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