@nsshunt/stsuxvue 0.0.3 → 0.0.5

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.
package/dist/stsuxvue.mjs CHANGED
@@ -8212,7 +8212,7 @@ var Filter = /* @__PURE__ */ function() {
8212
8212
  }();
8213
8213
  var ansi_to_html = Filter;
8214
8214
  const Convert = /* @__PURE__ */ getDefaultExportFromCjs(ansi_to_html);
8215
- /*! @license DOMPurify 3.1.0 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.1.0/LICENSE */
8215
+ /*! @license DOMPurify 3.1.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.1.3/LICENSE */
8216
8216
  const {
8217
8217
  entries,
8218
8218
  setPrototypeOf,
@@ -8261,6 +8261,7 @@ const stringTrim = unapply(String.prototype.trim);
8261
8261
  const objectHasOwnProperty = unapply(Object.prototype.hasOwnProperty);
8262
8262
  const regExpTest = unapply(RegExp.prototype.test);
8263
8263
  const typeErrorCreate = unconstruct(TypeError);
8264
+ const numberIsNaN = unapply(Number.isNaN);
8264
8265
  function unapply(func) {
8265
8266
  return function(thisArg) {
8266
8267
  for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
@@ -8381,6 +8382,23 @@ var EXPRESSIONS = /* @__PURE__ */ Object.freeze({
8381
8382
  DOCTYPE_NAME,
8382
8383
  CUSTOM_ELEMENT
8383
8384
  });
8385
+ const NODE_TYPE = {
8386
+ element: 1,
8387
+ attribute: 2,
8388
+ text: 3,
8389
+ cdataSection: 4,
8390
+ entityReference: 5,
8391
+ // Deprecated
8392
+ entityNode: 6,
8393
+ // Deprecated
8394
+ progressingInstruction: 7,
8395
+ comment: 8,
8396
+ document: 9,
8397
+ documentType: 10,
8398
+ documentFragment: 11,
8399
+ notation: 12
8400
+ // Deprecated
8401
+ };
8384
8402
  const getGlobal = function getGlobal2() {
8385
8403
  return typeof window === "undefined" ? null : window;
8386
8404
  };
@@ -8411,9 +8429,9 @@ const _createTrustedTypesPolicy = function _createTrustedTypesPolicy2(trustedTyp
8411
8429
  function createDOMPurify() {
8412
8430
  let window2 = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : getGlobal();
8413
8431
  const DOMPurify = (root) => createDOMPurify(root);
8414
- DOMPurify.version = "3.1.0";
8432
+ DOMPurify.version = "3.1.3";
8415
8433
  DOMPurify.removed = [];
8416
- if (!window2 || !window2.document || window2.document.nodeType !== 9) {
8434
+ if (!window2 || !window2.document || window2.document.nodeType !== NODE_TYPE.document) {
8417
8435
  DOMPurify.isSupported = false;
8418
8436
  return DOMPurify;
8419
8437
  }
@@ -8532,6 +8550,7 @@ function createDOMPurify() {
8532
8550
  const DEFAULT_PARSER_MEDIA_TYPE = "text/html";
8533
8551
  let transformCaseFunc = null;
8534
8552
  let CONFIG = null;
8553
+ const MAX_NESTING_DEPTH = 255;
8535
8554
  const formElement = document2.createElement("form");
8536
8555
  const isRegexOrFunction = function isRegexOrFunction2(testValue) {
8537
8556
  return testValue instanceof RegExp || testValue instanceof Function;
@@ -8681,7 +8700,7 @@ function createDOMPurify() {
8681
8700
  CONFIG = cfg;
8682
8701
  };
8683
8702
  const MATHML_TEXT_INTEGRATION_POINTS = addToSet({}, ["mi", "mo", "mn", "ms", "mtext"]);
8684
- const HTML_INTEGRATION_POINTS = addToSet({}, ["foreignobject", "desc", "title", "annotation-xml"]);
8703
+ const HTML_INTEGRATION_POINTS = addToSet({}, ["foreignobject", "annotation-xml"]);
8685
8704
  const COMMON_SVG_AND_HTML_ELEMENTS = addToSet({}, ["title", "style", "font", "a", "script"]);
8686
8705
  const ALL_SVG_TAGS = addToSet({}, [...svg$1, ...svgFilters, ...svgDisallowed]);
8687
8706
  const ALL_MATHML_TAGS = addToSet({}, [...mathMl$1, ...mathMlDisallowed]);
@@ -8812,7 +8831,9 @@ function createDOMPurify() {
8812
8831
  );
8813
8832
  };
8814
8833
  const _isClobbered = function _isClobbered2(elm) {
8815
- return elm instanceof HTMLFormElement && (typeof elm.nodeName !== "string" || typeof elm.textContent !== "string" || typeof elm.removeChild !== "function" || !(elm.attributes instanceof NamedNodeMap) || typeof elm.removeAttribute !== "function" || typeof elm.setAttribute !== "function" || typeof elm.namespaceURI !== "string" || typeof elm.insertBefore !== "function" || typeof elm.hasChildNodes !== "function");
8834
+ return elm instanceof HTMLFormElement && // eslint-disable-next-line unicorn/no-typeof-undefined
8835
+ (typeof elm.__depth !== "undefined" && typeof elm.__depth !== "number" || // eslint-disable-next-line unicorn/no-typeof-undefined
8836
+ typeof elm.__removalCount !== "undefined" && typeof elm.__removalCount !== "number" || typeof elm.nodeName !== "string" || typeof elm.textContent !== "string" || typeof elm.removeChild !== "function" || !(elm.attributes instanceof NamedNodeMap) || typeof elm.removeAttribute !== "function" || typeof elm.setAttribute !== "function" || typeof elm.namespaceURI !== "string" || typeof elm.insertBefore !== "function" || typeof elm.hasChildNodes !== "function");
8816
8837
  };
8817
8838
  const _isNode = function _isNode2(object) {
8818
8839
  return typeof Node === "function" && object instanceof Node;
@@ -8841,11 +8862,11 @@ function createDOMPurify() {
8841
8862
  _forceRemove(currentNode);
8842
8863
  return true;
8843
8864
  }
8844
- if (currentNode.nodeType === 7) {
8865
+ if (currentNode.nodeType === NODE_TYPE.progressingInstruction) {
8845
8866
  _forceRemove(currentNode);
8846
8867
  return true;
8847
8868
  }
8848
- if (SAFE_FOR_XML && currentNode.nodeType === 8 && regExpTest(/<[/\w]/g, currentNode.data)) {
8869
+ if (SAFE_FOR_XML && currentNode.nodeType === NODE_TYPE.comment && regExpTest(/<[/\w]/g, currentNode.data)) {
8849
8870
  _forceRemove(currentNode);
8850
8871
  return true;
8851
8872
  }
@@ -8864,7 +8885,9 @@ function createDOMPurify() {
8864
8885
  if (childNodes && parentNode) {
8865
8886
  const childCount = childNodes.length;
8866
8887
  for (let i = childCount - 1; i >= 0; --i) {
8867
- parentNode.insertBefore(cloneNode(childNodes[i], true), getNextSibling(currentNode));
8888
+ const childClone = cloneNode(childNodes[i], true);
8889
+ childClone.__removalCount = (currentNode.__removalCount || 0) + 1;
8890
+ parentNode.insertBefore(childClone, getNextSibling(currentNode));
8868
8891
  }
8869
8892
  }
8870
8893
  }
@@ -8879,7 +8902,7 @@ function createDOMPurify() {
8879
8902
  _forceRemove(currentNode);
8880
8903
  return true;
8881
8904
  }
8882
- if (SAFE_FOR_TEMPLATES && currentNode.nodeType === 3) {
8905
+ if (SAFE_FOR_TEMPLATES && currentNode.nodeType === NODE_TYPE.text) {
8883
8906
  content = currentNode.textContent;
8884
8907
  arrayForEach([MUSTACHE_EXPR2, ERB_EXPR2, TMPLIT_EXPR2], (expr) => {
8885
8908
  content = stringReplace(content, expr, " ");
@@ -8895,7 +8918,7 @@ function createDOMPurify() {
8895
8918
  return false;
8896
8919
  };
8897
8920
  const _isValidAttribute = function _isValidAttribute2(lcTag, lcName, value) {
8898
- if (SANITIZE_DOM && (lcName === "id" || lcName === "name") && (value in document2 || value in formElement)) {
8921
+ if (SANITIZE_DOM && (lcName === "id" || lcName === "name") && (value in document2 || value in formElement || value === "__depth" || value === "__removalCount")) {
8899
8922
  return false;
8900
8923
  }
8901
8924
  if (ALLOW_DATA_ATTR && !FORBID_ATTR[lcName] && regExpTest(DATA_ATTR2, lcName))
@@ -8973,6 +8996,10 @@ function createDOMPurify() {
8973
8996
  _removeAttribute(name, currentNode);
8974
8997
  continue;
8975
8998
  }
8999
+ if (SAFE_FOR_XML && regExpTest(/((--!?|])>)|<\/(style|title)/i, value)) {
9000
+ _removeAttribute(name, currentNode);
9001
+ continue;
9002
+ }
8976
9003
  if (SAFE_FOR_TEMPLATES) {
8977
9004
  arrayForEach([MUSTACHE_EXPR2, ERB_EXPR2, TMPLIT_EXPR2], (expr) => {
8978
9005
  value = stringReplace(value, expr, " ");
@@ -9008,7 +9035,11 @@ function createDOMPurify() {
9008
9035
  } else {
9009
9036
  currentNode.setAttribute(name, value);
9010
9037
  }
9011
- arrayPop(DOMPurify.removed);
9038
+ if (_isClobbered(currentNode)) {
9039
+ _forceRemove(currentNode);
9040
+ } else {
9041
+ arrayPop(DOMPurify.removed);
9042
+ }
9012
9043
  } catch (_) {
9013
9044
  }
9014
9045
  }
@@ -9023,7 +9054,19 @@ function createDOMPurify() {
9023
9054
  if (_sanitizeElements(shadowNode)) {
9024
9055
  continue;
9025
9056
  }
9057
+ const parentNode = getParentNode(shadowNode);
9058
+ if (shadowNode.nodeType === NODE_TYPE.element) {
9059
+ if (parentNode && parentNode.__depth) {
9060
+ shadowNode.__depth = (shadowNode.__removalCount || 0) + parentNode.__depth + 1;
9061
+ } else {
9062
+ shadowNode.__depth = 1;
9063
+ }
9064
+ }
9065
+ if (shadowNode.__depth >= MAX_NESTING_DEPTH || shadowNode.__depth < 0 || numberIsNaN(shadowNode.__depth)) {
9066
+ _forceRemove(shadowNode);
9067
+ }
9026
9068
  if (shadowNode.content instanceof DocumentFragment) {
9069
+ shadowNode.content.__depth = shadowNode.__depth;
9027
9070
  _sanitizeShadowDOM2(shadowNode.content);
9028
9071
  }
9029
9072
  _sanitizeAttributes(shadowNode);
@@ -9070,7 +9113,7 @@ function createDOMPurify() {
9070
9113
  } else if (dirty instanceof Node) {
9071
9114
  body = _initDocument("<!---->");
9072
9115
  importedNode = body.ownerDocument.importNode(dirty, true);
9073
- if (importedNode.nodeType === 1 && importedNode.nodeName === "BODY") {
9116
+ if (importedNode.nodeType === NODE_TYPE.element && importedNode.nodeName === "BODY") {
9074
9117
  body = importedNode;
9075
9118
  } else if (importedNode.nodeName === "HTML") {
9076
9119
  body = importedNode;
@@ -9095,7 +9138,19 @@ function createDOMPurify() {
9095
9138
  if (_sanitizeElements(currentNode)) {
9096
9139
  continue;
9097
9140
  }
9141
+ const parentNode = getParentNode(currentNode);
9142
+ if (currentNode.nodeType === NODE_TYPE.element) {
9143
+ if (parentNode && parentNode.__depth) {
9144
+ currentNode.__depth = (currentNode.__removalCount || 0) + parentNode.__depth + 1;
9145
+ } else {
9146
+ currentNode.__depth = 1;
9147
+ }
9148
+ }
9149
+ if (currentNode.__depth >= MAX_NESTING_DEPTH || currentNode.__depth < 0 || numberIsNaN(currentNode.__depth)) {
9150
+ _forceRemove(currentNode);
9151
+ }
9098
9152
  if (currentNode.content instanceof DocumentFragment) {
9153
+ currentNode.content.__depth = currentNode.__depth;
9099
9154
  _sanitizeShadowDOM(currentNode.content);
9100
9155
  }
9101
9156
  _sanitizeAttributes(currentNode);