@aleph-alpha/chat-kit 1.0.0 → 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (133) hide show
  1. package/dist/{CkInput.vue_vue_type_script_setup_true_lang-744ZHsQU.js → CkInput.vue_vue_type_script_setup_true_lang-CRymGkQs.js} +24 -69
  2. package/dist/components/base/CkHistoryItem/CkHistoryItem.vue.d.ts +3 -4
  3. package/dist/components/base/CkHistoryItem/CkHistoryItem.vue.d.ts.map +1 -1
  4. package/dist/components/base/CkHistoryItem/types.d.ts +3 -2
  5. package/dist/components/base/CkHistoryItem/types.d.ts.map +1 -1
  6. package/dist/components/base/CkPromptStopButton/CkPromptStopButton.vue.d.ts.map +1 -1
  7. package/dist/components/index.js +1 -1
  8. package/dist/composables/index.d.ts +2 -0
  9. package/dist/composables/index.d.ts.map +1 -1
  10. package/dist/composables/index.js +3 -2
  11. package/dist/composables/useConversationSessions.d.ts +29 -0
  12. package/dist/composables/useConversationSessions.d.ts.map +1 -0
  13. package/dist/handlers/index.js +2 -2
  14. package/dist/index.d.ts +2 -2
  15. package/dist/index.d.ts.map +1 -1
  16. package/dist/index.js +7 -6
  17. package/dist/purify.es-md74IFlY.js +1081 -0
  18. package/dist/{useChatKitLabels-Dvi2FmjE.js → useChatKitLabels-BmWmMyqX.js} +75 -1152
  19. package/dist/{useConversations-Ca242D2P.js → useConversationSessions-ulFhtpQr.js} +50 -2
  20. package/dist/{useMessageHandler-uLHNac39.js → useMessageHandler-BmBdu2EW.js} +4 -1
  21. package/package.json +5 -5
  22. package/src/components/base/CkAgentMessage/CkAgentMessage.spec.ts +91 -0
  23. package/src/components/base/CkAgentMessage/CkAgentMessage.stories.ts +215 -0
  24. package/src/components/base/CkAgentMessage/CkAgentMessage.vue +25 -0
  25. package/src/components/base/CkAgentMessage/index.ts +2 -0
  26. package/src/components/base/CkAgentMessage/types.ts +11 -0
  27. package/src/components/base/CkConversationLayout/CkConversationLayout.spec.ts +129 -0
  28. package/src/components/base/CkConversationLayout/CkConversationLayout.stories.ts +251 -0
  29. package/src/components/base/CkConversationLayout/CkConversationLayout.vue +206 -0
  30. package/src/components/base/CkConversationLayout/index.ts +2 -0
  31. package/src/components/base/CkConversationLayout/types.ts +18 -0
  32. package/src/components/base/CkCopyMessageActionButton/CkCopyMessageActionButton.spec.ts +89 -0
  33. package/src/components/base/CkCopyMessageActionButton/CkCopyMessageActionButton.stories.ts +70 -0
  34. package/src/components/base/CkCopyMessageActionButton/CkCopyMessageActionButton.vue +110 -0
  35. package/src/components/base/CkCopyMessageActionButton/index.ts +2 -0
  36. package/src/components/base/CkCopyMessageActionButton/types.ts +43 -0
  37. package/src/components/base/CkHistoryItem/CkHistoryItem.spec.ts +42 -0
  38. package/src/components/base/CkHistoryItem/CkHistoryItem.stories.ts +230 -0
  39. package/src/components/base/CkHistoryItem/CkHistoryItem.vue +285 -0
  40. package/src/components/base/CkHistoryItem/activeIndicator.ts +15 -0
  41. package/src/components/base/CkHistoryItem/index.ts +2 -0
  42. package/src/components/base/CkHistoryItem/types.ts +111 -0
  43. package/src/components/base/CkHistoryWrapper/CkHistoryWrapper.spec.ts +26 -0
  44. package/src/components/base/CkHistoryWrapper/CkHistoryWrapper.stories.ts +149 -0
  45. package/src/components/base/CkHistoryWrapper/CkHistoryWrapper.vue +36 -0
  46. package/src/components/base/CkHistoryWrapper/index.ts +2 -0
  47. package/src/components/base/CkHistoryWrapper/types.ts +16 -0
  48. package/src/components/base/CkMarkdownRenderer/CkMarkdownRenderer.spec.ts +348 -0
  49. package/src/components/base/CkMarkdownRenderer/CkMarkdownRenderer.stories.ts +382 -0
  50. package/src/components/base/CkMarkdownRenderer/CkMarkdownRenderer.vue +89 -0
  51. package/src/components/base/CkMarkdownRenderer/defaultMarkdownClasses.ts +19 -0
  52. package/src/components/base/CkMarkdownRenderer/index.ts +5 -0
  53. package/src/components/base/CkMarkdownRenderer/types.ts +53 -0
  54. package/src/components/base/CkMessageActionButton/CkMessageActionButton.spec.ts +40 -0
  55. package/src/components/base/CkMessageActionButton/CkMessageActionButton.stories.ts +56 -0
  56. package/src/components/base/CkMessageActionButton/CkMessageActionButton.vue +23 -0
  57. package/src/components/base/CkMessageActionButton/index.ts +2 -0
  58. package/src/components/base/CkMessageActionButton/types.ts +21 -0
  59. package/src/components/base/CkPromptActionButton/CkPromptActionButton.spec.ts +52 -0
  60. package/src/components/base/CkPromptActionButton/CkPromptActionButton.stories.ts +126 -0
  61. package/src/components/base/CkPromptActionButton/CkPromptActionButton.vue +25 -0
  62. package/src/components/base/CkPromptActionButton/index.ts +2 -0
  63. package/src/components/base/CkPromptActionButton/types.ts +32 -0
  64. package/src/components/base/CkPromptInput/CkPromptInput.spec.ts +181 -0
  65. package/src/components/base/CkPromptInput/CkPromptInput.stories.ts +224 -0
  66. package/src/components/base/CkPromptInput/CkPromptInput.vue +104 -0
  67. package/src/components/base/CkPromptInput/index.ts +2 -0
  68. package/src/components/base/CkPromptInput/types.ts +39 -0
  69. package/src/components/base/CkPromptInputDisclaimer/CkPromptInputDisclaimer.spec.ts +40 -0
  70. package/src/components/base/CkPromptInputDisclaimer/CkPromptInputDisclaimer.stories.ts +103 -0
  71. package/src/components/base/CkPromptInputDisclaimer/CkPromptInputDisclaimer.vue +16 -0
  72. package/src/components/base/CkPromptInputDisclaimer/index.ts +2 -0
  73. package/src/components/base/CkPromptInputDisclaimer/types.ts +17 -0
  74. package/src/components/base/CkPromptStopButton/CkPromptStopButton.spec.ts +64 -0
  75. package/src/components/base/CkPromptStopButton/CkPromptStopButton.stories.ts +81 -0
  76. package/src/components/base/CkPromptStopButton/CkPromptStopButton.vue +27 -0
  77. package/src/components/base/CkPromptStopButton/index.ts +2 -0
  78. package/src/components/base/CkPromptStopButton/types.ts +28 -0
  79. package/src/components/base/CkUserMessage/CkUserMessage.spec.ts +20 -0
  80. package/src/components/base/CkUserMessage/CkUserMessage.stories.ts +112 -0
  81. package/src/components/base/CkUserMessage/CkUserMessage.vue +19 -0
  82. package/src/components/base/CkUserMessage/index.ts +2 -0
  83. package/src/components/base/CkUserMessage/types.ts +14 -0
  84. package/src/components/base/icons/CkSendIcon.vue +22 -0
  85. package/src/components/base/icons/CkStopIcon.vue +18 -0
  86. package/src/components/base/icons/index.ts +2 -0
  87. package/src/components/base/index.ts +21 -0
  88. package/src/components/composed/CkConversation/CkConversation.spec.ts +439 -0
  89. package/src/components/composed/CkConversation/CkConversation.stories.ts +642 -0
  90. package/src/components/composed/CkConversation/CkConversation.vue +146 -0
  91. package/src/components/composed/CkConversation/index.ts +2 -0
  92. package/src/components/composed/CkConversation/types.ts +37 -0
  93. package/src/components/composed/CkHistory/CkHistory.spec.ts +327 -0
  94. package/src/components/composed/CkHistory/CkHistory.stories.ts +373 -0
  95. package/src/components/composed/CkHistory/CkHistory.vue +126 -0
  96. package/src/components/composed/CkHistory/index.ts +2 -0
  97. package/src/components/composed/CkHistory/types.ts +72 -0
  98. package/src/components/composed/CkInput/CkInput.spec.ts +191 -0
  99. package/src/components/composed/CkInput/CkInput.stories.ts +438 -0
  100. package/src/components/composed/CkInput/CkInput.vue +104 -0
  101. package/src/components/composed/CkInput/index.ts +2 -0
  102. package/src/components/composed/CkInput/types.ts +60 -0
  103. package/src/components/composed/index.ts +5 -0
  104. package/src/components/index.ts +34 -0
  105. package/src/composables/index.ts +15 -0
  106. package/src/composables/types.ts +36 -0
  107. package/src/composables/useChat.ts +18 -0
  108. package/src/composables/useConversationSessions.spec.ts +86 -0
  109. package/src/composables/useConversationSessions.ts +85 -0
  110. package/src/composables/useConversations.spec.ts +557 -0
  111. package/src/composables/useConversations.ts +321 -0
  112. package/src/handlers/index.ts +9 -0
  113. package/src/handlers/useChatKitLabels.spec.ts +290 -0
  114. package/src/handlers/useChatKitLabels.ts +96 -0
  115. package/src/handlers/useMarkdownParser.spec.ts +112 -0
  116. package/src/handlers/useMarkdownParser.ts +47 -0
  117. package/src/handlers/useMessageHandler.spec.ts +535 -0
  118. package/src/handlers/useMessageHandler.ts +138 -0
  119. package/src/helpers/conversationTree.spec.ts +423 -0
  120. package/src/helpers/conversationTree.ts +117 -0
  121. package/src/helpers/generateId.ts +5 -0
  122. package/src/helpers/index.ts +4 -0
  123. package/src/helpers/secondsToDate.ts +7 -0
  124. package/src/helpers/toError.ts +8 -0
  125. package/src/index.ts +86 -0
  126. package/src/services/ChatService.ts +60 -0
  127. package/src/services/MockChatService.ts +47 -0
  128. package/src/services/index.ts +12 -0
  129. package/src/services/types.ts +92 -0
  130. package/src/test-setup.ts +12 -0
  131. package/src/test-utils/createTextPlugin.ts +9 -0
  132. package/src/types.ts +47 -0
  133. package/dist/generateId-BHf0W4Rq.js +0 -6
@@ -1,4 +1,5 @@
1
1
  import { computed, toValue, inject, provide } from "vue";
2
+ import { p as purify } from "./purify.es-md74IFlY.js";
2
3
  function bail(error) {
3
4
  if (error) {
4
5
  throw error;
@@ -59,7 +60,7 @@ function requireExtend() {
59
60
  return obj[name];
60
61
  };
61
62
  extend$1 = function extend2() {
62
- var options, name, src, copy, copyIsArray, clone2;
63
+ var options, name, src, copy, copyIsArray, clone;
63
64
  var target = arguments[0];
64
65
  var i = 1;
65
66
  var length = arguments.length;
@@ -82,11 +83,11 @@ function requireExtend() {
82
83
  if (deep && copy && (isPlainObject2(copy) || (copyIsArray = isArray(copy)))) {
83
84
  if (copyIsArray) {
84
85
  copyIsArray = false;
85
- clone2 = src && isArray(src) ? src : [];
86
+ clone = src && isArray(src) ? src : [];
86
87
  } else {
87
- clone2 = src && isPlainObject2(src) ? src : {};
88
+ clone = src && isPlainObject2(src) ? src : {};
88
89
  }
89
- setProperty(target, { name, newValue: extend2(deep, clone2, copy) });
90
+ setProperty(target, { name, newValue: extend2(deep, clone, copy) });
90
91
  } else if (typeof copy !== "undefined") {
91
92
  setProperty(target, { name, newValue: copy });
92
93
  }
@@ -1085,11 +1086,11 @@ const CallableInstance = (
1085
1086
  constr.prototype
1086
1087
  );
1087
1088
  const value = proto[property];
1088
- const apply2 = function() {
1089
- return value.apply(apply2, arguments);
1089
+ const apply = function() {
1090
+ return value.apply(apply, arguments);
1090
1091
  };
1091
- Object.setPrototypeOf(apply2, proto);
1092
- return apply2;
1092
+ Object.setPrototypeOf(apply, proto);
1093
+ return apply;
1093
1094
  })
1094
1095
  );
1095
1096
  const own$5 = {}.hasOwnProperty;
@@ -5081,7 +5082,7 @@ const resolver = {
5081
5082
  resolveAll: createResolver()
5082
5083
  };
5083
5084
  const string$1 = initializeFactory("string");
5084
- const text$6 = initializeFactory("text");
5085
+ const text$5 = initializeFactory("text");
5085
5086
  function initializeFactory(field) {
5086
5087
  return {
5087
5088
  resolveAll: createResolver(field === "text" ? resolveAllLineSuffixes : void 0),
@@ -5252,7 +5253,7 @@ const string = {
5252
5253
  [38]: characterReference,
5253
5254
  [92]: characterEscape
5254
5255
  };
5255
- const text$5 = {
5256
+ const text$4 = {
5256
5257
  [-5]: lineEnding,
5257
5258
  [-4]: lineEnding,
5258
5259
  [-3]: lineEnding,
@@ -5285,7 +5286,7 @@ const defaultConstructs = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.d
5285
5286
  flowInitial,
5286
5287
  insideSpan,
5287
5288
  string,
5288
- text: text$5
5289
+ text: text$4
5289
5290
  }, Symbol.toStringTag, { value: "Module" }));
5290
5291
  function createTokenizer(parser, initialize, from) {
5291
5292
  let point2 = {
@@ -5420,8 +5421,8 @@ function createTokenizer(parser, initialize, from) {
5420
5421
  context.events.push(["exit", token, context]);
5421
5422
  return token;
5422
5423
  }
5423
- function onsuccessfulconstruct(construct2, info) {
5424
- addResult(construct2, info.from);
5424
+ function onsuccessfulconstruct(construct, info) {
5425
+ addResult(construct, info.from);
5425
5426
  }
5426
5427
  function onsuccessfulcheck(_, info) {
5427
5428
  info.restore();
@@ -5465,18 +5466,18 @@ function createTokenizer(parser, initialize, from) {
5465
5466
  }
5466
5467
  return handleConstruct(list2[constructIndex]);
5467
5468
  }
5468
- function handleConstruct(construct2) {
5469
+ function handleConstruct(construct) {
5469
5470
  return start;
5470
5471
  function start(code2) {
5471
5472
  info = store();
5472
- currentConstruct = construct2;
5473
- if (!construct2.partial) {
5474
- context.currentConstruct = construct2;
5473
+ currentConstruct = construct;
5474
+ if (!construct.partial) {
5475
+ context.currentConstruct = construct;
5475
5476
  }
5476
- if (construct2.name && context.parser.constructs.disable.null.includes(construct2.name)) {
5477
+ if (construct.name && context.parser.constructs.disable.null.includes(construct.name)) {
5477
5478
  return nok();
5478
5479
  }
5479
- return construct2.tokenize.call(
5480
+ return construct.tokenize.call(
5480
5481
  // If we do have fields, create an object w/ `context` as its
5481
5482
  // prototype.
5482
5483
  // This allows a “live binding”, which is needed for `interrupt`.
@@ -5500,15 +5501,15 @@ function createTokenizer(parser, initialize, from) {
5500
5501
  }
5501
5502
  }
5502
5503
  }
5503
- function addResult(construct2, from2) {
5504
- if (construct2.resolveAll && !resolveAllConstructs.includes(construct2)) {
5505
- resolveAllConstructs.push(construct2);
5504
+ function addResult(construct, from2) {
5505
+ if (construct.resolveAll && !resolveAllConstructs.includes(construct)) {
5506
+ resolveAllConstructs.push(construct);
5506
5507
  }
5507
- if (construct2.resolve) {
5508
- splice(context.events, from2, context.events.length - from2, construct2.resolve(context.events.slice(from2), context));
5508
+ if (construct.resolve) {
5509
+ splice(context.events, from2, context.events.length - from2, construct.resolve(context.events.slice(from2), context));
5509
5510
  }
5510
- if (construct2.resolveTo) {
5511
- context.events = construct2.resolveTo(context.events, context);
5511
+ if (construct.resolveTo) {
5512
+ context.events = construct.resolveTo(context.events, context);
5512
5513
  }
5513
5514
  }
5514
5515
  function store() {
@@ -5615,7 +5616,7 @@ function parse(options) {
5615
5616
  flow: create2(flow$1),
5616
5617
  lazy: {},
5617
5618
  string: create2(string$1),
5618
- text: create2(text$6)
5619
+ text: create2(text$5)
5619
5620
  };
5620
5621
  return parser;
5621
5622
  function create2(initial) {
@@ -7565,8 +7566,8 @@ function heading$1(node2, _, state, info) {
7565
7566
  exit2();
7566
7567
  return value;
7567
7568
  }
7568
- html$7.peek = htmlPeek;
7569
- function html$7(node2) {
7569
+ html$5.peek = htmlPeek;
7570
+ function html$5(node2) {
7570
7571
  return node2.value || "";
7571
7572
  }
7572
7573
  function htmlPeek() {
@@ -8028,7 +8029,7 @@ function strong$1(node2, _, state, info) {
8028
8029
  function strongPeek(_, _1, state) {
8029
8030
  return state.options.strong || "*";
8030
8031
  }
8031
- function text$4(node2, _, state, info) {
8032
+ function text$3(node2, _, state, info) {
8032
8033
  return state.safe(node2.value, info);
8033
8034
  }
8034
8035
  function checkRuleRepetition(state) {
@@ -8052,7 +8053,7 @@ const handle$1 = {
8052
8053
  emphasis: emphasis$1,
8053
8054
  hardBreak: hardBreak$1,
8054
8055
  heading: heading$1,
8055
- html: html$7,
8056
+ html: html$5,
8056
8057
  image: image$1,
8057
8058
  imageReference: imageReference$1,
8058
8059
  inlineCode: inlineCode$1,
@@ -8063,7 +8064,7 @@ const handle$1 = {
8063
8064
  paragraph: paragraph$1,
8064
8065
  root: root$2,
8065
8066
  strong: strong$1,
8066
- text: text$4,
8067
+ text: text$3,
8067
8068
  thematicBreak: thematicBreak$1
8068
8069
  };
8069
8070
  function gfmTableFromMarkdown() {
@@ -8342,27 +8343,27 @@ const emailAutolink = {
8342
8343
  tokenize: tokenizeEmailAutolink,
8343
8344
  previous: previousEmail
8344
8345
  };
8345
- const text$3 = {};
8346
+ const text$2 = {};
8346
8347
  function gfmAutolinkLiteral() {
8347
8348
  return {
8348
- text: text$3
8349
+ text: text$2
8349
8350
  };
8350
8351
  }
8351
8352
  let code$1 = 48;
8352
8353
  while (code$1 < 123) {
8353
- text$3[code$1] = emailAutolink;
8354
+ text$2[code$1] = emailAutolink;
8354
8355
  code$1++;
8355
8356
  if (code$1 === 58) code$1 = 65;
8356
8357
  else if (code$1 === 91) code$1 = 97;
8357
8358
  }
8358
- text$3[43] = emailAutolink;
8359
- text$3[45] = emailAutolink;
8360
- text$3[46] = emailAutolink;
8361
- text$3[95] = emailAutolink;
8362
- text$3[72] = [emailAutolink, protocolAutolink];
8363
- text$3[104] = [emailAutolink, protocolAutolink];
8364
- text$3[87] = [emailAutolink, wwwAutolink];
8365
- text$3[119] = [emailAutolink, wwwAutolink];
8359
+ text$2[43] = emailAutolink;
8360
+ text$2[45] = emailAutolink;
8361
+ text$2[46] = emailAutolink;
8362
+ text$2[95] = emailAutolink;
8363
+ text$2[72] = [emailAutolink, protocolAutolink];
8364
+ text$2[104] = [emailAutolink, protocolAutolink];
8365
+ text$2[87] = [emailAutolink, wwwAutolink];
8366
+ text$2[119] = [emailAutolink, wwwAutolink];
8366
8367
  function tokenizeEmailAutolink(effects, ok2, nok) {
8367
8368
  const self2 = this;
8368
8369
  let dot;
@@ -9697,7 +9698,7 @@ function heading(state, node2) {
9697
9698
  state.patch(node2, result);
9698
9699
  return state.applyData(node2, result);
9699
9700
  }
9700
- function html$6(state, node2) {
9701
+ function html$4(state, node2) {
9701
9702
  if (state.options.allowDangerousHtml) {
9702
9703
  const result = { type: "raw", value: node2.value };
9703
9704
  state.patch(node2, result);
@@ -10049,7 +10050,7 @@ function trimLine(value, start, end) {
10049
10050
  }
10050
10051
  return endIndex > startIndex ? value.slice(startIndex, endIndex) : "";
10051
10052
  }
10052
- function text$2(state, node2) {
10053
+ function text$1(state, node2) {
10053
10054
  const result = { type: "text", value: trimLines(String(node2.value)) };
10054
10055
  state.patch(node2, result);
10055
10056
  return state.applyData(node2, result);
@@ -10072,7 +10073,7 @@ const handlers = {
10072
10073
  emphasis,
10073
10074
  footnoteReference,
10074
10075
  heading,
10075
- html: html$6,
10076
+ html: html$4,
10076
10077
  imageReference,
10077
10078
  image,
10078
10079
  inlineCode,
@@ -10087,7 +10088,7 @@ const handlers = {
10087
10088
  table,
10088
10089
  tableCell,
10089
10090
  tableRow,
10090
- text: text$2,
10091
+ text: text$1,
10091
10092
  thematicBreak,
10092
10093
  toml: ignore,
10093
10094
  yaml: ignore,
@@ -10260,11 +10261,11 @@ const serializer = (strict, json, $, _) => {
10260
10261
  }
10261
10262
  if (json && "toJSON" in value)
10262
10263
  return pair(value.toJSON());
10263
- const entries2 = [];
10264
- const index2 = as([TYPE, entries2], value);
10264
+ const entries = [];
10265
+ const index2 = as([TYPE, entries], value);
10265
10266
  for (const key2 of keys(value)) {
10266
10267
  if (strict || !shouldSkip(typeOf(value[key2])))
10267
- entries2.push([pair(key2), pair(value[key2])]);
10268
+ entries.push([pair(key2), pair(value[key2])]);
10268
10269
  }
10269
10270
  return index2;
10270
10271
  }
@@ -10275,20 +10276,20 @@ const serializer = (strict, json, $, _) => {
10275
10276
  return as([TYPE, { source, flags }], value);
10276
10277
  }
10277
10278
  case MAP: {
10278
- const entries2 = [];
10279
- const index2 = as([TYPE, entries2], value);
10279
+ const entries = [];
10280
+ const index2 = as([TYPE, entries], value);
10280
10281
  for (const [key2, entry] of value) {
10281
10282
  if (strict || !(shouldSkip(typeOf(key2)) || shouldSkip(typeOf(entry))))
10282
- entries2.push([pair(key2), pair(entry)]);
10283
+ entries.push([pair(key2), pair(entry)]);
10283
10284
  }
10284
10285
  return index2;
10285
10286
  }
10286
10287
  case SET: {
10287
- const entries2 = [];
10288
- const index2 = as([TYPE, entries2], value);
10288
+ const entries = [];
10289
+ const index2 = as([TYPE, entries], value);
10289
10290
  for (const entry of value) {
10290
10291
  if (strict || !shouldSkip(typeOf(entry)))
10291
- entries2.push(pair(entry));
10292
+ entries.push(pair(entry));
10292
10293
  }
10293
10294
  return index2;
10294
10295
  }
@@ -10720,7 +10721,7 @@ function mark(values, key2, value) {
10720
10721
  values[key2] = value;
10721
10722
  }
10722
10723
  }
10723
- function create$1(definition2) {
10724
+ function create(definition2) {
10724
10725
  const properties = {};
10725
10726
  const normals = {};
10726
10727
  for (const [property, value] of Object.entries(definition2.properties)) {
@@ -10739,7 +10740,7 @@ function create$1(definition2) {
10739
10740
  }
10740
10741
  return new Schema(properties, normals, definition2.space);
10741
10742
  }
10742
- const aria = create$1({
10743
+ const aria = create({
10743
10744
  properties: {
10744
10745
  ariaActiveDescendant: null,
10745
10746
  ariaAtomic: booleanish,
@@ -10801,7 +10802,7 @@ function caseSensitiveTransform(attributes, attribute) {
10801
10802
  function caseInsensitiveTransform(attributes, property) {
10802
10803
  return caseSensitiveTransform(attributes, property.toLowerCase());
10803
10804
  }
10804
- const html$5 = create$1({
10805
+ const html$3 = create({
10805
10806
  attributes: {
10806
10807
  acceptcharset: "accept-charset",
10807
10808
  classname: "class",
@@ -11163,7 +11164,7 @@ const html$5 = create$1({
11163
11164
  space: "html",
11164
11165
  transform: caseInsensitiveTransform
11165
11166
  });
11166
- const svg$3 = create$1({
11167
+ const svg$1 = create({
11167
11168
  attributes: {
11168
11169
  accentHeight: "accent-height",
11169
11170
  alignmentBaseline: "alignment-baseline",
@@ -11723,7 +11724,7 @@ const svg$3 = create$1({
11723
11724
  space: "svg",
11724
11725
  transform: caseSensitiveTransform
11725
11726
  });
11726
- const xlink = create$1({
11727
+ const xlink = create({
11727
11728
  properties: {
11728
11729
  xLinkActuate: null,
11729
11730
  xLinkArcRole: null,
@@ -11738,13 +11739,13 @@ const xlink = create$1({
11738
11739
  return "xlink:" + property.slice(5).toLowerCase();
11739
11740
  }
11740
11741
  });
11741
- const xmlns = create$1({
11742
+ const xmlns = create({
11742
11743
  attributes: { xmlnsxlink: "xmlns:xlink" },
11743
11744
  properties: { xmlnsXLink: null, xmlns: null },
11744
11745
  space: "xmlns",
11745
11746
  transform: caseInsensitiveTransform
11746
11747
  });
11747
- const xml$1 = create$1({
11748
+ const xml = create({
11748
11749
  properties: { xmlBase: null, xmlLang: null, xmlSpace: null },
11749
11750
  space: "xml",
11750
11751
  transform(_, property) {
@@ -11785,8 +11786,8 @@ function kebab($0) {
11785
11786
  function camelcase($0) {
11786
11787
  return $0.charAt(1).toUpperCase();
11787
11788
  }
11788
- const html$4 = merge([aria, html$5, xlink, xmlns, xml$1], "html");
11789
- const svg$2 = merge([aria, svg$3, xlink, xmlns, xml$1], "svg");
11789
+ const html$2 = merge([aria, html$3, xlink, xmlns, xml], "html");
11790
+ const svg = merge([aria, svg$1, xlink, xmlns, xml], "svg");
11790
11791
  const defaultSubsetRegex = /["&'<>`]/g;
11791
11792
  const surrogatePairsRegex = /[\uD800-\uDBFF][\uDC00-\uDFFF]/g;
11792
11793
  const controlCharactersRegex = (
@@ -12331,7 +12332,7 @@ const closing = omission({
12331
12332
  dd,
12332
12333
  dt,
12333
12334
  head: headOrColgroupOrCaption,
12334
- html: html$3,
12335
+ html: html$1,
12335
12336
  li,
12336
12337
  optgroup,
12337
12338
  option,
@@ -12349,7 +12350,7 @@ function headOrColgroupOrCaption(_, index2, parent) {
12349
12350
  const next = siblingAfter(parent, index2, true);
12350
12351
  return !next || next.type !== "comment" && !(next.type === "text" && whitespace(next.value.charAt(0)));
12351
12352
  }
12352
- function html$3(_, index2, parent) {
12353
+ function html$1(_, index2, parent) {
12353
12354
  const next = siblingAfter(parent, index2);
12354
12355
  return !next || next.type !== "comment";
12355
12356
  }
@@ -12413,10 +12414,10 @@ const opening = omission({
12413
12414
  body,
12414
12415
  colgroup,
12415
12416
  head,
12416
- html: html$2,
12417
+ html,
12417
12418
  tbody
12418
12419
  });
12419
- function html$2(node2) {
12420
+ function html(node2) {
12420
12421
  const head2 = siblingAfter(node2, -1);
12421
12422
  return !head2 || head2.type !== "comment";
12422
12423
  }
@@ -12481,7 +12482,7 @@ function element(node2, index2, parent, state) {
12481
12482
  const parts = [];
12482
12483
  let last;
12483
12484
  if (schema.space === "html" && node2.tagName === "svg") {
12484
- state.schema = svg$2;
12485
+ state.schema = svg;
12485
12486
  }
12486
12487
  const attributes = serializeAttributes(state, node2.properties);
12487
12488
  const content2 = state.all(
@@ -12577,7 +12578,7 @@ function serializeAttribute(state, key2, value) {
12577
12578
  return name + (result ? "=" + result : result);
12578
12579
  }
12579
12580
  const textEntitySubset = ["<", "&"];
12580
- function text$1(node2, _, parent, state) {
12581
+ function text(node2, _, parent, state) {
12581
12582
  return parent && parent.type === "element" && (parent.tagName === "script" || parent.tagName === "style") ? node2.value : stringifyEntities(
12582
12583
  node2.value,
12583
12584
  Object.assign({}, state.settings.characterReferences, {
@@ -12586,7 +12587,7 @@ function text$1(node2, _, parent, state) {
12586
12587
  );
12587
12588
  }
12588
12589
  function raw(node2, index2, parent, state) {
12589
- return state.settings.allowDangerousHtml ? node2.value : text$1(node2, index2, parent, state);
12590
+ return state.settings.allowDangerousHtml ? node2.value : text(node2, index2, parent, state);
12590
12591
  }
12591
12592
  function root(node2, _1, _2, state) {
12592
12593
  return state.all(node2);
@@ -12594,7 +12595,7 @@ function root(node2, _1, _2, state) {
12594
12595
  const handle = zwitch("type", {
12595
12596
  invalid,
12596
12597
  unknown,
12597
- handlers: { comment, doctype, element, raw, root, text: text$1 }
12598
+ handlers: { comment, doctype, element, raw, root, text }
12598
12599
  });
12599
12600
  function invalid(node2) {
12600
12601
  throw new Error("Expected node, not `" + node2 + "`");
@@ -12638,7 +12639,7 @@ function toHtml(tree, options) {
12638
12639
  closeSelfClosing: options_.closeSelfClosing || false,
12639
12640
  closeEmptyElements: options_.closeEmptyElements || false
12640
12641
  },
12641
- schema: options_.space === "svg" ? svg$2 : html$4,
12642
+ schema: options_.space === "svg" ? svg : html$2,
12642
12643
  quote,
12643
12644
  alternative
12644
12645
  };
@@ -12668,1084 +12669,6 @@ function rehypeStringify(options) {
12668
12669
  return toHtml(tree, settings);
12669
12670
  }
12670
12671
  }
12671
- const {
12672
- entries,
12673
- setPrototypeOf,
12674
- isFrozen,
12675
- getPrototypeOf,
12676
- getOwnPropertyDescriptor
12677
- } = Object;
12678
- let {
12679
- freeze,
12680
- seal,
12681
- create
12682
- } = Object;
12683
- let {
12684
- apply,
12685
- construct
12686
- } = typeof Reflect !== "undefined" && Reflect;
12687
- if (!freeze) {
12688
- freeze = function freeze2(x) {
12689
- return x;
12690
- };
12691
- }
12692
- if (!seal) {
12693
- seal = function seal2(x) {
12694
- return x;
12695
- };
12696
- }
12697
- if (!apply) {
12698
- apply = function apply2(func, thisArg) {
12699
- for (var _len = arguments.length, args = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
12700
- args[_key - 2] = arguments[_key];
12701
- }
12702
- return func.apply(thisArg, args);
12703
- };
12704
- }
12705
- if (!construct) {
12706
- construct = function construct2(Func) {
12707
- for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
12708
- args[_key2 - 1] = arguments[_key2];
12709
- }
12710
- return new Func(...args);
12711
- };
12712
- }
12713
- const arrayForEach = unapply(Array.prototype.forEach);
12714
- const arrayLastIndexOf = unapply(Array.prototype.lastIndexOf);
12715
- const arrayPop = unapply(Array.prototype.pop);
12716
- const arrayPush = unapply(Array.prototype.push);
12717
- const arraySplice = unapply(Array.prototype.splice);
12718
- const arrayIsArray = Array.isArray;
12719
- const stringToLowerCase = unapply(String.prototype.toLowerCase);
12720
- const stringToString = unapply(String.prototype.toString);
12721
- const stringMatch = unapply(String.prototype.match);
12722
- const stringReplace = unapply(String.prototype.replace);
12723
- const stringIndexOf = unapply(String.prototype.indexOf);
12724
- const stringTrim = unapply(String.prototype.trim);
12725
- const numberToString = unapply(Number.prototype.toString);
12726
- const booleanToString = unapply(Boolean.prototype.toString);
12727
- const bigintToString = typeof BigInt === "undefined" ? null : unapply(BigInt.prototype.toString);
12728
- const symbolToString = typeof Symbol === "undefined" ? null : unapply(Symbol.prototype.toString);
12729
- const objectHasOwnProperty = unapply(Object.prototype.hasOwnProperty);
12730
- const objectToString = unapply(Object.prototype.toString);
12731
- const regExpTest = unapply(RegExp.prototype.test);
12732
- const typeErrorCreate = unconstruct(TypeError);
12733
- function unapply(func) {
12734
- return function(thisArg) {
12735
- if (thisArg instanceof RegExp) {
12736
- thisArg.lastIndex = 0;
12737
- }
12738
- for (var _len3 = arguments.length, args = new Array(_len3 > 1 ? _len3 - 1 : 0), _key3 = 1; _key3 < _len3; _key3++) {
12739
- args[_key3 - 1] = arguments[_key3];
12740
- }
12741
- return apply(func, thisArg, args);
12742
- };
12743
- }
12744
- function unconstruct(Func) {
12745
- return function() {
12746
- for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
12747
- args[_key4] = arguments[_key4];
12748
- }
12749
- return construct(Func, args);
12750
- };
12751
- }
12752
- function addToSet(set, array) {
12753
- let transformCaseFunc = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : stringToLowerCase;
12754
- if (setPrototypeOf) {
12755
- setPrototypeOf(set, null);
12756
- }
12757
- if (!arrayIsArray(array)) {
12758
- return set;
12759
- }
12760
- let l = array.length;
12761
- while (l--) {
12762
- let element2 = array[l];
12763
- if (typeof element2 === "string") {
12764
- const lcElement = transformCaseFunc(element2);
12765
- if (lcElement !== element2) {
12766
- if (!isFrozen(array)) {
12767
- array[l] = lcElement;
12768
- }
12769
- element2 = lcElement;
12770
- }
12771
- }
12772
- set[element2] = true;
12773
- }
12774
- return set;
12775
- }
12776
- function cleanArray(array) {
12777
- for (let index2 = 0; index2 < array.length; index2++) {
12778
- const isPropertyExist = objectHasOwnProperty(array, index2);
12779
- if (!isPropertyExist) {
12780
- array[index2] = null;
12781
- }
12782
- }
12783
- return array;
12784
- }
12785
- function clone(object) {
12786
- const newObject = create(null);
12787
- for (const [property, value] of entries(object)) {
12788
- const isPropertyExist = objectHasOwnProperty(object, property);
12789
- if (isPropertyExist) {
12790
- if (arrayIsArray(value)) {
12791
- newObject[property] = cleanArray(value);
12792
- } else if (value && typeof value === "object" && value.constructor === Object) {
12793
- newObject[property] = clone(value);
12794
- } else {
12795
- newObject[property] = value;
12796
- }
12797
- }
12798
- }
12799
- return newObject;
12800
- }
12801
- function stringifyValue(value) {
12802
- switch (typeof value) {
12803
- case "string": {
12804
- return value;
12805
- }
12806
- case "number": {
12807
- return numberToString(value);
12808
- }
12809
- case "boolean": {
12810
- return booleanToString(value);
12811
- }
12812
- case "bigint": {
12813
- return bigintToString ? bigintToString(value) : "0";
12814
- }
12815
- case "symbol": {
12816
- return symbolToString ? symbolToString(value) : "Symbol()";
12817
- }
12818
- case "undefined": {
12819
- return objectToString(value);
12820
- }
12821
- case "function":
12822
- case "object": {
12823
- if (value === null) {
12824
- return objectToString(value);
12825
- }
12826
- const valueAsRecord = value;
12827
- const valueToString = lookupGetter(valueAsRecord, "toString");
12828
- if (typeof valueToString === "function") {
12829
- const stringified = valueToString(valueAsRecord);
12830
- return typeof stringified === "string" ? stringified : objectToString(stringified);
12831
- }
12832
- return objectToString(value);
12833
- }
12834
- default: {
12835
- return objectToString(value);
12836
- }
12837
- }
12838
- }
12839
- function lookupGetter(object, prop) {
12840
- while (object !== null) {
12841
- const desc = getOwnPropertyDescriptor(object, prop);
12842
- if (desc) {
12843
- if (desc.get) {
12844
- return unapply(desc.get);
12845
- }
12846
- if (typeof desc.value === "function") {
12847
- return unapply(desc.value);
12848
- }
12849
- }
12850
- object = getPrototypeOf(object);
12851
- }
12852
- function fallbackValue() {
12853
- return null;
12854
- }
12855
- return fallbackValue;
12856
- }
12857
- function isRegex(value) {
12858
- try {
12859
- regExpTest(value, "");
12860
- return true;
12861
- } catch (_unused) {
12862
- return false;
12863
- }
12864
- }
12865
- const html$1 = freeze(["a", "abbr", "acronym", "address", "area", "article", "aside", "audio", "b", "bdi", "bdo", "big", "blink", "blockquote", "body", "br", "button", "canvas", "caption", "center", "cite", "code", "col", "colgroup", "content", "data", "datalist", "dd", "decorator", "del", "details", "dfn", "dialog", "dir", "div", "dl", "dt", "element", "em", "fieldset", "figcaption", "figure", "font", "footer", "form", "h1", "h2", "h3", "h4", "h5", "h6", "head", "header", "hgroup", "hr", "html", "i", "img", "input", "ins", "kbd", "label", "legend", "li", "main", "map", "mark", "marquee", "menu", "menuitem", "meter", "nav", "nobr", "ol", "optgroup", "option", "output", "p", "picture", "pre", "progress", "q", "rp", "rt", "ruby", "s", "samp", "search", "section", "select", "shadow", "slot", "small", "source", "spacer", "span", "strike", "strong", "style", "sub", "summary", "sup", "table", "tbody", "td", "template", "textarea", "tfoot", "th", "thead", "time", "tr", "track", "tt", "u", "ul", "var", "video", "wbr"]);
12866
- 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"]);
12867
- 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"]);
12868
- 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"]);
12869
- 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"]);
12870
- const mathMlDisallowed = freeze(["maction", "maligngroup", "malignmark", "mlongdiv", "mscarries", "mscarry", "msgroup", "mstack", "msline", "msrow", "semantics", "annotation", "annotation-xml", "mprescripts", "none"]);
12871
- const text = freeze(["#text"]);
12872
- const html = 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"]);
12873
- 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"]);
12874
- 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"]);
12875
- const xml = freeze(["xlink:href", "xml:id", "xlink:title", "xml:space", "xmlns:xlink"]);
12876
- const MUSTACHE_EXPR = seal(/\{\{[\w\W]*|[\w\W]*\}\}/gm);
12877
- const ERB_EXPR = seal(/<%[\w\W]*|[\w\W]*%>/gm);
12878
- const TMPLIT_EXPR = seal(/\$\{[\w\W]*/gm);
12879
- const DATA_ATTR = seal(/^data-[\-\w.\u00B7-\uFFFF]+$/);
12880
- const ARIA_ATTR = seal(/^aria-[\-\w]+$/);
12881
- const IS_ALLOWED_URI = seal(
12882
- /^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i
12883
- // eslint-disable-line no-useless-escape
12884
- );
12885
- const IS_SCRIPT_OR_DATA = seal(/^(?:\w+script|data):/i);
12886
- const ATTR_WHITESPACE = seal(
12887
- /[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g
12888
- // eslint-disable-line no-control-regex
12889
- );
12890
- const DOCTYPE_NAME = seal(/^html$/i);
12891
- const CUSTOM_ELEMENT = seal(/^[a-z][.\w]*(-[.\w]+)+$/i);
12892
- var EXPRESSIONS = /* @__PURE__ */ Object.freeze({
12893
- __proto__: null,
12894
- ARIA_ATTR,
12895
- ATTR_WHITESPACE,
12896
- CUSTOM_ELEMENT,
12897
- DATA_ATTR,
12898
- DOCTYPE_NAME,
12899
- ERB_EXPR,
12900
- IS_ALLOWED_URI,
12901
- IS_SCRIPT_OR_DATA,
12902
- MUSTACHE_EXPR,
12903
- TMPLIT_EXPR
12904
- });
12905
- const NODE_TYPE = {
12906
- element: 1,
12907
- text: 3,
12908
- // Deprecated
12909
- progressingInstruction: 7,
12910
- comment: 8,
12911
- document: 9
12912
- };
12913
- const getGlobal = function getGlobal2() {
12914
- return typeof window === "undefined" ? null : window;
12915
- };
12916
- const _createTrustedTypesPolicy = function _createTrustedTypesPolicy2(trustedTypes, purifyHostElement) {
12917
- if (typeof trustedTypes !== "object" || typeof trustedTypes.createPolicy !== "function") {
12918
- return null;
12919
- }
12920
- let suffix = null;
12921
- const ATTR_NAME = "data-tt-policy-suffix";
12922
- if (purifyHostElement && purifyHostElement.hasAttribute(ATTR_NAME)) {
12923
- suffix = purifyHostElement.getAttribute(ATTR_NAME);
12924
- }
12925
- const policyName = "dompurify" + (suffix ? "#" + suffix : "");
12926
- try {
12927
- return trustedTypes.createPolicy(policyName, {
12928
- createHTML(html2) {
12929
- return html2;
12930
- },
12931
- createScriptURL(scriptUrl) {
12932
- return scriptUrl;
12933
- }
12934
- });
12935
- } catch (_) {
12936
- console.warn("TrustedTypes policy " + policyName + " could not be created.");
12937
- return null;
12938
- }
12939
- };
12940
- const _createHooksMap = function _createHooksMap2() {
12941
- return {
12942
- afterSanitizeAttributes: [],
12943
- afterSanitizeElements: [],
12944
- afterSanitizeShadowDOM: [],
12945
- beforeSanitizeAttributes: [],
12946
- beforeSanitizeElements: [],
12947
- beforeSanitizeShadowDOM: [],
12948
- uponSanitizeAttribute: [],
12949
- uponSanitizeElement: [],
12950
- uponSanitizeShadowNode: []
12951
- };
12952
- };
12953
- function createDOMPurify() {
12954
- let window2 = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : getGlobal();
12955
- const DOMPurify = (root2) => createDOMPurify(root2);
12956
- DOMPurify.version = "3.4.1";
12957
- DOMPurify.removed = [];
12958
- if (!window2 || !window2.document || window2.document.nodeType !== NODE_TYPE.document || !window2.Element) {
12959
- DOMPurify.isSupported = false;
12960
- return DOMPurify;
12961
- }
12962
- let {
12963
- document: document2
12964
- } = window2;
12965
- const originalDocument = document2;
12966
- const currentScript = originalDocument.currentScript;
12967
- const {
12968
- DocumentFragment,
12969
- HTMLTemplateElement,
12970
- Node,
12971
- Element,
12972
- NodeFilter,
12973
- NamedNodeMap = window2.NamedNodeMap || window2.MozNamedAttrMap,
12974
- HTMLFormElement,
12975
- DOMParser,
12976
- trustedTypes
12977
- } = window2;
12978
- const ElementPrototype = Element.prototype;
12979
- const cloneNode = lookupGetter(ElementPrototype, "cloneNode");
12980
- const remove = lookupGetter(ElementPrototype, "remove");
12981
- const getNextSibling = lookupGetter(ElementPrototype, "nextSibling");
12982
- const getChildNodes = lookupGetter(ElementPrototype, "childNodes");
12983
- const getParentNode = lookupGetter(ElementPrototype, "parentNode");
12984
- if (typeof HTMLTemplateElement === "function") {
12985
- const template = document2.createElement("template");
12986
- if (template.content && template.content.ownerDocument) {
12987
- document2 = template.content.ownerDocument;
12988
- }
12989
- }
12990
- let trustedTypesPolicy;
12991
- let emptyHTML = "";
12992
- const {
12993
- implementation,
12994
- createNodeIterator,
12995
- createDocumentFragment,
12996
- getElementsByTagName
12997
- } = document2;
12998
- const {
12999
- importNode
13000
- } = originalDocument;
13001
- let hooks = _createHooksMap();
13002
- DOMPurify.isSupported = typeof entries === "function" && typeof getParentNode === "function" && implementation && implementation.createHTMLDocument !== void 0;
13003
- const {
13004
- MUSTACHE_EXPR: MUSTACHE_EXPR2,
13005
- ERB_EXPR: ERB_EXPR2,
13006
- TMPLIT_EXPR: TMPLIT_EXPR2,
13007
- DATA_ATTR: DATA_ATTR2,
13008
- ARIA_ATTR: ARIA_ATTR2,
13009
- IS_SCRIPT_OR_DATA: IS_SCRIPT_OR_DATA2,
13010
- ATTR_WHITESPACE: ATTR_WHITESPACE2,
13011
- CUSTOM_ELEMENT: CUSTOM_ELEMENT2
13012
- } = EXPRESSIONS;
13013
- let {
13014
- IS_ALLOWED_URI: IS_ALLOWED_URI$1
13015
- } = EXPRESSIONS;
13016
- let ALLOWED_TAGS = null;
13017
- const DEFAULT_ALLOWED_TAGS = addToSet({}, [...html$1, ...svg$1, ...svgFilters, ...mathMl$1, ...text]);
13018
- let ALLOWED_ATTR = null;
13019
- const DEFAULT_ALLOWED_ATTR = addToSet({}, [...html, ...svg, ...mathMl, ...xml]);
13020
- let CUSTOM_ELEMENT_HANDLING = Object.seal(create(null, {
13021
- tagNameCheck: {
13022
- writable: true,
13023
- configurable: false,
13024
- enumerable: true,
13025
- value: null
13026
- },
13027
- attributeNameCheck: {
13028
- writable: true,
13029
- configurable: false,
13030
- enumerable: true,
13031
- value: null
13032
- },
13033
- allowCustomizedBuiltInElements: {
13034
- writable: true,
13035
- configurable: false,
13036
- enumerable: true,
13037
- value: false
13038
- }
13039
- }));
13040
- let FORBID_TAGS = null;
13041
- let FORBID_ATTR = null;
13042
- const EXTRA_ELEMENT_HANDLING = Object.seal(create(null, {
13043
- tagCheck: {
13044
- writable: true,
13045
- configurable: false,
13046
- enumerable: true,
13047
- value: null
13048
- },
13049
- attributeCheck: {
13050
- writable: true,
13051
- configurable: false,
13052
- enumerable: true,
13053
- value: null
13054
- }
13055
- }));
13056
- let ALLOW_ARIA_ATTR = true;
13057
- let ALLOW_DATA_ATTR = true;
13058
- let ALLOW_UNKNOWN_PROTOCOLS = false;
13059
- let ALLOW_SELF_CLOSE_IN_ATTR = true;
13060
- let SAFE_FOR_TEMPLATES = false;
13061
- let SAFE_FOR_XML = true;
13062
- let WHOLE_DOCUMENT = false;
13063
- let SET_CONFIG = false;
13064
- let FORCE_BODY = false;
13065
- let RETURN_DOM = false;
13066
- let RETURN_DOM_FRAGMENT = false;
13067
- let RETURN_TRUSTED_TYPE = false;
13068
- let SANITIZE_DOM = true;
13069
- let SANITIZE_NAMED_PROPS = false;
13070
- const SANITIZE_NAMED_PROPS_PREFIX = "user-content-";
13071
- let KEEP_CONTENT = true;
13072
- let IN_PLACE = false;
13073
- let USE_PROFILES = {};
13074
- let FORBID_CONTENTS = null;
13075
- 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"]);
13076
- let DATA_URI_TAGS = null;
13077
- const DEFAULT_DATA_URI_TAGS = addToSet({}, ["audio", "video", "img", "source", "image", "track"]);
13078
- let URI_SAFE_ATTRIBUTES = null;
13079
- const DEFAULT_URI_SAFE_ATTRIBUTES = addToSet({}, ["alt", "class", "for", "id", "label", "name", "pattern", "placeholder", "role", "summary", "title", "value", "style", "xmlns"]);
13080
- const MATHML_NAMESPACE = "http://www.w3.org/1998/Math/MathML";
13081
- const SVG_NAMESPACE = "http://www.w3.org/2000/svg";
13082
- const HTML_NAMESPACE = "http://www.w3.org/1999/xhtml";
13083
- let NAMESPACE = HTML_NAMESPACE;
13084
- let IS_EMPTY_INPUT = false;
13085
- let ALLOWED_NAMESPACES = null;
13086
- const DEFAULT_ALLOWED_NAMESPACES = addToSet({}, [MATHML_NAMESPACE, SVG_NAMESPACE, HTML_NAMESPACE], stringToString);
13087
- let MATHML_TEXT_INTEGRATION_POINTS = addToSet({}, ["mi", "mo", "mn", "ms", "mtext"]);
13088
- let HTML_INTEGRATION_POINTS = addToSet({}, ["annotation-xml"]);
13089
- const COMMON_SVG_AND_HTML_ELEMENTS = addToSet({}, ["title", "style", "font", "a", "script"]);
13090
- let PARSER_MEDIA_TYPE = null;
13091
- const SUPPORTED_PARSER_MEDIA_TYPES = ["application/xhtml+xml", "text/html"];
13092
- const DEFAULT_PARSER_MEDIA_TYPE = "text/html";
13093
- let transformCaseFunc = null;
13094
- let CONFIG = null;
13095
- const formElement = document2.createElement("form");
13096
- const isRegexOrFunction = function isRegexOrFunction2(testValue) {
13097
- return testValue instanceof RegExp || testValue instanceof Function;
13098
- };
13099
- const _parseConfig = function _parseConfig2() {
13100
- let cfg = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
13101
- if (CONFIG && CONFIG === cfg) {
13102
- return;
13103
- }
13104
- if (!cfg || typeof cfg !== "object") {
13105
- cfg = {};
13106
- }
13107
- cfg = clone(cfg);
13108
- PARSER_MEDIA_TYPE = // eslint-disable-next-line unicorn/prefer-includes
13109
- SUPPORTED_PARSER_MEDIA_TYPES.indexOf(cfg.PARSER_MEDIA_TYPE) === -1 ? DEFAULT_PARSER_MEDIA_TYPE : cfg.PARSER_MEDIA_TYPE;
13110
- transformCaseFunc = PARSER_MEDIA_TYPE === "application/xhtml+xml" ? stringToString : stringToLowerCase;
13111
- ALLOWED_TAGS = objectHasOwnProperty(cfg, "ALLOWED_TAGS") && arrayIsArray(cfg.ALLOWED_TAGS) ? addToSet({}, cfg.ALLOWED_TAGS, transformCaseFunc) : DEFAULT_ALLOWED_TAGS;
13112
- ALLOWED_ATTR = objectHasOwnProperty(cfg, "ALLOWED_ATTR") && arrayIsArray(cfg.ALLOWED_ATTR) ? addToSet({}, cfg.ALLOWED_ATTR, transformCaseFunc) : DEFAULT_ALLOWED_ATTR;
13113
- ALLOWED_NAMESPACES = objectHasOwnProperty(cfg, "ALLOWED_NAMESPACES") && arrayIsArray(cfg.ALLOWED_NAMESPACES) ? addToSet({}, cfg.ALLOWED_NAMESPACES, stringToString) : DEFAULT_ALLOWED_NAMESPACES;
13114
- URI_SAFE_ATTRIBUTES = objectHasOwnProperty(cfg, "ADD_URI_SAFE_ATTR") && arrayIsArray(cfg.ADD_URI_SAFE_ATTR) ? addToSet(clone(DEFAULT_URI_SAFE_ATTRIBUTES), cfg.ADD_URI_SAFE_ATTR, transformCaseFunc) : DEFAULT_URI_SAFE_ATTRIBUTES;
13115
- DATA_URI_TAGS = objectHasOwnProperty(cfg, "ADD_DATA_URI_TAGS") && arrayIsArray(cfg.ADD_DATA_URI_TAGS) ? addToSet(clone(DEFAULT_DATA_URI_TAGS), cfg.ADD_DATA_URI_TAGS, transformCaseFunc) : DEFAULT_DATA_URI_TAGS;
13116
- FORBID_CONTENTS = objectHasOwnProperty(cfg, "FORBID_CONTENTS") && arrayIsArray(cfg.FORBID_CONTENTS) ? addToSet({}, cfg.FORBID_CONTENTS, transformCaseFunc) : DEFAULT_FORBID_CONTENTS;
13117
- FORBID_TAGS = objectHasOwnProperty(cfg, "FORBID_TAGS") && arrayIsArray(cfg.FORBID_TAGS) ? addToSet({}, cfg.FORBID_TAGS, transformCaseFunc) : clone({});
13118
- FORBID_ATTR = objectHasOwnProperty(cfg, "FORBID_ATTR") && arrayIsArray(cfg.FORBID_ATTR) ? addToSet({}, cfg.FORBID_ATTR, transformCaseFunc) : clone({});
13119
- USE_PROFILES = objectHasOwnProperty(cfg, "USE_PROFILES") ? cfg.USE_PROFILES && typeof cfg.USE_PROFILES === "object" ? clone(cfg.USE_PROFILES) : cfg.USE_PROFILES : false;
13120
- ALLOW_ARIA_ATTR = cfg.ALLOW_ARIA_ATTR !== false;
13121
- ALLOW_DATA_ATTR = cfg.ALLOW_DATA_ATTR !== false;
13122
- ALLOW_UNKNOWN_PROTOCOLS = cfg.ALLOW_UNKNOWN_PROTOCOLS || false;
13123
- ALLOW_SELF_CLOSE_IN_ATTR = cfg.ALLOW_SELF_CLOSE_IN_ATTR !== false;
13124
- SAFE_FOR_TEMPLATES = cfg.SAFE_FOR_TEMPLATES || false;
13125
- SAFE_FOR_XML = cfg.SAFE_FOR_XML !== false;
13126
- WHOLE_DOCUMENT = cfg.WHOLE_DOCUMENT || false;
13127
- RETURN_DOM = cfg.RETURN_DOM || false;
13128
- RETURN_DOM_FRAGMENT = cfg.RETURN_DOM_FRAGMENT || false;
13129
- RETURN_TRUSTED_TYPE = cfg.RETURN_TRUSTED_TYPE || false;
13130
- FORCE_BODY = cfg.FORCE_BODY || false;
13131
- SANITIZE_DOM = cfg.SANITIZE_DOM !== false;
13132
- SANITIZE_NAMED_PROPS = cfg.SANITIZE_NAMED_PROPS || false;
13133
- KEEP_CONTENT = cfg.KEEP_CONTENT !== false;
13134
- IN_PLACE = cfg.IN_PLACE || false;
13135
- IS_ALLOWED_URI$1 = isRegex(cfg.ALLOWED_URI_REGEXP) ? cfg.ALLOWED_URI_REGEXP : IS_ALLOWED_URI;
13136
- NAMESPACE = typeof cfg.NAMESPACE === "string" ? cfg.NAMESPACE : HTML_NAMESPACE;
13137
- MATHML_TEXT_INTEGRATION_POINTS = objectHasOwnProperty(cfg, "MATHML_TEXT_INTEGRATION_POINTS") && cfg.MATHML_TEXT_INTEGRATION_POINTS && typeof cfg.MATHML_TEXT_INTEGRATION_POINTS === "object" ? clone(cfg.MATHML_TEXT_INTEGRATION_POINTS) : addToSet({}, ["mi", "mo", "mn", "ms", "mtext"]);
13138
- HTML_INTEGRATION_POINTS = objectHasOwnProperty(cfg, "HTML_INTEGRATION_POINTS") && cfg.HTML_INTEGRATION_POINTS && typeof cfg.HTML_INTEGRATION_POINTS === "object" ? clone(cfg.HTML_INTEGRATION_POINTS) : addToSet({}, ["annotation-xml"]);
13139
- const customElementHandling = objectHasOwnProperty(cfg, "CUSTOM_ELEMENT_HANDLING") && cfg.CUSTOM_ELEMENT_HANDLING && typeof cfg.CUSTOM_ELEMENT_HANDLING === "object" ? clone(cfg.CUSTOM_ELEMENT_HANDLING) : create(null);
13140
- CUSTOM_ELEMENT_HANDLING = create(null);
13141
- if (objectHasOwnProperty(customElementHandling, "tagNameCheck") && isRegexOrFunction(customElementHandling.tagNameCheck)) {
13142
- CUSTOM_ELEMENT_HANDLING.tagNameCheck = customElementHandling.tagNameCheck;
13143
- }
13144
- if (objectHasOwnProperty(customElementHandling, "attributeNameCheck") && isRegexOrFunction(customElementHandling.attributeNameCheck)) {
13145
- CUSTOM_ELEMENT_HANDLING.attributeNameCheck = customElementHandling.attributeNameCheck;
13146
- }
13147
- if (objectHasOwnProperty(customElementHandling, "allowCustomizedBuiltInElements") && typeof customElementHandling.allowCustomizedBuiltInElements === "boolean") {
13148
- CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements = customElementHandling.allowCustomizedBuiltInElements;
13149
- }
13150
- if (SAFE_FOR_TEMPLATES) {
13151
- ALLOW_DATA_ATTR = false;
13152
- }
13153
- if (RETURN_DOM_FRAGMENT) {
13154
- RETURN_DOM = true;
13155
- }
13156
- if (USE_PROFILES) {
13157
- ALLOWED_TAGS = addToSet({}, text);
13158
- ALLOWED_ATTR = create(null);
13159
- if (USE_PROFILES.html === true) {
13160
- addToSet(ALLOWED_TAGS, html$1);
13161
- addToSet(ALLOWED_ATTR, html);
13162
- }
13163
- if (USE_PROFILES.svg === true) {
13164
- addToSet(ALLOWED_TAGS, svg$1);
13165
- addToSet(ALLOWED_ATTR, svg);
13166
- addToSet(ALLOWED_ATTR, xml);
13167
- }
13168
- if (USE_PROFILES.svgFilters === true) {
13169
- addToSet(ALLOWED_TAGS, svgFilters);
13170
- addToSet(ALLOWED_ATTR, svg);
13171
- addToSet(ALLOWED_ATTR, xml);
13172
- }
13173
- if (USE_PROFILES.mathMl === true) {
13174
- addToSet(ALLOWED_TAGS, mathMl$1);
13175
- addToSet(ALLOWED_ATTR, mathMl);
13176
- addToSet(ALLOWED_ATTR, xml);
13177
- }
13178
- }
13179
- EXTRA_ELEMENT_HANDLING.tagCheck = null;
13180
- EXTRA_ELEMENT_HANDLING.attributeCheck = null;
13181
- if (objectHasOwnProperty(cfg, "ADD_TAGS")) {
13182
- if (typeof cfg.ADD_TAGS === "function") {
13183
- EXTRA_ELEMENT_HANDLING.tagCheck = cfg.ADD_TAGS;
13184
- } else if (arrayIsArray(cfg.ADD_TAGS)) {
13185
- if (ALLOWED_TAGS === DEFAULT_ALLOWED_TAGS) {
13186
- ALLOWED_TAGS = clone(ALLOWED_TAGS);
13187
- }
13188
- addToSet(ALLOWED_TAGS, cfg.ADD_TAGS, transformCaseFunc);
13189
- }
13190
- }
13191
- if (objectHasOwnProperty(cfg, "ADD_ATTR")) {
13192
- if (typeof cfg.ADD_ATTR === "function") {
13193
- EXTRA_ELEMENT_HANDLING.attributeCheck = cfg.ADD_ATTR;
13194
- } else if (arrayIsArray(cfg.ADD_ATTR)) {
13195
- if (ALLOWED_ATTR === DEFAULT_ALLOWED_ATTR) {
13196
- ALLOWED_ATTR = clone(ALLOWED_ATTR);
13197
- }
13198
- addToSet(ALLOWED_ATTR, cfg.ADD_ATTR, transformCaseFunc);
13199
- }
13200
- }
13201
- if (objectHasOwnProperty(cfg, "ADD_URI_SAFE_ATTR") && arrayIsArray(cfg.ADD_URI_SAFE_ATTR)) {
13202
- addToSet(URI_SAFE_ATTRIBUTES, cfg.ADD_URI_SAFE_ATTR, transformCaseFunc);
13203
- }
13204
- if (objectHasOwnProperty(cfg, "FORBID_CONTENTS") && arrayIsArray(cfg.FORBID_CONTENTS)) {
13205
- if (FORBID_CONTENTS === DEFAULT_FORBID_CONTENTS) {
13206
- FORBID_CONTENTS = clone(FORBID_CONTENTS);
13207
- }
13208
- addToSet(FORBID_CONTENTS, cfg.FORBID_CONTENTS, transformCaseFunc);
13209
- }
13210
- if (objectHasOwnProperty(cfg, "ADD_FORBID_CONTENTS") && arrayIsArray(cfg.ADD_FORBID_CONTENTS)) {
13211
- if (FORBID_CONTENTS === DEFAULT_FORBID_CONTENTS) {
13212
- FORBID_CONTENTS = clone(FORBID_CONTENTS);
13213
- }
13214
- addToSet(FORBID_CONTENTS, cfg.ADD_FORBID_CONTENTS, transformCaseFunc);
13215
- }
13216
- if (KEEP_CONTENT) {
13217
- ALLOWED_TAGS["#text"] = true;
13218
- }
13219
- if (WHOLE_DOCUMENT) {
13220
- addToSet(ALLOWED_TAGS, ["html", "head", "body"]);
13221
- }
13222
- if (ALLOWED_TAGS.table) {
13223
- addToSet(ALLOWED_TAGS, ["tbody"]);
13224
- delete FORBID_TAGS.tbody;
13225
- }
13226
- if (cfg.TRUSTED_TYPES_POLICY) {
13227
- if (typeof cfg.TRUSTED_TYPES_POLICY.createHTML !== "function") {
13228
- throw typeErrorCreate('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');
13229
- }
13230
- if (typeof cfg.TRUSTED_TYPES_POLICY.createScriptURL !== "function") {
13231
- throw typeErrorCreate('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');
13232
- }
13233
- trustedTypesPolicy = cfg.TRUSTED_TYPES_POLICY;
13234
- emptyHTML = trustedTypesPolicy.createHTML("");
13235
- } else {
13236
- if (trustedTypesPolicy === void 0) {
13237
- trustedTypesPolicy = _createTrustedTypesPolicy(trustedTypes, currentScript);
13238
- }
13239
- if (trustedTypesPolicy !== null && typeof emptyHTML === "string") {
13240
- emptyHTML = trustedTypesPolicy.createHTML("");
13241
- }
13242
- }
13243
- if (freeze) {
13244
- freeze(cfg);
13245
- }
13246
- CONFIG = cfg;
13247
- };
13248
- const ALL_SVG_TAGS = addToSet({}, [...svg$1, ...svgFilters, ...svgDisallowed]);
13249
- const ALL_MATHML_TAGS = addToSet({}, [...mathMl$1, ...mathMlDisallowed]);
13250
- const _checkValidNamespace = function _checkValidNamespace2(element2) {
13251
- let parent = getParentNode(element2);
13252
- if (!parent || !parent.tagName) {
13253
- parent = {
13254
- namespaceURI: NAMESPACE,
13255
- tagName: "template"
13256
- };
13257
- }
13258
- const tagName = stringToLowerCase(element2.tagName);
13259
- const parentTagName = stringToLowerCase(parent.tagName);
13260
- if (!ALLOWED_NAMESPACES[element2.namespaceURI]) {
13261
- return false;
13262
- }
13263
- if (element2.namespaceURI === SVG_NAMESPACE) {
13264
- if (parent.namespaceURI === HTML_NAMESPACE) {
13265
- return tagName === "svg";
13266
- }
13267
- if (parent.namespaceURI === MATHML_NAMESPACE) {
13268
- return tagName === "svg" && (parentTagName === "annotation-xml" || MATHML_TEXT_INTEGRATION_POINTS[parentTagName]);
13269
- }
13270
- return Boolean(ALL_SVG_TAGS[tagName]);
13271
- }
13272
- if (element2.namespaceURI === MATHML_NAMESPACE) {
13273
- if (parent.namespaceURI === HTML_NAMESPACE) {
13274
- return tagName === "math";
13275
- }
13276
- if (parent.namespaceURI === SVG_NAMESPACE) {
13277
- return tagName === "math" && HTML_INTEGRATION_POINTS[parentTagName];
13278
- }
13279
- return Boolean(ALL_MATHML_TAGS[tagName]);
13280
- }
13281
- if (element2.namespaceURI === HTML_NAMESPACE) {
13282
- if (parent.namespaceURI === SVG_NAMESPACE && !HTML_INTEGRATION_POINTS[parentTagName]) {
13283
- return false;
13284
- }
13285
- if (parent.namespaceURI === MATHML_NAMESPACE && !MATHML_TEXT_INTEGRATION_POINTS[parentTagName]) {
13286
- return false;
13287
- }
13288
- return !ALL_MATHML_TAGS[tagName] && (COMMON_SVG_AND_HTML_ELEMENTS[tagName] || !ALL_SVG_TAGS[tagName]);
13289
- }
13290
- if (PARSER_MEDIA_TYPE === "application/xhtml+xml" && ALLOWED_NAMESPACES[element2.namespaceURI]) {
13291
- return true;
13292
- }
13293
- return false;
13294
- };
13295
- const _forceRemove = function _forceRemove2(node2) {
13296
- arrayPush(DOMPurify.removed, {
13297
- element: node2
13298
- });
13299
- try {
13300
- getParentNode(node2).removeChild(node2);
13301
- } catch (_) {
13302
- remove(node2);
13303
- }
13304
- };
13305
- const _removeAttribute = function _removeAttribute2(name, element2) {
13306
- try {
13307
- arrayPush(DOMPurify.removed, {
13308
- attribute: element2.getAttributeNode(name),
13309
- from: element2
13310
- });
13311
- } catch (_) {
13312
- arrayPush(DOMPurify.removed, {
13313
- attribute: null,
13314
- from: element2
13315
- });
13316
- }
13317
- element2.removeAttribute(name);
13318
- if (name === "is") {
13319
- if (RETURN_DOM || RETURN_DOM_FRAGMENT) {
13320
- try {
13321
- _forceRemove(element2);
13322
- } catch (_) {
13323
- }
13324
- } else {
13325
- try {
13326
- element2.setAttribute(name, "");
13327
- } catch (_) {
13328
- }
13329
- }
13330
- }
13331
- };
13332
- const _initDocument = function _initDocument2(dirty) {
13333
- let doc = null;
13334
- let leadingWhitespace = null;
13335
- if (FORCE_BODY) {
13336
- dirty = "<remove></remove>" + dirty;
13337
- } else {
13338
- const matches = stringMatch(dirty, /^[\r\n\t ]+/);
13339
- leadingWhitespace = matches && matches[0];
13340
- }
13341
- if (PARSER_MEDIA_TYPE === "application/xhtml+xml" && NAMESPACE === HTML_NAMESPACE) {
13342
- dirty = '<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>' + dirty + "</body></html>";
13343
- }
13344
- const dirtyPayload = trustedTypesPolicy ? trustedTypesPolicy.createHTML(dirty) : dirty;
13345
- if (NAMESPACE === HTML_NAMESPACE) {
13346
- try {
13347
- doc = new DOMParser().parseFromString(dirtyPayload, PARSER_MEDIA_TYPE);
13348
- } catch (_) {
13349
- }
13350
- }
13351
- if (!doc || !doc.documentElement) {
13352
- doc = implementation.createDocument(NAMESPACE, "template", null);
13353
- try {
13354
- doc.documentElement.innerHTML = IS_EMPTY_INPUT ? emptyHTML : dirtyPayload;
13355
- } catch (_) {
13356
- }
13357
- }
13358
- const body2 = doc.body || doc.documentElement;
13359
- if (dirty && leadingWhitespace) {
13360
- body2.insertBefore(document2.createTextNode(leadingWhitespace), body2.childNodes[0] || null);
13361
- }
13362
- if (NAMESPACE === HTML_NAMESPACE) {
13363
- return getElementsByTagName.call(doc, WHOLE_DOCUMENT ? "html" : "body")[0];
13364
- }
13365
- return WHOLE_DOCUMENT ? doc.documentElement : body2;
13366
- };
13367
- const _createNodeIterator = function _createNodeIterator2(root2) {
13368
- return createNodeIterator.call(
13369
- root2.ownerDocument || root2,
13370
- root2,
13371
- // eslint-disable-next-line no-bitwise
13372
- NodeFilter.SHOW_ELEMENT | NodeFilter.SHOW_COMMENT | NodeFilter.SHOW_TEXT | NodeFilter.SHOW_PROCESSING_INSTRUCTION | NodeFilter.SHOW_CDATA_SECTION,
13373
- null
13374
- );
13375
- };
13376
- const _isClobbered = function _isClobbered2(element2) {
13377
- return element2 instanceof HTMLFormElement && (typeof element2.nodeName !== "string" || typeof element2.textContent !== "string" || typeof element2.removeChild !== "function" || !(element2.attributes instanceof NamedNodeMap) || typeof element2.removeAttribute !== "function" || typeof element2.setAttribute !== "function" || typeof element2.namespaceURI !== "string" || typeof element2.insertBefore !== "function" || typeof element2.hasChildNodes !== "function");
13378
- };
13379
- const _isNode = function _isNode2(value) {
13380
- return typeof Node === "function" && value instanceof Node;
13381
- };
13382
- function _executeHooks(hooks2, currentNode, data) {
13383
- arrayForEach(hooks2, (hook) => {
13384
- hook.call(DOMPurify, currentNode, data, CONFIG);
13385
- });
13386
- }
13387
- const _sanitizeElements = function _sanitizeElements2(currentNode) {
13388
- let content2 = null;
13389
- _executeHooks(hooks.beforeSanitizeElements, currentNode, null);
13390
- if (_isClobbered(currentNode)) {
13391
- _forceRemove(currentNode);
13392
- return true;
13393
- }
13394
- const tagName = transformCaseFunc(currentNode.nodeName);
13395
- _executeHooks(hooks.uponSanitizeElement, currentNode, {
13396
- tagName,
13397
- allowedTags: ALLOWED_TAGS
13398
- });
13399
- if (SAFE_FOR_XML && currentNode.hasChildNodes() && !_isNode(currentNode.firstElementChild) && regExpTest(/<[/\w!]/g, currentNode.innerHTML) && regExpTest(/<[/\w!]/g, currentNode.textContent)) {
13400
- _forceRemove(currentNode);
13401
- return true;
13402
- }
13403
- if (SAFE_FOR_XML && currentNode.namespaceURI === HTML_NAMESPACE && tagName === "style" && _isNode(currentNode.firstElementChild)) {
13404
- _forceRemove(currentNode);
13405
- return true;
13406
- }
13407
- if (currentNode.nodeType === NODE_TYPE.progressingInstruction) {
13408
- _forceRemove(currentNode);
13409
- return true;
13410
- }
13411
- if (SAFE_FOR_XML && currentNode.nodeType === NODE_TYPE.comment && regExpTest(/<[/\w]/g, currentNode.data)) {
13412
- _forceRemove(currentNode);
13413
- return true;
13414
- }
13415
- if (FORBID_TAGS[tagName] || !(EXTRA_ELEMENT_HANDLING.tagCheck instanceof Function && EXTRA_ELEMENT_HANDLING.tagCheck(tagName)) && !ALLOWED_TAGS[tagName]) {
13416
- if (!FORBID_TAGS[tagName] && _isBasicCustomElement(tagName)) {
13417
- if (CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof RegExp && regExpTest(CUSTOM_ELEMENT_HANDLING.tagNameCheck, tagName)) {
13418
- return false;
13419
- }
13420
- if (CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof Function && CUSTOM_ELEMENT_HANDLING.tagNameCheck(tagName)) {
13421
- return false;
13422
- }
13423
- }
13424
- if (KEEP_CONTENT && !FORBID_CONTENTS[tagName]) {
13425
- const parentNode = getParentNode(currentNode) || currentNode.parentNode;
13426
- const childNodes = getChildNodes(currentNode) || currentNode.childNodes;
13427
- if (childNodes && parentNode) {
13428
- const childCount = childNodes.length;
13429
- for (let i = childCount - 1; i >= 0; --i) {
13430
- const childClone = cloneNode(childNodes[i], true);
13431
- parentNode.insertBefore(childClone, getNextSibling(currentNode));
13432
- }
13433
- }
13434
- }
13435
- _forceRemove(currentNode);
13436
- return true;
13437
- }
13438
- if (currentNode instanceof Element && !_checkValidNamespace(currentNode)) {
13439
- _forceRemove(currentNode);
13440
- return true;
13441
- }
13442
- if ((tagName === "noscript" || tagName === "noembed" || tagName === "noframes") && regExpTest(/<\/no(script|embed|frames)/i, currentNode.innerHTML)) {
13443
- _forceRemove(currentNode);
13444
- return true;
13445
- }
13446
- if (SAFE_FOR_TEMPLATES && currentNode.nodeType === NODE_TYPE.text) {
13447
- content2 = currentNode.textContent;
13448
- arrayForEach([MUSTACHE_EXPR2, ERB_EXPR2, TMPLIT_EXPR2], (expr) => {
13449
- content2 = stringReplace(content2, expr, " ");
13450
- });
13451
- if (currentNode.textContent !== content2) {
13452
- arrayPush(DOMPurify.removed, {
13453
- element: currentNode.cloneNode()
13454
- });
13455
- currentNode.textContent = content2;
13456
- }
13457
- }
13458
- _executeHooks(hooks.afterSanitizeElements, currentNode, null);
13459
- return false;
13460
- };
13461
- const _isValidAttribute = function _isValidAttribute2(lcTag, lcName, value) {
13462
- if (FORBID_ATTR[lcName]) {
13463
- return false;
13464
- }
13465
- if (SANITIZE_DOM && (lcName === "id" || lcName === "name") && (value in document2 || value in formElement)) {
13466
- return false;
13467
- }
13468
- if (ALLOW_DATA_ATTR && !FORBID_ATTR[lcName] && regExpTest(DATA_ATTR2, lcName)) ;
13469
- else if (ALLOW_ARIA_ATTR && regExpTest(ARIA_ATTR2, lcName)) ;
13470
- else if (EXTRA_ELEMENT_HANDLING.attributeCheck instanceof Function && EXTRA_ELEMENT_HANDLING.attributeCheck(lcName, lcTag)) ;
13471
- else if (!ALLOWED_ATTR[lcName] || FORBID_ATTR[lcName]) {
13472
- if (
13473
- // First condition does a very basic check if a) it's basically a valid custom element tagname AND
13474
- // b) if the tagName passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.tagNameCheck
13475
- // and c) if the attribute name passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.attributeNameCheck
13476
- _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
13477
- // the value passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.tagNameCheck
13478
- 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))
13479
- ) ;
13480
- else {
13481
- return false;
13482
- }
13483
- } else if (URI_SAFE_ATTRIBUTES[lcName]) ;
13484
- else if (regExpTest(IS_ALLOWED_URI$1, stringReplace(value, ATTR_WHITESPACE2, ""))) ;
13485
- else if ((lcName === "src" || lcName === "xlink:href" || lcName === "href") && lcTag !== "script" && stringIndexOf(value, "data:") === 0 && DATA_URI_TAGS[lcTag]) ;
13486
- else if (ALLOW_UNKNOWN_PROTOCOLS && !regExpTest(IS_SCRIPT_OR_DATA2, stringReplace(value, ATTR_WHITESPACE2, ""))) ;
13487
- else if (value) {
13488
- return false;
13489
- } else ;
13490
- return true;
13491
- };
13492
- 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"]);
13493
- const _isBasicCustomElement = function _isBasicCustomElement2(tagName) {
13494
- return !RESERVED_CUSTOM_ELEMENT_NAMES[stringToLowerCase(tagName)] && regExpTest(CUSTOM_ELEMENT2, tagName);
13495
- };
13496
- const _sanitizeAttributes = function _sanitizeAttributes2(currentNode) {
13497
- _executeHooks(hooks.beforeSanitizeAttributes, currentNode, null);
13498
- const {
13499
- attributes
13500
- } = currentNode;
13501
- if (!attributes || _isClobbered(currentNode)) {
13502
- return;
13503
- }
13504
- const hookEvent = {
13505
- attrName: "",
13506
- attrValue: "",
13507
- keepAttr: true,
13508
- allowedAttributes: ALLOWED_ATTR,
13509
- forceKeepAttr: void 0
13510
- };
13511
- let l = attributes.length;
13512
- while (l--) {
13513
- const attr = attributes[l];
13514
- const {
13515
- name,
13516
- namespaceURI,
13517
- value: attrValue
13518
- } = attr;
13519
- const lcName = transformCaseFunc(name);
13520
- const initValue = attrValue;
13521
- let value = name === "value" ? initValue : stringTrim(initValue);
13522
- hookEvent.attrName = lcName;
13523
- hookEvent.attrValue = value;
13524
- hookEvent.keepAttr = true;
13525
- hookEvent.forceKeepAttr = void 0;
13526
- _executeHooks(hooks.uponSanitizeAttribute, currentNode, hookEvent);
13527
- value = hookEvent.attrValue;
13528
- if (SANITIZE_NAMED_PROPS && (lcName === "id" || lcName === "name") && stringIndexOf(value, SANITIZE_NAMED_PROPS_PREFIX) !== 0) {
13529
- _removeAttribute(name, currentNode);
13530
- value = SANITIZE_NAMED_PROPS_PREFIX + value;
13531
- }
13532
- if (SAFE_FOR_XML && regExpTest(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i, value)) {
13533
- _removeAttribute(name, currentNode);
13534
- continue;
13535
- }
13536
- if (lcName === "attributename" && stringMatch(value, "href")) {
13537
- _removeAttribute(name, currentNode);
13538
- continue;
13539
- }
13540
- if (hookEvent.forceKeepAttr) {
13541
- continue;
13542
- }
13543
- if (!hookEvent.keepAttr) {
13544
- _removeAttribute(name, currentNode);
13545
- continue;
13546
- }
13547
- if (!ALLOW_SELF_CLOSE_IN_ATTR && regExpTest(/\/>/i, value)) {
13548
- _removeAttribute(name, currentNode);
13549
- continue;
13550
- }
13551
- if (SAFE_FOR_TEMPLATES) {
13552
- arrayForEach([MUSTACHE_EXPR2, ERB_EXPR2, TMPLIT_EXPR2], (expr) => {
13553
- value = stringReplace(value, expr, " ");
13554
- });
13555
- }
13556
- const lcTag = transformCaseFunc(currentNode.nodeName);
13557
- if (!_isValidAttribute(lcTag, lcName, value)) {
13558
- _removeAttribute(name, currentNode);
13559
- continue;
13560
- }
13561
- if (trustedTypesPolicy && typeof trustedTypes === "object" && typeof trustedTypes.getAttributeType === "function") {
13562
- if (namespaceURI) ;
13563
- else {
13564
- switch (trustedTypes.getAttributeType(lcTag, lcName)) {
13565
- case "TrustedHTML": {
13566
- value = trustedTypesPolicy.createHTML(value);
13567
- break;
13568
- }
13569
- case "TrustedScriptURL": {
13570
- value = trustedTypesPolicy.createScriptURL(value);
13571
- break;
13572
- }
13573
- }
13574
- }
13575
- }
13576
- if (value !== initValue) {
13577
- try {
13578
- if (namespaceURI) {
13579
- currentNode.setAttributeNS(namespaceURI, name, value);
13580
- } else {
13581
- currentNode.setAttribute(name, value);
13582
- }
13583
- if (_isClobbered(currentNode)) {
13584
- _forceRemove(currentNode);
13585
- } else {
13586
- arrayPop(DOMPurify.removed);
13587
- }
13588
- } catch (_) {
13589
- _removeAttribute(name, currentNode);
13590
- }
13591
- }
13592
- }
13593
- _executeHooks(hooks.afterSanitizeAttributes, currentNode, null);
13594
- };
13595
- const _sanitizeShadowDOM2 = function _sanitizeShadowDOM(fragment) {
13596
- let shadowNode = null;
13597
- const shadowIterator = _createNodeIterator(fragment);
13598
- _executeHooks(hooks.beforeSanitizeShadowDOM, fragment, null);
13599
- while (shadowNode = shadowIterator.nextNode()) {
13600
- _executeHooks(hooks.uponSanitizeShadowNode, shadowNode, null);
13601
- _sanitizeElements(shadowNode);
13602
- _sanitizeAttributes(shadowNode);
13603
- if (shadowNode.content instanceof DocumentFragment) {
13604
- _sanitizeShadowDOM2(shadowNode.content);
13605
- }
13606
- }
13607
- _executeHooks(hooks.afterSanitizeShadowDOM, fragment, null);
13608
- };
13609
- DOMPurify.sanitize = function(dirty) {
13610
- let cfg = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
13611
- let body2 = null;
13612
- let importedNode = null;
13613
- let currentNode = null;
13614
- let returnNode = null;
13615
- IS_EMPTY_INPUT = !dirty;
13616
- if (IS_EMPTY_INPUT) {
13617
- dirty = "<!-->";
13618
- }
13619
- if (typeof dirty !== "string" && !_isNode(dirty)) {
13620
- dirty = stringifyValue(dirty);
13621
- if (typeof dirty !== "string") {
13622
- throw typeErrorCreate("dirty is not a string, aborting");
13623
- }
13624
- }
13625
- if (!DOMPurify.isSupported) {
13626
- return dirty;
13627
- }
13628
- if (!SET_CONFIG) {
13629
- _parseConfig(cfg);
13630
- }
13631
- DOMPurify.removed = [];
13632
- if (typeof dirty === "string") {
13633
- IN_PLACE = false;
13634
- }
13635
- if (IN_PLACE) {
13636
- const nn = dirty.nodeName;
13637
- if (typeof nn === "string") {
13638
- const tagName = transformCaseFunc(nn);
13639
- if (!ALLOWED_TAGS[tagName] || FORBID_TAGS[tagName]) {
13640
- throw typeErrorCreate("root node is forbidden and cannot be sanitized in-place");
13641
- }
13642
- }
13643
- } else if (dirty instanceof Node) {
13644
- body2 = _initDocument("<!---->");
13645
- importedNode = body2.ownerDocument.importNode(dirty, true);
13646
- if (importedNode.nodeType === NODE_TYPE.element && importedNode.nodeName === "BODY") {
13647
- body2 = importedNode;
13648
- } else if (importedNode.nodeName === "HTML") {
13649
- body2 = importedNode;
13650
- } else {
13651
- body2.appendChild(importedNode);
13652
- }
13653
- } else {
13654
- if (!RETURN_DOM && !SAFE_FOR_TEMPLATES && !WHOLE_DOCUMENT && // eslint-disable-next-line unicorn/prefer-includes
13655
- dirty.indexOf("<") === -1) {
13656
- return trustedTypesPolicy && RETURN_TRUSTED_TYPE ? trustedTypesPolicy.createHTML(dirty) : dirty;
13657
- }
13658
- body2 = _initDocument(dirty);
13659
- if (!body2) {
13660
- return RETURN_DOM ? null : RETURN_TRUSTED_TYPE ? emptyHTML : "";
13661
- }
13662
- }
13663
- if (body2 && FORCE_BODY) {
13664
- _forceRemove(body2.firstChild);
13665
- }
13666
- const nodeIterator = _createNodeIterator(IN_PLACE ? dirty : body2);
13667
- while (currentNode = nodeIterator.nextNode()) {
13668
- _sanitizeElements(currentNode);
13669
- _sanitizeAttributes(currentNode);
13670
- if (currentNode.content instanceof DocumentFragment) {
13671
- _sanitizeShadowDOM2(currentNode.content);
13672
- }
13673
- }
13674
- if (IN_PLACE) {
13675
- return dirty;
13676
- }
13677
- if (RETURN_DOM) {
13678
- if (SAFE_FOR_TEMPLATES) {
13679
- body2.normalize();
13680
- let html2 = body2.innerHTML;
13681
- arrayForEach([MUSTACHE_EXPR2, ERB_EXPR2, TMPLIT_EXPR2], (expr) => {
13682
- html2 = stringReplace(html2, expr, " ");
13683
- });
13684
- body2.innerHTML = html2;
13685
- }
13686
- if (RETURN_DOM_FRAGMENT) {
13687
- returnNode = createDocumentFragment.call(body2.ownerDocument);
13688
- while (body2.firstChild) {
13689
- returnNode.appendChild(body2.firstChild);
13690
- }
13691
- } else {
13692
- returnNode = body2;
13693
- }
13694
- if (ALLOWED_ATTR.shadowroot || ALLOWED_ATTR.shadowrootmode) {
13695
- returnNode = importNode.call(originalDocument, returnNode, true);
13696
- }
13697
- return returnNode;
13698
- }
13699
- let serializedHTML = WHOLE_DOCUMENT ? body2.outerHTML : body2.innerHTML;
13700
- if (WHOLE_DOCUMENT && ALLOWED_TAGS["!doctype"] && body2.ownerDocument && body2.ownerDocument.doctype && body2.ownerDocument.doctype.name && regExpTest(DOCTYPE_NAME, body2.ownerDocument.doctype.name)) {
13701
- serializedHTML = "<!DOCTYPE " + body2.ownerDocument.doctype.name + ">\n" + serializedHTML;
13702
- }
13703
- if (SAFE_FOR_TEMPLATES) {
13704
- arrayForEach([MUSTACHE_EXPR2, ERB_EXPR2, TMPLIT_EXPR2], (expr) => {
13705
- serializedHTML = stringReplace(serializedHTML, expr, " ");
13706
- });
13707
- }
13708
- return trustedTypesPolicy && RETURN_TRUSTED_TYPE ? trustedTypesPolicy.createHTML(serializedHTML) : serializedHTML;
13709
- };
13710
- DOMPurify.setConfig = function() {
13711
- let cfg = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
13712
- _parseConfig(cfg);
13713
- SET_CONFIG = true;
13714
- };
13715
- DOMPurify.clearConfig = function() {
13716
- CONFIG = null;
13717
- SET_CONFIG = false;
13718
- };
13719
- DOMPurify.isValidAttribute = function(tag, attr, value) {
13720
- if (!CONFIG) {
13721
- _parseConfig({});
13722
- }
13723
- const lcTag = transformCaseFunc(tag);
13724
- const lcName = transformCaseFunc(attr);
13725
- return _isValidAttribute(lcTag, lcName, value);
13726
- };
13727
- DOMPurify.addHook = function(entryPoint, hookFunction) {
13728
- if (typeof hookFunction !== "function") {
13729
- return;
13730
- }
13731
- arrayPush(hooks[entryPoint], hookFunction);
13732
- };
13733
- DOMPurify.removeHook = function(entryPoint, hookFunction) {
13734
- if (hookFunction !== void 0) {
13735
- const index2 = arrayLastIndexOf(hooks[entryPoint], hookFunction);
13736
- return index2 === -1 ? void 0 : arraySplice(hooks[entryPoint], index2, 1)[0];
13737
- }
13738
- return arrayPop(hooks[entryPoint]);
13739
- };
13740
- DOMPurify.removeHooks = function(entryPoint) {
13741
- hooks[entryPoint] = [];
13742
- };
13743
- DOMPurify.removeAllHooks = function() {
13744
- hooks = _createHooksMap();
13745
- };
13746
- return DOMPurify;
13747
- }
13748
- var purify = createDOMPurify();
13749
12672
  function buildProcessor(plugins) {
13750
12673
  let proc = unified().use(remarkParse).use(remarkGfm);
13751
12674
  for (const plugin of plugins) {