From e0653e4bddef63a7eabbb61d203875c2ae88d798 Mon Sep 17 00:00:00 2001 From: Nicole Tietz-Sokolskaya Date: Tue, 21 May 2024 12:59:04 +0000 Subject: [PATCH] Create project and documents (#1) This is a big dump of a lot of code, mostly making it so that: - we have a key-value store - we can create/save/load projects and documents - there's a sidebar layout with some placeholders we may or may not need - other stuff I forgot Reviewed-on: https://git.kittencollective.com/nicole/pique/pulls/1 --- .gitignore | 1 + Cargo.lock | 959 +- Cargo.toml | 9 +- Makefile | 11 +- frontend/main.css | 60 + frontend/main.ts | 52 + model_derive/Cargo.lock | 46 + model_derive/Cargo.toml | 11 + model_derive/src/lib.rs | 48 + package-lock.json | 2668 +- package.json | 23 +- src/context.rs | 7 +- src/handler.rs | 2 + src/handler/documents.rs | 170 + src/handler/home.rs | 5 +- src/handler/projects.rs | 92 + src/kv.rs | 42 + src/lib.rs | 3 + src/logging.rs | 4 +- src/main.css | 3 - src/models.rs | 190 + src/prelude.rs | 1 + src/serialize.rs | 16 + src/server.rs | 15 +- src/templates.rs | 19 + static/main.css | 2037 +- static/main.js | 31880 ++++++++++++++++++++- static/style.css | 2844 ++ tailwind.config.js | 36 +- templates/components/nav/main_item.html | 17 + templates/components/sidebar.html | 76 + templates/documents/create_document.html | 44 + templates/documents/edit_document.html | 48 + templates/documents/list_documents.html | 45 + templates/head.html | 3 +- templates/home.html | 112 +- templates/login.html | 10 +- templates/projects/create_project.html | 45 + templates/projects/list_projects.html | 45 + 39 files changed, 39596 insertions(+), 2103 deletions(-) create mode 100644 frontend/main.css create mode 100644 frontend/main.ts create mode 100644 model_derive/Cargo.lock create mode 100644 model_derive/Cargo.toml create mode 100644 model_derive/src/lib.rs create mode 100644 src/handler/documents.rs create mode 100644 src/handler/projects.rs create mode 100644 src/kv.rs delete mode 100644 src/main.css create mode 100644 src/models.rs create mode 100644 src/serialize.rs create mode 100644 static/style.css create mode 100644 templates/components/nav/main_item.html create mode 100644 templates/components/sidebar.html create mode 100644 templates/documents/create_document.html create mode 100644 templates/documents/edit_document.html create mode 100644 templates/documents/list_documents.html create mode 100644 templates/projects/create_project.html create mode 100644 templates/projects/list_projects.html diff --git a/.gitignore b/.gitignore index adeaca8..3da6b60 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ target/ +kvdata/ node_modules/ *.db *.xml diff --git a/Cargo.lock b/Cargo.lock index 00e9889..b5f13e8 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -41,6 +41,15 @@ dependencies = [ "zerocopy", ] +[[package]] +name = "aho-corasick" +version = "0.7.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cc936419f96fa211c1b9166887b38e5e40b19958e5b895be7c1f93adec7071ac" +dependencies = [ + "memchr", +] + [[package]] name = "aho-corasick" version = "1.1.2" @@ -177,7 +186,7 @@ checksum = "16e62a023e7c117e27523144c5d2459f4397fcc3cab0085af8e2224f643a0193" dependencies = [ "proc-macro2", "quote", - "syn 2.0.52", + "syn 2.0.61", ] [[package]] @@ -188,7 +197,7 @@ checksum = "461abc97219de0eaaf81fe3ef974a540158f3d079c2ab200f891f1a2ef201e85" dependencies = [ "proc-macro2", "quote", - "syn 2.0.52", + "syn 2.0.61", ] [[package]] @@ -200,6 +209,12 @@ dependencies = [ "num-traits", ] +[[package]] +name = "atomic" +version = "0.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c59bdb34bc650a32731b31bd8f0829cc15d24a708ee31559e0bb34f2bc320cba" + [[package]] name = "autocfg" version = "1.1.0" @@ -324,6 +339,15 @@ version = "0.22.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9475866fec1451be56a3c2400fd081ff546538961565ccb5b7142cbd22bc7a51" +[[package]] +name = "base64-simd" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "781dd20c3aff0bd194fe7d2a977dd92f21c173891f3a03b677359e5fa457e5d5" +dependencies = [ + "simd-abstraction", +] + [[package]] name = "base64ct" version = "1.6.0" @@ -341,6 +365,34 @@ dependencies = [ "num-traits", ] +[[package]] +name = "bincode" +version = "1.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b1f45e9417d87227c7a56d22e471c6206462cba514c7590c09aff4cf6d1ddcad" +dependencies = [ + "serde", +] + +[[package]] +name = "bincode" +version = "2.0.0-rc.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f11ea1a0346b94ef188834a65c068a03aec181c94896d481d7a0a40d85b0ce95" +dependencies = [ + "bincode_derive", + "serde", +] + +[[package]] +name = "bincode_derive" +version = "2.0.0-rc.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7e30759b3b99a1b802a7a3aa21c85c3ded5c28e1c83170d82d70f08bbf7f3e4c" +dependencies = [ + "virtue", +] + [[package]] name = "bitflags" version = "1.3.2" @@ -406,7 +458,7 @@ dependencies = [ "proc-macro-crate", "proc-macro2", "quote", - "syn 2.0.52", + "syn 2.0.61", "syn_derive", ] @@ -456,6 +508,15 @@ version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a2bd12c1caf447e69cd4528f47f94d203fd2582878ecb9e9465484c4148a8223" +[[package]] +name = "cache-advisor" +version = "1.0.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f89ab55ca4e6a46a0740a1c5346db1ad66e4a76598bbfa060dc3259935a7450" +dependencies = [ + "crossbeam-queue", +] + [[package]] name = "camino" version = "1.1.6" @@ -492,6 +553,10 @@ name = "cc" version = "1.0.90" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8cd6604a82acf3039f1144f54b8eb34e91ffba622051189e71b781822d5ee1f5" +dependencies = [ + "jobserver", + "libc", +] [[package]] name = "cfg-if" @@ -507,14 +572,16 @@ checksum = "fd16c4719339c4530435d38e511904438d07cce7950afa3718a84ac36c10e89e" [[package]] name = "chrono" -version = "0.4.35" +version = "0.4.38" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8eaf5903dcbc0a39312feb77df2ff4c76387d591b9fc7b04a238dcf8bb62639a" +checksum = "a21f936df1771bf62b77f047b726c4625ff2e8aa607c01ec06e5a05bd8463401" dependencies = [ "android-tzdata", "iana-time-zone", + "js-sys", "num-traits", "serde", + "wasm-bindgen", "windows-targets 0.52.4", ] @@ -549,7 +616,7 @@ dependencies = [ "heck 0.5.0", "proc-macro2", "quote", - "syn 2.0.52", + "syn 2.0.61", ] [[package]] @@ -564,12 +631,52 @@ version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "acbf1af155f9b9ef647e42cdc158db4b64a1b61f743629225fde6f3e0be2a7c7" +[[package]] +name = "concurrent-map" +version = "5.0.33" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d2f5531a18ad61836deb8c2987422e44a38575564f423f448fe9e6cbbcb2171a" +dependencies = [ + "ebr", + "serde", + "stack-map", +] + [[package]] name = "const-oid" version = "0.9.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c2459377285ad874054d797f3ccebf984978aa39129f6eafde5cdc8315b612f8" +[[package]] +name = "const-str" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "21077772762a1002bb421c3af42ac1725fa56066bfc53d9a55bb79905df2aaf3" +dependencies = [ + "const-str-proc-macro", +] + +[[package]] +name = "const-str-proc-macro" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5e1e0fdd2e5d3041e530e1b21158aeeef8b5d0e306bc5c1e3d6cf0930d10e25a" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "convert_case" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec182b0ca2f35d8fc196cf3404988fd8b8c739a4d270ff118a398feb0cbec1ca" +dependencies = [ + "unicode-segmentation", +] + [[package]] name = "cookie" version = "0.18.0" @@ -611,6 +718,15 @@ version = "2.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "19d374276b40fb8bbdee95aef7c7fa6b5316ec764510eb64b8dd0e2ed0d7e7f5" +[[package]] +name = "crc32fast" +version = "1.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b3855a8a784b474f333699ef2bbca9db2c4a1f6d9088a90a2d25b1eb53111eaa" +dependencies = [ + "cfg-if", +] + [[package]] name = "crossbeam-channel" version = "0.5.12" @@ -620,6 +736,16 @@ dependencies = [ "crossbeam-utils", ] +[[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" @@ -638,6 +764,16 @@ dependencies = [ "crossbeam-utils", ] +[[package]] +name = "crossbeam-skiplist" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "df29de440c58ca2cc6e587ec3d22347551a32435fbde9d2bff64e78a9ffa151b" +dependencies = [ + "crossbeam-epoch", + "crossbeam-utils", +] + [[package]] name = "crossbeam-utils" version = "0.8.19" @@ -654,6 +790,66 @@ dependencies = [ "typenum", ] +[[package]] +name = "cssparser" +version = "0.33.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9be934d936a0fbed5bcdc01042b770de1398bf79d0e192f49fa7faea0e99281e" +dependencies = [ + "cssparser-macros", + "dtoa-short", + "itoa", + "phf 0.11.2", + "smallvec", +] + +[[package]] +name = "cssparser-color" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "556c099a61d85989d7af52b692e35a8d68a57e7df8c6d07563dc0778b3960c9f" +dependencies = [ + "cssparser", +] + +[[package]] +name = "cssparser-macros" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "13b588ba4ac1a99f7f2964d24b3d896ddc6bf847ee3855dbd4366f058cfcd331" +dependencies = [ + "quote", + "syn 2.0.61", +] + +[[package]] +name = "dashmap" +version = "5.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "978747c1d849a7d2ee5e8adc0159961c48fb7e5db2f06af6723b80123bb53856" +dependencies = [ + "cfg-if", + "hashbrown 0.14.3", + "lock_api", + "once_cell", + "parking_lot_core", +] + +[[package]] +name = "data-encoding" +version = "2.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e8566979429cf69b49a5c740c60791108e86440e8be149bbea4fe54d2c32d6e2" + +[[package]] +name = "data-url" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3a30bfce702bcfa94e906ef82421f2c0e61c076ad76030c16ee5d2e9a32fe193" +dependencies = [ + "matches", +] + [[package]] name = "der" version = "0.7.8" @@ -704,6 +900,36 @@ version = "0.15.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1aaf95b3e5c8f23aa320147307562d361db0ae0d51242340f558153b4eb2439b" +[[package]] +name = "double-ended-peekable" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c0d05e1c0dbad51b52c38bda7adceef61b9efc2baf04acfe8726a8c4630a6f57" + +[[package]] +name = "dtoa" +version = "1.0.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dcbb2bf8e87535c23f7a8a321e364ce21462d0ff10cb6407820e8e96dfff6653" + +[[package]] +name = "dtoa-short" +version = "0.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dbaceec3c6e4211c79e7b1800fb9680527106beb2f9c51904a3210c03a448c74" +dependencies = [ + "dtoa", +] + +[[package]] +name = "ebr" +version = "0.2.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2a7f90b4164e55fcf36357b68aa2c13f6c922b16ba96f219a5220abd5a94fc4b" +dependencies = [ + "shared-local-state", +] + [[package]] name = "either" version = "1.10.0" @@ -784,6 +1010,12 @@ version = "2.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "25cbce373ec4653f1a01a31e8a5e5ec0c622dc27ff9c4e6606eefef5cbbed4a5" +[[package]] +name = "fault-injection" +version = "1.0.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9e3d175246dec3fddef3b1fcd57acdb023e4c562d032e9eccc5f246da3d7fed3" + [[package]] name = "filetime" version = "0.2.23" @@ -802,6 +1034,32 @@ version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8fcfdc7a0362c9f4444381a9e697c79d435fe65b52a37466fc2c1184cee9edc6" +[[package]] +name = "fjall" +version = "0.6.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "caa8b3cbbdfa775c311965846c523ae291327a5cc3e433479583922ff9527594" +dependencies = [ + "byteorder", + "crc32fast", + "fs_extra", + "log", + "lsm-tree", + "path-absolutize", + "std-semaphore", + "tempfile", +] + +[[package]] +name = "flate2" +version = "1.0.30" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5f54427cfd1c7829e2a139fcefea601bf088ebca651d2bf53ebc600eac295dae" +dependencies = [ + "crc32fast", + "miniz_oxide", +] + [[package]] name = "flume" version = "0.11.0" @@ -828,6 +1086,38 @@ dependencies = [ "percent-encoding", ] +[[package]] +name = "free-icons" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6fff54f5619200d038566c3b9509bab5a921d1712a02e9ccd330d2893d753e84" +dependencies = [ + "anyhow", + "bincode 2.0.0-rc.3", + "convert_case", + "flate2", + "lazy_static", + "minify-html", + "minijinja", + "serde_json", +] + +[[package]] +name = "fs2" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9564fc758e15025b46aa6643b1b77d047d1a56a1aea6e01002ac0c7026876213" +dependencies = [ + "libc", + "winapi", +] + +[[package]] +name = "fs_extra" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "42703706b716c37f96a77aea830392ad231f44c9e9a67872fa5548707e11b11c" + [[package]] name = "fsevent-sys" version = "4.1.0" @@ -837,6 +1127,12 @@ dependencies = [ "libc", ] +[[package]] +name = "fuchsia-cprng" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a06f77d526c1a601b7c4cdd98f54b5eaabffc14d5f2f0296febdc7f357c6d3ba" + [[package]] name = "funty" version = "2.0.0" @@ -909,7 +1205,7 @@ checksum = "87750cf4b7a4c0625b1529e4c543c2182106e4dedc60a2a6455e00d212c489ac" dependencies = [ "proc-macro2", "quote", - "syn 2.0.52", + "syn 2.0.61", ] [[package]] @@ -942,6 +1238,15 @@ dependencies = [ "slab", ] +[[package]] +name = "fxhash" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c31b6d751ae2c7f11320402d34e41349dd1016f8d5d45e48c4312bc8625af50c" +dependencies = [ + "byteorder", +] + [[package]] name = "generic-array" version = "0.14.7" @@ -975,6 +1280,12 @@ version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d2fabcfbdc87f4758337ca535fb41a6d701b65693ce38287d856d1674551ec9b" +[[package]] +name = "guardian" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6817154789d2e9bb2af0486500e774af579d0e6539247044f06d803b141448b5" + [[package]] name = "h2" version = "0.4.3" @@ -1003,6 +1314,16 @@ dependencies = [ "ahash 0.7.8", ] +[[package]] +name = "hashbrown" +version = "0.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "43a3c133739dddd0d2990f9a4bdf8eb4b21ef50e4851ca85ab661199821d510e" +dependencies = [ + "ahash 0.8.11", + "bumpalo", +] + [[package]] name = "hashbrown" version = "0.14.3" @@ -1221,7 +1542,17 @@ checksum = "0122b7114117e64a63ac49f752a5ca4624d534c7b1c7de796ac196381cd2d947" dependencies = [ "proc-macro2", "quote", - "syn 2.0.52", + "syn 2.0.61", +] + +[[package]] +name = "inline-array" +version = "0.1.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e86268f00167193a59f2145028ad707d5c1db9c2d89585ece0b8cc8a2b13fb5e" +dependencies = [ + "concurrent-map", + "serde", ] [[package]] @@ -1244,6 +1575,15 @@ dependencies = [ "libc", ] +[[package]] +name = "itertools" +version = "0.10.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b0fd2260e829bddf4cb6ea802289de2f86d6a7a690192fbe91b3f46e0f2c8473" +dependencies = [ + "either", +] + [[package]] name = "itertools" version = "0.12.1" @@ -1259,6 +1599,15 @@ version = "1.0.10" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b1a46d1a171d865aa5f83f92695765caa047a9b4cbae2cbf37dbd613a793fd4c" +[[package]] +name = "jobserver" +version = "0.1.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d2b099aaa34a9751c5bf0878add70444e1ed2dd73f347be99003d4577277de6e" +dependencies = [ + "libc", +] + [[package]] name = "js-sys" version = "0.3.69" @@ -1320,6 +1669,31 @@ dependencies = [ "vcpkg", ] +[[package]] +name = "lightningcss" +version = "1.0.0-alpha.55" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3bd5bed3814fb631bfc1e24c2be6f7e86a9837c660909acab79a38374dcb8798" +dependencies = [ + "ahash 0.8.11", + "bitflags 2.4.2", + "const-str", + "cssparser", + "cssparser-color", + "dashmap", + "data-encoding", + "getrandom", + "itertools 0.10.5", + "lazy_static", + "parcel_selectors", + "parcel_sourcemap", + "paste", + "pathdiff", + "rayon", + "serde", + "smallvec", +] + [[package]] name = "linux-raw-sys" version = "0.4.13" @@ -1343,6 +1717,38 @@ version = "0.4.21" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "90ed8c1e510134f979dbc4f070f87d4313098b704861a105fe34231c70a3901c" +[[package]] +name = "lsm-tree" +version = "0.6.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "792f0f9d75b518035f7247774580ba60ee211d381237946e1a40609433f5573f" +dependencies = [ + "byteorder", + "chrono", + "crc32fast", + "crossbeam-skiplist", + "double-ended-peekable", + "fs_extra", + "guardian", + "log", + "lz4_flex", + "path-absolutize", + "quick_cache", + "rand 0.8.5", + "serde", + "serde_json", + "tempfile", +] + +[[package]] +name = "lz4_flex" +version = "0.11.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "75761162ae2b0e580d7e7c390558127e5f01b4194debd6221fd8c207fc80e3f5" +dependencies = [ + "twox-hash", +] + [[package]] name = "matchers" version = "0.1.0" @@ -1352,6 +1758,12 @@ dependencies = [ "regex-automata 0.1.10", ] +[[package]] +name = "matches" +version = "0.1.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2532096657941c2fea9c289d370a250971c689d4f143798ff67113ec042024a5" + [[package]] name = "matchit" version = "0.7.3" @@ -1396,6 +1808,47 @@ dependencies = [ "unicase", ] +[[package]] +name = "minify-html" +version = "0.15.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1cd4517942a8e7425c990b14977f86a63e4996eed7b15cfcca1540126ac5ff25" +dependencies = [ + "aho-corasick 0.7.20", + "lazy_static", + "lightningcss", + "memchr", + "minify-html-common", + "minify-js", + "once_cell", + "rustc-hash", +] + +[[package]] +name = "minify-html-common" +version = "0.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "697a6b40dffdc5de10c0cbd709dc2bc2039cea9dab8aaa636eb9a49d6b411780" +dependencies = [ + "aho-corasick 0.7.20", + "itertools 0.12.1", + "lazy_static", + "memchr", + "rustc-hash", + "serde", + "serde_json", +] + +[[package]] +name = "minify-js" +version = "0.5.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "22d6c512a82abddbbc13b70609cb2beff01be2c7afff534d6e5e1c85e438fc8b" +dependencies = [ + "lazy_static", + "parse-js", +] + [[package]] name = "minijinja" version = "1.0.14" @@ -1405,6 +1858,8 @@ dependencies = [ "memo-map", "self_cell", "serde", + "serde_json", + "v_htmlescape", ] [[package]] @@ -1444,6 +1899,14 @@ dependencies = [ "windows-sys 0.48.0", ] +[[package]] +name = "model_derive" +version = "0.1.0" +dependencies = [ + "quote", + "syn 2.0.61", +] + [[package]] name = "moka" version = "0.12.5" @@ -1528,7 +1991,7 @@ dependencies = [ "num-integer", "num-iter", "num-traits", - "rand", + "rand 0.8.5", "smallvec", "zeroize", ] @@ -1624,15 +2087,57 @@ dependencies = [ "proc-macro-error", "proc-macro2", "quote", - "syn 2.0.52", + "syn 2.0.61", ] +[[package]] +name = "outref" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f222829ae9293e33a9f5e9f440c6760a3d450a64affe1846486b140db81c1f4" + [[package]] name = "overload" version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b15813163c1d831bf4a13c3610c05c0d03b39feb07f7e09fa234dac9b15aaf39" +[[package]] +name = "pagetable" +version = "0.4.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "92a516a35619e87f5c17e7a5dd0e0313aa01aecbd39b3c650b22a4500d74f6e0" + +[[package]] +name = "parcel_selectors" +version = "0.26.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "05d74befe2d076330d9a58bf9ca2da424568724ab278adf15fb5718253133887" +dependencies = [ + "bitflags 2.4.2", + "cssparser", + "fxhash", + "log", + "phf 0.10.1", + "phf_codegen", + "precomputed-hash", + "smallvec", +] + +[[package]] +name = "parcel_sourcemap" +version = "2.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "485b74d7218068b2b7c0e3ff12fbc61ae11d57cb5d8224f525bd304c6be05bbb" +dependencies = [ + "base64-simd", + "data-url", + "rkyv", + "serde", + "serde_json", + "vlq", +] + [[package]] name = "parking_lot" version = "0.12.1" @@ -1656,6 +2161,19 @@ dependencies = [ "windows-targets 0.48.5", ] +[[package]] +name = "parse-js" +version = "0.17.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ec3b11d443640ec35165ee8f6f0559f1c6f41878d70330fe9187012b5935f02" +dependencies = [ + "aho-corasick 0.7.20", + "bumpalo", + "hashbrown 0.13.2", + "lazy_static", + "memchr", +] + [[package]] name = "password-hash" version = "0.5.0" @@ -1663,7 +2181,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "346f04948ba92c43e8469c1ee6736c7563d71012b17d40745260fe106aac2166" dependencies = [ "base64ct", - "rand_core", + "rand_core 0.6.4", "subtle", ] @@ -1673,6 +2191,30 @@ version = "1.0.14" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "de3145af08024dea9fa9914f381a17b8fc6034dfb00f3a84013f7ff43f29ed4c" +[[package]] +name = "path-absolutize" +version = "3.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e4af381fe79fa195b4909485d99f73a80792331df0625188e707854f0b3383f5" +dependencies = [ + "path-dedot", +] + +[[package]] +name = "path-dedot" +version = "3.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "07ba0ad7e047712414213ff67533e6dd477af0a4e1d14fb52343e53d30ea9397" +dependencies = [ + "once_cell", +] + +[[package]] +name = "pathdiff" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8835116a5c179084a830efb3adc117ab007512b535bc1a21c991d3b32a6b44dd" + [[package]] name = "pem-rfc7468" version = "0.7.0" @@ -1688,6 +2230,86 @@ version = "2.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e" +[[package]] +name = "phf" +version = "0.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fabbf1ead8a5bcbc20f5f8b939ee3f5b0f6f281b6ad3468b84656b658b455259" +dependencies = [ + "phf_shared 0.10.0", +] + +[[package]] +name = "phf" +version = "0.11.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ade2d8b8f33c7333b51bcf0428d37e217e9f32192ae4772156f65063b8ce03dc" +dependencies = [ + "phf_macros", + "phf_shared 0.11.2", +] + +[[package]] +name = "phf_codegen" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4fb1c3a8bc4dd4e5cfce29b44ffc14bedd2ee294559a294e2a4d4c9e9a6a13cd" +dependencies = [ + "phf_generator 0.10.0", + "phf_shared 0.10.0", +] + +[[package]] +name = "phf_generator" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5d5285893bb5eb82e6aaf5d59ee909a06a16737a8970984dd7746ba9283498d6" +dependencies = [ + "phf_shared 0.10.0", + "rand 0.8.5", +] + +[[package]] +name = "phf_generator" +version = "0.11.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "48e4cc64c2ad9ebe670cb8fd69dd50ae301650392e81c05f9bfcb2d5bdbc24b0" +dependencies = [ + "phf_shared 0.11.2", + "rand 0.8.5", +] + +[[package]] +name = "phf_macros" +version = "0.11.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3444646e286606587e49f3bcf1679b8cef1dc2c5ecc29ddacaffc305180d464b" +dependencies = [ + "phf_generator 0.11.2", + "phf_shared 0.11.2", + "proc-macro2", + "quote", + "syn 2.0.61", +] + +[[package]] +name = "phf_shared" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6796ad771acdc0123d2a88dc428b5e38ef24456743ddb1744ed628f9815c096" +dependencies = [ + "siphasher", +] + +[[package]] +name = "phf_shared" +version = "0.11.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "90fcb95eef784c2ac79119d1dd819e162b5da872ce6f3c3abe1e8ca1c082f72b" +dependencies = [ + "siphasher", +] + [[package]] name = "pin-project" version = "1.1.5" @@ -1705,7 +2327,7 @@ checksum = "2f38a4412a78282e09a2cf38d195ea5420d15ba0602cb375210efbc877243965" dependencies = [ "proc-macro2", "quote", - "syn 2.0.52", + "syn 2.0.61", ] [[package]] @@ -1730,14 +2352,20 @@ dependencies = [ "axum", "axum-htmx", "axum-login", + "bincode 1.3.3", "clap", "dotenvy", "env_logger", + "fjall", + "free-icons", "minijinja", "minijinja-autoreload", - "rand", + "model_derive", + "rand 0.8.5", + "redb", "sea-orm", "serde", + "sled", "thiserror", "tokio", "tower-http", @@ -1746,6 +2374,7 @@ dependencies = [ "tower-sessions-sqlx-store", "tracing", "tracing-subscriber", + "uuid", ] [[package]] @@ -1787,6 +2416,12 @@ version = "0.2.17" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de" +[[package]] +name = "precomputed-hash" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "925383efa346730478fb4838dbe9137d2a47675ad789c546d150a6e1dd4ab31c" + [[package]] name = "proc-macro-crate" version = "3.1.0" @@ -1822,9 +2457,9 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.79" +version = "1.0.82" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e835ff2298f5721608eb1a980ecaee1aef2c132bf95ecc026a11b7bf3c01c02e" +checksum = "8ad3d49ab951a01fbaafe34f2ec74122942fe18a3f9814c3268f1bb72042131b" dependencies = [ "unicode-ident", ] @@ -1876,10 +2511,20 @@ dependencies = [ ] [[package]] -name = "quote" -version = "1.0.35" +name = "quick_cache" +version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "291ec9ab5efd934aaf503a6466c5d5251535d108ee747472c3977cc5acc868ef" +checksum = "347e1a588d1de074eeb3c00eadff93db4db65aeb62aee852b1efd0949fe65b6c" +dependencies = [ + "equivalent", + "hashbrown 0.14.3", +] + +[[package]] +name = "quote" +version = "1.0.36" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0fa76aaf39101c457836aec0ce2316dbdc3ab723cdda1c6bd4e6ad4208acaca7" dependencies = [ "proc-macro2", ] @@ -1890,6 +2535,19 @@ version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dc33ff2d4973d518d823d61aa239014831e521c75da58e3df4840d3f47749d09" +[[package]] +name = "rand" +version = "0.4.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "552840b97013b1a26992c11eac34bdd778e464601a4c2054b5f0bff7c6761293" +dependencies = [ + "fuchsia-cprng", + "libc", + "rand_core 0.3.1", + "rdrand", + "winapi", +] + [[package]] name = "rand" version = "0.8.5" @@ -1898,7 +2556,7 @@ checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404" dependencies = [ "libc", "rand_chacha", - "rand_core", + "rand_core 0.6.4", ] [[package]] @@ -1908,9 +2566,24 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" dependencies = [ "ppv-lite86", - "rand_core", + "rand_core 0.6.4", ] +[[package]] +name = "rand_core" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7a6fdeb83b075e8266dcc8762c22776f6877a63111121f5f8c7411e5be7eed4b" +dependencies = [ + "rand_core 0.4.2", +] + +[[package]] +name = "rand_core" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9c33a3c44ca05fa6f1807d8e6743f3824e8509beca625669633be0acbdf509dc" + [[package]] name = "rand_core" version = "0.6.4" @@ -1929,6 +2602,44 @@ dependencies = [ "bitflags 2.4.2", ] +[[package]] +name = "rayon" +version = "1.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b418a60154510ca1a002a752ca9714984e21e4241e804d32555251faf8b78ffa" +dependencies = [ + "either", + "rayon-core", +] + +[[package]] +name = "rayon-core" +version = "1.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1465873a3dfdaa8ae7cb14b4383657caab0b3e8a0aa9ae8e04b044854c8dfce2" +dependencies = [ + "crossbeam-deque", + "crossbeam-utils", +] + +[[package]] +name = "rdrand" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "678054eb77286b51581ba43620cc911abf02758c91f93f479767aed0f90458b2" +dependencies = [ + "rand_core 0.3.1", +] + +[[package]] +name = "redb" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed7508e692a49b6b2290b56540384ccae9b1fb4d77065640b165835b56ffe3bb" +dependencies = [ + "libc", +] + [[package]] name = "redox_syscall" version = "0.4.1" @@ -1944,7 +2655,7 @@ version = "1.10.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b62dbe01f0b06f9d8dc7d49e05a0785f153b00b2c227856282f671e0318c9b15" dependencies = [ - "aho-corasick", + "aho-corasick 1.1.2", "memchr", "regex-automata 0.4.6", "regex-syntax 0.8.2", @@ -1965,7 +2676,7 @@ version = "0.4.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "86b83b8b9847f9bf95ef68afb0b8e6cdb80f498442f5179a29fad448fcc1eaea" dependencies = [ - "aho-corasick", + "aho-corasick 1.1.2", "memchr", "regex-syntax 0.8.2", ] @@ -1982,6 +2693,15 @@ version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c08c74e62047bb2de4ff487b251e4a92e24f48745648451635cec7d591162d9f" +[[package]] +name = "remove_dir_all" +version = "0.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3acd125665422973a33ac9d3dd2df85edad0f4ae9b00dafb1a05e43a9f5ef8e7" +dependencies = [ + "winapi", +] + [[package]] name = "rend" version = "0.4.2" @@ -2070,7 +2790,7 @@ dependencies = [ "num-traits", "pkcs1", "pkcs8", - "rand_core", + "rand_core 0.6.4", "signature", "spki", "subtle", @@ -2087,7 +2807,7 @@ dependencies = [ "borsh", "bytes", "num-traits", - "rand", + "rand 0.8.5", "rkyv", "serde", "serde_json", @@ -2099,6 +2819,12 @@ version = "0.1.23" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d626bb9dae77e28219937af045c257c28bfd3f69333c512553507f5f9798cb76" +[[package]] +name = "rustc-hash" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2" + [[package]] name = "rustc_version" version = "0.4.0" @@ -2198,7 +2924,7 @@ dependencies = [ "proc-macro-error", "proc-macro2", "quote", - "syn 2.0.52", + "syn 2.0.61", ] [[package]] @@ -2239,7 +2965,7 @@ dependencies = [ "proc-macro2", "quote", "sea-bae", - "syn 2.0.52", + "syn 2.0.61", "unicode-ident", ] @@ -2299,29 +3025,29 @@ dependencies = [ [[package]] name = "serde" -version = "1.0.197" +version = "1.0.201" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3fb1c873e1b9b056a4dc4c0c198b24c3ffa059243875552b2bd0933b1aee4ce2" +checksum = "780f1cebed1629e4753a1a38a3c72d30b97ec044f0aef68cb26650a3c5cf363c" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.197" +version = "1.0.201" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7eb0b34b42edc17f6b7cac84a52a1c5f0e1bb2227e997ca9011ea3dd34e8610b" +checksum = "c5e405930b9796f1c00bee880d03fc7e0bb4b9a11afc776885ffe84320da2865" dependencies = [ "proc-macro2", "quote", - "syn 2.0.52", + "syn 2.0.61", ] [[package]] name = "serde_json" -version = "1.0.114" +version = "1.0.117" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c5f09b1bd632ef549eaa9f60a1f8de742bdbc698e6cee2095fc84dde5f549ae0" +checksum = "455182ea6142b14f93f4bc5320a2b31c1f266b66a4a5c858b013302a5d8cbfc3" dependencies = [ "itoa", "ryu", @@ -2381,6 +3107,15 @@ dependencies = [ "lazy_static", ] +[[package]] +name = "shared-local-state" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3a50ccb2f45251772ed15abfd1e5f10a305288187b1582ab2e4295b29bbb4929" +dependencies = [ + "parking_lot", +] + [[package]] name = "signal-hook-registry" version = "1.4.1" @@ -2397,7 +3132,16 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "77549399552de45a898a580c1b41d445bf730df867cc44e6c0233bbc4b8329de" dependencies = [ "digest", - "rand_core", + "rand_core 0.6.4", +] + +[[package]] +name = "simd-abstraction" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9cadb29c57caadc51ff8346233b5cec1d240b68ce55cf1afc764818791876987" +dependencies = [ + "outref", ] [[package]] @@ -2406,6 +3150,12 @@ version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f27f6278552951f1f2b8cf9da965d10969b2efdea95a6ec47987ab46edfe263a" +[[package]] +name = "siphasher" +version = "0.3.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "38b58827f4464d87d377d175e90bf58eb00fd8716ff0a62f80356b5e61555d0d" + [[package]] name = "skeptic" version = "0.13.7" @@ -2430,6 +3180,33 @@ dependencies = [ "autocfg", ] +[[package]] +name = "sled" +version = "1.0.0-alpha.121" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4c13e52b2355f6d81e32a0271584fe9996120ec9785cf72adc7e9ef8bf96d0fe" +dependencies = [ + "bincode 1.3.3", + "cache-advisor", + "concurrent-map", + "crc32fast", + "crossbeam-channel", + "crossbeam-queue", + "ebr", + "fault-injection", + "fnv", + "fs2", + "inline-array", + "log", + "pagetable", + "parking_lot", + "rayon", + "serde", + "stack-map", + "tempdir", + "zstd", +] + [[package]] name = "smallvec" version = "1.13.1" @@ -2477,7 +3254,7 @@ version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ce81b7bd7c4493975347ef60d8c7e8b742d4694f4c49f93e0a12ea263938176c" dependencies = [ - "itertools", + "itertools 0.12.1", "nom", "unicode_categories", ] @@ -2612,7 +3389,7 @@ dependencies = [ "memchr", "once_cell", "percent-encoding", - "rand", + "rand 0.8.5", "rsa", "rust_decimal", "serde", @@ -2657,7 +3434,7 @@ dependencies = [ "memchr", "num-bigint", "once_cell", - "rand", + "rand 0.8.5", "rust_decimal", "serde", "serde_json", @@ -2698,12 +3475,27 @@ dependencies = [ "uuid", ] +[[package]] +name = "stack-map" +version = "1.0.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b49d6d36fee60faad91e23603db2356677b58ec2429237b39d5c60c26868f37c" +dependencies = [ + "serde", +] + [[package]] name = "static_assertions" version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" +[[package]] +name = "std-semaphore" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "33ae9eec00137a8eed469fb4148acd9fc6ac8c3f9b110f52cd34698c8b5bfa0e" + [[package]] name = "stringprep" version = "0.1.4" @@ -2746,9 +3538,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.52" +version = "2.0.61" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b699d15b36d1f02c3e7c69f8ffef53de37aefae075d8488d4ba1a7788d574a07" +checksum = "c993ed8ccba56ae856363b1845da7266a7cb78e1d146c8a32d54b45a8b831fc9" dependencies = [ "proc-macro2", "quote", @@ -2764,7 +3556,7 @@ dependencies = [ "proc-macro-error", "proc-macro2", "quote", - "syn 2.0.52", + "syn 2.0.61", ] [[package]] @@ -2785,6 +3577,16 @@ version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "55937e1799185b12863d447f42597ed69d9928686b8d88a1df17376a097d8369" +[[package]] +name = "tempdir" +version = "0.3.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "15f2b5fb00ccdf689e0149d1b1b3c03fead81c2b37735d812fa8bddbbf41b6d8" +dependencies = [ + "rand 0.4.6", + "remove_dir_all", +] + [[package]] name = "tempfile" version = "3.10.1" @@ -2814,7 +3616,7 @@ checksum = "c61f3ba182994efc43764a46c018c347bc492c79f024e705f46567b418f6d4f7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.52", + "syn 2.0.61", ] [[package]] @@ -2900,7 +3702,7 @@ checksum = "5b8a1e28f2deaa14e508979454cb3a223b10b938b45af148bc0986de36f1923b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.52", + "syn 2.0.61", ] [[package]] @@ -3045,7 +3847,7 @@ dependencies = [ "futures", "http", "parking_lot", - "rand", + "rand 0.8.5", "serde", "serde_json", "thiserror", @@ -3112,7 +3914,7 @@ checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.52", + "syn 2.0.61", ] [[package]] @@ -3160,6 +3962,16 @@ version = "0.1.11" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "859eb650cfee7434994602c3a68b25d77ad9e68c8a6cd491616ef86661382eb3" +[[package]] +name = "twox-hash" +version = "1.6.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "97fee6b57c6a41524a810daee9286c02d7752c4253064d0b05472833a438f675" +dependencies = [ + "cfg-if", + "static_assertions", +] + [[package]] name = "typenum" version = "1.17.0" @@ -3239,14 +4051,22 @@ checksum = "711b9620af191e0cdc7468a8d14e709c3dcdb115b36f838e601583af800a370a" [[package]] name = "uuid" -version = "1.7.0" +version = "1.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f00cc9702ca12d3c81455259621e676d0f7251cec66a21e98fe2e9a37db93b2a" +checksum = "a183cf7feeba97b4dd1c0d46788634f6221d87fa961b305bed08c851829efcc0" dependencies = [ + "atomic", "getrandom", + "rand 0.8.5", "serde", ] +[[package]] +name = "v_htmlescape" +version = "0.15.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4e8257fbc510f0a46eb602c10215901938b5c2a7d5e70fc11483b1d3c9b5b18c" + [[package]] name = "valuable" version = "0.1.0" @@ -3265,6 +4085,18 @@ version = "0.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" +[[package]] +name = "virtue" +version = "0.0.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9dcc60c0624df774c82a0ef104151231d37da4962957d691c011c852b2473314" + +[[package]] +name = "vlq" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "65dd7eed29412da847b0f78bcec0ac98588165988a8cfe41d4ea1d429f8ccfff" + [[package]] name = "walkdir" version = "2.5.0" @@ -3308,7 +4140,7 @@ dependencies = [ "once_cell", "proc-macro2", "quote", - "syn 2.0.52", + "syn 2.0.61", "wasm-bindgen-shared", ] @@ -3330,7 +4162,7 @@ checksum = "e94f17b526d0a461a191c78ea52bbce64071ed5c04c9ffe424dcb38f74171bb7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.52", + "syn 2.0.61", "wasm-bindgen-backend", "wasm-bindgen-shared", ] @@ -3640,7 +4472,7 @@ checksum = "9ce1b18ccd8e73a9321186f97e46f9f04b778851177567b1975109d26a08d2a6" dependencies = [ "proc-macro2", "quote", - "syn 2.0.52", + "syn 2.0.61", ] [[package]] @@ -3648,3 +4480,32 @@ name = "zeroize" version = "1.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "525b4ec142c6b68a2d10f01f7bbf6755599ca3f81ea53b8431b7dd348f5fdb2d" + +[[package]] +name = "zstd" +version = "0.12.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1a27595e173641171fc74a1232b7b1c7a7cb6e18222c11e9dfb9888fa424c53c" +dependencies = [ + "zstd-safe", +] + +[[package]] +name = "zstd-safe" +version = "6.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ee98ffd0b48ee95e6c5168188e44a54550b1564d9d530ee21d5f0eaed1069581" +dependencies = [ + "libc", + "zstd-sys", +] + +[[package]] +name = "zstd-sys" +version = "2.0.10+zstd.1.5.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c253a4914af5bafc8fa8c86ee400827e83cf6ec01195ec1f1ed8441bf00d65aa" +dependencies = [ + "cc", + "pkg-config", +] diff --git a/Cargo.toml b/Cargo.toml index 1851036..6308e34 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -13,14 +13,20 @@ async-trait = "0.1.78" axum = "0.7.4" axum-htmx = { version = "0.5.0", features = ["guards", "serde"] } axum-login = "0.14.0" +bincode = "1.3.3" clap = { version = "4.5.3", features = ["derive", "env"] } dotenvy = "0.15.7" env_logger = "0.11.3" -minijinja = { version = "1.0.14", features = ["loader"] } +fjall = "0.6.5" +free-icons = "0.7.0" +minijinja = { version = "1.0.14", features = ["loader", "json", "builtins"] } minijinja-autoreload = "1.0.14" +model_derive = { path = "./model_derive" } rand = "0.8.5" +redb = "2.1.0" sea-orm = { version = "0.12.15", features = ["sqlx-sqlite", "macros", "runtime-tokio-rustls"] } serde = { version = "1.0.197", features = ["derive"] } +sled = "=1.0.0-alpha.121" thiserror = "1.0.58" tokio = { version = "1.36.0", features = ["rt", "full"] } tower-http = { version = "0.5.2", features = ["fs", "trace"] } @@ -29,3 +35,4 @@ tower-sessions-moka-store = "0.11.0" tower-sessions-sqlx-store = { version = "0.11.0", features = ["sqlite"] } tracing = "0.1.40" tracing-subscriber = { version = "0.3.18", features = ["env-filter"] } +uuid = { version = "1.8.0", features = ["v4", "fast-rng", "v7", "serde"] } diff --git a/Makefile b/Makefile index 8bdda4c..658e8d7 100644 --- a/Makefile +++ b/Makefile @@ -2,11 +2,20 @@ run: SECURE_SESSIONS=false RUST_LOG=debug cargo run -- --reload-templates +run-watch: + SECURE_SESSIONS=false RUST_LOG=debug cargo watch --why -x 'run -- --reload-templates' + run-release: SECURE_SESSIONS=false RUST_LOG=info cargo run --release css-watch: - npx tailwindcss -i ./src/main.css -o ./static/main.css --watch + npm run css-watch + +typescript: + npm run build + +typescript-watch: + npm run build-watch migrate: sea-orm-cli migrate diff --git a/frontend/main.css b/frontend/main.css new file mode 100644 index 0000000..6260af8 --- /dev/null +++ b/frontend/main.css @@ -0,0 +1,60 @@ +@tailwind base; +@tailwind components; +@tailwind utilities; + + + + +/* Borrowed from https://github.com/Milkdown/milkdown/blob/main/e2e/src/list-item-block/style.css +which is licensed under MIT. */ + +.prose :where(li):not(:where([class~="not-prose"] *)) { + margin-top: 0.5em; + margin-bottom: 0; +} + +.prose :where(blockquote):not(:where([class~="not-prose"] *)) { + font-style: inherit; + font-weight: inherit; +} + +.prose :where(ul ul, ul ol, ol ul, ol ol):not(:where([class~="not-prose"] *)) { + margin-top: 0.5em; + margin-bottom: 0; +} + +.prose ol, +.prose ul { + list-style: none !important; + padding: 0; +} + +.prose li p { + @apply !m-0 !leading-6; +} + +.prose li p + p { + @apply !mt-2; +} + +.prose li.ProseMirror-selectednode { + outline: 2px solid #8cf; +} + +.prose li::after { + all: unset !important; +} + +milkdown-list-item-block .list-item { + gap: 8px; +} + +milkdown-list-item-block .label-wrapper { + height: 24px; + display: inline-flex; + justify-content: center; + align-items: center; + color: darkcyan; +} + +/* End borrowed block. */ diff --git a/frontend/main.ts b/frontend/main.ts new file mode 100644 index 0000000..83332f4 --- /dev/null +++ b/frontend/main.ts @@ -0,0 +1,52 @@ +import { defaultValueCtx, Editor, rootCtx } from '@milkdown/core'; +import { html } from 'atomico'; +import { listItemBlockComponent, listItemBlockConfig, ListItemBlockConfig, listItemBlockView } from '@milkdown/components/list-item-block' +import { commonmark } from '@milkdown/preset-commonmark'; +import { gfm } from '@milkdown/preset-gfm'; +import { nord } from '@milkdown/theme-nord' +import { listener, listenerCtx } from '@milkdown/plugin-listener'; +import '@milkdown/theme-nord/style.css' + +function configureListItem(ctx: Ctx) { + ctx.set(listItemBlockConfig.key, { + renderLabel: (label: string, listType, checked?: boolean) => { + if (checked == null) { + if (listType === 'bullet') { + return html`` + } + + return html`${label}` + } else { + return html`` + } + }, + }) +} + +function createEditor(rootId, fieldId, content) { + Editor + .make() + .config(ctx => { + ctx.set(rootCtx, rootId) + ctx.set(defaultValueCtx, content) + + const listener = ctx.get(listenerCtx); + listener.markdownUpdated((ctx, markdown, prevMarkdown) => { + if (markdown !== prevMarkdown) { + console.log(markdown); + console.log(fieldId); + document.getElementById(fieldId).value = markdown; + console.log("updated"); + } + }) + }) + .config(configureListItem) + .use(commonmark) + .use(gfm) + .use(nord) + .use(listener) + .use(listItemBlockComponent) + .create(); +} + +window.createEditor = createEditor; diff --git a/model_derive/Cargo.lock b/model_derive/Cargo.lock new file mode 100644 index 0000000..93b7aef --- /dev/null +++ b/model_derive/Cargo.lock @@ -0,0 +1,46 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 3 + +[[package]] +name = "model_derive" +version = "0.1.0" +dependencies = [ + "quote", + "syn", +] + +[[package]] +name = "proc-macro2" +version = "1.0.82" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8ad3d49ab951a01fbaafe34f2ec74122942fe18a3f9814c3268f1bb72042131b" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "quote" +version = "1.0.36" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0fa76aaf39101c457836aec0ce2316dbdc3ab723cdda1c6bd4e6ad4208acaca7" +dependencies = [ + "proc-macro2", +] + +[[package]] +name = "syn" +version = "2.0.61" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c993ed8ccba56ae856363b1845da7266a7cb78e1d146c8a32d54b45a8b831fc9" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "unicode-ident" +version = "1.0.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" diff --git a/model_derive/Cargo.toml b/model_derive/Cargo.toml new file mode 100644 index 0000000..3489eb2 --- /dev/null +++ b/model_derive/Cargo.toml @@ -0,0 +1,11 @@ +[package] +name = "model_derive" +version = "0.1.0" +edition = "2021" + +[lib] +proc-macro = true + +[dependencies] +quote = "1.0.36" +syn = { version = "2.0.61", features = ["full", "derive"] } diff --git a/model_derive/src/lib.rs b/model_derive/src/lib.rs new file mode 100644 index 0000000..996a23d --- /dev/null +++ b/model_derive/src/lib.rs @@ -0,0 +1,48 @@ +use proc_macro::TokenStream; +use quote::{format_ident, quote}; +use syn::{parse_macro_input, DeriveInput, LitInt}; + +#[proc_macro_derive(Model, attributes(model_version))] +pub fn model(input: TokenStream) -> TokenStream { + let input = parse_macro_input!(input as DeriveInput); + + let name = input.ident; + let attrs = input.attrs; + + let model_version = attrs.iter().find_map(|attr| { + if attr.path().is_ident("model_version") { + attr.parse_args::().ok().and_then(|lit| { + Some(lit.base10_parse::().unwrap()) + }) + } else { + None + } + }).unwrap_or(0); + + let lower_name = name.to_string().to_lowercase(); + let lower_name_ident = format_ident!("{}", lower_name); + + + let expanded = quote! { + impl Model for #name { + type Id = uuid::Uuid; + + fn id(&self) -> Self::Id { + self.id + } + + fn key(id: Self::Id) -> Vec { + let mut key = vec![]; + key.extend_from_slice(format!("{}:{}:", #lower_name, #model_version).as_bytes()); + key.extend_from_slice(&id.into_bytes()); + key + } + + fn partition(kv_handle: &KvHandle) -> &PartitionHandle { + &kv_handle.#lower_name_ident + } + } + }; + + TokenStream::from(expanded) +} diff --git a/package-lock.json b/package-lock.json index 923f845..edc791f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -4,8 +4,23 @@ "requires": true, "packages": { "": { + "dependencies": { + "@milkdown/components": "^7.3.6", + "@milkdown/core": "^7.3.6", + "@milkdown/plugin-listener": "^7.3.6", + "@milkdown/preset-commonmark": "^7.3.6", + "@milkdown/preset-gfm": "^7.3.6", + "@milkdown/theme-nord": "^7.3.6", + "@prosemirror-adapter/lit": "^0.2.6", + "clsx": "^2.1.1", + "tailwindcss": "^3.4.3" + }, "devDependencies": { - "tailwindcss": "^3.4.1" + "@tailwindcss/forms": "^0.5.7", + "@tailwindcss/typography": "^0.5.13", + "daisyui": "^4.10.5", + "esbuild": "0.21.1", + "tailwindcss": "^3.4.3" } }, "node_modules/@alloc/quick-lru": { @@ -20,6 +35,779 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/@atomico/hooks": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/@atomico/hooks/-/hooks-4.2.0.tgz", + "integrity": "sha512-i0UImiedbZpfRn7HoPt3+EGWVTjqG+44JOH1qALGceCjheryPRckzOZaLK0U1U3Ih4O8X1mbfoFkmcli4eFviA==", + "dependencies": { + "@atomico/use-attributes": "^2.0.1", + "@atomico/use-child-nodes": "^1.0.1", + "@atomico/use-click-coordinates": "^1.0.1", + "@atomico/use-click-press": "^1.0.1", + "@atomico/use-copy": "^1.0.1", + "@atomico/use-css-light-dom": "^1.0.1", + "@atomico/use-current-value": "^1.0.1", + "@atomico/use-debounce-state": "^1.0.1", + "@atomico/use-disabled": "^2.0.1", + "@atomico/use-drag-resize": "^1.0.0", + "@atomico/use-form": "^1.0.1", + "@atomico/use-internals": "^1.0.1", + "@atomico/use-intersection-observer": "^1.1.0", + "@atomico/use-keyboard": "^1.1.0", + "@atomico/use-listener": "^1.1.0", + "@atomico/use-media-query": "^1.0.1", + "@atomico/use-mutation-observer": "^2.0.2", + "@atomico/use-parallax": "^1.0.1", + "@atomico/use-parent": "^1.1.1", + "@atomico/use-prop-proxy": "^1.0.1", + "@atomico/use-reflect-event": "^1.0.1", + "@atomico/use-render": "^1.1.1", + "@atomico/use-resize-observer": "^1.1.0", + "@atomico/use-resize-state": "^1.0.1", + "@atomico/use-responsive-state": "^1.0.1", + "@atomico/use-router": "^1.0.1", + "@atomico/use-script": "^1.0.1", + "@atomico/use-slot": "^1.0.1", + "@atomico/use-value-history": "^1.0.1" + }, + "peerDependencies": { + "@atomico/react": "*", + "@atomico/vue": "*" + }, + "peerDependenciesMeta": { + "@atomico/react": { + "optional": true + }, + "@atomico/vue": { + "optional": true + } + } + }, + "node_modules/@atomico/use-attributes": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/@atomico/use-attributes/-/use-attributes-2.0.1.tgz", + "integrity": "sha512-YmnUYJAoQsNmY0zK55E7DijvvSl5EilWirHVzyeRVacphKAWYiphj5S0lz+8d2ZQDebw/noWG8PdSLsk84z3wA==", + "dependencies": { + "@atomico/use-mutation-observer": "*" + }, + "peerDependencies": { + "atomico": "^1.75.1" + } + }, + "node_modules/@atomico/use-child-nodes": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/@atomico/use-child-nodes/-/use-child-nodes-1.0.1.tgz", + "integrity": "sha512-Mjz0al79bh2TrLB6wuNImylhePtVQ5PpGYrVazGwzzmlBSRh1LYJq0QcvcvlUw2DKPkd697yFVaNgMwtQMrkjQ==", + "peerDependencies": { + "atomico": "^1.75.1" + } + }, + "node_modules/@atomico/use-click-coordinates": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/@atomico/use-click-coordinates/-/use-click-coordinates-1.0.1.tgz", + "integrity": "sha512-u+6DpSDsFyby5+krDF4a+8xhDibFmCNPUTMRElYey9/D+khgBiw9anuYniKJyplXMkI5ns3ev7dxMQPMfMj5lA==", + "dependencies": { + "@atomico/use-current-value": "*", + "@atomico/use-listener": "*" + }, + "peerDependencies": { + "atomico": "^1.75.1" + } + }, + "node_modules/@atomico/use-click-press": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/@atomico/use-click-press/-/use-click-press-1.0.1.tgz", + "integrity": "sha512-vLhoStp1RXX0AysqolS8RYd1vSDKhOJU9QK45D/vtu4uqb1pZoT7sWMcQUIR7XgM4xoUkEI8Z/8ej1UrLpZhyA==", + "dependencies": { + "@atomico/use-listener": "*" + }, + "peerDependencies": { + "atomico": "^1.75.1" + } + }, + "node_modules/@atomico/use-copy": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/@atomico/use-copy/-/use-copy-1.0.1.tgz", + "integrity": "sha512-ces7MxytvCpDuGHHpeap2uZ+CJeKi++tWMKK5uwQ8LjsyuFAi7EP/JkBmaSoQzYp4N9uWlNkJnL9zJfoi+CaQQ==", + "peerDependencies": { + "atomico": "^1.75.1" + } + }, + "node_modules/@atomico/use-css-light-dom": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/@atomico/use-css-light-dom/-/use-css-light-dom-1.0.1.tgz", + "integrity": "sha512-sClSNYbrnTTUqW9LiJrSi5BjVyPP1bxWWvWT+kiYIU+e6UX6gaR7wCoZ8m7B/ezTukMXjcQdOLlq4RsqxUGnXQ==", + "peerDependencies": { + "atomico": "^1.75.1" + } + }, + "node_modules/@atomico/use-current-value": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/@atomico/use-current-value/-/use-current-value-1.0.1.tgz", + "integrity": "sha512-d59warzhAmWyOi2VSWzXH1hw3Pafnao30y5h0D6IFs+NMPibLLybeupdwHqtsjTQlAov7Ak7Q940tzKdgGasDw==", + "peerDependencies": { + "atomico": "^1.75.1" + } + }, + "node_modules/@atomico/use-debounce-state": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/@atomico/use-debounce-state/-/use-debounce-state-1.0.1.tgz", + "integrity": "sha512-vCBGP0nDxxU+RTJ4yHI0JeGeWawEf/6UMj5X0tt0Gk5XKLE/kqKBgWG0uFUh33bbhW1eXuGboeB+/qcm2b8FYw==", + "peerDependencies": { + "atomico": "^1.75.1" + } + }, + "node_modules/@atomico/use-disabled": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/@atomico/use-disabled/-/use-disabled-2.0.1.tgz", + "integrity": "sha512-73IcqP2Rpd41j5TVjB823J/J5q6i1F2ZEs2BZuDRy0YRbUYAkDsi+agsuqWWiWNAxezI4zc+wYWj8GOeqilXNA==", + "dependencies": { + "@atomico/use-mutation-observer": "*", + "@atomico/use-parent": "*" + }, + "peerDependencies": { + "atomico": "^1.75.1" + } + }, + "node_modules/@atomico/use-drag-resize": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/@atomico/use-drag-resize/-/use-drag-resize-1.0.0.tgz", + "integrity": "sha512-+wSCARzFmOrURQKbqS0ki+fyQdNnQQosg3/Ov/PJMFLkdkCyHw9lgNjIhyHRo71AqN2hudiLC1Gtfgs5oQe/fA==", + "dependencies": { + "@atomico/use-debounce-state": "*", + "@atomico/use-listener": "*" + }, + "peerDependencies": { + "atomico": "^1.75.1" + } + }, + "node_modules/@atomico/use-form": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/@atomico/use-form/-/use-form-1.0.1.tgz", + "integrity": "sha512-N3RTdUHQlJsJNF4fPV3qj1fK9HPYRrKIYyq410PGICfm4VrTsU2Dbl/eBBnWXIH3MT4VXpUsy3jRk3EFJ8wYDA==", + "dependencies": { + "@atomico/use-listener": "*", + "@atomico/use-parent": "*", + "@atomico/use-render": "*" + }, + "peerDependencies": { + "atomico": "^1.75.1", + "element-internals-polyfill": "^0.1.49" + } + }, + "node_modules/@atomico/use-internals": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/@atomico/use-internals/-/use-internals-1.0.1.tgz", + "integrity": "sha512-qLHWzW/lsq9KyoC6v8HM+WiVsbGd2oUy7rl4x/dsouEW/E9qcTsTVeB8tMGL6O+ixYq5fj9BxCuGl49sU2zqIQ==", + "peerDependencies": { + "atomico": "^1.75.1" + } + }, + "node_modules/@atomico/use-intersection-observer": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@atomico/use-intersection-observer/-/use-intersection-observer-1.1.0.tgz", + "integrity": "sha512-0p1X6PSpoztM1wcL0wcO//g2fODSwqWETS4cL+X+3nW5Yjc5d++kjvHq0q2GvhN4VvCAZX9jod3I8iM2eXWWZg==", + "peerDependencies": { + "atomico": "^1.76.4" + } + }, + "node_modules/@atomico/use-keyboard": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@atomico/use-keyboard/-/use-keyboard-1.1.0.tgz", + "integrity": "sha512-VGA2jDh5nD361IColbRztN4/Wcydhx0MhLZ9emIPtvPsfzUyOdI7mm47OvlnzliaCUnu96G2DuMih9AnR+XzeA==", + "dependencies": { + "@atomico/use-current-value": "*", + "@atomico/use-listener": "*" + }, + "peerDependencies": { + "atomico": "^1.76.4" + } + }, + "node_modules/@atomico/use-listener": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@atomico/use-listener/-/use-listener-1.1.0.tgz", + "integrity": "sha512-d7LcW/Rvokfpb/FBBDaBedLygNJmIaznIgDc2xkUxfQFiXyzMAzsNAAHzY0ZEddiYKtxdbkwrZotDDWkhC6/ug==", + "dependencies": { + "@atomico/use-current-value": "*" + }, + "peerDependencies": { + "atomico": "^1.76.4" + } + }, + "node_modules/@atomico/use-media-query": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/@atomico/use-media-query/-/use-media-query-1.0.1.tgz", + "integrity": "sha512-7mWFsfs1PzoFXjpa08SZuAN5Ut9UXGNSc/5U9odAJgGvSRnbAoVTguDpHsHVyEAKVt6lRGJPGIytWaVpuzyyWg==", + "peerDependencies": { + "atomico": "^1.75.1" + } + }, + "node_modules/@atomico/use-mutation-observer": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/@atomico/use-mutation-observer/-/use-mutation-observer-2.0.2.tgz", + "integrity": "sha512-l5upQLTMSDvwCEq0oXL56vKtmg4SykKSMcNJsgA503hZ35AXmB0LJMz4+dfBCVcahxV7kT0RUnAb9ZE0Q+8rwA==", + "dependencies": { + "@atomico/use-current-value": "*", + "@atomico/use-ref-values": "*" + }, + "peerDependencies": { + "atomico": "^1.75.1" + } + }, + "node_modules/@atomico/use-parallax": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/@atomico/use-parallax/-/use-parallax-1.0.1.tgz", + "integrity": "sha512-0swK5Wr6ZD19gCql9iDSE8FlhJ67Ji+odVzhu4CdmU909e1B4Ob16rU5UuHnbDphAh2NZQ780O9CRhuxOUqWRw==", + "dependencies": { + "@atomico/use-debounce-state": "*", + "@atomico/use-intersection-observer": "*", + "@atomico/use-listener": "*" + }, + "peerDependencies": { + "atomico": "^1.75.1" + } + }, + "node_modules/@atomico/use-parent": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/@atomico/use-parent/-/use-parent-1.1.1.tgz", + "integrity": "sha512-a/gaEH9lVUgoc/ufyLCTjAZiOjRLBtZQLTV4V2DD9MKHQQsL6PColeDk9Qbf6RONo77cfJ60MN+ctjhu98Y8Ow==", + "peerDependencies": { + "atomico": "^1.75.1" + } + }, + "node_modules/@atomico/use-prop-proxy": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/@atomico/use-prop-proxy/-/use-prop-proxy-1.0.1.tgz", + "integrity": "sha512-20j1nn8HL52iSo6Y0v210/I90+usm3N7VNcHOYQIjRhiB7YwOqAJhKlbWQwXSEV5pFBhwUGu+Ks9FQdvJG3Esg==", + "dependencies": { + "@atomico/use-current-value": "*" + }, + "peerDependencies": { + "atomico": "^1.75.1" + } + }, + "node_modules/@atomico/use-ref-values": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/@atomico/use-ref-values/-/use-ref-values-1.0.1.tgz", + "integrity": "sha512-IFuwav8IkZ9uSFGscPiubYZnfSbdz2yV4xXdEClBq6IiViP0j8cBisE6YB7eAATJ/EHf7uhIBQGL5LOCk8Vi7A==", + "peerDependencies": { + "atomico": "^1.75.1" + } + }, + "node_modules/@atomico/use-reflect-event": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/@atomico/use-reflect-event/-/use-reflect-event-1.0.1.tgz", + "integrity": "sha512-HFAREdUlGp48PlhQ9UNfPX7DNI6GgqfmK61yoq3/F9KJow/48ZYnEPlyYy1/GxAeHOTnCK4C8OhclHH2jg8Gzw==", + "dependencies": { + "@atomico/use-listener": "*" + }, + "peerDependencies": { + "atomico": "^1.75.1" + } + }, + "node_modules/@atomico/use-render": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/@atomico/use-render/-/use-render-1.1.1.tgz", + "integrity": "sha512-SkXTapKVDU/8PzP2z3psOPi3hoKWckSo0T/Q/HSxeu7TGbIpLTsn9jugWZG/rqzTOToOnhLaZ8s0qEEXCsL7ag==", + "peerDependencies": { + "atomico": "^1.75.1" + } + }, + "node_modules/@atomico/use-resize-observer": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@atomico/use-resize-observer/-/use-resize-observer-1.1.0.tgz", + "integrity": "sha512-NcFs6G4dFwckO4IPrCzEpPEn1btuHZlHrrvaJnDCW+mf0UuEynwpCUD/264rkVIp5jfdAq4WTE3CBmBm7Nk89g==", + "dependencies": { + "@atomico/use-current-value": "*" + }, + "peerDependencies": { + "atomico": "^1.76.4" + } + }, + "node_modules/@atomico/use-resize-state": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/@atomico/use-resize-state/-/use-resize-state-1.0.1.tgz", + "integrity": "sha512-4gAklY6MxluHCPvC+4oM1c4ArqzDhPRMoSx1egM4OopEew9MwPJymKCCKbKpMe0SIjayAZv9Y2ZdYopn0xrwhQ==", + "dependencies": { + "@atomico/use-resize-observer": "*", + "@uppercod/match-media": "*" + }, + "peerDependencies": { + "atomico": "^1.75.1" + } + }, + "node_modules/@atomico/use-responsive-state": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/@atomico/use-responsive-state/-/use-responsive-state-1.0.1.tgz", + "integrity": "sha512-OXjVEBtZRAO5S+mEHe7Lb0r3eDonzGhDCLK1slQwc0N09oxUbz18lSrOPvWB05ezL9fitrxfY+auAIB7AIAUPA==", + "dependencies": { + "@uppercod/match-media": "^1.1.0" + }, + "peerDependencies": { + "atomico": "^1.75.1" + } + }, + "node_modules/@atomico/use-router": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/@atomico/use-router/-/use-router-1.0.1.tgz", + "integrity": "sha512-YaTSNDIdJHK18pUJmQR5cmHn0ek3OEJXw/Sids9+2VmXR/vNPuM79FXYlqCsxi5/9De2c+/jUypqxjp3PyXmhA==", + "dependencies": { + "@atomico/use-current-value": "*", + "@atomico/use-listener": "*", + "@uppercod/exp-route": "^1.4.2" + }, + "peerDependencies": { + "atomico": "^1.75.1" + } + }, + "node_modules/@atomico/use-script": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/@atomico/use-script/-/use-script-1.0.1.tgz", + "integrity": "sha512-FXVlQrXVfkbqHzgOkkoE9RmuTlZ2m6Kp64JgM1+jsHL+LpHFtAI7vIRnzyfGA0XvLXESgU8391qPY5z8lxpY7Q==", + "peerDependencies": { + "atomico": "^1.75.1" + } + }, + "node_modules/@atomico/use-slot": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/@atomico/use-slot/-/use-slot-1.0.1.tgz", + "integrity": "sha512-ndaaAjhu4RegzVL8shoKgHbWHXFgBdoeqc0rj4giIz4xv8//3uMcI0zQvRRHq1QKTvvc3/ROVW919AG5e/i0cQ==", + "dependencies": { + "@atomico/use-listener": "*" + }, + "peerDependencies": { + "atomico": "^1.75.1" + } + }, + "node_modules/@atomico/use-value-history": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/@atomico/use-value-history/-/use-value-history-1.0.1.tgz", + "integrity": "sha512-a0mtNNQ7AXOtJF93ySqp0sw1AQg6GiAEtoThpePEH/CCU07tyW2lKsAINU4/SYxZKYhyMbqBTuziK4D7gixFXg==", + "peerDependencies": { + "atomico": "^1.75.1" + } + }, + "node_modules/@codemirror/language": { + "version": "6.10.1", + "resolved": "https://registry.npmjs.org/@codemirror/language/-/language-6.10.1.tgz", + "integrity": "sha512-5GrXzrhq6k+gL5fjkAwt90nYDmjlzTIJV8THnxNFtNKWotMIlzzN+CpqxqwXOECnUdOndmSeWntVrVcv5axWRQ==", + "peer": true, + "dependencies": { + "@codemirror/state": "^6.0.0", + "@codemirror/view": "^6.23.0", + "@lezer/common": "^1.1.0", + "@lezer/highlight": "^1.0.0", + "@lezer/lr": "^1.0.0", + "style-mod": "^4.0.0" + } + }, + "node_modules/@codemirror/state": { + "version": "6.4.1", + "resolved": "https://registry.npmjs.org/@codemirror/state/-/state-6.4.1.tgz", + "integrity": "sha512-QkEyUiLhsJoZkbumGZlswmAhA7CBU02Wrz7zvH4SrcifbsqwlXShVXg65f3v/ts57W3dqyamEriMhij1Z3Zz4A==", + "peer": true + }, + "node_modules/@codemirror/view": { + "version": "6.26.3", + "resolved": "https://registry.npmjs.org/@codemirror/view/-/view-6.26.3.tgz", + "integrity": "sha512-gmqxkPALZjkgSxIeeweY/wGQXBfwTUaLs8h7OKtSwfbj9Ct3L11lD+u1sS7XHppxFQoMDiMDp07P9f3I2jWOHw==", + "peer": true, + "dependencies": { + "@codemirror/state": "^6.4.0", + "style-mod": "^4.1.0", + "w3c-keyname": "^2.2.4" + } + }, + "node_modules/@esbuild/aix-ppc64": { + "version": "0.21.1", + "resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.21.1.tgz", + "integrity": "sha512-O7yppwipkXvnEPjzkSXJRk2g4bS8sUx9p9oXHq9MU/U7lxUzZVsnFZMDTmeeX9bfQxrFcvOacl/ENgOh0WP9pA==", + "cpu": [ + "ppc64" + ], + "dev": true, + "optional": true, + "os": [ + "aix" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/android-arm": { + "version": "0.21.1", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.21.1.tgz", + "integrity": "sha512-hh3jKWikdnTtHCglDAeVO3Oyh8MaH8xZUaWMiCCvJ9/c3NtPqZq+CACOlGTxhddypXhl+8B45SeceYBfB/e8Ow==", + "cpu": [ + "arm" + ], + "dev": true, + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/android-arm64": { + "version": "0.21.1", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.21.1.tgz", + "integrity": "sha512-jXhccq6es+onw7x8MxoFnm820mz7sGa9J14kLADclmiEUH4fyj+FjR6t0M93RgtlI/awHWhtF0Wgfhqgf9gDZA==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/android-x64": { + "version": "0.21.1", + "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.21.1.tgz", + "integrity": "sha512-NPObtlBh4jQHE01gJeucqEhdoD/4ya2owSIS8lZYS58aR0x7oZo9lB2lVFxgTANSa5MGCBeoQtr+yA9oKCGPvA==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/darwin-arm64": { + "version": "0.21.1", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.21.1.tgz", + "integrity": "sha512-BLT7TDzqsVlQRmJfO/FirzKlzmDpBWwmCUlyggfzUwg1cAxVxeA4O6b1XkMInlxISdfPAOunV9zXjvh5x99Heg==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/darwin-x64": { + "version": "0.21.1", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.21.1.tgz", + "integrity": "sha512-D3h3wBQmeS/vp93O4B+SWsXB8HvRDwMyhTNhBd8yMbh5wN/2pPWRW5o/hM3EKgk9bdKd9594lMGoTCTiglQGRQ==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/freebsd-arm64": { + "version": "0.21.1", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.21.1.tgz", + "integrity": "sha512-/uVdqqpNKXIxT6TyS/oSK4XE4xWOqp6fh4B5tgAwozkyWdylcX+W4YF2v6SKsL4wCQ5h1bnaSNjWPXG/2hp8AQ==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/freebsd-x64": { + "version": "0.21.1", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.21.1.tgz", + "integrity": "sha512-paAkKN1n1jJitw+dAoR27TdCzxRl1FOEITx3h201R6NoXUojpMzgMLdkXVgCvaCSCqwYkeGLoe9UVNRDKSvQgw==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/linux-arm": { + "version": "0.21.1", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.21.1.tgz", + "integrity": "sha512-tRHnxWJnvNnDpNVnsyDhr1DIQZUfCXlHSCDohbXFqmg9W4kKR7g8LmA3kzcwbuxbRMKeit8ladnCabU5f2traA==", + "cpu": [ + "arm" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/linux-arm64": { + "version": "0.21.1", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.21.1.tgz", + "integrity": "sha512-G65d08YoH00TL7Xg4LaL3gLV21bpoAhQ+r31NUu013YB7KK0fyXIt05VbsJtpqh/6wWxoLJZOvQHYnodRrnbUQ==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/linux-ia32": { + "version": "0.21.1", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.21.1.tgz", + "integrity": "sha512-tt/54LqNNAqCz++QhxoqB9+XqdsaZOtFD/srEhHYwBd3ZUOepmR1Eeot8bS+Q7BiEvy9vvKbtpHf+r6q8hF5UA==", + "cpu": [ + "ia32" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/linux-loong64": { + "version": "0.21.1", + "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.21.1.tgz", + "integrity": "sha512-MhNalK6r0nZD0q8VzUBPwheHzXPr9wronqmZrewLfP7ui9Fv1tdPmg6e7A8lmg0ziQCziSDHxh3cyRt4YMhGnQ==", + "cpu": [ + "loong64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/linux-mips64el": { + "version": "0.21.1", + "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.21.1.tgz", + "integrity": "sha512-YCKVY7Zen5rwZV+nZczOhFmHaeIxR4Zn3jcmNH53LbgF6IKRwmrMywqDrg4SiSNApEefkAbPSIzN39FC8VsxPg==", + "cpu": [ + "mips64el" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/linux-ppc64": { + "version": "0.21.1", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.21.1.tgz", + "integrity": "sha512-bw7bcQ+270IOzDV4mcsKAnDtAFqKO0jVv3IgRSd8iM0ac3L8amvCrujRVt1ajBTJcpDaFhIX+lCNRKteoDSLig==", + "cpu": [ + "ppc64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/linux-riscv64": { + "version": "0.21.1", + "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.21.1.tgz", + "integrity": "sha512-ARmDRNkcOGOm1AqUBSwRVDfDeD9hGYRfkudP2QdoonBz1ucWVnfBPfy7H4JPI14eYtZruRSczJxyu7SRYDVOcg==", + "cpu": [ + "riscv64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/linux-s390x": { + "version": "0.21.1", + "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.21.1.tgz", + "integrity": "sha512-o73TcUNMuoTZlhwFdsgr8SfQtmMV58sbgq6gQq9G1xUiYnHMTmJbwq65RzMx89l0iya69lR4bxBgtWiiOyDQZA==", + "cpu": [ + "s390x" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/linux-x64": { + "version": "0.21.1", + "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.21.1.tgz", + "integrity": "sha512-da4/1mBJwwgJkbj4fMH7SOXq2zapgTo0LKXX1VUZ0Dxr+e8N0WbS80nSZ5+zf3lvpf8qxrkZdqkOqFfm57gXwA==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/netbsd-x64": { + "version": "0.21.1", + "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.21.1.tgz", + "integrity": "sha512-CPWs0HTFe5woTJN5eKPvgraUoRHrCtzlYIAv9wBC+FAyagBSaf+UdZrjwYyTGnwPGkThV4OCI7XibZOnPvONVw==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "netbsd" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/openbsd-x64": { + "version": "0.21.1", + "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.21.1.tgz", + "integrity": "sha512-xxhTm5QtzNLc24R0hEkcH+zCx/o49AsdFZ0Cy5zSd/5tOj4X2g3/2AJB625NoadUuc4A8B3TenLJoYdWYOYCew==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "openbsd" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/sunos-x64": { + "version": "0.21.1", + "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.21.1.tgz", + "integrity": "sha512-CWibXszpWys1pYmbr9UiKAkX6x+Sxw8HWtw1dRESK1dLW5fFJ6rMDVw0o8MbadusvVQx1a8xuOxnHXT941Hp1A==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "sunos" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/win32-arm64": { + "version": "0.21.1", + "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.21.1.tgz", + "integrity": "sha512-jb5B4k+xkytGbGUS4T+Z89cQJ9DJ4lozGRSV+hhfmCPpfJ3880O31Q1srPCimm+V6UCbnigqD10EgDNgjvjerQ==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/win32-ia32": { + "version": "0.21.1", + "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.21.1.tgz", + "integrity": "sha512-PgyFvjJhXqHn1uxPhyN1wZ6dIomKjiLUQh1LjFvjiV1JmnkZ/oMPrfeEAZg5R/1ftz4LZWZr02kefNIQ5SKREQ==", + "cpu": [ + "ia32" + ], + "dev": true, + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/win32-x64": { + "version": "0.21.1", + "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.21.1.tgz", + "integrity": "sha512-W9NttRZQR5ehAiqHGDnvfDaGmQOm6Fi4vSlce8mjM75x//XKuVAByohlEX6N17yZnVXxQFuh4fDRunP8ca6bfA==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@floating-ui/core": { + "version": "1.6.1", + "resolved": "https://registry.npmjs.org/@floating-ui/core/-/core-1.6.1.tgz", + "integrity": "sha512-42UH54oPZHPdRHdw6BgoBD6cg/eVTmVrFcgeRDM3jbO7uxSoipVcmcIGFcA5jmOHO5apcyvBhkSKES3fQJnu7A==", + "dependencies": { + "@floating-ui/utils": "^0.2.0" + } + }, + "node_modules/@floating-ui/dom": { + "version": "1.6.5", + "resolved": "https://registry.npmjs.org/@floating-ui/dom/-/dom-1.6.5.tgz", + "integrity": "sha512-Nsdud2X65Dz+1RHjAIP0t8z5e2ff/IRbei6BqFrl1urT8sDVzM1HMQ+R0XcU5ceRfyO3I6ayeqIfh+6Wb8LGTw==", + "dependencies": { + "@floating-ui/core": "^1.0.0", + "@floating-ui/utils": "^0.2.0" + } + }, + "node_modules/@floating-ui/utils": { + "version": "0.2.2", + "resolved": "https://registry.npmjs.org/@floating-ui/utils/-/utils-0.2.2.tgz", + "integrity": "sha512-J4yDIIthosAsRZ5CPYP/jQvUAQtlZTTD/4suA08/FEnlxqW3sKS9iAhgsa9VYLZ6vDHn/ixJgIqRQPotoBjxIw==" + }, "node_modules/@isaacs/cliui": { "version": "8.0.2", "resolved": "https://registry.npmjs.org/@isaacs/cliui/-/cliui-8.0.2.tgz", @@ -85,6 +873,277 @@ "@jridgewell/sourcemap-codec": "^1.4.14" } }, + "node_modules/@lezer/common": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/@lezer/common/-/common-1.2.1.tgz", + "integrity": "sha512-yemX0ZD2xS/73llMZIK6KplkjIjf2EvAHcinDi/TfJ9hS25G0388+ClHt6/3but0oOxinTcQHJLDXh6w1crzFQ==", + "peer": true + }, + "node_modules/@lezer/highlight": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/@lezer/highlight/-/highlight-1.2.0.tgz", + "integrity": "sha512-WrS5Mw51sGrpqjlh3d4/fOwpEV2Hd3YOkp9DBt4k8XZQcoTHZFB7sx030A6OcahF4J1nDQAa3jXlTVVYH50IFA==", + "peer": true, + "dependencies": { + "@lezer/common": "^1.0.0" + } + }, + "node_modules/@lezer/lr": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/@lezer/lr/-/lr-1.4.0.tgz", + "integrity": "sha512-Wst46p51km8gH0ZUmeNrtpRYmdlRHUpN1DQd3GFAyKANi8WVz8c2jHYTf1CVScFaCjQw1iO3ZZdqGDxQPRErTg==", + "peer": true, + "dependencies": { + "@lezer/common": "^1.0.0" + } + }, + "node_modules/@lit-labs/context": { + "version": "0.3.3", + "resolved": "https://registry.npmjs.org/@lit-labs/context/-/context-0.3.3.tgz", + "integrity": "sha512-5pWPLiXJnx8fZREF4w7RXBwJOxqRBJ57tujo7k23s0ZDfnSltomvYGW4kTOurXfyzDR0OLBBkv9xsWGDhauqew==", + "peer": true, + "dependencies": { + "@lit/reactive-element": "^1.5.0", + "lit": "^2.7.0" + } + }, + "node_modules/@lit-labs/ssr-dom-shim": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/@lit-labs/ssr-dom-shim/-/ssr-dom-shim-1.2.0.tgz", + "integrity": "sha512-yWJKmpGE6lUURKAaIltoPIE/wrbY3TEkqQt+X0m+7fQNnAv0keydnYvbiJFP1PnMhizmIWRWOG5KLhYyc/xl+g==", + "peer": true + }, + "node_modules/@lit/reactive-element": { + "version": "1.6.3", + "resolved": "https://registry.npmjs.org/@lit/reactive-element/-/reactive-element-1.6.3.tgz", + "integrity": "sha512-QuTgnG52Poic7uM1AN5yJ09QMe0O28e10XzSvWDz02TJiiKee4stsiownEIadWm8nYzyDAyT+gKzUoZmiWQtsQ==", + "peer": true, + "dependencies": { + "@lit-labs/ssr-dom-shim": "^1.0.0" + } + }, + "node_modules/@milkdown/components": { + "version": "7.3.6", + "resolved": "https://registry.npmjs.org/@milkdown/components/-/components-7.3.6.tgz", + "integrity": "sha512-w/sE8duUtNYcEKADLZKimotuZG35/d1V9LMYj52HwOypPO6YXUjtAzWhhU31MApDX00BuqsIKjyhwfmhr2N0pg==", + "dependencies": { + "@atomico/hooks": "^4.1.2", + "@floating-ui/dom": "^1.5.1", + "@milkdown/exception": "7.3.6", + "@milkdown/utils": "7.3.6", + "@types/lodash.debounce": "^4.0.7", + "atomico": "^1.75.1", + "clsx": "^2.0.0", + "lodash.debounce": "^4.0.8", + "tslib": "^2.5.0", + "unist-util-visit": "^5.0.0" + }, + "peerDependencies": { + "@codemirror/language": "^6", + "@codemirror/state": "^6", + "@codemirror/view": "^6", + "@milkdown/core": "^7.2.0", + "@milkdown/ctx": "^7.2.0", + "@milkdown/plugin-tooltip": "^7.2.0", + "@milkdown/preset-commonmark": "^7.2.0", + "@milkdown/prose": "^7.2.0", + "@milkdown/transformer": "^7.2.0" + } + }, + "node_modules/@milkdown/core": { + "version": "7.3.6", + "resolved": "https://registry.npmjs.org/@milkdown/core/-/core-7.3.6.tgz", + "integrity": "sha512-7jk1x0xNNr53FxZowxWNpIvD6yl8LlHP/8X9DyWuvKQl+H1oSpVrkcOv1CO3QEjCrSiGGStsoS4feCMhtCKODg==", + "dependencies": { + "@milkdown/exception": "7.3.6", + "remark-parse": "^11.0.0", + "remark-stringify": "^11.0.0", + "tslib": "^2.5.0", + "unified": "^11.0.3" + }, + "peerDependencies": { + "@milkdown/ctx": "^7.2.0", + "@milkdown/prose": "^7.2.0", + "@milkdown/transformer": "^7.2.0" + } + }, + "node_modules/@milkdown/ctx": { + "version": "7.3.6", + "resolved": "https://registry.npmjs.org/@milkdown/ctx/-/ctx-7.3.6.tgz", + "integrity": "sha512-ivVX5XIpT1/b4b5JC+ffpcxsrB+R0cNodry+AL63V2tvvTmG7IvKkCf8CHI6gnN17C3soHi8/auzYRYJBXzTAQ==", + "peer": true, + "dependencies": { + "@milkdown/exception": "7.3.6", + "tslib": "^2.5.0" + } + }, + "node_modules/@milkdown/exception": { + "version": "7.3.6", + "resolved": "https://registry.npmjs.org/@milkdown/exception/-/exception-7.3.6.tgz", + "integrity": "sha512-oEcQVyp3Lcvw3ySBc2EeCFAN1t/zvY+pdBsBSsIDB2uYueQK2PGSkzhd5WbvHnzv4lV4P19hoyPLwviqvQbVqA==", + "dependencies": { + "tslib": "^2.5.0" + } + }, + "node_modules/@milkdown/plugin-listener": { + "version": "7.3.6", + "resolved": "https://registry.npmjs.org/@milkdown/plugin-listener/-/plugin-listener-7.3.6.tgz", + "integrity": "sha512-sp9w36Vn/XLSCKl/4fqUIz2NNJnU1hXzX5X/XHH3WXCszqs6cJPRTtR6k8wAoTG2le0sW8EOdmptdjEsC2w5+Q==", + "dependencies": { + "@milkdown/utils": "7.3.6", + "@types/lodash.debounce": "^4.0.7", + "lodash.debounce": "^4.0.8", + "tslib": "^2.5.0" + }, + "peerDependencies": { + "@milkdown/core": "^7.2.0", + "@milkdown/ctx": "^7.2.0", + "@milkdown/prose": "^7.2.0" + } + }, + "node_modules/@milkdown/plugin-tooltip": { + "version": "7.3.6", + "resolved": "https://registry.npmjs.org/@milkdown/plugin-tooltip/-/plugin-tooltip-7.3.6.tgz", + "integrity": "sha512-oIKZIxq8XD51D9hpJtej1zZevwlk8up+EOgBLmQBEcdlP/PbY6r2GbUEE9Pk0yYorJjEzwlcL7tem185weebaQ==", + "peer": true, + "dependencies": { + "@milkdown/exception": "7.3.6", + "@milkdown/utils": "7.3.6", + "@types/lodash.debounce": "^4.0.7", + "lodash.debounce": "^4.0.8", + "tippy.js": "^6.3.7", + "tslib": "^2.5.0" + }, + "peerDependencies": { + "@milkdown/core": "^7.2.0", + "@milkdown/ctx": "^7.2.0", + "@milkdown/prose": "^7.2.0" + } + }, + "node_modules/@milkdown/preset-commonmark": { + "version": "7.3.6", + "resolved": "https://registry.npmjs.org/@milkdown/preset-commonmark/-/preset-commonmark-7.3.6.tgz", + "integrity": "sha512-AUhrcyPMPXWnHJLIth/cK4IHTshlJgIw2RavFOmE2IyTxjgN4JCLg8MSla5wqwNUcdDMxKH0VmVyNImwt+c4Mg==", + "dependencies": { + "@milkdown/exception": "7.3.6", + "@milkdown/utils": "7.3.6", + "@sindresorhus/slugify": "^2.2.0", + "remark-inline-links": "^7.0.0", + "tslib": "^2.5.0", + "unist-util-visit": "^5.0.0" + }, + "peerDependencies": { + "@milkdown/core": "^7.2.0", + "@milkdown/ctx": "^7.2.0", + "@milkdown/prose": "^7.2.0", + "@milkdown/transformer": "^7.2.0" + } + }, + "node_modules/@milkdown/preset-gfm": { + "version": "7.3.6", + "resolved": "https://registry.npmjs.org/@milkdown/preset-gfm/-/preset-gfm-7.3.6.tgz", + "integrity": "sha512-7T1EFTHgGLtdPUP4ciKbwpTo7NKu4BlLoJHmDS4yLZJtg+hw28ZPhya0mY+dOOjETf0Nd49hh4REM4kpOd7n2A==", + "dependencies": { + "@milkdown/exception": "7.3.6", + "@milkdown/utils": "7.3.6", + "remark-gfm": "^4.0.0", + "tslib": "^2.5.0" + }, + "peerDependencies": { + "@milkdown/core": "^7.2.0", + "@milkdown/ctx": "^7.2.0", + "@milkdown/preset-commonmark": "^7.2.0", + "@milkdown/prose": "^7.2.0", + "@milkdown/transformer": "^7.2.0" + } + }, + "node_modules/@milkdown/prose": { + "version": "7.3.6", + "resolved": "https://registry.npmjs.org/@milkdown/prose/-/prose-7.3.6.tgz", + "integrity": "sha512-uBPgqghlDLxlfFPPVpPslM0N1h/6RFol2NTug65LK00bqvnNz8AUB712LMORb+KC7SGPcfUSu3z54Wxx2a27fg==", + "peer": true, + "dependencies": { + "@milkdown/exception": "7.3.6", + "prosemirror-changeset": "^2.2.1", + "prosemirror-commands": "^1.5.2", + "prosemirror-dropcursor": "^1.8.1", + "prosemirror-gapcursor": "^1.3.2", + "prosemirror-history": "^1.3.2", + "prosemirror-inputrules": "^1.2.1", + "prosemirror-keymap": "^1.2.2", + "prosemirror-model": "^1.19.3", + "prosemirror-schema-list": "^1.3.0", + "prosemirror-state": "^1.4.3", + "prosemirror-tables": "^1.3.4", + "prosemirror-transform": "^1.7.5", + "prosemirror-view": "^1.31.7", + "tslib": "^2.5.0" + } + }, + "node_modules/@milkdown/theme-nord": { + "version": "7.3.6", + "resolved": "https://registry.npmjs.org/@milkdown/theme-nord/-/theme-nord-7.3.6.tgz", + "integrity": "sha512-JGQKn2IGD312cmoyBa5aZkM/OBMku4O+OL7QkVcDCx2HEohdx+ym/Fn/2r4f1dDYSrd5JZlNHD/rRVDv7FfjzQ==", + "dependencies": { + "clsx": "^2.0.0", + "tslib": "^2.5.0" + }, + "peerDependencies": { + "@milkdown/core": "^7.2.0", + "@milkdown/ctx": "^7.2.0", + "@milkdown/prose": "^7.2.0" + } + }, + "node_modules/@milkdown/transformer": { + "version": "7.3.6", + "resolved": "https://registry.npmjs.org/@milkdown/transformer/-/transformer-7.3.6.tgz", + "integrity": "sha512-uE3sRoufBRHyqULJg93g7eTcgmA6hJVX/hiy+p+whle2EB6q3nNJeHoZZrNR8A32o3i8IBvmEIvvguxUtK9RyQ==", + "peer": true, + "dependencies": { + "@milkdown/exception": "7.3.6", + "remark": "^15.0.1", + "remark-parse": "^11.0.0", + "remark-stringify": "^11.0.0", + "tslib": "^2.5.0", + "unified": "^11.0.3" + }, + "peerDependencies": { + "@milkdown/prose": "^7.2.0" + } + }, + "node_modules/@milkdown/utils": { + "version": "7.3.6", + "resolved": "https://registry.npmjs.org/@milkdown/utils/-/utils-7.3.6.tgz", + "integrity": "sha512-V2ljZN72PIJ/7dQmEtasyNVi7wpgfjxmPX+b82cncd3vA+m/4wKosTeK+oHRIlt0JlpMGNrxd4ikIGHoy1+6UQ==", + "dependencies": { + "@milkdown/exception": "7.3.6", + "nanoid": "^5.0.0", + "tslib": "^2.5.0" + }, + "peerDependencies": { + "@milkdown/core": "^7.2.0", + "@milkdown/ctx": "^7.2.0", + "@milkdown/prose": "^7.2.0", + "@milkdown/transformer": "^7.2.0" + } + }, + "node_modules/@milkdown/utils/node_modules/nanoid": { + "version": "5.0.7", + "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-5.0.7.tgz", + "integrity": "sha512-oLxFY2gd2IqnjcYyOXD8XGCftpGtZP2AbHbOkthDkvRywH5ayNtPVy9YlOPcHckXzbLTCHpkb7FB+yuxKV13pQ==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "bin": { + "nanoid": "bin/nanoid.js" + }, + "engines": { + "node": "^18 || >=20" + } + }, "node_modules/@nodelib/fs.scandir": { "version": "2.1.5", "resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz", @@ -130,6 +1189,179 @@ "node": ">=14" } }, + "node_modules/@popperjs/core": { + "version": "2.11.8", + "resolved": "https://registry.npmjs.org/@popperjs/core/-/core-2.11.8.tgz", + "integrity": "sha512-P1st0aksCrn9sGZhp8GMYwBnQsbvAWsZAX44oXNNvLHGqAOcoVxmjZiohstwQ7SqKnbR47akdNi+uleWD8+g6A==", + "peer": true, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/popperjs" + } + }, + "node_modules/@prosemirror-adapter/core": { + "version": "0.2.6", + "resolved": "https://registry.npmjs.org/@prosemirror-adapter/core/-/core-0.2.6.tgz", + "integrity": "sha512-7GXWQBR/bd6ngvek8SgtlEVC0x3KL7LKZ5cxyZl4IBAlRDbITQWsuKLChEXNan9A6+9Ry4a46crbDGTQlzooOg==", + "dependencies": { + "tslib": "^2.5.0" + } + }, + "node_modules/@prosemirror-adapter/lit": { + "version": "0.2.6", + "resolved": "https://registry.npmjs.org/@prosemirror-adapter/lit/-/lit-0.2.6.tgz", + "integrity": "sha512-vdTc51W8iu771bohR6JLLga+0eukMJZDDG9bLSfF9JzcNNlLo7LSw47tBsjn1Jqf5/dqYvsmXVxIbOOkZ/+vcA==", + "dependencies": { + "@prosemirror-adapter/core": "0.2.6", + "nanoid": "^4.0.2", + "tslib": "^2.5.0" + }, + "peerDependencies": { + "@lit-labs/context": "^0.3.0", + "lit": "^2.6.1" + } + }, + "node_modules/@prosemirror-adapter/lit/node_modules/nanoid": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-4.0.2.tgz", + "integrity": "sha512-7ZtY5KTCNheRGfEFxnedV5zFiORN1+Y1N6zvPTnHQd8ENUvfaDBeuJDZb2bN/oXwXxu3qkTXDzy57W5vAmDTBw==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "bin": { + "nanoid": "bin/nanoid.js" + }, + "engines": { + "node": "^14 || ^16 || >=18" + } + }, + "node_modules/@sindresorhus/slugify": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/@sindresorhus/slugify/-/slugify-2.2.1.tgz", + "integrity": "sha512-MkngSCRZ8JdSOCHRaYd+D01XhvU3Hjy6MGl06zhOk614hp9EOAp5gIkBeQg7wtmxpitU6eAL4kdiRMcJa2dlrw==", + "dependencies": { + "@sindresorhus/transliterate": "^1.0.0", + "escape-string-regexp": "^5.0.0" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/@sindresorhus/transliterate": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/@sindresorhus/transliterate/-/transliterate-1.6.0.tgz", + "integrity": "sha512-doH1gimEu3A46VX6aVxpHTeHrytJAG6HgdxntYnCFiIFHEM/ZGpG8KiZGBChchjQmG0XFIBL552kBTjVcMZXwQ==", + "dependencies": { + "escape-string-regexp": "^5.0.0" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/@tailwindcss/forms": { + "version": "0.5.7", + "resolved": "https://registry.npmjs.org/@tailwindcss/forms/-/forms-0.5.7.tgz", + "integrity": "sha512-QE7X69iQI+ZXwldE+rzasvbJiyV/ju1FGHH0Qn2W3FKbuYtqp8LKcy6iSw79fVUT5/Vvf+0XgLCeYVG+UV6hOw==", + "dev": true, + "dependencies": { + "mini-svg-data-uri": "^1.2.3" + }, + "peerDependencies": { + "tailwindcss": ">=3.0.0 || >= 3.0.0-alpha.1" + } + }, + "node_modules/@tailwindcss/typography": { + "version": "0.5.13", + "resolved": "https://registry.npmjs.org/@tailwindcss/typography/-/typography-0.5.13.tgz", + "integrity": "sha512-ADGcJ8dX21dVVHIwTRgzrcunY6YY9uSlAHHGVKvkA+vLc5qLwEszvKts40lx7z0qc4clpjclwLeK5rVCV2P/uw==", + "dev": true, + "dependencies": { + "lodash.castarray": "^4.4.0", + "lodash.isplainobject": "^4.0.6", + "lodash.merge": "^4.6.2", + "postcss-selector-parser": "6.0.10" + }, + "peerDependencies": { + "tailwindcss": ">=3.0.0 || insiders" + } + }, + "node_modules/@tailwindcss/typography/node_modules/postcss-selector-parser": { + "version": "6.0.10", + "resolved": "https://registry.npmjs.org/postcss-selector-parser/-/postcss-selector-parser-6.0.10.tgz", + "integrity": "sha512-IQ7TZdoaqbT+LCpShg46jnZVlhWD2w6iQYAcYXfHARZ7X1t/UGhhceQDs5X0cGqKvYlHNOuv7Oa1xmb0oQuA3w==", + "dev": true, + "dependencies": { + "cssesc": "^3.0.0", + "util-deprecate": "^1.0.2" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/@types/debug": { + "version": "4.1.12", + "resolved": "https://registry.npmjs.org/@types/debug/-/debug-4.1.12.tgz", + "integrity": "sha512-vIChWdVG3LG1SMxEvI/AK+FWJthlrqlTu7fbrlywTkkaONwk/UAGaULXRlf8vkzFBLVm0zkMdCquhL5aOjhXPQ==", + "dependencies": { + "@types/ms": "*" + } + }, + "node_modules/@types/lodash": { + "version": "4.17.1", + "resolved": "https://registry.npmjs.org/@types/lodash/-/lodash-4.17.1.tgz", + "integrity": "sha512-X+2qazGS3jxLAIz5JDXDzglAF3KpijdhFxlf/V1+hEsOUc+HnWi81L/uv/EvGuV90WY+7mPGFCUDGfQC3Gj95Q==" + }, + "node_modules/@types/lodash.debounce": { + "version": "4.0.9", + "resolved": "https://registry.npmjs.org/@types/lodash.debounce/-/lodash.debounce-4.0.9.tgz", + "integrity": "sha512-Ma5JcgTREwpLRwMM+XwBR7DaWe96nC38uCBDFKZWbNKD+osjVzdpnUSwBcqCptrp16sSOLBAUb50Car5I0TCsQ==", + "dependencies": { + "@types/lodash": "*" + } + }, + "node_modules/@types/mdast": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/@types/mdast/-/mdast-4.0.3.tgz", + "integrity": "sha512-LsjtqsyF+d2/yFOYaN22dHZI1Cpwkrj+g06G8+qtUKlhovPW89YhqSnfKtMbkgmEtYpH2gydRNULd6y8mciAFg==", + "dependencies": { + "@types/unist": "*" + } + }, + "node_modules/@types/ms": { + "version": "0.7.34", + "resolved": "https://registry.npmjs.org/@types/ms/-/ms-0.7.34.tgz", + "integrity": "sha512-nG96G3Wp6acyAgJqGasjODb+acrI7KltPiRxzHPXnP3NgI28bpQDRv53olbqGXbfcgF5aiiHmO3xpwEpS5Ld9g==" + }, + "node_modules/@types/trusted-types": { + "version": "2.0.7", + "resolved": "https://registry.npmjs.org/@types/trusted-types/-/trusted-types-2.0.7.tgz", + "integrity": "sha512-ScaPdn1dQczgbl0QFTeTOmVHFULt394XJgOQNoyVhZ6r2vLnMLJfBPd53SB52T/3G36VI1/g2MZaX0cwDuXsfw==", + "peer": true + }, + "node_modules/@types/unist": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/@types/unist/-/unist-3.0.2.tgz", + "integrity": "sha512-dqId9J8K/vGi5Zr7oo212BGii5m3q5Hxlkwy3WpYuKPklmBEvsbMYYyLxAQpSffdLl/gdW0XUpKWFvYmyoWCoQ==" + }, + "node_modules/@uppercod/exp-route": { + "version": "1.4.2", + "resolved": "https://registry.npmjs.org/@uppercod/exp-route/-/exp-route-1.4.2.tgz", + "integrity": "sha512-rRljihqBd3fBdWSKi4F+ev7OVJfjQyXSfwAxtjaA6PUcpBPbT0GjlJrXKa3wcFAMqE5brAjW0rMxTpXwbKv0pQ==" + }, + "node_modules/@uppercod/match-media": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/@uppercod/match-media/-/match-media-1.1.1.tgz", + "integrity": "sha512-ITGhdyxadb1ypwow3TkXGdF6vWAmRZWxxfUysZz2kvsGjgaCNSuJzbfLTeWEC+BeL651U18RwZlgpX93ZCRTFg==" + }, "node_modules/ansi-regex": { "version": "6.0.1", "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-6.0.1.tgz", @@ -179,6 +1411,20 @@ "integrity": "sha512-PYjyFOLKQ9y57JvQ6QLo8dAgNqswh8M1RMJYdQduT6xbWSgK36P/Z/v+p888pM69jMMfS8Xd8F6I1kQ/I9HUGg==", "dev": true }, + "node_modules/atomico": { + "version": "1.79.2", + "resolved": "https://registry.npmjs.org/atomico/-/atomico-1.79.2.tgz", + "integrity": "sha512-mshhLRMeIltNYbnQnqgnrvJ/uDa8XDfTQcjw3ymOygQqwHIQ4Sp0LcNYMCbACkV3DtV+eDXb9szwU4qMUuGwYQ==" + }, + "node_modules/bail": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/bail/-/bail-2.0.2.tgz", + "integrity": "sha512-0xO6mYd7JB2YesxDKplafRpsiOzPt9V02ddPCLbY1xYGPOX24NTyN50qnUxgCPcSoYMhKpAuBTjQoRZCAkUDRw==", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, "node_modules/balanced-match": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", @@ -227,6 +1473,24 @@ "node": ">= 6" } }, + "node_modules/ccount": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/ccount/-/ccount-2.0.1.tgz", + "integrity": "sha512-eyrF0jiFpY+3drT6383f1qhkbGsLSifNAjA61IUjZjmLCWjItY6LB9ft9YhoDgwfmclB2zhu51Lc7+95b8NRAg==", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/character-entities": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/character-entities/-/character-entities-2.0.2.tgz", + "integrity": "sha512-shx7oQ0Awen/BRIdkjkvz54PnEEI/EjwXDSIZp86/KKdbafHh1Df/RYGBhn4hbe2+uKC9FnT5UCEdyPz3ai9hQ==", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, "node_modules/chokidar": { "version": "3.6.0", "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.6.0.tgz", @@ -263,6 +1527,14 @@ "node": ">= 6" } }, + "node_modules/clsx": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/clsx/-/clsx-2.1.1.tgz", + "integrity": "sha512-eYm0QWBtUrBWZWG0d386OGAw16Z995PiOVo2B7bjWSbHedGl5e0ZWaq65kOGgUSNesEIDkB9ISbTg/JK9dhCZA==", + "engines": { + "node": ">=6" + } + }, "node_modules/color-convert": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", @@ -304,6 +1576,16 @@ "node": ">= 8" } }, + "node_modules/css-selector-tokenizer": { + "version": "0.8.0", + "resolved": "https://registry.npmjs.org/css-selector-tokenizer/-/css-selector-tokenizer-0.8.0.tgz", + "integrity": "sha512-Jd6Ig3/pe62/qe5SBPTN8h8LeUg/pT4lLgtavPf7updwwHpvFzxvOQBHYj2LZDMjUnBzgvIUSjRcf6oT5HzHFg==", + "dev": true, + "dependencies": { + "cssesc": "^3.0.0", + "fastparse": "^1.1.2" + } + }, "node_modules/cssesc": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/cssesc/-/cssesc-3.0.0.tgz", @@ -316,6 +1598,82 @@ "node": ">=4" } }, + "node_modules/culori": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/culori/-/culori-3.3.0.tgz", + "integrity": "sha512-pHJg+jbuFsCjz9iclQBqyL3B2HLCBF71BwVNujUYEvCeQMvV97R59MNK3R2+jgJ3a1fcZgI9B3vYgz8lzr/BFQ==", + "dev": true, + "engines": { + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + } + }, + "node_modules/daisyui": { + "version": "4.10.5", + "resolved": "https://registry.npmjs.org/daisyui/-/daisyui-4.10.5.tgz", + "integrity": "sha512-eOFUo5yEg0WV+3VK2C/+/XN1WH/OhFV4HzrMG5etAzcnB2hPg3aoR7gF1ZUpIv+b5MglLuAVMgub0rv660EgZg==", + "dev": true, + "dependencies": { + "css-selector-tokenizer": "^0.8", + "culori": "^3", + "picocolors": "^1", + "postcss-js": "^4" + }, + "engines": { + "node": ">=16.9.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/daisyui" + } + }, + "node_modules/debug": { + "version": "4.3.4", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", + "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==", + "dependencies": { + "ms": "2.1.2" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/decode-named-character-reference": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/decode-named-character-reference/-/decode-named-character-reference-1.0.2.tgz", + "integrity": "sha512-O8x12RzrUF8xyVcY0KJowWsmaJxQbmy0/EtnNtHRpsOcT7dFk5W598coHqBVpmWo1oQQfsCqfCmkZN5DJrZVdg==", + "dependencies": { + "character-entities": "^2.0.0" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/dequal": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/dequal/-/dequal-2.0.3.tgz", + "integrity": "sha512-0je+qPKHEMohvfRTCEo3CrPG6cAzAYgmzKyxRiYSSDkS6eGJdyVJm7WaYA5ECaAD9wLB2T4EEeymA5aFVcYXCA==", + "engines": { + "node": ">=6" + } + }, + "node_modules/devlop": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/devlop/-/devlop-1.1.0.tgz", + "integrity": "sha512-RWmIqhcFf1lRYBvNmr7qTNuyCt/7/ns2jbpp1+PalgE/rDQcBT0fioSMUpJ93irlUhC5hrg4cYqe6U+0ImW0rA==", + "dependencies": { + "dequal": "^2.0.0" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, "node_modules/didyoumean": { "version": "1.2.2", "resolved": "https://registry.npmjs.org/didyoumean/-/didyoumean-1.2.2.tgz", @@ -334,12 +1692,72 @@ "integrity": "sha512-I88TYZWc9XiYHRQ4/3c5rjjfgkjhLyW2luGIheGERbNQ6OY7yTybanSpDXZa8y7VUP9YmDcYa+eyq4ca7iLqWA==", "dev": true }, + "node_modules/element-internals-polyfill": { + "version": "0.1.55", + "resolved": "https://registry.npmjs.org/element-internals-polyfill/-/element-internals-polyfill-0.1.55.tgz", + "integrity": "sha512-clsNGQoOsCs8zlkT3q8Sgk9JcFZgYT0cDuXPEmD7ca8bthrYjhXQ19cIz5JGmo8CfQ+g7+SXJkfqBVw5mWB64w==", + "peer": true + }, "node_modules/emoji-regex": { "version": "9.2.2", "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-9.2.2.tgz", "integrity": "sha512-L18DaJsXSUk2+42pv8mLs5jJT2hqFkFE4j21wOmgbUqsZ2hL72NsUU785g9RXgo3s0ZNgVl42TiHp3ZtOv/Vyg==", "dev": true }, + "node_modules/esbuild": { + "version": "0.21.1", + "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.21.1.tgz", + "integrity": "sha512-GPqx+FX7mdqulCeQ4TsGZQ3djBJkx5k7zBGtqt9ycVlWNg8llJ4RO9n2vciu8BN2zAEs6lPbPl0asZsAh7oWzg==", + "dev": true, + "hasInstallScript": true, + "bin": { + "esbuild": "bin/esbuild" + }, + "engines": { + "node": ">=12" + }, + "optionalDependencies": { + "@esbuild/aix-ppc64": "0.21.1", + "@esbuild/android-arm": "0.21.1", + "@esbuild/android-arm64": "0.21.1", + "@esbuild/android-x64": "0.21.1", + "@esbuild/darwin-arm64": "0.21.1", + "@esbuild/darwin-x64": "0.21.1", + "@esbuild/freebsd-arm64": "0.21.1", + "@esbuild/freebsd-x64": "0.21.1", + "@esbuild/linux-arm": "0.21.1", + "@esbuild/linux-arm64": "0.21.1", + "@esbuild/linux-ia32": "0.21.1", + "@esbuild/linux-loong64": "0.21.1", + "@esbuild/linux-mips64el": "0.21.1", + "@esbuild/linux-ppc64": "0.21.1", + "@esbuild/linux-riscv64": "0.21.1", + "@esbuild/linux-s390x": "0.21.1", + "@esbuild/linux-x64": "0.21.1", + "@esbuild/netbsd-x64": "0.21.1", + "@esbuild/openbsd-x64": "0.21.1", + "@esbuild/sunos-x64": "0.21.1", + "@esbuild/win32-arm64": "0.21.1", + "@esbuild/win32-ia32": "0.21.1", + "@esbuild/win32-x64": "0.21.1" + } + }, + "node_modules/escape-string-regexp": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-5.0.0.tgz", + "integrity": "sha512-/veY75JbMK4j1yjvuUxuVsiS/hr/4iHs9FTT6cgTexxdE0Ly/glccBAkloH/DofkjRbZU3bnoj38mOmhkZ0lHw==", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/extend": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/extend/-/extend-3.0.2.tgz", + "integrity": "sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g==" + }, "node_modules/fast-glob": { "version": "3.3.2", "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.3.2.tgz", @@ -368,6 +1786,12 @@ "node": ">= 6" } }, + "node_modules/fastparse": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/fastparse/-/fastparse-1.1.2.tgz", + "integrity": "sha512-483XLLxTVIwWK3QTrMGRqUfUpoOs/0hbQrl2oz4J0pAcm3A3bu84wxTFqGqkJzewCLdME38xJLJAxBABfQT8sQ==", + "dev": true + }, "node_modules/fastq": { "version": "1.17.1", "resolved": "https://registry.npmjs.org/fastq/-/fastq-1.17.1.tgz", @@ -429,16 +1853,16 @@ } }, "node_modules/glob": { - "version": "10.3.10", - "resolved": "https://registry.npmjs.org/glob/-/glob-10.3.10.tgz", - "integrity": "sha512-fa46+tv1Ak0UPK1TOy/pZrIybNNt4HCv7SDzwyfiOZkvZLEbjsZkJBPtDHVshZjbecAoAGSC20MjLDG/qr679g==", + "version": "10.3.12", + "resolved": "https://registry.npmjs.org/glob/-/glob-10.3.12.tgz", + "integrity": "sha512-TCNv8vJ+xz4QiqTpfOJA7HvYv+tNIRHKfUWw/q+v2jdgN4ebz+KY9tGx5J4rHP0o84mNP+ApH66HRX8us3Khqg==", "dev": true, "dependencies": { "foreground-child": "^3.1.0", - "jackspeak": "^2.3.5", + "jackspeak": "^2.3.6", "minimatch": "^9.0.1", - "minipass": "^5.0.0 || ^6.0.2 || ^7.0.0", - "path-scurry": "^1.10.1" + "minipass": "^7.0.4", + "path-scurry": "^1.10.2" }, "bin": { "glob": "dist/esm/bin.mjs" @@ -537,6 +1961,17 @@ "node": ">=0.12.0" } }, + "node_modules/is-plain-obj": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/is-plain-obj/-/is-plain-obj-4.1.0.tgz", + "integrity": "sha512-+Pgi+vMuUNkJyExiMBt5IlFoMyKnr5zhJ4Uspz58WOhBF5QoIZkFyNHIbBAtHwzVAgk5RtndVNsDRN61/mmDqg==", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/isexe": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", @@ -585,15 +2020,278 @@ "integrity": "sha512-7ylylesZQ/PV29jhEDl3Ufjo6ZX7gCqJr5F7PKrqc93v7fzSymt1BpwEU8nAUXs8qzzvqhbjhK5QZg6Mt/HkBg==", "dev": true }, + "node_modules/lit": { + "version": "2.8.0", + "resolved": "https://registry.npmjs.org/lit/-/lit-2.8.0.tgz", + "integrity": "sha512-4Sc3OFX9QHOJaHbmTMk28SYgVxLN3ePDjg7hofEft2zWlehFL3LiAuapWc4U/kYwMYJSh2hTCPZ6/LIC7ii0MA==", + "peer": true, + "dependencies": { + "@lit/reactive-element": "^1.6.0", + "lit-element": "^3.3.0", + "lit-html": "^2.8.0" + } + }, + "node_modules/lit-element": { + "version": "3.3.3", + "resolved": "https://registry.npmjs.org/lit-element/-/lit-element-3.3.3.tgz", + "integrity": "sha512-XbeRxmTHubXENkV4h8RIPyr8lXc+Ff28rkcQzw3G6up2xg5E8Zu1IgOWIwBLEQsu3cOVFqdYwiVi0hv0SlpqUA==", + "peer": true, + "dependencies": { + "@lit-labs/ssr-dom-shim": "^1.1.0", + "@lit/reactive-element": "^1.3.0", + "lit-html": "^2.8.0" + } + }, + "node_modules/lit-html": { + "version": "2.8.0", + "resolved": "https://registry.npmjs.org/lit-html/-/lit-html-2.8.0.tgz", + "integrity": "sha512-o9t+MQM3P4y7M7yNzqAyjp7z+mQGa4NS4CxiyLqFPyFWyc4O+nodLrkrxSaCTrla6M5YOLaT3RpbbqjszB5g3Q==", + "peer": true, + "dependencies": { + "@types/trusted-types": "^2.0.2" + } + }, + "node_modules/lodash.castarray": { + "version": "4.4.0", + "resolved": "https://registry.npmjs.org/lodash.castarray/-/lodash.castarray-4.4.0.tgz", + "integrity": "sha512-aVx8ztPv7/2ULbArGJ2Y42bG1mEQ5mGjpdvrbJcJFU3TbYybe+QlLS4pst9zV52ymy2in1KpFPiZnAOATxD4+Q==", + "dev": true + }, + "node_modules/lodash.debounce": { + "version": "4.0.8", + "resolved": "https://registry.npmjs.org/lodash.debounce/-/lodash.debounce-4.0.8.tgz", + "integrity": "sha512-FT1yDzDYEoYWhnSGnpE/4Kj1fLZkDFyqRb7fNt6FdYOSxlUWAtp42Eh6Wb0rGIv/m9Bgo7x4GhQbm5Ys4SG5ow==" + }, + "node_modules/lodash.isplainobject": { + "version": "4.0.6", + "resolved": "https://registry.npmjs.org/lodash.isplainobject/-/lodash.isplainobject-4.0.6.tgz", + "integrity": "sha512-oSXzaWypCMHkPC3NvBEaPHf0KsA5mvPrOPgQWDsbg8n7orZ290M0BmC/jgRZ4vcJ6DTAhjrsSYgdsW/F+MFOBA==", + "dev": true + }, + "node_modules/lodash.merge": { + "version": "4.6.2", + "resolved": "https://registry.npmjs.org/lodash.merge/-/lodash.merge-4.6.2.tgz", + "integrity": "sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ==", + "dev": true + }, + "node_modules/longest-streak": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/longest-streak/-/longest-streak-3.1.0.tgz", + "integrity": "sha512-9Ri+o0JYgehTaVBBDoMqIl8GXtbWg711O3srftcHhZ0dqnETqLaoIK0x17fUw9rFSlK/0NlsKe0Ahhyl5pXE2g==", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, "node_modules/lru-cache": { - "version": "10.2.0", - "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-10.2.0.tgz", - "integrity": "sha512-2bIM8x+VAf6JT4bKAljS1qUWgMsqZRPGJS6FSahIMPVvctcNhyVp7AJu7quxOW9jwkryBReKZY5tY5JYv2n/7Q==", + "version": "10.2.2", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-10.2.2.tgz", + "integrity": "sha512-9hp3Vp2/hFQUiIwKo8XCeFVnrg8Pk3TYNPIR7tJADKi5YfcF7vEaK7avFHTlSy3kOKYaJQaalfEo6YuXdceBOQ==", "dev": true, "engines": { "node": "14 || >=16.14" } }, + "node_modules/markdown-table": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/markdown-table/-/markdown-table-3.0.3.tgz", + "integrity": "sha512-Z1NL3Tb1M9wH4XESsCDEksWoKTdlUafKc4pt0GRwjUyXaCFZ+dc3g2erqB6zm3szA2IUSi7VnPI+o/9jnxh9hw==", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/mdast-util-definitions": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/mdast-util-definitions/-/mdast-util-definitions-6.0.0.tgz", + "integrity": "sha512-scTllyX6pnYNZH/AIp/0ePz6s4cZtARxImwoPJ7kS42n+MnVsI4XbnG6d4ibehRIldYMWM2LD7ImQblVhUejVQ==", + "dependencies": { + "@types/mdast": "^4.0.0", + "@types/unist": "^3.0.0", + "unist-util-visit": "^5.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/mdast-util-find-and-replace": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/mdast-util-find-and-replace/-/mdast-util-find-and-replace-3.0.1.tgz", + "integrity": "sha512-SG21kZHGC3XRTSUhtofZkBzZTJNM5ecCi0SK2IMKmSXR8vO3peL+kb1O0z7Zl83jKtutG4k5Wv/W7V3/YHvzPA==", + "dependencies": { + "@types/mdast": "^4.0.0", + "escape-string-regexp": "^5.0.0", + "unist-util-is": "^6.0.0", + "unist-util-visit-parents": "^6.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/mdast-util-from-markdown": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/mdast-util-from-markdown/-/mdast-util-from-markdown-2.0.0.tgz", + "integrity": "sha512-n7MTOr/z+8NAX/wmhhDji8O3bRvPTV/U0oTCaZJkjhPSKTPhS3xufVhKGF8s1pJ7Ox4QgoIU7KHseh09S+9rTA==", + "dependencies": { + "@types/mdast": "^4.0.0", + "@types/unist": "^3.0.0", + "decode-named-character-reference": "^1.0.0", + "devlop": "^1.0.0", + "mdast-util-to-string": "^4.0.0", + "micromark": "^4.0.0", + "micromark-util-decode-numeric-character-reference": "^2.0.0", + "micromark-util-decode-string": "^2.0.0", + "micromark-util-normalize-identifier": "^2.0.0", + "micromark-util-symbol": "^2.0.0", + "micromark-util-types": "^2.0.0", + "unist-util-stringify-position": "^4.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/mdast-util-gfm": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/mdast-util-gfm/-/mdast-util-gfm-3.0.0.tgz", + "integrity": "sha512-dgQEX5Amaq+DuUqf26jJqSK9qgixgd6rYDHAv4aTBuA92cTknZlKpPfa86Z/s8Dj8xsAQpFfBmPUHWJBWqS4Bw==", + "dependencies": { + "mdast-util-from-markdown": "^2.0.0", + "mdast-util-gfm-autolink-literal": "^2.0.0", + "mdast-util-gfm-footnote": "^2.0.0", + "mdast-util-gfm-strikethrough": "^2.0.0", + "mdast-util-gfm-table": "^2.0.0", + "mdast-util-gfm-task-list-item": "^2.0.0", + "mdast-util-to-markdown": "^2.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/mdast-util-gfm-autolink-literal": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/mdast-util-gfm-autolink-literal/-/mdast-util-gfm-autolink-literal-2.0.0.tgz", + "integrity": "sha512-FyzMsduZZHSc3i0Px3PQcBT4WJY/X/RCtEJKuybiC6sjPqLv7h1yqAkmILZtuxMSsUyaLUWNp71+vQH2zqp5cg==", + "dependencies": { + "@types/mdast": "^4.0.0", + "ccount": "^2.0.0", + "devlop": "^1.0.0", + "mdast-util-find-and-replace": "^3.0.0", + "micromark-util-character": "^2.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/mdast-util-gfm-footnote": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/mdast-util-gfm-footnote/-/mdast-util-gfm-footnote-2.0.0.tgz", + "integrity": "sha512-5jOT2boTSVkMnQ7LTrd6n/18kqwjmuYqo7JUPe+tRCY6O7dAuTFMtTPauYYrMPpox9hlN0uOx/FL8XvEfG9/mQ==", + "dependencies": { + "@types/mdast": "^4.0.0", + "devlop": "^1.1.0", + "mdast-util-from-markdown": "^2.0.0", + "mdast-util-to-markdown": "^2.0.0", + "micromark-util-normalize-identifier": "^2.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/mdast-util-gfm-strikethrough": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/mdast-util-gfm-strikethrough/-/mdast-util-gfm-strikethrough-2.0.0.tgz", + "integrity": "sha512-mKKb915TF+OC5ptj5bJ7WFRPdYtuHv0yTRxK2tJvi+BDqbkiG7h7u/9SI89nRAYcmap2xHQL9D+QG/6wSrTtXg==", + "dependencies": { + "@types/mdast": "^4.0.0", + "mdast-util-from-markdown": "^2.0.0", + "mdast-util-to-markdown": "^2.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/mdast-util-gfm-table": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/mdast-util-gfm-table/-/mdast-util-gfm-table-2.0.0.tgz", + "integrity": "sha512-78UEvebzz/rJIxLvE7ZtDd/vIQ0RHv+3Mh5DR96p7cS7HsBhYIICDBCu8csTNWNO6tBWfqXPWekRuj2FNOGOZg==", + "dependencies": { + "@types/mdast": "^4.0.0", + "devlop": "^1.0.0", + "markdown-table": "^3.0.0", + "mdast-util-from-markdown": "^2.0.0", + "mdast-util-to-markdown": "^2.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/mdast-util-gfm-task-list-item": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/mdast-util-gfm-task-list-item/-/mdast-util-gfm-task-list-item-2.0.0.tgz", + "integrity": "sha512-IrtvNvjxC1o06taBAVJznEnkiHxLFTzgonUdy8hzFVeDun0uTjxxrRGVaNFqkU1wJR3RBPEfsxmU6jDWPofrTQ==", + "dependencies": { + "@types/mdast": "^4.0.0", + "devlop": "^1.0.0", + "mdast-util-from-markdown": "^2.0.0", + "mdast-util-to-markdown": "^2.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/mdast-util-phrasing": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/mdast-util-phrasing/-/mdast-util-phrasing-4.1.0.tgz", + "integrity": "sha512-TqICwyvJJpBwvGAMZjj4J2n0X8QWp21b9l0o7eXyVJ25YNWYbJDVIyD1bZXE6WtV6RmKJVYmQAKWa0zWOABz2w==", + "dependencies": { + "@types/mdast": "^4.0.0", + "unist-util-is": "^6.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/mdast-util-to-markdown": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/mdast-util-to-markdown/-/mdast-util-to-markdown-2.1.0.tgz", + "integrity": "sha512-SR2VnIEdVNCJbP6y7kVTJgPLifdr8WEU440fQec7qHoHOUz/oJ2jmNRqdDQ3rbiStOXb2mCDGTuwsK5OPUgYlQ==", + "dependencies": { + "@types/mdast": "^4.0.0", + "@types/unist": "^3.0.0", + "longest-streak": "^3.0.0", + "mdast-util-phrasing": "^4.0.0", + "mdast-util-to-string": "^4.0.0", + "micromark-util-decode-string": "^2.0.0", + "unist-util-visit": "^5.0.0", + "zwitch": "^2.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/mdast-util-to-string": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/mdast-util-to-string/-/mdast-util-to-string-4.0.0.tgz", + "integrity": "sha512-0H44vDimn51F0YwvxSJSm0eCDOJTRlmN0R1yBh4HLj9wiV1Dn0QoXGbvFAWj2hSItVTlCmBF1hqKlIyUBVFLPg==", + "dependencies": { + "@types/mdast": "^4.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, "node_modules/merge2": { "version": "1.4.1", "resolved": "https://registry.npmjs.org/merge2/-/merge2-1.4.1.tgz", @@ -603,6 +2301,541 @@ "node": ">= 8" } }, + "node_modules/micromark": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/micromark/-/micromark-4.0.0.tgz", + "integrity": "sha512-o/sd0nMof8kYff+TqcDx3VSrgBTcZpSvYcAHIfHhv5VAuNmisCxjhx6YmxS8PFEpb9z5WKWKPdzf0jM23ro3RQ==", + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "dependencies": { + "@types/debug": "^4.0.0", + "debug": "^4.0.0", + "decode-named-character-reference": "^1.0.0", + "devlop": "^1.0.0", + "micromark-core-commonmark": "^2.0.0", + "micromark-factory-space": "^2.0.0", + "micromark-util-character": "^2.0.0", + "micromark-util-chunked": "^2.0.0", + "micromark-util-combine-extensions": "^2.0.0", + "micromark-util-decode-numeric-character-reference": "^2.0.0", + "micromark-util-encode": "^2.0.0", + "micromark-util-normalize-identifier": "^2.0.0", + "micromark-util-resolve-all": "^2.0.0", + "micromark-util-sanitize-uri": "^2.0.0", + "micromark-util-subtokenize": "^2.0.0", + "micromark-util-symbol": "^2.0.0", + "micromark-util-types": "^2.0.0" + } + }, + "node_modules/micromark-core-commonmark": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/micromark-core-commonmark/-/micromark-core-commonmark-2.0.1.tgz", + "integrity": "sha512-CUQyKr1e///ZODyD1U3xit6zXwy1a8q2a1S1HKtIlmgvurrEpaw/Y9y6KSIbF8P59cn/NjzHyO+Q2fAyYLQrAA==", + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "dependencies": { + "decode-named-character-reference": "^1.0.0", + "devlop": "^1.0.0", + "micromark-factory-destination": "^2.0.0", + "micromark-factory-label": "^2.0.0", + "micromark-factory-space": "^2.0.0", + "micromark-factory-title": "^2.0.0", + "micromark-factory-whitespace": "^2.0.0", + "micromark-util-character": "^2.0.0", + "micromark-util-chunked": "^2.0.0", + "micromark-util-classify-character": "^2.0.0", + "micromark-util-html-tag-name": "^2.0.0", + "micromark-util-normalize-identifier": "^2.0.0", + "micromark-util-resolve-all": "^2.0.0", + "micromark-util-subtokenize": "^2.0.0", + "micromark-util-symbol": "^2.0.0", + "micromark-util-types": "^2.0.0" + } + }, + "node_modules/micromark-extension-gfm": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/micromark-extension-gfm/-/micromark-extension-gfm-3.0.0.tgz", + "integrity": "sha512-vsKArQsicm7t0z2GugkCKtZehqUm31oeGBV/KVSorWSy8ZlNAv7ytjFhvaryUiCUJYqs+NoE6AFhpQvBTM6Q4w==", + "dependencies": { + "micromark-extension-gfm-autolink-literal": "^2.0.0", + "micromark-extension-gfm-footnote": "^2.0.0", + "micromark-extension-gfm-strikethrough": "^2.0.0", + "micromark-extension-gfm-table": "^2.0.0", + "micromark-extension-gfm-tagfilter": "^2.0.0", + "micromark-extension-gfm-task-list-item": "^2.0.0", + "micromark-util-combine-extensions": "^2.0.0", + "micromark-util-types": "^2.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/micromark-extension-gfm-autolink-literal": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/micromark-extension-gfm-autolink-literal/-/micromark-extension-gfm-autolink-literal-2.0.0.tgz", + "integrity": "sha512-rTHfnpt/Q7dEAK1Y5ii0W8bhfJlVJFnJMHIPisfPK3gpVNuOP0VnRl96+YJ3RYWV/P4gFeQoGKNlT3RhuvpqAg==", + "dependencies": { + "micromark-util-character": "^2.0.0", + "micromark-util-sanitize-uri": "^2.0.0", + "micromark-util-symbol": "^2.0.0", + "micromark-util-types": "^2.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/micromark-extension-gfm-footnote": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/micromark-extension-gfm-footnote/-/micromark-extension-gfm-footnote-2.0.0.tgz", + "integrity": "sha512-6Rzu0CYRKDv3BfLAUnZsSlzx3ak6HAoI85KTiijuKIz5UxZxbUI+pD6oHgw+6UtQuiRwnGRhzMmPRv4smcz0fg==", + "dependencies": { + "devlop": "^1.0.0", + "micromark-core-commonmark": "^2.0.0", + "micromark-factory-space": "^2.0.0", + "micromark-util-character": "^2.0.0", + "micromark-util-normalize-identifier": "^2.0.0", + "micromark-util-sanitize-uri": "^2.0.0", + "micromark-util-symbol": "^2.0.0", + "micromark-util-types": "^2.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/micromark-extension-gfm-strikethrough": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/micromark-extension-gfm-strikethrough/-/micromark-extension-gfm-strikethrough-2.0.0.tgz", + "integrity": "sha512-c3BR1ClMp5fxxmwP6AoOY2fXO9U8uFMKs4ADD66ahLTNcwzSCyRVU4k7LPV5Nxo/VJiR4TdzxRQY2v3qIUceCw==", + "dependencies": { + "devlop": "^1.0.0", + "micromark-util-chunked": "^2.0.0", + "micromark-util-classify-character": "^2.0.0", + "micromark-util-resolve-all": "^2.0.0", + "micromark-util-symbol": "^2.0.0", + "micromark-util-types": "^2.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/micromark-extension-gfm-table": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/micromark-extension-gfm-table/-/micromark-extension-gfm-table-2.0.0.tgz", + "integrity": "sha512-PoHlhypg1ItIucOaHmKE8fbin3vTLpDOUg8KAr8gRCF1MOZI9Nquq2i/44wFvviM4WuxJzc3demT8Y3dkfvYrw==", + "dependencies": { + "devlop": "^1.0.0", + "micromark-factory-space": "^2.0.0", + "micromark-util-character": "^2.0.0", + "micromark-util-symbol": "^2.0.0", + "micromark-util-types": "^2.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/micromark-extension-gfm-tagfilter": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/micromark-extension-gfm-tagfilter/-/micromark-extension-gfm-tagfilter-2.0.0.tgz", + "integrity": "sha512-xHlTOmuCSotIA8TW1mDIM6X2O1SiX5P9IuDtqGonFhEK0qgRI4yeC6vMxEV2dgyr2TiD+2PQ10o+cOhdVAcwfg==", + "dependencies": { + "micromark-util-types": "^2.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/micromark-extension-gfm-task-list-item": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/micromark-extension-gfm-task-list-item/-/micromark-extension-gfm-task-list-item-2.0.1.tgz", + "integrity": "sha512-cY5PzGcnULaN5O7T+cOzfMoHjBW7j+T9D2sucA5d/KbsBTPcYdebm9zUd9zzdgJGCwahV+/W78Z3nbulBYVbTw==", + "dependencies": { + "devlop": "^1.0.0", + "micromark-factory-space": "^2.0.0", + "micromark-util-character": "^2.0.0", + "micromark-util-symbol": "^2.0.0", + "micromark-util-types": "^2.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/micromark-factory-destination": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/micromark-factory-destination/-/micromark-factory-destination-2.0.0.tgz", + "integrity": "sha512-j9DGrQLm/Uhl2tCzcbLhy5kXsgkHUrjJHg4fFAeoMRwJmJerT9aw4FEhIbZStWN8A3qMwOp1uzHr4UL8AInxtA==", + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "dependencies": { + "micromark-util-character": "^2.0.0", + "micromark-util-symbol": "^2.0.0", + "micromark-util-types": "^2.0.0" + } + }, + "node_modules/micromark-factory-label": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/micromark-factory-label/-/micromark-factory-label-2.0.0.tgz", + "integrity": "sha512-RR3i96ohZGde//4WSe/dJsxOX6vxIg9TimLAS3i4EhBAFx8Sm5SmqVfR8E87DPSR31nEAjZfbt91OMZWcNgdZw==", + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "dependencies": { + "devlop": "^1.0.0", + "micromark-util-character": "^2.0.0", + "micromark-util-symbol": "^2.0.0", + "micromark-util-types": "^2.0.0" + } + }, + "node_modules/micromark-factory-space": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/micromark-factory-space/-/micromark-factory-space-2.0.0.tgz", + "integrity": "sha512-TKr+LIDX2pkBJXFLzpyPyljzYK3MtmllMUMODTQJIUfDGncESaqB90db9IAUcz4AZAJFdd8U9zOp9ty1458rxg==", + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "dependencies": { + "micromark-util-character": "^2.0.0", + "micromark-util-types": "^2.0.0" + } + }, + "node_modules/micromark-factory-title": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/micromark-factory-title/-/micromark-factory-title-2.0.0.tgz", + "integrity": "sha512-jY8CSxmpWLOxS+t8W+FG3Xigc0RDQA9bKMY/EwILvsesiRniiVMejYTE4wumNc2f4UbAa4WsHqe3J1QS1sli+A==", + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "dependencies": { + "micromark-factory-space": "^2.0.0", + "micromark-util-character": "^2.0.0", + "micromark-util-symbol": "^2.0.0", + "micromark-util-types": "^2.0.0" + } + }, + "node_modules/micromark-factory-whitespace": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/micromark-factory-whitespace/-/micromark-factory-whitespace-2.0.0.tgz", + "integrity": "sha512-28kbwaBjc5yAI1XadbdPYHX/eDnqaUFVikLwrO7FDnKG7lpgxnvk/XGRhX/PN0mOZ+dBSZ+LgunHS+6tYQAzhA==", + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "dependencies": { + "micromark-factory-space": "^2.0.0", + "micromark-util-character": "^2.0.0", + "micromark-util-symbol": "^2.0.0", + "micromark-util-types": "^2.0.0" + } + }, + "node_modules/micromark-util-character": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/micromark-util-character/-/micromark-util-character-2.1.0.tgz", + "integrity": "sha512-KvOVV+X1yLBfs9dCBSopq/+G1PcgT3lAK07mC4BzXi5E7ahzMAF8oIupDDJ6mievI6F+lAATkbQQlQixJfT3aQ==", + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "dependencies": { + "micromark-util-symbol": "^2.0.0", + "micromark-util-types": "^2.0.0" + } + }, + "node_modules/micromark-util-chunked": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/micromark-util-chunked/-/micromark-util-chunked-2.0.0.tgz", + "integrity": "sha512-anK8SWmNphkXdaKgz5hJvGa7l00qmcaUQoMYsBwDlSKFKjc6gjGXPDw3FNL3Nbwq5L8gE+RCbGqTw49FK5Qyvg==", + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "dependencies": { + "micromark-util-symbol": "^2.0.0" + } + }, + "node_modules/micromark-util-classify-character": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/micromark-util-classify-character/-/micromark-util-classify-character-2.0.0.tgz", + "integrity": "sha512-S0ze2R9GH+fu41FA7pbSqNWObo/kzwf8rN/+IGlW/4tC6oACOs8B++bh+i9bVyNnwCcuksbFwsBme5OCKXCwIw==", + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "dependencies": { + "micromark-util-character": "^2.0.0", + "micromark-util-symbol": "^2.0.0", + "micromark-util-types": "^2.0.0" + } + }, + "node_modules/micromark-util-combine-extensions": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/micromark-util-combine-extensions/-/micromark-util-combine-extensions-2.0.0.tgz", + "integrity": "sha512-vZZio48k7ON0fVS3CUgFatWHoKbbLTK/rT7pzpJ4Bjp5JjkZeasRfrS9wsBdDJK2cJLHMckXZdzPSSr1B8a4oQ==", + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "dependencies": { + "micromark-util-chunked": "^2.0.0", + "micromark-util-types": "^2.0.0" + } + }, + "node_modules/micromark-util-decode-numeric-character-reference": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/micromark-util-decode-numeric-character-reference/-/micromark-util-decode-numeric-character-reference-2.0.1.tgz", + "integrity": "sha512-bmkNc7z8Wn6kgjZmVHOX3SowGmVdhYS7yBpMnuMnPzDq/6xwVA604DuOXMZTO1lvq01g+Adfa0pE2UKGlxL1XQ==", + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "dependencies": { + "micromark-util-symbol": "^2.0.0" + } + }, + "node_modules/micromark-util-decode-string": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/micromark-util-decode-string/-/micromark-util-decode-string-2.0.0.tgz", + "integrity": "sha512-r4Sc6leeUTn3P6gk20aFMj2ntPwn6qpDZqWvYmAG6NgvFTIlj4WtrAudLi65qYoaGdXYViXYw2pkmn7QnIFasA==", + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "dependencies": { + "decode-named-character-reference": "^1.0.0", + "micromark-util-character": "^2.0.0", + "micromark-util-decode-numeric-character-reference": "^2.0.0", + "micromark-util-symbol": "^2.0.0" + } + }, + "node_modules/micromark-util-encode": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/micromark-util-encode/-/micromark-util-encode-2.0.0.tgz", + "integrity": "sha512-pS+ROfCXAGLWCOc8egcBvT0kf27GoWMqtdarNfDcjb6YLuV5cM3ioG45Ys2qOVqeqSbjaKg72vU+Wby3eddPsA==", + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ] + }, + "node_modules/micromark-util-html-tag-name": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/micromark-util-html-tag-name/-/micromark-util-html-tag-name-2.0.0.tgz", + "integrity": "sha512-xNn4Pqkj2puRhKdKTm8t1YHC/BAjx6CEwRFXntTaRf/x16aqka6ouVoutm+QdkISTlT7e2zU7U4ZdlDLJd2Mcw==", + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ] + }, + "node_modules/micromark-util-normalize-identifier": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/micromark-util-normalize-identifier/-/micromark-util-normalize-identifier-2.0.0.tgz", + "integrity": "sha512-2xhYT0sfo85FMrUPtHcPo2rrp1lwbDEEzpx7jiH2xXJLqBuy4H0GgXk5ToU8IEwoROtXuL8ND0ttVa4rNqYK3w==", + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "dependencies": { + "micromark-util-symbol": "^2.0.0" + } + }, + "node_modules/micromark-util-resolve-all": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/micromark-util-resolve-all/-/micromark-util-resolve-all-2.0.0.tgz", + "integrity": "sha512-6KU6qO7DZ7GJkaCgwBNtplXCvGkJToU86ybBAUdavvgsCiG8lSSvYxr9MhwmQ+udpzywHsl4RpGJsYWG1pDOcA==", + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "dependencies": { + "micromark-util-types": "^2.0.0" + } + }, + "node_modules/micromark-util-sanitize-uri": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/micromark-util-sanitize-uri/-/micromark-util-sanitize-uri-2.0.0.tgz", + "integrity": "sha512-WhYv5UEcZrbAtlsnPuChHUAsu/iBPOVaEVsntLBIdpibO0ddy8OzavZz3iL2xVvBZOpolujSliP65Kq0/7KIYw==", + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "dependencies": { + "micromark-util-character": "^2.0.0", + "micromark-util-encode": "^2.0.0", + "micromark-util-symbol": "^2.0.0" + } + }, + "node_modules/micromark-util-subtokenize": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/micromark-util-subtokenize/-/micromark-util-subtokenize-2.0.1.tgz", + "integrity": "sha512-jZNtiFl/1aY73yS3UGQkutD0UbhTt68qnRpw2Pifmz5wV9h8gOVsN70v+Lq/f1rKaU/W8pxRe8y8Q9FX1AOe1Q==", + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "dependencies": { + "devlop": "^1.0.0", + "micromark-util-chunked": "^2.0.0", + "micromark-util-symbol": "^2.0.0", + "micromark-util-types": "^2.0.0" + } + }, + "node_modules/micromark-util-symbol": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/micromark-util-symbol/-/micromark-util-symbol-2.0.0.tgz", + "integrity": "sha512-8JZt9ElZ5kyTnO94muPxIGS8oyElRJaiJO8EzV6ZSyGQ1Is8xwl4Q45qU5UOg+bGH4AikWziz0iN4sFLWs8PGw==", + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ] + }, + "node_modules/micromark-util-types": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/micromark-util-types/-/micromark-util-types-2.0.0.tgz", + "integrity": "sha512-oNh6S2WMHWRZrmutsRmDDfkzKtxF+bc2VxLC9dvtrDIRFln627VsFP6fLMgTryGDljgLPjkrzQSDcPrjPyDJ5w==", + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ] + }, "node_modules/micromatch": { "version": "4.0.5", "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.5.tgz", @@ -616,10 +2849,19 @@ "node": ">=8.6" } }, + "node_modules/mini-svg-data-uri": { + "version": "1.4.4", + "resolved": "https://registry.npmjs.org/mini-svg-data-uri/-/mini-svg-data-uri-1.4.4.tgz", + "integrity": "sha512-r9deDe9p5FJUPZAk3A59wGH7Ii9YrjjWw0jmw/liSbHl2CHiyXj6FcDXDu2K3TjVAXqiJdaw3xxwlZZr9E6nHg==", + "dev": true, + "bin": { + "mini-svg-data-uri": "cli.js" + } + }, "node_modules/minimatch": { - "version": "9.0.3", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.3.tgz", - "integrity": "sha512-RHiac9mvaRw0x3AYRgDC1CxAP7HTcNrrECeA8YYJeWnpo+2Q5CegtZjaotWTWxDG3UeGA1coE05iH1mPjT/2mg==", + "version": "9.0.4", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.4.tgz", + "integrity": "sha512-KqWh+VchfxcMNRAJjj2tnsSJdNbHsVgnkBhTNrW7AjVo6OvLtxw8zfT9oLw1JSohlFzJ8jCoTgaoXvJ+kHt6fw==", "dev": true, "dependencies": { "brace-expansion": "^2.0.1" @@ -632,14 +2874,19 @@ } }, "node_modules/minipass": { - "version": "7.0.4", - "resolved": "https://registry.npmjs.org/minipass/-/minipass-7.0.4.tgz", - "integrity": "sha512-jYofLM5Dam9279rdkWzqHozUo4ybjdZmCsDHePy5V/PbBcVMiSZR97gmAy45aqi8CK1lG2ECd356FU86avfwUQ==", + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/minipass/-/minipass-7.1.0.tgz", + "integrity": "sha512-oGZRv2OT1lO2UF1zUcwdTb3wqUwI0kBGTgt/T7OdSj6M6N5m3o5uPf0AIW6lVxGGoiWUR7e2AwTE+xiwK8WQig==", "dev": true, "engines": { "node": ">=16 || 14 >=14.17" } }, + "node_modules/ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==" + }, "node_modules/mz": { "version": "2.7.0", "resolved": "https://registry.npmjs.org/mz/-/mz-2.7.0.tgz", @@ -696,6 +2943,12 @@ "node": ">= 6" } }, + "node_modules/orderedmap": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/orderedmap/-/orderedmap-2.1.1.tgz", + "integrity": "sha512-TvAWxi0nDe1j/rtMcWcIj94+Ffe6n7zhow33h40SKxmsmozs6dz/e+EajymfoFcHd7sxNn8yHM8839uixMOV6g==", + "peer": true + }, "node_modules/path-key": { "version": "3.1.1", "resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz", @@ -712,12 +2965,12 @@ "dev": true }, "node_modules/path-scurry": { - "version": "1.10.1", - "resolved": "https://registry.npmjs.org/path-scurry/-/path-scurry-1.10.1.tgz", - "integrity": "sha512-MkhCqzzBEpPvxxQ71Md0b1Kk51W01lrYvlMzSUaIzNsODdd7mqhiimSZlr+VegAz5Z6Vzt9Xg2ttE//XBhH3EQ==", + "version": "1.10.2", + "resolved": "https://registry.npmjs.org/path-scurry/-/path-scurry-1.10.2.tgz", + "integrity": "sha512-7xTavNy5RQXnsjANvVvMkEjvloOinkAjv/Z6Ildz9v2RinZ4SBKTWFOVRbaF8p0vpHnyjV/UwNDdKuUv6M5qcA==", "dev": true, "dependencies": { - "lru-cache": "^9.1.1 || ^10.0.0", + "lru-cache": "^10.2.0", "minipass": "^5.0.0 || ^6.0.2 || ^7.0.0" }, "engines": { @@ -912,6 +3165,145 @@ "integrity": "sha512-1NNCs6uurfkVbeXG4S8JFT9t19m45ICnif8zWLd5oPSZ50QnwMfK+H3jv408d4jw/7Bttv5axS5IiHoLaVNHeQ==", "dev": true }, + "node_modules/prosemirror-changeset": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/prosemirror-changeset/-/prosemirror-changeset-2.2.1.tgz", + "integrity": "sha512-J7msc6wbxB4ekDFj+n9gTW/jav/p53kdlivvuppHsrZXCaQdVgRghoZbSS3kwrRyAstRVQ4/+u5k7YfLgkkQvQ==", + "peer": true, + "dependencies": { + "prosemirror-transform": "^1.0.0" + } + }, + "node_modules/prosemirror-commands": { + "version": "1.5.2", + "resolved": "https://registry.npmjs.org/prosemirror-commands/-/prosemirror-commands-1.5.2.tgz", + "integrity": "sha512-hgLcPaakxH8tu6YvVAaILV2tXYsW3rAdDR8WNkeKGcgeMVQg3/TMhPdVoh7iAmfgVjZGtcOSjKiQaoeKjzd2mQ==", + "peer": true, + "dependencies": { + "prosemirror-model": "^1.0.0", + "prosemirror-state": "^1.0.0", + "prosemirror-transform": "^1.0.0" + } + }, + "node_modules/prosemirror-dropcursor": { + "version": "1.8.1", + "resolved": "https://registry.npmjs.org/prosemirror-dropcursor/-/prosemirror-dropcursor-1.8.1.tgz", + "integrity": "sha512-M30WJdJZLyXHi3N8vxN6Zh5O8ZBbQCz0gURTfPmTIBNQ5pxrdU7A58QkNqfa98YEjSAL1HUyyU34f6Pm5xBSGw==", + "peer": true, + "dependencies": { + "prosemirror-state": "^1.0.0", + "prosemirror-transform": "^1.1.0", + "prosemirror-view": "^1.1.0" + } + }, + "node_modules/prosemirror-gapcursor": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/prosemirror-gapcursor/-/prosemirror-gapcursor-1.3.2.tgz", + "integrity": "sha512-wtjswVBd2vaQRrnYZaBCbyDqr232Ed4p2QPtRIUK5FuqHYKGWkEwl08oQM4Tw7DOR0FsasARV5uJFvMZWxdNxQ==", + "peer": true, + "dependencies": { + "prosemirror-keymap": "^1.0.0", + "prosemirror-model": "^1.0.0", + "prosemirror-state": "^1.0.0", + "prosemirror-view": "^1.0.0" + } + }, + "node_modules/prosemirror-history": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/prosemirror-history/-/prosemirror-history-1.4.0.tgz", + "integrity": "sha512-UUiGzDVcqo1lovOPdi9YxxUps3oBFWAIYkXLu3Ot+JPv1qzVogRbcizxK3LhHmtaUxclohgiOVesRw5QSlMnbQ==", + "peer": true, + "dependencies": { + "prosemirror-state": "^1.2.2", + "prosemirror-transform": "^1.0.0", + "prosemirror-view": "^1.31.0", + "rope-sequence": "^1.3.0" + } + }, + "node_modules/prosemirror-inputrules": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/prosemirror-inputrules/-/prosemirror-inputrules-1.4.0.tgz", + "integrity": "sha512-6ygpPRuTJ2lcOXs9JkefieMst63wVJBgHZGl5QOytN7oSZs3Co/BYbc3Yx9zm9H37Bxw8kVzCnDsihsVsL4yEg==", + "peer": true, + "dependencies": { + "prosemirror-state": "^1.0.0", + "prosemirror-transform": "^1.0.0" + } + }, + "node_modules/prosemirror-keymap": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/prosemirror-keymap/-/prosemirror-keymap-1.2.2.tgz", + "integrity": "sha512-EAlXoksqC6Vbocqc0GtzCruZEzYgrn+iiGnNjsJsH4mrnIGex4qbLdWWNza3AW5W36ZRrlBID0eM6bdKH4OStQ==", + "peer": true, + "dependencies": { + "prosemirror-state": "^1.0.0", + "w3c-keyname": "^2.2.0" + } + }, + "node_modules/prosemirror-model": { + "version": "1.21.0", + "resolved": "https://registry.npmjs.org/prosemirror-model/-/prosemirror-model-1.21.0.tgz", + "integrity": "sha512-zLpS1mVCZLA7VTp82P+BfMiYVPcX1/z0Mf3gsjKZtzMWubwn2pN7CceMV0DycjlgE5JeXPR7UF4hJPbBV98oWA==", + "peer": true, + "dependencies": { + "orderedmap": "^2.0.0" + } + }, + "node_modules/prosemirror-schema-list": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/prosemirror-schema-list/-/prosemirror-schema-list-1.3.0.tgz", + "integrity": "sha512-Hz/7gM4skaaYfRPNgr421CU4GSwotmEwBVvJh5ltGiffUJwm7C8GfN/Bc6DR1EKEp5pDKhODmdXXyi9uIsZl5A==", + "peer": true, + "dependencies": { + "prosemirror-model": "^1.0.0", + "prosemirror-state": "^1.0.0", + "prosemirror-transform": "^1.7.3" + } + }, + "node_modules/prosemirror-state": { + "version": "1.4.3", + "resolved": "https://registry.npmjs.org/prosemirror-state/-/prosemirror-state-1.4.3.tgz", + "integrity": "sha512-goFKORVbvPuAQaXhpbemJFRKJ2aixr+AZMGiquiqKxaucC6hlpHNZHWgz5R7dS4roHiwq9vDctE//CZ++o0W1Q==", + "peer": true, + "dependencies": { + "prosemirror-model": "^1.0.0", + "prosemirror-transform": "^1.0.0", + "prosemirror-view": "^1.27.0" + } + }, + "node_modules/prosemirror-tables": { + "version": "1.3.7", + "resolved": "https://registry.npmjs.org/prosemirror-tables/-/prosemirror-tables-1.3.7.tgz", + "integrity": "sha512-oEwX1wrziuxMtwFvdDWSFHVUWrFJWt929kVVfHvtTi8yvw+5ppxjXZkMG/fuTdFo+3DXyIPSKfid+Be1npKXDA==", + "peer": true, + "dependencies": { + "prosemirror-keymap": "^1.1.2", + "prosemirror-model": "^1.8.1", + "prosemirror-state": "^1.3.1", + "prosemirror-transform": "^1.2.1", + "prosemirror-view": "^1.13.3" + } + }, + "node_modules/prosemirror-transform": { + "version": "1.9.0", + "resolved": "https://registry.npmjs.org/prosemirror-transform/-/prosemirror-transform-1.9.0.tgz", + "integrity": "sha512-5UXkr1LIRx3jmpXXNKDhv8OyAOeLTGuXNwdVfg8x27uASna/wQkr9p6fD3eupGOi4PLJfbezxTyi/7fSJypXHg==", + "peer": true, + "dependencies": { + "prosemirror-model": "^1.21.0" + } + }, + "node_modules/prosemirror-view": { + "version": "1.33.6", + "resolved": "https://registry.npmjs.org/prosemirror-view/-/prosemirror-view-1.33.6.tgz", + "integrity": "sha512-zRLUNgLIQfd8IfGprsXxWTjdA8xEAFJe8cDNrOptj6Mop9sj+BMeVbJvceyAYCm5G2dOdT2prctH7K9dfnpIMw==", + "peer": true, + "dependencies": { + "prosemirror-model": "^1.20.0", + "prosemirror-state": "^1.0.0", + "prosemirror-transform": "^1.1.0" + } + }, "node_modules/queue-microtask": { "version": "1.2.3", "resolved": "https://registry.npmjs.org/queue-microtask/-/queue-microtask-1.2.3.tgz", @@ -953,6 +3345,82 @@ "node": ">=8.10.0" } }, + "node_modules/remark": { + "version": "15.0.1", + "resolved": "https://registry.npmjs.org/remark/-/remark-15.0.1.tgz", + "integrity": "sha512-Eht5w30ruCXgFmxVUSlNWQ9iiimq07URKeFS3hNc8cUWy1llX4KDWfyEDZRycMc+znsN9Ux5/tJ/BFdgdOwA3A==", + "peer": true, + "dependencies": { + "@types/mdast": "^4.0.0", + "remark-parse": "^11.0.0", + "remark-stringify": "^11.0.0", + "unified": "^11.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/remark-gfm": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/remark-gfm/-/remark-gfm-4.0.0.tgz", + "integrity": "sha512-U92vJgBPkbw4Zfu/IiW2oTZLSL3Zpv+uI7My2eq8JxKgqraFdU8YUGicEJCEgSbeaG+QDFqIcwwfMTOEelPxuA==", + "dependencies": { + "@types/mdast": "^4.0.0", + "mdast-util-gfm": "^3.0.0", + "micromark-extension-gfm": "^3.0.0", + "remark-parse": "^11.0.0", + "remark-stringify": "^11.0.0", + "unified": "^11.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/remark-inline-links": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/remark-inline-links/-/remark-inline-links-7.0.0.tgz", + "integrity": "sha512-4uj1pPM+F495ySZhTIB6ay2oSkTsKgmYaKk/q5HIdhX2fuyLEegpjWa0VdJRJ01sgOqAFo7MBKdDUejIYBMVMQ==", + "dependencies": { + "@types/mdast": "^4.0.0", + "mdast-util-definitions": "^6.0.0", + "unist-util-visit": "^5.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/remark-parse": { + "version": "11.0.0", + "resolved": "https://registry.npmjs.org/remark-parse/-/remark-parse-11.0.0.tgz", + "integrity": "sha512-FCxlKLNGknS5ba/1lmpYijMUzX2esxW5xQqjWxw2eHFfS2MSdaHVINFmhjo+qN1WhZhNimq0dZATN9pH0IDrpA==", + "dependencies": { + "@types/mdast": "^4.0.0", + "mdast-util-from-markdown": "^2.0.0", + "micromark-util-types": "^2.0.0", + "unified": "^11.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/remark-stringify": { + "version": "11.0.0", + "resolved": "https://registry.npmjs.org/remark-stringify/-/remark-stringify-11.0.0.tgz", + "integrity": "sha512-1OSmLd3awB/t8qdoEOMazZkNsfVTeY4fTsgzcQFdXNq8ToTN4ZGwrMnlda4K6smTFKD+GRV6O48i6Z4iKgPPpw==", + "dependencies": { + "@types/mdast": "^4.0.0", + "mdast-util-to-markdown": "^2.0.0", + "unified": "^11.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, "node_modules/resolve": { "version": "1.22.8", "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.8.tgz", @@ -980,6 +3448,12 @@ "node": ">=0.10.0" } }, + "node_modules/rope-sequence": { + "version": "1.3.4", + "resolved": "https://registry.npmjs.org/rope-sequence/-/rope-sequence-1.3.4.tgz", + "integrity": "sha512-UT5EDe2cu2E/6O4igUr5PSFs23nvvukicWHx6GnOPlHAiiYbzNuCRQCuiUdHJQcqKalLKlrYJnjY0ySGsXNQXQ==", + "peer": true + }, "node_modules/run-parallel": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/run-parallel/-/run-parallel-1.2.0.tgz", @@ -1141,6 +3615,12 @@ "node": ">=8" } }, + "node_modules/style-mod": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/style-mod/-/style-mod-4.1.2.tgz", + "integrity": "sha512-wnD1HyVqpJUI2+eKZ+eo1UwghftP6yuFheBqqe+bWCotBjC2K1YnteJILRMs3SM4V/0dLEW1SC27MWP5y+mwmw==", + "peer": true + }, "node_modules/sucrase": { "version": "3.35.0", "resolved": "https://registry.npmjs.org/sucrase/-/sucrase-3.35.0.tgz", @@ -1176,9 +3656,9 @@ } }, "node_modules/tailwindcss": { - "version": "3.4.1", - "resolved": "https://registry.npmjs.org/tailwindcss/-/tailwindcss-3.4.1.tgz", - "integrity": "sha512-qAYmXRfk3ENzuPBakNK0SRrUDipP8NQnEY6772uDhflcQz5EhRdD7JNZxyrFHVQNCwULPBn6FNPp9brpO7ctcA==", + "version": "3.4.3", + "resolved": "https://registry.npmjs.org/tailwindcss/-/tailwindcss-3.4.3.tgz", + "integrity": "sha512-U7sxQk/n397Bmx4JHbJx/iSOOv5G+II3f1kpLpY2QeUv5DcPdcTsYLlusZfq1NthHS1c1cZoyFmmkex1rzke0A==", "dev": true, "dependencies": { "@alloc/quick-lru": "^5.2.0", @@ -1189,7 +3669,7 @@ "fast-glob": "^3.3.0", "glob-parent": "^6.0.2", "is-glob": "^4.0.3", - "jiti": "^1.19.1", + "jiti": "^1.21.0", "lilconfig": "^2.1.0", "micromatch": "^4.0.5", "normalize-path": "^3.0.0", @@ -1233,6 +3713,15 @@ "node": ">=0.8" } }, + "node_modules/tippy.js": { + "version": "6.3.7", + "resolved": "https://registry.npmjs.org/tippy.js/-/tippy.js-6.3.7.tgz", + "integrity": "sha512-E1d3oP2emgJ9dRQZdf3Kkn0qJgI6ZLpyS5z6ZkY1DF3kaQaBsGZsndEpHwx+eC+tYM41HaSNvNtLx8tU57FzTQ==", + "peer": true, + "dependencies": { + "@popperjs/core": "^2.9.0" + } + }, "node_modules/to-regex-range": { "version": "5.0.1", "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", @@ -1245,18 +3734,134 @@ "node": ">=8.0" } }, + "node_modules/trough": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/trough/-/trough-2.2.0.tgz", + "integrity": "sha512-tmMpK00BjZiUyVyvrBK7knerNgmgvcV/KLVyuma/SC+TQN167GrMRciANTz09+k3zW8L8t60jWO1GpfkZdjTaw==", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, "node_modules/ts-interface-checker": { "version": "0.1.13", "resolved": "https://registry.npmjs.org/ts-interface-checker/-/ts-interface-checker-0.1.13.tgz", "integrity": "sha512-Y/arvbn+rrz3JCKl9C4kVNfTfSm2/mEp5FSz5EsZSANGPSlQrpRI5M4PKF+mJnE52jOO90PnPSc3Ur3bTQw0gA==", "dev": true }, + "node_modules/tslib": { + "version": "2.6.2", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.6.2.tgz", + "integrity": "sha512-AEYxH93jGFPn/a2iVAwW87VuUIkR1FVUKB77NwMF7nBTDkDrrT/Hpt/IrCJ0QXhW27jTBDcf5ZY7w6RiqTMw2Q==" + }, + "node_modules/unified": { + "version": "11.0.4", + "resolved": "https://registry.npmjs.org/unified/-/unified-11.0.4.tgz", + "integrity": "sha512-apMPnyLjAX+ty4OrNap7yumyVAMlKx5IWU2wlzzUdYJO9A8f1p9m/gywF/GM2ZDFcjQPrx59Mc90KwmxsoklxQ==", + "dependencies": { + "@types/unist": "^3.0.0", + "bail": "^2.0.0", + "devlop": "^1.0.0", + "extend": "^3.0.0", + "is-plain-obj": "^4.0.0", + "trough": "^2.0.0", + "vfile": "^6.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/unist-util-is": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/unist-util-is/-/unist-util-is-6.0.0.tgz", + "integrity": "sha512-2qCTHimwdxLfz+YzdGfkqNlH0tLi9xjTnHddPmJwtIG9MGsdbutfTc4P+haPD7l7Cjxf/WZj+we5qfVPvvxfYw==", + "dependencies": { + "@types/unist": "^3.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/unist-util-stringify-position": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/unist-util-stringify-position/-/unist-util-stringify-position-4.0.0.tgz", + "integrity": "sha512-0ASV06AAoKCDkS2+xw5RXJywruurpbC4JZSm7nr7MOt1ojAzvyyaO+UxZf18j8FCF6kmzCZKcAgN/yu2gm2XgQ==", + "dependencies": { + "@types/unist": "^3.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/unist-util-visit": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/unist-util-visit/-/unist-util-visit-5.0.0.tgz", + "integrity": "sha512-MR04uvD+07cwl/yhVuVWAtw+3GOR/knlL55Nd/wAdblk27GCVt3lqpTivy/tkJcZoNPzTwS1Y+KMojlLDhoTzg==", + "dependencies": { + "@types/unist": "^3.0.0", + "unist-util-is": "^6.0.0", + "unist-util-visit-parents": "^6.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/unist-util-visit-parents": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/unist-util-visit-parents/-/unist-util-visit-parents-6.0.1.tgz", + "integrity": "sha512-L/PqWzfTP9lzzEa6CKs0k2nARxTdZduw3zyh8d2NVBnsyvHjSX4TWse388YrrQKbvI8w20fGjGlhgT96WwKykw==", + "dependencies": { + "@types/unist": "^3.0.0", + "unist-util-is": "^6.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, "node_modules/util-deprecate": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", "integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==", "dev": true }, + "node_modules/vfile": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/vfile/-/vfile-6.0.1.tgz", + "integrity": "sha512-1bYqc7pt6NIADBJ98UiG0Bn/CHIVOoZ/IyEkqIruLg0mE1BKzkOXY2D6CSqQIcKqgadppE5lrxgWXJmXd7zZJw==", + "dependencies": { + "@types/unist": "^3.0.0", + "unist-util-stringify-position": "^4.0.0", + "vfile-message": "^4.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/vfile-message": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/vfile-message/-/vfile-message-4.0.2.tgz", + "integrity": "sha512-jRDZ1IMLttGj41KcZvlrYAaI3CfqpLpfpf+Mfig13viT6NKvRzWZ+lXz0Y5D60w6uJIBAOGq9mSHf0gktF0duw==", + "dependencies": { + "@types/unist": "^3.0.0", + "unist-util-stringify-position": "^4.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/w3c-keyname": { + "version": "2.2.8", + "resolved": "https://registry.npmjs.org/w3c-keyname/-/w3c-keyname-2.2.8.tgz", + "integrity": "sha512-dpojBhNsCNN7T82Tm7k26A6G9ML3NkhDsnw9n/eoxSRlVBB4CEtIQ/KTCLI2Fwf3ataSXRhYFkQi3SlnFwPvPQ==", + "peer": true + }, "node_modules/which": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", @@ -1364,9 +3969,9 @@ } }, "node_modules/yaml": { - "version": "2.4.1", - "resolved": "https://registry.npmjs.org/yaml/-/yaml-2.4.1.tgz", - "integrity": "sha512-pIXzoImaqmfOrL7teGUBt/T7ZDnyeGBWyXQBvOVhLkWLN37GXv8NMLK406UY6dS51JfcQHsmcW5cJ441bHg6Lg==", + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/yaml/-/yaml-2.4.2.tgz", + "integrity": "sha512-B3VqDZ+JAg1nZpaEmWtTXUlBneoGx6CPM9b0TENK6aoSu5t73dItudwdgmi6tHlIZZId4dZ9skcAQ2UbcyAeVA==", "dev": true, "bin": { "yaml": "bin.mjs" @@ -1374,6 +3979,15 @@ "engines": { "node": ">= 14" } + }, + "node_modules/zwitch": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/zwitch/-/zwitch-2.0.4.tgz", + "integrity": "sha512-bXE4cR/kVZhKZX/RjPEflHaKVhUVl85noU3v6b8apfQEc1x4A+zBxjZ4lN8LqGd6WZ3dl98pY4o717VFmoPp+A==", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } } } } diff --git a/package.json b/package.json index 8e0d1d6..d595706 100644 --- a/package.json +++ b/package.json @@ -1,5 +1,26 @@ { "devDependencies": { - "tailwindcss": "^3.4.1" + "@tailwindcss/forms": "^0.5.7", + "@tailwindcss/typography": "^0.5.13", + "daisyui": "^4.10.5", + "esbuild": "0.21.1", + "tailwindcss": "^3.4.3" + }, + "scripts": { + "build": "esbuild frontend/main.ts --bundle --outfile=static/main.js --target=es2017", + "build-watch": "esbuild frontend/main.ts --bundle --outfile=static/main.js --target=es2017 --watch", + "css-watch": "tailwindcss -i ./frontend/main.css -o ./static/style.css --watch", + "css": "tailwindcss -i ./frontend/main.css -o ./static/style.css" + }, + "dependencies": { + "@milkdown/components": "^7.3.6", + "@milkdown/core": "^7.3.6", + "@milkdown/plugin-listener": "^7.3.6", + "@milkdown/preset-commonmark": "^7.3.6", + "@milkdown/preset-gfm": "^7.3.6", + "@milkdown/theme-nord": "^7.3.6", + "@prosemirror-adapter/lit": "^0.2.6", + "clsx": "^2.1.1", + "tailwindcss": "^3.4.3" } } diff --git a/src/context.rs b/src/context.rs index 0cbd9d0..0df1143 100644 --- a/src/context.rs +++ b/src/context.rs @@ -2,18 +2,21 @@ use std::sync::Arc; use minijinja_autoreload::AutoReloader; -use crate::{handler::internal_server_error, prelude::*}; +use crate::{handler::internal_server_error, kv::KvHandle, prelude::*}; #[derive(Clone)] pub struct Context { pub db: DatabaseConnection, + // TODO: add a design doc explaining why this not relational + pub kv_handles: KvHandle, template_loader: Arc, } impl Context { - pub fn new(db: DatabaseConnection, template_loader: AutoReloader) -> Context { + pub fn new(db: DatabaseConnection, kv_handles: KvHandle, template_loader: AutoReloader) -> Context { Context { db, + kv_handles, template_loader: Arc::new(template_loader), } } diff --git a/src/handler.rs b/src/handler.rs index acd50cf..566411a 100644 --- a/src/handler.rs +++ b/src/handler.rs @@ -1,5 +1,7 @@ +pub mod documents; pub mod home; pub mod login; +pub mod projects; use axum::http::StatusCode; use axum::response::Response; diff --git a/src/handler/documents.rs b/src/handler/documents.rs new file mode 100644 index 0000000..52c7992 --- /dev/null +++ b/src/handler/documents.rs @@ -0,0 +1,170 @@ +use axum::{extract::Path, response::Redirect, Form}; +use axum_login::AuthSession; + +use crate::{handler::internal_server_error, models::{Document, ModelPermission, ModelType, Permission}, prelude::*}; + +pub async fn documents_page( + State(ctx): State, + auth_session: AuthSession, +) -> Response { + if let Some(user) = auth_session.user { + render_documents_page(ctx, user).await + } else { + Redirect::to("/login").into_response() + } +} + +async fn render_documents_page(ctx: Context, user: crate::entity::user::Model) -> Response { + let documents = ModelPermission::user_documents(&ctx.kv_handles, user.id).unwrap_or_default(); + + let values = context! { + user => user, + documents => documents, + }; + + ctx.render_resp("documents/list_documents.html", values) +} + +pub async fn create_document_page( + State(ctx): State, + auth_session: AuthSession, +) -> Response { + let user = match auth_session.user { + Some(user) => user, + None => return Redirect::to("/login").into_response(), + }; + + let projects = ModelPermission::user_projects(&ctx.kv_handles, user.id).unwrap_or_default(); + + let values = context! { + user => user, + projects => projects, + }; + ctx.render_resp("documents/create_document.html", values) +} + +#[derive(Debug, Deserialize)] +pub struct CreateDocumentSubmission { + pub project_id: Uuid, + pub title: String, +} + +pub async fn create_document_submit( + State(ctx): State, + auth_session: AuthSession, + form: Form, +) -> Response { + let user = match auth_session.user { + Some(user) => user, + None => return Redirect::to("/login").into_response(), + }; + + let project = match ModelPermission::user_project(&ctx.kv_handles, user.id, form.project_id) { + Ok(Some(project)) => project, + Ok(None) => return Redirect::to("/documents/create").into_response(), + Err(err) => { + error!(?err, "failed to access kv store"); + return Redirect::to("/documents/create").into_response(); + } + }; + + let document = Document { + id: Uuid::now_v7(), + project_id: project.id, + title: form.title.to_owned(), + content: "".to_owned(), + }; + + if let Err(err) = document.save(&ctx.kv_handles) { + error!(?err, "failed to save document"); + return internal_server_error(); + } + info!(?document, "document created"); + + let permission = ModelPermission { + user_id: user.id, + model_type: ModelType::Document, + role: Permission::Admin, + model_id: document.id, + }; + + if let Err(err) = permission.add(&ctx.kv_handles) { + error!(?err, "failed to save new project permission"); + return internal_server_error(); + } + + + + Redirect::to("/documents").into_response() +} + +pub async fn edit_document_page( + State(ctx): State, + auth_session: AuthSession, + Path((id,)): Path<(Uuid,)>, +) -> Response { + let user = match auth_session.user { + Some(user) => user, + None => return Redirect::to("/login").into_response(), + }; + + let document = match ModelPermission::user_document(&ctx.kv_handles, user.id, id) { + Ok(Some(document)) => document, + Ok(None) => return Redirect::to("/documents").into_response(), + Err(err) => { + error!(?err, "failed to load document"); + return internal_server_error(); + } + }; + + dbg!(&document); + let values = context! { + user => user, + document => document, + }; + + ctx.render_resp("documents/edit_document.html", values) +} + +#[derive(Debug, Deserialize)] +pub struct EditDocumentSubmission { + pub title: String, + pub content: String, +} + + +pub async fn edit_document_submit( + State(ctx): State, + auth_session: AuthSession, + Path((document_id,)): Path<(Uuid,)>, + form: Form, +) -> Response { + let user = match auth_session.user { + Some(user) => user, + None => return Redirect::to("/login").into_response(), + }; + + let mut document = match ModelPermission::user_document(&ctx.kv_handles, user.id, document_id) { + Ok(Some(document)) => document, + Ok(None) => return Redirect::to("/documents").into_response(), + Err(err) => { + error!(?err, "failed to load document"); + return internal_server_error(); + } + }; + + let new_document = Document { + id: document.id, + project_id: document.id, + title: form.title.to_owned(), + content: form.content.to_owned(), + }; + + if let Err(err) = new_document.save(&ctx.kv_handles) { + error!(?err, "failed to save document"); + return internal_server_error(); + } + info!(?new_document, "document updated"); + + Redirect::to("/documents").into_response() +} diff --git a/src/handler/home.rs b/src/handler/home.rs index 79b6c26..8077eb5 100644 --- a/src/handler/home.rs +++ b/src/handler/home.rs @@ -1,12 +1,15 @@ use axum::response::Redirect; use axum_login::AuthSession; -use crate::prelude::*; +use crate::{models::{ModelPermission, Project}, prelude::*}; pub async fn home_page(State(ctx): State, auth_session: AuthSession) -> Response { if let Some(user) = auth_session.user { + let projects: Vec = ModelPermission::user_projects(&ctx.kv_handles, user.id).unwrap_or_default(); + let values = context! { user => user, + projects => projects, }; ctx.render_resp("home.html", values) diff --git a/src/handler/projects.rs b/src/handler/projects.rs new file mode 100644 index 0000000..14baa30 --- /dev/null +++ b/src/handler/projects.rs @@ -0,0 +1,92 @@ +use axum::{response::Redirect, Form}; +use axum_login::AuthSession; + +use crate::{ + handler::internal_server_error, + models::{ModelPermission, ModelType, Permission, Project}, + prelude::*, +}; + +pub async fn projects_page( + State(ctx): State, + auth_session: AuthSession, +) -> Response { + if let Some(user) = auth_session.user { + render_projects_page(ctx, user).await + } else { + Redirect::to("/login").into_response() + } +} + +async fn render_projects_page(ctx: Context, user: crate::entity::user::Model) -> Response { + let projects = ModelPermission::user_projects(&ctx.kv_handles, user.id).unwrap_or_default(); + + let values = context! { + user => user, + projects => projects, + }; + + ctx.render_resp("projects/list_projects.html", values) +} + +pub async fn create_project_page( + State(ctx): State, + auth_session: AuthSession, +) -> Response { + let user = match auth_session.user { + Some(user) => user, + None => return Redirect::to("/login").into_response(), + }; + + let values = context! { + user => user, + }; + ctx.render_resp("projects/create_project.html", values) +} + +#[derive(Debug, Deserialize)] +pub struct CreateProjectSubmission { + pub name: String, + pub key: String, + pub description: String, +} + +pub async fn create_project_submit( + State(ctx): State, + auth_session: AuthSession, + form: Form, +) -> Response { + let user = match auth_session.user { + Some(user) => user, + None => return Redirect::to("/login").into_response(), + }; + + let project = Project { + id: Uuid::now_v7(), + owner_id: user.id, + + name: form.name.clone(), + key: form.key.clone(), + description: form.description.clone(), + }; + // TODO: validation + + if let Err(err) = project.save(&ctx.kv_handles) { + error!(?err, "failed to save new project"); + return internal_server_error(); + } + + let permission = ModelPermission { + user_id: user.id, + model_type: ModelType::Project, + role: Permission::Admin, + model_id: project.id, + }; + + if let Err(err) = permission.add(&ctx.kv_handles) { + error!(?err, "failed to save new project permission"); + return internal_server_error(); + } + + Redirect::to("/projects").into_response() +} diff --git a/src/kv.rs b/src/kv.rs new file mode 100644 index 0000000..0d68fa0 --- /dev/null +++ b/src/kv.rs @@ -0,0 +1,42 @@ +use std::path::Path; + +use anyhow::Result; +use fjall::{Config, Keyspace, PartitionCreateOptions, PartitionHandle}; + +/// Contains the handles needed to reference key-value data. +/// +/// This contains both the Keyspace and multiple PartitionHandle. +/// The Keyspace allows operational control and reporting at the top level, +/// while each PartitionHandle controls reading, writing, and removing from a +/// particular partition of the data. +/// +/// All fields are public, because this is meant to be used internally as a +/// wrapper to pass everything around, instead of passing each handle around by +/// itself. +#[derive(Clone)] +pub struct KvHandle { + pub keyspace: Keyspace, + + pub project: PartitionHandle, + pub document: PartitionHandle, + pub permissions: PartitionHandle, +} + +impl KvHandle { + pub fn open>(p: P) -> Result { + // TODO: those should probably be configurable, or like, not just hard coded. + let config = Config::new(p).flush_workers(4).compaction_workers(4); + let keyspace = Keyspace::open(config)?; + + let project = keyspace.open_partition("project", PartitionCreateOptions::default())?; + let document = keyspace.open_partition("document", PartitionCreateOptions::default())?; + let permissions = keyspace.open_partition("permissions", PartitionCreateOptions::default())?; + + Ok(KvHandle { + keyspace, + project, + document, + permissions, + }) + } +} diff --git a/src/lib.rs b/src/lib.rs index c3aac44..4f3e2ba 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -4,8 +4,11 @@ pub mod db; pub mod entity; pub mod handler; pub mod logging; +pub mod models; pub mod password; pub mod prelude; +pub mod serialize; pub mod server; pub mod session; pub mod templates; +pub mod kv; diff --git a/src/logging.rs b/src/logging.rs index ed0eca7..5e03789 100644 --- a/src/logging.rs +++ b/src/logging.rs @@ -1,5 +1,7 @@ +use tracing_subscriber::EnvFilter; + pub fn setup_logging() { tracing_subscriber::fmt() - .with_max_level(tracing::Level::DEBUG) + .with_env_filter(EnvFilter::from_default_env()) .init(); } diff --git a/src/main.css b/src/main.css deleted file mode 100644 index b5c61c9..0000000 --- a/src/main.css +++ /dev/null @@ -1,3 +0,0 @@ -@tailwind base; -@tailwind components; -@tailwind utilities; diff --git a/src/models.rs b/src/models.rs new file mode 100644 index 0000000..60d2893 --- /dev/null +++ b/src/models.rs @@ -0,0 +1,190 @@ +use core::fmt::{self, Display}; +use crate::prelude::*; + +use anyhow::Result; +use fjall::PartitionHandle; +use model_derive::Model; +use serde::{Deserialize, Serialize}; +use uuid::Uuid; + +use crate::kv::KvHandle; + +pub trait Model: Sized + Serialize + for<'a> Deserialize<'a> { + type Id; + + fn id(&self) -> Self::Id; + fn key(id: Self::Id) -> Vec; + fn partition(kv_handle: &KvHandle) -> &PartitionHandle; + + fn save(&self, kv_handle: &KvHandle) -> Result<()> { + let key = Self::key(self.id()); + let value = bincode::serialize(self)?; + let partition = Self::partition(kv_handle); + + partition.insert(key, value)?; + + Ok(()) + } + + fn load(kv_handle: &KvHandle, id: Self::Id) -> Result> { + let key = Self::key(id); + let partition = Self::partition(kv_handle); + + match partition.get(key.as_slice())? { + Some(bytes) => { + let bytes = bytes.to_vec(); + let value: Self = bincode::deserialize(&bytes)?; + Ok(Some(value)) + } + None => Ok(None), + } + } +} + +#[derive(Debug, Model, Serialize, Deserialize, PartialEq)] +#[model_version(0)] +pub struct Project { + pub id: Uuid, + pub owner_id: i32, + + pub name: String, + pub description: String, + + // The key is the short code, like BUG, which is used to refer to a project + // quickly and to display it more compactly. This must be unique across the + // projects a user owns. + pub key: String, +} + +#[derive(Debug, Model, Serialize, Deserialize, PartialEq)] +#[model_version(0)] +pub struct Document { + pub id: Uuid, + pub project_id: Uuid, + + pub title: String, + pub content: String, +} + +#[derive(Debug, Serialize, Deserialize, PartialEq)] +#[repr(u8)] +pub enum ModelType { + Project = 0, + Document = 1, +} + +impl Display for ModelType { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + match self { + ModelType::Project => write!(f, "project"), + ModelType::Document => write!(f, "document"), + } + } +} + +#[derive(Debug, Serialize, Deserialize, PartialEq)] +#[repr(u8)] +pub enum Permission { + Admin = 0, + Read = 1, +} + +impl Display for Permission { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + match self { + Permission::Admin => write!(f, "admin"), + Permission::Read => write!(f, "read"), + } + } +} + +#[derive(Debug, Serialize, Deserialize, PartialEq)] +pub struct ModelPermission { + pub user_id: i32, + pub model_type: ModelType, + pub role: Permission, + pub model_id: Uuid, +} + +impl ModelPermission { + pub fn add(&self, kv_handle: &KvHandle) -> Result<()> { + let key = format!( + "{}:{}:{}:{}", + self.user_id, self.model_type, self.role, self.model_id + ); + let value = bincode::serialize(self)?; + + kv_handle.permissions.insert(key, value)?; + + Ok(()) + } + + pub fn user_projects(kv_handle: &KvHandle, user_id: i32) -> Result> { + let prefix = format!("{}:{}:", user_id, ModelType::Project); + + let mut ids = vec![]; + for row in kv_handle.permissions.prefix(prefix).into_iter() { + let (_key, value) = row?; + let permission: ModelPermission = bincode::deserialize(&value)?; + ids.push(permission.model_id); + } + + let projects: Vec = ids + .into_iter() + .filter_map(|id| { + let res = Project::load(kv_handle, id); + res.ok().flatten() + }) + .collect(); + + Ok(projects) + } + + pub fn user_project(kv_handle: &KvHandle, user_id: i32, project_id: Uuid) -> Result> { + let key = format!("{}:{}:{}:{}", user_id, ModelType::Project, Permission::Admin, project_id); + let value = kv_handle.permissions.get(key)?; + + match value { + Some(value) => { + let permission: ModelPermission = bincode::deserialize(&value)?; + let project = Project::load(kv_handle, permission.model_id)?; + Ok(project) + } + None => Ok(None), + } + } + + pub fn user_documents(kv_handle: &KvHandle, user_id: i32) -> Result> { + let prefix = format!("{}:{}:", user_id, ModelType::Document); + + let mut ids = vec![]; + for row in kv_handle.permissions.prefix(prefix).into_iter() { + let (_key, value) = row?; + let permission: ModelPermission = bincode::deserialize(&value)?; + ids.push(permission.model_id); + } + dbg!(&ids); + + let documents: Vec = ids + .into_iter() + .filter_map(|id| Document::load(kv_handle, id).ok().flatten()) + .collect(); + dbg!(&documents); + + Ok(documents) + } + + pub fn user_document(kv_handle: &KvHandle, user_id: i32, document_id: Uuid) -> Result> { + let key = format!("{}:{}:{}:{}", user_id, ModelType::Document, Permission::Admin, document_id); + let value = kv_handle.permissions.get(key)?; + + match value { + Some(value) => { + let permission: ModelPermission = bincode::deserialize(&value)?; + let document = Document::load(kv_handle, permission.model_id)?; + Ok(document) + } + None => Ok(None), + } + } +} diff --git a/src/prelude.rs b/src/prelude.rs index 0099512..e24c43a 100644 --- a/src/prelude.rs +++ b/src/prelude.rs @@ -1,5 +1,6 @@ pub use crate::context::Context; pub use crate::entity::prelude::*; +pub use crate::models::Model; pub use axum::extract::State; pub use axum::response::{Html, IntoResponse, Response}; pub use minijinja::context; diff --git a/src/serialize.rs b/src/serialize.rs new file mode 100644 index 0000000..7d790f8 --- /dev/null +++ b/src/serialize.rs @@ -0,0 +1,16 @@ +use bincode::{DefaultOptions, Options}; +use serde::{Deserialize, Serialize}; + +fn bincode_options() -> impl Options { + DefaultOptions::new().with_big_endian() +} + +pub fn serialize(value: &T) -> Result, bincode::Error> { + let options = bincode_options(); + options.serialize(value) +} + +pub fn deserialize<'a, T: Deserialize<'a>>(bytes: &'a [u8]) -> Result { + let options = bincode_options(); + options.deserialize(bytes) +} diff --git a/src/server.rs b/src/server.rs index e966b29..e6e96b8 100644 --- a/src/server.rs +++ b/src/server.rs @@ -10,7 +10,7 @@ use tower_sessions::SessionManagerLayer; use tower_sessions_sqlx_store::{sqlx::SqlitePool, SqliteStore}; use tracing::Level; -use crate::{config::CommandLineOptions, context::Context, handler::{home::home_page, login::logout, login_page, login_submit}, logging::setup_logging, templates::make_template_loader}; +use crate::{config::CommandLineOptions, context::Context, handler::{documents::{create_document_page, create_document_submit, documents_page, edit_document_page, edit_document_submit}, home::home_page, login::logout, login_page, login_submit, projects::{create_project_page, create_project_submit, projects_page}}, kv::KvHandle, logging::setup_logging, templates::make_template_loader}; pub async fn run() -> Result<()> { dotenvy::dotenv()?; @@ -25,7 +25,10 @@ pub async fn run() -> Result<()> { let session_layer = create_session_manager_layer().await?; - let context = Context::new(db, template_loader); + // TODO: better name, also make it an option + let kv_handles = KvHandle::open("./kvdata/")?; + + let context = Context::new(db, kv_handles, template_loader); let auth_backend = context.clone(); let auth_layer = AuthManagerLayerBuilder::new(auth_backend, session_layer.clone()).build(); @@ -40,6 +43,14 @@ pub async fn run() -> Result<()> { .route("/login", get(login_page)) .route("/login", post(login_submit)) .route("/logout", get(logout)) + .route("/projects", get(projects_page)) + .route("/projects/new", get(create_project_page)) + .route("/projects/new", post(create_project_submit)) + .route("/documents", get(documents_page)) + .route("/documents/new", get(create_document_page)) + .route("/documents/new", post(create_document_submit)) + .route("/documents/edit/:id", get(edit_document_page)) + .route("/documents/edit/:id", post(edit_document_submit)) .layer(trace_layer) .layer(session_layer) .layer(auth_layer) diff --git a/src/templates.rs b/src/templates.rs index 41ab4c4..9090c7f 100644 --- a/src/templates.rs +++ b/src/templates.rs @@ -1,9 +1,13 @@ +use minijinja::{Error, ErrorKind}; +use free_icons::IconAttrs; use minijinja::{path_loader, Environment}; use minijinja_autoreload::AutoReloader; pub fn make_template_loader(auto_reload: bool) -> AutoReloader { let reloader = AutoReloader::new(move |notifier| { let mut env = Environment::new(); + setup_filters(&mut env); + let templates_path = "templates/"; env.set_loader(path_loader(templates_path)); if auto_reload { @@ -13,3 +17,18 @@ pub fn make_template_loader(auto_reload: bool) -> AutoReloader { }); reloader } + +pub fn setup_filters(env: &mut Environment) { + env.add_filter("heroicon", heroicon_filter); +} + +pub fn heroicon_filter(name: String, classes: Option) -> Result { + let class = classes.unwrap_or_else(|| "".to_owned()); + + let attrs = IconAttrs::default() + .class(&class) + .fill("none") + .stroke_color("currentColor"); + + free_icons::heroicons(&name, true, attrs).ok_or(Error::new(ErrorKind::TemplateNotFound, "cannot find template for requested icon")) +} diff --git a/static/main.css b/static/main.css index fc4e466..0456fee 100644 --- a/static/main.css +++ b/static/main.css @@ -1,1889 +1,196 @@ -/* -! tailwindcss v3.4.1 | MIT License | https://tailwindcss.com -*/ - -/* -1. Prevent padding and border from affecting element width. (https://github.com/mozdevs/cssremedy/issues/4) -2. Allow adding a border to an element by just adding a border-width. (https://github.com/tailwindcss/tailwindcss/pull/116) -*/ - -*, -::before, -::after { - box-sizing: border-box; - /* 1 */ - border-width: 0; - /* 2 */ - border-style: solid; - /* 2 */ - border-color: #e5e7eb; - /* 2 */ -} - -::before, -::after { - --tw-content: ''; -} - -/* -1. Use a consistent sensible line-height in all browsers. -2. Prevent adjustments of font size after orientation changes in iOS. -3. Use a more readable tab size. -4. Use the user's configured `sans` font-family by default. -5. Use the user's configured `sans` font-feature-settings by default. -6. Use the user's configured `sans` font-variation-settings by default. -7. Disable tap highlights on iOS -*/ - -html, -:host { - line-height: 1.5; - /* 1 */ - -webkit-text-size-adjust: 100%; - /* 2 */ - -moz-tab-size: 4; - /* 3 */ - -o-tab-size: 4; - tab-size: 4; - /* 3 */ - font-family: ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji"; - /* 4 */ - font-feature-settings: normal; - /* 5 */ - font-variation-settings: normal; - /* 6 */ - -webkit-tap-highlight-color: transparent; - /* 7 */ -} - -/* -1. Remove the margin in all browsers. -2. Inherit line-height from `html` so users can set them as a class directly on the `html` element. -*/ - -body { - margin: 0; - /* 1 */ - line-height: inherit; - /* 2 */ -} - -/* -1. Add the correct height in Firefox. -2. Correct the inheritance of border color in Firefox. (https://bugzilla.mozilla.org/show_bug.cgi?id=190655) -3. Ensure horizontal rules are visible by default. -*/ - -hr { - height: 0; - /* 1 */ - color: inherit; - /* 2 */ - border-top-width: 1px; - /* 3 */ -} - -/* -Add the correct text decoration in Chrome, Edge, and Safari. -*/ - -abbr:where([title]) { - -webkit-text-decoration: underline dotted; - text-decoration: underline dotted; -} - -/* -Remove the default font size and weight for headings. -*/ - -h1, -h2, -h3, -h4, -h5, -h6 { - font-size: inherit; - font-weight: inherit; -} - -/* -Reset links to optimize for opt-in styling instead of opt-out. -*/ - -a { - color: inherit; - text-decoration: inherit; -} - -/* -Add the correct font weight in Edge and Safari. -*/ - -b, -strong { - font-weight: bolder; -} - -/* -1. Use the user's configured `mono` font-family by default. -2. Use the user's configured `mono` font-feature-settings by default. -3. Use the user's configured `mono` font-variation-settings by default. -4. Correct the odd `em` font sizing in all browsers. -*/ - -code, -kbd, -samp, -pre { - font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace; - /* 1 */ - font-feature-settings: normal; - /* 2 */ - font-variation-settings: normal; - /* 3 */ - font-size: 1em; - /* 4 */ -} - -/* -Add the correct font size in all browsers. -*/ - -small { - font-size: 80%; -} - -/* -Prevent `sub` and `sup` elements from affecting the line height in all browsers. -*/ - -sub, -sup { - font-size: 75%; - line-height: 0; +/* node_modules/@milkdown/theme-nord/lib/style.css */ +.ProseMirror { position: relative; - vertical-align: baseline; + word-wrap: break-word; + white-space: pre-wrap; + white-space: break-spaces; + font-variant-ligatures: none; + font-feature-settings: "liga" 0; } - -sub { - bottom: -0.25em; +.ProseMirror pre { + white-space: pre-wrap; } - -sup { - top: -0.5em; +.ProseMirror li { + position: relative; } - -/* -1. Remove text indentation from table contents in Chrome and Safari. (https://bugs.chromium.org/p/chromium/issues/detail?id=999088, https://bugs.webkit.org/show_bug.cgi?id=201297) -2. Correct table border color inheritance in all Chrome and Safari. (https://bugs.chromium.org/p/chromium/issues/detail?id=935729, https://bugs.webkit.org/show_bug.cgi?id=195016) -3. Remove gaps between table borders by default. -*/ - -table { - text-indent: 0; - /* 1 */ - border-color: inherit; - /* 2 */ +.ProseMirror-hideselection *::selection { + background: transparent; +} +.ProseMirror-hideselection *::-moz-selection { + background: transparent; +} +.ProseMirror-hideselection { + caret-color: transparent; +} +.ProseMirror [draggable][contenteditable=false] { + -webkit-user-select: text; + -moz-user-select: text; + user-select: text; +} +.ProseMirror-selectednode { + outline: 2px solid #8cf; +} +li.ProseMirror-selectednode { + outline: none; +} +li.ProseMirror-selectednode:after { + content: ""; + position: absolute; + left: -32px; + right: -2px; + top: -2px; + bottom: -2px; + border: 2px solid #8cf; + pointer-events: none; +} +img.ProseMirror-separator { + display: inline !important; + border: none !important; + margin: 0 !important; +} +.ProseMirror .tableWrapper { + overflow-x: auto; +} +.ProseMirror table { border-collapse: collapse; - /* 3 */ -} - -/* -1. Change the font styles in all browsers. -2. Remove the margin in Firefox and Safari. -3. Remove default padding in all browsers. -*/ - -button, -input, -optgroup, -select, -textarea { - font-family: inherit; - /* 1 */ - font-feature-settings: inherit; - /* 1 */ - font-variation-settings: inherit; - /* 1 */ - font-size: 100%; - /* 1 */ - font-weight: inherit; - /* 1 */ - line-height: inherit; - /* 1 */ - color: inherit; - /* 1 */ - margin: 0; - /* 2 */ - padding: 0; - /* 3 */ -} - -/* -Remove the inheritance of text transform in Edge and Firefox. -*/ - -button, -select { - text-transform: none; -} - -/* -1. Correct the inability to style clickable types in iOS and Safari. -2. Remove default button styles. -*/ - -button, -[type='button'], -[type='reset'], -[type='submit'] { - -webkit-appearance: button; - /* 1 */ - background-color: transparent; - /* 2 */ - background-image: none; - /* 2 */ -} - -/* -Use the modern Firefox focus style for all focusable elements. -*/ - -:-moz-focusring { - outline: auto; -} - -/* -Remove the additional `:invalid` styles in Firefox. (https://github.com/mozilla/gecko-dev/blob/2f9eacd9d3d995c937b4251a5557d95d494c9be1/layout/style/res/forms.css#L728-L737) -*/ - -:-moz-ui-invalid { - box-shadow: none; -} - -/* -Add the correct vertical alignment in Chrome and Firefox. -*/ - -progress { - vertical-align: baseline; -} - -/* -Correct the cursor style of increment and decrement buttons in Safari. -*/ - -::-webkit-inner-spin-button, -::-webkit-outer-spin-button { - height: auto; -} - -/* -1. Correct the odd appearance in Chrome and Safari. -2. Correct the outline style in Safari. -*/ - -[type='search'] { - -webkit-appearance: textfield; - /* 1 */ - outline-offset: -2px; - /* 2 */ -} - -/* -Remove the inner padding in Chrome and Safari on macOS. -*/ - -::-webkit-search-decoration { - -webkit-appearance: none; -} - -/* -1. Correct the inability to style clickable types in iOS and Safari. -2. Change font properties to `inherit` in Safari. -*/ - -::-webkit-file-upload-button { - -webkit-appearance: button; - /* 1 */ - font: inherit; - /* 2 */ -} - -/* -Add the correct display in Chrome and Safari. -*/ - -summary { - display: list-item; -} - -/* -Removes the default spacing and border for appropriate elements. -*/ - -blockquote, -dl, -dd, -h1, -h2, -h3, -h4, -h5, -h6, -hr, -figure, -p, -pre { - margin: 0; -} - -fieldset { - margin: 0; - padding: 0; -} - -legend { - padding: 0; -} - -ol, -ul, -menu { - list-style: none; - margin: 0; - padding: 0; -} - -/* -Reset default styling for dialogs. -*/ - -dialog { - padding: 0; -} - -/* -Prevent resizing textareas horizontally by default. -*/ - -textarea { - resize: vertical; -} - -/* -1. Reset the default placeholder opacity in Firefox. (https://github.com/tailwindlabs/tailwindcss/issues/3300) -2. Set the default placeholder color to the user's configured gray 400 color. -*/ - -input::-moz-placeholder, textarea::-moz-placeholder { - opacity: 1; - /* 1 */ - color: #9ca3af; - /* 2 */ -} - -input::placeholder, -textarea::placeholder { - opacity: 1; - /* 1 */ - color: #9ca3af; - /* 2 */ -} - -/* -Set the default cursor for buttons. -*/ - -button, -[role="button"] { - cursor: pointer; -} - -/* -Make sure disabled buttons don't get the pointer cursor. -*/ - -:disabled { - cursor: default; -} - -/* -1. Make replaced elements `display: block` by default. (https://github.com/mozdevs/cssremedy/issues/14) -2. Add `vertical-align: middle` to align replaced elements more sensibly by default. (https://github.com/jensimmons/cssremedy/issues/14#issuecomment-634934210) - This can trigger a poorly considered lint error in some tools but is included by design. -*/ - -img, -svg, -video, -canvas, -audio, -iframe, -embed, -object { - display: block; - /* 1 */ - vertical-align: middle; - /* 2 */ -} - -/* -Constrain images and videos to the parent width and preserve their intrinsic aspect ratio. (https://github.com/mozdevs/cssremedy/issues/14) -*/ - -img, -video { - max-width: 100%; - height: auto; -} - -/* Make elements with the HTML hidden attribute stay hidden by default */ - -[hidden] { - display: none; -} - -*, ::before, ::after { - --tw-border-spacing-x: 0; - --tw-border-spacing-y: 0; - --tw-translate-x: 0; - --tw-translate-y: 0; - --tw-rotate: 0; - --tw-skew-x: 0; - --tw-skew-y: 0; - --tw-scale-x: 1; - --tw-scale-y: 1; - --tw-pan-x: ; - --tw-pan-y: ; - --tw-pinch-zoom: ; - --tw-scroll-snap-strictness: proximity; - --tw-gradient-from-position: ; - --tw-gradient-via-position: ; - --tw-gradient-to-position: ; - --tw-ordinal: ; - --tw-slashed-zero: ; - --tw-numeric-figure: ; - --tw-numeric-spacing: ; - --tw-numeric-fraction: ; - --tw-ring-inset: ; - --tw-ring-offset-width: 0px; - --tw-ring-offset-color: #fff; - --tw-ring-color: rgb(59 130 246 / 0.5); - --tw-ring-offset-shadow: 0 0 #0000; - --tw-ring-shadow: 0 0 #0000; - --tw-shadow: 0 0 #0000; - --tw-shadow-colored: 0 0 #0000; - --tw-blur: ; - --tw-brightness: ; - --tw-contrast: ; - --tw-grayscale: ; - --tw-hue-rotate: ; - --tw-invert: ; - --tw-saturate: ; - --tw-sepia: ; - --tw-drop-shadow: ; - --tw-backdrop-blur: ; - --tw-backdrop-brightness: ; - --tw-backdrop-contrast: ; - --tw-backdrop-grayscale: ; - --tw-backdrop-hue-rotate: ; - --tw-backdrop-invert: ; - --tw-backdrop-opacity: ; - --tw-backdrop-saturate: ; - --tw-backdrop-sepia: ; -} - -::backdrop { - --tw-border-spacing-x: 0; - --tw-border-spacing-y: 0; - --tw-translate-x: 0; - --tw-translate-y: 0; - --tw-rotate: 0; - --tw-skew-x: 0; - --tw-skew-y: 0; - --tw-scale-x: 1; - --tw-scale-y: 1; - --tw-pan-x: ; - --tw-pan-y: ; - --tw-pinch-zoom: ; - --tw-scroll-snap-strictness: proximity; - --tw-gradient-from-position: ; - --tw-gradient-via-position: ; - --tw-gradient-to-position: ; - --tw-ordinal: ; - --tw-slashed-zero: ; - --tw-numeric-figure: ; - --tw-numeric-spacing: ; - --tw-numeric-fraction: ; - --tw-ring-inset: ; - --tw-ring-offset-width: 0px; - --tw-ring-offset-color: #fff; - --tw-ring-color: rgb(59 130 246 / 0.5); - --tw-ring-offset-shadow: 0 0 #0000; - --tw-ring-shadow: 0 0 #0000; - --tw-shadow: 0 0 #0000; - --tw-shadow-colored: 0 0 #0000; - --tw-blur: ; - --tw-brightness: ; - --tw-contrast: ; - --tw-grayscale: ; - --tw-hue-rotate: ; - --tw-invert: ; - --tw-saturate: ; - --tw-sepia: ; - --tw-drop-shadow: ; - --tw-backdrop-blur: ; - --tw-backdrop-brightness: ; - --tw-backdrop-contrast: ; - --tw-backdrop-grayscale: ; - --tw-backdrop-hue-rotate: ; - --tw-backdrop-invert: ; - --tw-backdrop-opacity: ; - --tw-backdrop-saturate: ; - --tw-backdrop-sepia: ; -} - -.sr-only { - position: absolute; - width: 1px; - height: 1px; - padding: 0; - margin: -1px; + table-layout: fixed; + width: 100%; overflow: hidden; - clip: rect(0, 0, 0, 0); - white-space: nowrap; - border-width: 0; } - -.fixed { - position: fixed; -} - -.absolute { - position: absolute; -} - -.relative { +.ProseMirror td, +.ProseMirror th { + vertical-align: top; + box-sizing: border-box; position: relative; } - -.sticky { - position: sticky; -} - -.inset-0 { - inset: 0px; -} - -.-inset-0 { - inset: -0px; -} - -.-inset-0\.5 { - inset: -0.125rem; -} - -.-inset-1 { - inset: -0.25rem; -} - -.-inset-1\.5 { - inset: -0.375rem; -} - -.inset-y-0 { - top: 0px; - bottom: 0px; -} - -.left-0 { - left: 0px; -} - -.right-0 { - right: 0px; -} - -.left-full { - left: 100%; -} - -.top-0 { - top: 0px; -} - -.z-10 { - z-index: 10; -} - -.z-40 { - z-index: 40; -} - -.z-50 { - z-index: 50; -} - -.-m-2 { - margin: -0.5rem; -} - -.-m-2\.5 { - margin: -0.625rem; -} - -.mx-auto { - margin-left: auto; - margin-right: auto; -} - -.-mx-2 { - margin-left: -0.5rem; - margin-right: -0.5rem; -} - -.-mx-6 { - margin-left: -1.5rem; - margin-right: -1.5rem; -} - -.ml-3 { - margin-left: 0.75rem; -} - -.mt-10 { - margin-top: 2.5rem; -} - -.mt-2 { - margin-top: 0.5rem; -} - -.mt-6 { - margin-top: 1.5rem; -} - -.mb-6 { - margin-bottom: 1.5rem; -} - -.mt-1 { - margin-top: 0.25rem; -} - -.ml-auto { - margin-left: auto; -} - -.mt-auto { - margin-top: auto; -} - -.mr-16 { - margin-right: 4rem; -} - -.-mr-2 { - margin-right: -0.5rem; -} - -.ml-10 { - margin-left: 2.5rem; -} - -.ml-4 { - margin-left: 1rem; -} - -.mt-3 { - margin-top: 0.75rem; -} - -.block { - display: block; -} - -.inline-block { - display: inline-block; -} - -.flex { - display: flex; -} - -.inline-flex { - display: inline-flex; -} - -.grid { - display: grid; -} - -.hidden { - display: none; -} - -.h-full { - height: 100%; -} - -.h-10 { - height: 2.5rem; -} - -.h-4 { - height: 1rem; -} - -.h-5 { - height: 1.25rem; -} - -.h-16 { - height: 4rem; -} - -.h-6 { - height: 1.5rem; -} - -.h-8 { - height: 2rem; -} - -.min-h-screen { - min-height: 100vh; -} - -.min-h-full { - min-height: 100%; -} - -.w-4 { - width: 1rem; -} - -.w-5 { - width: 1.25rem; -} - -.w-auto { - width: auto; -} - -.w-full { - width: 100%; -} - -.w-48 { - width: 12rem; -} - -.w-6 { - width: 1.5rem; -} - -.w-8 { - width: 2rem; -} - -.w-9 { - width: 2.25rem; -} - -.w-16 { - width: 4rem; -} - -.w-10 { - width: 2.5rem; -} - -.min-w-max { - min-width: -moz-max-content; - min-width: max-content; -} - -.max-w-sm { - max-width: 24rem; -} - -.max-w-7xl { - max-width: 80rem; -} - -.max-w-xs { - max-width: 20rem; -} - -.flex-1 { - flex: 1 1 0%; -} - -.flex-shrink-0 { - flex-shrink: 0; -} - -.shrink-0 { - flex-shrink: 0; -} - -.grow-0 { - flex-grow: 0; -} - -.grow { - flex-grow: 1; -} - -.origin-top-right { - transform-origin: top right; -} - -.-translate-x-full { - --tw-translate-x: -100%; - transform: translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y)); -} - -.translate-x-0 { - --tw-translate-x: 0px; - transform: translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y)); -} - -.scale-100 { - --tw-scale-x: 1; - --tw-scale-y: 1; - transform: translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y)); -} - -.scale-95 { - --tw-scale-x: .95; - --tw-scale-y: .95; - transform: translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y)); -} - -.transform { - transform: translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y)); -} - -.grid-cols-2 { - grid-template-columns: repeat(2, minmax(0, 1fr)); -} - -.flex-row { - flex-direction: row; -} - -.flex-col { - flex-direction: column; -} - -.items-center { - align-items: center; -} - -.items-baseline { - align-items: baseline; -} - -.justify-center { - justify-content: center; -} - -.justify-between { - justify-content: space-between; -} - -.gap-3 { - gap: 0.75rem; -} - -.gap-4 { - gap: 1rem; -} - -.gap-x-3 { - -moz-column-gap: 0.75rem; - column-gap: 0.75rem; -} - -.gap-x-4 { - -moz-column-gap: 1rem; - column-gap: 1rem; -} - -.gap-y-5 { - row-gap: 1.25rem; -} - -.gap-y-7 { - row-gap: 1.75rem; -} - -.gap-x-6 { - -moz-column-gap: 1.5rem; - column-gap: 1.5rem; -} - -.space-y-6 > :not([hidden]) ~ :not([hidden]) { - --tw-space-y-reverse: 0; - margin-top: calc(1.5rem * calc(1 - var(--tw-space-y-reverse))); - margin-bottom: calc(1.5rem * var(--tw-space-y-reverse)); -} - -.space-y-1 > :not([hidden]) ~ :not([hidden]) { - --tw-space-y-reverse: 0; - margin-top: calc(0.25rem * calc(1 - var(--tw-space-y-reverse))); - margin-bottom: calc(0.25rem * var(--tw-space-y-reverse)); -} - -.space-x-4 > :not([hidden]) ~ :not([hidden]) { - --tw-space-x-reverse: 0; - margin-right: calc(1rem * var(--tw-space-x-reverse)); - margin-left: calc(1rem * calc(1 - var(--tw-space-x-reverse))); -} - -.overflow-hidden { - overflow: hidden; -} - -.overflow-y-auto { - overflow-y: auto; -} - -.truncate { - overflow: hidden; - text-overflow: ellipsis; - white-space: nowrap; -} - -.whitespace-nowrap { - white-space: nowrap; -} - -.rounded { - border-radius: 0.25rem; -} - -.rounded-md { - border-radius: 0.375rem; -} - -.rounded-full { - border-radius: 9999px; -} - -.rounded-lg { - border-radius: 0.5rem; -} - -.border-0 { - border-width: 0px; -} - -.border { - border-width: 1px; -} - -.border-t { - border-top-width: 1px; -} - -.border-b-2 { - border-bottom-width: 2px; -} - -.border-l-4 { +.ProseMirror .column-resize-handle { + position: absolute; + right: -2px; + top: 0; + bottom: 0; + width: 4px; + z-index: 20; + background-color: #adf; + pointer-events: none; +} +.ProseMirror.resize-cursor { + cursor: ew-resize; + cursor: col-resize; +} +.ProseMirror .selectedCell:after { + z-index: 2; + position: absolute; + content: ""; + left: 0; + right: 0; + top: 0; + bottom: 0; + background: #c8c8ff66; + pointer-events: none; +} +.milkdown-theme-nord blockquote { border-left-width: 4px; + --tw-border-opacity: 1; + border-color: rgb(94 129 172 / var(--tw-border-opacity)); + padding-left: 1rem; + font-family: + ui-serif, + Georgia, + Cambria, + Times New Roman, + Times, + serif; + font-style: normal; } - -.border-gray-200 { +.milkdown-theme-nord code { + font-family: + ui-monospace, + SFMono-Regular, + Menlo, + Monaco, + Consolas, + Liberation Mono, + Courier New, + monospace; + font-weight: 400; + --tw-text-opacity: 1; + color: rgb(94 129 172 / var(--tw-text-opacity)); +} +.milkdown-theme-nord pre code { + color: inherit; +} +.milkdown-theme-nord img { + margin-top: 0 !important; + margin-bottom: 0 !important; + display: inline-block; + max-width: 100%; +} +.milkdown-theme-nord.prose :where(blockquote):not(:where([class~=not-prose] *)) { + font-weight: 400; +} +.milkdown-theme-nord.prose :where(ol > li):not(:where([class~=not-prose] *))::marker, +.milkdown-theme-nord.prose :where(ul > li):not(:where([class~=not-prose] *))::marker { + --tw-text-opacity: 1; + color: rgb(94 129 172 / var(--tw-text-opacity)); +} +.milkdown-theme-nord.prose :where(blockquote p:first-of-type):not(:where([class~=not-prose] *)):before, +.milkdown-theme-nord.prose :where(blockquote p:first-of-type):not(:where([class~=not-prose] *)):after { + content: ""; +} +.milkdown-theme-nord.prose :where(code):not(:where([class~=not-prose] *)):before, +.milkdown-theme-nord.prose :where(code):not(:where([class~=not-prose] *)):after { + content: ""; +} +.milkdown-theme-nord.prose .tableWrapper { + position: relative; + margin-bottom: .5rem; + overflow-x: auto; +} +.milkdown-theme-nord.prose table { + margin: 1rem !important; + overflow: visible !important; + font-size: .875rem; + line-height: 1.25rem; + --tw-shadow: 0 4px 6px -1px rgb(0 0 0 / .1), 0 2px 4px -2px rgb(0 0 0 / .1); + --tw-shadow-colored: 0 4px 6px -1px var(--tw-shadow-color), 0 2px 4px -2px var(--tw-shadow-color); + box-shadow: + var(--tw-ring-offset-shadow, 0 0 #0000), + var(--tw-ring-shadow, 0 0 #0000), + var(--tw-shadow); +} +@media (min-width: 640px) { + .milkdown-theme-nord.prose table { + border-radius: .5rem; + } +} +.milkdown-theme-nord.prose td, +.milkdown-theme-nord.prose th { + padding: .75rem 1.5rem !important; +} +.milkdown-theme-nord.prose tr { + border-bottom-width: 1px; --tw-border-opacity: 1; border-color: rgb(229 231 235 / var(--tw-border-opacity)); } - -.border-gray-300 { +:is(.dark .milkdown-theme-nord.prose tr) { --tw-border-opacity: 1; - border-color: rgb(209 213 219 / var(--tw-border-opacity)); + border-color: rgb(75 85 99 / var(--tw-border-opacity)); } - -.border-indigo-500 { - --tw-border-opacity: 1; - border-color: rgb(99 102 241 / var(--tw-border-opacity)); +.milkdown-theme-nord.prose :where(td, th) p { + margin: 0 !important; } - -.border-transparent { - border-color: transparent; -} - -.border-indigo-400 { - --tw-border-opacity: 1; - border-color: rgb(129 140 248 / var(--tw-border-opacity)); -} - -.border-indigo-700 { - --tw-border-opacity: 1; - border-color: rgb(67 56 202 / var(--tw-border-opacity)); -} - -.border-purple-700 { - --tw-border-opacity: 1; - border-color: rgb(126 34 206 / var(--tw-border-opacity)); -} - -.border-emerald-700 { - --tw-border-opacity: 1; - border-color: rgb(4 120 87 / var(--tw-border-opacity)); -} - -.bg-purple-100 { - --tw-bg-opacity: 1; - background-color: rgb(243 232 255 / var(--tw-bg-opacity)); -} - -.bg-white { - --tw-bg-opacity: 1; - background-color: rgb(255 255 255 / var(--tw-bg-opacity)); -} - -.bg-indigo-600 { - --tw-bg-opacity: 1; - background-color: rgb(79 70 229 / var(--tw-bg-opacity)); -} - -.bg-pink-600 { - --tw-bg-opacity: 1; - background-color: rgb(219 39 119 / var(--tw-bg-opacity)); -} - -.bg-orange-600 { - --tw-bg-opacity: 1; - background-color: rgb(234 88 12 / var(--tw-bg-opacity)); -} - -.bg-green-600 { - --tw-bg-opacity: 1; - background-color: rgb(22 163 74 / var(--tw-bg-opacity)); -} - -.bg-emerald-600 { - --tw-bg-opacity: 1; - background-color: rgb(5 150 105 / var(--tw-bg-opacity)); -} - -.bg-gray-100 { - --tw-bg-opacity: 1; - background-color: rgb(243 244 246 / var(--tw-bg-opacity)); -} - -.bg-indigo-50 { - --tw-bg-opacity: 1; - background-color: rgb(238 242 255 / var(--tw-bg-opacity)); -} - -.bg-indigo-500 { - --tw-bg-opacity: 1; - background-color: rgb(99 102 241 / var(--tw-bg-opacity)); -} - -.bg-indigo-700 { - --tw-bg-opacity: 1; - background-color: rgb(67 56 202 / var(--tw-bg-opacity)); -} - -.bg-gray-900\/80 { - background-color: rgb(17 24 39 / 0.8); -} - -.bg-purple-600 { - --tw-bg-opacity: 1; - background-color: rgb(147 51 234 / var(--tw-bg-opacity)); -} - -.bg-purple-700 { - --tw-bg-opacity: 1; - background-color: rgb(126 34 206 / var(--tw-bg-opacity)); -} - -.bg-emerald-700 { - --tw-bg-opacity: 1; - background-color: rgb(4 120 87 / var(--tw-bg-opacity)); -} - -.bg-purple-200 { - --tw-bg-opacity: 1; - background-color: rgb(233 213 255 / var(--tw-bg-opacity)); -} - -.bg-purple-300 { - --tw-bg-opacity: 1; - background-color: rgb(216 180 254 / var(--tw-bg-opacity)); -} - -.bg-gray-200 { - --tw-bg-opacity: 1; - background-color: rgb(229 231 235 / var(--tw-bg-opacity)); -} - -.fill-\[\#24292F\] { - fill: #24292F; -} - -.p-1 { - padding: 0.25rem; -} - -.p-2 { - padding: 0.5rem; -} - -.p-2\.5 { - padding: 0.625rem; -} - -.py-12 { - padding-top: 3rem; - padding-bottom: 3rem; -} - -.px-3 { - padding-left: 0.75rem; - padding-right: 0.75rem; -} - -.px-6 { - padding-left: 1.5rem; - padding-right: 1.5rem; -} - -.py-1 { - padding-top: 0.25rem; - padding-bottom: 0.25rem; -} - -.py-1\.5 { - padding-top: 0.375rem; - padding-bottom: 0.375rem; -} - -.py-2 { - padding-top: 0.5rem; - padding-bottom: 0.5rem; -} - -.px-1 { - padding-left: 0.25rem; - padding-right: 0.25rem; -} - -.px-2 { - padding-left: 0.5rem; - padding-right: 0.5rem; -} - -.px-4 { - padding-left: 1rem; - padding-right: 1rem; -} - -.px-2\.5 { - padding-left: 0.625rem; - padding-right: 0.625rem; -} - -.py-0 { - padding-top: 0px; - padding-bottom: 0px; -} - -.py-0\.5 { - padding-top: 0.125rem; - padding-bottom: 0.125rem; -} - -.py-3 { - padding-top: 0.75rem; - padding-bottom: 0.75rem; -} - -.py-10 { - padding-top: 2.5rem; - padding-bottom: 2.5rem; -} - -.py-4 { - padding-top: 1rem; - padding-bottom: 1rem; -} - -.px-5 { - padding-left: 1.25rem; - padding-right: 1.25rem; -} - -.py-6 { - padding-top: 1.5rem; - padding-bottom: 1.5rem; -} - -.pb-6 { - padding-bottom: 1.5rem; -} - -.pb-4 { - padding-bottom: 1rem; -} - -.pl-3 { - padding-left: 0.75rem; -} - -.pr-2 { - padding-right: 0.5rem; -} - -.pr-4 { - padding-right: 1rem; -} - -.pt-1 { - padding-top: 0.25rem; -} - -.pt-2 { - padding-top: 0.5rem; -} - -.pb-2 { - padding-bottom: 0.5rem; -} - -.pt-5 { - padding-top: 1.25rem; -} - -.pb-3 { - padding-bottom: 0.75rem; -} - -.pt-4 { - padding-top: 1rem; -} - -.text-center { - text-align: center; -} - -.text-xl { - font-size: 1.25rem; - line-height: 1.75rem; -} - -.text-2xl { - font-size: 1.5rem; - line-height: 2rem; -} - -.text-sm { - font-size: 0.875rem; - line-height: 1.25rem; -} - -.text-base { - font-size: 1rem; - line-height: 1.5rem; -} - -.text-\[0\.625rem\] { - font-size: 0.625rem; -} - -.text-xs { - font-size: 0.75rem; - line-height: 1rem; -} - -.text-lg { - font-size: 1.125rem; - line-height: 1.75rem; -} - -.font-bold { - font-weight: 700; -} - -.font-medium { - font-weight: 500; -} - -.font-semibold { - font-weight: 600; -} - -.leading-6 { - line-height: 1.5rem; -} - -.leading-9 { - line-height: 2.25rem; -} - -.leading-5 { - line-height: 1.25rem; -} - -.tracking-tight { - letter-spacing: -0.025em; -} - -.text-gray-500 { - --tw-text-opacity: 1; - color: rgb(107 114 128 / var(--tw-text-opacity)); -} - -.text-gray-900 { - --tw-text-opacity: 1; - color: rgb(17 24 39 / var(--tw-text-opacity)); -} - -.text-indigo-600 { - --tw-text-opacity: 1; - color: rgb(79 70 229 / var(--tw-text-opacity)); -} - -.text-white { - --tw-text-opacity: 1; - color: rgb(255 255 255 / var(--tw-text-opacity)); -} - -.text-pink-600 { - --tw-text-opacity: 1; - color: rgb(219 39 119 / var(--tw-text-opacity)); -} - -.text-orange-600 { - --tw-text-opacity: 1; - color: rgb(234 88 12 / var(--tw-text-opacity)); -} - -.text-green-600 { - --tw-text-opacity: 1; - color: rgb(22 163 74 / var(--tw-text-opacity)); -} - -.text-emerald-600 { - --tw-text-opacity: 1; - color: rgb(5 150 105 / var(--tw-text-opacity)); -} - -.text-gray-400 { - --tw-text-opacity: 1; - color: rgb(156 163 175 / var(--tw-text-opacity)); -} - -.text-gray-700 { - --tw-text-opacity: 1; - color: rgb(55 65 81 / var(--tw-text-opacity)); -} - -.text-indigo-700 { - --tw-text-opacity: 1; - color: rgb(67 56 202 / var(--tw-text-opacity)); -} - -.text-indigo-200 { - --tw-text-opacity: 1; - color: rgb(199 210 254 / var(--tw-text-opacity)); -} - -.text-indigo-300 { - --tw-text-opacity: 1; - color: rgb(165 180 252 / var(--tw-text-opacity)); -} - -.text-purple-200 { - --tw-text-opacity: 1; - color: rgb(233 213 255 / var(--tw-text-opacity)); -} - -.text-purple-300 { - --tw-text-opacity: 1; - color: rgb(216 180 254 / var(--tw-text-opacity)); -} - -.text-emerald-200 { - --tw-text-opacity: 1; - color: rgb(167 243 208 / var(--tw-text-opacity)); -} - -.text-emerald-300 { - --tw-text-opacity: 1; - color: rgb(110 231 183 / var(--tw-text-opacity)); -} - -.text-gray-300 { - --tw-text-opacity: 1; - color: rgb(209 213 219 / var(--tw-text-opacity)); -} - -.text-black { - --tw-text-opacity: 1; - color: rgb(0 0 0 / var(--tw-text-opacity)); -} - -.text-gray-600 { - --tw-text-opacity: 1; - color: rgb(75 85 99 / var(--tw-text-opacity)); -} - -.opacity-0 { - opacity: 0; -} - -.opacity-100 { - opacity: 1; -} - -.shadow-lg { - --tw-shadow: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1); - --tw-shadow-colored: 0 10px 15px -3px var(--tw-shadow-color), 0 4px 6px -4px var(--tw-shadow-color); - box-shadow: var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow); -} - -.shadow { - --tw-shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1); - --tw-shadow-colored: 0 1px 3px 0 var(--tw-shadow-color), 0 1px 2px -1px var(--tw-shadow-color); - box-shadow: var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow); -} - -.shadow-sm { - --tw-shadow: 0 1px 2px 0 rgb(0 0 0 / 0.05); - --tw-shadow-colored: 0 1px 2px 0 var(--tw-shadow-color); - box-shadow: var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow); -} - -.ring-1 { - --tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color); - --tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color); - box-shadow: var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow, 0 0 #0000); -} - -.ring-inset { - --tw-ring-inset: inset; -} - -.ring-gray-300 { - --tw-ring-opacity: 1; - --tw-ring-color: rgb(209 213 219 / var(--tw-ring-opacity)); -} - -.ring-black { - --tw-ring-opacity: 1; - --tw-ring-color: rgb(0 0 0 / var(--tw-ring-opacity)); -} - -.ring-indigo-500 { - --tw-ring-opacity: 1; - --tw-ring-color: rgb(99 102 241 / var(--tw-ring-opacity)); -} - -.ring-opacity-5 { - --tw-ring-opacity: 0.05; -} - -.transition { - transition-property: color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, -webkit-backdrop-filter; - transition-property: color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, backdrop-filter; - transition-property: color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, backdrop-filter, -webkit-backdrop-filter; - transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1); - transition-duration: 150ms; -} - -.transition-opacity { - transition-property: opacity; - transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1); - transition-duration: 150ms; -} - -.duration-200 { - transition-duration: 200ms; -} - -.duration-75 { - transition-duration: 75ms; -} - -.duration-300 { - transition-duration: 300ms; -} - -.duration-100 { - transition-duration: 100ms; -} - -.ease-in { - transition-timing-function: cubic-bezier(0.4, 0, 1, 1); -} - -.ease-out { - transition-timing-function: cubic-bezier(0, 0, 0.2, 1); -} - -.ease-in-out { - transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1); -} - -.ease-linear { - transition-timing-function: linear; -} - -.placeholder\:text-gray-400::-moz-placeholder { - --tw-text-opacity: 1; - color: rgb(156 163 175 / var(--tw-text-opacity)); -} - -.placeholder\:text-gray-400::placeholder { - --tw-text-opacity: 1; - color: rgb(156 163 175 / var(--tw-text-opacity)); -} - -.hover\:border-gray-300:hover { - --tw-border-opacity: 1; - border-color: rgb(209 213 219 / var(--tw-border-opacity)); -} - -.hover\:bg-gray-50:hover { +.milkdown-theme-nord.prose :where(td, th):nth-child(odd) { --tw-bg-opacity: 1; background-color: rgb(249 250 251 / var(--tw-bg-opacity)); } - -.hover\:bg-indigo-500:hover { +:is(.dark .milkdown-theme-nord.prose :where(td, th):nth-child(odd)) { --tw-bg-opacity: 1; - background-color: rgb(99 102 241 / var(--tw-bg-opacity)); + background-color: rgb(17 24 39 / var(--tw-bg-opacity)); } - -.hover\:bg-pink-500:hover { - --tw-bg-opacity: 1; - background-color: rgb(236 72 153 / var(--tw-bg-opacity)); +.milkdown-theme-nord.prose.ProseMirror .selectedCell:after { + background-color: #88c0d04d; } - -.hover\:bg-orange-500:hover { - --tw-bg-opacity: 1; - background-color: rgb(249 115 22 / var(--tw-bg-opacity)); -} - -.hover\:bg-green-500:hover { - --tw-bg-opacity: 1; - background-color: rgb(34 197 94 / var(--tw-bg-opacity)); -} - -.hover\:bg-emerald-500:hover { - --tw-bg-opacity: 1; - background-color: rgb(16 185 129 / var(--tw-bg-opacity)); -} - -.hover\:bg-gray-100:hover { - --tw-bg-opacity: 1; - background-color: rgb(243 244 246 / var(--tw-bg-opacity)); -} - -.hover\:bg-indigo-700:hover { - --tw-bg-opacity: 1; - background-color: rgb(67 56 202 / var(--tw-bg-opacity)); -} - -.hover\:bg-purple-500:hover { - --tw-bg-opacity: 1; - background-color: rgb(168 85 247 / var(--tw-bg-opacity)); -} - -.hover\:bg-opacity-75:hover { - --tw-bg-opacity: 0.75; -} - -.hover\:text-indigo-500:hover { - --tw-text-opacity: 1; - color: rgb(99 102 241 / var(--tw-text-opacity)); -} - -.hover\:text-pink-500:hover { - --tw-text-opacity: 1; - color: rgb(236 72 153 / var(--tw-text-opacity)); -} - -.hover\:text-orange-500:hover { - --tw-text-opacity: 1; - color: rgb(249 115 22 / var(--tw-text-opacity)); -} - -.hover\:text-green-500:hover { - --tw-text-opacity: 1; - color: rgb(34 197 94 / var(--tw-text-opacity)); -} - -.hover\:text-emerald-500:hover { - --tw-text-opacity: 1; - color: rgb(16 185 129 / var(--tw-text-opacity)); -} - -.hover\:text-gray-500:hover { - --tw-text-opacity: 1; - color: rgb(107 114 128 / var(--tw-text-opacity)); -} - -.hover\:text-gray-700:hover { - --tw-text-opacity: 1; - color: rgb(55 65 81 / var(--tw-text-opacity)); -} - -.hover\:text-white:hover { - --tw-text-opacity: 1; - color: rgb(255 255 255 / var(--tw-text-opacity)); -} - -.focus\:outline-none:focus { - outline: 2px solid transparent; - outline-offset: 2px; -} - -.focus\:ring-2:focus { - --tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color); - --tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color); - box-shadow: var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow, 0 0 #0000); -} - -.focus\:ring-inset:focus { - --tw-ring-inset: inset; -} - -.focus\:ring-indigo-600:focus { - --tw-ring-opacity: 1; - --tw-ring-color: rgb(79 70 229 / var(--tw-ring-opacity)); -} - -.focus\:ring-pink-600:focus { - --tw-ring-opacity: 1; - --tw-ring-color: rgb(219 39 119 / var(--tw-ring-opacity)); -} - -.focus\:ring-orange-600:focus { - --tw-ring-opacity: 1; - --tw-ring-color: rgb(234 88 12 / var(--tw-ring-opacity)); -} - -.focus\:ring-green-600:focus { - --tw-ring-opacity: 1; - --tw-ring-color: rgb(22 163 74 / var(--tw-ring-opacity)); -} - -.focus\:ring-emerald-600:focus { - --tw-ring-opacity: 1; - --tw-ring-color: rgb(5 150 105 / var(--tw-ring-opacity)); -} - -.focus\:ring-indigo-500:focus { - --tw-ring-opacity: 1; - --tw-ring-color: rgb(99 102 241 / var(--tw-ring-opacity)); -} - -.focus\:ring-white:focus { - --tw-ring-opacity: 1; - --tw-ring-color: rgb(255 255 255 / var(--tw-ring-opacity)); -} - -.focus\:ring-offset-2:focus { - --tw-ring-offset-width: 2px; -} - -.focus\:ring-offset-indigo-600:focus { - --tw-ring-offset-color: #4f46e5; -} - -.focus\:ring-offset-purple-600:focus { - --tw-ring-offset-color: #9333ea; -} - -.focus\:ring-offset-emerald-600:focus { - --tw-ring-offset-color: #059669; -} - -.focus-visible\:outline:focus-visible { - outline-style: solid; -} - -.focus-visible\:outline-2:focus-visible { - outline-width: 2px; -} - -.focus-visible\:outline-offset-2:focus-visible { - outline-offset: 2px; -} - -.focus-visible\:outline-indigo-600:focus-visible { - outline-color: #4f46e5; -} - -.focus-visible\:outline-pink-600:focus-visible { - outline-color: #db2777; -} - -.focus-visible\:outline-orange-600:focus-visible { - outline-color: #ea580c; -} - -.focus-visible\:outline-green-600:focus-visible { - outline-color: #16a34a; -} - -.focus-visible\:outline-emerald-600:focus-visible { - outline-color: #059669; -} - -.focus-visible\:ring-transparent:focus-visible { - --tw-ring-color: transparent; -} - -.group:hover .group-hover\:text-white { - --tw-text-opacity: 1; - color: rgb(255 255 255 / var(--tw-text-opacity)); -} - -@media (min-width: 640px) { - .sm\:static { - position: static; - } - - .sm\:inset-auto { - inset: auto; - } - - .sm\:mx-auto { - margin-left: auto; - margin-right: auto; - } - - .sm\:ml-6 { - margin-left: 1.5rem; - } - - .sm\:flex { - display: flex; - } - - .sm\:hidden { - display: none; - } - - .sm\:w-full { - width: 100%; - } - - .sm\:max-w-\[480px\] { - max-width: 480px; - } - - .sm\:max-w-md { - max-width: 28rem; - } - - .sm\:items-stretch { - align-items: stretch; - } - - .sm\:justify-start { - justify-content: flex-start; - } - - .sm\:space-x-8 > :not([hidden]) ~ :not([hidden]) { - --tw-space-x-reverse: 0; - margin-right: calc(2rem * var(--tw-space-x-reverse)); - margin-left: calc(2rem * calc(1 - var(--tw-space-x-reverse))); - } - - .sm\:rounded-lg { - border-radius: 0.5rem; - } - - .sm\:px-12 { - padding-left: 3rem; - padding-right: 3rem; - } - - .sm\:px-6 { - padding-left: 1.5rem; - padding-right: 1.5rem; - } - - .sm\:px-3 { - padding-left: 0.75rem; - padding-right: 0.75rem; - } - - .sm\:pr-0 { - padding-right: 0px; - } - - .sm\:text-sm { - font-size: 0.875rem; - line-height: 1.25rem; - } - - .sm\:leading-6 { - line-height: 1.5rem; - } -} - -@media (min-width: 768px) { - .md\:ml-6 { - margin-left: 1.5rem; - } - - .md\:block { - display: block; - } - - .md\:hidden { - display: none; - } -} - -@media (min-width: 1024px) { - .lg\:fixed { - position: fixed; - } - - .lg\:inset-y-0 { - top: 0px; - bottom: 0px; - } - - .lg\:z-50 { - z-index: 50; - } - - .lg\:flex { - display: flex; - } - - .lg\:hidden { - display: none; - } - - .lg\:w-72 { - width: 18rem; - } - - .lg\:flex-col { - flex-direction: column; - } - - .lg\:px-8 { - padding-left: 2rem; - padding-right: 2rem; - } - - .lg\:pl-72 { - padding-left: 18rem; - } +.milkdown-theme-nord.prose br[data-is-inline=true], +.milkdown-theme-nord.prose br[data-is-inline=true]:after { + content: " "; } diff --git a/static/main.js b/static/main.js index 3744808..a0e49f3 100644 --- a/static/main.js +++ b/static/main.js @@ -1,46 +1,31852 @@ -let mobile_open_button = document.getElementById("mobile-menu-open-button"); -let mobile_close_button = document.getElementById("mobile-menu-close-button"); -let mobile_menu = document.getElementById("mobile-menu"); +(() => { + var __create = Object.create; + var __defProp = Object.defineProperty; + var __defProps = Object.defineProperties; + var __getOwnPropDesc = Object.getOwnPropertyDescriptor; + var __getOwnPropDescs = Object.getOwnPropertyDescriptors; + var __getOwnPropNames = Object.getOwnPropertyNames; + var __getOwnPropSymbols = Object.getOwnPropertySymbols; + var __getProtoOf = Object.getPrototypeOf; + var __hasOwnProp = Object.prototype.hasOwnProperty; + var __propIsEnum = Object.prototype.propertyIsEnumerable; + var __typeError = (msg) => { + throw TypeError(msg); + }; + var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value; + var __spreadValues = (a2, b4) => { + for (var prop in b4 || (b4 = {})) + if (__hasOwnProp.call(b4, prop)) + __defNormalProp(a2, prop, b4[prop]); + if (__getOwnPropSymbols) + for (var prop of __getOwnPropSymbols(b4)) { + if (__propIsEnum.call(b4, prop)) + __defNormalProp(a2, prop, b4[prop]); + } + return a2; + }; + var __spreadProps = (a2, b4) => __defProps(a2, __getOwnPropDescs(b4)); + var __objRest = (source, exclude) => { + var target = {}; + for (var prop in source) + if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0) + target[prop] = source[prop]; + if (source != null && __getOwnPropSymbols) + for (var prop of __getOwnPropSymbols(source)) { + if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop)) + target[prop] = source[prop]; + } + return target; + }; + var __commonJS = (cb, mod) => function __require() { + return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports; + }; + var __export = (target, all2) => { + for (var name in all2) + __defProp(target, name, { get: all2[name], enumerable: true }); + }; + var __copyProps = (to, from, except, desc) => { + if (from && typeof from === "object" || typeof from === "function") { + for (let key of __getOwnPropNames(from)) + if (!__hasOwnProp.call(to, key) && key !== except) + __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); + } + return to; + }; + var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps( + // If the importer is in node compatibility mode or this is not an ESM + // file that has been converted to a CommonJS file using a Babel- + // compatible transform (i.e. "__esModule" has not been set), then set + // "default" to the CommonJS "module.exports" for node compatibility. + isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, + mod + )); + var __accessCheck = (obj, member, msg) => member.has(obj) || __typeError("Cannot " + msg); + var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj)); + var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value); + var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "write to private field"), setter ? setter.call(obj, value) : member.set(obj, value), value); -const profile_button = document.getElementById("profile-menu-button"); -let profile_dropdown = document.getElementById("profile-dropdown"); + // node_modules/extend/index.js + var require_extend = __commonJS({ + "node_modules/extend/index.js"(exports, module) { + "use strict"; + var hasOwn = Object.prototype.hasOwnProperty; + var toStr = Object.prototype.toString; + var defineProperty = Object.defineProperty; + var gOPD = Object.getOwnPropertyDescriptor; + var isArray2 = function isArray3(arr) { + if (typeof Array.isArray === "function") { + return Array.isArray(arr); + } + return toStr.call(arr) === "[object Array]"; + }; + var isPlainObject2 = function isPlainObject3(obj) { + if (!obj || toStr.call(obj) !== "[object Object]") { + return false; + } + var hasOwnConstructor = hasOwn.call(obj, "constructor"); + var hasIsPrototypeOf = obj.constructor && obj.constructor.prototype && hasOwn.call(obj.constructor.prototype, "isPrototypeOf"); + if (obj.constructor && !hasOwnConstructor && !hasIsPrototypeOf) { + return false; + } + var key; + for (key in obj) { + } + return typeof key === "undefined" || hasOwn.call(obj, key); + }; + var setProperty2 = function setProperty3(target, options2) { + if (defineProperty && options2.name === "__proto__") { + defineProperty(target, options2.name, { + enumerable: true, + configurable: true, + value: options2.newValue, + writable: true + }); + } else { + target[options2.name] = options2.newValue; + } + }; + var getProperty = function getProperty2(obj, name) { + if (name === "__proto__") { + if (!hasOwn.call(obj, name)) { + return void 0; + } else if (gOPD) { + return gOPD(obj, name).value; + } + } + return obj[name]; + }; + module.exports = function extend2() { + var options2, name, src, copy2, copyIsArray, clone; + var target = arguments[0]; + var i2 = 1; + var length = arguments.length; + var deep = false; + if (typeof target === "boolean") { + deep = target; + target = arguments[1] || {}; + i2 = 2; + } + if (target == null || typeof target !== "object" && typeof target !== "function") { + target = {}; + } + for (; i2 < length; ++i2) { + options2 = arguments[i2]; + if (options2 != null) { + for (name in options2) { + src = getProperty(target, name); + copy2 = getProperty(options2, name); + if (target !== copy2) { + if (deep && copy2 && (isPlainObject2(copy2) || (copyIsArray = isArray2(copy2)))) { + if (copyIsArray) { + copyIsArray = false; + clone = src && isArray2(src) ? src : []; + } else { + clone = src && isPlainObject2(src) ? src : {}; + } + setProperty2(target, { name, newValue: extend2(deep, clone, copy2) }); + } else if (typeof copy2 !== "undefined") { + setProperty2(target, { name, newValue: copy2 }); + } + } + } + } + } + return target; + }; + } + }); -function toggle_mobile_menu() { + // node_modules/lodash.debounce/index.js + var require_lodash = __commonJS({ + "node_modules/lodash.debounce/index.js"(exports, module) { + var FUNC_ERROR_TEXT = "Expected a function"; + var NAN = 0 / 0; + var symbolTag = "[object Symbol]"; + var reTrim = /^\s+|\s+$/g; + var reIsBadHex = /^[-+]0x[0-9a-f]+$/i; + var reIsBinary = /^0b[01]+$/i; + var reIsOctal = /^0o[0-7]+$/i; + var freeParseInt = parseInt; + var freeGlobal = typeof global == "object" && global && global.Object === Object && global; + var freeSelf = typeof self == "object" && self && self.Object === Object && self; + var root2 = freeGlobal || freeSelf || Function("return this")(); + var objectProto = Object.prototype; + var objectToString = objectProto.toString; + var nativeMax = Math.max; + var nativeMin = Math.min; + var now = function() { + return root2.Date.now(); + }; + function debounce(func, wait, options2) { + var lastArgs, lastThis, maxWait, result, timerId, lastCallTime, lastInvokeTime = 0, leading = false, maxing = false, trailing = true; + if (typeof func != "function") { + throw new TypeError(FUNC_ERROR_TEXT); + } + wait = toNumber(wait) || 0; + if (isObject2(options2)) { + leading = !!options2.leading; + maxing = "maxWait" in options2; + maxWait = maxing ? nativeMax(toNumber(options2.maxWait) || 0, wait) : maxWait; + trailing = "trailing" in options2 ? !!options2.trailing : trailing; + } + function invokeFunc(time) { + var args = lastArgs, thisArg = lastThis; + lastArgs = lastThis = void 0; + lastInvokeTime = time; + result = func.apply(thisArg, args); + return result; + } + function leadingEdge(time) { + lastInvokeTime = time; + timerId = setTimeout(timerExpired, wait); + return leading ? invokeFunc(time) : result; + } + function remainingWait(time) { + var timeSinceLastCall = time - lastCallTime, timeSinceLastInvoke = time - lastInvokeTime, result2 = wait - timeSinceLastCall; + return maxing ? nativeMin(result2, maxWait - timeSinceLastInvoke) : result2; + } + function shouldInvoke(time) { + var timeSinceLastCall = time - lastCallTime, timeSinceLastInvoke = time - lastInvokeTime; + return lastCallTime === void 0 || timeSinceLastCall >= wait || timeSinceLastCall < 0 || maxing && timeSinceLastInvoke >= maxWait; + } + function timerExpired() { + var time = now(); + if (shouldInvoke(time)) { + return trailingEdge(time); + } + timerId = setTimeout(timerExpired, remainingWait(time)); + } + function trailingEdge(time) { + timerId = void 0; + if (trailing && lastArgs) { + return invokeFunc(time); + } + lastArgs = lastThis = void 0; + return result; + } + function cancel() { + if (timerId !== void 0) { + clearTimeout(timerId); + } + lastInvokeTime = 0; + lastArgs = lastCallTime = lastThis = timerId = void 0; + } + function flush() { + return timerId === void 0 ? result : trailingEdge(now()); + } + function debounced() { + var time = now(), isInvoking = shouldInvoke(time); + lastArgs = arguments; + lastThis = this; + lastCallTime = time; + if (isInvoking) { + if (timerId === void 0) { + return leadingEdge(lastCallTime); + } + if (maxing) { + timerId = setTimeout(timerExpired, wait); + return invokeFunc(lastCallTime); + } + } + if (timerId === void 0) { + timerId = setTimeout(timerExpired, wait); + } + return result; + } + debounced.cancel = cancel; + debounced.flush = flush; + return debounced; + } + function isObject2(value) { + var type = typeof value; + return !!value && (type == "object" || type == "function"); + } + function isObjectLike(value) { + return !!value && typeof value == "object"; + } + function isSymbol(value) { + return typeof value == "symbol" || isObjectLike(value) && objectToString.call(value) == symbolTag; + } + function toNumber(value) { + if (typeof value == "number") { + return value; + } + if (isSymbol(value)) { + return NAN; + } + if (isObject2(value)) { + var other = typeof value.valueOf == "function" ? value.valueOf() : value; + value = isObject2(other) ? other + "" : other; + } + if (typeof value != "string") { + return value === 0 ? value : +value; + } + value = value.replace(reTrim, ""); + var isBinary = reIsBinary.test(value); + return isBinary || reIsOctal.test(value) ? freeParseInt(value.slice(2), isBinary ? 2 : 8) : reIsBadHex.test(value) ? NAN : +value; + } + module.exports = debounce; + } + }); - if (mobile_open_button.classList.contains("block")) { - mobile_menu.classList.remove("hidden"); - mobile_open_button.classList.remove("block"); - mobile_open_button.classList.add("hidden"); - mobile_close_button.classList.remove("hidden"); - mobile_close_button.classList.add("block"); + // node_modules/@milkdown/exception/lib/index.es.js + var n = /* @__PURE__ */ ((e2) => (e2.docTypeError = "docTypeError", e2.contextNotFound = "contextNotFound", e2.timerNotFound = "timerNotFound", e2.ctxCallOutOfScope = "ctxCallOutOfScope", e2.createNodeInParserFail = "createNodeInParserFail", e2.stackOverFlow = "stackOverFlow", e2.parserMatchError = "parserMatchError", e2.serializerMatchError = "serializerMatchError", e2.getAtomFromSchemaFail = "getAtomFromSchemaFail", e2.expectDomTypeError = "expectDomTypeError", e2.callCommandBeforeEditorView = "callCommandBeforeEditorView", e2.missingRootElement = "missingRootElement", e2.missingNodeInSchema = "missingNodeInSchema", e2.missingMarkInSchema = "missingMarkInSchema", e2.ctxNotBind = "ctxNotBind", e2.missingYjsDoc = "missingYjsDoc", e2))(n || {}); + var t = class extends Error { + constructor(o2, a2) { + super(a2), this.name = "MilkdownError", this.code = o2; + } + }; + var u = (e2, o2) => typeof o2 == "function" ? "[Function]" : o2; + var i = (e2) => JSON.stringify(e2, u); + function l(e2) { + return new t(n.docTypeError, `Doc type error, unsupported type: ${i(e2)}`); + } + function d(e2) { + return new t(n.contextNotFound, `Context "${e2}" not found, do you forget to inject it?`); + } + function f(e2) { + return new t(n.timerNotFound, `Timer "${e2}" not found, do you forget to record it?`); + } + function p() { + return new t(n.ctxCallOutOfScope, "Should not call a context out of the plugin."); + } + function g(...e2) { + const o2 = e2.reduce((a2, c6) => { + if (!c6) + return a2; + const s2 = (r3) => Array.isArray(r3) ? r3.map((m3) => s2(m3)).join(", ") : r3.toJSON ? i(r3.toJSON()) : r3.spec ? i(r3.spec) : r3.toString(); + return `${a2}, ${s2(c6)}`; + }, "Create prosemirror node from remark failed in parser"); + return new t(n.createNodeInParserFail, o2); + } + function h() { + return new t(n.stackOverFlow, "Stack over flow, cannot pop on an empty stack."); + } + function w(e2) { + return new t(n.parserMatchError, `Cannot match target parser for node: ${i(e2)}.`); + } + function F(e2) { + return new t(n.serializerMatchError, `Cannot match target serializer for node: ${i(e2)}.`); + } + function S(e2) { + return new t(n.expectDomTypeError, `Expect to be a dom, but get: ${i(e2)}.`); + } + function y() { + return new t( + n.callCommandBeforeEditorView, + "You're trying to call a command before editor view initialized, make sure to get commandManager from ctx after editor view has been initialized" + ); + } + function M(e2) { + return new t( + n.missingNodeInSchema, + `Missing node in schema, milkdown cannot find "${e2}" in schema.` + ); + } + function x(e2) { + return new t( + n.missingMarkInSchema, + `Missing mark in schema, milkdown cannot find "${e2}" in schema.` + ); + } + + // node_modules/@milkdown/ctx/lib/index.es.js + var P = (o2, s2, i2) => { + if (!s2.has(o2)) + throw TypeError("Cannot " + i2); + }; + var e = (o2, s2, i2) => (P(o2, s2, "read from private field"), i2 ? i2.call(o2) : s2.get(o2)); + var a = (o2, s2, i2) => { + if (s2.has(o2)) + throw TypeError("Cannot add the same private member more than once"); + s2 instanceof WeakSet ? s2.add(o2) : s2.set(o2, i2); + }; + var n2 = (o2, s2, i2, r3) => (P(o2, s2, "write to private field"), r3 ? r3.call(o2, i2) : s2.set(o2, i2), i2); + var G = class { + constructor() { + this.sliceMap = /* @__PURE__ */ new Map(), this.get = (s2) => { + const i2 = typeof s2 == "string" ? [...this.sliceMap.values()].find((r3) => r3.type.name === s2) : this.sliceMap.get(s2.id); + if (!i2) { + const r3 = typeof s2 == "string" ? s2 : s2.name; + throw d(r3); + } + return i2; + }, this.remove = (s2) => { + const i2 = typeof s2 == "string" ? [...this.sliceMap.values()].find((r3) => r3.type.name === s2) : this.sliceMap.get(s2.id); + i2 && this.sliceMap.delete(i2.type.id); + }, this.has = (s2) => typeof s2 == "string" ? [...this.sliceMap.values()].some((i2) => i2.type.name === s2) : this.sliceMap.has(s2.id); + } + }; + var u2; + var m; + var y2; + var V = class { + /// @internal + constructor(s2, i2, r3) { + a(this, u2, void 0); + a(this, m, void 0); + a(this, y2, void 0); + n2(this, u2, []), n2(this, y2, () => { + e(this, u2).forEach((t2) => t2(e(this, m))); + }), this.set = (t2) => { + n2(this, m, t2), e(this, y2).call(this); + }, this.get = () => e(this, m), this.update = (t2) => { + n2(this, m, t2(e(this, m))), e(this, y2).call(this); + }, this.type = r3, n2(this, m, i2), s2.set(r3.id, this); + } + /// Add a watcher for changes in the slice. + /// Returns a function to remove the watcher. + on(s2) { + return e(this, u2).push(s2), () => { + n2(this, u2, e(this, u2).filter((i2) => i2 !== s2)); + }; + } + /// Add a one-time watcher for changes in the slice. + /// The watcher will be removed after it is called. + /// Returns a function to remove the watcher. + once(s2) { + const i2 = this.on((r3) => { + s2(r3), i2(); + }); + return i2; + } + /// Remove a watcher. + off(s2) { + n2(this, u2, e(this, u2).filter((i2) => i2 !== s2)); + } + /// Remove all watchers. + offAll() { + n2(this, u2, []); + } + }; + u2 = /* @__PURE__ */ new WeakMap(), m = /* @__PURE__ */ new WeakMap(), y2 = /* @__PURE__ */ new WeakMap(); + var W = class { + /// Create a slice type with a default value and a name. + /// The name should be unique in the container. + constructor(s2, i2) { + this.id = Symbol(`Context-${i2}`), this.name = i2, this._defaultValue = s2, this._typeInfo = () => { + throw p(); + }; + } + /// Create a slice with a container. + /// You can also pass a value to override the default value. + create(s2, i2 = this._defaultValue) { + return new V(s2, i2, this); + } + }; + var H = (o2, s2) => new W(o2, s2); + var D; + var x2; + var R; + var w2; + var S2; + var f2; + var M2; + var T; + var j; + var _ = class { + /// Create an inspector with container, clock and metadata. + constructor(s2, i2, r3) { + a(this, D, void 0); + a(this, x2, void 0); + a(this, R, void 0); + a(this, w2, void 0); + a(this, S2, void 0); + a(this, f2, void 0); + a(this, M2, void 0); + a(this, T, void 0); + a(this, j, void 0); + n2(this, w2, /* @__PURE__ */ new Set()), n2(this, S2, /* @__PURE__ */ new Set()), n2(this, f2, /* @__PURE__ */ new Map()), n2(this, M2, /* @__PURE__ */ new Map()), this.read = () => ({ + metadata: e(this, D), + injectedSlices: [...e(this, w2)].map((t2) => ({ + name: typeof t2 == "string" ? t2 : t2.name, + value: e(this, T).call(this, t2) + })), + consumedSlices: [...e(this, S2)].map((t2) => ({ + name: typeof t2 == "string" ? t2 : t2.name, + value: e(this, T).call(this, t2) + })), + recordedTimers: [...e(this, f2)].map(([t2, { duration: h5 }]) => ({ + name: t2.name, + duration: h5, + status: e(this, j).call(this, t2) + })), + waitTimers: [...e(this, M2)].map(([t2, { duration: h5 }]) => ({ + name: t2.name, + duration: h5, + status: e(this, j).call(this, t2) + })) + }), this.onRecord = (t2) => { + e(this, f2).set(t2, { start: Date.now(), duration: 0 }); + }, this.onClear = (t2) => { + e(this, f2).delete(t2); + }, this.onDone = (t2) => { + const h5 = e(this, f2).get(t2); + h5 && (h5.duration = Date.now() - h5.start); + }, this.onWait = (t2, h5) => { + const v4 = Date.now(); + h5.finally(() => { + e(this, M2).set(t2, { duration: Date.now() - v4 }); + }); + }, this.onInject = (t2) => { + e(this, w2).add(t2); + }, this.onRemove = (t2) => { + e(this, w2).delete(t2); + }, this.onUse = (t2) => { + e(this, S2).add(t2); + }, n2(this, T, (t2) => e(this, x2).get(t2).get()), n2(this, j, (t2) => e(this, R).get(t2).status), n2(this, x2, s2), n2(this, R, i2), n2(this, D, r3); + } + }; + D = /* @__PURE__ */ new WeakMap(), x2 = /* @__PURE__ */ new WeakMap(), R = /* @__PURE__ */ new WeakMap(), w2 = /* @__PURE__ */ new WeakMap(), S2 = /* @__PURE__ */ new WeakMap(), f2 = /* @__PURE__ */ new WeakMap(), M2 = /* @__PURE__ */ new WeakMap(), T = /* @__PURE__ */ new WeakMap(), j = /* @__PURE__ */ new WeakMap(); + var d2; + var l2; + var b; + var c; + var L = class L2 { + /// Create a ctx object with container and clock. + constructor(s2, i2, r3) { + a(this, d2, void 0); + a(this, l2, void 0); + a(this, b, void 0); + a(this, c, void 0); + this.produce = (t2) => t2 && Object.keys(t2).length ? new L2(e(this, d2), e(this, l2), __spreadValues({}, t2)) : this, this.inject = (t2, h5) => { + var O4; + const v4 = t2.create(e(this, d2).sliceMap); + return h5 != null && v4.set(h5), (O4 = e(this, c)) == null || O4.onInject(t2), this; + }, this.remove = (t2) => { + var h5; + return e(this, d2).remove(t2), (h5 = e(this, c)) == null || h5.onRemove(t2), this; + }, this.record = (t2) => { + var h5; + return t2.create(e(this, l2).store), (h5 = e(this, c)) == null || h5.onRecord(t2), this; + }, this.clearTimer = (t2) => { + var h5; + return e(this, l2).remove(t2), (h5 = e(this, c)) == null || h5.onClear(t2), this; + }, this.isInjected = (t2) => e(this, d2).has(t2), this.isRecorded = (t2) => e(this, l2).has(t2), this.use = (t2) => { + var h5; + return (h5 = e(this, c)) == null || h5.onUse(t2), e(this, d2).get(t2); + }, this.get = (t2) => this.use(t2).get(), this.set = (t2, h5) => this.use(t2).set(h5), this.update = (t2, h5) => this.use(t2).update(h5), this.timer = (t2) => e(this, l2).get(t2), this.done = (t2) => { + var h5; + this.timer(t2).done(), (h5 = e(this, c)) == null || h5.onDone(t2); + }, this.wait = (t2) => { + var v4; + const h5 = this.timer(t2).start(); + return (v4 = e(this, c)) == null || v4.onWait(t2, h5), h5; + }, this.waitTimers = async (t2) => { + await Promise.all(this.get(t2).map((h5) => this.wait(h5))); + }, n2(this, d2, s2), n2(this, l2, i2), n2(this, b, r3), r3 && n2(this, c, new _(s2, i2, r3)); + } + /// Get metadata of the ctx. + get meta() { + return e(this, b); + } + /// Get the inspector of the ctx. + get inspector() { + return e(this, c); + } + }; + d2 = /* @__PURE__ */ new WeakMap(), l2 = /* @__PURE__ */ new WeakMap(), b = /* @__PURE__ */ new WeakMap(), c = /* @__PURE__ */ new WeakMap(); + var U = L; + var J = class { + constructor() { + this.store = /* @__PURE__ */ new Map(), this.get = (s2) => { + const i2 = this.store.get(s2.id); + if (!i2) + throw f(s2.name); + return i2; + }, this.remove = (s2) => { + this.store.delete(s2.id); + }, this.has = (s2) => this.store.has(s2.id); + } + }; + var C; + var g2; + var E; + var p2; + var I; + var k; + var q = class { + /// @internal + constructor(s2, i2) { + a(this, C, void 0); + a(this, g2, void 0); + a(this, E, void 0); + a(this, p2, void 0); + a(this, I, void 0); + a(this, k, void 0); + n2(this, C, null), n2(this, g2, null), n2(this, p2, "pending"), this.start = () => { + var _a; + return (_a = e(this, C)) != null ? _a : n2(this, C, new Promise((r3, t2) => { + n2(this, g2, (h5) => { + h5 instanceof CustomEvent && h5.detail.id === e(this, E) && (n2(this, p2, "resolved"), e(this, I).call(this), h5.stopImmediatePropagation(), r3()); + }), e(this, k).call(this, () => { + e(this, p2) === "pending" && n2(this, p2, "rejected"), e(this, I).call(this), t2(new Error(`Timing ${this.type.name} timeout.`)); + }), n2(this, p2, "pending"), addEventListener(this.type.name, e(this, g2)); + })), e(this, C); + }, this.done = () => { + const r3 = new CustomEvent(this.type.name, { detail: { id: e(this, E) } }); + dispatchEvent(r3); + }, n2(this, I, () => { + e(this, g2) && removeEventListener(this.type.name, e(this, g2)); + }), n2(this, k, (r3) => { + setTimeout(() => { + r3(); + }, this.type.timeout); + }), n2(this, E, Symbol(i2.name)), this.type = i2, s2.set(i2.id, this); + } + /// The status of the timer. + /// Can be `pending`, `resolved` or `rejected`. + get status() { + return e(this, p2); + } + }; + C = /* @__PURE__ */ new WeakMap(), g2 = /* @__PURE__ */ new WeakMap(), E = /* @__PURE__ */ new WeakMap(), p2 = /* @__PURE__ */ new WeakMap(), I = /* @__PURE__ */ new WeakMap(), k = /* @__PURE__ */ new WeakMap(); + var A = class { + /// Create a timer type with a name and a timeout. + /// The name should be unique in the clock. + constructor(s2, i2 = 3e3) { + this.create = (r3) => new q(r3, this), this.id = Symbol(`Timer-${s2}`), this.name = s2, this.timeout = i2; + } + }; + var K = (o2, s2 = 3e3) => new A(o2, s2); + + // node_modules/orderedmap/dist/index.js + function OrderedMap(content3) { + this.content = content3; + } + OrderedMap.prototype = { + constructor: OrderedMap, + find: function(key) { + for (var i2 = 0; i2 < this.content.length; i2 += 2) + if (this.content[i2] === key) return i2; + return -1; + }, + // :: (string) → ?any + // Retrieve the value stored under `key`, or return undefined when + // no such key exists. + get: function(key) { + var found2 = this.find(key); + return found2 == -1 ? void 0 : this.content[found2 + 1]; + }, + // :: (string, any, ?string) → OrderedMap + // Create a new map by replacing the value of `key` with a new + // value, or adding a binding to the end of the map. If `newKey` is + // given, the key of the binding will be replaced with that key. + update: function(key, value, newKey) { + var self2 = newKey && newKey != key ? this.remove(newKey) : this; + var found2 = self2.find(key), content3 = self2.content.slice(); + if (found2 == -1) { + content3.push(newKey || key, value); + } else { + content3[found2 + 1] = value; + if (newKey) content3[found2] = newKey; + } + return new OrderedMap(content3); + }, + // :: (string) → OrderedMap + // Return a map with the given key removed, if it existed. + remove: function(key) { + var found2 = this.find(key); + if (found2 == -1) return this; + var content3 = this.content.slice(); + content3.splice(found2, 2); + return new OrderedMap(content3); + }, + // :: (string, any) → OrderedMap + // Add a new key to the start of the map. + addToStart: function(key, value) { + return new OrderedMap([key, value].concat(this.remove(key).content)); + }, + // :: (string, any) → OrderedMap + // Add a new key to the end of the map. + addToEnd: function(key, value) { + var content3 = this.remove(key).content.slice(); + content3.push(key, value); + return new OrderedMap(content3); + }, + // :: (string, string, any) → OrderedMap + // Add a key after the given key. If `place` is not found, the new + // key is added to the end. + addBefore: function(place, key, value) { + var without = this.remove(key), content3 = without.content.slice(); + var found2 = without.find(place); + content3.splice(found2 == -1 ? content3.length : found2, 0, key, value); + return new OrderedMap(content3); + }, + // :: ((key: string, value: any)) + // Call the given function for each key/value pair in the map, in + // order. + forEach: function(f3) { + for (var i2 = 0; i2 < this.content.length; i2 += 2) + f3(this.content[i2], this.content[i2 + 1]); + }, + // :: (union) → OrderedMap + // Create a new map by prepending the keys in this map that don't + // appear in `map` before the keys in `map`. + prepend: function(map5) { + map5 = OrderedMap.from(map5); + if (!map5.size) return this; + return new OrderedMap(map5.content.concat(this.subtract(map5).content)); + }, + // :: (union) → OrderedMap + // Create a new map by appending the keys in this map that don't + // appear in `map` after the keys in `map`. + append: function(map5) { + map5 = OrderedMap.from(map5); + if (!map5.size) return this; + return new OrderedMap(this.subtract(map5).content.concat(map5.content)); + }, + // :: (union) → OrderedMap + // Create a map containing all the keys in this map that don't + // appear in `map`. + subtract: function(map5) { + var result = this; + map5 = OrderedMap.from(map5); + for (var i2 = 0; i2 < map5.content.length; i2 += 2) + result = result.remove(map5.content[i2]); + return result; + }, + // :: () → Object + // Turn ordered map into a plain object. + toObject: function() { + var result = {}; + this.forEach(function(key, value) { + result[key] = value; + }); + return result; + }, + // :: number + // The amount of keys in this map. + get size() { + return this.content.length >> 1; + } + }; + OrderedMap.from = function(value) { + if (value instanceof OrderedMap) return value; + var content3 = []; + if (value) for (var prop in value) content3.push(prop, value[prop]); + return new OrderedMap(content3); + }; + var dist_default = OrderedMap; + + // node_modules/prosemirror-model/dist/index.js + function findDiffStart(a2, b4, pos) { + for (let i2 = 0; ; i2++) { + if (i2 == a2.childCount || i2 == b4.childCount) + return a2.childCount == b4.childCount ? null : pos; + let childA = a2.child(i2), childB = b4.child(i2); + if (childA == childB) { + pos += childA.nodeSize; + continue; + } + if (!childA.sameMarkup(childB)) + return pos; + if (childA.isText && childA.text != childB.text) { + for (let j6 = 0; childA.text[j6] == childB.text[j6]; j6++) + pos++; + return pos; + } + if (childA.content.size || childB.content.size) { + let inner = findDiffStart(childA.content, childB.content, pos + 1); + if (inner != null) + return inner; + } + pos += childA.nodeSize; + } + } + function findDiffEnd(a2, b4, posA, posB) { + for (let iA = a2.childCount, iB = b4.childCount; ; ) { + if (iA == 0 || iB == 0) + return iA == iB ? null : { a: posA, b: posB }; + let childA = a2.child(--iA), childB = b4.child(--iB), size = childA.nodeSize; + if (childA == childB) { + posA -= size; + posB -= size; + continue; + } + if (!childA.sameMarkup(childB)) + return { a: posA, b: posB }; + if (childA.isText && childA.text != childB.text) { + let same = 0, minSize = Math.min(childA.text.length, childB.text.length); + while (same < minSize && childA.text[childA.text.length - same - 1] == childB.text[childB.text.length - same - 1]) { + same++; + posA--; + posB--; + } + return { a: posA, b: posB }; + } + if (childA.content.size || childB.content.size) { + let inner = findDiffEnd(childA.content, childB.content, posA - 1, posB - 1); + if (inner) + return inner; + } + posA -= size; + posB -= size; + } + } + var Fragment = class _Fragment { + /** + @internal + */ + constructor(content3, size) { + this.content = content3; + this.size = size || 0; + if (size == null) + for (let i2 = 0; i2 < content3.length; i2++) + this.size += content3[i2].nodeSize; + } + /** + Invoke a callback for all descendant nodes between the given two + positions (relative to start of this fragment). Doesn't descend + into a node when the callback returns `false`. + */ + nodesBetween(from, to, f3, nodeStart = 0, parent) { + for (let i2 = 0, pos = 0; pos < to; i2++) { + let child = this.content[i2], end = pos + child.nodeSize; + if (end > from && f3(child, nodeStart + pos, parent || null, i2) !== false && child.content.size) { + let start = pos + 1; + child.nodesBetween(Math.max(0, from - start), Math.min(child.content.size, to - start), f3, nodeStart + start); + } + pos = end; + } + } + /** + Call the given callback for every descendant node. `pos` will be + relative to the start of the fragment. The callback may return + `false` to prevent traversal of a given node's children. + */ + descendants(f3) { + this.nodesBetween(0, this.size, f3); + } + /** + Extract the text between `from` and `to`. See the same method on + [`Node`](https://prosemirror.net/docs/ref/#model.Node.textBetween). + */ + textBetween(from, to, blockSeparator, leafText) { + let text5 = "", first = true; + this.nodesBetween(from, to, (node2, pos) => { + let nodeText = node2.isText ? node2.text.slice(Math.max(from, pos) - pos, to - pos) : !node2.isLeaf ? "" : leafText ? typeof leafText === "function" ? leafText(node2) : leafText : node2.type.spec.leafText ? node2.type.spec.leafText(node2) : ""; + if (node2.isBlock && (node2.isLeaf && nodeText || node2.isTextblock) && blockSeparator) { + if (first) + first = false; + else + text5 += blockSeparator; + } + text5 += nodeText; + }, 0); + return text5; + } + /** + Create a new fragment containing the combined content of this + fragment and the other. + */ + append(other) { + if (!other.size) + return this; + if (!this.size) + return other; + let last = this.lastChild, first = other.firstChild, content3 = this.content.slice(), i2 = 0; + if (last.isText && last.sameMarkup(first)) { + content3[content3.length - 1] = last.withText(last.text + first.text); + i2 = 1; + } + for (; i2 < other.content.length; i2++) + content3.push(other.content[i2]); + return new _Fragment(content3, this.size + other.size); + } + /** + Cut out the sub-fragment between the two given positions. + */ + cut(from, to = this.size) { + if (from == 0 && to == this.size) + return this; + let result = [], size = 0; + if (to > from) + for (let i2 = 0, pos = 0; pos < to; i2++) { + let child = this.content[i2], end = pos + child.nodeSize; + if (end > from) { + if (pos < from || end > to) { + if (child.isText) + child = child.cut(Math.max(0, from - pos), Math.min(child.text.length, to - pos)); + else + child = child.cut(Math.max(0, from - pos - 1), Math.min(child.content.size, to - pos - 1)); + } + result.push(child); + size += child.nodeSize; + } + pos = end; + } + return new _Fragment(result, size); + } + /** + @internal + */ + cutByIndex(from, to) { + if (from == to) + return _Fragment.empty; + if (from == 0 && to == this.content.length) + return this; + return new _Fragment(this.content.slice(from, to)); + } + /** + Create a new fragment in which the node at the given index is + replaced by the given node. + */ + replaceChild(index2, node2) { + let current = this.content[index2]; + if (current == node2) + return this; + let copy2 = this.content.slice(); + let size = this.size + node2.nodeSize - current.nodeSize; + copy2[index2] = node2; + return new _Fragment(copy2, size); + } + /** + Create a new fragment by prepending the given node to this + fragment. + */ + addToStart(node2) { + return new _Fragment([node2].concat(this.content), this.size + node2.nodeSize); + } + /** + Create a new fragment by appending the given node to this + fragment. + */ + addToEnd(node2) { + return new _Fragment(this.content.concat(node2), this.size + node2.nodeSize); + } + /** + Compare this fragment to another one. + */ + eq(other) { + if (this.content.length != other.content.length) + return false; + for (let i2 = 0; i2 < this.content.length; i2++) + if (!this.content[i2].eq(other.content[i2])) + return false; + return true; + } + /** + The first child of the fragment, or `null` if it is empty. + */ + get firstChild() { + return this.content.length ? this.content[0] : null; + } + /** + The last child of the fragment, or `null` if it is empty. + */ + get lastChild() { + return this.content.length ? this.content[this.content.length - 1] : null; + } + /** + The number of child nodes in this fragment. + */ + get childCount() { + return this.content.length; + } + /** + Get the child node at the given index. Raise an error when the + index is out of range. + */ + child(index2) { + let found2 = this.content[index2]; + if (!found2) + throw new RangeError("Index " + index2 + " out of range for " + this); + return found2; + } + /** + Get the child node at the given index, if it exists. + */ + maybeChild(index2) { + return this.content[index2] || null; + } + /** + Call `f` for every child node, passing the node, its offset + into this parent node, and its index. + */ + forEach(f3) { + for (let i2 = 0, p4 = 0; i2 < this.content.length; i2++) { + let child = this.content[i2]; + f3(child, p4, i2); + p4 += child.nodeSize; + } + } + /** + Find the first position at which this fragment and another + fragment differ, or `null` if they are the same. + */ + findDiffStart(other, pos = 0) { + return findDiffStart(this, other, pos); + } + /** + Find the first position, searching from the end, at which this + fragment and the given fragment differ, or `null` if they are + the same. Since this position will not be the same in both + nodes, an object with two separate positions is returned. + */ + findDiffEnd(other, pos = this.size, otherPos = other.size) { + return findDiffEnd(this, other, pos, otherPos); + } + /** + Find the index and inner offset corresponding to a given relative + position in this fragment. The result object will be reused + (overwritten) the next time the function is called. (Not public.) + */ + findIndex(pos, round = -1) { + if (pos == 0) + return retIndex(0, pos); + if (pos == this.size) + return retIndex(this.content.length, pos); + if (pos > this.size || pos < 0) + throw new RangeError(`Position ${pos} outside of fragment (${this})`); + for (let i2 = 0, curPos = 0; ; i2++) { + let cur = this.child(i2), end = curPos + cur.nodeSize; + if (end >= pos) { + if (end == pos || round > 0) + return retIndex(i2 + 1, end); + return retIndex(i2, curPos); + } + curPos = end; + } + } + /** + Return a debugging string that describes this fragment. + */ + toString() { + return "<" + this.toStringInner() + ">"; + } + /** + @internal + */ + toStringInner() { + return this.content.join(", "); + } + /** + Create a JSON-serializeable representation of this fragment. + */ + toJSON() { + return this.content.length ? this.content.map((n4) => n4.toJSON()) : null; + } + /** + Deserialize a fragment from its JSON representation. + */ + static fromJSON(schema, value) { + if (!value) + return _Fragment.empty; + if (!Array.isArray(value)) + throw new RangeError("Invalid input for Fragment.fromJSON"); + return new _Fragment(value.map(schema.nodeFromJSON)); + } + /** + Build a fragment from an array of nodes. Ensures that adjacent + text nodes with the same marks are joined together. + */ + static fromArray(array) { + if (!array.length) + return _Fragment.empty; + let joined, size = 0; + for (let i2 = 0; i2 < array.length; i2++) { + let node2 = array[i2]; + size += node2.nodeSize; + if (i2 && node2.isText && array[i2 - 1].sameMarkup(node2)) { + if (!joined) + joined = array.slice(0, i2); + joined[joined.length - 1] = node2.withText(joined[joined.length - 1].text + node2.text); + } else if (joined) { + joined.push(node2); + } + } + return new _Fragment(joined || array, size); + } + /** + Create a fragment from something that can be interpreted as a + set of nodes. For `null`, it returns the empty fragment. For a + fragment, the fragment itself. For a node or array of nodes, a + fragment containing those nodes. + */ + static from(nodes) { + if (!nodes) + return _Fragment.empty; + if (nodes instanceof _Fragment) + return nodes; + if (Array.isArray(nodes)) + return this.fromArray(nodes); + if (nodes.attrs) + return new _Fragment([nodes], nodes.nodeSize); + throw new RangeError("Can not convert " + nodes + " to a Fragment" + (nodes.nodesBetween ? " (looks like multiple versions of prosemirror-model were loaded)" : "")); + } + }; + Fragment.empty = new Fragment([], 0); + var found = { index: 0, offset: 0 }; + function retIndex(index2, offset) { + found.index = index2; + found.offset = offset; + return found; + } + function compareDeep(a2, b4) { + if (a2 === b4) + return true; + if (!(a2 && typeof a2 == "object") || !(b4 && typeof b4 == "object")) + return false; + let array = Array.isArray(a2); + if (Array.isArray(b4) != array) + return false; + if (array) { + if (a2.length != b4.length) + return false; + for (let i2 = 0; i2 < a2.length; i2++) + if (!compareDeep(a2[i2], b4[i2])) + return false; } else { - mobile_menu.classList.add("hidden"); - mobile_close_button.classList.remove("block"); - mobile_close_button.classList.add("hidden"); - mobile_open_button.classList.remove("hidden"); - mobile_open_button.classList.add("block"); + for (let p4 in a2) + if (!(p4 in b4) || !compareDeep(a2[p4], b4[p4])) + return false; + for (let p4 in b4) + if (!(p4 in a2)) + return false; } -} - -function toggle_profile_dropdown() { - - if (profile_dropdown.classList.contains("hidden")) { - profile_dropdown.classList.remove("hidden"); + return true; + } + var Mark = class _Mark { + /** + @internal + */ + constructor(type, attrs) { + this.type = type; + this.attrs = attrs; + } + /** + Given a set of marks, create a new set which contains this one as + well, in the right position. If this mark is already in the set, + the set itself is returned. If any marks that are set to be + [exclusive](https://prosemirror.net/docs/ref/#model.MarkSpec.excludes) with this mark are present, + those are replaced by this one. + */ + addToSet(set) { + let copy2, placed = false; + for (let i2 = 0; i2 < set.length; i2++) { + let other = set[i2]; + if (this.eq(other)) + return set; + if (this.type.excludes(other.type)) { + if (!copy2) + copy2 = set.slice(0, i2); + } else if (other.type.excludes(this.type)) { + return set; + } else { + if (!placed && other.type.rank > this.type.rank) { + if (!copy2) + copy2 = set.slice(0, i2); + copy2.push(this); + placed = true; + } + if (copy2) + copy2.push(other); + } + } + if (!copy2) + copy2 = set.slice(); + if (!placed) + copy2.push(this); + return copy2; + } + /** + Remove this mark from the given set, returning a new set. If this + mark is not in the set, the set itself is returned. + */ + removeFromSet(set) { + for (let i2 = 0; i2 < set.length; i2++) + if (this.eq(set[i2])) + return set.slice(0, i2).concat(set.slice(i2 + 1)); + return set; + } + /** + Test whether this mark is in the given set of marks. + */ + isInSet(set) { + for (let i2 = 0; i2 < set.length; i2++) + if (this.eq(set[i2])) + return true; + return false; + } + /** + Test whether this mark has the same type and attributes as + another mark. + */ + eq(other) { + return this == other || this.type == other.type && compareDeep(this.attrs, other.attrs); + } + /** + Convert this mark to a JSON-serializeable representation. + */ + toJSON() { + let obj = { type: this.type.name }; + for (let _3 in this.attrs) { + obj.attrs = this.attrs; + break; + } + return obj; + } + /** + Deserialize a mark from JSON. + */ + static fromJSON(schema, json) { + if (!json) + throw new RangeError("Invalid input for Mark.fromJSON"); + let type = schema.marks[json.type]; + if (!type) + throw new RangeError(`There is no mark type ${json.type} in this schema`); + return type.create(json.attrs); + } + /** + Test whether two sets of marks are identical. + */ + static sameSet(a2, b4) { + if (a2 == b4) + return true; + if (a2.length != b4.length) + return false; + for (let i2 = 0; i2 < a2.length; i2++) + if (!a2[i2].eq(b4[i2])) + return false; + return true; + } + /** + Create a properly sorted mark set from null, a single mark, or an + unsorted array of marks. + */ + static setFrom(marks) { + if (!marks || Array.isArray(marks) && marks.length == 0) + return _Mark.none; + if (marks instanceof _Mark) + return [marks]; + let copy2 = marks.slice(); + copy2.sort((a2, b4) => a2.type.rank - b4.type.rank); + return copy2; + } + }; + Mark.none = []; + var ReplaceError = class extends Error { + }; + var Slice = class _Slice { + /** + Create a slice. When specifying a non-zero open depth, you must + make sure that there are nodes of at least that depth at the + appropriate side of the fragment—i.e. if the fragment is an + empty paragraph node, `openStart` and `openEnd` can't be greater + than 1. + + It is not necessary for the content of open nodes to conform to + the schema's content constraints, though it should be a valid + start/end/middle for such a node, depending on which sides are + open. + */ + constructor(content3, openStart, openEnd) { + this.content = content3; + this.openStart = openStart; + this.openEnd = openEnd; + } + /** + The size this slice would add when inserted into a document. + */ + get size() { + return this.content.size - this.openStart - this.openEnd; + } + /** + @internal + */ + insertAt(pos, fragment) { + let content3 = insertInto(this.content, pos + this.openStart, fragment); + return content3 && new _Slice(content3, this.openStart, this.openEnd); + } + /** + @internal + */ + removeBetween(from, to) { + return new _Slice(removeRange(this.content, from + this.openStart, to + this.openStart), this.openStart, this.openEnd); + } + /** + Tests whether this slice is equal to another slice. + */ + eq(other) { + return this.content.eq(other.content) && this.openStart == other.openStart && this.openEnd == other.openEnd; + } + /** + @internal + */ + toString() { + return this.content + "(" + this.openStart + "," + this.openEnd + ")"; + } + /** + Convert a slice to a JSON-serializable representation. + */ + toJSON() { + if (!this.content.size) + return null; + let json = { content: this.content.toJSON() }; + if (this.openStart > 0) + json.openStart = this.openStart; + if (this.openEnd > 0) + json.openEnd = this.openEnd; + return json; + } + /** + Deserialize a slice from its JSON representation. + */ + static fromJSON(schema, json) { + if (!json) + return _Slice.empty; + let openStart = json.openStart || 0, openEnd = json.openEnd || 0; + if (typeof openStart != "number" || typeof openEnd != "number") + throw new RangeError("Invalid input for Slice.fromJSON"); + return new _Slice(Fragment.fromJSON(schema, json.content), openStart, openEnd); + } + /** + Create a slice from a fragment by taking the maximum possible + open value on both side of the fragment. + */ + static maxOpen(fragment, openIsolating = true) { + let openStart = 0, openEnd = 0; + for (let n4 = fragment.firstChild; n4 && !n4.isLeaf && (openIsolating || !n4.type.spec.isolating); n4 = n4.firstChild) + openStart++; + for (let n4 = fragment.lastChild; n4 && !n4.isLeaf && (openIsolating || !n4.type.spec.isolating); n4 = n4.lastChild) + openEnd++; + return new _Slice(fragment, openStart, openEnd); + } + }; + Slice.empty = new Slice(Fragment.empty, 0, 0); + function removeRange(content3, from, to) { + let { index: index2, offset } = content3.findIndex(from), child = content3.maybeChild(index2); + let { index: indexTo, offset: offsetTo } = content3.findIndex(to); + if (offset == from || child.isText) { + if (offsetTo != to && !content3.child(indexTo).isText) + throw new RangeError("Removing non-flat range"); + return content3.cut(0, from).append(content3.cut(to)); + } + if (index2 != indexTo) + throw new RangeError("Removing non-flat range"); + return content3.replaceChild(index2, child.copy(removeRange(child.content, from - offset - 1, to - offset - 1))); + } + function insertInto(content3, dist, insert, parent) { + let { index: index2, offset } = content3.findIndex(dist), child = content3.maybeChild(index2); + if (offset == dist || child.isText) { + if (parent && !parent.canReplace(index2, index2, insert)) + return null; + return content3.cut(0, dist).append(insert).append(content3.cut(dist)); + } + let inner = insertInto(child.content, dist - offset - 1, insert); + return inner && content3.replaceChild(index2, child.copy(inner)); + } + function replace($from, $to, slice) { + if (slice.openStart > $from.depth) + throw new ReplaceError("Inserted content deeper than insertion position"); + if ($from.depth - slice.openStart != $to.depth - slice.openEnd) + throw new ReplaceError("Inconsistent open depths"); + return replaceOuter($from, $to, slice, 0); + } + function replaceOuter($from, $to, slice, depth) { + let index2 = $from.index(depth), node2 = $from.node(depth); + if (index2 == $to.index(depth) && depth < $from.depth - slice.openStart) { + let inner = replaceOuter($from, $to, slice, depth + 1); + return node2.copy(node2.content.replaceChild(index2, inner)); + } else if (!slice.content.size) { + return close(node2, replaceTwoWay($from, $to, depth)); + } else if (!slice.openStart && !slice.openEnd && $from.depth == depth && $to.depth == depth) { + let parent = $from.parent, content3 = parent.content; + return close(parent, content3.cut(0, $from.parentOffset).append(slice.content).append(content3.cut($to.parentOffset))); } else { - profile_dropdown.classList.add("hidden"); + let { start, end } = prepareSliceForReplace(slice, $from); + return close(node2, replaceThreeWay($from, start, end, $to, depth)); } -} - -function hide_profile_dropdown() { - let profile_dropdown = document.getElementById("profile-dropdown"); - - if (!profile_dropdown.classList.contains("hidden")) { - profile_dropdown.classList.add("hidden"); + } + function checkJoin(main, sub) { + if (!sub.type.compatibleContent(main.type)) + throw new ReplaceError("Cannot join " + sub.type.name + " onto " + main.type.name); + } + function joinable($before, $after, depth) { + let node2 = $before.node(depth); + checkJoin(node2, $after.node(depth)); + return node2; + } + function addNode(child, target) { + let last = target.length - 1; + if (last >= 0 && child.isText && child.sameMarkup(target[last])) + target[last] = child.withText(target[last].text + child.text); + else + target.push(child); + } + function addRange($start, $end, depth, target) { + let node2 = ($end || $start).node(depth); + let startIndex = 0, endIndex = $end ? $end.index(depth) : node2.childCount; + if ($start) { + startIndex = $start.index(depth); + if ($start.depth > depth) { + startIndex++; + } else if ($start.textOffset) { + addNode($start.nodeAfter, target); + startIndex++; + } } -} - -document.addEventListener("click", (event) => { - if (!profile_button.contains(event.target) && !profile_dropdown.contains(event.target)) { - profile_dropdown.classList.add("hidden"); + for (let i2 = startIndex; i2 < endIndex; i2++) + addNode(node2.child(i2), target); + if ($end && $end.depth == depth && $end.textOffset) + addNode($end.nodeBefore, target); + } + function close(node2, content3) { + node2.type.checkContent(content3); + return node2.copy(content3); + } + function replaceThreeWay($from, $start, $end, $to, depth) { + let openStart = $from.depth > depth && joinable($from, $start, depth + 1); + let openEnd = $to.depth > depth && joinable($end, $to, depth + 1); + let content3 = []; + addRange(null, $from, depth, content3); + if (openStart && openEnd && $start.index(depth) == $end.index(depth)) { + checkJoin(openStart, openEnd); + addNode(close(openStart, replaceThreeWay($from, $start, $end, $to, depth + 1)), content3); + } else { + if (openStart) + addNode(close(openStart, replaceTwoWay($from, $start, depth + 1)), content3); + addRange($start, $end, depth, content3); + if (openEnd) + addNode(close(openEnd, replaceTwoWay($end, $to, depth + 1)), content3); } -}); + addRange($to, null, depth, content3); + return new Fragment(content3); + } + function replaceTwoWay($from, $to, depth) { + let content3 = []; + addRange(null, $from, depth, content3); + if ($from.depth > depth) { + let type = joinable($from, $to, depth + 1); + addNode(close(type, replaceTwoWay($from, $to, depth + 1)), content3); + } + addRange($to, null, depth, content3); + return new Fragment(content3); + } + function prepareSliceForReplace(slice, $along) { + let extra = $along.depth - slice.openStart, parent = $along.node(extra); + let node2 = parent.copy(slice.content); + for (let i2 = extra - 1; i2 >= 0; i2--) + node2 = $along.node(i2).copy(Fragment.from(node2)); + return { + start: node2.resolveNoCache(slice.openStart + extra), + end: node2.resolveNoCache(node2.content.size - slice.openEnd - extra) + }; + } + var ResolvedPos = class _ResolvedPos { + /** + @internal + */ + constructor(pos, path3, parentOffset) { + this.pos = pos; + this.path = path3; + this.parentOffset = parentOffset; + this.depth = path3.length / 3 - 1; + } + /** + @internal + */ + resolveDepth(val) { + if (val == null) + return this.depth; + if (val < 0) + return this.depth + val; + return val; + } + /** + The parent node that the position points into. Note that even if + a position points into a text node, that node is not considered + the parent—text nodes are ‘flat’ in this model, and have no content. + */ + get parent() { + return this.node(this.depth); + } + /** + The root node in which the position was resolved. + */ + get doc() { + return this.node(0); + } + /** + The ancestor node at the given level. `p.node(p.depth)` is the + same as `p.parent`. + */ + node(depth) { + return this.path[this.resolveDepth(depth) * 3]; + } + /** + The index into the ancestor at the given level. If this points + at the 3rd node in the 2nd paragraph on the top level, for + example, `p.index(0)` is 1 and `p.index(1)` is 2. + */ + index(depth) { + return this.path[this.resolveDepth(depth) * 3 + 1]; + } + /** + The index pointing after this position into the ancestor at the + given level. + */ + indexAfter(depth) { + depth = this.resolveDepth(depth); + return this.index(depth) + (depth == this.depth && !this.textOffset ? 0 : 1); + } + /** + The (absolute) position at the start of the node at the given + level. + */ + start(depth) { + depth = this.resolveDepth(depth); + return depth == 0 ? 0 : this.path[depth * 3 - 1] + 1; + } + /** + The (absolute) position at the end of the node at the given + level. + */ + end(depth) { + depth = this.resolveDepth(depth); + return this.start(depth) + this.node(depth).content.size; + } + /** + The (absolute) position directly before the wrapping node at the + given level, or, when `depth` is `this.depth + 1`, the original + position. + */ + before(depth) { + depth = this.resolveDepth(depth); + if (!depth) + throw new RangeError("There is no position before the top-level node"); + return depth == this.depth + 1 ? this.pos : this.path[depth * 3 - 1]; + } + /** + The (absolute) position directly after the wrapping node at the + given level, or the original position when `depth` is `this.depth + 1`. + */ + after(depth) { + depth = this.resolveDepth(depth); + if (!depth) + throw new RangeError("There is no position after the top-level node"); + return depth == this.depth + 1 ? this.pos : this.path[depth * 3 - 1] + this.path[depth * 3].nodeSize; + } + /** + When this position points into a text node, this returns the + distance between the position and the start of the text node. + Will be zero for positions that point between nodes. + */ + get textOffset() { + return this.pos - this.path[this.path.length - 1]; + } + /** + Get the node directly after the position, if any. If the position + points into a text node, only the part of that node after the + position is returned. + */ + get nodeAfter() { + let parent = this.parent, index2 = this.index(this.depth); + if (index2 == parent.childCount) + return null; + let dOff = this.pos - this.path[this.path.length - 1], child = parent.child(index2); + return dOff ? parent.child(index2).cut(dOff) : child; + } + /** + Get the node directly before the position, if any. If the + position points into a text node, only the part of that node + before the position is returned. + */ + get nodeBefore() { + let index2 = this.index(this.depth); + let dOff = this.pos - this.path[this.path.length - 1]; + if (dOff) + return this.parent.child(index2).cut(0, dOff); + return index2 == 0 ? null : this.parent.child(index2 - 1); + } + /** + Get the position at the given index in the parent node at the + given depth (which defaults to `this.depth`). + */ + posAtIndex(index2, depth) { + depth = this.resolveDepth(depth); + let node2 = this.path[depth * 3], pos = depth == 0 ? 0 : this.path[depth * 3 - 1] + 1; + for (let i2 = 0; i2 < index2; i2++) + pos += node2.child(i2).nodeSize; + return pos; + } + /** + Get the marks at this position, factoring in the surrounding + marks' [`inclusive`](https://prosemirror.net/docs/ref/#model.MarkSpec.inclusive) property. If the + position is at the start of a non-empty node, the marks of the + node after it (if any) are returned. + */ + marks() { + let parent = this.parent, index2 = this.index(); + if (parent.content.size == 0) + return Mark.none; + if (this.textOffset) + return parent.child(index2).marks; + let main = parent.maybeChild(index2 - 1), other = parent.maybeChild(index2); + if (!main) { + let tmp = main; + main = other; + other = tmp; + } + let marks = main.marks; + for (var i2 = 0; i2 < marks.length; i2++) + if (marks[i2].type.spec.inclusive === false && (!other || !marks[i2].isInSet(other.marks))) + marks = marks[i2--].removeFromSet(marks); + return marks; + } + /** + Get the marks after the current position, if any, except those + that are non-inclusive and not present at position `$end`. This + is mostly useful for getting the set of marks to preserve after a + deletion. Will return `null` if this position is at the end of + its parent node or its parent node isn't a textblock (in which + case no marks should be preserved). + */ + marksAcross($end) { + let after = this.parent.maybeChild(this.index()); + if (!after || !after.isInline) + return null; + let marks = after.marks, next = $end.parent.maybeChild($end.index()); + for (var i2 = 0; i2 < marks.length; i2++) + if (marks[i2].type.spec.inclusive === false && (!next || !marks[i2].isInSet(next.marks))) + marks = marks[i2--].removeFromSet(marks); + return marks; + } + /** + The depth up to which this position and the given (non-resolved) + position share the same parent nodes. + */ + sharedDepth(pos) { + for (let depth = this.depth; depth > 0; depth--) + if (this.start(depth) <= pos && this.end(depth) >= pos) + return depth; + return 0; + } + /** + Returns a range based on the place where this position and the + given position diverge around block content. If both point into + the same textblock, for example, a range around that textblock + will be returned. If they point into different blocks, the range + around those blocks in their shared ancestor is returned. You can + pass in an optional predicate that will be called with a parent + node to see if a range into that parent is acceptable. + */ + blockRange(other = this, pred) { + if (other.pos < this.pos) + return other.blockRange(this); + for (let d6 = this.depth - (this.parent.inlineContent || this.pos == other.pos ? 1 : 0); d6 >= 0; d6--) + if (other.pos <= this.end(d6) && (!pred || pred(this.node(d6)))) + return new NodeRange(this, other, d6); + return null; + } + /** + Query whether the given position shares the same parent node. + */ + sameParent(other) { + return this.pos - this.parentOffset == other.pos - other.parentOffset; + } + /** + Return the greater of this and the given position. + */ + max(other) { + return other.pos > this.pos ? other : this; + } + /** + Return the smaller of this and the given position. + */ + min(other) { + return other.pos < this.pos ? other : this; + } + /** + @internal + */ + toString() { + let str = ""; + for (let i2 = 1; i2 <= this.depth; i2++) + str += (str ? "/" : "") + this.node(i2).type.name + "_" + this.index(i2 - 1); + return str + ":" + this.parentOffset; + } + /** + @internal + */ + static resolve(doc4, pos) { + if (!(pos >= 0 && pos <= doc4.content.size)) + throw new RangeError("Position " + pos + " out of range"); + let path3 = []; + let start = 0, parentOffset = pos; + for (let node2 = doc4; ; ) { + let { index: index2, offset } = node2.content.findIndex(parentOffset); + let rem = parentOffset - offset; + path3.push(node2, index2, start + offset); + if (!rem) + break; + node2 = node2.child(index2); + if (node2.isText) + break; + parentOffset = rem - 1; + start += offset + 1; + } + return new _ResolvedPos(pos, path3, parentOffset); + } + /** + @internal + */ + static resolveCached(doc4, pos) { + for (let i2 = 0; i2 < resolveCache.length; i2++) { + let cached = resolveCache[i2]; + if (cached.pos == pos && cached.doc == doc4) + return cached; + } + let result = resolveCache[resolveCachePos] = _ResolvedPos.resolve(doc4, pos); + resolveCachePos = (resolveCachePos + 1) % resolveCacheSize; + return result; + } + }; + var resolveCache = []; + var resolveCachePos = 0; + var resolveCacheSize = 12; + var NodeRange = class { + /** + Construct a node range. `$from` and `$to` should point into the + same node until at least the given `depth`, since a node range + denotes an adjacent set of nodes in a single parent node. + */ + constructor($from, $to, depth) { + this.$from = $from; + this.$to = $to; + this.depth = depth; + } + /** + The position at the start of the range. + */ + get start() { + return this.$from.before(this.depth + 1); + } + /** + The position at the end of the range. + */ + get end() { + return this.$to.after(this.depth + 1); + } + /** + The parent node that the range points into. + */ + get parent() { + return this.$from.node(this.depth); + } + /** + The start index of the range in the parent node. + */ + get startIndex() { + return this.$from.index(this.depth); + } + /** + The end index of the range in the parent node. + */ + get endIndex() { + return this.$to.indexAfter(this.depth); + } + }; + var emptyAttrs = /* @__PURE__ */ Object.create(null); + var Node2 = class _Node { + /** + @internal + */ + constructor(type, attrs, content3, marks = Mark.none) { + this.type = type; + this.attrs = attrs; + this.marks = marks; + this.content = content3 || Fragment.empty; + } + /** + The size of this node, as defined by the integer-based [indexing + scheme](/docs/guide/#doc.indexing). For text nodes, this is the + amount of characters. For other leaf nodes, it is one. For + non-leaf nodes, it is the size of the content plus two (the + start and end token). + */ + get nodeSize() { + return this.isLeaf ? 1 : 2 + this.content.size; + } + /** + The number of children that the node has. + */ + get childCount() { + return this.content.childCount; + } + /** + Get the child node at the given index. Raises an error when the + index is out of range. + */ + child(index2) { + return this.content.child(index2); + } + /** + Get the child node at the given index, if it exists. + */ + maybeChild(index2) { + return this.content.maybeChild(index2); + } + /** + Call `f` for every child node, passing the node, its offset + into this parent node, and its index. + */ + forEach(f3) { + this.content.forEach(f3); + } + /** + Invoke a callback for all descendant nodes recursively between + the given two positions that are relative to start of this + node's content. The callback is invoked with the node, its + position relative to the original node (method receiver), + its parent node, and its child index. When the callback returns + false for a given node, that node's children will not be + recursed over. The last parameter can be used to specify a + starting position to count from. + */ + nodesBetween(from, to, f3, startPos = 0) { + this.content.nodesBetween(from, to, f3, startPos, this); + } + /** + Call the given callback for every descendant node. Doesn't + descend into a node when the callback returns `false`. + */ + descendants(f3) { + this.nodesBetween(0, this.content.size, f3); + } + /** + Concatenates all the text nodes found in this fragment and its + children. + */ + get textContent() { + return this.isLeaf && this.type.spec.leafText ? this.type.spec.leafText(this) : this.textBetween(0, this.content.size, ""); + } + /** + Get all text between positions `from` and `to`. When + `blockSeparator` is given, it will be inserted to separate text + from different block nodes. If `leafText` is given, it'll be + inserted for every non-text leaf node encountered, otherwise + [`leafText`](https://prosemirror.net/docs/ref/#model.NodeSpec^leafText) will be used. + */ + textBetween(from, to, blockSeparator, leafText) { + return this.content.textBetween(from, to, blockSeparator, leafText); + } + /** + Returns this node's first child, or `null` if there are no + children. + */ + get firstChild() { + return this.content.firstChild; + } + /** + Returns this node's last child, or `null` if there are no + children. + */ + get lastChild() { + return this.content.lastChild; + } + /** + Test whether two nodes represent the same piece of document. + */ + eq(other) { + return this == other || this.sameMarkup(other) && this.content.eq(other.content); + } + /** + Compare the markup (type, attributes, and marks) of this node to + those of another. Returns `true` if both have the same markup. + */ + sameMarkup(other) { + return this.hasMarkup(other.type, other.attrs, other.marks); + } + /** + Check whether this node's markup correspond to the given type, + attributes, and marks. + */ + hasMarkup(type, attrs, marks) { + return this.type == type && compareDeep(this.attrs, attrs || type.defaultAttrs || emptyAttrs) && Mark.sameSet(this.marks, marks || Mark.none); + } + /** + Create a new node with the same markup as this node, containing + the given content (or empty, if no content is given). + */ + copy(content3 = null) { + if (content3 == this.content) + return this; + return new _Node(this.type, this.attrs, content3, this.marks); + } + /** + Create a copy of this node, with the given set of marks instead + of the node's own marks. + */ + mark(marks) { + return marks == this.marks ? this : new _Node(this.type, this.attrs, this.content, marks); + } + /** + Create a copy of this node with only the content between the + given positions. If `to` is not given, it defaults to the end of + the node. + */ + cut(from, to = this.content.size) { + if (from == 0 && to == this.content.size) + return this; + return this.copy(this.content.cut(from, to)); + } + /** + Cut out the part of the document between the given positions, and + return it as a `Slice` object. + */ + slice(from, to = this.content.size, includeParents = false) { + if (from == to) + return Slice.empty; + let $from = this.resolve(from), $to = this.resolve(to); + let depth = includeParents ? 0 : $from.sharedDepth(to); + let start = $from.start(depth), node2 = $from.node(depth); + let content3 = node2.content.cut($from.pos - start, $to.pos - start); + return new Slice(content3, $from.depth - depth, $to.depth - depth); + } + /** + Replace the part of the document between the given positions with + the given slice. The slice must 'fit', meaning its open sides + must be able to connect to the surrounding content, and its + content nodes must be valid children for the node they are placed + into. If any of this is violated, an error of type + [`ReplaceError`](https://prosemirror.net/docs/ref/#model.ReplaceError) is thrown. + */ + replace(from, to, slice) { + return replace(this.resolve(from), this.resolve(to), slice); + } + /** + Find the node directly after the given position. + */ + nodeAt(pos) { + for (let node2 = this; ; ) { + let { index: index2, offset } = node2.content.findIndex(pos); + node2 = node2.maybeChild(index2); + if (!node2) + return null; + if (offset == pos || node2.isText) + return node2; + pos -= offset + 1; + } + } + /** + Find the (direct) child node after the given offset, if any, + and return it along with its index and offset relative to this + node. + */ + childAfter(pos) { + let { index: index2, offset } = this.content.findIndex(pos); + return { node: this.content.maybeChild(index2), index: index2, offset }; + } + /** + Find the (direct) child node before the given offset, if any, + and return it along with its index and offset relative to this + node. + */ + childBefore(pos) { + if (pos == 0) + return { node: null, index: 0, offset: 0 }; + let { index: index2, offset } = this.content.findIndex(pos); + if (offset < pos) + return { node: this.content.child(index2), index: index2, offset }; + let node2 = this.content.child(index2 - 1); + return { node: node2, index: index2 - 1, offset: offset - node2.nodeSize }; + } + /** + Resolve the given position in the document, returning an + [object](https://prosemirror.net/docs/ref/#model.ResolvedPos) with information about its context. + */ + resolve(pos) { + return ResolvedPos.resolveCached(this, pos); + } + /** + @internal + */ + resolveNoCache(pos) { + return ResolvedPos.resolve(this, pos); + } + /** + Test whether a given mark or mark type occurs in this document + between the two given positions. + */ + rangeHasMark(from, to, type) { + let found2 = false; + if (to > from) + this.nodesBetween(from, to, (node2) => { + if (type.isInSet(node2.marks)) + found2 = true; + return !found2; + }); + return found2; + } + /** + True when this is a block (non-inline node) + */ + get isBlock() { + return this.type.isBlock; + } + /** + True when this is a textblock node, a block node with inline + content. + */ + get isTextblock() { + return this.type.isTextblock; + } + /** + True when this node allows inline content. + */ + get inlineContent() { + return this.type.inlineContent; + } + /** + True when this is an inline node (a text node or a node that can + appear among text). + */ + get isInline() { + return this.type.isInline; + } + /** + True when this is a text node. + */ + get isText() { + return this.type.isText; + } + /** + True when this is a leaf node. + */ + get isLeaf() { + return this.type.isLeaf; + } + /** + True when this is an atom, i.e. when it does not have directly + editable content. This is usually the same as `isLeaf`, but can + be configured with the [`atom` property](https://prosemirror.net/docs/ref/#model.NodeSpec.atom) + on a node's spec (typically used when the node is displayed as + an uneditable [node view](https://prosemirror.net/docs/ref/#view.NodeView)). + */ + get isAtom() { + return this.type.isAtom; + } + /** + Return a string representation of this node for debugging + purposes. + */ + toString() { + if (this.type.spec.toDebugString) + return this.type.spec.toDebugString(this); + let name = this.type.name; + if (this.content.size) + name += "(" + this.content.toStringInner() + ")"; + return wrapMarks(this.marks, name); + } + /** + Get the content match in this node at the given index. + */ + contentMatchAt(index2) { + let match = this.type.contentMatch.matchFragment(this.content, 0, index2); + if (!match) + throw new Error("Called contentMatchAt on a node with invalid content"); + return match; + } + /** + Test whether replacing the range between `from` and `to` (by + child index) with the given replacement fragment (which defaults + to the empty fragment) would leave the node's content valid. You + can optionally pass `start` and `end` indices into the + replacement fragment. + */ + canReplace(from, to, replacement = Fragment.empty, start = 0, end = replacement.childCount) { + let one2 = this.contentMatchAt(from).matchFragment(replacement, start, end); + let two = one2 && one2.matchFragment(this.content, to); + if (!two || !two.validEnd) + return false; + for (let i2 = start; i2 < end; i2++) + if (!this.type.allowsMarks(replacement.child(i2).marks)) + return false; + return true; + } + /** + Test whether replacing the range `from` to `to` (by index) with + a node of the given type would leave the node's content valid. + */ + canReplaceWith(from, to, type, marks) { + if (marks && !this.type.allowsMarks(marks)) + return false; + let start = this.contentMatchAt(from).matchType(type); + let end = start && start.matchFragment(this.content, to); + return end ? end.validEnd : false; + } + /** + Test whether the given node's content could be appended to this + node. If that node is empty, this will only return true if there + is at least one node type that can appear in both nodes (to avoid + merging completely incompatible nodes). + */ + canAppend(other) { + if (other.content.size) + return this.canReplace(this.childCount, this.childCount, other.content); + else + return this.type.compatibleContent(other.type); + } + /** + Check whether this node and its descendants conform to the + schema, and raise error when they do not. + */ + check() { + this.type.checkContent(this.content); + let copy2 = Mark.none; + for (let i2 = 0; i2 < this.marks.length; i2++) + copy2 = this.marks[i2].addToSet(copy2); + if (!Mark.sameSet(copy2, this.marks)) + throw new RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map((m3) => m3.type.name)}`); + this.content.forEach((node2) => node2.check()); + } + /** + Return a JSON-serializeable representation of this node. + */ + toJSON() { + let obj = { type: this.type.name }; + for (let _3 in this.attrs) { + obj.attrs = this.attrs; + break; + } + if (this.content.size) + obj.content = this.content.toJSON(); + if (this.marks.length) + obj.marks = this.marks.map((n4) => n4.toJSON()); + return obj; + } + /** + Deserialize a node from its JSON representation. + */ + static fromJSON(schema, json) { + if (!json) + throw new RangeError("Invalid input for Node.fromJSON"); + let marks = null; + if (json.marks) { + if (!Array.isArray(json.marks)) + throw new RangeError("Invalid mark data for Node.fromJSON"); + marks = json.marks.map(schema.markFromJSON); + } + if (json.type == "text") { + if (typeof json.text != "string") + throw new RangeError("Invalid text node in JSON"); + return schema.text(json.text, marks); + } + let content3 = Fragment.fromJSON(schema, json.content); + return schema.nodeType(json.type).create(json.attrs, content3, marks); + } + }; + Node2.prototype.text = void 0; + var TextNode = class _TextNode extends Node2 { + /** + @internal + */ + constructor(type, attrs, content3, marks) { + super(type, attrs, null, marks); + if (!content3) + throw new RangeError("Empty text nodes are not allowed"); + this.text = content3; + } + toString() { + if (this.type.spec.toDebugString) + return this.type.spec.toDebugString(this); + return wrapMarks(this.marks, JSON.stringify(this.text)); + } + get textContent() { + return this.text; + } + textBetween(from, to) { + return this.text.slice(from, to); + } + get nodeSize() { + return this.text.length; + } + mark(marks) { + return marks == this.marks ? this : new _TextNode(this.type, this.attrs, this.text, marks); + } + withText(text5) { + if (text5 == this.text) + return this; + return new _TextNode(this.type, this.attrs, text5, this.marks); + } + cut(from = 0, to = this.text.length) { + if (from == 0 && to == this.text.length) + return this; + return this.withText(this.text.slice(from, to)); + } + eq(other) { + return this.sameMarkup(other) && this.text == other.text; + } + toJSON() { + let base2 = super.toJSON(); + base2.text = this.text; + return base2; + } + }; + function wrapMarks(marks, str) { + for (let i2 = marks.length - 1; i2 >= 0; i2--) + str = marks[i2].type.name + "(" + str + ")"; + return str; + } + var ContentMatch = class _ContentMatch { + /** + @internal + */ + constructor(validEnd) { + this.validEnd = validEnd; + this.next = []; + this.wrapCache = []; + } + /** + @internal + */ + static parse(string3, nodeTypes) { + let stream = new TokenStream(string3, nodeTypes); + if (stream.next == null) + return _ContentMatch.empty; + let expr = parseExpr(stream); + if (stream.next) + stream.err("Unexpected trailing text"); + let match = dfa(nfa(expr)); + checkForDeadEnds(match, stream); + return match; + } + /** + Match a node type, returning a match after that node if + successful. + */ + matchType(type) { + for (let i2 = 0; i2 < this.next.length; i2++) + if (this.next[i2].type == type) + return this.next[i2].next; + return null; + } + /** + Try to match a fragment. Returns the resulting match when + successful. + */ + matchFragment(frag, start = 0, end = frag.childCount) { + let cur = this; + for (let i2 = start; cur && i2 < end; i2++) + cur = cur.matchType(frag.child(i2).type); + return cur; + } + /** + @internal + */ + get inlineContent() { + return this.next.length != 0 && this.next[0].type.isInline; + } + /** + Get the first matching node type at this match position that can + be generated. + */ + get defaultType() { + for (let i2 = 0; i2 < this.next.length; i2++) { + let { type } = this.next[i2]; + if (!(type.isText || type.hasRequiredAttrs())) + return type; + } + return null; + } + /** + @internal + */ + compatible(other) { + for (let i2 = 0; i2 < this.next.length; i2++) + for (let j6 = 0; j6 < other.next.length; j6++) + if (this.next[i2].type == other.next[j6].type) + return true; + return false; + } + /** + Try to match the given fragment, and if that fails, see if it can + be made to match by inserting nodes in front of it. When + successful, return a fragment of inserted nodes (which may be + empty if nothing had to be inserted). When `toEnd` is true, only + return a fragment if the resulting match goes to the end of the + content expression. + */ + fillBefore(after, toEnd = false, startIndex = 0) { + let seen = [this]; + function search2(match, types) { + let finished = match.matchFragment(after, startIndex); + if (finished && (!toEnd || finished.validEnd)) + return Fragment.from(types.map((tp) => tp.createAndFill())); + for (let i2 = 0; i2 < match.next.length; i2++) { + let { type, next } = match.next[i2]; + if (!(type.isText || type.hasRequiredAttrs()) && seen.indexOf(next) == -1) { + seen.push(next); + let found2 = search2(next, types.concat(type)); + if (found2) + return found2; + } + } + return null; + } + return search2(this, []); + } + /** + Find a set of wrapping node types that would allow a node of the + given type to appear at this position. The result may be empty + (when it fits directly) and will be null when no such wrapping + exists. + */ + findWrapping(target) { + for (let i2 = 0; i2 < this.wrapCache.length; i2 += 2) + if (this.wrapCache[i2] == target) + return this.wrapCache[i2 + 1]; + let computed = this.computeWrapping(target); + this.wrapCache.push(target, computed); + return computed; + } + /** + @internal + */ + computeWrapping(target) { + let seen = /* @__PURE__ */ Object.create(null), active = [{ match: this, type: null, via: null }]; + while (active.length) { + let current = active.shift(), match = current.match; + if (match.matchType(target)) { + let result = []; + for (let obj = current; obj.type; obj = obj.via) + result.push(obj.type); + return result.reverse(); + } + for (let i2 = 0; i2 < match.next.length; i2++) { + let { type, next } = match.next[i2]; + if (!type.isLeaf && !type.hasRequiredAttrs() && !(type.name in seen) && (!current.type || next.validEnd)) { + active.push({ match: type.contentMatch, type, via: current }); + seen[type.name] = true; + } + } + } + return null; + } + /** + The number of outgoing edges this node has in the finite + automaton that describes the content expression. + */ + get edgeCount() { + return this.next.length; + } + /** + Get the _n_​th outgoing edge from this node in the finite + automaton that describes the content expression. + */ + edge(n4) { + if (n4 >= this.next.length) + throw new RangeError(`There's no ${n4}th edge in this content match`); + return this.next[n4]; + } + /** + @internal + */ + toString() { + let seen = []; + function scan(m3) { + seen.push(m3); + for (let i2 = 0; i2 < m3.next.length; i2++) + if (seen.indexOf(m3.next[i2].next) == -1) + scan(m3.next[i2].next); + } + scan(this); + return seen.map((m3, i2) => { + let out = i2 + (m3.validEnd ? "*" : " ") + " "; + for (let i3 = 0; i3 < m3.next.length; i3++) + out += (i3 ? ", " : "") + m3.next[i3].type.name + "->" + seen.indexOf(m3.next[i3].next); + return out; + }).join("\n"); + } + }; + ContentMatch.empty = new ContentMatch(true); + var TokenStream = class { + constructor(string3, nodeTypes) { + this.string = string3; + this.nodeTypes = nodeTypes; + this.inline = null; + this.pos = 0; + this.tokens = string3.split(/\s*(?=\b|\W|$)/); + if (this.tokens[this.tokens.length - 1] == "") + this.tokens.pop(); + if (this.tokens[0] == "") + this.tokens.shift(); + } + get next() { + return this.tokens[this.pos]; + } + eat(tok) { + return this.next == tok && (this.pos++ || true); + } + err(str) { + throw new SyntaxError(str + " (in content expression '" + this.string + "')"); + } + }; + function parseExpr(stream) { + let exprs = []; + do { + exprs.push(parseExprSeq(stream)); + } while (stream.eat("|")); + return exprs.length == 1 ? exprs[0] : { type: "choice", exprs }; + } + function parseExprSeq(stream) { + let exprs = []; + do { + exprs.push(parseExprSubscript(stream)); + } while (stream.next && stream.next != ")" && stream.next != "|"); + return exprs.length == 1 ? exprs[0] : { type: "seq", exprs }; + } + function parseExprSubscript(stream) { + let expr = parseExprAtom(stream); + for (; ; ) { + if (stream.eat("+")) + expr = { type: "plus", expr }; + else if (stream.eat("*")) + expr = { type: "star", expr }; + else if (stream.eat("?")) + expr = { type: "opt", expr }; + else if (stream.eat("{")) + expr = parseExprRange(stream, expr); + else + break; + } + return expr; + } + function parseNum(stream) { + if (/\D/.test(stream.next)) + stream.err("Expected number, got '" + stream.next + "'"); + let result = Number(stream.next); + stream.pos++; + return result; + } + function parseExprRange(stream, expr) { + let min = parseNum(stream), max = min; + if (stream.eat(",")) { + if (stream.next != "}") + max = parseNum(stream); + else + max = -1; + } + if (!stream.eat("}")) + stream.err("Unclosed braced range"); + return { type: "range", min, max, expr }; + } + function resolveName(stream, name) { + let types = stream.nodeTypes, type = types[name]; + if (type) + return [type]; + let result = []; + for (let typeName in types) { + let type2 = types[typeName]; + if (type2.groups.indexOf(name) > -1) + result.push(type2); + } + if (result.length == 0) + stream.err("No node type or group '" + name + "' found"); + return result; + } + function parseExprAtom(stream) { + if (stream.eat("(")) { + let expr = parseExpr(stream); + if (!stream.eat(")")) + stream.err("Missing closing paren"); + return expr; + } else if (!/\W/.test(stream.next)) { + let exprs = resolveName(stream, stream.next).map((type) => { + if (stream.inline == null) + stream.inline = type.isInline; + else if (stream.inline != type.isInline) + stream.err("Mixing inline and block content"); + return { type: "name", value: type }; + }); + stream.pos++; + return exprs.length == 1 ? exprs[0] : { type: "choice", exprs }; + } else { + stream.err("Unexpected token '" + stream.next + "'"); + } + } + function nfa(expr) { + let nfa2 = [[]]; + connect(compile(expr, 0), node2()); + return nfa2; + function node2() { + return nfa2.push([]) - 1; + } + function edge(from, to, term) { + let edge2 = { term, to }; + nfa2[from].push(edge2); + return edge2; + } + function connect(edges, to) { + edges.forEach((edge2) => edge2.to = to); + } + function compile(expr2, from) { + if (expr2.type == "choice") { + return expr2.exprs.reduce((out, expr3) => out.concat(compile(expr3, from)), []); + } else if (expr2.type == "seq") { + for (let i2 = 0; ; i2++) { + let next = compile(expr2.exprs[i2], from); + if (i2 == expr2.exprs.length - 1) + return next; + connect(next, from = node2()); + } + } else if (expr2.type == "star") { + let loop = node2(); + edge(from, loop); + connect(compile(expr2.expr, loop), loop); + return [edge(loop)]; + } else if (expr2.type == "plus") { + let loop = node2(); + connect(compile(expr2.expr, from), loop); + connect(compile(expr2.expr, loop), loop); + return [edge(loop)]; + } else if (expr2.type == "opt") { + return [edge(from)].concat(compile(expr2.expr, from)); + } else if (expr2.type == "range") { + let cur = from; + for (let i2 = 0; i2 < expr2.min; i2++) { + let next = node2(); + connect(compile(expr2.expr, cur), next); + cur = next; + } + if (expr2.max == -1) { + connect(compile(expr2.expr, cur), cur); + } else { + for (let i2 = expr2.min; i2 < expr2.max; i2++) { + let next = node2(); + edge(cur, next); + connect(compile(expr2.expr, cur), next); + cur = next; + } + } + return [edge(cur)]; + } else if (expr2.type == "name") { + return [edge(from, void 0, expr2.value)]; + } else { + throw new Error("Unknown expr type"); + } + } + } + function cmp(a2, b4) { + return b4 - a2; + } + function nullFrom(nfa2, node2) { + let result = []; + scan(node2); + return result.sort(cmp); + function scan(node3) { + let edges = nfa2[node3]; + if (edges.length == 1 && !edges[0].term) + return scan(edges[0].to); + result.push(node3); + for (let i2 = 0; i2 < edges.length; i2++) { + let { term, to } = edges[i2]; + if (!term && result.indexOf(to) == -1) + scan(to); + } + } + } + function dfa(nfa2) { + let labeled = /* @__PURE__ */ Object.create(null); + return explore(nullFrom(nfa2, 0)); + function explore(states) { + let out = []; + states.forEach((node2) => { + nfa2[node2].forEach(({ term, to }) => { + if (!term) + return; + let set; + for (let i2 = 0; i2 < out.length; i2++) + if (out[i2][0] == term) + set = out[i2][1]; + nullFrom(nfa2, to).forEach((node3) => { + if (!set) + out.push([term, set = []]); + if (set.indexOf(node3) == -1) + set.push(node3); + }); + }); + }); + let state = labeled[states.join(",")] = new ContentMatch(states.indexOf(nfa2.length - 1) > -1); + for (let i2 = 0; i2 < out.length; i2++) { + let states2 = out[i2][1].sort(cmp); + state.next.push({ type: out[i2][0], next: labeled[states2.join(",")] || explore(states2) }); + } + return state; + } + } + function checkForDeadEnds(match, stream) { + for (let i2 = 0, work = [match]; i2 < work.length; i2++) { + let state = work[i2], dead = !state.validEnd, nodes = []; + for (let j6 = 0; j6 < state.next.length; j6++) { + let { type, next } = state.next[j6]; + nodes.push(type.name); + if (dead && !(type.isText || type.hasRequiredAttrs())) + dead = false; + if (work.indexOf(next) == -1) + work.push(next); + } + if (dead) + stream.err("Only non-generatable nodes (" + nodes.join(", ") + ") in a required position (see https://prosemirror.net/docs/guide/#generatable)"); + } + } + function defaultAttrs(attrs) { + let defaults = /* @__PURE__ */ Object.create(null); + for (let attrName in attrs) { + let attr = attrs[attrName]; + if (!attr.hasDefault) + return null; + defaults[attrName] = attr.default; + } + return defaults; + } + function computeAttrs(attrs, value) { + let built = /* @__PURE__ */ Object.create(null); + for (let name in attrs) { + let given = value && value[name]; + if (given === void 0) { + let attr = attrs[name]; + if (attr.hasDefault) + given = attr.default; + else + throw new RangeError("No value supplied for attribute " + name); + } + built[name] = given; + } + return built; + } + function initAttrs(attrs) { + let result = /* @__PURE__ */ Object.create(null); + if (attrs) + for (let name in attrs) + result[name] = new Attribute(attrs[name]); + return result; + } + var NodeType = class _NodeType { + /** + @internal + */ + constructor(name, schema, spec) { + this.name = name; + this.schema = schema; + this.spec = spec; + this.markSet = null; + this.groups = spec.group ? spec.group.split(" ") : []; + this.attrs = initAttrs(spec.attrs); + this.defaultAttrs = defaultAttrs(this.attrs); + this.contentMatch = null; + this.inlineContent = null; + this.isBlock = !(spec.inline || name == "text"); + this.isText = name == "text"; + } + /** + True if this is an inline type. + */ + get isInline() { + return !this.isBlock; + } + /** + True if this is a textblock type, a block that contains inline + content. + */ + get isTextblock() { + return this.isBlock && this.inlineContent; + } + /** + True for node types that allow no content. + */ + get isLeaf() { + return this.contentMatch == ContentMatch.empty; + } + /** + True when this node is an atom, i.e. when it does not have + directly editable content. + */ + get isAtom() { + return this.isLeaf || !!this.spec.atom; + } + /** + The node type's [whitespace](https://prosemirror.net/docs/ref/#model.NodeSpec.whitespace) option. + */ + get whitespace() { + return this.spec.whitespace || (this.spec.code ? "pre" : "normal"); + } + /** + Tells you whether this node type has any required attributes. + */ + hasRequiredAttrs() { + for (let n4 in this.attrs) + if (this.attrs[n4].isRequired) + return true; + return false; + } + /** + Indicates whether this node allows some of the same content as + the given node type. + */ + compatibleContent(other) { + return this == other || this.contentMatch.compatible(other.contentMatch); + } + /** + @internal + */ + computeAttrs(attrs) { + if (!attrs && this.defaultAttrs) + return this.defaultAttrs; + else + return computeAttrs(this.attrs, attrs); + } + /** + Create a `Node` of this type. The given attributes are + checked and defaulted (you can pass `null` to use the type's + defaults entirely, if no required attributes exist). `content` + may be a `Fragment`, a node, an array of nodes, or + `null`. Similarly `marks` may be `null` to default to the empty + set of marks. + */ + create(attrs = null, content3, marks) { + if (this.isText) + throw new Error("NodeType.create can't construct text nodes"); + return new Node2(this, this.computeAttrs(attrs), Fragment.from(content3), Mark.setFrom(marks)); + } + /** + Like [`create`](https://prosemirror.net/docs/ref/#model.NodeType.create), but check the given content + against the node type's content restrictions, and throw an error + if it doesn't match. + */ + createChecked(attrs = null, content3, marks) { + content3 = Fragment.from(content3); + this.checkContent(content3); + return new Node2(this, this.computeAttrs(attrs), content3, Mark.setFrom(marks)); + } + /** + Like [`create`](https://prosemirror.net/docs/ref/#model.NodeType.create), but see if it is + necessary to add nodes to the start or end of the given fragment + to make it fit the node. If no fitting wrapping can be found, + return null. Note that, due to the fact that required nodes can + always be created, this will always succeed if you pass null or + `Fragment.empty` as content. + */ + createAndFill(attrs = null, content3, marks) { + attrs = this.computeAttrs(attrs); + content3 = Fragment.from(content3); + if (content3.size) { + let before = this.contentMatch.fillBefore(content3); + if (!before) + return null; + content3 = before.append(content3); + } + let matched = this.contentMatch.matchFragment(content3); + let after = matched && matched.fillBefore(Fragment.empty, true); + if (!after) + return null; + return new Node2(this, attrs, content3.append(after), Mark.setFrom(marks)); + } + /** + Returns true if the given fragment is valid content for this node + type with the given attributes. + */ + validContent(content3) { + let result = this.contentMatch.matchFragment(content3); + if (!result || !result.validEnd) + return false; + for (let i2 = 0; i2 < content3.childCount; i2++) + if (!this.allowsMarks(content3.child(i2).marks)) + return false; + return true; + } + /** + Throws a RangeError if the given fragment is not valid content for this + node type. + @internal + */ + checkContent(content3) { + if (!this.validContent(content3)) + throw new RangeError(`Invalid content for node ${this.name}: ${content3.toString().slice(0, 50)}`); + } + /** + Check whether the given mark type is allowed in this node. + */ + allowsMarkType(markType) { + return this.markSet == null || this.markSet.indexOf(markType) > -1; + } + /** + Test whether the given set of marks are allowed in this node. + */ + allowsMarks(marks) { + if (this.markSet == null) + return true; + for (let i2 = 0; i2 < marks.length; i2++) + if (!this.allowsMarkType(marks[i2].type)) + return false; + return true; + } + /** + Removes the marks that are not allowed in this node from the given set. + */ + allowedMarks(marks) { + if (this.markSet == null) + return marks; + let copy2; + for (let i2 = 0; i2 < marks.length; i2++) { + if (!this.allowsMarkType(marks[i2].type)) { + if (!copy2) + copy2 = marks.slice(0, i2); + } else if (copy2) { + copy2.push(marks[i2]); + } + } + return !copy2 ? marks : copy2.length ? copy2 : Mark.none; + } + /** + @internal + */ + static compile(nodes, schema) { + let result = /* @__PURE__ */ Object.create(null); + nodes.forEach((name, spec) => result[name] = new _NodeType(name, schema, spec)); + let topType = schema.spec.topNode || "doc"; + if (!result[topType]) + throw new RangeError("Schema is missing its top node type ('" + topType + "')"); + if (!result.text) + throw new RangeError("Every schema needs a 'text' type"); + for (let _3 in result.text.attrs) + throw new RangeError("The text node type should not have attributes"); + return result; + } + }; + var Attribute = class { + constructor(options2) { + this.hasDefault = Object.prototype.hasOwnProperty.call(options2, "default"); + this.default = options2.default; + } + get isRequired() { + return !this.hasDefault; + } + }; + var MarkType = class _MarkType { + /** + @internal + */ + constructor(name, rank, schema, spec) { + this.name = name; + this.rank = rank; + this.schema = schema; + this.spec = spec; + this.attrs = initAttrs(spec.attrs); + this.excluded = null; + let defaults = defaultAttrs(this.attrs); + this.instance = defaults ? new Mark(this, defaults) : null; + } + /** + Create a mark of this type. `attrs` may be `null` or an object + containing only some of the mark's attributes. The others, if + they have defaults, will be added. + */ + create(attrs = null) { + if (!attrs && this.instance) + return this.instance; + return new Mark(this, computeAttrs(this.attrs, attrs)); + } + /** + @internal + */ + static compile(marks, schema) { + let result = /* @__PURE__ */ Object.create(null), rank = 0; + marks.forEach((name, spec) => result[name] = new _MarkType(name, rank++, schema, spec)); + return result; + } + /** + When there is a mark of this type in the given set, a new set + without it is returned. Otherwise, the input set is returned. + */ + removeFromSet(set) { + for (var i2 = 0; i2 < set.length; i2++) + if (set[i2].type == this) { + set = set.slice(0, i2).concat(set.slice(i2 + 1)); + i2--; + } + return set; + } + /** + Tests whether there is a mark of this type in the given set. + */ + isInSet(set) { + for (let i2 = 0; i2 < set.length; i2++) + if (set[i2].type == this) + return set[i2]; + } + /** + Queries whether a given mark type is + [excluded](https://prosemirror.net/docs/ref/#model.MarkSpec.excludes) by this one. + */ + excludes(other) { + return this.excluded.indexOf(other) > -1; + } + }; + var Schema = class { + /** + Construct a schema from a schema [specification](https://prosemirror.net/docs/ref/#model.SchemaSpec). + */ + constructor(spec) { + this.linebreakReplacement = null; + this.cached = /* @__PURE__ */ Object.create(null); + let instanceSpec = this.spec = {}; + for (let prop in spec) + instanceSpec[prop] = spec[prop]; + instanceSpec.nodes = dist_default.from(spec.nodes), instanceSpec.marks = dist_default.from(spec.marks || {}), this.nodes = NodeType.compile(this.spec.nodes, this); + this.marks = MarkType.compile(this.spec.marks, this); + let contentExprCache = /* @__PURE__ */ Object.create(null); + for (let prop in this.nodes) { + if (prop in this.marks) + throw new RangeError(prop + " can not be both a node and a mark"); + let type = this.nodes[prop], contentExpr = type.spec.content || "", markExpr = type.spec.marks; + type.contentMatch = contentExprCache[contentExpr] || (contentExprCache[contentExpr] = ContentMatch.parse(contentExpr, this.nodes)); + type.inlineContent = type.contentMatch.inlineContent; + if (type.spec.linebreakReplacement) { + if (this.linebreakReplacement) + throw new RangeError("Multiple linebreak nodes defined"); + if (!type.isInline || !type.isLeaf) + throw new RangeError("Linebreak replacement nodes must be inline leaf nodes"); + this.linebreakReplacement = type; + } + type.markSet = markExpr == "_" ? null : markExpr ? gatherMarks(this, markExpr.split(" ")) : markExpr == "" || !type.inlineContent ? [] : null; + } + for (let prop in this.marks) { + let type = this.marks[prop], excl = type.spec.excludes; + type.excluded = excl == null ? [type] : excl == "" ? [] : gatherMarks(this, excl.split(" ")); + } + this.nodeFromJSON = this.nodeFromJSON.bind(this); + this.markFromJSON = this.markFromJSON.bind(this); + this.topNodeType = this.nodes[this.spec.topNode || "doc"]; + this.cached.wrappings = /* @__PURE__ */ Object.create(null); + } + /** + Create a node in this schema. The `type` may be a string or a + `NodeType` instance. Attributes will be extended with defaults, + `content` may be a `Fragment`, `null`, a `Node`, or an array of + nodes. + */ + node(type, attrs = null, content3, marks) { + if (typeof type == "string") + type = this.nodeType(type); + else if (!(type instanceof NodeType)) + throw new RangeError("Invalid node type: " + type); + else if (type.schema != this) + throw new RangeError("Node type from different schema used (" + type.name + ")"); + return type.createChecked(attrs, content3, marks); + } + /** + Create a text node in the schema. Empty text nodes are not + allowed. + */ + text(text5, marks) { + let type = this.nodes.text; + return new TextNode(type, type.defaultAttrs, text5, Mark.setFrom(marks)); + } + /** + Create a mark with the given type and attributes. + */ + mark(type, attrs) { + if (typeof type == "string") + type = this.marks[type]; + return type.create(attrs); + } + /** + Deserialize a node from its JSON representation. This method is + bound. + */ + nodeFromJSON(json) { + return Node2.fromJSON(this, json); + } + /** + Deserialize a mark from its JSON representation. This method is + bound. + */ + markFromJSON(json) { + return Mark.fromJSON(this, json); + } + /** + @internal + */ + nodeType(name) { + let found2 = this.nodes[name]; + if (!found2) + throw new RangeError("Unknown node type: " + name); + return found2; + } + }; + function gatherMarks(schema, marks) { + let found2 = []; + for (let i2 = 0; i2 < marks.length; i2++) { + let name = marks[i2], mark = schema.marks[name], ok3 = mark; + if (mark) { + found2.push(mark); + } else { + for (let prop in schema.marks) { + let mark2 = schema.marks[prop]; + if (name == "_" || mark2.spec.group && mark2.spec.group.split(" ").indexOf(name) > -1) + found2.push(ok3 = mark2); + } + } + if (!ok3) + throw new SyntaxError("Unknown mark type: '" + marks[i2] + "'"); + } + return found2; + } + function isTagRule(rule) { + return rule.tag != null; + } + function isStyleRule(rule) { + return rule.style != null; + } + var DOMParser = class _DOMParser { + /** + Create a parser that targets the given schema, using the given + parsing rules. + */ + constructor(schema, rules) { + this.schema = schema; + this.rules = rules; + this.tags = []; + this.styles = []; + rules.forEach((rule) => { + if (isTagRule(rule)) + this.tags.push(rule); + else if (isStyleRule(rule)) + this.styles.push(rule); + }); + this.normalizeLists = !this.tags.some((r3) => { + if (!/^(ul|ol)\b/.test(r3.tag) || !r3.node) + return false; + let node2 = schema.nodes[r3.node]; + return node2.contentMatch.matchType(node2); + }); + } + /** + Parse a document from the content of a DOM node. + */ + parse(dom, options2 = {}) { + let context = new ParseContext(this, options2, false); + context.addAll(dom, options2.from, options2.to); + return context.finish(); + } + /** + Parses the content of the given DOM node, like + [`parse`](https://prosemirror.net/docs/ref/#model.DOMParser.parse), and takes the same set of + options. But unlike that method, which produces a whole node, + this one returns a slice that is open at the sides, meaning that + the schema constraints aren't applied to the start of nodes to + the left of the input and the end of nodes at the end. + */ + parseSlice(dom, options2 = {}) { + let context = new ParseContext(this, options2, true); + context.addAll(dom, options2.from, options2.to); + return Slice.maxOpen(context.finish()); + } + /** + @internal + */ + matchTag(dom, context, after) { + for (let i2 = after ? this.tags.indexOf(after) + 1 : 0; i2 < this.tags.length; i2++) { + let rule = this.tags[i2]; + if (matches(dom, rule.tag) && (rule.namespace === void 0 || dom.namespaceURI == rule.namespace) && (!rule.context || context.matchesContext(rule.context))) { + if (rule.getAttrs) { + let result = rule.getAttrs(dom); + if (result === false) + continue; + rule.attrs = result || void 0; + } + return rule; + } + } + } + /** + @internal + */ + matchStyle(prop, value, context, after) { + for (let i2 = after ? this.styles.indexOf(after) + 1 : 0; i2 < this.styles.length; i2++) { + let rule = this.styles[i2], style2 = rule.style; + if (style2.indexOf(prop) != 0 || rule.context && !context.matchesContext(rule.context) || // Test that the style string either precisely matches the prop, + // or has an '=' sign after the prop, followed by the given + // value. + style2.length > prop.length && (style2.charCodeAt(prop.length) != 61 || style2.slice(prop.length + 1) != value)) + continue; + if (rule.getAttrs) { + let result = rule.getAttrs(value); + if (result === false) + continue; + rule.attrs = result || void 0; + } + return rule; + } + } + /** + @internal + */ + static schemaRules(schema) { + let result = []; + function insert(rule) { + let priority = rule.priority == null ? 50 : rule.priority, i2 = 0; + for (; i2 < result.length; i2++) { + let next = result[i2], nextPriority = next.priority == null ? 50 : next.priority; + if (nextPriority < priority) + break; + } + result.splice(i2, 0, rule); + } + for (let name in schema.marks) { + let rules = schema.marks[name].spec.parseDOM; + if (rules) + rules.forEach((rule) => { + insert(rule = copy(rule)); + if (!(rule.mark || rule.ignore || rule.clearMark)) + rule.mark = name; + }); + } + for (let name in schema.nodes) { + let rules = schema.nodes[name].spec.parseDOM; + if (rules) + rules.forEach((rule) => { + insert(rule = copy(rule)); + if (!(rule.node || rule.ignore || rule.mark)) + rule.node = name; + }); + } + return result; + } + /** + Construct a DOM parser using the parsing rules listed in a + schema's [node specs](https://prosemirror.net/docs/ref/#model.NodeSpec.parseDOM), reordered by + [priority](https://prosemirror.net/docs/ref/#model.ParseRule.priority). + */ + static fromSchema(schema) { + return schema.cached.domParser || (schema.cached.domParser = new _DOMParser(schema, _DOMParser.schemaRules(schema))); + } + }; + var blockTags = { + address: true, + article: true, + aside: true, + blockquote: true, + canvas: true, + dd: true, + div: true, + dl: true, + fieldset: true, + figcaption: true, + figure: true, + footer: true, + form: true, + h1: true, + h2: true, + h3: true, + h4: true, + h5: true, + h6: true, + header: true, + hgroup: true, + hr: true, + li: true, + noscript: true, + ol: true, + output: true, + p: true, + pre: true, + section: true, + table: true, + tfoot: true, + ul: true + }; + var ignoreTags = { + head: true, + noscript: true, + object: true, + script: true, + style: true, + title: true + }; + var listTags = { ol: true, ul: true }; + var OPT_PRESERVE_WS = 1; + var OPT_PRESERVE_WS_FULL = 2; + var OPT_OPEN_LEFT = 4; + function wsOptionsFor(type, preserveWhitespace, base2) { + if (preserveWhitespace != null) + return (preserveWhitespace ? OPT_PRESERVE_WS : 0) | (preserveWhitespace === "full" ? OPT_PRESERVE_WS_FULL : 0); + return type && type.whitespace == "pre" ? OPT_PRESERVE_WS | OPT_PRESERVE_WS_FULL : base2 & ~OPT_OPEN_LEFT; + } + var NodeContext = class { + constructor(type, attrs, marks, pendingMarks, solid, match, options2) { + this.type = type; + this.attrs = attrs; + this.marks = marks; + this.pendingMarks = pendingMarks; + this.solid = solid; + this.options = options2; + this.content = []; + this.activeMarks = Mark.none; + this.stashMarks = []; + this.match = match || (options2 & OPT_OPEN_LEFT ? null : type.contentMatch); + } + findWrapping(node2) { + if (!this.match) { + if (!this.type) + return []; + let fill = this.type.contentMatch.fillBefore(Fragment.from(node2)); + if (fill) { + this.match = this.type.contentMatch.matchFragment(fill); + } else { + let start = this.type.contentMatch, wrap3; + if (wrap3 = start.findWrapping(node2.type)) { + this.match = start; + return wrap3; + } else { + return null; + } + } + } + return this.match.findWrapping(node2.type); + } + finish(openEnd) { + if (!(this.options & OPT_PRESERVE_WS)) { + let last = this.content[this.content.length - 1], m3; + if (last && last.isText && (m3 = /[ \t\r\n\u000c]+$/.exec(last.text))) { + let text5 = last; + if (last.text.length == m3[0].length) + this.content.pop(); + else + this.content[this.content.length - 1] = text5.withText(text5.text.slice(0, text5.text.length - m3[0].length)); + } + } + let content3 = Fragment.from(this.content); + if (!openEnd && this.match) + content3 = content3.append(this.match.fillBefore(Fragment.empty, true)); + return this.type ? this.type.create(this.attrs, content3, this.marks) : content3; + } + popFromStashMark(mark) { + for (let i2 = this.stashMarks.length - 1; i2 >= 0; i2--) + if (mark.eq(this.stashMarks[i2])) + return this.stashMarks.splice(i2, 1)[0]; + } + applyPending(nextType) { + for (let i2 = 0, pending = this.pendingMarks; i2 < pending.length; i2++) { + let mark = pending[i2]; + if ((this.type ? this.type.allowsMarkType(mark.type) : markMayApply(mark.type, nextType)) && !mark.isInSet(this.activeMarks)) { + this.activeMarks = mark.addToSet(this.activeMarks); + this.pendingMarks = mark.removeFromSet(this.pendingMarks); + } + } + } + inlineContext(node2) { + if (this.type) + return this.type.inlineContent; + if (this.content.length) + return this.content[0].isInline; + return node2.parentNode && !blockTags.hasOwnProperty(node2.parentNode.nodeName.toLowerCase()); + } + }; + var ParseContext = class { + constructor(parser, options2, isOpen) { + this.parser = parser; + this.options = options2; + this.isOpen = isOpen; + this.open = 0; + let topNode = options2.topNode, topContext; + let topOptions = wsOptionsFor(null, options2.preserveWhitespace, 0) | (isOpen ? OPT_OPEN_LEFT : 0); + if (topNode) + topContext = new NodeContext(topNode.type, topNode.attrs, Mark.none, Mark.none, true, options2.topMatch || topNode.type.contentMatch, topOptions); + else if (isOpen) + topContext = new NodeContext(null, null, Mark.none, Mark.none, true, null, topOptions); + else + topContext = new NodeContext(parser.schema.topNodeType, null, Mark.none, Mark.none, true, null, topOptions); + this.nodes = [topContext]; + this.find = options2.findPositions; + this.needsBlock = false; + } + get top() { + return this.nodes[this.open]; + } + // Add a DOM node to the content. Text is inserted as text node, + // otherwise, the node is passed to `addElement` or, if it has a + // `style` attribute, `addElementWithStyles`. + addDOM(dom) { + if (dom.nodeType == 3) + this.addTextNode(dom); + else if (dom.nodeType == 1) + this.addElement(dom); + } + withStyleRules(dom, f3) { + let style2 = dom.getAttribute("style"); + if (!style2) + return f3(); + let marks = this.readStyles(parseStyles(style2)); + if (!marks) + return; + let [addMarks, removeMarks] = marks, top = this.top; + for (let i2 = 0; i2 < removeMarks.length; i2++) + this.removePendingMark(removeMarks[i2], top); + for (let i2 = 0; i2 < addMarks.length; i2++) + this.addPendingMark(addMarks[i2]); + f3(); + for (let i2 = 0; i2 < addMarks.length; i2++) + this.removePendingMark(addMarks[i2], top); + for (let i2 = 0; i2 < removeMarks.length; i2++) + this.addPendingMark(removeMarks[i2]); + } + addTextNode(dom) { + let value = dom.nodeValue; + let top = this.top; + if (top.options & OPT_PRESERVE_WS_FULL || top.inlineContext(dom) || /[^ \t\r\n\u000c]/.test(value)) { + if (!(top.options & OPT_PRESERVE_WS)) { + value = value.replace(/[ \t\r\n\u000c]+/g, " "); + if (/^[ \t\r\n\u000c]/.test(value) && this.open == this.nodes.length - 1) { + let nodeBefore = top.content[top.content.length - 1]; + let domNodeBefore = dom.previousSibling; + if (!nodeBefore || domNodeBefore && domNodeBefore.nodeName == "BR" || nodeBefore.isText && /[ \t\r\n\u000c]$/.test(nodeBefore.text)) + value = value.slice(1); + } + } else if (!(top.options & OPT_PRESERVE_WS_FULL)) { + value = value.replace(/\r?\n|\r/g, " "); + } else { + value = value.replace(/\r\n?/g, "\n"); + } + if (value) + this.insertNode(this.parser.schema.text(value)); + this.findInText(dom); + } else { + this.findInside(dom); + } + } + // Try to find a handler for the given tag and use that to parse. If + // none is found, the element's content nodes are added directly. + addElement(dom, matchAfter) { + let name = dom.nodeName.toLowerCase(), ruleID; + if (listTags.hasOwnProperty(name) && this.parser.normalizeLists) + normalizeList(dom); + let rule = this.options.ruleFromNode && this.options.ruleFromNode(dom) || (ruleID = this.parser.matchTag(dom, this, matchAfter)); + if (rule ? rule.ignore : ignoreTags.hasOwnProperty(name)) { + this.findInside(dom); + this.ignoreFallback(dom); + } else if (!rule || rule.skip || rule.closeParent) { + if (rule && rule.closeParent) + this.open = Math.max(0, this.open - 1); + else if (rule && rule.skip.nodeType) + dom = rule.skip; + let sync, top = this.top, oldNeedsBlock = this.needsBlock; + if (blockTags.hasOwnProperty(name)) { + if (top.content.length && top.content[0].isInline && this.open) { + this.open--; + top = this.top; + } + sync = true; + if (!top.type) + this.needsBlock = true; + } else if (!dom.firstChild) { + this.leafFallback(dom); + return; + } + if (rule && rule.skip) + this.addAll(dom); + else + this.withStyleRules(dom, () => this.addAll(dom)); + if (sync) + this.sync(top); + this.needsBlock = oldNeedsBlock; + } else { + this.withStyleRules(dom, () => { + this.addElementByRule(dom, rule, rule.consuming === false ? ruleID : void 0); + }); + } + } + // Called for leaf DOM nodes that would otherwise be ignored + leafFallback(dom) { + if (dom.nodeName == "BR" && this.top.type && this.top.type.inlineContent) + this.addTextNode(dom.ownerDocument.createTextNode("\n")); + } + // Called for ignored nodes + ignoreFallback(dom) { + if (dom.nodeName == "BR" && (!this.top.type || !this.top.type.inlineContent)) + this.findPlace(this.parser.schema.text("-")); + } + // Run any style parser associated with the node's styles. Either + // return an array of marks, or null to indicate some of the styles + // had a rule with `ignore` set. + readStyles(styles) { + let add = Mark.none, remove = Mark.none; + for (let i2 = 0; i2 < styles.length; i2 += 2) { + for (let after = void 0; ; ) { + let rule = this.parser.matchStyle(styles[i2], styles[i2 + 1], this, after); + if (!rule) + break; + if (rule.ignore) + return null; + if (rule.clearMark) { + this.top.pendingMarks.concat(this.top.activeMarks).forEach((m3) => { + if (rule.clearMark(m3)) + remove = m3.addToSet(remove); + }); + } else { + add = this.parser.schema.marks[rule.mark].create(rule.attrs).addToSet(add); + } + if (rule.consuming === false) + after = rule; + else + break; + } + } + return [add, remove]; + } + // Look up a handler for the given node. If none are found, return + // false. Otherwise, apply it, use its return value to drive the way + // the node's content is wrapped, and return true. + addElementByRule(dom, rule, continueAfter) { + let sync, nodeType, mark; + if (rule.node) { + nodeType = this.parser.schema.nodes[rule.node]; + if (!nodeType.isLeaf) { + sync = this.enter(nodeType, rule.attrs || null, rule.preserveWhitespace); + } else if (!this.insertNode(nodeType.create(rule.attrs))) { + this.leafFallback(dom); + } + } else { + let markType = this.parser.schema.marks[rule.mark]; + mark = markType.create(rule.attrs); + this.addPendingMark(mark); + } + let startIn = this.top; + if (nodeType && nodeType.isLeaf) { + this.findInside(dom); + } else if (continueAfter) { + this.addElement(dom, continueAfter); + } else if (rule.getContent) { + this.findInside(dom); + rule.getContent(dom, this.parser.schema).forEach((node2) => this.insertNode(node2)); + } else { + let contentDOM = dom; + if (typeof rule.contentElement == "string") + contentDOM = dom.querySelector(rule.contentElement); + else if (typeof rule.contentElement == "function") + contentDOM = rule.contentElement(dom); + else if (rule.contentElement) + contentDOM = rule.contentElement; + this.findAround(dom, contentDOM, true); + this.addAll(contentDOM); + } + if (sync && this.sync(startIn)) + this.open--; + if (mark) + this.removePendingMark(mark, startIn); + } + // Add all child nodes between `startIndex` and `endIndex` (or the + // whole node, if not given). If `sync` is passed, use it to + // synchronize after every block element. + addAll(parent, startIndex, endIndex) { + let index2 = startIndex || 0; + for (let dom = startIndex ? parent.childNodes[startIndex] : parent.firstChild, end = endIndex == null ? null : parent.childNodes[endIndex]; dom != end; dom = dom.nextSibling, ++index2) { + this.findAtPoint(parent, index2); + this.addDOM(dom); + } + this.findAtPoint(parent, index2); + } + // Try to find a way to fit the given node type into the current + // context. May add intermediate wrappers and/or leave non-solid + // nodes that we're in. + findPlace(node2) { + let route, sync; + for (let depth = this.open; depth >= 0; depth--) { + let cx = this.nodes[depth]; + let found2 = cx.findWrapping(node2); + if (found2 && (!route || route.length > found2.length)) { + route = found2; + sync = cx; + if (!found2.length) + break; + } + if (cx.solid) + break; + } + if (!route) + return false; + this.sync(sync); + for (let i2 = 0; i2 < route.length; i2++) + this.enterInner(route[i2], null, false); + return true; + } + // Try to insert the given node, adjusting the context when needed. + insertNode(node2) { + if (node2.isInline && this.needsBlock && !this.top.type) { + let block = this.textblockFromContext(); + if (block) + this.enterInner(block); + } + if (this.findPlace(node2)) { + this.closeExtra(); + let top = this.top; + top.applyPending(node2.type); + if (top.match) + top.match = top.match.matchType(node2.type); + let marks = top.activeMarks; + for (let i2 = 0; i2 < node2.marks.length; i2++) + if (!top.type || top.type.allowsMarkType(node2.marks[i2].type)) + marks = node2.marks[i2].addToSet(marks); + top.content.push(node2.mark(marks)); + return true; + } + return false; + } + // Try to start a node of the given type, adjusting the context when + // necessary. + enter(type, attrs, preserveWS) { + let ok3 = this.findPlace(type.create(attrs)); + if (ok3) + this.enterInner(type, attrs, true, preserveWS); + return ok3; + } + // Open a node of the given type + enterInner(type, attrs = null, solid = false, preserveWS) { + this.closeExtra(); + let top = this.top; + top.applyPending(type); + top.match = top.match && top.match.matchType(type); + let options2 = wsOptionsFor(type, preserveWS, top.options); + if (top.options & OPT_OPEN_LEFT && top.content.length == 0) + options2 |= OPT_OPEN_LEFT; + this.nodes.push(new NodeContext(type, attrs, top.activeMarks, top.pendingMarks, solid, null, options2)); + this.open++; + } + // Make sure all nodes above this.open are finished and added to + // their parents + closeExtra(openEnd = false) { + let i2 = this.nodes.length - 1; + if (i2 > this.open) { + for (; i2 > this.open; i2--) + this.nodes[i2 - 1].content.push(this.nodes[i2].finish(openEnd)); + this.nodes.length = this.open + 1; + } + } + finish() { + this.open = 0; + this.closeExtra(this.isOpen); + return this.nodes[0].finish(this.isOpen || this.options.topOpen); + } + sync(to) { + for (let i2 = this.open; i2 >= 0; i2--) + if (this.nodes[i2] == to) { + this.open = i2; + return true; + } + return false; + } + get currentPos() { + this.closeExtra(); + let pos = 0; + for (let i2 = this.open; i2 >= 0; i2--) { + let content3 = this.nodes[i2].content; + for (let j6 = content3.length - 1; j6 >= 0; j6--) + pos += content3[j6].nodeSize; + if (i2) + pos++; + } + return pos; + } + findAtPoint(parent, offset) { + if (this.find) + for (let i2 = 0; i2 < this.find.length; i2++) { + if (this.find[i2].node == parent && this.find[i2].offset == offset) + this.find[i2].pos = this.currentPos; + } + } + findInside(parent) { + if (this.find) + for (let i2 = 0; i2 < this.find.length; i2++) { + if (this.find[i2].pos == null && parent.nodeType == 1 && parent.contains(this.find[i2].node)) + this.find[i2].pos = this.currentPos; + } + } + findAround(parent, content3, before) { + if (parent != content3 && this.find) + for (let i2 = 0; i2 < this.find.length; i2++) { + if (this.find[i2].pos == null && parent.nodeType == 1 && parent.contains(this.find[i2].node)) { + let pos = content3.compareDocumentPosition(this.find[i2].node); + if (pos & (before ? 2 : 4)) + this.find[i2].pos = this.currentPos; + } + } + } + findInText(textNode) { + if (this.find) + for (let i2 = 0; i2 < this.find.length; i2++) { + if (this.find[i2].node == textNode) + this.find[i2].pos = this.currentPos - (textNode.nodeValue.length - this.find[i2].offset); + } + } + // Determines whether the given context string matches this context. + matchesContext(context) { + if (context.indexOf("|") > -1) + return context.split(/\s*\|\s*/).some(this.matchesContext, this); + let parts = context.split("/"); + let option = this.options.context; + let useRoot = !this.isOpen && (!option || option.parent.type == this.nodes[0].type); + let minDepth = -(option ? option.depth + 1 : 0) + (useRoot ? 0 : 1); + let match = (i2, depth) => { + for (; i2 >= 0; i2--) { + let part = parts[i2]; + if (part == "") { + if (i2 == parts.length - 1 || i2 == 0) + continue; + for (; depth >= minDepth; depth--) + if (match(i2 - 1, depth)) + return true; + return false; + } else { + let next = depth > 0 || depth == 0 && useRoot ? this.nodes[depth].type : option && depth >= minDepth ? option.node(depth - minDepth).type : null; + if (!next || next.name != part && next.groups.indexOf(part) == -1) + return false; + depth--; + } + } + return true; + }; + return match(parts.length - 1, this.open); + } + textblockFromContext() { + let $context = this.options.context; + if ($context) + for (let d6 = $context.depth; d6 >= 0; d6--) { + let deflt = $context.node(d6).contentMatchAt($context.indexAfter(d6)).defaultType; + if (deflt && deflt.isTextblock && deflt.defaultAttrs) + return deflt; + } + for (let name in this.parser.schema.nodes) { + let type = this.parser.schema.nodes[name]; + if (type.isTextblock && type.defaultAttrs) + return type; + } + } + addPendingMark(mark) { + let found2 = findSameMarkInSet(mark, this.top.pendingMarks); + if (found2) + this.top.stashMarks.push(found2); + this.top.pendingMarks = mark.addToSet(this.top.pendingMarks); + } + removePendingMark(mark, upto) { + for (let depth = this.open; depth >= 0; depth--) { + let level = this.nodes[depth]; + let found2 = level.pendingMarks.lastIndexOf(mark); + if (found2 > -1) { + level.pendingMarks = mark.removeFromSet(level.pendingMarks); + } else { + level.activeMarks = mark.removeFromSet(level.activeMarks); + let stashMark = level.popFromStashMark(mark); + if (stashMark && level.type && level.type.allowsMarkType(stashMark.type)) + level.activeMarks = stashMark.addToSet(level.activeMarks); + } + if (level == upto) + break; + } + } + }; + function normalizeList(dom) { + for (let child = dom.firstChild, prevItem = null; child; child = child.nextSibling) { + let name = child.nodeType == 1 ? child.nodeName.toLowerCase() : null; + if (name && listTags.hasOwnProperty(name) && prevItem) { + prevItem.appendChild(child); + child = prevItem; + } else if (name == "li") { + prevItem = child; + } else if (name) { + prevItem = null; + } + } + } + function matches(dom, selector) { + return (dom.matches || dom.msMatchesSelector || dom.webkitMatchesSelector || dom.mozMatchesSelector).call(dom, selector); + } + function parseStyles(style2) { + let re4 = /\s*([\w-]+)\s*:\s*([^;]+)/g, m3, result = []; + while (m3 = re4.exec(style2)) + result.push(m3[1], m3[2].trim()); + return result; + } + function copy(obj) { + let copy2 = {}; + for (let prop in obj) + copy2[prop] = obj[prop]; + return copy2; + } + function markMayApply(markType, nodeType) { + let nodes = nodeType.schema.nodes; + for (let name in nodes) { + let parent = nodes[name]; + if (!parent.allowsMarkType(markType)) + continue; + let seen = [], scan = (match) => { + seen.push(match); + for (let i2 = 0; i2 < match.edgeCount; i2++) { + let { type, next } = match.edge(i2); + if (type == nodeType) + return true; + if (seen.indexOf(next) < 0 && scan(next)) + return true; + } + }; + if (scan(parent.contentMatch)) + return true; + } + } + function findSameMarkInSet(mark, set) { + for (let i2 = 0; i2 < set.length; i2++) { + if (mark.eq(set[i2])) + return set[i2]; + } + } + var DOMSerializer = class _DOMSerializer { + /** + Create a serializer. `nodes` should map node names to functions + that take a node and return a description of the corresponding + DOM. `marks` does the same for mark names, but also gets an + argument that tells it whether the mark's content is block or + inline content (for typical use, it'll always be inline). A mark + serializer may be `null` to indicate that marks of that type + should not be serialized. + */ + constructor(nodes, marks) { + this.nodes = nodes; + this.marks = marks; + } + /** + Serialize the content of this fragment to a DOM fragment. When + not in the browser, the `document` option, containing a DOM + document, should be passed so that the serializer can create + nodes. + */ + serializeFragment(fragment, options2 = {}, target) { + if (!target) + target = doc(options2).createDocumentFragment(); + let top = target, active = []; + fragment.forEach((node2) => { + if (active.length || node2.marks.length) { + let keep = 0, rendered = 0; + while (keep < active.length && rendered < node2.marks.length) { + let next = node2.marks[rendered]; + if (!this.marks[next.type.name]) { + rendered++; + continue; + } + if (!next.eq(active[keep][0]) || next.type.spec.spanning === false) + break; + keep++; + rendered++; + } + while (keep < active.length) + top = active.pop()[1]; + while (rendered < node2.marks.length) { + let add = node2.marks[rendered++]; + let markDOM = this.serializeMark(add, node2.isInline, options2); + if (markDOM) { + active.push([add, top]); + top.appendChild(markDOM.dom); + top = markDOM.contentDOM || markDOM.dom; + } + } + } + top.appendChild(this.serializeNodeInner(node2, options2)); + }); + return target; + } + /** + @internal + */ + serializeNodeInner(node2, options2) { + let { dom, contentDOM } = _DOMSerializer.renderSpec(doc(options2), this.nodes[node2.type.name](node2)); + if (contentDOM) { + if (node2.isLeaf) + throw new RangeError("Content hole not allowed in a leaf node spec"); + this.serializeFragment(node2.content, options2, contentDOM); + } + return dom; + } + /** + Serialize this node to a DOM node. This can be useful when you + need to serialize a part of a document, as opposed to the whole + document. To serialize a whole document, use + [`serializeFragment`](https://prosemirror.net/docs/ref/#model.DOMSerializer.serializeFragment) on + its [content](https://prosemirror.net/docs/ref/#model.Node.content). + */ + serializeNode(node2, options2 = {}) { + let dom = this.serializeNodeInner(node2, options2); + for (let i2 = node2.marks.length - 1; i2 >= 0; i2--) { + let wrap3 = this.serializeMark(node2.marks[i2], node2.isInline, options2); + if (wrap3) { + (wrap3.contentDOM || wrap3.dom).appendChild(dom); + dom = wrap3.dom; + } + } + return dom; + } + /** + @internal + */ + serializeMark(mark, inline, options2 = {}) { + let toDOM = this.marks[mark.type.name]; + return toDOM && _DOMSerializer.renderSpec(doc(options2), toDOM(mark, inline)); + } + /** + Render an [output spec](https://prosemirror.net/docs/ref/#model.DOMOutputSpec) to a DOM node. If + the spec has a hole (zero) in it, `contentDOM` will point at the + node with the hole. + */ + static renderSpec(doc4, structure, xmlNS = null) { + if (typeof structure == "string") + return { dom: doc4.createTextNode(structure) }; + if (structure.nodeType != null) + return { dom: structure }; + if (structure.dom && structure.dom.nodeType != null) + return structure; + let tagName = structure[0], space = tagName.indexOf(" "); + if (space > 0) { + xmlNS = tagName.slice(0, space); + tagName = tagName.slice(space + 1); + } + let contentDOM; + let dom = xmlNS ? doc4.createElementNS(xmlNS, tagName) : doc4.createElement(tagName); + let attrs = structure[1], start = 1; + if (attrs && typeof attrs == "object" && attrs.nodeType == null && !Array.isArray(attrs)) { + start = 2; + for (let name in attrs) + if (attrs[name] != null) { + let space2 = name.indexOf(" "); + if (space2 > 0) + dom.setAttributeNS(name.slice(0, space2), name.slice(space2 + 1), attrs[name]); + else + dom.setAttribute(name, attrs[name]); + } + } + for (let i2 = start; i2 < structure.length; i2++) { + let child = structure[i2]; + if (child === 0) { + if (i2 < structure.length - 1 || i2 > start) + throw new RangeError("Content hole must be the only child of its parent node"); + return { dom, contentDOM: dom }; + } else { + let { dom: inner, contentDOM: innerContent } = _DOMSerializer.renderSpec(doc4, child, xmlNS); + dom.appendChild(inner); + if (innerContent) { + if (contentDOM) + throw new RangeError("Multiple content holes"); + contentDOM = innerContent; + } + } + } + return { dom, contentDOM }; + } + /** + Build a serializer using the [`toDOM`](https://prosemirror.net/docs/ref/#model.NodeSpec.toDOM) + properties in a schema's node and mark specs. + */ + static fromSchema(schema) { + return schema.cached.domSerializer || (schema.cached.domSerializer = new _DOMSerializer(this.nodesFromSchema(schema), this.marksFromSchema(schema))); + } + /** + Gather the serializers in a schema's node specs into an object. + This can be useful as a base to build a custom serializer from. + */ + static nodesFromSchema(schema) { + let result = gatherToDOM(schema.nodes); + if (!result.text) + result.text = (node2) => node2.text; + return result; + } + /** + Gather the serializers in a schema's mark specs into an object. + */ + static marksFromSchema(schema) { + return gatherToDOM(schema.marks); + } + }; + function gatherToDOM(obj) { + let result = {}; + for (let name in obj) { + let toDOM = obj[name].spec.toDOM; + if (toDOM) + result[name] = toDOM; + } + return result; + } + function doc(options2) { + return options2.document || window.document; + } + + // node_modules/mdast-util-to-string/lib/index.js + var emptyOptions = {}; + function toString(value, options2) { + const settings = options2 || emptyOptions; + const includeImageAlt = typeof settings.includeImageAlt === "boolean" ? settings.includeImageAlt : true; + const includeHtml = typeof settings.includeHtml === "boolean" ? settings.includeHtml : true; + return one(value, includeImageAlt, includeHtml); + } + function one(value, includeImageAlt, includeHtml) { + if (node(value)) { + if ("value" in value) { + return value.type === "html" && !includeHtml ? "" : value.value; + } + if (includeImageAlt && "alt" in value && value.alt) { + return value.alt; + } + if ("children" in value) { + return all(value.children, includeImageAlt, includeHtml); + } + } + if (Array.isArray(value)) { + return all(value, includeImageAlt, includeHtml); + } + return ""; + } + function all(values, includeImageAlt, includeHtml) { + const result = []; + let index2 = -1; + while (++index2 < values.length) { + result[index2] = one(values[index2], includeImageAlt, includeHtml); + } + return result.join(""); + } + function node(value) { + return Boolean(value && typeof value === "object"); + } + + // node_modules/decode-named-character-reference/index.dom.js + var element = document.createElement("i"); + function decodeNamedCharacterReference(value) { + const characterReference2 = "&" + value + ";"; + element.innerHTML = characterReference2; + const char = element.textContent; + if (char.charCodeAt(char.length - 1) === 59 && value !== "semi") { + return false; + } + return char === characterReference2 ? false : char; + } + + // node_modules/micromark-util-chunked/index.js + function splice(list4, start, remove, items) { + const end = list4.length; + let chunkStart = 0; + let parameters; + if (start < 0) { + start = -start > end ? 0 : end + start; + } else { + start = start > end ? end : start; + } + remove = remove > 0 ? remove : 0; + if (items.length < 1e4) { + parameters = Array.from(items); + parameters.unshift(start, remove); + list4.splice(...parameters); + } else { + if (remove) list4.splice(start, remove); + while (chunkStart < items.length) { + parameters = items.slice(chunkStart, chunkStart + 1e4); + parameters.unshift(start, 0); + list4.splice(...parameters); + chunkStart += 1e4; + start += 1e4; + } + } + } + function push(list4, items) { + if (list4.length > 0) { + splice(list4, list4.length, 0, items); + return list4; + } + return items; + } + + // node_modules/micromark-util-combine-extensions/index.js + var hasOwnProperty = {}.hasOwnProperty; + function combineExtensions(extensions) { + const all2 = {}; + let index2 = -1; + while (++index2 < extensions.length) { + syntaxExtension(all2, extensions[index2]); + } + return all2; + } + function syntaxExtension(all2, extension2) { + let hook; + for (hook in extension2) { + const maybe = hasOwnProperty.call(all2, hook) ? all2[hook] : void 0; + const left = maybe || (all2[hook] = {}); + const right = extension2[hook]; + let code3; + if (right) { + for (code3 in right) { + if (!hasOwnProperty.call(left, code3)) left[code3] = []; + const value = right[code3]; + constructs( + // @ts-expect-error Looks like a list. + left[code3], + Array.isArray(value) ? value : value ? [value] : [] + ); + } + } + } + } + function constructs(existing, list4) { + let index2 = -1; + const before = []; + while (++index2 < list4.length) { + ; + (list4[index2].add === "after" ? existing : before).push(list4[index2]); + } + splice(existing, 0, 0, before); + } + + // node_modules/micromark-util-decode-numeric-character-reference/index.js + function decodeNumericCharacterReference(value, base2) { + const code3 = Number.parseInt(value, base2); + if ( + // C0 except for HT, LF, FF, CR, space. + code3 < 9 || code3 === 11 || code3 > 13 && code3 < 32 || // Control character (DEL) of C0, and C1 controls. + code3 > 126 && code3 < 160 || // Lone high surrogates and low surrogates. + code3 > 55295 && code3 < 57344 || // Noncharacters. + code3 > 64975 && code3 < 65008 || /* eslint-disable no-bitwise */ + (code3 & 65535) === 65535 || (code3 & 65535) === 65534 || /* eslint-enable no-bitwise */ + // Out of range + code3 > 1114111 + ) { + return "\uFFFD"; + } + return String.fromCodePoint(code3); + } + + // node_modules/micromark-util-normalize-identifier/index.js + function normalizeIdentifier(value) { + return value.replace(/[\t\n\r ]+/g, " ").replace(/^ | $/g, "").toLowerCase().toUpperCase(); + } + + // node_modules/micromark-util-character/index.js + var asciiAlpha = regexCheck(/[A-Za-z]/); + var asciiAlphanumeric = regexCheck(/[\dA-Za-z]/); + var asciiAtext = regexCheck(/[#-'*+\--9=?A-Z^-~]/); + function asciiControl(code3) { + return ( + // Special whitespace codes (which have negative values), C0 and Control + // character DEL + code3 !== null && (code3 < 32 || code3 === 127) + ); + } + var asciiDigit = regexCheck(/\d/); + var asciiHexDigit = regexCheck(/[\dA-Fa-f]/); + var asciiPunctuation = regexCheck(/[!-/:-@[-`{-~]/); + function markdownLineEnding(code3) { + return code3 !== null && code3 < -2; + } + function markdownLineEndingOrSpace(code3) { + return code3 !== null && (code3 < 0 || code3 === 32); + } + function markdownSpace(code3) { + return code3 === -2 || code3 === -1 || code3 === 32; + } + var unicodePunctuation = regexCheck(new RegExp("\\p{P}|\\p{S}", "u")); + var unicodeWhitespace = regexCheck(/\s/); + function regexCheck(regex) { + return check; + function check(code3) { + return code3 !== null && code3 > -1 && regex.test(String.fromCharCode(code3)); + } + } + + // node_modules/micromark-factory-space/index.js + function factorySpace(effects, ok3, type, max) { + const limit = max ? max - 1 : Number.POSITIVE_INFINITY; + let size = 0; + return start; + function start(code3) { + if (markdownSpace(code3)) { + effects.enter(type); + return prefix(code3); + } + return ok3(code3); + } + function prefix(code3) { + if (markdownSpace(code3) && size++ < limit) { + effects.consume(code3); + return prefix; + } + effects.exit(type); + return ok3(code3); + } + } + + // node_modules/micromark/lib/initialize/content.js + var content = { + tokenize: initializeContent + }; + function initializeContent(effects) { + const contentStart = effects.attempt( + this.parser.constructs.contentInitial, + afterContentStartConstruct, + paragraphInitial + ); + let previous3; + return contentStart; + function afterContentStartConstruct(code3) { + if (code3 === null) { + effects.consume(code3); + return; + } + effects.enter("lineEnding"); + effects.consume(code3); + effects.exit("lineEnding"); + return factorySpace(effects, contentStart, "linePrefix"); + } + function paragraphInitial(code3) { + effects.enter("paragraph"); + return lineStart(code3); + } + function lineStart(code3) { + const token = effects.enter("chunkText", { + contentType: "text", + previous: previous3 + }); + if (previous3) { + previous3.next = token; + } + previous3 = token; + return data(code3); + } + function data(code3) { + if (code3 === null) { + effects.exit("chunkText"); + effects.exit("paragraph"); + effects.consume(code3); + return; + } + if (markdownLineEnding(code3)) { + effects.consume(code3); + effects.exit("chunkText"); + return lineStart; + } + effects.consume(code3); + return data; + } + } + + // node_modules/micromark/lib/initialize/document.js + var document2 = { + tokenize: initializeDocument + }; + var containerConstruct = { + tokenize: tokenizeContainer + }; + function initializeDocument(effects) { + const self2 = this; + const stack = []; + let continued = 0; + let childFlow; + let childToken; + let lineStartOffset; + return start; + function start(code3) { + if (continued < stack.length) { + const item = stack[continued]; + self2.containerState = item[1]; + return effects.attempt( + item[0].continuation, + documentContinue, + checkNewContainers + )(code3); + } + return checkNewContainers(code3); + } + function documentContinue(code3) { + continued++; + if (self2.containerState._closeFlow) { + self2.containerState._closeFlow = void 0; + if (childFlow) { + closeFlow(); + } + const indexBeforeExits = self2.events.length; + let indexBeforeFlow = indexBeforeExits; + let point3; + while (indexBeforeFlow--) { + if (self2.events[indexBeforeFlow][0] === "exit" && self2.events[indexBeforeFlow][1].type === "chunkFlow") { + point3 = self2.events[indexBeforeFlow][1].end; + break; + } + } + exitContainers(continued); + let index2 = indexBeforeExits; + while (index2 < self2.events.length) { + self2.events[index2][1].end = Object.assign({}, point3); + index2++; + } + splice( + self2.events, + indexBeforeFlow + 1, + 0, + self2.events.slice(indexBeforeExits) + ); + self2.events.length = index2; + return checkNewContainers(code3); + } + return start(code3); + } + function checkNewContainers(code3) { + if (continued === stack.length) { + if (!childFlow) { + return documentContinued(code3); + } + if (childFlow.currentConstruct && childFlow.currentConstruct.concrete) { + return flowStart(code3); + } + self2.interrupt = Boolean( + childFlow.currentConstruct && !childFlow._gfmTableDynamicInterruptHack + ); + } + self2.containerState = {}; + return effects.check( + containerConstruct, + thereIsANewContainer, + thereIsNoNewContainer + )(code3); + } + function thereIsANewContainer(code3) { + if (childFlow) closeFlow(); + exitContainers(continued); + return documentContinued(code3); + } + function thereIsNoNewContainer(code3) { + self2.parser.lazy[self2.now().line] = continued !== stack.length; + lineStartOffset = self2.now().offset; + return flowStart(code3); + } + function documentContinued(code3) { + self2.containerState = {}; + return effects.attempt( + containerConstruct, + containerContinue, + flowStart + )(code3); + } + function containerContinue(code3) { + continued++; + stack.push([self2.currentConstruct, self2.containerState]); + return documentContinued(code3); + } + function flowStart(code3) { + if (code3 === null) { + if (childFlow) closeFlow(); + exitContainers(0); + effects.consume(code3); + return; + } + childFlow = childFlow || self2.parser.flow(self2.now()); + effects.enter("chunkFlow", { + contentType: "flow", + previous: childToken, + _tokenizer: childFlow + }); + return flowContinue(code3); + } + function flowContinue(code3) { + if (code3 === null) { + writeToChild(effects.exit("chunkFlow"), true); + exitContainers(0); + effects.consume(code3); + return; + } + if (markdownLineEnding(code3)) { + effects.consume(code3); + writeToChild(effects.exit("chunkFlow")); + continued = 0; + self2.interrupt = void 0; + return start; + } + effects.consume(code3); + return flowContinue; + } + function writeToChild(token, eof) { + const stream = self2.sliceStream(token); + if (eof) stream.push(null); + token.previous = childToken; + if (childToken) childToken.next = token; + childToken = token; + childFlow.defineSkip(token.start); + childFlow.write(stream); + if (self2.parser.lazy[token.start.line]) { + let index2 = childFlow.events.length; + while (index2--) { + if ( + // The token starts before the line ending… + childFlow.events[index2][1].start.offset < lineStartOffset && // …and either is not ended yet… + (!childFlow.events[index2][1].end || // …or ends after it. + childFlow.events[index2][1].end.offset > lineStartOffset) + ) { + return; + } + } + const indexBeforeExits = self2.events.length; + let indexBeforeFlow = indexBeforeExits; + let seen; + let point3; + while (indexBeforeFlow--) { + if (self2.events[indexBeforeFlow][0] === "exit" && self2.events[indexBeforeFlow][1].type === "chunkFlow") { + if (seen) { + point3 = self2.events[indexBeforeFlow][1].end; + break; + } + seen = true; + } + } + exitContainers(continued); + index2 = indexBeforeExits; + while (index2 < self2.events.length) { + self2.events[index2][1].end = Object.assign({}, point3); + index2++; + } + splice( + self2.events, + indexBeforeFlow + 1, + 0, + self2.events.slice(indexBeforeExits) + ); + self2.events.length = index2; + } + } + function exitContainers(size) { + let index2 = stack.length; + while (index2-- > size) { + const entry = stack[index2]; + self2.containerState = entry[1]; + entry[0].exit.call(self2, effects); + } + stack.length = size; + } + function closeFlow() { + childFlow.write([null]); + childToken = void 0; + childFlow = void 0; + self2.containerState._closeFlow = void 0; + } + } + function tokenizeContainer(effects, ok3, nok) { + return factorySpace( + effects, + effects.attempt(this.parser.constructs.document, ok3, nok), + "linePrefix", + this.parser.constructs.disable.null.includes("codeIndented") ? void 0 : 4 + ); + } + + // node_modules/micromark-util-classify-character/index.js + function classifyCharacter(code3) { + if (code3 === null || markdownLineEndingOrSpace(code3) || unicodeWhitespace(code3)) { + return 1; + } + if (unicodePunctuation(code3)) { + return 2; + } + } + + // node_modules/micromark-util-resolve-all/index.js + function resolveAll(constructs2, events, context) { + const called = []; + let index2 = -1; + while (++index2 < constructs2.length) { + const resolve = constructs2[index2].resolveAll; + if (resolve && !called.includes(resolve)) { + events = resolve(events, context); + called.push(resolve); + } + } + return events; + } + + // node_modules/micromark-core-commonmark/lib/attention.js + var attention = { + name: "attention", + tokenize: tokenizeAttention, + resolveAll: resolveAllAttention + }; + function resolveAllAttention(events, context) { + let index2 = -1; + let open; + let group; + let text5; + let openingSequence; + let closingSequence; + let use; + let nextEvents; + let offset; + while (++index2 < events.length) { + if (events[index2][0] === "enter" && events[index2][1].type === "attentionSequence" && events[index2][1]._close) { + open = index2; + while (open--) { + if (events[open][0] === "exit" && events[open][1].type === "attentionSequence" && events[open][1]._open && // If the markers are the same: + context.sliceSerialize(events[open][1]).charCodeAt(0) === context.sliceSerialize(events[index2][1]).charCodeAt(0)) { + if ((events[open][1]._close || events[index2][1]._open) && (events[index2][1].end.offset - events[index2][1].start.offset) % 3 && !((events[open][1].end.offset - events[open][1].start.offset + events[index2][1].end.offset - events[index2][1].start.offset) % 3)) { + continue; + } + use = events[open][1].end.offset - events[open][1].start.offset > 1 && events[index2][1].end.offset - events[index2][1].start.offset > 1 ? 2 : 1; + const start = Object.assign({}, events[open][1].end); + const end = Object.assign({}, events[index2][1].start); + movePoint(start, -use); + movePoint(end, use); + openingSequence = { + type: use > 1 ? "strongSequence" : "emphasisSequence", + start, + end: Object.assign({}, events[open][1].end) + }; + closingSequence = { + type: use > 1 ? "strongSequence" : "emphasisSequence", + start: Object.assign({}, events[index2][1].start), + end + }; + text5 = { + type: use > 1 ? "strongText" : "emphasisText", + start: Object.assign({}, events[open][1].end), + end: Object.assign({}, events[index2][1].start) + }; + group = { + type: use > 1 ? "strong" : "emphasis", + start: Object.assign({}, openingSequence.start), + end: Object.assign({}, closingSequence.end) + }; + events[open][1].end = Object.assign({}, openingSequence.start); + events[index2][1].start = Object.assign({}, closingSequence.end); + nextEvents = []; + if (events[open][1].end.offset - events[open][1].start.offset) { + nextEvents = push(nextEvents, [["enter", events[open][1], context], ["exit", events[open][1], context]]); + } + nextEvents = push(nextEvents, [["enter", group, context], ["enter", openingSequence, context], ["exit", openingSequence, context], ["enter", text5, context]]); + nextEvents = push(nextEvents, resolveAll(context.parser.constructs.insideSpan.null, events.slice(open + 1, index2), context)); + nextEvents = push(nextEvents, [["exit", text5, context], ["enter", closingSequence, context], ["exit", closingSequence, context], ["exit", group, context]]); + if (events[index2][1].end.offset - events[index2][1].start.offset) { + offset = 2; + nextEvents = push(nextEvents, [["enter", events[index2][1], context], ["exit", events[index2][1], context]]); + } else { + offset = 0; + } + splice(events, open - 1, index2 - open + 3, nextEvents); + index2 = open + nextEvents.length - offset - 2; + break; + } + } + } + } + index2 = -1; + while (++index2 < events.length) { + if (events[index2][1].type === "attentionSequence") { + events[index2][1].type = "data"; + } + } + return events; + } + function tokenizeAttention(effects, ok3) { + const attentionMarkers2 = this.parser.constructs.attentionMarkers.null; + const previous3 = this.previous; + const before = classifyCharacter(previous3); + let marker; + return start; + function start(code3) { + marker = code3; + effects.enter("attentionSequence"); + return inside(code3); + } + function inside(code3) { + if (code3 === marker) { + effects.consume(code3); + return inside; + } + const token = effects.exit("attentionSequence"); + const after = classifyCharacter(code3); + const open = !after || after === 2 && before || attentionMarkers2.includes(code3); + const close2 = !before || before === 2 && after || attentionMarkers2.includes(previous3); + token._open = Boolean(marker === 42 ? open : open && (before || !close2)); + token._close = Boolean(marker === 42 ? close2 : close2 && (after || !open)); + return ok3(code3); + } + } + function movePoint(point3, offset) { + point3.column += offset; + point3.offset += offset; + point3._bufferIndex += offset; + } + + // node_modules/micromark-core-commonmark/lib/autolink.js + var autolink = { + name: "autolink", + tokenize: tokenizeAutolink + }; + function tokenizeAutolink(effects, ok3, nok) { + let size = 0; + return start; + function start(code3) { + effects.enter("autolink"); + effects.enter("autolinkMarker"); + effects.consume(code3); + effects.exit("autolinkMarker"); + effects.enter("autolinkProtocol"); + return open; + } + function open(code3) { + if (asciiAlpha(code3)) { + effects.consume(code3); + return schemeOrEmailAtext; + } + if (code3 === 64) { + return nok(code3); + } + return emailAtext(code3); + } + function schemeOrEmailAtext(code3) { + if (code3 === 43 || code3 === 45 || code3 === 46 || asciiAlphanumeric(code3)) { + size = 1; + return schemeInsideOrEmailAtext(code3); + } + return emailAtext(code3); + } + function schemeInsideOrEmailAtext(code3) { + if (code3 === 58) { + effects.consume(code3); + size = 0; + return urlInside; + } + if ((code3 === 43 || code3 === 45 || code3 === 46 || asciiAlphanumeric(code3)) && size++ < 32) { + effects.consume(code3); + return schemeInsideOrEmailAtext; + } + size = 0; + return emailAtext(code3); + } + function urlInside(code3) { + if (code3 === 62) { + effects.exit("autolinkProtocol"); + effects.enter("autolinkMarker"); + effects.consume(code3); + effects.exit("autolinkMarker"); + effects.exit("autolink"); + return ok3; + } + if (code3 === null || code3 === 32 || code3 === 60 || asciiControl(code3)) { + return nok(code3); + } + effects.consume(code3); + return urlInside; + } + function emailAtext(code3) { + if (code3 === 64) { + effects.consume(code3); + return emailAtSignOrDot; + } + if (asciiAtext(code3)) { + effects.consume(code3); + return emailAtext; + } + return nok(code3); + } + function emailAtSignOrDot(code3) { + return asciiAlphanumeric(code3) ? emailLabel(code3) : nok(code3); + } + function emailLabel(code3) { + if (code3 === 46) { + effects.consume(code3); + size = 0; + return emailAtSignOrDot; + } + if (code3 === 62) { + effects.exit("autolinkProtocol").type = "autolinkEmail"; + effects.enter("autolinkMarker"); + effects.consume(code3); + effects.exit("autolinkMarker"); + effects.exit("autolink"); + return ok3; + } + return emailValue(code3); + } + function emailValue(code3) { + if ((code3 === 45 || asciiAlphanumeric(code3)) && size++ < 63) { + const next = code3 === 45 ? emailValue : emailLabel; + effects.consume(code3); + return next; + } + return nok(code3); + } + } + + // node_modules/micromark-core-commonmark/lib/blank-line.js + var blankLine = { + tokenize: tokenizeBlankLine, + partial: true + }; + function tokenizeBlankLine(effects, ok3, nok) { + return start; + function start(code3) { + return markdownSpace(code3) ? factorySpace(effects, after, "linePrefix")(code3) : after(code3); + } + function after(code3) { + return code3 === null || markdownLineEnding(code3) ? ok3(code3) : nok(code3); + } + } + + // node_modules/micromark-core-commonmark/lib/block-quote.js + var blockQuote = { + name: "blockQuote", + tokenize: tokenizeBlockQuoteStart, + continuation: { + tokenize: tokenizeBlockQuoteContinuation + }, + exit + }; + function tokenizeBlockQuoteStart(effects, ok3, nok) { + const self2 = this; + return start; + function start(code3) { + if (code3 === 62) { + const state = self2.containerState; + if (!state.open) { + effects.enter("blockQuote", { + _container: true + }); + state.open = true; + } + effects.enter("blockQuotePrefix"); + effects.enter("blockQuoteMarker"); + effects.consume(code3); + effects.exit("blockQuoteMarker"); + return after; + } + return nok(code3); + } + function after(code3) { + if (markdownSpace(code3)) { + effects.enter("blockQuotePrefixWhitespace"); + effects.consume(code3); + effects.exit("blockQuotePrefixWhitespace"); + effects.exit("blockQuotePrefix"); + return ok3; + } + effects.exit("blockQuotePrefix"); + return ok3(code3); + } + } + function tokenizeBlockQuoteContinuation(effects, ok3, nok) { + const self2 = this; + return contStart; + function contStart(code3) { + if (markdownSpace(code3)) { + return factorySpace(effects, contBefore, "linePrefix", self2.parser.constructs.disable.null.includes("codeIndented") ? void 0 : 4)(code3); + } + return contBefore(code3); + } + function contBefore(code3) { + return effects.attempt(blockQuote, ok3, nok)(code3); + } + } + function exit(effects) { + effects.exit("blockQuote"); + } + + // node_modules/micromark-core-commonmark/lib/character-escape.js + var characterEscape = { + name: "characterEscape", + tokenize: tokenizeCharacterEscape + }; + function tokenizeCharacterEscape(effects, ok3, nok) { + return start; + function start(code3) { + effects.enter("characterEscape"); + effects.enter("escapeMarker"); + effects.consume(code3); + effects.exit("escapeMarker"); + return inside; + } + function inside(code3) { + if (asciiPunctuation(code3)) { + effects.enter("characterEscapeValue"); + effects.consume(code3); + effects.exit("characterEscapeValue"); + effects.exit("characterEscape"); + return ok3; + } + return nok(code3); + } + } + + // node_modules/micromark-core-commonmark/lib/character-reference.js + var characterReference = { + name: "characterReference", + tokenize: tokenizeCharacterReference + }; + function tokenizeCharacterReference(effects, ok3, nok) { + const self2 = this; + let size = 0; + let max; + let test; + return start; + function start(code3) { + effects.enter("characterReference"); + effects.enter("characterReferenceMarker"); + effects.consume(code3); + effects.exit("characterReferenceMarker"); + return open; + } + function open(code3) { + if (code3 === 35) { + effects.enter("characterReferenceMarkerNumeric"); + effects.consume(code3); + effects.exit("characterReferenceMarkerNumeric"); + return numeric; + } + effects.enter("characterReferenceValue"); + max = 31; + test = asciiAlphanumeric; + return value(code3); + } + function numeric(code3) { + if (code3 === 88 || code3 === 120) { + effects.enter("characterReferenceMarkerHexadecimal"); + effects.consume(code3); + effects.exit("characterReferenceMarkerHexadecimal"); + effects.enter("characterReferenceValue"); + max = 6; + test = asciiHexDigit; + return value; + } + effects.enter("characterReferenceValue"); + max = 7; + test = asciiDigit; + return value(code3); + } + function value(code3) { + if (code3 === 59 && size) { + const token = effects.exit("characterReferenceValue"); + if (test === asciiAlphanumeric && !decodeNamedCharacterReference(self2.sliceSerialize(token))) { + return nok(code3); + } + effects.enter("characterReferenceMarker"); + effects.consume(code3); + effects.exit("characterReferenceMarker"); + effects.exit("characterReference"); + return ok3; + } + if (test(code3) && size++ < max) { + effects.consume(code3); + return value; + } + return nok(code3); + } + } + + // node_modules/micromark-core-commonmark/lib/code-fenced.js + var nonLazyContinuation = { + tokenize: tokenizeNonLazyContinuation, + partial: true + }; + var codeFenced = { + name: "codeFenced", + tokenize: tokenizeCodeFenced, + concrete: true + }; + function tokenizeCodeFenced(effects, ok3, nok) { + const self2 = this; + const closeStart = { + tokenize: tokenizeCloseStart, + partial: true + }; + let initialPrefix = 0; + let sizeOpen = 0; + let marker; + return start; + function start(code3) { + return beforeSequenceOpen(code3); + } + function beforeSequenceOpen(code3) { + const tail = self2.events[self2.events.length - 1]; + initialPrefix = tail && tail[1].type === "linePrefix" ? tail[2].sliceSerialize(tail[1], true).length : 0; + marker = code3; + effects.enter("codeFenced"); + effects.enter("codeFencedFence"); + effects.enter("codeFencedFenceSequence"); + return sequenceOpen(code3); + } + function sequenceOpen(code3) { + if (code3 === marker) { + sizeOpen++; + effects.consume(code3); + return sequenceOpen; + } + if (sizeOpen < 3) { + return nok(code3); + } + effects.exit("codeFencedFenceSequence"); + return markdownSpace(code3) ? factorySpace(effects, infoBefore, "whitespace")(code3) : infoBefore(code3); + } + function infoBefore(code3) { + if (code3 === null || markdownLineEnding(code3)) { + effects.exit("codeFencedFence"); + return self2.interrupt ? ok3(code3) : effects.check(nonLazyContinuation, atNonLazyBreak, after)(code3); + } + effects.enter("codeFencedFenceInfo"); + effects.enter("chunkString", { + contentType: "string" + }); + return info(code3); + } + function info(code3) { + if (code3 === null || markdownLineEnding(code3)) { + effects.exit("chunkString"); + effects.exit("codeFencedFenceInfo"); + return infoBefore(code3); + } + if (markdownSpace(code3)) { + effects.exit("chunkString"); + effects.exit("codeFencedFenceInfo"); + return factorySpace(effects, metaBefore, "whitespace")(code3); + } + if (code3 === 96 && code3 === marker) { + return nok(code3); + } + effects.consume(code3); + return info; + } + function metaBefore(code3) { + if (code3 === null || markdownLineEnding(code3)) { + return infoBefore(code3); + } + effects.enter("codeFencedFenceMeta"); + effects.enter("chunkString", { + contentType: "string" + }); + return meta(code3); + } + function meta(code3) { + if (code3 === null || markdownLineEnding(code3)) { + effects.exit("chunkString"); + effects.exit("codeFencedFenceMeta"); + return infoBefore(code3); + } + if (code3 === 96 && code3 === marker) { + return nok(code3); + } + effects.consume(code3); + return meta; + } + function atNonLazyBreak(code3) { + return effects.attempt(closeStart, after, contentBefore)(code3); + } + function contentBefore(code3) { + effects.enter("lineEnding"); + effects.consume(code3); + effects.exit("lineEnding"); + return contentStart; + } + function contentStart(code3) { + return initialPrefix > 0 && markdownSpace(code3) ? factorySpace(effects, beforeContentChunk, "linePrefix", initialPrefix + 1)(code3) : beforeContentChunk(code3); + } + function beforeContentChunk(code3) { + if (code3 === null || markdownLineEnding(code3)) { + return effects.check(nonLazyContinuation, atNonLazyBreak, after)(code3); + } + effects.enter("codeFlowValue"); + return contentChunk(code3); + } + function contentChunk(code3) { + if (code3 === null || markdownLineEnding(code3)) { + effects.exit("codeFlowValue"); + return beforeContentChunk(code3); + } + effects.consume(code3); + return contentChunk; + } + function after(code3) { + effects.exit("codeFenced"); + return ok3(code3); + } + function tokenizeCloseStart(effects2, ok4, nok2) { + let size = 0; + return startBefore; + function startBefore(code3) { + effects2.enter("lineEnding"); + effects2.consume(code3); + effects2.exit("lineEnding"); + return start2; + } + function start2(code3) { + effects2.enter("codeFencedFence"); + return markdownSpace(code3) ? factorySpace(effects2, beforeSequenceClose, "linePrefix", self2.parser.constructs.disable.null.includes("codeIndented") ? void 0 : 4)(code3) : beforeSequenceClose(code3); + } + function beforeSequenceClose(code3) { + if (code3 === marker) { + effects2.enter("codeFencedFenceSequence"); + return sequenceClose(code3); + } + return nok2(code3); + } + function sequenceClose(code3) { + if (code3 === marker) { + size++; + effects2.consume(code3); + return sequenceClose; + } + if (size >= sizeOpen) { + effects2.exit("codeFencedFenceSequence"); + return markdownSpace(code3) ? factorySpace(effects2, sequenceCloseAfter, "whitespace")(code3) : sequenceCloseAfter(code3); + } + return nok2(code3); + } + function sequenceCloseAfter(code3) { + if (code3 === null || markdownLineEnding(code3)) { + effects2.exit("codeFencedFence"); + return ok4(code3); + } + return nok2(code3); + } + } + } + function tokenizeNonLazyContinuation(effects, ok3, nok) { + const self2 = this; + return start; + function start(code3) { + if (code3 === null) { + return nok(code3); + } + effects.enter("lineEnding"); + effects.consume(code3); + effects.exit("lineEnding"); + return lineStart; + } + function lineStart(code3) { + return self2.parser.lazy[self2.now().line] ? nok(code3) : ok3(code3); + } + } + + // node_modules/micromark-core-commonmark/lib/code-indented.js + var codeIndented = { + name: "codeIndented", + tokenize: tokenizeCodeIndented + }; + var furtherStart = { + tokenize: tokenizeFurtherStart, + partial: true + }; + function tokenizeCodeIndented(effects, ok3, nok) { + const self2 = this; + return start; + function start(code3) { + effects.enter("codeIndented"); + return factorySpace(effects, afterPrefix, "linePrefix", 4 + 1)(code3); + } + function afterPrefix(code3) { + const tail = self2.events[self2.events.length - 1]; + return tail && tail[1].type === "linePrefix" && tail[2].sliceSerialize(tail[1], true).length >= 4 ? atBreak(code3) : nok(code3); + } + function atBreak(code3) { + if (code3 === null) { + return after(code3); + } + if (markdownLineEnding(code3)) { + return effects.attempt(furtherStart, atBreak, after)(code3); + } + effects.enter("codeFlowValue"); + return inside(code3); + } + function inside(code3) { + if (code3 === null || markdownLineEnding(code3)) { + effects.exit("codeFlowValue"); + return atBreak(code3); + } + effects.consume(code3); + return inside; + } + function after(code3) { + effects.exit("codeIndented"); + return ok3(code3); + } + } + function tokenizeFurtherStart(effects, ok3, nok) { + const self2 = this; + return furtherStart2; + function furtherStart2(code3) { + if (self2.parser.lazy[self2.now().line]) { + return nok(code3); + } + if (markdownLineEnding(code3)) { + effects.enter("lineEnding"); + effects.consume(code3); + effects.exit("lineEnding"); + return furtherStart2; + } + return factorySpace(effects, afterPrefix, "linePrefix", 4 + 1)(code3); + } + function afterPrefix(code3) { + const tail = self2.events[self2.events.length - 1]; + return tail && tail[1].type === "linePrefix" && tail[2].sliceSerialize(tail[1], true).length >= 4 ? ok3(code3) : markdownLineEnding(code3) ? furtherStart2(code3) : nok(code3); + } + } + + // node_modules/micromark-core-commonmark/lib/code-text.js + var codeText = { + name: "codeText", + tokenize: tokenizeCodeText, + resolve: resolveCodeText, + previous + }; + function resolveCodeText(events) { + let tailExitIndex = events.length - 4; + let headEnterIndex = 3; + let index2; + let enter; + if ((events[headEnterIndex][1].type === "lineEnding" || events[headEnterIndex][1].type === "space") && (events[tailExitIndex][1].type === "lineEnding" || events[tailExitIndex][1].type === "space")) { + index2 = headEnterIndex; + while (++index2 < tailExitIndex) { + if (events[index2][1].type === "codeTextData") { + events[headEnterIndex][1].type = "codeTextPadding"; + events[tailExitIndex][1].type = "codeTextPadding"; + headEnterIndex += 2; + tailExitIndex -= 2; + break; + } + } + } + index2 = headEnterIndex - 1; + tailExitIndex++; + while (++index2 <= tailExitIndex) { + if (enter === void 0) { + if (index2 !== tailExitIndex && events[index2][1].type !== "lineEnding") { + enter = index2; + } + } else if (index2 === tailExitIndex || events[index2][1].type === "lineEnding") { + events[enter][1].type = "codeTextData"; + if (index2 !== enter + 2) { + events[enter][1].end = events[index2 - 1][1].end; + events.splice(enter + 2, index2 - enter - 2); + tailExitIndex -= index2 - enter - 2; + index2 = enter + 2; + } + enter = void 0; + } + } + return events; + } + function previous(code3) { + return code3 !== 96 || this.events[this.events.length - 1][1].type === "characterEscape"; + } + function tokenizeCodeText(effects, ok3, nok) { + const self2 = this; + let sizeOpen = 0; + let size; + let token; + return start; + function start(code3) { + effects.enter("codeText"); + effects.enter("codeTextSequence"); + return sequenceOpen(code3); + } + function sequenceOpen(code3) { + if (code3 === 96) { + effects.consume(code3); + sizeOpen++; + return sequenceOpen; + } + effects.exit("codeTextSequence"); + return between2(code3); + } + function between2(code3) { + if (code3 === null) { + return nok(code3); + } + if (code3 === 32) { + effects.enter("space"); + effects.consume(code3); + effects.exit("space"); + return between2; + } + if (code3 === 96) { + token = effects.enter("codeTextSequence"); + size = 0; + return sequenceClose(code3); + } + if (markdownLineEnding(code3)) { + effects.enter("lineEnding"); + effects.consume(code3); + effects.exit("lineEnding"); + return between2; + } + effects.enter("codeTextData"); + return data(code3); + } + function data(code3) { + if (code3 === null || code3 === 32 || code3 === 96 || markdownLineEnding(code3)) { + effects.exit("codeTextData"); + return between2(code3); + } + effects.consume(code3); + return data; + } + function sequenceClose(code3) { + if (code3 === 96) { + effects.consume(code3); + size++; + return sequenceClose; + } + if (size === sizeOpen) { + effects.exit("codeTextSequence"); + effects.exit("codeText"); + return ok3(code3); + } + token.type = "codeTextData"; + return data(code3); + } + } + + // node_modules/micromark-util-subtokenize/lib/splice-buffer.js + var SpliceBuffer = class { + /** + * @param {ReadonlyArray | null | undefined} [initial] + * Initial items (optional). + * @returns + * Splice buffer. + */ + constructor(initial) { + this.left = initial ? [...initial] : []; + this.right = []; + } + /** + * Array access; + * does not move the cursor. + * + * @param {number} index + * Index. + * @return {T} + * Item. + */ + get(index2) { + if (index2 < 0 || index2 >= this.left.length + this.right.length) { + throw new RangeError("Cannot access index `" + index2 + "` in a splice buffer of size `" + (this.left.length + this.right.length) + "`"); + } + if (index2 < this.left.length) return this.left[index2]; + return this.right[this.right.length - index2 + this.left.length - 1]; + } + /** + * The length of the splice buffer, one greater than the largest index in the + * array. + */ + get length() { + return this.left.length + this.right.length; + } + /** + * Remove and return `list[0]`; + * moves the cursor to `0`. + * + * @returns {T | undefined} + * Item, optional. + */ + shift() { + this.setCursor(0); + return this.right.pop(); + } + /** + * Slice the buffer to get an array; + * does not move the cursor. + * + * @param {number} start + * Start. + * @param {number | null | undefined} [end] + * End (optional). + * @returns {Array} + * Array of items. + */ + slice(start, end) { + const stop = end === null || end === void 0 ? Number.POSITIVE_INFINITY : end; + if (stop < this.left.length) { + return this.left.slice(start, stop); + } + if (start > this.left.length) { + return this.right.slice(this.right.length - stop + this.left.length, this.right.length - start + this.left.length).reverse(); + } + return this.left.slice(start).concat(this.right.slice(this.right.length - stop + this.left.length).reverse()); + } + /** + * Mimics the behavior of Array.prototype.splice() except for the change of + * interface necessary to avoid segfaults when patching in very large arrays. + * + * This operation moves cursor is moved to `start` and results in the cursor + * placed after any inserted items. + * + * @param {number} start + * Start; + * zero-based index at which to start changing the array; + * negative numbers count backwards from the end of the array and values + * that are out-of bounds are clamped to the appropriate end of the array. + * @param {number | null | undefined} [deleteCount=0] + * Delete count (default: `0`); + * maximum number of elements to delete, starting from start. + * @param {Array | null | undefined} [items=[]] + * Items to include in place of the deleted items (default: `[]`). + * @return {Array} + * Any removed items. + */ + splice(start, deleteCount, items) { + const count = deleteCount || 0; + this.setCursor(Math.trunc(start)); + const removed = this.right.splice(this.right.length - count, Number.POSITIVE_INFINITY); + if (items) chunkedPush(this.left, items); + return removed.reverse(); + } + /** + * Remove and return the highest-numbered item in the array, so + * `list[list.length - 1]`; + * Moves the cursor to `length`. + * + * @returns {T | undefined} + * Item, optional. + */ + pop() { + this.setCursor(Number.POSITIVE_INFINITY); + return this.left.pop(); + } + /** + * Inserts a single item to the high-numbered side of the array; + * moves the cursor to `length`. + * + * @param {T} item + * Item. + * @returns {undefined} + * Nothing. + */ + push(item) { + this.setCursor(Number.POSITIVE_INFINITY); + this.left.push(item); + } + /** + * Inserts many items to the high-numbered side of the array. + * Moves the cursor to `length`. + * + * @param {Array} items + * Items. + * @returns {undefined} + * Nothing. + */ + pushMany(items) { + this.setCursor(Number.POSITIVE_INFINITY); + chunkedPush(this.left, items); + } + /** + * Inserts a single item to the low-numbered side of the array; + * Moves the cursor to `0`. + * + * @param {T} item + * Item. + * @returns {undefined} + * Nothing. + */ + unshift(item) { + this.setCursor(0); + this.right.push(item); + } + /** + * Inserts many items to the low-numbered side of the array; + * moves the cursor to `0`. + * + * @param {Array} items + * Items. + * @returns {undefined} + * Nothing. + */ + unshiftMany(items) { + this.setCursor(0); + chunkedPush(this.right, items.reverse()); + } + /** + * Move the cursor to a specific position in the array. Requires + * time proportional to the distance moved. + * + * If `n < 0`, the cursor will end up at the beginning. + * If `n > length`, the cursor will end up at the end. + * + * @param {number} n + * Position. + * @return {undefined} + * Nothing. + */ + setCursor(n4) { + if (n4 === this.left.length || n4 > this.left.length && this.right.length === 0 || n4 < 0 && this.left.length === 0) return; + if (n4 < this.left.length) { + const removed = this.left.splice(n4, Number.POSITIVE_INFINITY); + chunkedPush(this.right, removed.reverse()); + } else { + const removed = this.right.splice(this.left.length + this.right.length - n4, Number.POSITIVE_INFINITY); + chunkedPush(this.left, removed.reverse()); + } + } + }; + function chunkedPush(list4, right) { + let chunkStart = 0; + if (right.length < 1e4) { + list4.push(...right); + } else { + while (chunkStart < right.length) { + list4.push(...right.slice(chunkStart, chunkStart + 1e4)); + chunkStart += 1e4; + } + } + } + + // node_modules/micromark-util-subtokenize/index.js + function subtokenize(eventsArray) { + const jumps = {}; + let index2 = -1; + let event; + let lineIndex; + let otherIndex; + let otherEvent; + let parameters; + let subevents; + let more; + const events = new SpliceBuffer(eventsArray); + while (++index2 < events.length) { + while (index2 in jumps) { + index2 = jumps[index2]; + } + event = events.get(index2); + if (index2 && event[1].type === "chunkFlow" && events.get(index2 - 1)[1].type === "listItemPrefix") { + subevents = event[1]._tokenizer.events; + otherIndex = 0; + if (otherIndex < subevents.length && subevents[otherIndex][1].type === "lineEndingBlank") { + otherIndex += 2; + } + if (otherIndex < subevents.length && subevents[otherIndex][1].type === "content") { + while (++otherIndex < subevents.length) { + if (subevents[otherIndex][1].type === "content") { + break; + } + if (subevents[otherIndex][1].type === "chunkText") { + subevents[otherIndex][1]._isInFirstContentOfListItem = true; + otherIndex++; + } + } + } + } + if (event[0] === "enter") { + if (event[1].contentType) { + Object.assign(jumps, subcontent(events, index2)); + index2 = jumps[index2]; + more = true; + } + } else if (event[1]._container) { + otherIndex = index2; + lineIndex = void 0; + while (otherIndex--) { + otherEvent = events.get(otherIndex); + if (otherEvent[1].type === "lineEnding" || otherEvent[1].type === "lineEndingBlank") { + if (otherEvent[0] === "enter") { + if (lineIndex) { + events.get(lineIndex)[1].type = "lineEndingBlank"; + } + otherEvent[1].type = "lineEnding"; + lineIndex = otherIndex; + } + } else { + break; + } + } + if (lineIndex) { + event[1].end = Object.assign({}, events.get(lineIndex)[1].start); + parameters = events.slice(lineIndex, index2); + parameters.unshift(event); + events.splice(lineIndex, index2 - lineIndex + 1, parameters); + } + } + } + splice(eventsArray, 0, Number.POSITIVE_INFINITY, events.slice(0)); + return !more; + } + function subcontent(events, eventIndex) { + const token = events.get(eventIndex)[1]; + const context = events.get(eventIndex)[2]; + let startPosition = eventIndex - 1; + const startPositions = []; + const tokenizer = token._tokenizer || context.parser[token.contentType](token.start); + const childEvents = tokenizer.events; + const jumps = []; + const gaps = {}; + let stream; + let previous3; + let index2 = -1; + let current = token; + let adjust = 0; + let start = 0; + const breaks = [start]; + while (current) { + while (events.get(++startPosition)[1] !== current) { + } + startPositions.push(startPosition); + if (!current._tokenizer) { + stream = context.sliceStream(current); + if (!current.next) { + stream.push(null); + } + if (previous3) { + tokenizer.defineSkip(current.start); + } + if (current._isInFirstContentOfListItem) { + tokenizer._gfmTasklistFirstContentOfListItem = true; + } + tokenizer.write(stream); + if (current._isInFirstContentOfListItem) { + tokenizer._gfmTasklistFirstContentOfListItem = void 0; + } + } + previous3 = current; + current = current.next; + } + current = token; + while (++index2 < childEvents.length) { + if ( + // Find a void token that includes a break. + childEvents[index2][0] === "exit" && childEvents[index2 - 1][0] === "enter" && childEvents[index2][1].type === childEvents[index2 - 1][1].type && childEvents[index2][1].start.line !== childEvents[index2][1].end.line + ) { + start = index2 + 1; + breaks.push(start); + current._tokenizer = void 0; + current.previous = void 0; + current = current.next; + } + } + tokenizer.events = []; + if (current) { + current._tokenizer = void 0; + current.previous = void 0; + } else { + breaks.pop(); + } + index2 = breaks.length; + while (index2--) { + const slice = childEvents.slice(breaks[index2], breaks[index2 + 1]); + const start2 = startPositions.pop(); + jumps.push([start2, start2 + slice.length - 1]); + events.splice(start2, 2, slice); + } + jumps.reverse(); + index2 = -1; + while (++index2 < jumps.length) { + gaps[adjust + jumps[index2][0]] = adjust + jumps[index2][1]; + adjust += jumps[index2][1] - jumps[index2][0] - 1; + } + return gaps; + } + + // node_modules/micromark-core-commonmark/lib/content.js + var content2 = { + tokenize: tokenizeContent, + resolve: resolveContent + }; + var continuationConstruct = { + tokenize: tokenizeContinuation, + partial: true + }; + function resolveContent(events) { + subtokenize(events); + return events; + } + function tokenizeContent(effects, ok3) { + let previous3; + return chunkStart; + function chunkStart(code3) { + effects.enter("content"); + previous3 = effects.enter("chunkContent", { + contentType: "content" + }); + return chunkInside(code3); + } + function chunkInside(code3) { + if (code3 === null) { + return contentEnd(code3); + } + if (markdownLineEnding(code3)) { + return effects.check(continuationConstruct, contentContinue, contentEnd)(code3); + } + effects.consume(code3); + return chunkInside; + } + function contentEnd(code3) { + effects.exit("chunkContent"); + effects.exit("content"); + return ok3(code3); + } + function contentContinue(code3) { + effects.consume(code3); + effects.exit("chunkContent"); + previous3.next = effects.enter("chunkContent", { + contentType: "content", + previous: previous3 + }); + previous3 = previous3.next; + return chunkInside; + } + } + function tokenizeContinuation(effects, ok3, nok) { + const self2 = this; + return startLookahead; + function startLookahead(code3) { + effects.exit("chunkContent"); + effects.enter("lineEnding"); + effects.consume(code3); + effects.exit("lineEnding"); + return factorySpace(effects, prefixed, "linePrefix"); + } + function prefixed(code3) { + if (code3 === null || markdownLineEnding(code3)) { + return nok(code3); + } + const tail = self2.events[self2.events.length - 1]; + if (!self2.parser.constructs.disable.null.includes("codeIndented") && tail && tail[1].type === "linePrefix" && tail[2].sliceSerialize(tail[1], true).length >= 4) { + return ok3(code3); + } + return effects.interrupt(self2.parser.constructs.flow, nok, ok3)(code3); + } + } + + // node_modules/micromark-factory-destination/index.js + function factoryDestination(effects, ok3, nok, type, literalType, literalMarkerType, rawType, stringType, max) { + const limit = max || Number.POSITIVE_INFINITY; + let balance = 0; + return start; + function start(code3) { + if (code3 === 60) { + effects.enter(type); + effects.enter(literalType); + effects.enter(literalMarkerType); + effects.consume(code3); + effects.exit(literalMarkerType); + return enclosedBefore; + } + if (code3 === null || code3 === 32 || code3 === 41 || asciiControl(code3)) { + return nok(code3); + } + effects.enter(type); + effects.enter(rawType); + effects.enter(stringType); + effects.enter("chunkString", { + contentType: "string" + }); + return raw(code3); + } + function enclosedBefore(code3) { + if (code3 === 62) { + effects.enter(literalMarkerType); + effects.consume(code3); + effects.exit(literalMarkerType); + effects.exit(literalType); + effects.exit(type); + return ok3; + } + effects.enter(stringType); + effects.enter("chunkString", { + contentType: "string" + }); + return enclosed(code3); + } + function enclosed(code3) { + if (code3 === 62) { + effects.exit("chunkString"); + effects.exit(stringType); + return enclosedBefore(code3); + } + if (code3 === null || code3 === 60 || markdownLineEnding(code3)) { + return nok(code3); + } + effects.consume(code3); + return code3 === 92 ? enclosedEscape : enclosed; + } + function enclosedEscape(code3) { + if (code3 === 60 || code3 === 62 || code3 === 92) { + effects.consume(code3); + return enclosed; + } + return enclosed(code3); + } + function raw(code3) { + if (!balance && (code3 === null || code3 === 41 || markdownLineEndingOrSpace(code3))) { + effects.exit("chunkString"); + effects.exit(stringType); + effects.exit(rawType); + effects.exit(type); + return ok3(code3); + } + if (balance < limit && code3 === 40) { + effects.consume(code3); + balance++; + return raw; + } + if (code3 === 41) { + effects.consume(code3); + balance--; + return raw; + } + if (code3 === null || code3 === 32 || code3 === 40 || asciiControl(code3)) { + return nok(code3); + } + effects.consume(code3); + return code3 === 92 ? rawEscape : raw; + } + function rawEscape(code3) { + if (code3 === 40 || code3 === 41 || code3 === 92) { + effects.consume(code3); + return raw; + } + return raw(code3); + } + } + + // node_modules/micromark-factory-label/index.js + function factoryLabel(effects, ok3, nok, type, markerType, stringType) { + const self2 = this; + let size = 0; + let seen; + return start; + function start(code3) { + effects.enter(type); + effects.enter(markerType); + effects.consume(code3); + effects.exit(markerType); + effects.enter(stringType); + return atBreak; + } + function atBreak(code3) { + if (size > 999 || code3 === null || code3 === 91 || code3 === 93 && !seen || // To do: remove in the future once we’ve switched from + // `micromark-extension-footnote` to `micromark-extension-gfm-footnote`, + // which doesn’t need this. + // Hidden footnotes hook. + /* c8 ignore next 3 */ + code3 === 94 && !size && "_hiddenFootnoteSupport" in self2.parser.constructs) { + return nok(code3); + } + if (code3 === 93) { + effects.exit(stringType); + effects.enter(markerType); + effects.consume(code3); + effects.exit(markerType); + effects.exit(type); + return ok3; + } + if (markdownLineEnding(code3)) { + effects.enter("lineEnding"); + effects.consume(code3); + effects.exit("lineEnding"); + return atBreak; + } + effects.enter("chunkString", { + contentType: "string" + }); + return labelInside(code3); + } + function labelInside(code3) { + if (code3 === null || code3 === 91 || code3 === 93 || markdownLineEnding(code3) || size++ > 999) { + effects.exit("chunkString"); + return atBreak(code3); + } + effects.consume(code3); + if (!seen) seen = !markdownSpace(code3); + return code3 === 92 ? labelEscape : labelInside; + } + function labelEscape(code3) { + if (code3 === 91 || code3 === 92 || code3 === 93) { + effects.consume(code3); + size++; + return labelInside; + } + return labelInside(code3); + } + } + + // node_modules/micromark-factory-title/index.js + function factoryTitle(effects, ok3, nok, type, markerType, stringType) { + let marker; + return start; + function start(code3) { + if (code3 === 34 || code3 === 39 || code3 === 40) { + effects.enter(type); + effects.enter(markerType); + effects.consume(code3); + effects.exit(markerType); + marker = code3 === 40 ? 41 : code3; + return begin; + } + return nok(code3); + } + function begin(code3) { + if (code3 === marker) { + effects.enter(markerType); + effects.consume(code3); + effects.exit(markerType); + effects.exit(type); + return ok3; + } + effects.enter(stringType); + return atBreak(code3); + } + function atBreak(code3) { + if (code3 === marker) { + effects.exit(stringType); + return begin(marker); + } + if (code3 === null) { + return nok(code3); + } + if (markdownLineEnding(code3)) { + effects.enter("lineEnding"); + effects.consume(code3); + effects.exit("lineEnding"); + return factorySpace(effects, atBreak, "linePrefix"); + } + effects.enter("chunkString", { + contentType: "string" + }); + return inside(code3); + } + function inside(code3) { + if (code3 === marker || code3 === null || markdownLineEnding(code3)) { + effects.exit("chunkString"); + return atBreak(code3); + } + effects.consume(code3); + return code3 === 92 ? escape : inside; + } + function escape(code3) { + if (code3 === marker || code3 === 92) { + effects.consume(code3); + return inside; + } + return inside(code3); + } + } + + // node_modules/micromark-factory-whitespace/index.js + function factoryWhitespace(effects, ok3) { + let seen; + return start; + function start(code3) { + if (markdownLineEnding(code3)) { + effects.enter("lineEnding"); + effects.consume(code3); + effects.exit("lineEnding"); + seen = true; + return start; + } + if (markdownSpace(code3)) { + return factorySpace( + effects, + start, + seen ? "linePrefix" : "lineSuffix" + )(code3); + } + return ok3(code3); + } + } + + // node_modules/micromark-core-commonmark/lib/definition.js + var definition = { + name: "definition", + tokenize: tokenizeDefinition + }; + var titleBefore = { + tokenize: tokenizeTitleBefore, + partial: true + }; + function tokenizeDefinition(effects, ok3, nok) { + const self2 = this; + let identifier; + return start; + function start(code3) { + effects.enter("definition"); + return before(code3); + } + function before(code3) { + return factoryLabel.call( + self2, + effects, + labelAfter, + // Note: we don’t need to reset the way `markdown-rs` does. + nok, + "definitionLabel", + "definitionLabelMarker", + "definitionLabelString" + )(code3); + } + function labelAfter(code3) { + identifier = normalizeIdentifier(self2.sliceSerialize(self2.events[self2.events.length - 1][1]).slice(1, -1)); + if (code3 === 58) { + effects.enter("definitionMarker"); + effects.consume(code3); + effects.exit("definitionMarker"); + return markerAfter; + } + return nok(code3); + } + function markerAfter(code3) { + return markdownLineEndingOrSpace(code3) ? factoryWhitespace(effects, destinationBefore)(code3) : destinationBefore(code3); + } + function destinationBefore(code3) { + return factoryDestination( + effects, + destinationAfter, + // Note: we don’t need to reset the way `markdown-rs` does. + nok, + "definitionDestination", + "definitionDestinationLiteral", + "definitionDestinationLiteralMarker", + "definitionDestinationRaw", + "definitionDestinationString" + )(code3); + } + function destinationAfter(code3) { + return effects.attempt(titleBefore, after, after)(code3); + } + function after(code3) { + return markdownSpace(code3) ? factorySpace(effects, afterWhitespace, "whitespace")(code3) : afterWhitespace(code3); + } + function afterWhitespace(code3) { + if (code3 === null || markdownLineEnding(code3)) { + effects.exit("definition"); + self2.parser.defined.push(identifier); + return ok3(code3); + } + return nok(code3); + } + } + function tokenizeTitleBefore(effects, ok3, nok) { + return titleBefore2; + function titleBefore2(code3) { + return markdownLineEndingOrSpace(code3) ? factoryWhitespace(effects, beforeMarker)(code3) : nok(code3); + } + function beforeMarker(code3) { + return factoryTitle(effects, titleAfter, nok, "definitionTitle", "definitionTitleMarker", "definitionTitleString")(code3); + } + function titleAfter(code3) { + return markdownSpace(code3) ? factorySpace(effects, titleAfterOptionalWhitespace, "whitespace")(code3) : titleAfterOptionalWhitespace(code3); + } + function titleAfterOptionalWhitespace(code3) { + return code3 === null || markdownLineEnding(code3) ? ok3(code3) : nok(code3); + } + } + + // node_modules/micromark-core-commonmark/lib/hard-break-escape.js + var hardBreakEscape = { + name: "hardBreakEscape", + tokenize: tokenizeHardBreakEscape + }; + function tokenizeHardBreakEscape(effects, ok3, nok) { + return start; + function start(code3) { + effects.enter("hardBreakEscape"); + effects.consume(code3); + return after; + } + function after(code3) { + if (markdownLineEnding(code3)) { + effects.exit("hardBreakEscape"); + return ok3(code3); + } + return nok(code3); + } + } + + // node_modules/micromark-core-commonmark/lib/heading-atx.js + var headingAtx = { + name: "headingAtx", + tokenize: tokenizeHeadingAtx, + resolve: resolveHeadingAtx + }; + function resolveHeadingAtx(events, context) { + let contentEnd = events.length - 2; + let contentStart = 3; + let content3; + let text5; + if (events[contentStart][1].type === "whitespace") { + contentStart += 2; + } + if (contentEnd - 2 > contentStart && events[contentEnd][1].type === "whitespace") { + contentEnd -= 2; + } + if (events[contentEnd][1].type === "atxHeadingSequence" && (contentStart === contentEnd - 1 || contentEnd - 4 > contentStart && events[contentEnd - 2][1].type === "whitespace")) { + contentEnd -= contentStart + 1 === contentEnd ? 2 : 4; + } + if (contentEnd > contentStart) { + content3 = { + type: "atxHeadingText", + start: events[contentStart][1].start, + end: events[contentEnd][1].end + }; + text5 = { + type: "chunkText", + start: events[contentStart][1].start, + end: events[contentEnd][1].end, + contentType: "text" + }; + splice(events, contentStart, contentEnd - contentStart + 1, [["enter", content3, context], ["enter", text5, context], ["exit", text5, context], ["exit", content3, context]]); + } + return events; + } + function tokenizeHeadingAtx(effects, ok3, nok) { + let size = 0; + return start; + function start(code3) { + effects.enter("atxHeading"); + return before(code3); + } + function before(code3) { + effects.enter("atxHeadingSequence"); + return sequenceOpen(code3); + } + function sequenceOpen(code3) { + if (code3 === 35 && size++ < 6) { + effects.consume(code3); + return sequenceOpen; + } + if (code3 === null || markdownLineEndingOrSpace(code3)) { + effects.exit("atxHeadingSequence"); + return atBreak(code3); + } + return nok(code3); + } + function atBreak(code3) { + if (code3 === 35) { + effects.enter("atxHeadingSequence"); + return sequenceFurther(code3); + } + if (code3 === null || markdownLineEnding(code3)) { + effects.exit("atxHeading"); + return ok3(code3); + } + if (markdownSpace(code3)) { + return factorySpace(effects, atBreak, "whitespace")(code3); + } + effects.enter("atxHeadingText"); + return data(code3); + } + function sequenceFurther(code3) { + if (code3 === 35) { + effects.consume(code3); + return sequenceFurther; + } + effects.exit("atxHeadingSequence"); + return atBreak(code3); + } + function data(code3) { + if (code3 === null || code3 === 35 || markdownLineEndingOrSpace(code3)) { + effects.exit("atxHeadingText"); + return atBreak(code3); + } + effects.consume(code3); + return data; + } + } + + // node_modules/micromark-util-html-tag-name/index.js + var htmlBlockNames = [ + "address", + "article", + "aside", + "base", + "basefont", + "blockquote", + "body", + "caption", + "center", + "col", + "colgroup", + "dd", + "details", + "dialog", + "dir", + "div", + "dl", + "dt", + "fieldset", + "figcaption", + "figure", + "footer", + "form", + "frame", + "frameset", + "h1", + "h2", + "h3", + "h4", + "h5", + "h6", + "head", + "header", + "hr", + "html", + "iframe", + "legend", + "li", + "link", + "main", + "menu", + "menuitem", + "nav", + "noframes", + "ol", + "optgroup", + "option", + "p", + "param", + "search", + "section", + "summary", + "table", + "tbody", + "td", + "tfoot", + "th", + "thead", + "title", + "tr", + "track", + "ul" + ]; + var htmlRawNames = ["pre", "script", "style", "textarea"]; + + // node_modules/micromark-core-commonmark/lib/html-flow.js + var htmlFlow = { + name: "htmlFlow", + tokenize: tokenizeHtmlFlow, + resolveTo: resolveToHtmlFlow, + concrete: true + }; + var blankLineBefore = { + tokenize: tokenizeBlankLineBefore, + partial: true + }; + var nonLazyContinuationStart = { + tokenize: tokenizeNonLazyContinuationStart, + partial: true + }; + function resolveToHtmlFlow(events) { + let index2 = events.length; + while (index2--) { + if (events[index2][0] === "enter" && events[index2][1].type === "htmlFlow") { + break; + } + } + if (index2 > 1 && events[index2 - 2][1].type === "linePrefix") { + events[index2][1].start = events[index2 - 2][1].start; + events[index2 + 1][1].start = events[index2 - 2][1].start; + events.splice(index2 - 2, 2); + } + return events; + } + function tokenizeHtmlFlow(effects, ok3, nok) { + const self2 = this; + let marker; + let closingTag; + let buffer; + let index2; + let markerB; + return start; + function start(code3) { + return before(code3); + } + function before(code3) { + effects.enter("htmlFlow"); + effects.enter("htmlFlowData"); + effects.consume(code3); + return open; + } + function open(code3) { + if (code3 === 33) { + effects.consume(code3); + return declarationOpen; + } + if (code3 === 47) { + effects.consume(code3); + closingTag = true; + return tagCloseStart; + } + if (code3 === 63) { + effects.consume(code3); + marker = 3; + return self2.interrupt ? ok3 : continuationDeclarationInside; + } + if (asciiAlpha(code3)) { + effects.consume(code3); + buffer = String.fromCharCode(code3); + return tagName; + } + return nok(code3); + } + function declarationOpen(code3) { + if (code3 === 45) { + effects.consume(code3); + marker = 2; + return commentOpenInside; + } + if (code3 === 91) { + effects.consume(code3); + marker = 5; + index2 = 0; + return cdataOpenInside; + } + if (asciiAlpha(code3)) { + effects.consume(code3); + marker = 4; + return self2.interrupt ? ok3 : continuationDeclarationInside; + } + return nok(code3); + } + function commentOpenInside(code3) { + if (code3 === 45) { + effects.consume(code3); + return self2.interrupt ? ok3 : continuationDeclarationInside; + } + return nok(code3); + } + function cdataOpenInside(code3) { + const value = "CDATA["; + if (code3 === value.charCodeAt(index2++)) { + effects.consume(code3); + if (index2 === value.length) { + return self2.interrupt ? ok3 : continuation; + } + return cdataOpenInside; + } + return nok(code3); + } + function tagCloseStart(code3) { + if (asciiAlpha(code3)) { + effects.consume(code3); + buffer = String.fromCharCode(code3); + return tagName; + } + return nok(code3); + } + function tagName(code3) { + if (code3 === null || code3 === 47 || code3 === 62 || markdownLineEndingOrSpace(code3)) { + const slash = code3 === 47; + const name = buffer.toLowerCase(); + if (!slash && !closingTag && htmlRawNames.includes(name)) { + marker = 1; + return self2.interrupt ? ok3(code3) : continuation(code3); + } + if (htmlBlockNames.includes(buffer.toLowerCase())) { + marker = 6; + if (slash) { + effects.consume(code3); + return basicSelfClosing; + } + return self2.interrupt ? ok3(code3) : continuation(code3); + } + marker = 7; + return self2.interrupt && !self2.parser.lazy[self2.now().line] ? nok(code3) : closingTag ? completeClosingTagAfter(code3) : completeAttributeNameBefore(code3); + } + if (code3 === 45 || asciiAlphanumeric(code3)) { + effects.consume(code3); + buffer += String.fromCharCode(code3); + return tagName; + } + return nok(code3); + } + function basicSelfClosing(code3) { + if (code3 === 62) { + effects.consume(code3); + return self2.interrupt ? ok3 : continuation; + } + return nok(code3); + } + function completeClosingTagAfter(code3) { + if (markdownSpace(code3)) { + effects.consume(code3); + return completeClosingTagAfter; + } + return completeEnd(code3); + } + function completeAttributeNameBefore(code3) { + if (code3 === 47) { + effects.consume(code3); + return completeEnd; + } + if (code3 === 58 || code3 === 95 || asciiAlpha(code3)) { + effects.consume(code3); + return completeAttributeName; + } + if (markdownSpace(code3)) { + effects.consume(code3); + return completeAttributeNameBefore; + } + return completeEnd(code3); + } + function completeAttributeName(code3) { + if (code3 === 45 || code3 === 46 || code3 === 58 || code3 === 95 || asciiAlphanumeric(code3)) { + effects.consume(code3); + return completeAttributeName; + } + return completeAttributeNameAfter(code3); + } + function completeAttributeNameAfter(code3) { + if (code3 === 61) { + effects.consume(code3); + return completeAttributeValueBefore; + } + if (markdownSpace(code3)) { + effects.consume(code3); + return completeAttributeNameAfter; + } + return completeAttributeNameBefore(code3); + } + function completeAttributeValueBefore(code3) { + if (code3 === null || code3 === 60 || code3 === 61 || code3 === 62 || code3 === 96) { + return nok(code3); + } + if (code3 === 34 || code3 === 39) { + effects.consume(code3); + markerB = code3; + return completeAttributeValueQuoted; + } + if (markdownSpace(code3)) { + effects.consume(code3); + return completeAttributeValueBefore; + } + return completeAttributeValueUnquoted(code3); + } + function completeAttributeValueQuoted(code3) { + if (code3 === markerB) { + effects.consume(code3); + markerB = null; + return completeAttributeValueQuotedAfter; + } + if (code3 === null || markdownLineEnding(code3)) { + return nok(code3); + } + effects.consume(code3); + return completeAttributeValueQuoted; + } + function completeAttributeValueUnquoted(code3) { + if (code3 === null || code3 === 34 || code3 === 39 || code3 === 47 || code3 === 60 || code3 === 61 || code3 === 62 || code3 === 96 || markdownLineEndingOrSpace(code3)) { + return completeAttributeNameAfter(code3); + } + effects.consume(code3); + return completeAttributeValueUnquoted; + } + function completeAttributeValueQuotedAfter(code3) { + if (code3 === 47 || code3 === 62 || markdownSpace(code3)) { + return completeAttributeNameBefore(code3); + } + return nok(code3); + } + function completeEnd(code3) { + if (code3 === 62) { + effects.consume(code3); + return completeAfter; + } + return nok(code3); + } + function completeAfter(code3) { + if (code3 === null || markdownLineEnding(code3)) { + return continuation(code3); + } + if (markdownSpace(code3)) { + effects.consume(code3); + return completeAfter; + } + return nok(code3); + } + function continuation(code3) { + if (code3 === 45 && marker === 2) { + effects.consume(code3); + return continuationCommentInside; + } + if (code3 === 60 && marker === 1) { + effects.consume(code3); + return continuationRawTagOpen; + } + if (code3 === 62 && marker === 4) { + effects.consume(code3); + return continuationClose; + } + if (code3 === 63 && marker === 3) { + effects.consume(code3); + return continuationDeclarationInside; + } + if (code3 === 93 && marker === 5) { + effects.consume(code3); + return continuationCdataInside; + } + if (markdownLineEnding(code3) && (marker === 6 || marker === 7)) { + effects.exit("htmlFlowData"); + return effects.check(blankLineBefore, continuationAfter, continuationStart)(code3); + } + if (code3 === null || markdownLineEnding(code3)) { + effects.exit("htmlFlowData"); + return continuationStart(code3); + } + effects.consume(code3); + return continuation; + } + function continuationStart(code3) { + return effects.check(nonLazyContinuationStart, continuationStartNonLazy, continuationAfter)(code3); + } + function continuationStartNonLazy(code3) { + effects.enter("lineEnding"); + effects.consume(code3); + effects.exit("lineEnding"); + return continuationBefore; + } + function continuationBefore(code3) { + if (code3 === null || markdownLineEnding(code3)) { + return continuationStart(code3); + } + effects.enter("htmlFlowData"); + return continuation(code3); + } + function continuationCommentInside(code3) { + if (code3 === 45) { + effects.consume(code3); + return continuationDeclarationInside; + } + return continuation(code3); + } + function continuationRawTagOpen(code3) { + if (code3 === 47) { + effects.consume(code3); + buffer = ""; + return continuationRawEndTag; + } + return continuation(code3); + } + function continuationRawEndTag(code3) { + if (code3 === 62) { + const name = buffer.toLowerCase(); + if (htmlRawNames.includes(name)) { + effects.consume(code3); + return continuationClose; + } + return continuation(code3); + } + if (asciiAlpha(code3) && buffer.length < 8) { + effects.consume(code3); + buffer += String.fromCharCode(code3); + return continuationRawEndTag; + } + return continuation(code3); + } + function continuationCdataInside(code3) { + if (code3 === 93) { + effects.consume(code3); + return continuationDeclarationInside; + } + return continuation(code3); + } + function continuationDeclarationInside(code3) { + if (code3 === 62) { + effects.consume(code3); + return continuationClose; + } + if (code3 === 45 && marker === 2) { + effects.consume(code3); + return continuationDeclarationInside; + } + return continuation(code3); + } + function continuationClose(code3) { + if (code3 === null || markdownLineEnding(code3)) { + effects.exit("htmlFlowData"); + return continuationAfter(code3); + } + effects.consume(code3); + return continuationClose; + } + function continuationAfter(code3) { + effects.exit("htmlFlow"); + return ok3(code3); + } + } + function tokenizeNonLazyContinuationStart(effects, ok3, nok) { + const self2 = this; + return start; + function start(code3) { + if (markdownLineEnding(code3)) { + effects.enter("lineEnding"); + effects.consume(code3); + effects.exit("lineEnding"); + return after; + } + return nok(code3); + } + function after(code3) { + return self2.parser.lazy[self2.now().line] ? nok(code3) : ok3(code3); + } + } + function tokenizeBlankLineBefore(effects, ok3, nok) { + return start; + function start(code3) { + effects.enter("lineEnding"); + effects.consume(code3); + effects.exit("lineEnding"); + return effects.attempt(blankLine, ok3, nok); + } + } + + // node_modules/micromark-core-commonmark/lib/html-text.js + var htmlText = { + name: "htmlText", + tokenize: tokenizeHtmlText + }; + function tokenizeHtmlText(effects, ok3, nok) { + const self2 = this; + let marker; + let index2; + let returnState; + return start; + function start(code3) { + effects.enter("htmlText"); + effects.enter("htmlTextData"); + effects.consume(code3); + return open; + } + function open(code3) { + if (code3 === 33) { + effects.consume(code3); + return declarationOpen; + } + if (code3 === 47) { + effects.consume(code3); + return tagCloseStart; + } + if (code3 === 63) { + effects.consume(code3); + return instruction; + } + if (asciiAlpha(code3)) { + effects.consume(code3); + return tagOpen; + } + return nok(code3); + } + function declarationOpen(code3) { + if (code3 === 45) { + effects.consume(code3); + return commentOpenInside; + } + if (code3 === 91) { + effects.consume(code3); + index2 = 0; + return cdataOpenInside; + } + if (asciiAlpha(code3)) { + effects.consume(code3); + return declaration; + } + return nok(code3); + } + function commentOpenInside(code3) { + if (code3 === 45) { + effects.consume(code3); + return commentEnd; + } + return nok(code3); + } + function comment(code3) { + if (code3 === null) { + return nok(code3); + } + if (code3 === 45) { + effects.consume(code3); + return commentClose; + } + if (markdownLineEnding(code3)) { + returnState = comment; + return lineEndingBefore(code3); + } + effects.consume(code3); + return comment; + } + function commentClose(code3) { + if (code3 === 45) { + effects.consume(code3); + return commentEnd; + } + return comment(code3); + } + function commentEnd(code3) { + return code3 === 62 ? end(code3) : code3 === 45 ? commentClose(code3) : comment(code3); + } + function cdataOpenInside(code3) { + const value = "CDATA["; + if (code3 === value.charCodeAt(index2++)) { + effects.consume(code3); + return index2 === value.length ? cdata : cdataOpenInside; + } + return nok(code3); + } + function cdata(code3) { + if (code3 === null) { + return nok(code3); + } + if (code3 === 93) { + effects.consume(code3); + return cdataClose; + } + if (markdownLineEnding(code3)) { + returnState = cdata; + return lineEndingBefore(code3); + } + effects.consume(code3); + return cdata; + } + function cdataClose(code3) { + if (code3 === 93) { + effects.consume(code3); + return cdataEnd; + } + return cdata(code3); + } + function cdataEnd(code3) { + if (code3 === 62) { + return end(code3); + } + if (code3 === 93) { + effects.consume(code3); + return cdataEnd; + } + return cdata(code3); + } + function declaration(code3) { + if (code3 === null || code3 === 62) { + return end(code3); + } + if (markdownLineEnding(code3)) { + returnState = declaration; + return lineEndingBefore(code3); + } + effects.consume(code3); + return declaration; + } + function instruction(code3) { + if (code3 === null) { + return nok(code3); + } + if (code3 === 63) { + effects.consume(code3); + return instructionClose; + } + if (markdownLineEnding(code3)) { + returnState = instruction; + return lineEndingBefore(code3); + } + effects.consume(code3); + return instruction; + } + function instructionClose(code3) { + return code3 === 62 ? end(code3) : instruction(code3); + } + function tagCloseStart(code3) { + if (asciiAlpha(code3)) { + effects.consume(code3); + return tagClose; + } + return nok(code3); + } + function tagClose(code3) { + if (code3 === 45 || asciiAlphanumeric(code3)) { + effects.consume(code3); + return tagClose; + } + return tagCloseBetween(code3); + } + function tagCloseBetween(code3) { + if (markdownLineEnding(code3)) { + returnState = tagCloseBetween; + return lineEndingBefore(code3); + } + if (markdownSpace(code3)) { + effects.consume(code3); + return tagCloseBetween; + } + return end(code3); + } + function tagOpen(code3) { + if (code3 === 45 || asciiAlphanumeric(code3)) { + effects.consume(code3); + return tagOpen; + } + if (code3 === 47 || code3 === 62 || markdownLineEndingOrSpace(code3)) { + return tagOpenBetween(code3); + } + return nok(code3); + } + function tagOpenBetween(code3) { + if (code3 === 47) { + effects.consume(code3); + return end; + } + if (code3 === 58 || code3 === 95 || asciiAlpha(code3)) { + effects.consume(code3); + return tagOpenAttributeName; + } + if (markdownLineEnding(code3)) { + returnState = tagOpenBetween; + return lineEndingBefore(code3); + } + if (markdownSpace(code3)) { + effects.consume(code3); + return tagOpenBetween; + } + return end(code3); + } + function tagOpenAttributeName(code3) { + if (code3 === 45 || code3 === 46 || code3 === 58 || code3 === 95 || asciiAlphanumeric(code3)) { + effects.consume(code3); + return tagOpenAttributeName; + } + return tagOpenAttributeNameAfter(code3); + } + function tagOpenAttributeNameAfter(code3) { + if (code3 === 61) { + effects.consume(code3); + return tagOpenAttributeValueBefore; + } + if (markdownLineEnding(code3)) { + returnState = tagOpenAttributeNameAfter; + return lineEndingBefore(code3); + } + if (markdownSpace(code3)) { + effects.consume(code3); + return tagOpenAttributeNameAfter; + } + return tagOpenBetween(code3); + } + function tagOpenAttributeValueBefore(code3) { + if (code3 === null || code3 === 60 || code3 === 61 || code3 === 62 || code3 === 96) { + return nok(code3); + } + if (code3 === 34 || code3 === 39) { + effects.consume(code3); + marker = code3; + return tagOpenAttributeValueQuoted; + } + if (markdownLineEnding(code3)) { + returnState = tagOpenAttributeValueBefore; + return lineEndingBefore(code3); + } + if (markdownSpace(code3)) { + effects.consume(code3); + return tagOpenAttributeValueBefore; + } + effects.consume(code3); + return tagOpenAttributeValueUnquoted; + } + function tagOpenAttributeValueQuoted(code3) { + if (code3 === marker) { + effects.consume(code3); + marker = void 0; + return tagOpenAttributeValueQuotedAfter; + } + if (code3 === null) { + return nok(code3); + } + if (markdownLineEnding(code3)) { + returnState = tagOpenAttributeValueQuoted; + return lineEndingBefore(code3); + } + effects.consume(code3); + return tagOpenAttributeValueQuoted; + } + function tagOpenAttributeValueUnquoted(code3) { + if (code3 === null || code3 === 34 || code3 === 39 || code3 === 60 || code3 === 61 || code3 === 96) { + return nok(code3); + } + if (code3 === 47 || code3 === 62 || markdownLineEndingOrSpace(code3)) { + return tagOpenBetween(code3); + } + effects.consume(code3); + return tagOpenAttributeValueUnquoted; + } + function tagOpenAttributeValueQuotedAfter(code3) { + if (code3 === 47 || code3 === 62 || markdownLineEndingOrSpace(code3)) { + return tagOpenBetween(code3); + } + return nok(code3); + } + function end(code3) { + if (code3 === 62) { + effects.consume(code3); + effects.exit("htmlTextData"); + effects.exit("htmlText"); + return ok3; + } + return nok(code3); + } + function lineEndingBefore(code3) { + effects.exit("htmlTextData"); + effects.enter("lineEnding"); + effects.consume(code3); + effects.exit("lineEnding"); + return lineEndingAfter; + } + function lineEndingAfter(code3) { + return markdownSpace(code3) ? factorySpace(effects, lineEndingAfterPrefix, "linePrefix", self2.parser.constructs.disable.null.includes("codeIndented") ? void 0 : 4)(code3) : lineEndingAfterPrefix(code3); + } + function lineEndingAfterPrefix(code3) { + effects.enter("htmlTextData"); + return returnState(code3); + } + } + + // node_modules/micromark-core-commonmark/lib/label-end.js + var labelEnd = { + name: "labelEnd", + tokenize: tokenizeLabelEnd, + resolveTo: resolveToLabelEnd, + resolveAll: resolveAllLabelEnd + }; + var resourceConstruct = { + tokenize: tokenizeResource + }; + var referenceFullConstruct = { + tokenize: tokenizeReferenceFull + }; + var referenceCollapsedConstruct = { + tokenize: tokenizeReferenceCollapsed + }; + function resolveAllLabelEnd(events) { + let index2 = -1; + while (++index2 < events.length) { + const token = events[index2][1]; + if (token.type === "labelImage" || token.type === "labelLink" || token.type === "labelEnd") { + events.splice(index2 + 1, token.type === "labelImage" ? 4 : 2); + token.type = "data"; + index2++; + } + } + return events; + } + function resolveToLabelEnd(events, context) { + let index2 = events.length; + let offset = 0; + let token; + let open; + let close2; + let media; + while (index2--) { + token = events[index2][1]; + if (open) { + if (token.type === "link" || token.type === "labelLink" && token._inactive) { + break; + } + if (events[index2][0] === "enter" && token.type === "labelLink") { + token._inactive = true; + } + } else if (close2) { + if (events[index2][0] === "enter" && (token.type === "labelImage" || token.type === "labelLink") && !token._balanced) { + open = index2; + if (token.type !== "labelLink") { + offset = 2; + break; + } + } + } else if (token.type === "labelEnd") { + close2 = index2; + } + } + const group = { + type: events[open][1].type === "labelLink" ? "link" : "image", + start: Object.assign({}, events[open][1].start), + end: Object.assign({}, events[events.length - 1][1].end) + }; + const label = { + type: "label", + start: Object.assign({}, events[open][1].start), + end: Object.assign({}, events[close2][1].end) + }; + const text5 = { + type: "labelText", + start: Object.assign({}, events[open + offset + 2][1].end), + end: Object.assign({}, events[close2 - 2][1].start) + }; + media = [["enter", group, context], ["enter", label, context]]; + media = push(media, events.slice(open + 1, open + offset + 3)); + media = push(media, [["enter", text5, context]]); + media = push(media, resolveAll(context.parser.constructs.insideSpan.null, events.slice(open + offset + 4, close2 - 3), context)); + media = push(media, [["exit", text5, context], events[close2 - 2], events[close2 - 1], ["exit", label, context]]); + media = push(media, events.slice(close2 + 1)); + media = push(media, [["exit", group, context]]); + splice(events, open, events.length, media); + return events; + } + function tokenizeLabelEnd(effects, ok3, nok) { + const self2 = this; + let index2 = self2.events.length; + let labelStart; + let defined; + while (index2--) { + if ((self2.events[index2][1].type === "labelImage" || self2.events[index2][1].type === "labelLink") && !self2.events[index2][1]._balanced) { + labelStart = self2.events[index2][1]; + break; + } + } + return start; + function start(code3) { + if (!labelStart) { + return nok(code3); + } + if (labelStart._inactive) { + return labelEndNok(code3); + } + defined = self2.parser.defined.includes(normalizeIdentifier(self2.sliceSerialize({ + start: labelStart.end, + end: self2.now() + }))); + effects.enter("labelEnd"); + effects.enter("labelMarker"); + effects.consume(code3); + effects.exit("labelMarker"); + effects.exit("labelEnd"); + return after; + } + function after(code3) { + if (code3 === 40) { + return effects.attempt(resourceConstruct, labelEndOk, defined ? labelEndOk : labelEndNok)(code3); + } + if (code3 === 91) { + return effects.attempt(referenceFullConstruct, labelEndOk, defined ? referenceNotFull : labelEndNok)(code3); + } + return defined ? labelEndOk(code3) : labelEndNok(code3); + } + function referenceNotFull(code3) { + return effects.attempt(referenceCollapsedConstruct, labelEndOk, labelEndNok)(code3); + } + function labelEndOk(code3) { + return ok3(code3); + } + function labelEndNok(code3) { + labelStart._balanced = true; + return nok(code3); + } + } + function tokenizeResource(effects, ok3, nok) { + return resourceStart; + function resourceStart(code3) { + effects.enter("resource"); + effects.enter("resourceMarker"); + effects.consume(code3); + effects.exit("resourceMarker"); + return resourceBefore; + } + function resourceBefore(code3) { + return markdownLineEndingOrSpace(code3) ? factoryWhitespace(effects, resourceOpen)(code3) : resourceOpen(code3); + } + function resourceOpen(code3) { + if (code3 === 41) { + return resourceEnd(code3); + } + return factoryDestination(effects, resourceDestinationAfter, resourceDestinationMissing, "resourceDestination", "resourceDestinationLiteral", "resourceDestinationLiteralMarker", "resourceDestinationRaw", "resourceDestinationString", 32)(code3); + } + function resourceDestinationAfter(code3) { + return markdownLineEndingOrSpace(code3) ? factoryWhitespace(effects, resourceBetween)(code3) : resourceEnd(code3); + } + function resourceDestinationMissing(code3) { + return nok(code3); + } + function resourceBetween(code3) { + if (code3 === 34 || code3 === 39 || code3 === 40) { + return factoryTitle(effects, resourceTitleAfter, nok, "resourceTitle", "resourceTitleMarker", "resourceTitleString")(code3); + } + return resourceEnd(code3); + } + function resourceTitleAfter(code3) { + return markdownLineEndingOrSpace(code3) ? factoryWhitespace(effects, resourceEnd)(code3) : resourceEnd(code3); + } + function resourceEnd(code3) { + if (code3 === 41) { + effects.enter("resourceMarker"); + effects.consume(code3); + effects.exit("resourceMarker"); + effects.exit("resource"); + return ok3; + } + return nok(code3); + } + } + function tokenizeReferenceFull(effects, ok3, nok) { + const self2 = this; + return referenceFull; + function referenceFull(code3) { + return factoryLabel.call(self2, effects, referenceFullAfter, referenceFullMissing, "reference", "referenceMarker", "referenceString")(code3); + } + function referenceFullAfter(code3) { + return self2.parser.defined.includes(normalizeIdentifier(self2.sliceSerialize(self2.events[self2.events.length - 1][1]).slice(1, -1))) ? ok3(code3) : nok(code3); + } + function referenceFullMissing(code3) { + return nok(code3); + } + } + function tokenizeReferenceCollapsed(effects, ok3, nok) { + return referenceCollapsedStart; + function referenceCollapsedStart(code3) { + effects.enter("reference"); + effects.enter("referenceMarker"); + effects.consume(code3); + effects.exit("referenceMarker"); + return referenceCollapsedOpen; + } + function referenceCollapsedOpen(code3) { + if (code3 === 93) { + effects.enter("referenceMarker"); + effects.consume(code3); + effects.exit("referenceMarker"); + effects.exit("reference"); + return ok3; + } + return nok(code3); + } + } + + // node_modules/micromark-core-commonmark/lib/label-start-image.js + var labelStartImage = { + name: "labelStartImage", + tokenize: tokenizeLabelStartImage, + resolveAll: labelEnd.resolveAll + }; + function tokenizeLabelStartImage(effects, ok3, nok) { + const self2 = this; + return start; + function start(code3) { + effects.enter("labelImage"); + effects.enter("labelImageMarker"); + effects.consume(code3); + effects.exit("labelImageMarker"); + return open; + } + function open(code3) { + if (code3 === 91) { + effects.enter("labelMarker"); + effects.consume(code3); + effects.exit("labelMarker"); + effects.exit("labelImage"); + return after; + } + return nok(code3); + } + function after(code3) { + return code3 === 94 && "_hiddenFootnoteSupport" in self2.parser.constructs ? nok(code3) : ok3(code3); + } + } + + // node_modules/micromark-core-commonmark/lib/label-start-link.js + var labelStartLink = { + name: "labelStartLink", + tokenize: tokenizeLabelStartLink, + resolveAll: labelEnd.resolveAll + }; + function tokenizeLabelStartLink(effects, ok3, nok) { + const self2 = this; + return start; + function start(code3) { + effects.enter("labelLink"); + effects.enter("labelMarker"); + effects.consume(code3); + effects.exit("labelMarker"); + effects.exit("labelLink"); + return after; + } + function after(code3) { + return code3 === 94 && "_hiddenFootnoteSupport" in self2.parser.constructs ? nok(code3) : ok3(code3); + } + } + + // node_modules/micromark-core-commonmark/lib/line-ending.js + var lineEnding = { + name: "lineEnding", + tokenize: tokenizeLineEnding + }; + function tokenizeLineEnding(effects, ok3) { + return start; + function start(code3) { + effects.enter("lineEnding"); + effects.consume(code3); + effects.exit("lineEnding"); + return factorySpace(effects, ok3, "linePrefix"); + } + } + + // node_modules/micromark-core-commonmark/lib/thematic-break.js + var thematicBreak = { + name: "thematicBreak", + tokenize: tokenizeThematicBreak + }; + function tokenizeThematicBreak(effects, ok3, nok) { + let size = 0; + let marker; + return start; + function start(code3) { + effects.enter("thematicBreak"); + return before(code3); + } + function before(code3) { + marker = code3; + return atBreak(code3); + } + function atBreak(code3) { + if (code3 === marker) { + effects.enter("thematicBreakSequence"); + return sequence(code3); + } + if (size >= 3 && (code3 === null || markdownLineEnding(code3))) { + effects.exit("thematicBreak"); + return ok3(code3); + } + return nok(code3); + } + function sequence(code3) { + if (code3 === marker) { + effects.consume(code3); + size++; + return sequence; + } + effects.exit("thematicBreakSequence"); + return markdownSpace(code3) ? factorySpace(effects, atBreak, "whitespace")(code3) : atBreak(code3); + } + } + + // node_modules/micromark-core-commonmark/lib/list.js + var list = { + name: "list", + tokenize: tokenizeListStart, + continuation: { + tokenize: tokenizeListContinuation + }, + exit: tokenizeListEnd + }; + var listItemPrefixWhitespaceConstruct = { + tokenize: tokenizeListItemPrefixWhitespace, + partial: true + }; + var indentConstruct = { + tokenize: tokenizeIndent, + partial: true + }; + function tokenizeListStart(effects, ok3, nok) { + const self2 = this; + const tail = self2.events[self2.events.length - 1]; + let initialSize = tail && tail[1].type === "linePrefix" ? tail[2].sliceSerialize(tail[1], true).length : 0; + let size = 0; + return start; + function start(code3) { + const kind = self2.containerState.type || (code3 === 42 || code3 === 43 || code3 === 45 ? "listUnordered" : "listOrdered"); + if (kind === "listUnordered" ? !self2.containerState.marker || code3 === self2.containerState.marker : asciiDigit(code3)) { + if (!self2.containerState.type) { + self2.containerState.type = kind; + effects.enter(kind, { + _container: true + }); + } + if (kind === "listUnordered") { + effects.enter("listItemPrefix"); + return code3 === 42 || code3 === 45 ? effects.check(thematicBreak, nok, atMarker)(code3) : atMarker(code3); + } + if (!self2.interrupt || code3 === 49) { + effects.enter("listItemPrefix"); + effects.enter("listItemValue"); + return inside(code3); + } + } + return nok(code3); + } + function inside(code3) { + if (asciiDigit(code3) && ++size < 10) { + effects.consume(code3); + return inside; + } + if ((!self2.interrupt || size < 2) && (self2.containerState.marker ? code3 === self2.containerState.marker : code3 === 41 || code3 === 46)) { + effects.exit("listItemValue"); + return atMarker(code3); + } + return nok(code3); + } + function atMarker(code3) { + effects.enter("listItemMarker"); + effects.consume(code3); + effects.exit("listItemMarker"); + self2.containerState.marker = self2.containerState.marker || code3; + return effects.check( + blankLine, + // Can’t be empty when interrupting. + self2.interrupt ? nok : onBlank, + effects.attempt(listItemPrefixWhitespaceConstruct, endOfPrefix, otherPrefix) + ); + } + function onBlank(code3) { + self2.containerState.initialBlankLine = true; + initialSize++; + return endOfPrefix(code3); + } + function otherPrefix(code3) { + if (markdownSpace(code3)) { + effects.enter("listItemPrefixWhitespace"); + effects.consume(code3); + effects.exit("listItemPrefixWhitespace"); + return endOfPrefix; + } + return nok(code3); + } + function endOfPrefix(code3) { + self2.containerState.size = initialSize + self2.sliceSerialize(effects.exit("listItemPrefix"), true).length; + return ok3(code3); + } + } + function tokenizeListContinuation(effects, ok3, nok) { + const self2 = this; + self2.containerState._closeFlow = void 0; + return effects.check(blankLine, onBlank, notBlank); + function onBlank(code3) { + self2.containerState.furtherBlankLines = self2.containerState.furtherBlankLines || self2.containerState.initialBlankLine; + return factorySpace(effects, ok3, "listItemIndent", self2.containerState.size + 1)(code3); + } + function notBlank(code3) { + if (self2.containerState.furtherBlankLines || !markdownSpace(code3)) { + self2.containerState.furtherBlankLines = void 0; + self2.containerState.initialBlankLine = void 0; + return notInCurrentItem(code3); + } + self2.containerState.furtherBlankLines = void 0; + self2.containerState.initialBlankLine = void 0; + return effects.attempt(indentConstruct, ok3, notInCurrentItem)(code3); + } + function notInCurrentItem(code3) { + self2.containerState._closeFlow = true; + self2.interrupt = void 0; + return factorySpace(effects, effects.attempt(list, ok3, nok), "linePrefix", self2.parser.constructs.disable.null.includes("codeIndented") ? void 0 : 4)(code3); + } + } + function tokenizeIndent(effects, ok3, nok) { + const self2 = this; + return factorySpace(effects, afterPrefix, "listItemIndent", self2.containerState.size + 1); + function afterPrefix(code3) { + const tail = self2.events[self2.events.length - 1]; + return tail && tail[1].type === "listItemIndent" && tail[2].sliceSerialize(tail[1], true).length === self2.containerState.size ? ok3(code3) : nok(code3); + } + } + function tokenizeListEnd(effects) { + effects.exit(this.containerState.type); + } + function tokenizeListItemPrefixWhitespace(effects, ok3, nok) { + const self2 = this; + return factorySpace(effects, afterPrefix, "listItemPrefixWhitespace", self2.parser.constructs.disable.null.includes("codeIndented") ? void 0 : 4 + 1); + function afterPrefix(code3) { + const tail = self2.events[self2.events.length - 1]; + return !markdownSpace(code3) && tail && tail[1].type === "listItemPrefixWhitespace" ? ok3(code3) : nok(code3); + } + } + + // node_modules/micromark-core-commonmark/lib/setext-underline.js + var setextUnderline = { + name: "setextUnderline", + tokenize: tokenizeSetextUnderline, + resolveTo: resolveToSetextUnderline + }; + function resolveToSetextUnderline(events, context) { + let index2 = events.length; + let content3; + let text5; + let definition3; + while (index2--) { + if (events[index2][0] === "enter") { + if (events[index2][1].type === "content") { + content3 = index2; + break; + } + if (events[index2][1].type === "paragraph") { + text5 = index2; + } + } else { + if (events[index2][1].type === "content") { + events.splice(index2, 1); + } + if (!definition3 && events[index2][1].type === "definition") { + definition3 = index2; + } + } + } + const heading2 = { + type: "setextHeading", + start: Object.assign({}, events[text5][1].start), + end: Object.assign({}, events[events.length - 1][1].end) + }; + events[text5][1].type = "setextHeadingText"; + if (definition3) { + events.splice(text5, 0, ["enter", heading2, context]); + events.splice(definition3 + 1, 0, ["exit", events[content3][1], context]); + events[content3][1].end = Object.assign({}, events[definition3][1].end); + } else { + events[content3][1] = heading2; + } + events.push(["exit", heading2, context]); + return events; + } + function tokenizeSetextUnderline(effects, ok3, nok) { + const self2 = this; + let marker; + return start; + function start(code3) { + let index2 = self2.events.length; + let paragraph2; + while (index2--) { + if (self2.events[index2][1].type !== "lineEnding" && self2.events[index2][1].type !== "linePrefix" && self2.events[index2][1].type !== "content") { + paragraph2 = self2.events[index2][1].type === "paragraph"; + break; + } + } + if (!self2.parser.lazy[self2.now().line] && (self2.interrupt || paragraph2)) { + effects.enter("setextHeadingLine"); + marker = code3; + return before(code3); + } + return nok(code3); + } + function before(code3) { + effects.enter("setextHeadingLineSequence"); + return inside(code3); + } + function inside(code3) { + if (code3 === marker) { + effects.consume(code3); + return inside; + } + effects.exit("setextHeadingLineSequence"); + return markdownSpace(code3) ? factorySpace(effects, after, "lineSuffix")(code3) : after(code3); + } + function after(code3) { + if (code3 === null || markdownLineEnding(code3)) { + effects.exit("setextHeadingLine"); + return ok3(code3); + } + return nok(code3); + } + } + + // node_modules/micromark/lib/initialize/flow.js + var flow = { + tokenize: initializeFlow + }; + function initializeFlow(effects) { + const self2 = this; + const initial = effects.attempt( + // Try to parse a blank line. + blankLine, + atBlankEnding, + // Try to parse initial flow (essentially, only code). + effects.attempt( + this.parser.constructs.flowInitial, + afterConstruct, + factorySpace( + effects, + effects.attempt( + this.parser.constructs.flow, + afterConstruct, + effects.attempt(content2, afterConstruct) + ), + "linePrefix" + ) + ) + ); + return initial; + function atBlankEnding(code3) { + if (code3 === null) { + effects.consume(code3); + return; + } + effects.enter("lineEndingBlank"); + effects.consume(code3); + effects.exit("lineEndingBlank"); + self2.currentConstruct = void 0; + return initial; + } + function afterConstruct(code3) { + if (code3 === null) { + effects.consume(code3); + return; + } + effects.enter("lineEnding"); + effects.consume(code3); + effects.exit("lineEnding"); + self2.currentConstruct = void 0; + return initial; + } + } + + // node_modules/micromark/lib/initialize/text.js + var resolver = { + resolveAll: createResolver() + }; + var string = initializeFactory("string"); + var text = initializeFactory("text"); + function initializeFactory(field) { + return { + tokenize: initializeText, + resolveAll: createResolver( + field === "text" ? resolveAllLineSuffixes : void 0 + ) + }; + function initializeText(effects) { + const self2 = this; + const constructs2 = this.parser.constructs[field]; + const text5 = effects.attempt(constructs2, start, notText); + return start; + function start(code3) { + return atBreak(code3) ? text5(code3) : notText(code3); + } + function notText(code3) { + if (code3 === null) { + effects.consume(code3); + return; + } + effects.enter("data"); + effects.consume(code3); + return data; + } + function data(code3) { + if (atBreak(code3)) { + effects.exit("data"); + return text5(code3); + } + effects.consume(code3); + return data; + } + function atBreak(code3) { + if (code3 === null) { + return true; + } + const list4 = constructs2[code3]; + let index2 = -1; + if (list4) { + while (++index2 < list4.length) { + const item = list4[index2]; + if (!item.previous || item.previous.call(self2, self2.previous)) { + return true; + } + } + } + return false; + } + } + } + function createResolver(extraResolver) { + return resolveAllText; + function resolveAllText(events, context) { + let index2 = -1; + let enter; + while (++index2 <= events.length) { + if (enter === void 0) { + if (events[index2] && events[index2][1].type === "data") { + enter = index2; + index2++; + } + } else if (!events[index2] || events[index2][1].type !== "data") { + if (index2 !== enter + 2) { + events[enter][1].end = events[index2 - 1][1].end; + events.splice(enter + 2, index2 - enter - 2); + index2 = enter + 2; + } + enter = void 0; + } + } + return extraResolver ? extraResolver(events, context) : events; + } + } + function resolveAllLineSuffixes(events, context) { + let eventIndex = 0; + while (++eventIndex <= events.length) { + if ((eventIndex === events.length || events[eventIndex][1].type === "lineEnding") && events[eventIndex - 1][1].type === "data") { + const data = events[eventIndex - 1][1]; + const chunks = context.sliceStream(data); + let index2 = chunks.length; + let bufferIndex = -1; + let size = 0; + let tabs; + while (index2--) { + const chunk = chunks[index2]; + if (typeof chunk === "string") { + bufferIndex = chunk.length; + while (chunk.charCodeAt(bufferIndex - 1) === 32) { + size++; + bufferIndex--; + } + if (bufferIndex) break; + bufferIndex = -1; + } else if (chunk === -2) { + tabs = true; + size++; + } else if (chunk === -1) { + } else { + index2++; + break; + } + } + if (size) { + const token = { + type: eventIndex === events.length || tabs || size < 2 ? "lineSuffix" : "hardBreakTrailing", + start: { + line: data.end.line, + column: data.end.column - size, + offset: data.end.offset - size, + _index: data.start._index + index2, + _bufferIndex: index2 ? bufferIndex : data.start._bufferIndex + bufferIndex + }, + end: Object.assign({}, data.end) + }; + data.end = Object.assign({}, token.start); + if (data.start.offset === data.end.offset) { + Object.assign(data, token); + } else { + events.splice( + eventIndex, + 0, + ["enter", token, context], + ["exit", token, context] + ); + eventIndex += 2; + } + } + eventIndex++; + } + } + return events; + } + + // node_modules/micromark/lib/create-tokenizer.js + function createTokenizer(parser, initialize, from) { + let point3 = Object.assign( + from ? Object.assign({}, from) : { + line: 1, + column: 1, + offset: 0 + }, + { + _index: 0, + _bufferIndex: -1 + } + ); + const columnStart = {}; + const resolveAllConstructs = []; + let chunks = []; + let stack = []; + let consumed = true; + const effects = { + consume, + enter, + exit: exit3, + attempt: constructFactory(onsuccessfulconstruct), + check: constructFactory(onsuccessfulcheck), + interrupt: constructFactory(onsuccessfulcheck, { + interrupt: true + }) + }; + const context = { + previous: null, + code: null, + containerState: {}, + events: [], + parser, + sliceStream, + sliceSerialize, + now, + defineSkip, + write + }; + let state = initialize.tokenize.call(context, effects); + let expectedCode; + if (initialize.resolveAll) { + resolveAllConstructs.push(initialize); + } + return context; + function write(slice) { + chunks = push(chunks, slice); + main(); + if (chunks[chunks.length - 1] !== null) { + return []; + } + addResult(initialize, 0); + context.events = resolveAll(resolveAllConstructs, context.events, context); + return context.events; + } + function sliceSerialize(token, expandTabs) { + return serializeChunks(sliceStream(token), expandTabs); + } + function sliceStream(token) { + return sliceChunks(chunks, token); + } + function now() { + const { line, column, offset, _index, _bufferIndex } = point3; + return { + line, + column, + offset, + _index, + _bufferIndex + }; + } + function defineSkip(value) { + columnStart[value.line] = value.column; + accountForPotentialSkip(); + } + function main() { + let chunkIndex; + while (point3._index < chunks.length) { + const chunk = chunks[point3._index]; + if (typeof chunk === "string") { + chunkIndex = point3._index; + if (point3._bufferIndex < 0) { + point3._bufferIndex = 0; + } + while (point3._index === chunkIndex && point3._bufferIndex < chunk.length) { + go(chunk.charCodeAt(point3._bufferIndex)); + } + } else { + go(chunk); + } + } + } + function go(code3) { + consumed = void 0; + expectedCode = code3; + state = state(code3); + } + function consume(code3) { + if (markdownLineEnding(code3)) { + point3.line++; + point3.column = 1; + point3.offset += code3 === -3 ? 2 : 1; + accountForPotentialSkip(); + } else if (code3 !== -1) { + point3.column++; + point3.offset++; + } + if (point3._bufferIndex < 0) { + point3._index++; + } else { + point3._bufferIndex++; + if (point3._bufferIndex === chunks[point3._index].length) { + point3._bufferIndex = -1; + point3._index++; + } + } + context.previous = code3; + consumed = true; + } + function enter(type, fields) { + const token = fields || {}; + token.type = type; + token.start = now(); + context.events.push(["enter", token, context]); + stack.push(token); + return token; + } + function exit3(type) { + const token = stack.pop(); + token.end = now(); + context.events.push(["exit", token, context]); + return token; + } + function onsuccessfulconstruct(construct, info) { + addResult(construct, info.from); + } + function onsuccessfulcheck(_3, info) { + info.restore(); + } + function constructFactory(onreturn, fields) { + return hook; + function hook(constructs2, returnState, bogusState) { + let listOfConstructs; + let constructIndex; + let currentConstruct; + let info; + return Array.isArray(constructs2) ? handleListOfConstructs(constructs2) : "tokenize" in constructs2 ? ( + // @ts-expect-error Looks like a construct. + handleListOfConstructs([constructs2]) + ) : handleMapOfConstructs(constructs2); + function handleMapOfConstructs(map5) { + return start; + function start(code3) { + const def = code3 !== null && map5[code3]; + const all2 = code3 !== null && map5.null; + const list4 = [ + // To do: add more extension tests. + /* c8 ignore next 2 */ + ...Array.isArray(def) ? def : def ? [def] : [], + ...Array.isArray(all2) ? all2 : all2 ? [all2] : [] + ]; + return handleListOfConstructs(list4)(code3); + } + } + function handleListOfConstructs(list4) { + listOfConstructs = list4; + constructIndex = 0; + if (list4.length === 0) { + return bogusState; + } + return handleConstruct(list4[constructIndex]); + } + function handleConstruct(construct) { + return start; + function start(code3) { + info = store(); + currentConstruct = construct; + if (!construct.partial) { + context.currentConstruct = construct; + } + if (construct.name && context.parser.constructs.disable.null.includes(construct.name)) { + return nok(code3); + } + return construct.tokenize.call( + // If we do have fields, create an object w/ `context` as its + // prototype. + // This allows a “live binding”, which is needed for `interrupt`. + fields ? Object.assign(Object.create(context), fields) : context, + effects, + ok3, + nok + )(code3); + } + } + function ok3(code3) { + consumed = true; + onreturn(currentConstruct, info); + return returnState; + } + function nok(code3) { + consumed = true; + info.restore(); + if (++constructIndex < listOfConstructs.length) { + return handleConstruct(listOfConstructs[constructIndex]); + } + return bogusState; + } + } + } + function addResult(construct, from2) { + if (construct.resolveAll && !resolveAllConstructs.includes(construct)) { + resolveAllConstructs.push(construct); + } + if (construct.resolve) { + splice( + context.events, + from2, + context.events.length - from2, + construct.resolve(context.events.slice(from2), context) + ); + } + if (construct.resolveTo) { + context.events = construct.resolveTo(context.events, context); + } + } + function store() { + const startPoint = now(); + const startPrevious = context.previous; + const startCurrentConstruct = context.currentConstruct; + const startEventsIndex = context.events.length; + const startStack = Array.from(stack); + return { + restore, + from: startEventsIndex + }; + function restore() { + point3 = startPoint; + context.previous = startPrevious; + context.currentConstruct = startCurrentConstruct; + context.events.length = startEventsIndex; + stack = startStack; + accountForPotentialSkip(); + } + } + function accountForPotentialSkip() { + if (point3.line in columnStart && point3.column < 2) { + point3.column = columnStart[point3.line]; + point3.offset += columnStart[point3.line] - 1; + } + } + } + function sliceChunks(chunks, token) { + const startIndex = token.start._index; + const startBufferIndex = token.start._bufferIndex; + const endIndex = token.end._index; + const endBufferIndex = token.end._bufferIndex; + let view; + if (startIndex === endIndex) { + view = [chunks[startIndex].slice(startBufferIndex, endBufferIndex)]; + } else { + view = chunks.slice(startIndex, endIndex); + if (startBufferIndex > -1) { + const head = view[0]; + if (typeof head === "string") { + view[0] = head.slice(startBufferIndex); + } else { + view.shift(); + } + } + if (endBufferIndex > 0) { + view.push(chunks[endIndex].slice(0, endBufferIndex)); + } + } + return view; + } + function serializeChunks(chunks, expandTabs) { + let index2 = -1; + const result = []; + let atTab; + while (++index2 < chunks.length) { + const chunk = chunks[index2]; + let value; + if (typeof chunk === "string") { + value = chunk; + } else + switch (chunk) { + case -5: { + value = "\r"; + break; + } + case -4: { + value = "\n"; + break; + } + case -3: { + value = "\r\n"; + break; + } + case -2: { + value = expandTabs ? " " : " "; + break; + } + case -1: { + if (!expandTabs && atTab) continue; + value = " "; + break; + } + default: { + value = String.fromCharCode(chunk); + } + } + atTab = chunk === -2; + result.push(value); + } + return result.join(""); + } + + // node_modules/micromark/lib/constructs.js + var constructs_exports = {}; + __export(constructs_exports, { + attentionMarkers: () => attentionMarkers, + contentInitial: () => contentInitial, + disable: () => disable, + document: () => document3, + flow: () => flow2, + flowInitial: () => flowInitial, + insideSpan: () => insideSpan, + string: () => string2, + text: () => text2 + }); + var document3 = { + [42]: list, + [43]: list, + [45]: list, + [48]: list, + [49]: list, + [50]: list, + [51]: list, + [52]: list, + [53]: list, + [54]: list, + [55]: list, + [56]: list, + [57]: list, + [62]: blockQuote + }; + var contentInitial = { + [91]: definition + }; + var flowInitial = { + [-2]: codeIndented, + [-1]: codeIndented, + [32]: codeIndented + }; + var flow2 = { + [35]: headingAtx, + [42]: thematicBreak, + [45]: [setextUnderline, thematicBreak], + [60]: htmlFlow, + [61]: setextUnderline, + [95]: thematicBreak, + [96]: codeFenced, + [126]: codeFenced + }; + var string2 = { + [38]: characterReference, + [92]: characterEscape + }; + var text2 = { + [-5]: lineEnding, + [-4]: lineEnding, + [-3]: lineEnding, + [33]: labelStartImage, + [38]: characterReference, + [42]: attention, + [60]: [autolink, htmlText], + [91]: labelStartLink, + [92]: [hardBreakEscape, characterEscape], + [93]: labelEnd, + [95]: attention, + [96]: codeText + }; + var insideSpan = { + null: [attention, resolver] + }; + var attentionMarkers = { + null: [42, 95] + }; + var disable = { + null: [] + }; + + // node_modules/micromark/lib/parse.js + function parse(options2) { + const settings = options2 || {}; + const constructs2 = ( + /** @type {FullNormalizedExtension} */ + combineExtensions([constructs_exports, ...settings.extensions || []]) + ); + const parser = { + defined: [], + lazy: {}, + constructs: constructs2, + content: create(content), + document: create(document2), + flow: create(flow), + string: create(string), + text: create(text) + }; + return parser; + function create(initial) { + return creator; + function creator(from) { + return createTokenizer(parser, initial, from); + } + } + } + + // node_modules/micromark/lib/postprocess.js + function postprocess(events) { + while (!subtokenize(events)) { + } + return events; + } + + // node_modules/micromark/lib/preprocess.js + var search = /[\0\t\n\r]/g; + function preprocess() { + let column = 1; + let buffer = ""; + let start = true; + let atCarriageReturn; + return preprocessor; + function preprocessor(value, encoding, end) { + const chunks = []; + let match; + let next; + let startPosition; + let endPosition; + let code3; + value = buffer + (typeof value === "string" ? value.toString() : new TextDecoder(encoding || void 0).decode(value)); + startPosition = 0; + buffer = ""; + if (start) { + if (value.charCodeAt(0) === 65279) { + startPosition++; + } + start = void 0; + } + while (startPosition < value.length) { + search.lastIndex = startPosition; + match = search.exec(value); + endPosition = match && match.index !== void 0 ? match.index : value.length; + code3 = value.charCodeAt(endPosition); + if (!match) { + buffer = value.slice(startPosition); + break; + } + if (code3 === 10 && startPosition === endPosition && atCarriageReturn) { + chunks.push(-3); + atCarriageReturn = void 0; + } else { + if (atCarriageReturn) { + chunks.push(-5); + atCarriageReturn = void 0; + } + if (startPosition < endPosition) { + chunks.push(value.slice(startPosition, endPosition)); + column += endPosition - startPosition; + } + switch (code3) { + case 0: { + chunks.push(65533); + column++; + break; + } + case 9: { + next = Math.ceil(column / 4) * 4; + chunks.push(-2); + while (column++ < next) chunks.push(-1); + break; + } + case 10: { + chunks.push(-4); + column = 1; + break; + } + default: { + atCarriageReturn = true; + column = 1; + } + } + } + startPosition = endPosition + 1; + } + if (end) { + if (atCarriageReturn) chunks.push(-5); + if (buffer) chunks.push(buffer); + chunks.push(null); + } + return chunks; + } + } + + // node_modules/micromark-util-decode-string/index.js + var characterEscapeOrReference = /\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi; + function decodeString(value) { + return value.replace(characterEscapeOrReference, decode); + } + function decode($0, $1, $22) { + if ($1) { + return $1; + } + const head = $22.charCodeAt(0); + if (head === 35) { + const head2 = $22.charCodeAt(1); + const hex = head2 === 120 || head2 === 88; + return decodeNumericCharacterReference($22.slice(hex ? 2 : 1), hex ? 16 : 10); + } + return decodeNamedCharacterReference($22) || $0; + } + + // node_modules/unist-util-stringify-position/lib/index.js + function stringifyPosition(value) { + if (!value || typeof value !== "object") { + return ""; + } + if ("position" in value || "type" in value) { + return position(value.position); + } + if ("start" in value || "end" in value) { + return position(value); + } + if ("line" in value || "column" in value) { + return point(value); + } + return ""; + } + function point(point3) { + return index(point3 && point3.line) + ":" + index(point3 && point3.column); + } + function position(pos) { + return point(pos && pos.start) + "-" + point(pos && pos.end); + } + function index(value) { + return value && typeof value === "number" ? value : 1; + } + + // node_modules/mdast-util-from-markdown/lib/index.js + var own = {}.hasOwnProperty; + function fromMarkdown(value, encoding, options2) { + if (typeof encoding !== "string") { + options2 = encoding; + encoding = void 0; + } + return compiler(options2)( + postprocess( + parse(options2).document().write(preprocess()(value, encoding, true)) + ) + ); + } + function compiler(options2) { + const config = { + transforms: [], + canContainEols: ["emphasis", "fragment", "heading", "paragraph", "strong"], + enter: { + autolink: opener(link2), + autolinkProtocol: onenterdata, + autolinkEmail: onenterdata, + atxHeading: opener(heading2), + blockQuote: opener(blockQuote2), + characterEscape: onenterdata, + characterReference: onenterdata, + codeFenced: opener(codeFlow), + codeFencedFenceInfo: buffer, + codeFencedFenceMeta: buffer, + codeIndented: opener(codeFlow, buffer), + codeText: opener(codeText2, buffer), + codeTextData: onenterdata, + data: onenterdata, + codeFlowValue: onenterdata, + definition: opener(definition3), + definitionDestinationString: buffer, + definitionLabelString: buffer, + definitionTitleString: buffer, + emphasis: opener(emphasis2), + hardBreakEscape: opener(hardBreak2), + hardBreakTrailing: opener(hardBreak2), + htmlFlow: opener(html3, buffer), + htmlFlowData: onenterdata, + htmlText: opener(html3, buffer), + htmlTextData: onenterdata, + image: opener(image2), + label: buffer, + link: opener(link2), + listItem: opener(listItem2), + listItemValue: onenterlistitemvalue, + listOrdered: opener(list4, onenterlistordered), + listUnordered: opener(list4), + paragraph: opener(paragraph2), + reference: onenterreference, + referenceString: buffer, + resourceDestinationString: buffer, + resourceTitleString: buffer, + setextHeading: opener(heading2), + strong: opener(strong2), + thematicBreak: opener(thematicBreak3) + }, + exit: { + atxHeading: closer(), + atxHeadingSequence: onexitatxheadingsequence, + autolink: closer(), + autolinkEmail: onexitautolinkemail, + autolinkProtocol: onexitautolinkprotocol, + blockQuote: closer(), + characterEscapeValue: onexitdata, + characterReferenceMarkerHexadecimal: onexitcharacterreferencemarker, + characterReferenceMarkerNumeric: onexitcharacterreferencemarker, + characterReferenceValue: onexitcharacterreferencevalue, + codeFenced: closer(onexitcodefenced), + codeFencedFence: onexitcodefencedfence, + codeFencedFenceInfo: onexitcodefencedfenceinfo, + codeFencedFenceMeta: onexitcodefencedfencemeta, + codeFlowValue: onexitdata, + codeIndented: closer(onexitcodeindented), + codeText: closer(onexitcodetext), + codeTextData: onexitdata, + data: onexitdata, + definition: closer(), + definitionDestinationString: onexitdefinitiondestinationstring, + definitionLabelString: onexitdefinitionlabelstring, + definitionTitleString: onexitdefinitiontitlestring, + emphasis: closer(), + hardBreakEscape: closer(onexithardbreak), + hardBreakTrailing: closer(onexithardbreak), + htmlFlow: closer(onexithtmlflow), + htmlFlowData: onexitdata, + htmlText: closer(onexithtmltext), + htmlTextData: onexitdata, + image: closer(onexitimage), + label: onexitlabel, + labelText: onexitlabeltext, + lineEnding: onexitlineending, + link: closer(onexitlink), + listItem: closer(), + listOrdered: closer(), + listUnordered: closer(), + paragraph: closer(), + referenceString: onexitreferencestring, + resourceDestinationString: onexitresourcedestinationstring, + resourceTitleString: onexitresourcetitlestring, + resource: onexitresource, + setextHeading: closer(onexitsetextheading), + setextHeadingLineSequence: onexitsetextheadinglinesequence, + setextHeadingText: onexitsetextheadingtext, + strong: closer(), + thematicBreak: closer() + } + }; + configure(config, (options2 || {}).mdastExtensions || []); + const data = {}; + return compile; + function compile(events) { + let tree = { + type: "root", + children: [] + }; + const context = { + stack: [tree], + tokenStack: [], + config, + enter, + exit: exit3, + buffer, + resume, + data + }; + const listStack = []; + let index2 = -1; + while (++index2 < events.length) { + if (events[index2][1].type === "listOrdered" || events[index2][1].type === "listUnordered") { + if (events[index2][0] === "enter") { + listStack.push(index2); + } else { + const tail = listStack.pop(); + index2 = prepareList(events, tail, index2); + } + } + } + index2 = -1; + while (++index2 < events.length) { + const handler = config[events[index2][0]]; + if (own.call(handler, events[index2][1].type)) { + handler[events[index2][1].type].call( + Object.assign( + { + sliceSerialize: events[index2][2].sliceSerialize + }, + context + ), + events[index2][1] + ); + } + } + if (context.tokenStack.length > 0) { + const tail = context.tokenStack[context.tokenStack.length - 1]; + const handler = tail[1] || defaultOnError; + handler.call(context, void 0, tail[0]); + } + tree.position = { + start: point2( + events.length > 0 ? events[0][1].start : { + line: 1, + column: 1, + offset: 0 + } + ), + end: point2( + events.length > 0 ? events[events.length - 2][1].end : { + line: 1, + column: 1, + offset: 0 + } + ) + }; + index2 = -1; + while (++index2 < config.transforms.length) { + tree = config.transforms[index2](tree) || tree; + } + return tree; + } + function prepareList(events, start, length) { + let index2 = start - 1; + let containerBalance = -1; + let listSpread = false; + let listItem3; + let lineIndex; + let firstBlankLineIndex; + let atMarker; + while (++index2 <= length) { + const event = events[index2]; + switch (event[1].type) { + case "listUnordered": + case "listOrdered": + case "blockQuote": { + if (event[0] === "enter") { + containerBalance++; + } else { + containerBalance--; + } + atMarker = void 0; + break; + } + case "lineEndingBlank": { + if (event[0] === "enter") { + if (listItem3 && !atMarker && !containerBalance && !firstBlankLineIndex) { + firstBlankLineIndex = index2; + } + atMarker = void 0; + } + break; + } + case "linePrefix": + case "listItemValue": + case "listItemMarker": + case "listItemPrefix": + case "listItemPrefixWhitespace": { + break; + } + default: { + atMarker = void 0; + } + } + if (!containerBalance && event[0] === "enter" && event[1].type === "listItemPrefix" || containerBalance === -1 && event[0] === "exit" && (event[1].type === "listUnordered" || event[1].type === "listOrdered")) { + if (listItem3) { + let tailIndex = index2; + lineIndex = void 0; + while (tailIndex--) { + const tailEvent = events[tailIndex]; + if (tailEvent[1].type === "lineEnding" || tailEvent[1].type === "lineEndingBlank") { + if (tailEvent[0] === "exit") continue; + if (lineIndex) { + events[lineIndex][1].type = "lineEndingBlank"; + listSpread = true; + } + tailEvent[1].type = "lineEnding"; + lineIndex = tailIndex; + } else if (tailEvent[1].type === "linePrefix" || tailEvent[1].type === "blockQuotePrefix" || tailEvent[1].type === "blockQuotePrefixWhitespace" || tailEvent[1].type === "blockQuoteMarker" || tailEvent[1].type === "listItemIndent") { + } else { + break; + } + } + if (firstBlankLineIndex && (!lineIndex || firstBlankLineIndex < lineIndex)) { + listItem3._spread = true; + } + listItem3.end = Object.assign( + {}, + lineIndex ? events[lineIndex][1].start : event[1].end + ); + events.splice(lineIndex || index2, 0, ["exit", listItem3, event[2]]); + index2++; + length++; + } + if (event[1].type === "listItemPrefix") { + const item = { + type: "listItem", + _spread: false, + start: Object.assign({}, event[1].start), + // @ts-expect-error: we’ll add `end` in a second. + end: void 0 + }; + listItem3 = item; + events.splice(index2, 0, ["enter", item, event[2]]); + index2++; + length++; + firstBlankLineIndex = void 0; + atMarker = true; + } + } + } + events[start][1]._spread = listSpread; + return length; + } + function opener(create, and) { + return open; + function open(token) { + enter.call(this, create(token), token); + if (and) and.call(this, token); + } + } + function buffer() { + this.stack.push({ + type: "fragment", + children: [] + }); + } + function enter(node2, token, errorHandler) { + const parent = this.stack[this.stack.length - 1]; + const siblings = parent.children; + siblings.push(node2); + this.stack.push(node2); + this.tokenStack.push([token, errorHandler]); + node2.position = { + start: point2(token.start), + // @ts-expect-error: `end` will be patched later. + end: void 0 + }; + } + function closer(and) { + return close2; + function close2(token) { + if (and) and.call(this, token); + exit3.call(this, token); + } + } + function exit3(token, onExitError) { + const node2 = this.stack.pop(); + const open = this.tokenStack.pop(); + if (!open) { + throw new Error( + "Cannot close `" + token.type + "` (" + stringifyPosition({ + start: token.start, + end: token.end + }) + "): it\u2019s not open" + ); + } else if (open[0].type !== token.type) { + if (onExitError) { + onExitError.call(this, token, open[0]); + } else { + const handler = open[1] || defaultOnError; + handler.call(this, token, open[0]); + } + } + node2.position.end = point2(token.end); + } + function resume() { + return toString(this.stack.pop()); + } + function onenterlistordered() { + this.data.expectingFirstListItemValue = true; + } + function onenterlistitemvalue(token) { + if (this.data.expectingFirstListItemValue) { + const ancestor = this.stack[this.stack.length - 2]; + ancestor.start = Number.parseInt(this.sliceSerialize(token), 10); + this.data.expectingFirstListItemValue = void 0; + } + } + function onexitcodefencedfenceinfo() { + const data2 = this.resume(); + const node2 = this.stack[this.stack.length - 1]; + node2.lang = data2; + } + function onexitcodefencedfencemeta() { + const data2 = this.resume(); + const node2 = this.stack[this.stack.length - 1]; + node2.meta = data2; + } + function onexitcodefencedfence() { + if (this.data.flowCodeInside) return; + this.buffer(); + this.data.flowCodeInside = true; + } + function onexitcodefenced() { + const data2 = this.resume(); + const node2 = this.stack[this.stack.length - 1]; + node2.value = data2.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g, ""); + this.data.flowCodeInside = void 0; + } + function onexitcodeindented() { + const data2 = this.resume(); + const node2 = this.stack[this.stack.length - 1]; + node2.value = data2.replace(/(\r?\n|\r)$/g, ""); + } + function onexitdefinitionlabelstring(token) { + const label = this.resume(); + const node2 = this.stack[this.stack.length - 1]; + node2.label = label; + node2.identifier = normalizeIdentifier( + this.sliceSerialize(token) + ).toLowerCase(); + } + function onexitdefinitiontitlestring() { + const data2 = this.resume(); + const node2 = this.stack[this.stack.length - 1]; + node2.title = data2; + } + function onexitdefinitiondestinationstring() { + const data2 = this.resume(); + const node2 = this.stack[this.stack.length - 1]; + node2.url = data2; + } + function onexitatxheadingsequence(token) { + const node2 = this.stack[this.stack.length - 1]; + if (!node2.depth) { + const depth = this.sliceSerialize(token).length; + node2.depth = depth; + } + } + function onexitsetextheadingtext() { + this.data.setextHeadingSlurpLineEnding = true; + } + function onexitsetextheadinglinesequence(token) { + const node2 = this.stack[this.stack.length - 1]; + node2.depth = this.sliceSerialize(token).codePointAt(0) === 61 ? 1 : 2; + } + function onexitsetextheading() { + this.data.setextHeadingSlurpLineEnding = void 0; + } + function onenterdata(token) { + const node2 = this.stack[this.stack.length - 1]; + const siblings = node2.children; + let tail = siblings[siblings.length - 1]; + if (!tail || tail.type !== "text") { + tail = text5(); + tail.position = { + start: point2(token.start), + // @ts-expect-error: we’ll add `end` later. + end: void 0 + }; + siblings.push(tail); + } + this.stack.push(tail); + } + function onexitdata(token) { + const tail = this.stack.pop(); + tail.value += this.sliceSerialize(token); + tail.position.end = point2(token.end); + } + function onexitlineending(token) { + const context = this.stack[this.stack.length - 1]; + if (this.data.atHardBreak) { + const tail = context.children[context.children.length - 1]; + tail.position.end = point2(token.end); + this.data.atHardBreak = void 0; + return; + } + if (!this.data.setextHeadingSlurpLineEnding && config.canContainEols.includes(context.type)) { + onenterdata.call(this, token); + onexitdata.call(this, token); + } + } + function onexithardbreak() { + this.data.atHardBreak = true; + } + function onexithtmlflow() { + const data2 = this.resume(); + const node2 = this.stack[this.stack.length - 1]; + node2.value = data2; + } + function onexithtmltext() { + const data2 = this.resume(); + const node2 = this.stack[this.stack.length - 1]; + node2.value = data2; + } + function onexitcodetext() { + const data2 = this.resume(); + const node2 = this.stack[this.stack.length - 1]; + node2.value = data2; + } + function onexitlink() { + const node2 = this.stack[this.stack.length - 1]; + if (this.data.inReference) { + const referenceType = this.data.referenceType || "shortcut"; + node2.type += "Reference"; + node2.referenceType = referenceType; + delete node2.url; + delete node2.title; + } else { + delete node2.identifier; + delete node2.label; + } + this.data.referenceType = void 0; + } + function onexitimage() { + const node2 = this.stack[this.stack.length - 1]; + if (this.data.inReference) { + const referenceType = this.data.referenceType || "shortcut"; + node2.type += "Reference"; + node2.referenceType = referenceType; + delete node2.url; + delete node2.title; + } else { + delete node2.identifier; + delete node2.label; + } + this.data.referenceType = void 0; + } + function onexitlabeltext(token) { + const string3 = this.sliceSerialize(token); + const ancestor = this.stack[this.stack.length - 2]; + ancestor.label = decodeString(string3); + ancestor.identifier = normalizeIdentifier(string3).toLowerCase(); + } + function onexitlabel() { + const fragment = this.stack[this.stack.length - 1]; + const value = this.resume(); + const node2 = this.stack[this.stack.length - 1]; + this.data.inReference = true; + if (node2.type === "link") { + const children = fragment.children; + node2.children = children; + } else { + node2.alt = value; + } + } + function onexitresourcedestinationstring() { + const data2 = this.resume(); + const node2 = this.stack[this.stack.length - 1]; + node2.url = data2; + } + function onexitresourcetitlestring() { + const data2 = this.resume(); + const node2 = this.stack[this.stack.length - 1]; + node2.title = data2; + } + function onexitresource() { + this.data.inReference = void 0; + } + function onenterreference() { + this.data.referenceType = "collapsed"; + } + function onexitreferencestring(token) { + const label = this.resume(); + const node2 = this.stack[this.stack.length - 1]; + node2.label = label; + node2.identifier = normalizeIdentifier( + this.sliceSerialize(token) + ).toLowerCase(); + this.data.referenceType = "full"; + } + function onexitcharacterreferencemarker(token) { + this.data.characterReferenceType = token.type; + } + function onexitcharacterreferencevalue(token) { + const data2 = this.sliceSerialize(token); + const type = this.data.characterReferenceType; + let value; + if (type) { + value = decodeNumericCharacterReference( + data2, + type === "characterReferenceMarkerNumeric" ? 10 : 16 + ); + this.data.characterReferenceType = void 0; + } else { + const result = decodeNamedCharacterReference(data2); + value = result; + } + const tail = this.stack.pop(); + tail.value += value; + tail.position.end = point2(token.end); + } + function onexitautolinkprotocol(token) { + onexitdata.call(this, token); + const node2 = this.stack[this.stack.length - 1]; + node2.url = this.sliceSerialize(token); + } + function onexitautolinkemail(token) { + onexitdata.call(this, token); + const node2 = this.stack[this.stack.length - 1]; + node2.url = "mailto:" + this.sliceSerialize(token); + } + function blockQuote2() { + return { + type: "blockquote", + children: [] + }; + } + function codeFlow() { + return { + type: "code", + lang: null, + meta: null, + value: "" + }; + } + function codeText2() { + return { + type: "inlineCode", + value: "" + }; + } + function definition3() { + return { + type: "definition", + identifier: "", + label: null, + title: null, + url: "" + }; + } + function emphasis2() { + return { + type: "emphasis", + children: [] + }; + } + function heading2() { + return { + type: "heading", + // @ts-expect-error `depth` will be set later. + depth: 0, + children: [] + }; + } + function hardBreak2() { + return { + type: "break" + }; + } + function html3() { + return { + type: "html", + value: "" + }; + } + function image2() { + return { + type: "image", + title: null, + url: "", + alt: null + }; + } + function link2() { + return { + type: "link", + title: null, + url: "", + children: [] + }; + } + function list4(token) { + return { + type: "list", + ordered: token.type === "listOrdered", + start: null, + spread: token._spread, + children: [] + }; + } + function listItem2(token) { + return { + type: "listItem", + spread: token._spread, + checked: null, + children: [] + }; + } + function paragraph2() { + return { + type: "paragraph", + children: [] + }; + } + function strong2() { + return { + type: "strong", + children: [] + }; + } + function text5() { + return { + type: "text", + value: "" + }; + } + function thematicBreak3() { + return { + type: "thematicBreak" + }; + } + } + function point2(d6) { + return { + line: d6.line, + column: d6.column, + offset: d6.offset + }; + } + function configure(combined, extensions) { + let index2 = -1; + while (++index2 < extensions.length) { + const value = extensions[index2]; + if (Array.isArray(value)) { + configure(combined, value); + } else { + extension(combined, value); + } + } + } + function extension(combined, extension2) { + let key; + for (key in extension2) { + if (own.call(extension2, key)) { + switch (key) { + case "canContainEols": { + const right = extension2[key]; + if (right) { + combined[key].push(...right); + } + break; + } + case "transforms": { + const right = extension2[key]; + if (right) { + combined[key].push(...right); + } + break; + } + case "enter": + case "exit": { + const right = extension2[key]; + if (right) { + Object.assign(combined[key], right); + } + break; + } + } + } + } + } + function defaultOnError(left, right) { + if (left) { + throw new Error( + "Cannot close `" + left.type + "` (" + stringifyPosition({ + start: left.start, + end: left.end + }) + "): a different token (`" + right.type + "`, " + stringifyPosition({ + start: right.start, + end: right.end + }) + ") is open" + ); + } else { + throw new Error( + "Cannot close document, a token (`" + right.type + "`, " + stringifyPosition({ + start: right.start, + end: right.end + }) + ") is still open" + ); + } + } + + // node_modules/remark-parse/lib/index.js + function remarkParse(options2) { + const self2 = this; + self2.parser = parser; + function parser(doc4) { + return fromMarkdown(doc4, __spreadProps(__spreadValues(__spreadValues({}, self2.data("settings")), options2), { + // Note: these options are not in the readme. + // The goal is for them to be set by plugins on `data` instead of being + // passed by users. + extensions: self2.data("micromarkExtensions") || [], + mdastExtensions: self2.data("fromMarkdownExtensions") || [] + })); + } + } + + // node_modules/zwitch/index.js + var own2 = {}.hasOwnProperty; + function zwitch(key, options2) { + const settings = options2 || {}; + function one2(value, ...parameters) { + let fn = one2.invalid; + const handlers2 = one2.handlers; + if (value && own2.call(value, key)) { + const id = String(value[key]); + fn = own2.call(handlers2, id) ? handlers2[id] : one2.unknown; + } + if (fn) { + return fn.call(this, value, ...parameters); + } + } + one2.handlers = settings.handlers || {}; + one2.invalid = settings.invalid; + one2.unknown = settings.unknown; + return one2; + } + + // node_modules/mdast-util-to-markdown/lib/configure.js + var own3 = {}.hasOwnProperty; + function configure2(base2, extension2) { + let index2 = -1; + let key; + if (extension2.extensions) { + while (++index2 < extension2.extensions.length) { + configure2(base2, extension2.extensions[index2]); + } + } + for (key in extension2) { + if (own3.call(extension2, key)) { + switch (key) { + case "extensions": { + break; + } + case "unsafe": { + list2(base2[key], extension2[key]); + break; + } + case "join": { + list2(base2[key], extension2[key]); + break; + } + case "handlers": { + map(base2[key], extension2[key]); + break; + } + default: { + base2.options[key] = extension2[key]; + } + } + } + } + return base2; + } + function list2(left, right) { + if (right) { + left.push(...right); + } + } + function map(left, right) { + if (right) { + Object.assign(left, right); + } + } + + // node_modules/mdast-util-to-markdown/lib/handle/blockquote.js + function blockquote(node2, _3, state, info) { + const exit3 = state.enter("blockquote"); + const tracker = state.createTracker(info); + tracker.move("> "); + tracker.shift(2); + const value = state.indentLines( + state.containerFlow(node2, tracker.current()), + map2 + ); + exit3(); + return value; + } + function map2(line, _3, blank) { + return ">" + (blank ? "" : " ") + line; + } + + // node_modules/mdast-util-to-markdown/lib/util/pattern-in-scope.js + function patternInScope(stack, pattern) { + return listInScope(stack, pattern.inConstruct, true) && !listInScope(stack, pattern.notInConstruct, false); + } + function listInScope(stack, list4, none2) { + if (typeof list4 === "string") { + list4 = [list4]; + } + if (!list4 || list4.length === 0) { + return none2; + } + let index2 = -1; + while (++index2 < list4.length) { + if (stack.includes(list4[index2])) { + return true; + } + } + return false; + } + + // node_modules/mdast-util-to-markdown/lib/handle/break.js + function hardBreak(_3, _1, state, info) { + let index2 = -1; + while (++index2 < state.unsafe.length) { + if (state.unsafe[index2].character === "\n" && patternInScope(state.stack, state.unsafe[index2])) { + return /[ \t]/.test(info.before) ? "" : " "; + } + } + return "\\\n"; + } + + // node_modules/longest-streak/index.js + function longestStreak(value, substring) { + const source = String(value); + let index2 = source.indexOf(substring); + let expected = index2; + let count = 0; + let max = 0; + if (typeof substring !== "string") { + throw new TypeError("Expected substring"); + } + while (index2 !== -1) { + if (index2 === expected) { + if (++count > max) { + max = count; + } + } else { + count = 1; + } + expected = index2 + substring.length; + index2 = source.indexOf(substring, expected); + } + return max; + } + + // node_modules/mdast-util-to-markdown/lib/util/format-code-as-indented.js + function formatCodeAsIndented(node2, state) { + return Boolean( + state.options.fences === false && node2.value && // If there’s no info… + !node2.lang && // And there’s a non-whitespace character… + /[^ \r\n]/.test(node2.value) && // And the value doesn’t start or end in a blank… + !/^[\t ]*(?:[\r\n]|$)|(?:^|[\r\n])[\t ]*$/.test(node2.value) + ); + } + + // node_modules/mdast-util-to-markdown/lib/util/check-fence.js + function checkFence(state) { + const marker = state.options.fence || "`"; + if (marker !== "`" && marker !== "~") { + throw new Error( + "Cannot serialize code with `" + marker + "` for `options.fence`, expected `` ` `` or `~`" + ); + } + return marker; + } + + // node_modules/mdast-util-to-markdown/lib/handle/code.js + function code(node2, _3, state, info) { + const marker = checkFence(state); + const raw = node2.value || ""; + const suffix = marker === "`" ? "GraveAccent" : "Tilde"; + if (formatCodeAsIndented(node2, state)) { + const exit4 = state.enter("codeIndented"); + const value2 = state.indentLines(raw, map3); + exit4(); + return value2; + } + const tracker = state.createTracker(info); + const sequence = marker.repeat(Math.max(longestStreak(raw, marker) + 1, 3)); + const exit3 = state.enter("codeFenced"); + let value = tracker.move(sequence); + if (node2.lang) { + const subexit = state.enter(`codeFencedLang${suffix}`); + value += tracker.move( + state.safe(node2.lang, __spreadValues({ + before: value, + after: " ", + encode: ["`"] + }, tracker.current())) + ); + subexit(); + } + if (node2.lang && node2.meta) { + const subexit = state.enter(`codeFencedMeta${suffix}`); + value += tracker.move(" "); + value += tracker.move( + state.safe(node2.meta, __spreadValues({ + before: value, + after: "\n", + encode: ["`"] + }, tracker.current())) + ); + subexit(); + } + value += tracker.move("\n"); + if (raw) { + value += tracker.move(raw + "\n"); + } + value += tracker.move(sequence); + exit3(); + return value; + } + function map3(line, _3, blank) { + return (blank ? "" : " ") + line; + } + + // node_modules/mdast-util-to-markdown/lib/util/check-quote.js + function checkQuote(state) { + const marker = state.options.quote || '"'; + if (marker !== '"' && marker !== "'") { + throw new Error( + "Cannot serialize title with `" + marker + "` for `options.quote`, expected `\"`, or `'`" + ); + } + return marker; + } + + // node_modules/mdast-util-to-markdown/lib/handle/definition.js + function definition2(node2, _3, state, info) { + const quote = checkQuote(state); + const suffix = quote === '"' ? "Quote" : "Apostrophe"; + const exit3 = state.enter("definition"); + let subexit = state.enter("label"); + const tracker = state.createTracker(info); + let value = tracker.move("["); + value += tracker.move( + state.safe(state.associationId(node2), __spreadValues({ + before: value, + after: "]" + }, tracker.current())) + ); + value += tracker.move("]: "); + subexit(); + if ( + // If there’s no url, or… + !node2.url || // If there are control characters or whitespace. + /[\0- \u007F]/.test(node2.url) + ) { + subexit = state.enter("destinationLiteral"); + value += tracker.move("<"); + value += tracker.move( + state.safe(node2.url, __spreadValues({ before: value, after: ">" }, tracker.current())) + ); + value += tracker.move(">"); + } else { + subexit = state.enter("destinationRaw"); + value += tracker.move( + state.safe(node2.url, __spreadValues({ + before: value, + after: node2.title ? " " : "\n" + }, tracker.current())) + ); + } + subexit(); + if (node2.title) { + subexit = state.enter(`title${suffix}`); + value += tracker.move(" " + quote); + value += tracker.move( + state.safe(node2.title, __spreadValues({ + before: value, + after: quote + }, tracker.current())) + ); + value += tracker.move(quote); + subexit(); + } + exit3(); + return value; + } + + // node_modules/mdast-util-to-markdown/lib/util/check-emphasis.js + function checkEmphasis(state) { + const marker = state.options.emphasis || "*"; + if (marker !== "*" && marker !== "_") { + throw new Error( + "Cannot serialize emphasis with `" + marker + "` for `options.emphasis`, expected `*`, or `_`" + ); + } + return marker; + } + + // node_modules/mdast-util-to-markdown/lib/handle/emphasis.js + emphasis.peek = emphasisPeek; + function emphasis(node2, _3, state, info) { + const marker = checkEmphasis(state); + const exit3 = state.enter("emphasis"); + const tracker = state.createTracker(info); + let value = tracker.move(marker); + value += tracker.move( + state.containerPhrasing(node2, __spreadValues({ + before: value, + after: marker + }, tracker.current())) + ); + value += tracker.move(marker); + exit3(); + return value; + } + function emphasisPeek(_3, _1, state) { + return state.options.emphasis || "*"; + } + + // node_modules/unist-util-is/lib/index.js + var convert = ( + // Note: overloads in JSDoc can’t yet use different `@template`s. + /** + * @type {( + * ((test: Condition) => (node: unknown, index?: number | null | undefined, parent?: Parent | null | undefined, context?: unknown) => node is Node & {type: Condition}) & + * ((test: Condition) => (node: unknown, index?: number | null | undefined, parent?: Parent | null | undefined, context?: unknown) => node is Node & Condition) & + * ((test: Condition) => (node: unknown, index?: number | null | undefined, parent?: Parent | null | undefined, context?: unknown) => node is Node & Predicate) & + * ((test?: null | undefined) => (node?: unknown, index?: number | null | undefined, parent?: Parent | null | undefined, context?: unknown) => node is Node) & + * ((test?: Test) => Check) + * )} + */ + /** + * @param {Test} [test] + * @returns {Check} + */ + function(test) { + if (test === null || test === void 0) { + return ok; + } + if (typeof test === "function") { + return castFactory(test); + } + if (typeof test === "object") { + return Array.isArray(test) ? anyFactory(test) : propsFactory(test); + } + if (typeof test === "string") { + return typeFactory(test); + } + throw new Error("Expected function, string, or object as test"); + } + ); + function anyFactory(tests) { + const checks = []; + let index2 = -1; + while (++index2 < tests.length) { + checks[index2] = convert(tests[index2]); + } + return castFactory(any); + function any(...parameters) { + let index3 = -1; + while (++index3 < checks.length) { + if (checks[index3].apply(this, parameters)) return true; + } + return false; + } + } + function propsFactory(check) { + const checkAsRecord = ( + /** @type {Record} */ + check + ); + return castFactory(all2); + function all2(node2) { + const nodeAsRecord = ( + /** @type {Record} */ + /** @type {unknown} */ + node2 + ); + let key; + for (key in check) { + if (nodeAsRecord[key] !== checkAsRecord[key]) return false; + } + return true; + } + } + function typeFactory(check) { + return castFactory(type); + function type(node2) { + return node2 && node2.type === check; + } + } + function castFactory(testFunction) { + return check; + function check(value, index2, parent) { + return Boolean( + looksLikeANode(value) && testFunction.call( + this, + value, + typeof index2 === "number" ? index2 : void 0, + parent || void 0 + ) + ); + } + } + function ok() { + return true; + } + function looksLikeANode(value) { + return value !== null && typeof value === "object" && "type" in value; + } + + // node_modules/unist-util-visit-parents/lib/color.js + function color(d6) { + return d6; + } + + // node_modules/unist-util-visit-parents/lib/index.js + var empty = []; + var CONTINUE = true; + var EXIT = false; + var SKIP = "skip"; + function visitParents(tree, test, visitor, reverse) { + let check; + if (typeof test === "function" && typeof visitor !== "function") { + reverse = visitor; + visitor = test; + } else { + check = test; + } + const is2 = convert(check); + const step = reverse ? -1 : 1; + factory(tree, void 0, [])(); + function factory(node2, index2, parents) { + const value = ( + /** @type {Record} */ + node2 && typeof node2 === "object" ? node2 : {} + ); + if (typeof value.type === "string") { + const name = ( + // `hast` + typeof value.tagName === "string" ? value.tagName : ( + // `xast` + typeof value.name === "string" ? value.name : void 0 + ) + ); + Object.defineProperty(visit2, "name", { + value: "node (" + color(node2.type + (name ? "<" + name + ">" : "")) + ")" + }); + } + return visit2; + function visit2() { + let result = empty; + let subresult; + let offset; + let grandparents; + if (!test || is2(node2, index2, parents[parents.length - 1] || void 0)) { + result = toResult(visitor(node2, parents)); + if (result[0] === EXIT) { + return result; + } + } + if ("children" in node2 && node2.children) { + const nodeAsParent = ( + /** @type {UnistParent} */ + node2 + ); + if (nodeAsParent.children && result[0] !== SKIP) { + offset = (reverse ? nodeAsParent.children.length : -1) + step; + grandparents = parents.concat(nodeAsParent); + while (offset > -1 && offset < nodeAsParent.children.length) { + const child = nodeAsParent.children[offset]; + subresult = factory(child, offset, grandparents)(); + if (subresult[0] === EXIT) { + return subresult; + } + offset = typeof subresult[1] === "number" ? subresult[1] : offset + step; + } + } + } + return result; + } + } + } + function toResult(value) { + if (Array.isArray(value)) { + return value; + } + if (typeof value === "number") { + return [CONTINUE, value]; + } + return value === null || value === void 0 ? empty : [value]; + } + + // node_modules/unist-util-visit/lib/index.js + function visit(tree, testOrVisitor, visitorOrReverse, maybeReverse) { + let reverse; + let test; + let visitor; + if (typeof testOrVisitor === "function" && typeof visitorOrReverse !== "function") { + test = void 0; + visitor = testOrVisitor; + reverse = visitorOrReverse; + } else { + test = testOrVisitor; + visitor = visitorOrReverse; + reverse = maybeReverse; + } + visitParents(tree, test, overload, reverse); + function overload(node2, parents) { + const parent = parents[parents.length - 1]; + const index2 = parent ? parent.children.indexOf(node2) : void 0; + return visitor(node2, index2, parent); + } + } + + // node_modules/mdast-util-to-markdown/lib/util/format-heading-as-setext.js + function formatHeadingAsSetext(node2, state) { + let literalWithBreak = false; + visit(node2, function(node3) { + if ("value" in node3 && /\r?\n|\r/.test(node3.value) || node3.type === "break") { + literalWithBreak = true; + return EXIT; + } + }); + return Boolean( + (!node2.depth || node2.depth < 3) && toString(node2) && (state.options.setext || literalWithBreak) + ); + } + + // node_modules/mdast-util-to-markdown/lib/handle/heading.js + function heading(node2, _3, state, info) { + const rank = Math.max(Math.min(6, node2.depth || 1), 1); + const tracker = state.createTracker(info); + if (formatHeadingAsSetext(node2, state)) { + const exit4 = state.enter("headingSetext"); + const subexit2 = state.enter("phrasing"); + const value2 = state.containerPhrasing(node2, __spreadProps(__spreadValues({}, tracker.current()), { + before: "\n", + after: "\n" + })); + subexit2(); + exit4(); + return value2 + "\n" + (rank === 1 ? "=" : "-").repeat( + // The whole size… + value2.length - // Minus the position of the character after the last EOL (or + // 0 if there is none)… + (Math.max(value2.lastIndexOf("\r"), value2.lastIndexOf("\n")) + 1) + ); + } + const sequence = "#".repeat(rank); + const exit3 = state.enter("headingAtx"); + const subexit = state.enter("phrasing"); + tracker.move(sequence + " "); + let value = state.containerPhrasing(node2, __spreadValues({ + before: "# ", + after: "\n" + }, tracker.current())); + if (/^[\t ]/.test(value)) { + value = "&#x" + value.charCodeAt(0).toString(16).toUpperCase() + ";" + value.slice(1); + } + value = value ? sequence + " " + value : sequence; + if (state.options.closeAtx) { + value += " " + sequence; + } + subexit(); + exit3(); + return value; + } + + // node_modules/mdast-util-to-markdown/lib/handle/html.js + html.peek = htmlPeek; + function html(node2) { + return node2.value || ""; + } + function htmlPeek() { + return "<"; + } + + // node_modules/mdast-util-to-markdown/lib/handle/image.js + image.peek = imagePeek; + function image(node2, _3, state, info) { + const quote = checkQuote(state); + const suffix = quote === '"' ? "Quote" : "Apostrophe"; + const exit3 = state.enter("image"); + let subexit = state.enter("label"); + const tracker = state.createTracker(info); + let value = tracker.move("!["); + value += tracker.move( + state.safe(node2.alt, __spreadValues({ before: value, after: "]" }, tracker.current())) + ); + value += tracker.move("]("); + subexit(); + if ( + // If there’s no url but there is a title… + !node2.url && node2.title || // If there are control characters or whitespace. + /[\0- \u007F]/.test(node2.url) + ) { + subexit = state.enter("destinationLiteral"); + value += tracker.move("<"); + value += tracker.move( + state.safe(node2.url, __spreadValues({ before: value, after: ">" }, tracker.current())) + ); + value += tracker.move(">"); + } else { + subexit = state.enter("destinationRaw"); + value += tracker.move( + state.safe(node2.url, __spreadValues({ + before: value, + after: node2.title ? " " : ")" + }, tracker.current())) + ); + } + subexit(); + if (node2.title) { + subexit = state.enter(`title${suffix}`); + value += tracker.move(" " + quote); + value += tracker.move( + state.safe(node2.title, __spreadValues({ + before: value, + after: quote + }, tracker.current())) + ); + value += tracker.move(quote); + subexit(); + } + value += tracker.move(")"); + exit3(); + return value; + } + function imagePeek() { + return "!"; + } + + // node_modules/mdast-util-to-markdown/lib/handle/image-reference.js + imageReference.peek = imageReferencePeek; + function imageReference(node2, _3, state, info) { + const type = node2.referenceType; + const exit3 = state.enter("imageReference"); + let subexit = state.enter("label"); + const tracker = state.createTracker(info); + let value = tracker.move("!["); + const alt = state.safe(node2.alt, __spreadValues({ + before: value, + after: "]" + }, tracker.current())); + value += tracker.move(alt + "]["); + subexit(); + const stack = state.stack; + state.stack = []; + subexit = state.enter("reference"); + const reference = state.safe(state.associationId(node2), __spreadValues({ + before: value, + after: "]" + }, tracker.current())); + subexit(); + state.stack = stack; + exit3(); + if (type === "full" || !alt || alt !== reference) { + value += tracker.move(reference + "]"); + } else if (type === "shortcut") { + value = value.slice(0, -1); + } else { + value += tracker.move("]"); + } + return value; + } + function imageReferencePeek() { + return "!"; + } + + // node_modules/mdast-util-to-markdown/lib/handle/inline-code.js + inlineCode.peek = inlineCodePeek; + function inlineCode(node2, _3, state) { + let value = node2.value || ""; + let sequence = "`"; + let index2 = -1; + while (new RegExp("(^|[^`])" + sequence + "([^`]|$)").test(value)) { + sequence += "`"; + } + if (/[^ \r\n]/.test(value) && (/^[ \r\n]/.test(value) && /[ \r\n]$/.test(value) || /^`|`$/.test(value))) { + value = " " + value + " "; + } + while (++index2 < state.unsafe.length) { + const pattern = state.unsafe[index2]; + const expression = state.compilePattern(pattern); + let match; + if (!pattern.atBreak) continue; + while (match = expression.exec(value)) { + let position2 = match.index; + if (value.charCodeAt(position2) === 10 && value.charCodeAt(position2 - 1) === 13) { + position2--; + } + value = value.slice(0, position2) + " " + value.slice(match.index + 1); + } + } + return sequence + value + sequence; + } + function inlineCodePeek() { + return "`"; + } + + // node_modules/mdast-util-to-markdown/lib/util/format-link-as-autolink.js + function formatLinkAsAutolink(node2, state) { + const raw = toString(node2); + return Boolean( + !state.options.resourceLink && // If there’s a url… + node2.url && // And there’s a no title… + !node2.title && // And the content of `node` is a single text node… + node2.children && node2.children.length === 1 && node2.children[0].type === "text" && // And if the url is the same as the content… + (raw === node2.url || "mailto:" + raw === node2.url) && // And that starts w/ a protocol… + /^[a-z][a-z+.-]+:/i.test(node2.url) && // And that doesn’t contain ASCII control codes (character escapes and + // references don’t work), space, or angle brackets… + !/[\0- <>\u007F]/.test(node2.url) + ); + } + + // node_modules/mdast-util-to-markdown/lib/handle/link.js + link.peek = linkPeek; + function link(node2, _3, state, info) { + const quote = checkQuote(state); + const suffix = quote === '"' ? "Quote" : "Apostrophe"; + const tracker = state.createTracker(info); + let exit3; + let subexit; + if (formatLinkAsAutolink(node2, state)) { + const stack = state.stack; + state.stack = []; + exit3 = state.enter("autolink"); + let value2 = tracker.move("<"); + value2 += tracker.move( + state.containerPhrasing(node2, __spreadValues({ + before: value2, + after: ">" + }, tracker.current())) + ); + value2 += tracker.move(">"); + exit3(); + state.stack = stack; + return value2; + } + exit3 = state.enter("link"); + subexit = state.enter("label"); + let value = tracker.move("["); + value += tracker.move( + state.containerPhrasing(node2, __spreadValues({ + before: value, + after: "](" + }, tracker.current())) + ); + value += tracker.move("]("); + subexit(); + if ( + // If there’s no url but there is a title… + !node2.url && node2.title || // If there are control characters or whitespace. + /[\0- \u007F]/.test(node2.url) + ) { + subexit = state.enter("destinationLiteral"); + value += tracker.move("<"); + value += tracker.move( + state.safe(node2.url, __spreadValues({ before: value, after: ">" }, tracker.current())) + ); + value += tracker.move(">"); + } else { + subexit = state.enter("destinationRaw"); + value += tracker.move( + state.safe(node2.url, __spreadValues({ + before: value, + after: node2.title ? " " : ")" + }, tracker.current())) + ); + } + subexit(); + if (node2.title) { + subexit = state.enter(`title${suffix}`); + value += tracker.move(" " + quote); + value += tracker.move( + state.safe(node2.title, __spreadValues({ + before: value, + after: quote + }, tracker.current())) + ); + value += tracker.move(quote); + subexit(); + } + value += tracker.move(")"); + exit3(); + return value; + } + function linkPeek(node2, _3, state) { + return formatLinkAsAutolink(node2, state) ? "<" : "["; + } + + // node_modules/mdast-util-to-markdown/lib/handle/link-reference.js + linkReference.peek = linkReferencePeek; + function linkReference(node2, _3, state, info) { + const type = node2.referenceType; + const exit3 = state.enter("linkReference"); + let subexit = state.enter("label"); + const tracker = state.createTracker(info); + let value = tracker.move("["); + const text5 = state.containerPhrasing(node2, __spreadValues({ + before: value, + after: "]" + }, tracker.current())); + value += tracker.move(text5 + "]["); + subexit(); + const stack = state.stack; + state.stack = []; + subexit = state.enter("reference"); + const reference = state.safe(state.associationId(node2), __spreadValues({ + before: value, + after: "]" + }, tracker.current())); + subexit(); + state.stack = stack; + exit3(); + if (type === "full" || !text5 || text5 !== reference) { + value += tracker.move(reference + "]"); + } else if (type === "shortcut") { + value = value.slice(0, -1); + } else { + value += tracker.move("]"); + } + return value; + } + function linkReferencePeek() { + return "["; + } + + // node_modules/mdast-util-to-markdown/lib/util/check-bullet.js + function checkBullet(state) { + const marker = state.options.bullet || "*"; + if (marker !== "*" && marker !== "+" && marker !== "-") { + throw new Error( + "Cannot serialize items with `" + marker + "` for `options.bullet`, expected `*`, `+`, or `-`" + ); + } + return marker; + } + + // node_modules/mdast-util-to-markdown/lib/util/check-bullet-other.js + function checkBulletOther(state) { + const bullet = checkBullet(state); + const bulletOther = state.options.bulletOther; + if (!bulletOther) { + return bullet === "*" ? "-" : "*"; + } + if (bulletOther !== "*" && bulletOther !== "+" && bulletOther !== "-") { + throw new Error( + "Cannot serialize items with `" + bulletOther + "` for `options.bulletOther`, expected `*`, `+`, or `-`" + ); + } + if (bulletOther === bullet) { + throw new Error( + "Expected `bullet` (`" + bullet + "`) and `bulletOther` (`" + bulletOther + "`) to be different" + ); + } + return bulletOther; + } + + // node_modules/mdast-util-to-markdown/lib/util/check-bullet-ordered.js + function checkBulletOrdered(state) { + const marker = state.options.bulletOrdered || "."; + if (marker !== "." && marker !== ")") { + throw new Error( + "Cannot serialize items with `" + marker + "` for `options.bulletOrdered`, expected `.` or `)`" + ); + } + return marker; + } + + // node_modules/mdast-util-to-markdown/lib/util/check-rule.js + function checkRule(state) { + const marker = state.options.rule || "*"; + if (marker !== "*" && marker !== "-" && marker !== "_") { + throw new Error( + "Cannot serialize rules with `" + marker + "` for `options.rule`, expected `*`, `-`, or `_`" + ); + } + return marker; + } + + // node_modules/mdast-util-to-markdown/lib/handle/list.js + function list3(node2, parent, state, info) { + const exit3 = state.enter("list"); + const bulletCurrent = state.bulletCurrent; + let bullet = node2.ordered ? checkBulletOrdered(state) : checkBullet(state); + const bulletOther = node2.ordered ? bullet === "." ? ")" : "." : checkBulletOther(state); + let useDifferentMarker = parent && state.bulletLastUsed ? bullet === state.bulletLastUsed : false; + if (!node2.ordered) { + const firstListItem = node2.children ? node2.children[0] : void 0; + if ( + // Bullet could be used as a thematic break marker: + (bullet === "*" || bullet === "-") && // Empty first list item: + firstListItem && (!firstListItem.children || !firstListItem.children[0]) && // Directly in two other list items: + state.stack[state.stack.length - 1] === "list" && state.stack[state.stack.length - 2] === "listItem" && state.stack[state.stack.length - 3] === "list" && state.stack[state.stack.length - 4] === "listItem" && // That are each the first child. + state.indexStack[state.indexStack.length - 1] === 0 && state.indexStack[state.indexStack.length - 2] === 0 && state.indexStack[state.indexStack.length - 3] === 0 + ) { + useDifferentMarker = true; + } + if (checkRule(state) === bullet && firstListItem) { + let index2 = -1; + while (++index2 < node2.children.length) { + const item = node2.children[index2]; + if (item && item.type === "listItem" && item.children && item.children[0] && item.children[0].type === "thematicBreak") { + useDifferentMarker = true; + break; + } + } + } + } + if (useDifferentMarker) { + bullet = bulletOther; + } + state.bulletCurrent = bullet; + const value = state.containerFlow(node2, info); + state.bulletLastUsed = bullet; + state.bulletCurrent = bulletCurrent; + exit3(); + return value; + } + + // node_modules/mdast-util-to-markdown/lib/util/check-list-item-indent.js + function checkListItemIndent(state) { + const style2 = state.options.listItemIndent || "one"; + if (style2 !== "tab" && style2 !== "one" && style2 !== "mixed") { + throw new Error( + "Cannot serialize items with `" + style2 + "` for `options.listItemIndent`, expected `tab`, `one`, or `mixed`" + ); + } + return style2; + } + + // node_modules/mdast-util-to-markdown/lib/handle/list-item.js + function listItem(node2, parent, state, info) { + const listItemIndent = checkListItemIndent(state); + let bullet = state.bulletCurrent || checkBullet(state); + if (parent && parent.type === "list" && parent.ordered) { + bullet = (typeof parent.start === "number" && parent.start > -1 ? parent.start : 1) + (state.options.incrementListMarker === false ? 0 : parent.children.indexOf(node2)) + bullet; + } + let size = bullet.length + 1; + if (listItemIndent === "tab" || listItemIndent === "mixed" && (parent && parent.type === "list" && parent.spread || node2.spread)) { + size = Math.ceil(size / 4) * 4; + } + const tracker = state.createTracker(info); + tracker.move(bullet + " ".repeat(size - bullet.length)); + tracker.shift(size); + const exit3 = state.enter("listItem"); + const value = state.indentLines( + state.containerFlow(node2, tracker.current()), + map5 + ); + exit3(); + return value; + function map5(line, index2, blank) { + if (index2) { + return (blank ? "" : " ".repeat(size)) + line; + } + return (blank ? bullet : bullet + " ".repeat(size - bullet.length)) + line; + } + } + + // node_modules/mdast-util-to-markdown/lib/handle/paragraph.js + function paragraph(node2, _3, state, info) { + const exit3 = state.enter("paragraph"); + const subexit = state.enter("phrasing"); + const value = state.containerPhrasing(node2, info); + subexit(); + exit3(); + return value; + } + + // node_modules/mdast-util-phrasing/lib/index.js + var phrasing = ( + /** @type {(node?: unknown) => node is Exclude} */ + convert([ + "break", + "delete", + "emphasis", + // To do: next major: removed since footnotes were added to GFM. + "footnote", + "footnoteReference", + "image", + "imageReference", + "inlineCode", + // Enabled by `mdast-util-math`: + "inlineMath", + "link", + "linkReference", + // Enabled by `mdast-util-mdx`: + "mdxJsxTextElement", + // Enabled by `mdast-util-mdx`: + "mdxTextExpression", + "strong", + "text", + // Enabled by `mdast-util-directive`: + "textDirective" + ]) + ); + + // node_modules/mdast-util-to-markdown/lib/handle/root.js + function root(node2, _3, state, info) { + const hasPhrasing = node2.children.some(function(d6) { + return phrasing(d6); + }); + const fn = hasPhrasing ? state.containerPhrasing : state.containerFlow; + return fn.call(state, node2, info); + } + + // node_modules/mdast-util-to-markdown/lib/util/check-strong.js + function checkStrong(state) { + const marker = state.options.strong || "*"; + if (marker !== "*" && marker !== "_") { + throw new Error( + "Cannot serialize strong with `" + marker + "` for `options.strong`, expected `*`, or `_`" + ); + } + return marker; + } + + // node_modules/mdast-util-to-markdown/lib/handle/strong.js + strong.peek = strongPeek; + function strong(node2, _3, state, info) { + const marker = checkStrong(state); + const exit3 = state.enter("strong"); + const tracker = state.createTracker(info); + let value = tracker.move(marker + marker); + value += tracker.move( + state.containerPhrasing(node2, __spreadValues({ + before: value, + after: marker + }, tracker.current())) + ); + value += tracker.move(marker + marker); + exit3(); + return value; + } + function strongPeek(_3, _1, state) { + return state.options.strong || "*"; + } + + // node_modules/mdast-util-to-markdown/lib/handle/text.js + function text3(node2, _3, state, info) { + return state.safe(node2.value, info); + } + + // node_modules/mdast-util-to-markdown/lib/util/check-rule-repetition.js + function checkRuleRepetition(state) { + const repetition = state.options.ruleRepetition || 3; + if (repetition < 3) { + throw new Error( + "Cannot serialize rules with repetition `" + repetition + "` for `options.ruleRepetition`, expected `3` or more" + ); + } + return repetition; + } + + // node_modules/mdast-util-to-markdown/lib/handle/thematic-break.js + function thematicBreak2(_3, _1, state) { + const value = (checkRule(state) + (state.options.ruleSpaces ? " " : "")).repeat(checkRuleRepetition(state)); + return state.options.ruleSpaces ? value.slice(0, -1) : value; + } + + // node_modules/mdast-util-to-markdown/lib/handle/index.js + var handle = { + blockquote, + break: hardBreak, + code, + definition: definition2, + emphasis, + hardBreak, + heading, + html, + image, + imageReference, + inlineCode, + link, + linkReference, + list: list3, + listItem, + paragraph, + root, + strong, + text: text3, + thematicBreak: thematicBreak2 + }; + + // node_modules/mdast-util-to-markdown/lib/join.js + var join = [joinDefaults]; + function joinDefaults(left, right, parent, state) { + if (right.type === "code" && formatCodeAsIndented(right, state) && (left.type === "list" || left.type === right.type && formatCodeAsIndented(left, state))) { + return false; + } + if ("spread" in parent && typeof parent.spread === "boolean") { + if (left.type === "paragraph" && // Two paragraphs. + (left.type === right.type || right.type === "definition" || // Paragraph followed by a setext heading. + right.type === "heading" && formatHeadingAsSetext(right, state))) { + return; + } + return parent.spread ? 1 : 0; + } + } + + // node_modules/mdast-util-to-markdown/lib/unsafe.js + var fullPhrasingSpans = [ + "autolink", + "destinationLiteral", + "destinationRaw", + "reference", + "titleQuote", + "titleApostrophe" + ]; + var unsafe = [ + { character: " ", after: "[\\r\\n]", inConstruct: "phrasing" }, + { character: " ", before: "[\\r\\n]", inConstruct: "phrasing" }, + { + character: " ", + inConstruct: ["codeFencedLangGraveAccent", "codeFencedLangTilde"] + }, + { + character: "\r", + inConstruct: [ + "codeFencedLangGraveAccent", + "codeFencedLangTilde", + "codeFencedMetaGraveAccent", + "codeFencedMetaTilde", + "destinationLiteral", + "headingAtx" + ] + }, + { + character: "\n", + inConstruct: [ + "codeFencedLangGraveAccent", + "codeFencedLangTilde", + "codeFencedMetaGraveAccent", + "codeFencedMetaTilde", + "destinationLiteral", + "headingAtx" + ] + }, + { character: " ", after: "[\\r\\n]", inConstruct: "phrasing" }, + { character: " ", before: "[\\r\\n]", inConstruct: "phrasing" }, + { + character: " ", + inConstruct: ["codeFencedLangGraveAccent", "codeFencedLangTilde"] + }, + // An exclamation mark can start an image, if it is followed by a link or + // a link reference. + { + character: "!", + after: "\\[", + inConstruct: "phrasing", + notInConstruct: fullPhrasingSpans + }, + // A quote can break out of a title. + { character: '"', inConstruct: "titleQuote" }, + // A number sign could start an ATX heading if it starts a line. + { atBreak: true, character: "#" }, + { character: "#", inConstruct: "headingAtx", after: "(?:[\r\n]|$)" }, + // Dollar sign and percentage are not used in markdown. + // An ampersand could start a character reference. + { character: "&", after: "[#A-Za-z]", inConstruct: "phrasing" }, + // An apostrophe can break out of a title. + { character: "'", inConstruct: "titleApostrophe" }, + // A left paren could break out of a destination raw. + { character: "(", inConstruct: "destinationRaw" }, + // A left paren followed by `]` could make something into a link or image. + { + before: "\\]", + character: "(", + inConstruct: "phrasing", + notInConstruct: fullPhrasingSpans + }, + // A right paren could start a list item or break out of a destination + // raw. + { atBreak: true, before: "\\d+", character: ")" }, + { character: ")", inConstruct: "destinationRaw" }, + // An asterisk can start thematic breaks, list items, emphasis, strong. + { atBreak: true, character: "*", after: "(?:[ \r\n*])" }, + { character: "*", inConstruct: "phrasing", notInConstruct: fullPhrasingSpans }, + // A plus sign could start a list item. + { atBreak: true, character: "+", after: "(?:[ \r\n])" }, + // A dash can start thematic breaks, list items, and setext heading + // underlines. + { atBreak: true, character: "-", after: "(?:[ \r\n-])" }, + // A dot could start a list item. + { atBreak: true, before: "\\d+", character: ".", after: "(?:[ \r\n]|$)" }, + // Slash, colon, and semicolon are not used in markdown for constructs. + // A less than can start html (flow or text) or an autolink. + // HTML could start with an exclamation mark (declaration, cdata, comment), + // slash (closing tag), question mark (instruction), or a letter (tag). + // An autolink also starts with a letter. + // Finally, it could break out of a destination literal. + { atBreak: true, character: "<", after: "[!/?A-Za-z]" }, + { + character: "<", + after: "[!/?A-Za-z]", + inConstruct: "phrasing", + notInConstruct: fullPhrasingSpans + }, + { character: "<", inConstruct: "destinationLiteral" }, + // An equals to can start setext heading underlines. + { atBreak: true, character: "=" }, + // A greater than can start block quotes and it can break out of a + // destination literal. + { atBreak: true, character: ">" }, + { character: ">", inConstruct: "destinationLiteral" }, + // Question mark and at sign are not used in markdown for constructs. + // A left bracket can start definitions, references, labels, + { atBreak: true, character: "[" }, + { character: "[", inConstruct: "phrasing", notInConstruct: fullPhrasingSpans }, + { character: "[", inConstruct: ["label", "reference"] }, + // A backslash can start an escape (when followed by punctuation) or a + // hard break (when followed by an eol). + // Note: typical escapes are handled in `safe`! + { character: "\\", after: "[\\r\\n]", inConstruct: "phrasing" }, + // A right bracket can exit labels. + { character: "]", inConstruct: ["label", "reference"] }, + // Caret is not used in markdown for constructs. + // An underscore can start emphasis, strong, or a thematic break. + { atBreak: true, character: "_" }, + { character: "_", inConstruct: "phrasing", notInConstruct: fullPhrasingSpans }, + // A grave accent can start code (fenced or text), or it can break out of + // a grave accent code fence. + { atBreak: true, character: "`" }, + { + character: "`", + inConstruct: ["codeFencedLangGraveAccent", "codeFencedMetaGraveAccent"] + }, + { character: "`", inConstruct: "phrasing", notInConstruct: fullPhrasingSpans }, + // Left brace, vertical bar, right brace are not used in markdown for + // constructs. + // A tilde can start code (fenced). + { atBreak: true, character: "~" } + ]; + + // node_modules/mdast-util-to-markdown/lib/util/association.js + function association(node2) { + if (node2.label || !node2.identifier) { + return node2.label || ""; + } + return decodeString(node2.identifier); + } + + // node_modules/mdast-util-to-markdown/lib/util/compile-pattern.js + function compilePattern(pattern) { + if (!pattern._compiled) { + const before = (pattern.atBreak ? "[\\r\\n][\\t ]*" : "") + (pattern.before ? "(?:" + pattern.before + ")" : ""); + pattern._compiled = new RegExp( + (before ? "(" + before + ")" : "") + (/[|\\{}()[\]^$+*?.-]/.test(pattern.character) ? "\\" : "") + pattern.character + (pattern.after ? "(?:" + pattern.after + ")" : ""), + "g" + ); + } + return pattern._compiled; + } + + // node_modules/mdast-util-to-markdown/lib/util/container-phrasing.js + function containerPhrasing(parent, state, info) { + const indexStack = state.indexStack; + const children = parent.children || []; + const results = []; + let index2 = -1; + let before = info.before; + indexStack.push(-1); + let tracker = state.createTracker(info); + while (++index2 < children.length) { + const child = children[index2]; + let after; + indexStack[indexStack.length - 1] = index2; + if (index2 + 1 < children.length) { + let handle2 = state.handle.handlers[children[index2 + 1].type]; + if (handle2 && handle2.peek) handle2 = handle2.peek; + after = handle2 ? handle2(children[index2 + 1], parent, state, __spreadValues({ + before: "", + after: "" + }, tracker.current())).charAt(0) : ""; + } else { + after = info.after; + } + if (results.length > 0 && (before === "\r" || before === "\n") && child.type === "html") { + results[results.length - 1] = results[results.length - 1].replace( + /(\r?\n|\r)$/, + " " + ); + before = " "; + tracker = state.createTracker(info); + tracker.move(results.join("")); + } + results.push( + tracker.move( + state.handle(child, parent, state, __spreadProps(__spreadValues({}, tracker.current()), { + before, + after + })) + ) + ); + before = results[results.length - 1].slice(-1); + } + indexStack.pop(); + return results.join(""); + } + + // node_modules/mdast-util-to-markdown/lib/util/container-flow.js + function containerFlow(parent, state, info) { + const indexStack = state.indexStack; + const children = parent.children || []; + const tracker = state.createTracker(info); + const results = []; + let index2 = -1; + indexStack.push(-1); + while (++index2 < children.length) { + const child = children[index2]; + indexStack[indexStack.length - 1] = index2; + results.push( + tracker.move( + state.handle(child, parent, state, __spreadValues({ + before: "\n", + after: "\n" + }, tracker.current())) + ) + ); + if (child.type !== "list") { + state.bulletLastUsed = void 0; + } + if (index2 < children.length - 1) { + results.push( + tracker.move(between(child, children[index2 + 1], parent, state)) + ); + } + } + indexStack.pop(); + return results.join(""); + } + function between(left, right, parent, state) { + let index2 = state.join.length; + while (index2--) { + const result = state.join[index2](left, right, parent, state); + if (result === true || result === 1) { + break; + } + if (typeof result === "number") { + return "\n".repeat(1 + result); + } + if (result === false) { + return "\n\n\n\n"; + } + } + return "\n\n"; + } + + // node_modules/mdast-util-to-markdown/lib/util/indent-lines.js + var eol = /\r?\n|\r/g; + function indentLines(value, map5) { + const result = []; + let start = 0; + let line = 0; + let match; + while (match = eol.exec(value)) { + one2(value.slice(start, match.index)); + result.push(match[0]); + start = match.index + match[0].length; + line++; + } + one2(value.slice(start)); + return result.join(""); + function one2(value2) { + result.push(map5(value2, line, !value2)); + } + } + + // node_modules/mdast-util-to-markdown/lib/util/safe.js + function safe(state, input, config) { + const value = (config.before || "") + (input || "") + (config.after || ""); + const positions = []; + const result = []; + const infos = {}; + let index2 = -1; + while (++index2 < state.unsafe.length) { + const pattern = state.unsafe[index2]; + if (!patternInScope(state.stack, pattern)) { + continue; + } + const expression = state.compilePattern(pattern); + let match; + while (match = expression.exec(value)) { + const before = "before" in pattern || Boolean(pattern.atBreak); + const after = "after" in pattern; + const position2 = match.index + (before ? match[1].length : 0); + if (positions.includes(position2)) { + if (infos[position2].before && !before) { + infos[position2].before = false; + } + if (infos[position2].after && !after) { + infos[position2].after = false; + } + } else { + positions.push(position2); + infos[position2] = { before, after }; + } + } + } + positions.sort(numerical); + let start = config.before ? config.before.length : 0; + const end = value.length - (config.after ? config.after.length : 0); + index2 = -1; + while (++index2 < positions.length) { + const position2 = positions[index2]; + if (position2 < start || position2 >= end) { + continue; + } + if (position2 + 1 < end && positions[index2 + 1] === position2 + 1 && infos[position2].after && !infos[position2 + 1].before && !infos[position2 + 1].after || positions[index2 - 1] === position2 - 1 && infos[position2].before && !infos[position2 - 1].before && !infos[position2 - 1].after) { + continue; + } + if (start !== position2) { + result.push(escapeBackslashes(value.slice(start, position2), "\\")); + } + start = position2; + if (/[!-/:-@[-`{-~]/.test(value.charAt(position2)) && (!config.encode || !config.encode.includes(value.charAt(position2)))) { + result.push("\\"); + } else { + result.push( + "&#x" + value.charCodeAt(position2).toString(16).toUpperCase() + ";" + ); + start++; + } + } + result.push(escapeBackslashes(value.slice(start, end), config.after)); + return result.join(""); + } + function numerical(a2, b4) { + return a2 - b4; + } + function escapeBackslashes(value, after) { + const expression = /\\(?=[!-/:-@[-`{-~])/g; + const positions = []; + const results = []; + const whole = value + after; + let index2 = -1; + let start = 0; + let match; + while (match = expression.exec(whole)) { + positions.push(match.index); + } + while (++index2 < positions.length) { + if (start !== positions[index2]) { + results.push(value.slice(start, positions[index2])); + } + results.push("\\"); + start = positions[index2]; + } + results.push(value.slice(start)); + return results.join(""); + } + + // node_modules/mdast-util-to-markdown/lib/util/track.js + function track(config) { + const options2 = config || {}; + const now = options2.now || {}; + let lineShift = options2.lineShift || 0; + let line = now.line || 1; + let column = now.column || 1; + return { move, current, shift: shift2 }; + function current() { + return { now: { line, column }, lineShift }; + } + function shift2(value) { + lineShift += value; + } + function move(input) { + const value = input || ""; + const chunks = value.split(/\r?\n|\r/g); + const tail = chunks[chunks.length - 1]; + line += chunks.length - 1; + column = chunks.length === 1 ? column + tail.length : 1 + tail.length + lineShift; + return value; + } + } + + // node_modules/mdast-util-to-markdown/lib/index.js + function toMarkdown(tree, options2 = {}) { + const state = { + enter, + indentLines, + associationId: association, + containerPhrasing: containerPhrasingBound, + containerFlow: containerFlowBound, + createTracker: track, + compilePattern, + safe: safeBound, + stack: [], + unsafe: [...unsafe], + join: [...join], + // @ts-expect-error: GFM / frontmatter are typed in `mdast` but not defined + // here. + handlers: __spreadValues({}, handle), + options: {}, + indexStack: [], + // @ts-expect-error: add `handle` in a second. + handle: void 0 + }; + configure2(state, options2); + if (state.options.tightDefinitions) { + state.join.push(joinDefinition); + } + state.handle = zwitch("type", { + invalid, + unknown, + handlers: state.handlers + }); + let result = state.handle(tree, void 0, state, { + before: "\n", + after: "\n", + now: { line: 1, column: 1 }, + lineShift: 0 + }); + if (result && result.charCodeAt(result.length - 1) !== 10 && result.charCodeAt(result.length - 1) !== 13) { + result += "\n"; + } + return result; + function enter(name) { + state.stack.push(name); + return exit3; + function exit3() { + state.stack.pop(); + } + } + } + function invalid(value) { + throw new Error("Cannot handle value `" + value + "`, expected node"); + } + function unknown(value) { + const node2 = ( + /** @type {Nodes} */ + value + ); + throw new Error("Cannot handle unknown node `" + node2.type + "`"); + } + function joinDefinition(left, right) { + if (left.type === "definition" && left.type === right.type) { + return 0; + } + } + function containerPhrasingBound(parent, info) { + return containerPhrasing(parent, this, info); + } + function containerFlowBound(parent, info) { + return containerFlow(parent, this, info); + } + function safeBound(value, config) { + return safe(this, value, config); + } + + // node_modules/remark-stringify/lib/index.js + function remarkStringify(options2) { + const self2 = this; + self2.compiler = compiler2; + function compiler2(tree) { + return toMarkdown(tree, __spreadProps(__spreadValues(__spreadValues({}, self2.data("settings")), options2), { + // Note: this option is not in the readme. + // The goal is for it to be set by plugins on `data` instead of being + // passed by users. + extensions: self2.data("toMarkdownExtensions") || [] + })); + } + } + + // node_modules/bail/index.js + function bail(error) { + if (error) { + throw error; + } + } + + // node_modules/unified/lib/index.js + var import_extend = __toESM(require_extend(), 1); + + // node_modules/devlop/lib/default.js + function ok2() { + } + + // node_modules/is-plain-obj/index.js + function isPlainObject(value) { + if (typeof value !== "object" || value === null) { + return false; + } + const prototype = Object.getPrototypeOf(value); + return (prototype === null || prototype === Object.prototype || Object.getPrototypeOf(prototype) === null) && !(Symbol.toStringTag in value) && !(Symbol.iterator in value); + } + + // node_modules/trough/lib/index.js + function trough() { + const fns = []; + const pipeline = { run: run2, use }; + return pipeline; + function run2(...values) { + let middlewareIndex = -1; + const callback = values.pop(); + if (typeof callback !== "function") { + throw new TypeError("Expected function as last argument, not " + callback); + } + next(null, ...values); + function next(error, ...output) { + const fn = fns[++middlewareIndex]; + let index2 = -1; + if (error) { + callback(error); + return; + } + while (++index2 < values.length) { + if (output[index2] === null || output[index2] === void 0) { + output[index2] = values[index2]; + } + } + values = output; + if (fn) { + wrap(fn, next)(...output); + } else { + callback(null, ...output); + } + } + } + function use(middelware) { + if (typeof middelware !== "function") { + throw new TypeError( + "Expected `middelware` to be a function, not " + middelware + ); + } + fns.push(middelware); + return pipeline; + } + } + function wrap(middleware, callback) { + let called; + return wrapped; + function wrapped(...parameters) { + const fnExpectsCallback = middleware.length > parameters.length; + let result; + if (fnExpectsCallback) { + parameters.push(done); + } + try { + result = middleware.apply(this, parameters); + } catch (error) { + const exception = ( + /** @type {Error} */ + error + ); + if (fnExpectsCallback && called) { + throw exception; + } + return done(exception); + } + if (!fnExpectsCallback) { + if (result && result.then && typeof result.then === "function") { + result.then(then, done); + } else if (result instanceof Error) { + done(result); + } else { + then(result); + } + } + } + function done(error, ...output) { + if (!called) { + called = true; + callback(error, ...output); + } + } + function then(value) { + done(null, value); + } + } + + // node_modules/vfile-message/lib/index.js + var VFileMessage = class extends Error { + /** + * Create a message for `reason`. + * + * > 🪦 **Note**: also has obsolete signatures. + * + * @overload + * @param {string} reason + * @param {Options | null | undefined} [options] + * @returns + * + * @overload + * @param {string} reason + * @param {Node | NodeLike | null | undefined} parent + * @param {string | null | undefined} [origin] + * @returns + * + * @overload + * @param {string} reason + * @param {Point | Position | null | undefined} place + * @param {string | null | undefined} [origin] + * @returns + * + * @overload + * @param {string} reason + * @param {string | null | undefined} [origin] + * @returns + * + * @overload + * @param {Error | VFileMessage} cause + * @param {Node | NodeLike | null | undefined} parent + * @param {string | null | undefined} [origin] + * @returns + * + * @overload + * @param {Error | VFileMessage} cause + * @param {Point | Position | null | undefined} place + * @param {string | null | undefined} [origin] + * @returns + * + * @overload + * @param {Error | VFileMessage} cause + * @param {string | null | undefined} [origin] + * @returns + * + * @param {Error | VFileMessage | string} causeOrReason + * Reason for message, should use markdown. + * @param {Node | NodeLike | Options | Point | Position | string | null | undefined} [optionsOrParentOrPlace] + * Configuration (optional). + * @param {string | null | undefined} [origin] + * Place in code where the message originates (example: + * `'my-package:my-rule'` or `'my-rule'`). + * @returns + * Instance of `VFileMessage`. + */ + // eslint-disable-next-line complexity + constructor(causeOrReason, optionsOrParentOrPlace, origin) { + super(); + if (typeof optionsOrParentOrPlace === "string") { + origin = optionsOrParentOrPlace; + optionsOrParentOrPlace = void 0; + } + let reason = ""; + let options2 = {}; + let legacyCause = false; + if (optionsOrParentOrPlace) { + if ("line" in optionsOrParentOrPlace && "column" in optionsOrParentOrPlace) { + options2 = { place: optionsOrParentOrPlace }; + } else if ("start" in optionsOrParentOrPlace && "end" in optionsOrParentOrPlace) { + options2 = { place: optionsOrParentOrPlace }; + } else if ("type" in optionsOrParentOrPlace) { + options2 = { + ancestors: [optionsOrParentOrPlace], + place: optionsOrParentOrPlace.position + }; + } else { + options2 = __spreadValues({}, optionsOrParentOrPlace); + } + } + if (typeof causeOrReason === "string") { + reason = causeOrReason; + } else if (!options2.cause && causeOrReason) { + legacyCause = true; + reason = causeOrReason.message; + options2.cause = causeOrReason; + } + if (!options2.ruleId && !options2.source && typeof origin === "string") { + const index2 = origin.indexOf(":"); + if (index2 === -1) { + options2.ruleId = origin; + } else { + options2.source = origin.slice(0, index2); + options2.ruleId = origin.slice(index2 + 1); + } + } + if (!options2.place && options2.ancestors && options2.ancestors) { + const parent = options2.ancestors[options2.ancestors.length - 1]; + if (parent) { + options2.place = parent.position; + } + } + const start = options2.place && "start" in options2.place ? options2.place.start : options2.place; + this.ancestors = options2.ancestors || void 0; + this.cause = options2.cause || void 0; + this.column = start ? start.column : void 0; + this.fatal = void 0; + this.file; + this.message = reason; + this.line = start ? start.line : void 0; + this.name = stringifyPosition(options2.place) || "1:1"; + this.place = options2.place || void 0; + this.reason = this.message; + this.ruleId = options2.ruleId || void 0; + this.source = options2.source || void 0; + this.stack = legacyCause && options2.cause && typeof options2.cause.stack === "string" ? options2.cause.stack : ""; + this.actual; + this.expected; + this.note; + this.url; + } + }; + VFileMessage.prototype.file = ""; + VFileMessage.prototype.name = ""; + VFileMessage.prototype.reason = ""; + VFileMessage.prototype.message = ""; + VFileMessage.prototype.stack = ""; + VFileMessage.prototype.column = void 0; + VFileMessage.prototype.line = void 0; + VFileMessage.prototype.ancestors = void 0; + VFileMessage.prototype.cause = void 0; + VFileMessage.prototype.fatal = void 0; + VFileMessage.prototype.place = void 0; + VFileMessage.prototype.ruleId = void 0; + VFileMessage.prototype.source = void 0; + + // node_modules/vfile/lib/minpath.browser.js + var path = { basename, dirname, extname, join: join2, sep: "/" }; + function basename(path3, ext) { + if (ext !== void 0 && typeof ext !== "string") { + throw new TypeError('"ext" argument must be a string'); + } + assertPath(path3); + let start = 0; + let end = -1; + let index2 = path3.length; + let seenNonSlash; + if (ext === void 0 || ext.length === 0 || ext.length > path3.length) { + while (index2--) { + if (path3.codePointAt(index2) === 47) { + if (seenNonSlash) { + start = index2 + 1; + break; + } + } else if (end < 0) { + seenNonSlash = true; + end = index2 + 1; + } + } + return end < 0 ? "" : path3.slice(start, end); + } + if (ext === path3) { + return ""; + } + let firstNonSlashEnd = -1; + let extIndex = ext.length - 1; + while (index2--) { + if (path3.codePointAt(index2) === 47) { + if (seenNonSlash) { + start = index2 + 1; + break; + } + } else { + if (firstNonSlashEnd < 0) { + seenNonSlash = true; + firstNonSlashEnd = index2 + 1; + } + if (extIndex > -1) { + if (path3.codePointAt(index2) === ext.codePointAt(extIndex--)) { + if (extIndex < 0) { + end = index2; + } + } else { + extIndex = -1; + end = firstNonSlashEnd; + } + } + } + } + if (start === end) { + end = firstNonSlashEnd; + } else if (end < 0) { + end = path3.length; + } + return path3.slice(start, end); + } + function dirname(path3) { + assertPath(path3); + if (path3.length === 0) { + return "."; + } + let end = -1; + let index2 = path3.length; + let unmatchedSlash; + while (--index2) { + if (path3.codePointAt(index2) === 47) { + if (unmatchedSlash) { + end = index2; + break; + } + } else if (!unmatchedSlash) { + unmatchedSlash = true; + } + } + return end < 0 ? path3.codePointAt(0) === 47 ? "/" : "." : end === 1 && path3.codePointAt(0) === 47 ? "//" : path3.slice(0, end); + } + function extname(path3) { + assertPath(path3); + let index2 = path3.length; + let end = -1; + let startPart = 0; + let startDot = -1; + let preDotState = 0; + let unmatchedSlash; + while (index2--) { + const code3 = path3.codePointAt(index2); + if (code3 === 47) { + if (unmatchedSlash) { + startPart = index2 + 1; + break; + } + continue; + } + if (end < 0) { + unmatchedSlash = true; + end = index2 + 1; + } + if (code3 === 46) { + if (startDot < 0) { + startDot = index2; + } else if (preDotState !== 1) { + preDotState = 1; + } + } else if (startDot > -1) { + preDotState = -1; + } + } + if (startDot < 0 || end < 0 || // We saw a non-dot character immediately before the dot. + preDotState === 0 || // The (right-most) trimmed path component is exactly `..`. + preDotState === 1 && startDot === end - 1 && startDot === startPart + 1) { + return ""; + } + return path3.slice(startDot, end); + } + function join2(...segments) { + let index2 = -1; + let joined; + while (++index2 < segments.length) { + assertPath(segments[index2]); + if (segments[index2]) { + joined = joined === void 0 ? segments[index2] : joined + "/" + segments[index2]; + } + } + return joined === void 0 ? "." : normalize(joined); + } + function normalize(path3) { + assertPath(path3); + const absolute = path3.codePointAt(0) === 47; + let value = normalizeString(path3, !absolute); + if (value.length === 0 && !absolute) { + value = "."; + } + if (value.length > 0 && path3.codePointAt(path3.length - 1) === 47) { + value += "/"; + } + return absolute ? "/" + value : value; + } + function normalizeString(path3, allowAboveRoot) { + let result = ""; + let lastSegmentLength = 0; + let lastSlash = -1; + let dots = 0; + let index2 = -1; + let code3; + let lastSlashIndex; + while (++index2 <= path3.length) { + if (index2 < path3.length) { + code3 = path3.codePointAt(index2); + } else if (code3 === 47) { + break; + } else { + code3 = 47; + } + if (code3 === 47) { + if (lastSlash === index2 - 1 || dots === 1) { + } else if (lastSlash !== index2 - 1 && dots === 2) { + if (result.length < 2 || lastSegmentLength !== 2 || result.codePointAt(result.length - 1) !== 46 || result.codePointAt(result.length - 2) !== 46) { + if (result.length > 2) { + lastSlashIndex = result.lastIndexOf("/"); + if (lastSlashIndex !== result.length - 1) { + if (lastSlashIndex < 0) { + result = ""; + lastSegmentLength = 0; + } else { + result = result.slice(0, lastSlashIndex); + lastSegmentLength = result.length - 1 - result.lastIndexOf("/"); + } + lastSlash = index2; + dots = 0; + continue; + } + } else if (result.length > 0) { + result = ""; + lastSegmentLength = 0; + lastSlash = index2; + dots = 0; + continue; + } + } + if (allowAboveRoot) { + result = result.length > 0 ? result + "/.." : ".."; + lastSegmentLength = 2; + } + } else { + if (result.length > 0) { + result += "/" + path3.slice(lastSlash + 1, index2); + } else { + result = path3.slice(lastSlash + 1, index2); + } + lastSegmentLength = index2 - lastSlash - 1; + } + lastSlash = index2; + dots = 0; + } else if (code3 === 46 && dots > -1) { + dots++; + } else { + dots = -1; + } + } + return result; + } + function assertPath(path3) { + if (typeof path3 !== "string") { + throw new TypeError( + "Path must be a string. Received " + JSON.stringify(path3) + ); + } + } + + // node_modules/vfile/lib/minproc.browser.js + var proc = { cwd }; + function cwd() { + return "/"; + } + + // node_modules/vfile/lib/minurl.shared.js + function isUrl(fileUrlOrPath) { + return Boolean( + fileUrlOrPath !== null && typeof fileUrlOrPath === "object" && "href" in fileUrlOrPath && fileUrlOrPath.href && "protocol" in fileUrlOrPath && fileUrlOrPath.protocol && // @ts-expect-error: indexing is fine. + fileUrlOrPath.auth === void 0 + ); + } + + // node_modules/vfile/lib/minurl.browser.js + function urlToPath(path3) { + if (typeof path3 === "string") { + path3 = new URL(path3); + } else if (!isUrl(path3)) { + const error = new TypeError( + 'The "path" argument must be of type string or an instance of URL. Received `' + path3 + "`" + ); + error.code = "ERR_INVALID_ARG_TYPE"; + throw error; + } + if (path3.protocol !== "file:") { + const error = new TypeError("The URL must be of scheme file"); + error.code = "ERR_INVALID_URL_SCHEME"; + throw error; + } + return getPathFromURLPosix(path3); + } + function getPathFromURLPosix(url) { + if (url.hostname !== "") { + const error = new TypeError( + 'File URL host must be "localhost" or empty on darwin' + ); + error.code = "ERR_INVALID_FILE_URL_HOST"; + throw error; + } + const pathname = url.pathname; + let index2 = -1; + while (++index2 < pathname.length) { + if (pathname.codePointAt(index2) === 37 && pathname.codePointAt(index2 + 1) === 50) { + const third = pathname.codePointAt(index2 + 2); + if (third === 70 || third === 102) { + const error = new TypeError( + "File URL path must not include encoded / characters" + ); + error.code = "ERR_INVALID_FILE_URL_PATH"; + throw error; + } + } + } + return decodeURIComponent(pathname); + } + + // node_modules/vfile/lib/index.js + var order = ( + /** @type {const} */ + [ + "history", + "path", + "basename", + "stem", + "extname", + "dirname" + ] + ); + var VFile = class { + /** + * Create a new virtual file. + * + * `options` is treated as: + * + * * `string` or `Uint8Array` — `{value: options}` + * * `URL` — `{path: options}` + * * `VFile` — shallow copies its data over to the new file + * * `object` — all fields are shallow copied over to the new file + * + * Path related fields are set in the following order (least specific to + * most specific): `history`, `path`, `basename`, `stem`, `extname`, + * `dirname`. + * + * You cannot set `dirname` or `extname` without setting either `history`, + * `path`, `basename`, or `stem` too. + * + * @param {Compatible | null | undefined} [value] + * File value. + * @returns + * New instance. + */ + constructor(value) { + let options2; + if (!value) { + options2 = {}; + } else if (isUrl(value)) { + options2 = { path: value }; + } else if (typeof value === "string" || isUint8Array(value)) { + options2 = { value }; + } else { + options2 = value; + } + this.cwd = proc.cwd(); + this.data = {}; + this.history = []; + this.messages = []; + this.value; + this.map; + this.result; + this.stored; + let index2 = -1; + while (++index2 < order.length) { + const prop2 = order[index2]; + if (prop2 in options2 && options2[prop2] !== void 0 && options2[prop2] !== null) { + this[prop2] = prop2 === "history" ? [...options2[prop2]] : options2[prop2]; + } + } + let prop; + for (prop in options2) { + if (!order.includes(prop)) { + this[prop] = options2[prop]; + } + } + } + /** + * Get the basename (including extname) (example: `'index.min.js'`). + * + * @returns {string | undefined} + * Basename. + */ + get basename() { + return typeof this.path === "string" ? path.basename(this.path) : void 0; + } + /** + * Set basename (including extname) (`'index.min.js'`). + * + * Cannot contain path separators (`'/'` on unix, macOS, and browsers, `'\'` + * on windows). + * Cannot be nullified (use `file.path = file.dirname` instead). + * + * @param {string} basename + * Basename. + * @returns {undefined} + * Nothing. + */ + set basename(basename2) { + assertNonEmpty(basename2, "basename"); + assertPart(basename2, "basename"); + this.path = path.join(this.dirname || "", basename2); + } + /** + * Get the parent path (example: `'~'`). + * + * @returns {string | undefined} + * Dirname. + */ + get dirname() { + return typeof this.path === "string" ? path.dirname(this.path) : void 0; + } + /** + * Set the parent path (example: `'~'`). + * + * Cannot be set if there’s no `path` yet. + * + * @param {string | undefined} dirname + * Dirname. + * @returns {undefined} + * Nothing. + */ + set dirname(dirname2) { + assertPath2(this.basename, "dirname"); + this.path = path.join(dirname2 || "", this.basename); + } + /** + * Get the extname (including dot) (example: `'.js'`). + * + * @returns {string | undefined} + * Extname. + */ + get extname() { + return typeof this.path === "string" ? path.extname(this.path) : void 0; + } + /** + * Set the extname (including dot) (example: `'.js'`). + * + * Cannot contain path separators (`'/'` on unix, macOS, and browsers, `'\'` + * on windows). + * Cannot be set if there’s no `path` yet. + * + * @param {string | undefined} extname + * Extname. + * @returns {undefined} + * Nothing. + */ + set extname(extname2) { + assertPart(extname2, "extname"); + assertPath2(this.dirname, "extname"); + if (extname2) { + if (extname2.codePointAt(0) !== 46) { + throw new Error("`extname` must start with `.`"); + } + if (extname2.includes(".", 1)) { + throw new Error("`extname` cannot contain multiple dots"); + } + } + this.path = path.join(this.dirname, this.stem + (extname2 || "")); + } + /** + * Get the full path (example: `'~/index.min.js'`). + * + * @returns {string} + * Path. + */ + get path() { + return this.history[this.history.length - 1]; + } + /** + * Set the full path (example: `'~/index.min.js'`). + * + * Cannot be nullified. + * You can set a file URL (a `URL` object with a `file:` protocol) which will + * be turned into a path with `url.fileURLToPath`. + * + * @param {URL | string} path + * Path. + * @returns {undefined} + * Nothing. + */ + set path(path3) { + if (isUrl(path3)) { + path3 = urlToPath(path3); + } + assertNonEmpty(path3, "path"); + if (this.path !== path3) { + this.history.push(path3); + } + } + /** + * Get the stem (basename w/o extname) (example: `'index.min'`). + * + * @returns {string | undefined} + * Stem. + */ + get stem() { + return typeof this.path === "string" ? path.basename(this.path, this.extname) : void 0; + } + /** + * Set the stem (basename w/o extname) (example: `'index.min'`). + * + * Cannot contain path separators (`'/'` on unix, macOS, and browsers, `'\'` + * on windows). + * Cannot be nullified (use `file.path = file.dirname` instead). + * + * @param {string} stem + * Stem. + * @returns {undefined} + * Nothing. + */ + set stem(stem) { + assertNonEmpty(stem, "stem"); + assertPart(stem, "stem"); + this.path = path.join(this.dirname || "", stem + (this.extname || "")); + } + // Normal prototypal methods. + /** + * Create a fatal message for `reason` associated with the file. + * + * The `fatal` field of the message is set to `true` (error; file not usable) + * and the `file` field is set to the current file path. + * The message is added to the `messages` field on `file`. + * + * > 🪦 **Note**: also has obsolete signatures. + * + * @overload + * @param {string} reason + * @param {MessageOptions | null | undefined} [options] + * @returns {never} + * + * @overload + * @param {string} reason + * @param {Node | NodeLike | null | undefined} parent + * @param {string | null | undefined} [origin] + * @returns {never} + * + * @overload + * @param {string} reason + * @param {Point | Position | null | undefined} place + * @param {string | null | undefined} [origin] + * @returns {never} + * + * @overload + * @param {string} reason + * @param {string | null | undefined} [origin] + * @returns {never} + * + * @overload + * @param {Error | VFileMessage} cause + * @param {Node | NodeLike | null | undefined} parent + * @param {string | null | undefined} [origin] + * @returns {never} + * + * @overload + * @param {Error | VFileMessage} cause + * @param {Point | Position | null | undefined} place + * @param {string | null | undefined} [origin] + * @returns {never} + * + * @overload + * @param {Error | VFileMessage} cause + * @param {string | null | undefined} [origin] + * @returns {never} + * + * @param {Error | VFileMessage | string} causeOrReason + * Reason for message, should use markdown. + * @param {Node | NodeLike | MessageOptions | Point | Position | string | null | undefined} [optionsOrParentOrPlace] + * Configuration (optional). + * @param {string | null | undefined} [origin] + * Place in code where the message originates (example: + * `'my-package:my-rule'` or `'my-rule'`). + * @returns {never} + * Never. + * @throws {VFileMessage} + * Message. + */ + fail(causeOrReason, optionsOrParentOrPlace, origin) { + const message = this.message(causeOrReason, optionsOrParentOrPlace, origin); + message.fatal = true; + throw message; + } + /** + * Create an info message for `reason` associated with the file. + * + * The `fatal` field of the message is set to `undefined` (info; change + * likely not needed) and the `file` field is set to the current file path. + * The message is added to the `messages` field on `file`. + * + * > 🪦 **Note**: also has obsolete signatures. + * + * @overload + * @param {string} reason + * @param {MessageOptions | null | undefined} [options] + * @returns {VFileMessage} + * + * @overload + * @param {string} reason + * @param {Node | NodeLike | null | undefined} parent + * @param {string | null | undefined} [origin] + * @returns {VFileMessage} + * + * @overload + * @param {string} reason + * @param {Point | Position | null | undefined} place + * @param {string | null | undefined} [origin] + * @returns {VFileMessage} + * + * @overload + * @param {string} reason + * @param {string | null | undefined} [origin] + * @returns {VFileMessage} + * + * @overload + * @param {Error | VFileMessage} cause + * @param {Node | NodeLike | null | undefined} parent + * @param {string | null | undefined} [origin] + * @returns {VFileMessage} + * + * @overload + * @param {Error | VFileMessage} cause + * @param {Point | Position | null | undefined} place + * @param {string | null | undefined} [origin] + * @returns {VFileMessage} + * + * @overload + * @param {Error | VFileMessage} cause + * @param {string | null | undefined} [origin] + * @returns {VFileMessage} + * + * @param {Error | VFileMessage | string} causeOrReason + * Reason for message, should use markdown. + * @param {Node | NodeLike | MessageOptions | Point | Position | string | null | undefined} [optionsOrParentOrPlace] + * Configuration (optional). + * @param {string | null | undefined} [origin] + * Place in code where the message originates (example: + * `'my-package:my-rule'` or `'my-rule'`). + * @returns {VFileMessage} + * Message. + */ + info(causeOrReason, optionsOrParentOrPlace, origin) { + const message = this.message(causeOrReason, optionsOrParentOrPlace, origin); + message.fatal = void 0; + return message; + } + /** + * Create a message for `reason` associated with the file. + * + * The `fatal` field of the message is set to `false` (warning; change may be + * needed) and the `file` field is set to the current file path. + * The message is added to the `messages` field on `file`. + * + * > 🪦 **Note**: also has obsolete signatures. + * + * @overload + * @param {string} reason + * @param {MessageOptions | null | undefined} [options] + * @returns {VFileMessage} + * + * @overload + * @param {string} reason + * @param {Node | NodeLike | null | undefined} parent + * @param {string | null | undefined} [origin] + * @returns {VFileMessage} + * + * @overload + * @param {string} reason + * @param {Point | Position | null | undefined} place + * @param {string | null | undefined} [origin] + * @returns {VFileMessage} + * + * @overload + * @param {string} reason + * @param {string | null | undefined} [origin] + * @returns {VFileMessage} + * + * @overload + * @param {Error | VFileMessage} cause + * @param {Node | NodeLike | null | undefined} parent + * @param {string | null | undefined} [origin] + * @returns {VFileMessage} + * + * @overload + * @param {Error | VFileMessage} cause + * @param {Point | Position | null | undefined} place + * @param {string | null | undefined} [origin] + * @returns {VFileMessage} + * + * @overload + * @param {Error | VFileMessage} cause + * @param {string | null | undefined} [origin] + * @returns {VFileMessage} + * + * @param {Error | VFileMessage | string} causeOrReason + * Reason for message, should use markdown. + * @param {Node | NodeLike | MessageOptions | Point | Position | string | null | undefined} [optionsOrParentOrPlace] + * Configuration (optional). + * @param {string | null | undefined} [origin] + * Place in code where the message originates (example: + * `'my-package:my-rule'` or `'my-rule'`). + * @returns {VFileMessage} + * Message. + */ + message(causeOrReason, optionsOrParentOrPlace, origin) { + const message = new VFileMessage( + // @ts-expect-error: the overloads are fine. + causeOrReason, + optionsOrParentOrPlace, + origin + ); + if (this.path) { + message.name = this.path + ":" + message.name; + message.file = this.path; + } + message.fatal = false; + this.messages.push(message); + return message; + } + /** + * Serialize the file. + * + * > **Note**: which encodings are supported depends on the engine. + * > For info on Node.js, see: + * > . + * + * @param {string | null | undefined} [encoding='utf8'] + * Character encoding to understand `value` as when it’s a `Uint8Array` + * (default: `'utf-8'`). + * @returns {string} + * Serialized file. + */ + toString(encoding) { + if (this.value === void 0) { + return ""; + } + if (typeof this.value === "string") { + return this.value; + } + const decoder = new TextDecoder(encoding || void 0); + return decoder.decode(this.value); + } + }; + function assertPart(part, name) { + if (part && part.includes(path.sep)) { + throw new Error( + "`" + name + "` cannot be a path: did not expect `" + path.sep + "`" + ); + } + } + function assertNonEmpty(part, name) { + if (!part) { + throw new Error("`" + name + "` cannot be empty"); + } + } + function assertPath2(path3, name) { + if (!path3) { + throw new Error("Setting `" + name + "` requires `path` to be set too"); + } + } + function isUint8Array(value) { + return Boolean( + value && typeof value === "object" && "byteLength" in value && "byteOffset" in value + ); + } + + // node_modules/unified/lib/callable-instance.js + var CallableInstance = ( + /** + * @type {new , Result>(property: string | symbol) => (...parameters: Parameters) => Result} + */ + /** @type {unknown} */ + /** + * @this {Function} + * @param {string | symbol} property + * @returns {(...parameters: Array) => unknown} + */ + function(property) { + const self2 = this; + const constr = self2.constructor; + const proto = ( + /** @type {Record} */ + // Prototypes do exist. + // type-coverage:ignore-next-line + constr.prototype + ); + const func = proto[property]; + const apply2 = function() { + return func.apply(apply2, arguments); + }; + Object.setPrototypeOf(apply2, proto); + const names = Object.getOwnPropertyNames(func); + for (const p4 of names) { + const descriptor = Object.getOwnPropertyDescriptor(func, p4); + if (descriptor) Object.defineProperty(apply2, p4, descriptor); + } + return apply2; + } + ); + + // node_modules/unified/lib/index.js + var own4 = {}.hasOwnProperty; + var Processor = class _Processor extends CallableInstance { + /** + * Create a processor. + */ + constructor() { + super("copy"); + this.Compiler = void 0; + this.Parser = void 0; + this.attachers = []; + this.compiler = void 0; + this.freezeIndex = -1; + this.frozen = void 0; + this.namespace = {}; + this.parser = void 0; + this.transformers = trough(); + } + /** + * Copy a processor. + * + * @deprecated + * This is a private internal method and should not be used. + * @returns {Processor} + * New *unfrozen* processor ({@link Processor `Processor`}) that is + * configured to work the same as its ancestor. + * When the descendant processor is configured in the future it does not + * affect the ancestral processor. + */ + copy() { + const destination = ( + /** @type {Processor} */ + new _Processor() + ); + let index2 = -1; + while (++index2 < this.attachers.length) { + const attacher = this.attachers[index2]; + destination.use(...attacher); + } + destination.data((0, import_extend.default)(true, {}, this.namespace)); + return destination; + } + /** + * Configure the processor with info available to all plugins. + * Information is stored in an object. + * + * Typically, options can be given to a specific plugin, but sometimes it + * makes sense to have information shared with several plugins. + * For example, a list of HTML elements that are self-closing, which is + * needed during all phases. + * + * > 👉 **Note**: setting information cannot occur on *frozen* processors. + * > Call the processor first to create a new unfrozen processor. + * + * > 👉 **Note**: to register custom data in TypeScript, augment the + * > {@link Data `Data`} interface. + * + * @example + * This example show how to get and set info: + * + * ```js + * import {unified} from 'unified' + * + * const processor = unified().data('alpha', 'bravo') + * + * processor.data('alpha') // => 'bravo' + * + * processor.data() // => {alpha: 'bravo'} + * + * processor.data({charlie: 'delta'}) + * + * processor.data() // => {charlie: 'delta'} + * ``` + * + * @template {keyof Data} Key + * + * @overload + * @returns {Data} + * + * @overload + * @param {Data} dataset + * @returns {Processor} + * + * @overload + * @param {Key} key + * @returns {Data[Key]} + * + * @overload + * @param {Key} key + * @param {Data[Key]} value + * @returns {Processor} + * + * @param {Data | Key} [key] + * Key to get or set, or entire dataset to set, or nothing to get the + * entire dataset (optional). + * @param {Data[Key]} [value] + * Value to set (optional). + * @returns {unknown} + * The current processor when setting, the value at `key` when getting, or + * the entire dataset when getting without key. + */ + data(key, value) { + if (typeof key === "string") { + if (arguments.length === 2) { + assertUnfrozen("data", this.frozen); + this.namespace[key] = value; + return this; + } + return own4.call(this.namespace, key) && this.namespace[key] || void 0; + } + if (key) { + assertUnfrozen("data", this.frozen); + this.namespace = key; + return this; + } + return this.namespace; + } + /** + * Freeze a processor. + * + * Frozen processors are meant to be extended and not to be configured + * directly. + * + * When a processor is frozen it cannot be unfrozen. + * New processors working the same way can be created by calling the + * processor. + * + * It’s possible to freeze processors explicitly by calling `.freeze()`. + * Processors freeze automatically when `.parse()`, `.run()`, `.runSync()`, + * `.stringify()`, `.process()`, or `.processSync()` are called. + * + * @returns {Processor} + * The current processor. + */ + freeze() { + if (this.frozen) { + return this; + } + const self2 = ( + /** @type {Processor} */ + /** @type {unknown} */ + this + ); + while (++this.freezeIndex < this.attachers.length) { + const [attacher, ...options2] = this.attachers[this.freezeIndex]; + if (options2[0] === false) { + continue; + } + if (options2[0] === true) { + options2[0] = void 0; + } + const transformer = attacher.call(self2, ...options2); + if (typeof transformer === "function") { + this.transformers.use(transformer); + } + } + this.frozen = true; + this.freezeIndex = Number.POSITIVE_INFINITY; + return this; + } + /** + * Parse text to a syntax tree. + * + * > 👉 **Note**: `parse` freezes the processor if not already *frozen*. + * + * > 👉 **Note**: `parse` performs the parse phase, not the run phase or other + * > phases. + * + * @param {Compatible | undefined} [file] + * file to parse (optional); typically `string` or `VFile`; any value + * accepted as `x` in `new VFile(x)`. + * @returns {ParseTree extends undefined ? Node : ParseTree} + * Syntax tree representing `file`. + */ + parse(file) { + this.freeze(); + const realFile = vfile(file); + const parser = this.parser || this.Parser; + assertParser("parse", parser); + return parser(String(realFile), realFile); + } + /** + * Process the given file as configured on the processor. + * + * > 👉 **Note**: `process` freezes the processor if not already *frozen*. + * + * > 👉 **Note**: `process` performs the parse, run, and stringify phases. + * + * @overload + * @param {Compatible | undefined} file + * @param {ProcessCallback>} done + * @returns {undefined} + * + * @overload + * @param {Compatible | undefined} [file] + * @returns {Promise>} + * + * @param {Compatible | undefined} [file] + * File (optional); typically `string` or `VFile`]; any value accepted as + * `x` in `new VFile(x)`. + * @param {ProcessCallback> | undefined} [done] + * Callback (optional). + * @returns {Promise | undefined} + * Nothing if `done` is given. + * Otherwise a promise, rejected with a fatal error or resolved with the + * processed file. + * + * The parsed, transformed, and compiled value is available at + * `file.value` (see note). + * + * > 👉 **Note**: unified typically compiles by serializing: most + * > compilers return `string` (or `Uint8Array`). + * > Some compilers, such as the one configured with + * > [`rehype-react`][rehype-react], return other values (in this case, a + * > React tree). + * > If you’re using a compiler that doesn’t serialize, expect different + * > result values. + * > + * > To register custom results in TypeScript, add them to + * > {@link CompileResultMap `CompileResultMap`}. + * + * [rehype-react]: https://github.com/rehypejs/rehype-react + */ + process(file, done) { + const self2 = this; + this.freeze(); + assertParser("process", this.parser || this.Parser); + assertCompiler("process", this.compiler || this.Compiler); + return done ? executor(void 0, done) : new Promise(executor); + function executor(resolve, reject) { + const realFile = vfile(file); + const parseTree = ( + /** @type {HeadTree extends undefined ? Node : HeadTree} */ + /** @type {unknown} */ + self2.parse(realFile) + ); + self2.run(parseTree, realFile, function(error, tree, file2) { + if (error || !tree || !file2) { + return realDone(error); + } + const compileTree = ( + /** @type {CompileTree extends undefined ? Node : CompileTree} */ + /** @type {unknown} */ + tree + ); + const compileResult = self2.stringify(compileTree, file2); + if (looksLikeAValue(compileResult)) { + file2.value = compileResult; + } else { + file2.result = compileResult; + } + realDone( + error, + /** @type {VFileWithOutput} */ + file2 + ); + }); + function realDone(error, file2) { + if (error || !file2) { + reject(error); + } else if (resolve) { + resolve(file2); + } else { + ok2(done, "`done` is defined if `resolve` is not"); + done(void 0, file2); + } + } + } + } + /** + * Process the given file as configured on the processor. + * + * An error is thrown if asynchronous transforms are configured. + * + * > 👉 **Note**: `processSync` freezes the processor if not already *frozen*. + * + * > 👉 **Note**: `processSync` performs the parse, run, and stringify phases. + * + * @param {Compatible | undefined} [file] + * File (optional); typically `string` or `VFile`; any value accepted as + * `x` in `new VFile(x)`. + * @returns {VFileWithOutput} + * The processed file. + * + * The parsed, transformed, and compiled value is available at + * `file.value` (see note). + * + * > 👉 **Note**: unified typically compiles by serializing: most + * > compilers return `string` (or `Uint8Array`). + * > Some compilers, such as the one configured with + * > [`rehype-react`][rehype-react], return other values (in this case, a + * > React tree). + * > If you’re using a compiler that doesn’t serialize, expect different + * > result values. + * > + * > To register custom results in TypeScript, add them to + * > {@link CompileResultMap `CompileResultMap`}. + * + * [rehype-react]: https://github.com/rehypejs/rehype-react + */ + processSync(file) { + let complete = false; + let result; + this.freeze(); + assertParser("processSync", this.parser || this.Parser); + assertCompiler("processSync", this.compiler || this.Compiler); + this.process(file, realDone); + assertDone("processSync", "process", complete); + ok2(result, "we either bailed on an error or have a tree"); + return result; + function realDone(error, file2) { + complete = true; + bail(error); + result = file2; + } + } + /** + * Run *transformers* on a syntax tree. + * + * > 👉 **Note**: `run` freezes the processor if not already *frozen*. + * + * > 👉 **Note**: `run` performs the run phase, not other phases. + * + * @overload + * @param {HeadTree extends undefined ? Node : HeadTree} tree + * @param {RunCallback} done + * @returns {undefined} + * + * @overload + * @param {HeadTree extends undefined ? Node : HeadTree} tree + * @param {Compatible | undefined} file + * @param {RunCallback} done + * @returns {undefined} + * + * @overload + * @param {HeadTree extends undefined ? Node : HeadTree} tree + * @param {Compatible | undefined} [file] + * @returns {Promise} + * + * @param {HeadTree extends undefined ? Node : HeadTree} tree + * Tree to transform and inspect. + * @param {( + * RunCallback | + * Compatible + * )} [file] + * File associated with `node` (optional); any value accepted as `x` in + * `new VFile(x)`. + * @param {RunCallback} [done] + * Callback (optional). + * @returns {Promise | undefined} + * Nothing if `done` is given. + * Otherwise, a promise rejected with a fatal error or resolved with the + * transformed tree. + */ + run(tree, file, done) { + assertNode(tree); + this.freeze(); + const transformers = this.transformers; + if (!done && typeof file === "function") { + done = file; + file = void 0; + } + return done ? executor(void 0, done) : new Promise(executor); + function executor(resolve, reject) { + ok2( + typeof file !== "function", + "`file` can\u2019t be a `done` anymore, we checked" + ); + const realFile = vfile(file); + transformers.run(tree, realFile, realDone); + function realDone(error, outputTree, file2) { + const resultingTree = ( + /** @type {TailTree extends undefined ? Node : TailTree} */ + outputTree || tree + ); + if (error) { + reject(error); + } else if (resolve) { + resolve(resultingTree); + } else { + ok2(done, "`done` is defined if `resolve` is not"); + done(void 0, resultingTree, file2); + } + } + } + } + /** + * Run *transformers* on a syntax tree. + * + * An error is thrown if asynchronous transforms are configured. + * + * > 👉 **Note**: `runSync` freezes the processor if not already *frozen*. + * + * > 👉 **Note**: `runSync` performs the run phase, not other phases. + * + * @param {HeadTree extends undefined ? Node : HeadTree} tree + * Tree to transform and inspect. + * @param {Compatible | undefined} [file] + * File associated with `node` (optional); any value accepted as `x` in + * `new VFile(x)`. + * @returns {TailTree extends undefined ? Node : TailTree} + * Transformed tree. + */ + runSync(tree, file) { + let complete = false; + let result; + this.run(tree, file, realDone); + assertDone("runSync", "run", complete); + ok2(result, "we either bailed on an error or have a tree"); + return result; + function realDone(error, tree2) { + bail(error); + result = tree2; + complete = true; + } + } + /** + * Compile a syntax tree. + * + * > 👉 **Note**: `stringify` freezes the processor if not already *frozen*. + * + * > 👉 **Note**: `stringify` performs the stringify phase, not the run phase + * > or other phases. + * + * @param {CompileTree extends undefined ? Node : CompileTree} tree + * Tree to compile. + * @param {Compatible | undefined} [file] + * File associated with `node` (optional); any value accepted as `x` in + * `new VFile(x)`. + * @returns {CompileResult extends undefined ? Value : CompileResult} + * Textual representation of the tree (see note). + * + * > 👉 **Note**: unified typically compiles by serializing: most compilers + * > return `string` (or `Uint8Array`). + * > Some compilers, such as the one configured with + * > [`rehype-react`][rehype-react], return other values (in this case, a + * > React tree). + * > If you’re using a compiler that doesn’t serialize, expect different + * > result values. + * > + * > To register custom results in TypeScript, add them to + * > {@link CompileResultMap `CompileResultMap`}. + * + * [rehype-react]: https://github.com/rehypejs/rehype-react + */ + stringify(tree, file) { + this.freeze(); + const realFile = vfile(file); + const compiler2 = this.compiler || this.Compiler; + assertCompiler("stringify", compiler2); + assertNode(tree); + return compiler2(tree, realFile); + } + /** + * Configure the processor to use a plugin, a list of usable values, or a + * preset. + * + * If the processor is already using a plugin, the previous plugin + * configuration is changed based on the options that are passed in. + * In other words, the plugin is not added a second time. + * + * > 👉 **Note**: `use` cannot be called on *frozen* processors. + * > Call the processor first to create a new unfrozen processor. + * + * @example + * There are many ways to pass plugins to `.use()`. + * This example gives an overview: + * + * ```js + * import {unified} from 'unified' + * + * unified() + * // Plugin with options: + * .use(pluginA, {x: true, y: true}) + * // Passing the same plugin again merges configuration (to `{x: true, y: false, z: true}`): + * .use(pluginA, {y: false, z: true}) + * // Plugins: + * .use([pluginB, pluginC]) + * // Two plugins, the second with options: + * .use([pluginD, [pluginE, {}]]) + * // Preset with plugins and settings: + * .use({plugins: [pluginF, [pluginG, {}]], settings: {position: false}}) + * // Settings only: + * .use({settings: {position: false}}) + * ``` + * + * @template {Array} [Parameters=[]] + * @template {Node | string | undefined} [Input=undefined] + * @template [Output=Input] + * + * @overload + * @param {Preset | null | undefined} [preset] + * @returns {Processor} + * + * @overload + * @param {PluggableList} list + * @returns {Processor} + * + * @overload + * @param {Plugin} plugin + * @param {...(Parameters | [boolean])} parameters + * @returns {UsePlugin} + * + * @param {PluggableList | Plugin | Preset | null | undefined} value + * Usable value. + * @param {...unknown} parameters + * Parameters, when a plugin is given as a usable value. + * @returns {Processor} + * Current processor. + */ + use(value, ...parameters) { + const attachers = this.attachers; + const namespace = this.namespace; + assertUnfrozen("use", this.frozen); + if (value === null || value === void 0) { + } else if (typeof value === "function") { + addPlugin(value, parameters); + } else if (typeof value === "object") { + if (Array.isArray(value)) { + addList(value); + } else { + addPreset(value); + } + } else { + throw new TypeError("Expected usable value, not `" + value + "`"); + } + return this; + function add(value2) { + if (typeof value2 === "function") { + addPlugin(value2, []); + } else if (typeof value2 === "object") { + if (Array.isArray(value2)) { + const [plugin, ...parameters2] = ( + /** @type {PluginTuple>} */ + value2 + ); + addPlugin(plugin, parameters2); + } else { + addPreset(value2); + } + } else { + throw new TypeError("Expected usable value, not `" + value2 + "`"); + } + } + function addPreset(result) { + if (!("plugins" in result) && !("settings" in result)) { + throw new Error( + "Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither" + ); + } + addList(result.plugins); + if (result.settings) { + namespace.settings = (0, import_extend.default)(true, namespace.settings, result.settings); + } + } + function addList(plugins) { + let index2 = -1; + if (plugins === null || plugins === void 0) { + } else if (Array.isArray(plugins)) { + while (++index2 < plugins.length) { + const thing = plugins[index2]; + add(thing); + } + } else { + throw new TypeError("Expected a list of plugins, not `" + plugins + "`"); + } + } + function addPlugin(plugin, parameters2) { + let index2 = -1; + let entryIndex = -1; + while (++index2 < attachers.length) { + if (attachers[index2][0] === plugin) { + entryIndex = index2; + break; + } + } + if (entryIndex === -1) { + attachers.push([plugin, ...parameters2]); + } else if (parameters2.length > 0) { + let [primary, ...rest] = parameters2; + const currentPrimary = attachers[entryIndex][1]; + if (isPlainObject(currentPrimary) && isPlainObject(primary)) { + primary = (0, import_extend.default)(true, currentPrimary, primary); + } + attachers[entryIndex] = [plugin, primary, ...rest]; + } + } + } + }; + var unified = new Processor().freeze(); + function assertParser(name, value) { + if (typeof value !== "function") { + throw new TypeError("Cannot `" + name + "` without `parser`"); + } + } + function assertCompiler(name, value) { + if (typeof value !== "function") { + throw new TypeError("Cannot `" + name + "` without `compiler`"); + } + } + function assertUnfrozen(name, frozen) { + if (frozen) { + throw new Error( + "Cannot call `" + name + "` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`." + ); + } + } + function assertNode(node2) { + if (!isPlainObject(node2) || typeof node2.type !== "string") { + throw new TypeError("Expected node, got `" + node2 + "`"); + } + } + function assertDone(name, asyncName, complete) { + if (!complete) { + throw new Error( + "`" + name + "` finished async. Use `" + asyncName + "` instead" + ); + } + } + function vfile(value) { + return looksLikeAVFile(value) ? value : new VFile(value); + } + function looksLikeAVFile(value) { + return Boolean( + value && typeof value === "object" && "message" in value && "messages" in value + ); + } + function looksLikeAValue(value) { + return typeof value === "string" || isUint8Array2(value); + } + function isUint8Array2(value) { + return Boolean( + value && typeof value === "object" && "byteLength" in value && "byteOffset" in value + ); + } + + // node_modules/@milkdown/transformer/lib/index.es.js + var G2 = (p4, h5, n4) => { + if (!h5.has(p4)) + throw TypeError("Cannot " + n4); + }; + var r = (p4, h5, n4) => (G2(p4, h5, "read from private field"), n4 ? n4.call(p4) : h5.get(p4)); + var c2 = (p4, h5, n4) => { + if (h5.has(p4)) + throw TypeError("Cannot add the same private member more than once"); + h5 instanceof WeakSet ? h5.add(p4) : h5.set(p4, n4); + }; + var o = (p4, h5, n4, t2) => (G2(p4, h5, "write to private field"), t2 ? t2.call(p4, n4) : h5.set(p4, n4), n4); + var Q = class { + }; + var U2 = class { + constructor() { + this.elements = [], this.size = () => this.elements.length, this.top = () => this.elements.at(-1), this.push = (h5) => { + var n4; + (n4 = this.top()) == null || n4.push(h5); + }, this.open = (h5) => { + this.elements.push(h5); + }, this.close = () => { + const h5 = this.elements.pop(); + if (!h5) + throw h(); + return h5; + }; + } + }; + var B = class _B extends Q { + constructor(h5, n4, t2) { + super(), this.type = h5, this.content = n4, this.attrs = t2; + } + push(h5, ...n4) { + this.content.push(h5, ...n4); + } + pop() { + return this.content.pop(); + } + static create(h5, n4, t2) { + return new _B(h5, n4, t2); + } + }; + var d3; + var N; + var O; + var T2; + var F2; + var k2; + var M3; + var S3 = class S4 extends U2 { + /// @internal + constructor(n4) { + super(); + c2(this, d3, void 0); + c2(this, N, void 0); + c2(this, O, void 0); + c2(this, T2, void 0); + c2(this, F2, void 0); + c2(this, k2, void 0); + c2(this, M3, void 0); + o(this, d3, Mark.none), o(this, N, (t2) => t2.isText), o(this, O, (t2, s2) => { + if (r(this, N).call(this, t2) && r(this, N).call(this, s2) && Mark.sameSet(t2.marks, s2.marks)) + return this.schema.text(t2.text + s2.text, t2.marks); + }), o(this, T2, (t2) => { + const s2 = Object.values(__spreadValues(__spreadValues({}, this.schema.nodes), this.schema.marks)).find((e2) => e2.spec.parseMarkdown.match(t2)); + if (!s2) + throw w(t2); + return s2; + }), o(this, F2, (t2) => { + const s2 = r(this, T2).call(this, t2); + s2.spec.parseMarkdown.runner(this, t2, s2); + }), this.injectRoot = (t2, s2, e2) => (this.openNode(s2, e2), this.next(t2.children), this), this.openNode = (t2, s2) => (this.open(B.create(t2, [], s2)), this), o(this, k2, () => { + o(this, d3, Mark.none); + const t2 = this.close(); + return r(this, M3).call(this, t2.type, t2.attrs, t2.content); + }), this.closeNode = () => (r(this, k2).call(this), this), o(this, M3, (t2, s2, e2) => { + const i2 = t2.createAndFill(s2, e2, r(this, d3)); + if (!i2) + throw g(t2, s2, e2); + return this.push(i2), i2; + }), this.addNode = (t2, s2, e2) => (r(this, M3).call(this, t2, s2, e2), this), this.openMark = (t2, s2) => { + const e2 = t2.create(s2); + return o(this, d3, e2.addToSet(r(this, d3))), this; + }, this.closeMark = (t2) => (o(this, d3, t2.removeFromSet(r(this, d3))), this), this.addText = (t2) => { + const s2 = this.top(); + if (!s2) + throw h(); + const e2 = s2.pop(), i2 = this.schema.text(t2, r(this, d3)); + if (!e2) + return s2.push(i2), this; + const a2 = r(this, O).call(this, e2, i2); + return a2 ? (s2.push(a2), this) : (s2.push(e2, i2), this); + }, this.build = () => { + let t2; + do + t2 = r(this, k2).call(this); + while (this.size()); + return t2; + }, this.next = (t2 = []) => ([t2].flat().forEach((s2) => r(this, F2).call(this, s2)), this), this.toDoc = () => this.build(), this.run = (t2, s2) => { + const e2 = t2.runSync(t2.parse(s2), s2); + return this.next(e2), this; + }, this.schema = n4; + } + }; + d3 = /* @__PURE__ */ new WeakMap(), N = /* @__PURE__ */ new WeakMap(), O = /* @__PURE__ */ new WeakMap(), T2 = /* @__PURE__ */ new WeakMap(), F2 = /* @__PURE__ */ new WeakMap(), k2 = /* @__PURE__ */ new WeakMap(), M3 = /* @__PURE__ */ new WeakMap(), S3.create = (n4, t2) => { + const s2 = new S3(n4); + return (e2) => (s2.run(t2, e2), s2.toDoc()); + }; + var H2 = S3; + var q2 = class q3 extends Q { + constructor(h5, n4, t2, s2 = {}) { + super(), this.type = h5, this.children = n4, this.value = t2, this.props = s2, this.push = (e2, ...i2) => { + this.children || (this.children = []), this.children.push(e2, ...i2); + }, this.pop = () => { + var e2; + return (e2 = this.children) == null ? void 0 : e2.pop(); + }; + } + }; + q2.create = (h5, n4, t2, s2 = {}) => new q2(h5, n4, t2, s2); + var J2 = q2; + var Z = (p4) => Object.prototype.hasOwnProperty.call(p4, "size"); + var l3; + var v; + var A2; + var E2; + var w3; + var j2; + var x3; + var R2; + var m2; + var g3; + var C2; + var P2; + var z = class z2 extends U2 { + /// @internal + constructor(n4) { + super(); + c2(this, l3, void 0); + c2(this, v, void 0); + c2(this, A2, void 0); + c2(this, E2, void 0); + c2(this, w3, void 0); + c2(this, j2, void 0); + c2(this, x3, void 0); + c2(this, R2, void 0); + c2(this, m2, void 0); + c2(this, g3, void 0); + c2(this, C2, void 0); + c2(this, P2, void 0); + o(this, l3, Mark.none), o(this, v, (t2) => { + const s2 = Object.values(__spreadValues(__spreadValues({}, this.schema.nodes), this.schema.marks)).find((e2) => e2.spec.toMarkdown.match(t2)); + if (!s2) + throw F(t2.type); + return s2; + }), o(this, A2, (t2) => r(this, v).call(this, t2).spec.toMarkdown.runner(this, t2)), o(this, E2, (t2, s2) => r(this, v).call(this, t2).spec.toMarkdown.runner(this, t2, s2)), o(this, w3, (t2) => { + const { marks: s2 } = t2, e2 = (u4) => { + var _a; + return (_a = u4.type.spec.priority) != null ? _a : 50; + }; + [...s2].sort((u4, f3) => e2(u4) - e2(f3)).every((u4) => !r(this, E2).call(this, u4, t2)) && r(this, A2).call(this, t2), s2.forEach((u4) => r(this, P2).call(this, u4)); + }), o(this, j2, (t2, s2) => { + var f3; + if (t2.type === s2 || ((f3 = t2.children) == null ? void 0 : f3.length) !== 1) + return t2; + const e2 = (y4) => { + var I4; + if (y4.type === s2) + return y4; + if (((I4 = y4.children) == null ? void 0 : I4.length) !== 1) + return null; + const [b4] = y4.children; + return b4 ? e2(b4) : null; + }, i2 = e2(t2); + if (!i2) + return t2; + const a2 = i2.children ? [...i2.children] : void 0, u4 = __spreadProps(__spreadValues({}, t2), { children: a2 }); + return u4.children = a2, i2.children = [u4], i2; + }), o(this, x3, (t2) => { + const { children: s2 } = t2; + return s2 && (t2.children = s2.reduce((e2, i2, a2) => { + if (a2 === 0) + return [i2]; + const u4 = e2.at(-1); + if (u4 && u4.isMark && i2.isMark) { + i2 = r(this, j2).call(this, i2, u4.type); + const _a = i2, { children: f3 } = _a, y4 = __objRest(_a, ["children"]), _b = u4, { children: b4 } = _b, I4 = __objRest(_b, ["children"]); + if (i2.type === u4.type && f3 && b4 && JSON.stringify(y4) === JSON.stringify(I4)) { + const V4 = __spreadProps(__spreadValues({}, I4), { + children: [...b4, ...f3] + }); + return e2.slice(0, -1).concat(r(this, x3).call(this, V4)); + } + } + return e2.concat(i2); + }, [])), t2; + }), o(this, R2, (t2) => { + const s2 = __spreadProps(__spreadValues({}, t2.props), { + type: t2.type + }); + return t2.children && (s2.children = t2.children), t2.value && (s2.value = t2.value), s2; + }), this.openNode = (t2, s2, e2) => (this.open(J2.create(t2, void 0, s2, e2)), this), o(this, m2, () => { + const t2 = this.close(); + return r(this, g3).call(this, t2.type, t2.children, t2.value, t2.props); + }), this.closeNode = () => (r(this, m2).call(this), this), o(this, g3, (t2, s2, e2, i2) => { + const a2 = J2.create(t2, s2, e2, i2), u4 = r(this, x3).call(this, r(this, R2).call(this, a2)); + return this.push(u4), u4; + }), this.addNode = (t2, s2, e2, i2) => (r(this, g3).call(this, t2, s2, e2, i2), this), o(this, C2, (t2, s2, e2, i2) => t2.isInSet(r(this, l3)) ? this : (o(this, l3, t2.addToSet(r(this, l3))), this.openNode(s2, e2, __spreadProps(__spreadValues({}, i2), { isMark: true })))), o(this, P2, (t2) => { + t2.isInSet(r(this, l3)) && (o(this, l3, t2.type.removeFromSet(r(this, l3))), r(this, m2).call(this)); + }), this.withMark = (t2, s2, e2, i2) => (r(this, C2).call(this, t2, s2, e2, i2), this), this.closeMark = (t2) => (r(this, P2).call(this, t2), this), this.build = () => { + let t2 = null; + do + t2 = r(this, m2).call(this); + while (this.size()); + return t2; + }, this.next = (t2) => Z(t2) ? (t2.forEach((s2) => { + r(this, w3).call(this, s2); + }), this) : (r(this, w3).call(this, t2), this), this.toString = (t2) => t2.stringify(this.build()), this.run = (t2) => (this.next(t2), this), this.schema = n4; + } + }; + l3 = /* @__PURE__ */ new WeakMap(), v = /* @__PURE__ */ new WeakMap(), A2 = /* @__PURE__ */ new WeakMap(), E2 = /* @__PURE__ */ new WeakMap(), w3 = /* @__PURE__ */ new WeakMap(), j2 = /* @__PURE__ */ new WeakMap(), x3 = /* @__PURE__ */ new WeakMap(), R2 = /* @__PURE__ */ new WeakMap(), m2 = /* @__PURE__ */ new WeakMap(), g3 = /* @__PURE__ */ new WeakMap(), C2 = /* @__PURE__ */ new WeakMap(), P2 = /* @__PURE__ */ new WeakMap(), z.create = (n4, t2) => { + const s2 = new z(n4); + return (e2) => (s2.run(e2), s2.toString(t2)); + }; + var K2 = z; + + // node_modules/prosemirror-transform/dist/index.js + var lower16 = 65535; + var factor16 = Math.pow(2, 16); + function makeRecover(index2, offset) { + return index2 + offset * factor16; + } + function recoverIndex(value) { + return value & lower16; + } + function recoverOffset(value) { + return (value - (value & lower16)) / factor16; + } + var DEL_BEFORE = 1; + var DEL_AFTER = 2; + var DEL_ACROSS = 4; + var DEL_SIDE = 8; + var MapResult = class { + /** + @internal + */ + constructor(pos, delInfo, recover) { + this.pos = pos; + this.delInfo = delInfo; + this.recover = recover; + } + /** + Tells you whether the position was deleted, that is, whether the + step removed the token on the side queried (via the `assoc`) + argument from the document. + */ + get deleted() { + return (this.delInfo & DEL_SIDE) > 0; + } + /** + Tells you whether the token before the mapped position was deleted. + */ + get deletedBefore() { + return (this.delInfo & (DEL_BEFORE | DEL_ACROSS)) > 0; + } + /** + True when the token after the mapped position was deleted. + */ + get deletedAfter() { + return (this.delInfo & (DEL_AFTER | DEL_ACROSS)) > 0; + } + /** + Tells whether any of the steps mapped through deletes across the + position (including both the token before and after the + position). + */ + get deletedAcross() { + return (this.delInfo & DEL_ACROSS) > 0; + } + }; + var StepMap = class _StepMap { + /** + Create a position map. The modifications to the document are + represented as an array of numbers, in which each group of three + represents a modified chunk as `[start, oldSize, newSize]`. + */ + constructor(ranges, inverted = false) { + this.ranges = ranges; + this.inverted = inverted; + if (!ranges.length && _StepMap.empty) + return _StepMap.empty; + } + /** + @internal + */ + recover(value) { + let diff2 = 0, index2 = recoverIndex(value); + if (!this.inverted) + for (let i2 = 0; i2 < index2; i2++) + diff2 += this.ranges[i2 * 3 + 2] - this.ranges[i2 * 3 + 1]; + return this.ranges[index2 * 3] + diff2 + recoverOffset(value); + } + mapResult(pos, assoc = 1) { + return this._map(pos, assoc, false); + } + map(pos, assoc = 1) { + return this._map(pos, assoc, true); + } + /** + @internal + */ + _map(pos, assoc, simple) { + let diff2 = 0, oldIndex = this.inverted ? 2 : 1, newIndex = this.inverted ? 1 : 2; + for (let i2 = 0; i2 < this.ranges.length; i2 += 3) { + let start = this.ranges[i2] - (this.inverted ? diff2 : 0); + if (start > pos) + break; + let oldSize = this.ranges[i2 + oldIndex], newSize = this.ranges[i2 + newIndex], end = start + oldSize; + if (pos <= end) { + let side = !oldSize ? assoc : pos == start ? -1 : pos == end ? 1 : assoc; + let result = start + diff2 + (side < 0 ? 0 : newSize); + if (simple) + return result; + let recover = pos == (assoc < 0 ? start : end) ? null : makeRecover(i2 / 3, pos - start); + let del2 = pos == start ? DEL_AFTER : pos == end ? DEL_BEFORE : DEL_ACROSS; + if (assoc < 0 ? pos != start : pos != end) + del2 |= DEL_SIDE; + return new MapResult(result, del2, recover); + } + diff2 += newSize - oldSize; + } + return simple ? pos + diff2 : new MapResult(pos + diff2, 0, null); + } + /** + @internal + */ + touches(pos, recover) { + let diff2 = 0, index2 = recoverIndex(recover); + let oldIndex = this.inverted ? 2 : 1, newIndex = this.inverted ? 1 : 2; + for (let i2 = 0; i2 < this.ranges.length; i2 += 3) { + let start = this.ranges[i2] - (this.inverted ? diff2 : 0); + if (start > pos) + break; + let oldSize = this.ranges[i2 + oldIndex], end = start + oldSize; + if (pos <= end && i2 == index2 * 3) + return true; + diff2 += this.ranges[i2 + newIndex] - oldSize; + } + return false; + } + /** + Calls the given function on each of the changed ranges included in + this map. + */ + forEach(f3) { + let oldIndex = this.inverted ? 2 : 1, newIndex = this.inverted ? 1 : 2; + for (let i2 = 0, diff2 = 0; i2 < this.ranges.length; i2 += 3) { + let start = this.ranges[i2], oldStart = start - (this.inverted ? diff2 : 0), newStart = start + (this.inverted ? 0 : diff2); + let oldSize = this.ranges[i2 + oldIndex], newSize = this.ranges[i2 + newIndex]; + f3(oldStart, oldStart + oldSize, newStart, newStart + newSize); + diff2 += newSize - oldSize; + } + } + /** + Create an inverted version of this map. The result can be used to + map positions in the post-step document to the pre-step document. + */ + invert() { + return new _StepMap(this.ranges, !this.inverted); + } + /** + @internal + */ + toString() { + return (this.inverted ? "-" : "") + JSON.stringify(this.ranges); + } + /** + Create a map that moves all positions by offset `n` (which may be + negative). This can be useful when applying steps meant for a + sub-document to a larger document, or vice-versa. + */ + static offset(n4) { + return n4 == 0 ? _StepMap.empty : new _StepMap(n4 < 0 ? [0, -n4, 0] : [0, 0, n4]); + } + }; + StepMap.empty = new StepMap([]); + var Mapping = class _Mapping { + /** + Create a new mapping with the given position maps. + */ + constructor(maps = [], mirror, from = 0, to = maps.length) { + this.maps = maps; + this.mirror = mirror; + this.from = from; + this.to = to; + } + /** + Create a mapping that maps only through a part of this one. + */ + slice(from = 0, to = this.maps.length) { + return new _Mapping(this.maps, this.mirror, from, to); + } + /** + @internal + */ + copy() { + return new _Mapping(this.maps.slice(), this.mirror && this.mirror.slice(), this.from, this.to); + } + /** + Add a step map to the end of this mapping. If `mirrors` is + given, it should be the index of the step map that is the mirror + image of this one. + */ + appendMap(map5, mirrors) { + this.to = this.maps.push(map5); + if (mirrors != null) + this.setMirror(this.maps.length - 1, mirrors); + } + /** + Add all the step maps in a given mapping to this one (preserving + mirroring information). + */ + appendMapping(mapping) { + for (let i2 = 0, startSize = this.maps.length; i2 < mapping.maps.length; i2++) { + let mirr = mapping.getMirror(i2); + this.appendMap(mapping.maps[i2], mirr != null && mirr < i2 ? startSize + mirr : void 0); + } + } + /** + Finds the offset of the step map that mirrors the map at the + given offset, in this mapping (as per the second argument to + `appendMap`). + */ + getMirror(n4) { + if (this.mirror) { + for (let i2 = 0; i2 < this.mirror.length; i2++) + if (this.mirror[i2] == n4) + return this.mirror[i2 + (i2 % 2 ? -1 : 1)]; + } + } + /** + @internal + */ + setMirror(n4, m3) { + if (!this.mirror) + this.mirror = []; + this.mirror.push(n4, m3); + } + /** + Append the inverse of the given mapping to this one. + */ + appendMappingInverted(mapping) { + for (let i2 = mapping.maps.length - 1, totalSize = this.maps.length + mapping.maps.length; i2 >= 0; i2--) { + let mirr = mapping.getMirror(i2); + this.appendMap(mapping.maps[i2].invert(), mirr != null && mirr > i2 ? totalSize - mirr - 1 : void 0); + } + } + /** + Create an inverted version of this mapping. + */ + invert() { + let inverse = new _Mapping(); + inverse.appendMappingInverted(this); + return inverse; + } + /** + Map a position through this mapping. + */ + map(pos, assoc = 1) { + if (this.mirror) + return this._map(pos, assoc, true); + for (let i2 = this.from; i2 < this.to; i2++) + pos = this.maps[i2].map(pos, assoc); + return pos; + } + /** + Map a position through this mapping, returning a mapping + result. + */ + mapResult(pos, assoc = 1) { + return this._map(pos, assoc, false); + } + /** + @internal + */ + _map(pos, assoc, simple) { + let delInfo = 0; + for (let i2 = this.from; i2 < this.to; i2++) { + let map5 = this.maps[i2], result = map5.mapResult(pos, assoc); + if (result.recover != null) { + let corr = this.getMirror(i2); + if (corr != null && corr > i2 && corr < this.to) { + i2 = corr; + pos = this.maps[corr].recover(result.recover); + continue; + } + } + delInfo |= result.delInfo; + pos = result.pos; + } + return simple ? pos : new MapResult(pos, delInfo, null); + } + }; + var stepsByID = /* @__PURE__ */ Object.create(null); + var Step = class { + /** + Get the step map that represents the changes made by this step, + and which can be used to transform between positions in the old + and the new document. + */ + getMap() { + return StepMap.empty; + } + /** + Try to merge this step with another one, to be applied directly + after it. Returns the merged step when possible, null if the + steps can't be merged. + */ + merge(other) { + return null; + } + /** + Deserialize a step from its JSON representation. Will call + through to the step class' own implementation of this method. + */ + static fromJSON(schema, json) { + if (!json || !json.stepType) + throw new RangeError("Invalid input for Step.fromJSON"); + let type = stepsByID[json.stepType]; + if (!type) + throw new RangeError(`No step type ${json.stepType} defined`); + return type.fromJSON(schema, json); + } + /** + To be able to serialize steps to JSON, each step needs a string + ID to attach to its JSON representation. Use this method to + register an ID for your step classes. Try to pick something + that's unlikely to clash with steps from other modules. + */ + static jsonID(id, stepClass) { + if (id in stepsByID) + throw new RangeError("Duplicate use of step JSON ID " + id); + stepsByID[id] = stepClass; + stepClass.prototype.jsonID = id; + return stepClass; + } + }; + var StepResult = class _StepResult { + /** + @internal + */ + constructor(doc4, failed) { + this.doc = doc4; + this.failed = failed; + } + /** + Create a successful step result. + */ + static ok(doc4) { + return new _StepResult(doc4, null); + } + /** + Create a failed step result. + */ + static fail(message) { + return new _StepResult(null, message); + } + /** + Call [`Node.replace`](https://prosemirror.net/docs/ref/#model.Node.replace) with the given + arguments. Create a successful result if it succeeds, and a + failed one if it throws a `ReplaceError`. + */ + static fromReplace(doc4, from, to, slice) { + try { + return _StepResult.ok(doc4.replace(from, to, slice)); + } catch (e2) { + if (e2 instanceof ReplaceError) + return _StepResult.fail(e2.message); + throw e2; + } + } + }; + function mapFragment(fragment, f3, parent) { + let mapped = []; + for (let i2 = 0; i2 < fragment.childCount; i2++) { + let child = fragment.child(i2); + if (child.content.size) + child = child.copy(mapFragment(child.content, f3, child)); + if (child.isInline) + child = f3(child, parent, i2); + mapped.push(child); + } + return Fragment.fromArray(mapped); + } + var AddMarkStep = class _AddMarkStep extends Step { + /** + Create a mark step. + */ + constructor(from, to, mark) { + super(); + this.from = from; + this.to = to; + this.mark = mark; + } + apply(doc4) { + let oldSlice = doc4.slice(this.from, this.to), $from = doc4.resolve(this.from); + let parent = $from.node($from.sharedDepth(this.to)); + let slice = new Slice(mapFragment(oldSlice.content, (node2, parent2) => { + if (!node2.isAtom || !parent2.type.allowsMarkType(this.mark.type)) + return node2; + return node2.mark(this.mark.addToSet(node2.marks)); + }, parent), oldSlice.openStart, oldSlice.openEnd); + return StepResult.fromReplace(doc4, this.from, this.to, slice); + } + invert() { + return new RemoveMarkStep(this.from, this.to, this.mark); + } + map(mapping) { + let from = mapping.mapResult(this.from, 1), to = mapping.mapResult(this.to, -1); + if (from.deleted && to.deleted || from.pos >= to.pos) + return null; + return new _AddMarkStep(from.pos, to.pos, this.mark); + } + merge(other) { + if (other instanceof _AddMarkStep && other.mark.eq(this.mark) && this.from <= other.to && this.to >= other.from) + return new _AddMarkStep(Math.min(this.from, other.from), Math.max(this.to, other.to), this.mark); + return null; + } + toJSON() { + return { + stepType: "addMark", + mark: this.mark.toJSON(), + from: this.from, + to: this.to + }; + } + /** + @internal + */ + static fromJSON(schema, json) { + if (typeof json.from != "number" || typeof json.to != "number") + throw new RangeError("Invalid input for AddMarkStep.fromJSON"); + return new _AddMarkStep(json.from, json.to, schema.markFromJSON(json.mark)); + } + }; + Step.jsonID("addMark", AddMarkStep); + var RemoveMarkStep = class _RemoveMarkStep extends Step { + /** + Create a mark-removing step. + */ + constructor(from, to, mark) { + super(); + this.from = from; + this.to = to; + this.mark = mark; + } + apply(doc4) { + let oldSlice = doc4.slice(this.from, this.to); + let slice = new Slice(mapFragment(oldSlice.content, (node2) => { + return node2.mark(this.mark.removeFromSet(node2.marks)); + }, doc4), oldSlice.openStart, oldSlice.openEnd); + return StepResult.fromReplace(doc4, this.from, this.to, slice); + } + invert() { + return new AddMarkStep(this.from, this.to, this.mark); + } + map(mapping) { + let from = mapping.mapResult(this.from, 1), to = mapping.mapResult(this.to, -1); + if (from.deleted && to.deleted || from.pos >= to.pos) + return null; + return new _RemoveMarkStep(from.pos, to.pos, this.mark); + } + merge(other) { + if (other instanceof _RemoveMarkStep && other.mark.eq(this.mark) && this.from <= other.to && this.to >= other.from) + return new _RemoveMarkStep(Math.min(this.from, other.from), Math.max(this.to, other.to), this.mark); + return null; + } + toJSON() { + return { + stepType: "removeMark", + mark: this.mark.toJSON(), + from: this.from, + to: this.to + }; + } + /** + @internal + */ + static fromJSON(schema, json) { + if (typeof json.from != "number" || typeof json.to != "number") + throw new RangeError("Invalid input for RemoveMarkStep.fromJSON"); + return new _RemoveMarkStep(json.from, json.to, schema.markFromJSON(json.mark)); + } + }; + Step.jsonID("removeMark", RemoveMarkStep); + var AddNodeMarkStep = class _AddNodeMarkStep extends Step { + /** + Create a node mark step. + */ + constructor(pos, mark) { + super(); + this.pos = pos; + this.mark = mark; + } + apply(doc4) { + let node2 = doc4.nodeAt(this.pos); + if (!node2) + return StepResult.fail("No node at mark step's position"); + let updated = node2.type.create(node2.attrs, null, this.mark.addToSet(node2.marks)); + return StepResult.fromReplace(doc4, this.pos, this.pos + 1, new Slice(Fragment.from(updated), 0, node2.isLeaf ? 0 : 1)); + } + invert(doc4) { + let node2 = doc4.nodeAt(this.pos); + if (node2) { + let newSet = this.mark.addToSet(node2.marks); + if (newSet.length == node2.marks.length) { + for (let i2 = 0; i2 < node2.marks.length; i2++) + if (!node2.marks[i2].isInSet(newSet)) + return new _AddNodeMarkStep(this.pos, node2.marks[i2]); + return new _AddNodeMarkStep(this.pos, this.mark); + } + } + return new RemoveNodeMarkStep(this.pos, this.mark); + } + map(mapping) { + let pos = mapping.mapResult(this.pos, 1); + return pos.deletedAfter ? null : new _AddNodeMarkStep(pos.pos, this.mark); + } + toJSON() { + return { stepType: "addNodeMark", pos: this.pos, mark: this.mark.toJSON() }; + } + /** + @internal + */ + static fromJSON(schema, json) { + if (typeof json.pos != "number") + throw new RangeError("Invalid input for AddNodeMarkStep.fromJSON"); + return new _AddNodeMarkStep(json.pos, schema.markFromJSON(json.mark)); + } + }; + Step.jsonID("addNodeMark", AddNodeMarkStep); + var RemoveNodeMarkStep = class _RemoveNodeMarkStep extends Step { + /** + Create a mark-removing step. + */ + constructor(pos, mark) { + super(); + this.pos = pos; + this.mark = mark; + } + apply(doc4) { + let node2 = doc4.nodeAt(this.pos); + if (!node2) + return StepResult.fail("No node at mark step's position"); + let updated = node2.type.create(node2.attrs, null, this.mark.removeFromSet(node2.marks)); + return StepResult.fromReplace(doc4, this.pos, this.pos + 1, new Slice(Fragment.from(updated), 0, node2.isLeaf ? 0 : 1)); + } + invert(doc4) { + let node2 = doc4.nodeAt(this.pos); + if (!node2 || !this.mark.isInSet(node2.marks)) + return this; + return new AddNodeMarkStep(this.pos, this.mark); + } + map(mapping) { + let pos = mapping.mapResult(this.pos, 1); + return pos.deletedAfter ? null : new _RemoveNodeMarkStep(pos.pos, this.mark); + } + toJSON() { + return { stepType: "removeNodeMark", pos: this.pos, mark: this.mark.toJSON() }; + } + /** + @internal + */ + static fromJSON(schema, json) { + if (typeof json.pos != "number") + throw new RangeError("Invalid input for RemoveNodeMarkStep.fromJSON"); + return new _RemoveNodeMarkStep(json.pos, schema.markFromJSON(json.mark)); + } + }; + Step.jsonID("removeNodeMark", RemoveNodeMarkStep); + var ReplaceStep = class _ReplaceStep extends Step { + /** + The given `slice` should fit the 'gap' between `from` and + `to`—the depths must line up, and the surrounding nodes must be + able to be joined with the open sides of the slice. When + `structure` is true, the step will fail if the content between + from and to is not just a sequence of closing and then opening + tokens (this is to guard against rebased replace steps + overwriting something they weren't supposed to). + */ + constructor(from, to, slice, structure = false) { + super(); + this.from = from; + this.to = to; + this.slice = slice; + this.structure = structure; + } + apply(doc4) { + if (this.structure && contentBetween(doc4, this.from, this.to)) + return StepResult.fail("Structure replace would overwrite content"); + return StepResult.fromReplace(doc4, this.from, this.to, this.slice); + } + getMap() { + return new StepMap([this.from, this.to - this.from, this.slice.size]); + } + invert(doc4) { + return new _ReplaceStep(this.from, this.from + this.slice.size, doc4.slice(this.from, this.to)); + } + map(mapping) { + let from = mapping.mapResult(this.from, 1), to = mapping.mapResult(this.to, -1); + if (from.deletedAcross && to.deletedAcross) + return null; + return new _ReplaceStep(from.pos, Math.max(from.pos, to.pos), this.slice); + } + merge(other) { + if (!(other instanceof _ReplaceStep) || other.structure || this.structure) + return null; + if (this.from + this.slice.size == other.from && !this.slice.openEnd && !other.slice.openStart) { + let slice = this.slice.size + other.slice.size == 0 ? Slice.empty : new Slice(this.slice.content.append(other.slice.content), this.slice.openStart, other.slice.openEnd); + return new _ReplaceStep(this.from, this.to + (other.to - other.from), slice, this.structure); + } else if (other.to == this.from && !this.slice.openStart && !other.slice.openEnd) { + let slice = this.slice.size + other.slice.size == 0 ? Slice.empty : new Slice(other.slice.content.append(this.slice.content), other.slice.openStart, this.slice.openEnd); + return new _ReplaceStep(other.from, this.to, slice, this.structure); + } else { + return null; + } + } + toJSON() { + let json = { stepType: "replace", from: this.from, to: this.to }; + if (this.slice.size) + json.slice = this.slice.toJSON(); + if (this.structure) + json.structure = true; + return json; + } + /** + @internal + */ + static fromJSON(schema, json) { + if (typeof json.from != "number" || typeof json.to != "number") + throw new RangeError("Invalid input for ReplaceStep.fromJSON"); + return new _ReplaceStep(json.from, json.to, Slice.fromJSON(schema, json.slice), !!json.structure); + } + }; + Step.jsonID("replace", ReplaceStep); + var ReplaceAroundStep = class _ReplaceAroundStep extends Step { + /** + Create a replace-around step with the given range and gap. + `insert` should be the point in the slice into which the content + of the gap should be moved. `structure` has the same meaning as + it has in the [`ReplaceStep`](https://prosemirror.net/docs/ref/#transform.ReplaceStep) class. + */ + constructor(from, to, gapFrom, gapTo, slice, insert, structure = false) { + super(); + this.from = from; + this.to = to; + this.gapFrom = gapFrom; + this.gapTo = gapTo; + this.slice = slice; + this.insert = insert; + this.structure = structure; + } + apply(doc4) { + if (this.structure && (contentBetween(doc4, this.from, this.gapFrom) || contentBetween(doc4, this.gapTo, this.to))) + return StepResult.fail("Structure gap-replace would overwrite content"); + let gap = doc4.slice(this.gapFrom, this.gapTo); + if (gap.openStart || gap.openEnd) + return StepResult.fail("Gap is not a flat range"); + let inserted = this.slice.insertAt(this.insert, gap.content); + if (!inserted) + return StepResult.fail("Content does not fit in gap"); + return StepResult.fromReplace(doc4, this.from, this.to, inserted); + } + getMap() { + return new StepMap([ + this.from, + this.gapFrom - this.from, + this.insert, + this.gapTo, + this.to - this.gapTo, + this.slice.size - this.insert + ]); + } + invert(doc4) { + let gap = this.gapTo - this.gapFrom; + return new _ReplaceAroundStep(this.from, this.from + this.slice.size + gap, this.from + this.insert, this.from + this.insert + gap, doc4.slice(this.from, this.to).removeBetween(this.gapFrom - this.from, this.gapTo - this.from), this.gapFrom - this.from, this.structure); + } + map(mapping) { + let from = mapping.mapResult(this.from, 1), to = mapping.mapResult(this.to, -1); + let gapFrom = this.from == this.gapFrom ? from.pos : mapping.map(this.gapFrom, -1); + let gapTo = this.to == this.gapTo ? to.pos : mapping.map(this.gapTo, 1); + if (from.deletedAcross && to.deletedAcross || gapFrom < from.pos || gapTo > to.pos) + return null; + return new _ReplaceAroundStep(from.pos, to.pos, gapFrom, gapTo, this.slice, this.insert, this.structure); + } + toJSON() { + let json = { + stepType: "replaceAround", + from: this.from, + to: this.to, + gapFrom: this.gapFrom, + gapTo: this.gapTo, + insert: this.insert + }; + if (this.slice.size) + json.slice = this.slice.toJSON(); + if (this.structure) + json.structure = true; + return json; + } + /** + @internal + */ + static fromJSON(schema, json) { + if (typeof json.from != "number" || typeof json.to != "number" || typeof json.gapFrom != "number" || typeof json.gapTo != "number" || typeof json.insert != "number") + throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON"); + return new _ReplaceAroundStep(json.from, json.to, json.gapFrom, json.gapTo, Slice.fromJSON(schema, json.slice), json.insert, !!json.structure); + } + }; + Step.jsonID("replaceAround", ReplaceAroundStep); + function contentBetween(doc4, from, to) { + let $from = doc4.resolve(from), dist = to - from, depth = $from.depth; + while (dist > 0 && depth > 0 && $from.indexAfter(depth) == $from.node(depth).childCount) { + depth--; + dist--; + } + if (dist > 0) { + let next = $from.node(depth).maybeChild($from.indexAfter(depth)); + while (dist > 0) { + if (!next || next.isLeaf) + return true; + next = next.firstChild; + dist--; + } + } + return false; + } + function addMark(tr, from, to, mark) { + let removed = [], added = []; + let removing, adding; + tr.doc.nodesBetween(from, to, (node2, pos, parent) => { + if (!node2.isInline) + return; + let marks = node2.marks; + if (!mark.isInSet(marks) && parent.type.allowsMarkType(mark.type)) { + let start = Math.max(pos, from), end = Math.min(pos + node2.nodeSize, to); + let newSet = mark.addToSet(marks); + for (let i2 = 0; i2 < marks.length; i2++) { + if (!marks[i2].isInSet(newSet)) { + if (removing && removing.to == start && removing.mark.eq(marks[i2])) + removing.to = end; + else + removed.push(removing = new RemoveMarkStep(start, end, marks[i2])); + } + } + if (adding && adding.to == start) + adding.to = end; + else + added.push(adding = new AddMarkStep(start, end, mark)); + } + }); + removed.forEach((s2) => tr.step(s2)); + added.forEach((s2) => tr.step(s2)); + } + function removeMark(tr, from, to, mark) { + let matched = [], step = 0; + tr.doc.nodesBetween(from, to, (node2, pos) => { + if (!node2.isInline) + return; + step++; + let toRemove = null; + if (mark instanceof MarkType) { + let set = node2.marks, found2; + while (found2 = mark.isInSet(set)) { + (toRemove || (toRemove = [])).push(found2); + set = found2.removeFromSet(set); + } + } else if (mark) { + if (mark.isInSet(node2.marks)) + toRemove = [mark]; + } else { + toRemove = node2.marks; + } + if (toRemove && toRemove.length) { + let end = Math.min(pos + node2.nodeSize, to); + for (let i2 = 0; i2 < toRemove.length; i2++) { + let style2 = toRemove[i2], found2; + for (let j6 = 0; j6 < matched.length; j6++) { + let m3 = matched[j6]; + if (m3.step == step - 1 && style2.eq(matched[j6].style)) + found2 = m3; + } + if (found2) { + found2.to = end; + found2.step = step; + } else { + matched.push({ style: style2, from: Math.max(pos, from), to: end, step }); + } + } + } + }); + matched.forEach((m3) => tr.step(new RemoveMarkStep(m3.from, m3.to, m3.style))); + } + function clearIncompatible(tr, pos, parentType, match = parentType.contentMatch, clearNewlines = true) { + let node2 = tr.doc.nodeAt(pos); + let replSteps = [], cur = pos + 1; + for (let i2 = 0; i2 < node2.childCount; i2++) { + let child = node2.child(i2), end = cur + child.nodeSize; + let allowed = match.matchType(child.type); + if (!allowed) { + replSteps.push(new ReplaceStep(cur, end, Slice.empty)); + } else { + match = allowed; + for (let j6 = 0; j6 < child.marks.length; j6++) + if (!parentType.allowsMarkType(child.marks[j6].type)) + tr.step(new RemoveMarkStep(cur, end, child.marks[j6])); + if (clearNewlines && child.isText && parentType.whitespace != "pre") { + let m3, newline = /\r?\n|\r/g, slice; + while (m3 = newline.exec(child.text)) { + if (!slice) + slice = new Slice(Fragment.from(parentType.schema.text(" ", parentType.allowedMarks(child.marks))), 0, 0); + replSteps.push(new ReplaceStep(cur + m3.index, cur + m3.index + m3[0].length, slice)); + } + } + } + cur = end; + } + if (!match.validEnd) { + let fill = match.fillBefore(Fragment.empty, true); + tr.replace(cur, cur, new Slice(fill, 0, 0)); + } + for (let i2 = replSteps.length - 1; i2 >= 0; i2--) + tr.step(replSteps[i2]); + } + function canCut(node2, start, end) { + return (start == 0 || node2.canReplace(start, node2.childCount)) && (end == node2.childCount || node2.canReplace(0, end)); + } + function liftTarget(range) { + let parent = range.parent; + let content3 = parent.content.cutByIndex(range.startIndex, range.endIndex); + for (let depth = range.depth; ; --depth) { + let node2 = range.$from.node(depth); + let index2 = range.$from.index(depth), endIndex = range.$to.indexAfter(depth); + if (depth < range.depth && node2.canReplace(index2, endIndex, content3)) + return depth; + if (depth == 0 || node2.type.spec.isolating || !canCut(node2, index2, endIndex)) + break; + } + return null; + } + function lift(tr, range, target) { + let { $from, $to, depth } = range; + let gapStart = $from.before(depth + 1), gapEnd = $to.after(depth + 1); + let start = gapStart, end = gapEnd; + let before = Fragment.empty, openStart = 0; + for (let d6 = depth, splitting = false; d6 > target; d6--) + if (splitting || $from.index(d6) > 0) { + splitting = true; + before = Fragment.from($from.node(d6).copy(before)); + openStart++; + } else { + start--; + } + let after = Fragment.empty, openEnd = 0; + for (let d6 = depth, splitting = false; d6 > target; d6--) + if (splitting || $to.after(d6 + 1) < $to.end(d6)) { + splitting = true; + after = Fragment.from($to.node(d6).copy(after)); + openEnd++; + } else { + end++; + } + tr.step(new ReplaceAroundStep(start, end, gapStart, gapEnd, new Slice(before.append(after), openStart, openEnd), before.size - openStart, true)); + } + function findWrapping(range, nodeType, attrs = null, innerRange = range) { + let around = findWrappingOutside(range, nodeType); + let inner = around && findWrappingInside(innerRange, nodeType); + if (!inner) + return null; + return around.map(withAttrs).concat({ type: nodeType, attrs }).concat(inner.map(withAttrs)); + } + function withAttrs(type) { + return { type, attrs: null }; + } + function findWrappingOutside(range, type) { + let { parent, startIndex, endIndex } = range; + let around = parent.contentMatchAt(startIndex).findWrapping(type); + if (!around) + return null; + let outer = around.length ? around[0] : type; + return parent.canReplaceWith(startIndex, endIndex, outer) ? around : null; + } + function findWrappingInside(range, type) { + let { parent, startIndex, endIndex } = range; + let inner = parent.child(startIndex); + let inside = type.contentMatch.findWrapping(inner.type); + if (!inside) + return null; + let lastType = inside.length ? inside[inside.length - 1] : type; + let innerMatch = lastType.contentMatch; + for (let i2 = startIndex; innerMatch && i2 < endIndex; i2++) + innerMatch = innerMatch.matchType(parent.child(i2).type); + if (!innerMatch || !innerMatch.validEnd) + return null; + return inside; + } + function wrap2(tr, range, wrappers) { + let content3 = Fragment.empty; + for (let i2 = wrappers.length - 1; i2 >= 0; i2--) { + if (content3.size) { + let match = wrappers[i2].type.contentMatch.matchFragment(content3); + if (!match || !match.validEnd) + throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper"); + } + content3 = Fragment.from(wrappers[i2].type.create(wrappers[i2].attrs, content3)); + } + let start = range.start, end = range.end; + tr.step(new ReplaceAroundStep(start, end, start, end, new Slice(content3, 0, 0), wrappers.length, true)); + } + function setBlockType(tr, from, to, type, attrs) { + if (!type.isTextblock) + throw new RangeError("Type given to setBlockType should be a textblock"); + let mapFrom = tr.steps.length; + tr.doc.nodesBetween(from, to, (node2, pos) => { + if (node2.isTextblock && !node2.hasMarkup(type, attrs) && canChangeType(tr.doc, tr.mapping.slice(mapFrom).map(pos), type)) { + let convertNewlines = null; + if (type.schema.linebreakReplacement) { + let pre = type.whitespace == "pre", supportLinebreak = !!type.contentMatch.matchType(type.schema.linebreakReplacement); + if (pre && !supportLinebreak) + convertNewlines = false; + else if (!pre && supportLinebreak) + convertNewlines = true; + } + if (convertNewlines === false) + replaceLinebreaks(tr, node2, pos, mapFrom); + clearIncompatible(tr, tr.mapping.slice(mapFrom).map(pos, 1), type, void 0, convertNewlines === null); + let mapping = tr.mapping.slice(mapFrom); + let startM = mapping.map(pos, 1), endM = mapping.map(pos + node2.nodeSize, 1); + tr.step(new ReplaceAroundStep(startM, endM, startM + 1, endM - 1, new Slice(Fragment.from(type.create(attrs, null, node2.marks)), 0, 0), 1, true)); + if (convertNewlines === true) + replaceNewlines(tr, node2, pos, mapFrom); + return false; + } + }); + } + function replaceNewlines(tr, node2, pos, mapFrom) { + node2.forEach((child, offset) => { + if (child.isText) { + let m3, newline = /\r?\n|\r/g; + while (m3 = newline.exec(child.text)) { + let start = tr.mapping.slice(mapFrom).map(pos + 1 + offset + m3.index); + tr.replaceWith(start, start + 1, node2.type.schema.linebreakReplacement.create()); + } + } + }); + } + function replaceLinebreaks(tr, node2, pos, mapFrom) { + node2.forEach((child, offset) => { + if (child.type == child.type.schema.linebreakReplacement) { + let start = tr.mapping.slice(mapFrom).map(pos + 1 + offset); + tr.replaceWith(start, start + 1, node2.type.schema.text("\n")); + } + }); + } + function canChangeType(doc4, pos, type) { + let $pos = doc4.resolve(pos), index2 = $pos.index(); + return $pos.parent.canReplaceWith(index2, index2 + 1, type); + } + function setNodeMarkup(tr, pos, type, attrs, marks) { + let node2 = tr.doc.nodeAt(pos); + if (!node2) + throw new RangeError("No node at given position"); + if (!type) + type = node2.type; + let newNode = type.create(attrs, null, marks || node2.marks); + if (node2.isLeaf) + return tr.replaceWith(pos, pos + node2.nodeSize, newNode); + if (!type.validContent(node2.content)) + throw new RangeError("Invalid content for node type " + type.name); + tr.step(new ReplaceAroundStep(pos, pos + node2.nodeSize, pos + 1, pos + node2.nodeSize - 1, new Slice(Fragment.from(newNode), 0, 0), 1, true)); + } + function canSplit(doc4, pos, depth = 1, typesAfter) { + let $pos = doc4.resolve(pos), base2 = $pos.depth - depth; + let innerType = typesAfter && typesAfter[typesAfter.length - 1] || $pos.parent; + if (base2 < 0 || $pos.parent.type.spec.isolating || !$pos.parent.canReplace($pos.index(), $pos.parent.childCount) || !innerType.type.validContent($pos.parent.content.cutByIndex($pos.index(), $pos.parent.childCount))) + return false; + for (let d6 = $pos.depth - 1, i2 = depth - 2; d6 > base2; d6--, i2--) { + let node2 = $pos.node(d6), index3 = $pos.index(d6); + if (node2.type.spec.isolating) + return false; + let rest = node2.content.cutByIndex(index3, node2.childCount); + let overrideChild = typesAfter && typesAfter[i2 + 1]; + if (overrideChild) + rest = rest.replaceChild(0, overrideChild.type.create(overrideChild.attrs)); + let after = typesAfter && typesAfter[i2] || node2; + if (!node2.canReplace(index3 + 1, node2.childCount) || !after.type.validContent(rest)) + return false; + } + let index2 = $pos.indexAfter(base2); + let baseType = typesAfter && typesAfter[0]; + return $pos.node(base2).canReplaceWith(index2, index2, baseType ? baseType.type : $pos.node(base2 + 1).type); + } + function split(tr, pos, depth = 1, typesAfter) { + let $pos = tr.doc.resolve(pos), before = Fragment.empty, after = Fragment.empty; + for (let d6 = $pos.depth, e2 = $pos.depth - depth, i2 = depth - 1; d6 > e2; d6--, i2--) { + before = Fragment.from($pos.node(d6).copy(before)); + let typeAfter = typesAfter && typesAfter[i2]; + after = Fragment.from(typeAfter ? typeAfter.type.create(typeAfter.attrs, after) : $pos.node(d6).copy(after)); + } + tr.step(new ReplaceStep(pos, pos, new Slice(before.append(after), depth, depth), true)); + } + function canJoin(doc4, pos) { + let $pos = doc4.resolve(pos), index2 = $pos.index(); + return joinable2($pos.nodeBefore, $pos.nodeAfter) && $pos.parent.canReplace(index2, index2 + 1); + } + function joinable2(a2, b4) { + return !!(a2 && b4 && !a2.isLeaf && a2.canAppend(b4)); + } + function join3(tr, pos, depth) { + let step = new ReplaceStep(pos - depth, pos + depth, Slice.empty, true); + tr.step(step); + } + function insertPoint(doc4, pos, nodeType) { + let $pos = doc4.resolve(pos); + if ($pos.parent.canReplaceWith($pos.index(), $pos.index(), nodeType)) + return pos; + if ($pos.parentOffset == 0) + for (let d6 = $pos.depth - 1; d6 >= 0; d6--) { + let index2 = $pos.index(d6); + if ($pos.node(d6).canReplaceWith(index2, index2, nodeType)) + return $pos.before(d6 + 1); + if (index2 > 0) + return null; + } + if ($pos.parentOffset == $pos.parent.content.size) + for (let d6 = $pos.depth - 1; d6 >= 0; d6--) { + let index2 = $pos.indexAfter(d6); + if ($pos.node(d6).canReplaceWith(index2, index2, nodeType)) + return $pos.after(d6 + 1); + if (index2 < $pos.node(d6).childCount) + return null; + } + return null; + } + function dropPoint(doc4, pos, slice) { + let $pos = doc4.resolve(pos); + if (!slice.content.size) + return pos; + let content3 = slice.content; + for (let i2 = 0; i2 < slice.openStart; i2++) + content3 = content3.firstChild.content; + for (let pass = 1; pass <= (slice.openStart == 0 && slice.size ? 2 : 1); pass++) { + for (let d6 = $pos.depth; d6 >= 0; d6--) { + let bias = d6 == $pos.depth ? 0 : $pos.pos <= ($pos.start(d6 + 1) + $pos.end(d6 + 1)) / 2 ? -1 : 1; + let insertPos = $pos.index(d6) + (bias > 0 ? 1 : 0); + let parent = $pos.node(d6), fits = false; + if (pass == 1) { + fits = parent.canReplace(insertPos, insertPos, content3); + } else { + let wrapping = parent.contentMatchAt(insertPos).findWrapping(content3.firstChild.type); + fits = wrapping && parent.canReplaceWith(insertPos, insertPos, wrapping[0]); + } + if (fits) + return bias == 0 ? $pos.pos : bias < 0 ? $pos.before(d6 + 1) : $pos.after(d6 + 1); + } + } + return null; + } + function replaceStep(doc4, from, to = from, slice = Slice.empty) { + if (from == to && !slice.size) + return null; + let $from = doc4.resolve(from), $to = doc4.resolve(to); + if (fitsTrivially($from, $to, slice)) + return new ReplaceStep(from, to, slice); + return new Fitter($from, $to, slice).fit(); + } + function fitsTrivially($from, $to, slice) { + return !slice.openStart && !slice.openEnd && $from.start() == $to.start() && $from.parent.canReplace($from.index(), $to.index(), slice.content); + } + var Fitter = class { + constructor($from, $to, unplaced) { + this.$from = $from; + this.$to = $to; + this.unplaced = unplaced; + this.frontier = []; + this.placed = Fragment.empty; + for (let i2 = 0; i2 <= $from.depth; i2++) { + let node2 = $from.node(i2); + this.frontier.push({ + type: node2.type, + match: node2.contentMatchAt($from.indexAfter(i2)) + }); + } + for (let i2 = $from.depth; i2 > 0; i2--) + this.placed = Fragment.from($from.node(i2).copy(this.placed)); + } + get depth() { + return this.frontier.length - 1; + } + fit() { + while (this.unplaced.size) { + let fit = this.findFittable(); + if (fit) + this.placeNodes(fit); + else + this.openMore() || this.dropNode(); + } + let moveInline = this.mustMoveInline(), placedSize = this.placed.size - this.depth - this.$from.depth; + let $from = this.$from, $to = this.close(moveInline < 0 ? this.$to : $from.doc.resolve(moveInline)); + if (!$to) + return null; + let content3 = this.placed, openStart = $from.depth, openEnd = $to.depth; + while (openStart && openEnd && content3.childCount == 1) { + content3 = content3.firstChild.content; + openStart--; + openEnd--; + } + let slice = new Slice(content3, openStart, openEnd); + if (moveInline > -1) + return new ReplaceAroundStep($from.pos, moveInline, this.$to.pos, this.$to.end(), slice, placedSize); + if (slice.size || $from.pos != this.$to.pos) + return new ReplaceStep($from.pos, $to.pos, slice); + return null; + } + // Find a position on the start spine of `this.unplaced` that has + // content that can be moved somewhere on the frontier. Returns two + // depths, one for the slice and one for the frontier. + findFittable() { + let startDepth = this.unplaced.openStart; + for (let cur = this.unplaced.content, d6 = 0, openEnd = this.unplaced.openEnd; d6 < startDepth; d6++) { + let node2 = cur.firstChild; + if (cur.childCount > 1) + openEnd = 0; + if (node2.type.spec.isolating && openEnd <= d6) { + startDepth = d6; + break; + } + cur = node2.content; + } + for (let pass = 1; pass <= 2; pass++) { + for (let sliceDepth = pass == 1 ? startDepth : this.unplaced.openStart; sliceDepth >= 0; sliceDepth--) { + let fragment, parent = null; + if (sliceDepth) { + parent = contentAt(this.unplaced.content, sliceDepth - 1).firstChild; + fragment = parent.content; + } else { + fragment = this.unplaced.content; + } + let first = fragment.firstChild; + for (let frontierDepth = this.depth; frontierDepth >= 0; frontierDepth--) { + let { type, match } = this.frontier[frontierDepth], wrap3, inject = null; + if (pass == 1 && (first ? match.matchType(first.type) || (inject = match.fillBefore(Fragment.from(first), false)) : parent && type.compatibleContent(parent.type))) + return { sliceDepth, frontierDepth, parent, inject }; + else if (pass == 2 && first && (wrap3 = match.findWrapping(first.type))) + return { sliceDepth, frontierDepth, parent, wrap: wrap3 }; + if (parent && match.matchType(parent.type)) + break; + } + } + } + } + openMore() { + let { content: content3, openStart, openEnd } = this.unplaced; + let inner = contentAt(content3, openStart); + if (!inner.childCount || inner.firstChild.isLeaf) + return false; + this.unplaced = new Slice(content3, openStart + 1, Math.max(openEnd, inner.size + openStart >= content3.size - openEnd ? openStart + 1 : 0)); + return true; + } + dropNode() { + let { content: content3, openStart, openEnd } = this.unplaced; + let inner = contentAt(content3, openStart); + if (inner.childCount <= 1 && openStart > 0) { + let openAtEnd = content3.size - openStart <= openStart + inner.size; + this.unplaced = new Slice(dropFromFragment(content3, openStart - 1, 1), openStart - 1, openAtEnd ? openStart - 1 : openEnd); + } else { + this.unplaced = new Slice(dropFromFragment(content3, openStart, 1), openStart, openEnd); + } + } + // Move content from the unplaced slice at `sliceDepth` to the + // frontier node at `frontierDepth`. Close that frontier node when + // applicable. + placeNodes({ sliceDepth, frontierDepth, parent, inject, wrap: wrap3 }) { + while (this.depth > frontierDepth) + this.closeFrontierNode(); + if (wrap3) + for (let i2 = 0; i2 < wrap3.length; i2++) + this.openFrontierNode(wrap3[i2]); + let slice = this.unplaced, fragment = parent ? parent.content : slice.content; + let openStart = slice.openStart - sliceDepth; + let taken = 0, add = []; + let { match, type } = this.frontier[frontierDepth]; + if (inject) { + for (let i2 = 0; i2 < inject.childCount; i2++) + add.push(inject.child(i2)); + match = match.matchFragment(inject); + } + let openEndCount = fragment.size + sliceDepth - (slice.content.size - slice.openEnd); + while (taken < fragment.childCount) { + let next = fragment.child(taken), matches2 = match.matchType(next.type); + if (!matches2) + break; + taken++; + if (taken > 1 || openStart == 0 || next.content.size) { + match = matches2; + add.push(closeNodeStart(next.mark(type.allowedMarks(next.marks)), taken == 1 ? openStart : 0, taken == fragment.childCount ? openEndCount : -1)); + } + } + let toEnd = taken == fragment.childCount; + if (!toEnd) + openEndCount = -1; + this.placed = addToFragment(this.placed, frontierDepth, Fragment.from(add)); + this.frontier[frontierDepth].match = match; + if (toEnd && openEndCount < 0 && parent && parent.type == this.frontier[this.depth].type && this.frontier.length > 1) + this.closeFrontierNode(); + for (let i2 = 0, cur = fragment; i2 < openEndCount; i2++) { + let node2 = cur.lastChild; + this.frontier.push({ type: node2.type, match: node2.contentMatchAt(node2.childCount) }); + cur = node2.content; + } + this.unplaced = !toEnd ? new Slice(dropFromFragment(slice.content, sliceDepth, taken), slice.openStart, slice.openEnd) : sliceDepth == 0 ? Slice.empty : new Slice(dropFromFragment(slice.content, sliceDepth - 1, 1), sliceDepth - 1, openEndCount < 0 ? slice.openEnd : sliceDepth - 1); + } + mustMoveInline() { + if (!this.$to.parent.isTextblock) + return -1; + let top = this.frontier[this.depth], level; + if (!top.type.isTextblock || !contentAfterFits(this.$to, this.$to.depth, top.type, top.match, false) || this.$to.depth == this.depth && (level = this.findCloseLevel(this.$to)) && level.depth == this.depth) + return -1; + let { depth } = this.$to, after = this.$to.after(depth); + while (depth > 1 && after == this.$to.end(--depth)) + ++after; + return after; + } + findCloseLevel($to) { + scan: for (let i2 = Math.min(this.depth, $to.depth); i2 >= 0; i2--) { + let { match, type } = this.frontier[i2]; + let dropInner = i2 < $to.depth && $to.end(i2 + 1) == $to.pos + ($to.depth - (i2 + 1)); + let fit = contentAfterFits($to, i2, type, match, dropInner); + if (!fit) + continue; + for (let d6 = i2 - 1; d6 >= 0; d6--) { + let { match: match2, type: type2 } = this.frontier[d6]; + let matches2 = contentAfterFits($to, d6, type2, match2, true); + if (!matches2 || matches2.childCount) + continue scan; + } + return { depth: i2, fit, move: dropInner ? $to.doc.resolve($to.after(i2 + 1)) : $to }; + } + } + close($to) { + let close2 = this.findCloseLevel($to); + if (!close2) + return null; + while (this.depth > close2.depth) + this.closeFrontierNode(); + if (close2.fit.childCount) + this.placed = addToFragment(this.placed, close2.depth, close2.fit); + $to = close2.move; + for (let d6 = close2.depth + 1; d6 <= $to.depth; d6++) { + let node2 = $to.node(d6), add = node2.type.contentMatch.fillBefore(node2.content, true, $to.index(d6)); + this.openFrontierNode(node2.type, node2.attrs, add); + } + return $to; + } + openFrontierNode(type, attrs = null, content3) { + let top = this.frontier[this.depth]; + top.match = top.match.matchType(type); + this.placed = addToFragment(this.placed, this.depth, Fragment.from(type.create(attrs, content3))); + this.frontier.push({ type, match: type.contentMatch }); + } + closeFrontierNode() { + let open = this.frontier.pop(); + let add = open.match.fillBefore(Fragment.empty, true); + if (add.childCount) + this.placed = addToFragment(this.placed, this.frontier.length, add); + } + }; + function dropFromFragment(fragment, depth, count) { + if (depth == 0) + return fragment.cutByIndex(count, fragment.childCount); + return fragment.replaceChild(0, fragment.firstChild.copy(dropFromFragment(fragment.firstChild.content, depth - 1, count))); + } + function addToFragment(fragment, depth, content3) { + if (depth == 0) + return fragment.append(content3); + return fragment.replaceChild(fragment.childCount - 1, fragment.lastChild.copy(addToFragment(fragment.lastChild.content, depth - 1, content3))); + } + function contentAt(fragment, depth) { + for (let i2 = 0; i2 < depth; i2++) + fragment = fragment.firstChild.content; + return fragment; + } + function closeNodeStart(node2, openStart, openEnd) { + if (openStart <= 0) + return node2; + let frag = node2.content; + if (openStart > 1) + frag = frag.replaceChild(0, closeNodeStart(frag.firstChild, openStart - 1, frag.childCount == 1 ? openEnd - 1 : 0)); + if (openStart > 0) { + frag = node2.type.contentMatch.fillBefore(frag).append(frag); + if (openEnd <= 0) + frag = frag.append(node2.type.contentMatch.matchFragment(frag).fillBefore(Fragment.empty, true)); + } + return node2.copy(frag); + } + function contentAfterFits($to, depth, type, match, open) { + let node2 = $to.node(depth), index2 = open ? $to.indexAfter(depth) : $to.index(depth); + if (index2 == node2.childCount && !type.compatibleContent(node2.type)) + return null; + let fit = match.fillBefore(node2.content, true, index2); + return fit && !invalidMarks(type, node2.content, index2) ? fit : null; + } + function invalidMarks(type, fragment, start) { + for (let i2 = start; i2 < fragment.childCount; i2++) + if (!type.allowsMarks(fragment.child(i2).marks)) + return true; + return false; + } + function definesContent(type) { + return type.spec.defining || type.spec.definingForContent; + } + function replaceRange(tr, from, to, slice) { + if (!slice.size) + return tr.deleteRange(from, to); + let $from = tr.doc.resolve(from), $to = tr.doc.resolve(to); + if (fitsTrivially($from, $to, slice)) + return tr.step(new ReplaceStep(from, to, slice)); + let targetDepths = coveredDepths($from, tr.doc.resolve(to)); + if (targetDepths[targetDepths.length - 1] == 0) + targetDepths.pop(); + let preferredTarget = -($from.depth + 1); + targetDepths.unshift(preferredTarget); + for (let d6 = $from.depth, pos = $from.pos - 1; d6 > 0; d6--, pos--) { + let spec = $from.node(d6).type.spec; + if (spec.defining || spec.definingAsContext || spec.isolating) + break; + if (targetDepths.indexOf(d6) > -1) + preferredTarget = d6; + else if ($from.before(d6) == pos) + targetDepths.splice(1, 0, -d6); + } + let preferredTargetIndex = targetDepths.indexOf(preferredTarget); + let leftNodes = [], preferredDepth = slice.openStart; + for (let content3 = slice.content, i2 = 0; ; i2++) { + let node2 = content3.firstChild; + leftNodes.push(node2); + if (i2 == slice.openStart) + break; + content3 = node2.content; + } + for (let d6 = preferredDepth - 1; d6 >= 0; d6--) { + let leftNode = leftNodes[d6], def = definesContent(leftNode.type); + if (def && !leftNode.sameMarkup($from.node(Math.abs(preferredTarget) - 1))) + preferredDepth = d6; + else if (def || !leftNode.type.isTextblock) + break; + } + for (let j6 = slice.openStart; j6 >= 0; j6--) { + let openDepth = (j6 + preferredDepth + 1) % (slice.openStart + 1); + let insert = leftNodes[openDepth]; + if (!insert) + continue; + for (let i2 = 0; i2 < targetDepths.length; i2++) { + let targetDepth = targetDepths[(i2 + preferredTargetIndex) % targetDepths.length], expand = true; + if (targetDepth < 0) { + expand = false; + targetDepth = -targetDepth; + } + let parent = $from.node(targetDepth - 1), index2 = $from.index(targetDepth - 1); + if (parent.canReplaceWith(index2, index2, insert.type, insert.marks)) + return tr.replace($from.before(targetDepth), expand ? $to.after(targetDepth) : to, new Slice(closeFragment(slice.content, 0, slice.openStart, openDepth), openDepth, slice.openEnd)); + } + } + let startSteps = tr.steps.length; + for (let i2 = targetDepths.length - 1; i2 >= 0; i2--) { + tr.replace(from, to, slice); + if (tr.steps.length > startSteps) + break; + let depth = targetDepths[i2]; + if (depth < 0) + continue; + from = $from.before(depth); + to = $to.after(depth); + } + } + function closeFragment(fragment, depth, oldOpen, newOpen, parent) { + if (depth < oldOpen) { + let first = fragment.firstChild; + fragment = fragment.replaceChild(0, first.copy(closeFragment(first.content, depth + 1, oldOpen, newOpen, first))); + } + if (depth > newOpen) { + let match = parent.contentMatchAt(0); + let start = match.fillBefore(fragment).append(fragment); + fragment = start.append(match.matchFragment(start).fillBefore(Fragment.empty, true)); + } + return fragment; + } + function replaceRangeWith(tr, from, to, node2) { + if (!node2.isInline && from == to && tr.doc.resolve(from).parent.content.size) { + let point3 = insertPoint(tr.doc, from, node2.type); + if (point3 != null) + from = to = point3; + } + tr.replaceRange(from, to, new Slice(Fragment.from(node2), 0, 0)); + } + function deleteRange(tr, from, to) { + let $from = tr.doc.resolve(from), $to = tr.doc.resolve(to); + let covered = coveredDepths($from, $to); + for (let i2 = 0; i2 < covered.length; i2++) { + let depth = covered[i2], last = i2 == covered.length - 1; + if (last && depth == 0 || $from.node(depth).type.contentMatch.validEnd) + return tr.delete($from.start(depth), $to.end(depth)); + if (depth > 0 && (last || $from.node(depth - 1).canReplace($from.index(depth - 1), $to.indexAfter(depth - 1)))) + return tr.delete($from.before(depth), $to.after(depth)); + } + for (let d6 = 1; d6 <= $from.depth && d6 <= $to.depth; d6++) { + if (from - $from.start(d6) == $from.depth - d6 && to > $from.end(d6) && $to.end(d6) - to != $to.depth - d6) + return tr.delete($from.before(d6), to); + } + tr.delete(from, to); + } + function coveredDepths($from, $to) { + let result = [], minDepth = Math.min($from.depth, $to.depth); + for (let d6 = minDepth; d6 >= 0; d6--) { + let start = $from.start(d6); + if (start < $from.pos - ($from.depth - d6) || $to.end(d6) > $to.pos + ($to.depth - d6) || $from.node(d6).type.spec.isolating || $to.node(d6).type.spec.isolating) + break; + if (start == $to.start(d6) || d6 == $from.depth && d6 == $to.depth && $from.parent.inlineContent && $to.parent.inlineContent && d6 && $to.start(d6 - 1) == start - 1) + result.push(d6); + } + return result; + } + var AttrStep = class _AttrStep extends Step { + /** + Construct an attribute step. + */ + constructor(pos, attr, value) { + super(); + this.pos = pos; + this.attr = attr; + this.value = value; + } + apply(doc4) { + let node2 = doc4.nodeAt(this.pos); + if (!node2) + return StepResult.fail("No node at attribute step's position"); + let attrs = /* @__PURE__ */ Object.create(null); + for (let name in node2.attrs) + attrs[name] = node2.attrs[name]; + attrs[this.attr] = this.value; + let updated = node2.type.create(attrs, null, node2.marks); + return StepResult.fromReplace(doc4, this.pos, this.pos + 1, new Slice(Fragment.from(updated), 0, node2.isLeaf ? 0 : 1)); + } + getMap() { + return StepMap.empty; + } + invert(doc4) { + return new _AttrStep(this.pos, this.attr, doc4.nodeAt(this.pos).attrs[this.attr]); + } + map(mapping) { + let pos = mapping.mapResult(this.pos, 1); + return pos.deletedAfter ? null : new _AttrStep(pos.pos, this.attr, this.value); + } + toJSON() { + return { stepType: "attr", pos: this.pos, attr: this.attr, value: this.value }; + } + static fromJSON(schema, json) { + if (typeof json.pos != "number" || typeof json.attr != "string") + throw new RangeError("Invalid input for AttrStep.fromJSON"); + return new _AttrStep(json.pos, json.attr, json.value); + } + }; + Step.jsonID("attr", AttrStep); + var DocAttrStep = class _DocAttrStep extends Step { + /** + Construct an attribute step. + */ + constructor(attr, value) { + super(); + this.attr = attr; + this.value = value; + } + apply(doc4) { + let attrs = /* @__PURE__ */ Object.create(null); + for (let name in doc4.attrs) + attrs[name] = doc4.attrs[name]; + attrs[this.attr] = this.value; + let updated = doc4.type.create(attrs, doc4.content, doc4.marks); + return StepResult.ok(updated); + } + getMap() { + return StepMap.empty; + } + invert(doc4) { + return new _DocAttrStep(this.attr, doc4.attrs[this.attr]); + } + map(mapping) { + return this; + } + toJSON() { + return { stepType: "docAttr", attr: this.attr, value: this.value }; + } + static fromJSON(schema, json) { + if (typeof json.attr != "string") + throw new RangeError("Invalid input for DocAttrStep.fromJSON"); + return new _DocAttrStep(json.attr, json.value); + } + }; + Step.jsonID("docAttr", DocAttrStep); + var TransformError = class extends Error { + }; + TransformError = function TransformError2(message) { + let err = Error.call(this, message); + err.__proto__ = TransformError2.prototype; + return err; + }; + TransformError.prototype = Object.create(Error.prototype); + TransformError.prototype.constructor = TransformError; + TransformError.prototype.name = "TransformError"; + var Transform = class { + /** + Create a transform that starts with the given document. + */ + constructor(doc4) { + this.doc = doc4; + this.steps = []; + this.docs = []; + this.mapping = new Mapping(); + } + /** + The starting document. + */ + get before() { + return this.docs.length ? this.docs[0] : this.doc; + } + /** + Apply a new step in this transform, saving the result. Throws an + error when the step fails. + */ + step(step) { + let result = this.maybeStep(step); + if (result.failed) + throw new TransformError(result.failed); + return this; + } + /** + Try to apply a step in this transformation, ignoring it if it + fails. Returns the step result. + */ + maybeStep(step) { + let result = step.apply(this.doc); + if (!result.failed) + this.addStep(step, result.doc); + return result; + } + /** + True when the document has been changed (when there are any + steps). + */ + get docChanged() { + return this.steps.length > 0; + } + /** + @internal + */ + addStep(step, doc4) { + this.docs.push(this.doc); + this.steps.push(step); + this.mapping.appendMap(step.getMap()); + this.doc = doc4; + } + /** + Replace the part of the document between `from` and `to` with the + given `slice`. + */ + replace(from, to = from, slice = Slice.empty) { + let step = replaceStep(this.doc, from, to, slice); + if (step) + this.step(step); + return this; + } + /** + Replace the given range with the given content, which may be a + fragment, node, or array of nodes. + */ + replaceWith(from, to, content3) { + return this.replace(from, to, new Slice(Fragment.from(content3), 0, 0)); + } + /** + Delete the content between the given positions. + */ + delete(from, to) { + return this.replace(from, to, Slice.empty); + } + /** + Insert the given content at the given position. + */ + insert(pos, content3) { + return this.replaceWith(pos, pos, content3); + } + /** + Replace a range of the document with a given slice, using + `from`, `to`, and the slice's + [`openStart`](https://prosemirror.net/docs/ref/#model.Slice.openStart) property as hints, rather + than fixed start and end points. This method may grow the + replaced area or close open nodes in the slice in order to get a + fit that is more in line with WYSIWYG expectations, by dropping + fully covered parent nodes of the replaced region when they are + marked [non-defining as + context](https://prosemirror.net/docs/ref/#model.NodeSpec.definingAsContext), or including an + open parent node from the slice that _is_ marked as [defining + its content](https://prosemirror.net/docs/ref/#model.NodeSpec.definingForContent). + + This is the method, for example, to handle paste. The similar + [`replace`](https://prosemirror.net/docs/ref/#transform.Transform.replace) method is a more + primitive tool which will _not_ move the start and end of its given + range, and is useful in situations where you need more precise + control over what happens. + */ + replaceRange(from, to, slice) { + replaceRange(this, from, to, slice); + return this; + } + /** + Replace the given range with a node, but use `from` and `to` as + hints, rather than precise positions. When from and to are the same + and are at the start or end of a parent node in which the given + node doesn't fit, this method may _move_ them out towards a parent + that does allow the given node to be placed. When the given range + completely covers a parent node, this method may completely replace + that parent node. + */ + replaceRangeWith(from, to, node2) { + replaceRangeWith(this, from, to, node2); + return this; + } + /** + Delete the given range, expanding it to cover fully covered + parent nodes until a valid replace is found. + */ + deleteRange(from, to) { + deleteRange(this, from, to); + return this; + } + /** + Split the content in the given range off from its parent, if there + is sibling content before or after it, and move it up the tree to + the depth specified by `target`. You'll probably want to use + [`liftTarget`](https://prosemirror.net/docs/ref/#transform.liftTarget) to compute `target`, to make + sure the lift is valid. + */ + lift(range, target) { + lift(this, range, target); + return this; + } + /** + Join the blocks around the given position. If depth is 2, their + last and first siblings are also joined, and so on. + */ + join(pos, depth = 1) { + join3(this, pos, depth); + return this; + } + /** + Wrap the given [range](https://prosemirror.net/docs/ref/#model.NodeRange) in the given set of wrappers. + The wrappers are assumed to be valid in this position, and should + probably be computed with [`findWrapping`](https://prosemirror.net/docs/ref/#transform.findWrapping). + */ + wrap(range, wrappers) { + wrap2(this, range, wrappers); + return this; + } + /** + Set the type of all textblocks (partly) between `from` and `to` to + the given node type with the given attributes. + */ + setBlockType(from, to = from, type, attrs = null) { + setBlockType(this, from, to, type, attrs); + return this; + } + /** + Change the type, attributes, and/or marks of the node at `pos`. + When `type` isn't given, the existing node type is preserved, + */ + setNodeMarkup(pos, type, attrs = null, marks) { + setNodeMarkup(this, pos, type, attrs, marks); + return this; + } + /** + Set a single attribute on a given node to a new value. + The `pos` addresses the document content. Use `setDocAttribute` + to set attributes on the document itself. + */ + setNodeAttribute(pos, attr, value) { + this.step(new AttrStep(pos, attr, value)); + return this; + } + /** + Set a single attribute on the document to a new value. + */ + setDocAttribute(attr, value) { + this.step(new DocAttrStep(attr, value)); + return this; + } + /** + Add a mark to the node at position `pos`. + */ + addNodeMark(pos, mark) { + this.step(new AddNodeMarkStep(pos, mark)); + return this; + } + /** + Remove a mark (or a mark of the given type) from the node at + position `pos`. + */ + removeNodeMark(pos, mark) { + if (!(mark instanceof Mark)) { + let node2 = this.doc.nodeAt(pos); + if (!node2) + throw new RangeError("No node at position " + pos); + mark = mark.isInSet(node2.marks); + if (!mark) + return this; + } + this.step(new RemoveNodeMarkStep(pos, mark)); + return this; + } + /** + Split the node at the given position, and optionally, if `depth` is + greater than one, any number of nodes above that. By default, the + parts split off will inherit the node type of the original node. + This can be changed by passing an array of types and attributes to + use after the split. + */ + split(pos, depth = 1, typesAfter) { + split(this, pos, depth, typesAfter); + return this; + } + /** + Add the given mark to the inline content between `from` and `to`. + */ + addMark(from, to, mark) { + addMark(this, from, to, mark); + return this; + } + /** + Remove marks from inline nodes between `from` and `to`. When + `mark` is a single mark, remove precisely that mark. When it is + a mark type, remove all marks of that type. When it is null, + remove all marks of any type. + */ + removeMark(from, to, mark) { + removeMark(this, from, to, mark); + return this; + } + /** + Removes all marks and nodes from the content of the node at + `pos` that don't match the given new parent node type. Accepts + an optional starting [content match](https://prosemirror.net/docs/ref/#model.ContentMatch) as + third argument. + */ + clearIncompatible(pos, parentType, match) { + clearIncompatible(this, pos, parentType, match); + return this; + } + }; + + // node_modules/prosemirror-state/dist/index.js + var classesById = /* @__PURE__ */ Object.create(null); + var Selection = class { + /** + Initialize a selection with the head and anchor and ranges. If no + ranges are given, constructs a single range across `$anchor` and + `$head`. + */ + constructor($anchor, $head, ranges) { + this.$anchor = $anchor; + this.$head = $head; + this.ranges = ranges || [new SelectionRange($anchor.min($head), $anchor.max($head))]; + } + /** + The selection's anchor, as an unresolved position. + */ + get anchor() { + return this.$anchor.pos; + } + /** + The selection's head. + */ + get head() { + return this.$head.pos; + } + /** + The lower bound of the selection's main range. + */ + get from() { + return this.$from.pos; + } + /** + The upper bound of the selection's main range. + */ + get to() { + return this.$to.pos; + } + /** + The resolved lower bound of the selection's main range. + */ + get $from() { + return this.ranges[0].$from; + } + /** + The resolved upper bound of the selection's main range. + */ + get $to() { + return this.ranges[0].$to; + } + /** + Indicates whether the selection contains any content. + */ + get empty() { + let ranges = this.ranges; + for (let i2 = 0; i2 < ranges.length; i2++) + if (ranges[i2].$from.pos != ranges[i2].$to.pos) + return false; + return true; + } + /** + Get the content of this selection as a slice. + */ + content() { + return this.$from.doc.slice(this.from, this.to, true); + } + /** + Replace the selection with a slice or, if no slice is given, + delete the selection. Will append to the given transaction. + */ + replace(tr, content3 = Slice.empty) { + let lastNode = content3.content.lastChild, lastParent = null; + for (let i2 = 0; i2 < content3.openEnd; i2++) { + lastParent = lastNode; + lastNode = lastNode.lastChild; + } + let mapFrom = tr.steps.length, ranges = this.ranges; + for (let i2 = 0; i2 < ranges.length; i2++) { + let { $from, $to } = ranges[i2], mapping = tr.mapping.slice(mapFrom); + tr.replaceRange(mapping.map($from.pos), mapping.map($to.pos), i2 ? Slice.empty : content3); + if (i2 == 0) + selectionToInsertionEnd(tr, mapFrom, (lastNode ? lastNode.isInline : lastParent && lastParent.isTextblock) ? -1 : 1); + } + } + /** + Replace the selection with the given node, appending the changes + to the given transaction. + */ + replaceWith(tr, node2) { + let mapFrom = tr.steps.length, ranges = this.ranges; + for (let i2 = 0; i2 < ranges.length; i2++) { + let { $from, $to } = ranges[i2], mapping = tr.mapping.slice(mapFrom); + let from = mapping.map($from.pos), to = mapping.map($to.pos); + if (i2) { + tr.deleteRange(from, to); + } else { + tr.replaceRangeWith(from, to, node2); + selectionToInsertionEnd(tr, mapFrom, node2.isInline ? -1 : 1); + } + } + } + /** + Find a valid cursor or leaf node selection starting at the given + position and searching back if `dir` is negative, and forward if + positive. When `textOnly` is true, only consider cursor + selections. Will return null when no valid selection position is + found. + */ + static findFrom($pos, dir, textOnly = false) { + let inner = $pos.parent.inlineContent ? new TextSelection($pos) : findSelectionIn($pos.node(0), $pos.parent, $pos.pos, $pos.index(), dir, textOnly); + if (inner) + return inner; + for (let depth = $pos.depth - 1; depth >= 0; depth--) { + let found2 = dir < 0 ? findSelectionIn($pos.node(0), $pos.node(depth), $pos.before(depth + 1), $pos.index(depth), dir, textOnly) : findSelectionIn($pos.node(0), $pos.node(depth), $pos.after(depth + 1), $pos.index(depth) + 1, dir, textOnly); + if (found2) + return found2; + } + return null; + } + /** + Find a valid cursor or leaf node selection near the given + position. Searches forward first by default, but if `bias` is + negative, it will search backwards first. + */ + static near($pos, bias = 1) { + return this.findFrom($pos, bias) || this.findFrom($pos, -bias) || new AllSelection($pos.node(0)); + } + /** + Find the cursor or leaf node selection closest to the start of + the given document. Will return an + [`AllSelection`](https://prosemirror.net/docs/ref/#state.AllSelection) if no valid position + exists. + */ + static atStart(doc4) { + return findSelectionIn(doc4, doc4, 0, 0, 1) || new AllSelection(doc4); + } + /** + Find the cursor or leaf node selection closest to the end of the + given document. + */ + static atEnd(doc4) { + return findSelectionIn(doc4, doc4, doc4.content.size, doc4.childCount, -1) || new AllSelection(doc4); + } + /** + Deserialize the JSON representation of a selection. Must be + implemented for custom classes (as a static class method). + */ + static fromJSON(doc4, json) { + if (!json || !json.type) + throw new RangeError("Invalid input for Selection.fromJSON"); + let cls = classesById[json.type]; + if (!cls) + throw new RangeError(`No selection type ${json.type} defined`); + return cls.fromJSON(doc4, json); + } + /** + To be able to deserialize selections from JSON, custom selection + classes must register themselves with an ID string, so that they + can be disambiguated. Try to pick something that's unlikely to + clash with classes from other modules. + */ + static jsonID(id, selectionClass) { + if (id in classesById) + throw new RangeError("Duplicate use of selection JSON ID " + id); + classesById[id] = selectionClass; + selectionClass.prototype.jsonID = id; + return selectionClass; + } + /** + Get a [bookmark](https://prosemirror.net/docs/ref/#state.SelectionBookmark) for this selection, + which is a value that can be mapped without having access to a + current document, and later resolved to a real selection for a + given document again. (This is used mostly by the history to + track and restore old selections.) The default implementation of + this method just converts the selection to a text selection and + returns the bookmark for that. + */ + getBookmark() { + return TextSelection.between(this.$anchor, this.$head).getBookmark(); + } + }; + Selection.prototype.visible = true; + var SelectionRange = class { + /** + Create a range. + */ + constructor($from, $to) { + this.$from = $from; + this.$to = $to; + } + }; + var warnedAboutTextSelection = false; + function checkTextSelection($pos) { + if (!warnedAboutTextSelection && !$pos.parent.inlineContent) { + warnedAboutTextSelection = true; + console["warn"]("TextSelection endpoint not pointing into a node with inline content (" + $pos.parent.type.name + ")"); + } + } + var TextSelection = class _TextSelection extends Selection { + /** + Construct a text selection between the given points. + */ + constructor($anchor, $head = $anchor) { + checkTextSelection($anchor); + checkTextSelection($head); + super($anchor, $head); + } + /** + Returns a resolved position if this is a cursor selection (an + empty text selection), and null otherwise. + */ + get $cursor() { + return this.$anchor.pos == this.$head.pos ? this.$head : null; + } + map(doc4, mapping) { + let $head = doc4.resolve(mapping.map(this.head)); + if (!$head.parent.inlineContent) + return Selection.near($head); + let $anchor = doc4.resolve(mapping.map(this.anchor)); + return new _TextSelection($anchor.parent.inlineContent ? $anchor : $head, $head); + } + replace(tr, content3 = Slice.empty) { + super.replace(tr, content3); + if (content3 == Slice.empty) { + let marks = this.$from.marksAcross(this.$to); + if (marks) + tr.ensureMarks(marks); + } + } + eq(other) { + return other instanceof _TextSelection && other.anchor == this.anchor && other.head == this.head; + } + getBookmark() { + return new TextBookmark(this.anchor, this.head); + } + toJSON() { + return { type: "text", anchor: this.anchor, head: this.head }; + } + /** + @internal + */ + static fromJSON(doc4, json) { + if (typeof json.anchor != "number" || typeof json.head != "number") + throw new RangeError("Invalid input for TextSelection.fromJSON"); + return new _TextSelection(doc4.resolve(json.anchor), doc4.resolve(json.head)); + } + /** + Create a text selection from non-resolved positions. + */ + static create(doc4, anchor, head = anchor) { + let $anchor = doc4.resolve(anchor); + return new this($anchor, head == anchor ? $anchor : doc4.resolve(head)); + } + /** + Return a text selection that spans the given positions or, if + they aren't text positions, find a text selection near them. + `bias` determines whether the method searches forward (default) + or backwards (negative number) first. Will fall back to calling + [`Selection.near`](https://prosemirror.net/docs/ref/#state.Selection^near) when the document + doesn't contain a valid text position. + */ + static between($anchor, $head, bias) { + let dPos = $anchor.pos - $head.pos; + if (!bias || dPos) + bias = dPos >= 0 ? 1 : -1; + if (!$head.parent.inlineContent) { + let found2 = Selection.findFrom($head, bias, true) || Selection.findFrom($head, -bias, true); + if (found2) + $head = found2.$head; + else + return Selection.near($head, bias); + } + if (!$anchor.parent.inlineContent) { + if (dPos == 0) { + $anchor = $head; + } else { + $anchor = (Selection.findFrom($anchor, -bias, true) || Selection.findFrom($anchor, bias, true)).$anchor; + if ($anchor.pos < $head.pos != dPos < 0) + $anchor = $head; + } + } + return new _TextSelection($anchor, $head); + } + }; + Selection.jsonID("text", TextSelection); + var TextBookmark = class _TextBookmark { + constructor(anchor, head) { + this.anchor = anchor; + this.head = head; + } + map(mapping) { + return new _TextBookmark(mapping.map(this.anchor), mapping.map(this.head)); + } + resolve(doc4) { + return TextSelection.between(doc4.resolve(this.anchor), doc4.resolve(this.head)); + } + }; + var NodeSelection = class _NodeSelection extends Selection { + /** + Create a node selection. Does not verify the validity of its + argument. + */ + constructor($pos) { + let node2 = $pos.nodeAfter; + let $end = $pos.node(0).resolve($pos.pos + node2.nodeSize); + super($pos, $end); + this.node = node2; + } + map(doc4, mapping) { + let { deleted, pos } = mapping.mapResult(this.anchor); + let $pos = doc4.resolve(pos); + if (deleted) + return Selection.near($pos); + return new _NodeSelection($pos); + } + content() { + return new Slice(Fragment.from(this.node), 0, 0); + } + eq(other) { + return other instanceof _NodeSelection && other.anchor == this.anchor; + } + toJSON() { + return { type: "node", anchor: this.anchor }; + } + getBookmark() { + return new NodeBookmark(this.anchor); + } + /** + @internal + */ + static fromJSON(doc4, json) { + if (typeof json.anchor != "number") + throw new RangeError("Invalid input for NodeSelection.fromJSON"); + return new _NodeSelection(doc4.resolve(json.anchor)); + } + /** + Create a node selection from non-resolved positions. + */ + static create(doc4, from) { + return new _NodeSelection(doc4.resolve(from)); + } + /** + Determines whether the given node may be selected as a node + selection. + */ + static isSelectable(node2) { + return !node2.isText && node2.type.spec.selectable !== false; + } + }; + NodeSelection.prototype.visible = false; + Selection.jsonID("node", NodeSelection); + var NodeBookmark = class _NodeBookmark { + constructor(anchor) { + this.anchor = anchor; + } + map(mapping) { + let { deleted, pos } = mapping.mapResult(this.anchor); + return deleted ? new TextBookmark(pos, pos) : new _NodeBookmark(pos); + } + resolve(doc4) { + let $pos = doc4.resolve(this.anchor), node2 = $pos.nodeAfter; + if (node2 && NodeSelection.isSelectable(node2)) + return new NodeSelection($pos); + return Selection.near($pos); + } + }; + var AllSelection = class _AllSelection extends Selection { + /** + Create an all-selection over the given document. + */ + constructor(doc4) { + super(doc4.resolve(0), doc4.resolve(doc4.content.size)); + } + replace(tr, content3 = Slice.empty) { + if (content3 == Slice.empty) { + tr.delete(0, tr.doc.content.size); + let sel = Selection.atStart(tr.doc); + if (!sel.eq(tr.selection)) + tr.setSelection(sel); + } else { + super.replace(tr, content3); + } + } + toJSON() { + return { type: "all" }; + } + /** + @internal + */ + static fromJSON(doc4) { + return new _AllSelection(doc4); + } + map(doc4) { + return new _AllSelection(doc4); + } + eq(other) { + return other instanceof _AllSelection; + } + getBookmark() { + return AllBookmark; + } + }; + Selection.jsonID("all", AllSelection); + var AllBookmark = { + map() { + return this; + }, + resolve(doc4) { + return new AllSelection(doc4); + } + }; + function findSelectionIn(doc4, node2, pos, index2, dir, text5 = false) { + if (node2.inlineContent) + return TextSelection.create(doc4, pos); + for (let i2 = index2 - (dir > 0 ? 0 : 1); dir > 0 ? i2 < node2.childCount : i2 >= 0; i2 += dir) { + let child = node2.child(i2); + if (!child.isAtom) { + let inner = findSelectionIn(doc4, child, pos + dir, dir < 0 ? child.childCount : 0, dir, text5); + if (inner) + return inner; + } else if (!text5 && NodeSelection.isSelectable(child)) { + return NodeSelection.create(doc4, pos - (dir < 0 ? child.nodeSize : 0)); + } + pos += child.nodeSize * dir; + } + return null; + } + function selectionToInsertionEnd(tr, startLen, bias) { + let last = tr.steps.length - 1; + if (last < startLen) + return; + let step = tr.steps[last]; + if (!(step instanceof ReplaceStep || step instanceof ReplaceAroundStep)) + return; + let map5 = tr.mapping.maps[last], end; + map5.forEach((_from, _to, _newFrom, newTo) => { + if (end == null) + end = newTo; + }); + tr.setSelection(Selection.near(tr.doc.resolve(end), bias)); + } + var UPDATED_SEL = 1; + var UPDATED_MARKS = 2; + var UPDATED_SCROLL = 4; + var Transaction = class extends Transform { + /** + @internal + */ + constructor(state) { + super(state.doc); + this.curSelectionFor = 0; + this.updated = 0; + this.meta = /* @__PURE__ */ Object.create(null); + this.time = Date.now(); + this.curSelection = state.selection; + this.storedMarks = state.storedMarks; + } + /** + The transaction's current selection. This defaults to the editor + selection [mapped](https://prosemirror.net/docs/ref/#state.Selection.map) through the steps in the + transaction, but can be overwritten with + [`setSelection`](https://prosemirror.net/docs/ref/#state.Transaction.setSelection). + */ + get selection() { + if (this.curSelectionFor < this.steps.length) { + this.curSelection = this.curSelection.map(this.doc, this.mapping.slice(this.curSelectionFor)); + this.curSelectionFor = this.steps.length; + } + return this.curSelection; + } + /** + Update the transaction's current selection. Will determine the + selection that the editor gets when the transaction is applied. + */ + setSelection(selection) { + if (selection.$from.doc != this.doc) + throw new RangeError("Selection passed to setSelection must point at the current document"); + this.curSelection = selection; + this.curSelectionFor = this.steps.length; + this.updated = (this.updated | UPDATED_SEL) & ~UPDATED_MARKS; + this.storedMarks = null; + return this; + } + /** + Whether the selection was explicitly updated by this transaction. + */ + get selectionSet() { + return (this.updated & UPDATED_SEL) > 0; + } + /** + Set the current stored marks. + */ + setStoredMarks(marks) { + this.storedMarks = marks; + this.updated |= UPDATED_MARKS; + return this; + } + /** + Make sure the current stored marks or, if that is null, the marks + at the selection, match the given set of marks. Does nothing if + this is already the case. + */ + ensureMarks(marks) { + if (!Mark.sameSet(this.storedMarks || this.selection.$from.marks(), marks)) + this.setStoredMarks(marks); + return this; + } + /** + Add a mark to the set of stored marks. + */ + addStoredMark(mark) { + return this.ensureMarks(mark.addToSet(this.storedMarks || this.selection.$head.marks())); + } + /** + Remove a mark or mark type from the set of stored marks. + */ + removeStoredMark(mark) { + return this.ensureMarks(mark.removeFromSet(this.storedMarks || this.selection.$head.marks())); + } + /** + Whether the stored marks were explicitly set for this transaction. + */ + get storedMarksSet() { + return (this.updated & UPDATED_MARKS) > 0; + } + /** + @internal + */ + addStep(step, doc4) { + super.addStep(step, doc4); + this.updated = this.updated & ~UPDATED_MARKS; + this.storedMarks = null; + } + /** + Update the timestamp for the transaction. + */ + setTime(time) { + this.time = time; + return this; + } + /** + Replace the current selection with the given slice. + */ + replaceSelection(slice) { + this.selection.replace(this, slice); + return this; + } + /** + Replace the selection with the given node. When `inheritMarks` is + true and the content is inline, it inherits the marks from the + place where it is inserted. + */ + replaceSelectionWith(node2, inheritMarks = true) { + let selection = this.selection; + if (inheritMarks) + node2 = node2.mark(this.storedMarks || (selection.empty ? selection.$from.marks() : selection.$from.marksAcross(selection.$to) || Mark.none)); + selection.replaceWith(this, node2); + return this; + } + /** + Delete the selection. + */ + deleteSelection() { + this.selection.replace(this); + return this; + } + /** + Replace the given range, or the selection if no range is given, + with a text node containing the given string. + */ + insertText(text5, from, to) { + let schema = this.doc.type.schema; + if (from == null) { + if (!text5) + return this.deleteSelection(); + return this.replaceSelectionWith(schema.text(text5), true); + } else { + if (to == null) + to = from; + to = to == null ? from : to; + if (!text5) + return this.deleteRange(from, to); + let marks = this.storedMarks; + if (!marks) { + let $from = this.doc.resolve(from); + marks = to == from ? $from.marks() : $from.marksAcross(this.doc.resolve(to)); + } + this.replaceRangeWith(from, to, schema.text(text5, marks)); + if (!this.selection.empty) + this.setSelection(Selection.near(this.selection.$to)); + return this; + } + } + /** + Store a metadata property in this transaction, keyed either by + name or by plugin. + */ + setMeta(key, value) { + this.meta[typeof key == "string" ? key : key.key] = value; + return this; + } + /** + Retrieve a metadata property for a given name or plugin. + */ + getMeta(key) { + return this.meta[typeof key == "string" ? key : key.key]; + } + /** + Returns true if this transaction doesn't contain any metadata, + and can thus safely be extended. + */ + get isGeneric() { + for (let _3 in this.meta) + return false; + return true; + } + /** + Indicate that the editor should scroll the selection into view + when updated to the state produced by this transaction. + */ + scrollIntoView() { + this.updated |= UPDATED_SCROLL; + return this; + } + /** + True when this transaction has had `scrollIntoView` called on it. + */ + get scrolledIntoView() { + return (this.updated & UPDATED_SCROLL) > 0; + } + }; + function bind(f3, self2) { + return !self2 || !f3 ? f3 : f3.bind(self2); + } + var FieldDesc = class { + constructor(name, desc, self2) { + this.name = name; + this.init = bind(desc.init, self2); + this.apply = bind(desc.apply, self2); + } + }; + var baseFields = [ + new FieldDesc("doc", { + init(config) { + return config.doc || config.schema.topNodeType.createAndFill(); + }, + apply(tr) { + return tr.doc; + } + }), + new FieldDesc("selection", { + init(config, instance) { + return config.selection || Selection.atStart(instance.doc); + }, + apply(tr) { + return tr.selection; + } + }), + new FieldDesc("storedMarks", { + init(config) { + return config.storedMarks || null; + }, + apply(tr, _marks, _old, state) { + return state.selection.$cursor ? tr.storedMarks : null; + } + }), + new FieldDesc("scrollToSelection", { + init() { + return 0; + }, + apply(tr, prev) { + return tr.scrolledIntoView ? prev + 1 : prev; + } + }) + ]; + var Configuration = class { + constructor(schema, plugins) { + this.schema = schema; + this.plugins = []; + this.pluginsByKey = /* @__PURE__ */ Object.create(null); + this.fields = baseFields.slice(); + if (plugins) + plugins.forEach((plugin) => { + if (this.pluginsByKey[plugin.key]) + throw new RangeError("Adding different instances of a keyed plugin (" + plugin.key + ")"); + this.plugins.push(plugin); + this.pluginsByKey[plugin.key] = plugin; + if (plugin.spec.state) + this.fields.push(new FieldDesc(plugin.key, plugin.spec.state, plugin)); + }); + } + }; + var EditorState = class _EditorState { + /** + @internal + */ + constructor(config) { + this.config = config; + } + /** + The schema of the state's document. + */ + get schema() { + return this.config.schema; + } + /** + The plugins that are active in this state. + */ + get plugins() { + return this.config.plugins; + } + /** + Apply the given transaction to produce a new state. + */ + apply(tr) { + return this.applyTransaction(tr).state; + } + /** + @internal + */ + filterTransaction(tr, ignore = -1) { + for (let i2 = 0; i2 < this.config.plugins.length; i2++) + if (i2 != ignore) { + let plugin = this.config.plugins[i2]; + if (plugin.spec.filterTransaction && !plugin.spec.filterTransaction.call(plugin, tr, this)) + return false; + } + return true; + } + /** + Verbose variant of [`apply`](https://prosemirror.net/docs/ref/#state.EditorState.apply) that + returns the precise transactions that were applied (which might + be influenced by the [transaction + hooks](https://prosemirror.net/docs/ref/#state.PluginSpec.filterTransaction) of + plugins) along with the new state. + */ + applyTransaction(rootTr) { + if (!this.filterTransaction(rootTr)) + return { state: this, transactions: [] }; + let trs = [rootTr], newState = this.applyInner(rootTr), seen = null; + for (; ; ) { + let haveNew = false; + for (let i2 = 0; i2 < this.config.plugins.length; i2++) { + let plugin = this.config.plugins[i2]; + if (plugin.spec.appendTransaction) { + let n4 = seen ? seen[i2].n : 0, oldState = seen ? seen[i2].state : this; + let tr = n4 < trs.length && plugin.spec.appendTransaction.call(plugin, n4 ? trs.slice(n4) : trs, oldState, newState); + if (tr && newState.filterTransaction(tr, i2)) { + tr.setMeta("appendedTransaction", rootTr); + if (!seen) { + seen = []; + for (let j6 = 0; j6 < this.config.plugins.length; j6++) + seen.push(j6 < i2 ? { state: newState, n: trs.length } : { state: this, n: 0 }); + } + trs.push(tr); + newState = newState.applyInner(tr); + haveNew = true; + } + if (seen) + seen[i2] = { state: newState, n: trs.length }; + } + } + if (!haveNew) + return { state: newState, transactions: trs }; + } + } + /** + @internal + */ + applyInner(tr) { + if (!tr.before.eq(this.doc)) + throw new RangeError("Applying a mismatched transaction"); + let newInstance = new _EditorState(this.config), fields = this.config.fields; + for (let i2 = 0; i2 < fields.length; i2++) { + let field = fields[i2]; + newInstance[field.name] = field.apply(tr, this[field.name], this, newInstance); + } + return newInstance; + } + /** + Start a [transaction](https://prosemirror.net/docs/ref/#state.Transaction) from this state. + */ + get tr() { + return new Transaction(this); + } + /** + Create a new state. + */ + static create(config) { + let $config = new Configuration(config.doc ? config.doc.type.schema : config.schema, config.plugins); + let instance = new _EditorState($config); + for (let i2 = 0; i2 < $config.fields.length; i2++) + instance[$config.fields[i2].name] = $config.fields[i2].init(config, instance); + return instance; + } + /** + Create a new state based on this one, but with an adjusted set + of active plugins. State fields that exist in both sets of + plugins are kept unchanged. Those that no longer exist are + dropped, and those that are new are initialized using their + [`init`](https://prosemirror.net/docs/ref/#state.StateField.init) method, passing in the new + configuration object.. + */ + reconfigure(config) { + let $config = new Configuration(this.schema, config.plugins); + let fields = $config.fields, instance = new _EditorState($config); + for (let i2 = 0; i2 < fields.length; i2++) { + let name = fields[i2].name; + instance[name] = this.hasOwnProperty(name) ? this[name] : fields[i2].init(config, instance); + } + return instance; + } + /** + Serialize this state to JSON. If you want to serialize the state + of plugins, pass an object mapping property names to use in the + resulting JSON object to plugin objects. The argument may also be + a string or number, in which case it is ignored, to support the + way `JSON.stringify` calls `toString` methods. + */ + toJSON(pluginFields) { + let result = { doc: this.doc.toJSON(), selection: this.selection.toJSON() }; + if (this.storedMarks) + result.storedMarks = this.storedMarks.map((m3) => m3.toJSON()); + if (pluginFields && typeof pluginFields == "object") + for (let prop in pluginFields) { + if (prop == "doc" || prop == "selection") + throw new RangeError("The JSON fields `doc` and `selection` are reserved"); + let plugin = pluginFields[prop], state = plugin.spec.state; + if (state && state.toJSON) + result[prop] = state.toJSON.call(plugin, this[plugin.key]); + } + return result; + } + /** + Deserialize a JSON representation of a state. `config` should + have at least a `schema` field, and should contain array of + plugins to initialize the state with. `pluginFields` can be used + to deserialize the state of plugins, by associating plugin + instances with the property names they use in the JSON object. + */ + static fromJSON(config, json, pluginFields) { + if (!json) + throw new RangeError("Invalid input for EditorState.fromJSON"); + if (!config.schema) + throw new RangeError("Required config field 'schema' missing"); + let $config = new Configuration(config.schema, config.plugins); + let instance = new _EditorState($config); + $config.fields.forEach((field) => { + if (field.name == "doc") { + instance.doc = Node2.fromJSON(config.schema, json.doc); + } else if (field.name == "selection") { + instance.selection = Selection.fromJSON(instance.doc, json.selection); + } else if (field.name == "storedMarks") { + if (json.storedMarks) + instance.storedMarks = json.storedMarks.map(config.schema.markFromJSON); + } else { + if (pluginFields) + for (let prop in pluginFields) { + let plugin = pluginFields[prop], state = plugin.spec.state; + if (plugin.key == field.name && state && state.fromJSON && Object.prototype.hasOwnProperty.call(json, prop)) { + instance[field.name] = state.fromJSON.call(plugin, config, json[prop], instance); + return; + } + } + instance[field.name] = field.init(config, instance); + } + }); + return instance; + } + }; + function bindProps(obj, self2, target) { + for (let prop in obj) { + let val = obj[prop]; + if (val instanceof Function) + val = val.bind(self2); + else if (prop == "handleDOMEvents") + val = bindProps(val, self2, {}); + target[prop] = val; + } + return target; + } + var Plugin = class { + /** + Create a plugin. + */ + constructor(spec) { + this.spec = spec; + this.props = {}; + if (spec.props) + bindProps(spec.props, this, this.props); + this.key = spec.key ? spec.key.key : createKey("plugin"); + } + /** + Extract the plugin's state field from an editor state. + */ + getState(state) { + return state[this.key]; + } + }; + var keys = /* @__PURE__ */ Object.create(null); + function createKey(name) { + if (name in keys) + return name + "$" + ++keys[name]; + keys[name] = 0; + return name + "$"; + } + var PluginKey = class { + /** + Create a plugin key. + */ + constructor(name = "key") { + this.key = createKey(name); + } + /** + Get the active plugin with this key, if any, from an editor + state. + */ + get(state) { + return state.config.pluginsByKey[this.key]; + } + /** + Get the plugin's state from an editor state. + */ + getState(state) { + return state[this.key]; + } + }; + + // node_modules/prosemirror-view/dist/index.js + var domIndex = function(node2) { + for (var index2 = 0; ; index2++) { + node2 = node2.previousSibling; + if (!node2) + return index2; + } + }; + var parentNode = function(node2) { + let parent = node2.assignedSlot || node2.parentNode; + return parent && parent.nodeType == 11 ? parent.host : parent; + }; + var reusedRange = null; + var textRange = function(node2, from, to) { + let range = reusedRange || (reusedRange = document.createRange()); + range.setEnd(node2, to == null ? node2.nodeValue.length : to); + range.setStart(node2, from || 0); + return range; + }; + var clearReusedRange = function() { + reusedRange = null; + }; + var isEquivalentPosition = function(node2, off, targetNode, targetOff) { + return targetNode && (scanFor(node2, off, targetNode, targetOff, -1) || scanFor(node2, off, targetNode, targetOff, 1)); + }; + var atomElements = /^(img|br|input|textarea|hr)$/i; + function scanFor(node2, off, targetNode, targetOff, dir) { + for (; ; ) { + if (node2 == targetNode && off == targetOff) + return true; + if (off == (dir < 0 ? 0 : nodeSize(node2))) { + let parent = node2.parentNode; + if (!parent || parent.nodeType != 1 || hasBlockDesc(node2) || atomElements.test(node2.nodeName) || node2.contentEditable == "false") + return false; + off = domIndex(node2) + (dir < 0 ? 0 : 1); + node2 = parent; + } else if (node2.nodeType == 1) { + node2 = node2.childNodes[off + (dir < 0 ? -1 : 0)]; + if (node2.contentEditable == "false") + return false; + off = dir < 0 ? nodeSize(node2) : 0; + } else { + return false; + } + } + } + function nodeSize(node2) { + return node2.nodeType == 3 ? node2.nodeValue.length : node2.childNodes.length; + } + function textNodeBefore$1(node2, offset) { + for (; ; ) { + if (node2.nodeType == 3 && offset) + return node2; + if (node2.nodeType == 1 && offset > 0) { + if (node2.contentEditable == "false") + return null; + node2 = node2.childNodes[offset - 1]; + offset = nodeSize(node2); + } else if (node2.parentNode && !hasBlockDesc(node2)) { + offset = domIndex(node2); + node2 = node2.parentNode; + } else { + return null; + } + } + } + function textNodeAfter$1(node2, offset) { + for (; ; ) { + if (node2.nodeType == 3 && offset < node2.nodeValue.length) + return node2; + if (node2.nodeType == 1 && offset < node2.childNodes.length) { + if (node2.contentEditable == "false") + return null; + node2 = node2.childNodes[offset]; + offset = 0; + } else if (node2.parentNode && !hasBlockDesc(node2)) { + offset = domIndex(node2) + 1; + node2 = node2.parentNode; + } else { + return null; + } + } + } + function isOnEdge(node2, offset, parent) { + for (let atStart = offset == 0, atEnd = offset == nodeSize(node2); atStart || atEnd; ) { + if (node2 == parent) + return true; + let index2 = domIndex(node2); + node2 = node2.parentNode; + if (!node2) + return false; + atStart = atStart && index2 == 0; + atEnd = atEnd && index2 == nodeSize(node2); + } + } + function hasBlockDesc(dom) { + let desc; + for (let cur = dom; cur; cur = cur.parentNode) + if (desc = cur.pmViewDesc) + break; + return desc && desc.node && desc.node.isBlock && (desc.dom == dom || desc.contentDOM == dom); + } + var selectionCollapsed = function(domSel) { + return domSel.focusNode && isEquivalentPosition(domSel.focusNode, domSel.focusOffset, domSel.anchorNode, domSel.anchorOffset); + }; + function keyEvent(keyCode, key) { + let event = document.createEvent("Event"); + event.initEvent("keydown", true, true); + event.keyCode = keyCode; + event.key = event.code = key; + return event; + } + function deepActiveElement(doc4) { + let elt = doc4.activeElement; + while (elt && elt.shadowRoot) + elt = elt.shadowRoot.activeElement; + return elt; + } + function caretFromPoint(doc4, x6, y4) { + if (doc4.caretPositionFromPoint) { + try { + let pos = doc4.caretPositionFromPoint(x6, y4); + if (pos) + return { node: pos.offsetNode, offset: pos.offset }; + } catch (_3) { + } + } + if (doc4.caretRangeFromPoint) { + let range = doc4.caretRangeFromPoint(x6, y4); + if (range) + return { node: range.startContainer, offset: range.startOffset }; + } + } + var nav = typeof navigator != "undefined" ? navigator : null; + var doc2 = typeof document != "undefined" ? document : null; + var agent = nav && nav.userAgent || ""; + var ie_edge = /Edge\/(\d+)/.exec(agent); + var ie_upto10 = /MSIE \d/.exec(agent); + var ie_11up = /Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(agent); + var ie = !!(ie_upto10 || ie_11up || ie_edge); + var ie_version = ie_upto10 ? document.documentMode : ie_11up ? +ie_11up[1] : ie_edge ? +ie_edge[1] : 0; + var gecko = !ie && /gecko\/(\d+)/i.test(agent); + gecko && +(/Firefox\/(\d+)/.exec(agent) || [0, 0])[1]; + var _chrome = !ie && /Chrome\/(\d+)/.exec(agent); + var chrome = !!_chrome; + var chrome_version = _chrome ? +_chrome[1] : 0; + var safari = !ie && !!nav && /Apple Computer/.test(nav.vendor); + var ios = safari && (/Mobile\/\w+/.test(agent) || !!nav && nav.maxTouchPoints > 2); + var mac = ios || (nav ? /Mac/.test(nav.platform) : false); + var windows = nav ? /Win/.test(nav.platform) : false; + var android = /Android \d/.test(agent); + var webkit = !!doc2 && "webkitFontSmoothing" in doc2.documentElement.style; + var webkit_version = webkit ? +(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent) || [0, 0])[1] : 0; + function windowRect(doc4) { + let vp = doc4.defaultView && doc4.defaultView.visualViewport; + if (vp) + return { + left: 0, + right: vp.width, + top: 0, + bottom: vp.height + }; + return { + left: 0, + right: doc4.documentElement.clientWidth, + top: 0, + bottom: doc4.documentElement.clientHeight + }; + } + function getSide(value, side) { + return typeof value == "number" ? value : value[side]; + } + function clientRect(node2) { + let rect = node2.getBoundingClientRect(); + let scaleX = rect.width / node2.offsetWidth || 1; + let scaleY = rect.height / node2.offsetHeight || 1; + return { + left: rect.left, + right: rect.left + node2.clientWidth * scaleX, + top: rect.top, + bottom: rect.top + node2.clientHeight * scaleY + }; + } + function scrollRectIntoView(view, rect, startDOM) { + let scrollThreshold = view.someProp("scrollThreshold") || 0, scrollMargin = view.someProp("scrollMargin") || 5; + let doc4 = view.dom.ownerDocument; + for (let parent = startDOM || view.dom; ; parent = parentNode(parent)) { + if (!parent) + break; + if (parent.nodeType != 1) + continue; + let elt = parent; + let atTop = elt == doc4.body; + let bounding = atTop ? windowRect(doc4) : clientRect(elt); + let moveX = 0, moveY = 0; + if (rect.top < bounding.top + getSide(scrollThreshold, "top")) + moveY = -(bounding.top - rect.top + getSide(scrollMargin, "top")); + else if (rect.bottom > bounding.bottom - getSide(scrollThreshold, "bottom")) + moveY = rect.bottom - rect.top > bounding.bottom - bounding.top ? rect.top + getSide(scrollMargin, "top") - bounding.top : rect.bottom - bounding.bottom + getSide(scrollMargin, "bottom"); + if (rect.left < bounding.left + getSide(scrollThreshold, "left")) + moveX = -(bounding.left - rect.left + getSide(scrollMargin, "left")); + else if (rect.right > bounding.right - getSide(scrollThreshold, "right")) + moveX = rect.right - bounding.right + getSide(scrollMargin, "right"); + if (moveX || moveY) { + if (atTop) { + doc4.defaultView.scrollBy(moveX, moveY); + } else { + let startX = elt.scrollLeft, startY = elt.scrollTop; + if (moveY) + elt.scrollTop += moveY; + if (moveX) + elt.scrollLeft += moveX; + let dX = elt.scrollLeft - startX, dY = elt.scrollTop - startY; + rect = { left: rect.left - dX, top: rect.top - dY, right: rect.right - dX, bottom: rect.bottom - dY }; + } + } + if (atTop || /^(fixed|sticky)$/.test(getComputedStyle(parent).position)) + break; + } + } + function storeScrollPos(view) { + let rect = view.dom.getBoundingClientRect(), startY = Math.max(0, rect.top); + let refDOM, refTop; + for (let x6 = (rect.left + rect.right) / 2, y4 = startY + 1; y4 < Math.min(innerHeight, rect.bottom); y4 += 5) { + let dom = view.root.elementFromPoint(x6, y4); + if (!dom || dom == view.dom || !view.dom.contains(dom)) + continue; + let localRect = dom.getBoundingClientRect(); + if (localRect.top >= startY - 20) { + refDOM = dom; + refTop = localRect.top; + break; + } + } + return { refDOM, refTop, stack: scrollStack(view.dom) }; + } + function scrollStack(dom) { + let stack = [], doc4 = dom.ownerDocument; + for (let cur = dom; cur; cur = parentNode(cur)) { + stack.push({ dom: cur, top: cur.scrollTop, left: cur.scrollLeft }); + if (dom == doc4) + break; + } + return stack; + } + function resetScrollPos({ refDOM, refTop, stack }) { + let newRefTop = refDOM ? refDOM.getBoundingClientRect().top : 0; + restoreScrollStack(stack, newRefTop == 0 ? 0 : newRefTop - refTop); + } + function restoreScrollStack(stack, dTop) { + for (let i2 = 0; i2 < stack.length; i2++) { + let { dom, top, left } = stack[i2]; + if (dom.scrollTop != top + dTop) + dom.scrollTop = top + dTop; + if (dom.scrollLeft != left) + dom.scrollLeft = left; + } + } + var preventScrollSupported = null; + function focusPreventScroll(dom) { + if (dom.setActive) + return dom.setActive(); + if (preventScrollSupported) + return dom.focus(preventScrollSupported); + let stored = scrollStack(dom); + dom.focus(preventScrollSupported == null ? { + get preventScroll() { + preventScrollSupported = { preventScroll: true }; + return true; + } + } : void 0); + if (!preventScrollSupported) { + preventScrollSupported = false; + restoreScrollStack(stored, 0); + } + } + function findOffsetInNode(node2, coords) { + let closest, dxClosest = 2e8, coordsClosest, offset = 0; + let rowBot = coords.top, rowTop = coords.top; + let firstBelow, coordsBelow; + for (let child = node2.firstChild, childIndex = 0; child; child = child.nextSibling, childIndex++) { + let rects; + if (child.nodeType == 1) + rects = child.getClientRects(); + else if (child.nodeType == 3) + rects = textRange(child).getClientRects(); + else + continue; + for (let i2 = 0; i2 < rects.length; i2++) { + let rect = rects[i2]; + if (rect.top <= rowBot && rect.bottom >= rowTop) { + rowBot = Math.max(rect.bottom, rowBot); + rowTop = Math.min(rect.top, rowTop); + let dx = rect.left > coords.left ? rect.left - coords.left : rect.right < coords.left ? coords.left - rect.right : 0; + if (dx < dxClosest) { + closest = child; + dxClosest = dx; + coordsClosest = dx && closest.nodeType == 3 ? { + left: rect.right < coords.left ? rect.right : rect.left, + top: coords.top + } : coords; + if (child.nodeType == 1 && dx) + offset = childIndex + (coords.left >= (rect.left + rect.right) / 2 ? 1 : 0); + continue; + } + } else if (rect.top > coords.top && !firstBelow && rect.left <= coords.left && rect.right >= coords.left) { + firstBelow = child; + coordsBelow = { left: Math.max(rect.left, Math.min(rect.right, coords.left)), top: rect.top }; + } + if (!closest && (coords.left >= rect.right && coords.top >= rect.top || coords.left >= rect.left && coords.top >= rect.bottom)) + offset = childIndex + 1; + } + } + if (!closest && firstBelow) { + closest = firstBelow; + coordsClosest = coordsBelow; + dxClosest = 0; + } + if (closest && closest.nodeType == 3) + return findOffsetInText(closest, coordsClosest); + if (!closest || dxClosest && closest.nodeType == 1) + return { node: node2, offset }; + return findOffsetInNode(closest, coordsClosest); + } + function findOffsetInText(node2, coords) { + let len = node2.nodeValue.length; + let range = document.createRange(); + for (let i2 = 0; i2 < len; i2++) { + range.setEnd(node2, i2 + 1); + range.setStart(node2, i2); + let rect = singleRect(range, 1); + if (rect.top == rect.bottom) + continue; + if (inRect(coords, rect)) + return { node: node2, offset: i2 + (coords.left >= (rect.left + rect.right) / 2 ? 1 : 0) }; + } + return { node: node2, offset: 0 }; + } + function inRect(coords, rect) { + return coords.left >= rect.left - 1 && coords.left <= rect.right + 1 && coords.top >= rect.top - 1 && coords.top <= rect.bottom + 1; + } + function targetKludge(dom, coords) { + let parent = dom.parentNode; + if (parent && /^li$/i.test(parent.nodeName) && coords.left < dom.getBoundingClientRect().left) + return parent; + return dom; + } + function posFromElement(view, elt, coords) { + let { node: node2, offset } = findOffsetInNode(elt, coords), bias = -1; + if (node2.nodeType == 1 && !node2.firstChild) { + let rect = node2.getBoundingClientRect(); + bias = rect.left != rect.right && coords.left > (rect.left + rect.right) / 2 ? 1 : -1; + } + return view.docView.posFromDOM(node2, offset, bias); + } + function posFromCaret(view, node2, offset, coords) { + let outsideBlock = -1; + for (let cur = node2, sawBlock = false; ; ) { + if (cur == view.dom) + break; + let desc = view.docView.nearestDesc(cur, true); + if (!desc) + return null; + if (desc.dom.nodeType == 1 && (desc.node.isBlock && desc.parent && !sawBlock || !desc.contentDOM)) { + let rect = desc.dom.getBoundingClientRect(); + if (desc.node.isBlock && desc.parent && !sawBlock) { + sawBlock = true; + if (rect.left > coords.left || rect.top > coords.top) + outsideBlock = desc.posBefore; + else if (rect.right < coords.left || rect.bottom < coords.top) + outsideBlock = desc.posAfter; + } + if (!desc.contentDOM && outsideBlock < 0 && !desc.node.isText) { + let before = desc.node.isBlock ? coords.top < (rect.top + rect.bottom) / 2 : coords.left < (rect.left + rect.right) / 2; + return before ? desc.posBefore : desc.posAfter; + } + } + cur = desc.dom.parentNode; + } + return outsideBlock > -1 ? outsideBlock : view.docView.posFromDOM(node2, offset, -1); + } + function elementFromPoint(element2, coords, box) { + let len = element2.childNodes.length; + if (len && box.top < box.bottom) { + for (let startI = Math.max(0, Math.min(len - 1, Math.floor(len * (coords.top - box.top) / (box.bottom - box.top)) - 2)), i2 = startI; ; ) { + let child = element2.childNodes[i2]; + if (child.nodeType == 1) { + let rects = child.getClientRects(); + for (let j6 = 0; j6 < rects.length; j6++) { + let rect = rects[j6]; + if (inRect(coords, rect)) + return elementFromPoint(child, coords, rect); + } + } + if ((i2 = (i2 + 1) % len) == startI) + break; + } + } + return element2; + } + function posAtCoords(view, coords) { + let doc4 = view.dom.ownerDocument, node2, offset = 0; + let caret = caretFromPoint(doc4, coords.left, coords.top); + if (caret) + ({ node: node2, offset } = caret); + let elt = (view.root.elementFromPoint ? view.root : doc4).elementFromPoint(coords.left, coords.top); + let pos; + if (!elt || !view.dom.contains(elt.nodeType != 1 ? elt.parentNode : elt)) { + let box = view.dom.getBoundingClientRect(); + if (!inRect(coords, box)) + return null; + elt = elementFromPoint(view.dom, coords, box); + if (!elt) + return null; + } + if (safari) { + for (let p4 = elt; node2 && p4; p4 = parentNode(p4)) + if (p4.draggable) + node2 = void 0; + } + elt = targetKludge(elt, coords); + if (node2) { + if (gecko && node2.nodeType == 1) { + offset = Math.min(offset, node2.childNodes.length); + if (offset < node2.childNodes.length) { + let next = node2.childNodes[offset], box; + if (next.nodeName == "IMG" && (box = next.getBoundingClientRect()).right <= coords.left && box.bottom > coords.top) + offset++; + } + } + let prev; + if (webkit && offset && node2.nodeType == 1 && (prev = node2.childNodes[offset - 1]).nodeType == 1 && prev.contentEditable == "false" && prev.getBoundingClientRect().top >= coords.top) + offset--; + if (node2 == view.dom && offset == node2.childNodes.length - 1 && node2.lastChild.nodeType == 1 && coords.top > node2.lastChild.getBoundingClientRect().bottom) + pos = view.state.doc.content.size; + else if (offset == 0 || node2.nodeType != 1 || node2.childNodes[offset - 1].nodeName != "BR") + pos = posFromCaret(view, node2, offset, coords); + } + if (pos == null) + pos = posFromElement(view, elt, coords); + let desc = view.docView.nearestDesc(elt, true); + return { pos, inside: desc ? desc.posAtStart - desc.border : -1 }; + } + function nonZero(rect) { + return rect.top < rect.bottom || rect.left < rect.right; + } + function singleRect(target, bias) { + let rects = target.getClientRects(); + if (rects.length) { + let first = rects[bias < 0 ? 0 : rects.length - 1]; + if (nonZero(first)) + return first; + } + return Array.prototype.find.call(rects, nonZero) || target.getBoundingClientRect(); + } + var BIDI = /[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/; + function coordsAtPos(view, pos, side) { + let { node: node2, offset, atom } = view.docView.domFromPos(pos, side < 0 ? -1 : 1); + let supportEmptyRange = webkit || gecko; + if (node2.nodeType == 3) { + if (supportEmptyRange && (BIDI.test(node2.nodeValue) || (side < 0 ? !offset : offset == node2.nodeValue.length))) { + let rect = singleRect(textRange(node2, offset, offset), side); + if (gecko && offset && /\s/.test(node2.nodeValue[offset - 1]) && offset < node2.nodeValue.length) { + let rectBefore = singleRect(textRange(node2, offset - 1, offset - 1), -1); + if (rectBefore.top == rect.top) { + let rectAfter = singleRect(textRange(node2, offset, offset + 1), -1); + if (rectAfter.top != rect.top) + return flattenV(rectAfter, rectAfter.left < rectBefore.left); + } + } + return rect; + } else { + let from = offset, to = offset, takeSide = side < 0 ? 1 : -1; + if (side < 0 && !offset) { + to++; + takeSide = -1; + } else if (side >= 0 && offset == node2.nodeValue.length) { + from--; + takeSide = 1; + } else if (side < 0) { + from--; + } else { + to++; + } + return flattenV(singleRect(textRange(node2, from, to), takeSide), takeSide < 0); + } + } + let $dom = view.state.doc.resolve(pos - (atom || 0)); + if (!$dom.parent.inlineContent) { + if (atom == null && offset && (side < 0 || offset == nodeSize(node2))) { + let before = node2.childNodes[offset - 1]; + if (before.nodeType == 1) + return flattenH(before.getBoundingClientRect(), false); + } + if (atom == null && offset < nodeSize(node2)) { + let after = node2.childNodes[offset]; + if (after.nodeType == 1) + return flattenH(after.getBoundingClientRect(), true); + } + return flattenH(node2.getBoundingClientRect(), side >= 0); + } + if (atom == null && offset && (side < 0 || offset == nodeSize(node2))) { + let before = node2.childNodes[offset - 1]; + let target = before.nodeType == 3 ? textRange(before, nodeSize(before) - (supportEmptyRange ? 0 : 1)) : before.nodeType == 1 && (before.nodeName != "BR" || !before.nextSibling) ? before : null; + if (target) + return flattenV(singleRect(target, 1), false); + } + if (atom == null && offset < nodeSize(node2)) { + let after = node2.childNodes[offset]; + while (after.pmViewDesc && after.pmViewDesc.ignoreForCoords) + after = after.nextSibling; + let target = !after ? null : after.nodeType == 3 ? textRange(after, 0, supportEmptyRange ? 0 : 1) : after.nodeType == 1 ? after : null; + if (target) + return flattenV(singleRect(target, -1), true); + } + return flattenV(singleRect(node2.nodeType == 3 ? textRange(node2) : node2, -side), side >= 0); + } + function flattenV(rect, left) { + if (rect.width == 0) + return rect; + let x6 = left ? rect.left : rect.right; + return { top: rect.top, bottom: rect.bottom, left: x6, right: x6 }; + } + function flattenH(rect, top) { + if (rect.height == 0) + return rect; + let y4 = top ? rect.top : rect.bottom; + return { top: y4, bottom: y4, left: rect.left, right: rect.right }; + } + function withFlushedState(view, state, f3) { + let viewState = view.state, active = view.root.activeElement; + if (viewState != state) + view.updateState(state); + if (active != view.dom) + view.focus(); + try { + return f3(); + } finally { + if (viewState != state) + view.updateState(viewState); + if (active != view.dom && active) + active.focus(); + } + } + function endOfTextblockVertical(view, state, dir) { + let sel = state.selection; + let $pos = dir == "up" ? sel.$from : sel.$to; + return withFlushedState(view, state, () => { + let { node: dom } = view.docView.domFromPos($pos.pos, dir == "up" ? -1 : 1); + for (; ; ) { + let nearest = view.docView.nearestDesc(dom, true); + if (!nearest) + break; + if (nearest.node.isBlock) { + dom = nearest.contentDOM || nearest.dom; + break; + } + dom = nearest.dom.parentNode; + } + let coords = coordsAtPos(view, $pos.pos, 1); + for (let child = dom.firstChild; child; child = child.nextSibling) { + let boxes; + if (child.nodeType == 1) + boxes = child.getClientRects(); + else if (child.nodeType == 3) + boxes = textRange(child, 0, child.nodeValue.length).getClientRects(); + else + continue; + for (let i2 = 0; i2 < boxes.length; i2++) { + let box = boxes[i2]; + if (box.bottom > box.top + 1 && (dir == "up" ? coords.top - box.top > (box.bottom - coords.top) * 2 : box.bottom - coords.bottom > (coords.bottom - box.top) * 2)) + return false; + } + } + return true; + }); + } + var maybeRTL = /[\u0590-\u08ac]/; + function endOfTextblockHorizontal(view, state, dir) { + let { $head } = state.selection; + if (!$head.parent.isTextblock) + return false; + let offset = $head.parentOffset, atStart = !offset, atEnd = offset == $head.parent.content.size; + let sel = view.domSelection(); + if (!maybeRTL.test($head.parent.textContent) || !sel.modify) + return dir == "left" || dir == "backward" ? atStart : atEnd; + return withFlushedState(view, state, () => { + let { focusNode: oldNode, focusOffset: oldOff, anchorNode, anchorOffset } = view.domSelectionRange(); + let oldBidiLevel = sel.caretBidiLevel; + sel.modify("move", dir, "character"); + let parentDOM = $head.depth ? view.docView.domAfterPos($head.before()) : view.dom; + let { focusNode: newNode, focusOffset: newOff } = view.domSelectionRange(); + let result = newNode && !parentDOM.contains(newNode.nodeType == 1 ? newNode : newNode.parentNode) || oldNode == newNode && oldOff == newOff; + try { + sel.collapse(anchorNode, anchorOffset); + if (oldNode && (oldNode != anchorNode || oldOff != anchorOffset) && sel.extend) + sel.extend(oldNode, oldOff); + } catch (_3) { + } + if (oldBidiLevel != null) + sel.caretBidiLevel = oldBidiLevel; + return result; + }); + } + var cachedState = null; + var cachedDir = null; + var cachedResult = false; + function endOfTextblock(view, state, dir) { + if (cachedState == state && cachedDir == dir) + return cachedResult; + cachedState = state; + cachedDir = dir; + return cachedResult = dir == "up" || dir == "down" ? endOfTextblockVertical(view, state, dir) : endOfTextblockHorizontal(view, state, dir); + } + var NOT_DIRTY = 0; + var CHILD_DIRTY = 1; + var CONTENT_DIRTY = 2; + var NODE_DIRTY = 3; + var ViewDesc = class { + constructor(parent, children, dom, contentDOM) { + this.parent = parent; + this.children = children; + this.dom = dom; + this.contentDOM = contentDOM; + this.dirty = NOT_DIRTY; + dom.pmViewDesc = this; + } + // Used to check whether a given description corresponds to a + // widget/mark/node. + matchesWidget(widget) { + return false; + } + matchesMark(mark) { + return false; + } + matchesNode(node2, outerDeco, innerDeco) { + return false; + } + matchesHack(nodeName) { + return false; + } + // When parsing in-editor content (in domchange.js), we allow + // descriptions to determine the parse rules that should be used to + // parse them. + parseRule() { + return null; + } + // Used by the editor's event handler to ignore events that come + // from certain descs. + stopEvent(event) { + return false; + } + // The size of the content represented by this desc. + get size() { + let size = 0; + for (let i2 = 0; i2 < this.children.length; i2++) + size += this.children[i2].size; + return size; + } + // For block nodes, this represents the space taken up by their + // start/end tokens. + get border() { + return 0; + } + destroy() { + this.parent = void 0; + if (this.dom.pmViewDesc == this) + this.dom.pmViewDesc = void 0; + for (let i2 = 0; i2 < this.children.length; i2++) + this.children[i2].destroy(); + } + posBeforeChild(child) { + for (let i2 = 0, pos = this.posAtStart; ; i2++) { + let cur = this.children[i2]; + if (cur == child) + return pos; + pos += cur.size; + } + } + get posBefore() { + return this.parent.posBeforeChild(this); + } + get posAtStart() { + return this.parent ? this.parent.posBeforeChild(this) + this.border : 0; + } + get posAfter() { + return this.posBefore + this.size; + } + get posAtEnd() { + return this.posAtStart + this.size - 2 * this.border; + } + localPosFromDOM(dom, offset, bias) { + if (this.contentDOM && this.contentDOM.contains(dom.nodeType == 1 ? dom : dom.parentNode)) { + if (bias < 0) { + let domBefore, desc; + if (dom == this.contentDOM) { + domBefore = dom.childNodes[offset - 1]; + } else { + while (dom.parentNode != this.contentDOM) + dom = dom.parentNode; + domBefore = dom.previousSibling; + } + while (domBefore && !((desc = domBefore.pmViewDesc) && desc.parent == this)) + domBefore = domBefore.previousSibling; + return domBefore ? this.posBeforeChild(desc) + desc.size : this.posAtStart; + } else { + let domAfter, desc; + if (dom == this.contentDOM) { + domAfter = dom.childNodes[offset]; + } else { + while (dom.parentNode != this.contentDOM) + dom = dom.parentNode; + domAfter = dom.nextSibling; + } + while (domAfter && !((desc = domAfter.pmViewDesc) && desc.parent == this)) + domAfter = domAfter.nextSibling; + return domAfter ? this.posBeforeChild(desc) : this.posAtEnd; + } + } + let atEnd; + if (dom == this.dom && this.contentDOM) { + atEnd = offset > domIndex(this.contentDOM); + } else if (this.contentDOM && this.contentDOM != this.dom && this.dom.contains(this.contentDOM)) { + atEnd = dom.compareDocumentPosition(this.contentDOM) & 2; + } else if (this.dom.firstChild) { + if (offset == 0) + for (let search2 = dom; ; search2 = search2.parentNode) { + if (search2 == this.dom) { + atEnd = false; + break; + } + if (search2.previousSibling) + break; + } + if (atEnd == null && offset == dom.childNodes.length) + for (let search2 = dom; ; search2 = search2.parentNode) { + if (search2 == this.dom) { + atEnd = true; + break; + } + if (search2.nextSibling) + break; + } + } + return (atEnd == null ? bias > 0 : atEnd) ? this.posAtEnd : this.posAtStart; + } + nearestDesc(dom, onlyNodes = false) { + for (let first = true, cur = dom; cur; cur = cur.parentNode) { + let desc = this.getDesc(cur), nodeDOM; + if (desc && (!onlyNodes || desc.node)) { + if (first && (nodeDOM = desc.nodeDOM) && !(nodeDOM.nodeType == 1 ? nodeDOM.contains(dom.nodeType == 1 ? dom : dom.parentNode) : nodeDOM == dom)) + first = false; + else + return desc; + } + } + } + getDesc(dom) { + let desc = dom.pmViewDesc; + for (let cur = desc; cur; cur = cur.parent) + if (cur == this) + return desc; + } + posFromDOM(dom, offset, bias) { + for (let scan = dom; scan; scan = scan.parentNode) { + let desc = this.getDesc(scan); + if (desc) + return desc.localPosFromDOM(dom, offset, bias); + } + return -1; + } + // Find the desc for the node after the given pos, if any. (When a + // parent node overrode rendering, there might not be one.) + descAt(pos) { + for (let i2 = 0, offset = 0; i2 < this.children.length; i2++) { + let child = this.children[i2], end = offset + child.size; + if (offset == pos && end != offset) { + while (!child.border && child.children.length) + child = child.children[0]; + return child; + } + if (pos < end) + return child.descAt(pos - offset - child.border); + offset = end; + } + } + domFromPos(pos, side) { + if (!this.contentDOM) + return { node: this.dom, offset: 0, atom: pos + 1 }; + let i2 = 0, offset = 0; + for (let curPos = 0; i2 < this.children.length; i2++) { + let child = this.children[i2], end = curPos + child.size; + if (end > pos || child instanceof TrailingHackViewDesc) { + offset = pos - curPos; + break; + } + curPos = end; + } + if (offset) + return this.children[i2].domFromPos(offset - this.children[i2].border, side); + for (let prev; i2 && !(prev = this.children[i2 - 1]).size && prev instanceof WidgetViewDesc && prev.side >= 0; i2--) { + } + if (side <= 0) { + let prev, enter = true; + for (; ; i2--, enter = false) { + prev = i2 ? this.children[i2 - 1] : null; + if (!prev || prev.dom.parentNode == this.contentDOM) + break; + } + if (prev && side && enter && !prev.border && !prev.domAtom) + return prev.domFromPos(prev.size, side); + return { node: this.contentDOM, offset: prev ? domIndex(prev.dom) + 1 : 0 }; + } else { + let next, enter = true; + for (; ; i2++, enter = false) { + next = i2 < this.children.length ? this.children[i2] : null; + if (!next || next.dom.parentNode == this.contentDOM) + break; + } + if (next && enter && !next.border && !next.domAtom) + return next.domFromPos(0, side); + return { node: this.contentDOM, offset: next ? domIndex(next.dom) : this.contentDOM.childNodes.length }; + } + } + // Used to find a DOM range in a single parent for a given changed + // range. + parseRange(from, to, base2 = 0) { + if (this.children.length == 0) + return { node: this.contentDOM, from, to, fromOffset: 0, toOffset: this.contentDOM.childNodes.length }; + let fromOffset = -1, toOffset = -1; + for (let offset = base2, i2 = 0; ; i2++) { + let child = this.children[i2], end = offset + child.size; + if (fromOffset == -1 && from <= end) { + let childBase = offset + child.border; + if (from >= childBase && to <= end - child.border && child.node && child.contentDOM && this.contentDOM.contains(child.contentDOM)) + return child.parseRange(from, to, childBase); + from = offset; + for (let j6 = i2; j6 > 0; j6--) { + let prev = this.children[j6 - 1]; + if (prev.size && prev.dom.parentNode == this.contentDOM && !prev.emptyChildAt(1)) { + fromOffset = domIndex(prev.dom) + 1; + break; + } + from -= prev.size; + } + if (fromOffset == -1) + fromOffset = 0; + } + if (fromOffset > -1 && (end > to || i2 == this.children.length - 1)) { + to = end; + for (let j6 = i2 + 1; j6 < this.children.length; j6++) { + let next = this.children[j6]; + if (next.size && next.dom.parentNode == this.contentDOM && !next.emptyChildAt(-1)) { + toOffset = domIndex(next.dom); + break; + } + to += next.size; + } + if (toOffset == -1) + toOffset = this.contentDOM.childNodes.length; + break; + } + offset = end; + } + return { node: this.contentDOM, from, to, fromOffset, toOffset }; + } + emptyChildAt(side) { + if (this.border || !this.contentDOM || !this.children.length) + return false; + let child = this.children[side < 0 ? 0 : this.children.length - 1]; + return child.size == 0 || child.emptyChildAt(side); + } + domAfterPos(pos) { + let { node: node2, offset } = this.domFromPos(pos, 0); + if (node2.nodeType != 1 || offset == node2.childNodes.length) + throw new RangeError("No node after pos " + pos); + return node2.childNodes[offset]; + } + // View descs are responsible for setting any selection that falls + // entirely inside of them, so that custom implementations can do + // custom things with the selection. Note that this falls apart when + // a selection starts in such a node and ends in another, in which + // case we just use whatever domFromPos produces as a best effort. + setSelection(anchor, head, root2, force = false) { + let from = Math.min(anchor, head), to = Math.max(anchor, head); + for (let i2 = 0, offset = 0; i2 < this.children.length; i2++) { + let child = this.children[i2], end = offset + child.size; + if (from > offset && to < end) + return child.setSelection(anchor - offset - child.border, head - offset - child.border, root2, force); + offset = end; + } + let anchorDOM = this.domFromPos(anchor, anchor ? -1 : 1); + let headDOM = head == anchor ? anchorDOM : this.domFromPos(head, head ? -1 : 1); + let domSel = root2.getSelection(); + let brKludge = false; + if ((gecko || safari) && anchor == head) { + let { node: node2, offset } = anchorDOM; + if (node2.nodeType == 3) { + brKludge = !!(offset && node2.nodeValue[offset - 1] == "\n"); + if (brKludge && offset == node2.nodeValue.length) { + for (let scan = node2, after; scan; scan = scan.parentNode) { + if (after = scan.nextSibling) { + if (after.nodeName == "BR") + anchorDOM = headDOM = { node: after.parentNode, offset: domIndex(after) + 1 }; + break; + } + let desc = scan.pmViewDesc; + if (desc && desc.node && desc.node.isBlock) + break; + } + } + } else { + let prev = node2.childNodes[offset - 1]; + brKludge = prev && (prev.nodeName == "BR" || prev.contentEditable == "false"); + } + } + if (gecko && domSel.focusNode && domSel.focusNode != headDOM.node && domSel.focusNode.nodeType == 1) { + let after = domSel.focusNode.childNodes[domSel.focusOffset]; + if (after && after.contentEditable == "false") + force = true; + } + if (!(force || brKludge && safari) && isEquivalentPosition(anchorDOM.node, anchorDOM.offset, domSel.anchorNode, domSel.anchorOffset) && isEquivalentPosition(headDOM.node, headDOM.offset, domSel.focusNode, domSel.focusOffset)) + return; + let domSelExtended = false; + if ((domSel.extend || anchor == head) && !brKludge) { + domSel.collapse(anchorDOM.node, anchorDOM.offset); + try { + if (anchor != head) + domSel.extend(headDOM.node, headDOM.offset); + domSelExtended = true; + } catch (_3) { + } + } + if (!domSelExtended) { + if (anchor > head) { + let tmp = anchorDOM; + anchorDOM = headDOM; + headDOM = tmp; + } + let range = document.createRange(); + range.setEnd(headDOM.node, headDOM.offset); + range.setStart(anchorDOM.node, anchorDOM.offset); + domSel.removeAllRanges(); + domSel.addRange(range); + } + } + ignoreMutation(mutation) { + return !this.contentDOM && mutation.type != "selection"; + } + get contentLost() { + return this.contentDOM && this.contentDOM != this.dom && !this.dom.contains(this.contentDOM); + } + // Remove a subtree of the element tree that has been touched + // by a DOM change, so that the next update will redraw it. + markDirty(from, to) { + for (let offset = 0, i2 = 0; i2 < this.children.length; i2++) { + let child = this.children[i2], end = offset + child.size; + if (offset == end ? from <= end && to >= offset : from < end && to > offset) { + let startInside = offset + child.border, endInside = end - child.border; + if (from >= startInside && to <= endInside) { + this.dirty = from == offset || to == end ? CONTENT_DIRTY : CHILD_DIRTY; + if (from == startInside && to == endInside && (child.contentLost || child.dom.parentNode != this.contentDOM)) + child.dirty = NODE_DIRTY; + else + child.markDirty(from - startInside, to - startInside); + return; + } else { + child.dirty = child.dom == child.contentDOM && child.dom.parentNode == this.contentDOM && !child.children.length ? CONTENT_DIRTY : NODE_DIRTY; + } + } + offset = end; + } + this.dirty = CONTENT_DIRTY; + } + markParentsDirty() { + let level = 1; + for (let node2 = this.parent; node2; node2 = node2.parent, level++) { + let dirty = level == 1 ? CONTENT_DIRTY : CHILD_DIRTY; + if (node2.dirty < dirty) + node2.dirty = dirty; + } + } + get domAtom() { + return false; + } + get ignoreForCoords() { + return false; + } + isText(text5) { + return false; + } + }; + var WidgetViewDesc = class extends ViewDesc { + constructor(parent, widget, view, pos) { + let self2, dom = widget.type.toDOM; + if (typeof dom == "function") + dom = dom(view, () => { + if (!self2) + return pos; + if (self2.parent) + return self2.parent.posBeforeChild(self2); + }); + if (!widget.type.spec.raw) { + if (dom.nodeType != 1) { + let wrap3 = document.createElement("span"); + wrap3.appendChild(dom); + dom = wrap3; + } + dom.contentEditable = "false"; + dom.classList.add("ProseMirror-widget"); + } + super(parent, [], dom, null); + this.widget = widget; + this.widget = widget; + self2 = this; + } + matchesWidget(widget) { + return this.dirty == NOT_DIRTY && widget.type.eq(this.widget.type); + } + parseRule() { + return { ignore: true }; + } + stopEvent(event) { + let stop = this.widget.spec.stopEvent; + return stop ? stop(event) : false; + } + ignoreMutation(mutation) { + return mutation.type != "selection" || this.widget.spec.ignoreSelection; + } + destroy() { + this.widget.type.destroy(this.dom); + super.destroy(); + } + get domAtom() { + return true; + } + get side() { + return this.widget.type.side; + } + }; + var CompositionViewDesc = class extends ViewDesc { + constructor(parent, dom, textDOM, text5) { + super(parent, [], dom, null); + this.textDOM = textDOM; + this.text = text5; + } + get size() { + return this.text.length; + } + localPosFromDOM(dom, offset) { + if (dom != this.textDOM) + return this.posAtStart + (offset ? this.size : 0); + return this.posAtStart + offset; + } + domFromPos(pos) { + return { node: this.textDOM, offset: pos }; + } + ignoreMutation(mut) { + return mut.type === "characterData" && mut.target.nodeValue == mut.oldValue; + } + }; + var MarkViewDesc = class _MarkViewDesc extends ViewDesc { + constructor(parent, mark, dom, contentDOM) { + super(parent, [], dom, contentDOM); + this.mark = mark; + } + static create(parent, mark, inline, view) { + let custom = view.nodeViews[mark.type.name]; + let spec = custom && custom(mark, view, inline); + if (!spec || !spec.dom) + spec = DOMSerializer.renderSpec(document, mark.type.spec.toDOM(mark, inline)); + return new _MarkViewDesc(parent, mark, spec.dom, spec.contentDOM || spec.dom); + } + parseRule() { + if (this.dirty & NODE_DIRTY || this.mark.type.spec.reparseInView) + return null; + return { mark: this.mark.type.name, attrs: this.mark.attrs, contentElement: this.contentDOM }; + } + matchesMark(mark) { + return this.dirty != NODE_DIRTY && this.mark.eq(mark); + } + markDirty(from, to) { + super.markDirty(from, to); + if (this.dirty != NOT_DIRTY) { + let parent = this.parent; + while (!parent.node) + parent = parent.parent; + if (parent.dirty < this.dirty) + parent.dirty = this.dirty; + this.dirty = NOT_DIRTY; + } + } + slice(from, to, view) { + let copy2 = _MarkViewDesc.create(this.parent, this.mark, true, view); + let nodes = this.children, size = this.size; + if (to < size) + nodes = replaceNodes(nodes, to, size, view); + if (from > 0) + nodes = replaceNodes(nodes, 0, from, view); + for (let i2 = 0; i2 < nodes.length; i2++) + nodes[i2].parent = copy2; + copy2.children = nodes; + return copy2; + } + }; + var NodeViewDesc = class _NodeViewDesc extends ViewDesc { + constructor(parent, node2, outerDeco, innerDeco, dom, contentDOM, nodeDOM, view, pos) { + super(parent, [], dom, contentDOM); + this.node = node2; + this.outerDeco = outerDeco; + this.innerDeco = innerDeco; + this.nodeDOM = nodeDOM; + } + // By default, a node is rendered using the `toDOM` method from the + // node type spec. But client code can use the `nodeViews` spec to + // supply a custom node view, which can influence various aspects of + // the way the node works. + // + // (Using subclassing for this was intentionally decided against, + // since it'd require exposing a whole slew of finicky + // implementation details to the user code that they probably will + // never need.) + static create(parent, node2, outerDeco, innerDeco, view, pos) { + let custom = view.nodeViews[node2.type.name], descObj; + let spec = custom && custom(node2, view, () => { + if (!descObj) + return pos; + if (descObj.parent) + return descObj.parent.posBeforeChild(descObj); + }, outerDeco, innerDeco); + let dom = spec && spec.dom, contentDOM = spec && spec.contentDOM; + if (node2.isText) { + if (!dom) + dom = document.createTextNode(node2.text); + else if (dom.nodeType != 3) + throw new RangeError("Text must be rendered as a DOM text node"); + } else if (!dom) { + ({ dom, contentDOM } = DOMSerializer.renderSpec(document, node2.type.spec.toDOM(node2))); + } + if (!contentDOM && !node2.isText && dom.nodeName != "BR") { + if (!dom.hasAttribute("contenteditable")) + dom.contentEditable = "false"; + if (node2.type.spec.draggable) + dom.draggable = true; + } + let nodeDOM = dom; + dom = applyOuterDeco(dom, outerDeco, node2); + if (spec) + return descObj = new CustomNodeViewDesc(parent, node2, outerDeco, innerDeco, dom, contentDOM || null, nodeDOM, spec, view, pos + 1); + else if (node2.isText) + return new TextViewDesc(parent, node2, outerDeco, innerDeco, dom, nodeDOM, view); + else + return new _NodeViewDesc(parent, node2, outerDeco, innerDeco, dom, contentDOM || null, nodeDOM, view, pos + 1); + } + parseRule() { + if (this.node.type.spec.reparseInView) + return null; + let rule = { node: this.node.type.name, attrs: this.node.attrs }; + if (this.node.type.whitespace == "pre") + rule.preserveWhitespace = "full"; + if (!this.contentDOM) { + rule.getContent = () => this.node.content; + } else if (!this.contentLost) { + rule.contentElement = this.contentDOM; + } else { + for (let i2 = this.children.length - 1; i2 >= 0; i2--) { + let child = this.children[i2]; + if (this.dom.contains(child.dom.parentNode)) { + rule.contentElement = child.dom.parentNode; + break; + } + } + if (!rule.contentElement) + rule.getContent = () => Fragment.empty; + } + return rule; + } + matchesNode(node2, outerDeco, innerDeco) { + return this.dirty == NOT_DIRTY && node2.eq(this.node) && sameOuterDeco(outerDeco, this.outerDeco) && innerDeco.eq(this.innerDeco); + } + get size() { + return this.node.nodeSize; + } + get border() { + return this.node.isLeaf ? 0 : 1; + } + // Syncs `this.children` to match `this.node.content` and the local + // decorations, possibly introducing nesting for marks. Then, in a + // separate step, syncs the DOM inside `this.contentDOM` to + // `this.children`. + updateChildren(view, pos) { + let inline = this.node.inlineContent, off = pos; + let composition = view.composing ? this.localCompositionInfo(view, pos) : null; + let localComposition = composition && composition.pos > -1 ? composition : null; + let compositionInChild = composition && composition.pos < 0; + let updater = new ViewTreeUpdater(this, localComposition && localComposition.node, view); + iterDeco(this.node, this.innerDeco, (widget, i2, insideNode) => { + if (widget.spec.marks) + updater.syncToMarks(widget.spec.marks, inline, view); + else if (widget.type.side >= 0 && !insideNode) + updater.syncToMarks(i2 == this.node.childCount ? Mark.none : this.node.child(i2).marks, inline, view); + updater.placeWidget(widget, view, off); + }, (child, outerDeco, innerDeco, i2) => { + updater.syncToMarks(child.marks, inline, view); + let compIndex; + if (updater.findNodeMatch(child, outerDeco, innerDeco, i2)) ; + else if (compositionInChild && view.state.selection.from > off && view.state.selection.to < off + child.nodeSize && (compIndex = updater.findIndexWithChild(composition.node)) > -1 && updater.updateNodeAt(child, outerDeco, innerDeco, compIndex, view)) ; + else if (updater.updateNextNode(child, outerDeco, innerDeco, view, i2, off)) ; + else { + updater.addNode(child, outerDeco, innerDeco, view, off); + } + off += child.nodeSize; + }); + updater.syncToMarks([], inline, view); + if (this.node.isTextblock) + updater.addTextblockHacks(); + updater.destroyRest(); + if (updater.changed || this.dirty == CONTENT_DIRTY) { + if (localComposition) + this.protectLocalComposition(view, localComposition); + renderDescs(this.contentDOM, this.children, view); + if (ios) + iosHacks(this.dom); + } + } + localCompositionInfo(view, pos) { + let { from, to } = view.state.selection; + if (!(view.state.selection instanceof TextSelection) || from < pos || to > pos + this.node.content.size) + return null; + let textNode = view.input.compositionNode; + if (!textNode || !this.dom.contains(textNode.parentNode)) + return null; + if (this.node.inlineContent) { + let text5 = textNode.nodeValue; + let textPos = findTextInFragment(this.node.content, text5, from - pos, to - pos); + return textPos < 0 ? null : { node: textNode, pos: textPos, text: text5 }; + } else { + return { node: textNode, pos: -1, text: "" }; + } + } + protectLocalComposition(view, { node: node2, pos, text: text5 }) { + if (this.getDesc(node2)) + return; + let topNode = node2; + for (; ; topNode = topNode.parentNode) { + if (topNode.parentNode == this.contentDOM) + break; + while (topNode.previousSibling) + topNode.parentNode.removeChild(topNode.previousSibling); + while (topNode.nextSibling) + topNode.parentNode.removeChild(topNode.nextSibling); + if (topNode.pmViewDesc) + topNode.pmViewDesc = void 0; + } + let desc = new CompositionViewDesc(this, topNode, node2, text5); + view.input.compositionNodes.push(desc); + this.children = replaceNodes(this.children, pos, pos + text5.length, view, desc); + } + // If this desc must be updated to match the given node decoration, + // do so and return true. + update(node2, outerDeco, innerDeco, view) { + if (this.dirty == NODE_DIRTY || !node2.sameMarkup(this.node)) + return false; + this.updateInner(node2, outerDeco, innerDeco, view); + return true; + } + updateInner(node2, outerDeco, innerDeco, view) { + this.updateOuterDeco(outerDeco); + this.node = node2; + this.innerDeco = innerDeco; + if (this.contentDOM) + this.updateChildren(view, this.posAtStart); + this.dirty = NOT_DIRTY; + } + updateOuterDeco(outerDeco) { + if (sameOuterDeco(outerDeco, this.outerDeco)) + return; + let needsWrap = this.nodeDOM.nodeType != 1; + let oldDOM = this.dom; + this.dom = patchOuterDeco(this.dom, this.nodeDOM, computeOuterDeco(this.outerDeco, this.node, needsWrap), computeOuterDeco(outerDeco, this.node, needsWrap)); + if (this.dom != oldDOM) { + oldDOM.pmViewDesc = void 0; + this.dom.pmViewDesc = this; + } + this.outerDeco = outerDeco; + } + // Mark this node as being the selected node. + selectNode() { + if (this.nodeDOM.nodeType == 1) + this.nodeDOM.classList.add("ProseMirror-selectednode"); + if (this.contentDOM || !this.node.type.spec.draggable) + this.dom.draggable = true; + } + // Remove selected node marking from this node. + deselectNode() { + if (this.nodeDOM.nodeType == 1) + this.nodeDOM.classList.remove("ProseMirror-selectednode"); + if (this.contentDOM || !this.node.type.spec.draggable) + this.dom.removeAttribute("draggable"); + } + get domAtom() { + return this.node.isAtom; + } + }; + function docViewDesc(doc4, outerDeco, innerDeco, dom, view) { + applyOuterDeco(dom, outerDeco, doc4); + let docView = new NodeViewDesc(void 0, doc4, outerDeco, innerDeco, dom, dom, dom, view, 0); + if (docView.contentDOM) + docView.updateChildren(view, 0); + return docView; + } + var TextViewDesc = class _TextViewDesc extends NodeViewDesc { + constructor(parent, node2, outerDeco, innerDeco, dom, nodeDOM, view) { + super(parent, node2, outerDeco, innerDeco, dom, null, nodeDOM, view, 0); + } + parseRule() { + let skip = this.nodeDOM.parentNode; + while (skip && skip != this.dom && !skip.pmIsDeco) + skip = skip.parentNode; + return { skip: skip || true }; + } + update(node2, outerDeco, innerDeco, view) { + if (this.dirty == NODE_DIRTY || this.dirty != NOT_DIRTY && !this.inParent() || !node2.sameMarkup(this.node)) + return false; + this.updateOuterDeco(outerDeco); + if ((this.dirty != NOT_DIRTY || node2.text != this.node.text) && node2.text != this.nodeDOM.nodeValue) { + this.nodeDOM.nodeValue = node2.text; + if (view.trackWrites == this.nodeDOM) + view.trackWrites = null; + } + this.node = node2; + this.dirty = NOT_DIRTY; + return true; + } + inParent() { + let parentDOM = this.parent.contentDOM; + for (let n4 = this.nodeDOM; n4; n4 = n4.parentNode) + if (n4 == parentDOM) + return true; + return false; + } + domFromPos(pos) { + return { node: this.nodeDOM, offset: pos }; + } + localPosFromDOM(dom, offset, bias) { + if (dom == this.nodeDOM) + return this.posAtStart + Math.min(offset, this.node.text.length); + return super.localPosFromDOM(dom, offset, bias); + } + ignoreMutation(mutation) { + return mutation.type != "characterData" && mutation.type != "selection"; + } + slice(from, to, view) { + let node2 = this.node.cut(from, to), dom = document.createTextNode(node2.text); + return new _TextViewDesc(this.parent, node2, this.outerDeco, this.innerDeco, dom, dom, view); + } + markDirty(from, to) { + super.markDirty(from, to); + if (this.dom != this.nodeDOM && (from == 0 || to == this.nodeDOM.nodeValue.length)) + this.dirty = NODE_DIRTY; + } + get domAtom() { + return false; + } + isText(text5) { + return this.node.text == text5; + } + }; + var TrailingHackViewDesc = class extends ViewDesc { + parseRule() { + return { ignore: true }; + } + matchesHack(nodeName) { + return this.dirty == NOT_DIRTY && this.dom.nodeName == nodeName; + } + get domAtom() { + return true; + } + get ignoreForCoords() { + return this.dom.nodeName == "IMG"; + } + }; + var CustomNodeViewDesc = class extends NodeViewDesc { + constructor(parent, node2, outerDeco, innerDeco, dom, contentDOM, nodeDOM, spec, view, pos) { + super(parent, node2, outerDeco, innerDeco, dom, contentDOM, nodeDOM, view, pos); + this.spec = spec; + } + // A custom `update` method gets to decide whether the update goes + // through. If it does, and there's a `contentDOM` node, our logic + // updates the children. + update(node2, outerDeco, innerDeco, view) { + if (this.dirty == NODE_DIRTY) + return false; + if (this.spec.update) { + let result = this.spec.update(node2, outerDeco, innerDeco); + if (result) + this.updateInner(node2, outerDeco, innerDeco, view); + return result; + } else if (!this.contentDOM && !node2.isLeaf) { + return false; + } else { + return super.update(node2, outerDeco, innerDeco, view); + } + } + selectNode() { + this.spec.selectNode ? this.spec.selectNode() : super.selectNode(); + } + deselectNode() { + this.spec.deselectNode ? this.spec.deselectNode() : super.deselectNode(); + } + setSelection(anchor, head, root2, force) { + this.spec.setSelection ? this.spec.setSelection(anchor, head, root2) : super.setSelection(anchor, head, root2, force); + } + destroy() { + if (this.spec.destroy) + this.spec.destroy(); + super.destroy(); + } + stopEvent(event) { + return this.spec.stopEvent ? this.spec.stopEvent(event) : false; + } + ignoreMutation(mutation) { + return this.spec.ignoreMutation ? this.spec.ignoreMutation(mutation) : super.ignoreMutation(mutation); + } + }; + function renderDescs(parentDOM, descs, view) { + let dom = parentDOM.firstChild, written = false; + for (let i2 = 0; i2 < descs.length; i2++) { + let desc = descs[i2], childDOM = desc.dom; + if (childDOM.parentNode == parentDOM) { + while (childDOM != dom) { + dom = rm(dom); + written = true; + } + dom = dom.nextSibling; + } else { + written = true; + parentDOM.insertBefore(childDOM, dom); + } + if (desc instanceof MarkViewDesc) { + let pos = dom ? dom.previousSibling : parentDOM.lastChild; + renderDescs(desc.contentDOM, desc.children, view); + dom = pos ? pos.nextSibling : parentDOM.firstChild; + } + } + while (dom) { + dom = rm(dom); + written = true; + } + if (written && view.trackWrites == parentDOM) + view.trackWrites = null; + } + var OuterDecoLevel = function(nodeName) { + if (nodeName) + this.nodeName = nodeName; + }; + OuterDecoLevel.prototype = /* @__PURE__ */ Object.create(null); + var noDeco = [new OuterDecoLevel()]; + function computeOuterDeco(outerDeco, node2, needsWrap) { + if (outerDeco.length == 0) + return noDeco; + let top = needsWrap ? noDeco[0] : new OuterDecoLevel(), result = [top]; + for (let i2 = 0; i2 < outerDeco.length; i2++) { + let attrs = outerDeco[i2].type.attrs; + if (!attrs) + continue; + if (attrs.nodeName) + result.push(top = new OuterDecoLevel(attrs.nodeName)); + for (let name in attrs) { + let val = attrs[name]; + if (val == null) + continue; + if (needsWrap && result.length == 1) + result.push(top = new OuterDecoLevel(node2.isInline ? "span" : "div")); + if (name == "class") + top.class = (top.class ? top.class + " " : "") + val; + else if (name == "style") + top.style = (top.style ? top.style + ";" : "") + val; + else if (name != "nodeName") + top[name] = val; + } + } + return result; + } + function patchOuterDeco(outerDOM, nodeDOM, prevComputed, curComputed) { + if (prevComputed == noDeco && curComputed == noDeco) + return nodeDOM; + let curDOM = nodeDOM; + for (let i2 = 0; i2 < curComputed.length; i2++) { + let deco = curComputed[i2], prev = prevComputed[i2]; + if (i2) { + let parent; + if (prev && prev.nodeName == deco.nodeName && curDOM != outerDOM && (parent = curDOM.parentNode) && parent.nodeName.toLowerCase() == deco.nodeName) { + curDOM = parent; + } else { + parent = document.createElement(deco.nodeName); + parent.pmIsDeco = true; + parent.appendChild(curDOM); + prev = noDeco[0]; + curDOM = parent; + } + } + patchAttributes(curDOM, prev || noDeco[0], deco); + } + return curDOM; + } + function patchAttributes(dom, prev, cur) { + for (let name in prev) + if (name != "class" && name != "style" && name != "nodeName" && !(name in cur)) + dom.removeAttribute(name); + for (let name in cur) + if (name != "class" && name != "style" && name != "nodeName" && cur[name] != prev[name]) + dom.setAttribute(name, cur[name]); + if (prev.class != cur.class) { + let prevList = prev.class ? prev.class.split(" ").filter(Boolean) : []; + let curList = cur.class ? cur.class.split(" ").filter(Boolean) : []; + for (let i2 = 0; i2 < prevList.length; i2++) + if (curList.indexOf(prevList[i2]) == -1) + dom.classList.remove(prevList[i2]); + for (let i2 = 0; i2 < curList.length; i2++) + if (prevList.indexOf(curList[i2]) == -1) + dom.classList.add(curList[i2]); + if (dom.classList.length == 0) + dom.removeAttribute("class"); + } + if (prev.style != cur.style) { + if (prev.style) { + let prop = /\s*([\w\-\xa1-\uffff]+)\s*:(?:"(?:\\.|[^"])*"|'(?:\\.|[^'])*'|\(.*?\)|[^;])*/g, m3; + while (m3 = prop.exec(prev.style)) + dom.style.removeProperty(m3[1]); + } + if (cur.style) + dom.style.cssText += cur.style; + } + } + function applyOuterDeco(dom, deco, node2) { + return patchOuterDeco(dom, dom, noDeco, computeOuterDeco(deco, node2, dom.nodeType != 1)); + } + function sameOuterDeco(a2, b4) { + if (a2.length != b4.length) + return false; + for (let i2 = 0; i2 < a2.length; i2++) + if (!a2[i2].type.eq(b4[i2].type)) + return false; + return true; + } + function rm(dom) { + let next = dom.nextSibling; + dom.parentNode.removeChild(dom); + return next; + } + var ViewTreeUpdater = class { + constructor(top, lock, view) { + this.lock = lock; + this.view = view; + this.index = 0; + this.stack = []; + this.changed = false; + this.top = top; + this.preMatch = preMatch(top.node.content, top); + } + // Destroy and remove the children between the given indices in + // `this.top`. + destroyBetween(start, end) { + if (start == end) + return; + for (let i2 = start; i2 < end; i2++) + this.top.children[i2].destroy(); + this.top.children.splice(start, end - start); + this.changed = true; + } + // Destroy all remaining children in `this.top`. + destroyRest() { + this.destroyBetween(this.index, this.top.children.length); + } + // Sync the current stack of mark descs with the given array of + // marks, reusing existing mark descs when possible. + syncToMarks(marks, inline, view) { + let keep = 0, depth = this.stack.length >> 1; + let maxKeep = Math.min(depth, marks.length); + while (keep < maxKeep && (keep == depth - 1 ? this.top : this.stack[keep + 1 << 1]).matchesMark(marks[keep]) && marks[keep].type.spec.spanning !== false) + keep++; + while (keep < depth) { + this.destroyRest(); + this.top.dirty = NOT_DIRTY; + this.index = this.stack.pop(); + this.top = this.stack.pop(); + depth--; + } + while (depth < marks.length) { + this.stack.push(this.top, this.index + 1); + let found2 = -1; + for (let i2 = this.index; i2 < Math.min(this.index + 3, this.top.children.length); i2++) { + let next = this.top.children[i2]; + if (next.matchesMark(marks[depth]) && !this.isLocked(next.dom)) { + found2 = i2; + break; + } + } + if (found2 > -1) { + if (found2 > this.index) { + this.changed = true; + this.destroyBetween(this.index, found2); + } + this.top = this.top.children[this.index]; + } else { + let markDesc = MarkViewDesc.create(this.top, marks[depth], inline, view); + this.top.children.splice(this.index, 0, markDesc); + this.top = markDesc; + this.changed = true; + } + this.index = 0; + depth++; + } + } + // Try to find a node desc matching the given data. Skip over it and + // return true when successful. + findNodeMatch(node2, outerDeco, innerDeco, index2) { + let found2 = -1, targetDesc; + if (index2 >= this.preMatch.index && (targetDesc = this.preMatch.matches[index2 - this.preMatch.index]).parent == this.top && targetDesc.matchesNode(node2, outerDeco, innerDeco)) { + found2 = this.top.children.indexOf(targetDesc, this.index); + } else { + for (let i2 = this.index, e2 = Math.min(this.top.children.length, i2 + 5); i2 < e2; i2++) { + let child = this.top.children[i2]; + if (child.matchesNode(node2, outerDeco, innerDeco) && !this.preMatch.matched.has(child)) { + found2 = i2; + break; + } + } + } + if (found2 < 0) + return false; + this.destroyBetween(this.index, found2); + this.index++; + return true; + } + updateNodeAt(node2, outerDeco, innerDeco, index2, view) { + let child = this.top.children[index2]; + if (child.dirty == NODE_DIRTY && child.dom == child.contentDOM) + child.dirty = CONTENT_DIRTY; + if (!child.update(node2, outerDeco, innerDeco, view)) + return false; + this.destroyBetween(this.index, index2); + this.index++; + return true; + } + findIndexWithChild(domNode) { + for (; ; ) { + let parent = domNode.parentNode; + if (!parent) + return -1; + if (parent == this.top.contentDOM) { + let desc = domNode.pmViewDesc; + if (desc) + for (let i2 = this.index; i2 < this.top.children.length; i2++) { + if (this.top.children[i2] == desc) + return i2; + } + return -1; + } + domNode = parent; + } + } + // Try to update the next node, if any, to the given data. Checks + // pre-matches to avoid overwriting nodes that could still be used. + updateNextNode(node2, outerDeco, innerDeco, view, index2, pos) { + for (let i2 = this.index; i2 < this.top.children.length; i2++) { + let next = this.top.children[i2]; + if (next instanceof NodeViewDesc) { + let preMatch2 = this.preMatch.matched.get(next); + if (preMatch2 != null && preMatch2 != index2) + return false; + let nextDOM = next.dom, updated; + let locked = this.isLocked(nextDOM) && !(node2.isText && next.node && next.node.isText && next.nodeDOM.nodeValue == node2.text && next.dirty != NODE_DIRTY && sameOuterDeco(outerDeco, next.outerDeco)); + if (!locked && next.update(node2, outerDeco, innerDeco, view)) { + this.destroyBetween(this.index, i2); + if (next.dom != nextDOM) + this.changed = true; + this.index++; + return true; + } else if (!locked && (updated = this.recreateWrapper(next, node2, outerDeco, innerDeco, view, pos))) { + this.top.children[this.index] = updated; + if (updated.contentDOM) { + updated.dirty = CONTENT_DIRTY; + updated.updateChildren(view, pos + 1); + updated.dirty = NOT_DIRTY; + } + this.changed = true; + this.index++; + return true; + } + break; + } + } + return false; + } + // When a node with content is replaced by a different node with + // identical content, move over its children. + recreateWrapper(next, node2, outerDeco, innerDeco, view, pos) { + if (next.dirty || node2.isAtom || !next.children.length || !next.node.content.eq(node2.content)) + return null; + let wrapper = NodeViewDesc.create(this.top, node2, outerDeco, innerDeco, view, pos); + if (wrapper.contentDOM) { + wrapper.children = next.children; + next.children = []; + for (let ch of wrapper.children) + ch.parent = wrapper; + } + next.destroy(); + return wrapper; + } + // Insert the node as a newly created node desc. + addNode(node2, outerDeco, innerDeco, view, pos) { + let desc = NodeViewDesc.create(this.top, node2, outerDeco, innerDeco, view, pos); + if (desc.contentDOM) + desc.updateChildren(view, pos + 1); + this.top.children.splice(this.index++, 0, desc); + this.changed = true; + } + placeWidget(widget, view, pos) { + let next = this.index < this.top.children.length ? this.top.children[this.index] : null; + if (next && next.matchesWidget(widget) && (widget == next.widget || !next.widget.type.toDOM.parentNode)) { + this.index++; + } else { + let desc = new WidgetViewDesc(this.top, widget, view, pos); + this.top.children.splice(this.index++, 0, desc); + this.changed = true; + } + } + // Make sure a textblock looks and behaves correctly in + // contentEditable. + addTextblockHacks() { + let lastChild = this.top.children[this.index - 1], parent = this.top; + while (lastChild instanceof MarkViewDesc) { + parent = lastChild; + lastChild = parent.children[parent.children.length - 1]; + } + if (!lastChild || // Empty textblock + !(lastChild instanceof TextViewDesc) || /\n$/.test(lastChild.node.text) || this.view.requiresGeckoHackNode && /\s$/.test(lastChild.node.text)) { + if ((safari || chrome) && lastChild && lastChild.dom.contentEditable == "false") + this.addHackNode("IMG", parent); + this.addHackNode("BR", this.top); + } + } + addHackNode(nodeName, parent) { + if (parent == this.top && this.index < parent.children.length && parent.children[this.index].matchesHack(nodeName)) { + this.index++; + } else { + let dom = document.createElement(nodeName); + if (nodeName == "IMG") { + dom.className = "ProseMirror-separator"; + dom.alt = ""; + } + if (nodeName == "BR") + dom.className = "ProseMirror-trailingBreak"; + let hack = new TrailingHackViewDesc(this.top, [], dom, null); + if (parent != this.top) + parent.children.push(hack); + else + parent.children.splice(this.index++, 0, hack); + this.changed = true; + } + } + isLocked(node2) { + return this.lock && (node2 == this.lock || node2.nodeType == 1 && node2.contains(this.lock.parentNode)); + } + }; + function preMatch(frag, parentDesc) { + let curDesc = parentDesc, descI = curDesc.children.length; + let fI = frag.childCount, matched = /* @__PURE__ */ new Map(), matches2 = []; + outer: while (fI > 0) { + let desc; + for (; ; ) { + if (descI) { + let next = curDesc.children[descI - 1]; + if (next instanceof MarkViewDesc) { + curDesc = next; + descI = next.children.length; + } else { + desc = next; + descI--; + break; + } + } else if (curDesc == parentDesc) { + break outer; + } else { + descI = curDesc.parent.children.indexOf(curDesc); + curDesc = curDesc.parent; + } + } + let node2 = desc.node; + if (!node2) + continue; + if (node2 != frag.child(fI - 1)) + break; + --fI; + matched.set(desc, fI); + matches2.push(desc); + } + return { index: fI, matched, matches: matches2.reverse() }; + } + function compareSide(a2, b4) { + return a2.type.side - b4.type.side; + } + function iterDeco(parent, deco, onWidget, onNode) { + let locals = deco.locals(parent), offset = 0; + if (locals.length == 0) { + for (let i2 = 0; i2 < parent.childCount; i2++) { + let child = parent.child(i2); + onNode(child, locals, deco.forChild(offset, child), i2); + offset += child.nodeSize; + } + return; + } + let decoIndex = 0, active = [], restNode = null; + for (let parentIndex = 0; ; ) { + let widget, widgets; + while (decoIndex < locals.length && locals[decoIndex].to == offset) { + let next = locals[decoIndex++]; + if (next.widget) { + if (!widget) + widget = next; + else + (widgets || (widgets = [widget])).push(next); + } + } + if (widget) { + if (widgets) { + widgets.sort(compareSide); + for (let i2 = 0; i2 < widgets.length; i2++) + onWidget(widgets[i2], parentIndex, !!restNode); + } else { + onWidget(widget, parentIndex, !!restNode); + } + } + let child, index2; + if (restNode) { + index2 = -1; + child = restNode; + restNode = null; + } else if (parentIndex < parent.childCount) { + index2 = parentIndex; + child = parent.child(parentIndex++); + } else { + break; + } + for (let i2 = 0; i2 < active.length; i2++) + if (active[i2].to <= offset) + active.splice(i2--, 1); + while (decoIndex < locals.length && locals[decoIndex].from <= offset && locals[decoIndex].to > offset) + active.push(locals[decoIndex++]); + let end = offset + child.nodeSize; + if (child.isText) { + let cutAt = end; + if (decoIndex < locals.length && locals[decoIndex].from < cutAt) + cutAt = locals[decoIndex].from; + for (let i2 = 0; i2 < active.length; i2++) + if (active[i2].to < cutAt) + cutAt = active[i2].to; + if (cutAt < end) { + restNode = child.cut(cutAt - offset); + child = child.cut(0, cutAt - offset); + end = cutAt; + index2 = -1; + } + } else { + while (decoIndex < locals.length && locals[decoIndex].to < end) + decoIndex++; + } + let outerDeco = child.isInline && !child.isLeaf ? active.filter((d6) => !d6.inline) : active.slice(); + onNode(child, outerDeco, deco.forChild(offset, child), index2); + offset = end; + } + } + function iosHacks(dom) { + if (dom.nodeName == "UL" || dom.nodeName == "OL") { + let oldCSS = dom.style.cssText; + dom.style.cssText = oldCSS + "; list-style: square !important"; + window.getComputedStyle(dom).listStyle; + dom.style.cssText = oldCSS; + } + } + function findTextInFragment(frag, text5, from, to) { + for (let i2 = 0, pos = 0; i2 < frag.childCount && pos <= to; ) { + let child = frag.child(i2++), childStart = pos; + pos += child.nodeSize; + if (!child.isText) + continue; + let str = child.text; + while (i2 < frag.childCount) { + let next = frag.child(i2++); + pos += next.nodeSize; + if (!next.isText) + break; + str += next.text; + } + if (pos >= from) { + if (pos >= to && str.slice(to - text5.length - childStart, to - childStart) == text5) + return to - text5.length; + let found2 = childStart < to ? str.lastIndexOf(text5, to - childStart - 1) : -1; + if (found2 >= 0 && found2 + text5.length + childStart >= from) + return childStart + found2; + if (from == to && str.length >= to + text5.length - childStart && str.slice(to - childStart, to - childStart + text5.length) == text5) + return to; + } + } + return -1; + } + function replaceNodes(nodes, from, to, view, replacement) { + let result = []; + for (let i2 = 0, off = 0; i2 < nodes.length; i2++) { + let child = nodes[i2], start = off, end = off += child.size; + if (start >= to || end <= from) { + result.push(child); + } else { + if (start < from) + result.push(child.slice(0, from - start, view)); + if (replacement) { + result.push(replacement); + replacement = void 0; + } + if (end > to) + result.push(child.slice(to - start, child.size, view)); + } + } + return result; + } + function selectionFromDOM(view, origin = null) { + let domSel = view.domSelectionRange(), doc4 = view.state.doc; + if (!domSel.focusNode) + return null; + let nearestDesc = view.docView.nearestDesc(domSel.focusNode), inWidget = nearestDesc && nearestDesc.size == 0; + let head = view.docView.posFromDOM(domSel.focusNode, domSel.focusOffset, 1); + if (head < 0) + return null; + let $head = doc4.resolve(head), $anchor, selection; + if (selectionCollapsed(domSel)) { + $anchor = $head; + while (nearestDesc && !nearestDesc.node) + nearestDesc = nearestDesc.parent; + let nearestDescNode = nearestDesc.node; + if (nearestDesc && nearestDescNode.isAtom && NodeSelection.isSelectable(nearestDescNode) && nearestDesc.parent && !(nearestDescNode.isInline && isOnEdge(domSel.focusNode, domSel.focusOffset, nearestDesc.dom))) { + let pos = nearestDesc.posBefore; + selection = new NodeSelection(head == pos ? $head : doc4.resolve(pos)); + } + } else { + let anchor = view.docView.posFromDOM(domSel.anchorNode, domSel.anchorOffset, 1); + if (anchor < 0) + return null; + $anchor = doc4.resolve(anchor); + } + if (!selection) { + let bias = origin == "pointer" || view.state.selection.head < $head.pos && !inWidget ? 1 : -1; + selection = selectionBetween(view, $anchor, $head, bias); + } + return selection; + } + function editorOwnsSelection(view) { + return view.editable ? view.hasFocus() : hasSelection(view) && document.activeElement && document.activeElement.contains(view.dom); + } + function selectionToDOM(view, force = false) { + let sel = view.state.selection; + syncNodeSelection(view, sel); + if (!editorOwnsSelection(view)) + return; + if (!force && view.input.mouseDown && view.input.mouseDown.allowDefault && chrome) { + let domSel = view.domSelectionRange(), curSel = view.domObserver.currentSelection; + if (domSel.anchorNode && curSel.anchorNode && isEquivalentPosition(domSel.anchorNode, domSel.anchorOffset, curSel.anchorNode, curSel.anchorOffset)) { + view.input.mouseDown.delayedSelectionSync = true; + view.domObserver.setCurSelection(); + return; + } + } + view.domObserver.disconnectSelection(); + if (view.cursorWrapper) { + selectCursorWrapper(view); + } else { + let { anchor, head } = sel, resetEditableFrom, resetEditableTo; + if (brokenSelectBetweenUneditable && !(sel instanceof TextSelection)) { + if (!sel.$from.parent.inlineContent) + resetEditableFrom = temporarilyEditableNear(view, sel.from); + if (!sel.empty && !sel.$from.parent.inlineContent) + resetEditableTo = temporarilyEditableNear(view, sel.to); + } + view.docView.setSelection(anchor, head, view.root, force); + if (brokenSelectBetweenUneditable) { + if (resetEditableFrom) + resetEditable(resetEditableFrom); + if (resetEditableTo) + resetEditable(resetEditableTo); + } + if (sel.visible) { + view.dom.classList.remove("ProseMirror-hideselection"); + } else { + view.dom.classList.add("ProseMirror-hideselection"); + if ("onselectionchange" in document) + removeClassOnSelectionChange(view); + } + } + view.domObserver.setCurSelection(); + view.domObserver.connectSelection(); + } + var brokenSelectBetweenUneditable = safari || chrome && chrome_version < 63; + function temporarilyEditableNear(view, pos) { + let { node: node2, offset } = view.docView.domFromPos(pos, 0); + let after = offset < node2.childNodes.length ? node2.childNodes[offset] : null; + let before = offset ? node2.childNodes[offset - 1] : null; + if (safari && after && after.contentEditable == "false") + return setEditable(after); + if ((!after || after.contentEditable == "false") && (!before || before.contentEditable == "false")) { + if (after) + return setEditable(after); + else if (before) + return setEditable(before); + } + } + function setEditable(element2) { + element2.contentEditable = "true"; + if (safari && element2.draggable) { + element2.draggable = false; + element2.wasDraggable = true; + } + return element2; + } + function resetEditable(element2) { + element2.contentEditable = "false"; + if (element2.wasDraggable) { + element2.draggable = true; + element2.wasDraggable = null; + } + } + function removeClassOnSelectionChange(view) { + let doc4 = view.dom.ownerDocument; + doc4.removeEventListener("selectionchange", view.input.hideSelectionGuard); + let domSel = view.domSelectionRange(); + let node2 = domSel.anchorNode, offset = domSel.anchorOffset; + doc4.addEventListener("selectionchange", view.input.hideSelectionGuard = () => { + if (domSel.anchorNode != node2 || domSel.anchorOffset != offset) { + doc4.removeEventListener("selectionchange", view.input.hideSelectionGuard); + setTimeout(() => { + if (!editorOwnsSelection(view) || view.state.selection.visible) + view.dom.classList.remove("ProseMirror-hideselection"); + }, 20); + } + }); + } + function selectCursorWrapper(view) { + let domSel = view.domSelection(), range = document.createRange(); + let node2 = view.cursorWrapper.dom, img = node2.nodeName == "IMG"; + if (img) + range.setEnd(node2.parentNode, domIndex(node2) + 1); + else + range.setEnd(node2, 0); + range.collapse(false); + domSel.removeAllRanges(); + domSel.addRange(range); + if (!img && !view.state.selection.visible && ie && ie_version <= 11) { + node2.disabled = true; + node2.disabled = false; + } + } + function syncNodeSelection(view, sel) { + if (sel instanceof NodeSelection) { + let desc = view.docView.descAt(sel.from); + if (desc != view.lastSelectedViewDesc) { + clearNodeSelection(view); + if (desc) + desc.selectNode(); + view.lastSelectedViewDesc = desc; + } + } else { + clearNodeSelection(view); + } + } + function clearNodeSelection(view) { + if (view.lastSelectedViewDesc) { + if (view.lastSelectedViewDesc.parent) + view.lastSelectedViewDesc.deselectNode(); + view.lastSelectedViewDesc = void 0; + } + } + function selectionBetween(view, $anchor, $head, bias) { + return view.someProp("createSelectionBetween", (f3) => f3(view, $anchor, $head)) || TextSelection.between($anchor, $head, bias); + } + function hasFocusAndSelection(view) { + if (view.editable && !view.hasFocus()) + return false; + return hasSelection(view); + } + function hasSelection(view) { + let sel = view.domSelectionRange(); + if (!sel.anchorNode) + return false; + try { + return view.dom.contains(sel.anchorNode.nodeType == 3 ? sel.anchorNode.parentNode : sel.anchorNode) && (view.editable || view.dom.contains(sel.focusNode.nodeType == 3 ? sel.focusNode.parentNode : sel.focusNode)); + } catch (_3) { + return false; + } + } + function anchorInRightPlace(view) { + let anchorDOM = view.docView.domFromPos(view.state.selection.anchor, 0); + let domSel = view.domSelectionRange(); + return isEquivalentPosition(anchorDOM.node, anchorDOM.offset, domSel.anchorNode, domSel.anchorOffset); + } + function moveSelectionBlock(state, dir) { + let { $anchor, $head } = state.selection; + let $side = dir > 0 ? $anchor.max($head) : $anchor.min($head); + let $start = !$side.parent.inlineContent ? $side : $side.depth ? state.doc.resolve(dir > 0 ? $side.after() : $side.before()) : null; + return $start && Selection.findFrom($start, dir); + } + function apply(view, sel) { + view.dispatch(view.state.tr.setSelection(sel).scrollIntoView()); + return true; + } + function selectHorizontally(view, dir, mods) { + let sel = view.state.selection; + if (sel instanceof TextSelection) { + if (mods.indexOf("s") > -1) { + let { $head } = sel, node2 = $head.textOffset ? null : dir < 0 ? $head.nodeBefore : $head.nodeAfter; + if (!node2 || node2.isText || !node2.isLeaf) + return false; + let $newHead = view.state.doc.resolve($head.pos + node2.nodeSize * (dir < 0 ? -1 : 1)); + return apply(view, new TextSelection(sel.$anchor, $newHead)); + } else if (!sel.empty) { + return false; + } else if (view.endOfTextblock(dir > 0 ? "forward" : "backward")) { + let next = moveSelectionBlock(view.state, dir); + if (next && next instanceof NodeSelection) + return apply(view, next); + return false; + } else if (!(mac && mods.indexOf("m") > -1)) { + let $head = sel.$head, node2 = $head.textOffset ? null : dir < 0 ? $head.nodeBefore : $head.nodeAfter, desc; + if (!node2 || node2.isText) + return false; + let nodePos = dir < 0 ? $head.pos - node2.nodeSize : $head.pos; + if (!(node2.isAtom || (desc = view.docView.descAt(nodePos)) && !desc.contentDOM)) + return false; + if (NodeSelection.isSelectable(node2)) { + return apply(view, new NodeSelection(dir < 0 ? view.state.doc.resolve($head.pos - node2.nodeSize) : $head)); + } else if (webkit) { + return apply(view, new TextSelection(view.state.doc.resolve(dir < 0 ? nodePos : nodePos + node2.nodeSize))); + } else { + return false; + } + } + } else if (sel instanceof NodeSelection && sel.node.isInline) { + return apply(view, new TextSelection(dir > 0 ? sel.$to : sel.$from)); + } else { + let next = moveSelectionBlock(view.state, dir); + if (next) + return apply(view, next); + return false; + } + } + function nodeLen(node2) { + return node2.nodeType == 3 ? node2.nodeValue.length : node2.childNodes.length; + } + function isIgnorable(dom, dir) { + let desc = dom.pmViewDesc; + return desc && desc.size == 0 && (dir < 0 || dom.nextSibling || dom.nodeName != "BR"); + } + function skipIgnoredNodes(view, dir) { + return dir < 0 ? skipIgnoredNodesBefore(view) : skipIgnoredNodesAfter(view); + } + function skipIgnoredNodesBefore(view) { + let sel = view.domSelectionRange(); + let node2 = sel.focusNode, offset = sel.focusOffset; + if (!node2) + return; + let moveNode, moveOffset, force = false; + if (gecko && node2.nodeType == 1 && offset < nodeLen(node2) && isIgnorable(node2.childNodes[offset], -1)) + force = true; + for (; ; ) { + if (offset > 0) { + if (node2.nodeType != 1) { + break; + } else { + let before = node2.childNodes[offset - 1]; + if (isIgnorable(before, -1)) { + moveNode = node2; + moveOffset = --offset; + } else if (before.nodeType == 3) { + node2 = before; + offset = node2.nodeValue.length; + } else + break; + } + } else if (isBlockNode(node2)) { + break; + } else { + let prev = node2.previousSibling; + while (prev && isIgnorable(prev, -1)) { + moveNode = node2.parentNode; + moveOffset = domIndex(prev); + prev = prev.previousSibling; + } + if (!prev) { + node2 = node2.parentNode; + if (node2 == view.dom) + break; + offset = 0; + } else { + node2 = prev; + offset = nodeLen(node2); + } + } + } + if (force) + setSelFocus(view, node2, offset); + else if (moveNode) + setSelFocus(view, moveNode, moveOffset); + } + function skipIgnoredNodesAfter(view) { + let sel = view.domSelectionRange(); + let node2 = sel.focusNode, offset = sel.focusOffset; + if (!node2) + return; + let len = nodeLen(node2); + let moveNode, moveOffset; + for (; ; ) { + if (offset < len) { + if (node2.nodeType != 1) + break; + let after = node2.childNodes[offset]; + if (isIgnorable(after, 1)) { + moveNode = node2; + moveOffset = ++offset; + } else + break; + } else if (isBlockNode(node2)) { + break; + } else { + let next = node2.nextSibling; + while (next && isIgnorable(next, 1)) { + moveNode = next.parentNode; + moveOffset = domIndex(next) + 1; + next = next.nextSibling; + } + if (!next) { + node2 = node2.parentNode; + if (node2 == view.dom) + break; + offset = len = 0; + } else { + node2 = next; + offset = 0; + len = nodeLen(node2); + } + } + } + if (moveNode) + setSelFocus(view, moveNode, moveOffset); + } + function isBlockNode(dom) { + let desc = dom.pmViewDesc; + return desc && desc.node && desc.node.isBlock; + } + function textNodeAfter(node2, offset) { + while (node2 && offset == node2.childNodes.length && !hasBlockDesc(node2)) { + offset = domIndex(node2) + 1; + node2 = node2.parentNode; + } + while (node2 && offset < node2.childNodes.length) { + let next = node2.childNodes[offset]; + if (next.nodeType == 3) + return next; + if (next.nodeType == 1 && next.contentEditable == "false") + break; + node2 = next; + offset = 0; + } + } + function textNodeBefore(node2, offset) { + while (node2 && !offset && !hasBlockDesc(node2)) { + offset = domIndex(node2); + node2 = node2.parentNode; + } + while (node2 && offset) { + let next = node2.childNodes[offset - 1]; + if (next.nodeType == 3) + return next; + if (next.nodeType == 1 && next.contentEditable == "false") + break; + node2 = next; + offset = node2.childNodes.length; + } + } + function setSelFocus(view, node2, offset) { + if (node2.nodeType != 3) { + let before, after; + if (after = textNodeAfter(node2, offset)) { + node2 = after; + offset = 0; + } else if (before = textNodeBefore(node2, offset)) { + node2 = before; + offset = before.nodeValue.length; + } + } + let sel = view.domSelection(); + if (selectionCollapsed(sel)) { + let range = document.createRange(); + range.setEnd(node2, offset); + range.setStart(node2, offset); + sel.removeAllRanges(); + sel.addRange(range); + } else if (sel.extend) { + sel.extend(node2, offset); + } + view.domObserver.setCurSelection(); + let { state } = view; + setTimeout(() => { + if (view.state == state) + selectionToDOM(view); + }, 50); + } + function findDirection(view, pos) { + let $pos = view.state.doc.resolve(pos); + if (!(chrome || windows) && $pos.parent.inlineContent) { + let coords = view.coordsAtPos(pos); + if (pos > $pos.start()) { + let before = view.coordsAtPos(pos - 1); + let mid = (before.top + before.bottom) / 2; + if (mid > coords.top && mid < coords.bottom && Math.abs(before.left - coords.left) > 1) + return before.left < coords.left ? "ltr" : "rtl"; + } + if (pos < $pos.end()) { + let after = view.coordsAtPos(pos + 1); + let mid = (after.top + after.bottom) / 2; + if (mid > coords.top && mid < coords.bottom && Math.abs(after.left - coords.left) > 1) + return after.left > coords.left ? "ltr" : "rtl"; + } + } + let computed = getComputedStyle(view.dom).direction; + return computed == "rtl" ? "rtl" : "ltr"; + } + function selectVertically(view, dir, mods) { + let sel = view.state.selection; + if (sel instanceof TextSelection && !sel.empty || mods.indexOf("s") > -1) + return false; + if (mac && mods.indexOf("m") > -1) + return false; + let { $from, $to } = sel; + if (!$from.parent.inlineContent || view.endOfTextblock(dir < 0 ? "up" : "down")) { + let next = moveSelectionBlock(view.state, dir); + if (next && next instanceof NodeSelection) + return apply(view, next); + } + if (!$from.parent.inlineContent) { + let side = dir < 0 ? $from : $to; + let beyond = sel instanceof AllSelection ? Selection.near(side, dir) : Selection.findFrom(side, dir); + return beyond ? apply(view, beyond) : false; + } + return false; + } + function stopNativeHorizontalDelete(view, dir) { + if (!(view.state.selection instanceof TextSelection)) + return true; + let { $head, $anchor, empty: empty3 } = view.state.selection; + if (!$head.sameParent($anchor)) + return true; + if (!empty3) + return false; + if (view.endOfTextblock(dir > 0 ? "forward" : "backward")) + return true; + let nextNode = !$head.textOffset && (dir < 0 ? $head.nodeBefore : $head.nodeAfter); + if (nextNode && !nextNode.isText) { + let tr = view.state.tr; + if (dir < 0) + tr.delete($head.pos - nextNode.nodeSize, $head.pos); + else + tr.delete($head.pos, $head.pos + nextNode.nodeSize); + view.dispatch(tr); + return true; + } + return false; + } + function switchEditable(view, node2, state) { + view.domObserver.stop(); + node2.contentEditable = state; + view.domObserver.start(); + } + function safariDownArrowBug(view) { + if (!safari || view.state.selection.$head.parentOffset > 0) + return false; + let { focusNode, focusOffset } = view.domSelectionRange(); + if (focusNode && focusNode.nodeType == 1 && focusOffset == 0 && focusNode.firstChild && focusNode.firstChild.contentEditable == "false") { + let child = focusNode.firstChild; + switchEditable(view, child, "true"); + setTimeout(() => switchEditable(view, child, "false"), 20); + } + return false; + } + function getMods(event) { + let result = ""; + if (event.ctrlKey) + result += "c"; + if (event.metaKey) + result += "m"; + if (event.altKey) + result += "a"; + if (event.shiftKey) + result += "s"; + return result; + } + function captureKeyDown(view, event) { + let code3 = event.keyCode, mods = getMods(event); + if (code3 == 8 || mac && code3 == 72 && mods == "c") { + return stopNativeHorizontalDelete(view, -1) || skipIgnoredNodes(view, -1); + } else if (code3 == 46 && !event.shiftKey || mac && code3 == 68 && mods == "c") { + return stopNativeHorizontalDelete(view, 1) || skipIgnoredNodes(view, 1); + } else if (code3 == 13 || code3 == 27) { + return true; + } else if (code3 == 37 || mac && code3 == 66 && mods == "c") { + let dir = code3 == 37 ? findDirection(view, view.state.selection.from) == "ltr" ? -1 : 1 : -1; + return selectHorizontally(view, dir, mods) || skipIgnoredNodes(view, dir); + } else if (code3 == 39 || mac && code3 == 70 && mods == "c") { + let dir = code3 == 39 ? findDirection(view, view.state.selection.from) == "ltr" ? 1 : -1 : 1; + return selectHorizontally(view, dir, mods) || skipIgnoredNodes(view, dir); + } else if (code3 == 38 || mac && code3 == 80 && mods == "c") { + return selectVertically(view, -1, mods) || skipIgnoredNodes(view, -1); + } else if (code3 == 40 || mac && code3 == 78 && mods == "c") { + return safariDownArrowBug(view) || selectVertically(view, 1, mods) || skipIgnoredNodes(view, 1); + } else if (mods == (mac ? "m" : "c") && (code3 == 66 || code3 == 73 || code3 == 89 || code3 == 90)) { + return true; + } + return false; + } + function serializeForClipboard(view, slice) { + view.someProp("transformCopied", (f3) => { + slice = f3(slice, view); + }); + let context = [], { content: content3, openStart, openEnd } = slice; + while (openStart > 1 && openEnd > 1 && content3.childCount == 1 && content3.firstChild.childCount == 1) { + openStart--; + openEnd--; + let node2 = content3.firstChild; + context.push(node2.type.name, node2.attrs != node2.type.defaultAttrs ? node2.attrs : null); + content3 = node2.content; + } + let serializer = view.someProp("clipboardSerializer") || DOMSerializer.fromSchema(view.state.schema); + let doc4 = detachedDoc(), wrap3 = doc4.createElement("div"); + wrap3.appendChild(serializer.serializeFragment(content3, { document: doc4 })); + let firstChild = wrap3.firstChild, needsWrap, wrappers = 0; + while (firstChild && firstChild.nodeType == 1 && (needsWrap = wrapMap[firstChild.nodeName.toLowerCase()])) { + for (let i2 = needsWrap.length - 1; i2 >= 0; i2--) { + let wrapper = doc4.createElement(needsWrap[i2]); + while (wrap3.firstChild) + wrapper.appendChild(wrap3.firstChild); + wrap3.appendChild(wrapper); + wrappers++; + } + firstChild = wrap3.firstChild; + } + if (firstChild && firstChild.nodeType == 1) + firstChild.setAttribute("data-pm-slice", `${openStart} ${openEnd}${wrappers ? ` -${wrappers}` : ""} ${JSON.stringify(context)}`); + let text5 = view.someProp("clipboardTextSerializer", (f3) => f3(slice, view)) || slice.content.textBetween(0, slice.content.size, "\n\n"); + return { dom: wrap3, text: text5, slice }; + } + function parseFromClipboard(view, text5, html3, plainText, $context) { + let inCode = $context.parent.type.spec.code; + let dom, slice; + if (!html3 && !text5) + return null; + let asText = text5 && (plainText || inCode || !html3); + if (asText) { + view.someProp("transformPastedText", (f3) => { + text5 = f3(text5, inCode || plainText, view); + }); + if (inCode) + return text5 ? new Slice(Fragment.from(view.state.schema.text(text5.replace(/\r\n?/g, "\n"))), 0, 0) : Slice.empty; + let parsed = view.someProp("clipboardTextParser", (f3) => f3(text5, $context, plainText, view)); + if (parsed) { + slice = parsed; + } else { + let marks = $context.marks(); + let { schema } = view.state, serializer = DOMSerializer.fromSchema(schema); + dom = document.createElement("div"); + text5.split(/(?:\r\n?|\n)+/).forEach((block) => { + let p4 = dom.appendChild(document.createElement("p")); + if (block) + p4.appendChild(serializer.serializeNode(schema.text(block, marks))); + }); + } + } else { + view.someProp("transformPastedHTML", (f3) => { + html3 = f3(html3, view); + }); + dom = readHTML(html3); + if (webkit) + restoreReplacedSpaces(dom); + } + let contextNode = dom && dom.querySelector("[data-pm-slice]"); + let sliceData = contextNode && /^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(contextNode.getAttribute("data-pm-slice") || ""); + if (sliceData && sliceData[3]) + for (let i2 = +sliceData[3]; i2 > 0; i2--) { + let child = dom.firstChild; + while (child && child.nodeType != 1) + child = child.nextSibling; + if (!child) + break; + dom = child; + } + if (!slice) { + let parser = view.someProp("clipboardParser") || view.someProp("domParser") || DOMParser.fromSchema(view.state.schema); + slice = parser.parseSlice(dom, { + preserveWhitespace: !!(asText || sliceData), + context: $context, + ruleFromNode(dom2) { + if (dom2.nodeName == "BR" && !dom2.nextSibling && dom2.parentNode && !inlineParents.test(dom2.parentNode.nodeName)) + return { ignore: true }; + return null; + } + }); + } + if (sliceData) { + slice = addContext(closeSlice(slice, +sliceData[1], +sliceData[2]), sliceData[4]); + } else { + slice = Slice.maxOpen(normalizeSiblings(slice.content, $context), true); + if (slice.openStart || slice.openEnd) { + let openStart = 0, openEnd = 0; + for (let node2 = slice.content.firstChild; openStart < slice.openStart && !node2.type.spec.isolating; openStart++, node2 = node2.firstChild) { + } + for (let node2 = slice.content.lastChild; openEnd < slice.openEnd && !node2.type.spec.isolating; openEnd++, node2 = node2.lastChild) { + } + slice = closeSlice(slice, openStart, openEnd); + } + } + view.someProp("transformPasted", (f3) => { + slice = f3(slice, view); + }); + return slice; + } + var inlineParents = /^(a|abbr|acronym|b|cite|code|del|em|i|ins|kbd|label|output|q|ruby|s|samp|span|strong|sub|sup|time|u|tt|var)$/i; + function normalizeSiblings(fragment, $context) { + if (fragment.childCount < 2) + return fragment; + for (let d6 = $context.depth; d6 >= 0; d6--) { + let parent = $context.node(d6); + let match = parent.contentMatchAt($context.index(d6)); + let lastWrap, result = []; + fragment.forEach((node2) => { + if (!result) + return; + let wrap3 = match.findWrapping(node2.type), inLast; + if (!wrap3) + return result = null; + if (inLast = result.length && lastWrap.length && addToSibling(wrap3, lastWrap, node2, result[result.length - 1], 0)) { + result[result.length - 1] = inLast; + } else { + if (result.length) + result[result.length - 1] = closeRight(result[result.length - 1], lastWrap.length); + let wrapped = withWrappers(node2, wrap3); + result.push(wrapped); + match = match.matchType(wrapped.type); + lastWrap = wrap3; + } + }); + if (result) + return Fragment.from(result); + } + return fragment; + } + function withWrappers(node2, wrap3, from = 0) { + for (let i2 = wrap3.length - 1; i2 >= from; i2--) + node2 = wrap3[i2].create(null, Fragment.from(node2)); + return node2; + } + function addToSibling(wrap3, lastWrap, node2, sibling, depth) { + if (depth < wrap3.length && depth < lastWrap.length && wrap3[depth] == lastWrap[depth]) { + let inner = addToSibling(wrap3, lastWrap, node2, sibling.lastChild, depth + 1); + if (inner) + return sibling.copy(sibling.content.replaceChild(sibling.childCount - 1, inner)); + let match = sibling.contentMatchAt(sibling.childCount); + if (match.matchType(depth == wrap3.length - 1 ? node2.type : wrap3[depth + 1])) + return sibling.copy(sibling.content.append(Fragment.from(withWrappers(node2, wrap3, depth + 1)))); + } + } + function closeRight(node2, depth) { + if (depth == 0) + return node2; + let fragment = node2.content.replaceChild(node2.childCount - 1, closeRight(node2.lastChild, depth - 1)); + let fill = node2.contentMatchAt(node2.childCount).fillBefore(Fragment.empty, true); + return node2.copy(fragment.append(fill)); + } + function closeRange(fragment, side, from, to, depth, openEnd) { + let node2 = side < 0 ? fragment.firstChild : fragment.lastChild, inner = node2.content; + if (fragment.childCount > 1) + openEnd = 0; + if (depth < to - 1) + inner = closeRange(inner, side, from, to, depth + 1, openEnd); + if (depth >= from) + inner = side < 0 ? node2.contentMatchAt(0).fillBefore(inner, openEnd <= depth).append(inner) : inner.append(node2.contentMatchAt(node2.childCount).fillBefore(Fragment.empty, true)); + return fragment.replaceChild(side < 0 ? 0 : fragment.childCount - 1, node2.copy(inner)); + } + function closeSlice(slice, openStart, openEnd) { + if (openStart < slice.openStart) + slice = new Slice(closeRange(slice.content, -1, openStart, slice.openStart, 0, slice.openEnd), openStart, slice.openEnd); + if (openEnd < slice.openEnd) + slice = new Slice(closeRange(slice.content, 1, openEnd, slice.openEnd, 0, 0), slice.openStart, openEnd); + return slice; + } + var wrapMap = { + thead: ["table"], + tbody: ["table"], + tfoot: ["table"], + caption: ["table"], + colgroup: ["table"], + col: ["table", "colgroup"], + tr: ["table", "tbody"], + td: ["table", "tbody", "tr"], + th: ["table", "tbody", "tr"] + }; + var _detachedDoc = null; + function detachedDoc() { + return _detachedDoc || (_detachedDoc = document.implementation.createHTMLDocument("title")); + } + function readHTML(html3) { + let metas = /^(\s*]*>)*/.exec(html3); + if (metas) + html3 = html3.slice(metas[0].length); + let elt = detachedDoc().createElement("div"); + let firstTag = /<([a-z][^>\s]+)/i.exec(html3), wrap3; + if (wrap3 = firstTag && wrapMap[firstTag[1].toLowerCase()]) + html3 = wrap3.map((n4) => "<" + n4 + ">").join("") + html3 + wrap3.map((n4) => "").reverse().join(""); + elt.innerHTML = html3; + if (wrap3) + for (let i2 = 0; i2 < wrap3.length; i2++) + elt = elt.querySelector(wrap3[i2]) || elt; + return elt; + } + function restoreReplacedSpaces(dom) { + let nodes = dom.querySelectorAll(chrome ? "span:not([class]):not([style])" : "span.Apple-converted-space"); + for (let i2 = 0; i2 < nodes.length; i2++) { + let node2 = nodes[i2]; + if (node2.childNodes.length == 1 && node2.textContent == "\xA0" && node2.parentNode) + node2.parentNode.replaceChild(dom.ownerDocument.createTextNode(" "), node2); + } + } + function addContext(slice, context) { + if (!slice.size) + return slice; + let schema = slice.content.firstChild.type.schema, array; + try { + array = JSON.parse(context); + } catch (e2) { + return slice; + } + let { content: content3, openStart, openEnd } = slice; + for (let i2 = array.length - 2; i2 >= 0; i2 -= 2) { + let type = schema.nodes[array[i2]]; + if (!type || type.hasRequiredAttrs()) + break; + content3 = Fragment.from(type.create(array[i2 + 1], content3)); + openStart++; + openEnd++; + } + return new Slice(content3, openStart, openEnd); + } + var handlers = {}; + var editHandlers = {}; + var passiveHandlers = { touchstart: true, touchmove: true }; + var InputState = class { + constructor() { + this.shiftKey = false; + this.mouseDown = null; + this.lastKeyCode = null; + this.lastKeyCodeTime = 0; + this.lastClick = { time: 0, x: 0, y: 0, type: "" }; + this.lastSelectionOrigin = null; + this.lastSelectionTime = 0; + this.lastIOSEnter = 0; + this.lastIOSEnterFallbackTimeout = -1; + this.lastFocus = 0; + this.lastTouch = 0; + this.lastAndroidDelete = 0; + this.composing = false; + this.compositionNode = null; + this.composingTimeout = -1; + this.compositionNodes = []; + this.compositionEndedAt = -2e8; + this.compositionID = 1; + this.compositionPendingChanges = 0; + this.domChangeCount = 0; + this.eventHandlers = /* @__PURE__ */ Object.create(null); + this.hideSelectionGuard = null; + } + }; + function initInput(view) { + for (let event in handlers) { + let handler = handlers[event]; + view.dom.addEventListener(event, view.input.eventHandlers[event] = (event2) => { + if (eventBelongsToView(view, event2) && !runCustomHandler(view, event2) && (view.editable || !(event2.type in editHandlers))) + handler(view, event2); + }, passiveHandlers[event] ? { passive: true } : void 0); + } + if (safari) + view.dom.addEventListener("input", () => null); + ensureListeners(view); + } + function setSelectionOrigin(view, origin) { + view.input.lastSelectionOrigin = origin; + view.input.lastSelectionTime = Date.now(); + } + function destroyInput(view) { + view.domObserver.stop(); + for (let type in view.input.eventHandlers) + view.dom.removeEventListener(type, view.input.eventHandlers[type]); + clearTimeout(view.input.composingTimeout); + clearTimeout(view.input.lastIOSEnterFallbackTimeout); + } + function ensureListeners(view) { + view.someProp("handleDOMEvents", (currentHandlers) => { + for (let type in currentHandlers) + if (!view.input.eventHandlers[type]) + view.dom.addEventListener(type, view.input.eventHandlers[type] = (event) => runCustomHandler(view, event)); + }); + } + function runCustomHandler(view, event) { + return view.someProp("handleDOMEvents", (handlers2) => { + let handler = handlers2[event.type]; + return handler ? handler(view, event) || event.defaultPrevented : false; + }); + } + function eventBelongsToView(view, event) { + if (!event.bubbles) + return true; + if (event.defaultPrevented) + return false; + for (let node2 = event.target; node2 != view.dom; node2 = node2.parentNode) + if (!node2 || node2.nodeType == 11 || node2.pmViewDesc && node2.pmViewDesc.stopEvent(event)) + return false; + return true; + } + function dispatchEvent2(view, event) { + if (!runCustomHandler(view, event) && handlers[event.type] && (view.editable || !(event.type in editHandlers))) + handlers[event.type](view, event); + } + editHandlers.keydown = (view, _event) => { + let event = _event; + view.input.shiftKey = event.keyCode == 16 || event.shiftKey; + if (inOrNearComposition(view, event)) + return; + view.input.lastKeyCode = event.keyCode; + view.input.lastKeyCodeTime = Date.now(); + if (android && chrome && event.keyCode == 13) + return; + if (event.keyCode != 229) + view.domObserver.forceFlush(); + if (ios && event.keyCode == 13 && !event.ctrlKey && !event.altKey && !event.metaKey) { + let now = Date.now(); + view.input.lastIOSEnter = now; + view.input.lastIOSEnterFallbackTimeout = setTimeout(() => { + if (view.input.lastIOSEnter == now) { + view.someProp("handleKeyDown", (f3) => f3(view, keyEvent(13, "Enter"))); + view.input.lastIOSEnter = 0; + } + }, 200); + } else if (view.someProp("handleKeyDown", (f3) => f3(view, event)) || captureKeyDown(view, event)) { + event.preventDefault(); + } else { + setSelectionOrigin(view, "key"); + } + }; + editHandlers.keyup = (view, event) => { + if (event.keyCode == 16) + view.input.shiftKey = false; + }; + editHandlers.keypress = (view, _event) => { + let event = _event; + if (inOrNearComposition(view, event) || !event.charCode || event.ctrlKey && !event.altKey || mac && event.metaKey) + return; + if (view.someProp("handleKeyPress", (f3) => f3(view, event))) { + event.preventDefault(); + return; + } + let sel = view.state.selection; + if (!(sel instanceof TextSelection) || !sel.$from.sameParent(sel.$to)) { + let text5 = String.fromCharCode(event.charCode); + if (!/[\r\n]/.test(text5) && !view.someProp("handleTextInput", (f3) => f3(view, sel.$from.pos, sel.$to.pos, text5))) + view.dispatch(view.state.tr.insertText(text5).scrollIntoView()); + event.preventDefault(); + } + }; + function eventCoords(event) { + return { left: event.clientX, top: event.clientY }; + } + function isNear(event, click) { + let dx = click.x - event.clientX, dy = click.y - event.clientY; + return dx * dx + dy * dy < 100; + } + function runHandlerOnContext(view, propName, pos, inside, event) { + if (inside == -1) + return false; + let $pos = view.state.doc.resolve(inside); + for (let i2 = $pos.depth + 1; i2 > 0; i2--) { + if (view.someProp(propName, (f3) => i2 > $pos.depth ? f3(view, pos, $pos.nodeAfter, $pos.before(i2), event, true) : f3(view, pos, $pos.node(i2), $pos.before(i2), event, false))) + return true; + } + return false; + } + function updateSelection(view, selection, origin) { + if (!view.focused) + view.focus(); + let tr = view.state.tr.setSelection(selection); + if (origin == "pointer") + tr.setMeta("pointer", true); + view.dispatch(tr); + } + function selectClickedLeaf(view, inside) { + if (inside == -1) + return false; + let $pos = view.state.doc.resolve(inside), node2 = $pos.nodeAfter; + if (node2 && node2.isAtom && NodeSelection.isSelectable(node2)) { + updateSelection(view, new NodeSelection($pos), "pointer"); + return true; + } + return false; + } + function selectClickedNode(view, inside) { + if (inside == -1) + return false; + let sel = view.state.selection, selectedNode, selectAt; + if (sel instanceof NodeSelection) + selectedNode = sel.node; + let $pos = view.state.doc.resolve(inside); + for (let i2 = $pos.depth + 1; i2 > 0; i2--) { + let node2 = i2 > $pos.depth ? $pos.nodeAfter : $pos.node(i2); + if (NodeSelection.isSelectable(node2)) { + if (selectedNode && sel.$from.depth > 0 && i2 >= sel.$from.depth && $pos.before(sel.$from.depth + 1) == sel.$from.pos) + selectAt = $pos.before(sel.$from.depth); + else + selectAt = $pos.before(i2); + break; + } + } + if (selectAt != null) { + updateSelection(view, NodeSelection.create(view.state.doc, selectAt), "pointer"); + return true; + } else { + return false; + } + } + function handleSingleClick(view, pos, inside, event, selectNode) { + return runHandlerOnContext(view, "handleClickOn", pos, inside, event) || view.someProp("handleClick", (f3) => f3(view, pos, event)) || (selectNode ? selectClickedNode(view, inside) : selectClickedLeaf(view, inside)); + } + function handleDoubleClick(view, pos, inside, event) { + return runHandlerOnContext(view, "handleDoubleClickOn", pos, inside, event) || view.someProp("handleDoubleClick", (f3) => f3(view, pos, event)); + } + function handleTripleClick(view, pos, inside, event) { + return runHandlerOnContext(view, "handleTripleClickOn", pos, inside, event) || view.someProp("handleTripleClick", (f3) => f3(view, pos, event)) || defaultTripleClick(view, inside, event); + } + function defaultTripleClick(view, inside, event) { + if (event.button != 0) + return false; + let doc4 = view.state.doc; + if (inside == -1) { + if (doc4.inlineContent) { + updateSelection(view, TextSelection.create(doc4, 0, doc4.content.size), "pointer"); + return true; + } + return false; + } + let $pos = doc4.resolve(inside); + for (let i2 = $pos.depth + 1; i2 > 0; i2--) { + let node2 = i2 > $pos.depth ? $pos.nodeAfter : $pos.node(i2); + let nodePos = $pos.before(i2); + if (node2.inlineContent) + updateSelection(view, TextSelection.create(doc4, nodePos + 1, nodePos + 1 + node2.content.size), "pointer"); + else if (NodeSelection.isSelectable(node2)) + updateSelection(view, NodeSelection.create(doc4, nodePos), "pointer"); + else + continue; + return true; + } + } + function forceDOMFlush(view) { + return endComposition(view); + } + var selectNodeModifier = mac ? "metaKey" : "ctrlKey"; + handlers.mousedown = (view, _event) => { + let event = _event; + view.input.shiftKey = event.shiftKey; + let flushed = forceDOMFlush(view); + let now = Date.now(), type = "singleClick"; + if (now - view.input.lastClick.time < 500 && isNear(event, view.input.lastClick) && !event[selectNodeModifier]) { + if (view.input.lastClick.type == "singleClick") + type = "doubleClick"; + else if (view.input.lastClick.type == "doubleClick") + type = "tripleClick"; + } + view.input.lastClick = { time: now, x: event.clientX, y: event.clientY, type }; + let pos = view.posAtCoords(eventCoords(event)); + if (!pos) + return; + if (type == "singleClick") { + if (view.input.mouseDown) + view.input.mouseDown.done(); + view.input.mouseDown = new MouseDown(view, pos, event, !!flushed); + } else if ((type == "doubleClick" ? handleDoubleClick : handleTripleClick)(view, pos.pos, pos.inside, event)) { + event.preventDefault(); + } else { + setSelectionOrigin(view, "pointer"); + } + }; + var MouseDown = class { + constructor(view, pos, event, flushed) { + this.view = view; + this.pos = pos; + this.event = event; + this.flushed = flushed; + this.delayedSelectionSync = false; + this.mightDrag = null; + this.startDoc = view.state.doc; + this.selectNode = !!event[selectNodeModifier]; + this.allowDefault = event.shiftKey; + let targetNode, targetPos; + if (pos.inside > -1) { + targetNode = view.state.doc.nodeAt(pos.inside); + targetPos = pos.inside; + } else { + let $pos = view.state.doc.resolve(pos.pos); + targetNode = $pos.parent; + targetPos = $pos.depth ? $pos.before() : 0; + } + const target = flushed ? null : event.target; + const targetDesc = target ? view.docView.nearestDesc(target, true) : null; + this.target = targetDesc ? targetDesc.dom : null; + let { selection } = view.state; + if (event.button == 0 && targetNode.type.spec.draggable && targetNode.type.spec.selectable !== false || selection instanceof NodeSelection && selection.from <= targetPos && selection.to > targetPos) + this.mightDrag = { + node: targetNode, + pos: targetPos, + addAttr: !!(this.target && !this.target.draggable), + setUneditable: !!(this.target && gecko && !this.target.hasAttribute("contentEditable")) + }; + if (this.target && this.mightDrag && (this.mightDrag.addAttr || this.mightDrag.setUneditable)) { + this.view.domObserver.stop(); + if (this.mightDrag.addAttr) + this.target.draggable = true; + if (this.mightDrag.setUneditable) + setTimeout(() => { + if (this.view.input.mouseDown == this) + this.target.setAttribute("contentEditable", "false"); + }, 20); + this.view.domObserver.start(); + } + view.root.addEventListener("mouseup", this.up = this.up.bind(this)); + view.root.addEventListener("mousemove", this.move = this.move.bind(this)); + setSelectionOrigin(view, "pointer"); + } + done() { + this.view.root.removeEventListener("mouseup", this.up); + this.view.root.removeEventListener("mousemove", this.move); + if (this.mightDrag && this.target) { + this.view.domObserver.stop(); + if (this.mightDrag.addAttr) + this.target.removeAttribute("draggable"); + if (this.mightDrag.setUneditable) + this.target.removeAttribute("contentEditable"); + this.view.domObserver.start(); + } + if (this.delayedSelectionSync) + setTimeout(() => selectionToDOM(this.view)); + this.view.input.mouseDown = null; + } + up(event) { + this.done(); + if (!this.view.dom.contains(event.target)) + return; + let pos = this.pos; + if (this.view.state.doc != this.startDoc) + pos = this.view.posAtCoords(eventCoords(event)); + this.updateAllowDefault(event); + if (this.allowDefault || !pos) { + setSelectionOrigin(this.view, "pointer"); + } else if (handleSingleClick(this.view, pos.pos, pos.inside, event, this.selectNode)) { + event.preventDefault(); + } else if (event.button == 0 && (this.flushed || // Safari ignores clicks on draggable elements + safari && this.mightDrag && !this.mightDrag.node.isAtom || // Chrome will sometimes treat a node selection as a + // cursor, but still report that the node is selected + // when asked through getSelection. You'll then get a + // situation where clicking at the point where that + // (hidden) cursor is doesn't change the selection, and + // thus doesn't get a reaction from ProseMirror. This + // works around that. + chrome && !this.view.state.selection.visible && Math.min(Math.abs(pos.pos - this.view.state.selection.from), Math.abs(pos.pos - this.view.state.selection.to)) <= 2)) { + updateSelection(this.view, Selection.near(this.view.state.doc.resolve(pos.pos)), "pointer"); + event.preventDefault(); + } else { + setSelectionOrigin(this.view, "pointer"); + } + } + move(event) { + this.updateAllowDefault(event); + setSelectionOrigin(this.view, "pointer"); + if (event.buttons == 0) + this.done(); + } + updateAllowDefault(event) { + if (!this.allowDefault && (Math.abs(this.event.x - event.clientX) > 4 || Math.abs(this.event.y - event.clientY) > 4)) + this.allowDefault = true; + } + }; + handlers.touchstart = (view) => { + view.input.lastTouch = Date.now(); + forceDOMFlush(view); + setSelectionOrigin(view, "pointer"); + }; + handlers.touchmove = (view) => { + view.input.lastTouch = Date.now(); + setSelectionOrigin(view, "pointer"); + }; + handlers.contextmenu = (view) => forceDOMFlush(view); + function inOrNearComposition(view, event) { + if (view.composing) + return true; + if (safari && Math.abs(event.timeStamp - view.input.compositionEndedAt) < 500) { + view.input.compositionEndedAt = -2e8; + return true; + } + return false; + } + var timeoutComposition = android ? 5e3 : -1; + editHandlers.compositionstart = editHandlers.compositionupdate = (view) => { + if (!view.composing) { + view.domObserver.flush(); + let { state } = view, $pos = state.selection.$from; + if (state.selection.empty && (state.storedMarks || !$pos.textOffset && $pos.parentOffset && $pos.nodeBefore.marks.some((m3) => m3.type.spec.inclusive === false))) { + view.markCursor = view.state.storedMarks || $pos.marks(); + endComposition(view, true); + view.markCursor = null; + } else { + endComposition(view); + if (gecko && state.selection.empty && $pos.parentOffset && !$pos.textOffset && $pos.nodeBefore.marks.length) { + let sel = view.domSelectionRange(); + for (let node2 = sel.focusNode, offset = sel.focusOffset; node2 && node2.nodeType == 1 && offset != 0; ) { + let before = offset < 0 ? node2.lastChild : node2.childNodes[offset - 1]; + if (!before) + break; + if (before.nodeType == 3) { + view.domSelection().collapse(before, before.nodeValue.length); + break; + } else { + node2 = before; + offset = -1; + } + } + } + } + view.input.composing = true; + } + scheduleComposeEnd(view, timeoutComposition); + }; + editHandlers.compositionend = (view, event) => { + if (view.composing) { + view.input.composing = false; + view.input.compositionEndedAt = event.timeStamp; + view.input.compositionPendingChanges = view.domObserver.pendingRecords().length ? view.input.compositionID : 0; + view.input.compositionNode = null; + if (view.input.compositionPendingChanges) + Promise.resolve().then(() => view.domObserver.flush()); + view.input.compositionID++; + scheduleComposeEnd(view, 20); + } + }; + function scheduleComposeEnd(view, delay) { + clearTimeout(view.input.composingTimeout); + if (delay > -1) + view.input.composingTimeout = setTimeout(() => endComposition(view), delay); + } + function clearComposition(view) { + if (view.composing) { + view.input.composing = false; + view.input.compositionEndedAt = timestampFromCustomEvent(); + } + while (view.input.compositionNodes.length > 0) + view.input.compositionNodes.pop().markParentsDirty(); + } + function findCompositionNode(view) { + let sel = view.domSelectionRange(); + if (!sel.focusNode) + return null; + let textBefore = textNodeBefore$1(sel.focusNode, sel.focusOffset); + let textAfter = textNodeAfter$1(sel.focusNode, sel.focusOffset); + if (textBefore && textAfter && textBefore != textAfter) { + let descAfter = textAfter.pmViewDesc; + if (!descAfter || !descAfter.isText(textAfter.nodeValue)) { + return textAfter; + } else if (view.input.compositionNode == textAfter) { + let descBefore = textBefore.pmViewDesc; + if (!(!descBefore || !descBefore.isText(textBefore.nodeValue))) + return textAfter; + } + } + return textBefore || textAfter; + } + function timestampFromCustomEvent() { + let event = document.createEvent("Event"); + event.initEvent("event", true, true); + return event.timeStamp; + } + function endComposition(view, forceUpdate = false) { + if (android && view.domObserver.flushingSoon >= 0) + return; + view.domObserver.forceFlush(); + clearComposition(view); + if (forceUpdate || view.docView && view.docView.dirty) { + let sel = selectionFromDOM(view); + if (sel && !sel.eq(view.state.selection)) + view.dispatch(view.state.tr.setSelection(sel)); + else + view.updateState(view.state); + return true; + } + return false; + } + function captureCopy(view, dom) { + if (!view.dom.parentNode) + return; + let wrap3 = view.dom.parentNode.appendChild(document.createElement("div")); + wrap3.appendChild(dom); + wrap3.style.cssText = "position: fixed; left: -10000px; top: 10px"; + let sel = getSelection(), range = document.createRange(); + range.selectNodeContents(dom); + view.dom.blur(); + sel.removeAllRanges(); + sel.addRange(range); + setTimeout(() => { + if (wrap3.parentNode) + wrap3.parentNode.removeChild(wrap3); + view.focus(); + }, 50); + } + var brokenClipboardAPI = ie && ie_version < 15 || ios && webkit_version < 604; + handlers.copy = editHandlers.cut = (view, _event) => { + let event = _event; + let sel = view.state.selection, cut = event.type == "cut"; + if (sel.empty) + return; + let data = brokenClipboardAPI ? null : event.clipboardData; + let slice = sel.content(), { dom, text: text5 } = serializeForClipboard(view, slice); + if (data) { + event.preventDefault(); + data.clearData(); + data.setData("text/html", dom.innerHTML); + data.setData("text/plain", text5); + } else { + captureCopy(view, dom); + } + if (cut) + view.dispatch(view.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent", "cut")); + }; + function sliceSingleNode(slice) { + return slice.openStart == 0 && slice.openEnd == 0 && slice.content.childCount == 1 ? slice.content.firstChild : null; + } + function capturePaste(view, event) { + if (!view.dom.parentNode) + return; + let plainText = view.input.shiftKey || view.state.selection.$from.parent.type.spec.code; + let target = view.dom.parentNode.appendChild(document.createElement(plainText ? "textarea" : "div")); + if (!plainText) + target.contentEditable = "true"; + target.style.cssText = "position: fixed; left: -10000px; top: 10px"; + target.focus(); + let plain = view.input.shiftKey && view.input.lastKeyCode != 45; + setTimeout(() => { + view.focus(); + if (target.parentNode) + target.parentNode.removeChild(target); + if (plainText) + doPaste(view, target.value, null, plain, event); + else + doPaste(view, target.textContent, target.innerHTML, plain, event); + }, 50); + } + function doPaste(view, text5, html3, preferPlain, event) { + let slice = parseFromClipboard(view, text5, html3, preferPlain, view.state.selection.$from); + if (view.someProp("handlePaste", (f3) => f3(view, event, slice || Slice.empty))) + return true; + if (!slice) + return false; + let singleNode = sliceSingleNode(slice); + let tr = singleNode ? view.state.tr.replaceSelectionWith(singleNode, preferPlain) : view.state.tr.replaceSelection(slice); + view.dispatch(tr.scrollIntoView().setMeta("paste", true).setMeta("uiEvent", "paste")); + return true; + } + function getText(clipboardData) { + let text5 = clipboardData.getData("text/plain") || clipboardData.getData("Text"); + if (text5) + return text5; + let uris = clipboardData.getData("text/uri-list"); + return uris ? uris.replace(/\r?\n/g, " ") : ""; + } + editHandlers.paste = (view, _event) => { + let event = _event; + if (view.composing && !android) + return; + let data = brokenClipboardAPI ? null : event.clipboardData; + let plain = view.input.shiftKey && view.input.lastKeyCode != 45; + if (data && doPaste(view, getText(data), data.getData("text/html"), plain, event)) + event.preventDefault(); + else + capturePaste(view, event); + }; + var Dragging = class { + constructor(slice, move, node2) { + this.slice = slice; + this.move = move; + this.node = node2; + } + }; + var dragCopyModifier = mac ? "altKey" : "ctrlKey"; + handlers.dragstart = (view, _event) => { + let event = _event; + let mouseDown = view.input.mouseDown; + if (mouseDown) + mouseDown.done(); + if (!event.dataTransfer) + return; + let sel = view.state.selection; + let pos = sel.empty ? null : view.posAtCoords(eventCoords(event)); + let node2; + if (pos && pos.pos >= sel.from && pos.pos <= (sel instanceof NodeSelection ? sel.to - 1 : sel.to)) ; + else if (mouseDown && mouseDown.mightDrag) { + node2 = NodeSelection.create(view.state.doc, mouseDown.mightDrag.pos); + } else if (event.target && event.target.nodeType == 1) { + let desc = view.docView.nearestDesc(event.target, true); + if (desc && desc.node.type.spec.draggable && desc != view.docView) + node2 = NodeSelection.create(view.state.doc, desc.posBefore); + } + let draggedSlice = (node2 || view.state.selection).content(); + let { dom, text: text5, slice } = serializeForClipboard(view, draggedSlice); + event.dataTransfer.clearData(); + event.dataTransfer.setData(brokenClipboardAPI ? "Text" : "text/html", dom.innerHTML); + event.dataTransfer.effectAllowed = "copyMove"; + if (!brokenClipboardAPI) + event.dataTransfer.setData("text/plain", text5); + view.dragging = new Dragging(slice, !event[dragCopyModifier], node2); + }; + handlers.dragend = (view) => { + let dragging = view.dragging; + window.setTimeout(() => { + if (view.dragging == dragging) + view.dragging = null; + }, 50); + }; + editHandlers.dragover = editHandlers.dragenter = (_3, e2) => e2.preventDefault(); + editHandlers.drop = (view, _event) => { + let event = _event; + let dragging = view.dragging; + view.dragging = null; + if (!event.dataTransfer) + return; + let eventPos = view.posAtCoords(eventCoords(event)); + if (!eventPos) + return; + let $mouse = view.state.doc.resolve(eventPos.pos); + let slice = dragging && dragging.slice; + if (slice) { + view.someProp("transformPasted", (f3) => { + slice = f3(slice, view); + }); + } else { + slice = parseFromClipboard(view, getText(event.dataTransfer), brokenClipboardAPI ? null : event.dataTransfer.getData("text/html"), false, $mouse); + } + let move = !!(dragging && !event[dragCopyModifier]); + if (view.someProp("handleDrop", (f3) => f3(view, event, slice || Slice.empty, move))) { + event.preventDefault(); + return; + } + if (!slice) + return; + event.preventDefault(); + let insertPos = slice ? dropPoint(view.state.doc, $mouse.pos, slice) : $mouse.pos; + if (insertPos == null) + insertPos = $mouse.pos; + let tr = view.state.tr; + if (move) { + let { node: node2 } = dragging; + if (node2) + node2.replace(tr); + else + tr.deleteSelection(); + } + let pos = tr.mapping.map(insertPos); + let isNode = slice.openStart == 0 && slice.openEnd == 0 && slice.content.childCount == 1; + let beforeInsert = tr.doc; + if (isNode) + tr.replaceRangeWith(pos, pos, slice.content.firstChild); + else + tr.replaceRange(pos, pos, slice); + if (tr.doc.eq(beforeInsert)) + return; + let $pos = tr.doc.resolve(pos); + if (isNode && NodeSelection.isSelectable(slice.content.firstChild) && $pos.nodeAfter && $pos.nodeAfter.sameMarkup(slice.content.firstChild)) { + tr.setSelection(new NodeSelection($pos)); + } else { + let end = tr.mapping.map(insertPos); + tr.mapping.maps[tr.mapping.maps.length - 1].forEach((_from, _to, _newFrom, newTo) => end = newTo); + tr.setSelection(selectionBetween(view, $pos, tr.doc.resolve(end))); + } + view.focus(); + view.dispatch(tr.setMeta("uiEvent", "drop")); + }; + handlers.focus = (view) => { + view.input.lastFocus = Date.now(); + if (!view.focused) { + view.domObserver.stop(); + view.dom.classList.add("ProseMirror-focused"); + view.domObserver.start(); + view.focused = true; + setTimeout(() => { + if (view.docView && view.hasFocus() && !view.domObserver.currentSelection.eq(view.domSelectionRange())) + selectionToDOM(view); + }, 20); + } + }; + handlers.blur = (view, _event) => { + let event = _event; + if (view.focused) { + view.domObserver.stop(); + view.dom.classList.remove("ProseMirror-focused"); + view.domObserver.start(); + if (event.relatedTarget && view.dom.contains(event.relatedTarget)) + view.domObserver.currentSelection.clear(); + view.focused = false; + } + }; + handlers.beforeinput = (view, _event) => { + let event = _event; + if (chrome && android && event.inputType == "deleteContentBackward") { + view.domObserver.flushSoon(); + let { domChangeCount } = view.input; + setTimeout(() => { + if (view.input.domChangeCount != domChangeCount) + return; + view.dom.blur(); + view.focus(); + if (view.someProp("handleKeyDown", (f3) => f3(view, keyEvent(8, "Backspace")))) + return; + let { $cursor } = view.state.selection; + if ($cursor && $cursor.pos > 0) + view.dispatch(view.state.tr.delete($cursor.pos - 1, $cursor.pos).scrollIntoView()); + }, 50); + } + }; + for (let prop in editHandlers) + handlers[prop] = editHandlers[prop]; + function compareObjs(a2, b4) { + if (a2 == b4) + return true; + for (let p4 in a2) + if (a2[p4] !== b4[p4]) + return false; + for (let p4 in b4) + if (!(p4 in a2)) + return false; + return true; + } + var WidgetType = class _WidgetType { + constructor(toDOM, spec) { + this.toDOM = toDOM; + this.spec = spec || noSpec; + this.side = this.spec.side || 0; + } + map(mapping, span, offset, oldOffset) { + let { pos, deleted } = mapping.mapResult(span.from + oldOffset, this.side < 0 ? -1 : 1); + return deleted ? null : new Decoration(pos - offset, pos - offset, this); + } + valid() { + return true; + } + eq(other) { + return this == other || other instanceof _WidgetType && (this.spec.key && this.spec.key == other.spec.key || this.toDOM == other.toDOM && compareObjs(this.spec, other.spec)); + } + destroy(node2) { + if (this.spec.destroy) + this.spec.destroy(node2); + } + }; + var InlineType = class _InlineType { + constructor(attrs, spec) { + this.attrs = attrs; + this.spec = spec || noSpec; + } + map(mapping, span, offset, oldOffset) { + let from = mapping.map(span.from + oldOffset, this.spec.inclusiveStart ? -1 : 1) - offset; + let to = mapping.map(span.to + oldOffset, this.spec.inclusiveEnd ? 1 : -1) - offset; + return from >= to ? null : new Decoration(from, to, this); + } + valid(_3, span) { + return span.from < span.to; + } + eq(other) { + return this == other || other instanceof _InlineType && compareObjs(this.attrs, other.attrs) && compareObjs(this.spec, other.spec); + } + static is(span) { + return span.type instanceof _InlineType; + } + destroy() { + } + }; + var NodeType2 = class _NodeType { + constructor(attrs, spec) { + this.attrs = attrs; + this.spec = spec || noSpec; + } + map(mapping, span, offset, oldOffset) { + let from = mapping.mapResult(span.from + oldOffset, 1); + if (from.deleted) + return null; + let to = mapping.mapResult(span.to + oldOffset, -1); + if (to.deleted || to.pos <= from.pos) + return null; + return new Decoration(from.pos - offset, to.pos - offset, this); + } + valid(node2, span) { + let { index: index2, offset } = node2.content.findIndex(span.from), child; + return offset == span.from && !(child = node2.child(index2)).isText && offset + child.nodeSize == span.to; + } + eq(other) { + return this == other || other instanceof _NodeType && compareObjs(this.attrs, other.attrs) && compareObjs(this.spec, other.spec); + } + destroy() { + } + }; + var Decoration = class _Decoration { + /** + @internal + */ + constructor(from, to, type) { + this.from = from; + this.to = to; + this.type = type; + } + /** + @internal + */ + copy(from, to) { + return new _Decoration(from, to, this.type); + } + /** + @internal + */ + eq(other, offset = 0) { + return this.type.eq(other.type) && this.from + offset == other.from && this.to + offset == other.to; + } + /** + @internal + */ + map(mapping, offset, oldOffset) { + return this.type.map(mapping, this, offset, oldOffset); + } + /** + Creates a widget decoration, which is a DOM node that's shown in + the document at the given position. It is recommended that you + delay rendering the widget by passing a function that will be + called when the widget is actually drawn in a view, but you can + also directly pass a DOM node. `getPos` can be used to find the + widget's current document position. + */ + static widget(pos, toDOM, spec) { + return new _Decoration(pos, pos, new WidgetType(toDOM, spec)); + } + /** + Creates an inline decoration, which adds the given attributes to + each inline node between `from` and `to`. + */ + static inline(from, to, attrs, spec) { + return new _Decoration(from, to, new InlineType(attrs, spec)); + } + /** + Creates a node decoration. `from` and `to` should point precisely + before and after a node in the document. That node, and only that + node, will receive the given attributes. + */ + static node(from, to, attrs, spec) { + return new _Decoration(from, to, new NodeType2(attrs, spec)); + } + /** + The spec provided when creating this decoration. Can be useful + if you've stored extra information in that object. + */ + get spec() { + return this.type.spec; + } + /** + @internal + */ + get inline() { + return this.type instanceof InlineType; + } + /** + @internal + */ + get widget() { + return this.type instanceof WidgetType; + } + }; + var none = []; + var noSpec = {}; + var DecorationSet = class _DecorationSet { + /** + @internal + */ + constructor(local, children) { + this.local = local.length ? local : none; + this.children = children.length ? children : none; + } + /** + Create a set of decorations, using the structure of the given + document. This will consume (modify) the `decorations` array, so + you must make a copy if you want need to preserve that. + */ + static create(doc4, decorations) { + return decorations.length ? buildTree(decorations, doc4, 0, noSpec) : empty2; + } + /** + Find all decorations in this set which touch the given range + (including decorations that start or end directly at the + boundaries) and match the given predicate on their spec. When + `start` and `end` are omitted, all decorations in the set are + considered. When `predicate` isn't given, all decorations are + assumed to match. + */ + find(start, end, predicate) { + let result = []; + this.findInner(start == null ? 0 : start, end == null ? 1e9 : end, result, 0, predicate); + return result; + } + findInner(start, end, result, offset, predicate) { + for (let i2 = 0; i2 < this.local.length; i2++) { + let span = this.local[i2]; + if (span.from <= end && span.to >= start && (!predicate || predicate(span.spec))) + result.push(span.copy(span.from + offset, span.to + offset)); + } + for (let i2 = 0; i2 < this.children.length; i2 += 3) { + if (this.children[i2] < end && this.children[i2 + 1] > start) { + let childOff = this.children[i2] + 1; + this.children[i2 + 2].findInner(start - childOff, end - childOff, result, offset + childOff, predicate); + } + } + } + /** + Map the set of decorations in response to a change in the + document. + */ + map(mapping, doc4, options2) { + if (this == empty2 || mapping.maps.length == 0) + return this; + return this.mapInner(mapping, doc4, 0, 0, options2 || noSpec); + } + /** + @internal + */ + mapInner(mapping, node2, offset, oldOffset, options2) { + let newLocal; + for (let i2 = 0; i2 < this.local.length; i2++) { + let mapped = this.local[i2].map(mapping, offset, oldOffset); + if (mapped && mapped.type.valid(node2, mapped)) + (newLocal || (newLocal = [])).push(mapped); + else if (options2.onRemove) + options2.onRemove(this.local[i2].spec); + } + if (this.children.length) + return mapChildren(this.children, newLocal || [], mapping, node2, offset, oldOffset, options2); + else + return newLocal ? new _DecorationSet(newLocal.sort(byPos), none) : empty2; + } + /** + Add the given array of decorations to the ones in the set, + producing a new set. Consumes the `decorations` array. Needs + access to the current document to create the appropriate tree + structure. + */ + add(doc4, decorations) { + if (!decorations.length) + return this; + if (this == empty2) + return _DecorationSet.create(doc4, decorations); + return this.addInner(doc4, decorations, 0); + } + addInner(doc4, decorations, offset) { + let children, childIndex = 0; + doc4.forEach((childNode, childOffset) => { + let baseOffset = childOffset + offset, found2; + if (!(found2 = takeSpansForNode(decorations, childNode, baseOffset))) + return; + if (!children) + children = this.children.slice(); + while (childIndex < children.length && children[childIndex] < childOffset) + childIndex += 3; + if (children[childIndex] == childOffset) + children[childIndex + 2] = children[childIndex + 2].addInner(childNode, found2, baseOffset + 1); + else + children.splice(childIndex, 0, childOffset, childOffset + childNode.nodeSize, buildTree(found2, childNode, baseOffset + 1, noSpec)); + childIndex += 3; + }); + let local = moveSpans(childIndex ? withoutNulls(decorations) : decorations, -offset); + for (let i2 = 0; i2 < local.length; i2++) + if (!local[i2].type.valid(doc4, local[i2])) + local.splice(i2--, 1); + return new _DecorationSet(local.length ? this.local.concat(local).sort(byPos) : this.local, children || this.children); + } + /** + Create a new set that contains the decorations in this set, minus + the ones in the given array. + */ + remove(decorations) { + if (decorations.length == 0 || this == empty2) + return this; + return this.removeInner(decorations, 0); + } + removeInner(decorations, offset) { + let children = this.children, local = this.local; + for (let i2 = 0; i2 < children.length; i2 += 3) { + let found2; + let from = children[i2] + offset, to = children[i2 + 1] + offset; + for (let j6 = 0, span; j6 < decorations.length; j6++) + if (span = decorations[j6]) { + if (span.from > from && span.to < to) { + decorations[j6] = null; + (found2 || (found2 = [])).push(span); + } + } + if (!found2) + continue; + if (children == this.children) + children = this.children.slice(); + let removed = children[i2 + 2].removeInner(found2, from + 1); + if (removed != empty2) { + children[i2 + 2] = removed; + } else { + children.splice(i2, 3); + i2 -= 3; + } + } + if (local.length) { + for (let i2 = 0, span; i2 < decorations.length; i2++) + if (span = decorations[i2]) { + for (let j6 = 0; j6 < local.length; j6++) + if (local[j6].eq(span, offset)) { + if (local == this.local) + local = this.local.slice(); + local.splice(j6--, 1); + } + } + } + if (children == this.children && local == this.local) + return this; + return local.length || children.length ? new _DecorationSet(local, children) : empty2; + } + forChild(offset, node2) { + if (this == empty2) + return this; + if (node2.isLeaf) + return _DecorationSet.empty; + let child, local; + for (let i2 = 0; i2 < this.children.length; i2 += 3) + if (this.children[i2] >= offset) { + if (this.children[i2] == offset) + child = this.children[i2 + 2]; + break; + } + let start = offset + 1, end = start + node2.content.size; + for (let i2 = 0; i2 < this.local.length; i2++) { + let dec = this.local[i2]; + if (dec.from < end && dec.to > start && dec.type instanceof InlineType) { + let from = Math.max(start, dec.from) - start, to = Math.min(end, dec.to) - start; + if (from < to) + (local || (local = [])).push(dec.copy(from, to)); + } + } + if (local) { + let localSet = new _DecorationSet(local.sort(byPos), none); + return child ? new DecorationGroup([localSet, child]) : localSet; + } + return child || empty2; + } + /** + @internal + */ + eq(other) { + if (this == other) + return true; + if (!(other instanceof _DecorationSet) || this.local.length != other.local.length || this.children.length != other.children.length) + return false; + for (let i2 = 0; i2 < this.local.length; i2++) + if (!this.local[i2].eq(other.local[i2])) + return false; + for (let i2 = 0; i2 < this.children.length; i2 += 3) + if (this.children[i2] != other.children[i2] || this.children[i2 + 1] != other.children[i2 + 1] || !this.children[i2 + 2].eq(other.children[i2 + 2])) + return false; + return true; + } + /** + @internal + */ + locals(node2) { + return removeOverlap(this.localsInner(node2)); + } + /** + @internal + */ + localsInner(node2) { + if (this == empty2) + return none; + if (node2.inlineContent || !this.local.some(InlineType.is)) + return this.local; + let result = []; + for (let i2 = 0; i2 < this.local.length; i2++) { + if (!(this.local[i2].type instanceof InlineType)) + result.push(this.local[i2]); + } + return result; + } + }; + DecorationSet.empty = new DecorationSet([], []); + DecorationSet.removeOverlap = removeOverlap; + var empty2 = DecorationSet.empty; + var DecorationGroup = class _DecorationGroup { + constructor(members) { + this.members = members; + } + map(mapping, doc4) { + const mappedDecos = this.members.map((member) => member.map(mapping, doc4, noSpec)); + return _DecorationGroup.from(mappedDecos); + } + forChild(offset, child) { + if (child.isLeaf) + return DecorationSet.empty; + let found2 = []; + for (let i2 = 0; i2 < this.members.length; i2++) { + let result = this.members[i2].forChild(offset, child); + if (result == empty2) + continue; + if (result instanceof _DecorationGroup) + found2 = found2.concat(result.members); + else + found2.push(result); + } + return _DecorationGroup.from(found2); + } + eq(other) { + if (!(other instanceof _DecorationGroup) || other.members.length != this.members.length) + return false; + for (let i2 = 0; i2 < this.members.length; i2++) + if (!this.members[i2].eq(other.members[i2])) + return false; + return true; + } + locals(node2) { + let result, sorted = true; + for (let i2 = 0; i2 < this.members.length; i2++) { + let locals = this.members[i2].localsInner(node2); + if (!locals.length) + continue; + if (!result) { + result = locals; + } else { + if (sorted) { + result = result.slice(); + sorted = false; + } + for (let j6 = 0; j6 < locals.length; j6++) + result.push(locals[j6]); + } + } + return result ? removeOverlap(sorted ? result : result.sort(byPos)) : none; + } + // Create a group for the given array of decoration sets, or return + // a single set when possible. + static from(members) { + switch (members.length) { + case 0: + return empty2; + case 1: + return members[0]; + default: + return new _DecorationGroup(members.every((m3) => m3 instanceof DecorationSet) ? members : members.reduce((r3, m3) => r3.concat(m3 instanceof DecorationSet ? m3 : m3.members), [])); + } + } + }; + function mapChildren(oldChildren, newLocal, mapping, node2, offset, oldOffset, options2) { + let children = oldChildren.slice(); + for (let i2 = 0, baseOffset = oldOffset; i2 < mapping.maps.length; i2++) { + let moved = 0; + mapping.maps[i2].forEach((oldStart, oldEnd, newStart, newEnd) => { + let dSize = newEnd - newStart - (oldEnd - oldStart); + for (let i3 = 0; i3 < children.length; i3 += 3) { + let end = children[i3 + 1]; + if (end < 0 || oldStart > end + baseOffset - moved) + continue; + let start = children[i3] + baseOffset - moved; + if (oldEnd >= start) { + children[i3 + 1] = oldStart <= start ? -2 : -1; + } else if (oldStart >= baseOffset && dSize) { + children[i3] += dSize; + children[i3 + 1] += dSize; + } + } + moved += dSize; + }); + baseOffset = mapping.maps[i2].map(baseOffset, -1); + } + let mustRebuild = false; + for (let i2 = 0; i2 < children.length; i2 += 3) + if (children[i2 + 1] < 0) { + if (children[i2 + 1] == -2) { + mustRebuild = true; + children[i2 + 1] = -1; + continue; + } + let from = mapping.map(oldChildren[i2] + oldOffset), fromLocal = from - offset; + if (fromLocal < 0 || fromLocal >= node2.content.size) { + mustRebuild = true; + continue; + } + let to = mapping.map(oldChildren[i2 + 1] + oldOffset, -1), toLocal = to - offset; + let { index: index2, offset: childOffset } = node2.content.findIndex(fromLocal); + let childNode = node2.maybeChild(index2); + if (childNode && childOffset == fromLocal && childOffset + childNode.nodeSize == toLocal) { + let mapped = children[i2 + 2].mapInner(mapping, childNode, from + 1, oldChildren[i2] + oldOffset + 1, options2); + if (mapped != empty2) { + children[i2] = fromLocal; + children[i2 + 1] = toLocal; + children[i2 + 2] = mapped; + } else { + children[i2 + 1] = -2; + mustRebuild = true; + } + } else { + mustRebuild = true; + } + } + if (mustRebuild) { + let decorations = mapAndGatherRemainingDecorations(children, oldChildren, newLocal, mapping, offset, oldOffset, options2); + let built = buildTree(decorations, node2, 0, options2); + newLocal = built.local; + for (let i2 = 0; i2 < children.length; i2 += 3) + if (children[i2 + 1] < 0) { + children.splice(i2, 3); + i2 -= 3; + } + for (let i2 = 0, j6 = 0; i2 < built.children.length; i2 += 3) { + let from = built.children[i2]; + while (j6 < children.length && children[j6] < from) + j6 += 3; + children.splice(j6, 0, built.children[i2], built.children[i2 + 1], built.children[i2 + 2]); + } + } + return new DecorationSet(newLocal.sort(byPos), children); + } + function moveSpans(spans, offset) { + if (!offset || !spans.length) + return spans; + let result = []; + for (let i2 = 0; i2 < spans.length; i2++) { + let span = spans[i2]; + result.push(new Decoration(span.from + offset, span.to + offset, span.type)); + } + return result; + } + function mapAndGatherRemainingDecorations(children, oldChildren, decorations, mapping, offset, oldOffset, options2) { + function gather(set, oldOffset2) { + for (let i2 = 0; i2 < set.local.length; i2++) { + let mapped = set.local[i2].map(mapping, offset, oldOffset2); + if (mapped) + decorations.push(mapped); + else if (options2.onRemove) + options2.onRemove(set.local[i2].spec); + } + for (let i2 = 0; i2 < set.children.length; i2 += 3) + gather(set.children[i2 + 2], set.children[i2] + oldOffset2 + 1); + } + for (let i2 = 0; i2 < children.length; i2 += 3) + if (children[i2 + 1] == -1) + gather(children[i2 + 2], oldChildren[i2] + oldOffset + 1); + return decorations; + } + function takeSpansForNode(spans, node2, offset) { + if (node2.isLeaf) + return null; + let end = offset + node2.nodeSize, found2 = null; + for (let i2 = 0, span; i2 < spans.length; i2++) { + if ((span = spans[i2]) && span.from > offset && span.to < end) { + (found2 || (found2 = [])).push(span); + spans[i2] = null; + } + } + return found2; + } + function withoutNulls(array) { + let result = []; + for (let i2 = 0; i2 < array.length; i2++) + if (array[i2] != null) + result.push(array[i2]); + return result; + } + function buildTree(spans, node2, offset, options2) { + let children = [], hasNulls = false; + node2.forEach((childNode, localStart) => { + let found2 = takeSpansForNode(spans, childNode, localStart + offset); + if (found2) { + hasNulls = true; + let subtree = buildTree(found2, childNode, offset + localStart + 1, options2); + if (subtree != empty2) + children.push(localStart, localStart + childNode.nodeSize, subtree); + } + }); + let locals = moveSpans(hasNulls ? withoutNulls(spans) : spans, -offset).sort(byPos); + for (let i2 = 0; i2 < locals.length; i2++) + if (!locals[i2].type.valid(node2, locals[i2])) { + if (options2.onRemove) + options2.onRemove(locals[i2].spec); + locals.splice(i2--, 1); + } + return locals.length || children.length ? new DecorationSet(locals, children) : empty2; + } + function byPos(a2, b4) { + return a2.from - b4.from || a2.to - b4.to; + } + function removeOverlap(spans) { + let working = spans; + for (let i2 = 0; i2 < working.length - 1; i2++) { + let span = working[i2]; + if (span.from != span.to) + for (let j6 = i2 + 1; j6 < working.length; j6++) { + let next = working[j6]; + if (next.from == span.from) { + if (next.to != span.to) { + if (working == spans) + working = spans.slice(); + working[j6] = next.copy(next.from, span.to); + insertAhead(working, j6 + 1, next.copy(span.to, next.to)); + } + continue; + } else { + if (next.from < span.to) { + if (working == spans) + working = spans.slice(); + working[i2] = span.copy(span.from, next.from); + insertAhead(working, j6, span.copy(next.from, span.to)); + } + break; + } + } + } + return working; + } + function insertAhead(array, i2, deco) { + while (i2 < array.length && byPos(deco, array[i2]) > 0) + i2++; + array.splice(i2, 0, deco); + } + function viewDecorations(view) { + let found2 = []; + view.someProp("decorations", (f3) => { + let result = f3(view.state); + if (result && result != empty2) + found2.push(result); + }); + if (view.cursorWrapper) + found2.push(DecorationSet.create(view.state.doc, [view.cursorWrapper.deco])); + return DecorationGroup.from(found2); + } + var observeOptions = { + childList: true, + characterData: true, + characterDataOldValue: true, + attributes: true, + attributeOldValue: true, + subtree: true + }; + var useCharData = ie && ie_version <= 11; + var SelectionState = class { + constructor() { + this.anchorNode = null; + this.anchorOffset = 0; + this.focusNode = null; + this.focusOffset = 0; + } + set(sel) { + this.anchorNode = sel.anchorNode; + this.anchorOffset = sel.anchorOffset; + this.focusNode = sel.focusNode; + this.focusOffset = sel.focusOffset; + } + clear() { + this.anchorNode = this.focusNode = null; + } + eq(sel) { + return sel.anchorNode == this.anchorNode && sel.anchorOffset == this.anchorOffset && sel.focusNode == this.focusNode && sel.focusOffset == this.focusOffset; + } + }; + var DOMObserver = class { + constructor(view, handleDOMChange) { + this.view = view; + this.handleDOMChange = handleDOMChange; + this.queue = []; + this.flushingSoon = -1; + this.observer = null; + this.currentSelection = new SelectionState(); + this.onCharData = null; + this.suppressingSelectionUpdates = false; + this.observer = window.MutationObserver && new window.MutationObserver((mutations) => { + for (let i2 = 0; i2 < mutations.length; i2++) + this.queue.push(mutations[i2]); + if (ie && ie_version <= 11 && mutations.some((m3) => m3.type == "childList" && m3.removedNodes.length || m3.type == "characterData" && m3.oldValue.length > m3.target.nodeValue.length)) + this.flushSoon(); + else + this.flush(); + }); + if (useCharData) { + this.onCharData = (e2) => { + this.queue.push({ target: e2.target, type: "characterData", oldValue: e2.prevValue }); + this.flushSoon(); + }; + } + this.onSelectionChange = this.onSelectionChange.bind(this); + } + flushSoon() { + if (this.flushingSoon < 0) + this.flushingSoon = window.setTimeout(() => { + this.flushingSoon = -1; + this.flush(); + }, 20); + } + forceFlush() { + if (this.flushingSoon > -1) { + window.clearTimeout(this.flushingSoon); + this.flushingSoon = -1; + this.flush(); + } + } + start() { + if (this.observer) { + this.observer.takeRecords(); + this.observer.observe(this.view.dom, observeOptions); + } + if (this.onCharData) + this.view.dom.addEventListener("DOMCharacterDataModified", this.onCharData); + this.connectSelection(); + } + stop() { + if (this.observer) { + let take = this.observer.takeRecords(); + if (take.length) { + for (let i2 = 0; i2 < take.length; i2++) + this.queue.push(take[i2]); + window.setTimeout(() => this.flush(), 20); + } + this.observer.disconnect(); + } + if (this.onCharData) + this.view.dom.removeEventListener("DOMCharacterDataModified", this.onCharData); + this.disconnectSelection(); + } + connectSelection() { + this.view.dom.ownerDocument.addEventListener("selectionchange", this.onSelectionChange); + } + disconnectSelection() { + this.view.dom.ownerDocument.removeEventListener("selectionchange", this.onSelectionChange); + } + suppressSelectionUpdates() { + this.suppressingSelectionUpdates = true; + setTimeout(() => this.suppressingSelectionUpdates = false, 50); + } + onSelectionChange() { + if (!hasFocusAndSelection(this.view)) + return; + if (this.suppressingSelectionUpdates) + return selectionToDOM(this.view); + if (ie && ie_version <= 11 && !this.view.state.selection.empty) { + let sel = this.view.domSelectionRange(); + if (sel.focusNode && isEquivalentPosition(sel.focusNode, sel.focusOffset, sel.anchorNode, sel.anchorOffset)) + return this.flushSoon(); + } + this.flush(); + } + setCurSelection() { + this.currentSelection.set(this.view.domSelectionRange()); + } + ignoreSelectionChange(sel) { + if (!sel.focusNode) + return true; + let ancestors = /* @__PURE__ */ new Set(), container; + for (let scan = sel.focusNode; scan; scan = parentNode(scan)) + ancestors.add(scan); + for (let scan = sel.anchorNode; scan; scan = parentNode(scan)) + if (ancestors.has(scan)) { + container = scan; + break; + } + let desc = container && this.view.docView.nearestDesc(container); + if (desc && desc.ignoreMutation({ + type: "selection", + target: container.nodeType == 3 ? container.parentNode : container + })) { + this.setCurSelection(); + return true; + } + } + pendingRecords() { + if (this.observer) + for (let mut of this.observer.takeRecords()) + this.queue.push(mut); + return this.queue; + } + flush() { + let { view } = this; + if (!view.docView || this.flushingSoon > -1) + return; + let mutations = this.pendingRecords(); + if (mutations.length) + this.queue = []; + let sel = view.domSelectionRange(); + let newSel = !this.suppressingSelectionUpdates && !this.currentSelection.eq(sel) && hasFocusAndSelection(view) && !this.ignoreSelectionChange(sel); + let from = -1, to = -1, typeOver = false, added = []; + if (view.editable) { + for (let i2 = 0; i2 < mutations.length; i2++) { + let result = this.registerMutation(mutations[i2], added); + if (result) { + from = from < 0 ? result.from : Math.min(result.from, from); + to = to < 0 ? result.to : Math.max(result.to, to); + if (result.typeOver) + typeOver = true; + } + } + } + if (gecko && added.length > 1) { + let brs = added.filter((n4) => n4.nodeName == "BR"); + if (brs.length == 2) { + let a2 = brs[0], b4 = brs[1]; + if (a2.parentNode && a2.parentNode.parentNode == b4.parentNode) + b4.remove(); + else + a2.remove(); + } + } + let readSel = null; + if (from < 0 && newSel && view.input.lastFocus > Date.now() - 200 && Math.max(view.input.lastTouch, view.input.lastClick.time) < Date.now() - 300 && selectionCollapsed(sel) && (readSel = selectionFromDOM(view)) && readSel.eq(Selection.near(view.state.doc.resolve(0), 1))) { + view.input.lastFocus = 0; + selectionToDOM(view); + this.currentSelection.set(sel); + view.scrollToSelection(); + } else if (from > -1 || newSel) { + if (from > -1) { + view.docView.markDirty(from, to); + checkCSS(view); + } + this.handleDOMChange(from, to, typeOver, added); + if (view.docView && view.docView.dirty) + view.updateState(view.state); + else if (!this.currentSelection.eq(sel)) + selectionToDOM(view); + this.currentSelection.set(sel); + } + } + registerMutation(mut, added) { + if (added.indexOf(mut.target) > -1) + return null; + let desc = this.view.docView.nearestDesc(mut.target); + if (mut.type == "attributes" && (desc == this.view.docView || mut.attributeName == "contenteditable" || // Firefox sometimes fires spurious events for null/empty styles + mut.attributeName == "style" && !mut.oldValue && !mut.target.getAttribute("style"))) + return null; + if (!desc || desc.ignoreMutation(mut)) + return null; + if (mut.type == "childList") { + for (let i2 = 0; i2 < mut.addedNodes.length; i2++) + added.push(mut.addedNodes[i2]); + if (desc.contentDOM && desc.contentDOM != desc.dom && !desc.contentDOM.contains(mut.target)) + return { from: desc.posBefore, to: desc.posAfter }; + let prev = mut.previousSibling, next = mut.nextSibling; + if (ie && ie_version <= 11 && mut.addedNodes.length) { + for (let i2 = 0; i2 < mut.addedNodes.length; i2++) { + let { previousSibling, nextSibling } = mut.addedNodes[i2]; + if (!previousSibling || Array.prototype.indexOf.call(mut.addedNodes, previousSibling) < 0) + prev = previousSibling; + if (!nextSibling || Array.prototype.indexOf.call(mut.addedNodes, nextSibling) < 0) + next = nextSibling; + } + } + let fromOffset = prev && prev.parentNode == mut.target ? domIndex(prev) + 1 : 0; + let from = desc.localPosFromDOM(mut.target, fromOffset, -1); + let toOffset = next && next.parentNode == mut.target ? domIndex(next) : mut.target.childNodes.length; + let to = desc.localPosFromDOM(mut.target, toOffset, 1); + return { from, to }; + } else if (mut.type == "attributes") { + return { from: desc.posAtStart - desc.border, to: desc.posAtEnd + desc.border }; + } else { + return { + from: desc.posAtStart, + to: desc.posAtEnd, + // An event was generated for a text change that didn't change + // any text. Mark the dom change to fall back to assuming the + // selection was typed over with an identical value if it can't + // find another change. + typeOver: mut.target.nodeValue == mut.oldValue + }; + } + } + }; + var cssChecked = /* @__PURE__ */ new WeakMap(); + var cssCheckWarned = false; + function checkCSS(view) { + if (cssChecked.has(view)) + return; + cssChecked.set(view, null); + if (["normal", "nowrap", "pre-line"].indexOf(getComputedStyle(view.dom).whiteSpace) !== -1) { + view.requiresGeckoHackNode = gecko; + if (cssCheckWarned) + return; + console["warn"]("ProseMirror expects the CSS white-space property to be set, preferably to 'pre-wrap'. It is recommended to load style/prosemirror.css from the prosemirror-view package."); + cssCheckWarned = true; + } + } + function rangeToSelectionRange(view, range) { + let anchorNode = range.startContainer, anchorOffset = range.startOffset; + let focusNode = range.endContainer, focusOffset = range.endOffset; + let currentAnchor = view.domAtPos(view.state.selection.anchor); + if (isEquivalentPosition(currentAnchor.node, currentAnchor.offset, focusNode, focusOffset)) + [anchorNode, anchorOffset, focusNode, focusOffset] = [focusNode, focusOffset, anchorNode, anchorOffset]; + return { anchorNode, anchorOffset, focusNode, focusOffset }; + } + function safariShadowSelectionRange(view, selection) { + if (selection.getComposedRanges) { + let range = selection.getComposedRanges(view.root)[0]; + if (range) + return rangeToSelectionRange(view, range); + } + let found2; + function read(event) { + event.preventDefault(); + event.stopImmediatePropagation(); + found2 = event.getTargetRanges()[0]; + } + view.dom.addEventListener("beforeinput", read, true); + document.execCommand("indent"); + view.dom.removeEventListener("beforeinput", read, true); + return found2 ? rangeToSelectionRange(view, found2) : null; + } + function parseBetween(view, from_, to_) { + let { node: parent, fromOffset, toOffset, from, to } = view.docView.parseRange(from_, to_); + let domSel = view.domSelectionRange(); + let find; + let anchor = domSel.anchorNode; + if (anchor && view.dom.contains(anchor.nodeType == 1 ? anchor : anchor.parentNode)) { + find = [{ node: anchor, offset: domSel.anchorOffset }]; + if (!selectionCollapsed(domSel)) + find.push({ node: domSel.focusNode, offset: domSel.focusOffset }); + } + if (chrome && view.input.lastKeyCode === 8) { + for (let off = toOffset; off > fromOffset; off--) { + let node2 = parent.childNodes[off - 1], desc = node2.pmViewDesc; + if (node2.nodeName == "BR" && !desc) { + toOffset = off; + break; + } + if (!desc || desc.size) + break; + } + } + let startDoc = view.state.doc; + let parser = view.someProp("domParser") || DOMParser.fromSchema(view.state.schema); + let $from = startDoc.resolve(from); + let sel = null, doc4 = parser.parse(parent, { + topNode: $from.parent, + topMatch: $from.parent.contentMatchAt($from.index()), + topOpen: true, + from: fromOffset, + to: toOffset, + preserveWhitespace: $from.parent.type.whitespace == "pre" ? "full" : true, + findPositions: find, + ruleFromNode, + context: $from + }); + if (find && find[0].pos != null) { + let anchor2 = find[0].pos, head = find[1] && find[1].pos; + if (head == null) + head = anchor2; + sel = { anchor: anchor2 + from, head: head + from }; + } + return { doc: doc4, sel, from, to }; + } + function ruleFromNode(dom) { + let desc = dom.pmViewDesc; + if (desc) { + return desc.parseRule(); + } else if (dom.nodeName == "BR" && dom.parentNode) { + if (safari && /^(ul|ol)$/i.test(dom.parentNode.nodeName)) { + let skip = document.createElement("div"); + skip.appendChild(document.createElement("li")); + return { skip }; + } else if (dom.parentNode.lastChild == dom || safari && /^(tr|table)$/i.test(dom.parentNode.nodeName)) { + return { ignore: true }; + } + } else if (dom.nodeName == "IMG" && dom.getAttribute("mark-placeholder")) { + return { ignore: true }; + } + return null; + } + var isInline = /^(a|abbr|acronym|b|bd[io]|big|br|button|cite|code|data(list)?|del|dfn|em|i|ins|kbd|label|map|mark|meter|output|q|ruby|s|samp|small|span|strong|su[bp]|time|u|tt|var)$/i; + function readDOMChange(view, from, to, typeOver, addedNodes) { + let compositionID = view.input.compositionPendingChanges || (view.composing ? view.input.compositionID : 0); + view.input.compositionPendingChanges = 0; + if (from < 0) { + let origin = view.input.lastSelectionTime > Date.now() - 50 ? view.input.lastSelectionOrigin : null; + let newSel = selectionFromDOM(view, origin); + if (newSel && !view.state.selection.eq(newSel)) { + if (chrome && android && view.input.lastKeyCode === 13 && Date.now() - 100 < view.input.lastKeyCodeTime && view.someProp("handleKeyDown", (f3) => f3(view, keyEvent(13, "Enter")))) + return; + let tr2 = view.state.tr.setSelection(newSel); + if (origin == "pointer") + tr2.setMeta("pointer", true); + else if (origin == "key") + tr2.scrollIntoView(); + if (compositionID) + tr2.setMeta("composition", compositionID); + view.dispatch(tr2); + } + return; + } + let $before = view.state.doc.resolve(from); + let shared = $before.sharedDepth(to); + from = $before.before(shared + 1); + to = view.state.doc.resolve(to).after(shared + 1); + let sel = view.state.selection; + let parse2 = parseBetween(view, from, to); + let doc4 = view.state.doc, compare = doc4.slice(parse2.from, parse2.to); + let preferredPos, preferredSide; + if (view.input.lastKeyCode === 8 && Date.now() - 100 < view.input.lastKeyCodeTime) { + preferredPos = view.state.selection.to; + preferredSide = "end"; + } else { + preferredPos = view.state.selection.from; + preferredSide = "start"; + } + view.input.lastKeyCode = null; + let change = findDiff(compare.content, parse2.doc.content, parse2.from, preferredPos, preferredSide); + if ((ios && view.input.lastIOSEnter > Date.now() - 225 || android) && addedNodes.some((n4) => n4.nodeType == 1 && !isInline.test(n4.nodeName)) && (!change || change.endA >= change.endB) && view.someProp("handleKeyDown", (f3) => f3(view, keyEvent(13, "Enter")))) { + view.input.lastIOSEnter = 0; + return; + } + if (!change) { + if (typeOver && sel instanceof TextSelection && !sel.empty && sel.$head.sameParent(sel.$anchor) && !view.composing && !(parse2.sel && parse2.sel.anchor != parse2.sel.head)) { + change = { start: sel.from, endA: sel.to, endB: sel.to }; + } else { + if (parse2.sel) { + let sel2 = resolveSelection(view, view.state.doc, parse2.sel); + if (sel2 && !sel2.eq(view.state.selection)) { + let tr2 = view.state.tr.setSelection(sel2); + if (compositionID) + tr2.setMeta("composition", compositionID); + view.dispatch(tr2); + } + } + return; + } + } + view.input.domChangeCount++; + if (view.state.selection.from < view.state.selection.to && change.start == change.endB && view.state.selection instanceof TextSelection) { + if (change.start > view.state.selection.from && change.start <= view.state.selection.from + 2 && view.state.selection.from >= parse2.from) { + change.start = view.state.selection.from; + } else if (change.endA < view.state.selection.to && change.endA >= view.state.selection.to - 2 && view.state.selection.to <= parse2.to) { + change.endB += view.state.selection.to - change.endA; + change.endA = view.state.selection.to; + } + } + if (ie && ie_version <= 11 && change.endB == change.start + 1 && change.endA == change.start && change.start > parse2.from && parse2.doc.textBetween(change.start - parse2.from - 1, change.start - parse2.from + 1) == " \xA0") { + change.start--; + change.endA--; + change.endB--; + } + let $from = parse2.doc.resolveNoCache(change.start - parse2.from); + let $to = parse2.doc.resolveNoCache(change.endB - parse2.from); + let $fromA = doc4.resolve(change.start); + let inlineChange = $from.sameParent($to) && $from.parent.inlineContent && $fromA.end() >= change.endA; + let nextSel; + if ((ios && view.input.lastIOSEnter > Date.now() - 225 && (!inlineChange || addedNodes.some((n4) => n4.nodeName == "DIV" || n4.nodeName == "P")) || !inlineChange && $from.pos < parse2.doc.content.size && !$from.sameParent($to) && (nextSel = Selection.findFrom(parse2.doc.resolve($from.pos + 1), 1, true)) && nextSel.head == $to.pos) && view.someProp("handleKeyDown", (f3) => f3(view, keyEvent(13, "Enter")))) { + view.input.lastIOSEnter = 0; + return; + } + if (view.state.selection.anchor > change.start && looksLikeBackspace(doc4, change.start, change.endA, $from, $to) && view.someProp("handleKeyDown", (f3) => f3(view, keyEvent(8, "Backspace")))) { + if (android && chrome) + view.domObserver.suppressSelectionUpdates(); + return; + } + if (chrome && android && change.endB == change.start) + view.input.lastAndroidDelete = Date.now(); + if (android && !inlineChange && $from.start() != $to.start() && $to.parentOffset == 0 && $from.depth == $to.depth && parse2.sel && parse2.sel.anchor == parse2.sel.head && parse2.sel.head == change.endA) { + change.endB -= 2; + $to = parse2.doc.resolveNoCache(change.endB - parse2.from); + setTimeout(() => { + view.someProp("handleKeyDown", function(f3) { + return f3(view, keyEvent(13, "Enter")); + }); + }, 20); + } + let chFrom = change.start, chTo = change.endA; + let tr, storedMarks, markChange; + if (inlineChange) { + if ($from.pos == $to.pos) { + if (ie && ie_version <= 11 && $from.parentOffset == 0) { + view.domObserver.suppressSelectionUpdates(); + setTimeout(() => selectionToDOM(view), 20); + } + tr = view.state.tr.delete(chFrom, chTo); + storedMarks = doc4.resolve(change.start).marksAcross(doc4.resolve(change.endA)); + } else if ( + // Adding or removing a mark + change.endA == change.endB && (markChange = isMarkChange($from.parent.content.cut($from.parentOffset, $to.parentOffset), $fromA.parent.content.cut($fromA.parentOffset, change.endA - $fromA.start()))) + ) { + tr = view.state.tr; + if (markChange.type == "add") + tr.addMark(chFrom, chTo, markChange.mark); + else + tr.removeMark(chFrom, chTo, markChange.mark); + } else if ($from.parent.child($from.index()).isText && $from.index() == $to.index() - ($to.textOffset ? 0 : 1)) { + let text5 = $from.parent.textBetween($from.parentOffset, $to.parentOffset); + if (view.someProp("handleTextInput", (f3) => f3(view, chFrom, chTo, text5))) + return; + tr = view.state.tr.insertText(text5, chFrom, chTo); + } + } + if (!tr) + tr = view.state.tr.replace(chFrom, chTo, parse2.doc.slice(change.start - parse2.from, change.endB - parse2.from)); + if (parse2.sel) { + let sel2 = resolveSelection(view, tr.doc, parse2.sel); + if (sel2 && !(chrome && android && view.composing && sel2.empty && (change.start != change.endB || view.input.lastAndroidDelete < Date.now() - 100) && (sel2.head == chFrom || sel2.head == tr.mapping.map(chTo) - 1) || ie && sel2.empty && sel2.head == chFrom)) + tr.setSelection(sel2); + } + if (storedMarks) + tr.ensureMarks(storedMarks); + if (compositionID) + tr.setMeta("composition", compositionID); + view.dispatch(tr.scrollIntoView()); + } + function resolveSelection(view, doc4, parsedSel) { + if (Math.max(parsedSel.anchor, parsedSel.head) > doc4.content.size) + return null; + return selectionBetween(view, doc4.resolve(parsedSel.anchor), doc4.resolve(parsedSel.head)); + } + function isMarkChange(cur, prev) { + let curMarks = cur.firstChild.marks, prevMarks = prev.firstChild.marks; + let added = curMarks, removed = prevMarks, type, mark, update; + for (let i2 = 0; i2 < prevMarks.length; i2++) + added = prevMarks[i2].removeFromSet(added); + for (let i2 = 0; i2 < curMarks.length; i2++) + removed = curMarks[i2].removeFromSet(removed); + if (added.length == 1 && removed.length == 0) { + mark = added[0]; + type = "add"; + update = (node2) => node2.mark(mark.addToSet(node2.marks)); + } else if (added.length == 0 && removed.length == 1) { + mark = removed[0]; + type = "remove"; + update = (node2) => node2.mark(mark.removeFromSet(node2.marks)); + } else { + return null; + } + let updated = []; + for (let i2 = 0; i2 < prev.childCount; i2++) + updated.push(update(prev.child(i2))); + if (Fragment.from(updated).eq(cur)) + return { mark, type }; + } + function looksLikeBackspace(old, start, end, $newStart, $newEnd) { + if ( + // The content must have shrunk + end - start <= $newEnd.pos - $newStart.pos || // newEnd must point directly at or after the end of the block that newStart points into + skipClosingAndOpening($newStart, true, false) < $newEnd.pos + ) + return false; + let $start = old.resolve(start); + if (!$newStart.parent.isTextblock) { + let after = $start.nodeAfter; + return after != null && end == start + after.nodeSize; + } + if ($start.parentOffset < $start.parent.content.size || !$start.parent.isTextblock) + return false; + let $next = old.resolve(skipClosingAndOpening($start, true, true)); + if (!$next.parent.isTextblock || $next.pos > end || skipClosingAndOpening($next, true, false) < end) + return false; + return $newStart.parent.content.cut($newStart.parentOffset).eq($next.parent.content); + } + function skipClosingAndOpening($pos, fromEnd, mayOpen) { + let depth = $pos.depth, end = fromEnd ? $pos.end() : $pos.pos; + while (depth > 0 && (fromEnd || $pos.indexAfter(depth) == $pos.node(depth).childCount)) { + depth--; + end++; + fromEnd = false; + } + if (mayOpen) { + let next = $pos.node(depth).maybeChild($pos.indexAfter(depth)); + while (next && !next.isLeaf) { + next = next.firstChild; + end++; + } + } + return end; + } + function findDiff(a2, b4, pos, preferredPos, preferredSide) { + let start = a2.findDiffStart(b4, pos); + if (start == null) + return null; + let { a: endA, b: endB } = a2.findDiffEnd(b4, pos + a2.size, pos + b4.size); + if (preferredSide == "end") { + let adjust = Math.max(0, start - Math.min(endA, endB)); + preferredPos -= endA + adjust - start; + } + if (endA < start && a2.size < b4.size) { + let move = preferredPos <= start && preferredPos >= endA ? start - preferredPos : 0; + start -= move; + if (start && start < b4.size && isSurrogatePair(b4.textBetween(start - 1, start + 1))) + start += move ? 1 : -1; + endB = start + (endB - endA); + endA = start; + } else if (endB < start) { + let move = preferredPos <= start && preferredPos >= endB ? start - preferredPos : 0; + start -= move; + if (start && start < a2.size && isSurrogatePair(a2.textBetween(start - 1, start + 1))) + start += move ? 1 : -1; + endA = start + (endA - endB); + endB = start; + } + return { start, endA, endB }; + } + function isSurrogatePair(str) { + if (str.length != 2) + return false; + let a2 = str.charCodeAt(0), b4 = str.charCodeAt(1); + return a2 >= 56320 && a2 <= 57343 && b4 >= 55296 && b4 <= 56319; + } + var EditorView = class { + /** + Create a view. `place` may be a DOM node that the editor should + be appended to, a function that will place it into the document, + or an object whose `mount` property holds the node to use as the + document container. If it is `null`, the editor will not be + added to the document. + */ + constructor(place, props) { + this._root = null; + this.focused = false; + this.trackWrites = null; + this.mounted = false; + this.markCursor = null; + this.cursorWrapper = null; + this.lastSelectedViewDesc = void 0; + this.input = new InputState(); + this.prevDirectPlugins = []; + this.pluginViews = []; + this.requiresGeckoHackNode = false; + this.dragging = null; + this._props = props; + this.state = props.state; + this.directPlugins = props.plugins || []; + this.directPlugins.forEach(checkStateComponent); + this.dispatch = this.dispatch.bind(this); + this.dom = place && place.mount || document.createElement("div"); + if (place) { + if (place.appendChild) + place.appendChild(this.dom); + else if (typeof place == "function") + place(this.dom); + else if (place.mount) + this.mounted = true; + } + this.editable = getEditable(this); + updateCursorWrapper(this); + this.nodeViews = buildNodeViews(this); + this.docView = docViewDesc(this.state.doc, computeDocDeco(this), viewDecorations(this), this.dom, this); + this.domObserver = new DOMObserver(this, (from, to, typeOver, added) => readDOMChange(this, from, to, typeOver, added)); + this.domObserver.start(); + initInput(this); + this.updatePluginViews(); + } + /** + Holds `true` when a + [composition](https://w3c.github.io/uievents/#events-compositionevents) + is active. + */ + get composing() { + return this.input.composing; + } + /** + The view's current [props](https://prosemirror.net/docs/ref/#view.EditorProps). + */ + get props() { + if (this._props.state != this.state) { + let prev = this._props; + this._props = {}; + for (let name in prev) + this._props[name] = prev[name]; + this._props.state = this.state; + } + return this._props; + } + /** + Update the view's props. Will immediately cause an update to + the DOM. + */ + update(props) { + if (props.handleDOMEvents != this._props.handleDOMEvents) + ensureListeners(this); + let prevProps = this._props; + this._props = props; + if (props.plugins) { + props.plugins.forEach(checkStateComponent); + this.directPlugins = props.plugins; + } + this.updateStateInner(props.state, prevProps); + } + /** + Update the view by updating existing props object with the object + given as argument. Equivalent to `view.update(Object.assign({}, + view.props, props))`. + */ + setProps(props) { + let updated = {}; + for (let name in this._props) + updated[name] = this._props[name]; + updated.state = this.state; + for (let name in props) + updated[name] = props[name]; + this.update(updated); + } + /** + Update the editor's `state` prop, without touching any of the + other props. + */ + updateState(state) { + this.updateStateInner(state, this._props); + } + updateStateInner(state, prevProps) { + var _a; + let prev = this.state, redraw = false, updateSel = false; + if (state.storedMarks && this.composing) { + clearComposition(this); + updateSel = true; + } + this.state = state; + let pluginsChanged = prev.plugins != state.plugins || this._props.plugins != prevProps.plugins; + if (pluginsChanged || this._props.plugins != prevProps.plugins || this._props.nodeViews != prevProps.nodeViews) { + let nodeViews = buildNodeViews(this); + if (changedNodeViews(nodeViews, this.nodeViews)) { + this.nodeViews = nodeViews; + redraw = true; + } + } + if (pluginsChanged || prevProps.handleDOMEvents != this._props.handleDOMEvents) { + ensureListeners(this); + } + this.editable = getEditable(this); + updateCursorWrapper(this); + let innerDeco = viewDecorations(this), outerDeco = computeDocDeco(this); + let scroll = prev.plugins != state.plugins && !prev.doc.eq(state.doc) ? "reset" : state.scrollToSelection > prev.scrollToSelection ? "to selection" : "preserve"; + let updateDoc = redraw || !this.docView.matchesNode(state.doc, outerDeco, innerDeco); + if (updateDoc || !state.selection.eq(prev.selection)) + updateSel = true; + let oldScrollPos = scroll == "preserve" && updateSel && this.dom.style.overflowAnchor == null && storeScrollPos(this); + if (updateSel) { + this.domObserver.stop(); + let forceSelUpdate = updateDoc && (ie || chrome) && !this.composing && !prev.selection.empty && !state.selection.empty && selectionContextChanged(prev.selection, state.selection); + if (updateDoc) { + let chromeKludge = chrome ? this.trackWrites = this.domSelectionRange().focusNode : null; + if (this.composing) + this.input.compositionNode = findCompositionNode(this); + if (redraw || !this.docView.update(state.doc, outerDeco, innerDeco, this)) { + this.docView.updateOuterDeco(outerDeco); + this.docView.destroy(); + this.docView = docViewDesc(state.doc, outerDeco, innerDeco, this.dom, this); + } + if (chromeKludge && !this.trackWrites) + forceSelUpdate = true; + } + if (forceSelUpdate || !(this.input.mouseDown && this.domObserver.currentSelection.eq(this.domSelectionRange()) && anchorInRightPlace(this))) { + selectionToDOM(this, forceSelUpdate); + } else { + syncNodeSelection(this, state.selection); + this.domObserver.setCurSelection(); + } + this.domObserver.start(); + } + this.updatePluginViews(prev); + if (((_a = this.dragging) === null || _a === void 0 ? void 0 : _a.node) && !prev.doc.eq(state.doc)) + this.updateDraggedNode(this.dragging, prev); + if (scroll == "reset") { + this.dom.scrollTop = 0; + } else if (scroll == "to selection") { + this.scrollToSelection(); + } else if (oldScrollPos) { + resetScrollPos(oldScrollPos); + } + } + /** + @internal + */ + scrollToSelection() { + let startDOM = this.domSelectionRange().focusNode; + if (this.someProp("handleScrollToSelection", (f3) => f3(this))) ; + else if (this.state.selection instanceof NodeSelection) { + let target = this.docView.domAfterPos(this.state.selection.from); + if (target.nodeType == 1) + scrollRectIntoView(this, target.getBoundingClientRect(), startDOM); + } else { + scrollRectIntoView(this, this.coordsAtPos(this.state.selection.head, 1), startDOM); + } + } + destroyPluginViews() { + let view; + while (view = this.pluginViews.pop()) + if (view.destroy) + view.destroy(); + } + updatePluginViews(prevState) { + if (!prevState || prevState.plugins != this.state.plugins || this.directPlugins != this.prevDirectPlugins) { + this.prevDirectPlugins = this.directPlugins; + this.destroyPluginViews(); + for (let i2 = 0; i2 < this.directPlugins.length; i2++) { + let plugin = this.directPlugins[i2]; + if (plugin.spec.view) + this.pluginViews.push(plugin.spec.view(this)); + } + for (let i2 = 0; i2 < this.state.plugins.length; i2++) { + let plugin = this.state.plugins[i2]; + if (plugin.spec.view) + this.pluginViews.push(plugin.spec.view(this)); + } + } else { + for (let i2 = 0; i2 < this.pluginViews.length; i2++) { + let pluginView = this.pluginViews[i2]; + if (pluginView.update) + pluginView.update(this, prevState); + } + } + } + updateDraggedNode(dragging, prev) { + let sel = dragging.node, found2 = -1; + if (this.state.doc.nodeAt(sel.from) == sel.node) { + found2 = sel.from; + } else { + let movedPos = sel.from + (this.state.doc.content.size - prev.doc.content.size); + let moved = movedPos > 0 && this.state.doc.nodeAt(movedPos); + if (moved == sel.node) + found2 = movedPos; + } + this.dragging = new Dragging(dragging.slice, dragging.move, found2 < 0 ? void 0 : NodeSelection.create(this.state.doc, found2)); + } + someProp(propName, f3) { + let prop = this._props && this._props[propName], value; + if (prop != null && (value = f3 ? f3(prop) : prop)) + return value; + for (let i2 = 0; i2 < this.directPlugins.length; i2++) { + let prop2 = this.directPlugins[i2].props[propName]; + if (prop2 != null && (value = f3 ? f3(prop2) : prop2)) + return value; + } + let plugins = this.state.plugins; + if (plugins) + for (let i2 = 0; i2 < plugins.length; i2++) { + let prop2 = plugins[i2].props[propName]; + if (prop2 != null && (value = f3 ? f3(prop2) : prop2)) + return value; + } + } + /** + Query whether the view has focus. + */ + hasFocus() { + if (ie) { + let node2 = this.root.activeElement; + if (node2 == this.dom) + return true; + if (!node2 || !this.dom.contains(node2)) + return false; + while (node2 && this.dom != node2 && this.dom.contains(node2)) { + if (node2.contentEditable == "false") + return false; + node2 = node2.parentElement; + } + return true; + } + return this.root.activeElement == this.dom; + } + /** + Focus the editor. + */ + focus() { + this.domObserver.stop(); + if (this.editable) + focusPreventScroll(this.dom); + selectionToDOM(this); + this.domObserver.start(); + } + /** + Get the document root in which the editor exists. This will + usually be the top-level `document`, but might be a [shadow + DOM](https://developer.mozilla.org/en-US/docs/Web/Web_Components/Shadow_DOM) + root if the editor is inside one. + */ + get root() { + let cached = this._root; + if (cached == null) + for (let search2 = this.dom.parentNode; search2; search2 = search2.parentNode) { + if (search2.nodeType == 9 || search2.nodeType == 11 && search2.host) { + if (!search2.getSelection) + Object.getPrototypeOf(search2).getSelection = () => search2.ownerDocument.getSelection(); + return this._root = search2; + } + } + return cached || document; + } + /** + When an existing editor view is moved to a new document or + shadow tree, call this to make it recompute its root. + */ + updateRoot() { + this._root = null; + } + /** + Given a pair of viewport coordinates, return the document + position that corresponds to them. May return null if the given + coordinates aren't inside of the editor. When an object is + returned, its `pos` property is the position nearest to the + coordinates, and its `inside` property holds the position of the + inner node that the position falls inside of, or -1 if it is at + the top level, not in any node. + */ + posAtCoords(coords) { + return posAtCoords(this, coords); + } + /** + Returns the viewport rectangle at a given document position. + `left` and `right` will be the same number, as this returns a + flat cursor-ish rectangle. If the position is between two things + that aren't directly adjacent, `side` determines which element + is used. When < 0, the element before the position is used, + otherwise the element after. + */ + coordsAtPos(pos, side = 1) { + return coordsAtPos(this, pos, side); + } + /** + Find the DOM position that corresponds to the given document + position. When `side` is negative, find the position as close as + possible to the content before the position. When positive, + prefer positions close to the content after the position. When + zero, prefer as shallow a position as possible. + + Note that you should **not** mutate the editor's internal DOM, + only inspect it (and even that is usually not necessary). + */ + domAtPos(pos, side = 0) { + return this.docView.domFromPos(pos, side); + } + /** + Find the DOM node that represents the document node after the + given position. May return `null` when the position doesn't point + in front of a node or if the node is inside an opaque node view. + + This is intended to be able to call things like + `getBoundingClientRect` on that DOM node. Do **not** mutate the + editor DOM directly, or add styling this way, since that will be + immediately overriden by the editor as it redraws the node. + */ + nodeDOM(pos) { + let desc = this.docView.descAt(pos); + return desc ? desc.nodeDOM : null; + } + /** + Find the document position that corresponds to a given DOM + position. (Whenever possible, it is preferable to inspect the + document structure directly, rather than poking around in the + DOM, but sometimes—for example when interpreting an event + target—you don't have a choice.) + + The `bias` parameter can be used to influence which side of a DOM + node to use when the position is inside a leaf node. + */ + posAtDOM(node2, offset, bias = -1) { + let pos = this.docView.posFromDOM(node2, offset, bias); + if (pos == null) + throw new RangeError("DOM position not inside the editor"); + return pos; + } + /** + Find out whether the selection is at the end of a textblock when + moving in a given direction. When, for example, given `"left"`, + it will return true if moving left from the current cursor + position would leave that position's parent textblock. Will apply + to the view's current state by default, but it is possible to + pass a different state. + */ + endOfTextblock(dir, state) { + return endOfTextblock(this, state || this.state, dir); + } + /** + Run the editor's paste logic with the given HTML string. The + `event`, if given, will be passed to the + [`handlePaste`](https://prosemirror.net/docs/ref/#view.EditorProps.handlePaste) hook. + */ + pasteHTML(html3, event) { + return doPaste(this, "", html3, false, event || new ClipboardEvent("paste")); + } + /** + Run the editor's paste logic with the given plain-text input. + */ + pasteText(text5, event) { + return doPaste(this, text5, null, true, event || new ClipboardEvent("paste")); + } + /** + Removes the editor from the DOM and destroys all [node + views](https://prosemirror.net/docs/ref/#view.NodeView). + */ + destroy() { + if (!this.docView) + return; + destroyInput(this); + this.destroyPluginViews(); + if (this.mounted) { + this.docView.update(this.state.doc, [], viewDecorations(this), this); + this.dom.textContent = ""; + } else if (this.dom.parentNode) { + this.dom.parentNode.removeChild(this.dom); + } + this.docView.destroy(); + this.docView = null; + clearReusedRange(); + } + /** + This is true when the view has been + [destroyed](https://prosemirror.net/docs/ref/#view.EditorView.destroy) (and thus should not be + used anymore). + */ + get isDestroyed() { + return this.docView == null; + } + /** + Used for testing. + */ + dispatchEvent(event) { + return dispatchEvent2(this, event); + } + /** + Dispatch a transaction. Will call + [`dispatchTransaction`](https://prosemirror.net/docs/ref/#view.DirectEditorProps.dispatchTransaction) + when given, and otherwise defaults to applying the transaction to + the current state and calling + [`updateState`](https://prosemirror.net/docs/ref/#view.EditorView.updateState) with the result. + This method is bound to the view instance, so that it can be + easily passed around. + */ + dispatch(tr) { + let dispatchTransaction = this._props.dispatchTransaction; + if (dispatchTransaction) + dispatchTransaction.call(this, tr); + else + this.updateState(this.state.apply(tr)); + } + /** + @internal + */ + domSelectionRange() { + let sel = this.domSelection(); + return safari && this.root.nodeType === 11 && deepActiveElement(this.dom.ownerDocument) == this.dom && safariShadowSelectionRange(this, sel) || sel; + } + /** + @internal + */ + domSelection() { + return this.root.getSelection(); + } + }; + function computeDocDeco(view) { + let attrs = /* @__PURE__ */ Object.create(null); + attrs.class = "ProseMirror"; + attrs.contenteditable = String(view.editable); + view.someProp("attributes", (value) => { + if (typeof value == "function") + value = value(view.state); + if (value) + for (let attr in value) { + if (attr == "class") + attrs.class += " " + value[attr]; + else if (attr == "style") + attrs.style = (attrs.style ? attrs.style + ";" : "") + value[attr]; + else if (!attrs[attr] && attr != "contenteditable" && attr != "nodeName") + attrs[attr] = String(value[attr]); + } + }); + if (!attrs.translate) + attrs.translate = "no"; + return [Decoration.node(0, view.state.doc.content.size, attrs)]; + } + function updateCursorWrapper(view) { + if (view.markCursor) { + let dom = document.createElement("img"); + dom.className = "ProseMirror-separator"; + dom.setAttribute("mark-placeholder", "true"); + dom.setAttribute("alt", ""); + view.cursorWrapper = { dom, deco: Decoration.widget(view.state.selection.head, dom, { raw: true, marks: view.markCursor }) }; + } else { + view.cursorWrapper = null; + } + } + function getEditable(view) { + return !view.someProp("editable", (value) => value(view.state) === false); + } + function selectionContextChanged(sel1, sel2) { + let depth = Math.min(sel1.$anchor.sharedDepth(sel1.head), sel2.$anchor.sharedDepth(sel2.head)); + return sel1.$anchor.start(depth) != sel2.$anchor.start(depth); + } + function buildNodeViews(view) { + let result = /* @__PURE__ */ Object.create(null); + function add(obj) { + for (let prop in obj) + if (!Object.prototype.hasOwnProperty.call(result, prop)) + result[prop] = obj[prop]; + } + view.someProp("nodeViews", add); + view.someProp("markViews", add); + return result; + } + function changedNodeViews(a2, b4) { + let nA = 0, nB = 0; + for (let prop in a2) { + if (a2[prop] != b4[prop]) + return true; + nA++; + } + for (let _3 in b4) + nB++; + return nA != nB; + } + function checkStateComponent(plugin) { + if (plugin.spec.state || plugin.spec.filterTransaction || plugin.spec.appendTransaction) + throw new RangeError("Plugins passed directly to the view must not have a state component"); + } + + // node_modules/prosemirror-inputrules/dist/index.js + var InputRule = class { + // :: (RegExp, union) + /** + Create an input rule. The rule applies when the user typed + something and the text directly in front of the cursor matches + `match`, which should end with `$`. + + The `handler` can be a string, in which case the matched text, or + the first matched group in the regexp, is replaced by that + string. + + Or a it can be a function, which will be called with the match + array produced by + [`RegExp.exec`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp/exec), + as well as the start and end of the matched range, and which can + return a [transaction](https://prosemirror.net/docs/ref/#state.Transaction) that describes the + rule's effect, or null to indicate the input was not handled. + */ + constructor(match, handler, options2 = {}) { + this.match = match; + this.match = match; + this.handler = typeof handler == "string" ? stringHandler(handler) : handler; + this.undoable = options2.undoable !== false; + this.inCode = options2.inCode || false; + } + }; + function stringHandler(string3) { + return function(state, match, start, end) { + let insert = string3; + if (match[1]) { + let offset = match[0].lastIndexOf(match[1]); + insert += match[0].slice(offset + match[1].length); + start += offset; + let cutOff = start - end; + if (cutOff > 0) { + insert = match[0].slice(offset - cutOff, offset) + insert; + start = end; + } + } + return state.tr.insertText(insert, start, end); + }; + } + var undoInputRule = (state, dispatch) => { + let plugins = state.plugins; + for (let i2 = 0; i2 < plugins.length; i2++) { + let plugin = plugins[i2], undoable; + if (plugin.spec.isInputRules && (undoable = plugin.getState(state))) { + if (dispatch) { + let tr = state.tr, toUndo = undoable.transform; + for (let j6 = toUndo.steps.length - 1; j6 >= 0; j6--) + tr.step(toUndo.steps[j6].invert(toUndo.docs[j6])); + if (undoable.text) { + let marks = tr.doc.resolve(undoable.from).marks(); + tr.replaceWith(undoable.from, undoable.to, state.schema.text(undoable.text, marks)); + } else { + tr.delete(undoable.from, undoable.to); + } + dispatch(tr); + } + return true; + } + } + return false; + }; + var emDash = new InputRule(/--$/, "\u2014"); + var ellipsis = new InputRule(/\.\.\.$/, "\u2026"); + var openDoubleQuote = new InputRule(/(?:^|[\s\{\[\(\<'"\u2018\u201C])(")$/, "\u201C"); + var closeDoubleQuote = new InputRule(/"$/, "\u201D"); + var openSingleQuote = new InputRule(/(?:^|[\s\{\[\(\<'"\u2018\u201C])(')$/, "\u2018"); + var closeSingleQuote = new InputRule(/'$/, "\u2019"); + function wrappingInputRule(regexp, nodeType, getAttrs = null, joinPredicate) { + return new InputRule(regexp, (state, match, start, end) => { + let attrs = getAttrs instanceof Function ? getAttrs(match) : getAttrs; + let tr = state.tr.delete(start, end); + let $start = tr.doc.resolve(start), range = $start.blockRange(), wrapping = range && findWrapping(range, nodeType, attrs); + if (!wrapping) + return null; + tr.wrap(range, wrapping); + let before = tr.doc.resolve(start - 1).nodeBefore; + if (before && before.type == nodeType && canJoin(tr.doc, start - 1) && (!joinPredicate || joinPredicate(match, before))) + tr.join(start - 1); + return tr; + }); + } + function textblockTypeInputRule(regexp, nodeType, getAttrs = null) { + return new InputRule(regexp, (state, match, start, end) => { + let $start = state.doc.resolve(start); + let attrs = getAttrs instanceof Function ? getAttrs(match) : getAttrs; + if (!$start.node(-1).canReplaceWith($start.index(-1), $start.indexAfter(-1), nodeType)) + return null; + return state.tr.delete(start, end).setBlockType(start, start, nodeType, attrs); + }); + } + + // node_modules/@milkdown/prose/lib/index.js + var nav2 = typeof navigator != "undefined" ? navigator : null; + var doc3 = typeof document != "undefined" ? document : null; + var agent2 = nav2 && nav2.userAgent || ""; + var ie_edge2 = /Edge\/(\d+)/.exec(agent2); + var ie_upto102 = /MSIE \d/.exec(agent2); + var ie_11up2 = /Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(agent2); + var ie2 = !!(ie_upto102 || ie_11up2 || ie_edge2); + var ie_version2 = ie_upto102 ? document.documentMode : ie_11up2 ? +ie_11up2[1] : ie_edge2 ? +ie_edge2[1] : 0; + var gecko2 = !ie2 && /gecko\/(\d+)/i.test(agent2); + var gecko_version = gecko2 && +(/Firefox\/(\d+)/.exec(agent2) || [0, 0])[1]; + var _chrome2 = !ie2 && /Chrome\/(\d+)/.exec(agent2); + var chrome2 = !!_chrome2; + var chrome_version2 = _chrome2 ? +_chrome2[1] : 0; + var safari2 = !ie2 && !!nav2 && /Apple Computer/.test(nav2.vendor); + var ios2 = safari2 && (/Mobile\/\w+/.test(agent2) || !!nav2 && nav2.maxTouchPoints > 2); + var mac2 = ios2 || (nav2 ? /Mac/.test(nav2.platform) : false); + var android2 = /Android \d/.test(agent2); + var webkit2 = !!doc3 && "webkitFontSmoothing" in doc3.documentElement.style; + var webkit_version2 = webkit2 ? +(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent) || [0, 0])[1] : 0; + var browser = /* @__PURE__ */ Object.freeze({ + __proto__: null, + android: android2, + chrome: chrome2, + chrome_version: chrome_version2, + gecko: gecko2, + gecko_version, + ie: ie2, + ie_version: ie_version2, + ios: ios2, + mac: mac2, + safari: safari2, + webkit: webkit2, + webkit_version: webkit_version2 + }); + function run(view, from, to, text5, rules, plugin) { + if (view.composing) + return false; + const state = view.state; + const $from = state.doc.resolve(from); + if ($from.parent.type.spec.code) + return false; + const textBefore = $from.parent.textBetween(Math.max(0, $from.parentOffset - 500), $from.parentOffset, void 0, "\uFFFC") + text5; + for (let i2 = 0; i2 < rules.length; i2++) { + const match = rules[i2].match.exec(textBefore); + const tr = match && match[0] && rules[i2].handler(state, match, from - (match[0].length - text5.length), to); + if (!tr) + continue; + view.dispatch(tr.setMeta(plugin, { transform: tr, from, to, text: text5 })); + return true; + } + return false; + } + var customInputRulesKey = new PluginKey("MILKDOWN_CUSTOM_INPUTRULES"); + function customInputRules({ rules }) { + const plugin = new Plugin({ + key: customInputRulesKey, + isInputRules: true, + state: { + init() { + return null; + }, + apply(tr, prev) { + const stored = tr.getMeta(this); + if (stored) + return stored; + return tr.selectionSet || tr.docChanged ? null : prev; + } + }, + props: { + handleTextInput(view, from, to, text5) { + return run(view, from, to, text5, rules, plugin); + }, + handleDOMEvents: { + compositionend: (view) => { + setTimeout(() => { + const { $cursor } = view.state.selection; + if ($cursor) + run(view, $cursor.pos, $cursor.pos, "", rules, plugin); + }); + return false; + } + }, + handleKeyDown(view, event) { + if (event.key !== "Enter") + return false; + const { $cursor } = view.state.selection; + if ($cursor) + return run(view, $cursor.pos, $cursor.pos, "\n", rules, plugin); + return false; + } + } + }); + return plugin; + } + function markRule(regexp, markType, options2 = {}) { + return new InputRule(regexp, (state, match, start, end) => { + var _a, _b, _c, _d; + const { tr } = state; + const matchLength = match.length; + let group = match[matchLength - 1]; + let fullMatch = match[0]; + let initialStoredMarks = []; + let markEnd = end; + const captured = { + group, + fullMatch, + start, + end + }; + const result = (_a = options2.updateCaptured) == null ? void 0 : _a.call(options2, captured); + Object.assign(captured, result); + ({ group, fullMatch, start, end } = captured); + if (fullMatch === null) + return null; + if ((group == null ? void 0 : group.trim()) === "") + return null; + if (group) { + const startSpaces = fullMatch.search(/\S/); + const textStart = start + fullMatch.indexOf(group); + const textEnd = textStart + group.length; + initialStoredMarks = (_b = tr.storedMarks) != null ? _b : []; + if (textEnd < end) + tr.delete(textEnd, end); + if (textStart > start) + tr.delete(start + startSpaces, textStart); + markEnd = start + startSpaces + group.length; + const attrs = (_c = options2.getAttr) == null ? void 0 : _c.call(options2, match); + tr.addMark(start, markEnd, markType.create(attrs)); + tr.setStoredMarks(initialStoredMarks); + (_d = options2.beforeDispatch) == null ? void 0 : _d.call(options2, { match, start, end, tr }); + } + return tr; + }); + } + function cloneTr(tr) { + return Object.assign(Object.create(tr), tr).setTime(Date.now()); + } + function equalNodeType(nodeType, node2) { + return Array.isArray(nodeType) && nodeType.includes(node2.type) || node2.type === nodeType; + } + function findParentNodeClosestToPos(predicate) { + return ($pos) => { + for (let i2 = $pos.depth; i2 > 0; i2--) { + const node2 = $pos.node(i2); + if (predicate(node2)) { + return { + pos: i2 > 0 ? $pos.before(i2) : 0, + start: $pos.start(i2), + depth: i2, + node: node2 + }; + } + } + return void 0; + }; + } + function findParentNode(predicate) { + return (selection) => { + return findParentNodeClosestToPos(predicate)(selection.$from); + }; + } + function findSelectedNodeOfType(selection, nodeType) { + if (!(selection instanceof NodeSelection)) + return; + const { node: node2, $from } = selection; + if (equalNodeType(nodeType, node2)) + return { node: node2, pos: $from.pos, start: $from.start($from.depth), depth: $from.depth }; + return void 0; + } + + // node_modules/prosemirror-commands/dist/index.js + var deleteSelection = (state, dispatch) => { + if (state.selection.empty) + return false; + if (dispatch) + dispatch(state.tr.deleteSelection().scrollIntoView()); + return true; + }; + function atBlockStart(state, view) { + let { $cursor } = state.selection; + if (!$cursor || (view ? !view.endOfTextblock("backward", state) : $cursor.parentOffset > 0)) + return null; + return $cursor; + } + var joinBackward = (state, dispatch, view) => { + let $cursor = atBlockStart(state, view); + if (!$cursor) + return false; + let $cut = findCutBefore($cursor); + if (!$cut) { + let range = $cursor.blockRange(), target = range && liftTarget(range); + if (target == null) + return false; + if (dispatch) + dispatch(state.tr.lift(range, target).scrollIntoView()); + return true; + } + let before = $cut.nodeBefore; + if (!before.type.spec.isolating && deleteBarrier(state, $cut, dispatch)) + return true; + if ($cursor.parent.content.size == 0 && (textblockAt(before, "end") || NodeSelection.isSelectable(before))) { + let delStep = replaceStep(state.doc, $cursor.before(), $cursor.after(), Slice.empty); + if (delStep && delStep.slice.size < delStep.to - delStep.from) { + if (dispatch) { + let tr = state.tr.step(delStep); + tr.setSelection(textblockAt(before, "end") ? Selection.findFrom(tr.doc.resolve(tr.mapping.map($cut.pos, -1)), -1) : NodeSelection.create(tr.doc, $cut.pos - before.nodeSize)); + dispatch(tr.scrollIntoView()); + } + return true; + } + } + if (before.isAtom && $cut.depth == $cursor.depth - 1) { + if (dispatch) + dispatch(state.tr.delete($cut.pos - before.nodeSize, $cut.pos).scrollIntoView()); + return true; + } + return false; + }; + function textblockAt(node2, side, only = false) { + for (let scan = node2; scan; scan = side == "start" ? scan.firstChild : scan.lastChild) { + if (scan.isTextblock) + return true; + if (only && scan.childCount != 1) + return false; + } + return false; + } + var selectNodeBackward = (state, dispatch, view) => { + let { $head, empty: empty3 } = state.selection, $cut = $head; + if (!empty3) + return false; + if ($head.parent.isTextblock) { + if (view ? !view.endOfTextblock("backward", state) : $head.parentOffset > 0) + return false; + $cut = findCutBefore($head); + } + let node2 = $cut && $cut.nodeBefore; + if (!node2 || !NodeSelection.isSelectable(node2)) + return false; + if (dispatch) + dispatch(state.tr.setSelection(NodeSelection.create(state.doc, $cut.pos - node2.nodeSize)).scrollIntoView()); + return true; + }; + function findCutBefore($pos) { + if (!$pos.parent.type.spec.isolating) + for (let i2 = $pos.depth - 1; i2 >= 0; i2--) { + if ($pos.index(i2) > 0) + return $pos.doc.resolve($pos.before(i2 + 1)); + if ($pos.node(i2).type.spec.isolating) + break; + } + return null; + } + function atBlockEnd(state, view) { + let { $cursor } = state.selection; + if (!$cursor || (view ? !view.endOfTextblock("forward", state) : $cursor.parentOffset < $cursor.parent.content.size)) + return null; + return $cursor; + } + var joinForward = (state, dispatch, view) => { + let $cursor = atBlockEnd(state, view); + if (!$cursor) + return false; + let $cut = findCutAfter($cursor); + if (!$cut) + return false; + let after = $cut.nodeAfter; + if (deleteBarrier(state, $cut, dispatch)) + return true; + if ($cursor.parent.content.size == 0 && (textblockAt(after, "start") || NodeSelection.isSelectable(after))) { + let delStep = replaceStep(state.doc, $cursor.before(), $cursor.after(), Slice.empty); + if (delStep && delStep.slice.size < delStep.to - delStep.from) { + if (dispatch) { + let tr = state.tr.step(delStep); + tr.setSelection(textblockAt(after, "start") ? Selection.findFrom(tr.doc.resolve(tr.mapping.map($cut.pos)), 1) : NodeSelection.create(tr.doc, tr.mapping.map($cut.pos))); + dispatch(tr.scrollIntoView()); + } + return true; + } + } + if (after.isAtom && $cut.depth == $cursor.depth - 1) { + if (dispatch) + dispatch(state.tr.delete($cut.pos, $cut.pos + after.nodeSize).scrollIntoView()); + return true; + } + return false; + }; + var selectNodeForward = (state, dispatch, view) => { + let { $head, empty: empty3 } = state.selection, $cut = $head; + if (!empty3) + return false; + if ($head.parent.isTextblock) { + if (view ? !view.endOfTextblock("forward", state) : $head.parentOffset < $head.parent.content.size) + return false; + $cut = findCutAfter($head); + } + let node2 = $cut && $cut.nodeAfter; + if (!node2 || !NodeSelection.isSelectable(node2)) + return false; + if (dispatch) + dispatch(state.tr.setSelection(NodeSelection.create(state.doc, $cut.pos)).scrollIntoView()); + return true; + }; + function findCutAfter($pos) { + if (!$pos.parent.type.spec.isolating) + for (let i2 = $pos.depth - 1; i2 >= 0; i2--) { + let parent = $pos.node(i2); + if ($pos.index(i2) + 1 < parent.childCount) + return $pos.doc.resolve($pos.after(i2 + 1)); + if (parent.type.spec.isolating) + break; + } + return null; + } + var newlineInCode = (state, dispatch) => { + let { $head, $anchor } = state.selection; + if (!$head.parent.type.spec.code || !$head.sameParent($anchor)) + return false; + if (dispatch) + dispatch(state.tr.insertText("\n").scrollIntoView()); + return true; + }; + function defaultBlockAt(match) { + for (let i2 = 0; i2 < match.edgeCount; i2++) { + let { type } = match.edge(i2); + if (type.isTextblock && !type.hasRequiredAttrs()) + return type; + } + return null; + } + var exitCode = (state, dispatch) => { + let { $head, $anchor } = state.selection; + if (!$head.parent.type.spec.code || !$head.sameParent($anchor)) + return false; + let above = $head.node(-1), after = $head.indexAfter(-1), type = defaultBlockAt(above.contentMatchAt(after)); + if (!type || !above.canReplaceWith(after, after, type)) + return false; + if (dispatch) { + let pos = $head.after(), tr = state.tr.replaceWith(pos, pos, type.createAndFill()); + tr.setSelection(Selection.near(tr.doc.resolve(pos), 1)); + dispatch(tr.scrollIntoView()); + } + return true; + }; + var createParagraphNear = (state, dispatch) => { + let sel = state.selection, { $from, $to } = sel; + if (sel instanceof AllSelection || $from.parent.inlineContent || $to.parent.inlineContent) + return false; + let type = defaultBlockAt($to.parent.contentMatchAt($to.indexAfter())); + if (!type || !type.isTextblock) + return false; + if (dispatch) { + let side = (!$from.parentOffset && $to.index() < $to.parent.childCount ? $from : $to).pos; + let tr = state.tr.insert(side, type.createAndFill()); + tr.setSelection(TextSelection.create(tr.doc, side + 1)); + dispatch(tr.scrollIntoView()); + } + return true; + }; + var liftEmptyBlock = (state, dispatch) => { + let { $cursor } = state.selection; + if (!$cursor || $cursor.parent.content.size) + return false; + if ($cursor.depth > 1 && $cursor.after() != $cursor.end(-1)) { + let before = $cursor.before(); + if (canSplit(state.doc, before)) { + if (dispatch) + dispatch(state.tr.split(before).scrollIntoView()); + return true; + } + } + let range = $cursor.blockRange(), target = range && liftTarget(range); + if (target == null) + return false; + if (dispatch) + dispatch(state.tr.lift(range, target).scrollIntoView()); + return true; + }; + function splitBlockAs(splitNode) { + return (state, dispatch) => { + let { $from, $to } = state.selection; + if (state.selection instanceof NodeSelection && state.selection.node.isBlock) { + if (!$from.parentOffset || !canSplit(state.doc, $from.pos)) + return false; + if (dispatch) + dispatch(state.tr.split($from.pos).scrollIntoView()); + return true; + } + if (!$from.parent.isBlock) + return false; + if (dispatch) { + let atEnd = $to.parentOffset == $to.parent.content.size; + let tr = state.tr; + if (state.selection instanceof TextSelection || state.selection instanceof AllSelection) + tr.deleteSelection(); + let deflt = $from.depth == 0 ? null : defaultBlockAt($from.node(-1).contentMatchAt($from.indexAfter(-1))); + let splitType = splitNode && splitNode($to.parent, atEnd); + let types = splitType ? [splitType] : atEnd && deflt ? [{ type: deflt }] : void 0; + let can = canSplit(tr.doc, tr.mapping.map($from.pos), 1, types); + if (!types && !can && canSplit(tr.doc, tr.mapping.map($from.pos), 1, deflt ? [{ type: deflt }] : void 0)) { + if (deflt) + types = [{ type: deflt }]; + can = true; + } + if (can) { + tr.split(tr.mapping.map($from.pos), 1, types); + if (!atEnd && !$from.parentOffset && $from.parent.type != deflt) { + let first = tr.mapping.map($from.before()), $first = tr.doc.resolve(first); + if (deflt && $from.node(-1).canReplaceWith($first.index(), $first.index() + 1, deflt)) + tr.setNodeMarkup(tr.mapping.map($from.before()), deflt); + } + } + dispatch(tr.scrollIntoView()); + } + return true; + }; + } + var splitBlock = splitBlockAs(); + var selectAll = (state, dispatch) => { + if (dispatch) + dispatch(state.tr.setSelection(new AllSelection(state.doc))); + return true; + }; + function joinMaybeClear(state, $pos, dispatch) { + let before = $pos.nodeBefore, after = $pos.nodeAfter, index2 = $pos.index(); + if (!before || !after || !before.type.compatibleContent(after.type)) + return false; + if (!before.content.size && $pos.parent.canReplace(index2 - 1, index2)) { + if (dispatch) + dispatch(state.tr.delete($pos.pos - before.nodeSize, $pos.pos).scrollIntoView()); + return true; + } + if (!$pos.parent.canReplace(index2, index2 + 1) || !(after.isTextblock || canJoin(state.doc, $pos.pos))) + return false; + if (dispatch) + dispatch(state.tr.clearIncompatible($pos.pos, before.type, before.contentMatchAt(before.childCount)).join($pos.pos).scrollIntoView()); + return true; + } + function deleteBarrier(state, $cut, dispatch) { + let before = $cut.nodeBefore, after = $cut.nodeAfter, conn, match; + if (before.type.spec.isolating || after.type.spec.isolating) + return false; + if (joinMaybeClear(state, $cut, dispatch)) + return true; + let canDelAfter = $cut.parent.canReplace($cut.index(), $cut.index() + 1); + if (canDelAfter && (conn = (match = before.contentMatchAt(before.childCount)).findWrapping(after.type)) && match.matchType(conn[0] || after.type).validEnd) { + if (dispatch) { + let end = $cut.pos + after.nodeSize, wrap3 = Fragment.empty; + for (let i2 = conn.length - 1; i2 >= 0; i2--) + wrap3 = Fragment.from(conn[i2].create(null, wrap3)); + wrap3 = Fragment.from(before.copy(wrap3)); + let tr = state.tr.step(new ReplaceAroundStep($cut.pos - 1, end, $cut.pos, end, new Slice(wrap3, 1, 0), conn.length, true)); + let joinAt = end + 2 * conn.length; + if (canJoin(tr.doc, joinAt)) + tr.join(joinAt); + dispatch(tr.scrollIntoView()); + } + return true; + } + let selAfter = Selection.findFrom($cut, 1); + let range = selAfter && selAfter.$from.blockRange(selAfter.$to), target = range && liftTarget(range); + if (target != null && target >= $cut.depth) { + if (dispatch) + dispatch(state.tr.lift(range, target).scrollIntoView()); + return true; + } + if (canDelAfter && textblockAt(after, "start", true) && textblockAt(before, "end")) { + let at4 = before, wrap3 = []; + for (; ; ) { + wrap3.push(at4); + if (at4.isTextblock) + break; + at4 = at4.lastChild; + } + let afterText = after, afterDepth = 1; + for (; !afterText.isTextblock; afterText = afterText.firstChild) + afterDepth++; + if (at4.canReplace(at4.childCount, at4.childCount, afterText.content)) { + if (dispatch) { + let end = Fragment.empty; + for (let i2 = wrap3.length - 1; i2 >= 0; i2--) + end = Fragment.from(wrap3[i2].copy(end)); + let tr = state.tr.step(new ReplaceAroundStep($cut.pos - wrap3.length, $cut.pos + after.nodeSize, $cut.pos + afterDepth, $cut.pos + after.nodeSize - afterDepth, new Slice(end, wrap3.length, 0), 0, true)); + dispatch(tr.scrollIntoView()); + } + return true; + } + } + return false; + } + function selectTextblockSide(side) { + return function(state, dispatch) { + let sel = state.selection, $pos = side < 0 ? sel.$from : sel.$to; + let depth = $pos.depth; + while ($pos.node(depth).isInline) { + if (!depth) + return false; + depth--; + } + if (!$pos.node(depth).isTextblock) + return false; + if (dispatch) + dispatch(state.tr.setSelection(TextSelection.create(state.doc, side < 0 ? $pos.start(depth) : $pos.end(depth)))); + return true; + }; + } + var selectTextblockStart = selectTextblockSide(-1); + var selectTextblockEnd = selectTextblockSide(1); + function wrapIn(nodeType, attrs = null) { + return function(state, dispatch) { + let { $from, $to } = state.selection; + let range = $from.blockRange($to), wrapping = range && findWrapping(range, nodeType, attrs); + if (!wrapping) + return false; + if (dispatch) + dispatch(state.tr.wrap(range, wrapping).scrollIntoView()); + return true; + }; + } + function setBlockType2(nodeType, attrs = null) { + return function(state, dispatch) { + let applicable = false; + for (let i2 = 0; i2 < state.selection.ranges.length && !applicable; i2++) { + let { $from: { pos: from }, $to: { pos: to } } = state.selection.ranges[i2]; + state.doc.nodesBetween(from, to, (node2, pos) => { + if (applicable) + return false; + if (!node2.isTextblock || node2.hasMarkup(nodeType, attrs)) + return; + if (node2.type == nodeType) { + applicable = true; + } else { + let $pos = state.doc.resolve(pos), index2 = $pos.index(); + applicable = $pos.parent.canReplaceWith(index2, index2 + 1, nodeType); + } + }); + } + if (!applicable) + return false; + if (dispatch) { + let tr = state.tr; + for (let i2 = 0; i2 < state.selection.ranges.length; i2++) { + let { $from: { pos: from }, $to: { pos: to } } = state.selection.ranges[i2]; + tr.setBlockType(from, to, nodeType, attrs); + } + dispatch(tr.scrollIntoView()); + } + return true; + }; + } + function markApplies(doc4, ranges, type) { + for (let i2 = 0; i2 < ranges.length; i2++) { + let { $from, $to } = ranges[i2]; + let can = $from.depth == 0 ? doc4.inlineContent && doc4.type.allowsMarkType(type) : false; + doc4.nodesBetween($from.pos, $to.pos, (node2) => { + if (can) + return false; + can = node2.inlineContent && node2.type.allowsMarkType(type); + }); + if (can) + return true; + } + return false; + } + function toggleMark(markType, attrs = null) { + return function(state, dispatch) { + let { empty: empty3, $cursor, ranges } = state.selection; + if (empty3 && !$cursor || !markApplies(state.doc, ranges, markType)) + return false; + if (dispatch) { + if ($cursor) { + if (markType.isInSet(state.storedMarks || $cursor.marks())) + dispatch(state.tr.removeStoredMark(markType)); + else + dispatch(state.tr.addStoredMark(markType.create(attrs))); + } else { + let has = false, tr = state.tr; + for (let i2 = 0; !has && i2 < ranges.length; i2++) { + let { $from, $to } = ranges[i2]; + has = state.doc.rangeHasMark($from.pos, $to.pos, markType); + } + for (let i2 = 0; i2 < ranges.length; i2++) { + let { $from, $to } = ranges[i2]; + if (has) { + tr.removeMark($from.pos, $to.pos, markType); + } else { + let from = $from.pos, to = $to.pos, start = $from.nodeAfter, end = $to.nodeBefore; + let spaceStart = start && start.isText ? /^\s*/.exec(start.text)[0].length : 0; + let spaceEnd = end && end.isText ? /\s*$/.exec(end.text)[0].length : 0; + if (from + spaceStart < to) { + from += spaceStart; + to -= spaceEnd; + } + tr.addMark(from, to, markType.create(attrs)); + } + } + dispatch(tr.scrollIntoView()); + } + } + return true; + }; + } + function chainCommands(...commands) { + return function(state, dispatch, view) { + for (let i2 = 0; i2 < commands.length; i2++) + if (commands[i2](state, dispatch, view)) + return true; + return false; + }; + } + var backspace = chainCommands(deleteSelection, joinBackward, selectNodeBackward); + var del = chainCommands(deleteSelection, joinForward, selectNodeForward); + var pcBaseKeymap = { + "Enter": chainCommands(newlineInCode, createParagraphNear, liftEmptyBlock, splitBlock), + "Mod-Enter": exitCode, + "Backspace": backspace, + "Mod-Backspace": backspace, + "Shift-Backspace": backspace, + "Delete": del, + "Mod-Delete": del, + "Mod-a": selectAll + }; + var macBaseKeymap = { + "Ctrl-h": pcBaseKeymap["Backspace"], + "Alt-Backspace": pcBaseKeymap["Mod-Backspace"], + "Ctrl-d": pcBaseKeymap["Delete"], + "Ctrl-Alt-Backspace": pcBaseKeymap["Mod-Delete"], + "Alt-Delete": pcBaseKeymap["Mod-Delete"], + "Alt-d": pcBaseKeymap["Mod-Delete"], + "Ctrl-a": selectTextblockStart, + "Ctrl-e": selectTextblockEnd + }; + for (let key in pcBaseKeymap) + macBaseKeymap[key] = pcBaseKeymap[key]; + var mac3 = typeof navigator != "undefined" ? /Mac|iP(hone|[oa]d)/.test(navigator.platform) : typeof os != "undefined" && os.platform ? os.platform() == "darwin" : false; + var baseKeymap = mac3 ? macBaseKeymap : pcBaseKeymap; + + // node_modules/w3c-keyname/index.js + var base = { + 8: "Backspace", + 9: "Tab", + 10: "Enter", + 12: "NumLock", + 13: "Enter", + 16: "Shift", + 17: "Control", + 18: "Alt", + 20: "CapsLock", + 27: "Escape", + 32: " ", + 33: "PageUp", + 34: "PageDown", + 35: "End", + 36: "Home", + 37: "ArrowLeft", + 38: "ArrowUp", + 39: "ArrowRight", + 40: "ArrowDown", + 44: "PrintScreen", + 45: "Insert", + 46: "Delete", + 59: ";", + 61: "=", + 91: "Meta", + 92: "Meta", + 106: "*", + 107: "+", + 108: ",", + 109: "-", + 110: ".", + 111: "/", + 144: "NumLock", + 145: "ScrollLock", + 160: "Shift", + 161: "Shift", + 162: "Control", + 163: "Control", + 164: "Alt", + 165: "Alt", + 173: "-", + 186: ";", + 187: "=", + 188: ",", + 189: "-", + 190: ".", + 191: "/", + 192: "`", + 219: "[", + 220: "\\", + 221: "]", + 222: "'" + }; + var shift = { + 48: ")", + 49: "!", + 50: "@", + 51: "#", + 52: "$", + 53: "%", + 54: "^", + 55: "&", + 56: "*", + 57: "(", + 59: ":", + 61: "+", + 173: "_", + 186: ":", + 187: "+", + 188: "<", + 189: "_", + 190: ">", + 191: "?", + 192: "~", + 219: "{", + 220: "|", + 221: "}", + 222: '"' + }; + var mac4 = typeof navigator != "undefined" && /Mac/.test(navigator.platform); + var ie3 = typeof navigator != "undefined" && /MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent); + for (i2 = 0; i2 < 10; i2++) base[48 + i2] = base[96 + i2] = String(i2); + var i2; + for (i2 = 1; i2 <= 24; i2++) base[i2 + 111] = "F" + i2; + var i2; + for (i2 = 65; i2 <= 90; i2++) { + base[i2] = String.fromCharCode(i2 + 32); + shift[i2] = String.fromCharCode(i2); + } + var i2; + for (code3 in base) if (!shift.hasOwnProperty(code3)) shift[code3] = base[code3]; + var code3; + function keyName(event) { + var ignoreKey = mac4 && event.metaKey && event.shiftKey && !event.ctrlKey && !event.altKey || ie3 && event.shiftKey && event.key && event.key.length == 1 || event.key == "Unidentified"; + var name = !ignoreKey && event.key || (event.shiftKey ? shift : base)[event.keyCode] || event.key || "Unidentified"; + if (name == "Esc") name = "Escape"; + if (name == "Del") name = "Delete"; + if (name == "Left") name = "ArrowLeft"; + if (name == "Up") name = "ArrowUp"; + if (name == "Right") name = "ArrowRight"; + if (name == "Down") name = "ArrowDown"; + return name; + } + + // node_modules/prosemirror-keymap/dist/index.js + var mac5 = typeof navigator != "undefined" ? /Mac|iP(hone|[oa]d)/.test(navigator.platform) : false; + function normalizeKeyName(name) { + let parts = name.split(/-(?!$)/), result = parts[parts.length - 1]; + if (result == "Space") + result = " "; + let alt, ctrl, shift2, meta; + for (let i2 = 0; i2 < parts.length - 1; i2++) { + let mod = parts[i2]; + if (/^(cmd|meta|m)$/i.test(mod)) + meta = true; + else if (/^a(lt)?$/i.test(mod)) + alt = true; + else if (/^(c|ctrl|control)$/i.test(mod)) + ctrl = true; + else if (/^s(hift)?$/i.test(mod)) + shift2 = true; + else if (/^mod$/i.test(mod)) { + if (mac5) + meta = true; + else + ctrl = true; + } else + throw new Error("Unrecognized modifier name: " + mod); + } + if (alt) + result = "Alt-" + result; + if (ctrl) + result = "Ctrl-" + result; + if (meta) + result = "Meta-" + result; + if (shift2) + result = "Shift-" + result; + return result; + } + function normalize2(map5) { + let copy2 = /* @__PURE__ */ Object.create(null); + for (let prop in map5) + copy2[normalizeKeyName(prop)] = map5[prop]; + return copy2; + } + function modifiers(name, event, shift2 = true) { + if (event.altKey) + name = "Alt-" + name; + if (event.ctrlKey) + name = "Ctrl-" + name; + if (event.metaKey) + name = "Meta-" + name; + if (shift2 && event.shiftKey) + name = "Shift-" + name; + return name; + } + function keymap(bindings) { + return new Plugin({ props: { handleKeyDown: keydownHandler(bindings) } }); + } + function keydownHandler(bindings) { + let map5 = normalize2(bindings); + return function(view, event) { + let name = keyName(event), baseName, direct = map5[modifiers(name, event)]; + if (direct && direct(view.state, view.dispatch, view)) + return true; + if (name.length == 1 && name != " ") { + if (event.shiftKey) { + let noShift = map5[modifiers(name, event, false)]; + if (noShift && noShift(view.state, view.dispatch, view)) + return true; + } + if ((event.shiftKey || event.altKey || event.metaKey || name.charCodeAt(0) > 127) && (baseName = base[event.keyCode]) && baseName != name) { + let fromCode = map5[modifiers(baseName, event)]; + if (fromCode && fromCode(view.state, view.dispatch, view)) + return true; + } + } + return false; + }; + } + + // node_modules/@milkdown/core/lib/index.es.js + var ve = (e2, t2, r3) => { + if (!t2.has(e2)) + throw TypeError("Cannot " + r3); + }; + var s = (e2, t2, r3) => (ve(e2, t2, "read from private field"), r3 ? r3.call(e2) : t2.get(e2)); + var d4 = (e2, t2, r3) => { + if (t2.has(e2)) + throw TypeError("Cannot add the same private member more than once"); + t2 instanceof WeakSet ? t2.add(e2) : t2.set(e2, r3); + }; + var c3 = (e2, t2, r3, i2) => (ve(e2, t2, "write to private field"), i2 ? i2.call(e2, r3) : t2.set(e2, r3), r3); + function k3(e2, t2) { + return e2.meta = __spreadValues({ + package: "@milkdown/core", + group: "System" + }, t2), e2; + } + var De = { + strong: (e2, t2, r3, i2) => { + const n4 = e2.marker || r3.options.strong || "*", a2 = r3.enter("strong"), h5 = r3.createTracker(i2); + let m3 = h5.move(n4 + n4); + return m3 += h5.move( + r3.containerPhrasing(e2, __spreadValues({ + before: m3, + after: n4 + }, h5.current())) + ), m3 += h5.move(n4 + n4), a2(), m3; + }, + emphasis: (e2, t2, r3, i2) => { + const n4 = e2.marker || r3.options.emphasis || "*", a2 = r3.enter("emphasis"), h5 = r3.createTracker(i2); + let m3 = h5.move(n4); + return m3 += h5.move( + r3.containerPhrasing(e2, __spreadValues({ + before: m3, + after: n4 + }, h5.current())) + ), m3 += h5.move(n4), a2(), m3; + } + }; + var L3 = K("ConfigReady"); + function ot(e2) { + const t2 = (r3) => (r3.record(L3), async () => (await e2(r3), r3.done(L3), () => { + r3.clearTimer(L3); + })); + return k3(t2, { + displayName: "Config" + }), t2; + } + var M4 = K("InitReady"); + var G3 = H([], "initTimer"); + var ke = H({}, "editor"); + var ue = H([], "inputRules"); + var N2 = H([], "prosePlugins"); + var pe = H([], "remarkPlugins"); + var fe = H([], "nodeView"); + var ye = H([], "markView"); + var P3 = H(unified().use(remarkParse).use(remarkStringify), "remark"); + var Q2 = H({ + handlers: De + }, "remarkStringifyOptions"); + function at(e2) { + const t2 = (r3) => (r3.inject(ke, e2).inject(N2, []).inject(pe, []).inject(ue, []).inject(fe, []).inject(ye, []).inject(Q2, { + handlers: De + }).inject(P3, unified().use(remarkParse).use(remarkStringify)).inject(G3, [L3]).record(M4), async () => { + await r3.waitTimers(G3); + const i2 = r3.get(Q2); + return r3.set(P3, unified().use(remarkParse).use(remarkStringify, i2)), r3.done(M4), () => { + r3.remove(ke).remove(N2).remove(pe).remove(ue).remove(fe).remove(ye).remove(Q2).remove(P3).remove(G3).clearTimer(M4); + }; + }); + return k3(t2, { + displayName: "Init" + }), t2; + } + var R3 = K("SchemaReady"); + var U3 = H([], "schemaTimer"); + var b2 = H({}, "schema"); + var X = H([], "nodes"); + var Z2 = H([], "marks"); + function Te(e2) { + var t2; + return __spreadProps(__spreadValues({}, e2), { + parseDOM: (t2 = e2.parseDOM) == null ? void 0 : t2.map((r3) => __spreadValues({ priority: e2.priority }, r3)) + }); + } + var Ee = (e2) => (e2.inject(b2, {}).inject(X, []).inject(Z2, []).inject(U3, [M4]).record(R3), async () => { + await e2.waitTimers(U3); + const t2 = e2.get(P3), i2 = e2.get(pe).reduce((m3, f3) => m3.use(f3.plugin, f3.options), t2); + e2.set(P3, i2); + const n4 = Object.fromEntries(e2.get(X).map(([m3, f3]) => [m3, Te(f3)])), a2 = Object.fromEntries(e2.get(Z2).map(([m3, f3]) => [m3, Te(f3)])), h5 = new Schema({ nodes: n4, marks: a2 }); + return e2.set(b2, h5), e2.done(R3), () => { + e2.remove(b2).remove(X).remove(Z2).remove(U3).clearTimer(R3); + }; + }); + k3(Ee, { + displayName: "Schema" + }); + var W2 = K("ParserReady"); + var Ie = () => { + throw p(); + }; + var Y = H(Ie, "parser"); + var x4 = H([], "parserTimer"); + var Ve = (e2) => (e2.inject(Y, Ie).inject(x4, [R3]).record(W2), async () => { + await e2.waitTimers(x4); + const t2 = e2.get(P3), r3 = e2.get(b2); + return e2.set(Y, H2.create(r3, t2)), e2.done(W2), () => { + e2.remove(Y).remove(x4).clearTimer(W2); + }; + }); + k3(Ve, { + displayName: "Parser" + }); + var $ = K("SerializerReady"); + var ee = H([], "serializerTimer"); + var Me = () => { + throw p(); + }; + var te = H(Me, "serializer"); + var Ne = (e2) => (e2.inject(te, Me).inject(ee, [R3]).record($), async () => { + await e2.waitTimers(ee); + const t2 = e2.get(P3), r3 = e2.get(b2); + return e2.set(te, K2.create(r3, t2)), e2.done($), () => { + e2.remove(te).remove(ee).clearTimer($); + }; + }); + k3(Ne, { + displayName: "Serializer" + }); + var re = H("", "defaultValue"); + var V2 = H({}, "editorState"); + var se = H((e2) => e2, "stateOptions"); + var ie4 = H([], "editorStateTimer"); + var q4 = K("EditorStateReady"); + function ct(e2, t2, r3) { + if (typeof e2 == "string") + return t2(e2); + if (e2.type === "html") + return DOMParser.fromSchema(r3).parse(e2.dom); + if (e2.type === "json") + return Node2.fromJSON(r3, e2.value); + throw l(e2); + } + var mt = new PluginKey("MILKDOWN_STATE_TRACKER"); + function dt(e2) { + const t2 = chainCommands( + undoInputRule, + deleteSelection, + joinBackward, + selectNodeBackward + ); + return e2.Backspace = t2, e2; + } + var _e = (e2) => (e2.inject(re, "").inject(V2, {}).inject(se, (t2) => t2).inject(ie4, [W2, $, J3]).record(q4), async () => { + await e2.waitTimers(ie4); + const t2 = e2.get(b2), r3 = e2.get(Y), i2 = e2.get(ue), n4 = e2.get(se), a2 = e2.get(N2), h5 = e2.get(re), m3 = ct(h5, r3, t2), f3 = [ + ...a2, + new Plugin({ + key: mt, + state: { + init: () => { + }, + apply: (Be2, F4, ft2, Le2) => { + e2.set(V2, Le2); + } + } + }), + customInputRules({ rules: i2 }), + keymap(dt(baseKeymap)) + ]; + e2.set(N2, f3); + const B3 = n4({ + schema: t2, + doc: m3, + plugins: f3 + }), l5 = EditorState.create(B3); + return e2.set(V2, l5), e2.done(q4), () => { + e2.remove(re).remove(V2).remove(se).remove(ie4).clearTimer(q4); + }; + }); + k3(_e, { + displayName: "EditorState" + }); + var ne = K("EditorViewReady"); + var H3 = H({}, "editorView"); + var oe = H([], "editorViewTimer"); + var ae = H({}, "editorViewOptions"); + var ce = H(null, "root"); + var we = H(null, "rootDOM"); + var ge = H({}, "rootAttrs"); + function ht(e2, t2) { + const r3 = document.createElement("div"); + r3.className = "milkdown", e2.appendChild(r3), t2.set(we, r3); + const i2 = t2.get(ge); + return Object.entries(i2).forEach(([n4, a2]) => r3.setAttribute(n4, a2)), r3; + } + function lt(e2) { + e2.classList.add("editor"), e2.setAttribute("role", "textbox"); + } + var ut = new PluginKey("MILKDOWN_VIEW_CLEAR"); + var ze = (e2) => (e2.inject(ce, document.body).inject(H3, {}).inject(ae, {}).inject(we, null).inject(ge, {}).inject(oe, [q4]).record(ne), async () => { + await e2.wait(M4); + const t2 = e2.get(ce) || document.body, r3 = typeof t2 == "string" ? document.querySelector(t2) : t2; + e2.update(N2, (f3) => [ + new Plugin({ + key: ut, + view: (B3) => { + const l5 = r3 ? ht(r3, e2) : void 0; + return (() => { + if (l5 && r3) { + const F4 = B3.dom; + r3.replaceChild(l5, F4), l5.appendChild(F4); + } + })(), { + destroy: () => { + l5 != null && l5.parentNode && (l5 == null || l5.parentNode.replaceChild(B3.dom, l5)), l5 == null || l5.remove(); + } + }; + } + }), + ...f3 + ]), await e2.waitTimers(oe); + const i2 = e2.get(V2), n4 = e2.get(ae), a2 = Object.fromEntries(e2.get(fe)), h5 = Object.fromEntries(e2.get(ye)), m3 = new EditorView(r3, __spreadValues({ + state: i2, + nodeViews: a2, + markViews: h5 + }, n4)); + return lt(m3.dom), e2.set(H3, m3), e2.done(ne), () => { + m3 == null || m3.destroy(), e2.remove(ce).remove(H3).remove(ae).remove(we).remove(ge).remove(oe).clearTimer(ne); + }; + }); + k3(ze, { + displayName: "EditorView" + }); + var T3; + var g4; + var Ke = class { + constructor() { + d4(this, T3, void 0); + d4(this, g4, void 0); + c3(this, T3, new G()), c3(this, g4, null), this.setCtx = (t2) => { + c3(this, g4, t2); + }; + } + get ctx() { + return s(this, g4); + } + /// Register a command into the manager. + create(t2, r3) { + const i2 = t2.create(s(this, T3).sliceMap); + return i2.set(r3), i2; + } + get(t2) { + return s(this, T3).get(t2).get(); + } + remove(t2) { + return s(this, T3).remove(t2); + } + call(t2, r3) { + if (s(this, g4) == null) + throw y(); + const n4 = this.get(t2)(r3), a2 = s(this, g4).get(H3); + return n4(a2.state, a2.dispatch, a2); + } + }; + T3 = /* @__PURE__ */ new WeakMap(), g4 = /* @__PURE__ */ new WeakMap(); + function Et(e2 = "cmdKey") { + return H(() => () => false, e2); + } + var je = H(new Ke(), "commands"); + var me = H([R3], "commandsTimer"); + var J3 = K("CommandsReady"); + var Ae = (e2) => { + const t2 = new Ke(); + return t2.setCtx(e2), e2.inject(je, t2).inject(me, [R3]).record(J3), async () => (await e2.waitTimers(me), e2.done(J3), () => { + e2.remove(je).remove(me).clearTimer(J3); + }); + }; + k3(Ae, { + displayName: "Commands" + }); + var j3; + var p3; + var y3; + var D2; + var _2; + var z3; + var u3; + var w4; + var O2; + var K3; + var S5; + var E3; + var A3; + var C3; + var I2; + var Ce = class Ce2 { + constructor() { + d4(this, j3, void 0); + d4(this, p3, void 0); + d4(this, y3, void 0); + d4(this, D2, void 0); + d4(this, _2, void 0); + d4(this, z3, void 0); + d4(this, u3, void 0); + d4(this, w4, void 0); + d4(this, O2, void 0); + d4(this, K3, void 0); + d4(this, S5, void 0); + d4(this, E3, void 0); + d4(this, A3, void 0); + d4(this, C3, void 0); + d4(this, I2, void 0); + c3(this, j3, false), c3(this, p3, "Idle"), c3(this, y3, []), c3(this, D2, () => { + }), c3(this, _2, new G()), c3(this, z3, new J()), c3(this, u3, /* @__PURE__ */ new Map()), c3(this, w4, /* @__PURE__ */ new Map()), c3(this, O2, new U(s(this, _2), s(this, z3))), c3(this, K3, () => { + const t2 = ot(async (i2) => { + await Promise.all(s(this, y3).map((n4) => n4(i2))); + }), r3 = [ + Ee, + Ve, + Ne, + Ae, + _e, + ze, + at(this), + t2 + ]; + s(this, S5).call(this, r3, s(this, w4)); + }), c3(this, S5, (t2, r3) => { + t2.forEach((i2) => { + const n4 = s(this, O2).produce(s(this, j3) ? i2.meta : void 0), a2 = i2(n4); + r3.set(i2, { ctx: n4, handler: a2, cleanup: void 0 }); + }); + }), c3(this, E3, (t2, r3 = false) => Promise.all( + [t2].flat().map((i2) => { + const n4 = s(this, u3).get(i2), a2 = n4 == null ? void 0 : n4.cleanup; + return r3 ? s(this, u3).delete(i2) : s(this, u3).set(i2, { ctx: void 0, handler: void 0, cleanup: void 0 }), typeof a2 == "function" ? a2() : a2; + }) + )), c3(this, A3, async () => { + await Promise.all([...s(this, w4).entries()].map(([t2, { cleanup: r3 }]) => typeof r3 == "function" ? r3() : r3)), s(this, w4).clear(); + }), c3(this, C3, (t2) => { + c3(this, p3, t2), s(this, D2).call(this, t2); + }), c3(this, I2, (t2) => [...t2.entries()].map(async ([r3, i2]) => { + const { ctx: n4, handler: a2 } = i2; + if (!a2) + return; + const h5 = await a2(); + t2.set(r3, { ctx: n4, handler: a2, cleanup: h5 }); + })), this.enableInspector = (t2 = true) => (c3(this, j3, t2), this), this.onStatusChange = (t2) => (c3(this, D2, t2), this), this.config = (t2) => (s(this, y3).push(t2), this), this.removeConfig = (t2) => (c3(this, y3, s(this, y3).filter((r3) => r3 !== t2)), this), this.use = (t2) => { + const r3 = [t2].flat(); + return r3.flat().forEach((i2) => { + s(this, u3).set(i2, { + ctx: void 0, + handler: void 0, + cleanup: void 0 + }); + }), s(this, p3) === "Created" && s(this, S5).call(this, r3, s(this, u3)), this; + }, this.remove = async (t2) => s(this, p3) === "OnCreate" ? (console.warn("[Milkdown]: You are trying to remove plugins when the editor is creating, this is not recommended, please check your code."), new Promise((r3) => { + setTimeout(() => { + r3(this.remove(t2)); + }, 50); + })) : (await s(this, E3).call(this, [t2].flat(), true), this), this.create = async () => s(this, p3) === "OnCreate" ? this : (s(this, p3) === "Created" && await this.destroy(), s(this, C3).call(this, "OnCreate"), s(this, K3).call(this), s(this, S5).call(this, [...s(this, u3).keys()], s(this, u3)), await Promise.all( + [ + s(this, I2).call(this, s(this, w4)), + s(this, I2).call(this, s(this, u3)) + ].flat() + ), s(this, C3).call(this, "Created"), this), this.destroy = async (t2 = false) => s(this, p3) === "Destroyed" || s(this, p3) === "OnDestroy" ? this : s(this, p3) === "OnCreate" ? new Promise((r3) => { + setTimeout(() => { + r3(this.destroy(t2)); + }, 50); + }) : (t2 && c3(this, y3, []), s(this, C3).call(this, "OnDestroy"), await s(this, E3).call(this, [...s(this, u3).keys()], t2), await s(this, A3).call(this), s(this, C3).call(this, "Destroyed"), this), this.action = (t2) => t2(s(this, O2)), this.inspect = () => s(this, j3) ? [...s(this, w4).values(), ...s(this, u3).values()].map(({ ctx: t2 }) => { + var r3; + return (r3 = t2 == null ? void 0 : t2.inspector) == null ? void 0 : r3.read(); + }).filter((t2) => !!t2) : (console.warn("[Milkdown]: You are trying to collect inspection when inspector is disabled, please enable inspector by `editor.enableInspector()` first."), []); + } + /// Create a new editor instance. + static make() { + return new Ce2(); + } + /// Get the ctx of the editor. + get ctx() { + return s(this, O2); + } + /// Get the status of the editor. + get status() { + return s(this, p3); + } + }; + j3 = /* @__PURE__ */ new WeakMap(), p3 = /* @__PURE__ */ new WeakMap(), y3 = /* @__PURE__ */ new WeakMap(), D2 = /* @__PURE__ */ new WeakMap(), _2 = /* @__PURE__ */ new WeakMap(), z3 = /* @__PURE__ */ new WeakMap(), u3 = /* @__PURE__ */ new WeakMap(), w4 = /* @__PURE__ */ new WeakMap(), O2 = /* @__PURE__ */ new WeakMap(), K3 = /* @__PURE__ */ new WeakMap(), S5 = /* @__PURE__ */ new WeakMap(), E3 = /* @__PURE__ */ new WeakMap(), A3 = /* @__PURE__ */ new WeakMap(), C3 = /* @__PURE__ */ new WeakMap(), I2 = /* @__PURE__ */ new WeakMap(); + var Oe = Ce; + + // node_modules/atomico/src/ref.js + var _current, _listeners; + var Ref = class { + /** + * @param {T} current + */ + constructor(current) { + /** + * @type {T} + */ + __privateAdd(this, _current); + __privateAdd(this, _listeners, /* @__PURE__ */ new Set()); + __privateSet(this, _current, current); + } + /** + * @return {T} + */ + get current() { + return __privateGet(this, _current); + } + /** + * @param {T} value + */ + set current(value) { + if (__privateGet(this, _current) != value) { + __privateSet(this, _current, value); + __privateGet(this, _listeners).forEach((fn) => fn(value)); + } + } + /** + * @type {import("hooks").Ref["on"]} + */ + on(fn) { + __privateGet(this, _listeners).add(fn); + return () => __privateGet(this, _listeners).delete(fn); + } + }; + _current = new WeakMap(); + _listeners = new WeakMap(); + var createRef = (value) => new Ref(value); + + // node_modules/atomico/src/hooks/create-hooks.js + var ID = Symbol.for("atomico.hooks"); + globalThis[ID] = globalThis[ID] || {}; + var SCOPE = globalThis[ID]; + var IdSuspense = Symbol.for("Atomico.suspense"); + var IdEffect = Symbol.for("Atomico.effect"); + var IdLayoutEffect = Symbol.for("Atomico.layoutEffect"); + var IdInsertionEffect = Symbol.for("Atomico.insertionEffect"); + var useHook = (render, effect, tag) => { + const { i: i2, hooks } = SCOPE.c; + const hook = hooks[i2] = hooks[i2] || {}; + hook.value = render(hook.value); + hook.effect = effect; + hook.tag = tag; + SCOPE.c.i++; + return hooks[i2].value; + }; + var useRef = (current) => useHook((ref = createRef(current)) => ref); + var useHost = () => useHook((ref = createRef(SCOPE.c.host)) => ref); + var createHooks = (update, host, id = 0) => { + let hooks = {}; + let suspense = false; + const isSuspense = () => suspense; + const cleanEffectsByType = (tag, unmounted) => { + for (const index2 in hooks) { + const hook = hooks[index2]; + if (hook.effect && hook.tag === tag) { + hook.value = hook.effect(hook.value, unmounted); + } + } + }; + const load = (callback) => { + SCOPE.c = { host, hooks, update, i: 0, id }; + let value; + try { + suspense = false; + value = callback(); + } catch (e2) { + if (e2 !== IdSuspense) throw e2; + suspense = true; + } finally { + SCOPE.c = null; + } + return value; + }; + const cleanEffects = (unmounted) => { + cleanEffectsByType(IdInsertionEffect, unmounted); + return () => { + cleanEffectsByType(IdLayoutEffect, unmounted); + return () => { + cleanEffectsByType(IdEffect, unmounted); + }; + }; + }; + return { load, cleanEffects, isSuspense }; + }; + + // node_modules/atomico/src/utils.js + var SymbolFor = Symbol.for; + function isEqualArray(before, after) { + const length = before.length; + if (length !== after.length) return false; + for (let i2 = 0; i2 < length; i2++) { + let beforeValue = before[i2]; + let afterValue = after[i2]; + if (beforeValue !== afterValue) return false; + } + return true; + } + var isFunction = (value) => typeof value == "function"; + var isObject = (value) => typeof value == "object"; + var { isArray } = Array; + var isHydrate = (node2, styleOnly) => (styleOnly ? node2 instanceof HTMLStyleElement : true) && "hydrate" in ((node2 == null ? void 0 : node2.dataset) || {}); + function flat(list4, callback) { + let last; + const reduce = (list5) => { + let { length } = list5; + for (let i2 = 0; i2 < length; i2++) { + const value = list5[i2]; + if (value && Array.isArray(value)) { + reduce(value); + } else { + const type = typeof value; + if (value == null || type === "function" || type === "boolean") { + continue; + } else if (type === "string" || type === "number") { + if (last == null) last = ""; + last += value; + } else { + if (last != null) { + callback(last); + last = null; + } + callback(value); + } + } + } + }; + reduce(list4); + if (last != null) callback(last); + } + var addListener = (target, type, handler) => { + target.addEventListener(type, handler); + return () => target.removeEventListener(type, handler); + }; + + // node_modules/atomico/src/element/errors.js + var Error2 = class { + /** + * + * @param {HTMLElement} target + * @param {string} message + * @param {string} value + */ + constructor(target, message, value) { + this.message = message; + this.target = target; + this.value = value; + } + }; + var PropError = class extends Error2 { + }; + var ParseError = class extends Error2 { + }; + + // node_modules/atomico/src/element/set-prototype.js + var CUSTOM_TYPE_NAME = "Custom"; + var Any = null; + var TRUE_VALUES = { true: 1, "": 1, 1: 1 }; + function setPrototype(prototype, prop, schema, attrs, values) { + const { + type, + reflect, + event, + value: defaultValue, + attr = getAttr(prop) + } = (schema == null ? void 0 : schema.name) != CUSTOM_TYPE_NAME && isObject(schema) && schema != Any ? schema : { type: schema }; + const isCustomType = (type == null ? void 0 : type.name) === CUSTOM_TYPE_NAME && type.map; + const withDefaultValue = defaultValue != null ? type == Function || !isFunction(defaultValue) ? () => defaultValue : defaultValue : null; + Object.defineProperty(prototype, prop, { + configurable: true, + /** + * @this {import("dom").AtomicoThisInternal} + * @param {any} newValue + */ + set(newValue) { + const oldValue = this[prop]; + if (withDefaultValue && type != Boolean && newValue == null) { + newValue = withDefaultValue(); + } + const { error, value } = (isCustomType ? mapValue : filterValue)( + type, + newValue + ); + if (error && value != null) { + throw new PropError( + this, + `The value defined for prop '${prop}' must be of type '${type.name}'`, + value + ); + } + if (oldValue == value) return; + this._props[prop] = value == null ? void 0 : value; + this.update(); + event && dispatchEvent3(this, event); + this.updated.then(() => { + if (reflect) { + this._ignoreAttr = attr; + reflectValue(this, type, attr, this[prop]); + this._ignoreAttr = null; + } + }); + }, + /** + * @this {import("dom").AtomicoThisInternal} + */ + get() { + return this._props[prop]; + } + }); + if (withDefaultValue) values[prop] = withDefaultValue(); + attrs[attr] = { prop, type }; + } + var dispatchEvent3 = (node2, _a) => { + var _b = _a, { type, base: base2 = CustomEvent } = _b, eventInit = __objRest(_b, ["type", "base"]); + return node2.dispatchEvent(new base2(type, eventInit)); + }; + var getAttr = (prop) => prop.replace(/([A-Z])/g, "-$1").toLowerCase(); + var reflectValue = (host, type, attr, value) => value == null || type == Boolean && !value ? host.removeAttribute(attr) : host.setAttribute( + attr, + (type == null ? void 0 : type.name) === CUSTOM_TYPE_NAME && (type == null ? void 0 : type.serialize) ? type == null ? void 0 : type.serialize(value) : isObject(value) ? JSON.stringify(value) : type == Boolean ? "" : value + ); + var transformValue = (type, value) => type == Boolean ? !!TRUE_VALUES[value] : type == Number ? Number(value) : type == String ? value : type == Array || type == Object ? JSON.parse(value) : type.name == CUSTOM_TYPE_NAME ? value : ( + // TODO: If when defining reflect the prop can also be of type string? + new type(value) + ); + var mapValue = ({ map: map5 }, value) => { + try { + return { value: map5(value), error: false }; + } catch (e2) { + return { value, error: true }; + } + }; + var filterValue = (type, value) => type == null || value == null ? { value, error: false } : type != String && value === "" ? { value: void 0, error: false } : type == Object || type == Array || type == Symbol ? { + value, + error: {}.toString.call(value) !== `[object ${type.name}]` + } : value instanceof type ? { + value, + error: type == Number && Number.isNaN(value.valueOf()) + } : type == String || type == Number || type == Boolean ? { + value, + error: type == Number ? typeof value != "number" ? true : Number.isNaN(value) : type == String ? typeof value != "string" : typeof value != "boolean" + } : { value, error: true }; + + // node_modules/atomico/src/element/custom-element.js + var ID2 = 0; + var getHydrateId = (node2) => { + var _a; + const id = ((_a = (node2 == null ? void 0 : node2.dataset) || {}) == null ? void 0 : _a.hydrate) || ""; + if (id) { + return id; + } else { + return "c" + ID2++; + } + }; + var c4 = (component, options2 = HTMLElement) => { + const attrs = {}; + const values = {}; + const withBase = "prototype" in options2 && options2.prototype instanceof Element; + const base2 = withBase ? options2 : "base" in options2 ? options2.base : HTMLElement; + const { props, styles } = withBase ? component : options2; + class AtomicoElement extends base2 { + constructor() { + super(); + this._setup(); + this._render = () => component(__spreadValues({}, this._props)); + for (const prop in values) this[prop] = values[prop]; + } + /** + * @returns {import("core").Sheets[]} + */ + static get styles() { + return [super.styles, styles]; + } + async _setup() { + if (this._props) return; + this._props = {}; + let mountParentNode; + let unmountParentNode; + this.mounted = new Promise( + (resolve) => this.mount = () => { + resolve(); + if (mountParentNode != this.parentNode) { + if (unmountParentNode != mountParentNode) { + this.unmounted.then(this.update); + } else { + this.update(); + } + } + mountParentNode = this.parentNode; + } + ); + this.unmounted = new Promise( + (resolve) => this.unmount = () => { + resolve(); + if (mountParentNode != this.parentNode || !this.isConnected) { + hooks.cleanEffects(true)()(); + unmountParentNode = this.parentNode; + mountParentNode = null; + } + } + ); + this.symbolId = this.symbolId || Symbol(); + this.symbolIdParent = Symbol(); + const hooks = createHooks( + () => this.update(), + this, + getHydrateId(this) + ); + let prevent; + let firstRender = true; + const hydrate = isHydrate(this); + this.update = () => { + if (!prevent) { + prevent = true; + this.updated = (this.updated || this.mounted).then(() => { + try { + const result = hooks.load(this._render); + const cleanUseLayoutEffects = hooks.cleanEffects(); + result && //@ts-ignore + result.render(this, this.symbolId, hydrate); + prevent = false; + if (firstRender && !hooks.isSuspense()) { + firstRender = false; + !hydrate && applyStyles(this); + } + return cleanUseLayoutEffects(); + } finally { + prevent = false; + } + }).then( + /** + * @param {import("internal/hooks.js").CleanUseEffects} [cleanUseEffect] + */ + (cleanUseEffect) => { + cleanUseEffect && cleanUseEffect(); + } + ); + } + return this.updated; + }; + this.update(); + } + connectedCallback() { + this.mount(); + super.connectedCallback && super.connectedCallback(); + } + disconnectedCallback() { + super.disconnectedCallback && super.disconnectedCallback(); + this.unmount(); + } + /** + * @this {import("dom").AtomicoThisInternal} + * @param {string} attr + * @param {(string|null)} oldValue + * @param {(string|null)} value + */ + attributeChangedCallback(attr, oldValue, value) { + if (attrs[attr]) { + if (attr === this._ignoreAttr || oldValue === value) return; + const { prop, type } = attrs[attr]; + try { + this[prop] = transformValue(type, value); + } catch (e2) { + throw new ParseError( + this, + `The value defined as attr '${attr}' cannot be parsed by type '${type.name}'`, + value + ); + } + } else { + super.attributeChangedCallback(attr, oldValue, value); + } + } + static get props() { + return __spreadValues(__spreadValues({}, super.props), props); + } + static get observedAttributes() { + const superAttrs = super.observedAttributes || []; + for (const prop in props) { + setPrototype(this.prototype, prop, props[prop], attrs, values); + } + return Object.keys(attrs).concat(superAttrs); + } + } + return AtomicoElement; + }; + function applyStyles(host) { + const { styles } = host.constructor; + const { shadowRoot } = host; + if (shadowRoot && styles.length) { + const sheets = []; + flat(styles, (value) => { + if (value) { + if (value instanceof Element) { + shadowRoot.appendChild(value.cloneNode(true)); + } else { + sheets.push(value); + } + } + }); + if (sheets.length) shadowRoot.adoptedStyleSheets = sheets; + } + } + + // node_modules/atomico/src/hooks/use-effect.js + var createEffect = (type) => (currentEffect, currentArgs) => { + useHook( + /** + * Clean the effect hook + * @type {import("internal/hooks.js").CollectorEffect} + */ + ([collector, args] = []) => { + if (args || !args) { + if (args && isEqualArray(args, currentArgs)) { + collector = collector || true; + } else { + isFunction(collector) && collector(); + collector = null; + } + } + return [collector, currentArgs]; + }, + /** + * @returns {any} + */ + ([collector, args], unmounted) => { + if (unmounted) { + isFunction(collector) && collector(); + return []; + } else { + return [collector ? collector : currentEffect(), args]; + } + }, + type + ); + }; + var useLayoutEffect = createEffect(IdLayoutEffect); + var useEffect = createEffect(IdEffect); + var useInsertionEffect = createEffect(IdInsertionEffect); + + // node_modules/atomico/src/options.js + var ID3 = SymbolFor("atomico/options"); + globalThis[ID3] = globalThis[ID3] || { + sheet: !!document.adoptedStyleSheets + }; + var options = globalThis[ID3]; + + // node_modules/atomico/src/loaded.js + var DOMLoaded = new Promise((resolve) => { + if (!options.ssr) { + if (document.readyState === "loading") { + addListener(document, "DOMContentLoaded", resolve); + } else { + resolve(); + } + } + }); + + // node_modules/atomico/src/render.js + var VAL_FROM_PROPS = { + checked: 1, + value: 1, + selected: 1 + }; + var PROPS_AS_ATTRS = { + list: 1, + type: 1, + size: 1, + form: 1, + width: 1, + height: 1, + src: 1, + href: 1, + slot: 1 + }; + var INTERNAL_PROPS = { + shadowDom: 1, + staticNode: 1, + cloneNode: 1, + children: 1, + key: 1 + }; + var EMPTY_PROPS = {}; + var EMPTY_CHILDREN = []; + var Mark2 = class extends Text { + }; + var ID4 = SymbolFor("atomico/id"); + var TYPE = SymbolFor("atomico/type"); + var TYPE_NODE = SymbolFor("atomico/ref"); + var TYPE_VNODE = SymbolFor("atomico/vnode"); + var Fragment2 = () => { + }; + function RENDER(node2, id, hydrate) { + return diff(this, node2, id, hydrate); + } + var h2 = (type, p4, ...args) => { + const props = p4 || EMPTY_PROPS; + let { children } = props; + children = children != null ? children : args.length ? args : EMPTY_CHILDREN; + if (type === Fragment2) { + return children; + } + const raw = type ? type instanceof Node ? 1 : ( + //@ts-ignore + type.prototype instanceof HTMLElement && 2 + ) : 0; + if (raw === false && type instanceof Function) { + return type( + children != EMPTY_CHILDREN ? __spreadValues({ children }, props) : props + ); + } + const render = options.render || RENDER; + const vnode = { + [TYPE]: TYPE_VNODE, + type, + props, + children, + key: props.key, + // key for lists by keys + // define if the node declares its shadowDom + shadow: props.shadowDom, + // allows renderings to run only once + static: props.staticNode, + // defines whether the type is a childNode `1` or a constructor `2` + raw, + // defines whether to use the second parameter for document.createElement + is: props.is, + // clone the node if it comes from a reference + clone: props.cloneNode, + render + }; + return vnode; + }; + function diff(newVnode, node2, id = ID4, hydrate, isSvg) { + let isNewNode; + if (node2 && node2[id] && node2[id].vnode == newVnode || newVnode[TYPE] != TYPE_VNODE) + return node2; + if (newVnode || !node2) { + isSvg = isSvg || newVnode.type == "svg"; + isNewNode = newVnode.type != "host" && (newVnode.raw == 1 ? (node2 && newVnode.clone ? node2[TYPE_NODE] : node2) != newVnode.type : newVnode.raw == 2 ? !(node2 instanceof newVnode.type) : node2 ? node2[TYPE_NODE] || node2.localName != newVnode.type : !node2); + if (isNewNode && newVnode.type != null) { + if (newVnode.raw == 1 && newVnode.clone) { + hydrate = true; + node2 = newVnode.type.cloneNode(true); + node2[TYPE_NODE] = newVnode.type; + } else { + node2 = newVnode.raw == 1 ? newVnode.type : newVnode.raw == 2 ? new newVnode.type() : isSvg ? document.createElementNS( + "http://www.w3.org/2000/svg", + newVnode.type + ) : document.createElement( + newVnode.type, + newVnode.is ? { is: newVnode.is } : void 0 + ); + } + } + } + const oldVNodeStore = node2[id] ? node2[id] : EMPTY_PROPS; + const { vnode = EMPTY_PROPS, cycle = 0 } = oldVNodeStore; + let { fragment, handlers: handlers2 } = oldVNodeStore; + const { children = EMPTY_CHILDREN, props = EMPTY_PROPS } = vnode; + handlers2 = isNewNode ? {} : handlers2 || {}; + if (newVnode.static && !isNewNode) return node2; + newVnode.shadow && !node2.shadowRoot && // @ts-ignore + node2.attachShadow(__spreadValues({ mode: "open" }, newVnode.shadow)); + newVnode.props != props && diffProps(node2, props, newVnode.props, handlers2, isSvg); + if (newVnode.children !== children) { + const nextParent = newVnode.shadow ? node2.shadowRoot : node2; + fragment = renderChildren( + newVnode.children, + /** + * @todo for hydration use attribute and send childNodes + */ + fragment, + nextParent, + id, + // add support to foreignObject, children will escape from svg + !cycle && hydrate, + isSvg && newVnode.type == "foreignObject" ? false : isSvg + ); + } + node2[id] = { vnode: newVnode, handlers: handlers2, fragment, cycle: cycle + 1 }; + return node2; + } + function createFragment(parent, hydrate) { + const markStart = new Mark2(""); + const markEnd = new Mark2(""); + let node2; + parent[hydrate ? "prepend" : "append"](markStart); + if (hydrate) { + let { lastElementChild } = parent; + while (lastElementChild) { + const { previousElementSibling } = lastElementChild; + if (isHydrate(lastElementChild, true) && !isHydrate(previousElementSibling, true)) { + node2 = lastElementChild; + break; + } + lastElementChild = previousElementSibling; + } + } + if (node2) { + node2.before(markEnd); + } else { + parent.append(markEnd); + } + return { + markStart, + markEnd + }; + } + function renderChildren(children, fragment, parent, id, hydrate, isSvg) { + children = children == null ? null : isArray(children) ? children : [children]; + const nextFragment = fragment || createFragment(parent, hydrate); + const { markStart, markEnd, keyes } = nextFragment; + let nextKeyes; + const removeNodes = keyes && /* @__PURE__ */ new Set(); + let currentNode = markStart; + children && flat(children, (child) => { + if (typeof child == "object" && !child[TYPE]) { + return; + } + const key = child[TYPE] && child.key; + const childKey = keyes && key != null && keyes.get(key); + if (currentNode != markEnd && currentNode === childKey) { + removeNodes.delete(currentNode); + } else { + currentNode = currentNode == markEnd ? markEnd : currentNode.nextSibling; + } + const childNode = keyes ? childKey : currentNode; + let nextChildNode = childNode; + if (!child[TYPE]) { + const text5 = child + ""; + if (!(nextChildNode instanceof Text) || nextChildNode instanceof Mark2) { + nextChildNode = new Text(text5); + } else if (nextChildNode.data != text5) { + nextChildNode.data = text5; + } + } else { + nextChildNode = diff(child, childNode, id, hydrate, isSvg); + } + if (nextChildNode != currentNode) { + keyes && removeNodes.delete(nextChildNode); + if (!childNode || keyes) { + parent.insertBefore(nextChildNode, currentNode); + keyes && currentNode != markEnd && removeNodes.add(currentNode); + } else if (childNode == markEnd) { + parent.insertBefore(nextChildNode, markEnd); + } else { + parent.replaceChild(nextChildNode, childNode); + currentNode = nextChildNode; + } + } + if (key != null) { + nextKeyes = nextKeyes || /* @__PURE__ */ new Map(); + nextKeyes.set(key, nextChildNode); + } + }); + currentNode = currentNode == markEnd ? markEnd : currentNode.nextSibling; + if (fragment && currentNode != markEnd) { + while (currentNode != markEnd) { + const nodeToRemove = currentNode; + currentNode = currentNode.nextSibling; + nodeToRemove.remove(); + } + } + removeNodes && removeNodes.forEach((node2) => node2.remove()); + nextFragment.keyes = nextKeyes; + return nextFragment; + } + function diffProps(node2, props, nextProps, handlers2, isSvg) { + for (const key in props) { + !(key in nextProps) && setProperty(node2, key, props[key], null, isSvg, handlers2); + } + for (const key in nextProps) { + setProperty(node2, key, props[key], nextProps[key], isSvg, handlers2); + } + } + function setProperty(node2, key, prevValue, nextValue, isSvg, handlers2) { + key = key == "class" && !isSvg ? "className" : key; + prevValue = prevValue == null ? null : prevValue; + nextValue = nextValue == null ? null : nextValue; + if (key in node2 && VAL_FROM_PROPS[key]) { + prevValue = node2[key]; + } + if (nextValue === prevValue || INTERNAL_PROPS[key] || key[0] == "_") return; + if (node2.localName === "slot" && key === "assignNode" && "assign" in node2) { + node2.assign(nextValue); + } else if (key[0] == "o" && key[1] == "n" && (isFunction(nextValue) || isFunction(prevValue))) { + setEvent(node2, key.slice(2), nextValue, handlers2); + } else if (key == "ref") { + if (nextValue) { + if (isFunction(nextValue)) { + nextValue(node2); + } else { + nextValue.current = node2; + } + } + } else if (key == "style") { + const { style: style2 } = node2; + prevValue = prevValue || ""; + nextValue = nextValue || ""; + const prevIsObject = isObject(prevValue); + const nextIsObject = isObject(nextValue); + if (prevIsObject) { + for (const key2 in prevValue) { + if (nextIsObject) { + !(key2 in nextValue) && setPropertyStyle(style2, key2, null); + } else { + break; + } + } + } + if (nextIsObject) { + for (const key2 in nextValue) { + const value = nextValue[key2]; + if (prevIsObject && prevValue[key2] === value) continue; + setPropertyStyle(style2, key2, value); + } + } else { + style2.cssText = nextValue; + } + } else { + const attr = key[0] == "$" ? key.slice(1) : key; + if (attr === key && (!isSvg && !PROPS_AS_ATTRS[key] && key in node2 || isFunction(nextValue) || isFunction(prevValue))) { + node2[key] = nextValue == null ? "" : nextValue; + } else if (nextValue == null) { + node2.removeAttribute(attr); + } else { + node2.setAttribute( + attr, + isObject(nextValue) ? JSON.stringify(nextValue) : nextValue + ); + } + } + } + function setEvent(node2, type, nextHandler, handlers2) { + if (!handlers2.handleEvent) { + handlers2.handleEvent = (event) => handlers2[event.type].call(node2, event); + } + if (nextHandler) { + if (!handlers2[type]) { + const options2 = nextHandler.capture || nextHandler.once || nextHandler.passive ? Object.assign({}, nextHandler) : null; + node2.addEventListener(type, handlers2, options2); + } + handlers2[type] = nextHandler; + } else { + if (handlers2[type]) { + node2.removeEventListener(type, handlers2); + delete handlers2[type]; + } + } + } + function setPropertyStyle(style2, key, value) { + let method = "setProperty"; + if (value == null) { + method = "removeProperty"; + value = null; + } + if (~key.indexOf("-")) { + style2[method](key, value); + } else { + style2[key] = value; + } + } + + // node_modules/atomico/src/context.js + var CONTEXT_TEMPLATE = h2("host", { style: "display: contents" }); + var CONTEXT_VALUE = "value"; + var useProvider = (id, value) => { + const host = useHost(); + const ref = useRef(); + useInsertionEffect( + () => addListener( + host.current, + "ConnectContext", + /** + * @param {CustomEvent} event + */ + (event) => { + const target = event.composedPath().at(0); + if (target !== event.currentTarget && id === event.detail.id) { + event.stopPropagation(); + event.detail.connect(ref); + } + } + ), + [id] + ); + ref.current = value; + }; + var createContext = (value) => { + const Context = c4( + ({ value: value2 }) => { + useProvider(Context, value2); + return CONTEXT_TEMPLATE; + }, + { + props: { + value: { + type: Object, + value: () => value + } + } + } + ); + Context[CONTEXT_VALUE] = value; + return Context; + }; + + // node_modules/atomico/src/hooks/custom-hooks/use-suspense.js + var SuspenseContext = createContext({ + /** + * + * @param {string} type + * @param {string} id + */ + dispatch(type, id) { + } + }); + + // node_modules/atomico/src/css.js + var SHEETS = {}; + function css(template2, ...args) { + const cssText = (template2.raw || template2).reduce( + (cssText2, part, i2) => cssText2 + part + (args[i2] || ""), + "" + ); + return SHEETS[cssText] = SHEETS[cssText] || createSheet(cssText); + } + function createSheet(cssText) { + if (options.sheet) { + const sheet = new CSSStyleSheet(); + sheet.replaceSync(cssText); + return sheet; + } else { + const sheet = document.createElement("style"); + sheet.textContent = cssText; + return sheet; + } + } + + // node_modules/atomico/html.js + var MODE_SLASH = 0; + var MODE_TEXT = 1; + var MODE_WHITESPACE = 2; + var MODE_TAGNAME = 3; + var MODE_COMMENT = 4; + var MODE_PROP_SET = 5; + var MODE_PROP_APPEND = 6; + var CHILD_APPEND = 0; + var CHILD_RECURSE = 2; + var TAG_SET = 3; + var PROPS_ASSIGN = 4; + var PROP_SET = MODE_PROP_SET; + var PROP_APPEND = MODE_PROP_APPEND; + var evaluate = (h5, built, fields, args) => { + let tmp; + built[0] = 0; + for (let i2 = 1; i2 < built.length; i2++) { + const type = built[i2++]; + const value = built[i2] ? (built[0] |= type ? 1 : 2, fields[built[i2++]]) : built[++i2]; + if (type === TAG_SET) { + args[0] = value; + } else if (type === PROPS_ASSIGN) { + args[1] = Object.assign(args[1] || {}, value); + } else if (type === PROP_SET) { + (args[1] = args[1] || {})[built[++i2]] = value; + } else if (type === PROP_APPEND) { + args[1][built[++i2]] += value + ""; + } else if (type) { + tmp = h5.apply(value, evaluate(h5, value, fields, ["", null])); + args.push(tmp); + if (value[0]) { + built[0] |= 2; + } else { + built[i2 - 2] = CHILD_APPEND; + built[i2] = tmp; + } + } else { + args.push(value); + } + } + return args; + }; + var build = function(statics) { + let mode = MODE_TEXT; + let buffer = ""; + let quote = ""; + let current = [0]; + let char, propName; + const commit = (field) => { + if (mode === MODE_TEXT && (field || (buffer = buffer.replace(/^\s*\n\s*|\s*\n\s*$/g, "")))) { + { + current.push(CHILD_APPEND, field, buffer); + } + } else if (mode === MODE_TAGNAME && (field || buffer)) { + { + current.push(TAG_SET, field, buffer); + } + mode = MODE_WHITESPACE; + } else if (mode === MODE_WHITESPACE && buffer === "..." && field) { + { + current.push(PROPS_ASSIGN, field, 0); + } + } else if (mode === MODE_WHITESPACE && buffer && !field) { + { + current.push(PROP_SET, 0, true, buffer); + } + } else if (mode >= MODE_PROP_SET) { + { + if (buffer || !field && mode === MODE_PROP_SET) { + current.push(mode, 0, buffer, propName); + mode = MODE_PROP_APPEND; + } + if (field) { + current.push(mode, field, 0, propName); + mode = MODE_PROP_APPEND; + } + } + } + buffer = ""; + }; + for (let i2 = 0; i2 < statics.length; i2++) { + if (i2) { + if (mode === MODE_TEXT) { + commit(); + } + commit(i2); + } + for (let j6 = 0; j6 < statics[i2].length; j6++) { + char = statics[i2][j6]; + if (mode === MODE_TEXT) { + if (char === "<") { + commit(); + { + current = [current]; + } + mode = MODE_TAGNAME; + } else { + buffer += char; + } + } else if (mode === MODE_COMMENT) { + if (buffer === "--" && char === ">") { + mode = MODE_TEXT; + buffer = ""; + } else { + buffer = char + buffer[0]; + } + } else if (quote) { + if (char === quote) { + quote = ""; + } else { + buffer += char; + } + } else if (char === '"' || char === "'") { + quote = char; + } else if (char === ">") { + commit(); + mode = MODE_TEXT; + } else if (!mode) ; + else if (char === "=") { + mode = MODE_PROP_SET; + propName = buffer; + buffer = ""; + } else if (char === "/" && (mode < MODE_PROP_SET || statics[i2][j6 + 1] === ">")) { + commit(); + if (mode === MODE_TAGNAME) { + current = current[0]; + } + mode = current; + { + (current = current[0]).push(CHILD_RECURSE, 0, mode); + } + mode = MODE_SLASH; + } else if (char === " " || char === " " || char === "\n" || char === "\r") { + commit(); + mode = MODE_WHITESPACE; + } else { + buffer += char; + } + if (mode === MODE_TAGNAME && buffer === "!--") { + mode = MODE_COMMENT; + current = current[0]; + } + } + } + commit(); + return current; + }; + var CACHE = /* @__PURE__ */ new Map(); + function html2(statics) { + let tmp = CACHE; + tmp = evaluate( + h2, + tmp.get(statics) || (tmp.set(statics, tmp = build(statics)), tmp), + arguments, + [] + ); + return tmp.length > 1 ? tmp : tmp[0]; + } + + // node_modules/@milkdown/utils/node_modules/nanoid/index.browser.js + var random = (bytes) => crypto.getRandomValues(new Uint8Array(bytes)); + var customRandom = (alphabet, defaultSize, getRandom) => { + let mask = (2 << Math.log(alphabet.length - 1) / Math.LN2) - 1; + let step = -~(1.6 * mask * defaultSize / alphabet.length); + return (size = defaultSize) => { + let id = ""; + while (true) { + let bytes = getRandom(step); + let j6 = step; + while (j6--) { + id += alphabet[bytes[j6] & mask] || ""; + if (id.length === size) return id; + } + } + }; + }; + var customAlphabet = (alphabet, size = 21) => customRandom(alphabet, size, random); + + // node_modules/@milkdown/utils/lib/index.es.js + var J4 = customAlphabet("abcedfghicklmn", 10); + function re2(n4, o2) { + const r3 = Et(n4), t2 = (e2) => async () => { + t2.key = r3, await e2.wait(J3); + const a2 = o2(e2); + return e2.get(je).create(r3, a2), t2.run = (s2) => e2.get(je).call(n4, s2), () => { + e2.get(je).remove(r3); + }; + }; + return t2; + } + function oe2(n4) { + const o2 = (r3) => async () => { + await r3.wait(R3); + const t2 = n4(r3); + return r3.update(ue, (e2) => [...e2, t2]), o2.inputRule = t2, () => { + r3.update(ue, (e2) => e2.filter((a2) => a2 !== t2)); + }; + }; + return o2; + } + function Q3(n4, o2) { + const r3 = (t2) => async () => { + const e2 = o2(t2); + return t2.update(Z2, (a2) => [...a2.filter((s2) => s2[0] !== n4), [n4, e2]]), r3.id = n4, r3.schema = e2, () => { + t2.update(Z2, (a2) => a2.filter(([s2]) => s2 !== n4)); + }; + }; + return r3.type = (t2) => { + const e2 = t2.get(b2).marks[n4]; + if (!e2) + throw x(n4); + return e2; + }, r3; + } + function W3(n4, o2) { + const r3 = (t2) => async () => { + const e2 = o2(t2); + return t2.update(X, (a2) => [...a2.filter((s2) => s2[0] !== n4), [n4, e2]]), r3.id = n4, r3.schema = e2, () => { + t2.update(X, (a2) => a2.filter(([s2]) => s2 !== n4)); + }; + }; + return r3.type = (t2) => { + const e2 = t2.get(b2).nodes[n4]; + if (!e2) + throw M(n4); + return e2; + }, r3; + } + function ue2(n4) { + let o2; + const r3 = (t2) => async () => (await t2.wait(R3), o2 = n4(t2), t2.update(N2, (e2) => [...e2, o2]), () => { + t2.update(N2, (e2) => e2.filter((a2) => a2 !== o2)); + }); + return r3.plugin = () => o2, r3.key = () => o2.spec.key, r3; + } + function X2(n4) { + const o2 = (r3) => async () => { + await r3.wait(R3); + const t2 = n4(r3), e2 = keymap(t2); + return r3.update(N2, (a2) => [...a2, e2]), o2.keymap = t2, () => { + r3.update(N2, (a2) => a2.filter((s2) => s2 !== e2)); + }; + }; + return o2; + } + function le(n4, o2) { + const r3 = (t2) => async () => { + await t2.wait(R3); + const e2 = o2(t2); + return n4.type(t2) instanceof NodeType ? t2.update(fe, (a2) => [...a2, [n4.id, e2]]) : t2.update(ye, (a2) => [...a2, [n4.id, e2]]), r3.view = e2, r3.type = n4, () => { + n4.type(t2) instanceof NodeType ? t2.update(fe, (a2) => a2.filter((s2) => s2[0] !== n4.id)) : t2.update(ye, (a2) => a2.filter((s2) => s2[0] !== n4.id)); + }; + }; + return r3; + } + function h3(n4, o2) { + const r3 = H(n4, o2), t2 = (e2) => (e2.inject(r3), () => () => { + e2.remove(r3); + }); + return t2.key = r3, t2; + } + function fe2(n4, o2) { + const r3 = h3(o2, n4), t2 = W3(n4, (a2) => a2.get(r3.key)(a2)), e2 = [r3, t2]; + return e2.id = t2.id, e2.node = t2, e2.type = (a2) => t2.type(a2), e2.schema = t2.schema, e2.ctx = r3, e2.key = r3.key, e2.extendSchema = (a2) => (s2) => () => { + const i2 = s2.get(r3.key), c6 = a2(i2)(s2); + s2.update(X, (m3) => [...m3.filter((S8) => S8[0] !== n4), [n4, c6]]), e2.schema = c6; + }, e2; + } + function ye2(n4, o2) { + const r3 = h3(o2, n4), t2 = Q3(n4, (a2) => a2.get(r3.key)(a2)), e2 = [r3, t2]; + return e2.id = t2.id, e2.mark = t2, e2.type = t2.type, e2.schema = t2.schema, e2.ctx = r3, e2.key = r3.key, e2.extendSchema = (a2) => (s2) => () => { + const i2 = s2.get(r3.key), c6 = a2(i2)(s2); + s2.update(Z2, (m3) => [...m3.filter((S8) => S8[0] !== n4), [n4, c6]]), e2.schema = c6; + }, e2; + } + function ge2(n4, o2) { + const r3 = Object.fromEntries(Object.entries(o2).map(([s2, { shortcuts: i2 }]) => [s2, i2])), t2 = h3(r3, `${n4}Keymap`), e2 = X2((s2) => { + const i2 = s2.get(t2.key), u4 = Object.entries(o2).flatMap(([c6, { command: m3 }]) => [i2[c6]].flat().map((V4) => [V4, m3(s2)])); + return Object.fromEntries(u4); + }), a2 = [t2, e2]; + return a2.ctx = t2, a2.shortcuts = e2, a2.key = t2.key, a2.keymap = e2.keymap, a2; + } + var he = (n4, o2 = () => ({})) => h3(o2, `${n4}Attr`); + var we2 = (n4, o2 = () => ({})) => h3(o2, `${n4}Attr`); + function ke2(n4, o2, r3) { + const t2 = h3(r3 != null ? r3 : {}, n4), e2 = (s2) => async () => { + await s2.wait(M4); + const u4 = { + plugin: o2(s2), + options: s2.get(t2.key) + }; + return s2.update(pe, (c6) => [...c6, u4]), () => { + s2.update(pe, (c6) => c6.filter((m3) => m3 !== u4)); + }; + }, a2 = [t2, e2]; + return a2.id = n4, a2.plugin = e2, a2.options = t2, a2; + } + + // node_modules/escape-string-regexp/index.js + function escapeStringRegexp(string3) { + if (typeof string3 !== "string") { + throw new TypeError("Expected a string"); + } + return string3.replace(/[|\\{}()[\]^$+*?.]/g, "\\$&").replace(/-/g, "\\x2d"); + } + + // node_modules/@sindresorhus/transliterate/replacements.js + var replacements = [ + // German umlauts + ["\xDF", "ss"], + ["\u1E9E", "Ss"], + ["\xE4", "ae"], + ["\xC4", "Ae"], + ["\xF6", "oe"], + ["\xD6", "Oe"], + ["\xFC", "ue"], + ["\xDC", "Ue"], + // Latin + ["\xC0", "A"], + ["\xC1", "A"], + ["\xC2", "A"], + ["\xC3", "A"], + ["\xC4", "Ae"], + ["\xC5", "A"], + ["\xC6", "AE"], + ["\xC7", "C"], + ["\xC8", "E"], + ["\xC9", "E"], + ["\xCA", "E"], + ["\xCB", "E"], + ["\xCC", "I"], + ["\xCD", "I"], + ["\xCE", "I"], + ["\xCF", "I"], + ["\xD0", "D"], + ["\xD1", "N"], + ["\xD2", "O"], + ["\xD3", "O"], + ["\xD4", "O"], + ["\xD5", "O"], + ["\xD6", "Oe"], + ["\u0150", "O"], + ["\xD8", "O"], + ["\xD9", "U"], + ["\xDA", "U"], + ["\xDB", "U"], + ["\xDC", "Ue"], + ["\u0170", "U"], + ["\xDD", "Y"], + ["\xDE", "TH"], + ["\xDF", "ss"], + ["\xE0", "a"], + ["\xE1", "a"], + ["\xE2", "a"], + ["\xE3", "a"], + ["\xE4", "ae"], + ["\xE5", "a"], + ["\xE6", "ae"], + ["\xE7", "c"], + ["\xE8", "e"], + ["\xE9", "e"], + ["\xEA", "e"], + ["\xEB", "e"], + ["\xEC", "i"], + ["\xED", "i"], + ["\xEE", "i"], + ["\xEF", "i"], + ["\xF0", "d"], + ["\xF1", "n"], + ["\xF2", "o"], + ["\xF3", "o"], + ["\xF4", "o"], + ["\xF5", "o"], + ["\xF6", "oe"], + ["\u0151", "o"], + ["\xF8", "o"], + ["\xF9", "u"], + ["\xFA", "u"], + ["\xFB", "u"], + ["\xFC", "ue"], + ["\u0171", "u"], + ["\xFD", "y"], + ["\xFE", "th"], + ["\xFF", "y"], + ["\u1E9E", "SS"], + // Vietnamese + ["\xE0", "a"], + ["\xC0", "A"], + ["\xE1", "a"], + ["\xC1", "A"], + ["\xE2", "a"], + ["\xC2", "A"], + ["\xE3", "a"], + ["\xC3", "A"], + ["\xE8", "e"], + ["\xC8", "E"], + ["\xE9", "e"], + ["\xC9", "E"], + ["\xEA", "e"], + ["\xCA", "E"], + ["\xEC", "i"], + ["\xCC", "I"], + ["\xED", "i"], + ["\xCD", "I"], + ["\xF2", "o"], + ["\xD2", "O"], + ["\xF3", "o"], + ["\xD3", "O"], + ["\xF4", "o"], + ["\xD4", "O"], + ["\xF5", "o"], + ["\xD5", "O"], + ["\xF9", "u"], + ["\xD9", "U"], + ["\xFA", "u"], + ["\xDA", "U"], + ["\xFD", "y"], + ["\xDD", "Y"], + ["\u0103", "a"], + ["\u0102", "A"], + ["\u0110", "D"], + ["\u0111", "d"], + ["\u0129", "i"], + ["\u0128", "I"], + ["\u0169", "u"], + ["\u0168", "U"], + ["\u01A1", "o"], + ["\u01A0", "O"], + ["\u01B0", "u"], + ["\u01AF", "U"], + ["\u1EA1", "a"], + ["\u1EA0", "A"], + ["\u1EA3", "a"], + ["\u1EA2", "A"], + ["\u1EA5", "a"], + ["\u1EA4", "A"], + ["\u1EA7", "a"], + ["\u1EA6", "A"], + ["\u1EA9", "a"], + ["\u1EA8", "A"], + ["\u1EAB", "a"], + ["\u1EAA", "A"], + ["\u1EAD", "a"], + ["\u1EAC", "A"], + ["\u1EAF", "a"], + ["\u1EAE", "A"], + ["\u1EB1", "a"], + ["\u1EB0", "A"], + ["\u1EB3", "a"], + ["\u1EB2", "A"], + ["\u1EB5", "a"], + ["\u1EB4", "A"], + ["\u1EB7", "a"], + ["\u1EB6", "A"], + ["\u1EB9", "e"], + ["\u1EB8", "E"], + ["\u1EBB", "e"], + ["\u1EBA", "E"], + ["\u1EBD", "e"], + ["\u1EBC", "E"], + ["\u1EBF", "e"], + ["\u1EBE", "E"], + ["\u1EC1", "e"], + ["\u1EC0", "E"], + ["\u1EC3", "e"], + ["\u1EC2", "E"], + ["\u1EC5", "e"], + ["\u1EC4", "E"], + ["\u1EC7", "e"], + ["\u1EC6", "E"], + ["\u1EC9", "i"], + ["\u1EC8", "I"], + ["\u1ECB", "i"], + ["\u1ECA", "I"], + ["\u1ECD", "o"], + ["\u1ECC", "O"], + ["\u1ECF", "o"], + ["\u1ECE", "O"], + ["\u1ED1", "o"], + ["\u1ED0", "O"], + ["\u1ED3", "o"], + ["\u1ED2", "O"], + ["\u1ED5", "o"], + ["\u1ED4", "O"], + ["\u1ED7", "o"], + ["\u1ED6", "O"], + ["\u1ED9", "o"], + ["\u1ED8", "O"], + ["\u1EDB", "o"], + ["\u1EDA", "O"], + ["\u1EDD", "o"], + ["\u1EDC", "O"], + ["\u1EDF", "o"], + ["\u1EDE", "O"], + ["\u1EE1", "o"], + ["\u1EE0", "O"], + ["\u1EE3", "o"], + ["\u1EE2", "O"], + ["\u1EE5", "u"], + ["\u1EE4", "U"], + ["\u1EE7", "u"], + ["\u1EE6", "U"], + ["\u1EE9", "u"], + ["\u1EE8", "U"], + ["\u1EEB", "u"], + ["\u1EEA", "U"], + ["\u1EED", "u"], + ["\u1EEC", "U"], + ["\u1EEF", "u"], + ["\u1EEE", "U"], + ["\u1EF1", "u"], + ["\u1EF0", "U"], + ["\u1EF3", "y"], + ["\u1EF2", "Y"], + ["\u1EF5", "y"], + ["\u1EF4", "Y"], + ["\u1EF7", "y"], + ["\u1EF6", "Y"], + ["\u1EF9", "y"], + ["\u1EF8", "Y"], + // Arabic + ["\u0621", "e"], + ["\u0622", "a"], + ["\u0623", "a"], + ["\u0624", "w"], + ["\u0625", "i"], + ["\u0626", "y"], + ["\u0627", "a"], + ["\u0628", "b"], + ["\u0629", "t"], + ["\u062A", "t"], + ["\u062B", "th"], + ["\u062C", "j"], + ["\u062D", "h"], + ["\u062E", "kh"], + ["\u062F", "d"], + ["\u0630", "dh"], + ["\u0631", "r"], + ["\u0632", "z"], + ["\u0633", "s"], + ["\u0634", "sh"], + ["\u0635", "s"], + ["\u0636", "d"], + ["\u0637", "t"], + ["\u0638", "z"], + ["\u0639", "e"], + ["\u063A", "gh"], + ["\u0640", "_"], + ["\u0641", "f"], + ["\u0642", "q"], + ["\u0643", "k"], + ["\u0644", "l"], + ["\u0645", "m"], + ["\u0646", "n"], + ["\u0647", "h"], + ["\u0648", "w"], + ["\u0649", "a"], + ["\u064A", "y"], + ["\u064E\u200E", "a"], + ["\u064F", "u"], + ["\u0650\u200E", "i"], + ["\u0660", "0"], + ["\u0661", "1"], + ["\u0662", "2"], + ["\u0663", "3"], + ["\u0664", "4"], + ["\u0665", "5"], + ["\u0666", "6"], + ["\u0667", "7"], + ["\u0668", "8"], + ["\u0669", "9"], + // Persian / Farsi + ["\u0686", "ch"], + ["\u06A9", "k"], + ["\u06AF", "g"], + ["\u067E", "p"], + ["\u0698", "zh"], + ["\u06CC", "y"], + ["\u06F0", "0"], + ["\u06F1", "1"], + ["\u06F2", "2"], + ["\u06F3", "3"], + ["\u06F4", "4"], + ["\u06F5", "5"], + ["\u06F6", "6"], + ["\u06F7", "7"], + ["\u06F8", "8"], + ["\u06F9", "9"], + // Pashto + ["\u067C", "p"], + ["\u0681", "z"], + ["\u0685", "c"], + ["\u0689", "d"], + ["\uFEAB", "d"], + ["\uFEAD", "r"], + ["\u0693", "r"], + ["\uFEAF", "z"], + ["\u0696", "g"], + ["\u069A", "x"], + ["\u06AB", "g"], + ["\u06BC", "n"], + ["\u06C0", "e"], + ["\u06D0", "e"], + ["\u06CD", "ai"], + // Urdu + ["\u0679", "t"], + ["\u0688", "d"], + ["\u0691", "r"], + ["\u06BA", "n"], + ["\u06C1", "h"], + ["\u06BE", "h"], + ["\u06D2", "e"], + // Russian + ["\u0410", "A"], + ["\u0430", "a"], + ["\u0411", "B"], + ["\u0431", "b"], + ["\u0412", "V"], + ["\u0432", "v"], + ["\u0413", "G"], + ["\u0433", "g"], + ["\u0414", "D"], + ["\u0434", "d"], + ["\u044A\u0435", "ye"], + ["\u042A\u0435", "Ye"], + ["\u044A\u0415", "yE"], + ["\u042A\u0415", "YE"], + ["\u0415", "E"], + ["\u0435", "e"], + ["\u0401", "Yo"], + ["\u0451", "yo"], + ["\u0416", "Zh"], + ["\u0436", "zh"], + ["\u0417", "Z"], + ["\u0437", "z"], + ["\u0418", "I"], + ["\u0438", "i"], + ["\u044B\u0439", "iy"], + ["\u042B\u0439", "Iy"], + ["\u042B\u0419", "IY"], + ["\u044B\u0419", "iY"], + ["\u0419", "Y"], + ["\u0439", "y"], + ["\u041A", "K"], + ["\u043A", "k"], + ["\u041B", "L"], + ["\u043B", "l"], + ["\u041C", "M"], + ["\u043C", "m"], + ["\u041D", "N"], + ["\u043D", "n"], + ["\u041E", "O"], + ["\u043E", "o"], + ["\u041F", "P"], + ["\u043F", "p"], + ["\u0420", "R"], + ["\u0440", "r"], + ["\u0421", "S"], + ["\u0441", "s"], + ["\u0422", "T"], + ["\u0442", "t"], + ["\u0423", "U"], + ["\u0443", "u"], + ["\u0424", "F"], + ["\u0444", "f"], + ["\u0425", "Kh"], + ["\u0445", "kh"], + ["\u0426", "Ts"], + ["\u0446", "ts"], + ["\u0427", "Ch"], + ["\u0447", "ch"], + ["\u0428", "Sh"], + ["\u0448", "sh"], + ["\u0429", "Sch"], + ["\u0449", "sch"], + ["\u042A", ""], + ["\u044A", ""], + ["\u042B", "Y"], + ["\u044B", "y"], + ["\u042C", ""], + ["\u044C", ""], + ["\u042D", "E"], + ["\u044D", "e"], + ["\u042E", "Yu"], + ["\u044E", "yu"], + ["\u042F", "Ya"], + ["\u044F", "ya"], + // Romanian + ["\u0103", "a"], + ["\u0102", "A"], + ["\u0219", "s"], + ["\u0218", "S"], + ["\u021B", "t"], + ["\u021A", "T"], + ["\u0163", "t"], + ["\u0162", "T"], + // Turkish + ["\u015F", "s"], + ["\u015E", "S"], + ["\xE7", "c"], + ["\xC7", "C"], + ["\u011F", "g"], + ["\u011E", "G"], + ["\u0131", "i"], + ["\u0130", "I"], + // Armenian + ["\u0561", "a"], + ["\u0531", "A"], + ["\u0562", "b"], + ["\u0532", "B"], + ["\u0563", "g"], + ["\u0533", "G"], + ["\u0564", "d"], + ["\u0534", "D"], + ["\u0565", "ye"], + ["\u0535", "Ye"], + ["\u0566", "z"], + ["\u0536", "Z"], + ["\u0567", "e"], + ["\u0537", "E"], + ["\u0568", "y"], + ["\u0538", "Y"], + ["\u0569", "t"], + ["\u0539", "T"], + ["\u056A", "zh"], + ["\u053A", "Zh"], + ["\u056B", "i"], + ["\u053B", "I"], + ["\u056C", "l"], + ["\u053C", "L"], + ["\u056D", "kh"], + ["\u053D", "Kh"], + ["\u056E", "ts"], + ["\u053E", "Ts"], + ["\u056F", "k"], + ["\u053F", "K"], + ["\u0570", "h"], + ["\u0540", "H"], + ["\u0571", "dz"], + ["\u0541", "Dz"], + ["\u0572", "gh"], + ["\u0542", "Gh"], + ["\u0573", "tch"], + ["\u0543", "Tch"], + ["\u0574", "m"], + ["\u0544", "M"], + ["\u0575", "y"], + ["\u0545", "Y"], + ["\u0576", "n"], + ["\u0546", "N"], + ["\u0577", "sh"], + ["\u0547", "Sh"], + ["\u0578", "vo"], + ["\u0548", "Vo"], + ["\u0579", "ch"], + ["\u0549", "Ch"], + ["\u057A", "p"], + ["\u054A", "P"], + ["\u057B", "j"], + ["\u054B", "J"], + ["\u057C", "r"], + ["\u054C", "R"], + ["\u057D", "s"], + ["\u054D", "S"], + ["\u057E", "v"], + ["\u054E", "V"], + ["\u057F", "t"], + ["\u054F", "T"], + ["\u0580", "r"], + ["\u0550", "R"], + ["\u0581", "c"], + ["\u0551", "C"], + ["\u0578\u0582", "u"], + ["\u0548\u0552", "U"], + ["\u0548\u0582", "U"], + ["\u0583", "p"], + ["\u0553", "P"], + ["\u0584", "q"], + ["\u0554", "Q"], + ["\u0585", "o"], + ["\u0555", "O"], + ["\u0586", "f"], + ["\u0556", "F"], + ["\u0587", "yev"], + // Georgian + ["\u10D0", "a"], + ["\u10D1", "b"], + ["\u10D2", "g"], + ["\u10D3", "d"], + ["\u10D4", "e"], + ["\u10D5", "v"], + ["\u10D6", "z"], + ["\u10D7", "t"], + ["\u10D8", "i"], + ["\u10D9", "k"], + ["\u10DA", "l"], + ["\u10DB", "m"], + ["\u10DC", "n"], + ["\u10DD", "o"], + ["\u10DE", "p"], + ["\u10DF", "zh"], + ["\u10E0", "r"], + ["\u10E1", "s"], + ["\u10E2", "t"], + ["\u10E3", "u"], + ["\u10E4", "ph"], + ["\u10E5", "q"], + ["\u10E6", "gh"], + ["\u10E7", "k"], + ["\u10E8", "sh"], + ["\u10E9", "ch"], + ["\u10EA", "ts"], + ["\u10EB", "dz"], + ["\u10EC", "ts"], + ["\u10ED", "tch"], + ["\u10EE", "kh"], + ["\u10EF", "j"], + ["\u10F0", "h"], + // Czech + ["\u010D", "c"], + ["\u010F", "d"], + ["\u011B", "e"], + ["\u0148", "n"], + ["\u0159", "r"], + ["\u0161", "s"], + ["\u0165", "t"], + ["\u016F", "u"], + ["\u017E", "z"], + ["\u010C", "C"], + ["\u010E", "D"], + ["\u011A", "E"], + ["\u0147", "N"], + ["\u0158", "R"], + ["\u0160", "S"], + ["\u0164", "T"], + ["\u016E", "U"], + ["\u017D", "Z"], + // Dhivehi + ["\u0780", "h"], + ["\u0781", "sh"], + ["\u0782", "n"], + ["\u0783", "r"], + ["\u0784", "b"], + ["\u0785", "lh"], + ["\u0786", "k"], + ["\u0787", "a"], + ["\u0788", "v"], + ["\u0789", "m"], + ["\u078A", "f"], + ["\u078B", "dh"], + ["\u078C", "th"], + ["\u078D", "l"], + ["\u078E", "g"], + ["\u078F", "gn"], + ["\u0790", "s"], + ["\u0791", "d"], + ["\u0792", "z"], + ["\u0793", "t"], + ["\u0794", "y"], + ["\u0795", "p"], + ["\u0796", "j"], + ["\u0797", "ch"], + ["\u0798", "tt"], + ["\u0799", "hh"], + ["\u079A", "kh"], + ["\u079B", "th"], + ["\u079C", "z"], + ["\u079D", "sh"], + ["\u079E", "s"], + ["\u079F", "d"], + ["\u07A0", "t"], + ["\u07A1", "z"], + ["\u07A2", "a"], + ["\u07A3", "gh"], + ["\u07A4", "q"], + ["\u07A5", "w"], + ["\u07A6", "a"], + ["\u07A7", "aa"], + ["\u07A8", "i"], + ["\u07A9", "ee"], + ["\u07AA", "u"], + ["\u07AB", "oo"], + ["\u07AC", "e"], + ["\u07AD", "ey"], + ["\u07AE", "o"], + ["\u07AF", "oa"], + ["\u07B0", ""], + // Greek + ["\u03B1", "a"], + ["\u03B2", "v"], + ["\u03B3", "g"], + ["\u03B4", "d"], + ["\u03B5", "e"], + ["\u03B6", "z"], + ["\u03B7", "i"], + ["\u03B8", "th"], + ["\u03B9", "i"], + ["\u03BA", "k"], + ["\u03BB", "l"], + ["\u03BC", "m"], + ["\u03BD", "n"], + ["\u03BE", "ks"], + ["\u03BF", "o"], + ["\u03C0", "p"], + ["\u03C1", "r"], + ["\u03C3", "s"], + ["\u03C4", "t"], + ["\u03C5", "y"], + ["\u03C6", "f"], + ["\u03C7", "x"], + ["\u03C8", "ps"], + ["\u03C9", "o"], + ["\u03AC", "a"], + ["\u03AD", "e"], + ["\u03AF", "i"], + ["\u03CC", "o"], + ["\u03CD", "y"], + ["\u03AE", "i"], + ["\u03CE", "o"], + ["\u03C2", "s"], + ["\u03CA", "i"], + ["\u03B0", "y"], + ["\u03CB", "y"], + ["\u0390", "i"], + ["\u0391", "A"], + ["\u0392", "B"], + ["\u0393", "G"], + ["\u0394", "D"], + ["\u0395", "E"], + ["\u0396", "Z"], + ["\u0397", "I"], + ["\u0398", "TH"], + ["\u0399", "I"], + ["\u039A", "K"], + ["\u039B", "L"], + ["\u039C", "M"], + ["\u039D", "N"], + ["\u039E", "KS"], + ["\u039F", "O"], + ["\u03A0", "P"], + ["\u03A1", "R"], + ["\u03A3", "S"], + ["\u03A4", "T"], + ["\u03A5", "Y"], + ["\u03A6", "F"], + ["\u03A7", "X"], + ["\u03A8", "PS"], + ["\u03A9", "O"], + ["\u0386", "A"], + ["\u0388", "E"], + ["\u038A", "I"], + ["\u038C", "O"], + ["\u038E", "Y"], + ["\u0389", "I"], + ["\u038F", "O"], + ["\u03AA", "I"], + ["\u03AB", "Y"], + // Disabled as it conflicts with German and Latin. + // Hungarian + // ['ä', 'a'], + // ['Ä', 'A'], + // ['ö', 'o'], + // ['Ö', 'O'], + // ['ü', 'u'], + // ['Ü', 'U'], + // ['ű', 'u'], + // ['Ű', 'U'], + // Latvian + ["\u0101", "a"], + ["\u0113", "e"], + ["\u0123", "g"], + ["\u012B", "i"], + ["\u0137", "k"], + ["\u013C", "l"], + ["\u0146", "n"], + ["\u016B", "u"], + ["\u0100", "A"], + ["\u0112", "E"], + ["\u0122", "G"], + ["\u012A", "I"], + ["\u0136", "K"], + ["\u013B", "L"], + ["\u0145", "N"], + ["\u016A", "U"], + ["\u010D", "c"], + ["\u0161", "s"], + ["\u017E", "z"], + ["\u010C", "C"], + ["\u0160", "S"], + ["\u017D", "Z"], + // Lithuanian + ["\u0105", "a"], + ["\u010D", "c"], + ["\u0119", "e"], + ["\u0117", "e"], + ["\u012F", "i"], + ["\u0161", "s"], + ["\u0173", "u"], + ["\u016B", "u"], + ["\u017E", "z"], + ["\u0104", "A"], + ["\u010C", "C"], + ["\u0118", "E"], + ["\u0116", "E"], + ["\u012E", "I"], + ["\u0160", "S"], + ["\u0172", "U"], + ["\u016A", "U"], + // Macedonian + ["\u040C", "Kj"], + ["\u045C", "kj"], + ["\u0409", "Lj"], + ["\u0459", "lj"], + ["\u040A", "Nj"], + ["\u045A", "nj"], + ["\u0422\u0441", "Ts"], + ["\u0442\u0441", "ts"], + // Polish + ["\u0105", "a"], + ["\u0107", "c"], + ["\u0119", "e"], + ["\u0142", "l"], + ["\u0144", "n"], + ["\u015B", "s"], + ["\u017A", "z"], + ["\u017C", "z"], + ["\u0104", "A"], + ["\u0106", "C"], + ["\u0118", "E"], + ["\u0141", "L"], + ["\u0143", "N"], + ["\u015A", "S"], + ["\u0179", "Z"], + ["\u017B", "Z"], + // Disabled as it conflicts with Vietnamese. + // Serbian + // ['љ', 'lj'], + // ['њ', 'nj'], + // ['Љ', 'Lj'], + // ['Њ', 'Nj'], + // ['đ', 'dj'], + // ['Đ', 'Dj'], + // ['ђ', 'dj'], + // ['ј', 'j'], + // ['ћ', 'c'], + // ['џ', 'dz'], + // ['Ђ', 'Dj'], + // ['Ј', 'j'], + // ['Ћ', 'C'], + // ['Џ', 'Dz'], + // Disabled as it conflicts with German and Latin. + // Slovak + // ['ä', 'a'], + // ['Ä', 'A'], + // ['ľ', 'l'], + // ['ĺ', 'l'], + // ['ŕ', 'r'], + // ['Ľ', 'L'], + // ['Ĺ', 'L'], + // ['Ŕ', 'R'], + // Disabled as it conflicts with German and Latin. + // Swedish + // ['å', 'o'], + // ['Å', 'o'], + // ['ä', 'a'], + // ['Ä', 'A'], + // ['ë', 'e'], + // ['Ë', 'E'], + // ['ö', 'o'], + // ['Ö', 'O'], + // Ukrainian + ["\u0404", "Ye"], + ["\u0406", "I"], + ["\u0407", "Yi"], + ["\u0490", "G"], + ["\u0454", "ye"], + ["\u0456", "i"], + ["\u0457", "yi"], + ["\u0491", "g"], + // Dutch + ["\u0132", "IJ"], + ["\u0133", "ij"], + // Danish + // ['Æ', 'Ae'], + // ['Ø', 'Oe'], + // ['Å', 'Aa'], + // ['æ', 'ae'], + // ['ø', 'oe'], + // ['å', 'aa'] + // Currencies + ["\xA2", "c"], + ["\xA5", "Y"], + ["\u07FF", "b"], + ["\u09F3", "t"], + ["\u0AF1", "Bo"], + ["\u0E3F", "B"], + ["\u20A0", "CE"], + ["\u20A1", "C"], + ["\u20A2", "Cr"], + ["\u20A3", "F"], + ["\u20A5", "m"], + ["\u20A6", "N"], + ["\u20A7", "Pt"], + ["\u20A8", "Rs"], + ["\u20A9", "W"], + ["\u20AB", "s"], + ["\u20AC", "E"], + ["\u20AD", "K"], + ["\u20AE", "T"], + ["\u20AF", "Dp"], + ["\u20B0", "S"], + ["\u20B1", "P"], + ["\u20B2", "G"], + ["\u20B3", "A"], + ["\u20B4", "S"], + ["\u20B5", "C"], + ["\u20B6", "tt"], + ["\u20B7", "S"], + ["\u20B8", "T"], + ["\u20B9", "R"], + ["\u20BA", "L"], + ["\u20BD", "P"], + ["\u20BF", "B"], + ["\uFE69", "$"], + ["\uFFE0", "c"], + ["\uFFE5", "Y"], + ["\uFFE6", "W"], + // Latin + ["\u{1D400}", "A"], + ["\u{1D401}", "B"], + ["\u{1D402}", "C"], + ["\u{1D403}", "D"], + ["\u{1D404}", "E"], + ["\u{1D405}", "F"], + ["\u{1D406}", "G"], + ["\u{1D407}", "H"], + ["\u{1D408}", "I"], + ["\u{1D409}", "J"], + ["\u{1D40A}", "K"], + ["\u{1D40B}", "L"], + ["\u{1D40C}", "M"], + ["\u{1D40D}", "N"], + ["\u{1D40E}", "O"], + ["\u{1D40F}", "P"], + ["\u{1D410}", "Q"], + ["\u{1D411}", "R"], + ["\u{1D412}", "S"], + ["\u{1D413}", "T"], + ["\u{1D414}", "U"], + ["\u{1D415}", "V"], + ["\u{1D416}", "W"], + ["\u{1D417}", "X"], + ["\u{1D418}", "Y"], + ["\u{1D419}", "Z"], + ["\u{1D41A}", "a"], + ["\u{1D41B}", "b"], + ["\u{1D41C}", "c"], + ["\u{1D41D}", "d"], + ["\u{1D41E}", "e"], + ["\u{1D41F}", "f"], + ["\u{1D420}", "g"], + ["\u{1D421}", "h"], + ["\u{1D422}", "i"], + ["\u{1D423}", "j"], + ["\u{1D424}", "k"], + ["\u{1D425}", "l"], + ["\u{1D426}", "m"], + ["\u{1D427}", "n"], + ["\u{1D428}", "o"], + ["\u{1D429}", "p"], + ["\u{1D42A}", "q"], + ["\u{1D42B}", "r"], + ["\u{1D42C}", "s"], + ["\u{1D42D}", "t"], + ["\u{1D42E}", "u"], + ["\u{1D42F}", "v"], + ["\u{1D430}", "w"], + ["\u{1D431}", "x"], + ["\u{1D432}", "y"], + ["\u{1D433}", "z"], + ["\u{1D434}", "A"], + ["\u{1D435}", "B"], + ["\u{1D436}", "C"], + ["\u{1D437}", "D"], + ["\u{1D438}", "E"], + ["\u{1D439}", "F"], + ["\u{1D43A}", "G"], + ["\u{1D43B}", "H"], + ["\u{1D43C}", "I"], + ["\u{1D43D}", "J"], + ["\u{1D43E}", "K"], + ["\u{1D43F}", "L"], + ["\u{1D440}", "M"], + ["\u{1D441}", "N"], + ["\u{1D442}", "O"], + ["\u{1D443}", "P"], + ["\u{1D444}", "Q"], + ["\u{1D445}", "R"], + ["\u{1D446}", "S"], + ["\u{1D447}", "T"], + ["\u{1D448}", "U"], + ["\u{1D449}", "V"], + ["\u{1D44A}", "W"], + ["\u{1D44B}", "X"], + ["\u{1D44C}", "Y"], + ["\u{1D44D}", "Z"], + ["\u{1D44E}", "a"], + ["\u{1D44F}", "b"], + ["\u{1D450}", "c"], + ["\u{1D451}", "d"], + ["\u{1D452}", "e"], + ["\u{1D453}", "f"], + ["\u{1D454}", "g"], + ["\u{1D456}", "i"], + ["\u{1D457}", "j"], + ["\u{1D458}", "k"], + ["\u{1D459}", "l"], + ["\u{1D45A}", "m"], + ["\u{1D45B}", "n"], + ["\u{1D45C}", "o"], + ["\u{1D45D}", "p"], + ["\u{1D45E}", "q"], + ["\u{1D45F}", "r"], + ["\u{1D460}", "s"], + ["\u{1D461}", "t"], + ["\u{1D462}", "u"], + ["\u{1D463}", "v"], + ["\u{1D464}", "w"], + ["\u{1D465}", "x"], + ["\u{1D466}", "y"], + ["\u{1D467}", "z"], + ["\u{1D468}", "A"], + ["\u{1D469}", "B"], + ["\u{1D46A}", "C"], + ["\u{1D46B}", "D"], + ["\u{1D46C}", "E"], + ["\u{1D46D}", "F"], + ["\u{1D46E}", "G"], + ["\u{1D46F}", "H"], + ["\u{1D470}", "I"], + ["\u{1D471}", "J"], + ["\u{1D472}", "K"], + ["\u{1D473}", "L"], + ["\u{1D474}", "M"], + ["\u{1D475}", "N"], + ["\u{1D476}", "O"], + ["\u{1D477}", "P"], + ["\u{1D478}", "Q"], + ["\u{1D479}", "R"], + ["\u{1D47A}", "S"], + ["\u{1D47B}", "T"], + ["\u{1D47C}", "U"], + ["\u{1D47D}", "V"], + ["\u{1D47E}", "W"], + ["\u{1D47F}", "X"], + ["\u{1D480}", "Y"], + ["\u{1D481}", "Z"], + ["\u{1D482}", "a"], + ["\u{1D483}", "b"], + ["\u{1D484}", "c"], + ["\u{1D485}", "d"], + ["\u{1D486}", "e"], + ["\u{1D487}", "f"], + ["\u{1D488}", "g"], + ["\u{1D489}", "h"], + ["\u{1D48A}", "i"], + ["\u{1D48B}", "j"], + ["\u{1D48C}", "k"], + ["\u{1D48D}", "l"], + ["\u{1D48E}", "m"], + ["\u{1D48F}", "n"], + ["\u{1D490}", "o"], + ["\u{1D491}", "p"], + ["\u{1D492}", "q"], + ["\u{1D493}", "r"], + ["\u{1D494}", "s"], + ["\u{1D495}", "t"], + ["\u{1D496}", "u"], + ["\u{1D497}", "v"], + ["\u{1D498}", "w"], + ["\u{1D499}", "x"], + ["\u{1D49A}", "y"], + ["\u{1D49B}", "z"], + ["\u{1D49C}", "A"], + ["\u{1D49E}", "C"], + ["\u{1D49F}", "D"], + ["\u{1D4A2}", "g"], + ["\u{1D4A5}", "J"], + ["\u{1D4A6}", "K"], + ["\u{1D4A9}", "N"], + ["\u{1D4AA}", "O"], + ["\u{1D4AB}", "P"], + ["\u{1D4AC}", "Q"], + ["\u{1D4AE}", "S"], + ["\u{1D4AF}", "T"], + ["\u{1D4B0}", "U"], + ["\u{1D4B1}", "V"], + ["\u{1D4B2}", "W"], + ["\u{1D4B3}", "X"], + ["\u{1D4B4}", "Y"], + ["\u{1D4B5}", "Z"], + ["\u{1D4B6}", "a"], + ["\u{1D4B7}", "b"], + ["\u{1D4B8}", "c"], + ["\u{1D4B9}", "d"], + ["\u{1D4BB}", "f"], + ["\u{1D4BD}", "h"], + ["\u{1D4BE}", "i"], + ["\u{1D4BF}", "j"], + ["\u{1D4C0}", "h"], + ["\u{1D4C1}", "l"], + ["\u{1D4C2}", "m"], + ["\u{1D4C3}", "n"], + ["\u{1D4C5}", "p"], + ["\u{1D4C6}", "q"], + ["\u{1D4C7}", "r"], + ["\u{1D4C8}", "s"], + ["\u{1D4C9}", "t"], + ["\u{1D4CA}", "u"], + ["\u{1D4CB}", "v"], + ["\u{1D4CC}", "w"], + ["\u{1D4CD}", "x"], + ["\u{1D4CE}", "y"], + ["\u{1D4CF}", "z"], + ["\u{1D4D0}", "A"], + ["\u{1D4D1}", "B"], + ["\u{1D4D2}", "C"], + ["\u{1D4D3}", "D"], + ["\u{1D4D4}", "E"], + ["\u{1D4D5}", "F"], + ["\u{1D4D6}", "G"], + ["\u{1D4D7}", "H"], + ["\u{1D4D8}", "I"], + ["\u{1D4D9}", "J"], + ["\u{1D4DA}", "K"], + ["\u{1D4DB}", "L"], + ["\u{1D4DC}", "M"], + ["\u{1D4DD}", "N"], + ["\u{1D4DE}", "O"], + ["\u{1D4DF}", "P"], + ["\u{1D4E0}", "Q"], + ["\u{1D4E1}", "R"], + ["\u{1D4E2}", "S"], + ["\u{1D4E3}", "T"], + ["\u{1D4E4}", "U"], + ["\u{1D4E5}", "V"], + ["\u{1D4E6}", "W"], + ["\u{1D4E7}", "X"], + ["\u{1D4E8}", "Y"], + ["\u{1D4E9}", "Z"], + ["\u{1D4EA}", "a"], + ["\u{1D4EB}", "b"], + ["\u{1D4EC}", "c"], + ["\u{1D4ED}", "d"], + ["\u{1D4EE}", "e"], + ["\u{1D4EF}", "f"], + ["\u{1D4F0}", "g"], + ["\u{1D4F1}", "h"], + ["\u{1D4F2}", "i"], + ["\u{1D4F3}", "j"], + ["\u{1D4F4}", "k"], + ["\u{1D4F5}", "l"], + ["\u{1D4F6}", "m"], + ["\u{1D4F7}", "n"], + ["\u{1D4F8}", "o"], + ["\u{1D4F9}", "p"], + ["\u{1D4FA}", "q"], + ["\u{1D4FB}", "r"], + ["\u{1D4FC}", "s"], + ["\u{1D4FD}", "t"], + ["\u{1D4FE}", "u"], + ["\u{1D4FF}", "v"], + ["\u{1D500}", "w"], + ["\u{1D501}", "x"], + ["\u{1D502}", "y"], + ["\u{1D503}", "z"], + ["\u{1D504}", "A"], + ["\u{1D505}", "B"], + ["\u{1D507}", "D"], + ["\u{1D508}", "E"], + ["\u{1D509}", "F"], + ["\u{1D50A}", "G"], + ["\u{1D50D}", "J"], + ["\u{1D50E}", "K"], + ["\u{1D50F}", "L"], + ["\u{1D510}", "M"], + ["\u{1D511}", "N"], + ["\u{1D512}", "O"], + ["\u{1D513}", "P"], + ["\u{1D514}", "Q"], + ["\u{1D516}", "S"], + ["\u{1D517}", "T"], + ["\u{1D518}", "U"], + ["\u{1D519}", "V"], + ["\u{1D51A}", "W"], + ["\u{1D51B}", "X"], + ["\u{1D51C}", "Y"], + ["\u{1D51E}", "a"], + ["\u{1D51F}", "b"], + ["\u{1D520}", "c"], + ["\u{1D521}", "d"], + ["\u{1D522}", "e"], + ["\u{1D523}", "f"], + ["\u{1D524}", "g"], + ["\u{1D525}", "h"], + ["\u{1D526}", "i"], + ["\u{1D527}", "j"], + ["\u{1D528}", "k"], + ["\u{1D529}", "l"], + ["\u{1D52A}", "m"], + ["\u{1D52B}", "n"], + ["\u{1D52C}", "o"], + ["\u{1D52D}", "p"], + ["\u{1D52E}", "q"], + ["\u{1D52F}", "r"], + ["\u{1D530}", "s"], + ["\u{1D531}", "t"], + ["\u{1D532}", "u"], + ["\u{1D533}", "v"], + ["\u{1D534}", "w"], + ["\u{1D535}", "x"], + ["\u{1D536}", "y"], + ["\u{1D537}", "z"], + ["\u{1D538}", "A"], + ["\u{1D539}", "B"], + ["\u{1D53B}", "D"], + ["\u{1D53C}", "E"], + ["\u{1D53D}", "F"], + ["\u{1D53E}", "G"], + ["\u{1D540}", "I"], + ["\u{1D541}", "J"], + ["\u{1D542}", "K"], + ["\u{1D543}", "L"], + ["\u{1D544}", "M"], + ["\u{1D546}", "N"], + ["\u{1D54A}", "S"], + ["\u{1D54B}", "T"], + ["\u{1D54C}", "U"], + ["\u{1D54D}", "V"], + ["\u{1D54E}", "W"], + ["\u{1D54F}", "X"], + ["\u{1D550}", "Y"], + ["\u{1D552}", "a"], + ["\u{1D553}", "b"], + ["\u{1D554}", "c"], + ["\u{1D555}", "d"], + ["\u{1D556}", "e"], + ["\u{1D557}", "f"], + ["\u{1D558}", "g"], + ["\u{1D559}", "h"], + ["\u{1D55A}", "i"], + ["\u{1D55B}", "j"], + ["\u{1D55C}", "k"], + ["\u{1D55D}", "l"], + ["\u{1D55E}", "m"], + ["\u{1D55F}", "n"], + ["\u{1D560}", "o"], + ["\u{1D561}", "p"], + ["\u{1D562}", "q"], + ["\u{1D563}", "r"], + ["\u{1D564}", "s"], + ["\u{1D565}", "t"], + ["\u{1D566}", "u"], + ["\u{1D567}", "v"], + ["\u{1D568}", "w"], + ["\u{1D569}", "x"], + ["\u{1D56A}", "y"], + ["\u{1D56B}", "z"], + ["\u{1D56C}", "A"], + ["\u{1D56D}", "B"], + ["\u{1D56E}", "C"], + ["\u{1D56F}", "D"], + ["\u{1D570}", "E"], + ["\u{1D571}", "F"], + ["\u{1D572}", "G"], + ["\u{1D573}", "H"], + ["\u{1D574}", "I"], + ["\u{1D575}", "J"], + ["\u{1D576}", "K"], + ["\u{1D577}", "L"], + ["\u{1D578}", "M"], + ["\u{1D579}", "N"], + ["\u{1D57A}", "O"], + ["\u{1D57B}", "P"], + ["\u{1D57C}", "Q"], + ["\u{1D57D}", "R"], + ["\u{1D57E}", "S"], + ["\u{1D57F}", "T"], + ["\u{1D580}", "U"], + ["\u{1D581}", "V"], + ["\u{1D582}", "W"], + ["\u{1D583}", "X"], + ["\u{1D584}", "Y"], + ["\u{1D585}", "Z"], + ["\u{1D586}", "a"], + ["\u{1D587}", "b"], + ["\u{1D588}", "c"], + ["\u{1D589}", "d"], + ["\u{1D58A}", "e"], + ["\u{1D58B}", "f"], + ["\u{1D58C}", "g"], + ["\u{1D58D}", "h"], + ["\u{1D58E}", "i"], + ["\u{1D58F}", "j"], + ["\u{1D590}", "k"], + ["\u{1D591}", "l"], + ["\u{1D592}", "m"], + ["\u{1D593}", "n"], + ["\u{1D594}", "o"], + ["\u{1D595}", "p"], + ["\u{1D596}", "q"], + ["\u{1D597}", "r"], + ["\u{1D598}", "s"], + ["\u{1D599}", "t"], + ["\u{1D59A}", "u"], + ["\u{1D59B}", "v"], + ["\u{1D59C}", "w"], + ["\u{1D59D}", "x"], + ["\u{1D59E}", "y"], + ["\u{1D59F}", "z"], + ["\u{1D5A0}", "A"], + ["\u{1D5A1}", "B"], + ["\u{1D5A2}", "C"], + ["\u{1D5A3}", "D"], + ["\u{1D5A4}", "E"], + ["\u{1D5A5}", "F"], + ["\u{1D5A6}", "G"], + ["\u{1D5A7}", "H"], + ["\u{1D5A8}", "I"], + ["\u{1D5A9}", "J"], + ["\u{1D5AA}", "K"], + ["\u{1D5AB}", "L"], + ["\u{1D5AC}", "M"], + ["\u{1D5AD}", "N"], + ["\u{1D5AE}", "O"], + ["\u{1D5AF}", "P"], + ["\u{1D5B0}", "Q"], + ["\u{1D5B1}", "R"], + ["\u{1D5B2}", "S"], + ["\u{1D5B3}", "T"], + ["\u{1D5B4}", "U"], + ["\u{1D5B5}", "V"], + ["\u{1D5B6}", "W"], + ["\u{1D5B7}", "X"], + ["\u{1D5B8}", "Y"], + ["\u{1D5B9}", "Z"], + ["\u{1D5BA}", "a"], + ["\u{1D5BB}", "b"], + ["\u{1D5BC}", "c"], + ["\u{1D5BD}", "d"], + ["\u{1D5BE}", "e"], + ["\u{1D5BF}", "f"], + ["\u{1D5C0}", "g"], + ["\u{1D5C1}", "h"], + ["\u{1D5C2}", "i"], + ["\u{1D5C3}", "j"], + ["\u{1D5C4}", "k"], + ["\u{1D5C5}", "l"], + ["\u{1D5C6}", "m"], + ["\u{1D5C7}", "n"], + ["\u{1D5C8}", "o"], + ["\u{1D5C9}", "p"], + ["\u{1D5CA}", "q"], + ["\u{1D5CB}", "r"], + ["\u{1D5CC}", "s"], + ["\u{1D5CD}", "t"], + ["\u{1D5CE}", "u"], + ["\u{1D5CF}", "v"], + ["\u{1D5D0}", "w"], + ["\u{1D5D1}", "x"], + ["\u{1D5D2}", "y"], + ["\u{1D5D3}", "z"], + ["\u{1D5D4}", "A"], + ["\u{1D5D5}", "B"], + ["\u{1D5D6}", "C"], + ["\u{1D5D7}", "D"], + ["\u{1D5D8}", "E"], + ["\u{1D5D9}", "F"], + ["\u{1D5DA}", "G"], + ["\u{1D5DB}", "H"], + ["\u{1D5DC}", "I"], + ["\u{1D5DD}", "J"], + ["\u{1D5DE}", "K"], + ["\u{1D5DF}", "L"], + ["\u{1D5E0}", "M"], + ["\u{1D5E1}", "N"], + ["\u{1D5E2}", "O"], + ["\u{1D5E3}", "P"], + ["\u{1D5E4}", "Q"], + ["\u{1D5E5}", "R"], + ["\u{1D5E6}", "S"], + ["\u{1D5E7}", "T"], + ["\u{1D5E8}", "U"], + ["\u{1D5E9}", "V"], + ["\u{1D5EA}", "W"], + ["\u{1D5EB}", "X"], + ["\u{1D5EC}", "Y"], + ["\u{1D5ED}", "Z"], + ["\u{1D5EE}", "a"], + ["\u{1D5EF}", "b"], + ["\u{1D5F0}", "c"], + ["\u{1D5F1}", "d"], + ["\u{1D5F2}", "e"], + ["\u{1D5F3}", "f"], + ["\u{1D5F4}", "g"], + ["\u{1D5F5}", "h"], + ["\u{1D5F6}", "i"], + ["\u{1D5F7}", "j"], + ["\u{1D5F8}", "k"], + ["\u{1D5F9}", "l"], + ["\u{1D5FA}", "m"], + ["\u{1D5FB}", "n"], + ["\u{1D5FC}", "o"], + ["\u{1D5FD}", "p"], + ["\u{1D5FE}", "q"], + ["\u{1D5FF}", "r"], + ["\u{1D600}", "s"], + ["\u{1D601}", "t"], + ["\u{1D602}", "u"], + ["\u{1D603}", "v"], + ["\u{1D604}", "w"], + ["\u{1D605}", "x"], + ["\u{1D606}", "y"], + ["\u{1D607}", "z"], + ["\u{1D608}", "A"], + ["\u{1D609}", "B"], + ["\u{1D60A}", "C"], + ["\u{1D60B}", "D"], + ["\u{1D60C}", "E"], + ["\u{1D60D}", "F"], + ["\u{1D60E}", "G"], + ["\u{1D60F}", "H"], + ["\u{1D610}", "I"], + ["\u{1D611}", "J"], + ["\u{1D612}", "K"], + ["\u{1D613}", "L"], + ["\u{1D614}", "M"], + ["\u{1D615}", "N"], + ["\u{1D616}", "O"], + ["\u{1D617}", "P"], + ["\u{1D618}", "Q"], + ["\u{1D619}", "R"], + ["\u{1D61A}", "S"], + ["\u{1D61B}", "T"], + ["\u{1D61C}", "U"], + ["\u{1D61D}", "V"], + ["\u{1D61E}", "W"], + ["\u{1D61F}", "X"], + ["\u{1D620}", "Y"], + ["\u{1D621}", "Z"], + ["\u{1D622}", "a"], + ["\u{1D623}", "b"], + ["\u{1D624}", "c"], + ["\u{1D625}", "d"], + ["\u{1D626}", "e"], + ["\u{1D627}", "f"], + ["\u{1D628}", "g"], + ["\u{1D629}", "h"], + ["\u{1D62A}", "i"], + ["\u{1D62B}", "j"], + ["\u{1D62C}", "k"], + ["\u{1D62D}", "l"], + ["\u{1D62E}", "m"], + ["\u{1D62F}", "n"], + ["\u{1D630}", "o"], + ["\u{1D631}", "p"], + ["\u{1D632}", "q"], + ["\u{1D633}", "r"], + ["\u{1D634}", "s"], + ["\u{1D635}", "t"], + ["\u{1D636}", "u"], + ["\u{1D637}", "v"], + ["\u{1D638}", "w"], + ["\u{1D639}", "x"], + ["\u{1D63A}", "y"], + ["\u{1D63B}", "z"], + ["\u{1D63C}", "A"], + ["\u{1D63D}", "B"], + ["\u{1D63E}", "C"], + ["\u{1D63F}", "D"], + ["\u{1D640}", "E"], + ["\u{1D641}", "F"], + ["\u{1D642}", "G"], + ["\u{1D643}", "H"], + ["\u{1D644}", "I"], + ["\u{1D645}", "J"], + ["\u{1D646}", "K"], + ["\u{1D647}", "L"], + ["\u{1D648}", "M"], + ["\u{1D649}", "N"], + ["\u{1D64A}", "O"], + ["\u{1D64B}", "P"], + ["\u{1D64C}", "Q"], + ["\u{1D64D}", "R"], + ["\u{1D64E}", "S"], + ["\u{1D64F}", "T"], + ["\u{1D650}", "U"], + ["\u{1D651}", "V"], + ["\u{1D652}", "W"], + ["\u{1D653}", "X"], + ["\u{1D654}", "Y"], + ["\u{1D655}", "Z"], + ["\u{1D656}", "a"], + ["\u{1D657}", "b"], + ["\u{1D658}", "c"], + ["\u{1D659}", "d"], + ["\u{1D65A}", "e"], + ["\u{1D65B}", "f"], + ["\u{1D65C}", "g"], + ["\u{1D65D}", "h"], + ["\u{1D65E}", "i"], + ["\u{1D65F}", "j"], + ["\u{1D660}", "k"], + ["\u{1D661}", "l"], + ["\u{1D662}", "m"], + ["\u{1D663}", "n"], + ["\u{1D664}", "o"], + ["\u{1D665}", "p"], + ["\u{1D666}", "q"], + ["\u{1D667}", "r"], + ["\u{1D668}", "s"], + ["\u{1D669}", "t"], + ["\u{1D66A}", "u"], + ["\u{1D66B}", "v"], + ["\u{1D66C}", "w"], + ["\u{1D66D}", "x"], + ["\u{1D66E}", "y"], + ["\u{1D66F}", "z"], + ["\u{1D670}", "A"], + ["\u{1D671}", "B"], + ["\u{1D672}", "C"], + ["\u{1D673}", "D"], + ["\u{1D674}", "E"], + ["\u{1D675}", "F"], + ["\u{1D676}", "G"], + ["\u{1D677}", "H"], + ["\u{1D678}", "I"], + ["\u{1D679}", "J"], + ["\u{1D67A}", "K"], + ["\u{1D67B}", "L"], + ["\u{1D67C}", "M"], + ["\u{1D67D}", "N"], + ["\u{1D67E}", "O"], + ["\u{1D67F}", "P"], + ["\u{1D680}", "Q"], + ["\u{1D681}", "R"], + ["\u{1D682}", "S"], + ["\u{1D683}", "T"], + ["\u{1D684}", "U"], + ["\u{1D685}", "V"], + ["\u{1D686}", "W"], + ["\u{1D687}", "X"], + ["\u{1D688}", "Y"], + ["\u{1D689}", "Z"], + ["\u{1D68A}", "a"], + ["\u{1D68B}", "b"], + ["\u{1D68C}", "c"], + ["\u{1D68D}", "d"], + ["\u{1D68E}", "e"], + ["\u{1D68F}", "f"], + ["\u{1D690}", "g"], + ["\u{1D691}", "h"], + ["\u{1D692}", "i"], + ["\u{1D693}", "j"], + ["\u{1D694}", "k"], + ["\u{1D695}", "l"], + ["\u{1D696}", "m"], + ["\u{1D697}", "n"], + ["\u{1D698}", "o"], + ["\u{1D699}", "p"], + ["\u{1D69A}", "q"], + ["\u{1D69B}", "r"], + ["\u{1D69C}", "s"], + ["\u{1D69D}", "t"], + ["\u{1D69E}", "u"], + ["\u{1D69F}", "v"], + ["\u{1D6A0}", "w"], + ["\u{1D6A1}", "x"], + ["\u{1D6A2}", "y"], + ["\u{1D6A3}", "z"], + // Dotless letters + ["\u{1D6A4}", "l"], + ["\u{1D6A5}", "j"], + // Greek + ["\u{1D6E2}", "A"], + ["\u{1D6E3}", "B"], + ["\u{1D6E4}", "G"], + ["\u{1D6E5}", "D"], + ["\u{1D6E6}", "E"], + ["\u{1D6E7}", "Z"], + ["\u{1D6E8}", "I"], + ["\u{1D6E9}", "TH"], + ["\u{1D6EA}", "I"], + ["\u{1D6EB}", "K"], + ["\u{1D6EC}", "L"], + ["\u{1D6ED}", "M"], + ["\u{1D6EE}", "N"], + ["\u{1D6EF}", "KS"], + ["\u{1D6F0}", "O"], + ["\u{1D6F1}", "P"], + ["\u{1D6F2}", "R"], + ["\u{1D6F3}", "TH"], + ["\u{1D6F4}", "S"], + ["\u{1D6F5}", "T"], + ["\u{1D6F6}", "Y"], + ["\u{1D6F7}", "F"], + ["\u{1D6F8}", "x"], + ["\u{1D6F9}", "PS"], + ["\u{1D6FA}", "O"], + ["\u{1D6FB}", "D"], + ["\u{1D6FC}", "a"], + ["\u{1D6FD}", "b"], + ["\u{1D6FE}", "g"], + ["\u{1D6FF}", "d"], + ["\u{1D700}", "e"], + ["\u{1D701}", "z"], + ["\u{1D702}", "i"], + ["\u{1D703}", "th"], + ["\u{1D704}", "i"], + ["\u{1D705}", "k"], + ["\u{1D706}", "l"], + ["\u{1D707}", "m"], + ["\u{1D708}", "n"], + ["\u{1D709}", "ks"], + ["\u{1D70A}", "o"], + ["\u{1D70B}", "p"], + ["\u{1D70C}", "r"], + ["\u{1D70D}", "s"], + ["\u{1D70E}", "s"], + ["\u{1D70F}", "t"], + ["\u{1D710}", "y"], + ["\u{1D711}", "f"], + ["\u{1D712}", "x"], + ["\u{1D713}", "ps"], + ["\u{1D714}", "o"], + ["\u{1D715}", "d"], + ["\u{1D716}", "E"], + ["\u{1D717}", "TH"], + ["\u{1D718}", "K"], + ["\u{1D719}", "f"], + ["\u{1D71A}", "r"], + ["\u{1D71B}", "p"], + ["\u{1D71C}", "A"], + ["\u{1D71D}", "V"], + ["\u{1D71E}", "G"], + ["\u{1D71F}", "D"], + ["\u{1D720}", "E"], + ["\u{1D721}", "Z"], + ["\u{1D722}", "I"], + ["\u{1D723}", "TH"], + ["\u{1D724}", "I"], + ["\u{1D725}", "K"], + ["\u{1D726}", "L"], + ["\u{1D727}", "M"], + ["\u{1D728}", "N"], + ["\u{1D729}", "KS"], + ["\u{1D72A}", "O"], + ["\u{1D72B}", "P"], + ["\u{1D72C}", "S"], + ["\u{1D72D}", "TH"], + ["\u{1D72E}", "S"], + ["\u{1D72F}", "T"], + ["\u{1D730}", "Y"], + ["\u{1D731}", "F"], + ["\u{1D732}", "X"], + ["\u{1D733}", "PS"], + ["\u{1D734}", "O"], + ["\u{1D735}", "D"], + ["\u{1D736}", "a"], + ["\u{1D737}", "v"], + ["\u{1D738}", "g"], + ["\u{1D739}", "d"], + ["\u{1D73A}", "e"], + ["\u{1D73B}", "z"], + ["\u{1D73C}", "i"], + ["\u{1D73D}", "th"], + ["\u{1D73E}", "i"], + ["\u{1D73F}", "k"], + ["\u{1D740}", "l"], + ["\u{1D741}", "m"], + ["\u{1D742}", "n"], + ["\u{1D743}", "ks"], + ["\u{1D744}", "o"], + ["\u{1D745}", "p"], + ["\u{1D746}", "r"], + ["\u{1D747}", "s"], + ["\u{1D748}", "s"], + ["\u{1D749}", "t"], + ["\u{1D74A}", "y"], + ["\u{1D74B}", "f"], + ["\u{1D74C}", "x"], + ["\u{1D74D}", "ps"], + ["\u{1D74E}", "o"], + ["\u{1D74F}", "a"], + ["\u{1D750}", "e"], + ["\u{1D751}", "i"], + ["\u{1D752}", "k"], + ["\u{1D753}", "f"], + ["\u{1D754}", "r"], + ["\u{1D755}", "p"], + ["\u{1D756}", "A"], + ["\u{1D757}", "B"], + ["\u{1D758}", "G"], + ["\u{1D759}", "D"], + ["\u{1D75A}", "E"], + ["\u{1D75B}", "Z"], + ["\u{1D75C}", "I"], + ["\u{1D75D}", "TH"], + ["\u{1D75E}", "I"], + ["\u{1D75F}", "K"], + ["\u{1D760}", "L"], + ["\u{1D761}", "M"], + ["\u{1D762}", "N"], + ["\u{1D763}", "KS"], + ["\u{1D764}", "O"], + ["\u{1D765}", "P"], + ["\u{1D766}", "R"], + ["\u{1D767}", "TH"], + ["\u{1D768}", "S"], + ["\u{1D769}", "T"], + ["\u{1D76A}", "Y"], + ["\u{1D76B}", "F"], + ["\u{1D76C}", "X"], + ["\u{1D76D}", "PS"], + ["\u{1D76E}", "O"], + ["\u{1D76F}", "D"], + ["\u{1D770}", "a"], + ["\u{1D771}", "v"], + ["\u{1D772}", "g"], + ["\u{1D773}", "d"], + ["\u{1D774}", "e"], + ["\u{1D775}", "z"], + ["\u{1D776}", "i"], + ["\u{1D777}", "th"], + ["\u{1D778}", "i"], + ["\u{1D779}", "k"], + ["\u{1D77A}", "l"], + ["\u{1D77B}", "m"], + ["\u{1D77C}", "n"], + ["\u{1D77D}", "ks"], + ["\u{1D77E}", "o"], + ["\u{1D77F}", "p"], + ["\u{1D780}", "r"], + ["\u{1D781}", "s"], + ["\u{1D782}", "s"], + ["\u{1D783}", "t"], + ["\u{1D784}", "y"], + ["\u{1D785}", "f"], + ["\u{1D786}", "x"], + ["\u{1D787}", "ps"], + ["\u{1D788}", "o"], + ["\u{1D789}", "a"], + ["\u{1D78A}", "e"], + ["\u{1D78B}", "i"], + ["\u{1D78C}", "k"], + ["\u{1D78D}", "f"], + ["\u{1D78E}", "r"], + ["\u{1D78F}", "p"], + ["\u{1D790}", "A"], + ["\u{1D791}", "V"], + ["\u{1D792}", "G"], + ["\u{1D793}", "D"], + ["\u{1D794}", "E"], + ["\u{1D795}", "Z"], + ["\u{1D796}", "I"], + ["\u{1D797}", "TH"], + ["\u{1D798}", "I"], + ["\u{1D799}", "K"], + ["\u{1D79A}", "L"], + ["\u{1D79B}", "M"], + ["\u{1D79C}", "N"], + ["\u{1D79D}", "KS"], + ["\u{1D79E}", "O"], + ["\u{1D79F}", "P"], + ["\u{1D7A0}", "S"], + ["\u{1D7A1}", "TH"], + ["\u{1D7A2}", "S"], + ["\u{1D7A3}", "T"], + ["\u{1D7A4}", "Y"], + ["\u{1D7A5}", "F"], + ["\u{1D7A6}", "X"], + ["\u{1D7A7}", "PS"], + ["\u{1D7A8}", "O"], + ["\u{1D7A9}", "D"], + ["\u{1D7AA}", "av"], + ["\u{1D7AB}", "g"], + ["\u{1D7AC}", "d"], + ["\u{1D7AD}", "e"], + ["\u{1D7AE}", "z"], + ["\u{1D7AF}", "i"], + ["\u{1D7B0}", "i"], + ["\u{1D7B1}", "th"], + ["\u{1D7B2}", "i"], + ["\u{1D7B3}", "k"], + ["\u{1D7B4}", "l"], + ["\u{1D7B5}", "m"], + ["\u{1D7B6}", "n"], + ["\u{1D7B7}", "ks"], + ["\u{1D7B8}", "o"], + ["\u{1D7B9}", "p"], + ["\u{1D7BA}", "r"], + ["\u{1D7BB}", "s"], + ["\u{1D7BC}", "s"], + ["\u{1D7BD}", "t"], + ["\u{1D7BE}", "y"], + ["\u{1D7BF}", "f"], + ["\u{1D7C0}", "x"], + ["\u{1D7C1}", "ps"], + ["\u{1D7C2}", "o"], + ["\u{1D7C3}", "a"], + ["\u{1D7C4}", "e"], + ["\u{1D7C5}", "i"], + ["\u{1D7C6}", "k"], + ["\u{1D7C7}", "f"], + ["\u{1D7C8}", "r"], + ["\u{1D7C9}", "p"], + ["\u{1D7CA}", "F"], + ["\u{1D7CB}", "f"], + ["\u249C", "(a)"], + ["\u249D", "(b)"], + ["\u249E", "(c)"], + ["\u249F", "(d)"], + ["\u24A0", "(e)"], + ["\u24A1", "(f)"], + ["\u24A2", "(g)"], + ["\u24A3", "(h)"], + ["\u24A4", "(i)"], + ["\u24A5", "(j)"], + ["\u24A6", "(k)"], + ["\u24A7", "(l)"], + ["\u24A8", "(m)"], + ["\u24A9", "(n)"], + ["\u24AA", "(o)"], + ["\u24AB", "(p)"], + ["\u24AC", "(q)"], + ["\u24AD", "(r)"], + ["\u24AE", "(s)"], + ["\u24AF", "(t)"], + ["\u24B0", "(u)"], + ["\u24B1", "(v)"], + ["\u24B2", "(w)"], + ["\u24B3", "(x)"], + ["\u24B4", "(y)"], + ["\u24B5", "(z)"], + ["\u24B6", "(A)"], + ["\u24B7", "(B)"], + ["\u24B8", "(C)"], + ["\u24B9", "(D)"], + ["\u24BA", "(E)"], + ["\u24BB", "(F)"], + ["\u24BC", "(G)"], + ["\u24BD", "(H)"], + ["\u24BE", "(I)"], + ["\u24BF", "(J)"], + ["\u24C0", "(K)"], + ["\u24C1", "(L)"], + ["\u24C3", "(N)"], + ["\u24C4", "(O)"], + ["\u24C5", "(P)"], + ["\u24C6", "(Q)"], + ["\u24C7", "(R)"], + ["\u24C8", "(S)"], + ["\u24C9", "(T)"], + ["\u24CA", "(U)"], + ["\u24CB", "(V)"], + ["\u24CC", "(W)"], + ["\u24CD", "(X)"], + ["\u24CE", "(Y)"], + ["\u24CF", "(Z)"], + ["\u24D0", "(a)"], + ["\u24D1", "(b)"], + ["\u24D2", "(b)"], + ["\u24D3", "(c)"], + ["\u24D4", "(e)"], + ["\u24D5", "(f)"], + ["\u24D6", "(g)"], + ["\u24D7", "(h)"], + ["\u24D8", "(i)"], + ["\u24D9", "(j)"], + ["\u24DA", "(k)"], + ["\u24DB", "(l)"], + ["\u24DC", "(m)"], + ["\u24DD", "(n)"], + ["\u24DE", "(o)"], + ["\u24DF", "(p)"], + ["\u24E0", "(q)"], + ["\u24E1", "(r)"], + ["\u24E2", "(s)"], + ["\u24E3", "(t)"], + ["\u24E4", "(u)"], + ["\u24E5", "(v)"], + ["\u24E6", "(w)"], + ["\u24E7", "(x)"], + ["\u24E8", "(y)"], + ["\u24E9", "(z)"], + // Maltese + ["\u010A", "C"], + ["\u010B", "c"], + ["\u0120", "G"], + ["\u0121", "g"], + ["\u0126", "H"], + ["\u0127", "h"], + ["\u017B", "Z"], + ["\u017C", "z"], + // Numbers + ["\u{1D7CE}", "0"], + ["\u{1D7CF}", "1"], + ["\u{1D7D0}", "2"], + ["\u{1D7D1}", "3"], + ["\u{1D7D2}", "4"], + ["\u{1D7D3}", "5"], + ["\u{1D7D4}", "6"], + ["\u{1D7D5}", "7"], + ["\u{1D7D6}", "8"], + ["\u{1D7D7}", "9"], + ["\u{1D7D8}", "0"], + ["\u{1D7D9}", "1"], + ["\u{1D7DA}", "2"], + ["\u{1D7DB}", "3"], + ["\u{1D7DC}", "4"], + ["\u{1D7DD}", "5"], + ["\u{1D7DE}", "6"], + ["\u{1D7DF}", "7"], + ["\u{1D7E0}", "8"], + ["\u{1D7E1}", "9"], + ["\u{1D7E2}", "0"], + ["\u{1D7E3}", "1"], + ["\u{1D7E4}", "2"], + ["\u{1D7E5}", "3"], + ["\u{1D7E6}", "4"], + ["\u{1D7E7}", "5"], + ["\u{1D7E8}", "6"], + ["\u{1D7E9}", "7"], + ["\u{1D7EA}", "8"], + ["\u{1D7EB}", "9"], + ["\u{1D7EC}", "0"], + ["\u{1D7ED}", "1"], + ["\u{1D7EE}", "2"], + ["\u{1D7EF}", "3"], + ["\u{1D7F0}", "4"], + ["\u{1D7F1}", "5"], + ["\u{1D7F2}", "6"], + ["\u{1D7F3}", "7"], + ["\u{1D7F4}", "8"], + ["\u{1D7F5}", "9"], + ["\u{1D7F6}", "0"], + ["\u{1D7F7}", "1"], + ["\u{1D7F8}", "2"], + ["\u{1D7F9}", "3"], + ["\u{1D7FA}", "4"], + ["\u{1D7FB}", "5"], + ["\u{1D7FC}", "6"], + ["\u{1D7FD}", "7"], + ["\u{1D7FE}", "8"], + ["\u{1D7FF}", "9"], + ["\u2460", "1"], + ["\u2461", "2"], + ["\u2462", "3"], + ["\u2463", "4"], + ["\u2464", "5"], + ["\u2465", "6"], + ["\u2466", "7"], + ["\u2467", "8"], + ["\u2468", "9"], + ["\u2469", "10"], + ["\u246A", "11"], + ["\u246B", "12"], + ["\u246C", "13"], + ["\u246D", "14"], + ["\u246E", "15"], + ["\u246F", "16"], + ["\u2470", "17"], + ["\u2471", "18"], + ["\u2472", "19"], + ["\u2473", "20"], + ["\u2474", "1"], + ["\u2475", "2"], + ["\u2476", "3"], + ["\u2477", "4"], + ["\u2478", "5"], + ["\u2479", "6"], + ["\u247A", "7"], + ["\u247B", "8"], + ["\u247C", "9"], + ["\u247D", "10"], + ["\u247E", "11"], + ["\u247F", "12"], + ["\u2480", "13"], + ["\u2481", "14"], + ["\u2482", "15"], + ["\u2483", "16"], + ["\u2484", "17"], + ["\u2485", "18"], + ["\u2486", "19"], + ["\u2487", "20"], + ["\u2488", "1."], + ["\u2489", "2."], + ["\u248A", "3."], + ["\u248B", "4."], + ["\u248C", "5."], + ["\u248D", "6."], + ["\u248E", "7."], + ["\u248F", "8."], + ["\u2490", "9."], + ["\u2491", "10."], + ["\u2492", "11."], + ["\u2493", "12."], + ["\u2494", "13."], + ["\u2495", "14."], + ["\u2496", "15."], + ["\u2497", "16."], + ["\u2498", "17."], + ["\u2499", "18."], + ["\u249A", "19."], + ["\u249B", "20."], + ["\u24EA", "0"], + ["\u24EB", "11"], + ["\u24EC", "12"], + ["\u24ED", "13"], + ["\u24EE", "14"], + ["\u24EF", "15"], + ["\u24F0", "16"], + ["\u24F1", "17"], + ["\u24F2", "18"], + ["\u24F3", "19"], + ["\u24F4", "20"], + ["\u24F5", "1"], + ["\u24F6", "2"], + ["\u24F7", "3"], + ["\u24F8", "4"], + ["\u24F9", "5"], + ["\u24FA", "6"], + ["\u24FB", "7"], + ["\u24FC", "8"], + ["\u24FD", "9"], + ["\u24FE", "10"], + ["\u24FF", "0"], + // Punctuation + ["\u{1F670}", "&"], + ["\u{1F671}", "&"], + ["\u{1F672}", "&"], + ["\u{1F673}", "&"], + ["\u{1F674}", "&"], + ["\u{1F675}", "&"], + ["\u{1F676}", '"'], + ["\u{1F677}", '"'], + ["\u{1F678}", '"'], + ["\u203D", "?!"], + ["\u{1F679}", "?!"], + ["\u{1F67A}", "?!"], + ["\u{1F67B}", "?!"], + ["\u{1F67C}", "/"], + ["\u{1F67D}", "\\"], + // Alchemy + ["\u{1F707}", "AR"], + ["\u{1F708}", "V"], + ["\u{1F709}", "V"], + ["\u{1F706}", "VR"], + ["\u{1F705}", "VF"], + ["\u{1F729}", "2"], + ["\u{1F72A}", "5"], + ["\u{1F761}", "f"], + ["\u{1F762}", "W"], + ["\u{1F763}", "U"], + ["\u{1F767}", "V"], + ["\u{1F768}", "T"], + ["\u{1F76A}", "V"], + ["\u{1F76B}", "MB"], + ["\u{1F76C}", "VB"], + ["\u{1F772}", "3B"], + ["\u{1F773}", "3B"], + // Emojis + ["\u{1F4AF}", "100"], + ["\u{1F519}", "BACK"], + ["\u{1F51A}", "END"], + ["\u{1F51B}", "ON!"], + ["\u{1F51C}", "SOON"], + ["\u{1F51D}", "TOP"], + ["\u{1F51E}", "18"], + ["\u{1F524}", "abc"], + ["\u{1F520}", "ABCD"], + ["\u{1F521}", "abcd"], + ["\u{1F522}", "1234"], + ["\u{1F523}", "T&@%"], + ["#\uFE0F\u20E3", "#"], + ["*\uFE0F\u20E3", "*"], + ["0\uFE0F\u20E3", "0"], + ["1\uFE0F\u20E3", "1"], + ["2\uFE0F\u20E3", "2"], + ["3\uFE0F\u20E3", "3"], + ["4\uFE0F\u20E3", "4"], + ["5\uFE0F\u20E3", "5"], + ["6\uFE0F\u20E3", "6"], + ["7\uFE0F\u20E3", "7"], + ["8\uFE0F\u20E3", "8"], + ["9\uFE0F\u20E3", "9"], + ["\u{1F51F}", "10"], + ["\u{1F170}\uFE0F", "A"], + ["\u{1F171}\uFE0F", "B"], + ["\u{1F18E}", "AB"], + ["\u{1F191}", "CL"], + ["\u{1F17E}\uFE0F", "O"], + ["\u{1F17F}", "P"], + ["\u{1F198}", "SOS"], + ["\u{1F172}", "C"], + ["\u{1F173}", "D"], + ["\u{1F174}", "E"], + ["\u{1F175}", "F"], + ["\u{1F176}", "G"], + ["\u{1F177}", "H"], + ["\u{1F178}", "I"], + ["\u{1F179}", "J"], + ["\u{1F17A}", "K"], + ["\u{1F17B}", "L"], + ["\u{1F17C}", "M"], + ["\u{1F17D}", "N"], + ["\u{1F180}", "Q"], + ["\u{1F181}", "R"], + ["\u{1F182}", "S"], + ["\u{1F183}", "T"], + ["\u{1F184}", "U"], + ["\u{1F185}", "V"], + ["\u{1F186}", "W"], + ["\u{1F187}", "X"], + ["\u{1F188}", "Y"], + ["\u{1F189}", "Z"] + ]; + var replacements_default = replacements; + + // node_modules/@sindresorhus/transliterate/index.js + var doCustomReplacements = (string3, replacements2) => { + for (const [key, value] of replacements2) { + string3 = string3.replace(new RegExp(escapeStringRegexp(key), "g"), value); + } + return string3; + }; + function transliterate(string3, options2) { + if (typeof string3 !== "string") { + throw new TypeError(`Expected a string, got \`${typeof string3}\``); + } + options2 = __spreadValues({ + customReplacements: [] + }, options2); + const customReplacements = new Map([ + ...replacements_default, + ...options2.customReplacements + ]); + string3 = string3.normalize(); + string3 = doCustomReplacements(string3, customReplacements); + string3 = string3.normalize("NFD").replace(new RegExp("\\p{Diacritic}", "gu"), "").normalize(); + return string3; + } + + // node_modules/@sindresorhus/slugify/overridable-replacements.js + var overridableReplacements = [ + ["&", " and "], + ["\u{1F984}", " unicorn "], + ["\u2665", " love "] + ]; + var overridable_replacements_default = overridableReplacements; + + // node_modules/@sindresorhus/slugify/index.js + var decamelize = (string3) => { + return string3.replace(/([A-Z]{2,})(\d+)/g, "$1 $2").replace(/([a-z\d]+)([A-Z]{2,})/g, "$1 $2").replace(/([a-z\d])([A-Z])/g, "$1 $2").replace(/([A-Z]+)([A-Z][a-rt-z\d]+)/g, "$1 $2"); + }; + var removeMootSeparators = (string3, separator) => { + const escapedSeparator = escapeStringRegexp(separator); + return string3.replace(new RegExp(`${escapedSeparator}{2,}`, "g"), separator).replace(new RegExp(`^${escapedSeparator}|${escapedSeparator}$`, "g"), ""); + }; + var buildPatternSlug = (options2) => { + let negationSetPattern = "a-z\\d"; + negationSetPattern += options2.lowercase ? "" : "A-Z"; + if (options2.preserveCharacters.length > 0) { + for (const character of options2.preserveCharacters) { + if (character === options2.separator) { + throw new Error(`The separator character \`${options2.separator}\` cannot be included in preserved characters: ${options2.preserveCharacters}`); + } + negationSetPattern += escapeStringRegexp(character); + } + } + return new RegExp(`[^${negationSetPattern}]+`, "g"); + }; + function slugify(string3, options2) { + if (typeof string3 !== "string") { + throw new TypeError(`Expected a string, got \`${typeof string3}\``); + } + options2 = __spreadValues({ + separator: "-", + lowercase: true, + decamelize: true, + customReplacements: [], + preserveLeadingUnderscore: false, + preserveTrailingDash: false, + preserveCharacters: [] + }, options2); + const shouldPrependUnderscore = options2.preserveLeadingUnderscore && string3.startsWith("_"); + const shouldAppendDash = options2.preserveTrailingDash && string3.endsWith("-"); + const customReplacements = new Map([ + ...overridable_replacements_default, + ...options2.customReplacements + ]); + string3 = transliterate(string3, { customReplacements }); + if (options2.decamelize) { + string3 = decamelize(string3); + } + const patternSlug = buildPatternSlug(options2); + if (options2.lowercase) { + string3 = string3.toLowerCase(); + } + string3 = string3.replace(/([a-zA-Z\d]+)'([ts])(\s|$)/g, "$1$2$3"); + string3 = string3.replace(patternSlug, options2.separator); + string3 = string3.replace(/\\/g, ""); + if (options2.separator) { + string3 = removeMootSeparators(string3, options2.separator); + } + if (shouldPrependUnderscore) { + string3 = `_${string3}`; + } + if (shouldAppendDash) { + string3 = `${string3}-`; + } + return string3; + } + + // node_modules/prosemirror-schema-list/dist/index.js + function splitListItem(itemType, itemAttrs) { + return function(state, dispatch) { + let { $from, $to, node: node2 } = state.selection; + if (node2 && node2.isBlock || $from.depth < 2 || !$from.sameParent($to)) + return false; + let grandParent = $from.node(-1); + if (grandParent.type != itemType) + return false; + if ($from.parent.content.size == 0 && $from.node(-1).childCount == $from.indexAfter(-1)) { + if ($from.depth == 3 || $from.node(-3).type != itemType || $from.index(-2) != $from.node(-2).childCount - 1) + return false; + if (dispatch) { + let wrap3 = Fragment.empty; + let depthBefore = $from.index(-1) ? 1 : $from.index(-2) ? 2 : 3; + for (let d6 = $from.depth - depthBefore; d6 >= $from.depth - 3; d6--) + wrap3 = Fragment.from($from.node(d6).copy(wrap3)); + let depthAfter = $from.indexAfter(-1) < $from.node(-2).childCount ? 1 : $from.indexAfter(-2) < $from.node(-3).childCount ? 2 : 3; + wrap3 = wrap3.append(Fragment.from(itemType.createAndFill())); + let start = $from.before($from.depth - (depthBefore - 1)); + let tr2 = state.tr.replace(start, $from.after(-depthAfter), new Slice(wrap3, 4 - depthBefore, 0)); + let sel = -1; + tr2.doc.nodesBetween(start, tr2.doc.content.size, (node3, pos) => { + if (sel > -1) + return false; + if (node3.isTextblock && node3.content.size == 0) + sel = pos + 1; + }); + if (sel > -1) + tr2.setSelection(Selection.near(tr2.doc.resolve(sel))); + dispatch(tr2.scrollIntoView()); + } + return true; + } + let nextType = $to.pos == $from.end() ? grandParent.contentMatchAt(0).defaultType : null; + let tr = state.tr.delete($from.pos, $to.pos); + let types = nextType ? [itemAttrs ? { type: itemType, attrs: itemAttrs } : null, { type: nextType }] : void 0; + if (!canSplit(tr.doc, $from.pos, 2, types)) + return false; + if (dispatch) + dispatch(tr.split($from.pos, 2, types).scrollIntoView()); + return true; + }; + } + function liftListItem(itemType) { + return function(state, dispatch) { + let { $from, $to } = state.selection; + let range = $from.blockRange($to, (node2) => node2.childCount > 0 && node2.firstChild.type == itemType); + if (!range) + return false; + if (!dispatch) + return true; + if ($from.node(range.depth - 1).type == itemType) + return liftToOuterList(state, dispatch, itemType, range); + else + return liftOutOfList(state, dispatch, range); + }; + } + function liftToOuterList(state, dispatch, itemType, range) { + let tr = state.tr, end = range.end, endOfList = range.$to.end(range.depth); + if (end < endOfList) { + tr.step(new ReplaceAroundStep(end - 1, endOfList, end, endOfList, new Slice(Fragment.from(itemType.create(null, range.parent.copy())), 1, 0), 1, true)); + range = new NodeRange(tr.doc.resolve(range.$from.pos), tr.doc.resolve(endOfList), range.depth); + } + const target = liftTarget(range); + if (target == null) + return false; + tr.lift(range, target); + let after = tr.mapping.map(end, -1) - 1; + if (canJoin(tr.doc, after)) + tr.join(after); + dispatch(tr.scrollIntoView()); + return true; + } + function liftOutOfList(state, dispatch, range) { + let tr = state.tr, list4 = range.parent; + for (let pos = range.end, i2 = range.endIndex - 1, e2 = range.startIndex; i2 > e2; i2--) { + pos -= list4.child(i2).nodeSize; + tr.delete(pos - 1, pos + 1); + } + let $start = tr.doc.resolve(range.start), item = $start.nodeAfter; + if (tr.mapping.map(range.end) != range.start + $start.nodeAfter.nodeSize) + return false; + let atStart = range.startIndex == 0, atEnd = range.endIndex == list4.childCount; + let parent = $start.node(-1), indexBefore = $start.index(-1); + if (!parent.canReplace(indexBefore + (atStart ? 0 : 1), indexBefore + 1, item.content.append(atEnd ? Fragment.empty : Fragment.from(list4)))) + return false; + let start = $start.pos, end = start + item.nodeSize; + tr.step(new ReplaceAroundStep(start - (atStart ? 1 : 0), end + (atEnd ? 1 : 0), start + 1, end - 1, new Slice((atStart ? Fragment.empty : Fragment.from(list4.copy(Fragment.empty))).append(atEnd ? Fragment.empty : Fragment.from(list4.copy(Fragment.empty))), atStart ? 0 : 1, atEnd ? 0 : 1), atStart ? 0 : 1)); + dispatch(tr.scrollIntoView()); + return true; + } + function sinkListItem(itemType) { + return function(state, dispatch) { + let { $from, $to } = state.selection; + let range = $from.blockRange($to, (node2) => node2.childCount > 0 && node2.firstChild.type == itemType); + if (!range) + return false; + let startIndex = range.startIndex; + if (startIndex == 0) + return false; + let parent = range.parent, nodeBefore = parent.child(startIndex - 1); + if (nodeBefore.type != itemType) + return false; + if (dispatch) { + let nestedBefore = nodeBefore.lastChild && nodeBefore.lastChild.type == parent.type; + let inner = Fragment.from(nestedBefore ? itemType.create() : null); + let slice = new Slice(Fragment.from(itemType.create(null, Fragment.from(parent.type.create(null, inner)))), nestedBefore ? 3 : 1, 0); + let before = range.start, after = range.end; + dispatch(state.tr.step(new ReplaceAroundStep(before - (nestedBefore ? 3 : 1), after, before, after, slice, 1, true)).scrollIntoView()); + } + return true; + }; + } + + // node_modules/mdast-util-definitions/lib/index.js + function definitions(tree) { + const cache = /* @__PURE__ */ new Map(); + if (!tree || !tree.type) { + throw new Error("mdast-util-definitions expected node"); + } + visit(tree, "definition", function(definition4) { + const id = clean(definition4.identifier); + if (id && !cache.get(id)) { + cache.set(id, definition4); + } + }); + return definition3; + function definition3(identifier) { + const id = clean(identifier); + return cache.get(id); + } + } + function clean(value) { + return String(value || "").toUpperCase(); + } + + // node_modules/remark-inline-links/lib/index.js + function remarkInlineLinks() { + return function(tree) { + const definition3 = definitions(tree); + visit(tree, function(node2, index2, parent) { + if (node2.type === "definition" && parent !== void 0 && typeof index2 === "number") { + parent.children.splice(index2, 1); + return [SKIP, index2]; + } + if (node2.type === "imageReference" || node2.type === "linkReference") { + const def = definition3(node2.identifier); + if (def && parent && typeof index2 === "number") { + parent.children[index2] = node2.type === "imageReference" ? { type: "image", url: def.url, title: def.title, alt: node2.alt } : { + type: "link", + url: def.url, + title: def.title, + children: node2.children + }; + return [SKIP, index2]; + } + } + }); + }; + } + + // node_modules/@milkdown/preset-commonmark/lib/index.es.js + function at2(t2, e2) { + var o2; + if (!(e2.childCount >= 1 && ((o2 = e2.lastChild) == null ? void 0 : o2.type.name) === "hardbreak")) { + t2.next(e2.content); + return; + } + const a2 = []; + e2.content.forEach((s2, l5, i2) => { + i2 !== e2.childCount - 1 && a2.push(s2); + }), t2.next(Fragment.fromArray(a2)); + } + function n3(t2, e2) { + return Object.assign(t2, { + meta: __spreadValues({ + package: "@milkdown/preset-commonmark" + }, e2) + }), t2; + } + var Z3 = we2("emphasis"); + n3(Z3, { + displayName: "Attr", + group: "Emphasis" + }); + var R4 = ye2("emphasis", (t2) => ({ + attrs: { + marker: { + default: t2.get(Q2).emphasis || "*" + } + }, + parseDOM: [ + { tag: "i" }, + { tag: "em" }, + { style: "font-style", getAttrs: (e2) => e2 === "italic" } + ], + toDOM: (e2) => ["em", t2.get(Z3.key)(e2)], + parseMarkdown: { + match: (e2) => e2.type === "emphasis", + runner: (e2, r3, a2) => { + e2.openMark(a2, { marker: r3.marker }), e2.next(r3.children), e2.closeMark(a2); + } + }, + toMarkdown: { + match: (e2) => e2.type.name === "emphasis", + runner: (e2, r3) => { + e2.withMark(r3, "emphasis", void 0, { + marker: r3.attrs.marker + }); + } + } + })); + n3(R4.mark, { + displayName: "MarkSchema", + group: "Emphasis" + }); + n3(R4.ctx, { + displayName: "MarkSchemaCtx", + group: "Emphasis" + }); + var ee2 = re2("ToggleEmphasis", (t2) => () => toggleMark(R4.type(t2))); + n3(ee2, { + displayName: "Command", + group: "Emphasis" + }); + var nt = oe2((t2) => markRule(/(?:^|[^*])\*([^*]+)\*$/, R4.type(t2), { + getAttr: () => ({ + marker: "*" + }), + updateCaptured: ({ fullMatch: e2, start: r3 }) => e2.startsWith("*") ? {} : { fullMatch: e2.slice(1), start: r3 + 1 } + })); + n3(nt, { + displayName: "InputRule|Star", + group: "Emphasis" + }); + var ot2 = oe2((t2) => markRule(/(?:^|[^_])_([^_]+)_$/, R4.type(t2), { + getAttr: () => ({ + marker: "_" + }), + updateCaptured: ({ fullMatch: e2, start: r3 }) => e2.startsWith("_") ? {} : { fullMatch: e2.slice(1), start: r3 + 1 } + })); + n3(ot2, { + displayName: "InputRule|Underscore", + group: "Emphasis" + }); + var te2 = ge2("emphasisKeymap", { + ToggleEmphasis: { + shortcuts: "Mod-i", + command: (t2) => { + const e2 = t2.get(je); + return () => e2.call(ee2.key); + } + } + }); + n3(te2.ctx, { + displayName: "KeymapCtx", + group: "Emphasis" + }); + n3(te2.shortcuts, { + displayName: "Keymap", + group: "Emphasis" + }); + var re3 = we2("strong"); + n3(re3, { + displayName: "Attr", + group: "Strong" + }); + var $2 = ye2("strong", (t2) => ({ + attrs: { + marker: { + default: t2.get(Q2).strong || "*" + } + }, + parseDOM: [ + { tag: "b" }, + { tag: "strong" }, + { style: "font-style", getAttrs: (e2) => e2 === "bold" } + ], + toDOM: (e2) => ["strong", t2.get(re3.key)(e2)], + parseMarkdown: { + match: (e2) => e2.type === "strong", + runner: (e2, r3, a2) => { + e2.openMark(a2, { marker: r3.marker }), e2.next(r3.children), e2.closeMark(a2); + } + }, + toMarkdown: { + match: (e2) => e2.type.name === "strong", + runner: (e2, r3) => { + e2.withMark(r3, "strong", void 0, { + marker: r3.attrs.marker + }); + } + } + })); + n3($2.mark, { + displayName: "MarkSchema", + group: "Strong" + }); + n3($2.ctx, { + displayName: "MarkSchemaCtx", + group: "Strong" + }); + var ae2 = re2("ToggleStrong", (t2) => () => toggleMark($2.type(t2))); + n3(ae2, { + displayName: "Command", + group: "Strong" + }); + var st = oe2((t2) => markRule(/(?:\*\*|__)([^*_]+)(?:\*\*|__)$/, $2.type(t2), { + getAttr: (e2) => ({ + marker: e2[0].startsWith("*") ? "*" : "_" + }) + })); + n3(st, { + displayName: "InputRule", + group: "Strong" + }); + var ne2 = ge2("strongKeymap", { + ToggleBold: { + shortcuts: ["Mod-b"], + command: (t2) => { + const e2 = t2.get(je); + return () => e2.call(ae2.key); + } + } + }); + n3(ne2.ctx, { + displayName: "KeymapCtx", + group: "Strong" + }); + n3(ne2.shortcuts, { + displayName: "Keymap", + group: "Strong" + }); + var oe3 = we2("inlineCode"); + n3(oe3, { + displayName: "Attr", + group: "InlineCode" + }); + var x5 = ye2("inlineCode", (t2) => ({ + priority: 100, + code: true, + inclusive: false, + parseDOM: [{ tag: "code" }], + toDOM: (e2) => ["code", t2.get(oe3.key)(e2)], + parseMarkdown: { + match: (e2) => e2.type === "inlineCode", + runner: (e2, r3, a2) => { + e2.openMark(a2), e2.addText(r3.value), e2.closeMark(a2); + } + }, + toMarkdown: { + match: (e2) => e2.type.name === "inlineCode", + runner: (e2, r3, a2) => { + e2.withMark(r3, "inlineCode", a2.text || ""); + } + } + })); + n3(x5.mark, { + displayName: "MarkSchema", + group: "InlineCode" + }); + n3(x5.ctx, { + displayName: "MarkSchemaCtx", + group: "InlineCode" + }); + var se2 = re2("ToggleInlineCode", (t2) => () => (e2, r3) => { + const { selection: a2, tr: o2 } = e2; + if (a2.empty) + return false; + const { from: s2, to: l5 } = a2; + return e2.doc.rangeHasMark(s2, l5, x5.type(t2)) ? (r3 == null || r3(o2.removeMark(s2, l5, x5.type(t2))), true) : (Object.keys(e2.schema.marks).filter((m3) => m3 !== x5.type.name).map((m3) => e2.schema.marks[m3]).forEach((m3) => { + o2.removeMark(s2, l5, m3); + }), r3 == null || r3(o2.addMark(s2, l5, x5.type(t2).create())), true); + }); + n3(se2, { + displayName: "Command", + group: "InlineCode" + }); + var lt2 = oe2((t2) => markRule(/(?:\`)([^\`]+)(?:\`)$/, x5.type(t2))); + n3(lt2, { + displayName: "InputRule", + group: "InlineCode" + }); + var le2 = ge2("inlineCodeKeymap", { + ToggleInlineCode: { + shortcuts: "Mod-e", + command: (t2) => { + const e2 = t2.get(je); + return () => e2.call(se2.key); + } + } + }); + n3(le2.ctx, { + displayName: "KeymapCtx", + group: "InlineCode" + }); + n3(le2.shortcuts, { + displayName: "Keymap", + group: "InlineCode" + }); + var ie5 = we2("link"); + n3(ie5, { + displayName: "Attr", + group: "Link" + }); + var B2 = ye2("link", (t2) => ({ + attrs: { + href: {}, + title: { default: null } + }, + parseDOM: [ + { + tag: "a[href]", + getAttrs: (e2) => { + if (!(e2 instanceof HTMLElement)) + throw S(e2); + return { href: e2.getAttribute("href"), title: e2.getAttribute("title") }; + } + } + ], + toDOM: (e2) => ["a", __spreadValues(__spreadValues({}, t2.get(ie5.key)(e2)), e2.attrs)], + parseMarkdown: { + match: (e2) => e2.type === "link", + runner: (e2, r3, a2) => { + const o2 = r3.url, s2 = r3.title; + e2.openMark(a2, { href: o2, title: s2 }), e2.next(r3.children), e2.closeMark(a2); + } + }, + toMarkdown: { + match: (e2) => e2.type.name === "link", + runner: (e2, r3) => { + e2.withMark(r3, "link", void 0, { + title: r3.attrs.title, + url: r3.attrs.href + }); + } + } + })); + n3(B2.mark, { + displayName: "MarkSchema", + group: "Link" + }); + var it = re2("ToggleLink", (t2) => (e2 = {}) => toggleMark(B2.type(t2), e2)); + n3(it, { + displayName: "Command", + group: "Link" + }); + var dt2 = re2("UpdateLink", (t2) => (e2 = {}) => (r3, a2) => { + if (!a2) + return false; + let o2, s2 = -1; + const { selection: l5 } = r3, { from: i2, to: d6 } = l5; + if (r3.doc.nodesBetween(i2, i2 === d6 ? d6 + 1 : d6, (y4, b4) => { + if (B2.type(t2).isInSet(y4.marks)) + return o2 = y4, s2 = b4, false; + }), !o2) + return false; + const m3 = o2.marks.find(({ type: y4 }) => y4 === B2.type(t2)); + if (!m3) + return false; + const p4 = s2, k4 = s2 + o2.nodeSize, { tr: g5 } = r3, C5 = B2.type(t2).create(__spreadValues(__spreadValues({}, m3.attrs), e2)); + return C5 ? (a2( + g5.removeMark(p4, k4, m3).addMark(p4, k4, C5).setSelection(new TextSelection(g5.selection.$anchor)).scrollIntoView() + ), true) : false; + }); + n3(dt2, { + displayName: "Command", + group: "Link" + }); + var mt2 = W3("doc", () => ({ + content: "block+", + parseMarkdown: { + match: ({ type: t2 }) => t2 === "root", + runner: (t2, e2, r3) => { + t2.injectRoot(e2, r3); + } + }, + toMarkdown: { + match: (t2) => t2.type.name === "doc", + runner: (t2, e2) => { + t2.openNode("root"), t2.next(e2.content); + } + } + })); + n3(mt2, { + displayName: "NodeSchema", + group: "Doc" + }); + var de = he("paragraph"); + n3(de, { + displayName: "Attr", + group: "Paragraph" + }); + var w5 = fe2("paragraph", (t2) => ({ + content: "inline*", + group: "block", + parseDOM: [{ tag: "p" }], + toDOM: (e2) => ["p", t2.get(de.key)(e2), 0], + parseMarkdown: { + match: (e2) => e2.type === "paragraph", + runner: (e2, r3, a2) => { + e2.openNode(a2), r3.children ? e2.next(r3.children) : e2.addText(r3.value || ""), e2.closeNode(); + } + }, + toMarkdown: { + match: (e2) => e2.type.name === "paragraph", + runner: (e2, r3) => { + e2.openNode("paragraph"), at2(e2, r3), e2.closeNode(); + } + } + })); + n3(w5.node, { + displayName: "NodeSchema", + group: "Paragraph" + }); + n3(w5.ctx, { + displayName: "NodeSchemaCtx", + group: "Paragraph" + }); + var me2 = re2("TurnIntoText", (t2) => () => setBlockType2(w5.type(t2))); + n3(me2, { + displayName: "Command", + group: "Paragraph" + }); + var pe2 = ge2("paragraphKeymap", { + TurnIntoText: { + shortcuts: "Mod-Alt-0", + command: (t2) => { + const e2 = t2.get(je); + return () => e2.call(me2.key); + } + } + }); + n3(pe2.ctx, { + displayName: "KeymapCtx", + group: "Paragraph" + }); + n3(pe2.shortcuts, { + displayName: "Keymap", + group: "Paragraph" + }); + var Dt = Array(6).fill(0).map((t2, e2) => e2 + 1); + function _t(t2) { + return slugify(t2.textContent); + } + var j4 = h3(_t, "headingIdGenerator"); + n3(j4, { + displayName: "Ctx", + group: "Heading" + }); + var ce2 = he("heading"); + n3(ce2, { + displayName: "Attr", + group: "Heading" + }); + var H4 = fe2("heading", (t2) => { + const e2 = t2.get(j4.key); + return { + content: "inline*", + group: "block", + defining: true, + attrs: { + id: { + default: "" + }, + level: { + default: 1 + } + }, + parseDOM: Dt.map((r3) => ({ + tag: `h${r3}`, + getAttrs: (a2) => { + if (!(a2 instanceof HTMLElement)) + throw S(a2); + return { level: r3, id: a2.id }; + } + })), + toDOM: (r3) => [ + `h${r3.attrs.level}`, + __spreadProps(__spreadValues({}, t2.get(ce2.key)(r3)), { + id: r3.attrs.id || e2(r3) + }), + 0 + ], + parseMarkdown: { + match: ({ type: r3 }) => r3 === "heading", + runner: (r3, a2, o2) => { + const s2 = a2.depth; + r3.openNode(o2, { level: s2 }), r3.next(a2.children), r3.closeNode(); + } + }, + toMarkdown: { + match: (r3) => r3.type.name === "heading", + runner: (r3, a2) => { + r3.openNode("heading", void 0, { depth: a2.attrs.level }), at2(r3, a2), r3.closeNode(); + } + } + }; + }); + n3(H4.node, { + displayName: "NodeSchema", + group: "Heading" + }); + n3(H4.ctx, { + displayName: "NodeSchemaCtx", + group: "Heading" + }); + var pt = oe2((t2) => textblockTypeInputRule(new RegExp("^(?#+)\\s$"), H4.type(t2), (e2) => { + var l5, i2; + const r3 = ((i2 = (l5 = e2.groups) == null ? void 0 : l5.hashes) == null ? void 0 : i2.length) || 0, a2 = t2.get(H3), { $from: o2 } = a2.state.selection, s2 = o2.node(); + if (s2.type.name === "heading") { + let d6 = Number(s2.attrs.level) + Number(r3); + return d6 > 6 && (d6 = 6), { level: d6 }; + } + return { level: r3 }; + })); + n3(pt, { + displayName: "InputRule", + group: "Heading" + }); + var L4 = re2("WrapInHeading", (t2) => (e2) => (e2 != null ? e2 : e2 = 1, e2 < 1 ? setBlockType2(w5.type(t2)) : setBlockType2(H4.type(t2), { level: e2 }))); + n3(L4, { + displayName: "Command", + group: "Heading" + }); + var ue3 = re2("DowngradeHeading", (t2) => () => (e2, r3, a2) => { + const { $from: o2 } = e2.selection, s2 = o2.node(); + if (s2.type !== H4.type(t2) || !e2.selection.empty || o2.parentOffset !== 0) + return false; + const l5 = s2.attrs.level - 1; + return l5 ? (r3 == null || r3( + e2.tr.setNodeMarkup(e2.selection.$from.before(), void 0, __spreadProps(__spreadValues({}, s2.attrs), { + level: l5 + })) + ), true) : setBlockType2(w5.type(t2))(e2, r3, a2); + }); + n3(ue3, { + displayName: "Command", + group: "Heading" + }); + var ge3 = ge2("headingKeymap", { + TurnIntoH1: { + shortcuts: "Mod-Alt-1", + command: (t2) => { + const e2 = t2.get(je); + return () => e2.call(L4.key, 1); + } + }, + TurnIntoH2: { + shortcuts: "Mod-Alt-2", + command: (t2) => { + const e2 = t2.get(je); + return () => e2.call(L4.key, 2); + } + }, + TurnIntoH3: { + shortcuts: "Mod-Alt-3", + command: (t2) => { + const e2 = t2.get(je); + return () => e2.call(L4.key, 3); + } + }, + TurnIntoH4: { + shortcuts: "Mod-Alt-4", + command: (t2) => { + const e2 = t2.get(je); + return () => e2.call(L4.key, 4); + } + }, + TurnIntoH5: { + shortcuts: "Mod-Alt-5", + command: (t2) => { + const e2 = t2.get(je); + return () => e2.call(L4.key, 5); + } + }, + TurnIntoH6: { + shortcuts: "Mod-Alt-6", + command: (t2) => { + const e2 = t2.get(je); + return () => e2.call(L4.key, 6); + } + }, + DowngradeHeading: { + shortcuts: ["Delete", "Backspace"], + command: (t2) => { + const e2 = t2.get(je); + return () => e2.call(ue3.key); + } + } + }); + n3(ge3.ctx, { + displayName: "KeymapCtx", + group: "Heading" + }); + n3(ge3.shortcuts, { + displayName: "Keymap", + group: "Heading" + }); + var ye3 = he("blockquote"); + n3(ye3, { + displayName: "Attr
", + group: "Blockquote" + }); + var q5 = fe2("blockquote", (t2) => ({ + content: "block+", + group: "block", + defining: true, + parseDOM: [{ tag: "blockquote" }], + toDOM: (e2) => ["blockquote", t2.get(ye3.key)(e2), 0], + parseMarkdown: { + match: ({ type: e2 }) => e2 === "blockquote", + runner: (e2, r3, a2) => { + e2.openNode(a2).next(r3.children).closeNode(); + } + }, + toMarkdown: { + match: (e2) => e2.type.name === "blockquote", + runner: (e2, r3) => { + e2.openNode("blockquote").next(r3.content).closeNode(); + } + } + })); + n3(q5.node, { + displayName: "NodeSchema
", + group: "Blockquote" + }); + n3(q5.ctx, { + displayName: "NodeSchemaCtx
", + group: "Blockquote" + }); + var ct2 = oe2((t2) => wrappingInputRule(/^\s*>\s$/, q5.type(t2))); + n3(ct2, { + displayName: "InputRule", + group: "Blockquote" + }); + var ke3 = re2("WrapInBlockquote", (t2) => () => wrapIn(q5.type(t2))); + n3(ke3, { + displayName: "Command", + group: "Blockquote" + }); + var he2 = ge2("blockquoteKeymap", { + WrapInBlockquote: { + shortcuts: "Mod-Shift-b", + command: (t2) => { + const e2 = t2.get(je); + return () => e2.call(ke3.key); + } + } + }); + n3(he2.ctx, { + displayName: "KeymapCtx
", + group: "Blockquote" + }); + n3(he2.shortcuts, { + displayName: "Keymap
", + group: "Blockquote" + }); + var fe3 = he("codeBlock", () => ({ + pre: {}, + code: {} + })); + n3(fe3, { + displayName: "Attr", + group: "CodeBlock" + }); + var W4 = fe2("code_block", (t2) => ({ + content: "text*", + group: "block", + marks: "", + defining: true, + code: true, + attrs: { + language: { + default: "" + } + }, + parseDOM: [ + { + tag: "pre", + preserveWhitespace: "full", + getAttrs: (e2) => { + if (!(e2 instanceof HTMLElement)) + throw S(e2); + return { language: e2.dataset.language }; + } + } + ], + toDOM: (e2) => { + const r3 = t2.get(fe3.key)(e2); + return [ + "pre", + __spreadProps(__spreadValues({}, r3.pre), { + "data-language": e2.attrs.language + }), + ["code", r3.code, 0] + ]; + }, + parseMarkdown: { + match: ({ type: e2 }) => e2 === "code", + runner: (e2, r3, a2) => { + const o2 = r3.lang, s2 = r3.value; + e2.openNode(a2, { language: o2 }), s2 && e2.addText(s2), e2.closeNode(); + } + }, + toMarkdown: { + match: (e2) => e2.type.name === "code_block", + runner: (e2, r3) => { + var a2; + e2.addNode("code", void 0, ((a2 = r3.content.firstChild) == null ? void 0 : a2.text) || "", { + lang: r3.attrs.language + }); + } + } + })); + n3(W4.node, { + displayName: "NodeSchema", + group: "CodeBlock" + }); + n3(W4.ctx, { + displayName: "NodeSchemaCtx", + group: "CodeBlock" + }); + var ut2 = oe2((t2) => textblockTypeInputRule(new RegExp("^```(?[a-z]*)?[\\s\\n]$"), W4.type(t2), (e2) => { + var _a; + var r3; + return { + language: (_a = (r3 = e2.groups) == null ? void 0 : r3.language) != null ? _a : "" + }; + })); + n3(ut2, { + displayName: "InputRule", + group: "CodeBlock" + }); + var Ne2 = re2("CreateCodeBlock", (t2) => (e2 = "") => setBlockType2(W4.type(t2), { language: e2 })); + n3(Ne2, { + displayName: "Command", + group: "CodeBlock" + }); + var Et2 = re2("UpdateCodeBlockLanguage", () => ({ pos: t2, language: e2 } = { pos: -1, language: "" }) => (r3, a2) => t2 >= 0 ? (a2 == null || a2(r3.tr.setNodeAttribute(t2, "language", e2)), true) : false); + n3(Et2, { + displayName: "Command", + group: "CodeBlock" + }); + var Ie2 = ge2("codeBlockKeymap", { + CreateCodeBlock: { + shortcuts: "Mod-Alt-c", + command: (t2) => { + const e2 = t2.get(je); + return () => e2.call(Ne2.key); + } + } + }); + n3(Ie2.ctx, { + displayName: "KeymapCtx", + group: "CodeBlock" + }); + n3(Ie2.shortcuts, { + displayName: "Keymap", + group: "CodeBlock" + }); + var Ce3 = he("image"); + n3(Ce3, { + displayName: "Attr", + group: "Image" + }); + var v2 = fe2("image", (t2) => ({ + inline: true, + group: "inline", + selectable: true, + draggable: true, + marks: "", + atom: true, + defining: true, + isolating: true, + attrs: { + src: { default: "" }, + alt: { default: "" }, + title: { default: "" } + }, + parseDOM: [ + { + tag: "img[src]", + getAttrs: (e2) => { + if (!(e2 instanceof HTMLElement)) + throw S(e2); + return { + src: e2.getAttribute("src") || "", + alt: e2.getAttribute("alt") || "", + title: e2.getAttribute("title") || e2.getAttribute("alt") || "" + }; + } + } + ], + toDOM: (e2) => ["img", __spreadValues(__spreadValues({}, t2.get(Ce3.key)(e2)), e2.attrs)], + parseMarkdown: { + match: ({ type: e2 }) => e2 === "image", + runner: (e2, r3, a2) => { + const o2 = r3.url, s2 = r3.alt, l5 = r3.title; + e2.addNode(a2, { + src: o2, + alt: s2, + title: l5 + }); + } + }, + toMarkdown: { + match: (e2) => e2.type.name === "image", + runner: (e2, r3) => { + e2.addNode("image", void 0, void 0, { + title: r3.attrs.title, + url: r3.attrs.src, + alt: r3.attrs.alt + }); + } + } + })); + n3(v2.node, { + displayName: "NodeSchema", + group: "Image" + }); + n3(v2.ctx, { + displayName: "NodeSchemaCtx", + group: "Image" + }); + var gt = re2("InsertImage", (t2) => (e2 = {}) => (r3, a2) => { + if (!a2) + return true; + const { src: o2 = "", alt: s2 = "", title: l5 = "" } = e2, i2 = v2.type(t2).create({ src: o2, alt: s2, title: l5 }); + return i2 && a2(r3.tr.replaceSelectionWith(i2).scrollIntoView()), true; + }); + n3(gt, { + displayName: "Command", + group: "Image" + }); + var yt = re2("UpdateImage", (t2) => (e2 = {}) => (r3, a2) => { + const o2 = findSelectedNodeOfType(r3.selection, v2.type(t2)); + if (!o2) + return false; + const { node: s2, pos: l5 } = o2, i2 = __spreadValues({}, s2.attrs), { src: d6, alt: m3, title: p4 } = e2; + return d6 !== void 0 && (i2.src = d6), m3 !== void 0 && (i2.alt = m3), p4 !== void 0 && (i2.title = p4), a2 == null || a2(r3.tr.setNodeMarkup(l5, void 0, i2).scrollIntoView()), true; + }); + n3(yt, { + displayName: "Command", + group: "Image" + }); + var Pt = oe2((t2) => new InputRule( + new RegExp('!\\[(?.*?)]\\((?.*?)\\s*(?="|\\))"?(?[^"]+)?"?\\)'), + (e2, r3, a2, o2) => { + const [s2, l5, i2 = "", d6] = r3; + return s2 ? e2.tr.replaceWith(a2, o2, v2.type(t2).create({ src: i2, alt: l5, title: d6 })) : null; + } + )); + n3(Pt, { + displayName: "InputRule<insertImageInputRule>", + group: "Image" + }); + var Me2 = he("hardbreak", (t2) => ({ + "data-is-inline": t2.attrs.isInline + })); + n3(Me2, { + displayName: "Attr<hardbreak>", + group: "Hardbreak" + }); + var S6 = fe2("hardbreak", (t2) => ({ + inline: true, + group: "inline", + attrs: { + isInline: { + default: false + } + }, + selectable: false, + parseDOM: [{ tag: "br" }], + toDOM: (e2) => ["br", t2.get(Me2.key)(e2)], + parseMarkdown: { + match: ({ type: e2 }) => e2 === "break", + runner: (e2, r3, a2) => { + var o2; + e2.addNode(a2, { isInline: !!((o2 = r3.data) != null && o2.isInline) }); + } + }, + leafText: () => ` +`, + toMarkdown: { + match: (e2) => e2.type.name === "hardbreak", + runner: (e2, r3) => { + r3.attrs.isInline ? e2.addNode("text", void 0, ` +`) : e2.addNode("break"); + } + } + })); + n3(S6.node, { + displayName: "NodeSchema<hardbreak>", + group: "Hardbreak" + }); + n3(S6.ctx, { + displayName: "NodeSchemaCtx<hardbreak>", + group: "Hardbreak" + }); + var be = re2("InsertHardbreak", (t2) => () => (e2, r3) => { + var s2; + const { selection: a2, tr: o2 } = e2; + if (!(a2 instanceof TextSelection)) + return false; + if (a2.empty) { + const l5 = a2.$from.node(); + if (l5.childCount > 0 && ((s2 = l5.lastChild) == null ? void 0 : s2.type.name) === "hardbreak") + return r3 == null || r3( + o2.replaceRangeWith(a2.to - 1, a2.to, e2.schema.node("paragraph")).setSelection(Selection.near(o2.doc.resolve(a2.to))).scrollIntoView() + ), true; + } + return r3 == null || r3(o2.setMeta("hardbreak", true).replaceSelectionWith(S6.type(t2).create()).scrollIntoView()), true; + }); + n3(be, { + displayName: "Command<insertHardbreakCommand>", + group: "Hardbreak" + }); + var Le = ge2("hardbreakKeymap", { + InsertHardbreak: { + shortcuts: "Shift-Enter", + command: (t2) => { + const e2 = t2.get(je); + return () => e2.call(be.key); + } + } + }); + n3(Le.ctx, { + displayName: "KeymapCtx<hardbreak>", + group: "Hardbreak" + }); + n3(Le.shortcuts, { + displayName: "Keymap<hardbreak>", + group: "Hardbreak" + }); + var xe = he("hr"); + n3(xe, { + displayName: "Attr<hr>", + group: "Hr" + }); + var F3 = fe2("hr", (t2) => ({ + group: "block", + parseDOM: [{ tag: "hr" }], + toDOM: (e2) => ["hr", t2.get(xe.key)(e2)], + parseMarkdown: { + match: ({ type: e2 }) => e2 === "thematicBreak", + runner: (e2, r3, a2) => { + e2.addNode(a2); + } + }, + toMarkdown: { + match: (e2) => e2.type.name === "hr", + runner: (e2) => { + e2.addNode("thematicBreak"); + } + } + })); + n3(F3.node, { + displayName: "NodeSchema<hr>", + group: "Hr" + }); + n3(F3.ctx, { + displayName: "NodeSchemaCtx<hr>", + group: "Hr" + }); + var kt = oe2((t2) => new InputRule( + /^(?:---|___\s|\*\*\*\s)$/, + (e2, r3, a2, o2) => { + const { tr: s2 } = e2; + return r3[0] && s2.replaceWith(a2 - 1, o2, F3.type(t2).create()), s2; + } + )); + n3(kt, { + displayName: "InputRule<insertHrInputRule>", + group: "Hr" + }); + var ht2 = re2("InsertHr", (t2) => () => (e2, r3) => { + if (!r3) + return true; + const a2 = w5.node.type(t2).create(), { tr: o2, selection: s2 } = e2, { from: l5 } = s2, i2 = F3.type(t2).create(); + if (!i2) + return true; + const d6 = o2.replaceSelectionWith(i2).insert(l5, a2), m3 = Selection.findFrom(d6.doc.resolve(l5), 1, true); + return m3 && r3(d6.setSelection(m3).scrollIntoView()), true; + }); + n3(ht2, { + displayName: "Command<insertHrCommand>", + group: "Hr" + }); + var Se = he("bulletList"); + n3(Se, { + displayName: "Attr<bulletList>", + group: "BulletList" + }); + var O3 = fe2("bullet_list", (t2) => ({ + content: "listItem+", + group: "block", + attrs: { + spread: { + default: false + } + }, + parseDOM: [ + { + tag: "ul", + getAttrs: (e2) => { + if (!(e2 instanceof HTMLElement)) + throw S(e2); + return { + spread: e2.dataset.spread + }; + } + } + ], + toDOM: (e2) => [ + "ul", + __spreadProps(__spreadValues({}, t2.get(Se.key)(e2)), { + "data-spread": e2.attrs.spread + }), + 0 + ], + parseMarkdown: { + match: ({ type: e2, ordered: r3 }) => e2 === "list" && !r3, + runner: (e2, r3, a2) => { + const o2 = r3.spread != null ? `${r3.spread}` : "false"; + e2.openNode(a2, { spread: o2 }).next(r3.children).closeNode(); + } + }, + toMarkdown: { + match: (e2) => e2.type.name === "bullet_list", + runner: (e2, r3) => { + e2.openNode("list", void 0, { ordered: false, spread: r3.attrs.spread === "true" }).next(r3.content).closeNode(); + } + } + })); + n3(O3.node, { + displayName: "NodeSchema<bulletList>", + group: "BulletList" + }); + n3(O3.ctx, { + displayName: "NodeSchemaCtx<bulletList>", + group: "BulletList" + }); + var ft = oe2((t2) => wrappingInputRule(/^\s*([-+*])\s$/, O3.type(t2))); + n3(ft, { + displayName: "InputRule<wrapInBulletListInputRule>", + group: "BulletList" + }); + var Ae2 = re2("WrapInBulletList", (t2) => () => wrapIn(O3.type(t2))); + n3(Ae2, { + displayName: "Command<wrapInBulletListCommand>", + group: "BulletList" + }); + var we3 = ge2("bulletListKeymap", { + WrapInBulletList: { + shortcuts: "Mod-Alt-8", + command: (t2) => { + const e2 = t2.get(je); + return () => e2.call(Ae2.key); + } + } + }); + n3(we3.ctx, { + displayName: "KeymapCtx<bulletListKeymap>", + group: "BulletList" + }); + n3(we3.shortcuts, { + displayName: "Keymap<bulletListKeymap>", + group: "BulletList" + }); + var He = he("orderedList"); + n3(He, { + displayName: "Attr<orderedList>", + group: "OrderedList" + }); + var T4 = fe2("ordered_list", (t2) => ({ + content: "listItem+", + group: "block", + attrs: { + order: { + default: 1 + }, + spread: { + default: false + } + }, + parseDOM: [ + { + tag: "ol", + getAttrs: (e2) => { + if (!(e2 instanceof HTMLElement)) + throw S(e2); + return { + spread: e2.dataset.spread, + order: e2.hasAttribute("start") ? Number(e2.getAttribute("start")) : 1 + }; + } + } + ], + toDOM: (e2) => [ + "ol", + __spreadProps(__spreadValues(__spreadValues({}, t2.get(He.key)(e2)), e2.attrs.order === 1 ? {} : e2.attrs.order), { + "data-spread": e2.attrs.spread + }), + 0 + ], + parseMarkdown: { + match: ({ type: e2, ordered: r3 }) => e2 === "list" && !!r3, + runner: (e2, r3, a2) => { + const o2 = r3.spread != null ? `${r3.spread}` : "true"; + e2.openNode(a2, { spread: o2 }).next(r3.children).closeNode(); + } + }, + toMarkdown: { + match: (e2) => e2.type.name === "ordered_list", + runner: (e2, r3) => { + e2.openNode("list", void 0, { ordered: true, start: 1, spread: r3.attrs.spread === "true" }), e2.next(r3.content), e2.closeNode(); + } + } + })); + n3(T4.node, { + displayName: "NodeSchema<orderedList>", + group: "OrderedList" + }); + n3(T4.ctx, { + displayName: "NodeSchemaCtx<orderedList>", + group: "OrderedList" + }); + var Nt = oe2((t2) => wrappingInputRule( + /^\s*(\d+)\.\s$/, + T4.type(t2), + (e2) => ({ order: Number(e2[1]) }), + (e2, r3) => r3.childCount + r3.attrs.order === Number(e2[1]) + )); + n3(Nt, { + displayName: "InputRule<wrapInOrderedListInputRule>", + group: "OrderedList" + }); + var Be = re2("WrapInOrderedList", (t2) => () => wrapIn(T4.type(t2))); + n3(Be, { + displayName: "Command<wrapInOrderedListCommand>", + group: "OrderedList" + }); + var Re = ge2("orderedListKeymap", { + WrapInOrderedList: { + shortcuts: "Mod-Alt-7", + command: (t2) => { + const e2 = t2.get(je); + return () => e2.call(Be.key); + } + } + }); + n3(Re.ctx, { + displayName: "KeymapCtx<orderedList>", + group: "OrderedList" + }); + n3(Re.shortcuts, { + displayName: "Keymap<orderedList>", + group: "OrderedList" + }); + var ve2 = he("listItem"); + n3(ve2, { + displayName: "Attr<listItem>", + group: "ListItem" + }); + var M5 = fe2("list_item", (t2) => ({ + group: "listItem", + content: "block+", + attrs: { + label: { + default: "\u2022" + }, + listType: { + default: "bullet" + }, + spread: { + default: "true" + } + }, + defining: true, + parseDOM: [ + { + tag: "li", + getAttrs: (e2) => { + if (!(e2 instanceof HTMLElement)) + throw S(e2); + return { + label: e2.dataset.label, + listType: e2.dataset["list-type"], + spread: e2.dataset.spread + }; + } + } + ], + toDOM: (e2) => [ + "li", + __spreadProps(__spreadValues({}, t2.get(ve2.key)(e2)), { + "data-label": e2.attrs.label, + "data-list-type": e2.attrs.listType, + "data-spread": e2.attrs.spread + }), + 0 + ], + parseMarkdown: { + match: ({ type: e2 }) => e2 === "listItem", + runner: (e2, r3, a2) => { + const o2 = r3.label != null ? `${r3.label}.` : "\u2022", s2 = r3.label != null ? "ordered" : "bullet", l5 = r3.spread != null ? `${r3.spread}` : "true"; + e2.openNode(a2, { label: o2, listType: s2, spread: l5 }), e2.next(r3.children), e2.closeNode(); + } + }, + toMarkdown: { + match: (e2) => e2.type.name === "list_item", + runner: (e2, r3) => { + e2.openNode("listItem", void 0, { spread: r3.attrs.spread === "true" }), e2.next(r3.content), e2.closeNode(); + } + } + })); + n3(M5.node, { + displayName: "NodeSchema<listItem>", + group: "ListItem" + }); + n3(M5.ctx, { + displayName: "NodeSchemaCtx<listItem>", + group: "ListItem" + }); + var Oe2 = re2("SinkListItem", (t2) => () => sinkListItem(M5.type(t2))); + n3(Oe2, { + displayName: "Command<sinkListItemCommand>", + group: "ListItem" + }); + var Te2 = re2("LiftListItem", (t2) => () => liftListItem(M5.type(t2))); + n3(Te2, { + displayName: "Command<liftListItemCommand>", + group: "ListItem" + }); + var Ke2 = re2("SplitListItem", (t2) => () => splitListItem(M5.type(t2))); + n3(Ke2, { + displayName: "Command<splitListItemCommand>", + group: "ListItem" + }); + function $t(t2) { + return (e2, r3, a2) => { + const { selection: o2 } = e2; + if (!(o2 instanceof TextSelection)) + return false; + const { empty: s2, $from: l5 } = o2; + if (!s2 || l5.parentOffset !== 0) + return false; + const i2 = l5.node(-1); + return i2.type !== M5.type(t2) || i2.firstChild !== l5.node() || l5.node(-2).childCount > 1 ? false : liftListItem(M5.type(t2))(e2, r3, a2); + }; + } + var De2 = re2("LiftFirstListItem", (t2) => () => $t(t2)); + n3(De2, { + displayName: "Command<liftFirstListItemCommand>", + group: "ListItem" + }); + var _e2 = ge2("listItemKeymap", { + NextListItem: { + shortcuts: "Enter", + command: (t2) => { + const e2 = t2.get(je); + return () => e2.call(Ke2.key); + } + }, + SinkListItem: { + shortcuts: ["Tab", "Mod-]"], + command: (t2) => { + const e2 = t2.get(je); + return () => e2.call(Oe2.key); + } + }, + LiftListItem: { + shortcuts: ["Shift-Tab", "Mod-["], + command: (t2) => { + const e2 = t2.get(je); + return () => e2.call(Te2.key); + } + }, + LiftFirstListItem: { + shortcuts: ["Backspace", "Delete"], + command: (t2) => { + const e2 = t2.get(je); + return () => e2.call(De2.key); + } + } + }); + n3(_e2.ctx, { + displayName: "KeymapCtx<listItem>", + group: "ListItem" + }); + n3(_e2.shortcuts, { + displayName: "Keymap<listItem>", + group: "ListItem" + }); + var It = W3("text", () => ({ + group: "inline", + parseMarkdown: { + match: ({ type: t2 }) => t2 === "text", + runner: (t2, e2) => { + t2.addText(e2.value); + } + }, + toMarkdown: { + match: (t2) => t2.type.name === "text", + runner: (t2, e2) => { + t2.addNode("text", void 0, e2.text); + } + } + })); + n3(It, { + displayName: "NodeSchema<text>", + group: "Text" + }); + var Ee2 = he("html"); + n3(Ee2, { + displayName: "Attr<html>", + group: "Html" + }); + var Pe = fe2("html", (t2) => ({ + atom: true, + group: "inline", + inline: true, + attrs: { + value: { + default: "" + } + }, + toDOM: (e2) => { + const r3 = document.createElement("span"), a2 = __spreadProps(__spreadValues({}, t2.get(Ee2.key)(e2)), { + "data-value": e2.attrs.value, + "data-type": "html" + }); + return r3.textContent = e2.attrs.value, ["span", a2, e2.attrs.value]; + }, + parseDOM: [{ + tag: 'span[data-type="html"]', + getAttrs: (e2) => { + var _a; + return { + value: (_a = e2.dataset.value) != null ? _a : "" + }; + } + }], + parseMarkdown: { + match: ({ type: e2 }) => e2 === "html", + runner: (e2, r3, a2) => { + e2.addNode(a2, { value: r3.value }); + } + }, + toMarkdown: { + match: (e2) => e2.type.name === "html", + runner: (e2, r3) => { + e2.addNode("html", void 0, r3.attrs.value); + } + } + })); + n3(Pe.node, { + displayName: "NodeSchema<html>", + group: "Html" + }); + n3(Pe.ctx, { + displayName: "NodeSchemaCtx<html>", + group: "Html" + }); + var qt = [ + mt2, + de, + w5, + j4, + ce2, + H4, + Me2, + S6, + ye3, + q5, + fe3, + W4, + xe, + F3, + Ce3, + v2, + Se, + O3, + He, + T4, + ve2, + M5, + Z3, + R4, + re3, + $2, + oe3, + x5, + ie5, + B2, + Ee2, + Pe, + It + ].flat(); + var Wt = [ + ct2, + ft, + Nt, + ut2, + kt, + pt + ].flat(); + var Ft = [ + nt, + ot2, + lt2, + st + ]; + var Vt = [ + me2, + ke3, + L4, + ue3, + Ne2, + be, + ht2, + gt, + yt, + Be, + Ae2, + Oe2, + Ke2, + Te2, + De2, + ee2, + se2, + ae2, + it, + dt2 + ]; + var Ut = [ + he2, + Ie2, + Le, + ge3, + _e2, + Re, + we3, + pe2, + te2, + le2, + ne2 + ].flat(); + var $e = ke2("remarkAddOrderInList", () => () => (t2) => { + visit(t2, "list", (e2) => { + var _a; + if (e2.ordered) { + const r3 = (_a = e2.start) != null ? _a : 1; + e2.children.forEach((a2, o2) => { + a2.label = o2 + r3; + }); + } + }); + }); + n3($e.plugin, { + displayName: "Remark<remarkAddOrderInListPlugin>", + group: "Remark" + }); + n3($e.options, { + displayName: "RemarkConfig<remarkAddOrderInListPlugin>", + group: "Remark" + }); + var qe = ke2("remarkLineBreak", () => () => (t2) => { + const e2 = /[\t ]*(?:\r?\n|\r)/g; + visit(t2, "text", (r3, a2, o2) => { + if (!r3.value || typeof r3.value != "string") + return; + const s2 = []; + let l5 = 0; + e2.lastIndex = 0; + let i2 = e2.exec(r3.value); + for (; i2; ) { + const m3 = i2.index; + l5 !== m3 && s2.push({ type: "text", value: r3.value.slice(l5, m3) }), s2.push({ type: "break", data: { isInline: true } }), l5 = m3 + i2[0].length, i2 = e2.exec(r3.value); + } + if (s2.length > 0 && o2 && typeof a2 == "number") + return l5 < r3.value.length && s2.push({ type: "text", value: r3.value.slice(l5) }), o2.children.splice(a2, 1, ...s2), a2 + s2.length; + }); + }); + n3(qe.plugin, { + displayName: "Remark<remarkLineBreak>", + group: "Remark" + }); + n3(qe.options, { + displayName: "RemarkConfig<remarkLineBreak>", + group: "Remark" + }); + var We = ke2("remarkInlineLink", () => remarkInlineLinks); + n3(We.plugin, { + displayName: "Remark<remarkInlineLinkPlugin>", + group: "Remark" + }); + n3(We.options, { + displayName: "RemarkConfig<remarkInlineLinkPlugin>", + group: "Remark" + }); + var Gt = (t2) => !!t2.children; + var jt = (t2) => t2.type === "html"; + function zt(t2, e2) { + return r3(t2, 0, null)[0]; + function r3(a2, o2, s2) { + if (Gt(a2)) { + const l5 = []; + for (let i2 = 0, d6 = a2.children.length; i2 < d6; i2++) { + const m3 = a2.children[i2]; + if (m3) { + const p4 = r3(m3, i2, a2); + if (p4) + for (let k4 = 0, g5 = p4.length; k4 < g5; k4++) { + const C5 = p4[k4]; + C5 && l5.push(C5); + } + } + } + a2.children = l5; + } + return e2(a2, o2, s2); + } + } + var Fe = ke2("remarkHTMLTransformer", () => () => (t2) => { + zt(t2, (e2, r3, a2) => jt(e2) ? ((a2 == null ? void 0 : a2.type) === "root" && (e2.children = [__spreadValues({}, e2)], delete e2.value, e2.type = "paragraph"), [e2]) : [e2]); + }); + n3(Fe.plugin, { + displayName: "Remark<remarkHtmlTransformer>", + group: "Remark" + }); + n3(Fe.options, { + displayName: "RemarkConfig<remarkHtmlTransformer>", + group: "Remark" + }); + var Ve2 = ke2("remarkMarker", () => () => (t2, e2) => { + const r3 = (a2) => e2.value.charAt(a2.position.start.offset); + visit(t2, (a2) => ["strong", "emphasis"].includes(a2.type), (a2) => { + a2.marker = r3(a2); + }); + }); + n3(Ve2.plugin, { + displayName: "Remark<remarkMarker>", + group: "Remark" + }); + n3(Ve2.options, { + displayName: "RemarkConfig<remarkMarker>", + group: "Remark" + }); + var Ct = ue2(() => { + let t2 = false; + const e2 = new PluginKey("MILKDOWN_INLINE_NODES_CURSOR"), r3 = new Plugin({ + key: e2, + state: { + init() { + return false; + }, + apply(a2) { + if (!a2.selection.empty) + return false; + const o2 = a2.selection.$from, s2 = o2.nodeBefore, l5 = o2.nodeAfter; + return !!(s2 && l5 && s2.isInline && !s2.isText && l5.isInline && !l5.isText); + } + }, + props: { + handleDOMEvents: { + compositionend: (a2, o2) => t2 ? (t2 = false, requestAnimationFrame(() => { + if (r3.getState(a2.state)) { + const l5 = a2.state.selection.from; + o2.preventDefault(), a2.dispatch(a2.state.tr.insertText(o2.data || "", l5)); + } + }), true) : false, + compositionstart: (a2) => (r3.getState(a2.state) && (t2 = true), false), + beforeinput: (a2, o2) => { + if (r3.getState(a2.state) && o2 instanceof InputEvent && o2.data && !t2) { + const l5 = a2.state.selection.from; + return o2.preventDefault(), a2.dispatch(a2.state.tr.insertText(o2.data || "", l5)), true; + } + return false; + } + }, + decorations(a2) { + if (r3.getState(a2)) { + const l5 = a2.selection.$from.pos, i2 = document.createElement("span"), d6 = Decoration.widget(l5, i2, { + side: -1 + }), m3 = document.createElement("span"), p4 = Decoration.widget(l5, m3); + return setTimeout(() => { + i2.contentEditable = "true", m3.contentEditable = "true"; + }), DecorationSet.create(a2.doc, [d6, p4]); + } + return DecorationSet.empty; + } + } + }); + return r3; + }); + n3(Ct, { + displayName: "Prose<inlineNodesCursorPlugin>", + group: "Prose" + }); + var Mt = ue2((t2) => new Plugin({ + key: new PluginKey("MILKDOWN_HARDBREAK_MARKS"), + appendTransaction: (e2, r3, a2) => { + if (!e2.length) + return; + const [o2] = e2; + if (!o2) + return; + const [s2] = o2.steps; + if (o2.getMeta("hardbreak")) { + if (!(s2 instanceof ReplaceStep)) + return; + const { from: d6 } = s2; + return a2.tr.setNodeMarkup(d6, S6.type(t2), void 0, []); + } + if (s2 instanceof AddMarkStep) { + let d6 = a2.tr; + const { from: m3, to: p4 } = s2; + return a2.doc.nodesBetween(m3, p4, (k4, g5) => { + k4.type === S6.type(t2) && (d6 = d6.setNodeMarkup(g5, S6.type(t2), void 0, [])); + }), d6; + } + } + })); + n3(Mt, { + displayName: "Prose<hardbreakClearMarkPlugin>", + group: "Prose" + }); + var Ue = h3(["table", "code_block"], "hardbreakFilterNodes"); + n3(Ue, { + displayName: "Ctx<hardbreakFilterNodes>", + group: "Prose" + }); + var bt = ue2((t2) => { + const e2 = t2.get(Ue.key); + return new Plugin({ + key: new PluginKey("MILKDOWN_HARDBREAK_FILTER"), + filterTransaction: (r3, a2) => { + const o2 = r3.getMeta("hardbreak"), [s2] = r3.steps; + if (o2 && s2) { + const { from: l5 } = s2, i2 = a2.doc.resolve(l5); + let d6 = i2.depth, m3 = true; + for (; d6 > 0; ) + e2.includes(i2.node(d6).type.name) && (m3 = false), d6--; + return m3; + } + return true; + } + }); + }); + n3(bt, { + displayName: "Prose<hardbreakFilterPlugin>", + group: "Prose" + }); + var Lt = ue2((t2) => { + const e2 = new PluginKey("MILKDOWN_HEADING_ID"), r3 = (a2) => { + if (a2.composing) + return; + const o2 = t2.get(j4.key), s2 = a2.state.tr.setMeta("addToHistory", false); + let l5 = false; + a2.state.doc.descendants((i2, d6) => { + if (i2.type === H4.type(t2)) { + if (i2.textContent.trim().length === 0) + return; + const m3 = i2.attrs, p4 = o2(i2); + m3.id !== p4 && (l5 = true, s2.setMeta(e2, true).setNodeMarkup(d6, void 0, __spreadProps(__spreadValues({}, m3), { + id: p4 + }))); + } + }), l5 && a2.dispatch(s2); + }; + return new Plugin({ + key: e2, + view: (a2) => (r3(a2), { + update: (o2) => { + r3(o2); + } + }) + }); + }); + n3(Lt, { + displayName: "Prose<syncHeadingIdPlugin>", + group: "Prose" + }); + var xt = ue2((t2) => { + const e2 = (r3) => { + if (r3.composing || !r3.editable) + return; + const a2 = T4.type(t2), o2 = O3.type(t2), s2 = M5.type(t2), l5 = r3.state, i2 = (p4, k4) => { + let g5 = false; + const C5 = `${k4 + 1}.`; + return p4.label !== C5 && (p4.label = C5, g5 = true), g5; + }; + let d6 = l5.tr, m3 = false; + l5.doc.descendants((p4, k4, g5, C5) => { + if (p4.type === o2) { + const y4 = p4.maybeChild(0); + (y4 == null ? void 0 : y4.type) === s2 && y4.attrs.listType === "ordered" && (m3 = true, d6.setNodeMarkup(k4, a2, { spread: "true" }), p4.descendants((b4, Ge, Qt, St) => { + if (b4.type === s2) { + const je2 = __spreadValues({}, b4.attrs); + i2(je2, St) && (d6 = d6.setNodeMarkup(Ge, void 0, je2)); + } + return false; + })); + } else if (p4.type === s2 && (g5 == null ? void 0 : g5.type) === a2) { + const y4 = __spreadValues({}, p4.attrs); + let b4 = false; + y4.listType !== "ordered" && (y4.listType = "ordered", b4 = true), (g5 == null ? void 0 : g5.maybeChild(0)) && (b4 = i2(y4, C5)), b4 && (d6 = d6.setNodeMarkup(k4, void 0, y4), m3 = true); + } + }), m3 && r3.dispatch(d6.setMeta("addToHistory", false)); + }; + return new Plugin({ + key: new PluginKey("MILKDOWN_KEEP_LIST_ORDER"), + view: (r3) => (e2(r3), { + update: (a2) => { + e2(a2); + } + }) + }); + }); + n3(xt, { + displayName: "Prose<syncListOrderPlugin>", + group: "Prose" + }); + var Jt = [ + Mt, + Ue, + bt, + Ct, + $e, + We, + qe, + Fe, + Ve2, + Lt, + xt + ].flat(); + var cr = [qt, Wt, Ft, Vt, Ut, Jt].flat(); + + // node_modules/clsx/dist/clsx.mjs + function r2(e2) { + var t2, f3, n4 = ""; + if ("string" == typeof e2 || "number" == typeof e2) n4 += e2; + else if ("object" == typeof e2) if (Array.isArray(e2)) { + var o2 = e2.length; + for (t2 = 0; t2 < o2; t2++) e2[t2] && (f3 = r2(e2[t2])) && (n4 && (n4 += " "), n4 += f3); + } else for (f3 in e2) e2[f3] && (n4 && (n4 += " "), n4 += f3); + return n4; + } + function clsx() { + for (var e2, t2, f3 = 0, n4 = "", o2 = arguments.length; f3 < o2; f3++) (e2 = arguments[f3]) && (t2 = r2(e2)) && (n4 && (n4 += " "), n4 += t2); + return n4; + } + var clsx_default = clsx; + + // node_modules/@milkdown/components/lib/list-item-block/index.es.js + var __defProp2 = Object.defineProperty; + var __getOwnPropSymbols2 = Object.getOwnPropertySymbols; + var __hasOwnProp2 = Object.prototype.hasOwnProperty; + var __propIsEnum2 = Object.prototype.propertyIsEnumerable; + var __defNormalProp2 = (obj, key, value) => key in obj ? __defProp2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value; + var __spreadValues2 = (a2, b4) => { + for (var prop in b4 || (b4 = {})) + if (__hasOwnProp2.call(b4, prop)) + __defNormalProp2(a2, prop, b4[prop]); + if (__getOwnPropSymbols2) + for (var prop of __getOwnPropSymbols2(b4)) { + if (__propIsEnum2.call(b4, prop)) + __defNormalProp2(a2, prop, b4[prop]); + } + return a2; + }; + function withMeta(plugin, meta) { + Object.assign(plugin, { + meta: __spreadValues2({ + package: "@milkdown/components" + }, meta) + }); + return plugin; + } + var scaleSelector = (selector) => selector.replace(/([^\w\_\-])/g, "\\$1"); + var serializeRules = ({ cssText, selectorText }, scopeSelector) => `${selectorText.split(/\s*,\s*/).map((selector) => (selector.startsWith(":") ? selector : ":host " + selector).replace(/(:host)\((.+)\)/, "$1$2").replace(/::slotted\((.+)\)/, ":host > $1").replace(/:host/g, scopeSelector))}${cssText.replace(selectorText, "").replace(/(animation(?:-name){0,1}\s*:\s*)([^;}]+)/g, "$1$2-" + scaleSelector(scopeSelector))}`; + function getRules(Sheet, scopeSelector) { + const { cssRules } = Sheet; + let rules = []; + for (let i2 = 0; i2 < cssRules.length; i2++) { + const rule = cssRules[i2]; + if (rule instanceof CSSStyleRule) { + rules.push(serializeRules(rule, scopeSelector)); + } else if (rule instanceof CSSKeyframesRule) { + const { cssText } = rule; + rules.push(cssText.replace(/\s+([^\s{]+)/, " $1-" + scaleSelector(scopeSelector))); + } else if (rule instanceof CSSMediaRule) { + const { conditionText } = rule; + rules.push(`@media ${conditionText}{${getRules(rule, scopeSelector)}}`); + } + } + return rules; + } + var sandbox; + function getSheet(style2) { + if (style2 instanceof CSSStyleSheet) { + return style2; + } + if (style2.sheet) { + return style2.sheet; + } + if (!sandbox) { + sandbox = document.createElement("iframe"); + sandbox.style.display = "none"; + document.body.appendChild(sandbox); + } + const { contentDocument } = sandbox; + contentDocument.head.appendChild(style2); + const { sheet } = style2; + const { cloneNode } = style2; + style2.cloneNode = (deep) => { + const copy2 = cloneNode.call(style2); + const { cssRules } = sheet; + for (let i2 = 0; i2 < cssRules.length; i2++) { + copy2.textContent += cssRules[i2].cssText; + } + return copy2; + }; + return sheet; + } + var ATTR = "data-sheet"; + var ID5 = 0; + function useCssLightDom(sheet) { + const host = useHost(); + useLayoutEffect(() => { + const style2 = document.createElement("style"); + const { current } = host; + if (!current.hasAttribute(ATTR)) { + current.setAttribute(ATTR, `${ID5++}`); + } + current.appendChild(style2); + if (style2.sheet) { + (Array.isArray(sheet) ? sheet.flat(100) : [sheet]).forEach((target) => { + if (!target) + return; + const sheet2 = getSheet(target); + getRules(sheet2, current.localName + `[data-sheet="${current.dataset.sheet}"]`).forEach((rule) => style2.sheet.insertRule(rule, style2.sheet.cssRules.length)); + }); + } + return () => style2.remove(); + }, [sheet]); + } + var style = css` + :host > .list-item { + display: flex; + align-items: start; + } + + :host > .list-item > .children { + min-width: 0; + flex: 1; + } +`; + var listItemComponent = ({ + selected, + label, + listType, + checked, + onMount, + setAttr, + config + }) => { + const host = useHost(); + const contentWrapperRef = useRef(); + useCssLightDom(style); + useLayoutEffect(() => { + const current = contentWrapperRef.current; + if (!current) + return; + const contentDOM = host.current.querySelector("[data-content-dom]"); + if (contentDOM) { + current.appendChild(contentDOM); + onMount == null ? void 0 : onMount(); + } + }, []); + const onClickLabel = () => { + if (checked == null) + return; + setAttr == null ? void 0 : setAttr("checked", !checked); + }; + return html2`<host> + <li class=${clsx_default("list-item", selected && "ProseMirror-selectednode")}> + <div class="label-wrapper" onclick=${onClickLabel} contenteditable="false">${config == null ? void 0 : config.renderLabel(label != null ? label : "", listType != null ? listType : "", checked)}</div> + <div class="children" ref=${contentWrapperRef}></div> + </li> + </host>`; + }; + listItemComponent.props = { + label: String, + checked: Boolean, + listType: String, + config: Object, + selected: Boolean, + setAttr: Function, + onMount: Function + }; + var ListItemElement = c4(listItemComponent); + var defaultListItemBlockConfig = { + renderLabel: (label, listType, checked) => { + if (checked == null) + return html2`<span class='label'>${listType === "bullet" ? "\u29BF" : label}</span>`; + return html2`<input class='label' type="checkbox" checked=${checked} />`; + } + }; + var listItemBlockConfig = h3(defaultListItemBlockConfig, "listItemBlockConfigCtx"); + withMeta(listItemBlockConfig, { + displayName: "Config<list-item-block>", + group: "ListItemBlock" + }); + customElements.define("milkdown-list-item-block", ListItemElement); + var listItemBlockView = le(M5.node, (ctx) => { + return (initialNode, view, getPos) => { + const dom = document.createElement("milkdown-list-item-block"); + const contentDOM = document.createElement("div"); + contentDOM.setAttribute("data-content-dom", "true"); + contentDOM.classList.add("content-dom"); + const config = ctx.get(listItemBlockConfig.key); + const bindAttrs = (node22) => { + dom.listType = node22.attrs.listType; + dom.label = node22.attrs.label; + dom.checked = node22.attrs.checked; + }; + bindAttrs(initialNode); + dom.appendChild(contentDOM); + dom.selected = false; + dom.setAttr = (attr, value) => { + const pos = getPos(); + if (pos == null) + return; + view.dispatch(view.state.tr.setNodeAttribute(pos, attr, value)); + }; + dom.onMount = () => { + var _a; + const pos = (_a = getPos()) != null ? _a : 0; + const end = pos + initialNode.nodeSize; + const { from, to } = view.state.selection; + if (view.hasFocus() && pos < from && to < end) { + Promise.resolve().then(() => { + const p4 = view.state.doc.resolve(pos); + view.dispatch(view.state.tr.setSelection(TextSelection.near(p4, 1))); + }); + } + }; + let node2 = initialNode; + dom.config = config; + return { + dom, + contentDOM, + update: (updatedNode) => { + if (updatedNode.type !== initialNode.type) + return false; + if (updatedNode.sameMarkup(node2) && updatedNode.content.eq(node2.content)) + return false; + node2 = updatedNode; + bindAttrs(updatedNode); + return true; + }, + ignoreMutation: (mutation) => { + if (!dom || !contentDOM) + return true; + if (mutation.type === "selection") + return false; + if (contentDOM === mutation.target && mutation.type === "attributes") + return true; + if (contentDOM.contains(mutation.target)) + return false; + return true; + }, + selectNode: () => { + dom.selected = true; + }, + deselectNode: () => { + dom.selected = false; + }, + destroy: () => { + dom.remove(); + contentDOM.remove(); + } + }; + }; + }); + withMeta(listItemBlockView, { + displayName: "NodeView<list-item-block>", + group: "ListItemBlock" + }); + var listItemBlockComponent = [ + listItemBlockConfig, + listItemBlockView + ]; + + // node_modules/prosemirror-tables/dist/index.js + var readFromCache; + var addToCache; + if (typeof WeakMap != "undefined") { + let cache = /* @__PURE__ */ new WeakMap(); + readFromCache = (key) => cache.get(key); + addToCache = (key, value) => { + cache.set(key, value); + return value; + }; + } else { + const cache = []; + const cacheSize = 10; + let cachePos = 0; + readFromCache = (key) => { + for (let i2 = 0; i2 < cache.length; i2 += 2) + if (cache[i2] == key) + return cache[i2 + 1]; + }; + addToCache = (key, value) => { + if (cachePos == cacheSize) + cachePos = 0; + cache[cachePos++] = key; + return cache[cachePos++] = value; + }; + } + var TableMap = class { + constructor(width, height, map5, problems) { + this.width = width; + this.height = height; + this.map = map5; + this.problems = problems; + } + // Find the dimensions of the cell at the given position. + findCell(pos) { + for (let i2 = 0; i2 < this.map.length; i2++) { + const curPos = this.map[i2]; + if (curPos != pos) + continue; + const left = i2 % this.width; + const top = i2 / this.width | 0; + let right = left + 1; + let bottom = top + 1; + for (let j6 = 1; right < this.width && this.map[i2 + j6] == curPos; j6++) { + right++; + } + for (let j6 = 1; bottom < this.height && this.map[i2 + this.width * j6] == curPos; j6++) { + bottom++; + } + return { left, top, right, bottom }; + } + throw new RangeError(`No cell with offset ${pos} found`); + } + // Find the left side of the cell at the given position. + colCount(pos) { + for (let i2 = 0; i2 < this.map.length; i2++) { + if (this.map[i2] == pos) { + return i2 % this.width; + } + } + throw new RangeError(`No cell with offset ${pos} found`); + } + // Find the next cell in the given direction, starting from the cell + // at `pos`, if any. + nextCell(pos, axis, dir) { + const { left, right, top, bottom } = this.findCell(pos); + if (axis == "horiz") { + if (dir < 0 ? left == 0 : right == this.width) + return null; + return this.map[top * this.width + (dir < 0 ? left - 1 : right)]; + } else { + if (dir < 0 ? top == 0 : bottom == this.height) + return null; + return this.map[left + this.width * (dir < 0 ? top - 1 : bottom)]; + } + } + // Get the rectangle spanning the two given cells. + rectBetween(a2, b4) { + const { + left: leftA, + right: rightA, + top: topA, + bottom: bottomA + } = this.findCell(a2); + const { + left: leftB, + right: rightB, + top: topB, + bottom: bottomB + } = this.findCell(b4); + return { + left: Math.min(leftA, leftB), + top: Math.min(topA, topB), + right: Math.max(rightA, rightB), + bottom: Math.max(bottomA, bottomB) + }; + } + // Return the position of all cells that have the top left corner in + // the given rectangle. + cellsInRect(rect) { + const result = []; + const seen = {}; + for (let row = rect.top; row < rect.bottom; row++) { + for (let col = rect.left; col < rect.right; col++) { + const index2 = row * this.width + col; + const pos = this.map[index2]; + if (seen[pos]) + continue; + seen[pos] = true; + if (col == rect.left && col && this.map[index2 - 1] == pos || row == rect.top && row && this.map[index2 - this.width] == pos) { + continue; + } + result.push(pos); + } + } + return result; + } + // Return the position at which the cell at the given row and column + // starts, or would start, if a cell started there. + positionAt(row, col, table) { + for (let i2 = 0, rowStart = 0; ; i2++) { + const rowEnd = rowStart + table.child(i2).nodeSize; + if (i2 == row) { + let index2 = col + row * this.width; + const rowEndIndex = (row + 1) * this.width; + while (index2 < rowEndIndex && this.map[index2] < rowStart) + index2++; + return index2 == rowEndIndex ? rowEnd - 1 : this.map[index2]; + } + rowStart = rowEnd; + } + } + // Find the table map for the given table node. + static get(table) { + return readFromCache(table) || addToCache(table, computeMap(table)); + } + }; + function computeMap(table) { + if (table.type.spec.tableRole != "table") + throw new RangeError("Not a table node: " + table.type.name); + const width = findWidth(table), height = table.childCount; + const map5 = []; + let mapPos = 0; + let problems = null; + const colWidths = []; + for (let i2 = 0, e2 = width * height; i2 < e2; i2++) + map5[i2] = 0; + for (let row = 0, pos = 0; row < height; row++) { + const rowNode = table.child(row); + pos++; + for (let i2 = 0; ; i2++) { + while (mapPos < map5.length && map5[mapPos] != 0) + mapPos++; + if (i2 == rowNode.childCount) + break; + const cellNode = rowNode.child(i2); + const { colspan, rowspan, colwidth } = cellNode.attrs; + for (let h5 = 0; h5 < rowspan; h5++) { + if (h5 + row >= height) { + (problems || (problems = [])).push({ + type: "overlong_rowspan", + pos, + n: rowspan - h5 + }); + break; + } + const start = mapPos + h5 * width; + for (let w7 = 0; w7 < colspan; w7++) { + if (map5[start + w7] == 0) + map5[start + w7] = pos; + else + (problems || (problems = [])).push({ + type: "collision", + row, + pos, + n: colspan - w7 + }); + const colW = colwidth && colwidth[w7]; + if (colW) { + const widthIndex = (start + w7) % width * 2, prev = colWidths[widthIndex]; + if (prev == null || prev != colW && colWidths[widthIndex + 1] == 1) { + colWidths[widthIndex] = colW; + colWidths[widthIndex + 1] = 1; + } else if (prev == colW) { + colWidths[widthIndex + 1]++; + } + } + } + } + mapPos += colspan; + pos += cellNode.nodeSize; + } + const expectedPos = (row + 1) * width; + let missing = 0; + while (mapPos < expectedPos) + if (map5[mapPos++] == 0) + missing++; + if (missing) + (problems || (problems = [])).push({ type: "missing", row, n: missing }); + pos++; + } + const tableMap = new TableMap(width, height, map5, problems); + let badWidths = false; + for (let i2 = 0; !badWidths && i2 < colWidths.length; i2 += 2) + if (colWidths[i2] != null && colWidths[i2 + 1] < height) + badWidths = true; + if (badWidths) + findBadColWidths(tableMap, colWidths, table); + return tableMap; + } + function findWidth(table) { + let width = -1; + let hasRowSpan = false; + for (let row = 0; row < table.childCount; row++) { + const rowNode = table.child(row); + let rowWidth = 0; + if (hasRowSpan) + for (let j6 = 0; j6 < row; j6++) { + const prevRow = table.child(j6); + for (let i2 = 0; i2 < prevRow.childCount; i2++) { + const cell = prevRow.child(i2); + if (j6 + cell.attrs.rowspan > row) + rowWidth += cell.attrs.colspan; + } + } + for (let i2 = 0; i2 < rowNode.childCount; i2++) { + const cell = rowNode.child(i2); + rowWidth += cell.attrs.colspan; + if (cell.attrs.rowspan > 1) + hasRowSpan = true; + } + if (width == -1) + width = rowWidth; + else if (width != rowWidth) + width = Math.max(width, rowWidth); + } + return width; + } + function findBadColWidths(map5, colWidths, table) { + if (!map5.problems) + map5.problems = []; + const seen = {}; + for (let i2 = 0; i2 < map5.map.length; i2++) { + const pos = map5.map[i2]; + if (seen[pos]) + continue; + seen[pos] = true; + const node2 = table.nodeAt(pos); + if (!node2) { + throw new RangeError(`No cell with offset ${pos} found`); + } + let updated = null; + const attrs = node2.attrs; + for (let j6 = 0; j6 < attrs.colspan; j6++) { + const col = (i2 + j6) % map5.width; + const colWidth = colWidths[col * 2]; + if (colWidth != null && (!attrs.colwidth || attrs.colwidth[j6] != colWidth)) + (updated || (updated = freshColWidth(attrs)))[j6] = colWidth; + } + if (updated) + map5.problems.unshift({ + type: "colwidth mismatch", + pos, + colwidth: updated + }); + } + } + function freshColWidth(attrs) { + if (attrs.colwidth) + return attrs.colwidth.slice(); + const result = []; + for (let i2 = 0; i2 < attrs.colspan; i2++) + result.push(0); + return result; + } + function getCellAttrs(dom, extraAttrs) { + if (typeof dom === "string") { + return {}; + } + const widthAttr = dom.getAttribute("data-colwidth"); + const widths = widthAttr && /^\d+(,\d+)*$/.test(widthAttr) ? widthAttr.split(",").map((s2) => Number(s2)) : null; + const colspan = Number(dom.getAttribute("colspan") || 1); + const result = { + colspan, + rowspan: Number(dom.getAttribute("rowspan") || 1), + colwidth: widths && widths.length == colspan ? widths : null + }; + for (const prop in extraAttrs) { + const getter = extraAttrs[prop].getFromDOM; + const value = getter && getter(dom); + if (value != null) { + result[prop] = value; + } + } + return result; + } + function setCellAttrs(node2, extraAttrs) { + const attrs = {}; + if (node2.attrs.colspan != 1) + attrs.colspan = node2.attrs.colspan; + if (node2.attrs.rowspan != 1) + attrs.rowspan = node2.attrs.rowspan; + if (node2.attrs.colwidth) + attrs["data-colwidth"] = node2.attrs.colwidth.join(","); + for (const prop in extraAttrs) { + const setter = extraAttrs[prop].setDOMAttr; + if (setter) + setter(node2.attrs[prop], attrs); + } + return attrs; + } + function tableNodes(options2) { + const extraAttrs = options2.cellAttributes || {}; + const cellAttrs = { + colspan: { default: 1 }, + rowspan: { default: 1 }, + colwidth: { default: null } + }; + for (const prop in extraAttrs) + cellAttrs[prop] = { default: extraAttrs[prop].default }; + return { + table: { + content: "table_row+", + tableRole: "table", + isolating: true, + group: options2.tableGroup, + parseDOM: [{ tag: "table" }], + toDOM() { + return ["table", ["tbody", 0]]; + } + }, + table_row: { + content: "(table_cell | table_header)*", + tableRole: "row", + parseDOM: [{ tag: "tr" }], + toDOM() { + return ["tr", 0]; + } + }, + table_cell: { + content: options2.cellContent, + attrs: cellAttrs, + tableRole: "cell", + isolating: true, + parseDOM: [ + { tag: "td", getAttrs: (dom) => getCellAttrs(dom, extraAttrs) } + ], + toDOM(node2) { + return ["td", setCellAttrs(node2, extraAttrs), 0]; + } + }, + table_header: { + content: options2.cellContent, + attrs: cellAttrs, + tableRole: "header_cell", + isolating: true, + parseDOM: [ + { tag: "th", getAttrs: (dom) => getCellAttrs(dom, extraAttrs) } + ], + toDOM(node2) { + return ["th", setCellAttrs(node2, extraAttrs), 0]; + } + } + }; + } + function tableNodeTypes(schema) { + let result = schema.cached.tableNodeTypes; + if (!result) { + result = schema.cached.tableNodeTypes = {}; + for (const name in schema.nodes) { + const type = schema.nodes[name], role = type.spec.tableRole; + if (role) + result[role] = type; + } + } + return result; + } + var tableEditingKey = new PluginKey("selectingCells"); + function cellAround($pos) { + for (let d6 = $pos.depth - 1; d6 > 0; d6--) + if ($pos.node(d6).type.spec.tableRole == "row") + return $pos.node(0).resolve($pos.before(d6 + 1)); + return null; + } + function isInTable(state) { + const $head = state.selection.$head; + for (let d6 = $head.depth; d6 > 0; d6--) + if ($head.node(d6).type.spec.tableRole == "row") + return true; + return false; + } + function selectionCell(state) { + const sel = state.selection; + if ("$anchorCell" in sel && sel.$anchorCell) { + return sel.$anchorCell.pos > sel.$headCell.pos ? sel.$anchorCell : sel.$headCell; + } else if ("node" in sel && sel.node && sel.node.type.spec.tableRole == "cell") { + return sel.$anchor; + } + const $cell = cellAround(sel.$head) || cellNear(sel.$head); + if ($cell) { + return $cell; + } + throw new RangeError(`No cell found around position ${sel.head}`); + } + function cellNear($pos) { + for (let after = $pos.nodeAfter, pos = $pos.pos; after; after = after.firstChild, pos++) { + const role = after.type.spec.tableRole; + if (role == "cell" || role == "header_cell") + return $pos.doc.resolve(pos); + } + for (let before = $pos.nodeBefore, pos = $pos.pos; before; before = before.lastChild, pos--) { + const role = before.type.spec.tableRole; + if (role == "cell" || role == "header_cell") + return $pos.doc.resolve(pos - before.nodeSize); + } + } + function pointsAtCell($pos) { + return $pos.parent.type.spec.tableRole == "row" && !!$pos.nodeAfter; + } + function moveCellForward($pos) { + return $pos.node(0).resolve($pos.pos + $pos.nodeAfter.nodeSize); + } + function inSameTable($cellA, $cellB) { + return $cellA.depth == $cellB.depth && $cellA.pos >= $cellB.start(-1) && $cellA.pos <= $cellB.end(-1); + } + function nextCell($pos, axis, dir) { + const table = $pos.node(-1); + const map5 = TableMap.get(table); + const tableStart = $pos.start(-1); + const moved = map5.nextCell($pos.pos - tableStart, axis, dir); + return moved == null ? null : $pos.node(0).resolve(tableStart + moved); + } + function removeColSpan(attrs, pos, n4 = 1) { + const result = __spreadProps(__spreadValues({}, attrs), { colspan: attrs.colspan - n4 }); + if (result.colwidth) { + result.colwidth = result.colwidth.slice(); + result.colwidth.splice(pos, n4); + if (!result.colwidth.some((w7) => w7 > 0)) + result.colwidth = null; + } + return result; + } + function addColSpan(attrs, pos, n4 = 1) { + const result = __spreadProps(__spreadValues({}, attrs), { colspan: attrs.colspan + n4 }); + if (result.colwidth) { + result.colwidth = result.colwidth.slice(); + for (let i2 = 0; i2 < n4; i2++) + result.colwidth.splice(pos, 0, 0); + } + return result; + } + function columnIsHeader(map5, table, col) { + const headerCell = tableNodeTypes(table.type.schema).header_cell; + for (let row = 0; row < map5.height; row++) + if (table.nodeAt(map5.map[col + row * map5.width]).type != headerCell) + return false; + return true; + } + var CellSelection = class _CellSelection extends Selection { + // A table selection is identified by its anchor and head cells. The + // positions given to this constructor should point _before_ two + // cells in the same table. They may be the same, to select a single + // cell. + constructor($anchorCell, $headCell = $anchorCell) { + const table = $anchorCell.node(-1); + const map5 = TableMap.get(table); + const tableStart = $anchorCell.start(-1); + const rect = map5.rectBetween( + $anchorCell.pos - tableStart, + $headCell.pos - tableStart + ); + const doc4 = $anchorCell.node(0); + const cells = map5.cellsInRect(rect).filter((p4) => p4 != $headCell.pos - tableStart); + cells.unshift($headCell.pos - tableStart); + const ranges = cells.map((pos) => { + const cell = table.nodeAt(pos); + if (!cell) { + throw RangeError(`No cell with offset ${pos} found`); + } + const from = tableStart + pos + 1; + return new SelectionRange( + doc4.resolve(from), + doc4.resolve(from + cell.content.size) + ); + }); + super(ranges[0].$from, ranges[0].$to, ranges); + this.$anchorCell = $anchorCell; + this.$headCell = $headCell; + } + map(doc4, mapping) { + const $anchorCell = doc4.resolve(mapping.map(this.$anchorCell.pos)); + const $headCell = doc4.resolve(mapping.map(this.$headCell.pos)); + if (pointsAtCell($anchorCell) && pointsAtCell($headCell) && inSameTable($anchorCell, $headCell)) { + const tableChanged = this.$anchorCell.node(-1) != $anchorCell.node(-1); + if (tableChanged && this.isRowSelection()) + return _CellSelection.rowSelection($anchorCell, $headCell); + else if (tableChanged && this.isColSelection()) + return _CellSelection.colSelection($anchorCell, $headCell); + else + return new _CellSelection($anchorCell, $headCell); + } + return TextSelection.between($anchorCell, $headCell); + } + // Returns a rectangular slice of table rows containing the selected + // cells. + content() { + const table = this.$anchorCell.node(-1); + const map5 = TableMap.get(table); + const tableStart = this.$anchorCell.start(-1); + const rect = map5.rectBetween( + this.$anchorCell.pos - tableStart, + this.$headCell.pos - tableStart + ); + const seen = {}; + const rows = []; + for (let row = rect.top; row < rect.bottom; row++) { + const rowContent = []; + for (let index2 = row * map5.width + rect.left, col = rect.left; col < rect.right; col++, index2++) { + const pos = map5.map[index2]; + if (seen[pos]) + continue; + seen[pos] = true; + const cellRect = map5.findCell(pos); + let cell = table.nodeAt(pos); + if (!cell) { + throw RangeError(`No cell with offset ${pos} found`); + } + const extraLeft = rect.left - cellRect.left; + const extraRight = cellRect.right - rect.right; + if (extraLeft > 0 || extraRight > 0) { + let attrs = cell.attrs; + if (extraLeft > 0) { + attrs = removeColSpan(attrs, 0, extraLeft); + } + if (extraRight > 0) { + attrs = removeColSpan( + attrs, + attrs.colspan - extraRight, + extraRight + ); + } + if (cellRect.left < rect.left) { + cell = cell.type.createAndFill(attrs); + if (!cell) { + throw RangeError( + `Could not create cell with attrs ${JSON.stringify(attrs)}` + ); + } + } else { + cell = cell.type.create(attrs, cell.content); + } + } + if (cellRect.top < rect.top || cellRect.bottom > rect.bottom) { + const attrs = __spreadProps(__spreadValues({}, cell.attrs), { + rowspan: Math.min(cellRect.bottom, rect.bottom) - Math.max(cellRect.top, rect.top) + }); + if (cellRect.top < rect.top) { + cell = cell.type.createAndFill(attrs); + } else { + cell = cell.type.create(attrs, cell.content); + } + } + rowContent.push(cell); + } + rows.push(table.child(row).copy(Fragment.from(rowContent))); + } + const fragment = this.isColSelection() && this.isRowSelection() ? table : rows; + return new Slice(Fragment.from(fragment), 1, 1); + } + replace(tr, content3 = Slice.empty) { + const mapFrom = tr.steps.length, ranges = this.ranges; + for (let i2 = 0; i2 < ranges.length; i2++) { + const { $from, $to } = ranges[i2], mapping = tr.mapping.slice(mapFrom); + tr.replace( + mapping.map($from.pos), + mapping.map($to.pos), + i2 ? Slice.empty : content3 + ); + } + const sel = Selection.findFrom( + tr.doc.resolve(tr.mapping.slice(mapFrom).map(this.to)), + -1 + ); + if (sel) + tr.setSelection(sel); + } + replaceWith(tr, node2) { + this.replace(tr, new Slice(Fragment.from(node2), 0, 0)); + } + forEachCell(f3) { + const table = this.$anchorCell.node(-1); + const map5 = TableMap.get(table); + const tableStart = this.$anchorCell.start(-1); + const cells = map5.cellsInRect( + map5.rectBetween( + this.$anchorCell.pos - tableStart, + this.$headCell.pos - tableStart + ) + ); + for (let i2 = 0; i2 < cells.length; i2++) { + f3(table.nodeAt(cells[i2]), tableStart + cells[i2]); + } + } + // True if this selection goes all the way from the top to the + // bottom of the table. + isColSelection() { + const anchorTop = this.$anchorCell.index(-1); + const headTop = this.$headCell.index(-1); + if (Math.min(anchorTop, headTop) > 0) + return false; + const anchorBottom = anchorTop + this.$anchorCell.nodeAfter.attrs.rowspan; + const headBottom = headTop + this.$headCell.nodeAfter.attrs.rowspan; + return Math.max(anchorBottom, headBottom) == this.$headCell.node(-1).childCount; + } + // Returns the smallest column selection that covers the given anchor + // and head cell. + static colSelection($anchorCell, $headCell = $anchorCell) { + const table = $anchorCell.node(-1); + const map5 = TableMap.get(table); + const tableStart = $anchorCell.start(-1); + const anchorRect = map5.findCell($anchorCell.pos - tableStart); + const headRect = map5.findCell($headCell.pos - tableStart); + const doc4 = $anchorCell.node(0); + if (anchorRect.top <= headRect.top) { + if (anchorRect.top > 0) + $anchorCell = doc4.resolve(tableStart + map5.map[anchorRect.left]); + if (headRect.bottom < map5.height) + $headCell = doc4.resolve( + tableStart + map5.map[map5.width * (map5.height - 1) + headRect.right - 1] + ); + } else { + if (headRect.top > 0) + $headCell = doc4.resolve(tableStart + map5.map[headRect.left]); + if (anchorRect.bottom < map5.height) + $anchorCell = doc4.resolve( + tableStart + map5.map[map5.width * (map5.height - 1) + anchorRect.right - 1] + ); + } + return new _CellSelection($anchorCell, $headCell); + } + // True if this selection goes all the way from the left to the + // right of the table. + isRowSelection() { + const table = this.$anchorCell.node(-1); + const map5 = TableMap.get(table); + const tableStart = this.$anchorCell.start(-1); + const anchorLeft = map5.colCount(this.$anchorCell.pos - tableStart); + const headLeft = map5.colCount(this.$headCell.pos - tableStart); + if (Math.min(anchorLeft, headLeft) > 0) + return false; + const anchorRight = anchorLeft + this.$anchorCell.nodeAfter.attrs.colspan; + const headRight = headLeft + this.$headCell.nodeAfter.attrs.colspan; + return Math.max(anchorRight, headRight) == map5.width; + } + eq(other) { + return other instanceof _CellSelection && other.$anchorCell.pos == this.$anchorCell.pos && other.$headCell.pos == this.$headCell.pos; + } + // Returns the smallest row selection that covers the given anchor + // and head cell. + static rowSelection($anchorCell, $headCell = $anchorCell) { + const table = $anchorCell.node(-1); + const map5 = TableMap.get(table); + const tableStart = $anchorCell.start(-1); + const anchorRect = map5.findCell($anchorCell.pos - tableStart); + const headRect = map5.findCell($headCell.pos - tableStart); + const doc4 = $anchorCell.node(0); + if (anchorRect.left <= headRect.left) { + if (anchorRect.left > 0) + $anchorCell = doc4.resolve( + tableStart + map5.map[anchorRect.top * map5.width] + ); + if (headRect.right < map5.width) + $headCell = doc4.resolve( + tableStart + map5.map[map5.width * (headRect.top + 1) - 1] + ); + } else { + if (headRect.left > 0) + $headCell = doc4.resolve(tableStart + map5.map[headRect.top * map5.width]); + if (anchorRect.right < map5.width) + $anchorCell = doc4.resolve( + tableStart + map5.map[map5.width * (anchorRect.top + 1) - 1] + ); + } + return new _CellSelection($anchorCell, $headCell); + } + toJSON() { + return { + type: "cell", + anchor: this.$anchorCell.pos, + head: this.$headCell.pos + }; + } + static fromJSON(doc4, json) { + return new _CellSelection(doc4.resolve(json.anchor), doc4.resolve(json.head)); + } + static create(doc4, anchorCell, headCell = anchorCell) { + return new _CellSelection(doc4.resolve(anchorCell), doc4.resolve(headCell)); + } + getBookmark() { + return new CellBookmark(this.$anchorCell.pos, this.$headCell.pos); + } + }; + CellSelection.prototype.visible = false; + Selection.jsonID("cell", CellSelection); + var CellBookmark = class _CellBookmark { + constructor(anchor, head) { + this.anchor = anchor; + this.head = head; + } + map(mapping) { + return new _CellBookmark(mapping.map(this.anchor), mapping.map(this.head)); + } + resolve(doc4) { + const $anchorCell = doc4.resolve(this.anchor), $headCell = doc4.resolve(this.head); + if ($anchorCell.parent.type.spec.tableRole == "row" && $headCell.parent.type.spec.tableRole == "row" && $anchorCell.index() < $anchorCell.parent.childCount && $headCell.index() < $headCell.parent.childCount && inSameTable($anchorCell, $headCell)) + return new CellSelection($anchorCell, $headCell); + else + return Selection.near($headCell, 1); + } + }; + function drawCellSelection(state) { + if (!(state.selection instanceof CellSelection)) + return null; + const cells = []; + state.selection.forEachCell((node2, pos) => { + cells.push( + Decoration.node(pos, pos + node2.nodeSize, { class: "selectedCell" }) + ); + }); + return DecorationSet.create(state.doc, cells); + } + function isCellBoundarySelection({ $from, $to }) { + if ($from.pos == $to.pos || $from.pos < $from.pos - 6) + return false; + let afterFrom = $from.pos; + let beforeTo = $to.pos; + let depth = $from.depth; + for (; depth >= 0; depth--, afterFrom++) + if ($from.after(depth + 1) < $from.end(depth)) + break; + for (let d6 = $to.depth; d6 >= 0; d6--, beforeTo--) + if ($to.before(d6 + 1) > $to.start(d6)) + break; + return afterFrom == beforeTo && /row|table/.test($from.node(depth).type.spec.tableRole); + } + function isTextSelectionAcrossCells({ $from, $to }) { + let fromCellBoundaryNode; + let toCellBoundaryNode; + for (let i2 = $from.depth; i2 > 0; i2--) { + const node2 = $from.node(i2); + if (node2.type.spec.tableRole === "cell" || node2.type.spec.tableRole === "header_cell") { + fromCellBoundaryNode = node2; + break; + } + } + for (let i2 = $to.depth; i2 > 0; i2--) { + const node2 = $to.node(i2); + if (node2.type.spec.tableRole === "cell" || node2.type.spec.tableRole === "header_cell") { + toCellBoundaryNode = node2; + break; + } + } + return fromCellBoundaryNode !== toCellBoundaryNode && $to.parentOffset === 0; + } + function normalizeSelection(state, tr, allowTableNodeSelection) { + const sel = (tr || state).selection; + const doc4 = (tr || state).doc; + let normalize3; + let role; + if (sel instanceof NodeSelection && (role = sel.node.type.spec.tableRole)) { + if (role == "cell" || role == "header_cell") { + normalize3 = CellSelection.create(doc4, sel.from); + } else if (role == "row") { + const $cell = doc4.resolve(sel.from + 1); + normalize3 = CellSelection.rowSelection($cell, $cell); + } else if (!allowTableNodeSelection) { + const map5 = TableMap.get(sel.node); + const start = sel.from + 1; + const lastCell = start + map5.map[map5.width * map5.height - 1]; + normalize3 = CellSelection.create(doc4, start + 1, lastCell); + } + } else if (sel instanceof TextSelection && isCellBoundarySelection(sel)) { + normalize3 = TextSelection.create(doc4, sel.from); + } else if (sel instanceof TextSelection && isTextSelectionAcrossCells(sel)) { + normalize3 = TextSelection.create(doc4, sel.$from.start(), sel.$from.end()); + } + if (normalize3) + (tr || (tr = state.tr)).setSelection(normalize3); + return tr; + } + var fixTablesKey = new PluginKey("fix-tables"); + function changedDescendants(old, cur, offset, f3) { + const oldSize = old.childCount, curSize = cur.childCount; + outer: + for (let i2 = 0, j6 = 0; i2 < curSize; i2++) { + const child = cur.child(i2); + for (let scan = j6, e2 = Math.min(oldSize, i2 + 3); scan < e2; scan++) { + if (old.child(scan) == child) { + j6 = scan + 1; + offset += child.nodeSize; + continue outer; + } + } + f3(child, offset); + if (j6 < oldSize && old.child(j6).sameMarkup(child)) + changedDescendants(old.child(j6), child, offset + 1, f3); + else + child.nodesBetween(0, child.content.size, f3, offset + 1); + offset += child.nodeSize; + } + } + function fixTables(state, oldState) { + let tr; + const check = (node2, pos) => { + if (node2.type.spec.tableRole == "table") + tr = fixTable(state, node2, pos, tr); + }; + if (!oldState) + state.doc.descendants(check); + else if (oldState.doc != state.doc) + changedDescendants(oldState.doc, state.doc, 0, check); + return tr; + } + function fixTable(state, table, tablePos, tr) { + const map5 = TableMap.get(table); + if (!map5.problems) + return tr; + if (!tr) + tr = state.tr; + const mustAdd = []; + for (let i2 = 0; i2 < map5.height; i2++) + mustAdd.push(0); + for (let i2 = 0; i2 < map5.problems.length; i2++) { + const prob = map5.problems[i2]; + if (prob.type == "collision") { + const cell = table.nodeAt(prob.pos); + if (!cell) + continue; + const attrs = cell.attrs; + for (let j6 = 0; j6 < attrs.rowspan; j6++) + mustAdd[prob.row + j6] += prob.n; + tr.setNodeMarkup( + tr.mapping.map(tablePos + 1 + prob.pos), + null, + removeColSpan(attrs, attrs.colspan - prob.n, prob.n) + ); + } else if (prob.type == "missing") { + mustAdd[prob.row] += prob.n; + } else if (prob.type == "overlong_rowspan") { + const cell = table.nodeAt(prob.pos); + if (!cell) + continue; + tr.setNodeMarkup(tr.mapping.map(tablePos + 1 + prob.pos), null, __spreadProps(__spreadValues({}, cell.attrs), { + rowspan: cell.attrs.rowspan - prob.n + })); + } else if (prob.type == "colwidth mismatch") { + const cell = table.nodeAt(prob.pos); + if (!cell) + continue; + tr.setNodeMarkup(tr.mapping.map(tablePos + 1 + prob.pos), null, __spreadProps(__spreadValues({}, cell.attrs), { + colwidth: prob.colwidth + })); + } + } + let first, last; + for (let i2 = 0; i2 < mustAdd.length; i2++) + if (mustAdd[i2]) { + if (first == null) + first = i2; + last = i2; + } + for (let i2 = 0, pos = tablePos + 1; i2 < map5.height; i2++) { + const row = table.child(i2); + const end = pos + row.nodeSize; + const add = mustAdd[i2]; + if (add > 0) { + let role = "cell"; + if (row.firstChild) { + role = row.firstChild.type.spec.tableRole; + } + const nodes = []; + for (let j6 = 0; j6 < add; j6++) { + const node2 = tableNodeTypes(state.schema)[role].createAndFill(); + if (node2) + nodes.push(node2); + } + const side = (i2 == 0 || first == i2 - 1) && last == i2 ? pos + 1 : end - 1; + tr.insert(tr.mapping.map(side), nodes); + } + pos = end; + } + return tr.setMeta(fixTablesKey, { fixTables: true }); + } + function pastedCells(slice) { + if (!slice.size) + return null; + let { content: content3, openStart, openEnd } = slice; + while (content3.childCount == 1 && (openStart > 0 && openEnd > 0 || content3.child(0).type.spec.tableRole == "table")) { + openStart--; + openEnd--; + content3 = content3.child(0).content; + } + const first = content3.child(0); + const role = first.type.spec.tableRole; + const schema = first.type.schema, rows = []; + if (role == "row") { + for (let i2 = 0; i2 < content3.childCount; i2++) { + let cells = content3.child(i2).content; + const left = i2 ? 0 : Math.max(0, openStart - 1); + const right = i2 < content3.childCount - 1 ? 0 : Math.max(0, openEnd - 1); + if (left || right) + cells = fitSlice( + tableNodeTypes(schema).row, + new Slice(cells, left, right) + ).content; + rows.push(cells); + } + } else if (role == "cell" || role == "header_cell") { + rows.push( + openStart || openEnd ? fitSlice( + tableNodeTypes(schema).row, + new Slice(content3, openStart, openEnd) + ).content : content3 + ); + } else { + return null; + } + return ensureRectangular(schema, rows); + } + function ensureRectangular(schema, rows) { + const widths = []; + for (let i2 = 0; i2 < rows.length; i2++) { + const row = rows[i2]; + for (let j6 = row.childCount - 1; j6 >= 0; j6--) { + const { rowspan, colspan } = row.child(j6).attrs; + for (let r3 = i2; r3 < i2 + rowspan; r3++) + widths[r3] = (widths[r3] || 0) + colspan; + } + } + let width = 0; + for (let r3 = 0; r3 < widths.length; r3++) + width = Math.max(width, widths[r3]); + for (let r3 = 0; r3 < widths.length; r3++) { + if (r3 >= rows.length) + rows.push(Fragment.empty); + if (widths[r3] < width) { + const empty3 = tableNodeTypes(schema).cell.createAndFill(); + const cells = []; + for (let i2 = widths[r3]; i2 < width; i2++) { + cells.push(empty3); + } + rows[r3] = rows[r3].append(Fragment.from(cells)); + } + } + return { height: rows.length, width, rows }; + } + function fitSlice(nodeType, slice) { + const node2 = nodeType.createAndFill(); + const tr = new Transform(node2).replace(0, node2.content.size, slice); + return tr.doc; + } + function clipCells({ width, height, rows }, newWidth, newHeight) { + if (width != newWidth) { + const added = []; + const newRows = []; + for (let row = 0; row < rows.length; row++) { + const frag = rows[row], cells = []; + for (let col = added[row] || 0, i2 = 0; col < newWidth; i2++) { + let cell = frag.child(i2 % frag.childCount); + if (col + cell.attrs.colspan > newWidth) + cell = cell.type.createChecked( + removeColSpan( + cell.attrs, + cell.attrs.colspan, + col + cell.attrs.colspan - newWidth + ), + cell.content + ); + cells.push(cell); + col += cell.attrs.colspan; + for (let j6 = 1; j6 < cell.attrs.rowspan; j6++) + added[row + j6] = (added[row + j6] || 0) + cell.attrs.colspan; + } + newRows.push(Fragment.from(cells)); + } + rows = newRows; + width = newWidth; + } + if (height != newHeight) { + const newRows = []; + for (let row = 0, i2 = 0; row < newHeight; row++, i2++) { + const cells = [], source = rows[i2 % height]; + for (let j6 = 0; j6 < source.childCount; j6++) { + let cell = source.child(j6); + if (row + cell.attrs.rowspan > newHeight) + cell = cell.type.create( + __spreadProps(__spreadValues({}, cell.attrs), { + rowspan: Math.max(1, newHeight - cell.attrs.rowspan) + }), + cell.content + ); + cells.push(cell); + } + newRows.push(Fragment.from(cells)); + } + rows = newRows; + height = newHeight; + } + return { width, height, rows }; + } + function growTable(tr, map5, table, start, width, height, mapFrom) { + const schema = tr.doc.type.schema; + const types = tableNodeTypes(schema); + let empty3; + let emptyHead; + if (width > map5.width) { + for (let row = 0, rowEnd = 0; row < map5.height; row++) { + const rowNode = table.child(row); + rowEnd += rowNode.nodeSize; + const cells = []; + let add; + if (rowNode.lastChild == null || rowNode.lastChild.type == types.cell) + add = empty3 || (empty3 = types.cell.createAndFill()); + else + add = emptyHead || (emptyHead = types.header_cell.createAndFill()); + for (let i2 = map5.width; i2 < width; i2++) + cells.push(add); + tr.insert(tr.mapping.slice(mapFrom).map(rowEnd - 1 + start), cells); + } + } + if (height > map5.height) { + const cells = []; + for (let i2 = 0, start2 = (map5.height - 1) * map5.width; i2 < Math.max(map5.width, width); i2++) { + const header = i2 >= map5.width ? false : table.nodeAt(map5.map[start2 + i2]).type == types.header_cell; + cells.push( + header ? emptyHead || (emptyHead = types.header_cell.createAndFill()) : empty3 || (empty3 = types.cell.createAndFill()) + ); + } + const emptyRow = types.row.create(null, Fragment.from(cells)), rows = []; + for (let i2 = map5.height; i2 < height; i2++) + rows.push(emptyRow); + tr.insert(tr.mapping.slice(mapFrom).map(start + table.nodeSize - 2), rows); + } + return !!(empty3 || emptyHead); + } + function isolateHorizontal(tr, map5, table, start, left, right, top, mapFrom) { + if (top == 0 || top == map5.height) + return false; + let found2 = false; + for (let col = left; col < right; col++) { + const index2 = top * map5.width + col, pos = map5.map[index2]; + if (map5.map[index2 - map5.width] == pos) { + found2 = true; + const cell = table.nodeAt(pos); + const { top: cellTop, left: cellLeft } = map5.findCell(pos); + tr.setNodeMarkup(tr.mapping.slice(mapFrom).map(pos + start), null, __spreadProps(__spreadValues({}, cell.attrs), { + rowspan: top - cellTop + })); + tr.insert( + tr.mapping.slice(mapFrom).map(map5.positionAt(top, cellLeft, table)), + cell.type.createAndFill(__spreadProps(__spreadValues({}, cell.attrs), { + rowspan: cellTop + cell.attrs.rowspan - top + })) + ); + col += cell.attrs.colspan - 1; + } + } + return found2; + } + function isolateVertical(tr, map5, table, start, top, bottom, left, mapFrom) { + if (left == 0 || left == map5.width) + return false; + let found2 = false; + for (let row = top; row < bottom; row++) { + const index2 = row * map5.width + left, pos = map5.map[index2]; + if (map5.map[index2 - 1] == pos) { + found2 = true; + const cell = table.nodeAt(pos); + const cellLeft = map5.colCount(pos); + const updatePos = tr.mapping.slice(mapFrom).map(pos + start); + tr.setNodeMarkup( + updatePos, + null, + removeColSpan( + cell.attrs, + left - cellLeft, + cell.attrs.colspan - (left - cellLeft) + ) + ); + tr.insert( + updatePos + cell.nodeSize, + cell.type.createAndFill( + removeColSpan(cell.attrs, 0, left - cellLeft) + ) + ); + row += cell.attrs.rowspan - 1; + } + } + return found2; + } + function insertCells(state, dispatch, tableStart, rect, cells) { + let table = tableStart ? state.doc.nodeAt(tableStart - 1) : state.doc; + if (!table) { + throw new Error("No table found"); + } + let map5 = TableMap.get(table); + const { top, left } = rect; + const right = left + cells.width, bottom = top + cells.height; + const tr = state.tr; + let mapFrom = 0; + function recomp() { + table = tableStart ? tr.doc.nodeAt(tableStart - 1) : tr.doc; + if (!table) { + throw new Error("No table found"); + } + map5 = TableMap.get(table); + mapFrom = tr.mapping.maps.length; + } + if (growTable(tr, map5, table, tableStart, right, bottom, mapFrom)) + recomp(); + if (isolateHorizontal(tr, map5, table, tableStart, left, right, top, mapFrom)) + recomp(); + if (isolateHorizontal(tr, map5, table, tableStart, left, right, bottom, mapFrom)) + recomp(); + if (isolateVertical(tr, map5, table, tableStart, top, bottom, left, mapFrom)) + recomp(); + if (isolateVertical(tr, map5, table, tableStart, top, bottom, right, mapFrom)) + recomp(); + for (let row = top; row < bottom; row++) { + const from = map5.positionAt(row, left, table), to = map5.positionAt(row, right, table); + tr.replace( + tr.mapping.slice(mapFrom).map(from + tableStart), + tr.mapping.slice(mapFrom).map(to + tableStart), + new Slice(cells.rows[row - top], 0, 0) + ); + } + recomp(); + tr.setSelection( + new CellSelection( + tr.doc.resolve(tableStart + map5.positionAt(top, left, table)), + tr.doc.resolve(tableStart + map5.positionAt(bottom - 1, right - 1, table)) + ) + ); + dispatch(tr); + } + var handleKeyDown = keydownHandler({ + ArrowLeft: arrow("horiz", -1), + ArrowRight: arrow("horiz", 1), + ArrowUp: arrow("vert", -1), + ArrowDown: arrow("vert", 1), + "Shift-ArrowLeft": shiftArrow("horiz", -1), + "Shift-ArrowRight": shiftArrow("horiz", 1), + "Shift-ArrowUp": shiftArrow("vert", -1), + "Shift-ArrowDown": shiftArrow("vert", 1), + Backspace: deleteCellSelection, + "Mod-Backspace": deleteCellSelection, + Delete: deleteCellSelection, + "Mod-Delete": deleteCellSelection + }); + function maybeSetSelection(state, dispatch, selection) { + if (selection.eq(state.selection)) + return false; + if (dispatch) + dispatch(state.tr.setSelection(selection).scrollIntoView()); + return true; + } + function arrow(axis, dir) { + return (state, dispatch, view) => { + if (!view) + return false; + const sel = state.selection; + if (sel instanceof CellSelection) { + return maybeSetSelection( + state, + dispatch, + Selection.near(sel.$headCell, dir) + ); + } + if (axis != "horiz" && !sel.empty) + return false; + const end = atEndOfCell(view, axis, dir); + if (end == null) + return false; + if (axis == "horiz") { + return maybeSetSelection( + state, + dispatch, + Selection.near(state.doc.resolve(sel.head + dir), dir) + ); + } else { + const $cell = state.doc.resolve(end); + const $next = nextCell($cell, axis, dir); + let newSel; + if ($next) + newSel = Selection.near($next, 1); + else if (dir < 0) + newSel = Selection.near(state.doc.resolve($cell.before(-1)), -1); + else + newSel = Selection.near(state.doc.resolve($cell.after(-1)), 1); + return maybeSetSelection(state, dispatch, newSel); + } + }; + } + function shiftArrow(axis, dir) { + return (state, dispatch, view) => { + if (!view) + return false; + const sel = state.selection; + let cellSel; + if (sel instanceof CellSelection) { + cellSel = sel; + } else { + const end = atEndOfCell(view, axis, dir); + if (end == null) + return false; + cellSel = new CellSelection(state.doc.resolve(end)); + } + const $head = nextCell(cellSel.$headCell, axis, dir); + if (!$head) + return false; + return maybeSetSelection( + state, + dispatch, + new CellSelection(cellSel.$anchorCell, $head) + ); + }; + } + function deleteCellSelection(state, dispatch) { + const sel = state.selection; + if (!(sel instanceof CellSelection)) + return false; + if (dispatch) { + const tr = state.tr; + const baseContent = tableNodeTypes(state.schema).cell.createAndFill().content; + sel.forEachCell((cell, pos) => { + if (!cell.content.eq(baseContent)) + tr.replace( + tr.mapping.map(pos + 1), + tr.mapping.map(pos + cell.nodeSize - 1), + new Slice(baseContent, 0, 0) + ); + }); + if (tr.docChanged) + dispatch(tr); + } + return true; + } + function handleTripleClick2(view, pos) { + const doc4 = view.state.doc, $cell = cellAround(doc4.resolve(pos)); + if (!$cell) + return false; + view.dispatch(view.state.tr.setSelection(new CellSelection($cell))); + return true; + } + function handlePaste(view, _3, slice) { + if (!isInTable(view.state)) + return false; + let cells = pastedCells(slice); + const sel = view.state.selection; + if (sel instanceof CellSelection) { + if (!cells) + cells = { + width: 1, + height: 1, + rows: [ + Fragment.from( + fitSlice(tableNodeTypes(view.state.schema).cell, slice) + ) + ] + }; + const table = sel.$anchorCell.node(-1); + const start = sel.$anchorCell.start(-1); + const rect = TableMap.get(table).rectBetween( + sel.$anchorCell.pos - start, + sel.$headCell.pos - start + ); + cells = clipCells(cells, rect.right - rect.left, rect.bottom - rect.top); + insertCells(view.state, view.dispatch, start, rect, cells); + return true; + } else if (cells) { + const $cell = selectionCell(view.state); + const start = $cell.start(-1); + insertCells( + view.state, + view.dispatch, + start, + TableMap.get($cell.node(-1)).findCell($cell.pos - start), + cells + ); + return true; + } else { + return false; + } + } + function handleMouseDown(view, startEvent) { + var _a; + if (startEvent.ctrlKey || startEvent.metaKey) + return; + const startDOMCell = domInCell(view, startEvent.target); + let $anchor; + if (startEvent.shiftKey && view.state.selection instanceof CellSelection) { + setCellSelection(view.state.selection.$anchorCell, startEvent); + startEvent.preventDefault(); + } else if (startEvent.shiftKey && startDOMCell && ($anchor = cellAround(view.state.selection.$anchor)) != null && ((_a = cellUnderMouse(view, startEvent)) == null ? void 0 : _a.pos) != $anchor.pos) { + setCellSelection($anchor, startEvent); + startEvent.preventDefault(); + } else if (!startDOMCell) { + return; + } + function setCellSelection($anchor2, event) { + let $head = cellUnderMouse(view, event); + const starting = tableEditingKey.getState(view.state) == null; + if (!$head || !inSameTable($anchor2, $head)) { + if (starting) + $head = $anchor2; + else + return; + } + const selection = new CellSelection($anchor2, $head); + if (starting || !view.state.selection.eq(selection)) { + const tr = view.state.tr.setSelection(selection); + if (starting) + tr.setMeta(tableEditingKey, $anchor2.pos); + view.dispatch(tr); + } + } + function stop() { + view.root.removeEventListener("mouseup", stop); + view.root.removeEventListener("dragstart", stop); + view.root.removeEventListener("mousemove", move); + if (tableEditingKey.getState(view.state) != null) + view.dispatch(view.state.tr.setMeta(tableEditingKey, -1)); + } + function move(_event) { + const event = _event; + const anchor = tableEditingKey.getState(view.state); + let $anchor2; + if (anchor != null) { + $anchor2 = view.state.doc.resolve(anchor); + } else if (domInCell(view, event.target) != startDOMCell) { + $anchor2 = cellUnderMouse(view, startEvent); + if (!$anchor2) + return stop(); + } + if ($anchor2) + setCellSelection($anchor2, event); + } + view.root.addEventListener("mouseup", stop); + view.root.addEventListener("dragstart", stop); + view.root.addEventListener("mousemove", move); + } + function atEndOfCell(view, axis, dir) { + if (!(view.state.selection instanceof TextSelection)) + return null; + const { $head } = view.state.selection; + for (let d6 = $head.depth - 1; d6 >= 0; d6--) { + const parent = $head.node(d6), index2 = dir < 0 ? $head.index(d6) : $head.indexAfter(d6); + if (index2 != (dir < 0 ? 0 : parent.childCount)) + return null; + if (parent.type.spec.tableRole == "cell" || parent.type.spec.tableRole == "header_cell") { + const cellPos = $head.before(d6); + const dirStr = axis == "vert" ? dir > 0 ? "down" : "up" : dir > 0 ? "right" : "left"; + return view.endOfTextblock(dirStr) ? cellPos : null; + } + } + return null; + } + function domInCell(view, dom) { + for (; dom && dom != view.dom; dom = dom.parentNode) { + if (dom.nodeName == "TD" || dom.nodeName == "TH") { + return dom; + } + } + return null; + } + function cellUnderMouse(view, event) { + const mousePos = view.posAtCoords({ + left: event.clientX, + top: event.clientY + }); + if (!mousePos) + return null; + return mousePos ? cellAround(view.state.doc.resolve(mousePos.pos)) : null; + } + var TableView = class { + constructor(node2, cellMinWidth) { + this.node = node2; + this.cellMinWidth = cellMinWidth; + this.dom = document.createElement("div"); + this.dom.className = "tableWrapper"; + this.table = this.dom.appendChild(document.createElement("table")); + this.colgroup = this.table.appendChild(document.createElement("colgroup")); + updateColumnsOnResize(node2, this.colgroup, this.table, cellMinWidth); + this.contentDOM = this.table.appendChild(document.createElement("tbody")); + } + update(node2) { + if (node2.type != this.node.type) + return false; + this.node = node2; + updateColumnsOnResize(node2, this.colgroup, this.table, this.cellMinWidth); + return true; + } + ignoreMutation(record) { + return record.type == "attributes" && (record.target == this.table || this.colgroup.contains(record.target)); + } + }; + function updateColumnsOnResize(node2, colgroup, table, cellMinWidth, overrideCol, overrideValue) { + var _a; + let totalWidth = 0; + let fixedWidth = true; + let nextDOM = colgroup.firstChild; + const row = node2.firstChild; + if (!row) + return; + for (let i2 = 0, col = 0; i2 < row.childCount; i2++) { + const { colspan, colwidth } = row.child(i2).attrs; + for (let j6 = 0; j6 < colspan; j6++, col++) { + const hasWidth = overrideCol == col ? overrideValue : colwidth && colwidth[j6]; + const cssWidth = hasWidth ? hasWidth + "px" : ""; + totalWidth += hasWidth || cellMinWidth; + if (!hasWidth) + fixedWidth = false; + if (!nextDOM) { + colgroup.appendChild(document.createElement("col")).style.width = cssWidth; + } else { + if (nextDOM.style.width != cssWidth) + nextDOM.style.width = cssWidth; + nextDOM = nextDOM.nextSibling; + } + } + } + while (nextDOM) { + const after = nextDOM.nextSibling; + (_a = nextDOM.parentNode) == null ? void 0 : _a.removeChild(nextDOM); + nextDOM = after; + } + if (fixedWidth) { + table.style.width = totalWidth + "px"; + table.style.minWidth = ""; + } else { + table.style.width = ""; + table.style.minWidth = totalWidth + "px"; + } + } + var columnResizingPluginKey = new PluginKey( + "tableColumnResizing" + ); + function columnResizing({ + handleWidth = 5, + cellMinWidth = 25, + View = TableView, + lastColumnResizable = true + } = {}) { + const plugin = new Plugin({ + key: columnResizingPluginKey, + state: { + init(_3, state) { + plugin.spec.props.nodeViews[tableNodeTypes(state.schema).table.name] = (node2, view) => new View(node2, cellMinWidth, view); + return new ResizeState(-1, false); + }, + apply(tr, prev) { + return prev.apply(tr); + } + }, + props: { + attributes: (state) => { + const pluginState = columnResizingPluginKey.getState(state); + return pluginState && pluginState.activeHandle > -1 ? { class: "resize-cursor" } : {}; + }, + handleDOMEvents: { + mousemove: (view, event) => { + handleMouseMove( + view, + event, + handleWidth, + cellMinWidth, + lastColumnResizable + ); + }, + mouseleave: (view) => { + handleMouseLeave(view); + }, + mousedown: (view, event) => { + handleMouseDown2(view, event, cellMinWidth); + } + }, + decorations: (state) => { + const pluginState = columnResizingPluginKey.getState(state); + if (pluginState && pluginState.activeHandle > -1) { + return handleDecorations(state, pluginState.activeHandle); + } + }, + nodeViews: {} + } + }); + return plugin; + } + var ResizeState = class _ResizeState { + constructor(activeHandle, dragging) { + this.activeHandle = activeHandle; + this.dragging = dragging; + } + apply(tr) { + const state = this; + const action = tr.getMeta(columnResizingPluginKey); + if (action && action.setHandle != null) + return new _ResizeState(action.setHandle, false); + if (action && action.setDragging !== void 0) + return new _ResizeState(state.activeHandle, action.setDragging); + if (state.activeHandle > -1 && tr.docChanged) { + let handle2 = tr.mapping.map(state.activeHandle, -1); + if (!pointsAtCell(tr.doc.resolve(handle2))) { + handle2 = -1; + } + return new _ResizeState(handle2, state.dragging); + } + return state; + } + }; + function handleMouseMove(view, event, handleWidth, cellMinWidth, lastColumnResizable) { + const pluginState = columnResizingPluginKey.getState(view.state); + if (!pluginState) + return; + if (!pluginState.dragging) { + const target = domCellAround(event.target); + let cell = -1; + if (target) { + const { left, right } = target.getBoundingClientRect(); + if (event.clientX - left <= handleWidth) + cell = edgeCell(view, event, "left", handleWidth); + else if (right - event.clientX <= handleWidth) + cell = edgeCell(view, event, "right", handleWidth); + } + if (cell != pluginState.activeHandle) { + if (!lastColumnResizable && cell !== -1) { + const $cell = view.state.doc.resolve(cell); + const table = $cell.node(-1); + const map5 = TableMap.get(table); + const tableStart = $cell.start(-1); + const col = map5.colCount($cell.pos - tableStart) + $cell.nodeAfter.attrs.colspan - 1; + if (col == map5.width - 1) { + return; + } + } + updateHandle(view, cell); + } + } + } + function handleMouseLeave(view) { + const pluginState = columnResizingPluginKey.getState(view.state); + if (pluginState && pluginState.activeHandle > -1 && !pluginState.dragging) + updateHandle(view, -1); + } + function handleMouseDown2(view, event, cellMinWidth) { + var _a; + const win = (_a = view.dom.ownerDocument.defaultView) != null ? _a : window; + const pluginState = columnResizingPluginKey.getState(view.state); + if (!pluginState || pluginState.activeHandle == -1 || pluginState.dragging) + return false; + const cell = view.state.doc.nodeAt(pluginState.activeHandle); + const width = currentColWidth(view, pluginState.activeHandle, cell.attrs); + view.dispatch( + view.state.tr.setMeta(columnResizingPluginKey, { + setDragging: { startX: event.clientX, startWidth: width } + }) + ); + function finish(event2) { + win.removeEventListener("mouseup", finish); + win.removeEventListener("mousemove", move); + const pluginState2 = columnResizingPluginKey.getState(view.state); + if (pluginState2 == null ? void 0 : pluginState2.dragging) { + updateColumnWidth( + view, + pluginState2.activeHandle, + draggedWidth(pluginState2.dragging, event2, cellMinWidth) + ); + view.dispatch( + view.state.tr.setMeta(columnResizingPluginKey, { setDragging: null }) + ); + } + } + function move(event2) { + if (!event2.which) + return finish(event2); + const pluginState2 = columnResizingPluginKey.getState(view.state); + if (!pluginState2) + return; + if (pluginState2.dragging) { + const dragged = draggedWidth(pluginState2.dragging, event2, cellMinWidth); + displayColumnWidth(view, pluginState2.activeHandle, dragged, cellMinWidth); + } + } + win.addEventListener("mouseup", finish); + win.addEventListener("mousemove", move); + event.preventDefault(); + return true; + } + function currentColWidth(view, cellPos, { colspan, colwidth }) { + const width = colwidth && colwidth[colwidth.length - 1]; + if (width) + return width; + const dom = view.domAtPos(cellPos); + const node2 = dom.node.childNodes[dom.offset]; + let domWidth = node2.offsetWidth, parts = colspan; + if (colwidth) { + for (let i2 = 0; i2 < colspan; i2++) + if (colwidth[i2]) { + domWidth -= colwidth[i2]; + parts--; + } + } + return domWidth / parts; + } + function domCellAround(target) { + while (target && target.nodeName != "TD" && target.nodeName != "TH") + target = target.classList && target.classList.contains("ProseMirror") ? null : target.parentNode; + return target; + } + function edgeCell(view, event, side, handleWidth) { + const offset = side == "right" ? -handleWidth : handleWidth; + const found2 = view.posAtCoords({ + left: event.clientX + offset, + top: event.clientY + }); + if (!found2) + return -1; + const { pos } = found2; + const $cell = cellAround(view.state.doc.resolve(pos)); + if (!$cell) + return -1; + if (side == "right") + return $cell.pos; + const map5 = TableMap.get($cell.node(-1)), start = $cell.start(-1); + const index2 = map5.map.indexOf($cell.pos - start); + return index2 % map5.width == 0 ? -1 : start + map5.map[index2 - 1]; + } + function draggedWidth(dragging, event, cellMinWidth) { + const offset = event.clientX - dragging.startX; + return Math.max(cellMinWidth, dragging.startWidth + offset); + } + function updateHandle(view, value) { + view.dispatch( + view.state.tr.setMeta(columnResizingPluginKey, { setHandle: value }) + ); + } + function updateColumnWidth(view, cell, width) { + const $cell = view.state.doc.resolve(cell); + const table = $cell.node(-1), map5 = TableMap.get(table), start = $cell.start(-1); + const col = map5.colCount($cell.pos - start) + $cell.nodeAfter.attrs.colspan - 1; + const tr = view.state.tr; + for (let row = 0; row < map5.height; row++) { + const mapIndex = row * map5.width + col; + if (row && map5.map[mapIndex] == map5.map[mapIndex - map5.width]) + continue; + const pos = map5.map[mapIndex]; + const attrs = table.nodeAt(pos).attrs; + const index2 = attrs.colspan == 1 ? 0 : col - map5.colCount(pos); + if (attrs.colwidth && attrs.colwidth[index2] == width) + continue; + const colwidth = attrs.colwidth ? attrs.colwidth.slice() : zeroes(attrs.colspan); + colwidth[index2] = width; + tr.setNodeMarkup(start + pos, null, __spreadProps(__spreadValues({}, attrs), { colwidth })); + } + if (tr.docChanged) + view.dispatch(tr); + } + function displayColumnWidth(view, cell, width, cellMinWidth) { + const $cell = view.state.doc.resolve(cell); + const table = $cell.node(-1), start = $cell.start(-1); + const col = TableMap.get(table).colCount($cell.pos - start) + $cell.nodeAfter.attrs.colspan - 1; + let dom = view.domAtPos($cell.start(-1)).node; + while (dom && dom.nodeName != "TABLE") { + dom = dom.parentNode; + } + if (!dom) + return; + updateColumnsOnResize( + table, + dom.firstChild, + dom, + cellMinWidth, + col, + width + ); + } + function zeroes(n4) { + return Array(n4).fill(0); + } + function handleDecorations(state, cell) { + const decorations = []; + const $cell = state.doc.resolve(cell); + const table = $cell.node(-1); + if (!table) { + return DecorationSet.empty; + } + const map5 = TableMap.get(table); + const start = $cell.start(-1); + const col = map5.colCount($cell.pos - start) + $cell.nodeAfter.attrs.colspan; + for (let row = 0; row < map5.height; row++) { + const index2 = col + row * map5.width - 1; + if ((col == map5.width || map5.map[index2] != map5.map[index2 + 1]) && (row == 0 || map5.map[index2] != map5.map[index2 - map5.width])) { + const cellPos = map5.map[index2]; + const pos = start + cellPos + table.nodeAt(cellPos).nodeSize - 1; + const dom = document.createElement("div"); + dom.className = "column-resize-handle"; + decorations.push(Decoration.widget(pos, dom)); + } + } + return DecorationSet.create(state.doc, decorations); + } + function selectedRect(state) { + const sel = state.selection; + const $pos = selectionCell(state); + const table = $pos.node(-1); + const tableStart = $pos.start(-1); + const map5 = TableMap.get(table); + const rect = sel instanceof CellSelection ? map5.rectBetween( + sel.$anchorCell.pos - tableStart, + sel.$headCell.pos - tableStart + ) : map5.findCell($pos.pos - tableStart); + return __spreadProps(__spreadValues({}, rect), { tableStart, map: map5, table }); + } + function addColumn(tr, { map: map5, tableStart, table }, col) { + let refColumn = col > 0 ? -1 : 0; + if (columnIsHeader(map5, table, col + refColumn)) { + refColumn = col == 0 || col == map5.width ? null : 0; + } + for (let row = 0; row < map5.height; row++) { + const index2 = row * map5.width + col; + if (col > 0 && col < map5.width && map5.map[index2 - 1] == map5.map[index2]) { + const pos = map5.map[index2]; + const cell = table.nodeAt(pos); + tr.setNodeMarkup( + tr.mapping.map(tableStart + pos), + null, + addColSpan(cell.attrs, col - map5.colCount(pos)) + ); + row += cell.attrs.rowspan - 1; + } else { + const type = refColumn == null ? tableNodeTypes(table.type.schema).cell : table.nodeAt(map5.map[index2 + refColumn]).type; + const pos = map5.positionAt(row, col, table); + tr.insert(tr.mapping.map(tableStart + pos), type.createAndFill()); + } + } + return tr; + } + function addColumnBefore(state, dispatch) { + if (!isInTable(state)) + return false; + if (dispatch) { + const rect = selectedRect(state); + dispatch(addColumn(state.tr, rect, rect.left)); + } + return true; + } + function addColumnAfter(state, dispatch) { + if (!isInTable(state)) + return false; + if (dispatch) { + const rect = selectedRect(state); + dispatch(addColumn(state.tr, rect, rect.right)); + } + return true; + } + function removeColumn(tr, { map: map5, table, tableStart }, col) { + const mapStart = tr.mapping.maps.length; + for (let row = 0; row < map5.height; ) { + const index2 = row * map5.width + col; + const pos = map5.map[index2]; + const cell = table.nodeAt(pos); + const attrs = cell.attrs; + if (col > 0 && map5.map[index2 - 1] == pos || col < map5.width - 1 && map5.map[index2 + 1] == pos) { + tr.setNodeMarkup( + tr.mapping.slice(mapStart).map(tableStart + pos), + null, + removeColSpan(attrs, col - map5.colCount(pos)) + ); + } else { + const start = tr.mapping.slice(mapStart).map(tableStart + pos); + tr.delete(start, start + cell.nodeSize); + } + row += attrs.rowspan; + } + } + function deleteColumn(state, dispatch) { + if (!isInTable(state)) + return false; + if (dispatch) { + const rect = selectedRect(state); + const tr = state.tr; + if (rect.left == 0 && rect.right == rect.map.width) + return false; + for (let i2 = rect.right - 1; ; i2--) { + removeColumn(tr, rect, i2); + if (i2 == rect.left) + break; + const table = rect.tableStart ? tr.doc.nodeAt(rect.tableStart - 1) : tr.doc; + if (!table) { + throw RangeError("No table found"); + } + rect.table = table; + rect.map = TableMap.get(table); + } + dispatch(tr); + } + return true; + } + function removeRow(tr, { map: map5, table, tableStart }, row) { + let rowPos = 0; + for (let i2 = 0; i2 < row; i2++) + rowPos += table.child(i2).nodeSize; + const nextRow = rowPos + table.child(row).nodeSize; + const mapFrom = tr.mapping.maps.length; + tr.delete(rowPos + tableStart, nextRow + tableStart); + const seen = /* @__PURE__ */ new Set(); + for (let col = 0, index2 = row * map5.width; col < map5.width; col++, index2++) { + const pos = map5.map[index2]; + if (seen.has(pos)) + continue; + seen.add(pos); + if (row > 0 && pos == map5.map[index2 - map5.width]) { + const attrs = table.nodeAt(pos).attrs; + tr.setNodeMarkup(tr.mapping.slice(mapFrom).map(pos + tableStart), null, __spreadProps(__spreadValues({}, attrs), { + rowspan: attrs.rowspan - 1 + })); + col += attrs.colspan - 1; + } else if (row < map5.height && pos == map5.map[index2 + map5.width]) { + const cell = table.nodeAt(pos); + const attrs = cell.attrs; + const copy2 = cell.type.create( + __spreadProps(__spreadValues({}, attrs), { rowspan: cell.attrs.rowspan - 1 }), + cell.content + ); + const newPos = map5.positionAt(row + 1, col, table); + tr.insert(tr.mapping.slice(mapFrom).map(tableStart + newPos), copy2); + col += attrs.colspan - 1; + } + } + } + function deleteRow(state, dispatch) { + if (!isInTable(state)) + return false; + if (dispatch) { + const rect = selectedRect(state), tr = state.tr; + if (rect.top == 0 && rect.bottom == rect.map.height) + return false; + for (let i2 = rect.bottom - 1; ; i2--) { + removeRow(tr, rect, i2); + if (i2 == rect.top) + break; + const table = rect.tableStart ? tr.doc.nodeAt(rect.tableStart - 1) : tr.doc; + if (!table) { + throw RangeError("No table found"); + } + rect.table = table; + rect.map = TableMap.get(rect.table); + } + dispatch(tr); + } + return true; + } + function setCellAttr(name, value) { + return function(state, dispatch) { + if (!isInTable(state)) + return false; + const $cell = selectionCell(state); + if ($cell.nodeAfter.attrs[name] === value) + return false; + if (dispatch) { + const tr = state.tr; + if (state.selection instanceof CellSelection) + state.selection.forEachCell((node2, pos) => { + if (node2.attrs[name] !== value) + tr.setNodeMarkup(pos, null, __spreadProps(__spreadValues({}, node2.attrs), { + [name]: value + })); + }); + else + tr.setNodeMarkup($cell.pos, null, __spreadProps(__spreadValues({}, $cell.nodeAfter.attrs), { + [name]: value + })); + dispatch(tr); + } + return true; + }; + } + function deprecated_toggleHeader(type) { + return function(state, dispatch) { + if (!isInTable(state)) + return false; + if (dispatch) { + const types = tableNodeTypes(state.schema); + const rect = selectedRect(state), tr = state.tr; + const cells = rect.map.cellsInRect( + type == "column" ? { + left: rect.left, + top: 0, + right: rect.right, + bottom: rect.map.height + } : type == "row" ? { + left: 0, + top: rect.top, + right: rect.map.width, + bottom: rect.bottom + } : rect + ); + const nodes = cells.map((pos) => rect.table.nodeAt(pos)); + for (let i2 = 0; i2 < cells.length; i2++) + if (nodes[i2].type == types.header_cell) + tr.setNodeMarkup( + rect.tableStart + cells[i2], + types.cell, + nodes[i2].attrs + ); + if (tr.steps.length == 0) + for (let i2 = 0; i2 < cells.length; i2++) + tr.setNodeMarkup( + rect.tableStart + cells[i2], + types.header_cell, + nodes[i2].attrs + ); + dispatch(tr); + } + return true; + }; + } + function isHeaderEnabledByType(type, rect, types) { + const cellPositions = rect.map.cellsInRect({ + left: 0, + top: 0, + right: type == "row" ? rect.map.width : 1, + bottom: type == "column" ? rect.map.height : 1 + }); + for (let i2 = 0; i2 < cellPositions.length; i2++) { + const cell = rect.table.nodeAt(cellPositions[i2]); + if (cell && cell.type !== types.header_cell) { + return false; + } + } + return true; + } + function toggleHeader(type, options2) { + options2 = options2 || { useDeprecatedLogic: false }; + if (options2.useDeprecatedLogic) + return deprecated_toggleHeader(type); + return function(state, dispatch) { + if (!isInTable(state)) + return false; + if (dispatch) { + const types = tableNodeTypes(state.schema); + const rect = selectedRect(state), tr = state.tr; + const isHeaderRowEnabled = isHeaderEnabledByType("row", rect, types); + const isHeaderColumnEnabled = isHeaderEnabledByType( + "column", + rect, + types + ); + const isHeaderEnabled = type === "column" ? isHeaderRowEnabled : type === "row" ? isHeaderColumnEnabled : false; + const selectionStartsAt = isHeaderEnabled ? 1 : 0; + const cellsRect = type == "column" ? { + left: 0, + top: selectionStartsAt, + right: 1, + bottom: rect.map.height + } : type == "row" ? { + left: selectionStartsAt, + top: 0, + right: rect.map.width, + bottom: 1 + } : rect; + const newType = type == "column" ? isHeaderColumnEnabled ? types.cell : types.header_cell : type == "row" ? isHeaderRowEnabled ? types.cell : types.header_cell : types.cell; + rect.map.cellsInRect(cellsRect).forEach((relativeCellPos) => { + const cellPos = relativeCellPos + rect.tableStart; + const cell = tr.doc.nodeAt(cellPos); + if (cell) { + tr.setNodeMarkup(cellPos, newType, cell.attrs); + } + }); + dispatch(tr); + } + return true; + }; + } + var toggleHeaderRow = toggleHeader("row", { + useDeprecatedLogic: true + }); + var toggleHeaderColumn = toggleHeader("column", { + useDeprecatedLogic: true + }); + var toggleHeaderCell = toggleHeader("cell", { + useDeprecatedLogic: true + }); + function findNextCell($cell, dir) { + if (dir < 0) { + const before = $cell.nodeBefore; + if (before) + return $cell.pos - before.nodeSize; + for (let row = $cell.index(-1) - 1, rowEnd = $cell.before(); row >= 0; row--) { + const rowNode = $cell.node(-1).child(row); + const lastChild = rowNode.lastChild; + if (lastChild) { + return rowEnd - 1 - lastChild.nodeSize; + } + rowEnd -= rowNode.nodeSize; + } + } else { + if ($cell.index() < $cell.parent.childCount - 1) { + return $cell.pos + $cell.nodeAfter.nodeSize; + } + const table = $cell.node(-1); + for (let row = $cell.indexAfter(-1), rowStart = $cell.after(); row < table.childCount; row++) { + const rowNode = table.child(row); + if (rowNode.childCount) + return rowStart + 1; + rowStart += rowNode.nodeSize; + } + } + return null; + } + function goToNextCell(direction) { + return function(state, dispatch) { + if (!isInTable(state)) + return false; + const cell = findNextCell(selectionCell(state), direction); + if (cell == null) + return false; + if (dispatch) { + const $cell = state.doc.resolve(cell); + dispatch( + state.tr.setSelection(TextSelection.between($cell, moveCellForward($cell))).scrollIntoView() + ); + } + return true; + }; + } + function deleteTable(state, dispatch) { + const $pos = state.selection.$anchor; + for (let d6 = $pos.depth; d6 > 0; d6--) { + const node2 = $pos.node(d6); + if (node2.type.spec.tableRole == "table") { + if (dispatch) + dispatch( + state.tr.delete($pos.before(d6), $pos.after(d6)).scrollIntoView() + ); + return true; + } + } + return false; + } + function tableEditing({ + allowTableNodeSelection = false + } = {}) { + return new Plugin({ + key: tableEditingKey, + // This piece of state is used to remember when a mouse-drag + // cell-selection is happening, so that it can continue even as + // transactions (which might move its anchor cell) come in. + state: { + init() { + return null; + }, + apply(tr, cur) { + const set = tr.getMeta(tableEditingKey); + if (set != null) + return set == -1 ? null : set; + if (cur == null || !tr.docChanged) + return cur; + const { deleted, pos } = tr.mapping.mapResult(cur); + return deleted ? null : pos; + } + }, + props: { + decorations: drawCellSelection, + handleDOMEvents: { + mousedown: handleMouseDown + }, + createSelectionBetween(view) { + return tableEditingKey.getState(view.state) != null ? view.state.selection : null; + }, + handleTripleClick: handleTripleClick2, + handleKeyDown, + handlePaste + }, + appendTransaction(_3, oldState, state) { + return normalizeSelection( + state, + fixTables(state, oldState), + allowTableNodeSelection + ); + } + }); + } + + // node_modules/ccount/index.js + function ccount(value, character) { + const source = String(value); + if (typeof character !== "string") { + throw new TypeError("Expected character"); + } + let count = 0; + let index2 = source.indexOf(character); + while (index2 !== -1) { + count++; + index2 = source.indexOf(character, index2 + character.length); + } + return count; + } + + // node_modules/mdast-util-find-and-replace/lib/index.js + function findAndReplace(tree, list4, options2) { + const settings = options2 || {}; + const ignored = convert(settings.ignore || []); + const pairs = toPairs(list4); + let pairIndex = -1; + while (++pairIndex < pairs.length) { + visitParents(tree, "text", visitor); + } + function visitor(node2, parents) { + let index2 = -1; + let grandparent; + while (++index2 < parents.length) { + const parent = parents[index2]; + const siblings = grandparent ? grandparent.children : void 0; + if (ignored( + parent, + siblings ? siblings.indexOf(parent) : void 0, + grandparent + )) { + return; + } + grandparent = parent; + } + if (grandparent) { + return handler(node2, parents); + } + } + function handler(node2, parents) { + const parent = parents[parents.length - 1]; + const find = pairs[pairIndex][0]; + const replace3 = pairs[pairIndex][1]; + let start = 0; + const siblings = parent.children; + const index2 = siblings.indexOf(node2); + let change = false; + let nodes = []; + find.lastIndex = 0; + let match = find.exec(node2.value); + while (match) { + const position2 = match.index; + const matchObject = { + index: match.index, + input: match.input, + stack: [...parents, node2] + }; + let value = replace3(...match, matchObject); + if (typeof value === "string") { + value = value.length > 0 ? { type: "text", value } : void 0; + } + if (value === false) { + find.lastIndex = position2 + 1; + } else { + if (start !== position2) { + nodes.push({ + type: "text", + value: node2.value.slice(start, position2) + }); + } + if (Array.isArray(value)) { + nodes.push(...value); + } else if (value) { + nodes.push(value); + } + start = position2 + match[0].length; + change = true; + } + if (!find.global) { + break; + } + match = find.exec(node2.value); + } + if (change) { + if (start < node2.value.length) { + nodes.push({ type: "text", value: node2.value.slice(start) }); + } + parent.children.splice(index2, 1, ...nodes); + } else { + nodes = [node2]; + } + return index2 + nodes.length; + } + } + function toPairs(tupleOrList) { + const result = []; + if (!Array.isArray(tupleOrList)) { + throw new TypeError("Expected find and replace tuple or list of tuples"); + } + const list4 = !tupleOrList[0] || Array.isArray(tupleOrList[0]) ? tupleOrList : [tupleOrList]; + let index2 = -1; + while (++index2 < list4.length) { + const tuple = list4[index2]; + result.push([toExpression(tuple[0]), toFunction(tuple[1])]); + } + return result; + } + function toExpression(find) { + return typeof find === "string" ? new RegExp(escapeStringRegexp(find), "g") : find; + } + function toFunction(replace3) { + return typeof replace3 === "function" ? replace3 : function() { + return replace3; + }; + } + + // node_modules/mdast-util-gfm-autolink-literal/lib/index.js + var inConstruct = "phrasing"; + var notInConstruct = ["autolink", "link", "image", "label"]; + function gfmAutolinkLiteralFromMarkdown() { + return { + transforms: [transformGfmAutolinkLiterals], + enter: { + literalAutolink: enterLiteralAutolink, + literalAutolinkEmail: enterLiteralAutolinkValue, + literalAutolinkHttp: enterLiteralAutolinkValue, + literalAutolinkWww: enterLiteralAutolinkValue + }, + exit: { + literalAutolink: exitLiteralAutolink, + literalAutolinkEmail: exitLiteralAutolinkEmail, + literalAutolinkHttp: exitLiteralAutolinkHttp, + literalAutolinkWww: exitLiteralAutolinkWww + } + }; + } + function gfmAutolinkLiteralToMarkdown() { + return { + unsafe: [ + { + character: "@", + before: "[+\\-.\\w]", + after: "[\\-.\\w]", + inConstruct, + notInConstruct + }, + { + character: ".", + before: "[Ww]", + after: "[\\-.\\w]", + inConstruct, + notInConstruct + }, + { + character: ":", + before: "[ps]", + after: "\\/", + inConstruct, + notInConstruct + } + ] + }; + } + function enterLiteralAutolink(token) { + this.enter({ type: "link", title: null, url: "", children: [] }, token); + } + function enterLiteralAutolinkValue(token) { + this.config.enter.autolinkProtocol.call(this, token); + } + function exitLiteralAutolinkHttp(token) { + this.config.exit.autolinkProtocol.call(this, token); + } + function exitLiteralAutolinkWww(token) { + this.config.exit.data.call(this, token); + const node2 = this.stack[this.stack.length - 1]; + ok2(node2.type === "link"); + node2.url = "http://" + this.sliceSerialize(token); + } + function exitLiteralAutolinkEmail(token) { + this.config.exit.autolinkEmail.call(this, token); + } + function exitLiteralAutolink(token) { + this.exit(token); + } + function transformGfmAutolinkLiterals(tree) { + findAndReplace( + tree, + [ + [/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi, findUrl], + [/([-.\w+]+)@([-\w]+(?:\.[-\w]+)+)/g, findEmail] + ], + { ignore: ["link", "linkReference"] } + ); + } + function findUrl(_3, protocol, domain2, path3, match) { + let prefix = ""; + if (!previous2(match)) { + return false; + } + if (/^w/i.test(protocol)) { + domain2 = protocol + domain2; + protocol = ""; + prefix = "http://"; + } + if (!isCorrectDomain(domain2)) { + return false; + } + const parts = splitUrl(domain2 + path3); + if (!parts[0]) return false; + const result = { + type: "link", + title: null, + url: prefix + protocol + parts[0], + children: [{ type: "text", value: protocol + parts[0] }] + }; + if (parts[1]) { + return [result, { type: "text", value: parts[1] }]; + } + return result; + } + function findEmail(_3, atext, label, match) { + if ( + // Not an expected previous character. + !previous2(match, true) || // Label ends in not allowed character. + /[-\d_]$/.test(label) + ) { + return false; + } + return { + type: "link", + title: null, + url: "mailto:" + atext + "@" + label, + children: [{ type: "text", value: atext + "@" + label }] + }; + } + function isCorrectDomain(domain2) { + const parts = domain2.split("."); + if (parts.length < 2 || parts[parts.length - 1] && (/_/.test(parts[parts.length - 1]) || !/[a-zA-Z\d]/.test(parts[parts.length - 1])) || parts[parts.length - 2] && (/_/.test(parts[parts.length - 2]) || !/[a-zA-Z\d]/.test(parts[parts.length - 2]))) { + return false; + } + return true; + } + function splitUrl(url) { + const trailExec = /[!"&'),.:;<>?\]}]+$/.exec(url); + if (!trailExec) { + return [url, void 0]; + } + url = url.slice(0, trailExec.index); + let trail2 = trailExec[0]; + let closingParenIndex = trail2.indexOf(")"); + const openingParens = ccount(url, "("); + let closingParens = ccount(url, ")"); + while (closingParenIndex !== -1 && openingParens > closingParens) { + url += trail2.slice(0, closingParenIndex + 1); + trail2 = trail2.slice(closingParenIndex + 1); + closingParenIndex = trail2.indexOf(")"); + closingParens++; + } + return [url, trail2]; + } + function previous2(match, email) { + const code3 = match.input.charCodeAt(match.index - 1); + return (match.index === 0 || unicodeWhitespace(code3) || unicodePunctuation(code3)) && (!email || code3 !== 47); + } + + // node_modules/mdast-util-gfm-footnote/lib/index.js + footnoteReference.peek = footnoteReferencePeek; + function gfmFootnoteFromMarkdown() { + return { + enter: { + gfmFootnoteDefinition: enterFootnoteDefinition, + gfmFootnoteDefinitionLabelString: enterFootnoteDefinitionLabelString, + gfmFootnoteCall: enterFootnoteCall, + gfmFootnoteCallString: enterFootnoteCallString + }, + exit: { + gfmFootnoteDefinition: exitFootnoteDefinition, + gfmFootnoteDefinitionLabelString: exitFootnoteDefinitionLabelString, + gfmFootnoteCall: exitFootnoteCall, + gfmFootnoteCallString: exitFootnoteCallString + } + }; + } + function gfmFootnoteToMarkdown() { + return { + // This is on by default already. + unsafe: [{ character: "[", inConstruct: ["phrasing", "label", "reference"] }], + handlers: { footnoteDefinition, footnoteReference } + }; + } + function enterFootnoteDefinition(token) { + this.enter( + { type: "footnoteDefinition", identifier: "", label: "", children: [] }, + token + ); + } + function enterFootnoteDefinitionLabelString() { + this.buffer(); + } + function exitFootnoteDefinitionLabelString(token) { + const label = this.resume(); + const node2 = this.stack[this.stack.length - 1]; + ok2(node2.type === "footnoteDefinition"); + node2.label = label; + node2.identifier = normalizeIdentifier( + this.sliceSerialize(token) + ).toLowerCase(); + } + function exitFootnoteDefinition(token) { + this.exit(token); + } + function enterFootnoteCall(token) { + this.enter({ type: "footnoteReference", identifier: "", label: "" }, token); + } + function enterFootnoteCallString() { + this.buffer(); + } + function exitFootnoteCallString(token) { + const label = this.resume(); + const node2 = this.stack[this.stack.length - 1]; + ok2(node2.type === "footnoteReference"); + node2.label = label; + node2.identifier = normalizeIdentifier( + this.sliceSerialize(token) + ).toLowerCase(); + } + function exitFootnoteCall(token) { + this.exit(token); + } + function footnoteReference(node2, _3, state, info) { + const tracker = state.createTracker(info); + let value = tracker.move("[^"); + const exit3 = state.enter("footnoteReference"); + const subexit = state.enter("reference"); + value += tracker.move( + state.safe(state.associationId(node2), __spreadProps(__spreadValues({}, tracker.current()), { + before: value, + after: "]" + })) + ); + subexit(); + exit3(); + value += tracker.move("]"); + return value; + } + function footnoteReferencePeek() { + return "["; + } + function footnoteDefinition(node2, _3, state, info) { + const tracker = state.createTracker(info); + let value = tracker.move("[^"); + const exit3 = state.enter("footnoteDefinition"); + const subexit = state.enter("label"); + value += tracker.move( + state.safe(state.associationId(node2), __spreadProps(__spreadValues({}, tracker.current()), { + before: value, + after: "]" + })) + ); + subexit(); + value += tracker.move( + "]:" + (node2.children && node2.children.length > 0 ? " " : "") + ); + tracker.shift(4); + value += tracker.move( + state.indentLines(state.containerFlow(node2, tracker.current()), map4) + ); + exit3(); + return value; + } + function map4(line, index2, blank) { + if (index2 === 0) { + return line; + } + return (blank ? "" : " ") + line; + } + + // node_modules/mdast-util-gfm-strikethrough/lib/index.js + var constructsWithoutStrikethrough = [ + "autolink", + "destinationLiteral", + "destinationRaw", + "reference", + "titleQuote", + "titleApostrophe" + ]; + handleDelete.peek = peekDelete; + function gfmStrikethroughFromMarkdown() { + return { + canContainEols: ["delete"], + enter: { strikethrough: enterStrikethrough }, + exit: { strikethrough: exitStrikethrough } + }; + } + function gfmStrikethroughToMarkdown() { + return { + unsafe: [ + { + character: "~", + inConstruct: "phrasing", + notInConstruct: constructsWithoutStrikethrough + } + ], + handlers: { delete: handleDelete } + }; + } + function enterStrikethrough(token) { + this.enter({ type: "delete", children: [] }, token); + } + function exitStrikethrough(token) { + this.exit(token); + } + function handleDelete(node2, _3, state, info) { + const tracker = state.createTracker(info); + const exit3 = state.enter("strikethrough"); + let value = tracker.move("~~"); + value += state.containerPhrasing(node2, __spreadProps(__spreadValues({}, tracker.current()), { + before: value, + after: "~" + })); + value += tracker.move("~~"); + exit3(); + return value; + } + function peekDelete() { + return "~"; + } + + // node_modules/markdown-table/index.js + function markdownTable(table, options2 = {}) { + const align = (options2.align || []).concat(); + const stringLength = options2.stringLength || defaultStringLength; + const alignments = []; + const cellMatrix = []; + const sizeMatrix = []; + const longestCellByColumn = []; + let mostCellsPerRow = 0; + let rowIndex = -1; + while (++rowIndex < table.length) { + const row2 = []; + const sizes2 = []; + let columnIndex2 = -1; + if (table[rowIndex].length > mostCellsPerRow) { + mostCellsPerRow = table[rowIndex].length; + } + while (++columnIndex2 < table[rowIndex].length) { + const cell = serialize(table[rowIndex][columnIndex2]); + if (options2.alignDelimiters !== false) { + const size = stringLength(cell); + sizes2[columnIndex2] = size; + if (longestCellByColumn[columnIndex2] === void 0 || size > longestCellByColumn[columnIndex2]) { + longestCellByColumn[columnIndex2] = size; + } + } + row2.push(cell); + } + cellMatrix[rowIndex] = row2; + sizeMatrix[rowIndex] = sizes2; + } + let columnIndex = -1; + if (typeof align === "object" && "length" in align) { + while (++columnIndex < mostCellsPerRow) { + alignments[columnIndex] = toAlignment(align[columnIndex]); + } + } else { + const code3 = toAlignment(align); + while (++columnIndex < mostCellsPerRow) { + alignments[columnIndex] = code3; + } + } + columnIndex = -1; + const row = []; + const sizes = []; + while (++columnIndex < mostCellsPerRow) { + const code3 = alignments[columnIndex]; + let before = ""; + let after = ""; + if (code3 === 99) { + before = ":"; + after = ":"; + } else if (code3 === 108) { + before = ":"; + } else if (code3 === 114) { + after = ":"; + } + let size = options2.alignDelimiters === false ? 1 : Math.max( + 1, + longestCellByColumn[columnIndex] - before.length - after.length + ); + const cell = before + "-".repeat(size) + after; + if (options2.alignDelimiters !== false) { + size = before.length + size + after.length; + if (size > longestCellByColumn[columnIndex]) { + longestCellByColumn[columnIndex] = size; + } + sizes[columnIndex] = size; + } + row[columnIndex] = cell; + } + cellMatrix.splice(1, 0, row); + sizeMatrix.splice(1, 0, sizes); + rowIndex = -1; + const lines = []; + while (++rowIndex < cellMatrix.length) { + const row2 = cellMatrix[rowIndex]; + const sizes2 = sizeMatrix[rowIndex]; + columnIndex = -1; + const line = []; + while (++columnIndex < mostCellsPerRow) { + const cell = row2[columnIndex] || ""; + let before = ""; + let after = ""; + if (options2.alignDelimiters !== false) { + const size = longestCellByColumn[columnIndex] - (sizes2[columnIndex] || 0); + const code3 = alignments[columnIndex]; + if (code3 === 114) { + before = " ".repeat(size); + } else if (code3 === 99) { + if (size % 2) { + before = " ".repeat(size / 2 + 0.5); + after = " ".repeat(size / 2 - 0.5); + } else { + before = " ".repeat(size / 2); + after = before; + } + } else { + after = " ".repeat(size); + } + } + if (options2.delimiterStart !== false && !columnIndex) { + line.push("|"); + } + if (options2.padding !== false && // Don’t add the opening space if we’re not aligning and the cell is + // empty: there will be a closing space. + !(options2.alignDelimiters === false && cell === "") && (options2.delimiterStart !== false || columnIndex)) { + line.push(" "); + } + if (options2.alignDelimiters !== false) { + line.push(before); + } + line.push(cell); + if (options2.alignDelimiters !== false) { + line.push(after); + } + if (options2.padding !== false) { + line.push(" "); + } + if (options2.delimiterEnd !== false || columnIndex !== mostCellsPerRow - 1) { + line.push("|"); + } + } + lines.push( + options2.delimiterEnd === false ? line.join("").replace(/ +$/, "") : line.join("") + ); + } + return lines.join("\n"); + } + function serialize(value) { + return value === null || value === void 0 ? "" : String(value); + } + function defaultStringLength(value) { + return value.length; + } + function toAlignment(value) { + const code3 = typeof value === "string" ? value.codePointAt(0) : 0; + return code3 === 67 || code3 === 99 ? 99 : code3 === 76 || code3 === 108 ? 108 : code3 === 82 || code3 === 114 ? 114 : 0; + } + + // node_modules/mdast-util-gfm-table/lib/index.js + function gfmTableFromMarkdown() { + return { + enter: { + table: enterTable, + tableData: enterCell, + tableHeader: enterCell, + tableRow: enterRow + }, + exit: { + codeText: exitCodeText, + table: exitTable, + tableData: exit2, + tableHeader: exit2, + tableRow: exit2 + } + }; + } + function enterTable(token) { + const align = token._align; + ok2(align, "expected `_align` on table"); + this.enter( + { + type: "table", + align: align.map(function(d6) { + return d6 === "none" ? null : d6; + }), + children: [] + }, + token + ); + this.data.inTable = true; + } + function exitTable(token) { + this.exit(token); + this.data.inTable = void 0; + } + function enterRow(token) { + this.enter({ type: "tableRow", children: [] }, token); + } + function exit2(token) { + this.exit(token); + } + function enterCell(token) { + this.enter({ type: "tableCell", children: [] }, token); + } + function exitCodeText(token) { + let value = this.resume(); + if (this.data.inTable) { + value = value.replace(/\\([\\|])/g, replace2); + } + const node2 = this.stack[this.stack.length - 1]; + ok2(node2.type === "inlineCode"); + node2.value = value; + this.exit(token); + } + function replace2($0, $1) { + return $1 === "|" ? $1 : $0; + } + function gfmTableToMarkdown(options2) { + const settings = options2 || {}; + const padding = settings.tableCellPadding; + const alignDelimiters = settings.tablePipeAlign; + const stringLength = settings.stringLength; + const around = padding ? " " : "|"; + return { + unsafe: [ + { character: "\r", inConstruct: "tableCell" }, + { character: "\n", inConstruct: "tableCell" }, + // A pipe, when followed by a tab or space (padding), or a dash or colon + // (unpadded delimiter row), could result in a table. + { atBreak: true, character: "|", after: "[ :-]" }, + // A pipe in a cell must be encoded. + { character: "|", inConstruct: "tableCell" }, + // A colon must be followed by a dash, in which case it could start a + // delimiter row. + { atBreak: true, character: ":", after: "-" }, + // A delimiter row can also start with a dash, when followed by more + // dashes, a colon, or a pipe. + // This is a stricter version than the built in check for lists, thematic + // breaks, and setex heading underlines though: + // <https://github.com/syntax-tree/mdast-util-to-markdown/blob/51a2038/lib/unsafe.js#L57> + { atBreak: true, character: "-", after: "[:|-]" } + ], + handlers: { + inlineCode: inlineCodeWithTable, + table: handleTable, + tableCell: handleTableCell, + tableRow: handleTableRow + } + }; + function handleTable(node2, _3, state, info) { + return serializeData(handleTableAsData(node2, state, info), node2.align); + } + function handleTableRow(node2, _3, state, info) { + const row = handleTableRowAsData(node2, state, info); + const value = serializeData([row]); + return value.slice(0, value.indexOf("\n")); + } + function handleTableCell(node2, _3, state, info) { + const exit3 = state.enter("tableCell"); + const subexit = state.enter("phrasing"); + const value = state.containerPhrasing(node2, __spreadProps(__spreadValues({}, info), { + before: around, + after: around + })); + subexit(); + exit3(); + return value; + } + function serializeData(matrix, align) { + return markdownTable(matrix, { + align, + // @ts-expect-error: `markdown-table` types should support `null`. + alignDelimiters, + // @ts-expect-error: `markdown-table` types should support `null`. + padding, + // @ts-expect-error: `markdown-table` types should support `null`. + stringLength + }); + } + function handleTableAsData(node2, state, info) { + const children = node2.children; + let index2 = -1; + const result = []; + const subexit = state.enter("table"); + while (++index2 < children.length) { + result[index2] = handleTableRowAsData(children[index2], state, info); + } + subexit(); + return result; + } + function handleTableRowAsData(node2, state, info) { + const children = node2.children; + let index2 = -1; + const result = []; + const subexit = state.enter("tableRow"); + while (++index2 < children.length) { + result[index2] = handleTableCell(children[index2], node2, state, info); + } + subexit(); + return result; + } + function inlineCodeWithTable(node2, parent, state) { + let value = handle.inlineCode(node2, parent, state); + if (state.stack.includes("tableCell")) { + value = value.replace(/\|/g, "\\$&"); + } + return value; + } + } + + // node_modules/mdast-util-gfm-task-list-item/lib/index.js + function gfmTaskListItemFromMarkdown() { + return { + exit: { + taskListCheckValueChecked: exitCheck, + taskListCheckValueUnchecked: exitCheck, + paragraph: exitParagraphWithTaskListItem + } + }; + } + function gfmTaskListItemToMarkdown() { + return { + unsafe: [{ atBreak: true, character: "-", after: "[:|-]" }], + handlers: { listItem: listItemWithTaskListItem } + }; + } + function exitCheck(token) { + const node2 = this.stack[this.stack.length - 2]; + ok2(node2.type === "listItem"); + node2.checked = token.type === "taskListCheckValueChecked"; + } + function exitParagraphWithTaskListItem(token) { + const parent = this.stack[this.stack.length - 2]; + if (parent && parent.type === "listItem" && typeof parent.checked === "boolean") { + const node2 = this.stack[this.stack.length - 1]; + ok2(node2.type === "paragraph"); + const head = node2.children[0]; + if (head && head.type === "text") { + const siblings = parent.children; + let index2 = -1; + let firstParaghraph; + while (++index2 < siblings.length) { + const sibling = siblings[index2]; + if (sibling.type === "paragraph") { + firstParaghraph = sibling; + break; + } + } + if (firstParaghraph === node2) { + head.value = head.value.slice(1); + if (head.value.length === 0) { + node2.children.shift(); + } else if (node2.position && head.position && typeof head.position.start.offset === "number") { + head.position.start.column++; + head.position.start.offset++; + node2.position.start = Object.assign({}, head.position.start); + } + } + } + } + this.exit(token); + } + function listItemWithTaskListItem(node2, parent, state, info) { + const head = node2.children[0]; + const checkable = typeof node2.checked === "boolean" && head && head.type === "paragraph"; + const checkbox = "[" + (node2.checked ? "x" : " ") + "] "; + const tracker = state.createTracker(info); + if (checkable) { + tracker.move(checkbox); + } + let value = handle.listItem(node2, parent, state, __spreadValues(__spreadValues({}, info), tracker.current())); + if (checkable) { + value = value.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/, check); + } + return value; + function check($0) { + return $0 + checkbox; + } + } + + // node_modules/mdast-util-gfm/lib/index.js + function gfmFromMarkdown() { + return [ + gfmAutolinkLiteralFromMarkdown(), + gfmFootnoteFromMarkdown(), + gfmStrikethroughFromMarkdown(), + gfmTableFromMarkdown(), + gfmTaskListItemFromMarkdown() + ]; + } + function gfmToMarkdown(options2) { + return { + extensions: [ + gfmAutolinkLiteralToMarkdown(), + gfmFootnoteToMarkdown(), + gfmStrikethroughToMarkdown(), + gfmTableToMarkdown(options2), + gfmTaskListItemToMarkdown() + ] + }; + } + + // node_modules/micromark-extension-gfm-autolink-literal/lib/syntax.js + var wwwPrefix = { + tokenize: tokenizeWwwPrefix, + partial: true + }; + var domain = { + tokenize: tokenizeDomain, + partial: true + }; + var path2 = { + tokenize: tokenizePath, + partial: true + }; + var trail = { + tokenize: tokenizeTrail, + partial: true + }; + var emailDomainDotTrail = { + tokenize: tokenizeEmailDomainDotTrail, + partial: true + }; + var wwwAutolink = { + tokenize: tokenizeWwwAutolink, + previous: previousWww + }; + var protocolAutolink = { + tokenize: tokenizeProtocolAutolink, + previous: previousProtocol + }; + var emailAutolink = { + tokenize: tokenizeEmailAutolink, + previous: previousEmail + }; + var text4 = {}; + function gfmAutolinkLiteral() { + return { + text: text4 + }; + } + var code2 = 48; + while (code2 < 123) { + text4[code2] = emailAutolink; + code2++; + if (code2 === 58) code2 = 65; + else if (code2 === 91) code2 = 97; + } + text4[43] = emailAutolink; + text4[45] = emailAutolink; + text4[46] = emailAutolink; + text4[95] = emailAutolink; + text4[72] = [emailAutolink, protocolAutolink]; + text4[104] = [emailAutolink, protocolAutolink]; + text4[87] = [emailAutolink, wwwAutolink]; + text4[119] = [emailAutolink, wwwAutolink]; + function tokenizeEmailAutolink(effects, ok3, nok) { + const self2 = this; + let dot; + let data; + return start; + function start(code3) { + if (!gfmAtext(code3) || !previousEmail.call(self2, self2.previous) || previousUnbalanced(self2.events)) { + return nok(code3); + } + effects.enter("literalAutolink"); + effects.enter("literalAutolinkEmail"); + return atext(code3); + } + function atext(code3) { + if (gfmAtext(code3)) { + effects.consume(code3); + return atext; + } + if (code3 === 64) { + effects.consume(code3); + return emailDomain; + } + return nok(code3); + } + function emailDomain(code3) { + if (code3 === 46) { + return effects.check( + emailDomainDotTrail, + emailDomainAfter, + emailDomainDot + )(code3); + } + if (code3 === 45 || code3 === 95 || asciiAlphanumeric(code3)) { + data = true; + effects.consume(code3); + return emailDomain; + } + return emailDomainAfter(code3); + } + function emailDomainDot(code3) { + effects.consume(code3); + dot = true; + return emailDomain; + } + function emailDomainAfter(code3) { + if (data && dot && asciiAlpha(self2.previous)) { + effects.exit("literalAutolinkEmail"); + effects.exit("literalAutolink"); + return ok3(code3); + } + return nok(code3); + } + } + function tokenizeWwwAutolink(effects, ok3, nok) { + const self2 = this; + return wwwStart; + function wwwStart(code3) { + if (code3 !== 87 && code3 !== 119 || !previousWww.call(self2, self2.previous) || previousUnbalanced(self2.events)) { + return nok(code3); + } + effects.enter("literalAutolink"); + effects.enter("literalAutolinkWww"); + return effects.check( + wwwPrefix, + effects.attempt(domain, effects.attempt(path2, wwwAfter), nok), + nok + )(code3); + } + function wwwAfter(code3) { + effects.exit("literalAutolinkWww"); + effects.exit("literalAutolink"); + return ok3(code3); + } + } + function tokenizeProtocolAutolink(effects, ok3, nok) { + const self2 = this; + let buffer = ""; + let seen = false; + return protocolStart; + function protocolStart(code3) { + if ((code3 === 72 || code3 === 104) && previousProtocol.call(self2, self2.previous) && !previousUnbalanced(self2.events)) { + effects.enter("literalAutolink"); + effects.enter("literalAutolinkHttp"); + buffer += String.fromCodePoint(code3); + effects.consume(code3); + return protocolPrefixInside; + } + return nok(code3); + } + function protocolPrefixInside(code3) { + if (asciiAlpha(code3) && buffer.length < 5) { + buffer += String.fromCodePoint(code3); + effects.consume(code3); + return protocolPrefixInside; + } + if (code3 === 58) { + const protocol = buffer.toLowerCase(); + if (protocol === "http" || protocol === "https") { + effects.consume(code3); + return protocolSlashesInside; + } + } + return nok(code3); + } + function protocolSlashesInside(code3) { + if (code3 === 47) { + effects.consume(code3); + if (seen) { + return afterProtocol; + } + seen = true; + return protocolSlashesInside; + } + return nok(code3); + } + function afterProtocol(code3) { + return code3 === null || asciiControl(code3) || markdownLineEndingOrSpace(code3) || unicodeWhitespace(code3) || unicodePunctuation(code3) ? nok(code3) : effects.attempt(domain, effects.attempt(path2, protocolAfter), nok)(code3); + } + function protocolAfter(code3) { + effects.exit("literalAutolinkHttp"); + effects.exit("literalAutolink"); + return ok3(code3); + } + } + function tokenizeWwwPrefix(effects, ok3, nok) { + let size = 0; + return wwwPrefixInside; + function wwwPrefixInside(code3) { + if ((code3 === 87 || code3 === 119) && size < 3) { + size++; + effects.consume(code3); + return wwwPrefixInside; + } + if (code3 === 46 && size === 3) { + effects.consume(code3); + return wwwPrefixAfter; + } + return nok(code3); + } + function wwwPrefixAfter(code3) { + return code3 === null ? nok(code3) : ok3(code3); + } + } + function tokenizeDomain(effects, ok3, nok) { + let underscoreInLastSegment; + let underscoreInLastLastSegment; + let seen; + return domainInside; + function domainInside(code3) { + if (code3 === 46 || code3 === 95) { + return effects.check(trail, domainAfter, domainAtPunctuation)(code3); + } + if (code3 === null || markdownLineEndingOrSpace(code3) || unicodeWhitespace(code3) || code3 !== 45 && unicodePunctuation(code3)) { + return domainAfter(code3); + } + seen = true; + effects.consume(code3); + return domainInside; + } + function domainAtPunctuation(code3) { + if (code3 === 95) { + underscoreInLastSegment = true; + } else { + underscoreInLastLastSegment = underscoreInLastSegment; + underscoreInLastSegment = void 0; + } + effects.consume(code3); + return domainInside; + } + function domainAfter(code3) { + if (underscoreInLastLastSegment || underscoreInLastSegment || !seen) { + return nok(code3); + } + return ok3(code3); + } + } + function tokenizePath(effects, ok3) { + let sizeOpen = 0; + let sizeClose = 0; + return pathInside; + function pathInside(code3) { + if (code3 === 40) { + sizeOpen++; + effects.consume(code3); + return pathInside; + } + if (code3 === 41 && sizeClose < sizeOpen) { + return pathAtPunctuation(code3); + } + if (code3 === 33 || code3 === 34 || code3 === 38 || code3 === 39 || code3 === 41 || code3 === 42 || code3 === 44 || code3 === 46 || code3 === 58 || code3 === 59 || code3 === 60 || code3 === 63 || code3 === 93 || code3 === 95 || code3 === 126) { + return effects.check(trail, ok3, pathAtPunctuation)(code3); + } + if (code3 === null || markdownLineEndingOrSpace(code3) || unicodeWhitespace(code3)) { + return ok3(code3); + } + effects.consume(code3); + return pathInside; + } + function pathAtPunctuation(code3) { + if (code3 === 41) { + sizeClose++; + } + effects.consume(code3); + return pathInside; + } + } + function tokenizeTrail(effects, ok3, nok) { + return trail2; + function trail2(code3) { + if (code3 === 33 || code3 === 34 || code3 === 39 || code3 === 41 || code3 === 42 || code3 === 44 || code3 === 46 || code3 === 58 || code3 === 59 || code3 === 63 || code3 === 95 || code3 === 126) { + effects.consume(code3); + return trail2; + } + if (code3 === 38) { + effects.consume(code3); + return trailCharRefStart; + } + if (code3 === 93) { + effects.consume(code3); + return trailBracketAfter; + } + if ( + // `<` is an end. + code3 === 60 || // So is whitespace. + code3 === null || markdownLineEndingOrSpace(code3) || unicodeWhitespace(code3) + ) { + return ok3(code3); + } + return nok(code3); + } + function trailBracketAfter(code3) { + if (code3 === null || code3 === 40 || code3 === 91 || markdownLineEndingOrSpace(code3) || unicodeWhitespace(code3)) { + return ok3(code3); + } + return trail2(code3); + } + function trailCharRefStart(code3) { + return asciiAlpha(code3) ? trailCharRefInside(code3) : nok(code3); + } + function trailCharRefInside(code3) { + if (code3 === 59) { + effects.consume(code3); + return trail2; + } + if (asciiAlpha(code3)) { + effects.consume(code3); + return trailCharRefInside; + } + return nok(code3); + } + } + function tokenizeEmailDomainDotTrail(effects, ok3, nok) { + return start; + function start(code3) { + effects.consume(code3); + return after; + } + function after(code3) { + return asciiAlphanumeric(code3) ? nok(code3) : ok3(code3); + } + } + function previousWww(code3) { + return code3 === null || code3 === 40 || code3 === 42 || code3 === 95 || code3 === 91 || code3 === 93 || code3 === 126 || markdownLineEndingOrSpace(code3); + } + function previousProtocol(code3) { + return !asciiAlpha(code3); + } + function previousEmail(code3) { + return !(code3 === 47 || gfmAtext(code3)); + } + function gfmAtext(code3) { + return code3 === 43 || code3 === 45 || code3 === 46 || code3 === 95 || asciiAlphanumeric(code3); + } + function previousUnbalanced(events) { + let index2 = events.length; + let result = false; + while (index2--) { + const token = events[index2][1]; + if ((token.type === "labelLink" || token.type === "labelImage") && !token._balanced) { + result = true; + break; + } + if (token._gfmAutolinkLiteralWalkedInto) { + result = false; + break; + } + } + if (events.length > 0 && !result) { + events[events.length - 1][1]._gfmAutolinkLiteralWalkedInto = true; + } + return result; + } + + // node_modules/micromark-extension-gfm-footnote/lib/syntax.js + var indent = { + tokenize: tokenizeIndent2, + partial: true + }; + function gfmFootnote() { + return { + document: { + [91]: { + tokenize: tokenizeDefinitionStart, + continuation: { + tokenize: tokenizeDefinitionContinuation + }, + exit: gfmFootnoteDefinitionEnd + } + }, + text: { + [91]: { + tokenize: tokenizeGfmFootnoteCall + }, + [93]: { + add: "after", + tokenize: tokenizePotentialGfmFootnoteCall, + resolveTo: resolveToPotentialGfmFootnoteCall + } + } + }; + } + function tokenizePotentialGfmFootnoteCall(effects, ok3, nok) { + const self2 = this; + let index2 = self2.events.length; + const defined = self2.parser.gfmFootnotes || (self2.parser.gfmFootnotes = []); + let labelStart; + while (index2--) { + const token = self2.events[index2][1]; + if (token.type === "labelImage") { + labelStart = token; + break; + } + if (token.type === "gfmFootnoteCall" || token.type === "labelLink" || token.type === "label" || token.type === "image" || token.type === "link") { + break; + } + } + return start; + function start(code3) { + if (!labelStart || !labelStart._balanced) { + return nok(code3); + } + const id = normalizeIdentifier( + self2.sliceSerialize({ + start: labelStart.end, + end: self2.now() + }) + ); + if (id.codePointAt(0) !== 94 || !defined.includes(id.slice(1))) { + return nok(code3); + } + effects.enter("gfmFootnoteCallLabelMarker"); + effects.consume(code3); + effects.exit("gfmFootnoteCallLabelMarker"); + return ok3(code3); + } + } + function resolveToPotentialGfmFootnoteCall(events, context) { + let index2 = events.length; + let labelStart; + while (index2--) { + if (events[index2][1].type === "labelImage" && events[index2][0] === "enter") { + labelStart = events[index2][1]; + break; + } + } + events[index2 + 1][1].type = "data"; + events[index2 + 3][1].type = "gfmFootnoteCallLabelMarker"; + const call = { + type: "gfmFootnoteCall", + start: Object.assign({}, events[index2 + 3][1].start), + end: Object.assign({}, events[events.length - 1][1].end) + }; + const marker = { + type: "gfmFootnoteCallMarker", + start: Object.assign({}, events[index2 + 3][1].end), + end: Object.assign({}, events[index2 + 3][1].end) + }; + marker.end.column++; + marker.end.offset++; + marker.end._bufferIndex++; + const string3 = { + type: "gfmFootnoteCallString", + start: Object.assign({}, marker.end), + end: Object.assign({}, events[events.length - 1][1].start) + }; + const chunk = { + type: "chunkString", + contentType: "string", + start: Object.assign({}, string3.start), + end: Object.assign({}, string3.end) + }; + const replacement = [ + // Take the `labelImageMarker` (now `data`, the `!`) + events[index2 + 1], + events[index2 + 2], + ["enter", call, context], + // The `[` + events[index2 + 3], + events[index2 + 4], + // The `^`. + ["enter", marker, context], + ["exit", marker, context], + // Everything in between. + ["enter", string3, context], + ["enter", chunk, context], + ["exit", chunk, context], + ["exit", string3, context], + // The ending (`]`, properly parsed and labelled). + events[events.length - 2], + events[events.length - 1], + ["exit", call, context] + ]; + events.splice(index2, events.length - index2 + 1, ...replacement); + return events; + } + function tokenizeGfmFootnoteCall(effects, ok3, nok) { + const self2 = this; + const defined = self2.parser.gfmFootnotes || (self2.parser.gfmFootnotes = []); + let size = 0; + let data; + return start; + function start(code3) { + effects.enter("gfmFootnoteCall"); + effects.enter("gfmFootnoteCallLabelMarker"); + effects.consume(code3); + effects.exit("gfmFootnoteCallLabelMarker"); + return callStart; + } + function callStart(code3) { + if (code3 !== 94) return nok(code3); + effects.enter("gfmFootnoteCallMarker"); + effects.consume(code3); + effects.exit("gfmFootnoteCallMarker"); + effects.enter("gfmFootnoteCallString"); + effects.enter("chunkString").contentType = "string"; + return callData; + } + function callData(code3) { + if ( + // Too long. + size > 999 || // Closing brace with nothing. + code3 === 93 && !data || // Space or tab is not supported by GFM for some reason. + // `\n` and `[` not being supported makes sense. + code3 === null || code3 === 91 || markdownLineEndingOrSpace(code3) + ) { + return nok(code3); + } + if (code3 === 93) { + effects.exit("chunkString"); + const token = effects.exit("gfmFootnoteCallString"); + if (!defined.includes(normalizeIdentifier(self2.sliceSerialize(token)))) { + return nok(code3); + } + effects.enter("gfmFootnoteCallLabelMarker"); + effects.consume(code3); + effects.exit("gfmFootnoteCallLabelMarker"); + effects.exit("gfmFootnoteCall"); + return ok3; + } + if (!markdownLineEndingOrSpace(code3)) { + data = true; + } + size++; + effects.consume(code3); + return code3 === 92 ? callEscape : callData; + } + function callEscape(code3) { + if (code3 === 91 || code3 === 92 || code3 === 93) { + effects.consume(code3); + size++; + return callData; + } + return callData(code3); + } + } + function tokenizeDefinitionStart(effects, ok3, nok) { + const self2 = this; + const defined = self2.parser.gfmFootnotes || (self2.parser.gfmFootnotes = []); + let identifier; + let size = 0; + let data; + return start; + function start(code3) { + effects.enter("gfmFootnoteDefinition")._container = true; + effects.enter("gfmFootnoteDefinitionLabel"); + effects.enter("gfmFootnoteDefinitionLabelMarker"); + effects.consume(code3); + effects.exit("gfmFootnoteDefinitionLabelMarker"); + return labelAtMarker; + } + function labelAtMarker(code3) { + if (code3 === 94) { + effects.enter("gfmFootnoteDefinitionMarker"); + effects.consume(code3); + effects.exit("gfmFootnoteDefinitionMarker"); + effects.enter("gfmFootnoteDefinitionLabelString"); + effects.enter("chunkString").contentType = "string"; + return labelInside; + } + return nok(code3); + } + function labelInside(code3) { + if ( + // Too long. + size > 999 || // Closing brace with nothing. + code3 === 93 && !data || // Space or tab is not supported by GFM for some reason. + // `\n` and `[` not being supported makes sense. + code3 === null || code3 === 91 || markdownLineEndingOrSpace(code3) + ) { + return nok(code3); + } + if (code3 === 93) { + effects.exit("chunkString"); + const token = effects.exit("gfmFootnoteDefinitionLabelString"); + identifier = normalizeIdentifier(self2.sliceSerialize(token)); + effects.enter("gfmFootnoteDefinitionLabelMarker"); + effects.consume(code3); + effects.exit("gfmFootnoteDefinitionLabelMarker"); + effects.exit("gfmFootnoteDefinitionLabel"); + return labelAfter; + } + if (!markdownLineEndingOrSpace(code3)) { + data = true; + } + size++; + effects.consume(code3); + return code3 === 92 ? labelEscape : labelInside; + } + function labelEscape(code3) { + if (code3 === 91 || code3 === 92 || code3 === 93) { + effects.consume(code3); + size++; + return labelInside; + } + return labelInside(code3); + } + function labelAfter(code3) { + if (code3 === 58) { + effects.enter("definitionMarker"); + effects.consume(code3); + effects.exit("definitionMarker"); + if (!defined.includes(identifier)) { + defined.push(identifier); + } + return factorySpace( + effects, + whitespaceAfter, + "gfmFootnoteDefinitionWhitespace" + ); + } + return nok(code3); + } + function whitespaceAfter(code3) { + return ok3(code3); + } + } + function tokenizeDefinitionContinuation(effects, ok3, nok) { + return effects.check(blankLine, ok3, effects.attempt(indent, ok3, nok)); + } + function gfmFootnoteDefinitionEnd(effects) { + effects.exit("gfmFootnoteDefinition"); + } + function tokenizeIndent2(effects, ok3, nok) { + const self2 = this; + return factorySpace( + effects, + afterPrefix, + "gfmFootnoteDefinitionIndent", + 4 + 1 + ); + function afterPrefix(code3) { + const tail = self2.events[self2.events.length - 1]; + return tail && tail[1].type === "gfmFootnoteDefinitionIndent" && tail[2].sliceSerialize(tail[1], true).length === 4 ? ok3(code3) : nok(code3); + } + } + + // node_modules/micromark-extension-gfm-strikethrough/lib/syntax.js + function gfmStrikethrough(options2) { + const options_ = options2 || {}; + let single = options_.singleTilde; + const tokenizer = { + tokenize: tokenizeStrikethrough, + resolveAll: resolveAllStrikethrough + }; + if (single === null || single === void 0) { + single = true; + } + return { + text: { + [126]: tokenizer + }, + insideSpan: { + null: [tokenizer] + }, + attentionMarkers: { + null: [126] + } + }; + function resolveAllStrikethrough(events, context) { + let index2 = -1; + while (++index2 < events.length) { + if (events[index2][0] === "enter" && events[index2][1].type === "strikethroughSequenceTemporary" && events[index2][1]._close) { + let open = index2; + while (open--) { + if (events[open][0] === "exit" && events[open][1].type === "strikethroughSequenceTemporary" && events[open][1]._open && // If the sizes are the same: + events[index2][1].end.offset - events[index2][1].start.offset === events[open][1].end.offset - events[open][1].start.offset) { + events[index2][1].type = "strikethroughSequence"; + events[open][1].type = "strikethroughSequence"; + const strikethrough = { + type: "strikethrough", + start: Object.assign({}, events[open][1].start), + end: Object.assign({}, events[index2][1].end) + }; + const text5 = { + type: "strikethroughText", + start: Object.assign({}, events[open][1].end), + end: Object.assign({}, events[index2][1].start) + }; + const nextEvents = [ + ["enter", strikethrough, context], + ["enter", events[open][1], context], + ["exit", events[open][1], context], + ["enter", text5, context] + ]; + const insideSpan2 = context.parser.constructs.insideSpan.null; + if (insideSpan2) { + splice( + nextEvents, + nextEvents.length, + 0, + resolveAll(insideSpan2, events.slice(open + 1, index2), context) + ); + } + splice(nextEvents, nextEvents.length, 0, [ + ["exit", text5, context], + ["enter", events[index2][1], context], + ["exit", events[index2][1], context], + ["exit", strikethrough, context] + ]); + splice(events, open - 1, index2 - open + 3, nextEvents); + index2 = open + nextEvents.length - 2; + break; + } + } + } + } + index2 = -1; + while (++index2 < events.length) { + if (events[index2][1].type === "strikethroughSequenceTemporary") { + events[index2][1].type = "data"; + } + } + return events; + } + function tokenizeStrikethrough(effects, ok3, nok) { + const previous3 = this.previous; + const events = this.events; + let size = 0; + return start; + function start(code3) { + if (previous3 === 126 && events[events.length - 1][1].type !== "characterEscape") { + return nok(code3); + } + effects.enter("strikethroughSequenceTemporary"); + return more(code3); + } + function more(code3) { + const before = classifyCharacter(previous3); + if (code3 === 126) { + if (size > 1) return nok(code3); + effects.consume(code3); + size++; + return more; + } + if (size < 2 && !single) return nok(code3); + const token = effects.exit("strikethroughSequenceTemporary"); + const after = classifyCharacter(code3); + token._open = !after || after === 2 && Boolean(before); + token._close = !before || before === 2 && Boolean(after); + return ok3(code3); + } + } + } + + // node_modules/micromark-extension-gfm-table/lib/edit-map.js + var EditMap = class { + /** + * Create a new edit map. + */ + constructor() { + this.map = []; + } + /** + * Create an edit: a remove and/or add at a certain place. + * + * @param {number} index + * @param {number} remove + * @param {Array<Event>} add + * @returns {undefined} + */ + add(index2, remove, add) { + addImpl(this, index2, remove, add); + } + // To do: add this when moving to `micromark`. + // /** + // * Create an edit: but insert `add` before existing additions. + // * + // * @param {number} index + // * @param {number} remove + // * @param {Array<Event>} add + // * @returns {undefined} + // */ + // addBefore(index, remove, add) { + // addImpl(this, index, remove, add, true) + // } + /** + * Done, change the events. + * + * @param {Array<Event>} events + * @returns {undefined} + */ + consume(events) { + this.map.sort(function(a2, b4) { + return a2[0] - b4[0]; + }); + if (this.map.length === 0) { + return; + } + let index2 = this.map.length; + const vecs = []; + while (index2 > 0) { + index2 -= 1; + vecs.push( + events.slice(this.map[index2][0] + this.map[index2][1]), + this.map[index2][2] + ); + events.length = this.map[index2][0]; + } + vecs.push([...events]); + events.length = 0; + let slice = vecs.pop(); + while (slice) { + events.push(...slice); + slice = vecs.pop(); + } + this.map.length = 0; + } + }; + function addImpl(editMap, at4, remove, add) { + let index2 = 0; + if (remove === 0 && add.length === 0) { + return; + } + while (index2 < editMap.map.length) { + if (editMap.map[index2][0] === at4) { + editMap.map[index2][1] += remove; + editMap.map[index2][2].push(...add); + return; + } + index2 += 1; + } + editMap.map.push([at4, remove, add]); + } + + // node_modules/micromark-extension-gfm-table/lib/infer.js + function gfmTableAlign(events, index2) { + let inDelimiterRow = false; + const align = []; + while (index2 < events.length) { + const event = events[index2]; + if (inDelimiterRow) { + if (event[0] === "enter") { + if (event[1].type === "tableContent") { + align.push( + events[index2 + 1][1].type === "tableDelimiterMarker" ? "left" : "none" + ); + } + } else if (event[1].type === "tableContent") { + if (events[index2 - 1][1].type === "tableDelimiterMarker") { + const alignIndex = align.length - 1; + align[alignIndex] = align[alignIndex] === "left" ? "center" : "right"; + } + } else if (event[1].type === "tableDelimiterRow") { + break; + } + } else if (event[0] === "enter" && event[1].type === "tableDelimiterRow") { + inDelimiterRow = true; + } + index2 += 1; + } + return align; + } + + // node_modules/micromark-extension-gfm-table/lib/syntax.js + function gfmTable() { + return { + flow: { + null: { + tokenize: tokenizeTable, + resolveAll: resolveTable + } + } + }; + } + function tokenizeTable(effects, ok3, nok) { + const self2 = this; + let size = 0; + let sizeB = 0; + let seen; + return start; + function start(code3) { + let index2 = self2.events.length - 1; + while (index2 > -1) { + const type = self2.events[index2][1].type; + if (type === "lineEnding" || // Note: markdown-rs uses `whitespace` instead of `linePrefix` + type === "linePrefix") + index2--; + else break; + } + const tail = index2 > -1 ? self2.events[index2][1].type : null; + const next = tail === "tableHead" || tail === "tableRow" ? bodyRowStart : headRowBefore; + if (next === bodyRowStart && self2.parser.lazy[self2.now().line]) { + return nok(code3); + } + return next(code3); + } + function headRowBefore(code3) { + effects.enter("tableHead"); + effects.enter("tableRow"); + return headRowStart(code3); + } + function headRowStart(code3) { + if (code3 === 124) { + return headRowBreak(code3); + } + seen = true; + sizeB += 1; + return headRowBreak(code3); + } + function headRowBreak(code3) { + if (code3 === null) { + return nok(code3); + } + if (markdownLineEnding(code3)) { + if (sizeB > 1) { + sizeB = 0; + self2.interrupt = true; + effects.exit("tableRow"); + effects.enter("lineEnding"); + effects.consume(code3); + effects.exit("lineEnding"); + return headDelimiterStart; + } + return nok(code3); + } + if (markdownSpace(code3)) { + return factorySpace(effects, headRowBreak, "whitespace")(code3); + } + sizeB += 1; + if (seen) { + seen = false; + size += 1; + } + if (code3 === 124) { + effects.enter("tableCellDivider"); + effects.consume(code3); + effects.exit("tableCellDivider"); + seen = true; + return headRowBreak; + } + effects.enter("data"); + return headRowData(code3); + } + function headRowData(code3) { + if (code3 === null || code3 === 124 || markdownLineEndingOrSpace(code3)) { + effects.exit("data"); + return headRowBreak(code3); + } + effects.consume(code3); + return code3 === 92 ? headRowEscape : headRowData; + } + function headRowEscape(code3) { + if (code3 === 92 || code3 === 124) { + effects.consume(code3); + return headRowData; + } + return headRowData(code3); + } + function headDelimiterStart(code3) { + self2.interrupt = false; + if (self2.parser.lazy[self2.now().line]) { + return nok(code3); + } + effects.enter("tableDelimiterRow"); + seen = false; + if (markdownSpace(code3)) { + return factorySpace( + effects, + headDelimiterBefore, + "linePrefix", + self2.parser.constructs.disable.null.includes("codeIndented") ? void 0 : 4 + )(code3); + } + return headDelimiterBefore(code3); + } + function headDelimiterBefore(code3) { + if (code3 === 45 || code3 === 58) { + return headDelimiterValueBefore(code3); + } + if (code3 === 124) { + seen = true; + effects.enter("tableCellDivider"); + effects.consume(code3); + effects.exit("tableCellDivider"); + return headDelimiterCellBefore; + } + return headDelimiterNok(code3); + } + function headDelimiterCellBefore(code3) { + if (markdownSpace(code3)) { + return factorySpace(effects, headDelimiterValueBefore, "whitespace")(code3); + } + return headDelimiterValueBefore(code3); + } + function headDelimiterValueBefore(code3) { + if (code3 === 58) { + sizeB += 1; + seen = true; + effects.enter("tableDelimiterMarker"); + effects.consume(code3); + effects.exit("tableDelimiterMarker"); + return headDelimiterLeftAlignmentAfter; + } + if (code3 === 45) { + sizeB += 1; + return headDelimiterLeftAlignmentAfter(code3); + } + if (code3 === null || markdownLineEnding(code3)) { + return headDelimiterCellAfter(code3); + } + return headDelimiterNok(code3); + } + function headDelimiterLeftAlignmentAfter(code3) { + if (code3 === 45) { + effects.enter("tableDelimiterFiller"); + return headDelimiterFiller(code3); + } + return headDelimiterNok(code3); + } + function headDelimiterFiller(code3) { + if (code3 === 45) { + effects.consume(code3); + return headDelimiterFiller; + } + if (code3 === 58) { + seen = true; + effects.exit("tableDelimiterFiller"); + effects.enter("tableDelimiterMarker"); + effects.consume(code3); + effects.exit("tableDelimiterMarker"); + return headDelimiterRightAlignmentAfter; + } + effects.exit("tableDelimiterFiller"); + return headDelimiterRightAlignmentAfter(code3); + } + function headDelimiterRightAlignmentAfter(code3) { + if (markdownSpace(code3)) { + return factorySpace(effects, headDelimiterCellAfter, "whitespace")(code3); + } + return headDelimiterCellAfter(code3); + } + function headDelimiterCellAfter(code3) { + if (code3 === 124) { + return headDelimiterBefore(code3); + } + if (code3 === null || markdownLineEnding(code3)) { + if (!seen || size !== sizeB) { + return headDelimiterNok(code3); + } + effects.exit("tableDelimiterRow"); + effects.exit("tableHead"); + return ok3(code3); + } + return headDelimiterNok(code3); + } + function headDelimiterNok(code3) { + return nok(code3); + } + function bodyRowStart(code3) { + effects.enter("tableRow"); + return bodyRowBreak(code3); + } + function bodyRowBreak(code3) { + if (code3 === 124) { + effects.enter("tableCellDivider"); + effects.consume(code3); + effects.exit("tableCellDivider"); + return bodyRowBreak; + } + if (code3 === null || markdownLineEnding(code3)) { + effects.exit("tableRow"); + return ok3(code3); + } + if (markdownSpace(code3)) { + return factorySpace(effects, bodyRowBreak, "whitespace")(code3); + } + effects.enter("data"); + return bodyRowData(code3); + } + function bodyRowData(code3) { + if (code3 === null || code3 === 124 || markdownLineEndingOrSpace(code3)) { + effects.exit("data"); + return bodyRowBreak(code3); + } + effects.consume(code3); + return code3 === 92 ? bodyRowEscape : bodyRowData; + } + function bodyRowEscape(code3) { + if (code3 === 92 || code3 === 124) { + effects.consume(code3); + return bodyRowData; + } + return bodyRowData(code3); + } + } + function resolveTable(events, context) { + let index2 = -1; + let inFirstCellAwaitingPipe = true; + let rowKind = 0; + let lastCell = [0, 0, 0, 0]; + let cell = [0, 0, 0, 0]; + let afterHeadAwaitingFirstBodyRow = false; + let lastTableEnd = 0; + let currentTable; + let currentBody; + let currentCell; + const map5 = new EditMap(); + while (++index2 < events.length) { + const event = events[index2]; + const token = event[1]; + if (event[0] === "enter") { + if (token.type === "tableHead") { + afterHeadAwaitingFirstBodyRow = false; + if (lastTableEnd !== 0) { + flushTableEnd(map5, context, lastTableEnd, currentTable, currentBody); + currentBody = void 0; + lastTableEnd = 0; + } + currentTable = { + type: "table", + start: Object.assign({}, token.start), + // Note: correct end is set later. + end: Object.assign({}, token.end) + }; + map5.add(index2, 0, [["enter", currentTable, context]]); + } else if (token.type === "tableRow" || token.type === "tableDelimiterRow") { + inFirstCellAwaitingPipe = true; + currentCell = void 0; + lastCell = [0, 0, 0, 0]; + cell = [0, index2 + 1, 0, 0]; + if (afterHeadAwaitingFirstBodyRow) { + afterHeadAwaitingFirstBodyRow = false; + currentBody = { + type: "tableBody", + start: Object.assign({}, token.start), + // Note: correct end is set later. + end: Object.assign({}, token.end) + }; + map5.add(index2, 0, [["enter", currentBody, context]]); + } + rowKind = token.type === "tableDelimiterRow" ? 2 : currentBody ? 3 : 1; + } else if (rowKind && (token.type === "data" || token.type === "tableDelimiterMarker" || token.type === "tableDelimiterFiller")) { + inFirstCellAwaitingPipe = false; + if (cell[2] === 0) { + if (lastCell[1] !== 0) { + cell[0] = cell[1]; + currentCell = flushCell( + map5, + context, + lastCell, + rowKind, + void 0, + currentCell + ); + lastCell = [0, 0, 0, 0]; + } + cell[2] = index2; + } + } else if (token.type === "tableCellDivider") { + if (inFirstCellAwaitingPipe) { + inFirstCellAwaitingPipe = false; + } else { + if (lastCell[1] !== 0) { + cell[0] = cell[1]; + currentCell = flushCell( + map5, + context, + lastCell, + rowKind, + void 0, + currentCell + ); + } + lastCell = cell; + cell = [lastCell[1], index2, 0, 0]; + } + } + } else if (token.type === "tableHead") { + afterHeadAwaitingFirstBodyRow = true; + lastTableEnd = index2; + } else if (token.type === "tableRow" || token.type === "tableDelimiterRow") { + lastTableEnd = index2; + if (lastCell[1] !== 0) { + cell[0] = cell[1]; + currentCell = flushCell( + map5, + context, + lastCell, + rowKind, + index2, + currentCell + ); + } else if (cell[1] !== 0) { + currentCell = flushCell(map5, context, cell, rowKind, index2, currentCell); + } + rowKind = 0; + } else if (rowKind && (token.type === "data" || token.type === "tableDelimiterMarker" || token.type === "tableDelimiterFiller")) { + cell[3] = index2; + } + } + if (lastTableEnd !== 0) { + flushTableEnd(map5, context, lastTableEnd, currentTable, currentBody); + } + map5.consume(context.events); + index2 = -1; + while (++index2 < context.events.length) { + const event = context.events[index2]; + if (event[0] === "enter" && event[1].type === "table") { + event[1]._align = gfmTableAlign(context.events, index2); + } + } + return events; + } + function flushCell(map5, context, range, rowKind, rowEnd, previousCell) { + const groupName = rowKind === 1 ? "tableHeader" : rowKind === 2 ? "tableDelimiter" : "tableData"; + const valueName = "tableContent"; + if (range[0] !== 0) { + previousCell.end = Object.assign({}, getPoint(context.events, range[0])); + map5.add(range[0], 0, [["exit", previousCell, context]]); + } + const now = getPoint(context.events, range[1]); + previousCell = { + type: groupName, + start: Object.assign({}, now), + // Note: correct end is set later. + end: Object.assign({}, now) + }; + map5.add(range[1], 0, [["enter", previousCell, context]]); + if (range[2] !== 0) { + const relatedStart = getPoint(context.events, range[2]); + const relatedEnd = getPoint(context.events, range[3]); + const valueToken = { + type: valueName, + start: Object.assign({}, relatedStart), + end: Object.assign({}, relatedEnd) + }; + map5.add(range[2], 0, [["enter", valueToken, context]]); + if (rowKind !== 2) { + const start = context.events[range[2]]; + const end = context.events[range[3]]; + start[1].end = Object.assign({}, end[1].end); + start[1].type = "chunkText"; + start[1].contentType = "text"; + if (range[3] > range[2] + 1) { + const a2 = range[2] + 1; + const b4 = range[3] - range[2] - 1; + map5.add(a2, b4, []); + } + } + map5.add(range[3] + 1, 0, [["exit", valueToken, context]]); + } + if (rowEnd !== void 0) { + previousCell.end = Object.assign({}, getPoint(context.events, rowEnd)); + map5.add(rowEnd, 0, [["exit", previousCell, context]]); + previousCell = void 0; + } + return previousCell; + } + function flushTableEnd(map5, context, index2, table, tableBody) { + const exits = []; + const related = getPoint(context.events, index2); + if (tableBody) { + tableBody.end = Object.assign({}, related); + exits.push(["exit", tableBody, context]); + } + table.end = Object.assign({}, related); + exits.push(["exit", table, context]); + map5.add(index2 + 1, 0, exits); + } + function getPoint(events, index2) { + const event = events[index2]; + const side = event[0] === "enter" ? "start" : "end"; + return event[1][side]; + } + + // node_modules/micromark-extension-gfm-task-list-item/lib/syntax.js + var tasklistCheck = { + tokenize: tokenizeTasklistCheck + }; + function gfmTaskListItem() { + return { + text: { + [91]: tasklistCheck + } + }; + } + function tokenizeTasklistCheck(effects, ok3, nok) { + const self2 = this; + return open; + function open(code3) { + if ( + // Exit if there’s stuff before. + self2.previous !== null || // Exit if not in the first content that is the first child of a list + // item. + !self2._gfmTasklistFirstContentOfListItem + ) { + return nok(code3); + } + effects.enter("taskListCheck"); + effects.enter("taskListCheckMarker"); + effects.consume(code3); + effects.exit("taskListCheckMarker"); + return inside; + } + function inside(code3) { + if (markdownLineEndingOrSpace(code3)) { + effects.enter("taskListCheckValueUnchecked"); + effects.consume(code3); + effects.exit("taskListCheckValueUnchecked"); + return close2; + } + if (code3 === 88 || code3 === 120) { + effects.enter("taskListCheckValueChecked"); + effects.consume(code3); + effects.exit("taskListCheckValueChecked"); + return close2; + } + return nok(code3); + } + function close2(code3) { + if (code3 === 93) { + effects.enter("taskListCheckMarker"); + effects.consume(code3); + effects.exit("taskListCheckMarker"); + effects.exit("taskListCheck"); + return after; + } + return nok(code3); + } + function after(code3) { + if (markdownLineEnding(code3)) { + return ok3(code3); + } + if (markdownSpace(code3)) { + return effects.check( + { + tokenize: spaceThenNonSpace + }, + ok3, + nok + )(code3); + } + return nok(code3); + } + } + function spaceThenNonSpace(effects, ok3, nok) { + return factorySpace(effects, after, "whitespace"); + function after(code3) { + return code3 === null ? nok(code3) : ok3(code3); + } + } + + // node_modules/micromark-extension-gfm/index.js + function gfm(options2) { + return combineExtensions([ + gfmAutolinkLiteral(), + gfmFootnote(), + gfmStrikethrough(options2), + gfmTable(), + gfmTaskListItem() + ]); + } + + // node_modules/remark-gfm/lib/index.js + var emptyOptions2 = {}; + function remarkGfm(options2) { + const self2 = ( + /** @type {Processor} */ + this + ); + const settings = options2 || emptyOptions2; + const data = self2.data(); + const micromarkExtensions = data.micromarkExtensions || (data.micromarkExtensions = []); + const fromMarkdownExtensions = data.fromMarkdownExtensions || (data.fromMarkdownExtensions = []); + const toMarkdownExtensions = data.toMarkdownExtensions || (data.toMarkdownExtensions = []); + micromarkExtensions.push(gfm(settings)); + fromMarkdownExtensions.push(gfmFromMarkdown()); + toMarkdownExtensions.push(gfmToMarkdown(settings)); + } + + // node_modules/@milkdown/preset-gfm/lib/index.es.js + function d5(e2, t2) { + return Object.assign(e2, { + meta: __spreadValues({ + package: "@milkdown/preset-gfm" + }, t2) + }), e2; + } + var K4 = we2("strike_through"); + d5(K4, { + displayName: "Attr<strikethrough>", + group: "Strikethrough" + }); + var T5 = ye2("strike_through", (e2) => ({ + parseDOM: [ + { tag: "del" }, + { style: "text-decoration", getAttrs: (t2) => t2 === "line-through" } + ], + toDOM: (t2) => ["del", e2.get(K4.key)(t2)], + parseMarkdown: { + match: (t2) => t2.type === "delete", + runner: (t2, n4, o2) => { + t2.openMark(o2), t2.next(n4.children), t2.closeMark(o2); + } + }, + toMarkdown: { + match: (t2) => t2.type.name === "strike_through", + runner: (t2, n4) => { + t2.withMark(n4, "delete"); + } + } + })); + d5(T5.mark, { + displayName: "MarkSchema<strikethrough>", + group: "Strikethrough" + }); + d5(T5.ctx, { + displayName: "MarkSchemaCtx<strikethrough>", + group: "Strikethrough" + }); + var H5 = re2("ToggleStrikeThrough", (e2) => () => toggleMark(T5.type(e2))); + d5(H5, { + displayName: "Command<ToggleStrikethrough>", + group: "Strikethrough" + }); + var ae3 = oe2((e2) => markRule(/~([^~]+)~$/, T5.type(e2))); + d5(ae3, { + displayName: "InputRule<strikethrough>", + group: "Strikethrough" + }); + var L5 = ge2("strikeThroughKeymap", { + ToggleStrikethrough: { + shortcuts: "Mod-Alt-x", + command: (e2) => { + const t2 = e2.get(je); + return () => t2.call(H5.key); + } + } + }); + d5(L5.ctx, { + displayName: "KeymapCtx<strikethrough>", + group: "Strikethrough" + }); + d5(L5.shortcuts, { + displayName: "Keymap<strikethrough>", + group: "Strikethrough" + }); + function se3(e2, t2 = 3, n4 = 3) { + const o2 = Array(n4).fill(0).map(() => M6.type(e2).createAndFill()), l5 = Array(n4).fill(0).map(() => I3.type(e2).createAndFill()), r3 = Array(t2).fill(0).map((s2, c6) => R5.type(e2).create(null, c6 === 0 ? l5 : o2)); + return S7.type(e2).create(null, r3); + } + function w6(e2) { + return findParentNode((t2) => t2.type.spec.tableRole === "table")(e2); + } + function b3(e2, t2) { + const n4 = w6(t2); + if (!n4) + return; + const o2 = TableMap.get(n4.node); + if (!(e2 < 0 || e2 >= o2.width)) + return o2.cellsInRect({ left: e2, right: e2 + 1, top: 0, bottom: o2.height }).map((l5) => { + const r3 = n4.node.nodeAt(l5); + if (!r3) + return; + const s2 = l5 + n4.start; + return { + pos: s2, + start: s2 + 1, + node: r3 + }; + }).filter((l5) => l5 != null); + } + function C4(e2, t2) { + const n4 = w6(t2); + if (!n4) + return; + const o2 = TableMap.get(n4.node); + if (!(e2 < 0 || e2 >= o2.height)) + return o2.cellsInRect({ left: 0, right: o2.width, top: e2, bottom: e2 + 1 }).map((l5) => { + const r3 = n4.node.nodeAt(l5); + if (!r3) + return; + const s2 = l5 + n4.start; + return { + pos: s2, + start: s2 + 1, + node: r3 + }; + }).filter((l5) => l5 != null); + } + function Je(e2) { + const t2 = w6(e2); + if (!t2) + return; + const n4 = TableMap.get(t2.node); + return n4.cellsInRect({ + left: 0, + right: n4.width, + top: 0, + bottom: n4.height + }).map((l5) => { + const r3 = t2.node.nodeAt(l5), s2 = l5 + t2.start; + return { pos: s2, start: s2 + 1, node: r3 }; + }); + } + function Qe(e2) { + const t2 = Je(e2.selection); + if (t2 && t2[0]) { + const n4 = e2.doc.resolve(t2[0].pos), o2 = t2[t2.length - 1]; + if (o2) { + const l5 = e2.doc.resolve(o2.pos); + return cloneTr(e2.setSelection(new CellSelection(l5, n4))); + } + } + return e2; + } + function ce3(e2, t2, { map: n4, tableStart: o2, table: l5 }, r3) { + const s2 = Array(r3).fill(0).reduce((i2, m3, a2) => i2 + l5.child(a2).nodeSize, o2), c6 = Array(n4.width).fill(0).map((i2, m3) => { + const a2 = l5.nodeAt(n4.map[m3]); + return M6.type(e2).createAndFill({ alignment: a2 == null ? void 0 : a2.attrs.alignment }); + }); + return t2.insert(s2, R5.type(e2).create(null, c6)), t2; + } + function ie6(e2) { + return (t2) => (n4) => { + const o2 = w6(n4.selection), l5 = e2 === "row"; + if (o2) { + const r3 = TableMap.get(o2.node); + if (t2 >= 0 && t2 < (l5 ? r3.height : r3.width)) { + const s2 = r3.positionAt( + l5 ? t2 : r3.height - 1, + l5 ? r3.width - 1 : t2, + o2.node + ), c6 = n4.doc.resolve(o2.start + s2), i2 = l5 ? CellSelection.rowSelection : CellSelection.colSelection, m3 = r3.positionAt(l5 ? t2 : 0, l5 ? 0 : t2, o2.node), a2 = n4.doc.resolve(o2.start + m3); + return cloneTr(n4.setSelection(i2(c6, a2))); + } + } + return n4; + }; + } + var Ye = ie6("row"); + var et = ie6("col"); + function q6(e2) { + return e2[0].map((t2, n4) => e2.map((o2) => o2[n4])); + } + function de2(e2, t2) { + const n4 = [], o2 = TableMap.get(e2); + for (let r3 = 0; r3 < o2.height; r3++) { + const s2 = e2.child(r3), c6 = []; + for (let i2 = 0; i2 < o2.width; i2++) { + if (!t2[r3][i2]) + continue; + const m3 = o2.map[r3 * o2.width + i2], a2 = t2[r3][i2], p4 = e2.nodeAt(m3).type.createChecked( + Object.assign({}, a2.attrs), + a2.content, + a2.marks + ); + c6.push(p4); + } + n4.push(s2.type.createChecked(s2.attrs, c6, s2.marks)); + } + return e2.type.createChecked( + e2.attrs, + n4, + e2.marks + ); + } + function me3(e2) { + const t2 = TableMap.get(e2), n4 = []; + for (let o2 = 0; o2 < t2.height; o2++) { + const l5 = [], r3 = {}; + for (let s2 = 0; s2 < t2.width; s2++) { + const c6 = t2.map[o2 * t2.width + s2], i2 = e2.nodeAt(c6), m3 = t2.findCell(c6); + if (r3[c6] || m3.top !== o2) { + l5.push(null); + continue; + } + r3[c6] = true, l5.push(i2); + } + n4.push(l5); + } + return n4; + } + function ue4(e2, t2, n4, o2) { + const l5 = t2[0] > n4[0] ? -1 : 1, r3 = e2.splice(t2[0], t2.length), s2 = r3.length % 2 === 0 ? 1 : 0; + let c6; + return o2 === -1 && l5 === 1 ? c6 = n4[0] - 1 : o2 === 1 && l5 === -1 ? c6 = n4[n4.length - 1] - s2 + 1 : c6 = l5 === -1 ? n4[0] : n4[n4.length - 1] - s2, e2.splice(c6, 0, ...r3), e2; + } + function tt(e2, t2, n4, o2) { + let l5 = q6(me3(e2.node)); + return l5 = ue4(l5, t2, n4, o2), l5 = q6(l5), de2(e2.node, l5); + } + function ot3(e2, t2, n4, o2) { + let l5 = me3(e2.node); + return l5 = ue4(l5, t2, n4, o2), de2(e2.node, l5); + } + function J5(e2, t2) { + let n4 = e2, o2 = e2; + for (let a2 = e2; a2 >= 0; a2--) { + const u4 = b3(a2, t2.selection); + u4 && u4.forEach((p4) => { + const f3 = p4.node.attrs.colspan + a2 - 1; + f3 >= n4 && (n4 = a2), f3 > o2 && (o2 = f3); + }); + } + for (let a2 = e2; a2 <= o2; a2++) { + const u4 = b3(a2, t2.selection); + u4 && u4.forEach((p4) => { + const f3 = p4.node.attrs.colspan + a2 - 1; + p4.node.attrs.colspan > 1 && f3 > o2 && (o2 = f3); + }); + } + const l5 = []; + for (let a2 = n4; a2 <= o2; a2++) { + const u4 = b3(a2, t2.selection); + u4 && u4.length && l5.push(a2); + } + n4 = l5[0], o2 = l5[l5.length - 1]; + const r3 = b3(n4, t2.selection), s2 = C4(0, t2.selection), c6 = t2.doc.resolve( + r3[r3.length - 1].pos + ); + let i2; + for (let a2 = o2; a2 >= n4; a2--) { + const u4 = b3(a2, t2.selection); + if (u4 && u4.length) { + for (let p4 = s2.length - 1; p4 >= 0; p4--) + if (s2[p4].pos === u4[0].pos) { + i2 = u4[0]; + break; + } + if (i2) + break; + } + } + const m3 = t2.doc.resolve(i2.pos); + return { $anchor: c6, $head: m3, indexes: l5 }; + } + function Q4(e2, t2) { + let n4 = e2, o2 = e2; + for (let a2 = e2; a2 >= 0; a2--) + C4(a2, t2.selection).forEach((p4) => { + const f3 = p4.node.attrs.rowspan + a2 - 1; + f3 >= n4 && (n4 = a2), f3 > o2 && (o2 = f3); + }); + for (let a2 = e2; a2 <= o2; a2++) + C4(a2, t2.selection).forEach((p4) => { + const f3 = p4.node.attrs.rowspan + a2 - 1; + p4.node.attrs.rowspan > 1 && f3 > o2 && (o2 = f3); + }); + const l5 = []; + for (let a2 = n4; a2 <= o2; a2++) { + const u4 = C4(a2, t2.selection); + u4 && u4.length && l5.push(a2); + } + n4 = l5[0], o2 = l5[l5.length - 1]; + const r3 = C4(n4, t2.selection), s2 = b3(0, t2.selection), c6 = t2.doc.resolve(r3[r3.length - 1].pos); + let i2; + for (let a2 = o2; a2 >= n4; a2--) { + const u4 = C4(a2, t2.selection); + if (u4 && u4.length) { + for (let p4 = s2.length - 1; p4 >= 0; p4--) + if (s2[p4].pos === u4[0].pos) { + i2 = u4[0]; + break; + } + if (i2) + break; + } + } + const m3 = t2.doc.resolve(i2.pos); + return { $anchor: c6, $head: m3, indexes: l5 }; + } + function nt2(e2, t2, n4, o2 = true) { + const l5 = w6(e2.selection); + if (!l5) + return e2; + const { indexes: r3 } = J5(t2, e2), { indexes: s2 } = J5(n4, e2); + if (r3.includes(n4)) + return e2; + const c6 = tt( + l5, + r3, + s2, + 0 + ), i2 = cloneTr(e2).replaceWith( + l5.pos, + l5.pos + l5.node.nodeSize, + c6 + ); + if (!o2) + return i2; + const m3 = TableMap.get(c6), a2 = l5.start, u4 = n4, p4 = m3.positionAt(m3.height - 1, u4, c6), f3 = i2.doc.resolve(a2 + p4), $3 = CellSelection.colSelection, P4 = m3.positionAt(0, u4, c6), _3 = i2.doc.resolve(a2 + P4); + return i2.setSelection($3(f3, _3)); + } + function lt3(e2, t2, n4, o2 = true) { + const l5 = w6(e2.selection); + if (!l5) + return e2; + const { indexes: r3 } = Q4(t2, e2), { indexes: s2 } = Q4(n4, e2); + if (r3.includes(n4)) + return e2; + const c6 = ot3( + l5, + r3, + s2, + 0 + ), i2 = cloneTr(e2).replaceWith( + l5.pos, + l5.pos + l5.node.nodeSize, + c6 + ); + if (!o2) + return i2; + const m3 = TableMap.get(c6), a2 = l5.start, u4 = n4, p4 = m3.positionAt(u4, m3.width - 1, c6), f3 = i2.doc.resolve(a2 + p4), $3 = CellSelection.rowSelection, P4 = m3.positionAt(u4, 0, c6), _3 = i2.doc.resolve(a2 + P4); + return i2.setSelection($3(f3, _3)); + } + var v3 = tableNodes({ + tableGroup: "block", + cellContent: "paragraph", + cellAttributes: { + alignment: { + default: "left", + getFromDOM: (e2) => e2.style.textAlign || "left", + setDOMAttr: (e2, t2) => { + t2.style = `text-align: ${e2 || "left"}`; + } + } + } + }); + var S7 = fe2("table", () => __spreadProps(__spreadValues({}, v3.table), { + parseMarkdown: { + match: (e2) => e2.type === "table", + runner: (e2, t2, n4) => { + const o2 = t2.align, l5 = t2.children.map((r3, s2) => __spreadProps(__spreadValues({}, r3), { + align: o2, + isHeader: s2 === 0 + })); + e2.openNode(n4), e2.next(l5), e2.closeNode(); + } + }, + toMarkdown: { + match: (e2) => e2.type.name === "table", + runner: (e2, t2) => { + var l5; + const n4 = (l5 = t2.content.firstChild) == null ? void 0 : l5.content; + if (!n4) + return; + const o2 = []; + n4.forEach((r3) => { + o2.push(r3.attrs.alignment); + }), e2.openNode("table", void 0, { align: o2 }), e2.next(t2.content), e2.closeNode(); + } + } + })); + d5(S7.node, { + displayName: "NodeSchema<table>", + group: "Table" + }); + d5(S7.ctx, { + displayName: "NodeSchemaCtx<table>", + group: "Table" + }); + var R5 = fe2("table_row", () => __spreadProps(__spreadValues({}, v3.table_row), { + parseMarkdown: { + match: (e2) => e2.type === "tableRow", + runner: (e2, t2, n4) => { + const o2 = t2.align, l5 = t2.children.map((r3, s2) => __spreadProps(__spreadValues({}, r3), { + align: o2[s2], + isHeader: t2.isHeader + })); + e2.openNode(n4), e2.next(l5), e2.closeNode(); + } + }, + toMarkdown: { + match: (e2) => e2.type.name === "table_row", + runner: (e2, t2) => { + e2.openNode("tableRow"), e2.next(t2.content), e2.closeNode(); + } + } + })); + d5(R5.node, { + displayName: "NodeSchema<tableRow>", + group: "Table" + }); + d5(R5.ctx, { + displayName: "NodeSchemaCtx<tableRow>", + group: "Table" + }); + var M6 = fe2("table_cell", () => __spreadProps(__spreadValues({}, v3.table_cell), { + parseMarkdown: { + match: (e2) => e2.type === "tableCell" && !e2.isHeader, + runner: (e2, t2, n4) => { + const o2 = t2.align; + e2.openNode(n4, { alignment: o2 }).openNode(e2.schema.nodes.paragraph).next(t2.children).closeNode().closeNode(); + } + }, + toMarkdown: { + match: (e2) => e2.type.name === "table_cell", + runner: (e2, t2) => { + e2.openNode("tableCell").next(t2.content).closeNode(); + } + } + })); + d5(M6.node, { + displayName: "NodeSchema<tableCell>", + group: "Table" + }); + d5(M6.ctx, { + displayName: "NodeSchemaCtx<tableCell>", + group: "Table" + }); + var I3 = fe2("table_header", () => __spreadProps(__spreadValues({}, v3.table_header), { + parseMarkdown: { + match: (e2) => e2.type === "tableCell" && !!e2.isHeader, + runner: (e2, t2, n4) => { + const o2 = t2.align; + e2.openNode(n4, { alignment: o2 }), e2.openNode(e2.schema.nodes.paragraph), e2.next(t2.children), e2.closeNode(), e2.closeNode(); + } + }, + toMarkdown: { + match: (e2) => e2.type.name === "table_header", + runner: (e2, t2) => { + e2.openNode("tableCell"), e2.next(t2.content), e2.closeNode(); + } + } + })); + d5(I3.node, { + displayName: "NodeSchema<tableHeader>", + group: "Table" + }); + d5(I3.ctx, { + displayName: "NodeSchemaCtx<tableHeader>", + group: "Table" + }); + var pe3 = oe2((e2) => new InputRule( + new RegExp("^\\|(?<col>\\d+)[xX](?<row>\\d+)\\|\\s$"), + (t2, n4, o2, l5) => { + var i2, m3; + const r3 = t2.doc.resolve(o2); + if (!r3.node(-1).canReplaceWith(r3.index(-1), r3.indexAfter(-1), S7.type(e2))) + return null; + const s2 = se3( + e2, + Number((i2 = n4.groups) == null ? void 0 : i2.row), + Number((m3 = n4.groups) == null ? void 0 : m3.col) + ), c6 = t2.tr.replaceRangeWith(o2, l5, s2); + return c6.setSelection(TextSelection.create(c6.doc, o2 + 3)).scrollIntoView(); + } + )); + d5(pe3, { + displayName: "InputRule<insertTableInputRule>", + group: "Table" + }); + var W5 = re2("GoToPrevTableCell", () => () => goToNextCell(-1)); + d5(W5, { + displayName: "Command<goToPrevTableCellCommand>", + group: "Table" + }); + var G4 = re2("GoToNextTableCell", () => () => goToNextCell(1)); + d5(G4, { + displayName: "Command<goToNextTableCellCommand>", + group: "Table" + }); + var z4 = re2("BreakTable", (e2) => () => (t2, n4) => { + if (!isInTable(t2)) + return false; + const { $head: o2 } = t2.selection, l5 = o2.after(), r3 = t2.tr.replaceWith(l5, l5, w5.type(e2).createAndFill()); + return r3.setSelection(Selection.near(r3.doc.resolve(l5), 1)).scrollIntoView(), n4 == null || n4(r3), true; + }); + d5(z4, { + displayName: "Command<breakTableCommand>", + group: "Table" + }); + var fe4 = re2("InsertTable", (e2) => ({ row: t2, col: n4 } = {}) => (o2, l5) => { + const { selection: r3, tr: s2 } = o2, { from: c6 } = r3, i2 = se3(e2, t2, n4), m3 = s2.replaceSelectionWith(i2), a2 = Selection.findFrom(m3.doc.resolve(c6), 1, true); + return a2 && m3.setSelection(a2), l5 == null || l5(m3), true; + }); + d5(fe4, { + displayName: "Command<insertTableCommand>", + group: "Table" + }); + var he3 = re2("MoveRow", () => ({ from: e2, to: t2 } = {}) => (n4, o2) => { + const { tr: l5 } = n4; + return !!(o2 == null ? void 0 : o2(lt3(l5, e2 != null ? e2 : 0, t2 != null ? t2 : 0, true))); + }); + d5(he3, { + displayName: "Command<moveRowCommand>", + group: "Table" + }); + var ge4 = re2("MoveCol", () => ({ from: e2, to: t2 } = {}) => (n4, o2) => { + const { tr: l5 } = n4; + return !!(o2 == null ? void 0 : o2(nt2(l5, e2 != null ? e2 : 0, t2 != null ? t2 : 0, true))); + }); + d5(ge4, { + displayName: "Command<moveColCommand>", + group: "Table" + }); + var be2 = re2("SelectRow", () => (e2 = 0) => (t2, n4) => { + const { tr: o2 } = t2; + return !!(n4 == null ? void 0 : n4(Ye(e2)(o2))); + }); + d5(be2, { + displayName: "Command<selectRowCommand>", + group: "Table" + }); + var Ce4 = re2("SelectCol", () => (e2 = 0) => (t2, n4) => { + const { tr: o2 } = t2; + return !!(n4 == null ? void 0 : n4(et(e2)(o2))); + }); + d5(Ce4, { + displayName: "Command<selectColCommand>", + group: "Table" + }); + var ye4 = re2("SelectTable", () => () => (e2, t2) => { + const { tr: n4 } = e2; + return !!(t2 == null ? void 0 : t2(Qe(n4))); + }); + d5(ye4, { + displayName: "Command<selectTableCommand>", + group: "Table" + }); + var ke4 = re2("DeleteSelectedCells", () => () => (e2, t2) => { + const { selection: n4 } = e2; + if (!(n4 instanceof CellSelection)) + return false; + const o2 = n4.isRowSelection(), l5 = n4.isColSelection(); + return o2 && l5 ? deleteTable(e2, t2) : l5 ? deleteColumn(e2, t2) : deleteRow(e2, t2); + }); + d5(ke4, { + displayName: "Command<deleteSelectedCellsCommand>", + group: "Table" + }); + var we4 = re2("AddColBefore", () => () => addColumnBefore); + d5(we4, { + displayName: "Command<addColBeforeCommand>", + group: "Table" + }); + var Ne3 = re2("AddColAfter", () => () => addColumnAfter); + d5(Ne3, { + displayName: "Command<addColAfterCommand>", + group: "Table" + }); + var Te3 = re2("AddRowBefore", (e2) => () => (t2, n4) => { + if (!isInTable(t2)) + return false; + if (n4) { + const o2 = selectedRect(t2); + n4(ce3(e2, t2.tr, o2, o2.top)); + } + return true; + }); + d5(Te3, { + displayName: "Command<addRowBeforeCommand>", + group: "Table" + }); + var Se2 = re2("AddRowAfter", (e2) => () => (t2, n4) => { + if (!isInTable(t2)) + return false; + if (n4) { + const o2 = selectedRect(t2); + n4(ce3(e2, t2.tr, o2, o2.bottom)); + } + return true; + }); + d5(Se2, { + displayName: "Command<addRowAfterCommand>", + group: "Table" + }); + var Re2 = re2("SetAlign", () => (e2 = "left") => setCellAttr("alignment", e2)); + d5(Re2, { + displayName: "Command<setAlignCommand>", + group: "Table" + }); + var j5 = ge2("tableKeymap", { + NextCell: { + shortcuts: ["Mod-]", "Tab"], + command: (e2) => { + const t2 = e2.get(je); + return () => t2.call(G4.key); + } + }, + PrevCell: { + shortcuts: ["Mod-[", "Shift-Tab"], + command: (e2) => { + const t2 = e2.get(je); + return () => t2.call(W5.key); + } + }, + ExitTable: { + shortcuts: ["Mod-Enter"], + command: (e2) => { + const t2 = e2.get(je); + return () => t2.call(z4.key); + } + } + }); + d5(j5.ctx, { + displayName: "KeymapCtx<table>", + group: "Table" + }); + d5(j5.shortcuts, { + displayName: "Keymap<table>", + group: "Table" + }); + var E4 = "footnote_definition"; + var Y2 = "footnoteDefinition"; + var Z4 = fe2("footnote_definition", () => ({ + group: "block", + content: "block+", + defining: true, + attrs: { + label: { + default: "" + } + }, + parseDOM: [ + { + tag: `dl[data-type="${E4}"]`, + getAttrs: (e2) => { + if (!(e2 instanceof HTMLElement)) + throw S(e2); + return { + label: e2.dataset.label + }; + }, + contentElement: "dd" + } + ], + toDOM: (e2) => { + const t2 = e2.attrs.label; + return [ + "dl", + { + // TODO: add a prosemirror plugin to sync label on change + "data-label": t2, + "data-type": E4 + }, + ["dt", t2], + ["dd", 0] + ]; + }, + parseMarkdown: { + match: ({ type: e2 }) => e2 === Y2, + runner: (e2, t2, n4) => { + e2.openNode(n4, { + label: t2.label + }).next(t2.children).closeNode(); + } + }, + toMarkdown: { + match: (e2) => e2.type.name === E4, + runner: (e2, t2) => { + e2.openNode(Y2, void 0, { + label: t2.attrs.label, + identifier: t2.attrs.label + }).next(t2.content).closeNode(); + } + } + })); + d5(Z4.ctx, { + displayName: "NodeSchemaCtx<footnodeDef>", + group: "footnote" + }); + d5(Z4.node, { + displayName: "NodeSchema<footnodeDef>", + group: "footnote" + }); + var D3 = "footnote_reference"; + var V3 = fe2("footnote_reference", () => ({ + group: "inline", + inline: true, + atom: true, + attrs: { + label: { + default: "" + } + }, + parseDOM: [ + { + tag: `sup[data-type="${D3}"]`, + getAttrs: (e2) => { + if (!(e2 instanceof HTMLElement)) + throw S(e2); + return { + label: e2.dataset.label + }; + } + } + ], + toDOM: (e2) => { + const t2 = e2.attrs.label; + return [ + "sup", + { + // TODO: add a prosemirror plugin to sync label on change + "data-label": t2, + "data-type": D3 + }, + t2 + ]; + }, + parseMarkdown: { + match: ({ type: e2 }) => e2 === "footnoteReference", + runner: (e2, t2, n4) => { + e2.addNode(n4, { + label: t2.label + }); + } + }, + toMarkdown: { + match: (e2) => e2.type.name === D3, + runner: (e2, t2) => { + e2.addNode("footnoteReference", void 0, void 0, { + label: t2.attrs.label, + identifier: t2.attrs.label + }); + } + } + })); + d5(V3.ctx, { + displayName: "NodeSchemaCtx<footnodeRef>", + group: "footnote" + }); + d5(V3.node, { + displayName: "NodeSchema<footnodeRef>", + group: "footnote" + }); + var Me3 = M5.extendSchema((e2) => (t2) => { + const n4 = e2(t2); + return __spreadProps(__spreadValues({}, n4), { + attrs: __spreadProps(__spreadValues({}, n4.attrs), { + checked: { + default: null + } + }), + parseDOM: [ + { + tag: 'li[data-item-type="task"]', + getAttrs: (o2) => { + if (!(o2 instanceof HTMLElement)) + throw S(o2); + return { + label: o2.dataset.label, + listType: o2.dataset["list-type"], + spread: o2.dataset.spread, + checked: o2.dataset.checked ? o2.dataset.checked === "true" : null + }; + } + }, + ...(n4 == null ? void 0 : n4.parseDOM) || [] + ], + toDOM: (o2) => n4.toDOM && o2.attrs.checked == null ? n4.toDOM(o2) : [ + "li", + { + "data-item-type": "task", + "data-label": o2.attrs.label, + "data-list-type": o2.attrs.listType, + "data-spread": o2.attrs.spread, + "data-checked": o2.attrs.checked + }, + 0 + ], + parseMarkdown: { + match: ({ type: o2 }) => o2 === "listItem", + runner: (o2, l5, r3) => { + if (l5.checked == null) { + n4.parseMarkdown.runner(o2, l5, r3); + return; + } + const s2 = l5.label != null ? `${l5.label}.` : "\u2022", c6 = l5.checked != null ? !!l5.checked : null, i2 = l5.label != null ? "ordered" : "bullet", m3 = l5.spread != null ? `${l5.spread}` : "true"; + o2.openNode(r3, { label: s2, listType: i2, spread: m3, checked: c6 }), o2.next(l5.children), o2.closeNode(); + } + }, + toMarkdown: { + match: (o2) => o2.type.name === "list_item", + runner: (o2, l5) => { + if (l5.attrs.checked == null) { + n4.toMarkdown.runner(o2, l5); + return; + } + const r3 = l5.attrs.label, s2 = l5.attrs.listType, c6 = l5.attrs.spread === "true", i2 = l5.attrs.checked; + o2.openNode("listItem", void 0, { label: r3, listType: s2, spread: c6, checked: i2 }), o2.next(l5.content), o2.closeNode(); + } + } + }); + }); + d5(Me3, { + displayName: "NodeSchema<listItem>", + group: "ListItem" + }); + var Ae3 = oe2(() => new InputRule(new RegExp("^\\[(?<checked>\\s|x)\\]\\s$"), (e2, t2, n4, o2) => { + var a2; + const l5 = e2.doc.resolve(n4); + let r3 = 0, s2 = l5.node(r3); + for (; s2 && s2.type.name !== "list_item"; ) + r3--, s2 = l5.node(r3); + if (!s2 || s2.attrs.checked != null) + return null; + const c6 = ((a2 = t2.groups) == null ? void 0 : a2.checked) === "x", i2 = l5.before(r3), m3 = e2.tr; + return m3.deleteRange(n4, o2).setNodeMarkup(i2, void 0, __spreadProps(__spreadValues({}, s2.attrs), { checked: c6 })), m3; + })); + d5(Ae3, { + displayName: "InputRule<wrapInTaskListInputRule>", + group: "ListItem" + }); + var rt = [ + L5, + j5 + ].flat(); + var at3 = [ + pe3, + Ae3 + ]; + var st2 = [ + ae3 + ]; + var xe2 = ue2((e2) => { + const t2 = new PluginKey("MILKDOWN_AUTO_INSERT_ZERO_SPACE"), n4 = (l5) => l5.type === w5.type(e2), o2 = (l5) => n4(l5) && l5.nodeSize === 2; + return new Plugin({ + key: t2, + props: { + handleDOMEvents: { + compositionstart(l5) { + const { state: r3, dispatch: s2 } = l5, { tr: c6, selection: i2 } = r3, { $from: m3 } = i2; + return browser.safari && isInTable(r3) && i2.empty && o2(m3.parent) && s2(c6.insertText("\u2060", m3.start())), false; + }, + compositionend(l5) { + const { state: r3, dispatch: s2 } = l5, { tr: c6, selection: i2 } = r3, { $from: m3 } = i2; + return browser.safari && isInTable(r3) && i2.empty && n4(m3.parent) && m3.parent.textContent.startsWith("\u2060") && s2(c6.delete(m3.start(), m3.start() + 1)), false; + } + } + } + }); + }); + d5(xe2, { + displayName: "Prose<autoInsertZeroSpaceInTablePlugin>", + group: "Prose" + }); + var ve3 = ue2(() => columnResizing({})); + d5(ve3, { + displayName: "Prose<columnResizingPlugin>", + group: "Prose" + }); + var Ie3 = ue2(() => tableEditing()); + d5(Ie3, { + displayName: "Prose<tableEditingPlugin>", + group: "Prose" + }); + var U4 = ke2("remarkGFM", () => remarkGfm); + d5(U4.plugin, { + displayName: "Remark<remarkGFMPlugin>", + group: "Remark" + }); + d5(U4.options, { + displayName: "RemarkConfig<remarkGFMPlugin>", + group: "Remark" + }); + var ct3 = [ + xe2, + ve3, + Ie3, + U4 + ].flat(); + var it2 = [ + Me3, + S7, + R5, + I3, + M6, + Z4, + V3, + K4, + T5 + ].flat(); + var dt3 = [ + G4, + W5, + z4, + fe4, + he3, + ge4, + be2, + Ce4, + ye4, + ke4, + Te3, + Se2, + we4, + Ne3, + Re2, + H5 + ]; + var wt = [it2, at3, st2, rt, ct3, dt3].flat(); + + // node_modules/@milkdown/theme-nord/lib/index.es.js + function c5(e2) { + e2.update(ae, (r3) => { + const o2 = r3.attributes; + return __spreadProps(__spreadValues({}, r3), { + attributes: (n4) => { + const t2 = typeof o2 == "function" ? o2(n4) : o2; + return __spreadProps(__spreadValues({}, t2), { + class: clsx_default("prose dark:prose-invert outline-none", (t2 == null ? void 0 : t2.class) || "", "milkdown-theme-nord") + }); + } + }); + }); + } + + // node_modules/@milkdown/plugin-listener/lib/index.es.js + var import_lodash = __toESM(require_lodash(), 1); + var l4 = class { + constructor() { + this.beforeMountedListeners = [], this.mountedListeners = [], this.updatedListeners = [], this.markdownUpdatedListeners = [], this.blurListeners = [], this.focusListeners = [], this.destroyListeners = [], this.beforeMount = (s2) => (this.beforeMountedListeners.push(s2), this), this.mounted = (s2) => (this.mountedListeners.push(s2), this), this.updated = (s2) => (this.updatedListeners.push(s2), this); + } + /// A getter to get all [subscribers](#interface-subscribers). You should not use this method directly. + get listeners() { + return { + beforeMount: this.beforeMountedListeners, + mounted: this.mountedListeners, + updated: this.updatedListeners, + markdownUpdated: this.markdownUpdatedListeners, + blur: this.blurListeners, + focus: this.focusListeners, + destroy: this.destroyListeners + }; + } + /// Subscribe to the markdownUpdated event. + /// This event will be triggered after the editor state is updated and **the document is changed**. + /// The second parameter is the current markdown and the third parameter is the previous markdown. + markdownUpdated(s2) { + return this.markdownUpdatedListeners.push(s2), this; + } + /// Subscribe to the blur event. + /// This event will be triggered when the editor is blurred. + blur(s2) { + return this.blurListeners.push(s2), this; + } + /// Subscribe to the focus event. + /// This event will be triggered when the editor is focused. + focus(s2) { + return this.focusListeners.push(s2), this; + } + /// Subscribe to the destroy event. + /// This event will be triggered before the editor is destroyed. + destroy(s2) { + return this.destroyListeners.push(s2), this; + } + }; + var h4 = H(new l4(), "listener"); + var M7 = new PluginKey("MILKDOWN_LISTENER"); + var U5 = (t2) => (t2.inject(h4, new l4()), async () => { + await t2.wait(M4); + const s2 = t2.get(h4), { listeners: r3 } = s2; + r3.beforeMount.forEach((e2) => e2(t2)), await t2.wait($); + const u4 = t2.get(te); + let n4 = null, d6 = null; + const p4 = new Plugin({ + key: M7, + view: () => ({ + destroy: () => { + r3.destroy.forEach((e2) => e2(t2)); + } + }), + props: { + handleDOMEvents: { + focus: () => (r3.focus.forEach((e2) => e2(t2)), false), + blur: () => (r3.blur.forEach((e2) => e2(t2)), false) + } + }, + state: { + init: (e2, a2) => { + n4 = a2.doc, d6 = u4(a2.doc); + }, + apply: (e2) => !e2.docChanged || e2.getMeta("addToHistory") === false ? void 0 : (0, import_lodash.default)(() => { + const { doc: i2 } = e2; + if (r3.updated.length > 0 && n4 && !n4.eq(i2) && r3.updated.forEach((o2) => { + o2(t2, i2, n4); + }), r3.markdownUpdated.length > 0 && n4 && !n4.eq(i2)) { + const o2 = u4(i2); + r3.markdownUpdated.forEach((f3) => { + f3(t2, o2, d6); + }), d6 = o2; + } + n4 = i2; + }, 200)() + } + }); + t2.update(N2, (e2) => e2.concat(p4)), await t2.wait(ne), r3.mounted.forEach((e2) => e2(t2)); + }); + U5.meta = { + package: "@milkdown/plugin-listener", + displayName: "Listener" + }; + + // frontend/main.ts + function configureListItem(ctx) { + ctx.set(listItemBlockConfig.key, { + renderLabel: (label, listType, checked) => { + if (checked == null) { + if (listType === "bullet") { + return html2`<span class='label'>•</span>`; + } + return html2`<span class='label'>${label}</span>`; + } else { + return html2`<input class='label' type="checkbox" checked=${checked} />`; + } + } + }); + } + function createEditor(rootId, fieldId, content3) { + Oe.make().config((ctx) => { + ctx.set(ce, rootId); + ctx.set(re, content3); + const listener = ctx.get(h4); + listener.markdownUpdated((ctx2, markdown, prevMarkdown) => { + if (markdown !== prevMarkdown) { + console.log(markdown); + console.log(fieldId); + document.getElementById(fieldId).value = markdown; + console.log("updated"); + } + }); + }).config(configureListItem).use(cr).use(wt).use(c5).use(U5).use(listItemBlockComponent).create(); + } + window.createEditor = createEditor; +})(); diff --git a/static/style.css b/static/style.css new file mode 100644 index 0000000..081fd20 --- /dev/null +++ b/static/style.css @@ -0,0 +1,2844 @@ +/* +! tailwindcss v3.4.3 | MIT License | https://tailwindcss.com +*/ + +/* +1. Prevent padding and border from affecting element width. (https://github.com/mozdevs/cssremedy/issues/4) +2. Allow adding a border to an element by just adding a border-width. (https://github.com/tailwindcss/tailwindcss/pull/116) +*/ + +*, +::before, +::after { + box-sizing: border-box; + /* 1 */ + border-width: 0; + /* 2 */ + border-style: solid; + /* 2 */ + border-color: #e5e7eb; + /* 2 */ +} + +::before, +::after { + --tw-content: ''; +} + +/* +1. Use a consistent sensible line-height in all browsers. +2. Prevent adjustments of font size after orientation changes in iOS. +3. Use a more readable tab size. +4. Use the user's configured `sans` font-family by default. +5. Use the user's configured `sans` font-feature-settings by default. +6. Use the user's configured `sans` font-variation-settings by default. +7. Disable tap highlights on iOS +*/ + +html, +:host { + line-height: 1.5; + /* 1 */ + -webkit-text-size-adjust: 100%; + /* 2 */ + -moz-tab-size: 4; + /* 3 */ + -o-tab-size: 4; + tab-size: 4; + /* 3 */ + font-family: ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji"; + /* 4 */ + font-feature-settings: normal; + /* 5 */ + font-variation-settings: normal; + /* 6 */ + -webkit-tap-highlight-color: transparent; + /* 7 */ +} + +/* +1. Remove the margin in all browsers. +2. Inherit line-height from `html` so users can set them as a class directly on the `html` element. +*/ + +body { + margin: 0; + /* 1 */ + line-height: inherit; + /* 2 */ +} + +/* +1. Add the correct height in Firefox. +2. Correct the inheritance of border color in Firefox. (https://bugzilla.mozilla.org/show_bug.cgi?id=190655) +3. Ensure horizontal rules are visible by default. +*/ + +hr { + height: 0; + /* 1 */ + color: inherit; + /* 2 */ + border-top-width: 1px; + /* 3 */ +} + +/* +Add the correct text decoration in Chrome, Edge, and Safari. +*/ + +abbr:where([title]) { + -webkit-text-decoration: underline dotted; + text-decoration: underline dotted; +} + +/* +Remove the default font size and weight for headings. +*/ + +h1, +h2, +h3, +h4, +h5, +h6 { + font-size: inherit; + font-weight: inherit; +} + +/* +Reset links to optimize for opt-in styling instead of opt-out. +*/ + +a { + color: inherit; + text-decoration: inherit; +} + +/* +Add the correct font weight in Edge and Safari. +*/ + +b, +strong { + font-weight: bolder; +} + +/* +1. Use the user's configured `mono` font-family by default. +2. Use the user's configured `mono` font-feature-settings by default. +3. Use the user's configured `mono` font-variation-settings by default. +4. Correct the odd `em` font sizing in all browsers. +*/ + +code, +kbd, +samp, +pre { + font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace; + /* 1 */ + font-feature-settings: normal; + /* 2 */ + font-variation-settings: normal; + /* 3 */ + font-size: 1em; + /* 4 */ +} + +/* +Add the correct font size in all browsers. +*/ + +small { + font-size: 80%; +} + +/* +Prevent `sub` and `sup` elements from affecting the line height in all browsers. +*/ + +sub, +sup { + font-size: 75%; + line-height: 0; + position: relative; + vertical-align: baseline; +} + +sub { + bottom: -0.25em; +} + +sup { + top: -0.5em; +} + +/* +1. Remove text indentation from table contents in Chrome and Safari. (https://bugs.chromium.org/p/chromium/issues/detail?id=999088, https://bugs.webkit.org/show_bug.cgi?id=201297) +2. Correct table border color inheritance in all Chrome and Safari. (https://bugs.chromium.org/p/chromium/issues/detail?id=935729, https://bugs.webkit.org/show_bug.cgi?id=195016) +3. Remove gaps between table borders by default. +*/ + +table { + text-indent: 0; + /* 1 */ + border-color: inherit; + /* 2 */ + border-collapse: collapse; + /* 3 */ +} + +/* +1. Change the font styles in all browsers. +2. Remove the margin in Firefox and Safari. +3. Remove default padding in all browsers. +*/ + +button, +input, +optgroup, +select, +textarea { + font-family: inherit; + /* 1 */ + font-feature-settings: inherit; + /* 1 */ + font-variation-settings: inherit; + /* 1 */ + font-size: 100%; + /* 1 */ + font-weight: inherit; + /* 1 */ + line-height: inherit; + /* 1 */ + letter-spacing: inherit; + /* 1 */ + color: inherit; + /* 1 */ + margin: 0; + /* 2 */ + padding: 0; + /* 3 */ +} + +/* +Remove the inheritance of text transform in Edge and Firefox. +*/ + +button, +select { + text-transform: none; +} + +/* +1. Correct the inability to style clickable types in iOS and Safari. +2. Remove default button styles. +*/ + +button, +input:where([type='button']), +input:where([type='reset']), +input:where([type='submit']) { + -webkit-appearance: button; + /* 1 */ + background-color: transparent; + /* 2 */ + background-image: none; + /* 2 */ +} + +/* +Use the modern Firefox focus style for all focusable elements. +*/ + +:-moz-focusring { + outline: auto; +} + +/* +Remove the additional `:invalid` styles in Firefox. (https://github.com/mozilla/gecko-dev/blob/2f9eacd9d3d995c937b4251a5557d95d494c9be1/layout/style/res/forms.css#L728-L737) +*/ + +:-moz-ui-invalid { + box-shadow: none; +} + +/* +Add the correct vertical alignment in Chrome and Firefox. +*/ + +progress { + vertical-align: baseline; +} + +/* +Correct the cursor style of increment and decrement buttons in Safari. +*/ + +::-webkit-inner-spin-button, +::-webkit-outer-spin-button { + height: auto; +} + +/* +1. Correct the odd appearance in Chrome and Safari. +2. Correct the outline style in Safari. +*/ + +[type='search'] { + -webkit-appearance: textfield; + /* 1 */ + outline-offset: -2px; + /* 2 */ +} + +/* +Remove the inner padding in Chrome and Safari on macOS. +*/ + +::-webkit-search-decoration { + -webkit-appearance: none; +} + +/* +1. Correct the inability to style clickable types in iOS and Safari. +2. Change font properties to `inherit` in Safari. +*/ + +::-webkit-file-upload-button { + -webkit-appearance: button; + /* 1 */ + font: inherit; + /* 2 */ +} + +/* +Add the correct display in Chrome and Safari. +*/ + +summary { + display: list-item; +} + +/* +Removes the default spacing and border for appropriate elements. +*/ + +blockquote, +dl, +dd, +h1, +h2, +h3, +h4, +h5, +h6, +hr, +figure, +p, +pre { + margin: 0; +} + +fieldset { + margin: 0; + padding: 0; +} + +legend { + padding: 0; +} + +ol, +ul, +menu { + list-style: none; + margin: 0; + padding: 0; +} + +/* +Reset default styling for dialogs. +*/ + +dialog { + padding: 0; +} + +/* +Prevent resizing textareas horizontally by default. +*/ + +textarea { + resize: vertical; +} + +/* +1. Reset the default placeholder opacity in Firefox. (https://github.com/tailwindlabs/tailwindcss/issues/3300) +2. Set the default placeholder color to the user's configured gray 400 color. +*/ + +input::-moz-placeholder, textarea::-moz-placeholder { + opacity: 1; + /* 1 */ + color: #9ca3af; + /* 2 */ +} + +input::placeholder, +textarea::placeholder { + opacity: 1; + /* 1 */ + color: #9ca3af; + /* 2 */ +} + +/* +Set the default cursor for buttons. +*/ + +button, +[role="button"] { + cursor: pointer; +} + +/* +Make sure disabled buttons don't get the pointer cursor. +*/ + +:disabled { + cursor: default; +} + +/* +1. Make replaced elements `display: block` by default. (https://github.com/mozdevs/cssremedy/issues/14) +2. Add `vertical-align: middle` to align replaced elements more sensibly by default. (https://github.com/jensimmons/cssremedy/issues/14#issuecomment-634934210) + This can trigger a poorly considered lint error in some tools but is included by design. +*/ + +img, +svg, +video, +canvas, +audio, +iframe, +embed, +object { + display: block; + /* 1 */ + vertical-align: middle; + /* 2 */ +} + +/* +Constrain images and videos to the parent width and preserve their intrinsic aspect ratio. (https://github.com/mozdevs/cssremedy/issues/14) +*/ + +img, +video { + max-width: 100%; + height: auto; +} + +/* Make elements with the HTML hidden attribute stay hidden by default */ + +[hidden] { + display: none; +} + +:root, +[data-theme] { + background-color: var(--fallback-b1,oklch(var(--b1)/1)); + color: var(--fallback-bc,oklch(var(--bc)/1)); +} + +@supports not (color: oklch(0% 0 0)) { + :root { + color-scheme: light; + --fallback-p: #491eff; + --fallback-pc: #d4dbff; + --fallback-s: #ff41c7; + --fallback-sc: #fff9fc; + --fallback-a: #00cfbd; + --fallback-ac: #00100d; + --fallback-n: #2b3440; + --fallback-nc: #d7dde4; + --fallback-b1: #ffffff; + --fallback-b2: #e5e6e6; + --fallback-b3: #e5e6e6; + --fallback-bc: #1f2937; + --fallback-in: #00b3f0; + --fallback-inc: #000000; + --fallback-su: #00ca92; + --fallback-suc: #000000; + --fallback-wa: #ffc22d; + --fallback-wac: #000000; + --fallback-er: #ff6f70; + --fallback-erc: #000000; + } + + @media (prefers-color-scheme: dark) { + :root { + color-scheme: dark; + --fallback-p: #7582ff; + --fallback-pc: #050617; + --fallback-s: #ff71cf; + --fallback-sc: #190211; + --fallback-a: #00c7b5; + --fallback-ac: #000e0c; + --fallback-n: #2a323c; + --fallback-nc: #a6adbb; + --fallback-b1: #1d232a; + --fallback-b2: #191e24; + --fallback-b3: #15191e; + --fallback-bc: #a6adbb; + --fallback-in: #00b3f0; + --fallback-inc: #000000; + --fallback-su: #00ca92; + --fallback-suc: #000000; + --fallback-wa: #ffc22d; + --fallback-wac: #000000; + --fallback-er: #ff6f70; + --fallback-erc: #000000; + } + } +} + +html { + -webkit-tap-highlight-color: transparent; +} + +:root { + --p: 81.1787% 0.091182 6.323441; + --rounded-box: 1rem; + --rounded-btn: 0.5rem; + --rounded-badge: 1.9rem; + --animation-btn: 0.25s; + --animation-input: .2s; + --btn-focus-scale: 0.95; + --border-btn: 1px; + --tab-border: 1px; + --tab-radius: 0.5rem; + --pc: 16.1631% 0.019731 7.611912; + --s: 80.2505% 0.120284 226.513023; + --sc: 15.921% 0.023483 228.193635; + --a: 86.2762% 0.090464 154.896727; + --ac: 17.1651% 0.017414 151.988369; + --n: 70.1674% 0.322491 328.363418; + --nc: 14.047% 0.06456 328.363418; + --b1: 100% 0 0; + --b2: 90.0601% 0 0; + --b3: 80.1517% 0 0; + --bc: 20.0193% 0 0; + --in: 51.0573% 0.230053 276.965635; + --inc: 90.2553% 0.04582 275.978968; + --su: 51.0938% 0.086055 186.391359; + --suc: 90.2981% 0.017553 183.500117; + --wa: 79.5243% 0.161668 86.046788; + --wac: 15.9399% 0.03259 87.51442; + --er: 63.6834% 0.207849 25.331328; + --erc: 13.0045% 0.039838 24.572492; +} + +[type='text'],input:where(:not([type])),[type='email'],[type='url'],[type='password'],[type='number'],[type='date'],[type='datetime-local'],[type='month'],[type='search'],[type='tel'],[type='time'],[type='week'],[multiple],textarea,select { + -webkit-appearance: none; + -moz-appearance: none; + appearance: none; + background-color: #fff; + border-color: #6b7280; + border-width: 1px; + border-radius: 0px; + padding-top: 0.5rem; + padding-right: 0.75rem; + padding-bottom: 0.5rem; + padding-left: 0.75rem; + font-size: 1rem; + line-height: 1.5rem; + --tw-shadow: 0 0 #0000; +} + +[type='text']:focus, input:where(:not([type])):focus, [type='email']:focus, [type='url']:focus, [type='password']:focus, [type='number']:focus, [type='date']:focus, [type='datetime-local']:focus, [type='month']:focus, [type='search']:focus, [type='tel']:focus, [type='time']:focus, [type='week']:focus, [multiple]:focus, textarea:focus, select:focus { + outline: 2px solid transparent; + outline-offset: 2px; + --tw-ring-inset: var(--tw-empty,/*!*/ /*!*/); + --tw-ring-offset-width: 0px; + --tw-ring-offset-color: #fff; + --tw-ring-color: #2563eb; + --tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color); + --tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color); + box-shadow: var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow); + border-color: #2563eb; +} + +input::-moz-placeholder, textarea::-moz-placeholder { + color: #6b7280; + opacity: 1; +} + +input::placeholder,textarea::placeholder { + color: #6b7280; + opacity: 1; +} + +::-webkit-datetime-edit-fields-wrapper { + padding: 0; +} + +::-webkit-date-and-time-value { + min-height: 1.5em; + text-align: inherit; +} + +::-webkit-datetime-edit { + display: inline-flex; +} + +::-webkit-datetime-edit,::-webkit-datetime-edit-year-field,::-webkit-datetime-edit-month-field,::-webkit-datetime-edit-day-field,::-webkit-datetime-edit-hour-field,::-webkit-datetime-edit-minute-field,::-webkit-datetime-edit-second-field,::-webkit-datetime-edit-millisecond-field,::-webkit-datetime-edit-meridiem-field { + padding-top: 0; + padding-bottom: 0; +} + +select { + background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e"); + background-position: right 0.5rem center; + background-repeat: no-repeat; + background-size: 1.5em 1.5em; + padding-right: 2.5rem; + -webkit-print-color-adjust: exact; + print-color-adjust: exact; +} + +[multiple],[size]:where(select:not([size="1"])) { + background-image: initial; + background-position: initial; + background-repeat: unset; + background-size: initial; + padding-right: 0.75rem; + -webkit-print-color-adjust: unset; + print-color-adjust: unset; +} + +[type='checkbox'],[type='radio'] { + -webkit-appearance: none; + -moz-appearance: none; + appearance: none; + padding: 0; + -webkit-print-color-adjust: exact; + print-color-adjust: exact; + display: inline-block; + vertical-align: middle; + background-origin: border-box; + -webkit-user-select: none; + -moz-user-select: none; + user-select: none; + flex-shrink: 0; + height: 1rem; + width: 1rem; + color: #2563eb; + background-color: #fff; + border-color: #6b7280; + border-width: 1px; + --tw-shadow: 0 0 #0000; +} + +[type='checkbox'] { + border-radius: 0px; +} + +[type='radio'] { + border-radius: 100%; +} + +[type='checkbox']:focus,[type='radio']:focus { + outline: 2px solid transparent; + outline-offset: 2px; + --tw-ring-inset: var(--tw-empty,/*!*/ /*!*/); + --tw-ring-offset-width: 2px; + --tw-ring-offset-color: #fff; + --tw-ring-color: #2563eb; + --tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color); + --tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color); + box-shadow: var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow); +} + +[type='checkbox']:checked,[type='radio']:checked { + border-color: transparent; + background-color: currentColor; + background-size: 100% 100%; + background-position: center; + background-repeat: no-repeat; +} + +[type='checkbox']:checked { + background-image: url("data:image/svg+xml,%3csvg viewBox='0 0 16 16' fill='white' xmlns='http://www.w3.org/2000/svg'%3e%3cpath d='M12.207 4.793a1 1 0 010 1.414l-5 5a1 1 0 01-1.414 0l-2-2a1 1 0 011.414-1.414L6.5 9.086l4.293-4.293a1 1 0 011.414 0z'/%3e%3c/svg%3e"); +} + +@media (forced-colors: active) { + [type='checkbox']:checked { + -webkit-appearance: auto; + -moz-appearance: auto; + appearance: auto; + } +} + +[type='radio']:checked { + background-image: url("data:image/svg+xml,%3csvg viewBox='0 0 16 16' fill='white' xmlns='http://www.w3.org/2000/svg'%3e%3ccircle cx='8' cy='8' r='3'/%3e%3c/svg%3e"); +} + +@media (forced-colors: active) { + [type='radio']:checked { + -webkit-appearance: auto; + -moz-appearance: auto; + appearance: auto; + } +} + +[type='checkbox']:checked:hover,[type='checkbox']:checked:focus,[type='radio']:checked:hover,[type='radio']:checked:focus { + border-color: transparent; + background-color: currentColor; +} + +[type='checkbox']:indeterminate { + background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 16 16'%3e%3cpath stroke='white' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M4 8h8'/%3e%3c/svg%3e"); + border-color: transparent; + background-color: currentColor; + background-size: 100% 100%; + background-position: center; + background-repeat: no-repeat; +} + +@media (forced-colors: active) { + [type='checkbox']:indeterminate { + -webkit-appearance: auto; + -moz-appearance: auto; + appearance: auto; + } +} + +[type='checkbox']:indeterminate:hover,[type='checkbox']:indeterminate:focus { + border-color: transparent; + background-color: currentColor; +} + +[type='file'] { + background: unset; + border-color: inherit; + border-width: 0; + border-radius: 0; + padding: 0; + font-size: unset; + line-height: inherit; +} + +[type='file']:focus { + outline: 1px solid ButtonText; + outline: 1px auto -webkit-focus-ring-color; +} + +*, ::before, ::after { + --tw-border-spacing-x: 0; + --tw-border-spacing-y: 0; + --tw-translate-x: 0; + --tw-translate-y: 0; + --tw-rotate: 0; + --tw-skew-x: 0; + --tw-skew-y: 0; + --tw-scale-x: 1; + --tw-scale-y: 1; + --tw-pan-x: ; + --tw-pan-y: ; + --tw-pinch-zoom: ; + --tw-scroll-snap-strictness: proximity; + --tw-gradient-from-position: ; + --tw-gradient-via-position: ; + --tw-gradient-to-position: ; + --tw-ordinal: ; + --tw-slashed-zero: ; + --tw-numeric-figure: ; + --tw-numeric-spacing: ; + --tw-numeric-fraction: ; + --tw-ring-inset: ; + --tw-ring-offset-width: 0px; + --tw-ring-offset-color: #fff; + --tw-ring-color: rgb(59 130 246 / 0.5); + --tw-ring-offset-shadow: 0 0 #0000; + --tw-ring-shadow: 0 0 #0000; + --tw-shadow: 0 0 #0000; + --tw-shadow-colored: 0 0 #0000; + --tw-blur: ; + --tw-brightness: ; + --tw-contrast: ; + --tw-grayscale: ; + --tw-hue-rotate: ; + --tw-invert: ; + --tw-saturate: ; + --tw-sepia: ; + --tw-drop-shadow: ; + --tw-backdrop-blur: ; + --tw-backdrop-brightness: ; + --tw-backdrop-contrast: ; + --tw-backdrop-grayscale: ; + --tw-backdrop-hue-rotate: ; + --tw-backdrop-invert: ; + --tw-backdrop-opacity: ; + --tw-backdrop-saturate: ; + --tw-backdrop-sepia: ; + --tw-contain-size: ; + --tw-contain-layout: ; + --tw-contain-paint: ; + --tw-contain-style: ; +} + +::backdrop { + --tw-border-spacing-x: 0; + --tw-border-spacing-y: 0; + --tw-translate-x: 0; + --tw-translate-y: 0; + --tw-rotate: 0; + --tw-skew-x: 0; + --tw-skew-y: 0; + --tw-scale-x: 1; + --tw-scale-y: 1; + --tw-pan-x: ; + --tw-pan-y: ; + --tw-pinch-zoom: ; + --tw-scroll-snap-strictness: proximity; + --tw-gradient-from-position: ; + --tw-gradient-via-position: ; + --tw-gradient-to-position: ; + --tw-ordinal: ; + --tw-slashed-zero: ; + --tw-numeric-figure: ; + --tw-numeric-spacing: ; + --tw-numeric-fraction: ; + --tw-ring-inset: ; + --tw-ring-offset-width: 0px; + --tw-ring-offset-color: #fff; + --tw-ring-color: rgb(59 130 246 / 0.5); + --tw-ring-offset-shadow: 0 0 #0000; + --tw-ring-shadow: 0 0 #0000; + --tw-shadow: 0 0 #0000; + --tw-shadow-colored: 0 0 #0000; + --tw-blur: ; + --tw-brightness: ; + --tw-contrast: ; + --tw-grayscale: ; + --tw-hue-rotate: ; + --tw-invert: ; + --tw-saturate: ; + --tw-sepia: ; + --tw-drop-shadow: ; + --tw-backdrop-blur: ; + --tw-backdrop-brightness: ; + --tw-backdrop-contrast: ; + --tw-backdrop-grayscale: ; + --tw-backdrop-hue-rotate: ; + --tw-backdrop-invert: ; + --tw-backdrop-opacity: ; + --tw-backdrop-saturate: ; + --tw-backdrop-sepia: ; + --tw-contain-size: ; + --tw-contain-layout: ; + --tw-contain-paint: ; + --tw-contain-style: ; +} + +.avatar.placeholder > div { + display: flex; + align-items: center; + justify-content: center; +} + +@media (hover:hover) { + .label a:hover { + --tw-text-opacity: 1; + color: var(--fallback-bc,oklch(var(--bc)/var(--tw-text-opacity))); + } +} + +.btn { + display: inline-flex; + height: 3rem; + min-height: 3rem; + flex-shrink: 0; + cursor: pointer; + -webkit-user-select: none; + -moz-user-select: none; + user-select: none; + flex-wrap: wrap; + align-items: center; + justify-content: center; + border-radius: var(--rounded-btn, 0.5rem); + border-color: transparent; + border-color: oklch(var(--btn-color, var(--b2)) / var(--tw-border-opacity)); + padding-left: 1rem; + padding-right: 1rem; + text-align: center; + font-size: 0.875rem; + line-height: 1em; + gap: 0.5rem; + font-weight: 600; + text-decoration-line: none; + transition-duration: 200ms; + transition-timing-function: cubic-bezier(0, 0, 0.2, 1); + border-width: var(--border-btn, 1px); + animation: button-pop var(--animation-btn, 0.25s) ease-out; + transition-property: color, background-color, border-color, opacity, box-shadow, transform; + --tw-text-opacity: 1; + color: var(--fallback-bc,oklch(var(--bc)/var(--tw-text-opacity))); + --tw-shadow: 0 1px 2px 0 rgb(0 0 0 / 0.05); + --tw-shadow-colored: 0 1px 2px 0 var(--tw-shadow-color); + box-shadow: var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow); + outline-color: var(--fallback-bc,oklch(var(--bc)/1)); + background-color: oklch(var(--btn-color, var(--b2)) / var(--tw-bg-opacity)); + --tw-bg-opacity: 1; + --tw-border-opacity: 1; +} + +.btn-disabled, + .btn[disabled], + .btn:disabled { + pointer-events: none; +} + +:where(.btn:is(input[type="checkbox"])), +:where(.btn:is(input[type="radio"])) { + width: auto; + -webkit-appearance: none; + -moz-appearance: none; + appearance: none; +} + +.btn:is(input[type="checkbox"]):after, +.btn:is(input[type="radio"]):after { + --tw-content: attr(aria-label); + content: var(--tw-content); +} + +.card { + position: relative; + display: flex; + flex-direction: column; + border-radius: var(--rounded-box, 1rem); +} + +.card:focus { + outline: 2px solid transparent; + outline-offset: 2px; +} + +.card-body { + display: flex; + flex: 1 1 auto; + flex-direction: column; + padding: var(--padding-card, 2rem); + gap: 0.5rem; +} + +.card-body :where(p) { + flex-grow: 1; +} + +.card-actions { + display: flex; + flex-wrap: wrap; + align-items: flex-start; + gap: 0.5rem; +} + +.card figure { + display: flex; + align-items: center; + justify-content: center; +} + +.card.image-full { + display: grid; +} + +.card.image-full:before { + position: relative; + content: ""; + z-index: 10; + border-radius: var(--rounded-box, 1rem); + --tw-bg-opacity: 1; + background-color: var(--fallback-n,oklch(var(--n)/var(--tw-bg-opacity))); + opacity: 0.75; +} + +.card.image-full:before, + .card.image-full > * { + grid-column-start: 1; + grid-row-start: 1; +} + +.card.image-full > figure img { + height: 100%; + -o-object-fit: cover; + object-fit: cover; +} + +.card.image-full > .card-body { + position: relative; + z-index: 20; + --tw-text-opacity: 1; + color: var(--fallback-nc,oklch(var(--nc)/var(--tw-text-opacity))); +} + +.checkbox { + flex-shrink: 0; + --chkbg: var(--fallback-bc,oklch(var(--bc)/1)); + --chkfg: var(--fallback-b1,oklch(var(--b1)/1)); + height: 1.5rem; + width: 1.5rem; + cursor: pointer; + -webkit-appearance: none; + -moz-appearance: none; + appearance: none; + border-radius: var(--rounded-btn, 0.5rem); + border-width: 1px; + border-color: var(--fallback-bc,oklch(var(--bc)/var(--tw-border-opacity))); + --tw-border-opacity: 0.2; +} + +@media (hover: hover) { + .btn:hover { + --tw-border-opacity: 1; + border-color: var(--fallback-b3,oklch(var(--b3)/var(--tw-border-opacity))); + --tw-bg-opacity: 1; + background-color: var(--fallback-b3,oklch(var(--b3)/var(--tw-bg-opacity))); + } + + @supports (color: color-mix(in oklab, black, black)) { + .btn:hover { + background-color: color-mix( + in oklab, + oklch(var(--btn-color, var(--b2)) / var(--tw-bg-opacity, 1)) 90%, + black + ); + border-color: color-mix( + in oklab, + oklch(var(--btn-color, var(--b2)) / var(--tw-border-opacity, 1)) 90%, + black + ); + } + } + + @supports not (color: oklch(0% 0 0)) { + .btn:hover { + background-color: var(--btn-color, var(--fallback-b2)); + border-color: var(--btn-color, var(--fallback-b2)); + } + } + + .btn.glass:hover { + --glass-opacity: 25%; + --glass-border-opacity: 15%; + } + + .btn-outline.btn-primary:hover { + --tw-text-opacity: 1; + color: var(--fallback-pc,oklch(var(--pc)/var(--tw-text-opacity))); + } + + @supports (color: color-mix(in oklab, black, black)) { + .btn-outline.btn-primary:hover { + background-color: color-mix(in oklab, var(--fallback-p,oklch(var(--p)/1)) 90%, black); + border-color: color-mix(in oklab, var(--fallback-p,oklch(var(--p)/1)) 90%, black); + } + } + + .btn-disabled:hover, + .btn[disabled]:hover, + .btn:disabled:hover { + --tw-border-opacity: 0; + background-color: var(--fallback-n,oklch(var(--n)/var(--tw-bg-opacity))); + --tw-bg-opacity: 0.2; + color: var(--fallback-bc,oklch(var(--bc)/var(--tw-text-opacity))); + --tw-text-opacity: 0.2; + } + + @supports (color: color-mix(in oklab, black, black)) { + .btn:is(input[type="checkbox"]:checked):hover, .btn:is(input[type="radio"]:checked):hover { + background-color: color-mix(in oklab, var(--fallback-p,oklch(var(--p)/1)) 90%, black); + border-color: color-mix(in oklab, var(--fallback-p,oklch(var(--p)/1)) 90%, black); + } + } +} + +.label { + display: flex; + -webkit-user-select: none; + -moz-user-select: none; + user-select: none; + align-items: center; + justify-content: space-between; + padding-left: 0.25rem; + padding-right: 0.25rem; + padding-top: 0.5rem; + padding-bottom: 0.5rem; +} + +.input { + flex-shrink: 1; + -webkit-appearance: none; + -moz-appearance: none; + appearance: none; + height: 3rem; + padding-left: 1rem; + padding-right: 1rem; + font-size: 1rem; + line-height: 2; + line-height: 1.5rem; + border-radius: var(--rounded-btn, 0.5rem); + border-width: 1px; + border-color: transparent; + --tw-bg-opacity: 1; + background-color: var(--fallback-b1,oklch(var(--b1)/var(--tw-bg-opacity))); +} + +.input[type="number"]::-webkit-inner-spin-button, +.input-md[type="number"]::-webkit-inner-spin-button { + margin-top: -1rem; + margin-bottom: -1rem; + margin-inline-end: -1rem; +} + +.link { + cursor: pointer; + text-decoration-line: underline; +} + +.navbar { + display: flex; + align-items: center; + padding: var(--navbar-padding, 0.5rem); + min-height: 4rem; + width: 100%; +} + +:where(.navbar > *:not(script, style)) { + display: inline-flex; + align-items: center; +} + +.navbar-start { + width: 50%; + justify-content: flex-start; +} + +.navbar-end { + width: 50%; + justify-content: flex-end; +} + +.select { + display: inline-flex; + cursor: pointer; + -webkit-user-select: none; + -moz-user-select: none; + user-select: none; + -webkit-appearance: none; + -moz-appearance: none; + appearance: none; + height: 3rem; + min-height: 3rem; + padding-left: 1rem; + padding-right: 2.5rem; + font-size: 0.875rem; + line-height: 1.25rem; + line-height: 2; + border-radius: var(--rounded-btn, 0.5rem); + border-width: 1px; + border-color: transparent; + --tw-bg-opacity: 1; + background-color: var(--fallback-b1,oklch(var(--b1)/var(--tw-bg-opacity))); + background-image: linear-gradient(45deg, transparent 50%, currentColor 50%), + linear-gradient(135deg, currentColor 50%, transparent 50%); + background-position: calc(100% - 20px) calc(1px + 50%), + calc(100% - 16.1px) calc(1px + 50%); + background-size: 4px 4px, + 4px 4px; + background-repeat: no-repeat; +} + +.select[multiple] { + height: auto; +} + +.textarea { + min-height: 3rem; + flex-shrink: 1; + padding-left: 1rem; + padding-right: 1rem; + padding-top: 0.5rem; + padding-bottom: 0.5rem; + font-size: 0.875rem; + line-height: 1.25rem; + line-height: 2; + border-radius: var(--rounded-btn, 0.5rem); + border-width: 1px; + border-color: transparent; + --tw-bg-opacity: 1; + background-color: var(--fallback-b1,oklch(var(--b1)/var(--tw-bg-opacity))); +} + +.btm-nav > * .label { + font-size: 1rem; + line-height: 1.5rem; +} + +.btn:active:hover, + .btn:active:focus { + animation: button-pop 0s ease-out; + transform: scale(var(--btn-focus-scale, 0.97)); +} + +@supports not (color: oklch(0% 0 0)) { + .btn { + background-color: var(--btn-color, var(--fallback-b2)); + border-color: var(--btn-color, var(--fallback-b2)); + } + + .btn-primary { + --btn-color: var(--fallback-p); + } + + .prose :where(code):not(:where([class~="not-prose"] *, pre *)) { + background-color: var(--fallback-b3,oklch(var(--b3)/1)); + } +} + +@supports (color: color-mix(in oklab, black, black)) { + .btn-outline.btn-primary.btn-active { + background-color: color-mix(in oklab, var(--fallback-p,oklch(var(--p)/1)) 90%, black); + border-color: color-mix(in oklab, var(--fallback-p,oklch(var(--p)/1)) 90%, black); + } +} + +.btn:focus-visible { + outline-style: solid; + outline-width: 2px; + outline-offset: 2px; +} + +.btn-primary { + --tw-text-opacity: 1; + color: var(--fallback-pc,oklch(var(--pc)/var(--tw-text-opacity))); + outline-color: var(--fallback-p,oklch(var(--p)/1)); +} + +@supports (color: oklch(0% 0 0)) { + .btn-primary { + --btn-color: var(--p); + } +} + +.btn.glass { + --tw-shadow: 0 0 #0000; + --tw-shadow-colored: 0 0 #0000; + box-shadow: var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow); + outline-color: currentColor; +} + +.btn.glass.btn-active { + --glass-opacity: 25%; + --glass-border-opacity: 15%; +} + +.btn-outline.btn-primary { + --tw-text-opacity: 1; + color: var(--fallback-p,oklch(var(--p)/var(--tw-text-opacity))); +} + +.btn-outline.btn-primary.btn-active { + --tw-text-opacity: 1; + color: var(--fallback-pc,oklch(var(--pc)/var(--tw-text-opacity))); +} + +.btn.btn-disabled, + .btn[disabled], + .btn:disabled { + --tw-border-opacity: 0; + background-color: var(--fallback-n,oklch(var(--n)/var(--tw-bg-opacity))); + --tw-bg-opacity: 0.2; + color: var(--fallback-bc,oklch(var(--bc)/var(--tw-text-opacity))); + --tw-text-opacity: 0.2; +} + +.btn:is(input[type="checkbox"]:checked), +.btn:is(input[type="radio"]:checked) { + --tw-border-opacity: 1; + border-color: var(--fallback-p,oklch(var(--p)/var(--tw-border-opacity))); + --tw-bg-opacity: 1; + background-color: var(--fallback-p,oklch(var(--p)/var(--tw-bg-opacity))); + --tw-text-opacity: 1; + color: var(--fallback-pc,oklch(var(--pc)/var(--tw-text-opacity))); +} + +.btn:is(input[type="checkbox"]:checked):focus-visible, .btn:is(input[type="radio"]:checked):focus-visible { + outline-color: var(--fallback-p,oklch(var(--p)/1)); +} + +@keyframes button-pop { + 0% { + transform: scale(var(--btn-focus-scale, 0.98)); + } + + 40% { + transform: scale(1.02); + } + + 100% { + transform: scale(1); + } +} + +.card :where(figure:first-child) { + overflow: hidden; + border-start-start-radius: inherit; + border-start-end-radius: inherit; + border-end-start-radius: unset; + border-end-end-radius: unset; +} + +.card :where(figure:last-child) { + overflow: hidden; + border-start-start-radius: unset; + border-start-end-radius: unset; + border-end-start-radius: inherit; + border-end-end-radius: inherit; +} + +.card:focus-visible { + outline: 2px solid currentColor; + outline-offset: 2px; +} + +.card.bordered { + border-width: 1px; + --tw-border-opacity: 1; + border-color: var(--fallback-b2,oklch(var(--b2)/var(--tw-border-opacity))); +} + +.card.compact .card-body { + padding: 1rem; + font-size: 0.875rem; + line-height: 1.25rem; +} + +.card-title { + display: flex; + align-items: center; + gap: 0.5rem; + font-size: 1.25rem; + line-height: 1.75rem; + font-weight: 600; +} + +.card.image-full :where(figure) { + overflow: hidden; + border-radius: inherit; +} + +.checkbox:focus { + box-shadow: none; +} + +.checkbox:focus-visible { + outline-style: solid; + outline-width: 2px; + outline-offset: 2px; + outline-color: var(--fallback-bc,oklch(var(--bc)/1)); +} + +.checkbox:disabled { + border-width: 0px; + cursor: not-allowed; + border-color: transparent; + --tw-bg-opacity: 1; + background-color: var(--fallback-bc,oklch(var(--bc)/var(--tw-bg-opacity))); + opacity: 0.2; +} + +.checkbox:checked, + .checkbox[aria-checked="true"] { + background-repeat: no-repeat; + animation: checkmark var(--animation-input, 0.2s) ease-out; + background-color: var(--chkbg); + background-image: linear-gradient(-45deg, transparent 65%, var(--chkbg) 65.99%), + linear-gradient(45deg, transparent 75%, var(--chkbg) 75.99%), + linear-gradient(-45deg, var(--chkbg) 40%, transparent 40.99%), + linear-gradient( + 45deg, + var(--chkbg) 30%, + var(--chkfg) 30.99%, + var(--chkfg) 40%, + transparent 40.99% + ), + linear-gradient(-45deg, var(--chkfg) 50%, var(--chkbg) 50.99%); +} + +.checkbox:indeterminate { + --tw-bg-opacity: 1; + background-color: var(--fallback-bc,oklch(var(--bc)/var(--tw-bg-opacity))); + background-repeat: no-repeat; + animation: checkmark var(--animation-input, 0.2s) ease-out; + background-image: linear-gradient(90deg, transparent 80%, var(--chkbg) 80%), + linear-gradient(-90deg, transparent 80%, var(--chkbg) 80%), + linear-gradient(0deg, var(--chkbg) 43%, var(--chkfg) 43%, var(--chkfg) 57%, var(--chkbg) 57%); +} + +@keyframes checkmark { + 0% { + background-position-y: 5px; + } + + 50% { + background-position-y: -2px; + } + + 100% { + background-position-y: 0; + } +} + +.input input { + --tw-bg-opacity: 1; + background-color: var(--fallback-p,oklch(var(--p)/var(--tw-bg-opacity))); + background-color: transparent; +} + +.input input:focus { + outline: 2px solid transparent; + outline-offset: 2px; +} + +.input[list]::-webkit-calendar-picker-indicator { + line-height: 1em; +} + +.input-bordered { + border-color: var(--fallback-bc,oklch(var(--bc)/0.2)); +} + +.input:focus, + .input:focus-within { + box-shadow: none; + border-color: var(--fallback-bc,oklch(var(--bc)/0.2)); + outline-style: solid; + outline-width: 2px; + outline-offset: 2px; + outline-color: var(--fallback-bc,oklch(var(--bc)/0.2)); +} + +.input:has(> input[disabled]), + .input-disabled, + .input:disabled, + .input[disabled] { + cursor: not-allowed; + --tw-border-opacity: 1; + border-color: var(--fallback-b2,oklch(var(--b2)/var(--tw-border-opacity))); + --tw-bg-opacity: 1; + background-color: var(--fallback-b2,oklch(var(--b2)/var(--tw-bg-opacity))); + color: var(--fallback-bc,oklch(var(--bc)/0.4)); +} + +.input:has(> input[disabled])::-moz-placeholder, .input-disabled::-moz-placeholder, .input:disabled::-moz-placeholder, .input[disabled]::-moz-placeholder { + color: var(--fallback-bc,oklch(var(--bc)/var(--tw-placeholder-opacity))); + --tw-placeholder-opacity: 0.2; +} + +.input:has(> input[disabled])::placeholder, + .input-disabled::placeholder, + .input:disabled::placeholder, + .input[disabled]::placeholder { + color: var(--fallback-bc,oklch(var(--bc)/var(--tw-placeholder-opacity))); + --tw-placeholder-opacity: 0.2; +} + +.input:has(> input[disabled]) > input[disabled] { + cursor: not-allowed; +} + +.input::-webkit-date-and-time-value { + text-align: inherit; +} + +.link:focus { + outline: 2px solid transparent; + outline-offset: 2px; +} + +.link:focus-visible { + outline: 2px solid currentColor; + outline-offset: 2px; +} + +.mockup-phone .display { + overflow: hidden; + border-radius: 40px; + margin-top: -25px; +} + +.mockup-browser .mockup-browser-toolbar .input { + position: relative; + margin-left: auto; + margin-right: auto; + display: block; + height: 1.75rem; + width: 24rem; + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; + --tw-bg-opacity: 1; + background-color: var(--fallback-b2,oklch(var(--b2)/var(--tw-bg-opacity))); + padding-left: 2rem; + direction: ltr; +} + +.mockup-browser .mockup-browser-toolbar .input:before { + content: ""; + position: absolute; + left: 0.5rem; + top: 50%; + aspect-ratio: 1 / 1; + height: 0.75rem; + --tw-translate-y: -50%; + transform: translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y)); + border-radius: 9999px; + border-width: 2px; + border-color: currentColor; + opacity: 0.6; +} + +.mockup-browser .mockup-browser-toolbar .input:after { + content: ""; + position: absolute; + left: 1.25rem; + top: 50%; + height: 0.5rem; + --tw-translate-y: 25%; + --tw-rotate: -45deg; + transform: translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y)); + border-radius: 9999px; + border-width: 1px; + border-color: currentColor; + opacity: 0.6; +} + +@keyframes modal-pop { + 0% { + opacity: 0; + } +} + +@keyframes progress-loading { + 50% { + background-position-x: -115%; + } +} + +@keyframes radiomark { + 0% { + box-shadow: 0 0 0 12px var(--fallback-b1,oklch(var(--b1)/1)) inset, + 0 0 0 12px var(--fallback-b1,oklch(var(--b1)/1)) inset; + } + + 50% { + box-shadow: 0 0 0 3px var(--fallback-b1,oklch(var(--b1)/1)) inset, + 0 0 0 3px var(--fallback-b1,oklch(var(--b1)/1)) inset; + } + + 100% { + box-shadow: 0 0 0 4px var(--fallback-b1,oklch(var(--b1)/1)) inset, + 0 0 0 4px var(--fallback-b1,oklch(var(--b1)/1)) inset; + } +} + +@keyframes rating-pop { + 0% { + transform: translateY(-0.125em); + } + + 40% { + transform: translateY(-0.125em); + } + + 100% { + transform: translateY(0); + } +} + +.select:focus { + box-shadow: none; + border-color: var(--fallback-bc,oklch(var(--bc)/0.2)); + outline-style: solid; + outline-width: 2px; + outline-offset: 2px; + outline-color: var(--fallback-bc,oklch(var(--bc)/0.2)); +} + +.select-disabled, + .select:disabled, + .select[disabled] { + cursor: not-allowed; + --tw-border-opacity: 1; + border-color: var(--fallback-b2,oklch(var(--b2)/var(--tw-border-opacity))); + --tw-bg-opacity: 1; + background-color: var(--fallback-b2,oklch(var(--b2)/var(--tw-bg-opacity))); + color: var(--fallback-bc,oklch(var(--bc)/0.4)); +} + +.select-disabled::-moz-placeholder, .select:disabled::-moz-placeholder, .select[disabled]::-moz-placeholder { + color: var(--fallback-bc,oklch(var(--bc)/var(--tw-placeholder-opacity))); + --tw-placeholder-opacity: 0.2; +} + +.select-disabled::placeholder, + .select:disabled::placeholder, + .select[disabled]::placeholder { + color: var(--fallback-bc,oklch(var(--bc)/var(--tw-placeholder-opacity))); + --tw-placeholder-opacity: 0.2; +} + +.select-multiple, + .select[multiple], + .select[size].select:not([size="1"]) { + background-image: none; + padding-right: 1rem; +} + +[dir="rtl"] .select { + background-position: calc(0% + 12px) calc(1px + 50%), + calc(0% + 16px) calc(1px + 50%); +} + +@keyframes skeleton { + from { + background-position: 150%; + } + + to { + background-position: -50%; + } +} + +.textarea:focus { + box-shadow: none; + border-color: var(--fallback-bc,oklch(var(--bc)/0.2)); + outline-style: solid; + outline-width: 2px; + outline-offset: 2px; + outline-color: var(--fallback-bc,oklch(var(--bc)/0.2)); +} + +.textarea-disabled, + .textarea:disabled, + .textarea[disabled] { + cursor: not-allowed; + --tw-border-opacity: 1; + border-color: var(--fallback-b2,oklch(var(--b2)/var(--tw-border-opacity))); + --tw-bg-opacity: 1; + background-color: var(--fallback-b2,oklch(var(--b2)/var(--tw-bg-opacity))); + color: var(--fallback-bc,oklch(var(--bc)/0.4)); +} + +.textarea-disabled::-moz-placeholder, .textarea:disabled::-moz-placeholder, .textarea[disabled]::-moz-placeholder { + color: var(--fallback-bc,oklch(var(--bc)/var(--tw-placeholder-opacity))); + --tw-placeholder-opacity: 0.2; +} + +.textarea-disabled::placeholder, + .textarea:disabled::placeholder, + .textarea[disabled]::placeholder { + color: var(--fallback-bc,oklch(var(--bc)/var(--tw-placeholder-opacity))); + --tw-placeholder-opacity: 0.2; +} + +@keyframes toast-pop { + 0% { + transform: scale(0.9); + opacity: 0; + } + + 100% { + transform: scale(1); + opacity: 1; + } +} + +:root .prose { + --tw-prose-body: var(--fallback-bc,oklch(var(--bc)/0.8)); + --tw-prose-headings: var(--fallback-bc,oklch(var(--bc)/1)); + --tw-prose-lead: var(--fallback-bc,oklch(var(--bc)/1)); + --tw-prose-links: var(--fallback-bc,oklch(var(--bc)/1)); + --tw-prose-bold: var(--fallback-bc,oklch(var(--bc)/1)); + --tw-prose-counters: var(--fallback-bc,oklch(var(--bc)/1)); + --tw-prose-bullets: var(--fallback-bc,oklch(var(--bc)/0.5)); + --tw-prose-hr: var(--fallback-bc,oklch(var(--bc)/0.2)); + --tw-prose-quotes: var(--fallback-bc,oklch(var(--bc)/1)); + --tw-prose-quote-borders: var(--fallback-bc,oklch(var(--bc)/0.2)); + --tw-prose-captions: var(--fallback-bc,oklch(var(--bc)/0.5)); + --tw-prose-code: var(--fallback-bc,oklch(var(--bc)/1)); + --tw-prose-pre-code: var(--fallback-nc,oklch(var(--nc)/1)); + --tw-prose-pre-bg: var(--fallback-n,oklch(var(--n)/1)); + --tw-prose-th-borders: var(--fallback-bc,oklch(var(--bc)/0.5)); + --tw-prose-td-borders: var(--fallback-bc,oklch(var(--bc)/0.2)); +} + +.prose :where(code):not(:where([class~="not-prose"] *, pre *)) { + padding: 1px 8px; + border-radius: var(--rounded-badge); + font-weight: initial; + background-color: var(--fallback-bc,oklch(var(--bc)/0.1)); +} + +.prose :where(code):not(:where([class~="not-prose"], [class~="not-prose"] *))::before, .prose :where(code):not(:where([class~="not-prose"], [class~="not-prose"] *))::after { + display: none; +} + +.prose pre code { + border-radius: 0; + padding: 0; +} + +.prose :where(tbody tr, thead):not(:where([class~="not-prose"] *)) { + border-bottom-color: var(--fallback-bc,oklch(var(--bc)/0.2)); +} + +.card-compact .card-body { + padding: 1rem; + font-size: 0.875rem; + line-height: 1.25rem; +} + +.card-compact .card-title { + margin-bottom: 0.25rem; +} + +.card-normal .card-body { + padding: var(--padding-card, 2rem); + font-size: 1rem; + line-height: 1.5rem; +} + +.card-normal .card-title { + margin-bottom: 0.75rem; +} + +.prose { + color: var(--tw-prose-body); + max-width: 65ch; +} + +.prose :where(p):not(:where([class~="not-prose"],[class~="not-prose"] *)) { + margin-top: 1.25em; + margin-bottom: 1.25em; +} + +.prose :where([class~="lead"]):not(:where([class~="not-prose"],[class~="not-prose"] *)) { + color: var(--tw-prose-lead); + font-size: 1.25em; + line-height: 1.6; + margin-top: 1.2em; + margin-bottom: 1.2em; +} + +.prose :where(a):not(:where([class~="not-prose"],[class~="not-prose"] *)) { + color: var(--tw-prose-links); + text-decoration: underline; + font-weight: 500; +} + +.prose :where(strong):not(:where([class~="not-prose"],[class~="not-prose"] *)) { + color: var(--tw-prose-bold); + font-weight: 600; +} + +.prose :where(a strong):not(:where([class~="not-prose"],[class~="not-prose"] *)) { + color: inherit; +} + +.prose :where(blockquote strong):not(:where([class~="not-prose"],[class~="not-prose"] *)) { + color: inherit; +} + +.prose :where(thead th strong):not(:where([class~="not-prose"],[class~="not-prose"] *)) { + color: inherit; +} + +.prose :where(ol):not(:where([class~="not-prose"],[class~="not-prose"] *)) { + list-style-type: decimal; + margin-top: 1.25em; + margin-bottom: 1.25em; + padding-inline-start: 1.625em; +} + +.prose :where(ol[type="A"]):not(:where([class~="not-prose"],[class~="not-prose"] *)) { + list-style-type: upper-alpha; +} + +.prose :where(ol[type="a"]):not(:where([class~="not-prose"],[class~="not-prose"] *)) { + list-style-type: lower-alpha; +} + +.prose :where(ol[type="A" s]):not(:where([class~="not-prose"],[class~="not-prose"] *)) { + list-style-type: upper-alpha; +} + +.prose :where(ol[type="a" s]):not(:where([class~="not-prose"],[class~="not-prose"] *)) { + list-style-type: lower-alpha; +} + +.prose :where(ol[type="I"]):not(:where([class~="not-prose"],[class~="not-prose"] *)) { + list-style-type: upper-roman; +} + +.prose :where(ol[type="i"]):not(:where([class~="not-prose"],[class~="not-prose"] *)) { + list-style-type: lower-roman; +} + +.prose :where(ol[type="I" s]):not(:where([class~="not-prose"],[class~="not-prose"] *)) { + list-style-type: upper-roman; +} + +.prose :where(ol[type="i" s]):not(:where([class~="not-prose"],[class~="not-prose"] *)) { + list-style-type: lower-roman; +} + +.prose :where(ol[type="1"]):not(:where([class~="not-prose"],[class~="not-prose"] *)) { + list-style-type: decimal; +} + +.prose :where(ul):not(:where([class~="not-prose"],[class~="not-prose"] *)) { + list-style-type: disc; + margin-top: 1.25em; + margin-bottom: 1.25em; + padding-inline-start: 1.625em; +} + +.prose :where(ol > li):not(:where([class~="not-prose"],[class~="not-prose"] *))::marker { + font-weight: 400; + color: var(--tw-prose-counters); +} + +.prose :where(ul > li):not(:where([class~="not-prose"],[class~="not-prose"] *))::marker { + color: var(--tw-prose-bullets); +} + +.prose :where(dt):not(:where([class~="not-prose"],[class~="not-prose"] *)) { + color: var(--tw-prose-headings); + font-weight: 600; + margin-top: 1.25em; +} + +.prose :where(hr):not(:where([class~="not-prose"],[class~="not-prose"] *)) { + border-color: var(--tw-prose-hr); + border-top-width: 1px; + margin-top: 3em; + margin-bottom: 3em; +} + +.prose :where(blockquote):not(:where([class~="not-prose"],[class~="not-prose"] *)) { + font-weight: 500; + font-style: italic; + color: var(--tw-prose-quotes); + border-inline-start-width: 0.25rem; + border-inline-start-color: var(--tw-prose-quote-borders); + quotes: "\201C""\201D""\2018""\2019"; + margin-top: 1.6em; + margin-bottom: 1.6em; + padding-inline-start: 1em; +} + +.prose :where(blockquote p:first-of-type):not(:where([class~="not-prose"],[class~="not-prose"] *))::before { + content: open-quote; +} + +.prose :where(blockquote p:last-of-type):not(:where([class~="not-prose"],[class~="not-prose"] *))::after { + content: close-quote; +} + +.prose :where(h1):not(:where([class~="not-prose"],[class~="not-prose"] *)) { + color: var(--tw-prose-headings); + font-weight: 800; + font-size: 2.25em; + margin-top: 0; + margin-bottom: 0.8888889em; + line-height: 1.1111111; +} + +.prose :where(h1 strong):not(:where([class~="not-prose"],[class~="not-prose"] *)) { + font-weight: 900; + color: inherit; +} + +.prose :where(h2):not(:where([class~="not-prose"],[class~="not-prose"] *)) { + color: var(--tw-prose-headings); + font-weight: 700; + font-size: 1.5em; + margin-top: 2em; + margin-bottom: 1em; + line-height: 1.3333333; +} + +.prose :where(h2 strong):not(:where([class~="not-prose"],[class~="not-prose"] *)) { + font-weight: 800; + color: inherit; +} + +.prose :where(h3):not(:where([class~="not-prose"],[class~="not-prose"] *)) { + color: var(--tw-prose-headings); + font-weight: 600; + font-size: 1.25em; + margin-top: 1.6em; + margin-bottom: 0.6em; + line-height: 1.6; +} + +.prose :where(h3 strong):not(:where([class~="not-prose"],[class~="not-prose"] *)) { + font-weight: 700; + color: inherit; +} + +.prose :where(h4):not(:where([class~="not-prose"],[class~="not-prose"] *)) { + color: var(--tw-prose-headings); + font-weight: 600; + margin-top: 1.5em; + margin-bottom: 0.5em; + line-height: 1.5; +} + +.prose :where(h4 strong):not(:where([class~="not-prose"],[class~="not-prose"] *)) { + font-weight: 700; + color: inherit; +} + +.prose :where(img):not(:where([class~="not-prose"],[class~="not-prose"] *)) { + margin-top: 2em; + margin-bottom: 2em; +} + +.prose :where(picture):not(:where([class~="not-prose"],[class~="not-prose"] *)) { + display: block; + margin-top: 2em; + margin-bottom: 2em; +} + +.prose :where(video):not(:where([class~="not-prose"],[class~="not-prose"] *)) { + margin-top: 2em; + margin-bottom: 2em; +} + +.prose :where(kbd):not(:where([class~="not-prose"],[class~="not-prose"] *)) { + font-weight: 500; + font-family: inherit; + color: var(--tw-prose-kbd); + box-shadow: 0 0 0 1px rgb(var(--tw-prose-kbd-shadows) / 10%), 0 3px 0 rgb(var(--tw-prose-kbd-shadows) / 10%); + font-size: 0.875em; + border-radius: 0.3125rem; + padding-top: 0.1875em; + padding-inline-end: 0.375em; + padding-bottom: 0.1875em; + padding-inline-start: 0.375em; +} + +.prose :where(code):not(:where([class~="not-prose"],[class~="not-prose"] *)) { + color: var(--tw-prose-code); + font-weight: 600; + font-size: 0.875em; +} + +.prose :where(code):not(:where([class~="not-prose"],[class~="not-prose"] *))::before { + content: "`"; +} + +.prose :where(code):not(:where([class~="not-prose"],[class~="not-prose"] *))::after { + content: "`"; +} + +.prose :where(a code):not(:where([class~="not-prose"],[class~="not-prose"] *)) { + color: inherit; +} + +.prose :where(h1 code):not(:where([class~="not-prose"],[class~="not-prose"] *)) { + color: inherit; +} + +.prose :where(h2 code):not(:where([class~="not-prose"],[class~="not-prose"] *)) { + color: inherit; + font-size: 0.875em; +} + +.prose :where(h3 code):not(:where([class~="not-prose"],[class~="not-prose"] *)) { + color: inherit; + font-size: 0.9em; +} + +.prose :where(h4 code):not(:where([class~="not-prose"],[class~="not-prose"] *)) { + color: inherit; +} + +.prose :where(blockquote code):not(:where([class~="not-prose"],[class~="not-prose"] *)) { + color: inherit; +} + +.prose :where(thead th code):not(:where([class~="not-prose"],[class~="not-prose"] *)) { + color: inherit; +} + +.prose :where(pre):not(:where([class~="not-prose"],[class~="not-prose"] *)) { + color: var(--tw-prose-pre-code); + background-color: var(--tw-prose-pre-bg); + overflow-x: auto; + font-weight: 400; + font-size: 0.875em; + line-height: 1.7142857; + margin-top: 1.7142857em; + margin-bottom: 1.7142857em; + border-radius: 0.375rem; + padding-top: 0.8571429em; + padding-inline-end: 1.1428571em; + padding-bottom: 0.8571429em; + padding-inline-start: 1.1428571em; +} + +.prose :where(pre code):not(:where([class~="not-prose"],[class~="not-prose"] *)) { + background-color: transparent; + border-width: 0; + border-radius: 0; + padding: 0; + font-weight: inherit; + color: inherit; + font-size: inherit; + font-family: inherit; + line-height: inherit; +} + +.prose :where(pre code):not(:where([class~="not-prose"],[class~="not-prose"] *))::before { + content: none; +} + +.prose :where(pre code):not(:where([class~="not-prose"],[class~="not-prose"] *))::after { + content: none; +} + +.prose :where(table):not(:where([class~="not-prose"],[class~="not-prose"] *)) { + width: 100%; + table-layout: auto; + text-align: start; + margin-top: 2em; + margin-bottom: 2em; + font-size: 0.875em; + line-height: 1.7142857; +} + +.prose :where(thead):not(:where([class~="not-prose"],[class~="not-prose"] *)) { + border-bottom-width: 1px; + border-bottom-color: var(--tw-prose-th-borders); +} + +.prose :where(thead th):not(:where([class~="not-prose"],[class~="not-prose"] *)) { + color: var(--tw-prose-headings); + font-weight: 600; + vertical-align: bottom; + padding-inline-end: 0.5714286em; + padding-bottom: 0.5714286em; + padding-inline-start: 0.5714286em; +} + +.prose :where(tbody tr):not(:where([class~="not-prose"],[class~="not-prose"] *)) { + border-bottom-width: 1px; + border-bottom-color: var(--tw-prose-td-borders); +} + +.prose :where(tbody tr:last-child):not(:where([class~="not-prose"],[class~="not-prose"] *)) { + border-bottom-width: 0; +} + +.prose :where(tbody td):not(:where([class~="not-prose"],[class~="not-prose"] *)) { + vertical-align: baseline; +} + +.prose :where(tfoot):not(:where([class~="not-prose"],[class~="not-prose"] *)) { + border-top-width: 1px; + border-top-color: var(--tw-prose-th-borders); +} + +.prose :where(tfoot td):not(:where([class~="not-prose"],[class~="not-prose"] *)) { + vertical-align: top; +} + +.prose :where(figure > *):not(:where([class~="not-prose"],[class~="not-prose"] *)) { + margin-top: 0; + margin-bottom: 0; +} + +.prose :where(figcaption):not(:where([class~="not-prose"],[class~="not-prose"] *)) { + color: var(--tw-prose-captions); + font-size: 0.875em; + line-height: 1.4285714; + margin-top: 0.8571429em; +} + +.prose { + --tw-prose-body: #374151; + --tw-prose-headings: #111827; + --tw-prose-lead: #4b5563; + --tw-prose-links: #111827; + --tw-prose-bold: #111827; + --tw-prose-counters: #6b7280; + --tw-prose-bullets: #d1d5db; + --tw-prose-hr: #e5e7eb; + --tw-prose-quotes: #111827; + --tw-prose-quote-borders: #e5e7eb; + --tw-prose-captions: #6b7280; + --tw-prose-kbd: #111827; + --tw-prose-kbd-shadows: 17 24 39; + --tw-prose-code: #111827; + --tw-prose-pre-code: #e5e7eb; + --tw-prose-pre-bg: #1f2937; + --tw-prose-th-borders: #d1d5db; + --tw-prose-td-borders: #e5e7eb; + --tw-prose-invert-body: #d1d5db; + --tw-prose-invert-headings: #fff; + --tw-prose-invert-lead: #9ca3af; + --tw-prose-invert-links: #fff; + --tw-prose-invert-bold: #fff; + --tw-prose-invert-counters: #9ca3af; + --tw-prose-invert-bullets: #4b5563; + --tw-prose-invert-hr: #374151; + --tw-prose-invert-quotes: #f3f4f6; + --tw-prose-invert-quote-borders: #374151; + --tw-prose-invert-captions: #9ca3af; + --tw-prose-invert-kbd: #fff; + --tw-prose-invert-kbd-shadows: 255 255 255; + --tw-prose-invert-code: #fff; + --tw-prose-invert-pre-code: #d1d5db; + --tw-prose-invert-pre-bg: rgb(0 0 0 / 50%); + --tw-prose-invert-th-borders: #4b5563; + --tw-prose-invert-td-borders: #374151; + font-size: 1rem; + line-height: 1.75; +} + +.prose :where(picture > img):not(:where([class~="not-prose"],[class~="not-prose"] *)) { + margin-top: 0; + margin-bottom: 0; +} + +.prose :where(li):not(:where([class~="not-prose"],[class~="not-prose"] *)) { + margin-top: 0.5em; + margin-bottom: 0.5em; +} + +.prose :where(ol > li):not(:where([class~="not-prose"],[class~="not-prose"] *)) { + padding-inline-start: 0.375em; +} + +.prose :where(ul > li):not(:where([class~="not-prose"],[class~="not-prose"] *)) { + padding-inline-start: 0.375em; +} + +.prose :where(.prose > ul > li p):not(:where([class~="not-prose"],[class~="not-prose"] *)) { + margin-top: 0.75em; + margin-bottom: 0.75em; +} + +.prose :where(.prose > ul > li > p:first-child):not(:where([class~="not-prose"],[class~="not-prose"] *)) { + margin-top: 1.25em; +} + +.prose :where(.prose > ul > li > p:last-child):not(:where([class~="not-prose"],[class~="not-prose"] *)) { + margin-bottom: 1.25em; +} + +.prose :where(.prose > ol > li > p:first-child):not(:where([class~="not-prose"],[class~="not-prose"] *)) { + margin-top: 1.25em; +} + +.prose :where(.prose > ol > li > p:last-child):not(:where([class~="not-prose"],[class~="not-prose"] *)) { + margin-bottom: 1.25em; +} + +.prose :where(ul ul, ul ol, ol ul, ol ol):not(:where([class~="not-prose"],[class~="not-prose"] *)) { + margin-top: 0.75em; + margin-bottom: 0.75em; +} + +.prose :where(dl):not(:where([class~="not-prose"],[class~="not-prose"] *)) { + margin-top: 1.25em; + margin-bottom: 1.25em; +} + +.prose :where(dd):not(:where([class~="not-prose"],[class~="not-prose"] *)) { + margin-top: 0.5em; + padding-inline-start: 1.625em; +} + +.prose :where(hr + *):not(:where([class~="not-prose"],[class~="not-prose"] *)) { + margin-top: 0; +} + +.prose :where(h2 + *):not(:where([class~="not-prose"],[class~="not-prose"] *)) { + margin-top: 0; +} + +.prose :where(h3 + *):not(:where([class~="not-prose"],[class~="not-prose"] *)) { + margin-top: 0; +} + +.prose :where(h4 + *):not(:where([class~="not-prose"],[class~="not-prose"] *)) { + margin-top: 0; +} + +.prose :where(thead th:first-child):not(:where([class~="not-prose"],[class~="not-prose"] *)) { + padding-inline-start: 0; +} + +.prose :where(thead th:last-child):not(:where([class~="not-prose"],[class~="not-prose"] *)) { + padding-inline-end: 0; +} + +.prose :where(tbody td, tfoot td):not(:where([class~="not-prose"],[class~="not-prose"] *)) { + padding-top: 0.5714286em; + padding-inline-end: 0.5714286em; + padding-bottom: 0.5714286em; + padding-inline-start: 0.5714286em; +} + +.prose :where(tbody td:first-child, tfoot td:first-child):not(:where([class~="not-prose"],[class~="not-prose"] *)) { + padding-inline-start: 0; +} + +.prose :where(tbody td:last-child, tfoot td:last-child):not(:where([class~="not-prose"],[class~="not-prose"] *)) { + padding-inline-end: 0; +} + +.prose :where(figure):not(:where([class~="not-prose"],[class~="not-prose"] *)) { + margin-top: 2em; + margin-bottom: 2em; +} + +.prose :where(.prose > :first-child):not(:where([class~="not-prose"],[class~="not-prose"] *)) { + margin-top: 0; +} + +.prose :where(.prose > :last-child):not(:where([class~="not-prose"],[class~="not-prose"] *)) { + margin-bottom: 0; +} + +.sr-only { + position: absolute; + width: 1px; + height: 1px; + padding: 0; + margin: -1px; + overflow: hidden; + clip: rect(0, 0, 0, 0); + white-space: nowrap; + border-width: 0; +} + +.fixed { + position: fixed; +} + +.inset-y-0 { + top: 0px; + bottom: 0px; +} + +.z-50 { + z-index: 50; +} + +.-mx-2 { + margin-left: -0.5rem; + margin-right: -0.5rem; +} + +.-mx-6 { + margin-left: -1.5rem; + margin-right: -1.5rem; +} + +.mt-10 { + margin-top: 2.5rem; +} + +.mt-2 { + margin-top: 0.5rem; +} + +.mt-6 { + margin-top: 1.5rem; +} + +.mt-auto { + margin-top: auto; +} + +.block { + display: block; +} + +.flex { + display: flex; +} + +.hidden { + display: none; +} + +.h-16 { + height: 4rem; +} + +.h-6 { + height: 1.5rem; +} + +.h-8 { + height: 2rem; +} + +.h-full { + height: 100%; +} + +.h-max { + height: -moz-max-content; + height: max-content; +} + +.min-h-full { + min-height: 100%; +} + +.w-10 { + width: 2.5rem; +} + +.w-6 { + width: 1.5rem; +} + +.w-72 { + width: 18rem; +} + +.w-8 { + width: 2rem; +} + +.w-96 { + width: 24rem; +} + +.w-auto { + width: auto; +} + +.w-full { + width: 100%; +} + +.w-max { + width: -moz-max-content; + width: max-content; +} + +.flex-1 { + flex: 1 1 0%; +} + +.shrink-0 { + flex-shrink: 0; +} + +.grow { + flex-grow: 1; +} + +.flex-col { + flex-direction: column; +} + +.items-center { + align-items: center; +} + +.justify-end { + justify-content: flex-end; +} + +.justify-center { + justify-content: center; +} + +.justify-around { + justify-content: space-around; +} + +.gap-2 { + gap: 0.5rem; +} + +.gap-x-3 { + -moz-column-gap: 0.75rem; + column-gap: 0.75rem; +} + +.gap-x-4 { + -moz-column-gap: 1rem; + column-gap: 1rem; +} + +.gap-y-4 { + row-gap: 1rem; +} + +.gap-y-5 { + row-gap: 1.25rem; +} + +.gap-y-7 { + row-gap: 1.75rem; +} + +.space-y-1 > :not([hidden]) ~ :not([hidden]) { + --tw-space-y-reverse: 0; + margin-top: calc(0.25rem * calc(1 - var(--tw-space-y-reverse))); + margin-bottom: calc(0.25rem * var(--tw-space-y-reverse)); +} + +.space-y-6 > :not([hidden]) ~ :not([hidden]) { + --tw-space-y-reverse: 0; + margin-top: calc(1.5rem * calc(1 - var(--tw-space-y-reverse))); + margin-bottom: calc(1.5rem * var(--tw-space-y-reverse)); +} + +.overflow-y-auto { + overflow-y: auto; +} + +.truncate { + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; +} + +.rounded-full { + border-radius: 9999px; +} + +.rounded-lg { + border-radius: 0.5rem; +} + +.rounded-md { + border-radius: 0.375rem; +} + +.border { + border-width: 1px; +} + +.border-0 { + border-width: 0px; +} + +.border-2 { + border-width: 2px; +} + +.border-r { + border-right-width: 1px; +} + +.border-solid { + border-style: solid; +} + +.border-gray-200 { + --tw-border-opacity: 1; + border-color: rgb(229 231 235 / var(--tw-border-opacity)); +} + +.border-black { + --tw-border-opacity: 1; + border-color: rgb(0 0 0 / var(--tw-border-opacity)); +} + +.border-gray-400 { + --tw-border-opacity: 1; + border-color: rgb(156 163 175 / var(--tw-border-opacity)); +} + +.bg-accent { + --tw-bg-opacity: 1; + background-color: var(--fallback-a,oklch(var(--a)/var(--tw-bg-opacity))); +} + +.bg-base-100 { + --tw-bg-opacity: 1; + background-color: var(--fallback-b1,oklch(var(--b1)/var(--tw-bg-opacity))); +} + +.bg-gray-100 { + --tw-bg-opacity: 1; + background-color: rgb(243 244 246 / var(--tw-bg-opacity)); +} + +.bg-gray-50 { + --tw-bg-opacity: 1; + background-color: rgb(249 250 251 / var(--tw-bg-opacity)); +} + +.bg-secondary { + --tw-bg-opacity: 1; + background-color: var(--fallback-s,oklch(var(--s)/var(--tw-bg-opacity))); +} + +.bg-white { + --tw-bg-opacity: 1; + background-color: rgb(255 255 255 / var(--tw-bg-opacity)); +} + +.p-2 { + padding: 0.5rem; +} + +.px-6 { + padding-left: 1.5rem; + padding-right: 1.5rem; +} + +.px-8 { + padding-left: 2rem; + padding-right: 2rem; +} + +.py-1 { + padding-top: 0.25rem; + padding-bottom: 0.25rem; +} + +.py-1\.5 { + padding-top: 0.375rem; + padding-bottom: 0.375rem; +} + +.py-10 { + padding-top: 2.5rem; + padding-bottom: 2.5rem; +} + +.py-12 { + padding-top: 3rem; + padding-bottom: 3rem; +} + +.py-3 { + padding-top: 0.75rem; + padding-bottom: 0.75rem; +} + +.py-8 { + padding-top: 2rem; + padding-bottom: 2rem; +} + +.pl-72 { + padding-left: 18rem; +} + +.text-center { + text-align: center; +} + +.text-2xl { + font-size: 1.5rem; + line-height: 2rem; +} + +.text-\[0\.625rem\] { + font-size: 0.625rem; +} + +.text-sm { + font-size: 0.875rem; + line-height: 1.25rem; +} + +.text-xl { + font-size: 1.25rem; + line-height: 1.75rem; +} + +.text-xs { + font-size: 0.75rem; + line-height: 1rem; +} + +.font-bold { + font-weight: 700; +} + +.font-medium { + font-weight: 500; +} + +.font-semibold { + font-weight: 600; +} + +.italic { + font-style: italic; +} + +.leading-6 { + line-height: 1.5rem; +} + +.leading-9 { + line-height: 2.25rem; +} + +.tracking-tight { + letter-spacing: -0.025em; +} + +.text-accent-content { + --tw-text-opacity: 1; + color: var(--fallback-ac,oklch(var(--ac)/var(--tw-text-opacity))); +} + +.text-gray-400 { + --tw-text-opacity: 1; + color: rgb(156 163 175 / var(--tw-text-opacity)); +} + +.text-gray-500 { + --tw-text-opacity: 1; + color: rgb(107 114 128 / var(--tw-text-opacity)); +} + +.text-gray-700 { + --tw-text-opacity: 1; + color: rgb(55 65 81 / var(--tw-text-opacity)); +} + +.text-gray-900 { + --tw-text-opacity: 1; + color: rgb(17 24 39 / var(--tw-text-opacity)); +} + +.text-indigo-600 { + --tw-text-opacity: 1; + color: rgb(79 70 229 / var(--tw-text-opacity)); +} + +.text-secondary-content { + --tw-text-opacity: 1; + color: var(--fallback-sc,oklch(var(--sc)/var(--tw-text-opacity))); +} + +.shadow { + --tw-shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1); + --tw-shadow-colored: 0 1px 3px 0 var(--tw-shadow-color), 0 1px 2px -1px var(--tw-shadow-color); + box-shadow: var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow); +} + +.shadow-md { + --tw-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1); + --tw-shadow-colored: 0 4px 6px -1px var(--tw-shadow-color), 0 2px 4px -2px var(--tw-shadow-color); + box-shadow: var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow); +} + +.shadow-sm { + --tw-shadow: 0 1px 2px 0 rgb(0 0 0 / 0.05); + --tw-shadow-colored: 0 1px 2px 0 var(--tw-shadow-color); + box-shadow: var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow); +} + +.ring-1 { + --tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color); + --tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color); + box-shadow: var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow, 0 0 #0000); +} + +.ring-inset { + --tw-ring-inset: inset; +} + +.ring-gray-300 { + --tw-ring-opacity: 1; + --tw-ring-color: rgb(209 213 219 / var(--tw-ring-opacity)); +} + +/* Borrowed from https://github.com/Milkdown/milkdown/blob/main/e2e/src/list-item-block/style.css +which is licensed under MIT. */ + +.prose :where(li):not(:where([class~="not-prose"] *)) { + margin-top: 0.5em; + margin-bottom: 0; +} + +.prose :where(blockquote):not(:where([class~="not-prose"] *)) { + font-style: inherit; + font-weight: inherit; +} + +.prose :where(ul ul, ul ol, ol ul, ol ol):not(:where([class~="not-prose"] *)) { + margin-top: 0.5em; + margin-bottom: 0; +} + +.prose ol, +.prose ul { + list-style: none !important; + padding: 0; +} + +.prose li p { + margin: 0px !important; + line-height: 1.5rem !important; +} + +.prose li p + p { + margin-top: 0.5rem !important; +} + +.prose li.ProseMirror-selectednode { + outline: 2px solid #8cf; +} + +.prose li::after { + all: unset !important; +} + +milkdown-list-item-block .list-item { + gap: 8px; +} + +milkdown-list-item-block .label-wrapper { + height: 24px; + display: inline-flex; + justify-content: center; + align-items: center; + color: darkcyan; +} + +/* End borrowed block. */ + +.placeholder\:text-gray-400::-moz-placeholder { + --tw-text-opacity: 1; + color: rgb(156 163 175 / var(--tw-text-opacity)); +} + +.placeholder\:text-gray-400::placeholder { + --tw-text-opacity: 1; + color: rgb(156 163 175 / var(--tw-text-opacity)); +} + +.hover\:bg-gray-100:hover { + --tw-bg-opacity: 1; + background-color: rgb(243 244 246 / var(--tw-bg-opacity)); +} + +.hover\:bg-gray-50:hover { + --tw-bg-opacity: 1; + background-color: rgb(249 250 251 / var(--tw-bg-opacity)); +} + +.hover\:text-gray-900:hover { + --tw-text-opacity: 1; + color: rgb(17 24 39 / var(--tw-text-opacity)); +} + +.hover\:text-indigo-600:hover { + --tw-text-opacity: 1; + color: rgb(79 70 229 / var(--tw-text-opacity)); +} + +.focus\:ring-2:focus { + --tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color); + --tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color); + box-shadow: var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow, 0 0 #0000); +} + +.focus\:ring-inset:focus { + --tw-ring-inset: inset; +} + +.focus\:ring-accent:focus { + --tw-ring-opacity: 1; + --tw-ring-color: var(--fallback-a,oklch(var(--a)/var(--tw-ring-opacity))); +} + +.group:hover .group-hover\:border-indigo-600 { + --tw-border-opacity: 1; + border-color: rgb(79 70 229 / var(--tw-border-opacity)); +} + +.group:hover .group-hover\:text-gray-900 { + --tw-text-opacity: 1; + color: rgb(17 24 39 / var(--tw-text-opacity)); +} + +.group:hover .group-hover\:text-indigo-600 { + --tw-text-opacity: 1; + color: rgb(79 70 229 / var(--tw-text-opacity)); +} + +@media (min-width: 640px) { + .sm\:mx-auto { + margin-left: auto; + margin-right: auto; + } + + .sm\:w-full { + width: 100%; + } + + .sm\:max-w-\[480px\] { + max-width: 480px; + } + + .sm\:max-w-md { + max-width: 28rem; + } + + .sm\:rounded-lg { + border-radius: 0.5rem; + } + + .sm\:px-12 { + padding-left: 3rem; + padding-right: 3rem; + } + + .sm\:px-6 { + padding-left: 1.5rem; + padding-right: 1.5rem; + } + + .sm\:text-sm { + font-size: 0.875rem; + line-height: 1.25rem; + } + + .sm\:leading-6 { + line-height: 1.5rem; + } +} + +@media (min-width: 1024px) { + .lg\:px-8 { + padding-left: 2rem; + padding-right: 2rem; + } +} diff --git a/tailwind.config.js b/tailwind.config.js index bd73443..92ed479 100644 --- a/tailwind.config.js +++ b/tailwind.config.js @@ -1,9 +1,41 @@ /** @type {import('tailwindcss').Config} */ module.exports = { - content: ["./templates/**/*.html"], + content: ["./templates/**/*.html", "./frontend/**/*.ts"], theme: { extend: {}, }, - plugins: [], + plugins: [ + require('daisyui'), + require('@tailwindcss/typography'), + require('@tailwindcss/forms'), + ], + daisyui: { + themes: [ + { + "pique": { + "primary": "#F5A9B8", + "primary-content": "#150a0c", + "secondary": "#5BCEFA", + "secondary-content": "#030f15", + "accent": "#A2E4B8", + "accent-content": "#0a120c", + "neutral": "#ff00ff", + "neutral-content": "#160016", + "base-100": "#ffffff", + "base-200": "#dedede", + "base-300": "#bebebe", + "base-content": "#161616", + "info": "#4f46e5", + "info-content": "#d6ddfe", + "success": "#0f766e", + "success-content": "#d3e3e0", + "warning": "#eab308", + "warning-content": "#130c00", + "error": "#ef4444", + "error-content": "#140202", + } + }, + ], + }, } diff --git a/templates/components/nav/main_item.html b/templates/components/nav/main_item.html new file mode 100644 index 0000000..91c5734 --- /dev/null +++ b/templates/components/nav/main_item.html @@ -0,0 +1,17 @@ +<li> +{% if selected %} +<a href="{{ path }}" class="bg-gray-100 text-gray-900 group flex gap-x-3 rounded-md p-2 text-sm leading-6 font-semibold"> + <svg class="h-6 w-6 shrink-0 text-gray-900" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" aria-hidden="true"> + <path stroke-linecap="round" stroke-linejoin="round" d="{{ svg }}" /> + </svg> + {{ text }} + </a> +{% else %} + <a href="{{ path }}" class="text-gray-700 hover:text-gray-900 hover:bg-gray-100 group flex gap-x-3 rounded-md p-2 text-sm leading-6 font-semibold"> + <svg class="h-6 w-6 shrink-0 text-gray-400 group-hover:text-gray-900" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" aria-hidden="true"> + <path stroke-linecap="round" stroke-linejoin="round" d="{{ svg }}" /> + </svg> + {{ text }} + </a> +{% endif %} +</li> diff --git a/templates/components/sidebar.html b/templates/components/sidebar.html new file mode 100644 index 0000000..a36728e --- /dev/null +++ b/templates/components/sidebar.html @@ -0,0 +1,76 @@ + +<div class="fixed inset-y-0 z-50 flex w-72 flex-col"> + <div class="flex grow flex-col gap-y-5 overflow-y-auto border-r border-gray-20 bg-white px-6"> + + <div class="flex h-16 shrink-0 items-center"> + <span class="h-8 w-auto text-xl">⛰️</span> + </div> + + <nav class="flex flex-1 flex-col"> + <ul role="list" class="flex flex-1 flex-col gap-y-7"> + + <li> + <ul role="list" class="-mx-2 space-y-1"> + + {% with path = "/", text = "Dashboard", selected = (current_page == "home"), svg = "M2.25 12.75V12A2.25 2.25 0 014.5 9.75h15A2.25 2.25 0 0121.75 12v.75m-8.69-6.44l-2.12-2.12a1.5 1.5 0 00-1.061-.44H4.5A2.25 2.25 0 002.25 6v12a2.25 2.25 0 002.25 2.25h15A2.25 2.25 0 0021.75 18V9a2.25 2.25 0 00-2.25-2.25h-5.379a1.5 1.5 0 01-1.06-.44z" %} + {% include "components/nav/main_item.html" %} + {% endwith %} + + {% with path = "/projects", text = "Projects", selected = (current_page == "projects"), svg = "M2.25 12.75V12A2.25 2.25 0 014.5 9.75h15A2.25 2.25 0 0121.75 12v.75m-8.69-6.44l-2.12-2.12a1.5 1.5 0 00-1.061-.44H4.5A2.25 2.25 0 002.25 6v12a2.25 2.25 0 002.25 2.25h15A2.25 2.25 0 0021.75 18V9a2.25 2.25 0 00-2.25-2.25h-5.379a1.5 1.5 0 01-1.06-.44z" %} + {% include "components/nav/main_item.html" %} + {% endwith %} + + {% with path = "/documents", text = "Documents", selected = (current_page == "documents"), svg = "M15.75 17.25v3.375c0 .621-.504 1.125-1.125 1.125h-9.75a1.125 1.125 0 01-1.125-1.125V7.875c0-.621.504-1.125 1.125-1.125H6.75a9.06 9.06 0 011.5.124m7.5 10.376h3.375c.621 0 1.125-.504 1.125-1.125V11.25c0-4.46-3.243-8.161-7.5-8.876a9.06 9.06 0 00-1.5-.124H9.375c-.621 0-1.125.504-1.125 1.125v3.5m7.5 10.375H9.375a1.125 1.125 0 01-1.125-1.125v-9.25m12 6.625v-1.875a3.375 3.375 0 00-3.375-3.375h-1.5a1.125 1.125 0 01-1.125-1.125v-1.5a3.375 3.375 0 00-3.375-3.375H9.75" %} + {% include "components/nav/main_item.html" %} + {% endwith %} + + {% with path = "/chats", text = "Chats", selected = (current_page == "chats"), svg = "M20.25 8.511c.884.284 1.5 1.128 1.5 2.097v4.286c0 1.136-.847 2.1-1.98 2.193-.34.027-.68.052-1.02.072v3.091l-3-3c-1.354 0-2.694-.055-4.02-.163a2.115 2.115 0 0 1-.825-.242m9.345-8.334a2.126 2.126 0 0 0-.476-.095 48.64 48.64 0 0 0-8.048 0c-1.131.094-1.976 1.057-1.976 2.192v4.286c0 .837.46 1.58 1.155 1.951m9.345-8.334V6.637c0-1.621-1.152-3.026-2.76-3.235A48.455 48.455 0 0 0 11.25 3c-2.115 0-4.198.137-6.24.402-1.608.209-2.76 1.614-2.76 3.235v6.226c0 1.621 1.152 3.026 2.76 3.235.577.075 1.157.14 1.74.194V21l4.155-4.155" %} + {% include "components/nav/main_item.html" %} + {% endwith %} + </ul> + </li> + + <li> + <div class="text-xs font-semibold leading-6 text-gray-400">Your projects</div> + <ul role="list" class="-mx-2 mt-2 space-y-1"> + + {% for project in projects %} + <li> + <!-- Current: "bg-gray-50 text-indigo-600", Default: "text-gray-700 hover:text-indigo-600 hover:bg-gray-50" --> + <a href="#" class="text-gray-700 hover:text-indigo-600 hover:bg-gray-50 group flex gap-x-3 rounded-md p-2 text-sm leading-6 font-semibold"> + <span class="flex h-6 w-10 shrink-0 items-center justify-center rounded-lg border text-[0.625rem] font-medium bg-white text-gray-400 border-gray-200 group-hover:border-indigo-600 group-hover:text-indigo-600">{{ project.key }}</span> + <span class="truncate">{{ project.name }}</span> + </a> + </li> + {% else %} + <div class="text-gray-500 p-2 text-xs leading-6 italic"> + No projects. + </div> + {% endfor %} + + </ul> + </li> + + <li class="-mx-6 mt-auto"> + <div class="w-auto flex justify-around items-center text-sm font-semibold leading-6 text-gray-900"> + <a href="/profile" class="flex items-center gap-x-4 px-6 py-3 hover:bg-gray-50 rounded-md"> + <div class="h-8 w-8 rounded-full bg-gray-50"> + <svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="w-8 h-8"> + <path stroke-linecap="round" stroke-linejoin="round" d="M17.982 18.725A7.488 7.488 0 0 0 12 15.75a7.488 7.488 0 0 0-5.982 2.975m11.963 0a9 9 0 1 0-11.963 0m11.963 0A8.966 8.966 0 0 1 12 21a8.966 8.966 0 0 1-5.982-2.275M15 9.75a3 3 0 1 1-6 0 3 3 0 0 1 6 0Z" /> + </svg> + </div> + + <span class="sr-only">Your profile</span> + <span aria-hidden="true" class="">Profile</span> + </a> + + <a href="/logout" class="flex px-6 py-3 hover:bg-gray-50 rounded-md"> + <span>Log out</span> + </a> + </li> + + </ul> + </nav> + + </div> +</div> diff --git a/templates/documents/create_document.html b/templates/documents/create_document.html new file mode 100644 index 0000000..2862390 --- /dev/null +++ b/templates/documents/create_document.html @@ -0,0 +1,44 @@ +<!DOCTYPE html> +<html lang="en" class="h-full bg-white"> +{% include "head.html" %} +<body class="h-full"> + +<div class="h-full"> + {% set current_page = "projects" %} + {% include "components/sidebar.html" %} + + <main class="pl-72 bg-gray-50 h-full"> + <div class="navbar bg-accent text-accent-content"> + <div class="navbar-start"> + <a class="btn" href="/projects"> + {{ "arrow-left"|heroicon("w-6 h-6")|safe }} Back + </a> + </div> + </div> + + <form action="/documents/new" method="POST"> + <div class="px-8 py-8 flex flex-col gap-y-4"> + <label class="input input-bordered flex items-center gap-2"> + Title + <input type="text" id="title" name="title" class="grow" placeholder="The title of the document is..." /> + </label> + + <label class="input input-bordered flex items-center gap-2"> + Project + <select id="project_id" name="project_id" class="grow"> + {% for project in projects %} + <option value="{{ project.id }}">{{ project.name }}</option> + {% endfor %} + </select> + </label> + + <button class="btn btn-primary">Create</button> + </div> + </form> + + </main> + + +<script type="text/javascript" src="/static/main.js"></script> +</body> +</html> diff --git a/templates/documents/edit_document.html b/templates/documents/edit_document.html new file mode 100644 index 0000000..3a86327 --- /dev/null +++ b/templates/documents/edit_document.html @@ -0,0 +1,48 @@ +<!DOCTYPE html> +<html lang="en" class="h-full bg-white"> +{% include "head.html" %} +<body class="h-full"> + +<div class="h-full"> + {% set current_page = "documents" %} + {% include "components/sidebar.html" %} + + <main class="pl-72 bg-gray-50 h-full"> + <form action="/documents/edit/{{ document.id }}" method="POST"> + <div class="navbar bg-accent text-accent-content"> + <div class="navbar-start gap-2"> + <a class="btn" href="/documents"> + {{ "arrow-left"|heroicon("w-6 h-6")|safe }} Back + </a> + <button class="btn" onClick="saveDocument()">Save</button> + </div> + </div> + + <div class="px-8 py-8 flex flex-col gap-y-4"> + <label class="input input-bordered flex items-center gap-2"> + Title + <input type="text" id="title" name="title" class="grow" value="{{ document.title }}" /> + </label> + + <div id="editor-{{document.id}}" class="prose bg-white"></div> + + <textarea id="content-{{ document.id }}" name="content" class="hidden"> + </textarea> + + </div> + </form> + </main> + + +<script type="text/javascript" src="/static/main.js"></script> +<script type="text/javascript"> +console.log("hi"); +window.createEditor("#editor-{{document.id}}", "content-{{document.id}}", {{document.content | tojson }}); +console.log({{document.content | tojson}}); +console.log("hi2"); +function saveDocument() { + console.log("saving"); +} +</script> +</body> +</html> diff --git a/templates/documents/list_documents.html b/templates/documents/list_documents.html new file mode 100644 index 0000000..c801c1e --- /dev/null +++ b/templates/documents/list_documents.html @@ -0,0 +1,45 @@ +<!DOCTYPE html> +<html lang="en" class="h-full bg-white"> +{% include "head.html" %} +<body class="h-full"> + +<div class="h-full"> + {% set current_page = "documents" %} + {% include "components/sidebar.html" %} + + <main class="pl-72 bg-gray-50 h-full"> + <div class="navbar bg-accent text-accent-content"> + <div class="navbar-start"> + <a class="btn" href="/documents/new">New Document</a> + </div> + <div class="navbar-end"> + <div class="btn"> + <svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="w-6 h-6"> + <path stroke-linecap="round" stroke-linejoin="round" d="M12 3c2.755 0 5.455.232 8.083.678.533.09.917.556.917 1.096v1.044a2.25 2.25 0 0 1-.659 1.591l-5.432 5.432a2.25 2.25 0 0 0-.659 1.591v2.927a2.25 2.25 0 0 1-1.244 2.013L9.75 21v-6.568a2.25 2.25 0 0 0-.659-1.591L3.659 7.409A2.25 2.25 0 0 1 3 5.818V4.774c0-.54.384-1.006.917-1.096A48.32 48.32 0 0 1 12 3Z" /> + </svg> + </div> + </div> + </div> + <div class="px-8 py-8 flex flex-col gap-y-4"> + + + {% for document in documents %} + <div class="card w-96 bg-base-100 shadow-md border-2 border-solid"> + <div class="card-body"> + <h2 class="card-title">{{ document.title }}</h2> + <div class="card-actions justify-end"> + <a href="/documents/edit/{{ document.id }}" class="btn btn-primary">Open</a> + + </div> + </div> + </div> + {% endfor %} + + </div> + <div id="editor" class="prose bg-white"></div> + </main> + + +<script type="text/javascript" src="/static/main.js"></script> +</body> +</html> diff --git a/templates/head.html b/templates/head.html index 33fdb38..50866bd 100644 --- a/templates/head.html +++ b/templates/head.html @@ -3,6 +3,7 @@ <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Pique + - + diff --git a/templates/home.html b/templates/home.html index 32fd3a5..f0b1f4e 100644 --- a/templates/home.html +++ b/templates/home.html @@ -2,115 +2,17 @@ {% include "head.html" %} - -
- - -
-
- - Hi there! +
+ {% set current_page = "home" %} + {% include "components/sidebar.html" %} +
+
+ Main content.
-
+ diff --git a/templates/login.html b/templates/login.html index 89994f2..202d624 100644 --- a/templates/login.html +++ b/templates/login.html @@ -1,11 +1,11 @@ - + {% include "head.html" %}
-

Sign in to Pique

+

Sign in to Pique

@@ -14,19 +14,19 @@
- +
- +
- +
diff --git a/templates/projects/create_project.html b/templates/projects/create_project.html new file mode 100644 index 0000000..e3838a2 --- /dev/null +++ b/templates/projects/create_project.html @@ -0,0 +1,45 @@ + + +{% include "head.html" %} + + +
+ {% set current_page = "projects" %} + {% include "components/sidebar.html" %} + +
+ + +
+
+ + + + + + + +
+
+ +
+ + + + + diff --git a/templates/projects/list_projects.html b/templates/projects/list_projects.html new file mode 100644 index 0000000..58c0576 --- /dev/null +++ b/templates/projects/list_projects.html @@ -0,0 +1,45 @@ + + +{% include "head.html" %} + + +
+ {% set current_page = "projects" %} + {% include "components/sidebar.html" %} + +
+ +
+ + + {% for project in projects %} +
+
+

{{ project.key }} - {{ project.name }}

+

{{ project.description }}

+
+ + +
+
+
+ {% endfor %} + +
+
+ + + + +