@ktnpm_devops/react-component 0.19.0 → 0.21.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (420) hide show
  1. package/dist/composites/CustomRangePicker/CustomRangePicker.d.ts.map +1 -1
  2. package/dist/composites/DatePickerDropdown/DatePickerDropdown.d.ts.map +1 -1
  3. package/dist/composites/FilterDropdown/FilterDropdown.d.ts +1 -1
  4. package/dist/composites/FilterDropdown/FilterDropdown.d.ts.map +1 -1
  5. package/dist/composites/FilterDropdown/FilterDropdown.types.d.ts +7 -1
  6. package/dist/composites/FilterDropdown/FilterDropdown.types.d.ts.map +1 -1
  7. package/dist/composites/MultiSelectDropdown/MultiSelectDropdown.d.ts.map +1 -1
  8. package/dist/composites/SingleSelectDropdown/SingleSelectDropdown.d.ts.map +1 -1
  9. package/dist/hooks/usePanelPlacement.d.ts +12 -20
  10. package/dist/hooks/usePanelPlacement.d.ts.map +1 -1
  11. package/dist/index10.cjs +1 -1
  12. package/dist/index10.js +1 -1
  13. package/dist/index100.cjs +10 -27
  14. package/dist/index100.cjs.map +1 -1
  15. package/dist/index100.js +9 -26
  16. package/dist/index100.js.map +1 -1
  17. package/dist/index101.cjs +70 -48
  18. package/dist/index101.cjs.map +1 -1
  19. package/dist/index101.js +69 -47
  20. package/dist/index101.js.map +1 -1
  21. package/dist/index102.cjs +19 -18
  22. package/dist/index102.cjs.map +1 -1
  23. package/dist/index102.js +18 -17
  24. package/dist/index102.js.map +1 -1
  25. package/dist/index103.cjs +22 -31
  26. package/dist/index103.cjs.map +1 -1
  27. package/dist/index103.js +22 -31
  28. package/dist/index103.js.map +1 -1
  29. package/dist/index104.cjs +15 -3
  30. package/dist/index104.cjs.map +1 -1
  31. package/dist/index104.js +15 -3
  32. package/dist/index104.js.map +1 -1
  33. package/dist/index105.cjs +13 -16
  34. package/dist/index105.cjs.map +1 -1
  35. package/dist/index105.js +13 -16
  36. package/dist/index105.js.map +1 -1
  37. package/dist/index106.cjs +2 -17
  38. package/dist/index106.cjs.map +1 -1
  39. package/dist/index106.js +3 -18
  40. package/dist/index106.js.map +1 -1
  41. package/dist/index107.cjs +20 -2
  42. package/dist/index107.cjs.map +1 -1
  43. package/dist/index107.js +20 -2
  44. package/dist/index107.js.map +1 -1
  45. package/dist/index108.cjs +16 -13
  46. package/dist/index108.cjs.map +1 -1
  47. package/dist/index108.js +16 -13
  48. package/dist/index108.js.map +1 -1
  49. package/dist/index109.cjs +2 -14
  50. package/dist/index109.cjs.map +1 -1
  51. package/dist/index109.js +3 -15
  52. package/dist/index109.js.map +1 -1
  53. package/dist/index11.cjs +1 -1
  54. package/dist/index11.js +1 -1
  55. package/dist/index110.cjs +21 -30
  56. package/dist/index110.cjs.map +1 -1
  57. package/dist/index110.js +21 -30
  58. package/dist/index110.js.map +1 -1
  59. package/dist/index111.cjs +17 -6
  60. package/dist/index111.cjs.map +1 -1
  61. package/dist/index111.js +16 -5
  62. package/dist/index111.js.map +1 -1
  63. package/dist/index112.cjs +2 -53
  64. package/dist/index112.cjs.map +1 -1
  65. package/dist/index112.js +3 -54
  66. package/dist/index112.js.map +1 -1
  67. package/dist/index113.cjs +15 -22
  68. package/dist/index113.cjs.map +1 -1
  69. package/dist/index113.js +14 -21
  70. package/dist/index113.js.map +1 -1
  71. package/dist/index114.cjs +6 -69
  72. package/dist/index114.cjs.map +1 -1
  73. package/dist/index114.js +5 -68
  74. package/dist/index114.js.map +1 -1
  75. package/dist/index115.cjs +39 -7
  76. package/dist/index115.cjs.map +1 -1
  77. package/dist/index115.js +38 -6
  78. package/dist/index115.js.map +1 -1
  79. package/dist/index116.cjs +16 -34
  80. package/dist/index116.cjs.map +1 -1
  81. package/dist/index116.js +16 -34
  82. package/dist/index116.js.map +1 -1
  83. package/dist/index117.cjs +21 -35
  84. package/dist/index117.cjs.map +1 -1
  85. package/dist/index117.js +20 -34
  86. package/dist/index117.js.map +1 -1
  87. package/dist/index118.cjs +21 -43
  88. package/dist/index118.cjs.map +1 -1
  89. package/dist/index118.js +20 -42
  90. package/dist/index118.js.map +1 -1
  91. package/dist/index119.cjs +18 -24
  92. package/dist/index119.cjs.map +1 -1
  93. package/dist/index119.js +17 -23
  94. package/dist/index119.js.map +1 -1
  95. package/dist/index12.cjs +1 -1
  96. package/dist/index12.js +1 -1
  97. package/dist/index120.cjs +39 -39
  98. package/dist/index120.cjs.map +1 -1
  99. package/dist/index120.js +38 -38
  100. package/dist/index120.js.map +1 -1
  101. package/dist/index121.cjs +55 -9
  102. package/dist/index121.cjs.map +1 -1
  103. package/dist/index121.js +54 -8
  104. package/dist/index121.js.map +1 -1
  105. package/dist/index122.cjs +47 -10
  106. package/dist/index122.cjs.map +1 -1
  107. package/dist/index122.js +47 -10
  108. package/dist/index122.js.map +1 -1
  109. package/dist/index123.cjs +17 -19
  110. package/dist/index123.cjs.map +1 -1
  111. package/dist/index123.js +17 -19
  112. package/dist/index123.js.map +1 -1
  113. package/dist/index124.cjs +37 -14
  114. package/dist/index124.cjs.map +1 -1
  115. package/dist/index124.js +36 -13
  116. package/dist/index124.js.map +1 -1
  117. package/dist/index125.cjs +33 -10
  118. package/dist/index125.cjs.map +1 -1
  119. package/dist/index125.js +32 -9
  120. package/dist/index125.js.map +1 -1
  121. package/dist/index126.cjs +2 -65
  122. package/dist/index126.cjs.map +1 -1
  123. package/dist/index126.js +3 -66
  124. package/dist/index126.js.map +1 -1
  125. package/dist/index127.cjs +46 -19
  126. package/dist/index127.cjs.map +1 -1
  127. package/dist/index127.js +46 -19
  128. package/dist/index127.js.map +1 -1
  129. package/dist/index128.cjs +10 -22
  130. package/dist/index128.cjs.map +1 -1
  131. package/dist/index128.js +11 -23
  132. package/dist/index128.js.map +1 -1
  133. package/dist/index129.cjs +43 -9
  134. package/dist/index129.cjs.map +1 -1
  135. package/dist/index129.js +43 -9
  136. package/dist/index129.js.map +1 -1
  137. package/dist/index13.cjs +1 -1
  138. package/dist/index13.js +1 -1
  139. package/dist/index130.cjs +70 -1158
  140. package/dist/index130.cjs.map +1 -1
  141. package/dist/index130.js +70 -1159
  142. package/dist/index130.js.map +1 -1
  143. package/dist/index131.cjs +1063 -1475
  144. package/dist/index131.cjs.map +1 -1
  145. package/dist/index131.js +1063 -1475
  146. package/dist/index131.js.map +1 -1
  147. package/dist/index132.cjs +1572 -31
  148. package/dist/index132.cjs.map +1 -1
  149. package/dist/index132.js +1572 -30
  150. package/dist/index132.js.map +1 -1
  151. package/dist/index133.cjs +37 -0
  152. package/dist/index133.cjs.map +1 -0
  153. package/dist/index133.js +37 -0
  154. package/dist/index133.js.map +1 -0
  155. package/dist/index14.cjs +1 -1
  156. package/dist/index14.js +1 -1
  157. package/dist/index15.cjs +1 -1
  158. package/dist/index15.js +1 -1
  159. package/dist/index16.cjs +1 -1
  160. package/dist/index16.js +1 -1
  161. package/dist/index17.cjs +1 -1
  162. package/dist/index17.js +1 -1
  163. package/dist/index18.cjs +1 -1
  164. package/dist/index18.js +1 -1
  165. package/dist/index19.cjs +1 -1
  166. package/dist/index19.js +1 -1
  167. package/dist/index20.cjs +1 -1
  168. package/dist/index20.js +1 -1
  169. package/dist/index21.cjs +1 -1
  170. package/dist/index21.js +1 -1
  171. package/dist/index22.cjs +1 -1
  172. package/dist/index22.js +1 -1
  173. package/dist/index23.cjs +1 -1
  174. package/dist/index23.js +1 -1
  175. package/dist/index24.cjs +1 -1
  176. package/dist/index24.js +1 -1
  177. package/dist/index25.cjs +4 -3
  178. package/dist/index25.cjs.map +1 -1
  179. package/dist/index25.js +4 -3
  180. package/dist/index25.js.map +1 -1
  181. package/dist/index26.cjs +1 -1
  182. package/dist/index26.js +1 -1
  183. package/dist/index27.cjs +4 -3
  184. package/dist/index27.cjs.map +1 -1
  185. package/dist/index27.js +4 -3
  186. package/dist/index27.js.map +1 -1
  187. package/dist/index28.cjs +1 -1
  188. package/dist/index28.js +1 -1
  189. package/dist/index29.cjs +8 -6
  190. package/dist/index29.cjs.map +1 -1
  191. package/dist/index29.js +8 -6
  192. package/dist/index29.js.map +1 -1
  193. package/dist/index30.cjs +10 -10
  194. package/dist/index30.js +10 -10
  195. package/dist/index31.cjs +4 -4
  196. package/dist/index31.js +4 -4
  197. package/dist/index32.cjs +3 -3
  198. package/dist/index32.js +3 -3
  199. package/dist/index33.cjs +1 -1
  200. package/dist/index33.js +1 -1
  201. package/dist/index34.cjs +1 -1
  202. package/dist/index34.js +1 -1
  203. package/dist/index35.cjs +1 -1
  204. package/dist/index35.js +1 -1
  205. package/dist/index36.cjs +2 -2
  206. package/dist/index36.js +2 -2
  207. package/dist/index37.cjs +1 -1
  208. package/dist/index37.js +1 -1
  209. package/dist/index38.cjs +4 -3
  210. package/dist/index38.cjs.map +1 -1
  211. package/dist/index38.js +4 -3
  212. package/dist/index38.js.map +1 -1
  213. package/dist/index39.cjs +1 -1
  214. package/dist/index39.js +1 -1
  215. package/dist/index40.cjs +1 -1
  216. package/dist/index40.js +1 -1
  217. package/dist/index41.cjs +1 -1
  218. package/dist/index41.js +1 -1
  219. package/dist/index42.cjs +1 -1
  220. package/dist/index42.js +1 -1
  221. package/dist/index43.cjs +1 -1
  222. package/dist/index43.js +1 -1
  223. package/dist/index44.cjs +1 -1
  224. package/dist/index44.js +1 -1
  225. package/dist/index45.cjs +3 -3
  226. package/dist/index45.js +3 -3
  227. package/dist/index46.cjs +1 -1
  228. package/dist/index46.js +1 -1
  229. package/dist/index47.cjs +1 -1
  230. package/dist/index47.js +1 -1
  231. package/dist/index48.cjs +1 -1
  232. package/dist/index48.js +1 -1
  233. package/dist/index49.cjs +1 -1
  234. package/dist/index49.js +1 -1
  235. package/dist/index50.cjs +4 -3
  236. package/dist/index50.cjs.map +1 -1
  237. package/dist/index50.js +4 -3
  238. package/dist/index50.js.map +1 -1
  239. package/dist/index51.cjs +1 -1
  240. package/dist/index51.js +1 -1
  241. package/dist/index52.cjs +2 -2
  242. package/dist/index52.js +2 -2
  243. package/dist/index53.cjs +1 -1
  244. package/dist/index53.js +1 -1
  245. package/dist/index54.cjs +1 -1
  246. package/dist/index54.js +1 -1
  247. package/dist/index55.cjs +2 -2
  248. package/dist/index55.js +2 -2
  249. package/dist/index56.cjs +1 -1
  250. package/dist/index56.js +1 -1
  251. package/dist/index57.cjs +1 -1
  252. package/dist/index57.js +1 -1
  253. package/dist/index58.cjs +1 -1
  254. package/dist/index58.js +1 -1
  255. package/dist/index60.cjs +19 -64
  256. package/dist/index60.cjs.map +1 -1
  257. package/dist/index60.js +19 -64
  258. package/dist/index60.js.map +1 -1
  259. package/dist/index61.cjs +22 -10
  260. package/dist/index61.cjs.map +1 -1
  261. package/dist/index61.js +23 -11
  262. package/dist/index61.js.map +1 -1
  263. package/dist/index63.cjs +16 -34
  264. package/dist/index63.cjs.map +1 -1
  265. package/dist/index63.js +17 -35
  266. package/dist/index63.js.map +1 -1
  267. package/dist/index64.cjs +19 -16
  268. package/dist/index64.cjs.map +1 -1
  269. package/dist/index64.js +19 -16
  270. package/dist/index64.js.map +1 -1
  271. package/dist/index65.cjs +16 -10
  272. package/dist/index65.cjs.map +1 -1
  273. package/dist/index65.js +17 -11
  274. package/dist/index65.js.map +1 -1
  275. package/dist/index66.cjs +19 -16
  276. package/dist/index66.cjs.map +1 -1
  277. package/dist/index66.js +20 -17
  278. package/dist/index66.js.map +1 -1
  279. package/dist/index67.cjs +10 -19
  280. package/dist/index67.cjs.map +1 -1
  281. package/dist/index67.js +11 -20
  282. package/dist/index67.js.map +1 -1
  283. package/dist/index68.cjs +66 -36
  284. package/dist/index68.cjs.map +1 -1
  285. package/dist/index68.js +66 -36
  286. package/dist/index68.js.map +1 -1
  287. package/dist/index69.cjs +2 -38
  288. package/dist/index69.cjs.map +1 -1
  289. package/dist/index69.js +3 -39
  290. package/dist/index69.js.map +1 -1
  291. package/dist/index70.cjs +73 -54
  292. package/dist/index70.cjs.map +1 -1
  293. package/dist/index70.js +72 -53
  294. package/dist/index70.js.map +1 -1
  295. package/dist/index71.cjs +52 -19
  296. package/dist/index71.cjs.map +1 -1
  297. package/dist/index71.js +52 -19
  298. package/dist/index71.js.map +1 -1
  299. package/dist/index72.cjs +80 -2
  300. package/dist/index72.cjs.map +1 -1
  301. package/dist/index72.js +81 -3
  302. package/dist/index72.js.map +1 -1
  303. package/dist/index73.cjs +14 -5
  304. package/dist/index73.cjs.map +1 -1
  305. package/dist/index73.js +14 -5
  306. package/dist/index73.js.map +1 -1
  307. package/dist/index74.cjs +34 -16
  308. package/dist/index74.cjs.map +1 -1
  309. package/dist/index74.js +35 -17
  310. package/dist/index74.js.map +1 -1
  311. package/dist/index75.cjs +30 -12
  312. package/dist/index75.cjs.map +1 -1
  313. package/dist/index75.js +30 -12
  314. package/dist/index75.js.map +1 -1
  315. package/dist/index76.cjs +9 -46
  316. package/dist/index76.cjs.map +1 -1
  317. package/dist/index76.js +8 -45
  318. package/dist/index76.js.map +1 -1
  319. package/dist/index77.cjs +4 -46
  320. package/dist/index77.cjs.map +1 -1
  321. package/dist/index77.js +5 -47
  322. package/dist/index77.js.map +1 -1
  323. package/dist/index78.cjs +29 -2
  324. package/dist/index78.cjs.map +1 -1
  325. package/dist/index78.js +30 -3
  326. package/dist/index78.js.map +1 -1
  327. package/dist/index79.cjs +42 -17
  328. package/dist/index79.cjs.map +1 -1
  329. package/dist/index79.js +41 -16
  330. package/dist/index79.js.map +1 -1
  331. package/dist/index80.cjs +134 -7
  332. package/dist/index80.cjs.map +1 -1
  333. package/dist/index80.js +133 -6
  334. package/dist/index80.js.map +1 -1
  335. package/dist/index81.cjs +40 -19
  336. package/dist/index81.cjs.map +1 -1
  337. package/dist/index81.js +41 -20
  338. package/dist/index81.js.map +1 -1
  339. package/dist/index82.cjs +50 -32
  340. package/dist/index82.cjs.map +1 -1
  341. package/dist/index82.js +50 -32
  342. package/dist/index82.js.map +1 -1
  343. package/dist/index83.cjs +39 -18
  344. package/dist/index83.cjs.map +1 -1
  345. package/dist/index83.js +38 -17
  346. package/dist/index83.js.map +1 -1
  347. package/dist/index84.cjs +92 -57
  348. package/dist/index84.cjs.map +1 -1
  349. package/dist/index84.js +91 -56
  350. package/dist/index84.js.map +1 -1
  351. package/dist/index85.cjs +40 -134
  352. package/dist/index85.cjs.map +1 -1
  353. package/dist/index85.js +39 -133
  354. package/dist/index85.js.map +1 -1
  355. package/dist/index86.cjs +116 -46
  356. package/dist/index86.cjs.map +1 -1
  357. package/dist/index86.js +115 -45
  358. package/dist/index86.js.map +1 -1
  359. package/dist/index87.cjs +35 -77
  360. package/dist/index87.cjs.map +1 -1
  361. package/dist/index87.js +35 -77
  362. package/dist/index87.js.map +1 -1
  363. package/dist/index88.cjs +22 -18
  364. package/dist/index88.cjs.map +1 -1
  365. package/dist/index88.js +21 -17
  366. package/dist/index88.js.map +1 -1
  367. package/dist/index89.cjs +69 -33
  368. package/dist/index89.cjs.map +1 -1
  369. package/dist/index89.js +68 -32
  370. package/dist/index89.js.map +1 -1
  371. package/dist/index90.cjs +7 -24
  372. package/dist/index90.cjs.map +1 -1
  373. package/dist/index90.js +6 -23
  374. package/dist/index90.js.map +1 -1
  375. package/dist/index91.cjs +34 -13
  376. package/dist/index91.cjs.map +1 -1
  377. package/dist/index91.js +35 -14
  378. package/dist/index91.js.map +1 -1
  379. package/dist/index92.cjs +35 -33
  380. package/dist/index92.cjs.map +1 -1
  381. package/dist/index92.js +34 -32
  382. package/dist/index92.js.map +1 -1
  383. package/dist/index93.cjs +43 -21
  384. package/dist/index93.cjs.map +1 -1
  385. package/dist/index93.js +42 -20
  386. package/dist/index93.js.map +1 -1
  387. package/dist/index94.cjs +22 -113
  388. package/dist/index94.cjs.map +1 -1
  389. package/dist/index94.js +23 -114
  390. package/dist/index94.js.map +1 -1
  391. package/dist/index95.cjs +39 -42
  392. package/dist/index95.cjs.map +1 -1
  393. package/dist/index95.js +38 -41
  394. package/dist/index95.js.map +1 -1
  395. package/dist/index96.cjs +8 -39
  396. package/dist/index96.cjs.map +1 -1
  397. package/dist/index96.js +8 -39
  398. package/dist/index96.js.map +1 -1
  399. package/dist/index97.cjs +10 -92
  400. package/dist/index97.cjs.map +1 -1
  401. package/dist/index97.js +10 -92
  402. package/dist/index97.js.map +1 -1
  403. package/dist/index98.cjs +20 -40
  404. package/dist/index98.cjs.map +1 -1
  405. package/dist/index98.js +19 -39
  406. package/dist/index98.js.map +1 -1
  407. package/dist/index99.cjs +14 -10
  408. package/dist/index99.cjs.map +1 -1
  409. package/dist/index99.js +13 -9
  410. package/dist/index99.js.map +1 -1
  411. package/dist/style.css +55 -0
  412. package/dist/utils/clippingRect.d.ts +11 -11
  413. package/dist/utils/clippingRect.d.ts.map +1 -1
  414. package/dist/utils/panelPlacement.d.ts +34 -0
  415. package/dist/utils/panelPlacement.d.ts.map +1 -0
  416. package/dist/utils/panelPlacement.test.d.ts +2 -0
  417. package/dist/utils/panelPlacement.test.d.ts.map +1 -0
  418. package/dist/utils/panelPlacement.types.d.ts +57 -0
  419. package/dist/utils/panelPlacement.types.d.ts.map +1 -0
  420. package/package.json +1 -1
package/dist/index131.js CHANGED
@@ -1,1579 +1,1167 @@
1
- /*! @license DOMPurify 3.4.14 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.4.14/LICENSE */
2
- function _arrayLikeToArray(r, a) {
3
- (null == a || a > r.length) && (a = r.length);
4
- for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];
5
- return n;
1
+ var __defProp = Object.defineProperty;
2
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
3
+ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
4
+ var _a;
5
+ function M() {
6
+ return { async: false, breaks: false, extensions: null, gfm: true, hooks: null, pedantic: false, renderer: null, silent: false, tokenizer: null, walkTokens: null };
6
7
  }
7
- function _arrayWithHoles(r) {
8
- if (Array.isArray(r)) return r;
8
+ var O = M();
9
+ function G(u3) {
10
+ O = u3;
9
11
  }
10
- function _iterableToArrayLimit(r, l) {
11
- var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
12
- if (null != t) {
13
- var e, n, i, u, a = [], f = true, o = false;
14
- try {
15
- if (i = (t = t.call(r)).next, 0 === l) ;
16
- else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = true) ;
17
- } catch (r2) {
18
- o = true, n = r2;
19
- } finally {
20
- try {
21
- if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return;
22
- } finally {
23
- if (o) throw n;
24
- }
25
- }
26
- return a;
12
+ var _ = { exec: () => null };
13
+ function k(u3, e = "") {
14
+ let t = typeof u3 == "string" ? u3 : u3.source, n = { replace: (r, i) => {
15
+ let s = typeof i == "string" ? i : i.source;
16
+ return s = s.replace(m.caret, "$1"), t = t.replace(r, s), n;
17
+ }, getRegex: () => new RegExp(t, e) };
18
+ return n;
19
+ }
20
+ var be = (() => {
21
+ try {
22
+ return !!new RegExp("(?<=1)(?<!1)");
23
+ } catch {
24
+ return false;
27
25
  }
26
+ })(), m = { codeRemoveIndent: /^(?: {1,4}| {0,3}\t)/gm, outputLinkReplace: /\\([\[\]])/g, indentCodeCompensation: /^(\s+)(?:```)/, beginningSpace: /^\s+/, endingHash: /#$/, startingSpaceChar: /^ /, endingSpaceChar: / $/, nonSpaceChar: /[^ ]/, newLineCharGlobal: /\n/g, tabCharGlobal: /\t/g, multipleSpaceGlobal: /\s+/g, blankLine: /^[ \t]*$/, doubleBlankLine: /\n[ \t]*\n[ \t]*$/, blockquoteStart: /^ {0,3}>/, blockquoteSetextReplace: /\n {0,3}((?:=+|-+) *)(?=\n|$)/g, blockquoteSetextReplace2: /^ {0,3}>[ \t]?/gm, listReplaceNesting: /^ {1,4}(?=( {4})*[^ ])/g, listIsTask: /^\[[ xX]\] +\S/, listReplaceTask: /^\[[ xX]\] +/, listTaskCheckbox: /\[[ xX]\]/, anyLine: /\n.*\n/, hrefBrackets: /^<(.*)>$/, tableDelimiter: /[:|]/, tableAlignChars: /^\||\| *$/g, tableRowBlankLine: /\n[ \t]*$/, tableAlignRight: /^ *-+: *$/, tableAlignCenter: /^ *:-+: *$/, tableAlignLeft: /^ *:-+ *$/, startATag: /^<a /i, endATag: /^<\/a>/i, startPreScriptTag: /^<(pre|code|kbd|script)(\s|>)/i, endPreScriptTag: /^<\/(pre|code|kbd|script)(\s|>)/i, startAngleBracket: /^</, endAngleBracket: />$/, pedanticHrefTitle: /^([^'"]*[^\s])\s+(['"])(.*)\2/, unicodeAlphaNumeric: /[\p{L}\p{N}]/u, escapeTest: /[&<>"']/, escapeReplace: /[&<>"']/g, escapeTestNoEncode: /[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/, escapeReplaceNoEncode: /[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g, caret: /(^|[^\[])\^/g, percentDecode: /%25/g, findPipe: /\|/g, splitPipe: / \|/, slashPipe: /\\\|/g, carriageReturn: /\r\n|\r/g, spaceLine: /^ +$/gm, notSpaceStart: /^\S*/, endingNewline: /\n$/, listItemRegex: (u3) => new RegExp(`^( {0,3}${u3})((?:[ ][^\\n]*)?(?:\\n|$))`), nextBulletRegex: (u3) => new RegExp(`^ {0,${Math.min(3, u3 - 1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`), hrRegex: (u3) => new RegExp(`^ {0,${Math.min(3, u3 - 1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`), fencesBeginRegex: (u3) => new RegExp(`^ {0,${Math.min(3, u3 - 1)}}(?:\`\`\`|~~~)`), headingBeginRegex: (u3) => new RegExp(`^ {0,${Math.min(3, u3 - 1)}}#`), htmlBeginRegex: (u3) => new RegExp(`^ {0,${Math.min(3, u3 - 1)}}<(?:[a-z].*>|!--)`, "i"), blockquoteBeginRegex: (u3) => new RegExp(`^ {0,${Math.min(3, u3 - 1)}}>`) }, Re = /^(?:[ \t]*(?:\n|$))+/, Oe = /^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/, Te = /^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/, C = /^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/, we = /^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/, Q = / {0,3}(?:[*+-]|\d{1,9}[.)])/, se = /^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/, ie = k(se).replace(/bull/g, Q).replace(/blockCode/g, /(?: {4}| {0,3}\t)/).replace(/fences/g, / {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g, / {0,3}>/).replace(/heading/g, / {0,3}#{1,6}/).replace(/html/g, / {0,3}<[^\n>]+>\n/).replace(/\|table/g, "").getRegex(), ye = k(se).replace(/bull/g, Q).replace(/blockCode/g, /(?: {4}| {0,3}\t)/).replace(/fences/g, / {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g, / {0,3}>/).replace(/heading/g, / {0,3}#{1,6}/).replace(/html/g, / {0,3}<[^\n>]+>\n/).replace(/table/g, / {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(), j = /^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/, Pe = /^[^\n]+/, F = /(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/, Se = k(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label", F).replace("title", /(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(), $e = k(/^(bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g, Q).getRegex(), v = "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|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul", U = /<!--(?:-?>|[\s\S]*?(?:-->|$))/, _e = k("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))", "i").replace("comment", U).replace("tag", v).replace("attribute", / +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(), oe = k(j).replace("hr", C).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("|lheading", "").replace("|table", "").replace("blockquote", " {0,3}>").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list", " {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", v).getRegex(), Le = k(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph", oe).getRegex(), K = { blockquote: Le, code: Oe, def: Se, fences: Te, heading: we, hr: C, html: _e, lheading: ie, list: $e, newline: Re, paragraph: oe, table: _, text: Pe }, ne = k("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr", C).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("blockquote", " {0,3}>").replace("code", "(?: {4}| {0,3} )[^\\n]").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list", " {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", v).getRegex(), Me = { ...K, lheading: ye, table: ne, paragraph: k(j).replace("hr", C).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("|lheading", "").replace("table", ne).replace("blockquote", " {0,3}>").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list", " {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", v).getRegex() }, ze = { ...K, html: k(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment", U).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(), def: /^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/, heading: /^(#{1,6})(.*)(?:\n+|$)/, fences: _, lheading: /^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/, paragraph: k(j).replace("hr", C).replace("heading", ` *#{1,6} *[^
27
+ ]`).replace("lheading", ie).replace("|table", "").replace("blockquote", " {0,3}>").replace("|fences", "").replace("|list", "").replace("|html", "").replace("|tag", "").getRegex() }, Ee = /^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/, Ie = /^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/, ae = /^( {2,}|\\)\n(?!\s*$)/, Ae = /^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/, z = /[\p{P}\p{S}]/u, H = /[\s\p{P}\p{S}]/u, W = /[^\s\p{P}\p{S}]/u, Ce = k(/^((?![*_])punctSpace)/, "u").replace(/punctSpace/g, H).getRegex(), le = /(?!~)[\p{P}\p{S}]/u, Be = /(?!~)[\s\p{P}\p{S}]/u, De = /(?:[^\s\p{P}\p{S}]|~)/u, qe = k(/link|precode-code|html/, "g").replace("link", /\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-", be ? "(?<!`)()" : "(^^|[^`])").replace("code", /(?<b>`+)[^`]+\k<b>(?!`)/).replace("html", /<(?! )[^<>]*?>/).getRegex(), ue = /^(?:\*+(?:((?!\*)punct)|([^\s*]))?)|^_+(?:((?!_)punct)|([^\s_]))?/, ve = k(ue, "u").replace(/punct/g, z).getRegex(), He = k(ue, "u").replace(/punct/g, le).getRegex(), pe = "^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)", Ze = k(pe, "gu").replace(/notPunctSpace/g, W).replace(/punctSpace/g, H).replace(/punct/g, z).getRegex(), Ge = k(pe, "gu").replace(/notPunctSpace/g, De).replace(/punctSpace/g, Be).replace(/punct/g, le).getRegex(), Ne = k("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)", "gu").replace(/notPunctSpace/g, W).replace(/punctSpace/g, H).replace(/punct/g, z).getRegex(), Qe = k(/^~~?(?:((?!~)punct)|[^\s~])/, "u").replace(/punct/g, z).getRegex(), je = "^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)", Fe = k(je, "gu").replace(/notPunctSpace/g, W).replace(/punctSpace/g, H).replace(/punct/g, z).getRegex(), Ue = k(/\\(punct)/, "gu").replace(/punct/g, z).getRegex(), Ke = k(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme", /[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("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])?)+(?![-_])/).getRegex(), We = k(U).replace("(?:-->|$)", "-->").getRegex(), Xe = k("^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment", We).replace("attribute", /\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(), q = /(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\])|[^\[\]\\`])*?/, Je = k(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?\s*\)/).replace("label", q).replace("href", /<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title", /"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(), ce = k(/^!?\[(label)\]\[(ref)\]/).replace("label", q).replace("ref", F).getRegex(), he = k(/^!?\[(ref)\](?:\[\])?/).replace("ref", F).getRegex(), Ve = k("reflink|nolink(?!\\()", "g").replace("reflink", ce).replace("nolink", he).getRegex(), re = /[hH][tT][tT][pP][sS]?|[fF][tT][pP]/, X = { _backpedal: _, anyPunctuation: Ue, autolink: Ke, blockSkip: qe, br: ae, code: Ie, del: _, delLDelim: _, delRDelim: _, emStrongLDelim: ve, emStrongRDelimAst: Ze, emStrongRDelimUnd: Ne, escape: Ee, link: Je, nolink: he, punctuation: Ce, reflink: ce, reflinkSearch: Ve, tag: Xe, text: Ae, url: _ }, Ye = { ...X, link: k(/^!?\[(label)\]\((.*?)\)/).replace("label", q).getRegex(), reflink: k(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label", q).getRegex() }, N = { ...X, emStrongRDelimAst: Ge, emStrongLDelim: He, delLDelim: Qe, delRDelim: Fe, url: k(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol", re).replace("email", /[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(), _backpedal: /(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/, del: /^(~~?)(?=[^\s~])((?:\\[\s\S]|[^\\])*?(?:\\[\s\S]|[^\s~\\]))\1(?=[^~]|$)/, text: k(/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace("protocol", re).getRegex() }, et = { ...N, br: k(ae).replace("{2,}", "*").getRegex(), text: k(N.text).replace("\\b_", "\\b_| {2,}\\n").replace(/\{2,\}/g, "*").getRegex() }, B = { normal: K, gfm: Me, pedantic: ze }, E = { normal: X, gfm: N, breaks: et, pedantic: Ye };
28
+ var tt = { "&": "&amp;", "<": "&lt;", ">": "&gt;", '"': "&quot;", "'": "&#39;" }, ke = (u3) => tt[u3];
29
+ function T(u3, e) {
30
+ if (e) {
31
+ if (m.escapeTest.test(u3)) return u3.replace(m.escapeReplace, ke);
32
+ } else if (m.escapeTestNoEncode.test(u3)) return u3.replace(m.escapeReplaceNoEncode, ke);
33
+ return u3;
28
34
  }
29
- function _nonIterableRest() {
30
- throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
35
+ function J(u3) {
36
+ try {
37
+ u3 = encodeURI(u3).replace(m.percentDecode, "%");
38
+ } catch {
39
+ return null;
40
+ }
41
+ return u3;
31
42
  }
32
- function _slicedToArray(r, e) {
33
- return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest();
43
+ function V(u3, e) {
44
+ var _a2;
45
+ let t = u3.replace(m.findPipe, (i, s, a) => {
46
+ let o = false, l = s;
47
+ for (; --l >= 0 && a[l] === "\\"; ) o = !o;
48
+ return o ? "|" : " |";
49
+ }), n = t.split(m.splitPipe), r = 0;
50
+ if (n[0].trim() || n.shift(), n.length > 0 && !((_a2 = n.at(-1)) == null ? void 0 : _a2.trim()) && n.pop(), e) if (n.length > e) n.splice(e);
51
+ else for (; n.length < e; ) n.push("");
52
+ for (; r < n.length; r++) n[r] = n[r].trim().replace(m.slashPipe, "|");
53
+ return n;
34
54
  }
35
- function _unsupportedIterableToArray(r, a) {
36
- if (r) {
37
- if ("string" == typeof r) return _arrayLikeToArray(r, a);
38
- var t = {}.toString.call(r).slice(8, -1);
39
- return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0;
55
+ function I(u3, e, t) {
56
+ let n = u3.length;
57
+ if (n === 0) return "";
58
+ let r = 0;
59
+ for (; r < n; ) {
60
+ let i = u3.charAt(n - r - 1);
61
+ if (i === e && true) r++;
62
+ else break;
40
63
  }
64
+ return u3.slice(0, n - r);
41
65
  }
42
- const entries = Object.entries, setPrototypeOf = Object.setPrototypeOf, isFrozen = Object.isFrozen, getPrototypeOf = Object.getPrototypeOf, getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
43
- let freeze = Object.freeze, seal = Object.seal, create = Object.create;
44
- let _ref = typeof Reflect !== "undefined" && Reflect, apply = _ref.apply, construct = _ref.construct;
45
- if (!freeze) {
46
- freeze = function freeze2(x) {
47
- return x;
48
- };
66
+ function de(u3, e) {
67
+ if (u3.indexOf(e[1]) === -1) return -1;
68
+ let t = 0;
69
+ for (let n = 0; n < u3.length; n++) if (u3[n] === "\\") n++;
70
+ else if (u3[n] === e[0]) t++;
71
+ else if (u3[n] === e[1] && (t--, t < 0)) return n;
72
+ return t > 0 ? -2 : -1;
49
73
  }
50
- if (!seal) {
51
- seal = function seal2(x) {
52
- return x;
53
- };
74
+ function ge(u3, e = 0) {
75
+ let t = e, n = "";
76
+ for (let r of u3) if (r === " ") {
77
+ let i = 4 - t % 4;
78
+ n += " ".repeat(i), t += i;
79
+ } else n += r, t++;
80
+ return n;
54
81
  }
55
- if (!apply) {
56
- apply = function apply2(func, thisArg) {
57
- for (var _len = arguments.length, args = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
58
- args[_key - 2] = arguments[_key];
59
- }
60
- return func.apply(thisArg, args);
61
- };
82
+ function fe(u3, e, t, n, r) {
83
+ let i = e.href, s = e.title || null, a = u3[1].replace(r.other.outputLinkReplace, "$1");
84
+ n.state.inLink = true;
85
+ let o = { type: u3[0].charAt(0) === "!" ? "image" : "link", raw: t, href: i, title: s, text: a, tokens: n.inlineTokens(a) };
86
+ return n.state.inLink = false, o;
62
87
  }
63
- if (!construct) {
64
- construct = function construct2(Func) {
65
- for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
66
- args[_key2 - 1] = arguments[_key2];
67
- }
68
- return new Func(...args);
69
- };
88
+ function nt(u3, e, t) {
89
+ let n = u3.match(t.other.indentCodeCompensation);
90
+ if (n === null) return e;
91
+ let r = n[1];
92
+ return e.split(`
93
+ `).map((i) => {
94
+ let s = i.match(t.other.beginningSpace);
95
+ if (s === null) return i;
96
+ let [a] = s;
97
+ return a.length >= r.length ? i.slice(r.length) : i;
98
+ }).join(`
99
+ `);
70
100
  }
71
- const arrayForEach = unapply(Array.prototype.forEach);
72
- const arrayLastIndexOf = unapply(Array.prototype.lastIndexOf);
73
- const arrayPop = unapply(Array.prototype.pop);
74
- const arrayPush = unapply(Array.prototype.push);
75
- const arraySplice = unapply(Array.prototype.splice);
76
- const arrayIsArray = Array.isArray;
77
- const stringToLowerCase = unapply(String.prototype.toLowerCase);
78
- const stringToString = unapply(String.prototype.toString);
79
- const stringMatch = unapply(String.prototype.match);
80
- const stringReplace = unapply(String.prototype.replace);
81
- const stringIndexOf = unapply(String.prototype.indexOf);
82
- const stringTrim = unapply(String.prototype.trim);
83
- const numberToString = unapply(Number.prototype.toString);
84
- const booleanToString = unapply(Boolean.prototype.toString);
85
- const bigintToString = typeof BigInt === "undefined" ? null : unapply(BigInt.prototype.toString);
86
- const symbolToString = typeof Symbol === "undefined" ? null : unapply(Symbol.prototype.toString);
87
- const objectHasOwnProperty = unapply(Object.prototype.hasOwnProperty);
88
- const objectToString = unapply(Object.prototype.toString);
89
- const regExpTest = unapply(RegExp.prototype.test);
90
- const typeErrorCreate = unconstruct(TypeError);
91
- function unapply(func) {
92
- return function(thisArg) {
93
- if (thisArg instanceof RegExp) {
94
- thisArg.lastIndex = 0;
95
- }
96
- for (var _len3 = arguments.length, args = new Array(_len3 > 1 ? _len3 - 1 : 0), _key3 = 1; _key3 < _len3; _key3++) {
97
- args[_key3 - 1] = arguments[_key3];
101
+ var w = class {
102
+ constructor(e) {
103
+ __publicField(this, "options");
104
+ __publicField(this, "rules");
105
+ __publicField(this, "lexer");
106
+ this.options = e || O;
107
+ }
108
+ space(e) {
109
+ let t = this.rules.block.newline.exec(e);
110
+ if (t && t[0].length > 0) return { type: "space", raw: t[0] };
111
+ }
112
+ code(e) {
113
+ let t = this.rules.block.code.exec(e);
114
+ if (t) {
115
+ let n = t[0].replace(this.rules.other.codeRemoveIndent, "");
116
+ return { type: "code", raw: t[0], codeBlockStyle: "indented", text: this.options.pedantic ? n : I(n, `
117
+ `) };
98
118
  }
99
- return apply(func, thisArg, args);
100
- };
101
- }
102
- function unconstruct(Func) {
103
- return function() {
104
- for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
105
- args[_key4] = arguments[_key4];
119
+ }
120
+ fences(e) {
121
+ let t = this.rules.block.fences.exec(e);
122
+ if (t) {
123
+ let n = t[0], r = nt(n, t[3] || "", this.rules);
124
+ return { type: "code", raw: n, lang: t[2] ? t[2].trim().replace(this.rules.inline.anyPunctuation, "$1") : t[2], text: r };
106
125
  }
107
- return construct(Func, args);
108
- };
109
- }
110
- function addToSet(set, array) {
111
- let transformCaseFunc = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : stringToLowerCase;
112
- if (setPrototypeOf) {
113
- setPrototypeOf(set, null);
114
- }
115
- if (!arrayIsArray(array)) {
116
- return set;
117
- }
118
- let l = array.length;
119
- while (l--) {
120
- let element = array[l];
121
- if (typeof element === "string") {
122
- const lcElement = transformCaseFunc(element);
123
- if (lcElement !== element) {
124
- if (!isFrozen(array)) {
125
- array[l] = lcElement;
126
- }
127
- element = lcElement;
126
+ }
127
+ heading(e) {
128
+ let t = this.rules.block.heading.exec(e);
129
+ if (t) {
130
+ let n = t[2].trim();
131
+ if (this.rules.other.endingHash.test(n)) {
132
+ let r = I(n, "#");
133
+ (this.options.pedantic || !r || this.rules.other.endingSpaceChar.test(r)) && (n = r.trim());
128
134
  }
135
+ return { type: "heading", raw: t[0], depth: t[1].length, text: n, tokens: this.lexer.inline(n) };
129
136
  }
130
- set[element] = true;
131
137
  }
132
- return set;
133
- }
134
- function cleanArray(array) {
135
- for (let index = 0; index < array.length; index++) {
136
- const isPropertyExist = objectHasOwnProperty(array, index);
137
- if (!isPropertyExist) {
138
- array[index] = null;
139
- }
138
+ hr(e) {
139
+ let t = this.rules.block.hr.exec(e);
140
+ if (t) return { type: "hr", raw: I(t[0], `
141
+ `) };
140
142
  }
141
- return array;
142
- }
143
- function clone(object) {
144
- const newObject = create(null);
145
- for (const _ref2 of entries(object)) {
146
- var _ref3 = _slicedToArray(_ref2, 2);
147
- const property = _ref3[0];
148
- const value = _ref3[1];
149
- const isPropertyExist = objectHasOwnProperty(object, property);
150
- if (isPropertyExist) {
151
- if (arrayIsArray(value)) {
152
- newObject[property] = cleanArray(value);
153
- } else if (value && typeof value === "object" && value.constructor === Object) {
154
- newObject[property] = clone(value);
155
- } else {
156
- newObject[property] = value;
143
+ blockquote(e) {
144
+ let t = this.rules.block.blockquote.exec(e);
145
+ if (t) {
146
+ let n = I(t[0], `
147
+ `).split(`
148
+ `), r = "", i = "", s = [];
149
+ for (; n.length > 0; ) {
150
+ let a = false, o = [], l;
151
+ for (l = 0; l < n.length; l++) if (this.rules.other.blockquoteStart.test(n[l])) o.push(n[l]), a = true;
152
+ else if (!a) o.push(n[l]);
153
+ else break;
154
+ n = n.slice(l);
155
+ let p = o.join(`
156
+ `), c = p.replace(this.rules.other.blockquoteSetextReplace, `
157
+ $1`).replace(this.rules.other.blockquoteSetextReplace2, "");
158
+ r = r ? `${r}
159
+ ${p}` : p, i = i ? `${i}
160
+ ${c}` : c;
161
+ let d = this.lexer.state.top;
162
+ if (this.lexer.state.top = true, this.lexer.blockTokens(c, s, true), this.lexer.state.top = d, n.length === 0) break;
163
+ let h = s.at(-1);
164
+ if ((h == null ? void 0 : h.type) === "code") break;
165
+ if ((h == null ? void 0 : h.type) === "blockquote") {
166
+ let R = h, f = R.raw + `
167
+ ` + n.join(`
168
+ `), S = this.blockquote(f);
169
+ s[s.length - 1] = S, r = r.substring(0, r.length - R.raw.length) + S.raw, i = i.substring(0, i.length - R.text.length) + S.text;
170
+ break;
171
+ } else if ((h == null ? void 0 : h.type) === "list") {
172
+ let R = h, f = R.raw + `
173
+ ` + n.join(`
174
+ `), S = this.list(f);
175
+ s[s.length - 1] = S, r = r.substring(0, r.length - h.raw.length) + S.raw, i = i.substring(0, i.length - R.raw.length) + S.raw, n = f.substring(s.at(-1).raw.length).split(`
176
+ `);
177
+ continue;
178
+ }
157
179
  }
180
+ return { type: "blockquote", raw: r, tokens: s, text: i };
158
181
  }
159
182
  }
160
- return newObject;
161
- }
162
- function stringifyValue(value) {
163
- switch (typeof value) {
164
- case "string": {
165
- return value;
166
- }
167
- case "number": {
168
- return numberToString(value);
169
- }
170
- case "boolean": {
171
- return booleanToString(value);
172
- }
173
- case "bigint": {
174
- return bigintToString ? bigintToString(value) : "0";
175
- }
176
- case "symbol": {
177
- return symbolToString ? symbolToString(value) : "Symbol()";
178
- }
179
- case "undefined": {
180
- return objectToString(value);
181
- }
182
- case "function":
183
- case "object": {
184
- if (value === null) {
185
- return objectToString(value);
183
+ list(e) {
184
+ var _a2, _b;
185
+ let t = this.rules.block.list.exec(e);
186
+ if (t) {
187
+ let n = t[1].trim(), r = n.length > 1, i = { type: "list", raw: "", ordered: r, start: r ? +n.slice(0, -1) : "", loose: false, items: [] };
188
+ n = r ? `\\d{1,9}\\${n.slice(-1)}` : `\\${n}`, this.options.pedantic && (n = r ? n : "[*+-]");
189
+ let s = this.rules.other.listItemRegex(n), a = false;
190
+ for (; e; ) {
191
+ let l = false, p = "", c = "";
192
+ if (!(t = s.exec(e)) || this.rules.block.hr.test(e)) break;
193
+ p = t[0], e = e.substring(p.length);
194
+ let d = ge(t[2].split(`
195
+ `, 1)[0], t[1].length), h = e.split(`
196
+ `, 1)[0], R = !d.trim(), f = 0;
197
+ if (this.options.pedantic ? (f = 2, c = d.trimStart()) : R ? f = t[1].length + 1 : (f = d.search(this.rules.other.nonSpaceChar), f = f > 4 ? 1 : f, c = d.slice(f), f += t[1].length), R && this.rules.other.blankLine.test(h) && (p += h + `
198
+ `, e = e.substring(h.length + 1), l = true), !l) {
199
+ let S = this.rules.other.nextBulletRegex(f), Y = this.rules.other.hrRegex(f), ee = this.rules.other.fencesBeginRegex(f), te = this.rules.other.headingBeginRegex(f), me = this.rules.other.htmlBeginRegex(f), xe = this.rules.other.blockquoteBeginRegex(f);
200
+ for (; e; ) {
201
+ let Z = e.split(`
202
+ `, 1)[0], A;
203
+ if (h = Z, this.options.pedantic ? (h = h.replace(this.rules.other.listReplaceNesting, " "), A = h) : A = h.replace(this.rules.other.tabCharGlobal, " "), ee.test(h) || te.test(h) || me.test(h) || xe.test(h) || S.test(h) || Y.test(h)) break;
204
+ if (A.search(this.rules.other.nonSpaceChar) >= f || !h.trim()) c += `
205
+ ` + A.slice(f);
206
+ else {
207
+ if (R || d.replace(this.rules.other.tabCharGlobal, " ").search(this.rules.other.nonSpaceChar) >= 4 || ee.test(d) || te.test(d) || Y.test(d)) break;
208
+ c += `
209
+ ` + h;
210
+ }
211
+ R = !h.trim(), p += Z + `
212
+ `, e = e.substring(Z.length + 1), d = A.slice(f);
213
+ }
214
+ }
215
+ i.loose || (a ? i.loose = true : this.rules.other.doubleBlankLine.test(p) && (a = true)), i.items.push({ type: "list_item", raw: p, task: !!this.options.gfm && this.rules.other.listIsTask.test(c), loose: false, text: c, tokens: [] }), i.raw += p;
216
+ }
217
+ let o = i.items.at(-1);
218
+ if (o) o.raw = o.raw.trimEnd(), o.text = o.text.trimEnd();
219
+ else return;
220
+ i.raw = i.raw.trimEnd();
221
+ for (let l of i.items) {
222
+ if (this.lexer.state.top = false, l.tokens = this.lexer.blockTokens(l.text, []), l.task) {
223
+ if (l.text = l.text.replace(this.rules.other.listReplaceTask, ""), ((_a2 = l.tokens[0]) == null ? void 0 : _a2.type) === "text" || ((_b = l.tokens[0]) == null ? void 0 : _b.type) === "paragraph") {
224
+ l.tokens[0].raw = l.tokens[0].raw.replace(this.rules.other.listReplaceTask, ""), l.tokens[0].text = l.tokens[0].text.replace(this.rules.other.listReplaceTask, "");
225
+ for (let c = this.lexer.inlineQueue.length - 1; c >= 0; c--) if (this.rules.other.listIsTask.test(this.lexer.inlineQueue[c].src)) {
226
+ this.lexer.inlineQueue[c].src = this.lexer.inlineQueue[c].src.replace(this.rules.other.listReplaceTask, "");
227
+ break;
228
+ }
229
+ }
230
+ let p = this.rules.other.listTaskCheckbox.exec(l.raw);
231
+ if (p) {
232
+ let c = { type: "checkbox", raw: p[0] + " ", checked: p[0] !== "[ ]" };
233
+ l.checked = c.checked, i.loose ? l.tokens[0] && ["paragraph", "text"].includes(l.tokens[0].type) && "tokens" in l.tokens[0] && l.tokens[0].tokens ? (l.tokens[0].raw = c.raw + l.tokens[0].raw, l.tokens[0].text = c.raw + l.tokens[0].text, l.tokens[0].tokens.unshift(c)) : l.tokens.unshift({ type: "paragraph", raw: c.raw, text: c.raw, tokens: [c] }) : l.tokens.unshift(c);
234
+ }
235
+ }
236
+ if (!i.loose) {
237
+ let p = l.tokens.filter((d) => d.type === "space"), c = p.length > 0 && p.some((d) => this.rules.other.anyLine.test(d.raw));
238
+ i.loose = c;
239
+ }
186
240
  }
187
- const valueAsRecord = value;
188
- const valueToString = lookupGetter(valueAsRecord, "toString");
189
- if (typeof valueToString === "function") {
190
- const stringified = valueToString(valueAsRecord);
191
- return typeof stringified === "string" ? stringified : objectToString(stringified);
241
+ if (i.loose) for (let l of i.items) {
242
+ l.loose = true;
243
+ for (let p of l.tokens) p.type === "text" && (p.type = "paragraph");
192
244
  }
193
- return objectToString(value);
245
+ return i;
194
246
  }
195
- default: {
196
- return objectToString(value);
247
+ }
248
+ html(e) {
249
+ let t = this.rules.block.html.exec(e);
250
+ if (t) return { type: "html", block: true, raw: t[0], pre: t[1] === "pre" || t[1] === "script" || t[1] === "style", text: t[0] };
251
+ }
252
+ def(e) {
253
+ let t = this.rules.block.def.exec(e);
254
+ if (t) {
255
+ let n = t[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal, " "), r = t[2] ? t[2].replace(this.rules.other.hrefBrackets, "$1").replace(this.rules.inline.anyPunctuation, "$1") : "", i = t[3] ? t[3].substring(1, t[3].length - 1).replace(this.rules.inline.anyPunctuation, "$1") : t[3];
256
+ return { type: "def", tag: n, raw: t[0], href: r, title: i };
197
257
  }
198
258
  }
199
- }
200
- function lookupGetter(object, prop) {
201
- while (object !== null) {
202
- const desc = getOwnPropertyDescriptor(object, prop);
203
- if (desc) {
204
- if (desc.get) {
205
- return unapply(desc.get);
206
- }
207
- if (typeof desc.value === "function") {
208
- return unapply(desc.value);
209
- }
259
+ table(e) {
260
+ var _a2;
261
+ let t = this.rules.block.table.exec(e);
262
+ if (!t || !this.rules.other.tableDelimiter.test(t[2])) return;
263
+ let n = V(t[1]), r = t[2].replace(this.rules.other.tableAlignChars, "").split("|"), i = ((_a2 = t[3]) == null ? void 0 : _a2.trim()) ? t[3].replace(this.rules.other.tableRowBlankLine, "").split(`
264
+ `) : [], s = { type: "table", raw: t[0], header: [], align: [], rows: [] };
265
+ if (n.length === r.length) {
266
+ for (let a of r) this.rules.other.tableAlignRight.test(a) ? s.align.push("right") : this.rules.other.tableAlignCenter.test(a) ? s.align.push("center") : this.rules.other.tableAlignLeft.test(a) ? s.align.push("left") : s.align.push(null);
267
+ for (let a = 0; a < n.length; a++) s.header.push({ text: n[a], tokens: this.lexer.inline(n[a]), header: true, align: s.align[a] });
268
+ for (let a of i) s.rows.push(V(a, s.header.length).map((o, l) => ({ text: o, tokens: this.lexer.inline(o), header: false, align: s.align[l] })));
269
+ return s;
210
270
  }
211
- object = getPrototypeOf(object);
212
271
  }
213
- function fallbackValue() {
214
- return null;
272
+ lheading(e) {
273
+ let t = this.rules.block.lheading.exec(e);
274
+ if (t) {
275
+ let n = t[1].trim();
276
+ return { type: "heading", raw: t[0], depth: t[2].charAt(0) === "=" ? 1 : 2, text: n, tokens: this.lexer.inline(n) };
277
+ }
215
278
  }
216
- return fallbackValue;
217
- }
218
- function isRegex(value) {
219
- try {
220
- regExpTest(value, "");
221
- return true;
222
- } catch (_unused) {
223
- return false;
279
+ paragraph(e) {
280
+ let t = this.rules.block.paragraph.exec(e);
281
+ if (t) {
282
+ let n = t[1].charAt(t[1].length - 1) === `
283
+ ` ? t[1].slice(0, -1) : t[1];
284
+ return { type: "paragraph", raw: t[0], text: n, tokens: this.lexer.inline(n) };
285
+ }
224
286
  }
225
- }
226
- const html$1 = freeze(["a", "abbr", "acronym", "address", "area", "article", "aside", "audio", "b", "bdi", "bdo", "big", "blink", "blockquote", "body", "br", "button", "canvas", "caption", "center", "cite", "code", "col", "colgroup", "content", "data", "datalist", "dd", "decorator", "del", "details", "dfn", "dialog", "dir", "div", "dl", "dt", "element", "em", "fieldset", "figcaption", "figure", "font", "footer", "form", "h1", "h2", "h3", "h4", "h5", "h6", "head", "header", "hgroup", "hr", "html", "i", "img", "input", "ins", "kbd", "label", "legend", "li", "main", "map", "mark", "marquee", "menu", "menuitem", "meter", "nav", "nobr", "ol", "optgroup", "option", "output", "p", "picture", "pre", "progress", "q", "rp", "rt", "ruby", "s", "samp", "search", "section", "select", "shadow", "slot", "small", "source", "spacer", "span", "strike", "strong", "style", "sub", "summary", "sup", "table", "tbody", "td", "template", "textarea", "tfoot", "th", "thead", "time", "tr", "track", "tt", "u", "ul", "var", "video", "wbr"]);
227
- const svg$1 = freeze(["svg", "a", "altglyph", "altglyphdef", "altglyphitem", "animatecolor", "animatemotion", "animatetransform", "circle", "clippath", "defs", "desc", "ellipse", "enterkeyhint", "exportparts", "filter", "font", "g", "glyph", "glyphref", "hkern", "image", "inputmode", "line", "lineargradient", "marker", "mask", "metadata", "mpath", "part", "path", "pattern", "polygon", "polyline", "radialgradient", "rect", "stop", "style", "switch", "symbol", "text", "textpath", "title", "tref", "tspan", "view", "vkern"]);
228
- const svgFilters = freeze(["feBlend", "feColorMatrix", "feComponentTransfer", "feComposite", "feConvolveMatrix", "feDiffuseLighting", "feDisplacementMap", "feDistantLight", "feDropShadow", "feFlood", "feFuncA", "feFuncB", "feFuncG", "feFuncR", "feGaussianBlur", "feImage", "feMerge", "feMergeNode", "feMorphology", "feOffset", "fePointLight", "feSpecularLighting", "feSpotLight", "feTile", "feTurbulence"]);
229
- const svgDisallowed = freeze(["animate", "color-profile", "cursor", "discard", "font-face", "font-face-format", "font-face-name", "font-face-src", "font-face-uri", "foreignobject", "hatch", "hatchpath", "mesh", "meshgradient", "meshpatch", "meshrow", "missing-glyph", "script", "set", "solidcolor", "unknown", "use"]);
230
- const mathMl$1 = freeze(["math", "menclose", "merror", "mfenced", "mfrac", "mglyph", "mi", "mlabeledtr", "mmultiscripts", "mn", "mo", "mover", "mpadded", "mphantom", "mroot", "mrow", "ms", "mspace", "msqrt", "mstyle", "msub", "msup", "msubsup", "mtable", "mtd", "mtext", "mtr", "munder", "munderover", "mprescripts"]);
231
- const mathMlDisallowed = freeze(["maction", "maligngroup", "malignmark", "mlongdiv", "mscarries", "mscarry", "msgroup", "mstack", "msline", "msrow", "semantics", "annotation", "annotation-xml", "mprescripts", "none"]);
232
- const text = freeze(["#text"]);
233
- const html = freeze(["accept", "action", "align", "alt", "autocapitalize", "autocomplete", "autopictureinpicture", "autoplay", "background", "bgcolor", "border", "capture", "cellpadding", "cellspacing", "checked", "cite", "class", "clear", "color", "cols", "colspan", "command", "commandfor", "controls", "controlslist", "coords", "crossorigin", "datetime", "decoding", "default", "dir", "disabled", "disablepictureinpicture", "disableremoteplayback", "download", "draggable", "enctype", "enterkeyhint", "exportparts", "face", "for", "headers", "height", "hidden", "high", "href", "hreflang", "id", "inert", "inputmode", "integrity", "ismap", "kind", "label", "lang", "list", "loading", "loop", "low", "max", "maxlength", "media", "method", "min", "minlength", "multiple", "muted", "name", "nonce", "noshade", "novalidate", "nowrap", "open", "optimum", "part", "pattern", "placeholder", "playsinline", "popover", "popovertarget", "popovertargetaction", "poster", "preload", "pubdate", "radiogroup", "readonly", "rel", "required", "rev", "reversed", "role", "rows", "rowspan", "spellcheck", "scope", "selected", "shape", "size", "sizes", "slot", "span", "srclang", "start", "src", "srcset", "step", "style", "summary", "tabindex", "title", "translate", "type", "usemap", "valign", "value", "width", "wrap", "xmlns"]);
234
- const svg = freeze(["accent-height", "accumulate", "additive", "alignment-baseline", "amplitude", "ascent", "attributename", "attributetype", "azimuth", "basefrequency", "baseline-shift", "begin", "bias", "by", "class", "clip", "clippathunits", "clip-path", "clip-rule", "color", "color-interpolation", "color-interpolation-filters", "color-profile", "color-rendering", "cx", "cy", "d", "dx", "dy", "diffuseconstant", "direction", "display", "divisor", "dominant-baseline", "dur", "edgemode", "elevation", "end", "exponent", "fill", "fill-opacity", "fill-rule", "filter", "filterunits", "flood-color", "flood-opacity", "font-family", "font-size", "font-size-adjust", "font-stretch", "font-style", "font-variant", "font-weight", "fx", "fy", "g1", "g2", "glyph-name", "glyphref", "gradientunits", "gradienttransform", "height", "href", "id", "image-rendering", "in", "in2", "intercept", "k", "k1", "k2", "k3", "k4", "kerning", "keypoints", "keysplines", "keytimes", "lang", "lengthadjust", "letter-spacing", "kernelmatrix", "kernelunitlength", "lighting-color", "local", "marker-end", "marker-mid", "marker-start", "markerheight", "markerunits", "markerwidth", "maskcontentunits", "maskunits", "max", "mask", "mask-type", "media", "method", "mode", "min", "name", "numoctaves", "offset", "operator", "opacity", "order", "orient", "orientation", "origin", "overflow", "paint-order", "path", "pathlength", "patterncontentunits", "patterntransform", "patternunits", "pointer-events", "points", "preservealpha", "preserveaspectratio", "primitiveunits", "r", "rx", "ry", "radius", "refx", "refy", "repeatcount", "repeatdur", "restart", "result", "rotate", "scale", "seed", "shape-rendering", "slope", "specularconstant", "specularexponent", "spreadmethod", "startoffset", "stddeviation", "stitchtiles", "stop-color", "stop-opacity", "stroke-dasharray", "stroke-dashoffset", "stroke-linecap", "stroke-linejoin", "stroke-miterlimit", "stroke-opacity", "stroke", "stroke-width", "style", "surfacescale", "systemlanguage", "tabindex", "tablevalues", "targetx", "targety", "transform", "transform-origin", "text-anchor", "text-decoration", "text-orientation", "text-rendering", "textlength", "type", "u1", "u2", "unicode", "values", "vector-effect", "viewbox", "visibility", "version", "vert-adv-y", "vert-origin-x", "vert-origin-y", "width", "word-spacing", "wrap", "writing-mode", "xchannelselector", "ychannelselector", "x", "x1", "x2", "xmlns", "y", "y1", "y2", "z", "zoomandpan"]);
235
- const mathMl = freeze(["accent", "accentunder", "align", "bevelled", "close", "columnalign", "columnlines", "columnspacing", "columnspan", "denomalign", "depth", "dir", "display", "displaystyle", "encoding", "fence", "frame", "height", "href", "id", "largeop", "length", "linethickness", "lquote", "lspace", "mathbackground", "mathcolor", "mathsize", "mathvariant", "maxsize", "minsize", "movablelimits", "notation", "numalign", "open", "rowalign", "rowlines", "rowspacing", "rowspan", "rspace", "rquote", "scriptlevel", "scriptminsize", "scriptsizemultiplier", "selection", "separator", "separators", "stretchy", "subscriptshift", "supscriptshift", "symmetric", "voffset", "width", "xmlns"]);
236
- const xml = freeze(["xlink:href", "xml:id", "xlink:title", "xml:space", "xmlns:xlink"]);
237
- const MUSTACHE_EXPR = seal(/{{[\w\W]*|^[\w\W]*}}/g);
238
- const ERB_EXPR = seal(/<%[\w\W]*|^[\w\W]*%>/g);
239
- const TMPLIT_EXPR = seal(/\${[\w\W]*/g);
240
- const DATA_ATTR = seal(/^data-[\-\w.\u00B7-\uFFFF]+$/);
241
- const ARIA_ATTR = seal(/^aria-[\-\w]+$/);
242
- const IS_ALLOWED_URI = seal(
243
- /^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i
244
- // eslint-disable-line no-useless-escape
245
- );
246
- const IS_SCRIPT_OR_DATA = seal(/^(?:\w+script|data):/i);
247
- const ATTR_WHITESPACE = seal(
248
- /[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g
249
- // eslint-disable-line no-control-regex
250
- );
251
- const DOCTYPE_NAME = seal(/^html$/i);
252
- const CUSTOM_ELEMENT = seal(/^[a-z][.\w]*(-[.\w]+)+$/i);
253
- const ELEMENT_MARKUP_PROBE = seal(/<[/\w!]/g);
254
- const COMMENT_MARKUP_PROBE = seal(/<[/\w]/g);
255
- const FALLBACK_TAG_CLOSE = seal(/<\/no(script|embed|frames)/i);
256
- const SELF_CLOSING_TAG = seal(/\/>/i);
257
- const NODE_TYPE = {
258
- element: 1,
259
- attribute: 2,
260
- text: 3,
261
- cdataSection: 4,
262
- entityReference: 5,
263
- // Deprecated
264
- entityNode: 6,
265
- // Deprecated
266
- processingInstruction: 7,
267
- comment: 8,
268
- document: 9,
269
- documentType: 10,
270
- documentFragment: 11,
271
- notation: 12
272
- // Deprecated
273
- };
274
- const LITERAL_TEXT_ELEMENT_NAMES = ["style", "script", "xmp", "iframe", "noembed", "noframes", "plaintext", "noscript"];
275
- const LITERAL_TEXT_ELEMENTS = freeze(addToSet({}, LITERAL_TEXT_ELEMENT_NAMES));
276
- const LITERAL_TEXT_CLOSE = function() {
277
- const map = {};
278
- arrayForEach(LITERAL_TEXT_ELEMENT_NAMES, (name) => {
279
- map[name] = seal(new RegExp("</" + name + "(?=[\\t\\n\\f\\r />])", "i"));
280
- });
281
- return freeze(map);
282
- }();
283
- const getGlobal = function getGlobal2() {
284
- return typeof window === "undefined" ? null : window;
285
- };
286
- const _createTrustedTypesPolicy = function _createTrustedTypesPolicy2(trustedTypes, purifyHostElement) {
287
- if (typeof trustedTypes !== "object" || typeof trustedTypes.createPolicy !== "function") {
288
- return null;
287
+ text(e) {
288
+ let t = this.rules.block.text.exec(e);
289
+ if (t) return { type: "text", raw: t[0], text: t[0], tokens: this.lexer.inline(t[0]) };
289
290
  }
290
- let suffix = null;
291
- const ATTR_NAME = "data-tt-policy-suffix";
292
- if (purifyHostElement && purifyHostElement.hasAttribute(ATTR_NAME)) {
293
- suffix = purifyHostElement.getAttribute(ATTR_NAME);
291
+ escape(e) {
292
+ let t = this.rules.inline.escape.exec(e);
293
+ if (t) return { type: "escape", raw: t[0], text: t[1] };
294
294
  }
295
- const policyName = "dompurify" + (suffix ? "#" + suffix : "");
296
- try {
297
- return trustedTypes.createPolicy(policyName, {
298
- createHTML(html2) {
299
- return html2;
300
- },
301
- createScriptURL(scriptUrl) {
302
- return scriptUrl;
303
- }
304
- });
305
- } catch (_) {
306
- console.warn("TrustedTypes policy " + policyName + " could not be created.");
307
- return null;
295
+ tag(e) {
296
+ let t = this.rules.inline.tag.exec(e);
297
+ if (t) return !this.lexer.state.inLink && this.rules.other.startATag.test(t[0]) ? this.lexer.state.inLink = true : this.lexer.state.inLink && this.rules.other.endATag.test(t[0]) && (this.lexer.state.inLink = false), !this.lexer.state.inRawBlock && this.rules.other.startPreScriptTag.test(t[0]) ? this.lexer.state.inRawBlock = true : this.lexer.state.inRawBlock && this.rules.other.endPreScriptTag.test(t[0]) && (this.lexer.state.inRawBlock = false), { type: "html", raw: t[0], inLink: this.lexer.state.inLink, inRawBlock: this.lexer.state.inRawBlock, block: false, text: t[0] };
308
298
  }
309
- };
310
- const _createHooksMap = function _createHooksMap2() {
311
- return {
312
- afterSanitizeAttributes: [],
313
- afterSanitizeElements: [],
314
- afterSanitizeShadowDOM: [],
315
- beforeSanitizeAttributes: [],
316
- beforeSanitizeElements: [],
317
- beforeSanitizeShadowDOM: [],
318
- uponSanitizeAttribute: [],
319
- uponSanitizeElement: [],
320
- uponSanitizeShadowNode: []
321
- };
322
- };
323
- const _resolveSetOption = function _resolveSetOption2(cfg, key, fallback, options) {
324
- return objectHasOwnProperty(cfg, key) && arrayIsArray(cfg[key]) ? addToSet(options.base ? clone(options.base) : {}, cfg[key], options.transform) : fallback;
325
- };
326
- const _resolveObjectOption = function _resolveObjectOption2(cfg, key, makeFallback) {
327
- const value = objectHasOwnProperty(cfg, key) ? cfg[key] : void 0;
328
- return value && typeof value === "object" ? clone(value) : makeFallback();
329
- };
330
- function createDOMPurify() {
331
- let window2 = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : getGlobal();
332
- const DOMPurify = (root) => createDOMPurify(root);
333
- DOMPurify.version = "3.4.14";
334
- DOMPurify.removed = [];
335
- if (!window2 || !window2.document || window2.document.nodeType !== NODE_TYPE.document || !window2.Element) {
336
- DOMPurify.isSupported = false;
337
- return DOMPurify;
338
- }
339
- let document = window2.document;
340
- const originalDocument = document;
341
- const currentScript = originalDocument.currentScript;
342
- window2.DocumentFragment;
343
- const HTMLTemplateElement = window2.HTMLTemplateElement, Node = window2.Node, Element = window2.Element, NodeFilter = window2.NodeFilter, _window$NamedNodeMap = window2.NamedNodeMap;
344
- _window$NamedNodeMap === void 0 ? window2.NamedNodeMap || window2.MozNamedAttrMap : _window$NamedNodeMap;
345
- window2.HTMLFormElement;
346
- const DOMParser = window2.DOMParser, trustedTypes = window2.trustedTypes;
347
- const ElementPrototype = Element.prototype;
348
- const cloneNode = lookupGetter(ElementPrototype, "cloneNode");
349
- const remove = lookupGetter(ElementPrototype, "remove");
350
- const getNextSibling = lookupGetter(ElementPrototype, "nextSibling");
351
- const getChildNodes = lookupGetter(ElementPrototype, "childNodes");
352
- const getParentNode = lookupGetter(ElementPrototype, "parentNode");
353
- const getShadowRoot = lookupGetter(ElementPrototype, "shadowRoot");
354
- const getAttributes = lookupGetter(ElementPrototype, "attributes");
355
- const getNodeType = Node && Node.prototype ? lookupGetter(Node.prototype, "nodeType") : null;
356
- const getNodeName = Node && Node.prototype ? lookupGetter(Node.prototype, "nodeName") : null;
357
- const getOwnerDocument = Node && Node.prototype ? lookupGetter(Node.prototype, "ownerDocument") : null;
358
- const _readNodeType = function _readNodeType2(node) {
359
- return getNodeType ? getNodeType(node) : node.nodeType;
360
- };
361
- const _readNodeName = function _readNodeName2(node) {
362
- return getNodeName ? getNodeName(node) : node.nodeName;
363
- };
364
- if (typeof HTMLTemplateElement === "function") {
365
- const template = document.createElement("template");
366
- if (template.content && template.content.ownerDocument) {
367
- document = template.content.ownerDocument;
299
+ link(e) {
300
+ let t = this.rules.inline.link.exec(e);
301
+ if (t) {
302
+ let n = t[2].trim();
303
+ if (!this.options.pedantic && this.rules.other.startAngleBracket.test(n)) {
304
+ if (!this.rules.other.endAngleBracket.test(n)) return;
305
+ let s = I(n.slice(0, -1), "\\");
306
+ if ((n.length - s.length) % 2 === 0) return;
307
+ } else {
308
+ let s = de(t[2], "()");
309
+ if (s === -2) return;
310
+ if (s > -1) {
311
+ let o = (t[0].indexOf("!") === 0 ? 5 : 4) + t[1].length + s;
312
+ t[2] = t[2].substring(0, s), t[0] = t[0].substring(0, o).trim(), t[3] = "";
313
+ }
314
+ }
315
+ let r = t[2], i = "";
316
+ if (this.options.pedantic) {
317
+ let s = this.rules.other.pedanticHrefTitle.exec(r);
318
+ s && (r = s[1], i = s[3]);
319
+ } else i = t[3] ? t[3].slice(1, -1) : "";
320
+ return r = r.trim(), this.rules.other.startAngleBracket.test(r) && (this.options.pedantic && !this.rules.other.endAngleBracket.test(n) ? r = r.slice(1) : r = r.slice(1, -1)), fe(t, { href: r && r.replace(this.rules.inline.anyPunctuation, "$1"), title: i && i.replace(this.rules.inline.anyPunctuation, "$1") }, t[0], this.lexer, this.rules);
368
321
  }
369
322
  }
370
- let trustedTypesPolicy;
371
- let emptyHTML = "";
372
- let defaultTrustedTypesPolicy;
373
- let defaultTrustedTypesPolicyResolved = false;
374
- let IN_TRUSTED_TYPES_POLICY = 0;
375
- const _assertNotInTrustedTypesPolicy = function _assertNotInTrustedTypesPolicy2() {
376
- if (IN_TRUSTED_TYPES_POLICY > 0) {
377
- throw typeErrorCreate('A configured TRUSTED_TYPES_POLICY callback (createHTML or createScriptURL) must not call DOMPurify.sanitize, as that causes infinite recursion. Do not pass a policy whose callbacks wrap DOMPurify as TRUSTED_TYPES_POLICY; see the "DOMPurify and Trusted Types" section of the README.');
378
- }
379
- };
380
- const _createTrustedHTML = function _createTrustedHTML2(html2) {
381
- _assertNotInTrustedTypesPolicy();
382
- IN_TRUSTED_TYPES_POLICY++;
383
- try {
384
- return trustedTypesPolicy.createHTML(html2);
385
- } finally {
386
- IN_TRUSTED_TYPES_POLICY--;
387
- }
388
- };
389
- const _createTrustedScriptURL = function _createTrustedScriptURL2(scriptUrl) {
390
- _assertNotInTrustedTypesPolicy();
391
- IN_TRUSTED_TYPES_POLICY++;
392
- try {
393
- return trustedTypesPolicy.createScriptURL(scriptUrl);
394
- } finally {
395
- IN_TRUSTED_TYPES_POLICY--;
396
- }
397
- };
398
- const _getDefaultTrustedTypesPolicy = function _getDefaultTrustedTypesPolicy2() {
399
- if (!defaultTrustedTypesPolicyResolved) {
400
- defaultTrustedTypesPolicy = _createTrustedTypesPolicy(trustedTypes, currentScript);
401
- defaultTrustedTypesPolicyResolved = true;
402
- }
403
- return defaultTrustedTypesPolicy;
404
- };
405
- const _document = document, implementation = _document.implementation, createNodeIterator = _document.createNodeIterator, createDocumentFragment = _document.createDocumentFragment, getElementsByTagName = _document.getElementsByTagName;
406
- const importNode = originalDocument.importNode;
407
- let hooks = _createHooksMap();
408
- DOMPurify.isSupported = typeof entries === "function" && typeof getParentNode === "function" && implementation && implementation.createHTMLDocument !== void 0;
409
- const MUSTACHE_EXPR$1 = MUSTACHE_EXPR, ERB_EXPR$1 = ERB_EXPR, TMPLIT_EXPR$1 = TMPLIT_EXPR, DATA_ATTR$1 = DATA_ATTR, ARIA_ATTR$1 = ARIA_ATTR, IS_SCRIPT_OR_DATA$1 = IS_SCRIPT_OR_DATA, ATTR_WHITESPACE$1 = ATTR_WHITESPACE, CUSTOM_ELEMENT$1 = CUSTOM_ELEMENT;
410
- let IS_ALLOWED_URI$1 = IS_ALLOWED_URI;
411
- let ALLOWED_TAGS = null;
412
- const DEFAULT_ALLOWED_TAGS = addToSet({}, [...html$1, ...svg$1, ...svgFilters, ...mathMl$1, ...text]);
413
- let ALLOWED_ATTR = null;
414
- const DEFAULT_ALLOWED_ATTR = addToSet({}, [...html, ...svg, ...mathMl, ...xml]);
415
- let CUSTOM_ELEMENT_HANDLING = Object.seal(create(null, {
416
- tagNameCheck: {
417
- writable: true,
418
- configurable: false,
419
- enumerable: true,
420
- value: null
421
- },
422
- attributeNameCheck: {
423
- writable: true,
424
- configurable: false,
425
- enumerable: true,
426
- value: null
427
- },
428
- allowCustomizedBuiltInElements: {
429
- writable: true,
430
- configurable: false,
431
- enumerable: true,
432
- value: false
433
- }
434
- }));
435
- let FORBID_TAGS = null;
436
- let FORBID_ATTR = null;
437
- const EXTRA_ELEMENT_HANDLING = Object.seal(create(null, {
438
- tagCheck: {
439
- writable: true,
440
- configurable: false,
441
- enumerable: true,
442
- value: null
443
- },
444
- attributeCheck: {
445
- writable: true,
446
- configurable: false,
447
- enumerable: true,
448
- value: null
449
- }
450
- }));
451
- let ALLOW_ARIA_ATTR = true;
452
- let ALLOW_DATA_ATTR = true;
453
- let ALLOW_UNKNOWN_PROTOCOLS = false;
454
- let ALLOW_SELF_CLOSE_IN_ATTR = true;
455
- let SAFE_FOR_TEMPLATES = false;
456
- let SAFE_FOR_XML = true;
457
- let WHOLE_DOCUMENT = false;
458
- let SET_CONFIG = false;
459
- let SET_CONFIG_ALLOWED_TAGS = null;
460
- let SET_CONFIG_ALLOWED_ATTR = null;
461
- let FORCE_BODY = false;
462
- let RETURN_DOM = false;
463
- let RETURN_DOM_FRAGMENT = false;
464
- let RETURN_TRUSTED_TYPE = false;
465
- let SANITIZE_DOM = true;
466
- let SANITIZE_NAMED_PROPS = false;
467
- const SANITIZE_NAMED_PROPS_PREFIX = "user-content-";
468
- let KEEP_CONTENT = true;
469
- let IN_PLACE = false;
470
- let USE_PROFILES = {};
471
- let FORBID_CONTENTS = null;
472
- const DEFAULT_FORBID_CONTENTS = addToSet({}, [
473
- "annotation-xml",
474
- "audio",
475
- "colgroup",
476
- "desc",
477
- "foreignobject",
478
- "head",
479
- "iframe",
480
- "math",
481
- "mi",
482
- "mn",
483
- "mo",
484
- "ms",
485
- "mtext",
486
- "noembed",
487
- "noframes",
488
- "noscript",
489
- "plaintext",
490
- "script",
491
- // <selectedcontent> mirrors the selected <option>'s subtree, cloned by
492
- // the UA (customizable <select>) — including any on* handlers — and the
493
- // engine re-mirrors synchronously whenever a removal changes which
494
- // option/selectedcontent is current, even inside DOMPurify's inert
495
- // DOMParser document. Hoisting its children on removal re-inserts a fresh
496
- // mirror target ahead of the walk, which the engine refills, looping
497
- // forever (DoS) and amplifying output. Dropping its content on removal
498
- // (rather than hoisting) breaks that cascade; the content is a duplicate
499
- // of the option, which is sanitized on its own. See campaign-3 F1/F6.
500
- "selectedcontent",
501
- "style",
502
- "svg",
503
- "template",
504
- "thead",
505
- "title",
506
- "video",
507
- "xmp"
508
- ]);
509
- let DATA_URI_TAGS = null;
510
- const DEFAULT_DATA_URI_TAGS = addToSet({}, ["audio", "video", "img", "source", "image", "track"]);
511
- let URI_SAFE_ATTRIBUTES = null;
512
- const DEFAULT_URI_SAFE_ATTRIBUTES = addToSet({}, ["alt", "class", "for", "id", "label", "name", "pattern", "placeholder", "role", "summary", "title", "value", "style", "xmlns"]);
513
- const MATHML_NAMESPACE = "http://www.w3.org/1998/Math/MathML";
514
- const SVG_NAMESPACE = "http://www.w3.org/2000/svg";
515
- const HTML_NAMESPACE = "http://www.w3.org/1999/xhtml";
516
- let NAMESPACE = HTML_NAMESPACE;
517
- let IS_EMPTY_INPUT = false;
518
- let ALLOWED_NAMESPACES = null;
519
- const DEFAULT_ALLOWED_NAMESPACES = addToSet({}, [MATHML_NAMESPACE, SVG_NAMESPACE, HTML_NAMESPACE], stringToString);
520
- const DEFAULT_MATHML_TEXT_INTEGRATION_POINTS = freeze(["mi", "mo", "mn", "ms", "mtext"]);
521
- let MATHML_TEXT_INTEGRATION_POINTS = addToSet({}, DEFAULT_MATHML_TEXT_INTEGRATION_POINTS);
522
- const DEFAULT_HTML_INTEGRATION_POINTS = freeze(["annotation-xml"]);
523
- let HTML_INTEGRATION_POINTS = addToSet({}, DEFAULT_HTML_INTEGRATION_POINTS);
524
- const COMMON_SVG_AND_HTML_ELEMENTS = addToSet({}, ["title", "style", "font", "a", "script"]);
525
- let PARSER_MEDIA_TYPE = null;
526
- const SUPPORTED_PARSER_MEDIA_TYPES = ["application/xhtml+xml", "text/html"];
527
- const DEFAULT_PARSER_MEDIA_TYPE = "text/html";
528
- let transformCaseFunc = null;
529
- let CONFIG = null;
530
- const formElement = document.createElement("form");
531
- const isRegexOrFunction = function isRegexOrFunction2(testValue) {
532
- return testValue instanceof RegExp || testValue instanceof Function;
533
- };
534
- const _parseConfig = function _parseConfig2() {
535
- let cfg = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
536
- if (CONFIG && CONFIG === cfg) {
537
- return;
538
- }
539
- if (!cfg || typeof cfg !== "object") {
540
- cfg = {};
541
- }
542
- cfg = clone(cfg);
543
- PARSER_MEDIA_TYPE = // eslint-disable-next-line unicorn/prefer-includes
544
- SUPPORTED_PARSER_MEDIA_TYPES.indexOf(cfg.PARSER_MEDIA_TYPE) === -1 ? DEFAULT_PARSER_MEDIA_TYPE : cfg.PARSER_MEDIA_TYPE;
545
- transformCaseFunc = PARSER_MEDIA_TYPE === "application/xhtml+xml" ? stringToString : stringToLowerCase;
546
- ALLOWED_TAGS = _resolveSetOption(cfg, "ALLOWED_TAGS", DEFAULT_ALLOWED_TAGS, {
547
- transform: transformCaseFunc
548
- });
549
- ALLOWED_ATTR = _resolveSetOption(cfg, "ALLOWED_ATTR", DEFAULT_ALLOWED_ATTR, {
550
- transform: transformCaseFunc
551
- });
552
- ALLOWED_NAMESPACES = _resolveSetOption(cfg, "ALLOWED_NAMESPACES", DEFAULT_ALLOWED_NAMESPACES, {
553
- transform: stringToString
554
- });
555
- URI_SAFE_ATTRIBUTES = _resolveSetOption(cfg, "ADD_URI_SAFE_ATTR", DEFAULT_URI_SAFE_ATTRIBUTES, {
556
- transform: transformCaseFunc,
557
- base: DEFAULT_URI_SAFE_ATTRIBUTES
558
- });
559
- DATA_URI_TAGS = _resolveSetOption(cfg, "ADD_DATA_URI_TAGS", DEFAULT_DATA_URI_TAGS, {
560
- transform: transformCaseFunc,
561
- base: DEFAULT_DATA_URI_TAGS
562
- });
563
- FORBID_CONTENTS = _resolveSetOption(cfg, "FORBID_CONTENTS", DEFAULT_FORBID_CONTENTS, {
564
- transform: transformCaseFunc
565
- });
566
- FORBID_TAGS = _resolveSetOption(cfg, "FORBID_TAGS", clone({}), {
567
- transform: transformCaseFunc
568
- });
569
- FORBID_ATTR = _resolveSetOption(cfg, "FORBID_ATTR", clone({}), {
570
- transform: transformCaseFunc
571
- });
572
- USE_PROFILES = objectHasOwnProperty(cfg, "USE_PROFILES") ? cfg.USE_PROFILES && typeof cfg.USE_PROFILES === "object" ? clone(cfg.USE_PROFILES) : cfg.USE_PROFILES : false;
573
- ALLOW_ARIA_ATTR = cfg.ALLOW_ARIA_ATTR !== false;
574
- ALLOW_DATA_ATTR = cfg.ALLOW_DATA_ATTR !== false;
575
- ALLOW_UNKNOWN_PROTOCOLS = cfg.ALLOW_UNKNOWN_PROTOCOLS || false;
576
- ALLOW_SELF_CLOSE_IN_ATTR = cfg.ALLOW_SELF_CLOSE_IN_ATTR !== false;
577
- SAFE_FOR_TEMPLATES = cfg.SAFE_FOR_TEMPLATES || false;
578
- SAFE_FOR_XML = cfg.SAFE_FOR_XML !== false;
579
- WHOLE_DOCUMENT = cfg.WHOLE_DOCUMENT || false;
580
- RETURN_DOM = cfg.RETURN_DOM || false;
581
- RETURN_DOM_FRAGMENT = cfg.RETURN_DOM_FRAGMENT || false;
582
- RETURN_TRUSTED_TYPE = cfg.RETURN_TRUSTED_TYPE || false;
583
- FORCE_BODY = cfg.FORCE_BODY || false;
584
- SANITIZE_DOM = cfg.SANITIZE_DOM !== false;
585
- SANITIZE_NAMED_PROPS = cfg.SANITIZE_NAMED_PROPS || false;
586
- KEEP_CONTENT = cfg.KEEP_CONTENT !== false;
587
- IN_PLACE = cfg.IN_PLACE || false;
588
- IS_ALLOWED_URI$1 = isRegex(cfg.ALLOWED_URI_REGEXP) ? cfg.ALLOWED_URI_REGEXP : IS_ALLOWED_URI;
589
- NAMESPACE = typeof cfg.NAMESPACE === "string" ? cfg.NAMESPACE : HTML_NAMESPACE;
590
- MATHML_TEXT_INTEGRATION_POINTS = _resolveObjectOption(
591
- cfg,
592
- "MATHML_TEXT_INTEGRATION_POINTS",
593
- () => addToSet({}, DEFAULT_MATHML_TEXT_INTEGRATION_POINTS)
594
- // Default built-in map
595
- );
596
- HTML_INTEGRATION_POINTS = _resolveObjectOption(
597
- cfg,
598
- "HTML_INTEGRATION_POINTS",
599
- () => addToSet({}, DEFAULT_HTML_INTEGRATION_POINTS)
600
- // Default built-in map
601
- );
602
- const customElementHandling = _resolveObjectOption(cfg, "CUSTOM_ELEMENT_HANDLING", () => create(null));
603
- CUSTOM_ELEMENT_HANDLING = create(null);
604
- if (objectHasOwnProperty(customElementHandling, "tagNameCheck") && isRegexOrFunction(customElementHandling.tagNameCheck)) {
605
- CUSTOM_ELEMENT_HANDLING.tagNameCheck = customElementHandling.tagNameCheck;
606
- }
607
- if (objectHasOwnProperty(customElementHandling, "attributeNameCheck") && isRegexOrFunction(customElementHandling.attributeNameCheck)) {
608
- CUSTOM_ELEMENT_HANDLING.attributeNameCheck = customElementHandling.attributeNameCheck;
609
- }
610
- if (objectHasOwnProperty(customElementHandling, "allowCustomizedBuiltInElements") && typeof customElementHandling.allowCustomizedBuiltInElements === "boolean") {
611
- CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements = customElementHandling.allowCustomizedBuiltInElements;
612
- }
613
- seal(CUSTOM_ELEMENT_HANDLING);
614
- if (SAFE_FOR_TEMPLATES) {
615
- ALLOW_DATA_ATTR = false;
616
- }
617
- if (RETURN_DOM_FRAGMENT) {
618
- RETURN_DOM = true;
619
- }
620
- if (USE_PROFILES) {
621
- ALLOWED_TAGS = addToSet({}, text);
622
- ALLOWED_ATTR = create(null);
623
- if (USE_PROFILES.html === true) {
624
- addToSet(ALLOWED_TAGS, html$1);
625
- addToSet(ALLOWED_ATTR, html);
626
- }
627
- if (USE_PROFILES.svg === true) {
628
- addToSet(ALLOWED_TAGS, svg$1);
629
- addToSet(ALLOWED_ATTR, svg);
630
- addToSet(ALLOWED_ATTR, xml);
631
- }
632
- if (USE_PROFILES.svgFilters === true) {
633
- addToSet(ALLOWED_TAGS, svgFilters);
634
- addToSet(ALLOWED_ATTR, svg);
635
- addToSet(ALLOWED_ATTR, xml);
636
- }
637
- if (USE_PROFILES.mathMl === true) {
638
- addToSet(ALLOWED_TAGS, mathMl$1);
639
- addToSet(ALLOWED_ATTR, mathMl);
640
- addToSet(ALLOWED_ATTR, xml);
323
+ reflink(e, t) {
324
+ let n;
325
+ if ((n = this.rules.inline.reflink.exec(e)) || (n = this.rules.inline.nolink.exec(e))) {
326
+ let r = (n[2] || n[1]).replace(this.rules.other.multipleSpaceGlobal, " "), i = t[r.toLowerCase()];
327
+ if (!i) {
328
+ let s = n[0].charAt(0);
329
+ return { type: "text", raw: s, text: s };
641
330
  }
331
+ return fe(n, i, n[0], this.lexer, this.rules);
642
332
  }
643
- EXTRA_ELEMENT_HANDLING.tagCheck = null;
644
- EXTRA_ELEMENT_HANDLING.attributeCheck = null;
645
- if (objectHasOwnProperty(cfg, "ADD_TAGS")) {
646
- if (typeof cfg.ADD_TAGS === "function") {
647
- EXTRA_ELEMENT_HANDLING.tagCheck = cfg.ADD_TAGS;
648
- } else if (arrayIsArray(cfg.ADD_TAGS)) {
649
- if (ALLOWED_TAGS === DEFAULT_ALLOWED_TAGS) {
650
- ALLOWED_TAGS = clone(ALLOWED_TAGS);
333
+ }
334
+ emStrong(e, t, n = "") {
335
+ let r = this.rules.inline.emStrongLDelim.exec(e);
336
+ if (!r || !r[1] && !r[2] && !r[3] && !r[4] || r[4] && n.match(this.rules.other.unicodeAlphaNumeric)) return;
337
+ if (!(r[1] || r[3] || "") || !n || this.rules.inline.punctuation.exec(n)) {
338
+ let s = [...r[0]].length - 1, a, o, l = s, p = 0, c = r[0][0] === "*" ? this.rules.inline.emStrongRDelimAst : this.rules.inline.emStrongRDelimUnd;
339
+ for (c.lastIndex = 0, t = t.slice(-1 * e.length + s); (r = c.exec(t)) !== null; ) {
340
+ if (a = r[1] || r[2] || r[3] || r[4] || r[5] || r[6], !a) continue;
341
+ if (o = [...a].length, r[3] || r[4]) {
342
+ l += o;
343
+ continue;
344
+ } else if ((r[5] || r[6]) && s % 3 && !((s + o) % 3)) {
345
+ p += o;
346
+ continue;
651
347
  }
652
- addToSet(ALLOWED_TAGS, cfg.ADD_TAGS, transformCaseFunc);
653
- }
654
- }
655
- if (objectHasOwnProperty(cfg, "ADD_ATTR")) {
656
- if (typeof cfg.ADD_ATTR === "function") {
657
- EXTRA_ELEMENT_HANDLING.attributeCheck = cfg.ADD_ATTR;
658
- } else if (arrayIsArray(cfg.ADD_ATTR)) {
659
- if (ALLOWED_ATTR === DEFAULT_ALLOWED_ATTR) {
660
- ALLOWED_ATTR = clone(ALLOWED_ATTR);
348
+ if (l -= o, l > 0) continue;
349
+ o = Math.min(o, o + l + p);
350
+ let d = [...r[0]][0].length, h = e.slice(0, s + r.index + d + o);
351
+ if (Math.min(s, o) % 2) {
352
+ let f = h.slice(1, -1);
353
+ return { type: "em", raw: h, text: f, tokens: this.lexer.inlineTokens(f) };
661
354
  }
662
- addToSet(ALLOWED_ATTR, cfg.ADD_ATTR, transformCaseFunc);
663
- }
664
- }
665
- if (objectHasOwnProperty(cfg, "ADD_FORBID_CONTENTS") && arrayIsArray(cfg.ADD_FORBID_CONTENTS)) {
666
- if (FORBID_CONTENTS === DEFAULT_FORBID_CONTENTS) {
667
- FORBID_CONTENTS = clone(FORBID_CONTENTS);
355
+ let R = h.slice(2, -2);
356
+ return { type: "strong", raw: h, text: R, tokens: this.lexer.inlineTokens(R) };
668
357
  }
669
- addToSet(FORBID_CONTENTS, cfg.ADD_FORBID_CONTENTS, transformCaseFunc);
670
- }
671
- if (KEEP_CONTENT) {
672
- ALLOWED_TAGS["#text"] = true;
673
- }
674
- if (WHOLE_DOCUMENT) {
675
- addToSet(ALLOWED_TAGS, ["html", "head", "body"]);
676
358
  }
677
- if (ALLOWED_TAGS.table) {
678
- addToSet(ALLOWED_TAGS, ["tbody"]);
679
- delete FORBID_TAGS.tbody;
359
+ }
360
+ codespan(e) {
361
+ let t = this.rules.inline.code.exec(e);
362
+ if (t) {
363
+ let n = t[2].replace(this.rules.other.newLineCharGlobal, " "), r = this.rules.other.nonSpaceChar.test(n), i = this.rules.other.startingSpaceChar.test(n) && this.rules.other.endingSpaceChar.test(n);
364
+ return r && i && (n = n.substring(1, n.length - 1)), { type: "codespan", raw: t[0], text: n };
680
365
  }
681
- if (cfg.TRUSTED_TYPES_POLICY) {
682
- if (typeof cfg.TRUSTED_TYPES_POLICY.createHTML !== "function") {
683
- throw typeErrorCreate('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');
684
- }
685
- if (typeof cfg.TRUSTED_TYPES_POLICY.createScriptURL !== "function") {
686
- throw typeErrorCreate('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');
687
- }
688
- const previousTrustedTypesPolicy = trustedTypesPolicy;
689
- trustedTypesPolicy = cfg.TRUSTED_TYPES_POLICY;
690
- try {
691
- emptyHTML = _createTrustedHTML("");
692
- } catch (error) {
693
- trustedTypesPolicy = previousTrustedTypesPolicy;
694
- throw error;
695
- }
696
- } else if (cfg.TRUSTED_TYPES_POLICY === null) {
697
- trustedTypesPolicy = void 0;
698
- emptyHTML = "";
699
- } else {
700
- if (trustedTypesPolicy === void 0) {
701
- trustedTypesPolicy = _getDefaultTrustedTypesPolicy();
702
- }
703
- if (trustedTypesPolicy && typeof emptyHTML === "string") {
704
- emptyHTML = _createTrustedHTML("");
366
+ }
367
+ br(e) {
368
+ let t = this.rules.inline.br.exec(e);
369
+ if (t) return { type: "br", raw: t[0] };
370
+ }
371
+ del(e, t, n = "") {
372
+ let r = this.rules.inline.delLDelim.exec(e);
373
+ if (!r) return;
374
+ if (!(r[1] || "") || !n || this.rules.inline.punctuation.exec(n)) {
375
+ let s = [...r[0]].length - 1, a, o, l = s, p = this.rules.inline.delRDelim;
376
+ for (p.lastIndex = 0, t = t.slice(-1 * e.length + s); (r = p.exec(t)) !== null; ) {
377
+ if (a = r[1] || r[2] || r[3] || r[4] || r[5] || r[6], !a || (o = [...a].length, o !== s)) continue;
378
+ if (r[3] || r[4]) {
379
+ l += o;
380
+ continue;
381
+ }
382
+ if (l -= o, l > 0) continue;
383
+ o = Math.min(o, o + l);
384
+ let c = [...r[0]][0].length, d = e.slice(0, s + r.index + c + o), h = d.slice(s, -s);
385
+ return { type: "del", raw: d, text: h, tokens: this.lexer.inlineTokens(h) };
705
386
  }
706
387
  }
707
- if (freeze) {
708
- freeze(cfg);
709
- }
710
- CONFIG = cfg;
711
- };
712
- const ALL_SVG_TAGS = addToSet({}, [...svg$1, ...svgFilters, ...svgDisallowed]);
713
- const ALL_MATHML_TAGS = addToSet({}, [...mathMl$1, ...mathMlDisallowed]);
714
- const _checkSvgNamespace = function _checkSvgNamespace2(tagName, parent, parentTagName) {
715
- if (parent.namespaceURI === HTML_NAMESPACE) {
716
- return tagName === "svg";
717
- }
718
- if (parent.namespaceURI === MATHML_NAMESPACE) {
719
- return tagName === "svg" && (parentTagName === "annotation-xml" || MATHML_TEXT_INTEGRATION_POINTS[parentTagName]);
720
- }
721
- return Boolean(ALL_SVG_TAGS[tagName]);
722
- };
723
- const _checkMathMlNamespace = function _checkMathMlNamespace2(tagName, parent, parentTagName) {
724
- if (parent.namespaceURI === HTML_NAMESPACE) {
725
- return tagName === "math";
726
- }
727
- if (parent.namespaceURI === SVG_NAMESPACE) {
728
- return tagName === "math" && HTML_INTEGRATION_POINTS[parentTagName];
729
- }
730
- return Boolean(ALL_MATHML_TAGS[tagName]);
731
- };
732
- const _checkHtmlNamespace = function _checkHtmlNamespace2(tagName, parent, parentTagName) {
733
- if (parent.namespaceURI === SVG_NAMESPACE && !HTML_INTEGRATION_POINTS[parentTagName]) {
734
- return false;
735
- }
736
- if (parent.namespaceURI === MATHML_NAMESPACE && !MATHML_TEXT_INTEGRATION_POINTS[parentTagName]) {
737
- return false;
738
- }
739
- return !ALL_MATHML_TAGS[tagName] && (COMMON_SVG_AND_HTML_ELEMENTS[tagName] || !ALL_SVG_TAGS[tagName]);
740
- };
741
- const _checkValidNamespace = function _checkValidNamespace2(element) {
742
- let parent = getParentNode(element);
743
- if (!parent || !parent.tagName) {
744
- parent = {
745
- namespaceURI: NAMESPACE,
746
- tagName: "template"
747
- };
748
- }
749
- const tagName = stringToLowerCase(element.tagName);
750
- const parentTagName = stringToLowerCase(parent.tagName);
751
- if (!ALLOWED_NAMESPACES[element.namespaceURI]) {
752
- return false;
753
- }
754
- if (element.namespaceURI === SVG_NAMESPACE) {
755
- return _checkSvgNamespace(tagName, parent, parentTagName);
756
- }
757
- if (element.namespaceURI === MATHML_NAMESPACE) {
758
- return _checkMathMlNamespace(tagName, parent, parentTagName);
759
- }
760
- if (element.namespaceURI === HTML_NAMESPACE) {
761
- return _checkHtmlNamespace(tagName, parent, parentTagName);
388
+ }
389
+ autolink(e) {
390
+ let t = this.rules.inline.autolink.exec(e);
391
+ if (t) {
392
+ let n, r;
393
+ return t[2] === "@" ? (n = t[1], r = "mailto:" + n) : (n = t[1], r = n), { type: "link", raw: t[0], text: n, href: r, tokens: [{ type: "text", raw: n, text: n }] };
762
394
  }
763
- if (PARSER_MEDIA_TYPE === "application/xhtml+xml" && ALLOWED_NAMESPACES[element.namespaceURI]) {
764
- return true;
395
+ }
396
+ url(e) {
397
+ var _a2;
398
+ let t;
399
+ if (t = this.rules.inline.url.exec(e)) {
400
+ let n, r;
401
+ if (t[2] === "@") n = t[0], r = "mailto:" + n;
402
+ else {
403
+ let i;
404
+ do
405
+ i = t[0], t[0] = ((_a2 = this.rules.inline._backpedal.exec(t[0])) == null ? void 0 : _a2[0]) ?? "";
406
+ while (i !== t[0]);
407
+ n = t[0], t[1] === "www." ? r = "http://" + t[0] : r = t[0];
408
+ }
409
+ return { type: "link", raw: t[0], text: n, href: r, tokens: [{ type: "text", raw: n, text: n }] };
765
410
  }
766
- return false;
767
- };
768
- const _forceRemove = function _forceRemove2(node) {
769
- arrayPush(DOMPurify.removed, {
770
- element: node
771
- });
772
- try {
773
- getParentNode(node).removeChild(node);
774
- } catch (_) {
775
- remove(node);
776
- if (!getParentNode(node)) {
777
- throw typeErrorCreate("a node selected for removal could not be detached from its tree and cannot be safely returned; refusing to sanitize in place");
778
- }
411
+ }
412
+ inlineText(e) {
413
+ let t = this.rules.inline.text.exec(e);
414
+ if (t) {
415
+ let n = this.lexer.state.inRawBlock;
416
+ return { type: "text", raw: t[0], text: t[0], escaped: n };
779
417
  }
780
- };
781
- const _stripAttributeNode = function _stripAttributeNode2(element, attribute, name) {
782
- try {
783
- element.removeAttributeNode(attribute);
784
- } catch (_) {
785
- try {
786
- element.removeAttribute(name);
787
- } catch (_2) {
418
+ }
419
+ };
420
+ var x = class u {
421
+ constructor(e) {
422
+ __publicField(this, "tokens");
423
+ __publicField(this, "options");
424
+ __publicField(this, "state");
425
+ __publicField(this, "inlineQueue");
426
+ __publicField(this, "tokenizer");
427
+ this.tokens = [], this.tokens.links = /* @__PURE__ */ Object.create(null), this.options = e || O, this.options.tokenizer = this.options.tokenizer || new w(), this.tokenizer = this.options.tokenizer, this.tokenizer.options = this.options, this.tokenizer.lexer = this, this.inlineQueue = [], this.state = { inLink: false, inRawBlock: false, top: true };
428
+ let t = { other: m, block: B.normal, inline: E.normal };
429
+ this.options.pedantic ? (t.block = B.pedantic, t.inline = E.pedantic) : this.options.gfm && (t.block = B.gfm, this.options.breaks ? t.inline = E.breaks : t.inline = E.gfm), this.tokenizer.rules = t;
430
+ }
431
+ static get rules() {
432
+ return { block: B, inline: E };
433
+ }
434
+ static lex(e, t) {
435
+ return new u(t).lex(e);
436
+ }
437
+ static lexInline(e, t) {
438
+ return new u(t).inlineTokens(e);
439
+ }
440
+ lex(e) {
441
+ e = e.replace(m.carriageReturn, `
442
+ `), this.blockTokens(e, this.tokens);
443
+ for (let t = 0; t < this.inlineQueue.length; t++) {
444
+ let n = this.inlineQueue[t];
445
+ this.inlineTokens(n.src, n.tokens);
446
+ }
447
+ return this.inlineQueue = [], this.tokens;
448
+ }
449
+ blockTokens(e, t = [], n = false) {
450
+ var _a2, _b, _c;
451
+ for (this.tokenizer.lexer = this, this.options.pedantic && (e = e.replace(m.tabCharGlobal, " ").replace(m.spaceLine, "")); e; ) {
452
+ let r;
453
+ if ((_b = (_a2 = this.options.extensions) == null ? void 0 : _a2.block) == null ? void 0 : _b.some((s) => (r = s.call({ lexer: this }, e, t)) ? (e = e.substring(r.raw.length), t.push(r), true) : false)) continue;
454
+ if (r = this.tokenizer.space(e)) {
455
+ e = e.substring(r.raw.length);
456
+ let s = t.at(-1);
457
+ r.raw.length === 1 && s !== void 0 ? s.raw += `
458
+ ` : t.push(r);
459
+ continue;
788
460
  }
789
- }
790
- };
791
- const _neutralizeRoot = function _neutralizeRoot2(root) {
792
- _neutralizeSubtree(root);
793
- const childNodes = getChildNodes(root);
794
- if (childNodes) {
795
- const snapshot = [];
796
- arrayForEach(childNodes, (child) => {
797
- arrayPush(snapshot, child);
798
- });
799
- arrayForEach(snapshot, (child) => {
800
- try {
801
- remove(child);
802
- } catch (_) {
803
- }
804
- });
805
- }
806
- const attributes = getAttributes(root);
807
- if (attributes) {
808
- for (let i = attributes.length - 1; i >= 0; --i) {
809
- const attribute = attributes[i];
810
- const name = attribute && attribute.name;
811
- if (typeof name === "string") {
812
- _stripAttributeNode(root, attribute, name);
813
- }
461
+ if (r = this.tokenizer.code(e)) {
462
+ e = e.substring(r.raw.length);
463
+ let s = t.at(-1);
464
+ (s == null ? void 0 : s.type) === "paragraph" || (s == null ? void 0 : s.type) === "text" ? (s.raw += (s.raw.endsWith(`
465
+ `) ? "" : `
466
+ `) + r.raw, s.text += `
467
+ ` + r.text, this.inlineQueue.at(-1).src = s.text) : t.push(r);
468
+ continue;
814
469
  }
815
- }
816
- };
817
- const _removeAttribute = function _removeAttribute2(name, element, attr) {
818
- if (!attr) {
819
- try {
820
- attr = element.getAttributeNode(name);
821
- } catch (_) {
822
- attr = null;
470
+ if (r = this.tokenizer.fences(e)) {
471
+ e = e.substring(r.raw.length), t.push(r);
472
+ continue;
823
473
  }
824
- }
825
- arrayPush(DOMPurify.removed, {
826
- attribute: attr || null,
827
- from: element
828
- });
829
- try {
830
- if (attr) {
831
- element.removeAttributeNode(attr);
832
- } else {
833
- element.removeAttribute(name);
474
+ if (r = this.tokenizer.heading(e)) {
475
+ e = e.substring(r.raw.length), t.push(r);
476
+ continue;
834
477
  }
835
- } catch (_) {
836
- try {
837
- element.removeAttribute(name);
838
- } catch (_2) {
478
+ if (r = this.tokenizer.hr(e)) {
479
+ e = e.substring(r.raw.length), t.push(r);
480
+ continue;
839
481
  }
840
- }
841
- if (name === "is") {
842
- if (RETURN_DOM || RETURN_DOM_FRAGMENT) {
843
- try {
844
- _forceRemove(element);
845
- } catch (_) {
846
- }
847
- } else {
848
- try {
849
- element.setAttribute(name, "");
850
- } catch (_) {
851
- }
482
+ if (r = this.tokenizer.blockquote(e)) {
483
+ e = e.substring(r.raw.length), t.push(r);
484
+ continue;
852
485
  }
853
- }
854
- };
855
- const _stripDisallowedAttributes = function _stripDisallowedAttributes2(element) {
856
- const attributes = getAttributes(element);
857
- if (!attributes) {
858
- return;
859
- }
860
- for (let i = attributes.length - 1; i >= 0; --i) {
861
- const attribute = attributes[i];
862
- const name = attribute && attribute.name;
863
- if (typeof name !== "string" || ALLOWED_ATTR[transformCaseFunc(name)]) {
486
+ if (r = this.tokenizer.list(e)) {
487
+ e = e.substring(r.raw.length), t.push(r);
864
488
  continue;
865
489
  }
866
- _stripAttributeNode(element, attribute, name);
867
- }
868
- };
869
- const _neutralizeSubtree = function _neutralizeSubtree2(root) {
870
- const stack = [root];
871
- while (stack.length > 0) {
872
- const node = stack.pop();
873
- const nodeType = _readNodeType(node);
874
- if (nodeType === NODE_TYPE.element) {
875
- _stripDisallowedAttributes(node);
490
+ if (r = this.tokenizer.html(e)) {
491
+ e = e.substring(r.raw.length), t.push(r);
492
+ continue;
876
493
  }
877
- const childNodes = getChildNodes(node);
878
- if (childNodes) {
879
- for (let i = childNodes.length - 1; i >= 0; --i) {
880
- stack.push(childNodes[i]);
881
- }
494
+ if (r = this.tokenizer.def(e)) {
495
+ e = e.substring(r.raw.length);
496
+ let s = t.at(-1);
497
+ (s == null ? void 0 : s.type) === "paragraph" || (s == null ? void 0 : s.type) === "text" ? (s.raw += (s.raw.endsWith(`
498
+ `) ? "" : `
499
+ `) + r.raw, s.text += `
500
+ ` + r.raw, this.inlineQueue.at(-1).src = s.text) : this.tokens.links[r.tag] || (this.tokens.links[r.tag] = { href: r.href, title: r.title }, t.push(r));
501
+ continue;
882
502
  }
883
- }
884
- };
885
- const _isPatchLinkageAttribute = function _isPatchLinkageAttribute2(lcName, lcTag) {
886
- if (!SAFE_FOR_XML) {
887
- return false;
888
- }
889
- if (lcName === "patchsrc") {
890
- return true;
891
- }
892
- return lcName === "for" && lcTag !== "label" && lcTag !== "output";
893
- };
894
- const _neutralizePatchLinkage = function _neutralizePatchLinkage2(root) {
895
- if (!SAFE_FOR_XML) {
896
- return;
897
- }
898
- const stack = [root];
899
- while (stack.length > 0) {
900
- const node = stack.pop();
901
- const nodeType = _readNodeType(node);
902
- if (nodeType === NODE_TYPE.processingInstruction || nodeType === NODE_TYPE.comment && regExpTest(COMMENT_MARKUP_PROBE, node.data)) {
903
- try {
904
- remove(node);
905
- } catch (_) {
906
- }
503
+ if (r = this.tokenizer.table(e)) {
504
+ e = e.substring(r.raw.length), t.push(r);
907
505
  continue;
908
506
  }
909
- if (nodeType === NODE_TYPE.element) {
910
- const element = node;
911
- const lcTag = transformCaseFunc(_readNodeName(node));
912
- try {
913
- if (element.hasAttribute && element.hasAttribute("patchsrc")) {
914
- element.removeAttribute("patchsrc");
915
- }
916
- if (element.hasAttribute && element.hasAttribute("for") && _isPatchLinkageAttribute("for", lcTag)) {
917
- element.removeAttribute("for");
918
- }
919
- } catch (_) {
920
- }
507
+ if (r = this.tokenizer.lheading(e)) {
508
+ e = e.substring(r.raw.length), t.push(r);
509
+ continue;
921
510
  }
922
- const childNodes = getChildNodes(node);
923
- if (childNodes) {
924
- for (let i = childNodes.length - 1; i >= 0; --i) {
925
- stack.push(childNodes[i]);
926
- }
511
+ let i = e;
512
+ if ((_c = this.options.extensions) == null ? void 0 : _c.startBlock) {
513
+ let s = 1 / 0, a = e.slice(1), o;
514
+ this.options.extensions.startBlock.forEach((l) => {
515
+ o = l.call({ lexer: this }, a), typeof o == "number" && o >= 0 && (s = Math.min(s, o));
516
+ }), s < 1 / 0 && s >= 0 && (i = e.substring(0, s + 1));
517
+ }
518
+ if (this.state.top && (r = this.tokenizer.paragraph(i))) {
519
+ let s = t.at(-1);
520
+ n && (s == null ? void 0 : s.type) === "paragraph" ? (s.raw += (s.raw.endsWith(`
521
+ `) ? "" : `
522
+ `) + r.raw, s.text += `
523
+ ` + r.text, this.inlineQueue.pop(), this.inlineQueue.at(-1).src = s.text) : t.push(r), n = i.length !== e.length, e = e.substring(r.raw.length);
524
+ continue;
927
525
  }
928
- }
929
- };
930
- const _initDocument = function _initDocument2(dirty) {
931
- let doc = null;
932
- let leadingWhitespace = null;
933
- if (FORCE_BODY) {
934
- dirty = "<remove></remove>" + dirty;
935
- } else {
936
- const matches = stringMatch(dirty, /^[\r\n\t ]+/);
937
- leadingWhitespace = matches && matches[0];
938
- }
939
- if (PARSER_MEDIA_TYPE === "application/xhtml+xml" && NAMESPACE === HTML_NAMESPACE) {
940
- dirty = '<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>' + dirty + "</body></html>";
941
- }
942
- const dirtyPayload = trustedTypesPolicy ? _createTrustedHTML(dirty) : dirty;
943
- if (NAMESPACE === HTML_NAMESPACE) {
944
- try {
945
- doc = new DOMParser().parseFromString(dirtyPayload, PARSER_MEDIA_TYPE);
946
- } catch (_) {
526
+ if (r = this.tokenizer.text(e)) {
527
+ e = e.substring(r.raw.length);
528
+ let s = t.at(-1);
529
+ (s == null ? void 0 : s.type) === "text" ? (s.raw += (s.raw.endsWith(`
530
+ `) ? "" : `
531
+ `) + r.raw, s.text += `
532
+ ` + r.text, this.inlineQueue.pop(), this.inlineQueue.at(-1).src = s.text) : t.push(r);
533
+ continue;
947
534
  }
948
- }
949
- if (!doc || !doc.documentElement) {
950
- doc = implementation.createDocument(NAMESPACE, "template", null);
951
- try {
952
- doc.documentElement.innerHTML = IS_EMPTY_INPUT ? emptyHTML : dirtyPayload;
953
- } catch (_) {
535
+ if (e) {
536
+ let s = "Infinite loop on byte: " + e.charCodeAt(0);
537
+ if (this.options.silent) {
538
+ console.error(s);
539
+ break;
540
+ } else throw new Error(s);
954
541
  }
955
542
  }
956
- const body = doc.body || doc.documentElement;
957
- if (dirty && leadingWhitespace) {
958
- body.insertBefore(document.createTextNode(leadingWhitespace), body.childNodes[0] || null);
959
- }
960
- if (NAMESPACE === HTML_NAMESPACE) {
961
- return getElementsByTagName.call(doc, WHOLE_DOCUMENT ? "html" : "body")[0];
962
- }
963
- return WHOLE_DOCUMENT ? doc.documentElement : body;
964
- };
965
- const _createNodeIterator = function _createNodeIterator2(root) {
966
- const doc = getOwnerDocument ? getOwnerDocument(root) : root.ownerDocument;
967
- return createNodeIterator.call(
968
- doc || root,
969
- root,
970
- // eslint-disable-next-line no-bitwise
971
- NodeFilter.SHOW_ELEMENT | NodeFilter.SHOW_COMMENT | NodeFilter.SHOW_TEXT | NodeFilter.SHOW_PROCESSING_INSTRUCTION | NodeFilter.SHOW_CDATA_SECTION,
972
- null
973
- );
974
- };
975
- const _stripTemplateExpressions = function _stripTemplateExpressions2(value) {
976
- value = stringReplace(value, MUSTACHE_EXPR$1, " ");
977
- value = stringReplace(value, ERB_EXPR$1, " ");
978
- value = stringReplace(value, TMPLIT_EXPR$1, " ");
979
- return value;
980
- };
981
- const _scrubTemplateExpressions2 = function _scrubTemplateExpressions(node) {
982
- var _node$querySelectorAl;
983
- node.normalize();
984
- const doc = getOwnerDocument ? getOwnerDocument(node) : node.ownerDocument;
985
- const walker = createNodeIterator.call(
986
- doc || node,
987
- node,
988
- // eslint-disable-next-line no-bitwise
989
- NodeFilter.SHOW_TEXT | NodeFilter.SHOW_COMMENT | NodeFilter.SHOW_CDATA_SECTION | NodeFilter.SHOW_PROCESSING_INSTRUCTION,
990
- null
991
- );
992
- let currentNode = walker.nextNode();
993
- while (currentNode) {
994
- currentNode.data = _stripTemplateExpressions(currentNode.data);
995
- currentNode = walker.nextNode();
996
- }
997
- const templates = (_node$querySelectorAl = node.querySelectorAll) === null || _node$querySelectorAl === void 0 ? void 0 : _node$querySelectorAl.call(node, "template");
998
- if (templates) {
999
- arrayForEach(templates, (tmpl) => {
1000
- if (_isDocumentFragment(tmpl.content)) {
1001
- _scrubTemplateExpressions2(tmpl.content);
1002
- }
1003
- });
1004
- }
1005
- };
1006
- const _isClobbered = function _isClobbered2(element) {
1007
- const realTagName = getNodeName ? getNodeName(element) : null;
1008
- if (typeof realTagName !== "string") {
1009
- return false;
1010
- }
1011
- if (transformCaseFunc(realTagName) !== "form") {
1012
- return false;
1013
- }
1014
- return typeof element.nodeName !== "string" || typeof element.textContent !== "string" || typeof element.removeChild !== "function" || // Realm-safe NamedNodeMap detection: equality against the cached
1015
- // prototype getter. Clobbered .attributes (e.g. <input name="attributes">)
1016
- // makes the direct read diverge from the cached read; a clean form
1017
- // (same-realm OR foreign-realm) has both reads pointing at the same
1018
- // canonical NamedNodeMap.
1019
- element.attributes !== getAttributes(element) || typeof element.removeAttribute !== "function" || typeof element.setAttribute !== "function" || typeof element.namespaceURI !== "string" || typeof element.insertBefore !== "function" || typeof element.hasChildNodes !== "function" || // NodeType clobbering probe. Cached Node.prototype.nodeType getter
1020
- // returns the integer 1 for any Element regardless of realm; direct
1021
- // read on a clobbered form (e.g. <input name="nodeType">) returns
1022
- // the named child element. Cheap addition — nodeType is read from
1023
- // an internal slot, no serialization cost — and removes a residual
1024
- // clobbering surface used by several mXSS / PI / comment branches
1025
- // in _sanitizeElements that compare currentNode.nodeType directly.
1026
- element.nodeType !== getNodeType(element) || // HTMLFormElement has [LegacyOverrideBuiltIns]: a descendant named
1027
- // "childNodes" shadows the prototype getter. Direct reads of
1028
- // form.childNodes from a clobbered form return the named child
1029
- // instead of the real NodeList, so any walk that reads it directly
1030
- // skips the form's real children. Compare the direct read to the
1031
- // cached Node.prototype getter — when the form's named-property
1032
- // getter intercepts the read, the two values differ and we flag
1033
- // the form. This catches every clobbering child type (input,
1034
- // select, etc.) regardless of whether the named child happens to
1035
- // carry a numeric .length, which a typeof-based probe would miss
1036
- // (e.g. HTMLSelectElement.length is a defined unsigned-long).
1037
- element.childNodes !== getChildNodes(element);
1038
- };
1039
- const _isDocumentFragment = function _isDocumentFragment2(value) {
1040
- if (!getNodeType || typeof value !== "object" || value === null) {
1041
- return false;
1042
- }
1043
- try {
1044
- return getNodeType(value) === NODE_TYPE.documentFragment;
1045
- } catch (_) {
1046
- return false;
1047
- }
1048
- };
1049
- const _isNode = function _isNode2(value) {
1050
- if (!getNodeType || typeof value !== "object" || value === null) {
1051
- return false;
1052
- }
1053
- try {
1054
- return typeof getNodeType(value) === "number";
1055
- } catch (_) {
1056
- return false;
1057
- }
1058
- };
1059
- function _executeHooks(hooks2, currentNode, data) {
1060
- if (hooks2.length === 0) {
1061
- return;
1062
- }
1063
- arrayForEach(hooks2, (hook) => {
1064
- hook.call(DOMPurify, currentNode, data, CONFIG);
1065
- });
543
+ return this.state.top = true, t;
1066
544
  }
1067
- const _isUnsafeNode = function _isUnsafeNode2(currentNode, tagName) {
1068
- if (SAFE_FOR_XML && currentNode.hasChildNodes() && !_isNode(currentNode.firstElementChild) && regExpTest(ELEMENT_MARKUP_PROBE, currentNode.textContent) && regExpTest(ELEMENT_MARKUP_PROBE, currentNode.innerHTML)) {
1069
- return true;
1070
- }
1071
- if (SAFE_FOR_XML && currentNode.namespaceURI === HTML_NAMESPACE && LITERAL_TEXT_ELEMENTS[tagName] && (_isNode(currentNode.firstElementChild) || typeof currentNode.textContent === "string" && regExpTest(LITERAL_TEXT_CLOSE[tagName], currentNode.textContent))) {
1072
- return true;
1073
- }
1074
- if (currentNode.nodeType === NODE_TYPE.processingInstruction) {
1075
- return true;
1076
- }
1077
- if (SAFE_FOR_XML && currentNode.nodeType === NODE_TYPE.comment && regExpTest(COMMENT_MARKUP_PROBE, currentNode.data)) {
1078
- return true;
1079
- }
1080
- return false;
1081
- };
1082
- const _matchesNameCheck = function _matchesNameCheck2(check, name) {
1083
- if (check instanceof RegExp) {
1084
- return regExpTest(check, name);
1085
- }
1086
- if (check instanceof Function) {
1087
- for (var _len = arguments.length, args = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
1088
- args[_key - 2] = arguments[_key];
1089
- }
1090
- return Boolean(check(name, ...args));
1091
- }
1092
- return false;
1093
- };
1094
- const _sanitizeDisallowedNode = function _sanitizeDisallowedNode2(currentNode, tagName, root) {
1095
- if (!FORBID_TAGS[tagName] && _isBasicCustomElement(tagName) && _matchesNameCheck(CUSTOM_ELEMENT_HANDLING.tagNameCheck, tagName)) {
1096
- return false;
1097
- }
1098
- if (KEEP_CONTENT && !FORBID_CONTENTS[tagName]) {
1099
- const parentNode = getParentNode(currentNode);
1100
- const childNodes = getChildNodes(currentNode);
1101
- if (childNodes && parentNode) {
1102
- const childCount = childNodes.length;
1103
- for (let i = childCount - 1; i >= 0; --i) {
1104
- const hoisted = currentNode === root ? cloneNode(childNodes[i], true) : childNodes[i];
1105
- parentNode.insertBefore(hoisted, getNextSibling(currentNode));
1106
- }
1107
- }
1108
- }
1109
- _forceRemove(currentNode);
1110
- return true;
1111
- };
1112
- const _forkSharedAllowlist = function _forkSharedAllowlist2(hookList, set, defaultSet, setConfigSet) {
1113
- if (hookList.length === 0) {
1114
- return set;
1115
- }
1116
- return set === defaultSet || set === setConfigSet ? clone(set) : set;
1117
- };
1118
- const _handleHookDetachedNode = function _handleHookDetachedNode2(currentNode, root) {
1119
- if (currentNode === root || getParentNode(currentNode) !== null) {
1120
- return false;
1121
- }
1122
- if (IN_PLACE) {
1123
- _neutralizeSubtree(currentNode);
1124
- }
1125
- return true;
1126
- };
1127
- const _sanitizeElements = function _sanitizeElements2(currentNode, root) {
1128
- _executeHooks(hooks.beforeSanitizeElements, currentNode, null);
1129
- if (_handleHookDetachedNode(currentNode, root)) {
1130
- return true;
1131
- }
1132
- if (_isClobbered(currentNode)) {
1133
- _forceRemove(currentNode);
1134
- return true;
1135
- }
1136
- const tagName = transformCaseFunc(_readNodeName(currentNode));
1137
- ALLOWED_TAGS = _forkSharedAllowlist(hooks.uponSanitizeElement, ALLOWED_TAGS, DEFAULT_ALLOWED_TAGS, SET_CONFIG_ALLOWED_TAGS);
1138
- _executeHooks(hooks.uponSanitizeElement, currentNode, {
1139
- tagName,
1140
- allowedTags: ALLOWED_TAGS
1141
- });
1142
- if (_handleHookDetachedNode(currentNode, root)) {
1143
- return true;
1144
- }
1145
- if (_isUnsafeNode(currentNode, tagName)) {
1146
- _forceRemove(currentNode);
1147
- return true;
1148
- }
1149
- if (FORBID_TAGS[tagName] || !(EXTRA_ELEMENT_HANDLING.tagCheck instanceof Function && EXTRA_ELEMENT_HANDLING.tagCheck(tagName)) && !ALLOWED_TAGS[tagName]) {
1150
- const removed = _sanitizeDisallowedNode(currentNode, tagName, root);
1151
- if (removed === false) {
1152
- _executeHooks(hooks.afterSanitizeElements, currentNode, null);
1153
- }
1154
- return removed;
1155
- }
1156
- const nt = _readNodeType(currentNode);
1157
- if (nt === NODE_TYPE.element && !_checkValidNamespace(currentNode)) {
1158
- _forceRemove(currentNode);
1159
- return true;
1160
- }
1161
- if ((tagName === "noscript" || tagName === "noembed" || tagName === "noframes") && regExpTest(FALLBACK_TAG_CLOSE, currentNode.innerHTML)) {
1162
- _forceRemove(currentNode);
1163
- return true;
1164
- }
1165
- if (SAFE_FOR_TEMPLATES && currentNode.nodeType === NODE_TYPE.text) {
1166
- const content = _stripTemplateExpressions(currentNode.textContent);
1167
- if (currentNode.textContent !== content) {
1168
- arrayPush(DOMPurify.removed, {
1169
- element: currentNode.cloneNode()
1170
- });
1171
- currentNode.textContent = content;
1172
- }
1173
- }
1174
- _executeHooks(hooks.afterSanitizeElements, currentNode, null);
1175
- return false;
1176
- };
1177
- const _isValidAttribute = function _isValidAttribute2(lcTag, lcName, value) {
1178
- if (FORBID_ATTR[lcName]) {
1179
- return false;
1180
- }
1181
- if (_isPatchLinkageAttribute(lcName, lcTag)) {
1182
- return false;
1183
- }
1184
- if (SANITIZE_DOM && (lcName === "id" || lcName === "name") && (value in document || value in formElement)) {
1185
- return false;
1186
- }
1187
- const nameIsPermitted = ALLOWED_ATTR[lcName] || EXTRA_ELEMENT_HANDLING.attributeCheck instanceof Function && EXTRA_ELEMENT_HANDLING.attributeCheck(lcName, lcTag);
1188
- if (ALLOW_DATA_ATTR && regExpTest(DATA_ATTR$1, lcName)) {
1189
- return true;
1190
- }
1191
- if (ALLOW_ARIA_ATTR && regExpTest(ARIA_ATTR$1, lcName)) {
1192
- return true;
1193
- }
1194
- if (!nameIsPermitted) {
1195
- return (
1196
- // Condition a) covers a basically valid custom element tag name whose
1197
- // tag passes the configured tagNameCheck and whose attribute name
1198
- // passes the configured attributeNameCheck ...
1199
- _isBasicCustomElement(lcTag) && _matchesNameCheck(CUSTOM_ELEMENT_HANDLING.tagNameCheck, lcTag) && _matchesNameCheck(CUSTOM_ELEMENT_HANDLING.attributeNameCheck, lcName, lcTag) || // Condition b) covers an `is` attribute whose value passes the
1200
- // configured tagNameCheck while customized built-in elements are
1201
- // allowed.
1202
- lcName === "is" && CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements && _matchesNameCheck(CUSTOM_ELEMENT_HANDLING.tagNameCheck, value)
1203
- );
1204
- }
1205
- if (URI_SAFE_ATTRIBUTES[lcName]) {
1206
- return true;
1207
- }
1208
- if (regExpTest(IS_ALLOWED_URI$1, stringReplace(value, ATTR_WHITESPACE$1, ""))) {
1209
- return true;
1210
- }
1211
- if ((lcName === "src" || lcName === "xlink:href" || lcName === "href") && lcTag !== "script" && stringIndexOf(value, "data:") === 0 && DATA_URI_TAGS[lcTag]) {
1212
- return true;
1213
- }
1214
- if (ALLOW_UNKNOWN_PROTOCOLS && !regExpTest(IS_SCRIPT_OR_DATA$1, stringReplace(value, ATTR_WHITESPACE$1, ""))) {
1215
- return true;
1216
- }
1217
- return !value;
1218
- };
1219
- const RESERVED_CUSTOM_ELEMENT_NAMES = addToSet({}, ["annotation-xml", "color-profile", "font-face", "font-face-format", "font-face-name", "font-face-src", "font-face-uri", "missing-glyph"]);
1220
- const _isBasicCustomElement = function _isBasicCustomElement2(tagName) {
1221
- return !RESERVED_CUSTOM_ELEMENT_NAMES[stringToLowerCase(tagName)] && regExpTest(CUSTOM_ELEMENT$1, tagName);
1222
- };
1223
- const _applyTrustedTypesToAttribute = function _applyTrustedTypesToAttribute2(lcTag, lcName, namespaceURI, value) {
1224
- if (trustedTypesPolicy && typeof trustedTypes === "object" && typeof trustedTypes.getAttributeType === "function" && !namespaceURI) {
1225
- switch (trustedTypes.getAttributeType(lcTag, lcName)) {
1226
- case "TrustedHTML": {
1227
- return _createTrustedHTML(value);
1228
- }
1229
- case "TrustedScriptURL": {
1230
- return _createTrustedScriptURL(value);
1231
- }
545
+ inline(e, t = []) {
546
+ return this.inlineQueue.push({ src: e, tokens: t }), t;
547
+ }
548
+ inlineTokens(e, t = []) {
549
+ var _a2, _b, _c, _d, _e2;
550
+ this.tokenizer.lexer = this;
551
+ let n = e, r = null;
552
+ if (this.tokens.links) {
553
+ let o = Object.keys(this.tokens.links);
554
+ if (o.length > 0) for (; (r = this.tokenizer.rules.inline.reflinkSearch.exec(n)) !== null; ) o.includes(r[0].slice(r[0].lastIndexOf("[") + 1, -1)) && (n = n.slice(0, r.index) + "[" + "a".repeat(r[0].length - 2) + "]" + n.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex));
555
+ }
556
+ for (; (r = this.tokenizer.rules.inline.anyPunctuation.exec(n)) !== null; ) n = n.slice(0, r.index) + "++" + n.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);
557
+ let i;
558
+ for (; (r = this.tokenizer.rules.inline.blockSkip.exec(n)) !== null; ) i = r[2] ? r[2].length : 0, n = n.slice(0, r.index + i) + "[" + "a".repeat(r[0].length - i - 2) + "]" + n.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);
559
+ n = ((_b = (_a2 = this.options.hooks) == null ? void 0 : _a2.emStrongMask) == null ? void 0 : _b.call({ lexer: this }, n)) ?? n;
560
+ let s = false, a = "";
561
+ for (; e; ) {
562
+ s || (a = ""), s = false;
563
+ let o;
564
+ if ((_d = (_c = this.options.extensions) == null ? void 0 : _c.inline) == null ? void 0 : _d.some((p) => (o = p.call({ lexer: this }, e, t)) ? (e = e.substring(o.raw.length), t.push(o), true) : false)) continue;
565
+ if (o = this.tokenizer.escape(e)) {
566
+ e = e.substring(o.raw.length), t.push(o);
567
+ continue;
1232
568
  }
1233
- }
1234
- return value;
1235
- };
1236
- const _setAttributeValue = function _setAttributeValue2(currentNode, name, namespaceURI, value) {
1237
- try {
1238
- if (namespaceURI) {
1239
- currentNode.setAttributeNS(namespaceURI, name, value);
1240
- } else {
1241
- currentNode.setAttribute(name, value);
569
+ if (o = this.tokenizer.tag(e)) {
570
+ e = e.substring(o.raw.length), t.push(o);
571
+ continue;
1242
572
  }
1243
- if (_isClobbered(currentNode)) {
1244
- _forceRemove(currentNode);
1245
- } else {
1246
- arrayPop(DOMPurify.removed);
573
+ if (o = this.tokenizer.link(e)) {
574
+ e = e.substring(o.raw.length), t.push(o);
575
+ continue;
1247
576
  }
1248
- } catch (_) {
1249
- _removeAttribute(name, currentNode);
1250
- }
1251
- };
1252
- const _sanitizeAttributes = function _sanitizeAttributes2(currentNode) {
1253
- _executeHooks(hooks.beforeSanitizeAttributes, currentNode, null);
1254
- const attributes = currentNode.attributes;
1255
- if (!attributes || _isClobbered(currentNode)) {
1256
- return;
1257
- }
1258
- ALLOWED_ATTR = _forkSharedAllowlist(hooks.uponSanitizeAttribute, ALLOWED_ATTR, DEFAULT_ALLOWED_ATTR, SET_CONFIG_ALLOWED_ATTR);
1259
- const hookEvent = {
1260
- attrName: "",
1261
- attrValue: "",
1262
- keepAttr: true,
1263
- allowedAttributes: ALLOWED_ATTR,
1264
- forceKeepAttr: void 0
1265
- };
1266
- let l = attributes.length;
1267
- const lcTag = transformCaseFunc(currentNode.nodeName);
1268
- while (l--) {
1269
- const attr = attributes[l];
1270
- const name = attr.name, namespaceURI = attr.namespaceURI, attrValue = attr.value;
1271
- const lcName = transformCaseFunc(name);
1272
- const initValue = attrValue;
1273
- let value = name === "value" ? initValue : stringTrim(initValue);
1274
- hookEvent.attrName = lcName;
1275
- hookEvent.attrValue = value;
1276
- hookEvent.keepAttr = true;
1277
- hookEvent.forceKeepAttr = void 0;
1278
- _executeHooks(hooks.uponSanitizeAttribute, currentNode, hookEvent);
1279
- value = hookEvent.attrValue;
1280
- if (SANITIZE_NAMED_PROPS && (lcName === "id" || lcName === "name") && stringIndexOf(value, SANITIZE_NAMED_PROPS_PREFIX) !== 0) {
1281
- _removeAttribute(name, currentNode, attr);
1282
- value = SANITIZE_NAMED_PROPS_PREFIX + value;
577
+ if (o = this.tokenizer.reflink(e, this.tokens.links)) {
578
+ e = e.substring(o.raw.length);
579
+ let p = t.at(-1);
580
+ o.type === "text" && (p == null ? void 0 : p.type) === "text" ? (p.raw += o.raw, p.text += o.text) : t.push(o);
581
+ continue;
1283
582
  }
1284
- if (SAFE_FOR_XML && regExpTest(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i, value)) {
1285
- _removeAttribute(name, currentNode, attr);
583
+ if (o = this.tokenizer.emStrong(e, n, a)) {
584
+ e = e.substring(o.raw.length), t.push(o);
1286
585
  continue;
1287
586
  }
1288
- if (lcName === "attributename" && stringMatch(value, "href")) {
1289
- _removeAttribute(name, currentNode, attr);
587
+ if (o = this.tokenizer.codespan(e)) {
588
+ e = e.substring(o.raw.length), t.push(o);
1290
589
  continue;
1291
590
  }
1292
- if (hookEvent.forceKeepAttr) {
591
+ if (o = this.tokenizer.br(e)) {
592
+ e = e.substring(o.raw.length), t.push(o);
1293
593
  continue;
1294
594
  }
1295
- if (!hookEvent.keepAttr) {
1296
- _removeAttribute(name, currentNode, attr);
595
+ if (o = this.tokenizer.del(e, n, a)) {
596
+ e = e.substring(o.raw.length), t.push(o);
1297
597
  continue;
1298
598
  }
1299
- if (!ALLOW_SELF_CLOSE_IN_ATTR && regExpTest(SELF_CLOSING_TAG, value)) {
1300
- _removeAttribute(name, currentNode, attr);
599
+ if (o = this.tokenizer.autolink(e)) {
600
+ e = e.substring(o.raw.length), t.push(o);
1301
601
  continue;
1302
602
  }
1303
- if (SAFE_FOR_TEMPLATES) {
1304
- value = _stripTemplateExpressions(value);
603
+ if (!this.state.inLink && (o = this.tokenizer.url(e))) {
604
+ e = e.substring(o.raw.length), t.push(o);
605
+ continue;
1305
606
  }
1306
- if (!_isValidAttribute(lcTag, lcName, value)) {
1307
- _removeAttribute(name, currentNode, attr);
607
+ let l = e;
608
+ if ((_e2 = this.options.extensions) == null ? void 0 : _e2.startInline) {
609
+ let p = 1 / 0, c = e.slice(1), d;
610
+ this.options.extensions.startInline.forEach((h) => {
611
+ d = h.call({ lexer: this }, c), typeof d == "number" && d >= 0 && (p = Math.min(p, d));
612
+ }), p < 1 / 0 && p >= 0 && (l = e.substring(0, p + 1));
613
+ }
614
+ if (o = this.tokenizer.inlineText(l)) {
615
+ e = e.substring(o.raw.length), o.raw.slice(-1) !== "_" && (a = o.raw.slice(-1)), s = true;
616
+ let p = t.at(-1);
617
+ (p == null ? void 0 : p.type) === "text" ? (p.raw += o.raw, p.text += o.text) : t.push(o);
1308
618
  continue;
1309
619
  }
1310
- value = _applyTrustedTypesToAttribute(lcTag, lcName, namespaceURI, value);
1311
- if (value !== initValue) {
1312
- _setAttributeValue(currentNode, name, namespaceURI, value);
620
+ if (e) {
621
+ let p = "Infinite loop on byte: " + e.charCodeAt(0);
622
+ if (this.options.silent) {
623
+ console.error(p);
624
+ break;
625
+ } else throw new Error(p);
1313
626
  }
1314
627
  }
1315
- _executeHooks(hooks.afterSanitizeAttributes, currentNode, null);
1316
- };
1317
- const _sanitizeShadowDOM2 = function _sanitizeShadowDOM(fragment) {
1318
- let shadowNode = null;
1319
- const shadowIterator = _createNodeIterator(fragment);
1320
- _executeHooks(hooks.beforeSanitizeShadowDOM, fragment, null);
1321
- while (shadowNode = shadowIterator.nextNode()) {
1322
- _executeHooks(hooks.uponSanitizeShadowNode, shadowNode, null);
1323
- _sanitizeElements(shadowNode, fragment);
1324
- _sanitizeAttributes(shadowNode);
1325
- if (_isDocumentFragment(shadowNode.content)) {
1326
- _sanitizeShadowDOM2(shadowNode.content);
1327
- }
1328
- if (_readNodeType(shadowNode) === NODE_TYPE.element) {
1329
- const innerSr = getShadowRoot(shadowNode);
1330
- if (_isDocumentFragment(innerSr)) {
1331
- _sanitizeAttachedShadowRoots(innerSr);
1332
- _sanitizeShadowDOM2(innerSr);
628
+ return t;
629
+ }
630
+ };
631
+ var y = class {
632
+ constructor(e) {
633
+ __publicField(this, "options");
634
+ __publicField(this, "parser");
635
+ this.options = e || O;
636
+ }
637
+ space(e) {
638
+ return "";
639
+ }
640
+ code({ text: e, lang: t, escaped: n }) {
641
+ var _a2;
642
+ let r = (_a2 = (t || "").match(m.notSpaceStart)) == null ? void 0 : _a2[0], i = e.replace(m.endingNewline, "") + `
643
+ `;
644
+ return r ? '<pre><code class="language-' + T(r) + '">' + (n ? i : T(i, true)) + `</code></pre>
645
+ ` : "<pre><code>" + (n ? i : T(i, true)) + `</code></pre>
646
+ `;
647
+ }
648
+ blockquote({ tokens: e }) {
649
+ return `<blockquote>
650
+ ${this.parser.parse(e)}</blockquote>
651
+ `;
652
+ }
653
+ html({ text: e }) {
654
+ return e;
655
+ }
656
+ def(e) {
657
+ return "";
658
+ }
659
+ heading({ tokens: e, depth: t }) {
660
+ return `<h${t}>${this.parser.parseInline(e)}</h${t}>
661
+ `;
662
+ }
663
+ hr(e) {
664
+ return `<hr>
665
+ `;
666
+ }
667
+ list(e) {
668
+ let t = e.ordered, n = e.start, r = "";
669
+ for (let a = 0; a < e.items.length; a++) {
670
+ let o = e.items[a];
671
+ r += this.listitem(o);
672
+ }
673
+ let i = t ? "ol" : "ul", s = t && n !== 1 ? ' start="' + n + '"' : "";
674
+ return "<" + i + s + `>
675
+ ` + r + "</" + i + `>
676
+ `;
677
+ }
678
+ listitem(e) {
679
+ return `<li>${this.parser.parse(e.tokens)}</li>
680
+ `;
681
+ }
682
+ checkbox({ checked: e }) {
683
+ return "<input " + (e ? 'checked="" ' : "") + 'disabled="" type="checkbox"> ';
684
+ }
685
+ paragraph({ tokens: e }) {
686
+ return `<p>${this.parser.parseInline(e)}</p>
687
+ `;
688
+ }
689
+ table(e) {
690
+ let t = "", n = "";
691
+ for (let i = 0; i < e.header.length; i++) n += this.tablecell(e.header[i]);
692
+ t += this.tablerow({ text: n });
693
+ let r = "";
694
+ for (let i = 0; i < e.rows.length; i++) {
695
+ let s = e.rows[i];
696
+ n = "";
697
+ for (let a = 0; a < s.length; a++) n += this.tablecell(s[a]);
698
+ r += this.tablerow({ text: n });
699
+ }
700
+ return r && (r = `<tbody>${r}</tbody>`), `<table>
701
+ <thead>
702
+ ` + t + `</thead>
703
+ ` + r + `</table>
704
+ `;
705
+ }
706
+ tablerow({ text: e }) {
707
+ return `<tr>
708
+ ${e}</tr>
709
+ `;
710
+ }
711
+ tablecell(e) {
712
+ let t = this.parser.parseInline(e.tokens), n = e.header ? "th" : "td";
713
+ return (e.align ? `<${n} align="${e.align}">` : `<${n}>`) + t + `</${n}>
714
+ `;
715
+ }
716
+ strong({ tokens: e }) {
717
+ return `<strong>${this.parser.parseInline(e)}</strong>`;
718
+ }
719
+ em({ tokens: e }) {
720
+ return `<em>${this.parser.parseInline(e)}</em>`;
721
+ }
722
+ codespan({ text: e }) {
723
+ return `<code>${T(e, true)}</code>`;
724
+ }
725
+ br(e) {
726
+ return "<br>";
727
+ }
728
+ del({ tokens: e }) {
729
+ return `<del>${this.parser.parseInline(e)}</del>`;
730
+ }
731
+ link({ href: e, title: t, tokens: n }) {
732
+ let r = this.parser.parseInline(n), i = J(e);
733
+ if (i === null) return r;
734
+ e = i;
735
+ let s = '<a href="' + e + '"';
736
+ return t && (s += ' title="' + T(t) + '"'), s += ">" + r + "</a>", s;
737
+ }
738
+ image({ href: e, title: t, text: n, tokens: r }) {
739
+ r && (n = this.parser.parseInline(r, this.parser.textRenderer));
740
+ let i = J(e);
741
+ if (i === null) return T(n);
742
+ e = i;
743
+ let s = `<img src="${e}" alt="${T(n)}"`;
744
+ return t && (s += ` title="${T(t)}"`), s += ">", s;
745
+ }
746
+ text(e) {
747
+ return "tokens" in e && e.tokens ? this.parser.parseInline(e.tokens) : "escaped" in e && e.escaped ? e.text : T(e.text);
748
+ }
749
+ };
750
+ var $ = class {
751
+ strong({ text: e }) {
752
+ return e;
753
+ }
754
+ em({ text: e }) {
755
+ return e;
756
+ }
757
+ codespan({ text: e }) {
758
+ return e;
759
+ }
760
+ del({ text: e }) {
761
+ return e;
762
+ }
763
+ html({ text: e }) {
764
+ return e;
765
+ }
766
+ text({ text: e }) {
767
+ return e;
768
+ }
769
+ link({ text: e }) {
770
+ return "" + e;
771
+ }
772
+ image({ text: e }) {
773
+ return "" + e;
774
+ }
775
+ br() {
776
+ return "";
777
+ }
778
+ checkbox({ raw: e }) {
779
+ return e;
780
+ }
781
+ };
782
+ var b = class u2 {
783
+ constructor(e) {
784
+ __publicField(this, "options");
785
+ __publicField(this, "renderer");
786
+ __publicField(this, "textRenderer");
787
+ this.options = e || O, this.options.renderer = this.options.renderer || new y(), this.renderer = this.options.renderer, this.renderer.options = this.options, this.renderer.parser = this, this.textRenderer = new $();
788
+ }
789
+ static parse(e, t) {
790
+ return new u2(t).parse(e);
791
+ }
792
+ static parseInline(e, t) {
793
+ return new u2(t).parseInline(e);
794
+ }
795
+ parse(e) {
796
+ var _a2, _b;
797
+ this.renderer.parser = this;
798
+ let t = "";
799
+ for (let n = 0; n < e.length; n++) {
800
+ let r = e[n];
801
+ if ((_b = (_a2 = this.options.extensions) == null ? void 0 : _a2.renderers) == null ? void 0 : _b[r.type]) {
802
+ let s = r, a = this.options.extensions.renderers[s.type].call({ parser: this }, s);
803
+ if (a !== false || !["space", "hr", "heading", "code", "table", "blockquote", "list", "html", "def", "paragraph", "text"].includes(s.type)) {
804
+ t += a || "";
805
+ continue;
1333
806
  }
1334
807
  }
1335
- }
1336
- _executeHooks(hooks.afterSanitizeShadowDOM, fragment, null);
1337
- };
1338
- const _sanitizeAttachedShadowRoots = function _sanitizeAttachedShadowRoots2(root) {
1339
- const stack = [{
1340
- node: root,
1341
- shadow: null
1342
- }];
1343
- while (stack.length > 0) {
1344
- const item = stack.pop();
1345
- if (item.shadow) {
1346
- _sanitizeShadowDOM2(item.shadow);
1347
- continue;
1348
- }
1349
- const node = item.node;
1350
- const nodeType = _readNodeType(node);
1351
- const isElement = nodeType === NODE_TYPE.element;
1352
- const childNodes = getChildNodes(node);
1353
- if (childNodes) {
1354
- for (let i = childNodes.length - 1; i >= 0; --i) {
1355
- stack.push({
1356
- node: childNodes[i],
1357
- shadow: null
1358
- });
808
+ let i = r;
809
+ switch (i.type) {
810
+ case "space": {
811
+ t += this.renderer.space(i);
812
+ break;
1359
813
  }
1360
- }
1361
- if (isElement) {
1362
- const rootName = getNodeName ? getNodeName(node) : null;
1363
- if (typeof rootName === "string" && transformCaseFunc(rootName) === "template") {
1364
- const content = node.content;
1365
- if (_isDocumentFragment(content)) {
1366
- stack.push({
1367
- node: content,
1368
- shadow: null
1369
- });
1370
- }
814
+ case "hr": {
815
+ t += this.renderer.hr(i);
816
+ break;
1371
817
  }
1372
- }
1373
- if (isElement) {
1374
- const sr = getShadowRoot(node);
1375
- if (_isDocumentFragment(sr)) {
1376
- stack.push({
1377
- node: null,
1378
- shadow: sr
1379
- }, {
1380
- node: sr,
1381
- shadow: null
1382
- });
818
+ case "heading": {
819
+ t += this.renderer.heading(i);
820
+ break;
1383
821
  }
1384
- }
1385
- }
1386
- };
1387
- DOMPurify.sanitize = function(dirty) {
1388
- let cfg = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
1389
- let body = null;
1390
- let importedNode = null;
1391
- let currentNode = null;
1392
- let returnNode = null;
1393
- IS_EMPTY_INPUT = !dirty;
1394
- if (IS_EMPTY_INPUT) {
1395
- dirty = "<!-->";
1396
- }
1397
- if (typeof dirty !== "string" && !_isNode(dirty)) {
1398
- dirty = stringifyValue(dirty);
1399
- if (typeof dirty !== "string") {
1400
- throw typeErrorCreate("dirty is not a string, aborting");
1401
- }
1402
- }
1403
- if (!DOMPurify.isSupported) {
1404
- return dirty;
1405
- }
1406
- if (SET_CONFIG) {
1407
- ALLOWED_TAGS = SET_CONFIG_ALLOWED_TAGS;
1408
- ALLOWED_ATTR = SET_CONFIG_ALLOWED_ATTR;
1409
- } else {
1410
- _parseConfig(cfg);
1411
- }
1412
- if (hooks.uponSanitizeElement.length > 0 || hooks.uponSanitizeAttribute.length > 0) {
1413
- ALLOWED_TAGS = clone(ALLOWED_TAGS);
1414
- }
1415
- if (hooks.uponSanitizeAttribute.length > 0) {
1416
- ALLOWED_ATTR = clone(ALLOWED_ATTR);
1417
- }
1418
- DOMPurify.removed = [];
1419
- const inPlace = IN_PLACE && typeof dirty !== "string" && _isNode(dirty);
1420
- if (inPlace) {
1421
- _neutralizePatchLinkage(dirty);
1422
- const nn = _readNodeName(dirty);
1423
- if (typeof nn === "string") {
1424
- const tagName = transformCaseFunc(nn);
1425
- if (!ALLOWED_TAGS[tagName] || FORBID_TAGS[tagName]) {
1426
- _neutralizeRoot(dirty);
1427
- throw typeErrorCreate("root node is forbidden and cannot be sanitized in-place");
822
+ case "code": {
823
+ t += this.renderer.code(i);
824
+ break;
825
+ }
826
+ case "table": {
827
+ t += this.renderer.table(i);
828
+ break;
829
+ }
830
+ case "blockquote": {
831
+ t += this.renderer.blockquote(i);
832
+ break;
833
+ }
834
+ case "list": {
835
+ t += this.renderer.list(i);
836
+ break;
837
+ }
838
+ case "checkbox": {
839
+ t += this.renderer.checkbox(i);
840
+ break;
841
+ }
842
+ case "html": {
843
+ t += this.renderer.html(i);
844
+ break;
845
+ }
846
+ case "def": {
847
+ t += this.renderer.def(i);
848
+ break;
849
+ }
850
+ case "paragraph": {
851
+ t += this.renderer.paragraph(i);
852
+ break;
853
+ }
854
+ case "text": {
855
+ t += this.renderer.text(i);
856
+ break;
857
+ }
858
+ default: {
859
+ let s = 'Token with "' + i.type + '" type was not found.';
860
+ if (this.options.silent) return console.error(s), "";
861
+ throw new Error(s);
1428
862
  }
1429
863
  }
1430
- if (_isClobbered(dirty)) {
1431
- _neutralizeRoot(dirty);
1432
- throw typeErrorCreate("root node is clobbered and cannot be sanitized in-place");
1433
- }
1434
- try {
1435
- _sanitizeAttachedShadowRoots(dirty);
1436
- } catch (error) {
1437
- _neutralizeRoot(dirty);
1438
- throw error;
1439
- }
1440
- } else if (_isNode(dirty)) {
1441
- body = _initDocument("<!---->");
1442
- importedNode = body.ownerDocument.importNode(dirty, true);
1443
- if (importedNode.nodeType === NODE_TYPE.element && importedNode.nodeName === "BODY") {
1444
- body = importedNode;
1445
- } else if (importedNode.nodeName === "HTML") {
1446
- body = importedNode;
1447
- } else {
1448
- body.appendChild(importedNode);
1449
- }
1450
- _sanitizeAttachedShadowRoots(importedNode);
1451
- } else {
1452
- if (!RETURN_DOM && !SAFE_FOR_TEMPLATES && !WHOLE_DOCUMENT && // eslint-disable-next-line unicorn/prefer-includes
1453
- dirty.indexOf("<") === -1) {
1454
- return trustedTypesPolicy && RETURN_TRUSTED_TYPE ? _createTrustedHTML(dirty) : dirty;
1455
- }
1456
- body = _initDocument(dirty);
1457
- if (!body) {
1458
- return RETURN_DOM ? null : RETURN_TRUSTED_TYPE ? emptyHTML : "";
1459
- }
1460
- }
1461
- if (body && FORCE_BODY) {
1462
- _forceRemove(body.firstChild);
1463
864
  }
1464
- const walkRoot = inPlace ? dirty : body;
1465
- try {
1466
- const nodeIterator = _createNodeIterator(walkRoot);
1467
- while (currentNode = nodeIterator.nextNode()) {
1468
- _sanitizeElements(currentNode, walkRoot);
1469
- _sanitizeAttributes(currentNode);
1470
- if (_isDocumentFragment(currentNode.content)) {
1471
- _sanitizeShadowDOM2(currentNode.content);
865
+ return t;
866
+ }
867
+ parseInline(e, t = this.renderer) {
868
+ var _a2, _b;
869
+ this.renderer.parser = this;
870
+ let n = "";
871
+ for (let r = 0; r < e.length; r++) {
872
+ let i = e[r];
873
+ if ((_b = (_a2 = this.options.extensions) == null ? void 0 : _a2.renderers) == null ? void 0 : _b[i.type]) {
874
+ let a = this.options.extensions.renderers[i.type].call({ parser: this }, i);
875
+ if (a !== false || !["escape", "html", "link", "image", "strong", "em", "codespan", "br", "del", "text"].includes(i.type)) {
876
+ n += a || "";
877
+ continue;
1472
878
  }
1473
879
  }
1474
- } catch (error) {
1475
- if (inPlace) {
1476
- _neutralizeRoot(dirty);
1477
- arrayForEach(DOMPurify.removed, (entry) => {
1478
- if (entry.element) {
1479
- _neutralizeSubtree(entry.element);
1480
- }
1481
- });
1482
- }
1483
- throw error;
1484
- }
1485
- if (inPlace) {
1486
- arrayForEach(DOMPurify.removed, (entry) => {
1487
- if (entry.element) {
1488
- _neutralizeSubtree(entry.element);
880
+ let s = i;
881
+ switch (s.type) {
882
+ case "escape": {
883
+ n += t.text(s);
884
+ break;
885
+ }
886
+ case "html": {
887
+ n += t.html(s);
888
+ break;
889
+ }
890
+ case "link": {
891
+ n += t.link(s);
892
+ break;
893
+ }
894
+ case "image": {
895
+ n += t.image(s);
896
+ break;
897
+ }
898
+ case "checkbox": {
899
+ n += t.checkbox(s);
900
+ break;
901
+ }
902
+ case "strong": {
903
+ n += t.strong(s);
904
+ break;
905
+ }
906
+ case "em": {
907
+ n += t.em(s);
908
+ break;
909
+ }
910
+ case "codespan": {
911
+ n += t.codespan(s);
912
+ break;
913
+ }
914
+ case "br": {
915
+ n += t.br(s);
916
+ break;
917
+ }
918
+ case "del": {
919
+ n += t.del(s);
920
+ break;
921
+ }
922
+ case "text": {
923
+ n += t.text(s);
924
+ break;
925
+ }
926
+ default: {
927
+ let a = 'Token with "' + s.type + '" type was not found.';
928
+ if (this.options.silent) return console.error(a), "";
929
+ throw new Error(a);
1489
930
  }
1490
- });
1491
- if (SAFE_FOR_TEMPLATES) {
1492
- _scrubTemplateExpressions2(dirty);
1493
931
  }
1494
- return dirty;
1495
932
  }
1496
- if (RETURN_DOM) {
1497
- if (SAFE_FOR_TEMPLATES) {
1498
- _scrubTemplateExpressions2(body);
1499
- }
1500
- if (RETURN_DOM_FRAGMENT) {
1501
- returnNode = createDocumentFragment.call(body.ownerDocument);
1502
- while (body.firstChild) {
1503
- returnNode.appendChild(body.firstChild);
933
+ return n;
934
+ }
935
+ };
936
+ var P = (_a = class {
937
+ constructor(e) {
938
+ __publicField(this, "options");
939
+ __publicField(this, "block");
940
+ this.options = e || O;
941
+ }
942
+ preprocess(e) {
943
+ return e;
944
+ }
945
+ postprocess(e) {
946
+ return e;
947
+ }
948
+ processAllTokens(e) {
949
+ return e;
950
+ }
951
+ emStrongMask(e) {
952
+ return e;
953
+ }
954
+ provideLexer(e = this.block) {
955
+ return e ? x.lex : x.lexInline;
956
+ }
957
+ provideParser(e = this.block) {
958
+ return e ? b.parse : b.parseInline;
959
+ }
960
+ }, __publicField(_a, "passThroughHooks", /* @__PURE__ */ new Set(["preprocess", "postprocess", "processAllTokens", "emStrongMask"])), __publicField(_a, "passThroughHooksRespectAsync", /* @__PURE__ */ new Set(["preprocess", "postprocess", "processAllTokens"])), _a);
961
+ var D = class {
962
+ constructor(...e) {
963
+ __publicField(this, "defaults", M());
964
+ __publicField(this, "options", this.setOptions);
965
+ __publicField(this, "parse", this.parseMarkdown(true));
966
+ __publicField(this, "parseInline", this.parseMarkdown(false));
967
+ __publicField(this, "Parser", b);
968
+ __publicField(this, "Renderer", y);
969
+ __publicField(this, "TextRenderer", $);
970
+ __publicField(this, "Lexer", x);
971
+ __publicField(this, "Tokenizer", w);
972
+ __publicField(this, "Hooks", P);
973
+ this.use(...e);
974
+ }
975
+ walkTokens(e, t) {
976
+ var _a2, _b;
977
+ let n = [];
978
+ for (let r of e) switch (n = n.concat(t.call(this, r)), r.type) {
979
+ case "table": {
980
+ let i = r;
981
+ for (let s of i.header) n = n.concat(this.walkTokens(s.tokens, t));
982
+ for (let s of i.rows) for (let a of s) n = n.concat(this.walkTokens(a.tokens, t));
983
+ break;
984
+ }
985
+ case "list": {
986
+ let i = r;
987
+ n = n.concat(this.walkTokens(i.items, t));
988
+ break;
989
+ }
990
+ default: {
991
+ let i = r;
992
+ ((_b = (_a2 = this.defaults.extensions) == null ? void 0 : _a2.childTokens) == null ? void 0 : _b[i.type]) ? this.defaults.extensions.childTokens[i.type].forEach((s) => {
993
+ let a = i[s].flat(1 / 0);
994
+ n = n.concat(this.walkTokens(a, t));
995
+ }) : i.tokens && (n = n.concat(this.walkTokens(i.tokens, t)));
996
+ }
997
+ }
998
+ return n;
999
+ }
1000
+ use(...e) {
1001
+ let t = this.defaults.extensions || { renderers: {}, childTokens: {} };
1002
+ return e.forEach((n) => {
1003
+ let r = { ...n };
1004
+ if (r.async = this.defaults.async || r.async || false, n.extensions && (n.extensions.forEach((i) => {
1005
+ if (!i.name) throw new Error("extension name required");
1006
+ if ("renderer" in i) {
1007
+ let s = t.renderers[i.name];
1008
+ s ? t.renderers[i.name] = function(...a) {
1009
+ let o = i.renderer.apply(this, a);
1010
+ return o === false && (o = s.apply(this, a)), o;
1011
+ } : t.renderers[i.name] = i.renderer;
1504
1012
  }
1505
- } else {
1506
- returnNode = body;
1013
+ if ("tokenizer" in i) {
1014
+ if (!i.level || i.level !== "block" && i.level !== "inline") throw new Error("extension level must be 'block' or 'inline'");
1015
+ let s = t[i.level];
1016
+ s ? s.unshift(i.tokenizer) : t[i.level] = [i.tokenizer], i.start && (i.level === "block" ? t.startBlock ? t.startBlock.push(i.start) : t.startBlock = [i.start] : i.level === "inline" && (t.startInline ? t.startInline.push(i.start) : t.startInline = [i.start]));
1017
+ }
1018
+ "childTokens" in i && i.childTokens && (t.childTokens[i.name] = i.childTokens);
1019
+ }), r.extensions = t), n.renderer) {
1020
+ let i = this.defaults.renderer || new y(this.defaults);
1021
+ for (let s in n.renderer) {
1022
+ if (!(s in i)) throw new Error(`renderer '${s}' does not exist`);
1023
+ if (["options", "parser"].includes(s)) continue;
1024
+ let a = s, o = n.renderer[a], l = i[a];
1025
+ i[a] = (...p) => {
1026
+ let c = o.apply(i, p);
1027
+ return c === false && (c = l.apply(i, p)), c || "";
1028
+ };
1029
+ }
1030
+ r.renderer = i;
1031
+ }
1032
+ if (n.tokenizer) {
1033
+ let i = this.defaults.tokenizer || new w(this.defaults);
1034
+ for (let s in n.tokenizer) {
1035
+ if (!(s in i)) throw new Error(`tokenizer '${s}' does not exist`);
1036
+ if (["options", "rules", "lexer"].includes(s)) continue;
1037
+ let a = s, o = n.tokenizer[a], l = i[a];
1038
+ i[a] = (...p) => {
1039
+ let c = o.apply(i, p);
1040
+ return c === false && (c = l.apply(i, p)), c;
1041
+ };
1042
+ }
1043
+ r.tokenizer = i;
1044
+ }
1045
+ if (n.hooks) {
1046
+ let i = this.defaults.hooks || new P();
1047
+ for (let s in n.hooks) {
1048
+ if (!(s in i)) throw new Error(`hook '${s}' does not exist`);
1049
+ if (["options", "block"].includes(s)) continue;
1050
+ let a = s, o = n.hooks[a], l = i[a];
1051
+ P.passThroughHooks.has(s) ? i[a] = (p) => {
1052
+ if (this.defaults.async && P.passThroughHooksRespectAsync.has(s)) return (async () => {
1053
+ let d = await o.call(i, p);
1054
+ return l.call(i, d);
1055
+ })();
1056
+ let c = o.call(i, p);
1057
+ return l.call(i, c);
1058
+ } : i[a] = (...p) => {
1059
+ if (this.defaults.async) return (async () => {
1060
+ let d = await o.apply(i, p);
1061
+ return d === false && (d = await l.apply(i, p)), d;
1062
+ })();
1063
+ let c = o.apply(i, p);
1064
+ return c === false && (c = l.apply(i, p)), c;
1065
+ };
1066
+ }
1067
+ r.hooks = i;
1507
1068
  }
1508
- if (ALLOWED_ATTR.shadowroot || ALLOWED_ATTR.shadowrootmode) {
1509
- returnNode = importNode.call(originalDocument, returnNode, true);
1069
+ if (n.walkTokens) {
1070
+ let i = this.defaults.walkTokens, s = n.walkTokens;
1071
+ r.walkTokens = function(a) {
1072
+ let o = [];
1073
+ return o.push(s.call(this, a)), i && (o = o.concat(i.call(this, a))), o;
1074
+ };
1510
1075
  }
1511
- return returnNode;
1512
- }
1513
- let serializedHTML = WHOLE_DOCUMENT ? body.outerHTML : body.innerHTML;
1514
- if (WHOLE_DOCUMENT && ALLOWED_TAGS["!doctype"] && body.ownerDocument && body.ownerDocument.doctype && body.ownerDocument.doctype.name && regExpTest(DOCTYPE_NAME, body.ownerDocument.doctype.name)) {
1515
- serializedHTML = "<!DOCTYPE " + body.ownerDocument.doctype.name + ">\n" + serializedHTML;
1516
- }
1517
- if (SAFE_FOR_TEMPLATES) {
1518
- serializedHTML = _stripTemplateExpressions(serializedHTML);
1519
- }
1520
- return trustedTypesPolicy && RETURN_TRUSTED_TYPE ? _createTrustedHTML(serializedHTML) : serializedHTML;
1521
- };
1522
- DOMPurify.setConfig = function() {
1523
- let cfg = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
1524
- _parseConfig(cfg);
1525
- SET_CONFIG = true;
1526
- SET_CONFIG_ALLOWED_TAGS = ALLOWED_TAGS;
1527
- SET_CONFIG_ALLOWED_ATTR = ALLOWED_ATTR;
1528
- };
1529
- DOMPurify.clearConfig = function() {
1530
- CONFIG = null;
1531
- SET_CONFIG = false;
1532
- SET_CONFIG_ALLOWED_TAGS = null;
1533
- SET_CONFIG_ALLOWED_ATTR = null;
1534
- trustedTypesPolicy = defaultTrustedTypesPolicy;
1535
- emptyHTML = "";
1536
- };
1537
- DOMPurify.isValidAttribute = function(tag, attr, value) {
1538
- if (!CONFIG) {
1539
- _parseConfig({});
1540
- }
1541
- const lcTag = transformCaseFunc(tag);
1542
- const lcName = transformCaseFunc(attr);
1543
- return _isValidAttribute(lcTag, lcName, value);
1544
- };
1545
- DOMPurify.addHook = function(entryPoint, hookFunction) {
1546
- if (typeof hookFunction !== "function") {
1547
- return;
1548
- }
1549
- if (!objectHasOwnProperty(hooks, entryPoint)) {
1550
- return;
1551
- }
1552
- arrayPush(hooks[entryPoint], hookFunction);
1553
- };
1554
- DOMPurify.removeHook = function(entryPoint, hookFunction) {
1555
- if (!objectHasOwnProperty(hooks, entryPoint)) {
1556
- return void 0;
1557
- }
1558
- if (hookFunction !== void 0) {
1559
- const index = arrayLastIndexOf(hooks[entryPoint], hookFunction);
1560
- return index === -1 ? void 0 : arraySplice(hooks[entryPoint], index, 1)[0];
1561
- }
1562
- return arrayPop(hooks[entryPoint]);
1563
- };
1564
- DOMPurify.removeHooks = function(entryPoint) {
1565
- if (!objectHasOwnProperty(hooks, entryPoint)) {
1566
- return;
1567
- }
1568
- hooks[entryPoint] = [];
1569
- };
1570
- DOMPurify.removeAllHooks = function() {
1571
- hooks = _createHooksMap();
1572
- };
1573
- return DOMPurify;
1076
+ this.defaults = { ...this.defaults, ...r };
1077
+ }), this;
1078
+ }
1079
+ setOptions(e) {
1080
+ return this.defaults = { ...this.defaults, ...e }, this;
1081
+ }
1082
+ lexer(e, t) {
1083
+ return x.lex(e, t ?? this.defaults);
1084
+ }
1085
+ parser(e, t) {
1086
+ return b.parse(e, t ?? this.defaults);
1087
+ }
1088
+ parseMarkdown(e) {
1089
+ return (n, r) => {
1090
+ let i = { ...r }, s = { ...this.defaults, ...i }, a = this.onError(!!s.silent, !!s.async);
1091
+ if (this.defaults.async === true && i.async === false) return a(new Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise."));
1092
+ if (typeof n > "u" || n === null) return a(new Error("marked(): input parameter is undefined or null"));
1093
+ if (typeof n != "string") return a(new Error("marked(): input parameter is of type " + Object.prototype.toString.call(n) + ", string expected"));
1094
+ if (s.hooks && (s.hooks.options = s, s.hooks.block = e), s.async) return (async () => {
1095
+ let o = s.hooks ? await s.hooks.preprocess(n) : n, p = await (s.hooks ? await s.hooks.provideLexer(e) : e ? x.lex : x.lexInline)(o, s), c = s.hooks ? await s.hooks.processAllTokens(p) : p;
1096
+ s.walkTokens && await Promise.all(this.walkTokens(c, s.walkTokens));
1097
+ let h = await (s.hooks ? await s.hooks.provideParser(e) : e ? b.parse : b.parseInline)(c, s);
1098
+ return s.hooks ? await s.hooks.postprocess(h) : h;
1099
+ })().catch(a);
1100
+ try {
1101
+ s.hooks && (n = s.hooks.preprocess(n));
1102
+ let l = (s.hooks ? s.hooks.provideLexer(e) : e ? x.lex : x.lexInline)(n, s);
1103
+ s.hooks && (l = s.hooks.processAllTokens(l)), s.walkTokens && this.walkTokens(l, s.walkTokens);
1104
+ let c = (s.hooks ? s.hooks.provideParser(e) : e ? b.parse : b.parseInline)(l, s);
1105
+ return s.hooks && (c = s.hooks.postprocess(c)), c;
1106
+ } catch (o) {
1107
+ return a(o);
1108
+ }
1109
+ };
1110
+ }
1111
+ onError(e, t) {
1112
+ return (n) => {
1113
+ if (n.message += `
1114
+ Please report this to https://github.com/markedjs/marked.`, e) {
1115
+ let r = "<p>An error occurred:</p><pre>" + T(n.message + "", true) + "</pre>";
1116
+ return t ? Promise.resolve(r) : r;
1117
+ }
1118
+ if (t) return Promise.reject(n);
1119
+ throw n;
1120
+ };
1121
+ }
1122
+ };
1123
+ var L = new D();
1124
+ function g(u3, e) {
1125
+ return L.parse(u3, e);
1574
1126
  }
1575
- var purify = createDOMPurify();
1127
+ g.options = g.setOptions = function(u3) {
1128
+ return L.setOptions(u3), g.defaults = L.defaults, G(g.defaults), g;
1129
+ };
1130
+ g.getDefaults = M;
1131
+ g.defaults = O;
1132
+ g.use = function(...u3) {
1133
+ return L.use(...u3), g.defaults = L.defaults, G(g.defaults), g;
1134
+ };
1135
+ g.walkTokens = function(u3, e) {
1136
+ return L.walkTokens(u3, e);
1137
+ };
1138
+ g.parseInline = L.parseInline;
1139
+ g.Parser = b;
1140
+ g.parser = b.parse;
1141
+ g.Renderer = y;
1142
+ g.TextRenderer = $;
1143
+ g.Lexer = x;
1144
+ g.lexer = x.lex;
1145
+ g.Tokenizer = w;
1146
+ g.Hooks = P;
1147
+ g.parse = g;
1148
+ g.options;
1149
+ g.setOptions;
1150
+ g.use;
1151
+ g.walkTokens;
1152
+ g.parseInline;
1153
+ b.parse;
1154
+ x.lex;
1576
1155
  export {
1577
- purify as default
1156
+ P as Hooks,
1157
+ x as Lexer,
1158
+ D as Marked,
1159
+ b as Parser,
1160
+ y as Renderer,
1161
+ $ as TextRenderer,
1162
+ w as Tokenizer,
1163
+ O as defaults,
1164
+ M as getDefaults,
1165
+ g as marked
1578
1166
  };
1579
1167
  //# sourceMappingURL=index131.js.map