@64mb/freelens-power 1.6.1 → 2.20.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 (526) hide show
  1. package/README.md +60 -35
  2. package/THIRD_PARTY_LICENSES +74 -0
  3. package/dist/ai-codex-api-CHt-EMIE.js +4403 -0
  4. package/dist/ai-codex-api-CHt-EMIE.js.map +1 -0
  5. package/dist/ai-codex-api.js +1 -0
  6. package/{out/main/dashboard-preload.js → dist/dashboard-preload.cjs} +6 -6
  7. package/dist/dashboard-preload.cjs.map +1 -0
  8. package/dist/main.js +14935 -0
  9. package/dist/main.js.map +1 -0
  10. package/dist/power-logs-D2eUB0f0.js +32 -0
  11. package/dist/power-logs-D2eUB0f0.js.map +1 -0
  12. package/{out/main → dist}/power-logs-child.js +13 -12
  13. package/dist/power-logs-child.js.map +1 -0
  14. package/dist/power-logs-database.js +384 -0
  15. package/dist/power-logs-database.js.map +1 -0
  16. package/{out/renderer/src/common/power-logs-limits.js → dist/power-logs-limits-CdzRcMHg.js} +7 -10
  17. package/{out/renderer/src/common/power-logs-limits.js.map → dist/power-logs-limits-CdzRcMHg.js.map} +1 -1
  18. package/dist/power-logs-query-child.js +22 -0
  19. package/dist/power-logs-query-child.js.map +1 -0
  20. package/{out/main → dist}/power-logs-query.js +17 -16
  21. package/dist/power-logs-query.js.map +1 -0
  22. package/dist/renderer.js +43781 -0
  23. package/dist/renderer.js.map +1 -0
  24. package/package.json +43 -31
  25. package/out/main/_virtual/_@oxc-project_runtime@0.137.0/helpers/esm/decorate.js +0 -9
  26. package/out/main/_virtual/_@oxc-project_runtime@0.137.0/helpers/esm/decorateMetadata.js +0 -6
  27. package/out/main/_virtual/_global-external_@freelensapp/extensions.js +0 -9
  28. package/out/main/_virtual/_global-external_mobx.js +0 -77
  29. package/out/main/ai-claude-policy.js +0 -141
  30. package/out/main/ai-claude-policy.js.map +0 -1
  31. package/out/main/ai-discovery.js +0 -61
  32. package/out/main/ai-discovery.js.map +0 -1
  33. package/out/main/ai-ipc.js +0 -144
  34. package/out/main/ai-ipc.js.map +0 -1
  35. package/out/main/ai-logs.js +0 -52
  36. package/out/main/ai-logs.js.map +0 -1
  37. package/out/main/ai-models.js +0 -82
  38. package/out/main/ai-models.js.map +0 -1
  39. package/out/main/ai-references.js +0 -20
  40. package/out/main/ai-references.js.map +0 -1
  41. package/out/main/ai-resources.js +0 -418
  42. package/out/main/ai-resources.js.map +0 -1
  43. package/out/main/ai.js +0 -527
  44. package/out/main/ai.js.map +0 -1
  45. package/out/main/cluster-icons-catalog.js +0 -28
  46. package/out/main/cluster-icons-catalog.js.map +0 -1
  47. package/out/main/cluster-icons.js +0 -125
  48. package/out/main/cluster-icons.js.map +0 -1
  49. package/out/main/common/ai-extras.js +0 -68
  50. package/out/main/common/ai-extras.js.map +0 -1
  51. package/out/main/common/ai-models.js +0 -6
  52. package/out/main/common/ai-models.js.map +0 -1
  53. package/out/main/common/ai-prompts.js +0 -16
  54. package/out/main/common/ai-prompts.js.map +0 -1
  55. package/out/main/common/ai-shortcuts.js +0 -69
  56. package/out/main/common/ai-shortcuts.js.map +0 -1
  57. package/out/main/common/ai-terminal-context.js +0 -51
  58. package/out/main/common/ai-terminal-context.js.map +0 -1
  59. package/out/main/common/ai.js +0 -12
  60. package/out/main/common/ai.js.map +0 -1
  61. package/out/main/common/cluster-icon-ipc.js +0 -6
  62. package/out/main/common/cluster-icon-ipc.js.map +0 -1
  63. package/out/main/common/cluster-icons.js +0 -121
  64. package/out/main/common/cluster-icons.js.map +0 -1
  65. package/out/main/common/dashboard-picker.js +0 -133
  66. package/out/main/common/dashboard-picker.js.map +0 -1
  67. package/out/main/common/dashboard-readiness.js +0 -58
  68. package/out/main/common/dashboard-readiness.js.map +0 -1
  69. package/out/main/common/dashboard-selector.js +0 -124
  70. package/out/main/common/dashboard-selector.js.map +0 -1
  71. package/out/main/common/dashboard-views.js +0 -12
  72. package/out/main/common/dashboard-views.js.map +0 -1
  73. package/out/main/common/dashboard.js +0 -39
  74. package/out/main/common/dashboard.js.map +0 -1
  75. package/out/main/common/extension-info.js +0 -8
  76. package/out/main/common/extension-info.js.map +0 -1
  77. package/out/main/common/monitoring-history.js +0 -52
  78. package/out/main/common/monitoring-history.js.map +0 -1
  79. package/out/main/common/power-logs-limits.js +0 -227
  80. package/out/main/common/power-logs-limits.js.map +0 -1
  81. package/out/main/common/power-logs.js +0 -32
  82. package/out/main/common/power-logs.js.map +0 -1
  83. package/out/main/common/resource-search.js +0 -61
  84. package/out/main/common/resource-search.js.map +0 -1
  85. package/out/main/common/settings-export.js +0 -83
  86. package/out/main/common/settings-export.js.map +0 -1
  87. package/out/main/common/store/ai-preferences-store.js +0 -101
  88. package/out/main/common/store/ai-preferences-store.js.map +0 -1
  89. package/out/main/common/store/ai-shortcuts-store.js +0 -40
  90. package/out/main/common/store/ai-shortcuts-store.js.map +0 -1
  91. package/out/main/common/store/appearance-preferences-store.js +0 -94
  92. package/out/main/common/store/appearance-preferences-store.js.map +0 -1
  93. package/out/main/common/store/cluster-icons-store.js +0 -32
  94. package/out/main/common/store/cluster-icons-store.js.map +0 -1
  95. package/out/main/common/store/dashboard-preferences-store.js +0 -56
  96. package/out/main/common/store/dashboard-preferences-store.js.map +0 -1
  97. package/out/main/common/store/logs-preferences-store.js +0 -45
  98. package/out/main/common/store/logs-preferences-store.js.map +0 -1
  99. package/out/main/common/store/monitoring-preferences-store.js +0 -69
  100. package/out/main/common/store/monitoring-preferences-store.js.map +0 -1
  101. package/out/main/common/store/node-shell-preferences-store.js +0 -40
  102. package/out/main/common/store/node-shell-preferences-store.js.map +0 -1
  103. package/out/main/common/store/power-preferences-store.js +0 -23
  104. package/out/main/common/store/power-preferences-store.js.map +0 -1
  105. package/out/main/common/store/read-only-preferences-store.js +0 -26
  106. package/out/main/common/store/read-only-preferences-store.js.map +0 -1
  107. package/out/main/dashboard-catalog.js +0 -29
  108. package/out/main/dashboard-catalog.js.map +0 -1
  109. package/out/main/dashboard-icon-cache.js +0 -63
  110. package/out/main/dashboard-icon-cache.js.map +0 -1
  111. package/out/main/dashboard-network.js +0 -104
  112. package/out/main/dashboard-network.js.map +0 -1
  113. package/out/main/dashboard-picker.js +0 -133
  114. package/out/main/dashboard-picker.js.map +0 -1
  115. package/out/main/dashboard-preload.js.map +0 -1
  116. package/out/main/dashboard-views.js +0 -810
  117. package/out/main/dashboard-views.js.map +0 -1
  118. package/out/main/diagnostics-menu-order.js +0 -57
  119. package/out/main/diagnostics-menu-order.js.map +0 -1
  120. package/out/main/dock-icon.js +0 -121
  121. package/out/main/dock-icon.js.map +0 -1
  122. package/out/main/index.js +0 -92
  123. package/out/main/index.js.map +0 -1
  124. package/out/main/monitoring-history-database.js +0 -103
  125. package/out/main/monitoring-history-database.js.map +0 -1
  126. package/out/main/monitoring-history-worker.js +0 -61
  127. package/out/main/monitoring-history-worker.js.map +0 -1
  128. package/out/main/monitoring-history.js +0 -110
  129. package/out/main/monitoring-history.js.map +0 -1
  130. package/out/main/power-logs-budget.js +0 -126
  131. package/out/main/power-logs-budget.js.map +0 -1
  132. package/out/main/power-logs-child.js.map +0 -1
  133. package/out/main/power-logs-database.js +0 -179
  134. package/out/main/power-logs-database.js.map +0 -1
  135. package/out/main/power-logs-ipc.js +0 -275
  136. package/out/main/power-logs-ipc.js.map +0 -1
  137. package/out/main/power-logs-query-child.js +0 -23
  138. package/out/main/power-logs-query-child.js.map +0 -1
  139. package/out/main/power-logs-query.js.map +0 -1
  140. package/out/main/power-logs-worker.js +0 -215
  141. package/out/main/power-logs-worker.js.map +0 -1
  142. package/out/main/resource-search-database.js +0 -209
  143. package/out/main/resource-search-database.js.map +0 -1
  144. package/out/main/resource-search-worker.js +0 -56
  145. package/out/main/resource-search-worker.js.map +0 -1
  146. package/out/main/resource-search.js +0 -155
  147. package/out/main/resource-search.js.map +0 -1
  148. package/out/main/settings-export.js +0 -68
  149. package/out/main/settings-export.js.map +0 -1
  150. package/out/main/settings-import.js +0 -89
  151. package/out/main/settings-import.js.map +0 -1
  152. package/out/main/splash-accent.js +0 -84
  153. package/out/main/splash-accent.js.map +0 -1
  154. package/out/renderer/_virtual/_@oxc-project_runtime@0.137.0/helpers/esm/decorate.js +0 -9
  155. package/out/renderer/_virtual/_@oxc-project_runtime@0.137.0/helpers/esm/decorateMetadata.js +0 -6
  156. package/out/renderer/_virtual/_global-external_@freelensapp/extensions.js +0 -9
  157. package/out/renderer/_virtual/_global-external_mobx-react.js +0 -20
  158. package/out/renderer/_virtual/_global-external_mobx.js +0 -78
  159. package/out/renderer/_virtual/_global-external_react/jsx-runtime.js +0 -10
  160. package/out/renderer/_virtual/_global-external_react-dom.js +0 -16
  161. package/out/renderer/_virtual/_global-external_react.js +0 -44
  162. package/out/renderer/_virtual/_rolldown/runtime.js +0 -35
  163. package/out/renderer/ai-copy-answer.js +0 -35
  164. package/out/renderer/ai-copy-answer.js.map +0 -1
  165. package/out/renderer/ai-diagnostic-handoff.js +0 -52
  166. package/out/renderer/ai-diagnostic-handoff.js.map +0 -1
  167. package/out/renderer/ai-extras.js +0 -155
  168. package/out/renderer/ai-extras.js.map +0 -1
  169. package/out/renderer/ai-icon.js +0 -20
  170. package/out/renderer/ai-icon.js.map +0 -1
  171. package/out/renderer/ai-logs-sql.js +0 -27
  172. package/out/renderer/ai-logs-sql.js.map +0 -1
  173. package/out/renderer/ai-message.js +0 -281
  174. package/out/renderer/ai-message.js.map +0 -1
  175. package/out/renderer/ai-provider-icon.js +0 -44
  176. package/out/renderer/ai-provider-icon.js.map +0 -1
  177. package/out/renderer/ai-resize.js +0 -87
  178. package/out/renderer/ai-resize.js.map +0 -1
  179. package/out/renderer/ai-shortcuts.js +0 -38
  180. package/out/renderer/ai-shortcuts.js.map +0 -1
  181. package/out/renderer/ai-terminal-context.js +0 -210
  182. package/out/renderer/ai-terminal-context.js.map +0 -1
  183. package/out/renderer/ai.js +0 -955
  184. package/out/renderer/ai.js.map +0 -1
  185. package/out/renderer/appearance.js +0 -41
  186. package/out/renderer/appearance.js.map +0 -1
  187. package/out/renderer/assets/claude.js +0 -6
  188. package/out/renderer/assets/claude.js.map +0 -1
  189. package/out/renderer/button-styles.js +0 -20
  190. package/out/renderer/button-styles.js.map +0 -1
  191. package/out/renderer/cluster-icon-colors.js +0 -188
  192. package/out/renderer/cluster-icon-colors.js.map +0 -1
  193. package/out/renderer/cluster-icons.js +0 -304
  194. package/out/renderer/cluster-icons.js.map +0 -1
  195. package/out/renderer/dashboard.js +0 -530
  196. package/out/renderer/dashboard.js.map +0 -1
  197. package/out/renderer/details/hpa-diagnostics-details.js +0 -46
  198. package/out/renderer/details/hpa-diagnostics-details.js.map +0 -1
  199. package/out/renderer/details/namespace-health-details.js +0 -91
  200. package/out/renderer/details/namespace-health-details.js.map +0 -1
  201. package/out/renderer/details/resource-health-details.js +0 -135
  202. package/out/renderer/details/resource-health-details.js.map +0 -1
  203. package/out/renderer/details/secret-certificate-details.js +0 -68
  204. package/out/renderer/details/secret-certificate-details.js.map +0 -1
  205. package/out/renderer/details/service-diagnostics-details.js +0 -163
  206. package/out/renderer/details/service-diagnostics-details.js.map +0 -1
  207. package/out/renderer/diagnostic-explain-button.js +0 -16
  208. package/out/renderer/diagnostic-explain-button.js.map +0 -1
  209. package/out/renderer/diagnostics-state.js +0 -53
  210. package/out/renderer/diagnostics-state.js.map +0 -1
  211. package/out/renderer/diagnostics.css.js +0 -48
  212. package/out/renderer/diagnostics.css.js.map +0 -1
  213. package/out/renderer/diagnostics.js +0 -1472
  214. package/out/renderer/diagnostics.js.map +0 -1
  215. package/out/renderer/gateway-relationships-client.js +0 -107
  216. package/out/renderer/gateway-relationships-client.js.map +0 -1
  217. package/out/renderer/incident-copy-button.js +0 -50
  218. package/out/renderer/incident-copy-button.js.map +0 -1
  219. package/out/renderer/index.js +0 -263
  220. package/out/renderer/index.js.map +0 -1
  221. package/out/renderer/menus/secure-node-shell-menu.js +0 -44
  222. package/out/renderer/menus/secure-node-shell-menu.js.map +0 -1
  223. package/out/renderer/monitoring-collector.js +0 -202
  224. package/out/renderer/monitoring-collector.js.map +0 -1
  225. package/out/renderer/monitoring-details-chart.js +0 -42
  226. package/out/renderer/monitoring-details-chart.js.map +0 -1
  227. package/out/renderer/monitoring-history-collection.js +0 -168
  228. package/out/renderer/monitoring-history-collection.js.map +0 -1
  229. package/out/renderer/monitoring-history-view.js +0 -227
  230. package/out/renderer/monitoring-history-view.js.map +0 -1
  231. package/out/renderer/monitoring-history.js +0 -19
  232. package/out/renderer/monitoring-history.js.map +0 -1
  233. package/out/renderer/monitoring.js +0 -858
  234. package/out/renderer/monitoring.js.map +0 -1
  235. package/out/renderer/node-monitoring.js +0 -127
  236. package/out/renderer/node-monitoring.js.map +0 -1
  237. package/out/renderer/node_modules/.pnpm/@babel_runtime@7.27.6/node_modules/@babel/runtime/helpers/esm/arrayLikeToArray.js +0 -10
  238. package/out/renderer/node_modules/.pnpm/@babel_runtime@7.27.6/node_modules/@babel/runtime/helpers/esm/arrayLikeToArray.js.map +0 -1
  239. package/out/renderer/node_modules/.pnpm/@babel_runtime@7.27.6/node_modules/@babel/runtime/helpers/esm/arrayWithHoles.js +0 -8
  240. package/out/renderer/node_modules/.pnpm/@babel_runtime@7.27.6/node_modules/@babel/runtime/helpers/esm/arrayWithHoles.js.map +0 -1
  241. package/out/renderer/node_modules/.pnpm/@babel_runtime@7.27.6/node_modules/@babel/runtime/helpers/esm/arrayWithoutHoles.js +0 -9
  242. package/out/renderer/node_modules/.pnpm/@babel_runtime@7.27.6/node_modules/@babel/runtime/helpers/esm/arrayWithoutHoles.js.map +0 -1
  243. package/out/renderer/node_modules/.pnpm/@babel_runtime@7.27.6/node_modules/@babel/runtime/helpers/esm/assertThisInitialized.js +0 -9
  244. package/out/renderer/node_modules/.pnpm/@babel_runtime@7.27.6/node_modules/@babel/runtime/helpers/esm/assertThisInitialized.js.map +0 -1
  245. package/out/renderer/node_modules/.pnpm/@babel_runtime@7.27.6/node_modules/@babel/runtime/helpers/esm/classCallCheck.js +0 -8
  246. package/out/renderer/node_modules/.pnpm/@babel_runtime@7.27.6/node_modules/@babel/runtime/helpers/esm/classCallCheck.js.map +0 -1
  247. package/out/renderer/node_modules/.pnpm/@babel_runtime@7.27.6/node_modules/@babel/runtime/helpers/esm/createClass.js +0 -15
  248. package/out/renderer/node_modules/.pnpm/@babel_runtime@7.27.6/node_modules/@babel/runtime/helpers/esm/createClass.js.map +0 -1
  249. package/out/renderer/node_modules/.pnpm/@babel_runtime@7.27.6/node_modules/@babel/runtime/helpers/esm/createSuper.js +0 -19
  250. package/out/renderer/node_modules/.pnpm/@babel_runtime@7.27.6/node_modules/@babel/runtime/helpers/esm/createSuper.js.map +0 -1
  251. package/out/renderer/node_modules/.pnpm/@babel_runtime@7.27.6/node_modules/@babel/runtime/helpers/esm/defineProperty.js +0 -14
  252. package/out/renderer/node_modules/.pnpm/@babel_runtime@7.27.6/node_modules/@babel/runtime/helpers/esm/defineProperty.js.map +0 -1
  253. package/out/renderer/node_modules/.pnpm/@babel_runtime@7.27.6/node_modules/@babel/runtime/helpers/esm/extends.js +0 -19
  254. package/out/renderer/node_modules/.pnpm/@babel_runtime@7.27.6/node_modules/@babel/runtime/helpers/esm/extends.js.map +0 -1
  255. package/out/renderer/node_modules/.pnpm/@babel_runtime@7.27.6/node_modules/@babel/runtime/helpers/esm/getPrototypeOf.js +0 -15
  256. package/out/renderer/node_modules/.pnpm/@babel_runtime@7.27.6/node_modules/@babel/runtime/helpers/esm/getPrototypeOf.js.map +0 -1
  257. package/out/renderer/node_modules/.pnpm/@babel_runtime@7.27.6/node_modules/@babel/runtime/helpers/esm/inherits.js +0 -14
  258. package/out/renderer/node_modules/.pnpm/@babel_runtime@7.27.6/node_modules/@babel/runtime/helpers/esm/inherits.js.map +0 -1
  259. package/out/renderer/node_modules/.pnpm/@babel_runtime@7.27.6/node_modules/@babel/runtime/helpers/esm/isNativeReflectConstruct.js +0 -18
  260. package/out/renderer/node_modules/.pnpm/@babel_runtime@7.27.6/node_modules/@babel/runtime/helpers/esm/isNativeReflectConstruct.js.map +0 -1
  261. package/out/renderer/node_modules/.pnpm/@babel_runtime@7.27.6/node_modules/@babel/runtime/helpers/esm/iterableToArray.js +0 -8
  262. package/out/renderer/node_modules/.pnpm/@babel_runtime@7.27.6/node_modules/@babel/runtime/helpers/esm/iterableToArray.js.map +0 -1
  263. package/out/renderer/node_modules/.pnpm/@babel_runtime@7.27.6/node_modules/@babel/runtime/helpers/esm/iterableToArrayLimit.js +0 -26
  264. package/out/renderer/node_modules/.pnpm/@babel_runtime@7.27.6/node_modules/@babel/runtime/helpers/esm/iterableToArrayLimit.js.map +0 -1
  265. package/out/renderer/node_modules/.pnpm/@babel_runtime@7.27.6/node_modules/@babel/runtime/helpers/esm/nonIterableRest.js +0 -8
  266. package/out/renderer/node_modules/.pnpm/@babel_runtime@7.27.6/node_modules/@babel/runtime/helpers/esm/nonIterableRest.js.map +0 -1
  267. package/out/renderer/node_modules/.pnpm/@babel_runtime@7.27.6/node_modules/@babel/runtime/helpers/esm/nonIterableSpread.js +0 -8
  268. package/out/renderer/node_modules/.pnpm/@babel_runtime@7.27.6/node_modules/@babel/runtime/helpers/esm/nonIterableSpread.js.map +0 -1
  269. package/out/renderer/node_modules/.pnpm/@babel_runtime@7.27.6/node_modules/@babel/runtime/helpers/esm/objectSpread2.js +0 -27
  270. package/out/renderer/node_modules/.pnpm/@babel_runtime@7.27.6/node_modules/@babel/runtime/helpers/esm/objectSpread2.js.map +0 -1
  271. package/out/renderer/node_modules/.pnpm/@babel_runtime@7.27.6/node_modules/@babel/runtime/helpers/esm/objectWithoutProperties.js +0 -15
  272. package/out/renderer/node_modules/.pnpm/@babel_runtime@7.27.6/node_modules/@babel/runtime/helpers/esm/objectWithoutProperties.js.map +0 -1
  273. package/out/renderer/node_modules/.pnpm/@babel_runtime@7.27.6/node_modules/@babel/runtime/helpers/esm/objectWithoutPropertiesLoose.js +0 -14
  274. package/out/renderer/node_modules/.pnpm/@babel_runtime@7.27.6/node_modules/@babel/runtime/helpers/esm/objectWithoutPropertiesLoose.js.map +0 -1
  275. package/out/renderer/node_modules/.pnpm/@babel_runtime@7.27.6/node_modules/@babel/runtime/helpers/esm/possibleConstructorReturn.js +0 -12
  276. package/out/renderer/node_modules/.pnpm/@babel_runtime@7.27.6/node_modules/@babel/runtime/helpers/esm/possibleConstructorReturn.js.map +0 -1
  277. package/out/renderer/node_modules/.pnpm/@babel_runtime@7.27.6/node_modules/@babel/runtime/helpers/esm/setPrototypeOf.js +0 -15
  278. package/out/renderer/node_modules/.pnpm/@babel_runtime@7.27.6/node_modules/@babel/runtime/helpers/esm/setPrototypeOf.js.map +0 -1
  279. package/out/renderer/node_modules/.pnpm/@babel_runtime@7.27.6/node_modules/@babel/runtime/helpers/esm/slicedToArray.js +0 -12
  280. package/out/renderer/node_modules/.pnpm/@babel_runtime@7.27.6/node_modules/@babel/runtime/helpers/esm/slicedToArray.js.map +0 -1
  281. package/out/renderer/node_modules/.pnpm/@babel_runtime@7.27.6/node_modules/@babel/runtime/helpers/esm/taggedTemplateLiteral.js +0 -8
  282. package/out/renderer/node_modules/.pnpm/@babel_runtime@7.27.6/node_modules/@babel/runtime/helpers/esm/taggedTemplateLiteral.js.map +0 -1
  283. package/out/renderer/node_modules/.pnpm/@babel_runtime@7.27.6/node_modules/@babel/runtime/helpers/esm/toConsumableArray.js +0 -12
  284. package/out/renderer/node_modules/.pnpm/@babel_runtime@7.27.6/node_modules/@babel/runtime/helpers/esm/toConsumableArray.js.map +0 -1
  285. package/out/renderer/node_modules/.pnpm/@babel_runtime@7.27.6/node_modules/@babel/runtime/helpers/esm/toPrimitive.js +0 -16
  286. package/out/renderer/node_modules/.pnpm/@babel_runtime@7.27.6/node_modules/@babel/runtime/helpers/esm/toPrimitive.js.map +0 -1
  287. package/out/renderer/node_modules/.pnpm/@babel_runtime@7.27.6/node_modules/@babel/runtime/helpers/esm/toPropertyKey.js +0 -11
  288. package/out/renderer/node_modules/.pnpm/@babel_runtime@7.27.6/node_modules/@babel/runtime/helpers/esm/toPropertyKey.js.map +0 -1
  289. package/out/renderer/node_modules/.pnpm/@babel_runtime@7.27.6/node_modules/@babel/runtime/helpers/esm/typeof.js +0 -18
  290. package/out/renderer/node_modules/.pnpm/@babel_runtime@7.27.6/node_modules/@babel/runtime/helpers/esm/typeof.js.map +0 -1
  291. package/out/renderer/node_modules/.pnpm/@babel_runtime@7.27.6/node_modules/@babel/runtime/helpers/esm/unsupportedIterableToArray.js +0 -13
  292. package/out/renderer/node_modules/.pnpm/@babel_runtime@7.27.6/node_modules/@babel/runtime/helpers/esm/unsupportedIterableToArray.js.map +0 -1
  293. package/out/renderer/node_modules/.pnpm/@emotion_cache@11.14.0/node_modules/@emotion/cache/dist/emotion-cache.browser.esm.js +0 -237
  294. package/out/renderer/node_modules/.pnpm/@emotion_cache@11.14.0/node_modules/@emotion/cache/dist/emotion-cache.browser.esm.js.map +0 -1
  295. package/out/renderer/node_modules/.pnpm/@emotion_hash@0.9.2/node_modules/@emotion/hash/dist/emotion-hash.esm.js +0 -25
  296. package/out/renderer/node_modules/.pnpm/@emotion_hash@0.9.2/node_modules/@emotion/hash/dist/emotion-hash.esm.js.map +0 -1
  297. package/out/renderer/node_modules/.pnpm/@emotion_memoize@0.9.0/node_modules/@emotion/memoize/dist/emotion-memoize.esm.js +0 -12
  298. package/out/renderer/node_modules/.pnpm/@emotion_memoize@0.9.0/node_modules/@emotion/memoize/dist/emotion-memoize.esm.js.map +0 -1
  299. package/out/renderer/node_modules/.pnpm/@emotion_react@11.14.0_@types_react@17.0.93_react@17.0.2/node_modules/@emotion/react/dist/emotion-element-f0de968e.browser.esm.js +0 -58
  300. package/out/renderer/node_modules/.pnpm/@emotion_react@11.14.0_@types_react@17.0.93_react@17.0.2/node_modules/@emotion/react/dist/emotion-element-f0de968e.browser.esm.js.map +0 -1
  301. package/out/renderer/node_modules/.pnpm/@emotion_react@11.14.0_@types_react@17.0.93_react@17.0.2/node_modules/@emotion/react/dist/emotion-react.browser.esm.js +0 -54
  302. package/out/renderer/node_modules/.pnpm/@emotion_react@11.14.0_@types_react@17.0.93_react@17.0.2/node_modules/@emotion/react/dist/emotion-react.browser.esm.js.map +0 -1
  303. package/out/renderer/node_modules/.pnpm/@emotion_serialize@1.3.3/node_modules/@emotion/serialize/dist/emotion-serialize.esm.js +0 -133
  304. package/out/renderer/node_modules/.pnpm/@emotion_serialize@1.3.3/node_modules/@emotion/serialize/dist/emotion-serialize.esm.js.map +0 -1
  305. package/out/renderer/node_modules/.pnpm/@emotion_sheet@1.4.0/node_modules/@emotion/sheet/dist/emotion-sheet.esm.js +0 -65
  306. package/out/renderer/node_modules/.pnpm/@emotion_sheet@1.4.0/node_modules/@emotion/sheet/dist/emotion-sheet.esm.js.map +0 -1
  307. package/out/renderer/node_modules/.pnpm/@emotion_unitless@0.10.0/node_modules/@emotion/unitless/dist/emotion-unitless.esm.js +0 -54
  308. package/out/renderer/node_modules/.pnpm/@emotion_unitless@0.10.0/node_modules/@emotion/unitless/dist/emotion-unitless.esm.js.map +0 -1
  309. package/out/renderer/node_modules/.pnpm/@emotion_use-insertion-effect-with-fallbacks@1.2.0_react@17.0.2/node_modules/@emotion/use-insertion-effect-with-fallbacks/dist/emotion-use-insertion-effect-with-fallbacks.browser.esm.js +0 -12
  310. package/out/renderer/node_modules/.pnpm/@emotion_use-insertion-effect-with-fallbacks@1.2.0_react@17.0.2/node_modules/@emotion/use-insertion-effect-with-fallbacks/dist/emotion-use-insertion-effect-with-fallbacks.browser.esm.js.map +0 -1
  311. package/out/renderer/node_modules/.pnpm/@emotion_utils@1.4.2/node_modules/@emotion/utils/dist/emotion-utils.browser.esm.js +0 -30
  312. package/out/renderer/node_modules/.pnpm/@emotion_utils@1.4.2/node_modules/@emotion/utils/dist/emotion-utils.browser.esm.js.map +0 -1
  313. package/out/renderer/node_modules/.pnpm/@floating-ui_dom@1.7.2/node_modules/@floating-ui/dom/dist/floating-ui.dom.js +0 -211
  314. package/out/renderer/node_modules/.pnpm/@floating-ui_dom@1.7.2/node_modules/@floating-ui/dom/dist/floating-ui.dom.js.map +0 -1
  315. package/out/renderer/node_modules/.pnpm/@floating-ui_utils@0.2.10/node_modules/@floating-ui/utils/dist/floating-ui.utils.dom.js +0 -97
  316. package/out/renderer/node_modules/.pnpm/@floating-ui_utils@0.2.10/node_modules/@floating-ui/utils/dist/floating-ui.utils.dom.js.map +0 -1
  317. package/out/renderer/node_modules/.pnpm/@floating-ui_utils@0.2.10/node_modules/@floating-ui/utils/dist/floating-ui.utils.js +0 -31
  318. package/out/renderer/node_modules/.pnpm/@floating-ui_utils@0.2.10/node_modules/@floating-ui/utils/dist/floating-ui.utils.js.map +0 -1
  319. package/out/renderer/node_modules/.pnpm/entities@8.0.0/node_modules/entities/dist/decode-codepoint.js +0 -45
  320. package/out/renderer/node_modules/.pnpm/entities@8.0.0/node_modules/entities/dist/decode-codepoint.js.map +0 -1
  321. package/out/renderer/node_modules/.pnpm/entities@8.0.0/node_modules/entities/dist/decode.js +0 -392
  322. package/out/renderer/node_modules/.pnpm/entities@8.0.0/node_modules/entities/dist/decode.js.map +0 -1
  323. package/out/renderer/node_modules/.pnpm/entities@8.0.0/node_modules/entities/dist/generated/decode-data-html.js +0 -7
  324. package/out/renderer/node_modules/.pnpm/entities@8.0.0/node_modules/entities/dist/generated/decode-data-html.js.map +0 -1
  325. package/out/renderer/node_modules/.pnpm/entities@8.0.0/node_modules/entities/dist/internal/bin-trie-flags.js +0 -27
  326. package/out/renderer/node_modules/.pnpm/entities@8.0.0/node_modules/entities/dist/internal/bin-trie-flags.js.map +0 -1
  327. package/out/renderer/node_modules/.pnpm/entities@8.0.0/node_modules/entities/dist/internal/decode-shared.js +0 -21
  328. package/out/renderer/node_modules/.pnpm/entities@8.0.0/node_modules/entities/dist/internal/decode-shared.js.map +0 -1
  329. package/out/renderer/node_modules/.pnpm/hoist-non-react-statics@3.3.2/node_modules/hoist-non-react-statics/dist/hoist-non-react-statics.cjs.js +0 -93
  330. package/out/renderer/node_modules/.pnpm/hoist-non-react-statics@3.3.2/node_modules/hoist-non-react-statics/dist/hoist-non-react-statics.cjs.js.map +0 -1
  331. package/out/renderer/node_modules/.pnpm/linkify-it@6.1.0/node_modules/linkify-it/build/index.js +0 -534
  332. package/out/renderer/node_modules/.pnpm/linkify-it@6.1.0/node_modules/linkify-it/build/index.js.map +0 -1
  333. package/out/renderer/node_modules/.pnpm/markdown-it@15.0.2/node_modules/markdown-it/dist/markdown-it.js +0 -3774
  334. package/out/renderer/node_modules/.pnpm/markdown-it@15.0.2/node_modules/markdown-it/dist/markdown-it.js.map +0 -1
  335. package/out/renderer/node_modules/.pnpm/mdurl@2.1.0/node_modules/mdurl/index.js +0 -25
  336. package/out/renderer/node_modules/.pnpm/mdurl@2.1.0/node_modules/mdurl/index.js.map +0 -1
  337. package/out/renderer/node_modules/.pnpm/mdurl@2.1.0/node_modules/mdurl/lib/decode.js +0 -74
  338. package/out/renderer/node_modules/.pnpm/mdurl@2.1.0/node_modules/mdurl/lib/decode.js.map +0 -1
  339. package/out/renderer/node_modules/.pnpm/mdurl@2.1.0/node_modules/mdurl/lib/encode.js +0 -57
  340. package/out/renderer/node_modules/.pnpm/mdurl@2.1.0/node_modules/mdurl/lib/encode.js.map +0 -1
  341. package/out/renderer/node_modules/.pnpm/mdurl@2.1.0/node_modules/mdurl/lib/format.js +0 -18
  342. package/out/renderer/node_modules/.pnpm/mdurl@2.1.0/node_modules/mdurl/lib/format.js.map +0 -1
  343. package/out/renderer/node_modules/.pnpm/mdurl@2.1.0/node_modules/mdurl/lib/parse.js +0 -175
  344. package/out/renderer/node_modules/.pnpm/mdurl@2.1.0/node_modules/mdurl/lib/parse.js.map +0 -1
  345. package/out/renderer/node_modules/.pnpm/memoize-one@6.0.0/node_modules/memoize-one/dist/memoize-one.esm.js +0 -38
  346. package/out/renderer/node_modules/.pnpm/memoize-one@6.0.0/node_modules/memoize-one/dist/memoize-one.esm.js.map +0 -1
  347. package/out/renderer/node_modules/.pnpm/punycode.js@2.3.1/node_modules/punycode.js/punycode.es6.js +0 -307
  348. package/out/renderer/node_modules/.pnpm/punycode.js@2.3.1/node_modules/punycode.js/punycode.es6.js.map +0 -1
  349. package/out/renderer/node_modules/.pnpm/react-is@16.13.1/node_modules/react-is/cjs/react-is.development.js +0 -159
  350. package/out/renderer/node_modules/.pnpm/react-is@16.13.1/node_modules/react-is/cjs/react-is.development.js.map +0 -1
  351. package/out/renderer/node_modules/.pnpm/react-is@16.13.1/node_modules/react-is/cjs/react-is.production.min.js +0 -103
  352. package/out/renderer/node_modules/.pnpm/react-is@16.13.1/node_modules/react-is/cjs/react-is.production.min.js.map +0 -1
  353. package/out/renderer/node_modules/.pnpm/react-is@16.13.1/node_modules/react-is/index.js +0 -18
  354. package/out/renderer/node_modules/.pnpm/react-is@16.13.1/node_modules/react-is/index.js.map +0 -1
  355. package/out/renderer/node_modules/.pnpm/react-select@5.10.2_@types_react@17.0.93_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/react-select/dist/Select-ef7c0426.esm.js +0 -2200
  356. package/out/renderer/node_modules/.pnpm/react-select@5.10.2_@types_react@17.0.93_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/react-select/dist/Select-ef7c0426.esm.js.map +0 -1
  357. package/out/renderer/node_modules/.pnpm/react-select@5.10.2_@types_react@17.0.93_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/react-select/dist/index-641ee5b8.esm.js +0 -992
  358. package/out/renderer/node_modules/.pnpm/react-select@5.10.2_@types_react@17.0.93_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/react-select/dist/index-641ee5b8.esm.js.map +0 -1
  359. package/out/renderer/node_modules/.pnpm/react-select@5.10.2_@types_react@17.0.93_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/react-select/dist/react-select.esm.js +0 -14
  360. package/out/renderer/node_modules/.pnpm/react-select@5.10.2_@types_react@17.0.93_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/react-select/dist/react-select.esm.js.map +0 -1
  361. package/out/renderer/node_modules/.pnpm/react-select@5.10.2_@types_react@17.0.93_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/react-select/dist/useStateManager-7e1e8489.esm.js +0 -56
  362. package/out/renderer/node_modules/.pnpm/react-select@5.10.2_@types_react@17.0.93_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/react-select/dist/useStateManager-7e1e8489.esm.js.map +0 -1
  363. package/out/renderer/node_modules/.pnpm/stylis@4.2.0/node_modules/stylis/src/Enum.js +0 -22
  364. package/out/renderer/node_modules/.pnpm/stylis@4.2.0/node_modules/stylis/src/Enum.js.map +0 -1
  365. package/out/renderer/node_modules/.pnpm/stylis@4.2.0/node_modules/stylis/src/Middleware.js +0 -30
  366. package/out/renderer/node_modules/.pnpm/stylis@4.2.0/node_modules/stylis/src/Middleware.js.map +0 -1
  367. package/out/renderer/node_modules/.pnpm/stylis@4.2.0/node_modules/stylis/src/Parser.js +0 -164
  368. package/out/renderer/node_modules/.pnpm/stylis@4.2.0/node_modules/stylis/src/Parser.js.map +0 -1
  369. package/out/renderer/node_modules/.pnpm/stylis@4.2.0/node_modules/stylis/src/Serializer.js +0 -37
  370. package/out/renderer/node_modules/.pnpm/stylis@4.2.0/node_modules/stylis/src/Serializer.js.map +0 -1
  371. package/out/renderer/node_modules/.pnpm/stylis@4.2.0/node_modules/stylis/src/Tokenizer.js +0 -245
  372. package/out/renderer/node_modules/.pnpm/stylis@4.2.0/node_modules/stylis/src/Tokenizer.js.map +0 -1
  373. package/out/renderer/node_modules/.pnpm/stylis@4.2.0/node_modules/stylis/src/Utility.js +0 -120
  374. package/out/renderer/node_modules/.pnpm/stylis@4.2.0/node_modules/stylis/src/Utility.js.map +0 -1
  375. package/out/renderer/node_modules/.pnpm/uc.micro@3.0.0/node_modules/uc.micro/build/index.js +0 -30
  376. package/out/renderer/node_modules/.pnpm/uc.micro@3.0.0/node_modules/uc.micro/build/index.js.map +0 -1
  377. package/out/renderer/node_modules/.pnpm/use-isomorphic-layout-effect@1.2.1_@types_react@17.0.93_react@17.0.2/node_modules/use-isomorphic-layout-effect/dist/use-isomorphic-layout-effect.browser.esm.js +0 -6
  378. package/out/renderer/node_modules/.pnpm/use-isomorphic-layout-effect@1.2.1_@types_react@17.0.93_react@17.0.2/node_modules/use-isomorphic-layout-effect/dist/use-isomorphic-layout-effect.browser.esm.js.map +0 -1
  379. package/out/renderer/pod-monitoring.js +0 -309
  380. package/out/renderer/pod-monitoring.js.map +0 -1
  381. package/out/renderer/power-log-json.js +0 -29
  382. package/out/renderer/power-log-json.js.map +0 -1
  383. package/out/renderer/power-logs-client.js +0 -35
  384. package/out/renderer/power-logs-client.js.map +0 -1
  385. package/out/renderer/power-logs-collector.js +0 -316
  386. package/out/renderer/power-logs-collector.js.map +0 -1
  387. package/out/renderer/power-logs-entrypoints.js +0 -201
  388. package/out/renderer/power-logs-entrypoints.js.map +0 -1
  389. package/out/renderer/power-logs-sql-row.js +0 -52
  390. package/out/renderer/power-logs-sql-row.js.map +0 -1
  391. package/out/renderer/power-logs-transport.js +0 -122
  392. package/out/renderer/power-logs-transport.js.map +0 -1
  393. package/out/renderer/power-logs.css.js +0 -117
  394. package/out/renderer/power-logs.css.js.map +0 -1
  395. package/out/renderer/power-logs.js +0 -1385
  396. package/out/renderer/power-logs.js.map +0 -1
  397. package/out/renderer/preferences/ai-preferences.js +0 -249
  398. package/out/renderer/preferences/ai-preferences.js.map +0 -1
  399. package/out/renderer/preferences/ai-shortcuts-preferences.js +0 -175
  400. package/out/renderer/preferences/ai-shortcuts-preferences.js.map +0 -1
  401. package/out/renderer/preferences/appearance-preferences.js +0 -97
  402. package/out/renderer/preferences/appearance-preferences.js.map +0 -1
  403. package/out/renderer/preferences/dashboard-preferences.js +0 -423
  404. package/out/renderer/preferences/dashboard-preferences.js.map +0 -1
  405. package/out/renderer/preferences/logs-preferences.js +0 -93
  406. package/out/renderer/preferences/logs-preferences.js.map +0 -1
  407. package/out/renderer/preferences/monitoring-preferences.js +0 -174
  408. package/out/renderer/preferences/monitoring-preferences.js.map +0 -1
  409. package/out/renderer/preferences/node-shell-preferences.js +0 -73
  410. package/out/renderer/preferences/node-shell-preferences.js.map +0 -1
  411. package/out/renderer/preferences/power-preferences.js +0 -22
  412. package/out/renderer/preferences/power-preferences.js.map +0 -1
  413. package/out/renderer/preferences/preferences.js +0 -263
  414. package/out/renderer/preferences/preferences.js.map +0 -1
  415. package/out/renderer/preferences/read-only-preferences.js +0 -23
  416. package/out/renderer/preferences/read-only-preferences.js.map +0 -1
  417. package/out/renderer/preferences/settings-export.js +0 -91
  418. package/out/renderer/preferences/settings-export.js.map +0 -1
  419. package/out/renderer/preferences/settings-icon-action.js +0 -23
  420. package/out/renderer/preferences/settings-icon-action.js.map +0 -1
  421. package/out/renderer/preferences/settings-modal.js +0 -82
  422. package/out/renderer/preferences/settings-modal.js.map +0 -1
  423. package/out/renderer/read-only.js +0 -103
  424. package/out/renderer/read-only.js.map +0 -1
  425. package/out/renderer/resource-relationships.css.js +0 -7
  426. package/out/renderer/resource-relationships.css.js.map +0 -1
  427. package/out/renderer/resource-relationships.js +0 -609
  428. package/out/renderer/resource-relationships.js.map +0 -1
  429. package/out/renderer/resource-search-client.js +0 -116
  430. package/out/renderer/resource-search-client.js.map +0 -1
  431. package/out/renderer/resource-search-discovery.js +0 -79
  432. package/out/renderer/resource-search-discovery.js.map +0 -1
  433. package/out/renderer/resource-search-distance.js +0 -24
  434. package/out/renderer/resource-search-distance.js.map +0 -1
  435. package/out/renderer/resource-search-fields.js +0 -55
  436. package/out/renderer/resource-search-fields.js.map +0 -1
  437. package/out/renderer/resource-search-model.js +0 -194
  438. package/out/renderer/resource-search-model.js.map +0 -1
  439. package/out/renderer/resource-search-routing.js +0 -78
  440. package/out/renderer/resource-search-routing.js.map +0 -1
  441. package/out/renderer/resource-search-sync.js +0 -199
  442. package/out/renderer/resource-search-sync.js.map +0 -1
  443. package/out/renderer/resource-search.js +0 -590
  444. package/out/renderer/resource-search.js.map +0 -1
  445. package/out/renderer/src/common/ai-extras.js +0 -68
  446. package/out/renderer/src/common/ai-extras.js.map +0 -1
  447. package/out/renderer/src/common/ai-models.js +0 -6
  448. package/out/renderer/src/common/ai-models.js.map +0 -1
  449. package/out/renderer/src/common/ai-prompts.js +0 -16
  450. package/out/renderer/src/common/ai-prompts.js.map +0 -1
  451. package/out/renderer/src/common/ai-shortcuts.js +0 -78
  452. package/out/renderer/src/common/ai-shortcuts.js.map +0 -1
  453. package/out/renderer/src/common/ai-terminal-context.js +0 -51
  454. package/out/renderer/src/common/ai-terminal-context.js.map +0 -1
  455. package/out/renderer/src/common/ai.js +0 -8
  456. package/out/renderer/src/common/ai.js.map +0 -1
  457. package/out/renderer/src/common/cluster-icon-ipc.js +0 -6
  458. package/out/renderer/src/common/cluster-icon-ipc.js.map +0 -1
  459. package/out/renderer/src/common/cluster-icons.js +0 -133
  460. package/out/renderer/src/common/cluster-icons.js.map +0 -1
  461. package/out/renderer/src/common/dashboard-picker.js +0 -6
  462. package/out/renderer/src/common/dashboard-picker.js.map +0 -1
  463. package/out/renderer/src/common/dashboard-selector.js +0 -9
  464. package/out/renderer/src/common/dashboard-selector.js.map +0 -1
  465. package/out/renderer/src/common/dashboard-views.js +0 -18
  466. package/out/renderer/src/common/dashboard-views.js.map +0 -1
  467. package/out/renderer/src/common/dashboard.js +0 -39
  468. package/out/renderer/src/common/dashboard.js.map +0 -1
  469. package/out/renderer/src/common/date-time.js +0 -11
  470. package/out/renderer/src/common/date-time.js.map +0 -1
  471. package/out/renderer/src/common/extension-info.js +0 -8
  472. package/out/renderer/src/common/extension-info.js.map +0 -1
  473. package/out/renderer/src/common/gateway-relationships.js +0 -122
  474. package/out/renderer/src/common/gateway-relationships.js.map +0 -1
  475. package/out/renderer/src/common/hpa-diagnostics.js +0 -24
  476. package/out/renderer/src/common/hpa-diagnostics.js.map +0 -1
  477. package/out/renderer/src/common/incident-summary.js +0 -73
  478. package/out/renderer/src/common/incident-summary.js.map +0 -1
  479. package/out/renderer/src/common/monitoring-history.js +0 -17
  480. package/out/renderer/src/common/monitoring-history.js.map +0 -1
  481. package/out/renderer/src/common/monitoring-math.js +0 -98
  482. package/out/renderer/src/common/monitoring-math.js.map +0 -1
  483. package/out/renderer/src/common/node-shell.js +0 -22
  484. package/out/renderer/src/common/node-shell.js.map +0 -1
  485. package/out/renderer/src/common/power-log-parser.js +0 -114
  486. package/out/renderer/src/common/power-log-parser.js.map +0 -1
  487. package/out/renderer/src/common/power-logs-ai.js +0 -56
  488. package/out/renderer/src/common/power-logs-ai.js.map +0 -1
  489. package/out/renderer/src/common/power-logs.js +0 -32
  490. package/out/renderer/src/common/power-logs.js.map +0 -1
  491. package/out/renderer/src/common/resource-diagnostics.js +0 -227
  492. package/out/renderer/src/common/resource-diagnostics.js.map +0 -1
  493. package/out/renderer/src/common/resource-health.js +0 -92
  494. package/out/renderer/src/common/resource-health.js.map +0 -1
  495. package/out/renderer/src/common/resource-relationships.js +0 -163
  496. package/out/renderer/src/common/resource-relationships.js.map +0 -1
  497. package/out/renderer/src/common/resource-search.js +0 -6
  498. package/out/renderer/src/common/resource-search.js.map +0 -1
  499. package/out/renderer/src/common/secret-certificates.js +0 -34
  500. package/out/renderer/src/common/secret-certificates.js.map +0 -1
  501. package/out/renderer/src/common/service-diagnostics.js +0 -50
  502. package/out/renderer/src/common/service-diagnostics.js.map +0 -1
  503. package/out/renderer/src/common/settings-export.js +0 -8
  504. package/out/renderer/src/common/settings-export.js.map +0 -1
  505. package/out/renderer/src/common/store/ai-preferences-store.js +0 -101
  506. package/out/renderer/src/common/store/ai-preferences-store.js.map +0 -1
  507. package/out/renderer/src/common/store/ai-shortcuts-store.js +0 -40
  508. package/out/renderer/src/common/store/ai-shortcuts-store.js.map +0 -1
  509. package/out/renderer/src/common/store/appearance-preferences-store.js +0 -94
  510. package/out/renderer/src/common/store/appearance-preferences-store.js.map +0 -1
  511. package/out/renderer/src/common/store/dashboard-preferences-store.js +0 -56
  512. package/out/renderer/src/common/store/dashboard-preferences-store.js.map +0 -1
  513. package/out/renderer/src/common/store/logs-preferences-store.js +0 -45
  514. package/out/renderer/src/common/store/logs-preferences-store.js.map +0 -1
  515. package/out/renderer/src/common/store/monitoring-preferences-store.js +0 -69
  516. package/out/renderer/src/common/store/monitoring-preferences-store.js.map +0 -1
  517. package/out/renderer/src/common/store/node-shell-preferences-store.js +0 -40
  518. package/out/renderer/src/common/store/node-shell-preferences-store.js.map +0 -1
  519. package/out/renderer/src/common/store/power-preferences-store.js +0 -23
  520. package/out/renderer/src/common/store/power-preferences-store.js.map +0 -1
  521. package/out/renderer/src/common/store/read-only-preferences-store.js +0 -26
  522. package/out/renderer/src/common/store/read-only-preferences-store.js.map +0 -1
  523. package/out/renderer/src/common/timeline-groups.js +0 -36
  524. package/out/renderer/src/common/timeline-groups.js.map +0 -1
  525. package/out/renderer/welcome.js +0 -120
  526. package/out/renderer/welcome.js.map +0 -1
@@ -1,3774 +0,0 @@
1
- const require_decode = require("../../../../mdurl@2.1.0/node_modules/mdurl/lib/decode.js");
2
- const require_encode = require("../../../../mdurl@2.1.0/node_modules/mdurl/lib/encode.js");
3
- const require_format = require("../../../../mdurl@2.1.0/node_modules/mdurl/lib/format.js");
4
- const require_parse = require("../../../../mdurl@2.1.0/node_modules/mdurl/lib/parse.js");
5
- const require_index = require("../../../../mdurl@2.1.0/node_modules/mdurl/index.js");
6
- const require_index$1 = require("../../../../uc.micro@3.0.0/node_modules/uc.micro/build/index.js");
7
- const require_decode$1 = require("../../../../entities@8.0.0/node_modules/entities/dist/decode.js");
8
- const require_index$2 = require("../../../../linkify-it@6.1.0/node_modules/linkify-it/build/index.js");
9
- const require_punycode_es6 = require("../../../../punycode.js@2.3.1/node_modules/punycode.js/punycode.es6.js");
10
- //#region node_modules/.pnpm/markdown-it@15.0.2/node_modules/markdown-it/dist/markdown-it.mjs
11
- /*! markdown-it 15.0.2 https://github.com/markdown-it/markdown-it @license MIT */
12
- var __defProp = Object.defineProperty;
13
- var __exportAll = (all, no_symbols) => {
14
- let target = {};
15
- for (var name in all) __defProp(target, name, {
16
- get: all[name],
17
- enumerable: true
18
- });
19
- if (!no_symbols) __defProp(target, Symbol.toStringTag, { value: "Module" });
20
- return target;
21
- };
22
- /**
23
- * Common utility functions exposed through `md.utils` for use by plugins.
24
- *
25
- * @module md.utils
26
- */
27
- var utils_exports = /* @__PURE__ */ __exportAll({
28
- arrayReplaceAt: () => arrayReplaceAt,
29
- asciiTrim: () => asciiTrim,
30
- callable: () => callable,
31
- escapeHtml: () => escapeHtml,
32
- escapeRE: () => escapeRE,
33
- fromCodePoint: () => fromCodePoint,
34
- isMdAsciiPunct: () => isMdAsciiPunct,
35
- isPunctChar: () => isPunctChar,
36
- isPunctCharCode: () => isPunctCharCode,
37
- isSpace: () => isSpace,
38
- isValidEntityCode: () => isValidEntityCode,
39
- isWhiteSpace: () => isWhiteSpace,
40
- lib: () => lib,
41
- normalizeReference: () => normalizeReference,
42
- unescapeAll: () => unescapeAll,
43
- unescapeMd: () => unescapeMd
44
- });
45
- function callable(cls) {
46
- const wrapper = function(...args) {
47
- return Reflect.construct(cls, args, new.target && new.target !== wrapper ? new.target : cls);
48
- };
49
- Object.defineProperty(wrapper, "name", { value: cls.name });
50
- Object.setPrototypeOf(wrapper, cls);
51
- wrapper.prototype = cls.prototype;
52
- return wrapper;
53
- }
54
- /**
55
- * Returns a copy of a token array with the token at `pos` replaced by
56
- * `newElements`. Used to transform token streams without modifying the
57
- * original array.
58
- */
59
- function arrayReplaceAt(src, pos, newElements) {
60
- return [].concat(src.slice(0, pos), newElements, src.slice(pos + 1));
61
- }
62
- /** Checks whether a code point can be decoded from a numeric HTML entity. */
63
- function isValidEntityCode(c) {
64
- if (c >= 55296 && c <= 57343) return false;
65
- if (c >= 64976 && c <= 65007) return false;
66
- if ((c & 65535) === 65535 || (c & 65535) === 65534) return false;
67
- if (c >= 0 && c <= 8) return false;
68
- if (c === 11) return false;
69
- if (c >= 14 && c <= 31) return false;
70
- if (c >= 127 && c <= 159) return false;
71
- if (c > 1114111) return false;
72
- return true;
73
- }
74
- /**
75
- * Converts a Unicode code point to a string, like `String.fromCodePoint()`,
76
- * but does not throw for invalid input.
77
- */
78
- function fromCodePoint(c) {
79
- if (c > 65535) {
80
- c -= 65536;
81
- const surrogate1 = 55296 + (c >> 10);
82
- const surrogate2 = 56320 + (c & 1023);
83
- return String.fromCharCode(surrogate1, surrogate2);
84
- }
85
- return String.fromCharCode(c);
86
- }
87
- var UNESCAPE_MD_RE = /\\([!"#$%&'()*+,\-./:;<=>?@[\\\]^_`{|}~])/g;
88
- var UNESCAPE_ALL_RE = new RegExp(`${UNESCAPE_MD_RE.source}|${/&([a-z#][a-z0-9]{1,31});/gi.source}`, "gi");
89
- var DIGITAL_ENTITY_TEST_RE = /^#((?:x[a-f0-9]{1,8}|[0-9]{1,8}))$/i;
90
- function replaceEntityPattern(match, name) {
91
- if (name.charCodeAt(0) === 35 && DIGITAL_ENTITY_TEST_RE.test(name)) {
92
- const code = name[1].toLowerCase() === "x" ? parseInt(name.slice(2), 16) : parseInt(name.slice(1), 10);
93
- if (isValidEntityCode(code)) return fromCodePoint(code);
94
- return match;
95
- }
96
- const decoded = require_decode$1.decodeHTMLStrict(match);
97
- if (decoded !== match) return decoded;
98
- return match;
99
- }
100
- /** Decodes Markdown backslash escapes. */
101
- function unescapeMd(str) {
102
- if (str.indexOf("\\") < 0) return str;
103
- return str.replace(UNESCAPE_MD_RE, "$1");
104
- }
105
- /**
106
- * Decodes Markdown backslash escapes and HTML character references in link
107
- * destinations, link titles, and fenced code info strings.
108
- */
109
- function unescapeAll(str) {
110
- if (str.indexOf("\\") < 0 && str.indexOf("&") < 0) return str;
111
- return str.replace(UNESCAPE_ALL_RE, function(match, escaped, entity) {
112
- if (escaped) return escaped;
113
- return replaceEntityPattern(match, entity);
114
- });
115
- }
116
- var HTML_ESCAPE_TEST_RE = /[&<>"]/;
117
- var HTML_ESCAPE_REPLACE_RE = /[&<>"]/g;
118
- var HTML_REPLACEMENTS = {
119
- "&": "&amp;",
120
- "<": "&lt;",
121
- ">": "&gt;",
122
- "\"": "&quot;"
123
- };
124
- function replaceUnsafeChar(ch) {
125
- return HTML_REPLACEMENTS[ch];
126
- }
127
- /** Escapes HTML special characters in a string. */
128
- function escapeHtml(str) {
129
- if (HTML_ESCAPE_TEST_RE.test(str)) return str.replace(HTML_ESCAPE_REPLACE_RE, replaceUnsafeChar);
130
- return str;
131
- }
132
- var REGEXP_ESCAPE_RE = /[.?*+^$[\]\\(){}|-]/g;
133
- /** Escapes regular expression metacharacters in a string. */
134
- function escapeRE(str) {
135
- return str.replace(REGEXP_ESCAPE_RE, "\\$&");
136
- }
137
- /** Checks whether a character code is an ASCII space or tab. */
138
- function isSpace(code) {
139
- switch (code) {
140
- case 9:
141
- case 32: return true;
142
- }
143
- return false;
144
- }
145
- /**
146
- * Checks whether a character code is whitespace recognized by Markdown.
147
- *
148
- * Matches the Unicode `Zs` category or `\t`, `\f`, `\v`, `\r`, `\n`.
149
- */
150
- function isWhiteSpace(code) {
151
- if (code >= 8192 && code <= 8202) return true;
152
- switch (code) {
153
- case 9:
154
- case 10:
155
- case 11:
156
- case 12:
157
- case 13:
158
- case 32:
159
- case 160:
160
- case 5760:
161
- case 8239:
162
- case 8287:
163
- case 12288: return true;
164
- }
165
- return false;
166
- }
167
- /**
168
- * Checks whether a character is Unicode punctuation or a symbol.
169
- *
170
- * Does not support astral characters.
171
- */
172
- function isPunctChar(ch) {
173
- return require_index$1.P.test(ch) || require_index$1.S.test(ch);
174
- }
175
- /** Checks whether a Unicode code point is punctuation or a symbol. */
176
- function isPunctCharCode(code) {
177
- return isPunctChar(fromCodePoint(code));
178
- }
179
- /**
180
- * Markdown ASCII punctuation characters.
181
- *
182
- * !, ", #, $, %, &, ', (, ), *, +, ,, -, ., /, :, ;, <, =, >, ?, @,
183
- * [, \, ], ^, _, `, {, |, }, or ~
184
- *
185
- * http://spec.commonmark.org/0.15/#ascii-punctuation-character
186
- *
187
- * Don't confuse with Unicode punctuation. It lacks some characters in the
188
- * ASCII range.
189
- */
190
- function isMdAsciiPunct(ch) {
191
- switch (ch) {
192
- case 33:
193
- case 34:
194
- case 35:
195
- case 36:
196
- case 37:
197
- case 38:
198
- case 39:
199
- case 40:
200
- case 41:
201
- case 42:
202
- case 43:
203
- case 44:
204
- case 45:
205
- case 46:
206
- case 47:
207
- case 58:
208
- case 59:
209
- case 60:
210
- case 61:
211
- case 62:
212
- case 63:
213
- case 64:
214
- case 91:
215
- case 92:
216
- case 93:
217
- case 94:
218
- case 95:
219
- case 96:
220
- case 123:
221
- case 124:
222
- case 125:
223
- case 126: return true;
224
- default: return false;
225
- }
226
- }
227
- /** Normalizes `[reference labels]` for case-insensitive lookup. */
228
- function normalizeReference(str) {
229
- str = str.trim().replace(/\s+/g, " ");
230
- return str.toLowerCase().toUpperCase();
231
- }
232
- function isAsciiTrimmable(c) {
233
- return c === 32 || c === 9 || c === 10 || c === 13;
234
- }
235
- /**
236
- * "Light" `.trim()` for blocks (headings, paragraphs), where Unicode spaces
237
- * should be preserved.
238
- */
239
- function asciiTrim(str) {
240
- let start = 0;
241
- for (; start < str.length; start++) if (!isAsciiTrimmable(str.charCodeAt(start))) break;
242
- let end = str.length - 1;
243
- for (; end >= start; end--) if (!isAsciiTrimmable(str.charCodeAt(end))) break;
244
- return str.slice(start, end + 1);
245
- }
246
- /**
247
- * Libraries commonly used by markdown-it and its plugins, re-exported to
248
- * reduce duplicate dependencies in browser bundles.
249
- */
250
- var lib = {
251
- mdurl: require_index.mdurl_exports,
252
- ucmicro: require_index$1.build_exports
253
- };
254
- /** Finds the end of a link or image label (`[label]`). */
255
- function parseLinkLabel(state, start, disableNested) {
256
- let level, found, marker, prevPos;
257
- const max = state.posMax;
258
- const oldPos = state.pos;
259
- state.pos = start + 1;
260
- level = 1;
261
- while (state.pos < max) {
262
- marker = state.src.charCodeAt(state.pos);
263
- if (marker === 93) {
264
- level--;
265
- if (level === 0) {
266
- found = true;
267
- break;
268
- }
269
- }
270
- prevPos = state.pos;
271
- state.md.inline.skipToken(state);
272
- if (marker === 91) {
273
- if (prevPos === state.pos - 1) level++;
274
- else if (disableNested) {
275
- state.pos = oldPos;
276
- return -1;
277
- }
278
- }
279
- }
280
- let labelEnd = -1;
281
- if (found) labelEnd = state.pos;
282
- state.pos = oldPos;
283
- return labelEnd;
284
- }
285
- /** Parses the destination in `[label](destination "title")`. */
286
- function parseLinkDestination(str, start, max) {
287
- let code;
288
- let pos = start;
289
- const result = {
290
- ok: false,
291
- pos: 0,
292
- str: ""
293
- };
294
- if (str.charCodeAt(pos) === 60) {
295
- pos++;
296
- while (pos < max) {
297
- code = str.charCodeAt(pos);
298
- if (code === 10) return result;
299
- if (code === 60) return result;
300
- if (code === 62) {
301
- result.pos = pos + 1;
302
- result.str = unescapeAll(str.slice(start + 1, pos));
303
- result.ok = true;
304
- return result;
305
- }
306
- if (code === 92 && pos + 1 < max) {
307
- pos += 2;
308
- continue;
309
- }
310
- pos++;
311
- }
312
- return result;
313
- }
314
- let level = 0;
315
- while (pos < max) {
316
- code = str.charCodeAt(pos);
317
- if (code === 32) break;
318
- if (code < 32 || code === 127) break;
319
- if (code === 92 && pos + 1 < max) {
320
- if (str.charCodeAt(pos + 1) === 32) {
321
- pos++;
322
- continue;
323
- }
324
- pos += 2;
325
- continue;
326
- }
327
- if (code === 40) {
328
- level++;
329
- if (level > 32) return result;
330
- }
331
- if (code === 41) {
332
- if (level === 0) break;
333
- level--;
334
- }
335
- pos++;
336
- }
337
- if (start === pos) return result;
338
- if (level !== 0) return result;
339
- result.str = unescapeAll(str.slice(start, pos));
340
- result.pos = pos;
341
- result.ok = true;
342
- return result;
343
- }
344
- /**
345
- * Parses the optional title in `[label](destination "title")` or
346
- * `[label]: destination "title"`.
347
- *
348
- * `prev_state` continues a reference title on the next source line.
349
- */
350
- function parseLinkTitle(str, start, max, prev_state) {
351
- let code;
352
- let pos = start;
353
- const state = {
354
- ok: false,
355
- can_continue: false,
356
- pos: 0,
357
- str: "",
358
- marker: 0
359
- };
360
- if (prev_state) {
361
- state.str = prev_state.str;
362
- state.marker = prev_state.marker;
363
- } else {
364
- if (pos >= max) return state;
365
- let marker = str.charCodeAt(pos);
366
- if (marker !== 34 && marker !== 39 && marker !== 40) return state;
367
- start++;
368
- pos++;
369
- if (marker === 40) marker = 41;
370
- state.marker = marker;
371
- }
372
- while (pos < max) {
373
- code = str.charCodeAt(pos);
374
- if (code === state.marker) {
375
- state.pos = pos + 1;
376
- state.str += unescapeAll(str.slice(start, pos));
377
- state.ok = true;
378
- return state;
379
- } else if (code === 40 && state.marker === 41) return state;
380
- else if (code === 92 && pos + 1 < max) pos++;
381
- pos++;
382
- }
383
- state.can_continue = true;
384
- state.str += unescapeAll(str.slice(start, pos));
385
- return state;
386
- }
387
- /**
388
- * Functions used to parse links and images, split out of parser rules because
389
- * of their size.
390
- *
391
- * @module md.helpers
392
- */
393
- var helpers_exports = /* @__PURE__ */ __exportAll({
394
- parseLinkDestination: () => parseLinkDestination,
395
- parseLinkLabel: () => parseLinkLabel,
396
- parseLinkTitle: () => parseLinkTitle
397
- });
398
- function _typeof(o) {
399
- "@babel/helpers - typeof";
400
- return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) {
401
- return typeof o;
402
- } : function(o) {
403
- return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
404
- }, _typeof(o);
405
- }
406
- function toPrimitive(t, r) {
407
- if ("object" != _typeof(t) || !t) return t;
408
- var e = t[Symbol.toPrimitive];
409
- if (void 0 !== e) {
410
- var i = e.call(t, r || "default");
411
- if ("object" != _typeof(i)) return i;
412
- throw new TypeError("@@toPrimitive must return a primitive value.");
413
- }
414
- return ("string" === r ? String : Number)(t);
415
- }
416
- function toPropertyKey(t) {
417
- var i = toPrimitive(t, "string");
418
- return "symbol" == _typeof(i) ? i : i + "";
419
- }
420
- function _defineProperty(e, r, t) {
421
- return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
422
- value: t,
423
- enumerable: !0,
424
- configurable: !0,
425
- writable: !0
426
- }) : e[r] = t, e;
427
- }
428
- /**
429
- * Represents one item in the parsed token stream, storing parsed data and
430
- * providing helpers for managing HTML attributes.
431
- */
432
- var Token = class {
433
- constructor(type, tag, nesting) {
434
- _defineProperty(
435
- this,
436
- /**
437
- * Source map info. Format: `[ line_begin, line_end ]`
438
- */
439
- "map",
440
- null
441
- );
442
- _defineProperty(
443
- this,
444
- /**
445
- * nesting level, the same as `state.level`
446
- */
447
- "level",
448
- 0
449
- );
450
- _defineProperty(
451
- this,
452
- /**
453
- * An array of child nodes (inline and img tokens)
454
- */
455
- "children",
456
- null
457
- );
458
- _defineProperty(
459
- this,
460
- /**
461
- * In a case of self-closing tag (code, html, fence, etc.),
462
- * it has contents of this tag.
463
- */
464
- "content",
465
- ""
466
- );
467
- _defineProperty(
468
- this,
469
- /**
470
- * '*' or '_' for emphasis, fence string for fence, etc.
471
- */
472
- "markup",
473
- ""
474
- );
475
- _defineProperty(
476
- this,
477
- /**
478
- * Additional information:
479
- *
480
- * - Info string for "fence" tokens
481
- * - The value "auto" for autolink "link_open" and "link_close" tokens
482
- * - The string value of the item marker for ordered-list "list_item_open" tokens
483
- */
484
- "info",
485
- ""
486
- );
487
- _defineProperty(
488
- this,
489
- /**
490
- * True for block-level tokens, false for inline tokens.
491
- * Used in renderer to calculate line breaks
492
- */
493
- "block",
494
- false
495
- );
496
- _defineProperty(
497
- this,
498
- /**
499
- * If it's true, ignore this element when rendering. Used for tight lists
500
- * to hide paragraphs.
501
- */
502
- "hidden",
503
- false
504
- );
505
- this.type = type;
506
- this.tag = tag;
507
- this.attrs = null;
508
- this.nesting = nesting;
509
- this.meta = null;
510
- }
511
- /**
512
- * Search attribute index by name.
513
- */
514
- attrIndex(name) {
515
- if (!this.attrs) return -1;
516
- const attrs = this.attrs;
517
- for (let i = 0, len = attrs.length; i < len; i++) if (attrs[i][0] === name) return i;
518
- return -1;
519
- }
520
- /**
521
- * Add `[ name, value ]` attribute to list. Init attrs if necessary
522
- */
523
- attrPush(attrData) {
524
- if (this.attrs) this.attrs.push(attrData);
525
- else this.attrs = [attrData];
526
- }
527
- /**
528
- * Set `name` attribute to `value`. Override old value if exists.
529
- */
530
- attrSet(name, value) {
531
- const idx = this.attrIndex(name);
532
- const attrData = [name, value];
533
- if (idx < 0) this.attrPush(attrData);
534
- else this.attrs[idx] = attrData;
535
- }
536
- /**
537
- * Get the value of attribute `name`, or null if it does not exist.
538
- */
539
- attrGet(name) {
540
- const idx = this.attrIndex(name);
541
- let value = null;
542
- if (idx >= 0) value = this.attrs[idx][1];
543
- return value;
544
- }
545
- /**
546
- * Join value to existing attribute via space. Or create new attribute if not
547
- * exists. Useful to operate with token classes.
548
- */
549
- attrJoin(name, value) {
550
- const idx = this.attrIndex(name);
551
- if (idx < 0) this.attrPush([name, value]);
552
- else this.attrs[idx][1] = `${this.attrs[idx][1]} ${value}`;
553
- }
554
- };
555
- /**
556
- * Helper class, used by {@link MarkdownIt.core}, {@link MarkdownIt.block} and
557
- * {@link MarkdownIt.inline} to manage sequences of functions (rules):
558
- *
559
- * - keep rules in defined order
560
- * - assign the name to each rule
561
- * - enable/disable rules
562
- * - add/replace rules
563
- * - allow assign rules to additional named chains (in the same)
564
- * - cacheing lists of active rules
565
- *
566
- * You will not need use this class directly until write plugins. For simple
567
- * rules control use {@link MarkdownIt.disable}, {@link MarkdownIt.enable} and
568
- * {@link MarkdownIt.use}.
569
- */
570
- var Ruler = class {
571
- constructor() {
572
- _defineProperty(
573
- this,
574
- /** @internal */
575
- "__rules__",
576
- []
577
- );
578
- _defineProperty(
579
- this,
580
- /** @internal */
581
- "__cache__",
582
- null
583
- );
584
- }
585
- /** @internal */
586
- __find__(name) {
587
- for (let i = 0; i < this.__rules__.length; i++) if (this.__rules__[i].name === name) return i;
588
- return -1;
589
- }
590
- /** @internal */
591
- __compile__() {
592
- const chains = /* @__PURE__ */ new Set();
593
- this.__rules__.forEach((rule) => {
594
- if (!rule.enabled) return;
595
- rule.alt.forEach((altName) => {
596
- if (altName) chains.add(altName);
597
- });
598
- });
599
- this.__cache__ = Object.create(null);
600
- this.__cache__[""] = [];
601
- this.__rules__.forEach((rule) => {
602
- if (rule.enabled) this.__cache__[""].push(rule.fn);
603
- });
604
- chains.forEach((chain) => {
605
- this.__cache__[chain] = [];
606
- this.__rules__.forEach((rule) => {
607
- if (rule.enabled && rule.alt.indexOf(chain) >= 0) this.__cache__[chain].push(rule.fn);
608
- });
609
- });
610
- }
611
- /**
612
- * Replace rule by name with new function & options. Throws error if name not
613
- * found.
614
- *
615
- * @example Replace existing typographer replacement rule with new one
616
- * ```javascript
617
- * import MarkdownIt from 'markdown-it'
618
- * const md = new MarkdownIt()
619
- *
620
- * md.core.ruler.at('replacements', function replace(state) {
621
- * //...
622
- * });
623
- * ```
624
- */
625
- at(name, fn, options = {}) {
626
- const index = this.__find__(name);
627
- if (index === -1) throw new Error(`Parser rule not found: ${name}`);
628
- this.__rules__[index].fn = fn;
629
- this.__rules__[index].alt = options.alt || [];
630
- this.__cache__ = null;
631
- }
632
- /**
633
- * Add new rule to chain before one with given name. See also
634
- * {@link Ruler.after}, {@link Ruler.push}.
635
- *
636
- * @example
637
- * ```javascript
638
- * import MarkdownIt from 'markdown-it'
639
- * const md = new MarkdownIt()
640
- *
641
- * md.block.ruler.before('paragraph', 'my_rule', function replace(state) {
642
- * //...
643
- * });
644
- * ```
645
- */
646
- before(beforeName, ruleName, fn, options = {}) {
647
- const index = this.__find__(beforeName);
648
- if (index === -1) throw new Error(`Parser rule not found: ${beforeName}`);
649
- this.__rules__.splice(index, 0, {
650
- name: ruleName,
651
- enabled: true,
652
- fn,
653
- alt: options.alt || []
654
- });
655
- this.__cache__ = null;
656
- }
657
- /**
658
- * Add new rule to chain after one with given name. See also
659
- * {@link Ruler.before}, {@link Ruler.push}.
660
- *
661
- * @example
662
- * ```javascript
663
- * import MarkdownIt from 'markdown-it'
664
- * const md = new MarkdownIt()
665
- *
666
- * md.inline.ruler.after('text', 'my_rule', function replace(state) {
667
- * //...
668
- * });
669
- * ```
670
- */
671
- after(afterName, ruleName, fn, options = {}) {
672
- const index = this.__find__(afterName);
673
- if (index === -1) throw new Error(`Parser rule not found: ${afterName}`);
674
- this.__rules__.splice(index + 1, 0, {
675
- name: ruleName,
676
- enabled: true,
677
- fn,
678
- alt: options.alt || []
679
- });
680
- this.__cache__ = null;
681
- }
682
- /**
683
- * Push new rule to the end of chain. See also
684
- * {@link Ruler.before}, {@link Ruler.after}.
685
- *
686
- * @example
687
- * ```javascript
688
- * import MarkdownIt from 'markdown-it'
689
- * const md = new MarkdownIt()
690
- *
691
- * md.core.ruler.push('my_rule', function replace(state) {
692
- * //...
693
- * });
694
- * ```
695
- */
696
- push(ruleName, fn, options = {}) {
697
- this.__rules__.push({
698
- name: ruleName,
699
- enabled: true,
700
- fn,
701
- alt: options.alt || []
702
- });
703
- this.__cache__ = null;
704
- }
705
- /**
706
- * Enable rules with given names. If any rule name not found - throw Error.
707
- * Errors can be disabled by second param.
708
- *
709
- * See also {@link Ruler.disable}, {@link Ruler.enableOnly}.
710
- *
711
- * Returns list of found rule names (if no exception happened).
712
- */
713
- enable(list, ignoreInvalid = false) {
714
- if (!Array.isArray(list)) list = [list];
715
- const result = [];
716
- list.forEach((name) => {
717
- const idx = this.__find__(name);
718
- if (idx < 0) {
719
- if (ignoreInvalid) return;
720
- throw new Error(`Rules manager: invalid rule name ${name}`);
721
- }
722
- this.__rules__[idx].enabled = true;
723
- result.push(name);
724
- });
725
- this.__cache__ = null;
726
- return result;
727
- }
728
- /**
729
- * Enable rules with given names, and disable everything else. If any rule name
730
- * not found - throw Error. Errors can be disabled by second param.
731
- *
732
- * See also {@link Ruler.disable}, {@link Ruler.enable}.
733
- */
734
- enableOnly(list, ignoreInvalid = false) {
735
- if (!Array.isArray(list)) list = [list];
736
- this.__rules__.forEach((rule) => {
737
- rule.enabled = false;
738
- });
739
- this.enable(list, ignoreInvalid);
740
- }
741
- /**
742
- * Disable rules with given names. If any rule name not found - throw Error.
743
- * Errors can be disabled by second param.
744
- *
745
- * See also {@link Ruler.enable}, {@link Ruler.enableOnly}.
746
- *
747
- * Returns list of found rule names (if no exception happened).
748
- */
749
- disable(list, ignoreInvalid = false) {
750
- if (!Array.isArray(list)) list = [list];
751
- const result = [];
752
- list.forEach((name) => {
753
- const idx = this.__find__(name);
754
- if (idx < 0) {
755
- if (ignoreInvalid) return;
756
- throw new Error(`Rules manager: invalid rule name ${name}`);
757
- }
758
- this.__rules__[idx].enabled = false;
759
- result.push(name);
760
- });
761
- this.__cache__ = null;
762
- return result;
763
- }
764
- /**
765
- * Return array of active functions (rules) for given chain name. It analyzes
766
- * rules configuration, compiles caches if not exists and returns result.
767
- *
768
- * Default chain name is `''` (empty string). It can't be skipped. That's
769
- * done intentionally, to keep signature monomorphic for high speed.
770
- */
771
- getRules(chainName) {
772
- if (!this.__cache__) this.__compile__();
773
- return this.__cache__[chainName] || [];
774
- }
775
- };
776
- var default_rules = {};
777
- default_rules.code_inline = function(tokens, idx, options, env, slf) {
778
- const token = tokens[idx];
779
- return `<code${slf.renderAttrs(token)}>${escapeHtml(token.content)}</code>`;
780
- };
781
- default_rules.code_block = function(tokens, idx, options, env, slf) {
782
- const token = tokens[idx];
783
- return `<pre${slf.renderAttrs(token)}><code>${escapeHtml(tokens[idx].content)}</code></pre>\n`;
784
- };
785
- default_rules.fence = function(tokens, idx, options, env, slf) {
786
- const token = tokens[idx];
787
- const info = token.info ? unescapeAll(token.info).trim() : "";
788
- let langName = "";
789
- let langAttrs = "";
790
- if (info) {
791
- const arr = info.split(/(\s+)/g);
792
- langName = arr[0];
793
- langAttrs = arr.slice(2).join("");
794
- }
795
- let highlighted;
796
- if (options.highlight) highlighted = options.highlight(token.content, langName, langAttrs) || escapeHtml(token.content);
797
- else highlighted = escapeHtml(token.content);
798
- if (highlighted.indexOf("<pre") === 0) return highlighted + "\n";
799
- if (info) {
800
- const i = token.attrIndex("class");
801
- const tmpAttrs = token.attrs ? token.attrs.slice() : [];
802
- if (i < 0) tmpAttrs.push(["class", `${options.langPrefix}${langName}`]);
803
- else {
804
- tmpAttrs[i] = [tmpAttrs[i][0], tmpAttrs[i][1]];
805
- tmpAttrs[i][1] += ` ${options.langPrefix}${langName}`;
806
- }
807
- const tmpToken = { attrs: tmpAttrs };
808
- return `<pre><code${slf.renderAttrs(tmpToken)}>${highlighted}</code></pre>\n`;
809
- }
810
- return `<pre><code${slf.renderAttrs(token)}>${highlighted}</code></pre>\n`;
811
- };
812
- default_rules.image = function(tokens, idx, options, env, slf) {
813
- const token = tokens[idx];
814
- token.attrs[token.attrIndex("alt")][1] = slf.renderInlineAsText(token.children, options, env);
815
- return slf.renderToken(tokens, idx, options);
816
- };
817
- default_rules.hardbreak = function(tokens, idx, options) {
818
- return options.xhtmlOut ? "<br />\n" : "<br>\n";
819
- };
820
- default_rules.softbreak = function(tokens, idx, options) {
821
- return options.breaks ? options.xhtmlOut ? "<br />\n" : "<br>\n" : "\n";
822
- };
823
- default_rules.text = function(tokens, idx) {
824
- return escapeHtml(tokens[idx].content);
825
- };
826
- default_rules.html_block = function(tokens, idx) {
827
- return tokens[idx].content;
828
- };
829
- default_rules.html_inline = function(tokens, idx) {
830
- return tokens[idx].content;
831
- };
832
- /**
833
- * Generates HTML from parsed token stream. Each instance has independent
834
- * copy of rules. Those can be rewritten with ease. Also, you can add new
835
- * rules if you create plugin and adds new token types.
836
- *
837
- * Creates new renderer instance and fills {@link Renderer.rules} with defaults.
838
- */
839
- var Renderer = class {
840
- constructor() {
841
- _defineProperty(
842
- this,
843
- /**
844
- * Contains render rules for tokens. Can be updated and extended.
845
- *
846
- * See [source code](https://github.com/markdown-it/markdown-it/blob/master/src/renderer.ts)
847
- * for more details and examples.
848
- *
849
- * @example Custom render rules
850
- * ```javascript
851
- * import MarkdownIt from 'markdown-it'
852
- * const md = new MarkdownIt()
853
- *
854
- * md.renderer.rules.strong_open = function () { return '<b>'; };
855
- * md.renderer.rules.strong_close = function () { return '</b>'; };
856
- *
857
- * const result = md.renderInline(...);
858
- * ```
859
- *
860
- * @example Each rule is called as independent static function with fixed signature
861
- * ```javascript
862
- * function my_token_render(tokens, idx, options, env, renderer) {
863
- * // ...
864
- * return renderedHTML;
865
- * }
866
- * ```
867
- */
868
- "rules",
869
- Object.assign({}, default_rules)
870
- );
871
- }
872
- /**
873
- * Render token attributes to string.
874
- */
875
- renderAttrs(token) {
876
- let i, l, result;
877
- if (!token.attrs) return "";
878
- result = "";
879
- for (i = 0, l = token.attrs.length; i < l; i++) result += ` ${escapeHtml(token.attrs[i][0])}="${escapeHtml(String(token.attrs[i][1]))}"`;
880
- return result;
881
- }
882
- /**
883
- * Default token renderer. Can be overriden by custom function
884
- * in {@link Renderer.rules}.
885
- */
886
- renderToken(tokens, idx, options) {
887
- const token = tokens[idx];
888
- let result = "";
889
- if (token.hidden) return "";
890
- let prev = idx - 1;
891
- while (prev >= 0 && tokens[prev].hidden && tokens[prev].nesting === 0) prev--;
892
- if (token.block && token.nesting !== -1 && prev >= 0 && tokens[prev].hidden && tokens[prev].nesting === -1) result += "\n";
893
- result += (token.nesting === -1 ? "</" : "<") + token.tag;
894
- result += this.renderAttrs(token);
895
- if (token.nesting === 0 && options.xhtmlOut) result += " /";
896
- let needLf = false;
897
- if (token.block) {
898
- needLf = true;
899
- if (token.nesting === 1) {
900
- let next = idx + 1;
901
- while (next < tokens.length && tokens[next].hidden && tokens[next].nesting === 0) next++;
902
- if (next < tokens.length) {
903
- const nextToken = tokens[next];
904
- if (nextToken.type === "inline" || nextToken.hidden) needLf = false;
905
- else if (nextToken.nesting === -1 && nextToken.tag === token.tag) needLf = false;
906
- }
907
- }
908
- }
909
- result += needLf ? ">\n" : ">";
910
- return result;
911
- }
912
- /**
913
- * The same as {@link Renderer.render}, but for single token of `inline` type.
914
- */
915
- renderInline(tokens, options, env) {
916
- let result = "";
917
- const rules = this.rules;
918
- for (let i = 0, len = tokens.length; i < len; i++) {
919
- const type = tokens[i].type;
920
- if (typeof rules[type] !== "undefined") result += rules[type](tokens, i, options, env, this);
921
- else result += this.renderToken(tokens, i, options);
922
- }
923
- return result;
924
- }
925
- /**
926
- * Special kludge for image `alt` attributes to conform CommonMark spec.
927
- * Don't try to use it! Spec requires to show `alt` content with stripped markup,
928
- * instead of simple escaping.
929
- */
930
- renderInlineAsText(tokens, options, env) {
931
- let result = "";
932
- for (let i = 0, len = tokens.length; i < len; i++) switch (tokens[i].type) {
933
- case "text":
934
- case "code_inline":
935
- result += tokens[i].content;
936
- break;
937
- case "image":
938
- result += this.renderInlineAsText(tokens[i].children, options, env);
939
- break;
940
- case "html_inline":
941
- case "html_block":
942
- result += tokens[i].content;
943
- break;
944
- case "softbreak":
945
- case "hardbreak": result += "\n";
946
- }
947
- return result;
948
- }
949
- /**
950
- * Takes token stream and generates HTML. Probably, you will never need to call
951
- * this method directly.
952
- */
953
- render(tokens, options, env) {
954
- let result = "";
955
- const rules = this.rules;
956
- for (let i = 0, len = tokens.length; i < len; i++) {
957
- const type = tokens[i].type;
958
- if (type === "inline") result += this.renderInline(tokens[i].children, options, env);
959
- else if (typeof rules[type] !== "undefined") result += rules[type](tokens, i, options, env, this);
960
- else result += this.renderToken(tokens, i, options);
961
- }
962
- return result;
963
- }
964
- };
965
- /** Mutable state passed through the core rules chain. */
966
- var StateCore = class {
967
- constructor(src, md, env) {
968
- _defineProperty(this, "tokens", []);
969
- _defineProperty(this, "inlineMode", false);
970
- _defineProperty(this, "Token", Token);
971
- this.src = src;
972
- this.env = env;
973
- this.md = md;
974
- }
975
- };
976
- var UNNORMALIZED_NEWLINE_RE = /\r\n?/g;
977
- var NULL_RE = /\0/g;
978
- function normalize(state) {
979
- let str;
980
- str = state.src.replace(UNNORMALIZED_NEWLINE_RE, "\n");
981
- str = str.replace(NULL_RE, "�");
982
- state.src = str;
983
- }
984
- function block(state) {
985
- let token;
986
- if (state.inlineMode) {
987
- token = new state.Token("inline", "", 0);
988
- token.content = state.src;
989
- token.map = [0, 1];
990
- token.children = [];
991
- state.tokens.push(token);
992
- } else state.md.block.parse(state.src, state.md, state.env, state.tokens);
993
- }
994
- function strip_references(state) {
995
- const tokens = state.tokens;
996
- let last = 0;
997
- for (let curr = 0; curr < tokens.length; curr++) {
998
- if (tokens[curr].type === "reference_definition") continue;
999
- if (curr !== last) tokens[last] = tokens[curr];
1000
- last++;
1001
- }
1002
- if (tokens.length !== last) tokens.length = last;
1003
- }
1004
- function inline(state) {
1005
- const tokens = state.tokens;
1006
- for (let i = 0, l = tokens.length; i < l; i++) {
1007
- const tok = tokens[i];
1008
- if (tok.type === "inline") state.md.inline.parse(tok.content, state.md, state.env, tok.children);
1009
- }
1010
- }
1011
- function isLinkOpen$1(str) {
1012
- return /^<a[>\s]/i.test(str);
1013
- }
1014
- function isLinkClose$1(str) {
1015
- return /^<\/a\s*>/i.test(str);
1016
- }
1017
- function linkify$1(state) {
1018
- const blockTokens = state.tokens;
1019
- if (!state.md.options.linkify) return;
1020
- for (let j = 0, l = blockTokens.length; j < l; j++) {
1021
- if (blockTokens[j].type !== "inline" || !state.md.linkify.test(blockTokens[j].content)) continue;
1022
- const tokens = blockTokens[j].children;
1023
- const replacements = [];
1024
- let htmlLinkLevel = 0;
1025
- for (let i = tokens.length - 1; i >= 0; i--) {
1026
- const currentToken = tokens[i];
1027
- if (currentToken.type === "link_close") {
1028
- i--;
1029
- while (tokens[i].level !== currentToken.level && tokens[i].type !== "link_open") i--;
1030
- continue;
1031
- }
1032
- if (currentToken.type === "html_inline") {
1033
- if (isLinkOpen$1(currentToken.content) && htmlLinkLevel > 0) htmlLinkLevel--;
1034
- if (isLinkClose$1(currentToken.content)) htmlLinkLevel++;
1035
- }
1036
- if (htmlLinkLevel > 0) continue;
1037
- if (currentToken.type === "text" && state.md.linkify.test(currentToken.content)) {
1038
- const text = currentToken.content;
1039
- let links = state.md.linkify.match(text);
1040
- const nodes = [];
1041
- let level = currentToken.level;
1042
- let lastPos = 0;
1043
- if (links.length > 0 && links[0].index === 0 && i > 0 && tokens[i - 1].type === "text_special") links = links.slice(1);
1044
- for (let ln = 0; ln < links.length; ln++) {
1045
- const url = links[ln].url;
1046
- const fullUrl = state.md.normalizeLink(url);
1047
- if (!state.md.validateLink(fullUrl)) continue;
1048
- let urlText = links[ln].text;
1049
- if (!links[ln].schema) urlText = state.md.normalizeLinkText(`http://${urlText}`).replace(/^http:\/\//, "");
1050
- else if (links[ln].schema === "mailto:" && !/^mailto:/i.test(urlText)) urlText = state.md.normalizeLinkText(`mailto:${urlText}`).replace(/^mailto:/, "");
1051
- else urlText = state.md.normalizeLinkText(urlText);
1052
- const pos = links[ln].index;
1053
- if (pos > lastPos) {
1054
- const token = new state.Token("text", "", 0);
1055
- token.content = text.slice(lastPos, pos);
1056
- token.level = level;
1057
- nodes.push(token);
1058
- }
1059
- const token_o = new state.Token("link_open", "a", 1);
1060
- token_o.attrs = [["href", fullUrl]];
1061
- token_o.level = level++;
1062
- token_o.markup = "linkify";
1063
- token_o.info = "auto";
1064
- nodes.push(token_o);
1065
- const token_t = new state.Token("text", "", 0);
1066
- token_t.content = urlText;
1067
- token_t.level = level;
1068
- nodes.push(token_t);
1069
- const token_c = new state.Token("link_close", "a", -1);
1070
- token_c.level = --level;
1071
- token_c.markup = "linkify";
1072
- token_c.info = "auto";
1073
- nodes.push(token_c);
1074
- lastPos = links[ln].lastIndex;
1075
- }
1076
- if (lastPos < text.length) {
1077
- const token = new state.Token("text", "", 0);
1078
- token.content = text.slice(lastPos);
1079
- token.level = level;
1080
- nodes.push(token);
1081
- }
1082
- replacements.push({
1083
- index: i,
1084
- nodes
1085
- });
1086
- }
1087
- }
1088
- if (replacements.length > 0) {
1089
- let newTokensLength = tokens.length;
1090
- for (const replacement of replacements) newTokensLength += replacement.nodes.length - 1;
1091
- const newTokens = new Array(newTokensLength);
1092
- let replacementIndex = 0;
1093
- let newTokenIndex = 0;
1094
- replacements.reverse();
1095
- for (let i = 0; i < tokens.length; i++) {
1096
- const replacement = replacements[replacementIndex];
1097
- if ((replacement === null || replacement === void 0 ? void 0 : replacement.index) === i) {
1098
- for (const node of replacement.nodes) newTokens[newTokenIndex++] = node;
1099
- replacementIndex++;
1100
- } else newTokens[newTokenIndex++] = tokens[i];
1101
- }
1102
- blockTokens[j].children = newTokens;
1103
- }
1104
- }
1105
- }
1106
- var RARE_RE = /\+-|\.\.|\?\?\?\?|!!!!|,,|--/;
1107
- var SCOPED_ABBR_TEST_RE = /\((c|tm|r)\)/i;
1108
- var SCOPED_ABBR_RE = /\((c|tm|r)\)/gi;
1109
- var SCOPED_ABBR = {
1110
- c: "©",
1111
- r: "®",
1112
- tm: "™"
1113
- };
1114
- function replaceFn(match, name) {
1115
- return SCOPED_ABBR[name.toLowerCase()];
1116
- }
1117
- function replace_scoped(inlineTokens) {
1118
- let inside_autolink = 0;
1119
- for (let i = inlineTokens.length - 1; i >= 0; i--) {
1120
- const token = inlineTokens[i];
1121
- if (token.type === "text" && !inside_autolink) token.content = token.content.replace(SCOPED_ABBR_RE, replaceFn);
1122
- if (token.type === "link_open" && token.info === "auto") inside_autolink--;
1123
- if (token.type === "link_close" && token.info === "auto") inside_autolink++;
1124
- }
1125
- }
1126
- function replace_rare(inlineTokens) {
1127
- let inside_autolink = 0;
1128
- for (let i = inlineTokens.length - 1; i >= 0; i--) {
1129
- const token = inlineTokens[i];
1130
- if (token.type === "text" && !inside_autolink) {
1131
- if (RARE_RE.test(token.content)) token.content = token.content.replace(/\+-/g, "±").replace(/\.{2,}/g, "…").replace(/([?!])…/g, "$1..").replace(/([?!]){4,}/g, "$1$1$1").replace(/,{2,}/g, ",").replace(/(^|[^-])---(?=[^-]|$)/gm, "$1—").replace(/(^|\s)--(?=\s|$)/gm, "$1–").replace(/(^|[^-\s])--(?=[^-\s]|$)/gm, "$1–");
1132
- }
1133
- if (token.type === "link_open" && token.info === "auto") inside_autolink--;
1134
- if (token.type === "link_close" && token.info === "auto") inside_autolink++;
1135
- }
1136
- }
1137
- function replace(state) {
1138
- let blkIdx;
1139
- if (!state.md.options.typographer) return;
1140
- for (blkIdx = state.tokens.length - 1; blkIdx >= 0; blkIdx--) {
1141
- if (state.tokens[blkIdx].type !== "inline") continue;
1142
- if (SCOPED_ABBR_TEST_RE.test(state.tokens[blkIdx].content)) replace_scoped(state.tokens[blkIdx].children);
1143
- if (RARE_RE.test(state.tokens[blkIdx].content)) replace_rare(state.tokens[blkIdx].children);
1144
- }
1145
- }
1146
- var QUOTE_TEST_RE = /['"]/;
1147
- var QUOTE_RE = /['"]/g;
1148
- var APOSTROPHE = "’";
1149
- var MAX_OPENERS = 1e3;
1150
- function truncateStack(stack, heads, length) {
1151
- while (stack.length > length) {
1152
- const item = stack.pop();
1153
- if (item.isSingleQuote) heads.single = item.prevSameQuoteIdx;
1154
- else heads.double = item.prevSameQuoteIdx;
1155
- }
1156
- }
1157
- function addReplacement(replacements, tokenIdx, pos, ch) {
1158
- if (!replacements[tokenIdx]) replacements[tokenIdx] = [];
1159
- replacements[tokenIdx].push({
1160
- pos,
1161
- ch
1162
- });
1163
- }
1164
- function applyReplacements(str, replacements) {
1165
- let result = "";
1166
- let lastPos = 0;
1167
- replacements.sort((a, b) => a.pos - b.pos);
1168
- for (let i = 0; i < replacements.length; i++) {
1169
- const replacement = replacements[i];
1170
- result += str.slice(lastPos, replacement.pos) + replacement.ch;
1171
- lastPos = replacement.pos + 1;
1172
- }
1173
- return result + str.slice(lastPos);
1174
- }
1175
- function process_inlines(tokens, state) {
1176
- let j;
1177
- const stack = [];
1178
- const heads = {
1179
- single: -1,
1180
- double: -1
1181
- };
1182
- const replacements = {};
1183
- for (let i = 0; i < tokens.length; i++) {
1184
- const token = tokens[i];
1185
- const thisLevel = tokens[i].level;
1186
- for (j = stack.length - 1; j >= 0; j--) if (stack[j].level <= thisLevel) break;
1187
- truncateStack(stack, heads, j + 1);
1188
- if (token.type !== "text") continue;
1189
- const text = token.content;
1190
- let pos = 0;
1191
- const max = text.length;
1192
- OUTER: while (pos < max) {
1193
- QUOTE_RE.lastIndex = pos;
1194
- const t = QUOTE_RE.exec(text);
1195
- if (!t) break;
1196
- let canOpen = true;
1197
- let canClose = true;
1198
- pos = t.index + 1;
1199
- const isSingle = t[0] === "'";
1200
- let lastChar = 32;
1201
- if (t.index - 1 >= 0) lastChar = text.charCodeAt(t.index - 1);
1202
- else for (j = i - 1; j >= 0; j--) {
1203
- if (tokens[j].type === "softbreak" || tokens[j].type === "hardbreak") break;
1204
- if (!tokens[j].content) continue;
1205
- lastChar = tokens[j].content.charCodeAt(tokens[j].content.length - 1);
1206
- break;
1207
- }
1208
- let nextChar = 32;
1209
- if (pos < max) nextChar = text.charCodeAt(pos);
1210
- else for (j = i + 1; j < tokens.length; j++) {
1211
- if (tokens[j].type === "softbreak" || tokens[j].type === "hardbreak") break;
1212
- if (!tokens[j].content) continue;
1213
- nextChar = tokens[j].content.charCodeAt(0);
1214
- break;
1215
- }
1216
- const isLastPunctChar = isMdAsciiPunct(lastChar) || isPunctCharCode(lastChar);
1217
- const isNextPunctChar = isMdAsciiPunct(nextChar) || isPunctCharCode(nextChar);
1218
- const isLastWhiteSpace = isWhiteSpace(lastChar);
1219
- const isNextWhiteSpace = isWhiteSpace(nextChar);
1220
- if (isNextWhiteSpace) canOpen = false;
1221
- else if (isNextPunctChar) {
1222
- if (!(isLastWhiteSpace || isLastPunctChar)) canOpen = false;
1223
- }
1224
- if (isLastWhiteSpace) canClose = false;
1225
- else if (isLastPunctChar) {
1226
- if (!(isNextWhiteSpace || isNextPunctChar)) canClose = false;
1227
- }
1228
- if (nextChar === 34 && t[0] === "\"") {
1229
- if (lastChar >= 48 && lastChar <= 57) canClose = canOpen = false;
1230
- }
1231
- if (canOpen && canClose) {
1232
- canOpen = isLastPunctChar;
1233
- canClose = isNextPunctChar;
1234
- }
1235
- if (!canOpen && !canClose) {
1236
- if (isSingle) addReplacement(replacements, i, t.index, APOSTROPHE);
1237
- continue;
1238
- }
1239
- if (canClose) {
1240
- j = isSingle ? heads.single : heads.double;
1241
- if (j >= 0 && stack[j].level === thisLevel) {
1242
- const item = stack[j];
1243
- let openQuote;
1244
- let closeQuote;
1245
- if (isSingle) {
1246
- openQuote = state.md.options.quotes[2];
1247
- closeQuote = state.md.options.quotes[3];
1248
- } else {
1249
- openQuote = state.md.options.quotes[0];
1250
- closeQuote = state.md.options.quotes[1];
1251
- }
1252
- addReplacement(replacements, i, t.index, closeQuote);
1253
- addReplacement(replacements, item.tokenIdx, item.contentPos, openQuote);
1254
- truncateStack(stack, heads, j);
1255
- continue OUTER;
1256
- }
1257
- }
1258
- if (canOpen) {
1259
- if (stack.length >= MAX_OPENERS) return;
1260
- stack.push({
1261
- tokenIdx: i,
1262
- contentPos: t.index,
1263
- isSingleQuote: isSingle,
1264
- level: thisLevel,
1265
- prevSameQuoteIdx: isSingle ? heads.single : heads.double
1266
- });
1267
- if (isSingle) heads.single = stack.length - 1;
1268
- else heads.double = stack.length - 1;
1269
- } else if (canClose && isSingle) addReplacement(replacements, i, t.index, APOSTROPHE);
1270
- }
1271
- }
1272
- Object.keys(replacements).forEach(function(tokenIdx) {
1273
- const idx = Number(tokenIdx);
1274
- tokens[idx].content = applyReplacements(tokens[idx].content, replacements[tokenIdx]);
1275
- });
1276
- }
1277
- function smartquotes(state) {
1278
- if (!state.md.options.typographer) return;
1279
- for (let blkIdx = state.tokens.length - 1; blkIdx >= 0; blkIdx--) {
1280
- if (state.tokens[blkIdx].type !== "inline" || !QUOTE_TEST_RE.test(state.tokens[blkIdx].content)) continue;
1281
- process_inlines(state.tokens[blkIdx].children, state);
1282
- }
1283
- }
1284
- function join_alt(tokens) {
1285
- let curr, last;
1286
- const max = tokens.length;
1287
- for (curr = 0; curr < max; curr++) if (tokens[curr].type === "text_special") tokens[curr].type = "text";
1288
- for (curr = last = 0; curr < max; curr++) if (tokens[curr].type === "text" && curr + 1 < max && tokens[curr + 1].type === "text") tokens[curr + 1].content = tokens[curr].content + tokens[curr + 1].content;
1289
- else {
1290
- if (curr !== last) tokens[last] = tokens[curr];
1291
- last++;
1292
- }
1293
- if (curr !== last) tokens.length = last;
1294
- }
1295
- function text_join(state) {
1296
- let curr, last;
1297
- const blockTokens = state.tokens;
1298
- const l = blockTokens.length;
1299
- for (let j = 0; j < l; j++) {
1300
- if (blockTokens[j].type !== "inline") continue;
1301
- const tokens = blockTokens[j].children;
1302
- const max = tokens.length;
1303
- for (curr = 0; curr < max; curr++) {
1304
- if (tokens[curr].type === "text_special") tokens[curr].type = "text";
1305
- if (tokens[curr].children) join_alt(tokens[curr].children);
1306
- }
1307
- for (curr = last = 0; curr < max; curr++) if (tokens[curr].type === "text" && curr + 1 < max && tokens[curr + 1].type === "text") tokens[curr + 1].content = tokens[curr].content + tokens[curr + 1].content;
1308
- else {
1309
- if (curr !== last) tokens[last] = tokens[curr];
1310
- last++;
1311
- }
1312
- if (curr !== last) tokens.length = last;
1313
- }
1314
- }
1315
- var _rules$2 = [
1316
- ["normalize", normalize],
1317
- ["block", block],
1318
- ["strip_references", strip_references],
1319
- ["inline", inline],
1320
- ["linkify", linkify$1],
1321
- ["replacements", replace],
1322
- ["smartquotes", smartquotes],
1323
- ["text_join", text_join]
1324
- ];
1325
- /**
1326
- * Top-level rules executor. Glues block/inline parsers and does intermediate
1327
- * transformations.
1328
- */
1329
- var ParserCore = class {
1330
- constructor() {
1331
- _defineProperty(
1332
- this,
1333
- /**
1334
- * {@link Ruler} instance. Keep configuration of core rules.
1335
- */
1336
- "ruler",
1337
- new Ruler()
1338
- );
1339
- _defineProperty(this, "State", StateCore);
1340
- for (let i = 0; i < _rules$2.length; i++) this.ruler.push(_rules$2[i][0], _rules$2[i][1]);
1341
- }
1342
- /**
1343
- * Executes core chain rules.
1344
- */
1345
- process(state) {
1346
- const rules = this.ruler.getRules("");
1347
- for (let i = 0, l = rules.length; i < l; i++) rules[i](state);
1348
- }
1349
- };
1350
- /** Mutable state passed to block rules while tokenizing a source document. */
1351
- var StateBlock = class {
1352
- constructor(src, md, env, tokens) {
1353
- _defineProperty(this, "bMarks", []);
1354
- _defineProperty(this, "eMarks", []);
1355
- _defineProperty(this, "tShift", []);
1356
- _defineProperty(this, "sCount", []);
1357
- _defineProperty(this, "bsCount", []);
1358
- _defineProperty(this, "blkIndent", 0);
1359
- _defineProperty(this, "line", 0);
1360
- _defineProperty(this, "lineMax", 0);
1361
- _defineProperty(this, "tight", false);
1362
- _defineProperty(this, "listIndent", -1);
1363
- _defineProperty(this, "parentType", "root");
1364
- _defineProperty(this, "level", 0);
1365
- _defineProperty(this, "Token", Token);
1366
- this.src = src;
1367
- this.md = md;
1368
- this.env = env;
1369
- this.tokens = tokens;
1370
- const s = this.src;
1371
- for (let start = 0, pos = 0, indent = 0, offset = 0, len = s.length, indent_found = false; pos < len; pos++) {
1372
- const ch = s.charCodeAt(pos);
1373
- if (!indent_found) if (isSpace(ch)) {
1374
- indent++;
1375
- if (ch === 9) offset += 4 - offset % 4;
1376
- else offset++;
1377
- continue;
1378
- } else indent_found = true;
1379
- if (ch === 10 || pos === len - 1) {
1380
- if (ch !== 10) pos++;
1381
- this.bMarks.push(start);
1382
- this.eMarks.push(pos);
1383
- this.tShift.push(indent);
1384
- this.sCount.push(offset);
1385
- this.bsCount.push(0);
1386
- indent_found = false;
1387
- indent = 0;
1388
- offset = 0;
1389
- start = pos + 1;
1390
- }
1391
- }
1392
- this.bMarks.push(s.length);
1393
- this.eMarks.push(s.length);
1394
- this.tShift.push(0);
1395
- this.sCount.push(0);
1396
- this.bsCount.push(0);
1397
- this.lineMax = this.bMarks.length - 1;
1398
- }
1399
- push(type, tag, nesting) {
1400
- const token = new Token(type, tag, nesting);
1401
- token.block = true;
1402
- if (nesting < 0) this.level--;
1403
- token.level = this.level;
1404
- if (nesting > 0) this.level++;
1405
- this.tokens.push(token);
1406
- return token;
1407
- }
1408
- isEmpty(line) {
1409
- return this.bMarks[line] + this.tShift[line] >= this.eMarks[line];
1410
- }
1411
- skipEmptyLines(from) {
1412
- for (let max = this.lineMax; from < max; from++) if (this.bMarks[from] + this.tShift[from] < this.eMarks[from]) break;
1413
- return from;
1414
- }
1415
- skipSpaces(pos) {
1416
- for (let max = this.src.length; pos < max; pos++) if (!isSpace(this.src.charCodeAt(pos))) break;
1417
- return pos;
1418
- }
1419
- skipSpacesBack(pos, min) {
1420
- if (pos <= min) return pos;
1421
- while (pos > min) if (!isSpace(this.src.charCodeAt(--pos))) return pos + 1;
1422
- return pos;
1423
- }
1424
- skipChars(pos, code) {
1425
- for (let max = this.src.length; pos < max; pos++) if (this.src.charCodeAt(pos) !== code) break;
1426
- return pos;
1427
- }
1428
- skipCharsBack(pos, code, min) {
1429
- if (pos <= min) return pos;
1430
- while (pos > min) if (code !== this.src.charCodeAt(--pos)) return pos + 1;
1431
- return pos;
1432
- }
1433
- getLines(begin, end, indent, keepLastLF) {
1434
- if (begin >= end) return "";
1435
- const queue = new Array(end - begin);
1436
- for (let i = 0, line = begin; line < end; line++, i++) {
1437
- let lineIndent = 0;
1438
- const lineStart = this.bMarks[line];
1439
- let first = lineStart;
1440
- let last;
1441
- if (line + 1 < end || keepLastLF) last = this.eMarks[line] + 1;
1442
- else last = this.eMarks[line];
1443
- while (first < last && lineIndent < indent) {
1444
- const ch = this.src.charCodeAt(first);
1445
- if (isSpace(ch)) if (ch === 9) lineIndent += 4 - (lineIndent + this.bsCount[line]) % 4;
1446
- else lineIndent++;
1447
- else if (first - lineStart < this.tShift[line]) lineIndent++;
1448
- else break;
1449
- first++;
1450
- }
1451
- if (lineIndent > indent) queue[i] = new Array(lineIndent - indent + 1).join(" ") + this.src.slice(first, last);
1452
- else queue[i] = this.src.slice(first, last);
1453
- }
1454
- return queue.join("");
1455
- }
1456
- };
1457
- var MAX_AUTOCOMPLETED_CELLS = 65536;
1458
- function getLine(state, line) {
1459
- const pos = state.bMarks[line] + state.tShift[line];
1460
- const max = state.eMarks[line];
1461
- return state.src.slice(pos, max);
1462
- }
1463
- function escapedSplit(str) {
1464
- const result = [];
1465
- const max = str.length;
1466
- let pos = 0;
1467
- let ch = str.charCodeAt(pos);
1468
- let isEscaped = false;
1469
- let lastPos = 0;
1470
- let current = "";
1471
- while (pos < max) {
1472
- if (ch === 124) if (!isEscaped) {
1473
- result.push(current + str.substring(lastPos, pos));
1474
- current = "";
1475
- lastPos = pos + 1;
1476
- } else {
1477
- current += str.substring(lastPos, pos - 1);
1478
- lastPos = pos;
1479
- }
1480
- isEscaped = ch === 92;
1481
- pos++;
1482
- ch = str.charCodeAt(pos);
1483
- }
1484
- result.push(current + str.substring(lastPos));
1485
- return result;
1486
- }
1487
- function table(state, startLine, endLine, silent) {
1488
- if (startLine + 2 > endLine) return false;
1489
- let nextLine = startLine + 1;
1490
- if (state.sCount[nextLine] < state.blkIndent) return false;
1491
- if (state.sCount[nextLine] - state.blkIndent >= 4) return false;
1492
- let pos = state.bMarks[nextLine] + state.tShift[nextLine];
1493
- if (pos >= state.eMarks[nextLine]) return false;
1494
- const firstCh = state.src.charCodeAt(pos++);
1495
- if (firstCh !== 124 && firstCh !== 45 && firstCh !== 58) return false;
1496
- if (pos >= state.eMarks[nextLine]) return false;
1497
- const secondCh = state.src.charCodeAt(pos++);
1498
- if (secondCh !== 124 && secondCh !== 45 && secondCh !== 58 && !isSpace(secondCh)) return false;
1499
- if (firstCh === 45 && isSpace(secondCh)) return false;
1500
- while (pos < state.eMarks[nextLine]) {
1501
- const ch = state.src.charCodeAt(pos);
1502
- if (ch !== 124 && ch !== 45 && ch !== 58 && !isSpace(ch)) return false;
1503
- pos++;
1504
- }
1505
- let lineText = getLine(state, startLine + 1);
1506
- let columns = lineText.split("|");
1507
- const aligns = [];
1508
- for (let i = 0; i < columns.length; i++) {
1509
- const t = columns[i].trim();
1510
- if (!t) if (i === 0 || i === columns.length - 1) continue;
1511
- else return false;
1512
- if (!/^:?-+:?$/.test(t)) return false;
1513
- if (t.charCodeAt(t.length - 1) === 58) aligns.push(t.charCodeAt(0) === 58 ? "center" : "right");
1514
- else if (t.charCodeAt(0) === 58) aligns.push("left");
1515
- else aligns.push("");
1516
- }
1517
- lineText = getLine(state, startLine).trim();
1518
- if (lineText.indexOf("|") === -1) return false;
1519
- if (state.sCount[startLine] - state.blkIndent >= 4) return false;
1520
- columns = escapedSplit(lineText);
1521
- if (columns.length && columns[0] === "") columns.shift();
1522
- if (columns.length && columns[columns.length - 1] === "") columns.pop();
1523
- const columnCount = columns.length;
1524
- if (columnCount === 0 || columnCount !== aligns.length) return false;
1525
- if (silent) return true;
1526
- const oldParentType = state.parentType;
1527
- state.parentType = "table";
1528
- const terminatorRules = state.md.block.ruler.getRules("blockquote");
1529
- const token_to = state.push("table_open", "table", 1);
1530
- const tableLines = [startLine, 0];
1531
- token_to.map = tableLines;
1532
- const token_tho = state.push("thead_open", "thead", 1);
1533
- token_tho.map = [startLine, startLine + 1];
1534
- const token_htro = state.push("tr_open", "tr", 1);
1535
- token_htro.map = [startLine, startLine + 1];
1536
- for (let i = 0; i < columns.length; i++) {
1537
- const token_ho = state.push("th_open", "th", 1);
1538
- if (aligns[i]) token_ho.attrs = [["style", `text-align:${aligns[i]}`]];
1539
- const token_il = state.push("inline", "", 0);
1540
- token_il.content = columns[i].trim();
1541
- token_il.children = [];
1542
- state.push("th_close", "th", -1);
1543
- }
1544
- state.push("tr_close", "tr", -1);
1545
- state.push("thead_close", "thead", -1);
1546
- let tbodyLines;
1547
- let autocompletedCells = 0;
1548
- for (nextLine = startLine + 2; nextLine < endLine; nextLine++) {
1549
- if (state.sCount[nextLine] < state.blkIndent) break;
1550
- let terminate = false;
1551
- for (let i = 0, l = terminatorRules.length; i < l; i++) if (terminatorRules[i](state, nextLine, endLine, true)) {
1552
- terminate = true;
1553
- break;
1554
- }
1555
- if (terminate) break;
1556
- lineText = getLine(state, nextLine).trim();
1557
- if (!lineText) break;
1558
- if (state.sCount[nextLine] - state.blkIndent >= 4) break;
1559
- columns = escapedSplit(lineText);
1560
- if (columns.length && columns[0] === "") columns.shift();
1561
- if (columns.length && columns[columns.length - 1] === "") columns.pop();
1562
- autocompletedCells += columnCount - columns.length;
1563
- if (autocompletedCells > MAX_AUTOCOMPLETED_CELLS) break;
1564
- if (nextLine === startLine + 2) {
1565
- const token_tbo = state.push("tbody_open", "tbody", 1);
1566
- token_tbo.map = tbodyLines = [startLine + 2, 0];
1567
- }
1568
- const token_tro = state.push("tr_open", "tr", 1);
1569
- token_tro.map = [nextLine, nextLine + 1];
1570
- for (let i = 0; i < columnCount; i++) {
1571
- const token_tdo = state.push("td_open", "td", 1);
1572
- if (aligns[i]) token_tdo.attrs = [["style", `text-align:${aligns[i]}`]];
1573
- const token_il = state.push("inline", "", 0);
1574
- token_il.content = columns[i] ? columns[i].trim() : "";
1575
- token_il.children = [];
1576
- state.push("td_close", "td", -1);
1577
- }
1578
- state.push("tr_close", "tr", -1);
1579
- }
1580
- if (tbodyLines) {
1581
- state.push("tbody_close", "tbody", -1);
1582
- tbodyLines[1] = nextLine;
1583
- }
1584
- state.push("table_close", "table", -1);
1585
- tableLines[1] = nextLine;
1586
- state.parentType = oldParentType;
1587
- state.line = nextLine;
1588
- return true;
1589
- }
1590
- function code(state, startLine, endLine) {
1591
- if (state.sCount[startLine] - state.blkIndent < 4) return false;
1592
- let nextLine = startLine + 1;
1593
- let last = nextLine;
1594
- while (nextLine < endLine) {
1595
- if (state.isEmpty(nextLine)) {
1596
- nextLine++;
1597
- continue;
1598
- }
1599
- if (state.sCount[nextLine] - state.blkIndent >= 4) {
1600
- nextLine++;
1601
- last = nextLine;
1602
- continue;
1603
- }
1604
- break;
1605
- }
1606
- state.line = last;
1607
- const token = state.push("code_block", "code", 0);
1608
- token.content = state.getLines(startLine, last, 4 + state.blkIndent, false) + "\n";
1609
- token.map = [startLine, state.line];
1610
- return true;
1611
- }
1612
- function fence(state, startLine, endLine, silent) {
1613
- let pos = state.bMarks[startLine] + state.tShift[startLine];
1614
- let max = state.eMarks[startLine];
1615
- if (state.sCount[startLine] - state.blkIndent >= 4) return false;
1616
- if (pos + 3 > max) return false;
1617
- const marker = state.src.charCodeAt(pos);
1618
- if (marker !== 126 && marker !== 96) return false;
1619
- let mem = pos;
1620
- pos = state.skipChars(pos, marker);
1621
- let len = pos - mem;
1622
- if (len < 3) return false;
1623
- const markup = state.src.slice(mem, pos);
1624
- const params = state.src.slice(pos, max);
1625
- if (marker === 96) {
1626
- if (params.indexOf(String.fromCharCode(marker)) >= 0) return false;
1627
- }
1628
- if (silent) return true;
1629
- let nextLine = startLine;
1630
- let haveEndMarker = false;
1631
- for (;;) {
1632
- nextLine++;
1633
- if (nextLine >= endLine) break;
1634
- pos = mem = state.bMarks[nextLine] + state.tShift[nextLine];
1635
- max = state.eMarks[nextLine];
1636
- if (pos < max && state.sCount[nextLine] < state.blkIndent) break;
1637
- if (state.src.charCodeAt(pos) !== marker) continue;
1638
- if (state.sCount[nextLine] - state.blkIndent >= 4) continue;
1639
- pos = state.skipChars(pos, marker);
1640
- if (pos - mem < len) continue;
1641
- pos = state.skipSpaces(pos);
1642
- if (pos < max) continue;
1643
- haveEndMarker = true;
1644
- break;
1645
- }
1646
- len = state.sCount[startLine];
1647
- state.line = nextLine + (haveEndMarker ? 1 : 0);
1648
- const token = state.push("fence", "code", 0);
1649
- token.info = params;
1650
- token.content = state.getLines(startLine + 1, nextLine, len, true);
1651
- token.markup = markup;
1652
- token.map = [startLine, state.line];
1653
- return true;
1654
- }
1655
- function blockquote(state, startLine, endLine, silent) {
1656
- let pos = state.bMarks[startLine] + state.tShift[startLine];
1657
- let max = state.eMarks[startLine];
1658
- const oldLineMax = state.lineMax;
1659
- if (state.sCount[startLine] - state.blkIndent >= 4) return false;
1660
- if (state.src.charCodeAt(pos) !== 62) return false;
1661
- if (silent) return true;
1662
- const oldBMarks = [];
1663
- const oldBSCount = [];
1664
- const oldSCount = [];
1665
- const oldTShift = [];
1666
- const terminatorRules = state.md.block.ruler.getRules("blockquote");
1667
- const oldParentType = state.parentType;
1668
- state.parentType = "blockquote";
1669
- let lastLineEmpty = false;
1670
- let nextLine;
1671
- for (nextLine = startLine; nextLine < endLine; nextLine++) {
1672
- const isOutdented = state.sCount[nextLine] < state.blkIndent;
1673
- pos = state.bMarks[nextLine] + state.tShift[nextLine];
1674
- max = state.eMarks[nextLine];
1675
- if (pos >= max) break;
1676
- if (state.src.charCodeAt(pos++) === 62 && !isOutdented) {
1677
- let initial = state.sCount[nextLine] + 1;
1678
- let spaceAfterMarker;
1679
- let adjustTab;
1680
- if (state.src.charCodeAt(pos) === 32) {
1681
- pos++;
1682
- initial++;
1683
- adjustTab = false;
1684
- spaceAfterMarker = true;
1685
- } else if (state.src.charCodeAt(pos) === 9) {
1686
- spaceAfterMarker = true;
1687
- if ((state.bsCount[nextLine] + initial) % 4 === 3) {
1688
- pos++;
1689
- initial++;
1690
- adjustTab = false;
1691
- } else adjustTab = true;
1692
- } else spaceAfterMarker = false;
1693
- let offset = initial;
1694
- oldBMarks.push(state.bMarks[nextLine]);
1695
- state.bMarks[nextLine] = pos;
1696
- while (pos < max) {
1697
- const ch = state.src.charCodeAt(pos);
1698
- if (isSpace(ch)) if (ch === 9) offset += 4 - (offset + state.bsCount[nextLine] + (adjustTab ? 1 : 0)) % 4;
1699
- else offset++;
1700
- else break;
1701
- pos++;
1702
- }
1703
- lastLineEmpty = pos >= max;
1704
- oldBSCount.push(state.bsCount[nextLine]);
1705
- state.bsCount[nextLine] = state.sCount[nextLine] + 1 + (spaceAfterMarker ? 1 : 0);
1706
- oldSCount.push(state.sCount[nextLine]);
1707
- state.sCount[nextLine] = offset - initial;
1708
- oldTShift.push(state.tShift[nextLine]);
1709
- state.tShift[nextLine] = pos - state.bMarks[nextLine];
1710
- continue;
1711
- }
1712
- if (lastLineEmpty) break;
1713
- let terminate = false;
1714
- for (let i = 0, l = terminatorRules.length; i < l; i++) if (terminatorRules[i](state, nextLine, endLine, true)) {
1715
- terminate = true;
1716
- break;
1717
- }
1718
- if (terminate) {
1719
- state.lineMax = nextLine;
1720
- if (state.blkIndent !== 0) {
1721
- oldBMarks.push(state.bMarks[nextLine]);
1722
- oldBSCount.push(state.bsCount[nextLine]);
1723
- oldTShift.push(state.tShift[nextLine]);
1724
- oldSCount.push(state.sCount[nextLine]);
1725
- state.sCount[nextLine] -= state.blkIndent;
1726
- }
1727
- break;
1728
- }
1729
- oldBMarks.push(state.bMarks[nextLine]);
1730
- oldBSCount.push(state.bsCount[nextLine]);
1731
- oldTShift.push(state.tShift[nextLine]);
1732
- oldSCount.push(state.sCount[nextLine]);
1733
- state.sCount[nextLine] = -1;
1734
- }
1735
- const oldIndent = state.blkIndent;
1736
- state.blkIndent = 0;
1737
- const token_o = state.push("blockquote_open", "blockquote", 1);
1738
- token_o.markup = ">";
1739
- const lines = [startLine, 0];
1740
- token_o.map = lines;
1741
- state.md.block.tokenize(state, startLine, nextLine);
1742
- const token_c = state.push("blockquote_close", "blockquote", -1);
1743
- token_c.markup = ">";
1744
- state.lineMax = oldLineMax;
1745
- state.parentType = oldParentType;
1746
- lines[1] = state.line;
1747
- for (let i = 0; i < oldTShift.length; i++) {
1748
- state.bMarks[i + startLine] = oldBMarks[i];
1749
- state.tShift[i + startLine] = oldTShift[i];
1750
- state.sCount[i + startLine] = oldSCount[i];
1751
- state.bsCount[i + startLine] = oldBSCount[i];
1752
- }
1753
- state.blkIndent = oldIndent;
1754
- return true;
1755
- }
1756
- function hr(state, startLine, endLine, silent) {
1757
- const max = state.eMarks[startLine];
1758
- if (state.sCount[startLine] - state.blkIndent >= 4) return false;
1759
- let pos = state.bMarks[startLine] + state.tShift[startLine];
1760
- const marker = state.src.charCodeAt(pos++);
1761
- if (marker !== 42 && marker !== 45 && marker !== 95) return false;
1762
- let cnt = 1;
1763
- while (pos < max) {
1764
- const ch = state.src.charCodeAt(pos++);
1765
- if (ch !== marker && !isSpace(ch)) return false;
1766
- if (ch === marker) cnt++;
1767
- }
1768
- if (cnt < 3) return false;
1769
- if (silent) return true;
1770
- state.line = startLine + 1;
1771
- const token = state.push("hr", "hr", 0);
1772
- token.map = [startLine, state.line];
1773
- token.markup = Array(cnt + 1).join(String.fromCharCode(marker));
1774
- return true;
1775
- }
1776
- function skipBulletListMarker(state, startLine) {
1777
- const max = state.eMarks[startLine];
1778
- let pos = state.bMarks[startLine] + state.tShift[startLine];
1779
- const marker = state.src.charCodeAt(pos++);
1780
- if (marker !== 42 && marker !== 45 && marker !== 43) return -1;
1781
- if (pos < max) {
1782
- if (!isSpace(state.src.charCodeAt(pos))) return -1;
1783
- }
1784
- return pos;
1785
- }
1786
- function skipOrderedListMarker(state, startLine) {
1787
- const start = state.bMarks[startLine] + state.tShift[startLine];
1788
- const max = state.eMarks[startLine];
1789
- let pos = start;
1790
- if (pos + 1 >= max) return -1;
1791
- let ch = state.src.charCodeAt(pos++);
1792
- if (ch < 48 || ch > 57) return -1;
1793
- for (;;) {
1794
- if (pos >= max) return -1;
1795
- ch = state.src.charCodeAt(pos++);
1796
- if (ch >= 48 && ch <= 57) {
1797
- if (pos - start >= 10) return -1;
1798
- continue;
1799
- }
1800
- if (ch === 41 || ch === 46) break;
1801
- return -1;
1802
- }
1803
- if (pos < max) {
1804
- ch = state.src.charCodeAt(pos);
1805
- if (!isSpace(ch)) return -1;
1806
- }
1807
- return pos;
1808
- }
1809
- function markTightParagraphs(state, idx) {
1810
- const level = state.level + 2;
1811
- for (let i = idx + 2, l = state.tokens.length - 2; i < l; i++) if (state.tokens[i].level === level && state.tokens[i].type === "paragraph_open") {
1812
- state.tokens[i + 2].hidden = true;
1813
- state.tokens[i].hidden = true;
1814
- i += 2;
1815
- }
1816
- }
1817
- function list(state, startLine, endLine, silent) {
1818
- let max, pos, start, token;
1819
- let nextLine = startLine;
1820
- let tight = true;
1821
- if (state.sCount[nextLine] - state.blkIndent >= 4) return false;
1822
- if (state.listIndent >= 0 && state.sCount[nextLine] - state.listIndent >= 4 && state.sCount[nextLine] < state.blkIndent) return false;
1823
- let isTerminatingParagraph = false;
1824
- if (silent && state.parentType === "paragraph") {
1825
- if (state.sCount[nextLine] >= state.blkIndent) isTerminatingParagraph = true;
1826
- }
1827
- let isOrdered;
1828
- let markerValue;
1829
- let posAfterMarker;
1830
- if ((posAfterMarker = skipOrderedListMarker(state, nextLine)) >= 0) {
1831
- isOrdered = true;
1832
- start = state.bMarks[nextLine] + state.tShift[nextLine];
1833
- markerValue = Number(state.src.slice(start, posAfterMarker - 1));
1834
- if (isTerminatingParagraph && markerValue !== 1) return false;
1835
- } else if ((posAfterMarker = skipBulletListMarker(state, nextLine)) >= 0) isOrdered = false;
1836
- else return false;
1837
- if (isTerminatingParagraph) {
1838
- if (state.skipSpaces(posAfterMarker) >= state.eMarks[nextLine]) return false;
1839
- }
1840
- if (silent) return true;
1841
- const markerCharCode = state.src.charCodeAt(posAfterMarker - 1);
1842
- const listTokIdx = state.tokens.length;
1843
- if (isOrdered) {
1844
- token = state.push("ordered_list_open", "ol", 1);
1845
- if (markerValue !== 1) token.attrs = [["start", markerValue]];
1846
- } else token = state.push("bullet_list_open", "ul", 1);
1847
- const listLines = [nextLine, 0];
1848
- token.map = listLines;
1849
- token.markup = String.fromCharCode(markerCharCode);
1850
- let prevEmptyEnd = false;
1851
- const terminatorRules = state.md.block.ruler.getRules("list");
1852
- const oldParentType = state.parentType;
1853
- state.parentType = "list";
1854
- while (nextLine < endLine) {
1855
- pos = posAfterMarker;
1856
- max = state.eMarks[nextLine];
1857
- const initial = state.sCount[nextLine] + posAfterMarker - (state.bMarks[nextLine] + state.tShift[nextLine]);
1858
- let offset = initial;
1859
- while (pos < max) {
1860
- const ch = state.src.charCodeAt(pos);
1861
- if (ch === 9) offset += 4 - (offset + state.bsCount[nextLine]) % 4;
1862
- else if (ch === 32) offset++;
1863
- else break;
1864
- pos++;
1865
- }
1866
- const contentStart = pos;
1867
- let indentAfterMarker;
1868
- if (contentStart >= max) indentAfterMarker = 1;
1869
- else indentAfterMarker = offset - initial;
1870
- if (indentAfterMarker > 4) indentAfterMarker = 1;
1871
- const indent = initial + indentAfterMarker;
1872
- token = state.push("list_item_open", "li", 1);
1873
- token.markup = String.fromCharCode(markerCharCode);
1874
- const itemLines = [nextLine, 0];
1875
- token.map = itemLines;
1876
- if (isOrdered) token.info = state.src.slice(start, posAfterMarker - 1);
1877
- const oldTight = state.tight;
1878
- const oldTShift = state.tShift[nextLine];
1879
- const oldSCount = state.sCount[nextLine];
1880
- const oldListIndent = state.listIndent;
1881
- state.listIndent = state.blkIndent;
1882
- state.blkIndent = indent;
1883
- state.tight = true;
1884
- state.tShift[nextLine] = contentStart - state.bMarks[nextLine];
1885
- state.sCount[nextLine] = offset;
1886
- if (contentStart >= max && state.isEmpty(nextLine + 1)) state.line = Math.min(state.line + 2, endLine);
1887
- else state.md.block.tokenize(state, nextLine, endLine);
1888
- if (!state.tight || prevEmptyEnd) tight = false;
1889
- prevEmptyEnd = state.line - nextLine > 1 && state.isEmpty(state.line - 1);
1890
- state.blkIndent = state.listIndent;
1891
- state.listIndent = oldListIndent;
1892
- state.tShift[nextLine] = oldTShift;
1893
- state.sCount[nextLine] = oldSCount;
1894
- state.tight = oldTight;
1895
- token = state.push("list_item_close", "li", -1);
1896
- token.markup = String.fromCharCode(markerCharCode);
1897
- nextLine = state.line;
1898
- itemLines[1] = nextLine;
1899
- if (nextLine >= endLine) break;
1900
- if (state.sCount[nextLine] < state.blkIndent) break;
1901
- if (state.sCount[nextLine] - state.blkIndent >= 4) break;
1902
- let terminate = false;
1903
- for (let i = 0, l = terminatorRules.length; i < l; i++) if (terminatorRules[i](state, nextLine, endLine, true)) {
1904
- terminate = true;
1905
- break;
1906
- }
1907
- if (terminate) break;
1908
- if (isOrdered) {
1909
- posAfterMarker = skipOrderedListMarker(state, nextLine);
1910
- if (posAfterMarker < 0) break;
1911
- start = state.bMarks[nextLine] + state.tShift[nextLine];
1912
- } else {
1913
- posAfterMarker = skipBulletListMarker(state, nextLine);
1914
- if (posAfterMarker < 0) break;
1915
- }
1916
- if (markerCharCode !== state.src.charCodeAt(posAfterMarker - 1)) break;
1917
- }
1918
- if (isOrdered) token = state.push("ordered_list_close", "ol", -1);
1919
- else token = state.push("bullet_list_close", "ul", -1);
1920
- token.markup = String.fromCharCode(markerCharCode);
1921
- listLines[1] = nextLine;
1922
- state.line = nextLine;
1923
- state.parentType = oldParentType;
1924
- if (tight) markTightParagraphs(state, listTokIdx);
1925
- return true;
1926
- }
1927
- function reference(state, startLine, _endLine, silent) {
1928
- let pos = state.bMarks[startLine] + state.tShift[startLine];
1929
- let max = state.eMarks[startLine];
1930
- let nextLine = startLine + 1;
1931
- if (state.sCount[startLine] - state.blkIndent >= 4) return false;
1932
- if (state.src.charCodeAt(pos) !== 91) return false;
1933
- function getNextLine(nextLine) {
1934
- const endLine = state.lineMax;
1935
- if (nextLine >= endLine || state.isEmpty(nextLine)) return null;
1936
- let isContinuation = false;
1937
- if (state.sCount[nextLine] - state.blkIndent > 3) isContinuation = true;
1938
- if (state.sCount[nextLine] < 0) isContinuation = true;
1939
- if (!isContinuation) {
1940
- const terminatorRules = state.md.block.ruler.getRules("reference");
1941
- const oldParentType = state.parentType;
1942
- state.parentType = "reference";
1943
- let terminate = false;
1944
- for (let i = 0, l = terminatorRules.length; i < l; i++) if (terminatorRules[i](state, nextLine, endLine, true)) {
1945
- terminate = true;
1946
- break;
1947
- }
1948
- state.parentType = oldParentType;
1949
- if (terminate) return null;
1950
- }
1951
- const pos = state.bMarks[nextLine] + state.tShift[nextLine];
1952
- const max = state.eMarks[nextLine];
1953
- return state.src.slice(pos, max + 1);
1954
- }
1955
- let str = state.src.slice(pos, max + 1);
1956
- max = str.length;
1957
- let labelEnd = -1;
1958
- for (pos = 1; pos < max; pos++) {
1959
- const ch = str.charCodeAt(pos);
1960
- if (ch === 91) return false;
1961
- else if (ch === 93) {
1962
- labelEnd = pos;
1963
- break;
1964
- } else if (ch === 10) {
1965
- const lineContent = getNextLine(nextLine);
1966
- if (lineContent !== null) {
1967
- str += lineContent;
1968
- max = str.length;
1969
- nextLine++;
1970
- }
1971
- } else if (ch === 92) {
1972
- pos++;
1973
- if (pos < max && str.charCodeAt(pos) === 10) {
1974
- const lineContent = getNextLine(nextLine);
1975
- if (lineContent !== null) {
1976
- str += lineContent;
1977
- max = str.length;
1978
- nextLine++;
1979
- }
1980
- }
1981
- }
1982
- }
1983
- if (labelEnd < 0 || str.charCodeAt(labelEnd + 1) !== 58) return false;
1984
- for (pos = labelEnd + 2; pos < max; pos++) {
1985
- const ch = str.charCodeAt(pos);
1986
- if (ch === 10) {
1987
- const lineContent = getNextLine(nextLine);
1988
- if (lineContent !== null) {
1989
- str += lineContent;
1990
- max = str.length;
1991
- nextLine++;
1992
- }
1993
- } else if (isSpace(ch)) {} else break;
1994
- }
1995
- const destRes = state.md.helpers.parseLinkDestination(str, pos, max);
1996
- if (!destRes.ok) return false;
1997
- const href = state.md.normalizeLink(destRes.str);
1998
- if (!state.md.validateLink(href)) return false;
1999
- pos = destRes.pos;
2000
- const destEndPos = pos;
2001
- const destEndLineNo = nextLine;
2002
- const start = pos;
2003
- for (; pos < max; pos++) {
2004
- const ch = str.charCodeAt(pos);
2005
- if (ch === 10) {
2006
- const lineContent = getNextLine(nextLine);
2007
- if (lineContent !== null) {
2008
- str += lineContent;
2009
- max = str.length;
2010
- nextLine++;
2011
- }
2012
- } else if (isSpace(ch)) {} else break;
2013
- }
2014
- let titleRes = state.md.helpers.parseLinkTitle(str, pos, max);
2015
- while (titleRes.can_continue) {
2016
- const lineContent = getNextLine(nextLine);
2017
- if (lineContent === null) break;
2018
- str += lineContent;
2019
- pos = max;
2020
- max = str.length;
2021
- nextLine++;
2022
- titleRes = state.md.helpers.parseLinkTitle(str, pos, max, titleRes);
2023
- }
2024
- let title;
2025
- if (pos < max && start !== pos && titleRes.ok) {
2026
- title = titleRes.str;
2027
- pos = titleRes.pos;
2028
- } else {
2029
- title = "";
2030
- pos = destEndPos;
2031
- nextLine = destEndLineNo;
2032
- }
2033
- while (pos < max) {
2034
- if (!isSpace(str.charCodeAt(pos))) break;
2035
- pos++;
2036
- }
2037
- if (pos < max && str.charCodeAt(pos) !== 10) {
2038
- if (title) {
2039
- title = "";
2040
- pos = destEndPos;
2041
- nextLine = destEndLineNo;
2042
- while (pos < max) {
2043
- if (!isSpace(str.charCodeAt(pos))) break;
2044
- pos++;
2045
- }
2046
- }
2047
- }
2048
- if (pos < max && str.charCodeAt(pos) !== 10) return false;
2049
- const label = normalizeReference(str.slice(1, labelEnd));
2050
- if (!label) return false;
2051
- /* istanbul ignore if */
2052
- if (silent) return true;
2053
- if (typeof state.env.references === "undefined") state.env.references = {};
2054
- if (typeof state.env.references[label] === "undefined") state.env.references[label] = {
2055
- title,
2056
- href
2057
- };
2058
- const token = state.push("reference_definition", "", 0);
2059
- token.map = [startLine, nextLine];
2060
- token.hidden = true;
2061
- const meta = Object.create(null);
2062
- meta.label = label;
2063
- token.meta = meta;
2064
- state.line = nextLine;
2065
- return true;
2066
- }
2067
- var html_blocks_default = [
2068
- "address",
2069
- "article",
2070
- "aside",
2071
- "base",
2072
- "basefont",
2073
- "blockquote",
2074
- "body",
2075
- "caption",
2076
- "center",
2077
- "col",
2078
- "colgroup",
2079
- "dd",
2080
- "details",
2081
- "dialog",
2082
- "dir",
2083
- "div",
2084
- "dl",
2085
- "dt",
2086
- "fieldset",
2087
- "figcaption",
2088
- "figure",
2089
- "footer",
2090
- "form",
2091
- "frame",
2092
- "frameset",
2093
- "h1",
2094
- "h2",
2095
- "h3",
2096
- "h4",
2097
- "h5",
2098
- "h6",
2099
- "head",
2100
- "header",
2101
- "hr",
2102
- "html",
2103
- "iframe",
2104
- "legend",
2105
- "li",
2106
- "link",
2107
- "main",
2108
- "menu",
2109
- "menuitem",
2110
- "nav",
2111
- "noframes",
2112
- "ol",
2113
- "optgroup",
2114
- "option",
2115
- "p",
2116
- "param",
2117
- "search",
2118
- "section",
2119
- "summary",
2120
- "table",
2121
- "tbody",
2122
- "td",
2123
- "tfoot",
2124
- "th",
2125
- "thead",
2126
- "title",
2127
- "tr",
2128
- "track",
2129
- "ul"
2130
- ];
2131
- var open_tag = `<[A-Za-z][A-Za-z0-9\\-]*(?:\\s+[a-zA-Z_:][a-zA-Z0-9:._-]*(?:\\s*=\\s*(?:[^"'=<>\`\\x00-\\x20]+|'[^']*'|"[^"]*"))?)*\\s*\\/?>`;
2132
- var close_tag = "<\\/[A-Za-z][A-Za-z0-9\\-]*\\s*>";
2133
- var HTML_TAG_RE = new RegExp(`^(?:${open_tag}|${close_tag}|<!---?>|<!--(?:[^-]|-[^-]|--[^>])*-->|<[?][\\s\\S]*?[?]>|<![A-Za-z][^>]*>|<!\\[CDATA\\[[\\s\\S]*?\\]\\]>)`);
2134
- var HTML_OPEN_CLOSE_TAG_RE = new RegExp(`^(?:${open_tag}|${close_tag})`);
2135
- var HTML_SEQUENCES = [
2136
- [
2137
- /^<(script|pre|style|textarea)(?=(\s|>|$))/i,
2138
- /<\/(script|pre|style|textarea)>/i,
2139
- true
2140
- ],
2141
- [
2142
- /^<!--/,
2143
- /-->/,
2144
- true
2145
- ],
2146
- [
2147
- /^<\?/,
2148
- /\?>/,
2149
- true
2150
- ],
2151
- [
2152
- /^<![A-Za-z]/,
2153
- />/,
2154
- true
2155
- ],
2156
- [
2157
- /^<!\[CDATA\[/,
2158
- /\]\]>/,
2159
- true
2160
- ],
2161
- [
2162
- new RegExp(`^</?(${html_blocks_default.join("|")})(?=(\\s|/?>|$))`, "i"),
2163
- /^$/,
2164
- true
2165
- ],
2166
- [
2167
- new RegExp(`${HTML_OPEN_CLOSE_TAG_RE.source}\\s*$`),
2168
- /^$/,
2169
- false
2170
- ]
2171
- ];
2172
- function html_block(state, startLine, endLine, silent) {
2173
- let pos = state.bMarks[startLine] + state.tShift[startLine];
2174
- let max = state.eMarks[startLine];
2175
- if (state.sCount[startLine] - state.blkIndent >= 4) return false;
2176
- if (!state.md.options.html) return false;
2177
- if (state.src.charCodeAt(pos) !== 60) return false;
2178
- let lineText = state.src.slice(pos, max);
2179
- let i = 0;
2180
- for (; i < HTML_SEQUENCES.length; i++) if (HTML_SEQUENCES[i][0].test(lineText)) break;
2181
- if (i === HTML_SEQUENCES.length) return false;
2182
- if (silent) return HTML_SEQUENCES[i][2];
2183
- let nextLine = startLine + 1;
2184
- const endsOnBlankLine = HTML_SEQUENCES[i][1].test("");
2185
- if (!HTML_SEQUENCES[i][1].test(lineText)) for (; nextLine < endLine; nextLine++) {
2186
- if (state.sCount[nextLine] < state.blkIndent) {
2187
- if (endsOnBlankLine || !state.isEmpty(nextLine)) break;
2188
- }
2189
- pos = state.bMarks[nextLine] + state.tShift[nextLine];
2190
- max = state.eMarks[nextLine];
2191
- lineText = state.src.slice(pos, max);
2192
- if (HTML_SEQUENCES[i][1].test(lineText)) {
2193
- if (lineText.length !== 0) nextLine++;
2194
- break;
2195
- }
2196
- }
2197
- state.line = nextLine;
2198
- const token = state.push("html_block", "", 0);
2199
- token.map = [startLine, nextLine];
2200
- token.content = state.getLines(startLine, nextLine, state.blkIndent, true);
2201
- return true;
2202
- }
2203
- function heading(state, startLine, endLine, silent) {
2204
- let pos = state.bMarks[startLine] + state.tShift[startLine];
2205
- let max = state.eMarks[startLine];
2206
- if (state.sCount[startLine] - state.blkIndent >= 4) return false;
2207
- let ch = state.src.charCodeAt(pos);
2208
- if (ch !== 35 || pos >= max) return false;
2209
- let level = 1;
2210
- ch = state.src.charCodeAt(++pos);
2211
- while (ch === 35 && pos < max && level <= 6) {
2212
- level++;
2213
- ch = state.src.charCodeAt(++pos);
2214
- }
2215
- if (level > 6 || pos < max && !isSpace(ch)) return false;
2216
- if (silent) return true;
2217
- max = state.skipSpacesBack(max, pos);
2218
- const tmp = state.skipCharsBack(max, 35, pos);
2219
- if (tmp > pos && isSpace(state.src.charCodeAt(tmp - 1))) max = tmp;
2220
- state.line = startLine + 1;
2221
- const token_o = state.push("heading_open", `h${level}`, 1);
2222
- token_o.markup = "########".slice(0, level);
2223
- token_o.map = [startLine, state.line];
2224
- const token_i = state.push("inline", "", 0);
2225
- token_i.content = asciiTrim(state.src.slice(pos, max));
2226
- token_i.map = [startLine, state.line];
2227
- token_i.children = [];
2228
- const token_c = state.push("heading_close", `h${level}`, -1);
2229
- token_c.markup = "########".slice(0, level);
2230
- return true;
2231
- }
2232
- function lheading(state, startLine, endLine) {
2233
- const terminatorRules = state.md.block.ruler.getRules("paragraph");
2234
- if (state.sCount[startLine] - state.blkIndent >= 4) return false;
2235
- const oldParentType = state.parentType;
2236
- state.parentType = "paragraph";
2237
- let level = 0;
2238
- let marker;
2239
- let nextLine = startLine + 1;
2240
- for (; nextLine < endLine && !state.isEmpty(nextLine); nextLine++) {
2241
- if (state.sCount[nextLine] - state.blkIndent > 3) continue;
2242
- if (state.sCount[nextLine] >= state.blkIndent) {
2243
- let pos = state.bMarks[nextLine] + state.tShift[nextLine];
2244
- const max = state.eMarks[nextLine];
2245
- if (pos < max) {
2246
- marker = state.src.charCodeAt(pos);
2247
- if (marker === 45 || marker === 61) {
2248
- pos = state.skipChars(pos, marker);
2249
- pos = state.skipSpaces(pos);
2250
- if (pos >= max) {
2251
- level = marker === 61 ? 1 : 2;
2252
- break;
2253
- }
2254
- }
2255
- }
2256
- }
2257
- if (state.sCount[nextLine] < 0) continue;
2258
- let terminate = false;
2259
- for (let i = 0, l = terminatorRules.length; i < l; i++) if (terminatorRules[i](state, nextLine, endLine, true)) {
2260
- terminate = true;
2261
- break;
2262
- }
2263
- if (terminate) break;
2264
- }
2265
- if (!level) {
2266
- state.parentType = oldParentType;
2267
- return false;
2268
- }
2269
- const content = asciiTrim(state.getLines(startLine, nextLine, state.blkIndent, false));
2270
- state.line = nextLine + 1;
2271
- const token_o = state.push("heading_open", `h${level}`, 1);
2272
- token_o.markup = String.fromCharCode(marker);
2273
- token_o.map = [startLine, state.line];
2274
- const token_i = state.push("inline", "", 0);
2275
- token_i.content = content;
2276
- token_i.map = [startLine, state.line - 1];
2277
- token_i.children = [];
2278
- const token_c = state.push("heading_close", `h${level}`, -1);
2279
- token_c.markup = String.fromCharCode(marker);
2280
- state.parentType = oldParentType;
2281
- return true;
2282
- }
2283
- function paragraph(state, startLine, endLine) {
2284
- const terminatorRules = state.md.block.ruler.getRules("paragraph");
2285
- const oldParentType = state.parentType;
2286
- let nextLine = startLine + 1;
2287
- state.parentType = "paragraph";
2288
- for (; nextLine < endLine && !state.isEmpty(nextLine); nextLine++) {
2289
- if (state.sCount[nextLine] - state.blkIndent > 3) continue;
2290
- if (state.sCount[nextLine] < 0) continue;
2291
- let terminate = false;
2292
- for (let i = 0, l = terminatorRules.length; i < l; i++) if (terminatorRules[i](state, nextLine, endLine, true)) {
2293
- terminate = true;
2294
- break;
2295
- }
2296
- if (terminate) break;
2297
- }
2298
- const content = asciiTrim(state.getLines(startLine, nextLine, state.blkIndent, false));
2299
- state.line = nextLine;
2300
- const token_o = state.push("paragraph_open", "p", 1);
2301
- token_o.map = [startLine, state.line];
2302
- const token_i = state.push("inline", "", 0);
2303
- token_i.content = content;
2304
- token_i.map = [startLine, state.line];
2305
- token_i.children = [];
2306
- state.push("paragraph_close", "p", -1);
2307
- state.parentType = oldParentType;
2308
- return true;
2309
- }
2310
- var _rules$1 = [
2311
- [
2312
- "table",
2313
- table,
2314
- ["paragraph", "reference"]
2315
- ],
2316
- ["code", code],
2317
- [
2318
- "fence",
2319
- fence,
2320
- [
2321
- "paragraph",
2322
- "reference",
2323
- "blockquote",
2324
- "list"
2325
- ]
2326
- ],
2327
- [
2328
- "blockquote",
2329
- blockquote,
2330
- [
2331
- "paragraph",
2332
- "reference",
2333
- "blockquote",
2334
- "list"
2335
- ]
2336
- ],
2337
- [
2338
- "hr",
2339
- hr,
2340
- [
2341
- "paragraph",
2342
- "reference",
2343
- "blockquote",
2344
- "list"
2345
- ]
2346
- ],
2347
- [
2348
- "list",
2349
- list,
2350
- [
2351
- "paragraph",
2352
- "reference",
2353
- "blockquote"
2354
- ]
2355
- ],
2356
- ["reference", reference],
2357
- [
2358
- "html_block",
2359
- html_block,
2360
- [
2361
- "paragraph",
2362
- "reference",
2363
- "blockquote"
2364
- ]
2365
- ],
2366
- [
2367
- "heading",
2368
- heading,
2369
- [
2370
- "paragraph",
2371
- "reference",
2372
- "blockquote"
2373
- ]
2374
- ],
2375
- ["lheading", lheading],
2376
- ["paragraph", paragraph]
2377
- ];
2378
- /**
2379
- * Block-level tokenizer.
2380
- */
2381
- var ParserBlock = class {
2382
- constructor() {
2383
- _defineProperty(
2384
- this,
2385
- /**
2386
- * {@link Ruler} instance. Keep configuration of block rules.
2387
- */
2388
- "ruler",
2389
- new Ruler()
2390
- );
2391
- _defineProperty(this, "State", StateBlock);
2392
- for (let i = 0; i < _rules$1.length; i++) this.ruler.push(_rules$1[i][0], _rules$1[i][1], { alt: (_rules$1[i][2] || []).slice() });
2393
- }
2394
- tokenize(state, startLine, endLine) {
2395
- const rules = this.ruler.getRules("");
2396
- const len = rules.length;
2397
- const maxNesting = state.md.options.maxNesting;
2398
- let line = startLine;
2399
- let hasEmptyLines = false;
2400
- while (line < endLine) {
2401
- state.line = line = state.skipEmptyLines(line);
2402
- if (line >= endLine) break;
2403
- if (state.sCount[line] < state.blkIndent) break;
2404
- if (state.level >= maxNesting) {
2405
- state.line = endLine;
2406
- break;
2407
- }
2408
- const prevLine = state.line;
2409
- let ok = false;
2410
- for (let i = 0; i < len; i++) {
2411
- ok = rules[i](state, line, endLine, false);
2412
- if (ok) {
2413
- if (prevLine >= state.line) throw new Error("block rule didn't increment state.line");
2414
- break;
2415
- }
2416
- }
2417
- if (!ok) throw new Error("none of the block rules matched");
2418
- state.tight = !hasEmptyLines;
2419
- if (state.isEmpty(state.line - 1)) hasEmptyLines = true;
2420
- line = state.line;
2421
- if (line < endLine && state.isEmpty(line)) {
2422
- hasEmptyLines = true;
2423
- line++;
2424
- state.line = line;
2425
- }
2426
- }
2427
- }
2428
- /**
2429
- * Process input string and push block tokens into `outTokens`
2430
- */
2431
- parse(src, md, env, outTokens) {
2432
- if (!src) return;
2433
- const state = new this.State(src, md, env, outTokens);
2434
- this.tokenize(state, state.line, state.lineMax);
2435
- }
2436
- };
2437
- /** Mutable state passed to inline rules while tokenizing inline content. */
2438
- var StateInline = class {
2439
- constructor(src, md, env, outTokens) {
2440
- _defineProperty(this, "pos", 0);
2441
- _defineProperty(this, "level", 0);
2442
- _defineProperty(this, "pending", "");
2443
- _defineProperty(this, "pendingLevel", 0);
2444
- _defineProperty(this, "cache", {});
2445
- _defineProperty(this, "backticks", {});
2446
- _defineProperty(this, "backticksScanned", false);
2447
- _defineProperty(this, "linkLevel", 0);
2448
- _defineProperty(this, "delimiters", []);
2449
- _defineProperty(this, "_prev_delimiters", []);
2450
- _defineProperty(this, "Token", Token);
2451
- this.src = src;
2452
- this.env = env;
2453
- this.md = md;
2454
- this.tokens = outTokens;
2455
- this.tokens_meta = Array(outTokens.length);
2456
- this.posMax = this.src.length;
2457
- }
2458
- pushPending() {
2459
- const token = new Token("text", "", 0);
2460
- token.content = this.pending;
2461
- token.level = this.pendingLevel;
2462
- this.tokens.push(token);
2463
- this.pending = "";
2464
- return token;
2465
- }
2466
- push(type, tag, nesting) {
2467
- if (this.pending) this.pushPending();
2468
- const token = new Token(type, tag, nesting);
2469
- let token_meta = void 0;
2470
- if (nesting < 0) {
2471
- this.level--;
2472
- this.delimiters = this._prev_delimiters.pop();
2473
- }
2474
- token.level = this.level;
2475
- if (nesting > 0) {
2476
- this.level++;
2477
- this._prev_delimiters.push(this.delimiters);
2478
- this.delimiters = [];
2479
- token_meta = { delimiters: this.delimiters };
2480
- }
2481
- this.pendingLevel = this.level;
2482
- this.tokens.push(token);
2483
- this.tokens_meta.push(token_meta);
2484
- return token;
2485
- }
2486
- scanDelims(start, canSplitWord) {
2487
- const max = this.posMax;
2488
- const marker = this.src.charCodeAt(start);
2489
- let lastChar;
2490
- if (start === 0) lastChar = 32;
2491
- else if (start === 1) {
2492
- lastChar = this.src.charCodeAt(0);
2493
- if ((lastChar & 63488) === 55296) lastChar = 65533;
2494
- } else {
2495
- lastChar = this.src.charCodeAt(start - 1);
2496
- if ((lastChar & 64512) === 56320) {
2497
- const highSurr = this.src.charCodeAt(start - 2);
2498
- lastChar = (highSurr & 64512) === 55296 ? 65536 + (highSurr - 55296 << 10) + (lastChar - 56320) : 65533;
2499
- } else if ((lastChar & 64512) === 55296) lastChar = 65533;
2500
- }
2501
- let pos = start;
2502
- while (pos < max && this.src.charCodeAt(pos) === marker) pos++;
2503
- const count = pos - start;
2504
- let nextChar = pos < max ? this.src.charCodeAt(pos) : 32;
2505
- if ((nextChar & 64512) === 55296) {
2506
- const lowSurr = this.src.charCodeAt(pos + 1);
2507
- nextChar = (lowSurr & 64512) === 56320 ? 65536 + (nextChar - 55296 << 10) + (lowSurr - 56320) : 65533;
2508
- } else if ((nextChar & 64512) === 56320) nextChar = 65533;
2509
- const isLastPunctChar = isMdAsciiPunct(lastChar) || isPunctCharCode(lastChar);
2510
- const isNextPunctChar = isMdAsciiPunct(nextChar) || isPunctCharCode(nextChar);
2511
- const isLastWhiteSpace = isWhiteSpace(lastChar);
2512
- const isNextWhiteSpace = isWhiteSpace(nextChar);
2513
- const left_flanking = !isNextWhiteSpace && (!isNextPunctChar || isLastWhiteSpace || isLastPunctChar);
2514
- const right_flanking = !isLastWhiteSpace && (!isLastPunctChar || isNextWhiteSpace || isNextPunctChar);
2515
- return {
2516
- can_open: left_flanking && (canSplitWord || !right_flanking || isLastPunctChar),
2517
- can_close: right_flanking && (canSplitWord || !left_flanking || isNextPunctChar),
2518
- length: count
2519
- };
2520
- }
2521
- };
2522
- function isTerminatorChar(ch) {
2523
- switch (ch) {
2524
- case 10:
2525
- case 33:
2526
- case 35:
2527
- case 36:
2528
- case 37:
2529
- case 38:
2530
- case 42:
2531
- case 43:
2532
- case 45:
2533
- case 58:
2534
- case 60:
2535
- case 61:
2536
- case 62:
2537
- case 64:
2538
- case 91:
2539
- case 92:
2540
- case 93:
2541
- case 94:
2542
- case 95:
2543
- case 96:
2544
- case 123:
2545
- case 125:
2546
- case 126: return true;
2547
- default: return false;
2548
- }
2549
- }
2550
- function text(state, silent) {
2551
- let pos = state.pos;
2552
- while (pos < state.posMax && !isTerminatorChar(state.src.charCodeAt(pos))) pos++;
2553
- if (pos === state.pos) return false;
2554
- if (!silent) state.pending += state.src.slice(state.pos, pos);
2555
- state.pos = pos;
2556
- return true;
2557
- }
2558
- function isAsciiAlpha(code) {
2559
- return code >= 65 && code <= 90 || code >= 97 && code <= 122;
2560
- }
2561
- function isSchemeChar(code) {
2562
- return code >= 65 && code <= 90 || code >= 97 && code <= 122 || code >= 48 && code <= 57 || code === 43 || code === 45 || code === 46;
2563
- }
2564
- function linkify(state, silent) {
2565
- if (!state.md.options.linkify) return false;
2566
- if (state.linkLevel > 0) return false;
2567
- const pos = state.pos;
2568
- const max = state.posMax;
2569
- if (pos + 3 > max) return false;
2570
- if (state.src.charCodeAt(pos) !== 58) return false;
2571
- if (state.src.charCodeAt(pos + 1) !== 47) return false;
2572
- if (state.src.charCodeAt(pos + 2) !== 47) return false;
2573
- const protoMin = pos - Math.min(10, state.pending.length, pos);
2574
- let protoStart = pos;
2575
- while (protoStart > protoMin && isSchemeChar(state.src.charCodeAt(protoStart - 1))) protoStart--;
2576
- if (protoStart === pos || !isAsciiAlpha(state.src.charCodeAt(protoStart))) return false;
2577
- const protoLength = pos - protoStart;
2578
- const link = state.md.linkify.matchAtStart(state.src.slice(protoStart));
2579
- if (!link) return false;
2580
- let url = link.url;
2581
- if (url.length <= protoLength) return false;
2582
- let urlEnd = url.length;
2583
- while (urlEnd > 0 && url.charCodeAt(urlEnd - 1) === 42) urlEnd--;
2584
- if (urlEnd !== url.length) url = url.slice(0, urlEnd);
2585
- const fullUrl = state.md.normalizeLink(url);
2586
- if (!state.md.validateLink(fullUrl)) return false;
2587
- if (!silent) {
2588
- state.pending = state.pending.slice(0, -protoLength);
2589
- const token_o = state.push("link_open", "a", 1);
2590
- token_o.attrs = [["href", fullUrl]];
2591
- token_o.markup = "linkify";
2592
- token_o.info = "auto";
2593
- const token_t = state.push("text", "", 0);
2594
- token_t.content = state.md.normalizeLinkText(url);
2595
- const token_c = state.push("link_close", "a", -1);
2596
- token_c.markup = "linkify";
2597
- token_c.info = "auto";
2598
- }
2599
- state.pos += url.length - protoLength;
2600
- return true;
2601
- }
2602
- function newline(state, silent) {
2603
- let pos = state.pos;
2604
- if (state.src.charCodeAt(pos) !== 10) return false;
2605
- const pmax = state.pending.length - 1;
2606
- const max = state.posMax;
2607
- if (!silent) if (pmax >= 0 && state.pending.charCodeAt(pmax) === 32) if (pmax >= 1 && state.pending.charCodeAt(pmax - 1) === 32) {
2608
- let ws = pmax - 1;
2609
- while (ws >= 1 && state.pending.charCodeAt(ws - 1) === 32) ws--;
2610
- state.pending = state.pending.slice(0, ws);
2611
- state.push("hardbreak", "br", 0);
2612
- } else {
2613
- state.pending = state.pending.slice(0, -1);
2614
- state.push("softbreak", "br", 0);
2615
- }
2616
- else state.push("softbreak", "br", 0);
2617
- pos++;
2618
- while (pos < max && isSpace(state.src.charCodeAt(pos))) pos++;
2619
- state.pos = pos;
2620
- return true;
2621
- }
2622
- var ESCAPED = [];
2623
- for (let i = 0; i < 256; i++) ESCAPED.push(0);
2624
- "\\!\"#$%&'()*+,./:;<=>?@[]^_`{|}~-".split("").forEach(function(ch) {
2625
- ESCAPED[ch.charCodeAt(0)] = 1;
2626
- });
2627
- function escape(state, silent) {
2628
- let pos = state.pos;
2629
- const max = state.posMax;
2630
- if (state.src.charCodeAt(pos) !== 92) return false;
2631
- pos++;
2632
- if (pos >= max) return false;
2633
- let ch1 = state.src.charCodeAt(pos);
2634
- if (ch1 === 10) {
2635
- if (!silent) state.push("hardbreak", "br", 0);
2636
- pos++;
2637
- while (pos < max) {
2638
- ch1 = state.src.charCodeAt(pos);
2639
- if (!isSpace(ch1)) break;
2640
- pos++;
2641
- }
2642
- state.pos = pos;
2643
- return true;
2644
- }
2645
- if (ch1 === 32) {
2646
- if (!silent) {
2647
- const token = state.push("text_special", "", 0);
2648
- token.content = "\\";
2649
- token.markup = "\\";
2650
- token.info = "escape";
2651
- }
2652
- state.pos = pos;
2653
- return true;
2654
- }
2655
- let escapedStr = state.src[pos];
2656
- if (ch1 >= 55296 && ch1 <= 56319 && pos + 1 < max) {
2657
- const ch2 = state.src.charCodeAt(pos + 1);
2658
- if (ch2 >= 56320 && ch2 <= 57343) {
2659
- escapedStr += state.src[pos + 1];
2660
- pos++;
2661
- }
2662
- }
2663
- const origStr = "\\" + escapedStr;
2664
- if (!silent) {
2665
- const token = state.push("text_special", "", 0);
2666
- if (ch1 < 256 && ESCAPED[ch1] !== 0) token.content = escapedStr;
2667
- else token.content = origStr;
2668
- token.markup = origStr;
2669
- token.info = "escape";
2670
- }
2671
- state.pos = pos + 1;
2672
- return true;
2673
- }
2674
- function buildLastRuns(src) {
2675
- const lastRuns = {};
2676
- let pos = 0;
2677
- while ((pos = src.indexOf("`", pos)) !== -1) {
2678
- const start = pos;
2679
- while (src.charCodeAt(++pos) === 96);
2680
- lastRuns[pos - start] = start;
2681
- }
2682
- return lastRuns;
2683
- }
2684
- function backtick(state, silent) {
2685
- var _state$backticks$open;
2686
- const start = state.pos;
2687
- if (state.src.charCodeAt(start) !== 96) return false;
2688
- const max = state.posMax;
2689
- let pos = start + 1;
2690
- while (pos < max && state.src.charCodeAt(pos) === 96) pos++;
2691
- const marker = state.src.slice(start, pos);
2692
- const openerLength = marker.length;
2693
- if (!state.backticksScanned) {
2694
- state.backticks = buildLastRuns(state.src);
2695
- state.backticksScanned = true;
2696
- }
2697
- if (((_state$backticks$open = state.backticks[openerLength]) !== null && _state$backticks$open !== void 0 ? _state$backticks$open : -1) >= pos) {
2698
- let matchEnd = pos;
2699
- let matchStart;
2700
- while ((matchStart = state.src.indexOf("`", matchEnd)) !== -1 && matchStart < max) {
2701
- matchEnd = matchStart + 1;
2702
- while (state.src.charCodeAt(matchEnd) === 96) matchEnd++;
2703
- if (matchEnd > max) break;
2704
- if (matchEnd - matchStart === openerLength) {
2705
- if (!silent) {
2706
- const token = state.push("code_inline", "code", 0);
2707
- token.markup = marker;
2708
- let content = state.src.slice(pos, matchStart).replace(/\n/g, " ");
2709
- if (content.startsWith(" ") && content.endsWith(" ") && /[^ ]/.test(content)) content = content.slice(1, -1);
2710
- token.content = content;
2711
- }
2712
- state.pos = matchEnd;
2713
- return true;
2714
- }
2715
- }
2716
- }
2717
- if (!silent) state.pending += marker;
2718
- state.pos = pos;
2719
- return true;
2720
- }
2721
- function strikethrough_tokenize(state, silent) {
2722
- const start = state.pos;
2723
- const marker = state.src.charCodeAt(start);
2724
- if (silent) return false;
2725
- if (marker !== 126) return false;
2726
- const scanned = state.scanDelims(state.pos, true);
2727
- let len = scanned.length;
2728
- const ch = String.fromCharCode(marker);
2729
- if (len < 2) return false;
2730
- let token;
2731
- if (len % 2) {
2732
- token = state.push("text", "", 0);
2733
- token.content = ch;
2734
- len--;
2735
- }
2736
- for (let i = 0; i < len; i += 2) {
2737
- token = state.push("text", "", 0);
2738
- token.content = ch + ch;
2739
- state.delimiters.push({
2740
- marker,
2741
- length: 0,
2742
- token: state.tokens.length - 1,
2743
- end: -1,
2744
- open: scanned.can_open,
2745
- close: scanned.can_close
2746
- });
2747
- }
2748
- state.pos += scanned.length;
2749
- return true;
2750
- }
2751
- function postProcess$1(state, delimiters) {
2752
- let token;
2753
- const loneMarkers = [];
2754
- const max = delimiters.length;
2755
- for (let i = 0; i < max; i++) {
2756
- const startDelim = delimiters[i];
2757
- if (startDelim.marker !== 126) continue;
2758
- if (startDelim.end === -1) continue;
2759
- const endDelim = delimiters[startDelim.end];
2760
- token = state.tokens[startDelim.token];
2761
- token.type = "s_open";
2762
- token.tag = "s";
2763
- token.nesting = 1;
2764
- token.markup = "~~";
2765
- token.content = "";
2766
- token = state.tokens[endDelim.token];
2767
- token.type = "s_close";
2768
- token.tag = "s";
2769
- token.nesting = -1;
2770
- token.markup = "~~";
2771
- token.content = "";
2772
- if (state.tokens[endDelim.token - 1].type === "text" && state.tokens[endDelim.token - 1].content === "~") loneMarkers.push(endDelim.token - 1);
2773
- }
2774
- while (loneMarkers.length) {
2775
- const i = loneMarkers.pop();
2776
- let j = i + 1;
2777
- while (j < state.tokens.length && state.tokens[j].type === "s_close") j++;
2778
- j--;
2779
- if (i !== j) {
2780
- token = state.tokens[j];
2781
- state.tokens[j] = state.tokens[i];
2782
- state.tokens[i] = token;
2783
- }
2784
- }
2785
- }
2786
- function strikethrough_postProcess(state) {
2787
- const tokens_meta = state.tokens_meta;
2788
- const max = state.tokens_meta.length;
2789
- postProcess$1(state, state.delimiters);
2790
- for (let curr = 0; curr < max; curr++) {
2791
- var _tokens_meta$curr;
2792
- const delimiters = (_tokens_meta$curr = tokens_meta[curr]) === null || _tokens_meta$curr === void 0 ? void 0 : _tokens_meta$curr.delimiters;
2793
- if (delimiters) postProcess$1(state, delimiters);
2794
- }
2795
- }
2796
- var strikethrough_default = {
2797
- tokenize: strikethrough_tokenize,
2798
- postProcess: strikethrough_postProcess
2799
- };
2800
- function emphasis_tokenize(state, silent) {
2801
- const start = state.pos;
2802
- const marker = state.src.charCodeAt(start);
2803
- if (silent) return false;
2804
- if (marker !== 95 && marker !== 42) return false;
2805
- const scanned = state.scanDelims(state.pos, marker === 42);
2806
- for (let i = 0; i < scanned.length; i++) {
2807
- const token = state.push("text", "", 0);
2808
- token.content = String.fromCharCode(marker);
2809
- state.delimiters.push({
2810
- marker,
2811
- length: scanned.length,
2812
- token: state.tokens.length - 1,
2813
- end: -1,
2814
- open: scanned.can_open,
2815
- close: scanned.can_close
2816
- });
2817
- }
2818
- state.pos += scanned.length;
2819
- return true;
2820
- }
2821
- function postProcess(state, delimiters) {
2822
- const max = delimiters.length;
2823
- for (let i = max - 1; i >= 0; i--) {
2824
- const startDelim = delimiters[i];
2825
- if (startDelim.marker !== 95 && startDelim.marker !== 42) continue;
2826
- if (startDelim.end === -1) continue;
2827
- const endDelim = delimiters[startDelim.end];
2828
- const isStrong = i > 0 && delimiters[i - 1].end === startDelim.end + 1 && delimiters[i - 1].marker === startDelim.marker && delimiters[i - 1].token === startDelim.token - 1 && delimiters[startDelim.end + 1].token === endDelim.token + 1;
2829
- const ch = String.fromCharCode(startDelim.marker);
2830
- const token_o = state.tokens[startDelim.token];
2831
- token_o.type = isStrong ? "strong_open" : "em_open";
2832
- token_o.tag = isStrong ? "strong" : "em";
2833
- token_o.nesting = 1;
2834
- token_o.markup = isStrong ? ch + ch : ch;
2835
- token_o.content = "";
2836
- const token_c = state.tokens[endDelim.token];
2837
- token_c.type = isStrong ? "strong_close" : "em_close";
2838
- token_c.tag = isStrong ? "strong" : "em";
2839
- token_c.nesting = -1;
2840
- token_c.markup = isStrong ? ch + ch : ch;
2841
- token_c.content = "";
2842
- if (isStrong) {
2843
- state.tokens[delimiters[i - 1].token].content = "";
2844
- state.tokens[delimiters[startDelim.end + 1].token].content = "";
2845
- i--;
2846
- }
2847
- }
2848
- }
2849
- function emphasis_post_process(state) {
2850
- const tokens_meta = state.tokens_meta;
2851
- const max = state.tokens_meta.length;
2852
- postProcess(state, state.delimiters);
2853
- for (let curr = 0; curr < max; curr++) {
2854
- var _tokens_meta$curr;
2855
- const delimiters = (_tokens_meta$curr = tokens_meta[curr]) === null || _tokens_meta$curr === void 0 ? void 0 : _tokens_meta$curr.delimiters;
2856
- if (delimiters) postProcess(state, delimiters);
2857
- }
2858
- }
2859
- var emphasis_default = {
2860
- tokenize: emphasis_tokenize,
2861
- postProcess: emphasis_post_process
2862
- };
2863
- function link(state, silent) {
2864
- let code, label, res, ref;
2865
- let href = "";
2866
- let title = "";
2867
- let start = state.pos;
2868
- let parseReference = true;
2869
- if (state.src.charCodeAt(state.pos) !== 91) return false;
2870
- const oldPos = state.pos;
2871
- const max = state.posMax;
2872
- const labelStart = state.pos + 1;
2873
- const labelEnd = state.md.helpers.parseLinkLabel(state, state.pos, true);
2874
- if (labelEnd < 0) return false;
2875
- let pos = labelEnd + 1;
2876
- if (pos < max && state.src.charCodeAt(pos) === 40) {
2877
- parseReference = false;
2878
- pos++;
2879
- for (; pos < max; pos++) {
2880
- code = state.src.charCodeAt(pos);
2881
- if (!isSpace(code) && code !== 10) break;
2882
- }
2883
- if (pos >= max) return false;
2884
- start = pos;
2885
- res = state.md.helpers.parseLinkDestination(state.src, pos, state.posMax);
2886
- if (res.ok) {
2887
- href = state.md.normalizeLink(res.str);
2888
- if (state.md.validateLink(href)) pos = res.pos;
2889
- else href = "";
2890
- start = pos;
2891
- for (; pos < max; pos++) {
2892
- code = state.src.charCodeAt(pos);
2893
- if (!isSpace(code) && code !== 10) break;
2894
- }
2895
- res = state.md.helpers.parseLinkTitle(state.src, pos, state.posMax);
2896
- if (pos < max && start !== pos && res.ok) {
2897
- title = res.str;
2898
- pos = res.pos;
2899
- for (; pos < max; pos++) {
2900
- code = state.src.charCodeAt(pos);
2901
- if (!isSpace(code) && code !== 10) break;
2902
- }
2903
- }
2904
- }
2905
- if (pos >= max || state.src.charCodeAt(pos) !== 41) parseReference = true;
2906
- pos++;
2907
- }
2908
- if (parseReference) {
2909
- if (typeof state.env.references === "undefined") return false;
2910
- if (pos < max && state.src.charCodeAt(pos) === 91) {
2911
- start = pos + 1;
2912
- pos = state.md.helpers.parseLinkLabel(state, pos);
2913
- if (pos >= 0) label = state.src.slice(start, pos++);
2914
- else pos = labelEnd + 1;
2915
- } else pos = labelEnd + 1;
2916
- if (!label) label = state.src.slice(labelStart, labelEnd);
2917
- label = normalizeReference(label);
2918
- ref = state.env.references[label];
2919
- if (!ref) {
2920
- state.pos = oldPos;
2921
- return false;
2922
- }
2923
- href = ref.href;
2924
- title = ref.title;
2925
- }
2926
- if (!silent) {
2927
- state.pos = labelStart;
2928
- state.posMax = labelEnd;
2929
- const token_o = state.push("link_open", "a", 1);
2930
- const attrs = [["href", href]];
2931
- token_o.attrs = attrs;
2932
- if (title) attrs.push(["title", title]);
2933
- if (label) {
2934
- const meta = Object.create(null);
2935
- meta.label = label;
2936
- token_o.meta = meta;
2937
- }
2938
- state.linkLevel++;
2939
- state.md.inline.tokenize(state);
2940
- state.linkLevel--;
2941
- state.push("link_close", "a", -1);
2942
- }
2943
- state.pos = pos;
2944
- state.posMax = max;
2945
- return true;
2946
- }
2947
- function image(state, silent) {
2948
- let code, content, label, pos, ref, res, title, start;
2949
- let href = "";
2950
- const oldPos = state.pos;
2951
- const max = state.posMax;
2952
- if (state.src.charCodeAt(state.pos) !== 33) return false;
2953
- if (state.src.charCodeAt(state.pos + 1) !== 91) return false;
2954
- const labelStart = state.pos + 2;
2955
- const labelEnd = state.md.helpers.parseLinkLabel(state, state.pos + 1, false);
2956
- if (labelEnd < 0) return false;
2957
- pos = labelEnd + 1;
2958
- if (pos < max && state.src.charCodeAt(pos) === 40) {
2959
- pos++;
2960
- for (; pos < max; pos++) {
2961
- code = state.src.charCodeAt(pos);
2962
- if (!isSpace(code) && code !== 10) break;
2963
- }
2964
- if (pos >= max) return false;
2965
- start = pos;
2966
- res = state.md.helpers.parseLinkDestination(state.src, pos, state.posMax);
2967
- if (res.ok) {
2968
- href = state.md.normalizeLink(res.str);
2969
- if (state.md.validateLink(href)) pos = res.pos;
2970
- else href = "";
2971
- }
2972
- start = pos;
2973
- for (; pos < max; pos++) {
2974
- code = state.src.charCodeAt(pos);
2975
- if (!isSpace(code) && code !== 10) break;
2976
- }
2977
- res = state.md.helpers.parseLinkTitle(state.src, pos, state.posMax);
2978
- if (pos < max && start !== pos && res.ok) {
2979
- title = res.str;
2980
- pos = res.pos;
2981
- for (; pos < max; pos++) {
2982
- code = state.src.charCodeAt(pos);
2983
- if (!isSpace(code) && code !== 10) break;
2984
- }
2985
- } else title = "";
2986
- if (pos >= max || state.src.charCodeAt(pos) !== 41) {
2987
- state.pos = oldPos;
2988
- return false;
2989
- }
2990
- pos++;
2991
- } else {
2992
- if (typeof state.env.references === "undefined") return false;
2993
- if (pos < max && state.src.charCodeAt(pos) === 91) {
2994
- start = pos + 1;
2995
- pos = state.md.helpers.parseLinkLabel(state, pos);
2996
- if (pos >= 0) label = state.src.slice(start, pos++);
2997
- else pos = labelEnd + 1;
2998
- } else pos = labelEnd + 1;
2999
- if (!label) label = state.src.slice(labelStart, labelEnd);
3000
- label = normalizeReference(label);
3001
- ref = state.env.references[label];
3002
- if (!ref) {
3003
- state.pos = oldPos;
3004
- return false;
3005
- }
3006
- href = ref.href;
3007
- title = ref.title;
3008
- }
3009
- if (!silent) {
3010
- content = state.src.slice(labelStart, labelEnd);
3011
- const tokens = [];
3012
- state.md.inline.parse(content, state.md, state.env, tokens);
3013
- const token = state.push("image", "img", 0);
3014
- const attrs = [["src", href], ["alt", ""]];
3015
- token.attrs = attrs;
3016
- token.children = tokens;
3017
- token.content = content;
3018
- if (title) attrs.push(["title", title]);
3019
- if (label) {
3020
- const meta = Object.create(null);
3021
- meta.label = label;
3022
- token.meta = meta;
3023
- }
3024
- }
3025
- state.pos = pos;
3026
- state.posMax = max;
3027
- return true;
3028
- }
3029
- var EMAIL_RE = /^([a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*)$/;
3030
- var AUTOLINK_RE = /^([a-zA-Z][a-zA-Z0-9+.-]{1,31}):([^<>\x00-\x20]*)$/;
3031
- function autolink(state, silent) {
3032
- let pos = state.pos;
3033
- if (state.src.charCodeAt(pos) !== 60) return false;
3034
- const start = state.pos;
3035
- const max = state.posMax;
3036
- for (;;) {
3037
- if (++pos >= max) return false;
3038
- const ch = state.src.charCodeAt(pos);
3039
- if (ch === 60) return false;
3040
- if (ch === 62) break;
3041
- }
3042
- const url = state.src.slice(start + 1, pos);
3043
- if (AUTOLINK_RE.test(url)) {
3044
- const fullUrl = state.md.normalizeLink(url);
3045
- if (!state.md.validateLink(fullUrl)) return false;
3046
- if (!silent) {
3047
- const token_o = state.push("link_open", "a", 1);
3048
- token_o.attrs = [["href", fullUrl]];
3049
- token_o.markup = "autolink";
3050
- token_o.info = "auto";
3051
- const token_t = state.push("text", "", 0);
3052
- token_t.content = state.md.normalizeLinkText(url);
3053
- const token_c = state.push("link_close", "a", -1);
3054
- token_c.markup = "autolink";
3055
- token_c.info = "auto";
3056
- }
3057
- state.pos += url.length + 2;
3058
- return true;
3059
- }
3060
- if (EMAIL_RE.test(url)) {
3061
- const fullUrl = state.md.normalizeLink(`mailto:${url}`);
3062
- if (!state.md.validateLink(fullUrl)) return false;
3063
- if (!silent) {
3064
- const token_o = state.push("link_open", "a", 1);
3065
- token_o.attrs = [["href", fullUrl]];
3066
- token_o.markup = "autolink";
3067
- token_o.info = "auto";
3068
- const token_t = state.push("text", "", 0);
3069
- token_t.content = state.md.normalizeLinkText(url);
3070
- const token_c = state.push("link_close", "a", -1);
3071
- token_c.markup = "autolink";
3072
- token_c.info = "auto";
3073
- }
3074
- state.pos += url.length + 2;
3075
- return true;
3076
- }
3077
- return false;
3078
- }
3079
- function isLinkOpen(str) {
3080
- return /^<a[>\s]/i.test(str);
3081
- }
3082
- function isLinkClose(str) {
3083
- return /^<\/a\s*>/i.test(str);
3084
- }
3085
- function isLetter(ch) {
3086
- const lc = ch | 32;
3087
- return lc >= 97 && lc <= 122;
3088
- }
3089
- function html_inline(state, silent) {
3090
- if (!state.md.options.html) return false;
3091
- const max = state.posMax;
3092
- const pos = state.pos;
3093
- if (state.src.charCodeAt(pos) !== 60 || pos + 2 >= max) return false;
3094
- const ch = state.src.charCodeAt(pos + 1);
3095
- if (ch !== 33 && ch !== 63 && ch !== 47 && !isLetter(ch)) return false;
3096
- const match = state.src.slice(pos).match(HTML_TAG_RE);
3097
- if (!match) return false;
3098
- if (!silent) {
3099
- const token = state.push("html_inline", "", 0);
3100
- token.content = match[0];
3101
- if (isLinkOpen(token.content)) state.linkLevel++;
3102
- if (isLinkClose(token.content)) state.linkLevel--;
3103
- }
3104
- state.pos += match[0].length;
3105
- return true;
3106
- }
3107
- var DIGITAL_RE = /^&#((?:x[a-f0-9]{1,6}|[0-9]{1,7}));/i;
3108
- var NAMED_RE = /^&([a-z][a-z0-9]{1,31});/i;
3109
- function entity(state, silent) {
3110
- const pos = state.pos;
3111
- const max = state.posMax;
3112
- if (state.src.charCodeAt(pos) !== 38) return false;
3113
- if (pos + 1 >= max) return false;
3114
- if (state.src.charCodeAt(pos + 1) === 35) {
3115
- const match = state.src.slice(pos).match(DIGITAL_RE);
3116
- if (match) {
3117
- if (!silent) {
3118
- const code = match[1][0].toLowerCase() === "x" ? parseInt(match[1].slice(1), 16) : parseInt(match[1], 10);
3119
- const token = state.push("text_special", "", 0);
3120
- token.content = isValidEntityCode(code) ? fromCodePoint(code) : fromCodePoint(65533);
3121
- token.markup = match[0];
3122
- token.info = "entity";
3123
- }
3124
- state.pos += match[0].length;
3125
- return true;
3126
- }
3127
- } else {
3128
- const match = state.src.slice(pos).match(NAMED_RE);
3129
- if (match) {
3130
- const decoded = require_decode$1.decodeHTMLStrict(match[0]);
3131
- if (decoded !== match[0]) {
3132
- if (!silent) {
3133
- const token = state.push("text_special", "", 0);
3134
- token.content = decoded;
3135
- token.markup = match[0];
3136
- token.info = "entity";
3137
- }
3138
- state.pos += match[0].length;
3139
- return true;
3140
- }
3141
- }
3142
- }
3143
- return false;
3144
- }
3145
- function processDelimiters(delimiters) {
3146
- const openersBottom = {};
3147
- const max = delimiters.length;
3148
- if (!max) return;
3149
- let headerIdx = 0;
3150
- let lastTokenIdx = -2;
3151
- const jumps = [];
3152
- for (let closerIdx = 0; closerIdx < max; closerIdx++) {
3153
- const closer = delimiters[closerIdx];
3154
- jumps.push(0);
3155
- if (delimiters[headerIdx].marker !== closer.marker || lastTokenIdx !== closer.token - 1) headerIdx = closerIdx;
3156
- lastTokenIdx = closer.token;
3157
- closer.length = closer.length || 0;
3158
- if (!closer.close) continue;
3159
- if (!openersBottom.hasOwnProperty(closer.marker)) openersBottom[closer.marker] = [
3160
- -1,
3161
- -1,
3162
- -1,
3163
- -1,
3164
- -1,
3165
- -1
3166
- ];
3167
- const minOpenerIdx = openersBottom[closer.marker][(closer.open ? 3 : 0) + closer.length % 3];
3168
- let openerIdx = headerIdx - jumps[headerIdx] - 1;
3169
- let newMinOpenerIdx = openerIdx;
3170
- for (; openerIdx > minOpenerIdx; openerIdx -= jumps[openerIdx] + 1) {
3171
- const opener = delimiters[openerIdx];
3172
- if (opener.marker !== closer.marker) continue;
3173
- if (opener.open && opener.end < 0) {
3174
- let isOddMatch = false;
3175
- if (opener.close || closer.open) {
3176
- if ((opener.length + closer.length) % 3 === 0) {
3177
- if (opener.length % 3 !== 0 || closer.length % 3 !== 0) isOddMatch = true;
3178
- }
3179
- }
3180
- if (!isOddMatch) {
3181
- const lastJump = openerIdx > 0 && !delimiters[openerIdx - 1].open ? jumps[openerIdx - 1] + 1 : 0;
3182
- jumps[closerIdx] = closerIdx - openerIdx + lastJump;
3183
- jumps[openerIdx] = lastJump;
3184
- closer.open = false;
3185
- opener.end = closerIdx;
3186
- opener.close = false;
3187
- newMinOpenerIdx = -1;
3188
- lastTokenIdx = -2;
3189
- break;
3190
- }
3191
- }
3192
- }
3193
- if (newMinOpenerIdx !== -1) openersBottom[closer.marker][(closer.open ? 3 : 0) + (closer.length || 0) % 3] = newMinOpenerIdx;
3194
- }
3195
- }
3196
- function link_pairs(state) {
3197
- const tokens_meta = state.tokens_meta;
3198
- const max = state.tokens_meta.length;
3199
- processDelimiters(state.delimiters);
3200
- for (let curr = 0; curr < max; curr++) {
3201
- var _tokens_meta$curr;
3202
- const delimiters = (_tokens_meta$curr = tokens_meta[curr]) === null || _tokens_meta$curr === void 0 ? void 0 : _tokens_meta$curr.delimiters;
3203
- if (delimiters) processDelimiters(delimiters);
3204
- }
3205
- }
3206
- function fragments_join(state) {
3207
- let curr, last;
3208
- let level = 0;
3209
- const tokens = state.tokens;
3210
- const max = state.tokens.length;
3211
- for (curr = last = 0; curr < max; curr++) {
3212
- if (tokens[curr].nesting < 0) level--;
3213
- tokens[curr].level = level;
3214
- if (tokens[curr].nesting > 0) level++;
3215
- if (tokens[curr].type === "text" && curr + 1 < max && tokens[curr + 1].type === "text") tokens[curr + 1].content = tokens[curr].content + tokens[curr + 1].content;
3216
- else {
3217
- if (curr !== last) tokens[last] = tokens[curr];
3218
- last++;
3219
- }
3220
- }
3221
- if (curr !== last) tokens.length = last;
3222
- }
3223
- var _rules = [
3224
- ["text", text],
3225
- ["linkify", linkify],
3226
- ["newline", newline],
3227
- ["escape", escape],
3228
- ["backticks", backtick],
3229
- ["strikethrough", strikethrough_default.tokenize],
3230
- ["emphasis", emphasis_default.tokenize],
3231
- ["link", link],
3232
- ["image", image],
3233
- ["autolink", autolink],
3234
- ["html_inline", html_inline],
3235
- ["entity", entity]
3236
- ];
3237
- var _rules2 = [
3238
- ["balance_pairs", link_pairs],
3239
- ["strikethrough", strikethrough_default.postProcess],
3240
- ["emphasis", emphasis_default.postProcess],
3241
- ["fragments_join", fragments_join]
3242
- ];
3243
- /**
3244
- * Tokenizes paragraph content.
3245
- */
3246
- var ParserInline = class {
3247
- constructor() {
3248
- _defineProperty(
3249
- this,
3250
- /**
3251
- * {@link Ruler} instance. Keep configuration of inline rules.
3252
- */
3253
- "ruler",
3254
- new Ruler()
3255
- );
3256
- _defineProperty(
3257
- this,
3258
- /**
3259
- * {@link Ruler} instance. Second ruler used for post-processing
3260
- * (e.g. in emphasis-like rules).
3261
- */
3262
- "ruler2",
3263
- new Ruler()
3264
- );
3265
- _defineProperty(this, "State", StateInline);
3266
- for (let i = 0; i < _rules.length; i++) this.ruler.push(_rules[i][0], _rules[i][1]);
3267
- for (let i = 0; i < _rules2.length; i++) this.ruler2.push(_rules2[i][0], _rules2[i][1]);
3268
- }
3269
- skipToken(state) {
3270
- const pos = state.pos;
3271
- const rules = this.ruler.getRules("");
3272
- const len = rules.length;
3273
- const maxNesting = state.md.options.maxNesting;
3274
- const cache = state.cache;
3275
- if (typeof cache[pos] !== "undefined") {
3276
- state.pos = cache[pos];
3277
- return;
3278
- }
3279
- let ok = false;
3280
- if (state.level < maxNesting) for (let i = 0; i < len; i++) {
3281
- state.level++;
3282
- ok = rules[i](state, true);
3283
- state.level--;
3284
- if (ok) {
3285
- if (pos >= state.pos) throw new Error("inline rule didn't increment state.pos");
3286
- break;
3287
- }
3288
- }
3289
- else state.pos = state.posMax;
3290
- if (!ok) state.pos++;
3291
- cache[pos] = state.pos;
3292
- }
3293
- tokenize(state) {
3294
- const rules = this.ruler.getRules("");
3295
- const len = rules.length;
3296
- const end = state.posMax;
3297
- const maxNesting = state.md.options.maxNesting;
3298
- while (state.pos < end) {
3299
- const prevPos = state.pos;
3300
- let ok = false;
3301
- if (state.level < maxNesting) for (let i = 0; i < len; i++) {
3302
- ok = rules[i](state, false);
3303
- if (ok) {
3304
- if (prevPos >= state.pos) throw new Error("inline rule didn't increment state.pos");
3305
- break;
3306
- }
3307
- }
3308
- if (ok) {
3309
- if (state.pos >= end) break;
3310
- continue;
3311
- }
3312
- state.pending += state.src[state.pos++];
3313
- }
3314
- if (state.pending) state.pushPending();
3315
- }
3316
- /**
3317
- * Process input string and push inline tokens into `outTokens`
3318
- */
3319
- parse(str, md, env, outTokens) {
3320
- const state = new this.State(str, md, env, outTokens);
3321
- this.tokenize(state);
3322
- const rules = this.ruler2.getRules("");
3323
- const len = rules.length;
3324
- for (let i = 0; i < len; i++) rules[i](state);
3325
- }
3326
- };
3327
- var config = {
3328
- default: {
3329
- options: {
3330
- html: false,
3331
- xhtmlOut: false,
3332
- breaks: false,
3333
- langPrefix: "language-",
3334
- linkify: false,
3335
- typographer: false,
3336
- quotes: "“”‘’",
3337
- highlight: null,
3338
- maxNesting: 100
3339
- },
3340
- components: {
3341
- core: {},
3342
- block: {},
3343
- inline: {}
3344
- }
3345
- },
3346
- zero: {
3347
- options: {
3348
- html: false,
3349
- xhtmlOut: false,
3350
- breaks: false,
3351
- langPrefix: "language-",
3352
- linkify: false,
3353
- typographer: false,
3354
- quotes: "“”‘’",
3355
- highlight: null,
3356
- maxNesting: 20
3357
- },
3358
- components: {
3359
- core: { rules: [
3360
- "normalize",
3361
- "block",
3362
- "strip_references",
3363
- "inline",
3364
- "text_join"
3365
- ] },
3366
- block: { rules: ["paragraph"] },
3367
- inline: {
3368
- rules: ["text"],
3369
- rules2: ["balance_pairs", "fragments_join"]
3370
- }
3371
- }
3372
- },
3373
- commonmark: {
3374
- options: {
3375
- html: true,
3376
- xhtmlOut: true,
3377
- breaks: false,
3378
- langPrefix: "language-",
3379
- linkify: false,
3380
- typographer: false,
3381
- quotes: "“”‘’",
3382
- highlight: null,
3383
- maxNesting: 20
3384
- },
3385
- components: {
3386
- core: { rules: [
3387
- "normalize",
3388
- "block",
3389
- "strip_references",
3390
- "inline",
3391
- "text_join"
3392
- ] },
3393
- block: { rules: [
3394
- "blockquote",
3395
- "code",
3396
- "fence",
3397
- "heading",
3398
- "hr",
3399
- "html_block",
3400
- "lheading",
3401
- "list",
3402
- "reference",
3403
- "paragraph"
3404
- ] },
3405
- inline: {
3406
- rules: [
3407
- "autolink",
3408
- "backticks",
3409
- "emphasis",
3410
- "entity",
3411
- "escape",
3412
- "html_inline",
3413
- "image",
3414
- "link",
3415
- "newline",
3416
- "text"
3417
- ],
3418
- rules2: [
3419
- "balance_pairs",
3420
- "emphasis",
3421
- "fragments_join"
3422
- ]
3423
- }
3424
- }
3425
- }
3426
- };
3427
- var BAD_PROTO_RE = /^(vbscript|javascript|file|data):/;
3428
- var GOOD_DATA_RE = /^data:image\/(gif|png|jpeg|webp);/;
3429
- var RECODE_HOSTNAME_FOR = [
3430
- "http:",
3431
- "https:",
3432
- "mailto:"
3433
- ];
3434
- /**
3435
- * Parses Markdown into tokens and renders them to HTML.
3436
- *
3437
- * @category Main
3438
- */
3439
- var MarkdownIt = class {
3440
- /**
3441
- * Link validation function. CommonMark allows too much in links. By default
3442
- * we disable `javascript:`, `vbscript:`, `file:` schemas, and almost all `data:...` schemas
3443
- * except some embedded image types.
3444
- *
3445
- * You can change this behaviour:
3446
- *
3447
- * @example
3448
- * ```javascript
3449
- * import MarkdownIt from 'markdown-it'
3450
- * const md = new MarkdownIt()
3451
- *
3452
- * // enable everything
3453
- * md.validateLink = function () { return true; }
3454
- * ```
3455
- */
3456
- validateLink(url) {
3457
- const str = url.trim().toLowerCase();
3458
- return BAD_PROTO_RE.test(str) ? GOOD_DATA_RE.test(str) : true;
3459
- }
3460
- /**
3461
- * Function used to encode link url to a machine-readable format,
3462
- * which includes url-encoding, punycode, etc.
3463
- */
3464
- normalizeLink(url) {
3465
- const parsed = require_parse.default(url, true);
3466
- if (parsed.hostname) {
3467
- if (!parsed.protocol || RECODE_HOSTNAME_FOR.indexOf(parsed.protocol) >= 0) try {
3468
- parsed.hostname = require_punycode_es6.default.toASCII(parsed.hostname);
3469
- } catch (er) {}
3470
- }
3471
- if (parsed.auth) parsed.auth = require_encode.default(parsed.auth);
3472
- if (parsed.hostname) parsed.hostname = require_encode.default(parsed.hostname);
3473
- if (parsed.pathname) parsed.pathname = require_encode.default(parsed.pathname);
3474
- if (parsed.search) parsed.search = require_encode.default(parsed.search);
3475
- if (parsed.hash) parsed.hash = require_encode.default(parsed.hash);
3476
- return require_format.default(parsed);
3477
- }
3478
- /**
3479
- * Function used to decode link url to a human-readable format`
3480
- */
3481
- normalizeLinkText(url) {
3482
- const parsed = require_parse.default(url, true);
3483
- if (parsed.hostname) {
3484
- if (!parsed.protocol || RECODE_HOSTNAME_FOR.indexOf(parsed.protocol) >= 0) try {
3485
- parsed.hostname = require_punycode_es6.default.toUnicode(parsed.hostname);
3486
- } catch (er) {}
3487
- }
3488
- return require_decode.default(require_format.default(parsed), require_decode.default.defaultChars + "%");
3489
- }
3490
- constructor(...args) {
3491
- _defineProperty(
3492
- this,
3493
- /**
3494
- * Instance of {@link ParserInline}. You may need it to add new rules when
3495
- * writing plugins. For simple rules control use {@link MarkdownIt.disable}
3496
- * and {@link MarkdownIt.enable}.
3497
- */
3498
- "inline",
3499
- new ParserInline()
3500
- );
3501
- _defineProperty(
3502
- this,
3503
- /**
3504
- * Instance of {@link ParserBlock}. You may need it to add new rules when
3505
- * writing plugins. For simple rules control use {@link MarkdownIt.disable}
3506
- * and {@link MarkdownIt.enable}.
3507
- */
3508
- "block",
3509
- new ParserBlock()
3510
- );
3511
- _defineProperty(
3512
- this,
3513
- /**
3514
- * Instance of {@link ParserCore} chain executor. You may need it to add new
3515
- * rules when writing plugins. For simple rules control use
3516
- * {@link MarkdownIt.disable} and {@link MarkdownIt.enable}.
3517
- */
3518
- "core",
3519
- new ParserCore()
3520
- );
3521
- _defineProperty(
3522
- this,
3523
- /**
3524
- * Instance of {@link Renderer}. Use it to modify output look. Or to add rendering
3525
- * rules for new token types, generated by plugins.
3526
- *
3527
- * See {@link Renderer} docs and
3528
- * [source code](https://github.com/markdown-it/markdown-it/blob/master/src/renderer.ts).
3529
- *
3530
- * @example
3531
- * ```javascript
3532
- * import MarkdownIt from 'markdown-it'
3533
- * const md = new MarkdownIt()
3534
- *
3535
- * function myToken(tokens, idx, options, env, self) {
3536
- * //...
3537
- * return result;
3538
- * };
3539
- *
3540
- * md.renderer.rules['my_token'] = myToken
3541
- * ```
3542
- */
3543
- "renderer",
3544
- new Renderer()
3545
- );
3546
- _defineProperty(
3547
- this,
3548
- /**
3549
- * [linkify-it](https://github.com/markdown-it/linkify-it) instance.
3550
- * Used by [linkify](https://github.com/markdown-it/markdown-it/blob/master/src/rules_core/linkify.ts)
3551
- * rule.
3552
- */
3553
- "linkify",
3554
- new require_index$2.LinkifyIt()
3555
- );
3556
- _defineProperty(
3557
- this,
3558
- /**
3559
- * Assorted utility functions, useful to write plugins. See details
3560
- * [here](https://github.com/markdown-it/markdown-it/blob/master/src/common/utils.ts).
3561
- */
3562
- "utils",
3563
- utils_exports
3564
- );
3565
- _defineProperty(
3566
- this,
3567
- /**
3568
- * Link components parser functions, useful to write plugins. See details
3569
- * [here](https://github.com/markdown-it/markdown-it/blob/master/src/helpers).
3570
- */
3571
- "helpers",
3572
- Object.assign({}, helpers_exports)
3573
- );
3574
- const [presetNameOrOptions, options] = args;
3575
- if (typeof presetNameOrOptions === "string") {
3576
- this.configure(presetNameOrOptions);
3577
- if (options) this.set(options);
3578
- } else {
3579
- this.configure("default");
3580
- this.set(presetNameOrOptions || {});
3581
- }
3582
- }
3583
- /**
3584
- * Set parser options (in the same format as in constructor). Probably, you
3585
- * will never need it, but you can change options after constructor call.
3586
- *
3587
- * __Note:__ To achieve the best possible performance, don't modify a
3588
- * `markdown-it` instance options on the fly. If you need multiple configurations
3589
- * it's best to create multiple instances and initialize each with separate
3590
- * config.
3591
- *
3592
- * @example
3593
- * ```javascript
3594
- * import MarkdownIt from 'markdown-it'
3595
- *
3596
- * const md = new MarkdownIt()
3597
- * .set({ html: true, breaks: true })
3598
- * .set({ typographer: true })
3599
- * ```
3600
- */
3601
- set(options) {
3602
- Object.assign(this.options, options);
3603
- return this;
3604
- }
3605
- /**
3606
- * Batch load of all options and compenent settings. This is internal method,
3607
- * and you probably will not need it. But if you will - see available presets
3608
- * and data structure [here](https://github.com/markdown-it/markdown-it/tree/master/src/presets)
3609
- *
3610
- * We strongly recommend to use presets instead of direct config loads. That
3611
- * will give better compatibility with next versions.
3612
- */
3613
- configure(presets) {
3614
- let p;
3615
- if (typeof presets === "string") {
3616
- const presetName = presets;
3617
- p = config[presetName];
3618
- if (!p) throw new Error(`Wrong 'markdown-it' preset "${presetName}", check name`);
3619
- } else p = presets;
3620
- if (!p) throw new Error("Wrong `markdown-it` preset, can't be empty");
3621
- if (p.options) this.options = { ...p.options };
3622
- const components = p.components;
3623
- if (components) {
3624
- var _components$inline;
3625
- [
3626
- "core",
3627
- "block",
3628
- "inline"
3629
- ].forEach((name) => {
3630
- var _components$name;
3631
- const rules = (_components$name = components[name]) === null || _components$name === void 0 ? void 0 : _components$name.rules;
3632
- if (rules) this[name].ruler.enableOnly(rules);
3633
- });
3634
- const rules2 = (_components$inline = components.inline) === null || _components$inline === void 0 ? void 0 : _components$inline.rules2;
3635
- if (rules2) this.inline.ruler2.enableOnly(rules2);
3636
- }
3637
- return this;
3638
- }
3639
- /**
3640
- * Enable list or rules. It will automatically find appropriate components,
3641
- * containing rules with given names. If rule not found, and `ignoreInvalid`
3642
- * not set - throws exception.
3643
- *
3644
- * @example
3645
- * ```javascript
3646
- * import MarkdownIt from 'markdown-it'
3647
- *
3648
- * const md = new MarkdownIt()
3649
- * .enable(['sub', 'sup'])
3650
- * .disable('smartquotes')
3651
- * ```
3652
- */
3653
- enable(list, ignoreInvalid = false) {
3654
- let result = [];
3655
- if (!Array.isArray(list)) list = [list];
3656
- [
3657
- "core",
3658
- "block",
3659
- "inline"
3660
- ].forEach((chain) => {
3661
- result = result.concat(this[chain].ruler.enable(list, true));
3662
- });
3663
- result = result.concat(this.inline.ruler2.enable(list, true));
3664
- const missed = list.filter((name) => result.indexOf(name) < 0);
3665
- if (missed.length && !ignoreInvalid) throw new Error(`MarkdownIt. Failed to enable unknown rule(s): ${missed}`);
3666
- return this;
3667
- }
3668
- /**
3669
- * The same as {@link MarkdownIt.enable}, but turn specified rules off.
3670
- */
3671
- disable(list, ignoreInvalid = false) {
3672
- let result = [];
3673
- if (!Array.isArray(list)) list = [list];
3674
- [
3675
- "core",
3676
- "block",
3677
- "inline"
3678
- ].forEach((chain) => {
3679
- result = result.concat(this[chain].ruler.disable(list, true));
3680
- });
3681
- result = result.concat(this.inline.ruler2.disable(list, true));
3682
- const missed = list.filter((name) => result.indexOf(name) < 0);
3683
- if (missed.length && !ignoreInvalid) throw new Error(`MarkdownIt. Failed to disable unknown rule(s): ${missed}`);
3684
- return this;
3685
- }
3686
- /**
3687
- * Load specified plugin with given params into current parser instance.
3688
- * It's just a sugar to call `plugin(md, params)` with curring.
3689
- *
3690
- * @example
3691
- * ```javascript
3692
- * import MarkdownIt from 'markdown-it'
3693
- * import iterator from 'markdown-it-for-inline'
3694
- *
3695
- * const md = new MarkdownIt()
3696
- * .use(iterator, 'foo_replace', 'text', function (tokens, idx) {
3697
- * tokens[idx].content = tokens[idx].content.replace(/foo/g, 'bar')
3698
- * })
3699
- * ```
3700
- */
3701
- use(plugin, ...params) {
3702
- plugin.apply(plugin, [this, ...params]);
3703
- return this;
3704
- }
3705
- /**
3706
- * Parse input string and return list of block tokens (special token type
3707
- * "inline" will contain list of inline tokens). You should not call this
3708
- * method directly, until you write custom renderer (for example, to produce
3709
- * AST).
3710
- *
3711
- * `env` is used to pass data between "distributed" rules and return additional
3712
- * metadata like reference info, needed for the renderer. It also can be used to
3713
- * inject data in specific cases. Usually, you will be ok to pass `{}`,
3714
- * and then pass updated object to renderer.
3715
- */
3716
- parse(src, env) {
3717
- if (typeof src !== "string") throw new Error("Input data should be a String");
3718
- const state = new this.core.State(src, this, env);
3719
- this.core.process(state);
3720
- return state.tokens;
3721
- }
3722
- /**
3723
- * Render markdown string into html. It does all magic for you :).
3724
- *
3725
- * `env` can be used to inject additional metadata (`{}` by default).
3726
- * But you will not need it with high probability. See also comment
3727
- * in {@link MarkdownIt.parse}.
3728
- */
3729
- render(src, env = {}) {
3730
- return this.renderer.render(this.parse(src, env), this.options, env);
3731
- }
3732
- /**
3733
- * The same as {@link MarkdownIt.parse} but skip all block rules. It returns
3734
- * the block tokens list with the single `inline` element, containing parsed
3735
- * inline tokens in `children` property. Also updates `env` object.
3736
- */
3737
- parseInline(src, env) {
3738
- const state = new this.core.State(src, this, env);
3739
- state.inlineMode = true;
3740
- this.core.process(state);
3741
- return state.tokens;
3742
- }
3743
- /**
3744
- * Similar to {@link MarkdownIt.render} but for single paragraph content.
3745
- * Result will NOT be wrapped into `<p>` tags.
3746
- */
3747
- renderInline(src, env = {}) {
3748
- return this.renderer.render(this.parseInline(src, env), this.options, env);
3749
- }
3750
- };
3751
- _defineProperty(MarkdownIt, "Token", Token);
3752
- _defineProperty(MarkdownIt, "Ruler", Ruler);
3753
- _defineProperty(MarkdownIt, "Renderer", Renderer);
3754
- _defineProperty(MarkdownIt, "ParserCore", ParserCore);
3755
- _defineProperty(MarkdownIt, "StateCore", StateCore);
3756
- _defineProperty(MarkdownIt, "ParserBlock", ParserBlock);
3757
- _defineProperty(MarkdownIt, "StateBlock", StateBlock);
3758
- _defineProperty(MarkdownIt, "ParserInline", ParserInline);
3759
- _defineProperty(MarkdownIt, "StateInline", StateInline);
3760
- /**
3761
- * Default package export.
3762
- *
3763
- * For backward compatibility, the {@link MarkdownIt} class is wrapped so
3764
- * legacy code can call it without `new`. New code should instantiate it as a
3765
- * regular class with `new`. The compatibility wrapper may be removed in a
3766
- * future release.
3767
- *
3768
- * @category Main
3769
- */
3770
- var MarkdownItCallable = callable(MarkdownIt);
3771
- //#endregion
3772
- exports.default = MarkdownItCallable;
3773
-
3774
- //# sourceMappingURL=markdown-it.js.map