@onereach/ui-components 2.70.0-beta.2131.0 → 2.70.0-beta.2159.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (228) hide show
  1. package/dist/bundled/v2/{OrAvatar-2fa559e1.js → OrAvatar-ae61bfb9.js} +41 -15
  2. package/dist/bundled/v2/{OrButton-0e91a808.js → OrButton-4b99c680.js} +5 -1
  3. package/dist/bundled/v2/{OrCard-58a1ba3e.js → OrCard-29116e1f.js} +2 -2
  4. package/dist/bundled/v2/OrCardCollection-c4209a92.js +350 -0
  5. package/dist/bundled/v2/OrCode-be1bd373.js +4255 -0
  6. package/dist/bundled/v2/{OrConfirm-18c534df.js → OrConfirm-cab6535b.js} +1 -1
  7. package/dist/bundled/v2/OrEmptyState-9fb413f9.js +160 -0
  8. package/dist/bundled/v2/{OrRichTextEditor-63ef1357.js → OrRichTextEditor-5843ecda.js} +13803 -20711
  9. package/dist/bundled/v2/{OrSearch-9d402f56.js → OrSearch-76b002cf.js} +10 -4
  10. package/dist/bundled/v2/{OrSortHeader-396e6a7c.js → OrSortHeader-9932d28f.js} +2 -2
  11. package/dist/bundled/v2/codemirrorView-14f6685c.js +7136 -0
  12. package/dist/bundled/v2/components/index.d.ts +1 -0
  13. package/dist/bundled/v2/components/index.js +13 -10
  14. package/dist/bundled/v2/components/or-avatar-v3/OrAvatar.stories3.d.ts +1 -1
  15. package/dist/bundled/v2/components/or-avatar-v3/OrAvatar.vue.d.ts +11 -0
  16. package/dist/bundled/v2/components/or-avatar-v3/index.js +2 -1
  17. package/dist/bundled/v2/components/or-avatar-v3/props.d.ts +2 -1
  18. package/dist/bundled/v2/components/or-avatar-v3/styles.d.ts +2 -0
  19. package/dist/bundled/v2/components/or-button-v3/index.js +1 -1
  20. package/dist/bundled/v2/components/or-card-collection-v3/OrCardCollection.stories3.d.ts +10 -0
  21. package/dist/bundled/v2/components/or-card-collection-v3/OrCardCollection.vue.d.ts +87 -40
  22. package/dist/bundled/v2/components/or-card-collection-v3/OrCardCollectionView.vue2.vue.d.ts +35 -0
  23. package/dist/bundled/v2/components/or-card-collection-v3/index.js +7 -4
  24. package/dist/bundled/v2/components/or-card-collection-v3/props.d.ts +5 -1
  25. package/dist/bundled/v2/components/or-card-collection-v3/styles.d.ts +2 -2
  26. package/dist/bundled/v2/components/or-card-collection-v3/types.d.ts +8 -3
  27. package/dist/bundled/v2/components/or-card-v3/index.js +1 -1
  28. package/dist/bundled/v2/components/or-code/index.js +3 -2
  29. package/dist/bundled/v2/components/or-confirm-v3/index.js +2 -2
  30. package/dist/bundled/v2/components/or-empty-state-v3/OrEmptyState.vue.d.ts +1 -1
  31. package/dist/bundled/v2/components/or-empty-state-v3/index.js +3 -159
  32. package/dist/bundled/v2/components/or-input-box-v3/OrInputBox.vue.d.ts +1 -2
  33. package/dist/bundled/v2/components/or-rich-text-editor-v3/index.js +4 -2
  34. package/dist/bundled/v2/components/or-rich-text-editor-v3/utils/codemirror/codemirrorNode.d.ts +3 -0
  35. package/dist/bundled/v2/components/or-rich-text-editor-v3/utils/codemirror/codemirrorView.d.ts +45 -0
  36. package/dist/bundled/v2/components/or-rich-text-editor-v3/utils/codemirror/index.d.ts +1 -0
  37. package/dist/bundled/v2/components/or-rich-text-editor-v3/utils/codemirror/index.js +2 -0
  38. package/dist/bundled/v2/components/or-rich-text-editor-v3/utils/codemirror/types.d.ts +19 -0
  39. package/dist/bundled/v2/components/or-search-v3/OrSearch.vue.d.ts +15 -2
  40. package/dist/bundled/v2/components/or-search-v3/index.js +1 -1
  41. package/dist/bundled/v2/components/or-sort-header-v3/index.js +1 -1
  42. package/dist/bundled/v2/index-46cc379c.js +12186 -0
  43. package/dist/bundled/v2/index-780d00b0.js +13307 -0
  44. package/dist/bundled/v2/index.js +14 -11
  45. package/dist/bundled/v3/{OrAvatar.vue_vue_type_script_lang-22e46ce1.js → OrAvatar.vue_vue_type_script_lang-0426862b.js} +35 -13
  46. package/dist/bundled/v3/OrButton-a671b8a1.js +33 -0
  47. package/dist/bundled/v3/{OrButton.vue_vue_type_script_lang-3718b300.js → OrButton.vue_vue_type_script_lang-b0dc31ca.js} +5 -1
  48. package/dist/bundled/v3/OrCardCollection.vue_vue_type_script_lang-9a2ae9a3.js +236 -0
  49. package/dist/bundled/v3/OrCode.vue_vue_type_script_lang-0f668150.js +4133 -0
  50. package/dist/bundled/v3/{OrConfirm.vue_vue_type_script_lang-289b5600.js → OrConfirm.vue_vue_type_script_lang-f57ffa1a.js} +6 -36
  51. package/dist/bundled/v3/OrEmptyState.vue_vue_type_script_lang-da7d6c42.js +111 -0
  52. package/dist/bundled/v3/{OrIconButton-4bd33e3c.js → OrIconButton-1581013c.js} +1 -1
  53. package/dist/bundled/v3/{OrIconButton.vue_vue_type_script_lang-641f6e06.js → OrIconButton.vue_vue_type_script_lang-f6f801ff.js} +1 -1
  54. package/dist/bundled/v3/{OrInlineInput.vue_vue_type_script_lang-3a8189f4.js → OrInlineInput.vue_vue_type_script_lang-f29483f4.js} +2 -2
  55. package/dist/bundled/v3/{OrInlineTextarea.vue_vue_type_script_lang-890b97ab.js → OrInlineTextarea.vue_vue_type_script_lang-cc40af48.js} +2 -2
  56. package/dist/bundled/v3/OrInput.vue_vue_type_script_lang-f6d793d3.js +2 -2
  57. package/dist/bundled/v3/{OrModal.vue_vue_type_script_lang-00a477f0.js → OrModal.vue_vue_type_script_lang-80a7b906.js} +2 -2
  58. package/dist/bundled/v3/OrNotification.vue_vue_type_script_lang-fbb35355.js +2 -2
  59. package/dist/bundled/v3/{OrRichTextEditor.vue_vue_type_script_lang-47fffbd6.js → OrRichTextEditor.vue_vue_type_script_lang-e0dfd695.js} +13803 -20711
  60. package/dist/bundled/v3/{OrSearch.vue_vue_type_script_lang-ed78b21f.js → OrSearch.vue_vue_type_script_lang-014ad470.js} +9 -3
  61. package/dist/bundled/v3/OrSelect.vue_vue_type_script_lang-15285ce4.js +1 -1
  62. package/dist/bundled/v3/{OrTag.vue_vue_type_script_lang-92d9fb12.js → OrTag.vue_vue_type_script_lang-dc6a4011.js} +2 -2
  63. package/dist/bundled/v3/{OrToastContainer-afb51e5d.js → OrToastContainer-7c3c0b12.js} +1 -1
  64. package/dist/bundled/v3/codemirrorView-14f6685c.js +7136 -0
  65. package/dist/bundled/v3/components/index.d.ts +1 -0
  66. package/dist/bundled/v3/components/index.js +23 -19
  67. package/dist/bundled/v3/components/or-avatar-v3/OrAvatar.stories3.d.ts +1 -1
  68. package/dist/bundled/v3/components/or-avatar-v3/OrAvatar.vue.d.ts +11 -0
  69. package/dist/bundled/v3/components/or-avatar-v3/index.js +3 -1
  70. package/dist/bundled/v3/components/or-avatar-v3/props.d.ts +2 -1
  71. package/dist/bundled/v3/components/or-avatar-v3/styles.d.ts +2 -0
  72. package/dist/bundled/v3/components/or-button-v3/index.js +1 -1
  73. package/dist/bundled/v3/components/or-card-collection-v3/OrCardCollection.stories3.d.ts +10 -0
  74. package/dist/bundled/v3/components/or-card-collection-v3/OrCardCollection.vue.d.ts +87 -40
  75. package/dist/bundled/v3/components/or-card-collection-v3/OrCardCollectionView.vue3.vue.d.ts +35 -0
  76. package/dist/bundled/v3/components/or-card-collection-v3/index.js +13 -6
  77. package/dist/bundled/v3/components/or-card-collection-v3/props.d.ts +5 -1
  78. package/dist/bundled/v3/components/or-card-collection-v3/styles.d.ts +2 -2
  79. package/dist/bundled/v3/components/or-card-collection-v3/types.d.ts +8 -3
  80. package/dist/bundled/v3/components/or-code/index.js +3 -2
  81. package/dist/bundled/v3/components/or-confirm-v3/index.js +5 -4
  82. package/dist/bundled/v3/components/or-empty-state-v3/OrEmptyState.vue.d.ts +1 -1
  83. package/dist/bundled/v3/components/or-empty-state-v3/index.js +2 -134
  84. package/dist/bundled/v3/components/or-icon-button-v3/index.js +1 -1
  85. package/dist/bundled/v3/components/or-inline-input-v3/index.js +3 -3
  86. package/dist/bundled/v3/components/or-inline-textarea-v3/index.js +3 -3
  87. package/dist/bundled/v3/components/or-input-box-v3/OrInputBox.vue.d.ts +1 -2
  88. package/dist/bundled/v3/components/or-input-v3/index.js +2 -2
  89. package/dist/bundled/v3/components/or-modal-v3/index.js +3 -3
  90. package/dist/bundled/v3/components/or-notification-v3/index.js +2 -2
  91. package/dist/bundled/v3/components/or-rich-text-editor-v3/index.js +6 -4
  92. package/dist/bundled/v3/components/or-rich-text-editor-v3/utils/codemirror/codemirrorNode.d.ts +3 -0
  93. package/dist/bundled/v3/components/or-rich-text-editor-v3/utils/codemirror/codemirrorView.d.ts +45 -0
  94. package/dist/bundled/v3/components/or-rich-text-editor-v3/utils/codemirror/index.d.ts +1 -0
  95. package/dist/bundled/v3/components/or-rich-text-editor-v3/utils/codemirror/index.js +2 -0
  96. package/dist/bundled/v3/components/or-rich-text-editor-v3/utils/codemirror/types.d.ts +19 -0
  97. package/dist/bundled/v3/components/or-search-v3/OrSearch.vue.d.ts +15 -2
  98. package/dist/bundled/v3/components/or-search-v3/index.js +3 -3
  99. package/dist/bundled/v3/components/or-select-v3/index.js +3 -3
  100. package/dist/bundled/v3/components/or-tag-v3/index.js +3 -3
  101. package/dist/bundled/v3/components/or-toast-v3/index.js +4 -4
  102. package/dist/bundled/v3/index-44faad6a.js +12186 -0
  103. package/dist/bundled/v3/index-780d00b0.js +13307 -0
  104. package/dist/bundled/v3/index.js +415 -351
  105. package/dist/bundled/v3/{types-6c5eee23.js → types-dcc78caa.js} +2 -2
  106. package/dist/esm/v2/{OrAvatar-0afdef36.js → OrAvatar-3d155af3.js} +41 -15
  107. package/dist/esm/v2/{OrButton-357a5756.js → OrButton-357e1e2c.js} +5 -1
  108. package/dist/esm/v2/OrCardCollection-57d11adf.js +350 -0
  109. package/dist/esm/v2/{OrCode-41dd5f9b.js → OrCode-d4400b42.js} +6 -4
  110. package/dist/esm/v2/{OrConfirm-b0b2e43c.js → OrConfirm-ec7aef0e.js} +1 -1
  111. package/dist/esm/v2/OrEmptyState-2481f13f.js +158 -0
  112. package/dist/esm/v2/{OrRichTextEditor-c3dee275.js → OrRichTextEditor-2d152db0.js} +59 -11
  113. package/dist/esm/v2/{OrSearch-ddb7c1fe.js → OrSearch-2f260b09.js} +8 -2
  114. package/dist/esm/v2/codemirrorView-8ea431d2.js +184 -0
  115. package/dist/esm/v2/components/index.d.ts +1 -0
  116. package/dist/esm/v2/components/index.js +13 -7
  117. package/dist/esm/v2/components/or-avatar-v3/OrAvatar.stories3.d.ts +1 -1
  118. package/dist/esm/v2/components/or-avatar-v3/OrAvatar.vue.d.ts +11 -0
  119. package/dist/esm/v2/components/or-avatar-v3/index.js +2 -1
  120. package/dist/esm/v2/components/or-avatar-v3/props.d.ts +2 -1
  121. package/dist/esm/v2/components/or-avatar-v3/styles.d.ts +2 -0
  122. package/dist/esm/v2/components/or-button-v3/index.js +1 -1
  123. package/dist/esm/v2/components/or-card-collection-v3/OrCardCollection.stories3.d.ts +10 -0
  124. package/dist/esm/v2/components/or-card-collection-v3/OrCardCollection.vue.d.ts +87 -40
  125. package/dist/esm/v2/components/or-card-collection-v3/OrCardCollectionView.vue2.vue.d.ts +35 -0
  126. package/dist/esm/v2/components/or-card-collection-v3/index.js +7 -4
  127. package/dist/esm/v2/components/or-card-collection-v3/props.d.ts +5 -1
  128. package/dist/esm/v2/components/or-card-collection-v3/styles.d.ts +2 -2
  129. package/dist/esm/v2/components/or-card-collection-v3/types.d.ts +8 -3
  130. package/dist/esm/v2/components/or-code/index.js +3 -1
  131. package/dist/esm/v2/components/or-confirm-v3/index.js +2 -2
  132. package/dist/esm/v2/components/or-empty-state-v3/OrEmptyState.vue.d.ts +1 -1
  133. package/dist/esm/v2/components/or-empty-state-v3/index.js +3 -158
  134. package/dist/esm/v2/components/or-input-box-v3/OrInputBox.vue.d.ts +1 -2
  135. package/dist/esm/v2/components/or-rich-text-editor-v3/index.js +8 -1
  136. package/dist/esm/v2/components/or-rich-text-editor-v3/utils/codemirror/codemirrorNode.d.ts +3 -0
  137. package/dist/esm/v2/components/or-rich-text-editor-v3/utils/codemirror/codemirrorView.d.ts +45 -0
  138. package/dist/esm/v2/components/or-rich-text-editor-v3/utils/codemirror/index.d.ts +1 -0
  139. package/dist/esm/v2/components/or-rich-text-editor-v3/utils/codemirror/index.js +5 -0
  140. package/dist/esm/v2/components/or-rich-text-editor-v3/utils/codemirror/types.d.ts +19 -0
  141. package/dist/esm/v2/components/or-search-v3/OrSearch.vue.d.ts +15 -2
  142. package/dist/esm/v2/components/or-search-v3/index.js +1 -1
  143. package/dist/esm/v2/index.js +13 -7
  144. package/dist/esm/v3/{OrAvatar-ef88d31c.js → OrAvatar-53a4429d.js} +43 -16
  145. package/dist/esm/v3/{OrButton-f4b9ee51.js → OrButton-bb6bf8a9.js} +5 -1
  146. package/dist/esm/v3/OrCardCollection-2a6514f3.js +298 -0
  147. package/dist/esm/v3/{OrCode-ee19a5e6.js → OrCode-5ed69c23.js} +3 -1
  148. package/dist/esm/v3/{OrConfirm-906427ef.js → OrConfirm-5d56cbd3.js} +1 -1
  149. package/dist/esm/v3/OrEmptyState-bb8e3145.js +135 -0
  150. package/dist/esm/v3/OrInput-41691fb3.js +1 -1
  151. package/dist/esm/v3/{OrInputBox-5247ab25.js → OrInputBox-6d1b6059.js} +1 -1
  152. package/dist/esm/v3/{OrRichTextEditor-b2e87342.js → OrRichTextEditor-f1271eb6.js} +58 -10
  153. package/dist/esm/v3/{OrSearch-cdde55ce.js → OrSearch-e5a2e93e.js} +9 -3
  154. package/dist/esm/v3/OrSelect-7e813982.js +1 -1
  155. package/dist/esm/v3/OrTextarea-bb9ef3f2.js +1 -1
  156. package/dist/esm/v3/codemirrorView-8ea431d2.js +184 -0
  157. package/dist/esm/v3/components/index.d.ts +1 -0
  158. package/dist/esm/v3/components/index.js +14 -8
  159. package/dist/esm/v3/components/or-avatar-v3/OrAvatar.stories3.d.ts +1 -1
  160. package/dist/esm/v3/components/or-avatar-v3/OrAvatar.vue.d.ts +11 -0
  161. package/dist/esm/v3/components/or-avatar-v3/index.js +2 -1
  162. package/dist/esm/v3/components/or-avatar-v3/props.d.ts +2 -1
  163. package/dist/esm/v3/components/or-avatar-v3/styles.d.ts +2 -0
  164. package/dist/esm/v3/components/or-button-v3/index.js +1 -1
  165. package/dist/esm/v3/components/or-card-collection-v3/OrCardCollection.stories3.d.ts +10 -0
  166. package/dist/esm/v3/components/or-card-collection-v3/OrCardCollection.vue.d.ts +87 -40
  167. package/dist/esm/v3/components/or-card-collection-v3/OrCardCollectionView.vue3.vue.d.ts +35 -0
  168. package/dist/esm/v3/components/or-card-collection-v3/index.js +8 -5
  169. package/dist/esm/v3/components/or-card-collection-v3/props.d.ts +5 -1
  170. package/dist/esm/v3/components/or-card-collection-v3/styles.d.ts +2 -2
  171. package/dist/esm/v3/components/or-card-collection-v3/types.d.ts +8 -3
  172. package/dist/esm/v3/components/or-code/index.js +3 -1
  173. package/dist/esm/v3/components/or-confirm-v3/index.js +3 -3
  174. package/dist/esm/v3/components/or-empty-state-v3/OrEmptyState.vue.d.ts +1 -1
  175. package/dist/esm/v3/components/or-empty-state-v3/index.js +3 -135
  176. package/dist/esm/v3/components/or-input-box-v3/OrInputBox.vue.d.ts +1 -2
  177. package/dist/esm/v3/components/or-input-box-v3/index.js +2 -2
  178. package/dist/esm/v3/components/or-input-v3/index.js +1 -1
  179. package/dist/esm/v3/components/or-rich-text-editor-v3/index.js +8 -1
  180. package/dist/esm/v3/components/or-rich-text-editor-v3/utils/codemirror/codemirrorNode.d.ts +3 -0
  181. package/dist/esm/v3/components/or-rich-text-editor-v3/utils/codemirror/codemirrorView.d.ts +45 -0
  182. package/dist/esm/v3/components/or-rich-text-editor-v3/utils/codemirror/index.d.ts +1 -0
  183. package/dist/esm/v3/components/or-rich-text-editor-v3/utils/codemirror/index.js +5 -0
  184. package/dist/esm/v3/components/or-rich-text-editor-v3/utils/codemirror/types.d.ts +19 -0
  185. package/dist/esm/v3/components/or-search-v3/OrSearch.vue.d.ts +15 -2
  186. package/dist/esm/v3/components/or-search-v3/index.js +2 -2
  187. package/dist/esm/v3/components/or-select-v3/index.js +1 -1
  188. package/dist/esm/v3/components/or-textarea-v3/index.js +1 -1
  189. package/dist/esm/v3/index.js +14 -8
  190. package/package.json +2 -1
  191. package/src/components/index.ts +1 -0
  192. package/src/components/or-avatar-v3/OrAvatar.stories3.ts +9 -7
  193. package/src/components/or-avatar-v3/OrAvatar.vue +22 -2
  194. package/src/components/or-avatar-v3/props.ts +1 -0
  195. package/src/components/or-avatar-v3/styles.ts +49 -11
  196. package/src/components/or-button-v3/styles.ts +6 -0
  197. package/src/components/or-card/OrCard.stories.ts +1 -1
  198. package/src/components/or-card-collection/OrCardCollection.stories.ts +1 -1
  199. package/src/components/or-card-collection-v3/OrCardCollection.docs.mdx +4 -0
  200. package/src/components/or-card-collection-v3/OrCardCollection.stories3.ts +246 -30
  201. package/src/components/or-card-collection-v3/OrCardCollection.vue +132 -77
  202. package/src/components/or-card-collection-v3/OrCardCollectionView.vue2.vue +41 -0
  203. package/src/components/or-card-collection-v3/OrCardCollectionView.vue3.vue +42 -0
  204. package/src/components/or-card-collection-v3/props.ts +14 -1
  205. package/src/components/or-card-collection-v3/styles.ts +6 -4
  206. package/src/components/or-card-collection-v3/types.ts +9 -3
  207. package/src/components/or-code/OrCode.vue +3 -1
  208. package/src/components/or-empty-state-v3/OrEmptyState.vue +16 -10
  209. package/src/components/or-input-box-v3/OrInputBox.vue +1 -2
  210. package/src/components/or-menu-v3/OrMenu.stories3.ts +1 -1
  211. package/src/components/or-rich-text-editor-v3/OrRichTextEditor.stories3.ts +2 -0
  212. package/src/components/or-rich-text-editor-v3/OrRichTextEditor.vue +32 -6
  213. package/src/components/or-rich-text-editor-v3/utils/codemirror/codemirrorNode.ts +40 -0
  214. package/src/components/or-rich-text-editor-v3/utils/codemirror/codemirrorView.ts +257 -0
  215. package/src/components/or-rich-text-editor-v3/utils/codemirror/index.ts +1 -0
  216. package/src/components/or-rich-text-editor-v3/utils/codemirror/types.ts +22 -0
  217. package/src/components/or-rich-text-editor-v3/utils/markdown.ts +2 -0
  218. package/src/components/or-search-v3/OrSearch.stories3.ts +1 -1
  219. package/src/components/or-search-v3/OrSearch.vue +8 -2
  220. package/src/components/or-teleport-v3/OrTeleport.stories3.ts +1 -1
  221. package/dist/bundled/v2/OrCardCollection-a9a779ea.js +0 -228
  222. package/dist/bundled/v2/OrCode-0cd991a1.js +0 -29579
  223. package/dist/bundled/v2/index.es-3f39f316.js +0 -115
  224. package/dist/bundled/v3/OrCardCollection.vue_vue_type_script_lang-3993a015.js +0 -164
  225. package/dist/bundled/v3/OrCode.vue_vue_type_script_lang-6c5f94a6.js +0 -29457
  226. package/dist/bundled/v3/index.es-3f39f316.js +0 -115
  227. package/dist/esm/v2/OrCardCollection-4f001551.js +0 -227
  228. package/dist/esm/v3/OrCardCollection-5a0febaf.js +0 -198
@@ -0,0 +1,4133 @@
1
+ import { E as EditorView, a as EditorSelection, P as Prec, k as keymap, b as EditorState } from './index-780d00b0.js';
2
+ import { C as ContextTracker, E as ExternalTokenizer, s as styleTags, t as tags$1, L as LRParser, p as parseMixed, a as LanguageSupport, b as syntaxTree, c as LRLanguage, i as indentNodeProp, d as continuedIndent, f as foldNodeProp, e as foldInside, j as javascriptLanguage, g as javascript, N as NodeType, h as NodeProp, k as NodeSet, P as Parser, T as Tag, l as Tree, m as Language, n as defineLanguageFacet, o as LanguageDescription, q as ParseContext, r as languageDataProp, u as basicSetup, v as indentWithTab } from './index-44faad6a.js';
3
+ import { useElementHover } from '@vueuse/core';
4
+ import _ from 'lodash';
5
+ import { defineComponent, ref } from 'vue';
6
+ import { s as script$3 } from './OrTeleportVue3-012351e1.js';
7
+ import './OrIconButton-e637158e.js';
8
+ import './OrModal-868160ef.js';
9
+ import { s as script$2 } from './OrModal.vue_vue_type_script_lang-a1ed2ebb.js';
10
+ import './OrError-b43ebad8.js';
11
+ import './OrHint-c9114268.js';
12
+ import './OrLabel-e412c532.js';
13
+ import { s as script$1 } from './OrIconButton.vue_vue_type_script_lang-40547ab0.js';
14
+ import { s as script$4 } from './OrError.vue_vue_type_script_lang-7c39e012.js';
15
+ import { s as script$5 } from './OrHint.vue_vue_type_script_lang-78598c8e.js';
16
+ import { s as script$6 } from './OrLabel.vue_vue_type_script_lang-27f8b12d.js';
17
+
18
+ var OrCodeLanguages;
19
+ (function (OrCodeLanguages) {
20
+ OrCodeLanguages["JS"] = "javascript";
21
+ OrCodeLanguages["TS"] = "typescript";
22
+ OrCodeLanguages["CSS"] = "css";
23
+ OrCodeLanguages["HTML"] = "html";
24
+ OrCodeLanguages["JSON"] = "json";
25
+ OrCodeLanguages["MD"] = "markdown";
26
+ })(OrCodeLanguages || (OrCodeLanguages = {}));
27
+
28
+ // This file was generated by lezer-generator. You probably shouldn't edit it.
29
+ const scriptText = 54,
30
+ StartCloseScriptTag = 1,
31
+ styleText = 55,
32
+ StartCloseStyleTag = 2,
33
+ textareaText = 56,
34
+ StartCloseTextareaTag = 3,
35
+ StartTag = 4,
36
+ StartScriptTag = 5,
37
+ StartStyleTag = 6,
38
+ StartTextareaTag = 7,
39
+ StartSelfClosingTag = 8,
40
+ StartCloseTag = 9,
41
+ NoMatchStartCloseTag = 10,
42
+ MismatchedStartCloseTag = 11,
43
+ missingCloseTag = 57,
44
+ IncompleteCloseTag = 12,
45
+ commentContent$1 = 58,
46
+ Element$1 = 18,
47
+ TagName = 20,
48
+ Attribute = 21,
49
+ AttributeName = 22,
50
+ AttributeValue = 24,
51
+ UnquotedAttributeValue = 25,
52
+ ScriptText = 27,
53
+ StyleText = 30,
54
+ TextareaText = 33,
55
+ OpenTag = 35,
56
+ CloseTag = 36,
57
+ Dialect_noMatch = 0;
58
+
59
+ /* Hand-written tokenizers for HTML. */
60
+
61
+ const selfClosers = {
62
+ area: true,
63
+ base: true,
64
+ br: true,
65
+ col: true,
66
+ command: true,
67
+ embed: true,
68
+ frame: true,
69
+ hr: true,
70
+ img: true,
71
+ input: true,
72
+ keygen: true,
73
+ link: true,
74
+ meta: true,
75
+ param: true,
76
+ source: true,
77
+ track: true,
78
+ wbr: true,
79
+ menuitem: true
80
+ };
81
+ const implicitlyClosed = {
82
+ dd: true,
83
+ li: true,
84
+ optgroup: true,
85
+ option: true,
86
+ p: true,
87
+ rp: true,
88
+ rt: true,
89
+ tbody: true,
90
+ td: true,
91
+ tfoot: true,
92
+ th: true,
93
+ tr: true
94
+ };
95
+ const closeOnOpen = {
96
+ dd: {
97
+ dd: true,
98
+ dt: true
99
+ },
100
+ dt: {
101
+ dd: true,
102
+ dt: true
103
+ },
104
+ li: {
105
+ li: true
106
+ },
107
+ option: {
108
+ option: true,
109
+ optgroup: true
110
+ },
111
+ optgroup: {
112
+ optgroup: true
113
+ },
114
+ p: {
115
+ address: true,
116
+ article: true,
117
+ aside: true,
118
+ blockquote: true,
119
+ dir: true,
120
+ div: true,
121
+ dl: true,
122
+ fieldset: true,
123
+ footer: true,
124
+ form: true,
125
+ h1: true,
126
+ h2: true,
127
+ h3: true,
128
+ h4: true,
129
+ h5: true,
130
+ h6: true,
131
+ header: true,
132
+ hgroup: true,
133
+ hr: true,
134
+ menu: true,
135
+ nav: true,
136
+ ol: true,
137
+ p: true,
138
+ pre: true,
139
+ section: true,
140
+ table: true,
141
+ ul: true
142
+ },
143
+ rp: {
144
+ rp: true,
145
+ rt: true
146
+ },
147
+ rt: {
148
+ rp: true,
149
+ rt: true
150
+ },
151
+ tbody: {
152
+ tbody: true,
153
+ tfoot: true
154
+ },
155
+ td: {
156
+ td: true,
157
+ th: true
158
+ },
159
+ tfoot: {
160
+ tbody: true
161
+ },
162
+ th: {
163
+ td: true,
164
+ th: true
165
+ },
166
+ thead: {
167
+ tbody: true,
168
+ tfoot: true
169
+ },
170
+ tr: {
171
+ tr: true
172
+ }
173
+ };
174
+ function nameChar(ch) {
175
+ return ch == 45 || ch == 46 || ch == 58 || ch >= 65 && ch <= 90 || ch == 95 || ch >= 97 && ch <= 122 || ch >= 161;
176
+ }
177
+ function isSpace(ch) {
178
+ return ch == 9 || ch == 10 || ch == 13 || ch == 32;
179
+ }
180
+ let cachedName = null,
181
+ cachedInput = null,
182
+ cachedPos = 0;
183
+ function tagNameAfter(input, offset) {
184
+ let pos = input.pos + offset;
185
+ if (cachedPos == pos && cachedInput == input) return cachedName;
186
+ let next = input.peek(offset);
187
+ while (isSpace(next)) next = input.peek(++offset);
188
+ let name = "";
189
+ for (;;) {
190
+ if (!nameChar(next)) break;
191
+ name += String.fromCharCode(next);
192
+ next = input.peek(++offset);
193
+ }
194
+ // Undefined to signal there's a <? or <!, null for just missing
195
+ cachedInput = input;
196
+ cachedPos = pos;
197
+ return cachedName = name ? name.toLowerCase() : next == question || next == bang ? undefined : null;
198
+ }
199
+ const lessThan = 60,
200
+ greaterThan = 62,
201
+ slash = 47,
202
+ question = 63,
203
+ bang = 33,
204
+ dash$1 = 45;
205
+ function ElementContext(name, parent) {
206
+ this.name = name;
207
+ this.parent = parent;
208
+ this.hash = parent ? parent.hash : 0;
209
+ for (let i = 0; i < name.length; i++) this.hash += (this.hash << 4) + name.charCodeAt(i) + (name.charCodeAt(i) << 8);
210
+ }
211
+ const startTagTerms = [StartTag, StartSelfClosingTag, StartScriptTag, StartStyleTag, StartTextareaTag];
212
+ const elementContext = new ContextTracker({
213
+ start: null,
214
+ shift(context, term, stack, input) {
215
+ return startTagTerms.indexOf(term) > -1 ? new ElementContext(tagNameAfter(input, 1) || "", context) : context;
216
+ },
217
+ reduce(context, term) {
218
+ return term == Element$1 && context ? context.parent : context;
219
+ },
220
+ reuse(context, node, stack, input) {
221
+ let type = node.type.id;
222
+ return type == StartTag || type == OpenTag ? new ElementContext(tagNameAfter(input, 1) || "", context) : context;
223
+ },
224
+ hash(context) {
225
+ return context ? context.hash : 0;
226
+ },
227
+ strict: false
228
+ });
229
+ const tagStart = new ExternalTokenizer((input, stack) => {
230
+ if (input.next != lessThan) {
231
+ // End of file, close any open tags
232
+ if (input.next < 0 && stack.context) input.acceptToken(missingCloseTag);
233
+ return;
234
+ }
235
+ input.advance();
236
+ let close = input.next == slash;
237
+ if (close) input.advance();
238
+ let name = tagNameAfter(input, 0);
239
+ if (name === undefined) return;
240
+ if (!name) return input.acceptToken(close ? IncompleteCloseTag : StartTag);
241
+ let parent = stack.context ? stack.context.name : null;
242
+ if (close) {
243
+ if (name == parent) return input.acceptToken(StartCloseTag);
244
+ if (parent && implicitlyClosed[parent]) return input.acceptToken(missingCloseTag, -2);
245
+ if (stack.dialectEnabled(Dialect_noMatch)) return input.acceptToken(NoMatchStartCloseTag);
246
+ for (let cx = stack.context; cx; cx = cx.parent) if (cx.name == name) return;
247
+ input.acceptToken(MismatchedStartCloseTag);
248
+ } else {
249
+ if (name == "script") return input.acceptToken(StartScriptTag);
250
+ if (name == "style") return input.acceptToken(StartStyleTag);
251
+ if (name == "textarea") return input.acceptToken(StartTextareaTag);
252
+ if (selfClosers.hasOwnProperty(name)) return input.acceptToken(StartSelfClosingTag);
253
+ if (parent && closeOnOpen[parent] && closeOnOpen[parent][name]) input.acceptToken(missingCloseTag, -1);else input.acceptToken(StartTag);
254
+ }
255
+ }, {
256
+ contextual: true
257
+ });
258
+ const commentContent = new ExternalTokenizer(input => {
259
+ for (let dashes = 0, i = 0;; i++) {
260
+ if (input.next < 0) {
261
+ if (i) input.acceptToken(commentContent$1);
262
+ break;
263
+ }
264
+ if (input.next == dash$1) {
265
+ dashes++;
266
+ } else if (input.next == greaterThan && dashes >= 2) {
267
+ if (i > 3) input.acceptToken(commentContent$1, -2);
268
+ break;
269
+ } else {
270
+ dashes = 0;
271
+ }
272
+ input.advance();
273
+ }
274
+ });
275
+ function contentTokenizer(tag, textToken, endToken) {
276
+ let lastState = 2 + tag.length;
277
+ return new ExternalTokenizer(input => {
278
+ // state means:
279
+ // - 0 nothing matched
280
+ // - 1 '<' matched
281
+ // - 2 '</' + possibly whitespace matched
282
+ // - 3-(1+tag.length) part of the tag matched
283
+ // - lastState whole tag + possibly whitespace matched
284
+ for (let state = 0, matchedLen = 0, i = 0;; i++) {
285
+ if (input.next < 0) {
286
+ if (i) input.acceptToken(textToken);
287
+ break;
288
+ }
289
+ if (state == 0 && input.next == lessThan || state == 1 && input.next == slash || state >= 2 && state < lastState && input.next == tag.charCodeAt(state - 2)) {
290
+ state++;
291
+ matchedLen++;
292
+ } else if ((state == 2 || state == lastState) && isSpace(input.next)) {
293
+ matchedLen++;
294
+ } else if (state == lastState && input.next == greaterThan) {
295
+ if (i > matchedLen) input.acceptToken(textToken, -matchedLen);else input.acceptToken(endToken, -(matchedLen - 2));
296
+ break;
297
+ } else if ((input.next == 10 /* '\n' */ || input.next == 13 /* '\r' */) && i) {
298
+ input.acceptToken(textToken, 1);
299
+ break;
300
+ } else {
301
+ state = matchedLen = 0;
302
+ }
303
+ input.advance();
304
+ }
305
+ });
306
+ }
307
+ const scriptTokens = contentTokenizer("script", scriptText, StartCloseScriptTag);
308
+ const styleTokens = contentTokenizer("style", styleText, StartCloseStyleTag);
309
+ const textareaTokens = contentTokenizer("textarea", textareaText, StartCloseTextareaTag);
310
+ const htmlHighlighting = styleTags({
311
+ "Text RawText": tags$1.content,
312
+ "StartTag StartCloseTag SelfClosingEndTag EndTag": tags$1.angleBracket,
313
+ TagName: tags$1.tagName,
314
+ "MismatchedCloseTag/TagName": [tags$1.tagName, tags$1.invalid],
315
+ AttributeName: tags$1.attributeName,
316
+ "AttributeValue UnquotedAttributeValue": tags$1.attributeValue,
317
+ Is: tags$1.definitionOperator,
318
+ "EntityReference CharacterReference": tags$1.character,
319
+ Comment: tags$1.blockComment,
320
+ ProcessingInst: tags$1.processingInstruction,
321
+ DoctypeDecl: tags$1.documentMeta
322
+ });
323
+
324
+ // This file was generated by lezer-generator. You probably shouldn't edit it.
325
+ const parser$3 = LRParser.deserialize({
326
+ version: 14,
327
+ states: ",xOVOxOOO!WQ!bO'#CoO!]Q!bO'#CyO!bQ!bO'#C|O!gQ!bO'#DPO!lQ!bO'#DRO!qOXO'#CnO!|OYO'#CnO#XO[O'#CnO$eOxO'#CnOOOW'#Cn'#CnO$lO!rO'#DTO$tQ!b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qP!ZqP~OSSOTPOUQOVROWTOXqOY]OZ[O[^O^^O_^O`^Oa^Ox^O!dZO~O!ZrO~P#dO![sO!euO~OdvO~OdwO~OfyOj|O~OfyOj!OO~OfyOj!QO~OfyOj!SOv!TO~OfyOj!TO~O!WfOPkX!ZkX~OP!WO!Z!XO~O!XiOQnX!ZnX~OQ!ZO!Z!XO~O!YlORqX!ZqX~OR!]O!Z!XO~O!Z!XO~P#dOd!_O~O![sO!e!aO~Oj!bO~Oj!cO~Og!dOfeXjeXveX~OfyOj!fO~OfyOj!gO~OfyOj!hO~OfyOj!iOv!jO~OfyOj!jO~Od!kO~Od!lO~Od!mO~Oj!nO~Oi!qO!`!oO!b!pO~Oj!rO~Oj!sO~Oj!tO~O_!uO`!uOa!uO!`!wO!a!uO~O_!xO`!xOa!xO!b!wO!c!xO~O_!uO`!uOa!uO!`!{O!a!uO~O_!xO`!xOa!xO!b!{O!c!xO~Ov~vj`!dx{_a_~",
329
+ goto: "%p!`PPPPPPPPPPPPPPPPPP!a!gP!mPP!yPP!|#P#S#Y#]#`#f#i#l#r#xP!aP!a!aP$O$U$l$r$x%O%U%[%bPPPPPPPP%hX^OX`pXUOX`pezabcde{}!P!R!UR!q!dRhUR!XhXVOX`pRkVR!XkXWOX`pRnWR!XnXXOX`pQrXR!XpXYOX`pQ`ORx`Q{aQ}bQ!PcQ!RdQ!UeZ!e{}!P!R!UQ!v!oR!z!vQ!y!pR!|!yQgUR!VgQjVR!YjQmWR![mQpXR!^pQtZR!`tS_O`ToXp",
330
+ nodeNames: "⚠ StartCloseTag StartCloseTag StartCloseTag StartTag StartTag StartTag StartTag StartTag StartCloseTag StartCloseTag StartCloseTag IncompleteCloseTag Document Text EntityReference CharacterReference InvalidEntity Element OpenTag TagName Attribute AttributeName Is AttributeValue UnquotedAttributeValue EndTag ScriptText CloseTag OpenTag StyleText CloseTag OpenTag TextareaText CloseTag OpenTag CloseTag SelfClosingTag SelfClosingEndTag Comment ProcessingInst MismatchedCloseTag CloseTag DoctypeDecl",
331
+ maxTerm: 67,
332
+ context: elementContext,
333
+ nodeProps: [["closedBy", -10, 1, 2, 3, 5, 6, 7, 8, 9, 10, 11, "EndTag", 4, "EndTag SelfClosingEndTag", -4, 19, 29, 32, 35, "CloseTag"], ["group", -9, 12, 15, 16, 17, 18, 39, 40, 41, 42, "Entity", 14, "Entity TextContent", -3, 27, 30, 33, "TextContent Entity"], ["openedBy", 26, "StartTag StartCloseTag", -4, 28, 31, 34, 36, "OpenTag", 38, "StartTag"]],
334
+ propSources: [htmlHighlighting],
335
+ skippedNodes: [0],
336
+ repeatNodeCount: 9,
337
+ tokenData: "#(r!aR!YOX$qXY,QYZ,QZ[$q[]&X]^,Q^p$qpq,Qqr-_rs4ysv-_vw5iwxJ^x}-_}!OKP!O!P-_!P!Q!!O!Q![-_![!]!$c!]!^-_!^!_!(k!_!`#'S!`!a#'z!a!c-_!c!}!$c!}#R-_#R#S!$c#S#T3V#T#o!$c#o#s-_#s$f$q$f%W-_%W%o!$c%o%p-_%p&a!$c&a&b-_&b1p!$c1p4U-_4U4d!$c4d4e-_4e$IS!$c$IS$I`-_$I`$Ib!$c$Ib$Kh-_$Kh%#t!$c%#t&/x-_&/x&Et!$c&Et&FV-_&FV;'S!$c;'S;:j!(e;:j;=`4s<%l?&r-_?&r?Ah!$c?Ah?BY$q?BY?Mn!$c?MnO$q!Z$|c^PiW!a`!cpOX$qXZ&XZ[$q[^&X^p$qpq&Xqr$qrs&}sv$qvw+Pwx(tx!^$q!^!_*V!_!a&X!a#S$q#S#T&X#T;'S$q;'S;=`+z<%lO$q!R&bX^P!a`!cpOr&Xrs&}sv&Xwx(tx!^&X!^!_*V!_;'S&X;'S;=`*y<%lO&Xq'UV^P!cpOv&}wx'kx!^&}!^!_(V!_;'S&};'S;=`(n<%lO&}P'pT^POv'kw!^'k!_;'S'k;'S;=`(P<%lO'kP(SP;=`<%l'kp([S!cpOv(Vx;'S(V;'S;=`(h<%lO(Vp(kP;=`<%l(Vq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|<%l?Ah!H^?Ah?BY!Ir?BY?Mn!H^?MnO!Ir!V#'PP;=`<%l!H^!V#'_XgS^P!a`!cpOr&Xrs&}sv&Xwx(tx!^&X!^!_*V!_;'S&X;'S;=`*y<%lO&X!X#(VX^P!a`!cpjUOr&Xrs&}sv&Xwx(tx!^&X!^!_*V!_;'S&X;'S;=`*y<%lO&X",
338
+ tokenizers: [scriptTokens, styleTokens, textareaTokens, tagStart, commentContent, 0, 1, 2, 3, 4, 5],
339
+ topRules: {
340
+ "Document": [0, 13]
341
+ },
342
+ dialects: {
343
+ noMatch: 0,
344
+ selfClosing: 485
345
+ },
346
+ tokenPrec: 487
347
+ });
348
+ function getAttrs(openTag, input) {
349
+ let attrs = Object.create(null);
350
+ for (let att of openTag.getChildren(Attribute)) {
351
+ let name = att.getChild(AttributeName),
352
+ value = att.getChild(AttributeValue) || att.getChild(UnquotedAttributeValue);
353
+ if (name) attrs[input.read(name.from, name.to)] = !value ? "" : value.type.id == AttributeValue ? input.read(value.from + 1, value.to - 1) : input.read(value.from, value.to);
354
+ }
355
+ return attrs;
356
+ }
357
+ function findTagName(openTag, input) {
358
+ let tagNameNode = openTag.getChild(TagName);
359
+ return tagNameNode ? input.read(tagNameNode.from, tagNameNode.to) : " ";
360
+ }
361
+ function maybeNest(node, input, tags) {
362
+ let attrs;
363
+ for (let tag of tags) {
364
+ if (!tag.attrs || tag.attrs(attrs || (attrs = getAttrs(node.node.parent.firstChild, input)))) return {
365
+ parser: tag.parser
366
+ };
367
+ }
368
+ return null;
369
+ }
370
+
371
+ // tags?: {
372
+ // tag: string,
373
+ // attrs?: ({[attr: string]: string}) => boolean,
374
+ // parser: Parser
375
+ // }[]
376
+ // attributes?: {
377
+ // name: string,
378
+ // tagName?: string,
379
+ // parser: Parser
380
+ // }[]
381
+
382
+ function configureNesting(tags = [], attributes = []) {
383
+ let script = [],
384
+ style = [],
385
+ textarea = [],
386
+ other = [];
387
+ for (let tag of tags) {
388
+ let array = tag.tag == "script" ? script : tag.tag == "style" ? style : tag.tag == "textarea" ? textarea : other;
389
+ array.push(tag);
390
+ }
391
+ let attrs = attributes.length ? Object.create(null) : null;
392
+ for (let attr of attributes) (attrs[attr.name] || (attrs[attr.name] = [])).push(attr);
393
+ return parseMixed((node, input) => {
394
+ let id = node.type.id;
395
+ if (id == ScriptText) return maybeNest(node, input, script);
396
+ if (id == StyleText) return maybeNest(node, input, style);
397
+ if (id == TextareaText) return maybeNest(node, input, textarea);
398
+ if (id == OpenTag && other.length) {
399
+ let n = node.node,
400
+ tagName = findTagName(n, input),
401
+ attrs;
402
+ for (let tag of other) {
403
+ if (tag.tag == tagName && (!tag.attrs || tag.attrs(attrs || (attrs = getAttrs(n, input))))) {
404
+ let close = n.parent.lastChild;
405
+ return {
406
+ parser: tag.parser,
407
+ overlay: [{
408
+ from: node.to,
409
+ to: close.type.id == CloseTag ? close.from : n.parent.to
410
+ }]
411
+ };
412
+ }
413
+ }
414
+ }
415
+ if (attrs && id == Attribute) {
416
+ let n = node.node,
417
+ nameNode;
418
+ if (nameNode = n.firstChild) {
419
+ let matches = attrs[input.read(nameNode.from, nameNode.to)];
420
+ if (matches) for (let attr of matches) {
421
+ if (attr.tagName && attr.tagName != findTagName(n.parent, input)) continue;
422
+ let value = n.lastChild;
423
+ if (value.type.id == AttributeValue) return {
424
+ parser: attr.parser,
425
+ overlay: [{
426
+ from: value.from + 1,
427
+ to: value.to - 1
428
+ }]
429
+ };else if (value.type.id == UnquotedAttributeValue) return {
430
+ parser: attr.parser,
431
+ overlay: [{
432
+ from: value.from,
433
+ to: value.to
434
+ }]
435
+ };
436
+ }
437
+ }
438
+ }
439
+ return null;
440
+ });
441
+ }
442
+
443
+ // This file was generated by lezer-generator. You probably shouldn't edit it.
444
+ const descendantOp = 94,
445
+ Unit = 1,
446
+ callee = 95,
447
+ identifier$2 = 96,
448
+ VariableName = 2;
449
+
450
+ /* Hand-written tokenizers for CSS tokens that can't be
451
+ expressed by Lezer's built-in tokenizer. */
452
+
453
+ const space$1 = [9, 10, 11, 12, 13, 32, 133, 160, 5760, 8192, 8193, 8194, 8195, 8196, 8197, 8198, 8199, 8200, 8201, 8202, 8232, 8233, 8239, 8287, 12288];
454
+ const colon = 58,
455
+ parenL = 40,
456
+ underscore = 95,
457
+ bracketL = 91,
458
+ dash = 45,
459
+ period = 46,
460
+ hash = 35,
461
+ percent = 37;
462
+ function isAlpha(ch) {
463
+ return ch >= 65 && ch <= 90 || ch >= 97 && ch <= 122 || ch >= 161;
464
+ }
465
+ function isDigit(ch) {
466
+ return ch >= 48 && ch <= 57;
467
+ }
468
+ const identifiers = new ExternalTokenizer((input, stack) => {
469
+ for (let inside = false, dashes = 0, i = 0;; i++) {
470
+ let {
471
+ next
472
+ } = input;
473
+ if (isAlpha(next) || next == dash || next == underscore || inside && isDigit(next)) {
474
+ if (!inside && (next != dash || i > 0)) inside = true;
475
+ if (dashes === i && next == dash) dashes++;
476
+ input.advance();
477
+ } else {
478
+ if (inside) input.acceptToken(next == parenL ? callee : dashes == 2 && stack.canShift(VariableName) ? VariableName : identifier$2);
479
+ break;
480
+ }
481
+ }
482
+ });
483
+ const descendant = new ExternalTokenizer(input => {
484
+ if (space$1.includes(input.peek(-1))) {
485
+ let {
486
+ next
487
+ } = input;
488
+ if (isAlpha(next) || next == underscore || next == hash || next == period || next == bracketL || next == colon || next == dash) input.acceptToken(descendantOp);
489
+ }
490
+ });
491
+ const unitToken = new ExternalTokenizer(input => {
492
+ if (!space$1.includes(input.peek(-1))) {
493
+ let {
494
+ next
495
+ } = input;
496
+ if (next == percent) {
497
+ input.advance();
498
+ input.acceptToken(Unit);
499
+ }
500
+ if (isAlpha(next)) {
501
+ do {
502
+ input.advance();
503
+ } while (isAlpha(input.next));
504
+ input.acceptToken(Unit);
505
+ }
506
+ }
507
+ });
508
+ const cssHighlighting = styleTags({
509
+ "AtKeyword import charset namespace keyframes media supports": tags$1.definitionKeyword,
510
+ "from to selector": tags$1.keyword,
511
+ NamespaceName: tags$1.namespace,
512
+ KeyframeName: tags$1.labelName,
513
+ TagName: tags$1.tagName,
514
+ ClassName: tags$1.className,
515
+ PseudoClassName: tags$1.constant(tags$1.className),
516
+ IdName: tags$1.labelName,
517
+ "FeatureName PropertyName": tags$1.propertyName,
518
+ AttributeName: tags$1.attributeName,
519
+ NumberLiteral: tags$1.number,
520
+ KeywordQuery: tags$1.keyword,
521
+ UnaryQueryOp: tags$1.operatorKeyword,
522
+ "CallTag ValueName": tags$1.atom,
523
+ VariableName: tags$1.variableName,
524
+ Callee: tags$1.operatorKeyword,
525
+ Unit: tags$1.unit,
526
+ "UniversalSelector NestingSelector": tags$1.definitionOperator,
527
+ MatchOp: tags$1.compareOperator,
528
+ "ChildOp SiblingOp, LogicOp": tags$1.logicOperator,
529
+ BinOp: tags$1.arithmeticOperator,
530
+ Important: tags$1.modifier,
531
+ Comment: tags$1.blockComment,
532
+ ParenthesizedContent: tags$1.special(tags$1.name),
533
+ ColorLiteral: tags$1.color,
534
+ StringLiteral: tags$1.string,
535
+ ":": tags$1.punctuation,
536
+ "PseudoOp #": tags$1.derefOperator,
537
+ "; ,": tags$1.separator,
538
+ "( )": tags$1.paren,
539
+ "[ ]": tags$1.squareBracket,
540
+ "{ }": tags$1.brace
541
+ });
542
+
543
+ // This file was generated by lezer-generator. You probably shouldn't edit it.
544
+ const spec_callee = {
545
+ __proto__: null,
546
+ lang: 32,
547
+ "nth-child": 32,
548
+ "nth-last-child": 32,
549
+ "nth-of-type": 32,
550
+ "nth-last-of-type": 32,
551
+ dir: 32,
552
+ "host-context": 32,
553
+ url: 60,
554
+ "url-prefix": 60,
555
+ domain: 60,
556
+ regexp: 60,
557
+ selector: 134
558
+ };
559
+ const spec_AtKeyword = {
560
+ __proto__: null,
561
+ "@import": 114,
562
+ "@media": 138,
563
+ "@charset": 142,
564
+ "@namespace": 146,
565
+ "@keyframes": 152,
566
+ "@supports": 164
567
+ };
568
+ const spec_identifier = {
569
+ __proto__: null,
570
+ not: 128,
571
+ only: 128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WQ!kfS#i!k#jR#j!lQ#Z!ZR#}#ZQ$S#bR$g$S_bOPcgt!j#h^TOPcgt!j#hQ!nlQ!vqQ!wrQ!xsQ#o!zR$O#]R#s!{Q!SYQ!`[Q#O!QQ#f!i[#q!{#r#y$_$d$mQ#t!}Q#v#QS$U#f$WQ$Z#mR$i$VR#p!zQhPR!ytQ!_ZQ!g`R#R!SU!ZZ`!SQ!f_Q#W!YQ#[![Q#{#XR#|#Y",
580
+ nodeNames: "⚠ Unit VariableName Comment StyleSheet RuleSet UniversalSelector TagSelector TagName NestingSelector ClassSelector ClassName PseudoClassSelector : :: PseudoClassName PseudoClassName ) ( ArgList ValueName ParenthesizedValue ColorLiteral NumberLiteral StringLiteral BinaryExpression BinOp CallExpression Callee CallLiteral CallTag ParenthesizedContent , PseudoClassName ArgList IdSelector # IdName ] AttributeSelector [ AttributeName MatchOp ChildSelector ChildOp DescendantSelector SiblingSelector SiblingOp } { Block Declaration PropertyName Important ; ImportStatement AtKeyword import KeywordQuery FeatureQuery FeatureName BinaryQuery LogicOp UnaryQuery UnaryQueryOp ParenthesizedQuery SelectorQuery selector MediaStatement media CharsetStatement charset NamespaceStatement namespace NamespaceName KeyframesStatement keyframes KeyframeName KeyframeList from to SupportsStatement supports AtRule Styles",
581
+ maxTerm: 108,
582
+ nodeProps: [["openedBy", 17, "(", 48, "{"], ["closedBy", 18, ")", 49, "}"]],
583
+ propSources: [cssHighlighting],
584
+ skippedNodes: [0, 3],
585
+ repeatNodeCount: 8,
586
+ tokenData: "Lq~R!^OX$}X^%u^p$}pq%uqr)Xrs.Rst/utu6duv$}vw7^wx7oxy9^yz9oz{9t{|:_|}?Q}!O?c!O!P@Q!P!Q@i!Q![Cu![!]Dp!]!^El!^!_$}!_!`E}!`!aF`!a!b$}!b!cG[!c!}$}!}#OHt#O#P$}#P#QIV#Q#R6d#R#T$}#T#UIh#U#c$}#c#dJy#d#o$}#o#pK`#p#q6d#q#rKq#r#sLS#s#y$}#y#z%u#z$f$}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<%lO%^XG_WOy%^z!c%^!c!}Gw!}#T%^#T#oGw#o;'S%^;'S;=`%o<%lO%^XHO[!YPoWOy%^z}%^}!OGw!O!Q%^!Q![Gw![!c%^!c!}Gw!}#T%^#T#oGw#o;'S%^;'S;=`%o<%lO%^XHySxPOy%^z;'S%^;'S;=`%o<%lO%^^I[SvUOy%^z;'S%^;'S;=`%o<%lO%^XIkUOy%^z#b%^#b#cI}#c;'S%^;'S;=`%o<%lO%^XJSUoWOy%^z#W%^#W#XJf#X;'S%^;'S;=`%o<%lO%^XJmS!`PoWOy%^z;'S%^;'S;=`%o<%lO%^XJ|UOy%^z#f%^#f#gJf#g;'S%^;'S;=`%o<%lO%^XKeS!RPOy%^z;'S%^;'S;=`%o<%lO%^_KvS!QVOy%^z;'S%^;'S;=`%o<%lO%^ZLXU!PPOy%^z!_%^!_!`6y!`;'S%^;'S;=`%o<%lO%^WLnP;=`<%l$}",
587
+ tokenizers: [descendant, unitToken, identifiers, 0, 1, 2, 3],
588
+ topRules: {
589
+ "StyleSheet": [0, 4],
590
+ "Styles": [1, 84]
591
+ },
592
+ specialized: [{
593
+ term: 95,
594
+ get: value => spec_callee[value] || -1
595
+ }, {
596
+ term: 56,
597
+ get: value => spec_AtKeyword[value] || -1
598
+ }, {
599
+ term: 96,
600
+ get: value => spec_identifier[value] || -1
601
+ }],
602
+ tokenPrec: 1123
603
+ });
604
+
605
+ let _properties = null;
606
+ function properties() {
607
+ if (!_properties && typeof document == "object" && document.body) {
608
+ let names = [];
609
+ for (let prop in document.body.style) {
610
+ if (!/[A-Z]|^-|^(item|length)$/.test(prop)) names.push(prop);
611
+ }
612
+ _properties = names.sort().map(name => ({
613
+ type: "property",
614
+ label: name
615
+ }));
616
+ }
617
+ return _properties || [];
618
+ }
619
+ const pseudoClasses = /*@__PURE__*/["active", "after", "before", "checked", "default", "disabled", "empty", "enabled", "first-child", "first-letter", "first-line", "first-of-type", "focus", "hover", "in-range", "indeterminate", "invalid", "lang", "last-child", "last-of-type", "link", "not", "nth-child", "nth-last-child", "nth-last-of-type", "nth-of-type", "only-of-type", "only-child", "optional", "out-of-range", "placeholder", "read-only", "read-write", "required", "root", "selection", "target", "valid", "visited"].map(name => ({
620
+ type: "class",
621
+ label: name
622
+ }));
623
+ const values = /*@__PURE__*/["above", "absolute", "activeborder", "additive", "activecaption", "after-white-space", "ahead", "alias", "all", "all-scroll", "alphabetic", "alternate", "always", "antialiased", "appworkspace", "asterisks", "attr", "auto", "auto-flow", "avoid", "avoid-column", "avoid-page", "avoid-region", "axis-pan", "background", "backwards", "baseline", "below", "bidi-override", "blink", "block", "block-axis", "bold", "bolder", "border", "border-box", "both", "bottom", "break", "break-all", "break-word", "bullets", "button", "button-bevel", "buttonface", "buttonhighlight", "buttonshadow", "buttontext", "calc", "capitalize", "caps-lock-indicator", "caption", "captiontext", "caret", "cell", "center", "checkbox", "circle", "cjk-decimal", "clear", "clip", "close-quote", "col-resize", "collapse", "color", "color-burn", "color-dodge", "column", "column-reverse", "compact", "condensed", "contain", "content", "contents", "content-box", "context-menu", "continuous", "copy", "counter", "counters", "cover", "crop", "cross", "crosshair", "currentcolor", "cursive", "cyclic", "darken", "dashed", "decimal", "decimal-leading-zero", "default", "default-button", "dense", "destination-atop", "destination-in", "destination-out", "destination-over", "difference", "disc", "discard", "disclosure-closed", "disclosure-open", "document", "dot-dash", "dot-dot-dash", "dotted", "double", "down", "e-resize", "ease", "ease-in", "ease-in-out", "ease-out", "element", "ellipse", "ellipsis", "embed", "end", "ethiopic-abegede-gez", "ethiopic-halehame-aa-er", "ethiopic-halehame-gez", "ew-resize", "exclusion", "expanded", "extends", "extra-condensed", "extra-expanded", "fantasy", "fast", "fill", "fill-box", "fixed", "flat", "flex", "flex-end", "flex-start", "footnotes", "forwards", "from", "geometricPrecision", "graytext", "grid", "groove", "hand", "hard-light", "help", "hidden", "hide", "higher", "highlight", "highlighttext", "horizontal", "hsl", "hsla", "hue", "icon", "ignore", "inactiveborder", "inactivecaption", "inactivecaptiontext", "infinite", "infobackground", "infotext", "inherit", "initial", "inline", "inline-axis", "inline-block", "inline-flex", "inline-grid", "inline-table", "inset", "inside", "intrinsic", "invert", "italic", "justify", "keep-all", "landscape", "large", "larger", "left", "level", "lighter", "lighten", "line-through", "linear", "linear-gradient", "lines", "list-item", "listbox", "listitem", "local", "logical", "loud", "lower", "lower-hexadecimal", "lower-latin", "lower-norwegian", "lowercase", "ltr", "luminosity", "manipulation", "match", "matrix", "matrix3d", "medium", "menu", "menutext", "message-box", "middle", "min-intrinsic", "mix", "monospace", "move", "multiple", "multiple_mask_images", "multiply", "n-resize", "narrower", "ne-resize", "nesw-resize", "no-close-quote", "no-drop", "no-open-quote", "no-repeat", "none", "normal", "not-allowed", "nowrap", "ns-resize", "numbers", "numeric", "nw-resize", "nwse-resize", "oblique", "opacity", "open-quote", "optimizeLegibility", "optimizeSpeed", "outset", "outside", "outside-shape", "overlay", "overline", "padding", "padding-box", "painted", "page", "paused", "perspective", "pinch-zoom", "plus-darker", "plus-lighter", "pointer", "polygon", "portrait", "pre", "pre-line", "pre-wrap", "preserve-3d", "progress", "push-button", "radial-gradient", "radio", "read-only", "read-write", "read-write-plaintext-only", "rectangle", "region", "relative", "repeat", "repeating-linear-gradient", "repeating-radial-gradient", "repeat-x", "repeat-y", "reset", "reverse", "rgb", "rgba", "ridge", "right", "rotate", "rotate3d", "rotateX", "rotateY", "rotateZ", "round", "row", "row-resize", "row-reverse", "rtl", "run-in", "running", "s-resize", "sans-serif", "saturation", "scale", "scale3d", "scaleX", "scaleY", "scaleZ", "screen", "scroll", "scrollbar", "scroll-position", "se-resize", "self-start", "self-end", "semi-condensed", "semi-expanded", "separate", "serif", "show", "single", "skew", "skewX", "skewY", "skip-white-space", "slide", "slider-horizontal", "slider-vertical", "sliderthumb-horizontal", "sliderthumb-vertical", "slow", "small", "small-caps", "small-caption", "smaller", "soft-light", "solid", "source-atop", "source-in", "source-out", "source-over", "space", "space-around", "space-between", "space-evenly", "spell-out", "square", "start", "static", "status-bar", "stretch", "stroke", "stroke-box", "sub", "subpixel-antialiased", "svg_masks", "super", "sw-resize", "symbolic", "symbols", "system-ui", "table", "table-caption", "table-cell", "table-column", "table-column-group", "table-footer-group", "table-header-group", "table-row", "table-row-group", "text", "text-bottom", "text-top", "textarea", "textfield", "thick", "thin", "threeddarkshadow", "threedface", "threedhighlight", "threedlightshadow", "threedshadow", "to", "top", "transform", "translate", "translate3d", "translateX", "translateY", "translateZ", "transparent", "ultra-condensed", "ultra-expanded", "underline", "unidirectional-pan", "unset", "up", "upper-latin", "uppercase", "url", "var", "vertical", "vertical-text", "view-box", "visible", "visibleFill", "visiblePainted", "visibleStroke", "visual", "w-resize", "wait", "wave", "wider", "window", "windowframe", "windowtext", "words", "wrap", "wrap-reverse", "x-large", "x-small", "xor", "xx-large", "xx-small"].map(name => ({
624
+ type: "keyword",
625
+ label: name
626
+ })).concat( /*@__PURE__*/["aliceblue", "antiquewhite", "aqua", "aquamarine", "azure", "beige", "bisque", "black", "blanchedalmond", "blue", "blueviolet", "brown", "burlywood", "cadetblue", "chartreuse", "chocolate", "coral", "cornflowerblue", "cornsilk", "crimson", "cyan", "darkblue", "darkcyan", "darkgoldenrod", "darkgray", "darkgreen", "darkkhaki", "darkmagenta", "darkolivegreen", "darkorange", "darkorchid", "darkred", "darksalmon", "darkseagreen", "darkslateblue", "darkslategray", "darkturquoise", "darkviolet", "deeppink", "deepskyblue", "dimgray", "dodgerblue", "firebrick", "floralwhite", "forestgreen", "fuchsia", "gainsboro", "ghostwhite", "gold", "goldenrod", "gray", "grey", "green", "greenyellow", "honeydew", "hotpink", "indianred", "indigo", "ivory", "khaki", "lavender", "lavenderblush", "lawngreen", "lemonchiffon", "lightblue", "lightcoral", "lightcyan", "lightgoldenrodyellow", "lightgray", "lightgreen", "lightpink", "lightsalmon", "lightseagreen", "lightskyblue", "lightslategray", "lightsteelblue", "lightyellow", "lime", "limegreen", "linen", "magenta", "maroon", "mediumaquamarine", "mediumblue", "mediumorchid", "mediumpurple", "mediumseagreen", "mediumslateblue", "mediumspringgreen", "mediumturquoise", "mediumvioletred", "midnightblue", "mintcream", "mistyrose", "moccasin", "navajowhite", "navy", "oldlace", "olive", "olivedrab", "orange", "orangered", "orchid", "palegoldenrod", "palegreen", "paleturquoise", "palevioletred", "papayawhip", "peachpuff", "peru", "pink", "plum", "powderblue", "purple", "rebeccapurple", "red", "rosybrown", "royalblue", "saddlebrown", "salmon", "sandybrown", "seagreen", "seashell", "sienna", "silver", "skyblue", "slateblue", "slategray", "snow", "springgreen", "steelblue", "tan", "teal", "thistle", "tomato", "turquoise", "violet", "wheat", "white", "whitesmoke", "yellow", "yellowgreen"].map(name => ({
627
+ type: "constant",
628
+ label: name
629
+ })));
630
+ const tags = /*@__PURE__*/["a", "abbr", "address", "article", "aside", "b", "bdi", "bdo", "blockquote", "body", "br", "button", "canvas", "caption", "cite", "code", "col", "colgroup", "dd", "del", "details", "dfn", "dialog", "div", "dl", "dt", "em", "figcaption", "figure", "footer", "form", "header", "hgroup", "h1", "h2", "h3", "h4", "h5", "h6", "hr", "html", "i", "iframe", "img", "input", "ins", "kbd", "label", "legend", "li", "main", "meter", "nav", "ol", "output", "p", "pre", "ruby", "section", "select", "small", "source", "span", "strong", "sub", "summary", "sup", "table", "tbody", "td", "template", "textarea", "tfoot", "th", "thead", "tr", "u", "ul"].map(name => ({
631
+ type: "type",
632
+ label: name
633
+ }));
634
+ const identifier$1 = /^[\w-]*/;
635
+ /**
636
+ CSS property and value keyword completion source.
637
+ */
638
+ const cssCompletionSource = context => {
639
+ let {
640
+ state,
641
+ pos
642
+ } = context,
643
+ node = syntaxTree(state).resolveInner(pos, -1);
644
+ if (node.name == "PropertyName") return {
645
+ from: node.from,
646
+ options: properties(),
647
+ validFor: identifier$1
648
+ };
649
+ if (node.name == "ValueName") return {
650
+ from: node.from,
651
+ options: values,
652
+ validFor: identifier$1
653
+ };
654
+ if (node.name == "PseudoClassName") return {
655
+ from: node.from,
656
+ options: pseudoClasses,
657
+ validFor: identifier$1
658
+ };
659
+ if (node.name == "TagName") {
660
+ for (let {
661
+ parent
662
+ } = node; parent; parent = parent.parent) if (parent.name == "Block") return {
663
+ from: node.from,
664
+ options: properties(),
665
+ validFor: identifier$1
666
+ };
667
+ return {
668
+ from: node.from,
669
+ options: tags,
670
+ validFor: identifier$1
671
+ };
672
+ }
673
+ if (!context.explicit) return null;
674
+ let above = node.resolve(pos),
675
+ before = above.childBefore(pos);
676
+ if (before && before.name == ":" && above.name == "PseudoClassSelector") return {
677
+ from: pos,
678
+ options: pseudoClasses,
679
+ validFor: identifier$1
680
+ };
681
+ if (before && before.name == ":" && above.name == "Declaration" || above.name == "ArgList") return {
682
+ from: pos,
683
+ options: values,
684
+ validFor: identifier$1
685
+ };
686
+ if (above.name == "Block") return {
687
+ from: pos,
688
+ options: properties(),
689
+ validFor: identifier$1
690
+ };
691
+ return null;
692
+ };
693
+
694
+ /**
695
+ A language provider based on the [Lezer CSS
696
+ parser](https://github.com/lezer-parser/css), extended with
697
+ highlighting and indentation information.
698
+ */
699
+ const cssLanguage = /*@__PURE__*/LRLanguage.define({
700
+ parser: /*@__PURE__*/parser$2.configure({
701
+ props: [/*@__PURE__*/indentNodeProp.add({
702
+ Declaration: /*@__PURE__*/continuedIndent()
703
+ }), /*@__PURE__*/foldNodeProp.add({
704
+ Block: foldInside
705
+ })]
706
+ }),
707
+ languageData: {
708
+ commentTokens: {
709
+ block: {
710
+ open: "/*",
711
+ close: "*/"
712
+ }
713
+ },
714
+ indentOnInput: /^\s*\}$/,
715
+ wordChars: "-"
716
+ }
717
+ });
718
+ /**
719
+ Language support for CSS.
720
+ */
721
+ function css() {
722
+ return new LanguageSupport(cssLanguage, cssLanguage.data.of({
723
+ autocomplete: cssCompletionSource
724
+ }));
725
+ }
726
+
727
+ const Targets = ["_blank", "_self", "_top", "_parent"];
728
+ const Charsets = ["ascii", "utf-8", "utf-16", "latin1", "latin1"];
729
+ const Methods = ["get", "post", "put", "delete"];
730
+ const Encs = ["application/x-www-form-urlencoded", "multipart/form-data", "text/plain"];
731
+ const Bool = ["true", "false"];
732
+ const S = {}; // Empty tag spec
733
+ const Tags = {
734
+ a: {
735
+ attrs: {
736
+ href: null,
737
+ ping: null,
738
+ type: null,
739
+ media: null,
740
+ target: Targets,
741
+ hreflang: null
742
+ }
743
+ },
744
+ abbr: S,
745
+ acronym: S,
746
+ address: S,
747
+ applet: S,
748
+ area: {
749
+ attrs: {
750
+ alt: null,
751
+ coords: null,
752
+ href: null,
753
+ target: null,
754
+ ping: null,
755
+ media: null,
756
+ hreflang: null,
757
+ type: null,
758
+ shape: ["default", "rect", "circle", "poly"]
759
+ }
760
+ },
761
+ article: S,
762
+ aside: S,
763
+ audio: {
764
+ attrs: {
765
+ src: null,
766
+ mediagroup: null,
767
+ crossorigin: ["anonymous", "use-credentials"],
768
+ preload: ["none", "metadata", "auto"],
769
+ autoplay: ["autoplay"],
770
+ loop: ["loop"],
771
+ controls: ["controls"]
772
+ }
773
+ },
774
+ b: S,
775
+ base: {
776
+ attrs: {
777
+ href: null,
778
+ target: Targets
779
+ }
780
+ },
781
+ basefont: S,
782
+ bdi: S,
783
+ bdo: S,
784
+ big: S,
785
+ blockquote: {
786
+ attrs: {
787
+ cite: null
788
+ }
789
+ },
790
+ body: S,
791
+ br: S,
792
+ button: {
793
+ attrs: {
794
+ form: null,
795
+ formaction: null,
796
+ name: null,
797
+ value: null,
798
+ autofocus: ["autofocus"],
799
+ disabled: ["autofocus"],
800
+ formenctype: Encs,
801
+ formmethod: Methods,
802
+ formnovalidate: ["novalidate"],
803
+ formtarget: Targets,
804
+ type: ["submit", "reset", "button"]
805
+ }
806
+ },
807
+ canvas: {
808
+ attrs: {
809
+ width: null,
810
+ height: null
811
+ }
812
+ },
813
+ caption: S,
814
+ center: S,
815
+ cite: S,
816
+ code: S,
817
+ col: {
818
+ attrs: {
819
+ span: null
820
+ }
821
+ },
822
+ colgroup: {
823
+ attrs: {
824
+ span: null
825
+ }
826
+ },
827
+ command: {
828
+ attrs: {
829
+ type: ["command", "checkbox", "radio"],
830
+ label: null,
831
+ icon: null,
832
+ radiogroup: null,
833
+ command: null,
834
+ title: null,
835
+ disabled: ["disabled"],
836
+ checked: ["checked"]
837
+ }
838
+ },
839
+ data: {
840
+ attrs: {
841
+ value: null
842
+ }
843
+ },
844
+ datagrid: {
845
+ attrs: {
846
+ disabled: ["disabled"],
847
+ multiple: ["multiple"]
848
+ }
849
+ },
850
+ datalist: {
851
+ attrs: {
852
+ data: null
853
+ }
854
+ },
855
+ dd: S,
856
+ del: {
857
+ attrs: {
858
+ cite: null,
859
+ datetime: null
860
+ }
861
+ },
862
+ details: {
863
+ attrs: {
864
+ open: ["open"]
865
+ }
866
+ },
867
+ dfn: S,
868
+ dir: S,
869
+ div: S,
870
+ dl: S,
871
+ dt: S,
872
+ em: S,
873
+ embed: {
874
+ attrs: {
875
+ src: null,
876
+ type: null,
877
+ width: null,
878
+ height: null
879
+ }
880
+ },
881
+ eventsource: {
882
+ attrs: {
883
+ src: null
884
+ }
885
+ },
886
+ fieldset: {
887
+ attrs: {
888
+ disabled: ["disabled"],
889
+ form: null,
890
+ name: null
891
+ }
892
+ },
893
+ figcaption: S,
894
+ figure: S,
895
+ font: S,
896
+ footer: S,
897
+ form: {
898
+ attrs: {
899
+ action: null,
900
+ name: null,
901
+ "accept-charset": Charsets,
902
+ autocomplete: ["on", "off"],
903
+ enctype: Encs,
904
+ method: Methods,
905
+ novalidate: ["novalidate"],
906
+ target: Targets
907
+ }
908
+ },
909
+ frame: S,
910
+ frameset: S,
911
+ h1: S,
912
+ h2: S,
913
+ h3: S,
914
+ h4: S,
915
+ h5: S,
916
+ h6: S,
917
+ head: {
918
+ children: ["title", "base", "link", "style", "meta", "script", "noscript", "command"]
919
+ },
920
+ header: S,
921
+ hgroup: S,
922
+ hr: S,
923
+ html: {
924
+ attrs: {
925
+ manifest: null
926
+ }
927
+ },
928
+ i: S,
929
+ iframe: {
930
+ attrs: {
931
+ src: null,
932
+ srcdoc: null,
933
+ name: null,
934
+ width: null,
935
+ height: null,
936
+ sandbox: ["allow-top-navigation", "allow-same-origin", "allow-forms", "allow-scripts"],
937
+ seamless: ["seamless"]
938
+ }
939
+ },
940
+ img: {
941
+ attrs: {
942
+ alt: null,
943
+ src: null,
944
+ ismap: null,
945
+ usemap: null,
946
+ width: null,
947
+ height: null,
948
+ crossorigin: ["anonymous", "use-credentials"]
949
+ }
950
+ },
951
+ input: {
952
+ attrs: {
953
+ alt: null,
954
+ dirname: null,
955
+ form: null,
956
+ formaction: null,
957
+ height: null,
958
+ list: null,
959
+ max: null,
960
+ maxlength: null,
961
+ min: null,
962
+ name: null,
963
+ pattern: null,
964
+ placeholder: null,
965
+ size: null,
966
+ src: null,
967
+ step: null,
968
+ value: null,
969
+ width: null,
970
+ accept: ["audio/*", "video/*", "image/*"],
971
+ autocomplete: ["on", "off"],
972
+ autofocus: ["autofocus"],
973
+ checked: ["checked"],
974
+ disabled: ["disabled"],
975
+ formenctype: Encs,
976
+ formmethod: Methods,
977
+ formnovalidate: ["novalidate"],
978
+ formtarget: Targets,
979
+ multiple: ["multiple"],
980
+ readonly: ["readonly"],
981
+ required: ["required"],
982
+ type: ["hidden", "text", "search", "tel", "url", "email", "password", "datetime", "date", "month", "week", "time", "datetime-local", "number", "range", "color", "checkbox", "radio", "file", "submit", "image", "reset", "button"]
983
+ }
984
+ },
985
+ ins: {
986
+ attrs: {
987
+ cite: null,
988
+ datetime: null
989
+ }
990
+ },
991
+ kbd: S,
992
+ keygen: {
993
+ attrs: {
994
+ challenge: null,
995
+ form: null,
996
+ name: null,
997
+ autofocus: ["autofocus"],
998
+ disabled: ["disabled"],
999
+ keytype: ["RSA"]
1000
+ }
1001
+ },
1002
+ label: {
1003
+ attrs: {
1004
+ for: null,
1005
+ form: null
1006
+ }
1007
+ },
1008
+ legend: S,
1009
+ li: {
1010
+ attrs: {
1011
+ value: null
1012
+ }
1013
+ },
1014
+ link: {
1015
+ attrs: {
1016
+ href: null,
1017
+ type: null,
1018
+ hreflang: null,
1019
+ media: null,
1020
+ sizes: ["all", "16x16", "16x16 32x32", "16x16 32x32 64x64"]
1021
+ }
1022
+ },
1023
+ map: {
1024
+ attrs: {
1025
+ name: null
1026
+ }
1027
+ },
1028
+ mark: S,
1029
+ menu: {
1030
+ attrs: {
1031
+ label: null,
1032
+ type: ["list", "context", "toolbar"]
1033
+ }
1034
+ },
1035
+ meta: {
1036
+ attrs: {
1037
+ content: null,
1038
+ charset: Charsets,
1039
+ name: ["viewport", "application-name", "author", "description", "generator", "keywords"],
1040
+ "http-equiv": ["content-language", "content-type", "default-style", "refresh"]
1041
+ }
1042
+ },
1043
+ meter: {
1044
+ attrs: {
1045
+ value: null,
1046
+ min: null,
1047
+ low: null,
1048
+ high: null,
1049
+ max: null,
1050
+ optimum: null
1051
+ }
1052
+ },
1053
+ nav: S,
1054
+ noframes: S,
1055
+ noscript: S,
1056
+ object: {
1057
+ attrs: {
1058
+ data: null,
1059
+ type: null,
1060
+ name: null,
1061
+ usemap: null,
1062
+ form: null,
1063
+ width: null,
1064
+ height: null,
1065
+ typemustmatch: ["typemustmatch"]
1066
+ }
1067
+ },
1068
+ ol: {
1069
+ attrs: {
1070
+ reversed: ["reversed"],
1071
+ start: null,
1072
+ type: ["1", "a", "A", "i", "I"]
1073
+ },
1074
+ children: ["li", "script", "template", "ul", "ol"]
1075
+ },
1076
+ optgroup: {
1077
+ attrs: {
1078
+ disabled: ["disabled"],
1079
+ label: null
1080
+ }
1081
+ },
1082
+ option: {
1083
+ attrs: {
1084
+ disabled: ["disabled"],
1085
+ label: null,
1086
+ selected: ["selected"],
1087
+ value: null
1088
+ }
1089
+ },
1090
+ output: {
1091
+ attrs: {
1092
+ for: null,
1093
+ form: null,
1094
+ name: null
1095
+ }
1096
+ },
1097
+ p: S,
1098
+ param: {
1099
+ attrs: {
1100
+ name: null,
1101
+ value: null
1102
+ }
1103
+ },
1104
+ pre: S,
1105
+ progress: {
1106
+ attrs: {
1107
+ value: null,
1108
+ max: null
1109
+ }
1110
+ },
1111
+ q: {
1112
+ attrs: {
1113
+ cite: null
1114
+ }
1115
+ },
1116
+ rp: S,
1117
+ rt: S,
1118
+ ruby: S,
1119
+ s: S,
1120
+ samp: S,
1121
+ script: {
1122
+ attrs: {
1123
+ type: ["text/javascript"],
1124
+ src: null,
1125
+ async: ["async"],
1126
+ defer: ["defer"],
1127
+ charset: Charsets
1128
+ }
1129
+ },
1130
+ section: S,
1131
+ select: {
1132
+ attrs: {
1133
+ form: null,
1134
+ name: null,
1135
+ size: null,
1136
+ autofocus: ["autofocus"],
1137
+ disabled: ["disabled"],
1138
+ multiple: ["multiple"]
1139
+ }
1140
+ },
1141
+ slot: {
1142
+ attrs: {
1143
+ name: null
1144
+ }
1145
+ },
1146
+ small: S,
1147
+ source: {
1148
+ attrs: {
1149
+ src: null,
1150
+ type: null,
1151
+ media: null
1152
+ }
1153
+ },
1154
+ span: S,
1155
+ strike: S,
1156
+ strong: S,
1157
+ style: {
1158
+ attrs: {
1159
+ type: ["text/css"],
1160
+ media: null,
1161
+ scoped: null
1162
+ }
1163
+ },
1164
+ sub: S,
1165
+ summary: S,
1166
+ sup: S,
1167
+ table: S,
1168
+ tbody: S,
1169
+ td: {
1170
+ attrs: {
1171
+ colspan: null,
1172
+ rowspan: null,
1173
+ headers: null
1174
+ }
1175
+ },
1176
+ template: S,
1177
+ textarea: {
1178
+ attrs: {
1179
+ dirname: null,
1180
+ form: null,
1181
+ maxlength: null,
1182
+ name: null,
1183
+ placeholder: null,
1184
+ rows: null,
1185
+ cols: null,
1186
+ autofocus: ["autofocus"],
1187
+ disabled: ["disabled"],
1188
+ readonly: ["readonly"],
1189
+ required: ["required"],
1190
+ wrap: ["soft", "hard"]
1191
+ }
1192
+ },
1193
+ tfoot: S,
1194
+ th: {
1195
+ attrs: {
1196
+ colspan: null,
1197
+ rowspan: null,
1198
+ headers: null,
1199
+ scope: ["row", "col", "rowgroup", "colgroup"]
1200
+ }
1201
+ },
1202
+ thead: S,
1203
+ time: {
1204
+ attrs: {
1205
+ datetime: null
1206
+ }
1207
+ },
1208
+ title: S,
1209
+ tr: S,
1210
+ track: {
1211
+ attrs: {
1212
+ src: null,
1213
+ label: null,
1214
+ default: null,
1215
+ kind: ["subtitles", "captions", "descriptions", "chapters", "metadata"],
1216
+ srclang: null
1217
+ }
1218
+ },
1219
+ tt: S,
1220
+ u: S,
1221
+ ul: {
1222
+ children: ["li", "script", "template", "ul", "ol"]
1223
+ },
1224
+ var: S,
1225
+ video: {
1226
+ attrs: {
1227
+ src: null,
1228
+ poster: null,
1229
+ width: null,
1230
+ height: null,
1231
+ crossorigin: ["anonymous", "use-credentials"],
1232
+ preload: ["auto", "metadata", "none"],
1233
+ autoplay: ["autoplay"],
1234
+ mediagroup: ["movie"],
1235
+ muted: ["muted"],
1236
+ controls: ["controls"]
1237
+ }
1238
+ },
1239
+ wbr: S
1240
+ };
1241
+ const GlobalAttrs = {
1242
+ accesskey: null,
1243
+ class: null,
1244
+ contenteditable: Bool,
1245
+ contextmenu: null,
1246
+ dir: ["ltr", "rtl", "auto"],
1247
+ draggable: ["true", "false", "auto"],
1248
+ dropzone: ["copy", "move", "link", "string:", "file:"],
1249
+ hidden: ["hidden"],
1250
+ id: null,
1251
+ inert: ["inert"],
1252
+ itemid: null,
1253
+ itemprop: null,
1254
+ itemref: null,
1255
+ itemscope: ["itemscope"],
1256
+ itemtype: null,
1257
+ lang: ["ar", "bn", "de", "en-GB", "en-US", "es", "fr", "hi", "id", "ja", "pa", "pt", "ru", "tr", "zh"],
1258
+ spellcheck: Bool,
1259
+ autocorrect: Bool,
1260
+ autocapitalize: Bool,
1261
+ style: null,
1262
+ tabindex: null,
1263
+ title: null,
1264
+ translate: ["yes", "no"],
1265
+ onclick: null,
1266
+ rel: ["stylesheet", "alternate", "author", "bookmark", "help", "license", "next", "nofollow", "noreferrer", "prefetch", "prev", "search", "tag"],
1267
+ role: /*@__PURE__*/"alert application article banner button cell checkbox complementary contentinfo dialog document feed figure form grid gridcell heading img list listbox listitem main navigation region row rowgroup search switch tab table tabpanel textbox timer".split(" "),
1268
+ "aria-activedescendant": null,
1269
+ "aria-atomic": Bool,
1270
+ "aria-autocomplete": ["inline", "list", "both", "none"],
1271
+ "aria-busy": Bool,
1272
+ "aria-checked": ["true", "false", "mixed", "undefined"],
1273
+ "aria-controls": null,
1274
+ "aria-describedby": null,
1275
+ "aria-disabled": Bool,
1276
+ "aria-dropeffect": null,
1277
+ "aria-expanded": ["true", "false", "undefined"],
1278
+ "aria-flowto": null,
1279
+ "aria-grabbed": ["true", "false", "undefined"],
1280
+ "aria-haspopup": Bool,
1281
+ "aria-hidden": Bool,
1282
+ "aria-invalid": ["true", "false", "grammar", "spelling"],
1283
+ "aria-label": null,
1284
+ "aria-labelledby": null,
1285
+ "aria-level": null,
1286
+ "aria-live": ["off", "polite", "assertive"],
1287
+ "aria-multiline": Bool,
1288
+ "aria-multiselectable": Bool,
1289
+ "aria-owns": null,
1290
+ "aria-posinset": null,
1291
+ "aria-pressed": ["true", "false", "mixed", "undefined"],
1292
+ "aria-readonly": Bool,
1293
+ "aria-relevant": null,
1294
+ "aria-required": Bool,
1295
+ "aria-selected": ["true", "false", "undefined"],
1296
+ "aria-setsize": null,
1297
+ "aria-sort": ["ascending", "descending", "none", "other"],
1298
+ "aria-valuemax": null,
1299
+ "aria-valuemin": null,
1300
+ "aria-valuenow": null,
1301
+ "aria-valuetext": null
1302
+ };
1303
+ class Schema {
1304
+ constructor(extraTags, extraAttrs) {
1305
+ this.tags = Object.assign(Object.assign({}, Tags), extraTags);
1306
+ this.globalAttrs = Object.assign(Object.assign({}, GlobalAttrs), extraAttrs);
1307
+ this.allTags = Object.keys(this.tags);
1308
+ this.globalAttrNames = Object.keys(this.globalAttrs);
1309
+ }
1310
+ }
1311
+ Schema.default = /*@__PURE__*/new Schema();
1312
+ function elementName(doc, tree, max = doc.length) {
1313
+ if (!tree) return "";
1314
+ let tag = tree.firstChild;
1315
+ let name = tag && tag.getChild("TagName");
1316
+ return name ? doc.sliceString(name.from, Math.min(name.to, max)) : "";
1317
+ }
1318
+ function findParentElement(tree, skip = false) {
1319
+ for (let cur = tree.parent; cur; cur = cur.parent) if (cur.name == "Element") {
1320
+ if (skip) skip = false;else return cur;
1321
+ }
1322
+ return null;
1323
+ }
1324
+ function allowedChildren(doc, tree, schema) {
1325
+ let parentInfo = schema.tags[elementName(doc, findParentElement(tree, true))];
1326
+ return (parentInfo === null || parentInfo === void 0 ? void 0 : parentInfo.children) || schema.allTags;
1327
+ }
1328
+ function openTags(doc, tree) {
1329
+ let open = [];
1330
+ for (let parent = tree; parent = findParentElement(parent);) {
1331
+ let tagName = elementName(doc, parent);
1332
+ if (tagName && parent.lastChild.name == "CloseTag") break;
1333
+ if (tagName && open.indexOf(tagName) < 0 && (tree.name == "EndTag" || tree.from >= parent.firstChild.to)) open.push(tagName);
1334
+ }
1335
+ return open;
1336
+ }
1337
+ const identifier = /^[:\-\.\w\u00b7-\uffff]*$/;
1338
+ function completeTag(state, schema, tree, from, to) {
1339
+ let end = /\s*>/.test(state.sliceDoc(to, to + 5)) ? "" : ">";
1340
+ return {
1341
+ from,
1342
+ to,
1343
+ options: allowedChildren(state.doc, tree, schema).map(tagName => ({
1344
+ label: tagName,
1345
+ type: "type"
1346
+ })).concat(openTags(state.doc, tree).map((tag, i) => ({
1347
+ label: "/" + tag,
1348
+ apply: "/" + tag + end,
1349
+ type: "type",
1350
+ boost: 99 - i
1351
+ }))),
1352
+ validFor: /^\/?[:\-\.\w\u00b7-\uffff]*$/
1353
+ };
1354
+ }
1355
+ function completeCloseTag(state, tree, from, to) {
1356
+ let end = /\s*>/.test(state.sliceDoc(to, to + 5)) ? "" : ">";
1357
+ return {
1358
+ from,
1359
+ to,
1360
+ options: openTags(state.doc, tree).map((tag, i) => ({
1361
+ label: tag,
1362
+ apply: tag + end,
1363
+ type: "type",
1364
+ boost: 99 - i
1365
+ })),
1366
+ validFor: identifier
1367
+ };
1368
+ }
1369
+ function completeStartTag(state, schema, tree, pos) {
1370
+ let options = [],
1371
+ level = 0;
1372
+ for (let tagName of allowedChildren(state.doc, tree, schema)) options.push({
1373
+ label: "<" + tagName,
1374
+ type: "type"
1375
+ });
1376
+ for (let open of openTags(state.doc, tree)) options.push({
1377
+ label: "</" + open + ">",
1378
+ type: "type",
1379
+ boost: 99 - level++
1380
+ });
1381
+ return {
1382
+ from: pos,
1383
+ to: pos,
1384
+ options,
1385
+ validFor: /^<\/?[:\-\.\w\u00b7-\uffff]*$/
1386
+ };
1387
+ }
1388
+ function completeAttrName(state, schema, tree, from, to) {
1389
+ let elt = findParentElement(tree),
1390
+ info = elt ? schema.tags[elementName(state.doc, elt)] : null;
1391
+ let names = info && info.attrs ? Object.keys(info.attrs).concat(schema.globalAttrNames) : schema.globalAttrNames;
1392
+ return {
1393
+ from,
1394
+ to,
1395
+ options: names.map(attrName => ({
1396
+ label: attrName,
1397
+ type: "property"
1398
+ })),
1399
+ validFor: identifier
1400
+ };
1401
+ }
1402
+ function completeAttrValue(state, schema, tree, from, to) {
1403
+ var _a;
1404
+ let nameNode = (_a = tree.parent) === null || _a === void 0 ? void 0 : _a.getChild("AttributeName");
1405
+ let options = [],
1406
+ token = undefined;
1407
+ if (nameNode) {
1408
+ let attrName = state.sliceDoc(nameNode.from, nameNode.to);
1409
+ let attrs = schema.globalAttrs[attrName];
1410
+ if (!attrs) {
1411
+ let elt = findParentElement(tree),
1412
+ info = elt ? schema.tags[elementName(state.doc, elt)] : null;
1413
+ attrs = (info === null || info === void 0 ? void 0 : info.attrs) && info.attrs[attrName];
1414
+ }
1415
+ if (attrs) {
1416
+ let base = state.sliceDoc(from, to).toLowerCase(),
1417
+ quoteStart = '"',
1418
+ quoteEnd = '"';
1419
+ if (/^['"]/.test(base)) {
1420
+ token = base[0] == '"' ? /^[^"]*$/ : /^[^']*$/;
1421
+ quoteStart = "";
1422
+ quoteEnd = state.sliceDoc(to, to + 1) == base[0] ? "" : base[0];
1423
+ base = base.slice(1);
1424
+ from++;
1425
+ } else {
1426
+ token = /^[^\s<>='"]*$/;
1427
+ }
1428
+ for (let value of attrs) options.push({
1429
+ label: value,
1430
+ apply: quoteStart + value + quoteEnd,
1431
+ type: "constant"
1432
+ });
1433
+ }
1434
+ }
1435
+ return {
1436
+ from,
1437
+ to,
1438
+ options,
1439
+ validFor: token
1440
+ };
1441
+ }
1442
+ function htmlCompletionFor(schema, context) {
1443
+ let {
1444
+ state,
1445
+ pos
1446
+ } = context,
1447
+ around = syntaxTree(state).resolveInner(pos),
1448
+ tree = around.resolve(pos, -1);
1449
+ for (let scan = pos, before; around == tree && (before = tree.childBefore(scan));) {
1450
+ let last = before.lastChild;
1451
+ if (!last || !last.type.isError || last.from < last.to) break;
1452
+ around = tree = before;
1453
+ scan = last.from;
1454
+ }
1455
+ if (tree.name == "TagName") {
1456
+ return tree.parent && /CloseTag$/.test(tree.parent.name) ? completeCloseTag(state, tree, tree.from, pos) : completeTag(state, schema, tree, tree.from, pos);
1457
+ } else if (tree.name == "StartTag") {
1458
+ return completeTag(state, schema, tree, pos, pos);
1459
+ } else if (tree.name == "StartCloseTag" || tree.name == "IncompleteCloseTag") {
1460
+ return completeCloseTag(state, tree, pos, pos);
1461
+ } else if (context.explicit && (tree.name == "OpenTag" || tree.name == "SelfClosingTag") || tree.name == "AttributeName") {
1462
+ return completeAttrName(state, schema, tree, tree.name == "AttributeName" ? tree.from : pos, pos);
1463
+ } else if (tree.name == "Is" || tree.name == "AttributeValue" || tree.name == "UnquotedAttributeValue") {
1464
+ return completeAttrValue(state, schema, tree, tree.name == "Is" ? pos : tree.from, pos);
1465
+ } else if (context.explicit && (around.name == "Element" || around.name == "Text" || around.name == "Document")) {
1466
+ return completeStartTag(state, schema, tree, pos);
1467
+ } else {
1468
+ return null;
1469
+ }
1470
+ }
1471
+ /**
1472
+ Create a completion source for HTML extended with additional tags
1473
+ or attributes.
1474
+ */
1475
+ function htmlCompletionSourceWith(config) {
1476
+ let {
1477
+ extraTags,
1478
+ extraGlobalAttributes: extraAttrs
1479
+ } = config;
1480
+ let schema = extraAttrs || extraTags ? new Schema(extraTags, extraAttrs) : Schema.default;
1481
+ return context => htmlCompletionFor(schema, context);
1482
+ }
1483
+
1484
+ /**
1485
+ A language provider based on the [Lezer HTML
1486
+ parser](https://github.com/lezer-parser/html), extended with the
1487
+ JavaScript and CSS parsers to parse the content of `<script>` and
1488
+ `<style>` tags.
1489
+ */
1490
+ const htmlLanguage = /*@__PURE__*/LRLanguage.define({
1491
+ parser: /*@__PURE__*/parser$3.configure({
1492
+ props: [/*@__PURE__*/indentNodeProp.add({
1493
+ Element(context) {
1494
+ let after = /^(\s*)(<\/)?/.exec(context.textAfter);
1495
+ if (context.node.to <= context.pos + after[0].length) return context.continue();
1496
+ return context.lineIndent(context.node.from) + (after[2] ? 0 : context.unit);
1497
+ },
1498
+ "OpenTag CloseTag SelfClosingTag"(context) {
1499
+ return context.column(context.node.from) + context.unit;
1500
+ },
1501
+ Document(context) {
1502
+ if (context.pos + /\s*/.exec(context.textAfter)[0].length < context.node.to) return context.continue();
1503
+ let endElt = null,
1504
+ close;
1505
+ for (let cur = context.node;;) {
1506
+ let last = cur.lastChild;
1507
+ if (!last || last.name != "Element" || last.to != cur.to) break;
1508
+ endElt = cur = last;
1509
+ }
1510
+ if (endElt && !((close = endElt.lastChild) && (close.name == "CloseTag" || close.name == "SelfClosingTag"))) return context.lineIndent(endElt.from) + context.unit;
1511
+ return null;
1512
+ }
1513
+ }), /*@__PURE__*/foldNodeProp.add({
1514
+ Element(node) {
1515
+ let first = node.firstChild,
1516
+ last = node.lastChild;
1517
+ if (!first || first.name != "OpenTag") return null;
1518
+ return {
1519
+ from: first.to,
1520
+ to: last.name == "CloseTag" ? last.from : node.to
1521
+ };
1522
+ }
1523
+ })],
1524
+ wrap: /*@__PURE__*/configureNesting([{
1525
+ tag: "script",
1526
+ attrs(attrs) {
1527
+ return !attrs.type || /^(?:text|application)\/(?:x-)?(?:java|ecma)script$|^module$|^$/i.test(attrs.type);
1528
+ },
1529
+ parser: javascriptLanguage.parser
1530
+ }, {
1531
+ tag: "style",
1532
+ attrs(attrs) {
1533
+ return (!attrs.lang || attrs.lang == "css") && (!attrs.type || /^(text\/)?(x-)?(stylesheet|css)$/i.test(attrs.type));
1534
+ },
1535
+ parser: cssLanguage.parser
1536
+ }])
1537
+ }),
1538
+ languageData: {
1539
+ commentTokens: {
1540
+ block: {
1541
+ open: "<!--",
1542
+ close: "-->"
1543
+ }
1544
+ },
1545
+ indentOnInput: /^\s*<\/\w+\W$/,
1546
+ wordChars: "-._"
1547
+ }
1548
+ });
1549
+ /**
1550
+ Language support for HTML, including
1551
+ [`htmlCompletion`](https://codemirror.net/6/docs/ref/#lang-html.htmlCompletion) and JavaScript and
1552
+ CSS support extensions.
1553
+ */
1554
+ function html(config = {}) {
1555
+ let lang = htmlLanguage;
1556
+ if (config.matchClosingTags === false) lang = lang.configure({
1557
+ dialect: "noMatch"
1558
+ });
1559
+ return new LanguageSupport(lang, [htmlLanguage.data.of({
1560
+ autocomplete: htmlCompletionSourceWith(config)
1561
+ }), config.autoCloseTags !== false ? autoCloseTags : [], javascript().support, css().support]);
1562
+ }
1563
+ /**
1564
+ Extension that will automatically insert close tags when a `>` or
1565
+ `/` is typed.
1566
+ */
1567
+ const autoCloseTags = /*@__PURE__*/EditorView.inputHandler.of((view, from, to, text) => {
1568
+ if (view.composing || view.state.readOnly || from != to || text != ">" && text != "/" || !htmlLanguage.isActiveAt(view.state, from, -1)) return false;
1569
+ let {
1570
+ state
1571
+ } = view;
1572
+ let changes = state.changeByRange(range => {
1573
+ var _a, _b, _c;
1574
+ let {
1575
+ head
1576
+ } = range,
1577
+ around = syntaxTree(state).resolveInner(head, -1),
1578
+ name;
1579
+ if (around.name == "TagName" || around.name == "StartTag") around = around.parent;
1580
+ if (text == ">" && around.name == "OpenTag") {
1581
+ if (((_b = (_a = around.parent) === null || _a === void 0 ? void 0 : _a.lastChild) === null || _b === void 0 ? void 0 : _b.name) != "CloseTag" && (name = elementName(state.doc, around.parent, head))) return {
1582
+ range: EditorSelection.cursor(head + 1),
1583
+ changes: {
1584
+ from: head,
1585
+ insert: `></${name}>`
1586
+ }
1587
+ };
1588
+ } else if (text == "/" && around.name == "OpenTag") {
1589
+ let empty = around.parent,
1590
+ base = empty === null || empty === void 0 ? void 0 : empty.parent;
1591
+ if (empty.from == head - 1 && ((_c = base.lastChild) === null || _c === void 0 ? void 0 : _c.name) != "CloseTag" && (name = elementName(state.doc, base, head))) {
1592
+ let insert = `/${name}>`;
1593
+ return {
1594
+ range: EditorSelection.cursor(head + insert.length),
1595
+ changes: {
1596
+ from: head,
1597
+ insert
1598
+ }
1599
+ };
1600
+ }
1601
+ }
1602
+ return {
1603
+ range
1604
+ };
1605
+ });
1606
+ if (changes.changes.empty) return false;
1607
+ view.dispatch(changes, {
1608
+ userEvent: "input.type",
1609
+ scrollIntoView: true
1610
+ });
1611
+ return true;
1612
+ });
1613
+
1614
+ const jsonHighlighting = styleTags({
1615
+ String: tags$1.string,
1616
+ Number: tags$1.number,
1617
+ "True False": tags$1.bool,
1618
+ PropertyName: tags$1.propertyName,
1619
+ Null: tags$1.null,
1620
+ ",": tags$1.separator,
1621
+ "[ ]": tags$1.squareBracket,
1622
+ "{ }": tags$1.brace
1623
+ });
1624
+
1625
+ // This file was generated by lezer-generator. You probably shouldn't edit it.
1626
+ const parser$1 = LRParser.deserialize({
1627
+ version: 14,
1628
+ states: "$bOVQPOOOOQO'#Cb'#CbOnQPO'#CeOvQPO'#CjOOQO'#Cp'#CpQOQPOOOOQO'#Cg'#CgO}QPO'#CfO!SQPO'#CrOOQO,59P,59PO![QPO,59PO!aQPO'#CuOOQO,59U,59UO!iQPO,59UOVQPO,59QOqQPO'#CkO!nQPO,59^OOQO1G.k1G.kOVQPO'#ClO!vQPO,59aOOQO1G.p1G.pOOQO1G.l1G.lOOQO,59V,59VOOQO-E6i-E6iOOQO,59W,59WOOQO-E6j-E6j",
1629
+ stateData: "#O~OcOS~OQSORSOSSOTSOWQO]ROePO~OVXOeUO~O[[O~PVOg^O~Oh_OVfX~OVaO~OhbO[iX~O[dO~Oh_OVfa~OhbO[ia~O",
1630
+ goto: "!kjPPPPPPkPPkqwPPk{!RPPP!XP!ePP!hXSOR^bQWQRf_TVQ_Q`WRg`QcZRicQTOQZRQe^RhbRYQR]R",
1631
+ nodeNames: "⚠ JsonText True False Null Number String } { Object Property PropertyName ] [ Array",
1632
+ maxTerm: 25,
1633
+ nodeProps: [["openedBy", 7, "{", 12, "["], ["closedBy", 8, "}", 13, "]"]],
1634
+ propSources: [jsonHighlighting],
1635
+ skippedNodes: [0],
1636
+ repeatNodeCount: 2,
1637
+ tokenData: "(p~RaXY!WYZ!W]^!Wpq!Wrs!]|}$i}!O$n!Q!R$w!R![&V![!]&h!}#O&m#P#Q&r#Y#Z&w#b#c'f#h#i'}#o#p(f#q#r(k~!]Oc~~!`Upq!]qr!]rs!rs#O!]#O#P!w#P~!]~!wOe~~!zXrs!]!P!Q!]#O#P!]#U#V!]#Y#Z!]#b#c!]#f#g!]#h#i!]#i#j#g~#jR!Q![#s!c!i#s#T#Z#s~#vR!Q![$P!c!i$P#T#Z$P~$SR!Q![$]!c!i$]#T#Z$]~$`R!Q![!]!c!i!]#T#Z!]~$nOh~~$qQ!Q!R$w!R![&V~$|RT~!O!P%V!g!h%k#X#Y%k~%YP!Q![%]~%bRT~!Q![%]!g!h%k#X#Y%k~%nR{|%w}!O%w!Q![%}~%zP!Q![%}~&SPT~!Q![%}~&[ST~!O!P%V!Q![&V!g!h%k#X#Y%k~&mOg~~&rO]~~&wO[~~&zP#T#U&}~'QP#`#a'T~'WP#g#h'Z~'^P#X#Y'a~'fOR~~'iP#i#j'l~'oP#`#a'r~'uP#`#a'x~'}OS~~(QP#f#g(T~(WP#i#j(Z~(^P#X#Y(a~(fOQ~~(kOW~~(pOV~",
1638
+ tokenizers: [0],
1639
+ topRules: {
1640
+ "JsonText": [0, 1]
1641
+ },
1642
+ tokenPrec: 0
1643
+ });
1644
+
1645
+ /**
1646
+ A language provider that provides JSON parsing.
1647
+ */
1648
+ const jsonLanguage = /*@__PURE__*/LRLanguage.define({
1649
+ parser: /*@__PURE__*/parser$1.configure({
1650
+ props: [/*@__PURE__*/indentNodeProp.add({
1651
+ Object: /*@__PURE__*/continuedIndent({
1652
+ except: /^\s*\}/
1653
+ }),
1654
+ Array: /*@__PURE__*/continuedIndent({
1655
+ except: /^\s*\]/
1656
+ })
1657
+ }), /*@__PURE__*/foldNodeProp.add({
1658
+ "Object Array": foldInside
1659
+ })]
1660
+ }),
1661
+ languageData: {
1662
+ closeBrackets: {
1663
+ brackets: ["[", "{", '"']
1664
+ },
1665
+ indentOnInput: /^\s*[\}\]]$/
1666
+ }
1667
+ });
1668
+ /**
1669
+ JSON language support.
1670
+ */
1671
+ function json() {
1672
+ return new LanguageSupport(jsonLanguage);
1673
+ }
1674
+
1675
+ class CompositeBlock {
1676
+ constructor(type,
1677
+ // Used for indentation in list items, markup character in lists
1678
+ value, from, hash, end, children, positions) {
1679
+ this.type = type;
1680
+ this.value = value;
1681
+ this.from = from;
1682
+ this.hash = hash;
1683
+ this.end = end;
1684
+ this.children = children;
1685
+ this.positions = positions;
1686
+ this.hashProp = [[NodeProp.contextHash, hash]];
1687
+ }
1688
+ static create(type, value, from, parentHash, end) {
1689
+ let hash = parentHash + (parentHash << 8) + type + (value << 4) | 0;
1690
+ return new CompositeBlock(type, value, from, hash, end, [], []);
1691
+ }
1692
+ addChild(child, pos) {
1693
+ if (child.prop(NodeProp.contextHash) != this.hash) child = new Tree(child.type, child.children, child.positions, child.length, this.hashProp);
1694
+ this.children.push(child);
1695
+ this.positions.push(pos);
1696
+ }
1697
+ toTree(nodeSet, end = this.end) {
1698
+ let last = this.children.length - 1;
1699
+ if (last >= 0) end = Math.max(end, this.positions[last] + this.children[last].length + this.from);
1700
+ let tree = new Tree(nodeSet.types[this.type], this.children, this.positions, end - this.from).balance({
1701
+ makeTree: (children, positions, length) => new Tree(NodeType.none, children, positions, length, this.hashProp)
1702
+ });
1703
+ return tree;
1704
+ }
1705
+ }
1706
+ var Type;
1707
+ (function (Type) {
1708
+ Type[Type["Document"] = 1] = "Document";
1709
+ Type[Type["CodeBlock"] = 2] = "CodeBlock";
1710
+ Type[Type["FencedCode"] = 3] = "FencedCode";
1711
+ Type[Type["Blockquote"] = 4] = "Blockquote";
1712
+ Type[Type["HorizontalRule"] = 5] = "HorizontalRule";
1713
+ Type[Type["BulletList"] = 6] = "BulletList";
1714
+ Type[Type["OrderedList"] = 7] = "OrderedList";
1715
+ Type[Type["ListItem"] = 8] = "ListItem";
1716
+ Type[Type["ATXHeading1"] = 9] = "ATXHeading1";
1717
+ Type[Type["ATXHeading2"] = 10] = "ATXHeading2";
1718
+ Type[Type["ATXHeading3"] = 11] = "ATXHeading3";
1719
+ Type[Type["ATXHeading4"] = 12] = "ATXHeading4";
1720
+ Type[Type["ATXHeading5"] = 13] = "ATXHeading5";
1721
+ Type[Type["ATXHeading6"] = 14] = "ATXHeading6";
1722
+ Type[Type["SetextHeading1"] = 15] = "SetextHeading1";
1723
+ Type[Type["SetextHeading2"] = 16] = "SetextHeading2";
1724
+ Type[Type["HTMLBlock"] = 17] = "HTMLBlock";
1725
+ Type[Type["LinkReference"] = 18] = "LinkReference";
1726
+ Type[Type["Paragraph"] = 19] = "Paragraph";
1727
+ Type[Type["CommentBlock"] = 20] = "CommentBlock";
1728
+ Type[Type["ProcessingInstructionBlock"] = 21] = "ProcessingInstructionBlock";
1729
+ // Inline
1730
+ Type[Type["Escape"] = 22] = "Escape";
1731
+ Type[Type["Entity"] = 23] = "Entity";
1732
+ Type[Type["HardBreak"] = 24] = "HardBreak";
1733
+ Type[Type["Emphasis"] = 25] = "Emphasis";
1734
+ Type[Type["StrongEmphasis"] = 26] = "StrongEmphasis";
1735
+ Type[Type["Link"] = 27] = "Link";
1736
+ Type[Type["Image"] = 28] = "Image";
1737
+ Type[Type["InlineCode"] = 29] = "InlineCode";
1738
+ Type[Type["HTMLTag"] = 30] = "HTMLTag";
1739
+ Type[Type["Comment"] = 31] = "Comment";
1740
+ Type[Type["ProcessingInstruction"] = 32] = "ProcessingInstruction";
1741
+ Type[Type["URL"] = 33] = "URL";
1742
+ // Smaller tokens
1743
+ Type[Type["HeaderMark"] = 34] = "HeaderMark";
1744
+ Type[Type["QuoteMark"] = 35] = "QuoteMark";
1745
+ Type[Type["ListMark"] = 36] = "ListMark";
1746
+ Type[Type["LinkMark"] = 37] = "LinkMark";
1747
+ Type[Type["EmphasisMark"] = 38] = "EmphasisMark";
1748
+ Type[Type["CodeMark"] = 39] = "CodeMark";
1749
+ Type[Type["CodeText"] = 40] = "CodeText";
1750
+ Type[Type["CodeInfo"] = 41] = "CodeInfo";
1751
+ Type[Type["LinkTitle"] = 42] = "LinkTitle";
1752
+ Type[Type["LinkLabel"] = 43] = "LinkLabel";
1753
+ })(Type || (Type = {}));
1754
+ /// Data structure used to accumulate a block's content during [leaf
1755
+ /// block parsing](#BlockParser.leaf).
1756
+ class LeafBlock {
1757
+ /// @internal
1758
+ constructor(
1759
+ /// The start position of the block.
1760
+ start,
1761
+ /// The block's text content.
1762
+ content) {
1763
+ this.start = start;
1764
+ this.content = content;
1765
+ /// @internal
1766
+ this.marks = [];
1767
+ /// The block parsers active for this block.
1768
+ this.parsers = [];
1769
+ }
1770
+ }
1771
+ /// Data structure used during block-level per-line parsing.
1772
+ class Line {
1773
+ constructor() {
1774
+ /// The line's full text.
1775
+ this.text = "";
1776
+ /// The base indent provided by the composite contexts (that have
1777
+ /// been handled so far).
1778
+ this.baseIndent = 0;
1779
+ /// The string position corresponding to the base indent.
1780
+ this.basePos = 0;
1781
+ /// The number of contexts handled @internal
1782
+ this.depth = 0;
1783
+ /// Any markers (i.e. block quote markers) parsed for the contexts. @internal
1784
+ this.markers = [];
1785
+ /// The position of the next non-whitespace character beyond any
1786
+ /// list, blockquote, or other composite block markers.
1787
+ this.pos = 0;
1788
+ /// The column of the next non-whitespace character.
1789
+ this.indent = 0;
1790
+ /// The character code of the character after `pos`.
1791
+ this.next = -1;
1792
+ }
1793
+ /// @internal
1794
+ forward() {
1795
+ if (this.basePos > this.pos) this.forwardInner();
1796
+ }
1797
+ /// @internal
1798
+ forwardInner() {
1799
+ let newPos = this.skipSpace(this.basePos);
1800
+ this.indent = this.countIndent(newPos, this.pos, this.indent);
1801
+ this.pos = newPos;
1802
+ this.next = newPos == this.text.length ? -1 : this.text.charCodeAt(newPos);
1803
+ }
1804
+ /// Skip whitespace after the given position, return the position of
1805
+ /// the next non-space character or the end of the line if there's
1806
+ /// only space after `from`.
1807
+ skipSpace(from) {
1808
+ return skipSpace(this.text, from);
1809
+ }
1810
+ /// @internal
1811
+ reset(text) {
1812
+ this.text = text;
1813
+ this.baseIndent = this.basePos = this.pos = this.indent = 0;
1814
+ this.forwardInner();
1815
+ this.depth = 1;
1816
+ while (this.markers.length) this.markers.pop();
1817
+ }
1818
+ /// Move the line's base position forward to the given position.
1819
+ /// This should only be called by composite [block
1820
+ /// parsers](#BlockParser.parse) or [markup skipping
1821
+ /// functions](#NodeSpec.composite).
1822
+ moveBase(to) {
1823
+ this.basePos = to;
1824
+ this.baseIndent = this.countIndent(to, this.pos, this.indent);
1825
+ }
1826
+ /// Move the line's base position forward to the given _column_.
1827
+ moveBaseColumn(indent) {
1828
+ this.baseIndent = indent;
1829
+ this.basePos = this.findColumn(indent);
1830
+ }
1831
+ /// Store a composite-block-level marker. Should be called from
1832
+ /// [markup skipping functions](#NodeSpec.composite) when they
1833
+ /// consume any non-whitespace characters.
1834
+ addMarker(elt) {
1835
+ this.markers.push(elt);
1836
+ }
1837
+ /// Find the column position at `to`, optionally starting at a given
1838
+ /// position and column.
1839
+ countIndent(to, from = 0, indent = 0) {
1840
+ for (let i = from; i < to; i++) indent += this.text.charCodeAt(i) == 9 ? 4 - indent % 4 : 1;
1841
+ return indent;
1842
+ }
1843
+ /// Find the position corresponding to the given column.
1844
+ findColumn(goal) {
1845
+ let i = 0;
1846
+ for (let indent = 0; i < this.text.length && indent < goal; i++) indent += this.text.charCodeAt(i) == 9 ? 4 - indent % 4 : 1;
1847
+ return i;
1848
+ }
1849
+ /// @internal
1850
+ scrub() {
1851
+ if (!this.baseIndent) return this.text;
1852
+ let result = "";
1853
+ for (let i = 0; i < this.basePos; i++) result += " ";
1854
+ return result + this.text.slice(this.basePos);
1855
+ }
1856
+ }
1857
+ function skipForList(bl, cx, line) {
1858
+ if (line.pos == line.text.length || bl != cx.block && line.indent >= cx.stack[line.depth + 1].value + line.baseIndent) return true;
1859
+ if (line.indent >= line.baseIndent + 4) return false;
1860
+ let size = (bl.type == Type.OrderedList ? isOrderedList : isBulletList)(line, cx, false);
1861
+ return size > 0 && (bl.type != Type.BulletList || isHorizontalRule(line, cx, false) < 0) && line.text.charCodeAt(line.pos + size - 1) == bl.value;
1862
+ }
1863
+ const DefaultSkipMarkup = {
1864
+ [Type.Blockquote](bl, cx, line) {
1865
+ if (line.next != 62 /* '>' */) return false;
1866
+ line.markers.push(elt(Type.QuoteMark, cx.lineStart + line.pos, cx.lineStart + line.pos + 1));
1867
+ line.moveBase(line.pos + (space(line.text.charCodeAt(line.pos + 1)) ? 2 : 1));
1868
+ bl.end = cx.lineStart + line.text.length;
1869
+ return true;
1870
+ },
1871
+ [Type.ListItem](bl, _cx, line) {
1872
+ if (line.indent < line.baseIndent + bl.value && line.next > -1) return false;
1873
+ line.moveBaseColumn(line.baseIndent + bl.value);
1874
+ return true;
1875
+ },
1876
+ [Type.OrderedList]: skipForList,
1877
+ [Type.BulletList]: skipForList,
1878
+ [Type.Document]() {
1879
+ return true;
1880
+ }
1881
+ };
1882
+ function space(ch) {
1883
+ return ch == 32 || ch == 9 || ch == 10 || ch == 13;
1884
+ }
1885
+ function skipSpace(line, i = 0) {
1886
+ while (i < line.length && space(line.charCodeAt(i))) i++;
1887
+ return i;
1888
+ }
1889
+ function skipSpaceBack(line, i, to) {
1890
+ while (i > to && space(line.charCodeAt(i - 1))) i--;
1891
+ return i;
1892
+ }
1893
+ function isFencedCode(line) {
1894
+ if (line.next != 96 && line.next != 126 /* '`~' */) return -1;
1895
+ let pos = line.pos + 1;
1896
+ while (pos < line.text.length && line.text.charCodeAt(pos) == line.next) pos++;
1897
+ if (pos < line.pos + 3) return -1;
1898
+ if (line.next == 96) for (let i = pos; i < line.text.length; i++) if (line.text.charCodeAt(i) == 96) return -1;
1899
+ return pos;
1900
+ }
1901
+ function isBlockquote(line) {
1902
+ return line.next != 62 /* '>' */ ? -1 : line.text.charCodeAt(line.pos + 1) == 32 ? 2 : 1;
1903
+ }
1904
+ function isHorizontalRule(line, cx, breaking) {
1905
+ if (line.next != 42 && line.next != 45 && line.next != 95 /* '_-*' */) return -1;
1906
+ let count = 1;
1907
+ for (let pos = line.pos + 1; pos < line.text.length; pos++) {
1908
+ let ch = line.text.charCodeAt(pos);
1909
+ if (ch == line.next) count++;else if (!space(ch)) return -1;
1910
+ }
1911
+ // Setext headers take precedence
1912
+ if (breaking && line.next == 45 && isSetextUnderline(line) > -1 && line.depth == cx.stack.length) return -1;
1913
+ return count < 3 ? -1 : 1;
1914
+ }
1915
+ function inList(cx, type) {
1916
+ for (let i = cx.stack.length - 1; i >= 0; i--) if (cx.stack[i].type == type) return true;
1917
+ return false;
1918
+ }
1919
+ function isBulletList(line, cx, breaking) {
1920
+ 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;
1921
+ }
1922
+ function isOrderedList(line, cx, breaking) {
1923
+ let pos = line.pos,
1924
+ next = line.next;
1925
+ for (;;) {
1926
+ if (next >= 48 && next <= 57 /* '0-9' */) pos++;else break;
1927
+ if (pos == line.text.length) return -1;
1928
+ next = line.text.charCodeAt(pos);
1929
+ }
1930
+ 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 /* '1' */)) return -1;
1931
+ return pos + 1 - line.pos;
1932
+ }
1933
+ function isAtxHeading(line) {
1934
+ if (line.next != 35 /* '#' */) return -1;
1935
+ let pos = line.pos + 1;
1936
+ while (pos < line.text.length && line.text.charCodeAt(pos) == 35) pos++;
1937
+ if (pos < line.text.length && line.text.charCodeAt(pos) != 32) return -1;
1938
+ let size = pos - line.pos;
1939
+ return size > 6 ? -1 : size;
1940
+ }
1941
+ function isSetextUnderline(line) {
1942
+ if (line.next != 45 && line.next != 61 /* '-=' */ || line.indent >= line.baseIndent + 4) return -1;
1943
+ let pos = line.pos + 1;
1944
+ while (pos < line.text.length && line.text.charCodeAt(pos) == line.next) pos++;
1945
+ let end = pos;
1946
+ while (pos < line.text.length && space(line.text.charCodeAt(pos))) pos++;
1947
+ return pos == line.text.length ? end : -1;
1948
+ }
1949
+ const EmptyLine = /^[ \t]*$/,
1950
+ CommentEnd = /-->/,
1951
+ ProcessingEnd = /\?>/;
1952
+ const HTMLBlockStyle = [[/^<(?:script|pre|style)(?:\s|>|$)/i, /<\/(?:script|pre|style)>/i], [/^\s*<!--/, CommentEnd], [/^\s*<\?/, ProcessingEnd], [/^\s*<![A-Z]/, />/], [/^\s*<!\[CDATA\[/, /\]\]>/], [/^\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], [/^\s*(?:<\/[a-z][\w-]*\s*>|<[a-z][\w-]*(\s+[a-z:_][\w-.]*(?:\s*=\s*(?:[^\s"'=<>`]+|'[^']*'|"[^"]*"))?)*\s*>)\s*$/i, EmptyLine]];
1953
+ function isHTMLBlock(line, _cx, breaking) {
1954
+ if (line.next != 60 /* '<' */) return -1;
1955
+ let rest = line.text.slice(line.pos);
1956
+ for (let i = 0, e = HTMLBlockStyle.length - (breaking ? 1 : 0); i < e; i++) if (HTMLBlockStyle[i][0].test(rest)) return i;
1957
+ return -1;
1958
+ }
1959
+ function getListIndent(line, pos) {
1960
+ let indentAfter = line.countIndent(pos, line.pos, line.indent);
1961
+ let indented = line.countIndent(line.skipSpace(pos), pos, indentAfter);
1962
+ return indented >= indentAfter + 5 ? indentAfter + 1 : indented;
1963
+ }
1964
+ function addCodeText(marks, from, to) {
1965
+ let last = marks.length - 1;
1966
+ if (last >= 0 && marks[last].to == from && marks[last].type == Type.CodeText) marks[last].to = to;else marks.push(elt(Type.CodeText, from, to));
1967
+ }
1968
+ // Rules for parsing blocks. A return value of false means the rule
1969
+ // doesn't apply here, true means it does. When true is returned and
1970
+ // `p.line` has been updated, the rule is assumed to have consumed a
1971
+ // leaf block. Otherwise, it is assumed to have opened a context.
1972
+ const DefaultBlockParsers = {
1973
+ LinkReference: undefined,
1974
+ IndentedCode(cx, line) {
1975
+ let base = line.baseIndent + 4;
1976
+ if (line.indent < base) return false;
1977
+ let start = line.findColumn(base);
1978
+ let from = cx.lineStart + start,
1979
+ to = cx.lineStart + line.text.length;
1980
+ let marks = [],
1981
+ pendingMarks = [];
1982
+ addCodeText(marks, from, to);
1983
+ while (cx.nextLine() && line.depth >= cx.stack.length) {
1984
+ if (line.pos == line.text.length) {
1985
+ // Empty
1986
+ addCodeText(pendingMarks, cx.lineStart - 1, cx.lineStart);
1987
+ for (let m of line.markers) pendingMarks.push(m);
1988
+ } else if (line.indent < base) {
1989
+ break;
1990
+ } else {
1991
+ if (pendingMarks.length) {
1992
+ for (let m of pendingMarks) {
1993
+ if (m.type == Type.CodeText) addCodeText(marks, m.from, m.to);else marks.push(m);
1994
+ }
1995
+ pendingMarks = [];
1996
+ }
1997
+ addCodeText(marks, cx.lineStart - 1, cx.lineStart);
1998
+ for (let m of line.markers) marks.push(m);
1999
+ to = cx.lineStart + line.text.length;
2000
+ let codeStart = cx.lineStart + line.findColumn(line.baseIndent + 4);
2001
+ if (codeStart < to) addCodeText(marks, codeStart, to);
2002
+ }
2003
+ }
2004
+ if (pendingMarks.length) {
2005
+ pendingMarks = pendingMarks.filter(m => m.type != Type.CodeText);
2006
+ if (pendingMarks.length) line.markers = pendingMarks.concat(line.markers);
2007
+ }
2008
+ cx.addNode(cx.buffer.writeElements(marks, -from).finish(Type.CodeBlock, to - from), from);
2009
+ return true;
2010
+ },
2011
+ FencedCode(cx, line) {
2012
+ let fenceEnd = isFencedCode(line);
2013
+ if (fenceEnd < 0) return false;
2014
+ let from = cx.lineStart + line.pos,
2015
+ ch = line.next,
2016
+ len = fenceEnd - line.pos;
2017
+ let infoFrom = line.skipSpace(fenceEnd),
2018
+ infoTo = skipSpaceBack(line.text, line.text.length, infoFrom);
2019
+ let marks = [elt(Type.CodeMark, from, from + len)];
2020
+ if (infoFrom < infoTo) marks.push(elt(Type.CodeInfo, cx.lineStart + infoFrom, cx.lineStart + infoTo));
2021
+ for (let first = true; cx.nextLine() && line.depth >= cx.stack.length; first = false) {
2022
+ let i = line.pos;
2023
+ if (line.indent - line.baseIndent < 4) while (i < line.text.length && line.text.charCodeAt(i) == ch) i++;
2024
+ if (i - line.pos >= len && line.skipSpace(i) == line.text.length) {
2025
+ for (let m of line.markers) marks.push(m);
2026
+ marks.push(elt(Type.CodeMark, cx.lineStart + line.pos, cx.lineStart + i));
2027
+ cx.nextLine();
2028
+ break;
2029
+ } else {
2030
+ if (!first) addCodeText(marks, cx.lineStart - 1, cx.lineStart);
2031
+ for (let m of line.markers) marks.push(m);
2032
+ let textStart = cx.lineStart + line.basePos,
2033
+ textEnd = cx.lineStart + line.text.length;
2034
+ if (textStart < textEnd) addCodeText(marks, textStart, textEnd);
2035
+ }
2036
+ }
2037
+ cx.addNode(cx.buffer.writeElements(marks, -from).finish(Type.FencedCode, cx.prevLineEnd() - from), from);
2038
+ return true;
2039
+ },
2040
+ Blockquote(cx, line) {
2041
+ let size = isBlockquote(line);
2042
+ if (size < 0) return false;
2043
+ cx.startContext(Type.Blockquote, line.pos);
2044
+ cx.addNode(Type.QuoteMark, cx.lineStart + line.pos, cx.lineStart + line.pos + 1);
2045
+ line.moveBase(line.pos + size);
2046
+ return null;
2047
+ },
2048
+ HorizontalRule(cx, line) {
2049
+ if (isHorizontalRule(line, cx, false) < 0) return false;
2050
+ let from = cx.lineStart + line.pos;
2051
+ cx.nextLine();
2052
+ cx.addNode(Type.HorizontalRule, from);
2053
+ return true;
2054
+ },
2055
+ BulletList(cx, line) {
2056
+ let size = isBulletList(line, cx, false);
2057
+ if (size < 0) return false;
2058
+ if (cx.block.type != Type.BulletList) cx.startContext(Type.BulletList, line.basePos, line.next);
2059
+ let newBase = getListIndent(line, line.pos + 1);
2060
+ cx.startContext(Type.ListItem, line.basePos, newBase - line.baseIndent);
2061
+ cx.addNode(Type.ListMark, cx.lineStart + line.pos, cx.lineStart + line.pos + size);
2062
+ line.moveBaseColumn(newBase);
2063
+ return null;
2064
+ },
2065
+ OrderedList(cx, line) {
2066
+ let size = isOrderedList(line, cx, false);
2067
+ if (size < 0) return false;
2068
+ if (cx.block.type != Type.OrderedList) cx.startContext(Type.OrderedList, line.basePos, line.text.charCodeAt(line.pos + size - 1));
2069
+ let newBase = getListIndent(line, line.pos + size);
2070
+ cx.startContext(Type.ListItem, line.basePos, newBase - line.baseIndent);
2071
+ cx.addNode(Type.ListMark, cx.lineStart + line.pos, cx.lineStart + line.pos + size);
2072
+ line.moveBaseColumn(newBase);
2073
+ return null;
2074
+ },
2075
+ ATXHeading(cx, line) {
2076
+ let size = isAtxHeading(line);
2077
+ if (size < 0) return false;
2078
+ let off = line.pos,
2079
+ from = cx.lineStart + off;
2080
+ let endOfSpace = skipSpaceBack(line.text, line.text.length, off),
2081
+ after = endOfSpace;
2082
+ while (after > off && line.text.charCodeAt(after - 1) == line.next) after--;
2083
+ if (after == endOfSpace || after == off || !space(line.text.charCodeAt(after - 1))) after = line.text.length;
2084
+ let buf = cx.buffer.write(Type.HeaderMark, 0, size).writeElements(cx.parser.parseInline(line.text.slice(off + size + 1, after), from + size + 1), -from);
2085
+ if (after < line.text.length) buf.write(Type.HeaderMark, after - off, endOfSpace - off);
2086
+ let node = buf.finish(Type.ATXHeading1 - 1 + size, line.text.length - off);
2087
+ cx.nextLine();
2088
+ cx.addNode(node, from);
2089
+ return true;
2090
+ },
2091
+ HTMLBlock(cx, line) {
2092
+ let type = isHTMLBlock(line, cx, false);
2093
+ if (type < 0) return false;
2094
+ let from = cx.lineStart + line.pos,
2095
+ end = HTMLBlockStyle[type][1];
2096
+ let marks = [],
2097
+ trailing = end != EmptyLine;
2098
+ while (!end.test(line.text) && cx.nextLine()) {
2099
+ if (line.depth < cx.stack.length) {
2100
+ trailing = false;
2101
+ break;
2102
+ }
2103
+ for (let m of line.markers) marks.push(m);
2104
+ }
2105
+ if (trailing) cx.nextLine();
2106
+ let nodeType = end == CommentEnd ? Type.CommentBlock : end == ProcessingEnd ? Type.ProcessingInstructionBlock : Type.HTMLBlock;
2107
+ let to = cx.prevLineEnd();
2108
+ cx.addNode(cx.buffer.writeElements(marks, -from).finish(nodeType, to - from), from);
2109
+ return true;
2110
+ },
2111
+ SetextHeading: undefined // Specifies relative precedence for block-continue function
2112
+ };
2113
+ // This implements a state machine that incrementally parses link references. At each
2114
+ // next line, it looks ahead to see if the line continues the reference or not. If it
2115
+ // doesn't and a valid link is available ending before that line, it finishes that.
2116
+ // Similarly, on `finish` (when the leaf is terminated by external circumstances), it
2117
+ // creates a link reference if there's a valid reference up to the current point.
2118
+ class LinkReferenceParser {
2119
+ constructor(leaf) {
2120
+ this.stage = 0 /* Start */;
2121
+ this.elts = [];
2122
+ this.pos = 0;
2123
+ this.start = leaf.start;
2124
+ this.advance(leaf.content);
2125
+ }
2126
+ nextLine(cx, line, leaf) {
2127
+ if (this.stage == -1 /* Failed */) return false;
2128
+ let content = leaf.content + "\n" + line.scrub();
2129
+ let finish = this.advance(content);
2130
+ if (finish > -1 && finish < content.length) return this.complete(cx, leaf, finish);
2131
+ return false;
2132
+ }
2133
+ finish(cx, leaf) {
2134
+ if ((this.stage == 2 /* Link */ || this.stage == 3 /* Title */) && skipSpace(leaf.content, this.pos) == leaf.content.length) return this.complete(cx, leaf, leaf.content.length);
2135
+ return false;
2136
+ }
2137
+ complete(cx, leaf, len) {
2138
+ cx.addLeafElement(leaf, elt(Type.LinkReference, this.start, this.start + len, this.elts));
2139
+ return true;
2140
+ }
2141
+ nextStage(elt) {
2142
+ if (elt) {
2143
+ this.pos = elt.to - this.start;
2144
+ this.elts.push(elt);
2145
+ this.stage++;
2146
+ return true;
2147
+ }
2148
+ if (elt === false) this.stage = -1 /* Failed */;
2149
+ return false;
2150
+ }
2151
+ advance(content) {
2152
+ for (;;) {
2153
+ if (this.stage == -1 /* Failed */) {
2154
+ return -1;
2155
+ } else if (this.stage == 0 /* Start */) {
2156
+ if (!this.nextStage(parseLinkLabel(content, this.pos, this.start, true))) return -1;
2157
+ if (content.charCodeAt(this.pos) != 58 /* ':' */) return this.stage = -1 /* Failed */;
2158
+ this.elts.push(elt(Type.LinkMark, this.pos + this.start, this.pos + this.start + 1));
2159
+ this.pos++;
2160
+ } else if (this.stage == 1 /* Label */) {
2161
+ if (!this.nextStage(parseURL(content, skipSpace(content, this.pos), this.start))) return -1;
2162
+ } else if (this.stage == 2 /* Link */) {
2163
+ let skip = skipSpace(content, this.pos),
2164
+ end = 0;
2165
+ if (skip > this.pos) {
2166
+ let title = parseLinkTitle(content, skip, this.start);
2167
+ if (title) {
2168
+ let titleEnd = lineEnd(content, title.to - this.start);
2169
+ if (titleEnd > 0) {
2170
+ this.nextStage(title);
2171
+ end = titleEnd;
2172
+ }
2173
+ }
2174
+ }
2175
+ if (!end) end = lineEnd(content, this.pos);
2176
+ return end > 0 && end < content.length ? end : -1;
2177
+ } else {
2178
+ // RefStage.Title
2179
+ return lineEnd(content, this.pos);
2180
+ }
2181
+ }
2182
+ }
2183
+ }
2184
+ function lineEnd(text, pos) {
2185
+ for (; pos < text.length; pos++) {
2186
+ let next = text.charCodeAt(pos);
2187
+ if (next == 10) break;
2188
+ if (!space(next)) return -1;
2189
+ }
2190
+ return pos;
2191
+ }
2192
+ class SetextHeadingParser {
2193
+ nextLine(cx, line, leaf) {
2194
+ let underline = line.depth < cx.stack.length ? -1 : isSetextUnderline(line);
2195
+ let next = line.next;
2196
+ if (underline < 0) return false;
2197
+ let underlineMark = elt(Type.HeaderMark, cx.lineStart + line.pos, cx.lineStart + underline);
2198
+ cx.nextLine();
2199
+ cx.addLeafElement(leaf, elt(next == 61 ? Type.SetextHeading1 : Type.SetextHeading2, leaf.start, cx.prevLineEnd(), [...cx.parser.parseInline(leaf.content, leaf.start), underlineMark]));
2200
+ return true;
2201
+ }
2202
+ finish() {
2203
+ return false;
2204
+ }
2205
+ }
2206
+ const DefaultLeafBlocks = {
2207
+ LinkReference(_, leaf) {
2208
+ return leaf.content.charCodeAt(0) == 91 /* '[' */ ? new LinkReferenceParser(leaf) : null;
2209
+ },
2210
+ SetextHeading() {
2211
+ return new SetextHeadingParser();
2212
+ }
2213
+ };
2214
+ const DefaultEndLeaf = [(_, line) => isAtxHeading(line) >= 0, (_, line) => isFencedCode(line) >= 0, (_, line) => isBlockquote(line) >= 0, (p, line) => isBulletList(line, p, true) >= 0, (p, line) => isOrderedList(line, p, true) >= 0, (p, line) => isHorizontalRule(line, p, true) >= 0, (p, line) => isHTMLBlock(line, p, true) >= 0];
2215
+ const scanLineResult = {
2216
+ text: "",
2217
+ end: 0
2218
+ };
2219
+ /// Block-level parsing functions get access to this context object.
2220
+ class BlockContext {
2221
+ /// @internal
2222
+ constructor(
2223
+ /// The parser configuration used.
2224
+ parser,
2225
+ /// @internal
2226
+ input, fragments,
2227
+ /// @internal
2228
+ ranges) {
2229
+ this.parser = parser;
2230
+ this.input = input;
2231
+ this.ranges = ranges;
2232
+ this.line = new Line();
2233
+ this.atEnd = false;
2234
+ /// @internal
2235
+ this.dontInject = new Set();
2236
+ this.stoppedAt = null;
2237
+ /// The range index that absoluteLineStart points into @internal
2238
+ this.rangeI = 0;
2239
+ this.to = ranges[ranges.length - 1].to;
2240
+ this.lineStart = this.absoluteLineStart = this.absoluteLineEnd = ranges[0].from;
2241
+ this.block = CompositeBlock.create(Type.Document, 0, this.lineStart, 0, 0);
2242
+ this.stack = [this.block];
2243
+ this.fragments = fragments.length ? new FragmentCursor(fragments, input) : null;
2244
+ this.readLine();
2245
+ }
2246
+ get parsedPos() {
2247
+ return this.absoluteLineStart;
2248
+ }
2249
+ advance() {
2250
+ if (this.stoppedAt != null && this.absoluteLineStart > this.stoppedAt) return this.finish();
2251
+ let {
2252
+ line
2253
+ } = this;
2254
+ for (;;) {
2255
+ while (line.depth < this.stack.length) this.finishContext();
2256
+ for (let mark of line.markers) this.addNode(mark.type, mark.from, mark.to);
2257
+ if (line.pos < line.text.length) break;
2258
+ // Empty line
2259
+ if (!this.nextLine()) return this.finish();
2260
+ }
2261
+ if (this.fragments && this.reuseFragment(line.basePos)) return null;
2262
+ start: for (;;) {
2263
+ for (let type of this.parser.blockParsers) if (type) {
2264
+ let result = type(this, line);
2265
+ if (result != false) {
2266
+ if (result == true) return null;
2267
+ line.forward();
2268
+ continue start;
2269
+ }
2270
+ }
2271
+ break;
2272
+ }
2273
+ let leaf = new LeafBlock(this.lineStart + line.pos, line.text.slice(line.pos));
2274
+ for (let parse of this.parser.leafBlockParsers) if (parse) {
2275
+ let parser = parse(this, leaf);
2276
+ if (parser) leaf.parsers.push(parser);
2277
+ }
2278
+ lines: while (this.nextLine()) {
2279
+ if (line.pos == line.text.length) break;
2280
+ if (line.indent < line.baseIndent + 4) {
2281
+ for (let stop of this.parser.endLeafBlock) if (stop(this, line, leaf)) break lines;
2282
+ }
2283
+ for (let parser of leaf.parsers) if (parser.nextLine(this, line, leaf)) return null;
2284
+ leaf.content += "\n" + line.scrub();
2285
+ for (let m of line.markers) leaf.marks.push(m);
2286
+ }
2287
+ this.finishLeaf(leaf);
2288
+ return null;
2289
+ }
2290
+ stopAt(pos) {
2291
+ if (this.stoppedAt != null && this.stoppedAt < pos) throw new RangeError("Can't move stoppedAt forward");
2292
+ this.stoppedAt = pos;
2293
+ }
2294
+ reuseFragment(start) {
2295
+ if (!this.fragments.moveTo(this.absoluteLineStart + start, this.absoluteLineStart) || !this.fragments.matches(this.block.hash)) return false;
2296
+ let taken = this.fragments.takeNodes(this);
2297
+ if (!taken) return false;
2298
+ let withoutGaps = taken,
2299
+ end = this.absoluteLineStart + taken;
2300
+ for (let i = 1; i < this.ranges.length; i++) {
2301
+ let gapFrom = this.ranges[i - 1].to,
2302
+ gapTo = this.ranges[i].from;
2303
+ if (gapFrom >= this.lineStart && gapTo < end) withoutGaps -= gapTo - gapFrom;
2304
+ }
2305
+ this.lineStart += withoutGaps;
2306
+ this.absoluteLineStart += taken;
2307
+ this.moveRangeI();
2308
+ if (this.absoluteLineStart < this.to) {
2309
+ this.lineStart++;
2310
+ this.absoluteLineStart++;
2311
+ this.readLine();
2312
+ } else {
2313
+ this.atEnd = true;
2314
+ this.readLine();
2315
+ }
2316
+ return true;
2317
+ }
2318
+ /// The number of parent blocks surrounding the current block.
2319
+ get depth() {
2320
+ return this.stack.length;
2321
+ }
2322
+ /// Get the type of the parent block at the given depth. When no
2323
+ /// depth is passed, return the type of the innermost parent.
2324
+ parentType(depth = this.depth - 1) {
2325
+ return this.parser.nodeSet.types[this.stack[depth].type];
2326
+ }
2327
+ /// Move to the next input line. This should only be called by
2328
+ /// (non-composite) [block parsers](#BlockParser.parse) that consume
2329
+ /// the line directly, or leaf block parser
2330
+ /// [`nextLine`](#LeafBlockParser.nextLine) methods when they
2331
+ /// consume the current line (and return true).
2332
+ nextLine() {
2333
+ this.lineStart += this.line.text.length;
2334
+ if (this.absoluteLineEnd >= this.to) {
2335
+ this.absoluteLineStart = this.absoluteLineEnd;
2336
+ this.atEnd = true;
2337
+ this.readLine();
2338
+ return false;
2339
+ } else {
2340
+ this.lineStart++;
2341
+ this.absoluteLineStart = this.absoluteLineEnd + 1;
2342
+ this.moveRangeI();
2343
+ this.readLine();
2344
+ return true;
2345
+ }
2346
+ }
2347
+ moveRangeI() {
2348
+ while (this.rangeI < this.ranges.length - 1 && this.absoluteLineStart >= this.ranges[this.rangeI].to) {
2349
+ this.rangeI++;
2350
+ this.absoluteLineStart = Math.max(this.absoluteLineStart, this.ranges[this.rangeI].from);
2351
+ }
2352
+ }
2353
+ /// @internal
2354
+ scanLine(start) {
2355
+ let r = scanLineResult;
2356
+ r.end = start;
2357
+ if (start >= this.to) {
2358
+ r.text = "";
2359
+ } else {
2360
+ r.text = this.lineChunkAt(start);
2361
+ r.end += r.text.length;
2362
+ if (this.ranges.length > 1) {
2363
+ let textOffset = this.absoluteLineStart,
2364
+ rangeI = this.rangeI;
2365
+ while (this.ranges[rangeI].to < r.end) {
2366
+ rangeI++;
2367
+ let nextFrom = this.ranges[rangeI].from;
2368
+ let after = this.lineChunkAt(nextFrom);
2369
+ r.end = nextFrom + after.length;
2370
+ r.text = r.text.slice(0, this.ranges[rangeI - 1].to - textOffset) + after;
2371
+ textOffset = r.end - r.text.length;
2372
+ }
2373
+ }
2374
+ }
2375
+ return r;
2376
+ }
2377
+ /// @internal
2378
+ readLine() {
2379
+ let {
2380
+ line
2381
+ } = this,
2382
+ {
2383
+ text,
2384
+ end
2385
+ } = this.scanLine(this.absoluteLineStart);
2386
+ this.absoluteLineEnd = end;
2387
+ line.reset(text);
2388
+ for (; line.depth < this.stack.length; line.depth++) {
2389
+ let cx = this.stack[line.depth],
2390
+ handler = this.parser.skipContextMarkup[cx.type];
2391
+ if (!handler) throw new Error("Unhandled block context " + Type[cx.type]);
2392
+ if (!handler(cx, this, line)) break;
2393
+ line.forward();
2394
+ }
2395
+ }
2396
+ lineChunkAt(pos) {
2397
+ let next = this.input.chunk(pos),
2398
+ text;
2399
+ if (!this.input.lineChunks) {
2400
+ let eol = next.indexOf("\n");
2401
+ text = eol < 0 ? next : next.slice(0, eol);
2402
+ } else {
2403
+ text = next == "\n" ? "" : next;
2404
+ }
2405
+ return pos + text.length > this.to ? text.slice(0, this.to - pos) : text;
2406
+ }
2407
+ /// The end position of the previous line.
2408
+ prevLineEnd() {
2409
+ return this.atEnd ? this.lineStart : this.lineStart - 1;
2410
+ }
2411
+ /// @internal
2412
+ startContext(type, start, value = 0) {
2413
+ this.block = CompositeBlock.create(type, value, this.lineStart + start, this.block.hash, this.lineStart + this.line.text.length);
2414
+ this.stack.push(this.block);
2415
+ }
2416
+ /// Start a composite block. Should only be called from [block
2417
+ /// parser functions](#BlockParser.parse) that return null.
2418
+ startComposite(type, start, value = 0) {
2419
+ this.startContext(this.parser.getNodeType(type), start, value);
2420
+ }
2421
+ /// @internal
2422
+ addNode(block, from, to) {
2423
+ if (typeof block == "number") block = new Tree(this.parser.nodeSet.types[block], none, none, (to !== null && to !== void 0 ? to : this.prevLineEnd()) - from);
2424
+ this.block.addChild(block, from - this.block.from);
2425
+ }
2426
+ /// Add a block element. Can be called by [block
2427
+ /// parsers](#BlockParser.parse).
2428
+ addElement(elt) {
2429
+ this.block.addChild(elt.toTree(this.parser.nodeSet), elt.from - this.block.from);
2430
+ }
2431
+ /// Add a block element from a [leaf parser](#LeafBlockParser). This
2432
+ /// makes sure any extra composite block markup (such as blockquote
2433
+ /// markers) inside the block are also added to the syntax tree.
2434
+ addLeafElement(leaf, elt) {
2435
+ this.addNode(this.buffer.writeElements(injectMarks(elt.children, leaf.marks), -elt.from).finish(elt.type, elt.to - elt.from), elt.from);
2436
+ }
2437
+ /// @internal
2438
+ finishContext() {
2439
+ let cx = this.stack.pop();
2440
+ let top = this.stack[this.stack.length - 1];
2441
+ top.addChild(cx.toTree(this.parser.nodeSet), cx.from - top.from);
2442
+ this.block = top;
2443
+ }
2444
+ finish() {
2445
+ while (this.stack.length > 1) this.finishContext();
2446
+ return this.addGaps(this.block.toTree(this.parser.nodeSet, this.lineStart));
2447
+ }
2448
+ addGaps(tree) {
2449
+ return this.ranges.length > 1 ? injectGaps(this.ranges, 0, tree.topNode, this.ranges[0].from, this.dontInject) : tree;
2450
+ }
2451
+ /// @internal
2452
+ finishLeaf(leaf) {
2453
+ for (let parser of leaf.parsers) if (parser.finish(this, leaf)) return;
2454
+ let inline = injectMarks(this.parser.parseInline(leaf.content, leaf.start), leaf.marks);
2455
+ this.addNode(this.buffer.writeElements(inline, -leaf.start).finish(Type.Paragraph, leaf.content.length), leaf.start);
2456
+ }
2457
+ elt(type, from, to, children) {
2458
+ if (typeof type == "string") return elt(this.parser.getNodeType(type), from, to, children);
2459
+ return new TreeElement(type, from);
2460
+ }
2461
+ /// @internal
2462
+ get buffer() {
2463
+ return new Buffer(this.parser.nodeSet);
2464
+ }
2465
+ }
2466
+ function injectGaps(ranges, rangeI, tree, offset, dont) {
2467
+ if (dont.has(tree.tree)) return tree.tree;
2468
+ let rangeEnd = ranges[rangeI].to;
2469
+ let children = [],
2470
+ positions = [],
2471
+ start = tree.from + offset;
2472
+ function movePastNext(upto, inclusive) {
2473
+ while (inclusive ? upto >= rangeEnd : upto > rangeEnd) {
2474
+ let size = ranges[rangeI + 1].from - rangeEnd;
2475
+ offset += size;
2476
+ upto += size;
2477
+ rangeI++;
2478
+ rangeEnd = ranges[rangeI].to;
2479
+ }
2480
+ }
2481
+ for (let ch = tree.firstChild; ch; ch = ch.nextSibling) {
2482
+ movePastNext(ch.from + offset, true);
2483
+ let from = ch.from + offset,
2484
+ node;
2485
+ if (ch.to + offset > rangeEnd) {
2486
+ node = injectGaps(ranges, rangeI, ch, offset, dont);
2487
+ movePastNext(ch.to + offset, false);
2488
+ } else {
2489
+ node = ch.toTree();
2490
+ }
2491
+ children.push(node);
2492
+ positions.push(from - start);
2493
+ }
2494
+ movePastNext(tree.to + offset, false);
2495
+ return new Tree(tree.type, children, positions, tree.to + offset - start, tree.tree ? tree.tree.propValues : undefined);
2496
+ }
2497
+ /// A Markdown parser configuration.
2498
+ class MarkdownParser extends Parser {
2499
+ /// @internal
2500
+ constructor(
2501
+ /// The parser's syntax [node
2502
+ /// types](https://lezer.codemirror.net/docs/ref/#common.NodeSet).
2503
+ nodeSet,
2504
+ /// @internal
2505
+ blockParsers,
2506
+ /// @internal
2507
+ leafBlockParsers,
2508
+ /// @internal
2509
+ blockNames,
2510
+ /// @internal
2511
+ endLeafBlock,
2512
+ /// @internal
2513
+ skipContextMarkup,
2514
+ /// @internal
2515
+ inlineParsers,
2516
+ /// @internal
2517
+ inlineNames,
2518
+ /// @internal
2519
+ wrappers) {
2520
+ super();
2521
+ this.nodeSet = nodeSet;
2522
+ this.blockParsers = blockParsers;
2523
+ this.leafBlockParsers = leafBlockParsers;
2524
+ this.blockNames = blockNames;
2525
+ this.endLeafBlock = endLeafBlock;
2526
+ this.skipContextMarkup = skipContextMarkup;
2527
+ this.inlineParsers = inlineParsers;
2528
+ this.inlineNames = inlineNames;
2529
+ this.wrappers = wrappers;
2530
+ /// @internal
2531
+ this.nodeTypes = Object.create(null);
2532
+ for (let t of nodeSet.types) this.nodeTypes[t.name] = t.id;
2533
+ }
2534
+ createParse(input, fragments, ranges) {
2535
+ let parse = new BlockContext(this, input, fragments, ranges);
2536
+ for (let w of this.wrappers) parse = w(parse, input, fragments, ranges);
2537
+ return parse;
2538
+ }
2539
+ /// Reconfigure the parser.
2540
+ configure(spec) {
2541
+ let config = resolveConfig(spec);
2542
+ if (!config) return this;
2543
+ let {
2544
+ nodeSet,
2545
+ skipContextMarkup
2546
+ } = this;
2547
+ let blockParsers = this.blockParsers.slice(),
2548
+ leafBlockParsers = this.leafBlockParsers.slice(),
2549
+ blockNames = this.blockNames.slice(),
2550
+ inlineParsers = this.inlineParsers.slice(),
2551
+ inlineNames = this.inlineNames.slice(),
2552
+ endLeafBlock = this.endLeafBlock.slice(),
2553
+ wrappers = this.wrappers;
2554
+ if (nonEmpty(config.defineNodes)) {
2555
+ skipContextMarkup = Object.assign({}, skipContextMarkup);
2556
+ let nodeTypes = nodeSet.types.slice(),
2557
+ styles;
2558
+ for (let s of config.defineNodes) {
2559
+ let {
2560
+ name,
2561
+ block,
2562
+ composite,
2563
+ style
2564
+ } = typeof s == "string" ? {
2565
+ name: s
2566
+ } : s;
2567
+ if (nodeTypes.some(t => t.name == name)) continue;
2568
+ if (composite) skipContextMarkup[nodeTypes.length] = (bl, cx, line) => composite(cx, line, bl.value);
2569
+ let id = nodeTypes.length;
2570
+ let group = composite ? ["Block", "BlockContext"] : !block ? undefined : id >= Type.ATXHeading1 && id <= Type.SetextHeading2 ? ["Block", "LeafBlock", "Heading"] : ["Block", "LeafBlock"];
2571
+ nodeTypes.push(NodeType.define({
2572
+ id,
2573
+ name,
2574
+ props: group && [[NodeProp.group, group]]
2575
+ }));
2576
+ if (style) {
2577
+ if (!styles) styles = {};
2578
+ if (Array.isArray(style) || style instanceof Tag) styles[name] = style;else Object.assign(styles, style);
2579
+ }
2580
+ }
2581
+ nodeSet = new NodeSet(nodeTypes);
2582
+ if (styles) nodeSet = nodeSet.extend(styleTags(styles));
2583
+ }
2584
+ if (nonEmpty(config.props)) nodeSet = nodeSet.extend(...config.props);
2585
+ if (nonEmpty(config.remove)) {
2586
+ for (let rm of config.remove) {
2587
+ let block = this.blockNames.indexOf(rm),
2588
+ inline = this.inlineNames.indexOf(rm);
2589
+ if (block > -1) blockParsers[block] = leafBlockParsers[block] = undefined;
2590
+ if (inline > -1) inlineParsers[inline] = undefined;
2591
+ }
2592
+ }
2593
+ if (nonEmpty(config.parseBlock)) {
2594
+ for (let spec of config.parseBlock) {
2595
+ let found = blockNames.indexOf(spec.name);
2596
+ if (found > -1) {
2597
+ blockParsers[found] = spec.parse;
2598
+ leafBlockParsers[found] = spec.leaf;
2599
+ } else {
2600
+ let pos = spec.before ? findName(blockNames, spec.before) : spec.after ? findName(blockNames, spec.after) + 1 : blockNames.length - 1;
2601
+ blockParsers.splice(pos, 0, spec.parse);
2602
+ leafBlockParsers.splice(pos, 0, spec.leaf);
2603
+ blockNames.splice(pos, 0, spec.name);
2604
+ }
2605
+ if (spec.endLeaf) endLeafBlock.push(spec.endLeaf);
2606
+ }
2607
+ }
2608
+ if (nonEmpty(config.parseInline)) {
2609
+ for (let spec of config.parseInline) {
2610
+ let found = inlineNames.indexOf(spec.name);
2611
+ if (found > -1) {
2612
+ inlineParsers[found] = spec.parse;
2613
+ } else {
2614
+ let pos = spec.before ? findName(inlineNames, spec.before) : spec.after ? findName(inlineNames, spec.after) + 1 : inlineNames.length - 1;
2615
+ inlineParsers.splice(pos, 0, spec.parse);
2616
+ inlineNames.splice(pos, 0, spec.name);
2617
+ }
2618
+ }
2619
+ }
2620
+ if (config.wrap) wrappers = wrappers.concat(config.wrap);
2621
+ return new MarkdownParser(nodeSet, blockParsers, leafBlockParsers, blockNames, endLeafBlock, skipContextMarkup, inlineParsers, inlineNames, wrappers);
2622
+ }
2623
+ /// @internal
2624
+ getNodeType(name) {
2625
+ let found = this.nodeTypes[name];
2626
+ if (found == null) throw new RangeError(`Unknown node type '${name}'`);
2627
+ return found;
2628
+ }
2629
+ /// Parse the given piece of inline text at the given offset,
2630
+ /// returning an array of [`Element`](#Element) objects representing
2631
+ /// the inline content.
2632
+ parseInline(text, offset) {
2633
+ let cx = new InlineContext(this, text, offset);
2634
+ outer: for (let pos = offset; pos < cx.end;) {
2635
+ let next = cx.char(pos);
2636
+ for (let token of this.inlineParsers) if (token) {
2637
+ let result = token(cx, next, pos);
2638
+ if (result >= 0) {
2639
+ pos = result;
2640
+ continue outer;
2641
+ }
2642
+ }
2643
+ pos++;
2644
+ }
2645
+ return cx.resolveMarkers(0);
2646
+ }
2647
+ }
2648
+ function nonEmpty(a) {
2649
+ return a != null && a.length > 0;
2650
+ }
2651
+ function resolveConfig(spec) {
2652
+ if (!Array.isArray(spec)) return spec;
2653
+ if (spec.length == 0) return null;
2654
+ let conf = resolveConfig(spec[0]);
2655
+ if (spec.length == 1) return conf;
2656
+ let rest = resolveConfig(spec.slice(1));
2657
+ if (!rest || !conf) return conf || rest;
2658
+ let conc = (a, b) => (a || none).concat(b || none);
2659
+ let wrapA = conf.wrap,
2660
+ wrapB = rest.wrap;
2661
+ return {
2662
+ props: conc(conf.props, rest.props),
2663
+ defineNodes: conc(conf.defineNodes, rest.defineNodes),
2664
+ parseBlock: conc(conf.parseBlock, rest.parseBlock),
2665
+ parseInline: conc(conf.parseInline, rest.parseInline),
2666
+ remove: conc(conf.remove, rest.remove),
2667
+ wrap: !wrapA ? wrapB : !wrapB ? wrapA : (inner, input, fragments, ranges) => wrapA(wrapB(inner, input, fragments, ranges), input, fragments, ranges)
2668
+ };
2669
+ }
2670
+ function findName(names, name) {
2671
+ let found = names.indexOf(name);
2672
+ if (found < 0) throw new RangeError(`Position specified relative to unknown parser ${name}`);
2673
+ return found;
2674
+ }
2675
+ let nodeTypes = [NodeType.none];
2676
+ for (let i = 1, name; name = Type[i]; i++) {
2677
+ nodeTypes[i] = NodeType.define({
2678
+ id: i,
2679
+ name,
2680
+ props: i >= Type.Escape ? [] : [[NodeProp.group, i in DefaultSkipMarkup ? ["Block", "BlockContext"] : ["Block", "LeafBlock"]]]
2681
+ });
2682
+ }
2683
+ const none = [];
2684
+ class Buffer {
2685
+ constructor(nodeSet) {
2686
+ this.nodeSet = nodeSet;
2687
+ this.content = [];
2688
+ this.nodes = [];
2689
+ }
2690
+ write(type, from, to, children = 0) {
2691
+ this.content.push(type, from, to, 4 + children * 4);
2692
+ return this;
2693
+ }
2694
+ writeElements(elts, offset = 0) {
2695
+ for (let e of elts) e.writeTo(this, offset);
2696
+ return this;
2697
+ }
2698
+ finish(type, length) {
2699
+ return Tree.build({
2700
+ buffer: this.content,
2701
+ nodeSet: this.nodeSet,
2702
+ reused: this.nodes,
2703
+ topID: type,
2704
+ length
2705
+ });
2706
+ }
2707
+ }
2708
+ /// Elements are used to compose syntax nodes during parsing.
2709
+ class Element {
2710
+ /// @internal
2711
+ constructor(
2712
+ /// The node's
2713
+ /// [id](https://lezer.codemirror.net/docs/ref/#common.NodeType.id).
2714
+ type,
2715
+ /// The start of the node, as an offset from the start of the document.
2716
+ from,
2717
+ /// The end of the node.
2718
+ to,
2719
+ /// The node's child nodes @internal
2720
+ children = none) {
2721
+ this.type = type;
2722
+ this.from = from;
2723
+ this.to = to;
2724
+ this.children = children;
2725
+ }
2726
+ /// @internal
2727
+ writeTo(buf, offset) {
2728
+ let startOff = buf.content.length;
2729
+ buf.writeElements(this.children, offset);
2730
+ buf.content.push(this.type, this.from + offset, this.to + offset, buf.content.length + 4 - startOff);
2731
+ }
2732
+ /// @internal
2733
+ toTree(nodeSet) {
2734
+ return new Buffer(nodeSet).writeElements(this.children, -this.from).finish(this.type, this.to - this.from);
2735
+ }
2736
+ }
2737
+ class TreeElement {
2738
+ constructor(tree, from) {
2739
+ this.tree = tree;
2740
+ this.from = from;
2741
+ }
2742
+ get to() {
2743
+ return this.from + this.tree.length;
2744
+ }
2745
+ get type() {
2746
+ return this.tree.type.id;
2747
+ }
2748
+ get children() {
2749
+ return none;
2750
+ }
2751
+ writeTo(buf, offset) {
2752
+ buf.nodes.push(this.tree);
2753
+ buf.content.push(buf.nodes.length - 1, this.from + offset, this.to + offset, -1);
2754
+ }
2755
+ toTree() {
2756
+ return this.tree;
2757
+ }
2758
+ }
2759
+ function elt(type, from, to, children) {
2760
+ return new Element(type, from, to, children);
2761
+ }
2762
+ const EmphasisUnderscore = {
2763
+ resolve: "Emphasis",
2764
+ mark: "EmphasisMark"
2765
+ };
2766
+ const EmphasisAsterisk = {
2767
+ resolve: "Emphasis",
2768
+ mark: "EmphasisMark"
2769
+ };
2770
+ const LinkStart = {},
2771
+ ImageStart = {};
2772
+ class InlineDelimiter {
2773
+ constructor(type, from, to, side) {
2774
+ this.type = type;
2775
+ this.from = from;
2776
+ this.to = to;
2777
+ this.side = side;
2778
+ }
2779
+ }
2780
+ const Escapable = "!\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~";
2781
+ let Punctuation = /[!"#$%&'()*+,\-.\/:;<=>?@\[\\\]^_`{|}~\xA1\u2010-\u2027]/;
2782
+ try {
2783
+ Punctuation = new RegExp("[\\p{Pc}|\\p{Pd}|\\p{Pe}|\\p{Pf}|\\p{Pi}|\\p{Po}|\\p{Ps}]", "u");
2784
+ } catch (_) {}
2785
+ const DefaultInline = {
2786
+ Escape(cx, next, start) {
2787
+ if (next != 92 /* '\\' */ || start == cx.end - 1) return -1;
2788
+ let escaped = cx.char(start + 1);
2789
+ for (let i = 0; i < Escapable.length; i++) if (Escapable.charCodeAt(i) == escaped) return cx.append(elt(Type.Escape, start, start + 2));
2790
+ return -1;
2791
+ },
2792
+ Entity(cx, next, start) {
2793
+ if (next != 38 /* '&' */) return -1;
2794
+ let m = /^(?:#\d+|#x[a-f\d]+|\w+);/i.exec(cx.slice(start + 1, start + 31));
2795
+ return m ? cx.append(elt(Type.Entity, start, start + 1 + m[0].length)) : -1;
2796
+ },
2797
+ InlineCode(cx, next, start) {
2798
+ if (next != 96 /* '`' */ || start && cx.char(start - 1) == 96) return -1;
2799
+ let pos = start + 1;
2800
+ while (pos < cx.end && cx.char(pos) == 96) pos++;
2801
+ let size = pos - start,
2802
+ curSize = 0;
2803
+ for (; pos < cx.end; pos++) {
2804
+ if (cx.char(pos) == 96) {
2805
+ curSize++;
2806
+ if (curSize == size && cx.char(pos + 1) != 96) return cx.append(elt(Type.InlineCode, start, pos + 1, [elt(Type.CodeMark, start, start + size), elt(Type.CodeMark, pos + 1 - size, pos + 1)]));
2807
+ } else {
2808
+ curSize = 0;
2809
+ }
2810
+ }
2811
+ return -1;
2812
+ },
2813
+ HTMLTag(cx, next, start) {
2814
+ if (next != 60 /* '<' */ || start == cx.end - 1) return -1;
2815
+ let after = cx.slice(start + 1, cx.end);
2816
+ 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);
2817
+ if (url) return cx.append(elt(Type.URL, start, start + 1 + url[0].length));
2818
+ let comment = /^!--[^>](?:-[^-]|[^-])*?-->/i.exec(after);
2819
+ if (comment) return cx.append(elt(Type.Comment, start, start + 1 + comment[0].length));
2820
+ let procInst = /^\?[^]*?\?>/.exec(after);
2821
+ if (procInst) return cx.append(elt(Type.ProcessingInstruction, start, start + 1 + procInst[0].length));
2822
+ 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);
2823
+ if (!m) return -1;
2824
+ return cx.append(elt(Type.HTMLTag, start, start + 1 + m[0].length));
2825
+ },
2826
+ Emphasis(cx, next, start) {
2827
+ if (next != 95 && next != 42) return -1;
2828
+ let pos = start + 1;
2829
+ while (cx.char(pos) == next) pos++;
2830
+ let before = cx.slice(start - 1, start),
2831
+ after = cx.slice(pos, pos + 1);
2832
+ let pBefore = Punctuation.test(before),
2833
+ pAfter = Punctuation.test(after);
2834
+ let sBefore = /\s|^$/.test(before),
2835
+ sAfter = /\s|^$/.test(after);
2836
+ let leftFlanking = !sAfter && (!pAfter || sBefore || pBefore);
2837
+ let rightFlanking = !sBefore && (!pBefore || sAfter || pAfter);
2838
+ let canOpen = leftFlanking && (next == 42 || !rightFlanking || pBefore);
2839
+ let canClose = rightFlanking && (next == 42 || !leftFlanking || pAfter);
2840
+ return cx.append(new InlineDelimiter(next == 95 ? EmphasisUnderscore : EmphasisAsterisk, start, pos, (canOpen ? 1 /* Open */ : 0) | (canClose ? 2 /* Close */ : 0)));
2841
+ },
2842
+ HardBreak(cx, next, start) {
2843
+ if (next == 92 /* '\\' */ && cx.char(start + 1) == 10 /* '\n' */) return cx.append(elt(Type.HardBreak, start, start + 2));
2844
+ if (next == 32) {
2845
+ let pos = start + 1;
2846
+ while (cx.char(pos) == 32) pos++;
2847
+ if (cx.char(pos) == 10 && pos >= start + 2) return cx.append(elt(Type.HardBreak, start, pos + 1));
2848
+ }
2849
+ return -1;
2850
+ },
2851
+ Link(cx, next, start) {
2852
+ return next == 91 /* '[' */ ? cx.append(new InlineDelimiter(LinkStart, start, start + 1, 1 /* Open */)) : -1;
2853
+ },
2854
+ Image(cx, next, start) {
2855
+ return next == 33 /* '!' */ && cx.char(start + 1) == 91 /* '[' */ ? cx.append(new InlineDelimiter(ImageStart, start, start + 2, 1 /* Open */)) : -1;
2856
+ },
2857
+ LinkEnd(cx, next, start) {
2858
+ if (next != 93 /* ']' */) return -1;
2859
+ // Scanning back to the next link/image start marker
2860
+ for (let i = cx.parts.length - 1; i >= 0; i--) {
2861
+ let part = cx.parts[i];
2862
+ if (part instanceof InlineDelimiter && (part.type == LinkStart || part.type == ImageStart)) {
2863
+ // If this one has been set invalid (because it would produce
2864
+ // a nested link) or there's no valid link here ignore both.
2865
+ if (!part.side || cx.skipSpace(part.to) == start && !/[(\[]/.test(cx.slice(start + 1, start + 2))) {
2866
+ cx.parts[i] = null;
2867
+ return -1;
2868
+ }
2869
+ // Finish the content and replace the entire range in
2870
+ // this.parts with the link/image node.
2871
+ let content = cx.takeContent(i);
2872
+ let link = cx.parts[i] = finishLink(cx, content, part.type == LinkStart ? Type.Link : Type.Image, part.from, start + 1);
2873
+ // Set any open-link markers before this link to invalid.
2874
+ if (part.type == LinkStart) for (let j = 0; j < i; j++) {
2875
+ let p = cx.parts[j];
2876
+ if (p instanceof InlineDelimiter && p.type == LinkStart) p.side = 0;
2877
+ }
2878
+ return link.to;
2879
+ }
2880
+ }
2881
+ return -1;
2882
+ }
2883
+ };
2884
+ function finishLink(cx, content, type, start, startPos) {
2885
+ let {
2886
+ text
2887
+ } = cx,
2888
+ next = cx.char(startPos),
2889
+ endPos = startPos;
2890
+ content.unshift(elt(Type.LinkMark, start, start + (type == Type.Image ? 2 : 1)));
2891
+ content.push(elt(Type.LinkMark, startPos - 1, startPos));
2892
+ if (next == 40 /* '(' */) {
2893
+ let pos = cx.skipSpace(startPos + 1);
2894
+ let dest = parseURL(text, pos - cx.offset, cx.offset),
2895
+ title;
2896
+ if (dest) {
2897
+ pos = cx.skipSpace(dest.to);
2898
+ title = parseLinkTitle(text, pos - cx.offset, cx.offset);
2899
+ if (title) pos = cx.skipSpace(title.to);
2900
+ }
2901
+ if (cx.char(pos) == 41 /* ')' */) {
2902
+ content.push(elt(Type.LinkMark, startPos, startPos + 1));
2903
+ endPos = pos + 1;
2904
+ if (dest) content.push(dest);
2905
+ if (title) content.push(title);
2906
+ content.push(elt(Type.LinkMark, pos, endPos));
2907
+ }
2908
+ } else if (next == 91 /* '[' */) {
2909
+ let label = parseLinkLabel(text, startPos - cx.offset, cx.offset, false);
2910
+ if (label) {
2911
+ content.push(label);
2912
+ endPos = label.to;
2913
+ }
2914
+ }
2915
+ return elt(type, start, endPos, content);
2916
+ }
2917
+ // These return `null` when falling off the end of the input, `false`
2918
+ // when parsing fails otherwise (for use in the incremental link
2919
+ // reference parser).
2920
+ function parseURL(text, start, offset) {
2921
+ let next = text.charCodeAt(start);
2922
+ if (next == 60 /* '<' */) {
2923
+ for (let pos = start + 1; pos < text.length; pos++) {
2924
+ let ch = text.charCodeAt(pos);
2925
+ if (ch == 62 /* '>' */) return elt(Type.URL, start + offset, pos + 1 + offset);
2926
+ if (ch == 60 || ch == 10 /* '<\n' */) return false;
2927
+ }
2928
+ return null;
2929
+ } else {
2930
+ let depth = 0,
2931
+ pos = start;
2932
+ for (let escaped = false; pos < text.length; pos++) {
2933
+ let ch = text.charCodeAt(pos);
2934
+ if (space(ch)) {
2935
+ break;
2936
+ } else if (escaped) {
2937
+ escaped = false;
2938
+ } else if (ch == 40 /* '(' */) {
2939
+ depth++;
2940
+ } else if (ch == 41 /* ')' */) {
2941
+ if (!depth) break;
2942
+ depth--;
2943
+ } else if (ch == 92 /* '\\' */) {
2944
+ escaped = true;
2945
+ }
2946
+ }
2947
+ return pos > start ? elt(Type.URL, start + offset, pos + offset) : pos == text.length ? null : false;
2948
+ }
2949
+ }
2950
+ function parseLinkTitle(text, start, offset) {
2951
+ let next = text.charCodeAt(start);
2952
+ if (next != 39 && next != 34 && next != 40 /* '"\'(' */) return false;
2953
+ let end = next == 40 ? 41 : next;
2954
+ for (let pos = start + 1, escaped = false; pos < text.length; pos++) {
2955
+ let ch = text.charCodeAt(pos);
2956
+ if (escaped) escaped = false;else if (ch == end) return elt(Type.LinkTitle, start + offset, pos + 1 + offset);else if (ch == 92 /* '\\' */) escaped = true;
2957
+ }
2958
+ return null;
2959
+ }
2960
+ function parseLinkLabel(text, start, offset, requireNonWS) {
2961
+ for (let escaped = false, pos = start + 1, end = Math.min(text.length, pos + 999); pos < end; pos++) {
2962
+ let ch = text.charCodeAt(pos);
2963
+ if (escaped) escaped = false;else if (ch == 93 /* ']' */) return requireNonWS ? false : elt(Type.LinkLabel, start + offset, pos + 1 + offset);else {
2964
+ if (requireNonWS && !space(ch)) requireNonWS = false;
2965
+ if (ch == 91 /* '[' */) return false;else if (ch == 92 /* '\\' */) escaped = true;
2966
+ }
2967
+ }
2968
+ return null;
2969
+ }
2970
+ /// Inline parsing functions get access to this context, and use it to
2971
+ /// read the content and emit syntax nodes.
2972
+ class InlineContext {
2973
+ /// @internal
2974
+ constructor(
2975
+ /// The parser that is being used.
2976
+ parser,
2977
+ /// The text of this inline section.
2978
+ text,
2979
+ /// The starting offset of the section in the document.
2980
+ offset) {
2981
+ this.parser = parser;
2982
+ this.text = text;
2983
+ this.offset = offset;
2984
+ /// @internal
2985
+ this.parts = [];
2986
+ }
2987
+ /// Get the character code at the given (document-relative)
2988
+ /// position.
2989
+ char(pos) {
2990
+ return pos >= this.end ? -1 : this.text.charCodeAt(pos - this.offset);
2991
+ }
2992
+ /// The position of the end of this inline section.
2993
+ get end() {
2994
+ return this.offset + this.text.length;
2995
+ }
2996
+ /// Get a substring of this inline section. Again uses
2997
+ /// document-relative positions.
2998
+ slice(from, to) {
2999
+ return this.text.slice(from - this.offset, to - this.offset);
3000
+ }
3001
+ /// @internal
3002
+ append(elt) {
3003
+ this.parts.push(elt);
3004
+ return elt.to;
3005
+ }
3006
+ /// Add a [delimiter](#DelimiterType) at this given position. `open`
3007
+ /// and `close` indicate whether this delimiter is opening, closing,
3008
+ /// or both. Returns the end of the delimiter, for convenient
3009
+ /// returning from [parse functions](#InlineParser.parse).
3010
+ addDelimiter(type, from, to, open, close) {
3011
+ return this.append(new InlineDelimiter(type, from, to, (open ? 1 /* Open */ : 0) | (close ? 2 /* Close */ : 0)));
3012
+ }
3013
+ /// Add an inline element. Returns the end of the element.
3014
+ addElement(elt) {
3015
+ return this.append(elt);
3016
+ }
3017
+ /// Resolve markers between this.parts.length and from, wrapping matched markers in the
3018
+ /// appropriate node and updating the content of this.parts. @internal
3019
+ resolveMarkers(from) {
3020
+ // Scan forward, looking for closing tokens
3021
+ for (let i = from; i < this.parts.length; i++) {
3022
+ let close = this.parts[i];
3023
+ if (!(close instanceof InlineDelimiter && close.type.resolve && close.side & 2 /* Close */)) continue;
3024
+ let emp = close.type == EmphasisUnderscore || close.type == EmphasisAsterisk;
3025
+ let closeSize = close.to - close.from;
3026
+ let open,
3027
+ j = i - 1;
3028
+ // Continue scanning for a matching opening token
3029
+ for (; j >= from; j--) {
3030
+ let part = this.parts[j];
3031
+ if (part instanceof InlineDelimiter && part.side & 1 /* Open */ && part.type == close.type &&
3032
+ // Ignore emphasis delimiters where the character count doesn't match
3033
+ !(emp && (close.side & 1 /* Open */ || part.side & 2 /* Close */) && (part.to - part.from + closeSize) % 3 == 0 && ((part.to - part.from) % 3 || closeSize % 3))) {
3034
+ open = part;
3035
+ break;
3036
+ }
3037
+ }
3038
+ if (!open) continue;
3039
+ let type = close.type.resolve,
3040
+ content = [];
3041
+ let start = open.from,
3042
+ end = close.to;
3043
+ // Emphasis marker effect depends on the character count. Size consumed is minimum of the two
3044
+ // markers.
3045
+ if (emp) {
3046
+ let size = Math.min(2, open.to - open.from, closeSize);
3047
+ start = open.to - size;
3048
+ end = close.from + size;
3049
+ type = size == 1 ? "Emphasis" : "StrongEmphasis";
3050
+ }
3051
+ // Move the covered region into content, optionally adding marker nodes
3052
+ if (open.type.mark) content.push(this.elt(open.type.mark, start, open.to));
3053
+ for (let k = j + 1; k < i; k++) {
3054
+ if (this.parts[k] instanceof Element) content.push(this.parts[k]);
3055
+ this.parts[k] = null;
3056
+ }
3057
+ if (close.type.mark) content.push(this.elt(close.type.mark, close.from, end));
3058
+ let element = this.elt(type, start, end, content);
3059
+ // If there are leftover emphasis marker characters, shrink the close/open markers. Otherwise, clear them.
3060
+ this.parts[j] = emp && open.from != start ? new InlineDelimiter(open.type, open.from, start, open.side) : null;
3061
+ let keep = this.parts[i] = emp && close.to != end ? new InlineDelimiter(close.type, end, close.to, close.side) : null;
3062
+ // Insert the new element in this.parts
3063
+ if (keep) this.parts.splice(i, 0, element);else this.parts[i] = element;
3064
+ }
3065
+ // Collect the elements remaining in this.parts into an array.
3066
+ let result = [];
3067
+ for (let i = from; i < this.parts.length; i++) {
3068
+ let part = this.parts[i];
3069
+ if (part instanceof Element) result.push(part);
3070
+ }
3071
+ return result;
3072
+ }
3073
+ /// Find an opening delimiter of the given type. Returns `null` if
3074
+ /// no delimiter is found, or an index that can be passed to
3075
+ /// [`takeContent`](#InlineContext.takeContent) otherwise.
3076
+ findOpeningDelimiter(type) {
3077
+ for (let i = this.parts.length - 1; i >= 0; i--) {
3078
+ let part = this.parts[i];
3079
+ if (part instanceof InlineDelimiter && part.type == type) return i;
3080
+ }
3081
+ return null;
3082
+ }
3083
+ /// Remove all inline elements and delimiters starting from the
3084
+ /// given index (which you should get from
3085
+ /// [`findOpeningDelimiter`](#InlineContext.findOpeningDelimiter),
3086
+ /// resolve delimiters inside of them, and return them as an array
3087
+ /// of elements.
3088
+ takeContent(startIndex) {
3089
+ let content = this.resolveMarkers(startIndex);
3090
+ this.parts.length = startIndex;
3091
+ return content;
3092
+ }
3093
+ /// Skip space after the given (document) position, returning either
3094
+ /// the position of the next non-space character or the end of the
3095
+ /// section.
3096
+ skipSpace(from) {
3097
+ return skipSpace(this.text, from - this.offset) + this.offset;
3098
+ }
3099
+ elt(type, from, to, children) {
3100
+ if (typeof type == "string") return elt(this.parser.getNodeType(type), from, to, children);
3101
+ return new TreeElement(type, from);
3102
+ }
3103
+ }
3104
+ function injectMarks(elements, marks) {
3105
+ if (!marks.length) return elements;
3106
+ if (!elements.length) return marks;
3107
+ let elts = elements.slice(),
3108
+ eI = 0;
3109
+ for (let mark of marks) {
3110
+ while (eI < elts.length && elts[eI].to < mark.to) eI++;
3111
+ if (eI < elts.length && elts[eI].from < mark.from) {
3112
+ let e = elts[eI];
3113
+ if (e instanceof Element) elts[eI] = new Element(e.type, e.from, e.to, injectMarks(e.children, [mark]));
3114
+ } else {
3115
+ elts.splice(eI++, 0, mark);
3116
+ }
3117
+ }
3118
+ return elts;
3119
+ }
3120
+ // These are blocks that can span blank lines, and should thus only be
3121
+ // reused if their next sibling is also being reused.
3122
+ const NotLast = [Type.CodeBlock, Type.ListItem, Type.OrderedList, Type.BulletList];
3123
+ class FragmentCursor {
3124
+ constructor(fragments, input) {
3125
+ this.fragments = fragments;
3126
+ this.input = input;
3127
+ // Index into fragment array
3128
+ this.i = 0;
3129
+ // Active fragment
3130
+ this.fragment = null;
3131
+ this.fragmentEnd = -1;
3132
+ // Cursor into the current fragment, if any. When `moveTo` returns
3133
+ // true, this points at the first block after `pos`.
3134
+ this.cursor = null;
3135
+ if (fragments.length) this.fragment = fragments[this.i++];
3136
+ }
3137
+ nextFragment() {
3138
+ this.fragment = this.i < this.fragments.length ? this.fragments[this.i++] : null;
3139
+ this.cursor = null;
3140
+ this.fragmentEnd = -1;
3141
+ }
3142
+ moveTo(pos, lineStart) {
3143
+ while (this.fragment && this.fragment.to <= pos) this.nextFragment();
3144
+ if (!this.fragment || this.fragment.from > (pos ? pos - 1 : 0)) return false;
3145
+ if (this.fragmentEnd < 0) {
3146
+ let end = this.fragment.to;
3147
+ while (end > 0 && this.input.read(end - 1, end) != "\n") end--;
3148
+ this.fragmentEnd = end ? end - 1 : 0;
3149
+ }
3150
+ let c = this.cursor;
3151
+ if (!c) {
3152
+ c = this.cursor = this.fragment.tree.cursor();
3153
+ c.firstChild();
3154
+ }
3155
+ let rPos = pos + this.fragment.offset;
3156
+ while (c.to <= rPos) if (!c.parent()) return false;
3157
+ for (;;) {
3158
+ if (c.from >= rPos) return this.fragment.from <= lineStart;
3159
+ if (!c.childAfter(rPos)) return false;
3160
+ }
3161
+ }
3162
+ matches(hash) {
3163
+ let tree = this.cursor.tree;
3164
+ return tree && tree.prop(NodeProp.contextHash) == hash;
3165
+ }
3166
+ takeNodes(cx) {
3167
+ let cur = this.cursor,
3168
+ off = this.fragment.offset,
3169
+ fragEnd = this.fragmentEnd - (this.fragment.openEnd ? 1 : 0);
3170
+ let start = cx.absoluteLineStart,
3171
+ end = start,
3172
+ blockI = cx.block.children.length;
3173
+ let prevEnd = end,
3174
+ prevI = blockI;
3175
+ for (;;) {
3176
+ if (cur.to - off > fragEnd) {
3177
+ if (cur.type.isAnonymous && cur.firstChild()) continue;
3178
+ break;
3179
+ }
3180
+ cx.dontInject.add(cur.tree);
3181
+ cx.addNode(cur.tree, cur.from - off);
3182
+ // Taken content must always end in a block, because incremental
3183
+ // parsing happens on block boundaries. Never stop directly
3184
+ // after an indented code block, since those can continue after
3185
+ // any number of blank lines.
3186
+ if (cur.type.is("Block")) {
3187
+ if (NotLast.indexOf(cur.type.id) < 0) {
3188
+ end = cur.to - off;
3189
+ blockI = cx.block.children.length;
3190
+ } else {
3191
+ end = prevEnd;
3192
+ blockI = prevI;
3193
+ prevEnd = cur.to - off;
3194
+ prevI = cx.block.children.length;
3195
+ }
3196
+ }
3197
+ if (!cur.nextSibling()) break;
3198
+ }
3199
+ while (cx.block.children.length > blockI) {
3200
+ cx.block.children.pop();
3201
+ cx.block.positions.pop();
3202
+ }
3203
+ return end - start;
3204
+ }
3205
+ }
3206
+ const markdownHighlighting = styleTags({
3207
+ "Blockquote/...": tags$1.quote,
3208
+ HorizontalRule: tags$1.contentSeparator,
3209
+ "ATXHeading1/... SetextHeading1/...": tags$1.heading1,
3210
+ "ATXHeading2/... SetextHeading2/...": tags$1.heading2,
3211
+ "ATXHeading3/...": tags$1.heading3,
3212
+ "ATXHeading4/...": tags$1.heading4,
3213
+ "ATXHeading5/...": tags$1.heading5,
3214
+ "ATXHeading6/...": tags$1.heading6,
3215
+ "Comment CommentBlock": tags$1.comment,
3216
+ Escape: tags$1.escape,
3217
+ Entity: tags$1.character,
3218
+ "Emphasis/...": tags$1.emphasis,
3219
+ "StrongEmphasis/...": tags$1.strong,
3220
+ "Link/... Image/...": tags$1.link,
3221
+ "OrderedList/... BulletList/...": tags$1.list,
3222
+ "BlockQuote/...": tags$1.quote,
3223
+ "InlineCode CodeText": tags$1.monospace,
3224
+ URL: tags$1.url,
3225
+ "HeaderMark HardBreak QuoteMark ListMark LinkMark EmphasisMark CodeMark": tags$1.processingInstruction,
3226
+ "CodeInfo LinkLabel": tags$1.labelName,
3227
+ LinkTitle: tags$1.string,
3228
+ Paragraph: tags$1.content
3229
+ });
3230
+ /// The default CommonMark parser.
3231
+ const 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), []);
3232
+ function leftOverSpace(node, from, to) {
3233
+ let ranges = [];
3234
+ for (let n = node.firstChild, pos = from;; n = n.nextSibling) {
3235
+ let nextPos = n ? n.from : to;
3236
+ if (nextPos > pos) ranges.push({
3237
+ from: pos,
3238
+ to: nextPos
3239
+ });
3240
+ if (!n) break;
3241
+ pos = n.to;
3242
+ }
3243
+ return ranges;
3244
+ }
3245
+ /// Create a Markdown extension to enable nested parsing on code
3246
+ /// blocks and/or embedded HTML.
3247
+ function parseCode(config) {
3248
+ let {
3249
+ codeParser,
3250
+ htmlParser
3251
+ } = config;
3252
+ let wrap = parseMixed((node, input) => {
3253
+ let id = node.type.id;
3254
+ if (codeParser && (id == Type.CodeBlock || id == Type.FencedCode)) {
3255
+ let info = "";
3256
+ if (id == Type.FencedCode) {
3257
+ let infoNode = node.node.getChild(Type.CodeInfo);
3258
+ if (infoNode) info = input.read(infoNode.from, infoNode.to);
3259
+ }
3260
+ let parser = codeParser(info);
3261
+ if (parser) return {
3262
+ parser,
3263
+ overlay: node => node.type.id == Type.CodeText
3264
+ };
3265
+ } else if (htmlParser && (id == Type.HTMLBlock || id == Type.HTMLTag)) {
3266
+ return {
3267
+ parser: htmlParser,
3268
+ overlay: leftOverSpace(node.node, node.from, node.to)
3269
+ };
3270
+ }
3271
+ return null;
3272
+ });
3273
+ return {
3274
+ wrap
3275
+ };
3276
+ }
3277
+ const StrikethroughDelim = {
3278
+ resolve: "Strikethrough",
3279
+ mark: "StrikethroughMark"
3280
+ };
3281
+ /// An extension that implements
3282
+ /// [GFM-style](https://github.github.com/gfm/#strikethrough-extension-)
3283
+ /// Strikethrough syntax using `~~` delimiters.
3284
+ const Strikethrough = {
3285
+ defineNodes: [{
3286
+ name: "Strikethrough",
3287
+ style: {
3288
+ "Strikethrough/...": tags$1.strikethrough
3289
+ }
3290
+ }, {
3291
+ name: "StrikethroughMark",
3292
+ style: tags$1.processingInstruction
3293
+ }],
3294
+ parseInline: [{
3295
+ name: "Strikethrough",
3296
+ parse(cx, next, pos) {
3297
+ if (next != 126 /* '~' */ || cx.char(pos + 1) != 126 || cx.char(pos + 2) == 126) return -1;
3298
+ let before = cx.slice(pos - 1, pos),
3299
+ after = cx.slice(pos + 2, pos + 3);
3300
+ let sBefore = /\s|^$/.test(before),
3301
+ sAfter = /\s|^$/.test(after);
3302
+ let pBefore = Punctuation.test(before),
3303
+ pAfter = Punctuation.test(after);
3304
+ return cx.addDelimiter(StrikethroughDelim, pos, pos + 2, !sAfter && (!pAfter || sBefore || pBefore), !sBefore && (!pBefore || sAfter || pAfter));
3305
+ },
3306
+ after: "Emphasis"
3307
+ }]
3308
+ };
3309
+ function parseRow(cx, line, startI = 0, elts, offset = 0) {
3310
+ let count = 0,
3311
+ first = true,
3312
+ cellStart = -1,
3313
+ cellEnd = -1,
3314
+ esc = false;
3315
+ let parseCell = () => {
3316
+ elts.push(cx.elt("TableCell", offset + cellStart, offset + cellEnd, cx.parser.parseInline(line.slice(cellStart, cellEnd), offset + cellStart)));
3317
+ };
3318
+ for (let i = startI; i < line.length; i++) {
3319
+ let next = line.charCodeAt(i);
3320
+ if (next == 124 /* '|' */ && !esc) {
3321
+ if (!first || cellStart > -1) count++;
3322
+ first = false;
3323
+ if (elts) {
3324
+ if (cellStart > -1) parseCell();
3325
+ elts.push(cx.elt("TableDelimiter", i + offset, i + offset + 1));
3326
+ }
3327
+ cellStart = cellEnd = -1;
3328
+ } else if (esc || next != 32 && next != 9) {
3329
+ if (cellStart < 0) cellStart = i;
3330
+ cellEnd = i + 1;
3331
+ }
3332
+ esc = !esc && next == 92;
3333
+ }
3334
+ if (cellStart > -1) {
3335
+ count++;
3336
+ if (elts) parseCell();
3337
+ }
3338
+ return count;
3339
+ }
3340
+ function hasPipe(str, start) {
3341
+ for (let i = start; i < str.length; i++) {
3342
+ let next = str.charCodeAt(i);
3343
+ if (next == 124 /* '|' */) return true;
3344
+ if (next == 92 /* '\\' */) i++;
3345
+ }
3346
+ return false;
3347
+ }
3348
+ const delimiterLine = /^\|?(\s*:?-+:?\s*\|)+(\s*:?-+:?\s*)?$/;
3349
+ class TableParser {
3350
+ constructor() {
3351
+ // Null means we haven't seen the second line yet, false means this
3352
+ // isn't a table, and an array means this is a table and we've
3353
+ // parsed the given rows so far.
3354
+ this.rows = null;
3355
+ }
3356
+ nextLine(cx, line, leaf) {
3357
+ if (this.rows == null) {
3358
+ // Second line
3359
+ this.rows = false;
3360
+ let lineText;
3361
+ if ((line.next == 45 || line.next == 58 || line.next == 124 /* '-:|' */) && delimiterLine.test(lineText = line.text.slice(line.pos))) {
3362
+ let firstRow = [],
3363
+ firstCount = parseRow(cx, leaf.content, 0, firstRow, leaf.start);
3364
+ if (firstCount == parseRow(cx, lineText, line.pos)) this.rows = [cx.elt("TableHeader", leaf.start, leaf.start + leaf.content.length, firstRow), cx.elt("TableDelimiter", cx.lineStart + line.pos, cx.lineStart + line.text.length)];
3365
+ }
3366
+ } else if (this.rows) {
3367
+ // Line after the second
3368
+ let content = [];
3369
+ parseRow(cx, line.text, line.pos, content, cx.lineStart);
3370
+ this.rows.push(cx.elt("TableRow", cx.lineStart + line.pos, cx.lineStart + line.text.length, content));
3371
+ }
3372
+ return false;
3373
+ }
3374
+ finish(cx, leaf) {
3375
+ if (!this.rows) return false;
3376
+ cx.addLeafElement(leaf, cx.elt("Table", leaf.start, leaf.start + leaf.content.length, this.rows));
3377
+ return true;
3378
+ }
3379
+ }
3380
+ /// This extension provides
3381
+ /// [GFM-style](https://github.github.com/gfm/#tables-extension-)
3382
+ /// tables, using syntax like this:
3383
+ ///
3384
+ /// ```
3385
+ /// | head 1 | head 2 |
3386
+ /// | --- | --- |
3387
+ /// | cell 1 | cell 2 |
3388
+ /// ```
3389
+ const Table = {
3390
+ defineNodes: [{
3391
+ name: "Table",
3392
+ block: true
3393
+ }, {
3394
+ name: "TableHeader",
3395
+ style: {
3396
+ "TableHeader/...": tags$1.heading
3397
+ }
3398
+ }, "TableRow", {
3399
+ name: "TableCell",
3400
+ style: tags$1.content
3401
+ }, {
3402
+ name: "TableDelimiter",
3403
+ style: tags$1.processingInstruction
3404
+ }],
3405
+ parseBlock: [{
3406
+ name: "Table",
3407
+ leaf(_, leaf) {
3408
+ return hasPipe(leaf.content, 0) ? new TableParser() : null;
3409
+ },
3410
+ endLeaf(cx, line, leaf) {
3411
+ if (leaf.parsers.some(p => p instanceof TableParser) || !hasPipe(line.text, line.basePos)) return false;
3412
+ let next = cx.scanLine(cx.absoluteLineEnd + 1).text;
3413
+ return delimiterLine.test(next) && parseRow(cx, line.text, line.basePos) == parseRow(cx, next, line.basePos);
3414
+ },
3415
+ before: "SetextHeading"
3416
+ }]
3417
+ };
3418
+ class TaskParser {
3419
+ nextLine() {
3420
+ return false;
3421
+ }
3422
+ finish(cx, leaf) {
3423
+ cx.addLeafElement(leaf, cx.elt("Task", leaf.start, leaf.start + leaf.content.length, [cx.elt("TaskMarker", leaf.start, leaf.start + 3), ...cx.parser.parseInline(leaf.content.slice(3), leaf.start + 3)]));
3424
+ return true;
3425
+ }
3426
+ }
3427
+ /// Extension providing
3428
+ /// [GFM-style](https://github.github.com/gfm/#task-list-items-extension-)
3429
+ /// task list items, where list items can be prefixed with `[ ]` or
3430
+ /// `[x]` to add a checkbox.
3431
+ const TaskList = {
3432
+ defineNodes: [{
3433
+ name: "Task",
3434
+ block: true,
3435
+ style: tags$1.list
3436
+ }, {
3437
+ name: "TaskMarker",
3438
+ style: tags$1.atom
3439
+ }],
3440
+ parseBlock: [{
3441
+ name: "TaskList",
3442
+ leaf(cx, leaf) {
3443
+ return /^\[[ xX]\]/.test(leaf.content) && cx.parentType().name == "ListItem" ? new TaskParser() : null;
3444
+ },
3445
+ after: "SetextHeading"
3446
+ }]
3447
+ };
3448
+ /// Extension bundle containing [`Table`](#Table),
3449
+ /// [`TaskList`](#TaskList) and [`Strikethrough`](#Strikethrough).
3450
+ const GFM = [Table, TaskList, Strikethrough];
3451
+ function parseSubSuper(ch, node, mark) {
3452
+ return (cx, next, pos) => {
3453
+ if (next != ch || cx.char(pos + 1) == ch) return -1;
3454
+ let elts = [cx.elt(mark, pos, pos + 1)];
3455
+ for (let i = pos + 1; i < cx.end; i++) {
3456
+ let next = cx.char(i);
3457
+ if (next == ch) return cx.addElement(cx.elt(node, pos, i + 1, elts.concat(cx.elt(mark, i, i + 1))));
3458
+ if (next == 92 /* '\\' */) elts.push(cx.elt("Escape", i, i++ + 2));
3459
+ if (space(next)) break;
3460
+ }
3461
+ return -1;
3462
+ };
3463
+ }
3464
+ /// Extension providing
3465
+ /// [Pandoc-style](https://pandoc.org/MANUAL.html#superscripts-and-subscripts)
3466
+ /// superscript using `^` markers.
3467
+ const Superscript = {
3468
+ defineNodes: [{
3469
+ name: "Superscript",
3470
+ style: tags$1.special(tags$1.content)
3471
+ }, {
3472
+ name: "SuperscriptMark",
3473
+ style: tags$1.processingInstruction
3474
+ }],
3475
+ parseInline: [{
3476
+ name: "Superscript",
3477
+ parse: parseSubSuper(94 /* '^' */, "Superscript", "SuperscriptMark")
3478
+ }]
3479
+ };
3480
+ /// Extension providing
3481
+ /// [Pandoc-style](https://pandoc.org/MANUAL.html#superscripts-and-subscripts)
3482
+ /// subscript using `~` markers.
3483
+ const Subscript = {
3484
+ defineNodes: [{
3485
+ name: "Subscript",
3486
+ style: tags$1.special(tags$1.content)
3487
+ }, {
3488
+ name: "SubscriptMark",
3489
+ style: tags$1.processingInstruction
3490
+ }],
3491
+ parseInline: [{
3492
+ name: "Subscript",
3493
+ parse: parseSubSuper(126 /* '~' */, "Subscript", "SubscriptMark")
3494
+ }]
3495
+ };
3496
+ /// Extension that parses two colons with only letters, underscores,
3497
+ /// and numbers between them as `Emoji` nodes.
3498
+ const Emoji = {
3499
+ defineNodes: [{
3500
+ name: "Emoji",
3501
+ style: tags$1.character
3502
+ }],
3503
+ parseInline: [{
3504
+ name: "Emoji",
3505
+ parse(cx, next, pos) {
3506
+ let match;
3507
+ if (next != 58 /* ':' */ || !(match = /^[a-zA-Z_0-9]+:/.exec(cx.slice(pos + 1, cx.end)))) return -1;
3508
+ return cx.addElement(cx.elt("Emoji", pos, pos + 1 + match[0].length));
3509
+ }
3510
+ }]
3511
+ };
3512
+
3513
+ const data = /*@__PURE__*/defineLanguageFacet({
3514
+ block: {
3515
+ open: "<!--",
3516
+ close: "-->"
3517
+ }
3518
+ });
3519
+ const commonmark = /*@__PURE__*/parser.configure({
3520
+ props: [/*@__PURE__*/foldNodeProp.add(type => {
3521
+ if (!type.is("Block") || type.is("Document")) return undefined;
3522
+ return (tree, state) => ({
3523
+ from: state.doc.lineAt(tree.from).to,
3524
+ to: tree.to
3525
+ });
3526
+ }), /*@__PURE__*/indentNodeProp.add({
3527
+ Document: () => null
3528
+ }), /*@__PURE__*/languageDataProp.add({
3529
+ Document: data
3530
+ })]
3531
+ });
3532
+ function mkLang(parser) {
3533
+ return new Language(data, parser);
3534
+ }
3535
+ /**
3536
+ Language support for strict CommonMark.
3537
+ */
3538
+ const commonmarkLanguage = /*@__PURE__*/mkLang(commonmark);
3539
+ const extended = /*@__PURE__*/commonmark.configure([GFM, Subscript, Superscript, Emoji]);
3540
+ /**
3541
+ Language support for [GFM](https://github.github.com/gfm/) plus
3542
+ subscript, superscript, and emoji syntax.
3543
+ */
3544
+ const markdownLanguage = /*@__PURE__*/mkLang(extended);
3545
+ function getCodeParser(languages, defaultLanguage) {
3546
+ return info => {
3547
+ if (info && languages) {
3548
+ let found = null;
3549
+ // Strip anything after whitespace
3550
+ info = /\S*/.exec(info)[0];
3551
+ if (typeof languages == "function") found = languages(info);else found = LanguageDescription.matchLanguageName(languages, info, true);
3552
+ if (found instanceof LanguageDescription) return found.support ? found.support.language.parser : ParseContext.getSkippingParser(found.load());else if (found) return found.parser;
3553
+ }
3554
+ return defaultLanguage ? defaultLanguage.parser : null;
3555
+ };
3556
+ }
3557
+ function nodeStart(node, doc) {
3558
+ return doc.sliceString(node.from, node.from + 50);
3559
+ }
3560
+ class Context {
3561
+ constructor(node, from, to, spaceBefore, spaceAfter, type, item) {
3562
+ this.node = node;
3563
+ this.from = from;
3564
+ this.to = to;
3565
+ this.spaceBefore = spaceBefore;
3566
+ this.spaceAfter = spaceAfter;
3567
+ this.type = type;
3568
+ this.item = item;
3569
+ }
3570
+ blank(trailing = true) {
3571
+ let result = this.spaceBefore;
3572
+ if (this.node.name == "Blockquote") result += ">";else for (let i = this.to - this.from - result.length - this.spaceAfter.length; i > 0; i--) result += " ";
3573
+ return result + (trailing ? this.spaceAfter : "");
3574
+ }
3575
+ marker(doc, add) {
3576
+ let number = this.node.name == "OrderedList" ? String(+itemNumber(this.item, doc)[2] + add) : "";
3577
+ return this.spaceBefore + number + this.type + this.spaceAfter;
3578
+ }
3579
+ }
3580
+ function getContext(node, line, doc) {
3581
+ let nodes = [];
3582
+ for (let cur = node; cur && cur.name != "Document"; cur = cur.parent) {
3583
+ if (cur.name == "ListItem" || cur.name == "Blockquote") nodes.push(cur);
3584
+ }
3585
+ let context = [],
3586
+ pos = 0;
3587
+ for (let i = nodes.length - 1; i >= 0; i--) {
3588
+ let node = nodes[i],
3589
+ match,
3590
+ start = pos;
3591
+ if (node.name == "Blockquote" && (match = /^[ \t]*>( ?)/.exec(line.slice(pos)))) {
3592
+ pos += match[0].length;
3593
+ context.push(new Context(node, start, pos, "", match[1], ">", null));
3594
+ } else if (node.name == "ListItem" && node.parent.name == "OrderedList" && (match = /^([ \t]*)\d+([.)])([ \t]*)/.exec(nodeStart(node, doc)))) {
3595
+ let after = match[3],
3596
+ len = match[0].length;
3597
+ if (after.length >= 4) {
3598
+ after = after.slice(0, after.length - 4);
3599
+ len -= 4;
3600
+ }
3601
+ pos += len;
3602
+ context.push(new Context(node.parent, start, pos, match[1], after, match[2], node));
3603
+ } else if (node.name == "ListItem" && node.parent.name == "BulletList" && (match = /^([ \t]*)([-+*])([ \t]{1,4}\[[ xX]\])?([ \t]+)/.exec(nodeStart(node, doc)))) {
3604
+ let after = match[4],
3605
+ len = match[0].length;
3606
+ if (after.length > 4) {
3607
+ after = after.slice(0, after.length - 4);
3608
+ len -= 4;
3609
+ }
3610
+ let type = match[2];
3611
+ if (match[3]) type += match[3].replace(/[xX]/, ' ');
3612
+ pos += len;
3613
+ context.push(new Context(node.parent, start, pos, match[1], after, type, node));
3614
+ }
3615
+ }
3616
+ return context;
3617
+ }
3618
+ function itemNumber(item, doc) {
3619
+ return /^(\s*)(\d+)(?=[.)])/.exec(doc.sliceString(item.from, item.from + 10));
3620
+ }
3621
+ function renumberList(after, doc, changes, offset = 0) {
3622
+ for (let prev = -1, node = after;;) {
3623
+ if (node.name == "ListItem") {
3624
+ let m = itemNumber(node, doc);
3625
+ let number = +m[2];
3626
+ if (prev >= 0) {
3627
+ if (number != prev + 1) return;
3628
+ changes.push({
3629
+ from: node.from + m[1].length,
3630
+ to: node.from + m[0].length,
3631
+ insert: String(prev + 2 + offset)
3632
+ });
3633
+ }
3634
+ prev = number;
3635
+ }
3636
+ let next = node.nextSibling;
3637
+ if (!next) break;
3638
+ node = next;
3639
+ }
3640
+ }
3641
+ /**
3642
+ This command, when invoked in Markdown context with cursor
3643
+ selection(s), will create a new line with the markup for
3644
+ blockquotes and lists that were active on the old line. If the
3645
+ cursor was directly after the end of the markup for the old line,
3646
+ trailing whitespace and list markers are removed from that line.
3647
+
3648
+ The command does nothing in non-Markdown context, so it should
3649
+ not be used as the only binding for Enter (even in a Markdown
3650
+ document, HTML and code regions might use a different language).
3651
+ */
3652
+ const insertNewlineContinueMarkup = ({
3653
+ state,
3654
+ dispatch
3655
+ }) => {
3656
+ let tree = syntaxTree(state),
3657
+ {
3658
+ doc
3659
+ } = state;
3660
+ let dont = null,
3661
+ changes = state.changeByRange(range => {
3662
+ if (!range.empty || !markdownLanguage.isActiveAt(state, range.from)) return dont = {
3663
+ range
3664
+ };
3665
+ let pos = range.from,
3666
+ line = doc.lineAt(pos);
3667
+ let context = getContext(tree.resolveInner(pos, -1), line.text, doc);
3668
+ while (context.length && context[context.length - 1].from > pos - line.from) context.pop();
3669
+ if (!context.length) return dont = {
3670
+ range
3671
+ };
3672
+ let inner = context[context.length - 1];
3673
+ if (inner.to - inner.spaceAfter.length > pos - line.from) return dont = {
3674
+ range
3675
+ };
3676
+ let emptyLine = pos >= inner.to - inner.spaceAfter.length && !/\S/.test(line.text.slice(inner.to));
3677
+ // Empty line in list
3678
+ if (inner.item && emptyLine) {
3679
+ // First list item or blank line before: delete a level of markup
3680
+ if (inner.node.firstChild.to >= pos || line.from > 0 && !/[^\s>]/.test(doc.lineAt(line.from - 1).text)) {
3681
+ let next = context.length > 1 ? context[context.length - 2] : null;
3682
+ let delTo,
3683
+ insert = "";
3684
+ if (next && next.item) {
3685
+ // Re-add marker for the list at the next level
3686
+ delTo = line.from + next.from;
3687
+ insert = next.marker(doc, 1);
3688
+ } else {
3689
+ delTo = line.from + (next ? next.to : 0);
3690
+ }
3691
+ let changes = [{
3692
+ from: delTo,
3693
+ to: pos,
3694
+ insert
3695
+ }];
3696
+ if (inner.node.name == "OrderedList") renumberList(inner.item, doc, changes, -2);
3697
+ if (next && next.node.name == "OrderedList") renumberList(next.item, doc, changes);
3698
+ return {
3699
+ range: EditorSelection.cursor(delTo + insert.length),
3700
+ changes
3701
+ };
3702
+ } else {
3703
+ // Move this line down
3704
+ let insert = "";
3705
+ for (let i = 0, e = context.length - 2; i <= e; i++) insert += context[i].blank(i < e);
3706
+ insert += state.lineBreak;
3707
+ return {
3708
+ range: EditorSelection.cursor(pos + insert.length),
3709
+ changes: {
3710
+ from: line.from,
3711
+ insert
3712
+ }
3713
+ };
3714
+ }
3715
+ }
3716
+ if (inner.node.name == "Blockquote" && emptyLine && line.from) {
3717
+ let prevLine = doc.lineAt(line.from - 1),
3718
+ quoted = />\s*$/.exec(prevLine.text);
3719
+ // Two aligned empty quoted lines in a row
3720
+ if (quoted && quoted.index == inner.from) {
3721
+ let changes = state.changes([{
3722
+ from: prevLine.from + quoted.index,
3723
+ to: prevLine.to
3724
+ }, {
3725
+ from: line.from + inner.from,
3726
+ to: line.to
3727
+ }]);
3728
+ return {
3729
+ range: range.map(changes),
3730
+ changes
3731
+ };
3732
+ }
3733
+ }
3734
+ let changes = [];
3735
+ if (inner.node.name == "OrderedList") renumberList(inner.item, doc, changes);
3736
+ let insert = state.lineBreak;
3737
+ let continued = inner.item && inner.item.from < line.from;
3738
+ // If not dedented
3739
+ if (!continued || /^[\s\d.)\-+*>]*/.exec(line.text)[0].length >= inner.to) {
3740
+ for (let i = 0, e = context.length - 1; i <= e; i++) insert += i == e && !continued ? context[i].marker(doc, 1) : context[i].blank();
3741
+ }
3742
+ let from = pos;
3743
+ while (from > line.from && /\s/.test(line.text.charAt(from - line.from - 1))) from--;
3744
+ changes.push({
3745
+ from,
3746
+ to: pos,
3747
+ insert
3748
+ });
3749
+ return {
3750
+ range: EditorSelection.cursor(from + insert.length),
3751
+ changes
3752
+ };
3753
+ });
3754
+ if (dont) return false;
3755
+ dispatch(state.update(changes, {
3756
+ scrollIntoView: true,
3757
+ userEvent: "input"
3758
+ }));
3759
+ return true;
3760
+ };
3761
+ function isMark(node) {
3762
+ return node.name == "QuoteMark" || node.name == "ListMark";
3763
+ }
3764
+ function contextNodeForDelete(tree, pos) {
3765
+ let node = tree.resolveInner(pos, -1),
3766
+ scan = pos;
3767
+ if (isMark(node)) {
3768
+ scan = node.from;
3769
+ node = node.parent;
3770
+ }
3771
+ for (let prev; prev = node.childBefore(scan);) {
3772
+ if (isMark(prev)) {
3773
+ scan = prev.from;
3774
+ } else if (prev.name == "OrderedList" || prev.name == "BulletList") {
3775
+ node = prev.lastChild;
3776
+ scan = node.to;
3777
+ } else {
3778
+ break;
3779
+ }
3780
+ }
3781
+ return node;
3782
+ }
3783
+ /**
3784
+ This command will, when invoked in a Markdown context with the
3785
+ cursor directly after list or blockquote markup, delete one level
3786
+ of markup. When the markup is for a list, it will be replaced by
3787
+ spaces on the first invocation (a further invocation will delete
3788
+ the spaces), to make it easy to continue a list.
3789
+
3790
+ When not after Markdown block markup, this command will return
3791
+ false, so it is intended to be bound alongside other deletion
3792
+ commands, with a higher precedence than the more generic commands.
3793
+ */
3794
+ const deleteMarkupBackward = ({
3795
+ state,
3796
+ dispatch
3797
+ }) => {
3798
+ let tree = syntaxTree(state);
3799
+ let dont = null,
3800
+ changes = state.changeByRange(range => {
3801
+ let pos = range.from,
3802
+ {
3803
+ doc
3804
+ } = state;
3805
+ if (range.empty && markdownLanguage.isActiveAt(state, range.from)) {
3806
+ let line = doc.lineAt(pos);
3807
+ let context = getContext(contextNodeForDelete(tree, pos), line.text, doc);
3808
+ if (context.length) {
3809
+ let inner = context[context.length - 1];
3810
+ let spaceEnd = inner.to - inner.spaceAfter.length + (inner.spaceAfter ? 1 : 0);
3811
+ // Delete extra trailing space after markup
3812
+ if (pos - line.from > spaceEnd && !/\S/.test(line.text.slice(spaceEnd, pos - line.from))) return {
3813
+ range: EditorSelection.cursor(line.from + spaceEnd),
3814
+ changes: {
3815
+ from: line.from + spaceEnd,
3816
+ to: pos
3817
+ }
3818
+ };
3819
+ if (pos - line.from == spaceEnd) {
3820
+ let start = line.from + inner.from;
3821
+ // Replace a list item marker with blank space
3822
+ if (inner.item && inner.node.from < inner.item.from && /\S/.test(line.text.slice(inner.from, inner.to))) return {
3823
+ range,
3824
+ changes: {
3825
+ from: start,
3826
+ to: line.from + inner.to,
3827
+ insert: inner.blank()
3828
+ }
3829
+ };
3830
+ // Delete one level of indentation
3831
+ if (start < pos) return {
3832
+ range: EditorSelection.cursor(start),
3833
+ changes: {
3834
+ from: start,
3835
+ to: pos
3836
+ }
3837
+ };
3838
+ }
3839
+ }
3840
+ }
3841
+ return dont = {
3842
+ range
3843
+ };
3844
+ });
3845
+ if (dont) return false;
3846
+ dispatch(state.update(changes, {
3847
+ scrollIntoView: true,
3848
+ userEvent: "delete"
3849
+ }));
3850
+ return true;
3851
+ };
3852
+
3853
+ /**
3854
+ A small keymap with Markdown-specific bindings. Binds Enter to
3855
+ [`insertNewlineContinueMarkup`](https://codemirror.net/6/docs/ref/#lang-markdown.insertNewlineContinueMarkup)
3856
+ and Backspace to
3857
+ [`deleteMarkupBackward`](https://codemirror.net/6/docs/ref/#lang-markdown.deleteMarkupBackward).
3858
+ */
3859
+ const markdownKeymap = [{
3860
+ key: "Enter",
3861
+ run: insertNewlineContinueMarkup
3862
+ }, {
3863
+ key: "Backspace",
3864
+ run: deleteMarkupBackward
3865
+ }];
3866
+ const htmlNoMatch = /*@__PURE__*/html({
3867
+ matchClosingTags: false
3868
+ });
3869
+ /**
3870
+ Markdown language support.
3871
+ */
3872
+ function markdown(config = {}) {
3873
+ let {
3874
+ codeLanguages,
3875
+ defaultCodeLanguage,
3876
+ addKeymap = true,
3877
+ base: {
3878
+ parser
3879
+ } = commonmarkLanguage
3880
+ } = config;
3881
+ if (!(parser instanceof MarkdownParser)) throw new RangeError("Base parser provided to `markdown` should be a Markdown parser");
3882
+ let extensions = config.extensions ? [config.extensions] : [];
3883
+ let support = [htmlNoMatch.support],
3884
+ defaultCode;
3885
+ if (defaultCodeLanguage instanceof LanguageSupport) {
3886
+ support.push(defaultCodeLanguage.support);
3887
+ defaultCode = defaultCodeLanguage.language;
3888
+ } else if (defaultCodeLanguage) {
3889
+ defaultCode = defaultCodeLanguage;
3890
+ }
3891
+ let codeParser = codeLanguages || defaultCode ? getCodeParser(codeLanguages, defaultCode) : undefined;
3892
+ extensions.push(parseCode({
3893
+ codeParser,
3894
+ htmlParser: htmlNoMatch.language.parser
3895
+ }));
3896
+ if (addKeymap) support.push(Prec.high(keymap.of(markdownKeymap)));
3897
+ return new LanguageSupport(mkLang(parser.configure(extensions)), support);
3898
+ }
3899
+
3900
+ const JS = javascript({
3901
+ typescript: false
3902
+ });
3903
+ const TS = javascript({
3904
+ typescript: true
3905
+ });
3906
+ const CSS = css();
3907
+ const HTML = html();
3908
+ const JSON$1 = json();
3909
+ const MD = markdown();
3910
+ var languages = {
3911
+ [OrCodeLanguages.JS]: JS,
3912
+ [OrCodeLanguages.TS]: TS,
3913
+ [OrCodeLanguages.CSS]: CSS,
3914
+ [OrCodeLanguages.HTML]: HTML,
3915
+ [OrCodeLanguages.JSON]: JSON$1,
3916
+ [OrCodeLanguages.MD]: MD
3917
+ };
3918
+
3919
+ //partially based on https://github.com/logue/vue-codemirror6/blob/master/src/components/CodeMirror.vue
3920
+ var script = defineComponent({
3921
+ name: 'OrCode',
3922
+ components: {
3923
+ OrIconButton: script$1,
3924
+ OrModal: script$2,
3925
+ OrTeleport: script$3,
3926
+ OrError: script$4,
3927
+ OrHint: script$5,
3928
+ OrLabel: script$6
3929
+ },
3930
+ model: {
3931
+ prop: 'modelValue',
3932
+ event: 'update:modelValue'
3933
+ },
3934
+ props: {
3935
+ label: {
3936
+ type: String,
3937
+ default: '',
3938
+ required: false
3939
+ },
3940
+ modelValue: {
3941
+ type: String,
3942
+ default: '',
3943
+ required: false
3944
+ },
3945
+ language: {
3946
+ type: [Object, String],
3947
+ required: false,
3948
+ default: OrCodeLanguages.JS
3949
+ },
3950
+ isReadonly: {
3951
+ type: Boolean,
3952
+ required: false,
3953
+ default: false
3954
+ },
3955
+ extensions: {
3956
+ type: Array,
3957
+ required: false,
3958
+ default: () => [basicSetup]
3959
+ },
3960
+ phrases: {
3961
+ type: Object,
3962
+ required: false,
3963
+ default: null
3964
+ },
3965
+ isShowingFullscreen: {
3966
+ type: Boolean,
3967
+ default: true,
3968
+ required: false
3969
+ },
3970
+ isInvalid: {
3971
+ type: Boolean,
3972
+ default: false,
3973
+ required: false
3974
+ },
3975
+ error: {
3976
+ type: String,
3977
+ default: '',
3978
+ required: false
3979
+ },
3980
+ hint: {
3981
+ type: String,
3982
+ default: '',
3983
+ required: false
3984
+ },
3985
+ allowPaste: {
3986
+ type: Boolean,
3987
+ default: true
3988
+ },
3989
+ allowDrop: {
3990
+ type: Boolean,
3991
+ default: true
3992
+ },
3993
+ lineWrapping: {
3994
+ type: Boolean,
3995
+ default: false
3996
+ }
3997
+ },
3998
+ emits: ['update:modelValue', 'focus', 'blur'],
3999
+ setup(props, {
4000
+ emit
4001
+ }) {
4002
+ const root = ref();
4003
+ const target = ref();
4004
+ const fullscreenTarget = ref();
4005
+ const isHovered = useElementHover(root);
4006
+ const editor = new EditorView({
4007
+ state: EditorState.create({
4008
+ doc: props.modelValue
4009
+ }),
4010
+ dispatch: tr => {
4011
+ editor.update([tr]);
4012
+ if (tr.changes.empty) return;
4013
+ emit('update:modelValue', editor.state.doc.toString());
4014
+ }
4015
+ });
4016
+ return {
4017
+ root,
4018
+ target,
4019
+ fullscreenTarget,
4020
+ editor,
4021
+ isHovered
4022
+ };
4023
+ },
4024
+ data() {
4025
+ return {
4026
+ isFullscreen: false
4027
+ };
4028
+ },
4029
+ computed: {
4030
+ localLanguage() {
4031
+ if (_.includes(_.values(OrCodeLanguages), this.language)) {
4032
+ return languages[this.language];
4033
+ } else {
4034
+ return this.language;
4035
+ }
4036
+ },
4037
+ localExtensions() {
4038
+ const {
4039
+ allowDrop,
4040
+ allowPaste,
4041
+ lineWrapping
4042
+ } = this;
4043
+ const ext = _.compact([
4044
+ // Toggle light/dark mode
4045
+ EditorView.baseTheme({}),
4046
+ // locale settings
4047
+ this.phrases ? EditorState.phrases.of(this.phrases) : undefined,
4048
+ // Parser language setting
4049
+ this.localLanguage,
4050
+ // Editable option
4051
+ EditorView.editable.of(!this.isReadonly),
4052
+ // Focus and blur listener
4053
+ EditorView.updateListener.of(viewUpdate => {
4054
+ if (viewUpdate.focusChanged) {
4055
+ viewUpdate.view.hasFocus ? this.$emit('focus') : this.$emit('blur', viewUpdate.state.doc.toString());
4056
+ }
4057
+ }), EditorView.domEventHandlers({
4058
+ drop(event) {
4059
+ if (!allowDrop) {
4060
+ event.preventDefault();
4061
+ return true;
4062
+ }
4063
+ },
4064
+ paste(event) {
4065
+ if (!allowPaste) {
4066
+ event.preventDefault();
4067
+ return true;
4068
+ }
4069
+ }
4070
+ }),
4071
+ // line wrapping
4072
+ lineWrapping ? EditorView.lineWrapping : undefined, keymap.of([indentWithTab])]);
4073
+ // Append Extensions (such as basic-setup)
4074
+ if (this.extensions.length !== 0) _.merge(ext, this.extensions);
4075
+ return ext;
4076
+ },
4077
+ isShowingError() {
4078
+ return !!this.error && this.isInvalid;
4079
+ },
4080
+ isShowingHint() {
4081
+ return !!this.hint && !this.isShowingError;
4082
+ },
4083
+ isShowingHeader() {
4084
+ var _a;
4085
+ return this.isShowingFullscreen || this.$slots.label || this.$slots.actions || ((_a = this.$scopedSlots) === null || _a === void 0 ? void 0 : _a.actions);
4086
+ }
4087
+ },
4088
+ watch: {
4089
+ modelValue(value) {
4090
+ if (this.editor.composing) return;
4091
+ if (this.editor.state.doc.toString() === value) return;
4092
+ const previous = this.editor.state.selection;
4093
+ this.editor.setState(EditorState.create({
4094
+ doc: value,
4095
+ extensions: this.localExtensions,
4096
+ selection: _.some(previous.ranges, range => range.to > value.length) ? {
4097
+ anchor: value.length
4098
+ } : previous
4099
+ }));
4100
+ },
4101
+ isFullscreen(value) {
4102
+ if (value) {
4103
+ this.fullscreenTarget.append(this.editor.dom);
4104
+ } else {
4105
+ this.target.append(this.editor.dom);
4106
+ }
4107
+ },
4108
+ localExtensions() {
4109
+ this.updateEditorState();
4110
+ }
4111
+ },
4112
+ mounted() {
4113
+ this.updateEditorState();
4114
+ this.target.append(this.editor.dom);
4115
+ },
4116
+ beforeUnmount() {
4117
+ var _a;
4118
+ (_a = this.editor) === null || _a === void 0 ? void 0 : _a.destroy();
4119
+ },
4120
+ methods: {
4121
+ updateEditorState() {
4122
+ this.editor.setState(EditorState.create({
4123
+ doc: this.modelValue,
4124
+ extensions: this.localExtensions
4125
+ }));
4126
+ },
4127
+ toggleFullscreen(value) {
4128
+ this.isFullscreen = value === undefined ? !this.isFullscreen : value;
4129
+ }
4130
+ }
4131
+ });
4132
+
4133
+ export { OrCodeLanguages as O, script as s };