chrome-devtools-frontend 1.0.944427 → 1.0.945677

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 (327) hide show
  1. package/config/gni/devtools_grd_files.gni +4 -0
  2. package/config/gni/devtools_image_files.gni +1 -0
  3. package/front_end/Images/src/circled_exclamation_icon.svg +3 -0
  4. package/front_end/core/common/ParsedURL.ts +1 -1
  5. package/front_end/core/host/UserMetrics.ts +3 -1
  6. package/front_end/core/i18n/i18nImpl.ts +7 -4
  7. package/front_end/core/i18n/locales/en-US.json +3 -60
  8. package/front_end/core/i18n/locales/en-XL.json +15 -72
  9. package/front_end/core/protocol_client/NodeURL.ts +1 -0
  10. package/front_end/core/sdk/CSSMetadata.ts +0 -1
  11. package/front_end/core/sdk/CSSStyleSheetHeader.ts +2 -3
  12. package/front_end/core/sdk/CompilerSourceMappingContentProvider.ts +2 -3
  13. package/front_end/core/sdk/Cookie.ts +17 -0
  14. package/front_end/core/sdk/CookieModel.ts +1 -0
  15. package/front_end/core/sdk/DebuggerModel.ts +5 -4
  16. package/front_end/core/sdk/NetworkManager.ts +4 -1
  17. package/front_end/core/sdk/NetworkRequest.ts +2 -2
  18. package/front_end/core/sdk/Resource.ts +2 -2
  19. package/front_end/core/sdk/Script.ts +2 -3
  20. package/front_end/entrypoints/main/MainImpl.ts +6 -0
  21. package/front_end/generated/protocol.d.ts +0 -4
  22. package/front_end/models/bindings/BreakpointManager.ts +3 -4
  23. package/front_end/models/bindings/ResourceMapping.ts +1 -2
  24. package/front_end/models/bindings/StylesSourceMapping.ts +1 -2
  25. package/front_end/models/emulation/EmulatedDevices.ts +2 -4
  26. package/front_end/models/persistence/IsolatedFileSystem.ts +7 -6
  27. package/front_end/models/persistence/PersistenceActions.ts +4 -1
  28. package/front_end/models/persistence/PlatformFileSystem.ts +3 -4
  29. package/front_end/models/text_utils/ContentProvider.ts +1 -2
  30. package/front_end/models/text_utils/StaticContentProvider.ts +2 -3
  31. package/front_end/models/timeline_model/TimelineJSProfile.ts +16 -3
  32. package/front_end/models/timeline_model/TimelineModel.ts +1 -0
  33. package/front_end/models/workspace/UISourceCode.ts +2 -2
  34. package/front_end/models/workspace_diff/WorkspaceDiff.ts +20 -6
  35. package/front_end/panels/animation/AnimationTimeline.ts +1 -1
  36. package/front_end/panels/animation/animationTimeline.css +2 -0
  37. package/front_end/panels/application/BackForwardCacheStrings.ts +15 -75
  38. package/front_end/panels/application/BackForwardCacheView.ts +8 -1
  39. package/front_end/panels/application/ReportingApiView.ts +15 -1
  40. package/front_end/panels/application/components/EndpointsGrid.ts +63 -4
  41. package/front_end/panels/application/components/FrameDetailsView.ts +21 -34
  42. package/front_end/panels/changes/ChangesView.ts +8 -7
  43. package/front_end/panels/elements/StyleEditorWidget.ts +7 -7
  44. package/front_end/panels/elements/StylePropertyTreeElement.ts +8 -15
  45. package/front_end/panels/elements/StylesSidebarPane.ts +35 -9
  46. package/front_end/panels/emulation/DeviceModeView.ts +3 -0
  47. package/front_end/panels/help/ReleaseNoteText.ts +3 -1
  48. package/front_end/panels/network/NetworkItemView.ts +7 -1
  49. package/front_end/panels/profiler/heapProfiler.css +2 -5
  50. package/front_end/panels/snippets/ScriptSnippetFileSystem.ts +1 -1
  51. package/front_end/panels/sources/DebuggerPlugin.ts +1 -1
  52. package/front_end/panels/sources/NavigatorView.ts +1 -1
  53. package/front_end/panels/sources/UISourceCodeFrame.ts +0 -1
  54. package/front_end/panels/timeline/TimelineController.ts +3 -0
  55. package/front_end/panels/timeline/TimelineFlameChartDataProvider.ts +3 -34
  56. package/front_end/panels/timeline/TimelineUIUtils.ts +51 -3
  57. package/front_end/panels/webauthn/WebauthnPane.ts +31 -32
  58. package/front_end/services/window_bounds/WindowBoundsService.ts +27 -0
  59. package/front_end/services/window_bounds/window_bounds.ts +9 -0
  60. package/front_end/third_party/acorn/README.chromium +2 -2
  61. package/front_end/third_party/acorn/acorn.ts +1 -1
  62. package/front_end/third_party/acorn/package/CHANGELOG.md +31 -1
  63. package/front_end/third_party/acorn/package/README.md +1 -1
  64. package/front_end/third_party/acorn/package/dist/acorn.d.ts +3 -0
  65. package/front_end/third_party/acorn/package/dist/acorn.js +772 -708
  66. package/front_end/third_party/acorn/package/dist/acorn.mjs +767 -703
  67. package/front_end/third_party/acorn/package/dist/bin.js +47 -21
  68. package/front_end/third_party/acorn/package/package.json +1 -1
  69. package/front_end/third_party/acorn-loose/README.chromium +2 -2
  70. package/front_end/third_party/acorn-loose/package/CHANGELOG.md +12 -0
  71. package/front_end/third_party/acorn-loose/package/dist/acorn-loose.js +27 -7
  72. package/front_end/third_party/acorn-loose/package/dist/acorn-loose.mjs +28 -8
  73. package/front_end/third_party/acorn-loose/package/package.json +2 -2
  74. package/front_end/third_party/codemirror.next/bundle.ts +1 -1
  75. package/front_end/third_party/codemirror.next/chunk/codemirror.js +1 -1
  76. package/front_end/third_party/codemirror.next/codemirror.next.d.ts +8 -1
  77. package/front_end/third_party/codemirror.next/codemirror.next.js +1 -1
  78. package/front_end/third_party/codemirror.next/package.json +1 -1
  79. package/front_end/third_party/i18n/i18n-impl.ts +1 -1
  80. package/front_end/third_party/lit-html/README.chromium +2 -2
  81. package/front_end/third_party/lit-html/package/CHANGELOG.md +216 -28
  82. package/front_end/third_party/lit-html/package/LICENSE +9 -9
  83. package/front_end/third_party/lit-html/package/README.md +12 -162
  84. package/front_end/third_party/lit-html/package/async-directive.d.ts +23 -54
  85. package/front_end/third_party/lit-html/package/async-directive.d.ts.map +1 -1
  86. package/front_end/third_party/lit-html/package/async-directive.js +2 -7
  87. package/front_end/third_party/lit-html/package/async-directive.js.map +1 -1
  88. package/front_end/third_party/lit-html/package/development/async-directive.d.ts +23 -54
  89. package/front_end/third_party/lit-html/package/development/async-directive.d.ts.map +1 -1
  90. package/front_end/third_party/lit-html/package/development/async-directive.js +44 -194
  91. package/front_end/third_party/lit-html/package/development/async-directive.js.map +1 -1
  92. package/front_end/third_party/lit-html/package/development/directive-helpers.d.ts +6 -5
  93. package/front_end/third_party/lit-html/package/development/directive-helpers.d.ts.map +1 -1
  94. package/front_end/third_party/lit-html/package/development/directive-helpers.js +25 -9
  95. package/front_end/third_party/lit-html/package/development/directive-helpers.js.map +1 -1
  96. package/front_end/third_party/lit-html/package/development/directive.d.ts +3 -16
  97. package/front_end/third_party/lit-html/package/development/directive.d.ts.map +1 -1
  98. package/front_end/third_party/lit-html/package/development/directive.js +6 -1
  99. package/front_end/third_party/lit-html/package/development/directive.js.map +1 -1
  100. package/front_end/third_party/lit-html/package/development/directives/async-append.d.ts +7 -14
  101. package/front_end/third_party/lit-html/package/development/directives/async-append.d.ts.map +1 -1
  102. package/front_end/third_party/lit-html/package/development/directives/async-append.js +17 -58
  103. package/front_end/third_party/lit-html/package/development/directives/async-append.js.map +1 -1
  104. package/front_end/third_party/lit-html/package/development/directives/async-replace.d.ts +9 -14
  105. package/front_end/third_party/lit-html/package/development/directives/async-replace.d.ts.map +1 -1
  106. package/front_end/third_party/lit-html/package/development/directives/async-replace.js +57 -37
  107. package/front_end/third_party/lit-html/package/development/directives/async-replace.js.map +1 -1
  108. package/front_end/third_party/lit-html/package/development/directives/cache.d.ts +2 -3
  109. package/front_end/third_party/lit-html/package/development/directives/cache.d.ts.map +1 -1
  110. package/front_end/third_party/lit-html/package/development/directives/cache.js +4 -6
  111. package/front_end/third_party/lit-html/package/development/directives/cache.js.map +1 -1
  112. package/front_end/third_party/lit-html/package/development/directives/class-map.d.ts +2 -2
  113. package/front_end/third_party/lit-html/package/development/directives/class-map.d.ts.map +1 -1
  114. package/front_end/third_party/lit-html/package/development/directives/class-map.js +17 -7
  115. package/front_end/third_party/lit-html/package/development/directives/class-map.js.map +1 -1
  116. package/front_end/third_party/lit-html/package/development/directives/guard.d.ts +3 -2
  117. package/front_end/third_party/lit-html/package/development/directives/guard.d.ts.map +1 -1
  118. package/front_end/third_party/lit-html/package/development/directives/guard.js +3 -2
  119. package/front_end/third_party/lit-html/package/development/directives/guard.js.map +1 -1
  120. package/front_end/third_party/lit-html/package/development/directives/live.d.ts +4 -3
  121. package/front_end/third_party/lit-html/package/development/directives/live.d.ts.map +1 -1
  122. package/front_end/third_party/lit-html/package/development/directives/live.js +5 -7
  123. package/front_end/third_party/lit-html/package/development/directives/live.js.map +1 -1
  124. package/front_end/third_party/lit-html/package/development/directives/private-async-helpers.d.ts +58 -0
  125. package/front_end/third_party/lit-html/package/development/directives/private-async-helpers.d.ts.map +1 -0
  126. package/front_end/third_party/lit-html/package/development/directives/private-async-helpers.js +85 -0
  127. package/front_end/third_party/lit-html/package/development/directives/private-async-helpers.js.map +1 -0
  128. package/front_end/third_party/lit-html/package/development/directives/ref.d.ts +14 -11
  129. package/front_end/third_party/lit-html/package/development/directives/ref.d.ts.map +1 -1
  130. package/front_end/third_party/lit-html/package/development/directives/ref.js +13 -11
  131. package/front_end/third_party/lit-html/package/development/directives/ref.js.map +1 -1
  132. package/front_end/third_party/lit-html/package/development/directives/repeat.d.ts +8 -4
  133. package/front_end/third_party/lit-html/package/development/directives/repeat.d.ts.map +1 -1
  134. package/front_end/third_party/lit-html/package/development/directives/repeat.js +23 -9
  135. package/front_end/third_party/lit-html/package/development/directives/repeat.js.map +1 -1
  136. package/front_end/third_party/lit-html/package/development/directives/style-map.d.ts +1 -2
  137. package/front_end/third_party/lit-html/package/development/directives/style-map.d.ts.map +1 -1
  138. package/front_end/third_party/lit-html/package/development/directives/style-map.js +1 -2
  139. package/front_end/third_party/lit-html/package/development/directives/style-map.js.map +1 -1
  140. package/front_end/third_party/lit-html/package/development/directives/template-content.d.ts +1 -2
  141. package/front_end/third_party/lit-html/package/development/directives/template-content.js +1 -2
  142. package/front_end/third_party/lit-html/package/development/directives/unsafe-html.d.ts +6 -4
  143. package/front_end/third_party/lit-html/package/development/directives/unsafe-html.d.ts.map +1 -1
  144. package/front_end/third_party/lit-html/package/development/directives/unsafe-html.js +7 -5
  145. package/front_end/third_party/lit-html/package/development/directives/unsafe-html.js.map +1 -1
  146. package/front_end/third_party/lit-html/package/development/directives/unsafe-svg.d.ts +4 -1
  147. package/front_end/third_party/lit-html/package/development/directives/unsafe-svg.d.ts.map +1 -1
  148. package/front_end/third_party/lit-html/package/development/directives/unsafe-svg.js +3 -0
  149. package/front_end/third_party/lit-html/package/development/directives/unsafe-svg.js.map +1 -1
  150. package/front_end/third_party/lit-html/package/development/directives/until.d.ts +12 -8
  151. package/front_end/third_party/lit-html/package/development/directives/until.d.ts.map +1 -1
  152. package/front_end/third_party/lit-html/package/development/directives/until.js +63 -23
  153. package/front_end/third_party/lit-html/package/development/directives/until.js.map +1 -1
  154. package/front_end/third_party/lit-html/package/development/experimental-hydrate.d.ts.map +1 -1
  155. package/front_end/third_party/lit-html/package/development/experimental-hydrate.js +9 -8
  156. package/front_end/third_party/lit-html/package/development/experimental-hydrate.js.map +1 -1
  157. package/front_end/third_party/lit-html/package/development/lit-html.d.ts +81 -136
  158. package/front_end/third_party/lit-html/package/development/lit-html.d.ts.map +1 -1
  159. package/front_end/third_party/lit-html/package/development/lit-html.js +249 -76
  160. package/front_end/third_party/lit-html/package/development/lit-html.js.map +1 -1
  161. package/front_end/third_party/lit-html/package/development/polyfill-support.d.ts +1 -41
  162. package/front_end/third_party/lit-html/package/development/polyfill-support.d.ts.map +1 -1
  163. package/front_end/third_party/lit-html/package/development/polyfill-support.js +40 -21
  164. package/front_end/third_party/lit-html/package/development/polyfill-support.js.map +1 -1
  165. package/front_end/third_party/lit-html/package/development/private-ssr-support.d.ts +12 -10
  166. package/front_end/third_party/lit-html/package/development/private-ssr-support.d.ts.map +1 -1
  167. package/front_end/third_party/lit-html/package/development/private-ssr-support.js +11 -3
  168. package/front_end/third_party/lit-html/package/development/private-ssr-support.js.map +1 -1
  169. package/front_end/third_party/lit-html/package/development/static.d.ts.map +1 -1
  170. package/front_end/third_party/lit-html/package/development/static.js +6 -5
  171. package/front_end/third_party/lit-html/package/development/static.js.map +1 -1
  172. package/front_end/third_party/lit-html/package/directive-helpers.d.ts +6 -5
  173. package/front_end/third_party/lit-html/package/directive-helpers.d.ts.map +1 -1
  174. package/front_end/third_party/lit-html/package/directive-helpers.js +2 -2
  175. package/front_end/third_party/lit-html/package/directive-helpers.js.map +1 -1
  176. package/front_end/third_party/lit-html/package/directive.d.ts +3 -16
  177. package/front_end/third_party/lit-html/package/directive.d.ts.map +1 -1
  178. package/front_end/third_party/lit-html/package/directive.js +1 -1
  179. package/front_end/third_party/lit-html/package/directive.js.map +1 -1
  180. package/front_end/third_party/lit-html/package/directives/async-append.d.ts +7 -14
  181. package/front_end/third_party/lit-html/package/directives/async-append.d.ts.map +1 -1
  182. package/front_end/third_party/lit-html/package/directives/async-append.js +2 -6
  183. package/front_end/third_party/lit-html/package/directives/async-append.js.map +1 -1
  184. package/front_end/third_party/lit-html/package/directives/async-replace.d.ts +9 -14
  185. package/front_end/third_party/lit-html/package/directives/async-replace.d.ts.map +1 -1
  186. package/front_end/third_party/lit-html/package/directives/async-replace.js +2 -5
  187. package/front_end/third_party/lit-html/package/directives/async-replace.js.map +1 -1
  188. package/front_end/third_party/lit-html/package/directives/cache.d.ts +2 -3
  189. package/front_end/third_party/lit-html/package/directives/cache.d.ts.map +1 -1
  190. package/front_end/third_party/lit-html/package/directives/cache.js +2 -5
  191. package/front_end/third_party/lit-html/package/directives/cache.js.map +1 -1
  192. package/front_end/third_party/lit-html/package/directives/class-map.d.ts +2 -2
  193. package/front_end/third_party/lit-html/package/directives/class-map.d.ts.map +1 -1
  194. package/front_end/third_party/lit-html/package/directives/class-map.js +2 -4
  195. package/front_end/third_party/lit-html/package/directives/class-map.js.map +1 -1
  196. package/front_end/third_party/lit-html/package/directives/guard.d.ts +3 -2
  197. package/front_end/third_party/lit-html/package/directives/guard.d.ts.map +1 -1
  198. package/front_end/third_party/lit-html/package/directives/guard.js +2 -4
  199. package/front_end/third_party/lit-html/package/directives/guard.js.map +1 -1
  200. package/front_end/third_party/lit-html/package/directives/live.d.ts +4 -3
  201. package/front_end/third_party/lit-html/package/directives/live.d.ts.map +1 -1
  202. package/front_end/third_party/lit-html/package/directives/live.js +1 -4
  203. package/front_end/third_party/lit-html/package/directives/live.js.map +1 -1
  204. package/front_end/third_party/lit-html/package/directives/private-async-helpers.d.ts +58 -0
  205. package/front_end/third_party/lit-html/package/directives/private-async-helpers.d.ts.map +1 -0
  206. package/front_end/third_party/lit-html/package/directives/private-async-helpers.js +7 -0
  207. package/front_end/third_party/lit-html/package/directives/private-async-helpers.js.map +1 -0
  208. package/front_end/third_party/lit-html/package/directives/ref.d.ts +14 -11
  209. package/front_end/third_party/lit-html/package/directives/ref.d.ts.map +1 -1
  210. package/front_end/third_party/lit-html/package/directives/ref.js +2 -5
  211. package/front_end/third_party/lit-html/package/directives/ref.js.map +1 -1
  212. package/front_end/third_party/lit-html/package/directives/repeat.d.ts +8 -4
  213. package/front_end/third_party/lit-html/package/directives/repeat.d.ts.map +1 -1
  214. package/front_end/third_party/lit-html/package/directives/repeat.js +2 -5
  215. package/front_end/third_party/lit-html/package/directives/repeat.js.map +1 -1
  216. package/front_end/third_party/lit-html/package/directives/style-map.d.ts +1 -2
  217. package/front_end/third_party/lit-html/package/directives/style-map.d.ts.map +1 -1
  218. package/front_end/third_party/lit-html/package/directives/style-map.js +2 -4
  219. package/front_end/third_party/lit-html/package/directives/style-map.js.map +1 -1
  220. package/front_end/third_party/lit-html/package/directives/template-content.d.ts +1 -2
  221. package/front_end/third_party/lit-html/package/directives/template-content.js +2 -4
  222. package/front_end/third_party/lit-html/package/directives/template-content.js.map +1 -1
  223. package/front_end/third_party/lit-html/package/directives/unsafe-html.d.ts +6 -4
  224. package/front_end/third_party/lit-html/package/directives/unsafe-html.d.ts.map +1 -1
  225. package/front_end/third_party/lit-html/package/directives/unsafe-html.js +2 -4
  226. package/front_end/third_party/lit-html/package/directives/unsafe-html.js.map +1 -1
  227. package/front_end/third_party/lit-html/package/directives/unsafe-svg.d.ts +4 -1
  228. package/front_end/third_party/lit-html/package/directives/unsafe-svg.d.ts.map +1 -1
  229. package/front_end/third_party/lit-html/package/directives/unsafe-svg.js.map +1 -1
  230. package/front_end/third_party/lit-html/package/directives/until.d.ts +12 -8
  231. package/front_end/third_party/lit-html/package/directives/until.d.ts.map +1 -1
  232. package/front_end/third_party/lit-html/package/directives/until.js +2 -6
  233. package/front_end/third_party/lit-html/package/directives/until.js.map +1 -1
  234. package/front_end/third_party/lit-html/package/experimental-hydrate.d.ts.map +1 -1
  235. package/front_end/third_party/lit-html/package/experimental-hydrate.js +2 -5
  236. package/front_end/third_party/lit-html/package/experimental-hydrate.js.map +1 -1
  237. package/front_end/third_party/lit-html/package/lit-html.d.ts +81 -136
  238. package/front_end/third_party/lit-html/package/lit-html.d.ts.map +1 -1
  239. package/front_end/third_party/lit-html/package/lit-html.js +1 -1
  240. package/front_end/third_party/lit-html/package/lit-html.js.map +1 -1
  241. package/front_end/third_party/lit-html/package/package.json +75 -24
  242. package/front_end/third_party/lit-html/package/polyfill-support.d.ts +1 -41
  243. package/front_end/third_party/lit-html/package/polyfill-support.d.ts.map +1 -1
  244. package/front_end/third_party/lit-html/package/polyfill-support.js +1 -1
  245. package/front_end/third_party/lit-html/package/polyfill-support.js.map +1 -1
  246. package/front_end/third_party/lit-html/package/private-ssr-support.d.ts +12 -10
  247. package/front_end/third_party/lit-html/package/private-ssr-support.d.ts.map +1 -1
  248. package/front_end/third_party/lit-html/package/private-ssr-support.js +2 -2
  249. package/front_end/third_party/lit-html/package/private-ssr-support.js.map +1 -1
  250. package/front_end/third_party/lit-html/package/static.d.ts.map +1 -1
  251. package/front_end/third_party/lit-html/package/static.js +1 -1
  252. package/front_end/third_party/lit-html/package/static.js.map +1 -1
  253. package/front_end/third_party/marked/README.chromium +2 -2
  254. package/front_end/third_party/marked/marked.ts +2 -2
  255. package/front_end/third_party/marked/package/README.md +7 -1
  256. package/front_end/third_party/marked/package/bin/marked.js +214 -0
  257. package/front_end/third_party/marked/package/lib/marked.cjs +2907 -0
  258. package/front_end/third_party/marked/package/lib/marked.esm.d.ts +1 -3
  259. package/front_end/third_party/marked/package/lib/marked.esm.js +627 -586
  260. package/front_end/third_party/marked/package/lib/marked.umd.js +2913 -0
  261. package/front_end/third_party/marked/package/man/marked.1 +5 -24
  262. package/front_end/third_party/marked/package/man/marked.1.txt +21 -31
  263. package/front_end/third_party/marked/package/marked.min.js +1 -1
  264. package/front_end/third_party/marked/package/package.json +41 -32
  265. package/front_end/third_party/marked/package/src/Lexer.js +109 -108
  266. package/front_end/third_party/marked/package/src/Parser.js +38 -15
  267. package/front_end/third_party/marked/package/src/Renderer.js +5 -5
  268. package/front_end/third_party/marked/package/src/Slugger.js +2 -2
  269. package/front_end/third_party/marked/package/src/TextRenderer.js +2 -2
  270. package/front_end/third_party/marked/package/src/Tokenizer.js +215 -190
  271. package/front_end/third_party/marked/package/src/defaults.js +6 -9
  272. package/front_end/third_party/marked/package/src/helpers.js +16 -27
  273. package/front_end/third_party/marked/package/src/marked.js +146 -63
  274. package/front_end/third_party/marked/package/src/rules.js +20 -45
  275. package/front_end/third_party/wasmparser/README.chromium +2 -2
  276. package/front_end/third_party/wasmparser/package/.github/workflows/main.yml +47 -0
  277. package/front_end/third_party/wasmparser/package/CHANGELOG.md +12 -0
  278. package/front_end/third_party/wasmparser/package/dist/cjs/WasmParser.js +53 -53
  279. package/front_end/third_party/wasmparser/package/dist/cjs/WasmParser.js.map +1 -1
  280. package/front_end/third_party/wasmparser/package/dist/esm/WasmParser.js +53 -53
  281. package/front_end/third_party/wasmparser/package/dist/esm/WasmParser.js.map +1 -1
  282. package/front_end/third_party/wasmparser/package/package.json +1 -1
  283. package/front_end/third_party/wasmparser/package/src/WasmParser.ts +53 -53
  284. package/front_end/ui/components/adorners/Adorner.ts +14 -14
  285. package/front_end/ui/components/buttons/Button.ts +133 -42
  286. package/front_end/ui/components/buttons/button.css +31 -0
  287. package/front_end/ui/components/data_grid/DataGrid.ts +131 -122
  288. package/front_end/ui/components/data_grid/DataGridController.ts +42 -42
  289. package/front_end/ui/components/diff_view/DiffView.ts +4 -4
  290. package/front_end/ui/components/docs/button/basic.html +3 -0
  291. package/front_end/ui/components/docs/button/basic.ts +58 -0
  292. package/front_end/ui/components/expandable_list/ExpandableList.ts +11 -11
  293. package/front_end/ui/components/icon_button/Icon.ts +24 -21
  294. package/front_end/ui/components/icon_button/IconButton.ts +31 -31
  295. package/front_end/ui/components/issue_counter/IssueCounter.ts +52 -52
  296. package/front_end/ui/components/issue_counter/IssueLinkIcon.ts +42 -42
  297. package/front_end/ui/components/linear_memory_inspector/LinearMemoryInspector.ts +67 -67
  298. package/front_end/ui/components/linear_memory_inspector/LinearMemoryInspectorController.ts +22 -22
  299. package/front_end/ui/components/linear_memory_inspector/LinearMemoryInspectorPane.ts +36 -36
  300. package/front_end/ui/components/linear_memory_inspector/LinearMemoryNavigator.ts +19 -19
  301. package/front_end/ui/components/linear_memory_inspector/LinearMemoryValueInterpreter.ts +25 -25
  302. package/front_end/ui/components/linear_memory_inspector/LinearMemoryViewer.ts +52 -52
  303. package/front_end/ui/components/linear_memory_inspector/ValueInterpreterDisplay.ts +21 -21
  304. package/front_end/ui/components/linear_memory_inspector/ValueInterpreterSettings.ts +6 -6
  305. package/front_end/ui/components/markdown_view/MarkdownImage.ts +14 -14
  306. package/front_end/ui/components/markdown_view/MarkdownLink.ts +8 -8
  307. package/front_end/ui/components/markdown_view/MarkdownView.ts +6 -6
  308. package/front_end/ui/components/render_coordinator/RenderCoordinator.ts +33 -33
  309. package/front_end/ui/components/report_view/ReportView.ts +18 -18
  310. package/front_end/ui/components/request_link_icon/RequestLinkIcon.ts +53 -53
  311. package/front_end/ui/components/settings/SettingCheckbox.ts +15 -15
  312. package/front_end/ui/components/survey_link/SurveyLink.ts +28 -28
  313. package/front_end/ui/components/text_editor/TextEditor.ts +68 -36
  314. package/front_end/ui/components/text_editor/config.ts +4 -2
  315. package/front_end/ui/components/text_editor/javascript.ts +6 -6
  316. package/front_end/ui/components/text_prompt/TextPrompt.ts +19 -19
  317. package/front_end/ui/components/tree_outline/TreeOutline.ts +56 -56
  318. package/front_end/ui/legacy/Infobar.ts +9 -0
  319. package/front_end/ui/legacy/InspectorView.ts +1 -1
  320. package/front_end/ui/legacy/ListWidget.ts +2 -2
  321. package/front_end/ui/legacy/ViewManager.ts +6 -0
  322. package/front_end/ui/legacy/components/cookie_table/CookiesTable.ts +20 -0
  323. package/front_end/ui/legacy/tabbedPane.css +1 -1
  324. package/inspector_overlay/main.ts +3 -0
  325. package/package.json +1 -1
  326. package/scripts/eslint_rules/lib/l10n_filename_matches.js +17 -4
  327. package/scripts/eslint_rules/tests/l10n_filename_matches_test.js +21 -0
@@ -0,0 +1,2907 @@
1
+ /**
2
+ * marked - a markdown parser
3
+ * Copyright (c) 2011-2021, Christopher Jeffrey. (MIT Licensed)
4
+ * https://github.com/markedjs/marked
5
+ */
6
+
7
+ /**
8
+ * DO NOT EDIT THIS FILE
9
+ * The code in this file is generated from files in ./src/
10
+ */
11
+
12
+ 'use strict';
13
+
14
+ Object.defineProperty(exports, '__esModule', { value: true });
15
+
16
+ function _defineProperties(target, props) {
17
+ for (var i = 0; i < props.length; i++) {
18
+ var descriptor = props[i];
19
+ descriptor.enumerable = descriptor.enumerable || false;
20
+ descriptor.configurable = true;
21
+ if ("value" in descriptor) descriptor.writable = true;
22
+ Object.defineProperty(target, descriptor.key, descriptor);
23
+ }
24
+ }
25
+
26
+ function _createClass(Constructor, protoProps, staticProps) {
27
+ if (protoProps) _defineProperties(Constructor.prototype, protoProps);
28
+ if (staticProps) _defineProperties(Constructor, staticProps);
29
+ return Constructor;
30
+ }
31
+
32
+ function _unsupportedIterableToArray(o, minLen) {
33
+ if (!o) return;
34
+ if (typeof o === "string") return _arrayLikeToArray(o, minLen);
35
+ var n = Object.prototype.toString.call(o).slice(8, -1);
36
+ if (n === "Object" && o.constructor) n = o.constructor.name;
37
+ if (n === "Map" || n === "Set") return Array.from(o);
38
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
39
+ }
40
+
41
+ function _arrayLikeToArray(arr, len) {
42
+ if (len == null || len > arr.length) len = arr.length;
43
+
44
+ for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
45
+
46
+ return arr2;
47
+ }
48
+
49
+ function _createForOfIteratorHelperLoose(o, allowArrayLike) {
50
+ var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"];
51
+ if (it) return (it = it.call(o)).next.bind(it);
52
+
53
+ if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") {
54
+ if (it) o = it;
55
+ var i = 0;
56
+ return function () {
57
+ if (i >= o.length) return {
58
+ done: true
59
+ };
60
+ return {
61
+ done: false,
62
+ value: o[i++]
63
+ };
64
+ };
65
+ }
66
+
67
+ throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
68
+ }
69
+
70
+ function getDefaults() {
71
+ return {
72
+ baseUrl: null,
73
+ breaks: false,
74
+ extensions: null,
75
+ gfm: true,
76
+ headerIds: true,
77
+ headerPrefix: '',
78
+ highlight: null,
79
+ langPrefix: 'language-',
80
+ mangle: true,
81
+ pedantic: false,
82
+ renderer: null,
83
+ sanitize: false,
84
+ sanitizer: null,
85
+ silent: false,
86
+ smartLists: false,
87
+ smartypants: false,
88
+ tokenizer: null,
89
+ walkTokens: null,
90
+ xhtml: false
91
+ };
92
+ }
93
+ exports.defaults = getDefaults();
94
+ function changeDefaults(newDefaults) {
95
+ exports.defaults = newDefaults;
96
+ }
97
+
98
+ /**
99
+ * Helpers
100
+ */
101
+ var escapeTest = /[&<>"']/;
102
+ var escapeReplace = /[&<>"']/g;
103
+ var escapeTestNoEncode = /[<>"']|&(?!#?\w+;)/;
104
+ var escapeReplaceNoEncode = /[<>"']|&(?!#?\w+;)/g;
105
+ var escapeReplacements = {
106
+ '&': '&amp;',
107
+ '<': '&lt;',
108
+ '>': '&gt;',
109
+ '"': '&quot;',
110
+ "'": '&#39;'
111
+ };
112
+
113
+ var getEscapeReplacement = function getEscapeReplacement(ch) {
114
+ return escapeReplacements[ch];
115
+ };
116
+
117
+ function escape(html, encode) {
118
+ if (encode) {
119
+ if (escapeTest.test(html)) {
120
+ return html.replace(escapeReplace, getEscapeReplacement);
121
+ }
122
+ } else {
123
+ if (escapeTestNoEncode.test(html)) {
124
+ return html.replace(escapeReplaceNoEncode, getEscapeReplacement);
125
+ }
126
+ }
127
+
128
+ return html;
129
+ }
130
+ var unescapeTest = /&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;
131
+ function unescape(html) {
132
+ // explicitly match decimal, hex, and named HTML entities
133
+ return html.replace(unescapeTest, function (_, n) {
134
+ n = n.toLowerCase();
135
+ if (n === 'colon') return ':';
136
+
137
+ if (n.charAt(0) === '#') {
138
+ return n.charAt(1) === 'x' ? String.fromCharCode(parseInt(n.substring(2), 16)) : String.fromCharCode(+n.substring(1));
139
+ }
140
+
141
+ return '';
142
+ });
143
+ }
144
+ var caret = /(^|[^\[])\^/g;
145
+ function edit(regex, opt) {
146
+ regex = regex.source || regex;
147
+ opt = opt || '';
148
+ var obj = {
149
+ replace: function replace(name, val) {
150
+ val = val.source || val;
151
+ val = val.replace(caret, '$1');
152
+ regex = regex.replace(name, val);
153
+ return obj;
154
+ },
155
+ getRegex: function getRegex() {
156
+ return new RegExp(regex, opt);
157
+ }
158
+ };
159
+ return obj;
160
+ }
161
+ var nonWordAndColonTest = /[^\w:]/g;
162
+ var originIndependentUrl = /^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;
163
+ function cleanUrl(sanitize, base, href) {
164
+ if (sanitize) {
165
+ var prot;
166
+
167
+ try {
168
+ prot = decodeURIComponent(unescape(href)).replace(nonWordAndColonTest, '').toLowerCase();
169
+ } catch (e) {
170
+ return null;
171
+ }
172
+
173
+ if (prot.indexOf('javascript:') === 0 || prot.indexOf('vbscript:') === 0 || prot.indexOf('data:') === 0) {
174
+ return null;
175
+ }
176
+ }
177
+
178
+ if (base && !originIndependentUrl.test(href)) {
179
+ href = resolveUrl(base, href);
180
+ }
181
+
182
+ try {
183
+ href = encodeURI(href).replace(/%25/g, '%');
184
+ } catch (e) {
185
+ return null;
186
+ }
187
+
188
+ return href;
189
+ }
190
+ var baseUrls = {};
191
+ var justDomain = /^[^:]+:\/*[^/]*$/;
192
+ var protocol = /^([^:]+:)[\s\S]*$/;
193
+ var domain = /^([^:]+:\/*[^/]*)[\s\S]*$/;
194
+ function resolveUrl(base, href) {
195
+ if (!baseUrls[' ' + base]) {
196
+ // we can ignore everything in base after the last slash of its path component,
197
+ // but we might need to add _that_
198
+ // https://tools.ietf.org/html/rfc3986#section-3
199
+ if (justDomain.test(base)) {
200
+ baseUrls[' ' + base] = base + '/';
201
+ } else {
202
+ baseUrls[' ' + base] = rtrim(base, '/', true);
203
+ }
204
+ }
205
+
206
+ base = baseUrls[' ' + base];
207
+ var relativeBase = base.indexOf(':') === -1;
208
+
209
+ if (href.substring(0, 2) === '//') {
210
+ if (relativeBase) {
211
+ return href;
212
+ }
213
+
214
+ return base.replace(protocol, '$1') + href;
215
+ } else if (href.charAt(0) === '/') {
216
+ if (relativeBase) {
217
+ return href;
218
+ }
219
+
220
+ return base.replace(domain, '$1') + href;
221
+ } else {
222
+ return base + href;
223
+ }
224
+ }
225
+ var noopTest = {
226
+ exec: function noopTest() {}
227
+ };
228
+ function merge(obj) {
229
+ var i = 1,
230
+ target,
231
+ key;
232
+
233
+ for (; i < arguments.length; i++) {
234
+ target = arguments[i];
235
+
236
+ for (key in target) {
237
+ if (Object.prototype.hasOwnProperty.call(target, key)) {
238
+ obj[key] = target[key];
239
+ }
240
+ }
241
+ }
242
+
243
+ return obj;
244
+ }
245
+ function splitCells(tableRow, count) {
246
+ // ensure that every cell-delimiting pipe has a space
247
+ // before it to distinguish it from an escaped pipe
248
+ var row = tableRow.replace(/\|/g, function (match, offset, str) {
249
+ var escaped = false,
250
+ curr = offset;
251
+
252
+ while (--curr >= 0 && str[curr] === '\\') {
253
+ escaped = !escaped;
254
+ }
255
+
256
+ if (escaped) {
257
+ // odd number of slashes means | is escaped
258
+ // so we leave it alone
259
+ return '|';
260
+ } else {
261
+ // add space before unescaped |
262
+ return ' |';
263
+ }
264
+ }),
265
+ cells = row.split(/ \|/);
266
+ var i = 0; // First/last cell in a row cannot be empty if it has no leading/trailing pipe
267
+
268
+ if (!cells[0].trim()) {
269
+ cells.shift();
270
+ }
271
+
272
+ if (!cells[cells.length - 1].trim()) {
273
+ cells.pop();
274
+ }
275
+
276
+ if (cells.length > count) {
277
+ cells.splice(count);
278
+ } else {
279
+ while (cells.length < count) {
280
+ cells.push('');
281
+ }
282
+ }
283
+
284
+ for (; i < cells.length; i++) {
285
+ // leading or trailing whitespace is ignored per the gfm spec
286
+ cells[i] = cells[i].trim().replace(/\\\|/g, '|');
287
+ }
288
+
289
+ return cells;
290
+ } // Remove trailing 'c's. Equivalent to str.replace(/c*$/, '').
291
+ // /c*$/ is vulnerable to REDOS.
292
+ // invert: Remove suffix of non-c chars instead. Default falsey.
293
+
294
+ function rtrim(str, c, invert) {
295
+ var l = str.length;
296
+
297
+ if (l === 0) {
298
+ return '';
299
+ } // Length of suffix matching the invert condition.
300
+
301
+
302
+ var suffLen = 0; // Step left until we fail to match the invert condition.
303
+
304
+ while (suffLen < l) {
305
+ var currChar = str.charAt(l - suffLen - 1);
306
+
307
+ if (currChar === c && !invert) {
308
+ suffLen++;
309
+ } else if (currChar !== c && invert) {
310
+ suffLen++;
311
+ } else {
312
+ break;
313
+ }
314
+ }
315
+
316
+ return str.substr(0, l - suffLen);
317
+ }
318
+ function findClosingBracket(str, b) {
319
+ if (str.indexOf(b[1]) === -1) {
320
+ return -1;
321
+ }
322
+
323
+ var l = str.length;
324
+ var level = 0,
325
+ i = 0;
326
+
327
+ for (; i < l; i++) {
328
+ if (str[i] === '\\') {
329
+ i++;
330
+ } else if (str[i] === b[0]) {
331
+ level++;
332
+ } else if (str[i] === b[1]) {
333
+ level--;
334
+
335
+ if (level < 0) {
336
+ return i;
337
+ }
338
+ }
339
+ }
340
+
341
+ return -1;
342
+ }
343
+ function checkSanitizeDeprecation(opt) {
344
+ if (opt && opt.sanitize && !opt.silent) {
345
+ console.warn('marked(): sanitize and sanitizer parameters are deprecated since version 0.7.0, should not be used and will be removed in the future. Read more here: https://marked.js.org/#/USING_ADVANCED.md#options');
346
+ }
347
+ } // copied from https://stackoverflow.com/a/5450113/806777
348
+
349
+ function repeatString(pattern, count) {
350
+ if (count < 1) {
351
+ return '';
352
+ }
353
+
354
+ var result = '';
355
+
356
+ while (count > 1) {
357
+ if (count & 1) {
358
+ result += pattern;
359
+ }
360
+
361
+ count >>= 1;
362
+ pattern += pattern;
363
+ }
364
+
365
+ return result + pattern;
366
+ }
367
+
368
+ function outputLink(cap, link, raw, lexer) {
369
+ var href = link.href;
370
+ var title = link.title ? escape(link.title) : null;
371
+ var text = cap[1].replace(/\\([\[\]])/g, '$1');
372
+
373
+ if (cap[0].charAt(0) !== '!') {
374
+ lexer.state.inLink = true;
375
+ var token = {
376
+ type: 'link',
377
+ raw: raw,
378
+ href: href,
379
+ title: title,
380
+ text: text,
381
+ tokens: lexer.inlineTokens(text, [])
382
+ };
383
+ lexer.state.inLink = false;
384
+ return token;
385
+ } else {
386
+ return {
387
+ type: 'image',
388
+ raw: raw,
389
+ href: href,
390
+ title: title,
391
+ text: escape(text)
392
+ };
393
+ }
394
+ }
395
+
396
+ function indentCodeCompensation(raw, text) {
397
+ var matchIndentToCode = raw.match(/^(\s+)(?:```)/);
398
+
399
+ if (matchIndentToCode === null) {
400
+ return text;
401
+ }
402
+
403
+ var indentToCode = matchIndentToCode[1];
404
+ return text.split('\n').map(function (node) {
405
+ var matchIndentInNode = node.match(/^\s+/);
406
+
407
+ if (matchIndentInNode === null) {
408
+ return node;
409
+ }
410
+
411
+ var indentInNode = matchIndentInNode[0];
412
+
413
+ if (indentInNode.length >= indentToCode.length) {
414
+ return node.slice(indentToCode.length);
415
+ }
416
+
417
+ return node;
418
+ }).join('\n');
419
+ }
420
+ /**
421
+ * Tokenizer
422
+ */
423
+
424
+
425
+ var Tokenizer = /*#__PURE__*/function () {
426
+ function Tokenizer(options) {
427
+ this.options = options || exports.defaults;
428
+ }
429
+
430
+ var _proto = Tokenizer.prototype;
431
+
432
+ _proto.space = function space(src) {
433
+ var cap = this.rules.block.newline.exec(src);
434
+
435
+ if (cap) {
436
+ if (cap[0].length > 1) {
437
+ return {
438
+ type: 'space',
439
+ raw: cap[0]
440
+ };
441
+ }
442
+
443
+ return {
444
+ raw: '\n'
445
+ };
446
+ }
447
+ };
448
+
449
+ _proto.code = function code(src) {
450
+ var cap = this.rules.block.code.exec(src);
451
+
452
+ if (cap) {
453
+ var text = cap[0].replace(/^ {1,4}/gm, '');
454
+ return {
455
+ type: 'code',
456
+ raw: cap[0],
457
+ codeBlockStyle: 'indented',
458
+ text: !this.options.pedantic ? rtrim(text, '\n') : text
459
+ };
460
+ }
461
+ };
462
+
463
+ _proto.fences = function fences(src) {
464
+ var cap = this.rules.block.fences.exec(src);
465
+
466
+ if (cap) {
467
+ var raw = cap[0];
468
+ var text = indentCodeCompensation(raw, cap[3] || '');
469
+ return {
470
+ type: 'code',
471
+ raw: raw,
472
+ lang: cap[2] ? cap[2].trim() : cap[2],
473
+ text: text
474
+ };
475
+ }
476
+ };
477
+
478
+ _proto.heading = function heading(src) {
479
+ var cap = this.rules.block.heading.exec(src);
480
+
481
+ if (cap) {
482
+ var text = cap[2].trim(); // remove trailing #s
483
+
484
+ if (/#$/.test(text)) {
485
+ var trimmed = rtrim(text, '#');
486
+
487
+ if (this.options.pedantic) {
488
+ text = trimmed.trim();
489
+ } else if (!trimmed || / $/.test(trimmed)) {
490
+ // CommonMark requires space before trailing #s
491
+ text = trimmed.trim();
492
+ }
493
+ }
494
+
495
+ var token = {
496
+ type: 'heading',
497
+ raw: cap[0],
498
+ depth: cap[1].length,
499
+ text: text,
500
+ tokens: []
501
+ };
502
+ this.lexer.inline(token.text, token.tokens);
503
+ return token;
504
+ }
505
+ };
506
+
507
+ _proto.hr = function hr(src) {
508
+ var cap = this.rules.block.hr.exec(src);
509
+
510
+ if (cap) {
511
+ return {
512
+ type: 'hr',
513
+ raw: cap[0]
514
+ };
515
+ }
516
+ };
517
+
518
+ _proto.blockquote = function blockquote(src) {
519
+ var cap = this.rules.block.blockquote.exec(src);
520
+
521
+ if (cap) {
522
+ var text = cap[0].replace(/^ *> ?/gm, '');
523
+ return {
524
+ type: 'blockquote',
525
+ raw: cap[0],
526
+ tokens: this.lexer.blockTokens(text, []),
527
+ text: text
528
+ };
529
+ }
530
+ };
531
+
532
+ _proto.list = function list(src) {
533
+ var cap = this.rules.block.list.exec(src);
534
+
535
+ if (cap) {
536
+ var raw, istask, ischecked, indent, i, blankLine, endsWithBlankLine, line, lines, itemContents;
537
+ var bull = cap[1].trim();
538
+ var isordered = bull.length > 1;
539
+ var list = {
540
+ type: 'list',
541
+ raw: '',
542
+ ordered: isordered,
543
+ start: isordered ? +bull.slice(0, -1) : '',
544
+ loose: false,
545
+ items: []
546
+ };
547
+ bull = isordered ? "\\d{1,9}\\" + bull.slice(-1) : "\\" + bull;
548
+
549
+ if (this.options.pedantic) {
550
+ bull = isordered ? bull : '[*+-]';
551
+ } // Get next list item
552
+
553
+
554
+ var itemRegex = new RegExp("^( {0,3}" + bull + ")((?: [^\\n]*| *)(?:\\n[^\\n]*)*(?:\\n|$))"); // Get each top-level item
555
+
556
+ while (src) {
557
+ if (this.rules.block.hr.test(src)) {
558
+ // End list if we encounter an HR (possibly move into itemRegex?)
559
+ break;
560
+ }
561
+
562
+ if (!(cap = itemRegex.exec(src))) {
563
+ break;
564
+ }
565
+
566
+ lines = cap[2].split('\n');
567
+
568
+ if (this.options.pedantic) {
569
+ indent = 2;
570
+ itemContents = lines[0].trimLeft();
571
+ } else {
572
+ indent = cap[2].search(/[^ ]/); // Find first non-space char
573
+
574
+ indent = cap[1].length + (indent > 4 ? 1 : indent); // intented code blocks after 4 spaces; indent is always 1
575
+
576
+ itemContents = lines[0].slice(indent - cap[1].length);
577
+ }
578
+
579
+ blankLine = false;
580
+ raw = cap[0];
581
+
582
+ if (!lines[0] && /^ *$/.test(lines[1])) {
583
+ // items begin with at most one blank line
584
+ raw = cap[1] + lines.slice(0, 2).join('\n') + '\n';
585
+ list.loose = true;
586
+ lines = [];
587
+ }
588
+
589
+ var nextBulletRegex = new RegExp("^ {0," + Math.min(3, indent - 1) + "}(?:[*+-]|\\d{1,9}[.)])");
590
+
591
+ for (i = 1; i < lines.length; i++) {
592
+ line = lines[i];
593
+
594
+ if (this.options.pedantic) {
595
+ // Re-align to follow commonmark nesting rules
596
+ line = line.replace(/^ {1,4}(?=( {4})*[^ ])/g, ' ');
597
+ } // End list item if found start of new bullet
598
+
599
+
600
+ if (nextBulletRegex.test(line)) {
601
+ raw = cap[1] + lines.slice(0, i).join('\n') + '\n';
602
+ break;
603
+ } // Until we encounter a blank line, item contents do not need indentation
604
+
605
+
606
+ if (!blankLine) {
607
+ if (!line.trim()) {
608
+ // Check if current line is empty
609
+ blankLine = true;
610
+ } // Dedent if possible
611
+
612
+
613
+ if (line.search(/[^ ]/) >= indent) {
614
+ itemContents += '\n' + line.slice(indent);
615
+ } else {
616
+ itemContents += '\n' + line;
617
+ }
618
+
619
+ continue;
620
+ } // Dedent this line
621
+
622
+
623
+ if (line.search(/[^ ]/) >= indent || !line.trim()) {
624
+ itemContents += '\n' + line.slice(indent);
625
+ continue;
626
+ } else {
627
+ // Line was not properly indented; end of this item
628
+ raw = cap[1] + lines.slice(0, i).join('\n') + '\n';
629
+ break;
630
+ }
631
+ }
632
+
633
+ if (!list.loose) {
634
+ // If the previous item ended with a blank line, the list is loose
635
+ if (endsWithBlankLine) {
636
+ list.loose = true;
637
+ } else if (/\n *\n *$/.test(raw)) {
638
+ endsWithBlankLine = true;
639
+ }
640
+ } // Check for task list items
641
+
642
+
643
+ if (this.options.gfm) {
644
+ istask = /^\[[ xX]\] /.exec(itemContents);
645
+
646
+ if (istask) {
647
+ ischecked = istask[0] !== '[ ] ';
648
+ itemContents = itemContents.replace(/^\[[ xX]\] +/, '');
649
+ }
650
+ }
651
+
652
+ list.items.push({
653
+ type: 'list_item',
654
+ raw: raw,
655
+ task: !!istask,
656
+ checked: ischecked,
657
+ loose: false,
658
+ text: itemContents
659
+ });
660
+ list.raw += raw;
661
+ src = src.slice(raw.length);
662
+ } // Do not consume newlines at end of final item. Alternatively, make itemRegex *start* with any newlines to simplify/speed up endsWithBlankLine logic
663
+
664
+
665
+ list.items[list.items.length - 1].raw = raw.trimRight();
666
+ list.items[list.items.length - 1].text = itemContents.trimRight();
667
+ list.raw = list.raw.trimRight();
668
+ var l = list.items.length; // Item child tokens handled here at end because we needed to have the final item to trim it first
669
+
670
+ for (i = 0; i < l; i++) {
671
+ this.lexer.state.top = false;
672
+ list.items[i].tokens = this.lexer.blockTokens(list.items[i].text, []);
673
+
674
+ if (list.items[i].tokens.some(function (t) {
675
+ return t.type === 'space';
676
+ })) {
677
+ list.loose = true;
678
+ list.items[i].loose = true;
679
+ }
680
+ }
681
+
682
+ return list;
683
+ }
684
+ };
685
+
686
+ _proto.html = function html(src) {
687
+ var cap = this.rules.block.html.exec(src);
688
+
689
+ if (cap) {
690
+ var token = {
691
+ type: 'html',
692
+ raw: cap[0],
693
+ pre: !this.options.sanitizer && (cap[1] === 'pre' || cap[1] === 'script' || cap[1] === 'style'),
694
+ text: cap[0]
695
+ };
696
+
697
+ if (this.options.sanitize) {
698
+ token.type = 'paragraph';
699
+ token.text = this.options.sanitizer ? this.options.sanitizer(cap[0]) : escape(cap[0]);
700
+ token.tokens = [];
701
+ this.lexer.inline(token.text, token.tokens);
702
+ }
703
+
704
+ return token;
705
+ }
706
+ };
707
+
708
+ _proto.def = function def(src) {
709
+ var cap = this.rules.block.def.exec(src);
710
+
711
+ if (cap) {
712
+ if (cap[3]) cap[3] = cap[3].substring(1, cap[3].length - 1);
713
+ var tag = cap[1].toLowerCase().replace(/\s+/g, ' ');
714
+ return {
715
+ type: 'def',
716
+ tag: tag,
717
+ raw: cap[0],
718
+ href: cap[2],
719
+ title: cap[3]
720
+ };
721
+ }
722
+ };
723
+
724
+ _proto.table = function table(src) {
725
+ var cap = this.rules.block.table.exec(src);
726
+
727
+ if (cap) {
728
+ var item = {
729
+ type: 'table',
730
+ header: splitCells(cap[1]).map(function (c) {
731
+ return {
732
+ text: c
733
+ };
734
+ }),
735
+ align: cap[2].replace(/^ *|\| *$/g, '').split(/ *\| */),
736
+ rows: cap[3] ? cap[3].replace(/\n$/, '').split('\n') : []
737
+ };
738
+
739
+ if (item.header.length === item.align.length) {
740
+ item.raw = cap[0];
741
+ var l = item.align.length;
742
+ var i, j, k, row;
743
+
744
+ for (i = 0; i < l; i++) {
745
+ if (/^ *-+: *$/.test(item.align[i])) {
746
+ item.align[i] = 'right';
747
+ } else if (/^ *:-+: *$/.test(item.align[i])) {
748
+ item.align[i] = 'center';
749
+ } else if (/^ *:-+ *$/.test(item.align[i])) {
750
+ item.align[i] = 'left';
751
+ } else {
752
+ item.align[i] = null;
753
+ }
754
+ }
755
+
756
+ l = item.rows.length;
757
+
758
+ for (i = 0; i < l; i++) {
759
+ item.rows[i] = splitCells(item.rows[i], item.header.length).map(function (c) {
760
+ return {
761
+ text: c
762
+ };
763
+ });
764
+ } // parse child tokens inside headers and cells
765
+ // header child tokens
766
+
767
+
768
+ l = item.header.length;
769
+
770
+ for (j = 0; j < l; j++) {
771
+ item.header[j].tokens = [];
772
+ this.lexer.inlineTokens(item.header[j].text, item.header[j].tokens);
773
+ } // cell child tokens
774
+
775
+
776
+ l = item.rows.length;
777
+
778
+ for (j = 0; j < l; j++) {
779
+ row = item.rows[j];
780
+
781
+ for (k = 0; k < row.length; k++) {
782
+ row[k].tokens = [];
783
+ this.lexer.inlineTokens(row[k].text, row[k].tokens);
784
+ }
785
+ }
786
+
787
+ return item;
788
+ }
789
+ }
790
+ };
791
+
792
+ _proto.lheading = function lheading(src) {
793
+ var cap = this.rules.block.lheading.exec(src);
794
+
795
+ if (cap) {
796
+ var token = {
797
+ type: 'heading',
798
+ raw: cap[0],
799
+ depth: cap[2].charAt(0) === '=' ? 1 : 2,
800
+ text: cap[1],
801
+ tokens: []
802
+ };
803
+ this.lexer.inline(token.text, token.tokens);
804
+ return token;
805
+ }
806
+ };
807
+
808
+ _proto.paragraph = function paragraph(src) {
809
+ var cap = this.rules.block.paragraph.exec(src);
810
+
811
+ if (cap) {
812
+ var token = {
813
+ type: 'paragraph',
814
+ raw: cap[0],
815
+ text: cap[1].charAt(cap[1].length - 1) === '\n' ? cap[1].slice(0, -1) : cap[1],
816
+ tokens: []
817
+ };
818
+ this.lexer.inline(token.text, token.tokens);
819
+ return token;
820
+ }
821
+ };
822
+
823
+ _proto.text = function text(src) {
824
+ var cap = this.rules.block.text.exec(src);
825
+
826
+ if (cap) {
827
+ var token = {
828
+ type: 'text',
829
+ raw: cap[0],
830
+ text: cap[0],
831
+ tokens: []
832
+ };
833
+ this.lexer.inline(token.text, token.tokens);
834
+ return token;
835
+ }
836
+ };
837
+
838
+ _proto.escape = function escape$1(src) {
839
+ var cap = this.rules.inline.escape.exec(src);
840
+
841
+ if (cap) {
842
+ return {
843
+ type: 'escape',
844
+ raw: cap[0],
845
+ text: escape(cap[1])
846
+ };
847
+ }
848
+ };
849
+
850
+ _proto.tag = function tag(src) {
851
+ var cap = this.rules.inline.tag.exec(src);
852
+
853
+ if (cap) {
854
+ if (!this.lexer.state.inLink && /^<a /i.test(cap[0])) {
855
+ this.lexer.state.inLink = true;
856
+ } else if (this.lexer.state.inLink && /^<\/a>/i.test(cap[0])) {
857
+ this.lexer.state.inLink = false;
858
+ }
859
+
860
+ if (!this.lexer.state.inRawBlock && /^<(pre|code|kbd|script)(\s|>)/i.test(cap[0])) {
861
+ this.lexer.state.inRawBlock = true;
862
+ } else if (this.lexer.state.inRawBlock && /^<\/(pre|code|kbd|script)(\s|>)/i.test(cap[0])) {
863
+ this.lexer.state.inRawBlock = false;
864
+ }
865
+
866
+ return {
867
+ type: this.options.sanitize ? 'text' : 'html',
868
+ raw: cap[0],
869
+ inLink: this.lexer.state.inLink,
870
+ inRawBlock: this.lexer.state.inRawBlock,
871
+ text: this.options.sanitize ? this.options.sanitizer ? this.options.sanitizer(cap[0]) : escape(cap[0]) : cap[0]
872
+ };
873
+ }
874
+ };
875
+
876
+ _proto.link = function link(src) {
877
+ var cap = this.rules.inline.link.exec(src);
878
+
879
+ if (cap) {
880
+ var trimmedUrl = cap[2].trim();
881
+
882
+ if (!this.options.pedantic && /^</.test(trimmedUrl)) {
883
+ // commonmark requires matching angle brackets
884
+ if (!/>$/.test(trimmedUrl)) {
885
+ return;
886
+ } // ending angle bracket cannot be escaped
887
+
888
+
889
+ var rtrimSlash = rtrim(trimmedUrl.slice(0, -1), '\\');
890
+
891
+ if ((trimmedUrl.length - rtrimSlash.length) % 2 === 0) {
892
+ return;
893
+ }
894
+ } else {
895
+ // find closing parenthesis
896
+ var lastParenIndex = findClosingBracket(cap[2], '()');
897
+
898
+ if (lastParenIndex > -1) {
899
+ var start = cap[0].indexOf('!') === 0 ? 5 : 4;
900
+ var linkLen = start + cap[1].length + lastParenIndex;
901
+ cap[2] = cap[2].substring(0, lastParenIndex);
902
+ cap[0] = cap[0].substring(0, linkLen).trim();
903
+ cap[3] = '';
904
+ }
905
+ }
906
+
907
+ var href = cap[2];
908
+ var title = '';
909
+
910
+ if (this.options.pedantic) {
911
+ // split pedantic href and title
912
+ var link = /^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(href);
913
+
914
+ if (link) {
915
+ href = link[1];
916
+ title = link[3];
917
+ }
918
+ } else {
919
+ title = cap[3] ? cap[3].slice(1, -1) : '';
920
+ }
921
+
922
+ href = href.trim();
923
+
924
+ if (/^</.test(href)) {
925
+ if (this.options.pedantic && !/>$/.test(trimmedUrl)) {
926
+ // pedantic allows starting angle bracket without ending angle bracket
927
+ href = href.slice(1);
928
+ } else {
929
+ href = href.slice(1, -1);
930
+ }
931
+ }
932
+
933
+ return outputLink(cap, {
934
+ href: href ? href.replace(this.rules.inline._escapes, '$1') : href,
935
+ title: title ? title.replace(this.rules.inline._escapes, '$1') : title
936
+ }, cap[0], this.lexer);
937
+ }
938
+ };
939
+
940
+ _proto.reflink = function reflink(src, links) {
941
+ var cap;
942
+
943
+ if ((cap = this.rules.inline.reflink.exec(src)) || (cap = this.rules.inline.nolink.exec(src))) {
944
+ var link = (cap[2] || cap[1]).replace(/\s+/g, ' ');
945
+ link = links[link.toLowerCase()];
946
+
947
+ if (!link || !link.href) {
948
+ var text = cap[0].charAt(0);
949
+ return {
950
+ type: 'text',
951
+ raw: text,
952
+ text: text
953
+ };
954
+ }
955
+
956
+ return outputLink(cap, link, cap[0], this.lexer);
957
+ }
958
+ };
959
+
960
+ _proto.emStrong = function emStrong(src, maskedSrc, prevChar) {
961
+ if (prevChar === void 0) {
962
+ prevChar = '';
963
+ }
964
+
965
+ var match = this.rules.inline.emStrong.lDelim.exec(src);
966
+ if (!match) return; // _ can't be between two alphanumerics. \p{L}\p{N} includes non-english alphabet/numbers as well
967
+
968
+ if (match[3] && prevChar.match(/(?:[0-9A-Za-z\xAA\xB2\xB3\xB5\xB9\xBA\xBC-\xBE\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0560-\u0588\u05D0-\u05EA\u05EF-\u05F2\u0620-\u064A\u0660-\u0669\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07C0-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u0860-\u086A\u0870-\u0887\u0889-\u088E\u08A0-\u08C9\u0904-\u0939\u093D\u0950\u0958-\u0961\u0966-\u096F\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09E6-\u09F1\u09F4-\u09F9\u09FC\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A66-\u0A6F\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AE6-\u0AEF\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B66-\u0B6F\u0B71-\u0B77\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0BE6-\u0BF2\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C5D\u0C60\u0C61\u0C66-\u0C6F\u0C78-\u0C7E\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDD\u0CDE\u0CE0\u0CE1\u0CE6-\u0CEF\u0CF1\u0CF2\u0D04-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D58-\u0D61\u0D66-\u0D78\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0DE6-\u0DEF\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E50-\u0E59\u0E81\u0E82\u0E84\u0E86-\u0E8A\u0E8C-\u0EA3\u0EA5\u0EA7-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0ED0-\u0ED9\u0EDC-\u0EDF\u0F00\u0F20-\u0F33\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F-\u1049\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u1090-\u1099\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1369-\u137C\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u1711\u171F-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u17E0-\u17E9\u17F0-\u17F9\u1810-\u1819\u1820-\u1878\u1880-\u1884\u1887-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1946-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u19D0-\u19DA\u1A00-\u1A16\u1A20-\u1A54\u1A80-\u1A89\u1A90-\u1A99\u1AA7\u1B05-\u1B33\u1B45-\u1B4C\u1B50-\u1B59\u1B83-\u1BA0\u1BAE-\u1BE5\u1C00-\u1C23\u1C40-\u1C49\u1C4D-\u1C7D\u1C80-\u1C88\u1C90-\u1CBA\u1CBD-\u1CBF\u1CE9-\u1CEC\u1CEE-\u1CF3\u1CF5\u1CF6\u1CFA\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2070\u2071\u2074-\u2079\u207F-\u2089\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2150-\u2189\u2460-\u249B\u24EA-\u24FF\u2776-\u2793\u2C00-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2CFD\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312F\u3131-\u318E\u3192-\u3195\u31A0-\u31BF\u31F0-\u31FF\u3220-\u3229\u3248-\u324F\u3251-\u325F\u3280-\u3289\u32B1-\u32BF\u3400-\u4DBF\u4E00-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA7CA\uA7D0\uA7D1\uA7D3\uA7D5-\uA7D9\uA7F2-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA830-\uA835\uA840-\uA873\uA882-\uA8B3\uA8D0-\uA8D9\uA8F2-\uA8F7\uA8FB\uA8FD\uA8FE\uA900-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF-\uA9D9\uA9E0-\uA9E4\uA9E6-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA50-\uAA59\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB69\uAB70-\uABE2\uABF0-\uABF9\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF10-\uFF19\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD07-\uDD33\uDD40-\uDD78\uDD8A\uDD8B\uDE80-\uDE9C\uDEA0-\uDED0\uDEE1-\uDEFB\uDF00-\uDF23\uDF2D-\uDF4A\uDF50-\uDF75\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDCA0-\uDCA9\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDD70-\uDD7A\uDD7C-\uDD8A\uDD8C-\uDD92\uDD94\uDD95\uDD97-\uDDA1\uDDA3-\uDDB1\uDDB3-\uDDB9\uDDBB\uDDBC\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67\uDF80-\uDF85\uDF87-\uDFB0\uDFB2-\uDFBA]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC58-\uDC76\uDC79-\uDC9E\uDCA7-\uDCAF\uDCE0-\uDCF2\uDCF4\uDCF5\uDCFB-\uDD1B\uDD20-\uDD39\uDD80-\uDDB7\uDDBC-\uDDCF\uDDD2-\uDE00\uDE10-\uDE13\uDE15-\uDE17\uDE19-\uDE35\uDE40-\uDE48\uDE60-\uDE7E\uDE80-\uDE9F\uDEC0-\uDEC7\uDEC9-\uDEE4\uDEEB-\uDEEF\uDF00-\uDF35\uDF40-\uDF55\uDF58-\uDF72\uDF78-\uDF91\uDFA9-\uDFAF]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2\uDCFA-\uDD23\uDD30-\uDD39\uDE60-\uDE7E\uDE80-\uDEA9\uDEB0\uDEB1\uDF00-\uDF27\uDF30-\uDF45\uDF51-\uDF54\uDF70-\uDF81\uDFB0-\uDFCB\uDFE0-\uDFF6]|\uD804[\uDC03-\uDC37\uDC52-\uDC6F\uDC71\uDC72\uDC75\uDC83-\uDCAF\uDCD0-\uDCE8\uDCF0-\uDCF9\uDD03-\uDD26\uDD36-\uDD3F\uDD44\uDD47\uDD50-\uDD72\uDD76\uDD83-\uDDB2\uDDC1-\uDDC4\uDDD0-\uDDDA\uDDDC\uDDE1-\uDDF4\uDE00-\uDE11\uDE13-\uDE2B\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEDE\uDEF0-\uDEF9\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3D\uDF50\uDF5D-\uDF61]|\uD805[\uDC00-\uDC34\uDC47-\uDC4A\uDC50-\uDC59\uDC5F-\uDC61\uDC80-\uDCAF\uDCC4\uDCC5\uDCC7\uDCD0-\uDCD9\uDD80-\uDDAE\uDDD8-\uDDDB\uDE00-\uDE2F\uDE44\uDE50-\uDE59\uDE80-\uDEAA\uDEB8\uDEC0-\uDEC9\uDF00-\uDF1A\uDF30-\uDF3B\uDF40-\uDF46]|\uD806[\uDC00-\uDC2B\uDCA0-\uDCF2\uDCFF-\uDD06\uDD09\uDD0C-\uDD13\uDD15\uDD16\uDD18-\uDD2F\uDD3F\uDD41\uDD50-\uDD59\uDDA0-\uDDA7\uDDAA-\uDDD0\uDDE1\uDDE3\uDE00\uDE0B-\uDE32\uDE3A\uDE50\uDE5C-\uDE89\uDE9D\uDEB0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC2E\uDC40\uDC50-\uDC6C\uDC72-\uDC8F\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD30\uDD46\uDD50-\uDD59\uDD60-\uDD65\uDD67\uDD68\uDD6A-\uDD89\uDD98\uDDA0-\uDDA9\uDEE0-\uDEF2\uDFB0\uDFC0-\uDFD4]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|\uD80B[\uDF90-\uDFF0]|[\uD80C\uD81C-\uD820\uD822\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879\uD880-\uD883][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDE60-\uDE69\uDE70-\uDEBE\uDEC0-\uDEC9\uDED0-\uDEED\uDF00-\uDF2F\uDF40-\uDF43\uDF50-\uDF59\uDF5B-\uDF61\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDE40-\uDE96\uDF00-\uDF4A\uDF50\uDF93-\uDF9F\uDFE0\uDFE1\uDFE3]|\uD821[\uDC00-\uDFF7]|\uD823[\uDC00-\uDCD5\uDD00-\uDD08]|\uD82B[\uDFF0-\uDFF3\uDFF5-\uDFFB\uDFFD\uDFFE]|\uD82C[\uDC00-\uDD22\uDD50-\uDD52\uDD64-\uDD67\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99]|\uD834[\uDEE0-\uDEF3\uDF60-\uDF78]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB\uDFCE-\uDFFF]|\uD837[\uDF00-\uDF1E]|\uD838[\uDD00-\uDD2C\uDD37-\uDD3D\uDD40-\uDD49\uDD4E\uDE90-\uDEAD\uDEC0-\uDEEB\uDEF0-\uDEF9]|\uD839[\uDFE0-\uDFE6\uDFE8-\uDFEB\uDFED\uDFEE\uDFF0-\uDFFE]|\uD83A[\uDC00-\uDCC4\uDCC7-\uDCCF\uDD00-\uDD43\uDD4B\uDD50-\uDD59]|\uD83B[\uDC71-\uDCAB\uDCAD-\uDCAF\uDCB1-\uDCB4\uDD01-\uDD2D\uDD2F-\uDD3D\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD83C[\uDD00-\uDD0C]|\uD83E[\uDFF0-\uDFF9]|\uD869[\uDC00-\uDEDF\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF38\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|\uD87E[\uDC00-\uDE1D]|\uD884[\uDC00-\uDF4A])/)) return;
969
+ var nextChar = match[1] || match[2] || '';
970
+
971
+ if (!nextChar || nextChar && (prevChar === '' || this.rules.inline.punctuation.exec(prevChar))) {
972
+ var lLength = match[0].length - 1;
973
+ var rDelim,
974
+ rLength,
975
+ delimTotal = lLength,
976
+ midDelimTotal = 0;
977
+ var endReg = match[0][0] === '*' ? this.rules.inline.emStrong.rDelimAst : this.rules.inline.emStrong.rDelimUnd;
978
+ endReg.lastIndex = 0; // Clip maskedSrc to same section of string as src (move to lexer?)
979
+
980
+ maskedSrc = maskedSrc.slice(-1 * src.length + lLength);
981
+
982
+ while ((match = endReg.exec(maskedSrc)) != null) {
983
+ rDelim = match[1] || match[2] || match[3] || match[4] || match[5] || match[6];
984
+ if (!rDelim) continue; // skip single * in __abc*abc__
985
+
986
+ rLength = rDelim.length;
987
+
988
+ if (match[3] || match[4]) {
989
+ // found another Left Delim
990
+ delimTotal += rLength;
991
+ continue;
992
+ } else if (match[5] || match[6]) {
993
+ // either Left or Right Delim
994
+ if (lLength % 3 && !((lLength + rLength) % 3)) {
995
+ midDelimTotal += rLength;
996
+ continue; // CommonMark Emphasis Rules 9-10
997
+ }
998
+ }
999
+
1000
+ delimTotal -= rLength;
1001
+ if (delimTotal > 0) continue; // Haven't found enough closing delimiters
1002
+ // Remove extra characters. *a*** -> *a*
1003
+
1004
+ rLength = Math.min(rLength, rLength + delimTotal + midDelimTotal); // Create `em` if smallest delimiter has odd char count. *a***
1005
+
1006
+ if (Math.min(lLength, rLength) % 2) {
1007
+ var _text = src.slice(1, lLength + match.index + rLength);
1008
+
1009
+ return {
1010
+ type: 'em',
1011
+ raw: src.slice(0, lLength + match.index + rLength + 1),
1012
+ text: _text,
1013
+ tokens: this.lexer.inlineTokens(_text, [])
1014
+ };
1015
+ } // Create 'strong' if smallest delimiter has even char count. **a***
1016
+
1017
+
1018
+ var text = src.slice(2, lLength + match.index + rLength - 1);
1019
+ return {
1020
+ type: 'strong',
1021
+ raw: src.slice(0, lLength + match.index + rLength + 1),
1022
+ text: text,
1023
+ tokens: this.lexer.inlineTokens(text, [])
1024
+ };
1025
+ }
1026
+ }
1027
+ };
1028
+
1029
+ _proto.codespan = function codespan(src) {
1030
+ var cap = this.rules.inline.code.exec(src);
1031
+
1032
+ if (cap) {
1033
+ var text = cap[2].replace(/\n/g, ' ');
1034
+ var hasNonSpaceChars = /[^ ]/.test(text);
1035
+ var hasSpaceCharsOnBothEnds = /^ /.test(text) && / $/.test(text);
1036
+
1037
+ if (hasNonSpaceChars && hasSpaceCharsOnBothEnds) {
1038
+ text = text.substring(1, text.length - 1);
1039
+ }
1040
+
1041
+ text = escape(text, true);
1042
+ return {
1043
+ type: 'codespan',
1044
+ raw: cap[0],
1045
+ text: text
1046
+ };
1047
+ }
1048
+ };
1049
+
1050
+ _proto.br = function br(src) {
1051
+ var cap = this.rules.inline.br.exec(src);
1052
+
1053
+ if (cap) {
1054
+ return {
1055
+ type: 'br',
1056
+ raw: cap[0]
1057
+ };
1058
+ }
1059
+ };
1060
+
1061
+ _proto.del = function del(src) {
1062
+ var cap = this.rules.inline.del.exec(src);
1063
+
1064
+ if (cap) {
1065
+ return {
1066
+ type: 'del',
1067
+ raw: cap[0],
1068
+ text: cap[2],
1069
+ tokens: this.lexer.inlineTokens(cap[2], [])
1070
+ };
1071
+ }
1072
+ };
1073
+
1074
+ _proto.autolink = function autolink(src, mangle) {
1075
+ var cap = this.rules.inline.autolink.exec(src);
1076
+
1077
+ if (cap) {
1078
+ var text, href;
1079
+
1080
+ if (cap[2] === '@') {
1081
+ text = escape(this.options.mangle ? mangle(cap[1]) : cap[1]);
1082
+ href = 'mailto:' + text;
1083
+ } else {
1084
+ text = escape(cap[1]);
1085
+ href = text;
1086
+ }
1087
+
1088
+ return {
1089
+ type: 'link',
1090
+ raw: cap[0],
1091
+ text: text,
1092
+ href: href,
1093
+ tokens: [{
1094
+ type: 'text',
1095
+ raw: text,
1096
+ text: text
1097
+ }]
1098
+ };
1099
+ }
1100
+ };
1101
+
1102
+ _proto.url = function url(src, mangle) {
1103
+ var cap;
1104
+
1105
+ if (cap = this.rules.inline.url.exec(src)) {
1106
+ var text, href;
1107
+
1108
+ if (cap[2] === '@') {
1109
+ text = escape(this.options.mangle ? mangle(cap[0]) : cap[0]);
1110
+ href = 'mailto:' + text;
1111
+ } else {
1112
+ // do extended autolink path validation
1113
+ var prevCapZero;
1114
+
1115
+ do {
1116
+ prevCapZero = cap[0];
1117
+ cap[0] = this.rules.inline._backpedal.exec(cap[0])[0];
1118
+ } while (prevCapZero !== cap[0]);
1119
+
1120
+ text = escape(cap[0]);
1121
+
1122
+ if (cap[1] === 'www.') {
1123
+ href = 'http://' + text;
1124
+ } else {
1125
+ href = text;
1126
+ }
1127
+ }
1128
+
1129
+ return {
1130
+ type: 'link',
1131
+ raw: cap[0],
1132
+ text: text,
1133
+ href: href,
1134
+ tokens: [{
1135
+ type: 'text',
1136
+ raw: text,
1137
+ text: text
1138
+ }]
1139
+ };
1140
+ }
1141
+ };
1142
+
1143
+ _proto.inlineText = function inlineText(src, smartypants) {
1144
+ var cap = this.rules.inline.text.exec(src);
1145
+
1146
+ if (cap) {
1147
+ var text;
1148
+
1149
+ if (this.lexer.state.inRawBlock) {
1150
+ text = this.options.sanitize ? this.options.sanitizer ? this.options.sanitizer(cap[0]) : escape(cap[0]) : cap[0];
1151
+ } else {
1152
+ text = escape(this.options.smartypants ? smartypants(cap[0]) : cap[0]);
1153
+ }
1154
+
1155
+ return {
1156
+ type: 'text',
1157
+ raw: cap[0],
1158
+ text: text
1159
+ };
1160
+ }
1161
+ };
1162
+
1163
+ return Tokenizer;
1164
+ }();
1165
+
1166
+ /**
1167
+ * Block-Level Grammar
1168
+ */
1169
+
1170
+ var block = {
1171
+ newline: /^(?: *(?:\n|$))+/,
1172
+ code: /^( {4}[^\n]+(?:\n(?: *(?:\n|$))*)?)+/,
1173
+ fences: /^ {0,3}(`{3,}(?=[^`\n]*\n)|~{3,})([^\n]*)\n(?:|([\s\S]*?)\n)(?: {0,3}\1[~`]* *(?=\n|$)|$)/,
1174
+ hr: /^ {0,3}((?:- *){3,}|(?:_ *){3,}|(?:\* *){3,})(?:\n+|$)/,
1175
+ heading: /^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,
1176
+ blockquote: /^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/,
1177
+ list: /^( {0,3}bull)( [^\n]+?)?(?:\n|$)/,
1178
+ html: '^ {0,3}(?:' // optional indentation
1179
+ + '<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)' // (1)
1180
+ + '|comment[^\\n]*(\\n+|$)' // (2)
1181
+ + '|<\\?[\\s\\S]*?(?:\\?>\\n*|$)' // (3)
1182
+ + '|<![A-Z][\\s\\S]*?(?:>\\n*|$)' // (4)
1183
+ + '|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)' // (5)
1184
+ + '|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n *)+\\n|$)' // (6)
1185
+ + '|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n *)+\\n|$)' // (7) open tag
1186
+ + '|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n *)+\\n|$)' // (7) closing tag
1187
+ + ')',
1188
+ def: /^ {0,3}\[(label)\]: *\n? *<?([^\s>]+)>?(?:(?: +\n? *| *\n *)(title))? *(?:\n+|$)/,
1189
+ table: noopTest,
1190
+ lheading: /^([^\n]+)\n {0,3}(=+|-+) *(?:\n+|$)/,
1191
+ // regex template, placeholders will be replaced according to different paragraph
1192
+ // interruption rules of commonmark and the original markdown spec:
1193
+ _paragraph: /^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html| +\n)[^\n]+)*)/,
1194
+ text: /^[^\n]+/
1195
+ };
1196
+ block._label = /(?!\s*\])(?:\\[\[\]]|[^\[\]])+/;
1197
+ block._title = /(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/;
1198
+ block.def = edit(block.def).replace('label', block._label).replace('title', block._title).getRegex();
1199
+ block.bullet = /(?:[*+-]|\d{1,9}[.)])/;
1200
+ block.listItemStart = edit(/^( *)(bull) */).replace('bull', block.bullet).getRegex();
1201
+ block.list = edit(block.list).replace(/bull/g, block.bullet).replace('hr', '\\n+(?=\\1?(?:(?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$))').replace('def', '\\n+(?=' + block.def.source + ')').getRegex();
1202
+ block._tag = 'address|article|aside|base|basefont|blockquote|body|caption' + '|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption' + '|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe' + '|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option' + '|p|param|section|source|summary|table|tbody|td|tfoot|th|thead|title|tr' + '|track|ul';
1203
+ block._comment = /<!--(?!-?>)[\s\S]*?(?:-->|$)/;
1204
+ block.html = edit(block.html, 'i').replace('comment', block._comment).replace('tag', block._tag).replace('attribute', / +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex();
1205
+ block.paragraph = edit(block._paragraph).replace('hr', block.hr).replace('heading', ' {0,3}#{1,6} ').replace('|lheading', '') // setex headings don't interrupt commonmark paragraphs
1206
+ .replace('blockquote', ' {0,3}>').replace('fences', ' {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n').replace('list', ' {0,3}(?:[*+-]|1[.)]) ') // only lists starting from 1 can interrupt
1207
+ .replace('html', '</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)').replace('tag', block._tag) // pars can be interrupted by type (6) html blocks
1208
+ .getRegex();
1209
+ block.blockquote = edit(block.blockquote).replace('paragraph', block.paragraph).getRegex();
1210
+ /**
1211
+ * Normal Block Grammar
1212
+ */
1213
+
1214
+ block.normal = merge({}, block);
1215
+ /**
1216
+ * GFM Block Grammar
1217
+ */
1218
+
1219
+ block.gfm = merge({}, block.normal, {
1220
+ table: '^ *([^\\n ].*\\|.*)\\n' // Header
1221
+ + ' {0,3}(?:\\| *)?(:?-+:? *(?:\\| *:?-+:? *)*)(?:\\| *)?' // Align
1222
+ + '(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)' // Cells
1223
+
1224
+ });
1225
+ block.gfm.table = edit(block.gfm.table).replace('hr', block.hr).replace('heading', ' {0,3}#{1,6} ').replace('blockquote', ' {0,3}>').replace('code', ' {4}[^\\n]').replace('fences', ' {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n').replace('list', ' {0,3}(?:[*+-]|1[.)]) ') // only lists starting from 1 can interrupt
1226
+ .replace('html', '</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)').replace('tag', block._tag) // tables can be interrupted by type (6) html blocks
1227
+ .getRegex();
1228
+ /**
1229
+ * Pedantic grammar (original John Gruber's loose markdown specification)
1230
+ */
1231
+
1232
+ block.pedantic = merge({}, block.normal, {
1233
+ html: edit('^ *(?:comment *(?:\\n|\\s*$)' + '|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)' // closed tag
1234
+ + '|<tag(?:"[^"]*"|\'[^\']*\'|\\s[^\'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))').replace('comment', block._comment).replace(/tag/g, '(?!(?:' + 'a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub' + '|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)' + '\\b)\\w+(?!:|[^\\w\\s@]*@)\\b').getRegex(),
1235
+ def: /^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,
1236
+ heading: /^(#{1,6})(.*)(?:\n+|$)/,
1237
+ fences: noopTest,
1238
+ // fences not supported
1239
+ paragraph: edit(block.normal._paragraph).replace('hr', block.hr).replace('heading', ' *#{1,6} *[^\n]').replace('lheading', block.lheading).replace('blockquote', ' {0,3}>').replace('|fences', '').replace('|list', '').replace('|html', '').getRegex()
1240
+ });
1241
+ /**
1242
+ * Inline-Level Grammar
1243
+ */
1244
+
1245
+ var inline = {
1246
+ escape: /^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,
1247
+ autolink: /^<(scheme:[^\s\x00-\x1f<>]*|email)>/,
1248
+ url: noopTest,
1249
+ tag: '^comment' + '|^</[a-zA-Z][\\w:-]*\\s*>' // self-closing tag
1250
+ + '|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>' // open tag
1251
+ + '|^<\\?[\\s\\S]*?\\?>' // processing instruction, e.g. <?php ?>
1252
+ + '|^<![a-zA-Z]+\\s[\\s\\S]*?>' // declaration, e.g. <!DOCTYPE html>
1253
+ + '|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>',
1254
+ // CDATA section
1255
+ link: /^!?\[(label)\]\(\s*(href)(?:\s+(title))?\s*\)/,
1256
+ reflink: /^!?\[(label)\]\[(?!\s*\])((?:\\[\[\]]?|[^\[\]\\])+)\]/,
1257
+ nolink: /^!?\[(?!\s*\])((?:\[[^\[\]]*\]|\\[\[\]]|[^\[\]])*)\](?:\[\])?/,
1258
+ reflinkSearch: 'reflink|nolink(?!\\()',
1259
+ emStrong: {
1260
+ lDelim: /^(?:\*+(?:([punct_])|[^\s*]))|^_+(?:([punct*])|([^\s_]))/,
1261
+ // (1) and (2) can only be a Right Delimiter. (3) and (4) can only be Left. (5) and (6) can be either Left or Right.
1262
+ // () Skip orphan delim inside strong (1) #*** (2) a***#, a*** (3) #***a, ***a (4) ***# (5) #***# (6) a***a
1263
+ rDelimAst: /^[^_*]*?\_\_[^_*]*?\*[^_*]*?(?=\_\_)|[punct_](\*+)(?=[\s]|$)|[^punct*_\s](\*+)(?=[punct_\s]|$)|[punct_\s](\*+)(?=[^punct*_\s])|[\s](\*+)(?=[punct_])|[punct_](\*+)(?=[punct_])|[^punct*_\s](\*+)(?=[^punct*_\s])/,
1264
+ rDelimUnd: /^[^_*]*?\*\*[^_*]*?\_[^_*]*?(?=\*\*)|[punct*](\_+)(?=[\s]|$)|[^punct*_\s](\_+)(?=[punct*\s]|$)|[punct*\s](\_+)(?=[^punct*_\s])|[\s](\_+)(?=[punct*])|[punct*](\_+)(?=[punct*])/ // ^- Not allowed for _
1265
+
1266
+ },
1267
+ code: /^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,
1268
+ br: /^( {2,}|\\)\n(?!\s*$)/,
1269
+ del: noopTest,
1270
+ text: /^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,
1271
+ punctuation: /^([\spunctuation])/
1272
+ }; // list of punctuation marks from CommonMark spec
1273
+ // without * and _ to handle the different emphasis markers * and _
1274
+
1275
+ inline._punctuation = '!"#$%&\'()+\\-.,/:;<=>?@\\[\\]`^{|}~';
1276
+ inline.punctuation = edit(inline.punctuation).replace(/punctuation/g, inline._punctuation).getRegex(); // sequences em should skip over [title](link), `code`, <html>
1277
+
1278
+ inline.blockSkip = /\[[^\]]*?\]\([^\)]*?\)|`[^`]*?`|<[^>]*?>/g;
1279
+ inline.escapedEmSt = /\\\*|\\_/g;
1280
+ inline._comment = edit(block._comment).replace('(?:-->|$)', '-->').getRegex();
1281
+ inline.emStrong.lDelim = edit(inline.emStrong.lDelim).replace(/punct/g, inline._punctuation).getRegex();
1282
+ inline.emStrong.rDelimAst = edit(inline.emStrong.rDelimAst, 'g').replace(/punct/g, inline._punctuation).getRegex();
1283
+ inline.emStrong.rDelimUnd = edit(inline.emStrong.rDelimUnd, 'g').replace(/punct/g, inline._punctuation).getRegex();
1284
+ inline._escapes = /\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/g;
1285
+ inline._scheme = /[a-zA-Z][a-zA-Z0-9+.-]{1,31}/;
1286
+ inline._email = /[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])?)+(?![-_])/;
1287
+ inline.autolink = edit(inline.autolink).replace('scheme', inline._scheme).replace('email', inline._email).getRegex();
1288
+ inline._attribute = /\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/;
1289
+ inline.tag = edit(inline.tag).replace('comment', inline._comment).replace('attribute', inline._attribute).getRegex();
1290
+ inline._label = /(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/;
1291
+ inline._href = /<(?:\\.|[^\n<>\\])+>|[^\s\x00-\x1f]*/;
1292
+ inline._title = /"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/;
1293
+ inline.link = edit(inline.link).replace('label', inline._label).replace('href', inline._href).replace('title', inline._title).getRegex();
1294
+ inline.reflink = edit(inline.reflink).replace('label', inline._label).getRegex();
1295
+ inline.reflinkSearch = edit(inline.reflinkSearch, 'g').replace('reflink', inline.reflink).replace('nolink', inline.nolink).getRegex();
1296
+ /**
1297
+ * Normal Inline Grammar
1298
+ */
1299
+
1300
+ inline.normal = merge({}, inline);
1301
+ /**
1302
+ * Pedantic Inline Grammar
1303
+ */
1304
+
1305
+ inline.pedantic = merge({}, inline.normal, {
1306
+ strong: {
1307
+ start: /^__|\*\*/,
1308
+ middle: /^__(?=\S)([\s\S]*?\S)__(?!_)|^\*\*(?=\S)([\s\S]*?\S)\*\*(?!\*)/,
1309
+ endAst: /\*\*(?!\*)/g,
1310
+ endUnd: /__(?!_)/g
1311
+ },
1312
+ em: {
1313
+ start: /^_|\*/,
1314
+ middle: /^()\*(?=\S)([\s\S]*?\S)\*(?!\*)|^_(?=\S)([\s\S]*?\S)_(?!_)/,
1315
+ endAst: /\*(?!\*)/g,
1316
+ endUnd: /_(?!_)/g
1317
+ },
1318
+ link: edit(/^!?\[(label)\]\((.*?)\)/).replace('label', inline._label).getRegex(),
1319
+ reflink: edit(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace('label', inline._label).getRegex()
1320
+ });
1321
+ /**
1322
+ * GFM Inline Grammar
1323
+ */
1324
+
1325
+ inline.gfm = merge({}, inline.normal, {
1326
+ escape: edit(inline.escape).replace('])', '~|])').getRegex(),
1327
+ _extended_email: /[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/,
1328
+ url: /^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/,
1329
+ _backpedal: /(?:[^?!.,:;*_~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_~)]+(?!$))+/,
1330
+ del: /^(~~?)(?=[^\s~])([\s\S]*?[^\s~])\1(?=[^~]|$)/,
1331
+ text: /^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|https?:\/\/|ftp:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/
1332
+ });
1333
+ inline.gfm.url = edit(inline.gfm.url, 'i').replace('email', inline.gfm._extended_email).getRegex();
1334
+ /**
1335
+ * GFM + Line Breaks Inline Grammar
1336
+ */
1337
+
1338
+ inline.breaks = merge({}, inline.gfm, {
1339
+ br: edit(inline.br).replace('{2,}', '*').getRegex(),
1340
+ text: edit(inline.gfm.text).replace('\\b_', '\\b_| {2,}\\n').replace(/\{2,\}/g, '*').getRegex()
1341
+ });
1342
+
1343
+ /**
1344
+ * smartypants text replacement
1345
+ */
1346
+
1347
+ function smartypants(text) {
1348
+ return text // em-dashes
1349
+ .replace(/---/g, "\u2014") // en-dashes
1350
+ .replace(/--/g, "\u2013") // opening singles
1351
+ .replace(/(^|[-\u2014/(\[{"\s])'/g, "$1\u2018") // closing singles & apostrophes
1352
+ .replace(/'/g, "\u2019") // opening doubles
1353
+ .replace(/(^|[-\u2014/(\[{\u2018\s])"/g, "$1\u201C") // closing doubles
1354
+ .replace(/"/g, "\u201D") // ellipses
1355
+ .replace(/\.{3}/g, "\u2026");
1356
+ }
1357
+ /**
1358
+ * mangle email addresses
1359
+ */
1360
+
1361
+
1362
+ function mangle(text) {
1363
+ var out = '',
1364
+ i,
1365
+ ch;
1366
+ var l = text.length;
1367
+
1368
+ for (i = 0; i < l; i++) {
1369
+ ch = text.charCodeAt(i);
1370
+
1371
+ if (Math.random() > 0.5) {
1372
+ ch = 'x' + ch.toString(16);
1373
+ }
1374
+
1375
+ out += '&#' + ch + ';';
1376
+ }
1377
+
1378
+ return out;
1379
+ }
1380
+ /**
1381
+ * Block Lexer
1382
+ */
1383
+
1384
+
1385
+ var Lexer = /*#__PURE__*/function () {
1386
+ function Lexer(options) {
1387
+ this.tokens = [];
1388
+ this.tokens.links = Object.create(null);
1389
+ this.options = options || exports.defaults;
1390
+ this.options.tokenizer = this.options.tokenizer || new Tokenizer();
1391
+ this.tokenizer = this.options.tokenizer;
1392
+ this.tokenizer.options = this.options;
1393
+ this.tokenizer.lexer = this;
1394
+ this.inlineQueue = [];
1395
+ this.state = {
1396
+ inLink: false,
1397
+ inRawBlock: false,
1398
+ top: true
1399
+ };
1400
+ var rules = {
1401
+ block: block.normal,
1402
+ inline: inline.normal
1403
+ };
1404
+
1405
+ if (this.options.pedantic) {
1406
+ rules.block = block.pedantic;
1407
+ rules.inline = inline.pedantic;
1408
+ } else if (this.options.gfm) {
1409
+ rules.block = block.gfm;
1410
+
1411
+ if (this.options.breaks) {
1412
+ rules.inline = inline.breaks;
1413
+ } else {
1414
+ rules.inline = inline.gfm;
1415
+ }
1416
+ }
1417
+
1418
+ this.tokenizer.rules = rules;
1419
+ }
1420
+ /**
1421
+ * Expose Rules
1422
+ */
1423
+
1424
+
1425
+ /**
1426
+ * Static Lex Method
1427
+ */
1428
+ Lexer.lex = function lex(src, options) {
1429
+ var lexer = new Lexer(options);
1430
+ return lexer.lex(src);
1431
+ }
1432
+ /**
1433
+ * Static Lex Inline Method
1434
+ */
1435
+ ;
1436
+
1437
+ Lexer.lexInline = function lexInline(src, options) {
1438
+ var lexer = new Lexer(options);
1439
+ return lexer.inlineTokens(src);
1440
+ }
1441
+ /**
1442
+ * Preprocessing
1443
+ */
1444
+ ;
1445
+
1446
+ var _proto = Lexer.prototype;
1447
+
1448
+ _proto.lex = function lex(src) {
1449
+ src = src.replace(/\r\n|\r/g, '\n').replace(/\t/g, ' ');
1450
+ this.blockTokens(src, this.tokens);
1451
+ var next;
1452
+
1453
+ while (next = this.inlineQueue.shift()) {
1454
+ this.inlineTokens(next.src, next.tokens);
1455
+ }
1456
+
1457
+ return this.tokens;
1458
+ }
1459
+ /**
1460
+ * Lexing
1461
+ */
1462
+ ;
1463
+
1464
+ _proto.blockTokens = function blockTokens(src, tokens) {
1465
+ var _this = this;
1466
+
1467
+ if (tokens === void 0) {
1468
+ tokens = [];
1469
+ }
1470
+
1471
+ if (this.options.pedantic) {
1472
+ src = src.replace(/^ +$/gm, '');
1473
+ }
1474
+
1475
+ var token, lastToken, cutSrc, lastParagraphClipped;
1476
+
1477
+ while (src) {
1478
+ if (this.options.extensions && this.options.extensions.block && this.options.extensions.block.some(function (extTokenizer) {
1479
+ if (token = extTokenizer.call({
1480
+ lexer: _this
1481
+ }, src, tokens)) {
1482
+ src = src.substring(token.raw.length);
1483
+ tokens.push(token);
1484
+ return true;
1485
+ }
1486
+
1487
+ return false;
1488
+ })) {
1489
+ continue;
1490
+ } // newline
1491
+
1492
+
1493
+ if (token = this.tokenizer.space(src)) {
1494
+ src = src.substring(token.raw.length);
1495
+
1496
+ if (token.type) {
1497
+ tokens.push(token);
1498
+ }
1499
+
1500
+ continue;
1501
+ } // code
1502
+
1503
+
1504
+ if (token = this.tokenizer.code(src)) {
1505
+ src = src.substring(token.raw.length);
1506
+ lastToken = tokens[tokens.length - 1]; // An indented code block cannot interrupt a paragraph.
1507
+
1508
+ if (lastToken && (lastToken.type === 'paragraph' || lastToken.type === 'text')) {
1509
+ lastToken.raw += '\n' + token.raw;
1510
+ lastToken.text += '\n' + token.text;
1511
+ this.inlineQueue[this.inlineQueue.length - 1].src = lastToken.text;
1512
+ } else {
1513
+ tokens.push(token);
1514
+ }
1515
+
1516
+ continue;
1517
+ } // fences
1518
+
1519
+
1520
+ if (token = this.tokenizer.fences(src)) {
1521
+ src = src.substring(token.raw.length);
1522
+ tokens.push(token);
1523
+ continue;
1524
+ } // heading
1525
+
1526
+
1527
+ if (token = this.tokenizer.heading(src)) {
1528
+ src = src.substring(token.raw.length);
1529
+ tokens.push(token);
1530
+ continue;
1531
+ } // hr
1532
+
1533
+
1534
+ if (token = this.tokenizer.hr(src)) {
1535
+ src = src.substring(token.raw.length);
1536
+ tokens.push(token);
1537
+ continue;
1538
+ } // blockquote
1539
+
1540
+
1541
+ if (token = this.tokenizer.blockquote(src)) {
1542
+ src = src.substring(token.raw.length);
1543
+ tokens.push(token);
1544
+ continue;
1545
+ } // list
1546
+
1547
+
1548
+ if (token = this.tokenizer.list(src)) {
1549
+ src = src.substring(token.raw.length);
1550
+ tokens.push(token);
1551
+ continue;
1552
+ } // html
1553
+
1554
+
1555
+ if (token = this.tokenizer.html(src)) {
1556
+ src = src.substring(token.raw.length);
1557
+ tokens.push(token);
1558
+ continue;
1559
+ } // def
1560
+
1561
+
1562
+ if (token = this.tokenizer.def(src)) {
1563
+ src = src.substring(token.raw.length);
1564
+ lastToken = tokens[tokens.length - 1];
1565
+
1566
+ if (lastToken && (lastToken.type === 'paragraph' || lastToken.type === 'text')) {
1567
+ lastToken.raw += '\n' + token.raw;
1568
+ lastToken.text += '\n' + token.raw;
1569
+ this.inlineQueue[this.inlineQueue.length - 1].src = lastToken.text;
1570
+ } else if (!this.tokens.links[token.tag]) {
1571
+ this.tokens.links[token.tag] = {
1572
+ href: token.href,
1573
+ title: token.title
1574
+ };
1575
+ }
1576
+
1577
+ continue;
1578
+ } // table (gfm)
1579
+
1580
+
1581
+ if (token = this.tokenizer.table(src)) {
1582
+ src = src.substring(token.raw.length);
1583
+ tokens.push(token);
1584
+ continue;
1585
+ } // lheading
1586
+
1587
+
1588
+ if (token = this.tokenizer.lheading(src)) {
1589
+ src = src.substring(token.raw.length);
1590
+ tokens.push(token);
1591
+ continue;
1592
+ } // top-level paragraph
1593
+ // prevent paragraph consuming extensions by clipping 'src' to extension start
1594
+
1595
+
1596
+ cutSrc = src;
1597
+
1598
+ if (this.options.extensions && this.options.extensions.startBlock) {
1599
+ (function () {
1600
+ var startIndex = Infinity;
1601
+ var tempSrc = src.slice(1);
1602
+ var tempStart = void 0;
1603
+
1604
+ _this.options.extensions.startBlock.forEach(function (getStartIndex) {
1605
+ tempStart = getStartIndex.call({
1606
+ lexer: this
1607
+ }, tempSrc);
1608
+
1609
+ if (typeof tempStart === 'number' && tempStart >= 0) {
1610
+ startIndex = Math.min(startIndex, tempStart);
1611
+ }
1612
+ });
1613
+
1614
+ if (startIndex < Infinity && startIndex >= 0) {
1615
+ cutSrc = src.substring(0, startIndex + 1);
1616
+ }
1617
+ })();
1618
+ }
1619
+
1620
+ if (this.state.top && (token = this.tokenizer.paragraph(cutSrc))) {
1621
+ lastToken = tokens[tokens.length - 1];
1622
+
1623
+ if (lastParagraphClipped && lastToken.type === 'paragraph') {
1624
+ lastToken.raw += '\n' + token.raw;
1625
+ lastToken.text += '\n' + token.text;
1626
+ this.inlineQueue.pop();
1627
+ this.inlineQueue[this.inlineQueue.length - 1].src = lastToken.text;
1628
+ } else {
1629
+ tokens.push(token);
1630
+ }
1631
+
1632
+ lastParagraphClipped = cutSrc.length !== src.length;
1633
+ src = src.substring(token.raw.length);
1634
+ continue;
1635
+ } // text
1636
+
1637
+
1638
+ if (token = this.tokenizer.text(src)) {
1639
+ src = src.substring(token.raw.length);
1640
+ lastToken = tokens[tokens.length - 1];
1641
+
1642
+ if (lastToken && lastToken.type === 'text') {
1643
+ lastToken.raw += '\n' + token.raw;
1644
+ lastToken.text += '\n' + token.text;
1645
+ this.inlineQueue.pop();
1646
+ this.inlineQueue[this.inlineQueue.length - 1].src = lastToken.text;
1647
+ } else {
1648
+ tokens.push(token);
1649
+ }
1650
+
1651
+ continue;
1652
+ }
1653
+
1654
+ if (src) {
1655
+ var errMsg = 'Infinite loop on byte: ' + src.charCodeAt(0);
1656
+
1657
+ if (this.options.silent) {
1658
+ console.error(errMsg);
1659
+ break;
1660
+ } else {
1661
+ throw new Error(errMsg);
1662
+ }
1663
+ }
1664
+ }
1665
+
1666
+ this.state.top = true;
1667
+ return tokens;
1668
+ };
1669
+
1670
+ _proto.inline = function inline(src, tokens) {
1671
+ this.inlineQueue.push({
1672
+ src: src,
1673
+ tokens: tokens
1674
+ });
1675
+ }
1676
+ /**
1677
+ * Lexing/Compiling
1678
+ */
1679
+ ;
1680
+
1681
+ _proto.inlineTokens = function inlineTokens(src, tokens) {
1682
+ var _this2 = this;
1683
+
1684
+ if (tokens === void 0) {
1685
+ tokens = [];
1686
+ }
1687
+
1688
+ var token, lastToken, cutSrc; // String with links masked to avoid interference with em and strong
1689
+
1690
+ var maskedSrc = src;
1691
+ var match;
1692
+ var keepPrevChar, prevChar; // Mask out reflinks
1693
+
1694
+ if (this.tokens.links) {
1695
+ var links = Object.keys(this.tokens.links);
1696
+
1697
+ if (links.length > 0) {
1698
+ while ((match = this.tokenizer.rules.inline.reflinkSearch.exec(maskedSrc)) != null) {
1699
+ if (links.includes(match[0].slice(match[0].lastIndexOf('[') + 1, -1))) {
1700
+ maskedSrc = maskedSrc.slice(0, match.index) + '[' + repeatString('a', match[0].length - 2) + ']' + maskedSrc.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex);
1701
+ }
1702
+ }
1703
+ }
1704
+ } // Mask out other blocks
1705
+
1706
+
1707
+ while ((match = this.tokenizer.rules.inline.blockSkip.exec(maskedSrc)) != null) {
1708
+ maskedSrc = maskedSrc.slice(0, match.index) + '[' + repeatString('a', match[0].length - 2) + ']' + maskedSrc.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);
1709
+ } // Mask out escaped em & strong delimiters
1710
+
1711
+
1712
+ while ((match = this.tokenizer.rules.inline.escapedEmSt.exec(maskedSrc)) != null) {
1713
+ maskedSrc = maskedSrc.slice(0, match.index) + '++' + maskedSrc.slice(this.tokenizer.rules.inline.escapedEmSt.lastIndex);
1714
+ }
1715
+
1716
+ while (src) {
1717
+ if (!keepPrevChar) {
1718
+ prevChar = '';
1719
+ }
1720
+
1721
+ keepPrevChar = false; // extensions
1722
+
1723
+ if (this.options.extensions && this.options.extensions.inline && this.options.extensions.inline.some(function (extTokenizer) {
1724
+ if (token = extTokenizer.call({
1725
+ lexer: _this2
1726
+ }, src, tokens)) {
1727
+ src = src.substring(token.raw.length);
1728
+ tokens.push(token);
1729
+ return true;
1730
+ }
1731
+
1732
+ return false;
1733
+ })) {
1734
+ continue;
1735
+ } // escape
1736
+
1737
+
1738
+ if (token = this.tokenizer.escape(src)) {
1739
+ src = src.substring(token.raw.length);
1740
+ tokens.push(token);
1741
+ continue;
1742
+ } // tag
1743
+
1744
+
1745
+ if (token = this.tokenizer.tag(src)) {
1746
+ src = src.substring(token.raw.length);
1747
+ lastToken = tokens[tokens.length - 1];
1748
+
1749
+ if (lastToken && token.type === 'text' && lastToken.type === 'text') {
1750
+ lastToken.raw += token.raw;
1751
+ lastToken.text += token.text;
1752
+ } else {
1753
+ tokens.push(token);
1754
+ }
1755
+
1756
+ continue;
1757
+ } // link
1758
+
1759
+
1760
+ if (token = this.tokenizer.link(src)) {
1761
+ src = src.substring(token.raw.length);
1762
+ tokens.push(token);
1763
+ continue;
1764
+ } // reflink, nolink
1765
+
1766
+
1767
+ if (token = this.tokenizer.reflink(src, this.tokens.links)) {
1768
+ src = src.substring(token.raw.length);
1769
+ lastToken = tokens[tokens.length - 1];
1770
+
1771
+ if (lastToken && token.type === 'text' && lastToken.type === 'text') {
1772
+ lastToken.raw += token.raw;
1773
+ lastToken.text += token.text;
1774
+ } else {
1775
+ tokens.push(token);
1776
+ }
1777
+
1778
+ continue;
1779
+ } // em & strong
1780
+
1781
+
1782
+ if (token = this.tokenizer.emStrong(src, maskedSrc, prevChar)) {
1783
+ src = src.substring(token.raw.length);
1784
+ tokens.push(token);
1785
+ continue;
1786
+ } // code
1787
+
1788
+
1789
+ if (token = this.tokenizer.codespan(src)) {
1790
+ src = src.substring(token.raw.length);
1791
+ tokens.push(token);
1792
+ continue;
1793
+ } // br
1794
+
1795
+
1796
+ if (token = this.tokenizer.br(src)) {
1797
+ src = src.substring(token.raw.length);
1798
+ tokens.push(token);
1799
+ continue;
1800
+ } // del (gfm)
1801
+
1802
+
1803
+ if (token = this.tokenizer.del(src)) {
1804
+ src = src.substring(token.raw.length);
1805
+ tokens.push(token);
1806
+ continue;
1807
+ } // autolink
1808
+
1809
+
1810
+ if (token = this.tokenizer.autolink(src, mangle)) {
1811
+ src = src.substring(token.raw.length);
1812
+ tokens.push(token);
1813
+ continue;
1814
+ } // url (gfm)
1815
+
1816
+
1817
+ if (!this.state.inLink && (token = this.tokenizer.url(src, mangle))) {
1818
+ src = src.substring(token.raw.length);
1819
+ tokens.push(token);
1820
+ continue;
1821
+ } // text
1822
+ // prevent inlineText consuming extensions by clipping 'src' to extension start
1823
+
1824
+
1825
+ cutSrc = src;
1826
+
1827
+ if (this.options.extensions && this.options.extensions.startInline) {
1828
+ (function () {
1829
+ var startIndex = Infinity;
1830
+ var tempSrc = src.slice(1);
1831
+ var tempStart = void 0;
1832
+
1833
+ _this2.options.extensions.startInline.forEach(function (getStartIndex) {
1834
+ tempStart = getStartIndex.call({
1835
+ lexer: this
1836
+ }, tempSrc);
1837
+
1838
+ if (typeof tempStart === 'number' && tempStart >= 0) {
1839
+ startIndex = Math.min(startIndex, tempStart);
1840
+ }
1841
+ });
1842
+
1843
+ if (startIndex < Infinity && startIndex >= 0) {
1844
+ cutSrc = src.substring(0, startIndex + 1);
1845
+ }
1846
+ })();
1847
+ }
1848
+
1849
+ if (token = this.tokenizer.inlineText(cutSrc, smartypants)) {
1850
+ src = src.substring(token.raw.length);
1851
+
1852
+ if (token.raw.slice(-1) !== '_') {
1853
+ // Track prevChar before string of ____ started
1854
+ prevChar = token.raw.slice(-1);
1855
+ }
1856
+
1857
+ keepPrevChar = true;
1858
+ lastToken = tokens[tokens.length - 1];
1859
+
1860
+ if (lastToken && lastToken.type === 'text') {
1861
+ lastToken.raw += token.raw;
1862
+ lastToken.text += token.text;
1863
+ } else {
1864
+ tokens.push(token);
1865
+ }
1866
+
1867
+ continue;
1868
+ }
1869
+
1870
+ if (src) {
1871
+ var errMsg = 'Infinite loop on byte: ' + src.charCodeAt(0);
1872
+
1873
+ if (this.options.silent) {
1874
+ console.error(errMsg);
1875
+ break;
1876
+ } else {
1877
+ throw new Error(errMsg);
1878
+ }
1879
+ }
1880
+ }
1881
+
1882
+ return tokens;
1883
+ };
1884
+
1885
+ _createClass(Lexer, null, [{
1886
+ key: "rules",
1887
+ get: function get() {
1888
+ return {
1889
+ block: block,
1890
+ inline: inline
1891
+ };
1892
+ }
1893
+ }]);
1894
+
1895
+ return Lexer;
1896
+ }();
1897
+
1898
+ /**
1899
+ * Renderer
1900
+ */
1901
+
1902
+ var Renderer = /*#__PURE__*/function () {
1903
+ function Renderer(options) {
1904
+ this.options = options || exports.defaults;
1905
+ }
1906
+
1907
+ var _proto = Renderer.prototype;
1908
+
1909
+ _proto.code = function code(_code, infostring, escaped) {
1910
+ var lang = (infostring || '').match(/\S*/)[0];
1911
+
1912
+ if (this.options.highlight) {
1913
+ var out = this.options.highlight(_code, lang);
1914
+
1915
+ if (out != null && out !== _code) {
1916
+ escaped = true;
1917
+ _code = out;
1918
+ }
1919
+ }
1920
+
1921
+ _code = _code.replace(/\n$/, '') + '\n';
1922
+
1923
+ if (!lang) {
1924
+ return '<pre><code>' + (escaped ? _code : escape(_code, true)) + '</code></pre>\n';
1925
+ }
1926
+
1927
+ return '<pre><code class="' + this.options.langPrefix + escape(lang, true) + '">' + (escaped ? _code : escape(_code, true)) + '</code></pre>\n';
1928
+ };
1929
+
1930
+ _proto.blockquote = function blockquote(quote) {
1931
+ return '<blockquote>\n' + quote + '</blockquote>\n';
1932
+ };
1933
+
1934
+ _proto.html = function html(_html) {
1935
+ return _html;
1936
+ };
1937
+
1938
+ _proto.heading = function heading(text, level, raw, slugger) {
1939
+ if (this.options.headerIds) {
1940
+ return '<h' + level + ' id="' + this.options.headerPrefix + slugger.slug(raw) + '">' + text + '</h' + level + '>\n';
1941
+ } // ignore IDs
1942
+
1943
+
1944
+ return '<h' + level + '>' + text + '</h' + level + '>\n';
1945
+ };
1946
+
1947
+ _proto.hr = function hr() {
1948
+ return this.options.xhtml ? '<hr/>\n' : '<hr>\n';
1949
+ };
1950
+
1951
+ _proto.list = function list(body, ordered, start) {
1952
+ var type = ordered ? 'ol' : 'ul',
1953
+ startatt = ordered && start !== 1 ? ' start="' + start + '"' : '';
1954
+ return '<' + type + startatt + '>\n' + body + '</' + type + '>\n';
1955
+ };
1956
+
1957
+ _proto.listitem = function listitem(text) {
1958
+ return '<li>' + text + '</li>\n';
1959
+ };
1960
+
1961
+ _proto.checkbox = function checkbox(checked) {
1962
+ return '<input ' + (checked ? 'checked="" ' : '') + 'disabled="" type="checkbox"' + (this.options.xhtml ? ' /' : '') + '> ';
1963
+ };
1964
+
1965
+ _proto.paragraph = function paragraph(text) {
1966
+ return '<p>' + text + '</p>\n';
1967
+ };
1968
+
1969
+ _proto.table = function table(header, body) {
1970
+ if (body) body = '<tbody>' + body + '</tbody>';
1971
+ return '<table>\n' + '<thead>\n' + header + '</thead>\n' + body + '</table>\n';
1972
+ };
1973
+
1974
+ _proto.tablerow = function tablerow(content) {
1975
+ return '<tr>\n' + content + '</tr>\n';
1976
+ };
1977
+
1978
+ _proto.tablecell = function tablecell(content, flags) {
1979
+ var type = flags.header ? 'th' : 'td';
1980
+ var tag = flags.align ? '<' + type + ' align="' + flags.align + '">' : '<' + type + '>';
1981
+ return tag + content + '</' + type + '>\n';
1982
+ } // span level renderer
1983
+ ;
1984
+
1985
+ _proto.strong = function strong(text) {
1986
+ return '<strong>' + text + '</strong>';
1987
+ };
1988
+
1989
+ _proto.em = function em(text) {
1990
+ return '<em>' + text + '</em>';
1991
+ };
1992
+
1993
+ _proto.codespan = function codespan(text) {
1994
+ return '<code>' + text + '</code>';
1995
+ };
1996
+
1997
+ _proto.br = function br() {
1998
+ return this.options.xhtml ? '<br/>' : '<br>';
1999
+ };
2000
+
2001
+ _proto.del = function del(text) {
2002
+ return '<del>' + text + '</del>';
2003
+ };
2004
+
2005
+ _proto.link = function link(href, title, text) {
2006
+ href = cleanUrl(this.options.sanitize, this.options.baseUrl, href);
2007
+
2008
+ if (href === null) {
2009
+ return text;
2010
+ }
2011
+
2012
+ var out = '<a href="' + escape(href) + '"';
2013
+
2014
+ if (title) {
2015
+ out += ' title="' + title + '"';
2016
+ }
2017
+
2018
+ out += '>' + text + '</a>';
2019
+ return out;
2020
+ };
2021
+
2022
+ _proto.image = function image(href, title, text) {
2023
+ href = cleanUrl(this.options.sanitize, this.options.baseUrl, href);
2024
+
2025
+ if (href === null) {
2026
+ return text;
2027
+ }
2028
+
2029
+ var out = '<img src="' + href + '" alt="' + text + '"';
2030
+
2031
+ if (title) {
2032
+ out += ' title="' + title + '"';
2033
+ }
2034
+
2035
+ out += this.options.xhtml ? '/>' : '>';
2036
+ return out;
2037
+ };
2038
+
2039
+ _proto.text = function text(_text) {
2040
+ return _text;
2041
+ };
2042
+
2043
+ return Renderer;
2044
+ }();
2045
+
2046
+ /**
2047
+ * TextRenderer
2048
+ * returns only the textual part of the token
2049
+ */
2050
+ var TextRenderer = /*#__PURE__*/function () {
2051
+ function TextRenderer() {}
2052
+
2053
+ var _proto = TextRenderer.prototype;
2054
+
2055
+ // no need for block level renderers
2056
+ _proto.strong = function strong(text) {
2057
+ return text;
2058
+ };
2059
+
2060
+ _proto.em = function em(text) {
2061
+ return text;
2062
+ };
2063
+
2064
+ _proto.codespan = function codespan(text) {
2065
+ return text;
2066
+ };
2067
+
2068
+ _proto.del = function del(text) {
2069
+ return text;
2070
+ };
2071
+
2072
+ _proto.html = function html(text) {
2073
+ return text;
2074
+ };
2075
+
2076
+ _proto.text = function text(_text) {
2077
+ return _text;
2078
+ };
2079
+
2080
+ _proto.link = function link(href, title, text) {
2081
+ return '' + text;
2082
+ };
2083
+
2084
+ _proto.image = function image(href, title, text) {
2085
+ return '' + text;
2086
+ };
2087
+
2088
+ _proto.br = function br() {
2089
+ return '';
2090
+ };
2091
+
2092
+ return TextRenderer;
2093
+ }();
2094
+
2095
+ /**
2096
+ * Slugger generates header id
2097
+ */
2098
+ var Slugger = /*#__PURE__*/function () {
2099
+ function Slugger() {
2100
+ this.seen = {};
2101
+ }
2102
+
2103
+ var _proto = Slugger.prototype;
2104
+
2105
+ _proto.serialize = function serialize(value) {
2106
+ return value.toLowerCase().trim() // remove html tags
2107
+ .replace(/<[!\/a-z].*?>/ig, '') // remove unwanted chars
2108
+ .replace(/[\u2000-\u206F\u2E00-\u2E7F\\'!"#$%&()*+,./:;<=>?@[\]^`{|}~]/g, '').replace(/\s/g, '-');
2109
+ }
2110
+ /**
2111
+ * Finds the next safe (unique) slug to use
2112
+ */
2113
+ ;
2114
+
2115
+ _proto.getNextSafeSlug = function getNextSafeSlug(originalSlug, isDryRun) {
2116
+ var slug = originalSlug;
2117
+ var occurenceAccumulator = 0;
2118
+
2119
+ if (this.seen.hasOwnProperty(slug)) {
2120
+ occurenceAccumulator = this.seen[originalSlug];
2121
+
2122
+ do {
2123
+ occurenceAccumulator++;
2124
+ slug = originalSlug + '-' + occurenceAccumulator;
2125
+ } while (this.seen.hasOwnProperty(slug));
2126
+ }
2127
+
2128
+ if (!isDryRun) {
2129
+ this.seen[originalSlug] = occurenceAccumulator;
2130
+ this.seen[slug] = 0;
2131
+ }
2132
+
2133
+ return slug;
2134
+ }
2135
+ /**
2136
+ * Convert string to unique id
2137
+ * @param {object} options
2138
+ * @param {boolean} options.dryrun Generates the next unique slug without updating the internal accumulator.
2139
+ */
2140
+ ;
2141
+
2142
+ _proto.slug = function slug(value, options) {
2143
+ if (options === void 0) {
2144
+ options = {};
2145
+ }
2146
+
2147
+ var slug = this.serialize(value);
2148
+ return this.getNextSafeSlug(slug, options.dryrun);
2149
+ };
2150
+
2151
+ return Slugger;
2152
+ }();
2153
+
2154
+ /**
2155
+ * Parsing & Compiling
2156
+ */
2157
+
2158
+ var Parser = /*#__PURE__*/function () {
2159
+ function Parser(options) {
2160
+ this.options = options || exports.defaults;
2161
+ this.options.renderer = this.options.renderer || new Renderer();
2162
+ this.renderer = this.options.renderer;
2163
+ this.renderer.options = this.options;
2164
+ this.textRenderer = new TextRenderer();
2165
+ this.slugger = new Slugger();
2166
+ }
2167
+ /**
2168
+ * Static Parse Method
2169
+ */
2170
+
2171
+
2172
+ Parser.parse = function parse(tokens, options) {
2173
+ var parser = new Parser(options);
2174
+ return parser.parse(tokens);
2175
+ }
2176
+ /**
2177
+ * Static Parse Inline Method
2178
+ */
2179
+ ;
2180
+
2181
+ Parser.parseInline = function parseInline(tokens, options) {
2182
+ var parser = new Parser(options);
2183
+ return parser.parseInline(tokens);
2184
+ }
2185
+ /**
2186
+ * Parse Loop
2187
+ */
2188
+ ;
2189
+
2190
+ var _proto = Parser.prototype;
2191
+
2192
+ _proto.parse = function parse(tokens, top) {
2193
+ if (top === void 0) {
2194
+ top = true;
2195
+ }
2196
+
2197
+ var out = '',
2198
+ i,
2199
+ j,
2200
+ k,
2201
+ l2,
2202
+ l3,
2203
+ row,
2204
+ cell,
2205
+ header,
2206
+ body,
2207
+ token,
2208
+ ordered,
2209
+ start,
2210
+ loose,
2211
+ itemBody,
2212
+ item,
2213
+ checked,
2214
+ task,
2215
+ checkbox,
2216
+ ret;
2217
+ var l = tokens.length;
2218
+
2219
+ for (i = 0; i < l; i++) {
2220
+ token = tokens[i]; // Run any renderer extensions
2221
+
2222
+ if (this.options.extensions && this.options.extensions.renderers && this.options.extensions.renderers[token.type]) {
2223
+ ret = this.options.extensions.renderers[token.type].call({
2224
+ parser: this
2225
+ }, token);
2226
+
2227
+ if (ret !== false || !['space', 'hr', 'heading', 'code', 'table', 'blockquote', 'list', 'html', 'paragraph', 'text'].includes(token.type)) {
2228
+ out += ret || '';
2229
+ continue;
2230
+ }
2231
+ }
2232
+
2233
+ switch (token.type) {
2234
+ case 'space':
2235
+ {
2236
+ continue;
2237
+ }
2238
+
2239
+ case 'hr':
2240
+ {
2241
+ out += this.renderer.hr();
2242
+ continue;
2243
+ }
2244
+
2245
+ case 'heading':
2246
+ {
2247
+ out += this.renderer.heading(this.parseInline(token.tokens), token.depth, unescape(this.parseInline(token.tokens, this.textRenderer)), this.slugger);
2248
+ continue;
2249
+ }
2250
+
2251
+ case 'code':
2252
+ {
2253
+ out += this.renderer.code(token.text, token.lang, token.escaped);
2254
+ continue;
2255
+ }
2256
+
2257
+ case 'table':
2258
+ {
2259
+ header = ''; // header
2260
+
2261
+ cell = '';
2262
+ l2 = token.header.length;
2263
+
2264
+ for (j = 0; j < l2; j++) {
2265
+ cell += this.renderer.tablecell(this.parseInline(token.header[j].tokens), {
2266
+ header: true,
2267
+ align: token.align[j]
2268
+ });
2269
+ }
2270
+
2271
+ header += this.renderer.tablerow(cell);
2272
+ body = '';
2273
+ l2 = token.rows.length;
2274
+
2275
+ for (j = 0; j < l2; j++) {
2276
+ row = token.rows[j];
2277
+ cell = '';
2278
+ l3 = row.length;
2279
+
2280
+ for (k = 0; k < l3; k++) {
2281
+ cell += this.renderer.tablecell(this.parseInline(row[k].tokens), {
2282
+ header: false,
2283
+ align: token.align[k]
2284
+ });
2285
+ }
2286
+
2287
+ body += this.renderer.tablerow(cell);
2288
+ }
2289
+
2290
+ out += this.renderer.table(header, body);
2291
+ continue;
2292
+ }
2293
+
2294
+ case 'blockquote':
2295
+ {
2296
+ body = this.parse(token.tokens);
2297
+ out += this.renderer.blockquote(body);
2298
+ continue;
2299
+ }
2300
+
2301
+ case 'list':
2302
+ {
2303
+ ordered = token.ordered;
2304
+ start = token.start;
2305
+ loose = token.loose;
2306
+ l2 = token.items.length;
2307
+ body = '';
2308
+
2309
+ for (j = 0; j < l2; j++) {
2310
+ item = token.items[j];
2311
+ checked = item.checked;
2312
+ task = item.task;
2313
+ itemBody = '';
2314
+
2315
+ if (item.task) {
2316
+ checkbox = this.renderer.checkbox(checked);
2317
+
2318
+ if (loose) {
2319
+ if (item.tokens.length > 0 && item.tokens[0].type === 'paragraph') {
2320
+ item.tokens[0].text = checkbox + ' ' + item.tokens[0].text;
2321
+
2322
+ if (item.tokens[0].tokens && item.tokens[0].tokens.length > 0 && item.tokens[0].tokens[0].type === 'text') {
2323
+ item.tokens[0].tokens[0].text = checkbox + ' ' + item.tokens[0].tokens[0].text;
2324
+ }
2325
+ } else {
2326
+ item.tokens.unshift({
2327
+ type: 'text',
2328
+ text: checkbox
2329
+ });
2330
+ }
2331
+ } else {
2332
+ itemBody += checkbox;
2333
+ }
2334
+ }
2335
+
2336
+ itemBody += this.parse(item.tokens, loose);
2337
+ body += this.renderer.listitem(itemBody, task, checked);
2338
+ }
2339
+
2340
+ out += this.renderer.list(body, ordered, start);
2341
+ continue;
2342
+ }
2343
+
2344
+ case 'html':
2345
+ {
2346
+ // TODO parse inline content if parameter markdown=1
2347
+ out += this.renderer.html(token.text);
2348
+ continue;
2349
+ }
2350
+
2351
+ case 'paragraph':
2352
+ {
2353
+ out += this.renderer.paragraph(this.parseInline(token.tokens));
2354
+ continue;
2355
+ }
2356
+
2357
+ case 'text':
2358
+ {
2359
+ body = token.tokens ? this.parseInline(token.tokens) : token.text;
2360
+
2361
+ while (i + 1 < l && tokens[i + 1].type === 'text') {
2362
+ token = tokens[++i];
2363
+ body += '\n' + (token.tokens ? this.parseInline(token.tokens) : token.text);
2364
+ }
2365
+
2366
+ out += top ? this.renderer.paragraph(body) : body;
2367
+ continue;
2368
+ }
2369
+
2370
+ default:
2371
+ {
2372
+ var errMsg = 'Token with "' + token.type + '" type was not found.';
2373
+
2374
+ if (this.options.silent) {
2375
+ console.error(errMsg);
2376
+ return;
2377
+ } else {
2378
+ throw new Error(errMsg);
2379
+ }
2380
+ }
2381
+ }
2382
+ }
2383
+
2384
+ return out;
2385
+ }
2386
+ /**
2387
+ * Parse Inline Tokens
2388
+ */
2389
+ ;
2390
+
2391
+ _proto.parseInline = function parseInline(tokens, renderer) {
2392
+ renderer = renderer || this.renderer;
2393
+ var out = '',
2394
+ i,
2395
+ token,
2396
+ ret;
2397
+ var l = tokens.length;
2398
+
2399
+ for (i = 0; i < l; i++) {
2400
+ token = tokens[i]; // Run any renderer extensions
2401
+
2402
+ if (this.options.extensions && this.options.extensions.renderers && this.options.extensions.renderers[token.type]) {
2403
+ ret = this.options.extensions.renderers[token.type].call({
2404
+ parser: this
2405
+ }, token);
2406
+
2407
+ if (ret !== false || !['escape', 'html', 'link', 'image', 'strong', 'em', 'codespan', 'br', 'del', 'text'].includes(token.type)) {
2408
+ out += ret || '';
2409
+ continue;
2410
+ }
2411
+ }
2412
+
2413
+ switch (token.type) {
2414
+ case 'escape':
2415
+ {
2416
+ out += renderer.text(token.text);
2417
+ break;
2418
+ }
2419
+
2420
+ case 'html':
2421
+ {
2422
+ out += renderer.html(token.text);
2423
+ break;
2424
+ }
2425
+
2426
+ case 'link':
2427
+ {
2428
+ out += renderer.link(token.href, token.title, this.parseInline(token.tokens, renderer));
2429
+ break;
2430
+ }
2431
+
2432
+ case 'image':
2433
+ {
2434
+ out += renderer.image(token.href, token.title, token.text);
2435
+ break;
2436
+ }
2437
+
2438
+ case 'strong':
2439
+ {
2440
+ out += renderer.strong(this.parseInline(token.tokens, renderer));
2441
+ break;
2442
+ }
2443
+
2444
+ case 'em':
2445
+ {
2446
+ out += renderer.em(this.parseInline(token.tokens, renderer));
2447
+ break;
2448
+ }
2449
+
2450
+ case 'codespan':
2451
+ {
2452
+ out += renderer.codespan(token.text);
2453
+ break;
2454
+ }
2455
+
2456
+ case 'br':
2457
+ {
2458
+ out += renderer.br();
2459
+ break;
2460
+ }
2461
+
2462
+ case 'del':
2463
+ {
2464
+ out += renderer.del(this.parseInline(token.tokens, renderer));
2465
+ break;
2466
+ }
2467
+
2468
+ case 'text':
2469
+ {
2470
+ out += renderer.text(token.text);
2471
+ break;
2472
+ }
2473
+
2474
+ default:
2475
+ {
2476
+ var errMsg = 'Token with "' + token.type + '" type was not found.';
2477
+
2478
+ if (this.options.silent) {
2479
+ console.error(errMsg);
2480
+ return;
2481
+ } else {
2482
+ throw new Error(errMsg);
2483
+ }
2484
+ }
2485
+ }
2486
+ }
2487
+
2488
+ return out;
2489
+ };
2490
+
2491
+ return Parser;
2492
+ }();
2493
+
2494
+ /**
2495
+ * Marked
2496
+ */
2497
+
2498
+ function marked(src, opt, callback) {
2499
+ // throw error in case of non string input
2500
+ if (typeof src === 'undefined' || src === null) {
2501
+ throw new Error('marked(): input parameter is undefined or null');
2502
+ }
2503
+
2504
+ if (typeof src !== 'string') {
2505
+ throw new Error('marked(): input parameter is of type ' + Object.prototype.toString.call(src) + ', string expected');
2506
+ }
2507
+
2508
+ if (typeof opt === 'function') {
2509
+ callback = opt;
2510
+ opt = null;
2511
+ }
2512
+
2513
+ opt = merge({}, marked.defaults, opt || {});
2514
+ checkSanitizeDeprecation(opt);
2515
+
2516
+ if (callback) {
2517
+ var highlight = opt.highlight;
2518
+ var tokens;
2519
+
2520
+ try {
2521
+ tokens = Lexer.lex(src, opt);
2522
+ } catch (e) {
2523
+ return callback(e);
2524
+ }
2525
+
2526
+ var done = function done(err) {
2527
+ var out;
2528
+
2529
+ if (!err) {
2530
+ try {
2531
+ if (opt.walkTokens) {
2532
+ marked.walkTokens(tokens, opt.walkTokens);
2533
+ }
2534
+
2535
+ out = Parser.parse(tokens, opt);
2536
+ } catch (e) {
2537
+ err = e;
2538
+ }
2539
+ }
2540
+
2541
+ opt.highlight = highlight;
2542
+ return err ? callback(err) : callback(null, out);
2543
+ };
2544
+
2545
+ if (!highlight || highlight.length < 3) {
2546
+ return done();
2547
+ }
2548
+
2549
+ delete opt.highlight;
2550
+ if (!tokens.length) return done();
2551
+ var pending = 0;
2552
+ marked.walkTokens(tokens, function (token) {
2553
+ if (token.type === 'code') {
2554
+ pending++;
2555
+ setTimeout(function () {
2556
+ highlight(token.text, token.lang, function (err, code) {
2557
+ if (err) {
2558
+ return done(err);
2559
+ }
2560
+
2561
+ if (code != null && code !== token.text) {
2562
+ token.text = code;
2563
+ token.escaped = true;
2564
+ }
2565
+
2566
+ pending--;
2567
+
2568
+ if (pending === 0) {
2569
+ done();
2570
+ }
2571
+ });
2572
+ }, 0);
2573
+ }
2574
+ });
2575
+
2576
+ if (pending === 0) {
2577
+ done();
2578
+ }
2579
+
2580
+ return;
2581
+ }
2582
+
2583
+ try {
2584
+ var _tokens = Lexer.lex(src, opt);
2585
+
2586
+ if (opt.walkTokens) {
2587
+ marked.walkTokens(_tokens, opt.walkTokens);
2588
+ }
2589
+
2590
+ return Parser.parse(_tokens, opt);
2591
+ } catch (e) {
2592
+ e.message += '\nPlease report this to https://github.com/markedjs/marked.';
2593
+
2594
+ if (opt.silent) {
2595
+ return '<p>An error occurred:</p><pre>' + escape(e.message + '', true) + '</pre>';
2596
+ }
2597
+
2598
+ throw e;
2599
+ }
2600
+ }
2601
+ /**
2602
+ * Options
2603
+ */
2604
+
2605
+ marked.options = marked.setOptions = function (opt) {
2606
+ merge(marked.defaults, opt);
2607
+ changeDefaults(marked.defaults);
2608
+ return marked;
2609
+ };
2610
+
2611
+ marked.getDefaults = getDefaults;
2612
+ marked.defaults = exports.defaults;
2613
+ /**
2614
+ * Use Extension
2615
+ */
2616
+
2617
+ marked.use = function () {
2618
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
2619
+ args[_key] = arguments[_key];
2620
+ }
2621
+
2622
+ var opts = merge.apply(void 0, [{}].concat(args));
2623
+ var extensions = marked.defaults.extensions || {
2624
+ renderers: {},
2625
+ childTokens: {}
2626
+ };
2627
+ var hasExtensions;
2628
+ args.forEach(function (pack) {
2629
+ // ==-- Parse "addon" extensions --== //
2630
+ if (pack.extensions) {
2631
+ hasExtensions = true;
2632
+ pack.extensions.forEach(function (ext) {
2633
+ if (!ext.name) {
2634
+ throw new Error('extension name required');
2635
+ }
2636
+
2637
+ if (ext.renderer) {
2638
+ // Renderer extensions
2639
+ var prevRenderer = extensions.renderers ? extensions.renderers[ext.name] : null;
2640
+
2641
+ if (prevRenderer) {
2642
+ // Replace extension with func to run new extension but fall back if false
2643
+ extensions.renderers[ext.name] = function () {
2644
+ for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
2645
+ args[_key2] = arguments[_key2];
2646
+ }
2647
+
2648
+ var ret = ext.renderer.apply(this, args);
2649
+
2650
+ if (ret === false) {
2651
+ ret = prevRenderer.apply(this, args);
2652
+ }
2653
+
2654
+ return ret;
2655
+ };
2656
+ } else {
2657
+ extensions.renderers[ext.name] = ext.renderer;
2658
+ }
2659
+ }
2660
+
2661
+ if (ext.tokenizer) {
2662
+ // Tokenizer Extensions
2663
+ if (!ext.level || ext.level !== 'block' && ext.level !== 'inline') {
2664
+ throw new Error("extension level must be 'block' or 'inline'");
2665
+ }
2666
+
2667
+ if (extensions[ext.level]) {
2668
+ extensions[ext.level].unshift(ext.tokenizer);
2669
+ } else {
2670
+ extensions[ext.level] = [ext.tokenizer];
2671
+ }
2672
+
2673
+ if (ext.start) {
2674
+ // Function to check for start of token
2675
+ if (ext.level === 'block') {
2676
+ if (extensions.startBlock) {
2677
+ extensions.startBlock.push(ext.start);
2678
+ } else {
2679
+ extensions.startBlock = [ext.start];
2680
+ }
2681
+ } else if (ext.level === 'inline') {
2682
+ if (extensions.startInline) {
2683
+ extensions.startInline.push(ext.start);
2684
+ } else {
2685
+ extensions.startInline = [ext.start];
2686
+ }
2687
+ }
2688
+ }
2689
+ }
2690
+
2691
+ if (ext.childTokens) {
2692
+ // Child tokens to be visited by walkTokens
2693
+ extensions.childTokens[ext.name] = ext.childTokens;
2694
+ }
2695
+ });
2696
+ } // ==-- Parse "overwrite" extensions --== //
2697
+
2698
+
2699
+ if (pack.renderer) {
2700
+ (function () {
2701
+ var renderer = marked.defaults.renderer || new Renderer();
2702
+
2703
+ var _loop = function _loop(prop) {
2704
+ var prevRenderer = renderer[prop]; // Replace renderer with func to run extension, but fall back if false
2705
+
2706
+ renderer[prop] = function () {
2707
+ for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
2708
+ args[_key3] = arguments[_key3];
2709
+ }
2710
+
2711
+ var ret = pack.renderer[prop].apply(renderer, args);
2712
+
2713
+ if (ret === false) {
2714
+ ret = prevRenderer.apply(renderer, args);
2715
+ }
2716
+
2717
+ return ret;
2718
+ };
2719
+ };
2720
+
2721
+ for (var prop in pack.renderer) {
2722
+ _loop(prop);
2723
+ }
2724
+
2725
+ opts.renderer = renderer;
2726
+ })();
2727
+ }
2728
+
2729
+ if (pack.tokenizer) {
2730
+ (function () {
2731
+ var tokenizer = marked.defaults.tokenizer || new Tokenizer();
2732
+
2733
+ var _loop2 = function _loop2(prop) {
2734
+ var prevTokenizer = tokenizer[prop]; // Replace tokenizer with func to run extension, but fall back if false
2735
+
2736
+ tokenizer[prop] = function () {
2737
+ for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
2738
+ args[_key4] = arguments[_key4];
2739
+ }
2740
+
2741
+ var ret = pack.tokenizer[prop].apply(tokenizer, args);
2742
+
2743
+ if (ret === false) {
2744
+ ret = prevTokenizer.apply(tokenizer, args);
2745
+ }
2746
+
2747
+ return ret;
2748
+ };
2749
+ };
2750
+
2751
+ for (var prop in pack.tokenizer) {
2752
+ _loop2(prop);
2753
+ }
2754
+
2755
+ opts.tokenizer = tokenizer;
2756
+ })();
2757
+ } // ==-- Parse WalkTokens extensions --== //
2758
+
2759
+
2760
+ if (pack.walkTokens) {
2761
+ var _walkTokens = marked.defaults.walkTokens;
2762
+
2763
+ opts.walkTokens = function (token) {
2764
+ pack.walkTokens.call(this, token);
2765
+
2766
+ if (_walkTokens) {
2767
+ _walkTokens.call(this, token);
2768
+ }
2769
+ };
2770
+ }
2771
+
2772
+ if (hasExtensions) {
2773
+ opts.extensions = extensions;
2774
+ }
2775
+
2776
+ marked.setOptions(opts);
2777
+ });
2778
+ };
2779
+ /**
2780
+ * Run callback for every token
2781
+ */
2782
+
2783
+
2784
+ marked.walkTokens = function (tokens, callback) {
2785
+ var _loop3 = function _loop3() {
2786
+ var token = _step.value;
2787
+ callback.call(marked, token);
2788
+
2789
+ switch (token.type) {
2790
+ case 'table':
2791
+ {
2792
+ for (var _iterator2 = _createForOfIteratorHelperLoose(token.header), _step2; !(_step2 = _iterator2()).done;) {
2793
+ var cell = _step2.value;
2794
+ marked.walkTokens(cell.tokens, callback);
2795
+ }
2796
+
2797
+ for (var _iterator3 = _createForOfIteratorHelperLoose(token.rows), _step3; !(_step3 = _iterator3()).done;) {
2798
+ var row = _step3.value;
2799
+
2800
+ for (var _iterator4 = _createForOfIteratorHelperLoose(row), _step4; !(_step4 = _iterator4()).done;) {
2801
+ var _cell = _step4.value;
2802
+ marked.walkTokens(_cell.tokens, callback);
2803
+ }
2804
+ }
2805
+
2806
+ break;
2807
+ }
2808
+
2809
+ case 'list':
2810
+ {
2811
+ marked.walkTokens(token.items, callback);
2812
+ break;
2813
+ }
2814
+
2815
+ default:
2816
+ {
2817
+ if (marked.defaults.extensions && marked.defaults.extensions.childTokens && marked.defaults.extensions.childTokens[token.type]) {
2818
+ // Walk any extensions
2819
+ marked.defaults.extensions.childTokens[token.type].forEach(function (childTokens) {
2820
+ marked.walkTokens(token[childTokens], callback);
2821
+ });
2822
+ } else if (token.tokens) {
2823
+ marked.walkTokens(token.tokens, callback);
2824
+ }
2825
+ }
2826
+ }
2827
+ };
2828
+
2829
+ for (var _iterator = _createForOfIteratorHelperLoose(tokens), _step; !(_step = _iterator()).done;) {
2830
+ _loop3();
2831
+ }
2832
+ };
2833
+ /**
2834
+ * Parse Inline
2835
+ */
2836
+
2837
+
2838
+ marked.parseInline = function (src, opt) {
2839
+ // throw error in case of non string input
2840
+ if (typeof src === 'undefined' || src === null) {
2841
+ throw new Error('marked.parseInline(): input parameter is undefined or null');
2842
+ }
2843
+
2844
+ if (typeof src !== 'string') {
2845
+ throw new Error('marked.parseInline(): input parameter is of type ' + Object.prototype.toString.call(src) + ', string expected');
2846
+ }
2847
+
2848
+ opt = merge({}, marked.defaults, opt || {});
2849
+ checkSanitizeDeprecation(opt);
2850
+
2851
+ try {
2852
+ var tokens = Lexer.lexInline(src, opt);
2853
+
2854
+ if (opt.walkTokens) {
2855
+ marked.walkTokens(tokens, opt.walkTokens);
2856
+ }
2857
+
2858
+ return Parser.parseInline(tokens, opt);
2859
+ } catch (e) {
2860
+ e.message += '\nPlease report this to https://github.com/markedjs/marked.';
2861
+
2862
+ if (opt.silent) {
2863
+ return '<p>An error occurred:</p><pre>' + escape(e.message + '', true) + '</pre>';
2864
+ }
2865
+
2866
+ throw e;
2867
+ }
2868
+ };
2869
+ /**
2870
+ * Expose
2871
+ */
2872
+
2873
+
2874
+ marked.Parser = Parser;
2875
+ marked.parser = Parser.parse;
2876
+ marked.Renderer = Renderer;
2877
+ marked.TextRenderer = TextRenderer;
2878
+ marked.Lexer = Lexer;
2879
+ marked.lexer = Lexer.lex;
2880
+ marked.Tokenizer = Tokenizer;
2881
+ marked.Slugger = Slugger;
2882
+ marked.parse = marked;
2883
+ var options = marked.options;
2884
+ var setOptions = marked.setOptions;
2885
+ var use = marked.use;
2886
+ var walkTokens = marked.walkTokens;
2887
+ var parseInline = marked.parseInline;
2888
+ var parse = marked;
2889
+ var parser = Parser.parse;
2890
+ var lexer = Lexer.lex;
2891
+
2892
+ exports.Lexer = Lexer;
2893
+ exports.Parser = Parser;
2894
+ exports.Renderer = Renderer;
2895
+ exports.Slugger = Slugger;
2896
+ exports.TextRenderer = TextRenderer;
2897
+ exports.Tokenizer = Tokenizer;
2898
+ exports.getDefaults = getDefaults;
2899
+ exports.lexer = lexer;
2900
+ exports.marked = marked;
2901
+ exports.options = options;
2902
+ exports.parse = parse;
2903
+ exports.parseInline = parseInline;
2904
+ exports.parser = parser;
2905
+ exports.setOptions = setOptions;
2906
+ exports.use = use;
2907
+ exports.walkTokens = walkTokens;