From 646ffb35adb42f1fcb1a04d199d8fb3ca07b2038 Mon Sep 17 00:00:00 2001 From: LostLuma Date: Fri, 25 Oct 2024 14:47:55 +0200 Subject: [PATCH 01/36] WIP Rust API server --- echo/.dockerignore | 2 + echo/.gitignore | 4 + echo/Cargo.lock | 3130 ++++++++++++++++++++++++++ echo/Cargo.toml | 23 + echo/Dockerfile | 56 + echo/README.md | 7 + echo/Rocket.toml | 8 + echo/docker-compose.yaml | 53 + echo/example.config.json | 3 + echo/schema/00-init.sh | 7 + echo/schema/01-base.sh | 36 + echo/src/bin/healthcheck.rs | 16 + echo/src/config.rs | 6 + echo/src/cors.rs | 45 + echo/src/database/background_task.rs | 58 + echo/src/database/mod.rs | 9 + echo/src/database/pastes.rs | 203 ++ echo/src/database/security.rs | 40 + echo/src/main.rs | 51 + echo/src/models/mod.rs | 2 + echo/src/models/pastes.rs | 157 ++ echo/src/models/security.rs | 7 + echo/src/result.rs | 26 + echo/src/routes/health.rs | 20 + echo/src/routes/mod.rs | 3 + echo/src/routes/pastes.rs | 40 + echo/src/routes/security.rs | 20 + echo/src/utils.rs | 35 + 28 files changed, 4067 insertions(+) create mode 100644 echo/.dockerignore create mode 100644 echo/.gitignore create mode 100644 echo/Cargo.lock create mode 100644 echo/Cargo.toml create mode 100644 echo/Dockerfile create mode 100644 echo/README.md create mode 100644 echo/Rocket.toml create mode 100644 echo/docker-compose.yaml create mode 100644 echo/example.config.json create mode 100644 echo/schema/00-init.sh create mode 100644 echo/schema/01-base.sh create mode 100644 echo/src/bin/healthcheck.rs create mode 100644 echo/src/config.rs create mode 100644 echo/src/cors.rs create mode 100644 echo/src/database/background_task.rs create mode 100644 echo/src/database/mod.rs create mode 100644 echo/src/database/pastes.rs create mode 100644 echo/src/database/security.rs create mode 100644 echo/src/main.rs create mode 100644 echo/src/models/mod.rs create mode 100644 echo/src/models/pastes.rs create mode 100644 echo/src/models/security.rs create mode 100644 echo/src/result.rs create mode 100644 echo/src/routes/health.rs create mode 100644 echo/src/routes/mod.rs create mode 100644 echo/src/routes/pastes.rs create mode 100644 echo/src/routes/security.rs create mode 100644 echo/src/utils.rs diff --git a/echo/.dockerignore b/echo/.dockerignore new file mode 100644 index 0000000..a7e1884 --- /dev/null +++ b/echo/.dockerignore @@ -0,0 +1,2 @@ +data/ +target/ diff --git a/echo/.gitignore b/echo/.gitignore new file mode 100644 index 0000000..ba09094 --- /dev/null +++ b/echo/.gitignore @@ -0,0 +1,4 @@ +.env +config.json +data/ +target/ diff --git a/echo/Cargo.lock b/echo/Cargo.lock new file mode 100644 index 0000000..9923e9d --- /dev/null +++ b/echo/Cargo.lock @@ -0,0 +1,3130 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 3 + +[[package]] +name = "addr2line" +version = "0.24.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dfbe277e56a376000877090da837660b4427aad530e3028d44e0bffe4f89a1c1" +dependencies = [ + "gimli", +] + +[[package]] +name = "adler2" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "512761e0bb2578dd7380c6baaa0f4ce03e84f95e960231d1dec8bf4d7d6e2627" + +[[package]] +name = "ahash" +version = "0.8.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e89da841a80418a9b391ebaea17f5c112ffaaa96f621d2c285b5174da76b9011" +dependencies = [ + "cfg-if", + "getrandom", + "once_cell", + "version_check", + "zerocopy", +] + +[[package]] +name = "aho-corasick" +version = "1.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e60d3430d3a69478ad0993f19238d2df97c507009a52b3c10addcd7f6bcb916" +dependencies = [ + "memchr", +] + +[[package]] +name = "allocator-api2" +version = "0.2.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c6cb57a04249c6480766f7f7cef5467412af1490f8d1e243141daddada3264f" + +[[package]] +name = "android-tzdata" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e999941b234f3131b00bc13c22d06e8c5ff726d1b6318ac7eb276997bbb4fef0" + +[[package]] +name = "android_system_properties" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "819e7219dbd41043ac279b19830f2efc897156490d7fd6ea916720117ee66311" +dependencies = [ + "libc", +] + +[[package]] +name = "async-stream" +version = "0.3.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b5a71a6f37880a80d1d7f19efd781e4b5de42c88f0722cc13bcb6cc2cfe8476" +dependencies = [ + "async-stream-impl", + "futures-core", + "pin-project-lite", +] + +[[package]] +name = "async-stream-impl" +version = "0.3.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c7c24de15d275a1ecfd47a380fb4d5ec9bfe0933f309ed5e705b775596a3574d" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.79", +] + +[[package]] +name = "async-trait" +version = "0.1.83" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "721cae7de5c34fbb2acd27e21e6d2cf7b886dce0c27388d46c4e6c47ea4318dd" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.79", +] + +[[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" +version = "0.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c59bdb34bc650a32731b31bd8f0829cc15d24a708ee31559e0bb34f2bc320cba" + +[[package]] +name = "atomic" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8d818003e740b63afc82337e3160717f4f63078720a810b7b903e70a5d1d2994" +dependencies = [ + "bytemuck", +] + +[[package]] +name = "autocfg" +version = "1.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ace50bade8e6234aa140d9a2f552bbee1db4d353f69b8217bc503490fc1a9f26" + +[[package]] +name = "backtrace" +version = "0.3.74" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8d82cb332cdfaed17ae235a638438ac4d4839913cc2af585c3c6746e8f8bee1a" +dependencies = [ + "addr2line", + "cfg-if", + "libc", + "miniz_oxide", + "object", + "rustc-demangle", + "windows-targets 0.52.6", +] + +[[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.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8c3c1a368f70d6cf7302d78f8f7093da241fb8e8807c05cc9e51a125895a6d5b" + +[[package]] +name = "binascii" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "383d29d513d8764dcdc42ea295d979eb99c3c9f00607b3692cf68a431f7dca72" + +[[package]] +name = "bitflags" +version = "2.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b048fb63fd8b5923fc5aa7b340d8e156aec7ec02f0c78fa8a6ddc2613f6f71de" +dependencies = [ + "serde", +] + +[[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.16.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "79296716171880943b8470b5f8d03aa55eb2e645a4874bdbb28adb49162e012c" + +[[package]] +name = "bytemuck" +version = "1.19.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8334215b81e418a0a7bdb8ef0849474f40bb10c8b71f1c4ed315cff49f32494d" + +[[package]] +name = "byteorder" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" + +[[package]] +name = "bytes" +version = "1.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "428d9aa8fbc0670b7b8d6030a7fadd0f86151cae55e4dbbece15f3780a3dfaf3" + +[[package]] +name = "cc" +version = "1.1.30" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b16803a61b81d9eabb7eae2588776c4c1e584b738ede45fdbb4c972cec1e9945" +dependencies = [ + "shlex", +] + +[[package]] +name = "cfg-if" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" + +[[package]] +name = "chrono" +version = "0.4.38" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a21f936df1771bf62b77f047b726c4625ff2e8aa607c01ec06e5a05bd8463401" +dependencies = [ + "android-tzdata", + "iana-time-zone", + "js-sys", + "num-traits", + "serde", + "wasm-bindgen", + "windows-targets 0.52.6", +] + +[[package]] +name = "const-oid" +version = "0.9.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c2459377285ad874054d797f3ccebf984978aa39129f6eafde5cdc8315b612f8" + +[[package]] +name = "cookie" +version = "0.18.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4ddef33a339a91ea89fb53151bd0a4689cfce27055c291dfa69945475d22c747" +dependencies = [ + "percent-encoding", + "time", + "version_check", +] + +[[package]] +name = "core-foundation" +version = "0.9.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "91e195e091a93c46f7102ec7818a2aa394e1e1771c3ab4825963fa03e45afb8f" +dependencies = [ + "core-foundation-sys", + "libc", +] + +[[package]] +name = "core-foundation-sys" +version = "0.8.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "773648b94d0e5d620f64f280777445740e61fe701025087ec8b57f45c791888b" + +[[package]] +name = "cpufeatures" +version = "0.2.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "608697df725056feaccfa42cffdaeeec3fccc4ffc38358ecd19b243e716a78e0" +dependencies = [ + "libc", +] + +[[package]] +name = "crc" +version = "3.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "69e6e4d7b33a94f0991c26729976b10ebde1d34c3ee82408fb536164fa10d636" +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 = "crossbeam-queue" +version = "0.3.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "df0346b5d5e76ac2fe4e327c5fd1118d6be7c51dfb18f9b7922923f287471e35" +dependencies = [ + "crossbeam-utils", +] + +[[package]] +name = "crossbeam-utils" +version = "0.8.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "22ec99545bb0ed0ea7bb9b8e1e9122ea386ff8a48c0922e43f36d45ab09e0e80" + +[[package]] +name = "crypto-common" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3" +dependencies = [ + "generic-array", + "typenum", +] + +[[package]] +name = "der" +version = "0.7.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f55bf8e7b65898637379c1b74eb1551107c8294ed26d855ceb9fd1a09cfc9bc0" +dependencies = [ + "const-oid", + "pem-rfc7468", + "zeroize", +] + +[[package]] +name = "deranged" +version = "0.3.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b42b6fa04a440b495c8b04d0e71b707c585f83cb9cb28cf8cd0d976c315e31b4" +dependencies = [ + "powerfmt", +] + +[[package]] +name = "devise" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f1d90b0c4c777a2cad215e3c7be59ac7c15adf45cf76317009b7d096d46f651d" +dependencies = [ + "devise_codegen", + "devise_core", +] + +[[package]] +name = "devise_codegen" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "71b28680d8be17a570a2334922518be6adc3f58ecc880cbb404eaeb8624fd867" +dependencies = [ + "devise_core", + "quote", +] + +[[package]] +name = "devise_core" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b035a542cf7abf01f2e3c4d5a7acbaebfefe120ae4efc7bde3df98186e4b8af7" +dependencies = [ + "bitflags", + "proc-macro2", + "proc-macro2-diagnostics", + "quote", + "syn 2.0.79", +] + +[[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 = "dotenvy" +version = "0.15.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1aaf95b3e5c8f23aa320147307562d361db0ae0d51242340f558153b4eb2439b" + +[[package]] +name = "echo" +version = "1.0.0" +dependencies = [ + "chrono", + "figment", + "rand", + "reqwest", + "rocket", + "rocket-validation", + "rocket_db_pools", + "serde", + "sqlx", + "tokio", + "validator", +] + +[[package]] +name = "either" +version = "1.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "60b1af1c220855b6ceac025d3f6ecdd2b7c4894bfe9cd9bda4fbb4bc7c0d4cf0" +dependencies = [ + "serde", +] + +[[package]] +name = "encoding_rs" +version = "0.8.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b45de904aa0b010bce2ab45264d0631681847fa7b6f2eaa7dab7619943bc4f59" +dependencies = [ + "cfg-if", +] + +[[package]] +name = "equivalent" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" + +[[package]] +name = "errno" +version = "0.3.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "534c5cf6194dfab3db3242765c03bbe257cf92f22b38f6bc0c58d59108a820ba" +dependencies = [ + "libc", + "windows-sys 0.52.0", +] + +[[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.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e8c02a5121d4ea3eb16a80748c74f5549a5665e4c21333c6098f283870fbdea6" + +[[package]] +name = "figment" +version = "0.10.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8cb01cd46b0cf372153850f4c6c272d9cbea2da513e07538405148f95bd789f3" +dependencies = [ + "atomic 0.6.0", + "pear", + "serde", + "serde_json", + "toml", + "uncased", + "version_check", +] + +[[package]] +name = "flume" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "55ac459de2512911e4b674ce33cf20befaba382d05b62b008afc1c8b57cbf181" +dependencies = [ + "futures-core", + "futures-sink", + "spin", +] + +[[package]] +name = "fnv" +version = "1.0.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" + +[[package]] +name = "foreign-types" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f6f339eb8adc052cd2ca78910fda869aefa38d22d5cb648e6485e4d3fc06f3b1" +dependencies = [ + "foreign-types-shared", +] + +[[package]] +name = "foreign-types-shared" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b" + +[[package]] +name = "form_urlencoded" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e13624c2627564efccf4934284bdd98cbaa14e79b0b5a141218e507b3a823456" +dependencies = [ + "percent-encoding", +] + +[[package]] +name = "futures" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "65bc07b1a8bc7c85c5f2e110c476c7389b4554ba72af57d8445ea63a576b0876" +dependencies = [ + "futures-channel", + "futures-core", + "futures-io", + "futures-sink", + "futures-task", + "futures-util", +] + +[[package]] +name = "futures-channel" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2dff15bf788c671c1934e366d07e30c1814a8ef514e1af724a602e8a2fbe1b10" +dependencies = [ + "futures-core", + "futures-sink", +] + +[[package]] +name = "futures-core" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "05f29059c0c2090612e8d742178b0580d2dc940c837851ad723096f87af6663e" + +[[package]] +name = "futures-executor" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e28d1d997f585e54aebc3f97d39e72338912123a67330d723fdbb564d646c9f" +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.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9e5c1b78ca4aae1ac06c48a526a655760685149f0d465d21f37abfe57ce075c6" + +[[package]] +name = "futures-sink" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e575fab7d1e0dcb8d0c7bcf9a63ee213816ab51902e6d244a95819acacf1d4f7" + +[[package]] +name = "futures-task" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f90f7dce0722e95104fcb095585910c0977252f286e354b5e3bd38902cd99988" + +[[package]] +name = "futures-util" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9fa08315bb612088cc391249efdc3bc77536f16c91f6cf495e6fbe85b20a4a81" +dependencies = [ + "futures-channel", + "futures-core", + "futures-io", + "futures-sink", + "futures-task", + "memchr", + "pin-project-lite", + "pin-utils", + "slab", +] + +[[package]] +name = "generator" +version = "0.7.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5cc16584ff22b460a382b7feec54b23d2908d858152e5739a120b949293bd74e" +dependencies = [ + "cc", + "libc", + "log", + "rustversion", + "windows", +] + +[[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.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c4567c8db10ae91089c99af84c68c38da3ec2f087c3f82960bcdbf3656b6f4d7" +dependencies = [ + "cfg-if", + "libc", + "wasi", +] + +[[package]] +name = "gimli" +version = "0.31.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "07e28edb80900c19c28f1072f2e8aeca7fa06b23cd4169cefe1af5aa3260783f" + +[[package]] +name = "glob" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d2fabcfbdc87f4758337ca535fb41a6d701b65693ce38287d856d1674551ec9b" + +[[package]] +name = "h2" +version = "0.3.26" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "81fe527a889e1532da5c525686d96d4c2e74cdd345badf8dfef9f6b39dd5f5e8" +dependencies = [ + "bytes", + "fnv", + "futures-core", + "futures-sink", + "futures-util", + "http 0.2.12", + "indexmap", + "slab", + "tokio", + "tokio-util", + "tracing", +] + +[[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.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e087f84d4f86bf4b218b927129862374b72199ae7d8657835f1e89000eea4fb" + +[[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 = "hermit-abi" +version = "0.3.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d231dfb89cfffdbc30e7fc41579ed6066ad03abda9e567ccafae602b97ec5024" + +[[package]] +name = "hermit-abi" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fbf6a919d6cf397374f7dfeeea91d974c7c0a7221d0d0f4f20d859d329e53fcc" + +[[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.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3d1354bf6b7235cb4a0576c2619fd4ed18183f689b12b006a0ee7329eeff9a5" +dependencies = [ + "windows-sys 0.52.0", +] + +[[package]] +name = "http" +version = "0.2.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "601cbb57e577e2f5ef5be8e7b83f0f63994f25aa94d673e54a92d5c516d101f1" +dependencies = [ + "bytes", + "fnv", + "itoa", +] + +[[package]] +name = "http" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "21b9ddb458710bc376481b842f5da65cdf31522de232c1ca8146abce2a358258" +dependencies = [ + "bytes", + "fnv", + "itoa", +] + +[[package]] +name = "http-body" +version = "0.4.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7ceab25649e9960c0311ea418d17bee82c0dcec1bd053b5f9a66e265a693bed2" +dependencies = [ + "bytes", + "http 0.2.12", + "pin-project-lite", +] + +[[package]] +name = "http-body" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1efedce1fb8e6913f23e0c92de8e62cd5b772a67e7b3946df930a62566c93184" +dependencies = [ + "bytes", + "http 1.1.0", +] + +[[package]] +name = "http-body-util" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "793429d76616a256bcb62c2a2ec2bed781c8307e797e2598c50010f2bee2544f" +dependencies = [ + "bytes", + "futures-util", + "http 1.1.0", + "http-body 1.0.1", + "pin-project-lite", +] + +[[package]] +name = "httparse" +version = "1.9.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7d71d3574edd2771538b901e6549113b4006ece66150fb69c0fb6d9a2adae946" + +[[package]] +name = "httpdate" +version = "1.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "df3b46402a9d5adb4c86a0cf463f42e19994e3ee891101b1841f30a545cb49a9" + +[[package]] +name = "hyper" +version = "0.14.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8c08302e8fa335b151b788c775ff56e7a03ae64ff85c548ee820fecb70356e85" +dependencies = [ + "bytes", + "futures-channel", + "futures-core", + "futures-util", + "h2", + "http 0.2.12", + "http-body 0.4.6", + "httparse", + "httpdate", + "itoa", + "pin-project-lite", + "socket2", + "tokio", + "tower-service", + "tracing", + "want", +] + +[[package]] +name = "hyper" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bbbff0a806a4728c99295b254c8838933b5b082d75e3cb70c8dab21fdfbcfa9a" +dependencies = [ + "bytes", + "futures-channel", + "futures-util", + "http 1.1.0", + "http-body 1.0.1", + "httparse", + "itoa", + "pin-project-lite", + "smallvec", + "tokio", + "want", +] + +[[package]] +name = "hyper-tls" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "70206fc6890eaca9fde8a0bf71caa2ddfc9fe045ac9e5c70df101a7dbde866e0" +dependencies = [ + "bytes", + "http-body-util", + "hyper 1.5.0", + "hyper-util", + "native-tls", + "tokio", + "tokio-native-tls", + "tower-service", +] + +[[package]] +name = "hyper-util" +version = "0.1.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "41296eb09f183ac68eec06e03cdbea2e759633d4067b2f6552fc2e009bcad08b" +dependencies = [ + "bytes", + "futures-channel", + "futures-util", + "http 1.1.0", + "http-body 1.0.1", + "hyper 1.5.0", + "pin-project-lite", + "socket2", + "tokio", + "tower-service", + "tracing", +] + +[[package]] +name = "iana-time-zone" +version = "0.1.61" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "235e081f3925a06703c2d0117ea8b91f042756fd6e7a6e5d901e8ca1a996b220" +dependencies = [ + "android_system_properties", + "core-foundation-sys", + "iana-time-zone-haiku", + "js-sys", + "wasm-bindgen", + "windows-core", +] + +[[package]] +name = "iana-time-zone-haiku" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f31827a206f56af32e590ba56d5d2d085f558508192593743f16b2306495269f" +dependencies = [ + "cc", +] + +[[package]] +name = "idna" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7d20d6b07bfbc108882d88ed8e37d39636dcc260e15e30c45e6ba089610b917c" +dependencies = [ + "unicode-bidi", + "unicode-normalization", +] + +[[package]] +name = "idna" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "634d9b1461af396cad843f47fdba5597a4f9e6ddd4bfb6ff5d85028c25cb12f6" +dependencies = [ + "unicode-bidi", + "unicode-normalization", +] + +[[package]] +name = "if_chain" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cb56e1aa765b4b4f3aadfab769793b7087bb03a4ea4920644a6d238e2df5b9ed" + +[[package]] +name = "indexmap" +version = "2.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "707907fe3c25f5424cce2cb7e1cbcafee6bdbe735ca90ef77c29e84591e5b9da" +dependencies = [ + "equivalent", + "hashbrown 0.15.0", + "serde", +] + +[[package]] +name = "inlinable_string" +version = "0.1.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c8fae54786f62fb2918dcfae3d568594e50eb9b5c25bf04371af6fe7516452fb" + +[[package]] +name = "ipnet" +version = "2.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ddc24109865250148c2e0f3d25d4f0f479571723792d3802153c60922a4fb708" + +[[package]] +name = "is-terminal" +version = "0.4.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "261f68e344040fbd0edea105bef17c66edf46f984ddb1115b775ce31be948f4b" +dependencies = [ + "hermit-abi 0.4.0", + "libc", + "windows-sys 0.52.0", +] + +[[package]] +name = "itoa" +version = "1.0.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "49f1f14873335454500d59611f1cf4a4b0f786f9ac11f4312a78e4cf2566695b" + +[[package]] +name = "js-sys" +version = "0.3.72" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6a88f1bda2bd75b0452a14784937d796722fdebfe50df998aeb3f0b7603019a9" +dependencies = [ + "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 = "libc" +version = "0.2.161" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e9489c2807c139ffd9c1794f4af0ebe86a828db53ecdc7fea2111d0fed085d1" + +[[package]] +name = "libm" +version = "0.2.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4ec2a862134d2a7d32d7983ddcdd1c4923530833c9f2ea1a44fc5fa473989058" + +[[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.4.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "78b3ae25bc7c8c38cec158d1f2757ee79e9b3740fbc7ccf0e59e4b08d793fa89" + +[[package]] +name = "lock_api" +version = "0.4.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "07af8b9cdd281b7915f413fa73f29ebd5d55d0d3f0155584dade1ff18cea1b17" +dependencies = [ + "autocfg", + "scopeguard", +] + +[[package]] +name = "log" +version = "0.4.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a7a70ba024b9dc04c27ea2f0c0548feb474ec5c54bba33a7f72f873a39d07b24" + +[[package]] +name = "loom" +version = "0.5.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ff50ecb28bb86013e935fb6683ab1f6d3a20016f123c76fd4c27470076ac30f5" +dependencies = [ + "cfg-if", + "generator", + "scoped-tls", + "serde", + "serde_json", + "tracing", + "tracing-subscriber", +] + +[[package]] +name = "matchers" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8263075bb86c5a1b1427b5ae862e8889656f126e9f77c484496e8b47cf5c5558" +dependencies = [ + "regex-automata 0.1.10", +] + +[[package]] +name = "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.7.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3" + +[[package]] +name = "mime" +version = "0.3.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6877bb514081ee2a7ff5ef9de3281f14a4dd4bceac4c09388074a6b5df8a139a" + +[[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.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e2d80299ef12ff69b16a84bb182e3b9df68b5a91574d3d4fa6e41b65deec4df1" +dependencies = [ + "adler2", +] + +[[package]] +name = "mio" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "80e04d1dcff3aae0704555fe5fee3bcfaf3d1fdf8a7e521d5b9d2b42acb52cec" +dependencies = [ + "hermit-abi 0.3.9", + "libc", + "wasi", + "windows-sys 0.52.0", +] + +[[package]] +name = "multer" +version = "3.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "83e87776546dc87511aa5ee218730c92b666d7264ab6ed41f9d215af9cd5224b" +dependencies = [ + "bytes", + "encoding_rs", + "futures-util", + "http 1.1.0", + "httparse", + "memchr", + "mime", + "spin", + "tokio", + "tokio-util", + "version_check", +] + +[[package]] +name = "native-tls" +version = "0.2.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a8614eb2c83d59d1c8cc974dd3f920198647674a0a035e1af1fa58707e317466" +dependencies = [ + "libc", + "log", + "openssl", + "openssl-probe", + "openssl-sys", + "schannel", + "security-framework", + "security-framework-sys", + "tempfile", +] + +[[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.46.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77a8165726e8236064dbb45459242600304b42a5ea24ee2948e18e023bf7ba84" +dependencies = [ + "overload", + "winapi", +] + +[[package]] +name = "num-bigint-dig" +version = "0.8.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc84195820f291c7697304f3cbdadd1cb7199c0efc917ff5eafd71225c136151" +dependencies = [ + "byteorder", + "lazy_static", + "libm", + "num-integer", + "num-iter", + "num-traits", + "rand", + "smallvec", + "zeroize", +] + +[[package]] +name = "num-conv" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "51d515d32fb182ee37cda2ccdcb92950d6a3c2893aa280e540671c2cd0f3b1d9" + +[[package]] +name = "num-integer" +version = "0.1.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 = "num_cpus" +version = "1.16.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4161fcb6d602d4d2081af7c3a45852d875a03dd337a6bfdd6e06407b61342a43" +dependencies = [ + "hermit-abi 0.3.9", + "libc", +] + +[[package]] +name = "object" +version = "0.36.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aedf0a2d09c573ed1d8d85b30c119153926a2b36dce0ab28322c09a117a4683e" +dependencies = [ + "memchr", +] + +[[package]] +name = "once_cell" +version = "1.20.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1261fe7e33c73b354eab43b1273a57c8f967d0391e80353e51f764ac02cf6775" + +[[package]] +name = "openssl" +version = "0.10.68" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6174bc48f102d208783c2c84bf931bb75927a617866870de8a4ea85597f871f5" +dependencies = [ + "bitflags", + "cfg-if", + "foreign-types", + "libc", + "once_cell", + "openssl-macros", + "openssl-sys", +] + +[[package]] +name = "openssl-macros" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.79", +] + +[[package]] +name = "openssl-probe" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf" + +[[package]] +name = "openssl-src" +version = "300.3.2+3.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a211a18d945ef7e648cc6e0058f4c548ee46aab922ea203e0d30e966ea23647b" +dependencies = [ + "cc", +] + +[[package]] +name = "openssl-sys" +version = "0.9.104" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "45abf306cbf99debc8195b66b7346498d7b10c210de50418b5ccd7ceba08c741" +dependencies = [ + "cc", + "libc", + "openssl-src", + "pkg-config", + "vcpkg", +] + +[[package]] +name = "overload" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b15813163c1d831bf4a13c3610c05c0d03b39feb07f7e09fa234dac9b15aaf39" + +[[package]] +name = "parking_lot" +version = "0.12.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f1bf18183cf54e8d6059647fc3063646a1801cf30896933ec2311622cc4b9a27" +dependencies = [ + "lock_api", + "parking_lot_core", +] + +[[package]] +name = "parking_lot_core" +version = "0.9.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e401f977ab385c9e4e3ab30627d6f26d00e2c73eef317493c4ec6d468726cf8" +dependencies = [ + "cfg-if", + "libc", + "redox_syscall", + "smallvec", + "windows-targets 0.52.6", +] + +[[package]] +name = "paste" +version = "1.0.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "57c0d7b74b563b49d38dae00a0c37d4d6de9b432382b2892f0574ddcae73fd0a" + +[[package]] +name = "pear" +version = "0.2.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bdeeaa00ce488657faba8ebf44ab9361f9365a97bd39ffb8a60663f57ff4b467" +dependencies = [ + "inlinable_string", + "pear_codegen", + "yansi", +] + +[[package]] +name = "pear_codegen" +version = "0.2.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4bab5b985dc082b345f812b7df84e1bef27e7207b39e448439ba8bd69c93f147" +dependencies = [ + "proc-macro2", + "proc-macro2-diagnostics", + "quote", + "syn 2.0.79", +] + +[[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.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e" + +[[package]] +name = "pin-project-lite" +version = "0.2.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bda66fc9667c18cb2758a2ac84d1167245054bcf85d5d1aaa6923f45801bdd02" + +[[package]] +name = "pin-utils" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" + +[[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.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "953ec861398dccce10c670dfeaf3ec4911ca479e9c02154b3a215178c5f566f2" + +[[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.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77957b295656769bb8ad2b6a6b09d897d94f05c41b069aede1fcdaa675eaea04" +dependencies = [ + "zerocopy", +] + +[[package]] +name = "proc-macro-error" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "da25490ff9892aab3fcf7c36f08cfb902dd3e71ca0f9f9517bea02a73a5ce38c" +dependencies = [ + "proc-macro-error-attr", + "proc-macro2", + "quote", + "syn 1.0.109", + "version_check", +] + +[[package]] +name = "proc-macro-error-attr" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a1be40180e52ecc98ad80b184934baf3d0d29f979574e439af5a55274b35f869" +dependencies = [ + "proc-macro2", + "quote", + "version_check", +] + +[[package]] +name = "proc-macro2" +version = "1.0.88" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7c3a7fc5db1e57d5a779a352c8cdb57b29aa4c40cc69c3a68a7fedc815fbf2f9" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "proc-macro2-diagnostics" +version = "0.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "af066a9c399a26e020ada66a034357a868728e72cd426f3adcd35f80d88d88c8" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.79", + "version_check", + "yansi", +] + +[[package]] +name = "quote" +version = "1.0.37" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b5b9d34b8991d19d98081b46eacdd8eb58c6f2b201139f7c5f643cc155a633af" +dependencies = [ + "proc-macro2", +] + +[[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", +] + +[[package]] +name = "redox_syscall" +version = "0.5.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b6dfecf2c74bce2466cabf93f6664d6998a69eb21e39f4207930065b27b771f" +dependencies = [ + "bitflags", +] + +[[package]] +name = "ref-cast" +version = "1.0.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ccf0a6f84d5f1d581da8b41b47ec8600871962f2a528115b542b362d4b744931" +dependencies = [ + "ref-cast-impl", +] + +[[package]] +name = "ref-cast-impl" +version = "1.0.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bcc303e793d3734489387d205e9b186fac9c6cfacedd98cbb2e8a5943595f3e6" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.79", +] + +[[package]] +name = "regex" +version = "1.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "38200e5ee88914975b69f657f0801b6f6dccafd44fd9326302a4aaeecfacb1d8" +dependencies = [ + "aho-corasick", + "memchr", + "regex-automata 0.4.8", + "regex-syntax 0.8.5", +] + +[[package]] +name = "regex-automata" +version = "0.1.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c230d73fb8d8c1b9c0b3135c5142a8acee3a0558fb8db5cf1cb65f8d7862132" +dependencies = [ + "regex-syntax 0.6.29", +] + +[[package]] +name = "regex-automata" +version = "0.4.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "368758f23274712b504848e9d5a6f010445cc8b87a7cdb4d7cbee666c1288da3" +dependencies = [ + "aho-corasick", + "memchr", + "regex-syntax 0.8.5", +] + +[[package]] +name = "regex-syntax" +version = "0.6.29" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f162c6dd7b008981e4d40210aca20b4bd0f9b60ca9271061b07f78537722f2e1" + +[[package]] +name = "regex-syntax" +version = "0.8.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2b15c43186be67a4fd63bee50d0303afffcef381492ebe2c5d87f324e1b8815c" + +[[package]] +name = "reqwest" +version = "0.12.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f713147fbe92361e52392c73b8c9e48c04c6625bce969ef54dc901e58e042a7b" +dependencies = [ + "base64 0.22.1", + "bytes", + "futures-core", + "futures-util", + "http 1.1.0", + "http-body 1.0.1", + "http-body-util", + "hyper 1.5.0", + "hyper-tls", + "hyper-util", + "ipnet", + "js-sys", + "log", + "mime", + "native-tls", + "once_cell", + "percent-encoding", + "pin-project-lite", + "rustls-pemfile 2.2.0", + "serde", + "serde_json", + "serde_urlencoded", + "sync_wrapper", + "tokio", + "tokio-native-tls", + "tower-service", + "url", + "wasm-bindgen", + "wasm-bindgen-futures", + "web-sys", + "windows-registry", +] + +[[package]] +name = "ring" +version = "0.17.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c17fa4cb658e3583423e915b9f3acc01cceaee1860e33d59ebae66adc3a2dc0d" +dependencies = [ + "cc", + "cfg-if", + "getrandom", + "libc", + "spin", + "untrusted", + "windows-sys 0.52.0", +] + +[[package]] +name = "rocket" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a516907296a31df7dc04310e7043b61d71954d703b603cc6867a026d7e72d73f" +dependencies = [ + "async-stream", + "async-trait", + "atomic 0.5.3", + "binascii", + "bytes", + "either", + "figment", + "futures", + "indexmap", + "log", + "memchr", + "multer", + "num_cpus", + "parking_lot", + "pin-project-lite", + "rand", + "ref-cast", + "rocket_codegen", + "rocket_http", + "serde", + "serde_json", + "state", + "tempfile", + "time", + "tokio", + "tokio-stream", + "tokio-util", + "ubyte", + "version_check", + "yansi", +] + +[[package]] +name = "rocket-validation" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7b0bd0f76c16ddcc84567f362bdf9c0075968e096288da9a42bf1da9a3e42e47" +dependencies = [ + "rocket", + "validator", +] + +[[package]] +name = "rocket_codegen" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "575d32d7ec1a9770108c879fc7c47815a80073f96ca07ff9525a94fcede1dd46" +dependencies = [ + "devise", + "glob", + "indexmap", + "proc-macro2", + "quote", + "rocket_http", + "syn 2.0.79", + "unicode-xid", + "version_check", +] + +[[package]] +name = "rocket_db_pools" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c6578b2740ceee3e78bff63fe9299d964b7e68318446cdcb9af3b9cab46e1e9d" +dependencies = [ + "rocket", + "rocket_db_pools_codegen", + "sqlx", + "version_check", +] + +[[package]] +name = "rocket_db_pools_codegen" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "842e859f2e87a23efc0f81e25756c0fb43f18726e62daf99da7ea19fbc56cebd" +dependencies = [ + "devise", + "quote", +] + +[[package]] +name = "rocket_http" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e274915a20ee3065f611c044bd63c40757396b6dbc057d6046aec27f14f882b9" +dependencies = [ + "cookie", + "either", + "futures", + "http 0.2.12", + "hyper 0.14.31", + "indexmap", + "log", + "memchr", + "pear", + "percent-encoding", + "pin-project-lite", + "ref-cast", + "serde", + "smallvec", + "stable-pattern", + "state", + "time", + "tokio", + "uncased", +] + +[[package]] +name = "rsa" +version = "0.9.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5d0e5124fcb30e76a7e79bfee683a2746db83784b86289f6251b54b7950a0dfc" +dependencies = [ + "const-oid", + "digest", + "num-bigint-dig", + "num-integer", + "num-traits", + "pkcs1", + "pkcs8", + "rand_core", + "signature", + "spki", + "subtle", + "zeroize", +] + +[[package]] +name = "rustc-demangle" +version = "0.1.24" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "719b953e2095829ee67db738b3bfa9fa368c94900df327b3f07fe6e794d2fe1f" + +[[package]] +name = "rustix" +version = "0.38.37" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8acb788b847c24f28525660c4d7758620a7210875711f79e7f663cc152726811" +dependencies = [ + "bitflags", + "errno", + "libc", + "linux-raw-sys", + "windows-sys 0.52.0", +] + +[[package]] +name = "rustls" +version = "0.21.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f56a14d1f48b391359b22f731fd4bd7e43c97f3c50eee276f3aa09c94784d3e" +dependencies = [ + "ring", + "rustls-webpki", + "sct", +] + +[[package]] +name = "rustls-pemfile" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1c74cae0a4cf6ccbbf5f359f08efdf8ee7e1dc532573bf0db71968cb56b1448c" +dependencies = [ + "base64 0.21.7", +] + +[[package]] +name = "rustls-pemfile" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dce314e5fee3f39953d46bb63bb8a46d40c2f8fb7cc5a3b6cab2bde9721d6e50" +dependencies = [ + "rustls-pki-types", +] + +[[package]] +name = "rustls-pki-types" +version = "1.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "16f1201b3c9a7ee8039bcadc17b7e605e2945b27eee7631788c1bd2b0643674b" + +[[package]] +name = "rustls-webpki" +version = "0.101.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b6275d1ee7a1cd780b64aca7726599a1dbc893b1e64144529e55c3c2f745765" +dependencies = [ + "ring", + "untrusted", +] + +[[package]] +name = "rustversion" +version = "1.0.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0e819f2bc632f285be6d7cd36e25940d45b2391dd6d9b939e79de557f7014248" + +[[package]] +name = "ryu" +version = "1.0.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f3cb5ba0dc43242ce17de99c180e96db90b235b8a9fdc9543c96d2209116bd9f" + +[[package]] +name = "schannel" +version = "0.1.26" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "01227be5826fa0690321a2ba6c5cd57a19cf3f6a09e76973b58e61de6ab9d1c1" +dependencies = [ + "windows-sys 0.59.0", +] + +[[package]] +name = "scoped-tls" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e1cf6437eb19a8f4a6cc0f7dca544973b0b78843adbfeb3683d1a94a0024a294" + +[[package]] +name = "scopeguard" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" + +[[package]] +name = "sct" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "da046153aa2352493d6cb7da4b6e5c0c057d8a1d0a9aa8560baffdd945acd414" +dependencies = [ + "ring", + "untrusted", +] + +[[package]] +name = "security-framework" +version = "2.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "897b2245f0b511c87893af39b033e5ca9cce68824c4d7e7630b5a1d339658d02" +dependencies = [ + "bitflags", + "core-foundation", + "core-foundation-sys", + "libc", + "security-framework-sys", +] + +[[package]] +name = "security-framework-sys" +version = "2.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ea4a292869320c0272d7bc55a5a6aafaff59b4f63404a003887b679a2e05b4b6" +dependencies = [ + "core-foundation-sys", + "libc", +] + +[[package]] +name = "serde" +version = "1.0.210" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c8e3592472072e6e22e0a54d5904d9febf8508f65fb8552499a1abc7d1078c3a" +dependencies = [ + "serde_derive", +] + +[[package]] +name = "serde_derive" +version = "1.0.210" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "243902eda00fad750862fc144cea25caca5e20d615af0a81bee94ca738f1df1f" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.79", +] + +[[package]] +name = "serde_json" +version = "1.0.130" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "610f75ff4a8e3cb29b85da56eabdd1bff5b06739059a4b8e2967fef32e5d9944" +dependencies = [ + "itoa", + "memchr", + "ryu", + "serde", +] + +[[package]] +name = "serde_spanned" +version = "0.6.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "87607cb1398ed59d48732e575a4c28a7a8ebf2454b964fe3f224f2afc07909e1" +dependencies = [ + "serde", +] + +[[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.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "793db75ad2bcafc3ffa7c68b215fee268f537982cd901d132f89c6343f3a3dc8" +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.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a9e9e0b4211b72e7b8b6e85c807d36c212bdb33ea8587f7569562a84df5465b1" +dependencies = [ + "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 = "slab" +version = "0.4.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f92a496fb766b417c996b9c5e57daf2f7ad3b0bebe1ccfca4856390e3d3bb67" +dependencies = [ + "autocfg", +] + +[[package]] +name = "smallvec" +version = "1.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67" + +[[package]] +name = "socket2" +version = "0.5.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ce305eb0b4296696835b71df73eb912e0f1ffd2556a501fcede6e0c50349191c" +dependencies = [ + "libc", + "windows-sys 0.52.0", +] + +[[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", + "rustls", + "rustls-pemfile 1.0.4", + "serde", + "serde_json", + "sha2", + "smallvec", + "sqlformat", + "thiserror", + "tokio", + "tokio-stream", + "tracing", + "url", + "webpki-roots", +] + +[[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", + "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-pattern" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4564168c00635f88eaed410d5efa8131afa8d8699a612c80c455a0ba05c21045" +dependencies = [ + "memchr", +] + +[[package]] +name = "state" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2b8c4a4445d81357df8b1a650d0d0d6fbbbfe99d064aa5e02f3e4022061476d8" +dependencies = [ + "loom", +] + +[[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.79" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "89132cd0bf050864e1d38dc3bbc07a0eb8e7530af26344d3d2bbbef83499f590" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "sync_wrapper" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a7065abeca94b6a8a577f9bd45aa0867a2238b74e8eb67cf10d492bc39351394" +dependencies = [ + "futures-core", +] + +[[package]] +name = "tempfile" +version = "3.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f0f2c9fc62d0beef6951ccffd757e241266a2c833136efbe35af6cd2567dca5b" +dependencies = [ + "cfg-if", + "fastrand", + "once_cell", + "rustix", + "windows-sys 0.59.0", +] + +[[package]] +name = "thiserror" +version = "1.0.64" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d50af8abc119fb8bb6dbabcfa89656f46f84aa0ac7688088608076ad2b459a84" +dependencies = [ + "thiserror-impl", +] + +[[package]] +name = "thiserror-impl" +version = "1.0.64" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "08904e7672f5eb876eaaf87e0ce17857500934f4981c4a0ab2b4aa98baac7fc3" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.79", +] + +[[package]] +name = "thread_local" +version = "1.1.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b9ef9bad013ada3808854ceac7b46812a6465ba368859a37e2100283d2d719c" +dependencies = [ + "cfg-if", + "once_cell", +] + +[[package]] +name = "time" +version = "0.3.36" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5dfd88e563464686c916c7e46e623e520ddc6d79fa6641390f2e3fa86e83e885" +dependencies = [ + "deranged", + "itoa", + "num-conv", + "powerfmt", + "serde", + "time-core", + "time-macros", +] + +[[package]] +name = "time-core" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ef927ca75afb808a4d64dd374f00a2adf8d0fcff8e7b184af886c3c87ec4a3f3" + +[[package]] +name = "time-macros" +version = "0.2.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f252a68540fde3a3877aeea552b832b40ab9a69e318efd078774a01ddee1ccf" +dependencies = [ + "num-conv", + "time-core", +] + +[[package]] +name = "tinyvec" +version = "1.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "445e881f4f6d382d5f27c034e25eb92edd7c784ceab92a0937db7f2e9471b938" +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.40.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e2b070231665d27ad9ec9b8df639893f46727666c6767db40317fbe920a5d998" +dependencies = [ + "backtrace", + "bytes", + "libc", + "mio", + "pin-project-lite", + "signal-hook-registry", + "socket2", + "tokio-macros", + "windows-sys 0.52.0", +] + +[[package]] +name = "tokio-macros" +version = "2.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "693d596312e88961bc67d7f1f97af8a70227d9f90c31bba5806eec004978d752" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.79", +] + +[[package]] +name = "tokio-native-tls" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bbae76ab933c85776efabc971569dd6119c580d8f5d448769dec1764bf796ef2" +dependencies = [ + "native-tls", + "tokio", +] + +[[package]] +name = "tokio-stream" +version = "0.1.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4f4e6ce100d0eb49a2734f8c0812bcd324cf357d21810932c5df6b96ef2b86f1" +dependencies = [ + "futures-core", + "pin-project-lite", + "tokio", +] + +[[package]] +name = "tokio-util" +version = "0.7.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "61e7c3654c13bcd040d4a03abee2c75b1d14a37b423cf5a813ceae1cc903ec6a" +dependencies = [ + "bytes", + "futures-core", + "futures-sink", + "pin-project-lite", + "tokio", +] + +[[package]] +name = "toml" +version = "0.8.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a1ed1f98e3fdc28d6d910e6737ae6ab1a93bf1985935a1193e68f93eeb68d24e" +dependencies = [ + "serde", + "serde_spanned", + "toml_datetime", + "toml_edit", +] + +[[package]] +name = "toml_datetime" +version = "0.6.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0dd7358ecb8fc2f8d014bf86f6f638ce72ba252a2c3a2572f2a795f1d23efb41" +dependencies = [ + "serde", +] + +[[package]] +name = "toml_edit" +version = "0.22.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4ae48d6208a266e853d946088ed816055e556cc6028c5e8e2b84d9fa5dd7c7f5" +dependencies = [ + "indexmap", + "serde", + "serde_spanned", + "toml_datetime", + "winnow", +] + +[[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.40" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c3523ab5a71916ccf420eebdf5521fcef02141234bbc0b8a49f2fdc4544364ef" +dependencies = [ + "log", + "pin-project-lite", + "tracing-attributes", + "tracing-core", +] + +[[package]] +name = "tracing-attributes" +version = "0.1.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.79", +] + +[[package]] +name = "tracing-core" +version = "0.1.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c06d3da6113f116aaee68e4d601191614c9053067f9ab7f6edbcb161237daa54" +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.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ad0f048c97dbd9faa9b7df56362b8ebcaa52adb06b498c050d2f4e32f90a7a8b" +dependencies = [ + "matchers", + "nu-ansi-term", + "once_cell", + "regex", + "sharded-slab", + "smallvec", + "thread_local", + "tracing", + "tracing-core", + "tracing-log", +] + +[[package]] +name = "try-lock" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e421abadd41a4225275504ea4d6566923418b7f05506fbc9c0fe86ba7396114b" + +[[package]] +name = "typenum" +version = "1.17.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "42ff0bf0c66b8238c6f3b578df37d0b7848e55df8577b3f74f92a69acceeb825" + +[[package]] +name = "ubyte" +version = "0.10.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f720def6ce1ee2fc44d40ac9ed6d3a59c361c80a75a7aa8e75bb9baed31cf2ea" +dependencies = [ + "serde", +] + +[[package]] +name = "uncased" +version = "0.9.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e1b88fcfe09e89d3866a5c11019378088af2d24c3fbd4f0543f96b479ec90697" +dependencies = [ + "serde", + "version_check", +] + +[[package]] +name = "unicode-bidi" +version = "0.3.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5ab17db44d7388991a428b2ee655ce0c212e862eff1768a455c58f9aad6e7893" + +[[package]] +name = "unicode-ident" +version = "1.0.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e91b56cd4cadaeb79bbf1a5645f6b4f8dc5bde8834ad5894a8db35fda9efa1fe" + +[[package]] +name = "unicode-normalization" +version = "0.1.24" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5033c97c4262335cded6d6fc3e5c18ab755e1a3dc96376350f3d8e9f009ad956" +dependencies = [ + "tinyvec", +] + +[[package]] +name = "unicode-properties" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e70f2a8b45122e719eb623c01822704c4e0907e7e426a05927e1a1cfff5b75d0" + +[[package]] +name = "unicode-segmentation" +version = "1.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f6ccf251212114b54433ec949fd6a7841275f9ada20dddd2f29e9ceea4501493" + +[[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 = "untrusted" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8ecb6da28b8a351d773b68d5825ac39017e680750f980f3a1a85cd8dd28a47c1" + +[[package]] +name = "url" +version = "2.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "22784dbdf76fdde8af1aeda5622b546b422b6fc585325248a2bf9f5e41e94d6c" +dependencies = [ + "form_urlencoded", + "idna 0.5.0", + "percent-encoding", +] + +[[package]] +name = "urlencoding" +version = "2.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "daf8dba3b7eb870caf1ddeed7bc9d2a049f3cfdfae7cb521b087cc33ae4c49da" + +[[package]] +name = "validator" +version = "0.16.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b92f40481c04ff1f4f61f304d61793c7b56ff76ac1469f1beb199b1445b253bd" +dependencies = [ + "idna 0.4.0", + "lazy_static", + "regex", + "serde", + "serde_derive", + "serde_json", + "url", + "validator_derive", +] + +[[package]] +name = "validator_derive" +version = "0.16.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bc44ca3088bb3ba384d9aecf40c6a23a676ce23e09bdaca2073d99c207f864af" +dependencies = [ + "if_chain", + "lazy_static", + "proc-macro-error", + "proc-macro2", + "quote", + "regex", + "syn 1.0.109", + "validator_types", +] + +[[package]] +name = "validator_types" +version = "0.16.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "111abfe30072511849c5910134e8baf8dc05de4c0e5903d681cbd5c9c4d611e3" +dependencies = [ + "proc-macro2", + "syn 1.0.109", +] + +[[package]] +name = "valuable" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "830b7e5d4d90034032940e4ace0d9a9a057e7a45cd94e6c007832e39edb82f6d" + +[[package]] +name = "vcpkg" +version = "0.2.15" +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 = "want" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bfa7760aed19e106de2c7c0b581b509f2f25d3dacaf737cb82ac61bc6d760b0e" +dependencies = [ + "try-lock", +] + +[[package]] +name = "wasi" +version = "0.11.0+wasi-snapshot-preview1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" + +[[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.95" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "128d1e363af62632b8eb57219c8fd7877144af57558fb2ef0368d0087bddeb2e" +dependencies = [ + "cfg-if", + "once_cell", + "wasm-bindgen-macro", +] + +[[package]] +name = "wasm-bindgen-backend" +version = "0.2.95" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cb6dd4d3ca0ddffd1dd1c9c04f94b868c37ff5fac97c30b97cff2d74fce3a358" +dependencies = [ + "bumpalo", + "log", + "once_cell", + "proc-macro2", + "quote", + "syn 2.0.79", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-futures" +version = "0.4.45" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cc7ec4f8827a71586374db3e87abdb5a2bb3a15afed140221307c3ec06b1f63b" +dependencies = [ + "cfg-if", + "js-sys", + "wasm-bindgen", + "web-sys", +] + +[[package]] +name = "wasm-bindgen-macro" +version = "0.2.95" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e79384be7f8f5a9dd5d7167216f022090cf1f9ec128e6e6a482a2cb5c5422c56" +dependencies = [ + "quote", + "wasm-bindgen-macro-support", +] + +[[package]] +name = "wasm-bindgen-macro-support" +version = "0.2.95" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "26c6ab57572f7a24a4985830b120de1594465e5d500f24afe89e16b4e833ef68" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.79", + "wasm-bindgen-backend", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-shared" +version = "0.2.95" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "65fc09f10666a9f147042251e0dda9c18f166ff7de300607007e96bdebc1068d" + +[[package]] +name = "web-sys" +version = "0.3.72" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f6488b90108c040df0fe62fa815cbdee25124641df01814dd7282749234c6112" +dependencies = [ + "js-sys", + "wasm-bindgen", +] + +[[package]] +name = "webpki-roots" +version = "0.25.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5f20c57d8d7db6d3b86154206ae5d8fba62dd39573114de97c2cb0578251f8e1" + +[[package]] +name = "whoami" +version = "1.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "372d5b87f58ec45c384ba03563b03544dc5fadc3983e434b286913f5b4a9bb6d" +dependencies = [ + "redox_syscall", + "wasite", +] + +[[package]] +name = "winapi" +version = "0.3.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" +dependencies = [ + "winapi-i686-pc-windows-gnu", + "winapi-x86_64-pc-windows-gnu", +] + +[[package]] +name = "winapi-i686-pc-windows-gnu" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" + +[[package]] +name = "winapi-x86_64-pc-windows-gnu" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" + +[[package]] +name = "windows" +version = "0.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e686886bc078bc1b0b600cac0147aadb815089b6e4da64016cbd754b6342700f" +dependencies = [ + "windows-targets 0.48.5", +] + +[[package]] +name = "windows-core" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "33ab640c8d7e35bf8ba19b884ba838ceb4fba93a4e8c65a9059d08afcfc683d9" +dependencies = [ + "windows-targets 0.52.6", +] + +[[package]] +name = "windows-registry" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e400001bb720a623c1c69032f8e3e4cf09984deec740f007dd2b03ec864804b0" +dependencies = [ + "windows-result", + "windows-strings", + "windows-targets 0.52.6", +] + +[[package]] +name = "windows-result" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d1043d8214f791817bab27572aaa8af63732e11bf84aa21a45a78d6c317ae0e" +dependencies = [ + "windows-targets 0.52.6", +] + +[[package]] +name = "windows-strings" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4cd9b125c486025df0eabcb585e62173c6c9eddcec5d117d3b6e8c30e2ee4d10" +dependencies = [ + "windows-result", + "windows-targets 0.52.6", +] + +[[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.59.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e38bc4d79ed67fd075bcc251a1c39b32a1776bbe92e5bef1f0bf1f8c531853b" +dependencies = [ + "windows-targets 0.52.6", +] + +[[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 = "winnow" +version = "0.6.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "36c1fec1a2bb5866f07c25f68c26e565c4c200aebb96d7e55710c19d3e8ac49b" +dependencies = [ + "memchr", +] + +[[package]] +name = "yansi" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cfe53a6657fd280eaa890a3bc59152892ffa3e30101319d168b781ed6529b049" +dependencies = [ + "is-terminal", +] + +[[package]] +name = "zerocopy" +version = "0.7.35" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1b9b4fd18abc82b8136838da5d50bae7bdea537c574d8dc1a34ed098d6c166f0" +dependencies = [ + "byteorder", + "zerocopy-derive", +] + +[[package]] +name = "zerocopy-derive" +version = "0.7.35" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fa4f8080344d4671fb4e831a13ad1e68092748387dfc4f55e356242fae12ce3e" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.79", +] + +[[package]] +name = "zeroize" +version = "1.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ced3678a2879b30306d323f4542626697a464a97c0a07c9aebf7ebca65cd4dde" diff --git a/echo/Cargo.toml b/echo/Cargo.toml new file mode 100644 index 0000000..ea99ecd --- /dev/null +++ b/echo/Cargo.toml @@ -0,0 +1,23 @@ +[package] +name = "echo" +version = "1.0.0" +publish = false +edition = "2021" + +[dependencies] +chrono = { version = "0.4.38", features = ["serde"] } +figment = { version = "0.10.19", features = ["json"] } +rand = "0.8.5" +reqwest = { version = "0.12.8", default-features = false, features = ["json", "native-tls-vendored"] } +rocket = { version = "0.5.1", features = ["json"] } +rocket-validation = "0.2.0" +rocket_db_pools = { version = "0.2.0", features = ["sqlx_postgres"] } +serde = "1.0.210" +sqlx = { version = "0.7.4", features = ["chrono"] } +tokio = "1.40.0" +validator = "0.16.1" + +[profile.release] +lto = true +strip = true +codegen-units = 1 diff --git a/echo/Dockerfile b/echo/Dockerfile new file mode 100644 index 0000000..4b85fb2 --- /dev/null +++ b/echo/Dockerfile @@ -0,0 +1,56 @@ +FROM rust:latest AS build + +ARG PROFILE=release + +WORKDIR /build + +RUN mkdir bin && \ + apt update -y && apt upgrade -y && apt install -y musl-tools && \ + rustup target add x86_64-unknown-linux-musl + +# Mounting src using bind mount is slower for some reason +COPY src src +ENV RUSTFLAGS='-C target-feature=+crt-static' + +# NOTE: Due to caching this is actually faster than using +# Two separate cargo builds (one without source present). +RUN --mount=type=cache,target=target \ + --mount=type=cache,target=/usr/local/cargo/git \ + --mount=type=cache,target=/usr/local/cargo/registry \ + --mount=type=bind,source=Cargo.toml,target=Cargo.toml,readwrite \ + --mount=type=bind,source=Cargo.lock,target=Cargo.lock,readwrite \ + # Use musl target as the binary is about 1MiB smaller + cargo build --profile $PROFILE --target x86_64-unknown-linux-musl && \ + # The "dev" target directory is named "debug" instead + [ $PROFILE = "dev" ] && FOLDER="debug" || FOLDER="release"; \ + # Copy output into an unmounted directory for copying + cp target/x86_64-unknown-linux-musl/$FOLDER/echo /build/bin && \ + cp target/x86_64-unknown-linux-musl/$FOLDER/healthcheck /build/bin + +FROM scratch AS image + +ARG PROFILE + +LABEL org.opencontainers.image.title="MystBin Echo" +LABEL org.opencontainers.image.authors="Lilly Rose Berner " + +EXPOSE 8000 +WORKDIR /opt/echo + +# Non-empty value to enable +ENV RUST_BACKTRACE=$PROFILE + +ENV PATH=/opt/echo/bin +ENV ROCKET_CONFIG=/etc/opt/echo/Rocket.toml + +COPY Rocket.toml $ROCKET_CONFIG + +COPY --from=build /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ + +# Copy last so prior steps are cached doing many rebuilds +COPY --from=build /build/bin bin + +HEALTHCHECK --interval=5s --timeout=5s --retries=1 CMD ["healthcheck"] + +USER 101:101 +CMD ["echo"] diff --git a/echo/README.md b/echo/README.md new file mode 100644 index 0000000..7705140 --- /dev/null +++ b/echo/README.md @@ -0,0 +1,7 @@ +# Echo + +Run development environment: + +```sh +PROFILE=dev docker compose up --watch +``` diff --git a/echo/Rocket.toml b/echo/Rocket.toml new file mode 100644 index 0000000..5b8ab7f --- /dev/null +++ b/echo/Rocket.toml @@ -0,0 +1,8 @@ +[default] +ident = "Echo" + +address = "0.0.0.0" +ip_header = "x-forwarded-for" + +[default.databases.postgres] +url = "postgres://echo@db" diff --git a/echo/docker-compose.yaml b/echo/docker-compose.yaml new file mode 100644 index 0000000..b7dc7ab --- /dev/null +++ b/echo/docker-compose.yaml @@ -0,0 +1,53 @@ +name: echo + +services: + echo: + build: + context: . + args: + - PROFILE + cap_drop: + - ALL + networks: + - public + - hidden + ports: + - 127.0.0.1:${PORT:-8000}:8000 + restart: unless-stopped + depends_on: + db: + condition: service_healthy + configs: + - source: echo + target: /etc/opt/echo/config.json + environment: + - ECHO_CONFIG=/etc/opt/echo/config.json + develop: + watch: + - path: src/ + action: rebuild + + db: + image: postgres:17-alpine + networks: + - hidden + restart: unless-stopped + environment: + - POSTGRES_HOST_AUTH_METHOD=trust + volumes: + - ./schema:/docker-entrypoint-initdb.d + - ./data/postgres:/var/lib/postgresql/data + healthcheck: + test: ["CMD", "pg_isready", "-U", "echo"] + interval: 5s + timeout: 5s + start_period: 1m + +networks: + public: + hidden: + internal: true + +configs: + echo: + file: config.json diff --git a/echo/example.config.json b/echo/example.config.json new file mode 100644 index 0000000..68468f1 --- /dev/null +++ b/echo/example.config.json @@ -0,0 +1,3 @@ +{ + "allowed_hosts": ["http://localhost:1234", "https://mystb.in"] +} diff --git a/echo/schema/00-init.sh b/echo/schema/00-init.sh new file mode 100644 index 0000000..60152ec --- /dev/null +++ b/echo/schema/00-init.sh @@ -0,0 +1,7 @@ +#!/bin/sh +set -euf -o pipefail + +psql -v ON_ERROR_STOP=1 --username "postgres" --dbname "postgres" <<-EOSQL + CREATE ROLE echo WITH login; + CREATE DATABASE echo WITH OWNER echo; +EOSQL diff --git a/echo/schema/01-base.sh b/echo/schema/01-base.sh new file mode 100644 index 0000000..5a66f27 --- /dev/null +++ b/echo/schema/01-base.sh @@ -0,0 +1,36 @@ +#!/bin/sh +set -euf -o pipefail + +psql -v ON_ERROR_STOP=1 --username "echo" --dbname "echo" <<-EOSQL + CREATE EXTENSION IF NOT EXISTS pgcrypto; + + CREATE TABLE IF NOT EXISTS pastes ( + id TEXT PRIMARY KEY, + created_at TIMESTAMPTZ NOT NULL DEFAULT (CURRENT_TIMESTAMP AT TIME ZONE 'UTC'), + expires_at TIMESTAMPTZ, + views BIGINT NOT NULL DEFAULT 0, + max_views SMALLINT, + password TEXT, + safety TEXT UNIQUE + ); + + -- Index by safety keys for faster lookup to delete. + CREATE UNIQUE INDEX IF NOT EXISTS pastes_safety_idx ON pastes (safety); + + CREATE TABLE IF NOT EXISTS files ( + id BIGSERIAL PRIMARY KEY NOT NULL, + paste_id TEXT REFERENCES pastes(id) ON DELETE CASCADE, + name TEXT NOT NULL, + content TEXT NOT NULL, + lines INTEGER NOT NULL GENERATED ALWAYS AS (LENGTH(REGEXP_REPLACE(content, '[^\n]', '', 'g')) + 1) STORED, + characters INTEGER NOT NULL GENERATED ALWAYS AS (LENGTH(content)) STORED + ); + + CREATE TABLE IF NOT EXISTS annotations ( + id BIGSERIAL PRIMARY KEY NOT NULL, + file_id BIGINT REFERENCES files(id) ON DELETE CASCADE, + head INTEGER NOT NULL, + tail INTEGER NOT NULL, + content TEXT NOT NULL + ); +EOSQL diff --git a/echo/src/bin/healthcheck.rs b/echo/src/bin/healthcheck.rs new file mode 100644 index 0000000..3648e1f --- /dev/null +++ b/echo/src/bin/healthcheck.rs @@ -0,0 +1,16 @@ +use std::{ + io::{Read, Write}, + net::TcpStream, +}; + +fn main() { + let mut stream = TcpStream::connect("127.0.0.1:8000").expect("tcp connect"); + + let data = "GET /health HTTP/1.1\r\n\r\n"; + stream.write_all(data.as_bytes()).expect("write data"); + + let mut buffer = [0; 12]; + stream.read(&mut buffer).expect("read data"); + + assert!(buffer == "HTTP/1.1 200".as_bytes(), "response is not ok"); +} diff --git a/echo/src/config.rs b/echo/src/config.rs new file mode 100644 index 0000000..64816b6 --- /dev/null +++ b/echo/src/config.rs @@ -0,0 +1,6 @@ +use serde::{Deserialize, Serialize}; + +#[derive(Debug, Deserialize, Serialize)] +pub struct Config { + pub allowed_hosts: Vec, +} diff --git a/echo/src/cors.rs b/echo/src/cors.rs new file mode 100644 index 0000000..81f49cb --- /dev/null +++ b/echo/src/cors.rs @@ -0,0 +1,45 @@ +use rocket::{ + fairing::{Fairing, Info, Kind}, + http::Header, + options, Request, Response, +}; + +use crate::config::Config; + +// Ensure the server responds to all preflight requests +#[options("/<_..>")] +pub fn snatcher() {} + +pub struct CorsHeaders; + +#[rocket::async_trait] +impl Fairing for CorsHeaders { + fn info(&self) -> Info { + Info { + name: "CORS Headers", + kind: Kind::Response, + } + } + + async fn on_response<'r>(&self, request: &'r Request<'_>, response: &mut Response<'r>) { + let origin = match request.headers().get_one("Origin") { + Some(value) => value, + None => return, + }; + + let config = request.rocket().state::().unwrap(); + + if !config.allowed_hosts.iter().any(|x| x == origin) { + return; + } + + response.set_header(Header::new("Access-Control-Allow-Origin", origin)); + + response.set_header(Header::new( + "Access-Control-Allow-Methods", + "DELETE, GET, PATCH, POST, PUT, QUERY", + )); + response.set_header(Header::new("Access-Control-Max-Age", "86400")); + response.set_header(Header::new("Access-Control-Allow-Credentials", "true")); + } +} diff --git a/echo/src/database/background_task.rs b/echo/src/database/background_task.rs new file mode 100644 index 0000000..84ab789 --- /dev/null +++ b/echo/src/database/background_task.rs @@ -0,0 +1,58 @@ +use std::time::Duration; + +use rocket::{ + fairing::{self, Fairing, Info, Kind}, + Build, Rocket, +}; +use rocket_db_pools::{ + sqlx::{self}, + Database, +}; +use tokio::time; + +use super::PgDatabase; + +pub struct BackgroundTask; + +#[rocket::async_trait] +impl Fairing for BackgroundTask { + fn info(&self) -> Info { + Info { + name: "Database Cleanup Task", + kind: Kind::Ignite, + } + } + + async fn on_ignite(&self, rocket: Rocket) -> fairing::Result { + let mut interval = time::interval(Duration::from_secs(3600)); + let db = PgDatabase::fetch(&rocket).expect("database").0.clone(); + + tokio::spawn(async move { + loop { + match db.acquire().await { + Ok(mut conn) => { + let result = sqlx::query( + " + DELETE FROM pastes + WHERE views >= max_views OR expires_at <= NOW() + ", + ) + .execute(&mut *conn) + .await; + + if let Err(error) = result { + eprintln!("Failed to delete expired pastes! {}", error); + } + } + Err(error) => { + eprint!("Failed to acquire database connection! {}", error); + } + } + + interval.tick().await; + } + }); + + Ok(rocket) + } +} diff --git a/echo/src/database/mod.rs b/echo/src/database/mod.rs new file mode 100644 index 0000000..d78d998 --- /dev/null +++ b/echo/src/database/mod.rs @@ -0,0 +1,9 @@ +use rocket_db_pools::{sqlx, Database}; + +pub mod background_task; +pub mod pastes; +pub mod security; + +#[derive(Database)] +#[database("postgres")] +pub struct PgDatabase(sqlx::PgPool); diff --git a/echo/src/database/pastes.rs b/echo/src/database/pastes.rs new file mode 100644 index 0000000..ae6ed27 --- /dev/null +++ b/echo/src/database/pastes.rs @@ -0,0 +1,203 @@ +use crate::{ + models::pastes::{Annotation, CreatePaste, File, Paste}, + result::{HTTPError, Result}, + utils::generate_id, +}; +use rocket_db_pools::{ + sqlx::{self, Row}, + Connection, +}; +use sqlx::{postgres::PgRow, Acquire}; + +use super::PgDatabase; + +impl Paste { + pub async fn fetch<'r>( + conn: &mut Connection, + id: String, + password: Option<&'r str>, + ) -> Result { + let query = format!( + " + UPDATE + pastes + SET + views = views + 1 + WHERE + id = $1 AND + CASE WHEN max_views IS NULL THEN true ELSE views <= max_views END AND + CASE WHEN expires_at IS NULL THEN true ELSE expires_at > CURRENT_TIMESTAMP END AND + {} + RETURNING + created_at, expires_at, views, max_views + ", + match password { + None => "password IS NULL", + Some(_) => "password = CRYPT($2, password)", + }, + ); + + let result = sqlx::query(&query) + .bind(&id) + .bind(password) + .fetch_one(&mut ***conn) + .await; + + match result { + Ok(row) => { + let files = File::fetch(conn, &id).await?; + Ok(Paste::from_row(row, id, files, None)) + } + Err(_) => return Err(HTTPError::new(404, "Unknown paste or invalid password.")), + } + } + + pub async fn create<'r>( + conn: &mut Connection, + data: CreatePaste<'r>, + ) -> Result { + let mut tx = match (&mut **conn).begin().await { + Ok(tx) => tx, + Err(_) => return Err(HTTPError::new(500, "Failed to create paste.")), + }; + + let mut paste = loop { + let id = generate_id(20); + let safety = generate_id(64); + + let result = sqlx::query( + " + INSERT INTO pastes (id, expires_at, max_views, password, safety) + VALUES ($1, $2, $3, (SELECT CRYPT($4, gen_salt('bf')) WHERE $4 IS NOT NULL), $5) + RETURNING created_at, expires_at, views, max_views + ", + ) + .bind(&id) + .bind(data.expires_at()) + .bind(data.max_views()) + .bind(data.password()) + .bind(&safety) + .fetch_one(&mut *tx) + .await; + + match result { + Ok(row) => { + let files = Vec::with_capacity(data.files().len()); + break Paste::from_row(row, id, files, Some(safety)); + } + Err(error) => { + let inner = error.as_database_error(); + + // However unlikely it is, the id or safety was a duplicate. + if inner.is_some() && inner.unwrap().is_unique_violation() { + continue; + } + + return Err(HTTPError::new(500, "Failed to create paste.")); + } + } + }; + + for file in data.files() { + let result = sqlx::query( + " + INSERT INTO files (paste_id, name, content) + VALUES ($1, $2, $3) + RETURNING id, name, content, lines, characters + ", + ) + .bind(paste.id()) + .bind(file.name().or(Some("unknown"))) + .bind(file.content()) + .fetch_one(&mut *tx) + .await; + + match result { + Ok(row) => { + let _id: i64 = row.get("id"); + let annotations = Vec::new(); // TODO: Create and insert annotations + + paste.add_file(File::from_row(row, annotations)); + } + Err(_) => return Err(HTTPError::new(500, "Failed to create paste.")), + } + } + + match tx.commit().await { + Ok(_) => Ok(paste), + Err(_) => Err(HTTPError::new(500, "Failed to create paste.")), + } + } + + fn from_row(row: PgRow, id: String, files: Vec, safety: Option) -> Self { + let created_at = row.get("created_at"); + let expires_at = row.get("expires_at"); + + let views = row.get("views"); + let max_views = row.get("max_views"); + + Paste::new(id, created_at, expires_at, views, max_views, files, safety) + } +} + +impl File { + async fn fetch(conn: &mut Connection, paste_id: &str) -> Result> { + let result = sqlx::query( + " + SELECT id, name, content, lines, characters + FROM files + WHERE paste_id = $1 + ORDER BY id ASC + ", + ) + .bind(paste_id) + .fetch_all(&mut ***conn) + .await; + + let rows = match result { + Ok(rows) => rows, + Err(_) => return Err(HTTPError::new(500, "Unable to fetch paste files.")), + }; + + let mut files = Vec::with_capacity(rows.len()); + + for row in rows { + let id = row.get("id"); + let annotations = Annotation::fetch(conn, &id).await?; + + files.push(File::from_row(row, annotations)); + } + + Ok(files) + } + + fn from_row(row: PgRow, annotations: Vec) -> Self { + let name = row.get("name"); + let content = row.get("content"); + + let lines = row.get("lines"); + let characters = row.get("characters"); + + File::new(name, content, lines, characters, annotations) + } +} + +impl Annotation { + async fn fetch(conn: &mut Connection, file_id: &i64) -> Result> { + let result = sqlx::query_as::<_, Annotation>( + " + SELECT head, tail, content + FROM annotations + WHERE file_id = $1 + ORDER BY id ASC", + ) + .bind(file_id) + .fetch_all(&mut ***conn) + .await; + + match result { + Ok(annotations) => Ok(annotations), + Err(_) => return Err(HTTPError::new(500, "Unable to fetch file annotations.")), + } + } +} diff --git a/echo/src/database/security.rs b/echo/src/database/security.rs new file mode 100644 index 0000000..1a53ee5 --- /dev/null +++ b/echo/src/database/security.rs @@ -0,0 +1,40 @@ +use rocket_db_pools::{ + sqlx::{self}, + Connection, +}; + +use crate::{ + models::security::SparsePasteInfo, + result::{HTTPError, Result}, +}; + +use super::PgDatabase; + +impl SparsePasteInfo { + pub async fn get(mut conn: Connection, token: &str) -> Result { + let result = + sqlx::query_as::<_, SparsePasteInfo>("SELECT id FROM pastes WHERE safety = $1") + .bind(token) + .fetch_one(&mut **conn) + .await; + + match result { + Ok(result) => Ok(result), + Err(_) => Err(HTTPError::new(404, "Invalid safety token provided.")), + } + } + + pub async fn delete(mut conn: Connection, token: &str) -> Result { + let result = sqlx::query_as::<_, SparsePasteInfo>( + "DELETE FROM pastes WHERE safety = $1 RETURNING id", + ) + .bind(token) + .fetch_one(&mut **conn) + .await; + + match result { + Ok(result) => Ok(result), + Err(_) => Err(HTTPError::new(404, "Invalid safety token provided.")), + } + } +} diff --git a/echo/src/main.rs b/echo/src/main.rs new file mode 100644 index 0000000..c993a0c --- /dev/null +++ b/echo/src/main.rs @@ -0,0 +1,51 @@ +use std::env; + +use config::Config; +use cors::CorsHeaders; +use database::{background_task::BackgroundTask, PgDatabase}; +use figment::providers::{Format, Json}; +use rocket::{catchers, fairing::AdHoc, figment, routes}; +use rocket_db_pools::Database; +use routes::{health, pastes, security}; + +pub mod config; +pub mod cors; +pub mod database; +pub mod models; +pub mod result; +pub mod routes; +pub mod utils; + +#[rocket::launch] +fn rocket() -> _ { + let routes = routes![ + cors::snatcher, + health::health, + pastes::get_paste, + pastes::create_paste_simple, + pastes::create_paste_structured, + security::get_security, + security::delete_security, + ]; + + let version = env!("CARGO_PKG_VERSION"); + let user_agent = format!("Echo/{} (+https://mystb.in)", version); + + let client = reqwest::Client::builder() + .https_only(true) + .user_agent(user_agent) + .build() + .unwrap(); + + let path = env::var("ECHO_CONFIG").expect("ECHO_CONFIG not set"); + let provider = rocket::Config::figment().merge(Json::file(path)); + + rocket::custom(provider) + .manage(client) + .mount("/", routes) + .attach(PgDatabase::init()) + .attach(CorsHeaders) + .attach(BackgroundTask) + .attach(AdHoc::config::()) + .register("/", catchers![rocket_validation::validation_catcher]) +} diff --git a/echo/src/models/mod.rs b/echo/src/models/mod.rs new file mode 100644 index 0000000..29edf71 --- /dev/null +++ b/echo/src/models/mod.rs @@ -0,0 +1,2 @@ +pub mod pastes; +pub mod security; diff --git a/echo/src/models/pastes.rs b/echo/src/models/pastes.rs new file mode 100644 index 0000000..cbf3cf3 --- /dev/null +++ b/echo/src/models/pastes.rs @@ -0,0 +1,157 @@ +use chrono::{DateTime, Utc}; +use rocket_validation::Validate; +use serde::{Deserialize, Serialize}; +use sqlx::prelude::FromRow; + +use crate::result::{HTTPError, Result}; + +#[derive(FromRow, Serialize)] +pub struct Annotation { + head: i32, + tail: i32, + content: String, +} + +#[derive(Serialize)] +pub struct File { + name: String, + content: String, + + lines: i32, + characters: i32, + + annotations: Vec, +} + +impl File { + pub fn new( + name: String, + content: String, + lines: i32, + characters: i32, + annotations: Vec, + ) -> Self { + File { + name, + content, + lines, + characters, + annotations, + } + } +} + +#[derive(Serialize)] +pub struct Paste { + id: String, + + created_at: DateTime, + expires_at: Option>, + + views: i64, + max_views: Option, + + files: Vec, + + #[serde(skip_serializing_if = "Option::is_none")] + security: Option, +} + +impl Paste { + pub fn id(&self) -> &str { + &self.id + } + + pub fn add_file(&mut self, file: File) { + self.files.push(file); + } + + pub fn new( + id: String, + created_at: DateTime, + expires_at: Option>, + views: i64, + max_views: Option, + files: Vec, + security: Option, + ) -> Self { + Paste { + id, + created_at, + expires_at, + views, + max_views, + files, + security, + } + } +} + +#[derive(Deserialize, Serialize, Validate)] +pub struct CreateFile<'r> { + #[validate(length(min = 1, max = 32))] + name: Option<&'r str>, + #[validate(length(min = 1, max = 300_000))] + // Using str here doesn't validate if the supplied data contains newlines ... + content: String, +} + +impl<'r> CreateFile<'r> { + pub fn name(&self) -> Option<&'r str> { + self.name + } + + pub fn content(&self) -> &str { + &self.content + } +} + +#[derive(Deserialize, Serialize, Validate)] +pub struct CreatePaste<'r> { + #[validate(length(min = 1, max = 5))] + files: Vec>, + #[validate(length(min = 1, max = 72))] + password: Option<&'r str>, + #[validate(range(min = 1, max = 128))] + max_views: Option, + expires_at: Option>, +} + +impl<'r> CreatePaste<'r> { + pub fn files(&self) -> &'r Vec { + &self.files + } + + pub fn password(&self) -> Option<&'r str> { + self.password + } + + pub fn max_views(&self) -> Option { + self.max_views + } + + pub fn expires_at(&self) -> Option> { + self.expires_at + } + + pub fn from_content(content: String) -> Result { + if content.len() < 1 || content.len() > 300_000 { + return Err(HTTPError::new( + 422, + "Must be between 1 and 300000 in length!", + )); + } + + let file = CreateFile { + name: None, + content, + }; + + Ok(CreatePaste { + files: vec![file], + password: None, + max_views: None, + expires_at: None, + }) + } +} diff --git a/echo/src/models/security.rs b/echo/src/models/security.rs new file mode 100644 index 0000000..f5d1c41 --- /dev/null +++ b/echo/src/models/security.rs @@ -0,0 +1,7 @@ +use serde::Serialize; +use sqlx::prelude::FromRow; + +#[derive(FromRow, Serialize)] +pub struct SparsePasteInfo { + id: String, +} diff --git a/echo/src/result.rs b/echo/src/result.rs new file mode 100644 index 0000000..a2889f3 --- /dev/null +++ b/echo/src/result.rs @@ -0,0 +1,26 @@ +use std::result; + +use rocket::{http::Status, serde::json::Json, Responder}; +use serde::Serialize; + +#[derive(Serialize)] +pub struct Error { + message: E, +} + +#[derive(Responder)] +pub struct HTTPError { + inner: (Status, Json>), +} + +impl HTTPError { + pub fn new(code: u16, message: E) -> HTTPError { + let status = Status::from_code(code).expect("http status"); + + HTTPError { + inner: (status, Json(Error { message })), + } + } +} + +pub type Result = result::Result>; diff --git a/echo/src/routes/health.rs b/echo/src/routes/health.rs new file mode 100644 index 0000000..a048534 --- /dev/null +++ b/echo/src/routes/health.rs @@ -0,0 +1,20 @@ +use rocket::get; +use rocket_db_pools::{ + sqlx::{self, Row}, + Connection, +}; + +use crate::{ + database::PgDatabase, + result::{HTTPError, Result}, +}; + +#[get("/health")] +pub async fn health(mut db: Connection) -> Result { + let result = sqlx::query("SELECT 'ok'").fetch_one(&mut **db).await; + + match result { + Ok(row) => Ok(row.get(0)), + Err(_) => Err(HTTPError::new(503, "Database connection unhealthy.")), + } +} diff --git a/echo/src/routes/mod.rs b/echo/src/routes/mod.rs new file mode 100644 index 0000000..f036613 --- /dev/null +++ b/echo/src/routes/mod.rs @@ -0,0 +1,3 @@ +pub mod health; +pub mod pastes; +pub mod security; diff --git a/echo/src/routes/pastes.rs b/echo/src/routes/pastes.rs new file mode 100644 index 0000000..ec6c2e8 --- /dev/null +++ b/echo/src/routes/pastes.rs @@ -0,0 +1,40 @@ +use crate::{ + database::PgDatabase, + models::pastes::{CreatePaste, Paste}, + result::Result, + utils::PasswordHeader, +}; +use rocket::{get, post, serde::json::Json}; +use rocket_db_pools::Connection; +use rocket_validation::Validated; + +#[get("/pastes/")] +pub async fn get_paste<'r>( + mut conn: Connection, + id: String, + password: Option>, +) -> Result> { + let password = match password { + Some(value) => Some(value.get()), + None => None, + }; + + Ok(Json(Paste::fetch(&mut conn, id, password).await?)) +} + +#[post("/pastes", format = "text/plain", data = "")] +pub async fn create_paste_simple<'r>( + mut conn: Connection, + data: String, +) -> Result> { + let paste = CreatePaste::from_content(data)?; + Ok(Json(Paste::create(&mut conn, paste).await?)) +} + +#[post("/pastes", format = "application/json", data = "")] +pub async fn create_paste_structured<'r>( + mut conn: Connection, + data: Validated>>, +) -> Result> { + Ok(Json(Paste::create(&mut conn, data.0 .0).await?)) +} diff --git a/echo/src/routes/security.rs b/echo/src/routes/security.rs new file mode 100644 index 0000000..e2bf060 --- /dev/null +++ b/echo/src/routes/security.rs @@ -0,0 +1,20 @@ +use rocket::{get, serde::json::Json}; +use rocket_db_pools::Connection; + +use crate::{database::PgDatabase, models::security::SparsePasteInfo, result::Result}; + +#[get("/security/")] +pub async fn get_security( + conn: Connection, + token: &str, +) -> Result> { + Ok(Json(SparsePasteInfo::get(conn, token).await?)) +} + +#[get("/security//delete")] +pub async fn delete_security( + conn: Connection, + token: &str, +) -> Result> { + Ok(Json(SparsePasteInfo::delete(conn, token).await?)) +} diff --git a/echo/src/utils.rs b/echo/src/utils.rs new file mode 100644 index 0000000..5183f0b --- /dev/null +++ b/echo/src/utils.rs @@ -0,0 +1,35 @@ +use rand::{distributions::Alphanumeric, Rng}; + +use rocket::{ + http::Status, + request::{FromRequest, Outcome, Request}, +}; + +pub fn generate_id(size: usize) -> String { + let random = rand::thread_rng(); + String::from_utf8(random.sample_iter(Alphanumeric).take(size).collect()).expect("id generator") +} + +pub struct PasswordHeader<'r> { + value: &'r str, +} + +impl<'r> PasswordHeader<'r> { + pub fn get(self) -> &'r str { + self.value + } +} + +#[rocket::async_trait] +impl<'r> FromRequest<'r> for PasswordHeader<'r> { + type Error = &'static str; + + async fn from_request(request: &'r Request<'_>) -> Outcome { + let result = request.headers().get_one("Authorization"); + + match result { + Some(value) => Outcome::Success(PasswordHeader { value }), + None => Outcome::Error((Status::Unauthorized, "Missing Authorization header.")), + } + } +} From 937fcb64d16cdac5a4f6bc28b74ce2f97edd9594 Mon Sep 17 00:00:00 2001 From: LostLuma Date: Tue, 12 Nov 2024 12:56:12 +0100 Subject: [PATCH 02/36] Misc cleanup --- echo/Cargo.toml | 2 +- echo/Dockerfile | 1 - echo/README.md | 2 +- echo/docker-compose.yaml | 36 ++++++++++++++++++++++++------------ echo/src/database/pastes.rs | 3 ++- 5 files changed, 28 insertions(+), 16 deletions(-) diff --git a/echo/Cargo.toml b/echo/Cargo.toml index ea99ecd..eb1eadf 100644 --- a/echo/Cargo.toml +++ b/echo/Cargo.toml @@ -8,7 +8,7 @@ edition = "2021" chrono = { version = "0.4.38", features = ["serde"] } figment = { version = "0.10.19", features = ["json"] } rand = "0.8.5" -reqwest = { version = "0.12.8", default-features = false, features = ["json", "native-tls-vendored"] } +reqwest = { version = "0.12.8", default-features = false, features = ["json", "native-tls-alpn", "native-tls-vendored"] } rocket = { version = "0.5.1", features = ["json"] } rocket-validation = "0.2.0" rocket_db_pools = { version = "0.2.0", features = ["sqlx_postgres"] } diff --git a/echo/Dockerfile b/echo/Dockerfile index 4b85fb2..72c2130 100644 --- a/echo/Dockerfile +++ b/echo/Dockerfile @@ -10,7 +10,6 @@ RUN mkdir bin && \ # Mounting src using bind mount is slower for some reason COPY src src -ENV RUSTFLAGS='-C target-feature=+crt-static' # NOTE: Due to caching this is actually faster than using # Two separate cargo builds (one without source present). diff --git a/echo/README.md b/echo/README.md index 7705140..b3bc48f 100644 --- a/echo/README.md +++ b/echo/README.md @@ -3,5 +3,5 @@ Run development environment: ```sh -PROFILE=dev docker compose up --watch +PROFILE=dev sh -c 'docker compose up --watch' ``` diff --git a/echo/docker-compose.yaml b/echo/docker-compose.yaml index b7dc7ab..89ca303 100644 --- a/echo/docker-compose.yaml +++ b/echo/docker-compose.yaml @@ -8,20 +8,22 @@ services: - PROFILE cap_drop: - ALL + read_only: true + security_opt: + - no-new-privileges=true networks: - public - hidden ports: - - 127.0.0.1:${PORT:-8000}:8000 - restart: unless-stopped + - ${HOST:-127.0.0.1}:${PORT:-8000}:8000 + restart: always depends_on: db: condition: service_healthy - configs: - - source: echo - target: /etc/opt/echo/config.json environment: - ECHO_CONFIG=/etc/opt/echo/config.json + volumes: + - ./config.json:/etc/opt/echo/config.json:ro develop: watch: - path: src/ @@ -29,14 +31,28 @@ services: db: image: postgres:17-alpine + cap_add: + - CHOWN + - DAC_READ_SEARCH + - FOWNER + - SETGID + - SETUID + cap_drop: + - ALL + read_only: true + security_opt: + - no-new-privileges=true networks: - hidden - restart: unless-stopped + restart: always + tmpfs: + - /tmp + - /run/postgresql environment: - POSTGRES_HOST_AUTH_METHOD=trust volumes: - - ./schema:/docker-entrypoint-initdb.d - - ./data/postgres:/var/lib/postgresql/data + - ./schema:/docker-entrypoint-initdb.d:ro + - ./data/postgres:/var/lib/postgresql/data:rw healthcheck: test: ["CMD", "pg_isready", "-U", "echo"] interval: 5s @@ -47,7 +63,3 @@ networks: public: hidden: internal: true - -configs: - echo: - file: config.json diff --git a/echo/src/database/pastes.rs b/echo/src/database/pastes.rs index ae6ed27..1c6a83a 100644 --- a/echo/src/database/pastes.rs +++ b/echo/src/database/pastes.rs @@ -189,7 +189,8 @@ impl Annotation { SELECT head, tail, content FROM annotations WHERE file_id = $1 - ORDER BY id ASC", + ORDER BY id ASC + ", ) .bind(file_id) .fetch_all(&mut ***conn) From c3753c70990d4bfbf999f4937b673caacf432c4e Mon Sep 17 00:00:00 2001 From: LostLuma Date: Wed, 13 Nov 2024 19:25:12 +0100 Subject: [PATCH 03/36] Add file name validator --- echo/src/models/pastes.rs | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/echo/src/models/pastes.rs b/echo/src/models/pastes.rs index cbf3cf3..f418a44 100644 --- a/echo/src/models/pastes.rs +++ b/echo/src/models/pastes.rs @@ -89,13 +89,22 @@ impl Paste { #[derive(Deserialize, Serialize, Validate)] pub struct CreateFile<'r> { - #[validate(length(min = 1, max = 32))] + #[validate(length(min = 1, max = 32), custom(function = "validate_name"))] name: Option<&'r str>, #[validate(length(min = 1, max = 300_000))] - // Using str here doesn't validate if the supplied data contains newlines ... + // Using String instead of str because of newlines: + // https://github.com/somehowchris/rocket-validation/issues/41 content: String, } +fn validate_name(name: &str) -> result::Result<(), ValidationError> { + if !name.contains("\n") { + Ok(()) + } else { + Err(ValidationError::new("Newline in file name.")) + } +} + impl<'r> CreateFile<'r> { pub fn name(&self) -> Option<&'r str> { self.name From 57c7e8b78783262d0fb9f242192c9951f85f08a5 Mon Sep 17 00:00:00 2001 From: LostLuma Date: Wed, 13 Nov 2024 19:29:11 +0100 Subject: [PATCH 04/36] Add secrets scanning --- echo/Cargo.lock | 7 +- echo/Cargo.toml | 3 + echo/example.config.json | 6 +- echo/schema/01-base.sh | 6 +- echo/src/config.rs | 9 ++ echo/src/database/pastes.rs | 102 ++++++++++++++++------ echo/src/main.rs | 5 +- echo/src/models/pastes.rs | 47 ++++++++-- echo/src/scanners.rs | 168 ++++++++++++++++++++++++++++++++++++ 9 files changed, 317 insertions(+), 36 deletions(-) create mode 100644 echo/src/scanners.rs diff --git a/echo/Cargo.lock b/echo/Cargo.lock index 9923e9d..3490e3e 100644 --- a/echo/Cargo.lock +++ b/echo/Cargo.lock @@ -391,9 +391,12 @@ checksum = "1aaf95b3e5c8f23aa320147307562d361db0ae0d51242340f558153b4eb2439b" name = "echo" version = "1.0.0" dependencies = [ + "base64 0.22.1", "chrono", "figment", + "once_cell", "rand", + "regex", "reqwest", "rocket", "rocket-validation", @@ -1550,9 +1553,9 @@ dependencies = [ [[package]] name = "regex" -version = "1.11.0" +version = "1.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "38200e5ee88914975b69f657f0801b6f6dccafd44fd9326302a4aaeecfacb1d8" +checksum = "b544ef1b4eac5dc2db33ea63606ae9ffcfac26c1416a2806ae0bf5f56b201191" dependencies = [ "aho-corasick", "memchr", diff --git a/echo/Cargo.toml b/echo/Cargo.toml index eb1eadf..a81eeb2 100644 --- a/echo/Cargo.toml +++ b/echo/Cargo.toml @@ -5,9 +5,12 @@ publish = false edition = "2021" [dependencies] +base64 = "0.22.1" chrono = { version = "0.4.38", features = ["serde"] } figment = { version = "0.10.19", features = ["json"] } +once_cell = "1.20.2" rand = "0.8.5" +regex = "1.11.1" reqwest = { version = "0.12.8", default-features = false, features = ["json", "native-tls-alpn", "native-tls-vendored"] } rocket = { version = "0.5.1", features = ["json"] } rocket-validation = "0.2.0" diff --git a/echo/example.config.json b/echo/example.config.json index 68468f1..edbd645 100644 --- a/echo/example.config.json +++ b/echo/example.config.json @@ -1,3 +1,7 @@ { - "allowed_hosts": ["http://localhost:1234", "https://mystb.in"] + "allowed_hosts": ["http://localhost:1234", "https://mystb.in"], + "extra_scanners": [ + { "name": "PyPi", "pattern": "pypi-AgEIcHlwaS5vcmc[A-Za-z0-9-_]{70,}" }, + { "name": "GitHub", "pattern": "((ghp|gho|ghu|ghs|ghr)_[A-Za-z0-9_]{36})" } + ] } diff --git a/echo/schema/01-base.sh b/echo/schema/01-base.sh index 5a66f27..246a28a 100644 --- a/echo/schema/01-base.sh +++ b/echo/schema/01-base.sh @@ -29,8 +29,10 @@ psql -v ON_ERROR_STOP=1 --username "echo" --dbname "echo" <<-EOSQL CREATE TABLE IF NOT EXISTS annotations ( id BIGSERIAL PRIMARY KEY NOT NULL, file_id BIGINT REFERENCES files(id) ON DELETE CASCADE, - head INTEGER NOT NULL, - tail INTEGER NOT NULL, + head_line INTEGER NOT NULL, + head_char INTEGER NOT NULL, + tail_line INTEGER NOT NULL, + tail_char INTEGER NOT NULL, content TEXT NOT NULL ); EOSQL diff --git a/echo/src/config.rs b/echo/src/config.rs index 64816b6..b24156e 100644 --- a/echo/src/config.rs +++ b/echo/src/config.rs @@ -1,6 +1,15 @@ +use std::sync::Arc; + use serde::{Deserialize, Serialize}; +#[derive(Debug, Deserialize, Serialize)] +pub struct ScannerConfig { + pub name: Arc, + pub pattern: String, +} + #[derive(Debug, Deserialize, Serialize)] pub struct Config { pub allowed_hosts: Vec, + pub extra_scanners: Vec, } diff --git a/echo/src/database/pastes.rs b/echo/src/database/pastes.rs index 1c6a83a..d014cda 100644 --- a/echo/src/database/pastes.rs +++ b/echo/src/database/pastes.rs @@ -1,13 +1,14 @@ use crate::{ - models::pastes::{Annotation, CreatePaste, File, Paste}, + models::pastes::{Annotation, CreateFile, CreatePaste, File, Paste}, result::{HTTPError, Result}, + scanners::scan_file, utils::generate_id, }; use rocket_db_pools::{ sqlx::{self, Row}, Connection, }; -use sqlx::{postgres::PgRow, Acquire}; +use sqlx::{postgres::PgRow, Acquire, Postgres, Transaction}; use super::PgDatabase; @@ -99,28 +100,8 @@ impl Paste { }; for file in data.files() { - let result = sqlx::query( - " - INSERT INTO files (paste_id, name, content) - VALUES ($1, $2, $3) - RETURNING id, name, content, lines, characters - ", - ) - .bind(paste.id()) - .bind(file.name().or(Some("unknown"))) - .bind(file.content()) - .fetch_one(&mut *tx) - .await; - - match result { - Ok(row) => { - let _id: i64 = row.get("id"); - let annotations = Vec::new(); // TODO: Create and insert annotations - - paste.add_file(File::from_row(row, annotations)); - } - Err(_) => return Err(HTTPError::new(500, "Failed to create paste.")), - } + let file = File::create(&mut tx, paste.id(), file).await?; + paste.add_file(file); } match tx.commit().await { @@ -171,6 +152,35 @@ impl File { Ok(files) } + async fn create<'r>( + tx: &mut Transaction<'_, Postgres>, + paste_id: &str, + file: &'r CreateFile<'r>, + ) -> Result { + let result = sqlx::query( + " + INSERT INTO files (paste_id, name, content) + VALUES ($1, $2, $3) + RETURNING id, name, content, lines, characters + ", + ) + .bind(paste_id) + .bind(file.name().or(Some("unknown"))) + .bind(file.content()) + .fetch_one(&mut **tx) + .await; + + match result { + Ok(row) => { + let id: i64 = row.get("id"); + let annotations = Annotation::create(tx, id, file.content()).await?; + + return Ok(File::from_row(row, annotations)); + } + Err(_) => return Err(HTTPError::new(500, "Failed to create paste.")), + } + } + fn from_row(row: PgRow, annotations: Vec) -> Self { let name = row.get("name"); let content = row.get("content"); @@ -186,7 +196,7 @@ impl Annotation { async fn fetch(conn: &mut Connection, file_id: &i64) -> Result> { let result = sqlx::query_as::<_, Annotation>( " - SELECT head, tail, content + SELECT head_line, head_char, head_char, tail_line, tail_char, content FROM annotations WHERE file_id = $1 ORDER BY id ASC @@ -201,4 +211,46 @@ impl Annotation { Err(_) => return Err(HTTPError::new(500, "Unable to fetch file annotations.")), } } + + async fn create( + tx: &mut Transaction<'_, Postgres>, + file_id: i64, + content: &str, + ) -> Result> { + let scans = scan_file(content); + let mut annotations = Vec::with_capacity(scans.len()); + + for scan in scans { + let content = format!("Contains potentially sensitive data from {}.", scan.service); + + let result = sqlx::query( + " + INSERT INTO annotations (file_id, head_line, head_char, tail_line, tail_char, content) + VALUES ($1, $2, $3, $4, $5, $6) + ", + ) + .bind(file_id) + .bind(scan.head.line) + .bind(scan.head.char) + .bind(scan.tail.line) + .bind(scan.tail.char) + .bind(&content) + .execute(&mut **tx) + .await; + + match result { + Ok(_) => { + let value = Annotation { + head: scan.head, + tail: scan.tail, + content, + }; + annotations.push(value) + } + Err(_) => return Err(HTTPError::new(500, "Failed to create paste.")), + }; + } + + Ok(annotations) + } } diff --git a/echo/src/main.rs b/echo/src/main.rs index c993a0c..02703f5 100644 --- a/echo/src/main.rs +++ b/echo/src/main.rs @@ -7,6 +7,7 @@ use figment::providers::{Format, Json}; use rocket::{catchers, fairing::AdHoc, figment, routes}; use rocket_db_pools::Database; use routes::{health, pastes, security}; +use scanners::InitScanners; pub mod config; pub mod cors; @@ -14,6 +15,7 @@ pub mod database; pub mod models; pub mod result; pub mod routes; +pub mod scanners; pub mod utils; #[rocket::launch] @@ -43,9 +45,10 @@ fn rocket() -> _ { rocket::custom(provider) .manage(client) .mount("/", routes) + .attach(AdHoc::config::()) .attach(PgDatabase::init()) .attach(CorsHeaders) + .attach(InitScanners) .attach(BackgroundTask) - .attach(AdHoc::config::()) .register("/", catchers![rocket_validation::validation_catcher]) } diff --git a/echo/src/models/pastes.rs b/echo/src/models/pastes.rs index f418a44..aaafca8 100644 --- a/echo/src/models/pastes.rs +++ b/echo/src/models/pastes.rs @@ -1,15 +1,52 @@ +use std::result; + use chrono::{DateTime, Utc}; use rocket_validation::Validate; use serde::{Deserialize, Serialize}; -use sqlx::prelude::FromRow; +use sqlx::{postgres::PgRow, FromRow, Row}; +use validator::ValidationError; use crate::result::{HTTPError, Result}; -#[derive(FromRow, Serialize)] +#[derive(Serialize)] +pub struct Position { + pub line: i32, + pub char: i32, +} + +#[derive(Serialize)] pub struct Annotation { - head: i32, - tail: i32, - content: String, + pub head: Position, + pub tail: Position, + pub content: String, +} + +impl FromRow<'_, PgRow> for Annotation { + fn from_row(row: &PgRow) -> std::result::Result { + let head_line = row.get("head_line"); + let head_char = row.get("head_char"); + + let tail_line = row.get("tail_line"); + let tail_char = row.get("tail_char"); + + let content = row.get("content"); + + let head = Position { + line: head_line, + char: head_char, + }; + + let tail = Position { + line: tail_line, + char: tail_char, + }; + + Ok(Annotation { + head, + tail, + content, + }) + } } #[derive(Serialize)] diff --git a/echo/src/scanners.rs b/echo/src/scanners.rs new file mode 100644 index 0000000..a728fe1 --- /dev/null +++ b/echo/src/scanners.rs @@ -0,0 +1,168 @@ +use std::sync::{Arc, OnceLock}; + +use base64::{prelude::BASE64_STANDARD_NO_PAD, Engine}; +use once_cell::sync::Lazy; +use regex::{Match, Regex}; +use rocket::{ + fairing::{self, Fairing, Info, Kind}, + Build, Rocket, +}; + +use crate::{ + config::{Config, ScannerConfig}, + models::pastes::Position, +}; + +fn find_position(content: &str, position: usize) -> Position { + let haystack = &content[0..position]; + let (idx, line) = haystack.split('\n').enumerate().last().unwrap(); + + Position { + line: idx as i32, + char: line.len() as i32, + } +} + +pub struct ScanResult<'r> { + pub head: Position, + pub tail: Position, + + pub content: &'r str, + pub service: Arc, +} + +trait Scanner: Send + Sync { + fn pattern(&self) -> &Regex; + fn service(&self) -> Arc; + + fn confirm(&self, _item: &Match) -> bool { + true + } + + fn execute<'r>(&self, haystack: &'r str) -> Vec> { + self.pattern() + .find_iter(haystack) + .filter(|x| self.confirm(x)) + .collect() + } +} + +struct DiscordScanner { + name: Arc, +} + +impl DiscordScanner { + fn new() -> Self { + DiscordScanner { + name: Arc::new(String::from("Discord")), + } + } +} + +impl Scanner for DiscordScanner { + fn service(&self) -> Arc { + Arc::clone(&self.name) + } + + fn pattern(&self) -> &'static Regex { + static PATTERN: Lazy = Lazy::new(|| { + Regex::new(r"[a-zA-Z0-9_-]{23,28}\.[a-zA-Z0-9_-]{6,7}\.[a-zA-Z0-9_-]{27,}").unwrap() + }); + + &PATTERN + } + + fn confirm(&self, item: &Match) -> bool { + let mut parts = item.as_str().split('.'); + + let user_id = match parts.next() { + None => return false, + Some(value) => value, + }; + + // Discord tokens have 3 parts total + if parts.count() != 2 { + return false; + } + + match BASE64_STANDARD_NO_PAD.decode(user_id) { + Ok(_) => true, + Err(_) => false, + } + } +} + +struct GenericScanner { + name: Arc, + pattern: Regex, +} + +impl GenericScanner { + fn new(config: &ScannerConfig) -> Self { + let name = Arc::clone(&config.name); + let pattern = Regex::new(&config.pattern).expect("invalid scanner pattern"); + + GenericScanner { name, pattern } + } +} + +impl Scanner for GenericScanner { + fn service(&self) -> Arc { + Arc::clone(&self.name) + } + + fn pattern(&self) -> &Regex { + &self.pattern + } +} + +static SCANNERS: OnceLock>> = OnceLock::new(); + +pub struct InitScanners; + +#[rocket::async_trait] +impl Fairing for InitScanners { + fn info(&self) -> Info { + Info { + name: "Scanner Initialization", + kind: Kind::Ignite, + } + } + + async fn on_ignite(&self, rocket: Rocket) -> fairing::Result { + let config = rocket.state::().unwrap(); + let mut active: Vec> = Vec::new(); + + active.push(Box::new(DiscordScanner::new())); + + for value in &config.extra_scanners { + active.push(Box::new(GenericScanner::new(value))); + } + + match SCANNERS.set(active) { + Ok(_) => {} + Err(_) => panic!("failed to set up scanners!"), + }; + + Ok(rocket) + } +} + +pub fn scan_file<'r>(content: &'r str) -> Vec> { + let mut results = Vec::new(); + + for scanner in SCANNERS.get().unwrap() { + for result in scanner.execute(content) { + let result = ScanResult { + service: scanner.service(), + content: result.as_str(), + head: find_position(content, result.start()), + tail: find_position(content, result.end()), + }; + + results.push(result); + } + } + + results +} From 642f371aa3c66742328cac1371cccbb8b73f7a36 Mon Sep 17 00:00:00 2001 From: LostLuma Date: Wed, 13 Nov 2024 19:41:22 +0100 Subject: [PATCH 05/36] Fix indentation --- echo/src/database/pastes.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/echo/src/database/pastes.rs b/echo/src/database/pastes.rs index d014cda..bdb26cf 100644 --- a/echo/src/database/pastes.rs +++ b/echo/src/database/pastes.rs @@ -159,10 +159,10 @@ impl File { ) -> Result { let result = sqlx::query( " - INSERT INTO files (paste_id, name, content) - VALUES ($1, $2, $3) - RETURNING id, name, content, lines, characters - ", + INSERT INTO files (paste_id, name, content) + VALUES ($1, $2, $3) + RETURNING id, name, content, lines, characters + ", ) .bind(paste_id) .bind(file.name().or(Some("unknown"))) From 667b9f7493cff647f61ca59ef532f251c0704b3c Mon Sep 17 00:00:00 2001 From: LostLuma Date: Wed, 13 Nov 2024 19:41:40 +0100 Subject: [PATCH 06/36] Remove unneccessary branch --- echo/src/scanners.rs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/echo/src/scanners.rs b/echo/src/scanners.rs index a728fe1..c7e00ab 100644 --- a/echo/src/scanners.rs +++ b/echo/src/scanners.rs @@ -139,10 +139,9 @@ impl Fairing for InitScanners { active.push(Box::new(GenericScanner::new(value))); } - match SCANNERS.set(active) { - Ok(_) => {} - Err(_) => panic!("failed to set up scanners!"), - }; + if let Err(_) = SCANNERS.set(active) { + panic!("failed to set up scanners!") + } Ok(rocket) } From bf30c575476e62e0fb08bc5d1d536db19a551ba3 Mon Sep 17 00:00:00 2001 From: LostLuma Date: Thu, 14 Nov 2024 09:41:13 +0100 Subject: [PATCH 07/36] Add constructors to the remaining models --- echo/src/database/pastes.rs | 17 +++++------------ echo/src/models/pastes.rs | 34 +++++++++++++++++++++++++++++----- echo/src/scanners.rs | 5 +---- 3 files changed, 35 insertions(+), 21 deletions(-) diff --git a/echo/src/database/pastes.rs b/echo/src/database/pastes.rs index bdb26cf..a5d1b9c 100644 --- a/echo/src/database/pastes.rs +++ b/echo/src/database/pastes.rs @@ -230,23 +230,16 @@ impl Annotation { ", ) .bind(file_id) - .bind(scan.head.line) - .bind(scan.head.char) - .bind(scan.tail.line) - .bind(scan.tail.char) + .bind(scan.head.line()) + .bind(scan.head.char()) + .bind(scan.tail.line()) + .bind(scan.tail.char()) .bind(&content) .execute(&mut **tx) .await; match result { - Ok(_) => { - let value = Annotation { - head: scan.head, - tail: scan.tail, - content, - }; - annotations.push(value) - } + Ok(_) => annotations.push(Annotation::new(scan.head, scan.tail, content)), Err(_) => return Err(HTTPError::new(500, "Failed to create paste.")), }; } diff --git a/echo/src/models/pastes.rs b/echo/src/models/pastes.rs index aaafca8..06e5ed0 100644 --- a/echo/src/models/pastes.rs +++ b/echo/src/models/pastes.rs @@ -10,15 +10,39 @@ use crate::result::{HTTPError, Result}; #[derive(Serialize)] pub struct Position { - pub line: i32, - pub char: i32, + line: i32, + char: i32, +} + +impl Position { + pub fn line(&self) -> i32 { + self.line + } + + pub fn char(&self) -> i32 { + self.char + } + + pub fn new(line: i32, char: i32) -> Self { + Position { line, char } + } } #[derive(Serialize)] pub struct Annotation { - pub head: Position, - pub tail: Position, - pub content: String, + head: Position, + tail: Position, + content: String, +} + +impl Annotation { + pub fn new(head: Position, tail: Position, content: String) -> Self { + Annotation { + head, + tail, + content, + } + } } impl FromRow<'_, PgRow> for Annotation { diff --git a/echo/src/scanners.rs b/echo/src/scanners.rs index c7e00ab..fcaeb98 100644 --- a/echo/src/scanners.rs +++ b/echo/src/scanners.rs @@ -17,10 +17,7 @@ fn find_position(content: &str, position: usize) -> Position { let haystack = &content[0..position]; let (idx, line) = haystack.split('\n').enumerate().last().unwrap(); - Position { - line: idx as i32, - char: line.len() as i32, - } + Position::new(idx as i32, line.len() as i32) } pub struct ScanResult<'r> { From 9ad4cddd03034e96685a508cf7040400f71ae16e Mon Sep 17 00:00:00 2001 From: LostLuma Date: Sat, 16 Nov 2024 21:27:26 +0100 Subject: [PATCH 08/36] Add API documentation using scalar --- echo/Cargo.lock | 339 ++++++++++++++++++++++++++++ echo/Cargo.toml | 1 + echo/Dockerfile | 1 + echo/openapi.json | 428 ++++++++++++++++++++++++++++++++++++ echo/src/main.rs | 4 +- echo/src/routes/docs.rs | 20 ++ echo/src/routes/mod.rs | 1 + echo/src/routes/security.rs | 4 +- 8 files changed, 795 insertions(+), 3 deletions(-) create mode 100644 echo/openapi.json create mode 100644 echo/src/routes/docs.rs diff --git a/echo/Cargo.lock b/echo/Cargo.lock index 3490e3e..e77026f 100644 --- a/echo/Cargo.lock +++ b/echo/Cargo.lock @@ -60,6 +60,12 @@ dependencies = [ "libc", ] +[[package]] +name = "anyhow" +version = "1.0.93" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4c95c10ba0b00a02636238b814946408b1322d5ac4760326e6fb8ec956d85775" + [[package]] name = "async-stream" version = "0.3.6" @@ -180,6 +186,16 @@ dependencies = [ "generic-array", ] +[[package]] +name = "bstr" +version = "1.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1a68f1f47cdf0ec8ee4b941b2eee2a80cb796db73118c0dd09ac63fbe405be22" +dependencies = [ + "memchr", + "serde", +] + [[package]] name = "bumpalo" version = "3.16.0" @@ -234,6 +250,28 @@ dependencies = [ "windows-targets 0.52.6", ] +[[package]] +name = "chrono-tz" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "93698b29de5e97ad0ae26447b344c482a7284c737d9ddc5f9e52b74a336671bb" +dependencies = [ + "chrono", + "chrono-tz-build", + "phf", +] + +[[package]] +name = "chrono-tz-build" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0c088aee841df9c3041febbb73934cfc39708749bf96dc827e3359cd39ef11b1" +dependencies = [ + "parse-zoneinfo", + "phf", + "phf_codegen", +] + [[package]] name = "const-oid" version = "0.9.6" @@ -291,6 +329,25 @@ version = "2.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "19d374276b40fb8bbdee95aef7c7fa6b5316ec764510eb64b8dd0e2ed0d7e7f5" +[[package]] +name = "crossbeam-deque" +version = "0.8.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "613f8cc01fe9cf1a3eb3d7f488fd2fa8388403e97039e2f73692932e291a770d" +dependencies = [ + "crossbeam-epoch", + "crossbeam-utils", +] + +[[package]] +name = "crossbeam-epoch" +version = "0.9.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5b82ac4a3c2ca9c3460964f020e1402edd5753411d7737aa39c3714ad1b5420e" +dependencies = [ + "crossbeam-utils", +] + [[package]] name = "crossbeam-queue" version = "0.3.11" @@ -336,6 +393,12 @@ dependencies = [ "powerfmt", ] +[[package]] +name = "deunicode" +version = "1.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "339544cc9e2c4dc3fc7149fd630c5f22263a4fdf18a98afd0075784968b5cf00" + [[package]] name = "devise" version = "0.4.2" @@ -401,6 +464,7 @@ dependencies = [ "rocket", "rocket-validation", "rocket_db_pools", + "scalar-doc", "serde", "sqlx", "tokio", @@ -653,6 +717,30 @@ version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d2fabcfbdc87f4758337ca535fb41a6d701b65693ce38287d856d1674551ec9b" +[[package]] +name = "globset" +version = "0.4.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "15f1ce686646e7f1e19bf7d5533fe443a45dbfb990e00629110797578b42fb19" +dependencies = [ + "aho-corasick", + "bstr", + "log", + "regex-automata 0.4.8", + "regex-syntax 0.8.5", +] + +[[package]] +name = "globwalk" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0bf760ebf69878d9fd8f110c89703d90ce35095324d1f1edcb595c63945ee757" +dependencies = [ + "bitflags", + "ignore", + "walkdir", +] + [[package]] name = "h2" version = "0.3.26" @@ -819,6 +907,15 @@ version = "1.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "df3b46402a9d5adb4c86a0cf463f42e19994e3ee891101b1841f30a545cb49a9" +[[package]] +name = "humansize" +version = "2.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6cb51c9a029ddc91b07a787f1d86b53ccfa49b0e86688c946ebe8d3555685dd7" +dependencies = [ + "libm", +] + [[package]] name = "hyper" version = "0.14.31" @@ -946,6 +1043,22 @@ version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cb56e1aa765b4b4f3aadfab769793b7087bb03a4ea4920644a6d238e2df5b9ed" +[[package]] +name = "ignore" +version = "0.4.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6d89fd380afde86567dfba715db065673989d6253f42b88179abd3eae47bda4b" +dependencies = [ + "crossbeam-deque", + "globset", + "log", + "memchr", + "regex-automata 0.4.8", + "same-file", + "walkdir", + "winapi-util", +] + [[package]] name = "indexmap" version = "2.6.0" @@ -1339,6 +1452,15 @@ dependencies = [ "windows-targets 0.52.6", ] +[[package]] +name = "parse-zoneinfo" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1f2a05b18d44e2957b88f96ba460715e295bc1d7510468a2f3d3b44535d26c24" +dependencies = [ + "regex", +] + [[package]] name = "paste" version = "1.0.15" @@ -1383,6 +1505,89 @@ version = "2.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e" +[[package]] +name = "pest" +version = "2.7.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "879952a81a83930934cbf1786752d6dedc3b1f29e8f8fb2ad1d0a36f377cf442" +dependencies = [ + "memchr", + "thiserror", + "ucd-trie", +] + +[[package]] +name = "pest_derive" +version = "2.7.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d214365f632b123a47fd913301e14c946c61d1c183ee245fa76eb752e59a02dd" +dependencies = [ + "pest", + "pest_generator", +] + +[[package]] +name = "pest_generator" +version = "2.7.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eb55586734301717aea2ac313f50b2eb8f60d2fc3dc01d190eefa2e625f60c4e" +dependencies = [ + "pest", + "pest_meta", + "proc-macro2", + "quote", + "syn 2.0.79", +] + +[[package]] +name = "pest_meta" +version = "2.7.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b75da2a70cf4d9cb76833c990ac9cd3923c9a8905a8929789ce347c84564d03d" +dependencies = [ + "once_cell", + "pest", + "sha2", +] + +[[package]] +name = "phf" +version = "0.11.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ade2d8b8f33c7333b51bcf0428d37e217e9f32192ae4772156f65063b8ce03dc" +dependencies = [ + "phf_shared", +] + +[[package]] +name = "phf_codegen" +version = "0.11.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e8d39688d359e6b34654d328e262234662d16cc0f60ec8dcbe5e718709342a5a" +dependencies = [ + "phf_generator", + "phf_shared", +] + +[[package]] +name = "phf_generator" +version = "0.11.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "48e4cc64c2ad9ebe670cb8fd69dd50ae301650392e81c05f9bfcb2d5bdbc24b0" +dependencies = [ + "phf_shared", + "rand", +] + +[[package]] +name = "phf_shared" +version = "0.11.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "90fcb95eef784c2ac79119d1dd819e162b5da872ce6f3c3abe1e8ca1c082f72b" +dependencies = [ + "siphasher", +] + [[package]] name = "pin-project-lite" version = "0.2.14" @@ -1859,6 +2064,27 @@ version = "1.0.18" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f3cb5ba0dc43242ce17de99c180e96db90b235b8a9fdc9543c96d2209116bd9f" +[[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 = "scalar-doc" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d144ef6022602a2adcb35a28254e1a9600484054a57e912e3da9632e83c52075" +dependencies = [ + "anyhow", + "serde", + "serde_json", + "tera", +] + [[package]] name = "schannel" version = "0.1.26" @@ -2022,6 +2248,12 @@ dependencies = [ "rand_core", ] +[[package]] +name = "siphasher" +version = "0.3.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "38b58827f4464d87d377d175e90bf58eb00fd8716ff0a62f80356b5e61555d0d" + [[package]] name = "slab" version = "0.4.9" @@ -2031,6 +2263,16 @@ dependencies = [ "autocfg", ] +[[package]] +name = "slug" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "882a80f72ee45de3cc9a5afeb2da0331d58df69e4e7d8eeb5d3c7784ae67e724" +dependencies = [ + "deunicode", + "wasm-bindgen", +] + [[package]] name = "smallvec" version = "1.13.2" @@ -2356,6 +2598,28 @@ dependencies = [ "windows-sys 0.59.0", ] +[[package]] +name = "tera" +version = "1.20.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ab9d851b45e865f178319da0abdbfe6acbc4328759ff18dafc3a41c16b4cd2ee" +dependencies = [ + "chrono", + "chrono-tz", + "globwalk", + "humansize", + "lazy_static", + "percent-encoding", + "pest", + "pest_derive", + "rand", + "regex", + "serde", + "serde_json", + "slug", + "unic-segment", +] + [[package]] name = "thiserror" version = "1.0.64" @@ -2617,6 +2881,12 @@ dependencies = [ "serde", ] +[[package]] +name = "ucd-trie" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2896d95c02a80c6d6a5d6e953d479f5ddf2dfdb6a244441010e373ac0fb88971" + [[package]] name = "uncased" version = "0.9.10" @@ -2627,6 +2897,56 @@ dependencies = [ "version_check", ] +[[package]] +name = "unic-char-property" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a8c57a407d9b6fa02b4795eb81c5b6652060a15a7903ea981f3d723e6c0be221" +dependencies = [ + "unic-char-range", +] + +[[package]] +name = "unic-char-range" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0398022d5f700414f6b899e10b8348231abf9173fa93144cbc1a43b9793c1fbc" + +[[package]] +name = "unic-common" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "80d7ff825a6a654ee85a63e80f92f054f904f21e7d12da4e22f9834a4aaa35bc" + +[[package]] +name = "unic-segment" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e4ed5d26be57f84f176157270c112ef57b86debac9cd21daaabbe56db0f88f23" +dependencies = [ + "unic-ucd-segment", +] + +[[package]] +name = "unic-ucd-segment" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2079c122a62205b421f499da10f3ee0f7697f012f55b675e002483c73ea34700" +dependencies = [ + "unic-char-property", + "unic-char-range", + "unic-ucd-version", +] + +[[package]] +name = "unic-ucd-version" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "96bd2f2237fe450fcd0a1d2f5f4e91711124f7857ba2e964247776ebeeb7b0c4" +dependencies = [ + "unic-common", +] + [[package]] name = "unicode-bidi" version = "0.3.17" @@ -2755,6 +3075,16 @@ 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 = "want" version = "0.3.1" @@ -2885,6 +3215,15 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" +[[package]] +name = "winapi-util" +version = "0.1.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cf221c93e13a30d793f7645a0e7762c55d169dbb0a49671918a2319d289b10bb" +dependencies = [ + "windows-sys 0.59.0", +] + [[package]] name = "winapi-x86_64-pc-windows-gnu" version = "0.4.0" diff --git a/echo/Cargo.toml b/echo/Cargo.toml index a81eeb2..06d1fab 100644 --- a/echo/Cargo.toml +++ b/echo/Cargo.toml @@ -15,6 +15,7 @@ reqwest = { version = "0.12.8", default-features = false, features = ["json", "n rocket = { version = "0.5.1", features = ["json"] } rocket-validation = "0.2.0" rocket_db_pools = { version = "0.2.0", features = ["sqlx_postgres"] } +scalar-doc = "0.1.0" serde = "1.0.210" sqlx = { version = "0.7.4", features = ["chrono"] } tokio = "1.40.0" diff --git a/echo/Dockerfile b/echo/Dockerfile index 72c2130..a5df086 100644 --- a/echo/Dockerfile +++ b/echo/Dockerfile @@ -18,6 +18,7 @@ RUN --mount=type=cache,target=target \ --mount=type=cache,target=/usr/local/cargo/registry \ --mount=type=bind,source=Cargo.toml,target=Cargo.toml,readwrite \ --mount=type=bind,source=Cargo.lock,target=Cargo.lock,readwrite \ + --mount=type=bind,source=openapi.json,target=openapi.json,readwrite \ # Use musl target as the binary is about 1MiB smaller cargo build --profile $PROFILE --target x86_64-unknown-linux-musl && \ # The "dev" target directory is named "debug" instead diff --git a/echo/openapi.json b/echo/openapi.json new file mode 100644 index 0000000..a0fb064 --- /dev/null +++ b/echo/openapi.json @@ -0,0 +1,428 @@ +{ + "openapi": "3.1.3", + "info": { + "title": "MystBin API", + "description": "MystBin API endpoints and types.", + "version": "1.0.0", + "contact": { + "name": "MystBin", + "email": "support@mystb.in" + } + }, + "tags": [ + { + "name": "Paste", + "description": "Endpoints relating to Pastes." + }, + { + "name": "Security", + "description": "Endpoints relating to Security tokens." + } + ], + "servers": [ + { + "url": "https://api.mystb.in", + "description": "The MystBin production server." + } + ], + "paths": { + "/paste": { + "post": { + "summary": "Create New Paste", + "description": "Create a new Paste containing up to five files.", + "operationId": "create-paste", + "tags": ["Paste"], + "requestBody": { + "description": "Data used to create a new Paste.", + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/CreatePaste" + } + }, + "text/plain": { + "schema": { + "type": "string", + "minLength": 1, + "maxLength": 300000, + "description": "Content for a Paste containing a single File." + } + } + } + }, + "responses": { + "200": { + "description": "A new Paste has been created.", + "content": { + "application/json": { + "schema": { + "type": "object", + "$ref": "#/components/schemas/Paste" + } + } + } + }, + "400": { + "description": "The body data was malformed or incorrect.", + "content": { + "application/json": { + "schema": { + "type": "object", + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + } + } + } + }, + "/paste/{id}": { + "parameters": [ + { + "schema": { + "type": "string" + }, + "name": "id", + "in": "path", + "required": true, + "description": "The Paste id." + } + ], + "get": { + "summary": "Fetch Existing Paste", + "description": "View an existing Paste.", + "operationId": "get-paste", + "tags": ["Paste"], + "parameters": [ + { + "schema": { + "type": "string", + "format": "password", + "description": "A password to access the Paste. Must be provided for secret Pastes." + }, + "required": false, + "in": "header", + "name": "Authorization" + } + ], + "responses": { + "200": { + "description": "The requested Paste.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Paste" + } + } + } + }, + "404": { + "description": "The requested Paste does not exist or you are not authorized to view it.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + } + } + } + }, + "/security/{token}": { + "parameters": [ + { + "schema": { + "type": "string", + "format": "password", + "description": "The security token returned when creating the Paste." + }, + "required": true, + "in": "path", + "name": "token" + } + ], + "get": { + "summary": "Security Token Info.", + "description": "View which Paste a particular security token is associated with.", + "operationId": "security-info", + "tags": ["Security"], + "responses": { + "200": { + "description": "Information about the Paste associated with this token.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/PasteInfo" + } + } + } + }, + "404": { + "description": "The provided security token is not valid.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + } + } + }, + "delete": { + "summary": "Delete Paste with Security Token.", + "description": "Delete the Paste associated with this security token.", + "operationId": "security-delete", + "tags": ["Security"], + "responses": { + "200": { + "description": "The Paste has successfully been deleted.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/PasteInfo" + } + } + } + }, + "404": { + "description": "The provided security token is not valid.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + } + } + } + } + }, + "components": { + "schemas": { + "Position": { + "title": "Position", + "type": "object", + "description": "Describes a position inside a File.", + "properties": { + "line": { + "type": "integer", + "description": "A line inside a File." + }, + "char": { + "type": "integer", + "description": "A specific character on the aforementioned line." + } + } + }, + "Annotation": { + "title": "Annotation", + "type": "object", + "description": "Auto-generated notices about File contents. May disclose things such as authentication tokens that were accidentally included.", + "properties": { + "head": { + "type": "object", + "description": "Annotated area start.", + "items": { + "$ref": "#/components/schemas/Position" + } + }, + "tail": { + "type": "object", + "description": "Annotated area end.", + "items": { + "$ref": "#/components/schemas/Position" + } + }, + "content": { + "type": "string", + "description": "Reason this annotation was generated. Should be shown to the end user." + } + }, + "example": { + "head": { + "line": 3, + "char": 5 + }, + "tail": { + "line": 3, + "char": 15 + }, + "content": "Contains a MystBin authentication token!" + } + }, + "File": { + "title": "File", + "type": "object", + "description": "A File associated with a Paste.", + "properties": { + "name": { + "type": "string", + "description": "A short name for the File." + }, + "content": { + "type": "string", + "description": "The File's content." + }, + "lines": { + "type": "integer", + "description": "Amount of newlines the content has." + }, + "characters": { + "type": "integer", + "description": "Total character count inside the content." + }, + "annotations": { + "type": "array", + "description": "Auto-generated notices about the File content.", + "items": { + "$ref": "#/components/schemas/Annotation" + } + } + }, + "example": { + "name": "beaver.txt", + "content": "Beavers are soo cute!", + "lines": 1, + "characters": 21, + "annotations": [] + } + }, + "Paste": { + "title": "Paste", + "type": "object", + "description": "A Paste containing one or more Files.", + "properties": { + "id": { + "type": "string", + "description": "An auto-generated unique identifier for this Paste." + }, + "created_at": { + "type": "string", + "description": "Timestamp at which this Paste was created.", + "format": "date-time" + }, + "expires_at": { + "type": "string", + "description": "Timestamp at which this Paste will automatically be deleted.", + "format": "date-time", + "nullable": true + }, + "views": { + "type": "integer", + "description": "Amount of times this Paste has been accessed after creation." + }, + "max_views": { + "type": "integer", + "description": "Total amount of accesses before the Paste is automatically deleted.", + "nullable": true + }, + "files": { + "type": "array", + "description": "The Files associated with this Paste.", + "items": { + "$ref": "#/components/schemas/File" + } + }, + "security": { + "type": "string", + "description": "A unique token that allows deleting the Paste. Present when creating a Paste only.", + "nullable": true + } + } + }, + "PasteInfo": { + "title": "PasteInfo", + "type": "object", + "description": "Sparse information about a Paste.", + "properties": { + "id": { + "type": "string", + "description": "The unique identifier for the Paste." + } + } + }, + "CreateFile": { + "title": "CreateFile", + "type": "object", + "description": "Data used to create a new File.", + "properties": { + "name": { + "type": "string", + "minLength": 1, + "maxLength": 32, + "description": "The File's name. Defaults to 'unknown'." + }, + "content": { + "type": "string", + "minLength": 1, + "maxLength": 300000, + "description": "The File's content." + } + }, + "required": ["content"], + "example": { + "name": "beaver.txt", + "content": "Beavers are soo cute!" + } + }, + "CreatePaste": { + "title": "CreatePaste", + "type": "object", + "description": "Data used to create a new Paste.", + "properties": { + "files": { + "type": "array", + "minItems": 1, + "maxItems": 5, + "description": "Files to create inside this Paste.", + "items": { + "$ref": "#/components/schemas/CreateFile" + } + }, + "password": { + "type": "string", + "minLength": 1, + "maxLength": 72, + "format": "password", + "description": "An optional secret required to view the Paste." + }, + "max_views": { + "type": "integer", + "minimum": 1, + "maximum": 128, + "description": "The maximum amount of times this Paste may be accessed." + }, + "expires_at": { + "type": "string", + "format": "date-time", + "description": "Timestamp at which this Paste will automatically be deleted." + } + }, + "required": ["files"], + "example": { + "files": [ + { + "name": "secret.txt", + "content": "This file disappears after you view it!" + } + ], + "password": "shh", + "max_views": 1 + } + }, + "ErrorResponse": { + "title": "ErrorResponse", + "type": "object", + "properties": { + "message": { + "type": "string" + } + } + } + } + } +} diff --git a/echo/src/main.rs b/echo/src/main.rs index 02703f5..5a43e1a 100644 --- a/echo/src/main.rs +++ b/echo/src/main.rs @@ -6,7 +6,7 @@ use database::{background_task::BackgroundTask, PgDatabase}; use figment::providers::{Format, Json}; use rocket::{catchers, fairing::AdHoc, figment, routes}; use rocket_db_pools::Database; -use routes::{health, pastes, security}; +use routes::{docs, health, pastes, security}; use scanners::InitScanners; pub mod config; @@ -22,6 +22,8 @@ pub mod utils; fn rocket() -> _ { let routes = routes![ cors::snatcher, + docs::get_docs, + docs::get_spec, health::health, pastes::get_paste, pastes::create_paste_simple, diff --git a/echo/src/routes/docs.rs b/echo/src/routes/docs.rs new file mode 100644 index 0000000..ab1b717 --- /dev/null +++ b/echo/src/routes/docs.rs @@ -0,0 +1,20 @@ +use rocket::{ + get, + response::content::{RawHtml, RawJson}, +}; +use scalar_doc::{Documentation, Theme}; + +#[get("/docs")] +pub fn get_docs() -> RawHtml { + let docs = Documentation::new("MystBin API Documentation", "/docs/spec.json") + .theme(Theme::Alternate) + .build() + .unwrap(); + + RawHtml(docs) +} + +#[get("/docs/spec.json")] +pub fn get_spec() -> RawJson<&'static str> { + RawJson(include_str!("../../openapi.json")) +} diff --git a/echo/src/routes/mod.rs b/echo/src/routes/mod.rs index f036613..17092f9 100644 --- a/echo/src/routes/mod.rs +++ b/echo/src/routes/mod.rs @@ -1,3 +1,4 @@ +pub mod docs; pub mod health; pub mod pastes; pub mod security; diff --git a/echo/src/routes/security.rs b/echo/src/routes/security.rs index e2bf060..9aa73d2 100644 --- a/echo/src/routes/security.rs +++ b/echo/src/routes/security.rs @@ -1,4 +1,4 @@ -use rocket::{get, serde::json::Json}; +use rocket::{delete, get, serde::json::Json}; use rocket_db_pools::Connection; use crate::{database::PgDatabase, models::security::SparsePasteInfo, result::Result}; @@ -11,7 +11,7 @@ pub async fn get_security( Ok(Json(SparsePasteInfo::get(conn, token).await?)) } -#[get("/security//delete")] +#[delete("/security/")] pub async fn delete_security( conn: Connection, token: &str, From 42678ba1efe83b7f55bcb56df8ae89c43ef30d24 Mon Sep 17 00:00:00 2001 From: LostLuma Date: Sat, 16 Nov 2024 21:30:14 +0100 Subject: [PATCH 09/36] Add redirect from / to /docs --- echo/src/main.rs | 1 + echo/src/routes/mod.rs | 7 +++++++ 2 files changed, 8 insertions(+) diff --git a/echo/src/main.rs b/echo/src/main.rs index 5a43e1a..ae0b85a 100644 --- a/echo/src/main.rs +++ b/echo/src/main.rs @@ -21,6 +21,7 @@ pub mod utils; #[rocket::launch] fn rocket() -> _ { let routes = routes![ + routes::get_root, cors::snatcher, docs::get_docs, docs::get_spec, diff --git a/echo/src/routes/mod.rs b/echo/src/routes/mod.rs index 17092f9..f72b221 100644 --- a/echo/src/routes/mod.rs +++ b/echo/src/routes/mod.rs @@ -1,4 +1,11 @@ +use rocket::{get, response::Redirect, uri}; + pub mod docs; pub mod health; pub mod pastes; pub mod security; + +#[get("/")] +pub fn get_root() -> Redirect { + Redirect::temporary(uri!("/docs")) +} From 1171d8984ba10c41f0768bfbac920b96fb80b4c5 Mon Sep 17 00:00:00 2001 From: LostLuma Date: Sat, 16 Nov 2024 22:26:30 +0100 Subject: [PATCH 10/36] Optimize Dockerfile --- echo/Dockerfile | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/echo/Dockerfile b/echo/Dockerfile index a5df086..7e75b41 100644 --- a/echo/Dockerfile +++ b/echo/Dockerfile @@ -8,17 +8,15 @@ RUN mkdir bin && \ apt update -y && apt upgrade -y && apt install -y musl-tools && \ rustup target add x86_64-unknown-linux-musl -# Mounting src using bind mount is slower for some reason -COPY src src - # NOTE: Due to caching this is actually faster than using # Two separate cargo builds (one without source present). RUN --mount=type=cache,target=target \ --mount=type=cache,target=/usr/local/cargo/git \ --mount=type=cache,target=/usr/local/cargo/registry \ + --mount=type=bind,source=src,target=src \ + --mount=type=bind,source=openapi.json,target=openapi.json \ --mount=type=bind,source=Cargo.toml,target=Cargo.toml,readwrite \ --mount=type=bind,source=Cargo.lock,target=Cargo.lock,readwrite \ - --mount=type=bind,source=openapi.json,target=openapi.json,readwrite \ # Use musl target as the binary is about 1MiB smaller cargo build --profile $PROFILE --target x86_64-unknown-linux-musl && \ # The "dev" target directory is named "debug" instead From 0d11dc866c1da876bd208ef9111ba68ed0d35f47 Mon Sep 17 00:00:00 2001 From: LostLuma Date: Sun, 17 Nov 2024 00:05:10 +0100 Subject: [PATCH 11/36] Some API spec fixed --- echo/openapi.json | 28 +++++++++++++++++++++++----- 1 file changed, 23 insertions(+), 5 deletions(-) diff --git a/echo/openapi.json b/echo/openapi.json index a0fb064..0bd7779 100644 --- a/echo/openapi.json +++ b/echo/openapi.json @@ -64,7 +64,18 @@ } }, "400": { - "description": "The body data was malformed or incorrect.", + "description": "Request body malformed or incorrect.", + "content": { + "application/json": { + "schema": { + "type": "object", + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "422": { + "description": "Request body contained semantic errors.", "content": { "application/json": { "schema": { @@ -144,7 +155,7 @@ } ], "get": { - "summary": "Security Token Info.", + "summary": "Security Token Info", "description": "View which Paste a particular security token is associated with.", "operationId": "security-info", "tags": ["Security"], @@ -172,7 +183,7 @@ } }, "delete": { - "summary": "Delete Paste with Security Token.", + "summary": "Delete Paste with Security Token", "description": "Delete the Paste associated with this security token.", "operationId": "security-delete", "tags": ["Security"], @@ -417,11 +428,18 @@ "ErrorResponse": { "title": "ErrorResponse", "type": "object", + "description": "Generic response when something went wrong.", "properties": { "message": { - "type": "string" + "type": "string", + "description": "The error message." + }, + "errors": { + "type": "object", + "description": "Detailed information on the error. May not be present." } - } + }, + "required": ["message"] } } } From 9c8d4e9ba76cde10997076a526229088257c886a Mon Sep 17 00:00:00 2001 From: LostLuma Date: Sun, 17 Nov 2024 00:32:06 +0100 Subject: [PATCH 12/36] Correct version and pastes endpoint path in openapi spec --- echo/openapi.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/echo/openapi.json b/echo/openapi.json index 0bd7779..5307a00 100644 --- a/echo/openapi.json +++ b/echo/openapi.json @@ -3,7 +3,7 @@ "info": { "title": "MystBin API", "description": "MystBin API endpoints and types.", - "version": "1.0.0", + "version": "5.0.0", "contact": { "name": "MystBin", "email": "support@mystb.in" @@ -26,7 +26,7 @@ } ], "paths": { - "/paste": { + "/pastes": { "post": { "summary": "Create New Paste", "description": "Create a new Paste containing up to five files.", @@ -88,7 +88,7 @@ } } }, - "/paste/{id}": { + "/pastes/{id}": { "parameters": [ { "schema": { From c1666d972ad79edf9fd126d4a7307a6ae27957ab Mon Sep 17 00:00:00 2001 From: LostLuma Date: Sun, 17 Nov 2024 00:35:15 +0100 Subject: [PATCH 13/36] Reformat db schema to be consistent --- echo/schema/01-base.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/echo/schema/01-base.sh b/echo/schema/01-base.sh index 246a28a..8c3f77b 100644 --- a/echo/schema/01-base.sh +++ b/echo/schema/01-base.sh @@ -2,7 +2,7 @@ set -euf -o pipefail psql -v ON_ERROR_STOP=1 --username "echo" --dbname "echo" <<-EOSQL - CREATE EXTENSION IF NOT EXISTS pgcrypto; + CREATE EXTENSION IF NOT EXISTS pgcrypto; CREATE TABLE IF NOT EXISTS pastes ( id TEXT PRIMARY KEY, From 7fb73a2f827a7b580ad6cc02680770ba867a3603 Mon Sep 17 00:00:00 2001 From: LostLuma Date: Sun, 17 Nov 2024 00:38:36 +0100 Subject: [PATCH 14/36] Force sh files to check out as LF --- echo/.gitattributes | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 echo/.gitattributes diff --git a/echo/.gitattributes b/echo/.gitattributes new file mode 100644 index 0000000..efdba87 --- /dev/null +++ b/echo/.gitattributes @@ -0,0 +1,2 @@ +* text=auto +*.sh text eol=lf From 5c751a8bdba9abde33c8aeaf9875a9fab6e6b697 Mon Sep 17 00:00:00 2001 From: Eviee Py Date: Sun, 17 Nov 2024 14:30:18 +1000 Subject: [PATCH 15/36] Add Access Control Headers --- echo/src/cors.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/echo/src/cors.rs b/echo/src/cors.rs index 81f49cb..d5d5ef7 100644 --- a/echo/src/cors.rs +++ b/echo/src/cors.rs @@ -41,5 +41,6 @@ impl Fairing for CorsHeaders { )); response.set_header(Header::new("Access-Control-Max-Age", "86400")); response.set_header(Header::new("Access-Control-Allow-Credentials", "true")); + response.set_header(Header::new("Access-Control-Allow-Headers", "Origin, X-Requested-With, Content-Type, Accept, Authorization")); } } From e90177e882f0a4c4b9426adf548e4276360e9eed Mon Sep 17 00:00:00 2001 From: LostLuma Date: Sun, 17 Nov 2024 14:26:42 +0100 Subject: [PATCH 16/36] Add optional language field to File --- echo/openapi.json | 12 +++++++++++- echo/schema/01-base.sh | 1 + echo/src/database/pastes.rs | 12 +++++++----- echo/src/models/pastes.rs | 16 +++++++++++++--- 4 files changed, 32 insertions(+), 9 deletions(-) diff --git a/echo/openapi.json b/echo/openapi.json index 5307a00..5a6685f 100644 --- a/echo/openapi.json +++ b/echo/openapi.json @@ -278,6 +278,11 @@ "type": "string", "description": "The File's content." }, + "language": { + "type": "string", + "nullable": true, + "description": "Syntax highlighting language for the File." + }, "lines": { "type": "integer", "description": "Amount of newlines the content has." @@ -288,7 +293,7 @@ }, "annotations": { "type": "array", - "description": "Auto-generated notices about the File content.", + "description": "Auto-generated notices about File content.", "items": { "$ref": "#/components/schemas/Annotation" } @@ -297,6 +302,7 @@ "example": { "name": "beaver.txt", "content": "Beavers are soo cute!", + "language": "plaintext", "lines": 1, "characters": 21, "annotations": [] @@ -372,6 +378,10 @@ "minLength": 1, "maxLength": 300000, "description": "The File's content." + }, + "language": { + "type": "string", + "description": "Syntax highlighting language for the File." } }, "required": ["content"], diff --git a/echo/schema/01-base.sh b/echo/schema/01-base.sh index 8c3f77b..d8b0c1a 100644 --- a/echo/schema/01-base.sh +++ b/echo/schema/01-base.sh @@ -22,6 +22,7 @@ psql -v ON_ERROR_STOP=1 --username "echo" --dbname "echo" <<-EOSQL paste_id TEXT REFERENCES pastes(id) ON DELETE CASCADE, name TEXT NOT NULL, content TEXT NOT NULL, + language TEXT, -- highlight.js syntax highlighting language lines INTEGER NOT NULL GENERATED ALWAYS AS (LENGTH(REGEXP_REPLACE(content, '[^\n]', '', 'g')) + 1) STORED, characters INTEGER NOT NULL GENERATED ALWAYS AS (LENGTH(content)) STORED ); diff --git a/echo/src/database/pastes.rs b/echo/src/database/pastes.rs index a5d1b9c..1d72ed4 100644 --- a/echo/src/database/pastes.rs +++ b/echo/src/database/pastes.rs @@ -125,7 +125,7 @@ impl File { async fn fetch(conn: &mut Connection, paste_id: &str) -> Result> { let result = sqlx::query( " - SELECT id, name, content, lines, characters + SELECT id, name, content, language, lines, characters FROM files WHERE paste_id = $1 ORDER BY id ASC @@ -159,14 +159,15 @@ impl File { ) -> Result { let result = sqlx::query( " - INSERT INTO files (paste_id, name, content) - VALUES ($1, $2, $3) - RETURNING id, name, content, lines, characters + INSERT INTO files (paste_id, name, content, language) + VALUES ($1, $2, $3, $4) + RETURNING id, name, content, language, lines, characters ", ) .bind(paste_id) .bind(file.name().or(Some("unknown"))) .bind(file.content()) + .bind(file.language()) .fetch_one(&mut **tx) .await; @@ -184,11 +185,12 @@ impl File { fn from_row(row: PgRow, annotations: Vec) -> Self { let name = row.get("name"); let content = row.get("content"); + let language = row.get("language"); let lines = row.get("lines"); let characters = row.get("characters"); - File::new(name, content, lines, characters, annotations) + File::new(name, content, language, lines, characters, annotations) } } diff --git a/echo/src/models/pastes.rs b/echo/src/models/pastes.rs index 06e5ed0..30d4d4d 100644 --- a/echo/src/models/pastes.rs +++ b/echo/src/models/pastes.rs @@ -77,6 +77,7 @@ impl FromRow<'_, PgRow> for Annotation { pub struct File { name: String, content: String, + language: Option, lines: i32, characters: i32, @@ -88,6 +89,7 @@ impl File { pub fn new( name: String, content: String, + language: Option, lines: i32, characters: i32, annotations: Vec, @@ -95,6 +97,7 @@ impl File { File { name, content, + language, lines, characters, annotations, @@ -150,19 +153,21 @@ impl Paste { #[derive(Deserialize, Serialize, Validate)] pub struct CreateFile<'r> { - #[validate(length(min = 1, max = 32), custom(function = "validate_name"))] + #[validate(length(min = 1, max = 32), custom(function = "no_newlines"))] name: Option<&'r str>, #[validate(length(min = 1, max = 300_000))] // Using String instead of str because of newlines: // https://github.com/somehowchris/rocket-validation/issues/41 content: String, + #[validate(length(min = 1, max = 32), custom(function = "no_newlines"))] + language: Option<&'r str>, } -fn validate_name(name: &str) -> result::Result<(), ValidationError> { +fn no_newlines(name: &str) -> result::Result<(), ValidationError> { if !name.contains("\n") { Ok(()) } else { - Err(ValidationError::new("Newline in file name.")) + Err(ValidationError::new("Found newline in unsupported field.")) } } @@ -174,6 +179,10 @@ impl<'r> CreateFile<'r> { pub fn content(&self) -> &str { &self.content } + + pub fn language(&self) -> Option<&'r str> { + self.language + } } #[derive(Deserialize, Serialize, Validate)] @@ -215,6 +224,7 @@ impl<'r> CreatePaste<'r> { let file = CreateFile { name: None, content, + language: None, }; Ok(CreatePaste { From ce53f9cbd788ebc636efa858960d12472896834a Mon Sep 17 00:00:00 2001 From: LostLuma Date: Wed, 20 Nov 2024 05:02:58 +0100 Subject: [PATCH 17/36] Require password prefix fetching authenticated pastes Signed-off-by: Lilly Rose Berner --- echo/src/utils.rs | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/echo/src/utils.rs b/echo/src/utils.rs index 5183f0b..b66c450 100644 --- a/echo/src/utils.rs +++ b/echo/src/utils.rs @@ -1,5 +1,7 @@ +use once_cell::sync::Lazy; use rand::{distributions::Alphanumeric, Rng}; +use regex::Regex; use rocket::{ http::Status, request::{FromRequest, Outcome, Request}, @@ -27,9 +29,19 @@ impl<'r> FromRequest<'r> for PasswordHeader<'r> { async fn from_request(request: &'r Request<'_>) -> Outcome { let result = request.headers().get_one("Authorization"); - match result { - Some(value) => Outcome::Success(PasswordHeader { value }), - None => Outcome::Error((Status::Unauthorized, "Missing Authorization header.")), + let value = match result { + Some(value) => value, + None => return Outcome::Error((Status::Unauthorized, "Missing Authorization header.")), + }; + + static PATTERN: Lazy = Lazy::new(|| Regex::new(r"(?i:password): .+").unwrap()); + + if !PATTERN.is_match(value) { + return Outcome::Error((Status::Unauthorized, "Invalid Authorization header.")); } + + Outcome::Success(PasswordHeader { + value: value.split_once(" ").unwrap().1, + }) } } From 705576f66b55ac499e77e16760921afed0d06c8a Mon Sep 17 00:00:00 2001 From: LostLuma Date: Wed, 20 Nov 2024 05:04:24 +0100 Subject: [PATCH 18/36] Return 401 when an invalid password is used on an authenticated paste Signed-off-by: Lilly Rose Berner --- echo/openapi.json | 12 ++++++++++- echo/src/database/pastes.rs | 42 ++++++++++++++++++++++++++++--------- 2 files changed, 43 insertions(+), 11 deletions(-) diff --git a/echo/openapi.json b/echo/openapi.json index 5a6685f..3e5f805 100644 --- a/echo/openapi.json +++ b/echo/openapi.json @@ -128,8 +128,18 @@ } } }, + "401": { + "description": "You are not authorized to view the requested Paste.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, "404": { - "description": "The requested Paste does not exist or you are not authorized to view it.", + "description": "The requested Paste does not exist, has too many views, or has expired.", "content": { "application/json": { "schema": { diff --git a/echo/src/database/pastes.rs b/echo/src/database/pastes.rs index 1d72ed4..6e128b8 100644 --- a/echo/src/database/pastes.rs +++ b/echo/src/database/pastes.rs @@ -20,17 +20,28 @@ impl Paste { ) -> Result { let query = format!( " - UPDATE + WITH _ AS ( + UPDATE + pastes + SET + views = views + 1 + WHERE + id = $1 AND {} + ) + SELECT + created_at, + expires_at, + views + 1 AS views, -- account for in-progress update above + max_views, + CASE WHEN password IS NULL THEN true ELSE + CASE WHEN $2 IS NULL THEN false ELSE password = CRYPT($2, password) END + END AS authenticated + FROM pastes - SET - views = views + 1 WHERE id = $1 AND CASE WHEN max_views IS NULL THEN true ELSE views <= max_views END AND - CASE WHEN expires_at IS NULL THEN true ELSE expires_at > CURRENT_TIMESTAMP END AND - {} - RETURNING - created_at, expires_at, views, max_views + CASE WHEN expires_at IS NULL THEN true ELSE expires_at > CURRENT_TIMESTAMP END ", match password { None => "password IS NULL", @@ -46,10 +57,21 @@ impl Paste { match result { Ok(row) => { - let files = File::fetch(conn, &id).await?; - Ok(Paste::from_row(row, id, files, None)) + let authenticated = row.get("authenticated"); + + if authenticated { + let files = File::fetch(conn, &id).await?; + Ok(Paste::from_row(row, id, files, None)) + } else { + Err(HTTPError::new(401, "Provided password is not valid.")) + } + } + Err(_) => { + return Err(HTTPError::new( + 404, + "Requested paste does not exist, has too many views, or has expired.", + )) } - Err(_) => return Err(HTTPError::new(404, "Unknown paste or invalid password.")), } } From 8bb92843b8c2de92084aead07493b8d84369296f Mon Sep 17 00:00:00 2001 From: LostLuma Date: Wed, 20 Nov 2024 05:07:54 +0100 Subject: [PATCH 19/36] Document new password header prefix Signed-off-by: Lilly Rose Berner --- echo/openapi.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/echo/openapi.json b/echo/openapi.json index 3e5f805..816c0b3 100644 --- a/echo/openapi.json +++ b/echo/openapi.json @@ -110,7 +110,7 @@ "schema": { "type": "string", "format": "password", - "description": "A password to access the Paste. Must be provided for secret Pastes." + "description": "A password to access a secret Paste. Must have `password:` prefix." }, "required": false, "in": "header", From b7c35abe86dc74a223a5574ac6445497330c0bf3 Mon Sep 17 00:00:00 2001 From: LostLuma Date: Wed, 20 Nov 2024 05:14:24 +0100 Subject: [PATCH 20/36] Remove non-standard colon from auth header separator Signed-off-by: Lilly Rose Berner --- echo/openapi.json | 2 +- echo/src/utils.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/echo/openapi.json b/echo/openapi.json index 816c0b3..4b6ebab 100644 --- a/echo/openapi.json +++ b/echo/openapi.json @@ -110,7 +110,7 @@ "schema": { "type": "string", "format": "password", - "description": "A password to access a secret Paste. Must have `password:` prefix." + "description": "A password to access a secret Paste. Must have `Password` prefix." }, "required": false, "in": "header", diff --git a/echo/src/utils.rs b/echo/src/utils.rs index b66c450..d7afa37 100644 --- a/echo/src/utils.rs +++ b/echo/src/utils.rs @@ -34,7 +34,7 @@ impl<'r> FromRequest<'r> for PasswordHeader<'r> { None => return Outcome::Error((Status::Unauthorized, "Missing Authorization header.")), }; - static PATTERN: Lazy = Lazy::new(|| Regex::new(r"(?i:password): .+").unwrap()); + static PATTERN: Lazy = Lazy::new(|| Regex::new(r"(?i:password) .+").unwrap()); if !PATTERN.is_match(value) { return Outcome::Error((Status::Unauthorized, "Invalid Authorization header.")); From ea039da672f5b3bdb75498ca0b47da4af57b468f Mon Sep 17 00:00:00 2001 From: LostLuma Date: Wed, 20 Nov 2024 06:46:50 +0100 Subject: [PATCH 21/36] Remove all v4 files Signed-off-by: Lilly Rose Berner --- .dockerignore | 9 - .env.template | 2 - .github/CONTRIBUTING.md | 39 - .github/FUNDING.yml | 3 - .github/workflows/build_and_push.yaml | 87 - .github/workflows/coverage_and_lint.yml | 46 - .github/workflows/deploy.yaml | 27 - .gitignore | 164 -- Dockerfile | 26 - LICENSE | 674 -------- config.template.toml | 28 - core/__init__.py | 21 - core/config.py | 34 - core/database.py | 299 ---- core/models.py | 85 - core/scanners.py | 134 -- core/server.py | 112 -- core/utils.py | 159 -- docker-compose.yaml | 42 - launcher.py | 58 - migration.sql | 26 - pyproject.toml | 64 - redis.conf | 2 - requirements.txt | 8 - schema.sql | 25 - types_/config.py | 66 - types_/github.py | 29 - types_/scanner.py | 30 - views/__init__.py | 21 - views/api.py | 360 ----- views/docs.py | 48 - views/htmx.py | 360 ----- web/docs.html | 25 - web/index.html | 118 -- web/maint.html | 74 - web/password.html | 100 -- web/paste.html | 88 - web/static/images/favicon.ico | Bin 15406 -> 0 bytes web/static/images/keyboard-light.svg | 6 - web/static/images/keyboard.svg | 6 - web/static/images/logo.svg | 1 - web/static/images/vsc.svg | 1 - web/static/packages/highlight.min.js | 1964 ----------------------- web/static/packages/htmx.min.js | 1 - web/static/scripts/dragDrop.js | 79 - web/static/scripts/files.js | 98 -- web/static/scripts/files.old.js | 51 - web/static/scripts/hidecopy.js | 43 - web/static/scripts/highlights.js | 65 - web/static/scripts/highlightsHTMX.js | 75 - web/static/scripts/initialTheme.js | 28 - web/static/scripts/lineHighlights.js | 119 -- web/static/scripts/shortcuts.js | 16 - web/static/scripts/themes.js | 16 - web/static/scripts/utils.js | 16 - web/static/styles/global.css | 778 --------- web/static/styles/highlights.css | 188 --- 57 files changed, 7044 deletions(-) delete mode 100644 .dockerignore delete mode 100644 .env.template delete mode 100644 .github/CONTRIBUTING.md delete mode 100644 .github/FUNDING.yml delete mode 100644 .github/workflows/build_and_push.yaml delete mode 100644 .github/workflows/coverage_and_lint.yml delete mode 100644 .github/workflows/deploy.yaml delete mode 100644 .gitignore delete mode 100644 Dockerfile delete mode 100755 LICENSE delete mode 100644 config.template.toml delete mode 100644 core/__init__.py delete mode 100644 core/config.py delete mode 100644 core/database.py delete mode 100644 core/models.py delete mode 100644 core/scanners.py delete mode 100644 core/server.py delete mode 100644 core/utils.py delete mode 100644 docker-compose.yaml delete mode 100644 launcher.py delete mode 100644 migration.sql delete mode 100644 pyproject.toml delete mode 100644 redis.conf delete mode 100644 requirements.txt delete mode 100644 schema.sql delete mode 100644 types_/config.py delete mode 100644 types_/github.py delete mode 100644 types_/scanner.py delete mode 100644 views/__init__.py delete mode 100644 views/api.py delete mode 100644 views/docs.py delete mode 100644 views/htmx.py delete mode 100644 web/docs.html delete mode 100644 web/index.html delete mode 100644 web/maint.html delete mode 100644 web/password.html delete mode 100644 web/paste.html delete mode 100644 web/static/images/favicon.ico delete mode 100644 web/static/images/keyboard-light.svg delete mode 100644 web/static/images/keyboard.svg delete mode 100644 web/static/images/logo.svg delete mode 100644 web/static/images/vsc.svg delete mode 100644 web/static/packages/highlight.min.js delete mode 100644 web/static/packages/htmx.min.js delete mode 100644 web/static/scripts/dragDrop.js delete mode 100644 web/static/scripts/files.js delete mode 100644 web/static/scripts/files.old.js delete mode 100644 web/static/scripts/hidecopy.js delete mode 100644 web/static/scripts/highlights.js delete mode 100644 web/static/scripts/highlightsHTMX.js delete mode 100644 web/static/scripts/initialTheme.js delete mode 100644 web/static/scripts/lineHighlights.js delete mode 100644 web/static/scripts/shortcuts.js delete mode 100644 web/static/scripts/themes.js delete mode 100644 web/static/scripts/utils.js delete mode 100644 web/static/styles/global.css delete mode 100644 web/static/styles/highlights.css diff --git a/.dockerignore b/.dockerignore deleted file mode 100644 index 69e7796..0000000 --- a/.dockerignore +++ /dev/null @@ -1,9 +0,0 @@ -.git/ -.github/ -types_/ -config.template.toml -Dockerfile -LICENSE -migration.sql -pyproject.toml -README.md diff --git a/.env.template b/.env.template deleted file mode 100644 index 272b827..0000000 --- a/.env.template +++ /dev/null @@ -1,2 +0,0 @@ -POSTGRES_USER=mystbin -POSTGRES_PASSWORD=mystbin diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md deleted file mode 100644 index 901d575..0000000 --- a/.github/CONTRIBUTING.md +++ /dev/null @@ -1,39 +0,0 @@ -## Contributing to Mystbin! - -First off, thanks for taking the time to contribute. It makes the service substantially better. :+1: - -The following is a set of guidelines for contributing to the repository. These are guidelines, not hard rules. - -## Good Bug Reports - -Please be aware of the following things when filing bug reports. - -1. Don't open duplicate issues. Please search your issue to see if it has been asked already. Duplicate issues will be closed. -2. When filing a bug about exceptions or tracebacks, please include the *complete* traceback. Without the complete traceback the issue might be **unsolvable** and you will be asked to provide more information. -3. Make sure to provide enough information to make the issue workable. The issue template will generally walk you through the process, but they are enumerated here as well: - - A **summary** of your bug report. This is generally a quick sentence or two to describe the issue in human terms. - - Guidance on **how to reproduce the issue**. Ideally, this should have a paste ID that allows us to run and see the issue for ourselves to debug. **Please make sure any of your tokens are not displayed**. If you cannot provide a paste ID, then let us know what the steps were, how often it happens, etc. - - Tell us **what you expected to happen**. That way we can meet that expectation. - - Tell us **what actually happens**. What ends up happening in reality? It's not helpful to say "it fails" or "it doesn't work". Say *how* it failed, do you get an error? Does it hang? How are the expectations different from reality? - - Tell us **information about your environment**. What web browser(s) does this occur on, etc? - -If the bug report is missing this information then it'll take us longer to fix the issue. We will probably ask for clarification, and barring that if no response was given then the issue will be closed. - -## Submitting a Pull Request - -Submitting a pull request is fairly simple, just make sure it focuses on a single aspect and doesn't manage to have scope creep, and it's probably good to go. It would be incredibly lovely if the style is consistent to that found in the project. This project follows PEP-8 guidelines (mostly) with a column limit of 125. -There are provided tool rules in `pyproject.toml` for `isort`, `black` and `pyright` when working on the backend side of things. -There are rules provided for prettier when working on the frontend side of things. - -There are actions that run on new PRs and if those checks fail then the PR will not be accepted. - -NOTE: We do not provide `black` and `isort` in the requirements files for the backend. Feel free to install these yourself. - -### Git Commit Guidelines - -- Use present tense (e.g. "Add feature" not "Added feature") -- Limit all lines to 72 characters or fewer. -- Reference issues or pull requests outside the first line. - - Please use the shorthand `#123` and not the full URL. - -If you do not meet any of these guidelines, don't fret. Chances are they will be fixed upon rebasing but please do try to meet them to remove some workload. diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml deleted file mode 100644 index c4927e4..0000000 --- a/.github/FUNDING.yml +++ /dev/null @@ -1,3 +0,0 @@ - -github: [IAmTomahawkx, EvieePy, AbstractUmbra] -ko_fi: AbstractUmbra diff --git a/.github/workflows/build_and_push.yaml b/.github/workflows/build_and_push.yaml deleted file mode 100644 index d6fb51f..0000000 --- a/.github/workflows/build_and_push.yaml +++ /dev/null @@ -1,87 +0,0 @@ -# This workflow uses actions that are not certified by GitHub. -# They are provided by a third-party and are governed by -# separate terms of service, privacy policy, and support -# documentation. - -# GitHub recommends pinning actions to a commit SHA. -# To get a newer version, you will need to update the SHA. -# You can also reference a tag or branch, but the action may change without warning. - -name: Create and publish a Docker image - -on: - workflow_dispatch: - push: - branches: - - main - paths: - - '**.html' - - '**.css' - - '**.js' - - '**.py' - - '**.toml' - - '**.svg' - -concurrency: - cancel-in-progress: true - group: ci-${{ github.ref }} - -env: - REGISTRY: ghcr.io - IMAGE_NAME: ${{ github.repository }} - -jobs: - build-and-push-image: - runs-on: ubuntu-latest - env: - GIT_SHA: ${GITHUB_SHA::7} - permissions: - contents: read - packages: write - - steps: - - name: Checkout repository - uses: actions/checkout@v4 - with: - fetch-depth: 0 - - - name: Set up QEMU - uses: docker/setup-qemu-action@v3 - - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v3 - - - name: Log in to the Container registry - uses: docker/login-action@master - with: - registry: ${{ env.REGISTRY }} - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} - - - name: Extract metadata (tags, labels) for Docker - id: meta - uses: docker/metadata-action@master - with: - images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} - - - name: Generate lowername image - id: image-name - run: | - echo "IMAGE_NAME_LC=${IMAGE_NAME,,}" >> "${GITHUB_OUTPUT}" - env: - IMAGE_NAME: '${{ env.IMAGE_NAME }}' - - - name: Get short SHA - id: slug - run: echo "GIT_SHORT_SHA7=$(echo ${GITHUB_SHA} | cut -c1-7)" >> "$GITHUB_OUTPUT" - - - name: Build and push Docker image - uses: docker/build-push-action@v5 - with: - context: . - push: true - tags: | - ${{ steps.meta.outputs.tags }} - ghcr.io/${{ steps.image-name.outputs.IMAGE_NAME_LC }}:${{ steps.slug.outputs.GIT_SHORT_SHA7 }} - ghcr.io/${{ steps.image-name.outputs.IMAGE_NAME_LC }}:latest - labels: ${{ steps.meta.outputs.labels }} diff --git a/.github/workflows/coverage_and_lint.yml b/.github/workflows/coverage_and_lint.yml deleted file mode 100644 index 3b592a7..0000000 --- a/.github/workflows/coverage_and_lint.yml +++ /dev/null @@ -1,46 +0,0 @@ -name: Type Coverage and Linting - -on: - push: - branches: - - main - pull_request: - branches: - - main - types: [opened, reopened, synchronize] - -jobs: - check: - runs-on: ubuntu-latest - strategy: - fail-fast: false - matrix: - python-version: ["3.11", "3.x"] - - name: "Type Coverage and Linting @ ${{ matrix.python-version }}" - steps: - - name: "Checkout Repository" - uses: actions/checkout@v3 - with: - fetch-depth: 0 - - - name: "Setup Python @ ${{ matrix.python-version }}" - id: setup-python - uses: actions/setup-python@v4 - with: - python-version: "${{ matrix.python-version }}" - cache: "pip" - - - name: "Install Python deps @ ${{ matrix.python-version }}" - id: install-deps - run: | - pip install -Ur requirements.txt - - name: "Run Pyright @ ${{ matrix.python-version }}" - uses: jakebailey/pyright-action@v1 - with: - no-comments: ${{ matrix.python-version != '3.x' }} - warnings: false - - - name: Lint with Ruff - if: ${{ always() && steps.install-deps.outcome == 'success' }} - uses: chartboost/ruff-action@v1 diff --git a/.github/workflows/deploy.yaml b/.github/workflows/deploy.yaml deleted file mode 100644 index a315197..0000000 --- a/.github/workflows/deploy.yaml +++ /dev/null @@ -1,27 +0,0 @@ -name: Deploy - -on: - workflow_run: - workflows: ["Create and publish a Docker image"] - branches: [main] - types: - - completed - -jobs: - deploy: - name: Deploy bot - runs-on: ubuntu-latest - steps: - - name: Remote deploy - uses: appleboy/ssh-action@master - with: - host: ${{ secrets.SSH_HOST }} - key: ${{ secrets.SSH_KEY }} - port: ${{ secrets.SSH_PORT }} - script: | - cd ~/mystbin - git reset --hard HEAD || true - git pull origin main - docker compose --profile redis pull - docker compose --profile redis up --build -d mystbin - username: ${{ secrets.SSH_USER }} diff --git a/.gitignore b/.gitignore deleted file mode 100644 index 8350ffd..0000000 --- a/.gitignore +++ /dev/null @@ -1,164 +0,0 @@ -# Byte-compiled / optimized / DLL files -__pycache__/ -*.py[cod] -*$py.class - -# C extensions -*.so - -# Distribution / packaging -.Python -build/ -develop-eggs/ -dist/ -downloads/ -eggs/ -.eggs/ -lib/ -lib64/ -parts/ -sdist/ -var/ -wheels/ -share/python-wheels/ -*.egg-info/ -.installed.cfg -*.egg -MANIFEST - -# PyInstaller -# Usually these files are written by a python script from a template -# before PyInstaller builds the exe, so as to inject date/other infos into it. -*.manifest -*.spec - -# Installer logs -pip-log.txt -pip-delete-this-directory.txt - -# Unit test / coverage reports -htmlcov/ -.tox/ -.nox/ -.coverage -.coverage.* -.cache -nosetests.xml -coverage.xml -*.cover -*.py,cover -.hypothesis/ -.pytest_cache/ -cover/ - -# Translations -*.mo -*.pot - -# Django stuff: -*.log -local_settings.py -db.sqlite3 -db.sqlite3-journal - -# Flask stuff: -instance/ -.webassets-cache - -# Scrapy stuff: -.scrapy - -# Sphinx documentation -docs/_build/ - -# PyBuilder -.pybuilder/ -target/ - -# Jupyter Notebook -.ipynb_checkpoints - -# IPython -profile_default/ -ipython_config.py - -# pyenv -# For a library or package, you might want to ignore these files since the code is -# intended to run in multiple environments; otherwise, check them in: -# .python-version - -# pipenv -# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control. -# However, in case of collaboration, if having platform-specific dependencies or dependencies -# having no cross-platform support, pipenv may install dependencies that don't work, or not -# install all needed dependencies. -#Pipfile.lock - -# poetry -# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control. -# This is especially recommended for binary packages to ensure reproducibility, and is more -# commonly ignored for libraries. -# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control -#poetry.lock - -# pdm -# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control. -#pdm.lock -# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it -# in version control. -# https://pdm.fming.dev/#use-with-ide -.pdm.toml - -# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm -__pypackages__/ - -# Celery stuff -celerybeat-schedule -celerybeat.pid - -# SageMath parsed files -*.sage.py - -# Environments -.env -.venv -env/ -venv/ -ENV/ -env.bak/ -venv.bak/ - -# Spyder project settings -.spyderproject -.spyproject - -# Rope project settings -.ropeproject - -# mkdocs documentation -/site - -# mypy -.mypy_cache/ -.dmypy.json -dmypy.json - -# Pyre type checker -.pyre/ - -# pytype static type analyzer -.pytype/ - -# Cython debug symbols -cython_debug/ - -# PyCharm -# JetBrains specific template is maintained in a separate JetBrains.gitignore that can -# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore -# and can be added to the global gitignore or merged into this file. For a more nuclear -# option (not recommended) you can uncomment the following to ignore the entire idea folder. -#.idea/ - -# Config Files... -config.toml -.config.toml \ No newline at end of file diff --git a/Dockerfile b/Dockerfile deleted file mode 100644 index ac8b63e..0000000 --- a/Dockerfile +++ /dev/null @@ -1,26 +0,0 @@ -FROM python:3.12-slim - -LABEL org.opencontainers.image.source=https://github.com/pythonistaguild/mystbin -LABEL org.opencontainers.image.description="Container for running MystB.in" -LABEL org.opencontainers.image.licenses=GPLv3 - -RUN mkdir -p /etc/apt/keyrings \ - && apt update -y \ - && apt-get install --no-install-recommends -y \ - # deps for building python deps - git \ - build-essential \ - libcurl4-gnutls-dev \ - gnutls-dev \ - libmagic-dev \ - && rm -rf /var/lib/apt/lists/* - -# copy project requirement files here to ensure they will be cached. -WORKDIR /app -COPY requirements.txt ./ - -# install runtime deps -RUN pip install -Ur requirements.txt - -COPY . /app/ -ENTRYPOINT python -O launcher.py diff --git a/LICENSE b/LICENSE deleted file mode 100755 index f288702..0000000 --- a/LICENSE +++ /dev/null @@ -1,674 +0,0 @@ - GNU GENERAL PUBLIC LICENSE - Version 3, 29 June 2007 - - Copyright (C) 2007 Free Software Foundation, Inc. - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - Preamble - - The GNU General Public License is a free, copyleft license for -software and other kinds of works. - - The licenses for most software and other practical works are designed -to take away your freedom to share and change the works. By contrast, -the GNU General Public License is intended to guarantee your freedom to -share and change all versions of a program--to make sure it remains free -software for all its users. We, the Free Software Foundation, use the -GNU General Public License for most of our software; it applies also to -any other work released this way by its authors. You can apply it to -your programs, too. - - When we speak of free software, we are referring to freedom, not -price. Our General Public Licenses are designed to make sure that you -have the freedom to distribute copies of free software (and charge for -them if you wish), that you receive source code or can get it if you -want it, that you can change the software or use pieces of it in new -free programs, and that you know you can do these things. - - To protect your rights, we need to prevent others from denying you -these rights or asking you to surrender the rights. Therefore, you have -certain responsibilities if you distribute copies of the software, or if -you modify it: responsibilities to respect the freedom of others. - - For example, if you distribute copies of such a program, whether -gratis or for a fee, you must pass on to the recipients the same -freedoms that you received. You must make sure that they, too, receive -or can get the source code. And you must show them these terms so they -know their rights. - - Developers that use the GNU GPL protect your rights with two steps: -(1) assert copyright on the software, and (2) offer you this License -giving you legal permission to copy, distribute and/or modify it. - - For the developers' and authors' protection, the GPL clearly explains -that there is no warranty for this free software. For both users' and -authors' sake, the GPL requires that modified versions be marked as -changed, so that their problems will not be attributed erroneously to -authors of previous versions. - - Some devices are designed to deny users access to install or run -modified versions of the software inside them, although the manufacturer -can do so. This is fundamentally incompatible with the aim of -protecting users' freedom to change the software. The systematic -pattern of such abuse occurs in the area of products for individuals to -use, which is precisely where it is most unacceptable. Therefore, we -have designed this version of the GPL to prohibit the practice for those -products. If such problems arise substantially in other domains, we -stand ready to extend this provision to those domains in future versions -of the GPL, as needed to protect the freedom of users. - - Finally, every program is threatened constantly by software patents. -States should not allow patents to restrict development and use of -software on general-purpose computers, but in those that do, we wish to -avoid the special danger that patents applied to a free program could -make it effectively proprietary. To prevent this, the GPL assures that -patents cannot be used to render the program non-free. - - The precise terms and conditions for copying, distribution and -modification follow. - - TERMS AND CONDITIONS - - 0. Definitions. - - "This License" refers to version 3 of the GNU General Public License. - - "Copyright" also means copyright-like laws that apply to other kinds of -works, such as semiconductor masks. - - "The Program" refers to any copyrightable work licensed under this -License. Each licensee is addressed as "you". "Licensees" and -"recipients" may be individuals or organizations. - - To "modify" a work means to copy from or adapt all or part of the work -in a fashion requiring copyright permission, other than the making of an -exact copy. The resulting work is called a "modified version" of the -earlier work or a work "based on" the earlier work. - - A "covered work" means either the unmodified Program or a work based -on the Program. - - To "propagate" a work means to do anything with it that, without -permission, would make you directly or secondarily liable for -infringement under applicable copyright law, except executing it on a -computer or modifying a private copy. Propagation includes copying, -distribution (with or without modification), making available to the -public, and in some countries other activities as well. - - To "convey" a work means any kind of propagation that enables other -parties to make or receive copies. Mere interaction with a user through -a computer network, with no transfer of a copy, is not conveying. - - An interactive user interface displays "Appropriate Legal Notices" -to the extent that it includes a convenient and prominently visible -feature that (1) displays an appropriate copyright notice, and (2) -tells the user that there is no warranty for the work (except to the -extent that warranties are provided), that licensees may convey the -work under this License, and how to view a copy of this License. If -the interface presents a list of user commands or options, such as a -menu, a prominent item in the list meets this criterion. - - 1. Source Code. - - The "source code" for a work means the preferred form of the work -for making modifications to it. "Object code" means any non-source -form of a work. - - A "Standard Interface" means an interface that either is an official -standard defined by a recognized standards body, or, in the case of -interfaces specified for a particular programming language, one that -is widely used among developers working in that language. - - The "System Libraries" of an executable work include anything, other -than the work as a whole, that (a) is included in the normal form of -packaging a Major Component, but which is not part of that Major -Component, and (b) serves only to enable use of the work with that -Major Component, or to implement a Standard Interface for which an -implementation is available to the public in source code form. A -"Major Component", in this context, means a major essential component -(kernel, window system, and so on) of the specific operating system -(if any) on which the executable work runs, or a compiler used to -produce the work, or an object code interpreter used to run it. - - The "Corresponding Source" for a work in object code form means all -the source code needed to generate, install, and (for an executable -work) run the object code and to modify the work, including scripts to -control those activities. However, it does not include the work's -System Libraries, or general-purpose tools or generally available free -programs which are used unmodified in performing those activities but -which are not part of the work. For example, Corresponding Source -includes interface definition files associated with source files for -the work, and the source code for shared libraries and dynamically -linked subprograms that the work is specifically designed to require, -such as by intimate data communication or control flow between those -subprograms and other parts of the work. - - The Corresponding Source need not include anything that users -can regenerate automatically from other parts of the Corresponding -Source. - - The Corresponding Source for a work in source code form is that -same work. - - 2. Basic Permissions. - - All rights granted under this License are granted for the term of -copyright on the Program, and are irrevocable provided the stated -conditions are met. This License explicitly affirms your unlimited -permission to run the unmodified Program. The output from running a -covered work is covered by this License only if the output, given its -content, constitutes a covered work. This License acknowledges your -rights of fair use or other equivalent, as provided by copyright law. - - You may make, run and propagate covered works that you do not -convey, without conditions so long as your license otherwise remains -in force. You may convey covered works to others for the sole purpose -of having them make modifications exclusively for you, or provide you -with facilities for running those works, provided that you comply with -the terms of this License in conveying all material for which you do -not control copyright. Those thus making or running the covered works -for you must do so exclusively on your behalf, under your direction -and control, on terms that prohibit them from making any copies of -your copyrighted material outside their relationship with you. - - Conveying under any other circumstances is permitted solely under -the conditions stated below. Sublicensing is not allowed; section 10 -makes it unnecessary. - - 3. Protecting Users' Legal Rights From Anti-Circumvention Law. - - No covered work shall be deemed part of an effective technological -measure under any applicable law fulfilling obligations under article -11 of the WIPO copyright treaty adopted on 20 December 1996, or -similar laws prohibiting or restricting circumvention of such -measures. - - When you convey a covered work, you waive any legal power to forbid -circumvention of technological measures to the extent such circumvention -is effected by exercising rights under this License with respect to -the covered work, and you disclaim any intention to limit operation or -modification of the work as a means of enforcing, against the work's -users, your or third parties' legal rights to forbid circumvention of -technological measures. - - 4. Conveying Verbatim Copies. - - You may convey verbatim copies of the Program's source code as you -receive it, in any medium, provided that you conspicuously and -appropriately publish on each copy an appropriate copyright notice; -keep intact all notices stating that this License and any -non-permissive terms added in accord with section 7 apply to the code; -keep intact all notices of the absence of any warranty; and give all -recipients a copy of this License along with the Program. - - You may charge any price or no price for each copy that you convey, -and you may offer support or warranty protection for a fee. - - 5. Conveying Modified Source Versions. - - You may convey a work based on the Program, or the modifications to -produce it from the Program, in the form of source code under the -terms of section 4, provided that you also meet all of these conditions: - - a) The work must carry prominent notices stating that you modified - it, and giving a relevant date. - - b) The work must carry prominent notices stating that it is - released under this License and any conditions added under section - 7. This requirement modifies the requirement in section 4 to - "keep intact all notices". - - c) You must license the entire work, as a whole, under this - License to anyone who comes into possession of a copy. This - License will therefore apply, along with any applicable section 7 - additional terms, to the whole of the work, and all its parts, - regardless of how they are packaged. This License gives no - permission to license the work in any other way, but it does not - invalidate such permission if you have separately received it. - - d) If the work has interactive user interfaces, each must display - Appropriate Legal Notices; however, if the Program has interactive - interfaces that do not display Appropriate Legal Notices, your - work need not make them do so. - - A compilation of a covered work with other separate and independent -works, which are not by their nature extensions of the covered work, -and which are not combined with it such as to form a larger program, -in or on a volume of a storage or distribution medium, is called an -"aggregate" if the compilation and its resulting copyright are not -used to limit the access or legal rights of the compilation's users -beyond what the individual works permit. Inclusion of a covered work -in an aggregate does not cause this License to apply to the other -parts of the aggregate. - - 6. Conveying Non-Source Forms. - - You may convey a covered work in object code form under the terms -of sections 4 and 5, provided that you also convey the -machine-readable Corresponding Source under the terms of this License, -in one of these ways: - - a) Convey the object code in, or embodied in, a physical product - (including a physical distribution medium), accompanied by the - Corresponding Source fixed on a durable physical medium - customarily used for software interchange. - - b) Convey the object code in, or embodied in, a physical product - (including a physical distribution medium), accompanied by a - written offer, valid for at least three years and valid for as - long as you offer spare parts or customer support for that product - model, to give anyone who possesses the object code either (1) a - copy of the Corresponding Source for all the software in the - product that is covered by this License, on a durable physical - medium customarily used for software interchange, for a price no - more than your reasonable cost of physically performing this - conveying of source, or (2) access to copy the - Corresponding Source from a network server at no charge. - - c) Convey individual copies of the object code with a copy of the - written offer to provide the Corresponding Source. This - alternative is allowed only occasionally and noncommercially, and - only if you received the object code with such an offer, in accord - with subsection 6b. - - d) Convey the object code by offering access from a designated - place (gratis or for a charge), and offer equivalent access to the - Corresponding Source in the same way through the same place at no - further charge. You need not require recipients to copy the - Corresponding Source along with the object code. If the place to - copy the object code is a network server, the Corresponding Source - may be on a different server (operated by you or a third party) - that supports equivalent copying facilities, provided you maintain - clear directions next to the object code saying where to find the - Corresponding Source. Regardless of what server hosts the - Corresponding Source, you remain obligated to ensure that it is - available for as long as needed to satisfy these requirements. - - e) Convey the object code using peer-to-peer transmission, provided - you inform other peers where the object code and Corresponding - Source of the work are being offered to the general public at no - charge under subsection 6d. - - A separable portion of the object code, whose source code is excluded -from the Corresponding Source as a System Library, need not be -included in conveying the object code work. - - A "User Product" is either (1) a "consumer product", which means any -tangible personal property which is normally used for personal, family, -or household purposes, or (2) anything designed or sold for incorporation -into a dwelling. In determining whether a product is a consumer product, -doubtful cases shall be resolved in favor of coverage. For a particular -product received by a particular user, "normally used" refers to a -typical or common use of that class of product, regardless of the status -of the particular user or of the way in which the particular user -actually uses, or expects or is expected to use, the product. A product -is a consumer product regardless of whether the product has substantial -commercial, industrial or non-consumer uses, unless such uses represent -the only significant mode of use of the product. - - "Installation Information" for a User Product means any methods, -procedures, authorization keys, or other information required to install -and execute modified versions of a covered work in that User Product from -a modified version of its Corresponding Source. The information must -suffice to ensure that the continued functioning of the modified object -code is in no case prevented or interfered with solely because -modification has been made. - - If you convey an object code work under this section in, or with, or -specifically for use in, a User Product, and the conveying occurs as -part of a transaction in which the right of possession and use of the -User Product is transferred to the recipient in perpetuity or for a -fixed term (regardless of how the transaction is characterized), the -Corresponding Source conveyed under this section must be accompanied -by the Installation Information. But this requirement does not apply -if neither you nor any third party retains the ability to install -modified object code on the User Product (for example, the work has -been installed in ROM). - - The requirement to provide Installation Information does not include a -requirement to continue to provide support service, warranty, or updates -for a work that has been modified or installed by the recipient, or for -the User Product in which it has been modified or installed. Access to a -network may be denied when the modification itself materially and -adversely affects the operation of the network or violates the rules and -protocols for communication across the network. - - Corresponding Source conveyed, and Installation Information provided, -in accord with this section must be in a format that is publicly -documented (and with an implementation available to the public in -source code form), and must require no special password or key for -unpacking, reading or copying. - - 7. Additional Terms. - - "Additional permissions" are terms that supplement the terms of this -License by making exceptions from one or more of its conditions. -Additional permissions that are applicable to the entire Program shall -be treated as though they were included in this License, to the extent -that they are valid under applicable law. If additional permissions -apply only to part of the Program, that part may be used separately -under those permissions, but the entire Program remains governed by -this License without regard to the additional permissions. - - When you convey a copy of a covered work, you may at your option -remove any additional permissions from that copy, or from any part of -it. (Additional permissions may be written to require their own -removal in certain cases when you modify the work.) You may place -additional permissions on material, added by you to a covered work, -for which you have or can give appropriate copyright permission. - - Notwithstanding any other provision of this License, for material you -add to a covered work, you may (if authorized by the copyright holders of -that material) supplement the terms of this License with terms: - - a) Disclaiming warranty or limiting liability differently from the - terms of sections 15 and 16 of this License; or - - b) Requiring preservation of specified reasonable legal notices or - author attributions in that material or in the Appropriate Legal - Notices displayed by works containing it; or - - c) Prohibiting misrepresentation of the origin of that material, or - requiring that modified versions of such material be marked in - reasonable ways as different from the original version; or - - d) Limiting the use for publicity purposes of names of licensors or - authors of the material; or - - e) Declining to grant rights under trademark law for use of some - trade names, trademarks, or service marks; or - - f) Requiring indemnification of licensors and authors of that - material by anyone who conveys the material (or modified versions of - it) with contractual assumptions of liability to the recipient, for - any liability that these contractual assumptions directly impose on - those licensors and authors. - - All other non-permissive additional terms are considered "further -restrictions" within the meaning of section 10. If the Program as you -received it, or any part of it, contains a notice stating that it is -governed by this License along with a term that is a further -restriction, you may remove that term. If a license document contains -a further restriction but permits relicensing or conveying under this -License, you may add to a covered work material governed by the terms -of that license document, provided that the further restriction does -not survive such relicensing or conveying. - - If you add terms to a covered work in accord with this section, you -must place, in the relevant source files, a statement of the -additional terms that apply to those files, or a notice indicating -where to find the applicable terms. - - Additional terms, permissive or non-permissive, may be stated in the -form of a separately written license, or stated as exceptions; -the above requirements apply either way. - - 8. Termination. - - You may not propagate or modify a covered work except as expressly -provided under this License. Any attempt otherwise to propagate or -modify it is void, and will automatically terminate your rights under -this License (including any patent licenses granted under the third -paragraph of section 11). - - However, if you cease all violation of this License, then your -license from a particular copyright holder is reinstated (a) -provisionally, unless and until the copyright holder explicitly and -finally terminates your license, and (b) permanently, if the copyright -holder fails to notify you of the violation by some reasonable means -prior to 60 days after the cessation. - - Moreover, your license from a particular copyright holder is -reinstated permanently if the copyright holder notifies you of the -violation by some reasonable means, this is the first time you have -received notice of violation of this License (for any work) from that -copyright holder, and you cure the violation prior to 30 days after -your receipt of the notice. - - Termination of your rights under this section does not terminate the -licenses of parties who have received copies or rights from you under -this License. If your rights have been terminated and not permanently -reinstated, you do not qualify to receive new licenses for the same -material under section 10. - - 9. Acceptance Not Required for Having Copies. - - You are not required to accept this License in order to receive or -run a copy of the Program. Ancillary propagation of a covered work -occurring solely as a consequence of using peer-to-peer transmission -to receive a copy likewise does not require acceptance. However, -nothing other than this License grants you permission to propagate or -modify any covered work. These actions infringe copyright if you do -not accept this License. Therefore, by modifying or propagating a -covered work, you indicate your acceptance of this License to do so. - - 10. Automatic Licensing of Downstream Recipients. - - Each time you convey a covered work, the recipient automatically -receives a license from the original licensors, to run, modify and -propagate that work, subject to this License. You are not responsible -for enforcing compliance by third parties with this License. - - An "entity transaction" is a transaction transferring control of an -organization, or substantially all assets of one, or subdividing an -organization, or merging organizations. If propagation of a covered -work results from an entity transaction, each party to that -transaction who receives a copy of the work also receives whatever -licenses to the work the party's predecessor in interest had or could -give under the previous paragraph, plus a right to possession of the -Corresponding Source of the work from the predecessor in interest, if -the predecessor has it or can get it with reasonable efforts. - - You may not impose any further restrictions on the exercise of the -rights granted or affirmed under this License. For example, you may -not impose a license fee, royalty, or other charge for exercise of -rights granted under this License, and you may not initiate litigation -(including a cross-claim or counterclaim in a lawsuit) alleging that -any patent claim is infringed by making, using, selling, offering for -sale, or importing the Program or any portion of it. - - 11. Patents. - - A "contributor" is a copyright holder who authorizes use under this -License of the Program or a work on which the Program is based. The -work thus licensed is called the contributor's "contributor version". - - A contributor's "essential patent claims" are all patent claims -owned or controlled by the contributor, whether already acquired or -hereafter acquired, that would be infringed by some manner, permitted -by this License, of making, using, or selling its contributor version, -but do not include claims that would be infringed only as a -consequence of further modification of the contributor version. For -purposes of this definition, "control" includes the right to grant -patent sublicenses in a manner consistent with the requirements of -this License. - - Each contributor grants you a non-exclusive, worldwide, royalty-free -patent license under the contributor's essential patent claims, to -make, use, sell, offer for sale, import and otherwise run, modify and -propagate the contents of its contributor version. - - In the following three paragraphs, a "patent license" is any express -agreement or commitment, however denominated, not to enforce a patent -(such as an express permission to practice a patent or covenant not to -sue for patent infringement). To "grant" such a patent license to a -party means to make such an agreement or commitment not to enforce a -patent against the party. - - If you convey a covered work, knowingly relying on a patent license, -and the Corresponding Source of the work is not available for anyone -to copy, free of charge and under the terms of this License, through a -publicly available network server or other readily accessible means, -then you must either (1) cause the Corresponding Source to be so -available, or (2) arrange to deprive yourself of the benefit of the -patent license for this particular work, or (3) arrange, in a manner -consistent with the requirements of this License, to extend the patent -license to downstream recipients. "Knowingly relying" means you have -actual knowledge that, but for the patent license, your conveying the -covered work in a country, or your recipient's use of the covered work -in a country, would infringe one or more identifiable patents in that -country that you have reason to believe are valid. - - If, pursuant to or in connection with a single transaction or -arrangement, you convey, or propagate by procuring conveyance of, a -covered work, and grant a patent license to some of the parties -receiving the covered work authorizing them to use, propagate, modify -or convey a specific copy of the covered work, then the patent license -you grant is automatically extended to all recipients of the covered -work and works based on it. - - A patent license is "discriminatory" if it does not include within -the scope of its coverage, prohibits the exercise of, or is -conditioned on the non-exercise of one or more of the rights that are -specifically granted under this License. You may not convey a covered -work if you are a party to an arrangement with a third party that is -in the business of distributing software, under which you make payment -to the third party based on the extent of your activity of conveying -the work, and under which the third party grants, to any of the -parties who would receive the covered work from you, a discriminatory -patent license (a) in connection with copies of the covered work -conveyed by you (or copies made from those copies), or (b) primarily -for and in connection with specific products or compilations that -contain the covered work, unless you entered into that arrangement, -or that patent license was granted, prior to 28 March 2007. - - Nothing in this License shall be construed as excluding or limiting -any implied license or other defenses to infringement that may -otherwise be available to you under applicable patent law. - - 12. No Surrender of Others' Freedom. - - If conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot convey a -covered work so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you may -not convey it at all. For example, if you agree to terms that obligate you -to collect a royalty for further conveying from those to whom you convey -the Program, the only way you could satisfy both those terms and this -License would be to refrain entirely from conveying the Program. - - 13. Use with the GNU Affero General Public License. - - Notwithstanding any other provision of this License, you have -permission to link or combine any covered work with a work licensed -under version 3 of the GNU Affero General Public License into a single -combined work, and to convey the resulting work. The terms of this -License will continue to apply to the part which is the covered work, -but the special requirements of the GNU Affero General Public License, -section 13, concerning interaction through a network will apply to the -combination as such. - - 14. Revised Versions of this License. - - The Free Software Foundation may publish revised and/or new versions of -the GNU General Public License from time to time. Such new versions will -be similar in spirit to the present version, but may differ in detail to -address new problems or concerns. - - Each version is given a distinguishing version number. If the -Program specifies that a certain numbered version of the GNU General -Public License "or any later version" applies to it, you have the -option of following the terms and conditions either of that numbered -version or of any later version published by the Free Software -Foundation. If the Program does not specify a version number of the -GNU General Public License, you may choose any version ever published -by the Free Software Foundation. - - If the Program specifies that a proxy can decide which future -versions of the GNU General Public License can be used, that proxy's -public statement of acceptance of a version permanently authorizes you -to choose that version for the Program. - - Later license versions may give you additional or different -permissions. However, no additional obligations are imposed on any -author or copyright holder as a result of your choosing to follow a -later version. - - 15. Disclaimer of Warranty. - - THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY -APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT -HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY -OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM -IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF -ALL NECESSARY SERVICING, REPAIR OR CORRECTION. - - 16. Limitation of Liability. - - IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING -WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS -THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY -GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE -USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF -DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD -PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), -EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF -SUCH DAMAGES. - - 17. Interpretation of Sections 15 and 16. - - If the disclaimer of warranty and limitation of liability provided -above cannot be given local legal effect according to their terms, -reviewing courts shall apply local law that most closely approximates -an absolute waiver of all civil liability in connection with the -Program, unless a warranty or assumption of liability accompanies a -copy of the Program in return for a fee. - - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Programs - - If you develop a new program, and you want it to be of the greatest -possible use to the public, the best way to achieve this is to make it -free software which everyone can redistribute and change under these terms. - - To do so, attach the following notices to the program. It is safest -to attach them to the start of each source file to most effectively -state the exclusion of warranty; and each file should have at least -the "copyright" line and a pointer to where the full notice is found. - - - Copyright (C) - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . - -Also add information on how to contact you by electronic and paper mail. - - If the program does terminal interaction, make it output a short -notice like this when it starts in an interactive mode: - - Copyright (C) - This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. - This is free software, and you are welcome to redistribute it - under certain conditions; type `show c' for details. - -The hypothetical commands `show w' and `show c' should show the appropriate -parts of the General Public License. Of course, your program's commands -might be different; for a GUI interface, you would use an "about box". - - You should also get your employer (if you work as a programmer) or school, -if any, to sign a "copyright disclaimer" for the program, if necessary. -For more information on this, and how to apply and follow the GNU GPL, see -. - - The GNU General Public License does not permit incorporating your program -into proprietary programs. If your program is a subroutine library, you -may consider it more useful to permit linking proprietary applications with -the library. If this is what you want to do, use the GNU Lesser General -Public License instead of this License. But first, please read -. diff --git a/config.template.toml b/config.template.toml deleted file mode 100644 index 939b932..0000000 --- a/config.template.toml +++ /dev/null @@ -1,28 +0,0 @@ -[SERVER] -host = "localhost" -port = 8181 -session_secret = "" # Run: import secrets; print(secrets.token_urlsafe(64)) -maintenance = false - -[DATABASE] -dsn = "postgres://mystbin:mystbin@database:5432/mystbin" - -[LIMITS] -paste_get = { rate = 30, per = 60, priority = 1, bucket = "ip" } -paste_get_day = { rate = 7200, per = 86400, priority = 2, bucket = "ip" } -paste_post = { rate = 10, per = 60, priority = 1, bucket = "ip" } -paste_post_day = { rate = 1440, per = 86400, priority = 2, bucket = "ip" } -global_limit = { rate = 21600, per = 86400, priority = 1, bucket = "ip" } - -[PASTES] -char_limit = 300_000 -file_limit = 5 -name_limit = 25 - -[REDIS] # optional key -limiter = "redis://redis:6379/0" # required if key present -sessions = "redis://redis:6379/1" # required if key present - -[GITHUB] # optional key -token = "..." # a github token capable of creating gists, non-optional if the above key is provided -timeout = 10 # how long to wait between posting gists if there's an influx of tokens posted. Non-optional diff --git a/core/__init__.py b/core/__init__.py deleted file mode 100644 index 57aab0c..0000000 --- a/core/__init__.py +++ /dev/null @@ -1,21 +0,0 @@ -"""MystBin. Share code easily. - -Copyright (C) 2020-Current PythonistaGuild - -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation, either version 3 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program. If not, see . -""" - -from .config import CONFIG as CONFIG -from .database import Database as Database -from .server import Application as Application diff --git a/core/config.py b/core/config.py deleted file mode 100644 index 6860326..0000000 --- a/core/config.py +++ /dev/null @@ -1,34 +0,0 @@ -"""MystBin. Share code easily. - -Copyright (C) 2020-Current PythonistaGuild - -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation, either version 3 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program. If not, see . -""" - -from __future__ import annotations - -from typing import TYPE_CHECKING - -import tomllib - - -if TYPE_CHECKING: - from types_.config import Config - - -__all__ = ("CONFIG",) - - -with open("config.toml", "rb") as fp: - CONFIG: Config = tomllib.load(fp) # type: ignore diff --git a/core/database.py b/core/database.py deleted file mode 100644 index 5c31c05..0000000 --- a/core/database.py +++ /dev/null @@ -1,299 +0,0 @@ -"""MystBin. Share code easily. - -Copyright (C) 2020-Current PythonistaGuild - -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation, either version 3 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program. If not, see . -""" - -from __future__ import annotations - -import asyncio -import datetime -import logging -from typing import TYPE_CHECKING, Any, Self - -import aiohttp -import asyncpg - -from core import CONFIG - -from . import utils -from .models import FileModel, PasteModel -from .scanners import SecurityInfo, Services - - -if TYPE_CHECKING: - _Pool = asyncpg.Pool[asyncpg.Record] - from types_.config import Github - from types_.github import PostGist - from types_.scanner import ScannerSecret -else: - _Pool = asyncpg.Pool - - -LOGGER: logging.Logger = logging.getLogger(__name__) - - -class Database: - pool: _Pool - - def __init__(self, *, dsn: str, session: aiohttp.ClientSession | None = None, github_config: Github | None) -> None: - self._dsn: str = dsn - self.session: aiohttp.ClientSession | None = session - self._handling_tokens = bool(self.session and github_config) - - if self._handling_tokens: - LOGGER.info("Setup to handle Discord Tokens.") - assert github_config # guarded by if here - - self._gist_token = github_config["token"] - self._gist_timeout = github_config["timeout"] - # tokens bucket for gist posting: {paste_id: token\ntoken} - self.__tokens_bucket: dict[str, str] = {} - self.__token_lock = asyncio.Lock() - self.__token_task = asyncio.create_task(self._token_task()) - - async def __aenter__(self) -> Self: - await self.connect() - return self - - async def __aexit__(self, *_: Any) -> None: - task: asyncio.Task[None] | None = getattr(self, "__token_task", None) - if task: - task.cancel() - - await self.close() - - async def _token_task(self) -> None: - # won't run unless pre-reqs are met in __init__ - while True: - if self.__tokens_bucket: - async with self.__token_lock: - await self._post_gist_of_tokens() - - await asyncio.sleep(self._gist_timeout) - - def _handle_discord_tokens(self, tokens: list[str], paste_id: str) -> None: - if not self._handling_tokens or not tokens: - return - - LOGGER.info( - "Discord bot token located and added to token bucket. Current bucket size is: %s", len(self.__tokens_bucket) - ) - - self.__tokens_bucket[paste_id] = "\n".join(tokens) - - async def _post_gist_of_tokens(self) -> None: - assert self.session # guarded in caller - json_payload: PostGist = { - "description": "MystBin found these Discord tokens in a public paste, and posted them here to invalidate them. If you intended to share these, please apply a password to the paste.", - "files": {}, - "public": True, - } - - github_headers = { - "Accept": "application/vnd.github+json", - "Authorization": f"Bearer {self._gist_token}", - "X-GitHub-Api-Version": "2022-11-28", - } - - current_tokens = self.__tokens_bucket - self.__tokens_bucket = {} - - for paste_id, tokens in current_tokens.items(): - filename = str(datetime.datetime.now(datetime.UTC)) + "-tokens.txt" - json_payload["files"][filename] = {"content": f"https://mystb.in/{paste_id}:\n{tokens}"} - - success = False - - try: - async with self.session.post( - "https://api.github.com/gists", headers=github_headers, json=json_payload - ) as resp: - success = resp.ok - - if not success: - response_body = await resp.text() - LOGGER.error( - "Failed to create gist with token bucket with response status code %s and response body:\n\n%s", - resp.status, - response_body, - ) - except (aiohttp.ClientError, aiohttp.ClientOSError) as error: - success = False - LOGGER.error("Failed to handle gist creation due to a client or operating system error", exc_info=error) - - if success: - LOGGER.info("Gist created and invalidated tokens from %s pastes.", len(current_tokens)) - else: - self.__tokens_bucket.update(current_tokens) - - async def connect(self) -> None: - try: - pool: asyncpg.Pool[asyncpg.Record] | None = await asyncpg.create_pool(dsn=self._dsn) - except Exception as e: - raise RuntimeError from e - - if not pool: - raise RuntimeError("Failed to connect to the database... No additional information.") - - with open("schema.sql") as fp: - await pool.execute(fp.read()) - - self.pool = pool - LOGGER.info("Successfully connected to the database.") - - async def close(self) -> None: - try: - await asyncio.wait_for(self.pool.close(), timeout=10) - except TimeoutError: - LOGGER.warning("Failed to greacefully close the database connection...") - else: - LOGGER.info("Successfully closed the database connection.") - - async def fetch_paste(self, identifier: str, *, password: str | None) -> PasteModel | None: - assert self.pool - - paste_query: str = """ - UPDATE pastes SET views = views + 1 WHERE id = $1 - RETURNING *, - CASE WHEN password IS NOT NULL THEN true - ELSE false END AS has_password, - CASE WHEN password = CRYPT($2, password) THEN true - ELSE false END AS password_ok - """ - - file_query: str = """ - SELECT * FROM files WHERE parent_id = $1 - """ - - async with self.pool.acquire() as connection: - record: asyncpg.Record | None = await connection.fetchrow(paste_query, identifier, password) - - if not record: - return - - paste: PasteModel = PasteModel(record) - if paste.expires and paste.expires <= datetime.datetime.now(tz=datetime.timezone.utc): - await connection.execute("DELETE FROM pastes WHERE id = $1", identifier) - return - - if paste.has_password and not paste.password_ok: - return paste - - records: list[asyncpg.Record] = await connection.fetch(file_query, identifier) - paste.files = [FileModel(d) for d in records] - - return paste - - async def create_paste(self, *, data: dict[str, Any]) -> PasteModel: - assert self.pool - - paste_query: str = """ - INSERT INTO pastes (id, expires, password, safety) - VALUES ($1, $2, (SELECT crypt($3, gen_salt('bf')) WHERE $3 is not null), $4) - RETURNING * - """ - - file_query: str = """ - INSERT INTO files (parent_id, content, filename, loc, annotation, warning_positions) - VALUES ($1, $2, $3, $4, $5, $6) - RETURNING * - """ - - files: list[dict[str, Any]] = data["files"] - expiry: str | None = data["expires"] - password: str | None = data["password"] - - async with self.pool.acquire() as connection: - while True: - identifier: str = utils.generate_id() - safety: str = utils.generate_safety_token() - - try: - paster: asyncpg.Record | None = await connection.fetchrow( - paste_query, - identifier, - expiry, - password, - safety, - ) - except asyncpg.exceptions.UniqueViolationError: - continue - else: - break - - assert paster - - paste: PasteModel = PasteModel(paster) - async with connection.transaction(): - for index, file in enumerate(files, 1): - name: str = (file.get("filename") or f"file_{index}")[-CONFIG["PASTES"]["name_limit"] :] - name = "_".join(name.splitlines()) - - # Normalise newlines... - content: str = file["content"].replace("\r\n", "\n").replace("\r", "\n") - loc: int = file["content"].count("\n") + 1 - - positions: list[int] = [] - extra: str = "" - - secrets: list[ScannerSecret] = SecurityInfo.scan_file(content) - for payload in secrets: - service: Services = payload["service"] - - extra += f"{service.value}, " - positions += [t[0] for t in payload["tokens"]] - - if not password and self._handling_tokens and service is Services.discord: - self._handle_discord_tokens(tokens=[t[1] for t in payload["tokens"]], paste_id=paste.id) - - extra = extra.removesuffix(", ") - annotation = f"Contains possibly sensitive data from: {extra}" if extra else "" - - row: asyncpg.Record | None = await connection.fetchrow( - file_query, - paste.id, - content, - name, - loc, - annotation, - sorted(positions), - ) - - if row: - paste.files.append(FileModel(row)) - - return paste - - async def fetch_paste_security(self, *, token: str) -> PasteModel | None: - query: str = """SELECT * FROM pastes WHERE safety = $1""" - - async with self.pool.acquire() as connection: - record: asyncpg.Record | None = await connection.fetchrow(query, token) - if not record: - return - - paste: PasteModel = PasteModel(record=record) - if paste.expires and paste.expires <= datetime.datetime.now(tz=datetime.timezone.utc): - await connection.execute("DELETE FROM pastes WHERE id = $1", token) - return - - return paste - - async def delete_paste_security(self, *, token: str) -> None: - query: str = """DELETE FROM pastes WHERE safety = $1""" - - async with self.pool.acquire() as connection: - await connection.execute(query, token) diff --git a/core/models.py b/core/models.py deleted file mode 100644 index 414d097..0000000 --- a/core/models.py +++ /dev/null @@ -1,85 +0,0 @@ -"""MystBin. Share code easily. - -Copyright (C) 2020-Current PythonistaGuild - -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation, either version 3 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program. If not, see . -""" - -import datetime -from collections.abc import Iterator, Mapping -from typing import Any - -import asyncpg - - -class BaseModel(Mapping[str, Any]): - __slots__ = ("record",) - - def __init__(self, record: asyncpg.Record | dict[str, Any], /) -> None: - self.record: dict[str, Any] = dict(record) - - def __getitem__(self, key: str) -> Any: - return self.record[key] - - def __iter__(self) -> Iterator[str]: - return iter(self.record) - - def __len__(self) -> int: - return len(self.record) - - def serialize(self, *, exclude: list[str] = ["file_index"]) -> dict[str, Any]: - new: dict[str, Any] = {} - - for key, value in self.record.items(): - if key in exclude: - continue - - if isinstance(value, datetime.datetime): - new[key] = value.isoformat() - else: - new[key] = value - - if isinstance(self, PasteModel) and self.files: - new["files"] = [f.serialize() for f in self.files] - - return new - - -class FileModel(BaseModel): - def __init__(self, record: asyncpg.Record | dict[str, Any]) -> None: - super().__init__(record) - - self.parent_id: str = record["parent_id"] - self.content: str = record["content"] - self.filename: str = record["filename"] - self.loc: int = record["loc"] - self.charcount: int = record["charcount"] - self.index: int = record["file_index"] - self.annotation: str | None = record["annotation"] - self.warning_positions: list[int] = record["warning_positions"] - - -class PasteModel(BaseModel): - def __init__(self, record: asyncpg.Record) -> None: - super().__init__(record) - - self.id: str = record["id"] - self.created_at: datetime.datetime = record["created_at"] - self.expires: datetime.datetime | None = record["expires"] - self.password: str | None = record["password"] - self.views: int = record["views"] - self.safety: str = record["safety"] - self.has_password: bool | None = record.get("has_password", None) - self.password_ok: bool | None = record.get("password_ok", None) - self.files: list[FileModel] = [] diff --git a/core/scanners.py b/core/scanners.py deleted file mode 100644 index 12433e3..0000000 --- a/core/scanners.py +++ /dev/null @@ -1,134 +0,0 @@ -"""MystBin. Share code easily. - -Copyright (C) 2020-Current PythonistaGuild - -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation, either version 3 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program. If not, see . -""" - -from __future__ import annotations - -import base64 -import binascii -import enum -import logging -import re -from typing import TYPE_CHECKING, ClassVar - - -if TYPE_CHECKING: - from types_.scanner import ScannerSecret - - -logger: logging.Logger = logging.getLogger(__name__) - - -class Services(enum.Enum): - discord = "Discord" - pypi = "PyPi" - github = "GitHub" - - -class BaseScanner: - REGEX: ClassVar[re.Pattern[str]] - SERVICE: ClassVar[Services] - - @classmethod - def match(cls, content: str) -> ScannerSecret: - matches: list[tuple[int, str]] = [(m.start(0), m.group(0)) for m in cls.REGEX.finditer(content)] - - payload: ScannerSecret = { - "service": cls.SERVICE, - "tokens": matches, - } - - return payload - - -class DiscordScanner(BaseScanner): - REGEX = re.compile(r"[a-zA-Z0-9_-]{23,28}\.[a-zA-Z0-9_-]{6,7}\.[a-zA-Z0-9_-]{27,}") - SERVICE = Services.discord - - @staticmethod - def validate_discord_token(token: str) -> bool: - try: - # Just check if the first part validates as a user ID - (user_id, _, _) = token.split(".") - user_id = int(base64.b64decode(user_id + "=" * (len(user_id) % 4), validate=True)) - except (ValueError, binascii.Error): - return False - else: - return True - - @classmethod - def match(cls, content: str) -> ScannerSecret: - matches: list[tuple[int, str]] = [ - (m.start(0), m.group(0)) for m in cls.REGEX.finditer(content) if cls.validate_discord_token(m.group(0)) - ] - - payload: ScannerSecret = { - "service": cls.SERVICE, - "tokens": matches, - } - - return payload - - -class PyPiScanner(BaseScanner): - REGEX = re.compile(r"pypi-AgEIcHlwaS5vcmc[A-Za-z0-9-_]{70,}") - SERVICE = Services.pypi - - -class GitHubScanner(BaseScanner): - REGEX = re.compile(r"((ghp|gho|ghu|ghs|ghr)_[A-Za-z0-9_]{36})") - SERVICE = Services.github - - -class SecurityInfo: - __SERVICE_MAPPING: ClassVar[dict[Services, type[BaseScanner]]] = { - Services.discord: DiscordScanner, - Services.pypi: PyPiScanner, - Services.github: GitHubScanner, - } - - @classmethod - def scan_file( - cls, - file: str, - /, - *, - allowed: list[Services] | None = None, - disallowed: list[Services] | None = None, - ) -> list[ScannerSecret]: - """Scan for tokens in a given files content. - - You may pass a list of allowed or disallowed Services. - If both lists are empty (Default) all available services will be scanned. - """ - disallowed = disallowed or [] - allowed = allowed or list(Services) - - services: list[Services] = [s for s in allowed if s not in disallowed] - secrets: list[ScannerSecret] = [] - - for service in services: - scanner: type[BaseScanner] | None = cls.__SERVICE_MAPPING.get(service, None) - if not scanner: - logging.warning("The provided service %r is not a supported or a valid service.", service) - continue - - found: ScannerSecret = scanner.match(file) - if found["tokens"]: - secrets.append(found) - - return secrets diff --git a/core/server.py b/core/server.py deleted file mode 100644 index bed80bc..0000000 --- a/core/server.py +++ /dev/null @@ -1,112 +0,0 @@ -"""MystBin. Share code easily. - -Copyright (C) 2020-Current PythonistaGuild - -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation, either version 3 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program. If not, see . -""" - -import logging - -import aiohttp -import starlette_plus -from starlette.middleware import Middleware -from starlette.routing import Mount, Route -from starlette.schemas import SchemaGenerator -from starlette.staticfiles import StaticFiles - -from core.database import Database -from views import * - -from .config import CONFIG - - -logger: logging.Logger = logging.getLogger(__name__) - - -class Application(starlette_plus.Application): - def __init__(self, *, database: Database, session: aiohttp.ClientSession | None = None) -> None: - self.database: Database = database - self.session: aiohttp.ClientSession | None = session - self.schemas: SchemaGenerator | None = None - - views: list[starlette_plus.View] = [ - HTMXView(self), - APIView(self), - DocsView(self), - ] - routes: list[Mount | Route] = [Mount("/static", app=StaticFiles(directory="web/static"), name="static")] - - if redis_key := CONFIG.get("REDIS"): - limit_url = redis_key["limiter"] - session_url = redis_key["sessions"] - else: - limit_url = None - session_url = None - - limit_redis = starlette_plus.Redis(url=limit_url) - sess_redis = starlette_plus.Redis(url=session_url) - - global_limits = [CONFIG["LIMITS"]["global_limit"]] - middleware = [ - Middleware( - starlette_plus.middleware.RatelimitMiddleware, - ignore_localhost=True, - redis=limit_redis, - global_limits=global_limits, - ), - Middleware( - starlette_plus.middleware.SessionMiddleware, - secret=CONFIG["SERVER"]["session_secret"], - redis=sess_redis, - max_age=86400, - ), - ] - - if CONFIG["SERVER"]["maintenance"]: - # inject a catch all before any route... - routes.append(Route("/", self.maint_mode, methods=["GET", "POST", "PUT", "PATCH", "DELETE", "OPTIONS"])) - routes.append( - Route("/{path:path}", self.maint_mode, methods=["GET", "POST", "PUT", "PATCH", "DELETE", "OPTIONS"]) - ) - - super().__init__(on_startup=[self.event_ready], views=views, routes=routes, middleware=middleware) - - @staticmethod - async def maint_mode(request: starlette_plus.Request) -> starlette_plus.Response: - return starlette_plus.FileResponse("web/maint.html") - - @starlette_plus.route("/docs") - @starlette_plus.route("/documentation") - async def documentation_redirect(self, request: starlette_plus.Request) -> starlette_plus.Response: - return starlette_plus.RedirectResponse("/api/documentation") - - @starlette_plus.route("/documents", methods=["POST"]) - @starlette_plus.route("/api/documents", methods=["POST"]) - async def documents_redirect(self, request: starlette_plus.Request) -> starlette_plus.Response: - # Compat redirect route... - return starlette_plus.RedirectResponse("/api/paste", status_code=308) - - async def event_ready(self) -> None: - self.schemas = SchemaGenerator( - { - "openapi": "3.1.0", - "info": { - "title": "MystBin API", - "version": "4.0", - "summary": "API Documentation", - "description": "MystBin - Easily share code and text.", - }, - } - ) - logger.info("MystBin application has successfully started!") diff --git a/core/utils.py b/core/utils.py deleted file mode 100644 index b525a15..0000000 --- a/core/utils.py +++ /dev/null @@ -1,159 +0,0 @@ -"""MystBin. Share code easily. - -Copyright (C) 2020-Current PythonistaGuild - -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation, either version 3 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program. If not, see . -""" - -from __future__ import annotations - -import base64 -import binascii -import datetime -import json -import re -import secrets -from typing import Any - -import starlette_plus - -from core import CONFIG - - -TOKEN_REGEX = re.compile(r"[a-zA-Z0-9_-]{23,28}\.[a-zA-Z0-9_-]{6,7}\.[a-zA-Z0-9_-]{27,}") - - -def generate_id() -> str: - return secrets.token_hex(9) - - -def generate_safety_token() -> str: - return secrets.token_urlsafe(64) - - -async def json_or_text(request: starlette_plus.Request) -> dict[str, Any] | str: - text: str = str(await request.body()) - - try: - data: dict[str, Any] = json.loads(text) - except json.JSONDecodeError: - return text - - return data - - -def validate_paste(data: dict[str, Any]) -> starlette_plus.Response | None: - limit: int = CONFIG["PASTES"]["char_limit"] - file_limit: int = CONFIG["PASTES"]["file_limit"] - - try: - files: list[dict[str, str | None]] = data["files"] - except KeyError: - return starlette_plus.JSONResponse({"error": 'Missing the "files" parameter.'}, status_code=400) - - if len(files) > file_limit: - return starlette_plus.JSONResponse( - {"error": f'Paste exceeds the file limit of "{file_limit}" files.'}, - status_code=400, - ) - - for index, file in enumerate(files): - try: - content: str | None = file["content"] - except KeyError: - return starlette_plus.JSONResponse( - {"error": f'The file at index "{index}" is missing the content parameter.'}, - status_code=400, - ) - - if not content: - return starlette_plus.JSONResponse( - {"error": f'The file at index "{index}" has no content.'}, - status_code=400, - ) - - if len(content) > limit: - return starlette_plus.JSONResponse( - {"error": f'The file at index "{index}" exceeds content size limits of "{limit}" characters.'}, - status_code=400, - ) - - -def validate_discord_token(token: str) -> bool: - try: - # Just check if the first part validates as a user ID - (user_id, _, _) = token.split(".") - user_id = int(base64.b64decode(user_id + "==", validate=True)) - except (ValueError, binascii.Error): - return False - else: - return True - - -def pluralize(count: int, singular: str) -> str: - return singular if count == 1 else singular + "s" - - -def natural_time( - td: datetime.timedelta, - /, - *, - source: datetime.datetime | None = None, -) -> str: - now = source or datetime.datetime.now(datetime.UTC) - - then = now - td - future = then > now - - seconds = round(td.total_seconds()) - - if seconds < 60 and not future: - return "now" - - ago = "{delta} from now" if future else "{delta} ago" - - years, seconds = divmod(seconds, 60 * 60 * 24 * 365) - months, seconds = divmod(seconds, 60 * 60 * 24 * 30) - weeks, seconds = divmod(seconds, 60 * 60 * 24 * 7) - days, seconds = divmod(seconds, 60 * 60 * 24) - hours, seconds = divmod(seconds, 60 * 60) - minutes, seconds = divmod(seconds, 60) - - ret = "" - - if years: - ret += f"{years} {pluralize(years, 'year')}" - if months: - ret += f", {months} {pluralize(months, 'month')}" - elif months: - ret += f"{months} {pluralize(months, 'month')}" - elif weeks: - ret += f"{weeks} {pluralize(weeks, 'week')}" - if days: - ret += f", {days} {pluralize(days, 'day')}" - elif days: - ret += f"{days} {pluralize(days, 'day')}" - - if hours and not years and not months and not weeks and not days: - if ret: - ret += ", " - ret += f"{hours} {pluralize(hours, 'hour')}" - if minutes and not years and not months and not weeks and not days and not hours: - if ret: - ret += ", " - ret += f"{minutes} {pluralize(minutes, 'minute')}" - - formatted_ret = ", ".join(ret.split(", ")[:2]) - - return ago.format(delta=formatted_ret) diff --git a/docker-compose.yaml b/docker-compose.yaml deleted file mode 100644 index f04636e..0000000 --- a/docker-compose.yaml +++ /dev/null @@ -1,42 +0,0 @@ -services: - mystbin: - image: ghcr.io/pythonistaguild/mystbin - container_name: mystbin - ports: - - 8181:8181 - restart: unless-stopped - depends_on: - database: - condition: service_healthy - restart: true - volumes: - - ./config.toml:/app/config.toml:ro - - database: - image: postgres:latest - container_name: mystbin-database - restart: unless-stopped - healthcheck: - test: ["CMD-SHELL", "pg_isready -d $${POSTGRES_DB} -U $${POSTGRES_USER}"] - interval: 10s - timeout: 5s - retries: 5 - env_file: .env - environment: - - PG_DATA=/var/lib/postgresql/data - - POSTGRES_DB=mystbin - volumes: - - mystbin_pg_data:/var/lib/postgresql/data - - redis: - image: redis:latest - container_name: mystbin-redis - restart: unless-stopped - profiles: - - redis - volumes: - - "./redis.conf:/config/redis.conf:ro" - command: ["redis-server", "/config/redis.conf"] - -volumes: - mystbin_pg_data: diff --git a/launcher.py b/launcher.py deleted file mode 100644 index 05fc09d..0000000 --- a/launcher.py +++ /dev/null @@ -1,58 +0,0 @@ -"""MystBin. Share code easily. - -Copyright (C) 2020-Current PythonistaGuild - -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation, either version 3 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program. If not, see . -""" - -import asyncio -import logging - -import aiohttp -import starlette_plus -import uvicorn - -import core -import core.config - - -starlette_plus.setup_logging(level=logging.INFO) -logger: logging.Logger = logging.getLogger(__name__) - - -async def main() -> None: - async with aiohttp.ClientSession() as session, core.Database( - dsn=core.CONFIG["DATABASE"]["dsn"], session=session, github_config=core.CONFIG.get("GITHUB") - ) as database: - app: core.Application = core.Application(database=database) - - host: str = core.CONFIG["SERVER"]["host"] - port: int = core.CONFIG["SERVER"]["port"] - - config: uvicorn.Config = uvicorn.Config( - app=app, - host=host, - port=port, - access_log=False, - forwarded_allow_ips="*", - ) - server: uvicorn.Server = uvicorn.Server(config) - - await server.serve() - - -try: - asyncio.run(main()) -except KeyboardInterrupt: - logger.info("Closing the MystBin application due to KeyboardInterrupt.") diff --git a/migration.sql b/migration.sql deleted file mode 100644 index 899c850..0000000 --- a/migration.sql +++ /dev/null @@ -1,26 +0,0 @@ -BEGIN; -- start transaction - -SAVEPOINT pastes; -ALTER TABLE pastes DROP COLUMN IF EXISTS author_id CASCADE; -- no longer storing users -ALTER TABLE pastes DROP COLUMN IF EXISTS last_edited CASCADE; -- no longer allowing edits -ALTER TABLE pastes ALTER COLUMN password SET DEFAULT NULL; -- nullable password by default -ALTER TABLE pastes DROP COLUMN IF EXISTS origin_ip CASCADE; -- no longer needed -ALTER TABLE pastes ADD COLUMN IF NOT EXISTS safety TEXT UNIQUE; -- this is how we handle paste deletion. -UPDATE pastes SET safety = gen_random_uuid(); -- Populate with junk data. -ALTER TABLE pastes ALTER COLUMN safety SET NOT NULL; -- add not null constraint -CREATE UNIQUE INDEX IF NOT EXISTS pastes_safety_idx ON pastes (safety); -- -- Index by safety keys for faster lookup to delete. - -SAVEPOINT files; -ALTER TABLE files ALTER COLUMN filename SET NOT NULL; -- always require filename -ALTER TABLE files DROP COLUMN IF EXISTS attachment; -- we don't have these anymore -ALTER TABLE files ADD COLUMN IF NOT EXISTS annotation TEXT; -ALTER TABLE files RENAME COLUMN index TO file_index; -- bad column name -ALTER TABLE files ADD COLUMN IF NOT EXISTS warning_positions INTEGER[]; -- New line warning positions - -SAVEPOINT drops; -DROP TABLE IF EXISTS bans CASCADE; -- no longer needed -DROP TABLE IF EXISTS logs CASCADE; -- no longer needed -DROP TABLE IF EXISTS bookmarks CASCADE; -- no longer needed -DROP TABLE IF EXISTS users CASCADE; -- no longer needed - -COMMIT; diff --git a/pyproject.toml b/pyproject.toml deleted file mode 100644 index ee4903a..0000000 --- a/pyproject.toml +++ /dev/null @@ -1,64 +0,0 @@ -[tool.ruff] -line-length = 120 -indent-width = 4 -exclude = ["venv", ".venv"] - -[tool.ruff.lint] -select = [ - "C4", - "E", - "F", - "G", - "I", - "PTH", - "RUF", - "SIM", - "TCH", - "UP", - "W", - "PERF", - "ANN", -] -ignore = [ - "F402", - "F403", - "F405", - "PERF203", - "RUF001", - "RUF009", - "SIM105", - "UP034", - "UP038", - "ANN101", - "ANN102", - "ANN401", - "UP031", - "PTH123", - "E203", - "E501", -] - -[tool.ruff.lint.isort] -split-on-trailing-comma = true -combine-as-imports = true -lines-after-imports = 2 - -[tool.ruff.lint.flake8-annotations] -allow-star-arg-any = true - -[tool.ruff.lint.flake8-quotes] -inline-quotes = "double" - -[tool.ruff.format] -quote-style = "double" -indent-style = "space" -skip-magic-trailing-comma = false -line-ending = "auto" - -[tool.pyright] -exclude = ["venv", ".venv"] -useLibraryCodeForTypes = true -typeCheckingMode = "strict" -reportImportCycles = false -reportPrivateUsage = false -pythonVersion = "3.11" diff --git a/redis.conf b/redis.conf deleted file mode 100644 index df87817..0000000 --- a/redis.conf +++ /dev/null @@ -1,2 +0,0 @@ -port 6379 -tcp-backlog 511 diff --git a/requirements.txt b/requirements.txt deleted file mode 100644 index 14b5840..0000000 --- a/requirements.txt +++ /dev/null @@ -1,8 +0,0 @@ -starlette_plus @ git+https://github.com/PythonistaGuild/StarlettePlus.git@f21169a -uvicorn==0.29.0 -asyncpg==0.29.0 -asyncpg-stubs==0.29.1 -bleach==6.1.0 -python-multipart==0.0.9 -aiohttp==3.10.5 -pyyaml==6.0.1 diff --git a/schema.sql b/schema.sql deleted file mode 100644 index 3ca0776..0000000 --- a/schema.sql +++ /dev/null @@ -1,25 +0,0 @@ -CREATE EXTENSION IF NOT EXISTS pgcrypto; - -CREATE TABLE IF NOT EXISTS pastes ( - id TEXT PRIMARY KEY, - created_at TIMESTAMP NOT NULL DEFAULT (NOW() AT TIME ZONE 'UTC'), - expires TIMESTAMP WITH TIME ZONE, - password TEXT DEFAULT NULL, - views INTEGER DEFAULT 0, - safety TEXT UNIQUE -); - -CREATE UNIQUE INDEX IF NOT EXISTS pastes_safety_idx ON pastes (safety); --- Index by safety keys for faster lookup to delete. - -CREATE TABLE IF NOT EXISTS files ( - parent_id TEXT REFERENCES pastes(id) ON DELETE CASCADE, - content TEXT NOT NULL, - filename TEXT NOT NULL, - loc INTEGER NOT NULL, - charcount INTEGER GENERATED ALWAYS AS (LENGTH(content)) STORED, - file_index SERIAL NOT NULL, - annotation TEXT, - warning_positions INTEGER[], - PRIMARY KEY (parent_id, file_index) -); diff --git a/types_/config.py b/types_/config.py deleted file mode 100644 index 8be4827..0000000 --- a/types_/config.py +++ /dev/null @@ -1,66 +0,0 @@ -"""MystBin. Share code easily. - -Copyright (C) 2020-Current PythonistaGuild - -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation, either version 3 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program. If not, see . -""" - -from typing import NotRequired, TypedDict - -import starlette_plus - - -class Server(TypedDict): - host: str - port: int - domain: str - session_secret: str - maintenance: bool - - -class Database(TypedDict): - dsn: str - - -class Redis(TypedDict): - limiter: str - sessions: str - - -class Limits(TypedDict): - paste_get: starlette_plus.RateLimitData - paste_get_day: starlette_plus.RateLimitData - paste_post: starlette_plus.RateLimitData - paste_post_day: starlette_plus.RateLimitData - global_limit: starlette_plus.RateLimitData - - -class Pastes(TypedDict): - char_limit: int - file_limit: int - name_limit: int - - -class Github(TypedDict): - token: str - timeout: float - - -class Config(TypedDict): - SERVER: Server - DATABASE: Database - REDIS: NotRequired[Redis] - LIMITS: Limits - PASTES: Pastes - GITHUB: NotRequired[Github] diff --git a/types_/github.py b/types_/github.py deleted file mode 100644 index 8d3311a..0000000 --- a/types_/github.py +++ /dev/null @@ -1,29 +0,0 @@ -"""MystBin. Share code easily. - -Copyright (C) 2020-Current PythonistaGuild - -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation, either version 3 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program. If not, see . -""" - -from typing import TypedDict - - -class GistContent(TypedDict): - content: str - - -class PostGist(TypedDict): - description: str - files: dict[str, GistContent] - public: bool diff --git a/types_/scanner.py b/types_/scanner.py deleted file mode 100644 index 3b63909..0000000 --- a/types_/scanner.py +++ /dev/null @@ -1,30 +0,0 @@ -"""MystBin. Share code easily. - -Copyright (C) 2020-Current PythonistaGuild - -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation, either version 3 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program. If not, see . -""" - -from __future__ import annotations - -from typing import TYPE_CHECKING, TypedDict - - -if TYPE_CHECKING: - from core.scanners import Services - - -class ScannerSecret(TypedDict): - service: Services - tokens: list[tuple[int, str]] diff --git a/views/__init__.py b/views/__init__.py deleted file mode 100644 index 5196a58..0000000 --- a/views/__init__.py +++ /dev/null @@ -1,21 +0,0 @@ -"""MystBin. Share code easily. - -Copyright (C) 2020-Current PythonistaGuild - -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation, either version 3 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program. If not, see . -""" - -from .api import APIView as APIView -from .docs import DocsView as DocsView -from .htmx import HTMXView as HTMXView diff --git a/views/api.py b/views/api.py deleted file mode 100644 index ba0d583..0000000 --- a/views/api.py +++ /dev/null @@ -1,360 +0,0 @@ -"""MystBin. Share code easily. - -Copyright (C) 2020-Current PythonistaGuild - -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation, either version 3 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program. If not, see . -""" - -from __future__ import annotations - -import datetime -import json -from typing import TYPE_CHECKING, Any - -import asyncpg -import starlette_plus - -from core import CONFIG -from core.utils import validate_paste - - -if TYPE_CHECKING: - from core import Application - - -class APIView(starlette_plus.View, prefix="api"): - def __init__(self, app: Application) -> None: - self.app: Application = app - - @starlette_plus.route("/paste/{id}", methods=["GET"]) - @starlette_plus.route("/pastes/{id}", methods=["GET"], include_in_schema=False) - @starlette_plus.limit(**CONFIG["LIMITS"]["paste_get"]) - @starlette_plus.limit(**CONFIG["LIMITS"]["paste_get_day"]) - async def paste_get(self, request: starlette_plus.Request) -> starlette_plus.Response: - """Fetch a paste. - - --- - summary: Fetch a paste. - description: - Fetches a paste with all relevant meta-data and files.\n\n - - Fetching pastes does not include the `password` or `safety` fields. You only receive the `safety` field - directly after creating a paste. - - parameters: - - in: path - name: id - schema: - type: string - required: true - description: The paste ID. - - - in: header - name: Authorization - schema: - type: string - format: basic - required: false - description: The password for the paste; if one is required. - - responses: - 200: - description: The paste meta-data and files. - content: - application/json: - schema: - type: object - properties: - id: - type: string - example: abc123 - created_at: - type: string - example: 2024-01-01T00:00:00.000000+00:00 - expires: - type: string - views: - type: integer - example: 3 - has_password: - type: boolean - example: false - files: - type: array - items: - type: object - properties: - parent_id: - type: string - content: - type: string - filename: - type: string - loc: - type: integer - charcount: - type: integer - annotation: - type: string - - 404: - description: The paste does not exist or has been previously deleted. - content: - application/json: - schema: - type: object - properties: - error: - type: string - - 401: - description: You are not authorized to view this paste or you provided an incorrect password. - content: - application/json: - schema: - type: object - properties: - error: - type: string - example: Unauthorized. - - 429: - description: You are requesting too fast. - content: - application/json: - schema: - type: object - properties: - error: - type: string - example: You are requesting too fast. - """ - password: str | None = request.headers.get("authorization", None) - identifier: str = request.path_params["id"] - - paste = await self.app.database.fetch_paste(identifier, password=password) - if not paste: - return starlette_plus.JSONResponse( - {"error": f'A paste with the id "{identifier}" could not be found or has expired.'}, status_code=404 - ) - - if paste.has_password and not paste.password_ok: - return starlette_plus.JSONResponse({"error": "Unauthorized"}, status_code=401) - - to_return: dict[str, Any] = paste.serialize(exclude=["safety", "password", "password_ok"]) - return starlette_plus.JSONResponse(to_return) - - @starlette_plus.route("/paste", methods=["POST"]) - @starlette_plus.route("/pastes", methods=["POST"], include_in_schema=False) - @starlette_plus.limit(**CONFIG["LIMITS"]["paste_post"]) - @starlette_plus.limit(**CONFIG["LIMITS"]["paste_post_day"]) - async def paste_post(self, request: starlette_plus.Request) -> starlette_plus.Response: - """Create a paste. - - --- - summary: Create a paste. - description: - Creates a paste with or without multiple files for view on the web or via the API. - You can use this endpoint to POST valid `JSON` data or `plain-text` content.\n\n\n - - When using `plain-text`, only one file will be created, without a password or expiry.\n\n\n - - Max Character per file is `300_000`.\n\n - - Max file limit is `5`.\n\n - - If the paste is regarded as public, and contains Discord authorization tokens, - then these will be invalidated upon paste creation.\n\n - - requestBody: - description: The paste data. `password` and `expires` are optional. - content: - application/json: - schema: - type: object - properties: - files: - type: array - items: - type: object - properties: - filename: - type: string - required: false - content: - type: string - required: true - example: - - filename: thing.py - content: print(\"Hello World!\") - - content: Some text or code... - password: - required: false - type: string - example: null - expires: - required: false - type: string - example: null - text/plain: - schema: - type: string - - responses: - 200: - description: The paste meta-data. - content: - application/json: - schema: - type: object - properties: - id: - type: string - example: abc123 - created_at: - type: string - example: 2024-01-01T00:00:00.000000+00:00 - expires: - type: string - example: 2024-01-01T00:00:00.000000+00:00 - safety: - type: string - 400: - description: The paste data was invalid. - content: - application/json: - schema: - type: object - properties: - error: - type: string - example: The reason the paste was invalid. - 429: - description: You are requesting too fast. - content: - application/json: - schema: - type: object - properties: - error: - type: string - example: You are requesting too fast. - """ - content_type: str | None = request.headers.get("content-type", None) - body: dict[str, Any] | str - data: dict[str, Any] - - if content_type == "application/json": - try: - body = await request.json() - except json.JSONDecodeError: - return starlette_plus.JSONResponse({"error": "Invalid JSON provided."}, status_code=400) - else: - body = (await request.body()).decode(encoding="UTF-8") - - data = {"files": [{"content": body, "filename": None}]} if isinstance(body, str) else body - - if resp := validate_paste(data): - return resp - - expiry_str: str | None = data.get("expires", None) - - try: - expiry: datetime.datetime | None = datetime.datetime.fromisoformat(expiry_str) if expiry_str else None - except Exception as e: - return starlette_plus.JSONResponse({"error": f'Unable to parse "expiry" parameter: {e}'}, status_code=400) - - data["expires"] = expiry - data["password"] = data.get("password") - - try: - paste = await self.app.database.create_paste(data=data) - except asyncpg.CharacterNotInRepertoireError: - message: str = "File(s)/Filename(s) contain invalid characters or byte sequences." - return starlette_plus.JSONResponse({"error": message}, status_code=400) - - to_return: dict[str, Any] = paste.serialize(exclude=["password", "password_ok"]) - to_return.pop("files", None) - - return starlette_plus.JSONResponse(to_return, status_code=200) - - @starlette_plus.route("/security/info/{token}") - async def security_info(self, request: starlette_plus.Request) -> starlette_plus.Response: - token: str | None = request.path_params.get("token", None) - if not token: - return starlette_plus.JSONResponse({"error": "Unauthorized."}, status_code=401) - - paste = await self.app.database.fetch_paste_security(token=token) - if not paste: - return starlette_plus.JSONResponse( - {"error": "A paste was not found with the provided token, or has expired or been deleted."}, - status_code=404, - ) - - delete: str = f"{request.url.scheme}://{request.url.hostname}/api/security/delete/{token}" - info: str = f"{request.url.scheme}://{request.url.hostname}/api/security/info/{token}" - data: dict[str, str] = { - "token": paste.safety, - "delete": delete, - "info": info, - "extra": "Visiting the delete URL will remove the paste instantly.", - } - - return starlette_plus.JSONResponse(data, status_code=200) - - @starlette_plus.route("/security/delete/{token}", methods=["GET"]) - async def security_delete(self, request: starlette_plus.Request) -> starlette_plus.Response: - """Delete a paste. - - --- - summary: Delete a paste. - description: - Deletes a paste with the associated safety token.\n\n - - This action is not reversible. - - parameters: - - in: path - name: token - schema: - type: string - required: true - description: The safety token received when creating the paste. - - - responses: - 200: - description: The paste was successfully deleted. - content: - text/plain: - schema: - type: string - - 401: - description: You are not authorized to delete this paste. - content: - application/json: - schema: - type: object - properties: - error: - type: string - example: Unauthorized. - """ - token: str | None = request.path_params.get("token", None) - if not token: - return starlette_plus.JSONResponse({"error": "Unauthorized."}, status_code=401) - - await self.app.database.delete_paste_security(token=token) - return starlette_plus.Response("Ok", status_code=200) diff --git a/views/docs.py b/views/docs.py deleted file mode 100644 index af72aed..0000000 --- a/views/docs.py +++ /dev/null @@ -1,48 +0,0 @@ -"""MystBin. Share code easily. - -Copyright (C) 2020-Current PythonistaGuild - -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation, either version 3 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program. If not, see . -""" - -from __future__ import annotations - -from typing import TYPE_CHECKING - -import starlette_plus - - -if TYPE_CHECKING: - from core import Application - - -class DocsView(starlette_plus.View, prefix="api"): - def __init__(self, app: Application) -> None: - self.app: Application = app - - @starlette_plus.route("/documentation") - async def documentation(self, request: starlette_plus.Request) -> starlette_plus.Response: - headers = {"Access-Control-Allow-Origin": "*"} - return starlette_plus.FileResponse("web/docs.html", headers=headers) - - @starlette_plus.route("/docs") - async def documentation_redirect(self, request: starlette_plus.Request) -> starlette_plus.Response: - return starlette_plus.RedirectResponse("/api/documentation") - - @starlette_plus.route("/schema") - async def openapi_schema(self, request: starlette_plus.Request) -> starlette_plus.Response: - if not self.app.schemas: - return starlette_plus.Response(status_code=503) - - return self.app.schemas.OpenAPIResponse(request=request) diff --git a/views/htmx.py b/views/htmx.py deleted file mode 100644 index 7094ad9..0000000 --- a/views/htmx.py +++ /dev/null @@ -1,360 +0,0 @@ -"""MystBin. Share code easily. - -Copyright (C) 2020-Current PythonistaGuild - -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation, either version 3 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program. If not, see . -""" - -from __future__ import annotations - -import asyncio -import datetime -import json -from typing import TYPE_CHECKING, Any, cast -from urllib.parse import unquote, urlsplit - -import asyncpg -import bleach -import starlette_plus - -from core import CONFIG -from core.utils import natural_time, validate_paste - - -if TYPE_CHECKING: - from starlette.datastructures import FormData - - from core import Application - - -with open("web/paste.html") as fp: - PASTE_HTML: str = fp.read() - - -class HTMXView(starlette_plus.View, prefix="htmx"): - def __init__(self, app: Application) -> None: - self.app: Application = app - - def highlight_code(self, *, files: list[dict[str, Any]]) -> str: - html: str = "" - - for index, file in enumerate(files): - filename = bleach.clean(file["filename"], attributes=[], tags=[]) - filename = "_".join(filename.splitlines()) - - raw_url: str = f'/raw/{file["parent_id"]}' - annotation: str = file["annotation"] or "" - positions: list[int] = file.get("warning_positions", []) - original: str = file["content"] - - parts: list[str] = annotation.split(":") - annotation = parts.pop(0) - - extra: str = ( - f"""{parts[0]}""" - if parts - else "" - ) - annotations: str = ( - f'❌ {annotation}{": " + extra if extra else ""}' - if annotation - else "" - ) - - position: int = 0 - next_pos: int | None = positions.pop(0) if positions else None - - numbers: list[str] = [] - for n, line in enumerate(original.splitlines(), 1): - length: int = len(line) - - if next_pos is not None and position <= next_pos <= position + length: - numbers.append( - f"""{n}""" - ) - - try: - next_pos = positions.pop(0) - except IndexError: - next_pos = None - - else: - numbers.append( - f"""{n}""" - ) - - position += length + 1 - - content = bleach.clean( - original.replace("\n{"".join(numbers)}\n""" - html += f""" -
-
-
- {filename} - Hide - Copy - Raw -
-
- {annotations} -
{lines}{content}
-
""" - - return html - - def check_discord(self, request: starlette_plus.Request) -> starlette_plus.Response | None: - agent: str = request.headers.get("user-agent", "") - if "discordbot" in agent.lower(): - return starlette_plus.Response(status_code=204) - - @starlette_plus.route("/", prefix=False) - async def home(self, request: starlette_plus.Request) -> starlette_plus.Response: - if resp := self.check_discord(request=request): - return resp - - return starlette_plus.FileResponse("web/index.html") - - @starlette_plus.route("/protected/{id}", prefix=False) - @starlette_plus.limit(**CONFIG["LIMITS"]["paste_get"]) - @starlette_plus.limit(**CONFIG["LIMITS"]["paste_get_day"]) - async def protected_paste(self, request: starlette_plus.Request) -> starlette_plus.Response: - return starlette_plus.FileResponse("web/password.html") - - @starlette_plus.route("/{id}", prefix=False) - @starlette_plus.limit(**CONFIG["LIMITS"]["paste_get"]) - @starlette_plus.limit(**CONFIG["LIMITS"]["paste_get_day"]) - async def paste(self, request: starlette_plus.Request) -> starlette_plus.Response: - if resp := self.check_discord(request=request): - return resp - - identifier: str = request.path_params.get("id", "pass") - htmx_url: str | None = request.headers.get("HX-Current-URL", None) - - if htmx_url and identifier == "pass": - identifier = urlsplit(htmx_url).path.removeprefix("/protected/") - - not_found: str = """ -
-

404 - This page or paste could not be found

- Return Home... -
- """ - - password: str = unquote(request.query_params.get("pastePassword", "")) - paste = await self.app.database.fetch_paste(identifier, password=password) - - if not paste: - return starlette_plus.HTMLResponse(PASTE_HTML.format(__PASTES__=not_found)) - - if paste.has_password and not paste.password_ok: - if not password: - return starlette_plus.RedirectResponse(f"/protected/{identifier}") - - error_headers: dict[str, str] = {"HX-Retarget": "#errorResponse", "HX-Reswap": "outerHTML"} - return starlette_plus.HTMLResponse( - """Incorrect Password.""", - headers=error_headers, - ) - - data: dict[str, Any] = paste.serialize(exclude=["password", "password_ok"]) - files: list[dict[str, Any]] = data["files"] - created_delta: datetime.timedelta = datetime.datetime.now(tz=datetime.timezone.utc) - paste.created_at.replace( - tzinfo=datetime.timezone.utc - ) - - url: str = f"/{identifier}" - raw_url: str = f"/raw/{identifier}" - security_html: str = "" - - stored: list[str] = request.session.get("pastes", []) - if identifier in stored: - security_url: str = f"/api/security/info/{data['safety']}" - - security_html = f""" - """ - - html: str = f""" -
-
- /{identifier} - Created {natural_time(created_delta)}... -
- {security_html} -
- Raw - -
-
- """ - - html += await asyncio.to_thread(self.highlight_code, files=files) - if htmx_url and password: - return starlette_plus.HTMLResponse(html, headers={"HX-Replace-Url": f"{url}?pastePassword={password}"}) - - return starlette_plus.HTMLResponse(PASTE_HTML.format(__PASTES__=html), media_type="text/html") - - @starlette_plus.route("/raw/{id}", prefix=False) - @starlette_plus.limit(**CONFIG["LIMITS"]["paste_get"]) - @starlette_plus.limit(**CONFIG["LIMITS"]["paste_get_day"]) - async def paste_raw(self, request: starlette_plus.Request) -> starlette_plus.Response: - if resp := self.check_discord(request=request): - return resp - - password: str | None = request.headers.get("authorization", None) - identifier: str = request.path_params["id"] - - htmx_url: str | None = request.headers.get("HX-Current-URL", None) - if identifier == "0" and htmx_url: - identifier = htmx_url.removeprefix(f"{request.url.scheme}://{request.url.hostname}/") - - headers: dict[str, str] = {"HX-Redirect": f"/raw/{identifier}"} - paste = await self.app.database.fetch_paste(identifier, password=password) - - if not paste: - return starlette_plus.JSONResponse( - {"error": f'A paste with the id "{identifier}" could not be found or has expired.'}, - status_code=404, - headers=headers, - ) - - if paste.has_password and not paste.password_ok: - return starlette_plus.JSONResponse( - {"error": "Unauthorized. Raw pastes can not be viewed when protected by passwords."}, - status_code=401, - headers=headers, - ) - - to_return: dict[str, Any] = paste.serialize(exclude=["safety", "password", "password_ok"]) - text: str = "\n\n\n\n".join([f"# MystBin ! - {f['filename']}\n{f['content']}" for f in to_return["files"]]) - - return starlette_plus.PlainTextResponse(text, headers=headers) - - @starlette_plus.route("/raw/{id}/{page:int}", prefix=False) - @starlette_plus.limit(**CONFIG["LIMITS"]["paste_get"]) - @starlette_plus.limit(**CONFIG["LIMITS"]["paste_get_day"]) - async def paste_raw_page(self, request: starlette_plus.Request) -> starlette_plus.Response: - if resp := self.check_discord(request=request): - return resp - - password: str | None = request.headers.get("authorization", None) - identifier: str = request.path_params["id"] - page: int = max(request.path_params["page"], 1) - - paste = await self.app.database.fetch_paste(identifier, password=password) - if not paste: - return starlette_plus.JSONResponse( - {"error": f'A paste with the id "{identifier}" could not be found or has expired.'}, - status_code=404, - ) - - if paste.has_password and not paste.password_ok: - return starlette_plus.JSONResponse( - {"error": "Unauthorized. Raw pastes can not be viewed when protected by passwords."}, - status_code=401, - ) - - to_return: dict[str, Any] = paste.serialize(exclude=["safety", "password", "password_ok"]) - - try: - text: str = to_return["files"][page - 1]["content"] - except IndexError: - return starlette_plus.JSONResponse({"error": f"This file does not exist on paste: '{identifier}'"}) - - return starlette_plus.PlainTextResponse(text) - - @starlette_plus.route("/save", methods=["POST"]) - @starlette_plus.limit(**CONFIG["LIMITS"]["paste_post"]) - @starlette_plus.limit(**CONFIG["LIMITS"]["paste_post_day"]) - async def htmx_save(self, request: starlette_plus.Request) -> starlette_plus.Response: - if resp := self.check_discord(request=request): - return resp - - form: FormData = await request.form() - multi = form.multi_items() - - password: str = cast(str, multi.pop()[1]) - names: list[str] = cast(list[str], [i[1] for i in multi if i[0] == "fileName"]) - contents: list[str] = cast(list[str], [i[1] for i in multi if i[0] == "fileContent"]) - - error_headers: dict[str, str] = {"HX-Retarget": "#errorResponse"} - - if len(names) != len(contents): - return starlette_plus.HTMLResponse( - """400: Invalidated paste data.""", - headers=error_headers, - ) - - data: dict[str, Any] = {"files": []} - for n in range(len(names)): - if not contents[n]: - continue - - inner: dict[str, str | None] = {} - - try: - inner["filename"] = names[n].encode("UTF-8").decode("UTF-8") or None - inner["content"] = contents[n].encode("UTF-8").decode("UTF-8") - except Exception: - return starlette_plus.HTMLResponse( - """400: File/Filename contains invalid characters.""", - headers=error_headers, - ) - data["files"].append(inner) - - if not data["files"]: - return starlette_plus.HTMLResponse( - """400: Missing files or data to paste.""", - headers=error_headers, - ) - - if resp := validate_paste(data): - json_: dict[str, Any] = json.loads(resp.body) # type: ignore Can only be memoryview when specifically used. - return starlette_plus.HTMLResponse( - f"""{resp.status_code}: {json_["error"]}""", - headers=error_headers, - ) - - data["expires"] = None # TODO: Add this to Frontend... - data["password"] = password or None - - try: - paste = await self.app.database.create_paste(data=data) - except asyncpg.CharacterNotInRepertoireError: - return starlette_plus.HTMLResponse( - """400: File/Filename contains invalid characters.""", - headers=error_headers, - ) - - to_return: dict[str, Any] = paste.serialize(exclude=["password", "password_ok"]) - identifier: str = to_return["id"] - - url: str = f"/{identifier}" - - try: - (request.session["pastes"].append(identifier)) - except (KeyError, AttributeError): - request.session["pastes"] = [identifier] - else: - request.session["pastes"] = request.session["pastes"][-5:] - - return starlette_plus.HTMLResponse("", headers={"HX-Redirect": url}) diff --git a/web/docs.html b/web/docs.html deleted file mode 100644 index b0505f4..0000000 --- a/web/docs.html +++ /dev/null @@ -1,25 +0,0 @@ - - - - Mystbin - Documentation - - - - - - - - - - \ No newline at end of file diff --git a/web/index.html b/web/index.html deleted file mode 100644 index 225da4b..0000000 --- a/web/index.html +++ /dev/null @@ -1,118 +0,0 @@ - - - - - - MystBin - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - MystBin - -
- - - - -
-
- -
-
-
-
- - Delete File -
- -
- -
-
- - Delete File -
- -
-
- -
-
-
- Save Paste - -
- -
-
- - - - - \ No newline at end of file diff --git a/web/maint.html b/web/maint.html deleted file mode 100644 index 8620399..0000000 --- a/web/maint.html +++ /dev/null @@ -1,74 +0,0 @@ - - - - - - MystBin - Maintenance - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - MystBin - -
- - - - -
-
- -
-

We are currently undergoing maintenance, be back soon!

-
- - - - - \ No newline at end of file diff --git a/web/password.html b/web/password.html deleted file mode 100644 index e7e187d..0000000 --- a/web/password.html +++ /dev/null @@ -1,100 +0,0 @@ - - - - - - MystBin - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - MystBin - -
- - - - -
-
- -
-
-
-

Password Protected!

- This paste has been password protected. Please enter the password below to continue. - - - Submit -
-
-
- - - -
- - - \ No newline at end of file diff --git a/web/paste.html b/web/paste.html deleted file mode 100644 index 166d828..0000000 --- a/web/paste.html +++ /dev/null @@ -1,88 +0,0 @@ - - - - - - MystBin - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - MystBin - -
- - - - -
-
- -
-
{__PASTES__}
-
- - - -
- - - \ No newline at end of file diff --git a/web/static/images/favicon.ico b/web/static/images/favicon.ico deleted file mode 100644 index d26d25148ec53c719f2db3166a2edf9c956c21d2..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 15406 zcmeI3=~5I)5P*AQ_W|4=-hzYNa)=^`igGGmA*hI=ASlYEf`Z)lt+>9zKF+>YZGOe% zL`~bn%-{ejLqtdSRAp6WWo2dMh3Ea@{plS#VJrqaz9~FBCF!Q&T46 z$dRb_SbUlM^vM+G=0;$%Pn|NeG9Gx^Ypz_e-{mDGrs~24`+eo&MRTs8zYb7RAFK7DF= z0G#+n)fE%~xHP4)E=J~C!}WW*GlITOJT zOj7$dHfD`m9RXHjEy9lzo`P$?wQh@J__Q!5YpDc0Yw$eT3H zzsKG1Gwx&7i4&%+rNw-B_s+cQ?@##diM5vAmoM#H=-Qmj%((h#u(#KI+uSsB)6*%@ zXYGQQdyzTO&)eOl+0dEMO|6K1FQpFVnI=e}N56?5*Kj10paJuY^Liw9d{d11jcT)!UG zJ}LL*()_%^PEz=?!a@s+Eud|@u`S>&{cgMe8yjFnYywwKUWtvt*gH3FM2&?e+Rr*R z6Sfs?oF8}YDWUc2=g$UNaNGUgVgT@slZ=$_N(EWSCIUn zSK&YMsjxxs?c{GwqF; z=mzj{juiLotby@wDYd6tc+SGx+32B!`=snpZ}cu-dC@z?BefC%UU?!kM7^M z=d|J4H3NUy-+|Y!O>NlEa@R*Yw3UW^Ew@jed$sZUlcd*{l0(j zQQ150{#4(;pFVuB>sPgr6P`2IV=S(=}3eTA=K-xxn* zMdDKN;!HnE|JcWm)~5jbDbn!>6tne>#~tb^?1%;w1N)nhbFX z*1$6*aWCR3iOxq%M`IGiE!e|E$EFG{OJXr2Lqm}@Y!~14<0NjOYbU4b@87H6?1jnz zerlq4?@C+-`Wag*IoU+Vr5cX7xyGc(b0j)H=U(Y&FA^P>YPj;^;t2idzC`EOST}3X zdH{DUF`Pz;*%Ln_c2C^U?dO|#7IY6krM zv3}=DK8lz#^lNQ{3rjwT_#!c5V#h^JZH2-?J8?~5$iKUBdtkC9r$OwGe)O9^whTTL!H8_1?-jg%Y8YCBXulUcI=4`MA@+atW>@t@Y_nSM8TpT)! z91giz?r|4}@4ccQ9eYb^naHKG2J{(ma6diz+oc~^Y}uf5@6x|2=es0;C#lds$b7xn z@AIMqp&y;T9sSUS{JfFc1mKY$?kQcLzFqp!ZOEqf=^GnlGps**y1KsO180o-Kk&rT zpBGC@ZJio0BXSPo$&cbjH&frnxS-sEOFuB|v5w^p->CJ_yOTMnS#x2qY4whYMSqv% z#F(G+OAgB&AMZO+{mJ|jVxO}n?pSCi=cv4;pFP5+BF{lTaJ5qJp!Xa4F)073`afCy z$=bADCEoo7eLUpWu@h`vpX6m!cC=s59(60|Mb*#rqoadzI7&bHS=Jqo=h}~+RsScR z{lFPf8y8wsW|VI7t6FEHZSI?~L3vS^hwNW6{uj0tYX%SdpzG2%`SekdX?Tc?a#mR{ zwh-$rcQdDeiRf^H9zv)ydNC)L_K=pYW53_gGS3jZ0O zFrE#Y42~dJ{Au*g4D~NUHxG3y$>>k!#V2G9dPg$Pe#8%{?MGJytu - - - - \ No newline at end of file diff --git a/web/static/images/keyboard.svg b/web/static/images/keyboard.svg deleted file mode 100644 index a58cc81..0000000 --- a/web/static/images/keyboard.svg +++ /dev/null @@ -1,6 +0,0 @@ - - - - - \ No newline at end of file diff --git a/web/static/images/logo.svg b/web/static/images/logo.svg deleted file mode 100644 index fc90865..0000000 --- a/web/static/images/logo.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/web/static/images/vsc.svg b/web/static/images/vsc.svg deleted file mode 100644 index 97306b1..0000000 --- a/web/static/images/vsc.svg +++ /dev/null @@ -1 +0,0 @@ - diff --git a/web/static/packages/highlight.min.js b/web/static/packages/highlight.min.js deleted file mode 100644 index 375adab..0000000 --- a/web/static/packages/highlight.min.js +++ /dev/null @@ -1,1964 +0,0 @@ -/*! - Highlight.js v11.10.0 (git: 366a8bd012) - (c) 2006-2024 Josh Goebel and other contributors - License: BSD-3-Clause - */ -var hljs=function(){"use strict";function e(t){ -return t instanceof Map?t.clear=t.delete=t.set=()=>{ -throw Error("map is read-only")}:t instanceof Set&&(t.add=t.clear=t.delete=()=>{ -throw Error("set is read-only") -}),Object.freeze(t),Object.getOwnPropertyNames(t).forEach((n=>{ -const i=t[n],s=typeof i;"object"!==s&&"function"!==s||Object.isFrozen(i)||e(i) -})),t}class t{constructor(e){ -void 0===e.data&&(e.data={}),this.data=e.data,this.isMatchIgnored=!1} -ignoreMatch(){this.isMatchIgnored=!0}}function n(e){ -return e.replace(/&/g,"&").replace(//g,">").replace(/"/g,""").replace(/'/g,"'") -}function i(e,...t){const n=Object.create(null);for(const t in e)n[t]=e[t] -;return t.forEach((e=>{for(const t in e)n[t]=e[t]})),n}const s=e=>!!e.scope -;class o{constructor(e,t){ -this.buffer="",this.classPrefix=t.classPrefix,e.walk(this)}addText(e){ -this.buffer+=n(e)}openNode(e){if(!s(e))return;const t=((e,{prefix:t})=>{ -if(e.startsWith("language:"))return e.replace("language:","language-") -;if(e.includes(".")){const n=e.split(".") -;return[`${t}${n.shift()}`,...n.map(((e,t)=>`${e}${"_".repeat(t+1)}`))].join(" ") -}return`${t}${e}`})(e.scope,{prefix:this.classPrefix});this.span(t)} -closeNode(e){s(e)&&(this.buffer+="
")}value(){return this.buffer}span(e){ -this.buffer+=``}}const r=(e={})=>{const t={children:[]} -;return Object.assign(t,e),t};class a{constructor(){ -this.rootNode=r(),this.stack=[this.rootNode]}get top(){ -return this.stack[this.stack.length-1]}get root(){return this.rootNode}add(e){ -this.top.children.push(e)}openNode(e){const t=r({scope:e}) -;this.add(t),this.stack.push(t)}closeNode(){ -if(this.stack.length>1)return this.stack.pop()}closeAllNodes(){ -for(;this.closeNode(););}toJSON(){return JSON.stringify(this.rootNode,null,4)} -walk(e){return this.constructor._walk(e,this.rootNode)}static _walk(e,t){ -return"string"==typeof t?e.addText(t):t.children&&(e.openNode(t), -t.children.forEach((t=>this._walk(e,t))),e.closeNode(t)),e}static _collapse(e){ -"string"!=typeof e&&e.children&&(e.children.every((e=>"string"==typeof e))?e.children=[e.children.join("")]:e.children.forEach((e=>{ -a._collapse(e)})))}}class c extends a{constructor(e){super(),this.options=e} -addText(e){""!==e&&this.add(e)}startScope(e){this.openNode(e)}endScope(){ -this.closeNode()}__addSublanguage(e,t){const n=e.root -;t&&(n.scope="language:"+t),this.add(n)}toHTML(){ -return new o(this,this.options).value()}finalize(){ -return this.closeAllNodes(),!0}}function l(e){ -return e?"string"==typeof e?e:e.source:null}function g(e){return h("(?=",e,")")} -function u(e){return h("(?:",e,")*")}function d(e){return h("(?:",e,")?")} -function h(...e){return e.map((e=>l(e))).join("")}function f(...e){const t=(e=>{ -const t=e[e.length-1] -;return"object"==typeof t&&t.constructor===Object?(e.splice(e.length-1,1),t):{} -})(e);return"("+(t.capture?"":"?:")+e.map((e=>l(e))).join("|")+")"} -function p(e){return RegExp(e.toString()+"|").exec("").length-1} -const b=/\[(?:[^\\\]]|\\.)*\]|\(\??|\\([1-9][0-9]*)|\\./ -;function m(e,{joinWith:t}){let n=0;return e.map((e=>{n+=1;const t=n -;let i=l(e),s="";for(;i.length>0;){const e=b.exec(i);if(!e){s+=i;break} -s+=i.substring(0,e.index), -i=i.substring(e.index+e[0].length),"\\"===e[0][0]&&e[1]?s+="\\"+(Number(e[1])+t):(s+=e[0], -"("===e[0]&&n++)}return s})).map((e=>`(${e})`)).join(t)} -const E="[a-zA-Z]\\w*",x="[a-zA-Z_]\\w*",w="\\b\\d+(\\.\\d+)?",y="(-?)(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)",_="\\b(0b[01]+)",O={ -begin:"\\\\[\\s\\S]",relevance:0},v={scope:"string",begin:"'",end:"'", -illegal:"\\n",contains:[O]},k={scope:"string",begin:'"',end:'"',illegal:"\\n", -contains:[O]},N=(e,t,n={})=>{const s=i({scope:"comment",begin:e,end:t, -contains:[]},n);s.contains.push({scope:"doctag", -begin:"[ ]*(?=(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):)", -end:/(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):/,excludeBegin:!0,relevance:0}) -;const o=f("I","a","is","so","us","to","at","if","in","it","on",/[A-Za-z]+['](d|ve|re|ll|t|s|n)/,/[A-Za-z]+[-][a-z]+/,/[A-Za-z][a-z]{2,}/) -;return s.contains.push({begin:h(/[ ]+/,"(",o,/[.]?[:]?([.][ ]|[ ])/,"){3}")}),s -},S=N("//","$"),M=N("/\\*","\\*/"),R=N("#","$");var j=Object.freeze({ -__proto__:null,APOS_STRING_MODE:v,BACKSLASH_ESCAPE:O,BINARY_NUMBER_MODE:{ -scope:"number",begin:_,relevance:0},BINARY_NUMBER_RE:_,COMMENT:N, -C_BLOCK_COMMENT_MODE:M,C_LINE_COMMENT_MODE:S,C_NUMBER_MODE:{scope:"number", -begin:y,relevance:0},C_NUMBER_RE:y,END_SAME_AS_BEGIN:e=>Object.assign(e,{ -"on:begin":(e,t)=>{t.data._beginMatch=e[1]},"on:end":(e,t)=>{ -t.data._beginMatch!==e[1]&&t.ignoreMatch()}}),HASH_COMMENT_MODE:R,IDENT_RE:E, -MATCH_NOTHING_RE:/\b\B/,METHOD_GUARD:{begin:"\\.\\s*"+x,relevance:0}, -NUMBER_MODE:{scope:"number",begin:w,relevance:0},NUMBER_RE:w, -PHRASAL_WORDS_MODE:{ -begin:/\b(a|an|the|are|I'm|isn't|don't|doesn't|won't|but|just|should|pretty|simply|enough|gonna|going|wtf|so|such|will|you|your|they|like|more)\b/ -},QUOTE_STRING_MODE:k,REGEXP_MODE:{scope:"regexp",begin:/\/(?=[^/\n]*\/)/, -end:/\/[gimuy]*/,contains:[O,{begin:/\[/,end:/\]/,relevance:0,contains:[O]}]}, -RE_STARTERS_RE:"!|!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|-|-=|/=|/|:|;|<<|<<=|<=|<|===|==|=|>>>=|>>=|>=|>>>|>>|>|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~", -SHEBANG:(e={})=>{const t=/^#![ ]*\// -;return e.binary&&(e.begin=h(t,/.*\b/,e.binary,/\b.*/)),i({scope:"meta",begin:t, -end:/$/,relevance:0,"on:begin":(e,t)=>{0!==e.index&&t.ignoreMatch()}},e)}, -TITLE_MODE:{scope:"title",begin:E,relevance:0},UNDERSCORE_IDENT_RE:x, -UNDERSCORE_TITLE_MODE:{scope:"title",begin:x,relevance:0}});function A(e,t){ -"."===e.input[e.index-1]&&t.ignoreMatch()}function I(e,t){ -void 0!==e.className&&(e.scope=e.className,delete e.className)}function T(e,t){ -t&&e.beginKeywords&&(e.begin="\\b("+e.beginKeywords.split(" ").join("|")+")(?!\\.)(?=\\b|\\s)", -e.__beforeBegin=A,e.keywords=e.keywords||e.beginKeywords,delete e.beginKeywords, -void 0===e.relevance&&(e.relevance=0))}function L(e,t){ -Array.isArray(e.illegal)&&(e.illegal=f(...e.illegal))}function B(e,t){ -if(e.match){ -if(e.begin||e.end)throw Error("begin & end are not supported with match") -;e.begin=e.match,delete e.match}}function P(e,t){ -void 0===e.relevance&&(e.relevance=1)}const D=(e,t)=>{if(!e.beforeMatch)return -;if(e.starts)throw Error("beforeMatch cannot be used with starts") -;const n=Object.assign({},e);Object.keys(e).forEach((t=>{delete e[t] -})),e.keywords=n.keywords,e.begin=h(n.beforeMatch,g(n.begin)),e.starts={ -relevance:0,contains:[Object.assign(n,{endsParent:!0})] -},e.relevance=0,delete n.beforeMatch -},H=["of","and","for","in","not","or","if","then","parent","list","value"],C="keyword" -;function $(e,t,n=C){const i=Object.create(null) -;return"string"==typeof e?s(n,e.split(" ")):Array.isArray(e)?s(n,e):Object.keys(e).forEach((n=>{ -Object.assign(i,$(e[n],t,n))})),i;function s(e,n){ -t&&(n=n.map((e=>e.toLowerCase()))),n.forEach((t=>{const n=t.split("|") -;i[n[0]]=[e,U(n[0],n[1])]}))}}function U(e,t){ -return t?Number(t):(e=>H.includes(e.toLowerCase()))(e)?0:1}const z={},W=e=>{ -console.error(e)},X=(e,...t)=>{console.log("WARN: "+e,...t)},G=(e,t)=>{ -z[`${e}/${t}`]||(console.log(`Deprecated as of ${e}. ${t}`),z[`${e}/${t}`]=!0) -},K=Error();function F(e,t,{key:n}){let i=0;const s=e[n],o={},r={} -;for(let e=1;e<=t.length;e++)r[e+i]=s[e],o[e+i]=!0,i+=p(t[e-1]) -;e[n]=r,e[n]._emit=o,e[n]._multi=!0}function Z(e){(e=>{ -e.scope&&"object"==typeof e.scope&&null!==e.scope&&(e.beginScope=e.scope, -delete e.scope)})(e),"string"==typeof e.beginScope&&(e.beginScope={ -_wrap:e.beginScope}),"string"==typeof e.endScope&&(e.endScope={_wrap:e.endScope -}),(e=>{if(Array.isArray(e.begin)){ -if(e.skip||e.excludeBegin||e.returnBegin)throw W("skip, excludeBegin, returnBegin not compatible with beginScope: {}"), -K -;if("object"!=typeof e.beginScope||null===e.beginScope)throw W("beginScope must be object"), -K;F(e,e.begin,{key:"beginScope"}),e.begin=m(e.begin,{joinWith:""})}})(e),(e=>{ -if(Array.isArray(e.end)){ -if(e.skip||e.excludeEnd||e.returnEnd)throw W("skip, excludeEnd, returnEnd not compatible with endScope: {}"), -K -;if("object"!=typeof e.endScope||null===e.endScope)throw W("endScope must be object"), -K;F(e,e.end,{key:"endScope"}),e.end=m(e.end,{joinWith:""})}})(e)}function V(e){ -function t(t,n){ -return RegExp(l(t),"m"+(e.case_insensitive?"i":"")+(e.unicodeRegex?"u":"")+(n?"g":"")) -}class n{constructor(){ -this.matchIndexes={},this.regexes=[],this.matchAt=1,this.position=0} -addRule(e,t){ -t.position=this.position++,this.matchIndexes[this.matchAt]=t,this.regexes.push([t,e]), -this.matchAt+=p(e)+1}compile(){0===this.regexes.length&&(this.exec=()=>null) -;const e=this.regexes.map((e=>e[1]));this.matcherRe=t(m(e,{joinWith:"|" -}),!0),this.lastIndex=0}exec(e){this.matcherRe.lastIndex=this.lastIndex -;const t=this.matcherRe.exec(e);if(!t)return null -;const n=t.findIndex(((e,t)=>t>0&&void 0!==e)),i=this.matchIndexes[n] -;return t.splice(0,n),Object.assign(t,i)}}class s{constructor(){ -this.rules=[],this.multiRegexes=[], -this.count=0,this.lastIndex=0,this.regexIndex=0}getMatcher(e){ -if(this.multiRegexes[e])return this.multiRegexes[e];const t=new n -;return this.rules.slice(e).forEach((([e,n])=>t.addRule(e,n))), -t.compile(),this.multiRegexes[e]=t,t}resumingScanAtSamePosition(){ -return 0!==this.regexIndex}considerAll(){this.regexIndex=0}addRule(e,t){ -this.rules.push([e,t]),"begin"===t.type&&this.count++}exec(e){ -const t=this.getMatcher(this.regexIndex);t.lastIndex=this.lastIndex -;let n=t.exec(e) -;if(this.resumingScanAtSamePosition())if(n&&n.index===this.lastIndex);else{ -const t=this.getMatcher(0);t.lastIndex=this.lastIndex+1,n=t.exec(e)} -return n&&(this.regexIndex+=n.position+1, -this.regexIndex===this.count&&this.considerAll()),n}} -if(e.compilerExtensions||(e.compilerExtensions=[]), -e.contains&&e.contains.includes("self"))throw Error("ERR: contains `self` is not supported at the top-level of a language. See documentation.") -;return e.classNameAliases=i(e.classNameAliases||{}),function n(o,r){const a=o -;if(o.isCompiled)return a -;[I,B,Z,D].forEach((e=>e(o,r))),e.compilerExtensions.forEach((e=>e(o,r))), -o.__beforeBegin=null,[T,L,P].forEach((e=>e(o,r))),o.isCompiled=!0;let c=null -;return"object"==typeof o.keywords&&o.keywords.$pattern&&(o.keywords=Object.assign({},o.keywords), -c=o.keywords.$pattern, -delete o.keywords.$pattern),c=c||/\w+/,o.keywords&&(o.keywords=$(o.keywords,e.case_insensitive)), -a.keywordPatternRe=t(c,!0), -r&&(o.begin||(o.begin=/\B|\b/),a.beginRe=t(a.begin),o.end||o.endsWithParent||(o.end=/\B|\b/), -o.end&&(a.endRe=t(a.end)), -a.terminatorEnd=l(a.end)||"",o.endsWithParent&&r.terminatorEnd&&(a.terminatorEnd+=(o.end?"|":"")+r.terminatorEnd)), -o.illegal&&(a.illegalRe=t(o.illegal)), -o.contains||(o.contains=[]),o.contains=[].concat(...o.contains.map((e=>(e=>(e.variants&&!e.cachedVariants&&(e.cachedVariants=e.variants.map((t=>i(e,{ -variants:null},t)))),e.cachedVariants?e.cachedVariants:q(e)?i(e,{ -starts:e.starts?i(e.starts):null -}):Object.isFrozen(e)?i(e):e))("self"===e?o:e)))),o.contains.forEach((e=>{n(e,a) -})),o.starts&&n(o.starts,r),a.matcher=(e=>{const t=new s -;return e.contains.forEach((e=>t.addRule(e.begin,{rule:e,type:"begin" -}))),e.terminatorEnd&&t.addRule(e.terminatorEnd,{type:"end" -}),e.illegal&&t.addRule(e.illegal,{type:"illegal"}),t})(a),a}(e)}function q(e){ -return!!e&&(e.endsWithParent||q(e.starts))}class J extends Error{ -constructor(e,t){super(e),this.name="HTMLInjectionError",this.html=t}} -const Y=n,Q=i,ee=Symbol("nomatch"),te=n=>{ -const i=Object.create(null),s=Object.create(null),o=[];let r=!0 -;const a="Could not find the language '{}', did you forget to load/include a language module?",l={ -disableAutodetect:!0,name:"Plain text",contains:[]};let p={ -ignoreUnescapedHTML:!1,throwUnescapedHTML:!1,noHighlightRe:/^(no-?highlight)$/i, -languageDetectRe:/\blang(?:uage)?-([\w-]+)\b/i,classPrefix:"hljs-", -cssSelector:"pre code",languages:null,__emitter:c};function b(e){ -return p.noHighlightRe.test(e)}function m(e,t,n){let i="",s="" -;"object"==typeof t?(i=e, -n=t.ignoreIllegals,s=t.language):(G("10.7.0","highlight(lang, code, ...args) has been deprecated."), -G("10.7.0","Please use highlight(code, options) instead.\nhttps://github.com/highlightjs/highlight.js/issues/2277"), -s=e,i=t),void 0===n&&(n=!0);const o={code:i,language:s};N("before:highlight",o) -;const r=o.result?o.result:E(o.language,o.code,n) -;return r.code=o.code,N("after:highlight",r),r}function E(e,n,s,o){ -const c=Object.create(null);function l(){if(!N.keywords)return void M.addText(R) -;let e=0;N.keywordPatternRe.lastIndex=0;let t=N.keywordPatternRe.exec(R),n="" -;for(;t;){n+=R.substring(e,t.index) -;const s=_.case_insensitive?t[0].toLowerCase():t[0],o=(i=s,N.keywords[i]);if(o){ -const[e,i]=o -;if(M.addText(n),n="",c[s]=(c[s]||0)+1,c[s]<=7&&(j+=i),e.startsWith("_"))n+=t[0];else{ -const n=_.classNameAliases[e]||e;u(t[0],n)}}else n+=t[0] -;e=N.keywordPatternRe.lastIndex,t=N.keywordPatternRe.exec(R)}var i -;n+=R.substring(e),M.addText(n)}function g(){null!=N.subLanguage?(()=>{ -if(""===R)return;let e=null;if("string"==typeof N.subLanguage){ -if(!i[N.subLanguage])return void M.addText(R) -;e=E(N.subLanguage,R,!0,S[N.subLanguage]),S[N.subLanguage]=e._top -}else e=x(R,N.subLanguage.length?N.subLanguage:null) -;N.relevance>0&&(j+=e.relevance),M.__addSublanguage(e._emitter,e.language) -})():l(),R=""}function u(e,t){ -""!==e&&(M.startScope(t),M.addText(e),M.endScope())}function d(e,t){let n=1 -;const i=t.length-1;for(;n<=i;){if(!e._emit[n]){n++;continue} -const i=_.classNameAliases[e[n]]||e[n],s=t[n];i?u(s,i):(R=s,l(),R=""),n++}} -function h(e,t){ -return e.scope&&"string"==typeof e.scope&&M.openNode(_.classNameAliases[e.scope]||e.scope), -e.beginScope&&(e.beginScope._wrap?(u(R,_.classNameAliases[e.beginScope._wrap]||e.beginScope._wrap), -R=""):e.beginScope._multi&&(d(e.beginScope,t),R="")),N=Object.create(e,{parent:{ -value:N}}),N}function f(e,n,i){let s=((e,t)=>{const n=e&&e.exec(t) -;return n&&0===n.index})(e.endRe,i);if(s){if(e["on:end"]){const i=new t(e) -;e["on:end"](n,i),i.isMatchIgnored&&(s=!1)}if(s){ -for(;e.endsParent&&e.parent;)e=e.parent;return e}} -if(e.endsWithParent)return f(e.parent,n,i)}function b(e){ -return 0===N.matcher.regexIndex?(R+=e[0],1):(T=!0,0)}function m(e){ -const t=e[0],i=n.substring(e.index),s=f(N,e,i);if(!s)return ee;const o=N -;N.endScope&&N.endScope._wrap?(g(), -u(t,N.endScope._wrap)):N.endScope&&N.endScope._multi?(g(), -d(N.endScope,e)):o.skip?R+=t:(o.returnEnd||o.excludeEnd||(R+=t), -g(),o.excludeEnd&&(R=t));do{ -N.scope&&M.closeNode(),N.skip||N.subLanguage||(j+=N.relevance),N=N.parent -}while(N!==s.parent);return s.starts&&h(s.starts,e),o.returnEnd?0:t.length} -let w={};function y(i,o){const a=o&&o[0];if(R+=i,null==a)return g(),0 -;if("begin"===w.type&&"end"===o.type&&w.index===o.index&&""===a){ -if(R+=n.slice(o.index,o.index+1),!r){const t=Error(`0 width match regex (${e})`) -;throw t.languageName=e,t.badRule=w.rule,t}return 1} -if(w=o,"begin"===o.type)return(e=>{ -const n=e[0],i=e.rule,s=new t(i),o=[i.__beforeBegin,i["on:begin"]] -;for(const t of o)if(t&&(t(e,s),s.isMatchIgnored))return b(n) -;return i.skip?R+=n:(i.excludeBegin&&(R+=n), -g(),i.returnBegin||i.excludeBegin||(R=n)),h(i,e),i.returnBegin?0:n.length})(o) -;if("illegal"===o.type&&!s){ -const e=Error('Illegal lexeme "'+a+'" for mode "'+(N.scope||"")+'"') -;throw e.mode=N,e}if("end"===o.type){const e=m(o);if(e!==ee)return e} -if("illegal"===o.type&&""===a)return 1 -;if(I>1e5&&I>3*o.index)throw Error("potential infinite loop, way more iterations than matches") -;return R+=a,a.length}const _=O(e) -;if(!_)throw W(a.replace("{}",e)),Error('Unknown language: "'+e+'"') -;const v=V(_);let k="",N=o||v;const S={},M=new p.__emitter(p);(()=>{const e=[] -;for(let t=N;t!==_;t=t.parent)t.scope&&e.unshift(t.scope) -;e.forEach((e=>M.openNode(e)))})();let R="",j=0,A=0,I=0,T=!1;try{ -if(_.__emitTokens)_.__emitTokens(n,M);else{for(N.matcher.considerAll();;){ -I++,T?T=!1:N.matcher.considerAll(),N.matcher.lastIndex=A -;const e=N.matcher.exec(n);if(!e)break;const t=y(n.substring(A,e.index),e) -;A=e.index+t}y(n.substring(A))}return M.finalize(),k=M.toHTML(),{language:e, -value:k,relevance:j,illegal:!1,_emitter:M,_top:N}}catch(t){ -if(t.message&&t.message.includes("Illegal"))return{language:e,value:Y(n), -illegal:!0,relevance:0,_illegalBy:{message:t.message,index:A, -context:n.slice(A-100,A+100),mode:t.mode,resultSoFar:k},_emitter:M};if(r)return{ -language:e,value:Y(n),illegal:!1,relevance:0,errorRaised:t,_emitter:M,_top:N} -;throw t}}function x(e,t){t=t||p.languages||Object.keys(i);const n=(e=>{ -const t={value:Y(e),illegal:!1,relevance:0,_top:l,_emitter:new p.__emitter(p)} -;return t._emitter.addText(e),t})(e),s=t.filter(O).filter(k).map((t=>E(t,e,!1))) -;s.unshift(n);const o=s.sort(((e,t)=>{ -if(e.relevance!==t.relevance)return t.relevance-e.relevance -;if(e.language&&t.language){if(O(e.language).supersetOf===t.language)return 1 -;if(O(t.language).supersetOf===e.language)return-1}return 0})),[r,a]=o,c=r -;return c.secondBest=a,c}function w(e){let t=null;const n=(e=>{ -let t=e.className+" ";t+=e.parentNode?e.parentNode.className:"" -;const n=p.languageDetectRe.exec(t);if(n){const t=O(n[1]) -;return t||(X(a.replace("{}",n[1])), -X("Falling back to no-highlight mode for this block.",e)),t?n[1]:"no-highlight"} -return t.split(/\s+/).find((e=>b(e)||O(e)))})(e);if(b(n))return -;if(N("before:highlightElement",{el:e,language:n -}),e.dataset.highlighted)return void console.log("Element previously highlighted. To highlight again, first unset `dataset.highlighted`.",e) -;if(e.children.length>0&&(p.ignoreUnescapedHTML||(console.warn("One of your code blocks includes unescaped HTML. This is a potentially serious security risk."), -console.warn("https://github.com/highlightjs/highlight.js/wiki/security"), -console.warn("The element with unescaped HTML:"), -console.warn(e)),p.throwUnescapedHTML))throw new J("One of your code blocks includes unescaped HTML.",e.innerHTML) -;t=e;const i=t.textContent,o=n?m(i,{language:n,ignoreIllegals:!0}):x(i) -;e.innerHTML=o.value,e.dataset.highlighted="yes",((e,t,n)=>{const i=t&&s[t]||n -;e.classList.add("hljs"),e.classList.add("language-"+i) -})(e,n,o.language),e.result={language:o.language,re:o.relevance, -relevance:o.relevance},o.secondBest&&(e.secondBest={ -language:o.secondBest.language,relevance:o.secondBest.relevance -}),N("after:highlightElement",{el:e,result:o,text:i})}let y=!1;function _(){ -"loading"!==document.readyState?document.querySelectorAll(p.cssSelector).forEach(w):y=!0 -}function O(e){return e=(e||"").toLowerCase(),i[e]||i[s[e]]} -function v(e,{languageName:t}){"string"==typeof e&&(e=[e]),e.forEach((e=>{ -s[e.toLowerCase()]=t}))}function k(e){const t=O(e) -;return t&&!t.disableAutodetect}function N(e,t){const n=e;o.forEach((e=>{ -e[n]&&e[n](t)}))} -"undefined"!=typeof window&&window.addEventListener&&window.addEventListener("DOMContentLoaded",(()=>{ -y&&_()}),!1),Object.assign(n,{highlight:m,highlightAuto:x,highlightAll:_, -highlightElement:w, -highlightBlock:e=>(G("10.7.0","highlightBlock will be removed entirely in v12.0"), -G("10.7.0","Please use highlightElement now."),w(e)),configure:e=>{p=Q(p,e)}, -initHighlighting:()=>{ -_(),G("10.6.0","initHighlighting() deprecated. Use highlightAll() now.")}, -initHighlightingOnLoad:()=>{ -_(),G("10.6.0","initHighlightingOnLoad() deprecated. Use highlightAll() now.") -},registerLanguage:(e,t)=>{let s=null;try{s=t(n)}catch(t){ -if(W("Language definition for '{}' could not be registered.".replace("{}",e)), -!r)throw t;W(t),s=l} -s.name||(s.name=e),i[e]=s,s.rawDefinition=t.bind(null,n),s.aliases&&v(s.aliases,{ -languageName:e})},unregisterLanguage:e=>{delete i[e] -;for(const t of Object.keys(s))s[t]===e&&delete s[t]}, -listLanguages:()=>Object.keys(i),getLanguage:O,registerAliases:v, -autoDetection:k,inherit:Q,addPlugin:e=>{(e=>{ -e["before:highlightBlock"]&&!e["before:highlightElement"]&&(e["before:highlightElement"]=t=>{ -e["before:highlightBlock"](Object.assign({block:t.el},t)) -}),e["after:highlightBlock"]&&!e["after:highlightElement"]&&(e["after:highlightElement"]=t=>{ -e["after:highlightBlock"](Object.assign({block:t.el},t))})})(e),o.push(e)}, -removePlugin:e=>{const t=o.indexOf(e);-1!==t&&o.splice(t,1)}}),n.debugMode=()=>{ -r=!1},n.safeMode=()=>{r=!0},n.versionString="11.10.0",n.regex={concat:h, -lookahead:g,either:f,optional:d,anyNumberOfTimes:u} -;for(const t in j)"object"==typeof j[t]&&e(j[t]);return Object.assign(n,j),n -},ne=te({});return ne.newInstance=()=>te({}),ne}() -;"object"==typeof exports&&"undefined"!=typeof module&&(module.exports=hljs);/*! `accesslog` grammar compiled for Highlight.js 11.10.0 */ -(()=>{var e=(()=>{"use strict";return e=>{ -const n=e.regex,a=["GET","POST","HEAD","PUT","DELETE","CONNECT","OPTIONS","PATCH","TRACE"] -;return{name:"Apache Access Log",contains:[{className:"number", -begin:/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}(:\d{1,5})?\b/,relevance:5},{ -className:"number",begin:/\b\d+\b/,relevance:0},{className:"string", -begin:n.concat(/"/,n.either(...a)),end:/"/,keywords:a,illegal:/\n/,relevance:5, -contains:[{begin:/HTTP\/[12]\.\d'/,relevance:5}]},{className:"string", -begin:/\[\d[^\]\n]{8,}\]/,illegal:/\n/,relevance:1},{className:"string", -begin:/\[/,end:/\]/,illegal:/\n/,relevance:0},{className:"string", -begin:/"Mozilla\/\d\.\d \(/,end:/"/,illegal:/\n/,relevance:3},{ -className:"string",begin:/"/,end:/"/,illegal:/\n/,relevance:0}]}}})() -;hljs.registerLanguage("accesslog",e)})();/*! `actionscript` grammar compiled for Highlight.js 11.10.0 */ -(()=>{var e=(()=>{"use strict";return e=>{ -const a=e.regex,t=/[a-zA-Z_$][a-zA-Z0-9_$]*/,n=a.concat(t,a.concat("(\\.",t,")*")),s={ -className:"rest_arg",begin:/[.]{3}/,end:t,relevance:10};return{ -name:"ActionScript",aliases:["as"],keywords:{ -keyword:["as","break","case","catch","class","const","continue","default","delete","do","dynamic","each","else","extends","final","finally","for","function","get","if","implements","import","in","include","instanceof","interface","internal","is","namespace","native","new","override","package","private","protected","public","return","set","static","super","switch","this","throw","try","typeof","use","var","void","while","with"], -literal:["true","false","null","undefined"]}, -contains:[e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,e.C_NUMBER_MODE,{ -match:[/\bpackage/,/\s+/,n],className:{1:"keyword",3:"title.class"}},{ -match:[/\b(?:class|interface|extends|implements)/,/\s+/,t],className:{ -1:"keyword",3:"title.class"}},{className:"meta",beginKeywords:"import include", -end:/;/,keywords:{keyword:"import include"}},{beginKeywords:"function", -end:/[{;]/,excludeEnd:!0,illegal:/\S/,contains:[e.inherit(e.TITLE_MODE,{ -className:"title.function"}),{className:"params",begin:/\(/,end:/\)/, -contains:[e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,s] -},{begin:a.concat(/:\s*/,/([*]|[a-zA-Z_$][a-zA-Z0-9_$]*)/)}]},e.METHOD_GUARD], -illegal:/#/}}})();hljs.registerLanguage("actionscript",e)})();/*! `ada` grammar compiled for Highlight.js 11.10.0 */ -(()=>{var e=(()=>{"use strict";return e=>{ -const n="\\d(_|\\d)*",s="[eE][-+]?"+n,a="\\b("+n+"#\\w+(\\.\\w+)?#("+s+")?|"+n+"(\\."+n+")?("+s+")?)",r="[A-Za-z](_?[A-Za-z0-9.])*",i="[]\\{\\}%#'\"",t=e.COMMENT("--","$"),c={ -begin:"\\s+:\\s+",end:"\\s*(:=|;|\\)|=>|$)",illegal:i,contains:[{ -beginKeywords:"loop for declare others",endsParent:!0},{className:"keyword", -beginKeywords:"not null constant access function procedure in out aliased exception" -},{className:"type",begin:r,endsParent:!0,relevance:0}]};return{name:"Ada", -case_insensitive:!0,keywords:{ -keyword:["abort","else","new","return","abs","elsif","not","reverse","abstract","end","accept","entry","select","access","exception","of","separate","aliased","exit","or","some","all","others","subtype","and","for","out","synchronized","array","function","overriding","at","tagged","generic","package","task","begin","goto","pragma","terminate","body","private","then","if","procedure","type","case","in","protected","constant","interface","is","raise","use","declare","range","delay","limited","record","when","delta","loop","rem","while","digits","renames","with","do","mod","requeue","xor"], -literal:["True","False"]},contains:[t,{className:"string",begin:/"/,end:/"/, -contains:[{begin:/""/,relevance:0}]},{className:"string",begin:/'.'/},{ -className:"number",begin:a,relevance:0},{className:"symbol",begin:"'"+r},{ -className:"title", -begin:"(\\bwith\\s+)?(\\bprivate\\s+)?\\bpackage\\s+(\\bbody\\s+)?", -end:"(is|$)",keywords:"package body",excludeBegin:!0,excludeEnd:!0,illegal:i},{ -begin:"(\\b(with|overriding)\\s+)?\\b(function|procedure)\\s+", -end:"(\\bis|\\bwith|\\brenames|\\)\\s*;)", -keywords:"overriding function procedure with is renames return",returnBegin:!0, -contains:[t,{className:"title", -begin:"(\\bwith\\s+)?\\b(function|procedure)\\s+",end:"(\\(|\\s+|$)", -excludeBegin:!0,excludeEnd:!0,illegal:i},c,{className:"type", -begin:"\\breturn\\s+",end:"(\\s+|;|$)",keywords:"return",excludeBegin:!0, -excludeEnd:!0,endsParent:!0,illegal:i}]},{className:"type", -begin:"\\b(sub)?type\\s+",end:"\\s+",keywords:"type",excludeBegin:!0,illegal:i -},c]}}})();hljs.registerLanguage("ada",e)})();/*! `autohotkey` grammar compiled for Highlight.js 11.10.0 */ -(()=>{var e=(()=>{"use strict";return e=>{const a={begin:"`[\\s\\S]"};return{ -name:"AutoHotkey",case_insensitive:!0,aliases:["ahk"],keywords:{ -keyword:"Break Continue Critical Exit ExitApp Gosub Goto New OnExit Pause return SetBatchLines SetTimer Suspend Thread Throw Until ahk_id ahk_class ahk_pid ahk_exe ahk_group", -literal:"true false NOT AND OR", -built_in:"ComSpec Clipboard ClipboardAll ErrorLevel"}, -contains:[a,e.inherit(e.QUOTE_STRING_MODE,{contains:[a]}),e.COMMENT(";","$",{ -relevance:0}),e.C_BLOCK_COMMENT_MODE,{className:"number",begin:e.NUMBER_RE, -relevance:0},{className:"variable",begin:"%[a-zA-Z0-9#_$@]+%"},{ -className:"built_in",begin:"^\\s*\\w+\\s*(,|%)"},{className:"title",variants:[{ -begin:'^[^\\n";]+::(?!=)'},{begin:'^[^\\n";]+:(?!=)',relevance:0}]},{ -className:"meta",begin:"^\\s*#\\w+",end:"$",relevance:0},{className:"built_in", -begin:"A_[a-zA-Z0-9]+"},{begin:",\\s*,"}]}}})() -;hljs.registerLanguage("autohotkey",e)})();/*! `bash` grammar compiled for Highlight.js 11.10.0 */ -(()=>{var e=(()=>{"use strict";return e=>{const s=e.regex,t={},n={begin:/\$\{/, -end:/\}/,contains:["self",{begin:/:-/,contains:[t]}]};Object.assign(t,{ -className:"variable",variants:[{ -begin:s.concat(/\$[\w\d#@][\w\d_]*/,"(?![\\w\\d])(?![$])")},n]});const a={ -className:"subst",begin:/\$\(/,end:/\)/,contains:[e.BACKSLASH_ESCAPE] -},i=e.inherit(e.COMMENT(),{match:[/(^|\s)/,/#.*$/],scope:{2:"comment"}}),c={ -begin:/<<-?\s*(?=\w+)/,starts:{contains:[e.END_SAME_AS_BEGIN({begin:/(\w+)/, -end:/(\w+)/,className:"string"})]}},o={className:"string",begin:/"/,end:/"/, -contains:[e.BACKSLASH_ESCAPE,t,a]};a.contains.push(o);const r={begin:/\$?\(\(/, -end:/\)\)/,contains:[{begin:/\d+#[0-9a-f]+/,className:"number"},e.NUMBER_MODE,t] -},l=e.SHEBANG({binary:"(fish|bash|zsh|sh|csh|ksh|tcsh|dash|scsh)",relevance:10 -}),m={className:"function",begin:/\w[\w\d_]*\s*\(\s*\)\s*\{/,returnBegin:!0, -contains:[e.inherit(e.TITLE_MODE,{begin:/\w[\w\d_]*/})],relevance:0};return{ -name:"Bash",aliases:["sh","zsh"],keywords:{$pattern:/\b[a-z][a-z0-9._-]+\b/, -keyword:["if","then","else","elif","fi","for","while","until","in","do","done","case","esac","function","select"], -literal:["true","false"], -built_in:["break","cd","continue","eval","exec","exit","export","getopts","hash","pwd","readonly","return","shift","test","times","trap","umask","unset","alias","bind","builtin","caller","command","declare","echo","enable","help","let","local","logout","mapfile","printf","read","readarray","source","sudo","type","typeset","ulimit","unalias","set","shopt","autoload","bg","bindkey","bye","cap","chdir","clone","comparguments","compcall","compctl","compdescribe","compfiles","compgroups","compquote","comptags","comptry","compvalues","dirs","disable","disown","echotc","echoti","emulate","fc","fg","float","functions","getcap","getln","history","integer","jobs","kill","limit","log","noglob","popd","print","pushd","pushln","rehash","sched","setcap","setopt","stat","suspend","ttyctl","unfunction","unhash","unlimit","unsetopt","vared","wait","whence","where","which","zcompile","zformat","zftp","zle","zmodload","zparseopts","zprof","zpty","zregexparse","zsocket","zstyle","ztcp","chcon","chgrp","chown","chmod","cp","dd","df","dir","dircolors","ln","ls","mkdir","mkfifo","mknod","mktemp","mv","realpath","rm","rmdir","shred","sync","touch","truncate","vdir","b2sum","base32","base64","cat","cksum","comm","csplit","cut","expand","fmt","fold","head","join","md5sum","nl","numfmt","od","paste","ptx","pr","sha1sum","sha224sum","sha256sum","sha384sum","sha512sum","shuf","sort","split","sum","tac","tail","tr","tsort","unexpand","uniq","wc","arch","basename","chroot","date","dirname","du","echo","env","expr","factor","groups","hostid","id","link","logname","nice","nohup","nproc","pathchk","pinky","printenv","printf","pwd","readlink","runcon","seq","sleep","stat","stdbuf","stty","tee","test","timeout","tty","uname","unlink","uptime","users","who","whoami","yes"] -},contains:[l,e.SHEBANG(),m,r,i,c,{match:/(\/[a-z._-]+)+/},o,{match:/\\"/},{ -className:"string",begin:/'/,end:/'/},{match:/\\'/},t]}}})() -;hljs.registerLanguage("bash",e)})();/*! `c` grammar compiled for Highlight.js 11.10.0 */ -(()=>{var e=(()=>{"use strict";return e=>{const n=e.regex,t=e.COMMENT("//","$",{ -contains:[{begin:/\\\n/}] -}),a="decltype\\(auto\\)",s="[a-zA-Z_]\\w*::",i="("+a+"|"+n.optional(s)+"[a-zA-Z_]\\w*"+n.optional("<[^<>]+>")+")",r={ -className:"type",variants:[{begin:"\\b[a-z\\d_]*_t\\b"},{ -match:/\batomic_[a-z]{3,6}\b/}]},l={className:"string",variants:[{ -begin:'(u8?|U|L)?"',end:'"',illegal:"\\n",contains:[e.BACKSLASH_ESCAPE]},{ -begin:"(u8?|U|L)?'(\\\\(x[0-9A-Fa-f]{2}|u[0-9A-Fa-f]{4,8}|[0-7]{3}|\\S)|.)", -end:"'",illegal:"."},e.END_SAME_AS_BEGIN({ -begin:/(?:u8?|U|L)?R"([^()\\ ]{0,16})\(/,end:/\)([^()\\ ]{0,16})"/})]},o={ -className:"number",variants:[{begin:"\\b(0b[01']+)"},{ -begin:"(-?)\\b([\\d']+(\\.[\\d']*)?|\\.[\\d']+)((ll|LL|l|L)(u|U)?|(u|U)(ll|LL|l|L)?|f|F|b|B)" -},{ -begin:"(-?)(\\b0[xX][a-fA-F0-9']+|(\\b[\\d']+(\\.[\\d']*)?|\\.[\\d']+)([eE][-+]?[\\d']+)?)" -}],relevance:0},c={className:"meta",begin:/#\s*[a-z]+\b/,end:/$/,keywords:{ -keyword:"if else elif endif define undef warning error line pragma _Pragma ifdef ifndef elifdef elifndef include" -},contains:[{begin:/\\\n/,relevance:0},e.inherit(l,{className:"string"}),{ -className:"string",begin:/<.*?>/},t,e.C_BLOCK_COMMENT_MODE]},d={ -className:"title",begin:n.optional(s)+e.IDENT_RE,relevance:0 -},_=n.optional(s)+e.IDENT_RE+"\\s*\\(",u={ -keyword:["asm","auto","break","case","continue","default","do","else","enum","extern","for","fortran","goto","if","inline","register","restrict","return","sizeof","typeof","typeof_unqual","struct","switch","typedef","union","volatile","while","_Alignas","_Alignof","_Atomic","_Generic","_Noreturn","_Static_assert","_Thread_local","alignas","alignof","noreturn","static_assert","thread_local","_Pragma"], -type:["float","double","signed","unsigned","int","short","long","char","void","_Bool","_BitInt","_Complex","_Imaginary","_Decimal32","_Decimal64","_Decimal96","_Decimal128","_Decimal64x","_Decimal128x","_Float16","_Float32","_Float64","_Float128","_Float32x","_Float64x","_Float128x","const","static","constexpr","complex","bool","imaginary"], -literal:"true false NULL", -built_in:"std string wstring cin cout cerr clog stdin stdout stderr stringstream istringstream ostringstream auto_ptr deque list queue stack vector map set pair bitset multiset multimap unordered_set unordered_map unordered_multiset unordered_multimap priority_queue make_pair array shared_ptr abort terminate abs acos asin atan2 atan calloc ceil cosh cos exit exp fabs floor fmod fprintf fputs free frexp fscanf future isalnum isalpha iscntrl isdigit isgraph islower isprint ispunct isspace isupper isxdigit tolower toupper labs ldexp log10 log malloc realloc memchr memcmp memcpy memset modf pow printf putchar puts scanf sinh sin snprintf sprintf sqrt sscanf strcat strchr strcmp strcpy strcspn strlen strncat strncmp strncpy strpbrk strrchr strspn strstr tanh tan vfprintf vprintf vsprintf endl initializer_list unique_ptr" -},g=[c,r,t,e.C_BLOCK_COMMENT_MODE,o,l],m={variants:[{begin:/=/,end:/;/},{ -begin:/\(/,end:/\)/},{beginKeywords:"new throw return else",end:/;/}], -keywords:u,contains:g.concat([{begin:/\(/,end:/\)/,keywords:u, -contains:g.concat(["self"]),relevance:0}]),relevance:0},p={ -begin:"("+i+"[\\*&\\s]+)+"+_,returnBegin:!0,end:/[{;=]/,excludeEnd:!0, -keywords:u,illegal:/[^\w\s\*&:<>.]/,contains:[{begin:a,keywords:u,relevance:0},{ -begin:_,returnBegin:!0,contains:[e.inherit(d,{className:"title.function"})], -relevance:0},{relevance:0,match:/,/},{className:"params",begin:/\(/,end:/\)/, -keywords:u,relevance:0,contains:[t,e.C_BLOCK_COMMENT_MODE,l,o,r,{begin:/\(/, -end:/\)/,keywords:u,relevance:0,contains:["self",t,e.C_BLOCK_COMMENT_MODE,l,o,r] -}]},r,t,e.C_BLOCK_COMMENT_MODE,c]};return{name:"C",aliases:["h"],keywords:u, -disableAutodetect:!0,illegal:"=]/,contains:[{ -beginKeywords:"final class struct"},e.TITLE_MODE]}]),exports:{preprocessor:c, -strings:l,keywords:u}}}})();hljs.registerLanguage("c",e)})();/*! `clojure` grammar compiled for Highlight.js 11.10.0 */ -(()=>{var e=(()=>{"use strict";return e=>{ -const t="a-zA-Z_\\-!.?+*=<>&'",n="[#]?["+t+"]["+t+"0-9/;:$#]*",a="def defonce defprotocol defstruct defmulti defmethod defn- defn defmacro deftype defrecord",r={ -$pattern:n, -built_in:a+" cond apply if-not if-let if not not= =|0 <|0 >|0 <=|0 >=|0 ==|0 +|0 /|0 *|0 -|0 rem quot neg? pos? delay? symbol? keyword? true? false? integer? empty? coll? list? set? ifn? fn? associative? sequential? sorted? counted? reversible? number? decimal? class? distinct? isa? float? rational? reduced? ratio? odd? even? char? seq? vector? string? map? nil? contains? zero? instance? not-every? not-any? libspec? -> ->> .. . inc compare do dotimes mapcat take remove take-while drop letfn drop-last take-last drop-while while intern condp case reduced cycle split-at split-with repeat replicate iterate range merge zipmap declare line-seq sort comparator sort-by dorun doall nthnext nthrest partition eval doseq await await-for let agent atom send send-off release-pending-sends add-watch mapv filterv remove-watch agent-error restart-agent set-error-handler error-handler set-error-mode! error-mode shutdown-agents quote var fn loop recur throw try monitor-enter monitor-exit macroexpand macroexpand-1 for dosync and or when when-not when-let comp juxt partial sequence memoize constantly complement identity assert peek pop doto proxy first rest cons cast coll last butlast sigs reify second ffirst fnext nfirst nnext meta with-meta ns in-ns create-ns import refer keys select-keys vals key val rseq name namespace promise into transient persistent! conj! assoc! dissoc! pop! disj! use class type num float double short byte boolean bigint biginteger bigdec print-method print-dup throw-if printf format load compile get-in update-in pr pr-on newline flush read slurp read-line subvec with-open memfn time re-find re-groups rand-int rand mod locking assert-valid-fdecl alias resolve ref deref refset swap! reset! set-validator! compare-and-set! alter-meta! reset-meta! commute get-validator alter ref-set ref-history-count ref-min-history ref-max-history ensure sync io! new next conj set! to-array future future-call into-array aset gen-class reduce map filter find empty hash-map hash-set sorted-map sorted-map-by sorted-set sorted-set-by vec vector seq flatten reverse assoc dissoc list disj get union difference intersection extend extend-type extend-protocol int nth delay count concat chunk chunk-buffer chunk-append chunk-first chunk-rest max min dec unchecked-inc-int unchecked-inc unchecked-dec-inc unchecked-dec unchecked-negate unchecked-add-int unchecked-add unchecked-subtract-int unchecked-subtract chunk-next chunk-cons chunked-seq? prn vary-meta lazy-seq spread list* str find-keyword keyword symbol gensym force rationalize" -},s={begin:n,relevance:0},o={scope:"number",relevance:0,variants:[{ -match:/[-+]?0[xX][0-9a-fA-F]+N?/},{match:/[-+]?0[0-7]+N?/},{ -match:/[-+]?[1-9][0-9]?[rR][0-9a-zA-Z]+N?/},{match:/[-+]?[0-9]+\/[0-9]+N?/},{ -match:/[-+]?[0-9]+((\.[0-9]*([eE][+-]?[0-9]+)?M?)|([eE][+-]?[0-9]+M?|M))/},{ -match:/[-+]?([1-9][0-9]*|0)N?/}]},c={scope:"character",variants:[{ -match:/\\o[0-3]?[0-7]{1,2}/},{match:/\\u[0-9a-fA-F]{4}/},{ -match:/\\(newline|space|tab|formfeed|backspace|return)/},{match:/\\\S/, -relevance:0}]},i={scope:"regex",begin:/#"/,end:/"/,contains:[e.BACKSLASH_ESCAPE] -},d=e.inherit(e.QUOTE_STRING_MODE,{illegal:null}),l={scope:"punctuation", -match:/,/,relevance:0},m=e.COMMENT(";","$",{relevance:0}),p={ -className:"literal",begin:/\b(true|false|nil)\b/},u={ -begin:"\\[|(#::?"+n+")?\\{",end:"[\\]\\}]",relevance:0},f={className:"symbol", -begin:"[:]{1,2}"+n},h={begin:"\\(",end:"\\)"},y={endsWithParent:!0,relevance:0 -},g={keywords:r,className:"name",begin:n,relevance:0,starts:y -},b=[l,h,c,i,d,m,f,u,o,p,s],v={beginKeywords:a,keywords:{$pattern:n,keyword:a}, -end:'(\\[|#|\\d|"|:|\\{|\\)|\\(|$)',contains:[{className:"title",begin:n, -relevance:0,excludeEnd:!0,endsParent:!0}].concat(b)} -;return h.contains=[v,g,y],y.contains=b,u.contains=b,{name:"Clojure", -aliases:["clj","edn"],illegal:/\S/,contains:[l,h,c,i,d,m,f,u,o,p]}}})() -;hljs.registerLanguage("clojure",e)})();/*! `cmake` grammar compiled for Highlight.js 11.10.0 */ -(()=>{var e=(()=>{"use strict";return e=>({name:"CMake",aliases:["cmake.in"], -case_insensitive:!0,keywords:{ -keyword:"break cmake_host_system_information cmake_minimum_required cmake_parse_arguments cmake_policy configure_file continue elseif else endforeach endfunction endif endmacro endwhile execute_process file find_file find_library find_package find_path find_program foreach function get_cmake_property get_directory_property get_filename_component get_property if include include_guard list macro mark_as_advanced math message option return separate_arguments set_directory_properties set_property set site_name string unset variable_watch while add_compile_definitions add_compile_options add_custom_command add_custom_target add_definitions add_dependencies add_executable add_library add_link_options add_subdirectory add_test aux_source_directory build_command create_test_sourcelist define_property enable_language enable_testing export fltk_wrap_ui get_source_file_property get_target_property get_test_property include_directories include_external_msproject include_regular_expression install link_directories link_libraries load_cache project qt_wrap_cpp qt_wrap_ui remove_definitions set_source_files_properties set_target_properties set_tests_properties source_group target_compile_definitions target_compile_features target_compile_options target_include_directories target_link_directories target_link_libraries target_link_options target_sources try_compile try_run ctest_build ctest_configure ctest_coverage ctest_empty_binary_directory ctest_memcheck ctest_read_custom_files ctest_run_script ctest_sleep ctest_start ctest_submit ctest_test ctest_update ctest_upload build_name exec_program export_library_dependencies install_files install_programs install_targets load_command make_directory output_required_files remove subdir_depends subdirs use_mangled_mesa utility_source variable_requires write_file qt5_use_modules qt5_use_package qt5_wrap_cpp on off true false and or not command policy target test exists is_newer_than is_directory is_symlink is_absolute matches less greater equal less_equal greater_equal strless strgreater strequal strless_equal strgreater_equal version_less version_greater version_equal version_less_equal version_greater_equal in_list defined" -},contains:[{className:"variable",begin:/\$\{/,end:/\}/ -},e.COMMENT(/#\[\[/,/]]/),e.HASH_COMMENT_MODE,e.QUOTE_STRING_MODE,e.NUMBER_MODE] -})})();hljs.registerLanguage("cmake",e)})();/*! `cpp` grammar compiled for Highlight.js 11.10.0 */ -(()=>{var e=(()=>{"use strict";return e=>{const t=e.regex,a=e.COMMENT("//","$",{ -contains:[{begin:/\\\n/}] -}),n="decltype\\(auto\\)",r="[a-zA-Z_]\\w*::",i="(?!struct)("+n+"|"+t.optional(r)+"[a-zA-Z_]\\w*"+t.optional("<[^<>]+>")+")",s={ -className:"type",begin:"\\b[a-z\\d_]*_t\\b"},c={className:"string",variants:[{ -begin:'(u8?|U|L)?"',end:'"',illegal:"\\n",contains:[e.BACKSLASH_ESCAPE]},{ -begin:"(u8?|U|L)?'(\\\\(x[0-9A-Fa-f]{2}|u[0-9A-Fa-f]{4,8}|[0-7]{3}|\\S)|.)", -end:"'",illegal:"."},e.END_SAME_AS_BEGIN({ -begin:/(?:u8?|U|L)?R"([^()\\ ]{0,16})\(/,end:/\)([^()\\ ]{0,16})"/})]},o={ -className:"number",variants:[{ -begin:"[+-]?(?:(?:[0-9](?:'?[0-9])*\\.(?:[0-9](?:'?[0-9])*)?|\\.[0-9](?:'?[0-9])*)(?:[Ee][+-]?[0-9](?:'?[0-9])*)?|[0-9](?:'?[0-9])*[Ee][+-]?[0-9](?:'?[0-9])*|0[Xx](?:[0-9A-Fa-f](?:'?[0-9A-Fa-f])*(?:\\.(?:[0-9A-Fa-f](?:'?[0-9A-Fa-f])*)?)?|\\.[0-9A-Fa-f](?:'?[0-9A-Fa-f])*)[Pp][+-]?[0-9](?:'?[0-9])*)(?:[Ff](?:16|32|64|128)?|(BF|bf)16|[Ll]|)" -},{ -begin:"[+-]?\\b(?:0[Bb][01](?:'?[01])*|0[Xx][0-9A-Fa-f](?:'?[0-9A-Fa-f])*|0(?:'?[0-7])*|[1-9](?:'?[0-9])*)(?:[Uu](?:LL?|ll?)|[Uu][Zz]?|(?:LL?|ll?)[Uu]?|[Zz][Uu]|)" -}],relevance:0},l={className:"meta",begin:/#\s*[a-z]+\b/,end:/$/,keywords:{ -keyword:"if else elif endif define undef warning error line pragma _Pragma ifdef ifndef include" -},contains:[{begin:/\\\n/,relevance:0},e.inherit(c,{className:"string"}),{ -className:"string",begin:/<.*?>/},a,e.C_BLOCK_COMMENT_MODE]},u={ -className:"title",begin:t.optional(r)+e.IDENT_RE,relevance:0 -},d=t.optional(r)+e.IDENT_RE+"\\s*\\(",p={ -type:["bool","char","char16_t","char32_t","char8_t","double","float","int","long","short","void","wchar_t","unsigned","signed","const","static"], -keyword:["alignas","alignof","and","and_eq","asm","atomic_cancel","atomic_commit","atomic_noexcept","auto","bitand","bitor","break","case","catch","class","co_await","co_return","co_yield","compl","concept","const_cast|10","consteval","constexpr","constinit","continue","decltype","default","delete","do","dynamic_cast|10","else","enum","explicit","export","extern","false","final","for","friend","goto","if","import","inline","module","mutable","namespace","new","noexcept","not","not_eq","nullptr","operator","or","or_eq","override","private","protected","public","reflexpr","register","reinterpret_cast|10","requires","return","sizeof","static_assert","static_cast|10","struct","switch","synchronized","template","this","thread_local","throw","transaction_safe","transaction_safe_dynamic","true","try","typedef","typeid","typename","union","using","virtual","volatile","while","xor","xor_eq"], -literal:["NULL","false","nullopt","nullptr","true"],built_in:["_Pragma"], -_type_hints:["any","auto_ptr","barrier","binary_semaphore","bitset","complex","condition_variable","condition_variable_any","counting_semaphore","deque","false_type","future","imaginary","initializer_list","istringstream","jthread","latch","lock_guard","multimap","multiset","mutex","optional","ostringstream","packaged_task","pair","promise","priority_queue","queue","recursive_mutex","recursive_timed_mutex","scoped_lock","set","shared_future","shared_lock","shared_mutex","shared_timed_mutex","shared_ptr","stack","string_view","stringstream","timed_mutex","thread","true_type","tuple","unique_lock","unique_ptr","unordered_map","unordered_multimap","unordered_multiset","unordered_set","variant","vector","weak_ptr","wstring","wstring_view"] -},_={className:"function.dispatch",relevance:0,keywords:{ -_hint:["abort","abs","acos","apply","as_const","asin","atan","atan2","calloc","ceil","cerr","cin","clog","cos","cosh","cout","declval","endl","exchange","exit","exp","fabs","floor","fmod","forward","fprintf","fputs","free","frexp","fscanf","future","invoke","isalnum","isalpha","iscntrl","isdigit","isgraph","islower","isprint","ispunct","isspace","isupper","isxdigit","labs","launder","ldexp","log","log10","make_pair","make_shared","make_shared_for_overwrite","make_tuple","make_unique","malloc","memchr","memcmp","memcpy","memset","modf","move","pow","printf","putchar","puts","realloc","scanf","sin","sinh","snprintf","sprintf","sqrt","sscanf","std","stderr","stdin","stdout","strcat","strchr","strcmp","strcpy","strcspn","strlen","strncat","strncmp","strncpy","strpbrk","strrchr","strspn","strstr","swap","tan","tanh","terminate","to_underlying","tolower","toupper","vfprintf","visit","vprintf","vsprintf"] -}, -begin:t.concat(/\b/,/(?!decltype)/,/(?!if)/,/(?!for)/,/(?!switch)/,/(?!while)/,e.IDENT_RE,t.lookahead(/(<[^<>]+>|)\s*\(/)) -},m=[_,l,s,a,e.C_BLOCK_COMMENT_MODE,o,c],f={variants:[{begin:/=/,end:/;/},{ -begin:/\(/,end:/\)/},{beginKeywords:"new throw return else",end:/;/}], -keywords:p,contains:m.concat([{begin:/\(/,end:/\)/,keywords:p, -contains:m.concat(["self"]),relevance:0}]),relevance:0},g={className:"function", -begin:"("+i+"[\\*&\\s]+)+"+d,returnBegin:!0,end:/[{;=]/,excludeEnd:!0, -keywords:p,illegal:/[^\w\s\*&:<>.]/,contains:[{begin:n,keywords:p,relevance:0},{ -begin:d,returnBegin:!0,contains:[u],relevance:0},{begin:/::/,relevance:0},{ -begin:/:/,endsWithParent:!0,contains:[c,o]},{relevance:0,match:/,/},{ -className:"params",begin:/\(/,end:/\)/,keywords:p,relevance:0, -contains:[a,e.C_BLOCK_COMMENT_MODE,c,o,s,{begin:/\(/,end:/\)/,keywords:p, -relevance:0,contains:["self",a,e.C_BLOCK_COMMENT_MODE,c,o,s]}] -},s,a,e.C_BLOCK_COMMENT_MODE,l]};return{name:"C++", -aliases:["cc","c++","h++","hpp","hh","hxx","cxx"],keywords:p,illegal:"",keywords:p,contains:["self",s]},{begin:e.IDENT_RE+"::",keywords:p},{ -match:[/\b(?:enum(?:\s+(?:class|struct))?|class|struct|union)/,/\s+/,/\w+/], -className:{1:"keyword",3:"title.class"}}])}}})();hljs.registerLanguage("cpp",e) -})();/*! `csharp` grammar compiled for Highlight.js 11.10.0 */ -(()=>{var e=(()=>{"use strict";return e=>{const n={ -keyword:["abstract","as","base","break","case","catch","class","const","continue","do","else","event","explicit","extern","finally","fixed","for","foreach","goto","if","implicit","in","interface","internal","is","lock","namespace","new","operator","out","override","params","private","protected","public","readonly","record","ref","return","scoped","sealed","sizeof","stackalloc","static","struct","switch","this","throw","try","typeof","unchecked","unsafe","using","virtual","void","volatile","while"].concat(["add","alias","and","ascending","async","await","by","descending","equals","from","get","global","group","init","into","join","let","nameof","not","notnull","on","or","orderby","partial","remove","select","set","unmanaged","value|0","var","when","where","with","yield"]), -built_in:["bool","byte","char","decimal","delegate","double","dynamic","enum","float","int","long","nint","nuint","object","sbyte","short","string","ulong","uint","ushort"], -literal:["default","false","null","true"]},a=e.inherit(e.TITLE_MODE,{ -begin:"[a-zA-Z](\\.?\\w)*"}),i={className:"number",variants:[{ -begin:"\\b(0b[01']+)"},{ -begin:"(-?)\\b([\\d']+(\\.[\\d']*)?|\\.[\\d']+)(u|U|l|L|ul|UL|f|F|b|B)"},{ -begin:"(-?)(\\b0[xX][a-fA-F0-9']+|(\\b[\\d']+(\\.[\\d']*)?|\\.[\\d']+)([eE][-+]?[\\d']+)?)" -}],relevance:0},s={className:"string",begin:'@"',end:'"',contains:[{begin:'""'}] -},t=e.inherit(s,{illegal:/\n/}),r={className:"subst",begin:/\{/,end:/\}/, -keywords:n},l=e.inherit(r,{illegal:/\n/}),c={className:"string",begin:/\$"/, -end:'"',illegal:/\n/,contains:[{begin:/\{\{/},{begin:/\}\}/ -},e.BACKSLASH_ESCAPE,l]},o={className:"string",begin:/\$@"/,end:'"',contains:[{ -begin:/\{\{/},{begin:/\}\}/},{begin:'""'},r]},d=e.inherit(o,{illegal:/\n/, -contains:[{begin:/\{\{/},{begin:/\}\}/},{begin:'""'},l]}) -;r.contains=[o,c,s,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,i,e.C_BLOCK_COMMENT_MODE], -l.contains=[d,c,t,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,i,e.inherit(e.C_BLOCK_COMMENT_MODE,{ -illegal:/\n/})];const g={variants:[{className:"string", -begin:/"""("*)(?!")(.|\n)*?"""\1/,relevance:1 -},o,c,s,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE]},E={begin:"<",end:">", -contains:[{beginKeywords:"in out"},a] -},_=e.IDENT_RE+"(<"+e.IDENT_RE+"(\\s*,\\s*"+e.IDENT_RE+")*>)?(\\[\\])?",b={ -begin:"@"+e.IDENT_RE,relevance:0};return{name:"C#",aliases:["cs","c#"], -keywords:n,illegal:/::/,contains:[e.COMMENT("///","$",{returnBegin:!0, -contains:[{className:"doctag",variants:[{begin:"///",relevance:0},{ -begin:"\x3c!--|--\x3e"},{begin:""}]}] -}),e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,{className:"meta",begin:"#", -end:"$",keywords:{ -keyword:"if else elif endif define undef warning error line region endregion pragma checksum" -}},g,i,{beginKeywords:"class interface",relevance:0,end:/[{;=]/, -illegal:/[^\s:,]/,contains:[{beginKeywords:"where class" -},a,E,e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},{beginKeywords:"namespace", -relevance:0,end:/[{;=]/,illegal:/[^\s:]/, -contains:[a,e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},{ -beginKeywords:"record",relevance:0,end:/[{;=]/,illegal:/[^\s:]/, -contains:[a,E,e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},{className:"meta", -begin:"^\\s*\\[(?=[\\w])",excludeBegin:!0,end:"\\]",excludeEnd:!0,contains:[{ -className:"string",begin:/"/,end:/"/}]},{ -beginKeywords:"new return throw await else",relevance:0},{className:"function", -begin:"("+_+"\\s+)+"+e.IDENT_RE+"\\s*(<[^=]+>\\s*)?\\(",returnBegin:!0, -end:/\s*[{;=]/,excludeEnd:!0,keywords:n,contains:[{ -beginKeywords:"public private protected static internal protected abstract async extern override unsafe virtual new sealed partial", -relevance:0},{begin:e.IDENT_RE+"\\s*(<[^=]+>\\s*)?\\(",returnBegin:!0, -contains:[e.TITLE_MODE,E],relevance:0},{match:/\(\)/},{className:"params", -begin:/\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:n,relevance:0, -contains:[g,i,e.C_BLOCK_COMMENT_MODE] -},e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},b]}}})() -;hljs.registerLanguage("csharp",e)})();/*! `css` grammar compiled for Highlight.js 11.10.0 */ -(()=>{var e=(()=>{"use strict" -;const e=["a","abbr","address","article","aside","audio","b","blockquote","body","button","canvas","caption","cite","code","dd","del","details","dfn","div","dl","dt","em","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hgroup","html","i","iframe","img","input","ins","kbd","label","legend","li","main","mark","menu","nav","object","ol","optgroup","option","p","picture","q","quote","samp","section","select","source","span","strong","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","tr","ul","var","video","defs","g","marker","mask","pattern","svg","switch","symbol","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feFlood","feGaussianBlur","feImage","feMerge","feMorphology","feOffset","feSpecularLighting","feTile","feTurbulence","linearGradient","radialGradient","stop","circle","ellipse","image","line","path","polygon","polyline","rect","text","use","textPath","tspan","foreignObject","clipPath"],r=["any-hover","any-pointer","aspect-ratio","color","color-gamut","color-index","device-aspect-ratio","device-height","device-width","display-mode","forced-colors","grid","height","hover","inverted-colors","monochrome","orientation","overflow-block","overflow-inline","pointer","prefers-color-scheme","prefers-contrast","prefers-reduced-motion","prefers-reduced-transparency","resolution","scan","scripting","update","width","min-width","max-width","min-height","max-height"].sort().reverse(),t=["active","any-link","blank","checked","current","default","defined","dir","disabled","drop","empty","enabled","first","first-child","first-of-type","fullscreen","future","focus","focus-visible","focus-within","has","host","host-context","hover","indeterminate","in-range","invalid","is","lang","last-child","last-of-type","left","link","local-link","not","nth-child","nth-col","nth-last-child","nth-last-col","nth-last-of-type","nth-of-type","only-child","only-of-type","optional","out-of-range","past","placeholder-shown","read-only","read-write","required","right","root","scope","target","target-within","user-invalid","valid","visited","where"].sort().reverse(),i=["after","backdrop","before","cue","cue-region","first-letter","first-line","grammar-error","marker","part","placeholder","selection","slotted","spelling-error"].sort().reverse(),o=["accent-color","align-content","align-items","align-self","alignment-baseline","all","animation","animation-delay","animation-direction","animation-duration","animation-fill-mode","animation-iteration-count","animation-name","animation-play-state","animation-timing-function","appearance","backface-visibility","background","background-attachment","background-blend-mode","background-clip","background-color","background-image","background-origin","background-position","background-repeat","background-size","baseline-shift","block-size","border","border-block","border-block-color","border-block-end","border-block-end-color","border-block-end-style","border-block-end-width","border-block-start","border-block-start-color","border-block-start-style","border-block-start-width","border-block-style","border-block-width","border-bottom","border-bottom-color","border-bottom-left-radius","border-bottom-right-radius","border-bottom-style","border-bottom-width","border-collapse","border-color","border-image","border-image-outset","border-image-repeat","border-image-slice","border-image-source","border-image-width","border-inline","border-inline-color","border-inline-end","border-inline-end-color","border-inline-end-style","border-inline-end-width","border-inline-start","border-inline-start-color","border-inline-start-style","border-inline-start-width","border-inline-style","border-inline-width","border-left","border-left-color","border-left-style","border-left-width","border-radius","border-right","border-end-end-radius","border-end-start-radius","border-right-color","border-right-style","border-right-width","border-spacing","border-start-end-radius","border-start-start-radius","border-style","border-top","border-top-color","border-top-left-radius","border-top-right-radius","border-top-style","border-top-width","border-width","bottom","box-decoration-break","box-shadow","box-sizing","break-after","break-before","break-inside","cx","cy","caption-side","caret-color","clear","clip","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","color-scheme","column-count","column-fill","column-gap","column-rule","column-rule-color","column-rule-style","column-rule-width","column-span","column-width","columns","contain","content","content-visibility","counter-increment","counter-reset","cue","cue-after","cue-before","cursor","direction","display","dominant-baseline","empty-cells","enable-background","fill","fill-opacity","fill-rule","filter","flex","flex-basis","flex-direction","flex-flow","flex-grow","flex-shrink","flex-wrap","float","flow","flood-color","flood-opacity","font","font-display","font-family","font-feature-settings","font-kerning","font-language-override","font-size","font-size-adjust","font-smoothing","font-stretch","font-style","font-synthesis","font-variant","font-variant-caps","font-variant-east-asian","font-variant-ligatures","font-variant-numeric","font-variant-position","font-variation-settings","font-weight","gap","glyph-orientation-horizontal","glyph-orientation-vertical","grid","grid-area","grid-auto-columns","grid-auto-flow","grid-auto-rows","grid-column","grid-column-end","grid-column-start","grid-gap","grid-row","grid-row-end","grid-row-start","grid-template","grid-template-areas","grid-template-columns","grid-template-rows","hanging-punctuation","height","hyphens","icon","image-orientation","image-rendering","image-resolution","ime-mode","inline-size","inset","inset-block","inset-block-end","inset-block-start","inset-inline","inset-inline-end","inset-inline-start","isolation","kerning","justify-content","justify-items","justify-self","left","letter-spacing","lighting-color","line-break","line-height","list-style","list-style-image","list-style-position","list-style-type","marker","marker-end","marker-mid","marker-start","mask","margin","margin-block","margin-block-end","margin-block-start","margin-bottom","margin-inline","margin-inline-end","margin-inline-start","margin-left","margin-right","margin-top","marks","mask","mask-border","mask-border-mode","mask-border-outset","mask-border-repeat","mask-border-slice","mask-border-source","mask-border-width","mask-clip","mask-composite","mask-image","mask-mode","mask-origin","mask-position","mask-repeat","mask-size","mask-type","max-block-size","max-height","max-inline-size","max-width","min-block-size","min-height","min-inline-size","min-width","mix-blend-mode","nav-down","nav-index","nav-left","nav-right","nav-up","none","normal","object-fit","object-position","opacity","order","orphans","outline","outline-color","outline-offset","outline-style","outline-width","overflow","overflow-wrap","overflow-x","overflow-y","padding","padding-block","padding-block-end","padding-block-start","padding-bottom","padding-inline","padding-inline-end","padding-inline-start","padding-left","padding-right","padding-top","page-break-after","page-break-before","page-break-inside","pause","pause-after","pause-before","perspective","perspective-origin","pointer-events","position","quotes","r","resize","rest","rest-after","rest-before","right","rotate","row-gap","scale","scroll-margin","scroll-margin-block","scroll-margin-block-end","scroll-margin-block-start","scroll-margin-bottom","scroll-margin-inline","scroll-margin-inline-end","scroll-margin-inline-start","scroll-margin-left","scroll-margin-right","scroll-margin-top","scroll-padding","scroll-padding-block","scroll-padding-block-end","scroll-padding-block-start","scroll-padding-bottom","scroll-padding-inline","scroll-padding-inline-end","scroll-padding-inline-start","scroll-padding-left","scroll-padding-right","scroll-padding-top","scroll-snap-align","scroll-snap-stop","scroll-snap-type","scrollbar-color","scrollbar-gutter","scrollbar-width","shape-image-threshold","shape-margin","shape-outside","shape-rendering","stop-color","stop-opacity","stroke","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","speak","speak-as","src","tab-size","table-layout","text-anchor","text-align","text-align-all","text-align-last","text-combine-upright","text-decoration","text-decoration-color","text-decoration-line","text-decoration-skip-ink","text-decoration-style","text-decoration-thickness","text-emphasis","text-emphasis-color","text-emphasis-position","text-emphasis-style","text-indent","text-justify","text-orientation","text-overflow","text-rendering","text-shadow","text-transform","text-underline-offset","text-underline-position","top","transform","transform-box","transform-origin","transform-style","transition","transition-delay","transition-duration","transition-property","transition-timing-function","translate","unicode-bidi","vector-effect","vertical-align","visibility","voice-balance","voice-duration","voice-family","voice-pitch","voice-range","voice-rate","voice-stress","voice-volume","white-space","widows","width","will-change","word-break","word-spacing","word-wrap","writing-mode","x","y","z-index"].sort().reverse() -;return n=>{const a=n.regex,l=(e=>({IMPORTANT:{scope:"meta",begin:"!important"}, -BLOCK_COMMENT:e.C_BLOCK_COMMENT_MODE,HEXCOLOR:{scope:"number", -begin:/#(([0-9a-fA-F]{3,4})|(([0-9a-fA-F]{2}){3,4}))\b/},FUNCTION_DISPATCH:{ -className:"built_in",begin:/[\w-]+(?=\()/},ATTRIBUTE_SELECTOR_MODE:{ -scope:"selector-attr",begin:/\[/,end:/\]/,illegal:"$", -contains:[e.APOS_STRING_MODE,e.QUOTE_STRING_MODE]},CSS_NUMBER_MODE:{ -scope:"number", -begin:e.NUMBER_RE+"(%|em|ex|ch|rem|vw|vh|vmin|vmax|cm|mm|in|pt|pc|px|deg|grad|rad|turn|s|ms|Hz|kHz|dpi|dpcm|dppx)?", -relevance:0},CSS_VARIABLE:{className:"attr",begin:/--[A-Za-z_][A-Za-z0-9_-]*/} -}))(n),s=[n.APOS_STRING_MODE,n.QUOTE_STRING_MODE];return{name:"CSS", -case_insensitive:!0,illegal:/[=|'\$]/,keywords:{keyframePosition:"from to"}, -classNameAliases:{keyframePosition:"selector-tag"},contains:[l.BLOCK_COMMENT,{ -begin:/-(webkit|moz|ms|o)-(?=[a-z])/},l.CSS_NUMBER_MODE,{ -className:"selector-id",begin:/#[A-Za-z0-9_-]+/,relevance:0},{ -className:"selector-class",begin:"\\.[a-zA-Z-][a-zA-Z0-9_-]*",relevance:0 -},l.ATTRIBUTE_SELECTOR_MODE,{className:"selector-pseudo",variants:[{ -begin:":("+t.join("|")+")"},{begin:":(:)?("+i.join("|")+")"}]},l.CSS_VARIABLE,{ -className:"attribute",begin:"\\b("+o.join("|")+")\\b"},{begin:/:/,end:/[;}{]/, -contains:[l.BLOCK_COMMENT,l.HEXCOLOR,l.IMPORTANT,l.CSS_NUMBER_MODE,...s,{ -begin:/(url|data-uri)\(/,end:/\)/,relevance:0,keywords:{built_in:"url data-uri" -},contains:[...s,{className:"string",begin:/[^)]/,endsWithParent:!0, -excludeEnd:!0}]},l.FUNCTION_DISPATCH]},{begin:a.lookahead(/@/),end:"[{;]", -relevance:0,illegal:/:/,contains:[{className:"keyword",begin:/@-?\w[\w]*(-\w+)*/ -},{begin:/\s/,endsWithParent:!0,excludeEnd:!0,relevance:0,keywords:{ -$pattern:/[a-z-]+/,keyword:"and or not only",attribute:r.join(" ")},contains:[{ -begin:/[a-z-]+(?=:)/,className:"attribute"},...s,l.CSS_NUMBER_MODE]}]},{ -className:"selector-tag",begin:"\\b("+e.join("|")+")\\b"}]}}})() -;hljs.registerLanguage("css",e)})();/*! `dart` grammar compiled for Highlight.js 11.10.0 */ -(()=>{var e=(()=>{"use strict";return e=>{const n={className:"subst",variants:[{ -begin:"\\$[A-Za-z0-9_]+"}]},a={className:"subst",variants:[{begin:/\$\{/, -end:/\}/}],keywords:"true false null this is new super"},t={className:"string", -variants:[{begin:"r'''",end:"'''"},{begin:'r"""',end:'"""'},{begin:"r'",end:"'", -illegal:"\\n"},{begin:'r"',end:'"',illegal:"\\n"},{begin:"'''",end:"'''", -contains:[e.BACKSLASH_ESCAPE,n,a]},{begin:'"""',end:'"""', -contains:[e.BACKSLASH_ESCAPE,n,a]},{begin:"'",end:"'",illegal:"\\n", -contains:[e.BACKSLASH_ESCAPE,n,a]},{begin:'"',end:'"',illegal:"\\n", -contains:[e.BACKSLASH_ESCAPE,n,a]}]};a.contains=[e.C_NUMBER_MODE,t] -;const i=["Comparable","DateTime","Duration","Function","Iterable","Iterator","List","Map","Match","Object","Pattern","RegExp","Set","Stopwatch","String","StringBuffer","StringSink","Symbol","Type","Uri","bool","double","int","num","Element","ElementList"],r=i.map((e=>e+"?")) -;return{name:"Dart",keywords:{ -keyword:["abstract","as","assert","async","await","base","break","case","catch","class","const","continue","covariant","default","deferred","do","dynamic","else","enum","export","extends","extension","external","factory","false","final","finally","for","Function","get","hide","if","implements","import","in","interface","is","late","library","mixin","new","null","on","operator","part","required","rethrow","return","sealed","set","show","static","super","switch","sync","this","throw","true","try","typedef","var","void","when","while","with","yield"], -built_in:i.concat(r).concat(["Never","Null","dynamic","print","document","querySelector","querySelectorAll","window"]), -$pattern:/[A-Za-z][A-Za-z0-9_]*\??/}, -contains:[t,e.COMMENT(/\/\*\*(?!\/)/,/\*\//,{subLanguage:"markdown",relevance:0 -}),e.COMMENT(/\/{3,} ?/,/$/,{contains:[{subLanguage:"markdown",begin:".", -end:"$",relevance:0}]}),e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,{ -className:"class",beginKeywords:"class interface",end:/\{/,excludeEnd:!0, -contains:[{beginKeywords:"extends implements"},e.UNDERSCORE_TITLE_MODE] -},e.C_NUMBER_MODE,{className:"meta",begin:"@[A-Za-z]+"},{begin:"=>"}]}}})() -;hljs.registerLanguage("dart",e)})();/*! `delphi` grammar compiled for Highlight.js 11.10.0 */ -(()=>{var e=(()=>{"use strict";return e=>{ -const a=["exports","register","file","shl","array","record","property","for","mod","while","set","ally","label","uses","raise","not","stored","class","safecall","var","interface","or","private","static","exit","index","inherited","to","else","stdcall","override","shr","asm","far","resourcestring","finalization","packed","virtual","out","and","protected","library","do","xorwrite","goto","near","function","end","div","overload","object","unit","begin","string","on","inline","repeat","until","destructor","write","message","program","with","read","initialization","except","default","nil","if","case","cdecl","in","downto","threadvar","of","try","pascal","const","external","constructor","type","public","then","implementation","finally","published","procedure","absolute","reintroduce","operator","as","is","abstract","alias","assembler","bitpacked","break","continue","cppdecl","cvar","enumerator","experimental","platform","deprecated","unimplemented","dynamic","export","far16","forward","generic","helper","implements","interrupt","iochecks","local","name","nodefault","noreturn","nostackframe","oldfpccall","otherwise","saveregisters","softfloat","specialize","strict","unaligned","varargs"],r=[e.C_LINE_COMMENT_MODE,e.COMMENT(/\{/,/\}/,{ -relevance:0}),e.COMMENT(/\(\*/,/\*\)/,{relevance:10})],t={className:"meta", -variants:[{begin:/\{\$/,end:/\}/},{begin:/\(\*\$/,end:/\*\)/}]},n={ -className:"string",begin:/'/,end:/'/,contains:[{begin:/''/}]},s={ -className:"string",variants:[{match:/#\d[\d_]*/},{ -match:/#\$[\dA-Fa-f][\dA-Fa-f_]*/},{match:/#&[0-7][0-7_]*/},{ -match:/#%[01][01_]*/}]},i={begin:e.IDENT_RE+"\\s*=\\s*class\\s*\\(", -returnBegin:!0,contains:[e.TITLE_MODE]},c={className:"function", -beginKeywords:"function constructor destructor procedure",end:/[:;]/, -keywords:"function constructor|10 destructor|10 procedure|10", -contains:[e.TITLE_MODE,{className:"params",begin:/\(/,end:/\)/,keywords:a, -contains:[n,s,t].concat(r)},t].concat(r)};return{name:"Delphi", -aliases:["dpr","dfm","pas","pascal"],case_insensitive:!0,keywords:a, -illegal:/"|\$[G-Zg-z]|\/\*|<\/|\|/,contains:[n,s,{className:"number", -relevance:0,variants:[{match:/\b\d[\d_]*(\.\d[\d_]*)?/},{match:/\$[\dA-Fa-f_]+/ -},{match:/\$/,relevance:0},{match:/&[0-7][0-7_]*/},{match:/%[01_]+/},{match:/%/, -relevance:0}]},i,c,t].concat(r)}}})();hljs.registerLanguage("delphi",e)})();/*! `diff` grammar compiled for Highlight.js 11.10.0 */ -(()=>{var e=(()=>{"use strict";return e=>{const a=e.regex;return{name:"Diff", -aliases:["patch"],contains:[{className:"meta",relevance:10, -match:a.either(/^@@ +-\d+,\d+ +\+\d+,\d+ +@@/,/^\*\*\* +\d+,\d+ +\*\*\*\*$/,/^--- +\d+,\d+ +----$/) -},{className:"comment",variants:[{ -begin:a.either(/Index: /,/^index/,/={3,}/,/^-{3}/,/^\*{3} /,/^\+{3}/,/^diff --git/), -end:/$/},{match:/^\*{15}$/}]},{className:"addition",begin:/^\+/,end:/$/},{ -className:"deletion",begin:/^-/,end:/$/},{className:"addition",begin:/^!/, -end:/$/}]}}})();hljs.registerLanguage("diff",e)})();/*! `django` grammar compiled for Highlight.js 11.10.0 */ -(()=>{var e=(()=>{"use strict";return e=>{const t={begin:/\|[A-Za-z]+:?/, -keywords:{ -name:"truncatewords removetags linebreaksbr yesno get_digit timesince random striptags filesizeformat escape linebreaks length_is ljust rjust cut urlize fix_ampersands title floatformat capfirst pprint divisibleby add make_list unordered_list urlencode timeuntil urlizetrunc wordcount stringformat linenumbers slice date dictsort dictsortreversed default_if_none pluralize lower join center default truncatewords_html upper length phone2numeric wordwrap time addslashes slugify first escapejs force_escape iriencode last safe safeseq truncatechars localize unlocalize localtime utc timezone" -},contains:[e.QUOTE_STRING_MODE,e.APOS_STRING_MODE]};return{name:"Django", -aliases:["jinja"],case_insensitive:!0,subLanguage:"xml", -contains:[e.COMMENT(/\{%\s*comment\s*%\}/,/\{%\s*endcomment\s*%\}/),e.COMMENT(/\{#/,/#\}/),{ -className:"template-tag",begin:/\{%/,end:/%\}/,contains:[{className:"name", -begin:/\w+/,keywords:{ -name:"comment endcomment load templatetag ifchanged endifchanged if endif firstof for endfor ifnotequal endifnotequal widthratio extends include spaceless endspaceless regroup ifequal endifequal ssi now with cycle url filter endfilter debug block endblock else autoescape endautoescape csrf_token empty elif endwith static trans blocktrans endblocktrans get_static_prefix get_media_prefix plural get_current_language language get_available_languages get_current_language_bidi get_language_info get_language_info_list localize endlocalize localtime endlocaltime timezone endtimezone get_current_timezone verbatim" -},starts:{endsWithParent:!0,keywords:"in by as",contains:[t],relevance:0}}]},{ -className:"template-variable",begin:/\{\{/,end:/\}\}/,contains:[t]}]}}})() -;hljs.registerLanguage("django",e)})();/*! `dockerfile` grammar compiled for Highlight.js 11.10.0 */ -(()=>{var e=(()=>{"use strict";return e=>({name:"Dockerfile",aliases:["docker"], -case_insensitive:!0, -keywords:["from","maintainer","expose","env","arg","user","onbuild","stopsignal"], -contains:[e.HASH_COMMENT_MODE,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,e.NUMBER_MODE,{ -beginKeywords:"run cmd entrypoint volume add copy workdir label healthcheck shell", -starts:{end:/[^\\]$/,subLanguage:"bash"}}],illegal:"{var e=(()=>{"use strict";return e=>{ -const n=e.regex,a="[a-zA-Z_][a-zA-Z0-9_.]*(!|\\?)?",i={$pattern:a, -keyword:["after","alias","and","case","catch","cond","defstruct","defguard","do","else","end","fn","for","if","import","in","not","or","quote","raise","receive","require","reraise","rescue","try","unless","unquote","unquote_splicing","use","when","with|0"], -literal:["false","nil","true"]},s={className:"subst",begin:/#\{/,end:/\}/, -keywords:i},c={match:/\\[\s\S]/,scope:"char.escape",relevance:0 -},r="[/|([{<\"']",t=[{begin:/"/,end:/"/},{begin:/'/,end:/'/},{begin:/\//, -end:/\//},{begin:/\|/,end:/\|/},{begin:/\(/,end:/\)/},{begin:/\[/,end:/\]/},{ -begin:/\{/,end:/\}/},{begin://}],d=e=>({scope:"char.escape", -begin:n.concat(/\\/,e),relevance:0}),o={className:"string", -begin:"~[a-z](?="+r+")",contains:t.map((n=>e.inherit(n,{contains:[d(n.end),c,s] -})))},b={className:"string",begin:"~[A-Z](?="+r+")", -contains:t.map((n=>e.inherit(n,{contains:[d(n.end)]})))},g={className:"regex", -variants:[{begin:"~r(?="+r+")",contains:t.map((a=>e.inherit(a,{ -end:n.concat(a.end,/[uismxfU]{0,7}/),contains:[d(a.end),c,s]})))},{ -begin:"~R(?="+r+")",contains:t.map((a=>e.inherit(a,{ -end:n.concat(a.end,/[uismxfU]{0,7}/),contains:[d(a.end)]})))}]},l={ -className:"string",contains:[e.BACKSLASH_ESCAPE,s],variants:[{begin:/"""/, -end:/"""/},{begin:/'''/,end:/'''/},{begin:/~S"""/,end:/"""/,contains:[]},{ -begin:/~S"/,end:/"/,contains:[]},{begin:/~S'''/,end:/'''/,contains:[]},{ -begin:/~S'/,end:/'/,contains:[]},{begin:/'/,end:/'/},{begin:/"/,end:/"/}]},m={ -className:"function",beginKeywords:"def defp defmacro defmacrop",end:/\B\b/, -contains:[e.inherit(e.TITLE_MODE,{begin:a,endsParent:!0})]},u=e.inherit(m,{ -className:"class",beginKeywords:"defimpl defmodule defprotocol defrecord", -end:/\bdo\b|$|;/}),f=[l,g,b,o,e.HASH_COMMENT_MODE,u,m,{begin:"::"},{ -className:"symbol",begin:":(?![\\s:])",contains:[l,{ -begin:"[a-zA-Z_]\\w*[!?=]?|[-+~]@|<<|>>|=~|===?|<=>|[<>]=?|\\*\\*|[-/+%^&*~`|]|\\[\\]=?" -}],relevance:0},{className:"symbol",begin:a+":(?!:)",relevance:0},{ -className:"title.class",begin:/(\b[A-Z][a-zA-Z0-9_]+)/,relevance:0},{ -className:"number", -begin:"(\\b0o[0-7_]+)|(\\b0b[01_]+)|(\\b0x[0-9a-fA-F_]+)|(-?\\b[0-9][0-9_]*(\\.[0-9_]+([eE][-+]?[0-9]+)?)?)", -relevance:0},{className:"variable",begin:"(\\$\\W)|((\\$|@@?)(\\w+))"}] -;return s.contains=f,{name:"Elixir",aliases:["ex","exs"],keywords:i,contains:f}} -})();hljs.registerLanguage("elixir",e)})();/*! `erlang` grammar compiled for Highlight.js 11.10.0 */ -(()=>{var e=(()=>{"use strict";return e=>{ -const n="[a-z'][a-zA-Z0-9_']*",r="("+n+":"+n+"|"+n+")",a={ -keyword:"after and andalso|10 band begin bnot bor bsl bzr bxor case catch cond div end fun if let not of orelse|10 query receive rem try when xor", -literal:"false true"},i=e.COMMENT("%","$"),s={className:"number", -begin:"\\b(\\d+(_\\d+)*#[a-fA-F0-9]+(_[a-fA-F0-9]+)*|\\d+(_\\d+)*(\\.\\d+(_\\d+)*)?([eE][-+]?\\d+)?)", -relevance:0},c={begin:"fun\\s+"+n+"/\\d+"},t={begin:r+"\\(",end:"\\)", -returnBegin:!0,relevance:0,contains:[{begin:r,relevance:0},{begin:"\\(", -end:"\\)",endsWithParent:!0,returnEnd:!0,relevance:0}]},d={begin:/\{/,end:/\}/, -relevance:0},o={begin:"\\b_([A-Z][A-Za-z0-9_]*)?",relevance:0},l={ -begin:"[A-Z][a-zA-Z0-9_]*",relevance:0},g={begin:"#"+e.UNDERSCORE_IDENT_RE, -relevance:0,returnBegin:!0,contains:[{begin:"#"+e.UNDERSCORE_IDENT_RE, -relevance:0},{begin:/\{/,end:/\}/,relevance:0}]},b={scope:"string", -match:/\$(\\([^0-9]|[0-9]{1,3}|)|.)/},E={ -beginKeywords:"fun receive if try case",end:"end",keywords:a} -;E.contains=[i,c,e.inherit(e.APOS_STRING_MODE,{className:"" -}),E,t,e.QUOTE_STRING_MODE,s,d,o,l,g,b] -;const u=[i,c,E,t,e.QUOTE_STRING_MODE,s,d,o,l,g,b] -;t.contains[1].contains=u,d.contains=u,g.contains[1].contains=u;const _={ -className:"params",begin:"\\(",end:"\\)",contains:u};return{name:"Erlang", -aliases:["erl"],keywords:a,illegal:"(",returnBegin:!0, -illegal:"\\(|#|//|/\\*|\\\\|:|;",contains:[_,e.inherit(e.TITLE_MODE,{begin:n})], -starts:{end:";|\\.",keywords:a,contains:u}},i,{begin:"^-",end:"\\.",relevance:0, -excludeEnd:!0,returnBegin:!0,keywords:{$pattern:"-"+e.IDENT_RE, -keyword:["-module","-record","-undef","-export","-ifdef","-ifndef","-author","-copyright","-doc","-vsn","-import","-include","-include_lib","-compile","-define","-else","-endif","-file","-behaviour","-behavior","-spec"].map((e=>e+"|1.5")).join(" ") -},contains:[_]},s,e.QUOTE_STRING_MODE,g,o,l,d,b,{begin:/\.$/}]}}})() -;hljs.registerLanguage("erlang",e)})();/*! `fortran` grammar compiled for Highlight.js 11.10.0 */ -(()=>{var e=(()=>{"use strict";return e=>{const n=e.regex,a={ -variants:[e.COMMENT("!","$",{relevance:0}),e.COMMENT("^C[ ]","$",{relevance:0 -}),e.COMMENT("^C$","$",{relevance:0})] -},t=/(_[a-z_\d]+)?/,i=/([de][+-]?\d+)?/,c={className:"number",variants:[{ -begin:n.concat(/\b\d+/,/\.(\d*)/,i,t)},{begin:n.concat(/\b\d+/,i,t)},{ -begin:n.concat(/\.\d+/,i,t)}],relevance:0},o={className:"function", -beginKeywords:"subroutine function program",illegal:"[${=\\n]", -contains:[e.UNDERSCORE_TITLE_MODE,{className:"params",begin:"\\(",end:"\\)"}]} -;return{name:"Fortran",case_insensitive:!0,aliases:["f90","f95"],keywords:{ -$pattern:/\b[a-z][a-z0-9_]+\b|\.[a-z][a-z0-9_]+\./, -keyword:["kind","do","concurrent","local","shared","while","private","call","intrinsic","where","elsewhere","type","endtype","endmodule","endselect","endinterface","end","enddo","endif","if","forall","endforall","only","contains","default","return","stop","then","block","endblock","endassociate","public","subroutine|10","function","program",".and.",".or.",".not.",".le.",".eq.",".ge.",".gt.",".lt.","goto","save","else","use","module","select","case","access","blank","direct","exist","file","fmt","form","formatted","iostat","name","named","nextrec","number","opened","rec","recl","sequential","status","unformatted","unit","continue","format","pause","cycle","exit","c_null_char","c_alert","c_backspace","c_form_feed","flush","wait","decimal","round","iomsg","synchronous","nopass","non_overridable","pass","protected","volatile","abstract","extends","import","non_intrinsic","value","deferred","generic","final","enumerator","class","associate","bind","enum","c_int","c_short","c_long","c_long_long","c_signed_char","c_size_t","c_int8_t","c_int16_t","c_int32_t","c_int64_t","c_int_least8_t","c_int_least16_t","c_int_least32_t","c_int_least64_t","c_int_fast8_t","c_int_fast16_t","c_int_fast32_t","c_int_fast64_t","c_intmax_t","C_intptr_t","c_float","c_double","c_long_double","c_float_complex","c_double_complex","c_long_double_complex","c_bool","c_char","c_null_ptr","c_null_funptr","c_new_line","c_carriage_return","c_horizontal_tab","c_vertical_tab","iso_c_binding","c_loc","c_funloc","c_associated","c_f_pointer","c_ptr","c_funptr","iso_fortran_env","character_storage_size","error_unit","file_storage_size","input_unit","iostat_end","iostat_eor","numeric_storage_size","output_unit","c_f_procpointer","ieee_arithmetic","ieee_support_underflow_control","ieee_get_underflow_mode","ieee_set_underflow_mode","newunit","contiguous","recursive","pad","position","action","delim","readwrite","eor","advance","nml","interface","procedure","namelist","include","sequence","elemental","pure","impure","integer","real","character","complex","logical","codimension","dimension","allocatable|10","parameter","external","implicit|10","none","double","precision","assign","intent","optional","pointer","target","in","out","common","equivalence","data"], -literal:[".False.",".True."], -built_in:["alog","alog10","amax0","amax1","amin0","amin1","amod","cabs","ccos","cexp","clog","csin","csqrt","dabs","dacos","dasin","datan","datan2","dcos","dcosh","ddim","dexp","dint","dlog","dlog10","dmax1","dmin1","dmod","dnint","dsign","dsin","dsinh","dsqrt","dtan","dtanh","float","iabs","idim","idint","idnint","ifix","isign","max0","max1","min0","min1","sngl","algama","cdabs","cdcos","cdexp","cdlog","cdsin","cdsqrt","cqabs","cqcos","cqexp","cqlog","cqsin","cqsqrt","dcmplx","dconjg","derf","derfc","dfloat","dgamma","dimag","dlgama","iqint","qabs","qacos","qasin","qatan","qatan2","qcmplx","qconjg","qcos","qcosh","qdim","qerf","qerfc","qexp","qgamma","qimag","qlgama","qlog","qlog10","qmax1","qmin1","qmod","qnint","qsign","qsin","qsinh","qsqrt","qtan","qtanh","abs","acos","aimag","aint","anint","asin","atan","atan2","char","cmplx","conjg","cos","cosh","exp","ichar","index","int","log","log10","max","min","nint","sign","sin","sinh","sqrt","tan","tanh","print","write","dim","lge","lgt","lle","llt","mod","nullify","allocate","deallocate","adjustl","adjustr","all","allocated","any","associated","bit_size","btest","ceiling","count","cshift","date_and_time","digits","dot_product","eoshift","epsilon","exponent","floor","fraction","huge","iand","ibclr","ibits","ibset","ieor","ior","ishft","ishftc","lbound","len_trim","matmul","maxexponent","maxloc","maxval","merge","minexponent","minloc","minval","modulo","mvbits","nearest","pack","present","product","radix","random_number","random_seed","range","repeat","reshape","rrspacing","scale","scan","selected_int_kind","selected_real_kind","set_exponent","shape","size","spacing","spread","sum","system_clock","tiny","transpose","trim","ubound","unpack","verify","achar","iachar","transfer","dble","entry","dprod","cpu_time","command_argument_count","get_command","get_command_argument","get_environment_variable","is_iostat_end","ieee_arithmetic","ieee_support_underflow_control","ieee_get_underflow_mode","ieee_set_underflow_mode","is_iostat_eor","move_alloc","new_line","selected_char_kind","same_type_as","extends_type_of","acosh","asinh","atanh","bessel_j0","bessel_j1","bessel_jn","bessel_y0","bessel_y1","bessel_yn","erf","erfc","erfc_scaled","gamma","log_gamma","hypot","norm2","atomic_define","atomic_ref","execute_command_line","leadz","trailz","storage_size","merge_bits","bge","bgt","ble","blt","dshiftl","dshiftr","findloc","iall","iany","iparity","image_index","lcobound","ucobound","maskl","maskr","num_images","parity","popcnt","poppar","shifta","shiftl","shiftr","this_image","sync","change","team","co_broadcast","co_max","co_min","co_sum","co_reduce"] -},illegal:/\/\*/,contains:[{className:"string",relevance:0, -variants:[e.APOS_STRING_MODE,e.QUOTE_STRING_MODE]},o,{begin:/^C\s*=(?!=)/, -relevance:0},a,c]}}})();hljs.registerLanguage("fortran",e)})();/*! `go` grammar compiled for Highlight.js 11.10.0 */ -(()=>{var e=(()=>{"use strict";return e=>{const a={ -keyword:["break","case","chan","const","continue","default","defer","else","fallthrough","for","func","go","goto","if","import","interface","map","package","range","return","select","struct","switch","type","var"], -type:["bool","byte","complex64","complex128","error","float32","float64","int8","int16","int32","int64","string","uint8","uint16","uint32","uint64","int","uint","uintptr","rune"], -literal:["true","false","iota","nil"], -built_in:["append","cap","close","complex","copy","imag","len","make","new","panic","print","println","real","recover","delete"] -};return{name:"Go",aliases:["golang"],keywords:a,illegal:"{var e=(()=>{"use strict";return e=>({name:"Gradle",case_insensitive:!0, -keywords:["task","project","allprojects","subprojects","artifacts","buildscript","configurations","dependencies","repositories","sourceSets","description","delete","from","into","include","exclude","source","classpath","destinationDir","includes","options","sourceCompatibility","targetCompatibility","group","flatDir","doLast","doFirst","flatten","todir","fromdir","ant","def","abstract","break","case","catch","continue","default","do","else","extends","final","finally","for","if","implements","instanceof","native","new","private","protected","public","return","static","switch","synchronized","throw","throws","transient","try","volatile","while","strictfp","package","import","false","null","super","this","true","antlrtask","checkstyle","codenarc","copy","boolean","byte","char","class","double","float","int","interface","long","short","void","compile","runTime","file","fileTree","abs","any","append","asList","asWritable","call","collect","compareTo","count","div","dump","each","eachByte","eachFile","eachLine","every","find","findAll","flatten","getAt","getErr","getIn","getOut","getText","grep","immutable","inject","inspect","intersect","invokeMethods","isCase","join","leftShift","minus","multiply","newInputStream","newOutputStream","newPrintWriter","newReader","newWriter","next","plus","pop","power","previous","print","println","push","putAt","read","readBytes","readLines","reverse","reverseEach","round","size","sort","splitEachLine","step","subMap","times","toInteger","toList","tokenize","upto","waitForOrKill","withPrintWriter","withReader","withStream","withWriter","withWriterAppend","write","writeLine"], -contains:[e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,e.NUMBER_MODE,e.REGEXP_MODE] -})})();hljs.registerLanguage("gradle",e)})();/*! `graphql` grammar compiled for Highlight.js 11.10.0 */ -(()=>{var e=(()=>{"use strict";return e=>{const a=e.regex;return{name:"GraphQL", -aliases:["gql"],case_insensitive:!0,disableAutodetect:!1,keywords:{ -keyword:["query","mutation","subscription","type","input","schema","directive","interface","union","scalar","fragment","enum","on"], -literal:["true","false","null"]}, -contains:[e.HASH_COMMENT_MODE,e.QUOTE_STRING_MODE,e.NUMBER_MODE,{ -scope:"punctuation",match:/[.]{3}/,relevance:0},{scope:"punctuation", -begin:/[\!\(\)\:\=\[\]\{\|\}]{1}/,relevance:0},{scope:"variable",begin:/\$/, -end:/\W/,excludeEnd:!0,relevance:0},{scope:"meta",match:/@\w+/,excludeEnd:!0},{ -scope:"symbol",begin:a.concat(/[_A-Za-z][_0-9A-Za-z]*/,a.lookahead(/\s*:/)), -relevance:0}],illegal:[/[;<']/,/BEGIN/]}}})();hljs.registerLanguage("graphql",e) -})();/*! `haskell` grammar compiled for Highlight.js 11.10.0 */ -(()=>{var e=(()=>{"use strict";return e=>{ -const n="([0-9]_*)+",a="([0-9a-fA-F]_*)+",i="([!#$%&*+.\\/<=>?@\\\\^~-]|(?!([(),;\\[\\]`|{}]|[_:\"']))(\\p{S}|\\p{P}))",s={ -variants:[e.COMMENT("--+","$"),e.COMMENT(/\{-/,/-\}/,{contains:["self"]})]},l={ -className:"meta",begin:/\{-#/,end:/#-\}/},t={className:"meta",begin:"^#",end:"$" -},c={className:"type",begin:"\\b[A-Z][\\w']*",relevance:0},r={begin:"\\(", -end:"\\)",illegal:'"',contains:[l,t,{className:"type", -begin:"\\b[A-Z][\\w]*(\\((\\.\\.|,|\\w+)\\))?"},e.inherit(e.TITLE_MODE,{ -begin:"[_a-z][\\w']*"}),s]},o={className:"number",relevance:0,variants:[{ -match:`\\b(${n})(\\.(${n}))?([eE][+-]?(${n}))?\\b`},{ -match:`\\b0[xX]_*(${a})(\\.(${a}))?([pP][+-]?(${n}))?\\b`},{ -match:"\\b0[oO](([0-7]_*)+)\\b"},{match:"\\b0[bB](([01]_*)+)\\b"}]};return{ -name:"Haskell",aliases:["hs"], -keywords:"let in if then else case of where do module import hiding qualified type data newtype deriving class instance as default infix infixl infixr foreign export ccall stdcall cplusplus jvm dotnet safe unsafe family forall mdo proc rec", -unicodeRegex:!0,contains:[{beginKeywords:"module",end:"where", -keywords:"module where",contains:[r,s],illegal:"\\W\\.|;"},{ -begin:"\\bimport\\b",end:"$",keywords:"import qualified as hiding", -contains:[r,s],illegal:"\\W\\.|;"},{className:"class", -begin:"^(\\s*)?(class|instance)\\b",end:"where", -keywords:"class family instance where",contains:[c,r,s]},{className:"class", -begin:"\\b(data|(new)?type)\\b",end:"$", -keywords:"data family type newtype deriving",contains:[l,c,r,{begin:/\{/, -end:/\}/,contains:r.contains},s]},{beginKeywords:"default",end:"$", -contains:[c,r,s]},{beginKeywords:"infix infixl infixr",end:"$", -contains:[e.C_NUMBER_MODE,s]},{begin:"\\bforeign\\b",end:"$", -keywords:"foreign import export ccall stdcall cplusplus jvm dotnet safe unsafe", -contains:[c,e.QUOTE_STRING_MODE,s]},{className:"meta", -begin:"#!\\/usr\\/bin\\/env runhaskell",end:"$"},l,t,{scope:"string", -begin:/'(?=\\?.')/,end:/'/,contains:[{scope:"char.escape",match:/\\./}] -},e.QUOTE_STRING_MODE,o,c,e.inherit(e.TITLE_MODE,{begin:"^[_a-z][\\w']*"}),{ -begin:`(?!-)${i}--+|--+(?!-)${i}`},s,{begin:"->|<-"}]}}})() -;hljs.registerLanguage("haskell",e)})();/*! `ini` grammar compiled for Highlight.js 11.10.0 */ -(()=>{var e=(()=>{"use strict";return e=>{const n=e.regex,a={className:"number", -relevance:0,variants:[{begin:/([+-]+)?[\d]+_[\d_]+/},{begin:e.NUMBER_RE}] -},s=e.COMMENT();s.variants=[{begin:/;/,end:/$/},{begin:/#/,end:/$/}];const i={ -className:"variable",variants:[{begin:/\$[\w\d"][\w\d_]*/},{begin:/\$\{(.*?)\}/ -}]},t={className:"literal",begin:/\bon|off|true|false|yes|no\b/},r={ -className:"string",contains:[e.BACKSLASH_ESCAPE],variants:[{begin:"'''", -end:"'''",relevance:10},{begin:'"""',end:'"""',relevance:10},{begin:'"',end:'"' -},{begin:"'",end:"'"}]},l={begin:/\[/,end:/\]/,contains:[s,t,i,r,a,"self"], -relevance:0},c=n.either(/[A-Za-z0-9_-]+/,/"(\\"|[^"])*"/,/'[^']*'/);return{ -name:"TOML, also INI",aliases:["toml"],case_insensitive:!0,illegal:/\S/, -contains:[s,{className:"section",begin:/\[+/,end:/\]+/},{ -begin:n.concat(c,"(\\s*\\.\\s*",c,")*",n.lookahead(/\s*=\s*[^#\s]/)), -className:"attr",starts:{end:/$/,contains:[s,l,t,i,r,a]}}]}}})() -;hljs.registerLanguage("ini",e)})();/*! `java` grammar compiled for Highlight.js 11.10.0 */ -(()=>{var e=(()=>{"use strict" -;var e="[0-9](_*[0-9])*",a=`\\.(${e})`,n="[0-9a-fA-F](_*[0-9a-fA-F])*",s={ -className:"number",variants:[{ -begin:`(\\b(${e})((${a})|\\.)?|(${a}))[eE][+-]?(${e})[fFdD]?\\b`},{ -begin:`\\b(${e})((${a})[fFdD]?\\b|\\.([fFdD]\\b)?)`},{begin:`(${a})[fFdD]?\\b` -},{begin:`\\b(${e})[fFdD]\\b`},{ -begin:`\\b0[xX]((${n})\\.?|(${n})?\\.(${n}))[pP][+-]?(${e})[fFdD]?\\b`},{ -begin:"\\b(0|[1-9](_*[0-9])*)[lL]?\\b"},{begin:`\\b0[xX](${n})[lL]?\\b`},{ -begin:"\\b0(_*[0-7])*[lL]?\\b"},{begin:"\\b0[bB][01](_*[01])*[lL]?\\b"}], -relevance:0};function t(e,a,n){return-1===n?"":e.replace(a,(s=>t(e,a,n-1)))} -return e=>{ -const a=e.regex,n="[\xc0-\u02b8a-zA-Z_$][\xc0-\u02b8a-zA-Z_$0-9]*",i=n+t("(?:<"+n+"~~~(?:\\s*,\\s*"+n+"~~~)*>)?",/~~~/g,2),r={ -keyword:["synchronized","abstract","private","var","static","if","const ","for","while","strictfp","finally","protected","import","native","final","void","enum","else","break","transient","catch","instanceof","volatile","case","assert","package","default","public","try","switch","continue","throws","protected","public","private","module","requires","exports","do","sealed","yield","permits","goto"], -literal:["false","true","null"], -type:["char","boolean","long","float","int","byte","short","double"], -built_in:["super","this"]},l={className:"meta",begin:"@"+n,contains:[{ -begin:/\(/,end:/\)/,contains:["self"]}]},c={className:"params",begin:/\(/, -end:/\)/,keywords:r,relevance:0,contains:[e.C_BLOCK_COMMENT_MODE],endsParent:!0} -;return{name:"Java",aliases:["jsp"],keywords:r,illegal:/<\/|#/, -contains:[e.COMMENT("/\\*\\*","\\*/",{relevance:0,contains:[{begin:/\w+@/, -relevance:0},{className:"doctag",begin:"@[A-Za-z]+"}]}),{ -begin:/import java\.[a-z]+\./,keywords:"import",relevance:2 -},e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,{begin:/"""/,end:/"""/, -className:"string",contains:[e.BACKSLASH_ESCAPE] -},e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,{ -match:[/\b(?:class|interface|enum|extends|implements|new)/,/\s+/,n],className:{ -1:"keyword",3:"title.class"}},{match:/non-sealed/,scope:"keyword"},{ -begin:[a.concat(/(?!else)/,n),/\s+/,n,/\s+/,/=(?!=)/],className:{1:"type", -3:"variable",5:"operator"}},{begin:[/record/,/\s+/,n],className:{1:"keyword", -3:"title.class"},contains:[c,e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},{ -beginKeywords:"new throw return else",relevance:0},{ -begin:["(?:"+i+"\\s+)",e.UNDERSCORE_IDENT_RE,/\s*(?=\()/],className:{ -2:"title.function"},keywords:r,contains:[{className:"params",begin:/\(/, -end:/\)/,keywords:r,relevance:0, -contains:[l,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,s,e.C_BLOCK_COMMENT_MODE] -},e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},s,l]}}})() -;hljs.registerLanguage("java",e)})();/*! `javascript` grammar compiled for Highlight.js 11.10.0 */ -(()=>{var e=(()=>{"use strict" -;const e="[A-Za-z$_][0-9A-Za-z$_]*",n=["as","in","of","if","for","while","finally","var","new","function","do","return","void","else","break","catch","instanceof","with","throw","case","default","try","switch","continue","typeof","delete","let","yield","const","class","debugger","async","await","static","import","from","export","extends"],a=["true","false","null","undefined","NaN","Infinity"],t=["Object","Function","Boolean","Symbol","Math","Date","Number","BigInt","String","RegExp","Array","Float32Array","Float64Array","Int8Array","Uint8Array","Uint8ClampedArray","Int16Array","Int32Array","Uint16Array","Uint32Array","BigInt64Array","BigUint64Array","Set","Map","WeakSet","WeakMap","ArrayBuffer","SharedArrayBuffer","Atomics","DataView","JSON","Promise","Generator","GeneratorFunction","AsyncFunction","Reflect","Proxy","Intl","WebAssembly"],s=["Error","EvalError","InternalError","RangeError","ReferenceError","SyntaxError","TypeError","URIError"],r=["setInterval","setTimeout","clearInterval","clearTimeout","require","exports","eval","isFinite","isNaN","parseFloat","parseInt","decodeURI","decodeURIComponent","encodeURI","encodeURIComponent","escape","unescape"],c=["arguments","this","super","console","window","document","localStorage","sessionStorage","module","global"],i=[].concat(r,t,s) -;return o=>{const l=o.regex,b=e,d={begin:/<[A-Za-z0-9\\._:-]+/, -end:/\/[A-Za-z0-9\\._:-]+>|\/>/,isTrulyOpeningTag:(e,n)=>{ -const a=e[0].length+e.index,t=e.input[a] -;if("<"===t||","===t)return void n.ignoreMatch();let s -;">"===t&&(((e,{after:n})=>{const a="e+"\\s*\\(")), -l.concat("(?!",T.join("|"),")")),b,l.lookahead(/\s*\(/)), -className:"title.function",relevance:0};var T;const C={ -begin:l.concat(/\./,l.lookahead(l.concat(b,/(?![0-9A-Za-z$_(])/))),end:b, -excludeBegin:!0,keywords:"prototype",className:"property",relevance:0},M={ -match:[/get|set/,/\s+/,b,/(?=\()/],className:{1:"keyword",3:"title.function"}, -contains:[{begin:/\(\)/},R] -},B="(\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)|"+o.UNDERSCORE_IDENT_RE+")\\s*=>",$={ -match:[/const|var|let/,/\s+/,b,/\s*/,/=\s*/,/(async\s*)?/,l.lookahead(B)], -keywords:"async",className:{1:"keyword",3:"title.function"},contains:[R]} -;return{name:"JavaScript",aliases:["js","jsx","mjs","cjs"],keywords:g,exports:{ -PARAMS_CONTAINS:w,CLASS_REFERENCE:k},illegal:/#(?![$_A-z])/, -contains:[o.SHEBANG({label:"shebang",binary:"node",relevance:5}),{ -label:"use_strict",className:"meta",relevance:10, -begin:/^\s*['"]use (strict|asm)['"]/ -},o.APOS_STRING_MODE,o.QUOTE_STRING_MODE,h,N,_,f,p,{match:/\$\d+/},A,k,{ -className:"attr",begin:b+l.lookahead(":"),relevance:0},$,{ -begin:"("+o.RE_STARTERS_RE+"|\\b(case|return|throw)\\b)\\s*", -keywords:"return throw case",relevance:0,contains:[p,o.REGEXP_MODE,{ -className:"function",begin:B,returnBegin:!0,end:"\\s*=>",contains:[{ -className:"params",variants:[{begin:o.UNDERSCORE_IDENT_RE,relevance:0},{ -className:null,begin:/\(\s*\)/,skip:!0},{begin:/(\s*)\(/,end:/\)/, -excludeBegin:!0,excludeEnd:!0,keywords:g,contains:w}]}]},{begin:/,/,relevance:0 -},{match:/\s+/,relevance:0},{variants:[{begin:"<>",end:""},{ -match:/<[A-Za-z0-9\\._:-]+\s*\/>/},{begin:d.begin, -"on:begin":d.isTrulyOpeningTag,end:d.end}],subLanguage:"xml",contains:[{ -begin:d.begin,end:d.end,skip:!0,contains:["self"]}]}]},I,{ -beginKeywords:"while if switch catch for"},{ -begin:"\\b(?!function)"+o.UNDERSCORE_IDENT_RE+"\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)\\s*\\{", -returnBegin:!0,label:"func.def",contains:[R,o.inherit(o.TITLE_MODE,{begin:b, -className:"title.function"})]},{match:/\.\.\./,relevance:0},C,{match:"\\$"+b, -relevance:0},{match:[/\bconstructor(?=\s*\()/],className:{1:"title.function"}, -contains:[R]},x,{relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/, -className:"variable.constant"},O,M,{match:/\$[(.]/}]}}})() -;hljs.registerLanguage("javascript",e)})();/*! `json` grammar compiled for Highlight.js 11.10.0 */ -(()=>{var e=(()=>{"use strict";return e=>{const a=["true","false","null"],s={ -scope:"literal",beginKeywords:a.join(" ")};return{name:"JSON",aliases:["jsonc"], -keywords:{literal:a},contains:[{className:"attr", -begin:/"(\\.|[^\\"\r\n])*"(?=\s*:)/,relevance:1.01},{match:/[{}[\],:]/, -className:"punctuation",relevance:0 -},e.QUOTE_STRING_MODE,s,e.C_NUMBER_MODE,e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE], -illegal:"\\S"}}})();hljs.registerLanguage("json",e)})();/*! `julia` grammar compiled for Highlight.js 11.10.0 */ -(()=>{var e=(()=>{"use strict";return e=>{ -const r="[A-Za-z_\\u00A1-\\uFFFF][A-Za-z_0-9\\u00A1-\\uFFFF]*",t={$pattern:r, -keyword:["baremodule","begin","break","catch","ccall","const","continue","do","else","elseif","end","export","false","finally","for","function","global","if","import","in","isa","let","local","macro","module","quote","return","true","try","using","where","while"], -literal:["ARGS","C_NULL","DEPOT_PATH","ENDIAN_BOM","ENV","Inf","Inf16","Inf32","Inf64","InsertionSort","LOAD_PATH","MergeSort","NaN","NaN16","NaN32","NaN64","PROGRAM_FILE","QuickSort","RoundDown","RoundFromZero","RoundNearest","RoundNearestTiesAway","RoundNearestTiesUp","RoundToZero","RoundUp","VERSION|0","devnull","false","im","missing","nothing","pi","stderr","stdin","stdout","true","undef","\u03c0","\u212f"], -built_in:["AbstractArray","AbstractChannel","AbstractChar","AbstractDict","AbstractDisplay","AbstractFloat","AbstractIrrational","AbstractMatrix","AbstractRange","AbstractSet","AbstractString","AbstractUnitRange","AbstractVecOrMat","AbstractVector","Any","ArgumentError","Array","AssertionError","BigFloat","BigInt","BitArray","BitMatrix","BitSet","BitVector","Bool","BoundsError","CapturedException","CartesianIndex","CartesianIndices","Cchar","Cdouble","Cfloat","Channel","Char","Cint","Cintmax_t","Clong","Clonglong","Cmd","Colon","Complex","ComplexF16","ComplexF32","ComplexF64","CompositeException","Condition","Cptrdiff_t","Cshort","Csize_t","Cssize_t","Cstring","Cuchar","Cuint","Cuintmax_t","Culong","Culonglong","Cushort","Cvoid","Cwchar_t","Cwstring","DataType","DenseArray","DenseMatrix","DenseVecOrMat","DenseVector","Dict","DimensionMismatch","Dims","DivideError","DomainError","EOFError","Enum","ErrorException","Exception","ExponentialBackOff","Expr","Float16","Float32","Float64","Function","GlobalRef","HTML","IO","IOBuffer","IOContext","IOStream","IdDict","IndexCartesian","IndexLinear","IndexStyle","InexactError","InitError","Int","Int128","Int16","Int32","Int64","Int8","Integer","InterruptException","InvalidStateException","Irrational","KeyError","LinRange","LineNumberNode","LinearIndices","LoadError","MIME","Matrix","Method","MethodError","Missing","MissingException","Module","NTuple","NamedTuple","Nothing","Number","OrdinalRange","OutOfMemoryError","OverflowError","Pair","PartialQuickSort","PermutedDimsArray","Pipe","ProcessFailedException","Ptr","QuoteNode","Rational","RawFD","ReadOnlyMemoryError","Real","ReentrantLock","Ref","Regex","RegexMatch","RoundingMode","SegmentationFault","Set","Signed","Some","StackOverflowError","StepRange","StepRangeLen","StridedArray","StridedMatrix","StridedVecOrMat","StridedVector","String","StringIndexError","SubArray","SubString","SubstitutionString","Symbol","SystemError","Task","TaskFailedException","Text","TextDisplay","Timer","Tuple","Type","TypeError","TypeVar","UInt","UInt128","UInt16","UInt32","UInt64","UInt8","UndefInitializer","UndefKeywordError","UndefRefError","UndefVarError","Union","UnionAll","UnitRange","Unsigned","Val","Vararg","VecElement","VecOrMat","Vector","VersionNumber","WeakKeyDict","WeakRef"] -},n={keywords:t,illegal:/<\//},a={className:"subst",begin:/\$\(/,end:/\)/, -keywords:t},i={className:"variable",begin:"\\$"+r},o={className:"string", -contains:[e.BACKSLASH_ESCAPE,a,i],variants:[{begin:/\w*"""/,end:/"""\w*/, -relevance:10},{begin:/\w*"/,end:/"\w*/}]},s={className:"string", -contains:[e.BACKSLASH_ESCAPE,a,i],begin:"`",end:"`"},l={className:"meta", -begin:"@"+r};return n.name="Julia",n.contains=[{className:"number", -begin:/(\b0x[\d_]*(\.[\d_]*)?|0x\.\d[\d_]*)p[-+]?\d+|\b0[box][a-fA-F0-9][a-fA-F0-9_]*|(\b\d[\d_]*(\.[\d_]*)?|\.\d[\d_]*)([eEfF][-+]?\d+)?/, -relevance:0},{className:"string",begin:/'(.|\\[xXuU][a-zA-Z0-9]+)'/},o,s,l,{ -className:"comment",variants:[{begin:"#=",end:"=#",relevance:10},{begin:"#", -end:"$"}]},e.HASH_COMMENT_MODE,{className:"keyword", -begin:"\\b(((abstract|primitive)\\s+)type|(mutable\\s+)?struct)\\b"},{begin:/<:/ -}],a.contains=n.contains,n}})();hljs.registerLanguage("julia",e)})();/*! `kotlin` grammar compiled for Highlight.js 11.10.0 */ -(()=>{var e=(()=>{"use strict" -;var e="[0-9](_*[0-9])*",n=`\\.(${e})`,a="[0-9a-fA-F](_*[0-9a-fA-F])*",i={ -className:"number",variants:[{ -begin:`(\\b(${e})((${n})|\\.)?|(${n}))[eE][+-]?(${e})[fFdD]?\\b`},{ -begin:`\\b(${e})((${n})[fFdD]?\\b|\\.([fFdD]\\b)?)`},{begin:`(${n})[fFdD]?\\b` -},{begin:`\\b(${e})[fFdD]\\b`},{ -begin:`\\b0[xX]((${a})\\.?|(${a})?\\.(${a}))[pP][+-]?(${e})[fFdD]?\\b`},{ -begin:"\\b(0|[1-9](_*[0-9])*)[lL]?\\b"},{begin:`\\b0[xX](${a})[lL]?\\b`},{ -begin:"\\b0(_*[0-7])*[lL]?\\b"},{begin:"\\b0[bB][01](_*[01])*[lL]?\\b"}], -relevance:0};return e=>{const n={ -keyword:"abstract as val var vararg get set class object open private protected public noinline crossinline dynamic final enum if else do while for when throw try catch finally import package is in fun override companion reified inline lateinit init interface annotation data sealed internal infix operator out by constructor super tailrec where const inner suspend typealias external expect actual", -built_in:"Byte Short Char Int Long Boolean Float Double Void Unit Nothing", -literal:"true false null"},a={className:"symbol",begin:e.UNDERSCORE_IDENT_RE+"@" -},s={className:"subst",begin:/\$\{/,end:/\}/,contains:[e.C_NUMBER_MODE]},t={ -className:"variable",begin:"\\$"+e.UNDERSCORE_IDENT_RE},r={className:"string", -variants:[{begin:'"""',end:'"""(?=[^"])',contains:[t,s]},{begin:"'",end:"'", -illegal:/\n/,contains:[e.BACKSLASH_ESCAPE]},{begin:'"',end:'"',illegal:/\n/, -contains:[e.BACKSLASH_ESCAPE,t,s]}]};s.contains.push(r);const l={ -className:"meta", -begin:"@(?:file|property|field|get|set|receiver|param|setparam|delegate)\\s*:(?:\\s*"+e.UNDERSCORE_IDENT_RE+")?" -},c={className:"meta",begin:"@"+e.UNDERSCORE_IDENT_RE,contains:[{begin:/\(/, -end:/\)/,contains:[e.inherit(r,{className:"string"}),"self"]}] -},o=i,b=e.COMMENT("/\\*","\\*/",{contains:[e.C_BLOCK_COMMENT_MODE]}),E={ -variants:[{className:"type",begin:e.UNDERSCORE_IDENT_RE},{begin:/\(/,end:/\)/, -contains:[]}]},d=E;return d.variants[1].contains=[E],E.variants[1].contains=[d], -{name:"Kotlin",aliases:["kt","kts"],keywords:n, -contains:[e.COMMENT("/\\*\\*","\\*/",{relevance:0,contains:[{className:"doctag", -begin:"@[A-Za-z]+"}]}),e.C_LINE_COMMENT_MODE,b,{className:"keyword", -begin:/\b(break|continue|return|this)\b/,starts:{contains:[{className:"symbol", -begin:/@\w+/}]}},a,l,c,{className:"function",beginKeywords:"fun",end:"[(]|$", -returnBegin:!0,excludeEnd:!0,keywords:n,relevance:5,contains:[{ -begin:e.UNDERSCORE_IDENT_RE+"\\s*\\(",returnBegin:!0,relevance:0, -contains:[e.UNDERSCORE_TITLE_MODE]},{className:"type",begin://, -keywords:"reified",relevance:0},{className:"params",begin:/\(/,end:/\)/, -endsParent:!0,keywords:n,relevance:0,contains:[{begin:/:/,end:/[=,\/]/, -endsWithParent:!0,contains:[E,e.C_LINE_COMMENT_MODE,b],relevance:0 -},e.C_LINE_COMMENT_MODE,b,l,c,r,e.C_NUMBER_MODE]},b]},{ -begin:[/class|interface|trait/,/\s+/,e.UNDERSCORE_IDENT_RE],beginScope:{ -3:"title.class"},keywords:"class interface trait",end:/[:\{(]|$/,excludeEnd:!0, -illegal:"extends implements",contains:[{ -beginKeywords:"public protected internal private constructor" -},e.UNDERSCORE_TITLE_MODE,{className:"type",begin://,excludeBegin:!0, -excludeEnd:!0,relevance:0},{className:"type",begin:/[,:]\s*/,end:/[<\(,){\s]|$/, -excludeBegin:!0,returnEnd:!0},l,c]},r,{className:"meta",begin:"^#!/usr/bin/env", -end:"$",illegal:"\n"},o]}}})();hljs.registerLanguage("kotlin",e)})();/*! `latex` grammar compiled for Highlight.js 11.10.0 */ -(()=>{var e=(()=>{"use strict";return e=>{const n=[{begin:/\^{6}[0-9a-f]{6}/},{ -begin:/\^{5}[0-9a-f]{5}/},{begin:/\^{4}[0-9a-f]{4}/},{begin:/\^{3}[0-9a-f]{3}/ -},{begin:/\^{2}[0-9a-f]{2}/},{begin:/\^{2}[\u0000-\u007f]/}],a=[{ -className:"keyword",begin:/\\/,relevance:0,contains:[{endsParent:!0, -begin:e.regex.either(...["(?:NeedsTeXFormat|RequirePackage|GetIdInfo)","Provides(?:Expl)?(?:Package|Class|File)","(?:DeclareOption|ProcessOptions)","(?:documentclass|usepackage|input|include)","makeat(?:letter|other)","ExplSyntax(?:On|Off)","(?:new|renew|provide)?command","(?:re)newenvironment","(?:New|Renew|Provide|Declare)(?:Expandable)?DocumentCommand","(?:New|Renew|Provide|Declare)DocumentEnvironment","(?:(?:e|g|x)?def|let)","(?:begin|end)","(?:part|chapter|(?:sub){0,2}section|(?:sub)?paragraph)","caption","(?:label|(?:eq|page|name)?ref|(?:paren|foot|super)?cite)","(?:alpha|beta|[Gg]amma|[Dd]elta|(?:var)?epsilon|zeta|eta|[Tt]heta|vartheta)","(?:iota|(?:var)?kappa|[Ll]ambda|mu|nu|[Xx]i|[Pp]i|varpi|(?:var)rho)","(?:[Ss]igma|varsigma|tau|[Uu]psilon|[Pp]hi|varphi|chi|[Pp]si|[Oo]mega)","(?:frac|sum|prod|lim|infty|times|sqrt|leq|geq|left|right|middle|[bB]igg?)","(?:[lr]angle|q?quad|[lcvdi]?dots|d?dot|hat|tilde|bar)"].map((e=>e+"(?![a-zA-Z@:_])"))) -},{endsParent:!0, -begin:RegExp(["(?:__)?[a-zA-Z]{2,}_[a-zA-Z](?:_?[a-zA-Z])+:[a-zA-Z]*","[lgc]__?[a-zA-Z](?:_?[a-zA-Z])*_[a-zA-Z]{2,}","[qs]__?[a-zA-Z](?:_?[a-zA-Z])+","use(?:_i)?:[a-zA-Z]*","(?:else|fi|or):","(?:if|cs|exp):w","(?:hbox|vbox):n","::[a-zA-Z]_unbraced","::[a-zA-Z:]"].map((e=>e+"(?![a-zA-Z:_])")).join("|")) -},{endsParent:!0,variants:n},{endsParent:!0,relevance:0,variants:[{ -begin:/[a-zA-Z@]+/},{begin:/[^a-zA-Z@]?/}]}]},{className:"params",relevance:0, -begin:/#+\d?/},{variants:n},{className:"built_in",relevance:0,begin:/[$&^_]/},{ -className:"meta",begin:/% ?!(T[eE]X|tex|BIB|bib)/,end:"$",relevance:10 -},e.COMMENT("%","$",{relevance:0})],i={begin:/\{/,end:/\}/,relevance:0, -contains:["self",...a]},t=e.inherit(i,{relevance:0,endsParent:!0, -contains:[i,...a]}),r={begin:/\[/,end:/\]/,endsParent:!0,relevance:0, -contains:[i,...a]},s={begin:/\s+/,relevance:0},c=[t],l=[r],o=(e,n)=>({ -contains:[s],starts:{relevance:0,contains:e,starts:n}}),d=(e,n)=>({ -begin:"\\\\"+e+"(?![a-zA-Z@:_])",keywords:{$pattern:/\\[a-zA-Z]+/,keyword:"\\"+e -},relevance:0,contains:[s],starts:n}),g=(n,a)=>e.inherit({ -begin:"\\\\begin(?=[ \t]*(\\r?\\n[ \t]*)?\\{"+n+"\\})",keywords:{ -$pattern:/\\[a-zA-Z]+/,keyword:"\\begin"},relevance:0 -},o(c,a)),m=(n="string")=>e.END_SAME_AS_BEGIN({className:n,begin:/(.|\r?\n)/, -end:/(.|\r?\n)/,excludeBegin:!0,excludeEnd:!0,endsParent:!0}),b=e=>({ -className:"string",end:"(?=\\\\end\\{"+e+"\\})"}),p=(e="string")=>({relevance:0, -begin:/\{/,starts:{endsParent:!0,contains:[{className:e,end:/(?=\})/, -endsParent:!0,contains:[{begin:/\{/,end:/\}/,relevance:0,contains:["self"]}]}]} -});return{name:"LaTeX",aliases:["tex"], -contains:[...["verb","lstinline"].map((e=>d(e,{contains:[m()]}))),d("mint",o(c,{ -contains:[m()]})),d("mintinline",o(c,{contains:[p(),m()]})),d("url",{ -contains:[p("link"),p("link")]}),d("hyperref",{contains:[p("link")] -}),d("href",o(l,{contains:[p("link")] -})),...[].concat(...["","\\*"].map((e=>[g("verbatim"+e,b("verbatim"+e)),g("filecontents"+e,o(c,b("filecontents"+e))),...["","B","L"].map((n=>g(n+"Verbatim"+e,o(l,b(n+"Verbatim"+e)))))]))),g("minted",o(l,o(c,b("minted")))),...a] -}}})();hljs.registerLanguage("latex",e)})();/*! `less` grammar compiled for Highlight.js 11.10.0 */ -(()=>{var e=(()=>{"use strict" -;const e=["a","abbr","address","article","aside","audio","b","blockquote","body","button","canvas","caption","cite","code","dd","del","details","dfn","div","dl","dt","em","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hgroup","html","i","iframe","img","input","ins","kbd","label","legend","li","main","mark","menu","nav","object","ol","optgroup","option","p","picture","q","quote","samp","section","select","source","span","strong","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","tr","ul","var","video","defs","g","marker","mask","pattern","svg","switch","symbol","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feFlood","feGaussianBlur","feImage","feMerge","feMorphology","feOffset","feSpecularLighting","feTile","feTurbulence","linearGradient","radialGradient","stop","circle","ellipse","image","line","path","polygon","polyline","rect","text","use","textPath","tspan","foreignObject","clipPath"],t=["any-hover","any-pointer","aspect-ratio","color","color-gamut","color-index","device-aspect-ratio","device-height","device-width","display-mode","forced-colors","grid","height","hover","inverted-colors","monochrome","orientation","overflow-block","overflow-inline","pointer","prefers-color-scheme","prefers-contrast","prefers-reduced-motion","prefers-reduced-transparency","resolution","scan","scripting","update","width","min-width","max-width","min-height","max-height"].sort().reverse(),r=["active","any-link","blank","checked","current","default","defined","dir","disabled","drop","empty","enabled","first","first-child","first-of-type","fullscreen","future","focus","focus-visible","focus-within","has","host","host-context","hover","indeterminate","in-range","invalid","is","lang","last-child","last-of-type","left","link","local-link","not","nth-child","nth-col","nth-last-child","nth-last-col","nth-last-of-type","nth-of-type","only-child","only-of-type","optional","out-of-range","past","placeholder-shown","read-only","read-write","required","right","root","scope","target","target-within","user-invalid","valid","visited","where"].sort().reverse(),i=["after","backdrop","before","cue","cue-region","first-letter","first-line","grammar-error","marker","part","placeholder","selection","slotted","spelling-error"].sort().reverse(),o=["accent-color","align-content","align-items","align-self","alignment-baseline","all","animation","animation-delay","animation-direction","animation-duration","animation-fill-mode","animation-iteration-count","animation-name","animation-play-state","animation-timing-function","appearance","backface-visibility","background","background-attachment","background-blend-mode","background-clip","background-color","background-image","background-origin","background-position","background-repeat","background-size","baseline-shift","block-size","border","border-block","border-block-color","border-block-end","border-block-end-color","border-block-end-style","border-block-end-width","border-block-start","border-block-start-color","border-block-start-style","border-block-start-width","border-block-style","border-block-width","border-bottom","border-bottom-color","border-bottom-left-radius","border-bottom-right-radius","border-bottom-style","border-bottom-width","border-collapse","border-color","border-image","border-image-outset","border-image-repeat","border-image-slice","border-image-source","border-image-width","border-inline","border-inline-color","border-inline-end","border-inline-end-color","border-inline-end-style","border-inline-end-width","border-inline-start","border-inline-start-color","border-inline-start-style","border-inline-start-width","border-inline-style","border-inline-width","border-left","border-left-color","border-left-style","border-left-width","border-radius","border-right","border-end-end-radius","border-end-start-radius","border-right-color","border-right-style","border-right-width","border-spacing","border-start-end-radius","border-start-start-radius","border-style","border-top","border-top-color","border-top-left-radius","border-top-right-radius","border-top-style","border-top-width","border-width","bottom","box-decoration-break","box-shadow","box-sizing","break-after","break-before","break-inside","cx","cy","caption-side","caret-color","clear","clip","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","color-scheme","column-count","column-fill","column-gap","column-rule","column-rule-color","column-rule-style","column-rule-width","column-span","column-width","columns","contain","content","content-visibility","counter-increment","counter-reset","cue","cue-after","cue-before","cursor","direction","display","dominant-baseline","empty-cells","enable-background","fill","fill-opacity","fill-rule","filter","flex","flex-basis","flex-direction","flex-flow","flex-grow","flex-shrink","flex-wrap","float","flow","flood-color","flood-opacity","font","font-display","font-family","font-feature-settings","font-kerning","font-language-override","font-size","font-size-adjust","font-smoothing","font-stretch","font-style","font-synthesis","font-variant","font-variant-caps","font-variant-east-asian","font-variant-ligatures","font-variant-numeric","font-variant-position","font-variation-settings","font-weight","gap","glyph-orientation-horizontal","glyph-orientation-vertical","grid","grid-area","grid-auto-columns","grid-auto-flow","grid-auto-rows","grid-column","grid-column-end","grid-column-start","grid-gap","grid-row","grid-row-end","grid-row-start","grid-template","grid-template-areas","grid-template-columns","grid-template-rows","hanging-punctuation","height","hyphens","icon","image-orientation","image-rendering","image-resolution","ime-mode","inline-size","inset","inset-block","inset-block-end","inset-block-start","inset-inline","inset-inline-end","inset-inline-start","isolation","kerning","justify-content","justify-items","justify-self","left","letter-spacing","lighting-color","line-break","line-height","list-style","list-style-image","list-style-position","list-style-type","marker","marker-end","marker-mid","marker-start","mask","margin","margin-block","margin-block-end","margin-block-start","margin-bottom","margin-inline","margin-inline-end","margin-inline-start","margin-left","margin-right","margin-top","marks","mask","mask-border","mask-border-mode","mask-border-outset","mask-border-repeat","mask-border-slice","mask-border-source","mask-border-width","mask-clip","mask-composite","mask-image","mask-mode","mask-origin","mask-position","mask-repeat","mask-size","mask-type","max-block-size","max-height","max-inline-size","max-width","min-block-size","min-height","min-inline-size","min-width","mix-blend-mode","nav-down","nav-index","nav-left","nav-right","nav-up","none","normal","object-fit","object-position","opacity","order","orphans","outline","outline-color","outline-offset","outline-style","outline-width","overflow","overflow-wrap","overflow-x","overflow-y","padding","padding-block","padding-block-end","padding-block-start","padding-bottom","padding-inline","padding-inline-end","padding-inline-start","padding-left","padding-right","padding-top","page-break-after","page-break-before","page-break-inside","pause","pause-after","pause-before","perspective","perspective-origin","pointer-events","position","quotes","r","resize","rest","rest-after","rest-before","right","rotate","row-gap","scale","scroll-margin","scroll-margin-block","scroll-margin-block-end","scroll-margin-block-start","scroll-margin-bottom","scroll-margin-inline","scroll-margin-inline-end","scroll-margin-inline-start","scroll-margin-left","scroll-margin-right","scroll-margin-top","scroll-padding","scroll-padding-block","scroll-padding-block-end","scroll-padding-block-start","scroll-padding-bottom","scroll-padding-inline","scroll-padding-inline-end","scroll-padding-inline-start","scroll-padding-left","scroll-padding-right","scroll-padding-top","scroll-snap-align","scroll-snap-stop","scroll-snap-type","scrollbar-color","scrollbar-gutter","scrollbar-width","shape-image-threshold","shape-margin","shape-outside","shape-rendering","stop-color","stop-opacity","stroke","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","speak","speak-as","src","tab-size","table-layout","text-anchor","text-align","text-align-all","text-align-last","text-combine-upright","text-decoration","text-decoration-color","text-decoration-line","text-decoration-skip-ink","text-decoration-style","text-decoration-thickness","text-emphasis","text-emphasis-color","text-emphasis-position","text-emphasis-style","text-indent","text-justify","text-orientation","text-overflow","text-rendering","text-shadow","text-transform","text-underline-offset","text-underline-position","top","transform","transform-box","transform-origin","transform-style","transition","transition-delay","transition-duration","transition-property","transition-timing-function","translate","unicode-bidi","vector-effect","vertical-align","visibility","voice-balance","voice-duration","voice-family","voice-pitch","voice-range","voice-rate","voice-stress","voice-volume","white-space","widows","width","will-change","word-break","word-spacing","word-wrap","writing-mode","x","y","z-index"].sort().reverse(),n=r.concat(i).sort().reverse() -;return a=>{const l=(e=>({IMPORTANT:{scope:"meta",begin:"!important"}, -BLOCK_COMMENT:e.C_BLOCK_COMMENT_MODE,HEXCOLOR:{scope:"number", -begin:/#(([0-9a-fA-F]{3,4})|(([0-9a-fA-F]{2}){3,4}))\b/},FUNCTION_DISPATCH:{ -className:"built_in",begin:/[\w-]+(?=\()/},ATTRIBUTE_SELECTOR_MODE:{ -scope:"selector-attr",begin:/\[/,end:/\]/,illegal:"$", -contains:[e.APOS_STRING_MODE,e.QUOTE_STRING_MODE]},CSS_NUMBER_MODE:{ -scope:"number", -begin:e.NUMBER_RE+"(%|em|ex|ch|rem|vw|vh|vmin|vmax|cm|mm|in|pt|pc|px|deg|grad|rad|turn|s|ms|Hz|kHz|dpi|dpcm|dppx)?", -relevance:0},CSS_VARIABLE:{className:"attr",begin:/--[A-Za-z_][A-Za-z0-9_-]*/} -}))(a),s=n,d="[\\w-]+",c="("+d+"|@\\{"+d+"\\})",g=[],b=[],m=e=>({ -className:"string",begin:"~?"+e+".*?"+e}),p=(e,t,r)=>({className:e,begin:t, -relevance:r}),f={$pattern:/[a-z-]+/,keyword:"and or not only", -attribute:t.join(" ")},u={begin:"\\(",end:"\\)",contains:b,keywords:f, -relevance:0} -;b.push(a.C_LINE_COMMENT_MODE,a.C_BLOCK_COMMENT_MODE,m("'"),m('"'),l.CSS_NUMBER_MODE,{ -begin:"(url|data-uri)\\(",starts:{className:"string",end:"[\\)\\n]", -excludeEnd:!0} -},l.HEXCOLOR,u,p("variable","@@?"+d,10),p("variable","@\\{"+d+"\\}"),p("built_in","~?`[^`]*?`"),{ -className:"attribute",begin:d+"\\s*:",end:":",returnBegin:!0,excludeEnd:!0 -},l.IMPORTANT,{beginKeywords:"and not"},l.FUNCTION_DISPATCH);const h=b.concat({ -begin:/\{/,end:/\}/,contains:g}),k={beginKeywords:"when",endsWithParent:!0, -contains:[{beginKeywords:"and not"}].concat(b)},v={begin:c+"\\s*:", -returnBegin:!0,end:/[;}]/,relevance:0,contains:[{begin:/-(webkit|moz|ms|o)-/ -},l.CSS_VARIABLE,{className:"attribute",begin:"\\b("+o.join("|")+")\\b", -end:/(?=:)/,starts:{endsWithParent:!0,illegal:"[<=$]",relevance:0,contains:b}}] -},y={className:"keyword", -begin:"@(import|media|charset|font-face|(-[a-z]+-)?keyframes|supports|document|namespace|page|viewport|host)\\b", -starts:{end:"[;{}]",keywords:f,returnEnd:!0,contains:b,relevance:0}},w={ -className:"variable",variants:[{begin:"@"+d+"\\s*:",relevance:15},{begin:"@"+d -}],starts:{end:"[;}]",returnEnd:!0,contains:h}},x={variants:[{ -begin:"[\\.#:&\\[>]",end:"[;{}]"},{begin:c,end:/\{/}],returnBegin:!0, -returnEnd:!0,illegal:"[<='$\"]",relevance:0, -contains:[a.C_LINE_COMMENT_MODE,a.C_BLOCK_COMMENT_MODE,k,p("keyword","all\\b"),p("variable","@\\{"+d+"\\}"),{ -begin:"\\b("+e.join("|")+")\\b",className:"selector-tag" -},l.CSS_NUMBER_MODE,p("selector-tag",c,0),p("selector-id","#"+c),p("selector-class","\\."+c,0),p("selector-tag","&",0),l.ATTRIBUTE_SELECTOR_MODE,{ -className:"selector-pseudo",begin:":("+r.join("|")+")"},{ -className:"selector-pseudo",begin:":(:)?("+i.join("|")+")"},{begin:/\(/, -end:/\)/,relevance:0,contains:h},{begin:"!important"},l.FUNCTION_DISPATCH]},_={ -begin:d+":(:)?"+`(${s.join("|")})`,returnBegin:!0,contains:[x]} -;return g.push(a.C_LINE_COMMENT_MODE,a.C_BLOCK_COMMENT_MODE,y,w,_,v,x,k,l.FUNCTION_DISPATCH), -{name:"Less",case_insensitive:!0,illegal:"[=>'/<($\"]",contains:g}}})() -;hljs.registerLanguage("less",e)})();/*! `lisp` grammar compiled for Highlight.js 11.10.0 */ -(()=>{var e=(()=>{"use strict";return e=>{ -const n="[a-zA-Z_\\-+\\*\\/<=>&#][a-zA-Z0-9_\\-+*\\/<=>&#!]*",a="\\|[^]*?\\|",i="(-|\\+)?\\d+(\\.\\d+|\\/\\d+)?((d|e|f|l|s|D|E|F|L|S)(\\+|-)?\\d+)?",s={ -className:"literal",begin:"\\b(t{1}|nil)\\b"},l={className:"number",variants:[{ -begin:i,relevance:0},{begin:"#(b|B)[0-1]+(/[0-1]+)?"},{ -begin:"#(o|O)[0-7]+(/[0-7]+)?"},{begin:"#(x|X)[0-9a-fA-F]+(/[0-9a-fA-F]+)?"},{ -begin:"#(c|C)\\("+i+" +"+i,end:"\\)"}]},b=e.inherit(e.QUOTE_STRING_MODE,{ -illegal:null}),g=e.COMMENT(";","$",{relevance:0}),r={begin:"\\*",end:"\\*"},t={ -className:"symbol",begin:"[:&]"+n},c={begin:n,relevance:0},d={begin:a},o={ -contains:[l,b,r,t,{begin:"\\(",end:"\\)",contains:["self",s,b,l,c]},c], -variants:[{begin:"['`]\\(",end:"\\)"},{begin:"\\(quote ",end:"\\)",keywords:{ -name:"quote"}},{begin:"'"+a}]},v={variants:[{begin:"'"+n},{ -begin:"#'"+n+"(::"+n+")*"}]},m={begin:"\\(\\s*",end:"\\)"},u={endsWithParent:!0, -relevance:0};return m.contains=[{className:"name",variants:[{begin:n,relevance:0 -},{begin:a}]},u],u.contains=[o,v,m,s,l,b,g,r,t,d,c],{name:"Lisp",illegal:/\S/, -contains:[l,e.SHEBANG(),s,b,g,o,v,m,c]}}})();hljs.registerLanguage("lisp",e) -})();/*! `lua` grammar compiled for Highlight.js 11.10.0 */ -(()=>{var e=(()=>{"use strict";return e=>{const t="\\[=*\\[",a="\\]=*\\]",n={ -begin:t,end:a,contains:["self"] -},o=[e.COMMENT("--(?!"+t+")","$"),e.COMMENT("--"+t,a,{contains:[n],relevance:10 -})];return{name:"Lua",keywords:{$pattern:e.UNDERSCORE_IDENT_RE, -literal:"true false nil", -keyword:"and break do else elseif end for goto if in local not or repeat return then until while", -built_in:"_G _ENV _VERSION __index __newindex __mode __call __metatable __tostring __len __gc __add __sub __mul __div __mod __pow __concat __unm __eq __lt __le assert collectgarbage dofile error getfenv getmetatable ipairs load loadfile loadstring module next pairs pcall print rawequal rawget rawset require select setfenv setmetatable tonumber tostring type unpack xpcall arg self coroutine resume yield status wrap create running debug getupvalue debug sethook getmetatable gethook setmetatable setlocal traceback setfenv getinfo setupvalue getlocal getregistry getfenv io lines write close flush open output type read stderr stdin input stdout popen tmpfile math log max acos huge ldexp pi cos tanh pow deg tan cosh sinh random randomseed frexp ceil floor rad abs sqrt modf asin min mod fmod log10 atan2 exp sin atan os exit setlocale date getenv difftime remove time clock tmpname rename execute package preload loadlib loaded loaders cpath config path seeall string sub upper len gfind rep find match char dump gmatch reverse byte format gsub lower table setn insert getn foreachi maxn foreach concat sort remove" -},contains:o.concat([{className:"function",beginKeywords:"function",end:"\\)", -contains:[e.inherit(e.TITLE_MODE,{ -begin:"([_a-zA-Z]\\w*\\.)*([_a-zA-Z]\\w*:)?[_a-zA-Z]\\w*"}),{className:"params", -begin:"\\(",endsWithParent:!0,contains:o}].concat(o) -},e.C_NUMBER_MODE,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,{className:"string", -begin:t,end:a,contains:[n],relevance:5}])}}})();hljs.registerLanguage("lua",e) -})();/*! `makefile` grammar compiled for Highlight.js 11.10.0 */ -(()=>{var e=(()=>{"use strict";return e=>{const i={className:"variable", -variants:[{begin:"\\$\\("+e.UNDERSCORE_IDENT_RE+"\\)", -contains:[e.BACKSLASH_ESCAPE]},{begin:/\$[@%{var e=(()=>{"use strict";return e=>{const n={begin:/<\/?[A-Za-z_]/, -end:">",subLanguage:"xml",relevance:0},a={variants:[{begin:/\[.+?\]\[.*?\]/, -relevance:0},{ -begin:/\[.+?\]\(((data|javascript|mailto):|(?:http|ftp)s?:\/\/).*?\)/, -relevance:2},{ -begin:e.regex.concat(/\[.+?\]\(/,/[A-Za-z][A-Za-z0-9+.-]*/,/:\/\/.*?\)/), -relevance:2},{begin:/\[.+?\]\([./?&#].*?\)/,relevance:1},{ -begin:/\[.*?\]\(.*?\)/,relevance:0}],returnBegin:!0,contains:[{match:/\[(?=\])/ -},{className:"string",relevance:0,begin:"\\[",end:"\\]",excludeBegin:!0, -returnEnd:!0},{className:"link",relevance:0,begin:"\\]\\(",end:"\\)", -excludeBegin:!0,excludeEnd:!0},{className:"symbol",relevance:0,begin:"\\]\\[", -end:"\\]",excludeBegin:!0,excludeEnd:!0}]},i={className:"strong",contains:[], -variants:[{begin:/_{2}(?!\s)/,end:/_{2}/},{begin:/\*{2}(?!\s)/,end:/\*{2}/}] -},s={className:"emphasis",contains:[],variants:[{begin:/\*(?![*\s])/,end:/\*/},{ -begin:/_(?![_\s])/,end:/_/,relevance:0}]},c=e.inherit(i,{contains:[] -}),t=e.inherit(s,{contains:[]});i.contains.push(t),s.contains.push(c) -;let g=[n,a];return[i,s,c,t].forEach((e=>{e.contains=e.contains.concat(g) -})),g=g.concat(i,s),{name:"Markdown",aliases:["md","mkdown","mkd"],contains:[{ -className:"section",variants:[{begin:"^#{1,6}",end:"$",contains:g},{ -begin:"(?=^.+?\\n[=-]{2,}$)",contains:[{begin:"^[=-]*$"},{begin:"^",end:"\\n", -contains:g}]}]},n,{className:"bullet",begin:"^[ \t]*([*+-]|(\\d+\\.))(?=\\s+)", -end:"\\s+",excludeEnd:!0},i,s,{className:"quote",begin:"^>\\s+",contains:g, -end:"$"},{className:"code",variants:[{begin:"(`{3,})[^`](.|\\n)*?\\1`*[ ]*"},{ -begin:"(~{3,})[^~](.|\\n)*?\\1~*[ ]*"},{begin:"```",end:"```+[ ]*$"},{ -begin:"~~~",end:"~~~+[ ]*$"},{begin:"`.+?`"},{begin:"(?=^( {4}|\\t))", -contains:[{begin:"^( {4}|\\t)",end:"(\\n)$"}],relevance:0}]},{ -begin:"^[-\\*]{3,}",end:"$"},a,{begin:/^\[[^\n]+\]:/,returnBegin:!0,contains:[{ -className:"symbol",begin:/\[/,end:/\]/,excludeBegin:!0,excludeEnd:!0},{ -className:"link",begin:/:\s*/,end:/$/,excludeBegin:!0}]},{scope:"literal", -match:/&([a-zA-Z0-9]+|#[0-9]{1,7}|#[Xx][0-9a-fA-F]{1,6});/}]}}})() -;hljs.registerLanguage("markdown",e)})();/*! `matlab` grammar compiled for Highlight.js 11.10.0 */ -(()=>{var e=(()=>{"use strict";return e=>{const a="('|\\.')+",s={relevance:0, -contains:[{begin:a}]};return{name:"Matlab",keywords:{ -keyword:"arguments break case catch classdef continue else elseif end enumeration events for function global if methods otherwise parfor persistent properties return spmd switch try while", -built_in:"sin sind sinh asin asind asinh cos cosd cosh acos acosd acosh tan tand tanh atan atand atan2 atanh sec secd sech asec asecd asech csc cscd csch acsc acscd acsch cot cotd coth acot acotd acoth hypot exp expm1 log log1p log10 log2 pow2 realpow reallog realsqrt sqrt nthroot nextpow2 abs angle complex conj imag real unwrap isreal cplxpair fix floor ceil round mod rem sign airy besselj bessely besselh besseli besselk beta betainc betaln ellipj ellipke erf erfc erfcx erfinv expint gamma gammainc gammaln psi legendre cross dot factor isprime primes gcd lcm rat rats perms nchoosek factorial cart2sph cart2pol pol2cart sph2cart hsv2rgb rgb2hsv zeros ones eye repmat rand randn linspace logspace freqspace meshgrid accumarray size length ndims numel disp isempty isequal isequalwithequalnans cat reshape diag blkdiag tril triu fliplr flipud flipdim rot90 find sub2ind ind2sub bsxfun ndgrid permute ipermute shiftdim circshift squeeze isscalar isvector ans eps realmax realmin pi i|0 inf nan isnan isinf isfinite j|0 why compan gallery hadamard hankel hilb invhilb magic pascal rosser toeplitz vander wilkinson max min nanmax nanmin mean nanmean type table readtable writetable sortrows sort figure plot plot3 scatter scatter3 cellfun legend intersect ismember procrustes hold num2cell " -},illegal:'(//|"|#|/\\*|\\s+/\\w+)',contains:[{className:"function", -beginKeywords:"function",end:"$",contains:[e.UNDERSCORE_TITLE_MODE,{ -className:"params",variants:[{begin:"\\(",end:"\\)"},{begin:"\\[",end:"\\]"}]}] -},{className:"built_in",begin:/true|false/,relevance:0,starts:s},{ -begin:"[a-zA-Z][a-zA-Z_0-9]*"+a,relevance:0},{className:"number", -begin:e.C_NUMBER_RE,relevance:0,starts:s},{className:"string",begin:"'",end:"'", -contains:[{begin:"''"}]},{begin:/\]|\}|\)/,relevance:0,starts:s},{ -className:"string",begin:'"',end:'"',contains:[{begin:'""'}],starts:s -},e.COMMENT("^\\s*%\\{\\s*$","^\\s*%\\}\\s*$"),e.COMMENT("%","$")]}}})() -;hljs.registerLanguage("matlab",e)})();/*! `nginx` grammar compiled for Highlight.js 11.10.0 */ -(()=>{var e=(()=>{"use strict";return e=>{const n=e.regex,a={ -className:"variable",variants:[{begin:/\$\d+/},{begin:/\$\{\w+\}/},{ -begin:n.concat(/[$@]/,e.UNDERSCORE_IDENT_RE)}]},s={endsWithParent:!0,keywords:{ -$pattern:/[a-z_]{2,}|\/dev\/poll/, -literal:["on","off","yes","no","true","false","none","blocked","debug","info","notice","warn","error","crit","select","break","last","permanent","redirect","kqueue","rtsig","epoll","poll","/dev/poll"] -},relevance:0,illegal:"=>",contains:[e.HASH_COMMENT_MODE,{className:"string", -contains:[e.BACKSLASH_ESCAPE,a],variants:[{begin:/"/,end:/"/},{begin:/'/,end:/'/ -}]},{begin:"([a-z]+):/",end:"\\s",endsWithParent:!0,excludeEnd:!0,contains:[a] -},{className:"regexp",contains:[e.BACKSLASH_ESCAPE,a],variants:[{begin:"\\s\\^", -end:"\\s|\\{|;",returnEnd:!0},{begin:"~\\*?\\s+",end:"\\s|\\{|;",returnEnd:!0},{ -begin:"\\*(\\.[a-z\\-]+)+"},{begin:"([a-z\\-]+\\.)+\\*"}]},{className:"number", -begin:"\\b\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}(:\\d{1,5})?\\b"},{ -className:"number",begin:"\\b\\d+[kKmMgGdshdwy]?\\b",relevance:0},a]};return{ -name:"Nginx config",aliases:["nginxconf"],contains:[e.HASH_COMMENT_MODE,{ -beginKeywords:"upstream location",end:/;|\{/,contains:s.contains,keywords:{ -section:"upstream location"}},{className:"section", -begin:n.concat(e.UNDERSCORE_IDENT_RE+n.lookahead(/\s+\{/)),relevance:0},{ -begin:n.lookahead(e.UNDERSCORE_IDENT_RE+"\\s"),end:";|\\{",contains:[{ -className:"attribute",begin:e.UNDERSCORE_IDENT_RE,starts:s}],relevance:0}], -illegal:"[^\\s\\}\\{]"}}})();hljs.registerLanguage("nginx",e)})();/*! `nix` grammar compiled for Highlight.js 11.10.0 */ -(()=>{var e=(()=>{"use strict";return e=>{const n={ -keyword:["rec","with","let","in","inherit","assert","if","else","then"], -literal:["true","false","or","and","null"], -built_in:["import","abort","baseNameOf","dirOf","isNull","builtins","map","removeAttrs","throw","toString","derivation"] -},s={className:"subst",begin:/\$\{/,end:/\}/,keywords:n},a={className:"string", -contains:[{className:"char.escape",begin:/''\$/},s],variants:[{begin:"''", -end:"''"},{begin:'"',end:'"'}] -},i=[e.NUMBER_MODE,e.HASH_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,a,{ -begin:/[a-zA-Z0-9-_]+(\s*=)/,returnBegin:!0,relevance:0,contains:[{ -className:"attr",begin:/\S+/,relevance:.2}]}];return s.contains=i,{name:"Nix", -aliases:["nixos"],keywords:n,contains:i}}})();hljs.registerLanguage("nix",e) -})();/*! `objectivec` grammar compiled for Highlight.js 11.10.0 */ -(()=>{var e=(()=>{"use strict";return e=>{const n=/[a-zA-Z@][a-zA-Z0-9_]*/,_={ -$pattern:n,keyword:["@interface","@class","@protocol","@implementation"]} -;return{name:"Objective-C", -aliases:["mm","objc","obj-c","obj-c++","objective-c++"],keywords:{ -"variable.language":["this","super"],$pattern:n, -keyword:["while","export","sizeof","typedef","const","struct","for","union","volatile","static","mutable","if","do","return","goto","enum","else","break","extern","asm","case","default","register","explicit","typename","switch","continue","inline","readonly","assign","readwrite","self","@synchronized","id","typeof","nonatomic","IBOutlet","IBAction","strong","weak","copy","in","out","inout","bycopy","byref","oneway","__strong","__weak","__block","__autoreleasing","@private","@protected","@public","@try","@property","@end","@throw","@catch","@finally","@autoreleasepool","@synthesize","@dynamic","@selector","@optional","@required","@encode","@package","@import","@defs","@compatibility_alias","__bridge","__bridge_transfer","__bridge_retained","__bridge_retain","__covariant","__contravariant","__kindof","_Nonnull","_Nullable","_Null_unspecified","__FUNCTION__","__PRETTY_FUNCTION__","__attribute__","getter","setter","retain","unsafe_unretained","nonnull","nullable","null_unspecified","null_resettable","class","instancetype","NS_DESIGNATED_INITIALIZER","NS_UNAVAILABLE","NS_REQUIRES_SUPER","NS_RETURNS_INNER_POINTER","NS_INLINE","NS_AVAILABLE","NS_DEPRECATED","NS_ENUM","NS_OPTIONS","NS_SWIFT_UNAVAILABLE","NS_ASSUME_NONNULL_BEGIN","NS_ASSUME_NONNULL_END","NS_REFINED_FOR_SWIFT","NS_SWIFT_NAME","NS_SWIFT_NOTHROW","NS_DURING","NS_HANDLER","NS_ENDHANDLER","NS_VALUERETURN","NS_VOIDRETURN"], -literal:["false","true","FALSE","TRUE","nil","YES","NO","NULL"], -built_in:["dispatch_once_t","dispatch_queue_t","dispatch_sync","dispatch_async","dispatch_once"], -type:["int","float","char","unsigned","signed","short","long","double","wchar_t","unichar","void","bool","BOOL","id|0","_Bool"] -},illegal:"/,end:/$/,illegal:"\\n" -},e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},{className:"class", -begin:"("+_.keyword.join("|")+")\\b",end:/(\{|$)/,excludeEnd:!0,keywords:_, -contains:[e.UNDERSCORE_TITLE_MODE]},{begin:"\\."+e.UNDERSCORE_IDENT_RE, -relevance:0}]}}})();hljs.registerLanguage("objectivec",e)})();/*! `ocaml` grammar compiled for Highlight.js 11.10.0 */ -(()=>{var e=(()=>{"use strict";return e=>({name:"OCaml",aliases:["ml"], -keywords:{$pattern:"[a-z_]\\w*!?", -keyword:"and as assert asr begin class constraint do done downto else end exception external for fun function functor if in include inherit! inherit initializer land lazy let lor lsl lsr lxor match method!|10 method mod module mutable new object of open! open or private rec sig struct then to try type val! val virtual when while with parser value", -built_in:"array bool bytes char exn|5 float int int32 int64 list lazy_t|5 nativeint|5 string unit in_channel out_channel ref", -literal:"true false"},illegal:/\/\/|>>/,contains:[{className:"literal", -begin:"\\[(\\|\\|)?\\]|\\(\\)",relevance:0},e.COMMENT("\\(\\*","\\*\\)",{ -contains:["self"]}),{className:"symbol",begin:"'[A-Za-z_](?!')[\\w']*"},{ -className:"type",begin:"`[A-Z][\\w']*"},{className:"type", -begin:"\\b[A-Z][\\w']*",relevance:0},{begin:"[a-z_]\\w*'[\\w']*",relevance:0 -},e.inherit(e.APOS_STRING_MODE,{className:"string",relevance:0 -}),e.inherit(e.QUOTE_STRING_MODE,{illegal:null}),{className:"number", -begin:"\\b(0[xX][a-fA-F0-9_]+[Lln]?|0[oO][0-7_]+[Lln]?|0[bB][01_]+[Lln]?|[0-9][0-9_]*([Lln]|(\\.[0-9_]*)?([eE][-+]?[0-9_]+)?)?)", -relevance:0},{begin:/->/}]})})();hljs.registerLanguage("ocaml",e)})();/*! `perl` grammar compiled for Highlight.js 11.10.0 */ -(()=>{var e=(()=>{"use strict";return e=>{ -const n=e.regex,t=/[dualxmsipngr]{0,12}/,s={$pattern:/[\w.]+/, -keyword:"abs accept alarm and atan2 bind binmode bless break caller chdir chmod chomp chop chown chr chroot class close closedir connect continue cos crypt dbmclose dbmopen defined delete die do dump each else elsif endgrent endhostent endnetent endprotoent endpwent endservent eof eval exec exists exit exp fcntl field fileno flock for foreach fork format formline getc getgrent getgrgid getgrnam gethostbyaddr gethostbyname gethostent getlogin getnetbyaddr getnetbyname getnetent getpeername getpgrp getpriority getprotobyname getprotobynumber getprotoent getpwent getpwnam getpwuid getservbyname getservbyport getservent getsockname getsockopt given glob gmtime goto grep gt hex if index int ioctl join keys kill last lc lcfirst length link listen local localtime log lstat lt ma map method mkdir msgctl msgget msgrcv msgsnd my ne next no not oct open opendir or ord our pack package pipe pop pos print printf prototype push q|0 qq quotemeta qw qx rand read readdir readline readlink readpipe recv redo ref rename require reset return reverse rewinddir rindex rmdir say scalar seek seekdir select semctl semget semop send setgrent sethostent setnetent setpgrp setpriority setprotoent setpwent setservent setsockopt shift shmctl shmget shmread shmwrite shutdown sin sleep socket socketpair sort splice split sprintf sqrt srand stat state study sub substr symlink syscall sysopen sysread sysseek system syswrite tell telldir tie tied time times tr truncate uc ucfirst umask undef unless unlink unpack unshift untie until use utime values vec wait waitpid wantarray warn when while write x|0 xor y|0" -},r={className:"subst",begin:"[$@]\\{",end:"\\}",keywords:s},a={begin:/->\{/, -end:/\}/},i={scope:"attr",match:/\s+:\s*\w+(\s*\(.*?\))?/},c={scope:"variable", -variants:[{begin:/\$\d/},{ -begin:n.concat(/[$%@](?!")(\^\w\b|#\w+(::\w+)*|\{\w+\}|\w+(::\w*)*)/,"(?![A-Za-z])(?![@$%])") -},{begin:/[$%@](?!")[^\s\w{=]|\$=/,relevance:0}],contains:[i]},o={ -className:"number",variants:[{match:/0?\.[0-9][0-9_]+\b/},{ -match:/\bv?(0|[1-9][0-9_]*(\.[0-9_]+)?|[1-9][0-9_]*)\b/},{ -match:/\b0[0-7][0-7_]*\b/},{match:/\b0x[0-9a-fA-F][0-9a-fA-F_]*\b/},{ -match:/\b0b[0-1][0-1_]*\b/}],relevance:0 -},l=[e.BACKSLASH_ESCAPE,r,c],g=[/!/,/\//,/\|/,/\?/,/'/,/"/,/#/],d=(e,s,r="\\1")=>{ -const a="\\1"===r?r:n.concat(r,s) -;return n.concat(n.concat("(?:",e,")"),s,/(?:\\.|[^\\\/])*?/,a,/(?:\\.|[^\\\/])*?/,r,t) -},m=(e,s,r)=>n.concat(n.concat("(?:",e,")"),s,/(?:\\.|[^\\\/])*?/,r,t),p=[c,e.HASH_COMMENT_MODE,e.COMMENT(/^=\w/,/=cut/,{ -endsWithParent:!0}),a,{className:"string",contains:l,variants:[{ -begin:"q[qwxr]?\\s*\\(",end:"\\)",relevance:5},{begin:"q[qwxr]?\\s*\\[", -end:"\\]",relevance:5},{begin:"q[qwxr]?\\s*\\{",end:"\\}",relevance:5},{ -begin:"q[qwxr]?\\s*\\|",end:"\\|",relevance:5},{begin:"q[qwxr]?\\s*<",end:">", -relevance:5},{begin:"qw\\s+q",end:"q",relevance:5},{begin:"'",end:"'", -contains:[e.BACKSLASH_ESCAPE]},{begin:'"',end:'"'},{begin:"`",end:"`", -contains:[e.BACKSLASH_ESCAPE]},{begin:/\{\w+\}/,relevance:0},{ -begin:"-?\\w+\\s*=>",relevance:0}]},o,{ -begin:"(\\/\\/|"+e.RE_STARTERS_RE+"|\\b(split|return|print|reverse|grep)\\b)\\s*", -keywords:"split return print reverse grep",relevance:0, -contains:[e.HASH_COMMENT_MODE,{className:"regexp",variants:[{ -begin:d("s|tr|y",n.either(...g,{capture:!0}))},{begin:d("s|tr|y","\\(","\\)")},{ -begin:d("s|tr|y","\\[","\\]")},{begin:d("s|tr|y","\\{","\\}")}],relevance:2},{ -className:"regexp",variants:[{begin:/(m|qr)\/\//,relevance:0},{ -begin:m("(?:m|qr)?",/\//,/\//)},{begin:m("m|qr",n.either(...g,{capture:!0 -}),/\1/)},{begin:m("m|qr",/\(/,/\)/)},{begin:m("m|qr",/\[/,/\]/)},{ -begin:m("m|qr",/\{/,/\}/)}]}]},{className:"function",beginKeywords:"sub method", -end:"(\\s*\\(.*?\\))?[;{]",excludeEnd:!0,relevance:5,contains:[e.TITLE_MODE,i] -},{className:"class",beginKeywords:"class",end:"[;{]",excludeEnd:!0,relevance:5, -contains:[e.TITLE_MODE,i,o]},{begin:"-\\w\\b",relevance:0},{begin:"^__DATA__$", -end:"^__END__$",subLanguage:"mojolicious",contains:[{begin:"^@@.*",end:"$", -className:"comment"}]}];return r.contains=p,a.contains=p,{name:"Perl", -aliases:["pl","pm"],keywords:s,contains:p}}})();hljs.registerLanguage("perl",e) -})();/*! `pgsql` grammar compiled for Highlight.js 11.10.0 */ -(()=>{var E=(()=>{"use strict";return E=>{ -const T=E.COMMENT("--","$"),N="\\$([a-zA-Z_]?|[a-zA-Z_][a-zA-Z_0-9]*)\\$",A="BIGINT INT8 BIGSERIAL SERIAL8 BIT VARYING VARBIT BOOLEAN BOOL BOX BYTEA CHARACTER CHAR VARCHAR CIDR CIRCLE DATE DOUBLE PRECISION FLOAT8 FLOAT INET INTEGER INT INT4 INTERVAL JSON JSONB LINE LSEG|10 MACADDR MACADDR8 MONEY NUMERIC DEC DECIMAL PATH POINT POLYGON REAL FLOAT4 SMALLINT INT2 SMALLSERIAL|10 SERIAL2|10 SERIAL|10 SERIAL4|10 TEXT TIME ZONE TIMETZ|10 TIMESTAMP TIMESTAMPTZ|10 TSQUERY|10 TSVECTOR|10 TXID_SNAPSHOT|10 UUID XML NATIONAL NCHAR INT4RANGE|10 INT8RANGE|10 NUMRANGE|10 TSRANGE|10 TSTZRANGE|10 DATERANGE|10 ANYELEMENT ANYARRAY ANYNONARRAY ANYENUM ANYRANGE CSTRING INTERNAL RECORD PG_DDL_COMMAND VOID UNKNOWN OPAQUE REFCURSOR NAME OID REGPROC|10 REGPROCEDURE|10 REGOPER|10 REGOPERATOR|10 REGCLASS|10 REGTYPE|10 REGROLE|10 REGNAMESPACE|10 REGCONFIG|10 REGDICTIONARY|10 ",R=A.trim().split(" ").map((E=>E.split("|")[0])).join("|"),I="ARRAY_AGG AVG BIT_AND BIT_OR BOOL_AND BOOL_OR COUNT EVERY JSON_AGG JSONB_AGG JSON_OBJECT_AGG JSONB_OBJECT_AGG MAX MIN MODE STRING_AGG SUM XMLAGG CORR COVAR_POP COVAR_SAMP REGR_AVGX REGR_AVGY REGR_COUNT REGR_INTERCEPT REGR_R2 REGR_SLOPE REGR_SXX REGR_SXY REGR_SYY STDDEV STDDEV_POP STDDEV_SAMP VARIANCE VAR_POP VAR_SAMP PERCENTILE_CONT PERCENTILE_DISC ROW_NUMBER RANK DENSE_RANK PERCENT_RANK CUME_DIST NTILE LAG LEAD FIRST_VALUE LAST_VALUE NTH_VALUE NUM_NONNULLS NUM_NULLS ABS CBRT CEIL CEILING DEGREES DIV EXP FLOOR LN LOG MOD PI POWER RADIANS ROUND SCALE SIGN SQRT TRUNC WIDTH_BUCKET RANDOM SETSEED ACOS ACOSD ASIN ASIND ATAN ATAND ATAN2 ATAN2D COS COSD COT COTD SIN SIND TAN TAND BIT_LENGTH CHAR_LENGTH CHARACTER_LENGTH LOWER OCTET_LENGTH OVERLAY POSITION SUBSTRING TREAT TRIM UPPER ASCII BTRIM CHR CONCAT CONCAT_WS CONVERT CONVERT_FROM CONVERT_TO DECODE ENCODE INITCAP LEFT LENGTH LPAD LTRIM MD5 PARSE_IDENT PG_CLIENT_ENCODING QUOTE_IDENT|10 QUOTE_LITERAL|10 QUOTE_NULLABLE|10 REGEXP_MATCH REGEXP_MATCHES REGEXP_REPLACE REGEXP_SPLIT_TO_ARRAY REGEXP_SPLIT_TO_TABLE REPEAT REPLACE REVERSE RIGHT RPAD RTRIM SPLIT_PART STRPOS SUBSTR TO_ASCII TO_HEX TRANSLATE OCTET_LENGTH GET_BIT GET_BYTE SET_BIT SET_BYTE TO_CHAR TO_DATE TO_NUMBER TO_TIMESTAMP AGE CLOCK_TIMESTAMP|10 DATE_PART DATE_TRUNC ISFINITE JUSTIFY_DAYS JUSTIFY_HOURS JUSTIFY_INTERVAL MAKE_DATE MAKE_INTERVAL|10 MAKE_TIME MAKE_TIMESTAMP|10 MAKE_TIMESTAMPTZ|10 NOW STATEMENT_TIMESTAMP|10 TIMEOFDAY TRANSACTION_TIMESTAMP|10 ENUM_FIRST ENUM_LAST ENUM_RANGE AREA CENTER DIAMETER HEIGHT ISCLOSED ISOPEN NPOINTS PCLOSE POPEN RADIUS WIDTH BOX BOUND_BOX CIRCLE LINE LSEG PATH POLYGON ABBREV BROADCAST HOST HOSTMASK MASKLEN NETMASK NETWORK SET_MASKLEN TEXT INET_SAME_FAMILY INET_MERGE MACADDR8_SET7BIT ARRAY_TO_TSVECTOR GET_CURRENT_TS_CONFIG NUMNODE PLAINTO_TSQUERY PHRASETO_TSQUERY WEBSEARCH_TO_TSQUERY QUERYTREE SETWEIGHT STRIP TO_TSQUERY TO_TSVECTOR JSON_TO_TSVECTOR JSONB_TO_TSVECTOR TS_DELETE TS_FILTER TS_HEADLINE TS_RANK TS_RANK_CD TS_REWRITE TSQUERY_PHRASE TSVECTOR_TO_ARRAY TSVECTOR_UPDATE_TRIGGER TSVECTOR_UPDATE_TRIGGER_COLUMN XMLCOMMENT XMLCONCAT XMLELEMENT XMLFOREST XMLPI XMLROOT XMLEXISTS XML_IS_WELL_FORMED XML_IS_WELL_FORMED_DOCUMENT XML_IS_WELL_FORMED_CONTENT XPATH XPATH_EXISTS XMLTABLE XMLNAMESPACES TABLE_TO_XML TABLE_TO_XMLSCHEMA TABLE_TO_XML_AND_XMLSCHEMA QUERY_TO_XML QUERY_TO_XMLSCHEMA QUERY_TO_XML_AND_XMLSCHEMA CURSOR_TO_XML CURSOR_TO_XMLSCHEMA SCHEMA_TO_XML SCHEMA_TO_XMLSCHEMA SCHEMA_TO_XML_AND_XMLSCHEMA DATABASE_TO_XML DATABASE_TO_XMLSCHEMA DATABASE_TO_XML_AND_XMLSCHEMA XMLATTRIBUTES TO_JSON TO_JSONB ARRAY_TO_JSON ROW_TO_JSON JSON_BUILD_ARRAY JSONB_BUILD_ARRAY JSON_BUILD_OBJECT JSONB_BUILD_OBJECT JSON_OBJECT JSONB_OBJECT JSON_ARRAY_LENGTH JSONB_ARRAY_LENGTH JSON_EACH JSONB_EACH JSON_EACH_TEXT JSONB_EACH_TEXT JSON_EXTRACT_PATH JSONB_EXTRACT_PATH JSON_OBJECT_KEYS JSONB_OBJECT_KEYS JSON_POPULATE_RECORD JSONB_POPULATE_RECORD JSON_POPULATE_RECORDSET JSONB_POPULATE_RECORDSET JSON_ARRAY_ELEMENTS JSONB_ARRAY_ELEMENTS JSON_ARRAY_ELEMENTS_TEXT JSONB_ARRAY_ELEMENTS_TEXT JSON_TYPEOF JSONB_TYPEOF JSON_TO_RECORD JSONB_TO_RECORD JSON_TO_RECORDSET JSONB_TO_RECORDSET JSON_STRIP_NULLS JSONB_STRIP_NULLS JSONB_SET JSONB_INSERT JSONB_PRETTY CURRVAL LASTVAL NEXTVAL SETVAL COALESCE NULLIF GREATEST LEAST ARRAY_APPEND ARRAY_CAT ARRAY_NDIMS ARRAY_DIMS ARRAY_FILL ARRAY_LENGTH ARRAY_LOWER ARRAY_POSITION ARRAY_POSITIONS ARRAY_PREPEND ARRAY_REMOVE ARRAY_REPLACE ARRAY_TO_STRING ARRAY_UPPER CARDINALITY STRING_TO_ARRAY UNNEST ISEMPTY LOWER_INC UPPER_INC LOWER_INF UPPER_INF RANGE_MERGE GENERATE_SERIES GENERATE_SUBSCRIPTS CURRENT_DATABASE CURRENT_QUERY CURRENT_SCHEMA|10 CURRENT_SCHEMAS|10 INET_CLIENT_ADDR INET_CLIENT_PORT INET_SERVER_ADDR INET_SERVER_PORT ROW_SECURITY_ACTIVE FORMAT_TYPE TO_REGCLASS TO_REGPROC TO_REGPROCEDURE TO_REGOPER TO_REGOPERATOR TO_REGTYPE TO_REGNAMESPACE TO_REGROLE COL_DESCRIPTION OBJ_DESCRIPTION SHOBJ_DESCRIPTION TXID_CURRENT TXID_CURRENT_IF_ASSIGNED TXID_CURRENT_SNAPSHOT TXID_SNAPSHOT_XIP TXID_SNAPSHOT_XMAX TXID_SNAPSHOT_XMIN TXID_VISIBLE_IN_SNAPSHOT TXID_STATUS CURRENT_SETTING SET_CONFIG BRIN_SUMMARIZE_NEW_VALUES BRIN_SUMMARIZE_RANGE BRIN_DESUMMARIZE_RANGE GIN_CLEAN_PENDING_LIST SUPPRESS_REDUNDANT_UPDATES_TRIGGER LO_FROM_BYTEA LO_PUT LO_GET LO_CREAT LO_CREATE LO_UNLINK LO_IMPORT LO_EXPORT LOREAD LOWRITE GROUPING CAST".split(" ").map((E=>E.split("|")[0])).join("|") -;return{name:"PostgreSQL",aliases:["postgres","postgresql"],supersetOf:"sql", -case_insensitive:!0,keywords:{ -keyword:"ABORT ALTER ANALYZE BEGIN CALL CHECKPOINT|10 CLOSE CLUSTER COMMENT COMMIT COPY CREATE DEALLOCATE DECLARE DELETE DISCARD DO DROP END EXECUTE EXPLAIN FETCH GRANT IMPORT INSERT LISTEN LOAD LOCK MOVE NOTIFY PREPARE REASSIGN|10 REFRESH REINDEX RELEASE RESET REVOKE ROLLBACK SAVEPOINT SECURITY SELECT SET SHOW START TRUNCATE UNLISTEN|10 UPDATE VACUUM|10 VALUES AGGREGATE COLLATION CONVERSION|10 DATABASE DEFAULT PRIVILEGES DOMAIN TRIGGER EXTENSION FOREIGN WRAPPER|10 TABLE FUNCTION GROUP LANGUAGE LARGE OBJECT MATERIALIZED VIEW OPERATOR CLASS FAMILY POLICY PUBLICATION|10 ROLE RULE SCHEMA SEQUENCE SERVER STATISTICS SUBSCRIPTION SYSTEM TABLESPACE CONFIGURATION DICTIONARY PARSER TEMPLATE TYPE USER MAPPING PREPARED ACCESS METHOD CAST AS TRANSFORM TRANSACTION OWNED TO INTO SESSION AUTHORIZATION INDEX PROCEDURE ASSERTION ALL ANALYSE AND ANY ARRAY ASC ASYMMETRIC|10 BOTH CASE CHECK COLLATE COLUMN CONCURRENTLY|10 CONSTRAINT CROSS DEFERRABLE RANGE DESC DISTINCT ELSE EXCEPT FOR FREEZE|10 FROM FULL HAVING ILIKE IN INITIALLY INNER INTERSECT IS ISNULL JOIN LATERAL LEADING LIKE LIMIT NATURAL NOT NOTNULL NULL OFFSET ON ONLY OR ORDER OUTER OVERLAPS PLACING PRIMARY REFERENCES RETURNING SIMILAR SOME SYMMETRIC TABLESAMPLE THEN TRAILING UNION UNIQUE USING VARIADIC|10 VERBOSE WHEN WHERE WINDOW WITH BY RETURNS INOUT OUT SETOF|10 IF STRICT CURRENT CONTINUE OWNER LOCATION OVER PARTITION WITHIN BETWEEN ESCAPE EXTERNAL INVOKER DEFINER WORK RENAME VERSION CONNECTION CONNECT TABLES TEMP TEMPORARY FUNCTIONS SEQUENCES TYPES SCHEMAS OPTION CASCADE RESTRICT ADD ADMIN EXISTS VALID VALIDATE ENABLE DISABLE REPLICA|10 ALWAYS PASSING COLUMNS PATH REF VALUE OVERRIDING IMMUTABLE STABLE VOLATILE BEFORE AFTER EACH ROW PROCEDURAL ROUTINE NO HANDLER VALIDATOR OPTIONS STORAGE OIDS|10 WITHOUT INHERIT DEPENDS CALLED INPUT LEAKPROOF|10 COST ROWS NOWAIT SEARCH UNTIL ENCRYPTED|10 PASSWORD CONFLICT|10 INSTEAD INHERITS CHARACTERISTICS WRITE CURSOR ALSO STATEMENT SHARE EXCLUSIVE INLINE ISOLATION REPEATABLE READ COMMITTED SERIALIZABLE UNCOMMITTED LOCAL GLOBAL SQL PROCEDURES RECURSIVE SNAPSHOT ROLLUP CUBE TRUSTED|10 INCLUDE FOLLOWING PRECEDING UNBOUNDED RANGE GROUPS UNENCRYPTED|10 SYSID FORMAT DELIMITER HEADER QUOTE ENCODING FILTER OFF FORCE_QUOTE FORCE_NOT_NULL FORCE_NULL COSTS BUFFERS TIMING SUMMARY DISABLE_PAGE_SKIPPING RESTART CYCLE GENERATED IDENTITY DEFERRED IMMEDIATE LEVEL LOGGED UNLOGGED OF NOTHING NONE EXCLUDE ATTRIBUTE USAGE ROUTINES TRUE FALSE NAN INFINITY ALIAS BEGIN CONSTANT DECLARE END EXCEPTION RETURN PERFORM|10 RAISE GET DIAGNOSTICS STACKED|10 FOREACH LOOP ELSIF EXIT WHILE REVERSE SLICE DEBUG LOG INFO NOTICE WARNING ASSERT OPEN SUPERUSER NOSUPERUSER CREATEDB NOCREATEDB CREATEROLE NOCREATEROLE INHERIT NOINHERIT LOGIN NOLOGIN REPLICATION NOREPLICATION BYPASSRLS NOBYPASSRLS ", -built_in:"CURRENT_TIME CURRENT_TIMESTAMP CURRENT_USER CURRENT_CATALOG|10 CURRENT_DATE LOCALTIME LOCALTIMESTAMP CURRENT_ROLE|10 CURRENT_SCHEMA|10 SESSION_USER PUBLIC FOUND NEW OLD TG_NAME|10 TG_WHEN|10 TG_LEVEL|10 TG_OP|10 TG_RELID|10 TG_RELNAME|10 TG_TABLE_NAME|10 TG_TABLE_SCHEMA|10 TG_NARGS|10 TG_ARGV|10 TG_EVENT|10 TG_TAG|10 ROW_COUNT RESULT_OID|10 PG_CONTEXT|10 RETURNED_SQLSTATE COLUMN_NAME CONSTRAINT_NAME PG_DATATYPE_NAME|10 MESSAGE_TEXT TABLE_NAME SCHEMA_NAME PG_EXCEPTION_DETAIL|10 PG_EXCEPTION_HINT|10 PG_EXCEPTION_CONTEXT|10 SQLSTATE SQLERRM|10 SUCCESSFUL_COMPLETION WARNING DYNAMIC_RESULT_SETS_RETURNED IMPLICIT_ZERO_BIT_PADDING NULL_VALUE_ELIMINATED_IN_SET_FUNCTION PRIVILEGE_NOT_GRANTED PRIVILEGE_NOT_REVOKED STRING_DATA_RIGHT_TRUNCATION DEPRECATED_FEATURE NO_DATA NO_ADDITIONAL_DYNAMIC_RESULT_SETS_RETURNED SQL_STATEMENT_NOT_YET_COMPLETE CONNECTION_EXCEPTION CONNECTION_DOES_NOT_EXIST CONNECTION_FAILURE SQLCLIENT_UNABLE_TO_ESTABLISH_SQLCONNECTION SQLSERVER_REJECTED_ESTABLISHMENT_OF_SQLCONNECTION TRANSACTION_RESOLUTION_UNKNOWN PROTOCOL_VIOLATION TRIGGERED_ACTION_EXCEPTION FEATURE_NOT_SUPPORTED INVALID_TRANSACTION_INITIATION LOCATOR_EXCEPTION INVALID_LOCATOR_SPECIFICATION INVALID_GRANTOR INVALID_GRANT_OPERATION INVALID_ROLE_SPECIFICATION DIAGNOSTICS_EXCEPTION STACKED_DIAGNOSTICS_ACCESSED_WITHOUT_ACTIVE_HANDLER CASE_NOT_FOUND CARDINALITY_VIOLATION DATA_EXCEPTION ARRAY_SUBSCRIPT_ERROR CHARACTER_NOT_IN_REPERTOIRE DATETIME_FIELD_OVERFLOW DIVISION_BY_ZERO ERROR_IN_ASSIGNMENT ESCAPE_CHARACTER_CONFLICT INDICATOR_OVERFLOW INTERVAL_FIELD_OVERFLOW INVALID_ARGUMENT_FOR_LOGARITHM INVALID_ARGUMENT_FOR_NTILE_FUNCTION INVALID_ARGUMENT_FOR_NTH_VALUE_FUNCTION INVALID_ARGUMENT_FOR_POWER_FUNCTION INVALID_ARGUMENT_FOR_WIDTH_BUCKET_FUNCTION INVALID_CHARACTER_VALUE_FOR_CAST INVALID_DATETIME_FORMAT INVALID_ESCAPE_CHARACTER INVALID_ESCAPE_OCTET INVALID_ESCAPE_SEQUENCE NONSTANDARD_USE_OF_ESCAPE_CHARACTER INVALID_INDICATOR_PARAMETER_VALUE INVALID_PARAMETER_VALUE INVALID_REGULAR_EXPRESSION INVALID_ROW_COUNT_IN_LIMIT_CLAUSE INVALID_ROW_COUNT_IN_RESULT_OFFSET_CLAUSE INVALID_TABLESAMPLE_ARGUMENT INVALID_TABLESAMPLE_REPEAT INVALID_TIME_ZONE_DISPLACEMENT_VALUE INVALID_USE_OF_ESCAPE_CHARACTER MOST_SPECIFIC_TYPE_MISMATCH NULL_VALUE_NOT_ALLOWED NULL_VALUE_NO_INDICATOR_PARAMETER NUMERIC_VALUE_OUT_OF_RANGE SEQUENCE_GENERATOR_LIMIT_EXCEEDED STRING_DATA_LENGTH_MISMATCH STRING_DATA_RIGHT_TRUNCATION SUBSTRING_ERROR TRIM_ERROR UNTERMINATED_C_STRING ZERO_LENGTH_CHARACTER_STRING FLOATING_POINT_EXCEPTION INVALID_TEXT_REPRESENTATION INVALID_BINARY_REPRESENTATION BAD_COPY_FILE_FORMAT UNTRANSLATABLE_CHARACTER NOT_AN_XML_DOCUMENT INVALID_XML_DOCUMENT INVALID_XML_CONTENT INVALID_XML_COMMENT INVALID_XML_PROCESSING_INSTRUCTION INTEGRITY_CONSTRAINT_VIOLATION RESTRICT_VIOLATION NOT_NULL_VIOLATION FOREIGN_KEY_VIOLATION UNIQUE_VIOLATION CHECK_VIOLATION EXCLUSION_VIOLATION INVALID_CURSOR_STATE INVALID_TRANSACTION_STATE ACTIVE_SQL_TRANSACTION BRANCH_TRANSACTION_ALREADY_ACTIVE HELD_CURSOR_REQUIRES_SAME_ISOLATION_LEVEL INAPPROPRIATE_ACCESS_MODE_FOR_BRANCH_TRANSACTION INAPPROPRIATE_ISOLATION_LEVEL_FOR_BRANCH_TRANSACTION NO_ACTIVE_SQL_TRANSACTION_FOR_BRANCH_TRANSACTION READ_ONLY_SQL_TRANSACTION SCHEMA_AND_DATA_STATEMENT_MIXING_NOT_SUPPORTED NO_ACTIVE_SQL_TRANSACTION IN_FAILED_SQL_TRANSACTION IDLE_IN_TRANSACTION_SESSION_TIMEOUT INVALID_SQL_STATEMENT_NAME TRIGGERED_DATA_CHANGE_VIOLATION INVALID_AUTHORIZATION_SPECIFICATION INVALID_PASSWORD DEPENDENT_PRIVILEGE_DESCRIPTORS_STILL_EXIST DEPENDENT_OBJECTS_STILL_EXIST INVALID_TRANSACTION_TERMINATION SQL_ROUTINE_EXCEPTION FUNCTION_EXECUTED_NO_RETURN_STATEMENT MODIFYING_SQL_DATA_NOT_PERMITTED PROHIBITED_SQL_STATEMENT_ATTEMPTED READING_SQL_DATA_NOT_PERMITTED INVALID_CURSOR_NAME EXTERNAL_ROUTINE_EXCEPTION CONTAINING_SQL_NOT_PERMITTED MODIFYING_SQL_DATA_NOT_PERMITTED PROHIBITED_SQL_STATEMENT_ATTEMPTED READING_SQL_DATA_NOT_PERMITTED EXTERNAL_ROUTINE_INVOCATION_EXCEPTION INVALID_SQLSTATE_RETURNED NULL_VALUE_NOT_ALLOWED TRIGGER_PROTOCOL_VIOLATED SRF_PROTOCOL_VIOLATED EVENT_TRIGGER_PROTOCOL_VIOLATED SAVEPOINT_EXCEPTION INVALID_SAVEPOINT_SPECIFICATION INVALID_CATALOG_NAME INVALID_SCHEMA_NAME TRANSACTION_ROLLBACK TRANSACTION_INTEGRITY_CONSTRAINT_VIOLATION SERIALIZATION_FAILURE STATEMENT_COMPLETION_UNKNOWN DEADLOCK_DETECTED SYNTAX_ERROR_OR_ACCESS_RULE_VIOLATION SYNTAX_ERROR INSUFFICIENT_PRIVILEGE CANNOT_COERCE GROUPING_ERROR WINDOWING_ERROR INVALID_RECURSION INVALID_FOREIGN_KEY INVALID_NAME NAME_TOO_LONG RESERVED_NAME DATATYPE_MISMATCH INDETERMINATE_DATATYPE COLLATION_MISMATCH INDETERMINATE_COLLATION WRONG_OBJECT_TYPE GENERATED_ALWAYS UNDEFINED_COLUMN UNDEFINED_FUNCTION UNDEFINED_TABLE UNDEFINED_PARAMETER UNDEFINED_OBJECT DUPLICATE_COLUMN DUPLICATE_CURSOR DUPLICATE_DATABASE DUPLICATE_FUNCTION DUPLICATE_PREPARED_STATEMENT DUPLICATE_SCHEMA DUPLICATE_TABLE DUPLICATE_ALIAS DUPLICATE_OBJECT AMBIGUOUS_COLUMN AMBIGUOUS_FUNCTION AMBIGUOUS_PARAMETER AMBIGUOUS_ALIAS INVALID_COLUMN_REFERENCE INVALID_COLUMN_DEFINITION INVALID_CURSOR_DEFINITION INVALID_DATABASE_DEFINITION INVALID_FUNCTION_DEFINITION INVALID_PREPARED_STATEMENT_DEFINITION INVALID_SCHEMA_DEFINITION INVALID_TABLE_DEFINITION INVALID_OBJECT_DEFINITION WITH_CHECK_OPTION_VIOLATION INSUFFICIENT_RESOURCES DISK_FULL OUT_OF_MEMORY TOO_MANY_CONNECTIONS CONFIGURATION_LIMIT_EXCEEDED PROGRAM_LIMIT_EXCEEDED STATEMENT_TOO_COMPLEX TOO_MANY_COLUMNS TOO_MANY_ARGUMENTS OBJECT_NOT_IN_PREREQUISITE_STATE OBJECT_IN_USE CANT_CHANGE_RUNTIME_PARAM LOCK_NOT_AVAILABLE OPERATOR_INTERVENTION QUERY_CANCELED ADMIN_SHUTDOWN CRASH_SHUTDOWN CANNOT_CONNECT_NOW DATABASE_DROPPED SYSTEM_ERROR IO_ERROR UNDEFINED_FILE DUPLICATE_FILE SNAPSHOT_TOO_OLD CONFIG_FILE_ERROR LOCK_FILE_EXISTS FDW_ERROR FDW_COLUMN_NAME_NOT_FOUND FDW_DYNAMIC_PARAMETER_VALUE_NEEDED FDW_FUNCTION_SEQUENCE_ERROR FDW_INCONSISTENT_DESCRIPTOR_INFORMATION FDW_INVALID_ATTRIBUTE_VALUE FDW_INVALID_COLUMN_NAME FDW_INVALID_COLUMN_NUMBER FDW_INVALID_DATA_TYPE FDW_INVALID_DATA_TYPE_DESCRIPTORS FDW_INVALID_DESCRIPTOR_FIELD_IDENTIFIER FDW_INVALID_HANDLE FDW_INVALID_OPTION_INDEX FDW_INVALID_OPTION_NAME FDW_INVALID_STRING_LENGTH_OR_BUFFER_LENGTH FDW_INVALID_STRING_FORMAT FDW_INVALID_USE_OF_NULL_POINTER FDW_TOO_MANY_HANDLES FDW_OUT_OF_MEMORY FDW_NO_SCHEMAS FDW_OPTION_NAME_NOT_FOUND FDW_REPLY_HANDLE FDW_SCHEMA_NOT_FOUND FDW_TABLE_NOT_FOUND FDW_UNABLE_TO_CREATE_EXECUTION FDW_UNABLE_TO_CREATE_REPLY FDW_UNABLE_TO_ESTABLISH_CONNECTION PLPGSQL_ERROR RAISE_EXCEPTION NO_DATA_FOUND TOO_MANY_ROWS ASSERT_FAILURE INTERNAL_ERROR DATA_CORRUPTED INDEX_CORRUPTED " -},illegal:/:==|\W\s*\(\*|(^|\s)\$[a-z]|\{\{|[a-z]:\s*$|\.\.\.|TO:|DO:/, -contains:[{className:"keyword",variants:[{begin:/\bTEXT\s*SEARCH\b/},{ -begin:/\b(PRIMARY|FOREIGN|FOR(\s+NO)?)\s+KEY\b/},{ -begin:/\bPARALLEL\s+(UNSAFE|RESTRICTED|SAFE)\b/},{ -begin:/\bSTORAGE\s+(PLAIN|EXTERNAL|EXTENDED|MAIN)\b/},{ -begin:/\bMATCH\s+(FULL|PARTIAL|SIMPLE)\b/},{begin:/\bNULLS\s+(FIRST|LAST)\b/},{ -begin:/\bEVENT\s+TRIGGER\b/},{begin:/\b(MAPPING|OR)\s+REPLACE\b/},{ -begin:/\b(FROM|TO)\s+(PROGRAM|STDIN|STDOUT)\b/},{ -begin:/\b(SHARE|EXCLUSIVE)\s+MODE\b/},{ -begin:/\b(LEFT|RIGHT)\s+(OUTER\s+)?JOIN\b/},{ -begin:/\b(FETCH|MOVE)\s+(NEXT|PRIOR|FIRST|LAST|ABSOLUTE|RELATIVE|FORWARD|BACKWARD)\b/ -},{begin:/\bPRESERVE\s+ROWS\b/},{begin:/\bDISCARD\s+PLANS\b/},{ -begin:/\bREFERENCING\s+(OLD|NEW)\b/},{begin:/\bSKIP\s+LOCKED\b/},{ -begin:/\bGROUPING\s+SETS\b/},{ -begin:/\b(BINARY|INSENSITIVE|SCROLL|NO\s+SCROLL)\s+(CURSOR|FOR)\b/},{ -begin:/\b(WITH|WITHOUT)\s+HOLD\b/},{ -begin:/\bWITH\s+(CASCADED|LOCAL)\s+CHECK\s+OPTION\b/},{ -begin:/\bEXCLUDE\s+(TIES|NO\s+OTHERS)\b/},{ -begin:/\bFORMAT\s+(TEXT|XML|JSON|YAML)\b/},{ -begin:/\bSET\s+((SESSION|LOCAL)\s+)?NAMES\b/},{begin:/\bIS\s+(NOT\s+)?UNKNOWN\b/ -},{begin:/\bSECURITY\s+LABEL\b/},{begin:/\bSTANDALONE\s+(YES|NO|NO\s+VALUE)\b/ -},{begin:/\bWITH\s+(NO\s+)?DATA\b/},{begin:/\b(FOREIGN|SET)\s+DATA\b/},{ -begin:/\bSET\s+(CATALOG|CONSTRAINTS)\b/},{begin:/\b(WITH|FOR)\s+ORDINALITY\b/},{ -begin:/\bIS\s+(NOT\s+)?DOCUMENT\b/},{ -begin:/\bXML\s+OPTION\s+(DOCUMENT|CONTENT)\b/},{ -begin:/\b(STRIP|PRESERVE)\s+WHITESPACE\b/},{ -begin:/\bNO\s+(ACTION|MAXVALUE|MINVALUE)\b/},{ -begin:/\bPARTITION\s+BY\s+(RANGE|LIST|HASH)\b/},{begin:/\bAT\s+TIME\s+ZONE\b/},{ -begin:/\bGRANTED\s+BY\b/},{begin:/\bRETURN\s+(QUERY|NEXT)\b/},{ -begin:/\b(ATTACH|DETACH)\s+PARTITION\b/},{ -begin:/\bFORCE\s+ROW\s+LEVEL\s+SECURITY\b/},{ -begin:/\b(INCLUDING|EXCLUDING)\s+(COMMENTS|CONSTRAINTS|DEFAULTS|IDENTITY|INDEXES|STATISTICS|STORAGE|ALL)\b/ -},{begin:/\bAS\s+(ASSIGNMENT|IMPLICIT|PERMISSIVE|RESTRICTIVE|ENUM|RANGE)\b/}]},{ -begin:/\b(FORMAT|FAMILY|VERSION)\s*\(/},{begin:/\bINCLUDE\s*\(/, -keywords:"INCLUDE"},{begin:/\bRANGE(?!\s*(BETWEEN|UNBOUNDED|CURRENT|[-0-9]+))/ -},{ -begin:/\b(VERSION|OWNER|TEMPLATE|TABLESPACE|CONNECTION\s+LIMIT|PROCEDURE|RESTRICT|JOIN|PARSER|COPY|START|END|COLLATION|INPUT|ANALYZE|STORAGE|LIKE|DEFAULT|DELIMITER|ENCODING|COLUMN|CONSTRAINT|TABLE|SCHEMA)\s*=/ -},{begin:/\b(PG_\w+?|HAS_[A-Z_]+_PRIVILEGE)\b/,relevance:10},{ -begin:/\bEXTRACT\s*\(/,end:/\bFROM\b/,returnEnd:!0,keywords:{ -type:"CENTURY DAY DECADE DOW DOY EPOCH HOUR ISODOW ISOYEAR MICROSECONDS MILLENNIUM MILLISECONDS MINUTE MONTH QUARTER SECOND TIMEZONE TIMEZONE_HOUR TIMEZONE_MINUTE WEEK YEAR" -}},{begin:/\b(XMLELEMENT|XMLPI)\s*\(\s*NAME/,keywords:{keyword:"NAME"}},{ -begin:/\b(XMLPARSE|XMLSERIALIZE)\s*\(\s*(DOCUMENT|CONTENT)/,keywords:{ -keyword:"DOCUMENT CONTENT"}},{beginKeywords:"CACHE INCREMENT MAXVALUE MINVALUE", -end:E.C_NUMBER_RE,returnEnd:!0,keywords:"BY CACHE INCREMENT MAXVALUE MINVALUE" -},{className:"type",begin:/\b(WITH|WITHOUT)\s+TIME\s+ZONE\b/},{className:"type", -begin:/\bINTERVAL\s+(YEAR|MONTH|DAY|HOUR|MINUTE|SECOND)(\s+TO\s+(MONTH|HOUR|MINUTE|SECOND))?\b/ -},{ -begin:/\bRETURNS\s+(LANGUAGE_HANDLER|TRIGGER|EVENT_TRIGGER|FDW_HANDLER|INDEX_AM_HANDLER|TSM_HANDLER)\b/, -keywords:{keyword:"RETURNS", -type:"LANGUAGE_HANDLER TRIGGER EVENT_TRIGGER FDW_HANDLER INDEX_AM_HANDLER TSM_HANDLER" -}},{begin:"\\b("+I+")\\s*\\("},{begin:"\\.("+R+")\\b"},{ -begin:"\\b("+R+")\\s+PATH\\b",keywords:{keyword:"PATH", -type:A.replace("PATH ","")}},{className:"type",begin:"\\b("+R+")\\b"},{ -className:"string",begin:"'",end:"'",contains:[{begin:"''"}]},{ -className:"string",begin:"(e|E|u&|U&)'",end:"'",contains:[{begin:"\\\\."}], -relevance:10},E.END_SAME_AS_BEGIN({begin:N,end:N,contains:[{ -subLanguage:["pgsql","perl","python","tcl","r","lua","java","php","ruby","bash","scheme","xml","json"], -endsWithParent:!0}]}),{begin:'"',end:'"',contains:[{begin:'""'}] -},E.C_NUMBER_MODE,E.C_BLOCK_COMMENT_MODE,T,{className:"meta",variants:[{ -begin:"%(ROW)?TYPE",relevance:10},{begin:"\\$\\d+"},{begin:"^#\\w",end:"$"}]},{ -className:"symbol",begin:"<<\\s*[a-zA-Z_][a-zA-Z_0-9$]*\\s*>>",relevance:10}]}} -})();hljs.registerLanguage("pgsql",E)})();/*! `php` grammar compiled for Highlight.js 11.10.0 */ -(()=>{var e=(()=>{"use strict";return e=>{ -const t=e.regex,a=/(?![A-Za-z0-9])(?![$])/,r=t.concat(/[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*/,a),n=t.concat(/(\\?[A-Z][a-z0-9_\x7f-\xff]+|\\?[A-Z]+(?=[A-Z][a-z0-9_\x7f-\xff])){1,}/,a),o={ -scope:"variable",match:"\\$+"+r},c={scope:"subst",variants:[{begin:/\$\w+/},{ -begin:/\{\$/,end:/\}/}]},i=e.inherit(e.APOS_STRING_MODE,{illegal:null -}),s="[ \t\n]",l={scope:"string",variants:[e.inherit(e.QUOTE_STRING_MODE,{ -illegal:null,contains:e.QUOTE_STRING_MODE.contains.concat(c)}),i,{ -begin:/<<<[ \t]*(?:(\w+)|"(\w+)")\n/,end:/[ \t]*(\w+)\b/, -contains:e.QUOTE_STRING_MODE.contains.concat(c),"on:begin":(e,t)=>{ -t.data._beginMatch=e[1]||e[2]},"on:end":(e,t)=>{ -t.data._beginMatch!==e[1]&&t.ignoreMatch()}},e.END_SAME_AS_BEGIN({ -begin:/<<<[ \t]*'(\w+)'\n/,end:/[ \t]*(\w+)\b/})]},d={scope:"number",variants:[{ -begin:"\\b0[bB][01]+(?:_[01]+)*\\b"},{begin:"\\b0[oO][0-7]+(?:_[0-7]+)*\\b"},{ -begin:"\\b0[xX][\\da-fA-F]+(?:_[\\da-fA-F]+)*\\b"},{ -begin:"(?:\\b\\d+(?:_\\d+)*(\\.(?:\\d+(?:_\\d+)*))?|\\B\\.\\d+)(?:[eE][+-]?\\d+)?" -}],relevance:0 -},_=["false","null","true"],p=["__CLASS__","__DIR__","__FILE__","__FUNCTION__","__COMPILER_HALT_OFFSET__","__LINE__","__METHOD__","__NAMESPACE__","__TRAIT__","die","echo","exit","include","include_once","print","require","require_once","array","abstract","and","as","binary","bool","boolean","break","callable","case","catch","class","clone","const","continue","declare","default","do","double","else","elseif","empty","enddeclare","endfor","endforeach","endif","endswitch","endwhile","enum","eval","extends","final","finally","float","for","foreach","from","global","goto","if","implements","instanceof","insteadof","int","integer","interface","isset","iterable","list","match|0","mixed","new","never","object","or","private","protected","public","readonly","real","return","string","switch","throw","trait","try","unset","use","var","void","while","xor","yield"],b=["Error|0","AppendIterator","ArgumentCountError","ArithmeticError","ArrayIterator","ArrayObject","AssertionError","BadFunctionCallException","BadMethodCallException","CachingIterator","CallbackFilterIterator","CompileError","Countable","DirectoryIterator","DivisionByZeroError","DomainException","EmptyIterator","ErrorException","Exception","FilesystemIterator","FilterIterator","GlobIterator","InfiniteIterator","InvalidArgumentException","IteratorIterator","LengthException","LimitIterator","LogicException","MultipleIterator","NoRewindIterator","OutOfBoundsException","OutOfRangeException","OuterIterator","OverflowException","ParentIterator","ParseError","RangeException","RecursiveArrayIterator","RecursiveCachingIterator","RecursiveCallbackFilterIterator","RecursiveDirectoryIterator","RecursiveFilterIterator","RecursiveIterator","RecursiveIteratorIterator","RecursiveRegexIterator","RecursiveTreeIterator","RegexIterator","RuntimeException","SeekableIterator","SplDoublyLinkedList","SplFileInfo","SplFileObject","SplFixedArray","SplHeap","SplMaxHeap","SplMinHeap","SplObjectStorage","SplObserver","SplPriorityQueue","SplQueue","SplStack","SplSubject","SplTempFileObject","TypeError","UnderflowException","UnexpectedValueException","UnhandledMatchError","ArrayAccess","BackedEnum","Closure","Fiber","Generator","Iterator","IteratorAggregate","Serializable","Stringable","Throwable","Traversable","UnitEnum","WeakReference","WeakMap","Directory","__PHP_Incomplete_Class","parent","php_user_filter","self","static","stdClass"],E={ -keyword:p,literal:(e=>{const t=[];return e.forEach((e=>{ -t.push(e),e.toLowerCase()===e?t.push(e.toUpperCase()):t.push(e.toLowerCase()) -})),t})(_),built_in:b},u=e=>e.map((e=>e.replace(/\|\d+$/,""))),g={variants:[{ -match:[/new/,t.concat(s,"+"),t.concat("(?!",u(b).join("\\b|"),"\\b)"),n],scope:{ -1:"keyword",4:"title.class"}}]},h=t.concat(r,"\\b(?!\\()"),m={variants:[{ -match:[t.concat(/::/,t.lookahead(/(?!class\b)/)),h],scope:{2:"variable.constant" -}},{match:[/::/,/class/],scope:{2:"variable.language"}},{ -match:[n,t.concat(/::/,t.lookahead(/(?!class\b)/)),h],scope:{1:"title.class", -3:"variable.constant"}},{match:[n,t.concat("::",t.lookahead(/(?!class\b)/))], -scope:{1:"title.class"}},{match:[n,/::/,/class/],scope:{1:"title.class", -3:"variable.language"}}]},I={scope:"attr", -match:t.concat(r,t.lookahead(":"),t.lookahead(/(?!::)/))},f={relevance:0, -begin:/\(/,end:/\)/,keywords:E,contains:[I,o,m,e.C_BLOCK_COMMENT_MODE,l,d,g] -},O={relevance:0, -match:[/\b/,t.concat("(?!fn\\b|function\\b|",u(p).join("\\b|"),"|",u(b).join("\\b|"),"\\b)"),r,t.concat(s,"*"),t.lookahead(/(?=\()/)], -scope:{3:"title.function.invoke"},contains:[f]};f.contains.push(O) -;const v=[I,m,e.C_BLOCK_COMMENT_MODE,l,d,g];return{case_insensitive:!1, -keywords:E,contains:[{begin:t.concat(/#\[\s*/,n),beginScope:"meta",end:/]/, -endScope:"meta",keywords:{literal:_,keyword:["new","array"]},contains:[{ -begin:/\[/,end:/]/,keywords:{literal:_,keyword:["new","array"]}, -contains:["self",...v]},...v,{scope:"meta",match:n}] -},e.HASH_COMMENT_MODE,e.COMMENT("//","$"),e.COMMENT("/\\*","\\*/",{contains:[{ -scope:"doctag",match:"@[A-Za-z]+"}]}),{match:/__halt_compiler\(\);/, -keywords:"__halt_compiler",starts:{scope:"comment",end:e.MATCH_NOTHING_RE, -contains:[{match:/\?>/,scope:"meta",endsParent:!0}]}},{scope:"meta",variants:[{ -begin:/<\?php/,relevance:10},{begin:/<\?=/},{begin:/<\?/,relevance:.1},{ -begin:/\?>/}]},{scope:"variable.language",match:/\$this\b/},o,O,m,{ -match:[/const/,/\s/,r],scope:{1:"keyword",3:"variable.constant"}},g,{ -scope:"function",relevance:0,beginKeywords:"fn function",end:/[;{]/, -excludeEnd:!0,illegal:"[$%\\[]",contains:[{beginKeywords:"use" -},e.UNDERSCORE_TITLE_MODE,{begin:"=>",endsParent:!0},{scope:"params", -begin:"\\(",end:"\\)",excludeBegin:!0,excludeEnd:!0,keywords:E, -contains:["self",o,m,e.C_BLOCK_COMMENT_MODE,l,d]}]},{scope:"class",variants:[{ -beginKeywords:"enum",illegal:/[($"]/},{beginKeywords:"class interface trait", -illegal:/[:($"]/}],relevance:0,end:/\{/,excludeEnd:!0,contains:[{ -beginKeywords:"extends implements"},e.UNDERSCORE_TITLE_MODE]},{ -beginKeywords:"namespace",relevance:0,end:";",illegal:/[.']/, -contains:[e.inherit(e.UNDERSCORE_TITLE_MODE,{scope:"title.class"})]},{ -beginKeywords:"use",relevance:0,end:";",contains:[{ -match:/\b(as|const|function)\b/,scope:"keyword"},e.UNDERSCORE_TITLE_MODE]},l,d]} -}})();hljs.registerLanguage("php",e)})();/*! `php-template` grammar compiled for Highlight.js 11.10.0 */ -(()=>{var n=(()=>{"use strict";return n=>({name:"PHP template", -subLanguage:"xml",contains:[{begin:/<\?(php|=)?/,end:/\?>/,subLanguage:"php", -contains:[{begin:"/\\*",end:"\\*/",skip:!0},{begin:'b"',end:'"',skip:!0},{ -begin:"b'",end:"'",skip:!0},n.inherit(n.APOS_STRING_MODE,{illegal:null, -className:null,contains:null,skip:!0}),n.inherit(n.QUOTE_STRING_MODE,{ -illegal:null,className:null,contains:null,skip:!0})]}]})})() -;hljs.registerLanguage("php-template",n)})();/*! `plaintext` grammar compiled for Highlight.js 11.10.0 */ -(()=>{var t=(()=>{"use strict";return t=>({name:"Plain text", -aliases:["text","txt"],disableAutodetect:!0})})() -;hljs.registerLanguage("plaintext",t)})();/*! `powershell` grammar compiled for Highlight.js 11.10.0 */ -(()=>{var e=(()=>{"use strict";return e=>{const n={$pattern:/-?[A-z\.\-]+\b/, -keyword:"if else foreach return do while until elseif begin for trap data dynamicparam end break throw param continue finally in switch exit filter try process catch hidden static parameter", -built_in:"ac asnp cat cd CFS chdir clc clear clhy cli clp cls clv cnsn compare copy cp cpi cpp curl cvpa dbp del diff dir dnsn ebp echo|0 epal epcsv epsn erase etsn exsn fc fhx fl ft fw gal gbp gc gcb gci gcm gcs gdr gerr ghy gi gin gjb gl gm gmo gp gps gpv group gsn gsnp gsv gtz gu gv gwmi h history icm iex ihy ii ipal ipcsv ipmo ipsn irm ise iwmi iwr kill lp ls man md measure mi mount move mp mv nal ndr ni nmo npssc nsn nv ogv oh popd ps pushd pwd r rbp rcjb rcsn rd rdr ren ri rjb rm rmdir rmo rni rnp rp rsn rsnp rujb rv rvpa rwmi sajb sal saps sasv sbp sc scb select set shcm si sl sleep sls sort sp spjb spps spsv start stz sujb sv swmi tee trcm type wget where wjb write" -},s={begin:"`[\\s\\S]",relevance:0},i={className:"variable",variants:[{ -begin:/\$\B/},{className:"keyword",begin:/\$this/},{begin:/\$[\w\d][\w\d_:]*/}] -},a={className:"string",variants:[{begin:/"/,end:/"/},{begin:/@"/,end:/^"@/}], -contains:[s,i,{className:"variable",begin:/\$[A-z]/,end:/[^A-z]/}]},t={ -className:"string",variants:[{begin:/'/,end:/'/},{begin:/@'/,end:/^'@/}] -},r=e.inherit(e.COMMENT(null,null),{variants:[{begin:/#/,end:/$/},{begin:/<#/, -end:/#>/}],contains:[{className:"doctag",variants:[{ -begin:/\.(synopsis|description|example|inputs|outputs|notes|link|component|role|functionality)/ -},{ -begin:/\.(parameter|forwardhelptargetname|forwardhelpcategory|remotehelprunspace|externalhelp)\s+\S+/ -}]}]}),c={className:"class",beginKeywords:"class enum",end:/\s*[{]/, -excludeEnd:!0,relevance:0,contains:[e.TITLE_MODE]},l={className:"function", -begin:/function\s+/,end:/\s*\{|$/,excludeEnd:!0,returnBegin:!0,relevance:0, -contains:[{begin:"function",relevance:0,className:"keyword"},{className:"title", -begin:/\w[\w\d]*((-)[\w\d]+)*/,relevance:0},{begin:/\(/,end:/\)/, -className:"params",relevance:0,contains:[i]}]},o={begin:/using\s/,end:/$/, -returnBegin:!0,contains:[a,t,{className:"keyword", -begin:/(using|assembly|command|module|namespace|type)/}]},p={ -className:"function",begin:/\[.*\]\s*[\w]+[ ]??\(/,end:/$/,returnBegin:!0, -relevance:0,contains:[{className:"keyword", -begin:"(".concat(n.keyword.toString().replace(/\s/g,"|"),")\\b"),endsParent:!0, -relevance:0},e.inherit(e.TITLE_MODE,{endsParent:!0})] -},g=[p,r,s,e.NUMBER_MODE,a,t,{className:"built_in",variants:[{ -begin:"(Add|Clear|Close|Copy|Enter|Exit|Find|Format|Get|Hide|Join|Lock|Move|New|Open|Optimize|Pop|Push|Redo|Remove|Rename|Reset|Resize|Search|Select|Set|Show|Skip|Split|Step|Switch|Undo|Unlock|Watch|Backup|Checkpoint|Compare|Compress|Convert|ConvertFrom|ConvertTo|Dismount|Edit|Expand|Export|Group|Import|Initialize|Limit|Merge|Mount|Out|Publish|Restore|Save|Sync|Unpublish|Update|Approve|Assert|Build|Complete|Confirm|Deny|Deploy|Disable|Enable|Install|Invoke|Register|Request|Restart|Resume|Start|Stop|Submit|Suspend|Uninstall|Unregister|Wait|Debug|Measure|Ping|Repair|Resolve|Test|Trace|Connect|Disconnect|Read|Receive|Send|Write|Block|Grant|Protect|Revoke|Unblock|Unprotect|Use|ForEach|Sort|Tee|Where)+(-)[\\w\\d]+" -}]},i,{className:"literal",begin:/\$(null|true|false)\b/},{ -className:"selector-tag",begin:/@\B/,relevance:0}],m={begin:/\[/,end:/\]/, -excludeBegin:!0,excludeEnd:!0,relevance:0,contains:[].concat("self",g,{ -begin:"(string|char|byte|int|long|bool|decimal|single|double|DateTime|xml|array|hashtable|void)", -className:"built_in",relevance:0},{className:"type",begin:/[\.\w\d]+/, -relevance:0})};return p.contains.unshift(m),{name:"PowerShell", -aliases:["pwsh","ps","ps1"],case_insensitive:!0,keywords:n, -contains:g.concat(c,l,o,{variants:[{className:"operator", -begin:"(-and|-as|-band|-bnot|-bor|-bxor|-casesensitive|-ccontains|-ceq|-cge|-cgt|-cle|-clike|-clt|-cmatch|-cne|-cnotcontains|-cnotlike|-cnotmatch|-contains|-creplace|-csplit|-eq|-exact|-f|-file|-ge|-gt|-icontains|-ieq|-ige|-igt|-ile|-ilike|-ilt|-imatch|-in|-ine|-inotcontains|-inotlike|-inotmatch|-ireplace|-is|-isnot|-isplit|-join|-le|-like|-lt|-match|-ne|-not|-notcontains|-notin|-notlike|-notmatch|-or|-regex|-replace|-shl|-shr|-split|-wildcard|-xor)\\b" -},{className:"literal",begin:/(-){1,2}[\w\d-]+/,relevance:0}]},m)}}})() -;hljs.registerLanguage("powershell",e)})();/*! `prolog` grammar compiled for Highlight.js 11.10.0 */ -(()=>{var n=(()=>{"use strict";return n=>{const e={begin:/\(/,end:/\)/, -relevance:0},a={begin:/\[/,end:/\]/},s={className:"comment",begin:/%/,end:/$/, -contains:[n.PHRASAL_WORDS_MODE]},i={className:"string",begin:/`/,end:/`/, -contains:[n.BACKSLASH_ESCAPE]},g=[{begin:/[a-z][A-Za-z0-9_]*/,relevance:0},{ -className:"symbol",variants:[{begin:/[A-Z][a-zA-Z0-9_]*/},{ -begin:/_[A-Za-z0-9_]*/}],relevance:0},e,{begin:/:-/ -},a,s,n.C_BLOCK_COMMENT_MODE,n.QUOTE_STRING_MODE,n.APOS_STRING_MODE,i,{ -className:"string",begin:/0'(\\'|.)/},{className:"string",begin:/0'\\s/ -},n.C_NUMBER_MODE];return e.contains=g,a.contains=g,{name:"Prolog", -contains:g.concat([{begin:/\.$/}])}}})();hljs.registerLanguage("prolog",n)})();/*! `protobuf` grammar compiled for Highlight.js 11.10.0 */ -(()=>{var e=(()=>{"use strict";return e=>{const s={ -match:[/(message|enum|service)\s+/,e.IDENT_RE],scope:{1:"keyword", -2:"title.class"}};return{name:"Protocol Buffers",aliases:["proto"],keywords:{ -keyword:["package","import","option","optional","required","repeated","group","oneof"], -type:["double","float","int32","int64","uint32","uint64","sint32","sint64","fixed32","fixed64","sfixed32","sfixed64","bool","string","bytes"], -literal:["true","false"]}, -contains:[e.QUOTE_STRING_MODE,e.NUMBER_MODE,e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,s,{ -className:"function",beginKeywords:"rpc",end:/[{;]/,excludeEnd:!0, -keywords:"rpc returns"},{begin:/^\s*[A-Z_]+(?=\s*=[^\n]+;$)/}]}}})() -;hljs.registerLanguage("protobuf",e)})();/*! `python` grammar compiled for Highlight.js 11.10.0 */ -(()=>{var e=(()=>{"use strict";return e=>{ -const n=e.regex,a=/[\p{XID_Start}_]\p{XID_Continue}*/u,s=["and","as","assert","async","await","break","case","class","continue","def","del","elif","else","except","finally","for","from","global","if","import","in","is","lambda","match","nonlocal|10","not","or","pass","raise","return","try","while","with","yield"],t={ -$pattern:/[A-Za-z]\w+|__\w+__/,keyword:s, -built_in:["__import__","abs","all","any","ascii","bin","bool","breakpoint","bytearray","bytes","callable","chr","classmethod","compile","complex","delattr","dict","dir","divmod","enumerate","eval","exec","filter","float","format","frozenset","getattr","globals","hasattr","hash","help","hex","id","input","int","isinstance","issubclass","iter","len","list","locals","map","max","memoryview","min","next","object","oct","open","ord","pow","print","property","range","repr","reversed","round","set","setattr","slice","sorted","staticmethod","str","sum","super","tuple","type","vars","zip"], -literal:["__debug__","Ellipsis","False","None","NotImplemented","True"], -type:["Any","Callable","Coroutine","Dict","List","Literal","Generic","Optional","Sequence","Set","Tuple","Type","Union"] -},i={className:"meta",begin:/^(>>>|\.\.\.) /},r={className:"subst",begin:/\{/, -end:/\}/,keywords:t,illegal:/#/},l={begin:/\{\{/,relevance:0},o={ -className:"string",contains:[e.BACKSLASH_ESCAPE],variants:[{ -begin:/([uU]|[bB]|[rR]|[bB][rR]|[rR][bB])?'''/,end:/'''/, -contains:[e.BACKSLASH_ESCAPE,i],relevance:10},{ -begin:/([uU]|[bB]|[rR]|[bB][rR]|[rR][bB])?"""/,end:/"""/, -contains:[e.BACKSLASH_ESCAPE,i],relevance:10},{ -begin:/([fF][rR]|[rR][fF]|[fF])'''/,end:/'''/, -contains:[e.BACKSLASH_ESCAPE,i,l,r]},{begin:/([fF][rR]|[rR][fF]|[fF])"""/, -end:/"""/,contains:[e.BACKSLASH_ESCAPE,i,l,r]},{begin:/([uU]|[rR])'/,end:/'/, -relevance:10},{begin:/([uU]|[rR])"/,end:/"/,relevance:10},{ -begin:/([bB]|[bB][rR]|[rR][bB])'/,end:/'/},{begin:/([bB]|[bB][rR]|[rR][bB])"/, -end:/"/},{begin:/([fF][rR]|[rR][fF]|[fF])'/,end:/'/, -contains:[e.BACKSLASH_ESCAPE,l,r]},{begin:/([fF][rR]|[rR][fF]|[fF])"/,end:/"/, -contains:[e.BACKSLASH_ESCAPE,l,r]},e.APOS_STRING_MODE,e.QUOTE_STRING_MODE] -},b="[0-9](_?[0-9])*",c=`(\\b(${b}))?\\.(${b})|\\b(${b})\\.`,d="\\b|"+s.join("|"),g={ -className:"number",relevance:0,variants:[{ -begin:`(\\b(${b})|(${c}))[eE][+-]?(${b})[jJ]?(?=${d})`},{begin:`(${c})[jJ]?`},{ -begin:`\\b([1-9](_?[0-9])*|0+(_?0)*)[lLjJ]?(?=${d})`},{ -begin:`\\b0[bB](_?[01])+[lL]?(?=${d})`},{begin:`\\b0[oO](_?[0-7])+[lL]?(?=${d})` -},{begin:`\\b0[xX](_?[0-9a-fA-F])+[lL]?(?=${d})`},{begin:`\\b(${b})[jJ](?=${d})` -}]},p={className:"comment",begin:n.lookahead(/# type:/),end:/$/,keywords:t, -contains:[{begin:/# type:/},{begin:/#/,end:/\b\B/,endsWithParent:!0}]},m={ -className:"params",variants:[{className:"",begin:/\(\s*\)/,skip:!0},{begin:/\(/, -end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:t, -contains:["self",i,g,o,e.HASH_COMMENT_MODE]}]};return r.contains=[o,g,i],{ -name:"Python",aliases:["py","gyp","ipython"],unicodeRegex:!0,keywords:t, -illegal:/(<\/|\?)|=>/,contains:[i,g,{scope:"variable.language",match:/\bself\b/ -},{beginKeywords:"if",relevance:0},{match:/\bor\b/,scope:"keyword" -},o,p,e.HASH_COMMENT_MODE,{match:[/\bdef/,/\s+/,a],scope:{1:"keyword", -3:"title.function"},contains:[m]},{variants:[{ -match:[/\bclass/,/\s+/,a,/\s*/,/\(\s*/,a,/\s*\)/]},{match:[/\bclass/,/\s+/,a]}], -scope:{1:"keyword",3:"title.class",6:"title.class.inherited"}},{ -className:"meta",begin:/^[\t ]*@/,end:/(?=#)|$/,contains:[g,m,o]}]}}})() -;hljs.registerLanguage("python",e)})();/*! `python-repl` grammar compiled for Highlight.js 11.10.0 */ -(()=>{var a=(()=>{"use strict";return a=>({aliases:["pycon"],contains:[{ -className:"meta.prompt",starts:{end:/ |$/,starts:{end:"$",subLanguage:"python"} -},variants:[{begin:/^>>>(?=[ ]|$)/},{begin:/^\.\.\.(?=[ ]|$)/}]}]})})() -;hljs.registerLanguage("python-repl",a)})();/*! `r` grammar compiled for Highlight.js 11.10.0 */ -(()=>{var e=(()=>{"use strict";return e=>{ -const a=e.regex,n=/(?:(?:[a-zA-Z]|\.[._a-zA-Z])[._a-zA-Z0-9]*)|\.(?!\d)/,i=a.either(/0[xX][0-9a-fA-F]+\.[0-9a-fA-F]*[pP][+-]?\d+i?/,/0[xX][0-9a-fA-F]+(?:[pP][+-]?\d+)?[Li]?/,/(?:\d+(?:\.\d*)?|\.\d+)(?:[eE][+-]?\d+)?[Li]?/),s=/[=!<>:]=|\|\||&&|:::?|<-|<<-|->>|->|\|>|[-+*\/?!$&|:<=>@^~]|\*\*/,t=a.either(/[()]/,/[{}]/,/\[\[/,/[[\]]/,/\\/,/,/) -;return{name:"R",keywords:{$pattern:n, -keyword:"function if in break next repeat else for while", -literal:"NULL NA TRUE FALSE Inf NaN NA_integer_|10 NA_real_|10 NA_character_|10 NA_complex_|10", -built_in:"LETTERS letters month.abb month.name pi T F abs acos acosh all any anyNA Arg as.call as.character as.complex as.double as.environment as.integer as.logical as.null.default as.numeric as.raw asin asinh atan atanh attr attributes baseenv browser c call ceiling class Conj cos cosh cospi cummax cummin cumprod cumsum digamma dim dimnames emptyenv exp expression floor forceAndCall gamma gc.time globalenv Im interactive invisible is.array is.atomic is.call is.character is.complex is.double is.environment is.expression is.finite is.function is.infinite is.integer is.language is.list is.logical is.matrix is.na is.name is.nan is.null is.numeric is.object is.pairlist is.raw is.recursive is.single is.symbol lazyLoadDBfetch length lgamma list log max min missing Mod names nargs nzchar oldClass on.exit pos.to.env proc.time prod quote range Re rep retracemem return round seq_along seq_len seq.int sign signif sin sinh sinpi sqrt standardGeneric substitute sum switch tan tanh tanpi tracemem trigamma trunc unclass untracemem UseMethod xtfrm" -},contains:[e.COMMENT(/#'/,/$/,{contains:[{scope:"doctag",match:/@examples/, -starts:{end:a.lookahead(a.either(/\n^#'\s*(?=@[a-zA-Z]+)/,/\n^(?!#')/)), -endsParent:!0}},{scope:"doctag",begin:"@param",end:/$/,contains:[{ -scope:"variable",variants:[{match:n},{match:/`(?:\\.|[^`\\])+`/}],endsParent:!0 -}]},{scope:"doctag",match:/@[a-zA-Z]+/},{scope:"keyword",match:/\\[a-zA-Z]+/}] -}),e.HASH_COMMENT_MODE,{scope:"string",contains:[e.BACKSLASH_ESCAPE], -variants:[e.END_SAME_AS_BEGIN({begin:/[rR]"(-*)\(/,end:/\)(-*)"/ -}),e.END_SAME_AS_BEGIN({begin:/[rR]"(-*)\{/,end:/\}(-*)"/ -}),e.END_SAME_AS_BEGIN({begin:/[rR]"(-*)\[/,end:/\](-*)"/ -}),e.END_SAME_AS_BEGIN({begin:/[rR]'(-*)\(/,end:/\)(-*)'/ -}),e.END_SAME_AS_BEGIN({begin:/[rR]'(-*)\{/,end:/\}(-*)'/ -}),e.END_SAME_AS_BEGIN({begin:/[rR]'(-*)\[/,end:/\](-*)'/}),{begin:'"',end:'"', -relevance:0},{begin:"'",end:"'",relevance:0}]},{relevance:0,variants:[{scope:{ -1:"operator",2:"number"},match:[s,i]},{scope:{1:"operator",2:"number"}, -match:[/%[^%]*%/,i]},{scope:{1:"punctuation",2:"number"},match:[t,i]},{scope:{ -2:"number"},match:[/[^a-zA-Z0-9._]|^/,i]}]},{scope:{3:"operator"}, -match:[n,/\s+/,/<-/,/\s+/]},{scope:"operator",relevance:0,variants:[{match:s},{ -match:/%[^%]*%/}]},{scope:"punctuation",relevance:0,match:t},{begin:"`",end:"`", -contains:[{begin:/\\./}]}]}}})();hljs.registerLanguage("r",e)})();/*! `ruby` grammar compiled for Highlight.js 11.10.0 */ -(()=>{var e=(()=>{"use strict";return e=>{ -const n=e.regex,a="([a-zA-Z_]\\w*[!?=]?|[-+~]@|<<|>>|=~|===?|<=>|[<>]=?|\\*\\*|[-/+%^&*~`|]|\\[\\]=?)",s=n.either(/\b([A-Z]+[a-z0-9]+)+/,/\b([A-Z]+[a-z0-9]+)+[A-Z]+/),i=n.concat(s,/(::\w+)*/),t={ -"variable.constant":["__FILE__","__LINE__","__ENCODING__"], -"variable.language":["self","super"], -keyword:["alias","and","begin","BEGIN","break","case","class","defined","do","else","elsif","end","END","ensure","for","if","in","module","next","not","or","redo","require","rescue","retry","return","then","undef","unless","until","when","while","yield","include","extend","prepend","public","private","protected","raise","throw"], -built_in:["proc","lambda","attr_accessor","attr_reader","attr_writer","define_method","private_constant","module_function"], -literal:["true","false","nil"]},c={className:"doctag",begin:"@[A-Za-z]+"},r={ -begin:"#<",end:">"},b=[e.COMMENT("#","$",{contains:[c] -}),e.COMMENT("^=begin","^=end",{contains:[c],relevance:10 -}),e.COMMENT("^__END__",e.MATCH_NOTHING_RE)],l={className:"subst",begin:/#\{/, -end:/\}/,keywords:t},d={className:"string",contains:[e.BACKSLASH_ESCAPE,l], -variants:[{begin:/'/,end:/'/},{begin:/"/,end:/"/},{begin:/`/,end:/`/},{ -begin:/%[qQwWx]?\(/,end:/\)/},{begin:/%[qQwWx]?\[/,end:/\]/},{ -begin:/%[qQwWx]?\{/,end:/\}/},{begin:/%[qQwWx]?/},{begin:/%[qQwWx]?\//, -end:/\//},{begin:/%[qQwWx]?%/,end:/%/},{begin:/%[qQwWx]?-/,end:/-/},{ -begin:/%[qQwWx]?\|/,end:/\|/},{begin:/\B\?(\\\d{1,3})/},{ -begin:/\B\?(\\x[A-Fa-f0-9]{1,2})/},{begin:/\B\?(\\u\{?[A-Fa-f0-9]{1,6}\}?)/},{ -begin:/\B\?(\\M-\\C-|\\M-\\c|\\c\\M-|\\M-|\\C-\\M-)[\x20-\x7e]/},{ -begin:/\B\?\\(c|C-)[\x20-\x7e]/},{begin:/\B\?\\?\S/},{ -begin:n.concat(/<<[-~]?'?/,n.lookahead(/(\w+)(?=\W)[^\n]*\n(?:[^\n]*\n)*?\s*\1\b/)), -contains:[e.END_SAME_AS_BEGIN({begin:/(\w+)/,end:/(\w+)/, -contains:[e.BACKSLASH_ESCAPE,l]})]}]},o="[0-9](_?[0-9])*",g={className:"number", -relevance:0,variants:[{ -begin:`\\b([1-9](_?[0-9])*|0)(\\.(${o}))?([eE][+-]?(${o})|r)?i?\\b`},{ -begin:"\\b0[dD][0-9](_?[0-9])*r?i?\\b"},{begin:"\\b0[bB][0-1](_?[0-1])*r?i?\\b" -},{begin:"\\b0[oO][0-7](_?[0-7])*r?i?\\b"},{ -begin:"\\b0[xX][0-9a-fA-F](_?[0-9a-fA-F])*r?i?\\b"},{ -begin:"\\b0(_?[0-7])+r?i?\\b"}]},_={variants:[{match:/\(\)/},{ -className:"params",begin:/\(/,end:/(?=\))/,excludeBegin:!0,endsParent:!0, -keywords:t}]},u=[d,{variants:[{match:[/class\s+/,i,/\s+<\s+/,i]},{ -match:[/\b(class|module)\s+/,i]}],scope:{2:"title.class", -4:"title.class.inherited"},keywords:t},{match:[/(include|extend)\s+/,i],scope:{ -2:"title.class"},keywords:t},{relevance:0,match:[i,/\.new[. (]/],scope:{ -1:"title.class"}},{relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/, -className:"variable.constant"},{relevance:0,match:s,scope:"title.class"},{ -match:[/def/,/\s+/,a],scope:{1:"keyword",3:"title.function"},contains:[_]},{ -begin:e.IDENT_RE+"::"},{className:"symbol", -begin:e.UNDERSCORE_IDENT_RE+"(!|\\?)?:",relevance:0},{className:"symbol", -begin:":(?!\\s)",contains:[d,{begin:a}],relevance:0},g,{className:"variable", -begin:"(\\$\\W)|((\\$|@@?)(\\w+))(?=[^@$?])(?![A-Za-z])(?![@$?'])"},{ -className:"params",begin:/\|/,end:/\|/,excludeBegin:!0,excludeEnd:!0, -relevance:0,keywords:t},{begin:"("+e.RE_STARTERS_RE+"|unless)\\s*", -keywords:"unless",contains:[{className:"regexp",contains:[e.BACKSLASH_ESCAPE,l], -illegal:/\n/,variants:[{begin:"/",end:"/[a-z]*"},{begin:/%r\{/,end:/\}[a-z]*/},{ -begin:"%r\\(",end:"\\)[a-z]*"},{begin:"%r!",end:"![a-z]*"},{begin:"%r\\[", -end:"\\][a-z]*"}]}].concat(r,b),relevance:0}].concat(r,b) -;l.contains=u,_.contains=u;const m=[{begin:/^\s*=>/,starts:{end:"$",contains:u} -},{className:"meta.prompt", -begin:"^([>?]>|[\\w#]+\\(\\w+\\):\\d+:\\d+[>*]|(\\w+-)?\\d+\\.\\d+\\.\\d+(p\\d+)?[^\\d][^>]+>)(?=[ ])", -starts:{end:"$",keywords:t,contains:u}}];return b.unshift(r),{name:"Ruby", -aliases:["rb","gemspec","podspec","thor","irb"],keywords:t,illegal:/\/\*/, -contains:[e.SHEBANG({binary:"ruby"})].concat(m).concat(b).concat(u)}}})() -;hljs.registerLanguage("ruby",e)})();/*! `rust` grammar compiled for Highlight.js 11.10.0 */ -(()=>{var e=(()=>{"use strict";return e=>{ -const t=e.regex,n=/(r#)?/,a=t.concat(n,e.UNDERSCORE_IDENT_RE),i=t.concat(n,e.IDENT_RE),r={ -className:"title.function.invoke",relevance:0, -begin:t.concat(/\b/,/(?!let|for|while|if|else|match\b)/,i,t.lookahead(/\s*\(/)) -},s="([ui](8|16|32|64|128|size)|f(32|64))?",l=["drop ","Copy","Send","Sized","Sync","Drop","Fn","FnMut","FnOnce","ToOwned","Clone","Debug","PartialEq","PartialOrd","Eq","Ord","AsRef","AsMut","Into","From","Default","Iterator","Extend","IntoIterator","DoubleEndedIterator","ExactSizeIterator","SliceConcatExt","ToString","assert!","assert_eq!","bitflags!","bytes!","cfg!","col!","concat!","concat_idents!","debug_assert!","debug_assert_eq!","env!","eprintln!","panic!","file!","format!","format_args!","include_bytes!","include_str!","line!","local_data_key!","module_path!","option_env!","print!","println!","select!","stringify!","try!","unimplemented!","unreachable!","vec!","write!","writeln!","macro_rules!","assert_ne!","debug_assert_ne!"],o=["i8","i16","i32","i64","i128","isize","u8","u16","u32","u64","u128","usize","f32","f64","str","char","bool","Box","Option","Result","String","Vec"] -;return{name:"Rust",aliases:["rs"],keywords:{$pattern:e.IDENT_RE+"!?",type:o, -keyword:["abstract","as","async","await","become","box","break","const","continue","crate","do","dyn","else","enum","extern","false","final","fn","for","if","impl","in","let","loop","macro","match","mod","move","mut","override","priv","pub","ref","return","self","Self","static","struct","super","trait","true","try","type","typeof","union","unsafe","unsized","use","virtual","where","while","yield"], -literal:["true","false","Some","None","Ok","Err"],built_in:l},illegal:""},r]}}})() -;hljs.registerLanguage("rust",e)})();/*! `scala` grammar compiled for Highlight.js 11.10.0 */ -(()=>{var e=(()=>{"use strict";return e=>{const n=e.regex,a={className:"subst", -variants:[{begin:"\\$[A-Za-z0-9_]+"},{begin:/\$\{/,end:/\}/}]},s={ -className:"string",variants:[{begin:'"""',end:'"""'},{begin:'"',end:'"', -illegal:"\\n",contains:[e.BACKSLASH_ESCAPE]},{begin:'[a-z]+"',end:'"', -illegal:"\\n",contains:[e.BACKSLASH_ESCAPE,a]},{className:"string", -begin:'[a-z]+"""',end:'"""',contains:[a],relevance:10}]},i={className:"type", -begin:"\\b[A-Z][A-Za-z0-9_]*",relevance:0},t={className:"title", -begin:/[^0-9\n\t "'(),.`{}\[\]:;][^\n\t "'(),.`{}\[\]:;]+|[^0-9\n\t "'(),.`{}\[\]:;=]/, -relevance:0},c={className:"class",beginKeywords:"class object trait type", -end:/[:={\[\n;]/,excludeEnd:!0, -contains:[e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,{ -beginKeywords:"extends with",relevance:10},{begin:/\[/,end:/\]/,excludeBegin:!0, -excludeEnd:!0,relevance:0, -contains:[i,e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},{className:"params", -begin:/\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,relevance:0, -contains:[i,e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},t]},r={ -className:"function",beginKeywords:"def",end:n.lookahead(/[:={\[(\n;]/), -contains:[t]};return{name:"Scala",keywords:{literal:"true false null", -keyword:"type yield lazy override def with val var sealed abstract private trait object if then forSome for while do throw finally protected extends import final return else break new catch super class case package default try this match continue throws implicit export enum given transparent" -},contains:[{begin:["//>",/\s+/,/using/,/\s+/,/\S+/],beginScope:{1:"comment", -3:"keyword",5:"type"},end:/$/,contains:[{className:"string",begin:/\S+/}] -},e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,s,i,r,c,e.C_NUMBER_MODE,{ -begin:[/^\s*/,"extension",/\s+(?=[[(])/],beginScope:{2:"keyword"}},{ -begin:[/^\s*/,/end/,/\s+/,/(extension\b)?/],beginScope:{2:"keyword",4:"keyword"} -},{match:/\.inline\b/},{begin:/\binline(?=\s)/,keywords:"inline"},{ -begin:[/\(\s*/,/using/,/\s+(?!\))/],beginScope:{2:"keyword"}},{className:"meta", -begin:"@[A-Za-z]+"}]}}})();hljs.registerLanguage("scala",e)})();/*! `scss` grammar compiled for Highlight.js 11.10.0 */ -(()=>{var e=(()=>{"use strict" -;const e=["a","abbr","address","article","aside","audio","b","blockquote","body","button","canvas","caption","cite","code","dd","del","details","dfn","div","dl","dt","em","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hgroup","html","i","iframe","img","input","ins","kbd","label","legend","li","main","mark","menu","nav","object","ol","optgroup","option","p","picture","q","quote","samp","section","select","source","span","strong","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","tr","ul","var","video","defs","g","marker","mask","pattern","svg","switch","symbol","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feFlood","feGaussianBlur","feImage","feMerge","feMorphology","feOffset","feSpecularLighting","feTile","feTurbulence","linearGradient","radialGradient","stop","circle","ellipse","image","line","path","polygon","polyline","rect","text","use","textPath","tspan","foreignObject","clipPath"],r=["any-hover","any-pointer","aspect-ratio","color","color-gamut","color-index","device-aspect-ratio","device-height","device-width","display-mode","forced-colors","grid","height","hover","inverted-colors","monochrome","orientation","overflow-block","overflow-inline","pointer","prefers-color-scheme","prefers-contrast","prefers-reduced-motion","prefers-reduced-transparency","resolution","scan","scripting","update","width","min-width","max-width","min-height","max-height"].sort().reverse(),t=["active","any-link","blank","checked","current","default","defined","dir","disabled","drop","empty","enabled","first","first-child","first-of-type","fullscreen","future","focus","focus-visible","focus-within","has","host","host-context","hover","indeterminate","in-range","invalid","is","lang","last-child","last-of-type","left","link","local-link","not","nth-child","nth-col","nth-last-child","nth-last-col","nth-last-of-type","nth-of-type","only-child","only-of-type","optional","out-of-range","past","placeholder-shown","read-only","read-write","required","right","root","scope","target","target-within","user-invalid","valid","visited","where"].sort().reverse(),i=["after","backdrop","before","cue","cue-region","first-letter","first-line","grammar-error","marker","part","placeholder","selection","slotted","spelling-error"].sort().reverse(),o=["accent-color","align-content","align-items","align-self","alignment-baseline","all","animation","animation-delay","animation-direction","animation-duration","animation-fill-mode","animation-iteration-count","animation-name","animation-play-state","animation-timing-function","appearance","backface-visibility","background","background-attachment","background-blend-mode","background-clip","background-color","background-image","background-origin","background-position","background-repeat","background-size","baseline-shift","block-size","border","border-block","border-block-color","border-block-end","border-block-end-color","border-block-end-style","border-block-end-width","border-block-start","border-block-start-color","border-block-start-style","border-block-start-width","border-block-style","border-block-width","border-bottom","border-bottom-color","border-bottom-left-radius","border-bottom-right-radius","border-bottom-style","border-bottom-width","border-collapse","border-color","border-image","border-image-outset","border-image-repeat","border-image-slice","border-image-source","border-image-width","border-inline","border-inline-color","border-inline-end","border-inline-end-color","border-inline-end-style","border-inline-end-width","border-inline-start","border-inline-start-color","border-inline-start-style","border-inline-start-width","border-inline-style","border-inline-width","border-left","border-left-color","border-left-style","border-left-width","border-radius","border-right","border-end-end-radius","border-end-start-radius","border-right-color","border-right-style","border-right-width","border-spacing","border-start-end-radius","border-start-start-radius","border-style","border-top","border-top-color","border-top-left-radius","border-top-right-radius","border-top-style","border-top-width","border-width","bottom","box-decoration-break","box-shadow","box-sizing","break-after","break-before","break-inside","cx","cy","caption-side","caret-color","clear","clip","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","color-scheme","column-count","column-fill","column-gap","column-rule","column-rule-color","column-rule-style","column-rule-width","column-span","column-width","columns","contain","content","content-visibility","counter-increment","counter-reset","cue","cue-after","cue-before","cursor","direction","display","dominant-baseline","empty-cells","enable-background","fill","fill-opacity","fill-rule","filter","flex","flex-basis","flex-direction","flex-flow","flex-grow","flex-shrink","flex-wrap","float","flow","flood-color","flood-opacity","font","font-display","font-family","font-feature-settings","font-kerning","font-language-override","font-size","font-size-adjust","font-smoothing","font-stretch","font-style","font-synthesis","font-variant","font-variant-caps","font-variant-east-asian","font-variant-ligatures","font-variant-numeric","font-variant-position","font-variation-settings","font-weight","gap","glyph-orientation-horizontal","glyph-orientation-vertical","grid","grid-area","grid-auto-columns","grid-auto-flow","grid-auto-rows","grid-column","grid-column-end","grid-column-start","grid-gap","grid-row","grid-row-end","grid-row-start","grid-template","grid-template-areas","grid-template-columns","grid-template-rows","hanging-punctuation","height","hyphens","icon","image-orientation","image-rendering","image-resolution","ime-mode","inline-size","inset","inset-block","inset-block-end","inset-block-start","inset-inline","inset-inline-end","inset-inline-start","isolation","kerning","justify-content","justify-items","justify-self","left","letter-spacing","lighting-color","line-break","line-height","list-style","list-style-image","list-style-position","list-style-type","marker","marker-end","marker-mid","marker-start","mask","margin","margin-block","margin-block-end","margin-block-start","margin-bottom","margin-inline","margin-inline-end","margin-inline-start","margin-left","margin-right","margin-top","marks","mask","mask-border","mask-border-mode","mask-border-outset","mask-border-repeat","mask-border-slice","mask-border-source","mask-border-width","mask-clip","mask-composite","mask-image","mask-mode","mask-origin","mask-position","mask-repeat","mask-size","mask-type","max-block-size","max-height","max-inline-size","max-width","min-block-size","min-height","min-inline-size","min-width","mix-blend-mode","nav-down","nav-index","nav-left","nav-right","nav-up","none","normal","object-fit","object-position","opacity","order","orphans","outline","outline-color","outline-offset","outline-style","outline-width","overflow","overflow-wrap","overflow-x","overflow-y","padding","padding-block","padding-block-end","padding-block-start","padding-bottom","padding-inline","padding-inline-end","padding-inline-start","padding-left","padding-right","padding-top","page-break-after","page-break-before","page-break-inside","pause","pause-after","pause-before","perspective","perspective-origin","pointer-events","position","quotes","r","resize","rest","rest-after","rest-before","right","rotate","row-gap","scale","scroll-margin","scroll-margin-block","scroll-margin-block-end","scroll-margin-block-start","scroll-margin-bottom","scroll-margin-inline","scroll-margin-inline-end","scroll-margin-inline-start","scroll-margin-left","scroll-margin-right","scroll-margin-top","scroll-padding","scroll-padding-block","scroll-padding-block-end","scroll-padding-block-start","scroll-padding-bottom","scroll-padding-inline","scroll-padding-inline-end","scroll-padding-inline-start","scroll-padding-left","scroll-padding-right","scroll-padding-top","scroll-snap-align","scroll-snap-stop","scroll-snap-type","scrollbar-color","scrollbar-gutter","scrollbar-width","shape-image-threshold","shape-margin","shape-outside","shape-rendering","stop-color","stop-opacity","stroke","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","speak","speak-as","src","tab-size","table-layout","text-anchor","text-align","text-align-all","text-align-last","text-combine-upright","text-decoration","text-decoration-color","text-decoration-line","text-decoration-skip-ink","text-decoration-style","text-decoration-thickness","text-emphasis","text-emphasis-color","text-emphasis-position","text-emphasis-style","text-indent","text-justify","text-orientation","text-overflow","text-rendering","text-shadow","text-transform","text-underline-offset","text-underline-position","top","transform","transform-box","transform-origin","transform-style","transition","transition-delay","transition-duration","transition-property","transition-timing-function","translate","unicode-bidi","vector-effect","vertical-align","visibility","voice-balance","voice-duration","voice-family","voice-pitch","voice-range","voice-rate","voice-stress","voice-volume","white-space","widows","width","will-change","word-break","word-spacing","word-wrap","writing-mode","x","y","z-index"].sort().reverse() -;return n=>{const a=(e=>({IMPORTANT:{scope:"meta",begin:"!important"}, -BLOCK_COMMENT:e.C_BLOCK_COMMENT_MODE,HEXCOLOR:{scope:"number", -begin:/#(([0-9a-fA-F]{3,4})|(([0-9a-fA-F]{2}){3,4}))\b/},FUNCTION_DISPATCH:{ -className:"built_in",begin:/[\w-]+(?=\()/},ATTRIBUTE_SELECTOR_MODE:{ -scope:"selector-attr",begin:/\[/,end:/\]/,illegal:"$", -contains:[e.APOS_STRING_MODE,e.QUOTE_STRING_MODE]},CSS_NUMBER_MODE:{ -scope:"number", -begin:e.NUMBER_RE+"(%|em|ex|ch|rem|vw|vh|vmin|vmax|cm|mm|in|pt|pc|px|deg|grad|rad|turn|s|ms|Hz|kHz|dpi|dpcm|dppx)?", -relevance:0},CSS_VARIABLE:{className:"attr",begin:/--[A-Za-z_][A-Za-z0-9_-]*/} -}))(n),l=i,s=t,d="@[a-z-]+",c={className:"variable", -begin:"(\\$[a-zA-Z-][a-zA-Z0-9_-]*)\\b",relevance:0};return{name:"SCSS", -case_insensitive:!0,illegal:"[=/|']", -contains:[n.C_LINE_COMMENT_MODE,n.C_BLOCK_COMMENT_MODE,a.CSS_NUMBER_MODE,{ -className:"selector-id",begin:"#[A-Za-z0-9_-]+",relevance:0},{ -className:"selector-class",begin:"\\.[A-Za-z0-9_-]+",relevance:0 -},a.ATTRIBUTE_SELECTOR_MODE,{className:"selector-tag", -begin:"\\b("+e.join("|")+")\\b",relevance:0},{className:"selector-pseudo", -begin:":("+s.join("|")+")"},{className:"selector-pseudo", -begin:":(:)?("+l.join("|")+")"},c,{begin:/\(/,end:/\)/, -contains:[a.CSS_NUMBER_MODE]},a.CSS_VARIABLE,{className:"attribute", -begin:"\\b("+o.join("|")+")\\b"},{ -begin:"\\b(whitespace|wait|w-resize|visible|vertical-text|vertical-ideographic|uppercase|upper-roman|upper-alpha|underline|transparent|top|thin|thick|text|text-top|text-bottom|tb-rl|table-header-group|table-footer-group|sw-resize|super|strict|static|square|solid|small-caps|separate|se-resize|scroll|s-resize|rtl|row-resize|ridge|right|repeat|repeat-y|repeat-x|relative|progress|pointer|overline|outside|outset|oblique|nowrap|not-allowed|normal|none|nw-resize|no-repeat|no-drop|newspaper|ne-resize|n-resize|move|middle|medium|ltr|lr-tb|lowercase|lower-roman|lower-alpha|loose|list-item|line|line-through|line-edge|lighter|left|keep-all|justify|italic|inter-word|inter-ideograph|inside|inset|inline|inline-block|inherit|inactive|ideograph-space|ideograph-parenthesis|ideograph-numeric|ideograph-alpha|horizontal|hidden|help|hand|groove|fixed|ellipsis|e-resize|double|dotted|distribute|distribute-space|distribute-letter|distribute-all-lines|disc|disabled|default|decimal|dashed|crosshair|collapse|col-resize|circle|char|center|capitalize|break-word|break-all|bottom|both|bolder|bold|block|bidi-override|below|baseline|auto|always|all-scroll|absolute|table|table-cell)\\b" -},{begin:/:/,end:/[;}{]/,relevance:0, -contains:[a.BLOCK_COMMENT,c,a.HEXCOLOR,a.CSS_NUMBER_MODE,n.QUOTE_STRING_MODE,n.APOS_STRING_MODE,a.IMPORTANT,a.FUNCTION_DISPATCH] -},{begin:"@(page|font-face)",keywords:{$pattern:d,keyword:"@page @font-face"}},{ -begin:"@",end:"[{;]",returnBegin:!0,keywords:{$pattern:/[a-z-]+/, -keyword:"and or not only",attribute:r.join(" ")},contains:[{begin:d, -className:"keyword"},{begin:/[a-z-]+(?=:)/,className:"attribute" -},c,n.QUOTE_STRING_MODE,n.APOS_STRING_MODE,a.HEXCOLOR,a.CSS_NUMBER_MODE] -},a.FUNCTION_DISPATCH]}}})();hljs.registerLanguage("scss",e)})();/*! `shell` grammar compiled for Highlight.js 11.10.0 */ -(()=>{var s=(()=>{"use strict";return s=>({name:"Shell Session", -aliases:["console","shellsession"],contains:[{className:"meta.prompt", -begin:/^\s{0,3}[/~\w\d[\]()@-]*[>%$#][ ]?/,starts:{end:/[^\\](?=\s*$)/, -subLanguage:"bash"}}]})})();hljs.registerLanguage("shell",s)})();/*! `sql` grammar compiled for Highlight.js 11.10.0 */ -(()=>{var e=(()=>{"use strict";return e=>{ -const r=e.regex,t=e.COMMENT("--","$"),n=["true","false","unknown"],a=["bigint","binary","blob","boolean","char","character","clob","date","dec","decfloat","decimal","float","int","integer","interval","nchar","nclob","national","numeric","real","row","smallint","time","timestamp","varchar","varying","varbinary"],i=["abs","acos","array_agg","asin","atan","avg","cast","ceil","ceiling","coalesce","corr","cos","cosh","count","covar_pop","covar_samp","cume_dist","dense_rank","deref","element","exp","extract","first_value","floor","json_array","json_arrayagg","json_exists","json_object","json_objectagg","json_query","json_table","json_table_primitive","json_value","lag","last_value","lead","listagg","ln","log","log10","lower","max","min","mod","nth_value","ntile","nullif","percent_rank","percentile_cont","percentile_disc","position","position_regex","power","rank","regr_avgx","regr_avgy","regr_count","regr_intercept","regr_r2","regr_slope","regr_sxx","regr_sxy","regr_syy","row_number","sin","sinh","sqrt","stddev_pop","stddev_samp","substring","substring_regex","sum","tan","tanh","translate","translate_regex","treat","trim","trim_array","unnest","upper","value_of","var_pop","var_samp","width_bucket"],s=["create table","insert into","primary key","foreign key","not null","alter table","add constraint","grouping sets","on overflow","character set","respect nulls","ignore nulls","nulls first","nulls last","depth first","breadth first"],o=i,c=["abs","acos","all","allocate","alter","and","any","are","array","array_agg","array_max_cardinality","as","asensitive","asin","asymmetric","at","atan","atomic","authorization","avg","begin","begin_frame","begin_partition","between","bigint","binary","blob","boolean","both","by","call","called","cardinality","cascaded","case","cast","ceil","ceiling","char","char_length","character","character_length","check","classifier","clob","close","coalesce","collate","collect","column","commit","condition","connect","constraint","contains","convert","copy","corr","corresponding","cos","cosh","count","covar_pop","covar_samp","create","cross","cube","cume_dist","current","current_catalog","current_date","current_default_transform_group","current_path","current_role","current_row","current_schema","current_time","current_timestamp","current_path","current_role","current_transform_group_for_type","current_user","cursor","cycle","date","day","deallocate","dec","decimal","decfloat","declare","default","define","delete","dense_rank","deref","describe","deterministic","disconnect","distinct","double","drop","dynamic","each","element","else","empty","end","end_frame","end_partition","end-exec","equals","escape","every","except","exec","execute","exists","exp","external","extract","false","fetch","filter","first_value","float","floor","for","foreign","frame_row","free","from","full","function","fusion","get","global","grant","group","grouping","groups","having","hold","hour","identity","in","indicator","initial","inner","inout","insensitive","insert","int","integer","intersect","intersection","interval","into","is","join","json_array","json_arrayagg","json_exists","json_object","json_objectagg","json_query","json_table","json_table_primitive","json_value","lag","language","large","last_value","lateral","lead","leading","left","like","like_regex","listagg","ln","local","localtime","localtimestamp","log","log10","lower","match","match_number","match_recognize","matches","max","member","merge","method","min","minute","mod","modifies","module","month","multiset","national","natural","nchar","nclob","new","no","none","normalize","not","nth_value","ntile","null","nullif","numeric","octet_length","occurrences_regex","of","offset","old","omit","on","one","only","open","or","order","out","outer","over","overlaps","overlay","parameter","partition","pattern","per","percent","percent_rank","percentile_cont","percentile_disc","period","portion","position","position_regex","power","precedes","precision","prepare","primary","procedure","ptf","range","rank","reads","real","recursive","ref","references","referencing","regr_avgx","regr_avgy","regr_count","regr_intercept","regr_r2","regr_slope","regr_sxx","regr_sxy","regr_syy","release","result","return","returns","revoke","right","rollback","rollup","row","row_number","rows","running","savepoint","scope","scroll","search","second","seek","select","sensitive","session_user","set","show","similar","sin","sinh","skip","smallint","some","specific","specifictype","sql","sqlexception","sqlstate","sqlwarning","sqrt","start","static","stddev_pop","stddev_samp","submultiset","subset","substring","substring_regex","succeeds","sum","symmetric","system","system_time","system_user","table","tablesample","tan","tanh","then","time","timestamp","timezone_hour","timezone_minute","to","trailing","translate","translate_regex","translation","treat","trigger","trim","trim_array","true","truncate","uescape","union","unique","unknown","unnest","update","upper","user","using","value","values","value_of","var_pop","var_samp","varbinary","varchar","varying","versioning","when","whenever","where","width_bucket","window","with","within","without","year","add","asc","collation","desc","final","first","last","view"].filter((e=>!i.includes(e))),l={ -begin:r.concat(/\b/,r.either(...o),/\s*\(/),relevance:0,keywords:{built_in:o}} -;return{name:"SQL",case_insensitive:!0,illegal:/[{}]|<\//,keywords:{ -$pattern:/\b[\w\.]+/,keyword:((e,{exceptions:r,when:t}={})=>{const n=t -;return r=r||[],e.map((e=>e.match(/\|\d+$/)||r.includes(e)?e:n(e)?e+"|0":e)) -})(c,{when:e=>e.length<3}),literal:n,type:a, -built_in:["current_catalog","current_date","current_default_transform_group","current_path","current_role","current_schema","current_transform_group_for_type","current_user","session_user","system_time","system_user","current_time","localtime","current_timestamp","localtimestamp"] -},contains:[{begin:r.either(...s),relevance:0,keywords:{$pattern:/[\w\.]+/, -keyword:c.concat(s),literal:n,type:a}},{className:"type", -begin:r.either("double precision","large object","with timezone","without timezone") -},l,{className:"variable",begin:/@[a-z0-9][a-z0-9_]*/},{className:"string", -variants:[{begin:/'/,end:/'/,contains:[{begin:/''/}]}]},{begin:/"/,end:/"/, -contains:[{begin:/""/}]},e.C_NUMBER_MODE,e.C_BLOCK_COMMENT_MODE,t,{ -className:"operator",begin:/[-+*/=%^~]|&&?|\|\|?|!=?|<(?:=>?|<|>)?|>[>=]?/, -relevance:0}]}}})();hljs.registerLanguage("sql",e)})();/*! `swift` grammar compiled for Highlight.js 11.10.0 */ -(()=>{var e=(()=>{"use strict";function e(e){ -return e?"string"==typeof e?e:e.source:null}function n(e){return t("(?=",e,")")} -function t(...n){return n.map((n=>e(n))).join("")}function a(...n){const t=(e=>{ -const n=e[e.length-1] -;return"object"==typeof n&&n.constructor===Object?(e.splice(e.length-1,1),n):{} -})(n);return"("+(t.capture?"":"?:")+n.map((n=>e(n))).join("|")+")"} -const i=e=>t(/\b/,e,/\w$/.test(e)?/\b/:/\B/),s=["Protocol","Type"].map(i),c=["init","self"].map(i),u=["Any","Self"],o=["actor","any","associatedtype","async","await",/as\?/,/as!/,"as","borrowing","break","case","catch","class","consume","consuming","continue","convenience","copy","default","defer","deinit","didSet","distributed","do","dynamic","each","else","enum","extension","fallthrough",/fileprivate\(set\)/,"fileprivate","final","for","func","get","guard","if","import","indirect","infix",/init\?/,/init!/,"inout",/internal\(set\)/,"internal","in","is","isolated","nonisolated","lazy","let","macro","mutating","nonmutating",/open\(set\)/,"open","operator","optional","override","package","postfix","precedencegroup","prefix",/private\(set\)/,"private","protocol",/public\(set\)/,"public","repeat","required","rethrows","return","set","some","static","struct","subscript","super","switch","throws","throw",/try\?/,/try!/,"try","typealias",/unowned\(safe\)/,/unowned\(unsafe\)/,"unowned","var","weak","where","while","willSet"],r=["false","nil","true"],l=["assignment","associativity","higherThan","left","lowerThan","none","right"],m=["#colorLiteral","#column","#dsohandle","#else","#elseif","#endif","#error","#file","#fileID","#fileLiteral","#filePath","#function","#if","#imageLiteral","#keyPath","#line","#selector","#sourceLocation","#warning"],p=["abs","all","any","assert","assertionFailure","debugPrint","dump","fatalError","getVaList","isKnownUniquelyReferenced","max","min","numericCast","pointwiseMax","pointwiseMin","precondition","preconditionFailure","print","readLine","repeatElement","sequence","stride","swap","swift_unboxFromSwiftValueWithType","transcode","type","unsafeBitCast","unsafeDowncast","withExtendedLifetime","withUnsafeMutablePointer","withUnsafePointer","withVaList","withoutActuallyEscaping","zip"],d=a(/[/=\-+!*%<>&|^~?]/,/[\u00A1-\u00A7]/,/[\u00A9\u00AB]/,/[\u00AC\u00AE]/,/[\u00B0\u00B1]/,/[\u00B6\u00BB\u00BF\u00D7\u00F7]/,/[\u2016-\u2017]/,/[\u2020-\u2027]/,/[\u2030-\u203E]/,/[\u2041-\u2053]/,/[\u2055-\u205E]/,/[\u2190-\u23FF]/,/[\u2500-\u2775]/,/[\u2794-\u2BFF]/,/[\u2E00-\u2E7F]/,/[\u3001-\u3003]/,/[\u3008-\u3020]/,/[\u3030]/),F=a(d,/[\u0300-\u036F]/,/[\u1DC0-\u1DFF]/,/[\u20D0-\u20FF]/,/[\uFE00-\uFE0F]/,/[\uFE20-\uFE2F]/),b=t(d,F,"*"),h=a(/[a-zA-Z_]/,/[\u00A8\u00AA\u00AD\u00AF\u00B2-\u00B5\u00B7-\u00BA]/,/[\u00BC-\u00BE\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u00FF]/,/[\u0100-\u02FF\u0370-\u167F\u1681-\u180D\u180F-\u1DBF]/,/[\u1E00-\u1FFF]/,/[\u200B-\u200D\u202A-\u202E\u203F-\u2040\u2054\u2060-\u206F]/,/[\u2070-\u20CF\u2100-\u218F\u2460-\u24FF\u2776-\u2793]/,/[\u2C00-\u2DFF\u2E80-\u2FFF]/,/[\u3004-\u3007\u3021-\u302F\u3031-\u303F\u3040-\uD7FF]/,/[\uF900-\uFD3D\uFD40-\uFDCF\uFDF0-\uFE1F\uFE30-\uFE44]/,/[\uFE47-\uFEFE\uFF00-\uFFFD]/),f=a(h,/\d/,/[\u0300-\u036F\u1DC0-\u1DFF\u20D0-\u20FF\uFE20-\uFE2F]/),w=t(h,f,"*"),g=t(/[A-Z]/,f,"*"),y=["attached","autoclosure",t(/convention\(/,a("swift","block","c"),/\)/),"discardableResult","dynamicCallable","dynamicMemberLookup","escaping","freestanding","frozen","GKInspectable","IBAction","IBDesignable","IBInspectable","IBOutlet","IBSegueAction","inlinable","main","nonobjc","NSApplicationMain","NSCopying","NSManaged",t(/objc\(/,w,/\)/),"objc","objcMembers","propertyWrapper","requires_stored_property_inits","resultBuilder","Sendable","testable","UIApplicationMain","unchecked","unknown","usableFromInline","warn_unqualified_access"],v=["iOS","iOSApplicationExtension","macOS","macOSApplicationExtension","macCatalyst","macCatalystApplicationExtension","watchOS","watchOSApplicationExtension","tvOS","tvOSApplicationExtension","swift"] -;return e=>{const d={match:/\s+/,relevance:0},h=e.COMMENT("/\\*","\\*/",{ -contains:["self"]}),E=[e.C_LINE_COMMENT_MODE,h],A={match:[/\./,a(...s,...c)], -className:{2:"keyword"}},C={match:t(/\./,a(...o)),relevance:0 -},k=o.filter((e=>"string"==typeof e)).concat(["_|0"]),N={variants:[{ -className:"keyword", -match:a(...o.filter((e=>"string"!=typeof e)).concat(u).map(i),...c)}]},S={ -$pattern:a(/\b\w+/,/#\w+/),keyword:k.concat(m),literal:r},B=[A,C,N],D=[{ -match:t(/\./,a(...p)),relevance:0},{className:"built_in", -match:t(/\b/,a(...p),/(?=\()/)}],_={match:/->/,relevance:0},M=[_,{ -className:"operator",relevance:0,variants:[{match:b},{match:`\\.(\\.|${F})+`}] -}],x="([0-9]_*)+",L="([0-9a-fA-F]_*)+",$={className:"number",relevance:0, -variants:[{match:`\\b(${x})(\\.(${x}))?([eE][+-]?(${x}))?\\b`},{ -match:`\\b0x(${L})(\\.(${L}))?([pP][+-]?(${x}))?\\b`},{match:/\b0o([0-7]_*)+\b/ -},{match:/\b0b([01]_*)+\b/}]},I=(e="")=>({className:"subst",variants:[{ -match:t(/\\/,e,/[0\\tnr"']/)},{match:t(/\\/,e,/u\{[0-9a-fA-F]{1,8}\}/)}] -}),O=(e="")=>({className:"subst",match:t(/\\/,e,/[\t ]*(?:[\r\n]|\r\n)/) -}),P=(e="")=>({className:"subst",label:"interpol",begin:t(/\\/,e,/\(/),end:/\)/ -}),j=(e="")=>({begin:t(e,/"""/),end:t(/"""/,e),contains:[I(e),O(e),P(e)] -}),K=(e="")=>({begin:t(e,/"/),end:t(/"/,e),contains:[I(e),P(e)]}),T={ -className:"string", -variants:[j(),j("#"),j("##"),j("###"),K(),K("#"),K("##"),K("###")] -},q=[e.BACKSLASH_ESCAPE,{begin:/\[/,end:/\]/,relevance:0, -contains:[e.BACKSLASH_ESCAPE]}],U={begin:/\/[^\s](?=[^/\n]*\/)/,end:/\//, -contains:q},z=e=>{const n=t(e,/\//),a=t(/\//,e);return{begin:n,end:a, -contains:[...q,{scope:"comment",begin:`#(?!.*${a})`,end:/$/}]}},V={ -scope:"regexp",variants:[z("###"),z("##"),z("#"),U]},W={match:t(/`/,w,/`/) -},Z=[W,{className:"variable",match:/\$\d+/},{className:"variable", -match:`\\$${f}+`}],G=[{match:/(@|#(un)?)available/,scope:"keyword",starts:{ -contains:[{begin:/\(/,end:/\)/,keywords:v,contains:[...M,$,T]}]}},{ -scope:"keyword",match:t(/@/,a(...y),n(a(/\(/,/\s+/)))},{scope:"meta", -match:t(/@/,w)}],H={match:n(/\b[A-Z]/),relevance:0,contains:[{className:"type", -match:t(/(AV|CA|CF|CG|CI|CL|CM|CN|CT|MK|MP|MTK|MTL|NS|SCN|SK|UI|WK|XC)/,f,"+") -},{className:"type",match:g,relevance:0},{match:/[?!]+/,relevance:0},{ -match:/\.\.\./,relevance:0},{match:t(/\s+&\s+/,n(g)),relevance:0}]},R={ -begin://,keywords:S,contains:[...E,...B,...G,_,H]};H.contains.push(R) -;const X={begin:/\(/,end:/\)/,relevance:0,keywords:S,contains:["self",{ -match:t(w,/\s*:/),keywords:"_|0",relevance:0 -},...E,V,...B,...D,...M,$,T,...Z,...G,H]},J={begin://, -keywords:"repeat each",contains:[...E,H]},Q={begin:/\(/,end:/\)/,keywords:S, -contains:[{begin:a(n(t(w,/\s*:/)),n(t(w,/\s+/,w,/\s*:/))),end:/:/,relevance:0, -contains:[{className:"keyword",match:/\b_\b/},{className:"params",match:w}] -},...E,...B,...M,$,T,...G,H,X],endsParent:!0,illegal:/["']/},Y={ -match:[/(func|macro)/,/\s+/,a(W.match,w,b)],className:{1:"keyword", -3:"title.function"},contains:[J,Q,d],illegal:[/\[/,/%/]},ee={ -match:[/\b(?:subscript|init[?!]?)/,/\s*(?=[<(])/],className:{1:"keyword"}, -contains:[J,Q,d],illegal:/\[|%/},ne={match:[/operator/,/\s+/,b],className:{ -1:"keyword",3:"title"}},te={begin:[/precedencegroup/,/\s+/,g],className:{ -1:"keyword",3:"title"},contains:[H],keywords:[...l,...r],end:/}/},ae={ -begin:[/(struct|protocol|class|extension|enum|actor)/,/\s+/,w,/\s*/], -beginScope:{1:"keyword",3:"title.class"},keywords:S,contains:[J,...B,{begin:/:/, -end:/\{/,keywords:S,contains:[{scope:"title.class.inherited",match:g},...B], -relevance:0}]};for(const e of T.variants){ -const n=e.contains.find((e=>"interpol"===e.label));n.keywords=S -;const t=[...B,...D,...M,$,T,...Z];n.contains=[...t,{begin:/\(/,end:/\)/, -contains:["self",...t]}]}return{name:"Swift",keywords:S, -contains:[...E,Y,ee,ae,ne,te,{beginKeywords:"import",end:/$/,contains:[...E], -relevance:0},V,...B,...D,...M,$,T,...Z,...G,H,X]}}})() -;hljs.registerLanguage("swift",e)})();/*! `typescript` grammar compiled for Highlight.js 11.10.0 */ -(()=>{var e=(()=>{"use strict" -;const e="[A-Za-z$_][0-9A-Za-z$_]*",n=["as","in","of","if","for","while","finally","var","new","function","do","return","void","else","break","catch","instanceof","with","throw","case","default","try","switch","continue","typeof","delete","let","yield","const","class","debugger","async","await","static","import","from","export","extends"],a=["true","false","null","undefined","NaN","Infinity"],t=["Object","Function","Boolean","Symbol","Math","Date","Number","BigInt","String","RegExp","Array","Float32Array","Float64Array","Int8Array","Uint8Array","Uint8ClampedArray","Int16Array","Int32Array","Uint16Array","Uint32Array","BigInt64Array","BigUint64Array","Set","Map","WeakSet","WeakMap","ArrayBuffer","SharedArrayBuffer","Atomics","DataView","JSON","Promise","Generator","GeneratorFunction","AsyncFunction","Reflect","Proxy","Intl","WebAssembly"],s=["Error","EvalError","InternalError","RangeError","ReferenceError","SyntaxError","TypeError","URIError"],r=["setInterval","setTimeout","clearInterval","clearTimeout","require","exports","eval","isFinite","isNaN","parseFloat","parseInt","decodeURI","decodeURIComponent","encodeURI","encodeURIComponent","escape","unescape"],c=["arguments","this","super","console","window","document","localStorage","sessionStorage","module","global"],i=[].concat(r,t,s) -;function o(o){const l=o.regex,d=e,b={begin:/<[A-Za-z0-9\\._:-]+/, -end:/\/[A-Za-z0-9\\._:-]+>|\/>/,isTrulyOpeningTag:(e,n)=>{ -const a=e[0].length+e.index,t=e.input[a] -;if("<"===t||","===t)return void n.ignoreMatch();let s -;">"===t&&(((e,{after:n})=>{const a="e+"\\s*\\(")), -l.concat("(?!",C.join("|"),")")),d,l.lookahead(/\s*\(/)), -className:"title.function",relevance:0};var C;const T={ -begin:l.concat(/\./,l.lookahead(l.concat(d,/(?![0-9A-Za-z$_(])/))),end:d, -excludeBegin:!0,keywords:"prototype",className:"property",relevance:0},M={ -match:[/get|set/,/\s+/,d,/(?=\()/],className:{1:"keyword",3:"title.function"}, -contains:[{begin:/\(\)/},R] -},B="(\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)|"+o.UNDERSCORE_IDENT_RE+")\\s*=>",$={ -match:[/const|var|let/,/\s+/,d,/\s*/,/=\s*/,/(async\s*)?/,l.lookahead(B)], -keywords:"async",className:{1:"keyword",3:"title.function"},contains:[R]} -;return{name:"JavaScript",aliases:["js","jsx","mjs","cjs"],keywords:g,exports:{ -PARAMS_CONTAINS:w,CLASS_REFERENCE:x},illegal:/#(?![$_A-z])/, -contains:[o.SHEBANG({label:"shebang",binary:"node",relevance:5}),{ -label:"use_strict",className:"meta",relevance:10, -begin:/^\s*['"]use (strict|asm)['"]/ -},o.APOS_STRING_MODE,o.QUOTE_STRING_MODE,p,N,f,_,h,{match:/\$\d+/},A,x,{ -className:"attr",begin:d+l.lookahead(":"),relevance:0},$,{ -begin:"("+o.RE_STARTERS_RE+"|\\b(case|return|throw)\\b)\\s*", -keywords:"return throw case",relevance:0,contains:[h,o.REGEXP_MODE,{ -className:"function",begin:B,returnBegin:!0,end:"\\s*=>",contains:[{ -className:"params",variants:[{begin:o.UNDERSCORE_IDENT_RE,relevance:0},{ -className:null,begin:/\(\s*\)/,skip:!0},{begin:/(\s*)\(/,end:/\)/, -excludeBegin:!0,excludeEnd:!0,keywords:g,contains:w}]}]},{begin:/,/,relevance:0 -},{match:/\s+/,relevance:0},{variants:[{begin:"<>",end:""},{ -match:/<[A-Za-z0-9\\._:-]+\s*\/>/},{begin:b.begin, -"on:begin":b.isTrulyOpeningTag,end:b.end}],subLanguage:"xml",contains:[{ -begin:b.begin,end:b.end,skip:!0,contains:["self"]}]}]},O,{ -beginKeywords:"while if switch catch for"},{ -begin:"\\b(?!function)"+o.UNDERSCORE_IDENT_RE+"\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)\\s*\\{", -returnBegin:!0,label:"func.def",contains:[R,o.inherit(o.TITLE_MODE,{begin:d, -className:"title.function"})]},{match:/\.\.\./,relevance:0},T,{match:"\\$"+d, -relevance:0},{match:[/\bconstructor(?=\s*\()/],className:{1:"title.function"}, -contains:[R]},I,{relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/, -className:"variable.constant"},k,M,{match:/\$[(.]/}]}}return t=>{ -const s=o(t),r=e,l=["any","void","number","boolean","string","object","never","symbol","bigint","unknown"],d={ -begin:[/namespace/,/\s+/,t.IDENT_RE],beginScope:{1:"keyword",3:"title.class"} -},b={beginKeywords:"interface",end:/\{/,excludeEnd:!0,keywords:{ -keyword:"interface extends",built_in:l},contains:[s.exports.CLASS_REFERENCE] -},g={$pattern:e, -keyword:n.concat(["type","interface","public","private","protected","implements","declare","abstract","readonly","enum","override","satisfies"]), -literal:a,built_in:i.concat(l),"variable.language":c},u={className:"meta", -begin:"@"+r},m=(e,n,a)=>{const t=e.contains.findIndex((e=>e.label===n)) -;if(-1===t)throw Error("can not find mode to replace");e.contains.splice(t,1,a)} -;Object.assign(s.keywords,g),s.exports.PARAMS_CONTAINS.push(u) -;const E=s.contains.find((e=>"attr"===e.className)) -;return s.exports.PARAMS_CONTAINS.push([s.exports.CLASS_REFERENCE,E]), -s.contains=s.contains.concat([u,d,b]), -m(s,"shebang",t.SHEBANG()),m(s,"use_strict",{className:"meta",relevance:10, -begin:/^\s*['"]use strict['"]/ -}),s.contains.find((e=>"func.def"===e.label)).relevance=0,Object.assign(s,{ -name:"TypeScript",aliases:["ts","tsx","mts","cts"]}),s}})() -;hljs.registerLanguage("typescript",e)})();/*! `vbnet` grammar compiled for Highlight.js 11.10.0 */ -(()=>{var e=(()=>{"use strict";return e=>{ -const n=e.regex,t=/\d{1,2}\/\d{1,2}\/\d{4}/,a=/\d{4}-\d{1,2}-\d{1,2}/,i=/(\d|1[012])(:\d+){0,2} *(AM|PM)/,s=/\d{1,2}(:\d{1,2}){1,2}/,r={ -className:"literal",variants:[{begin:n.concat(/# */,n.either(a,t),/ *#/)},{ -begin:n.concat(/# */,s,/ *#/)},{begin:n.concat(/# */,i,/ *#/)},{ -begin:n.concat(/# */,n.either(a,t),/ +/,n.either(i,s),/ *#/)}] -},l=e.COMMENT(/'''/,/$/,{contains:[{className:"doctag",begin:/<\/?/,end:/>/}] -}),o=e.COMMENT(null,/$/,{variants:[{begin:/'/},{begin:/([\t ]|^)REM(?=\s)/}]}) -;return{name:"Visual Basic .NET",aliases:["vb"],case_insensitive:!0, -classNameAliases:{label:"symbol"},keywords:{ -keyword:"addhandler alias aggregate ansi as async assembly auto binary by byref byval call case catch class compare const continue custom declare default delegate dim distinct do each equals else elseif end enum erase error event exit explicit finally for friend from function get global goto group handles if implements imports in inherits interface into iterator join key let lib loop me mid module mustinherit mustoverride mybase myclass namespace narrowing new next notinheritable notoverridable of off on operator option optional order overloads overridable overrides paramarray partial preserve private property protected public raiseevent readonly redim removehandler resume return select set shadows shared skip static step stop structure strict sub synclock take text then throw to try unicode until using when where while widening with withevents writeonly yield", -built_in:"addressof and andalso await directcast gettype getxmlnamespace is isfalse isnot istrue like mod nameof new not or orelse trycast typeof xor cbool cbyte cchar cdate cdbl cdec cint clng cobj csbyte cshort csng cstr cuint culng cushort", -type:"boolean byte char date decimal double integer long object sbyte short single string uinteger ulong ushort", -literal:"true false nothing"}, -illegal:"//|\\{|\\}|endif|gosub|variant|wend|^\\$ ",contains:[{ -className:"string",begin:/"(""|[^/n])"C\b/},{className:"string",begin:/"/, -end:/"/,illegal:/\n/,contains:[{begin:/""/}]},r,{className:"number",relevance:0, -variants:[{begin:/\b\d[\d_]*((\.[\d_]+(E[+-]?[\d_]+)?)|(E[+-]?[\d_]+))[RFD@!#]?/ -},{begin:/\b\d[\d_]*((U?[SIL])|[%&])?/},{begin:/&H[\dA-F_]+((U?[SIL])|[%&])?/},{ -begin:/&O[0-7_]+((U?[SIL])|[%&])?/},{begin:/&B[01_]+((U?[SIL])|[%&])?/}]},{ -className:"label",begin:/^\w+:/},l,o,{className:"meta", -begin:/[\t ]*#(const|disable|else|elseif|enable|end|externalsource|if|region)\b/, -end:/$/,keywords:{ -keyword:"const disable else elseif enable end externalsource if region then"}, -contains:[o]}]}}})();hljs.registerLanguage("vbnet",e)})();/*! `vbscript` grammar compiled for Highlight.js 11.10.0 */ -(()=>{var e=(()=>{"use strict";return e=>{ -const t=e.regex,r=["lcase","month","vartype","instrrev","ubound","setlocale","getobject","rgb","getref","string","weekdayname","rnd","dateadd","monthname","now","day","minute","isarray","cbool","round","formatcurrency","conversions","csng","timevalue","second","year","space","abs","clng","timeserial","fixs","len","asc","isempty","maths","dateserial","atn","timer","isobject","filter","weekday","datevalue","ccur","isdate","instr","datediff","formatdatetime","replace","isnull","right","sgn","array","snumeric","log","cdbl","hex","chr","lbound","msgbox","ucase","getlocale","cos","cdate","cbyte","rtrim","join","hour","oct","typename","trim","strcomp","int","createobject","loadpicture","tan","formatnumber","mid","split","cint","sin","datepart","ltrim","sqr","time","derived","eval","date","formatpercent","exp","inputbox","left","ascw","chrw","regexp","cstr","err"] -;return{name:"VBScript",aliases:["vbs"],case_insensitive:!0,keywords:{ -keyword:["call","class","const","dim","do","loop","erase","execute","executeglobal","exit","for","each","next","function","if","then","else","on","error","option","explicit","new","private","property","let","get","public","randomize","redim","rem","select","case","set","stop","sub","while","wend","with","end","to","elseif","is","or","xor","and","not","class_initialize","class_terminate","default","preserve","in","me","byval","byref","step","resume","goto"], -built_in:["server","response","request","scriptengine","scriptenginebuildversion","scriptengineminorversion","scriptenginemajorversion"], -literal:["true","false","null","nothing","empty"]},illegal:"//",contains:[{ -begin:t.concat(t.either(...r),"\\s*\\("),relevance:0,keywords:{built_in:r} -},e.inherit(e.QUOTE_STRING_MODE,{contains:[{begin:'""'}]}),e.COMMENT(/'/,/$/,{ -relevance:0}),e.C_NUMBER_MODE]}}})();hljs.registerLanguage("vbscript",e)})();/*! `wasm` grammar compiled for Highlight.js 11.10.0 */ -(()=>{var e=(()=>{"use strict";return e=>{e.regex;const a=e.COMMENT(/\(;/,/;\)/) -;return a.contains.push("self"),{name:"WebAssembly",keywords:{$pattern:/[\w.]+/, -keyword:["anyfunc","block","br","br_if","br_table","call","call_indirect","data","drop","elem","else","end","export","func","global.get","global.set","local.get","local.set","local.tee","get_global","get_local","global","if","import","local","loop","memory","memory.grow","memory.size","module","mut","nop","offset","param","result","return","select","set_global","set_local","start","table","tee_local","then","type","unreachable"] -},contains:[e.COMMENT(/;;/,/$/),a,{match:[/(?:offset|align)/,/\s*/,/=/], -className:{1:"keyword",3:"operator"}},{className:"variable",begin:/\$[\w_]+/},{ -match:/(\((?!;)|\))+/,className:"punctuation",relevance:0},{ -begin:[/(?:func|call|call_indirect)/,/\s+/,/\$[^\s)]+/],className:{1:"keyword", -3:"title.function"}},e.QUOTE_STRING_MODE,{match:/(i32|i64|f32|f64)(?!\.)/, -className:"type"},{className:"keyword", -match:/\b(f32|f64|i32|i64)(?:\.(?:abs|add|and|ceil|clz|const|convert_[su]\/i(?:32|64)|copysign|ctz|demote\/f64|div(?:_[su])?|eqz?|extend_[su]\/i32|floor|ge(?:_[su])?|gt(?:_[su])?|le(?:_[su])?|load(?:(?:8|16|32)_[su])?|lt(?:_[su])?|max|min|mul|nearest|neg?|or|popcnt|promote\/f32|reinterpret\/[fi](?:32|64)|rem_[su]|rot[lr]|shl|shr_[su]|store(?:8|16|32)?|sqrt|sub|trunc(?:_[su]\/f(?:32|64))?|wrap\/i64|xor))\b/ -},{className:"number",relevance:0, -match:/[+-]?\b(?:\d(?:_?\d)*(?:\.\d(?:_?\d)*)?(?:[eE][+-]?\d(?:_?\d)*)?|0x[\da-fA-F](?:_?[\da-fA-F])*(?:\.[\da-fA-F](?:_?[\da-fA-D])*)?(?:[pP][+-]?\d(?:_?\d)*)?)\b|\binf\b|\bnan(?::0x[\da-fA-F](?:_?[\da-fA-D])*)?\b/ -}]}}})();hljs.registerLanguage("wasm",e)})();/*! `x86asm` grammar compiled for Highlight.js 11.10.0 */ -(()=>{var s=(()=>{"use strict";return s=>({name:"Intel x86 Assembly", -case_insensitive:!0,keywords:{$pattern:"[.%]?"+s.IDENT_RE, -keyword:"lock rep repe repz repne repnz xaquire xrelease bnd nobnd aaa aad aam aas adc add and arpl bb0_reset bb1_reset bound bsf bsr bswap bt btc btr bts call cbw cdq cdqe clc cld cli clts cmc cmp cmpsb cmpsd cmpsq cmpsw cmpxchg cmpxchg486 cmpxchg8b cmpxchg16b cpuid cpu_read cpu_write cqo cwd cwde daa das dec div dmint emms enter equ f2xm1 fabs fadd faddp fbld fbstp fchs fclex fcmovb fcmovbe fcmove fcmovnb fcmovnbe fcmovne fcmovnu fcmovu fcom fcomi fcomip fcomp fcompp fcos fdecstp fdisi fdiv fdivp fdivr fdivrp femms feni ffree ffreep fiadd ficom ficomp fidiv fidivr fild fimul fincstp finit fist fistp fisttp fisub fisubr fld fld1 fldcw fldenv fldl2e fldl2t fldlg2 fldln2 fldpi fldz fmul fmulp fnclex fndisi fneni fninit fnop fnsave fnstcw fnstenv fnstsw fpatan fprem fprem1 fptan frndint frstor fsave fscale fsetpm fsin fsincos fsqrt fst fstcw fstenv fstp fstsw fsub fsubp fsubr fsubrp ftst fucom fucomi fucomip fucomp fucompp fxam fxch fxtract fyl2x fyl2xp1 hlt ibts icebp idiv imul in inc incbin insb insd insw int int01 int1 int03 int3 into invd invpcid invlpg invlpga iret iretd iretq iretw jcxz jecxz jrcxz jmp jmpe lahf lar lds lea leave les lfence lfs lgdt lgs lidt lldt lmsw loadall loadall286 lodsb lodsd lodsq lodsw loop loope loopne loopnz loopz lsl lss ltr mfence monitor mov movd movq movsb movsd movsq movsw movsx movsxd movzx mul mwait neg nop not or out outsb outsd outsw packssdw packsswb packuswb paddb paddd paddsb paddsiw paddsw paddusb paddusw paddw pand pandn pause paveb pavgusb pcmpeqb pcmpeqd pcmpeqw pcmpgtb pcmpgtd pcmpgtw pdistib pf2id pfacc pfadd pfcmpeq pfcmpge pfcmpgt pfmax pfmin pfmul pfrcp pfrcpit1 pfrcpit2 pfrsqit1 pfrsqrt pfsub pfsubr pi2fd pmachriw pmaddwd pmagw pmulhriw pmulhrwa pmulhrwc pmulhw pmullw pmvgezb pmvlzb pmvnzb pmvzb pop popa popad popaw popf popfd popfq popfw por prefetch prefetchw pslld psllq psllw psrad psraw psrld psrlq psrlw psubb psubd psubsb psubsiw psubsw psubusb psubusw psubw punpckhbw punpckhdq punpckhwd punpcklbw punpckldq punpcklwd push pusha pushad pushaw pushf pushfd pushfq pushfw pxor rcl rcr rdshr rdmsr rdpmc rdtsc rdtscp ret retf retn rol ror rdm rsdc rsldt rsm rsts sahf sal salc sar sbb scasb scasd scasq scasw sfence sgdt shl shld shr shrd sidt sldt skinit smi smint smintold smsw stc std sti stosb stosd stosq stosw str sub svdc svldt svts swapgs syscall sysenter sysexit sysret test ud0 ud1 ud2b ud2 ud2a umov verr verw fwait wbinvd wrshr wrmsr xadd xbts xchg xlatb xlat xor cmove cmovz cmovne cmovnz cmova cmovnbe cmovae cmovnb cmovb cmovnae cmovbe cmovna cmovg cmovnle cmovge cmovnl cmovl cmovnge cmovle cmovng cmovc cmovnc cmovo cmovno cmovs cmovns cmovp cmovpe cmovnp cmovpo je jz jne jnz ja jnbe jae jnb jb jnae jbe jna jg jnle jge jnl jl jnge jle jng jc jnc jo jno js jns jpo jnp jpe jp sete setz setne setnz seta setnbe setae setnb setnc setb setnae setcset setbe setna setg setnle setge setnl setl setnge setle setng sets setns seto setno setpe setp setpo setnp addps addss andnps andps cmpeqps cmpeqss cmpleps cmpless cmpltps cmpltss cmpneqps cmpneqss cmpnleps cmpnless cmpnltps cmpnltss cmpordps cmpordss cmpunordps cmpunordss cmpps cmpss comiss cvtpi2ps cvtps2pi cvtsi2ss cvtss2si cvttps2pi cvttss2si divps divss ldmxcsr maxps maxss minps minss movaps movhps movlhps movlps movhlps movmskps movntps movss movups mulps mulss orps rcpps rcpss rsqrtps rsqrtss shufps sqrtps sqrtss stmxcsr subps subss ucomiss unpckhps unpcklps xorps fxrstor fxrstor64 fxsave fxsave64 xgetbv xsetbv xsave xsave64 xsaveopt xsaveopt64 xrstor xrstor64 prefetchnta prefetcht0 prefetcht1 prefetcht2 maskmovq movntq pavgb pavgw pextrw pinsrw pmaxsw pmaxub pminsw pminub pmovmskb pmulhuw psadbw pshufw pf2iw pfnacc pfpnacc pi2fw pswapd maskmovdqu clflush movntdq movnti movntpd movdqa movdqu movdq2q movq2dq paddq pmuludq pshufd pshufhw pshuflw pslldq psrldq psubq punpckhqdq punpcklqdq addpd addsd andnpd andpd cmpeqpd cmpeqsd cmplepd cmplesd cmpltpd cmpltsd cmpneqpd cmpneqsd cmpnlepd cmpnlesd cmpnltpd cmpnltsd cmpordpd cmpordsd cmpunordpd cmpunordsd cmppd comisd cvtdq2pd cvtdq2ps cvtpd2dq cvtpd2pi cvtpd2ps cvtpi2pd cvtps2dq cvtps2pd cvtsd2si cvtsd2ss cvtsi2sd cvtss2sd cvttpd2pi cvttpd2dq cvttps2dq cvttsd2si divpd divsd maxpd maxsd minpd minsd movapd movhpd movlpd movmskpd movupd mulpd mulsd orpd shufpd sqrtpd sqrtsd subpd subsd ucomisd unpckhpd unpcklpd xorpd addsubpd addsubps haddpd haddps hsubpd hsubps lddqu movddup movshdup movsldup clgi stgi vmcall vmclear vmfunc vmlaunch vmload vmmcall vmptrld vmptrst vmread vmresume vmrun vmsave vmwrite vmxoff vmxon invept invvpid pabsb pabsw pabsd palignr phaddw phaddd phaddsw phsubw phsubd phsubsw pmaddubsw pmulhrsw pshufb psignb psignw psignd extrq insertq movntsd movntss lzcnt blendpd blendps blendvpd blendvps dppd dpps extractps insertps movntdqa mpsadbw packusdw pblendvb pblendw pcmpeqq pextrb pextrd pextrq phminposuw pinsrb pinsrd pinsrq pmaxsb pmaxsd pmaxud pmaxuw pminsb pminsd pminud pminuw pmovsxbw pmovsxbd pmovsxbq pmovsxwd pmovsxwq pmovsxdq pmovzxbw pmovzxbd pmovzxbq pmovzxwd pmovzxwq pmovzxdq pmuldq pmulld ptest roundpd roundps roundsd roundss crc32 pcmpestri pcmpestrm pcmpistri pcmpistrm pcmpgtq popcnt getsec pfrcpv pfrsqrtv movbe aesenc aesenclast aesdec aesdeclast aesimc aeskeygenassist vaesenc vaesenclast vaesdec vaesdeclast vaesimc vaeskeygenassist vaddpd vaddps vaddsd vaddss vaddsubpd vaddsubps vandpd vandps vandnpd vandnps vblendpd vblendps vblendvpd vblendvps vbroadcastss vbroadcastsd vbroadcastf128 vcmpeq_ospd vcmpeqpd vcmplt_ospd vcmpltpd vcmple_ospd vcmplepd vcmpunord_qpd vcmpunordpd vcmpneq_uqpd vcmpneqpd vcmpnlt_uspd vcmpnltpd vcmpnle_uspd vcmpnlepd vcmpord_qpd vcmpordpd vcmpeq_uqpd vcmpnge_uspd vcmpngepd vcmpngt_uspd vcmpngtpd vcmpfalse_oqpd vcmpfalsepd vcmpneq_oqpd vcmpge_ospd vcmpgepd vcmpgt_ospd vcmpgtpd vcmptrue_uqpd vcmptruepd vcmplt_oqpd vcmple_oqpd vcmpunord_spd vcmpneq_uspd vcmpnlt_uqpd vcmpnle_uqpd vcmpord_spd vcmpeq_uspd vcmpnge_uqpd vcmpngt_uqpd vcmpfalse_ospd vcmpneq_ospd vcmpge_oqpd vcmpgt_oqpd vcmptrue_uspd vcmppd vcmpeq_osps vcmpeqps vcmplt_osps vcmpltps vcmple_osps vcmpleps vcmpunord_qps vcmpunordps vcmpneq_uqps vcmpneqps vcmpnlt_usps vcmpnltps vcmpnle_usps vcmpnleps vcmpord_qps vcmpordps vcmpeq_uqps vcmpnge_usps vcmpngeps vcmpngt_usps vcmpngtps vcmpfalse_oqps vcmpfalseps vcmpneq_oqps vcmpge_osps vcmpgeps vcmpgt_osps vcmpgtps vcmptrue_uqps vcmptrueps vcmplt_oqps vcmple_oqps vcmpunord_sps vcmpneq_usps vcmpnlt_uqps vcmpnle_uqps vcmpord_sps vcmpeq_usps vcmpnge_uqps vcmpngt_uqps vcmpfalse_osps vcmpneq_osps vcmpge_oqps vcmpgt_oqps vcmptrue_usps vcmpps vcmpeq_ossd vcmpeqsd vcmplt_ossd vcmpltsd vcmple_ossd vcmplesd vcmpunord_qsd vcmpunordsd vcmpneq_uqsd vcmpneqsd vcmpnlt_ussd vcmpnltsd vcmpnle_ussd vcmpnlesd vcmpord_qsd vcmpordsd vcmpeq_uqsd vcmpnge_ussd vcmpngesd vcmpngt_ussd vcmpngtsd vcmpfalse_oqsd vcmpfalsesd vcmpneq_oqsd vcmpge_ossd vcmpgesd vcmpgt_ossd vcmpgtsd vcmptrue_uqsd vcmptruesd vcmplt_oqsd vcmple_oqsd vcmpunord_ssd vcmpneq_ussd vcmpnlt_uqsd vcmpnle_uqsd vcmpord_ssd vcmpeq_ussd vcmpnge_uqsd vcmpngt_uqsd vcmpfalse_ossd vcmpneq_ossd vcmpge_oqsd vcmpgt_oqsd vcmptrue_ussd vcmpsd vcmpeq_osss vcmpeqss vcmplt_osss vcmpltss vcmple_osss vcmpless vcmpunord_qss vcmpunordss vcmpneq_uqss vcmpneqss vcmpnlt_usss vcmpnltss vcmpnle_usss vcmpnless vcmpord_qss vcmpordss vcmpeq_uqss vcmpnge_usss vcmpngess vcmpngt_usss vcmpngtss vcmpfalse_oqss vcmpfalsess vcmpneq_oqss vcmpge_osss vcmpgess vcmpgt_osss vcmpgtss vcmptrue_uqss vcmptruess vcmplt_oqss vcmple_oqss vcmpunord_sss vcmpneq_usss vcmpnlt_uqss vcmpnle_uqss vcmpord_sss vcmpeq_usss vcmpnge_uqss vcmpngt_uqss vcmpfalse_osss vcmpneq_osss vcmpge_oqss vcmpgt_oqss vcmptrue_usss vcmpss vcomisd vcomiss vcvtdq2pd vcvtdq2ps vcvtpd2dq vcvtpd2ps vcvtps2dq vcvtps2pd vcvtsd2si vcvtsd2ss vcvtsi2sd vcvtsi2ss vcvtss2sd vcvtss2si vcvttpd2dq vcvttps2dq vcvttsd2si vcvttss2si vdivpd vdivps vdivsd vdivss vdppd vdpps vextractf128 vextractps vhaddpd vhaddps vhsubpd vhsubps vinsertf128 vinsertps vlddqu vldqqu vldmxcsr vmaskmovdqu vmaskmovps vmaskmovpd vmaxpd vmaxps vmaxsd vmaxss vminpd vminps vminsd vminss vmovapd vmovaps vmovd vmovq vmovddup vmovdqa vmovqqa vmovdqu vmovqqu vmovhlps vmovhpd vmovhps vmovlhps vmovlpd vmovlps vmovmskpd vmovmskps vmovntdq vmovntqq vmovntdqa vmovntpd vmovntps vmovsd vmovshdup vmovsldup vmovss vmovupd vmovups vmpsadbw vmulpd vmulps vmulsd vmulss vorpd vorps vpabsb vpabsw vpabsd vpacksswb vpackssdw vpackuswb vpackusdw vpaddb vpaddw vpaddd vpaddq vpaddsb vpaddsw vpaddusb vpaddusw vpalignr vpand vpandn vpavgb vpavgw vpblendvb vpblendw vpcmpestri vpcmpestrm vpcmpistri vpcmpistrm vpcmpeqb vpcmpeqw vpcmpeqd vpcmpeqq vpcmpgtb vpcmpgtw vpcmpgtd vpcmpgtq vpermilpd vpermilps vperm2f128 vpextrb vpextrw vpextrd vpextrq vphaddw vphaddd vphaddsw vphminposuw vphsubw vphsubd vphsubsw vpinsrb vpinsrw vpinsrd vpinsrq vpmaddwd vpmaddubsw vpmaxsb vpmaxsw vpmaxsd vpmaxub vpmaxuw vpmaxud vpminsb vpminsw vpminsd vpminub vpminuw vpminud vpmovmskb vpmovsxbw vpmovsxbd vpmovsxbq vpmovsxwd vpmovsxwq vpmovsxdq vpmovzxbw vpmovzxbd vpmovzxbq vpmovzxwd vpmovzxwq vpmovzxdq vpmulhuw vpmulhrsw vpmulhw vpmullw vpmulld vpmuludq vpmuldq vpor vpsadbw vpshufb vpshufd vpshufhw vpshuflw vpsignb vpsignw vpsignd vpslldq vpsrldq vpsllw vpslld vpsllq vpsraw vpsrad vpsrlw vpsrld vpsrlq vptest vpsubb vpsubw vpsubd vpsubq vpsubsb vpsubsw vpsubusb vpsubusw vpunpckhbw vpunpckhwd vpunpckhdq vpunpckhqdq vpunpcklbw vpunpcklwd vpunpckldq vpunpcklqdq vpxor vrcpps vrcpss vrsqrtps vrsqrtss vroundpd vroundps vroundsd vroundss vshufpd vshufps vsqrtpd vsqrtps vsqrtsd vsqrtss vstmxcsr vsubpd vsubps vsubsd vsubss vtestps vtestpd vucomisd vucomiss vunpckhpd vunpckhps vunpcklpd vunpcklps vxorpd vxorps vzeroall vzeroupper pclmullqlqdq pclmulhqlqdq pclmullqhqdq pclmulhqhqdq pclmulqdq vpclmullqlqdq vpclmulhqlqdq vpclmullqhqdq vpclmulhqhqdq vpclmulqdq vfmadd132ps vfmadd132pd vfmadd312ps vfmadd312pd vfmadd213ps vfmadd213pd vfmadd123ps vfmadd123pd vfmadd231ps vfmadd231pd vfmadd321ps vfmadd321pd vfmaddsub132ps vfmaddsub132pd vfmaddsub312ps vfmaddsub312pd vfmaddsub213ps vfmaddsub213pd vfmaddsub123ps vfmaddsub123pd vfmaddsub231ps vfmaddsub231pd vfmaddsub321ps vfmaddsub321pd vfmsub132ps vfmsub132pd vfmsub312ps vfmsub312pd vfmsub213ps vfmsub213pd vfmsub123ps vfmsub123pd vfmsub231ps vfmsub231pd vfmsub321ps vfmsub321pd vfmsubadd132ps vfmsubadd132pd vfmsubadd312ps vfmsubadd312pd vfmsubadd213ps vfmsubadd213pd vfmsubadd123ps vfmsubadd123pd vfmsubadd231ps vfmsubadd231pd vfmsubadd321ps vfmsubadd321pd vfnmadd132ps vfnmadd132pd vfnmadd312ps vfnmadd312pd vfnmadd213ps vfnmadd213pd vfnmadd123ps vfnmadd123pd vfnmadd231ps vfnmadd231pd vfnmadd321ps vfnmadd321pd vfnmsub132ps vfnmsub132pd vfnmsub312ps vfnmsub312pd vfnmsub213ps vfnmsub213pd vfnmsub123ps vfnmsub123pd vfnmsub231ps vfnmsub231pd vfnmsub321ps vfnmsub321pd vfmadd132ss vfmadd132sd vfmadd312ss vfmadd312sd vfmadd213ss vfmadd213sd vfmadd123ss vfmadd123sd vfmadd231ss vfmadd231sd vfmadd321ss vfmadd321sd vfmsub132ss vfmsub132sd vfmsub312ss vfmsub312sd vfmsub213ss vfmsub213sd vfmsub123ss vfmsub123sd vfmsub231ss vfmsub231sd vfmsub321ss vfmsub321sd vfnmadd132ss vfnmadd132sd vfnmadd312ss vfnmadd312sd vfnmadd213ss vfnmadd213sd vfnmadd123ss vfnmadd123sd vfnmadd231ss vfnmadd231sd vfnmadd321ss vfnmadd321sd vfnmsub132ss vfnmsub132sd vfnmsub312ss vfnmsub312sd vfnmsub213ss vfnmsub213sd vfnmsub123ss vfnmsub123sd vfnmsub231ss vfnmsub231sd vfnmsub321ss vfnmsub321sd rdfsbase rdgsbase rdrand wrfsbase wrgsbase vcvtph2ps vcvtps2ph adcx adox rdseed clac stac xstore xcryptecb xcryptcbc xcryptctr xcryptcfb xcryptofb montmul xsha1 xsha256 llwpcb slwpcb lwpval lwpins vfmaddpd vfmaddps vfmaddsd vfmaddss vfmaddsubpd vfmaddsubps vfmsubaddpd vfmsubaddps vfmsubpd vfmsubps vfmsubsd vfmsubss vfnmaddpd vfnmaddps vfnmaddsd vfnmaddss vfnmsubpd vfnmsubps vfnmsubsd vfnmsubss vfrczpd vfrczps vfrczsd vfrczss vpcmov vpcomb vpcomd vpcomq vpcomub vpcomud vpcomuq vpcomuw vpcomw vphaddbd vphaddbq vphaddbw vphadddq vphaddubd vphaddubq vphaddubw vphaddudq vphadduwd vphadduwq vphaddwd vphaddwq vphsubbw vphsubdq vphsubwd vpmacsdd vpmacsdqh vpmacsdql vpmacssdd vpmacssdqh vpmacssdql vpmacsswd vpmacssww vpmacswd vpmacsww vpmadcsswd vpmadcswd vpperm vprotb vprotd vprotq vprotw vpshab vpshad vpshaq vpshaw vpshlb vpshld vpshlq vpshlw vbroadcasti128 vpblendd vpbroadcastb vpbroadcastw vpbroadcastd vpbroadcastq vpermd vpermpd vpermps vpermq vperm2i128 vextracti128 vinserti128 vpmaskmovd vpmaskmovq vpsllvd vpsllvq vpsravd vpsrlvd vpsrlvq vgatherdpd vgatherqpd vgatherdps vgatherqps vpgatherdd vpgatherqd vpgatherdq vpgatherqq xabort xbegin xend xtest andn bextr blci blcic blsi blsic blcfill blsfill blcmsk blsmsk blsr blcs bzhi mulx pdep pext rorx sarx shlx shrx tzcnt tzmsk t1mskc valignd valignq vblendmpd vblendmps vbroadcastf32x4 vbroadcastf64x4 vbroadcasti32x4 vbroadcasti64x4 vcompresspd vcompressps vcvtpd2udq vcvtps2udq vcvtsd2usi vcvtss2usi vcvttpd2udq vcvttps2udq vcvttsd2usi vcvttss2usi vcvtudq2pd vcvtudq2ps vcvtusi2sd vcvtusi2ss vexpandpd vexpandps vextractf32x4 vextractf64x4 vextracti32x4 vextracti64x4 vfixupimmpd vfixupimmps vfixupimmsd vfixupimmss vgetexppd vgetexpps vgetexpsd vgetexpss vgetmantpd vgetmantps vgetmantsd vgetmantss vinsertf32x4 vinsertf64x4 vinserti32x4 vinserti64x4 vmovdqa32 vmovdqa64 vmovdqu32 vmovdqu64 vpabsq vpandd vpandnd vpandnq vpandq vpblendmd vpblendmq vpcmpltd vpcmpled vpcmpneqd vpcmpnltd vpcmpnled vpcmpd vpcmpltq vpcmpleq vpcmpneqq vpcmpnltq vpcmpnleq vpcmpq vpcmpequd vpcmpltud vpcmpleud vpcmpnequd vpcmpnltud vpcmpnleud vpcmpud vpcmpequq vpcmpltuq vpcmpleuq vpcmpnequq vpcmpnltuq vpcmpnleuq vpcmpuq vpcompressd vpcompressq vpermi2d vpermi2pd vpermi2ps vpermi2q vpermt2d vpermt2pd vpermt2ps vpermt2q vpexpandd vpexpandq vpmaxsq vpmaxuq vpminsq vpminuq vpmovdb vpmovdw vpmovqb vpmovqd vpmovqw vpmovsdb vpmovsdw vpmovsqb vpmovsqd vpmovsqw vpmovusdb vpmovusdw vpmovusqb vpmovusqd vpmovusqw vpord vporq vprold vprolq vprolvd vprolvq vprord vprorq vprorvd vprorvq vpscatterdd vpscatterdq vpscatterqd vpscatterqq vpsraq vpsravq vpternlogd vpternlogq vptestmd vptestmq vptestnmd vptestnmq vpxord vpxorq vrcp14pd vrcp14ps vrcp14sd vrcp14ss vrndscalepd vrndscaleps vrndscalesd vrndscaless vrsqrt14pd vrsqrt14ps vrsqrt14sd vrsqrt14ss vscalefpd vscalefps vscalefsd vscalefss vscatterdpd vscatterdps vscatterqpd vscatterqps vshuff32x4 vshuff64x2 vshufi32x4 vshufi64x2 kandnw kandw kmovw knotw kortestw korw kshiftlw kshiftrw kunpckbw kxnorw kxorw vpbroadcastmb2q vpbroadcastmw2d vpconflictd vpconflictq vplzcntd vplzcntq vexp2pd vexp2ps vrcp28pd vrcp28ps vrcp28sd vrcp28ss vrsqrt28pd vrsqrt28ps vrsqrt28sd vrsqrt28ss vgatherpf0dpd vgatherpf0dps vgatherpf0qpd vgatherpf0qps vgatherpf1dpd vgatherpf1dps vgatherpf1qpd vgatherpf1qps vscatterpf0dpd vscatterpf0dps vscatterpf0qpd vscatterpf0qps vscatterpf1dpd vscatterpf1dps vscatterpf1qpd vscatterpf1qps prefetchwt1 bndmk bndcl bndcu bndcn bndmov bndldx bndstx sha1rnds4 sha1nexte sha1msg1 sha1msg2 sha256rnds2 sha256msg1 sha256msg2 hint_nop0 hint_nop1 hint_nop2 hint_nop3 hint_nop4 hint_nop5 hint_nop6 hint_nop7 hint_nop8 hint_nop9 hint_nop10 hint_nop11 hint_nop12 hint_nop13 hint_nop14 hint_nop15 hint_nop16 hint_nop17 hint_nop18 hint_nop19 hint_nop20 hint_nop21 hint_nop22 hint_nop23 hint_nop24 hint_nop25 hint_nop26 hint_nop27 hint_nop28 hint_nop29 hint_nop30 hint_nop31 hint_nop32 hint_nop33 hint_nop34 hint_nop35 hint_nop36 hint_nop37 hint_nop38 hint_nop39 hint_nop40 hint_nop41 hint_nop42 hint_nop43 hint_nop44 hint_nop45 hint_nop46 hint_nop47 hint_nop48 hint_nop49 hint_nop50 hint_nop51 hint_nop52 hint_nop53 hint_nop54 hint_nop55 hint_nop56 hint_nop57 hint_nop58 hint_nop59 hint_nop60 hint_nop61 hint_nop62 hint_nop63", -built_in:"ip eip rip al ah bl bh cl ch dl dh sil dil bpl spl r8b r9b r10b r11b r12b r13b r14b r15b ax bx cx dx si di bp sp r8w r9w r10w r11w r12w r13w r14w r15w eax ebx ecx edx esi edi ebp esp eip r8d r9d r10d r11d r12d r13d r14d r15d rax rbx rcx rdx rsi rdi rbp rsp r8 r9 r10 r11 r12 r13 r14 r15 cs ds es fs gs ss st st0 st1 st2 st3 st4 st5 st6 st7 mm0 mm1 mm2 mm3 mm4 mm5 mm6 mm7 xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8 xmm9 xmm10 xmm11 xmm12 xmm13 xmm14 xmm15 xmm16 xmm17 xmm18 xmm19 xmm20 xmm21 xmm22 xmm23 xmm24 xmm25 xmm26 xmm27 xmm28 xmm29 xmm30 xmm31 ymm0 ymm1 ymm2 ymm3 ymm4 ymm5 ymm6 ymm7 ymm8 ymm9 ymm10 ymm11 ymm12 ymm13 ymm14 ymm15 ymm16 ymm17 ymm18 ymm19 ymm20 ymm21 ymm22 ymm23 ymm24 ymm25 ymm26 ymm27 ymm28 ymm29 ymm30 ymm31 zmm0 zmm1 zmm2 zmm3 zmm4 zmm5 zmm6 zmm7 zmm8 zmm9 zmm10 zmm11 zmm12 zmm13 zmm14 zmm15 zmm16 zmm17 zmm18 zmm19 zmm20 zmm21 zmm22 zmm23 zmm24 zmm25 zmm26 zmm27 zmm28 zmm29 zmm30 zmm31 k0 k1 k2 k3 k4 k5 k6 k7 bnd0 bnd1 bnd2 bnd3 cr0 cr1 cr2 cr3 cr4 cr8 dr0 dr1 dr2 dr3 dr8 tr3 tr4 tr5 tr6 tr7 r0 r1 r2 r3 r4 r5 r6 r7 r0b r1b r2b r3b r4b r5b r6b r7b r0w r1w r2w r3w r4w r5w r6w r7w r0d r1d r2d r3d r4d r5d r6d r7d r0h r1h r2h r3h r0l r1l r2l r3l r4l r5l r6l r7l r8l r9l r10l r11l r12l r13l r14l r15l db dw dd dq dt ddq do dy dz resb resw resd resq rest resdq reso resy resz incbin equ times byte word dword qword nosplit rel abs seg wrt strict near far a32 ptr", -meta:"%define %xdefine %+ %undef %defstr %deftok %assign %strcat %strlen %substr %rotate %elif %else %endif %if %ifmacro %ifctx %ifidn %ifidni %ifid %ifnum %ifstr %iftoken %ifempty %ifenv %error %warning %fatal %rep %endrep %include %push %pop %repl %pathsearch %depend %use %arg %stacksize %local %line %comment %endcomment .nolist __FILE__ __LINE__ __SECT__ __BITS__ __OUTPUT_FORMAT__ __DATE__ __TIME__ __DATE_NUM__ __TIME_NUM__ __UTC_DATE__ __UTC_TIME__ __UTC_DATE_NUM__ __UTC_TIME_NUM__ __PASS__ struc endstruc istruc at iend align alignb sectalign daz nodaz up down zero default option assume public bits use16 use32 use64 default section segment absolute extern global common cpu float __utf16__ __utf16le__ __utf16be__ __utf32__ __utf32le__ __utf32be__ __float8__ __float16__ __float32__ __float64__ __float80m__ __float80e__ __float128l__ __float128h__ __Infinity__ __QNaN__ __SNaN__ Inf NaN QNaN SNaN float8 float16 float32 float64 float80m float80e float128l float128h __FLOAT_DAZ__ __FLOAT_ROUND__ __FLOAT__" -},contains:[s.COMMENT(";","$",{relevance:0}),{className:"number",variants:[{ -begin:"\\b(?:([0-9][0-9_]*)?\\.[0-9_]*(?:[eE][+-]?[0-9_]+)?|(0[Xx])?[0-9][0-9_]*(\\.[0-9_]*)?(?:[pP](?:[+-]?[0-9_]+)?)?)\\b", -relevance:0},{begin:"\\$[0-9][0-9A-Fa-f]*",relevance:0},{ -begin:"\\b(?:[0-9A-Fa-f][0-9A-Fa-f_]*[Hh]|[0-9][0-9_]*[DdTt]?|[0-7][0-7_]*[QqOo]|[0-1][0-1_]*[BbYy])\\b" -},{ -begin:"\\b(?:0[Xx][0-9A-Fa-f_]+|0[DdTt][0-9_]+|0[QqOo][0-7_]+|0[BbYy][0-1_]+)\\b" -}]},s.QUOTE_STRING_MODE,{className:"string",variants:[{begin:"'",end:"[^\\\\]'" -},{begin:"`",end:"[^\\\\]`"}],relevance:0},{className:"symbol",variants:[{ -begin:"^\\s*[A-Za-z._?][A-Za-z0-9_$#@~.?]*(:|\\s+label)"},{ -begin:"^\\s*%%[A-Za-z0-9_$#@~.?]*:"}],relevance:0},{className:"subst", -begin:"%[0-9]+",relevance:0},{className:"subst",begin:"%!S+",relevance:0},{ -className:"meta",begin:/^\s*\.[\w_-]+/}]})})();hljs.registerLanguage("x86asm",s) -})();/*! `xml` grammar compiled for Highlight.js 11.10.0 */ -(()=>{var e=(()=>{"use strict";return e=>{ -const a=e.regex,n=a.concat(/[\p{L}_]/u,a.optional(/[\p{L}0-9_.-]*:/u),/[\p{L}0-9_.-]*/u),s={ -className:"symbol",begin:/&[a-z]+;|&#[0-9]+;|&#x[a-f0-9]+;/},t={begin:/\s/, -contains:[{className:"keyword",begin:/#?[a-z_][a-z1-9_-]+/,illegal:/\n/}] -},i=e.inherit(t,{begin:/\(/,end:/\)/}),c=e.inherit(e.APOS_STRING_MODE,{ -className:"string"}),l=e.inherit(e.QUOTE_STRING_MODE,{className:"string"}),r={ -endsWithParent:!0,illegal:/`]+/}]}]}]};return{ -name:"HTML, XML", -aliases:["html","xhtml","rss","atom","xjb","xsd","xsl","plist","wsf","svg"], -case_insensitive:!0,unicodeRegex:!0,contains:[{className:"meta",begin://,relevance:10,contains:[t,l,c,i,{begin:/\[/,end:/\]/,contains:[{ -className:"meta",begin://,contains:[t,i,l,c]}]}] -},e.COMMENT(//,{relevance:10}),{begin://, -relevance:10},s,{className:"meta",end:/\?>/,variants:[{begin:/<\?xml/, -relevance:10,contains:[l]},{begin:/<\?[a-z][a-z0-9]+/}]},{className:"tag", -begin:/)/,end:/>/,keywords:{name:"style"},contains:[r],starts:{ -end:/<\/style>/,returnEnd:!0,subLanguage:["css","xml"]}},{className:"tag", -begin:/)/,end:/>/,keywords:{name:"script"},contains:[r],starts:{ -end:/<\/script>/,returnEnd:!0,subLanguage:["javascript","handlebars","xml"]}},{ -className:"tag",begin:/<>|<\/>/},{className:"tag", -begin:a.concat(//,/>/,/\s/)))), -end:/\/?>/,contains:[{className:"name",begin:n,relevance:0,starts:r}]},{ -className:"tag",begin:a.concat(/<\//,a.lookahead(a.concat(n,/>/))),contains:[{ -className:"name",begin:n,relevance:0},{begin:/>/,relevance:0,endsParent:!0}]}]}} -})();hljs.registerLanguage("xml",e)})();/*! `yaml` grammar compiled for Highlight.js 11.10.0 */ -(()=>{var e=(()=>{"use strict";return e=>{ -const n="true false yes no null",a="[\\w#;/?:@&=+$,.~*'()[\\]]+",s={ -className:"string",relevance:0,variants:[{begin:/'/,end:/'/},{begin:/"/,end:/"/ -},{begin:/\S+/}],contains:[e.BACKSLASH_ESCAPE,{className:"template-variable", -variants:[{begin:/\{\{/,end:/\}\}/},{begin:/%\{/,end:/\}/}]}]},i=e.inherit(s,{ -variants:[{begin:/'/,end:/'/},{begin:/"/,end:/"/},{begin:/[^\s,{}[\]]+/}]}),l={ -end:",",endsWithParent:!0,excludeEnd:!0,keywords:n,relevance:0},t={begin:/\{/, -end:/\}/,contains:[l],illegal:"\\n",relevance:0},g={begin:"\\[",end:"\\]", -contains:[l],illegal:"\\n",relevance:0},b=[{className:"attr",variants:[{ -begin:/\w[\w :()\./-]*:(?=[ \t]|$)/},{begin:/"\w[\w :()\./-]*":(?=[ \t]|$)/},{ -begin:/'\w[\w :()\./-]*':(?=[ \t]|$)/}]},{className:"meta",begin:"^---\\s*$", -relevance:10},{className:"string", -begin:"[\\|>]([1-9]?[+-])?[ ]*\\n( +)[^ ][^\\n]*\\n(\\2[^\\n]+\\n?)*"},{ -begin:"<%[%=-]?",end:"[%-]?%>",subLanguage:"ruby",excludeBegin:!0,excludeEnd:!0, -relevance:0},{className:"type",begin:"!\\w+!"+a},{className:"type", -begin:"!<"+a+">"},{className:"type",begin:"!"+a},{className:"type",begin:"!!"+a -},{className:"meta",begin:"&"+e.UNDERSCORE_IDENT_RE+"$"},{className:"meta", -begin:"\\*"+e.UNDERSCORE_IDENT_RE+"$"},{className:"bullet",begin:"-(?=[ ]|$)", -relevance:0},e.HASH_COMMENT_MODE,{beginKeywords:n,keywords:{literal:n}},{ -className:"number", -begin:"\\b[0-9]{4}(-[0-9][0-9]){0,2}([Tt \\t][0-9][0-9]?(:[0-9][0-9]){2})?(\\.[0-9]*)?([ \\t])*(Z|[-+][0-9][0-9]?(:[0-9][0-9])?)?\\b" -},{className:"number",begin:e.C_NUMBER_RE+"\\b",relevance:0},t,g,s],r=[...b] -;return r.pop(),r.push(i),l.contains=r,{name:"YAML",case_insensitive:!0, -aliases:["yml"],contains:b}}})();hljs.registerLanguage("yaml",e)})(); \ No newline at end of file diff --git a/web/static/packages/htmx.min.js b/web/static/packages/htmx.min.js deleted file mode 100644 index de5f0f1..0000000 --- a/web/static/packages/htmx.min.js +++ /dev/null @@ -1 +0,0 @@ -(function(e,t){if(typeof define==="function"&&define.amd){define([],t)}else if(typeof module==="object"&&module.exports){module.exports=t()}else{e.htmx=e.htmx||t()}})(typeof self!=="undefined"?self:this,function(){return function(){"use strict";var Q={onLoad:F,process:zt,on:de,off:ge,trigger:ce,ajax:Nr,find:C,findAll:f,closest:v,values:function(e,t){var r=dr(e,t||"post");return r.values},remove:_,addClass:z,removeClass:n,toggleClass:$,takeClass:W,defineExtension:Ur,removeExtension:Br,logAll:V,logNone:j,logger:null,config:{historyEnabled:true,historyCacheSize:10,refreshOnHistoryMiss:false,defaultSwapStyle:"innerHTML",defaultSwapDelay:0,defaultSettleDelay:20,includeIndicatorStyles:true,indicatorClass:"htmx-indicator",requestClass:"htmx-request",addedClass:"htmx-added",settlingClass:"htmx-settling",swappingClass:"htmx-swapping",allowEval:true,allowScriptTags:true,inlineScriptNonce:"",attributesToSettle:["class","style","width","height"],withCredentials:false,timeout:0,wsReconnectDelay:"full-jitter",wsBinaryType:"blob",disableSelector:"[hx-disable], [data-hx-disable]",useTemplateFragments:false,scrollBehavior:"smooth",defaultFocusScroll:false,getCacheBusterParam:false,globalViewTransitions:false,methodsThatUseUrlParams:["get"],selfRequestsOnly:false,ignoreTitle:false,scrollIntoViewOnBoost:true,triggerSpecsCache:null},parseInterval:d,_:t,createEventSource:function(e){return new EventSource(e,{withCredentials:true})},createWebSocket:function(e){var t=new WebSocket(e,[]);t.binaryType=Q.config.wsBinaryType;return t},version:"1.9.12"};var r={addTriggerHandler:Lt,bodyContains:se,canAccessLocalStorage:U,findThisElement:xe,filterValues:yr,hasAttribute:o,getAttributeValue:te,getClosestAttributeValue:ne,getClosestMatch:c,getExpressionVars:Hr,getHeaders:xr,getInputValues:dr,getInternalData:ae,getSwapSpecification:wr,getTriggerSpecs:it,getTarget:ye,makeFragment:l,mergeObjects:le,makeSettleInfo:T,oobSwap:Ee,querySelectorExt:ue,selectAndSwap:je,settleImmediately:nr,shouldCancel:ut,triggerEvent:ce,triggerErrorEvent:fe,withExtensions:R};var w=["get","post","put","delete","patch"];var i=w.map(function(e){return"[hx-"+e+"], [data-hx-"+e+"]"}).join(", ");var S=e("head"),q=e("title"),H=e("svg",true);function e(e,t){return new RegExp("<"+e+"(\\s[^>]*>|>)([\\s\\S]*?)<\\/"+e+">",!!t?"gim":"im")}function d(e){if(e==undefined){return undefined}let t=NaN;if(e.slice(-2)=="ms"){t=parseFloat(e.slice(0,-2))}else if(e.slice(-1)=="s"){t=parseFloat(e.slice(0,-1))*1e3}else if(e.slice(-1)=="m"){t=parseFloat(e.slice(0,-1))*1e3*60}else{t=parseFloat(e)}return isNaN(t)?undefined:t}function ee(e,t){return e.getAttribute&&e.getAttribute(t)}function o(e,t){return e.hasAttribute&&(e.hasAttribute(t)||e.hasAttribute("data-"+t))}function te(e,t){return ee(e,t)||ee(e,"data-"+t)}function u(e){return e.parentElement}function re(){return document}function c(e,t){while(e&&!t(e)){e=u(e)}return e?e:null}function L(e,t,r){var n=te(t,r);var i=te(t,"hx-disinherit");if(e!==t&&i&&(i==="*"||i.split(" ").indexOf(r)>=0)){return"unset"}else{return n}}function ne(t,r){var n=null;c(t,function(e){return n=L(t,e,r)});if(n!=="unset"){return n}}function h(e,t){var r=e.matches||e.matchesSelector||e.msMatchesSelector||e.mozMatchesSelector||e.webkitMatchesSelector||e.oMatchesSelector;return r&&r.call(e,t)}function A(e){var t=/<([a-z][^\/\0>\x20\t\r\n\f]*)/i;var r=t.exec(e);if(r){return r[1].toLowerCase()}else{return""}}function s(e,t){var r=new DOMParser;var n=r.parseFromString(e,"text/html");var i=n.body;while(t>0){t--;i=i.firstChild}if(i==null){i=re().createDocumentFragment()}return i}function N(e){return/",0);var a=i.querySelector("template").content;if(Q.config.allowScriptTags){oe(a.querySelectorAll("script"),function(e){if(Q.config.inlineScriptNonce){e.nonce=Q.config.inlineScriptNonce}e.htmxExecuted=navigator.userAgent.indexOf("Firefox")===-1})}else{oe(a.querySelectorAll("script"),function(e){_(e)})}return a}switch(r){case"thead":case"tbody":case"tfoot":case"colgroup":case"caption":return s(""+n+"
",1);case"col":return s(""+n+"
",2);case"tr":return s(""+n+"
",2);case"td":case"th":return s(""+n+"
",3);case"script":case"style":return s("
"+n+"
",1);default:return s(n,0)}}function ie(e){if(e){e()}}function I(e,t){return Object.prototype.toString.call(e)==="[object "+t+"]"}function k(e){return I(e,"Function")}function P(e){return I(e,"Object")}function ae(e){var t="htmx-internal-data";var r=e[t];if(!r){r=e[t]={}}return r}function M(e){var t=[];if(e){for(var r=0;r=0}function se(e){if(e.getRootNode&&e.getRootNode()instanceof window.ShadowRoot){return re().body.contains(e.getRootNode().host)}else{return re().body.contains(e)}}function D(e){return e.trim().split(/\s+/)}function le(e,t){for(var r in t){if(t.hasOwnProperty(r)){e[r]=t[r]}}return e}function E(e){try{return JSON.parse(e)}catch(e){b(e);return null}}function U(){var e="htmx:localStorageTest";try{localStorage.setItem(e,e);localStorage.removeItem(e);return true}catch(e){return false}}function B(t){try{var e=new URL(t);if(e){t=e.pathname+e.search}if(!/^\/$/.test(t)){t=t.replace(/\/+$/,"")}return t}catch(e){return t}}function t(e){return Tr(re().body,function(){return eval(e)})}function F(t){var e=Q.on("htmx:load",function(e){t(e.detail.elt)});return e}function V(){Q.logger=function(e,t,r){if(console){console.log(t,e,r)}}}function j(){Q.logger=null}function C(e,t){if(t){return e.querySelector(t)}else{return C(re(),e)}}function f(e,t){if(t){return e.querySelectorAll(t)}else{return f(re(),e)}}function _(e,t){e=p(e);if(t){setTimeout(function(){_(e);e=null},t)}else{e.parentElement.removeChild(e)}}function z(e,t,r){e=p(e);if(r){setTimeout(function(){z(e,t);e=null},r)}else{e.classList&&e.classList.add(t)}}function n(e,t,r){e=p(e);if(r){setTimeout(function(){n(e,t);e=null},r)}else{if(e.classList){e.classList.remove(t);if(e.classList.length===0){e.removeAttribute("class")}}}}function $(e,t){e=p(e);e.classList.toggle(t)}function W(e,t){e=p(e);oe(e.parentElement.children,function(e){n(e,t)});z(e,t)}function v(e,t){e=p(e);if(e.closest){return e.closest(t)}else{do{if(e==null||h(e,t)){return e}}while(e=e&&u(e));return null}}function g(e,t){return e.substring(0,t.length)===t}function G(e,t){return e.substring(e.length-t.length)===t}function J(e){var t=e.trim();if(g(t,"<")&&G(t,"/>")){return t.substring(1,t.length-2)}else{return t}}function Z(e,t){if(t.indexOf("closest ")===0){return[v(e,J(t.substr(8)))]}else if(t.indexOf("find ")===0){return[C(e,J(t.substr(5)))]}else if(t==="next"){return[e.nextElementSibling]}else if(t.indexOf("next ")===0){return[K(e,J(t.substr(5)))]}else if(t==="previous"){return[e.previousElementSibling]}else if(t.indexOf("previous ")===0){return[Y(e,J(t.substr(9)))]}else if(t==="document"){return[document]}else if(t==="window"){return[window]}else if(t==="body"){return[document.body]}else{return re().querySelectorAll(J(t))}}var K=function(e,t){var r=re().querySelectorAll(t);for(var n=0;n=0;n--){var i=r[n];if(i.compareDocumentPosition(e)===Node.DOCUMENT_POSITION_FOLLOWING){return i}}};function ue(e,t){if(t){return Z(e,t)[0]}else{return Z(re().body,e)[0]}}function p(e){if(I(e,"String")){return C(e)}else{return e}}function ve(e,t,r){if(k(t)){return{target:re().body,event:e,listener:t}}else{return{target:p(e),event:t,listener:r}}}function de(t,r,n){jr(function(){var e=ve(t,r,n);e.target.addEventListener(e.event,e.listener)});var e=k(r);return e?r:n}function ge(t,r,n){jr(function(){var e=ve(t,r,n);e.target.removeEventListener(e.event,e.listener)});return k(r)?r:n}var pe=re().createElement("output");function me(e,t){var r=ne(e,t);if(r){if(r==="this"){return[xe(e,t)]}else{var n=Z(e,r);if(n.length===0){b('The selector "'+r+'" on '+t+" returned no matches!");return[pe]}else{return n}}}}function xe(e,t){return c(e,function(e){return te(e,t)!=null})}function ye(e){var t=ne(e,"hx-target");if(t){if(t==="this"){return xe(e,"hx-target")}else{return ue(e,t)}}else{var r=ae(e);if(r.boosted){return re().body}else{return e}}}function be(e){var t=Q.config.attributesToSettle;for(var r=0;r0){o=e.substr(0,e.indexOf(":"));t=e.substr(e.indexOf(":")+1,e.length)}else{o=e}var r=re().querySelectorAll(t);if(r){oe(r,function(e){var t;var r=i.cloneNode(true);t=re().createDocumentFragment();t.appendChild(r);if(!Se(o,e)){t=r}var n={shouldSwap:true,target:e,fragment:t};if(!ce(e,"htmx:oobBeforeSwap",n))return;e=n.target;if(n["shouldSwap"]){Fe(o,e,e,t,a)}oe(a.elts,function(e){ce(e,"htmx:oobAfterSwap",n)})});i.parentNode.removeChild(i)}else{i.parentNode.removeChild(i);fe(re().body,"htmx:oobErrorNoTarget",{content:i})}return e}function Ce(e,t,r){var n=ne(e,"hx-select-oob");if(n){var i=n.split(",");for(var a=0;a0){var r=t.replace("'","\\'");var n=e.tagName.replace(":","\\:");var i=o.querySelector(n+"[id='"+r+"']");if(i&&i!==o){var a=e.cloneNode();we(e,i);s.tasks.push(function(){we(e,a)})}}})}function Oe(e){return function(){n(e,Q.config.addedClass);zt(e);Nt(e);qe(e);ce(e,"htmx:load")}}function qe(e){var t="[autofocus]";var r=h(e,t)?e:e.querySelector(t);if(r!=null){r.focus()}}function a(e,t,r,n){Te(e,r,n);while(r.childNodes.length>0){var i=r.firstChild;z(i,Q.config.addedClass);e.insertBefore(i,t);if(i.nodeType!==Node.TEXT_NODE&&i.nodeType!==Node.COMMENT_NODE){n.tasks.push(Oe(i))}}}function He(e,t){var r=0;while(r-1){var t=e.replace(H,"");var r=t.match(q);if(r){return r[2]}}}function je(e,t,r,n,i,a){i.title=Ve(n);var o=l(n);if(o){Ce(r,o,i);o=Be(r,o,a);Re(o);return Fe(e,r,t,o,i)}}function _e(e,t,r){var n=e.getResponseHeader(t);if(n.indexOf("{")===0){var i=E(n);for(var a in i){if(i.hasOwnProperty(a)){var o=i[a];if(!P(o)){o={value:o}}ce(r,a,o)}}}else{var s=n.split(",");for(var l=0;l0){var o=t[0];if(o==="]"){n--;if(n===0){if(a===null){i=i+"true"}t.shift();i+=")})";try{var s=Tr(e,function(){return Function(i)()},function(){return true});s.source=i;return s}catch(e){fe(re().body,"htmx:syntax:error",{error:e,source:i});return null}}}else if(o==="["){n++}if(Qe(o,a,r)){i+="(("+r+"."+o+") ? ("+r+"."+o+") : (window."+o+"))"}else{i=i+o}a=t.shift()}}}function y(e,t){var r="";while(e.length>0&&!t.test(e[0])){r+=e.shift()}return r}function tt(e){var t;if(e.length>0&&Ze.test(e[0])){e.shift();t=y(e,Ke).trim();e.shift()}else{t=y(e,x)}return t}var rt="input, textarea, select";function nt(e,t,r){var n=[];var i=Ye(t);do{y(i,Je);var a=i.length;var o=y(i,/[,\[\s]/);if(o!==""){if(o==="every"){var s={trigger:"every"};y(i,Je);s.pollInterval=d(y(i,/[,\[\s]/));y(i,Je);var l=et(e,i,"event");if(l){s.eventFilter=l}n.push(s)}else if(o.indexOf("sse:")===0){n.push({trigger:"sse",sseEvent:o.substr(4)})}else{var u={trigger:o};var l=et(e,i,"event");if(l){u.eventFilter=l}while(i.length>0&&i[0]!==","){y(i,Je);var f=i.shift();if(f==="changed"){u.changed=true}else if(f==="once"){u.once=true}else if(f==="consume"){u.consume=true}else if(f==="delay"&&i[0]===":"){i.shift();u.delay=d(y(i,x))}else if(f==="from"&&i[0]===":"){i.shift();if(Ze.test(i[0])){var c=tt(i)}else{var c=y(i,x);if(c==="closest"||c==="find"||c==="next"||c==="previous"){i.shift();var h=tt(i);if(h.length>0){c+=" "+h}}}u.from=c}else if(f==="target"&&i[0]===":"){i.shift();u.target=tt(i)}else if(f==="throttle"&&i[0]===":"){i.shift();u.throttle=d(y(i,x))}else if(f==="queue"&&i[0]===":"){i.shift();u.queue=y(i,x)}else if(f==="root"&&i[0]===":"){i.shift();u[f]=tt(i)}else if(f==="threshold"&&i[0]===":"){i.shift();u[f]=y(i,x)}else{fe(e,"htmx:syntax:error",{token:i.shift()})}}n.push(u)}}if(i.length===a){fe(e,"htmx:syntax:error",{token:i.shift()})}y(i,Je)}while(i[0]===","&&i.shift());if(r){r[t]=n}return n}function it(e){var t=te(e,"hx-trigger");var r=[];if(t){var n=Q.config.triggerSpecsCache;r=n&&n[t]||nt(e,t,n)}if(r.length>0){return r}else if(h(e,"form")){return[{trigger:"submit"}]}else if(h(e,'input[type="button"], input[type="submit"]')){return[{trigger:"click"}]}else if(h(e,rt)){return[{trigger:"change"}]}else{return[{trigger:"click"}]}}function at(e){ae(e).cancelled=true}function ot(e,t,r){var n=ae(e);n.timeout=setTimeout(function(){if(se(e)&&n.cancelled!==true){if(!ct(r,e,Wt("hx:poll:trigger",{triggerSpec:r,target:e}))){t(e)}ot(e,t,r)}},r.pollInterval)}function st(e){return location.hostname===e.hostname&&ee(e,"href")&&ee(e,"href").indexOf("#")!==0}function lt(t,r,e){if(t.tagName==="A"&&st(t)&&(t.target===""||t.target==="_self")||t.tagName==="FORM"){r.boosted=true;var n,i;if(t.tagName==="A"){n="get";i=ee(t,"href")}else{var a=ee(t,"method");n=a?a.toLowerCase():"get";if(n==="get"){}i=ee(t,"action")}e.forEach(function(e){ht(t,function(e,t){if(v(e,Q.config.disableSelector)){m(e);return}he(n,i,e,t)},r,e,true)})}}function ut(e,t){if(e.type==="submit"||e.type==="click"){if(t.tagName==="FORM"){return true}if(h(t,'input[type="submit"], button')&&v(t,"form")!==null){return true}if(t.tagName==="A"&&t.href&&(t.getAttribute("href")==="#"||t.getAttribute("href").indexOf("#")!==0)){return true}}return false}function ft(e,t){return ae(e).boosted&&e.tagName==="A"&&t.type==="click"&&(t.ctrlKey||t.metaKey)}function ct(e,t,r){var n=e.eventFilter;if(n){try{return n.call(t,r)!==true}catch(e){fe(re().body,"htmx:eventFilter:error",{error:e,source:n.source});return true}}return false}function ht(a,o,e,s,l){var u=ae(a);var t;if(s.from){t=Z(a,s.from)}else{t=[a]}if(s.changed){t.forEach(function(e){var t=ae(e);t.lastValue=e.value})}oe(t,function(n){var i=function(e){if(!se(a)){n.removeEventListener(s.trigger,i);return}if(ft(a,e)){return}if(l||ut(e,a)){e.preventDefault()}if(ct(s,a,e)){return}var t=ae(e);t.triggerSpec=s;if(t.handledFor==null){t.handledFor=[]}if(t.handledFor.indexOf(a)<0){t.handledFor.push(a);if(s.consume){e.stopPropagation()}if(s.target&&e.target){if(!h(e.target,s.target)){return}}if(s.once){if(u.triggeredOnce){return}else{u.triggeredOnce=true}}if(s.changed){var r=ae(n);if(r.lastValue===n.value){return}r.lastValue=n.value}if(u.delayed){clearTimeout(u.delayed)}if(u.throttle){return}if(s.throttle>0){if(!u.throttle){o(a,e);u.throttle=setTimeout(function(){u.throttle=null},s.throttle)}}else if(s.delay>0){u.delayed=setTimeout(function(){o(a,e)},s.delay)}else{ce(a,"htmx:trigger");o(a,e)}}};if(e.listenerInfos==null){e.listenerInfos=[]}e.listenerInfos.push({trigger:s.trigger,listener:i,on:n});n.addEventListener(s.trigger,i)})}var vt=false;var dt=null;function gt(){if(!dt){dt=function(){vt=true};window.addEventListener("scroll",dt);setInterval(function(){if(vt){vt=false;oe(re().querySelectorAll("[hx-trigger='revealed'],[data-hx-trigger='revealed']"),function(e){pt(e)})}},200)}}function pt(t){if(!o(t,"data-hx-revealed")&&X(t)){t.setAttribute("data-hx-revealed","true");var e=ae(t);if(e.initHash){ce(t,"revealed")}else{t.addEventListener("htmx:afterProcessNode",function(e){ce(t,"revealed")},{once:true})}}}function mt(e,t,r){var n=D(r);for(var i=0;i=0){var t=wt(n);setTimeout(function(){xt(s,r,n+1)},t)}};t.onopen=function(e){n=0};ae(s).webSocket=t;t.addEventListener("message",function(e){if(yt(s)){return}var t=e.data;R(s,function(e){t=e.transformResponse(t,null,s)});var r=T(s);var n=l(t);var i=M(n.children);for(var a=0;a0){ce(u,"htmx:validation:halted",i);return}t.send(JSON.stringify(l));if(ut(e,u)){e.preventDefault()}})}else{fe(u,"htmx:noWebSocketSourceError")}}function wt(e){var t=Q.config.wsReconnectDelay;if(typeof t==="function"){return t(e)}if(t==="full-jitter"){var r=Math.min(e,6);var n=1e3*Math.pow(2,r);return n*Math.random()}b('htmx.config.wsReconnectDelay must either be a function or the string "full-jitter"')}function St(e,t,r){var n=D(r);for(var i=0;i0){setTimeout(i,n)}else{i()}}function Ht(t,i,e){var a=false;oe(w,function(r){if(o(t,"hx-"+r)){var n=te(t,"hx-"+r);a=true;i.path=n;i.verb=r;e.forEach(function(e){Lt(t,e,i,function(e,t){if(v(e,Q.config.disableSelector)){m(e);return}he(r,n,e,t)})})}});return a}function Lt(n,e,t,r){if(e.sseEvent){Rt(n,r,e.sseEvent)}else if(e.trigger==="revealed"){gt();ht(n,r,t,e);pt(n)}else if(e.trigger==="intersect"){var i={};if(e.root){i.root=ue(n,e.root)}if(e.threshold){i.threshold=parseFloat(e.threshold)}var a=new IntersectionObserver(function(e){for(var t=0;t0){t.polling=true;ot(n,r,e)}else{ht(n,r,t,e)}}function At(e){if(!e.htmxExecuted&&Q.config.allowScriptTags&&(e.type==="text/javascript"||e.type==="module"||e.type==="")){var t=re().createElement("script");oe(e.attributes,function(e){t.setAttribute(e.name,e.value)});t.textContent=e.textContent;t.async=false;if(Q.config.inlineScriptNonce){t.nonce=Q.config.inlineScriptNonce}var r=e.parentElement;try{r.insertBefore(t,e)}catch(e){b(e)}finally{if(e.parentElement){e.parentElement.removeChild(e)}}}}function Nt(e){if(h(e,"script")){At(e)}oe(f(e,"script"),function(e){At(e)})}function It(e){var t=e.attributes;if(!t){return false}for(var r=0;r0){var o=n.shift();var s=o.match(/^\s*([a-zA-Z:\-\.]+:)(.*)/);if(a===0&&s){o.split(":");i=s[1].slice(0,-1);r[i]=s[2]}else{r[i]+=o}a+=Bt(o)}for(var l in r){Ft(e,l,r[l])}}}function jt(e){Ae(e);for(var t=0;tQ.config.historyCacheSize){i.shift()}while(i.length>0){try{localStorage.setItem("htmx-history-cache",JSON.stringify(i));break}catch(e){fe(re().body,"htmx:historyCacheError",{cause:e,cache:i});i.shift()}}}function Yt(e){if(!U()){return null}e=B(e);var t=E(localStorage.getItem("htmx-history-cache"))||[];for(var r=0;r=200&&this.status<400){ce(re().body,"htmx:historyCacheMissLoad",o);var e=l(this.response);e=e.querySelector("[hx-history-elt],[data-hx-history-elt]")||e;var t=Zt();var r=T(t);var n=Ve(this.response);if(n){var i=C("title");if(i){i.innerHTML=n}else{window.document.title=n}}Ue(t,e,r);nr(r.tasks);Jt=a;ce(re().body,"htmx:historyRestore",{path:a,cacheMiss:true,serverResponse:this.response})}else{fe(re().body,"htmx:historyCacheMissLoadError",o)}};e.send()}function ar(e){er();e=e||location.pathname+location.search;var t=Yt(e);if(t){var r=l(t.content);var n=Zt();var i=T(n);Ue(n,r,i);nr(i.tasks);document.title=t.title;setTimeout(function(){window.scrollTo(0,t.scroll)},0);Jt=e;ce(re().body,"htmx:historyRestore",{path:e,item:t})}else{if(Q.config.refreshOnHistoryMiss){window.location.reload(true)}else{ir(e)}}}function or(e){var t=me(e,"hx-indicator");if(t==null){t=[e]}oe(t,function(e){var t=ae(e);t.requestCount=(t.requestCount||0)+1;e.classList["add"].call(e.classList,Q.config.requestClass)});return t}function sr(e){var t=me(e,"hx-disabled-elt");if(t==null){t=[]}oe(t,function(e){var t=ae(e);t.requestCount=(t.requestCount||0)+1;e.setAttribute("disabled","")});return t}function lr(e,t){oe(e,function(e){var t=ae(e);t.requestCount=(t.requestCount||0)-1;if(t.requestCount===0){e.classList["remove"].call(e.classList,Q.config.requestClass)}});oe(t,function(e){var t=ae(e);t.requestCount=(t.requestCount||0)-1;if(t.requestCount===0){e.removeAttribute("disabled")}})}function ur(e,t){for(var r=0;r=0}function wr(e,t){var r=t?t:ne(e,"hx-swap");var n={swapStyle:ae(e).boosted?"innerHTML":Q.config.defaultSwapStyle,swapDelay:Q.config.defaultSwapDelay,settleDelay:Q.config.defaultSettleDelay};if(Q.config.scrollIntoViewOnBoost&&ae(e).boosted&&!br(e)){n["show"]="top"}if(r){var i=D(r);if(i.length>0){for(var a=0;a0?l.join(":"):null;n["scroll"]=u;n["scrollTarget"]=f}else if(o.indexOf("show:")===0){var c=o.substr(5);var l=c.split(":");var h=l.pop();var f=l.length>0?l.join(":"):null;n["show"]=h;n["showTarget"]=f}else if(o.indexOf("focus-scroll:")===0){var v=o.substr("focus-scroll:".length);n["focusScroll"]=v=="true"}else if(a==0){n["swapStyle"]=o}else{b("Unknown modifier in hx-swap: "+o)}}}}return n}function Sr(e){return ne(e,"hx-encoding")==="multipart/form-data"||h(e,"form")&&ee(e,"enctype")==="multipart/form-data"}function Er(t,r,n){var i=null;R(r,function(e){if(i==null){i=e.encodeParameters(t,n,r)}});if(i!=null){return i}else{if(Sr(r)){return mr(n)}else{return pr(n)}}}function T(e){return{tasks:[],elts:[e]}}function Cr(e,t){var r=e[0];var n=e[e.length-1];if(t.scroll){var i=null;if(t.scrollTarget){i=ue(r,t.scrollTarget)}if(t.scroll==="top"&&(r||i)){i=i||r;i.scrollTop=0}if(t.scroll==="bottom"&&(n||i)){i=i||n;i.scrollTop=i.scrollHeight}}if(t.show){var i=null;if(t.showTarget){var a=t.showTarget;if(t.showTarget==="window"){a="body"}i=ue(r,a)}if(t.show==="top"&&(r||i)){i=i||r;i.scrollIntoView({block:"start",behavior:Q.config.scrollBehavior})}if(t.show==="bottom"&&(n||i)){i=i||n;i.scrollIntoView({block:"end",behavior:Q.config.scrollBehavior})}}}function Rr(e,t,r,n){if(n==null){n={}}if(e==null){return n}var i=te(e,t);if(i){var a=i.trim();var o=r;if(a==="unset"){return null}if(a.indexOf("javascript:")===0){a=a.substr(11);o=true}else if(a.indexOf("js:")===0){a=a.substr(3);o=true}if(a.indexOf("{")!==0){a="{"+a+"}"}var s;if(o){s=Tr(e,function(){return Function("return ("+a+")")()},{})}else{s=E(a)}for(var l in s){if(s.hasOwnProperty(l)){if(n[l]==null){n[l]=s[l]}}}}return Rr(u(e),t,r,n)}function Tr(e,t,r){if(Q.config.allowEval){return t()}else{fe(e,"htmx:evalDisallowedError");return r}}function Or(e,t){return Rr(e,"hx-vars",true,t)}function qr(e,t){return Rr(e,"hx-vals",false,t)}function Hr(e){return le(Or(e),qr(e))}function Lr(t,r,n){if(n!==null){try{t.setRequestHeader(r,n)}catch(e){t.setRequestHeader(r,encodeURIComponent(n));t.setRequestHeader(r+"-URI-AutoEncoded","true")}}}function Ar(t){if(t.responseURL&&typeof URL!=="undefined"){try{var e=new URL(t.responseURL);return e.pathname+e.search}catch(e){fe(re().body,"htmx:badResponseUrl",{url:t.responseURL})}}}function O(e,t){return t.test(e.getAllResponseHeaders())}function Nr(e,t,r){e=e.toLowerCase();if(r){if(r instanceof Element||I(r,"String")){return he(e,t,null,null,{targetOverride:p(r),returnPromise:true})}else{return he(e,t,p(r.source),r.event,{handler:r.handler,headers:r.headers,values:r.values,targetOverride:p(r.target),swapOverride:r.swap,select:r.select,returnPromise:true})}}else{return he(e,t,null,null,{returnPromise:true})}}function Ir(e){var t=[];while(e){t.push(e);e=e.parentElement}return t}function kr(e,t,r){var n;var i;if(typeof URL==="function"){i=new URL(t,document.location.href);var a=document.location.origin;n=a===i.origin}else{i=t;n=g(t,document.location.origin)}if(Q.config.selfRequestsOnly){if(!n){return false}}return ce(e,"htmx:validateUrl",le({url:i,sameHost:n},r))}function he(t,r,n,i,a,e){var o=null;var s=null;a=a!=null?a:{};if(a.returnPromise&&typeof Promise!=="undefined"){var l=new Promise(function(e,t){o=e;s=t})}if(n==null){n=re().body}var M=a.handler||Mr;var X=a.select||null;if(!se(n)){ie(o);return l}var u=a.targetOverride||ye(n);if(u==null||u==pe){fe(n,"htmx:targetError",{target:te(n,"hx-target")});ie(s);return l}var f=ae(n);var c=f.lastButtonClicked;if(c){var h=ee(c,"formaction");if(h!=null){r=h}var v=ee(c,"formmethod");if(v!=null){if(v.toLowerCase()!=="dialog"){t=v}}}var d=ne(n,"hx-confirm");if(e===undefined){var D=function(e){return he(t,r,n,i,a,!!e)};var U={target:u,elt:n,path:r,verb:t,triggeringEvent:i,etc:a,issueRequest:D,question:d};if(ce(n,"htmx:confirm",U)===false){ie(o);return l}}var g=n;var p=ne(n,"hx-sync");var m=null;var x=false;if(p){var B=p.split(":");var F=B[0].trim();if(F==="this"){g=xe(n,"hx-sync")}else{g=ue(n,F)}p=(B[1]||"drop").trim();f=ae(g);if(p==="drop"&&f.xhr&&f.abortable!==true){ie(o);return l}else if(p==="abort"){if(f.xhr){ie(o);return l}else{x=true}}else if(p==="replace"){ce(g,"htmx:abort")}else if(p.indexOf("queue")===0){var V=p.split(" ");m=(V[1]||"last").trim()}}if(f.xhr){if(f.abortable){ce(g,"htmx:abort")}else{if(m==null){if(i){var y=ae(i);if(y&&y.triggerSpec&&y.triggerSpec.queue){m=y.triggerSpec.queue}}if(m==null){m="last"}}if(f.queuedRequests==null){f.queuedRequests=[]}if(m==="first"&&f.queuedRequests.length===0){f.queuedRequests.push(function(){he(t,r,n,i,a)})}else if(m==="all"){f.queuedRequests.push(function(){he(t,r,n,i,a)})}else if(m==="last"){f.queuedRequests=[];f.queuedRequests.push(function(){he(t,r,n,i,a)})}ie(o);return l}}var b=new XMLHttpRequest;f.xhr=b;f.abortable=x;var w=function(){f.xhr=null;f.abortable=false;if(f.queuedRequests!=null&&f.queuedRequests.length>0){var e=f.queuedRequests.shift();e()}};var j=ne(n,"hx-prompt");if(j){var S=prompt(j);if(S===null||!ce(n,"htmx:prompt",{prompt:S,target:u})){ie(o);w();return l}}if(d&&!e){if(!confirm(d)){ie(o);w();return l}}var E=xr(n,u,S);if(t!=="get"&&!Sr(n)){E["Content-Type"]="application/x-www-form-urlencoded"}if(a.headers){E=le(E,a.headers)}var _=dr(n,t);var C=_.errors;var R=_.values;if(a.values){R=le(R,a.values)}var z=Hr(n);var $=le(R,z);var T=yr($,n);if(Q.config.getCacheBusterParam&&t==="get"){T["org.htmx.cache-buster"]=ee(u,"id")||"true"}if(r==null||r===""){r=re().location.href}var O=Rr(n,"hx-request");var W=ae(n).boosted;var q=Q.config.methodsThatUseUrlParams.indexOf(t)>=0;var H={boosted:W,useUrlParams:q,parameters:T,unfilteredParameters:$,headers:E,target:u,verb:t,errors:C,withCredentials:a.credentials||O.credentials||Q.config.withCredentials,timeout:a.timeout||O.timeout||Q.config.timeout,path:r,triggeringEvent:i};if(!ce(n,"htmx:configRequest",H)){ie(o);w();return l}r=H.path;t=H.verb;E=H.headers;T=H.parameters;C=H.errors;q=H.useUrlParams;if(C&&C.length>0){ce(n,"htmx:validation:halted",H);ie(o);w();return l}var G=r.split("#");var J=G[0];var L=G[1];var A=r;if(q){A=J;var Z=Object.keys(T).length!==0;if(Z){if(A.indexOf("?")<0){A+="?"}else{A+="&"}A+=pr(T);if(L){A+="#"+L}}}if(!kr(n,A,H)){fe(n,"htmx:invalidPath",H);ie(s);return l}b.open(t.toUpperCase(),A,true);b.overrideMimeType("text/html");b.withCredentials=H.withCredentials;b.timeout=H.timeout;if(O.noHeaders){}else{for(var N in E){if(E.hasOwnProperty(N)){var K=E[N];Lr(b,N,K)}}}var I={xhr:b,target:u,requestConfig:H,etc:a,boosted:W,select:X,pathInfo:{requestPath:r,finalRequestPath:A,anchor:L}};b.onload=function(){try{var e=Ir(n);I.pathInfo.responsePath=Ar(b);M(n,I);lr(k,P);ce(n,"htmx:afterRequest",I);ce(n,"htmx:afterOnLoad",I);if(!se(n)){var t=null;while(e.length>0&&t==null){var r=e.shift();if(se(r)){t=r}}if(t){ce(t,"htmx:afterRequest",I);ce(t,"htmx:afterOnLoad",I)}}ie(o);w()}catch(e){fe(n,"htmx:onLoadError",le({error:e},I));throw e}};b.onerror=function(){lr(k,P);fe(n,"htmx:afterRequest",I);fe(n,"htmx:sendError",I);ie(s);w()};b.onabort=function(){lr(k,P);fe(n,"htmx:afterRequest",I);fe(n,"htmx:sendAbort",I);ie(s);w()};b.ontimeout=function(){lr(k,P);fe(n,"htmx:afterRequest",I);fe(n,"htmx:timeout",I);ie(s);w()};if(!ce(n,"htmx:beforeRequest",I)){ie(o);w();return l}var k=or(n);var P=sr(n);oe(["loadstart","loadend","progress","abort"],function(t){oe([b,b.upload],function(e){e.addEventListener(t,function(e){ce(n,"htmx:xhr:"+t,{lengthComputable:e.lengthComputable,loaded:e.loaded,total:e.total})})})});ce(n,"htmx:beforeSend",I);var Y=q?null:Er(b,n,T);b.send(Y);return l}function Pr(e,t){var r=t.xhr;var n=null;var i=null;if(O(r,/HX-Push:/i)){n=r.getResponseHeader("HX-Push");i="push"}else if(O(r,/HX-Push-Url:/i)){n=r.getResponseHeader("HX-Push-Url");i="push"}else if(O(r,/HX-Replace-Url:/i)){n=r.getResponseHeader("HX-Replace-Url");i="replace"}if(n){if(n==="false"){return{}}else{return{type:i,path:n}}}var a=t.pathInfo.finalRequestPath;var o=t.pathInfo.responsePath;var s=ne(e,"hx-push-url");var l=ne(e,"hx-replace-url");var u=ae(e).boosted;var f=null;var c=null;if(s){f="push";c=s}else if(l){f="replace";c=l}else if(u){f="push";c=o||a}if(c){if(c==="false"){return{}}if(c==="true"){c=o||a}if(t.pathInfo.anchor&&c.indexOf("#")===-1){c=c+"#"+t.pathInfo.anchor}return{type:f,path:c}}else{return{}}}function Mr(l,u){var f=u.xhr;var c=u.target;var e=u.etc;var t=u.requestConfig;var h=u.select;if(!ce(l,"htmx:beforeOnLoad",u))return;if(O(f,/HX-Trigger:/i)){_e(f,"HX-Trigger",l)}if(O(f,/HX-Location:/i)){er();var r=f.getResponseHeader("HX-Location");var v;if(r.indexOf("{")===0){v=E(r);r=v["path"];delete v["path"]}Nr("GET",r,v).then(function(){tr(r)});return}var n=O(f,/HX-Refresh:/i)&&"true"===f.getResponseHeader("HX-Refresh");if(O(f,/HX-Redirect:/i)){location.href=f.getResponseHeader("HX-Redirect");n&&location.reload();return}if(n){location.reload();return}if(O(f,/HX-Retarget:/i)){if(f.getResponseHeader("HX-Retarget")==="this"){u.target=l}else{u.target=ue(l,f.getResponseHeader("HX-Retarget"))}}var d=Pr(l,u);var i=f.status>=200&&f.status<400&&f.status!==204;var g=f.response;var a=f.status>=400;var p=Q.config.ignoreTitle;var o=le({shouldSwap:i,serverResponse:g,isError:a,ignoreTitle:p},u);if(!ce(c,"htmx:beforeSwap",o))return;c=o.target;g=o.serverResponse;a=o.isError;p=o.ignoreTitle;u.target=c;u.failed=a;u.successful=!a;if(o.shouldSwap){if(f.status===286){at(l)}R(l,function(e){g=e.transformResponse(g,f,l)});if(d.type){er()}var s=e.swapOverride;if(O(f,/HX-Reswap:/i)){s=f.getResponseHeader("HX-Reswap")}var v=wr(l,s);if(v.hasOwnProperty("ignoreTitle")){p=v.ignoreTitle}c.classList.add(Q.config.swappingClass);var m=null;var x=null;var y=function(){try{var e=document.activeElement;var t={};try{t={elt:e,start:e?e.selectionStart:null,end:e?e.selectionEnd:null}}catch(e){}var r;if(h){r=h}if(O(f,/HX-Reselect:/i)){r=f.getResponseHeader("HX-Reselect")}if(d.type){ce(re().body,"htmx:beforeHistoryUpdate",le({history:d},u));if(d.type==="push"){tr(d.path);ce(re().body,"htmx:pushedIntoHistory",{path:d.path})}else{rr(d.path);ce(re().body,"htmx:replacedInHistory",{path:d.path})}}var n=T(c);je(v.swapStyle,c,l,g,n,r);if(t.elt&&!se(t.elt)&&ee(t.elt,"id")){var i=document.getElementById(ee(t.elt,"id"));var a={preventScroll:v.focusScroll!==undefined?!v.focusScroll:!Q.config.defaultFocusScroll};if(i){if(t.start&&i.setSelectionRange){try{i.setSelectionRange(t.start,t.end)}catch(e){}}i.focus(a)}}c.classList.remove(Q.config.swappingClass);oe(n.elts,function(e){if(e.classList){e.classList.add(Q.config.settlingClass)}ce(e,"htmx:afterSwap",u)});if(O(f,/HX-Trigger-After-Swap:/i)){var o=l;if(!se(l)){o=re().body}_e(f,"HX-Trigger-After-Swap",o)}var s=function(){oe(n.tasks,function(e){e.call()});oe(n.elts,function(e){if(e.classList){e.classList.remove(Q.config.settlingClass)}ce(e,"htmx:afterSettle",u)});if(u.pathInfo.anchor){var e=re().getElementById(u.pathInfo.anchor);if(e){e.scrollIntoView({block:"start",behavior:"auto"})}}if(n.title&&!p){var t=C("title");if(t){t.innerHTML=n.title}else{window.document.title=n.title}}Cr(n.elts,v);if(O(f,/HX-Trigger-After-Settle:/i)){var r=l;if(!se(l)){r=re().body}_e(f,"HX-Trigger-After-Settle",r)}ie(m)};if(v.settleDelay>0){setTimeout(s,v.settleDelay)}else{s()}}catch(e){fe(l,"htmx:swapError",u);ie(x);throw e}};var b=Q.config.globalViewTransitions;if(v.hasOwnProperty("transition")){b=v.transition}if(b&&ce(l,"htmx:beforeTransition",u)&&typeof Promise!=="undefined"&&document.startViewTransition){var w=new Promise(function(e,t){m=e;x=t});var S=y;y=function(){document.startViewTransition(function(){S();return w})}}if(v.swapDelay>0){setTimeout(y,v.swapDelay)}else{y()}}if(a){fe(l,"htmx:responseError",le({error:"Response Status Error Code "+f.status+" from "+u.pathInfo.requestPath},u))}}var Xr={};function Dr(){return{init:function(e){return null},onEvent:function(e,t){return true},transformResponse:function(e,t,r){return e},isInlineSwap:function(e){return false},handleSwap:function(e,t,r,n){return false},encodeParameters:function(e,t,r){return null}}}function Ur(e,t){if(t.init){t.init(r)}Xr[e]=le(Dr(),t)}function Br(e){delete Xr[e]}function Fr(e,r,n){if(e==undefined){return r}if(r==undefined){r=[]}if(n==undefined){n=[]}var t=te(e,"hx-ext");if(t){oe(t.split(","),function(e){e=e.replace(/ /g,"");if(e.slice(0,7)=="ignore:"){n.push(e.slice(7));return}if(n.indexOf(e)<0){var t=Xr[e];if(t&&r.indexOf(t)<0){r.push(t)}}})}return Fr(u(e),r,n)}var Vr=false;re().addEventListener("DOMContentLoaded",function(){Vr=true});function jr(e){if(Vr||re().readyState==="complete"){e()}else{re().addEventListener("DOMContentLoaded",e)}}function _r(){if(Q.config.includeIndicatorStyles!==false){re().head.insertAdjacentHTML("beforeend","")}}function zr(){var e=re().querySelector('meta[name="htmx-config"]');if(e){return E(e.content)}else{return null}}function $r(){var e=zr();if(e){Q.config=le(Q.config,e)}}jr(function(){$r();_r();var e=re().body;zt(e);var t=re().querySelectorAll("[hx-trigger='restored'],[data-hx-trigger='restored']");e.addEventListener("htmx:abort",function(e){var t=e.target;var r=ae(t);if(r&&r.xhr){r.xhr.abort()}});const r=window.onpopstate?window.onpopstate.bind(window):null;window.onpopstate=function(e){if(e.state&&e.state.htmx){ar();oe(t,function(e){ce(e,"htmx:restored",{document:re(),triggerEvent:ce})})}else{if(r){r(e)}}};setTimeout(function(){ce(e,"htmx:load",{});e=null},0)});return Q}()}); \ No newline at end of file diff --git a/web/static/scripts/dragDrop.js b/web/static/scripts/dragDrop.js deleted file mode 100644 index ee7abcd..0000000 --- a/web/static/scripts/dragDrop.js +++ /dev/null @@ -1,79 +0,0 @@ -let dragCounter = 0; - -function fileDragStart(event, target) { - event.preventDefault(); - event.stopPropagation(); - - target.classList.add("dragging"); - let pasteAreas = pasteContainer.getElementsByClassName("pasteArea"); - - for (let area of pasteAreas) { - if (area === target) { - continue; - } - area.classList.remove("dragging"); - } - - if (target.classList.contains("smallArea")) { - target.classList.remove("smallArea"); - } - - dragCounter++; -} - -function fileDragOver(event, target) { - event.preventDefault(); - - if (event.dataTransfer.items === 0) { return } - - let type = event.dataTransfer.items[0].type; - if (!type) { return } - - if (!type.startsWith("text/") && !type.startsWith("application/")) { - target.classList.add("prevented"); - event.dataTransfer.dropEffect = "none"; - } -} - -function fileDragEnd(event, target) { - event.preventDefault(); - event.stopPropagation(); - - dragCounter--; - if (dragCounter !== 0) { return } - - target.classList.remove("dragging"); - target.classList.remove("prevented"); - -} - -async function fileDrop(event, target) { - event.preventDefault(); - event.stopPropagation(); - - dragCounter = 0; - - target.classList.remove("prevented"); - target.classList.remove("dragging"); - - const file = event.dataTransfer.files[0]; - const textArea = target.querySelector(".fileContent"); - const fileName = target.querySelector(".pasteHeader > .filenameArea"); - - // Allow double the server limit incase of editing... - if (file.size > 600000) { - return; - } - - if (!file.type) { } - else if (!file.type.startsWith("text/") && !file.type.startsWith("application/")) { - return; - } - - let name = file.name; - let content = await file.text(); - fileName.value = name; - textArea.value = content; - - addFile(); -} \ No newline at end of file diff --git a/web/static/scripts/files.js b/web/static/scripts/files.js deleted file mode 100644 index 7d47977..0000000 --- a/web/static/scripts/files.js +++ /dev/null @@ -1,98 +0,0 @@ -let pasteContainer = document.querySelector(".pasteContainer"); -let count = 1; - - -function addFile(number) { - let canContinue = true; - let pasteAreas = pasteContainer.getElementsByClassName("pasteArea"); - let files = pasteContainer.querySelectorAll("[name='fileContent']"); - - for (let area of pasteAreas) { - let file = area.querySelector("[name='fileContent']"); - - if (!file.value) { - canContinue = false; - - if (file !== files[0]) { - area.classList.add("smallArea"); - } - } - - else if (file.value) { - area.classList.remove("smallArea"); - } - } - - if (!canContinue) { return } - if (files.length === 5) { return } - - count += 1; - - const pasteHTML = ` -
- -
- - Delete File -
- -
`; - - pasteContainer.insertAdjacentHTML("beforeend", pasteHTML); -} - -function deleteFile(identifier) { - let pasteAreas = pasteContainer.getElementsByClassName("pasteArea"); - let files = pasteContainer.querySelectorAll("[name='fileContent']"); - let area = document.getElementById(identifier); - let file = area.querySelector("[name='fileContent']") - - if (pasteAreas.length == 2) { - file.value = ""; - - if (file === files[1]) { - area.classList.add("smallArea"); - } - return - } - - if (files.length === 5 && file === files[4]) { - file.value = ""; - area.classList.add("smallArea"); - return - } - - area.remove(); - let canContinue = true; - let newAreas = pasteContainer.getElementsByClassName("pasteArea"); - - for (let newArea of newAreas) { - let newFile = newArea.querySelector("[name='fileContent']"); - - if (!newFile.value) { - canContinue = false; - - if (newFile !== files[0]) { - newArea.classList.add("smallArea"); - } - } - - else if (newFile.value) { - newArea.classList.remove("smallArea"); - } - } - - if (!canContinue) { return } - - const pasteHTML = ` -
- -
- - Delete File -
- -
`; - - pasteContainer.insertAdjacentHTML("beforeend", pasteHTML); -} diff --git a/web/static/scripts/files.old.js b/web/static/scripts/files.old.js deleted file mode 100644 index 0c2aa4b..0000000 --- a/web/static/scripts/files.old.js +++ /dev/null @@ -1,51 +0,0 @@ -let pasteContainer = document.querySelector(".pasteContainer"); -let addButton = document.querySelector(".addPaste"); -let count = 0; - -addButton.addEventListener("click", (e) => { - let files = pasteContainer.getElementsByClassName("pasteArea"); - - if (files.length >= 5) { - return; - } - - count += 1; - - const pasteHTML = `
-
- - Delete File -
- -
`; - - pasteContainer.insertAdjacentHTML("beforeend", pasteHTML); - - files = pasteContainer.getElementsByClassName("pasteArea"); - for (let file of files) { - file.querySelector(".pasteHeader .deleteFile").classList.remove("disabled"); - } - - if (files.length >= 5) { - addButton.style.display = "none"; - } -}); - -function deleteFile(identifier) { - let files = pasteContainer.getElementsByClassName("pasteArea"); - - if (files.length == 1) { - return; - } else { - addButton.style.display = "flex"; - } - - document.getElementById(identifier).remove(); - - files = pasteContainer.getElementsByClassName("pasteArea"); - if (files.length == 1) { - files[0] - .querySelector(".pasteHeader .deleteFile") - .classList.add("disabled"); - } -} diff --git a/web/static/scripts/hidecopy.js b/web/static/scripts/hidecopy.js deleted file mode 100644 index a1d1d3a..0000000 --- a/web/static/scripts/hidecopy.js +++ /dev/null @@ -1,43 +0,0 @@ -function hideFile(button, index) { - const pastec = document.getElementById(`__paste_c_${index}`); - const pastea = document.getElementById(`__paste_a_${index}`); - - if (!pastec || !pastea) { - return; - } - - if (button.textContent == "Hide") { - button.textContent = "Show"; - pastec.style.display = "none"; - pastea.style.flexGrow = "0"; - } else { - button.textContent = "Hide"; - pastec.style.display = "flex"; - pastea.style.flexGrow = "1"; - } -} - -async function copyFile(index) { - let button = document.getElementById(`__paste_copy_${index}`); - - if (button.textContent != "Copy") { - button.textContent = "✓"; - return; - } - - if (pasteStores.length == 0) { - return - } - - let content = pasteStores[index]; - if (!content) { - return; - } - - await navigator.clipboard.writeText(content); - button.textContent = "✓"; - - setTimeout(() => { - button.textContent = "Copy"; - }, 3500); -} diff --git a/web/static/scripts/highlights.js b/web/static/scripts/highlights.js deleted file mode 100644 index 24c4aee..0000000 --- a/web/static/scripts/highlights.js +++ /dev/null @@ -1,65 +0,0 @@ -let pasteStores = []; - -const HIGHLIGHT_AREAS = document.querySelectorAll(".pasteArea"); -const LANGUAGES = hljs.listLanguages(); -let DlCount = 0; - -for (let area of HIGHLIGHT_AREAS) { - let code = area.querySelector("pre > code"); - let name = area.querySelector(".pasteHeader > div > .filenameArea"); - - pasteStores.push(code.textContent); - - // Highlight Code Block and get Language Details... - let nameLang = getLangByName(name.textContent); - let highlightedLang; - let details; - - if (!nameLang) { - details = hljs.highlightAuto(code.textContent); - highlightedLang = details.language || "plaintext"; - } else { - details = hljs.highlight(code.textContent, { "language": nameLang }) - highlightedLang = nameLang.toLowerCase(); - } - - code.innerHTML = details.value; - - let header = area.querySelector(".pasteHeader"); - let langOpts = ""; - - for (let lang of LANGUAGES) { - if (lang == highlightedLang) { - continue - } - langOpts += `` - } - - langOpts = `\n${langOpts}` - let html = ` -
- - - ${langOpts} - -
` - - header.insertAdjacentHTML("beforeend", html); - DlCount++; -} - -function changeLang(inp, area, index) { - let chosen = inp.value; - - if (!chosen) { return } - if (!LANGUAGES.includes(chosen)) { return } - - if (inp.placeholder === chosen) { return } - - let code = area.querySelector("pre > code"); - let highlighted = hljs.highlight(pasteStores[index], { language: chosen }); - code.innerHTML = highlighted.value; - - inp.placeholder = chosen; -} \ No newline at end of file diff --git a/web/static/scripts/highlightsHTMX.js b/web/static/scripts/highlightsHTMX.js deleted file mode 100644 index 421c90c..0000000 --- a/web/static/scripts/highlightsHTMX.js +++ /dev/null @@ -1,75 +0,0 @@ -let pasteStores = []; - -const LANGUAGES = hljs.listLanguages(); -let DlCount = 0; - - -document.addEventListener("htmx:afterRequest", function (evt) { - if (evt.detail.xhr.status != 200) { - return - } - - if (evt.detail.target.id == "pastecontainer" || evt.detail.target.id == "content") { - const HIGHLIGHT_AREAS = document.querySelectorAll(".pasteArea"); - - for (let area of HIGHLIGHT_AREAS) { - let code = area.querySelector("pre > code"); - let name = area.querySelector(".pasteHeader > div > .filenameArea"); - pasteStores.push(code.textContent); - - // Highlight Code Block and get Language Details... - let nameLang = getLangByName(name.textContent); - let highlightedLang; - let details; - - if (!nameLang) { - details = hljs.highlightAuto(code.textContent); - highlightedLang = details.language || "plaintext"; - } else { - details = hljs.highlight(code.textContent, { "language": nameLang }) - highlightedLang = nameLang.toLowerCase(); - } - - code.innerHTML = details.value; - - let header = area.querySelector(".pasteHeader"); - let langOpts = ""; - - for (let lang of LANGUAGES) { - if (lang == highlightedLang) { - continue - } - langOpts += `` - } - - langOpts = `\n${langOpts}` - let html = ` -
- - - ${langOpts} - -
` - - header.insertAdjacentHTML("beforeend", html); - DlCount++; - } - } -}); - - -function changeLang(inp, area, index) { - let chosen = inp.value; - - if (!chosen) { return } - if (!LANGUAGES.includes(chosen)) { return } - - if (inp.placeholder === chosen) { return } - - let code = area.querySelector("pre > code"); - let highlighted = hljs.highlight(pasteStores[index], { language: chosen }); - code.innerHTML = highlighted.value; - - inp.placeholder = chosen; -} \ No newline at end of file diff --git a/web/static/scripts/initialTheme.js b/web/static/scripts/initialTheme.js deleted file mode 100644 index 1bbc43c..0000000 --- a/web/static/scripts/initialTheme.js +++ /dev/null @@ -1,28 +0,0 @@ -function calculateSettingAsThemeString({ - localStorageTheme, - systemSettingDark, -}) { - if (localStorageTheme !== null) { - return localStorageTheme; - } - - if (systemSettingDark.matches) { - return "dark"; - } - - return "light"; -} - -function updateThemeOnHtmlEl({ theme }) { - document.querySelector("html").setAttribute("data-theme", theme); -} - -let localStorageTheme = localStorage.getItem("theme"); -let systemSettingDark = window.matchMedia("(prefers-color-scheme: dark)"); - -let currentThemeSetting = calculateSettingAsThemeString({ - localStorageTheme, - systemSettingDark, -}); - -updateThemeOnHtmlEl({ theme: currentThemeSetting }); \ No newline at end of file diff --git a/web/static/scripts/lineHighlights.js b/web/static/scripts/lineHighlights.js deleted file mode 100644 index 78a4b72..0000000 --- a/web/static/scripts/lineHighlights.js +++ /dev/null @@ -1,119 +0,0 @@ -let selections = {}; - -function parseLines() { - let params = new URLSearchParams(document.location.search); - let param = params.get("lines"); - - if (!param) { - return - } - - const regex = /F(\d+)-L(\d+)(?:-L(\d+))?/g; - let match; - while ((match = regex.exec(param)) !== null) { - let file = parseInt(match[1]); - let start = parseInt(match[2]); - let end = match[3] ? parseInt(match[3]) : start; - - if (isNaN(file) || isNaN(start) || isNaN(end)) { - continue; - } - - highlightLine(null, file - 1, start); - if (start !== end) { - highlightLine(null, file - 1, end); - } - } -} - -parseLines(); - -function removeSelected(lines) { - lines.forEach(line => { - let child = line.querySelector("td.lineSelected"); - if (child) { - line.removeChild(child); - line.classList.remove("lineNumRowSelected"); - } - }); -} - -function updateParams() { - const url = new URL(window.location); - let param = Object.entries(selections).map(([key, value]) => { - let end = value.end !== value.start ? `-L${value.end}_` : ''; - return `F${parseInt(key) + 1}-L${value.start}${end}`; - }).join(''); - - url.searchParams.set("lines", param); - url.searchParams.delete("pastePassword"); - - history.pushState(null, '', url); -} - -function replaceSelected(lines, idIndex, index, start, end) { - let newLines = lines.slice(start, end); - removeSelected(newLines); - - let line = lines[index - 1]; - line.insertAdjacentHTML("beforeend", ``); - line.classList.add("lineNumRowSelected"); - - selections[idIndex] = { "start": index, "end": index }; - updateParams(); -} - -function addLines(lines, idIndex, start, end) { - let newLines = lines.slice(start - 1, end); - newLines.forEach(line => { - if (!line.querySelector("td.lineSelected")) { - line.insertAdjacentHTML("beforeend", ``); - line.classList.add("lineNumRowSelected"); - } - }); - - selections[idIndex] = { "start": start, "end": end }; - updateParams(); -} - -function highlightLine(event, idI, selected) { - let idIndex = parseInt(idI); - let id = `__paste_c_${idIndex}`; - let block = document.getElementById(id); - - if (!block) { - return; - } - - let lines = Array.from(block.querySelectorAll("tbody>tr")); - let line = Math.min(parseInt(selected), lines.length); - - let current = selections[idIndex]; - if (!current) { - let selectedLine = lines[line - 1]; - selectedLine.insertAdjacentHTML("beforeend", ``); - selectedLine.classList.add("lineNumRowSelected"); - - selections[idIndex] = { "start": line, "end": line }; - updateParams(); - return; - } - - let { start, end } = current; - - if (event && !event.shiftKey) { - replaceSelected(lines, idIndex, line, start - 1, end); - return; - } - - if (!event || event.shiftKey) { - if (line < start) { - removeSelected(lines.slice(start, end)); - addLines(lines, idIndex, line, start); - } else if (line <= end) { - replaceSelected(lines, idIndex, line, start - 1, end); - } else { - addLines(lines, idIndex, start, line); - } - } -} diff --git a/web/static/scripts/shortcuts.js b/web/static/scripts/shortcuts.js deleted file mode 100644 index 8b59793..0000000 --- a/web/static/scripts/shortcuts.js +++ /dev/null @@ -1,16 +0,0 @@ -window.addEventListener("keydown", (e) => { - - // Ctrl + s === Save Paste - if (e.ctrlKey && e.key === "s") { - e.preventDefault(); - e.stopPropagation(); - return; - } - - // Ctrl + Shift + R === Raw Paste - else if (e.ctrlKey && e.shiftKey && e.key === "R") { - e.preventDefault(); - e.stopPropagation(); - return; - } -}); \ No newline at end of file diff --git a/web/static/scripts/themes.js b/web/static/scripts/themes.js deleted file mode 100644 index 03f0897..0000000 --- a/web/static/scripts/themes.js +++ /dev/null @@ -1,16 +0,0 @@ -function updateButton({ checkboxEl, isDark }) { - checkboxEl.checked = isDark ? true : false; -} - -let checkbox = document.querySelector("#themeSwitch"); -updateButton({ checkboxEl: checkbox, isDark: currentThemeSetting === "dark" }); - -checkbox.addEventListener("click", (event) => { - const newTheme = currentThemeSetting === "dark" ? "light" : "dark"; - - localStorage.setItem("theme", newTheme); - updateButton({ checkboxEl: checkbox, isDark: newTheme === "dark" }); - updateThemeOnHtmlEl({ theme: newTheme }); - - currentThemeSetting = newTheme; -}); diff --git a/web/static/scripts/utils.js b/web/static/scripts/utils.js deleted file mode 100644 index 7c8c142..0000000 --- a/web/static/scripts/utils.js +++ /dev/null @@ -1,16 +0,0 @@ -function getLangByName(name) { - splat = name.split("."); - if (splat.length <= 1) { - return null - } - - ext = splat[splat.length - 1]; - lang = hljs.getLanguage(ext); - - if (!lang) { - return null - } - - let lname = lang.name.replace(/\s+/g, '').toLowerCase(); - return lname; -} \ No newline at end of file diff --git a/web/static/styles/global.css b/web/static/styles/global.css deleted file mode 100644 index 43f123c..0000000 --- a/web/static/styles/global.css +++ /dev/null @@ -1,778 +0,0 @@ -[data-theme="light"] { - --color-switch: rgba(31, 31, 65, 0.9); - --color-accent: #9069a7; - --color-error: #dd374d; - --color-security: #004ac0; - --color-warning: #004ac0; - --color-background: #ffe5ee; - --color-background--header: #fefefe; - --color-background--pastes: #fff; - --color-background--resizer: rgb(255, 255, 255, 0.9); - --color-background--button: #eff2f7; - --color-foreground: #2e2e33; - --color-foreground--dim: rgb(46, 46, 51, 0.6); - --color-foreground--border: rgb(46, 46, 51, 0.2); - --color-annotation: rgb(185, 52, 69); - --color-second-paste: #f6f8fa; - --button--brightness: brightness(0.95); - --button--brightness-hover: brightness(0.85); - --button--brightness-active: brightness(0.95); - --color-line-hover: rgb(237, 219, 85, 0.2); - --color-line-selected: rgb(237, 219, 85, 0.2); - - .keyboardLight { - display: none !important; - } - - .deleteFile { - background-color: var(--color-background); - filter: brightness(0.99); - } - - .deleteFile:hover { - cursor: pointer; - filter: brightness(0.97); - } - - .deleteFile:active { - filter: brightness(0.99); - } - - .savePaste { - background-color: var(--color-background); - filter: brightness(0.99); - } - - .savePaste:hover { - cursor: pointer; - filter: brightness(0.97); - } - - .savePaste:active { - filter: brightness(0.99); - } -} - -[data-theme="dark"] { - --color-switch: rgb(246, 249, 255, 0.6); - --color-accent: #c89ee0; - --color-error: #dd374d; - --color-security: #c8e09e; - --color-warning: #feff99; - --color-background: #15151c; - --color-background--header: #1d1d26; - --color-background--pastes: rgb(29, 29, 38, 0.9); - --color-background--resizer: rgb(29, 29, 38, 0.9); - --color-background--button: #1d1d26; - --color-foreground: #c9c9d1; - --color-foreground--dim: rgb(201, 201, 209, 0.6); - --color-foreground--border: rgb(201, 201, 209, 0.2); - --color-annotation: rgb(192, 99, 112, 0.8); - --color-second-paste: rgba(127, 97, 175, 0.05); - --button--brightness: brightness(1.2); - --button--brightness-hover: brightness(1.1); - --button--brightness-active: brightness(1.1); - --color-line-hover: rgb(237, 219, 85, 0.1); - --color-line-selected: rgb(237, 219, 85, 0.1); - - .keyboardDark { - display: none !important; - } -} - -* { - box-sizing: border-box; -} - -html, -body { - padding: 0; - margin: 0; - scrollbar-color: var(--color-background) var(--color-background--header); - scrollbar-width: auto; -} - -body { - background-color: var(--color-background); - color: var(--color-foreground); - font-family: "Lato", sans-serif; - min-height: 100vh; - display: flex; - flex-direction: column; - justify-content: space-between; -} - -a { - color: var(--color-accent); -} - -.logo { - height: 2.25rem; - width: 2.25rem; -} - -.header { - display: flex; - flex-direction: row; - justify-content: space-between; - align-items: center; - padding: 0.25rem 2rem; - background-color: var(--color-background--header); -} - -.headerSection { - display: flex; - flex-direction: row; - align-items: center; - gap: 0.5rem; - font-size: 1.3em; - color: var(--color-accent); -} - -.headerSection { - text-decoration: none; -} - -.headerRight { - display: flex; - gap: 1rem; - align-items: center; -} - -.keyboard { - user-select: none; - width: 2.75rem; - padding-top: 0.19rem; - height: auto; - opacity: 0.6; -} - -.keyboard:hover { - cursor: help; -} - -.footer { - display: flex; - flex-direction: row; - justify-content: space-between; - align-items: center; - padding: 1rem 2rem; -} - -.footerSection { - align-items: center; - display: flex; - flex-direction: row; - gap: 1rem; - font-size: 0.8em; -} - -.footerSection>a { - display: flex; - flex-direction: row; - align-items: center; - gap: 0.25rem; - font-size: 0.9em; -} - -.footerText { - font-size: 0.9em; - color: var(--color-foreground--dim); -} - -.content { - display: flex; - flex-direction: column; - flex-grow: 1; - padding: 2rem; - gap: 2rem; -} - -.pasteArea { - display: flex; - flex-grow: 1; - flex-shrink: 1; - flex-direction: column; - width: 100%; - max-width: 100%; - height: 100%; - background-color: var(--color-background--pastes); - border-radius: 0.25rem; - border: 1px solid transparent; -} - -.dragging { - opacity: 0.5; - border: 1px dashed var(--color-accent); - position: relative; - cursor: copy; - background-color: var(--color-background--pastes); -} - -.dragging::after { - pointer-events: none; - content: "Drop File to Paste..."; - position: absolute; - top: 50%; - left: 50%; - transform: translate(-50%, -50%); -} - -.prevented { - border: 1px dashed var(--color-error); - cursor: no-drop; -} - -.prevented::after { - content: "File is not allowed..."; - color: var(--color-error); - font-weight: 700; - font-size: larger; -} - -.pasteHeader { - background-color: var(--color-second-paste); - border-radius: 0.25rem 0.2rem 0 0; - display: flex; - flex-direction: row; - justify-content: space-between; - align-items: center; - padding: 0.5rem 1rem; - width: 100%; -} - -.pasteContainer { - display: flex; - flex-direction: column; - gap: 1rem; - flex-grow: 1; - width: 100%; - max-width: 100%; - border-radius: 0.25rem; -} - -input[type="password"] { - background-color: var(--color-background--pastes) !important; - color: var(--color-foreground) !important; -} - -.filenameArea { - resize: none; - background-color: var(--color-background--pastes); - color: var(--color-foreground); - border-radius: 0.25rem; - font-family: "JetBrains Mono", monospace; - font-optical-sizing: auto; - font-style: normal; - font-size: smaller; - outline: none; - border: var(--color-foreground--border) 1px solid; - padding: 0.25rem; - white-space: pre; - overflow-wrap: normal; - overflow-x: hidden; -} - -.filenameArea:focus { - outline: var(--color-foreground--dim) 1px solid; -} - -.pasteArea>textarea { - display: flex; - flex-grow: 1; - resize: vertical; - background-color: var(--color-background--pastes); - color: var(--color-foreground); - outline: none; - border-radius: 0.25rem; - font-family: "JetBrains Mono", monospace; - font-optical-sizing: auto; - font-style: normal; - white-space: pre; - overflow-wrap: normal; - overflow-x: scroll; - border: none; - padding: 1rem; - width: 100%; - height: 100%; - min-height: 32rem; -} - -.smallArea { - flex-grow: 0; - height: 9rem; -} - -.smallArea>textarea { - min-height: 4rem; - height: 4rem; -} - -textarea::-webkit-resizer { - background-color: var(--color-background--resizer); -} - -textarea { - scrollbar-color: var(--color-background) var(--color-background--header); - scrollbar-width: auto; -} - -.addPaste { - display: flex; - padding: 1rem; - border-radius: 0 0 0.25rem 0.25rem; - background-color: var(--color-background--header); - color: var(--color-accent); - justify-content: center; - align-content: center; - user-select: none; -} - -.addPaste:hover { - cursor: pointer; - filter: var(--button--brightness-hover); -} - -.addPaste:active { - filter: var(--button--brightness-active); -} - -.deleteFile { - display: flex; - padding: 0.5rem 1rem; - border-radius: 0.25rem; - background-color: var(--color-background--header); - filter: brightness(0.8); - color: var(--color-accent); - justify-content: center; - align-content: center; - user-select: none; -} - -.deleteFile:hover { - cursor: pointer; - filter: brightness(0.9); -} - -.deleteFile:active { - filter: brightness(0.8); -} - -.disabled { - cursor: unset; - opacity: 0.6; - filter: brightness(0.9); -} - -.disabled:hover { - cursor: unset; - filter: brightness(0.9); -} - -.disabled:active { - filter: brightness(0.9); -} - -.pasteOptions { - display: flex; - flex-direction: column; - background-color: var(--color-background--header); - border-radius: 0 0 0.25rem 0.25rem; -} - -.pasteOptions>.hrLight { - width: 98%; -} - -.hrLight { - border-top: none; - border-left: none; - border-right: none; - outline: none; - border-bottom: 1px solid var(--color-foreground--border); - margin: 1rem 0; - align-self: center; -} - -.pasteOptionsSection { - display: flex; - flex-direction: row; - align-items: center; - gap: 2rem; - padding: 0 1rem; - width: 100%; -} - -.savePaste { - display: flex; - padding: 0.75rem 4rem; - border-radius: 0.25rem; - background-color: var(--color-background--button); - filter: var(--button--brightness); - color: var(--color-accent); - justify-content: center; - align-content: center; - user-select: none; -} - -.savePaste:hover { - cursor: pointer; - filter: var(--button--brightness-hover); -} - -.savePaste:active { - filter: var(--button--brightness-active); -} - -.fileContent { - padding: 0.5rem; - overflow-x: auto; - position: relative; -} - -.identifierHeader { - display: flex; - flex-direction: row; - gap: 1rem; - align-items: baseline; -} - -.identifierHeaderLeft { - display: flex; - flex-direction: column; - gap: 0.25rem; -} - -.identifierHeaderLeft>a { - font-weight: 600; - text-decoration: none; -} - -.identifierHeaderLeft>span { - color: var(--color-foreground--dim); - font-weight: 400; - font-size: 0.7em; -} - -.identifierHeaderSection { - font-size: 0.9em; - display: flex; - flex-direction: row; - gap: 0.5rem; -} - -.linenos { - font-family: "JetBrains Mono", monospace; -} - -.pre { - font-family: "JetBrains Mono", monospace; -} - -.vsc { - width: 14px; - height: 14px; -} - -.pasteButton { - font-size: 0.8em; - color: var(--color-accent); - user-select: none; -} - -.pasteButton:hover { - cursor: pointer; - filter: brightness(1.1); -} - -#errorResponse { - color: var(--color-error); - padding: 1rem; -} - -.protected { - display: flex; - flex-direction: column; - gap: 1rem; -} - -.protectedPassword { - resize: none; - background-color: var(--color-background--pastes); - color: var(--color-foreground); - border-radius: 0.25rem; - font-family: "JetBrains Mono", monospace; - font-optical-sizing: auto; - font-style: normal; - outline: none; - border: var(--color-foreground--border) 1px solid; - padding: 0.5rem; - white-space: pre; - overflow-wrap: normal; - overflow-x: hidden; - height: 3rem; -} - -.protectedPassword:focus { - outline: var(--color-foreground--dim) 1px solid; -} - -.annotations { - padding-bottom: 0.25rem; - font-size: 0.9em; - color: var(--color-annotation); - padding-left: 1rem; - background-color: var(--color-second-paste); -} - -.security { - color: var(--color-security); -} - -.langSelectContainer { - display: flex; - align-items: center; -} - -.langSelectContainer>label { - background-color: var(--color-background--resizer); - color: var(--color-foreground); - padding: 0.25rem; - border-radius: 0.25rem; - border: 1px solid var(--color-foreground--border); - outline: none; -} - -.langSelectContainer>label>input { - background-color: transparent; - color: var(--color-foreground--dim); - outline: none; - border: none; - padding: 0.25rem; -} - -.langSelectContainer>label:hover { - cursor: pointer; - filter: brightness(1.1); -} - -.langSelectContainer>label>input:hover { - cursor: pointer; -} - -.lineNums { - display: block; - border-collapse: collapse; - border-spacing: 0; - border: none; - font-family: "JetBrains Mono", monospace; - font-size: 0.75rem; - line-height: 1.1rem; - user-select: none; -} - -.lineNumRow { - padding: 0; - padding-right: 16px !important; - opacity: 0.7; -} - -.lineNumRow:hover { - cursor: pointer; - background-color: var(--color-line-hover); -} - -.lineNumRowSelected { - background: var(--color-line-selected); -} - -.lineSelected { - background: var(--color-line-selected); - position: absolute; - width: 100%; - z-index: 1; - height: 1.1rem; -} - -.lineWarn { - background: var(--color-error); - position: absolute; - width: 100%; - z-index: 1; - height: 1.1rem; - opacity: 0.4; -} - -code { - font-family: "JetBrains Mono", monospace; - font-size: 0.75rem; - line-height: 1.1rem; - z-index: 2; -} - -.annotationSecond { - color: var(--color-warning); - opacity: 0.9; - padding-left: 0.125rem; - font-weight: 400; -} - -.annotationSecond:hover { - cursor: help; -} - -/* Theme Switch */ -.themeSwitch { - --size: 1.5rem; - - appearance: none; - outline: none; - cursor: pointer; - - width: var(--size); - height: var(--size); - box-shadow: inset calc(var(--size) * 0.33) calc(var(--size) * -0.25) 0; - border-radius: 999px; - color: var(--color-switch); - - transition: all 500ms; - - &:checked { - --ray-size: calc(var(--size) * -0.4); - --offset-orthogonal: calc(var(--size) * 0.65); - --offset-diagonal: calc(var(--size) * 0.45); - - transform: scale(0.75); - color: var(--color-switch); - box-shadow: inset 0 0 0 var(--size), - calc(var(--offset-orthogonal) * -1) 0 0 var(--ray-size), - var(--offset-orthogonal) 0 0 var(--ray-size), - 0 calc(var(--offset-orthogonal) * -1) 0 var(--ray-size), - 0 var(--offset-orthogonal) 0 var(--ray-size), - calc(var(--offset-diagonal) * -1) calc(var(--offset-diagonal) * -1) 0 var(--ray-size), - var(--offset-diagonal) var(--offset-diagonal) 0 var(--ray-size), - calc(var(--offset-diagonal) * -1) var(--offset-diagonal) 0 var(--ray-size), - var(--offset-diagonal) calc(var(--offset-diagonal) * -1) 0 var(--ray-size); - } -} - -.notFound { - display: flex; - flex-direction: column; - gap: 0.5rem; - align-self: center; -} - -.annotationSecond { - position: relative; -} - -.annotationSecond:after { - position: absolute; - content: attr(data-text); - color: var(--color-foreground); - background-color: var(--color-background); - top: 50%; - transform: translateY(-50%); - left: 100%; - width: max-content; - border-radius: 0.25rem; - margin-left: 0.5rem; - padding: 0.5rem; - display: none; - /* hide by default */ - opacity: 1; -} - -.annotationSecond:hover:after { - display: block; -} - -.keyboardTool { - position: relative; -} - -.keyboardTool:after { - position: absolute; - content: attr(data-text); - color: var(--color-foreground); - background-color: var(--color-background); - width: max-content; - border-radius: 0.25rem; - padding: 0.75rem; - display: none; - /* hide by default */ - opacity: 1; - right: 0; - white-space: pre; - z-index: 9; - cursor: help; -} - -.keyboardTool:hover:after { - display: inline-block; -} - -@media screen and (max-width: 600px) { - .annotations { - font-size: 0.8em; - } - - .savePaste { - padding: 0.75rem; - font-size: 0.8em; - } - - .deleteFile { - padding: 0.5rem 1rem; - font-size: 0.8em; - } - - .deleteFile { - padding: 1rem; - font-size: 0.8em; - } - - .footer { - flex-direction: column; - padding: 0 0 1rem 0; - } - - .identifierHeaderSection { - font-size: 0.8em; - } - - .identifierHeader { - gap: 1rem; - } - - .filenameArea { - font-size: 0.6em; - } - - .content { - padding: 1rem 0.5rem 1rem 0.5rem; - } - - .header { - padding: 1rem 0.5rem; - } - - .pasteArea>textarea { - font-size: 0.8em; - } - - .langSelectContainer>label { - max-width: 6rem; - padding: 0; - } - - .langSelectContainer>label>input { - max-width: 6rem; - font-size: 0.7em; - } - - .pasteHeader { - padding: 0.5rem; - } -} \ No newline at end of file diff --git a/web/static/styles/highlights.css b/web/static/styles/highlights.css deleted file mode 100644 index 50cd0fd..0000000 --- a/web/static/styles/highlights.css +++ /dev/null @@ -1,188 +0,0 @@ -pre code.hljs { - display: block; - overflow-x: auto; - padding: 1em; - font-family: "JetBrains Mono", monospace; - font-size: 0.8em; -} - -code.hljs { - padding: 3px 5px; - font-family: "JetBrains Mono", monospace; -} - -.hljs-ln td { - padding-right: 16px!important; -} - -.hljs-ln-n { - opacity: 0.7; -} - -[data-theme="light"] { - .hljs { - color: #383a42; - } - - .hljs-comment, - .hljs-quote { - color: #a0a1a7; - font-style: italic; - } - - .hljs-doctag, - .hljs-keyword, - .hljs-formula { - color: #a626a4; - } - - .hljs-section, - .hljs-name, - .hljs-selector-tag, - .hljs-deletion, - .hljs-subst { - color: #e45649; - } - - .hljs-literal { - color: #0184bb; - } - - .hljs-string, - .hljs-regexp, - .hljs-addition, - .hljs-attribute, - .hljs-meta .hljs-string { - color: #50a14f; - } - - .hljs-attr, - .hljs-variable, - .hljs-template-variable, - .hljs-type, - .hljs-selector-class, - .hljs-selector-attr, - .hljs-selector-pseudo, - .hljs-number { - color: #986801; - } - - .hljs-symbol, - .hljs-bullet, - .hljs-link, - .hljs-meta, - .hljs-selector-id, - .hljs-title { - color: #4078f2; - } - - .hljs-built_in, - .hljs-title.class_, - .hljs-class .hljs-title { - color: #c18401; - } - - .hljs-emphasis { - font-style: italic; - } - - .hljs-strong { - font-weight: bold; - } - - .hljs-link { - text-decoration: underline; - } -} - -[data-theme="dark"] { - .hljs { - color: #b5bdca; - } - - .hljs-comment, - .hljs-quote { - color: #5c6370; - font-style: italic; - } - - .hljs-doctag, - .hljs-keyword, - .hljs-formula { - color: #c678dd; - } - - .hljs-section, - .hljs-name, - .hljs-selector-tag, - .hljs-deletion, - .hljs-subst { - color: #f5c2e4; - } - - .hljs-literal { - color: #f3a472; - } - - .hljs-string, - .hljs-regexp, - .hljs-addition, - .hljs-attribute, - .hljs-meta .hljs-string { - color: #8ca878; - } - - .hljs-attr, - .hljs-variable, - .hljs-template-variable, - .hljs-type, - .hljs-selector-class, - .hljs-selector-attr, - .hljs-selector-pseudo, - .hljs-number { - color: #d19a66; - } - - .hljs-meta { - color: #ebb371; - } - - .hljs-symbol, - .hljs-bullet, - .hljs-link, - .hljs-selector-id, - .hljs-title { - color: #61aeee; - } - - .hljs-built_in { - color: #6cb4ed; - } - - .hljs-title.class_, - .hljs-class .hljs-title { - color: #6cb4ed; - } - - .hljs-emphasis { - font-style: italic; - } - - .hljs-strong { - font-weight: bold; - } - - .hljs-link { - text-decoration: underline; - } - - .hljs-params { - color: #b5bdca; - } -} - -@media screen and (max-width: 600px) { - pre code.hljs { - font-size: 0.7em; - } -} \ No newline at end of file From 0635bf6c93875de83f3a9a936258ebf41a4f3cb3 Mon Sep 17 00:00:00 2001 From: LostLuma Date: Wed, 20 Nov 2024 07:06:37 +0100 Subject: [PATCH 22/36] Update README Signed-off-by: Lilly Rose Berner --- README.md | 39 ++++++++------------------------------- 1 file changed, 8 insertions(+), 31 deletions(-) diff --git a/README.md b/README.md index f3c7f7b..31762e1 100644 --- a/README.md +++ b/README.md @@ -1,38 +1,15 @@ # MystBin -Easily share code and text. +Easily share code or text with syntax highlighting and themes for readability. -[Website](https://mystb.in) +## Usage -[API Documentation](https://mystb.in/api/documentation) +Share and view pastes on the [Website](https://mystb.in). -[Install on VSCode](https://marketplace.visualstudio.com/items?itemName=PythonistaGuild.mystbin) +Read the [API docs](https://api.mystb.in/docs) to create your own integrations, +or install the official [VS Code extension](https://marketplace.visualstudio.com/items?itemName=PythonistaGuild.mystbin) to share code from your editor! +## Information -### Running without Docker -**Requirements:** -- Postgres - -**Setup:** -- Clone -- Copy `config.template.toml` into `config.toml` - - Set Database connection DSN. - - Optionally set URLs to a running Redis Instance. -- ! If you haven't already: Create a Database in `postgres` (Default `mystbin`) -- Install dependencies (Preferably to a `venv`): `pip install -Ur requirements.txt` -- Optionally in `core/server.py` set `ignore_localhost=` to `False` in the RateLimit Middleware for testing. -- Run: `python launcher.py` - -### Running with Docker -**Requirements** -- Docker -- Docker Compose - -**Setup:** -- Clone -- Copy `config.template.toml` into `config.toml` - - The default config for database (and redis) should work Out of Box. -- Optionally in `core/server.py` set `ignore_localhost=` to `False` in the RateLimit Middleware for testing. -- Run `docker compose up -d` to start the services. - - If you want to use redis for session/limit handling, run with the redis profile: `docker compose --profile redis up -d` - - The redis container doesn't expose connections outside of the network, but for added security edit `redis.conf` and change the password. +If you'd like to contribute please read our [contribution guidelines](https://github.com/PythonistaGuild/.github/blob/main/CONTRIBUTING.md). +Interested in self-hosting MystBin? See the readme in each components' directory. From eaa240fd0f8c00d71fec9917a22104f860a7aa9a Mon Sep 17 00:00:00 2001 From: LostLuma Date: Wed, 20 Nov 2024 07:08:21 +0100 Subject: [PATCH 23/36] Add AGPL-3.0 License Signed-off-by: Lilly Rose Berner --- LICENSE | 661 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 661 insertions(+) create mode 100644 LICENSE diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..551248d --- /dev/null +++ b/LICENSE @@ -0,0 +1,661 @@ + GNU AFFERO GENERAL PUBLIC LICENSE + Version 3, 19 November 2007 + +Copyright (C) 2007 Free Software Foundation, Inc. +Everyone is permitted to copy and distribute verbatim copies +of this license document, but changing it is not allowed. + + Preamble + +The GNU Affero General Public License is a free, copyleft license for +software and other kinds of works, specifically designed to ensure +cooperation with the community in the case of network server software. + +The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +our General Public Licenses are intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. + +When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + +Developers that use our General Public Licenses protect your rights +with two steps: (1) assert copyright on the software, and (2) offer +you this License which gives you legal permission to copy, distribute +and/or modify the software. + +A secondary benefit of defending all users' freedom is that +improvements made in alternate versions of the program, if they +receive widespread use, become available for other developers to +incorporate. Many developers of free software are heartened and +encouraged by the resulting cooperation. However, in the case of +software used on network servers, this result may fail to come about. +The GNU General Public License permits making a modified version and +letting the public access it on a server without ever releasing its +source code to the public. + +The GNU Affero General Public License is designed specifically to +ensure that, in such cases, the modified source code becomes available +to the community. It requires the operator of a network server to +provide the source code of the modified version running there to the +users of that server. Therefore, public use of a modified version, on +a publicly accessible server, gives the public access to the source +code of the modified version. + +An older license, called the Affero General Public License and +published by Affero, was designed to accomplish similar goals. This is +a different license, not a version of the Affero GPL, but Affero has +released a new version of the Affero GPL which permits relicensing under +this license. + +The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + +0. Definitions. + +"This License" refers to version 3 of the GNU Affero General Public License. + +"Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + +"The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + +To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + +A "covered work" means either the unmodified Program or a work based +on the Program. + +To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + +To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + +An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + +1. Source Code. + +The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + +A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + +The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + +The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + +The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + +The Corresponding Source for a work in source code form is that +same work. + +2. Basic Permissions. + +All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + +You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + +Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + +3. Protecting Users' Legal Rights From Anti-Circumvention Law. + +No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + +When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + +4. Conveying Verbatim Copies. + +You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + +You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + +5. Conveying Modified Source Versions. + +You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + +A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + +6. Conveying Non-Source Forms. + +You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + +A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + +A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + +"Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + +If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + +The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + +Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + +7. Additional Terms. + +"Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + +When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + +Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + +All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + +If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + +Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + +8. Termination. + +You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + +However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + +Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + +Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + +9. Acceptance Not Required for Having Copies. + +You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + +10. Automatic Licensing of Downstream Recipients. + +Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + +An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + +You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + +11. Patents. + +A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + +A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + +Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + +In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + +If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + +If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + +A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + +Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + +12. No Surrender of Others' Freedom. + +If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + +13. Remote Network Interaction; Use with the GNU General Public License. + +Notwithstanding any other provision of this License, if you modify the +Program, your modified version must prominently offer all users +interacting with it remotely through a computer network (if your version +supports such interaction) an opportunity to receive the Corresponding +Source of your version by providing access to the Corresponding Source +from a network server at no charge, through some standard or customary +means of facilitating copying of software. This Corresponding Source +shall include the Corresponding Source for any work covered by version 3 +of the GNU General Public License that is incorporated pursuant to the +following paragraph. + +Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the work with which it is combined will remain governed by version +3 of the GNU General Public License. + +14. Revised Versions of this License. + +The Free Software Foundation may publish revised and/or new versions of +the GNU Affero General Public License from time to time. Such new versions +will be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU Affero General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU Affero General Public License, you may choose any version ever published +by the Free Software Foundation. + +If the Program specifies that a proxy can decide which future +versions of the GNU Affero General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + +Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + +15. Disclaimer of Warranty. + +THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + +16. Limitation of Liability. + +IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + +17. Interpretation of Sections 15 and 16. + +If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + +If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + +To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + MystBin: Easily share code or text + Copyright (C) 2024 - current PythonistaGuild + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Affero General Public License as published + by the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Affero General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + +If your software can interact with users remotely through a computer +network, you should also make sure that it provides a way for users to +get its source. For example, if your program is a web application, its +interface could display a "Source" link that leads users to an archive +of the code. There are many ways you could offer source, and different +solutions will be better for different programs; see section 13 for the +specific requirements. + +You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU AGPL, see +. From d72896b57ba986b704dfb18ab2ed887d0a66b082 Mon Sep 17 00:00:00 2001 From: LostLuma Date: Thu, 28 Nov 2024 13:49:43 +0100 Subject: [PATCH 24/36] Pin Rust container version Signed-off-by: Lilly Rose Berner --- echo/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/echo/Dockerfile b/echo/Dockerfile index 7e75b41..20deccc 100644 --- a/echo/Dockerfile +++ b/echo/Dockerfile @@ -1,4 +1,4 @@ -FROM rust:latest AS build +FROM rust:1.82.0 AS build ARG PROFILE=release From cd78dbcd6194e1cb5a853ba2871fd4d29081f984 Mon Sep 17 00:00:00 2001 From: LostLuma Date: Fri, 29 Nov 2024 11:27:31 +0100 Subject: [PATCH 25/36] Reorganize scanner code, add secret invalidation Signed-off-by: Lilly Rose Berner --- echo/Cargo.lock | 109 +++++++++++++++++++++- echo/Cargo.toml | 2 +- echo/example.config.json | 5 +- echo/src/config.rs | 4 + echo/src/database/pastes.rs | 17 +++- echo/src/main.rs | 10 --- echo/src/scanners.rs | 164 ---------------------------------- echo/src/scanners/discord.rs | 44 +++++++++ echo/src/scanners/generic.rs | 41 +++++++++ echo/src/scanners/mod.rs | 128 ++++++++++++++++++++++++++ echo/src/scanners/reporter.rs | 121 +++++++++++++++++++++++++ 11 files changed, 461 insertions(+), 184 deletions(-) delete mode 100644 echo/src/scanners.rs create mode 100644 echo/src/scanners/discord.rs create mode 100644 echo/src/scanners/generic.rs create mode 100644 echo/src/scanners/mod.rs create mode 100644 echo/src/scanners/reporter.rs diff --git a/echo/Cargo.lock b/echo/Cargo.lock index e77026f..5561ab0 100644 --- a/echo/Cargo.lock +++ b/echo/Cargo.lock @@ -123,6 +123,12 @@ dependencies = [ "bytemuck", ] +[[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.4.0" @@ -760,6 +766,25 @@ dependencies = [ "tracing", ] +[[package]] +name = "h2" +version = "0.4.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "524e8ac6999421f49a846c2d4411f337e53497d8ec55d67753beffa43c5d9205" +dependencies = [ + "atomic-waker", + "bytes", + "fnv", + "futures-core", + "futures-sink", + "http 1.1.0", + "indexmap", + "slab", + "tokio", + "tokio-util", + "tracing", +] + [[package]] name = "hashbrown" version = "0.14.5" @@ -926,7 +951,7 @@ dependencies = [ "futures-channel", "futures-core", "futures-util", - "h2", + "h2 0.3.26", "http 0.2.12", "http-body 0.4.6", "httparse", @@ -949,6 +974,7 @@ dependencies = [ "bytes", "futures-channel", "futures-util", + "h2 0.4.6", "http 1.1.0", "http-body 1.0.1", "httparse", @@ -959,6 +985,23 @@ dependencies = [ "want", ] +[[package]] +name = "hyper-rustls" +version = "0.27.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "08afdbb5c31130e3034af566421053ab03787c640246a446327f550d11bcb333" +dependencies = [ + "futures-util", + "http 1.1.0", + "hyper 1.5.0", + "hyper-util", + "rustls 0.23.17", + "rustls-pki-types", + "tokio", + "tokio-rustls", + "tower-service", +] + [[package]] name = "hyper-tls" version = "0.6.0" @@ -1808,12 +1851,15 @@ checksum = "f713147fbe92361e52392c73b8c9e48c04c6625bce969ef54dc901e58e042a7b" dependencies = [ "base64 0.22.1", "bytes", + "encoding_rs", "futures-core", "futures-util", + "h2 0.4.6", "http 1.1.0", "http-body 1.0.1", "http-body-util", "hyper 1.5.0", + "hyper-rustls", "hyper-tls", "hyper-util", "ipnet", @@ -1829,6 +1875,7 @@ dependencies = [ "serde_json", "serde_urlencoded", "sync_wrapper", + "system-configuration", "tokio", "tokio-native-tls", "tower-service", @@ -2014,10 +2061,23 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3f56a14d1f48b391359b22f731fd4bd7e43c97f3c50eee276f3aa09c94784d3e" dependencies = [ "ring", - "rustls-webpki", + "rustls-webpki 0.101.7", "sct", ] +[[package]] +name = "rustls" +version = "0.23.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f1a745511c54ba6d4465e8d5dfbd81b45791756de28d4981af70d6dca128f1e" +dependencies = [ + "once_cell", + "rustls-pki-types", + "rustls-webpki 0.102.8", + "subtle", + "zeroize", +] + [[package]] name = "rustls-pemfile" version = "1.0.4" @@ -2052,6 +2112,17 @@ dependencies = [ "untrusted", ] +[[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.18" @@ -2359,7 +2430,7 @@ dependencies = [ "once_cell", "paste", "percent-encoding", - "rustls", + "rustls 0.21.12", "rustls-pemfile 1.0.4", "serde", "serde_json", @@ -2585,6 +2656,27 @@ dependencies = [ "futures-core", ] +[[package]] +name = "system-configuration" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3c879d448e9d986b661742763247d3693ed13609438cf3d006f51f5368a5ba6b" +dependencies = [ + "bitflags", + "core-foundation", + "system-configuration-sys", +] + +[[package]] +name = "system-configuration-sys" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e1d1b10ced5ca923a1fcb8d03e96b8d3268065d724548c0211415ff6ac6bac4" +dependencies = [ + "core-foundation-sys", + "libc", +] + [[package]] name = "tempfile" version = "3.13.0" @@ -2734,6 +2826,17 @@ dependencies = [ "tokio", ] +[[package]] +name = "tokio-rustls" +version = "0.26.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0c7bc40d0e5a97695bb96e27995cd3a08538541b0a846f65bba7a359f36700d4" +dependencies = [ + "rustls 0.23.17", + "rustls-pki-types", + "tokio", +] + [[package]] name = "tokio-stream" version = "0.1.16" diff --git a/echo/Cargo.toml b/echo/Cargo.toml index 06d1fab..c38a1b4 100644 --- a/echo/Cargo.toml +++ b/echo/Cargo.toml @@ -11,7 +11,7 @@ figment = { version = "0.10.19", features = ["json"] } once_cell = "1.20.2" rand = "0.8.5" regex = "1.11.1" -reqwest = { version = "0.12.8", default-features = false, features = ["json", "native-tls-alpn", "native-tls-vendored"] } +reqwest = { version = "0.12.8", features = ["json", "native-tls-alpn", "native-tls-vendored"] } rocket = { version = "0.5.1", features = ["json"] } rocket-validation = "0.2.0" rocket_db_pools = { version = "0.2.0", features = ["sqlx_postgres"] } diff --git a/echo/example.config.json b/echo/example.config.json index edbd645..4b41066 100644 --- a/echo/example.config.json +++ b/echo/example.config.json @@ -1,7 +1,8 @@ { "allowed_hosts": ["http://localhost:1234", "https://mystb.in"], + "github_token": "github_pat_KOBfYbSdPtOGcvSMdkoUye_IWEadGCSJxVffBVHZZRSCXBqvhKzKTaddmyBaZcHxWLdJQIOhJbpsbiEWx", "extra_scanners": [ - { "name": "PyPi", "pattern": "pypi-AgEIcHlwaS5vcmc[A-Za-z0-9-_]{70,}" }, - { "name": "GitHub", "pattern": "((ghp|gho|ghu|ghs|ghr)_[A-Za-z0-9_]{36})" } + { "name": "PyPi", "pattern": "pypi-AgEIcHlwaS5vcmc[A-Za-z0-9-_]{70,}", "invalidate": true }, + { "name": "GitHub", "pattern": "((ghp|gho|ghu|ghs|ghr)_[A-Za-z0-9_]{36})", "invalidate": true } ] } diff --git a/echo/src/config.rs b/echo/src/config.rs index b24156e..a39ff97 100644 --- a/echo/src/config.rs +++ b/echo/src/config.rs @@ -6,10 +6,14 @@ use serde::{Deserialize, Serialize}; pub struct ScannerConfig { pub name: Arc, pub pattern: String, + pub invalidate: bool, } #[derive(Debug, Deserialize, Serialize)] pub struct Config { + // CORS pub allowed_hosts: Vec, + // Secret Scanning + pub github_token: String, pub extra_scanners: Vec, } diff --git a/echo/src/database/pastes.rs b/echo/src/database/pastes.rs index 6e128b8..8f597a6 100644 --- a/echo/src/database/pastes.rs +++ b/echo/src/database/pastes.rs @@ -121,8 +121,10 @@ impl Paste { } }; + let invalidate_secrets = data.password().is_none(); + for file in data.files() { - let file = File::create(&mut tx, paste.id(), file).await?; + let file = File::create(&mut tx, paste.id(), file, invalidate_secrets).await?; paste.add_file(file); } @@ -178,6 +180,7 @@ impl File { tx: &mut Transaction<'_, Postgres>, paste_id: &str, file: &'r CreateFile<'r>, + invalidate_secrets: bool, ) -> Result { let result = sqlx::query( " @@ -196,7 +199,8 @@ impl File { match result { Ok(row) => { let id: i64 = row.get("id"); - let annotations = Annotation::create(tx, id, file.content()).await?; + let annotations = + Annotation::create(tx, id, file.content(), invalidate_secrets).await?; return Ok(File::from_row(row, annotations)); } @@ -240,12 +244,17 @@ impl Annotation { tx: &mut Transaction<'_, Postgres>, file_id: i64, content: &str, + invalidate_secrets: bool, ) -> Result> { - let scans = scan_file(content); + let scans = scan_file(content, invalidate_secrets).await; let mut annotations = Vec::with_capacity(scans.len()); for scan in scans { - let content = format!("Contains potentially sensitive data from {}.", scan.service); + let mut content = format!("Mystb.in found a secret for {}.", scan.service); + + if invalidate_secrets { + content += " This secret has been invalidated."; + } let result = sqlx::query( " diff --git a/echo/src/main.rs b/echo/src/main.rs index ae0b85a..e40436b 100644 --- a/echo/src/main.rs +++ b/echo/src/main.rs @@ -33,20 +33,10 @@ fn rocket() -> _ { security::delete_security, ]; - let version = env!("CARGO_PKG_VERSION"); - let user_agent = format!("Echo/{} (+https://mystb.in)", version); - - let client = reqwest::Client::builder() - .https_only(true) - .user_agent(user_agent) - .build() - .unwrap(); - let path = env::var("ECHO_CONFIG").expect("ECHO_CONFIG not set"); let provider = rocket::Config::figment().merge(Json::file(path)); rocket::custom(provider) - .manage(client) .mount("/", routes) .attach(AdHoc::config::()) .attach(PgDatabase::init()) diff --git a/echo/src/scanners.rs b/echo/src/scanners.rs deleted file mode 100644 index fcaeb98..0000000 --- a/echo/src/scanners.rs +++ /dev/null @@ -1,164 +0,0 @@ -use std::sync::{Arc, OnceLock}; - -use base64::{prelude::BASE64_STANDARD_NO_PAD, Engine}; -use once_cell::sync::Lazy; -use regex::{Match, Regex}; -use rocket::{ - fairing::{self, Fairing, Info, Kind}, - Build, Rocket, -}; - -use crate::{ - config::{Config, ScannerConfig}, - models::pastes::Position, -}; - -fn find_position(content: &str, position: usize) -> Position { - let haystack = &content[0..position]; - let (idx, line) = haystack.split('\n').enumerate().last().unwrap(); - - Position::new(idx as i32, line.len() as i32) -} - -pub struct ScanResult<'r> { - pub head: Position, - pub tail: Position, - - pub content: &'r str, - pub service: Arc, -} - -trait Scanner: Send + Sync { - fn pattern(&self) -> &Regex; - fn service(&self) -> Arc; - - fn confirm(&self, _item: &Match) -> bool { - true - } - - fn execute<'r>(&self, haystack: &'r str) -> Vec> { - self.pattern() - .find_iter(haystack) - .filter(|x| self.confirm(x)) - .collect() - } -} - -struct DiscordScanner { - name: Arc, -} - -impl DiscordScanner { - fn new() -> Self { - DiscordScanner { - name: Arc::new(String::from("Discord")), - } - } -} - -impl Scanner for DiscordScanner { - fn service(&self) -> Arc { - Arc::clone(&self.name) - } - - fn pattern(&self) -> &'static Regex { - static PATTERN: Lazy = Lazy::new(|| { - Regex::new(r"[a-zA-Z0-9_-]{23,28}\.[a-zA-Z0-9_-]{6,7}\.[a-zA-Z0-9_-]{27,}").unwrap() - }); - - &PATTERN - } - - fn confirm(&self, item: &Match) -> bool { - let mut parts = item.as_str().split('.'); - - let user_id = match parts.next() { - None => return false, - Some(value) => value, - }; - - // Discord tokens have 3 parts total - if parts.count() != 2 { - return false; - } - - match BASE64_STANDARD_NO_PAD.decode(user_id) { - Ok(_) => true, - Err(_) => false, - } - } -} - -struct GenericScanner { - name: Arc, - pattern: Regex, -} - -impl GenericScanner { - fn new(config: &ScannerConfig) -> Self { - let name = Arc::clone(&config.name); - let pattern = Regex::new(&config.pattern).expect("invalid scanner pattern"); - - GenericScanner { name, pattern } - } -} - -impl Scanner for GenericScanner { - fn service(&self) -> Arc { - Arc::clone(&self.name) - } - - fn pattern(&self) -> &Regex { - &self.pattern - } -} - -static SCANNERS: OnceLock>> = OnceLock::new(); - -pub struct InitScanners; - -#[rocket::async_trait] -impl Fairing for InitScanners { - fn info(&self) -> Info { - Info { - name: "Scanner Initialization", - kind: Kind::Ignite, - } - } - - async fn on_ignite(&self, rocket: Rocket) -> fairing::Result { - let config = rocket.state::().unwrap(); - let mut active: Vec> = Vec::new(); - - active.push(Box::new(DiscordScanner::new())); - - for value in &config.extra_scanners { - active.push(Box::new(GenericScanner::new(value))); - } - - if let Err(_) = SCANNERS.set(active) { - panic!("failed to set up scanners!") - } - - Ok(rocket) - } -} - -pub fn scan_file<'r>(content: &'r str) -> Vec> { - let mut results = Vec::new(); - - for scanner in SCANNERS.get().unwrap() { - for result in scanner.execute(content) { - let result = ScanResult { - service: scanner.service(), - content: result.as_str(), - head: find_position(content, result.start()), - tail: find_position(content, result.end()), - }; - - results.push(result); - } - } - - results -} diff --git a/echo/src/scanners/discord.rs b/echo/src/scanners/discord.rs new file mode 100644 index 0000000..4d27ee7 --- /dev/null +++ b/echo/src/scanners/discord.rs @@ -0,0 +1,44 @@ +use std::sync::Arc; + +use base64::{prelude::BASE64_STANDARD_NO_PAD, Engine as _}; +use once_cell::sync::Lazy; +use regex::{Match, Regex}; + +use super::Scanner; + +const NAME: Lazy> = Lazy::new(|| Arc::new(String::from("Discord"))); + +pub struct DiscordScanner; + +impl Scanner for DiscordScanner { + fn service(&self) -> Arc { + Arc::clone(&NAME) + } + + fn pattern(&self) -> &'static Regex { + static PATTERN: Lazy = Lazy::new(|| { + Regex::new(r"[a-zA-Z0-9_-]{23,28}\.[a-zA-Z0-9_-]{6,7}\.[a-zA-Z0-9_-]{27,}").unwrap() + }); + + &PATTERN + } + + fn confirm(&self, item: &Match) -> bool { + let mut parts = item.as_str().split('.'); + + let user_id = match parts.next() { + None => return false, + Some(value) => value, + }; + + // Discord tokens have 3 parts total + if parts.count() != 2 { + return false; + } + + match BASE64_STANDARD_NO_PAD.decode(user_id) { + Ok(_) => true, + Err(_) => false, + } + } +} diff --git a/echo/src/scanners/generic.rs b/echo/src/scanners/generic.rs new file mode 100644 index 0000000..6cf9b3c --- /dev/null +++ b/echo/src/scanners/generic.rs @@ -0,0 +1,41 @@ +use std::sync::Arc; + +use regex::Regex; + +use crate::config::ScannerConfig; + +use super::Scanner; + +pub struct GenericScanner { + name: Arc, + pattern: Regex, + nullify: bool, +} + +impl GenericScanner { + pub fn new(config: &ScannerConfig) -> Self { + let name = Arc::clone(&config.name); + let pattern = Regex::new(&config.pattern).expect("invalid scanner pattern"); + let nullify = config.invalidate; + + GenericScanner { + name, + pattern, + nullify, + } + } +} + +impl Scanner for GenericScanner { + fn pattern(&self) -> &Regex { + &self.pattern + } + + fn service(&self) -> Arc { + Arc::clone(&self.name) + } + + fn nullify(&self) -> bool { + self.nullify + } +} diff --git a/echo/src/scanners/mod.rs b/echo/src/scanners/mod.rs new file mode 100644 index 0000000..6e8f26c --- /dev/null +++ b/echo/src/scanners/mod.rs @@ -0,0 +1,128 @@ +use std::{ + sync::{Arc, OnceLock}, + time::Duration, +}; + +use discord::DiscordScanner; +use generic::GenericScanner; +use regex::{Match, Regex}; +use reporter::SecretReporter; +use rocket::{ + fairing::{self, Fairing, Info, Kind}, + Build, Rocket, +}; +use tokio::time; + +use crate::{config::Config, models::pastes::Position}; + +mod discord; +mod generic; +mod reporter; + +pub struct ScanResult<'r> { + pub head: Position, + pub tail: Position, + + pub content: &'r str, + pub service: Arc, +} + +static REPORTER: OnceLock = OnceLock::new(); +static SCANNERS: OnceLock>> = OnceLock::new(); + +pub async fn scan_file<'r>(content: &'r str, invalidate_secrets: bool) -> Vec> { + let mut results = Vec::new(); + + for scanner in SCANNERS.get().unwrap() { + for finding in scanner.execute(content) { + let result = ScanResult { + service: scanner.service(), + content: finding.as_str(), + head: find_position(content, finding.start()), + tail: find_position(content, finding.end()), + }; + + results.push(result); + + if scanner.nullify() && invalidate_secrets { + REPORTER.get().unwrap().add(finding.as_str()).await; + } + } + } + + results +} + +fn find_position(content: &str, position: usize) -> Position { + let haystack = &content[0..position]; + let (idx, line) = haystack.split('\n').enumerate().last().unwrap(); + + Position::new(idx as i32, line.len() as i32) +} + +trait Scanner: Send + Sync { + fn pattern(&self) -> &Regex; + fn service(&self) -> Arc; + + /// Whether to invalidate found secrets + fn nullify(&self) -> bool { + true + } + + /// Whether a found item might be valid + fn confirm(&self, _item: &Match) -> bool { + true + } + + fn execute<'r>(&self, haystack: &'r str) -> Vec> { + self.pattern() + .find_iter(haystack) + .filter(|x| self.confirm(x)) + .collect() + } +} + +pub struct InitScanners; + +#[rocket::async_trait] +impl Fairing for InitScanners { + fn info(&self) -> Info { + Info { + name: "Scanner Initialization", + kind: Kind::Ignite, + } + } + + async fn on_ignite(&self, rocket: Rocket) -> fairing::Result { + let config = rocket.state::().unwrap(); + let mut active: Vec> = Vec::new(); + + active.push(Box::new(DiscordScanner)); + + for value in &config.extra_scanners { + active.push(Box::new(GenericScanner::new(value))); + } + + if let Err(_) = SCANNERS.set(active) { + panic!("failed to set up scanners") + } + + let reporter = SecretReporter::new(&config.github_token); + + if let Err(_) = REPORTER.set(reporter) { + panic!("failed to set up reporter") + } + + tokio::spawn(async move { + let reporter = REPORTER.get().unwrap(); + let mut interval = time::interval(Duration::from_secs(10)); + + loop { + reporter.run().await; + interval.tick().await; + } + }); + + Ok(rocket) + } +} diff --git a/echo/src/scanners/reporter.rs b/echo/src/scanners/reporter.rs new file mode 100644 index 0000000..3c43a99 --- /dev/null +++ b/echo/src/scanners/reporter.rs @@ -0,0 +1,121 @@ +use std::collections::{HashMap, VecDeque}; + +use reqwest::header::HeaderMap; +use serde::Serialize; +use tokio::sync::Mutex; + +const DESCRIPTION: &str = + "Mystb.in secret scanning is invalidating these secrets. Use secret pastes to disable this."; + +pub struct SecretReporter { + client: reqwest::Client, + queued: Mutex>, + github_token: String, +} + +impl SecretReporter { + pub fn new(github_token: &str) -> Self { + let version = env!("CARGO_PKG_VERSION"); + let user_agent = format!("Echo/{} (+https://mystb.in)", version); + + let client = reqwest::Client::builder() + .https_only(true) + .user_agent(user_agent) + .build() + .unwrap(); + + let queued = Mutex::new(VecDeque::new()); + let github_token = format!("Bearer {github_token}"); + + SecretReporter { + client, + queued, + github_token, + } + } + + pub async fn add(&self, item: &str) { + let mut queue = self.queued.lock().await; + queue.push_back(item.to_owned()); + } + + pub async fn run(&self) { + let queue = self.queued.lock().await; + + if queue.is_empty() { + return; + } + + let copy = queue.clone(); + let mut data = CreateGist::new(); + + for (idx, secret) in copy.iter().enumerate() { + data.add_file(idx.to_string() + ".txt", secret); + } + + drop(queue); // Allow acquiring elsewhere + + if let Err(error) = self.create_gist(data).await { + eprintln!("Failed to create gist: {}", error.0); + } + } + + async fn create_gist<'r>(&self, data: CreateGist<'r>) -> Result<(), GistError> { + let mut headers = HeaderMap::new(); + + headers.append("Authorization", self.github_token.parse().unwrap()); + headers.append("X-GitHub-Api-Version", "2022-11-28".parse().unwrap()); + headers.append("Accept", "application/vnd.github+json".parse().unwrap()); + + self.client + .post("https://api.github.com/gists") + .headers(headers) + .json(&data) + .send() + .await? + .error_for_status()?; + + let mut queue = self.queued.lock().await; + queue.drain(0..data.len()); + + Ok(()) + } +} + +struct GistError(String); + +impl From for GistError { + fn from(value: reqwest::Error) -> Self { + GistError(value.to_string()) + } +} + +#[derive(Serialize)] +struct CreateGist<'r> { + public: bool, + description: &'r str, + files: HashMap>, +} + +impl<'r> CreateGist<'r> { + fn new() -> Self { + CreateGist { + public: true, + files: HashMap::new(), + description: DESCRIPTION, + } + } + + fn len(&self) -> usize { + self.files.len() + } + + fn add_file(&mut self, filename: String, content: &'r str) { + self.files.insert(filename, CreateGistFile { content }); + } +} + +#[derive(Serialize)] +struct CreateGistFile<'r> { + content: &'r str, +} From 8342fbcb3fe5e7159083ff6223542cd0d169df78 Mon Sep 17 00:00:00 2001 From: LostLuma Date: Fri, 29 Nov 2024 11:28:04 +0100 Subject: [PATCH 26/36] Reformat workflow file Signed-off-by: Lilly Rose Berner --- .github/workflows/signoff.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/signoff.yaml b/.github/workflows/signoff.yaml index e61a4b3..29167d3 100644 --- a/.github/workflows/signoff.yaml +++ b/.github/workflows/signoff.yaml @@ -1,4 +1,5 @@ name: validate-signoff + on: pull_request: types: From a143e482845d516df42d6e0cce89f0ef2c2722b3 Mon Sep 17 00:00:00 2001 From: LostLuma Date: Fri, 29 Nov 2024 11:30:58 +0100 Subject: [PATCH 27/36] Update preliminary deployment steps in README Signed-off-by: Lilly Rose Berner --- echo/README.md | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/echo/README.md b/echo/README.md index b3bc48f..7e35dbe 100644 --- a/echo/README.md +++ b/echo/README.md @@ -3,5 +3,10 @@ Run development environment: ```sh -PROFILE=dev sh -c 'docker compose up --watch' +cp example.config.json config.json +vim config.json # Edit to your liking + +PROFILE=dev sh -c 'docker compose up --build --watch' ``` + +To run a production-like setup instead run `docker compose up`. From ebd097ccbbcaebb3e60544571dbd1239a184940d Mon Sep 17 00:00:00 2001 From: LostLuma Date: Fri, 29 Nov 2024 13:38:14 +0100 Subject: [PATCH 28/36] Build echo container image in CI Note: The image is not pushed anywhere yet, that'll hopefully be done by our local CD witch later. Signed-off-by: Lilly Rose Berner --- .github/workflows/build-echo.yaml | 26 ++++++++++++++++++++++++++ echo/test | 0 2 files changed, 26 insertions(+) create mode 100644 .github/workflows/build-echo.yaml create mode 100644 echo/test diff --git a/.github/workflows/build-echo.yaml b/.github/workflows/build-echo.yaml new file mode 100644 index 0000000..ebaec5d --- /dev/null +++ b/.github/workflows/build-echo.yaml @@ -0,0 +1,26 @@ +name: build-echo + +on: + push: + branches: + - main + paths: + - echo/** + pull_request: + paths: + - echo/** + +jobs: + build: + runs-on: ubuntu-24.04 + steps: + - name: set up buildx + uses: docker/setup-buildx-action@v3 + - name: build and push + uses: docker/build-push-action@v6 + with: + # push: true + tags: echo:latest + context: "{{defaultContext}}:echo" + env: + SOURCE_DATE_EPOCH: 0 diff --git a/echo/test b/echo/test new file mode 100644 index 0000000..e69de29 From 1b6f7c713942c315dfed9140b4264a92d362a836 Mon Sep 17 00:00:00 2001 From: LostLuma Date: Fri, 29 Nov 2024 14:12:32 +0100 Subject: [PATCH 29/36] Remove CI trigger test file Signed-off-by: Lilly Rose Berner --- echo/test | 0 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 echo/test diff --git a/echo/test b/echo/test deleted file mode 100644 index e69de29..0000000 From 93d98b48bf8c36b0483daa00e5cf1dc9ed6db914 Mon Sep 17 00:00:00 2001 From: LostLuma Date: Fri, 29 Nov 2024 16:55:57 +0100 Subject: [PATCH 30/36] Allow using compose overrides Signed-off-by: Lilly Rose Berner --- echo/.gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/echo/.gitignore b/echo/.gitignore index ba09094..a85e107 100644 --- a/echo/.gitignore +++ b/echo/.gitignore @@ -1,4 +1,5 @@ .env +compose.override.yaml config.json data/ target/ From 9fe7600d22bafef9c41e8d4570e2abfda29482a0 Mon Sep 17 00:00:00 2001 From: LostLuma Date: Fri, 29 Nov 2024 16:56:34 +0100 Subject: [PATCH 31/36] Ensure dependent containers are restarted if needed Signed-off-by: Lilly Rose Berner --- echo/docker-compose.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/echo/docker-compose.yaml b/echo/docker-compose.yaml index 89ca303..2379d78 100644 --- a/echo/docker-compose.yaml +++ b/echo/docker-compose.yaml @@ -19,6 +19,7 @@ services: restart: always depends_on: db: + restart: true condition: service_healthy environment: - ECHO_CONFIG=/etc/opt/echo/config.json From 56563a7d1cd88dccb745394ce05340377ba2b127 Mon Sep 17 00:00:00 2001 From: LostLuma Date: Fri, 29 Nov 2024 16:57:18 +0100 Subject: [PATCH 32/36] Run healthchecks more frequently during startup for faster cold starts Signed-off-by: Lilly Rose Berner --- echo/Dockerfile | 2 +- echo/docker-compose.yaml | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/echo/Dockerfile b/echo/Dockerfile index 20deccc..d8862e2 100644 --- a/echo/Dockerfile +++ b/echo/Dockerfile @@ -48,7 +48,7 @@ COPY --from=build /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ # Copy last so prior steps are cached doing many rebuilds COPY --from=build /build/bin bin -HEALTHCHECK --interval=5s --timeout=5s --retries=1 CMD ["healthcheck"] +HEALTHCHECK --interval=5s --start-interval=1s --retries=1 --timeout=5s --start-period=1m CMD ["healthcheck"] USER 101:101 CMD ["echo"] diff --git a/echo/docker-compose.yaml b/echo/docker-compose.yaml index 2379d78..131106c 100644 --- a/echo/docker-compose.yaml +++ b/echo/docker-compose.yaml @@ -57,6 +57,8 @@ services: healthcheck: test: ["CMD", "pg_isready", "-U", "echo"] interval: 5s + start_interval: 1s + retries: 1 timeout: 5s start_period: 1m From 7e3270801933f2c9e27e2ab43514dadc86d5dd37 Mon Sep 17 00:00:00 2001 From: LostLuma Date: Sun, 1 Dec 2024 08:59:17 +0100 Subject: [PATCH 33/36] Fix invalidation text showing for secrets that aren't invalidated Signed-off-by: Lilly Rose Berner --- echo/src/database/pastes.rs | 2 +- echo/src/scanners/mod.rs | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/echo/src/database/pastes.rs b/echo/src/database/pastes.rs index 8f597a6..1143e07 100644 --- a/echo/src/database/pastes.rs +++ b/echo/src/database/pastes.rs @@ -252,7 +252,7 @@ impl Annotation { for scan in scans { let mut content = format!("Mystb.in found a secret for {}.", scan.service); - if invalidate_secrets { + if scan.invalidated { content += " This secret has been invalidated."; } diff --git a/echo/src/scanners/mod.rs b/echo/src/scanners/mod.rs index 6e8f26c..c923548 100644 --- a/echo/src/scanners/mod.rs +++ b/echo/src/scanners/mod.rs @@ -24,6 +24,7 @@ pub struct ScanResult<'r> { pub tail: Position, pub content: &'r str, + pub invalidated: bool, pub service: Arc, } @@ -35,16 +36,19 @@ pub async fn scan_file<'r>(content: &'r str, invalidate_secrets: bool) -> Vec Date: Tue, 14 Jan 2025 14:19:47 +0100 Subject: [PATCH 34/36] Move health and docs routes to meta module Signed-off-by: Lilly Rose Berner --- echo/src/main.rs | 10 ++++---- echo/src/routes/docs.rs | 20 ---------------- echo/src/routes/health.rs | 20 ---------------- echo/src/routes/meta.rs | 49 +++++++++++++++++++++++++++++++++++++++ echo/src/routes/mod.rs | 10 +------- 5 files changed, 55 insertions(+), 54 deletions(-) delete mode 100644 echo/src/routes/docs.rs delete mode 100644 echo/src/routes/health.rs create mode 100644 echo/src/routes/meta.rs diff --git a/echo/src/main.rs b/echo/src/main.rs index e40436b..aac677f 100644 --- a/echo/src/main.rs +++ b/echo/src/main.rs @@ -6,7 +6,7 @@ use database::{background_task::BackgroundTask, PgDatabase}; use figment::providers::{Format, Json}; use rocket::{catchers, fairing::AdHoc, figment, routes}; use rocket_db_pools::Database; -use routes::{docs, health, pastes, security}; +use routes::{meta, pastes, security}; use scanners::InitScanners; pub mod config; @@ -21,11 +21,11 @@ pub mod utils; #[rocket::launch] fn rocket() -> _ { let routes = routes![ - routes::get_root, cors::snatcher, - docs::get_docs, - docs::get_spec, - health::health, + meta::get_root, + meta::get_docs, + meta::get_spec, + meta::get_health, pastes::get_paste, pastes::create_paste_simple, pastes::create_paste_structured, diff --git a/echo/src/routes/docs.rs b/echo/src/routes/docs.rs deleted file mode 100644 index ab1b717..0000000 --- a/echo/src/routes/docs.rs +++ /dev/null @@ -1,20 +0,0 @@ -use rocket::{ - get, - response::content::{RawHtml, RawJson}, -}; -use scalar_doc::{Documentation, Theme}; - -#[get("/docs")] -pub fn get_docs() -> RawHtml { - let docs = Documentation::new("MystBin API Documentation", "/docs/spec.json") - .theme(Theme::Alternate) - .build() - .unwrap(); - - RawHtml(docs) -} - -#[get("/docs/spec.json")] -pub fn get_spec() -> RawJson<&'static str> { - RawJson(include_str!("../../openapi.json")) -} diff --git a/echo/src/routes/health.rs b/echo/src/routes/health.rs deleted file mode 100644 index a048534..0000000 --- a/echo/src/routes/health.rs +++ /dev/null @@ -1,20 +0,0 @@ -use rocket::get; -use rocket_db_pools::{ - sqlx::{self, Row}, - Connection, -}; - -use crate::{ - database::PgDatabase, - result::{HTTPError, Result}, -}; - -#[get("/health")] -pub async fn health(mut db: Connection) -> Result { - let result = sqlx::query("SELECT 'ok'").fetch_one(&mut **db).await; - - match result { - Ok(row) => Ok(row.get(0)), - Err(_) => Err(HTTPError::new(503, "Database connection unhealthy.")), - } -} diff --git a/echo/src/routes/meta.rs b/echo/src/routes/meta.rs new file mode 100644 index 0000000..ad978e8 --- /dev/null +++ b/echo/src/routes/meta.rs @@ -0,0 +1,49 @@ +use rocket::{ + get, + response::{ + content::{RawHtml, RawJson}, + Redirect, + }, + serde::json::Json, + uri, +}; +use rocket_db_pools::{ + sqlx::{self, Row}, + Connection, +}; +use scalar_doc::{Documentation, Theme}; + +use crate::{ + database::PgDatabase, + result::{HTTPError, Result}, +}; + +#[get("/")] +pub fn get_root() -> Redirect { + Redirect::temporary(uri!("/docs")) +} + +#[get("/docs")] +pub fn get_docs() -> RawHtml { + let docs = Documentation::new("MystBin API Documentation", "/docs/spec.json") + .theme(Theme::Alternate) + .build() + .unwrap(); + + RawHtml(docs) +} + +#[get("/docs/spec.json")] +pub fn get_spec() -> RawJson<&'static str> { + RawJson(include_str!("../../openapi.json")) +} + +#[get("/health")] +pub async fn get_health(mut db: Connection) -> Result { + let result = sqlx::query("SELECT 'ok'").fetch_one(&mut **db).await; + + match result { + Ok(row) => Ok(row.get(0)), + Err(_) => Err(HTTPError::new(503, "Database connection unhealthy.")), + } +} diff --git a/echo/src/routes/mod.rs b/echo/src/routes/mod.rs index f72b221..dd4da95 100644 --- a/echo/src/routes/mod.rs +++ b/echo/src/routes/mod.rs @@ -1,11 +1,3 @@ -use rocket::{get, response::Redirect, uri}; - -pub mod docs; -pub mod health; +pub mod meta; pub mod pastes; pub mod security; - -#[get("/")] -pub fn get_root() -> Redirect { - Redirect::temporary(uri!("/docs")) -} From 0666b7d6566a79ecb818de1cbf72b78a9e349393 Mon Sep 17 00:00:00 2001 From: LostLuma Date: Tue, 14 Jan 2025 14:20:58 +0100 Subject: [PATCH 35/36] Add `/version` route Signed-off-by: Lilly Rose Berner --- echo/Cargo.lock | 4 ++-- echo/Cargo.toml | 2 +- echo/src/main.rs | 1 + echo/src/models/meta.rs | 16 ++++++++++++++++ echo/src/models/mod.rs | 1 + echo/src/routes/meta.rs | 6 ++++++ 6 files changed, 27 insertions(+), 3 deletions(-) create mode 100644 echo/src/models/meta.rs diff --git a/echo/Cargo.lock b/echo/Cargo.lock index 5561ab0..93f177a 100644 --- a/echo/Cargo.lock +++ b/echo/Cargo.lock @@ -1,6 +1,6 @@ # This file is automatically @generated by Cargo. # It is not intended for manual editing. -version = 3 +version = 4 [[package]] name = "addr2line" @@ -458,7 +458,7 @@ checksum = "1aaf95b3e5c8f23aa320147307562d361db0ae0d51242340f558153b4eb2439b" [[package]] name = "echo" -version = "1.0.0" +version = "5.0.0-alpha.1" dependencies = [ "base64 0.22.1", "chrono", diff --git a/echo/Cargo.toml b/echo/Cargo.toml index c38a1b4..79ef69e 100644 --- a/echo/Cargo.toml +++ b/echo/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "echo" -version = "1.0.0" +version = "5.0.0-alpha.1" publish = false edition = "2021" diff --git a/echo/src/main.rs b/echo/src/main.rs index aac677f..9bd55a0 100644 --- a/echo/src/main.rs +++ b/echo/src/main.rs @@ -26,6 +26,7 @@ fn rocket() -> _ { meta::get_docs, meta::get_spec, meta::get_health, + meta::get_version, pastes::get_paste, pastes::create_paste_simple, pastes::create_paste_structured, diff --git a/echo/src/models/meta.rs b/echo/src/models/meta.rs new file mode 100644 index 0000000..eb2ed93 --- /dev/null +++ b/echo/src/models/meta.rs @@ -0,0 +1,16 @@ +use serde::Serialize; + +#[derive(Clone, Copy, Serialize)] +pub struct Version { + version: &'static str, +} + +impl Version { + const fn new() -> Self { + Version { + version: env!("CARGO_PKG_VERSION"), + } + } +} + +pub static VERSION: Version = Version::new(); diff --git a/echo/src/models/mod.rs b/echo/src/models/mod.rs index 29edf71..dd4da95 100644 --- a/echo/src/models/mod.rs +++ b/echo/src/models/mod.rs @@ -1,2 +1,3 @@ +pub mod meta; pub mod pastes; pub mod security; diff --git a/echo/src/routes/meta.rs b/echo/src/routes/meta.rs index ad978e8..90d7d76 100644 --- a/echo/src/routes/meta.rs +++ b/echo/src/routes/meta.rs @@ -15,6 +15,7 @@ use scalar_doc::{Documentation, Theme}; use crate::{ database::PgDatabase, + models::meta::{Version, VERSION}, result::{HTTPError, Result}, }; @@ -47,3 +48,8 @@ pub async fn get_health(mut db: Connection) -> Result { Err(_) => Err(HTTPError::new(503, "Database connection unhealthy.")), } } + +#[get("/version")] +pub async fn get_version() -> Json { + Json(VERSION) +} From e1b62f7dde6fd7427c17df2c6632da9d6ad443f6 Mon Sep 17 00:00:00 2001 From: LostLuma Date: Sat, 18 Jan 2025 15:56:45 +0100 Subject: [PATCH 36/36] Bump Rust version to 1.84.0 Signed-off-by: Lilly Rose Berner --- echo/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/echo/Dockerfile b/echo/Dockerfile index d8862e2..fe4892a 100644 --- a/echo/Dockerfile +++ b/echo/Dockerfile @@ -1,4 +1,4 @@ -FROM rust:1.82.0 AS build +FROM rust:1.84.0 AS build ARG PROFILE=release