@uiw/react-md-editor 3.24.0 → 3.25.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (62) hide show
  1. package/README.md +50 -5
  2. package/dist/mdeditor.js +1835 -1807
  3. package/dist/mdeditor.min.js +1 -1
  4. package/esm/Context.d.ts +1 -1
  5. package/esm/Editor.d.ts +4 -149
  6. package/esm/Editor.js +0 -1
  7. package/esm/Editor.nohighlight.d.ts +12 -0
  8. package/esm/Editor.nohighlight.js +255 -0
  9. package/esm/Types.d.ts +148 -0
  10. package/esm/Types.js +1 -0
  11. package/esm/commands/index.d.ts +4 -1
  12. package/esm/commands/index.js +2 -1
  13. package/esm/components/DragBar/index.d.ts +1 -1
  14. package/esm/components/TextArea/Markdown.d.ts +1 -1
  15. package/esm/components/TextArea/Textarea.d.ts +1 -1
  16. package/esm/components/TextArea/handleKeyDown.js +1 -3
  17. package/esm/components/TextArea/index.d.ts +1 -1
  18. package/esm/components/TextArea/index.nohighlight.d.ts +27 -0
  19. package/esm/components/TextArea/index.nohighlight.js +93 -0
  20. package/esm/components/Toolbar/Child.d.ts +1 -1
  21. package/esm/components/Toolbar/index.d.ts +1 -1
  22. package/esm/index.d.ts +2 -0
  23. package/esm/index.js +2 -0
  24. package/esm/index.nohighlight.d.ts +13 -0
  25. package/esm/index.nohighlight.js +13 -0
  26. package/lib/Context.d.ts +1 -1
  27. package/lib/Editor.d.ts +4 -149
  28. package/lib/Editor.nohighlight.d.ts +12 -0
  29. package/lib/Editor.nohighlight.js +317 -0
  30. package/lib/Types.d.ts +148 -0
  31. package/lib/Types.js +1 -0
  32. package/lib/commands/index.d.ts +4 -1
  33. package/lib/commands/index.js +19 -0
  34. package/lib/components/DragBar/index.d.ts +1 -1
  35. package/lib/components/TextArea/Markdown.d.ts +1 -1
  36. package/lib/components/TextArea/Textarea.d.ts +1 -1
  37. package/lib/components/TextArea/handleKeyDown.js +1 -3
  38. package/lib/components/TextArea/index.d.ts +1 -1
  39. package/lib/components/TextArea/index.nohighlight.d.ts +27 -0
  40. package/lib/components/TextArea/index.nohighlight.js +98 -0
  41. package/lib/components/Toolbar/Child.d.ts +1 -1
  42. package/lib/components/Toolbar/index.d.ts +1 -1
  43. package/lib/index.d.ts +2 -0
  44. package/lib/index.js +12 -0
  45. package/lib/index.nohighlight.d.ts +13 -0
  46. package/lib/index.nohighlight.js +98 -0
  47. package/package.json +16 -2
  48. package/src/Context.tsx +1 -1
  49. package/src/Editor.nohighlight.tsx +264 -0
  50. package/src/Editor.tsx +5 -151
  51. package/src/Types.ts +151 -0
  52. package/src/commands/index.ts +4 -0
  53. package/src/components/DragBar/index.tsx +1 -1
  54. package/src/components/TextArea/Markdown.tsx +2 -2
  55. package/src/components/TextArea/Textarea.tsx +1 -1
  56. package/src/components/TextArea/handleKeyDown.tsx +5 -3
  57. package/src/components/TextArea/index.nohighlight.tsx +109 -0
  58. package/src/components/TextArea/index.tsx +1 -1
  59. package/src/components/Toolbar/Child.tsx +1 -1
  60. package/src/components/Toolbar/index.tsx +1 -1
  61. package/src/index.nohighlight.tsx +16 -0
  62. package/src/index.tsx +2 -0
package/dist/mdeditor.js CHANGED
@@ -17389,10 +17389,12 @@ __webpack_require__.d(__webpack_exports__, {
17389
17389
  getStateFromTextArea: () => (/* reexport */ getStateFromTextArea),
17390
17390
  getSurroundingWord: () => (/* reexport */ getSurroundingWord),
17391
17391
  group: () => (/* reexport */ group),
17392
+ help: () => (/* reexport */ help),
17392
17393
  hr: () => (/* reexport */ hr),
17393
17394
  image: () => (/* reexport */ commands_image_image),
17394
17395
  insertBeforeEachLine: () => (/* reexport */ insertBeforeEachLine),
17395
17396
  insertTextAtPosition: () => (/* reexport */ insertTextAtPosition),
17397
+ issue: () => (/* reexport */ issue),
17396
17398
  italic: () => (/* reexport */ italic),
17397
17399
  link: () => (/* reexport */ commands_link_link),
17398
17400
  orderedListCommand: () => (/* reexport */ orderedListCommand),
@@ -17401,6 +17403,7 @@ __webpack_require__.d(__webpack_exports__, {
17401
17403
  selectLine: () => (/* reexport */ selectLine),
17402
17404
  selectWord: () => (/* reexport */ selectWord),
17403
17405
  strikethrough: () => (/* reexport */ strikeThrough_strikethrough),
17406
+ table: () => (/* reexport */ table_table),
17404
17407
  title: () => (/* reexport */ title),
17405
17408
  title1: () => (/* reexport */ title1),
17406
17409
  title2: () => (/* reexport */ title2),
@@ -17472,13 +17475,16 @@ __webpack_require__.d(commands_namespaceObject, {
17472
17475
  getExtraCommands: () => (getExtraCommands),
17473
17476
  getStateFromTextArea: () => (getStateFromTextArea),
17474
17477
  group: () => (group),
17478
+ help: () => (help),
17475
17479
  hr: () => (hr),
17476
17480
  image: () => (commands_image_image),
17481
+ issue: () => (issue),
17477
17482
  italic: () => (italic),
17478
17483
  link: () => (commands_link_link),
17479
17484
  orderedListCommand: () => (orderedListCommand),
17480
17485
  quote: () => (quote),
17481
17486
  strikethrough: () => (strikeThrough_strikethrough),
17487
+ table: () => (table_table),
17482
17488
  title: () => (title),
17483
17489
  title1: () => (title1),
17484
17490
  title2: () => (title2),
@@ -43304,161 +43310,112 @@ function rehypeRaw(options = {}) {
43304
43310
  }
43305
43311
  }
43306
43312
 
43307
- ;// CONCATENATED MODULE: ../node_modules/github-slugger/regex.js
43308
- // This module is generated by `script/`.
43309
- /* eslint-disable no-control-regex, no-misleading-character-class, no-useless-escape */
43310
- const regex = /[\0-\x1F!-,\.\/:-@\[-\^`\{-\xA9\xAB-\xB4\xB6-\xB9\xBB-\xBF\xD7\xF7\u02C2-\u02C5\u02D2-\u02DF\u02E5-\u02EB\u02ED\u02EF-\u02FF\u0375\u0378\u0379\u037E\u0380-\u0385\u0387\u038B\u038D\u03A2\u03F6\u0482\u0530\u0557\u0558\u055A-\u055F\u0589-\u0590\u05BE\u05C0\u05C3\u05C6\u05C8-\u05CF\u05EB-\u05EE\u05F3-\u060F\u061B-\u061F\u066A-\u066D\u06D4\u06DD\u06DE\u06E9\u06FD\u06FE\u0700-\u070F\u074B\u074C\u07B2-\u07BF\u07F6-\u07F9\u07FB\u07FC\u07FE\u07FF\u082E-\u083F\u085C-\u085F\u086B-\u089F\u08B5\u08C8-\u08D2\u08E2\u0964\u0965\u0970\u0984\u098D\u098E\u0991\u0992\u09A9\u09B1\u09B3-\u09B5\u09BA\u09BB\u09C5\u09C6\u09C9\u09CA\u09CF-\u09D6\u09D8-\u09DB\u09DE\u09E4\u09E5\u09F2-\u09FB\u09FD\u09FF\u0A00\u0A04\u0A0B-\u0A0E\u0A11\u0A12\u0A29\u0A31\u0A34\u0A37\u0A3A\u0A3B\u0A3D\u0A43-\u0A46\u0A49\u0A4A\u0A4E-\u0A50\u0A52-\u0A58\u0A5D\u0A5F-\u0A65\u0A76-\u0A80\u0A84\u0A8E\u0A92\u0AA9\u0AB1\u0AB4\u0ABA\u0ABB\u0AC6\u0ACA\u0ACE\u0ACF\u0AD1-\u0ADF\u0AE4\u0AE5\u0AF0-\u0AF8\u0B00\u0B04\u0B0D\u0B0E\u0B11\u0B12\u0B29\u0B31\u0B34\u0B3A\u0B3B\u0B45\u0B46\u0B49\u0B4A\u0B4E-\u0B54\u0B58-\u0B5B\u0B5E\u0B64\u0B65\u0B70\u0B72-\u0B81\u0B84\u0B8B-\u0B8D\u0B91\u0B96-\u0B98\u0B9B\u0B9D\u0BA0-\u0BA2\u0BA5-\u0BA7\u0BAB-\u0BAD\u0BBA-\u0BBD\u0BC3-\u0BC5\u0BC9\u0BCE\u0BCF\u0BD1-\u0BD6\u0BD8-\u0BE5\u0BF0-\u0BFF\u0C0D\u0C11\u0C29\u0C3A-\u0C3C\u0C45\u0C49\u0C4E-\u0C54\u0C57\u0C5B-\u0C5F\u0C64\u0C65\u0C70-\u0C7F\u0C84\u0C8D\u0C91\u0CA9\u0CB4\u0CBA\u0CBB\u0CC5\u0CC9\u0CCE-\u0CD4\u0CD7-\u0CDD\u0CDF\u0CE4\u0CE5\u0CF0\u0CF3-\u0CFF\u0D0D\u0D11\u0D45\u0D49\u0D4F-\u0D53\u0D58-\u0D5E\u0D64\u0D65\u0D70-\u0D79\u0D80\u0D84\u0D97-\u0D99\u0DB2\u0DBC\u0DBE\u0DBF\u0DC7-\u0DC9\u0DCB-\u0DCE\u0DD5\u0DD7\u0DE0-\u0DE5\u0DF0\u0DF1\u0DF4-\u0E00\u0E3B-\u0E3F\u0E4F\u0E5A-\u0E80\u0E83\u0E85\u0E8B\u0EA4\u0EA6\u0EBE\u0EBF\u0EC5\u0EC7\u0ECE\u0ECF\u0EDA\u0EDB\u0EE0-\u0EFF\u0F01-\u0F17\u0F1A-\u0F1F\u0F2A-\u0F34\u0F36\u0F38\u0F3A-\u0F3D\u0F48\u0F6D-\u0F70\u0F85\u0F98\u0FBD-\u0FC5\u0FC7-\u0FFF\u104A-\u104F\u109E\u109F\u10C6\u10C8-\u10CC\u10CE\u10CF\u10FB\u1249\u124E\u124F\u1257\u1259\u125E\u125F\u1289\u128E\u128F\u12B1\u12B6\u12B7\u12BF\u12C1\u12C6\u12C7\u12D7\u1311\u1316\u1317\u135B\u135C\u1360-\u137F\u1390-\u139F\u13F6\u13F7\u13FE-\u1400\u166D\u166E\u1680\u169B-\u169F\u16EB-\u16ED\u16F9-\u16FF\u170D\u1715-\u171F\u1735-\u173F\u1754-\u175F\u176D\u1771\u1774-\u177F\u17D4-\u17D6\u17D8-\u17DB\u17DE\u17DF\u17EA-\u180A\u180E\u180F\u181A-\u181F\u1879-\u187F\u18AB-\u18AF\u18F6-\u18FF\u191F\u192C-\u192F\u193C-\u1945\u196E\u196F\u1975-\u197F\u19AC-\u19AF\u19CA-\u19CF\u19DA-\u19FF\u1A1C-\u1A1F\u1A5F\u1A7D\u1A7E\u1A8A-\u1A8F\u1A9A-\u1AA6\u1AA8-\u1AAF\u1AC1-\u1AFF\u1B4C-\u1B4F\u1B5A-\u1B6A\u1B74-\u1B7F\u1BF4-\u1BFF\u1C38-\u1C3F\u1C4A-\u1C4C\u1C7E\u1C7F\u1C89-\u1C8F\u1CBB\u1CBC\u1CC0-\u1CCF\u1CD3\u1CFB-\u1CFF\u1DFA\u1F16\u1F17\u1F1E\u1F1F\u1F46\u1F47\u1F4E\u1F4F\u1F58\u1F5A\u1F5C\u1F5E\u1F7E\u1F7F\u1FB5\u1FBD\u1FBF-\u1FC1\u1FC5\u1FCD-\u1FCF\u1FD4\u1FD5\u1FDC-\u1FDF\u1FED-\u1FF1\u1FF5\u1FFD-\u203E\u2041-\u2053\u2055-\u2070\u2072-\u207E\u2080-\u208F\u209D-\u20CF\u20F1-\u2101\u2103-\u2106\u2108\u2109\u2114\u2116-\u2118\u211E-\u2123\u2125\u2127\u2129\u212E\u213A\u213B\u2140-\u2144\u214A-\u214D\u214F-\u215F\u2189-\u24B5\u24EA-\u2BFF\u2C2F\u2C5F\u2CE5-\u2CEA\u2CF4-\u2CFF\u2D26\u2D28-\u2D2C\u2D2E\u2D2F\u2D68-\u2D6E\u2D70-\u2D7E\u2D97-\u2D9F\u2DA7\u2DAF\u2DB7\u2DBF\u2DC7\u2DCF\u2DD7\u2DDF\u2E00-\u2E2E\u2E30-\u3004\u3008-\u3020\u3030\u3036\u3037\u303D-\u3040\u3097\u3098\u309B\u309C\u30A0\u30FB\u3100-\u3104\u3130\u318F-\u319F\u31C0-\u31EF\u3200-\u33FF\u4DC0-\u4DFF\u9FFD-\u9FFF\uA48D-\uA4CF\uA4FE\uA4FF\uA60D-\uA60F\uA62C-\uA63F\uA673\uA67E\uA6F2-\uA716\uA720\uA721\uA789\uA78A\uA7C0\uA7C1\uA7CB-\uA7F4\uA828-\uA82B\uA82D-\uA83F\uA874-\uA87F\uA8C6-\uA8CF\uA8DA-\uA8DF\uA8F8-\uA8FA\uA8FC\uA92E\uA92F\uA954-\uA95F\uA97D-\uA97F\uA9C1-\uA9CE\uA9DA-\uA9DF\uA9FF\uAA37-\uAA3F\uAA4E\uAA4F\uAA5A-\uAA5F\uAA77-\uAA79\uAAC3-\uAADA\uAADE\uAADF\uAAF0\uAAF1\uAAF7-\uAB00\uAB07\uAB08\uAB0F\uAB10\uAB17-\uAB1F\uAB27\uAB2F\uAB5B\uAB6A-\uAB6F\uABEB\uABEE\uABEF\uABFA-\uABFF\uD7A4-\uD7AF\uD7C7-\uD7CA\uD7FC-\uD7FF\uE000-\uF8FF\uFA6E\uFA6F\uFADA-\uFAFF\uFB07-\uFB12\uFB18-\uFB1C\uFB29\uFB37\uFB3D\uFB3F\uFB42\uFB45\uFBB2-\uFBD2\uFD3E-\uFD4F\uFD90\uFD91\uFDC8-\uFDEF\uFDFC-\uFDFF\uFE10-\uFE1F\uFE30-\uFE32\uFE35-\uFE4C\uFE50-\uFE6F\uFE75\uFEFD-\uFF0F\uFF1A-\uFF20\uFF3B-\uFF3E\uFF40\uFF5B-\uFF65\uFFBF-\uFFC1\uFFC8\uFFC9\uFFD0\uFFD1\uFFD8\uFFD9\uFFDD-\uFFFF]|\uD800[\uDC0C\uDC27\uDC3B\uDC3E\uDC4E\uDC4F\uDC5E-\uDC7F\uDCFB-\uDD3F\uDD75-\uDDFC\uDDFE-\uDE7F\uDE9D-\uDE9F\uDED1-\uDEDF\uDEE1-\uDEFF\uDF20-\uDF2C\uDF4B-\uDF4F\uDF7B-\uDF7F\uDF9E\uDF9F\uDFC4-\uDFC7\uDFD0\uDFD6-\uDFFF]|\uD801[\uDC9E\uDC9F\uDCAA-\uDCAF\uDCD4-\uDCD7\uDCFC-\uDCFF\uDD28-\uDD2F\uDD64-\uDDFF\uDF37-\uDF3F\uDF56-\uDF5F\uDF68-\uDFFF]|\uD802[\uDC06\uDC07\uDC09\uDC36\uDC39-\uDC3B\uDC3D\uDC3E\uDC56-\uDC5F\uDC77-\uDC7F\uDC9F-\uDCDF\uDCF3\uDCF6-\uDCFF\uDD16-\uDD1F\uDD3A-\uDD7F\uDDB8-\uDDBD\uDDC0-\uDDFF\uDE04\uDE07-\uDE0B\uDE14\uDE18\uDE36\uDE37\uDE3B-\uDE3E\uDE40-\uDE5F\uDE7D-\uDE7F\uDE9D-\uDEBF\uDEC8\uDEE7-\uDEFF\uDF36-\uDF3F\uDF56-\uDF5F\uDF73-\uDF7F\uDF92-\uDFFF]|\uD803[\uDC49-\uDC7F\uDCB3-\uDCBF\uDCF3-\uDCFF\uDD28-\uDD2F\uDD3A-\uDE7F\uDEAA\uDEAD-\uDEAF\uDEB2-\uDEFF\uDF1D-\uDF26\uDF28-\uDF2F\uDF51-\uDFAF\uDFC5-\uDFDF\uDFF7-\uDFFF]|\uD804[\uDC47-\uDC65\uDC70-\uDC7E\uDCBB-\uDCCF\uDCE9-\uDCEF\uDCFA-\uDCFF\uDD35\uDD40-\uDD43\uDD48-\uDD4F\uDD74\uDD75\uDD77-\uDD7F\uDDC5-\uDDC8\uDDCD\uDDDB\uDDDD-\uDDFF\uDE12\uDE38-\uDE3D\uDE3F-\uDE7F\uDE87\uDE89\uDE8E\uDE9E\uDEA9-\uDEAF\uDEEB-\uDEEF\uDEFA-\uDEFF\uDF04\uDF0D\uDF0E\uDF11\uDF12\uDF29\uDF31\uDF34\uDF3A\uDF45\uDF46\uDF49\uDF4A\uDF4E\uDF4F\uDF51-\uDF56\uDF58-\uDF5C\uDF64\uDF65\uDF6D-\uDF6F\uDF75-\uDFFF]|\uD805[\uDC4B-\uDC4F\uDC5A-\uDC5D\uDC62-\uDC7F\uDCC6\uDCC8-\uDCCF\uDCDA-\uDD7F\uDDB6\uDDB7\uDDC1-\uDDD7\uDDDE-\uDDFF\uDE41-\uDE43\uDE45-\uDE4F\uDE5A-\uDE7F\uDEB9-\uDEBF\uDECA-\uDEFF\uDF1B\uDF1C\uDF2C-\uDF2F\uDF3A-\uDFFF]|\uD806[\uDC3B-\uDC9F\uDCEA-\uDCFE\uDD07\uDD08\uDD0A\uDD0B\uDD14\uDD17\uDD36\uDD39\uDD3A\uDD44-\uDD4F\uDD5A-\uDD9F\uDDA8\uDDA9\uDDD8\uDDD9\uDDE2\uDDE5-\uDDFF\uDE3F-\uDE46\uDE48-\uDE4F\uDE9A-\uDE9C\uDE9E-\uDEBF\uDEF9-\uDFFF]|\uD807[\uDC09\uDC37\uDC41-\uDC4F\uDC5A-\uDC71\uDC90\uDC91\uDCA8\uDCB7-\uDCFF\uDD07\uDD0A\uDD37-\uDD39\uDD3B\uDD3E\uDD48-\uDD4F\uDD5A-\uDD5F\uDD66\uDD69\uDD8F\uDD92\uDD99-\uDD9F\uDDAA-\uDEDF\uDEF7-\uDFAF\uDFB1-\uDFFF]|\uD808[\uDF9A-\uDFFF]|\uD809[\uDC6F-\uDC7F\uDD44-\uDFFF]|[\uD80A\uD80B\uD80E-\uD810\uD812-\uD819\uD824-\uD82B\uD82D\uD82E\uD830-\uD833\uD837\uD839\uD83D\uD83F\uD87B-\uD87D\uD87F\uD885-\uDB3F\uDB41-\uDBFF][\uDC00-\uDFFF]|\uD80D[\uDC2F-\uDFFF]|\uD811[\uDE47-\uDFFF]|\uD81A[\uDE39-\uDE3F\uDE5F\uDE6A-\uDECF\uDEEE\uDEEF\uDEF5-\uDEFF\uDF37-\uDF3F\uDF44-\uDF4F\uDF5A-\uDF62\uDF78-\uDF7C\uDF90-\uDFFF]|\uD81B[\uDC00-\uDE3F\uDE80-\uDEFF\uDF4B-\uDF4E\uDF88-\uDF8E\uDFA0-\uDFDF\uDFE2\uDFE5-\uDFEF\uDFF2-\uDFFF]|\uD821[\uDFF8-\uDFFF]|\uD823[\uDCD6-\uDCFF\uDD09-\uDFFF]|\uD82C[\uDD1F-\uDD4F\uDD53-\uDD63\uDD68-\uDD6F\uDEFC-\uDFFF]|\uD82F[\uDC6B-\uDC6F\uDC7D-\uDC7F\uDC89-\uDC8F\uDC9A-\uDC9C\uDC9F-\uDFFF]|\uD834[\uDC00-\uDD64\uDD6A-\uDD6C\uDD73-\uDD7A\uDD83\uDD84\uDD8C-\uDDA9\uDDAE-\uDE41\uDE45-\uDFFF]|\uD835[\uDC55\uDC9D\uDCA0\uDCA1\uDCA3\uDCA4\uDCA7\uDCA8\uDCAD\uDCBA\uDCBC\uDCC4\uDD06\uDD0B\uDD0C\uDD15\uDD1D\uDD3A\uDD3F\uDD45\uDD47-\uDD49\uDD51\uDEA6\uDEA7\uDEC1\uDEDB\uDEFB\uDF15\uDF35\uDF4F\uDF6F\uDF89\uDFA9\uDFC3\uDFCC\uDFCD]|\uD836[\uDC00-\uDDFF\uDE37-\uDE3A\uDE6D-\uDE74\uDE76-\uDE83\uDE85-\uDE9A\uDEA0\uDEB0-\uDFFF]|\uD838[\uDC07\uDC19\uDC1A\uDC22\uDC25\uDC2B-\uDCFF\uDD2D-\uDD2F\uDD3E\uDD3F\uDD4A-\uDD4D\uDD4F-\uDEBF\uDEFA-\uDFFF]|\uD83A[\uDCC5-\uDCCF\uDCD7-\uDCFF\uDD4C-\uDD4F\uDD5A-\uDFFF]|\uD83B[\uDC00-\uDDFF\uDE04\uDE20\uDE23\uDE25\uDE26\uDE28\uDE33\uDE38\uDE3A\uDE3C-\uDE41\uDE43-\uDE46\uDE48\uDE4A\uDE4C\uDE50\uDE53\uDE55\uDE56\uDE58\uDE5A\uDE5C\uDE5E\uDE60\uDE63\uDE65\uDE66\uDE6B\uDE73\uDE78\uDE7D\uDE7F\uDE8A\uDE9C-\uDEA0\uDEA4\uDEAA\uDEBC-\uDFFF]|\uD83C[\uDC00-\uDD2F\uDD4A-\uDD4F\uDD6A-\uDD6F\uDD8A-\uDFFF]|\uD83E[\uDC00-\uDFEF\uDFFA-\uDFFF]|\uD869[\uDEDE-\uDEFF]|\uD86D[\uDF35-\uDF3F]|\uD86E[\uDC1E\uDC1F]|\uD873[\uDEA2-\uDEAF]|\uD87A[\uDFE1-\uDFFF]|\uD87E[\uDE1E-\uDFFF]|\uD884[\uDF4B-\uDFFF]|\uDB40[\uDC00-\uDCFF\uDDF0-\uDFFF]/g
43311
-
43312
- ;// CONCATENATED MODULE: ../node_modules/github-slugger/index.js
43313
-
43314
-
43315
- const github_slugger_own = Object.hasOwnProperty
43316
-
43317
- /**
43318
- * Slugger.
43319
- */
43320
- class BananaSlug {
43321
- /**
43322
- * Create a new slug class.
43323
- */
43324
- constructor () {
43325
- /** @type {Record<string, number>} */
43326
- // eslint-disable-next-line no-unused-expressions
43327
- this.occurrences
43328
-
43329
- this.reset()
43330
- }
43331
-
43332
- /**
43333
- * Generate a unique slug.
43334
- *
43335
- * Tracks previously generated slugs: repeated calls with the same value
43336
- * will result in different slugs.
43337
- * Use the `slug` function to get same slugs.
43338
- *
43339
- * @param {string} value
43340
- * String of text to slugify
43341
- * @param {boolean} [maintainCase=false]
43342
- * Keep the current case, otherwise make all lowercase
43343
- * @return {string}
43344
- * A unique slug string
43345
- */
43346
- slug (value, maintainCase) {
43347
- const self = this
43348
- let result = slug(value, maintainCase === true)
43349
- const originalSlug = result
43350
-
43351
- while (github_slugger_own.call(self.occurrences, result)) {
43352
- self.occurrences[originalSlug]++
43353
- result = originalSlug + '-' + self.occurrences[originalSlug]
43354
- }
43313
+ // EXTERNAL MODULE: ../node_modules/@uiw/copy-to-clipboard/dist/copy-to-clipboard.umd.js
43314
+ var copy_to_clipboard_umd = __webpack_require__(5028);
43315
+ var copy_to_clipboard_umd_default = /*#__PURE__*/__webpack_require__.n(copy_to_clipboard_umd);
43316
+ ;// CONCATENATED MODULE: ../node_modules/@uiw/react-markdown-preview/esm/plugins/useCopied.js
43355
43317
 
43356
- self.occurrences[result] = 0
43357
43318
 
43358
- return result
43319
+ function getParentElement(target) {
43320
+ if (!target) return null;
43321
+ var dom = target;
43322
+ if (dom.dataset.code && dom.classList.contains('copied')) {
43323
+ return dom;
43359
43324
  }
43360
-
43361
- /**
43362
- * Reset - Forget all previous slugs
43363
- *
43364
- * @return void
43365
- */
43366
- reset () {
43367
- this.occurrences = Object.create(null)
43325
+ if (dom.parentElement) {
43326
+ return getParentElement(dom.parentElement);
43368
43327
  }
43328
+ return null;
43369
43329
  }
43370
-
43371
- /**
43372
- * Generate a slug.
43373
- *
43374
- * Does not track previously generated slugs: repeated calls with the same value
43375
- * will result in the exact same slug.
43376
- * Use the `GithubSlugger` class to get unique slugs.
43377
- *
43378
- * @param {string} value
43379
- * String of text to slugify
43380
- * @param {boolean} [maintainCase=false]
43381
- * Keep the current case, otherwise make all lowercase
43382
- * @return {string}
43383
- * A unique slug string
43384
- */
43385
- function slug (value, maintainCase) {
43386
- if (typeof value !== 'string') return ''
43387
- if (!maintainCase) value = value.toLowerCase()
43388
- return value.replace(regex, '').replace(/ /g, '-')
43330
+ function useCopied(container) {
43331
+ var handle = event => {
43332
+ var target = getParentElement(event.target);
43333
+ if (!target) return;
43334
+ target.classList.add('active');
43335
+ copy_to_clipboard_umd_default()(target.dataset.code, function () {
43336
+ setTimeout(() => {
43337
+ target.classList.remove('active');
43338
+ }, 2000);
43339
+ });
43340
+ };
43341
+ (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect)(() => {
43342
+ var _container$current, _container$current2;
43343
+ (_container$current = container.current) == null || _container$current.removeEventListener('click', handle, false);
43344
+ (_container$current2 = container.current) == null || _container$current2.addEventListener('click', handle, false);
43345
+ return () => {
43346
+ var _container$current3;
43347
+ (_container$current3 = container.current) == null || _container$current3.removeEventListener('click', handle, false);
43348
+ };
43349
+ // eslint-disable-next-line react-hooks/exhaustive-deps
43350
+ }, [container]);
43389
43351
  }
43352
+ ;// CONCATENATED MODULE: ../node_modules/@uiw/react-markdown-preview/esm/styles/markdown.css
43353
+ // extracted by mini-css-extract-plugin
43354
+ /* harmony default export */ const markdown = ({});
43355
+ // EXTERNAL MODULE: ../node_modules/react/jsx-runtime.js
43356
+ var jsx_runtime = __webpack_require__(4246);
43357
+ ;// CONCATENATED MODULE: ../node_modules/@uiw/react-markdown-preview/esm/preview.js
43390
43358
 
43391
- ;// CONCATENATED MODULE: ../node_modules/hast-util-has-property/lib/index.js
43392
- /**
43393
- * @typedef {import('hast').Root} Root
43394
- * @typedef {import('hast').Content} Content
43395
- */
43396
43359
 
43397
- /**
43398
- * @typedef {Root | Content} Node
43399
- */
43360
+ var _excluded = ["prefixCls", "className", "source", "style", "disableCopy", "skipHtml", "onScroll", "onMouseOver", "pluginsFilter", "rehypeRewrite", "wrapperElement", "warpperElement"];
43400
43361
 
43401
- const hast_util_has_property_lib_own = {}.hasOwnProperty
43402
43362
 
43403
- /**
43404
- * Check if `node`is an element and has a `field` property.
43405
- *
43406
- * @param {unknown} node
43407
- * Thing to check (typically `Element`).
43408
- * @param {unknown} field
43409
- * Field name to check (typically `string`).
43410
- * @returns {boolean}
43411
- * Whether `node` is an element that has a `field` property.
43412
- */
43413
- function hasProperty(node, field) {
43414
- const value =
43415
- typeof field === 'string' &&
43416
- isNode(node) &&
43417
- node.type === 'element' &&
43418
- node.properties &&
43419
- hast_util_has_property_lib_own.call(node.properties, field) &&
43420
- node.properties[field]
43421
43363
 
43422
- return value !== null && value !== undefined && value !== false
43423
- }
43424
43364
 
43425
- /**
43426
- * @param {unknown} value
43427
- * @returns {value is Node}
43428
- */
43429
- function isNode(value) {
43430
- return Boolean(value && typeof value === 'object' && 'type' in value)
43431
- }
43432
43365
 
43433
- ;// CONCATENATED MODULE: ../node_modules/hast-util-heading-rank/lib/index.js
43434
- /**
43435
- * @typedef {import('hast').Root} Root
43436
- * @typedef {import('hast').Content} Content
43437
- */
43438
43366
 
43439
- /**
43440
- * @typedef {Root | Content} Node
43441
- */
43442
43367
 
43443
- // To do next major: return `undefined`.
43444
- /**
43445
- * Get the rank (`1` to `6`) of headings (`h1` to `h6`).
43446
- *
43447
- * @param {Node} node
43448
- * Node to check.
43449
- * @returns {number | null}
43450
- * Rank of the heading or `null` if not a heading.
43451
- */
43452
- function headingRank(node) {
43453
- const name =
43454
- (node && node.type === 'element' && node.tagName.toLowerCase()) || ''
43455
- const code =
43456
- name.length === 2 && name.charCodeAt(0) === 104 /* `h` */
43457
- ? name.charCodeAt(1)
43458
- : 0
43459
- return code > 48 /* `0` */ && code < 55 /* `7` */ ? code - 48 /* `0` */ : null
43460
- }
43461
43368
 
43369
+ /* harmony default export */ const preview = (/*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().forwardRef((props, ref) => {
43370
+ var {
43371
+ prefixCls = 'wmde-markdown wmde-markdown-color',
43372
+ className,
43373
+ source,
43374
+ style,
43375
+ disableCopy = false,
43376
+ skipHtml = true,
43377
+ onScroll,
43378
+ onMouseOver,
43379
+ pluginsFilter,
43380
+ wrapperElement = {},
43381
+ warpperElement = {}
43382
+ } = props,
43383
+ other = _objectWithoutPropertiesLoose(props, _excluded);
43384
+ var mdp = external_root_React_commonjs2_react_commonjs_react_amd_react_default().useRef(null);
43385
+ (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useImperativeHandle)(ref, () => _extends({}, props, {
43386
+ mdp
43387
+ }), [mdp, props]);
43388
+ var cls = (prefixCls || '') + " " + (className || '');
43389
+ useCopied(mdp);
43390
+ var rehypePlugins = [...(other.rehypePlugins || [])];
43391
+ var customProps = {
43392
+ allowElement: (element, index, parent) => {
43393
+ if (other.allowElement) {
43394
+ return other.allowElement(element, index, parent);
43395
+ }
43396
+ return /^[A-Za-z0-9]+$/.test(element.tagName);
43397
+ }
43398
+ };
43399
+ if (skipHtml) {
43400
+ rehypePlugins.push(rehypeRaw);
43401
+ }
43402
+ var remarkPlugins = [...(other.remarkPlugins || []), remarkGfm];
43403
+ var wrapperProps = _extends({}, warpperElement, wrapperElement);
43404
+ return /*#__PURE__*/(0,jsx_runtime.jsx)("div", _extends({
43405
+ ref: mdp,
43406
+ onScroll: onScroll,
43407
+ onMouseOver: onMouseOver
43408
+ }, wrapperProps, {
43409
+ className: cls,
43410
+ style: style,
43411
+ children: /*#__PURE__*/(0,jsx_runtime.jsx)(ReactMarkdown, _extends({}, customProps, other, {
43412
+ skipHtml: skipHtml,
43413
+ rehypePlugins: pluginsFilter ? pluginsFilter('rehype', rehypePlugins) : rehypePlugins,
43414
+ remarkPlugins: pluginsFilter ? pluginsFilter('remark', remarkPlugins) : remarkPlugins,
43415
+ children: source || ''
43416
+ }))
43417
+ }));
43418
+ }));
43462
43419
  ;// CONCATENATED MODULE: ../node_modules/hast-util-to-string/index.js
43463
43420
  /**
43464
43421
  * @fileoverview
@@ -43534,769 +43491,119 @@ function hast_util_to_string_all(node) {
43534
43491
  return result.join('')
43535
43492
  }
43536
43493
 
43537
- ;// CONCATENATED MODULE: ../node_modules/rehype-slug/index.js
43538
- /**
43539
- * @typedef {import('hast').Root} Root
43540
- */
43541
-
43542
- /**
43543
- * @typedef Options
43544
- * Configuration (optional).
43545
- * @property {string} [prefix='']
43546
- * Prefix to add in front of `id`s.
43547
- */
43548
-
43549
-
43550
-
43551
-
43552
-
43553
-
43554
-
43555
- const slugs = new BananaSlug()
43556
-
43557
- /**
43558
- * Plugin to add `id`s to headings.
43559
- *
43560
- * @type {import('unified').Plugin<[Options?]|Array<void>, Root>}
43561
- */
43562
- function rehypeSlug(options = {}) {
43563
- const prefix = options.prefix || ''
43564
-
43565
- return (tree) => {
43566
- slugs.reset()
43567
-
43568
- visit(tree, 'element', (node) => {
43569
- if (headingRank(node) && node.properties && !hasProperty(node, 'id')) {
43570
- node.properties.id = prefix + slugs.slug(hast_util_to_string_toString(node))
43571
- }
43572
- })
43573
- }
43574
- }
43575
-
43576
- ;// CONCATENATED MODULE: ../node_modules/hast-util-is-element/index.js
43494
+ ;// CONCATENATED MODULE: ../node_modules/unist-util-filter/lib/index.js
43577
43495
  /**
43496
+ * @typedef {import('unist').Node} Node
43578
43497
  * @typedef {import('unist').Parent} Parent
43579
- * @typedef {import('hast').Element} Element
43580
- */
43581
-
43582
- /**
43583
- * @typedef {null | undefined | string | TestFunctionAnything | Array<string | TestFunctionAnything>} Test
43584
- * Check for an arbitrary element, unaware of TypeScript inferral.
43498
+ * @typedef {import('unist-util-is').Test} Test
43585
43499
  *
43586
- * @callback TestFunctionAnything
43587
- * Check if an element passes a test, unaware of TypeScript inferral.
43588
- * @param {Element} element
43589
- * An element.
43590
- * @param {number | null | undefined} [index]
43591
- * The element’s position in its parent.
43592
- * @param {Parent | null | undefined} [parent]
43593
- * The element’s parent.
43594
- * @returns {boolean | void}
43595
- * Whether this element passes the test.
43500
+ * @typedef Options
43501
+ * Configuration (optional).
43502
+ * @property {boolean | null | undefined} [cascade=true]
43503
+ * Whether to drop parent nodes if they had children, but all their children
43504
+ * were filtered out.
43596
43505
  */
43597
43506
 
43598
- /**
43599
- * @template {Element} T
43600
- * Element type.
43601
- * @typedef {T['tagName'] | TestFunctionPredicate<T> | Array<T['tagName'] | TestFunctionPredicate<T>>} PredicateTest
43602
- * Check for an element that can be inferred by TypeScript.
43603
- */
43604
43507
 
43605
- /**
43606
- * Check if an element passes a certain node test.
43607
- *
43608
- * @template {Element} T
43609
- * Element type.
43610
- * @callback TestFunctionPredicate
43611
- * Complex test function for an element that can be inferred by TypeScript.
43612
- * @param {Element} element
43613
- * An element.
43614
- * @param {number | null | undefined} [index]
43615
- * The element’s position in its parent.
43616
- * @param {Parent | null | undefined} [parent]
43617
- * The element’s parent.
43618
- * @returns {element is T}
43619
- * Whether this element passes the test.
43620
- */
43621
43508
 
43622
- /**
43623
- * @callback AssertAnything
43624
- * Check that an arbitrary value is an element, unaware of TypeScript inferral.
43625
- * @param {unknown} [node]
43626
- * Anything (typically a node).
43627
- * @param {number | null | undefined} [index]
43628
- * The node’s position in its parent.
43629
- * @param {Parent | null | undefined} [parent]
43630
- * The node’s parent.
43631
- * @returns {boolean}
43632
- * Whether this is an element and passes a test.
43633
- */
43509
+ const unist_util_filter_lib_own = {}.hasOwnProperty
43634
43510
 
43635
43511
  /**
43636
- * Check if a node is an element and passes a certain node test
43512
+ * Create a new `tree` of copies of all nodes that pass `test`.
43637
43513
  *
43638
- * @template {Element} T
43639
- * Element type.
43640
- * @callback AssertPredicate
43641
- * Check that an arbitrary value is a specific element, aware of TypeScript.
43642
- * @param {unknown} [node]
43643
- * Anything (typically a node).
43644
- * @param {number | null | undefined} [index]
43645
- * The node’s position in its parent.
43646
- * @param {Parent | null | undefined} [parent]
43647
- * The node’s parent.
43648
- * @returns {node is T}
43649
- * Whether this is an element and passes a test.
43650
- */
43651
-
43652
- /**
43653
- * Check if `node` is an `Element` and whether it passes the given test.
43514
+ * The tree is walked in *preorder* (NLR), visiting the node itself, then its
43515
+ * head, etc.
43654
43516
  *
43655
- * @param node
43656
- * Thing to check, typically `Node`.
43517
+ * @param tree
43518
+ * Tree to filter.
43519
+ * @param options
43520
+ * Configuration (optional).
43657
43521
  * @param test
43658
- * A check for a specific element.
43659
- * @param index
43660
- * The node’s position in its parent.
43661
- * @param parent
43662
- * The node’s parent.
43522
+ * `unist-util-is` compatible test.
43663
43523
  * @returns
43664
- * Whether `node` is an element and passes a test.
43524
+ * New filtered tree.
43525
+ *
43526
+ * `null` is returned if `tree` itself didn’t pass the test, or is cascaded
43527
+ * away.
43665
43528
  */
43666
- const isElement =
43529
+ const filter =
43667
43530
  /**
43668
43531
  * @type {(
43669
- * (() => false) &
43670
- * (<T extends Element = Element>(node: unknown, test?: PredicateTest<T>, index?: number, parent?: Parent, context?: unknown) => node is T) &
43671
- * ((node: unknown, test: Test, index?: number, parent?: Parent, context?: unknown) => boolean)
43532
+ * (<Tree extends Node, Check extends Test>(node: Tree, options: Options | null | undefined, test: Check | null | undefined) => import('./complex-types.js').Matches<Tree, Check>) &
43533
+ * (<Tree extends Node, Check extends Test>(node: Tree, test: Check) => import('./complex-types.js').Matches<Tree, Check>) &
43534
+ * (<Tree extends Node>(node: Tree, options?: Options | null | undefined) => Tree)
43672
43535
  * )}
43673
43536
  */
43674
43537
  (
43675
43538
  /**
43676
- * @param {unknown} [node]
43677
- * @param {Test | undefined} [test]
43678
- * @param {number | null | undefined} [index]
43679
- * @param {Parent | null | undefined} [parent]
43680
- * @param {unknown} [context]
43681
- * @returns {boolean}
43539
+ * @param {Node} tree
43540
+ * @param {Options | Test | null | undefined} [options]
43541
+ * @param {Test | null | undefined} [test]
43542
+ * @returns {Node | null}
43682
43543
  */
43683
- // eslint-disable-next-line max-params
43684
- function (node, test, index, parent, context) {
43685
- const check = convertElement(test)
43544
+ function (tree, options, test) {
43545
+ const is = convert(test || options)
43546
+ /** @type {boolean | null | undefined} */
43547
+ const cascadeRaw =
43548
+ options && typeof options === 'object' && 'cascade' in options
43549
+ ? /** @type {boolean | null | undefined} */ (options.cascade)
43550
+ : undefined
43551
+ const cascade =
43552
+ cascadeRaw === undefined || cascadeRaw === null ? true : cascadeRaw
43686
43553
 
43687
- if (
43688
- index !== undefined &&
43689
- index !== null &&
43690
- (typeof index !== 'number' ||
43691
- index < 0 ||
43692
- index === Number.POSITIVE_INFINITY)
43693
- ) {
43694
- throw new Error('Expected positive finite index for child node')
43695
- }
43554
+ return preorder(tree)
43696
43555
 
43697
- if (
43698
- parent !== undefined &&
43699
- parent !== null &&
43700
- (!parent.type || !parent.children)
43701
- ) {
43702
- throw new Error('Expected parent node')
43703
- }
43556
+ /**
43557
+ * @param {Node} node
43558
+ * Current node.
43559
+ * @param {number | undefined} [index]
43560
+ * Index of `node` in `parent`.
43561
+ * @param {Parent | undefined} [parent]
43562
+ * Parent node.
43563
+ * @returns {Node | null}
43564
+ * Shallow copy of `node`.
43565
+ */
43566
+ function preorder(node, index, parent) {
43567
+ /** @type {Array<Node>} */
43568
+ const children = []
43704
43569
 
43705
- // @ts-expect-error Looks like a node.
43706
- if (!node || !node.type || typeof node.type !== 'string') {
43707
- return false
43708
- }
43570
+ if (!is(node, index, parent)) return null
43709
43571
 
43710
- if (
43711
- (parent === undefined || parent === null) !==
43712
- (index === undefined || index === null)
43713
- ) {
43714
- throw new Error('Expected both parent and index')
43715
- }
43572
+ // @ts-expect-error: Looks like a parent.
43573
+ if (node.children) {
43574
+ let childIndex = -1
43716
43575
 
43717
- return check.call(context, node, index, parent)
43718
- }
43719
- )
43576
+ // @ts-expect-error Looks like a parent.
43577
+ while (++childIndex < node.children.length) {
43578
+ // @ts-expect-error Looks like a parent.
43579
+ const result = preorder(node.children[childIndex], childIndex, node)
43720
43580
 
43721
- /**
43722
- * Generate an assertion from a test.
43723
- *
43724
- * Useful if you’re going to test many nodes, for example when creating a
43725
- * utility where something else passes a compatible test.
43726
- *
43727
- * The created function is a bit faster because it expects valid input only:
43728
- * a `node`, `index`, and `parent`.
43729
- *
43730
- * @param test
43731
- * * When nullish, checks if `node` is an `Element`.
43732
- * * When `string`, works like passing `(element) => element.tagName === test`.
43733
- * * When `function` checks if function passed the element is true.
43734
- * * When `array`, checks any one of the subtests pass.
43735
- * @returns
43736
- * An assertion.
43737
- */
43738
- const convertElement =
43739
- /**
43740
- * @type {(
43741
- * (<T extends Element>(test: T['tagName'] | TestFunctionPredicate<T>) => AssertPredicate<T>) &
43742
- * ((test?: Test) => AssertAnything)
43743
- * )}
43744
- */
43745
- (
43746
- /**
43747
- * @param {Test | null | undefined} [test]
43748
- * @returns {AssertAnything}
43749
- */
43750
- function (test) {
43751
- if (test === undefined || test === null) {
43752
- return hast_util_is_element_element
43753
- }
43581
+ if (result) {
43582
+ children.push(result)
43583
+ }
43584
+ }
43754
43585
 
43755
- if (typeof test === 'string') {
43756
- return tagNameFactory(test)
43757
- }
43586
+ // @ts-expect-error Looks like a parent.
43587
+ if (cascade && node.children.length > 0 && children.length === 0)
43588
+ return null
43589
+ }
43758
43590
 
43759
- if (typeof test === 'object') {
43760
- return hast_util_is_element_anyFactory(test)
43761
- }
43591
+ // Create a shallow clone, using the new children.
43592
+ /** @type {typeof node} */
43593
+ // @ts-expect-error all the fields will be copied over.
43594
+ const next = {}
43595
+ /** @type {string} */
43596
+ let key
43762
43597
 
43763
- if (typeof test === 'function') {
43764
- return hast_util_is_element_castFactory(test)
43765
- }
43598
+ for (key in node) {
43599
+ if (unist_util_filter_lib_own.call(node, key)) {
43600
+ // @ts-expect-error: Looks like a record.
43601
+ next[key] = key === 'children' ? children : node[key]
43602
+ }
43603
+ }
43766
43604
 
43767
- throw new Error('Expected function, string, or array as test')
43768
- }
43769
- )
43770
-
43771
- /**
43772
- * Handle multiple tests.
43773
- *
43774
- * @param {Array<string | TestFunctionAnything>} tests
43775
- * @returns {AssertAnything}
43776
- */
43777
- function hast_util_is_element_anyFactory(tests) {
43778
- /** @type {Array<AssertAnything>} */
43779
- const checks = []
43780
- let index = -1
43781
-
43782
- while (++index < tests.length) {
43783
- checks[index] = convertElement(tests[index])
43784
- }
43785
-
43786
- return hast_util_is_element_castFactory(any)
43787
-
43788
- /**
43789
- * @this {unknown}
43790
- * @param {Array<unknown>} parameters
43791
- * @returns {boolean}
43792
- */
43793
- function any(...parameters) {
43794
- let index = -1
43795
-
43796
- while (++index < checks.length) {
43797
- if (checks[index].call(this, ...parameters)) {
43798
- return true
43799
- }
43800
- }
43801
-
43802
- return false
43803
- }
43804
- }
43805
-
43806
- /**
43807
- * Turn a string into a test for an element with a certain tag name.
43808
- *
43809
- * @param {string} check
43810
- * @returns {AssertAnything}
43811
- */
43812
- function tagNameFactory(check) {
43813
- return tagName
43814
-
43815
- /**
43816
- * @param {unknown} node
43817
- * @returns {boolean}
43818
- */
43819
- function tagName(node) {
43820
- return hast_util_is_element_element(node) && node.tagName === check
43821
- }
43822
- }
43823
-
43824
- /**
43825
- * Turn a custom test into a test for an element that passes that test.
43826
- *
43827
- * @param {TestFunctionAnything} check
43828
- * @returns {AssertAnything}
43829
- */
43830
- function hast_util_is_element_castFactory(check) {
43831
- return assertion
43832
-
43833
- /**
43834
- * @this {unknown}
43835
- * @param {unknown} node
43836
- * @param {Array<unknown>} parameters
43837
- * @returns {boolean}
43838
- */
43839
- function assertion(node, ...parameters) {
43840
- // @ts-expect-error: fine.
43841
- return hast_util_is_element_element(node) && Boolean(check.call(this, node, ...parameters))
43842
- }
43843
- }
43844
-
43845
- /**
43846
- * Make sure something is an element.
43847
- *
43848
- * @param {unknown} node
43849
- * @returns {node is Element}
43850
- */
43851
- function hast_util_is_element_element(node) {
43852
- return Boolean(
43853
- node &&
43854
- typeof node === 'object' &&
43855
- // @ts-expect-error Looks like a node.
43856
- node.type === 'element' &&
43857
- // @ts-expect-error Looks like an element.
43858
- typeof node.tagName === 'string'
43859
- )
43860
- }
43861
-
43862
- ;// CONCATENATED MODULE: ../node_modules/rehype-autolink-headings/lib/index.js
43863
- /**
43864
- * @typedef {import('hast').Root} Root
43865
- * @typedef {import('hast').Parent} Parent
43866
- * @typedef {import('hast').Element} Element
43867
- * @typedef {Element['children'][number]} ElementChild
43868
- * @typedef {import('hast').Properties} Properties
43869
- * @typedef {import('hast-util-is-element').Test} Test
43870
- *
43871
- * @typedef {'prepend'|'append'|'wrap'|'before'|'after'} Behavior
43872
- *
43873
- * @callback Build
43874
- * @param {Element} node
43875
- * @returns {ElementChild|ElementChild[]}
43876
- *
43877
- * @typedef Options
43878
- * Configuration.
43879
- * @property {Behavior} [behavior='prepend']
43880
- * How to create links.
43881
- * @property {Behavior} [behaviour]
43882
- * Please use `behavior` instead
43883
- * @property {Properties} [properties]
43884
- * Extra properties to set on the link when injecting.
43885
- * Defaults to `{ariaHidden: true, tabIndex: -1}` when `'prepend'` or
43886
- * `'append'`.
43887
- * @property {ElementChild|ElementChild[]|Build} [content={type: 'element', tagName: 'span', properties: {className: ['icon', 'icon-link']}, children: []}]
43888
- * hast nodes to insert in the link.
43889
- * @property {ElementChild|ElementChild[]|Build} [group]
43890
- * hast node to wrap the heading and link with, if `behavior` is `'before'` or
43891
- * `'after'`.
43892
- * There is no default.
43893
- * @property {Test} [test]
43894
- * Test to define which heading elements are linked.
43895
- * Any test that can be given to `hast-util-is-element` is supported.
43896
- * The default (no test) is to link all headings.
43897
- * Can be used to link only h1-h3, or for example all except h1.
43898
- */
43899
-
43900
-
43901
-
43902
-
43903
-
43904
-
43905
-
43906
- /** @type {Element} */
43907
- const contentDefaults = {
43908
- type: 'element',
43909
- tagName: 'span',
43910
- properties: {className: ['icon', 'icon-link']},
43911
- children: []
43912
- }
43913
-
43914
- /**
43915
- * Plugin to automatically add links to headings (h1-h6).
43916
- *
43917
- * @type {import('unified').Plugin<[Options?]|void[], Root>}
43918
- */
43919
- function rehypeAutolinkHeadings(options = {}) {
43920
- let props = options.properties
43921
- const behavior = options.behaviour || options.behavior || 'prepend'
43922
- const content = options.content || contentDefaults
43923
- const group = options.group
43924
- const is = convertElement(options.test)
43925
-
43926
- /** @type {import('unist-util-visit/complex-types').Visitor<Element>} */
43927
- let method
43928
-
43929
- if (behavior === 'wrap') {
43930
- method = wrap
43931
- } else if (behavior === 'before' || behavior === 'after') {
43932
- method = around
43933
- } else {
43934
- if (!props) {
43935
- props = {ariaHidden: 'true', tabIndex: -1}
43936
- }
43937
-
43938
- method = inject
43939
- }
43940
-
43941
- return (tree) => {
43942
- visit(tree, 'element', (node, index, parent) => {
43943
- if (
43944
- headingRank(node) &&
43945
- hasProperty(node, 'id') &&
43946
- is(node, index, parent)
43947
- ) {
43948
- return method(node, index, parent)
43949
- }
43950
- })
43951
- }
43952
-
43953
- /** @type {import('unist-util-visit/complex-types').Visitor<Element>} */
43954
- function inject(node) {
43955
- node.children[behavior === 'prepend' ? 'unshift' : 'push'](
43956
- create(node, extend(true, {}, props), toChildren(content, node))
43957
- )
43958
-
43959
- return [SKIP]
43960
- }
43961
-
43962
- /** @type {import('unist-util-visit/complex-types').Visitor<Element>} */
43963
- function around(node, index, parent) {
43964
- // Uncommon.
43965
- /* c8 ignore next */
43966
- if (typeof index !== 'number' || !parent) return
43967
-
43968
- const link = create(
43969
- node,
43970
- extend(true, {}, props),
43971
- toChildren(content, node)
43972
- )
43973
- let nodes = behavior === 'before' ? [link, node] : [node, link]
43974
-
43975
- if (group) {
43976
- const grouping = toNode(group, node)
43977
-
43978
- if (grouping && !Array.isArray(grouping) && grouping.type === 'element') {
43979
- grouping.children = nodes
43980
- nodes = [grouping]
43981
- }
43982
- }
43983
-
43984
- parent.children.splice(index, 1, ...nodes)
43985
-
43986
- return [SKIP, index + nodes.length]
43987
- }
43988
-
43989
- /** @type {import('unist-util-visit/complex-types').Visitor<Element>} */
43990
- function wrap(node) {
43991
- node.children = [create(node, extend(true, {}, props), node.children)]
43992
- return [SKIP]
43993
- }
43994
-
43995
- /**
43996
- * @param {ElementChild|ElementChild[]|Build} value
43997
- * @param {Element} node
43998
- * @returns {ElementChild[]}
43999
- */
44000
- function toChildren(value, node) {
44001
- const result = toNode(value, node)
44002
- return Array.isArray(result) ? result : [result]
44003
- }
44004
-
44005
- /**
44006
- * @param {ElementChild|ElementChild[]|Build} value
44007
- * @param {Element} node
44008
- * @returns {ElementChild|ElementChild[]}
44009
- */
44010
- function toNode(value, node) {
44011
- if (typeof value === 'function') return value(node)
44012
- return extend(true, Array.isArray(value) ? [] : {}, value)
44013
- }
44014
-
44015
- /**
44016
- * @param {Element} node
44017
- * @param {Properties} props
44018
- * @param {ElementChild[]} children
44019
- * @returns {Element}
44020
- */
44021
- function create(node, props, children) {
44022
- return {
44023
- type: 'element',
44024
- tagName: 'a',
44025
- properties: Object.assign({}, props, {
44026
- // Fix hast types and make them required.
44027
- /* c8 ignore next */
44028
- href: '#' + (node.properties || {}).id
44029
- }),
44030
- children
44031
- }
44032
- }
44033
- }
44034
-
44035
- ;// CONCATENATED MODULE: ../node_modules/rehype-attr/lib/utils.js
44036
- const getURLParameters = (url = '') => (url.match(/([^?=&]+)(=([^&]*))/g) || []).reduce((a, v) => ((a[v.slice(0, v.indexOf('='))] = v.slice(v.indexOf('=') + 1)), a), {});
44037
- const prevChild = (data = [], index) => {
44038
- let i = index;
44039
- while (i > -1) {
44040
- i--;
44041
- if (!data[i])
44042
- return;
44043
- if ((data[i] && data[i].value && data[i].value.replace(/(\n|\s)/g, '') !== '') || data[i].type !== 'text') {
44044
- if (!/^rehype:/.test(data[i].value) || data[i].type !== 'comment')
44045
- return;
44046
- return data[i];
44047
- }
44048
- }
44049
- return;
44050
- };
44051
- const nextChild = (data = [], index, tagName, codeBlockParames) => {
44052
- let i = index;
44053
- while (i < data.length) {
44054
- i++;
44055
- if (tagName) {
44056
- const element = data[i];
44057
- if (element && element.value && element.value.replace(/(\n|\s)/g, '') !== '' || data[i] && data[i].type === 'element') {
44058
- return element.tagName === tagName ? element : undefined;
44059
- }
44060
- }
44061
- else {
44062
- const element = data[i];
44063
- if (!element || element.type === 'element')
44064
- return;
44065
- if (element.type === 'text' && element.value.replace(/(\n|\s)/g, '') !== '')
44066
- return;
44067
- if (element.type && /^(comment|raw)$/ig.test(element.type)) {
44068
- if (element.value && !/^rehype:/.test(element.value.replace(/^(\s+)?<!--(.*?)-->/, '$2') || '')) {
44069
- return;
44070
- }
44071
- ;
44072
- if (codeBlockParames) {
44073
- const nextNode = nextChild(data, i, 'pre', codeBlockParames);
44074
- if (nextNode)
44075
- return;
44076
- element.value = (element.value || '').replace(/^(\n|\s)+/, '');
44077
- return element;
44078
- }
44079
- else {
44080
- element.value = (element.value || '').replace(/^(\n|\s)+/, '');
44081
- return element;
44082
- }
44083
- }
44084
- }
44085
- }
44086
- return;
44087
- };
44088
- /**
44089
- * 获取代码注视的位置
44090
- * @param data 数据
44091
- * @param index 当前数据所在的位置
44092
- * @returns 返回 当前参数数据 Object,`{}`
44093
- */
44094
- const getCommentObject = ({ value = '' }) => {
44095
- const param = getURLParameters(value.replace(/^<!--(.*?)-->/, '$1').replace(/^rehype:/, ''));
44096
- Object.keys(param).forEach((keyName) => {
44097
- if (param[keyName] === 'true') {
44098
- param[keyName] = true;
44099
- }
44100
- if (param[keyName] === 'false') {
44101
- param[keyName] = false;
44102
- }
44103
- if (typeof param[keyName] === 'string' && !/^0/.test(param[keyName]) && !isNaN(+param[keyName])) {
44104
- param[keyName] = +param[keyName];
44105
- }
44106
- });
44107
- return param;
44108
- };
44109
- const propertiesHandle = (defaultAttrs, attrs, type) => {
44110
- if (type === 'string') {
44111
- return { ...defaultAttrs, 'data-config': JSON.stringify({ ...attrs, rehyp: true }) };
44112
- }
44113
- else if (type === 'attr') {
44114
- return { ...defaultAttrs, ...attrs };
44115
- }
44116
- return { ...defaultAttrs, 'data-config': { ...attrs, rehyp: true } };
44117
- };
44118
- //# sourceMappingURL=utils.js.map
44119
- ;// CONCATENATED MODULE: ../node_modules/rehype-attr/lib/index.js
44120
-
44121
-
44122
- const rehypeAttrs = (options = {}) => {
44123
- const { properties = 'data', codeBlockParames = true } = options;
44124
- return (tree) => {
44125
- visit(tree, 'element', (node, index, parent) => {
44126
- if (codeBlockParames && node.tagName === 'pre' && node && Array.isArray(node.children) && parent && Array.isArray(parent.children) && parent.children.length > 1) {
44127
- const firstChild = node.children[0];
44128
- if (firstChild && firstChild.tagName === 'code' && typeof index === 'number') {
44129
- const child = prevChild(parent.children, index);
44130
- if (child) {
44131
- const attr = getCommentObject(child);
44132
- if (Object.keys(attr).length > 0) {
44133
- node.properties = { ...node.properties, ...{ 'data-type': 'rehyp' } };
44134
- firstChild.properties = propertiesHandle(firstChild.properties, attr, properties);
44135
- }
44136
- }
44137
- }
44138
- }
44139
- if (/^(em|strong|b|a|i|p|pre|kbd|blockquote|h(1|2|3|4|5|6)|code|table|img|del|ul|ol)$/.test(node.tagName) && parent && Array.isArray(parent.children) && typeof index === 'number') {
44140
- const child = nextChild(parent.children, index, '', codeBlockParames);
44141
- if (child) {
44142
- const attr = getCommentObject(child);
44143
- if (Object.keys(attr).length > 0) {
44144
- node.properties = propertiesHandle(node.properties, attr, properties);
44145
- }
44146
- }
44147
- }
44148
- });
44149
- };
44150
- };
44151
- /* harmony default export */ const rehype_attr_lib = (rehypeAttrs);
44152
- //# sourceMappingURL=index.js.map
44153
- ;// CONCATENATED MODULE: ../node_modules/rehype-ignore/lib/index.js
44154
-
44155
- const rehypeIgnore = (options = {}) => {
44156
- const { openDelimiter = 'rehype:ignore:start', closeDelimiter = 'rehype:ignore:end' } = options;
44157
- return (tree) => {
44158
- visit(tree, (node, index, parent) => {
44159
- if (node.type === 'element' || node.type === 'root') {
44160
- // const start = node.children.findIndex((item) => item.type === 'comment' && item.value === openDelimiter);
44161
- // const end = node.children.findIndex((item) => item.type === 'comment' && item.value === closeDelimiter);
44162
- // if (start > -1 && end > -1) {
44163
- // node.children = node.children.filter((_, idx) => idx < start || idx > end);
44164
- // }
44165
- let start = false;
44166
- node.children = node.children.filter((item) => {
44167
- if (item.type === 'raw' || item.type === 'comment') {
44168
- let str = (item.value || '').trim();
44169
- str = str.replace(/^<!--(.*?)-->/, '$1');
44170
- if (str === openDelimiter) {
44171
- start = true;
44172
- return false;
44173
- }
44174
- if (str === closeDelimiter) {
44175
- start = false;
44176
- return false;
44177
- }
44178
- }
44179
- return !start;
44180
- });
44181
- }
44182
- });
44183
- };
44184
- };
44185
- /* harmony default export */ const rehype_ignore_lib = (rehypeIgnore);
44186
- //# sourceMappingURL=index.js.map
44187
- ;// CONCATENATED MODULE: ../node_modules/unist-util-filter/lib/index.js
44188
- /**
44189
- * @typedef {import('unist').Node} Node
44190
- * @typedef {import('unist').Parent} Parent
44191
- * @typedef {import('unist-util-is').Test} Test
44192
- *
44193
- * @typedef Options
44194
- * Configuration (optional).
44195
- * @property {boolean | null | undefined} [cascade=true]
44196
- * Whether to drop parent nodes if they had children, but all their children
44197
- * were filtered out.
44198
- */
44199
-
44200
-
44201
-
44202
- const unist_util_filter_lib_own = {}.hasOwnProperty
44203
-
44204
- /**
44205
- * Create a new `tree` of copies of all nodes that pass `test`.
44206
- *
44207
- * The tree is walked in *preorder* (NLR), visiting the node itself, then its
44208
- * head, etc.
44209
- *
44210
- * @param tree
44211
- * Tree to filter.
44212
- * @param options
44213
- * Configuration (optional).
44214
- * @param test
44215
- * `unist-util-is` compatible test.
44216
- * @returns
44217
- * New filtered tree.
44218
- *
44219
- * `null` is returned if `tree` itself didn’t pass the test, or is cascaded
44220
- * away.
44221
- */
44222
- const filter =
44223
- /**
44224
- * @type {(
44225
- * (<Tree extends Node, Check extends Test>(node: Tree, options: Options | null | undefined, test: Check | null | undefined) => import('./complex-types.js').Matches<Tree, Check>) &
44226
- * (<Tree extends Node, Check extends Test>(node: Tree, test: Check) => import('./complex-types.js').Matches<Tree, Check>) &
44227
- * (<Tree extends Node>(node: Tree, options?: Options | null | undefined) => Tree)
44228
- * )}
44229
- */
44230
- (
44231
- /**
44232
- * @param {Node} tree
44233
- * @param {Options | Test | null | undefined} [options]
44234
- * @param {Test | null | undefined} [test]
44235
- * @returns {Node | null}
44236
- */
44237
- function (tree, options, test) {
44238
- const is = convert(test || options)
44239
- /** @type {boolean | null | undefined} */
44240
- const cascadeRaw =
44241
- options && typeof options === 'object' && 'cascade' in options
44242
- ? /** @type {boolean | null | undefined} */ (options.cascade)
44243
- : undefined
44244
- const cascade =
44245
- cascadeRaw === undefined || cascadeRaw === null ? true : cascadeRaw
44246
-
44247
- return preorder(tree)
44248
-
44249
- /**
44250
- * @param {Node} node
44251
- * Current node.
44252
- * @param {number | undefined} [index]
44253
- * Index of `node` in `parent`.
44254
- * @param {Parent | undefined} [parent]
44255
- * Parent node.
44256
- * @returns {Node | null}
44257
- * Shallow copy of `node`.
44258
- */
44259
- function preorder(node, index, parent) {
44260
- /** @type {Array<Node>} */
44261
- const children = []
44262
-
44263
- if (!is(node, index, parent)) return null
44264
-
44265
- // @ts-expect-error: Looks like a parent.
44266
- if (node.children) {
44267
- let childIndex = -1
44268
-
44269
- // @ts-expect-error Looks like a parent.
44270
- while (++childIndex < node.children.length) {
44271
- // @ts-expect-error Looks like a parent.
44272
- const result = preorder(node.children[childIndex], childIndex, node)
44273
-
44274
- if (result) {
44275
- children.push(result)
44276
- }
44277
- }
44278
-
44279
- // @ts-expect-error Looks like a parent.
44280
- if (cascade && node.children.length > 0 && children.length === 0)
44281
- return null
44282
- }
44283
-
44284
- // Create a shallow clone, using the new children.
44285
- /** @type {typeof node} */
44286
- // @ts-expect-error all the fields will be copied over.
44287
- const next = {}
44288
- /** @type {string} */
44289
- let key
44290
-
44291
- for (key in node) {
44292
- if (unist_util_filter_lib_own.call(node, key)) {
44293
- // @ts-expect-error: Looks like a record.
44294
- next[key] = key === 'children' ? children : node[key]
44295
- }
44296
- }
44297
-
44298
- return next
44299
- }
43605
+ return next
43606
+ }
44300
43607
  }
44301
43608
  )
44302
43609
 
@@ -45938,11 +45245,11 @@ function java(Prism) {
45938
45245
 
45939
45246
  ;// CONCATENATED MODULE: ../node_modules/refractor/lang/regex.js
45940
45247
  // @ts-nocheck
45941
- regex_regex.displayName = 'regex'
45942
- regex_regex.aliases = []
45248
+ regex.displayName = 'regex'
45249
+ regex.aliases = []
45943
45250
 
45944
45251
  /** @type {import('../core.js').Syntax} */
45945
- function regex_regex(Prism) {
45252
+ function regex(Prism) {
45946
45253
  ;(function (Prism) {
45947
45254
  var specialEscape = {
45948
45255
  pattern: /\\[\\(){}[\]^$+*?|.]/,
@@ -46639,11 +45946,11 @@ function yaml(Prism) {
46639
45946
  ;// CONCATENATED MODULE: ../node_modules/refractor/lang/markdown.js
46640
45947
  // @ts-nocheck
46641
45948
 
46642
- markdown.displayName = 'markdown'
46643
- markdown.aliases = ['md']
45949
+ markdown_markdown.displayName = 'markdown'
45950
+ markdown_markdown.aliases = ['md']
46644
45951
 
46645
45952
  /** @type {import('../core.js').Syntax} */
46646
- function markdown(Prism) {
45953
+ function markdown_markdown(Prism) {
46647
45954
  Prism.register(markup)
46648
45955
  ;(function (Prism) {
46649
45956
  // Allow only one line break
@@ -50512,7 +49819,7 @@ refractor.register(diff)
50512
49819
  refractor.register(go)
50513
49820
  refractor.register(ini)
50514
49821
  refractor.register(java)
50515
- refractor.register(regex_regex)
49822
+ refractor.register(regex)
50516
49823
  refractor.register(javascript)
50517
49824
  refractor.register(json)
50518
49825
  refractor.register(kotlin)
@@ -50520,7 +49827,7 @@ refractor.register(less)
50520
49827
  refractor.register(lua)
50521
49828
  refractor.register(makefile)
50522
49829
  refractor.register(yaml)
50523
- refractor.register(markdown)
49830
+ refractor.register(markdown_markdown)
50524
49831
  refractor.register(objectivec)
50525
49832
  refractor.register(perl)
50526
49833
  refractor.register(markupTemplating)
@@ -70928,7 +70235,7 @@ function zig(Prism) {
70928
70235
  refractor.register(markup)
70929
70236
  refractor.register(css)
70930
70237
  refractor.register(clike)
70931
- refractor.register(regex_regex)
70238
+ refractor.register(regex)
70932
70239
  refractor.register(javascript)
70933
70240
  refractor.register(abap)
70934
70241
  refractor.register(abnf)
@@ -70950,7 +70257,7 @@ refractor.register(arff)
70950
70257
  refractor.register(armasm)
70951
70258
  refractor.register(bash)
70952
70259
  refractor.register(yaml)
70953
- refractor.register(markdown)
70260
+ refractor.register(markdown_markdown)
70954
70261
  refractor.register(arturo)
70955
70262
  refractor.register(asciidoc)
70956
70263
  refractor.register(csharp)
@@ -71409,6 +70716,48 @@ function dirProperty(node) {
71409
70716
  : undefined
71410
70717
  }
71411
70718
 
70719
+ ;// CONCATENATED MODULE: ../node_modules/hast-util-has-property/lib/index.js
70720
+ /**
70721
+ * @typedef {import('hast').Root} Root
70722
+ * @typedef {import('hast').Content} Content
70723
+ */
70724
+
70725
+ /**
70726
+ * @typedef {Root | Content} Node
70727
+ */
70728
+
70729
+ const hast_util_has_property_lib_own = {}.hasOwnProperty
70730
+
70731
+ /**
70732
+ * Check if `node`is an element and has a `field` property.
70733
+ *
70734
+ * @param {unknown} node
70735
+ * Thing to check (typically `Element`).
70736
+ * @param {unknown} field
70737
+ * Field name to check (typically `string`).
70738
+ * @returns {boolean}
70739
+ * Whether `node` is an element that has a `field` property.
70740
+ */
70741
+ function hasProperty(node, field) {
70742
+ const value =
70743
+ typeof field === 'string' &&
70744
+ isNode(node) &&
70745
+ node.type === 'element' &&
70746
+ node.properties &&
70747
+ hast_util_has_property_lib_own.call(node.properties, field) &&
70748
+ node.properties[field]
70749
+
70750
+ return value !== null && value !== undefined && value !== false
70751
+ }
70752
+
70753
+ /**
70754
+ * @param {unknown} value
70755
+ * @returns {value is Node}
70756
+ */
70757
+ function isNode(value) {
70758
+ return Boolean(value && typeof value === 'object' && 'type' in value)
70759
+ }
70760
+
71412
70761
  ;// CONCATENATED MODULE: ../node_modules/hast-util-select/lib/attribute.js
71413
70762
  /**
71414
70763
  * @typedef {import('./types.js').Rule} Rule
@@ -72289,553 +71638,1319 @@ function pseudo(query, element, index, parent, state) {
72289
71638
  }
72290
71639
 
72291
71640
  /**
72292
- * Check whether an element matches an `:any-link` pseudo.
71641
+ * Check whether an element matches an `:any-link` pseudo.
71642
+ *
71643
+ * @param {RulePseudo} _
71644
+ * @param {Element} element
71645
+ * @returns {boolean}
71646
+ */
71647
+ function anyLink(_, element) {
71648
+ return (
71649
+ (element.tagName === 'a' ||
71650
+ element.tagName === 'area' ||
71651
+ element.tagName === 'link') &&
71652
+ hasProperty(element, 'href')
71653
+ )
71654
+ }
71655
+
71656
+ /**
71657
+ * Check whether an element matches a `:blank` pseudo.
71658
+ *
71659
+ * @param {RulePseudo} _
71660
+ * @param {Element} element
71661
+ * @returns {boolean}
71662
+ */
71663
+ function blank(_, element) {
71664
+ return !someChildren(element, check)
71665
+
71666
+ /**
71667
+ * @param {ElementChild} child
71668
+ * @returns {boolean}
71669
+ */
71670
+ function check(child) {
71671
+ return (
71672
+ child.type === 'element' || (child.type === 'text' && !whitespace(child))
71673
+ )
71674
+ }
71675
+ }
71676
+
71677
+ /**
71678
+ * Check whether an element matches a `:checked` pseudo.
71679
+ *
71680
+ * @param {RulePseudo} _
71681
+ * @param {Element} element
71682
+ * @returns {boolean}
71683
+ */
71684
+ function checked(_, element) {
71685
+ if (element.tagName === 'input' || element.tagName === 'menuitem') {
71686
+ return Boolean(
71687
+ element.properties &&
71688
+ (element.properties.type === 'checkbox' ||
71689
+ element.properties.type === 'radio') &&
71690
+ hasProperty(element, 'checked')
71691
+ )
71692
+ }
71693
+
71694
+ if (element.tagName === 'option') {
71695
+ return hasProperty(element, 'selected')
71696
+ }
71697
+
71698
+ return false
71699
+ }
71700
+
71701
+ /**
71702
+ * Check whether an element matches a `:dir()` pseudo.
71703
+ *
71704
+ * @param {RulePseudo} query
71705
+ * @param {Element} _1
71706
+ * @param {number | undefined} _2
71707
+ * @param {Parent | undefined} _3
71708
+ * @param {SelectState} state
71709
+ * @returns {boolean}
71710
+ */
71711
+ function dir(query, _1, _2, _3, state) {
71712
+ return state.direction === query.value
71713
+ }
71714
+
71715
+ /**
71716
+ * Check whether an element matches a `:disabled` pseudo.
71717
+ *
71718
+ * @param {RulePseudo} _
71719
+ * @param {Element} element
71720
+ * @returns {boolean}
71721
+ */
71722
+ function disabled(_, element) {
71723
+ return (
71724
+ (element.tagName === 'button' ||
71725
+ element.tagName === 'input' ||
71726
+ element.tagName === 'select' ||
71727
+ element.tagName === 'textarea' ||
71728
+ element.tagName === 'optgroup' ||
71729
+ element.tagName === 'option' ||
71730
+ element.tagName === 'menuitem' ||
71731
+ element.tagName === 'fieldset') &&
71732
+ hasProperty(element, 'disabled')
71733
+ )
71734
+ }
71735
+
71736
+ /**
71737
+ * Check whether an element matches an `:empty` pseudo.
71738
+ *
71739
+ * @param {RulePseudo} _
71740
+ * @param {Element} element
71741
+ * @returns {boolean}
71742
+ */
71743
+ function empty(_, element) {
71744
+ return !someChildren(element, check)
71745
+
71746
+ /**
71747
+ * @param {ElementChild} child
71748
+ * @returns {boolean}
71749
+ */
71750
+ function check(child) {
71751
+ return child.type === 'element' || child.type === 'text'
71752
+ }
71753
+ }
71754
+
71755
+ /**
71756
+ * Check whether an element matches an `:enabled` pseudo.
71757
+ *
71758
+ * @param {RulePseudo} query
71759
+ * @param {Element} element
71760
+ * @returns {boolean}
71761
+ */
71762
+ function enabled(query, element) {
71763
+ return !disabled(query, element)
71764
+ }
71765
+
71766
+ /**
71767
+ * Check whether an element matches a `:first-child` pseudo.
71768
+ *
71769
+ * @param {RulePseudo} query
71770
+ * @param {Element} _1
71771
+ * @param {number | undefined} _2
71772
+ * @param {Parent | undefined} _3
71773
+ * @param {SelectState} state
71774
+ * @returns {boolean}
71775
+ */
71776
+ function firstChild(query, _1, _2, _3, state) {
71777
+ assertDeep(state, query)
71778
+ return state.elementIndex === 0
71779
+ }
71780
+
71781
+ /**
71782
+ * Check whether an element matches a `:first-of-type` pseudo.
71783
+ *
71784
+ * @param {RulePseudo} query
71785
+ * @param {Element} _1
71786
+ * @param {number | undefined} _2
71787
+ * @param {Parent | undefined} _3
71788
+ * @param {SelectState} state
71789
+ * @returns {boolean}
71790
+ */
71791
+ function firstOfType(query, _1, _2, _3, state) {
71792
+ assertDeep(state, query)
71793
+ return state.typeIndex === 0
71794
+ }
71795
+
71796
+ /**
71797
+ * @param {RulePseudoSelector} query
71798
+ * @param {Element} element
71799
+ * @param {number | undefined} _1
71800
+ * @param {Parent | undefined} _2
71801
+ * @param {SelectState} state
71802
+ * @returns {boolean}
71803
+ */
71804
+ function has(query, element, _1, _2, state) {
71805
+ /** @type {SelectState} */
71806
+ const childState = {
71807
+ ...state,
71808
+ // Not found yet.
71809
+ found: false,
71810
+ // Do walk deep.
71811
+ shallow: false,
71812
+ // One result is enough.
71813
+ one: true,
71814
+ scopeElements: [element],
71815
+ results: [],
71816
+ rootQuery: queryToSelectors(query.value)
71817
+ }
71818
+
71819
+ walk_walk(childState, {type: 'root', children: element.children})
71820
+
71821
+ return childState.results.length > 0
71822
+ }
71823
+
71824
+ /**
71825
+ * Check whether an element matches a `:lang()` pseudo.
71826
+ *
71827
+ * @param {RulePseudo} query
71828
+ * @param {Element} _1
71829
+ * @param {number | undefined} _2
71830
+ * @param {Parent | undefined} _3
71831
+ * @param {SelectState} state
71832
+ * @returns {boolean}
71833
+ */
71834
+ function pseudo_lang(query, _1, _2, _3, state) {
71835
+ return (
71836
+ state.language !== '' &&
71837
+ state.language !== undefined &&
71838
+ // @ts-expect-error never `selectors`.
71839
+ extendedFilter(state.language, comma_separated_tokens_parse(query.value)).length > 0
71840
+ )
71841
+ }
71842
+
71843
+ /**
71844
+ * Check whether an element matches a `:last-child` pseudo.
71845
+ *
71846
+ * @param {RulePseudo} query
71847
+ * @param {Element} _1
71848
+ * @param {number | undefined} _2
71849
+ * @param {Parent | undefined} _3
71850
+ * @param {SelectState} state
71851
+ * @returns {boolean}
71852
+ */
71853
+ function lastChild(query, _1, _2, _3, state) {
71854
+ assertDeep(state, query)
71855
+ return Boolean(
71856
+ state.elementCount && state.elementIndex === state.elementCount - 1
71857
+ )
71858
+ }
71859
+
71860
+ /**
71861
+ * Check whether an element matches a `:last-of-type` pseudo.
71862
+ *
71863
+ * @param {RulePseudo} query
71864
+ * @param {Element} _1
71865
+ * @param {number | undefined} _2
71866
+ * @param {Parent | undefined} _3
71867
+ * @param {SelectState} state
71868
+ * @returns {boolean}
71869
+ */
71870
+ function lastOfType(query, _1, _2, _3, state) {
71871
+ assertDeep(state, query)
71872
+ return (
71873
+ typeof state.typeIndex === 'number' &&
71874
+ typeof state.typeCount === 'number' &&
71875
+ state.typeIndex === state.typeCount - 1
71876
+ )
71877
+ }
71878
+
71879
+ /**
71880
+ * Check whether an element `:matches` further selectors.
71881
+ *
71882
+ * @param {RulePseudoSelector} query
71883
+ * @param {Element} element
71884
+ * @param {number | undefined} _
71885
+ * @param {Parent | undefined} parent
71886
+ * @param {SelectState} state
71887
+ * @returns {boolean}
71888
+ */
71889
+ function matches(query, element, _, parent, state) {
71890
+ /** @type {SelectState} */
71891
+ const childState = {
71892
+ ...state,
71893
+ // Not found yet.
71894
+ found: false,
71895
+ // Do walk deep.
71896
+ shallow: false,
71897
+ // One result is enough.
71898
+ one: true,
71899
+ scopeElements: [element],
71900
+ results: [],
71901
+ rootQuery: queryToSelectors(query.value)
71902
+ }
71903
+
71904
+ walk_walk(childState, element)
71905
+
71906
+ return childState.results[0] === element
71907
+ }
71908
+
71909
+ /**
71910
+ * Check whether an element does `:not` match further selectors.
71911
+ *
71912
+ * @param {RulePseudoSelector} query
71913
+ * @param {Element} element
71914
+ * @param {number | undefined} index
71915
+ * @param {Parent | undefined} parent
71916
+ * @param {SelectState} state
71917
+ * @returns {boolean}
71918
+ */
71919
+ function not(query, element, index, parent, state) {
71920
+ return !matches(query, element, index, parent, state)
71921
+ }
71922
+
71923
+ /**
71924
+ * Check whether an element matches an `:nth-child` pseudo.
71925
+ *
71926
+ * @param {RulePseudo} query
71927
+ * @param {Element} _1
71928
+ * @param {number | undefined} _2
71929
+ * @param {Parent | undefined} _3
71930
+ * @param {SelectState} state
71931
+ * @returns {boolean}
71932
+ */
71933
+ function nthChild(query, _1, _2, _3, state) {
71934
+ const fn = getCachedNthCheck(query)
71935
+ assertDeep(state, query)
71936
+ return typeof state.elementIndex === 'number' && fn(state.elementIndex)
71937
+ }
71938
+
71939
+ /**
71940
+ * Check whether an element matches an `:nth-last-child` pseudo.
71941
+ *
71942
+ * @param {RulePseudo} query
71943
+ * @param {Element} _1
71944
+ * @param {number | undefined} _2
71945
+ * @param {Parent | undefined} _3
71946
+ * @param {SelectState} state
71947
+ * @returns {boolean}
71948
+ */
71949
+ function nthLastChild(query, _1, _2, _3, state) {
71950
+ const fn = getCachedNthCheck(query)
71951
+ assertDeep(state, query)
71952
+ return Boolean(
71953
+ typeof state.elementCount === 'number' &&
71954
+ typeof state.elementIndex === 'number' &&
71955
+ fn(state.elementCount - state.elementIndex - 1)
71956
+ )
71957
+ }
71958
+
71959
+ /**
71960
+ * Check whether an element matches a `:nth-last-of-type` pseudo.
71961
+ *
71962
+ * @param {RulePseudo} query
71963
+ * @param {Element} _1
71964
+ * @param {number | undefined} _2
71965
+ * @param {Parent | undefined} _3
71966
+ * @param {SelectState} state
71967
+ * @returns {boolean}
71968
+ */
71969
+ function nthLastOfType(query, _1, _2, _3, state) {
71970
+ const fn = getCachedNthCheck(query)
71971
+ assertDeep(state, query)
71972
+ return (
71973
+ typeof state.typeCount === 'number' &&
71974
+ typeof state.typeIndex === 'number' &&
71975
+ fn(state.typeCount - 1 - state.typeIndex)
71976
+ )
71977
+ }
71978
+
71979
+ /**
71980
+ * Check whether an element matches an `:nth-of-type` pseudo.
71981
+ *
71982
+ * @param {RulePseudo} query
71983
+ * @param {Element} _1
71984
+ * @param {number | undefined} _2
71985
+ * @param {Parent | undefined} _3
71986
+ * @param {SelectState} state
71987
+ * @returns {boolean}
71988
+ */
71989
+ function nthOfType(query, _1, _2, _3, state) {
71990
+ const fn = getCachedNthCheck(query)
71991
+ assertDeep(state, query)
71992
+ return typeof state.typeIndex === 'number' && fn(state.typeIndex)
71993
+ }
71994
+
71995
+ /**
71996
+ * Check whether an element matches an `:only-child` pseudo.
71997
+ *
71998
+ * @param {RulePseudo} query
71999
+ * @param {Element} _1
72000
+ * @param {number | undefined} _2
72001
+ * @param {Parent | undefined} _3
72002
+ * @param {SelectState} state
72003
+ * @returns {boolean}
72004
+ */
72005
+ function onlyChild(query, _1, _2, _3, state) {
72006
+ assertDeep(state, query)
72007
+ return state.elementCount === 1
72008
+ }
72009
+
72010
+ /**
72011
+ * Check whether an element matches an `:only-of-type` pseudo.
72012
+ *
72013
+ * @param {RulePseudo} query
72014
+ * @param {Element} _1
72015
+ * @param {number | undefined} _2
72016
+ * @param {Parent | undefined} _3
72017
+ * @param {SelectState} state
72018
+ * @returns {boolean}
72019
+ */
72020
+ function onlyOfType(query, _1, _2, _3, state) {
72021
+ assertDeep(state, query)
72022
+ return state.typeCount === 1
72023
+ }
72024
+
72025
+ /**
72026
+ * Check whether an element matches an `:optional` pseudo.
72027
+ *
72028
+ * @param {RulePseudo} query
72029
+ * @param {Element} element
72030
+ * @returns {boolean}
72031
+ */
72032
+ function optional(query, element) {
72033
+ return !required(query, element)
72034
+ }
72035
+
72036
+ /**
72037
+ * Check whether an element matches a `:read-only` pseudo.
72038
+ *
72039
+ * @param {RulePseudo} query
72040
+ * @param {Element} element
72041
+ * @param {number | undefined} index
72042
+ * @param {Parent | undefined} parent
72043
+ * @param {SelectState} state
72044
+ * @returns {boolean}
72045
+ */
72046
+ function readOnly(query, element, index, parent, state) {
72047
+ return !readWrite(query, element, index, parent, state)
72048
+ }
72049
+
72050
+ /**
72051
+ * Check whether an element matches a `:read-write` pseudo.
72052
+ *
72053
+ * @param {RulePseudo} _
72054
+ * @param {Element} element
72055
+ * @param {number | undefined} _1
72056
+ * @param {Parent | undefined} _2
72057
+ * @param {SelectState} state
72058
+ * @returns {boolean}
72059
+ */
72060
+ function readWrite(_, element, _1, _2, state) {
72061
+ return element.tagName === 'input' || element.tagName === 'textarea'
72062
+ ? !hasProperty(element, 'readOnly') && !hasProperty(element, 'disabled')
72063
+ : Boolean(state.editableOrEditingHost)
72064
+ }
72065
+
72066
+ /**
72067
+ * Check whether an element matches a `:required` pseudo.
72068
+ *
72069
+ * @param {RulePseudo} _
72070
+ * @param {Element} element
72071
+ * @returns {boolean}
72072
+ */
72073
+ function required(_, element) {
72074
+ return (
72075
+ (element.tagName === 'input' ||
72076
+ element.tagName === 'textarea' ||
72077
+ element.tagName === 'select') &&
72078
+ hasProperty(element, 'required')
72079
+ )
72080
+ }
72081
+
72082
+ /**
72083
+ * Check whether an element matches a `:root` pseudo.
72293
72084
  *
72294
72085
  * @param {RulePseudo} _
72295
72086
  * @param {Element} element
72087
+ * @param {number | undefined} _1
72088
+ * @param {Parent | undefined} parent
72089
+ * @param {SelectState} state
72296
72090
  * @returns {boolean}
72297
72091
  */
72298
- function anyLink(_, element) {
72299
- return (
72300
- (element.tagName === 'a' ||
72301
- element.tagName === 'area' ||
72302
- element.tagName === 'link') &&
72303
- hasProperty(element, 'href')
72092
+ function pseudo_root(_, element, _1, parent, state) {
72093
+ return Boolean(
72094
+ (!parent || parent.type === 'root') &&
72095
+ state.schema &&
72096
+ (state.schema.space === 'html' || state.schema.space === 'svg') &&
72097
+ (element.tagName === 'html' || element.tagName === 'svg')
72304
72098
  )
72305
72099
  }
72306
72100
 
72307
72101
  /**
72308
- * Check whether an element matches a `:blank` pseudo.
72102
+ * Check whether an element matches a `:scope` pseudo.
72309
72103
  *
72310
72104
  * @param {RulePseudo} _
72311
72105
  * @param {Element} element
72106
+ * @param {number | undefined} _1
72107
+ * @param {Parent | undefined} _2
72108
+ * @param {SelectState} state
72312
72109
  * @returns {boolean}
72313
72110
  */
72314
- function blank(_, element) {
72315
- return !someChildren(element, check)
72111
+ function scope(_, element, _1, _2, state) {
72112
+ return state.scopeElements.includes(element)
72113
+ }
72316
72114
 
72317
- /**
72318
- * @param {ElementChild} child
72319
- * @returns {boolean}
72320
- */
72321
- function check(child) {
72322
- return (
72323
- child.type === 'element' || (child.type === 'text' && !whitespace(child))
72324
- )
72115
+ // Shouldn’t be called, parser gives correct data.
72116
+ /* c8 ignore next 3 */
72117
+ function invalidPseudo() {
72118
+ throw new Error('Invalid pseudo-selector')
72119
+ }
72120
+
72121
+ /**
72122
+ * @param {unknown} query
72123
+ * @returns {never}
72124
+ */
72125
+ function unknownPseudo(query) {
72126
+ // @ts-expect-error: indexable.
72127
+ if (query.name) {
72128
+ // @ts-expect-error: indexable.
72129
+ throw new Error('Unknown pseudo-selector `' + query.name + '`')
72325
72130
  }
72131
+
72132
+ throw new Error('Unexpected pseudo-element or empty pseudo-class')
72326
72133
  }
72327
72134
 
72328
72135
  /**
72329
- * Check whether an element matches a `:checked` pseudo.
72136
+ * Check children.
72330
72137
  *
72331
- * @param {RulePseudo} _
72332
72138
  * @param {Element} element
72139
+ * @param {(child: ElementChild) => boolean} check
72333
72140
  * @returns {boolean}
72334
72141
  */
72335
- function checked(_, element) {
72336
- if (element.tagName === 'input' || element.tagName === 'menuitem') {
72337
- return Boolean(
72338
- element.properties &&
72339
- (element.properties.type === 'checkbox' ||
72340
- element.properties.type === 'radio') &&
72341
- hasProperty(element, 'checked')
72342
- )
72343
- }
72142
+ function someChildren(element, check) {
72143
+ const children = element.children
72144
+ let index = -1
72344
72145
 
72345
- if (element.tagName === 'option') {
72346
- return hasProperty(element, 'selected')
72146
+ while (++index < children.length) {
72147
+ if (check(children[index])) return true
72347
72148
  }
72348
72149
 
72349
72150
  return false
72350
72151
  }
72351
72152
 
72352
72153
  /**
72353
- * Check whether an element matches a `:dir()` pseudo.
72354
- *
72355
- * @param {RulePseudo} query
72356
- * @param {Element} _1
72357
- * @param {number | undefined} _2
72358
- * @param {Parent | undefined} _3
72359
72154
  * @param {SelectState} state
72360
- * @returns {boolean}
72361
- */
72362
- function dir(query, _1, _2, _3, state) {
72363
- return state.direction === query.value
72364
- }
72365
-
72366
- /**
72367
- * Check whether an element matches a `:disabled` pseudo.
72368
- *
72369
- * @param {RulePseudo} _
72370
- * @param {Element} element
72371
- * @returns {boolean}
72155
+ * @param {RulePseudo} query
72372
72156
  */
72373
- function disabled(_, element) {
72374
- return (
72375
- (element.tagName === 'button' ||
72376
- element.tagName === 'input' ||
72377
- element.tagName === 'select' ||
72378
- element.tagName === 'textarea' ||
72379
- element.tagName === 'optgroup' ||
72380
- element.tagName === 'option' ||
72381
- element.tagName === 'menuitem' ||
72382
- element.tagName === 'fieldset') &&
72383
- hasProperty(element, 'disabled')
72384
- )
72157
+ function assertDeep(state, query) {
72158
+ if (state.shallow) {
72159
+ throw new Error('Cannot use `:' + query.name + '` without parent')
72160
+ }
72385
72161
  }
72386
72162
 
72387
72163
  /**
72388
- * Check whether an element matches an `:empty` pseudo.
72389
- *
72390
- * @param {RulePseudo} _
72391
- * @param {Element} element
72392
- * @returns {boolean}
72164
+ * @param {RulePseudo} query
72165
+ * @returns {(value: number) => boolean}
72393
72166
  */
72394
- function empty(_, element) {
72395
- return !someChildren(element, check)
72167
+ function getCachedNthCheck(query) {
72168
+ /** @type {(value: number) => boolean} */
72169
+ // @ts-expect-error: cache.
72170
+ let fn = query._cachedFn
72396
72171
 
72397
- /**
72398
- * @param {ElementChild} child
72399
- * @returns {boolean}
72400
- */
72401
- function check(child) {
72402
- return child.type === 'element' || child.type === 'text'
72172
+ if (!fn) {
72173
+ // @ts-expect-error: always string.
72174
+ fn = pseudo_nthCheck(query.value)
72175
+ // @ts-expect-error: cache.
72176
+ query._cachedFn = fn
72403
72177
  }
72178
+
72179
+ return fn
72404
72180
  }
72405
72181
 
72182
+ ;// CONCATENATED MODULE: ../node_modules/hast-util-select/lib/test.js
72406
72183
  /**
72407
- * Check whether an element matches an `:enabled` pseudo.
72408
- *
72409
- * @param {RulePseudo} query
72410
- * @param {Element} element
72411
- * @returns {boolean}
72184
+ * @typedef {import('./types.js').Rule} Rule
72185
+ * @typedef {import('./types.js').Element} Element
72186
+ * @typedef {import('./types.js').Parent} Parent
72187
+ * @typedef {import('./types.js').SelectState} SelectState
72412
72188
  */
72413
- function enabled(query, element) {
72414
- return !disabled(query, element)
72415
- }
72189
+
72190
+
72191
+
72192
+
72193
+
72194
+
72416
72195
 
72417
72196
  /**
72418
- * Check whether an element matches a `:first-child` pseudo.
72197
+ * Test a rule.
72419
72198
  *
72420
- * @param {RulePseudo} query
72421
- * @param {Element} _1
72422
- * @param {number | undefined} _2
72423
- * @param {Parent | undefined} _3
72199
+ * @param {Rule} query
72200
+ * @param {Element} element
72201
+ * @param {number | undefined} index
72202
+ * @param {Parent | undefined} parent
72424
72203
  * @param {SelectState} state
72425
72204
  * @returns {boolean}
72426
72205
  */
72427
- function firstChild(query, _1, _2, _3, state) {
72428
- assertDeep(state, query)
72429
- return state.elementIndex === 0
72206
+ function test(query, element, index, parent, state) {
72207
+ return Boolean(
72208
+ (!query.tagName || name_name(query, element)) &&
72209
+ (!query.classNames || className(query, element)) &&
72210
+ (!query.id || id(query, element)) &&
72211
+ (!query.attrs || attribute(query, element, state.schema)) &&
72212
+ (!query.pseudos || pseudo(query, element, index, parent, state))
72213
+ )
72430
72214
  }
72431
72215
 
72216
+ ;// CONCATENATED MODULE: ../node_modules/hast-util-select/lib/walk.js
72432
72217
  /**
72433
- * Check whether an element matches a `:first-of-type` pseudo.
72218
+ * @typedef {import('./types.js').Node} Node
72219
+ * @typedef {import('./types.js').Element} Element
72220
+ * @typedef {import('./types.js').Parent} Parent
72221
+ * @typedef {import('./types.js').RuleSet} RuleSet
72222
+ * @typedef {import('./types.js').SelectState} SelectState
72223
+ * @typedef {import('./types.js').Selectors} Selectors
72434
72224
  *
72435
- * @param {RulePseudo} query
72436
- * @param {Element} _1
72437
- * @param {number | undefined} _2
72438
- * @param {Parent | undefined} _3
72439
- * @param {SelectState} state
72440
- * @returns {boolean}
72225
+ * @typedef Nest
72226
+ * Rule sets by nesting.
72227
+ * @property {Array<RuleSet> | undefined} descendant
72228
+ * `a b`
72229
+ * @property {Array<RuleSet> | undefined} directChild
72230
+ * `a > b`
72231
+ * @property {Array<RuleSet> | undefined} adjacentSibling
72232
+ * `a + b`
72233
+ * @property {Array<RuleSet> | undefined} generalSibling
72234
+ * `a ~ b`
72235
+ *
72236
+ * @typedef Counts
72237
+ * Info on elements in a parent.
72238
+ * @property {number} count
72239
+ * Number of elements.
72240
+ * @property {Map<string, number>} types
72241
+ * Number of elements by tag name.
72441
72242
  */
72442
- function firstOfType(query, _1, _2, _3, state) {
72443
- assertDeep(state, query)
72444
- return state.typeIndex === 0
72445
- }
72243
+
72244
+
72245
+
72246
+
72247
+ /** @type {Array<never>} */
72248
+ const walk_empty = []
72446
72249
 
72447
72250
  /**
72448
- * @param {RulePseudoSelector} query
72449
- * @param {Element} element
72450
- * @param {number | undefined} _1
72451
- * @param {Parent | undefined} _2
72452
- * @param {SelectState} state
72453
- * @returns {boolean}
72251
+ * Turn a query into a uniform object.
72252
+ *
72253
+ * @param {Selectors | RuleSet | null} query
72254
+ * @returns {Selectors}
72454
72255
  */
72455
- function has(query, element, _1, _2, state) {
72456
- /** @type {SelectState} */
72457
- const childState = {
72458
- ...state,
72459
- // Not found yet.
72460
- found: false,
72461
- // Do walk deep.
72462
- shallow: false,
72463
- // One result is enough.
72464
- one: true,
72465
- scopeElements: [element],
72466
- results: [],
72467
- rootQuery: queryToSelectors(query.value)
72256
+ function queryToSelectors(query) {
72257
+ if (query === null) {
72258
+ return {type: 'selectors', selectors: []}
72468
72259
  }
72469
72260
 
72470
- walk_walk(childState, {type: 'root', children: element.children})
72261
+ if (query.type === 'ruleSet') {
72262
+ return {type: 'selectors', selectors: [query]}
72263
+ }
72471
72264
 
72472
- return childState.results.length > 0
72265
+ return query
72473
72266
  }
72474
72267
 
72475
72268
  /**
72476
- * Check whether an element matches a `:lang()` pseudo.
72269
+ * Walk a tree.
72477
72270
  *
72478
- * @param {RulePseudo} query
72479
- * @param {Element} _1
72480
- * @param {number | undefined} _2
72481
- * @param {Parent | undefined} _3
72482
72271
  * @param {SelectState} state
72483
- * @returns {boolean}
72272
+ * @param {Node | undefined} tree
72484
72273
  */
72485
- function pseudo_lang(query, _1, _2, _3, state) {
72486
- return (
72487
- state.language !== '' &&
72488
- state.language !== undefined &&
72489
- // @ts-expect-error never `selectors`.
72490
- extendedFilter(state.language, comma_separated_tokens_parse(query.value)).length > 0
72491
- )
72274
+ function walk_walk(state, tree) {
72275
+ if (tree) {
72276
+ walk_one(state, [], tree, undefined, undefined)
72277
+ }
72492
72278
  }
72493
72279
 
72494
72280
  /**
72495
- * Check whether an element matches a `:last-child` pseudo.
72281
+ * Check a node.
72496
72282
  *
72497
- * @param {RulePseudo} query
72498
- * @param {Element} _1
72499
- * @param {number | undefined} _2
72500
- * @param {Parent | undefined} _3
72501
72283
  * @param {SelectState} state
72502
- * @returns {boolean}
72284
+ * @param {Array<RuleSet>} currentRules
72285
+ * @param {Node} node
72286
+ * @param {number | undefined} index
72287
+ * @param {Parent | undefined} parent
72288
+ * @returns {Nest}
72503
72289
  */
72504
- function lastChild(query, _1, _2, _3, state) {
72505
- assertDeep(state, query)
72506
- return Boolean(
72507
- state.elementCount && state.elementIndex === state.elementCount - 1
72508
- )
72290
+ function walk_one(state, currentRules, node, index, parent) {
72291
+ /** @type {Nest} */
72292
+ let nestResult = {
72293
+ directChild: undefined,
72294
+ descendant: undefined,
72295
+ adjacentSibling: undefined,
72296
+ generalSibling: undefined
72297
+ }
72298
+ const exit = enterState(state, node)
72299
+
72300
+ if (node.type === 'element') {
72301
+ nestResult = applySelectors(
72302
+ state,
72303
+ // Try the root rules for this element too.
72304
+ combine(currentRules, state.rootQuery.selectors),
72305
+ node,
72306
+ index,
72307
+ parent
72308
+ )
72309
+ }
72310
+
72311
+ // If this is a parent, and we want to delve into them, and we haven’t found
72312
+ // our single result yet.
72313
+ if ('children' in node && !state.shallow && !(state.one && state.found)) {
72314
+ walk_all(state, nestResult, node)
72315
+ }
72316
+
72317
+ exit()
72318
+
72319
+ return nestResult
72509
72320
  }
72510
72321
 
72511
72322
  /**
72512
- * Check whether an element matches a `:last-of-type` pseudo.
72323
+ * Check a node.
72513
72324
  *
72514
- * @param {RulePseudo} query
72515
- * @param {Element} _1
72516
- * @param {number | undefined} _2
72517
- * @param {Parent | undefined} _3
72518
72325
  * @param {SelectState} state
72519
- * @returns {boolean}
72326
+ * @param {Nest} nest
72327
+ * @param {Parent} node
72328
+ * @returns {void}
72520
72329
  */
72521
- function lastOfType(query, _1, _2, _3, state) {
72522
- assertDeep(state, query)
72523
- return (
72524
- typeof state.typeIndex === 'number' &&
72525
- typeof state.typeCount === 'number' &&
72526
- state.typeIndex === state.typeCount - 1
72527
- )
72330
+ function walk_all(state, nest, node) {
72331
+ const fromParent = combine(nest.descendant, nest.directChild)
72332
+ /** @type {Array<RuleSet> | undefined} */
72333
+ let fromSibling
72334
+ let index = -1
72335
+ /**
72336
+ * Total counts.
72337
+ * @type {Counts}
72338
+ */
72339
+ const total = {count: 0, types: new Map()}
72340
+ /**
72341
+ * Counts of previous siblings.
72342
+ * @type {Counts}
72343
+ */
72344
+ const before = {count: 0, types: new Map()}
72345
+
72346
+ while (++index < node.children.length) {
72347
+ count(total, node.children[index])
72348
+ }
72349
+
72350
+ index = -1
72351
+
72352
+ while (++index < node.children.length) {
72353
+ const child = node.children[index]
72354
+ // Uppercase to prevent prototype polution, injecting `constructor` or so.
72355
+ // Normalize because HTML is insensitive.
72356
+ const name =
72357
+ child.type === 'element' ? child.tagName.toUpperCase() : undefined
72358
+ // Before counting further elements:
72359
+ state.elementIndex = before.count
72360
+ state.typeIndex = name ? before.types.get(name) || 0 : 0
72361
+ // After counting all elements.
72362
+ state.elementCount = total.count
72363
+ state.typeCount = name ? total.types.get(name) : 0
72364
+
72365
+ // Only apply if this is a parent, this should be an element, but we check
72366
+ // for parents so that we delve into custom nodes too.
72367
+ if ('children' in child) {
72368
+ const forSibling = combine(fromParent, fromSibling)
72369
+ const nest = walk_one(state, forSibling, node.children[index], index, node)
72370
+ fromSibling = combine(nest.generalSibling, nest.adjacentSibling)
72371
+ }
72372
+
72373
+ // We found one thing, and one is enough.
72374
+ if (state.one && state.found) {
72375
+ break
72376
+ }
72377
+
72378
+ count(before, node.children[index])
72379
+ }
72528
72380
  }
72529
72381
 
72530
72382
  /**
72531
- * Check whether an element `:matches` further selectors.
72383
+ * Apply selectors to an element.
72532
72384
  *
72533
- * @param {RulePseudoSelector} query
72534
- * @param {Element} element
72535
- * @param {number | undefined} _
72536
- * @param {Parent | undefined} parent
72537
72385
  * @param {SelectState} state
72538
- * @returns {boolean}
72386
+ * Current state.
72387
+ * @param {Array<RuleSet>} rules
72388
+ * Rules to apply.
72389
+ * @param {Element} node
72390
+ * Element to apply rules to.
72391
+ * @param {number | undefined} index
72392
+ * Index of node in parent.
72393
+ * @param {Parent | undefined} parent
72394
+ * Parent of node.
72395
+ * @returns {Nest}
72396
+ * Further rules.
72539
72397
  */
72540
- function matches(query, element, _, parent, state) {
72541
- /** @type {SelectState} */
72542
- const childState = {
72543
- ...state,
72544
- // Not found yet.
72545
- found: false,
72546
- // Do walk deep.
72547
- shallow: false,
72548
- // One result is enough.
72549
- one: true,
72550
- scopeElements: [element],
72551
- results: [],
72552
- rootQuery: queryToSelectors(query.value)
72398
+ function applySelectors(state, rules, node, index, parent) {
72399
+ /** @type {Nest} */
72400
+ const nestResult = {
72401
+ directChild: undefined,
72402
+ descendant: undefined,
72403
+ adjacentSibling: undefined,
72404
+ generalSibling: undefined
72553
72405
  }
72406
+ let selectorIndex = -1
72554
72407
 
72555
- walk_walk(childState, element)
72408
+ while (++selectorIndex < rules.length) {
72409
+ const ruleSet = rules[selectorIndex]
72556
72410
 
72557
- return childState.results[0] === element
72411
+ // We found one thing, and one is enough.
72412
+ if (state.one && state.found) {
72413
+ break
72414
+ }
72415
+
72416
+ // When shallow, we don’t allow nested rules.
72417
+ // Idea: we could allow a stack of parents?
72418
+ // Might get quite complex though.
72419
+ if (state.shallow && ruleSet.rule.rule) {
72420
+ throw new Error('Expected selector without nesting')
72421
+ }
72422
+
72423
+ // If this rule matches:
72424
+ if (test(ruleSet.rule, node, index, parent, state)) {
72425
+ const nest = ruleSet.rule.rule
72426
+
72427
+ // Are there more?
72428
+ if (nest) {
72429
+ /** @type {RuleSet} */
72430
+ const rule = {type: 'ruleSet', rule: nest}
72431
+ /** @type {keyof Nest} */
72432
+ const label =
72433
+ nest.nestingOperator === '+'
72434
+ ? 'adjacentSibling'
72435
+ : nest.nestingOperator === '~'
72436
+ ? 'generalSibling'
72437
+ : nest.nestingOperator === '>'
72438
+ ? 'directChild'
72439
+ : 'descendant'
72440
+ add(nestResult, label, rule)
72441
+ } else {
72442
+ // We have a match!
72443
+ state.found = true
72444
+
72445
+ if (!state.results.includes(node)) {
72446
+ state.results.push(node)
72447
+ }
72448
+ }
72449
+ }
72450
+
72451
+ // Descendant.
72452
+ if (ruleSet.rule.nestingOperator === null) {
72453
+ add(nestResult, 'descendant', ruleSet)
72454
+ }
72455
+ // Adjacent.
72456
+ else if (ruleSet.rule.nestingOperator === '~') {
72457
+ add(nestResult, 'generalSibling', ruleSet)
72458
+ }
72459
+ // Drop top-level nesting (`undefined`), direct child (`>`), adjacent sibling (`+`).
72460
+ }
72461
+
72462
+ return nestResult
72558
72463
  }
72559
72464
 
72560
72465
  /**
72561
- * Check whether an element does `:not` match further selectors.
72466
+ * Combine two lists, if needed.
72562
72467
  *
72563
- * @param {RulePseudoSelector} query
72564
- * @param {Element} element
72565
- * @param {number | undefined} index
72566
- * @param {Parent | undefined} parent
72567
- * @param {SelectState} state
72568
- * @returns {boolean}
72468
+ * This is optimized to create as few lists as possible.
72469
+ *
72470
+ * @param {Array<RuleSet> | undefined} left
72471
+ * @param {Array<RuleSet> | undefined} right
72472
+ * @returns {Array<RuleSet>}
72569
72473
  */
72570
- function not(query, element, index, parent, state) {
72571
- return !matches(query, element, index, parent, state)
72474
+ function combine(left, right) {
72475
+ return left && right && left.length > 0 && right.length > 0
72476
+ ? [...left, ...right]
72477
+ : left && left.length > 0
72478
+ ? left
72479
+ : right && right.length > 0
72480
+ ? right
72481
+ : walk_empty
72572
72482
  }
72573
72483
 
72574
72484
  /**
72575
- * Check whether an element matches an `:nth-child` pseudo.
72485
+ * Add a rule to a nesting map.
72576
72486
  *
72577
- * @param {RulePseudo} query
72578
- * @param {Element} _1
72579
- * @param {number | undefined} _2
72580
- * @param {Parent | undefined} _3
72581
- * @param {SelectState} state
72582
- * @returns {boolean}
72487
+ * @param {Nest} nest
72488
+ * @param {keyof Nest} field
72489
+ * @param {RuleSet} rule
72583
72490
  */
72584
- function nthChild(query, _1, _2, _3, state) {
72585
- const fn = getCachedNthCheck(query)
72586
- assertDeep(state, query)
72587
- return typeof state.elementIndex === 'number' && fn(state.elementIndex)
72491
+ function add(nest, field, rule) {
72492
+ const list = nest[field]
72493
+ if (list) {
72494
+ list.push(rule)
72495
+ } else {
72496
+ nest[field] = [rule]
72497
+ }
72588
72498
  }
72589
72499
 
72590
72500
  /**
72591
- * Check whether an element matches an `:nth-last-child` pseudo.
72501
+ * Count a node.
72592
72502
  *
72593
- * @param {RulePseudo} query
72594
- * @param {Element} _1
72595
- * @param {number | undefined} _2
72596
- * @param {Parent | undefined} _3
72597
- * @param {SelectState} state
72598
- * @returns {boolean}
72503
+ * @param {Counts} counts
72504
+ * Counts.
72505
+ * @param {Node} node
72506
+ * Node (we’re looking for elements).
72507
+ * @returns {void}
72508
+ * Nothing.
72599
72509
  */
72600
- function nthLastChild(query, _1, _2, _3, state) {
72601
- const fn = getCachedNthCheck(query)
72602
- assertDeep(state, query)
72603
- return Boolean(
72604
- typeof state.elementCount === 'number' &&
72605
- typeof state.elementIndex === 'number' &&
72606
- fn(state.elementCount - state.elementIndex - 1)
72607
- )
72510
+ function count(counts, node) {
72511
+ if (node.type === 'element') {
72512
+ // Uppercase to prevent prototype polution, injecting `constructor` or so.
72513
+ // Normalize because HTML is insensitive.
72514
+ const name = node.tagName.toUpperCase()
72515
+ const count = (counts.types.get(name) || 0) + 1
72516
+ counts.count++
72517
+ counts.types.set(name, count)
72518
+ }
72608
72519
  }
72609
72520
 
72521
+ // EXTERNAL MODULE: ../node_modules/css-selector-parser/lib/index.js
72522
+ var css_selector_parser_lib = __webpack_require__(301);
72523
+ ;// CONCATENATED MODULE: ../node_modules/hast-util-select/lib/parse.js
72610
72524
  /**
72611
- * Check whether an element matches a `:nth-last-of-type` pseudo.
72612
- *
72613
- * @param {RulePseudo} query
72614
- * @param {Element} _1
72615
- * @param {number | undefined} _2
72616
- * @param {Parent | undefined} _3
72617
- * @param {SelectState} state
72618
- * @returns {boolean}
72525
+ * @typedef {import('./types.js').Selectors} Selectors
72526
+ * @typedef {import('./types.js').RuleSet} RuleSet
72619
72527
  */
72620
- function nthLastOfType(query, _1, _2, _3, state) {
72621
- const fn = getCachedNthCheck(query)
72622
- assertDeep(state, query)
72623
- return (
72624
- typeof state.typeCount === 'number' &&
72625
- typeof state.typeIndex === 'number' &&
72626
- fn(state.typeCount - 1 - state.typeIndex)
72627
- )
72628
- }
72528
+
72529
+
72530
+
72531
+ const parse_parser = new css_selector_parser_lib/* CssSelectorParser */.N()
72532
+
72533
+ parse_parser.registerAttrEqualityMods('~', '|', '^', '$', '*')
72534
+ parse_parser.registerSelectorPseudos('any', 'matches', 'not', 'has')
72535
+ parse_parser.registerNestingOperators('>', '+', '~')
72629
72536
 
72630
72537
  /**
72631
- * Check whether an element matches an `:nth-of-type` pseudo.
72632
- *
72633
- * @param {RulePseudo} query
72634
- * @param {Element} _1
72635
- * @param {number | undefined} _2
72636
- * @param {Parent | undefined} _3
72637
- * @param {SelectState} state
72638
- * @returns {boolean}
72538
+ * @param {string} selector
72539
+ * @returns {Selectors | RuleSet | null}
72639
72540
  */
72640
- function nthOfType(query, _1, _2, _3, state) {
72641
- const fn = getCachedNthCheck(query)
72642
- assertDeep(state, query)
72643
- return typeof state.typeIndex === 'number' && fn(state.typeIndex)
72541
+ function lib_parse_parse(selector) {
72542
+ if (typeof selector !== 'string') {
72543
+ throw new TypeError('Expected `string` as selector, not `' + selector + '`')
72544
+ }
72545
+
72546
+ return parse_parser.parse(selector)
72644
72547
  }
72645
72548
 
72549
+ ;// CONCATENATED MODULE: ../node_modules/hast-util-select/lib/index.js
72646
72550
  /**
72647
- * Check whether an element matches an `:only-child` pseudo.
72648
- *
72649
- * @param {RulePseudo} query
72650
- * @param {Element} _1
72651
- * @param {number | undefined} _2
72652
- * @param {Parent | undefined} _3
72653
- * @param {SelectState} state
72654
- * @returns {boolean}
72551
+ * @typedef {import('./types.js').Element} Element
72552
+ * @typedef {import('./types.js').Node} Node
72553
+ * @typedef {import('./types.js').Space} Space
72554
+ * @typedef {import('./types.js').SelectState} SelectState
72655
72555
  */
72656
- function onlyChild(query, _1, _2, _3, state) {
72657
- assertDeep(state, query)
72658
- return state.elementCount === 1
72659
- }
72556
+
72557
+
72558
+
72559
+
72660
72560
 
72661
72561
  /**
72662
- * Check whether an element matches an `:only-of-type` pseudo.
72562
+ * Check that the given `node` matches `selector`.
72663
72563
  *
72664
- * @param {RulePseudo} query
72665
- * @param {Element} _1
72666
- * @param {number | undefined} _2
72667
- * @param {Parent | undefined} _3
72668
- * @param {SelectState} state
72564
+ * This only checks the element itself, not the surrounding tree.
72565
+ * Thus, nesting in selectors is not supported (`p b`, `p > b`), neither are
72566
+ * selectors like `:first-child`, etc.
72567
+ * This only checks that the given element matches the selector.
72568
+ *
72569
+ * @param {string} selector
72570
+ * CSS selector, such as (`h1`, `a, b`).
72571
+ * @param {Node | null | undefined} [node]
72572
+ * Node that might match `selector`, should be an element.
72573
+ * @param {Space | null | undefined} [space='html']
72574
+ * Name of namespace (`'svg'` or `'html'`).
72669
72575
  * @returns {boolean}
72576
+ * Whether `node` matches `selector`.
72670
72577
  */
72671
- function onlyOfType(query, _1, _2, _3, state) {
72672
- assertDeep(state, query)
72673
- return state.typeCount === 1
72578
+ function lib_matches(selector, node, space) {
72579
+ const state = lib_createState(selector, node, space)
72580
+ state.one = true
72581
+ state.shallow = true
72582
+ walk(state, node || undefined)
72583
+ return state.results.length > 0
72674
72584
  }
72675
72585
 
72676
72586
  /**
72677
- * Check whether an element matches an `:optional` pseudo.
72587
+ * Select the first element that matches `selector` in the given `tree`.
72588
+ * Searches the tree in *preorder*.
72678
72589
  *
72679
- * @param {RulePseudo} query
72680
- * @param {Element} element
72681
- * @returns {boolean}
72590
+ * @param {string} selector
72591
+ * CSS selector, such as (`h1`, `a, b`).
72592
+ * @param {Node | null | undefined} [tree]
72593
+ * Tree to search.
72594
+ * @param {Space | null | undefined} [space='html']
72595
+ * Name of namespace (`'svg'` or `'html'`).
72596
+ * @returns {Element | null}
72597
+ * First element in `tree` that matches `selector` or `null` if nothing is
72598
+ * found.
72599
+ * This could be `tree` itself.
72682
72600
  */
72683
- function optional(query, element) {
72684
- return !required(query, element)
72601
+ function lib_select(selector, tree, space) {
72602
+ const state = lib_createState(selector, tree, space)
72603
+ state.one = true
72604
+ walk(state, tree || undefined)
72605
+ // To do in major: return `undefined` instead.
72606
+ return state.results[0] || null
72685
72607
  }
72686
72608
 
72687
72609
  /**
72688
- * Check whether an element matches a `:read-only` pseudo.
72610
+ * Select all elements that match `selector` in the given `tree`.
72611
+ * Searches the tree in *preorder*.
72689
72612
  *
72690
- * @param {RulePseudo} query
72691
- * @param {Element} element
72692
- * @param {number | undefined} index
72693
- * @param {Parent | undefined} parent
72694
- * @param {SelectState} state
72695
- * @returns {boolean}
72613
+ * @param {string} selector
72614
+ * CSS selector, such as (`h1`, `a, b`).
72615
+ * @param {Node | null | undefined} [tree]
72616
+ * Tree to search.
72617
+ * @param {Space | null | undefined} [space='html']
72618
+ * Name of namespace (`'svg'` or `'html'`).
72619
+ * @returns {Array<Element>}
72620
+ * Elements in `tree` that match `selector`.
72621
+ * This could include `tree` itself.
72696
72622
  */
72697
- function readOnly(query, element, index, parent, state) {
72698
- return !readWrite(query, element, index, parent, state)
72623
+ function selectAll(selector, tree, space) {
72624
+ const state = lib_createState(selector, tree, space)
72625
+ walk_walk(state, tree || undefined)
72626
+ return state.results
72699
72627
  }
72700
72628
 
72701
72629
  /**
72702
- * Check whether an element matches a `:read-write` pseudo.
72703
- *
72704
- * @param {RulePseudo} _
72705
- * @param {Element} element
72706
- * @param {number | undefined} _1
72707
- * @param {Parent | undefined} _2
72708
- * @param {SelectState} state
72709
- * @returns {boolean}
72630
+ * @param {string} selector
72631
+ * Tree to search.
72632
+ * @param {Node | null | undefined} [tree]
72633
+ * Tree to search.
72634
+ * @param {Space | null | undefined} [space='html']
72635
+ * Name of namespace (`'svg'` or `'html'`).
72636
+ * @returns {SelectState} SelectState
72710
72637
  */
72711
- function readWrite(_, element, _1, _2, state) {
72712
- return element.tagName === 'input' || element.tagName === 'textarea'
72713
- ? !hasProperty(element, 'readOnly') && !hasProperty(element, 'disabled')
72714
- : Boolean(state.editableOrEditingHost)
72638
+ function lib_createState(selector, tree, space) {
72639
+ return {
72640
+ // State of the query.
72641
+ rootQuery: queryToSelectors(lib_parse_parse(selector)),
72642
+ results: [],
72643
+ // @ts-expect-error assume elements.
72644
+ scopeElements: tree ? (tree.type === 'root' ? tree.children : [tree]) : [],
72645
+ one: false,
72646
+ shallow: false,
72647
+ found: false,
72648
+ // State in the tree.
72649
+ schema: space === 'svg' ? property_information_svg : property_information_html,
72650
+ language: undefined,
72651
+ direction: 'ltr',
72652
+ editableOrEditingHost: false,
72653
+ typeIndex: undefined,
72654
+ elementIndex: undefined,
72655
+ typeCount: undefined,
72656
+ elementCount: undefined
72657
+ }
72715
72658
  }
72716
72659
 
72660
+ ;// CONCATENATED MODULE: ../node_modules/rehype-rewrite/lib/index.js
72661
+
72662
+
72663
+ /** Get the node tree source code string */
72664
+ const getCodeString = (data = [], code = '') => {
72665
+ data.forEach((node) => {
72666
+ if (node.type === 'text') {
72667
+ code += node.value;
72668
+ }
72669
+ else if (node.type === 'element' && node.children && Array.isArray(node.children)) {
72670
+ code += getCodeString(node.children);
72671
+ }
72672
+ });
72673
+ return code;
72674
+ };
72675
+ const remarkRewrite = (options) => {
72676
+ const { selector, rewrite } = options || {};
72677
+ return (tree) => {
72678
+ if (!rewrite || typeof rewrite !== 'function')
72679
+ return;
72680
+ if (selector && typeof selector === 'string') {
72681
+ const selected = selectAll(selector, tree);
72682
+ if (selected && selected.length > 0) {
72683
+ visit(tree, selected, (node, index, parent) => {
72684
+ rewrite(node, index, parent);
72685
+ });
72686
+ }
72687
+ return;
72688
+ }
72689
+ visit(tree, (node, index, parent) => {
72690
+ rewrite(node, index, parent);
72691
+ });
72692
+ };
72693
+ };
72694
+ /* harmony default export */ const rehype_rewrite_lib = (remarkRewrite);
72695
+ //# sourceMappingURL=index.js.map
72696
+ ;// CONCATENATED MODULE: ../node_modules/rehype-attr/lib/utils.js
72697
+ const getURLParameters = (url = '') => (url.match(/([^?=&]+)(=([^&]*))/g) || []).reduce((a, v) => ((a[v.slice(0, v.indexOf('='))] = v.slice(v.indexOf('=') + 1)), a), {});
72698
+ const prevChild = (data = [], index) => {
72699
+ let i = index;
72700
+ while (i > -1) {
72701
+ i--;
72702
+ if (!data[i])
72703
+ return;
72704
+ if ((data[i] && data[i].value && data[i].value.replace(/(\n|\s)/g, '') !== '') || data[i].type !== 'text') {
72705
+ if (!/^rehype:/.test(data[i].value) || data[i].type !== 'comment')
72706
+ return;
72707
+ return data[i];
72708
+ }
72709
+ }
72710
+ return;
72711
+ };
72712
+ const nextChild = (data = [], index, tagName, codeBlockParames) => {
72713
+ let i = index;
72714
+ while (i < data.length) {
72715
+ i++;
72716
+ if (tagName) {
72717
+ const element = data[i];
72718
+ if (element && element.value && element.value.replace(/(\n|\s)/g, '') !== '' || data[i] && data[i].type === 'element') {
72719
+ return element.tagName === tagName ? element : undefined;
72720
+ }
72721
+ }
72722
+ else {
72723
+ const element = data[i];
72724
+ if (!element || element.type === 'element')
72725
+ return;
72726
+ if (element.type === 'text' && element.value.replace(/(\n|\s)/g, '') !== '')
72727
+ return;
72728
+ if (element.type && /^(comment|raw)$/ig.test(element.type)) {
72729
+ if (element.value && !/^rehype:/.test(element.value.replace(/^(\s+)?<!--(.*?)-->/, '$2') || '')) {
72730
+ return;
72731
+ }
72732
+ ;
72733
+ if (codeBlockParames) {
72734
+ const nextNode = nextChild(data, i, 'pre', codeBlockParames);
72735
+ if (nextNode)
72736
+ return;
72737
+ element.value = (element.value || '').replace(/^(\n|\s)+/, '');
72738
+ return element;
72739
+ }
72740
+ else {
72741
+ element.value = (element.value || '').replace(/^(\n|\s)+/, '');
72742
+ return element;
72743
+ }
72744
+ }
72745
+ }
72746
+ }
72747
+ return;
72748
+ };
72717
72749
  /**
72718
- * Check whether an element matches a `:required` pseudo.
72719
- *
72720
- * @param {RulePseudo} _
72721
- * @param {Element} element
72722
- * @returns {boolean}
72750
+ * 获取代码注视的位置
72751
+ * @param data 数据
72752
+ * @param index 当前数据所在的位置
72753
+ * @returns 返回 当前参数数据 Object,`{}`
72723
72754
  */
72724
- function required(_, element) {
72725
- return (
72726
- (element.tagName === 'input' ||
72727
- element.tagName === 'textarea' ||
72728
- element.tagName === 'select') &&
72729
- hasProperty(element, 'required')
72730
- )
72731
- }
72755
+ const getCommentObject = ({ value = '' }) => {
72756
+ const param = getURLParameters(value.replace(/^<!--(.*?)-->/, '$1').replace(/^rehype:/, ''));
72757
+ Object.keys(param).forEach((keyName) => {
72758
+ if (param[keyName] === 'true') {
72759
+ param[keyName] = true;
72760
+ }
72761
+ if (param[keyName] === 'false') {
72762
+ param[keyName] = false;
72763
+ }
72764
+ if (typeof param[keyName] === 'string' && !/^0/.test(param[keyName]) && !isNaN(+param[keyName])) {
72765
+ param[keyName] = +param[keyName];
72766
+ }
72767
+ });
72768
+ return param;
72769
+ };
72770
+ const propertiesHandle = (defaultAttrs, attrs, type) => {
72771
+ if (type === 'string') {
72772
+ return { ...defaultAttrs, 'data-config': JSON.stringify({ ...attrs, rehyp: true }) };
72773
+ }
72774
+ else if (type === 'attr') {
72775
+ return { ...defaultAttrs, ...attrs };
72776
+ }
72777
+ return { ...defaultAttrs, 'data-config': { ...attrs, rehyp: true } };
72778
+ };
72779
+ //# sourceMappingURL=utils.js.map
72780
+ ;// CONCATENATED MODULE: ../node_modules/rehype-attr/lib/index.js
72781
+
72782
+
72783
+ const rehypeAttrs = (options = {}) => {
72784
+ const { properties = 'data', codeBlockParames = true } = options;
72785
+ return (tree) => {
72786
+ visit(tree, 'element', (node, index, parent) => {
72787
+ if (codeBlockParames && node.tagName === 'pre' && node && Array.isArray(node.children) && parent && Array.isArray(parent.children) && parent.children.length > 1) {
72788
+ const firstChild = node.children[0];
72789
+ if (firstChild && firstChild.tagName === 'code' && typeof index === 'number') {
72790
+ const child = prevChild(parent.children, index);
72791
+ if (child) {
72792
+ const attr = getCommentObject(child);
72793
+ if (Object.keys(attr).length > 0) {
72794
+ node.properties = { ...node.properties, ...{ 'data-type': 'rehyp' } };
72795
+ firstChild.properties = propertiesHandle(firstChild.properties, attr, properties);
72796
+ }
72797
+ }
72798
+ }
72799
+ }
72800
+ if (/^(em|strong|b|a|i|p|pre|kbd|blockquote|h(1|2|3|4|5|6)|code|table|img|del|ul|ol)$/.test(node.tagName) && parent && Array.isArray(parent.children) && typeof index === 'number') {
72801
+ const child = nextChild(parent.children, index, '', codeBlockParames);
72802
+ if (child) {
72803
+ const attr = getCommentObject(child);
72804
+ if (Object.keys(attr).length > 0) {
72805
+ node.properties = propertiesHandle(node.properties, attr, properties);
72806
+ }
72807
+ }
72808
+ }
72809
+ });
72810
+ };
72811
+ };
72812
+ /* harmony default export */ const rehype_attr_lib = (rehypeAttrs);
72813
+ //# sourceMappingURL=index.js.map
72814
+ ;// CONCATENATED MODULE: ../node_modules/@uiw/react-markdown-preview/esm/plugins/reservedMeta.js
72815
+
72816
+
72817
+ var reservedMeta = function reservedMeta(options) {
72818
+ if (options === void 0) {
72819
+ options = {};
72820
+ }
72821
+ return tree => {
72822
+ visit(tree, node => {
72823
+ if (node.type === 'element' && node.tagName === 'code' && node.data && node.data.meta) {
72824
+ node.properties = _extends({}, node.properties, {
72825
+ 'data-meta': String(node.data.meta)
72826
+ });
72827
+ }
72828
+ });
72829
+ };
72830
+ };
72831
+ ;// CONCATENATED MODULE: ../node_modules/github-slugger/regex.js
72832
+ // This module is generated by `script/`.
72833
+ /* eslint-disable no-control-regex, no-misleading-character-class, no-useless-escape */
72834
+ const regex_regex = /[\0-\x1F!-,\.\/:-@\[-\^`\{-\xA9\xAB-\xB4\xB6-\xB9\xBB-\xBF\xD7\xF7\u02C2-\u02C5\u02D2-\u02DF\u02E5-\u02EB\u02ED\u02EF-\u02FF\u0375\u0378\u0379\u037E\u0380-\u0385\u0387\u038B\u038D\u03A2\u03F6\u0482\u0530\u0557\u0558\u055A-\u055F\u0589-\u0590\u05BE\u05C0\u05C3\u05C6\u05C8-\u05CF\u05EB-\u05EE\u05F3-\u060F\u061B-\u061F\u066A-\u066D\u06D4\u06DD\u06DE\u06E9\u06FD\u06FE\u0700-\u070F\u074B\u074C\u07B2-\u07BF\u07F6-\u07F9\u07FB\u07FC\u07FE\u07FF\u082E-\u083F\u085C-\u085F\u086B-\u089F\u08B5\u08C8-\u08D2\u08E2\u0964\u0965\u0970\u0984\u098D\u098E\u0991\u0992\u09A9\u09B1\u09B3-\u09B5\u09BA\u09BB\u09C5\u09C6\u09C9\u09CA\u09CF-\u09D6\u09D8-\u09DB\u09DE\u09E4\u09E5\u09F2-\u09FB\u09FD\u09FF\u0A00\u0A04\u0A0B-\u0A0E\u0A11\u0A12\u0A29\u0A31\u0A34\u0A37\u0A3A\u0A3B\u0A3D\u0A43-\u0A46\u0A49\u0A4A\u0A4E-\u0A50\u0A52-\u0A58\u0A5D\u0A5F-\u0A65\u0A76-\u0A80\u0A84\u0A8E\u0A92\u0AA9\u0AB1\u0AB4\u0ABA\u0ABB\u0AC6\u0ACA\u0ACE\u0ACF\u0AD1-\u0ADF\u0AE4\u0AE5\u0AF0-\u0AF8\u0B00\u0B04\u0B0D\u0B0E\u0B11\u0B12\u0B29\u0B31\u0B34\u0B3A\u0B3B\u0B45\u0B46\u0B49\u0B4A\u0B4E-\u0B54\u0B58-\u0B5B\u0B5E\u0B64\u0B65\u0B70\u0B72-\u0B81\u0B84\u0B8B-\u0B8D\u0B91\u0B96-\u0B98\u0B9B\u0B9D\u0BA0-\u0BA2\u0BA5-\u0BA7\u0BAB-\u0BAD\u0BBA-\u0BBD\u0BC3-\u0BC5\u0BC9\u0BCE\u0BCF\u0BD1-\u0BD6\u0BD8-\u0BE5\u0BF0-\u0BFF\u0C0D\u0C11\u0C29\u0C3A-\u0C3C\u0C45\u0C49\u0C4E-\u0C54\u0C57\u0C5B-\u0C5F\u0C64\u0C65\u0C70-\u0C7F\u0C84\u0C8D\u0C91\u0CA9\u0CB4\u0CBA\u0CBB\u0CC5\u0CC9\u0CCE-\u0CD4\u0CD7-\u0CDD\u0CDF\u0CE4\u0CE5\u0CF0\u0CF3-\u0CFF\u0D0D\u0D11\u0D45\u0D49\u0D4F-\u0D53\u0D58-\u0D5E\u0D64\u0D65\u0D70-\u0D79\u0D80\u0D84\u0D97-\u0D99\u0DB2\u0DBC\u0DBE\u0DBF\u0DC7-\u0DC9\u0DCB-\u0DCE\u0DD5\u0DD7\u0DE0-\u0DE5\u0DF0\u0DF1\u0DF4-\u0E00\u0E3B-\u0E3F\u0E4F\u0E5A-\u0E80\u0E83\u0E85\u0E8B\u0EA4\u0EA6\u0EBE\u0EBF\u0EC5\u0EC7\u0ECE\u0ECF\u0EDA\u0EDB\u0EE0-\u0EFF\u0F01-\u0F17\u0F1A-\u0F1F\u0F2A-\u0F34\u0F36\u0F38\u0F3A-\u0F3D\u0F48\u0F6D-\u0F70\u0F85\u0F98\u0FBD-\u0FC5\u0FC7-\u0FFF\u104A-\u104F\u109E\u109F\u10C6\u10C8-\u10CC\u10CE\u10CF\u10FB\u1249\u124E\u124F\u1257\u1259\u125E\u125F\u1289\u128E\u128F\u12B1\u12B6\u12B7\u12BF\u12C1\u12C6\u12C7\u12D7\u1311\u1316\u1317\u135B\u135C\u1360-\u137F\u1390-\u139F\u13F6\u13F7\u13FE-\u1400\u166D\u166E\u1680\u169B-\u169F\u16EB-\u16ED\u16F9-\u16FF\u170D\u1715-\u171F\u1735-\u173F\u1754-\u175F\u176D\u1771\u1774-\u177F\u17D4-\u17D6\u17D8-\u17DB\u17DE\u17DF\u17EA-\u180A\u180E\u180F\u181A-\u181F\u1879-\u187F\u18AB-\u18AF\u18F6-\u18FF\u191F\u192C-\u192F\u193C-\u1945\u196E\u196F\u1975-\u197F\u19AC-\u19AF\u19CA-\u19CF\u19DA-\u19FF\u1A1C-\u1A1F\u1A5F\u1A7D\u1A7E\u1A8A-\u1A8F\u1A9A-\u1AA6\u1AA8-\u1AAF\u1AC1-\u1AFF\u1B4C-\u1B4F\u1B5A-\u1B6A\u1B74-\u1B7F\u1BF4-\u1BFF\u1C38-\u1C3F\u1C4A-\u1C4C\u1C7E\u1C7F\u1C89-\u1C8F\u1CBB\u1CBC\u1CC0-\u1CCF\u1CD3\u1CFB-\u1CFF\u1DFA\u1F16\u1F17\u1F1E\u1F1F\u1F46\u1F47\u1F4E\u1F4F\u1F58\u1F5A\u1F5C\u1F5E\u1F7E\u1F7F\u1FB5\u1FBD\u1FBF-\u1FC1\u1FC5\u1FCD-\u1FCF\u1FD4\u1FD5\u1FDC-\u1FDF\u1FED-\u1FF1\u1FF5\u1FFD-\u203E\u2041-\u2053\u2055-\u2070\u2072-\u207E\u2080-\u208F\u209D-\u20CF\u20F1-\u2101\u2103-\u2106\u2108\u2109\u2114\u2116-\u2118\u211E-\u2123\u2125\u2127\u2129\u212E\u213A\u213B\u2140-\u2144\u214A-\u214D\u214F-\u215F\u2189-\u24B5\u24EA-\u2BFF\u2C2F\u2C5F\u2CE5-\u2CEA\u2CF4-\u2CFF\u2D26\u2D28-\u2D2C\u2D2E\u2D2F\u2D68-\u2D6E\u2D70-\u2D7E\u2D97-\u2D9F\u2DA7\u2DAF\u2DB7\u2DBF\u2DC7\u2DCF\u2DD7\u2DDF\u2E00-\u2E2E\u2E30-\u3004\u3008-\u3020\u3030\u3036\u3037\u303D-\u3040\u3097\u3098\u309B\u309C\u30A0\u30FB\u3100-\u3104\u3130\u318F-\u319F\u31C0-\u31EF\u3200-\u33FF\u4DC0-\u4DFF\u9FFD-\u9FFF\uA48D-\uA4CF\uA4FE\uA4FF\uA60D-\uA60F\uA62C-\uA63F\uA673\uA67E\uA6F2-\uA716\uA720\uA721\uA789\uA78A\uA7C0\uA7C1\uA7CB-\uA7F4\uA828-\uA82B\uA82D-\uA83F\uA874-\uA87F\uA8C6-\uA8CF\uA8DA-\uA8DF\uA8F8-\uA8FA\uA8FC\uA92E\uA92F\uA954-\uA95F\uA97D-\uA97F\uA9C1-\uA9CE\uA9DA-\uA9DF\uA9FF\uAA37-\uAA3F\uAA4E\uAA4F\uAA5A-\uAA5F\uAA77-\uAA79\uAAC3-\uAADA\uAADE\uAADF\uAAF0\uAAF1\uAAF7-\uAB00\uAB07\uAB08\uAB0F\uAB10\uAB17-\uAB1F\uAB27\uAB2F\uAB5B\uAB6A-\uAB6F\uABEB\uABEE\uABEF\uABFA-\uABFF\uD7A4-\uD7AF\uD7C7-\uD7CA\uD7FC-\uD7FF\uE000-\uF8FF\uFA6E\uFA6F\uFADA-\uFAFF\uFB07-\uFB12\uFB18-\uFB1C\uFB29\uFB37\uFB3D\uFB3F\uFB42\uFB45\uFBB2-\uFBD2\uFD3E-\uFD4F\uFD90\uFD91\uFDC8-\uFDEF\uFDFC-\uFDFF\uFE10-\uFE1F\uFE30-\uFE32\uFE35-\uFE4C\uFE50-\uFE6F\uFE75\uFEFD-\uFF0F\uFF1A-\uFF20\uFF3B-\uFF3E\uFF40\uFF5B-\uFF65\uFFBF-\uFFC1\uFFC8\uFFC9\uFFD0\uFFD1\uFFD8\uFFD9\uFFDD-\uFFFF]|\uD800[\uDC0C\uDC27\uDC3B\uDC3E\uDC4E\uDC4F\uDC5E-\uDC7F\uDCFB-\uDD3F\uDD75-\uDDFC\uDDFE-\uDE7F\uDE9D-\uDE9F\uDED1-\uDEDF\uDEE1-\uDEFF\uDF20-\uDF2C\uDF4B-\uDF4F\uDF7B-\uDF7F\uDF9E\uDF9F\uDFC4-\uDFC7\uDFD0\uDFD6-\uDFFF]|\uD801[\uDC9E\uDC9F\uDCAA-\uDCAF\uDCD4-\uDCD7\uDCFC-\uDCFF\uDD28-\uDD2F\uDD64-\uDDFF\uDF37-\uDF3F\uDF56-\uDF5F\uDF68-\uDFFF]|\uD802[\uDC06\uDC07\uDC09\uDC36\uDC39-\uDC3B\uDC3D\uDC3E\uDC56-\uDC5F\uDC77-\uDC7F\uDC9F-\uDCDF\uDCF3\uDCF6-\uDCFF\uDD16-\uDD1F\uDD3A-\uDD7F\uDDB8-\uDDBD\uDDC0-\uDDFF\uDE04\uDE07-\uDE0B\uDE14\uDE18\uDE36\uDE37\uDE3B-\uDE3E\uDE40-\uDE5F\uDE7D-\uDE7F\uDE9D-\uDEBF\uDEC8\uDEE7-\uDEFF\uDF36-\uDF3F\uDF56-\uDF5F\uDF73-\uDF7F\uDF92-\uDFFF]|\uD803[\uDC49-\uDC7F\uDCB3-\uDCBF\uDCF3-\uDCFF\uDD28-\uDD2F\uDD3A-\uDE7F\uDEAA\uDEAD-\uDEAF\uDEB2-\uDEFF\uDF1D-\uDF26\uDF28-\uDF2F\uDF51-\uDFAF\uDFC5-\uDFDF\uDFF7-\uDFFF]|\uD804[\uDC47-\uDC65\uDC70-\uDC7E\uDCBB-\uDCCF\uDCE9-\uDCEF\uDCFA-\uDCFF\uDD35\uDD40-\uDD43\uDD48-\uDD4F\uDD74\uDD75\uDD77-\uDD7F\uDDC5-\uDDC8\uDDCD\uDDDB\uDDDD-\uDDFF\uDE12\uDE38-\uDE3D\uDE3F-\uDE7F\uDE87\uDE89\uDE8E\uDE9E\uDEA9-\uDEAF\uDEEB-\uDEEF\uDEFA-\uDEFF\uDF04\uDF0D\uDF0E\uDF11\uDF12\uDF29\uDF31\uDF34\uDF3A\uDF45\uDF46\uDF49\uDF4A\uDF4E\uDF4F\uDF51-\uDF56\uDF58-\uDF5C\uDF64\uDF65\uDF6D-\uDF6F\uDF75-\uDFFF]|\uD805[\uDC4B-\uDC4F\uDC5A-\uDC5D\uDC62-\uDC7F\uDCC6\uDCC8-\uDCCF\uDCDA-\uDD7F\uDDB6\uDDB7\uDDC1-\uDDD7\uDDDE-\uDDFF\uDE41-\uDE43\uDE45-\uDE4F\uDE5A-\uDE7F\uDEB9-\uDEBF\uDECA-\uDEFF\uDF1B\uDF1C\uDF2C-\uDF2F\uDF3A-\uDFFF]|\uD806[\uDC3B-\uDC9F\uDCEA-\uDCFE\uDD07\uDD08\uDD0A\uDD0B\uDD14\uDD17\uDD36\uDD39\uDD3A\uDD44-\uDD4F\uDD5A-\uDD9F\uDDA8\uDDA9\uDDD8\uDDD9\uDDE2\uDDE5-\uDDFF\uDE3F-\uDE46\uDE48-\uDE4F\uDE9A-\uDE9C\uDE9E-\uDEBF\uDEF9-\uDFFF]|\uD807[\uDC09\uDC37\uDC41-\uDC4F\uDC5A-\uDC71\uDC90\uDC91\uDCA8\uDCB7-\uDCFF\uDD07\uDD0A\uDD37-\uDD39\uDD3B\uDD3E\uDD48-\uDD4F\uDD5A-\uDD5F\uDD66\uDD69\uDD8F\uDD92\uDD99-\uDD9F\uDDAA-\uDEDF\uDEF7-\uDFAF\uDFB1-\uDFFF]|\uD808[\uDF9A-\uDFFF]|\uD809[\uDC6F-\uDC7F\uDD44-\uDFFF]|[\uD80A\uD80B\uD80E-\uD810\uD812-\uD819\uD824-\uD82B\uD82D\uD82E\uD830-\uD833\uD837\uD839\uD83D\uD83F\uD87B-\uD87D\uD87F\uD885-\uDB3F\uDB41-\uDBFF][\uDC00-\uDFFF]|\uD80D[\uDC2F-\uDFFF]|\uD811[\uDE47-\uDFFF]|\uD81A[\uDE39-\uDE3F\uDE5F\uDE6A-\uDECF\uDEEE\uDEEF\uDEF5-\uDEFF\uDF37-\uDF3F\uDF44-\uDF4F\uDF5A-\uDF62\uDF78-\uDF7C\uDF90-\uDFFF]|\uD81B[\uDC00-\uDE3F\uDE80-\uDEFF\uDF4B-\uDF4E\uDF88-\uDF8E\uDFA0-\uDFDF\uDFE2\uDFE5-\uDFEF\uDFF2-\uDFFF]|\uD821[\uDFF8-\uDFFF]|\uD823[\uDCD6-\uDCFF\uDD09-\uDFFF]|\uD82C[\uDD1F-\uDD4F\uDD53-\uDD63\uDD68-\uDD6F\uDEFC-\uDFFF]|\uD82F[\uDC6B-\uDC6F\uDC7D-\uDC7F\uDC89-\uDC8F\uDC9A-\uDC9C\uDC9F-\uDFFF]|\uD834[\uDC00-\uDD64\uDD6A-\uDD6C\uDD73-\uDD7A\uDD83\uDD84\uDD8C-\uDDA9\uDDAE-\uDE41\uDE45-\uDFFF]|\uD835[\uDC55\uDC9D\uDCA0\uDCA1\uDCA3\uDCA4\uDCA7\uDCA8\uDCAD\uDCBA\uDCBC\uDCC4\uDD06\uDD0B\uDD0C\uDD15\uDD1D\uDD3A\uDD3F\uDD45\uDD47-\uDD49\uDD51\uDEA6\uDEA7\uDEC1\uDEDB\uDEFB\uDF15\uDF35\uDF4F\uDF6F\uDF89\uDFA9\uDFC3\uDFCC\uDFCD]|\uD836[\uDC00-\uDDFF\uDE37-\uDE3A\uDE6D-\uDE74\uDE76-\uDE83\uDE85-\uDE9A\uDEA0\uDEB0-\uDFFF]|\uD838[\uDC07\uDC19\uDC1A\uDC22\uDC25\uDC2B-\uDCFF\uDD2D-\uDD2F\uDD3E\uDD3F\uDD4A-\uDD4D\uDD4F-\uDEBF\uDEFA-\uDFFF]|\uD83A[\uDCC5-\uDCCF\uDCD7-\uDCFF\uDD4C-\uDD4F\uDD5A-\uDFFF]|\uD83B[\uDC00-\uDDFF\uDE04\uDE20\uDE23\uDE25\uDE26\uDE28\uDE33\uDE38\uDE3A\uDE3C-\uDE41\uDE43-\uDE46\uDE48\uDE4A\uDE4C\uDE50\uDE53\uDE55\uDE56\uDE58\uDE5A\uDE5C\uDE5E\uDE60\uDE63\uDE65\uDE66\uDE6B\uDE73\uDE78\uDE7D\uDE7F\uDE8A\uDE9C-\uDEA0\uDEA4\uDEAA\uDEBC-\uDFFF]|\uD83C[\uDC00-\uDD2F\uDD4A-\uDD4F\uDD6A-\uDD6F\uDD8A-\uDFFF]|\uD83E[\uDC00-\uDFEF\uDFFA-\uDFFF]|\uD869[\uDEDE-\uDEFF]|\uD86D[\uDF35-\uDF3F]|\uD86E[\uDC1E\uDC1F]|\uD873[\uDEA2-\uDEAF]|\uD87A[\uDFE1-\uDFFF]|\uD87E[\uDE1E-\uDFFF]|\uD884[\uDF4B-\uDFFF]|\uDB40[\uDC00-\uDCFF\uDDF0-\uDFFF]/g
72835
+
72836
+ ;// CONCATENATED MODULE: ../node_modules/github-slugger/index.js
72837
+
72838
+
72839
+ const github_slugger_own = Object.hasOwnProperty
72732
72840
 
72733
72841
  /**
72734
- * Check whether an element matches a `:root` pseudo.
72735
- *
72736
- * @param {RulePseudo} _
72737
- * @param {Element} element
72738
- * @param {number | undefined} _1
72739
- * @param {Parent | undefined} parent
72740
- * @param {SelectState} state
72741
- * @returns {boolean}
72842
+ * Slugger.
72742
72843
  */
72743
- function pseudo_root(_, element, _1, parent, state) {
72744
- return Boolean(
72745
- (!parent || parent.type === 'root') &&
72746
- state.schema &&
72747
- (state.schema.space === 'html' || state.schema.space === 'svg') &&
72748
- (element.tagName === 'html' || element.tagName === 'svg')
72749
- )
72844
+ class BananaSlug {
72845
+ /**
72846
+ * Create a new slug class.
72847
+ */
72848
+ constructor () {
72849
+ /** @type {Record<string, number>} */
72850
+ // eslint-disable-next-line no-unused-expressions
72851
+ this.occurrences
72852
+
72853
+ this.reset()
72854
+ }
72855
+
72856
+ /**
72857
+ * Generate a unique slug.
72858
+ *
72859
+ * Tracks previously generated slugs: repeated calls with the same value
72860
+ * will result in different slugs.
72861
+ * Use the `slug` function to get same slugs.
72862
+ *
72863
+ * @param {string} value
72864
+ * String of text to slugify
72865
+ * @param {boolean} [maintainCase=false]
72866
+ * Keep the current case, otherwise make all lowercase
72867
+ * @return {string}
72868
+ * A unique slug string
72869
+ */
72870
+ slug (value, maintainCase) {
72871
+ const self = this
72872
+ let result = slug(value, maintainCase === true)
72873
+ const originalSlug = result
72874
+
72875
+ while (github_slugger_own.call(self.occurrences, result)) {
72876
+ self.occurrences[originalSlug]++
72877
+ result = originalSlug + '-' + self.occurrences[originalSlug]
72878
+ }
72879
+
72880
+ self.occurrences[result] = 0
72881
+
72882
+ return result
72883
+ }
72884
+
72885
+ /**
72886
+ * Reset - Forget all previous slugs
72887
+ *
72888
+ * @return void
72889
+ */
72890
+ reset () {
72891
+ this.occurrences = Object.create(null)
72892
+ }
72750
72893
  }
72751
72894
 
72752
72895
  /**
72753
- * Check whether an element matches a `:scope` pseudo.
72896
+ * Generate a slug.
72754
72897
  *
72755
- * @param {RulePseudo} _
72756
- * @param {Element} element
72757
- * @param {number | undefined} _1
72758
- * @param {Parent | undefined} _2
72759
- * @param {SelectState} state
72760
- * @returns {boolean}
72898
+ * Does not track previously generated slugs: repeated calls with the same value
72899
+ * will result in the exact same slug.
72900
+ * Use the `GithubSlugger` class to get unique slugs.
72901
+ *
72902
+ * @param {string} value
72903
+ * String of text to slugify
72904
+ * @param {boolean} [maintainCase=false]
72905
+ * Keep the current case, otherwise make all lowercase
72906
+ * @return {string}
72907
+ * A unique slug string
72761
72908
  */
72762
- function scope(_, element, _1, _2, state) {
72763
- return state.scopeElements.includes(element)
72764
- }
72765
-
72766
- // Shouldn’t be called, parser gives correct data.
72767
- /* c8 ignore next 3 */
72768
- function invalidPseudo() {
72769
- throw new Error('Invalid pseudo-selector')
72909
+ function slug (value, maintainCase) {
72910
+ if (typeof value !== 'string') return ''
72911
+ if (!maintainCase) value = value.toLowerCase()
72912
+ return value.replace(regex_regex, '').replace(/ /g, '-')
72770
72913
  }
72771
72914
 
72915
+ ;// CONCATENATED MODULE: ../node_modules/hast-util-heading-rank/lib/index.js
72772
72916
  /**
72773
- * @param {unknown} query
72774
- * @returns {never}
72917
+ * @typedef {import('hast').Root} Root
72918
+ * @typedef {import('hast').Content} Content
72775
72919
  */
72776
- function unknownPseudo(query) {
72777
- // @ts-expect-error: indexable.
72778
- if (query.name) {
72779
- // @ts-expect-error: indexable.
72780
- throw new Error('Unknown pseudo-selector `' + query.name + '`')
72781
- }
72782
-
72783
- throw new Error('Unexpected pseudo-element or empty pseudo-class')
72784
- }
72785
72920
 
72786
72921
  /**
72787
- * Check children.
72788
- *
72789
- * @param {Element} element
72790
- * @param {(child: ElementChild) => boolean} check
72791
- * @returns {boolean}
72922
+ * @typedef {Root | Content} Node
72792
72923
  */
72793
- function someChildren(element, check) {
72794
- const children = element.children
72795
- let index = -1
72796
-
72797
- while (++index < children.length) {
72798
- if (check(children[index])) return true
72799
- }
72800
-
72801
- return false
72802
- }
72803
72924
 
72925
+ // To do next major: return `undefined`.
72804
72926
  /**
72805
- * @param {SelectState} state
72806
- * @param {RulePseudo} query
72927
+ * Get the rank (`1` to `6`) of headings (`h1` to `h6`).
72928
+ *
72929
+ * @param {Node} node
72930
+ * Node to check.
72931
+ * @returns {number | null}
72932
+ * Rank of the heading or `null` if not a heading.
72807
72933
  */
72808
- function assertDeep(state, query) {
72809
- if (state.shallow) {
72810
- throw new Error('Cannot use `:' + query.name + '` without parent')
72811
- }
72934
+ function headingRank(node) {
72935
+ const name =
72936
+ (node && node.type === 'element' && node.tagName.toLowerCase()) || ''
72937
+ const code =
72938
+ name.length === 2 && name.charCodeAt(0) === 104 /* `h` */
72939
+ ? name.charCodeAt(1)
72940
+ : 0
72941
+ return code > 48 /* `0` */ && code < 55 /* `7` */ ? code - 48 /* `0` */ : null
72812
72942
  }
72813
72943
 
72944
+ ;// CONCATENATED MODULE: ../node_modules/rehype-slug/index.js
72814
72945
  /**
72815
- * @param {RulePseudo} query
72816
- * @returns {(value: number) => boolean}
72946
+ * @typedef {import('hast').Root} Root
72817
72947
  */
72818
- function getCachedNthCheck(query) {
72819
- /** @type {(value: number) => boolean} */
72820
- // @ts-expect-error: cache.
72821
- let fn = query._cachedFn
72822
-
72823
- if (!fn) {
72824
- // @ts-expect-error: always string.
72825
- fn = pseudo_nthCheck(query.value)
72826
- // @ts-expect-error: cache.
72827
- query._cachedFn = fn
72828
- }
72829
-
72830
- return fn
72831
- }
72832
72948
 
72833
- ;// CONCATENATED MODULE: ../node_modules/hast-util-select/lib/test.js
72834
72949
  /**
72835
- * @typedef {import('./types.js').Rule} Rule
72836
- * @typedef {import('./types.js').Element} Element
72837
- * @typedef {import('./types.js').Parent} Parent
72838
- * @typedef {import('./types.js').SelectState} SelectState
72950
+ * @typedef Options
72951
+ * Configuration (optional).
72952
+ * @property {string} [prefix='']
72953
+ * Prefix to add in front of `id`s.
72839
72954
  */
72840
72955
 
72841
72956
 
@@ -72844,505 +72959,519 @@ function getCachedNthCheck(query) {
72844
72959
 
72845
72960
 
72846
72961
 
72962
+ const slugs = new BananaSlug()
72963
+
72847
72964
  /**
72848
- * Test a rule.
72965
+ * Plugin to add `id`s to headings.
72849
72966
  *
72850
- * @param {Rule} query
72851
- * @param {Element} element
72852
- * @param {number | undefined} index
72853
- * @param {Parent | undefined} parent
72854
- * @param {SelectState} state
72855
- * @returns {boolean}
72967
+ * @type {import('unified').Plugin<[Options?]|Array<void>, Root>}
72856
72968
  */
72857
- function test(query, element, index, parent, state) {
72858
- return Boolean(
72859
- (!query.tagName || name_name(query, element)) &&
72860
- (!query.classNames || className(query, element)) &&
72861
- (!query.id || id(query, element)) &&
72862
- (!query.attrs || attribute(query, element, state.schema)) &&
72863
- (!query.pseudos || pseudo(query, element, index, parent, state))
72864
- )
72969
+ function rehypeSlug(options = {}) {
72970
+ const prefix = options.prefix || ''
72971
+
72972
+ return (tree) => {
72973
+ slugs.reset()
72974
+
72975
+ visit(tree, 'element', (node) => {
72976
+ if (headingRank(node) && node.properties && !hasProperty(node, 'id')) {
72977
+ node.properties.id = prefix + slugs.slug(hast_util_to_string_toString(node))
72978
+ }
72979
+ })
72980
+ }
72865
72981
  }
72866
72982
 
72867
- ;// CONCATENATED MODULE: ../node_modules/hast-util-select/lib/walk.js
72983
+ ;// CONCATENATED MODULE: ../node_modules/hast-util-is-element/index.js
72868
72984
  /**
72869
- * @typedef {import('./types.js').Node} Node
72870
- * @typedef {import('./types.js').Element} Element
72871
- * @typedef {import('./types.js').Parent} Parent
72872
- * @typedef {import('./types.js').RuleSet} RuleSet
72873
- * @typedef {import('./types.js').SelectState} SelectState
72874
- * @typedef {import('./types.js').Selectors} Selectors
72875
- *
72876
- * @typedef Nest
72877
- * Rule sets by nesting.
72878
- * @property {Array<RuleSet> | undefined} descendant
72879
- * `a b`
72880
- * @property {Array<RuleSet> | undefined} directChild
72881
- * `a > b`
72882
- * @property {Array<RuleSet> | undefined} adjacentSibling
72883
- * `a + b`
72884
- * @property {Array<RuleSet> | undefined} generalSibling
72885
- * `a ~ b`
72886
- *
72887
- * @typedef Counts
72888
- * Info on elements in a parent.
72889
- * @property {number} count
72890
- * Number of elements.
72891
- * @property {Map<string, number>} types
72892
- * Number of elements by tag name.
72985
+ * @typedef {import('unist').Parent} Parent
72986
+ * @typedef {import('hast').Element} Element
72893
72987
  */
72894
72988
 
72989
+ /**
72990
+ * @typedef {null | undefined | string | TestFunctionAnything | Array<string | TestFunctionAnything>} Test
72991
+ * Check for an arbitrary element, unaware of TypeScript inferral.
72992
+ *
72993
+ * @callback TestFunctionAnything
72994
+ * Check if an element passes a test, unaware of TypeScript inferral.
72995
+ * @param {Element} element
72996
+ * An element.
72997
+ * @param {number | null | undefined} [index]
72998
+ * The element’s position in its parent.
72999
+ * @param {Parent | null | undefined} [parent]
73000
+ * The element’s parent.
73001
+ * @returns {boolean | void}
73002
+ * Whether this element passes the test.
73003
+ */
72895
73004
 
72896
-
72897
-
72898
- /** @type {Array<never>} */
72899
- const walk_empty = []
73005
+ /**
73006
+ * @template {Element} T
73007
+ * Element type.
73008
+ * @typedef {T['tagName'] | TestFunctionPredicate<T> | Array<T['tagName'] | TestFunctionPredicate<T>>} PredicateTest
73009
+ * Check for an element that can be inferred by TypeScript.
73010
+ */
72900
73011
 
72901
73012
  /**
72902
- * Turn a query into a uniform object.
73013
+ * Check if an element passes a certain node test.
72903
73014
  *
72904
- * @param {Selectors | RuleSet | null} query
72905
- * @returns {Selectors}
73015
+ * @template {Element} T
73016
+ * Element type.
73017
+ * @callback TestFunctionPredicate
73018
+ * Complex test function for an element that can be inferred by TypeScript.
73019
+ * @param {Element} element
73020
+ * An element.
73021
+ * @param {number | null | undefined} [index]
73022
+ * The element’s position in its parent.
73023
+ * @param {Parent | null | undefined} [parent]
73024
+ * The element’s parent.
73025
+ * @returns {element is T}
73026
+ * Whether this element passes the test.
72906
73027
  */
72907
- function queryToSelectors(query) {
72908
- if (query === null) {
72909
- return {type: 'selectors', selectors: []}
72910
- }
72911
-
72912
- if (query.type === 'ruleSet') {
72913
- return {type: 'selectors', selectors: [query]}
72914
- }
72915
73028
 
72916
- return query
72917
- }
73029
+ /**
73030
+ * @callback AssertAnything
73031
+ * Check that an arbitrary value is an element, unaware of TypeScript inferral.
73032
+ * @param {unknown} [node]
73033
+ * Anything (typically a node).
73034
+ * @param {number | null | undefined} [index]
73035
+ * The node’s position in its parent.
73036
+ * @param {Parent | null | undefined} [parent]
73037
+ * The node’s parent.
73038
+ * @returns {boolean}
73039
+ * Whether this is an element and passes a test.
73040
+ */
72918
73041
 
72919
73042
  /**
72920
- * Walk a tree.
73043
+ * Check if a node is an element and passes a certain node test
72921
73044
  *
72922
- * @param {SelectState} state
72923
- * @param {Node | undefined} tree
73045
+ * @template {Element} T
73046
+ * Element type.
73047
+ * @callback AssertPredicate
73048
+ * Check that an arbitrary value is a specific element, aware of TypeScript.
73049
+ * @param {unknown} [node]
73050
+ * Anything (typically a node).
73051
+ * @param {number | null | undefined} [index]
73052
+ * The node’s position in its parent.
73053
+ * @param {Parent | null | undefined} [parent]
73054
+ * The node’s parent.
73055
+ * @returns {node is T}
73056
+ * Whether this is an element and passes a test.
72924
73057
  */
72925
- function walk_walk(state, tree) {
72926
- if (tree) {
72927
- walk_one(state, [], tree, undefined, undefined)
72928
- }
72929
- }
72930
73058
 
72931
73059
  /**
72932
- * Check a node.
73060
+ * Check if `node` is an `Element` and whether it passes the given test.
72933
73061
  *
72934
- * @param {SelectState} state
72935
- * @param {Array<RuleSet>} currentRules
72936
- * @param {Node} node
72937
- * @param {number | undefined} index
72938
- * @param {Parent | undefined} parent
72939
- * @returns {Nest}
73062
+ * @param node
73063
+ * Thing to check, typically `Node`.
73064
+ * @param test
73065
+ * A check for a specific element.
73066
+ * @param index
73067
+ * The node’s position in its parent.
73068
+ * @param parent
73069
+ * The node’s parent.
73070
+ * @returns
73071
+ * Whether `node` is an element and passes a test.
72940
73072
  */
72941
- function walk_one(state, currentRules, node, index, parent) {
72942
- /** @type {Nest} */
72943
- let nestResult = {
72944
- directChild: undefined,
72945
- descendant: undefined,
72946
- adjacentSibling: undefined,
72947
- generalSibling: undefined
72948
- }
72949
- const exit = enterState(state, node)
73073
+ const isElement =
73074
+ /**
73075
+ * @type {(
73076
+ * (() => false) &
73077
+ * (<T extends Element = Element>(node: unknown, test?: PredicateTest<T>, index?: number, parent?: Parent, context?: unknown) => node is T) &
73078
+ * ((node: unknown, test: Test, index?: number, parent?: Parent, context?: unknown) => boolean)
73079
+ * )}
73080
+ */
73081
+ (
73082
+ /**
73083
+ * @param {unknown} [node]
73084
+ * @param {Test | undefined} [test]
73085
+ * @param {number | null | undefined} [index]
73086
+ * @param {Parent | null | undefined} [parent]
73087
+ * @param {unknown} [context]
73088
+ * @returns {boolean}
73089
+ */
73090
+ // eslint-disable-next-line max-params
73091
+ function (node, test, index, parent, context) {
73092
+ const check = convertElement(test)
72950
73093
 
72951
- if (node.type === 'element') {
72952
- nestResult = applySelectors(
72953
- state,
72954
- // Try the root rules for this element too.
72955
- combine(currentRules, state.rootQuery.selectors),
72956
- node,
72957
- index,
72958
- parent
72959
- )
72960
- }
73094
+ if (
73095
+ index !== undefined &&
73096
+ index !== null &&
73097
+ (typeof index !== 'number' ||
73098
+ index < 0 ||
73099
+ index === Number.POSITIVE_INFINITY)
73100
+ ) {
73101
+ throw new Error('Expected positive finite index for child node')
73102
+ }
72961
73103
 
72962
- // If this is a parent, and we want to delve into them, and we haven’t found
72963
- // our single result yet.
72964
- if ('children' in node && !state.shallow && !(state.one && state.found)) {
72965
- walk_all(state, nestResult, node)
72966
- }
73104
+ if (
73105
+ parent !== undefined &&
73106
+ parent !== null &&
73107
+ (!parent.type || !parent.children)
73108
+ ) {
73109
+ throw new Error('Expected parent node')
73110
+ }
72967
73111
 
72968
- exit()
73112
+ // @ts-expect-error Looks like a node.
73113
+ if (!node || !node.type || typeof node.type !== 'string') {
73114
+ return false
73115
+ }
72969
73116
 
72970
- return nestResult
72971
- }
73117
+ if (
73118
+ (parent === undefined || parent === null) !==
73119
+ (index === undefined || index === null)
73120
+ ) {
73121
+ throw new Error('Expected both parent and index')
73122
+ }
73123
+
73124
+ return check.call(context, node, index, parent)
73125
+ }
73126
+ )
72972
73127
 
72973
73128
  /**
72974
- * Check a node.
73129
+ * Generate an assertion from a test.
72975
73130
  *
72976
- * @param {SelectState} state
72977
- * @param {Nest} nest
72978
- * @param {Parent} node
72979
- * @returns {void}
73131
+ * Useful if you’re going to test many nodes, for example when creating a
73132
+ * utility where something else passes a compatible test.
73133
+ *
73134
+ * The created function is a bit faster because it expects valid input only:
73135
+ * a `node`, `index`, and `parent`.
73136
+ *
73137
+ * @param test
73138
+ * * When nullish, checks if `node` is an `Element`.
73139
+ * * When `string`, works like passing `(element) => element.tagName === test`.
73140
+ * * When `function` checks if function passed the element is true.
73141
+ * * When `array`, checks any one of the subtests pass.
73142
+ * @returns
73143
+ * An assertion.
72980
73144
  */
72981
- function walk_all(state, nest, node) {
72982
- const fromParent = combine(nest.descendant, nest.directChild)
72983
- /** @type {Array<RuleSet> | undefined} */
72984
- let fromSibling
72985
- let index = -1
72986
- /**
72987
- * Total counts.
72988
- * @type {Counts}
72989
- */
72990
- const total = {count: 0, types: new Map()}
73145
+ const convertElement =
72991
73146
  /**
72992
- * Counts of previous siblings.
72993
- * @type {Counts}
73147
+ * @type {(
73148
+ * (<T extends Element>(test: T['tagName'] | TestFunctionPredicate<T>) => AssertPredicate<T>) &
73149
+ * ((test?: Test) => AssertAnything)
73150
+ * )}
72994
73151
  */
72995
- const before = {count: 0, types: new Map()}
72996
-
72997
- while (++index < node.children.length) {
72998
- count(total, node.children[index])
72999
- }
73152
+ (
73153
+ /**
73154
+ * @param {Test | null | undefined} [test]
73155
+ * @returns {AssertAnything}
73156
+ */
73157
+ function (test) {
73158
+ if (test === undefined || test === null) {
73159
+ return hast_util_is_element_element
73160
+ }
73000
73161
 
73001
- index = -1
73162
+ if (typeof test === 'string') {
73163
+ return tagNameFactory(test)
73164
+ }
73002
73165
 
73003
- while (++index < node.children.length) {
73004
- const child = node.children[index]
73005
- // Uppercase to prevent prototype polution, injecting `constructor` or so.
73006
- // Normalize because HTML is insensitive.
73007
- const name =
73008
- child.type === 'element' ? child.tagName.toUpperCase() : undefined
73009
- // Before counting further elements:
73010
- state.elementIndex = before.count
73011
- state.typeIndex = name ? before.types.get(name) || 0 : 0
73012
- // After counting all elements.
73013
- state.elementCount = total.count
73014
- state.typeCount = name ? total.types.get(name) : 0
73166
+ if (typeof test === 'object') {
73167
+ return hast_util_is_element_anyFactory(test)
73168
+ }
73015
73169
 
73016
- // Only apply if this is a parent, this should be an element, but we check
73017
- // for parents so that we delve into custom nodes too.
73018
- if ('children' in child) {
73019
- const forSibling = combine(fromParent, fromSibling)
73020
- const nest = walk_one(state, forSibling, node.children[index], index, node)
73021
- fromSibling = combine(nest.generalSibling, nest.adjacentSibling)
73022
- }
73170
+ if (typeof test === 'function') {
73171
+ return hast_util_is_element_castFactory(test)
73172
+ }
73023
73173
 
73024
- // We found one thing, and one is enough.
73025
- if (state.one && state.found) {
73026
- break
73174
+ throw new Error('Expected function, string, or array as test')
73027
73175
  }
73028
-
73029
- count(before, node.children[index])
73030
- }
73031
- }
73176
+ )
73032
73177
 
73033
73178
  /**
73034
- * Apply selectors to an element.
73179
+ * Handle multiple tests.
73035
73180
  *
73036
- * @param {SelectState} state
73037
- * Current state.
73038
- * @param {Array<RuleSet>} rules
73039
- * Rules to apply.
73040
- * @param {Element} node
73041
- * Element to apply rules to.
73042
- * @param {number | undefined} index
73043
- * Index of node in parent.
73044
- * @param {Parent | undefined} parent
73045
- * Parent of node.
73046
- * @returns {Nest}
73047
- * Further rules.
73181
+ * @param {Array<string | TestFunctionAnything>} tests
73182
+ * @returns {AssertAnything}
73048
73183
  */
73049
- function applySelectors(state, rules, node, index, parent) {
73050
- /** @type {Nest} */
73051
- const nestResult = {
73052
- directChild: undefined,
73053
- descendant: undefined,
73054
- adjacentSibling: undefined,
73055
- generalSibling: undefined
73056
- }
73057
- let selectorIndex = -1
73058
-
73059
- while (++selectorIndex < rules.length) {
73060
- const ruleSet = rules[selectorIndex]
73061
-
73062
- // We found one thing, and one is enough.
73063
- if (state.one && state.found) {
73064
- break
73065
- }
73184
+ function hast_util_is_element_anyFactory(tests) {
73185
+ /** @type {Array<AssertAnything>} */
73186
+ const checks = []
73187
+ let index = -1
73066
73188
 
73067
- // When shallow, we don’t allow nested rules.
73068
- // Idea: we could allow a stack of parents?
73069
- // Might get quite complex though.
73070
- if (state.shallow && ruleSet.rule.rule) {
73071
- throw new Error('Expected selector without nesting')
73072
- }
73189
+ while (++index < tests.length) {
73190
+ checks[index] = convertElement(tests[index])
73191
+ }
73073
73192
 
73074
- // If this rule matches:
73075
- if (test(ruleSet.rule, node, index, parent, state)) {
73076
- const nest = ruleSet.rule.rule
73193
+ return hast_util_is_element_castFactory(any)
73077
73194
 
73078
- // Are there more?
73079
- if (nest) {
73080
- /** @type {RuleSet} */
73081
- const rule = {type: 'ruleSet', rule: nest}
73082
- /** @type {keyof Nest} */
73083
- const label =
73084
- nest.nestingOperator === '+'
73085
- ? 'adjacentSibling'
73086
- : nest.nestingOperator === '~'
73087
- ? 'generalSibling'
73088
- : nest.nestingOperator === '>'
73089
- ? 'directChild'
73090
- : 'descendant'
73091
- add(nestResult, label, rule)
73092
- } else {
73093
- // We have a match!
73094
- state.found = true
73195
+ /**
73196
+ * @this {unknown}
73197
+ * @param {Array<unknown>} parameters
73198
+ * @returns {boolean}
73199
+ */
73200
+ function any(...parameters) {
73201
+ let index = -1
73095
73202
 
73096
- if (!state.results.includes(node)) {
73097
- state.results.push(node)
73098
- }
73203
+ while (++index < checks.length) {
73204
+ if (checks[index].call(this, ...parameters)) {
73205
+ return true
73099
73206
  }
73100
73207
  }
73101
73208
 
73102
- // Descendant.
73103
- if (ruleSet.rule.nestingOperator === null) {
73104
- add(nestResult, 'descendant', ruleSet)
73105
- }
73106
- // Adjacent.
73107
- else if (ruleSet.rule.nestingOperator === '~') {
73108
- add(nestResult, 'generalSibling', ruleSet)
73109
- }
73110
- // Drop top-level nesting (`undefined`), direct child (`>`), adjacent sibling (`+`).
73209
+ return false
73111
73210
  }
73211
+ }
73112
73212
 
73113
- return nestResult
73213
+ /**
73214
+ * Turn a string into a test for an element with a certain tag name.
73215
+ *
73216
+ * @param {string} check
73217
+ * @returns {AssertAnything}
73218
+ */
73219
+ function tagNameFactory(check) {
73220
+ return tagName
73221
+
73222
+ /**
73223
+ * @param {unknown} node
73224
+ * @returns {boolean}
73225
+ */
73226
+ function tagName(node) {
73227
+ return hast_util_is_element_element(node) && node.tagName === check
73228
+ }
73114
73229
  }
73115
73230
 
73116
73231
  /**
73117
- * Combine two lists, if needed.
73118
- *
73119
- * This is optimized to create as few lists as possible.
73232
+ * Turn a custom test into a test for an element that passes that test.
73120
73233
  *
73121
- * @param {Array<RuleSet> | undefined} left
73122
- * @param {Array<RuleSet> | undefined} right
73123
- * @returns {Array<RuleSet>}
73234
+ * @param {TestFunctionAnything} check
73235
+ * @returns {AssertAnything}
73124
73236
  */
73125
- function combine(left, right) {
73126
- return left && right && left.length > 0 && right.length > 0
73127
- ? [...left, ...right]
73128
- : left && left.length > 0
73129
- ? left
73130
- : right && right.length > 0
73131
- ? right
73132
- : walk_empty
73237
+ function hast_util_is_element_castFactory(check) {
73238
+ return assertion
73239
+
73240
+ /**
73241
+ * @this {unknown}
73242
+ * @param {unknown} node
73243
+ * @param {Array<unknown>} parameters
73244
+ * @returns {boolean}
73245
+ */
73246
+ function assertion(node, ...parameters) {
73247
+ // @ts-expect-error: fine.
73248
+ return hast_util_is_element_element(node) && Boolean(check.call(this, node, ...parameters))
73249
+ }
73133
73250
  }
73134
73251
 
73135
73252
  /**
73136
- * Add a rule to a nesting map.
73253
+ * Make sure something is an element.
73137
73254
  *
73138
- * @param {Nest} nest
73139
- * @param {keyof Nest} field
73140
- * @param {RuleSet} rule
73255
+ * @param {unknown} node
73256
+ * @returns {node is Element}
73141
73257
  */
73142
- function add(nest, field, rule) {
73143
- const list = nest[field]
73144
- if (list) {
73145
- list.push(rule)
73146
- } else {
73147
- nest[field] = [rule]
73148
- }
73258
+ function hast_util_is_element_element(node) {
73259
+ return Boolean(
73260
+ node &&
73261
+ typeof node === 'object' &&
73262
+ // @ts-expect-error Looks like a node.
73263
+ node.type === 'element' &&
73264
+ // @ts-expect-error Looks like an element.
73265
+ typeof node.tagName === 'string'
73266
+ )
73149
73267
  }
73150
73268
 
73269
+ ;// CONCATENATED MODULE: ../node_modules/rehype-autolink-headings/lib/index.js
73151
73270
  /**
73152
- * Count a node.
73271
+ * @typedef {import('hast').Root} Root
73272
+ * @typedef {import('hast').Parent} Parent
73273
+ * @typedef {import('hast').Element} Element
73274
+ * @typedef {Element['children'][number]} ElementChild
73275
+ * @typedef {import('hast').Properties} Properties
73276
+ * @typedef {import('hast-util-is-element').Test} Test
73153
73277
  *
73154
- * @param {Counts} counts
73155
- * Counts.
73156
- * @param {Node} node
73157
- * Node (we’re looking for elements).
73158
- * @returns {void}
73159
- * Nothing.
73278
+ * @typedef {'prepend'|'append'|'wrap'|'before'|'after'} Behavior
73279
+ *
73280
+ * @callback Build
73281
+ * @param {Element} node
73282
+ * @returns {ElementChild|ElementChild[]}
73283
+ *
73284
+ * @typedef Options
73285
+ * Configuration.
73286
+ * @property {Behavior} [behavior='prepend']
73287
+ * How to create links.
73288
+ * @property {Behavior} [behaviour]
73289
+ * Please use `behavior` instead
73290
+ * @property {Properties} [properties]
73291
+ * Extra properties to set on the link when injecting.
73292
+ * Defaults to `{ariaHidden: true, tabIndex: -1}` when `'prepend'` or
73293
+ * `'append'`.
73294
+ * @property {ElementChild|ElementChild[]|Build} [content={type: 'element', tagName: 'span', properties: {className: ['icon', 'icon-link']}, children: []}]
73295
+ * hast nodes to insert in the link.
73296
+ * @property {ElementChild|ElementChild[]|Build} [group]
73297
+ * hast node to wrap the heading and link with, if `behavior` is `'before'` or
73298
+ * `'after'`.
73299
+ * There is no default.
73300
+ * @property {Test} [test]
73301
+ * Test to define which heading elements are linked.
73302
+ * Any test that can be given to `hast-util-is-element` is supported.
73303
+ * The default (no test) is to link all headings.
73304
+ * Can be used to link only h1-h3, or for example all except h1.
73160
73305
  */
73161
- function count(counts, node) {
73162
- if (node.type === 'element') {
73163
- // Uppercase to prevent prototype polution, injecting `constructor` or so.
73164
- // Normalize because HTML is insensitive.
73165
- const name = node.tagName.toUpperCase()
73166
- const count = (counts.types.get(name) || 0) + 1
73167
- counts.count++
73168
- counts.types.set(name, count)
73169
- }
73306
+
73307
+
73308
+
73309
+
73310
+
73311
+
73312
+
73313
+ /** @type {Element} */
73314
+ const contentDefaults = {
73315
+ type: 'element',
73316
+ tagName: 'span',
73317
+ properties: {className: ['icon', 'icon-link']},
73318
+ children: []
73170
73319
  }
73171
73320
 
73172
- // EXTERNAL MODULE: ../node_modules/css-selector-parser/lib/index.js
73173
- var css_selector_parser_lib = __webpack_require__(301);
73174
- ;// CONCATENATED MODULE: ../node_modules/hast-util-select/lib/parse.js
73175
73321
  /**
73176
- * @typedef {import('./types.js').Selectors} Selectors
73177
- * @typedef {import('./types.js').RuleSet} RuleSet
73322
+ * Plugin to automatically add links to headings (h1-h6).
73323
+ *
73324
+ * @type {import('unified').Plugin<[Options?]|void[], Root>}
73178
73325
  */
73326
+ function rehypeAutolinkHeadings(options = {}) {
73327
+ let props = options.properties
73328
+ const behavior = options.behaviour || options.behavior || 'prepend'
73329
+ const content = options.content || contentDefaults
73330
+ const group = options.group
73331
+ const is = convertElement(options.test)
73179
73332
 
73333
+ /** @type {import('unist-util-visit/complex-types').Visitor<Element>} */
73334
+ let method
73180
73335
 
73336
+ if (behavior === 'wrap') {
73337
+ method = wrap
73338
+ } else if (behavior === 'before' || behavior === 'after') {
73339
+ method = around
73340
+ } else {
73341
+ if (!props) {
73342
+ props = {ariaHidden: 'true', tabIndex: -1}
73343
+ }
73181
73344
 
73182
- const parse_parser = new css_selector_parser_lib/* CssSelectorParser */.N()
73345
+ method = inject
73346
+ }
73183
73347
 
73184
- parse_parser.registerAttrEqualityMods('~', '|', '^', '$', '*')
73185
- parse_parser.registerSelectorPseudos('any', 'matches', 'not', 'has')
73186
- parse_parser.registerNestingOperators('>', '+', '~')
73348
+ return (tree) => {
73349
+ visit(tree, 'element', (node, index, parent) => {
73350
+ if (
73351
+ headingRank(node) &&
73352
+ hasProperty(node, 'id') &&
73353
+ is(node, index, parent)
73354
+ ) {
73355
+ return method(node, index, parent)
73356
+ }
73357
+ })
73358
+ }
73187
73359
 
73188
- /**
73189
- * @param {string} selector
73190
- * @returns {Selectors | RuleSet | null}
73191
- */
73192
- function lib_parse_parse(selector) {
73193
- if (typeof selector !== 'string') {
73194
- throw new TypeError('Expected `string` as selector, not `' + selector + '`')
73360
+ /** @type {import('unist-util-visit/complex-types').Visitor<Element>} */
73361
+ function inject(node) {
73362
+ node.children[behavior === 'prepend' ? 'unshift' : 'push'](
73363
+ create(node, extend(true, {}, props), toChildren(content, node))
73364
+ )
73365
+
73366
+ return [SKIP]
73195
73367
  }
73196
73368
 
73197
- return parse_parser.parse(selector)
73198
- }
73369
+ /** @type {import('unist-util-visit/complex-types').Visitor<Element>} */
73370
+ function around(node, index, parent) {
73371
+ // Uncommon.
73372
+ /* c8 ignore next */
73373
+ if (typeof index !== 'number' || !parent) return
73199
73374
 
73200
- ;// CONCATENATED MODULE: ../node_modules/hast-util-select/lib/index.js
73201
- /**
73202
- * @typedef {import('./types.js').Element} Element
73203
- * @typedef {import('./types.js').Node} Node
73204
- * @typedef {import('./types.js').Space} Space
73205
- * @typedef {import('./types.js').SelectState} SelectState
73206
- */
73375
+ const link = create(
73376
+ node,
73377
+ extend(true, {}, props),
73378
+ toChildren(content, node)
73379
+ )
73380
+ let nodes = behavior === 'before' ? [link, node] : [node, link]
73207
73381
 
73382
+ if (group) {
73383
+ const grouping = toNode(group, node)
73208
73384
 
73385
+ if (grouping && !Array.isArray(grouping) && grouping.type === 'element') {
73386
+ grouping.children = nodes
73387
+ nodes = [grouping]
73388
+ }
73389
+ }
73209
73390
 
73391
+ parent.children.splice(index, 1, ...nodes)
73210
73392
 
73393
+ return [SKIP, index + nodes.length]
73394
+ }
73211
73395
 
73212
- /**
73213
- * Check that the given `node` matches `selector`.
73214
- *
73215
- * This only checks the element itself, not the surrounding tree.
73216
- * Thus, nesting in selectors is not supported (`p b`, `p > b`), neither are
73217
- * selectors like `:first-child`, etc.
73218
- * This only checks that the given element matches the selector.
73219
- *
73220
- * @param {string} selector
73221
- * CSS selector, such as (`h1`, `a, b`).
73222
- * @param {Node | null | undefined} [node]
73223
- * Node that might match `selector`, should be an element.
73224
- * @param {Space | null | undefined} [space='html']
73225
- * Name of namespace (`'svg'` or `'html'`).
73226
- * @returns {boolean}
73227
- * Whether `node` matches `selector`.
73228
- */
73229
- function lib_matches(selector, node, space) {
73230
- const state = lib_createState(selector, node, space)
73231
- state.one = true
73232
- state.shallow = true
73233
- walk(state, node || undefined)
73234
- return state.results.length > 0
73235
- }
73396
+ /** @type {import('unist-util-visit/complex-types').Visitor<Element>} */
73397
+ function wrap(node) {
73398
+ node.children = [create(node, extend(true, {}, props), node.children)]
73399
+ return [SKIP]
73400
+ }
73236
73401
 
73237
- /**
73238
- * Select the first element that matches `selector` in the given `tree`.
73239
- * Searches the tree in *preorder*.
73240
- *
73241
- * @param {string} selector
73242
- * CSS selector, such as (`h1`, `a, b`).
73243
- * @param {Node | null | undefined} [tree]
73244
- * Tree to search.
73245
- * @param {Space | null | undefined} [space='html']
73246
- * Name of namespace (`'svg'` or `'html'`).
73247
- * @returns {Element | null}
73248
- * First element in `tree` that matches `selector` or `null` if nothing is
73249
- * found.
73250
- * This could be `tree` itself.
73251
- */
73252
- function lib_select(selector, tree, space) {
73253
- const state = lib_createState(selector, tree, space)
73254
- state.one = true
73255
- walk(state, tree || undefined)
73256
- // To do in major: return `undefined` instead.
73257
- return state.results[0] || null
73258
- }
73402
+ /**
73403
+ * @param {ElementChild|ElementChild[]|Build} value
73404
+ * @param {Element} node
73405
+ * @returns {ElementChild[]}
73406
+ */
73407
+ function toChildren(value, node) {
73408
+ const result = toNode(value, node)
73409
+ return Array.isArray(result) ? result : [result]
73410
+ }
73259
73411
 
73260
- /**
73261
- * Select all elements that match `selector` in the given `tree`.
73262
- * Searches the tree in *preorder*.
73263
- *
73264
- * @param {string} selector
73265
- * CSS selector, such as (`h1`, `a, b`).
73266
- * @param {Node | null | undefined} [tree]
73267
- * Tree to search.
73268
- * @param {Space | null | undefined} [space='html']
73269
- * Name of namespace (`'svg'` or `'html'`).
73270
- * @returns {Array<Element>}
73271
- * Elements in `tree` that match `selector`.
73272
- * This could include `tree` itself.
73273
- */
73274
- function selectAll(selector, tree, space) {
73275
- const state = lib_createState(selector, tree, space)
73276
- walk_walk(state, tree || undefined)
73277
- return state.results
73278
- }
73412
+ /**
73413
+ * @param {ElementChild|ElementChild[]|Build} value
73414
+ * @param {Element} node
73415
+ * @returns {ElementChild|ElementChild[]}
73416
+ */
73417
+ function toNode(value, node) {
73418
+ if (typeof value === 'function') return value(node)
73419
+ return extend(true, Array.isArray(value) ? [] : {}, value)
73420
+ }
73279
73421
 
73280
- /**
73281
- * @param {string} selector
73282
- * Tree to search.
73283
- * @param {Node | null | undefined} [tree]
73284
- * Tree to search.
73285
- * @param {Space | null | undefined} [space='html']
73286
- * Name of namespace (`'svg'` or `'html'`).
73287
- * @returns {SelectState} SelectState
73288
- */
73289
- function lib_createState(selector, tree, space) {
73290
- return {
73291
- // State of the query.
73292
- rootQuery: queryToSelectors(lib_parse_parse(selector)),
73293
- results: [],
73294
- // @ts-expect-error assume elements.
73295
- scopeElements: tree ? (tree.type === 'root' ? tree.children : [tree]) : [],
73296
- one: false,
73297
- shallow: false,
73298
- found: false,
73299
- // State in the tree.
73300
- schema: space === 'svg' ? property_information_svg : property_information_html,
73301
- language: undefined,
73302
- direction: 'ltr',
73303
- editableOrEditingHost: false,
73304
- typeIndex: undefined,
73305
- elementIndex: undefined,
73306
- typeCount: undefined,
73307
- elementCount: undefined
73422
+ /**
73423
+ * @param {Element} node
73424
+ * @param {Properties} props
73425
+ * @param {ElementChild[]} children
73426
+ * @returns {Element}
73427
+ */
73428
+ function create(node, props, children) {
73429
+ return {
73430
+ type: 'element',
73431
+ tagName: 'a',
73432
+ properties: Object.assign({}, props, {
73433
+ // Fix hast types and make them required.
73434
+ /* c8 ignore next */
73435
+ href: '#' + (node.properties || {}).id
73436
+ }),
73437
+ children
73438
+ }
73308
73439
  }
73309
73440
  }
73310
73441
 
73311
- ;// CONCATENATED MODULE: ../node_modules/rehype-rewrite/lib/index.js
73312
-
73442
+ ;// CONCATENATED MODULE: ../node_modules/rehype-ignore/lib/index.js
73313
73443
 
73314
- /** Get the node tree source code string */
73315
- const getCodeString = (data = [], code = '') => {
73316
- data.forEach((node) => {
73317
- if (node.type === 'text') {
73318
- code += node.value;
73319
- }
73320
- else if (node.type === 'element' && node.children && Array.isArray(node.children)) {
73321
- code += getCodeString(node.children);
73322
- }
73323
- });
73324
- return code;
73325
- };
73326
- const remarkRewrite = (options) => {
73327
- const { selector, rewrite } = options || {};
73444
+ const rehypeIgnore = (options = {}) => {
73445
+ const { openDelimiter = 'rehype:ignore:start', closeDelimiter = 'rehype:ignore:end' } = options;
73328
73446
  return (tree) => {
73329
- if (!rewrite || typeof rewrite !== 'function')
73330
- return;
73331
- if (selector && typeof selector === 'string') {
73332
- const selected = selectAll(selector, tree);
73333
- if (selected && selected.length > 0) {
73334
- visit(tree, selected, (node, index, parent) => {
73335
- rewrite(node, index, parent);
73447
+ visit(tree, (node, index, parent) => {
73448
+ if (node.type === 'element' || node.type === 'root') {
73449
+ // const start = node.children.findIndex((item) => item.type === 'comment' && item.value === openDelimiter);
73450
+ // const end = node.children.findIndex((item) => item.type === 'comment' && item.value === closeDelimiter);
73451
+ // if (start > -1 && end > -1) {
73452
+ // node.children = node.children.filter((_, idx) => idx < start || idx > end);
73453
+ // }
73454
+ let start = false;
73455
+ node.children = node.children.filter((item) => {
73456
+ if (item.type === 'raw' || item.type === 'comment') {
73457
+ let str = (item.value || '').trim();
73458
+ str = str.replace(/^<!--(.*?)-->/, '$1');
73459
+ if (str === openDelimiter) {
73460
+ start = true;
73461
+ return false;
73462
+ }
73463
+ if (str === closeDelimiter) {
73464
+ start = false;
73465
+ return false;
73466
+ }
73467
+ }
73468
+ return !start;
73336
73469
  });
73337
73470
  }
73338
- return;
73339
- }
73340
- visit(tree, (node, index, parent) => {
73341
- rewrite(node, index, parent);
73342
73471
  });
73343
73472
  };
73344
73473
  };
73345
- /* harmony default export */ const rehype_rewrite_lib = (remarkRewrite);
73474
+ /* harmony default export */ const rehype_ignore_lib = (rehypeIgnore);
73346
73475
  //# sourceMappingURL=index.js.map
73347
73476
  ;// CONCATENATED MODULE: ../node_modules/@uiw/react-markdown-preview/esm/nodes/octiconLink.js
73348
73477
  var octiconLink = {
@@ -73429,77 +73558,32 @@ function copyElement(str) {
73429
73558
  }]
73430
73559
  };
73431
73560
  }
73432
- // EXTERNAL MODULE: ../node_modules/@uiw/copy-to-clipboard/dist/copy-to-clipboard.umd.js
73433
- var copy_to_clipboard_umd = __webpack_require__(5028);
73434
- var copy_to_clipboard_umd_default = /*#__PURE__*/__webpack_require__.n(copy_to_clipboard_umd);
73435
- ;// CONCATENATED MODULE: ../node_modules/@uiw/react-markdown-preview/esm/plugins/useCopied.js
73436
-
73437
-
73438
- function getParentElement(target) {
73439
- if (!target) return null;
73440
- var dom = target;
73441
- if (dom.dataset.code && dom.classList.contains('copied')) {
73442
- return dom;
73443
- }
73444
- if (dom.parentElement) {
73445
- return getParentElement(dom.parentElement);
73446
- }
73447
- return null;
73448
- }
73449
- function useCopied(container) {
73450
- var handle = event => {
73451
- var target = getParentElement(event.target);
73452
- if (!target) return;
73453
- target.classList.add('active');
73454
- copy_to_clipboard_umd_default()(target.dataset.code, function () {
73455
- setTimeout(() => {
73456
- target.classList.remove('active');
73457
- }, 2000);
73458
- });
73459
- };
73460
- (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect)(() => {
73461
- var _container$current, _container$current2;
73462
- (_container$current = container.current) == null || _container$current.removeEventListener('click', handle, false);
73463
- (_container$current2 = container.current) == null || _container$current2.addEventListener('click', handle, false);
73464
- return () => {
73465
- var _container$current3;
73466
- (_container$current3 = container.current) == null || _container$current3.removeEventListener('click', handle, false);
73467
- };
73468
- // eslint-disable-next-line react-hooks/exhaustive-deps
73469
- }, [container]);
73470
- }
73471
- ;// CONCATENATED MODULE: ../node_modules/@uiw/react-markdown-preview/esm/styles/markdown.css
73472
- // extracted by mini-css-extract-plugin
73473
- /* harmony default export */ const styles_markdown = ({});
73474
- ;// CONCATENATED MODULE: ../node_modules/@uiw/react-markdown-preview/esm/plugins/reservedMeta.js
73475
-
73476
-
73477
- var reservedMeta = function reservedMeta(options) {
73478
- if (options === void 0) {
73479
- options = {};
73480
- }
73481
- return tree => {
73482
- visit(tree, node => {
73483
- if (node.type === 'element' && node.tagName === 'code' && node.data && node.data.meta) {
73484
- node.properties = _extends({}, node.properties, {
73485
- 'data-meta': String(node.data.meta)
73486
- });
73487
- }
73488
- });
73489
- };
73490
- };
73491
- // EXTERNAL MODULE: ../node_modules/react/jsx-runtime.js
73492
- var jsx_runtime = __webpack_require__(4246);
73493
- ;// CONCATENATED MODULE: ../node_modules/@uiw/react-markdown-preview/esm/index.js
73494
-
73561
+ ;// CONCATENATED MODULE: ../node_modules/@uiw/react-markdown-preview/esm/rehypePlugins.js
73495
73562
 
73496
- var _excluded = ["prefixCls", "className", "source", "style", "disableCopy", "skipHtml", "onScroll", "onMouseOver", "pluginsFilter", "rehypeRewrite", "wrapperElement", "warpperElement"];
73497
73563
 
73498
73564
 
73499
73565
 
73500
73566
 
73501
73567
 
73502
73568
 
73569
+ var rehypeRewriteHandle = (disableCopy, rewrite) => (node, index, parent) => {
73570
+ if (node.type === 'element' && parent && parent.type === 'root' && /h(1|2|3|4|5|6)/.test(node.tagName)) {
73571
+ var child = node.children && node.children[0];
73572
+ if (child && child.properties && child.properties.ariaHidden === 'true') {
73573
+ child.properties = _extends({
73574
+ class: 'anchor'
73575
+ }, child.properties);
73576
+ child.children = [octiconLink];
73577
+ }
73578
+ }
73579
+ if (node.type === 'element' && node.tagName === 'pre' && !disableCopy) {
73580
+ var code = getCodeString(node.children);
73581
+ node.children.push(copyElement(code));
73582
+ }
73583
+ rewrite && rewrite(node, index, parent);
73584
+ };
73585
+ var defaultRehypePlugins = [rehypeSlug, rehypeAutolinkHeadings, rehype_ignore_lib];
73586
+ ;// CONCATENATED MODULE: ../node_modules/@uiw/react-markdown-preview/esm/index.js
73503
73587
 
73504
73588
 
73505
73589
 
@@ -73511,76 +73595,17 @@ var _excluded = ["prefixCls", "className", "source", "style", "disableCopy", "sk
73511
73595
 
73512
73596
 
73513
73597
  /* harmony default export */ const esm = (/*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().forwardRef((props, ref) => {
73514
- var {
73515
- prefixCls = 'wmde-markdown wmde-markdown-color',
73516
- className,
73517
- source,
73518
- style,
73519
- disableCopy = false,
73520
- skipHtml = true,
73521
- onScroll,
73522
- onMouseOver,
73523
- pluginsFilter,
73524
- rehypeRewrite: rewrite,
73525
- wrapperElement = {},
73526
- warpperElement = {}
73527
- } = props,
73528
- other = _objectWithoutPropertiesLoose(props, _excluded);
73529
- var mdp = external_root_React_commonjs2_react_commonjs_react_amd_react_default().useRef(null);
73530
- (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useImperativeHandle)(ref, () => _extends({}, props, {
73531
- mdp
73532
- }), [mdp, props]);
73533
- var cls = (prefixCls || '') + " " + (className || '');
73534
- useCopied(mdp);
73535
- var rehypeRewriteHandle = (node, index, parent) => {
73536
- if (node.type === 'element' && parent && parent.type === 'root' && /h(1|2|3|4|5|6)/.test(node.tagName)) {
73537
- var child = node.children && node.children[0];
73538
- if (child && child.properties && child.properties.ariaHidden === 'true') {
73539
- child.properties = _extends({
73540
- class: 'anchor'
73541
- }, child.properties);
73542
- child.children = [octiconLink];
73543
- }
73544
- }
73545
- if (node.type === 'element' && node.tagName === 'pre' && !disableCopy) {
73546
- var code = getCodeString(node.children);
73547
- node.children.push(copyElement(code));
73548
- }
73549
- rewrite && rewrite(node, index, parent);
73550
- };
73598
+ var _props$disableCopy;
73551
73599
  var rehypePlugins = [reservedMeta, [f, {
73552
73600
  ignoreMissing: true
73553
- }], rehypeSlug, rehypeAutolinkHeadings, rehype_ignore_lib, [rehype_rewrite_lib, {
73554
- rewrite: rehypeRewriteHandle
73601
+ }], ...defaultRehypePlugins, [rehype_rewrite_lib, {
73602
+ rewrite: rehypeRewriteHandle((_props$disableCopy = props.disableCopy) != null ? _props$disableCopy : false, props.rehypeRewrite)
73555
73603
  }], [rehype_attr_lib, {
73556
73604
  properties: 'attr'
73557
- }], ...(other.rehypePlugins || [])];
73558
- var customProps = {
73559
- allowElement: (element, index, parent) => {
73560
- if (other.allowElement) {
73561
- return other.allowElement(element, index, parent);
73562
- }
73563
- return /^[A-Za-z0-9]+$/.test(element.tagName);
73564
- }
73565
- };
73566
- if (skipHtml) {
73567
- rehypePlugins.push(rehypeRaw);
73568
- }
73569
- var remarkPlugins = [...(other.remarkPlugins || []), remarkGfm];
73570
- var wrapperProps = _extends({}, warpperElement, wrapperElement);
73571
- return /*#__PURE__*/(0,jsx_runtime.jsx)("div", _extends({
73572
- ref: mdp,
73573
- onScroll: onScroll,
73574
- onMouseOver: onMouseOver
73575
- }, wrapperProps, {
73576
- className: cls,
73577
- style: style,
73578
- children: /*#__PURE__*/(0,jsx_runtime.jsx)(ReactMarkdown, _extends({}, customProps, other, {
73579
- skipHtml: skipHtml,
73580
- rehypePlugins: pluginsFilter ? pluginsFilter('rehype', rehypePlugins) : rehypePlugins,
73581
- remarkPlugins: pluginsFilter ? pluginsFilter('remark', remarkPlugins) : remarkPlugins,
73582
- children: source || ''
73583
- }))
73605
+ }], ...(props.rehypePlugins || [])];
73606
+ return /*#__PURE__*/(0,jsx_runtime.jsx)(preview, _extends({}, props, {
73607
+ rehypePlugins: rehypePlugins,
73608
+ ref: ref
73584
73609
  }));
73585
73610
  }));
73586
73611
  ;// CONCATENATED MODULE: ./src/Context.tsx
@@ -75989,6 +76014,9 @@ var table_table={name:'table',keyCommand:'table',prefix:'\n| Header | Header |\n
75989
76014
  })}),execute:function execute(state,api){var newSelectionRange=selectWord({text:state.text,selection:state.selection,prefix:state.command.prefix,suffix:state.command.suffix});var state1=api.setSelectionRange(newSelectionRange);if(state1.selectedText.length>=state.command.prefix.length+state.command.suffix.length&&state1.selectedText.startsWith(state.command.prefix)){// Remove
75990
76015
  executeCommand({api:api,selectedText:state1.selectedText,selection:state.selection,prefix:state.command.prefix,suffix:state.command.suffix});}else{// Add
75991
76016
  state1=api.setSelectionRange({start:state.selection.start,end:state.selection.start});executeCommand({api:api,selectedText:state1.selectedText,selection:state.selection,prefix:state.command.prefix,suffix:state.command.suffix});}}};
76017
+ ;// CONCATENATED MODULE: ./src/commands/issue.tsx
76018
+ var issue={name:'issue',keyCommand:'issue',prefix:'#',suffix:'',buttonProps:{'aria-label':'Add issue',title:'Add issue'},icon:/*#__PURE__*/(0,jsx_runtime.jsx)("svg",{role:"img",width:"12",height:"12",viewBox:"0 0 448 512",children:/*#__PURE__*/(0,jsx_runtime.jsx)("path",{fill:"currentColor",d:"M181.3 32.4c17.4 2.9 29.2 19.4 26.3 36.8L197.8 128h95.1l11.5-69.3c2.9-17.4 19.4-29.2 36.8-26.3s29.2 19.4 26.3 36.8L357.8 128H416c17.7 0 32 14.3 32 32s-14.3 32-32 32H347.1L325.8 320H384c17.7 0 32 14.3 32 32s-14.3 32-32 32H315.1l-11.5 69.3c-2.9 17.4-19.4 29.2-36.826.3s-29.2-19.4-26.3-36.8l9.8-58.7H155.1l-11.5 69.3c-2.9 17.4-19.4 29.2-36.8 26.3s-29.2-19.4-26.3-36.8L90.2 384H32c-17.7 0-32-14.3-32-32s14.3-32 32-32h68.9l21.3-128H64c-17.7 0-32-14.3-32-32s14.3-32 32-32h68.9l11.5-69.3c2.9-17.4 19.4-29.2 36.8-26.3zM187.1 192L165.8320h95.1l21.3-128H187.1z"//Font Awesome Free 6.4.2 by @fontawesome - https://fontawesome.com
76019
+ })}),execute:function execute(state,api){var newSelectionRange=selectWord({text:state.text,selection:state.selection,prefix:state.command.prefix,suffix:state.command.suffix});var state1=api.setSelectionRange(newSelectionRange);executeCommand({api:api,selectedText:state1.selectedText,selection:state.selection,prefix:state.command.prefix,suffix:state.command.suffix});}};
75992
76020
  ;// CONCATENATED MODULE: ./src/commands/help.tsx
75993
76021
  var help={name:'help',keyCommand:'help',buttonProps:{'aria-label':'Open help',title:'Open help'},icon:/*#__PURE__*/(0,jsx_runtime.jsx)("svg",{viewBox:"0 0 16 16",width:"12px",height:"12px",children:/*#__PURE__*/(0,jsx_runtime.jsx)("path",{d:"M8 0C3.6 0 0 3.6 0 8s3.6 8 8 8 8-3.6 8-8-3.6-8-8-8Zm.9 13H7v-1.8h1.9V13Zm-.1-3.6v.5H7.1v-.6c.2-2.1 2-1.9 1.9-3.2.1-.7-.3-1.1-1-1.1-.8 0-1.2.7-1.2 1.6H5c0-1.7 1.2-3 2.9-3 2.3 0 3 1.4 3 2.3.1 2.3-1.9 2-2.1 3.5Z",fill:"currentColor"})}),execute:function execute(){window.open('https://www.markdownguide.org/basic-syntax/','_blank','noreferrer');}};
75994
76022
  ;// CONCATENATED MODULE: ./src/commands/index.ts
@@ -76008,7 +76036,7 @@ var commands_getCommands=function getCommands(){return[bold,italic,strikeThrough
76008
76036
  * `9` - `Tab`
76009
76037
  */if(!defaultTabEnable&&e.code&&e.code.toLowerCase()==='tab'){stopPropagation(e);var space=new Array(tabSize+1).join(' ');if(target.selectionStart!==target.selectionEnd){var _star=target.value.substring(0,target.selectionStart).split('\n');var _end=target.value.substring(0,target.selectionEnd).split('\n');var modifiedTextLine=[];_end.forEach(function(item,idx){if(item!==_star[idx]){modifiedTextLine.push(item);}});var modifiedText=modifiedTextLine.join('\n');var oldSelectText=target.value.substring(target.selectionStart,target.selectionEnd);var newStarNum=target.value.substring(0,target.selectionStart).length;textArea.setSelectionRange({start:target.value.indexOf(modifiedText),end:target.selectionEnd});var modifiedTextObj=insertBeforeEachLine(modifiedText,e.shiftKey?'':space);var text=modifiedTextObj.modifiedText;if(e.shiftKey){text=text.split('\n').map(function(item){return item.replace(new RegExp("^".concat(space)),'');}).join('\n');}textArea.replaceSelection(text);var startTabSize=e.shiftKey?-tabSize:tabSize;var endTabSize=e.shiftKey?-modifiedTextLine.length*tabSize:modifiedTextLine.length*tabSize;textArea.setSelectionRange({start:newStarNum+startTabSize,end:newStarNum+oldSelectText.length+endTabSize});}else{return insertTextAtPosition(target,space);}}else if(e.keyCode===13&&e.code.toLowerCase()==='enter'&&(/^(-|\*)\s/.test(currentLineStr)||/^\d+.\s/.test(currentLineStr))&&!e.shiftKey){/**
76010
76038
  * `13` - `Enter`
76011
- */stopPropagation(e);var startStr='\n- ';if(currentLineStr.startsWith('*')){startStr='\n* ';}if(currentLineStr.startsWith('- [ ]')){startStr='\n- [ ] ';}else if(currentLineStr.startsWith('- [X]')||currentLineStr.startsWith('- [x]')){startStr='\n- [X] ';}if(/^\d+.\s/.test(currentLineStr)){startStr="\n".concat(parseInt(currentLineStr)+1,". ");}return insertTextAtPosition(target,startStr);}else if(e.code&&e.code.toLowerCase()==='keyd'&&e.ctrlKey){// Duplicate lines
76039
+ */stopPropagation(e);var startStr='\n- ';if(currentLineStr.startsWith('*')){startStr='\n* ';}if(currentLineStr.startsWith('- [ ]')||currentLineStr.startsWith('- [X]')||currentLineStr.startsWith('- [x]')){startStr='\n- [ ] ';}if(/^\d+.\s/.test(currentLineStr)){startStr="\n".concat(parseInt(currentLineStr)+1,". ");}return insertTextAtPosition(target,startStr);}else if(e.code&&e.code.toLowerCase()==='keyd'&&e.ctrlKey){// Duplicate lines
76012
76040
  stopPropagation(e);var selection={start:target.selectionStart,end:target.selectionEnd};var savedSelection=selection;selection=selectLine({text:target.value,selection:selection});var textToDuplicate=target.value.slice(selection.start,selection.end);textArea.setSelectionRange({start:selection.end,end:selection.end});insertTextAtPosition(target,"\n".concat(textToDuplicate));textArea.setSelectionRange({start:savedSelection.start,end:savedSelection.end});}else if(e.code&&e.code.toLowerCase()==='arrowup'&&e.altKey){handleLineMove(e,-1);}else if(e.code&&e.code.toLowerCase()==='arrowdown'&&e.altKey){handleLineMove(e,1);}}
76013
76041
  ;// CONCATENATED MODULE: ./src/components/TextArea/index.less
76014
76042
  // extracted by mini-css-extract-plugin
@@ -76042,9 +76070,6 @@ document.body.style.overflow=originalOverflow.current;}}},[fullscreen,originalOv
76042
76070
  ;// CONCATENATED MODULE: ./src/components/DragBar/index.tsx
76043
76071
  var DragBar_DragBar=function DragBar(props){var _ref=props||{},prefixCls=_ref.prefixCls,onChange=_ref.onChange;var $dom=(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)(null);var dragRef=(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)();var heightRef=(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)(props.height);(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect)(function(){if(heightRef.current!==props.height){heightRef.current=props.height;}},[props.height]);function handleMouseMove(event){if(dragRef.current){var _changedTouches$;var clientY=event.clientY||((_changedTouches$=event.changedTouches[0])===null||_changedTouches$===void 0?void 0:_changedTouches$.clientY);var newHeight=dragRef.current.height+clientY-dragRef.current.dragY;if(newHeight>=props.minHeight&&newHeight<=props.maxHeight){onChange&&onChange(dragRef.current.height+(clientY-dragRef.current.dragY));}}}function handleMouseUp(){var _$dom$current,_$dom$current2;dragRef.current=undefined;document.removeEventListener('mousemove',handleMouseMove);document.removeEventListener('mouseup',handleMouseUp);(_$dom$current=$dom.current)===null||_$dom$current===void 0?void 0:_$dom$current.removeEventListener('touchmove',handleMouseMove);(_$dom$current2=$dom.current)===null||_$dom$current2===void 0?void 0:_$dom$current2.removeEventListener('touchend',handleMouseUp);}function handleMouseDown(event){var _changedTouches$2,_$dom$current3,_$dom$current4;event.preventDefault();var clientY=event.clientY||((_changedTouches$2=event.changedTouches[0])===null||_changedTouches$2===void 0?void 0:_changedTouches$2.clientY);dragRef.current={height:heightRef.current,dragY:clientY};document.addEventListener('mousemove',handleMouseMove);document.addEventListener('mouseup',handleMouseUp);(_$dom$current3=$dom.current)===null||_$dom$current3===void 0?void 0:_$dom$current3.addEventListener('touchmove',handleMouseMove,{passive:false});(_$dom$current4=$dom.current)===null||_$dom$current4===void 0?void 0:_$dom$current4.addEventListener('touchend',handleMouseUp,{passive:false});}(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect)(function(){if(document){var _$dom$current5,_$dom$current6;(_$dom$current5=$dom.current)===null||_$dom$current5===void 0?void 0:_$dom$current5.addEventListener('touchstart',handleMouseDown,{passive:false});(_$dom$current6=$dom.current)===null||_$dom$current6===void 0?void 0:_$dom$current6.addEventListener('mousedown',handleMouseDown);}return function(){if(document){var _$dom$current7;(_$dom$current7=$dom.current)===null||_$dom$current7===void 0?void 0:_$dom$current7.removeEventListener('touchstart',handleMouseDown);document.removeEventListener('mousemove',handleMouseMove);}};// eslint-disable-next-line react-hooks/exhaustive-deps
76044
76072
  },[]);var svg=(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo)(function(){return/*#__PURE__*/(0,jsx_runtime.jsx)("svg",{viewBox:"0 0 512 512",height:"100%",children:/*#__PURE__*/(0,jsx_runtime.jsx)("path",{fill:"currentColor",d:"M304 256c0 26.5-21.5 48-48 48s-48-21.5-48-48 21.5-48 48-48 48 21.5 48 48zm120-48c-26.5 0-48 21.5-48 48s21.5 48 48 48 48-21.5 48-48-21.5-48-48-48zm-336 0c-26.5 0-48 21.5-48 48s21.5 48 48 48 48-21.5 48-48-21.5-48-48-48z"})});},[]);return/*#__PURE__*/(0,jsx_runtime.jsx)("div",{className:"".concat(prefixCls,"-bar"),ref:$dom,children:svg});};/* harmony default export */ const components_DragBar = (DragBar_DragBar);
76045
- ;// CONCATENATED MODULE: ./src/index.less
76046
- // extracted by mini-css-extract-plugin
76047
- /* harmony default export */ const src = ({});
76048
76073
  ;// CONCATENATED MODULE: ./src/Editor.tsx
76049
76074
  var Editor_excluded=["prefixCls","className","value","commands","commandsFilter","direction","extraCommands","height","enableScroll","visibleDragbar","highlightEnable","preview","fullscreen","overflow","previewOptions","textareaProps","maxHeight","minHeight","autoFocus","tabSize","defaultTabEnable","onChange","onStatistics","onHeightChange","hideToolbar","toolbarBottom","components","renderTextarea"];function setGroupPopFalse(){var data=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};Object.keys(data).forEach(function(keyname){data[keyname]=false;});return data;}var InternalMDEditor=/*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().forwardRef(function(props,ref){var _ref=props||{},_ref$prefixCls=_ref.prefixCls,prefixCls=_ref$prefixCls===void 0?'w-md-editor':_ref$prefixCls,className=_ref.className,propsValue=_ref.value,_ref$commands=_ref.commands,commands=_ref$commands===void 0?commands_getCommands():_ref$commands,commandsFilter=_ref.commandsFilter,direction=_ref.direction,_ref$extraCommands=_ref.extraCommands,extraCommands=_ref$extraCommands===void 0?getExtraCommands():_ref$extraCommands,_ref$height=_ref.height,height=_ref$height===void 0?200:_ref$height,_ref$enableScroll=_ref.enableScroll,enableScroll=_ref$enableScroll===void 0?true:_ref$enableScroll,_ref$visibleDragbar=_ref.visibleDragbar,visibleDragbar=_ref$visibleDragbar===void 0?typeof props.visiableDragbar==='boolean'?props.visiableDragbar:true:_ref$visibleDragbar,_ref$highlightEnable=_ref.highlightEnable,highlightEnable=_ref$highlightEnable===void 0?true:_ref$highlightEnable,_ref$preview=_ref.preview,previewType=_ref$preview===void 0?'live':_ref$preview,_ref$fullscreen=_ref.fullscreen,fullscreen=_ref$fullscreen===void 0?false:_ref$fullscreen,_ref$overflow=_ref.overflow,overflow=_ref$overflow===void 0?true:_ref$overflow,_ref$previewOptions=_ref.previewOptions,previewOptions=_ref$previewOptions===void 0?{}:_ref$previewOptions,textareaProps=_ref.textareaProps,_ref$maxHeight=_ref.maxHeight,maxHeight=_ref$maxHeight===void 0?1200:_ref$maxHeight,_ref$minHeight=_ref.minHeight,minHeight=_ref$minHeight===void 0?100:_ref$minHeight,autoFocus=_ref.autoFocus,_ref$tabSize=_ref.tabSize,tabSize=_ref$tabSize===void 0?2:_ref$tabSize,_ref$defaultTabEnable=_ref.defaultTabEnable,defaultTabEnable=_ref$defaultTabEnable===void 0?false:_ref$defaultTabEnable,onChange=_ref.onChange,onStatistics=_ref.onStatistics,onHeightChange=_ref.onHeightChange,hideToolbar=_ref.hideToolbar,_ref$toolbarBottom=_ref.toolbarBottom,toolbarBottom=_ref$toolbarBottom===void 0?false:_ref$toolbarBottom,components=_ref.components,renderTextarea=_ref.renderTextarea,other=_objectWithoutProperties(_ref,Editor_excluded);var cmds=commands.map(function(item){return commandsFilter?commandsFilter(item,false):item;}).filter(Boolean);var extraCmds=extraCommands.map(function(item){return commandsFilter?commandsFilter(item,true):item;}).filter(Boolean);var _useReducer=(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useReducer)(reducer,{markdown:propsValue,preview:previewType,components:components,height:height,highlightEnable:highlightEnable,tabSize:tabSize,defaultTabEnable:defaultTabEnable,scrollTop:0,scrollTopPreview:0,commands:cmds,extraCommands:extraCmds,fullscreen:fullscreen,barPopup:{}}),_useReducer2=_slicedToArray(_useReducer,2),state=_useReducer2[0],dispatch=_useReducer2[1];var container=(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)(null);var previewRef=(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)(null);var enableScrollRef=(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)(enableScroll);(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useImperativeHandle)(ref,function(){return _objectSpread2(_objectSpread2({},state),{},{container:container.current,dispatch:dispatch});});(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo)(function(){return enableScrollRef.current=enableScroll;},[enableScroll]);(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect)(function(){var stateInit={};if(container.current){stateInit.container=container.current||undefined;}stateInit.markdown=propsValue||'';stateInit.barPopup={};if(dispatch){dispatch(_objectSpread2(_objectSpread2({},state),stateInit));}// eslint-disable-next-line react-hooks/exhaustive-deps
76050
76075
  },[]);var cls=[className,'wmde-markdown-var',direction?"".concat(prefixCls,"-").concat(direction):null,prefixCls,state.preview?"".concat(prefixCls,"-show-").concat(state.preview):null,state.fullscreen?"".concat(prefixCls,"-fullscreen"):null].filter(Boolean).join(' ').trim();(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo)(function(){return propsValue!==state.markdown&&dispatch({markdown:propsValue||''});},[propsValue,state.markdown]);// eslint-disable-next-line react-hooks/exhaustive-deps
@@ -76056,6 +76081,9 @@ var Editor_excluded=["prefixCls","className","value","commands","commandsFilter"
76056
76081
  (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo)(function(){return height!==state.height&&dispatch({height:height});},[height]);(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo)(function(){return height!==state.height&&onHeightChange&&onHeightChange(state.height,height,state);},[height,onHeightChange,state]);// eslint-disable-next-line react-hooks/exhaustive-deps
76057
76082
  (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo)(function(){return commands!==state.commands&&dispatch({commands:cmds});},[props.commands]);// eslint-disable-next-line react-hooks/exhaustive-deps
76058
76083
  (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo)(function(){return extraCommands!==state.extraCommands&&dispatch({extraCommands:extraCmds});},[props.extraCommands]);var textareaDomRef=(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)();var active=(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)('preview');var initScroll=(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)(false);(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo)(function(){textareaDomRef.current=state.textareaWarp;if(state.textareaWarp){state.textareaWarp.addEventListener('mouseover',function(){active.current='text';});state.textareaWarp.addEventListener('mouseleave',function(){active.current='preview';});}},[state.textareaWarp]);var handleScroll=function handleScroll(e,type){if(!enableScrollRef.current)return;var textareaDom=textareaDomRef.current;var previewDom=previewRef.current?previewRef.current:undefined;if(!initScroll.current){active.current=type;initScroll.current=true;}if(textareaDom&&previewDom){var scale=(textareaDom.scrollHeight-textareaDom.offsetHeight)/(previewDom.scrollHeight-previewDom.offsetHeight);if(e.target===textareaDom&&active.current==='text'){previewDom.scrollTop=textareaDom.scrollTop/scale;}if(e.target===previewDom&&active.current==='preview'){textareaDom.scrollTop=previewDom.scrollTop*scale;}var scrollTop=0;if(active.current==='text'){scrollTop=textareaDom.scrollTop||0;}else if(active.current==='preview'){scrollTop=previewDom.scrollTop||0;}dispatch({scrollTop:scrollTop});}};var previewClassName="".concat(prefixCls,"-preview ").concat(previewOptions.className||'');var handlePreviewScroll=function handlePreviewScroll(e){return handleScroll(e,'preview');};var mdPreview=(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo)(function(){return/*#__PURE__*/(0,jsx_runtime.jsx)("div",{ref:previewRef,className:previewClassName,children:/*#__PURE__*/(0,jsx_runtime.jsx)(esm,_objectSpread2(_objectSpread2({},previewOptions),{},{onScroll:handlePreviewScroll,source:state.markdown||''}))});},[previewClassName,previewOptions,state.markdown]);var preview=(components===null||components===void 0?void 0:components.preview)&&(components===null||components===void 0?void 0:components.preview(state.markdown||'',state,dispatch));if(preview&&/*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().isValidElement(preview)){mdPreview=/*#__PURE__*/(0,jsx_runtime.jsx)("div",{className:previewClassName,ref:previewRef,onScroll:handlePreviewScroll,children:preview});}var containerStyle=_objectSpread2(_objectSpread2({},other.style),{},{height:state.height||'100%'});var containerClick=function containerClick(){return dispatch({barPopup:_objectSpread2({},setGroupPopFalse(state.barPopup))});};var dragBarChange=function dragBarChange(newHeight){return dispatch({height:newHeight});};var changeHandle=function changeHandle(evn){onChange&&onChange(evn.target.value,evn,state);if(textareaProps&&textareaProps.onChange){textareaProps.onChange(evn);}if(state.textarea&&state.textarea instanceof HTMLTextAreaElement&&onStatistics){var obj=new TextAreaCommandOrchestrator(state.textarea);var objState=obj.getState()||{};onStatistics(_objectSpread2(_objectSpread2({},objState),{},{lineCount:evn.target.value.split('\n').length,length:evn.target.value.length}));}};return/*#__PURE__*/(0,jsx_runtime.jsx)(EditorContext.Provider,{value:_objectSpread2(_objectSpread2({},state),{},{dispatch:dispatch}),children:/*#__PURE__*/(0,jsx_runtime.jsxs)("div",_objectSpread2(_objectSpread2({ref:container,className:cls},other),{},{onClick:containerClick,style:containerStyle,children:[!hideToolbar&&!toolbarBottom&&/*#__PURE__*/(0,jsx_runtime.jsx)(Toolbar_Toolbar,{prefixCls:prefixCls,overflow:overflow,toolbarBottom:toolbarBottom}),/*#__PURE__*/(0,jsx_runtime.jsxs)("div",{className:"".concat(prefixCls,"-content"),children:[/(edit|live)/.test(state.preview||'')&&/*#__PURE__*/(0,jsx_runtime.jsx)(TextArea_TextArea,_objectSpread2(_objectSpread2({className:"".concat(prefixCls,"-input"),prefixCls:prefixCls,autoFocus:autoFocus},textareaProps),{},{onChange:changeHandle,renderTextarea:(components===null||components===void 0?void 0:components.textarea)||renderTextarea,onScroll:function onScroll(e){return handleScroll(e,'text');}})),/(live|preview)/.test(state.preview||'')&&mdPreview]}),visibleDragbar&&!state.fullscreen&&/*#__PURE__*/(0,jsx_runtime.jsx)(components_DragBar,{prefixCls:prefixCls,height:state.height,maxHeight:maxHeight,minHeight:minHeight,onChange:dragBarChange}),!hideToolbar&&toolbarBottom&&/*#__PURE__*/(0,jsx_runtime.jsx)(Toolbar_Toolbar,{prefixCls:prefixCls,overflow:overflow,toolbarBottom:toolbarBottom})]}))});});var Editor=InternalMDEditor;Editor.Markdown=esm;/* harmony default export */ const src_Editor = (Editor);
76084
+ ;// CONCATENATED MODULE: ./src/index.less
76085
+ // extracted by mini-css-extract-plugin
76086
+ /* harmony default export */ const src = ({});
76059
76087
  ;// CONCATENATED MODULE: ./src/index.tsx
76060
76088
  /* harmony default export */ const src_0 = (src_Editor);
76061
76089
  })();