pcm-agents 1.0.19 → 1.0.20

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 (337) hide show
  1. package/LICENSE +21 -21
  2. package/dist/cjs/app-globals-BIO4q6tX.js.map +1 -1
  3. package/dist/cjs/{components-chat-message_33.cjs.entry.js → components-chat-message_31.cjs.entry.js} +2429 -320
  4. package/dist/cjs/components-chat-message_31.cjs.entry.js.map +1 -0
  5. package/dist/cjs/components-oem-virtual-chat-modal.cjs.entry.js +2 -2
  6. package/dist/cjs/{conversation-utils-CKlwCDRf.js → conversation-utils-s_nVpMzq.js} +4 -4
  7. package/dist/cjs/{conversation-utils-CKlwCDRf.js.map → conversation-utils-s_nVpMzq.js.map} +1 -1
  8. package/dist/cjs/index-C_qhED9Z.js +2 -2
  9. package/dist/cjs/{index-DLbq5wiz.js → index-DAdBAmyB.js} +3 -3
  10. package/dist/cjs/{index-DLbq5wiz.js.map → index-DAdBAmyB.js.map} +1 -1
  11. package/dist/cjs/index.cjs.js +1 -1
  12. package/dist/cjs/loader.cjs.js +1 -1
  13. package/dist/cjs/markdown-D3_atg0b.js +2564 -0
  14. package/dist/cjs/{markdown-C0QWZi9Q.js.map → markdown-D3_atg0b.js.map} +1 -1
  15. package/dist/cjs/oem-cast-modal.cjs.entry.js +1 -1
  16. package/dist/cjs/oem-htws-modal.cjs.entry.js +6 -2
  17. package/dist/cjs/oem-htws-modal.cjs.entry.js.map +1 -1
  18. package/dist/cjs/oem-htws-modal.entry.cjs.js.map +1 -1
  19. package/dist/cjs/oem-jd-modal.cjs.entry.js +7 -3
  20. package/dist/cjs/oem-jd-modal.cjs.entry.js.map +1 -1
  21. package/dist/cjs/oem-jd-modal.entry.cjs.js.map +1 -1
  22. package/dist/cjs/oem-jlpp-modal.cjs.entry.js +6 -2
  23. package/dist/cjs/oem-jlpp-modal.cjs.entry.js.map +1 -1
  24. package/dist/cjs/oem-jlpp-modal.entry.cjs.js.map +1 -1
  25. package/dist/cjs/oem-jlzz-modal.cjs.entry.js +7 -3
  26. package/dist/cjs/oem-jlzz-modal.cjs.entry.js.map +1 -1
  27. package/dist/cjs/oem-jlzz-modal.entry.cjs.js.map +1 -1
  28. package/dist/cjs/oem-mnct-modal.cjs.entry.js +6 -2
  29. package/dist/cjs/oem-mnct-modal.cjs.entry.js.map +1 -1
  30. package/dist/cjs/oem-mnct-modal.entry.cjs.js.map +1 -1
  31. package/dist/cjs/oem-mnms-modal.cjs.entry.js +7 -3
  32. package/dist/cjs/oem-mnms-modal.cjs.entry.js.map +1 -1
  33. package/dist/cjs/oem-mnms-modal.entry.cjs.js.map +1 -1
  34. package/dist/cjs/oem-qgqjl-modal.cjs.entry.js +9 -5
  35. package/dist/cjs/oem-qgqjl-modal.cjs.entry.js.map +1 -1
  36. package/dist/cjs/oem-qgqjl-modal.entry.cjs.js.map +1 -1
  37. package/dist/cjs/pcm-agents.cjs.js +1 -1
  38. package/dist/cjs/pcm-hr-chat-modal.cjs.entry.js +2 -2
  39. package/dist/cjs/pcm-jlsx-modal.cjs.entry.js +8 -4
  40. package/dist/cjs/pcm-jlsx-modal.cjs.entry.js.map +1 -1
  41. package/dist/cjs/pcm-jlsx-modal.entry.cjs.js.map +1 -1
  42. package/dist/cjs/{sentry-reporter-BmrqhSKs.js → sentry-reporter-DR35XbVc.js} +3 -3
  43. package/dist/cjs/{sentry-reporter-BmrqhSKs.js.map → sentry-reporter-DR35XbVc.js.map} +1 -1
  44. package/dist/collection/collection-manifest.json +0 -2
  45. package/dist/collection/components/components-upload/components-upload.js +1 -1
  46. package/dist/collection/components/components-voice-input-btn/components-voice-input-btn.css +67 -67
  47. package/dist/collection/components/components-voice-input-btn/components-voice-input-btn.js +2 -2
  48. package/dist/collection/components/components-voice-input-btn/components-voice-input-btn.js.map +1 -1
  49. package/dist/collection/components/oem-cast-modal/oem-cast-modal.js +1 -1
  50. package/dist/collection/components/oem-htws-modal/oem-htws-modal.js +25 -1
  51. package/dist/collection/components/oem-htws-modal/oem-htws-modal.js.map +1 -1
  52. package/dist/collection/components/oem-jd-modal/oem-jd-modal.js +25 -1
  53. package/dist/collection/components/oem-jd-modal/oem-jd-modal.js.map +1 -1
  54. package/dist/collection/components/oem-jlpp-modal/oem-jlpp-modal.js +25 -1
  55. package/dist/collection/components/oem-jlpp-modal/oem-jlpp-modal.js.map +1 -1
  56. package/dist/collection/components/oem-jlsx-modal/oem-jlsx-modal.js +25 -1
  57. package/dist/collection/components/oem-jlsx-modal/oem-jlsx-modal.js.map +1 -1
  58. package/dist/collection/components/oem-jlzz-modal/oem-jlzz-modal.js +26 -2
  59. package/dist/collection/components/oem-jlzz-modal/oem-jlzz-modal.js.map +1 -1
  60. package/dist/collection/components/oem-mnct-modal/oem-mnct-modal.js +25 -1
  61. package/dist/collection/components/oem-mnct-modal/oem-mnct-modal.js.map +1 -1
  62. package/dist/collection/components/oem-mnms-modal/oem-mnms-modal.js +26 -2
  63. package/dist/collection/components/oem-mnms-modal/oem-mnms-modal.js.map +1 -1
  64. package/dist/collection/components/oem-qgqjl-modal/oem-qgqjl-modal.js +26 -2
  65. package/dist/collection/components/oem-qgqjl-modal/oem-qgqjl-modal.js.map +1 -1
  66. package/dist/collection/components/oem-zygh-modal/oem-zygh-modal.js +26 -2
  67. package/dist/collection/components/oem-zygh-modal/oem-zygh-modal.js.map +1 -1
  68. package/dist/collection/components/pcm-1zhanshi-mnms-modal/pcm-1zhanshi-mnms-modal.js +25 -1
  69. package/dist/collection/components/pcm-1zhanshi-mnms-modal/pcm-1zhanshi-mnms-modal.js.map +1 -1
  70. package/dist/collection/components/pcm-app-chat-modal/pcm-app-chat-modal.js +25 -1
  71. package/dist/collection/components/pcm-app-chat-modal/pcm-app-chat-modal.js.map +1 -1
  72. package/dist/collection/components/pcm-ats-mnms-modal/pcm-ats-mnms-modal.js +25 -1
  73. package/dist/collection/components/pcm-ats-mnms-modal/pcm-ats-mnms-modal.js.map +1 -1
  74. package/dist/collection/components/pcm-htws-modal/pcm-htws-modal.js +25 -1
  75. package/dist/collection/components/pcm-htws-modal/pcm-htws-modal.js.map +1 -1
  76. package/dist/collection/components/pcm-hyzj-modal/pcm-hyzj-modal.js +25 -1
  77. package/dist/collection/components/pcm-hyzj-modal/pcm-hyzj-modal.js.map +1 -1
  78. package/dist/collection/components/pcm-jd-modal/pcm-jd-modal.js +25 -1
  79. package/dist/collection/components/pcm-jd-modal/pcm-jd-modal.js.map +1 -1
  80. package/dist/collection/components/pcm-jlpp-modal/pcm-jlpp-modal.js +25 -1
  81. package/dist/collection/components/pcm-jlpp-modal/pcm-jlpp-modal.js.map +1 -1
  82. package/dist/collection/components/pcm-jlsx-modal/pcm-jlsx-modal.js +25 -1
  83. package/dist/collection/components/pcm-jlsx-modal/pcm-jlsx-modal.js.map +1 -1
  84. package/dist/collection/components/pcm-jlzz-modal/pcm-jlzz-modal.js +26 -2
  85. package/dist/collection/components/pcm-jlzz-modal/pcm-jlzz-modal.js.map +1 -1
  86. package/dist/collection/components/pcm-mnct-modal/pcm-mnct-modal.js +26 -2
  87. package/dist/collection/components/pcm-mnct-modal/pcm-mnct-modal.js.map +1 -1
  88. package/dist/collection/components/pcm-mnms-modal/pcm-mnms-modal.js +26 -2
  89. package/dist/collection/components/pcm-mnms-modal/pcm-mnms-modal.js.map +1 -1
  90. package/dist/collection/components/pcm-mnms-zp-modal/pcm-mnms-zp-modal.js +26 -2
  91. package/dist/collection/components/pcm-mnms-zp-modal/pcm-mnms-zp-modal.js.map +1 -1
  92. package/dist/collection/components/pcm-msbg-modal/pcm-msbg-modal.js +25 -1
  93. package/dist/collection/components/pcm-msbg-modal/pcm-msbg-modal.js.map +1 -1
  94. package/dist/collection/components/pcm-qgqjl-modal/pcm-qgqjl-modal.js +26 -2
  95. package/dist/collection/components/pcm-qgqjl-modal/pcm-qgqjl-modal.js.map +1 -1
  96. package/dist/collection/components/pcm-zygh-modal/pcm-zygh-modal.js +26 -2
  97. package/dist/collection/components/pcm-zygh-modal/pcm-zygh-modal.js.map +1 -1
  98. package/dist/collection/components/pcm-zygh-v2-modal/pcm-zygh-v2-modal.js +26 -2
  99. package/dist/collection/components/pcm-zygh-v2-modal/pcm-zygh-v2-modal.js.map +1 -1
  100. package/dist/components/components-chat-message.js +1 -1
  101. package/dist/components/components-digital-human.js +1 -1
  102. package/dist/components/components-export-records-modal.js +1 -1
  103. package/dist/components/components-mobile-input-btn.js +1 -1
  104. package/dist/components/components-mobile-upload-btn.js +1 -1
  105. package/dist/components/components-oem-virtual-chat-modal.js +1 -1
  106. package/dist/components/components-position-selector.js +1 -1
  107. package/dist/components/components-thousand-resume-wrapper.js +1 -1
  108. package/dist/components/components-upload.js +1 -1
  109. package/dist/components/components-voice-input-btn.js +1 -1
  110. package/dist/components/index.js +1 -1
  111. package/dist/components/index.js.map +1 -1
  112. package/dist/components/oem-cast-modal.js +1 -1
  113. package/dist/components/oem-htws-modal.js +11 -6
  114. package/dist/components/oem-htws-modal.js.map +1 -1
  115. package/dist/components/oem-jd-modal.js +11 -6
  116. package/dist/components/oem-jd-modal.js.map +1 -1
  117. package/dist/components/oem-jlpp-modal.js +13 -8
  118. package/dist/components/oem-jlpp-modal.js.map +1 -1
  119. package/dist/components/oem-jlsx-modal.js +12 -7
  120. package/dist/components/oem-jlsx-modal.js.map +1 -1
  121. package/dist/components/oem-jlzz-modal.js +12 -7
  122. package/dist/components/oem-jlzz-modal.js.map +1 -1
  123. package/dist/components/oem-mnct-modal.js +13 -8
  124. package/dist/components/oem-mnct-modal.js.map +1 -1
  125. package/dist/components/oem-mnms-modal.js +15 -10
  126. package/dist/components/oem-mnms-modal.js.map +1 -1
  127. package/dist/components/oem-qgqjl-modal.js +16 -11
  128. package/dist/components/oem-qgqjl-modal.js.map +1 -1
  129. package/dist/components/oem-zygh-modal.js +11 -6
  130. package/dist/components/oem-zygh-modal.js.map +1 -1
  131. package/dist/components/{p-ChHHPVqa.js → p-53YKry0i.js} +12 -7
  132. package/dist/components/p-53YKry0i.js.map +1 -0
  133. package/dist/components/p-B85MJLTf.js +8 -0
  134. package/dist/components/p-B85MJLTf.js.map +1 -0
  135. package/dist/components/{p-CRuYvhDS.js → p-By3OtTlN.js} +3 -3
  136. package/dist/components/{p-CRuYvhDS.js.map → p-By3OtTlN.js.map} +1 -1
  137. package/dist/components/{p-BFBILVHb.js → p-C-RZ-vJH.js} +3 -3
  138. package/dist/components/{p-BFBILVHb.js.map → p-C-RZ-vJH.js.map} +1 -1
  139. package/dist/components/{p-BbgkkZ8z.js → p-C1pgC3Jv.js} +3 -3
  140. package/dist/components/{p-BbgkkZ8z.js.map → p-C1pgC3Jv.js.map} +1 -1
  141. package/dist/components/{p-OFgPkEGL.js → p-C4npZucW.js} +4 -4
  142. package/dist/components/{p-OFgPkEGL.js.map → p-C4npZucW.js.map} +1 -1
  143. package/dist/components/{p-CUgq8UDs.js → p-CPRmVvQS.js} +4 -4
  144. package/dist/components/p-CPRmVvQS.js.map +1 -0
  145. package/dist/components/{p-sXNEbeK0.js → p-CjAaZc9n.js} +3 -3
  146. package/dist/components/{p-sXNEbeK0.js.map → p-CjAaZc9n.js.map} +1 -1
  147. package/dist/components/{p-BsVthfPT.js → p-Cp8-JkXG.js} +4 -4
  148. package/dist/components/{p-BsVthfPT.js.map → p-Cp8-JkXG.js.map} +1 -1
  149. package/dist/components/p-D483moFs.js +2310 -0
  150. package/dist/components/p-D483moFs.js.map +1 -0
  151. package/dist/components/{p-DW7If7Qd.js → p-D9KmSj_x.js} +5 -4
  152. package/dist/components/p-D9KmSj_x.js.map +1 -0
  153. package/dist/components/{p-BM8LfA-I.js → p-DSd0hTX7.js} +4 -4
  154. package/dist/components/{p-BM8LfA-I.js.map → p-DSd0hTX7.js.map} +1 -1
  155. package/dist/components/{p-DMxCytIw.js → p-Dlk1tp9R.js} +4 -4
  156. package/dist/components/{p-DMxCytIw.js.map → p-Dlk1tp9R.js.map} +1 -1
  157. package/dist/components/{p-BMyYj4Nh.js → p-DrKxtpsI.js} +3 -3
  158. package/dist/components/{p-BMyYj4Nh.js.map → p-DrKxtpsI.js.map} +1 -1
  159. package/dist/components/p-DuXrU5Qi.js +2559 -0
  160. package/dist/components/p-DuXrU5Qi.js.map +1 -0
  161. package/dist/components/{p-aK_x2dmu.js → p-mVRqIhzD.js} +3 -3
  162. package/dist/components/{p-aK_x2dmu.js.map → p-mVRqIhzD.js.map} +1 -1
  163. package/dist/components/{p-C5cxtSmw.js → p-yzl8QYOf.js} +3 -3
  164. package/dist/components/{p-C5cxtSmw.js.map → p-yzl8QYOf.js.map} +1 -1
  165. package/dist/components/pcm-1zhanshi-mnms-modal.js +11 -6
  166. package/dist/components/pcm-1zhanshi-mnms-modal.js.map +1 -1
  167. package/dist/components/pcm-app-chat-modal.js +1 -1
  168. package/dist/components/pcm-ats-mnms-modal.js +11 -6
  169. package/dist/components/pcm-ats-mnms-modal.js.map +1 -1
  170. package/dist/components/pcm-hr-chat-modal.js +2 -2
  171. package/dist/components/pcm-htws-modal.js +14 -9
  172. package/dist/components/pcm-htws-modal.js.map +1 -1
  173. package/dist/components/pcm-hyzj-modal.js +11 -6
  174. package/dist/components/pcm-hyzj-modal.js.map +1 -1
  175. package/dist/components/pcm-jd-modal.js +12 -7
  176. package/dist/components/pcm-jd-modal.js.map +1 -1
  177. package/dist/components/pcm-jlpp-modal.js +14 -9
  178. package/dist/components/pcm-jlpp-modal.js.map +1 -1
  179. package/dist/components/pcm-jlsx-modal.js +12 -7
  180. package/dist/components/pcm-jlsx-modal.js.map +1 -1
  181. package/dist/components/pcm-jlzz-modal.js +13 -8
  182. package/dist/components/pcm-jlzz-modal.js.map +1 -1
  183. package/dist/components/pcm-mnct-modal.js +14 -9
  184. package/dist/components/pcm-mnct-modal.js.map +1 -1
  185. package/dist/components/pcm-mnms-modal.js +15 -10
  186. package/dist/components/pcm-mnms-modal.js.map +1 -1
  187. package/dist/components/pcm-mnms-zp-modal.js +15 -10
  188. package/dist/components/pcm-mnms-zp-modal.js.map +1 -1
  189. package/dist/components/pcm-msbg-modal.js +11 -6
  190. package/dist/components/pcm-msbg-modal.js.map +1 -1
  191. package/dist/components/pcm-qgqjl-modal.js +16 -11
  192. package/dist/components/pcm-qgqjl-modal.js.map +1 -1
  193. package/dist/components/pcm-virtual-chat-modal.js +1 -1
  194. package/dist/components/pcm-zsk-chat-modal.js +3 -3
  195. package/dist/components/pcm-zygh-modal.js +13 -8
  196. package/dist/components/pcm-zygh-modal.js.map +1 -1
  197. package/dist/components/pcm-zygh-v2-modal.js +13 -8
  198. package/dist/components/pcm-zygh-v2-modal.js.map +1 -1
  199. package/dist/esm/app-globals-Chti62re.js.map +1 -1
  200. package/dist/esm/{components-chat-message_33.entry.js → components-chat-message_31.entry.js} +2430 -319
  201. package/dist/esm/components-chat-message_31.entry.js.map +1 -0
  202. package/dist/esm/components-oem-virtual-chat-modal.entry.js +2 -2
  203. package/dist/esm/{conversation-utils-BGcxaSyr.js → conversation-utils-DQ2uwLtT.js} +4 -4
  204. package/dist/esm/{conversation-utils-BGcxaSyr.js.map → conversation-utils-DQ2uwLtT.js.map} +1 -1
  205. package/dist/esm/index-Bq0K-WqZ.js +2 -2
  206. package/dist/esm/{index-BaYctFVD.js → index-kfrWoYxt.js} +3 -3
  207. package/dist/esm/{index-BaYctFVD.js.map → index-kfrWoYxt.js.map} +1 -1
  208. package/dist/esm/index.js +1 -1
  209. package/dist/esm/loader.js +1 -1
  210. package/dist/esm/markdown-DcmYnk0q.js +2561 -0
  211. package/dist/esm/{markdown-CnhOGURu.js.map → markdown-DcmYnk0q.js.map} +1 -1
  212. package/dist/esm/oem-cast-modal.entry.js +1 -1
  213. package/dist/esm/oem-htws-modal.entry.js +6 -2
  214. package/dist/esm/oem-htws-modal.entry.js.map +1 -1
  215. package/dist/esm/oem-jd-modal.entry.js +7 -3
  216. package/dist/esm/oem-jd-modal.entry.js.map +1 -1
  217. package/dist/esm/oem-jlpp-modal.entry.js +6 -2
  218. package/dist/esm/oem-jlpp-modal.entry.js.map +1 -1
  219. package/dist/esm/oem-jlzz-modal.entry.js +7 -3
  220. package/dist/esm/oem-jlzz-modal.entry.js.map +1 -1
  221. package/dist/esm/oem-mnct-modal.entry.js +6 -2
  222. package/dist/esm/oem-mnct-modal.entry.js.map +1 -1
  223. package/dist/esm/oem-mnms-modal.entry.js +7 -3
  224. package/dist/esm/oem-mnms-modal.entry.js.map +1 -1
  225. package/dist/esm/oem-qgqjl-modal.entry.js +9 -5
  226. package/dist/esm/oem-qgqjl-modal.entry.js.map +1 -1
  227. package/dist/esm/pcm-agents.js +1 -1
  228. package/dist/esm/pcm-hr-chat-modal.entry.js +2 -2
  229. package/dist/esm/pcm-jlsx-modal.entry.js +8 -4
  230. package/dist/esm/pcm-jlsx-modal.entry.js.map +1 -1
  231. package/dist/esm/{sentry-reporter-CQ8bX8AM.js → sentry-reporter-YZTzmY6w.js} +3 -3
  232. package/dist/esm/{sentry-reporter-CQ8bX8AM.js.map → sentry-reporter-YZTzmY6w.js.map} +1 -1
  233. package/dist/pcm-agents/index.esm.js +1 -1
  234. package/dist/pcm-agents/oem-htws-modal.entry.esm.js.map +1 -1
  235. package/dist/pcm-agents/oem-jd-modal.entry.esm.js.map +1 -1
  236. package/dist/pcm-agents/oem-jlpp-modal.entry.esm.js.map +1 -1
  237. package/dist/pcm-agents/oem-jlzz-modal.entry.esm.js.map +1 -1
  238. package/dist/pcm-agents/oem-mnct-modal.entry.esm.js.map +1 -1
  239. package/dist/pcm-agents/oem-mnms-modal.entry.esm.js.map +1 -1
  240. package/dist/pcm-agents/oem-qgqjl-modal.entry.esm.js.map +1 -1
  241. package/dist/pcm-agents/p-17523d4c.entry.js +2 -0
  242. package/dist/pcm-agents/{p-52b8396f.entry.js → p-26996eda.entry.js} +2 -2
  243. package/dist/pcm-agents/p-26996eda.entry.js.map +1 -0
  244. package/dist/pcm-agents/{p-d25b1c70.entry.js → p-26f57e7b.entry.js} +2 -2
  245. package/dist/pcm-agents/p-26f57e7b.entry.js.map +1 -0
  246. package/dist/pcm-agents/{p-a33ebff7.entry.js → p-4d649f2a.entry.js} +2 -2
  247. package/dist/pcm-agents/p-4d649f2a.entry.js.map +1 -0
  248. package/dist/pcm-agents/{p-85b37d21.entry.js → p-54dc87b9.entry.js} +2 -2
  249. package/dist/pcm-agents/{p-07d0bfa5.entry.js → p-57c1b476.entry.js} +2 -2
  250. package/dist/pcm-agents/p-6ee0ae10.entry.js +8 -0
  251. package/dist/pcm-agents/p-6ee0ae10.entry.js.map +1 -0
  252. package/dist/pcm-agents/{p-415d021b.entry.js → p-7225d0ca.entry.js} +2 -2
  253. package/dist/pcm-agents/{p-86c15766.entry.js → p-893dbe28.entry.js} +2 -2
  254. package/dist/pcm-agents/p-893dbe28.entry.js.map +1 -0
  255. package/dist/pcm-agents/{p-BUe4kiCQ.js → p-Bd4_jEOe.js} +2 -2
  256. package/dist/pcm-agents/{p-BUe4kiCQ.js.map → p-Bd4_jEOe.js.map} +1 -1
  257. package/dist/pcm-agents/{p-DzZpAxqF.js → p-CGa8AOoe.js} +2 -2
  258. package/dist/pcm-agents/{p-DzZpAxqF.js.map → p-CGa8AOoe.js.map} +1 -1
  259. package/dist/pcm-agents/p-CeRTfvY9.js.map +1 -1
  260. package/dist/pcm-agents/p-DcmYnk0q.js +2 -0
  261. package/dist/pcm-agents/{p-CnhOGURu.js.map → p-DcmYnk0q.js.map} +1 -1
  262. package/dist/pcm-agents/{p-DpK1mBu7.js → p-I2lIWOKl.js} +2 -2
  263. package/dist/pcm-agents/{p-DpK1mBu7.js.map → p-I2lIWOKl.js.map} +1 -1
  264. package/dist/pcm-agents/{p-c95e6896.entry.js → p-ba2e1a60.entry.js} +2 -2
  265. package/dist/pcm-agents/{p-cd2844d8.entry.js → p-c9bddaf0.entry.js} +2 -2
  266. package/dist/pcm-agents/{p-900ade9f.entry.js → p-f1de36bb.entry.js} +2 -2
  267. package/dist/pcm-agents/p-f1de36bb.entry.js.map +1 -0
  268. package/dist/pcm-agents/pcm-agents.esm.js +1 -1
  269. package/dist/pcm-agents/pcm-jlsx-modal.entry.esm.js.map +1 -1
  270. package/dist/types/components/oem-htws-modal/oem-htws-modal.d.ts +4 -0
  271. package/dist/types/components/oem-jd-modal/oem-jd-modal.d.ts +4 -0
  272. package/dist/types/components/oem-jlpp-modal/oem-jlpp-modal.d.ts +4 -0
  273. package/dist/types/components/oem-jlsx-modal/oem-jlsx-modal.d.ts +4 -0
  274. package/dist/types/components/oem-jlzz-modal/oem-jlzz-modal.d.ts +4 -0
  275. package/dist/types/components/oem-mnct-modal/oem-mnct-modal.d.ts +4 -0
  276. package/dist/types/components/oem-mnms-modal/oem-mnms-modal.d.ts +4 -0
  277. package/dist/types/components/oem-qgqjl-modal/oem-qgqjl-modal.d.ts +4 -0
  278. package/dist/types/components/oem-zygh-modal/oem-zygh-modal.d.ts +4 -0
  279. package/dist/types/components/pcm-1zhanshi-mnms-modal/pcm-1zhanshi-mnms-modal.d.ts +4 -0
  280. package/dist/types/components/pcm-app-chat-modal/pcm-app-chat-modal.d.ts +4 -0
  281. package/dist/types/components/pcm-ats-mnms-modal/pcm-ats-mnms-modal.d.ts +4 -0
  282. package/dist/types/components/pcm-htws-modal/pcm-htws-modal.d.ts +4 -0
  283. package/dist/types/components/pcm-hyzj-modal/pcm-hyzj-modal.d.ts +4 -0
  284. package/dist/types/components/pcm-jd-modal/pcm-jd-modal.d.ts +4 -0
  285. package/dist/types/components/pcm-jlpp-modal/pcm-jlpp-modal.d.ts +4 -0
  286. package/dist/types/components/pcm-jlsx-modal/pcm-jlsx-modal.d.ts +4 -0
  287. package/dist/types/components/pcm-jlzz-modal/pcm-jlzz-modal.d.ts +4 -0
  288. package/dist/types/components/pcm-mnct-modal/pcm-mnct-modal.d.ts +4 -0
  289. package/dist/types/components/pcm-mnms-modal/pcm-mnms-modal.d.ts +4 -0
  290. package/dist/types/components/pcm-mnms-zp-modal/pcm-mnms-zp-modal.d.ts +4 -0
  291. package/dist/types/components/pcm-msbg-modal/pcm-msbg-modal.d.ts +4 -0
  292. package/dist/types/components/pcm-qgqjl-modal/pcm-qgqjl-modal.d.ts +4 -0
  293. package/dist/types/components/pcm-zygh-modal/pcm-zygh-modal.d.ts +4 -0
  294. package/dist/types/components/pcm-zygh-v2-modal/pcm-zygh-v2-modal.d.ts +4 -0
  295. package/dist/types/components.d.ts +200 -261
  296. package/package.json +1 -1
  297. package/readme.md +307 -307
  298. package/dist/cjs/components-chat-message_33.cjs.entry.js.map +0 -1
  299. package/dist/cjs/markdown-C0QWZi9Q.js +0 -2674
  300. package/dist/collection/components/pcm-button/pcm-button.css +0 -199
  301. package/dist/collection/components/pcm-button/pcm-button.js +0 -374
  302. package/dist/collection/components/pcm-button/pcm-button.js.map +0 -1
  303. package/dist/collection/components/pcm-card/pcm-card.css +0 -260
  304. package/dist/collection/components/pcm-card/pcm-card.js +0 -402
  305. package/dist/collection/components/pcm-card/pcm-card.js.map +0 -1
  306. package/dist/components/p-CUgq8UDs.js.map +0 -1
  307. package/dist/components/p-ChHHPVqa.js.map +0 -1
  308. package/dist/components/p-CnhOGURu.js +0 -2671
  309. package/dist/components/p-CnhOGURu.js.map +0 -1
  310. package/dist/components/p-DW7If7Qd.js.map +0 -1
  311. package/dist/components/pcm-button.d.ts +0 -11
  312. package/dist/components/pcm-button.js +0 -140
  313. package/dist/components/pcm-button.js.map +0 -1
  314. package/dist/components/pcm-card.d.ts +0 -11
  315. package/dist/components/pcm-card.js +0 -202
  316. package/dist/components/pcm-card.js.map +0 -1
  317. package/dist/esm/components-chat-message_33.entry.js.map +0 -1
  318. package/dist/esm/markdown-CnhOGURu.js +0 -2671
  319. package/dist/pcm-agents/p-52b8396f.entry.js.map +0 -1
  320. package/dist/pcm-agents/p-86c15766.entry.js.map +0 -1
  321. package/dist/pcm-agents/p-900ade9f.entry.js.map +0 -1
  322. package/dist/pcm-agents/p-CnhOGURu.js +0 -2
  323. package/dist/pcm-agents/p-a33ebff7.entry.js.map +0 -1
  324. package/dist/pcm-agents/p-be640465.entry.js +0 -2
  325. package/dist/pcm-agents/p-d25b1c70.entry.js.map +0 -1
  326. package/dist/pcm-agents/p-f2445cbd.entry.js +0 -8
  327. package/dist/pcm-agents/p-f2445cbd.entry.js.map +0 -1
  328. package/dist/types/components/pcm-button/pcm-button.d.ts +0 -64
  329. package/dist/types/components/pcm-card/pcm-card.d.ts +0 -79
  330. /package/dist/pcm-agents/{p-be640465.entry.js.map → p-17523d4c.entry.js.map} +0 -0
  331. /package/dist/pcm-agents/{p-85b37d21.entry.js.map → p-54dc87b9.entry.js.map} +0 -0
  332. /package/dist/pcm-agents/{p-07d0bfa5.entry.js.map → p-57c1b476.entry.js.map} +0 -0
  333. /package/dist/pcm-agents/{p-415d021b.entry.js.map → p-7225d0ca.entry.js.map} +0 -0
  334. /package/dist/pcm-agents/{p-c95e6896.entry.js.map → p-ba2e1a60.entry.js.map} +0 -0
  335. /package/dist/pcm-agents/{p-cd2844d8.entry.js.map → p-c9bddaf0.entry.js.map} +0 -0
  336. /package/dist/types/code/{sdk → agents-sdk}/packages/pcm-agents/.stencil/store/auth.store.d.ts +0 -0
  337. /package/dist/types/code/{sdk → agents-sdk}/packages/pcm-agents/.stencil/store/config.store.d.ts +0 -0
@@ -0,0 +1,2559 @@
1
+ import { g as getDefaultExportFromCjs } from './p-B85MJLTf.js';
2
+
3
+ function _classPrivateFieldLooseBase(e, t) { if (!{}.hasOwnProperty.call(e, t)) throw new TypeError("attempted to use private field on non-instance"); return e; }
4
+ var id = 0;
5
+ function _classPrivateFieldLooseKey(e) { return "__private_" + id++ + "_" + e; }
6
+ /**
7
+ * marked v9.1.6 - a markdown parser
8
+ * Copyright (c) 2011-2023, Christopher Jeffrey. (MIT Licensed)
9
+ * https://github.com/markedjs/marked
10
+ */
11
+
12
+ /**
13
+ * DO NOT EDIT THIS FILE
14
+ * The code in this file is generated from files in ./src/
15
+ */
16
+
17
+ /**
18
+ * Gets the original marked default options.
19
+ */
20
+ function _getDefaults() {
21
+ return {
22
+ async: false,
23
+ breaks: false,
24
+ extensions: null,
25
+ gfm: true,
26
+ hooks: null,
27
+ pedantic: false,
28
+ renderer: null,
29
+ silent: false,
30
+ tokenizer: null,
31
+ walkTokens: null
32
+ };
33
+ }
34
+ let _defaults = _getDefaults();
35
+ function changeDefaults(newDefaults) {
36
+ _defaults = newDefaults;
37
+ }
38
+
39
+ /**
40
+ * Helpers
41
+ */
42
+ const escapeTest = /[&<>"']/;
43
+ const escapeReplace = new RegExp(escapeTest.source, 'g');
44
+ const escapeTestNoEncode = /[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/;
45
+ const escapeReplaceNoEncode = new RegExp(escapeTestNoEncode.source, 'g');
46
+ const escapeReplacements = {
47
+ '&': '&amp;',
48
+ '<': '&lt;',
49
+ '>': '&gt;',
50
+ '"': '&quot;',
51
+ "'": '&#39;'
52
+ };
53
+ const getEscapeReplacement = ch => escapeReplacements[ch];
54
+ function escape(html, encode) {
55
+ if (encode) {
56
+ if (escapeTest.test(html)) {
57
+ return html.replace(escapeReplace, getEscapeReplacement);
58
+ }
59
+ } else {
60
+ if (escapeTestNoEncode.test(html)) {
61
+ return html.replace(escapeReplaceNoEncode, getEscapeReplacement);
62
+ }
63
+ }
64
+ return html;
65
+ }
66
+ const unescapeTest = /&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;
67
+ function unescape(html) {
68
+ // explicitly match decimal, hex, and named HTML entities
69
+ return html.replace(unescapeTest, (_, n) => {
70
+ n = n.toLowerCase();
71
+ if (n === 'colon') return ':';
72
+ if (n.charAt(0) === '#') {
73
+ return n.charAt(1) === 'x' ? String.fromCharCode(parseInt(n.substring(2), 16)) : String.fromCharCode(+n.substring(1));
74
+ }
75
+ return '';
76
+ });
77
+ }
78
+ const caret = /(^|[^\[])\^/g;
79
+ function edit(regex, opt) {
80
+ regex = typeof regex === 'string' ? regex : regex.source;
81
+ opt = opt || '';
82
+ const obj = {
83
+ replace: (name, val) => {
84
+ val = typeof val === 'object' && 'source' in val ? val.source : val;
85
+ val = val.replace(caret, '$1');
86
+ regex = regex.replace(name, val);
87
+ return obj;
88
+ },
89
+ getRegex: () => {
90
+ return new RegExp(regex, opt);
91
+ }
92
+ };
93
+ return obj;
94
+ }
95
+ function cleanUrl(href) {
96
+ try {
97
+ href = encodeURI(href).replace(/%25/g, '%');
98
+ } catch (e) {
99
+ return null;
100
+ }
101
+ return href;
102
+ }
103
+ const noopTest = {
104
+ exec: () => null
105
+ };
106
+ function splitCells(tableRow, count) {
107
+ // ensure that every cell-delimiting pipe has a space
108
+ // before it to distinguish it from an escaped pipe
109
+ const row = tableRow.replace(/\|/g, (match, offset, str) => {
110
+ let escaped = false;
111
+ let curr = offset;
112
+ while (--curr >= 0 && str[curr] === '\\') escaped = !escaped;
113
+ if (escaped) {
114
+ // odd number of slashes means | is escaped
115
+ // so we leave it alone
116
+ return '|';
117
+ } else {
118
+ // add space before unescaped |
119
+ return ' |';
120
+ }
121
+ }),
122
+ cells = row.split(/ \|/);
123
+ let i = 0;
124
+ // First/last cell in a row cannot be empty if it has no leading/trailing pipe
125
+ if (!cells[0].trim()) {
126
+ cells.shift();
127
+ }
128
+ if (cells.length > 0 && !cells[cells.length - 1].trim()) {
129
+ cells.pop();
130
+ }
131
+ if (count) {
132
+ if (cells.length > count) {
133
+ cells.splice(count);
134
+ } else {
135
+ while (cells.length < count) cells.push('');
136
+ }
137
+ }
138
+ for (; i < cells.length; i++) {
139
+ // leading or trailing whitespace is ignored per the gfm spec
140
+ cells[i] = cells[i].trim().replace(/\\\|/g, '|');
141
+ }
142
+ return cells;
143
+ }
144
+ /**
145
+ * Remove trailing 'c's. Equivalent to str.replace(/c*$/, '').
146
+ * /c*$/ is vulnerable to REDOS.
147
+ *
148
+ * @param str
149
+ * @param c
150
+ * @param invert Remove suffix of non-c chars instead. Default falsey.
151
+ */
152
+ function rtrim(str, c, invert) {
153
+ const l = str.length;
154
+ if (l === 0) {
155
+ return '';
156
+ }
157
+ // Length of suffix matching the invert condition.
158
+ let suffLen = 0;
159
+ // Step left until we fail to match the invert condition.
160
+ while (suffLen < l) {
161
+ const currChar = str.charAt(l - suffLen - 1);
162
+ if (currChar === c && true) {
163
+ suffLen++;
164
+ } else {
165
+ break;
166
+ }
167
+ }
168
+ return str.slice(0, l - suffLen);
169
+ }
170
+ function findClosingBracket(str, b) {
171
+ if (str.indexOf(b[1]) === -1) {
172
+ return -1;
173
+ }
174
+ let level = 0;
175
+ for (let i = 0; i < str.length; i++) {
176
+ if (str[i] === '\\') {
177
+ i++;
178
+ } else if (str[i] === b[0]) {
179
+ level++;
180
+ } else if (str[i] === b[1]) {
181
+ level--;
182
+ if (level < 0) {
183
+ return i;
184
+ }
185
+ }
186
+ }
187
+ return -1;
188
+ }
189
+ function outputLink(cap, link, raw, lexer) {
190
+ const href = link.href;
191
+ const title = link.title ? escape(link.title) : null;
192
+ const text = cap[1].replace(/\\([\[\]])/g, '$1');
193
+ if (cap[0].charAt(0) !== '!') {
194
+ lexer.state.inLink = true;
195
+ const token = {
196
+ type: 'link',
197
+ raw,
198
+ href,
199
+ title,
200
+ text,
201
+ tokens: lexer.inlineTokens(text)
202
+ };
203
+ lexer.state.inLink = false;
204
+ return token;
205
+ }
206
+ return {
207
+ type: 'image',
208
+ raw,
209
+ href,
210
+ title,
211
+ text: escape(text)
212
+ };
213
+ }
214
+ function indentCodeCompensation(raw, text) {
215
+ const matchIndentToCode = raw.match(/^(\s+)(?:```)/);
216
+ if (matchIndentToCode === null) {
217
+ return text;
218
+ }
219
+ const indentToCode = matchIndentToCode[1];
220
+ return text.split('\n').map(node => {
221
+ const matchIndentInNode = node.match(/^\s+/);
222
+ if (matchIndentInNode === null) {
223
+ return node;
224
+ }
225
+ const [indentInNode] = matchIndentInNode;
226
+ if (indentInNode.length >= indentToCode.length) {
227
+ return node.slice(indentToCode.length);
228
+ }
229
+ return node;
230
+ }).join('\n');
231
+ }
232
+ /**
233
+ * Tokenizer
234
+ */
235
+ class _Tokenizer {
236
+ constructor(options) {
237
+ this.options = void 0;
238
+ // TODO: Fix this rules type
239
+ this.rules = void 0;
240
+ this.lexer = void 0;
241
+ this.options = options || _defaults;
242
+ }
243
+ space(src) {
244
+ const cap = this.rules.block.newline.exec(src);
245
+ if (cap && cap[0].length > 0) {
246
+ return {
247
+ type: 'space',
248
+ raw: cap[0]
249
+ };
250
+ }
251
+ }
252
+ code(src) {
253
+ const cap = this.rules.block.code.exec(src);
254
+ if (cap) {
255
+ const text = cap[0].replace(/^ {1,4}/gm, '');
256
+ return {
257
+ type: 'code',
258
+ raw: cap[0],
259
+ codeBlockStyle: 'indented',
260
+ text: !this.options.pedantic ? rtrim(text, '\n') : text
261
+ };
262
+ }
263
+ }
264
+ fences(src) {
265
+ const cap = this.rules.block.fences.exec(src);
266
+ if (cap) {
267
+ const raw = cap[0];
268
+ const text = indentCodeCompensation(raw, cap[3] || '');
269
+ return {
270
+ type: 'code',
271
+ raw,
272
+ lang: cap[2] ? cap[2].trim().replace(this.rules.inline._escapes, '$1') : cap[2],
273
+ text
274
+ };
275
+ }
276
+ }
277
+ heading(src) {
278
+ const cap = this.rules.block.heading.exec(src);
279
+ if (cap) {
280
+ let text = cap[2].trim();
281
+ // remove trailing #s
282
+ if (/#$/.test(text)) {
283
+ const trimmed = rtrim(text, '#');
284
+ if (this.options.pedantic) {
285
+ text = trimmed.trim();
286
+ } else if (!trimmed || / $/.test(trimmed)) {
287
+ // CommonMark requires space before trailing #s
288
+ text = trimmed.trim();
289
+ }
290
+ }
291
+ return {
292
+ type: 'heading',
293
+ raw: cap[0],
294
+ depth: cap[1].length,
295
+ text,
296
+ tokens: this.lexer.inline(text)
297
+ };
298
+ }
299
+ }
300
+ hr(src) {
301
+ const cap = this.rules.block.hr.exec(src);
302
+ if (cap) {
303
+ return {
304
+ type: 'hr',
305
+ raw: cap[0]
306
+ };
307
+ }
308
+ }
309
+ blockquote(src) {
310
+ const cap = this.rules.block.blockquote.exec(src);
311
+ if (cap) {
312
+ const text = rtrim(cap[0].replace(/^ *>[ \t]?/gm, ''), '\n');
313
+ const top = this.lexer.state.top;
314
+ this.lexer.state.top = true;
315
+ const tokens = this.lexer.blockTokens(text);
316
+ this.lexer.state.top = top;
317
+ return {
318
+ type: 'blockquote',
319
+ raw: cap[0],
320
+ tokens,
321
+ text
322
+ };
323
+ }
324
+ }
325
+ list(src) {
326
+ let cap = this.rules.block.list.exec(src);
327
+ if (cap) {
328
+ let bull = cap[1].trim();
329
+ const isordered = bull.length > 1;
330
+ const list = {
331
+ type: 'list',
332
+ raw: '',
333
+ ordered: isordered,
334
+ start: isordered ? +bull.slice(0, -1) : '',
335
+ loose: false,
336
+ items: []
337
+ };
338
+ bull = isordered ? `\\d{1,9}\\${bull.slice(-1)}` : `\\${bull}`;
339
+ if (this.options.pedantic) {
340
+ bull = isordered ? bull : '[*+-]';
341
+ }
342
+ // Get next list item
343
+ const itemRegex = new RegExp(`^( {0,3}${bull})((?:[\t ][^\\n]*)?(?:\\n|$))`);
344
+ let raw = '';
345
+ let itemContents = '';
346
+ let endsWithBlankLine = false;
347
+ // Check if current bullet point can start a new List Item
348
+ while (src) {
349
+ let endEarly = false;
350
+ if (!(cap = itemRegex.exec(src))) {
351
+ break;
352
+ }
353
+ if (this.rules.block.hr.test(src)) {
354
+ // End list if bullet was actually HR (possibly move into itemRegex?)
355
+ break;
356
+ }
357
+ raw = cap[0];
358
+ src = src.substring(raw.length);
359
+ let line = cap[2].split('\n', 1)[0].replace(/^\t+/, t => ' '.repeat(3 * t.length));
360
+ let nextLine = src.split('\n', 1)[0];
361
+ let indent = 0;
362
+ if (this.options.pedantic) {
363
+ indent = 2;
364
+ itemContents = line.trimStart();
365
+ } else {
366
+ indent = cap[2].search(/[^ ]/); // Find first non-space char
367
+ indent = indent > 4 ? 1 : indent; // Treat indented code blocks (> 4 spaces) as having only 1 indent
368
+ itemContents = line.slice(indent);
369
+ indent += cap[1].length;
370
+ }
371
+ let blankLine = false;
372
+ if (!line && /^ *$/.test(nextLine)) {
373
+ // Items begin with at most one blank line
374
+ raw += nextLine + '\n';
375
+ src = src.substring(nextLine.length + 1);
376
+ endEarly = true;
377
+ }
378
+ if (!endEarly) {
379
+ const nextBulletRegex = new RegExp(`^ {0,${Math.min(3, indent - 1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ \t][^\\n]*)?(?:\\n|$))`);
380
+ const hrRegex = new RegExp(`^ {0,${Math.min(3, indent - 1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`);
381
+ const fencesBeginRegex = new RegExp(`^ {0,${Math.min(3, indent - 1)}}(?:\`\`\`|~~~)`);
382
+ const headingBeginRegex = new RegExp(`^ {0,${Math.min(3, indent - 1)}}#`);
383
+ // Check if following lines should be included in List Item
384
+ while (src) {
385
+ const rawLine = src.split('\n', 1)[0];
386
+ nextLine = rawLine;
387
+ // Re-align to follow commonmark nesting rules
388
+ if (this.options.pedantic) {
389
+ nextLine = nextLine.replace(/^ {1,4}(?=( {4})*[^ ])/g, ' ');
390
+ }
391
+ // End list item if found code fences
392
+ if (fencesBeginRegex.test(nextLine)) {
393
+ break;
394
+ }
395
+ // End list item if found start of new heading
396
+ if (headingBeginRegex.test(nextLine)) {
397
+ break;
398
+ }
399
+ // End list item if found start of new bullet
400
+ if (nextBulletRegex.test(nextLine)) {
401
+ break;
402
+ }
403
+ // Horizontal rule found
404
+ if (hrRegex.test(src)) {
405
+ break;
406
+ }
407
+ if (nextLine.search(/[^ ]/) >= indent || !nextLine.trim()) {
408
+ // Dedent if possible
409
+ itemContents += '\n' + nextLine.slice(indent);
410
+ } else {
411
+ // not enough indentation
412
+ if (blankLine) {
413
+ break;
414
+ }
415
+ // paragraph continuation unless last line was a different block level element
416
+ if (line.search(/[^ ]/) >= 4) {
417
+ // indented code block
418
+ break;
419
+ }
420
+ if (fencesBeginRegex.test(line)) {
421
+ break;
422
+ }
423
+ if (headingBeginRegex.test(line)) {
424
+ break;
425
+ }
426
+ if (hrRegex.test(line)) {
427
+ break;
428
+ }
429
+ itemContents += '\n' + nextLine;
430
+ }
431
+ if (!blankLine && !nextLine.trim()) {
432
+ // Check if current line is blank
433
+ blankLine = true;
434
+ }
435
+ raw += rawLine + '\n';
436
+ src = src.substring(rawLine.length + 1);
437
+ line = nextLine.slice(indent);
438
+ }
439
+ }
440
+ if (!list.loose) {
441
+ // If the previous item ended with a blank line, the list is loose
442
+ if (endsWithBlankLine) {
443
+ list.loose = true;
444
+ } else if (/\n *\n *$/.test(raw)) {
445
+ endsWithBlankLine = true;
446
+ }
447
+ }
448
+ let istask = null;
449
+ let ischecked;
450
+ // Check for task list items
451
+ if (this.options.gfm) {
452
+ istask = /^\[[ xX]\] /.exec(itemContents);
453
+ if (istask) {
454
+ ischecked = istask[0] !== '[ ] ';
455
+ itemContents = itemContents.replace(/^\[[ xX]\] +/, '');
456
+ }
457
+ }
458
+ list.items.push({
459
+ type: 'list_item',
460
+ raw,
461
+ task: !!istask,
462
+ checked: ischecked,
463
+ loose: false,
464
+ text: itemContents,
465
+ tokens: []
466
+ });
467
+ list.raw += raw;
468
+ }
469
+ // Do not consume newlines at end of final item. Alternatively, make itemRegex *start* with any newlines to simplify/speed up endsWithBlankLine logic
470
+ list.items[list.items.length - 1].raw = raw.trimEnd();
471
+ list.items[list.items.length - 1].text = itemContents.trimEnd();
472
+ list.raw = list.raw.trimEnd();
473
+ // Item child tokens handled here at end because we needed to have the final item to trim it first
474
+ for (let i = 0; i < list.items.length; i++) {
475
+ this.lexer.state.top = false;
476
+ list.items[i].tokens = this.lexer.blockTokens(list.items[i].text, []);
477
+ if (!list.loose) {
478
+ // Check if list should be loose
479
+ const spacers = list.items[i].tokens.filter(t => t.type === 'space');
480
+ const hasMultipleLineBreaks = spacers.length > 0 && spacers.some(t => /\n.*\n/.test(t.raw));
481
+ list.loose = hasMultipleLineBreaks;
482
+ }
483
+ }
484
+ // Set all items to loose if list is loose
485
+ if (list.loose) {
486
+ for (let i = 0; i < list.items.length; i++) {
487
+ list.items[i].loose = true;
488
+ }
489
+ }
490
+ return list;
491
+ }
492
+ }
493
+ html(src) {
494
+ const cap = this.rules.block.html.exec(src);
495
+ if (cap) {
496
+ const token = {
497
+ type: 'html',
498
+ block: true,
499
+ raw: cap[0],
500
+ pre: cap[1] === 'pre' || cap[1] === 'script' || cap[1] === 'style',
501
+ text: cap[0]
502
+ };
503
+ return token;
504
+ }
505
+ }
506
+ def(src) {
507
+ const cap = this.rules.block.def.exec(src);
508
+ if (cap) {
509
+ const tag = cap[1].toLowerCase().replace(/\s+/g, ' ');
510
+ const href = cap[2] ? cap[2].replace(/^<(.*)>$/, '$1').replace(this.rules.inline._escapes, '$1') : '';
511
+ const title = cap[3] ? cap[3].substring(1, cap[3].length - 1).replace(this.rules.inline._escapes, '$1') : cap[3];
512
+ return {
513
+ type: 'def',
514
+ tag,
515
+ raw: cap[0],
516
+ href,
517
+ title
518
+ };
519
+ }
520
+ }
521
+ table(src) {
522
+ const cap = this.rules.block.table.exec(src);
523
+ if (cap) {
524
+ if (!/[:|]/.test(cap[2])) {
525
+ // delimiter row must have a pipe (|) or colon (:) otherwise it is a setext heading
526
+ return;
527
+ }
528
+ const item = {
529
+ type: 'table',
530
+ raw: cap[0],
531
+ header: splitCells(cap[1]).map(c => {
532
+ return {
533
+ text: c,
534
+ tokens: []
535
+ };
536
+ }),
537
+ align: cap[2].replace(/^\||\| *$/g, '').split('|'),
538
+ rows: cap[3] && cap[3].trim() ? cap[3].replace(/\n[ \t]*$/, '').split('\n') : []
539
+ };
540
+ if (item.header.length === item.align.length) {
541
+ let l = item.align.length;
542
+ let i, j, k, row;
543
+ for (i = 0; i < l; i++) {
544
+ const align = item.align[i];
545
+ if (align) {
546
+ if (/^ *-+: *$/.test(align)) {
547
+ item.align[i] = 'right';
548
+ } else if (/^ *:-+: *$/.test(align)) {
549
+ item.align[i] = 'center';
550
+ } else if (/^ *:-+ *$/.test(align)) {
551
+ item.align[i] = 'left';
552
+ } else {
553
+ item.align[i] = null;
554
+ }
555
+ }
556
+ }
557
+ l = item.rows.length;
558
+ for (i = 0; i < l; i++) {
559
+ item.rows[i] = splitCells(item.rows[i], item.header.length).map(c => {
560
+ return {
561
+ text: c,
562
+ tokens: []
563
+ };
564
+ });
565
+ }
566
+ // parse child tokens inside headers and cells
567
+ // header child tokens
568
+ l = item.header.length;
569
+ for (j = 0; j < l; j++) {
570
+ item.header[j].tokens = this.lexer.inline(item.header[j].text);
571
+ }
572
+ // cell child tokens
573
+ l = item.rows.length;
574
+ for (j = 0; j < l; j++) {
575
+ row = item.rows[j];
576
+ for (k = 0; k < row.length; k++) {
577
+ row[k].tokens = this.lexer.inline(row[k].text);
578
+ }
579
+ }
580
+ return item;
581
+ }
582
+ }
583
+ }
584
+ lheading(src) {
585
+ const cap = this.rules.block.lheading.exec(src);
586
+ if (cap) {
587
+ return {
588
+ type: 'heading',
589
+ raw: cap[0],
590
+ depth: cap[2].charAt(0) === '=' ? 1 : 2,
591
+ text: cap[1],
592
+ tokens: this.lexer.inline(cap[1])
593
+ };
594
+ }
595
+ }
596
+ paragraph(src) {
597
+ const cap = this.rules.block.paragraph.exec(src);
598
+ if (cap) {
599
+ const text = cap[1].charAt(cap[1].length - 1) === '\n' ? cap[1].slice(0, -1) : cap[1];
600
+ return {
601
+ type: 'paragraph',
602
+ raw: cap[0],
603
+ text,
604
+ tokens: this.lexer.inline(text)
605
+ };
606
+ }
607
+ }
608
+ text(src) {
609
+ const cap = this.rules.block.text.exec(src);
610
+ if (cap) {
611
+ return {
612
+ type: 'text',
613
+ raw: cap[0],
614
+ text: cap[0],
615
+ tokens: this.lexer.inline(cap[0])
616
+ };
617
+ }
618
+ }
619
+ escape(src) {
620
+ const cap = this.rules.inline.escape.exec(src);
621
+ if (cap) {
622
+ return {
623
+ type: 'escape',
624
+ raw: cap[0],
625
+ text: escape(cap[1])
626
+ };
627
+ }
628
+ }
629
+ tag(src) {
630
+ const cap = this.rules.inline.tag.exec(src);
631
+ if (cap) {
632
+ if (!this.lexer.state.inLink && /^<a /i.test(cap[0])) {
633
+ this.lexer.state.inLink = true;
634
+ } else if (this.lexer.state.inLink && /^<\/a>/i.test(cap[0])) {
635
+ this.lexer.state.inLink = false;
636
+ }
637
+ if (!this.lexer.state.inRawBlock && /^<(pre|code|kbd|script)(\s|>)/i.test(cap[0])) {
638
+ this.lexer.state.inRawBlock = true;
639
+ } else if (this.lexer.state.inRawBlock && /^<\/(pre|code|kbd|script)(\s|>)/i.test(cap[0])) {
640
+ this.lexer.state.inRawBlock = false;
641
+ }
642
+ return {
643
+ type: 'html',
644
+ raw: cap[0],
645
+ inLink: this.lexer.state.inLink,
646
+ inRawBlock: this.lexer.state.inRawBlock,
647
+ block: false,
648
+ text: cap[0]
649
+ };
650
+ }
651
+ }
652
+ link(src) {
653
+ const cap = this.rules.inline.link.exec(src);
654
+ if (cap) {
655
+ const trimmedUrl = cap[2].trim();
656
+ if (!this.options.pedantic && /^</.test(trimmedUrl)) {
657
+ // commonmark requires matching angle brackets
658
+ if (!/>$/.test(trimmedUrl)) {
659
+ return;
660
+ }
661
+ // ending angle bracket cannot be escaped
662
+ const rtrimSlash = rtrim(trimmedUrl.slice(0, -1), '\\');
663
+ if ((trimmedUrl.length - rtrimSlash.length) % 2 === 0) {
664
+ return;
665
+ }
666
+ } else {
667
+ // find closing parenthesis
668
+ const lastParenIndex = findClosingBracket(cap[2], '()');
669
+ if (lastParenIndex > -1) {
670
+ const start = cap[0].indexOf('!') === 0 ? 5 : 4;
671
+ const linkLen = start + cap[1].length + lastParenIndex;
672
+ cap[2] = cap[2].substring(0, lastParenIndex);
673
+ cap[0] = cap[0].substring(0, linkLen).trim();
674
+ cap[3] = '';
675
+ }
676
+ }
677
+ let href = cap[2];
678
+ let title = '';
679
+ if (this.options.pedantic) {
680
+ // split pedantic href and title
681
+ const link = /^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(href);
682
+ if (link) {
683
+ href = link[1];
684
+ title = link[3];
685
+ }
686
+ } else {
687
+ title = cap[3] ? cap[3].slice(1, -1) : '';
688
+ }
689
+ href = href.trim();
690
+ if (/^</.test(href)) {
691
+ if (this.options.pedantic && !/>$/.test(trimmedUrl)) {
692
+ // pedantic allows starting angle bracket without ending angle bracket
693
+ href = href.slice(1);
694
+ } else {
695
+ href = href.slice(1, -1);
696
+ }
697
+ }
698
+ return outputLink(cap, {
699
+ href: href ? href.replace(this.rules.inline._escapes, '$1') : href,
700
+ title: title ? title.replace(this.rules.inline._escapes, '$1') : title
701
+ }, cap[0], this.lexer);
702
+ }
703
+ }
704
+ reflink(src, links) {
705
+ let cap;
706
+ if ((cap = this.rules.inline.reflink.exec(src)) || (cap = this.rules.inline.nolink.exec(src))) {
707
+ let link = (cap[2] || cap[1]).replace(/\s+/g, ' ');
708
+ link = links[link.toLowerCase()];
709
+ if (!link) {
710
+ const text = cap[0].charAt(0);
711
+ return {
712
+ type: 'text',
713
+ raw: text,
714
+ text
715
+ };
716
+ }
717
+ return outputLink(cap, link, cap[0], this.lexer);
718
+ }
719
+ }
720
+ emStrong(src, maskedSrc, prevChar = '') {
721
+ let match = this.rules.inline.emStrong.lDelim.exec(src);
722
+ if (!match) return;
723
+ // _ can't be between two alphanumerics. \p{L}\p{N} includes non-english alphabet/numbers as well
724
+ if (match[3] && prevChar.match(/[\p{L}\p{N}]/u)) return;
725
+ const nextChar = match[1] || match[2] || '';
726
+ if (!nextChar || !prevChar || this.rules.inline.punctuation.exec(prevChar)) {
727
+ // unicode Regex counts emoji as 1 char; spread into array for proper count (used multiple times below)
728
+ const lLength = [...match[0]].length - 1;
729
+ let rDelim,
730
+ rLength,
731
+ delimTotal = lLength,
732
+ midDelimTotal = 0;
733
+ const endReg = match[0][0] === '*' ? this.rules.inline.emStrong.rDelimAst : this.rules.inline.emStrong.rDelimUnd;
734
+ endReg.lastIndex = 0;
735
+ // Clip maskedSrc to same section of string as src (move to lexer?)
736
+ maskedSrc = maskedSrc.slice(-1 * src.length + lLength);
737
+ while ((match = endReg.exec(maskedSrc)) != null) {
738
+ rDelim = match[1] || match[2] || match[3] || match[4] || match[5] || match[6];
739
+ if (!rDelim) continue; // skip single * in __abc*abc__
740
+ rLength = [...rDelim].length;
741
+ if (match[3] || match[4]) {
742
+ // found another Left Delim
743
+ delimTotal += rLength;
744
+ continue;
745
+ } else if (match[5] || match[6]) {
746
+ // either Left or Right Delim
747
+ if (lLength % 3 && !((lLength + rLength) % 3)) {
748
+ midDelimTotal += rLength;
749
+ continue; // CommonMark Emphasis Rules 9-10
750
+ }
751
+ }
752
+ delimTotal -= rLength;
753
+ if (delimTotal > 0) continue; // Haven't found enough closing delimiters
754
+ // Remove extra characters. *a*** -> *a*
755
+ rLength = Math.min(rLength, rLength + delimTotal + midDelimTotal);
756
+ // char length can be >1 for unicode characters;
757
+ const lastCharLength = [...match[0]][0].length;
758
+ const raw = src.slice(0, lLength + match.index + lastCharLength + rLength);
759
+ // Create `em` if smallest delimiter has odd char count. *a***
760
+ if (Math.min(lLength, rLength) % 2) {
761
+ const text = raw.slice(1, -1);
762
+ return {
763
+ type: 'em',
764
+ raw,
765
+ text,
766
+ tokens: this.lexer.inlineTokens(text)
767
+ };
768
+ }
769
+ // Create 'strong' if smallest delimiter has even char count. **a***
770
+ const text = raw.slice(2, -2);
771
+ return {
772
+ type: 'strong',
773
+ raw,
774
+ text,
775
+ tokens: this.lexer.inlineTokens(text)
776
+ };
777
+ }
778
+ }
779
+ }
780
+ codespan(src) {
781
+ const cap = this.rules.inline.code.exec(src);
782
+ if (cap) {
783
+ let text = cap[2].replace(/\n/g, ' ');
784
+ const hasNonSpaceChars = /[^ ]/.test(text);
785
+ const hasSpaceCharsOnBothEnds = /^ /.test(text) && / $/.test(text);
786
+ if (hasNonSpaceChars && hasSpaceCharsOnBothEnds) {
787
+ text = text.substring(1, text.length - 1);
788
+ }
789
+ text = escape(text, true);
790
+ return {
791
+ type: 'codespan',
792
+ raw: cap[0],
793
+ text
794
+ };
795
+ }
796
+ }
797
+ br(src) {
798
+ const cap = this.rules.inline.br.exec(src);
799
+ if (cap) {
800
+ return {
801
+ type: 'br',
802
+ raw: cap[0]
803
+ };
804
+ }
805
+ }
806
+ del(src) {
807
+ const cap = this.rules.inline.del.exec(src);
808
+ if (cap) {
809
+ return {
810
+ type: 'del',
811
+ raw: cap[0],
812
+ text: cap[2],
813
+ tokens: this.lexer.inlineTokens(cap[2])
814
+ };
815
+ }
816
+ }
817
+ autolink(src) {
818
+ const cap = this.rules.inline.autolink.exec(src);
819
+ if (cap) {
820
+ let text, href;
821
+ if (cap[2] === '@') {
822
+ text = escape(cap[1]);
823
+ href = 'mailto:' + text;
824
+ } else {
825
+ text = escape(cap[1]);
826
+ href = text;
827
+ }
828
+ return {
829
+ type: 'link',
830
+ raw: cap[0],
831
+ text,
832
+ href,
833
+ tokens: [{
834
+ type: 'text',
835
+ raw: text,
836
+ text
837
+ }]
838
+ };
839
+ }
840
+ }
841
+ url(src) {
842
+ let cap;
843
+ if (cap = this.rules.inline.url.exec(src)) {
844
+ let text, href;
845
+ if (cap[2] === '@') {
846
+ text = escape(cap[0]);
847
+ href = 'mailto:' + text;
848
+ } else {
849
+ // do extended autolink path validation
850
+ let prevCapZero;
851
+ do {
852
+ prevCapZero = cap[0];
853
+ cap[0] = this.rules.inline._backpedal.exec(cap[0])[0];
854
+ } while (prevCapZero !== cap[0]);
855
+ text = escape(cap[0]);
856
+ if (cap[1] === 'www.') {
857
+ href = 'http://' + cap[0];
858
+ } else {
859
+ href = cap[0];
860
+ }
861
+ }
862
+ return {
863
+ type: 'link',
864
+ raw: cap[0],
865
+ text,
866
+ href,
867
+ tokens: [{
868
+ type: 'text',
869
+ raw: text,
870
+ text
871
+ }]
872
+ };
873
+ }
874
+ }
875
+ inlineText(src) {
876
+ const cap = this.rules.inline.text.exec(src);
877
+ if (cap) {
878
+ let text;
879
+ if (this.lexer.state.inRawBlock) {
880
+ text = cap[0];
881
+ } else {
882
+ text = escape(cap[0]);
883
+ }
884
+ return {
885
+ type: 'text',
886
+ raw: cap[0],
887
+ text
888
+ };
889
+ }
890
+ }
891
+ }
892
+
893
+ /**
894
+ * Block-Level Grammar
895
+ */
896
+ // Not all rules are defined in the object literal
897
+ // @ts-expect-error
898
+ const block = {
899
+ newline: /^(?: *(?:\n|$))+/,
900
+ code: /^( {4}[^\n]+(?:\n(?: *(?:\n|$))*)?)+/,
901
+ fences: /^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,
902
+ hr: /^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,
903
+ heading: /^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,
904
+ blockquote: /^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/,
905
+ list: /^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/,
906
+ html: '^ {0,3}(?:' // optional indentation
907
+ + '<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)' // (1)
908
+ + '|comment[^\\n]*(\\n+|$)' // (2)
909
+ + '|<\\?[\\s\\S]*?(?:\\?>\\n*|$)' // (3)
910
+ + '|<![A-Z][\\s\\S]*?(?:>\\n*|$)' // (4)
911
+ + '|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)' // (5)
912
+ + '|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n *)+\\n|$)' // (6)
913
+ + '|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n *)+\\n|$)' // (7) open tag
914
+ + '|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n *)+\\n|$)' // (7) closing tag
915
+ + ')',
916
+ def: /^ {0,3}\[(label)\]: *(?:\n *)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n *)?| *\n *)(title))? *(?:\n+|$)/,
917
+ table: noopTest,
918
+ lheading: /^(?!bull )((?:.|\n(?!\s*?\n|bull ))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,
919
+ // regex template, placeholders will be replaced according to different paragraph
920
+ // interruption rules of commonmark and the original markdown spec:
921
+ _paragraph: /^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,
922
+ text: /^[^\n]+/
923
+ };
924
+ block._label = /(?!\s*\])(?:\\.|[^\[\]\\])+/;
925
+ block._title = /(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/;
926
+ block.def = edit(block.def).replace('label', block._label).replace('title', block._title).getRegex();
927
+ block.bullet = /(?:[*+-]|\d{1,9}[.)])/;
928
+ block.listItemStart = edit(/^( *)(bull) */).replace('bull', block.bullet).getRegex();
929
+ 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();
930
+ 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';
931
+ block._comment = /<!--(?!-?>)[\s\S]*?(?:-->|$)/;
932
+ block.html = edit(block.html, 'i').replace('comment', block._comment).replace('tag', block._tag).replace('attribute', / +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex();
933
+ block.lheading = edit(block.lheading).replace(/bull/g, block.bullet) // lists can interrupt
934
+ .getRegex();
935
+ block.paragraph = edit(block._paragraph).replace('hr', block.hr).replace('heading', ' {0,3}#{1,6}(?:\\s|$)').replace('|lheading', '') // setex headings don't interrupt commonmark paragraphs
936
+ .replace('|table', '').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
937
+ .replace('html', '</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)').replace('tag', block._tag) // pars can be interrupted by type (6) html blocks
938
+ .getRegex();
939
+ block.blockquote = edit(block.blockquote).replace('paragraph', block.paragraph).getRegex();
940
+ /**
941
+ * Normal Block Grammar
942
+ */
943
+ block.normal = {
944
+ ...block
945
+ };
946
+ /**
947
+ * GFM Block Grammar
948
+ */
949
+ block.gfm = {
950
+ ...block.normal,
951
+ table: '^ *([^\\n ].*)\\n' // Header
952
+ + ' {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)' // Align
953
+ + '(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)' // Cells
954
+ };
955
+ block.gfm.table = edit(block.gfm.table).replace('hr', block.hr).replace('heading', ' {0,3}#{1,6}(?:\\s|$)').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
956
+ .replace('html', '</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)').replace('tag', block._tag) // tables can be interrupted by type (6) html blocks
957
+ .getRegex();
958
+ block.gfm.paragraph = edit(block._paragraph).replace('hr', block.hr).replace('heading', ' {0,3}#{1,6}(?:\\s|$)').replace('|lheading', '') // setex headings don't interrupt commonmark paragraphs
959
+ .replace('table', block.gfm.table) // interrupt paragraphs with table
960
+ .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
961
+ .replace('html', '</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)').replace('tag', block._tag) // pars can be interrupted by type (6) html blocks
962
+ .getRegex();
963
+ /**
964
+ * Pedantic grammar (original John Gruber's loose markdown specification)
965
+ */
966
+ block.pedantic = {
967
+ ...block.normal,
968
+ html: edit('^ *(?:comment *(?:\\n|\\s*$)' + '|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)' // closed tag
969
+ + '|<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(),
970
+ def: /^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,
971
+ heading: /^(#{1,6})(.*)(?:\n+|$)/,
972
+ fences: noopTest,
973
+ lheading: /^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,
974
+ 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()
975
+ };
976
+ /**
977
+ * Inline-Level Grammar
978
+ */
979
+ // Not all rules are defined in the object literal
980
+ // @ts-expect-error
981
+ const inline = {
982
+ escape: /^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,
983
+ autolink: /^<(scheme:[^\s\x00-\x1f<>]*|email)>/,
984
+ url: noopTest,
985
+ tag: '^comment' + '|^</[a-zA-Z][\\w:-]*\\s*>' // self-closing tag
986
+ + '|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>' // open tag
987
+ + '|^<\\?[\\s\\S]*?\\?>' // processing instruction, e.g. <?php ?>
988
+ + '|^<![a-zA-Z]+\\s[\\s\\S]*?>' // declaration, e.g. <!DOCTYPE html>
989
+ + '|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>',
990
+ link: /^!?\[(label)\]\(\s*(href)(?:\s+(title))?\s*\)/,
991
+ reflink: /^!?\[(label)\]\[(ref)\]/,
992
+ nolink: /^!?\[(ref)\](?:\[\])?/,
993
+ reflinkSearch: 'reflink|nolink(?!\\()',
994
+ emStrong: {
995
+ lDelim: /^(?:\*+(?:((?!\*)[punct])|[^\s*]))|^_+(?:((?!_)[punct])|([^\s_]))/,
996
+ // (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.
997
+ // | Skip orphan inside strong | Consume to delim | (1) #*** | (2) a***#, a*** | (3) #***a, ***a | (4) ***# | (5) #***# | (6) a***a
998
+ rDelimAst: /^[^_*]*?__[^_*]*?\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\*)[punct](\*+)(?=[\s]|$)|[^punct\s](\*+)(?!\*)(?=[punct\s]|$)|(?!\*)[punct\s](\*+)(?=[^punct\s])|[\s](\*+)(?!\*)(?=[punct])|(?!\*)[punct](\*+)(?!\*)(?=[punct])|[^punct\s](\*+)(?=[^punct\s])/,
999
+ rDelimUnd: /^[^_*]*?\*\*[^_*]*?_[^_*]*?(?=\*\*)|[^_]+(?=[^_])|(?!_)[punct](_+)(?=[\s]|$)|[^punct\s](_+)(?!_)(?=[punct\s]|$)|(?!_)[punct\s](_+)(?=[^punct\s])|[\s](_+)(?!_)(?=[punct])|(?!_)[punct](_+)(?!_)(?=[punct])/ // ^- Not allowed for _
1000
+ },
1001
+ code: /^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,
1002
+ br: /^( {2,}|\\)\n(?!\s*$)/,
1003
+ del: noopTest,
1004
+ text: /^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,
1005
+ punctuation: /^((?![*_])[\spunctuation])/
1006
+ };
1007
+ // list of unicode punctuation marks, plus any missing characters from CommonMark spec
1008
+ inline._punctuation = '\\p{P}$+<=>`^|~';
1009
+ inline.punctuation = edit(inline.punctuation, 'u').replace(/punctuation/g, inline._punctuation).getRegex();
1010
+ // sequences em should skip over [title](link), `code`, <html>
1011
+ inline.blockSkip = /\[[^[\]]*?\]\([^\(\)]*?\)|`[^`]*?`|<[^<>]*?>/g;
1012
+ inline.anyPunctuation = /\\[punct]/g;
1013
+ inline._escapes = /\\([punct])/g;
1014
+ inline._comment = edit(block._comment).replace('(?:-->|$)', '-->').getRegex();
1015
+ inline.emStrong.lDelim = edit(inline.emStrong.lDelim, 'u').replace(/punct/g, inline._punctuation).getRegex();
1016
+ inline.emStrong.rDelimAst = edit(inline.emStrong.rDelimAst, 'gu').replace(/punct/g, inline._punctuation).getRegex();
1017
+ inline.emStrong.rDelimUnd = edit(inline.emStrong.rDelimUnd, 'gu').replace(/punct/g, inline._punctuation).getRegex();
1018
+ inline.anyPunctuation = edit(inline.anyPunctuation, 'gu').replace(/punct/g, inline._punctuation).getRegex();
1019
+ inline._escapes = edit(inline._escapes, 'gu').replace(/punct/g, inline._punctuation).getRegex();
1020
+ inline._scheme = /[a-zA-Z][a-zA-Z0-9+.-]{1,31}/;
1021
+ 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])?)+(?![-_])/;
1022
+ inline.autolink = edit(inline.autolink).replace('scheme', inline._scheme).replace('email', inline._email).getRegex();
1023
+ inline._attribute = /\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/;
1024
+ inline.tag = edit(inline.tag).replace('comment', inline._comment).replace('attribute', inline._attribute).getRegex();
1025
+ inline._label = /(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/;
1026
+ inline._href = /<(?:\\.|[^\n<>\\])+>|[^\s\x00-\x1f]*/;
1027
+ inline._title = /"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/;
1028
+ inline.link = edit(inline.link).replace('label', inline._label).replace('href', inline._href).replace('title', inline._title).getRegex();
1029
+ inline.reflink = edit(inline.reflink).replace('label', inline._label).replace('ref', block._label).getRegex();
1030
+ inline.nolink = edit(inline.nolink).replace('ref', block._label).getRegex();
1031
+ inline.reflinkSearch = edit(inline.reflinkSearch, 'g').replace('reflink', inline.reflink).replace('nolink', inline.nolink).getRegex();
1032
+ /**
1033
+ * Normal Inline Grammar
1034
+ */
1035
+ inline.normal = {
1036
+ ...inline
1037
+ };
1038
+ /**
1039
+ * Pedantic Inline Grammar
1040
+ */
1041
+ inline.pedantic = {
1042
+ ...inline.normal,
1043
+ strong: {
1044
+ start: /^__|\*\*/,
1045
+ middle: /^__(?=\S)([\s\S]*?\S)__(?!_)|^\*\*(?=\S)([\s\S]*?\S)\*\*(?!\*)/,
1046
+ endAst: /\*\*(?!\*)/g,
1047
+ endUnd: /__(?!_)/g
1048
+ },
1049
+ em: {
1050
+ start: /^_|\*/,
1051
+ middle: /^()\*(?=\S)([\s\S]*?\S)\*(?!\*)|^_(?=\S)([\s\S]*?\S)_(?!_)/,
1052
+ endAst: /\*(?!\*)/g,
1053
+ endUnd: /_(?!_)/g
1054
+ },
1055
+ link: edit(/^!?\[(label)\]\((.*?)\)/).replace('label', inline._label).getRegex(),
1056
+ reflink: edit(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace('label', inline._label).getRegex()
1057
+ };
1058
+ /**
1059
+ * GFM Inline Grammar
1060
+ */
1061
+ inline.gfm = {
1062
+ ...inline.normal,
1063
+ escape: edit(inline.escape).replace('])', '~|])').getRegex(),
1064
+ _extended_email: /[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/,
1065
+ url: /^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/,
1066
+ _backpedal: /(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,
1067
+ del: /^(~~?)(?=[^\s~])([\s\S]*?[^\s~])\1(?=[^~]|$)/,
1068
+ text: /^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|https?:\/\/|ftp:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/
1069
+ };
1070
+ inline.gfm.url = edit(inline.gfm.url, 'i').replace('email', inline.gfm._extended_email).getRegex();
1071
+ /**
1072
+ * GFM + Line Breaks Inline Grammar
1073
+ */
1074
+ inline.breaks = {
1075
+ ...inline.gfm,
1076
+ br: edit(inline.br).replace('{2,}', '*').getRegex(),
1077
+ text: edit(inline.gfm.text).replace('\\b_', '\\b_| {2,}\\n').replace(/\{2,\}/g, '*').getRegex()
1078
+ };
1079
+
1080
+ /**
1081
+ * Block Lexer
1082
+ */
1083
+ class _Lexer {
1084
+ constructor(options) {
1085
+ this.tokens = void 0;
1086
+ this.options = void 0;
1087
+ this.state = void 0;
1088
+ this.tokenizer = void 0;
1089
+ this.inlineQueue = void 0;
1090
+ // TokenList cannot be created in one go
1091
+ // @ts-expect-error
1092
+ this.tokens = [];
1093
+ this.tokens.links = Object.create(null);
1094
+ this.options = options || _defaults;
1095
+ this.options.tokenizer = this.options.tokenizer || new _Tokenizer();
1096
+ this.tokenizer = this.options.tokenizer;
1097
+ this.tokenizer.options = this.options;
1098
+ this.tokenizer.lexer = this;
1099
+ this.inlineQueue = [];
1100
+ this.state = {
1101
+ inLink: false,
1102
+ inRawBlock: false,
1103
+ top: true
1104
+ };
1105
+ const rules = {
1106
+ block: block.normal,
1107
+ inline: inline.normal
1108
+ };
1109
+ if (this.options.pedantic) {
1110
+ rules.block = block.pedantic;
1111
+ rules.inline = inline.pedantic;
1112
+ } else if (this.options.gfm) {
1113
+ rules.block = block.gfm;
1114
+ if (this.options.breaks) {
1115
+ rules.inline = inline.breaks;
1116
+ } else {
1117
+ rules.inline = inline.gfm;
1118
+ }
1119
+ }
1120
+ this.tokenizer.rules = rules;
1121
+ }
1122
+ /**
1123
+ * Expose Rules
1124
+ */
1125
+ static get rules() {
1126
+ return {
1127
+ block,
1128
+ inline
1129
+ };
1130
+ }
1131
+ /**
1132
+ * Static Lex Method
1133
+ */
1134
+ static lex(src, options) {
1135
+ const lexer = new _Lexer(options);
1136
+ return lexer.lex(src);
1137
+ }
1138
+ /**
1139
+ * Static Lex Inline Method
1140
+ */
1141
+ static lexInline(src, options) {
1142
+ const lexer = new _Lexer(options);
1143
+ return lexer.inlineTokens(src);
1144
+ }
1145
+ /**
1146
+ * Preprocessing
1147
+ */
1148
+ lex(src) {
1149
+ src = src.replace(/\r\n|\r/g, '\n');
1150
+ this.blockTokens(src, this.tokens);
1151
+ let next;
1152
+ while (next = this.inlineQueue.shift()) {
1153
+ this.inlineTokens(next.src, next.tokens);
1154
+ }
1155
+ return this.tokens;
1156
+ }
1157
+ blockTokens(src, tokens = []) {
1158
+ if (this.options.pedantic) {
1159
+ src = src.replace(/\t/g, ' ').replace(/^ +$/gm, '');
1160
+ } else {
1161
+ src = src.replace(/^( *)(\t+)/gm, (_, leading, tabs) => {
1162
+ return leading + ' '.repeat(tabs.length);
1163
+ });
1164
+ }
1165
+ let token;
1166
+ let lastToken;
1167
+ let cutSrc;
1168
+ let lastParagraphClipped;
1169
+ while (src) {
1170
+ if (this.options.extensions && this.options.extensions.block && this.options.extensions.block.some(extTokenizer => {
1171
+ if (token = extTokenizer.call({
1172
+ lexer: this
1173
+ }, src, tokens)) {
1174
+ src = src.substring(token.raw.length);
1175
+ tokens.push(token);
1176
+ return true;
1177
+ }
1178
+ return false;
1179
+ })) {
1180
+ continue;
1181
+ }
1182
+ // newline
1183
+ if (token = this.tokenizer.space(src)) {
1184
+ src = src.substring(token.raw.length);
1185
+ if (token.raw.length === 1 && tokens.length > 0) {
1186
+ // if there's a single \n as a spacer, it's terminating the last line,
1187
+ // so move it there so that we don't get unnecessary paragraph tags
1188
+ tokens[tokens.length - 1].raw += '\n';
1189
+ } else {
1190
+ tokens.push(token);
1191
+ }
1192
+ continue;
1193
+ }
1194
+ // code
1195
+ if (token = this.tokenizer.code(src)) {
1196
+ src = src.substring(token.raw.length);
1197
+ lastToken = tokens[tokens.length - 1];
1198
+ // An indented code block cannot interrupt a paragraph.
1199
+ if (lastToken && (lastToken.type === 'paragraph' || lastToken.type === 'text')) {
1200
+ lastToken.raw += '\n' + token.raw;
1201
+ lastToken.text += '\n' + token.text;
1202
+ this.inlineQueue[this.inlineQueue.length - 1].src = lastToken.text;
1203
+ } else {
1204
+ tokens.push(token);
1205
+ }
1206
+ continue;
1207
+ }
1208
+ // fences
1209
+ if (token = this.tokenizer.fences(src)) {
1210
+ src = src.substring(token.raw.length);
1211
+ tokens.push(token);
1212
+ continue;
1213
+ }
1214
+ // heading
1215
+ if (token = this.tokenizer.heading(src)) {
1216
+ src = src.substring(token.raw.length);
1217
+ tokens.push(token);
1218
+ continue;
1219
+ }
1220
+ // hr
1221
+ if (token = this.tokenizer.hr(src)) {
1222
+ src = src.substring(token.raw.length);
1223
+ tokens.push(token);
1224
+ continue;
1225
+ }
1226
+ // blockquote
1227
+ if (token = this.tokenizer.blockquote(src)) {
1228
+ src = src.substring(token.raw.length);
1229
+ tokens.push(token);
1230
+ continue;
1231
+ }
1232
+ // list
1233
+ if (token = this.tokenizer.list(src)) {
1234
+ src = src.substring(token.raw.length);
1235
+ tokens.push(token);
1236
+ continue;
1237
+ }
1238
+ // html
1239
+ if (token = this.tokenizer.html(src)) {
1240
+ src = src.substring(token.raw.length);
1241
+ tokens.push(token);
1242
+ continue;
1243
+ }
1244
+ // def
1245
+ if (token = this.tokenizer.def(src)) {
1246
+ src = src.substring(token.raw.length);
1247
+ lastToken = tokens[tokens.length - 1];
1248
+ if (lastToken && (lastToken.type === 'paragraph' || lastToken.type === 'text')) {
1249
+ lastToken.raw += '\n' + token.raw;
1250
+ lastToken.text += '\n' + token.raw;
1251
+ this.inlineQueue[this.inlineQueue.length - 1].src = lastToken.text;
1252
+ } else if (!this.tokens.links[token.tag]) {
1253
+ this.tokens.links[token.tag] = {
1254
+ href: token.href,
1255
+ title: token.title
1256
+ };
1257
+ }
1258
+ continue;
1259
+ }
1260
+ // table (gfm)
1261
+ if (token = this.tokenizer.table(src)) {
1262
+ src = src.substring(token.raw.length);
1263
+ tokens.push(token);
1264
+ continue;
1265
+ }
1266
+ // lheading
1267
+ if (token = this.tokenizer.lheading(src)) {
1268
+ src = src.substring(token.raw.length);
1269
+ tokens.push(token);
1270
+ continue;
1271
+ }
1272
+ // top-level paragraph
1273
+ // prevent paragraph consuming extensions by clipping 'src' to extension start
1274
+ cutSrc = src;
1275
+ if (this.options.extensions && this.options.extensions.startBlock) {
1276
+ let startIndex = Infinity;
1277
+ const tempSrc = src.slice(1);
1278
+ let tempStart;
1279
+ this.options.extensions.startBlock.forEach(getStartIndex => {
1280
+ tempStart = getStartIndex.call({
1281
+ lexer: this
1282
+ }, tempSrc);
1283
+ if (typeof tempStart === 'number' && tempStart >= 0) {
1284
+ startIndex = Math.min(startIndex, tempStart);
1285
+ }
1286
+ });
1287
+ if (startIndex < Infinity && startIndex >= 0) {
1288
+ cutSrc = src.substring(0, startIndex + 1);
1289
+ }
1290
+ }
1291
+ if (this.state.top && (token = this.tokenizer.paragraph(cutSrc))) {
1292
+ lastToken = tokens[tokens.length - 1];
1293
+ if (lastParagraphClipped && lastToken.type === 'paragraph') {
1294
+ lastToken.raw += '\n' + token.raw;
1295
+ lastToken.text += '\n' + token.text;
1296
+ this.inlineQueue.pop();
1297
+ this.inlineQueue[this.inlineQueue.length - 1].src = lastToken.text;
1298
+ } else {
1299
+ tokens.push(token);
1300
+ }
1301
+ lastParagraphClipped = cutSrc.length !== src.length;
1302
+ src = src.substring(token.raw.length);
1303
+ continue;
1304
+ }
1305
+ // text
1306
+ if (token = this.tokenizer.text(src)) {
1307
+ src = src.substring(token.raw.length);
1308
+ lastToken = tokens[tokens.length - 1];
1309
+ if (lastToken && lastToken.type === 'text') {
1310
+ lastToken.raw += '\n' + token.raw;
1311
+ lastToken.text += '\n' + token.text;
1312
+ this.inlineQueue.pop();
1313
+ this.inlineQueue[this.inlineQueue.length - 1].src = lastToken.text;
1314
+ } else {
1315
+ tokens.push(token);
1316
+ }
1317
+ continue;
1318
+ }
1319
+ if (src) {
1320
+ const errMsg = 'Infinite loop on byte: ' + src.charCodeAt(0);
1321
+ if (this.options.silent) {
1322
+ console.error(errMsg);
1323
+ break;
1324
+ } else {
1325
+ throw new Error(errMsg);
1326
+ }
1327
+ }
1328
+ }
1329
+ this.state.top = true;
1330
+ return tokens;
1331
+ }
1332
+ inline(src, tokens = []) {
1333
+ this.inlineQueue.push({
1334
+ src,
1335
+ tokens
1336
+ });
1337
+ return tokens;
1338
+ }
1339
+ /**
1340
+ * Lexing/Compiling
1341
+ */
1342
+ inlineTokens(src, tokens = []) {
1343
+ let token, lastToken, cutSrc;
1344
+ // String with links masked to avoid interference with em and strong
1345
+ let maskedSrc = src;
1346
+ let match;
1347
+ let keepPrevChar, prevChar;
1348
+ // Mask out reflinks
1349
+ if (this.tokens.links) {
1350
+ const links = Object.keys(this.tokens.links);
1351
+ if (links.length > 0) {
1352
+ while ((match = this.tokenizer.rules.inline.reflinkSearch.exec(maskedSrc)) != null) {
1353
+ if (links.includes(match[0].slice(match[0].lastIndexOf('[') + 1, -1))) {
1354
+ maskedSrc = maskedSrc.slice(0, match.index) + '[' + 'a'.repeat(match[0].length - 2) + ']' + maskedSrc.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex);
1355
+ }
1356
+ }
1357
+ }
1358
+ }
1359
+ // Mask out other blocks
1360
+ while ((match = this.tokenizer.rules.inline.blockSkip.exec(maskedSrc)) != null) {
1361
+ maskedSrc = maskedSrc.slice(0, match.index) + '[' + 'a'.repeat(match[0].length - 2) + ']' + maskedSrc.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);
1362
+ }
1363
+ // Mask out escaped characters
1364
+ while ((match = this.tokenizer.rules.inline.anyPunctuation.exec(maskedSrc)) != null) {
1365
+ maskedSrc = maskedSrc.slice(0, match.index) + '++' + maskedSrc.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);
1366
+ }
1367
+ while (src) {
1368
+ if (!keepPrevChar) {
1369
+ prevChar = '';
1370
+ }
1371
+ keepPrevChar = false;
1372
+ // extensions
1373
+ if (this.options.extensions && this.options.extensions.inline && this.options.extensions.inline.some(extTokenizer => {
1374
+ if (token = extTokenizer.call({
1375
+ lexer: this
1376
+ }, src, tokens)) {
1377
+ src = src.substring(token.raw.length);
1378
+ tokens.push(token);
1379
+ return true;
1380
+ }
1381
+ return false;
1382
+ })) {
1383
+ continue;
1384
+ }
1385
+ // escape
1386
+ if (token = this.tokenizer.escape(src)) {
1387
+ src = src.substring(token.raw.length);
1388
+ tokens.push(token);
1389
+ continue;
1390
+ }
1391
+ // tag
1392
+ if (token = this.tokenizer.tag(src)) {
1393
+ src = src.substring(token.raw.length);
1394
+ lastToken = tokens[tokens.length - 1];
1395
+ if (lastToken && token.type === 'text' && lastToken.type === 'text') {
1396
+ lastToken.raw += token.raw;
1397
+ lastToken.text += token.text;
1398
+ } else {
1399
+ tokens.push(token);
1400
+ }
1401
+ continue;
1402
+ }
1403
+ // link
1404
+ if (token = this.tokenizer.link(src)) {
1405
+ src = src.substring(token.raw.length);
1406
+ tokens.push(token);
1407
+ continue;
1408
+ }
1409
+ // reflink, nolink
1410
+ if (token = this.tokenizer.reflink(src, this.tokens.links)) {
1411
+ src = src.substring(token.raw.length);
1412
+ lastToken = tokens[tokens.length - 1];
1413
+ if (lastToken && token.type === 'text' && lastToken.type === 'text') {
1414
+ lastToken.raw += token.raw;
1415
+ lastToken.text += token.text;
1416
+ } else {
1417
+ tokens.push(token);
1418
+ }
1419
+ continue;
1420
+ }
1421
+ // em & strong
1422
+ if (token = this.tokenizer.emStrong(src, maskedSrc, prevChar)) {
1423
+ src = src.substring(token.raw.length);
1424
+ tokens.push(token);
1425
+ continue;
1426
+ }
1427
+ // code
1428
+ if (token = this.tokenizer.codespan(src)) {
1429
+ src = src.substring(token.raw.length);
1430
+ tokens.push(token);
1431
+ continue;
1432
+ }
1433
+ // br
1434
+ if (token = this.tokenizer.br(src)) {
1435
+ src = src.substring(token.raw.length);
1436
+ tokens.push(token);
1437
+ continue;
1438
+ }
1439
+ // del (gfm)
1440
+ if (token = this.tokenizer.del(src)) {
1441
+ src = src.substring(token.raw.length);
1442
+ tokens.push(token);
1443
+ continue;
1444
+ }
1445
+ // autolink
1446
+ if (token = this.tokenizer.autolink(src)) {
1447
+ src = src.substring(token.raw.length);
1448
+ tokens.push(token);
1449
+ continue;
1450
+ }
1451
+ // url (gfm)
1452
+ if (!this.state.inLink && (token = this.tokenizer.url(src))) {
1453
+ src = src.substring(token.raw.length);
1454
+ tokens.push(token);
1455
+ continue;
1456
+ }
1457
+ // text
1458
+ // prevent inlineText consuming extensions by clipping 'src' to extension start
1459
+ cutSrc = src;
1460
+ if (this.options.extensions && this.options.extensions.startInline) {
1461
+ let startIndex = Infinity;
1462
+ const tempSrc = src.slice(1);
1463
+ let tempStart;
1464
+ this.options.extensions.startInline.forEach(getStartIndex => {
1465
+ tempStart = getStartIndex.call({
1466
+ lexer: this
1467
+ }, tempSrc);
1468
+ if (typeof tempStart === 'number' && tempStart >= 0) {
1469
+ startIndex = Math.min(startIndex, tempStart);
1470
+ }
1471
+ });
1472
+ if (startIndex < Infinity && startIndex >= 0) {
1473
+ cutSrc = src.substring(0, startIndex + 1);
1474
+ }
1475
+ }
1476
+ if (token = this.tokenizer.inlineText(cutSrc)) {
1477
+ src = src.substring(token.raw.length);
1478
+ if (token.raw.slice(-1) !== '_') {
1479
+ // Track prevChar before string of ____ started
1480
+ prevChar = token.raw.slice(-1);
1481
+ }
1482
+ keepPrevChar = true;
1483
+ lastToken = tokens[tokens.length - 1];
1484
+ if (lastToken && lastToken.type === 'text') {
1485
+ lastToken.raw += token.raw;
1486
+ lastToken.text += token.text;
1487
+ } else {
1488
+ tokens.push(token);
1489
+ }
1490
+ continue;
1491
+ }
1492
+ if (src) {
1493
+ const errMsg = 'Infinite loop on byte: ' + src.charCodeAt(0);
1494
+ if (this.options.silent) {
1495
+ console.error(errMsg);
1496
+ break;
1497
+ } else {
1498
+ throw new Error(errMsg);
1499
+ }
1500
+ }
1501
+ }
1502
+ return tokens;
1503
+ }
1504
+ }
1505
+
1506
+ /**
1507
+ * Renderer
1508
+ */
1509
+ class _Renderer {
1510
+ constructor(options) {
1511
+ this.options = void 0;
1512
+ this.options = options || _defaults;
1513
+ }
1514
+ code(code, infostring, escaped) {
1515
+ const lang = (infostring || '').match(/^\S*/)?.[0];
1516
+ code = code.replace(/\n$/, '') + '\n';
1517
+ if (!lang) {
1518
+ return '<pre><code>' + (escaped ? code : escape(code, true)) + '</code></pre>\n';
1519
+ }
1520
+ return '<pre><code class="language-' + escape(lang) + '">' + (escaped ? code : escape(code, true)) + '</code></pre>\n';
1521
+ }
1522
+ blockquote(quote) {
1523
+ return `<blockquote>\n${quote}</blockquote>\n`;
1524
+ }
1525
+ html(html, block) {
1526
+ return html;
1527
+ }
1528
+ heading(text, level, raw) {
1529
+ // ignore IDs
1530
+ return `<h${level}>${text}</h${level}>\n`;
1531
+ }
1532
+ hr() {
1533
+ return '<hr>\n';
1534
+ }
1535
+ list(body, ordered, start) {
1536
+ const type = ordered ? 'ol' : 'ul';
1537
+ const startatt = ordered && start !== 1 ? ' start="' + start + '"' : '';
1538
+ return '<' + type + startatt + '>\n' + body + '</' + type + '>\n';
1539
+ }
1540
+ listitem(text, task, checked) {
1541
+ return `<li>${text}</li>\n`;
1542
+ }
1543
+ checkbox(checked) {
1544
+ return '<input ' + (checked ? 'checked="" ' : '') + 'disabled="" type="checkbox">';
1545
+ }
1546
+ paragraph(text) {
1547
+ return `<p>${text}</p>\n`;
1548
+ }
1549
+ table(header, body) {
1550
+ if (body) body = `<tbody>${body}</tbody>`;
1551
+ return '<table>\n' + '<thead>\n' + header + '</thead>\n' + body + '</table>\n';
1552
+ }
1553
+ tablerow(content) {
1554
+ return `<tr>\n${content}</tr>\n`;
1555
+ }
1556
+ tablecell(content, flags) {
1557
+ const type = flags.header ? 'th' : 'td';
1558
+ const tag = flags.align ? `<${type} align="${flags.align}">` : `<${type}>`;
1559
+ return tag + content + `</${type}>\n`;
1560
+ }
1561
+ /**
1562
+ * span level renderer
1563
+ */
1564
+ strong(text) {
1565
+ return `<strong>${text}</strong>`;
1566
+ }
1567
+ em(text) {
1568
+ return `<em>${text}</em>`;
1569
+ }
1570
+ codespan(text) {
1571
+ return `<code>${text}</code>`;
1572
+ }
1573
+ br() {
1574
+ return '<br>';
1575
+ }
1576
+ del(text) {
1577
+ return `<del>${text}</del>`;
1578
+ }
1579
+ link(href, title, text) {
1580
+ const cleanHref = cleanUrl(href);
1581
+ if (cleanHref === null) {
1582
+ return text;
1583
+ }
1584
+ href = cleanHref;
1585
+ let out = '<a href="' + href + '"';
1586
+ if (title) {
1587
+ out += ' title="' + title + '"';
1588
+ }
1589
+ out += '>' + text + '</a>';
1590
+ return out;
1591
+ }
1592
+ image(href, title, text) {
1593
+ const cleanHref = cleanUrl(href);
1594
+ if (cleanHref === null) {
1595
+ return text;
1596
+ }
1597
+ href = cleanHref;
1598
+ let out = `<img src="${href}" alt="${text}"`;
1599
+ if (title) {
1600
+ out += ` title="${title}"`;
1601
+ }
1602
+ out += '>';
1603
+ return out;
1604
+ }
1605
+ text(text) {
1606
+ return text;
1607
+ }
1608
+ }
1609
+
1610
+ /**
1611
+ * TextRenderer
1612
+ * returns only the textual part of the token
1613
+ */
1614
+ class _TextRenderer {
1615
+ // no need for block level renderers
1616
+ strong(text) {
1617
+ return text;
1618
+ }
1619
+ em(text) {
1620
+ return text;
1621
+ }
1622
+ codespan(text) {
1623
+ return text;
1624
+ }
1625
+ del(text) {
1626
+ return text;
1627
+ }
1628
+ html(text) {
1629
+ return text;
1630
+ }
1631
+ text(text) {
1632
+ return text;
1633
+ }
1634
+ link(href, title, text) {
1635
+ return '' + text;
1636
+ }
1637
+ image(href, title, text) {
1638
+ return '' + text;
1639
+ }
1640
+ br() {
1641
+ return '';
1642
+ }
1643
+ }
1644
+
1645
+ /**
1646
+ * Parsing & Compiling
1647
+ */
1648
+ class _Parser {
1649
+ constructor(options) {
1650
+ this.options = void 0;
1651
+ this.renderer = void 0;
1652
+ this.textRenderer = void 0;
1653
+ this.options = options || _defaults;
1654
+ this.options.renderer = this.options.renderer || new _Renderer();
1655
+ this.renderer = this.options.renderer;
1656
+ this.renderer.options = this.options;
1657
+ this.textRenderer = new _TextRenderer();
1658
+ }
1659
+ /**
1660
+ * Static Parse Method
1661
+ */
1662
+ static parse(tokens, options) {
1663
+ const parser = new _Parser(options);
1664
+ return parser.parse(tokens);
1665
+ }
1666
+ /**
1667
+ * Static Parse Inline Method
1668
+ */
1669
+ static parseInline(tokens, options) {
1670
+ const parser = new _Parser(options);
1671
+ return parser.parseInline(tokens);
1672
+ }
1673
+ /**
1674
+ * Parse Loop
1675
+ */
1676
+ parse(tokens, top = true) {
1677
+ let out = '';
1678
+ for (let i = 0; i < tokens.length; i++) {
1679
+ const token = tokens[i];
1680
+ // Run any renderer extensions
1681
+ if (this.options.extensions && this.options.extensions.renderers && this.options.extensions.renderers[token.type]) {
1682
+ const genericToken = token;
1683
+ const ret = this.options.extensions.renderers[genericToken.type].call({
1684
+ parser: this
1685
+ }, genericToken);
1686
+ if (ret !== false || !['space', 'hr', 'heading', 'code', 'table', 'blockquote', 'list', 'html', 'paragraph', 'text'].includes(genericToken.type)) {
1687
+ out += ret || '';
1688
+ continue;
1689
+ }
1690
+ }
1691
+ switch (token.type) {
1692
+ case 'space':
1693
+ {
1694
+ continue;
1695
+ }
1696
+ case 'hr':
1697
+ {
1698
+ out += this.renderer.hr();
1699
+ continue;
1700
+ }
1701
+ case 'heading':
1702
+ {
1703
+ const headingToken = token;
1704
+ out += this.renderer.heading(this.parseInline(headingToken.tokens), headingToken.depth, unescape(this.parseInline(headingToken.tokens, this.textRenderer)));
1705
+ continue;
1706
+ }
1707
+ case 'code':
1708
+ {
1709
+ const codeToken = token;
1710
+ out += this.renderer.code(codeToken.text, codeToken.lang, !!codeToken.escaped);
1711
+ continue;
1712
+ }
1713
+ case 'table':
1714
+ {
1715
+ const tableToken = token;
1716
+ let header = '';
1717
+ // header
1718
+ let cell = '';
1719
+ for (let j = 0; j < tableToken.header.length; j++) {
1720
+ cell += this.renderer.tablecell(this.parseInline(tableToken.header[j].tokens), {
1721
+ header: true,
1722
+ align: tableToken.align[j]
1723
+ });
1724
+ }
1725
+ header += this.renderer.tablerow(cell);
1726
+ let body = '';
1727
+ for (let j = 0; j < tableToken.rows.length; j++) {
1728
+ const row = tableToken.rows[j];
1729
+ cell = '';
1730
+ for (let k = 0; k < row.length; k++) {
1731
+ cell += this.renderer.tablecell(this.parseInline(row[k].tokens), {
1732
+ header: false,
1733
+ align: tableToken.align[k]
1734
+ });
1735
+ }
1736
+ body += this.renderer.tablerow(cell);
1737
+ }
1738
+ out += this.renderer.table(header, body);
1739
+ continue;
1740
+ }
1741
+ case 'blockquote':
1742
+ {
1743
+ const blockquoteToken = token;
1744
+ const body = this.parse(blockquoteToken.tokens);
1745
+ out += this.renderer.blockquote(body);
1746
+ continue;
1747
+ }
1748
+ case 'list':
1749
+ {
1750
+ const listToken = token;
1751
+ const ordered = listToken.ordered;
1752
+ const start = listToken.start;
1753
+ const loose = listToken.loose;
1754
+ let body = '';
1755
+ for (let j = 0; j < listToken.items.length; j++) {
1756
+ const item = listToken.items[j];
1757
+ const checked = item.checked;
1758
+ const task = item.task;
1759
+ let itemBody = '';
1760
+ if (item.task) {
1761
+ const checkbox = this.renderer.checkbox(!!checked);
1762
+ if (loose) {
1763
+ if (item.tokens.length > 0 && item.tokens[0].type === 'paragraph') {
1764
+ item.tokens[0].text = checkbox + ' ' + item.tokens[0].text;
1765
+ if (item.tokens[0].tokens && item.tokens[0].tokens.length > 0 && item.tokens[0].tokens[0].type === 'text') {
1766
+ item.tokens[0].tokens[0].text = checkbox + ' ' + item.tokens[0].tokens[0].text;
1767
+ }
1768
+ } else {
1769
+ item.tokens.unshift({
1770
+ type: 'text',
1771
+ text: checkbox + ' '
1772
+ });
1773
+ }
1774
+ } else {
1775
+ itemBody += checkbox + ' ';
1776
+ }
1777
+ }
1778
+ itemBody += this.parse(item.tokens, loose);
1779
+ body += this.renderer.listitem(itemBody, task, !!checked);
1780
+ }
1781
+ out += this.renderer.list(body, ordered, start);
1782
+ continue;
1783
+ }
1784
+ case 'html':
1785
+ {
1786
+ const htmlToken = token;
1787
+ out += this.renderer.html(htmlToken.text, htmlToken.block);
1788
+ continue;
1789
+ }
1790
+ case 'paragraph':
1791
+ {
1792
+ const paragraphToken = token;
1793
+ out += this.renderer.paragraph(this.parseInline(paragraphToken.tokens));
1794
+ continue;
1795
+ }
1796
+ case 'text':
1797
+ {
1798
+ let textToken = token;
1799
+ let body = textToken.tokens ? this.parseInline(textToken.tokens) : textToken.text;
1800
+ while (i + 1 < tokens.length && tokens[i + 1].type === 'text') {
1801
+ textToken = tokens[++i];
1802
+ body += '\n' + (textToken.tokens ? this.parseInline(textToken.tokens) : textToken.text);
1803
+ }
1804
+ out += top ? this.renderer.paragraph(body) : body;
1805
+ continue;
1806
+ }
1807
+ default:
1808
+ {
1809
+ const errMsg = 'Token with "' + token.type + '" type was not found.';
1810
+ if (this.options.silent) {
1811
+ console.error(errMsg);
1812
+ return '';
1813
+ } else {
1814
+ throw new Error(errMsg);
1815
+ }
1816
+ }
1817
+ }
1818
+ }
1819
+ return out;
1820
+ }
1821
+ /**
1822
+ * Parse Inline Tokens
1823
+ */
1824
+ parseInline(tokens, renderer) {
1825
+ renderer = renderer || this.renderer;
1826
+ let out = '';
1827
+ for (let i = 0; i < tokens.length; i++) {
1828
+ const token = tokens[i];
1829
+ // Run any renderer extensions
1830
+ if (this.options.extensions && this.options.extensions.renderers && this.options.extensions.renderers[token.type]) {
1831
+ const ret = this.options.extensions.renderers[token.type].call({
1832
+ parser: this
1833
+ }, token);
1834
+ if (ret !== false || !['escape', 'html', 'link', 'image', 'strong', 'em', 'codespan', 'br', 'del', 'text'].includes(token.type)) {
1835
+ out += ret || '';
1836
+ continue;
1837
+ }
1838
+ }
1839
+ switch (token.type) {
1840
+ case 'escape':
1841
+ {
1842
+ const escapeToken = token;
1843
+ out += renderer.text(escapeToken.text);
1844
+ break;
1845
+ }
1846
+ case 'html':
1847
+ {
1848
+ const tagToken = token;
1849
+ out += renderer.html(tagToken.text);
1850
+ break;
1851
+ }
1852
+ case 'link':
1853
+ {
1854
+ const linkToken = token;
1855
+ out += renderer.link(linkToken.href, linkToken.title, this.parseInline(linkToken.tokens, renderer));
1856
+ break;
1857
+ }
1858
+ case 'image':
1859
+ {
1860
+ const imageToken = token;
1861
+ out += renderer.image(imageToken.href, imageToken.title, imageToken.text);
1862
+ break;
1863
+ }
1864
+ case 'strong':
1865
+ {
1866
+ const strongToken = token;
1867
+ out += renderer.strong(this.parseInline(strongToken.tokens, renderer));
1868
+ break;
1869
+ }
1870
+ case 'em':
1871
+ {
1872
+ const emToken = token;
1873
+ out += renderer.em(this.parseInline(emToken.tokens, renderer));
1874
+ break;
1875
+ }
1876
+ case 'codespan':
1877
+ {
1878
+ const codespanToken = token;
1879
+ out += renderer.codespan(codespanToken.text);
1880
+ break;
1881
+ }
1882
+ case 'br':
1883
+ {
1884
+ out += renderer.br();
1885
+ break;
1886
+ }
1887
+ case 'del':
1888
+ {
1889
+ const delToken = token;
1890
+ out += renderer.del(this.parseInline(delToken.tokens, renderer));
1891
+ break;
1892
+ }
1893
+ case 'text':
1894
+ {
1895
+ const textToken = token;
1896
+ out += renderer.text(textToken.text);
1897
+ break;
1898
+ }
1899
+ default:
1900
+ {
1901
+ const errMsg = 'Token with "' + token.type + '" type was not found.';
1902
+ if (this.options.silent) {
1903
+ console.error(errMsg);
1904
+ return '';
1905
+ } else {
1906
+ throw new Error(errMsg);
1907
+ }
1908
+ }
1909
+ }
1910
+ }
1911
+ return out;
1912
+ }
1913
+ }
1914
+ class _Hooks {
1915
+ constructor(options) {
1916
+ this.options = void 0;
1917
+ this.options = options || _defaults;
1918
+ }
1919
+ /**
1920
+ * Process markdown before marked
1921
+ */
1922
+ preprocess(markdown) {
1923
+ return markdown;
1924
+ }
1925
+ /**
1926
+ * Process HTML after marked is finished
1927
+ */
1928
+ postprocess(html) {
1929
+ return html;
1930
+ }
1931
+ }
1932
+ _Hooks.passThroughHooks = new Set(['preprocess', 'postprocess']);
1933
+ var _parseMarkdown = /*#__PURE__*/_classPrivateFieldLooseKey("parseMarkdown");
1934
+ var _onError = /*#__PURE__*/_classPrivateFieldLooseKey("onError");
1935
+ class Marked {
1936
+ constructor(...args) {
1937
+ Object.defineProperty(this, _onError, {
1938
+ value: _onError2
1939
+ });
1940
+ Object.defineProperty(this, _parseMarkdown, {
1941
+ value: _parseMarkdown2
1942
+ });
1943
+ this.defaults = _getDefaults();
1944
+ this.options = this.setOptions;
1945
+ this.parse = _classPrivateFieldLooseBase(this, _parseMarkdown)[_parseMarkdown](_Lexer.lex, _Parser.parse);
1946
+ this.parseInline = _classPrivateFieldLooseBase(this, _parseMarkdown)[_parseMarkdown](_Lexer.lexInline, _Parser.parseInline);
1947
+ this.Parser = _Parser;
1948
+ this.Renderer = _Renderer;
1949
+ this.TextRenderer = _TextRenderer;
1950
+ this.Lexer = _Lexer;
1951
+ this.Tokenizer = _Tokenizer;
1952
+ this.Hooks = _Hooks;
1953
+ this.use(...args);
1954
+ }
1955
+ /**
1956
+ * Run callback for every token
1957
+ */
1958
+ walkTokens(tokens, callback) {
1959
+ let values = [];
1960
+ for (const token of tokens) {
1961
+ values = values.concat(callback.call(this, token));
1962
+ switch (token.type) {
1963
+ case 'table':
1964
+ {
1965
+ const tableToken = token;
1966
+ for (const cell of tableToken.header) {
1967
+ values = values.concat(this.walkTokens(cell.tokens, callback));
1968
+ }
1969
+ for (const row of tableToken.rows) {
1970
+ for (const cell of row) {
1971
+ values = values.concat(this.walkTokens(cell.tokens, callback));
1972
+ }
1973
+ }
1974
+ break;
1975
+ }
1976
+ case 'list':
1977
+ {
1978
+ const listToken = token;
1979
+ values = values.concat(this.walkTokens(listToken.items, callback));
1980
+ break;
1981
+ }
1982
+ default:
1983
+ {
1984
+ const genericToken = token;
1985
+ if (this.defaults.extensions?.childTokens?.[genericToken.type]) {
1986
+ this.defaults.extensions.childTokens[genericToken.type].forEach(childTokens => {
1987
+ values = values.concat(this.walkTokens(genericToken[childTokens], callback));
1988
+ });
1989
+ } else if (genericToken.tokens) {
1990
+ values = values.concat(this.walkTokens(genericToken.tokens, callback));
1991
+ }
1992
+ }
1993
+ }
1994
+ }
1995
+ return values;
1996
+ }
1997
+ use(...args) {
1998
+ const extensions = this.defaults.extensions || {
1999
+ renderers: {},
2000
+ childTokens: {}
2001
+ };
2002
+ args.forEach(pack => {
2003
+ // copy options to new object
2004
+ const opts = {
2005
+ ...pack
2006
+ };
2007
+ // set async to true if it was set to true before
2008
+ opts.async = this.defaults.async || opts.async || false;
2009
+ // ==-- Parse "addon" extensions --== //
2010
+ if (pack.extensions) {
2011
+ pack.extensions.forEach(ext => {
2012
+ if (!ext.name) {
2013
+ throw new Error('extension name required');
2014
+ }
2015
+ if ('renderer' in ext) {
2016
+ // Renderer extensions
2017
+ const prevRenderer = extensions.renderers[ext.name];
2018
+ if (prevRenderer) {
2019
+ // Replace extension with func to run new extension but fall back if false
2020
+ extensions.renderers[ext.name] = function (...args) {
2021
+ let ret = ext.renderer.apply(this, args);
2022
+ if (ret === false) {
2023
+ ret = prevRenderer.apply(this, args);
2024
+ }
2025
+ return ret;
2026
+ };
2027
+ } else {
2028
+ extensions.renderers[ext.name] = ext.renderer;
2029
+ }
2030
+ }
2031
+ if ('tokenizer' in ext) {
2032
+ // Tokenizer Extensions
2033
+ if (!ext.level || ext.level !== 'block' && ext.level !== 'inline') {
2034
+ throw new Error("extension level must be 'block' or 'inline'");
2035
+ }
2036
+ const extLevel = extensions[ext.level];
2037
+ if (extLevel) {
2038
+ extLevel.unshift(ext.tokenizer);
2039
+ } else {
2040
+ extensions[ext.level] = [ext.tokenizer];
2041
+ }
2042
+ if (ext.start) {
2043
+ // Function to check for start of token
2044
+ if (ext.level === 'block') {
2045
+ if (extensions.startBlock) {
2046
+ extensions.startBlock.push(ext.start);
2047
+ } else {
2048
+ extensions.startBlock = [ext.start];
2049
+ }
2050
+ } else if (ext.level === 'inline') {
2051
+ if (extensions.startInline) {
2052
+ extensions.startInline.push(ext.start);
2053
+ } else {
2054
+ extensions.startInline = [ext.start];
2055
+ }
2056
+ }
2057
+ }
2058
+ }
2059
+ if ('childTokens' in ext && ext.childTokens) {
2060
+ // Child tokens to be visited by walkTokens
2061
+ extensions.childTokens[ext.name] = ext.childTokens;
2062
+ }
2063
+ });
2064
+ opts.extensions = extensions;
2065
+ }
2066
+ // ==-- Parse "overwrite" extensions --== //
2067
+ if (pack.renderer) {
2068
+ const renderer = this.defaults.renderer || new _Renderer(this.defaults);
2069
+ for (const prop in pack.renderer) {
2070
+ const rendererFunc = pack.renderer[prop];
2071
+ const rendererKey = prop;
2072
+ const prevRenderer = renderer[rendererKey];
2073
+ // Replace renderer with func to run extension, but fall back if false
2074
+ renderer[rendererKey] = (...args) => {
2075
+ let ret = rendererFunc.apply(renderer, args);
2076
+ if (ret === false) {
2077
+ ret = prevRenderer.apply(renderer, args);
2078
+ }
2079
+ return ret || '';
2080
+ };
2081
+ }
2082
+ opts.renderer = renderer;
2083
+ }
2084
+ if (pack.tokenizer) {
2085
+ const tokenizer = this.defaults.tokenizer || new _Tokenizer(this.defaults);
2086
+ for (const prop in pack.tokenizer) {
2087
+ const tokenizerFunc = pack.tokenizer[prop];
2088
+ const tokenizerKey = prop;
2089
+ const prevTokenizer = tokenizer[tokenizerKey];
2090
+ // Replace tokenizer with func to run extension, but fall back if false
2091
+ tokenizer[tokenizerKey] = (...args) => {
2092
+ let ret = tokenizerFunc.apply(tokenizer, args);
2093
+ if (ret === false) {
2094
+ ret = prevTokenizer.apply(tokenizer, args);
2095
+ }
2096
+ return ret;
2097
+ };
2098
+ }
2099
+ opts.tokenizer = tokenizer;
2100
+ }
2101
+ // ==-- Parse Hooks extensions --== //
2102
+ if (pack.hooks) {
2103
+ const hooks = this.defaults.hooks || new _Hooks();
2104
+ for (const prop in pack.hooks) {
2105
+ const hooksFunc = pack.hooks[prop];
2106
+ const hooksKey = prop;
2107
+ const prevHook = hooks[hooksKey];
2108
+ if (_Hooks.passThroughHooks.has(prop)) {
2109
+ hooks[hooksKey] = arg => {
2110
+ if (this.defaults.async) {
2111
+ return Promise.resolve(hooksFunc.call(hooks, arg)).then(ret => {
2112
+ return prevHook.call(hooks, ret);
2113
+ });
2114
+ }
2115
+ const ret = hooksFunc.call(hooks, arg);
2116
+ return prevHook.call(hooks, ret);
2117
+ };
2118
+ } else {
2119
+ hooks[hooksKey] = (...args) => {
2120
+ let ret = hooksFunc.apply(hooks, args);
2121
+ if (ret === false) {
2122
+ ret = prevHook.apply(hooks, args);
2123
+ }
2124
+ return ret;
2125
+ };
2126
+ }
2127
+ }
2128
+ opts.hooks = hooks;
2129
+ }
2130
+ // ==-- Parse WalkTokens extensions --== //
2131
+ if (pack.walkTokens) {
2132
+ const walkTokens = this.defaults.walkTokens;
2133
+ const packWalktokens = pack.walkTokens;
2134
+ opts.walkTokens = function (token) {
2135
+ let values = [];
2136
+ values.push(packWalktokens.call(this, token));
2137
+ if (walkTokens) {
2138
+ values = values.concat(walkTokens.call(this, token));
2139
+ }
2140
+ return values;
2141
+ };
2142
+ }
2143
+ this.defaults = {
2144
+ ...this.defaults,
2145
+ ...opts
2146
+ };
2147
+ });
2148
+ return this;
2149
+ }
2150
+ setOptions(opt) {
2151
+ this.defaults = {
2152
+ ...this.defaults,
2153
+ ...opt
2154
+ };
2155
+ return this;
2156
+ }
2157
+ lexer(src, options) {
2158
+ return _Lexer.lex(src, options ?? this.defaults);
2159
+ }
2160
+ parser(tokens, options) {
2161
+ return _Parser.parse(tokens, options ?? this.defaults);
2162
+ }
2163
+ }
2164
+ function _parseMarkdown2(lexer, parser) {
2165
+ return (src, options) => {
2166
+ const origOpt = {
2167
+ ...options
2168
+ };
2169
+ const opt = {
2170
+ ...this.defaults,
2171
+ ...origOpt
2172
+ };
2173
+ // Show warning if an extension set async to true but the parse was called with async: false
2174
+ if (this.defaults.async === true && origOpt.async === false) {
2175
+ if (!opt.silent) {
2176
+ console.warn('marked(): The async option was set to true by an extension. The async: false option sent to parse will be ignored.');
2177
+ }
2178
+ opt.async = true;
2179
+ }
2180
+ const throwError = _classPrivateFieldLooseBase(this, _onError)[_onError](!!opt.silent, !!opt.async);
2181
+ // throw error in case of non string input
2182
+ if (typeof src === 'undefined' || src === null) {
2183
+ return throwError(new Error('marked(): input parameter is undefined or null'));
2184
+ }
2185
+ if (typeof src !== 'string') {
2186
+ return throwError(new Error('marked(): input parameter is of type ' + Object.prototype.toString.call(src) + ', string expected'));
2187
+ }
2188
+ if (opt.hooks) {
2189
+ opt.hooks.options = opt;
2190
+ }
2191
+ if (opt.async) {
2192
+ return Promise.resolve(opt.hooks ? opt.hooks.preprocess(src) : src).then(src => lexer(src, opt)).then(tokens => opt.walkTokens ? Promise.all(this.walkTokens(tokens, opt.walkTokens)).then(() => tokens) : tokens).then(tokens => parser(tokens, opt)).then(html => opt.hooks ? opt.hooks.postprocess(html) : html).catch(throwError);
2193
+ }
2194
+ try {
2195
+ if (opt.hooks) {
2196
+ src = opt.hooks.preprocess(src);
2197
+ }
2198
+ const tokens = lexer(src, opt);
2199
+ if (opt.walkTokens) {
2200
+ this.walkTokens(tokens, opt.walkTokens);
2201
+ }
2202
+ let html = parser(tokens, opt);
2203
+ if (opt.hooks) {
2204
+ html = opt.hooks.postprocess(html);
2205
+ }
2206
+ return html;
2207
+ } catch (e) {
2208
+ return throwError(e);
2209
+ }
2210
+ };
2211
+ }
2212
+ function _onError2(silent, async) {
2213
+ return e => {
2214
+ e.message += '\nPlease report this to https://github.com/markedjs/marked.';
2215
+ if (silent) {
2216
+ const msg = '<p>An error occurred:</p><pre>' + escape(e.message + '', true) + '</pre>';
2217
+ if (async) {
2218
+ return Promise.resolve(msg);
2219
+ }
2220
+ return msg;
2221
+ }
2222
+ if (async) {
2223
+ return Promise.reject(e);
2224
+ }
2225
+ throw e;
2226
+ };
2227
+ }
2228
+ const markedInstance = new Marked();
2229
+ function marked(src, opt) {
2230
+ return markedInstance.parse(src, opt);
2231
+ }
2232
+ /**
2233
+ * Sets the default options.
2234
+ *
2235
+ * @param options Hash of options
2236
+ */
2237
+ marked.options = marked.setOptions = function (options) {
2238
+ markedInstance.setOptions(options);
2239
+ marked.defaults = markedInstance.defaults;
2240
+ changeDefaults(marked.defaults);
2241
+ return marked;
2242
+ };
2243
+ /**
2244
+ * Gets the original marked default options.
2245
+ */
2246
+ marked.getDefaults = _getDefaults;
2247
+ marked.defaults = _defaults;
2248
+ /**
2249
+ * Use Extension
2250
+ */
2251
+ marked.use = function (...args) {
2252
+ markedInstance.use(...args);
2253
+ marked.defaults = markedInstance.defaults;
2254
+ changeDefaults(marked.defaults);
2255
+ return marked;
2256
+ };
2257
+ /**
2258
+ * Run callback for every token
2259
+ */
2260
+ marked.walkTokens = function (tokens, callback) {
2261
+ return markedInstance.walkTokens(tokens, callback);
2262
+ };
2263
+ /**
2264
+ * Compiles markdown to HTML without enclosing `p` tag.
2265
+ *
2266
+ * @param src String of markdown source to be compiled
2267
+ * @param options Hash of options
2268
+ * @return String of compiled HTML
2269
+ */
2270
+ marked.parseInline = markedInstance.parseInline;
2271
+ /**
2272
+ * Expose
2273
+ */
2274
+ marked.Parser = _Parser;
2275
+ marked.parser = _Parser.parse;
2276
+ marked.Renderer = _Renderer;
2277
+ marked.TextRenderer = _TextRenderer;
2278
+ marked.Lexer = _Lexer;
2279
+ marked.lexer = _Lexer.lex;
2280
+ marked.Tokenizer = _Tokenizer;
2281
+ marked.Hooks = _Hooks;
2282
+ marked.parse = marked;
2283
+
2284
+ var lib;
2285
+ var hasRequiredLib;
2286
+
2287
+ function requireLib () {
2288
+ if (hasRequiredLib) return lib;
2289
+ hasRequiredLib = 1;
2290
+
2291
+ function index({
2292
+ interruptPatterns = [],
2293
+ skipEmptyRows = true
2294
+ } = {}) {
2295
+ return {
2296
+ extensions: [{
2297
+ name: 'spanTable',
2298
+ level: 'block',
2299
+ // Is this a block-level or inline-level tokenizer?
2300
+ start(src) {
2301
+ return src.match(/\n *([^\n ].*\|.*)\n/m)?.index;
2302
+ },
2303
+ // Hint to Marked.js to stop and check for a match
2304
+ tokenizer(src, tokens) {
2305
+ // const regex = this.tokenizer.rules.block.table;
2306
+ let regexString = '^ *([^\\n ].*\\|.*\\n(?: *[^\\s].*\\n)*?)' // Header
2307
+ + ' {0,3}(?:\\| *)?(:?-+(?: *(?:100|[1-9][0-9]?%) *-+)?:? *(?:\\| *:?-+(?: *(?:100|[1-9][0-9]?%) *-+)?:? *)*)(?:\\| *)?' // Align
2308
+ + '(?:\\n((?:(?! *\\n| {0,3}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})' // Cells
2309
+ + '(?:\\n+|$)| {0,3}#{1,6}(?:\\s|$)| {0,3}>| {4}[^\\n]| {0,3}(?:`{3,}' + '(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n| {0,3}(?:[*+-]|1[.)]) |' + '<\\/?(?: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)' + '(?: +|\\n|\\/?>)|<(?:script|pre|style|textarea|!--)endRegex).*(?:\\n|$))*)\\n*|$)'; // Cells
2310
+
2311
+ regexString = regexString.replace('endRegex', interruptPatterns.map(str => `|(?:${str})`).join(''));
2312
+ const widthRegex = / *(?:100|[1-9][0-9]?%) */g;
2313
+ const regex = new RegExp(regexString);
2314
+ const cap = regex.exec(src);
2315
+ if (cap) {
2316
+ const item = {
2317
+ type: 'spanTable',
2318
+ header: cap[1].replace(/\n$/, '').split('\n'),
2319
+ align: cap[2].replace(widthRegex, '').replace(/^ *|\| *$/g, '').split(/ *\| */),
2320
+ rows: cap[3]?.trim() ? cap[3].replace(/\n[ \t]*$/, '').split('\n') : [],
2321
+ width: cap[2].replace(/:/g, '').replace(/-+| /g, '').split('|')
2322
+ };
2323
+
2324
+ // Get first header row to determine how many columns
2325
+ item.header[0] = splitCells(item.header[0]);
2326
+ const colCount = item.header[0].reduce((length, header) => {
2327
+ return length + header.colspan;
2328
+ }, 0);
2329
+ if (colCount === item.align.length) {
2330
+ item.raw = cap[0];
2331
+ let i, j, k, row;
2332
+
2333
+ // Get alignment row (:---:)
2334
+ let l = item.align.length;
2335
+ for (i = 0; i < l; i++) {
2336
+ if (/^ *-+: *$/.test(item.align[i])) {
2337
+ item.align[i] = 'right';
2338
+ } else if (/^ *:-+: *$/.test(item.align[i])) {
2339
+ item.align[i] = 'center';
2340
+ } else if (/^ *:-+ *$/.test(item.align[i])) {
2341
+ item.align[i] = 'left';
2342
+ } else {
2343
+ item.align[i] = null;
2344
+ }
2345
+ }
2346
+
2347
+ // Get any remaining header rows
2348
+ l = item.header.length;
2349
+ for (i = 1; i < l; i++) {
2350
+ item.header[i] = splitCells(item.header[i], colCount, item.header[i - 1], skipEmptyRows);
2351
+ }
2352
+
2353
+ // Get main table cells
2354
+ l = item.rows.length;
2355
+ for (i = 0; i < l; i++) {
2356
+ item.rows[i] = splitCells(item.rows[i], colCount, item.rows[i - 1], skipEmptyRows);
2357
+ }
2358
+
2359
+ // header child tokens
2360
+ l = item.header.length;
2361
+ for (j = 0; j < l; j++) {
2362
+ row = item.header[j];
2363
+ for (k = 0; k < row.length; k++) {
2364
+ row[k].tokens = [];
2365
+ this.lexer.inline(row[k].text, row[k].tokens);
2366
+ }
2367
+ }
2368
+
2369
+ // cell child tokens
2370
+ l = item.rows.length;
2371
+ for (j = 0; j < l; j++) {
2372
+ row = item.rows[j];
2373
+ for (k = 0; k < row.length; k++) {
2374
+ row[k].tokens = [];
2375
+ this.lexer.inline(row[k].text, row[k].tokens);
2376
+ }
2377
+ }
2378
+ return item;
2379
+ }
2380
+ }
2381
+ },
2382
+ renderer(token) {
2383
+ let i, j, row, cell, col, text;
2384
+ let output = '<table>';
2385
+ output += '<thead>';
2386
+ for (i = 0; i < token.header.length; i++) {
2387
+ row = token.header[i];
2388
+ let col = 0;
2389
+ output += '<tr>';
2390
+ for (j = 0; j < row.length; j++) {
2391
+ cell = row[j];
2392
+ text = this.parser.parseInline(cell.tokens);
2393
+ output += getTableCell(text, cell, 'th', token.align[col], token.width[col]);
2394
+ col += cell.colspan;
2395
+ }
2396
+ output += '</tr>';
2397
+ }
2398
+ output += '</thead>';
2399
+ if (token.rows.length) {
2400
+ output += '<tbody>';
2401
+ for (i = 0; i < token.rows.length; i++) {
2402
+ row = token.rows[i];
2403
+ col = 0;
2404
+ if (!row[0].emptyRow) {
2405
+ output += '<tr>';
2406
+ for (j = 0; j < row.length; j++) {
2407
+ cell = row[j];
2408
+ text = this.parser.parseInline(cell.tokens);
2409
+ output += getTableCell(text, cell, 'td', token.align[col], token.width[col]);
2410
+ col += cell.colspan;
2411
+ }
2412
+ output += '</tr>';
2413
+ }
2414
+ }
2415
+ output += '</tbody>';
2416
+ }
2417
+ output += '</table>';
2418
+ return output;
2419
+ }
2420
+ }]
2421
+ };
2422
+ }
2423
+ const getTableCell = (text, cell, type, align, width) => {
2424
+ if (!cell.rowspan) {
2425
+ return '';
2426
+ }
2427
+ const tag = `<${type}` + `${cell.colspan > 1 ? ` colspan=${cell.colspan}` : ''}` + `${cell.rowspan > 1 ? ` rowspan=${cell.rowspan}` : ''}` + `${align ? ` align=${align}` : ''}` + `${width ? ` width=${width}` : ''}>`;
2428
+ return `${tag + text}</${type}>\n`;
2429
+ };
2430
+ const splitCells = (tableRow, count, prevRow = [], skipEmptyRows) => {
2431
+ const cells = [...tableRow.trim().matchAll(/(?:[^|\\]|\\.?)+(?:\|+|$)/g)].map(x => x[0]);
2432
+
2433
+ // Remove first/last cell in a row if whitespace only and no leading/trailing pipe
2434
+ if (!cells[0]?.trim()) {
2435
+ cells.shift();
2436
+ }
2437
+ if (!cells[cells.length - 1]?.trim()) {
2438
+ cells.pop();
2439
+ }
2440
+ let numCols = 0;
2441
+ let i, j, trimmedCell, prevCell, prevCols;
2442
+ for (i = 0; i < cells.length; i++) {
2443
+ trimmedCell = cells[i].split(/\|+$/)[0];
2444
+ cells[i] = {
2445
+ rowspan: 1,
2446
+ colspan: Math.max(cells[i].length - trimmedCell.length, 1),
2447
+ text: trimmedCell.trim().replace(/\\\|/g, '|')
2448
+ // display escaped pipes as normal character
2449
+ };
2450
+
2451
+ // Handle Rowspan
2452
+ if (trimmedCell.slice(-1) === '^' && prevRow.length) {
2453
+ // Find matching cell in previous row
2454
+ prevCols = 0;
2455
+ for (j = 0; j < prevRow.length; j++) {
2456
+ prevCell = prevRow[j];
2457
+ if (prevCols === numCols && prevCell.colspan === cells[i].colspan) {
2458
+ // merge into matching cell in previous row (the "target")
2459
+ cells[i].rowSpanTarget = prevCell.rowSpanTarget ?? prevCell;
2460
+ cells[i].rowSpanTarget.text += ` ${cells[i].text.slice(0, -1)}`;
2461
+ cells[i].rowSpanTarget.rowspan += 1;
2462
+ cells[i].rowspan = 0;
2463
+ break;
2464
+ }
2465
+ prevCols += prevCell.colspan;
2466
+ if (prevCols > numCols) {
2467
+ break;
2468
+ }
2469
+ }
2470
+ }
2471
+ numCols += cells[i].colspan;
2472
+ }
2473
+
2474
+ // If all cells have been merged, flag as an empty row
2475
+ if (cells.length > 0 && skipEmptyRows && cells.length === cells.filter(cell => {
2476
+ return cell.rowspan === 0;
2477
+ }).length) {
2478
+ cells[0].emptyRow = true;
2479
+ for (i = 0; i < cells.length; i++) {
2480
+ cells[i].rowSpanTarget.rowspan -= 1;
2481
+ }
2482
+ }
2483
+
2484
+ // Force main cell rows to match header column count
2485
+ if (numCols > count) {
2486
+ cells.splice(count);
2487
+ } else {
2488
+ while (numCols < count) {
2489
+ cells.push({
2490
+ rowspan: 1,
2491
+ colspan: 1,
2492
+ text: ''
2493
+ });
2494
+ numCols += 1;
2495
+ }
2496
+ }
2497
+ return cells;
2498
+ };
2499
+ lib = index;
2500
+ return lib;
2501
+ }
2502
+
2503
+ var libExports = requireLib();
2504
+ var extendedTables = /*@__PURE__*/getDefaultExportFromCjs(libExports);
2505
+
2506
+ /**
2507
+ * marked 全局配置是否已初始化
2508
+ * marked 的 use/setOptions 作用于模块单例,仅需配置一次
2509
+ */
2510
+ let markedConfigured = false;
2511
+ /**
2512
+ * 初始化 marked 全局配置(GFM 表格 + 扩展表格语法 + 换行转 <br>)
2513
+ */
2514
+ function ensureMarkedConfigured() {
2515
+ if (markedConfigured) {
2516
+ return;
2517
+ }
2518
+ marked.use(extendedTables);
2519
+ marked.setOptions({
2520
+ breaks: true,
2521
+ gfm: true
2522
+ });
2523
+ markedConfigured = true;
2524
+ }
2525
+ /**
2526
+ * 为表格包裹滚动容器:
2527
+ * 移动端(<=767px)由 .md-table-wrap 提供横向滚动,表格保持自然宽度不被压缩;
2528
+ * PC 端该容器为普通块级元素,不影响现有展示与打印。
2529
+ */
2530
+ function wrapMarkdownTables(html) {
2531
+ if (!html.includes('<table')) {
2532
+ return html;
2533
+ }
2534
+ return html
2535
+ .replace(/<table(\s|>)/gi, '<div class="md-table-wrap"><table$1')
2536
+ .replace(/<\/table>/gi, '</table></div>');
2537
+ }
2538
+ /**
2539
+ * 渲染 Markdown 为 HTML(项目内统一的渲染入口)
2540
+ *
2541
+ * - 统一应用 GFM / extended-tables / breaks 配置
2542
+ * - 所有 <table> 会被包裹在 <div class="md-table-wrap"> 中,
2543
+ * 配合 global/markdown.css 实现移动端横向滚动、PC 端保持原样
2544
+ *
2545
+ * @param content Markdown 源文本
2546
+ * @returns 渲染后的 HTML 字符串,空内容返回空字符串
2547
+ */
2548
+ function renderMarkdown(content) {
2549
+ if (!content) {
2550
+ return '';
2551
+ }
2552
+ ensureMarkedConfigured();
2553
+ return wrapMarkdownTables(marked(content));
2554
+ }
2555
+
2556
+ export { renderMarkdown as r };
2557
+ //# sourceMappingURL=p-DuXrU5Qi.js.map
2558
+
2559
+ //# sourceMappingURL=p-DuXrU5Qi.js.map