@anyblock/remark-any-block 1.0.3-beta1 → 3.4.11

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.
@@ -38,6 +38,16 @@ function jsdom_disable() {
38
38
  global.history = void 0;
39
39
  global.document = void 0;
40
40
  }
41
+ const ABCSetting = {
42
+ env: "obsidian",
43
+ // 某些环境的独占 api,其他环境用不上
44
+ obsidian: {
45
+ global_app: null,
46
+ global_ctx: null,
47
+ mermaid: void 0,
48
+ markmap_event: void 0
49
+ }
50
+ };
41
51
  const ABReg = {
42
52
  /**
43
53
  * AB块头部
@@ -59,9 +69,9 @@ const ABReg = {
59
69
  * - 不允许 `::` 是避免与 dataview 的 inline property 冲突
60
70
  */
61
71
  // 有前缀版本(给选择器用)
62
- reg_header: /^((\s|>\s|-\s|\*\s|\+\s)*)(%%)?(\[((?!toc|TOC|\!|< )[\|\!#:;\(\)\s0-9a-zA-Z\u4e00-\u9fa5](?!.*::).*)\]):?(%%)?\s*$/,
72
+ reg_header: /^((\s|>\s|-\s|\*\s|\+\s)*)(%%)?(\[((?!toc|TOC|\!|< )[\|\!#:;\(\)\s0-9a-zA-Z\u4e00-\u9fa5](?!.*::).*)\]):?\3\s*$/,
63
73
  // 可以用空`|`来解除首字符限制。(`|`注意:可以用来弄严格模式,`#`注意:建议后面空一格避免变成“标签”,`!`注意:别易误触发 `> [!note]`
64
- reg_header_up: /^((\s|>\s|-\s|\*\s|\+\s)*)(%%)?(\[((?!toc|TOC|\!)< [\|\!#:;\(\)\s0-9a-zA-Z\u4e00-\u9fa5](?!.*::).*)\]):?(%%)?\s*$/,
74
+ reg_header_up: /^((\s|>\s|-\s|\*\s|\+\s)*)(%%)?(\[((?!toc|TOC|\!)< [\|\!#:;\(\)\s0-9a-zA-Z\u4e00-\u9fa5](?!.*::).*)\]):?\3\s*$/,
65
75
  // 向上检查标志的 头部选择器
66
76
  reg_mdit_head: /^((\s|>\s|-\s|\*\s|\+\s)*)(::::*)\s?(.*)/,
67
77
  reg_mdit_tail: /^((\s|>\s|-\s|\*\s|\+\s)*)(::::*)/,
@@ -74,8 +84,8 @@ const ABReg = {
74
84
  reg_heading: /^((\s|>\s|-\s|\*\s|\+\s)*)(\#+\s)(.*)/,
75
85
  reg_table: /^((\s|>\s|-\s|\*\s|\+\s)*)(\|(.*)\|)/,
76
86
  // 无前缀版本(给处理器用,处理器不需要处理前缀,前缀在选择器阶段已经被去除了)
77
- reg_header_noprefix: /^((\s)*)(%%)?(\[((?!toc|TOC|\!|< )[\|\!#:;\(\)\s0-9a-zA-Z\u4e00-\u9fa5](?!.*::).*)\]):?(%%)?\s*$/,
78
- reg_header_up_noprefix: /^((\s)*)(%%)?(\[((?!toc|TOC|\!)< [\|\!#:;\(\)\s0-9a-zA-Z\u4e00-\u9fa5](?!.*::).*)\]):?(%%)?\s*$/,
87
+ reg_header_noprefix: /^((\s)*)(%%)?(\[((?!toc|TOC|\!|< )[\|\!#:;\(\)\s0-9a-zA-Z\u4e00-\u9fa5](?!.*::).*)\]):?\3\s*$/,
88
+ reg_header_up_noprefix: /^((\s)*)(%%)?(\[((?!toc|TOC|\!)< [\|\!#:;\(\)\s0-9a-zA-Z\u4e00-\u9fa5](?!.*::).*)\]):?\3\s*$/,
79
89
  reg_mdit_head_noprefix: /^((\s)*)(::::*)\s?(.*)/,
80
90
  reg_mdit_tail_noprefix: /^((\s)*)(::::*)/,
81
91
  reg_list_noprefix: /^((\s)*)(-\s|\*\s|\+\s)(.*)/,
@@ -88,12 +98,6 @@ const ABReg = {
88
98
  inline_split: /\| |, |, |\. |。 |: |: /
89
99
  // 内联切分。`|`或全角符号+一空格,半角符号+两空格 (后者由于空格压缩,若经历了重渲染可能有问题)
90
100
  };
91
- const ABCSetting = {
92
- env: "obsidian",
93
- // MarkdownPostProcessorContext类型, obsidian专用
94
- mermaid: void 0
95
- // obsidian专用,表示使用哪种方式渲染mermaid
96
- };
97
101
  const convert = (
98
102
  // Note: overloads in JSDoc can’t yet use different `@template`s.
99
103
  /**
@@ -368,11 +372,11 @@ function autoABAlias(header, selectorName, content) {
368
372
  } else if (selectorName == "table" || ABReg.reg_table_noprefix.test(content.trimStart())) {
369
373
  header = "|table_140lne" + header;
370
374
  }
371
- for (const item of ABAlias_json) {
375
+ for (const item of get_ABAlias_iter()) {
372
376
  header = header.replace(item.regex, item.replacement);
373
377
  }
374
378
  for (const item of ABAlias_json_withSub) {
375
- header = header.replace(item.regex, (match2, ...groups) => {
379
+ header = header.replace(item.regex, (_match, ...groups) => {
376
380
  return item.replacement.replace(/\$(\d+)/g, (_, number) => groups[number - 1] ?? "");
377
381
  });
378
382
  }
@@ -405,15 +409,35 @@ const ABAlias_json_withSub = [
405
409
  // 注意避免和原上/上面的callout语法冲突,以及自身递归
406
410
  ];
407
411
  const ABAlias_json_mdit = [
408
- { regex: /\|:::_140lne\|(2?tabs?|标签页?)\|/, replacement: "|mditTabs|" },
412
+ { regex: /\|:::_140lne\|((?:mdit2|2)?tabs?|标签页?)\|/, replacement: "|mditTabs|" },
409
413
  { regex: "|:::_140lne|demo|", replacement: "|mditDemo|" },
410
414
  { regex: "|:::_140lne|abDemo|", replacement: "|mditABDemo|" },
411
- { regex: /\|:::_140lne\|(2?col|分栏)\|/, replacement: "|mditCol|" },
412
- { regex: /\|:::_140lne\|(2?card|卡片)\|/, replacement: "|mditCard|" },
413
- { regex: /\|:::_140lne\|(2?chat|聊天)\|/, replacement: "|mditChat|code(chat)|" }
415
+ { regex: /\|:::_140lne\|((?:mdit2|2)?col|分栏)\|/, replacement: "|mditCol|" },
416
+ { regex: /\|:::_140lne\|((?:mdit2|2)?card|卡片)\|/, replacement: "|mditCard|" },
417
+ { regex: /\|:::_140lne\|((?:mdit2|2)?chat|聊天)\|/, replacement: "|mditChat|code(chat)|" },
418
+ //
419
+ // {regex: /\|:::_140lne\|2?(timeline|时间线)\|/, replacement: "|title2timeline|"},
420
+ // {regex: /\|:::_140lne\|2?(tabs?|标签页?)\||\|title2tabs?\|/, replacement: "|title2c2listdata|c2listdata2tab|"},
421
+ // {regex: /\|:::_140lne\|2?(col|分栏)\||\|title2col\|/, replacement: "|title2c2listdata|c2listdata2items|addClass(ab-col)|"},
422
+ // {regex: /\|:::_140lne\|2?(card|卡片)\||\|title2card\|/, replacement: "|title2c2listdata|c2listdata2items|addClass(ab-card)|addClass(ab-lay-vfall)|"},
423
+ // {regex: /\|:::_140lne\|2?(nodes?|节点)\||\|(title2node|title2abMindmap)\|/, replacement: "|title2listdata|listdata2strict|listdata2nodes|"},
424
+ // list - 多叉多层树
425
+ { regex: /\|:::_140lne\|(?:mdit2|2)?(mermaid|flow|流程图)\|/, replacement: "|mdit2list|list2mermaid|" },
426
+ { regex: /\|:::_140lne\|(?:mdit2|2)?(mehrmaid|mdmermaid)\|/, replacement: "|mdit2list|list2mehrmaidText|code(mehrmaid)|" },
427
+ { regex: /\|:::_140lne\|(?:mdit2|2)?(puml)?(plantuml|mindmap|脑图|思维导图)\|/, replacement: "|mdit2list|list2pumlMindmap|" },
428
+ { regex: /\|:::_140lne\|(?:mdit2|2)?(markmap|mdMindmap|md脑图|md思维导图)\|/, replacement: "|mdit2list|list2markmap|" },
429
+ { regex: /\|:::_140lne\|(?:mdit2|2)?(wbs|(工作)?分解(图|结构))\|/, replacement: "|mdit2list|list2pumlWBS|" },
430
+ { regex: /\|:::_140lne\|(?:mdit2|2)?(table|multiWayTable|multiCrossTable|表格?|多叉表格?|跨行表格?)\|/, replacement: "|mdit2list|list2table|" },
431
+ // list - lt树 (属于多层一叉树)
432
+ { regex: /\|:::_140lne\|(?:mdit2|2)?(lt|listTable|treeTable|listGrid|treeGrid|列表格|树形表格?)\|/, replacement: "|mdit2list|list2lt|" },
433
+ { regex: /\|:::_140lne\|(?:mdit2|2)?(list|列表)\|/, replacement: "|mdit2list|list2lt|addClass(ab-listtable-likelist)|" },
434
+ { regex: /\|:::_140lne\|(?:mdit2|2)?(dir|dirTree|目录树?|目录结构)\|/, replacement: "|mdit2list|list2dt|" },
435
+ // list - 二层树
436
+ { regex: /\|:::_140lne\|(fakeList|仿列表)\|/, replacement: "|mdit2list|list2table|addClass(ab-table-fc)|addClass(ab-table-likelist)|" },
437
+ // 至后
438
+ { regex: "|mdit2list|", replacement: "|mdit2listdata|listdata2strict|listdata2list|" }
414
439
  ];
415
440
  const ABAlias_json_title = [
416
- { regex: "|title2list|", replacement: "|title2listdata|listdata2strict|listdata2list|" },
417
441
  // title - list&title
418
442
  { regex: /\|heading_140lne\|2?(timeline|时间线)\|/, replacement: "|title2timeline|" },
419
443
  { regex: /\|heading_140lne\|2?(tabs?|标签页?)\||\|title2tabs?\|/, replacement: "|title2c2listdata|c2listdata2tab|" },
@@ -432,7 +456,9 @@ const ABAlias_json_title = [
432
456
  { regex: /\|heading_140lne\|2?(list|列表)\|/, replacement: "|title2list|list2lt|addClass(ab-listtable-likelist)|" },
433
457
  { regex: /\|heading_140lne\|2?(dir|dirTree|目录树?|目录结构)\|/, replacement: "|title2list|list2dt|" },
434
458
  // list - 二层树
435
- { regex: /\|heading_140lne\|(fakeList|仿列表)\|/, replacement: "|title2list|list2table|addClass(ab-table-fc)|addClass(ab-table-likelist)|" }
459
+ { regex: /\|heading_140lne\|(fakeList|仿列表)\|/, replacement: "|title2list|list2table|addClass(ab-table-fc)|addClass(ab-table-likelist)|" },
460
+ // 至后
461
+ { regex: "|title2list|", replacement: "|title2listdata|listdata2strict|listdata2list|" }
436
462
  ];
437
463
  const ABAlias_json_list = [
438
464
  // 特殊
@@ -516,7 +542,9 @@ const ABAlias_json_general = [
516
542
  { regex: "|超超小字|", replacement: "|addClass(ab-custom-font-smallxx)|" },
517
543
  { regex: "|加粗|", replacement: "|addClass(ab-custom-font-bold)|" }
518
544
  ];
519
- const ABAlias_json_default = [
545
+ const ABAlias_user = [];
546
+ const ABAlias_pro = [];
547
+ const ABAlias_default = [
520
548
  ...ABAlias_json_mdit,
521
549
  ...ABAlias_json_title,
522
550
  ...ABAlias_json_list,
@@ -526,10 +554,11 @@ const ABAlias_json_default = [
526
554
  ...ABAlias_json_general
527
555
  // 这个放最后
528
556
  ];
529
- let ABAlias_json = [
530
- ...ABAlias_json_default
531
- // 设置决定是否停用
532
- ];
557
+ function* get_ABAlias_iter() {
558
+ yield* ABAlias_user;
559
+ yield* ABAlias_pro;
560
+ yield* ABAlias_default;
561
+ }
533
562
  const ABAlias_json_end = [
534
563
  { regex: "|:::_140lne", replacement: "" },
535
564
  { regex: "|heading_140lne", replacement: "" },
@@ -586,24 +615,18 @@ class ABConvertManager {
586
615
  * @param header 转换方式
587
616
  * @param content 要转换的初始文本 (无前缀版本,前缀在选择器环节已经删除了)
588
617
  * @param selectorName 选择器名,空表示未知
589
- * @return 等于el,无用,后面可以删了
590
618
  */
591
619
  static autoABConvert(el, header, content, selectorName = "", ctx) {
592
- let prev_result = content;
593
- let prev_type = "string";
594
- let prev_type2 = ABConvert_IOEnum.text;
595
- let prev_processor;
596
620
  let prev2 = {
597
- // 组合在一起是为了引用传参
598
- prev_result,
599
- prev_type,
600
- prev_type2,
601
- prev_processor
621
+ prev_result: content,
622
+ prev_type: "string",
623
+ prev_type2: ABConvert_IOEnum.text,
624
+ prev_processor: void 0
602
625
  };
603
626
  {
604
- header = autoABAlias(header, selectorName, prev_result);
627
+ header = autoABAlias(header, selectorName, prev2.prev_result);
605
628
  let list_header = header.split("|");
606
- prev_result = this.autoABConvert_runConvert(el, list_header, prev2, ctx);
629
+ this.autoABConvert_runConvert(el, list_header, prev2, ctx);
607
630
  this.autoABConvert_last(el, header, selectorName, prev2, ctx);
608
631
  }
609
632
  }
@@ -662,7 +685,12 @@ class ABConvertManager {
662
685
  break;
663
686
  }
664
687
  }
665
- prev2.prev_result = abReplaceProcessor.process(el, item_header, prev2.prev_result, ctx);
688
+ try {
689
+ prev2.prev_result = abReplaceProcessor.process(el, item_header, prev2.prev_result, ctx);
690
+ } catch (e) {
691
+ console.error(`处理器执行错误, id:${abReplaceProcessor.id}, header:${item_header}, error:`, e);
692
+ break;
693
+ }
666
694
  prev2.prev_type = typeof prev2.prev_result;
667
695
  prev2.prev_type2 = abReplaceProcessor.process_return;
668
696
  prev2.prev_processor = abReplaceProcessor.process;
@@ -676,7 +704,7 @@ class ABConvertManager {
676
704
  /**
677
705
  * 子函数,后处理/尾处理,主要进行末尾追加指令
678
706
  */
679
- static autoABConvert_last(el, header, selectorName, prev2, ctx) {
707
+ static autoABConvert_last(el, _header, _selectorName, prev2, _ctx) {
680
708
  if (prev2.prev_type == "string" && prev2.prev_type2 == ABConvert_IOEnum.text) {
681
709
  const subEl = document.createElement("div");
682
710
  el.appendChild(subEl);
@@ -684,7 +712,7 @@ class ABConvertManager {
684
712
  prev2.prev_result = el;
685
713
  prev2.prev_type = "object";
686
714
  prev2.prev_type2 = ABConvert_IOEnum.el;
687
- prev2.process = "md";
715
+ prev2.prev_processor = "md";
688
716
  } else if (prev2.prev_type == "string" && prev2.prev_type2 == ABConvert_IOEnum.json) {
689
717
  const code_str = "```json\n" + prev2.prev_result + "\n```\n";
690
718
  const subEl = document.createElement("div");
@@ -693,7 +721,7 @@ class ABConvertManager {
693
721
  prev2.prev_result = el;
694
722
  prev2.prev_type = "object";
695
723
  prev2.prev_type2 = ABConvert_IOEnum.el;
696
- prev2.process = "show_json";
724
+ prev2.prev_processor = "show_json";
697
725
  } else if (prev2.prev_type == "object" && (prev2.prev_type2 == ABConvert_IOEnum.list_stream || prev2.prev_type2 == ABConvert_IOEnum.c2list_stream || prev2.prev_type2 == ABConvert_IOEnum.json)) {
698
726
  const code_str = "```json\n" + JSON.stringify(prev2.prev_result, null, 2) + "\n```\n";
699
727
  const subEl = document.createElement("div");
@@ -702,7 +730,7 @@ class ABConvertManager {
702
730
  prev2.prev_result = el;
703
731
  prev2.prev_type = "object";
704
732
  prev2.prev_type2 = ABConvert_IOEnum.el;
705
- prev2.process = "show_listStream";
733
+ prev2.prev_processor = "show_listStream";
706
734
  } else if (prev2.prev_type == "object" && prev2.prev_type2 == ABConvert_IOEnum.el) {
707
735
  return prev2;
708
736
  } else {
@@ -1146,7 +1174,7 @@ class ListProcess {
1146
1174
  }
1147
1175
  }
1148
1176
  /**
1149
- * 标题大纲转列表数据(@todo 正文的level+10,要减掉)
1177
+ * 标题大纲转列表数据
1150
1178
  *
1151
1179
  * @detail
1152
1180
  * 这里要将标题、正文、列表 的等级合为一块,所以存在偏移值:
@@ -1155,6 +1183,7 @@ class ListProcess {
1155
1183
  * 2. 正文等级, = 0, 取值[+1,+Infi]
1156
1184
  * 3. 列表等级, = `(.*)-`个数+1, 取值[0]
1157
1185
  *
1186
+ * (比较旧版是正文+10,列表+11,后来允许标题等级为负数。这样方便很多)
1158
1187
  */
1159
1188
  static title2data(text2) {
1160
1189
  let list_itemInfo = [];
@@ -1165,13 +1194,21 @@ class ListProcess {
1165
1194
  if (codeBlockFlag == "") {
1166
1195
  const match2 = line.match(ABReg.reg_code);
1167
1196
  if (match2 && match2[3]) {
1168
- codeBlockFlag = match2[1] + match2[3];
1169
- list_itemInfo[list_itemInfo.length - 1].content = list_itemInfo[list_itemInfo.length - 1].content + "\n" + line;
1197
+ if (mul_mode === "heading" || mul_mode === "") {
1198
+ list_itemInfo.push({
1199
+ content: line,
1200
+ level: 0
1201
+ });
1202
+ mul_mode = "para";
1203
+ } else {
1204
+ codeBlockFlag = match2[1] + match2[3];
1205
+ list_itemInfo[list_itemInfo.length - 1].content += "\n" + line;
1206
+ }
1170
1207
  continue;
1171
1208
  }
1172
1209
  } else {
1173
1210
  if (line.indexOf(codeBlockFlag) == 0) codeBlockFlag = "";
1174
- list_itemInfo[list_itemInfo.length - 1].content = list_itemInfo[list_itemInfo.length - 1].content + "\n" + line;
1211
+ list_itemInfo[list_itemInfo.length - 1].content += "\n" + line;
1175
1212
  continue;
1176
1213
  }
1177
1214
  const match_heading = line.match(ABReg.reg_heading_noprefix);
@@ -1188,21 +1225,125 @@ class ListProcess {
1188
1225
  list_itemInfo.push({
1189
1226
  content: match_list[4],
1190
1227
  level: match_list[1].length + 1
1191
- //+10
1192
1228
  });
1193
1229
  mul_mode = "list";
1194
1230
  } else if (/^\S/.test(line) && mul_mode == "list") {
1195
- list_itemInfo[list_itemInfo.length - 1].content = list_itemInfo[list_itemInfo.length - 1].content + "\n" + line;
1231
+ list_itemInfo[list_itemInfo.length - 1].content += "\n" + line;
1196
1232
  } else {
1197
1233
  if (mul_mode == "para") {
1198
- list_itemInfo[list_itemInfo.length - 1].content = list_itemInfo[list_itemInfo.length - 1].content + "\n" + line;
1234
+ list_itemInfo[list_itemInfo.length - 1].content += "\n" + line;
1235
+ } else if (/^\s*$/.test(line)) {
1236
+ continue;
1237
+ } else {
1238
+ list_itemInfo.push({
1239
+ content: line,
1240
+ level: 0
1241
+ });
1242
+ mul_mode = "para";
1243
+ }
1244
+ }
1245
+ }
1246
+ removeTailBlank();
1247
+ return list_itemInfo;
1248
+ function removeTailBlank() {
1249
+ if (mul_mode == "para" || mul_mode == "list") {
1250
+ list_itemInfo[list_itemInfo.length - 1].content = list_itemInfo[list_itemInfo.length - 1].content.replace(/\s*$/, "");
1251
+ }
1252
+ }
1253
+ }
1254
+ /**
1255
+ * MarkdownIt 转列表数据
1256
+ *
1257
+ * @detail
1258
+ * 与 title2data 的逻辑基本相同
1259
+ *
1260
+ * 这里要将Mdit标识 (@xxx)、正文、列表 的等级合为一块,所以存在偏移值:
1261
+ *
1262
+ * 1. Mdit等级, = `@<数字>`-100,
1263
+ * 2. 正文等级, = 0, 取值[+1,+Infi]
1264
+ * 3. 列表等级, = `(.*)-`个数+1, 取值[0]
1265
+ *
1266
+ * 例如:
1267
+ *
1268
+ * :::
1269
+ *
1270
+ * @1 AAA
1271
+ *
1272
+ * aaa
1273
+ *
1274
+ * @2 BBB
1275
+ *
1276
+ * @2 B22
1277
+ *
1278
+ * ccc
1279
+ * ddd
1280
+ *
1281
+ * @1 A22
1282
+ *
1283
+ * :::
1284
+ *
1285
+ * 会被转化为
1286
+ *
1287
+ * - AAA
1288
+ * - BBB
1289
+ * - B22
1290
+ * - ccc
1291
+ * ddd
1292
+ * - A22
1293
+ */
1294
+ static mdit2data(text2) {
1295
+ let list_itemInfo = [];
1296
+ const list_text = text2.split("\n");
1297
+ let mul_mode = "";
1298
+ let codeBlockFlag = "";
1299
+ for (let line of list_text) {
1300
+ if (codeBlockFlag == "") {
1301
+ const match2 = line.match(ABReg.reg_code);
1302
+ if (match2 && match2[3]) {
1303
+ if (mul_mode === "mdit" || mul_mode === "") {
1304
+ list_itemInfo.push({
1305
+ content: line,
1306
+ level: 0
1307
+ });
1308
+ mul_mode = "para";
1309
+ } else {
1310
+ codeBlockFlag = match2[1] + match2[3];
1311
+ list_itemInfo[list_itemInfo.length - 1].content += "\n" + line;
1312
+ }
1313
+ continue;
1314
+ }
1315
+ } else {
1316
+ if (line.indexOf(codeBlockFlag) == 0) codeBlockFlag = "";
1317
+ list_itemInfo[list_itemInfo.length - 1].content += "\n" + line;
1318
+ continue;
1319
+ }
1320
+ const match_mdit = line.match(/^(\s*)@(\d+)\s+(.*)$/);
1321
+ const match_list = line.match(ABReg.reg_list_noprefix);
1322
+ if (match_mdit && !match_mdit[1]) {
1323
+ removeTailBlank();
1324
+ list_itemInfo.push({
1325
+ content: match_mdit[3],
1326
+ level: Number(match_mdit[2]) - 100
1327
+ });
1328
+ mul_mode = "mdit";
1329
+ } else if (match_list) {
1330
+ removeTailBlank();
1331
+ list_itemInfo.push({
1332
+ content: match_list[4],
1333
+ level: match_list[1].length + 1
1334
+ });
1335
+ mul_mode = "list";
1336
+ } else if (/^\S/.test(line) && mul_mode == "list") {
1337
+ list_itemInfo[list_itemInfo.length - 1].content += "\n" + line;
1338
+ } else {
1339
+ if (mul_mode == "para") {
1340
+ list_itemInfo[list_itemInfo.length - 1].content += "\n" + line;
1199
1341
  } else if (/^\s*$/.test(line)) {
1200
1342
  continue;
1201
1343
  } else {
1202
1344
  list_itemInfo.push({
1203
1345
  content: line,
1204
1346
  level: 0
1205
- //+10
1206
1347
  });
1207
1348
  mul_mode = "para";
1208
1349
  }
@@ -1437,6 +1578,16 @@ const abc_title2listdata = ABConvert.factory({
1437
1578
  return ListProcess.title2data(content);
1438
1579
  }
1439
1580
  });
1581
+ ABConvert.factory({
1582
+ id: "mdit2listdata",
1583
+ name: "mdit到listdata",
1584
+ process_param: ABConvert_IOEnum.text,
1585
+ process_return: ABConvert_IOEnum.list_stream,
1586
+ detail: "mdit到listdata",
1587
+ process: (el, header, content) => {
1588
+ return ListProcess.mdit2data(content);
1589
+ }
1590
+ });
1440
1591
  ABConvert.factory({
1441
1592
  id: "listdata2list",
1442
1593
  name: "listdata到列表",
@@ -2432,6 +2583,1085 @@ ABConvert.factory({
2432
2583
  return newContent;
2433
2584
  }
2434
2585
  });
2586
+ function _arrayLikeToArray(r, a) {
2587
+ (null == a || a > r.length) && (a = r.length);
2588
+ for (var e = 0, n2 = Array(a); e < a; e++) n2[e] = r[e];
2589
+ return n2;
2590
+ }
2591
+ function _arrayWithHoles(r) {
2592
+ if (Array.isArray(r)) return r;
2593
+ }
2594
+ function _iterableToArrayLimit(r, l2) {
2595
+ var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
2596
+ if (null != t) {
2597
+ var e, n2, i, u, a = [], f = true, o = false;
2598
+ try {
2599
+ if (i = (t = t.call(r)).next, 0 === l2) ;
2600
+ else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l2); f = true) ;
2601
+ } catch (r2) {
2602
+ o = true, n2 = r2;
2603
+ } finally {
2604
+ try {
2605
+ if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return;
2606
+ } finally {
2607
+ if (o) throw n2;
2608
+ }
2609
+ }
2610
+ return a;
2611
+ }
2612
+ }
2613
+ function _nonIterableRest() {
2614
+ throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
2615
+ }
2616
+ function _slicedToArray(r, e) {
2617
+ return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest();
2618
+ }
2619
+ function _unsupportedIterableToArray(r, a) {
2620
+ if (r) {
2621
+ if ("string" == typeof r) return _arrayLikeToArray(r, a);
2622
+ var t = {}.toString.call(r).slice(8, -1);
2623
+ 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;
2624
+ }
2625
+ }
2626
+ const entries = Object.entries, setPrototypeOf = Object.setPrototypeOf, isFrozen = Object.isFrozen, getPrototypeOf = Object.getPrototypeOf, getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
2627
+ let freeze = Object.freeze, seal = Object.seal, create = Object.create;
2628
+ let _ref = typeof Reflect !== "undefined" && Reflect, apply = _ref.apply, construct = _ref.construct;
2629
+ if (!freeze) {
2630
+ freeze = function freeze2(x) {
2631
+ return x;
2632
+ };
2633
+ }
2634
+ if (!seal) {
2635
+ seal = function seal2(x) {
2636
+ return x;
2637
+ };
2638
+ }
2639
+ if (!apply) {
2640
+ apply = function apply2(func, thisArg) {
2641
+ for (var _len = arguments.length, args = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
2642
+ args[_key - 2] = arguments[_key];
2643
+ }
2644
+ return func.apply(thisArg, args);
2645
+ };
2646
+ }
2647
+ if (!construct) {
2648
+ construct = function construct2(Func) {
2649
+ for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
2650
+ args[_key2 - 1] = arguments[_key2];
2651
+ }
2652
+ return new Func(...args);
2653
+ };
2654
+ }
2655
+ const arrayForEach = unapply(Array.prototype.forEach);
2656
+ const arrayLastIndexOf = unapply(Array.prototype.lastIndexOf);
2657
+ const arrayPop = unapply(Array.prototype.pop);
2658
+ const arrayPush = unapply(Array.prototype.push);
2659
+ const arraySplice = unapply(Array.prototype.splice);
2660
+ const arrayIsArray = Array.isArray;
2661
+ const stringToLowerCase = unapply(String.prototype.toLowerCase);
2662
+ const stringToString = unapply(String.prototype.toString);
2663
+ const stringMatch = unapply(String.prototype.match);
2664
+ const stringReplace = unapply(String.prototype.replace);
2665
+ const stringIndexOf = unapply(String.prototype.indexOf);
2666
+ const stringTrim = unapply(String.prototype.trim);
2667
+ const numberToString = unapply(Number.prototype.toString);
2668
+ const booleanToString = unapply(Boolean.prototype.toString);
2669
+ const bigintToString = typeof BigInt === "undefined" ? null : unapply(BigInt.prototype.toString);
2670
+ const symbolToString = typeof Symbol === "undefined" ? null : unapply(Symbol.prototype.toString);
2671
+ const objectHasOwnProperty = unapply(Object.prototype.hasOwnProperty);
2672
+ const objectToString = unapply(Object.prototype.toString);
2673
+ const regExpTest = unapply(RegExp.prototype.test);
2674
+ const typeErrorCreate = unconstruct(TypeError);
2675
+ function unapply(func) {
2676
+ return function(thisArg) {
2677
+ if (thisArg instanceof RegExp) {
2678
+ thisArg.lastIndex = 0;
2679
+ }
2680
+ for (var _len3 = arguments.length, args = new Array(_len3 > 1 ? _len3 - 1 : 0), _key3 = 1; _key3 < _len3; _key3++) {
2681
+ args[_key3 - 1] = arguments[_key3];
2682
+ }
2683
+ return apply(func, thisArg, args);
2684
+ };
2685
+ }
2686
+ function unconstruct(Func) {
2687
+ return function() {
2688
+ for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
2689
+ args[_key4] = arguments[_key4];
2690
+ }
2691
+ return construct(Func, args);
2692
+ };
2693
+ }
2694
+ function addToSet(set2, array) {
2695
+ let transformCaseFunc = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : stringToLowerCase;
2696
+ if (setPrototypeOf) {
2697
+ setPrototypeOf(set2, null);
2698
+ }
2699
+ if (!arrayIsArray(array)) {
2700
+ return set2;
2701
+ }
2702
+ let l2 = array.length;
2703
+ while (l2--) {
2704
+ let element = array[l2];
2705
+ if (typeof element === "string") {
2706
+ const lcElement = transformCaseFunc(element);
2707
+ if (lcElement !== element) {
2708
+ if (!isFrozen(array)) {
2709
+ array[l2] = lcElement;
2710
+ }
2711
+ element = lcElement;
2712
+ }
2713
+ }
2714
+ set2[element] = true;
2715
+ }
2716
+ return set2;
2717
+ }
2718
+ function cleanArray(array) {
2719
+ for (let index2 = 0; index2 < array.length; index2++) {
2720
+ const isPropertyExist = objectHasOwnProperty(array, index2);
2721
+ if (!isPropertyExist) {
2722
+ array[index2] = null;
2723
+ }
2724
+ }
2725
+ return array;
2726
+ }
2727
+ function clone$3(object) {
2728
+ const newObject = create(null);
2729
+ for (const _ref2 of entries(object)) {
2730
+ var _ref3 = _slicedToArray(_ref2, 2);
2731
+ const property = _ref3[0];
2732
+ const value = _ref3[1];
2733
+ const isPropertyExist = objectHasOwnProperty(object, property);
2734
+ if (isPropertyExist) {
2735
+ if (arrayIsArray(value)) {
2736
+ newObject[property] = cleanArray(value);
2737
+ } else if (value && typeof value === "object" && value.constructor === Object) {
2738
+ newObject[property] = clone$3(value);
2739
+ } else {
2740
+ newObject[property] = value;
2741
+ }
2742
+ }
2743
+ }
2744
+ return newObject;
2745
+ }
2746
+ function stringifyValue(value) {
2747
+ switch (typeof value) {
2748
+ case "string": {
2749
+ return value;
2750
+ }
2751
+ case "number": {
2752
+ return numberToString(value);
2753
+ }
2754
+ case "boolean": {
2755
+ return booleanToString(value);
2756
+ }
2757
+ case "bigint": {
2758
+ return bigintToString ? bigintToString(value) : "0";
2759
+ }
2760
+ case "symbol": {
2761
+ return symbolToString ? symbolToString(value) : "Symbol()";
2762
+ }
2763
+ case "undefined": {
2764
+ return objectToString(value);
2765
+ }
2766
+ case "function":
2767
+ case "object": {
2768
+ if (value === null) {
2769
+ return objectToString(value);
2770
+ }
2771
+ const valueAsRecord = value;
2772
+ const valueToString = lookupGetter(valueAsRecord, "toString");
2773
+ if (typeof valueToString === "function") {
2774
+ const stringified = valueToString(valueAsRecord);
2775
+ return typeof stringified === "string" ? stringified : objectToString(stringified);
2776
+ }
2777
+ return objectToString(value);
2778
+ }
2779
+ default: {
2780
+ return objectToString(value);
2781
+ }
2782
+ }
2783
+ }
2784
+ function lookupGetter(object, prop2) {
2785
+ while (object !== null) {
2786
+ const desc = getOwnPropertyDescriptor(object, prop2);
2787
+ if (desc) {
2788
+ if (desc.get) {
2789
+ return unapply(desc.get);
2790
+ }
2791
+ if (typeof desc.value === "function") {
2792
+ return unapply(desc.value);
2793
+ }
2794
+ }
2795
+ object = getPrototypeOf(object);
2796
+ }
2797
+ function fallbackValue() {
2798
+ return null;
2799
+ }
2800
+ return fallbackValue;
2801
+ }
2802
+ function isRegex(value) {
2803
+ try {
2804
+ regExpTest(value, "");
2805
+ return true;
2806
+ } catch (_unused) {
2807
+ return false;
2808
+ }
2809
+ }
2810
+ const html$1$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"]);
2811
+ 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"]);
2812
+ 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"]);
2813
+ 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"]);
2814
+ 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"]);
2815
+ const mathMlDisallowed = freeze(["maction", "maligngroup", "malignmark", "mlongdiv", "mscarries", "mscarry", "msgroup", "mstack", "msline", "msrow", "semantics", "annotation", "annotation-xml", "mprescripts", "none"]);
2816
+ const text$2 = freeze(["#text"]);
2817
+ const html$2 = freeze(["accept", "action", "align", "alt", "autocapitalize", "autocomplete", "autopictureinpicture", "autoplay", "background", "bgcolor", "border", "capture", "cellpadding", "cellspacing", "checked", "cite", "class", "clear", "color", "cols", "colspan", "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"]);
2818
+ 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", "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", "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-rendering", "textlength", "type", "u1", "u2", "unicode", "values", "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"]);
2819
+ 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"]);
2820
+ const xml$1 = freeze(["xlink:href", "xml:id", "xlink:title", "xml:space", "xmlns:xlink"]);
2821
+ const MUSTACHE_EXPR = seal(/{{[\w\W]*|^[\w\W]*}}/g);
2822
+ const ERB_EXPR = seal(/<%[\w\W]*|^[\w\W]*%>/g);
2823
+ const TMPLIT_EXPR = seal(/\${[\w\W]*/g);
2824
+ const DATA_ATTR = seal(/^data-[\-\w.\u00B7-\uFFFF]+$/);
2825
+ const ARIA_ATTR = seal(/^aria-[\-\w]+$/);
2826
+ const IS_ALLOWED_URI = seal(
2827
+ /^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i
2828
+ // eslint-disable-line no-useless-escape
2829
+ );
2830
+ const IS_SCRIPT_OR_DATA = seal(/^(?:\w+script|data):/i);
2831
+ const ATTR_WHITESPACE = seal(
2832
+ /[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g
2833
+ // eslint-disable-line no-control-regex
2834
+ );
2835
+ const DOCTYPE_NAME = seal(/^html$/i);
2836
+ const CUSTOM_ELEMENT = seal(/^[a-z][.\w]*(-[.\w]+)+$/i);
2837
+ const NODE_TYPE$1 = {
2838
+ element: 1,
2839
+ text: 3,
2840
+ // Deprecated
2841
+ progressingInstruction: 7,
2842
+ comment: 8,
2843
+ document: 9
2844
+ };
2845
+ const getGlobal = function getGlobal2() {
2846
+ return typeof window === "undefined" ? null : window;
2847
+ };
2848
+ const _createTrustedTypesPolicy = function _createTrustedTypesPolicy2(trustedTypes, purifyHostElement) {
2849
+ if (typeof trustedTypes !== "object" || typeof trustedTypes.createPolicy !== "function") {
2850
+ return null;
2851
+ }
2852
+ let suffix = null;
2853
+ const ATTR_NAME = "data-tt-policy-suffix";
2854
+ if (purifyHostElement && purifyHostElement.hasAttribute(ATTR_NAME)) {
2855
+ suffix = purifyHostElement.getAttribute(ATTR_NAME);
2856
+ }
2857
+ const policyName = "dompurify" + (suffix ? "#" + suffix : "");
2858
+ try {
2859
+ return trustedTypes.createPolicy(policyName, {
2860
+ createHTML(html2) {
2861
+ return html2;
2862
+ },
2863
+ createScriptURL(scriptUrl) {
2864
+ return scriptUrl;
2865
+ }
2866
+ });
2867
+ } catch (_) {
2868
+ console.warn("TrustedTypes policy " + policyName + " could not be created.");
2869
+ return null;
2870
+ }
2871
+ };
2872
+ const _createHooksMap = function _createHooksMap2() {
2873
+ return {
2874
+ afterSanitizeAttributes: [],
2875
+ afterSanitizeElements: [],
2876
+ afterSanitizeShadowDOM: [],
2877
+ beforeSanitizeAttributes: [],
2878
+ beforeSanitizeElements: [],
2879
+ beforeSanitizeShadowDOM: [],
2880
+ uponSanitizeAttribute: [],
2881
+ uponSanitizeElement: [],
2882
+ uponSanitizeShadowNode: []
2883
+ };
2884
+ };
2885
+ function createDOMPurify() {
2886
+ let window2 = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : getGlobal();
2887
+ const DOMPurify = (root2) => createDOMPurify(root2);
2888
+ DOMPurify.version = "3.4.3";
2889
+ DOMPurify.removed = [];
2890
+ if (!window2 || !window2.document || window2.document.nodeType !== NODE_TYPE$1.document || !window2.Element) {
2891
+ DOMPurify.isSupported = false;
2892
+ return DOMPurify;
2893
+ }
2894
+ let document2 = window2.document;
2895
+ const originalDocument = document2;
2896
+ const currentScript = originalDocument.currentScript;
2897
+ const DocumentFragment = window2.DocumentFragment, HTMLTemplateElement = window2.HTMLTemplateElement, Node3 = window2.Node, Element2 = window2.Element, NodeFilter = window2.NodeFilter, _window$NamedNodeMap = window2.NamedNodeMap, NamedNodeMap = _window$NamedNodeMap === void 0 ? window2.NamedNodeMap || window2.MozNamedAttrMap : _window$NamedNodeMap, HTMLFormElement = window2.HTMLFormElement, DOMParser = window2.DOMParser, trustedTypes = window2.trustedTypes;
2898
+ const ElementPrototype = Element2.prototype;
2899
+ const cloneNode2 = lookupGetter(ElementPrototype, "cloneNode");
2900
+ const remove2 = lookupGetter(ElementPrototype, "remove");
2901
+ const getNextSibling = lookupGetter(ElementPrototype, "nextSibling");
2902
+ const getChildNodes = lookupGetter(ElementPrototype, "childNodes");
2903
+ const getParentNode = lookupGetter(ElementPrototype, "parentNode");
2904
+ if (typeof HTMLTemplateElement === "function") {
2905
+ const template = document2.createElement("template");
2906
+ if (template.content && template.content.ownerDocument) {
2907
+ document2 = template.content.ownerDocument;
2908
+ }
2909
+ }
2910
+ let trustedTypesPolicy;
2911
+ let emptyHTML = "";
2912
+ const _document = document2, implementation = _document.implementation, createNodeIterator = _document.createNodeIterator, createDocumentFragment = _document.createDocumentFragment, getElementsByTagName2 = _document.getElementsByTagName;
2913
+ const importNode = originalDocument.importNode;
2914
+ let hooks = _createHooksMap();
2915
+ DOMPurify.isSupported = typeof entries === "function" && typeof getParentNode === "function" && implementation && implementation.createHTMLDocument !== void 0;
2916
+ 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;
2917
+ let IS_ALLOWED_URI$1 = IS_ALLOWED_URI;
2918
+ let ALLOWED_TAGS = null;
2919
+ const DEFAULT_ALLOWED_TAGS = addToSet({}, [...html$1$1, ...svg$1, ...svgFilters, ...mathMl$1, ...text$2]);
2920
+ let ALLOWED_ATTR = null;
2921
+ const DEFAULT_ALLOWED_ATTR = addToSet({}, [...html$2, ...svg, ...mathMl, ...xml$1]);
2922
+ let CUSTOM_ELEMENT_HANDLING = Object.seal(create(null, {
2923
+ tagNameCheck: {
2924
+ writable: true,
2925
+ configurable: false,
2926
+ enumerable: true,
2927
+ value: null
2928
+ },
2929
+ attributeNameCheck: {
2930
+ writable: true,
2931
+ configurable: false,
2932
+ enumerable: true,
2933
+ value: null
2934
+ },
2935
+ allowCustomizedBuiltInElements: {
2936
+ writable: true,
2937
+ configurable: false,
2938
+ enumerable: true,
2939
+ value: false
2940
+ }
2941
+ }));
2942
+ let FORBID_TAGS = null;
2943
+ let FORBID_ATTR = null;
2944
+ const EXTRA_ELEMENT_HANDLING = Object.seal(create(null, {
2945
+ tagCheck: {
2946
+ writable: true,
2947
+ configurable: false,
2948
+ enumerable: true,
2949
+ value: null
2950
+ },
2951
+ attributeCheck: {
2952
+ writable: true,
2953
+ configurable: false,
2954
+ enumerable: true,
2955
+ value: null
2956
+ }
2957
+ }));
2958
+ let ALLOW_ARIA_ATTR = true;
2959
+ let ALLOW_DATA_ATTR = true;
2960
+ let ALLOW_UNKNOWN_PROTOCOLS = false;
2961
+ let ALLOW_SELF_CLOSE_IN_ATTR = true;
2962
+ let SAFE_FOR_TEMPLATES = false;
2963
+ let SAFE_FOR_XML = true;
2964
+ let WHOLE_DOCUMENT = false;
2965
+ let SET_CONFIG = false;
2966
+ let FORCE_BODY = false;
2967
+ let RETURN_DOM = false;
2968
+ let RETURN_DOM_FRAGMENT = false;
2969
+ let RETURN_TRUSTED_TYPE = false;
2970
+ let SANITIZE_DOM = true;
2971
+ let SANITIZE_NAMED_PROPS = false;
2972
+ const SANITIZE_NAMED_PROPS_PREFIX = "user-content-";
2973
+ let KEEP_CONTENT = true;
2974
+ let IN_PLACE = false;
2975
+ let USE_PROFILES = {};
2976
+ let FORBID_CONTENTS = null;
2977
+ const DEFAULT_FORBID_CONTENTS = addToSet({}, ["annotation-xml", "audio", "colgroup", "desc", "foreignobject", "head", "iframe", "math", "mi", "mn", "mo", "ms", "mtext", "noembed", "noframes", "noscript", "plaintext", "script", "style", "svg", "template", "thead", "title", "video", "xmp"]);
2978
+ let DATA_URI_TAGS = null;
2979
+ const DEFAULT_DATA_URI_TAGS = addToSet({}, ["audio", "video", "img", "source", "image", "track"]);
2980
+ let URI_SAFE_ATTRIBUTES = null;
2981
+ const DEFAULT_URI_SAFE_ATTRIBUTES = addToSet({}, ["alt", "class", "for", "id", "label", "name", "pattern", "placeholder", "role", "summary", "title", "value", "style", "xmlns"]);
2982
+ const MATHML_NAMESPACE = "http://www.w3.org/1998/Math/MathML";
2983
+ const SVG_NAMESPACE = "http://www.w3.org/2000/svg";
2984
+ const HTML_NAMESPACE = "http://www.w3.org/1999/xhtml";
2985
+ let NAMESPACE = HTML_NAMESPACE;
2986
+ let IS_EMPTY_INPUT = false;
2987
+ let ALLOWED_NAMESPACES = null;
2988
+ const DEFAULT_ALLOWED_NAMESPACES = addToSet({}, [MATHML_NAMESPACE, SVG_NAMESPACE, HTML_NAMESPACE], stringToString);
2989
+ let MATHML_TEXT_INTEGRATION_POINTS = addToSet({}, ["mi", "mo", "mn", "ms", "mtext"]);
2990
+ let HTML_INTEGRATION_POINTS = addToSet({}, ["annotation-xml"]);
2991
+ const COMMON_SVG_AND_HTML_ELEMENTS = addToSet({}, ["title", "style", "font", "a", "script"]);
2992
+ let PARSER_MEDIA_TYPE = null;
2993
+ const SUPPORTED_PARSER_MEDIA_TYPES = ["application/xhtml+xml", "text/html"];
2994
+ const DEFAULT_PARSER_MEDIA_TYPE = "text/html";
2995
+ let transformCaseFunc = null;
2996
+ let CONFIG = null;
2997
+ const formElement = document2.createElement("form");
2998
+ const isRegexOrFunction = function isRegexOrFunction2(testValue) {
2999
+ return testValue instanceof RegExp || testValue instanceof Function;
3000
+ };
3001
+ const _parseConfig = function _parseConfig2() {
3002
+ let cfg = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
3003
+ if (CONFIG && CONFIG === cfg) {
3004
+ return;
3005
+ }
3006
+ if (!cfg || typeof cfg !== "object") {
3007
+ cfg = {};
3008
+ }
3009
+ cfg = clone$3(cfg);
3010
+ PARSER_MEDIA_TYPE = // eslint-disable-next-line unicorn/prefer-includes
3011
+ SUPPORTED_PARSER_MEDIA_TYPES.indexOf(cfg.PARSER_MEDIA_TYPE) === -1 ? DEFAULT_PARSER_MEDIA_TYPE : cfg.PARSER_MEDIA_TYPE;
3012
+ transformCaseFunc = PARSER_MEDIA_TYPE === "application/xhtml+xml" ? stringToString : stringToLowerCase;
3013
+ ALLOWED_TAGS = objectHasOwnProperty(cfg, "ALLOWED_TAGS") && arrayIsArray(cfg.ALLOWED_TAGS) ? addToSet({}, cfg.ALLOWED_TAGS, transformCaseFunc) : DEFAULT_ALLOWED_TAGS;
3014
+ ALLOWED_ATTR = objectHasOwnProperty(cfg, "ALLOWED_ATTR") && arrayIsArray(cfg.ALLOWED_ATTR) ? addToSet({}, cfg.ALLOWED_ATTR, transformCaseFunc) : DEFAULT_ALLOWED_ATTR;
3015
+ ALLOWED_NAMESPACES = objectHasOwnProperty(cfg, "ALLOWED_NAMESPACES") && arrayIsArray(cfg.ALLOWED_NAMESPACES) ? addToSet({}, cfg.ALLOWED_NAMESPACES, stringToString) : DEFAULT_ALLOWED_NAMESPACES;
3016
+ URI_SAFE_ATTRIBUTES = objectHasOwnProperty(cfg, "ADD_URI_SAFE_ATTR") && arrayIsArray(cfg.ADD_URI_SAFE_ATTR) ? addToSet(clone$3(DEFAULT_URI_SAFE_ATTRIBUTES), cfg.ADD_URI_SAFE_ATTR, transformCaseFunc) : DEFAULT_URI_SAFE_ATTRIBUTES;
3017
+ DATA_URI_TAGS = objectHasOwnProperty(cfg, "ADD_DATA_URI_TAGS") && arrayIsArray(cfg.ADD_DATA_URI_TAGS) ? addToSet(clone$3(DEFAULT_DATA_URI_TAGS), cfg.ADD_DATA_URI_TAGS, transformCaseFunc) : DEFAULT_DATA_URI_TAGS;
3018
+ FORBID_CONTENTS = objectHasOwnProperty(cfg, "FORBID_CONTENTS") && arrayIsArray(cfg.FORBID_CONTENTS) ? addToSet({}, cfg.FORBID_CONTENTS, transformCaseFunc) : DEFAULT_FORBID_CONTENTS;
3019
+ FORBID_TAGS = objectHasOwnProperty(cfg, "FORBID_TAGS") && arrayIsArray(cfg.FORBID_TAGS) ? addToSet({}, cfg.FORBID_TAGS, transformCaseFunc) : clone$3({});
3020
+ FORBID_ATTR = objectHasOwnProperty(cfg, "FORBID_ATTR") && arrayIsArray(cfg.FORBID_ATTR) ? addToSet({}, cfg.FORBID_ATTR, transformCaseFunc) : clone$3({});
3021
+ USE_PROFILES = objectHasOwnProperty(cfg, "USE_PROFILES") ? cfg.USE_PROFILES && typeof cfg.USE_PROFILES === "object" ? clone$3(cfg.USE_PROFILES) : cfg.USE_PROFILES : false;
3022
+ ALLOW_ARIA_ATTR = cfg.ALLOW_ARIA_ATTR !== false;
3023
+ ALLOW_DATA_ATTR = cfg.ALLOW_DATA_ATTR !== false;
3024
+ ALLOW_UNKNOWN_PROTOCOLS = cfg.ALLOW_UNKNOWN_PROTOCOLS || false;
3025
+ ALLOW_SELF_CLOSE_IN_ATTR = cfg.ALLOW_SELF_CLOSE_IN_ATTR !== false;
3026
+ SAFE_FOR_TEMPLATES = cfg.SAFE_FOR_TEMPLATES || false;
3027
+ SAFE_FOR_XML = cfg.SAFE_FOR_XML !== false;
3028
+ WHOLE_DOCUMENT = cfg.WHOLE_DOCUMENT || false;
3029
+ RETURN_DOM = cfg.RETURN_DOM || false;
3030
+ RETURN_DOM_FRAGMENT = cfg.RETURN_DOM_FRAGMENT || false;
3031
+ RETURN_TRUSTED_TYPE = cfg.RETURN_TRUSTED_TYPE || false;
3032
+ FORCE_BODY = cfg.FORCE_BODY || false;
3033
+ SANITIZE_DOM = cfg.SANITIZE_DOM !== false;
3034
+ SANITIZE_NAMED_PROPS = cfg.SANITIZE_NAMED_PROPS || false;
3035
+ KEEP_CONTENT = cfg.KEEP_CONTENT !== false;
3036
+ IN_PLACE = cfg.IN_PLACE || false;
3037
+ IS_ALLOWED_URI$1 = isRegex(cfg.ALLOWED_URI_REGEXP) ? cfg.ALLOWED_URI_REGEXP : IS_ALLOWED_URI;
3038
+ NAMESPACE = typeof cfg.NAMESPACE === "string" ? cfg.NAMESPACE : HTML_NAMESPACE;
3039
+ MATHML_TEXT_INTEGRATION_POINTS = objectHasOwnProperty(cfg, "MATHML_TEXT_INTEGRATION_POINTS") && cfg.MATHML_TEXT_INTEGRATION_POINTS && typeof cfg.MATHML_TEXT_INTEGRATION_POINTS === "object" ? clone$3(cfg.MATHML_TEXT_INTEGRATION_POINTS) : addToSet({}, ["mi", "mo", "mn", "ms", "mtext"]);
3040
+ HTML_INTEGRATION_POINTS = objectHasOwnProperty(cfg, "HTML_INTEGRATION_POINTS") && cfg.HTML_INTEGRATION_POINTS && typeof cfg.HTML_INTEGRATION_POINTS === "object" ? clone$3(cfg.HTML_INTEGRATION_POINTS) : addToSet({}, ["annotation-xml"]);
3041
+ const customElementHandling = objectHasOwnProperty(cfg, "CUSTOM_ELEMENT_HANDLING") && cfg.CUSTOM_ELEMENT_HANDLING && typeof cfg.CUSTOM_ELEMENT_HANDLING === "object" ? clone$3(cfg.CUSTOM_ELEMENT_HANDLING) : create(null);
3042
+ CUSTOM_ELEMENT_HANDLING = create(null);
3043
+ if (objectHasOwnProperty(customElementHandling, "tagNameCheck") && isRegexOrFunction(customElementHandling.tagNameCheck)) {
3044
+ CUSTOM_ELEMENT_HANDLING.tagNameCheck = customElementHandling.tagNameCheck;
3045
+ }
3046
+ if (objectHasOwnProperty(customElementHandling, "attributeNameCheck") && isRegexOrFunction(customElementHandling.attributeNameCheck)) {
3047
+ CUSTOM_ELEMENT_HANDLING.attributeNameCheck = customElementHandling.attributeNameCheck;
3048
+ }
3049
+ if (objectHasOwnProperty(customElementHandling, "allowCustomizedBuiltInElements") && typeof customElementHandling.allowCustomizedBuiltInElements === "boolean") {
3050
+ CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements = customElementHandling.allowCustomizedBuiltInElements;
3051
+ }
3052
+ if (SAFE_FOR_TEMPLATES) {
3053
+ ALLOW_DATA_ATTR = false;
3054
+ }
3055
+ if (RETURN_DOM_FRAGMENT) {
3056
+ RETURN_DOM = true;
3057
+ }
3058
+ if (USE_PROFILES) {
3059
+ ALLOWED_TAGS = addToSet({}, text$2);
3060
+ ALLOWED_ATTR = create(null);
3061
+ if (USE_PROFILES.html === true) {
3062
+ addToSet(ALLOWED_TAGS, html$1$1);
3063
+ addToSet(ALLOWED_ATTR, html$2);
3064
+ }
3065
+ if (USE_PROFILES.svg === true) {
3066
+ addToSet(ALLOWED_TAGS, svg$1);
3067
+ addToSet(ALLOWED_ATTR, svg);
3068
+ addToSet(ALLOWED_ATTR, xml$1);
3069
+ }
3070
+ if (USE_PROFILES.svgFilters === true) {
3071
+ addToSet(ALLOWED_TAGS, svgFilters);
3072
+ addToSet(ALLOWED_ATTR, svg);
3073
+ addToSet(ALLOWED_ATTR, xml$1);
3074
+ }
3075
+ if (USE_PROFILES.mathMl === true) {
3076
+ addToSet(ALLOWED_TAGS, mathMl$1);
3077
+ addToSet(ALLOWED_ATTR, mathMl);
3078
+ addToSet(ALLOWED_ATTR, xml$1);
3079
+ }
3080
+ }
3081
+ EXTRA_ELEMENT_HANDLING.tagCheck = null;
3082
+ EXTRA_ELEMENT_HANDLING.attributeCheck = null;
3083
+ if (objectHasOwnProperty(cfg, "ADD_TAGS")) {
3084
+ if (typeof cfg.ADD_TAGS === "function") {
3085
+ EXTRA_ELEMENT_HANDLING.tagCheck = cfg.ADD_TAGS;
3086
+ } else if (arrayIsArray(cfg.ADD_TAGS)) {
3087
+ if (ALLOWED_TAGS === DEFAULT_ALLOWED_TAGS) {
3088
+ ALLOWED_TAGS = clone$3(ALLOWED_TAGS);
3089
+ }
3090
+ addToSet(ALLOWED_TAGS, cfg.ADD_TAGS, transformCaseFunc);
3091
+ }
3092
+ }
3093
+ if (objectHasOwnProperty(cfg, "ADD_ATTR")) {
3094
+ if (typeof cfg.ADD_ATTR === "function") {
3095
+ EXTRA_ELEMENT_HANDLING.attributeCheck = cfg.ADD_ATTR;
3096
+ } else if (arrayIsArray(cfg.ADD_ATTR)) {
3097
+ if (ALLOWED_ATTR === DEFAULT_ALLOWED_ATTR) {
3098
+ ALLOWED_ATTR = clone$3(ALLOWED_ATTR);
3099
+ }
3100
+ addToSet(ALLOWED_ATTR, cfg.ADD_ATTR, transformCaseFunc);
3101
+ }
3102
+ }
3103
+ if (objectHasOwnProperty(cfg, "ADD_URI_SAFE_ATTR") && arrayIsArray(cfg.ADD_URI_SAFE_ATTR)) {
3104
+ addToSet(URI_SAFE_ATTRIBUTES, cfg.ADD_URI_SAFE_ATTR, transformCaseFunc);
3105
+ }
3106
+ if (objectHasOwnProperty(cfg, "FORBID_CONTENTS") && arrayIsArray(cfg.FORBID_CONTENTS)) {
3107
+ if (FORBID_CONTENTS === DEFAULT_FORBID_CONTENTS) {
3108
+ FORBID_CONTENTS = clone$3(FORBID_CONTENTS);
3109
+ }
3110
+ addToSet(FORBID_CONTENTS, cfg.FORBID_CONTENTS, transformCaseFunc);
3111
+ }
3112
+ if (objectHasOwnProperty(cfg, "ADD_FORBID_CONTENTS") && arrayIsArray(cfg.ADD_FORBID_CONTENTS)) {
3113
+ if (FORBID_CONTENTS === DEFAULT_FORBID_CONTENTS) {
3114
+ FORBID_CONTENTS = clone$3(FORBID_CONTENTS);
3115
+ }
3116
+ addToSet(FORBID_CONTENTS, cfg.ADD_FORBID_CONTENTS, transformCaseFunc);
3117
+ }
3118
+ if (KEEP_CONTENT) {
3119
+ ALLOWED_TAGS["#text"] = true;
3120
+ }
3121
+ if (WHOLE_DOCUMENT) {
3122
+ addToSet(ALLOWED_TAGS, ["html", "head", "body"]);
3123
+ }
3124
+ if (ALLOWED_TAGS.table) {
3125
+ addToSet(ALLOWED_TAGS, ["tbody"]);
3126
+ delete FORBID_TAGS.tbody;
3127
+ }
3128
+ if (cfg.TRUSTED_TYPES_POLICY) {
3129
+ if (typeof cfg.TRUSTED_TYPES_POLICY.createHTML !== "function") {
3130
+ throw typeErrorCreate('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');
3131
+ }
3132
+ if (typeof cfg.TRUSTED_TYPES_POLICY.createScriptURL !== "function") {
3133
+ throw typeErrorCreate('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');
3134
+ }
3135
+ trustedTypesPolicy = cfg.TRUSTED_TYPES_POLICY;
3136
+ emptyHTML = trustedTypesPolicy.createHTML("");
3137
+ } else {
3138
+ if (trustedTypesPolicy === void 0) {
3139
+ trustedTypesPolicy = _createTrustedTypesPolicy(trustedTypes, currentScript);
3140
+ }
3141
+ if (trustedTypesPolicy !== null && typeof emptyHTML === "string") {
3142
+ emptyHTML = trustedTypesPolicy.createHTML("");
3143
+ }
3144
+ }
3145
+ if (freeze) {
3146
+ freeze(cfg);
3147
+ }
3148
+ CONFIG = cfg;
3149
+ };
3150
+ const ALL_SVG_TAGS = addToSet({}, [...svg$1, ...svgFilters, ...svgDisallowed]);
3151
+ const ALL_MATHML_TAGS = addToSet({}, [...mathMl$1, ...mathMlDisallowed]);
3152
+ const _checkValidNamespace = function _checkValidNamespace2(element) {
3153
+ let parent2 = getParentNode(element);
3154
+ if (!parent2 || !parent2.tagName) {
3155
+ parent2 = {
3156
+ namespaceURI: NAMESPACE,
3157
+ tagName: "template"
3158
+ };
3159
+ }
3160
+ const tagName = stringToLowerCase(element.tagName);
3161
+ const parentTagName = stringToLowerCase(parent2.tagName);
3162
+ if (!ALLOWED_NAMESPACES[element.namespaceURI]) {
3163
+ return false;
3164
+ }
3165
+ if (element.namespaceURI === SVG_NAMESPACE) {
3166
+ if (parent2.namespaceURI === HTML_NAMESPACE) {
3167
+ return tagName === "svg";
3168
+ }
3169
+ if (parent2.namespaceURI === MATHML_NAMESPACE) {
3170
+ return tagName === "svg" && (parentTagName === "annotation-xml" || MATHML_TEXT_INTEGRATION_POINTS[parentTagName]);
3171
+ }
3172
+ return Boolean(ALL_SVG_TAGS[tagName]);
3173
+ }
3174
+ if (element.namespaceURI === MATHML_NAMESPACE) {
3175
+ if (parent2.namespaceURI === HTML_NAMESPACE) {
3176
+ return tagName === "math";
3177
+ }
3178
+ if (parent2.namespaceURI === SVG_NAMESPACE) {
3179
+ return tagName === "math" && HTML_INTEGRATION_POINTS[parentTagName];
3180
+ }
3181
+ return Boolean(ALL_MATHML_TAGS[tagName]);
3182
+ }
3183
+ if (element.namespaceURI === HTML_NAMESPACE) {
3184
+ if (parent2.namespaceURI === SVG_NAMESPACE && !HTML_INTEGRATION_POINTS[parentTagName]) {
3185
+ return false;
3186
+ }
3187
+ if (parent2.namespaceURI === MATHML_NAMESPACE && !MATHML_TEXT_INTEGRATION_POINTS[parentTagName]) {
3188
+ return false;
3189
+ }
3190
+ return !ALL_MATHML_TAGS[tagName] && (COMMON_SVG_AND_HTML_ELEMENTS[tagName] || !ALL_SVG_TAGS[tagName]);
3191
+ }
3192
+ if (PARSER_MEDIA_TYPE === "application/xhtml+xml" && ALLOWED_NAMESPACES[element.namespaceURI]) {
3193
+ return true;
3194
+ }
3195
+ return false;
3196
+ };
3197
+ const _forceRemove = function _forceRemove2(node) {
3198
+ arrayPush(DOMPurify.removed, {
3199
+ element: node
3200
+ });
3201
+ try {
3202
+ getParentNode(node).removeChild(node);
3203
+ } catch (_) {
3204
+ remove2(node);
3205
+ }
3206
+ };
3207
+ const _removeAttribute = function _removeAttribute2(name2, element) {
3208
+ try {
3209
+ arrayPush(DOMPurify.removed, {
3210
+ attribute: element.getAttributeNode(name2),
3211
+ from: element
3212
+ });
3213
+ } catch (_) {
3214
+ arrayPush(DOMPurify.removed, {
3215
+ attribute: null,
3216
+ from: element
3217
+ });
3218
+ }
3219
+ element.removeAttribute(name2);
3220
+ if (name2 === "is") {
3221
+ if (RETURN_DOM || RETURN_DOM_FRAGMENT) {
3222
+ try {
3223
+ _forceRemove(element);
3224
+ } catch (_) {
3225
+ }
3226
+ } else {
3227
+ try {
3228
+ element.setAttribute(name2, "");
3229
+ } catch (_) {
3230
+ }
3231
+ }
3232
+ }
3233
+ };
3234
+ const _initDocument = function _initDocument2(dirty) {
3235
+ let doc = null;
3236
+ let leadingWhitespace = null;
3237
+ if (FORCE_BODY) {
3238
+ dirty = "<remove></remove>" + dirty;
3239
+ } else {
3240
+ const matches = stringMatch(dirty, /^[\r\n\t ]+/);
3241
+ leadingWhitespace = matches && matches[0];
3242
+ }
3243
+ if (PARSER_MEDIA_TYPE === "application/xhtml+xml" && NAMESPACE === HTML_NAMESPACE) {
3244
+ dirty = '<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>' + dirty + "</body></html>";
3245
+ }
3246
+ const dirtyPayload = trustedTypesPolicy ? trustedTypesPolicy.createHTML(dirty) : dirty;
3247
+ if (NAMESPACE === HTML_NAMESPACE) {
3248
+ try {
3249
+ doc = new DOMParser().parseFromString(dirtyPayload, PARSER_MEDIA_TYPE);
3250
+ } catch (_) {
3251
+ }
3252
+ }
3253
+ if (!doc || !doc.documentElement) {
3254
+ doc = implementation.createDocument(NAMESPACE, "template", null);
3255
+ try {
3256
+ doc.documentElement.innerHTML = IS_EMPTY_INPUT ? emptyHTML : dirtyPayload;
3257
+ } catch (_) {
3258
+ }
3259
+ }
3260
+ const body = doc.body || doc.documentElement;
3261
+ if (dirty && leadingWhitespace) {
3262
+ body.insertBefore(document2.createTextNode(leadingWhitespace), body.childNodes[0] || null);
3263
+ }
3264
+ if (NAMESPACE === HTML_NAMESPACE) {
3265
+ return getElementsByTagName2.call(doc, WHOLE_DOCUMENT ? "html" : "body")[0];
3266
+ }
3267
+ return WHOLE_DOCUMENT ? doc.documentElement : body;
3268
+ };
3269
+ const _createNodeIterator = function _createNodeIterator2(root2) {
3270
+ return createNodeIterator.call(
3271
+ root2.ownerDocument || root2,
3272
+ root2,
3273
+ // eslint-disable-next-line no-bitwise
3274
+ NodeFilter.SHOW_ELEMENT | NodeFilter.SHOW_COMMENT | NodeFilter.SHOW_TEXT | NodeFilter.SHOW_PROCESSING_INSTRUCTION | NodeFilter.SHOW_CDATA_SECTION,
3275
+ null
3276
+ );
3277
+ };
3278
+ const _isClobbered = function _isClobbered2(element) {
3279
+ return element instanceof HTMLFormElement && (typeof element.nodeName !== "string" || typeof element.textContent !== "string" || typeof element.removeChild !== "function" || !(element.attributes instanceof NamedNodeMap) || typeof element.removeAttribute !== "function" || typeof element.setAttribute !== "function" || typeof element.namespaceURI !== "string" || typeof element.insertBefore !== "function" || typeof element.hasChildNodes !== "function");
3280
+ };
3281
+ const _isNode = function _isNode2(value) {
3282
+ return typeof Node3 === "function" && value instanceof Node3;
3283
+ };
3284
+ function _executeHooks(hooks2, currentNode, data2) {
3285
+ arrayForEach(hooks2, (hook) => {
3286
+ hook.call(DOMPurify, currentNode, data2, CONFIG);
3287
+ });
3288
+ }
3289
+ const _sanitizeElements = function _sanitizeElements2(currentNode) {
3290
+ let content = null;
3291
+ _executeHooks(hooks.beforeSanitizeElements, currentNode, null);
3292
+ if (_isClobbered(currentNode)) {
3293
+ _forceRemove(currentNode);
3294
+ return true;
3295
+ }
3296
+ const tagName = transformCaseFunc(currentNode.nodeName);
3297
+ _executeHooks(hooks.uponSanitizeElement, currentNode, {
3298
+ tagName,
3299
+ allowedTags: ALLOWED_TAGS
3300
+ });
3301
+ if (SAFE_FOR_XML && currentNode.hasChildNodes() && !_isNode(currentNode.firstElementChild) && regExpTest(/<[/\w!]/g, currentNode.innerHTML) && regExpTest(/<[/\w!]/g, currentNode.textContent)) {
3302
+ _forceRemove(currentNode);
3303
+ return true;
3304
+ }
3305
+ if (SAFE_FOR_XML && currentNode.namespaceURI === HTML_NAMESPACE && tagName === "style" && _isNode(currentNode.firstElementChild)) {
3306
+ _forceRemove(currentNode);
3307
+ return true;
3308
+ }
3309
+ if (currentNode.nodeType === NODE_TYPE$1.progressingInstruction) {
3310
+ _forceRemove(currentNode);
3311
+ return true;
3312
+ }
3313
+ if (SAFE_FOR_XML && currentNode.nodeType === NODE_TYPE$1.comment && regExpTest(/<[/\w]/g, currentNode.data)) {
3314
+ _forceRemove(currentNode);
3315
+ return true;
3316
+ }
3317
+ if (FORBID_TAGS[tagName] || !(EXTRA_ELEMENT_HANDLING.tagCheck instanceof Function && EXTRA_ELEMENT_HANDLING.tagCheck(tagName)) && !ALLOWED_TAGS[tagName]) {
3318
+ if (!FORBID_TAGS[tagName] && _isBasicCustomElement(tagName)) {
3319
+ if (CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof RegExp && regExpTest(CUSTOM_ELEMENT_HANDLING.tagNameCheck, tagName)) {
3320
+ return false;
3321
+ }
3322
+ if (CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof Function && CUSTOM_ELEMENT_HANDLING.tagNameCheck(tagName)) {
3323
+ return false;
3324
+ }
3325
+ }
3326
+ if (KEEP_CONTENT && !FORBID_CONTENTS[tagName]) {
3327
+ const parentNode = getParentNode(currentNode) || currentNode.parentNode;
3328
+ const childNodes = getChildNodes(currentNode) || currentNode.childNodes;
3329
+ if (childNodes && parentNode) {
3330
+ const childCount = childNodes.length;
3331
+ for (let i = childCount - 1; i >= 0; --i) {
3332
+ const childClone = cloneNode2(childNodes[i], true);
3333
+ parentNode.insertBefore(childClone, getNextSibling(currentNode));
3334
+ }
3335
+ }
3336
+ }
3337
+ _forceRemove(currentNode);
3338
+ return true;
3339
+ }
3340
+ if (currentNode instanceof Element2 && !_checkValidNamespace(currentNode)) {
3341
+ _forceRemove(currentNode);
3342
+ return true;
3343
+ }
3344
+ if ((tagName === "noscript" || tagName === "noembed" || tagName === "noframes") && regExpTest(/<\/no(script|embed|frames)/i, currentNode.innerHTML)) {
3345
+ _forceRemove(currentNode);
3346
+ return true;
3347
+ }
3348
+ if (SAFE_FOR_TEMPLATES && currentNode.nodeType === NODE_TYPE$1.text) {
3349
+ content = currentNode.textContent;
3350
+ arrayForEach([MUSTACHE_EXPR$1, ERB_EXPR$1, TMPLIT_EXPR$1], (expr) => {
3351
+ content = stringReplace(content, expr, " ");
3352
+ });
3353
+ if (currentNode.textContent !== content) {
3354
+ arrayPush(DOMPurify.removed, {
3355
+ element: currentNode.cloneNode()
3356
+ });
3357
+ currentNode.textContent = content;
3358
+ }
3359
+ }
3360
+ _executeHooks(hooks.afterSanitizeElements, currentNode, null);
3361
+ return false;
3362
+ };
3363
+ const _isValidAttribute = function _isValidAttribute2(lcTag, lcName, value) {
3364
+ if (FORBID_ATTR[lcName]) {
3365
+ return false;
3366
+ }
3367
+ if (SANITIZE_DOM && (lcName === "id" || lcName === "name") && (value in document2 || value in formElement)) {
3368
+ return false;
3369
+ }
3370
+ const nameIsPermitted = ALLOWED_ATTR[lcName] || EXTRA_ELEMENT_HANDLING.attributeCheck instanceof Function && EXTRA_ELEMENT_HANDLING.attributeCheck(lcName, lcTag);
3371
+ if (ALLOW_DATA_ATTR && !FORBID_ATTR[lcName] && regExpTest(DATA_ATTR$1, lcName)) ;
3372
+ else if (ALLOW_ARIA_ATTR && regExpTest(ARIA_ATTR$1, lcName)) ;
3373
+ else if (!nameIsPermitted || FORBID_ATTR[lcName]) {
3374
+ if (
3375
+ // First condition does a very basic check if a) it's basically a valid custom element tagname AND
3376
+ // b) if the tagName passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.tagNameCheck
3377
+ // and c) if the attribute name passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.attributeNameCheck
3378
+ _isBasicCustomElement(lcTag) && (CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof RegExp && regExpTest(CUSTOM_ELEMENT_HANDLING.tagNameCheck, lcTag) || CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof Function && CUSTOM_ELEMENT_HANDLING.tagNameCheck(lcTag)) && (CUSTOM_ELEMENT_HANDLING.attributeNameCheck instanceof RegExp && regExpTest(CUSTOM_ELEMENT_HANDLING.attributeNameCheck, lcName) || CUSTOM_ELEMENT_HANDLING.attributeNameCheck instanceof Function && CUSTOM_ELEMENT_HANDLING.attributeNameCheck(lcName, lcTag)) || // Alternative, second condition checks if it's an `is`-attribute, AND
3379
+ // the value passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.tagNameCheck
3380
+ lcName === "is" && CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements && (CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof RegExp && regExpTest(CUSTOM_ELEMENT_HANDLING.tagNameCheck, value) || CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof Function && CUSTOM_ELEMENT_HANDLING.tagNameCheck(value))
3381
+ ) ;
3382
+ else {
3383
+ return false;
3384
+ }
3385
+ } else if (URI_SAFE_ATTRIBUTES[lcName]) ;
3386
+ else if (regExpTest(IS_ALLOWED_URI$1, stringReplace(value, ATTR_WHITESPACE$1, ""))) ;
3387
+ else if ((lcName === "src" || lcName === "xlink:href" || lcName === "href") && lcTag !== "script" && stringIndexOf(value, "data:") === 0 && DATA_URI_TAGS[lcTag]) ;
3388
+ else if (ALLOW_UNKNOWN_PROTOCOLS && !regExpTest(IS_SCRIPT_OR_DATA$1, stringReplace(value, ATTR_WHITESPACE$1, ""))) ;
3389
+ else if (value) {
3390
+ return false;
3391
+ } else ;
3392
+ return true;
3393
+ };
3394
+ 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"]);
3395
+ const _isBasicCustomElement = function _isBasicCustomElement2(tagName) {
3396
+ return !RESERVED_CUSTOM_ELEMENT_NAMES[stringToLowerCase(tagName)] && regExpTest(CUSTOM_ELEMENT$1, tagName);
3397
+ };
3398
+ const _sanitizeAttributes = function _sanitizeAttributes2(currentNode) {
3399
+ _executeHooks(hooks.beforeSanitizeAttributes, currentNode, null);
3400
+ const attributes2 = currentNode.attributes;
3401
+ if (!attributes2 || _isClobbered(currentNode)) {
3402
+ return;
3403
+ }
3404
+ const hookEvent = {
3405
+ attrName: "",
3406
+ attrValue: "",
3407
+ keepAttr: true,
3408
+ allowedAttributes: ALLOWED_ATTR,
3409
+ forceKeepAttr: void 0
3410
+ };
3411
+ let l2 = attributes2.length;
3412
+ while (l2--) {
3413
+ const attr2 = attributes2[l2];
3414
+ const name2 = attr2.name, namespaceURI = attr2.namespaceURI, attrValue = attr2.value;
3415
+ const lcName = transformCaseFunc(name2);
3416
+ const initValue = attrValue;
3417
+ let value = name2 === "value" ? initValue : stringTrim(initValue);
3418
+ hookEvent.attrName = lcName;
3419
+ hookEvent.attrValue = value;
3420
+ hookEvent.keepAttr = true;
3421
+ hookEvent.forceKeepAttr = void 0;
3422
+ _executeHooks(hooks.uponSanitizeAttribute, currentNode, hookEvent);
3423
+ value = hookEvent.attrValue;
3424
+ if (SANITIZE_NAMED_PROPS && (lcName === "id" || lcName === "name") && stringIndexOf(value, SANITIZE_NAMED_PROPS_PREFIX) !== 0) {
3425
+ _removeAttribute(name2, currentNode);
3426
+ value = SANITIZE_NAMED_PROPS_PREFIX + value;
3427
+ }
3428
+ if (SAFE_FOR_XML && regExpTest(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i, value)) {
3429
+ _removeAttribute(name2, currentNode);
3430
+ continue;
3431
+ }
3432
+ if (lcName === "attributename" && stringMatch(value, "href")) {
3433
+ _removeAttribute(name2, currentNode);
3434
+ continue;
3435
+ }
3436
+ if (hookEvent.forceKeepAttr) {
3437
+ continue;
3438
+ }
3439
+ if (!hookEvent.keepAttr) {
3440
+ _removeAttribute(name2, currentNode);
3441
+ continue;
3442
+ }
3443
+ if (!ALLOW_SELF_CLOSE_IN_ATTR && regExpTest(/\/>/i, value)) {
3444
+ _removeAttribute(name2, currentNode);
3445
+ continue;
3446
+ }
3447
+ if (SAFE_FOR_TEMPLATES) {
3448
+ arrayForEach([MUSTACHE_EXPR$1, ERB_EXPR$1, TMPLIT_EXPR$1], (expr) => {
3449
+ value = stringReplace(value, expr, " ");
3450
+ });
3451
+ }
3452
+ const lcTag = transformCaseFunc(currentNode.nodeName);
3453
+ if (!_isValidAttribute(lcTag, lcName, value)) {
3454
+ _removeAttribute(name2, currentNode);
3455
+ continue;
3456
+ }
3457
+ if (trustedTypesPolicy && typeof trustedTypes === "object" && typeof trustedTypes.getAttributeType === "function") {
3458
+ if (namespaceURI) ;
3459
+ else {
3460
+ switch (trustedTypes.getAttributeType(lcTag, lcName)) {
3461
+ case "TrustedHTML": {
3462
+ value = trustedTypesPolicy.createHTML(value);
3463
+ break;
3464
+ }
3465
+ case "TrustedScriptURL": {
3466
+ value = trustedTypesPolicy.createScriptURL(value);
3467
+ break;
3468
+ }
3469
+ }
3470
+ }
3471
+ }
3472
+ if (value !== initValue) {
3473
+ try {
3474
+ if (namespaceURI) {
3475
+ currentNode.setAttributeNS(namespaceURI, name2, value);
3476
+ } else {
3477
+ currentNode.setAttribute(name2, value);
3478
+ }
3479
+ if (_isClobbered(currentNode)) {
3480
+ _forceRemove(currentNode);
3481
+ } else {
3482
+ arrayPop(DOMPurify.removed);
3483
+ }
3484
+ } catch (_) {
3485
+ _removeAttribute(name2, currentNode);
3486
+ }
3487
+ }
3488
+ }
3489
+ _executeHooks(hooks.afterSanitizeAttributes, currentNode, null);
3490
+ };
3491
+ const _sanitizeShadowDOM2 = function _sanitizeShadowDOM(fragment) {
3492
+ let shadowNode = null;
3493
+ const shadowIterator = _createNodeIterator(fragment);
3494
+ _executeHooks(hooks.beforeSanitizeShadowDOM, fragment, null);
3495
+ while (shadowNode = shadowIterator.nextNode()) {
3496
+ _executeHooks(hooks.uponSanitizeShadowNode, shadowNode, null);
3497
+ _sanitizeElements(shadowNode);
3498
+ _sanitizeAttributes(shadowNode);
3499
+ if (shadowNode.content instanceof DocumentFragment) {
3500
+ _sanitizeShadowDOM2(shadowNode.content);
3501
+ }
3502
+ }
3503
+ _executeHooks(hooks.afterSanitizeShadowDOM, fragment, null);
3504
+ };
3505
+ const _sanitizeAttachedShadowRoots2 = function _sanitizeAttachedShadowRoots(root2) {
3506
+ if (root2.nodeType === NODE_TYPE$1.element && root2.shadowRoot instanceof DocumentFragment) {
3507
+ const sr = root2.shadowRoot;
3508
+ _sanitizeAttachedShadowRoots2(sr);
3509
+ _sanitizeShadowDOM2(sr);
3510
+ }
3511
+ const childNodes = root2.childNodes;
3512
+ if (!childNodes) {
3513
+ return;
3514
+ }
3515
+ const snapshot = [];
3516
+ arrayForEach(childNodes, (child) => {
3517
+ arrayPush(snapshot, child);
3518
+ });
3519
+ for (const child of snapshot) {
3520
+ _sanitizeAttachedShadowRoots2(child);
3521
+ }
3522
+ };
3523
+ DOMPurify.sanitize = function(dirty) {
3524
+ let cfg = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
3525
+ let body = null;
3526
+ let importedNode = null;
3527
+ let currentNode = null;
3528
+ let returnNode = null;
3529
+ IS_EMPTY_INPUT = !dirty;
3530
+ if (IS_EMPTY_INPUT) {
3531
+ dirty = "<!-->";
3532
+ }
3533
+ if (typeof dirty !== "string" && !_isNode(dirty)) {
3534
+ dirty = stringifyValue(dirty);
3535
+ if (typeof dirty !== "string") {
3536
+ throw typeErrorCreate("dirty is not a string, aborting");
3537
+ }
3538
+ }
3539
+ if (!DOMPurify.isSupported) {
3540
+ return dirty;
3541
+ }
3542
+ if (!SET_CONFIG) {
3543
+ _parseConfig(cfg);
3544
+ }
3545
+ DOMPurify.removed = [];
3546
+ if (typeof dirty === "string") {
3547
+ IN_PLACE = false;
3548
+ }
3549
+ if (IN_PLACE) {
3550
+ const nn = dirty.nodeName;
3551
+ if (typeof nn === "string") {
3552
+ const tagName = transformCaseFunc(nn);
3553
+ if (!ALLOWED_TAGS[tagName] || FORBID_TAGS[tagName]) {
3554
+ throw typeErrorCreate("root node is forbidden and cannot be sanitized in-place");
3555
+ }
3556
+ }
3557
+ _sanitizeAttachedShadowRoots2(dirty);
3558
+ } else if (dirty instanceof Node3) {
3559
+ body = _initDocument("<!---->");
3560
+ importedNode = body.ownerDocument.importNode(dirty, true);
3561
+ if (importedNode.nodeType === NODE_TYPE$1.element && importedNode.nodeName === "BODY") {
3562
+ body = importedNode;
3563
+ } else if (importedNode.nodeName === "HTML") {
3564
+ body = importedNode;
3565
+ } else {
3566
+ body.appendChild(importedNode);
3567
+ }
3568
+ _sanitizeAttachedShadowRoots2(importedNode);
3569
+ } else {
3570
+ if (!RETURN_DOM && !SAFE_FOR_TEMPLATES && !WHOLE_DOCUMENT && // eslint-disable-next-line unicorn/prefer-includes
3571
+ dirty.indexOf("<") === -1) {
3572
+ return trustedTypesPolicy && RETURN_TRUSTED_TYPE ? trustedTypesPolicy.createHTML(dirty) : dirty;
3573
+ }
3574
+ body = _initDocument(dirty);
3575
+ if (!body) {
3576
+ return RETURN_DOM ? null : RETURN_TRUSTED_TYPE ? emptyHTML : "";
3577
+ }
3578
+ }
3579
+ if (body && FORCE_BODY) {
3580
+ _forceRemove(body.firstChild);
3581
+ }
3582
+ const nodeIterator = _createNodeIterator(IN_PLACE ? dirty : body);
3583
+ while (currentNode = nodeIterator.nextNode()) {
3584
+ _sanitizeElements(currentNode);
3585
+ _sanitizeAttributes(currentNode);
3586
+ if (currentNode.content instanceof DocumentFragment) {
3587
+ _sanitizeShadowDOM2(currentNode.content);
3588
+ }
3589
+ }
3590
+ if (IN_PLACE) {
3591
+ return dirty;
3592
+ }
3593
+ if (RETURN_DOM) {
3594
+ if (SAFE_FOR_TEMPLATES) {
3595
+ body.normalize();
3596
+ let html2 = body.innerHTML;
3597
+ arrayForEach([MUSTACHE_EXPR$1, ERB_EXPR$1, TMPLIT_EXPR$1], (expr) => {
3598
+ html2 = stringReplace(html2, expr, " ");
3599
+ });
3600
+ body.innerHTML = html2;
3601
+ }
3602
+ if (RETURN_DOM_FRAGMENT) {
3603
+ returnNode = createDocumentFragment.call(body.ownerDocument);
3604
+ while (body.firstChild) {
3605
+ returnNode.appendChild(body.firstChild);
3606
+ }
3607
+ } else {
3608
+ returnNode = body;
3609
+ }
3610
+ if (ALLOWED_ATTR.shadowroot || ALLOWED_ATTR.shadowrootmode) {
3611
+ returnNode = importNode.call(originalDocument, returnNode, true);
3612
+ }
3613
+ return returnNode;
3614
+ }
3615
+ let serializedHTML = WHOLE_DOCUMENT ? body.outerHTML : body.innerHTML;
3616
+ if (WHOLE_DOCUMENT && ALLOWED_TAGS["!doctype"] && body.ownerDocument && body.ownerDocument.doctype && body.ownerDocument.doctype.name && regExpTest(DOCTYPE_NAME, body.ownerDocument.doctype.name)) {
3617
+ serializedHTML = "<!DOCTYPE " + body.ownerDocument.doctype.name + ">\n" + serializedHTML;
3618
+ }
3619
+ if (SAFE_FOR_TEMPLATES) {
3620
+ arrayForEach([MUSTACHE_EXPR$1, ERB_EXPR$1, TMPLIT_EXPR$1], (expr) => {
3621
+ serializedHTML = stringReplace(serializedHTML, expr, " ");
3622
+ });
3623
+ }
3624
+ return trustedTypesPolicy && RETURN_TRUSTED_TYPE ? trustedTypesPolicy.createHTML(serializedHTML) : serializedHTML;
3625
+ };
3626
+ DOMPurify.setConfig = function() {
3627
+ let cfg = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
3628
+ _parseConfig(cfg);
3629
+ SET_CONFIG = true;
3630
+ };
3631
+ DOMPurify.clearConfig = function() {
3632
+ CONFIG = null;
3633
+ SET_CONFIG = false;
3634
+ };
3635
+ DOMPurify.isValidAttribute = function(tag, attr2, value) {
3636
+ if (!CONFIG) {
3637
+ _parseConfig({});
3638
+ }
3639
+ const lcTag = transformCaseFunc(tag);
3640
+ const lcName = transformCaseFunc(attr2);
3641
+ return _isValidAttribute(lcTag, lcName, value);
3642
+ };
3643
+ DOMPurify.addHook = function(entryPoint, hookFunction) {
3644
+ if (typeof hookFunction !== "function") {
3645
+ return;
3646
+ }
3647
+ arrayPush(hooks[entryPoint], hookFunction);
3648
+ };
3649
+ DOMPurify.removeHook = function(entryPoint, hookFunction) {
3650
+ if (hookFunction !== void 0) {
3651
+ const index2 = arrayLastIndexOf(hooks[entryPoint], hookFunction);
3652
+ return index2 === -1 ? void 0 : arraySplice(hooks[entryPoint], index2, 1)[0];
3653
+ }
3654
+ return arrayPop(hooks[entryPoint]);
3655
+ };
3656
+ DOMPurify.removeHooks = function(entryPoint) {
3657
+ hooks[entryPoint] = [];
3658
+ };
3659
+ DOMPurify.removeAllHooks = function() {
3660
+ hooks = _createHooksMap();
3661
+ };
3662
+ return DOMPurify;
3663
+ }
3664
+ var purify = createDOMPurify();
2435
3665
  ABConvert.factory({
2436
3666
  id: "md",
2437
3667
  name: "md",
@@ -2451,7 +3681,7 @@ ABConvert.factory({
2451
3681
  process_param: ABConvert_IOEnum.text,
2452
3682
  process_return: ABConvert_IOEnum.el,
2453
3683
  process: (el, header, content) => {
2454
- el.innerHTML = `<p>${content.replace(/ /g, "&nbsp;").split("\n").join("<br/>")}</p>`;
3684
+ el.innerHTML = purify.sanitize(`<p>${content.replace(/ /g, "&nbsp;").split("\n").join("<br/>")}</p>`);
2455
3685
  return el;
2456
3686
  }
2457
3687
  });
@@ -3171,12 +4401,10 @@ ABConvert.factory({
3171
4401
  process_return: ABConvert_IOEnum.json,
3172
4402
  process: (el, header, content) => {
3173
4403
  return JSON.stringify(
3174
- ABAlias_json.map((item) => {
3175
- return {
3176
- regex: item.regex.toString(),
3177
- replacement: item.replacement
3178
- };
3179
- }),
4404
+ Array.from(get_ABAlias_iter(), (item) => ({
4405
+ regex: item.regex.toString(),
4406
+ replacement: item.replacement
4407
+ })),
3180
4408
  null,
3181
4409
  2
3182
4410
  );
@@ -15127,7 +16355,7 @@ ABConvert.factory({
15127
16355
  async function render_pumlText(text2, div) {
15128
16356
  var encoded = plantumlEncoder.encode(text2);
15129
16357
  let url = "http://www.plantuml.com/plantuml/img/" + encoded;
15130
- div.innerHTML = `<img src="${url}">`;
16358
+ div.innerHTML = purify.sanitize(`<img src="${url}">`);
15131
16359
  return div;
15132
16360
  }
15133
16361
  function getID(length = 16) {
@@ -15302,206 +16530,20 @@ async function data2mindmap(list_itemInfo, div) {
15302
16530
  return render_mermaidText(mermaidText, div);
15303
16531
  }
15304
16532
  async function render_mermaidText(mermaidText, div) {
15305
- if (ABCSetting.env.startsWith("obsidian") && ABCSetting.mermaid) {
15306
- ABCSetting.mermaid.then(async (mermaid) => {
15307
- const { svg } = await mermaid.render("ab-mermaid-" + getID(), mermaidText);
15308
- div.innerHTML = svg;
16533
+ if (ABCSetting.env.startsWith("obsidian") && ABCSetting.obsidian.mermaid) {
16534
+ ABCSetting.obsidian.mermaid.then(async (mermaid) => {
16535
+ const { svg: svg2 } = await mermaid.render("ab-mermaid-" + getID(), mermaidText);
16536
+ const div_mermaid = document.createElement("div");
16537
+ div.appendChild(div_mermaid);
16538
+ div_mermaid.classList.add("mermaid");
16539
+ div_mermaid.innerHTML = svg2;
15309
16540
  });
15310
16541
  } else {
15311
16542
  div.classList.add("ab-raw");
15312
- div.innerHTML = `<div class="ab-raw-data" type-data="mermaid" content-data='${mermaidText}'></div>`;
16543
+ div.innerHTML = purify.sanitize(`<div class="ab-raw-data" type-data="mermaid" content-data='${mermaidText}'></div>`);
15313
16544
  }
15314
16545
  return div;
15315
16546
  }
15316
- function abConvertEvent(d, isCycle = false) {
15317
- if (d.querySelector(".ab-super-width")) {
15318
- const els_note = d.querySelectorAll(".ab-note");
15319
- for (const el_note of els_note) {
15320
- if (el_note.querySelector(".ab-super-width")) {
15321
- const el_replace = el_note.parentNode;
15322
- if (el_replace && el_replace.classList.contains("ab-replace")) {
15323
- el_replace.classList.add("ab-super-width-p");
15324
- }
15325
- }
15326
- }
15327
- const els_view = document.querySelectorAll(".app-container .workspace-leaf");
15328
- for (const el_view of els_view) {
15329
- el_view.style.setProperty("--ab-width-outer", (el_view.offsetWidth - 40).toString() + "px");
15330
- }
15331
- }
15332
- if (d.querySelector(".ab-nodes-node")) {
15333
- const els_min = document.querySelectorAll(".ab-nodes.min .ab-nodes-node");
15334
- const list_children = d.querySelectorAll(".ab-nodes-node");
15335
- for (const children2 of list_children) {
15336
- const el_content = children2.querySelector(".ab-nodes-content");
15337
- if (!el_content) continue;
15338
- const el_child = children2.querySelector(".ab-nodes-children");
15339
- if (!el_child) continue;
15340
- const el_bracket = el_child.querySelector(".ab-nodes-bracket");
15341
- if (!el_bracket) continue;
15342
- const el_bracket2 = el_child.querySelector(".ab-nodes-bracket2");
15343
- if (!el_bracket2) continue;
15344
- const els_child = el_child.childNodes;
15345
- if (els_child.length < 3) {
15346
- el_bracket.style.setProperty("display", "none");
15347
- el_bracket2.style.setProperty("display", "none");
15348
- continue;
15349
- }
15350
- const el_child_first = els_child[2];
15351
- const el_child_last = els_child[els_child.length - 1];
15352
- const el_child_first_content = el_child_first.querySelector(".ab-nodes-content");
15353
- const el_child_last_content = el_child_last.querySelector(".ab-nodes-content");
15354
- let height = 0;
15355
- let heightToReduce = (el_child_first.offsetHeight + el_child_last.offsetHeight) / 2;
15356
- if (els_child.length == 3) {
15357
- height = el_child_first_content.offsetHeight - 20 > 20 ? el_child_first_content.offsetHeight - 20 : 20;
15358
- el_bracket2.style.cssText = `
15359
- height: ${height}px;
15360
- top: calc(50% - ${height / 2}px);
15361
- `;
15362
- } else {
15363
- el_bracket2.style.cssText = `
15364
- height: calc(100% - ${heightToReduce}px);
15365
- top: ${el_child_first.offsetHeight / 2}px;
15366
- `;
15367
- }
15368
- if (Array.prototype.includes.call(els_min, children2)) {
15369
- if (els_child.length == 3) {
15370
- el_bracket.style.cssText = `
15371
- display: block;
15372
- top: calc(50% + ${el_content.offsetHeight / 2}px - 3px);
15373
- clip-path: circle(40% at 50% 40%);
15374
- `;
15375
- } else {
15376
- el_bracket.setAttribute("display", "none");
15377
- }
15378
- if (els_child.length == 3 && el_content.offsetHeight == el_child_first_content.offsetHeight) {
15379
- el_bracket2.style.cssText = `
15380
- height: 1px;
15381
- top: calc(50% + ${el_content.offsetHeight / 2}px - 1px);
15382
- width: 18px; /* 可以溢出点 */
15383
- border-radius: 0;
15384
- border: none;
15385
- border-bottom: 1px solid var(--node-color);
15386
- `;
15387
- } else {
15388
- if (els_child.length == 3) {
15389
- height = el_child_last_content.offsetHeight / 2 - el_content.offsetHeight / 2;
15390
- el_bracket2.style.setProperty("height", `${height}px`);
15391
- el_bracket2.style.setProperty("top", `calc(50% + ${el_content.offsetHeight / 2}px)`);
15392
- el_bracket2.style.setProperty("border-radius", `0 0 0 10px`);
15393
- el_bracket2.style.setProperty("border-top", `0`);
15394
- } else {
15395
- heightToReduce = el_child_first.offsetHeight / 2 + el_child_first_content.offsetHeight / 2 + el_child_last.offsetHeight / 2 - el_child_last_content.offsetHeight / 2;
15396
- el_bracket2.style.setProperty("height", `calc(100% - ${heightToReduce}px + 1px)`);
15397
- el_bracket2.style.setProperty("top", `${el_child_first.offsetHeight / 2 + el_child_first_content.offsetHeight / 2 - 1}px`);
15398
- }
15399
- el_bracket2.style.setProperty("width", "20px");
15400
- }
15401
- }
15402
- }
15403
- }
15404
- if (d.querySelector(".ab-items.ab-lay-vfall:not(.js-waterfall):not(.ab-lay-hfall):not(.ab-lay-grid)")) {
15405
- const root_el_list = d.querySelectorAll(".ab-items.ab-lay-vfall:not(.js-waterfall):not(.ab-lay-hfall):not(.ab-lay-grid)");
15406
- for (const root_el of root_el_list) {
15407
- root_el.classList.add("js-waterfall");
15408
- const list_children = root_el.querySelectorAll(".ab-items-item");
15409
- const columnCountTmp = parseInt(window.getComputedStyle(root_el).getPropertyValue("column-count"));
15410
- let columnCount;
15411
- if (columnCountTmp && !isNaN(columnCountTmp) && columnCountTmp > 0) {
15412
- columnCount = columnCountTmp;
15413
- } else if (root_el.classList.contains("ab-col-auto") && list_children.length <= 4) {
15414
- columnCount = list_children.length;
15415
- root_el.classList.add("ab-col" + columnCount);
15416
- } else {
15417
- columnCount = 4;
15418
- root_el.classList.add("ab-col" + columnCount);
15419
- }
15420
- const height_cache = [];
15421
- const el_cache = [];
15422
- for (let i = 0; i < columnCount; i++) {
15423
- height_cache.push(0);
15424
- el_cache.push([]);
15425
- }
15426
- for (const children2 of list_children) {
15427
- const minValue = Math.min.apply(null, height_cache);
15428
- const minIndex = height_cache.indexOf(minValue);
15429
- const heightTmp = parseInt(window.getComputedStyle(children2).getPropertyValue("height"));
15430
- height_cache[minIndex] += heightTmp && !isNaN(heightTmp) && heightTmp > 0 ? heightTmp : 10;
15431
- el_cache[minIndex].push(children2);
15432
- }
15433
- const fillNumber = columnCount - list_children.length % columnCount;
15434
- if (fillNumber != 4) {
15435
- for (let i = 0; i < fillNumber; i++) {
15436
- const children2 = document.createElement("div");
15437
- children2.classList.add(".ab-items-item.placeholder");
15438
- children2.setAttribute("style", "height: 20px");
15439
- const minValue = Math.min.apply(null, height_cache);
15440
- const minIndex = height_cache.indexOf(minValue);
15441
- height_cache[minIndex] += 20;
15442
- el_cache[minIndex].push(children2);
15443
- }
15444
- }
15445
- root_el.innerHTML = "";
15446
- for (let i = 0; i < columnCount; i++) {
15447
- for (const j of el_cache[i]) {
15448
- root_el.appendChild(j);
15449
- }
15450
- }
15451
- }
15452
- }
15453
- if (!isCycle && d.querySelector(".ab-markmap-div")) {
15454
- const divEl = d;
15455
- let markmapId = "";
15456
- if (divEl.tagName === "DIV") {
15457
- markmapId = divEl.querySelector(".ab-markmap-div")?.id || "";
15458
- }
15459
- let mindmaps;
15460
- if (markmapId) {
15461
- mindmaps = document.querySelectorAll("#" + markmapId);
15462
- } else {
15463
- mindmaps = document.querySelectorAll(".ab-markmap-div");
15464
- }
15465
- for (const el_div of mindmaps) {
15466
- const el_svg = el_div.querySelector("svg");
15467
- const el_g = el_svg?.querySelector("g");
15468
- if (el_svg && el_g) {
15469
- const scale_new = el_g.getBBox().height / el_div.offsetWidth;
15470
- el_svg.setAttribute("style", `height:${el_g.getBBox().height * scale_new + 40}px`);
15471
- markmap_event(d);
15472
- }
15473
- }
15474
- }
15475
- }
15476
- function markmap_event(d) {
15477
- if (d.querySelector(".ab-markmap-svg")) {
15478
- console.log(" - markmap_event");
15479
- let script_el = document.querySelector('script[script-id="ab-markmap-script"]');
15480
- if (script_el) script_el.remove();
15481
- const divEl = d;
15482
- let markmapId = "";
15483
- if (divEl.tagName === "DIV") {
15484
- markmapId = divEl.querySelector(".ab-markmap-svg")?.id || "";
15485
- }
15486
- script_el = document.createElement("script");
15487
- document.head.appendChild(script_el);
15488
- script_el.type = "module";
15489
- script_el.setAttribute("script-id", "ab-markmap-script");
15490
- script_el.textContent = `
15491
- import { Markmap, } from 'https://jspm.dev/markmap-view';
15492
- const markmapId = "${markmapId || ""}";
15493
- let mindmaps;
15494
- if (markmapId) {
15495
- mindmaps = document.querySelectorAll('#' + markmapId);
15496
- } else {
15497
- mindmaps = document.querySelectorAll('.ab-markmap-svg'); // 注意一下这里的选择器
15498
- }
15499
- for(const mindmap of mindmaps) {
15500
- mindmap.innerHTML = "";
15501
- Markmap.create(mindmap,null,JSON.parse(mindmap.getAttribute('data-json')));
15502
- }`;
15503
- }
15504
- }
15505
16547
  const testPath = "npm2url/dist/index.cjs";
15506
16548
  const defaultProviders = {
15507
16549
  jsdelivr: (path) => `https://cdn.jsdelivr.net/npm/${path}`,
@@ -41127,8 +42169,8 @@ function requireKatex() {
41127
42169
  var _functions = {};
41128
42170
  var _htmlGroupBuilders = {};
41129
42171
  var _mathmlGroupBuilders = {};
41130
- function defineFunction(_ref) {
41131
- var type = _ref.type, names = _ref.names, props = _ref.props, handler = _ref.handler, htmlBuilder = _ref.htmlBuilder, mathmlBuilder = _ref.mathmlBuilder;
42172
+ function defineFunction(_ref2) {
42173
+ var type = _ref2.type, names = _ref2.names, props = _ref2.props, handler = _ref2.handler, htmlBuilder = _ref2.htmlBuilder, mathmlBuilder = _ref2.mathmlBuilder;
41132
42174
  var data2 = {
41133
42175
  type,
41134
42176
  numArgs: props.numArgs,
@@ -42126,8 +43168,8 @@ function requireKatex() {
42126
43168
  props: {
42127
43169
  numArgs: 1
42128
43170
  },
42129
- handler: function handler(_ref, args) {
42130
- var parser = _ref.parser, funcName = _ref.funcName;
43171
+ handler: function handler(_ref2, args) {
43172
+ var parser = _ref2.parser, funcName = _ref2.funcName;
42131
43173
  var base = args[0];
42132
43174
  return {
42133
43175
  type: "accentUnder",
@@ -42202,8 +43244,8 @@ function requireKatex() {
42202
43244
  numArgs: 1,
42203
43245
  numOptionalArgs: 1
42204
43246
  },
42205
- handler: function handler(_ref, args, optArgs) {
42206
- var parser = _ref.parser, funcName = _ref.funcName;
43247
+ handler: function handler(_ref2, args, optArgs) {
43248
+ var parser = _ref2.parser, funcName = _ref2.funcName;
42207
43249
  return {
42208
43250
  type: "xArrow",
42209
43251
  mode: parser.mode,
@@ -42295,8 +43337,8 @@ function requireKatex() {
42295
43337
  numArgs: 1,
42296
43338
  allowedInText: true
42297
43339
  },
42298
- handler: function handler(_ref, args) {
42299
- var parser = _ref.parser;
43340
+ handler: function handler(_ref2, args) {
43341
+ var parser = _ref2.parser;
42300
43342
  var arg = assertNodeType(args[0], "ordgroup");
42301
43343
  var group = arg.body;
42302
43344
  var number = "";
@@ -42334,8 +43376,8 @@ function requireKatex() {
42334
43376
  greediness: 3,
42335
43377
  argTypes: ["color", "original"]
42336
43378
  },
42337
- handler: function handler(_ref, args) {
42338
- var parser = _ref.parser;
43379
+ handler: function handler(_ref2, args) {
43380
+ var parser = _ref2.parser;
42339
43381
  var color2 = assertNodeType(args[0], "color-token").color;
42340
43382
  var body = args[1];
42341
43383
  return {
@@ -42381,8 +43423,8 @@ function requireKatex() {
42381
43423
  argTypes: ["size"],
42382
43424
  allowedInText: true
42383
43425
  },
42384
- handler: function handler(_ref, args, optArgs) {
42385
- var parser = _ref.parser, funcName = _ref.funcName;
43426
+ handler: function handler(_ref2, args, optArgs) {
43427
+ var parser = _ref2.parser, funcName = _ref2.funcName;
42386
43428
  var size = optArgs[0];
42387
43429
  var newRow = funcName === "\\cr";
42388
43430
  var newLine = false;
@@ -42475,8 +43517,8 @@ function requireKatex() {
42475
43517
  numArgs: 0,
42476
43518
  allowedInText: true
42477
43519
  },
42478
- handler: function handler(_ref) {
42479
- var parser = _ref.parser, funcName = _ref.funcName;
43520
+ handler: function handler(_ref2) {
43521
+ var parser = _ref2.parser, funcName = _ref2.funcName;
42480
43522
  parser.consumeSpaces();
42481
43523
  var token = parser.fetch();
42482
43524
  if (globalMap[token.text]) {
@@ -42810,14 +43852,14 @@ function requireKatex() {
42810
43852
  var delimiter_sqrtSvg = function sqrtSvg(sqrtName, height, viewBoxHeight, extraViniculum, options) {
42811
43853
  var path = sqrtPath(sqrtName, extraViniculum, viewBoxHeight);
42812
43854
  var pathNode = new domTree_PathNode(sqrtName, path);
42813
- var svg = new SvgNode([pathNode], {
43855
+ var svg2 = new SvgNode([pathNode], {
42814
43856
  // Note: 1000:1 ratio of viewBox to document em width.
42815
43857
  "width": "400em",
42816
43858
  "height": height + "em",
42817
43859
  "viewBox": "0 0 400000 " + viewBoxHeight,
42818
43860
  "preserveAspectRatio": "xMinYMin slice"
42819
43861
  });
42820
- return buildCommon.makeSvgSpan(["hide-tail"], [svg], options);
43862
+ return buildCommon.makeSvgSpan(["hide-tail"], [svg2], options);
42821
43863
  };
42822
43864
  var makeSqrtImage = function makeSqrtImage2(height, options) {
42823
43865
  var newOptions = options.havingBaseSizing();
@@ -43427,8 +44469,8 @@ function requireKatex() {
43427
44469
  greediness: 3,
43428
44470
  argTypes: ["color", "text"]
43429
44471
  },
43430
- handler: function handler(_ref, args, optArgs) {
43431
- var parser = _ref.parser, funcName = _ref.funcName;
44472
+ handler: function handler(_ref2, args, optArgs) {
44473
+ var parser = _ref2.parser, funcName = _ref2.funcName;
43432
44474
  var color2 = assertNodeType(args[0], "color-token").color;
43433
44475
  var body = args[1];
43434
44476
  return {
@@ -43506,8 +44548,8 @@ function requireKatex() {
43506
44548
  mathmlBuilder: enclose_mathmlBuilder
43507
44549
  });
43508
44550
  var _environments = {};
43509
- function defineEnvironment(_ref) {
43510
- var type = _ref.type, names = _ref.names, props = _ref.props, handler = _ref.handler, htmlBuilder = _ref.htmlBuilder, mathmlBuilder = _ref.mathmlBuilder;
44551
+ function defineEnvironment(_ref2) {
44552
+ var type = _ref2.type, names = _ref2.names, props = _ref2.props, handler = _ref2.handler, htmlBuilder = _ref2.htmlBuilder, mathmlBuilder = _ref2.mathmlBuilder;
43511
44553
  var data2 = {
43512
44554
  type,
43513
44555
  numArgs: props.numArgs || 0,
@@ -43538,8 +44580,8 @@ function requireKatex() {
43538
44580
  }
43539
44581
  return hlineInfo;
43540
44582
  }
43541
- function parseArray(parser, _ref, style) {
43542
- var hskipBeforeAndAfter = _ref.hskipBeforeAndAfter, addJot = _ref.addJot, cols = _ref.cols, arraystretch = _ref.arraystretch, colSeparationType = _ref.colSeparationType;
44583
+ function parseArray(parser, _ref2, style) {
44584
+ var hskipBeforeAndAfter = _ref2.hskipBeforeAndAfter, addJot = _ref2.addJot, cols = _ref2.cols, arraystretch = _ref2.arraystretch, colSeparationType = _ref2.colSeparationType;
43543
44585
  parser.gullet.beginGroup();
43544
44586
  parser.gullet.macros.set("\\\\", "\\cr");
43545
44587
  if (!arraystretch) {
@@ -44178,8 +45220,8 @@ function requireKatex() {
44178
45220
  numArgs: 1,
44179
45221
  argTypes: ["text"]
44180
45222
  },
44181
- handler: function handler(_ref, args) {
44182
- var parser = _ref.parser, funcName = _ref.funcName;
45223
+ handler: function handler(_ref2, args) {
45224
+ var parser = _ref2.parser, funcName = _ref2.funcName;
44183
45225
  var nameGroup = args[0];
44184
45226
  if (nameGroup.type !== "ordgroup") {
44185
45227
  throw new src_ParseError("Invalid environment name", nameGroup);
@@ -44259,8 +45301,8 @@ function requireKatex() {
44259
45301
  props: {
44260
45302
  numArgs: 1
44261
45303
  },
44262
- handler: function handler(_ref, args) {
44263
- var parser = _ref.parser, funcName = _ref.funcName;
45304
+ handler: function handler(_ref2, args) {
45305
+ var parser = _ref2.parser, funcName = _ref2.funcName;
44264
45306
  var body = args[0];
44265
45307
  return {
44266
45308
  type: "mclass",
@@ -44383,8 +45425,8 @@ function requireKatex() {
44383
45425
  numArgs: 1,
44384
45426
  greediness: 2
44385
45427
  },
44386
- handler: function handler(_ref, args) {
44387
- var parser = _ref.parser, funcName = _ref.funcName;
45428
+ handler: function handler(_ref2, args) {
45429
+ var parser = _ref2.parser, funcName = _ref2.funcName;
44388
45430
  var body = args[0];
44389
45431
  var func = funcName;
44390
45432
  if (func in fontAliases) {
@@ -44638,8 +45680,8 @@ function requireKatex() {
44638
45680
  numArgs: 2,
44639
45681
  greediness: 2
44640
45682
  },
44641
- handler: function handler(_ref, args) {
44642
- var parser = _ref.parser, funcName = _ref.funcName;
45683
+ handler: function handler(_ref2, args) {
45684
+ var parser = _ref2.parser, funcName = _ref2.funcName;
44643
45685
  var numer = args[0];
44644
45686
  var denom = args[1];
44645
45687
  var hasBarLine;
@@ -44940,8 +45982,8 @@ function requireKatex() {
44940
45982
  props: {
44941
45983
  numArgs: 1
44942
45984
  },
44943
- handler: function handler(_ref, args) {
44944
- var parser = _ref.parser, funcName = _ref.funcName;
45985
+ handler: function handler(_ref2, args) {
45986
+ var parser = _ref2.parser, funcName = _ref2.funcName;
44945
45987
  return {
44946
45988
  type: "horizBrace",
44947
45989
  mode: parser.mode,
@@ -44961,8 +46003,8 @@ function requireKatex() {
44961
46003
  argTypes: ["url", "original"],
44962
46004
  allowedInText: true
44963
46005
  },
44964
- handler: function handler(_ref, args) {
44965
- var parser = _ref.parser;
46006
+ handler: function handler(_ref2, args) {
46007
+ var parser = _ref2.parser;
44966
46008
  var body = args[1];
44967
46009
  var href = assertNodeType(args[0], "url").url;
44968
46010
  if (!parser.settings.isTrusted({
@@ -45042,9 +46084,9 @@ function requireKatex() {
45042
46084
  argTypes: ["raw", "original"],
45043
46085
  allowedInText: true
45044
46086
  },
45045
- handler: function handler(_ref, args) {
45046
- var parser = _ref.parser, funcName = _ref.funcName;
45047
- _ref.token;
46087
+ handler: function handler(_ref2, args) {
46088
+ var parser = _ref2.parser, funcName = _ref2.funcName;
46089
+ _ref2.token;
45048
46090
  var value = assertNodeType(args[0], "raw").string;
45049
46091
  var body = args[1];
45050
46092
  if (parser.settings.strict) {
@@ -45127,8 +46169,8 @@ function requireKatex() {
45127
46169
  numArgs: 2,
45128
46170
  allowedInText: true
45129
46171
  },
45130
- handler: function handler(_ref, args) {
45131
- var parser = _ref.parser;
46172
+ handler: function handler(_ref2, args) {
46173
+ var parser = _ref2.parser;
45132
46174
  return {
45133
46175
  type: "htmlmathml",
45134
46176
  mode: parser.mode,
@@ -45175,8 +46217,8 @@ function requireKatex() {
45175
46217
  argTypes: ["raw", "url"],
45176
46218
  allowedInText: false
45177
46219
  },
45178
- handler: function handler(_ref, args, optArgs) {
45179
- var parser = _ref.parser;
46220
+ handler: function handler(_ref2, args, optArgs) {
46221
+ var parser = _ref2.parser;
45180
46222
  var width = {
45181
46223
  number: 0,
45182
46224
  unit: "em"
@@ -45290,8 +46332,8 @@ function requireKatex() {
45290
46332
  argTypes: ["size"],
45291
46333
  allowedInText: true
45292
46334
  },
45293
- handler: function handler(_ref, args) {
45294
- var parser = _ref.parser, funcName = _ref.funcName;
46335
+ handler: function handler(_ref2, args) {
46336
+ var parser = _ref2.parser, funcName = _ref2.funcName;
45295
46337
  var size = assertNodeType(args[0], "size");
45296
46338
  if (parser.settings.strict) {
45297
46339
  var mathFunction = funcName[1] === "m";
@@ -45330,8 +46372,8 @@ function requireKatex() {
45330
46372
  numArgs: 1,
45331
46373
  allowedInText: true
45332
46374
  },
45333
- handler: function handler(_ref, args) {
45334
- var parser = _ref.parser, funcName = _ref.funcName;
46375
+ handler: function handler(_ref2, args) {
46376
+ var parser = _ref2.parser, funcName = _ref2.funcName;
45335
46377
  var body = args[0];
45336
46378
  return {
45337
46379
  type: "lap",
@@ -45375,8 +46417,8 @@ function requireKatex() {
45375
46417
  allowedInText: true,
45376
46418
  allowedInMath: false
45377
46419
  },
45378
- handler: function handler(_ref, args) {
45379
- var funcName = _ref.funcName, parser = _ref.parser;
46420
+ handler: function handler(_ref2, args) {
46421
+ var funcName = _ref2.funcName, parser = _ref2.parser;
45380
46422
  var outerMode = parser.mode;
45381
46423
  parser.switchMode("math");
45382
46424
  var close = funcName === "\\(" ? "\\)" : "$";
@@ -45424,8 +46466,8 @@ function requireKatex() {
45424
46466
  props: {
45425
46467
  numArgs: 4
45426
46468
  },
45427
- handler: function handler(_ref, args) {
45428
- var parser = _ref.parser;
46469
+ handler: function handler(_ref2, args) {
46470
+ var parser = _ref2.parser;
45429
46471
  return {
45430
46472
  type: "mathchoice",
45431
46473
  mode: parser.mode,
@@ -45657,8 +46699,8 @@ function requireKatex() {
45657
46699
  props: {
45658
46700
  numArgs: 0
45659
46701
  },
45660
- handler: function handler(_ref, args) {
45661
- var parser = _ref.parser, funcName = _ref.funcName;
46702
+ handler: function handler(_ref2, args) {
46703
+ var parser = _ref2.parser, funcName = _ref2.funcName;
45662
46704
  var fName = funcName;
45663
46705
  if (fName.length === 1) {
45664
46706
  fName = singleCharBigOps[fName];
@@ -45864,8 +46906,8 @@ function requireKatex() {
45864
46906
  props: {
45865
46907
  numArgs: 1
45866
46908
  },
45867
- handler: function handler(_ref, args) {
45868
- var parser = _ref.parser, funcName = _ref.funcName;
46909
+ handler: function handler(_ref2, args) {
46910
+ var parser = _ref2.parser, funcName = _ref2.funcName;
45869
46911
  var body = args[0];
45870
46912
  return {
45871
46913
  type: "operatorname",
@@ -45897,8 +46939,8 @@ function requireKatex() {
45897
46939
  props: {
45898
46940
  numArgs: 1
45899
46941
  },
45900
- handler: function handler(_ref, args) {
45901
- var parser = _ref.parser;
46942
+ handler: function handler(_ref2, args) {
46943
+ var parser = _ref2.parser;
45902
46944
  var body = args[0];
45903
46945
  return {
45904
46946
  type: "overline",
@@ -45943,8 +46985,8 @@ function requireKatex() {
45943
46985
  numArgs: 1,
45944
46986
  allowedInText: true
45945
46987
  },
45946
- handler: function handler(_ref, args) {
45947
- var parser = _ref.parser;
46988
+ handler: function handler(_ref2, args) {
46989
+ var parser = _ref2.parser;
45948
46990
  var body = args[0];
45949
46991
  return {
45950
46992
  type: "phantom",
@@ -46042,8 +47084,8 @@ function requireKatex() {
46042
47084
  argTypes: ["size", "hbox"],
46043
47085
  allowedInText: true
46044
47086
  },
46045
- handler: function handler(_ref, args) {
46046
- var parser = _ref.parser;
47087
+ handler: function handler(_ref2, args) {
47088
+ var parser = _ref2.parser;
46047
47089
  var amount = assertNodeType(args[0], "size").value;
46048
47090
  var body = args[1];
46049
47091
  return {
@@ -46080,8 +47122,8 @@ function requireKatex() {
46080
47122
  numOptionalArgs: 1,
46081
47123
  argTypes: ["size", "size", "size"]
46082
47124
  },
46083
- handler: function handler(_ref, args, optArgs) {
46084
- var parser = _ref.parser;
47125
+ handler: function handler(_ref2, args, optArgs) {
47126
+ var parser = _ref2.parser;
46085
47127
  var shift = optArgs[0];
46086
47128
  var width = assertNodeType(args[0], "size");
46087
47129
  var height = assertNodeType(args[1], "size");
@@ -46154,8 +47196,8 @@ function requireKatex() {
46154
47196
  numArgs: 0,
46155
47197
  allowedInText: true
46156
47198
  },
46157
- handler: function handler(_ref, args) {
46158
- var breakOnTokenText = _ref.breakOnTokenText, funcName = _ref.funcName, parser = _ref.parser;
47199
+ handler: function handler(_ref2, args) {
47200
+ var breakOnTokenText = _ref2.breakOnTokenText, funcName = _ref2.funcName, parser = _ref2.parser;
46159
47201
  var body = parser.parseExpression(false, breakOnTokenText);
46160
47202
  return {
46161
47203
  type: "sizing",
@@ -46182,8 +47224,8 @@ function requireKatex() {
46182
47224
  numOptionalArgs: 1,
46183
47225
  allowedInText: true
46184
47226
  },
46185
- handler: function handler(_ref, args, optArgs) {
46186
- var parser = _ref.parser;
47227
+ handler: function handler(_ref2, args, optArgs) {
47228
+ var parser = _ref2.parser;
46187
47229
  var smashHeight = false;
46188
47230
  var smashDepth = false;
46189
47231
  var tbArg = optArgs[0] && assertNodeType(optArgs[0], "ordgroup");
@@ -46263,8 +47305,8 @@ function requireKatex() {
46263
47305
  numArgs: 1,
46264
47306
  numOptionalArgs: 1
46265
47307
  },
46266
- handler: function handler(_ref, args, optArgs) {
46267
- var parser = _ref.parser;
47308
+ handler: function handler(_ref2, args, optArgs) {
47309
+ var parser = _ref2.parser;
46268
47310
  var index2 = optArgs[0];
46269
47311
  var body = args[0];
46270
47312
  return {
@@ -46348,8 +47390,8 @@ function requireKatex() {
46348
47390
  numArgs: 0,
46349
47391
  allowedInText: true
46350
47392
  },
46351
- handler: function handler(_ref, args) {
46352
- var breakOnTokenText = _ref.breakOnTokenText, funcName = _ref.funcName, parser = _ref.parser;
47393
+ handler: function handler(_ref2, args) {
47394
+ var breakOnTokenText = _ref2.breakOnTokenText, funcName = _ref2.funcName, parser = _ref2.parser;
46353
47395
  var body = parser.parseExpression(true, breakOnTokenText);
46354
47396
  var style = funcName.slice(1, funcName.length - 5);
46355
47397
  return {
@@ -46734,8 +47776,8 @@ function requireKatex() {
46734
47776
  greediness: 2,
46735
47777
  allowedInText: true
46736
47778
  },
46737
- handler: function handler(_ref, args) {
46738
- var parser = _ref.parser, funcName = _ref.funcName;
47779
+ handler: function handler(_ref2, args) {
47780
+ var parser = _ref2.parser, funcName = _ref2.funcName;
46739
47781
  var body = args[0];
46740
47782
  return {
46741
47783
  type: "text",
@@ -46761,8 +47803,8 @@ function requireKatex() {
46761
47803
  numArgs: 1,
46762
47804
  allowedInText: true
46763
47805
  },
46764
- handler: function handler(_ref, args) {
46765
- var parser = _ref.parser;
47806
+ handler: function handler(_ref2, args) {
47807
+ var parser = _ref2.parser;
46766
47808
  return {
46767
47809
  type: "underline",
46768
47810
  mode: parser.mode,
@@ -49632,7 +50674,7 @@ ABConvert.factory({
49632
50674
  process_return: ABConvert_IOEnum.el,
49633
50675
  process: (el, header, content) => {
49634
50676
  list2markmap(content, el);
49635
- markmap_event(el);
50677
+ ABCSetting.obsidian.markmap_event?.(el);
49636
50678
  return el;
49637
50679
  }
49638
50680
  });
@@ -49648,13 +50690,46 @@ function list2markmap(markdown, div) {
49648
50690
  svg_div.classList.add("ab-markmap-div");
49649
50691
  svg_div.id = "ab-markmap-div-" + id;
49650
50692
  const html_str = `<svg class="ab-markmap-svg" id="ab-markmap-${id}" data-json='${JSON.stringify(root2)}' style="height:${height_adapt}px"></svg>`;
49651
- svg_div.innerHTML = html_str;
50693
+ svg_div.innerHTML = purify.sanitize(html_str, {
50694
+ USE_PROFILES: { svg: true }
50695
+ });
49652
50696
  } else {
49653
50697
  div.classList.add("ab-raw");
49654
- div.innerHTML = `<div class="ab-raw-data" type-data="markmap" content-data='${markdown}'></div>`;
50698
+ div.innerHTML = purify.sanitize(`<div class="ab-raw-data" type-data="markmap" content-data='${markdown}'></div>`);
49655
50699
  }
49656
50700
  return div;
49657
50701
  }
50702
+ async function markmap_event(d) {
50703
+ if (ABCSetting.env == "obsidian-min") return;
50704
+ if (d.querySelector(".ab-markmap-svg")) {
50705
+ console.log(" - markmap_event");
50706
+ let script_el = document.querySelector('script[script-id="ab-markmap-script"]');
50707
+ if (script_el) script_el.remove();
50708
+ const divEl = d;
50709
+ let markmapId = "";
50710
+ if (divEl.tagName === "DIV") {
50711
+ markmapId = divEl.querySelector(".ab-markmap-svg")?.id || "";
50712
+ }
50713
+ script_el = document.createElement("script");
50714
+ document.head.appendChild(script_el);
50715
+ script_el.type = "module";
50716
+ script_el.setAttribute("script-id", "ab-markmap-script");
50717
+ script_el.textContent = `
50718
+ import { Markmap, } from 'https://jspm.dev/markmap-view';
50719
+ const markmapId = "${markmapId || ""}";
50720
+ let mindmaps;
50721
+ if (markmapId) {
50722
+ mindmaps = document.querySelectorAll('#' + markmapId);
50723
+ } else {
50724
+ mindmaps = document.querySelectorAll('.ab-markmap-svg'); // 注意一下这里的选择器
50725
+ }
50726
+ for(const mindmap of mindmaps) {
50727
+ mindmap.innerHTML = "";
50728
+ Markmap.create(mindmap,null,JSON.parse(mindmap.getAttribute('data-json')));
50729
+ }`;
50730
+ }
50731
+ }
50732
+ ABCSetting.obsidian.markmap_event = markmap_event;
49658
50733
  const md = new MarkdownIt({
49659
50734
  html: true,
49660
50735
  // 启用 HTML 标签解析
@@ -49711,6 +50786,166 @@ const quartz_transformer_anyblock = () => {
49711
50786
  }
49712
50787
  };
49713
50788
  };
50789
+ function abConvertEvent(d, isCycle = false) {
50790
+ if (d.querySelector(".ab-super-width")) {
50791
+ const els_note = d.querySelectorAll(".ab-note");
50792
+ for (const el_note of els_note) {
50793
+ if (el_note.classList.contains("ab-super-width") || el_note.querySelector(".ab-super-width")) {
50794
+ const el_replace = el_note.parentNode;
50795
+ if (el_replace && el_replace.classList.contains("ab-replace")) {
50796
+ el_replace.classList.add("ab-super-width-p");
50797
+ }
50798
+ }
50799
+ }
50800
+ const els_view = document.querySelectorAll(".app-container .workspace-leaf");
50801
+ for (const el_view of els_view) {
50802
+ el_view.style.setProperty("--ab-width-outer", (el_view.offsetWidth - 40).toString() + "px");
50803
+ }
50804
+ }
50805
+ if (d.querySelector(".ab-nodes-node")) {
50806
+ const els_min = document.querySelectorAll(".ab-nodes.min .ab-nodes-node");
50807
+ const list_children = d.querySelectorAll(".ab-nodes-node");
50808
+ for (const children2 of list_children) {
50809
+ const el_content = children2.querySelector(".ab-nodes-content");
50810
+ if (!el_content) continue;
50811
+ const el_child = children2.querySelector(".ab-nodes-children");
50812
+ if (!el_child) continue;
50813
+ const el_bracket = el_child.querySelector(".ab-nodes-bracket");
50814
+ if (!el_bracket) continue;
50815
+ const el_bracket2 = el_child.querySelector(".ab-nodes-bracket2");
50816
+ if (!el_bracket2) continue;
50817
+ const els_child = el_child.childNodes;
50818
+ if (els_child.length < 3) {
50819
+ el_bracket.style.setProperty("display", "none");
50820
+ el_bracket2.style.setProperty("display", "none");
50821
+ continue;
50822
+ }
50823
+ const el_child_first = els_child[2];
50824
+ const el_child_last = els_child[els_child.length - 1];
50825
+ const el_child_first_content = el_child_first.querySelector(".ab-nodes-content");
50826
+ const el_child_last_content = el_child_last.querySelector(".ab-nodes-content");
50827
+ let height = 0;
50828
+ let heightToReduce = (el_child_first.offsetHeight + el_child_last.offsetHeight) / 2;
50829
+ if (els_child.length == 3) {
50830
+ height = el_child_first_content.offsetHeight - 20 > 20 ? el_child_first_content.offsetHeight - 20 : 20;
50831
+ el_bracket2.style.cssText = `
50832
+ height: ${height}px;
50833
+ top: calc(50% - ${height / 2}px);
50834
+ `;
50835
+ } else {
50836
+ el_bracket2.style.cssText = `
50837
+ height: calc(100% - ${heightToReduce}px);
50838
+ top: ${el_child_first.offsetHeight / 2}px;
50839
+ `;
50840
+ }
50841
+ if (Array.prototype.includes.call(els_min, children2)) {
50842
+ if (els_child.length == 3) {
50843
+ el_bracket.style.cssText = `
50844
+ display: block;
50845
+ top: calc(50% + ${el_content.offsetHeight / 2}px - 3px);
50846
+ clip-path: circle(40% at 50% 40%);
50847
+ `;
50848
+ } else {
50849
+ el_bracket.setAttribute("display", "none");
50850
+ }
50851
+ if (els_child.length == 3 && el_content.offsetHeight == el_child_first_content.offsetHeight) {
50852
+ el_bracket2.style.cssText = `
50853
+ height: 1px;
50854
+ top: calc(50% + ${el_content.offsetHeight / 2}px - 1px);
50855
+ width: 18px; /* 可以溢出点 */
50856
+ border-radius: 0;
50857
+ border: none;
50858
+ border-bottom: 1px solid var(--node-color);
50859
+ `;
50860
+ } else {
50861
+ if (els_child.length == 3) {
50862
+ height = el_child_last_content.offsetHeight / 2 - el_content.offsetHeight / 2;
50863
+ el_bracket2.style.setProperty("height", `${height}px`);
50864
+ el_bracket2.style.setProperty("top", `calc(50% + ${el_content.offsetHeight / 2}px)`);
50865
+ el_bracket2.style.setProperty("border-radius", `0 0 0 10px`);
50866
+ el_bracket2.style.setProperty("border-top", `0`);
50867
+ } else {
50868
+ heightToReduce = el_child_first.offsetHeight / 2 + el_child_first_content.offsetHeight / 2 + el_child_last.offsetHeight / 2 - el_child_last_content.offsetHeight / 2;
50869
+ el_bracket2.style.setProperty("height", `calc(100% - ${heightToReduce}px + 1px)`);
50870
+ el_bracket2.style.setProperty("top", `${el_child_first.offsetHeight / 2 + el_child_first_content.offsetHeight / 2 - 1}px`);
50871
+ }
50872
+ el_bracket2.style.setProperty("width", "20px");
50873
+ }
50874
+ }
50875
+ }
50876
+ }
50877
+ if (d.querySelector(".ab-items.ab-lay-vfall:not(.js-waterfall):not(.ab-lay-hfall):not(.ab-lay-grid)")) {
50878
+ const root_el_list = d.querySelectorAll(".ab-items.ab-lay-vfall:not(.js-waterfall):not(.ab-lay-hfall):not(.ab-lay-grid)");
50879
+ for (const root_el of root_el_list) {
50880
+ root_el.classList.add("js-waterfall");
50881
+ const list_children = root_el.querySelectorAll(".ab-items-item");
50882
+ const columnCountTmp = parseInt(window.getComputedStyle(root_el).getPropertyValue("column-count"));
50883
+ let columnCount;
50884
+ if (columnCountTmp && !isNaN(columnCountTmp) && columnCountTmp > 0) {
50885
+ columnCount = columnCountTmp;
50886
+ } else if (root_el.classList.contains("ab-col-auto") && list_children.length <= 4) {
50887
+ columnCount = list_children.length;
50888
+ root_el.classList.add("ab-col" + columnCount);
50889
+ } else {
50890
+ columnCount = 4;
50891
+ root_el.classList.add("ab-col" + columnCount);
50892
+ }
50893
+ const height_cache = [];
50894
+ const el_cache = [];
50895
+ for (let i = 0; i < columnCount; i++) {
50896
+ height_cache.push(0);
50897
+ el_cache.push([]);
50898
+ }
50899
+ for (const children2 of list_children) {
50900
+ const minValue = Math.min.apply(null, height_cache);
50901
+ const minIndex = height_cache.indexOf(minValue);
50902
+ const heightTmp = parseInt(window.getComputedStyle(children2).getPropertyValue("height"));
50903
+ height_cache[minIndex] += heightTmp && !isNaN(heightTmp) && heightTmp > 0 ? heightTmp : 10;
50904
+ el_cache[minIndex].push(children2);
50905
+ }
50906
+ const fillNumber = columnCount - list_children.length % columnCount;
50907
+ if (fillNumber != 4) {
50908
+ for (let i = 0; i < fillNumber; i++) {
50909
+ const children2 = document.createElement("div");
50910
+ children2.classList.add(".ab-items-item.placeholder");
50911
+ children2.setAttribute("style", "height: 20px");
50912
+ const minValue = Math.min.apply(null, height_cache);
50913
+ const minIndex = height_cache.indexOf(minValue);
50914
+ height_cache[minIndex] += 20;
50915
+ el_cache[minIndex].push(children2);
50916
+ }
50917
+ }
50918
+ root_el.innerHTML = "";
50919
+ for (let i = 0; i < columnCount; i++) {
50920
+ for (const j of el_cache[i]) {
50921
+ root_el.appendChild(j);
50922
+ }
50923
+ }
50924
+ }
50925
+ }
50926
+ if (!isCycle && d.querySelector(".ab-markmap-div")) {
50927
+ const divEl = d;
50928
+ let markmapId = "";
50929
+ if (divEl.tagName === "DIV") {
50930
+ markmapId = divEl.querySelector(".ab-markmap-div")?.id || "";
50931
+ }
50932
+ let mindmaps;
50933
+ if (markmapId) {
50934
+ mindmaps = document.querySelectorAll("#" + markmapId);
50935
+ } else {
50936
+ mindmaps = document.querySelectorAll(".ab-markmap-div");
50937
+ }
50938
+ for (const el_div of mindmaps) {
50939
+ const el_svg = el_div.querySelector("svg");
50940
+ const el_g = el_svg?.querySelector("g");
50941
+ if (el_svg && el_g) {
50942
+ const scale_new = el_g.getBBox().height / el_div.offsetWidth;
50943
+ el_svg.setAttribute("style", `height:${el_g.getBBox().height * scale_new + 40}px`);
50944
+ ABCSetting.obsidian.markmap_event?.(d);
50945
+ }
50946
+ }
50947
+ }
50948
+ }
49714
50949
  export {
49715
50950
  ABConvertManager,
49716
50951
  ABReg,