@inkandswitch/patchwork-pkg-base 0.0.15 → 0.0.17

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 (383) hide show
  1. package/init.js +1 -0
  2. package/modules.json +11 -1
  3. package/package.json +1 -1
  4. package/packages/account-picker/dist/AccountPicker-7VBUJTTB.js +8860 -0
  5. package/packages/account-picker/dist/AccountPicker-7VBUJTTB.js.map +7 -0
  6. package/packages/account-picker/dist/AccountPicker-CN73XGEW.css +371 -0
  7. package/packages/account-picker/dist/AccountPicker-CN73XGEW.css.map +7 -0
  8. package/packages/account-picker/dist/chunk-5WRI5ZAA.js +31 -0
  9. package/packages/account-picker/dist/chunk-5WRI5ZAA.js.map +7 -0
  10. package/packages/account-picker/dist/tool.css +371 -0
  11. package/packages/account-picker/dist/tool.css.map +7 -0
  12. package/packages/account-picker/dist/tool.js +19 -0
  13. package/packages/account-picker/dist/tool.js.map +7 -0
  14. package/packages/account-picker/package.json +39 -0
  15. package/packages/codemirror-base/dist/chunk-KMEIRH3R.js +490 -0
  16. package/packages/codemirror-base/dist/chunk-KMEIRH3R.js.map +7 -0
  17. package/packages/codemirror-base/dist/lib/codemirror.js +7 -0
  18. package/packages/codemirror-base/dist/lib/codemirror.js.map +7 -0
  19. package/packages/codemirror-base/dist/main.js +17 -0
  20. package/packages/codemirror-base/dist/main.js.map +7 -0
  21. package/packages/codemirror-base/dist/tool.js +1799 -0
  22. package/packages/codemirror-base/dist/tool.js.map +7 -0
  23. package/packages/codemirror-base/package.json +55 -0
  24. package/packages/codemirror-markdown/dist/apl-QAIM2KBM.js +142 -0
  25. package/packages/codemirror-markdown/dist/apl-QAIM2KBM.js.map +7 -0
  26. package/packages/codemirror-markdown/dist/asciiarmor-G7UKQURA.js +58 -0
  27. package/packages/codemirror-markdown/dist/asciiarmor-G7UKQURA.js.map +7 -0
  28. package/packages/codemirror-markdown/dist/asn1-JTUXKWKT.js +144 -0
  29. package/packages/codemirror-markdown/dist/asn1-JTUXKWKT.js.map +7 -0
  30. package/packages/codemirror-markdown/dist/asterisk-NM6JCXOL.js +351 -0
  31. package/packages/codemirror-markdown/dist/asterisk-NM6JCXOL.js.map +7 -0
  32. package/packages/codemirror-markdown/dist/brainfuck-X7FFM55E.js +55 -0
  33. package/packages/codemirror-markdown/dist/brainfuck-X7FFM55E.js.map +7 -0
  34. package/packages/codemirror-markdown/dist/chunk-46Z6CXSY.js +1062 -0
  35. package/packages/codemirror-markdown/dist/chunk-46Z6CXSY.js.map +7 -0
  36. package/packages/codemirror-markdown/dist/chunk-6JT2ASRP.js +1111 -0
  37. package/packages/codemirror-markdown/dist/chunk-6JT2ASRP.js.map +7 -0
  38. package/packages/codemirror-markdown/dist/chunk-CSJO4DNL.js +1424 -0
  39. package/packages/codemirror-markdown/dist/chunk-CSJO4DNL.js.map +7 -0
  40. package/packages/codemirror-markdown/dist/chunk-FLC3A4DL.js +133 -0
  41. package/packages/codemirror-markdown/dist/chunk-FLC3A4DL.js.map +7 -0
  42. package/packages/codemirror-markdown/dist/chunk-M3X2FRO3.js +998 -0
  43. package/packages/codemirror-markdown/dist/chunk-M3X2FRO3.js.map +7 -0
  44. package/packages/codemirror-markdown/dist/chunk-MAW6NPUW.js +4930 -0
  45. package/packages/codemirror-markdown/dist/chunk-MAW6NPUW.js.map +7 -0
  46. package/packages/codemirror-markdown/dist/chunk-MBTMKYFQ.js +1779 -0
  47. package/packages/codemirror-markdown/dist/chunk-MBTMKYFQ.js.map +7 -0
  48. package/packages/codemirror-markdown/dist/chunk-NEI7FGV4.js +697 -0
  49. package/packages/codemirror-markdown/dist/chunk-NEI7FGV4.js.map +7 -0
  50. package/packages/codemirror-markdown/dist/chunk-PPGERYN5.js +2528 -0
  51. package/packages/codemirror-markdown/dist/chunk-PPGERYN5.js.map +7 -0
  52. package/packages/codemirror-markdown/dist/clike-DOBZTBQN.js +808 -0
  53. package/packages/codemirror-markdown/dist/clike-DOBZTBQN.js.map +7 -0
  54. package/packages/codemirror-markdown/dist/clojure-PTADSDNF.js +851 -0
  55. package/packages/codemirror-markdown/dist/clojure-PTADSDNF.js.map +7 -0
  56. package/packages/codemirror-markdown/dist/cmake-5HAC7YMH.js +73 -0
  57. package/packages/codemirror-markdown/dist/cmake-5HAC7YMH.js.map +7 -0
  58. package/packages/codemirror-markdown/dist/cobol-HAM4C42S.js +131 -0
  59. package/packages/codemirror-markdown/dist/cobol-HAM4C42S.js.map +7 -0
  60. package/packages/codemirror-markdown/dist/coffeescript-IBRKASSJ.js +310 -0
  61. package/packages/codemirror-markdown/dist/coffeescript-IBRKASSJ.js.map +7 -0
  62. package/packages/codemirror-markdown/dist/commonlisp-KMRPB5EW.js +132 -0
  63. package/packages/codemirror-markdown/dist/commonlisp-KMRPB5EW.js.map +7 -0
  64. package/packages/codemirror-markdown/dist/crystal-2MDF4EKJ.js +400 -0
  65. package/packages/codemirror-markdown/dist/crystal-2MDF4EKJ.js.map +7 -0
  66. package/packages/codemirror-markdown/dist/css-VQQXA3AY.js +1795 -0
  67. package/packages/codemirror-markdown/dist/css-VQQXA3AY.js.map +7 -0
  68. package/packages/codemirror-markdown/dist/cypher-ZZEGDGDJ.js +123 -0
  69. package/packages/codemirror-markdown/dist/cypher-ZZEGDGDJ.js.map +7 -0
  70. package/packages/codemirror-markdown/dist/d-5S6PJOOT.js +187 -0
  71. package/packages/codemirror-markdown/dist/d-5S6PJOOT.js.map +7 -0
  72. package/packages/codemirror-markdown/dist/datatype.js +48 -0
  73. package/packages/codemirror-markdown/dist/datatype.js.map +7 -0
  74. package/packages/codemirror-markdown/dist/diff-S77XBOWF.js +27 -0
  75. package/packages/codemirror-markdown/dist/diff-S77XBOWF.js.map +7 -0
  76. package/packages/codemirror-markdown/dist/dist-2C6IPJHB.js +98 -0
  77. package/packages/codemirror-markdown/dist/dist-2C6IPJHB.js.map +7 -0
  78. package/packages/codemirror-markdown/dist/dist-2H653DKD.js +170 -0
  79. package/packages/codemirror-markdown/dist/dist-2H653DKD.js.map +7 -0
  80. package/packages/codemirror-markdown/dist/dist-2O4EI6YQ.js +140 -0
  81. package/packages/codemirror-markdown/dist/dist-2O4EI6YQ.js.map +7 -0
  82. package/packages/codemirror-markdown/dist/dist-2UJRV4FH.js +75 -0
  83. package/packages/codemirror-markdown/dist/dist-2UJRV4FH.js.map +7 -0
  84. package/packages/codemirror-markdown/dist/dist-52S6W6Z3.js +15 -0
  85. package/packages/codemirror-markdown/dist/dist-52S6W6Z3.js.map +7 -0
  86. package/packages/codemirror-markdown/dist/dist-5KN6ODPO.js +340 -0
  87. package/packages/codemirror-markdown/dist/dist-5KN6ODPO.js.map +7 -0
  88. package/packages/codemirror-markdown/dist/dist-BOGB4NCA.js +20 -0
  89. package/packages/codemirror-markdown/dist/dist-BOGB4NCA.js.map +7 -0
  90. package/packages/codemirror-markdown/dist/dist-DZ4PW5HP.js +318 -0
  91. package/packages/codemirror-markdown/dist/dist-DZ4PW5HP.js.map +7 -0
  92. package/packages/codemirror-markdown/dist/dist-FDBKXKIA.js +100 -0
  93. package/packages/codemirror-markdown/dist/dist-FDBKXKIA.js.map +7 -0
  94. package/packages/codemirror-markdown/dist/dist-G2KVVLNT.js +381 -0
  95. package/packages/codemirror-markdown/dist/dist-G2KVVLNT.js.map +7 -0
  96. package/packages/codemirror-markdown/dist/dist-HHNZE2GE.js +193 -0
  97. package/packages/codemirror-markdown/dist/dist-HHNZE2GE.js.map +7 -0
  98. package/packages/codemirror-markdown/dist/dist-HNH74YPL.js +32 -0
  99. package/packages/codemirror-markdown/dist/dist-HNH74YPL.js.map +7 -0
  100. package/packages/codemirror-markdown/dist/dist-LBQUKRIG.js +27 -0
  101. package/packages/codemirror-markdown/dist/dist-LBQUKRIG.js.map +7 -0
  102. package/packages/codemirror-markdown/dist/dist-MFKCWPLQ.js +416 -0
  103. package/packages/codemirror-markdown/dist/dist-MFKCWPLQ.js.map +7 -0
  104. package/packages/codemirror-markdown/dist/dist-NISFJM3T.js +423 -0
  105. package/packages/codemirror-markdown/dist/dist-NISFJM3T.js.map +7 -0
  106. package/packages/codemirror-markdown/dist/dist-Q7P6VH6H.js +786 -0
  107. package/packages/codemirror-markdown/dist/dist-Q7P6VH6H.js.map +7 -0
  108. package/packages/codemirror-markdown/dist/dist-RWF5A5GN.js +451 -0
  109. package/packages/codemirror-markdown/dist/dist-RWF5A5GN.js.map +7 -0
  110. package/packages/codemirror-markdown/dist/dist-UHUU7KLC.js +748 -0
  111. package/packages/codemirror-markdown/dist/dist-UHUU7KLC.js.map +7 -0
  112. package/packages/codemirror-markdown/dist/dist-WJMBFK7W.js +360 -0
  113. package/packages/codemirror-markdown/dist/dist-WJMBFK7W.js.map +7 -0
  114. package/packages/codemirror-markdown/dist/dist-XJYSXJ7H.js +115 -0
  115. package/packages/codemirror-markdown/dist/dist-XJYSXJ7H.js.map +7 -0
  116. package/packages/codemirror-markdown/dist/dist-YY24ZXZD.js +212 -0
  117. package/packages/codemirror-markdown/dist/dist-YY24ZXZD.js.map +7 -0
  118. package/packages/codemirror-markdown/dist/dockerfile-JECCOJWP.js +209 -0
  119. package/packages/codemirror-markdown/dist/dockerfile-JECCOJWP.js.map +7 -0
  120. package/packages/codemirror-markdown/dist/dtd-MNDWTW4Z.js +116 -0
  121. package/packages/codemirror-markdown/dist/dtd-MNDWTW4Z.js.map +7 -0
  122. package/packages/codemirror-markdown/dist/dylan-VQ4IHJDS.js +317 -0
  123. package/packages/codemirror-markdown/dist/dylan-VQ4IHJDS.js.map +7 -0
  124. package/packages/codemirror-markdown/dist/ebnf-IDZBFTCG.js +142 -0
  125. package/packages/codemirror-markdown/dist/ebnf-IDZBFTCG.js.map +7 -0
  126. package/packages/codemirror-markdown/dist/ecl-X3ROY7E6.js +180 -0
  127. package/packages/codemirror-markdown/dist/ecl-X3ROY7E6.js.map +7 -0
  128. package/packages/codemirror-markdown/dist/eiffel-WB3M7Y2E.js +136 -0
  129. package/packages/codemirror-markdown/dist/eiffel-WB3M7Y2E.js.map +7 -0
  130. package/packages/codemirror-markdown/dist/elm-VHXR6ZA3.js +178 -0
  131. package/packages/codemirror-markdown/dist/elm-VHXR6ZA3.js.map +7 -0
  132. package/packages/codemirror-markdown/dist/erlang-7ZBDDQDV.js +676 -0
  133. package/packages/codemirror-markdown/dist/erlang-7ZBDDQDV.js.map +7 -0
  134. package/packages/codemirror-markdown/dist/extensions/embed.js +325 -0
  135. package/packages/codemirror-markdown/dist/extensions/embed.js.map +7 -0
  136. package/packages/codemirror-markdown/dist/extensions/links.js +118 -0
  137. package/packages/codemirror-markdown/dist/extensions/links.js.map +7 -0
  138. package/packages/codemirror-markdown/dist/extensions/markdown.js +3476 -0
  139. package/packages/codemirror-markdown/dist/extensions/markdown.js.map +7 -0
  140. package/packages/codemirror-markdown/dist/factor-IKT2GQE2.js +70 -0
  141. package/packages/codemirror-markdown/dist/factor-IKT2GQE2.js.map +7 -0
  142. package/packages/codemirror-markdown/dist/fcl-CNBUVGUC.js +143 -0
  143. package/packages/codemirror-markdown/dist/fcl-CNBUVGUC.js.map +7 -0
  144. package/packages/codemirror-markdown/dist/forth-4BTPWSFZ.js +118 -0
  145. package/packages/codemirror-markdown/dist/forth-4BTPWSFZ.js.map +7 -0
  146. package/packages/codemirror-markdown/dist/fortran-V6F5DQPK.js +469 -0
  147. package/packages/codemirror-markdown/dist/fortran-V6F5DQPK.js.map +7 -0
  148. package/packages/codemirror-markdown/dist/gas-4DLP6BC4.js +296 -0
  149. package/packages/codemirror-markdown/dist/gas-4DLP6BC4.js.map +7 -0
  150. package/packages/codemirror-markdown/dist/gherkin-OSGPX6HI.js +117 -0
  151. package/packages/codemirror-markdown/dist/gherkin-OSGPX6HI.js.map +7 -0
  152. package/packages/codemirror-markdown/dist/groovy-R2JW63QF.js +225 -0
  153. package/packages/codemirror-markdown/dist/groovy-R2JW63QF.js.map +7 -0
  154. package/packages/codemirror-markdown/dist/haskell-GG7T4J6H.js +461 -0
  155. package/packages/codemirror-markdown/dist/haskell-GG7T4J6H.js.map +7 -0
  156. package/packages/codemirror-markdown/dist/haxe-ESFUJKSE.js +521 -0
  157. package/packages/codemirror-markdown/dist/haxe-ESFUJKSE.js.map +7 -0
  158. package/packages/codemirror-markdown/dist/http-SZLSACOW.js +81 -0
  159. package/packages/codemirror-markdown/dist/http-SZLSACOW.js.map +7 -0
  160. package/packages/codemirror-markdown/dist/idl-V7UH35RP.js +987 -0
  161. package/packages/codemirror-markdown/dist/idl-V7UH35RP.js.map +7 -0
  162. package/packages/codemirror-markdown/dist/javascript-MGRPKFDN.js +13 -0
  163. package/packages/codemirror-markdown/dist/javascript-MGRPKFDN.js.map +7 -0
  164. package/packages/codemirror-markdown/dist/julia-CWCVZVPG.js +409 -0
  165. package/packages/codemirror-markdown/dist/julia-CWCVZVPG.js.map +7 -0
  166. package/packages/codemirror-markdown/dist/livescript-IGKT2FL7.js +303 -0
  167. package/packages/codemirror-markdown/dist/livescript-IGKT2FL7.js.map +7 -0
  168. package/packages/codemirror-markdown/dist/lua-GHK7GCTS.js +258 -0
  169. package/packages/codemirror-markdown/dist/lua-GHK7GCTS.js.map +7 -0
  170. package/packages/codemirror-markdown/dist/main.js +58 -0
  171. package/packages/codemirror-markdown/dist/main.js.map +7 -0
  172. package/packages/codemirror-markdown/dist/mathematica-W5LMQI3M.js +112 -0
  173. package/packages/codemirror-markdown/dist/mathematica-W5LMQI3M.js.map +7 -0
  174. package/packages/codemirror-markdown/dist/mbox-A7CXJ4HZ.js +119 -0
  175. package/packages/codemirror-markdown/dist/mbox-A7CXJ4HZ.js.map +7 -0
  176. package/packages/codemirror-markdown/dist/mirc-WYJEQUBY.js +109 -0
  177. package/packages/codemirror-markdown/dist/mirc-WYJEQUBY.js.map +7 -0
  178. package/packages/codemirror-markdown/dist/mllike-C2YS6SJI.js +340 -0
  179. package/packages/codemirror-markdown/dist/mllike-C2YS6SJI.js.map +7 -0
  180. package/packages/codemirror-markdown/dist/modelica-BMJSLZS7.js +149 -0
  181. package/packages/codemirror-markdown/dist/modelica-BMJSLZS7.js.map +7 -0
  182. package/packages/codemirror-markdown/dist/mscgen-5BORDYHW.js +137 -0
  183. package/packages/codemirror-markdown/dist/mscgen-5BORDYHW.js.map +7 -0
  184. package/packages/codemirror-markdown/dist/mumps-BYE6H7ZX.js +95 -0
  185. package/packages/codemirror-markdown/dist/mumps-BYE6H7ZX.js.map +7 -0
  186. package/packages/codemirror-markdown/dist/nginx-Y54HR7MQ.js +143 -0
  187. package/packages/codemirror-markdown/dist/nginx-Y54HR7MQ.js.map +7 -0
  188. package/packages/codemirror-markdown/dist/nsis-UZLPE2DL.js +67 -0
  189. package/packages/codemirror-markdown/dist/nsis-UZLPE2DL.js.map +7 -0
  190. package/packages/codemirror-markdown/dist/ntriples-SAI3J2VH.js +155 -0
  191. package/packages/codemirror-markdown/dist/ntriples-SAI3J2VH.js.map +7 -0
  192. package/packages/codemirror-markdown/dist/octave-TLUBYOUX.js +213 -0
  193. package/packages/codemirror-markdown/dist/octave-TLUBYOUX.js.map +7 -0
  194. package/packages/codemirror-markdown/dist/oz-F6LNIR6Q.js +233 -0
  195. package/packages/codemirror-markdown/dist/oz-F6LNIR6Q.js.map +7 -0
  196. package/packages/codemirror-markdown/dist/pascal-WINE2FE6.js +107 -0
  197. package/packages/codemirror-markdown/dist/pascal-WINE2FE6.js.map +7 -0
  198. package/packages/codemirror-markdown/dist/perl-NZG3EIBE.js +1107 -0
  199. package/packages/codemirror-markdown/dist/perl-NZG3EIBE.js.map +7 -0
  200. package/packages/codemirror-markdown/dist/pig-U7OFLRCV.js +105 -0
  201. package/packages/codemirror-markdown/dist/pig-U7OFLRCV.js.map +7 -0
  202. package/packages/codemirror-markdown/dist/powershell-ZSUS7P6D.js +330 -0
  203. package/packages/codemirror-markdown/dist/powershell-ZSUS7P6D.js.map +7 -0
  204. package/packages/codemirror-markdown/dist/properties-IJRU6UJW.js +60 -0
  205. package/packages/codemirror-markdown/dist/properties-IJRU6UJW.js.map +7 -0
  206. package/packages/codemirror-markdown/dist/protobuf-2KETQIQ5.js +80 -0
  207. package/packages/codemirror-markdown/dist/protobuf-2KETQIQ5.js.map +7 -0
  208. package/packages/codemirror-markdown/dist/pug-IQCJJAZU.js +410 -0
  209. package/packages/codemirror-markdown/dist/pug-IQCJJAZU.js.map +7 -0
  210. package/packages/codemirror-markdown/dist/puppet-YIIDDH6A.js +139 -0
  211. package/packages/codemirror-markdown/dist/puppet-YIIDDH6A.js.map +7 -0
  212. package/packages/codemirror-markdown/dist/python-A6P3XTMX.js +429 -0
  213. package/packages/codemirror-markdown/dist/python-A6P3XTMX.js.map +7 -0
  214. package/packages/codemirror-markdown/dist/q-2KXN5RX7.js +135 -0
  215. package/packages/codemirror-markdown/dist/q-2KXN5RX7.js.map +7 -0
  216. package/packages/codemirror-markdown/dist/r-BB4MIIBH.js +174 -0
  217. package/packages/codemirror-markdown/dist/r-BB4MIIBH.js.map +7 -0
  218. package/packages/codemirror-markdown/dist/rpm-LMR25AQ3.js +111 -0
  219. package/packages/codemirror-markdown/dist/rpm-LMR25AQ3.js.map +7 -0
  220. package/packages/codemirror-markdown/dist/ruby-TSD6FT73.js +333 -0
  221. package/packages/codemirror-markdown/dist/ruby-TSD6FT73.js.map +7 -0
  222. package/packages/codemirror-markdown/dist/sas-6X4WWIGV.js +209 -0
  223. package/packages/codemirror-markdown/dist/sas-6X4WWIGV.js.map +7 -0
  224. package/packages/codemirror-markdown/dist/scheme-E3I46HBL.js +230 -0
  225. package/packages/codemirror-markdown/dist/scheme-E3I46HBL.js.map +7 -0
  226. package/packages/codemirror-markdown/dist/shell-GX3PRI4I.js +224 -0
  227. package/packages/codemirror-markdown/dist/shell-GX3PRI4I.js.map +7 -0
  228. package/packages/codemirror-markdown/dist/sieve-V65ZPL4F.js +137 -0
  229. package/packages/codemirror-markdown/dist/sieve-V65ZPL4F.js.map +7 -0
  230. package/packages/codemirror-markdown/dist/smalltalk-OVKP2CVW.js +123 -0
  231. package/packages/codemirror-markdown/dist/smalltalk-OVKP2CVW.js.map +7 -0
  232. package/packages/codemirror-markdown/dist/solr-C4DLQJCF.js +71 -0
  233. package/packages/codemirror-markdown/dist/solr-C4DLQJCF.js.map +7 -0
  234. package/packages/codemirror-markdown/dist/sparql-REKUW7B3.js +251 -0
  235. package/packages/codemirror-markdown/dist/sparql-REKUW7B3.js.map +7 -0
  236. package/packages/codemirror-markdown/dist/spreadsheet-S7NN2YTQ.js +89 -0
  237. package/packages/codemirror-markdown/dist/spreadsheet-S7NN2YTQ.js.map +7 -0
  238. package/packages/codemirror-markdown/dist/sql-ML2Q43YF.js +358 -0
  239. package/packages/codemirror-markdown/dist/sql-ML2Q43YF.js.map +7 -0
  240. package/packages/codemirror-markdown/dist/stex-TCOGKBT4.js +233 -0
  241. package/packages/codemirror-markdown/dist/stex-TCOGKBT4.js.map +7 -0
  242. package/packages/codemirror-markdown/dist/stylus-3ONNYZOM.js +591 -0
  243. package/packages/codemirror-markdown/dist/stylus-3ONNYZOM.js.map +7 -0
  244. package/packages/codemirror-markdown/dist/swift-CNWGZ22Y.js +293 -0
  245. package/packages/codemirror-markdown/dist/swift-CNWGZ22Y.js.map +7 -0
  246. package/packages/codemirror-markdown/dist/tcl-77IMAZYE.js +116 -0
  247. package/packages/codemirror-markdown/dist/tcl-77IMAZYE.js.map +7 -0
  248. package/packages/codemirror-markdown/dist/textile-6IWIIKFM.js +416 -0
  249. package/packages/codemirror-markdown/dist/textile-6IWIIKFM.js.map +7 -0
  250. package/packages/codemirror-markdown/dist/tiddlywiki-IJSZMUSA.js +231 -0
  251. package/packages/codemirror-markdown/dist/tiddlywiki-IJSZMUSA.js.map +7 -0
  252. package/packages/codemirror-markdown/dist/tiki-HG37JJIT.js +276 -0
  253. package/packages/codemirror-markdown/dist/tiki-HG37JJIT.js.map +7 -0
  254. package/packages/codemirror-markdown/dist/toml-NINU2IMM.js +78 -0
  255. package/packages/codemirror-markdown/dist/toml-NINU2IMM.js.map +7 -0
  256. package/packages/codemirror-markdown/dist/troff-AOQJ4Q4C.js +63 -0
  257. package/packages/codemirror-markdown/dist/troff-AOQJ4Q4C.js.map +7 -0
  258. package/packages/codemirror-markdown/dist/ttcn-TLOZ3FX3.js +211 -0
  259. package/packages/codemirror-markdown/dist/ttcn-TLOZ3FX3.js.map +7 -0
  260. package/packages/codemirror-markdown/dist/ttcn-cfg-3B6QY7QE.js +141 -0
  261. package/packages/codemirror-markdown/dist/ttcn-cfg-3B6QY7QE.js.map +7 -0
  262. package/packages/codemirror-markdown/dist/turtle-3N5KCGXP.js +132 -0
  263. package/packages/codemirror-markdown/dist/turtle-3N5KCGXP.js.map +7 -0
  264. package/packages/codemirror-markdown/dist/vb-I7M5DRLP.js +204 -0
  265. package/packages/codemirror-markdown/dist/vb-I7M5DRLP.js.map +7 -0
  266. package/packages/codemirror-markdown/dist/vbscript-U2ARSJLD.js +482 -0
  267. package/packages/codemirror-markdown/dist/vbscript-U2ARSJLD.js.map +7 -0
  268. package/packages/codemirror-markdown/dist/velocity-R3AYP5XJ.js +151 -0
  269. package/packages/codemirror-markdown/dist/velocity-R3AYP5XJ.js.map +7 -0
  270. package/packages/codemirror-markdown/dist/verilog-7VEWVDW6.js +456 -0
  271. package/packages/codemirror-markdown/dist/verilog-7VEWVDW6.js.map +7 -0
  272. package/packages/codemirror-markdown/dist/vhdl-JZUPPGBA.js +162 -0
  273. package/packages/codemirror-markdown/dist/vhdl-JZUPPGBA.js.map +7 -0
  274. package/packages/codemirror-markdown/dist/webidl-SLQFEELK.js +206 -0
  275. package/packages/codemirror-markdown/dist/webidl-SLQFEELK.js.map +7 -0
  276. package/packages/codemirror-markdown/dist/xquery-VXP5KJ6N.js +532 -0
  277. package/packages/codemirror-markdown/dist/xquery-VXP5KJ6N.js.map +7 -0
  278. package/packages/codemirror-markdown/dist/yacas-JRBC4BEV.js +132 -0
  279. package/packages/codemirror-markdown/dist/yacas-JRBC4BEV.js.map +7 -0
  280. package/packages/codemirror-markdown/dist/z80-AJF6WLUV.js +95 -0
  281. package/packages/codemirror-markdown/dist/z80-AJF6WLUV.js.map +7 -0
  282. package/packages/codemirror-markdown/example.js +46 -0
  283. package/packages/codemirror-markdown/package.json +62 -0
  284. package/packages/commands/dist/main.js +504 -0
  285. package/packages/commands/dist/main.js.map +7 -0
  286. package/packages/commands/package.json +28 -0
  287. package/packages/contact/dist/ContactAvatar-FP32ZZH2.js +161 -0
  288. package/packages/contact/dist/ContactAvatar-FP32ZZH2.js.map +7 -0
  289. package/packages/contact/dist/ContactViewer-ZHEE6INW.js +60 -0
  290. package/packages/contact/dist/ContactViewer-ZHEE6INW.js.map +7 -0
  291. package/packages/contact/dist/InlineContactAvatar-VZDPEZV2.js +46 -0
  292. package/packages/contact/dist/InlineContactAvatar-VZDPEZV2.js.map +7 -0
  293. package/packages/contact/dist/chunk-MOZI4Y4O.js +54 -0
  294. package/packages/contact/dist/chunk-MOZI4Y4O.js.map +7 -0
  295. package/packages/contact/dist/datatype-ABVDVPWS.js +27 -0
  296. package/packages/contact/dist/datatype-ABVDVPWS.js.map +7 -0
  297. package/packages/contact/dist/tool.css +81 -0
  298. package/packages/contact/dist/tool.css.map +7 -0
  299. package/packages/contact/dist/tool.js +70 -0
  300. package/packages/contact/dist/tool.js.map +7 -0
  301. package/packages/contact/package.json +46 -0
  302. package/packages/folder/dist/datatype-HWGUFBTQ.js +27 -0
  303. package/packages/folder/dist/datatype-HWGUFBTQ.js.map +7 -0
  304. package/packages/folder/dist/index.js +27 -0
  305. package/packages/folder/dist/index.js.map +7 -0
  306. package/packages/folder/dist/tool-62JZAZRP.js +366 -0
  307. package/packages/folder/dist/tool-62JZAZRP.js.map +7 -0
  308. package/packages/folder/package.json +32 -0
  309. package/packages/sideboard/dist/account-bar-OJQC3J6W.js +2 -0
  310. package/packages/sideboard/dist/account-bar-OJQC3J6W.js.map +7 -0
  311. package/packages/sideboard/dist/chunk-32FICX7K.js +26 -0
  312. package/packages/sideboard/dist/chunk-32FICX7K.js.map +7 -0
  313. package/packages/sideboard/dist/chunk-3OYP6TVA.js +2 -0
  314. package/packages/sideboard/dist/chunk-3OYP6TVA.js.map +7 -0
  315. package/packages/sideboard/dist/chunk-FW4363Y4.js +2 -0
  316. package/packages/sideboard/dist/chunk-FW4363Y4.js.map +7 -0
  317. package/packages/sideboard/dist/chunk-QKYKEZU4.js +2 -0
  318. package/packages/sideboard/dist/chunk-QKYKEZU4.js.map +7 -0
  319. package/packages/sideboard/dist/document-list-panel-42LSXXCO.js +2 -0
  320. package/packages/sideboard/dist/document-list-panel-42LSXXCO.js.map +7 -0
  321. package/packages/sideboard/dist/index.css +2 -0
  322. package/packages/sideboard/dist/index.css.map +7 -0
  323. package/packages/sideboard/dist/index.js +2 -0
  324. package/packages/sideboard/dist/index.js.map +7 -0
  325. package/packages/sideboard/dist/sideboard/sideboard.js +2 -0
  326. package/packages/sideboard/dist/sideboard/sideboard.js.map +7 -0
  327. package/packages/sideboard/package.json +56 -0
  328. package/packages/theming/dist/active-theme-K27UXDBG.js +26 -0
  329. package/packages/theming/dist/active-theme-K27UXDBG.js.map +7 -0
  330. package/packages/theming/dist/chunk-K4OOO2TK.js +281 -0
  331. package/packages/theming/dist/chunk-K4OOO2TK.js.map +7 -0
  332. package/packages/theming/dist/chunk-RATW7VZI.js +11 -0
  333. package/packages/theming/dist/chunk-RATW7VZI.js.map +7 -0
  334. package/packages/theming/dist/chunk-U7SC4JPE.js +86 -0
  335. package/packages/theming/dist/chunk-U7SC4JPE.js.map +7 -0
  336. package/packages/theming/dist/codemirror-theme.js +2415 -0
  337. package/packages/theming/dist/codemirror-theme.js.map +7 -0
  338. package/packages/theming/dist/datatype-UUJVIZM7.js +16 -0
  339. package/packages/theming/dist/datatype-UUJVIZM7.js.map +7 -0
  340. package/packages/theming/dist/gloom-JYQPEOHI.css +102 -0
  341. package/packages/theming/dist/lychee-BMLMUNP6.css +114 -0
  342. package/packages/theming/dist/main.js +112 -0
  343. package/packages/theming/dist/main.js.map +7 -0
  344. package/packages/theming/dist/theme-RC7MV6WP.css +691 -0
  345. package/packages/theming/dist/theme-editor-datatype-CIXRKEFF.js +11 -0
  346. package/packages/theming/dist/theme-editor-datatype-CIXRKEFF.js.map +7 -0
  347. package/packages/theming/dist/theme-editor.js +576 -0
  348. package/packages/theming/dist/theme-editor.js.map +7 -0
  349. package/packages/theming/dist/theme-titlebar-P2CODQGF.js +21 -0
  350. package/packages/theming/dist/theme-titlebar-P2CODQGF.js.map +7 -0
  351. package/packages/theming/dist/theme-tray-5L2KGCGD.js +351 -0
  352. package/packages/theming/dist/theme-tray-5L2KGCGD.js.map +7 -0
  353. package/packages/theming/dist/tool.js +405 -0
  354. package/packages/theming/dist/tool.js.map +7 -0
  355. package/packages/theming/package.json +48 -0
  356. package/packages/threepane/dist/IsolatedDocumentArea-LFSDWMIY.js +2 -0
  357. package/packages/threepane/dist/IsolatedDocumentArea-LFSDWMIY.js.map +7 -0
  358. package/packages/threepane/dist/PatchworkFrame-JTNZ6365.js +2 -0
  359. package/packages/threepane/dist/PatchworkFrame-JTNZ6365.js.map +7 -0
  360. package/packages/threepane/dist/chunk-7YXO2YGV.js +2 -0
  361. package/packages/threepane/dist/chunk-7YXO2YGV.js.map +7 -0
  362. package/packages/threepane/dist/chunk-FOMAU6H2.js +972 -0
  363. package/packages/threepane/dist/chunk-FOMAU6H2.js.map +7 -0
  364. package/packages/threepane/dist/chunk-FW4363Y4.js +2 -0
  365. package/packages/threepane/dist/chunk-FW4363Y4.js.map +7 -0
  366. package/packages/threepane/dist/datatypes-FKBTWAO7.js +2 -0
  367. package/packages/threepane/dist/datatypes-FKBTWAO7.js.map +7 -0
  368. package/packages/threepane/dist/index.js +2 -0
  369. package/packages/threepane/dist/index.js.map +7 -0
  370. package/packages/threepane/package.json +42 -0
  371. package/packages/tldraw4/dist/chunk-IKZWERSR.js +38 -0
  372. package/packages/tldraw4/dist/chunk-IKZWERSR.js.map +7 -0
  373. package/packages/tldraw4/dist/chunk-VF5CY24G.js +140894 -0
  374. package/packages/tldraw4/dist/chunk-VF5CY24G.js.map +7 -0
  375. package/packages/tldraw4/dist/datatype.js +46 -0
  376. package/packages/tldraw4/dist/datatype.js.map +7 -0
  377. package/packages/tldraw4/dist/main.css +3202 -0
  378. package/packages/tldraw4/dist/main.css.map +7 -0
  379. package/packages/tldraw4/dist/main.js +42 -0
  380. package/packages/tldraw4/dist/main.js.map +7 -0
  381. package/packages/tldraw4/dist/tool.js +8767 -0
  382. package/packages/tldraw4/dist/tool.js.map +7 -0
  383. package/packages/tldraw4/package.json +62 -0
@@ -0,0 +1,2528 @@
1
+ import {
2
+ html,
3
+ htmlCompletionSource
4
+ } from "./chunk-6JT2ASRP.js";
5
+ import {
6
+ CompletionContext
7
+ } from "./chunk-CSJO4DNL.js";
8
+ import {
9
+ Language,
10
+ LanguageDescription,
11
+ LanguageSupport,
12
+ NodeProp,
13
+ NodeSet,
14
+ NodeType,
15
+ ParseContext,
16
+ Parser,
17
+ Tag,
18
+ Tree,
19
+ defineLanguageFacet,
20
+ foldNodeProp,
21
+ foldService,
22
+ indentNodeProp,
23
+ indentUnit,
24
+ languageDataProp,
25
+ parseMixed,
26
+ styleTags,
27
+ syntaxTree,
28
+ tags
29
+ } from "./chunk-MAW6NPUW.js";
30
+
31
+ // ../node_modules/.pnpm/@codemirror+lang-markdown@6.5.1/node_modules/@codemirror/lang-markdown/dist/index.js
32
+ import { EditorSelection, countColumn, Prec, EditorState } from "@codemirror/state";
33
+ import { EditorView, keymap } from "@codemirror/view";
34
+
35
+ // ../node_modules/.pnpm/@lezer+markdown@1.7.2/node_modules/@lezer/markdown/dist/index.js
36
+ var CompositeBlock = class _CompositeBlock {
37
+ static create(type, value, from, parentHash, end) {
38
+ let hash = parentHash + (parentHash << 8) + type + (value << 4) | 0;
39
+ return new _CompositeBlock(type, value, from, hash, end, [], []);
40
+ }
41
+ constructor(type, value, from, hash, end, children, positions) {
42
+ this.type = type;
43
+ this.value = value;
44
+ this.from = from;
45
+ this.hash = hash;
46
+ this.end = end;
47
+ this.children = children;
48
+ this.positions = positions;
49
+ this.hashProp = [[NodeProp.contextHash, hash]];
50
+ }
51
+ addChild(child, pos) {
52
+ if (child.prop(NodeProp.contextHash) != this.hash)
53
+ child = new Tree(child.type, child.children, child.positions, child.length, this.hashProp);
54
+ this.children.push(child);
55
+ this.positions.push(pos);
56
+ }
57
+ toTree(nodeSet, end = this.end) {
58
+ let last = this.children.length - 1;
59
+ if (last >= 0)
60
+ end = Math.max(end, this.positions[last] + this.children[last].length + this.from);
61
+ return new Tree(nodeSet.types[this.type], this.children, this.positions, end - this.from).balance({
62
+ makeTree: (children, positions, length) => new Tree(NodeType.none, children, positions, length, this.hashProp)
63
+ });
64
+ }
65
+ };
66
+ var Type;
67
+ (function(Type2) {
68
+ Type2[Type2["Document"] = 1] = "Document";
69
+ Type2[Type2["CodeBlock"] = 2] = "CodeBlock";
70
+ Type2[Type2["FencedCode"] = 3] = "FencedCode";
71
+ Type2[Type2["Blockquote"] = 4] = "Blockquote";
72
+ Type2[Type2["HorizontalRule"] = 5] = "HorizontalRule";
73
+ Type2[Type2["BulletList"] = 6] = "BulletList";
74
+ Type2[Type2["OrderedList"] = 7] = "OrderedList";
75
+ Type2[Type2["ListItem"] = 8] = "ListItem";
76
+ Type2[Type2["ATXHeading1"] = 9] = "ATXHeading1";
77
+ Type2[Type2["ATXHeading2"] = 10] = "ATXHeading2";
78
+ Type2[Type2["ATXHeading3"] = 11] = "ATXHeading3";
79
+ Type2[Type2["ATXHeading4"] = 12] = "ATXHeading4";
80
+ Type2[Type2["ATXHeading5"] = 13] = "ATXHeading5";
81
+ Type2[Type2["ATXHeading6"] = 14] = "ATXHeading6";
82
+ Type2[Type2["SetextHeading1"] = 15] = "SetextHeading1";
83
+ Type2[Type2["SetextHeading2"] = 16] = "SetextHeading2";
84
+ Type2[Type2["HTMLBlock"] = 17] = "HTMLBlock";
85
+ Type2[Type2["LinkReference"] = 18] = "LinkReference";
86
+ Type2[Type2["Paragraph"] = 19] = "Paragraph";
87
+ Type2[Type2["CommentBlock"] = 20] = "CommentBlock";
88
+ Type2[Type2["ProcessingInstructionBlock"] = 21] = "ProcessingInstructionBlock";
89
+ Type2[Type2["Escape"] = 22] = "Escape";
90
+ Type2[Type2["Entity"] = 23] = "Entity";
91
+ Type2[Type2["HardBreak"] = 24] = "HardBreak";
92
+ Type2[Type2["Emphasis"] = 25] = "Emphasis";
93
+ Type2[Type2["StrongEmphasis"] = 26] = "StrongEmphasis";
94
+ Type2[Type2["Link"] = 27] = "Link";
95
+ Type2[Type2["Image"] = 28] = "Image";
96
+ Type2[Type2["InlineCode"] = 29] = "InlineCode";
97
+ Type2[Type2["HTMLTag"] = 30] = "HTMLTag";
98
+ Type2[Type2["Comment"] = 31] = "Comment";
99
+ Type2[Type2["ProcessingInstruction"] = 32] = "ProcessingInstruction";
100
+ Type2[Type2["Autolink"] = 33] = "Autolink";
101
+ Type2[Type2["HeaderMark"] = 34] = "HeaderMark";
102
+ Type2[Type2["QuoteMark"] = 35] = "QuoteMark";
103
+ Type2[Type2["ListMark"] = 36] = "ListMark";
104
+ Type2[Type2["LinkMark"] = 37] = "LinkMark";
105
+ Type2[Type2["EmphasisMark"] = 38] = "EmphasisMark";
106
+ Type2[Type2["CodeMark"] = 39] = "CodeMark";
107
+ Type2[Type2["CodeText"] = 40] = "CodeText";
108
+ Type2[Type2["CodeInfo"] = 41] = "CodeInfo";
109
+ Type2[Type2["LinkTitle"] = 42] = "LinkTitle";
110
+ Type2[Type2["LinkLabel"] = 43] = "LinkLabel";
111
+ Type2[Type2["URL"] = 44] = "URL";
112
+ })(Type || (Type = {}));
113
+ var LeafBlock = class {
114
+ /**
115
+ @internal
116
+ */
117
+ constructor(start, content) {
118
+ this.start = start;
119
+ this.content = content;
120
+ this.marks = [];
121
+ this.parsers = [];
122
+ }
123
+ };
124
+ var Line = class {
125
+ constructor() {
126
+ this.text = "";
127
+ this.baseIndent = 0;
128
+ this.basePos = 0;
129
+ this.depth = 0;
130
+ this.markers = [];
131
+ this.pos = 0;
132
+ this.indent = 0;
133
+ this.next = -1;
134
+ }
135
+ /**
136
+ @internal
137
+ */
138
+ forward() {
139
+ if (this.basePos > this.pos)
140
+ this.forwardInner();
141
+ }
142
+ /**
143
+ @internal
144
+ */
145
+ forwardInner() {
146
+ let newPos = this.skipSpace(this.basePos);
147
+ this.indent = this.countIndent(newPos, this.pos, this.indent);
148
+ this.pos = newPos;
149
+ this.next = newPos == this.text.length ? -1 : this.text.charCodeAt(newPos);
150
+ }
151
+ /**
152
+ Skip whitespace after the given position, return the position of
153
+ the next non-space character or the end of the line if there's
154
+ only space after `from`.
155
+ */
156
+ skipSpace(from) {
157
+ return skipSpace(this.text, from);
158
+ }
159
+ /**
160
+ @internal
161
+ */
162
+ reset(text) {
163
+ this.text = text;
164
+ this.baseIndent = this.basePos = this.pos = this.indent = 0;
165
+ this.forwardInner();
166
+ this.depth = 1;
167
+ while (this.markers.length)
168
+ this.markers.pop();
169
+ }
170
+ /**
171
+ Move the line's base position forward to the given position.
172
+ This should only be called by composite [block
173
+ parsers](#BlockParser.parse) or [markup skipping
174
+ functions](#NodeSpec.composite).
175
+ */
176
+ moveBase(to) {
177
+ this.basePos = to;
178
+ this.baseIndent = this.countIndent(to, this.pos, this.indent);
179
+ }
180
+ /**
181
+ Move the line's base position forward to the given _column_.
182
+ */
183
+ moveBaseColumn(indent) {
184
+ this.baseIndent = indent;
185
+ this.basePos = this.findColumn(indent);
186
+ }
187
+ /**
188
+ Store a composite-block-level marker. Should be called from
189
+ [markup skipping functions](#NodeSpec.composite) when they
190
+ consume any non-whitespace characters.
191
+ */
192
+ addMarker(elt2) {
193
+ this.markers.push(elt2);
194
+ }
195
+ /**
196
+ Find the column position at `to`, optionally starting at a given
197
+ position and column.
198
+ */
199
+ countIndent(to, from = 0, indent = 0) {
200
+ for (let i = from; i < to; i++)
201
+ indent += this.text.charCodeAt(i) == 9 ? 4 - indent % 4 : 1;
202
+ return indent;
203
+ }
204
+ /**
205
+ Find the position corresponding to the given column.
206
+ */
207
+ findColumn(goal) {
208
+ let i = 0;
209
+ for (let indent = 0; i < this.text.length && indent < goal; i++)
210
+ indent += this.text.charCodeAt(i) == 9 ? 4 - indent % 4 : 1;
211
+ return i;
212
+ }
213
+ /**
214
+ @internal
215
+ */
216
+ scrub() {
217
+ if (!this.baseIndent)
218
+ return this.text;
219
+ let result = "";
220
+ for (let i = 0; i < this.basePos; i++)
221
+ result += " ";
222
+ return result + this.text.slice(this.basePos);
223
+ }
224
+ };
225
+ function skipForList(bl, cx, line) {
226
+ if (line.pos == line.text.length || bl != cx.block && line.indent >= cx.stack[line.depth + 1].value + line.baseIndent)
227
+ return true;
228
+ if (line.indent >= line.baseIndent + 4)
229
+ return false;
230
+ let size = (bl.type == Type.OrderedList ? isOrderedList : isBulletList)(line, cx, false);
231
+ return size > 0 && (bl.type != Type.BulletList || isHorizontalRule(line, cx, false) < 0) && line.text.charCodeAt(line.pos + size - 1) == bl.value;
232
+ }
233
+ var DefaultSkipMarkup = {
234
+ [Type.Blockquote](bl, cx, line) {
235
+ if (line.next != 62)
236
+ return false;
237
+ line.markers.push(elt(Type.QuoteMark, cx.lineStart + line.pos, cx.lineStart + line.pos + 1));
238
+ line.moveBase(line.pos + (space(line.text.charCodeAt(line.pos + 1)) ? 2 : 1));
239
+ bl.end = cx.lineStart + line.text.length;
240
+ return true;
241
+ },
242
+ [Type.ListItem](bl, _cx, line) {
243
+ if (line.indent < line.baseIndent + bl.value && line.next > -1)
244
+ return false;
245
+ line.moveBaseColumn(line.baseIndent + bl.value);
246
+ return true;
247
+ },
248
+ [Type.OrderedList]: skipForList,
249
+ [Type.BulletList]: skipForList,
250
+ [Type.Document]() {
251
+ return true;
252
+ }
253
+ };
254
+ function space(ch) {
255
+ return ch == 32 || ch == 9 || ch == 10 || ch == 13;
256
+ }
257
+ function skipSpace(line, i = 0) {
258
+ while (i < line.length && space(line.charCodeAt(i)))
259
+ i++;
260
+ return i;
261
+ }
262
+ function skipSpaceBack(line, i, to) {
263
+ while (i > to && space(line.charCodeAt(i - 1)))
264
+ i--;
265
+ return i;
266
+ }
267
+ function isFencedCode(line) {
268
+ if (line.next != 96 && line.next != 126)
269
+ return -1;
270
+ let pos = line.pos + 1;
271
+ while (pos < line.text.length && line.text.charCodeAt(pos) == line.next)
272
+ pos++;
273
+ if (pos < line.pos + 3)
274
+ return -1;
275
+ if (line.next == 96) {
276
+ for (let i = pos; i < line.text.length; i++)
277
+ if (line.text.charCodeAt(i) == 96)
278
+ return -1;
279
+ }
280
+ return pos;
281
+ }
282
+ function isBlockquote(line) {
283
+ return line.next != 62 ? -1 : line.text.charCodeAt(line.pos + 1) == 32 ? 2 : 1;
284
+ }
285
+ function isHorizontalRule(line, cx, breaking) {
286
+ if (line.next != 42 && line.next != 45 && line.next != 95)
287
+ return -1;
288
+ let count2 = 1;
289
+ for (let pos = line.pos + 1; pos < line.text.length; pos++) {
290
+ let ch = line.text.charCodeAt(pos);
291
+ if (ch == line.next)
292
+ count2++;
293
+ else if (!space(ch))
294
+ return -1;
295
+ }
296
+ if (breaking && line.next == 45 && isSetextUnderline(line) > -1 && line.depth == cx.stack.length && cx.parser.leafBlockParsers.indexOf(DefaultLeafBlocks.SetextHeading) > -1)
297
+ return -1;
298
+ return count2 < 3 ? -1 : 1;
299
+ }
300
+ function inList(cx, type) {
301
+ for (let i = cx.stack.length - 1; i >= 0; i--)
302
+ if (cx.stack[i].type == type)
303
+ return true;
304
+ return false;
305
+ }
306
+ function isBulletList(line, cx, breaking) {
307
+ return (line.next == 45 || line.next == 43 || line.next == 42) && (line.pos == line.text.length - 1 || space(line.text.charCodeAt(line.pos + 1))) && (!breaking || inList(cx, Type.BulletList) || line.skipSpace(line.pos + 2) < line.text.length) ? 1 : -1;
308
+ }
309
+ function isOrderedList(line, cx, breaking) {
310
+ let pos = line.pos, next = line.next;
311
+ for (; ; ) {
312
+ if (next >= 48 && next <= 57)
313
+ pos++;
314
+ else
315
+ break;
316
+ if (pos == line.text.length)
317
+ return -1;
318
+ next = line.text.charCodeAt(pos);
319
+ }
320
+ if (pos == line.pos || pos > line.pos + 9 || next != 46 && next != 41 || pos < line.text.length - 1 && !space(line.text.charCodeAt(pos + 1)) || breaking && !inList(cx, Type.OrderedList) && (line.skipSpace(pos + 1) == line.text.length || pos > line.pos + 1 || line.next != 49))
321
+ return -1;
322
+ return pos + 1 - line.pos;
323
+ }
324
+ function isAtxHeading(line) {
325
+ if (line.next != 35)
326
+ return -1;
327
+ let pos = line.pos + 1;
328
+ while (pos < line.text.length && line.text.charCodeAt(pos) == 35)
329
+ pos++;
330
+ if (pos < line.text.length && line.text.charCodeAt(pos) != 32)
331
+ return -1;
332
+ let size = pos - line.pos;
333
+ return size > 6 ? -1 : size;
334
+ }
335
+ function isSetextUnderline(line) {
336
+ if (line.next != 45 && line.next != 61 || line.indent >= line.baseIndent + 4)
337
+ return -1;
338
+ let pos = line.pos + 1;
339
+ while (pos < line.text.length && line.text.charCodeAt(pos) == line.next)
340
+ pos++;
341
+ let end = pos;
342
+ while (pos < line.text.length && space(line.text.charCodeAt(pos)))
343
+ pos++;
344
+ return pos == line.text.length ? end : -1;
345
+ }
346
+ var EmptyLine = /^[ \t]*$/;
347
+ var CommentEnd = /-->/;
348
+ var ProcessingEnd = /\?>/;
349
+ var HTMLBlockStyle = [
350
+ [/^<(?:script|pre|style)(?:\s|>|$)/i, /<\/(?:script|pre|style)>/i],
351
+ [/^\s*<!--/, CommentEnd],
352
+ [/^\s*<\?/, ProcessingEnd],
353
+ [/^\s*<![A-Z]/, />/],
354
+ [/^\s*<!\[CDATA\[/, /\]\]>/],
355
+ [/^\s*<\/?(?:address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h1|h2|h3|h4|h5|h6|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|nav|noframes|ol|optgroup|option|p|param|section|source|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul)(?:\s|\/?>|$)/i, EmptyLine],
356
+ [/^\s*(?:<\/[a-z][\w-]*\s*>|<[a-z][\w-]*(\s+[a-z:_][\w-.]*(?:\s*=\s*(?:[^\s"'=<>`]+|'[^']*'|"[^"]*"))?)*\s*>)\s*$/i, EmptyLine]
357
+ ];
358
+ function isHTMLBlock(line, _cx, breaking) {
359
+ if (line.next != 60)
360
+ return -1;
361
+ let rest = line.text.slice(line.pos);
362
+ for (let i = 0, e = HTMLBlockStyle.length - (breaking ? 1 : 0); i < e; i++)
363
+ if (HTMLBlockStyle[i][0].test(rest))
364
+ return i;
365
+ return -1;
366
+ }
367
+ function getListIndent(line, pos) {
368
+ let indentAfter = line.countIndent(pos, line.pos, line.indent);
369
+ let skipped = line.skipSpace(pos);
370
+ let indented = line.countIndent(skipped, pos, indentAfter);
371
+ return indented >= indentAfter + 5 || skipped == line.text.length ? indentAfter + 1 : indented;
372
+ }
373
+ function addCodeText(marks, from, to) {
374
+ let last = marks.length - 1;
375
+ if (last >= 0 && marks[last].to == from && marks[last].type == Type.CodeText)
376
+ marks[last].to = to;
377
+ else
378
+ marks.push(elt(Type.CodeText, from, to));
379
+ }
380
+ var DefaultBlockParsers = {
381
+ LinkReference: void 0,
382
+ IndentedCode(cx, line) {
383
+ let base = line.baseIndent + 4;
384
+ if (line.indent < base)
385
+ return false;
386
+ let start = line.findColumn(base);
387
+ let from = cx.lineStart + start, to = cx.lineStart + line.text.length;
388
+ let marks = [], pendingMarks = [];
389
+ addCodeText(marks, from, to);
390
+ while (cx.nextLine() && line.depth >= cx.stack.length) {
391
+ if (line.pos == line.text.length) {
392
+ addCodeText(pendingMarks, cx.lineStart - 1, cx.lineStart);
393
+ for (let m of line.markers)
394
+ pendingMarks.push(m);
395
+ } else if (line.indent < base) {
396
+ break;
397
+ } else {
398
+ if (pendingMarks.length) {
399
+ for (let m of pendingMarks) {
400
+ if (m.type == Type.CodeText)
401
+ addCodeText(marks, m.from, m.to);
402
+ else
403
+ marks.push(m);
404
+ }
405
+ pendingMarks = [];
406
+ }
407
+ addCodeText(marks, cx.lineStart - 1, cx.lineStart);
408
+ for (let m of line.markers)
409
+ marks.push(m);
410
+ to = cx.lineStart + line.text.length;
411
+ let codeStart = cx.lineStart + line.findColumn(line.baseIndent + 4);
412
+ if (codeStart < to)
413
+ addCodeText(marks, codeStart, to);
414
+ }
415
+ }
416
+ if (pendingMarks.length) {
417
+ pendingMarks = pendingMarks.filter((m) => m.type != Type.CodeText);
418
+ if (pendingMarks.length)
419
+ line.markers = pendingMarks.concat(line.markers);
420
+ }
421
+ cx.addNode(cx.buffer.writeElements(marks, -from).finish(Type.CodeBlock, to - from), from);
422
+ return true;
423
+ },
424
+ FencedCode(cx, line) {
425
+ let fenceEnd = isFencedCode(line);
426
+ if (fenceEnd < 0)
427
+ return false;
428
+ let from = cx.lineStart + line.pos, ch = line.next, len = fenceEnd - line.pos;
429
+ let infoFrom = line.skipSpace(fenceEnd), infoTo = skipSpaceBack(line.text, line.text.length, infoFrom);
430
+ let marks = [elt(Type.CodeMark, from, from + len)];
431
+ if (infoFrom < infoTo)
432
+ marks.push(elt(Type.CodeInfo, cx.lineStart + infoFrom, cx.lineStart + infoTo));
433
+ for (let first = true, empty = true, hasLine = false; cx.nextLine() && line.depth >= cx.stack.length; first = false) {
434
+ let i = line.pos;
435
+ if (line.indent - line.baseIndent < 4)
436
+ while (i < line.text.length && line.text.charCodeAt(i) == ch)
437
+ i++;
438
+ if (i - line.pos >= len && line.skipSpace(i) == line.text.length) {
439
+ for (let m of line.markers)
440
+ marks.push(m);
441
+ if (empty && hasLine)
442
+ addCodeText(marks, cx.lineStart - 1, cx.lineStart);
443
+ marks.push(elt(Type.CodeMark, cx.lineStart + line.pos, cx.lineStart + i));
444
+ cx.nextLine();
445
+ break;
446
+ } else {
447
+ hasLine = true;
448
+ if (!first) {
449
+ addCodeText(marks, cx.lineStart - 1, cx.lineStart);
450
+ empty = false;
451
+ }
452
+ for (let m of line.markers)
453
+ marks.push(m);
454
+ let textStart = cx.lineStart + line.basePos, textEnd = cx.lineStart + line.text.length;
455
+ if (textStart < textEnd) {
456
+ addCodeText(marks, textStart, textEnd);
457
+ empty = false;
458
+ }
459
+ }
460
+ }
461
+ cx.addNode(cx.buffer.writeElements(marks, -from).finish(Type.FencedCode, cx.prevLineEnd() - from), from);
462
+ return true;
463
+ },
464
+ Blockquote(cx, line) {
465
+ let size = isBlockquote(line);
466
+ if (size < 0)
467
+ return false;
468
+ cx.startContext(Type.Blockquote, line.pos);
469
+ cx.addNode(Type.QuoteMark, cx.lineStart + line.pos, cx.lineStart + line.pos + 1);
470
+ line.moveBase(line.pos + size);
471
+ return null;
472
+ },
473
+ HorizontalRule(cx, line) {
474
+ if (isHorizontalRule(line, cx, false) < 0)
475
+ return false;
476
+ let from = cx.lineStart + line.pos;
477
+ cx.nextLine();
478
+ cx.addNode(Type.HorizontalRule, from);
479
+ return true;
480
+ },
481
+ BulletList(cx, line) {
482
+ let size = isBulletList(line, cx, false);
483
+ if (size < 0)
484
+ return false;
485
+ if (cx.block.type != Type.BulletList)
486
+ cx.startContext(Type.BulletList, line.basePos, line.next);
487
+ let newBase = getListIndent(line, line.pos + 1);
488
+ cx.startContext(Type.ListItem, line.basePos, newBase - line.baseIndent);
489
+ cx.addNode(Type.ListMark, cx.lineStart + line.pos, cx.lineStart + line.pos + size);
490
+ line.moveBaseColumn(newBase);
491
+ return null;
492
+ },
493
+ OrderedList(cx, line) {
494
+ let size = isOrderedList(line, cx, false);
495
+ if (size < 0)
496
+ return false;
497
+ if (cx.block.type != Type.OrderedList)
498
+ cx.startContext(Type.OrderedList, line.basePos, line.text.charCodeAt(line.pos + size - 1));
499
+ let newBase = getListIndent(line, line.pos + size);
500
+ cx.startContext(Type.ListItem, line.basePos, newBase - line.baseIndent);
501
+ cx.addNode(Type.ListMark, cx.lineStart + line.pos, cx.lineStart + line.pos + size);
502
+ line.moveBaseColumn(newBase);
503
+ return null;
504
+ },
505
+ ATXHeading(cx, line) {
506
+ let size = isAtxHeading(line);
507
+ if (size < 0)
508
+ return false;
509
+ let off = line.pos, from = cx.lineStart + off;
510
+ let endOfSpace = skipSpaceBack(line.text, line.text.length, off), after = endOfSpace;
511
+ while (after > off && line.text.charCodeAt(after - 1) == line.next)
512
+ after--;
513
+ if (after == endOfSpace || after == off || !space(line.text.charCodeAt(after - 1)))
514
+ after = line.text.length;
515
+ let buf = cx.buffer.write(Type.HeaderMark, 0, size).writeElements(cx.parser.parseInline(line.text.slice(off + size + 1, after), from + size + 1), -from);
516
+ if (after < line.text.length)
517
+ buf.write(Type.HeaderMark, after - off, endOfSpace - off);
518
+ let node = buf.finish(Type.ATXHeading1 - 1 + size, line.text.length - off);
519
+ cx.nextLine();
520
+ cx.addNode(node, from);
521
+ return true;
522
+ },
523
+ HTMLBlock(cx, line) {
524
+ let type = isHTMLBlock(line, cx, false);
525
+ if (type < 0)
526
+ return false;
527
+ let from = cx.lineStart + line.pos, end = HTMLBlockStyle[type][1];
528
+ let marks = [], trailing = end != EmptyLine;
529
+ while (!end.test(line.text) && cx.nextLine()) {
530
+ if (line.depth < cx.stack.length) {
531
+ trailing = false;
532
+ break;
533
+ }
534
+ for (let m of line.markers)
535
+ marks.push(m);
536
+ }
537
+ if (trailing)
538
+ cx.nextLine();
539
+ let nodeType = end == CommentEnd ? Type.CommentBlock : end == ProcessingEnd ? Type.ProcessingInstructionBlock : Type.HTMLBlock;
540
+ let to = cx.prevLineEnd();
541
+ cx.addNode(cx.buffer.writeElements(marks, -from).finish(nodeType, to - from), from);
542
+ return true;
543
+ },
544
+ SetextHeading: void 0
545
+ // Specifies relative precedence for block-continue function
546
+ };
547
+ var LinkReferenceParser = class {
548
+ constructor(leaf) {
549
+ this.stage = 0;
550
+ this.elts = [];
551
+ this.pos = 0;
552
+ this.start = leaf.start;
553
+ this.advance(leaf.content);
554
+ }
555
+ nextLine(cx, line, leaf) {
556
+ if (this.stage == -1)
557
+ return false;
558
+ let content = leaf.content + "\n" + line.scrub();
559
+ let finish = this.advance(content);
560
+ if (finish > -1 && finish < content.length)
561
+ return this.complete(cx, leaf, finish);
562
+ return false;
563
+ }
564
+ finish(cx, leaf) {
565
+ if ((this.stage == 2 || this.stage == 3) && skipSpace(leaf.content, this.pos) == leaf.content.length)
566
+ return this.complete(cx, leaf, leaf.content.length);
567
+ return false;
568
+ }
569
+ complete(cx, leaf, len) {
570
+ cx.addLeafElement(leaf, elt(Type.LinkReference, this.start, this.start + len, this.elts));
571
+ return true;
572
+ }
573
+ nextStage(elt2) {
574
+ if (elt2) {
575
+ this.pos = elt2.to - this.start;
576
+ this.elts.push(elt2);
577
+ this.stage++;
578
+ return true;
579
+ }
580
+ if (elt2 === false)
581
+ this.stage = -1;
582
+ return false;
583
+ }
584
+ advance(content) {
585
+ for (; ; ) {
586
+ if (this.stage == -1) {
587
+ return -1;
588
+ } else if (this.stage == 0) {
589
+ if (!this.nextStage(parseLinkLabel(content, this.pos, this.start, true)))
590
+ return -1;
591
+ if (content.charCodeAt(this.pos) != 58)
592
+ return this.stage = -1;
593
+ this.elts.push(elt(Type.LinkMark, this.pos + this.start, this.pos + this.start + 1));
594
+ this.pos++;
595
+ } else if (this.stage == 1) {
596
+ if (!this.nextStage(parseURL(content, skipSpace(content, this.pos), this.start)))
597
+ return -1;
598
+ } else if (this.stage == 2) {
599
+ let skip = skipSpace(content, this.pos), end = 0;
600
+ if (skip > this.pos) {
601
+ let title = parseLinkTitle(content, skip, this.start);
602
+ if (title) {
603
+ let titleEnd = lineEnd(content, title.to - this.start);
604
+ if (titleEnd > 0) {
605
+ this.nextStage(title);
606
+ end = titleEnd;
607
+ }
608
+ }
609
+ }
610
+ if (!end)
611
+ end = lineEnd(content, this.pos);
612
+ return end > 0 && end < content.length ? end : -1;
613
+ } else {
614
+ return lineEnd(content, this.pos);
615
+ }
616
+ }
617
+ }
618
+ };
619
+ function lineEnd(text, pos) {
620
+ for (; pos < text.length; pos++) {
621
+ let next = text.charCodeAt(pos);
622
+ if (next == 10)
623
+ break;
624
+ if (!space(next))
625
+ return -1;
626
+ }
627
+ return pos;
628
+ }
629
+ var SetextHeadingParser = class {
630
+ nextLine(cx, line, leaf) {
631
+ let underline = line.depth < cx.stack.length ? -1 : isSetextUnderline(line);
632
+ let next = line.next;
633
+ if (underline < 0)
634
+ return false;
635
+ let underlineMark = elt(Type.HeaderMark, cx.lineStart + line.pos, cx.lineStart + underline);
636
+ cx.nextLine();
637
+ cx.addLeafElement(leaf, elt(next == 61 ? Type.SetextHeading1 : Type.SetextHeading2, leaf.start, cx.prevLineEnd(), [
638
+ ...cx.parser.parseInline(leaf.content, leaf.start),
639
+ underlineMark
640
+ ]));
641
+ return true;
642
+ }
643
+ finish() {
644
+ return false;
645
+ }
646
+ };
647
+ var DefaultLeafBlocks = {
648
+ LinkReference(_, leaf) {
649
+ return leaf.content.charCodeAt(0) == 91 ? new LinkReferenceParser(leaf) : null;
650
+ },
651
+ SetextHeading() {
652
+ return new SetextHeadingParser();
653
+ }
654
+ };
655
+ var DefaultEndLeaf = [
656
+ (_, line) => isAtxHeading(line) >= 0,
657
+ (_, line) => isFencedCode(line) >= 0,
658
+ (_, line) => isBlockquote(line) >= 0,
659
+ (p, line) => isBulletList(line, p, true) >= 0,
660
+ (p, line) => isOrderedList(line, p, true) >= 0,
661
+ (p, line) => isHorizontalRule(line, p, true) >= 0,
662
+ (p, line) => isHTMLBlock(line, p, true) >= 0
663
+ ];
664
+ var scanLineResult = { text: "", end: 0 };
665
+ var BlockContext = class {
666
+ /**
667
+ @internal
668
+ */
669
+ constructor(parser2, input, fragments, ranges) {
670
+ this.parser = parser2;
671
+ this.input = input;
672
+ this.ranges = ranges;
673
+ this.line = new Line();
674
+ this.atEnd = false;
675
+ this.reusePlaceholders = /* @__PURE__ */ new Map();
676
+ this.stoppedAt = null;
677
+ this.rangeI = 0;
678
+ this.to = ranges[ranges.length - 1].to;
679
+ this.lineStart = this.absoluteLineStart = this.absoluteLineEnd = ranges[0].from;
680
+ this.block = CompositeBlock.create(Type.Document, 0, this.lineStart, 0, 0);
681
+ this.stack = [this.block];
682
+ this.fragments = fragments.length ? new FragmentCursor(fragments, input) : null;
683
+ this.readLine();
684
+ }
685
+ get parsedPos() {
686
+ return this.absoluteLineStart;
687
+ }
688
+ advance() {
689
+ if (this.stoppedAt != null && this.absoluteLineStart > this.stoppedAt)
690
+ return this.finish();
691
+ let { line } = this;
692
+ for (; ; ) {
693
+ for (let markI = 0; ; ) {
694
+ let next = line.depth < this.stack.length ? this.stack[this.stack.length - 1] : null;
695
+ while (markI < line.markers.length && (!next || line.markers[markI].from < next.end)) {
696
+ let mark = line.markers[markI++];
697
+ this.addNode(mark.type, mark.from, mark.to);
698
+ }
699
+ if (!next)
700
+ break;
701
+ this.finishContext();
702
+ }
703
+ if (line.pos < line.text.length)
704
+ break;
705
+ if (!this.nextLine())
706
+ return this.finish();
707
+ }
708
+ if (this.fragments && this.reuseFragment(line.basePos))
709
+ return null;
710
+ start: for (; ; ) {
711
+ for (let type of this.parser.blockParsers)
712
+ if (type) {
713
+ let result = type(this, line);
714
+ if (result != false) {
715
+ if (result == true)
716
+ return null;
717
+ line.forward();
718
+ continue start;
719
+ }
720
+ }
721
+ break;
722
+ }
723
+ if (line.pos == line.text.length)
724
+ return this.nextLine() ? null : this.finish();
725
+ let leaf = new LeafBlock(this.lineStart + line.pos, line.text.slice(line.pos));
726
+ for (let parse of this.parser.leafBlockParsers)
727
+ if (parse) {
728
+ let parser2 = parse(this, leaf);
729
+ if (parser2)
730
+ leaf.parsers.push(parser2);
731
+ }
732
+ lines: while (this.nextLine()) {
733
+ if (line.pos == line.text.length)
734
+ break;
735
+ if (line.indent < line.baseIndent + 4) {
736
+ for (let stop of this.parser.endLeafBlock)
737
+ if (stop(this, line, leaf))
738
+ break lines;
739
+ }
740
+ for (let parser2 of leaf.parsers)
741
+ if (parser2.nextLine(this, line, leaf))
742
+ return null;
743
+ leaf.content += "\n" + line.scrub();
744
+ for (let m of line.markers)
745
+ leaf.marks.push(m);
746
+ }
747
+ this.finishLeaf(leaf);
748
+ return null;
749
+ }
750
+ stopAt(pos) {
751
+ if (this.stoppedAt != null && this.stoppedAt < pos)
752
+ throw new RangeError("Can't move stoppedAt forward");
753
+ this.stoppedAt = pos;
754
+ }
755
+ reuseFragment(start) {
756
+ if (!this.fragments.moveTo(this.absoluteLineStart + start, this.absoluteLineStart) || !this.fragments.matches(this.block.hash))
757
+ return false;
758
+ let taken = this.fragments.takeNodes(this);
759
+ if (!taken)
760
+ return false;
761
+ this.absoluteLineStart += taken;
762
+ this.lineStart = toRelative(this.absoluteLineStart, this.ranges);
763
+ this.moveRangeI();
764
+ if (this.absoluteLineStart < this.to) {
765
+ this.lineStart++;
766
+ this.absoluteLineStart++;
767
+ this.readLine();
768
+ } else {
769
+ this.atEnd = true;
770
+ this.readLine();
771
+ }
772
+ return true;
773
+ }
774
+ /**
775
+ The number of parent blocks surrounding the current block.
776
+ */
777
+ get depth() {
778
+ return this.stack.length;
779
+ }
780
+ /**
781
+ Get the type of the parent block at the given depth. When no
782
+ depth is passed, return the type of the innermost parent.
783
+ */
784
+ parentType(depth = this.depth - 1) {
785
+ return this.parser.nodeSet.types[this.stack[depth].type];
786
+ }
787
+ /**
788
+ Move to the next input line. This should only be called by
789
+ (non-composite) [block parsers](#BlockParser.parse) that consume
790
+ the line directly, or leaf block parser
791
+ [`nextLine`](#LeafBlockParser.nextLine) methods when they
792
+ consume the current line (and return true).
793
+ */
794
+ nextLine() {
795
+ this.lineStart += this.line.text.length;
796
+ if (this.absoluteLineEnd >= this.to) {
797
+ this.absoluteLineStart = this.absoluteLineEnd;
798
+ this.atEnd = true;
799
+ this.readLine();
800
+ return false;
801
+ } else {
802
+ this.lineStart++;
803
+ this.absoluteLineStart = this.absoluteLineEnd + 1;
804
+ this.moveRangeI();
805
+ this.readLine();
806
+ return true;
807
+ }
808
+ }
809
+ /**
810
+ Retrieve the text of the line after the current one, without
811
+ actually moving the context's current line forward.
812
+ */
813
+ peekLine() {
814
+ return this.scanLine(this.absoluteLineEnd + 1).text;
815
+ }
816
+ moveRangeI() {
817
+ while (this.rangeI < this.ranges.length - 1 && this.absoluteLineStart >= this.ranges[this.rangeI].to) {
818
+ this.rangeI++;
819
+ this.absoluteLineStart = Math.max(this.absoluteLineStart, this.ranges[this.rangeI].from);
820
+ }
821
+ }
822
+ /**
823
+ @internal
824
+ Collect the text for the next line.
825
+ */
826
+ scanLine(start) {
827
+ let r = scanLineResult;
828
+ r.end = start;
829
+ if (start >= this.to) {
830
+ r.text = "";
831
+ } else {
832
+ r.text = this.lineChunkAt(start);
833
+ r.end += r.text.length;
834
+ if (this.ranges.length > 1) {
835
+ let textOffset = this.absoluteLineStart, rangeI = this.rangeI;
836
+ while (this.ranges[rangeI].to < r.end) {
837
+ rangeI++;
838
+ let nextFrom = this.ranges[rangeI].from;
839
+ let after = this.lineChunkAt(nextFrom);
840
+ r.end = nextFrom + after.length;
841
+ r.text = r.text.slice(0, this.ranges[rangeI - 1].to - textOffset) + after;
842
+ textOffset = r.end - r.text.length;
843
+ }
844
+ }
845
+ }
846
+ return r;
847
+ }
848
+ /**
849
+ @internal
850
+ Populate this.line with the content of the next line. Skip
851
+ leading characters covered by composite blocks.
852
+ */
853
+ readLine() {
854
+ let { line } = this, { text, end } = this.scanLine(this.absoluteLineStart);
855
+ this.absoluteLineEnd = end;
856
+ line.reset(text);
857
+ for (; line.depth < this.stack.length; line.depth++) {
858
+ let cx = this.stack[line.depth], handler = this.parser.skipContextMarkup[cx.type];
859
+ if (!handler)
860
+ throw new Error("Unhandled block context " + Type[cx.type]);
861
+ let marks = this.line.markers.length;
862
+ if (!handler(cx, this, line)) {
863
+ if (this.line.markers.length > marks)
864
+ cx.end = this.line.markers[this.line.markers.length - 1].to;
865
+ line.forward();
866
+ break;
867
+ }
868
+ line.forward();
869
+ }
870
+ }
871
+ lineChunkAt(pos) {
872
+ let next = this.input.chunk(pos), text;
873
+ if (!this.input.lineChunks) {
874
+ let eol = next.indexOf("\n");
875
+ text = eol < 0 ? next : next.slice(0, eol);
876
+ } else {
877
+ text = next == "\n" ? "" : next;
878
+ }
879
+ return pos + text.length > this.to ? text.slice(0, this.to - pos) : text;
880
+ }
881
+ /**
882
+ The end position of the previous line.
883
+ */
884
+ prevLineEnd() {
885
+ return this.atEnd ? this.lineStart : this.lineStart - 1;
886
+ }
887
+ /**
888
+ @internal
889
+ */
890
+ startContext(type, start, value = 0) {
891
+ this.block = CompositeBlock.create(type, value, this.lineStart + start, this.block.hash, this.lineStart + this.line.text.length);
892
+ this.stack.push(this.block);
893
+ }
894
+ /**
895
+ Start a composite block. Should only be called from [block
896
+ parser functions](#BlockParser.parse) that return null.
897
+ */
898
+ startComposite(type, start, value = 0) {
899
+ this.startContext(this.parser.getNodeType(type), start, value);
900
+ }
901
+ /**
902
+ @internal
903
+ */
904
+ addNode(block, from, to) {
905
+ if (typeof block == "number")
906
+ block = new Tree(this.parser.nodeSet.types[block], none, none, (to !== null && to !== void 0 ? to : this.prevLineEnd()) - from);
907
+ this.block.addChild(block, from - this.block.from);
908
+ }
909
+ /**
910
+ Add a block element. Can be called by [block
911
+ parsers](#BlockParser.parse).
912
+ */
913
+ addElement(elt2) {
914
+ this.block.addChild(elt2.toTree(this.parser.nodeSet), elt2.from - this.block.from);
915
+ }
916
+ /**
917
+ Add a block element from a [leaf parser](#LeafBlockParser). This
918
+ makes sure any extra composite block markup (such as blockquote
919
+ markers) inside the block are also added to the syntax tree.
920
+ */
921
+ addLeafElement(leaf, elt2) {
922
+ this.addNode(this.buffer.writeElements(injectMarks(elt2.children, leaf.marks), -elt2.from).finish(elt2.type, elt2.to - elt2.from), elt2.from);
923
+ }
924
+ /**
925
+ @internal
926
+ */
927
+ finishContext() {
928
+ let cx = this.stack.pop();
929
+ let top = this.stack[this.stack.length - 1];
930
+ top.addChild(cx.toTree(this.parser.nodeSet), cx.from - top.from);
931
+ this.block = top;
932
+ }
933
+ finish() {
934
+ while (this.stack.length > 1)
935
+ this.finishContext();
936
+ return this.addGaps(this.block.toTree(this.parser.nodeSet, this.lineStart));
937
+ }
938
+ addGaps(tree) {
939
+ return this.ranges.length > 1 ? injectGaps(this.ranges, 0, tree.topNode, this.ranges[0].from, this.reusePlaceholders) : tree;
940
+ }
941
+ /**
942
+ @internal
943
+ */
944
+ finishLeaf(leaf) {
945
+ for (let parser2 of leaf.parsers)
946
+ if (parser2.finish(this, leaf))
947
+ return;
948
+ let inline = injectMarks(this.parser.parseInline(leaf.content, leaf.start), leaf.marks);
949
+ this.addNode(this.buffer.writeElements(inline, -leaf.start).finish(Type.Paragraph, leaf.content.length), leaf.start);
950
+ }
951
+ elt(type, from, to, children) {
952
+ if (typeof type == "string")
953
+ return elt(this.parser.getNodeType(type), from, to, children);
954
+ return new TreeElement(type, from);
955
+ }
956
+ /**
957
+ @internal
958
+ */
959
+ get buffer() {
960
+ return new Buffer(this.parser.nodeSet);
961
+ }
962
+ };
963
+ function injectGaps(ranges, rangeI, tree, offset, dummies) {
964
+ let rangeEnd = ranges[rangeI].to;
965
+ let children = [], positions = [], start = tree.from + offset;
966
+ function movePastNext(upto, inclusive) {
967
+ while (inclusive ? upto >= rangeEnd : upto > rangeEnd) {
968
+ let size = ranges[rangeI + 1].from - rangeEnd;
969
+ offset += size;
970
+ upto += size;
971
+ rangeI++;
972
+ rangeEnd = ranges[rangeI].to;
973
+ }
974
+ }
975
+ for (let ch = tree.firstChild; ch; ch = ch.nextSibling) {
976
+ movePastNext(ch.from + offset, true);
977
+ let from = ch.from + offset, node, reuse = dummies.get(ch.tree);
978
+ if (reuse) {
979
+ node = reuse;
980
+ } else if (ch.to + offset > rangeEnd) {
981
+ node = injectGaps(ranges, rangeI, ch, offset, dummies);
982
+ movePastNext(ch.to + offset, false);
983
+ } else {
984
+ node = ch.toTree();
985
+ }
986
+ children.push(node);
987
+ positions.push(from - start);
988
+ }
989
+ movePastNext(tree.to + offset, false);
990
+ return new Tree(tree.type, children, positions, tree.to + offset - start, tree.tree ? tree.tree.propValues : void 0);
991
+ }
992
+ var MarkdownParser = class _MarkdownParser extends Parser {
993
+ /**
994
+ @internal
995
+ */
996
+ constructor(nodeSet, blockParsers, leafBlockParsers, blockNames, endLeafBlock, skipContextMarkup, inlineParsers, inlineNames, wrappers) {
997
+ super();
998
+ this.nodeSet = nodeSet;
999
+ this.blockParsers = blockParsers;
1000
+ this.leafBlockParsers = leafBlockParsers;
1001
+ this.blockNames = blockNames;
1002
+ this.endLeafBlock = endLeafBlock;
1003
+ this.skipContextMarkup = skipContextMarkup;
1004
+ this.inlineParsers = inlineParsers;
1005
+ this.inlineNames = inlineNames;
1006
+ this.wrappers = wrappers;
1007
+ this.nodeTypes = /* @__PURE__ */ Object.create(null);
1008
+ for (let t of nodeSet.types)
1009
+ this.nodeTypes[t.name] = t.id;
1010
+ }
1011
+ createParse(input, fragments, ranges) {
1012
+ let parse = new BlockContext(this, input, fragments, ranges);
1013
+ for (let w of this.wrappers)
1014
+ parse = w(parse, input, fragments, ranges);
1015
+ return parse;
1016
+ }
1017
+ /**
1018
+ Reconfigure the parser.
1019
+ */
1020
+ configure(spec) {
1021
+ let config = resolveConfig(spec);
1022
+ if (!config)
1023
+ return this;
1024
+ let { nodeSet, skipContextMarkup } = this;
1025
+ let blockParsers = this.blockParsers.slice(), leafBlockParsers = this.leafBlockParsers.slice(), blockNames = this.blockNames.slice(), inlineParsers = this.inlineParsers.slice(), inlineNames = this.inlineNames.slice(), endLeafBlock = this.endLeafBlock.slice(), wrappers = this.wrappers;
1026
+ if (nonEmpty(config.defineNodes)) {
1027
+ skipContextMarkup = Object.assign({}, skipContextMarkup);
1028
+ let nodeTypes2 = nodeSet.types.slice(), styles;
1029
+ for (let s of config.defineNodes) {
1030
+ let { name, block, composite, style } = typeof s == "string" ? { name: s } : s;
1031
+ if (nodeTypes2.some((t) => t.name == name))
1032
+ continue;
1033
+ if (composite)
1034
+ skipContextMarkup[nodeTypes2.length] = (bl, cx, line) => composite(cx, line, bl.value);
1035
+ let id = nodeTypes2.length;
1036
+ let group = composite ? ["Block", "BlockContext"] : !block ? void 0 : id >= Type.ATXHeading1 && id <= Type.SetextHeading2 ? ["Block", "LeafBlock", "Heading"] : ["Block", "LeafBlock"];
1037
+ nodeTypes2.push(NodeType.define({
1038
+ id,
1039
+ name,
1040
+ props: group && [[NodeProp.group, group]]
1041
+ }));
1042
+ if (style) {
1043
+ if (!styles)
1044
+ styles = {};
1045
+ if (Array.isArray(style) || style instanceof Tag)
1046
+ styles[name] = style;
1047
+ else
1048
+ Object.assign(styles, style);
1049
+ }
1050
+ }
1051
+ nodeSet = new NodeSet(nodeTypes2);
1052
+ if (styles)
1053
+ nodeSet = nodeSet.extend(styleTags(styles));
1054
+ }
1055
+ if (nonEmpty(config.props))
1056
+ nodeSet = nodeSet.extend(...config.props);
1057
+ if (nonEmpty(config.remove)) {
1058
+ for (let rm of config.remove) {
1059
+ let block = this.blockNames.indexOf(rm), inline = this.inlineNames.indexOf(rm);
1060
+ if (block > -1)
1061
+ blockParsers[block] = leafBlockParsers[block] = void 0;
1062
+ if (inline > -1)
1063
+ inlineParsers[inline] = void 0;
1064
+ }
1065
+ }
1066
+ if (nonEmpty(config.parseBlock)) {
1067
+ for (let spec2 of config.parseBlock) {
1068
+ let found = blockNames.indexOf(spec2.name);
1069
+ if (found > -1) {
1070
+ blockParsers[found] = spec2.parse;
1071
+ leafBlockParsers[found] = spec2.leaf;
1072
+ } else {
1073
+ let pos = spec2.before ? findName(blockNames, spec2.before) : spec2.after ? findName(blockNames, spec2.after) + 1 : blockNames.length - 1;
1074
+ blockParsers.splice(pos, 0, spec2.parse);
1075
+ leafBlockParsers.splice(pos, 0, spec2.leaf);
1076
+ blockNames.splice(pos, 0, spec2.name);
1077
+ }
1078
+ if (spec2.endLeaf)
1079
+ endLeafBlock.push(spec2.endLeaf);
1080
+ }
1081
+ }
1082
+ if (nonEmpty(config.parseInline)) {
1083
+ for (let spec2 of config.parseInline) {
1084
+ let found = inlineNames.indexOf(spec2.name);
1085
+ if (found > -1) {
1086
+ inlineParsers[found] = spec2.parse;
1087
+ } else {
1088
+ let pos = spec2.before ? findName(inlineNames, spec2.before) : spec2.after ? findName(inlineNames, spec2.after) + 1 : inlineNames.length - 1;
1089
+ inlineParsers.splice(pos, 0, spec2.parse);
1090
+ inlineNames.splice(pos, 0, spec2.name);
1091
+ }
1092
+ }
1093
+ }
1094
+ if (config.wrap)
1095
+ wrappers = wrappers.concat(config.wrap);
1096
+ return new _MarkdownParser(nodeSet, blockParsers, leafBlockParsers, blockNames, endLeafBlock, skipContextMarkup, inlineParsers, inlineNames, wrappers);
1097
+ }
1098
+ /**
1099
+ @internal
1100
+ */
1101
+ getNodeType(name) {
1102
+ let found = this.nodeTypes[name];
1103
+ if (found == null)
1104
+ throw new RangeError(`Unknown node type '${name}'`);
1105
+ return found;
1106
+ }
1107
+ /**
1108
+ Parse the given piece of inline text at the given offset,
1109
+ returning an array of [`Element`](#Element) objects representing
1110
+ the inline content.
1111
+ */
1112
+ parseInline(text, offset) {
1113
+ let cx = new InlineContext(this, text, offset);
1114
+ outer: for (let pos = offset; pos < cx.end; ) {
1115
+ let next = cx.char(pos);
1116
+ for (let token of this.inlineParsers)
1117
+ if (token) {
1118
+ let result = token(cx, next, pos);
1119
+ if (result >= 0) {
1120
+ pos = result;
1121
+ continue outer;
1122
+ }
1123
+ }
1124
+ pos++;
1125
+ }
1126
+ return cx.resolveMarkers(0);
1127
+ }
1128
+ };
1129
+ function nonEmpty(a) {
1130
+ return a != null && a.length > 0;
1131
+ }
1132
+ function resolveConfig(spec) {
1133
+ if (!Array.isArray(spec))
1134
+ return spec;
1135
+ if (spec.length == 0)
1136
+ return null;
1137
+ let conf = resolveConfig(spec[0]);
1138
+ if (spec.length == 1)
1139
+ return conf;
1140
+ let rest = resolveConfig(spec.slice(1));
1141
+ if (!rest || !conf)
1142
+ return conf || rest;
1143
+ let conc = (a, b) => (a || none).concat(b || none);
1144
+ let wrapA = conf.wrap, wrapB = rest.wrap;
1145
+ return {
1146
+ props: conc(conf.props, rest.props),
1147
+ defineNodes: conc(conf.defineNodes, rest.defineNodes),
1148
+ parseBlock: conc(conf.parseBlock, rest.parseBlock),
1149
+ parseInline: conc(conf.parseInline, rest.parseInline),
1150
+ remove: conc(conf.remove, rest.remove),
1151
+ wrap: !wrapA ? wrapB : !wrapB ? wrapA : (inner, input, fragments, ranges) => wrapA(wrapB(inner, input, fragments, ranges), input, fragments, ranges)
1152
+ };
1153
+ }
1154
+ function findName(names, name) {
1155
+ let found = names.indexOf(name);
1156
+ if (found < 0)
1157
+ throw new RangeError(`Position specified relative to unknown parser ${name}`);
1158
+ return found;
1159
+ }
1160
+ var nodeTypes = [NodeType.none];
1161
+ for (let i = 1, name; name = Type[i]; i++) {
1162
+ nodeTypes[i] = NodeType.define({
1163
+ id: i,
1164
+ name,
1165
+ props: i >= Type.Escape ? [] : [[NodeProp.group, i in DefaultSkipMarkup ? ["Block", "BlockContext"] : ["Block", "LeafBlock"]]],
1166
+ top: name == "Document"
1167
+ });
1168
+ }
1169
+ var none = [];
1170
+ var Buffer = class {
1171
+ constructor(nodeSet) {
1172
+ this.nodeSet = nodeSet;
1173
+ this.content = [];
1174
+ this.nodes = [];
1175
+ }
1176
+ write(type, from, to, children = 0) {
1177
+ this.content.push(type, from, to, 4 + children * 4);
1178
+ return this;
1179
+ }
1180
+ writeElements(elts, offset = 0) {
1181
+ for (let e of elts)
1182
+ e.writeTo(this, offset);
1183
+ return this;
1184
+ }
1185
+ finish(type, length) {
1186
+ return Tree.build({
1187
+ buffer: this.content,
1188
+ nodeSet: this.nodeSet,
1189
+ reused: this.nodes,
1190
+ topID: type,
1191
+ length
1192
+ });
1193
+ }
1194
+ };
1195
+ var Element = class {
1196
+ /**
1197
+ @internal
1198
+ */
1199
+ constructor(type, from, to, children = none) {
1200
+ this.type = type;
1201
+ this.from = from;
1202
+ this.to = to;
1203
+ this.children = children;
1204
+ }
1205
+ /**
1206
+ @internal
1207
+ */
1208
+ writeTo(buf, offset) {
1209
+ let startOff = buf.content.length;
1210
+ buf.writeElements(this.children, offset);
1211
+ buf.content.push(this.type, this.from + offset, this.to + offset, buf.content.length + 4 - startOff);
1212
+ }
1213
+ /**
1214
+ @internal
1215
+ */
1216
+ toTree(nodeSet) {
1217
+ return new Buffer(nodeSet).writeElements(this.children, -this.from).finish(this.type, this.to - this.from);
1218
+ }
1219
+ };
1220
+ var TreeElement = class {
1221
+ constructor(tree, from) {
1222
+ this.tree = tree;
1223
+ this.from = from;
1224
+ }
1225
+ get to() {
1226
+ return this.from + this.tree.length;
1227
+ }
1228
+ get type() {
1229
+ return this.tree.type.id;
1230
+ }
1231
+ get children() {
1232
+ return none;
1233
+ }
1234
+ writeTo(buf, offset) {
1235
+ buf.nodes.push(this.tree);
1236
+ buf.content.push(buf.nodes.length - 1, this.from + offset, this.to + offset, -1);
1237
+ }
1238
+ toTree() {
1239
+ return this.tree;
1240
+ }
1241
+ };
1242
+ function elt(type, from, to, children) {
1243
+ return new Element(type, from, to, children);
1244
+ }
1245
+ var EmphasisUnderscore = { resolve: "Emphasis", mark: "EmphasisMark" };
1246
+ var EmphasisAsterisk = { resolve: "Emphasis", mark: "EmphasisMark" };
1247
+ var LinkStart = {};
1248
+ var ImageStart = {};
1249
+ var InlineDelimiter = class {
1250
+ constructor(type, from, to, side) {
1251
+ this.type = type;
1252
+ this.from = from;
1253
+ this.to = to;
1254
+ this.side = side;
1255
+ }
1256
+ };
1257
+ var Escapable = "!\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~";
1258
+ var Punctuation = /[!"#$%&'()*+,\-.\/:;<=>?@\[\\\]^_`{|}~\xA1\u2010-\u2027]/;
1259
+ try {
1260
+ Punctuation = new RegExp("[\\p{S}|\\p{P}]", "u");
1261
+ } catch (_) {
1262
+ }
1263
+ var DefaultInline = {
1264
+ Escape(cx, next, start) {
1265
+ if (next != 92 || start == cx.end - 1)
1266
+ return -1;
1267
+ let escaped = cx.char(start + 1);
1268
+ for (let i = 0; i < Escapable.length; i++)
1269
+ if (Escapable.charCodeAt(i) == escaped)
1270
+ return cx.append(elt(Type.Escape, start, start + 2));
1271
+ return -1;
1272
+ },
1273
+ Entity(cx, next, start) {
1274
+ if (next != 38)
1275
+ return -1;
1276
+ let m = /^(?:#\d+|#x[a-f\d]+|\w+);/i.exec(cx.slice(start + 1, start + 31));
1277
+ return m ? cx.append(elt(Type.Entity, start, start + 1 + m[0].length)) : -1;
1278
+ },
1279
+ InlineCode(cx, next, start) {
1280
+ if (next != 96 || start && cx.char(start - 1) == 96)
1281
+ return -1;
1282
+ let pos = start + 1;
1283
+ while (pos < cx.end && cx.char(pos) == 96)
1284
+ pos++;
1285
+ let size = pos - start, curSize = 0;
1286
+ for (; pos < cx.end; pos++) {
1287
+ if (cx.char(pos) == 96) {
1288
+ curSize++;
1289
+ if (curSize == size && cx.char(pos + 1) != 96)
1290
+ return cx.append(elt(Type.InlineCode, start, pos + 1, [
1291
+ elt(Type.CodeMark, start, start + size),
1292
+ elt(Type.CodeMark, pos + 1 - size, pos + 1)
1293
+ ]));
1294
+ } else {
1295
+ curSize = 0;
1296
+ }
1297
+ }
1298
+ return -1;
1299
+ },
1300
+ HTMLTag(cx, next, start) {
1301
+ if (next != 60 || start == cx.end - 1)
1302
+ return -1;
1303
+ let after = cx.slice(start + 1, cx.end);
1304
+ let url = /^(?:[a-z][-\w+.]+:[^\s>]+|[a-z\d.!#$%&'*+/=?^_`{|}~-]+@[a-z\d](?:[a-z\d-]{0,61}[a-z\d])?(?:\.[a-z\d](?:[a-z\d-]{0,61}[a-z\d])?)*)>/i.exec(after);
1305
+ if (url) {
1306
+ return cx.append(elt(Type.Autolink, start, start + 1 + url[0].length, [
1307
+ elt(Type.LinkMark, start, start + 1),
1308
+ // url[0] includes the closing bracket, so exclude it from this slice
1309
+ elt(Type.URL, start + 1, start + url[0].length),
1310
+ elt(Type.LinkMark, start + url[0].length, start + 1 + url[0].length)
1311
+ ]));
1312
+ }
1313
+ let comment = /^!--[^>](?:-[^-]|[^-])*?-->/i.exec(after);
1314
+ if (comment)
1315
+ return cx.append(elt(Type.Comment, start, start + 1 + comment[0].length));
1316
+ let procInst = /^\?[^]*?\?>/.exec(after);
1317
+ if (procInst)
1318
+ return cx.append(elt(Type.ProcessingInstruction, start, start + 1 + procInst[0].length));
1319
+ let m = /^(?:![A-Z][^]*?>|!\[CDATA\[[^]*?\]\]>|\/\s*[a-zA-Z][\w-]*\s*>|\s*[a-zA-Z][\w-]*(\s+[a-zA-Z:_][\w-.:]*(?:\s*=\s*(?:[^\s"'=<>`]+|'[^']*'|"[^"]*"))?)*\s*(\/\s*)?>)/.exec(after);
1320
+ if (!m)
1321
+ return -1;
1322
+ return cx.append(elt(Type.HTMLTag, start, start + 1 + m[0].length));
1323
+ },
1324
+ Emphasis(cx, next, start) {
1325
+ if (next != 95 && next != 42)
1326
+ return -1;
1327
+ let pos = start + 1;
1328
+ while (cx.char(pos) == next)
1329
+ pos++;
1330
+ let before = cx.slice(start - 1, start), after = cx.slice(pos, pos + 1);
1331
+ let pBefore = Punctuation.test(before), pAfter = Punctuation.test(after);
1332
+ let sBefore = /\s|^$/.test(before), sAfter = /\s|^$/.test(after);
1333
+ let leftFlanking = !sAfter && (!pAfter || sBefore || pBefore);
1334
+ let rightFlanking = !sBefore && (!pBefore || sAfter || pAfter);
1335
+ let canOpen = leftFlanking && (next == 42 || !rightFlanking || pBefore);
1336
+ let canClose = rightFlanking && (next == 42 || !leftFlanking || pAfter);
1337
+ return cx.append(new InlineDelimiter(next == 95 ? EmphasisUnderscore : EmphasisAsterisk, start, pos, (canOpen ? 1 : 0) | (canClose ? 2 : 0)));
1338
+ },
1339
+ HardBreak(cx, next, start) {
1340
+ if (next == 92 && cx.char(start + 1) == 10)
1341
+ return cx.append(elt(Type.HardBreak, start, start + 2));
1342
+ if (next == 32) {
1343
+ let pos = start + 1;
1344
+ while (cx.char(pos) == 32)
1345
+ pos++;
1346
+ if (cx.char(pos) == 10 && pos >= start + 2)
1347
+ return cx.append(elt(Type.HardBreak, start, pos + 1));
1348
+ }
1349
+ return -1;
1350
+ },
1351
+ Link(cx, next, start) {
1352
+ return next == 91 ? cx.append(new InlineDelimiter(
1353
+ LinkStart,
1354
+ start,
1355
+ start + 1,
1356
+ 1
1357
+ /* Mark.Open */
1358
+ )) : -1;
1359
+ },
1360
+ Image(cx, next, start) {
1361
+ return next == 33 && cx.char(start + 1) == 91 ? cx.append(new InlineDelimiter(
1362
+ ImageStart,
1363
+ start,
1364
+ start + 2,
1365
+ 1
1366
+ /* Mark.Open */
1367
+ )) : -1;
1368
+ },
1369
+ LinkEnd(cx, next, start) {
1370
+ if (next != 93)
1371
+ return -1;
1372
+ for (let i = cx.parts.length - 1; i >= 0; i--) {
1373
+ let part = cx.parts[i];
1374
+ if (part instanceof InlineDelimiter && (part.type == LinkStart || part.type == ImageStart)) {
1375
+ if (!part.side || cx.skipSpace(part.to) == start && !/[(\[]/.test(cx.slice(start + 1, start + 2))) {
1376
+ cx.parts[i] = null;
1377
+ return -1;
1378
+ }
1379
+ let content = cx.takeContent(i);
1380
+ let link = cx.parts[i] = finishLink(cx, content, part.type == LinkStart ? Type.Link : Type.Image, part.from, start + 1);
1381
+ if (part.type == LinkStart)
1382
+ for (let j = 0; j < i; j++) {
1383
+ let p = cx.parts[j];
1384
+ if (p instanceof InlineDelimiter && p.type == LinkStart)
1385
+ p.side = 0;
1386
+ }
1387
+ return link.to;
1388
+ }
1389
+ }
1390
+ return -1;
1391
+ }
1392
+ };
1393
+ function finishLink(cx, content, type, start, startPos) {
1394
+ let { text } = cx, next = cx.char(startPos), endPos = startPos;
1395
+ content.unshift(elt(Type.LinkMark, start, start + (type == Type.Image ? 2 : 1)));
1396
+ content.push(elt(Type.LinkMark, startPos - 1, startPos));
1397
+ if (next == 40) {
1398
+ let pos = cx.skipSpace(startPos + 1);
1399
+ let dest = parseURL(text, pos - cx.offset, cx.offset), title;
1400
+ if (dest) {
1401
+ pos = cx.skipSpace(dest.to);
1402
+ if (pos != dest.to) {
1403
+ title = parseLinkTitle(text, pos - cx.offset, cx.offset);
1404
+ if (title)
1405
+ pos = cx.skipSpace(title.to);
1406
+ }
1407
+ }
1408
+ if (cx.char(pos) == 41) {
1409
+ content.push(elt(Type.LinkMark, startPos, startPos + 1));
1410
+ endPos = pos + 1;
1411
+ if (dest)
1412
+ content.push(dest);
1413
+ if (title)
1414
+ content.push(title);
1415
+ content.push(elt(Type.LinkMark, pos, endPos));
1416
+ }
1417
+ } else if (next == 91) {
1418
+ let label = parseLinkLabel(text, startPos - cx.offset, cx.offset, false);
1419
+ if (label) {
1420
+ content.push(label);
1421
+ endPos = label.to;
1422
+ }
1423
+ }
1424
+ return elt(type, start, endPos, content);
1425
+ }
1426
+ function parseURL(text, start, offset) {
1427
+ let next = text.charCodeAt(start);
1428
+ if (next == 60) {
1429
+ for (let pos = start + 1; pos < text.length; pos++) {
1430
+ let ch = text.charCodeAt(pos);
1431
+ if (ch == 62)
1432
+ return elt(Type.URL, start + offset, pos + 1 + offset);
1433
+ if (ch == 60 || ch == 10)
1434
+ return false;
1435
+ }
1436
+ return null;
1437
+ } else {
1438
+ let depth = 0, pos = start;
1439
+ for (let escaped = false; pos < text.length; pos++) {
1440
+ let ch = text.charCodeAt(pos);
1441
+ if (space(ch)) {
1442
+ break;
1443
+ } else if (escaped) {
1444
+ escaped = false;
1445
+ } else if (ch == 40) {
1446
+ depth++;
1447
+ } else if (ch == 41) {
1448
+ if (!depth)
1449
+ break;
1450
+ depth--;
1451
+ } else if (ch == 92) {
1452
+ escaped = true;
1453
+ }
1454
+ }
1455
+ return pos > start ? elt(Type.URL, start + offset, pos + offset) : pos == text.length ? null : false;
1456
+ }
1457
+ }
1458
+ function parseLinkTitle(text, start, offset) {
1459
+ let next = text.charCodeAt(start);
1460
+ if (next != 39 && next != 34 && next != 40)
1461
+ return false;
1462
+ let end = next == 40 ? 41 : next;
1463
+ for (let pos = start + 1, escaped = false; pos < text.length; pos++) {
1464
+ let ch = text.charCodeAt(pos);
1465
+ if (escaped)
1466
+ escaped = false;
1467
+ else if (ch == end)
1468
+ return elt(Type.LinkTitle, start + offset, pos + 1 + offset);
1469
+ else if (ch == 92)
1470
+ escaped = true;
1471
+ }
1472
+ return null;
1473
+ }
1474
+ function parseLinkLabel(text, start, offset, requireNonWS) {
1475
+ for (let escaped = false, pos = start + 1, end = Math.min(text.length, pos + 999); pos < end; pos++) {
1476
+ let ch = text.charCodeAt(pos);
1477
+ if (escaped)
1478
+ escaped = false;
1479
+ else if (ch == 93)
1480
+ return requireNonWS ? false : elt(Type.LinkLabel, start + offset, pos + 1 + offset);
1481
+ else {
1482
+ if (requireNonWS && !space(ch))
1483
+ requireNonWS = false;
1484
+ if (ch == 91)
1485
+ return false;
1486
+ else if (ch == 92)
1487
+ escaped = true;
1488
+ }
1489
+ }
1490
+ return null;
1491
+ }
1492
+ var InlineContext = class {
1493
+ /**
1494
+ @internal
1495
+ */
1496
+ constructor(parser2, text, offset) {
1497
+ this.parser = parser2;
1498
+ this.text = text;
1499
+ this.offset = offset;
1500
+ this.parts = [];
1501
+ }
1502
+ /**
1503
+ Get the character code at the given (document-relative)
1504
+ position.
1505
+ */
1506
+ char(pos) {
1507
+ return pos >= this.end ? -1 : this.text.charCodeAt(pos - this.offset);
1508
+ }
1509
+ /**
1510
+ The position of the end of this inline section.
1511
+ */
1512
+ get end() {
1513
+ return this.offset + this.text.length;
1514
+ }
1515
+ /**
1516
+ Get a substring of this inline section. Again uses
1517
+ document-relative positions.
1518
+ */
1519
+ slice(from, to) {
1520
+ return this.text.slice(from - this.offset, to - this.offset);
1521
+ }
1522
+ /**
1523
+ @internal
1524
+ */
1525
+ append(elt2) {
1526
+ this.parts.push(elt2);
1527
+ return elt2.to;
1528
+ }
1529
+ /**
1530
+ Add a [delimiter](#DelimiterType) at this given position. `open`
1531
+ and `close` indicate whether this delimiter is opening, closing,
1532
+ or both. Returns the end of the delimiter, for convenient
1533
+ returning from [parse functions](#InlineParser.parse).
1534
+ */
1535
+ addDelimiter(type, from, to, open, close) {
1536
+ return this.append(new InlineDelimiter(type, from, to, (open ? 1 : 0) | (close ? 2 : 0)));
1537
+ }
1538
+ /**
1539
+ Returns true when there is an unmatched link or image opening
1540
+ token before the current position.
1541
+ */
1542
+ get hasOpenLink() {
1543
+ for (let i = this.parts.length - 1; i >= 0; i--) {
1544
+ let part = this.parts[i];
1545
+ if (part instanceof InlineDelimiter && (part.type == LinkStart || part.type == ImageStart))
1546
+ return true;
1547
+ }
1548
+ return false;
1549
+ }
1550
+ /**
1551
+ Add an inline element. Returns the end of the element.
1552
+ */
1553
+ addElement(elt2) {
1554
+ return this.append(elt2);
1555
+ }
1556
+ /**
1557
+ Resolve markers between this.parts.length and from, wrapping matched markers in the
1558
+ appropriate node and updating the content of this.parts. @internal
1559
+ */
1560
+ resolveMarkers(from) {
1561
+ for (let i = from; i < this.parts.length; i++) {
1562
+ let close = this.parts[i];
1563
+ if (!(close instanceof InlineDelimiter && close.type.resolve && close.side & 2))
1564
+ continue;
1565
+ let emp = close.type == EmphasisUnderscore || close.type == EmphasisAsterisk;
1566
+ let closeSize = close.to - close.from;
1567
+ let open, j = i - 1;
1568
+ for (; j >= from; j--) {
1569
+ let part = this.parts[j];
1570
+ if (part instanceof InlineDelimiter && part.side & 1 && part.type == close.type && // Ignore emphasis delimiters where the character count doesn't match
1571
+ !(emp && (close.side & 1 || part.side & 2) && (part.to - part.from + closeSize) % 3 == 0 && ((part.to - part.from) % 3 || closeSize % 3))) {
1572
+ open = part;
1573
+ break;
1574
+ }
1575
+ }
1576
+ if (!open)
1577
+ continue;
1578
+ let type = close.type.resolve, content = [];
1579
+ let start = open.from, end = close.to;
1580
+ if (emp) {
1581
+ let size = Math.min(2, open.to - open.from, closeSize);
1582
+ start = open.to - size;
1583
+ end = close.from + size;
1584
+ type = size == 1 ? "Emphasis" : "StrongEmphasis";
1585
+ }
1586
+ if (open.type.mark)
1587
+ content.push(this.elt(open.type.mark, start, open.to));
1588
+ for (let k = j + 1; k < i; k++) {
1589
+ if (this.parts[k] instanceof Element)
1590
+ content.push(this.parts[k]);
1591
+ this.parts[k] = null;
1592
+ }
1593
+ if (close.type.mark)
1594
+ content.push(this.elt(close.type.mark, close.from, end));
1595
+ let element = this.elt(type, start, end, content);
1596
+ this.parts[j] = emp && open.from != start ? new InlineDelimiter(open.type, open.from, start, open.side) : null;
1597
+ let keep = this.parts[i] = emp && close.to != end ? new InlineDelimiter(close.type, end, close.to, close.side) : null;
1598
+ if (keep)
1599
+ this.parts.splice(i, 0, element);
1600
+ else
1601
+ this.parts[i] = element;
1602
+ }
1603
+ let result = [];
1604
+ for (let i = from; i < this.parts.length; i++) {
1605
+ let part = this.parts[i];
1606
+ if (part instanceof Element)
1607
+ result.push(part);
1608
+ }
1609
+ return result;
1610
+ }
1611
+ /**
1612
+ Find an opening delimiter of the given type. Returns `null` if
1613
+ no delimiter is found, or an index that can be passed to
1614
+ [`takeContent`](#InlineContext.takeContent) otherwise.
1615
+ */
1616
+ findOpeningDelimiter(type) {
1617
+ for (let i = this.parts.length - 1; i >= 0; i--) {
1618
+ let part = this.parts[i];
1619
+ if (part instanceof InlineDelimiter && part.type == type && part.side & 1)
1620
+ return i;
1621
+ }
1622
+ return null;
1623
+ }
1624
+ /**
1625
+ Remove all inline elements and delimiters starting from the
1626
+ given index (which you should get from
1627
+ [`findOpeningDelimiter`](#InlineContext.findOpeningDelimiter),
1628
+ resolve delimiters inside of them, and return them as an array
1629
+ of elements.
1630
+ */
1631
+ takeContent(startIndex) {
1632
+ let content = this.resolveMarkers(startIndex);
1633
+ this.parts.length = startIndex;
1634
+ return content;
1635
+ }
1636
+ /**
1637
+ Return the delimiter at the given index. Mostly useful to get
1638
+ additional info out of a delimiter index returned by
1639
+ [`findOpeningDelimiter`](#InlineContext.findOpeningDelimiter).
1640
+ Returns null if there is no delimiter at this index.
1641
+ */
1642
+ getDelimiterAt(index) {
1643
+ let part = this.parts[index];
1644
+ return part instanceof InlineDelimiter ? part : null;
1645
+ }
1646
+ /**
1647
+ Skip space after the given (document) position, returning either
1648
+ the position of the next non-space character or the end of the
1649
+ section.
1650
+ */
1651
+ skipSpace(from) {
1652
+ return skipSpace(this.text, from - this.offset) + this.offset;
1653
+ }
1654
+ elt(type, from, to, children) {
1655
+ if (typeof type == "string")
1656
+ return elt(this.parser.getNodeType(type), from, to, children);
1657
+ return new TreeElement(type, from);
1658
+ }
1659
+ };
1660
+ InlineContext.linkStart = LinkStart;
1661
+ InlineContext.imageStart = ImageStart;
1662
+ function injectMarks(elements, marks) {
1663
+ if (!marks.length)
1664
+ return elements;
1665
+ if (!elements.length)
1666
+ return marks;
1667
+ let elts = elements.slice(), eI = 0;
1668
+ for (let mark of marks) {
1669
+ while (eI < elts.length && elts[eI].to < mark.to)
1670
+ eI++;
1671
+ if (eI < elts.length && elts[eI].from < mark.from) {
1672
+ let e = elts[eI];
1673
+ if (e instanceof Element)
1674
+ elts[eI] = new Element(e.type, e.from, e.to, injectMarks(e.children, [mark]));
1675
+ } else {
1676
+ elts.splice(eI++, 0, mark);
1677
+ }
1678
+ }
1679
+ return elts;
1680
+ }
1681
+ var NotLast = [Type.CodeBlock, Type.ListItem, Type.OrderedList, Type.BulletList];
1682
+ var FragmentCursor = class {
1683
+ constructor(fragments, input) {
1684
+ this.fragments = fragments;
1685
+ this.input = input;
1686
+ this.i = 0;
1687
+ this.fragment = null;
1688
+ this.fragmentEnd = -1;
1689
+ this.cursor = null;
1690
+ if (fragments.length)
1691
+ this.fragment = fragments[this.i++];
1692
+ }
1693
+ nextFragment() {
1694
+ this.fragment = this.i < this.fragments.length ? this.fragments[this.i++] : null;
1695
+ this.cursor = null;
1696
+ this.fragmentEnd = -1;
1697
+ }
1698
+ moveTo(pos, lineStart) {
1699
+ while (this.fragment && this.fragment.to <= pos)
1700
+ this.nextFragment();
1701
+ if (!this.fragment || this.fragment.from > (pos ? pos - 1 : 0))
1702
+ return false;
1703
+ if (this.fragmentEnd < 0) {
1704
+ let end = this.fragment.to;
1705
+ while (end > 0 && this.input.read(end - 1, end) != "\n")
1706
+ end--;
1707
+ this.fragmentEnd = end ? end - 1 : 0;
1708
+ }
1709
+ let c = this.cursor;
1710
+ if (!c) {
1711
+ c = this.cursor = this.fragment.tree.cursor();
1712
+ c.firstChild();
1713
+ }
1714
+ let rPos = pos + this.fragment.offset;
1715
+ while (c.to <= rPos)
1716
+ if (!c.parent())
1717
+ return false;
1718
+ for (; ; ) {
1719
+ if (c.from >= rPos)
1720
+ return this.fragment.from <= lineStart;
1721
+ if (!c.childAfter(rPos))
1722
+ return false;
1723
+ }
1724
+ }
1725
+ matches(hash) {
1726
+ let tree = this.cursor.tree;
1727
+ return tree && tree.prop(NodeProp.contextHash) == hash;
1728
+ }
1729
+ takeNodes(cx) {
1730
+ let cur = this.cursor, off = this.fragment.offset, fragEnd = this.fragmentEnd - (this.fragment.openEnd ? 1 : 0);
1731
+ let start = cx.absoluteLineStart, end = start, blockI = cx.block.children.length;
1732
+ let prevEnd = end, prevI = blockI;
1733
+ for (; ; ) {
1734
+ if (cur.to - off > fragEnd) {
1735
+ if (cur.type.isAnonymous && cur.firstChild())
1736
+ continue;
1737
+ break;
1738
+ }
1739
+ let pos = toRelative(cur.from - off, cx.ranges);
1740
+ if (cur.to - off <= cx.ranges[cx.rangeI].to) {
1741
+ cx.addNode(cur.tree, pos);
1742
+ } else {
1743
+ let dummy = new Tree(cx.parser.nodeSet.types[Type.Paragraph], [], [], 0, cx.block.hashProp);
1744
+ cx.reusePlaceholders.set(dummy, cur.tree);
1745
+ cx.addNode(dummy, pos);
1746
+ }
1747
+ if (cur.type.is("Block")) {
1748
+ if (NotLast.indexOf(cur.type.id) < 0) {
1749
+ end = cur.to - off;
1750
+ blockI = cx.block.children.length;
1751
+ } else {
1752
+ end = prevEnd;
1753
+ blockI = prevI;
1754
+ }
1755
+ prevEnd = cur.to - off;
1756
+ prevI = cx.block.children.length;
1757
+ }
1758
+ if (!cur.nextSibling())
1759
+ break;
1760
+ }
1761
+ while (cx.block.children.length > blockI) {
1762
+ cx.block.children.pop();
1763
+ cx.block.positions.pop();
1764
+ }
1765
+ return end - start;
1766
+ }
1767
+ };
1768
+ function toRelative(abs, ranges) {
1769
+ let pos = abs;
1770
+ for (let i = 1; i < ranges.length; i++) {
1771
+ let gapFrom = ranges[i - 1].to, gapTo = ranges[i].from;
1772
+ if (gapFrom < abs)
1773
+ pos -= gapTo - gapFrom;
1774
+ }
1775
+ return pos;
1776
+ }
1777
+ var markdownHighlighting = styleTags({
1778
+ "Blockquote/...": tags.quote,
1779
+ HorizontalRule: tags.contentSeparator,
1780
+ "ATXHeading1/... SetextHeading1/...": tags.heading1,
1781
+ "ATXHeading2/... SetextHeading2/...": tags.heading2,
1782
+ "ATXHeading3/...": tags.heading3,
1783
+ "ATXHeading4/...": tags.heading4,
1784
+ "ATXHeading5/...": tags.heading5,
1785
+ "ATXHeading6/...": tags.heading6,
1786
+ "Comment CommentBlock": tags.comment,
1787
+ Escape: tags.escape,
1788
+ Entity: tags.character,
1789
+ "Emphasis/...": tags.emphasis,
1790
+ "StrongEmphasis/...": tags.strong,
1791
+ "Link/... Image/...": tags.link,
1792
+ "OrderedList/... BulletList/...": tags.list,
1793
+ "BlockQuote/...": tags.quote,
1794
+ "InlineCode CodeText": tags.monospace,
1795
+ "URL Autolink": tags.url,
1796
+ "HeaderMark HardBreak QuoteMark ListMark LinkMark EmphasisMark CodeMark": tags.processingInstruction,
1797
+ "CodeInfo LinkLabel": tags.labelName,
1798
+ LinkTitle: tags.string,
1799
+ Paragraph: tags.content
1800
+ });
1801
+ var parser = new MarkdownParser(new NodeSet(nodeTypes).extend(markdownHighlighting), Object.keys(DefaultBlockParsers).map((n) => DefaultBlockParsers[n]), Object.keys(DefaultBlockParsers).map((n) => DefaultLeafBlocks[n]), Object.keys(DefaultBlockParsers), DefaultEndLeaf, DefaultSkipMarkup, Object.keys(DefaultInline).map((n) => DefaultInline[n]), Object.keys(DefaultInline), []);
1802
+ function leftOverSpace(node, from, to) {
1803
+ let ranges = [];
1804
+ for (let n = node.firstChild, pos = from; ; n = n.nextSibling) {
1805
+ let nextPos = n ? n.from : to;
1806
+ if (nextPos > pos)
1807
+ ranges.push({ from: pos, to: nextPos });
1808
+ if (!n)
1809
+ break;
1810
+ pos = n.to;
1811
+ }
1812
+ return ranges;
1813
+ }
1814
+ function parseCode(config) {
1815
+ let { codeParser, htmlParser } = config;
1816
+ let wrap = parseMixed((node, input) => {
1817
+ let id = node.type.id;
1818
+ if (codeParser && (id == Type.CodeBlock || id == Type.FencedCode)) {
1819
+ let info = "";
1820
+ if (id == Type.FencedCode) {
1821
+ let infoNode = node.node.getChild(Type.CodeInfo);
1822
+ if (infoNode)
1823
+ info = input.read(infoNode.from, infoNode.to);
1824
+ }
1825
+ let parser2 = codeParser(info);
1826
+ if (parser2)
1827
+ return { parser: parser2, overlay: (node2) => node2.type.id == Type.CodeText, bracketed: id == Type.FencedCode };
1828
+ } else if (htmlParser && (id == Type.HTMLBlock || id == Type.HTMLTag || id == Type.CommentBlock)) {
1829
+ return { parser: htmlParser, overlay: leftOverSpace(node.node, node.from, node.to) };
1830
+ }
1831
+ return null;
1832
+ });
1833
+ return { wrap };
1834
+ }
1835
+ var StrikethroughDelim = { resolve: "Strikethrough", mark: "StrikethroughMark" };
1836
+ var Strikethrough = {
1837
+ defineNodes: [{
1838
+ name: "Strikethrough",
1839
+ style: { "Strikethrough/...": tags.strikethrough }
1840
+ }, {
1841
+ name: "StrikethroughMark",
1842
+ style: tags.processingInstruction
1843
+ }],
1844
+ parseInline: [{
1845
+ name: "Strikethrough",
1846
+ parse(cx, next, pos) {
1847
+ if (next != 126 || cx.char(pos + 1) != 126 || cx.char(pos + 2) == 126)
1848
+ return -1;
1849
+ let before = cx.slice(pos - 1, pos), after = cx.slice(pos + 2, pos + 3);
1850
+ let sBefore = /\s|^$/.test(before), sAfter = /\s|^$/.test(after);
1851
+ let pBefore = Punctuation.test(before), pAfter = Punctuation.test(after);
1852
+ return cx.addDelimiter(StrikethroughDelim, pos, pos + 2, !sAfter && (!pAfter || sBefore || pBefore), !sBefore && (!pBefore || sAfter || pAfter));
1853
+ },
1854
+ after: "Emphasis"
1855
+ }]
1856
+ };
1857
+ function parseRow(cx, line, startI = 0, elts, offset = 0) {
1858
+ let count2 = 0, first = true, cellStart = -1, cellEnd = -1, esc = false;
1859
+ let parseCell = () => {
1860
+ elts.push(cx.elt("TableCell", offset + cellStart, offset + cellEnd, cx.parser.parseInline(line.slice(cellStart, cellEnd), offset + cellStart)));
1861
+ };
1862
+ for (let i = startI; i < line.length; i++) {
1863
+ let next = line.charCodeAt(i);
1864
+ if (next == 124 && !esc) {
1865
+ if (!first || cellStart > -1)
1866
+ count2++;
1867
+ first = false;
1868
+ if (elts) {
1869
+ if (cellStart > -1)
1870
+ parseCell();
1871
+ elts.push(cx.elt("TableDelimiter", i + offset, i + offset + 1));
1872
+ }
1873
+ cellStart = cellEnd = -1;
1874
+ } else if (esc || next != 32 && next != 9) {
1875
+ if (cellStart < 0)
1876
+ cellStart = i;
1877
+ cellEnd = i + 1;
1878
+ }
1879
+ esc = !esc && next == 92;
1880
+ }
1881
+ if (cellStart > -1) {
1882
+ count2++;
1883
+ if (elts)
1884
+ parseCell();
1885
+ }
1886
+ return count2;
1887
+ }
1888
+ function hasPipe(str, start) {
1889
+ for (let i = start; i < str.length; i++) {
1890
+ let next = str.charCodeAt(i);
1891
+ if (next == 124)
1892
+ return true;
1893
+ if (next == 92)
1894
+ i++;
1895
+ }
1896
+ return false;
1897
+ }
1898
+ var delimiterLine = /^[>\s]*\|?(\s*:?-+:?\s*\|)+(\s*:?-+:?\s*)?$/;
1899
+ var TableParser = class {
1900
+ constructor() {
1901
+ this.rows = null;
1902
+ }
1903
+ nextLine(cx, line, leaf) {
1904
+ if (this.rows == null) {
1905
+ this.rows = false;
1906
+ let lineText;
1907
+ if ((line.next == 45 || line.next == 58 || line.next == 124) && delimiterLine.test(lineText = line.text.slice(line.pos))) {
1908
+ let firstRow = [], firstCount = parseRow(cx, leaf.content, 0, firstRow, leaf.start);
1909
+ if (firstCount == parseRow(cx, lineText, 0))
1910
+ this.rows = [
1911
+ cx.elt("TableHeader", leaf.start, leaf.start + leaf.content.length, firstRow),
1912
+ cx.elt("TableDelimiter", cx.lineStart + line.pos, cx.lineStart + line.text.length)
1913
+ ];
1914
+ }
1915
+ } else if (this.rows) {
1916
+ let content = [];
1917
+ parseRow(cx, line.text, line.pos, content, cx.lineStart);
1918
+ this.rows.push(cx.elt("TableRow", cx.lineStart + line.pos, cx.lineStart + line.text.length, content));
1919
+ }
1920
+ return false;
1921
+ }
1922
+ finish(cx, leaf) {
1923
+ if (!this.rows)
1924
+ return false;
1925
+ cx.addLeafElement(leaf, cx.elt("Table", leaf.start, leaf.start + leaf.content.length, this.rows));
1926
+ return true;
1927
+ }
1928
+ };
1929
+ var Table = {
1930
+ defineNodes: [
1931
+ { name: "Table", block: true },
1932
+ { name: "TableHeader", style: { "TableHeader/...": tags.heading } },
1933
+ "TableRow",
1934
+ { name: "TableCell", style: tags.content },
1935
+ { name: "TableDelimiter", style: tags.processingInstruction }
1936
+ ],
1937
+ parseBlock: [{
1938
+ name: "Table",
1939
+ leaf(_, leaf) {
1940
+ return hasPipe(leaf.content, 0) ? new TableParser() : null;
1941
+ },
1942
+ endLeaf(cx, line, leaf) {
1943
+ if (leaf.parsers.some((p) => p instanceof TableParser) || !hasPipe(line.text, line.basePos))
1944
+ return false;
1945
+ let next = cx.peekLine();
1946
+ return delimiterLine.test(next) && parseRow(cx, line.text, line.basePos) == parseRow(cx, next, line.basePos);
1947
+ },
1948
+ before: "SetextHeading"
1949
+ }]
1950
+ };
1951
+ var TaskParser = class {
1952
+ nextLine() {
1953
+ return false;
1954
+ }
1955
+ finish(cx, leaf) {
1956
+ cx.addLeafElement(leaf, cx.elt("Task", leaf.start, leaf.start + leaf.content.length, [
1957
+ cx.elt("TaskMarker", leaf.start, leaf.start + 3),
1958
+ ...cx.parser.parseInline(leaf.content.slice(3), leaf.start + 3)
1959
+ ]));
1960
+ return true;
1961
+ }
1962
+ };
1963
+ var TaskList = {
1964
+ defineNodes: [
1965
+ { name: "Task", block: true, style: tags.list },
1966
+ { name: "TaskMarker", style: tags.atom }
1967
+ ],
1968
+ parseBlock: [{
1969
+ name: "TaskList",
1970
+ leaf(cx, leaf) {
1971
+ return /^\[[ xX]\][ \t]/.test(leaf.content) && cx.parentType().name == "ListItem" ? new TaskParser() : null;
1972
+ },
1973
+ after: "SetextHeading"
1974
+ }]
1975
+ };
1976
+ var autolinkRE = /(www\.)|(https?:\/\/)|([\w.+-]{1,100}@)|(mailto:|xmpp:)/gy;
1977
+ var urlRE = /[\w-]+(\.[\w-]+)+(:\d+)?(\/[^\s<]*)?/gy;
1978
+ var lastTwoDomainWords = /[\w-]+\.[\w-]+($|[/:])/;
1979
+ var emailRE = /[\w.+-]+@[\w-]+(\.[\w.-]+)+/gy;
1980
+ var xmppResourceRE = /\/[a-zA-Z\d@.]+/gy;
1981
+ function count(str, from, to, ch) {
1982
+ let result = 0;
1983
+ for (let i = from; i < to; i++)
1984
+ if (str[i] == ch)
1985
+ result++;
1986
+ return result;
1987
+ }
1988
+ function autolinkURLEnd(text, from) {
1989
+ urlRE.lastIndex = from;
1990
+ let m = urlRE.exec(text);
1991
+ if (!m || lastTwoDomainWords.exec(m[0])[0].indexOf("_") > -1)
1992
+ return -1;
1993
+ let end = from + m[0].length;
1994
+ for (; ; ) {
1995
+ let last = text[end - 1], m2;
1996
+ if (/[?!.,:*_~]/.test(last) || last == ")" && count(text, from, end, ")") > count(text, from, end, "("))
1997
+ end--;
1998
+ else if (last == ";" && (m2 = /&(?:#\d+|#x[a-f\d]+|\w+);$/.exec(text.slice(from, end))))
1999
+ end = from + m2.index;
2000
+ else
2001
+ break;
2002
+ }
2003
+ return end;
2004
+ }
2005
+ function autolinkEmailEnd(text, from) {
2006
+ emailRE.lastIndex = from;
2007
+ let m = emailRE.exec(text);
2008
+ if (!m)
2009
+ return -1;
2010
+ let last = m[0][m[0].length - 1];
2011
+ return last == "_" || last == "-" ? -1 : from + m[0].length - (last == "." ? 1 : 0);
2012
+ }
2013
+ var Autolink = {
2014
+ parseInline: [{
2015
+ name: "Autolink",
2016
+ parse(cx, next, absPos) {
2017
+ let pos = absPos - cx.offset;
2018
+ if (pos && /\w/.test(cx.text[pos - 1]))
2019
+ return -1;
2020
+ autolinkRE.lastIndex = pos;
2021
+ let m = autolinkRE.exec(cx.text), end = -1;
2022
+ if (!m)
2023
+ return -1;
2024
+ if (m[1] || m[2]) {
2025
+ end = autolinkURLEnd(cx.text, pos + m[0].length);
2026
+ if (end > -1 && cx.hasOpenLink) {
2027
+ let noBracket = /([^\[\]]|\[[^\]]*\])*/.exec(cx.text.slice(pos, end));
2028
+ end = pos + noBracket[0].length;
2029
+ }
2030
+ } else if (m[3]) {
2031
+ end = autolinkEmailEnd(cx.text, pos);
2032
+ } else {
2033
+ end = autolinkEmailEnd(cx.text, pos + m[0].length);
2034
+ if (end > -1 && m[0] == "xmpp:") {
2035
+ xmppResourceRE.lastIndex = end;
2036
+ m = xmppResourceRE.exec(cx.text);
2037
+ if (m)
2038
+ end = m.index + m[0].length;
2039
+ }
2040
+ }
2041
+ if (end < 0)
2042
+ return -1;
2043
+ cx.addElement(cx.elt("URL", absPos, end + cx.offset));
2044
+ return end + cx.offset;
2045
+ }
2046
+ }]
2047
+ };
2048
+ var GFM = [Table, TaskList, Strikethrough, Autolink];
2049
+ function parseSubSuper(ch, node, mark) {
2050
+ return (cx, next, pos) => {
2051
+ if (next != ch || cx.char(pos + 1) == ch)
2052
+ return -1;
2053
+ let elts = [cx.elt(mark, pos, pos + 1)];
2054
+ for (let i = pos + 1; i < cx.end; i++) {
2055
+ let next2 = cx.char(i);
2056
+ if (next2 == ch)
2057
+ return cx.addElement(cx.elt(node, pos, i + 1, elts.concat(cx.elt(mark, i, i + 1))));
2058
+ if (next2 == 92)
2059
+ elts.push(cx.elt("Escape", i, i++ + 2));
2060
+ if (space(next2))
2061
+ break;
2062
+ }
2063
+ return -1;
2064
+ };
2065
+ }
2066
+ var Superscript = {
2067
+ defineNodes: [
2068
+ { name: "Superscript", style: tags.special(tags.content) },
2069
+ { name: "SuperscriptMark", style: tags.processingInstruction }
2070
+ ],
2071
+ parseInline: [{
2072
+ name: "Superscript",
2073
+ parse: parseSubSuper(94, "Superscript", "SuperscriptMark")
2074
+ }]
2075
+ };
2076
+ var Subscript = {
2077
+ defineNodes: [
2078
+ { name: "Subscript", style: tags.special(tags.content) },
2079
+ { name: "SubscriptMark", style: tags.processingInstruction }
2080
+ ],
2081
+ parseInline: [{
2082
+ name: "Subscript",
2083
+ parse: parseSubSuper(126, "Subscript", "SubscriptMark")
2084
+ }]
2085
+ };
2086
+ var Emoji = {
2087
+ defineNodes: [{ name: "Emoji", style: tags.character }],
2088
+ parseInline: [{
2089
+ name: "Emoji",
2090
+ parse(cx, next, pos) {
2091
+ let match;
2092
+ if (next != 58 || !(match = /^[a-zA-Z_0-9]+:/.exec(cx.slice(pos + 1, cx.end))))
2093
+ return -1;
2094
+ return cx.addElement(cx.elt("Emoji", pos, pos + 1 + match[0].length));
2095
+ }
2096
+ }]
2097
+ };
2098
+
2099
+ // ../node_modules/.pnpm/@codemirror+lang-markdown@6.5.1/node_modules/@codemirror/lang-markdown/dist/index.js
2100
+ var data = /* @__PURE__ */ defineLanguageFacet({ commentTokens: { block: { open: "<!--", close: "-->" } } });
2101
+ var headingProp = /* @__PURE__ */ new NodeProp();
2102
+ var commonmark = /* @__PURE__ */ parser.configure({
2103
+ props: [
2104
+ /* @__PURE__ */ foldNodeProp.add((type) => {
2105
+ return !type.is("Block") || type.is("Document") || isHeading(type) != null || isList(type) ? void 0 : (tree, state) => ({ from: state.doc.lineAt(tree.from).to, to: tree.to });
2106
+ }),
2107
+ /* @__PURE__ */ headingProp.add(isHeading),
2108
+ /* @__PURE__ */ indentNodeProp.add({
2109
+ Document: () => null
2110
+ }),
2111
+ /* @__PURE__ */ languageDataProp.add({
2112
+ Document: data
2113
+ })
2114
+ ]
2115
+ });
2116
+ function isHeading(type) {
2117
+ let match = /^(?:ATX|Setext)Heading(\d)$/.exec(type.name);
2118
+ return match ? +match[1] : void 0;
2119
+ }
2120
+ function isList(type) {
2121
+ return type.name == "OrderedList" || type.name == "BulletList";
2122
+ }
2123
+ function findSectionEnd(headerNode, level) {
2124
+ let last = headerNode;
2125
+ for (; ; ) {
2126
+ let next = last.nextSibling, heading;
2127
+ if (!next || (heading = isHeading(next.type)) != null && heading <= level)
2128
+ break;
2129
+ last = next;
2130
+ }
2131
+ return last.to;
2132
+ }
2133
+ var headerIndent = /* @__PURE__ */ foldService.of((state, start, end) => {
2134
+ for (let node = syntaxTree(state).resolveInner(end, -1); node; node = node.parent) {
2135
+ if (node.from < start)
2136
+ break;
2137
+ let heading = node.type.prop(headingProp);
2138
+ if (heading == null)
2139
+ continue;
2140
+ let upto = findSectionEnd(node, heading);
2141
+ if (upto > end)
2142
+ return { from: end, to: upto };
2143
+ }
2144
+ return null;
2145
+ });
2146
+ function mkLang(parser2) {
2147
+ return new Language(data, parser2, [], "markdown");
2148
+ }
2149
+ var commonmarkLanguage = /* @__PURE__ */ mkLang(commonmark);
2150
+ var extended = /* @__PURE__ */ commonmark.configure([GFM, Subscript, Superscript, Emoji, {
2151
+ props: [
2152
+ /* @__PURE__ */ foldNodeProp.add({
2153
+ Table: (tree, state) => ({ from: state.doc.lineAt(tree.from).to, to: tree.to })
2154
+ })
2155
+ ]
2156
+ }]);
2157
+ var markdownLanguage = /* @__PURE__ */ mkLang(extended);
2158
+ function getCodeParser(languages, defaultLanguage) {
2159
+ return (info) => {
2160
+ if (info && languages) {
2161
+ let found = null;
2162
+ info = /\S*/.exec(info)[0];
2163
+ if (typeof languages == "function")
2164
+ found = languages(info);
2165
+ else
2166
+ found = LanguageDescription.matchLanguageName(languages, info, true);
2167
+ if (found instanceof LanguageDescription)
2168
+ return found.support ? found.support.language.parser : ParseContext.getSkippingParser(found.load());
2169
+ else if (found)
2170
+ return found.parser;
2171
+ }
2172
+ return defaultLanguage ? defaultLanguage.parser : null;
2173
+ };
2174
+ }
2175
+ var Context = class {
2176
+ constructor(node, from, to, spaceBefore, spaceAfter, type, item) {
2177
+ this.node = node;
2178
+ this.from = from;
2179
+ this.to = to;
2180
+ this.spaceBefore = spaceBefore;
2181
+ this.spaceAfter = spaceAfter;
2182
+ this.type = type;
2183
+ this.item = item;
2184
+ }
2185
+ blank(maxWidth, trailing = true) {
2186
+ let result = this.spaceBefore + (this.node.name == "Blockquote" ? ">" : "");
2187
+ if (maxWidth != null) {
2188
+ while (result.length < maxWidth)
2189
+ result += " ";
2190
+ return result;
2191
+ } else {
2192
+ for (let i = this.to - this.from - result.length - this.spaceAfter.length; i > 0; i--)
2193
+ result += " ";
2194
+ return result + (trailing ? this.spaceAfter : "");
2195
+ }
2196
+ }
2197
+ marker(doc, add) {
2198
+ let number = this.node.name == "OrderedList" ? String(+itemNumber(this.item, doc)[2] + add) : "";
2199
+ return this.spaceBefore + number + this.type + this.spaceAfter;
2200
+ }
2201
+ };
2202
+ function getContext(node, doc) {
2203
+ let nodes = [], context = [];
2204
+ for (let cur = node; cur; cur = cur.parent) {
2205
+ if (cur.name == "FencedCode")
2206
+ return context;
2207
+ if (cur.name == "ListItem" || cur.name == "Blockquote")
2208
+ nodes.push(cur);
2209
+ }
2210
+ for (let i = nodes.length - 1; i >= 0; i--) {
2211
+ let node2 = nodes[i], match;
2212
+ let line = doc.lineAt(node2.from), startPos = node2.from - line.from;
2213
+ if (node2.name == "Blockquote" && (match = /^ *>( ?)/.exec(line.text.slice(startPos)))) {
2214
+ context.push(new Context(node2, startPos, startPos + match[0].length, "", match[1], ">", null));
2215
+ } else if (node2.name == "ListItem" && node2.parent.name == "OrderedList" && (match = /^( *)\d+([.)])( *)/.exec(line.text.slice(startPos)))) {
2216
+ let after = match[3], len = match[0].length;
2217
+ if (after.length >= 4) {
2218
+ after = after.slice(0, after.length - 4);
2219
+ len -= 4;
2220
+ }
2221
+ context.push(new Context(node2.parent, startPos, startPos + len, match[1], after, match[2], node2));
2222
+ } else if (node2.name == "ListItem" && node2.parent.name == "BulletList" && (match = /^( *)([-+*])( {1,4}\[[ xX]\])?( +)/.exec(line.text.slice(startPos)))) {
2223
+ let after = match[4], len = match[0].length;
2224
+ if (after.length > 4) {
2225
+ after = after.slice(0, after.length - 4);
2226
+ len -= 4;
2227
+ }
2228
+ let type = match[2];
2229
+ if (match[3])
2230
+ type += match[3].replace(/[xX]/, " ");
2231
+ context.push(new Context(node2.parent, startPos, startPos + len, match[1], after, type, node2));
2232
+ }
2233
+ }
2234
+ return context;
2235
+ }
2236
+ function itemNumber(item, doc) {
2237
+ return /^(\s*)(\d+)(?=[.)])/.exec(doc.sliceString(item.from, item.from + 10));
2238
+ }
2239
+ function renumberList(after, doc, changes, offset = 0) {
2240
+ for (let prev = -1, node = after; ; ) {
2241
+ if (node.name == "ListItem") {
2242
+ let m = itemNumber(node, doc);
2243
+ let number = +m[2];
2244
+ if (prev >= 0) {
2245
+ if (number != prev + 1)
2246
+ return;
2247
+ changes.push({ from: node.from + m[1].length, to: node.from + m[0].length, insert: String(prev + 2 + offset) });
2248
+ }
2249
+ prev = number;
2250
+ }
2251
+ let next = node.nextSibling;
2252
+ if (!next)
2253
+ break;
2254
+ node = next;
2255
+ }
2256
+ }
2257
+ function normalizeIndent(content, state) {
2258
+ let blank = /^[ \t]*/.exec(content)[0].length;
2259
+ if (!blank || state.facet(indentUnit) != " ")
2260
+ return content;
2261
+ let col = countColumn(content, 4, blank);
2262
+ let space2 = "";
2263
+ for (let i = col; i > 0; ) {
2264
+ if (i >= 4) {
2265
+ space2 += " ";
2266
+ i -= 4;
2267
+ } else {
2268
+ space2 += " ";
2269
+ i--;
2270
+ }
2271
+ }
2272
+ return space2 + content.slice(blank);
2273
+ }
2274
+ var insertNewlineContinueMarkupCommand = (config = {}) => ({ state, dispatch }) => {
2275
+ let tree = syntaxTree(state), { doc } = state;
2276
+ let dont = null, changes = state.changeByRange((range) => {
2277
+ if (!range.empty || !markdownLanguage.isActiveAt(state, range.from, -1) && !markdownLanguage.isActiveAt(state, range.from, 1))
2278
+ return dont = { range };
2279
+ let pos = range.from, line = doc.lineAt(pos);
2280
+ let context = getContext(tree.resolveInner(pos, -1), doc);
2281
+ while (context.length && context[context.length - 1].from > pos - line.from)
2282
+ context.pop();
2283
+ if (!context.length)
2284
+ return dont = { range };
2285
+ let inner = context[context.length - 1];
2286
+ if (inner.to - inner.spaceAfter.length > pos - line.from)
2287
+ return dont = { range };
2288
+ let emptyLine = pos >= inner.to - inner.spaceAfter.length && !/\S/.test(line.text.slice(inner.to));
2289
+ if (inner.item && emptyLine) {
2290
+ let first = inner.node.firstChild, second = inner.node.getChild("ListItem", "ListItem");
2291
+ if (first.to >= pos || second && second.to < pos || line.from > 0 && !/[^\s>]/.test(doc.lineAt(line.from - 1).text) || config.nonTightLists === false) {
2292
+ let next = context.length > 1 ? context[context.length - 2] : null;
2293
+ let delTo, insert2 = "";
2294
+ if (next && next.item) {
2295
+ delTo = line.from + next.from;
2296
+ insert2 = next.marker(doc, 1);
2297
+ } else {
2298
+ delTo = line.from + (next ? next.to : 0);
2299
+ }
2300
+ let changes3 = [{ from: delTo, to: pos, insert: insert2 }];
2301
+ if (inner.node.name == "OrderedList")
2302
+ renumberList(inner.item, doc, changes3, -2);
2303
+ if (next && next.node.name == "OrderedList")
2304
+ renumberList(next.item, doc, changes3);
2305
+ return { range: EditorSelection.cursor(delTo + insert2.length), changes: changes3 };
2306
+ } else {
2307
+ let insert2 = blankLine(context, state, line);
2308
+ return {
2309
+ range: EditorSelection.cursor(pos + insert2.length + 1),
2310
+ changes: { from: line.from, insert: insert2 + state.lineBreak }
2311
+ };
2312
+ }
2313
+ }
2314
+ if (inner.node.name == "Blockquote" && emptyLine && line.from) {
2315
+ let prevLine = doc.lineAt(line.from - 1), quoted = />\s*$/.exec(prevLine.text);
2316
+ if (quoted && quoted.index == inner.from) {
2317
+ let changes3 = state.changes([
2318
+ { from: prevLine.from + quoted.index, to: prevLine.to },
2319
+ { from: line.from + inner.from, to: line.to }
2320
+ ]);
2321
+ return { range: range.map(changes3), changes: changes3 };
2322
+ }
2323
+ }
2324
+ let changes2 = [];
2325
+ if (inner.node.name == "OrderedList")
2326
+ renumberList(inner.item, doc, changes2);
2327
+ let continued = inner.item && inner.item.from < line.from;
2328
+ let insert = "";
2329
+ if (!continued || /^[\s\d.)\-+*>]*/.exec(line.text)[0].length >= inner.to) {
2330
+ for (let i = 0, e = context.length - 1; i <= e; i++) {
2331
+ insert += i == e && !continued ? context[i].marker(doc, 1) : context[i].blank(i < e ? countColumn(line.text, 4, context[i + 1].from) - insert.length : null);
2332
+ }
2333
+ }
2334
+ let from = pos;
2335
+ while (from > line.from && /\s/.test(line.text.charAt(from - line.from - 1)))
2336
+ from--;
2337
+ insert = normalizeIndent(insert, state);
2338
+ if (nonTightList(inner.node, state.doc))
2339
+ insert = blankLine(context, state, line) + state.lineBreak + insert;
2340
+ changes2.push({ from, to: pos, insert: state.lineBreak + insert });
2341
+ return { range: EditorSelection.cursor(from + insert.length + 1), changes: changes2 };
2342
+ });
2343
+ if (dont)
2344
+ return false;
2345
+ dispatch(state.update(changes, { scrollIntoView: true, userEvent: "input" }));
2346
+ return true;
2347
+ };
2348
+ var insertNewlineContinueMarkup = /* @__PURE__ */ insertNewlineContinueMarkupCommand();
2349
+ function isMark(node) {
2350
+ return node.name == "QuoteMark" || node.name == "ListMark";
2351
+ }
2352
+ function nonTightList(node, doc) {
2353
+ if (node.name != "OrderedList" && node.name != "BulletList")
2354
+ return false;
2355
+ let first = node.firstChild, second = node.getChild("ListItem", "ListItem");
2356
+ if (!second)
2357
+ return false;
2358
+ let line1 = doc.lineAt(first.to), line2 = doc.lineAt(second.from);
2359
+ let empty = /^[\s>]*$/.test(line1.text);
2360
+ return line1.number + (empty ? 0 : 1) < line2.number;
2361
+ }
2362
+ function blankLine(context, state, line) {
2363
+ let insert = "";
2364
+ for (let i = 0, e = context.length - 2; i <= e; i++) {
2365
+ insert += context[i].blank(i < e ? countColumn(line.text, 4, context[i + 1].from) - insert.length : null, i < e);
2366
+ }
2367
+ return normalizeIndent(insert, state);
2368
+ }
2369
+ function contextNodeForDelete(tree, pos) {
2370
+ let node = tree.resolveInner(pos, -1), scan = pos;
2371
+ if (isMark(node)) {
2372
+ scan = node.from;
2373
+ node = node.parent;
2374
+ }
2375
+ for (let prev; prev = node.childBefore(scan); ) {
2376
+ if (isMark(prev)) {
2377
+ scan = prev.from;
2378
+ } else if (prev.name == "OrderedList" || prev.name == "BulletList") {
2379
+ node = prev.lastChild;
2380
+ scan = node.to;
2381
+ } else {
2382
+ break;
2383
+ }
2384
+ }
2385
+ return node;
2386
+ }
2387
+ var deleteMarkupBackward = ({ state, dispatch }) => {
2388
+ let tree = syntaxTree(state);
2389
+ let dont = null, changes = state.changeByRange((range) => {
2390
+ let pos = range.from, { doc } = state;
2391
+ if (range.empty && markdownLanguage.isActiveAt(state, range.from)) {
2392
+ let line = doc.lineAt(pos);
2393
+ let context = getContext(contextNodeForDelete(tree, pos), doc);
2394
+ if (context.length) {
2395
+ let inner = context[context.length - 1];
2396
+ let spaceEnd = inner.to - inner.spaceAfter.length + (inner.spaceAfter ? 1 : 0);
2397
+ if (pos - line.from > spaceEnd && !/\S/.test(line.text.slice(spaceEnd, pos - line.from)))
2398
+ return {
2399
+ range: EditorSelection.cursor(line.from + spaceEnd),
2400
+ changes: { from: line.from + spaceEnd, to: pos }
2401
+ };
2402
+ if (pos - line.from == spaceEnd && // Only apply this if we're on the line that has the
2403
+ // construct's syntax, or there's only indentation in the
2404
+ // target range
2405
+ (inner.item && line.from <= inner.item.from || /^[\s>]*$/.test(line.text.slice(0, inner.to)))) {
2406
+ let start = line.from + inner.from;
2407
+ if (inner.item && inner.node.from < inner.item.from && /\S/.test(line.text.slice(inner.from, inner.to))) {
2408
+ let insert = inner.blank(countColumn(line.text, 4, inner.to) - countColumn(line.text, 4, inner.from));
2409
+ if (start == line.from)
2410
+ insert = normalizeIndent(insert, state);
2411
+ return {
2412
+ range: EditorSelection.cursor(start + insert.length),
2413
+ changes: { from: start, to: line.from + inner.to, insert }
2414
+ };
2415
+ }
2416
+ if (start < pos)
2417
+ return { range: EditorSelection.cursor(start), changes: { from: start, to: pos } };
2418
+ }
2419
+ }
2420
+ }
2421
+ return dont = { range };
2422
+ });
2423
+ if (dont)
2424
+ return false;
2425
+ dispatch(state.update(changes, { scrollIntoView: true, userEvent: "delete" }));
2426
+ return true;
2427
+ };
2428
+ var markdownKeymap = [
2429
+ { key: "Enter", run: insertNewlineContinueMarkup },
2430
+ { key: "Backspace", run: deleteMarkupBackward }
2431
+ ];
2432
+ var htmlNoMatch = /* @__PURE__ */ html({ matchClosingTags: false });
2433
+ function markdown(config = {}) {
2434
+ let { codeLanguages, defaultCodeLanguage, addKeymap = true, base: { parser: parser2 } = commonmarkLanguage, completeHTMLTags = true, pasteURLAsLink: pasteURL = true, htmlTagLanguage = htmlNoMatch } = config;
2435
+ if (!(parser2 instanceof MarkdownParser))
2436
+ throw new RangeError("Base parser provided to `markdown` should be a Markdown parser");
2437
+ let extensions = config.extensions ? [config.extensions] : [];
2438
+ let support = [htmlTagLanguage.support, headerIndent], defaultCode;
2439
+ if (pasteURL)
2440
+ support.push(pasteURLAsLink);
2441
+ if (defaultCodeLanguage instanceof LanguageSupport) {
2442
+ support.push(defaultCodeLanguage.support);
2443
+ defaultCode = defaultCodeLanguage.language;
2444
+ } else if (defaultCodeLanguage) {
2445
+ defaultCode = defaultCodeLanguage;
2446
+ }
2447
+ let codeParser = codeLanguages || defaultCode ? getCodeParser(codeLanguages, defaultCode) : void 0;
2448
+ extensions.push(parseCode({ codeParser, htmlParser: htmlTagLanguage.language.parser }));
2449
+ if (addKeymap)
2450
+ support.push(Prec.high(keymap.of(markdownKeymap)));
2451
+ let lang = mkLang(parser2.configure(extensions));
2452
+ if (completeHTMLTags)
2453
+ support.push(lang.data.of({ autocomplete: htmlTagCompletion }));
2454
+ return new LanguageSupport(lang, support);
2455
+ }
2456
+ function htmlTagCompletion(context) {
2457
+ let { state, pos } = context, m = /<[:\-\.\w\u00b7-\uffff]*$/.exec(state.sliceDoc(pos - 25, pos));
2458
+ if (!m)
2459
+ return null;
2460
+ let tree = syntaxTree(state).resolveInner(pos, -1);
2461
+ while (tree && !tree.type.isTop) {
2462
+ if (tree.name == "CodeBlock" || tree.name == "FencedCode" || tree.name == "ProcessingInstructionBlock" || tree.name == "CommentBlock" || tree.name == "Link" || tree.name == "Image")
2463
+ return null;
2464
+ tree = tree.parent;
2465
+ }
2466
+ return {
2467
+ from: pos - m[0].length,
2468
+ to: pos,
2469
+ options: htmlTagCompletions(),
2470
+ validFor: /^<[:\-\.\w\u00b7-\uffff]*$/
2471
+ };
2472
+ }
2473
+ var _tagCompletions = null;
2474
+ function htmlTagCompletions() {
2475
+ if (_tagCompletions)
2476
+ return _tagCompletions;
2477
+ let result = htmlCompletionSource(new CompletionContext(EditorState.create({ extensions: htmlNoMatch }), 0, true));
2478
+ return _tagCompletions = result ? result.options : [];
2479
+ }
2480
+ var nonPlainText = /code|horizontalrule|html|link|comment|processing|escape|entity|image|mark|url/i;
2481
+ var pasteURLAsLink = /* @__PURE__ */ EditorView.domEventHandlers({
2482
+ paste: (event, view) => {
2483
+ var _a;
2484
+ let { main } = view.state.selection;
2485
+ if (main.empty)
2486
+ return false;
2487
+ let link = (_a = event.clipboardData) === null || _a === void 0 ? void 0 : _a.getData("text/plain");
2488
+ if (!link || !/^(https?:\/\/|mailto:|xmpp:|www\.)/.test(link))
2489
+ return false;
2490
+ if (/^www\./.test(link))
2491
+ link = "https://" + link;
2492
+ if (!markdownLanguage.isActiveAt(view.state, main.from, 1))
2493
+ return false;
2494
+ let tree = syntaxTree(view.state), crossesNode = false;
2495
+ tree.iterate({
2496
+ from: main.from,
2497
+ to: main.to,
2498
+ enter: (node) => {
2499
+ if (node.from > main.from || nonPlainText.test(node.name))
2500
+ crossesNode = true;
2501
+ },
2502
+ leave: (node) => {
2503
+ if (node.to < main.to)
2504
+ crossesNode = true;
2505
+ }
2506
+ });
2507
+ if (crossesNode)
2508
+ return false;
2509
+ view.dispatch({
2510
+ changes: [{ from: main.from, insert: "[" }, { from: main.to, insert: `](${link})` }],
2511
+ userEvent: "input.paste",
2512
+ scrollIntoView: true
2513
+ });
2514
+ return true;
2515
+ }
2516
+ });
2517
+
2518
+ export {
2519
+ commonmarkLanguage,
2520
+ markdownLanguage,
2521
+ insertNewlineContinueMarkupCommand,
2522
+ insertNewlineContinueMarkup,
2523
+ deleteMarkupBackward,
2524
+ markdownKeymap,
2525
+ markdown,
2526
+ pasteURLAsLink
2527
+ };
2528
+ //# sourceMappingURL=chunk-PPGERYN5.js.map