markdown-it-any-block 3.4.4 → 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.
@@ -3,7 +3,10 @@ const ABCSetting = {
3
3
  env: "obsidian",
4
4
  // 某些环境的独占 api,其他环境用不上
5
5
  obsidian: {
6
- mermaid: void 0
6
+ global_app: null,
7
+ global_ctx: null,
8
+ mermaid: void 0,
9
+ markmap_event: void 0
7
10
  }
8
11
  };
9
12
  const ABReg = {
@@ -176,15 +179,35 @@ const ABAlias_json_withSub = [
176
179
  // 注意避免和原上/上面的callout语法冲突,以及自身递归
177
180
  ];
178
181
  const ABAlias_json_mdit = [
179
- { regex: /\|:::_140lne\|(2?tabs?|标签页?)\|/, replacement: "|mditTabs|" },
182
+ { regex: /\|:::_140lne\|((?:mdit2|2)?tabs?|标签页?)\|/, replacement: "|mditTabs|" },
180
183
  { regex: "|:::_140lne|demo|", replacement: "|mditDemo|" },
181
184
  { regex: "|:::_140lne|abDemo|", replacement: "|mditABDemo|" },
182
- { regex: /\|:::_140lne\|(2?col|分栏)\|/, replacement: "|mditCol|" },
183
- { regex: /\|:::_140lne\|(2?card|卡片)\|/, replacement: "|mditCard|" },
184
- { regex: /\|:::_140lne\|(2?chat|聊天)\|/, replacement: "|mditChat|code(chat)|" }
185
+ { regex: /\|:::_140lne\|((?:mdit2|2)?col|分栏)\|/, replacement: "|mditCol|" },
186
+ { regex: /\|:::_140lne\|((?:mdit2|2)?card|卡片)\|/, replacement: "|mditCard|" },
187
+ { regex: /\|:::_140lne\|((?:mdit2|2)?chat|聊天)\|/, replacement: "|mditChat|code(chat)|" },
188
+ //
189
+ // {regex: /\|:::_140lne\|2?(timeline|时间线)\|/, replacement: "|title2timeline|"},
190
+ // {regex: /\|:::_140lne\|2?(tabs?|标签页?)\||\|title2tabs?\|/, replacement: "|title2c2listdata|c2listdata2tab|"},
191
+ // {regex: /\|:::_140lne\|2?(col|分栏)\||\|title2col\|/, replacement: "|title2c2listdata|c2listdata2items|addClass(ab-col)|"},
192
+ // {regex: /\|:::_140lne\|2?(card|卡片)\||\|title2card\|/, replacement: "|title2c2listdata|c2listdata2items|addClass(ab-card)|addClass(ab-lay-vfall)|"},
193
+ // {regex: /\|:::_140lne\|2?(nodes?|节点)\||\|(title2node|title2abMindmap)\|/, replacement: "|title2listdata|listdata2strict|listdata2nodes|"},
194
+ // list - 多叉多层树
195
+ { regex: /\|:::_140lne\|(?:mdit2|2)?(mermaid|flow|流程图)\|/, replacement: "|mdit2list|list2mermaid|" },
196
+ { regex: /\|:::_140lne\|(?:mdit2|2)?(mehrmaid|mdmermaid)\|/, replacement: "|mdit2list|list2mehrmaidText|code(mehrmaid)|" },
197
+ { regex: /\|:::_140lne\|(?:mdit2|2)?(puml)?(plantuml|mindmap|脑图|思维导图)\|/, replacement: "|mdit2list|list2pumlMindmap|" },
198
+ { regex: /\|:::_140lne\|(?:mdit2|2)?(markmap|mdMindmap|md脑图|md思维导图)\|/, replacement: "|mdit2list|list2markmap|" },
199
+ { regex: /\|:::_140lne\|(?:mdit2|2)?(wbs|(工作)?分解(图|结构))\|/, replacement: "|mdit2list|list2pumlWBS|" },
200
+ { regex: /\|:::_140lne\|(?:mdit2|2)?(table|multiWayTable|multiCrossTable|表格?|多叉表格?|跨行表格?)\|/, replacement: "|mdit2list|list2table|" },
201
+ // list - lt树 (属于多层一叉树)
202
+ { regex: /\|:::_140lne\|(?:mdit2|2)?(lt|listTable|treeTable|listGrid|treeGrid|列表格|树形表格?)\|/, replacement: "|mdit2list|list2lt|" },
203
+ { regex: /\|:::_140lne\|(?:mdit2|2)?(list|列表)\|/, replacement: "|mdit2list|list2lt|addClass(ab-listtable-likelist)|" },
204
+ { regex: /\|:::_140lne\|(?:mdit2|2)?(dir|dirTree|目录树?|目录结构)\|/, replacement: "|mdit2list|list2dt|" },
205
+ // list - 二层树
206
+ { regex: /\|:::_140lne\|(fakeList|仿列表)\|/, replacement: "|mdit2list|list2table|addClass(ab-table-fc)|addClass(ab-table-likelist)|" },
207
+ // 至后
208
+ { regex: "|mdit2list|", replacement: "|mdit2listdata|listdata2strict|listdata2list|" }
185
209
  ];
186
210
  const ABAlias_json_title = [
187
- { regex: "|title2list|", replacement: "|title2listdata|listdata2strict|listdata2list|" },
188
211
  // title - list&title
189
212
  { regex: /\|heading_140lne\|2?(timeline|时间线)\|/, replacement: "|title2timeline|" },
190
213
  { regex: /\|heading_140lne\|2?(tabs?|标签页?)\||\|title2tabs?\|/, replacement: "|title2c2listdata|c2listdata2tab|" },
@@ -203,7 +226,9 @@ const ABAlias_json_title = [
203
226
  { regex: /\|heading_140lne\|2?(list|列表)\|/, replacement: "|title2list|list2lt|addClass(ab-listtable-likelist)|" },
204
227
  { regex: /\|heading_140lne\|2?(dir|dirTree|目录树?|目录结构)\|/, replacement: "|title2list|list2dt|" },
205
228
  // list - 二层树
206
- { regex: /\|heading_140lne\|(fakeList|仿列表)\|/, replacement: "|title2list|list2table|addClass(ab-table-fc)|addClass(ab-table-likelist)|" }
229
+ { regex: /\|heading_140lne\|(fakeList|仿列表)\|/, replacement: "|title2list|list2table|addClass(ab-table-fc)|addClass(ab-table-likelist)|" },
230
+ // 至后
231
+ { regex: "|title2list|", replacement: "|title2listdata|listdata2strict|listdata2list|" }
207
232
  ];
208
233
  const ABAlias_json_list = [
209
234
  // 特殊
@@ -360,24 +385,18 @@ class ABConvertManager {
360
385
  * @param header 转换方式
361
386
  * @param content 要转换的初始文本 (无前缀版本,前缀在选择器环节已经删除了)
362
387
  * @param selectorName 选择器名,空表示未知
363
- * @return 等于el,无用,后面可以删了
364
388
  */
365
389
  static autoABConvert(el, header, content, selectorName = "", ctx) {
366
- let prev_result = content;
367
- let prev_type = "string";
368
- let prev_type2 = ABConvert_IOEnum.text;
369
- let prev_processor;
370
390
  let prev2 = {
371
- // 组合在一起是为了引用传参
372
- prev_result,
373
- prev_type,
374
- prev_type2,
375
- prev_processor
391
+ prev_result: content,
392
+ prev_type: "string",
393
+ prev_type2: ABConvert_IOEnum.text,
394
+ prev_processor: void 0
376
395
  };
377
396
  {
378
- header = autoABAlias(header, selectorName, prev_result);
397
+ header = autoABAlias(header, selectorName, prev2.prev_result);
379
398
  let list_header = header.split("|");
380
- prev_result = this.autoABConvert_runConvert(el, list_header, prev2, ctx);
399
+ this.autoABConvert_runConvert(el, list_header, prev2, ctx);
381
400
  this.autoABConvert_last(el, header, selectorName, prev2, ctx);
382
401
  }
383
402
  }
@@ -436,7 +455,12 @@ class ABConvertManager {
436
455
  break;
437
456
  }
438
457
  }
439
- prev2.prev_result = abReplaceProcessor.process(el, item_header, prev2.prev_result, ctx);
458
+ try {
459
+ prev2.prev_result = abReplaceProcessor.process(el, item_header, prev2.prev_result, ctx);
460
+ } catch (e) {
461
+ console.error(`处理器执行错误, id:${abReplaceProcessor.id}, header:${item_header}, error:`, e);
462
+ break;
463
+ }
440
464
  prev2.prev_type = typeof prev2.prev_result;
441
465
  prev2.prev_type2 = abReplaceProcessor.process_return;
442
466
  prev2.prev_processor = abReplaceProcessor.process;
@@ -450,7 +474,7 @@ class ABConvertManager {
450
474
  /**
451
475
  * 子函数,后处理/尾处理,主要进行末尾追加指令
452
476
  */
453
- static autoABConvert_last(el, header, selectorName, prev2, ctx) {
477
+ static autoABConvert_last(el, _header, _selectorName, prev2, _ctx) {
454
478
  if (prev2.prev_type == "string" && prev2.prev_type2 == ABConvert_IOEnum.text) {
455
479
  const subEl = document.createElement("div");
456
480
  el.appendChild(subEl);
@@ -458,7 +482,7 @@ class ABConvertManager {
458
482
  prev2.prev_result = el;
459
483
  prev2.prev_type = "object";
460
484
  prev2.prev_type2 = ABConvert_IOEnum.el;
461
- prev2.process = "md";
485
+ prev2.prev_processor = "md";
462
486
  } else if (prev2.prev_type == "string" && prev2.prev_type2 == ABConvert_IOEnum.json) {
463
487
  const code_str = "```json\n" + prev2.prev_result + "\n```\n";
464
488
  const subEl = document.createElement("div");
@@ -467,7 +491,7 @@ class ABConvertManager {
467
491
  prev2.prev_result = el;
468
492
  prev2.prev_type = "object";
469
493
  prev2.prev_type2 = ABConvert_IOEnum.el;
470
- prev2.process = "show_json";
494
+ prev2.prev_processor = "show_json";
471
495
  } 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)) {
472
496
  const code_str = "```json\n" + JSON.stringify(prev2.prev_result, null, 2) + "\n```\n";
473
497
  const subEl = document.createElement("div");
@@ -476,7 +500,7 @@ class ABConvertManager {
476
500
  prev2.prev_result = el;
477
501
  prev2.prev_type = "object";
478
502
  prev2.prev_type2 = ABConvert_IOEnum.el;
479
- prev2.process = "show_listStream";
503
+ prev2.prev_processor = "show_listStream";
480
504
  } else if (prev2.prev_type == "object" && prev2.prev_type2 == ABConvert_IOEnum.el) {
481
505
  return prev2;
482
506
  } else {
@@ -920,7 +944,7 @@ class ListProcess {
920
944
  }
921
945
  }
922
946
  /**
923
- * 标题大纲转列表数据(@todo 正文的level+10,要减掉)
947
+ * 标题大纲转列表数据
924
948
  *
925
949
  * @detail
926
950
  * 这里要将标题、正文、列表 的等级合为一块,所以存在偏移值:
@@ -929,6 +953,7 @@ class ListProcess {
929
953
  * 2. 正文等级, = 0, 取值[+1,+Infi]
930
954
  * 3. 列表等级, = `(.*)-`个数+1, 取值[0]
931
955
  *
956
+ * (比较旧版是正文+10,列表+11,后来允许标题等级为负数。这样方便很多)
932
957
  */
933
958
  static title2data(text2) {
934
959
  let list_itemInfo = [];
@@ -939,13 +964,21 @@ class ListProcess {
939
964
  if (codeBlockFlag == "") {
940
965
  const match2 = line.match(ABReg.reg_code);
941
966
  if (match2 && match2[3]) {
942
- codeBlockFlag = match2[1] + match2[3];
943
- list_itemInfo[list_itemInfo.length - 1].content = list_itemInfo[list_itemInfo.length - 1].content + "\n" + line;
967
+ if (mul_mode === "heading" || mul_mode === "") {
968
+ list_itemInfo.push({
969
+ content: line,
970
+ level: 0
971
+ });
972
+ mul_mode = "para";
973
+ } else {
974
+ codeBlockFlag = match2[1] + match2[3];
975
+ list_itemInfo[list_itemInfo.length - 1].content += "\n" + line;
976
+ }
944
977
  continue;
945
978
  }
946
979
  } else {
947
980
  if (line.indexOf(codeBlockFlag) == 0) codeBlockFlag = "";
948
- list_itemInfo[list_itemInfo.length - 1].content = list_itemInfo[list_itemInfo.length - 1].content + "\n" + line;
981
+ list_itemInfo[list_itemInfo.length - 1].content += "\n" + line;
949
982
  continue;
950
983
  }
951
984
  const match_heading = line.match(ABReg.reg_heading_noprefix);
@@ -962,21 +995,125 @@ class ListProcess {
962
995
  list_itemInfo.push({
963
996
  content: match_list[4],
964
997
  level: match_list[1].length + 1
965
- //+10
966
998
  });
967
999
  mul_mode = "list";
968
1000
  } else if (/^\S/.test(line) && mul_mode == "list") {
969
- list_itemInfo[list_itemInfo.length - 1].content = list_itemInfo[list_itemInfo.length - 1].content + "\n" + line;
1001
+ list_itemInfo[list_itemInfo.length - 1].content += "\n" + line;
970
1002
  } else {
971
1003
  if (mul_mode == "para") {
972
- list_itemInfo[list_itemInfo.length - 1].content = list_itemInfo[list_itemInfo.length - 1].content + "\n" + line;
1004
+ list_itemInfo[list_itemInfo.length - 1].content += "\n" + line;
1005
+ } else if (/^\s*$/.test(line)) {
1006
+ continue;
1007
+ } else {
1008
+ list_itemInfo.push({
1009
+ content: line,
1010
+ level: 0
1011
+ });
1012
+ mul_mode = "para";
1013
+ }
1014
+ }
1015
+ }
1016
+ removeTailBlank();
1017
+ return list_itemInfo;
1018
+ function removeTailBlank() {
1019
+ if (mul_mode == "para" || mul_mode == "list") {
1020
+ list_itemInfo[list_itemInfo.length - 1].content = list_itemInfo[list_itemInfo.length - 1].content.replace(/\s*$/, "");
1021
+ }
1022
+ }
1023
+ }
1024
+ /**
1025
+ * MarkdownIt 转列表数据
1026
+ *
1027
+ * @detail
1028
+ * 与 title2data 的逻辑基本相同
1029
+ *
1030
+ * 这里要将Mdit标识 (@xxx)、正文、列表 的等级合为一块,所以存在偏移值:
1031
+ *
1032
+ * 1. Mdit等级, = `@<数字>`-100,
1033
+ * 2. 正文等级, = 0, 取值[+1,+Infi]
1034
+ * 3. 列表等级, = `(.*)-`个数+1, 取值[0]
1035
+ *
1036
+ * 例如:
1037
+ *
1038
+ * :::
1039
+ *
1040
+ * @1 AAA
1041
+ *
1042
+ * aaa
1043
+ *
1044
+ * @2 BBB
1045
+ *
1046
+ * @2 B22
1047
+ *
1048
+ * ccc
1049
+ * ddd
1050
+ *
1051
+ * @1 A22
1052
+ *
1053
+ * :::
1054
+ *
1055
+ * 会被转化为
1056
+ *
1057
+ * - AAA
1058
+ * - BBB
1059
+ * - B22
1060
+ * - ccc
1061
+ * ddd
1062
+ * - A22
1063
+ */
1064
+ static mdit2data(text2) {
1065
+ let list_itemInfo = [];
1066
+ const list_text = text2.split("\n");
1067
+ let mul_mode = "";
1068
+ let codeBlockFlag = "";
1069
+ for (let line of list_text) {
1070
+ if (codeBlockFlag == "") {
1071
+ const match2 = line.match(ABReg.reg_code);
1072
+ if (match2 && match2[3]) {
1073
+ if (mul_mode === "mdit" || mul_mode === "") {
1074
+ list_itemInfo.push({
1075
+ content: line,
1076
+ level: 0
1077
+ });
1078
+ mul_mode = "para";
1079
+ } else {
1080
+ codeBlockFlag = match2[1] + match2[3];
1081
+ list_itemInfo[list_itemInfo.length - 1].content += "\n" + line;
1082
+ }
1083
+ continue;
1084
+ }
1085
+ } else {
1086
+ if (line.indexOf(codeBlockFlag) == 0) codeBlockFlag = "";
1087
+ list_itemInfo[list_itemInfo.length - 1].content += "\n" + line;
1088
+ continue;
1089
+ }
1090
+ const match_mdit = line.match(/^(\s*)@(\d+)\s+(.*)$/);
1091
+ const match_list = line.match(ABReg.reg_list_noprefix);
1092
+ if (match_mdit && !match_mdit[1]) {
1093
+ removeTailBlank();
1094
+ list_itemInfo.push({
1095
+ content: match_mdit[3],
1096
+ level: Number(match_mdit[2]) - 100
1097
+ });
1098
+ mul_mode = "mdit";
1099
+ } else if (match_list) {
1100
+ removeTailBlank();
1101
+ list_itemInfo.push({
1102
+ content: match_list[4],
1103
+ level: match_list[1].length + 1
1104
+ });
1105
+ mul_mode = "list";
1106
+ } else if (/^\S/.test(line) && mul_mode == "list") {
1107
+ list_itemInfo[list_itemInfo.length - 1].content += "\n" + line;
1108
+ } else {
1109
+ if (mul_mode == "para") {
1110
+ list_itemInfo[list_itemInfo.length - 1].content += "\n" + line;
973
1111
  } else if (/^\s*$/.test(line)) {
974
1112
  continue;
975
1113
  } else {
976
1114
  list_itemInfo.push({
977
1115
  content: line,
978
1116
  level: 0
979
- //+10
980
1117
  });
981
1118
  mul_mode = "para";
982
1119
  }
@@ -1211,6 +1348,16 @@ const abc_title2listdata = ABConvert.factory({
1211
1348
  return ListProcess.title2data(content);
1212
1349
  }
1213
1350
  });
1351
+ ABConvert.factory({
1352
+ id: "mdit2listdata",
1353
+ name: "mdit到listdata",
1354
+ process_param: ABConvert_IOEnum.text,
1355
+ process_return: ABConvert_IOEnum.list_stream,
1356
+ detail: "mdit到listdata",
1357
+ process: (el, header, content) => {
1358
+ return ListProcess.mdit2data(content);
1359
+ }
1360
+ });
1214
1361
  ABConvert.factory({
1215
1362
  id: "listdata2list",
1216
1363
  name: "listdata到列表",
@@ -2206,6 +2353,1086 @@ ABConvert.factory({
2206
2353
  return newContent;
2207
2354
  }
2208
2355
  });
2356
+ /*! @license DOMPurify 3.4.3 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.4.3/LICENSE */
2357
+ function _arrayLikeToArray(r, a) {
2358
+ (null == a || a > r.length) && (a = r.length);
2359
+ for (var e = 0, n2 = Array(a); e < a; e++) n2[e] = r[e];
2360
+ return n2;
2361
+ }
2362
+ function _arrayWithHoles(r) {
2363
+ if (Array.isArray(r)) return r;
2364
+ }
2365
+ function _iterableToArrayLimit(r, l2) {
2366
+ var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
2367
+ if (null != t) {
2368
+ var e, n2, i, u, a = [], f = true, o = false;
2369
+ try {
2370
+ if (i = (t = t.call(r)).next, 0 === l2) ;
2371
+ else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l2); f = true) ;
2372
+ } catch (r2) {
2373
+ o = true, n2 = r2;
2374
+ } finally {
2375
+ try {
2376
+ if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return;
2377
+ } finally {
2378
+ if (o) throw n2;
2379
+ }
2380
+ }
2381
+ return a;
2382
+ }
2383
+ }
2384
+ function _nonIterableRest() {
2385
+ throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
2386
+ }
2387
+ function _slicedToArray(r, e) {
2388
+ return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest();
2389
+ }
2390
+ function _unsupportedIterableToArray(r, a) {
2391
+ if (r) {
2392
+ if ("string" == typeof r) return _arrayLikeToArray(r, a);
2393
+ var t = {}.toString.call(r).slice(8, -1);
2394
+ 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;
2395
+ }
2396
+ }
2397
+ const entries = Object.entries, setPrototypeOf = Object.setPrototypeOf, isFrozen = Object.isFrozen, getPrototypeOf = Object.getPrototypeOf, getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
2398
+ let freeze = Object.freeze, seal = Object.seal, create = Object.create;
2399
+ let _ref = typeof Reflect !== "undefined" && Reflect, apply = _ref.apply, construct = _ref.construct;
2400
+ if (!freeze) {
2401
+ freeze = function freeze2(x) {
2402
+ return x;
2403
+ };
2404
+ }
2405
+ if (!seal) {
2406
+ seal = function seal2(x) {
2407
+ return x;
2408
+ };
2409
+ }
2410
+ if (!apply) {
2411
+ apply = function apply2(func, thisArg) {
2412
+ for (var _len = arguments.length, args = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
2413
+ args[_key - 2] = arguments[_key];
2414
+ }
2415
+ return func.apply(thisArg, args);
2416
+ };
2417
+ }
2418
+ if (!construct) {
2419
+ construct = function construct2(Func) {
2420
+ for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
2421
+ args[_key2 - 1] = arguments[_key2];
2422
+ }
2423
+ return new Func(...args);
2424
+ };
2425
+ }
2426
+ const arrayForEach = unapply(Array.prototype.forEach);
2427
+ const arrayLastIndexOf = unapply(Array.prototype.lastIndexOf);
2428
+ const arrayPop = unapply(Array.prototype.pop);
2429
+ const arrayPush = unapply(Array.prototype.push);
2430
+ const arraySplice = unapply(Array.prototype.splice);
2431
+ const arrayIsArray = Array.isArray;
2432
+ const stringToLowerCase = unapply(String.prototype.toLowerCase);
2433
+ const stringToString = unapply(String.prototype.toString);
2434
+ const stringMatch = unapply(String.prototype.match);
2435
+ const stringReplace = unapply(String.prototype.replace);
2436
+ const stringIndexOf = unapply(String.prototype.indexOf);
2437
+ const stringTrim = unapply(String.prototype.trim);
2438
+ const numberToString = unapply(Number.prototype.toString);
2439
+ const booleanToString = unapply(Boolean.prototype.toString);
2440
+ const bigintToString = typeof BigInt === "undefined" ? null : unapply(BigInt.prototype.toString);
2441
+ const symbolToString = typeof Symbol === "undefined" ? null : unapply(Symbol.prototype.toString);
2442
+ const objectHasOwnProperty = unapply(Object.prototype.hasOwnProperty);
2443
+ const objectToString = unapply(Object.prototype.toString);
2444
+ const regExpTest = unapply(RegExp.prototype.test);
2445
+ const typeErrorCreate = unconstruct(TypeError);
2446
+ function unapply(func) {
2447
+ return function(thisArg) {
2448
+ if (thisArg instanceof RegExp) {
2449
+ thisArg.lastIndex = 0;
2450
+ }
2451
+ for (var _len3 = arguments.length, args = new Array(_len3 > 1 ? _len3 - 1 : 0), _key3 = 1; _key3 < _len3; _key3++) {
2452
+ args[_key3 - 1] = arguments[_key3];
2453
+ }
2454
+ return apply(func, thisArg, args);
2455
+ };
2456
+ }
2457
+ function unconstruct(Func) {
2458
+ return function() {
2459
+ for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
2460
+ args[_key4] = arguments[_key4];
2461
+ }
2462
+ return construct(Func, args);
2463
+ };
2464
+ }
2465
+ function addToSet(set2, array) {
2466
+ let transformCaseFunc = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : stringToLowerCase;
2467
+ if (setPrototypeOf) {
2468
+ setPrototypeOf(set2, null);
2469
+ }
2470
+ if (!arrayIsArray(array)) {
2471
+ return set2;
2472
+ }
2473
+ let l2 = array.length;
2474
+ while (l2--) {
2475
+ let element = array[l2];
2476
+ if (typeof element === "string") {
2477
+ const lcElement = transformCaseFunc(element);
2478
+ if (lcElement !== element) {
2479
+ if (!isFrozen(array)) {
2480
+ array[l2] = lcElement;
2481
+ }
2482
+ element = lcElement;
2483
+ }
2484
+ }
2485
+ set2[element] = true;
2486
+ }
2487
+ return set2;
2488
+ }
2489
+ function cleanArray(array) {
2490
+ for (let index2 = 0; index2 < array.length; index2++) {
2491
+ const isPropertyExist = objectHasOwnProperty(array, index2);
2492
+ if (!isPropertyExist) {
2493
+ array[index2] = null;
2494
+ }
2495
+ }
2496
+ return array;
2497
+ }
2498
+ function clone$3(object) {
2499
+ const newObject = create(null);
2500
+ for (const _ref2 of entries(object)) {
2501
+ var _ref3 = _slicedToArray(_ref2, 2);
2502
+ const property = _ref3[0];
2503
+ const value = _ref3[1];
2504
+ const isPropertyExist = objectHasOwnProperty(object, property);
2505
+ if (isPropertyExist) {
2506
+ if (arrayIsArray(value)) {
2507
+ newObject[property] = cleanArray(value);
2508
+ } else if (value && typeof value === "object" && value.constructor === Object) {
2509
+ newObject[property] = clone$3(value);
2510
+ } else {
2511
+ newObject[property] = value;
2512
+ }
2513
+ }
2514
+ }
2515
+ return newObject;
2516
+ }
2517
+ function stringifyValue(value) {
2518
+ switch (typeof value) {
2519
+ case "string": {
2520
+ return value;
2521
+ }
2522
+ case "number": {
2523
+ return numberToString(value);
2524
+ }
2525
+ case "boolean": {
2526
+ return booleanToString(value);
2527
+ }
2528
+ case "bigint": {
2529
+ return bigintToString ? bigintToString(value) : "0";
2530
+ }
2531
+ case "symbol": {
2532
+ return symbolToString ? symbolToString(value) : "Symbol()";
2533
+ }
2534
+ case "undefined": {
2535
+ return objectToString(value);
2536
+ }
2537
+ case "function":
2538
+ case "object": {
2539
+ if (value === null) {
2540
+ return objectToString(value);
2541
+ }
2542
+ const valueAsRecord = value;
2543
+ const valueToString = lookupGetter(valueAsRecord, "toString");
2544
+ if (typeof valueToString === "function") {
2545
+ const stringified = valueToString(valueAsRecord);
2546
+ return typeof stringified === "string" ? stringified : objectToString(stringified);
2547
+ }
2548
+ return objectToString(value);
2549
+ }
2550
+ default: {
2551
+ return objectToString(value);
2552
+ }
2553
+ }
2554
+ }
2555
+ function lookupGetter(object, prop2) {
2556
+ while (object !== null) {
2557
+ const desc = getOwnPropertyDescriptor(object, prop2);
2558
+ if (desc) {
2559
+ if (desc.get) {
2560
+ return unapply(desc.get);
2561
+ }
2562
+ if (typeof desc.value === "function") {
2563
+ return unapply(desc.value);
2564
+ }
2565
+ }
2566
+ object = getPrototypeOf(object);
2567
+ }
2568
+ function fallbackValue() {
2569
+ return null;
2570
+ }
2571
+ return fallbackValue;
2572
+ }
2573
+ function isRegex(value) {
2574
+ try {
2575
+ regExpTest(value, "");
2576
+ return true;
2577
+ } catch (_unused) {
2578
+ return false;
2579
+ }
2580
+ }
2581
+ 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"]);
2582
+ 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"]);
2583
+ 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"]);
2584
+ 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"]);
2585
+ 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"]);
2586
+ const mathMlDisallowed = freeze(["maction", "maligngroup", "malignmark", "mlongdiv", "mscarries", "mscarry", "msgroup", "mstack", "msline", "msrow", "semantics", "annotation", "annotation-xml", "mprescripts", "none"]);
2587
+ const text$2 = freeze(["#text"]);
2588
+ 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"]);
2589
+ 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"]);
2590
+ 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"]);
2591
+ const xml$1 = freeze(["xlink:href", "xml:id", "xlink:title", "xml:space", "xmlns:xlink"]);
2592
+ const MUSTACHE_EXPR = seal(/{{[\w\W]*|^[\w\W]*}}/g);
2593
+ const ERB_EXPR = seal(/<%[\w\W]*|^[\w\W]*%>/g);
2594
+ const TMPLIT_EXPR = seal(/\${[\w\W]*/g);
2595
+ const DATA_ATTR = seal(/^data-[\-\w.\u00B7-\uFFFF]+$/);
2596
+ const ARIA_ATTR = seal(/^aria-[\-\w]+$/);
2597
+ const IS_ALLOWED_URI = seal(
2598
+ /^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i
2599
+ // eslint-disable-line no-useless-escape
2600
+ );
2601
+ const IS_SCRIPT_OR_DATA = seal(/^(?:\w+script|data):/i);
2602
+ const ATTR_WHITESPACE = seal(
2603
+ /[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g
2604
+ // eslint-disable-line no-control-regex
2605
+ );
2606
+ const DOCTYPE_NAME = seal(/^html$/i);
2607
+ const CUSTOM_ELEMENT = seal(/^[a-z][.\w]*(-[.\w]+)+$/i);
2608
+ const NODE_TYPE$1 = {
2609
+ element: 1,
2610
+ text: 3,
2611
+ // Deprecated
2612
+ progressingInstruction: 7,
2613
+ comment: 8,
2614
+ document: 9
2615
+ };
2616
+ const getGlobal = function getGlobal2() {
2617
+ return typeof window === "undefined" ? null : window;
2618
+ };
2619
+ const _createTrustedTypesPolicy = function _createTrustedTypesPolicy2(trustedTypes, purifyHostElement) {
2620
+ if (typeof trustedTypes !== "object" || typeof trustedTypes.createPolicy !== "function") {
2621
+ return null;
2622
+ }
2623
+ let suffix = null;
2624
+ const ATTR_NAME = "data-tt-policy-suffix";
2625
+ if (purifyHostElement && purifyHostElement.hasAttribute(ATTR_NAME)) {
2626
+ suffix = purifyHostElement.getAttribute(ATTR_NAME);
2627
+ }
2628
+ const policyName = "dompurify" + (suffix ? "#" + suffix : "");
2629
+ try {
2630
+ return trustedTypes.createPolicy(policyName, {
2631
+ createHTML(html2) {
2632
+ return html2;
2633
+ },
2634
+ createScriptURL(scriptUrl) {
2635
+ return scriptUrl;
2636
+ }
2637
+ });
2638
+ } catch (_) {
2639
+ console.warn("TrustedTypes policy " + policyName + " could not be created.");
2640
+ return null;
2641
+ }
2642
+ };
2643
+ const _createHooksMap = function _createHooksMap2() {
2644
+ return {
2645
+ afterSanitizeAttributes: [],
2646
+ afterSanitizeElements: [],
2647
+ afterSanitizeShadowDOM: [],
2648
+ beforeSanitizeAttributes: [],
2649
+ beforeSanitizeElements: [],
2650
+ beforeSanitizeShadowDOM: [],
2651
+ uponSanitizeAttribute: [],
2652
+ uponSanitizeElement: [],
2653
+ uponSanitizeShadowNode: []
2654
+ };
2655
+ };
2656
+ function createDOMPurify() {
2657
+ let window2 = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : getGlobal();
2658
+ const DOMPurify = (root2) => createDOMPurify(root2);
2659
+ DOMPurify.version = "3.4.3";
2660
+ DOMPurify.removed = [];
2661
+ if (!window2 || !window2.document || window2.document.nodeType !== NODE_TYPE$1.document || !window2.Element) {
2662
+ DOMPurify.isSupported = false;
2663
+ return DOMPurify;
2664
+ }
2665
+ let document2 = window2.document;
2666
+ const originalDocument = document2;
2667
+ const currentScript = originalDocument.currentScript;
2668
+ 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;
2669
+ const ElementPrototype = Element2.prototype;
2670
+ const cloneNode2 = lookupGetter(ElementPrototype, "cloneNode");
2671
+ const remove2 = lookupGetter(ElementPrototype, "remove");
2672
+ const getNextSibling = lookupGetter(ElementPrototype, "nextSibling");
2673
+ const getChildNodes = lookupGetter(ElementPrototype, "childNodes");
2674
+ const getParentNode = lookupGetter(ElementPrototype, "parentNode");
2675
+ if (typeof HTMLTemplateElement === "function") {
2676
+ const template = document2.createElement("template");
2677
+ if (template.content && template.content.ownerDocument) {
2678
+ document2 = template.content.ownerDocument;
2679
+ }
2680
+ }
2681
+ let trustedTypesPolicy;
2682
+ let emptyHTML = "";
2683
+ const _document = document2, implementation = _document.implementation, createNodeIterator = _document.createNodeIterator, createDocumentFragment = _document.createDocumentFragment, getElementsByTagName2 = _document.getElementsByTagName;
2684
+ const importNode = originalDocument.importNode;
2685
+ let hooks = _createHooksMap();
2686
+ DOMPurify.isSupported = typeof entries === "function" && typeof getParentNode === "function" && implementation && implementation.createHTMLDocument !== void 0;
2687
+ 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;
2688
+ let IS_ALLOWED_URI$1 = IS_ALLOWED_URI;
2689
+ let ALLOWED_TAGS = null;
2690
+ const DEFAULT_ALLOWED_TAGS = addToSet({}, [...html$1$1, ...svg$1, ...svgFilters, ...mathMl$1, ...text$2]);
2691
+ let ALLOWED_ATTR = null;
2692
+ const DEFAULT_ALLOWED_ATTR = addToSet({}, [...html$2, ...svg, ...mathMl, ...xml$1]);
2693
+ let CUSTOM_ELEMENT_HANDLING = Object.seal(create(null, {
2694
+ tagNameCheck: {
2695
+ writable: true,
2696
+ configurable: false,
2697
+ enumerable: true,
2698
+ value: null
2699
+ },
2700
+ attributeNameCheck: {
2701
+ writable: true,
2702
+ configurable: false,
2703
+ enumerable: true,
2704
+ value: null
2705
+ },
2706
+ allowCustomizedBuiltInElements: {
2707
+ writable: true,
2708
+ configurable: false,
2709
+ enumerable: true,
2710
+ value: false
2711
+ }
2712
+ }));
2713
+ let FORBID_TAGS = null;
2714
+ let FORBID_ATTR = null;
2715
+ const EXTRA_ELEMENT_HANDLING = Object.seal(create(null, {
2716
+ tagCheck: {
2717
+ writable: true,
2718
+ configurable: false,
2719
+ enumerable: true,
2720
+ value: null
2721
+ },
2722
+ attributeCheck: {
2723
+ writable: true,
2724
+ configurable: false,
2725
+ enumerable: true,
2726
+ value: null
2727
+ }
2728
+ }));
2729
+ let ALLOW_ARIA_ATTR = true;
2730
+ let ALLOW_DATA_ATTR = true;
2731
+ let ALLOW_UNKNOWN_PROTOCOLS = false;
2732
+ let ALLOW_SELF_CLOSE_IN_ATTR = true;
2733
+ let SAFE_FOR_TEMPLATES = false;
2734
+ let SAFE_FOR_XML = true;
2735
+ let WHOLE_DOCUMENT = false;
2736
+ let SET_CONFIG = false;
2737
+ let FORCE_BODY = false;
2738
+ let RETURN_DOM = false;
2739
+ let RETURN_DOM_FRAGMENT = false;
2740
+ let RETURN_TRUSTED_TYPE = false;
2741
+ let SANITIZE_DOM = true;
2742
+ let SANITIZE_NAMED_PROPS = false;
2743
+ const SANITIZE_NAMED_PROPS_PREFIX = "user-content-";
2744
+ let KEEP_CONTENT = true;
2745
+ let IN_PLACE = false;
2746
+ let USE_PROFILES = {};
2747
+ let FORBID_CONTENTS = null;
2748
+ 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"]);
2749
+ let DATA_URI_TAGS = null;
2750
+ const DEFAULT_DATA_URI_TAGS = addToSet({}, ["audio", "video", "img", "source", "image", "track"]);
2751
+ let URI_SAFE_ATTRIBUTES = null;
2752
+ const DEFAULT_URI_SAFE_ATTRIBUTES = addToSet({}, ["alt", "class", "for", "id", "label", "name", "pattern", "placeholder", "role", "summary", "title", "value", "style", "xmlns"]);
2753
+ const MATHML_NAMESPACE = "http://www.w3.org/1998/Math/MathML";
2754
+ const SVG_NAMESPACE = "http://www.w3.org/2000/svg";
2755
+ const HTML_NAMESPACE = "http://www.w3.org/1999/xhtml";
2756
+ let NAMESPACE = HTML_NAMESPACE;
2757
+ let IS_EMPTY_INPUT = false;
2758
+ let ALLOWED_NAMESPACES = null;
2759
+ const DEFAULT_ALLOWED_NAMESPACES = addToSet({}, [MATHML_NAMESPACE, SVG_NAMESPACE, HTML_NAMESPACE], stringToString);
2760
+ let MATHML_TEXT_INTEGRATION_POINTS = addToSet({}, ["mi", "mo", "mn", "ms", "mtext"]);
2761
+ let HTML_INTEGRATION_POINTS = addToSet({}, ["annotation-xml"]);
2762
+ const COMMON_SVG_AND_HTML_ELEMENTS = addToSet({}, ["title", "style", "font", "a", "script"]);
2763
+ let PARSER_MEDIA_TYPE = null;
2764
+ const SUPPORTED_PARSER_MEDIA_TYPES = ["application/xhtml+xml", "text/html"];
2765
+ const DEFAULT_PARSER_MEDIA_TYPE = "text/html";
2766
+ let transformCaseFunc = null;
2767
+ let CONFIG = null;
2768
+ const formElement = document2.createElement("form");
2769
+ const isRegexOrFunction = function isRegexOrFunction2(testValue) {
2770
+ return testValue instanceof RegExp || testValue instanceof Function;
2771
+ };
2772
+ const _parseConfig = function _parseConfig2() {
2773
+ let cfg = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
2774
+ if (CONFIG && CONFIG === cfg) {
2775
+ return;
2776
+ }
2777
+ if (!cfg || typeof cfg !== "object") {
2778
+ cfg = {};
2779
+ }
2780
+ cfg = clone$3(cfg);
2781
+ PARSER_MEDIA_TYPE = // eslint-disable-next-line unicorn/prefer-includes
2782
+ SUPPORTED_PARSER_MEDIA_TYPES.indexOf(cfg.PARSER_MEDIA_TYPE) === -1 ? DEFAULT_PARSER_MEDIA_TYPE : cfg.PARSER_MEDIA_TYPE;
2783
+ transformCaseFunc = PARSER_MEDIA_TYPE === "application/xhtml+xml" ? stringToString : stringToLowerCase;
2784
+ ALLOWED_TAGS = objectHasOwnProperty(cfg, "ALLOWED_TAGS") && arrayIsArray(cfg.ALLOWED_TAGS) ? addToSet({}, cfg.ALLOWED_TAGS, transformCaseFunc) : DEFAULT_ALLOWED_TAGS;
2785
+ ALLOWED_ATTR = objectHasOwnProperty(cfg, "ALLOWED_ATTR") && arrayIsArray(cfg.ALLOWED_ATTR) ? addToSet({}, cfg.ALLOWED_ATTR, transformCaseFunc) : DEFAULT_ALLOWED_ATTR;
2786
+ ALLOWED_NAMESPACES = objectHasOwnProperty(cfg, "ALLOWED_NAMESPACES") && arrayIsArray(cfg.ALLOWED_NAMESPACES) ? addToSet({}, cfg.ALLOWED_NAMESPACES, stringToString) : DEFAULT_ALLOWED_NAMESPACES;
2787
+ 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;
2788
+ 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;
2789
+ FORBID_CONTENTS = objectHasOwnProperty(cfg, "FORBID_CONTENTS") && arrayIsArray(cfg.FORBID_CONTENTS) ? addToSet({}, cfg.FORBID_CONTENTS, transformCaseFunc) : DEFAULT_FORBID_CONTENTS;
2790
+ FORBID_TAGS = objectHasOwnProperty(cfg, "FORBID_TAGS") && arrayIsArray(cfg.FORBID_TAGS) ? addToSet({}, cfg.FORBID_TAGS, transformCaseFunc) : clone$3({});
2791
+ FORBID_ATTR = objectHasOwnProperty(cfg, "FORBID_ATTR") && arrayIsArray(cfg.FORBID_ATTR) ? addToSet({}, cfg.FORBID_ATTR, transformCaseFunc) : clone$3({});
2792
+ USE_PROFILES = objectHasOwnProperty(cfg, "USE_PROFILES") ? cfg.USE_PROFILES && typeof cfg.USE_PROFILES === "object" ? clone$3(cfg.USE_PROFILES) : cfg.USE_PROFILES : false;
2793
+ ALLOW_ARIA_ATTR = cfg.ALLOW_ARIA_ATTR !== false;
2794
+ ALLOW_DATA_ATTR = cfg.ALLOW_DATA_ATTR !== false;
2795
+ ALLOW_UNKNOWN_PROTOCOLS = cfg.ALLOW_UNKNOWN_PROTOCOLS || false;
2796
+ ALLOW_SELF_CLOSE_IN_ATTR = cfg.ALLOW_SELF_CLOSE_IN_ATTR !== false;
2797
+ SAFE_FOR_TEMPLATES = cfg.SAFE_FOR_TEMPLATES || false;
2798
+ SAFE_FOR_XML = cfg.SAFE_FOR_XML !== false;
2799
+ WHOLE_DOCUMENT = cfg.WHOLE_DOCUMENT || false;
2800
+ RETURN_DOM = cfg.RETURN_DOM || false;
2801
+ RETURN_DOM_FRAGMENT = cfg.RETURN_DOM_FRAGMENT || false;
2802
+ RETURN_TRUSTED_TYPE = cfg.RETURN_TRUSTED_TYPE || false;
2803
+ FORCE_BODY = cfg.FORCE_BODY || false;
2804
+ SANITIZE_DOM = cfg.SANITIZE_DOM !== false;
2805
+ SANITIZE_NAMED_PROPS = cfg.SANITIZE_NAMED_PROPS || false;
2806
+ KEEP_CONTENT = cfg.KEEP_CONTENT !== false;
2807
+ IN_PLACE = cfg.IN_PLACE || false;
2808
+ IS_ALLOWED_URI$1 = isRegex(cfg.ALLOWED_URI_REGEXP) ? cfg.ALLOWED_URI_REGEXP : IS_ALLOWED_URI;
2809
+ NAMESPACE = typeof cfg.NAMESPACE === "string" ? cfg.NAMESPACE : HTML_NAMESPACE;
2810
+ 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"]);
2811
+ 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"]);
2812
+ 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);
2813
+ CUSTOM_ELEMENT_HANDLING = create(null);
2814
+ if (objectHasOwnProperty(customElementHandling, "tagNameCheck") && isRegexOrFunction(customElementHandling.tagNameCheck)) {
2815
+ CUSTOM_ELEMENT_HANDLING.tagNameCheck = customElementHandling.tagNameCheck;
2816
+ }
2817
+ if (objectHasOwnProperty(customElementHandling, "attributeNameCheck") && isRegexOrFunction(customElementHandling.attributeNameCheck)) {
2818
+ CUSTOM_ELEMENT_HANDLING.attributeNameCheck = customElementHandling.attributeNameCheck;
2819
+ }
2820
+ if (objectHasOwnProperty(customElementHandling, "allowCustomizedBuiltInElements") && typeof customElementHandling.allowCustomizedBuiltInElements === "boolean") {
2821
+ CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements = customElementHandling.allowCustomizedBuiltInElements;
2822
+ }
2823
+ if (SAFE_FOR_TEMPLATES) {
2824
+ ALLOW_DATA_ATTR = false;
2825
+ }
2826
+ if (RETURN_DOM_FRAGMENT) {
2827
+ RETURN_DOM = true;
2828
+ }
2829
+ if (USE_PROFILES) {
2830
+ ALLOWED_TAGS = addToSet({}, text$2);
2831
+ ALLOWED_ATTR = create(null);
2832
+ if (USE_PROFILES.html === true) {
2833
+ addToSet(ALLOWED_TAGS, html$1$1);
2834
+ addToSet(ALLOWED_ATTR, html$2);
2835
+ }
2836
+ if (USE_PROFILES.svg === true) {
2837
+ addToSet(ALLOWED_TAGS, svg$1);
2838
+ addToSet(ALLOWED_ATTR, svg);
2839
+ addToSet(ALLOWED_ATTR, xml$1);
2840
+ }
2841
+ if (USE_PROFILES.svgFilters === true) {
2842
+ addToSet(ALLOWED_TAGS, svgFilters);
2843
+ addToSet(ALLOWED_ATTR, svg);
2844
+ addToSet(ALLOWED_ATTR, xml$1);
2845
+ }
2846
+ if (USE_PROFILES.mathMl === true) {
2847
+ addToSet(ALLOWED_TAGS, mathMl$1);
2848
+ addToSet(ALLOWED_ATTR, mathMl);
2849
+ addToSet(ALLOWED_ATTR, xml$1);
2850
+ }
2851
+ }
2852
+ EXTRA_ELEMENT_HANDLING.tagCheck = null;
2853
+ EXTRA_ELEMENT_HANDLING.attributeCheck = null;
2854
+ if (objectHasOwnProperty(cfg, "ADD_TAGS")) {
2855
+ if (typeof cfg.ADD_TAGS === "function") {
2856
+ EXTRA_ELEMENT_HANDLING.tagCheck = cfg.ADD_TAGS;
2857
+ } else if (arrayIsArray(cfg.ADD_TAGS)) {
2858
+ if (ALLOWED_TAGS === DEFAULT_ALLOWED_TAGS) {
2859
+ ALLOWED_TAGS = clone$3(ALLOWED_TAGS);
2860
+ }
2861
+ addToSet(ALLOWED_TAGS, cfg.ADD_TAGS, transformCaseFunc);
2862
+ }
2863
+ }
2864
+ if (objectHasOwnProperty(cfg, "ADD_ATTR")) {
2865
+ if (typeof cfg.ADD_ATTR === "function") {
2866
+ EXTRA_ELEMENT_HANDLING.attributeCheck = cfg.ADD_ATTR;
2867
+ } else if (arrayIsArray(cfg.ADD_ATTR)) {
2868
+ if (ALLOWED_ATTR === DEFAULT_ALLOWED_ATTR) {
2869
+ ALLOWED_ATTR = clone$3(ALLOWED_ATTR);
2870
+ }
2871
+ addToSet(ALLOWED_ATTR, cfg.ADD_ATTR, transformCaseFunc);
2872
+ }
2873
+ }
2874
+ if (objectHasOwnProperty(cfg, "ADD_URI_SAFE_ATTR") && arrayIsArray(cfg.ADD_URI_SAFE_ATTR)) {
2875
+ addToSet(URI_SAFE_ATTRIBUTES, cfg.ADD_URI_SAFE_ATTR, transformCaseFunc);
2876
+ }
2877
+ if (objectHasOwnProperty(cfg, "FORBID_CONTENTS") && arrayIsArray(cfg.FORBID_CONTENTS)) {
2878
+ if (FORBID_CONTENTS === DEFAULT_FORBID_CONTENTS) {
2879
+ FORBID_CONTENTS = clone$3(FORBID_CONTENTS);
2880
+ }
2881
+ addToSet(FORBID_CONTENTS, cfg.FORBID_CONTENTS, transformCaseFunc);
2882
+ }
2883
+ if (objectHasOwnProperty(cfg, "ADD_FORBID_CONTENTS") && arrayIsArray(cfg.ADD_FORBID_CONTENTS)) {
2884
+ if (FORBID_CONTENTS === DEFAULT_FORBID_CONTENTS) {
2885
+ FORBID_CONTENTS = clone$3(FORBID_CONTENTS);
2886
+ }
2887
+ addToSet(FORBID_CONTENTS, cfg.ADD_FORBID_CONTENTS, transformCaseFunc);
2888
+ }
2889
+ if (KEEP_CONTENT) {
2890
+ ALLOWED_TAGS["#text"] = true;
2891
+ }
2892
+ if (WHOLE_DOCUMENT) {
2893
+ addToSet(ALLOWED_TAGS, ["html", "head", "body"]);
2894
+ }
2895
+ if (ALLOWED_TAGS.table) {
2896
+ addToSet(ALLOWED_TAGS, ["tbody"]);
2897
+ delete FORBID_TAGS.tbody;
2898
+ }
2899
+ if (cfg.TRUSTED_TYPES_POLICY) {
2900
+ if (typeof cfg.TRUSTED_TYPES_POLICY.createHTML !== "function") {
2901
+ throw typeErrorCreate('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');
2902
+ }
2903
+ if (typeof cfg.TRUSTED_TYPES_POLICY.createScriptURL !== "function") {
2904
+ throw typeErrorCreate('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');
2905
+ }
2906
+ trustedTypesPolicy = cfg.TRUSTED_TYPES_POLICY;
2907
+ emptyHTML = trustedTypesPolicy.createHTML("");
2908
+ } else {
2909
+ if (trustedTypesPolicy === void 0) {
2910
+ trustedTypesPolicy = _createTrustedTypesPolicy(trustedTypes, currentScript);
2911
+ }
2912
+ if (trustedTypesPolicy !== null && typeof emptyHTML === "string") {
2913
+ emptyHTML = trustedTypesPolicy.createHTML("");
2914
+ }
2915
+ }
2916
+ if (freeze) {
2917
+ freeze(cfg);
2918
+ }
2919
+ CONFIG = cfg;
2920
+ };
2921
+ const ALL_SVG_TAGS = addToSet({}, [...svg$1, ...svgFilters, ...svgDisallowed]);
2922
+ const ALL_MATHML_TAGS = addToSet({}, [...mathMl$1, ...mathMlDisallowed]);
2923
+ const _checkValidNamespace = function _checkValidNamespace2(element) {
2924
+ let parent2 = getParentNode(element);
2925
+ if (!parent2 || !parent2.tagName) {
2926
+ parent2 = {
2927
+ namespaceURI: NAMESPACE,
2928
+ tagName: "template"
2929
+ };
2930
+ }
2931
+ const tagName = stringToLowerCase(element.tagName);
2932
+ const parentTagName = stringToLowerCase(parent2.tagName);
2933
+ if (!ALLOWED_NAMESPACES[element.namespaceURI]) {
2934
+ return false;
2935
+ }
2936
+ if (element.namespaceURI === SVG_NAMESPACE) {
2937
+ if (parent2.namespaceURI === HTML_NAMESPACE) {
2938
+ return tagName === "svg";
2939
+ }
2940
+ if (parent2.namespaceURI === MATHML_NAMESPACE) {
2941
+ return tagName === "svg" && (parentTagName === "annotation-xml" || MATHML_TEXT_INTEGRATION_POINTS[parentTagName]);
2942
+ }
2943
+ return Boolean(ALL_SVG_TAGS[tagName]);
2944
+ }
2945
+ if (element.namespaceURI === MATHML_NAMESPACE) {
2946
+ if (parent2.namespaceURI === HTML_NAMESPACE) {
2947
+ return tagName === "math";
2948
+ }
2949
+ if (parent2.namespaceURI === SVG_NAMESPACE) {
2950
+ return tagName === "math" && HTML_INTEGRATION_POINTS[parentTagName];
2951
+ }
2952
+ return Boolean(ALL_MATHML_TAGS[tagName]);
2953
+ }
2954
+ if (element.namespaceURI === HTML_NAMESPACE) {
2955
+ if (parent2.namespaceURI === SVG_NAMESPACE && !HTML_INTEGRATION_POINTS[parentTagName]) {
2956
+ return false;
2957
+ }
2958
+ if (parent2.namespaceURI === MATHML_NAMESPACE && !MATHML_TEXT_INTEGRATION_POINTS[parentTagName]) {
2959
+ return false;
2960
+ }
2961
+ return !ALL_MATHML_TAGS[tagName] && (COMMON_SVG_AND_HTML_ELEMENTS[tagName] || !ALL_SVG_TAGS[tagName]);
2962
+ }
2963
+ if (PARSER_MEDIA_TYPE === "application/xhtml+xml" && ALLOWED_NAMESPACES[element.namespaceURI]) {
2964
+ return true;
2965
+ }
2966
+ return false;
2967
+ };
2968
+ const _forceRemove = function _forceRemove2(node) {
2969
+ arrayPush(DOMPurify.removed, {
2970
+ element: node
2971
+ });
2972
+ try {
2973
+ getParentNode(node).removeChild(node);
2974
+ } catch (_) {
2975
+ remove2(node);
2976
+ }
2977
+ };
2978
+ const _removeAttribute = function _removeAttribute2(name2, element) {
2979
+ try {
2980
+ arrayPush(DOMPurify.removed, {
2981
+ attribute: element.getAttributeNode(name2),
2982
+ from: element
2983
+ });
2984
+ } catch (_) {
2985
+ arrayPush(DOMPurify.removed, {
2986
+ attribute: null,
2987
+ from: element
2988
+ });
2989
+ }
2990
+ element.removeAttribute(name2);
2991
+ if (name2 === "is") {
2992
+ if (RETURN_DOM || RETURN_DOM_FRAGMENT) {
2993
+ try {
2994
+ _forceRemove(element);
2995
+ } catch (_) {
2996
+ }
2997
+ } else {
2998
+ try {
2999
+ element.setAttribute(name2, "");
3000
+ } catch (_) {
3001
+ }
3002
+ }
3003
+ }
3004
+ };
3005
+ const _initDocument = function _initDocument2(dirty) {
3006
+ let doc = null;
3007
+ let leadingWhitespace = null;
3008
+ if (FORCE_BODY) {
3009
+ dirty = "<remove></remove>" + dirty;
3010
+ } else {
3011
+ const matches = stringMatch(dirty, /^[\r\n\t ]+/);
3012
+ leadingWhitespace = matches && matches[0];
3013
+ }
3014
+ if (PARSER_MEDIA_TYPE === "application/xhtml+xml" && NAMESPACE === HTML_NAMESPACE) {
3015
+ dirty = '<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>' + dirty + "</body></html>";
3016
+ }
3017
+ const dirtyPayload = trustedTypesPolicy ? trustedTypesPolicy.createHTML(dirty) : dirty;
3018
+ if (NAMESPACE === HTML_NAMESPACE) {
3019
+ try {
3020
+ doc = new DOMParser().parseFromString(dirtyPayload, PARSER_MEDIA_TYPE);
3021
+ } catch (_) {
3022
+ }
3023
+ }
3024
+ if (!doc || !doc.documentElement) {
3025
+ doc = implementation.createDocument(NAMESPACE, "template", null);
3026
+ try {
3027
+ doc.documentElement.innerHTML = IS_EMPTY_INPUT ? emptyHTML : dirtyPayload;
3028
+ } catch (_) {
3029
+ }
3030
+ }
3031
+ const body = doc.body || doc.documentElement;
3032
+ if (dirty && leadingWhitespace) {
3033
+ body.insertBefore(document2.createTextNode(leadingWhitespace), body.childNodes[0] || null);
3034
+ }
3035
+ if (NAMESPACE === HTML_NAMESPACE) {
3036
+ return getElementsByTagName2.call(doc, WHOLE_DOCUMENT ? "html" : "body")[0];
3037
+ }
3038
+ return WHOLE_DOCUMENT ? doc.documentElement : body;
3039
+ };
3040
+ const _createNodeIterator = function _createNodeIterator2(root2) {
3041
+ return createNodeIterator.call(
3042
+ root2.ownerDocument || root2,
3043
+ root2,
3044
+ // eslint-disable-next-line no-bitwise
3045
+ NodeFilter.SHOW_ELEMENT | NodeFilter.SHOW_COMMENT | NodeFilter.SHOW_TEXT | NodeFilter.SHOW_PROCESSING_INSTRUCTION | NodeFilter.SHOW_CDATA_SECTION,
3046
+ null
3047
+ );
3048
+ };
3049
+ const _isClobbered = function _isClobbered2(element) {
3050
+ 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");
3051
+ };
3052
+ const _isNode = function _isNode2(value) {
3053
+ return typeof Node3 === "function" && value instanceof Node3;
3054
+ };
3055
+ function _executeHooks(hooks2, currentNode, data2) {
3056
+ arrayForEach(hooks2, (hook) => {
3057
+ hook.call(DOMPurify, currentNode, data2, CONFIG);
3058
+ });
3059
+ }
3060
+ const _sanitizeElements = function _sanitizeElements2(currentNode) {
3061
+ let content = null;
3062
+ _executeHooks(hooks.beforeSanitizeElements, currentNode, null);
3063
+ if (_isClobbered(currentNode)) {
3064
+ _forceRemove(currentNode);
3065
+ return true;
3066
+ }
3067
+ const tagName = transformCaseFunc(currentNode.nodeName);
3068
+ _executeHooks(hooks.uponSanitizeElement, currentNode, {
3069
+ tagName,
3070
+ allowedTags: ALLOWED_TAGS
3071
+ });
3072
+ if (SAFE_FOR_XML && currentNode.hasChildNodes() && !_isNode(currentNode.firstElementChild) && regExpTest(/<[/\w!]/g, currentNode.innerHTML) && regExpTest(/<[/\w!]/g, currentNode.textContent)) {
3073
+ _forceRemove(currentNode);
3074
+ return true;
3075
+ }
3076
+ if (SAFE_FOR_XML && currentNode.namespaceURI === HTML_NAMESPACE && tagName === "style" && _isNode(currentNode.firstElementChild)) {
3077
+ _forceRemove(currentNode);
3078
+ return true;
3079
+ }
3080
+ if (currentNode.nodeType === NODE_TYPE$1.progressingInstruction) {
3081
+ _forceRemove(currentNode);
3082
+ return true;
3083
+ }
3084
+ if (SAFE_FOR_XML && currentNode.nodeType === NODE_TYPE$1.comment && regExpTest(/<[/\w]/g, currentNode.data)) {
3085
+ _forceRemove(currentNode);
3086
+ return true;
3087
+ }
3088
+ if (FORBID_TAGS[tagName] || !(EXTRA_ELEMENT_HANDLING.tagCheck instanceof Function && EXTRA_ELEMENT_HANDLING.tagCheck(tagName)) && !ALLOWED_TAGS[tagName]) {
3089
+ if (!FORBID_TAGS[tagName] && _isBasicCustomElement(tagName)) {
3090
+ if (CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof RegExp && regExpTest(CUSTOM_ELEMENT_HANDLING.tagNameCheck, tagName)) {
3091
+ return false;
3092
+ }
3093
+ if (CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof Function && CUSTOM_ELEMENT_HANDLING.tagNameCheck(tagName)) {
3094
+ return false;
3095
+ }
3096
+ }
3097
+ if (KEEP_CONTENT && !FORBID_CONTENTS[tagName]) {
3098
+ const parentNode = getParentNode(currentNode) || currentNode.parentNode;
3099
+ const childNodes = getChildNodes(currentNode) || currentNode.childNodes;
3100
+ if (childNodes && parentNode) {
3101
+ const childCount = childNodes.length;
3102
+ for (let i = childCount - 1; i >= 0; --i) {
3103
+ const childClone = cloneNode2(childNodes[i], true);
3104
+ parentNode.insertBefore(childClone, getNextSibling(currentNode));
3105
+ }
3106
+ }
3107
+ }
3108
+ _forceRemove(currentNode);
3109
+ return true;
3110
+ }
3111
+ if (currentNode instanceof Element2 && !_checkValidNamespace(currentNode)) {
3112
+ _forceRemove(currentNode);
3113
+ return true;
3114
+ }
3115
+ if ((tagName === "noscript" || tagName === "noembed" || tagName === "noframes") && regExpTest(/<\/no(script|embed|frames)/i, currentNode.innerHTML)) {
3116
+ _forceRemove(currentNode);
3117
+ return true;
3118
+ }
3119
+ if (SAFE_FOR_TEMPLATES && currentNode.nodeType === NODE_TYPE$1.text) {
3120
+ content = currentNode.textContent;
3121
+ arrayForEach([MUSTACHE_EXPR$1, ERB_EXPR$1, TMPLIT_EXPR$1], (expr) => {
3122
+ content = stringReplace(content, expr, " ");
3123
+ });
3124
+ if (currentNode.textContent !== content) {
3125
+ arrayPush(DOMPurify.removed, {
3126
+ element: currentNode.cloneNode()
3127
+ });
3128
+ currentNode.textContent = content;
3129
+ }
3130
+ }
3131
+ _executeHooks(hooks.afterSanitizeElements, currentNode, null);
3132
+ return false;
3133
+ };
3134
+ const _isValidAttribute = function _isValidAttribute2(lcTag, lcName, value) {
3135
+ if (FORBID_ATTR[lcName]) {
3136
+ return false;
3137
+ }
3138
+ if (SANITIZE_DOM && (lcName === "id" || lcName === "name") && (value in document2 || value in formElement)) {
3139
+ return false;
3140
+ }
3141
+ const nameIsPermitted = ALLOWED_ATTR[lcName] || EXTRA_ELEMENT_HANDLING.attributeCheck instanceof Function && EXTRA_ELEMENT_HANDLING.attributeCheck(lcName, lcTag);
3142
+ if (ALLOW_DATA_ATTR && !FORBID_ATTR[lcName] && regExpTest(DATA_ATTR$1, lcName)) ;
3143
+ else if (ALLOW_ARIA_ATTR && regExpTest(ARIA_ATTR$1, lcName)) ;
3144
+ else if (!nameIsPermitted || FORBID_ATTR[lcName]) {
3145
+ if (
3146
+ // First condition does a very basic check if a) it's basically a valid custom element tagname AND
3147
+ // b) if the tagName passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.tagNameCheck
3148
+ // and c) if the attribute name passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.attributeNameCheck
3149
+ _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
3150
+ // the value passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.tagNameCheck
3151
+ 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))
3152
+ ) ;
3153
+ else {
3154
+ return false;
3155
+ }
3156
+ } else if (URI_SAFE_ATTRIBUTES[lcName]) ;
3157
+ else if (regExpTest(IS_ALLOWED_URI$1, stringReplace(value, ATTR_WHITESPACE$1, ""))) ;
3158
+ else if ((lcName === "src" || lcName === "xlink:href" || lcName === "href") && lcTag !== "script" && stringIndexOf(value, "data:") === 0 && DATA_URI_TAGS[lcTag]) ;
3159
+ else if (ALLOW_UNKNOWN_PROTOCOLS && !regExpTest(IS_SCRIPT_OR_DATA$1, stringReplace(value, ATTR_WHITESPACE$1, ""))) ;
3160
+ else if (value) {
3161
+ return false;
3162
+ } else ;
3163
+ return true;
3164
+ };
3165
+ 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"]);
3166
+ const _isBasicCustomElement = function _isBasicCustomElement2(tagName) {
3167
+ return !RESERVED_CUSTOM_ELEMENT_NAMES[stringToLowerCase(tagName)] && regExpTest(CUSTOM_ELEMENT$1, tagName);
3168
+ };
3169
+ const _sanitizeAttributes = function _sanitizeAttributes2(currentNode) {
3170
+ _executeHooks(hooks.beforeSanitizeAttributes, currentNode, null);
3171
+ const attributes2 = currentNode.attributes;
3172
+ if (!attributes2 || _isClobbered(currentNode)) {
3173
+ return;
3174
+ }
3175
+ const hookEvent = {
3176
+ attrName: "",
3177
+ attrValue: "",
3178
+ keepAttr: true,
3179
+ allowedAttributes: ALLOWED_ATTR,
3180
+ forceKeepAttr: void 0
3181
+ };
3182
+ let l2 = attributes2.length;
3183
+ while (l2--) {
3184
+ const attr2 = attributes2[l2];
3185
+ const name2 = attr2.name, namespaceURI = attr2.namespaceURI, attrValue = attr2.value;
3186
+ const lcName = transformCaseFunc(name2);
3187
+ const initValue = attrValue;
3188
+ let value = name2 === "value" ? initValue : stringTrim(initValue);
3189
+ hookEvent.attrName = lcName;
3190
+ hookEvent.attrValue = value;
3191
+ hookEvent.keepAttr = true;
3192
+ hookEvent.forceKeepAttr = void 0;
3193
+ _executeHooks(hooks.uponSanitizeAttribute, currentNode, hookEvent);
3194
+ value = hookEvent.attrValue;
3195
+ if (SANITIZE_NAMED_PROPS && (lcName === "id" || lcName === "name") && stringIndexOf(value, SANITIZE_NAMED_PROPS_PREFIX) !== 0) {
3196
+ _removeAttribute(name2, currentNode);
3197
+ value = SANITIZE_NAMED_PROPS_PREFIX + value;
3198
+ }
3199
+ if (SAFE_FOR_XML && regExpTest(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i, value)) {
3200
+ _removeAttribute(name2, currentNode);
3201
+ continue;
3202
+ }
3203
+ if (lcName === "attributename" && stringMatch(value, "href")) {
3204
+ _removeAttribute(name2, currentNode);
3205
+ continue;
3206
+ }
3207
+ if (hookEvent.forceKeepAttr) {
3208
+ continue;
3209
+ }
3210
+ if (!hookEvent.keepAttr) {
3211
+ _removeAttribute(name2, currentNode);
3212
+ continue;
3213
+ }
3214
+ if (!ALLOW_SELF_CLOSE_IN_ATTR && regExpTest(/\/>/i, value)) {
3215
+ _removeAttribute(name2, currentNode);
3216
+ continue;
3217
+ }
3218
+ if (SAFE_FOR_TEMPLATES) {
3219
+ arrayForEach([MUSTACHE_EXPR$1, ERB_EXPR$1, TMPLIT_EXPR$1], (expr) => {
3220
+ value = stringReplace(value, expr, " ");
3221
+ });
3222
+ }
3223
+ const lcTag = transformCaseFunc(currentNode.nodeName);
3224
+ if (!_isValidAttribute(lcTag, lcName, value)) {
3225
+ _removeAttribute(name2, currentNode);
3226
+ continue;
3227
+ }
3228
+ if (trustedTypesPolicy && typeof trustedTypes === "object" && typeof trustedTypes.getAttributeType === "function") {
3229
+ if (namespaceURI) ;
3230
+ else {
3231
+ switch (trustedTypes.getAttributeType(lcTag, lcName)) {
3232
+ case "TrustedHTML": {
3233
+ value = trustedTypesPolicy.createHTML(value);
3234
+ break;
3235
+ }
3236
+ case "TrustedScriptURL": {
3237
+ value = trustedTypesPolicy.createScriptURL(value);
3238
+ break;
3239
+ }
3240
+ }
3241
+ }
3242
+ }
3243
+ if (value !== initValue) {
3244
+ try {
3245
+ if (namespaceURI) {
3246
+ currentNode.setAttributeNS(namespaceURI, name2, value);
3247
+ } else {
3248
+ currentNode.setAttribute(name2, value);
3249
+ }
3250
+ if (_isClobbered(currentNode)) {
3251
+ _forceRemove(currentNode);
3252
+ } else {
3253
+ arrayPop(DOMPurify.removed);
3254
+ }
3255
+ } catch (_) {
3256
+ _removeAttribute(name2, currentNode);
3257
+ }
3258
+ }
3259
+ }
3260
+ _executeHooks(hooks.afterSanitizeAttributes, currentNode, null);
3261
+ };
3262
+ const _sanitizeShadowDOM2 = function _sanitizeShadowDOM(fragment) {
3263
+ let shadowNode = null;
3264
+ const shadowIterator = _createNodeIterator(fragment);
3265
+ _executeHooks(hooks.beforeSanitizeShadowDOM, fragment, null);
3266
+ while (shadowNode = shadowIterator.nextNode()) {
3267
+ _executeHooks(hooks.uponSanitizeShadowNode, shadowNode, null);
3268
+ _sanitizeElements(shadowNode);
3269
+ _sanitizeAttributes(shadowNode);
3270
+ if (shadowNode.content instanceof DocumentFragment) {
3271
+ _sanitizeShadowDOM2(shadowNode.content);
3272
+ }
3273
+ }
3274
+ _executeHooks(hooks.afterSanitizeShadowDOM, fragment, null);
3275
+ };
3276
+ const _sanitizeAttachedShadowRoots2 = function _sanitizeAttachedShadowRoots(root2) {
3277
+ if (root2.nodeType === NODE_TYPE$1.element && root2.shadowRoot instanceof DocumentFragment) {
3278
+ const sr = root2.shadowRoot;
3279
+ _sanitizeAttachedShadowRoots2(sr);
3280
+ _sanitizeShadowDOM2(sr);
3281
+ }
3282
+ const childNodes = root2.childNodes;
3283
+ if (!childNodes) {
3284
+ return;
3285
+ }
3286
+ const snapshot = [];
3287
+ arrayForEach(childNodes, (child) => {
3288
+ arrayPush(snapshot, child);
3289
+ });
3290
+ for (const child of snapshot) {
3291
+ _sanitizeAttachedShadowRoots2(child);
3292
+ }
3293
+ };
3294
+ DOMPurify.sanitize = function(dirty) {
3295
+ let cfg = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
3296
+ let body = null;
3297
+ let importedNode = null;
3298
+ let currentNode = null;
3299
+ let returnNode = null;
3300
+ IS_EMPTY_INPUT = !dirty;
3301
+ if (IS_EMPTY_INPUT) {
3302
+ dirty = "<!-->";
3303
+ }
3304
+ if (typeof dirty !== "string" && !_isNode(dirty)) {
3305
+ dirty = stringifyValue(dirty);
3306
+ if (typeof dirty !== "string") {
3307
+ throw typeErrorCreate("dirty is not a string, aborting");
3308
+ }
3309
+ }
3310
+ if (!DOMPurify.isSupported) {
3311
+ return dirty;
3312
+ }
3313
+ if (!SET_CONFIG) {
3314
+ _parseConfig(cfg);
3315
+ }
3316
+ DOMPurify.removed = [];
3317
+ if (typeof dirty === "string") {
3318
+ IN_PLACE = false;
3319
+ }
3320
+ if (IN_PLACE) {
3321
+ const nn = dirty.nodeName;
3322
+ if (typeof nn === "string") {
3323
+ const tagName = transformCaseFunc(nn);
3324
+ if (!ALLOWED_TAGS[tagName] || FORBID_TAGS[tagName]) {
3325
+ throw typeErrorCreate("root node is forbidden and cannot be sanitized in-place");
3326
+ }
3327
+ }
3328
+ _sanitizeAttachedShadowRoots2(dirty);
3329
+ } else if (dirty instanceof Node3) {
3330
+ body = _initDocument("<!---->");
3331
+ importedNode = body.ownerDocument.importNode(dirty, true);
3332
+ if (importedNode.nodeType === NODE_TYPE$1.element && importedNode.nodeName === "BODY") {
3333
+ body = importedNode;
3334
+ } else if (importedNode.nodeName === "HTML") {
3335
+ body = importedNode;
3336
+ } else {
3337
+ body.appendChild(importedNode);
3338
+ }
3339
+ _sanitizeAttachedShadowRoots2(importedNode);
3340
+ } else {
3341
+ if (!RETURN_DOM && !SAFE_FOR_TEMPLATES && !WHOLE_DOCUMENT && // eslint-disable-next-line unicorn/prefer-includes
3342
+ dirty.indexOf("<") === -1) {
3343
+ return trustedTypesPolicy && RETURN_TRUSTED_TYPE ? trustedTypesPolicy.createHTML(dirty) : dirty;
3344
+ }
3345
+ body = _initDocument(dirty);
3346
+ if (!body) {
3347
+ return RETURN_DOM ? null : RETURN_TRUSTED_TYPE ? emptyHTML : "";
3348
+ }
3349
+ }
3350
+ if (body && FORCE_BODY) {
3351
+ _forceRemove(body.firstChild);
3352
+ }
3353
+ const nodeIterator = _createNodeIterator(IN_PLACE ? dirty : body);
3354
+ while (currentNode = nodeIterator.nextNode()) {
3355
+ _sanitizeElements(currentNode);
3356
+ _sanitizeAttributes(currentNode);
3357
+ if (currentNode.content instanceof DocumentFragment) {
3358
+ _sanitizeShadowDOM2(currentNode.content);
3359
+ }
3360
+ }
3361
+ if (IN_PLACE) {
3362
+ return dirty;
3363
+ }
3364
+ if (RETURN_DOM) {
3365
+ if (SAFE_FOR_TEMPLATES) {
3366
+ body.normalize();
3367
+ let html2 = body.innerHTML;
3368
+ arrayForEach([MUSTACHE_EXPR$1, ERB_EXPR$1, TMPLIT_EXPR$1], (expr) => {
3369
+ html2 = stringReplace(html2, expr, " ");
3370
+ });
3371
+ body.innerHTML = html2;
3372
+ }
3373
+ if (RETURN_DOM_FRAGMENT) {
3374
+ returnNode = createDocumentFragment.call(body.ownerDocument);
3375
+ while (body.firstChild) {
3376
+ returnNode.appendChild(body.firstChild);
3377
+ }
3378
+ } else {
3379
+ returnNode = body;
3380
+ }
3381
+ if (ALLOWED_ATTR.shadowroot || ALLOWED_ATTR.shadowrootmode) {
3382
+ returnNode = importNode.call(originalDocument, returnNode, true);
3383
+ }
3384
+ return returnNode;
3385
+ }
3386
+ let serializedHTML = WHOLE_DOCUMENT ? body.outerHTML : body.innerHTML;
3387
+ if (WHOLE_DOCUMENT && ALLOWED_TAGS["!doctype"] && body.ownerDocument && body.ownerDocument.doctype && body.ownerDocument.doctype.name && regExpTest(DOCTYPE_NAME, body.ownerDocument.doctype.name)) {
3388
+ serializedHTML = "<!DOCTYPE " + body.ownerDocument.doctype.name + ">\n" + serializedHTML;
3389
+ }
3390
+ if (SAFE_FOR_TEMPLATES) {
3391
+ arrayForEach([MUSTACHE_EXPR$1, ERB_EXPR$1, TMPLIT_EXPR$1], (expr) => {
3392
+ serializedHTML = stringReplace(serializedHTML, expr, " ");
3393
+ });
3394
+ }
3395
+ return trustedTypesPolicy && RETURN_TRUSTED_TYPE ? trustedTypesPolicy.createHTML(serializedHTML) : serializedHTML;
3396
+ };
3397
+ DOMPurify.setConfig = function() {
3398
+ let cfg = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
3399
+ _parseConfig(cfg);
3400
+ SET_CONFIG = true;
3401
+ };
3402
+ DOMPurify.clearConfig = function() {
3403
+ CONFIG = null;
3404
+ SET_CONFIG = false;
3405
+ };
3406
+ DOMPurify.isValidAttribute = function(tag, attr2, value) {
3407
+ if (!CONFIG) {
3408
+ _parseConfig({});
3409
+ }
3410
+ const lcTag = transformCaseFunc(tag);
3411
+ const lcName = transformCaseFunc(attr2);
3412
+ return _isValidAttribute(lcTag, lcName, value);
3413
+ };
3414
+ DOMPurify.addHook = function(entryPoint, hookFunction) {
3415
+ if (typeof hookFunction !== "function") {
3416
+ return;
3417
+ }
3418
+ arrayPush(hooks[entryPoint], hookFunction);
3419
+ };
3420
+ DOMPurify.removeHook = function(entryPoint, hookFunction) {
3421
+ if (hookFunction !== void 0) {
3422
+ const index2 = arrayLastIndexOf(hooks[entryPoint], hookFunction);
3423
+ return index2 === -1 ? void 0 : arraySplice(hooks[entryPoint], index2, 1)[0];
3424
+ }
3425
+ return arrayPop(hooks[entryPoint]);
3426
+ };
3427
+ DOMPurify.removeHooks = function(entryPoint) {
3428
+ hooks[entryPoint] = [];
3429
+ };
3430
+ DOMPurify.removeAllHooks = function() {
3431
+ hooks = _createHooksMap();
3432
+ };
3433
+ return DOMPurify;
3434
+ }
3435
+ var purify = createDOMPurify();
2209
3436
  ABConvert.factory({
2210
3437
  id: "md",
2211
3438
  name: "md",
@@ -2225,7 +3452,7 @@ ABConvert.factory({
2225
3452
  process_param: ABConvert_IOEnum.text,
2226
3453
  process_return: ABConvert_IOEnum.el,
2227
3454
  process: (el, header, content) => {
2228
- el.innerHTML = `<p>${content.replace(/ /g, "&nbsp;").split("\n").join("<br/>")}</p>`;
3455
+ el.innerHTML = purify.sanitize(`<p>${content.replace(/ /g, "&nbsp;").split("\n").join("<br/>")}</p>`);
2229
3456
  return el;
2230
3457
  }
2231
3458
  });
@@ -14823,7 +16050,7 @@ ABConvert.factory({
14823
16050
  async function render_pumlText(text2, div) {
14824
16051
  var encoded = plantumlEncoder.encode(text2);
14825
16052
  let url = "http://www.plantuml.com/plantuml/img/" + encoded;
14826
- div.innerHTML = `<img src="${url}">`;
16053
+ div.innerHTML = purify.sanitize(`<img src="${url}">`);
14827
16054
  return div;
14828
16055
  }
14829
16056
  function getID(length = 16) {
@@ -15000,207 +16227,18 @@ async function data2mindmap(list_itemInfo, div) {
15000
16227
  async function render_mermaidText(mermaidText, div) {
15001
16228
  if (ABCSetting.env.startsWith("obsidian") && ABCSetting.obsidian.mermaid) {
15002
16229
  ABCSetting.obsidian.mermaid.then(async (mermaid) => {
15003
- const { svg } = await mermaid.render("ab-mermaid-" + getID(), mermaidText);
16230
+ const { svg: svg2 } = await mermaid.render("ab-mermaid-" + getID(), mermaidText);
15004
16231
  const div_mermaid = document.createElement("div");
15005
16232
  div.appendChild(div_mermaid);
15006
16233
  div_mermaid.classList.add("mermaid");
15007
- div_mermaid.innerHTML = svg;
16234
+ div_mermaid.innerHTML = svg2;
15008
16235
  });
15009
16236
  } else {
15010
16237
  div.classList.add("ab-raw");
15011
- div.innerHTML = `<div class="ab-raw-data" type-data="mermaid" content-data='${mermaidText}'></div>`;
16238
+ div.innerHTML = purify.sanitize(`<div class="ab-raw-data" type-data="mermaid" content-data='${mermaidText}'></div>`);
15012
16239
  }
15013
16240
  return div;
15014
16241
  }
15015
- function abConvertEvent(d, isCycle = false) {
15016
- if (d.querySelector(".ab-super-width")) {
15017
- const els_note = d.querySelectorAll(".ab-note");
15018
- for (const el_note of els_note) {
15019
- if (el_note.classList.contains("ab-super-width") || el_note.querySelector(".ab-super-width")) {
15020
- const el_replace = el_note.parentNode;
15021
- if (el_replace && el_replace.classList.contains("ab-replace")) {
15022
- el_replace.classList.add("ab-super-width-p");
15023
- }
15024
- }
15025
- }
15026
- const els_view = document.querySelectorAll(".app-container .workspace-leaf");
15027
- for (const el_view of els_view) {
15028
- el_view.style.setProperty("--ab-width-outer", (el_view.offsetWidth - 40).toString() + "px");
15029
- }
15030
- }
15031
- if (d.querySelector(".ab-nodes-node")) {
15032
- const els_min = document.querySelectorAll(".ab-nodes.min .ab-nodes-node");
15033
- const list_children = d.querySelectorAll(".ab-nodes-node");
15034
- for (const children2 of list_children) {
15035
- const el_content = children2.querySelector(".ab-nodes-content");
15036
- if (!el_content) continue;
15037
- const el_child = children2.querySelector(".ab-nodes-children");
15038
- if (!el_child) continue;
15039
- const el_bracket = el_child.querySelector(".ab-nodes-bracket");
15040
- if (!el_bracket) continue;
15041
- const el_bracket2 = el_child.querySelector(".ab-nodes-bracket2");
15042
- if (!el_bracket2) continue;
15043
- const els_child = el_child.childNodes;
15044
- if (els_child.length < 3) {
15045
- el_bracket.style.setProperty("display", "none");
15046
- el_bracket2.style.setProperty("display", "none");
15047
- continue;
15048
- }
15049
- const el_child_first = els_child[2];
15050
- const el_child_last = els_child[els_child.length - 1];
15051
- const el_child_first_content = el_child_first.querySelector(".ab-nodes-content");
15052
- const el_child_last_content = el_child_last.querySelector(".ab-nodes-content");
15053
- let height = 0;
15054
- let heightToReduce = (el_child_first.offsetHeight + el_child_last.offsetHeight) / 2;
15055
- if (els_child.length == 3) {
15056
- height = el_child_first_content.offsetHeight - 20 > 20 ? el_child_first_content.offsetHeight - 20 : 20;
15057
- el_bracket2.style.cssText = `
15058
- height: ${height}px;
15059
- top: calc(50% - ${height / 2}px);
15060
- `;
15061
- } else {
15062
- el_bracket2.style.cssText = `
15063
- height: calc(100% - ${heightToReduce}px);
15064
- top: ${el_child_first.offsetHeight / 2}px;
15065
- `;
15066
- }
15067
- if (Array.prototype.includes.call(els_min, children2)) {
15068
- if (els_child.length == 3) {
15069
- el_bracket.style.cssText = `
15070
- display: block;
15071
- top: calc(50% + ${el_content.offsetHeight / 2}px - 3px);
15072
- clip-path: circle(40% at 50% 40%);
15073
- `;
15074
- } else {
15075
- el_bracket.setAttribute("display", "none");
15076
- }
15077
- if (els_child.length == 3 && el_content.offsetHeight == el_child_first_content.offsetHeight) {
15078
- el_bracket2.style.cssText = `
15079
- height: 1px;
15080
- top: calc(50% + ${el_content.offsetHeight / 2}px - 1px);
15081
- width: 18px; /* 可以溢出点 */
15082
- border-radius: 0;
15083
- border: none;
15084
- border-bottom: 1px solid var(--node-color);
15085
- `;
15086
- } else {
15087
- if (els_child.length == 3) {
15088
- height = el_child_last_content.offsetHeight / 2 - el_content.offsetHeight / 2;
15089
- el_bracket2.style.setProperty("height", `${height}px`);
15090
- el_bracket2.style.setProperty("top", `calc(50% + ${el_content.offsetHeight / 2}px)`);
15091
- el_bracket2.style.setProperty("border-radius", `0 0 0 10px`);
15092
- el_bracket2.style.setProperty("border-top", `0`);
15093
- } else {
15094
- heightToReduce = el_child_first.offsetHeight / 2 + el_child_first_content.offsetHeight / 2 + el_child_last.offsetHeight / 2 - el_child_last_content.offsetHeight / 2;
15095
- el_bracket2.style.setProperty("height", `calc(100% - ${heightToReduce}px + 1px)`);
15096
- el_bracket2.style.setProperty("top", `${el_child_first.offsetHeight / 2 + el_child_first_content.offsetHeight / 2 - 1}px`);
15097
- }
15098
- el_bracket2.style.setProperty("width", "20px");
15099
- }
15100
- }
15101
- }
15102
- }
15103
- if (d.querySelector(".ab-items.ab-lay-vfall:not(.js-waterfall):not(.ab-lay-hfall):not(.ab-lay-grid)")) {
15104
- const root_el_list = d.querySelectorAll(".ab-items.ab-lay-vfall:not(.js-waterfall):not(.ab-lay-hfall):not(.ab-lay-grid)");
15105
- for (const root_el of root_el_list) {
15106
- root_el.classList.add("js-waterfall");
15107
- const list_children = root_el.querySelectorAll(".ab-items-item");
15108
- const columnCountTmp = parseInt(window.getComputedStyle(root_el).getPropertyValue("column-count"));
15109
- let columnCount;
15110
- if (columnCountTmp && !isNaN(columnCountTmp) && columnCountTmp > 0) {
15111
- columnCount = columnCountTmp;
15112
- } else if (root_el.classList.contains("ab-col-auto") && list_children.length <= 4) {
15113
- columnCount = list_children.length;
15114
- root_el.classList.add("ab-col" + columnCount);
15115
- } else {
15116
- columnCount = 4;
15117
- root_el.classList.add("ab-col" + columnCount);
15118
- }
15119
- const height_cache = [];
15120
- const el_cache = [];
15121
- for (let i = 0; i < columnCount; i++) {
15122
- height_cache.push(0);
15123
- el_cache.push([]);
15124
- }
15125
- for (const children2 of list_children) {
15126
- const minValue = Math.min.apply(null, height_cache);
15127
- const minIndex = height_cache.indexOf(minValue);
15128
- const heightTmp = parseInt(window.getComputedStyle(children2).getPropertyValue("height"));
15129
- height_cache[minIndex] += heightTmp && !isNaN(heightTmp) && heightTmp > 0 ? heightTmp : 10;
15130
- el_cache[minIndex].push(children2);
15131
- }
15132
- const fillNumber = columnCount - list_children.length % columnCount;
15133
- if (fillNumber != 4) {
15134
- for (let i = 0; i < fillNumber; i++) {
15135
- const children2 = document.createElement("div");
15136
- children2.classList.add(".ab-items-item.placeholder");
15137
- children2.setAttribute("style", "height: 20px");
15138
- const minValue = Math.min.apply(null, height_cache);
15139
- const minIndex = height_cache.indexOf(minValue);
15140
- height_cache[minIndex] += 20;
15141
- el_cache[minIndex].push(children2);
15142
- }
15143
- }
15144
- root_el.innerHTML = "";
15145
- for (let i = 0; i < columnCount; i++) {
15146
- for (const j of el_cache[i]) {
15147
- root_el.appendChild(j);
15148
- }
15149
- }
15150
- }
15151
- }
15152
- if (!isCycle && d.querySelector(".ab-markmap-div")) {
15153
- const divEl = d;
15154
- let markmapId = "";
15155
- if (divEl.tagName === "DIV") {
15156
- markmapId = divEl.querySelector(".ab-markmap-div")?.id || "";
15157
- }
15158
- let mindmaps;
15159
- if (markmapId) {
15160
- mindmaps = document.querySelectorAll("#" + markmapId);
15161
- } else {
15162
- mindmaps = document.querySelectorAll(".ab-markmap-div");
15163
- }
15164
- for (const el_div of mindmaps) {
15165
- const el_svg = el_div.querySelector("svg");
15166
- const el_g = el_svg?.querySelector("g");
15167
- if (el_svg && el_g) {
15168
- const scale_new = el_g.getBBox().height / el_div.offsetWidth;
15169
- el_svg.setAttribute("style", `height:${el_g.getBBox().height * scale_new + 40}px`);
15170
- markmap_event(d);
15171
- }
15172
- }
15173
- }
15174
- }
15175
- function markmap_event(d) {
15176
- if (d.querySelector(".ab-markmap-svg")) {
15177
- console.log(" - markmap_event");
15178
- let script_el = document.querySelector('script[script-id="ab-markmap-script"]');
15179
- if (script_el) script_el.remove();
15180
- const divEl = d;
15181
- let markmapId = "";
15182
- if (divEl.tagName === "DIV") {
15183
- markmapId = divEl.querySelector(".ab-markmap-svg")?.id || "";
15184
- }
15185
- script_el = document.createElement("script");
15186
- document.head.appendChild(script_el);
15187
- script_el.type = "module";
15188
- script_el.setAttribute("script-id", "ab-markmap-script");
15189
- script_el.textContent = `
15190
- import { Markmap, } from 'https://jspm.dev/markmap-view';
15191
- const markmapId = "${markmapId || ""}";
15192
- let mindmaps;
15193
- if (markmapId) {
15194
- mindmaps = document.querySelectorAll('#' + markmapId);
15195
- } else {
15196
- mindmaps = document.querySelectorAll('.ab-markmap-svg'); // 注意一下这里的选择器
15197
- }
15198
- for(const mindmap of mindmaps) {
15199
- mindmap.innerHTML = "";
15200
- Markmap.create(mindmap,null,JSON.parse(mindmap.getAttribute('data-json')));
15201
- }`;
15202
- }
15203
- }
15204
16242
  const testPath = "npm2url/dist/index.cjs";
15205
16243
  const defaultProviders = {
15206
16244
  jsdelivr: (path) => `https://cdn.jsdelivr.net/npm/${path}`,
@@ -40790,8 +41828,8 @@ var katex$1 = { exports: {} };
40790
41828
  var _functions = {};
40791
41829
  var _htmlGroupBuilders = {};
40792
41830
  var _mathmlGroupBuilders = {};
40793
- function defineFunction(_ref) {
40794
- var type = _ref.type, names = _ref.names, props = _ref.props, handler = _ref.handler, htmlBuilder = _ref.htmlBuilder, mathmlBuilder = _ref.mathmlBuilder;
41831
+ function defineFunction(_ref2) {
41832
+ var type = _ref2.type, names = _ref2.names, props = _ref2.props, handler = _ref2.handler, htmlBuilder = _ref2.htmlBuilder, mathmlBuilder = _ref2.mathmlBuilder;
40795
41833
  var data2 = {
40796
41834
  type,
40797
41835
  numArgs: props.numArgs,
@@ -41789,8 +42827,8 @@ var katex$1 = { exports: {} };
41789
42827
  props: {
41790
42828
  numArgs: 1
41791
42829
  },
41792
- handler: function handler(_ref, args) {
41793
- var parser = _ref.parser, funcName = _ref.funcName;
42830
+ handler: function handler(_ref2, args) {
42831
+ var parser = _ref2.parser, funcName = _ref2.funcName;
41794
42832
  var base = args[0];
41795
42833
  return {
41796
42834
  type: "accentUnder",
@@ -41865,8 +42903,8 @@ var katex$1 = { exports: {} };
41865
42903
  numArgs: 1,
41866
42904
  numOptionalArgs: 1
41867
42905
  },
41868
- handler: function handler(_ref, args, optArgs) {
41869
- var parser = _ref.parser, funcName = _ref.funcName;
42906
+ handler: function handler(_ref2, args, optArgs) {
42907
+ var parser = _ref2.parser, funcName = _ref2.funcName;
41870
42908
  return {
41871
42909
  type: "xArrow",
41872
42910
  mode: parser.mode,
@@ -41958,8 +42996,8 @@ var katex$1 = { exports: {} };
41958
42996
  numArgs: 1,
41959
42997
  allowedInText: true
41960
42998
  },
41961
- handler: function handler(_ref, args) {
41962
- var parser = _ref.parser;
42999
+ handler: function handler(_ref2, args) {
43000
+ var parser = _ref2.parser;
41963
43001
  var arg = assertNodeType(args[0], "ordgroup");
41964
43002
  var group = arg.body;
41965
43003
  var number = "";
@@ -41997,8 +43035,8 @@ var katex$1 = { exports: {} };
41997
43035
  greediness: 3,
41998
43036
  argTypes: ["color", "original"]
41999
43037
  },
42000
- handler: function handler(_ref, args) {
42001
- var parser = _ref.parser;
43038
+ handler: function handler(_ref2, args) {
43039
+ var parser = _ref2.parser;
42002
43040
  var color = assertNodeType(args[0], "color-token").color;
42003
43041
  var body = args[1];
42004
43042
  return {
@@ -42044,8 +43082,8 @@ var katex$1 = { exports: {} };
42044
43082
  argTypes: ["size"],
42045
43083
  allowedInText: true
42046
43084
  },
42047
- handler: function handler(_ref, args, optArgs) {
42048
- var parser = _ref.parser, funcName = _ref.funcName;
43085
+ handler: function handler(_ref2, args, optArgs) {
43086
+ var parser = _ref2.parser, funcName = _ref2.funcName;
42049
43087
  var size = optArgs[0];
42050
43088
  var newRow = funcName === "\\cr";
42051
43089
  var newLine = false;
@@ -42138,8 +43176,8 @@ var katex$1 = { exports: {} };
42138
43176
  numArgs: 0,
42139
43177
  allowedInText: true
42140
43178
  },
42141
- handler: function handler(_ref) {
42142
- var parser = _ref.parser, funcName = _ref.funcName;
43179
+ handler: function handler(_ref2) {
43180
+ var parser = _ref2.parser, funcName = _ref2.funcName;
42143
43181
  parser.consumeSpaces();
42144
43182
  var token = parser.fetch();
42145
43183
  if (globalMap[token.text]) {
@@ -42473,14 +43511,14 @@ var katex$1 = { exports: {} };
42473
43511
  var delimiter_sqrtSvg = function sqrtSvg(sqrtName, height, viewBoxHeight, extraViniculum, options) {
42474
43512
  var path = sqrtPath(sqrtName, extraViniculum, viewBoxHeight);
42475
43513
  var pathNode = new domTree_PathNode(sqrtName, path);
42476
- var svg = new SvgNode([pathNode], {
43514
+ var svg2 = new SvgNode([pathNode], {
42477
43515
  // Note: 1000:1 ratio of viewBox to document em width.
42478
43516
  "width": "400em",
42479
43517
  "height": height + "em",
42480
43518
  "viewBox": "0 0 400000 " + viewBoxHeight,
42481
43519
  "preserveAspectRatio": "xMinYMin slice"
42482
43520
  });
42483
- return buildCommon.makeSvgSpan(["hide-tail"], [svg], options);
43521
+ return buildCommon.makeSvgSpan(["hide-tail"], [svg2], options);
42484
43522
  };
42485
43523
  var makeSqrtImage = function makeSqrtImage2(height, options) {
42486
43524
  var newOptions = options.havingBaseSizing();
@@ -43090,8 +44128,8 @@ var katex$1 = { exports: {} };
43090
44128
  greediness: 3,
43091
44129
  argTypes: ["color", "text"]
43092
44130
  },
43093
- handler: function handler(_ref, args, optArgs) {
43094
- var parser = _ref.parser, funcName = _ref.funcName;
44131
+ handler: function handler(_ref2, args, optArgs) {
44132
+ var parser = _ref2.parser, funcName = _ref2.funcName;
43095
44133
  var color = assertNodeType(args[0], "color-token").color;
43096
44134
  var body = args[1];
43097
44135
  return {
@@ -43169,8 +44207,8 @@ var katex$1 = { exports: {} };
43169
44207
  mathmlBuilder: enclose_mathmlBuilder
43170
44208
  });
43171
44209
  var _environments = {};
43172
- function defineEnvironment(_ref) {
43173
- var type = _ref.type, names = _ref.names, props = _ref.props, handler = _ref.handler, htmlBuilder = _ref.htmlBuilder, mathmlBuilder = _ref.mathmlBuilder;
44210
+ function defineEnvironment(_ref2) {
44211
+ var type = _ref2.type, names = _ref2.names, props = _ref2.props, handler = _ref2.handler, htmlBuilder = _ref2.htmlBuilder, mathmlBuilder = _ref2.mathmlBuilder;
43174
44212
  var data2 = {
43175
44213
  type,
43176
44214
  numArgs: props.numArgs || 0,
@@ -43201,8 +44239,8 @@ var katex$1 = { exports: {} };
43201
44239
  }
43202
44240
  return hlineInfo;
43203
44241
  }
43204
- function parseArray(parser, _ref, style) {
43205
- var hskipBeforeAndAfter = _ref.hskipBeforeAndAfter, addJot = _ref.addJot, cols = _ref.cols, arraystretch = _ref.arraystretch, colSeparationType = _ref.colSeparationType;
44242
+ function parseArray(parser, _ref2, style) {
44243
+ var hskipBeforeAndAfter = _ref2.hskipBeforeAndAfter, addJot = _ref2.addJot, cols = _ref2.cols, arraystretch = _ref2.arraystretch, colSeparationType = _ref2.colSeparationType;
43206
44244
  parser.gullet.beginGroup();
43207
44245
  parser.gullet.macros.set("\\\\", "\\cr");
43208
44246
  if (!arraystretch) {
@@ -43841,8 +44879,8 @@ var katex$1 = { exports: {} };
43841
44879
  numArgs: 1,
43842
44880
  argTypes: ["text"]
43843
44881
  },
43844
- handler: function handler(_ref, args) {
43845
- var parser = _ref.parser, funcName = _ref.funcName;
44882
+ handler: function handler(_ref2, args) {
44883
+ var parser = _ref2.parser, funcName = _ref2.funcName;
43846
44884
  var nameGroup = args[0];
43847
44885
  if (nameGroup.type !== "ordgroup") {
43848
44886
  throw new src_ParseError("Invalid environment name", nameGroup);
@@ -43922,8 +44960,8 @@ var katex$1 = { exports: {} };
43922
44960
  props: {
43923
44961
  numArgs: 1
43924
44962
  },
43925
- handler: function handler(_ref, args) {
43926
- var parser = _ref.parser, funcName = _ref.funcName;
44963
+ handler: function handler(_ref2, args) {
44964
+ var parser = _ref2.parser, funcName = _ref2.funcName;
43927
44965
  var body = args[0];
43928
44966
  return {
43929
44967
  type: "mclass",
@@ -44046,8 +45084,8 @@ var katex$1 = { exports: {} };
44046
45084
  numArgs: 1,
44047
45085
  greediness: 2
44048
45086
  },
44049
- handler: function handler(_ref, args) {
44050
- var parser = _ref.parser, funcName = _ref.funcName;
45087
+ handler: function handler(_ref2, args) {
45088
+ var parser = _ref2.parser, funcName = _ref2.funcName;
44051
45089
  var body = args[0];
44052
45090
  var func = funcName;
44053
45091
  if (func in fontAliases) {
@@ -44301,8 +45339,8 @@ var katex$1 = { exports: {} };
44301
45339
  numArgs: 2,
44302
45340
  greediness: 2
44303
45341
  },
44304
- handler: function handler(_ref, args) {
44305
- var parser = _ref.parser, funcName = _ref.funcName;
45342
+ handler: function handler(_ref2, args) {
45343
+ var parser = _ref2.parser, funcName = _ref2.funcName;
44306
45344
  var numer = args[0];
44307
45345
  var denom = args[1];
44308
45346
  var hasBarLine;
@@ -44603,8 +45641,8 @@ var katex$1 = { exports: {} };
44603
45641
  props: {
44604
45642
  numArgs: 1
44605
45643
  },
44606
- handler: function handler(_ref, args) {
44607
- var parser = _ref.parser, funcName = _ref.funcName;
45644
+ handler: function handler(_ref2, args) {
45645
+ var parser = _ref2.parser, funcName = _ref2.funcName;
44608
45646
  return {
44609
45647
  type: "horizBrace",
44610
45648
  mode: parser.mode,
@@ -44624,8 +45662,8 @@ var katex$1 = { exports: {} };
44624
45662
  argTypes: ["url", "original"],
44625
45663
  allowedInText: true
44626
45664
  },
44627
- handler: function handler(_ref, args) {
44628
- var parser = _ref.parser;
45665
+ handler: function handler(_ref2, args) {
45666
+ var parser = _ref2.parser;
44629
45667
  var body = args[1];
44630
45668
  var href = assertNodeType(args[0], "url").url;
44631
45669
  if (!parser.settings.isTrusted({
@@ -44705,9 +45743,9 @@ var katex$1 = { exports: {} };
44705
45743
  argTypes: ["raw", "original"],
44706
45744
  allowedInText: true
44707
45745
  },
44708
- handler: function handler(_ref, args) {
44709
- var parser = _ref.parser, funcName = _ref.funcName;
44710
- _ref.token;
45746
+ handler: function handler(_ref2, args) {
45747
+ var parser = _ref2.parser, funcName = _ref2.funcName;
45748
+ _ref2.token;
44711
45749
  var value = assertNodeType(args[0], "raw").string;
44712
45750
  var body = args[1];
44713
45751
  if (parser.settings.strict) {
@@ -44790,8 +45828,8 @@ var katex$1 = { exports: {} };
44790
45828
  numArgs: 2,
44791
45829
  allowedInText: true
44792
45830
  },
44793
- handler: function handler(_ref, args) {
44794
- var parser = _ref.parser;
45831
+ handler: function handler(_ref2, args) {
45832
+ var parser = _ref2.parser;
44795
45833
  return {
44796
45834
  type: "htmlmathml",
44797
45835
  mode: parser.mode,
@@ -44838,8 +45876,8 @@ var katex$1 = { exports: {} };
44838
45876
  argTypes: ["raw", "url"],
44839
45877
  allowedInText: false
44840
45878
  },
44841
- handler: function handler(_ref, args, optArgs) {
44842
- var parser = _ref.parser;
45879
+ handler: function handler(_ref2, args, optArgs) {
45880
+ var parser = _ref2.parser;
44843
45881
  var width = {
44844
45882
  number: 0,
44845
45883
  unit: "em"
@@ -44953,8 +45991,8 @@ var katex$1 = { exports: {} };
44953
45991
  argTypes: ["size"],
44954
45992
  allowedInText: true
44955
45993
  },
44956
- handler: function handler(_ref, args) {
44957
- var parser = _ref.parser, funcName = _ref.funcName;
45994
+ handler: function handler(_ref2, args) {
45995
+ var parser = _ref2.parser, funcName = _ref2.funcName;
44958
45996
  var size = assertNodeType(args[0], "size");
44959
45997
  if (parser.settings.strict) {
44960
45998
  var mathFunction = funcName[1] === "m";
@@ -44993,8 +46031,8 @@ var katex$1 = { exports: {} };
44993
46031
  numArgs: 1,
44994
46032
  allowedInText: true
44995
46033
  },
44996
- handler: function handler(_ref, args) {
44997
- var parser = _ref.parser, funcName = _ref.funcName;
46034
+ handler: function handler(_ref2, args) {
46035
+ var parser = _ref2.parser, funcName = _ref2.funcName;
44998
46036
  var body = args[0];
44999
46037
  return {
45000
46038
  type: "lap",
@@ -45038,8 +46076,8 @@ var katex$1 = { exports: {} };
45038
46076
  allowedInText: true,
45039
46077
  allowedInMath: false
45040
46078
  },
45041
- handler: function handler(_ref, args) {
45042
- var funcName = _ref.funcName, parser = _ref.parser;
46079
+ handler: function handler(_ref2, args) {
46080
+ var funcName = _ref2.funcName, parser = _ref2.parser;
45043
46081
  var outerMode = parser.mode;
45044
46082
  parser.switchMode("math");
45045
46083
  var close = funcName === "\\(" ? "\\)" : "$";
@@ -45087,8 +46125,8 @@ var katex$1 = { exports: {} };
45087
46125
  props: {
45088
46126
  numArgs: 4
45089
46127
  },
45090
- handler: function handler(_ref, args) {
45091
- var parser = _ref.parser;
46128
+ handler: function handler(_ref2, args) {
46129
+ var parser = _ref2.parser;
45092
46130
  return {
45093
46131
  type: "mathchoice",
45094
46132
  mode: parser.mode,
@@ -45320,8 +46358,8 @@ var katex$1 = { exports: {} };
45320
46358
  props: {
45321
46359
  numArgs: 0
45322
46360
  },
45323
- handler: function handler(_ref, args) {
45324
- var parser = _ref.parser, funcName = _ref.funcName;
46361
+ handler: function handler(_ref2, args) {
46362
+ var parser = _ref2.parser, funcName = _ref2.funcName;
45325
46363
  var fName = funcName;
45326
46364
  if (fName.length === 1) {
45327
46365
  fName = singleCharBigOps[fName];
@@ -45526,8 +46564,8 @@ var katex$1 = { exports: {} };
45526
46564
  props: {
45527
46565
  numArgs: 1
45528
46566
  },
45529
- handler: function handler(_ref, args) {
45530
- var parser = _ref.parser, funcName = _ref.funcName;
46567
+ handler: function handler(_ref2, args) {
46568
+ var parser = _ref2.parser, funcName = _ref2.funcName;
45531
46569
  var body = args[0];
45532
46570
  return {
45533
46571
  type: "operatorname",
@@ -45559,8 +46597,8 @@ var katex$1 = { exports: {} };
45559
46597
  props: {
45560
46598
  numArgs: 1
45561
46599
  },
45562
- handler: function handler(_ref, args) {
45563
- var parser = _ref.parser;
46600
+ handler: function handler(_ref2, args) {
46601
+ var parser = _ref2.parser;
45564
46602
  var body = args[0];
45565
46603
  return {
45566
46604
  type: "overline",
@@ -45605,8 +46643,8 @@ var katex$1 = { exports: {} };
45605
46643
  numArgs: 1,
45606
46644
  allowedInText: true
45607
46645
  },
45608
- handler: function handler(_ref, args) {
45609
- var parser = _ref.parser;
46646
+ handler: function handler(_ref2, args) {
46647
+ var parser = _ref2.parser;
45610
46648
  var body = args[0];
45611
46649
  return {
45612
46650
  type: "phantom",
@@ -45704,8 +46742,8 @@ var katex$1 = { exports: {} };
45704
46742
  argTypes: ["size", "hbox"],
45705
46743
  allowedInText: true
45706
46744
  },
45707
- handler: function handler(_ref, args) {
45708
- var parser = _ref.parser;
46745
+ handler: function handler(_ref2, args) {
46746
+ var parser = _ref2.parser;
45709
46747
  var amount = assertNodeType(args[0], "size").value;
45710
46748
  var body = args[1];
45711
46749
  return {
@@ -45742,8 +46780,8 @@ var katex$1 = { exports: {} };
45742
46780
  numOptionalArgs: 1,
45743
46781
  argTypes: ["size", "size", "size"]
45744
46782
  },
45745
- handler: function handler(_ref, args, optArgs) {
45746
- var parser = _ref.parser;
46783
+ handler: function handler(_ref2, args, optArgs) {
46784
+ var parser = _ref2.parser;
45747
46785
  var shift = optArgs[0];
45748
46786
  var width = assertNodeType(args[0], "size");
45749
46787
  var height = assertNodeType(args[1], "size");
@@ -45816,8 +46854,8 @@ var katex$1 = { exports: {} };
45816
46854
  numArgs: 0,
45817
46855
  allowedInText: true
45818
46856
  },
45819
- handler: function handler(_ref, args) {
45820
- var breakOnTokenText = _ref.breakOnTokenText, funcName = _ref.funcName, parser = _ref.parser;
46857
+ handler: function handler(_ref2, args) {
46858
+ var breakOnTokenText = _ref2.breakOnTokenText, funcName = _ref2.funcName, parser = _ref2.parser;
45821
46859
  var body = parser.parseExpression(false, breakOnTokenText);
45822
46860
  return {
45823
46861
  type: "sizing",
@@ -45844,8 +46882,8 @@ var katex$1 = { exports: {} };
45844
46882
  numOptionalArgs: 1,
45845
46883
  allowedInText: true
45846
46884
  },
45847
- handler: function handler(_ref, args, optArgs) {
45848
- var parser = _ref.parser;
46885
+ handler: function handler(_ref2, args, optArgs) {
46886
+ var parser = _ref2.parser;
45849
46887
  var smashHeight = false;
45850
46888
  var smashDepth = false;
45851
46889
  var tbArg = optArgs[0] && assertNodeType(optArgs[0], "ordgroup");
@@ -45925,8 +46963,8 @@ var katex$1 = { exports: {} };
45925
46963
  numArgs: 1,
45926
46964
  numOptionalArgs: 1
45927
46965
  },
45928
- handler: function handler(_ref, args, optArgs) {
45929
- var parser = _ref.parser;
46966
+ handler: function handler(_ref2, args, optArgs) {
46967
+ var parser = _ref2.parser;
45930
46968
  var index2 = optArgs[0];
45931
46969
  var body = args[0];
45932
46970
  return {
@@ -46010,8 +47048,8 @@ var katex$1 = { exports: {} };
46010
47048
  numArgs: 0,
46011
47049
  allowedInText: true
46012
47050
  },
46013
- handler: function handler(_ref, args) {
46014
- var breakOnTokenText = _ref.breakOnTokenText, funcName = _ref.funcName, parser = _ref.parser;
47051
+ handler: function handler(_ref2, args) {
47052
+ var breakOnTokenText = _ref2.breakOnTokenText, funcName = _ref2.funcName, parser = _ref2.parser;
46015
47053
  var body = parser.parseExpression(true, breakOnTokenText);
46016
47054
  var style = funcName.slice(1, funcName.length - 5);
46017
47055
  return {
@@ -46396,8 +47434,8 @@ var katex$1 = { exports: {} };
46396
47434
  greediness: 2,
46397
47435
  allowedInText: true
46398
47436
  },
46399
- handler: function handler(_ref, args) {
46400
- var parser = _ref.parser, funcName = _ref.funcName;
47437
+ handler: function handler(_ref2, args) {
47438
+ var parser = _ref2.parser, funcName = _ref2.funcName;
46401
47439
  var body = args[0];
46402
47440
  return {
46403
47441
  type: "text",
@@ -46423,8 +47461,8 @@ var katex$1 = { exports: {} };
46423
47461
  numArgs: 1,
46424
47462
  allowedInText: true
46425
47463
  },
46426
- handler: function handler(_ref, args) {
46427
- var parser = _ref.parser;
47464
+ handler: function handler(_ref2, args) {
47465
+ var parser = _ref2.parser;
46428
47466
  return {
46429
47467
  type: "underline",
46430
47468
  mode: parser.mode,
@@ -49285,7 +50323,7 @@ ABConvert.factory({
49285
50323
  process_return: ABConvert_IOEnum.el,
49286
50324
  process: (el, header, content) => {
49287
50325
  list2markmap(content, el);
49288
- markmap_event(el);
50326
+ ABCSetting.obsidian.markmap_event?.(el);
49289
50327
  return el;
49290
50328
  }
49291
50329
  });
@@ -49301,13 +50339,46 @@ function list2markmap(markdown, div) {
49301
50339
  svg_div.classList.add("ab-markmap-div");
49302
50340
  svg_div.id = "ab-markmap-div-" + id;
49303
50341
  const html_str = `<svg class="ab-markmap-svg" id="ab-markmap-${id}" data-json='${JSON.stringify(root2)}' style="height:${height_adapt}px"></svg>`;
49304
- svg_div.innerHTML = html_str;
50342
+ svg_div.innerHTML = purify.sanitize(html_str, {
50343
+ USE_PROFILES: { svg: true }
50344
+ });
49305
50345
  } else {
49306
50346
  div.classList.add("ab-raw");
49307
- div.innerHTML = `<div class="ab-raw-data" type-data="markmap" content-data='${markdown}'></div>`;
50347
+ div.innerHTML = purify.sanitize(`<div class="ab-raw-data" type-data="markmap" content-data='${markdown}'></div>`);
49308
50348
  }
49309
50349
  return div;
49310
50350
  }
50351
+ async function markmap_event(d) {
50352
+ if (ABCSetting.env == "obsidian-min") return;
50353
+ if (d.querySelector(".ab-markmap-svg")) {
50354
+ console.log(" - markmap_event");
50355
+ let script_el = document.querySelector('script[script-id="ab-markmap-script"]');
50356
+ if (script_el) script_el.remove();
50357
+ const divEl = d;
50358
+ let markmapId = "";
50359
+ if (divEl.tagName === "DIV") {
50360
+ markmapId = divEl.querySelector(".ab-markmap-svg")?.id || "";
50361
+ }
50362
+ script_el = document.createElement("script");
50363
+ document.head.appendChild(script_el);
50364
+ script_el.type = "module";
50365
+ script_el.setAttribute("script-id", "ab-markmap-script");
50366
+ script_el.textContent = `
50367
+ import { Markmap, } from 'https://jspm.dev/markmap-view';
50368
+ const markmapId = "${markmapId || ""}";
50369
+ let mindmaps;
50370
+ if (markmapId) {
50371
+ mindmaps = document.querySelectorAll('#' + markmapId);
50372
+ } else {
50373
+ mindmaps = document.querySelectorAll('.ab-markmap-svg'); // 注意一下这里的选择器
50374
+ }
50375
+ for(const mindmap of mindmaps) {
50376
+ mindmap.innerHTML = "";
50377
+ Markmap.create(mindmap,null,JSON.parse(mindmap.getAttribute('data-json')));
50378
+ }`;
50379
+ }
50380
+ }
50381
+ ABCSetting.obsidian.markmap_event = markmap_event;
49311
50382
  const jsdom_api = {
49312
50383
  jsdom_enable: () => {
49313
50384
  },
@@ -49578,6 +50649,166 @@ function ab_mdit_client(md, options) {
49578
50649
  md.use(abSelector_squareInline);
49579
50650
  md.use(abSelector_container);
49580
50651
  }
50652
+ function abConvertEvent(d, isCycle = false) {
50653
+ if (d.querySelector(".ab-super-width")) {
50654
+ const els_note = d.querySelectorAll(".ab-note");
50655
+ for (const el_note of els_note) {
50656
+ if (el_note.classList.contains("ab-super-width") || el_note.querySelector(".ab-super-width")) {
50657
+ const el_replace = el_note.parentNode;
50658
+ if (el_replace && el_replace.classList.contains("ab-replace")) {
50659
+ el_replace.classList.add("ab-super-width-p");
50660
+ }
50661
+ }
50662
+ }
50663
+ const els_view = document.querySelectorAll(".app-container .workspace-leaf");
50664
+ for (const el_view of els_view) {
50665
+ el_view.style.setProperty("--ab-width-outer", (el_view.offsetWidth - 40).toString() + "px");
50666
+ }
50667
+ }
50668
+ if (d.querySelector(".ab-nodes-node")) {
50669
+ const els_min = document.querySelectorAll(".ab-nodes.min .ab-nodes-node");
50670
+ const list_children = d.querySelectorAll(".ab-nodes-node");
50671
+ for (const children2 of list_children) {
50672
+ const el_content = children2.querySelector(".ab-nodes-content");
50673
+ if (!el_content) continue;
50674
+ const el_child = children2.querySelector(".ab-nodes-children");
50675
+ if (!el_child) continue;
50676
+ const el_bracket = el_child.querySelector(".ab-nodes-bracket");
50677
+ if (!el_bracket) continue;
50678
+ const el_bracket2 = el_child.querySelector(".ab-nodes-bracket2");
50679
+ if (!el_bracket2) continue;
50680
+ const els_child = el_child.childNodes;
50681
+ if (els_child.length < 3) {
50682
+ el_bracket.style.setProperty("display", "none");
50683
+ el_bracket2.style.setProperty("display", "none");
50684
+ continue;
50685
+ }
50686
+ const el_child_first = els_child[2];
50687
+ const el_child_last = els_child[els_child.length - 1];
50688
+ const el_child_first_content = el_child_first.querySelector(".ab-nodes-content");
50689
+ const el_child_last_content = el_child_last.querySelector(".ab-nodes-content");
50690
+ let height = 0;
50691
+ let heightToReduce = (el_child_first.offsetHeight + el_child_last.offsetHeight) / 2;
50692
+ if (els_child.length == 3) {
50693
+ height = el_child_first_content.offsetHeight - 20 > 20 ? el_child_first_content.offsetHeight - 20 : 20;
50694
+ el_bracket2.style.cssText = `
50695
+ height: ${height}px;
50696
+ top: calc(50% - ${height / 2}px);
50697
+ `;
50698
+ } else {
50699
+ el_bracket2.style.cssText = `
50700
+ height: calc(100% - ${heightToReduce}px);
50701
+ top: ${el_child_first.offsetHeight / 2}px;
50702
+ `;
50703
+ }
50704
+ if (Array.prototype.includes.call(els_min, children2)) {
50705
+ if (els_child.length == 3) {
50706
+ el_bracket.style.cssText = `
50707
+ display: block;
50708
+ top: calc(50% + ${el_content.offsetHeight / 2}px - 3px);
50709
+ clip-path: circle(40% at 50% 40%);
50710
+ `;
50711
+ } else {
50712
+ el_bracket.setAttribute("display", "none");
50713
+ }
50714
+ if (els_child.length == 3 && el_content.offsetHeight == el_child_first_content.offsetHeight) {
50715
+ el_bracket2.style.cssText = `
50716
+ height: 1px;
50717
+ top: calc(50% + ${el_content.offsetHeight / 2}px - 1px);
50718
+ width: 18px; /* 可以溢出点 */
50719
+ border-radius: 0;
50720
+ border: none;
50721
+ border-bottom: 1px solid var(--node-color);
50722
+ `;
50723
+ } else {
50724
+ if (els_child.length == 3) {
50725
+ height = el_child_last_content.offsetHeight / 2 - el_content.offsetHeight / 2;
50726
+ el_bracket2.style.setProperty("height", `${height}px`);
50727
+ el_bracket2.style.setProperty("top", `calc(50% + ${el_content.offsetHeight / 2}px)`);
50728
+ el_bracket2.style.setProperty("border-radius", `0 0 0 10px`);
50729
+ el_bracket2.style.setProperty("border-top", `0`);
50730
+ } else {
50731
+ heightToReduce = el_child_first.offsetHeight / 2 + el_child_first_content.offsetHeight / 2 + el_child_last.offsetHeight / 2 - el_child_last_content.offsetHeight / 2;
50732
+ el_bracket2.style.setProperty("height", `calc(100% - ${heightToReduce}px + 1px)`);
50733
+ el_bracket2.style.setProperty("top", `${el_child_first.offsetHeight / 2 + el_child_first_content.offsetHeight / 2 - 1}px`);
50734
+ }
50735
+ el_bracket2.style.setProperty("width", "20px");
50736
+ }
50737
+ }
50738
+ }
50739
+ }
50740
+ if (d.querySelector(".ab-items.ab-lay-vfall:not(.js-waterfall):not(.ab-lay-hfall):not(.ab-lay-grid)")) {
50741
+ const root_el_list = d.querySelectorAll(".ab-items.ab-lay-vfall:not(.js-waterfall):not(.ab-lay-hfall):not(.ab-lay-grid)");
50742
+ for (const root_el of root_el_list) {
50743
+ root_el.classList.add("js-waterfall");
50744
+ const list_children = root_el.querySelectorAll(".ab-items-item");
50745
+ const columnCountTmp = parseInt(window.getComputedStyle(root_el).getPropertyValue("column-count"));
50746
+ let columnCount;
50747
+ if (columnCountTmp && !isNaN(columnCountTmp) && columnCountTmp > 0) {
50748
+ columnCount = columnCountTmp;
50749
+ } else if (root_el.classList.contains("ab-col-auto") && list_children.length <= 4) {
50750
+ columnCount = list_children.length;
50751
+ root_el.classList.add("ab-col" + columnCount);
50752
+ } else {
50753
+ columnCount = 4;
50754
+ root_el.classList.add("ab-col" + columnCount);
50755
+ }
50756
+ const height_cache = [];
50757
+ const el_cache = [];
50758
+ for (let i = 0; i < columnCount; i++) {
50759
+ height_cache.push(0);
50760
+ el_cache.push([]);
50761
+ }
50762
+ for (const children2 of list_children) {
50763
+ const minValue = Math.min.apply(null, height_cache);
50764
+ const minIndex = height_cache.indexOf(minValue);
50765
+ const heightTmp = parseInt(window.getComputedStyle(children2).getPropertyValue("height"));
50766
+ height_cache[minIndex] += heightTmp && !isNaN(heightTmp) && heightTmp > 0 ? heightTmp : 10;
50767
+ el_cache[minIndex].push(children2);
50768
+ }
50769
+ const fillNumber = columnCount - list_children.length % columnCount;
50770
+ if (fillNumber != 4) {
50771
+ for (let i = 0; i < fillNumber; i++) {
50772
+ const children2 = document.createElement("div");
50773
+ children2.classList.add(".ab-items-item.placeholder");
50774
+ children2.setAttribute("style", "height: 20px");
50775
+ const minValue = Math.min.apply(null, height_cache);
50776
+ const minIndex = height_cache.indexOf(minValue);
50777
+ height_cache[minIndex] += 20;
50778
+ el_cache[minIndex].push(children2);
50779
+ }
50780
+ }
50781
+ root_el.innerHTML = "";
50782
+ for (let i = 0; i < columnCount; i++) {
50783
+ for (const j of el_cache[i]) {
50784
+ root_el.appendChild(j);
50785
+ }
50786
+ }
50787
+ }
50788
+ }
50789
+ if (!isCycle && d.querySelector(".ab-markmap-div")) {
50790
+ const divEl = d;
50791
+ let markmapId = "";
50792
+ if (divEl.tagName === "DIV") {
50793
+ markmapId = divEl.querySelector(".ab-markmap-div")?.id || "";
50794
+ }
50795
+ let mindmaps;
50796
+ if (markmapId) {
50797
+ mindmaps = document.querySelectorAll("#" + markmapId);
50798
+ } else {
50799
+ mindmaps = document.querySelectorAll(".ab-markmap-div");
50800
+ }
50801
+ for (const el_div of mindmaps) {
50802
+ const el_svg = el_div.querySelector("svg");
50803
+ const el_g = el_svg?.querySelector("g");
50804
+ if (el_svg && el_g) {
50805
+ const scale_new = el_g.getBBox().height / el_div.offsetWidth;
50806
+ el_svg.setAttribute("style", `height:${el_g.getBBox().height * scale_new + 40}px`);
50807
+ ABCSetting.obsidian.markmap_event?.(d);
50808
+ }
50809
+ }
50810
+ }
50811
+ }
49581
50812
  export {
49582
50813
  ABReg as A,
49583
50814
  ab_mdit as a,
@@ -49586,4 +50817,4 @@ export {
49586
50817
  ABConvertManager as d,
49587
50818
  jsdom_api as j
49588
50819
  };
49589
- //# sourceMappingURL=index_mdit-DeveGzkz.js.map
50820
+ //# sourceMappingURL=ABConvertEvent-CSIDczUT.js.map