@mulmoclaude/core 7.2.1 → 7.3.1
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/assets/helps/collection-skills.md +8 -0
- package/dist/collection/core/schemaZ.d.ts +8 -0
- package/dist/collection/registry/server/index.cjs +2 -2
- package/dist/collection/registry/server/index.js +2 -2
- package/dist/collection/server/index.cjs +2 -2
- package/dist/collection/server/index.js +2 -2
- package/dist/collection-watchers/index.cjs +2 -2
- package/dist/collection-watchers/index.js +2 -2
- package/dist/{discovery-D3e3JaAv.cjs → discovery-DxmMcpFo.cjs} +5 -1
- package/dist/{discovery-D3e3JaAv.cjs.map → discovery-DxmMcpFo.cjs.map} +1 -1
- package/dist/{discovery-BIQY56d1.js → discovery-RyuhNKjx.js} +5 -1
- package/dist/{discovery-BIQY56d1.js.map → discovery-RyuhNKjx.js.map} +1 -1
- package/dist/feeds/server/index.cjs +2 -2
- package/dist/feeds/server/index.js +2 -2
- package/dist/google/index.cjs +1 -1
- package/dist/google/index.js +1 -1
- package/dist/plugin-vue/index.cjs +185 -31
- package/dist/plugin-vue/index.cjs.map +1 -1
- package/dist/plugin-vue/index.js +185 -31
- package/dist/plugin-vue/index.js.map +1 -1
- package/dist/{server-BGxmZppB.cjs → server-ZKTtI8_W.cjs} +2 -2
- package/dist/{server-BGxmZppB.cjs.map → server-ZKTtI8_W.cjs.map} +1 -1
- package/dist/{server-MKJPGYKI.js → server-xdXBsiba.js} +2 -2
- package/dist/{server-MKJPGYKI.js.map → server-xdXBsiba.js.map} +1 -1
- package/package.json +2 -2
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
2
|
const require_rolldown_runtime = require("../../rolldown-runtime-CmQyd0Gu.cjs");
|
|
3
|
-
const require_server = require("../../server-
|
|
4
|
-
const require_discovery = require("../../discovery-
|
|
3
|
+
const require_server = require("../../server-ZKTtI8_W.cjs");
|
|
4
|
+
const require_discovery = require("../../discovery-DxmMcpFo.cjs");
|
|
5
5
|
const require_feeds_paths = require("../paths.cjs");
|
|
6
6
|
const require_itemId = require("../../itemId-D2XAQ8RU.cjs");
|
|
7
7
|
const require_project = require("../../project-DDTIVEMU.cjs");
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { F as buildCollectionActionSeedPrompt, I as promptPathsFor, z as readSkillTemplate } from "../../server-
|
|
2
|
-
import { W as resolveDataDir, _t as createForwardingLogger, d as storeFor, k as listItems, n as discoverCollections, q as safeSlugName, vt as createHostSlot } from "../../discovery-
|
|
1
|
+
import { F as buildCollectionActionSeedPrompt, I as promptPathsFor, z as readSkillTemplate } from "../../server-xdXBsiba.js";
|
|
2
|
+
import { W as resolveDataDir, _t as createForwardingLogger, d as storeFor, k as listItems, n as discoverCollections, q as safeSlugName, vt as createHostSlot } from "../../discovery-RyuhNKjx.js";
|
|
3
3
|
import { FEEDS_DIR, feedDir, feedStatePath, feedsRoot, ingestStateDir, ingestStatePath } from "../paths.js";
|
|
4
4
|
import { J as INGEST_KINDS, q as FEED_SCHEDULES } from "../../itemId-D_pSpa3U.js";
|
|
5
5
|
import { t as mergeIntoExisting } from "../../project-mU6-xLfy.js";
|
package/dist/google/index.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
2
|
const require_rolldown_runtime = require("../rolldown-runtime-CmQyd0Gu.cjs");
|
|
3
|
-
const require_discovery = require("../discovery-
|
|
3
|
+
const require_discovery = require("../discovery-DxmMcpFo.cjs");
|
|
4
4
|
require("../errors-B9mCEVG9.cjs");
|
|
5
5
|
const require_itemId = require("../itemId-D2XAQ8RU.cjs");
|
|
6
6
|
const require_text = require("../text-BQiyo5R9.cjs");
|
package/dist/google/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { _t as createForwardingLogger, d as storeFor, n as discoverCollections, rt as getWorkspaceRoot, vt as createHostSlot } from "../discovery-
|
|
1
|
+
import { _t as createForwardingLogger, d as storeFor, n as discoverCollections, rt as getWorkspaceRoot, vt as createHostSlot } from "../discovery-RyuhNKjx.js";
|
|
2
2
|
import "../errors-0QwjDxsv.js";
|
|
3
3
|
import { f as parseIsoDate, p as parseIsoDateTime } from "../itemId-D_pSpa3U.js";
|
|
4
4
|
import { t as truncate } from "../text-BQAuwKVj.js";
|
|
@@ -132,7 +132,7 @@ IconGlyph.props = {
|
|
|
132
132
|
fontClass: String
|
|
133
133
|
};
|
|
134
134
|
// ../../node_modules/dompurify/dist/purify.es.mjs
|
|
135
|
-
/*! @license DOMPurify 3.
|
|
135
|
+
/*! @license DOMPurify 3.5.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.5.0/LICENSE */
|
|
136
136
|
function _OverloadYield(e, d) {
|
|
137
137
|
this.v = e, this.k = d;
|
|
138
138
|
}
|
|
@@ -262,6 +262,10 @@ var arrayIsArray = Array.isArray;
|
|
|
262
262
|
var setCreate = unconstruct(Set);
|
|
263
263
|
var setAdd = unapply(Set.prototype.add);
|
|
264
264
|
var setHas = unapply(Set.prototype.has);
|
|
265
|
+
var setDelete = unapply(Set.prototype.delete);
|
|
266
|
+
var mapCreate = unconstruct(Map);
|
|
267
|
+
var mapGet = unapply(Map.prototype.get);
|
|
268
|
+
var mapSet = unapply(Map.prototype.set);
|
|
265
269
|
var stringToLowerCase = unapply(String.prototype.toLowerCase);
|
|
266
270
|
var stringToString = unapply(String.prototype.toString);
|
|
267
271
|
var stringMatch = unapply(String.prototype.match);
|
|
@@ -1097,7 +1101,9 @@ var xml = freeze([
|
|
|
1097
1101
|
var MUSTACHE_EXPR = seal(/{{[\w\W]*|^[\w\W]*}}/g);
|
|
1098
1102
|
var ERB_EXPR = seal(/<%[\w\W]*|^[\w\W]*%>/g);
|
|
1099
1103
|
var TMPLIT_EXPR = seal(/\${[\w\W]*/g);
|
|
1100
|
-
var
|
|
1104
|
+
var TMPL_MARKER = seal(/{{|}}|\${|<%|%>/);
|
|
1105
|
+
var NON_WHITESPACE = seal(/[^\t\n\f\r ]/);
|
|
1106
|
+
var NUL = seal(/\u0000/g);
|
|
1101
1107
|
var DATA_ATTR = seal(/^data-[\-\w.\u00B7-\uFFFF]+$/);
|
|
1102
1108
|
var ARIA_ATTR = seal(/^aria-[\-\w]+$/);
|
|
1103
1109
|
var IS_ALLOWED_URI = seal(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i);
|
|
@@ -1107,6 +1113,7 @@ var DOCTYPE_NAME = seal(/^html$/i);
|
|
|
1107
1113
|
var CUSTOM_ELEMENT = seal(/^[a-z][.\w]*(-[.\w]+)+$/i);
|
|
1108
1114
|
var ELEMENT_MARKUP_PROBE = seal(/<[/\w!]/g);
|
|
1109
1115
|
var COMMENT_MARKUP_PROBE = seal(/<[/\w]/g);
|
|
1116
|
+
var COMMENT_UNSAFE = seal(/<[/\w]|^-?>|--!?>|<!-$/g);
|
|
1110
1117
|
var FALLBACK_TAG_CLOSE = seal(/<\/no(script|embed|frames)/i);
|
|
1111
1118
|
var SELF_CLOSING_TAG = seal(/\/>/i);
|
|
1112
1119
|
var ATTR_VALUE_BREAKOUT = seal(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i);
|
|
@@ -1129,6 +1136,27 @@ var LITERAL_TEXT_ELEMENTS = freeze(addToSet({}, [
|
|
|
1129
1136
|
"plaintext",
|
|
1130
1137
|
"noscript"
|
|
1131
1138
|
]));
|
|
1139
|
+
var ESCAPABLE_TEXT_ELEMENTS = freeze(addToSet({}, ["textarea", "title"]));
|
|
1140
|
+
var VOID_ELEMENTS = freeze(addToSet({}, [
|
|
1141
|
+
"area",
|
|
1142
|
+
"base",
|
|
1143
|
+
"basefont",
|
|
1144
|
+
"bgsound",
|
|
1145
|
+
"br",
|
|
1146
|
+
"col",
|
|
1147
|
+
"embed",
|
|
1148
|
+
"frame",
|
|
1149
|
+
"hr",
|
|
1150
|
+
"img",
|
|
1151
|
+
"input",
|
|
1152
|
+
"keygen",
|
|
1153
|
+
"link",
|
|
1154
|
+
"meta",
|
|
1155
|
+
"param",
|
|
1156
|
+
"source",
|
|
1157
|
+
"track",
|
|
1158
|
+
"wbr"
|
|
1159
|
+
]));
|
|
1132
1160
|
var getGlobal = function getGlobal() {
|
|
1133
1161
|
return typeof window === "undefined" ? null : window;
|
|
1134
1162
|
};
|
|
@@ -1200,7 +1228,7 @@ var _resolveObjectOption = function _resolveObjectOption(cfg, key, fallback) {
|
|
|
1200
1228
|
function createDOMPurify() {
|
|
1201
1229
|
let window = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : getGlobal();
|
|
1202
1230
|
const DOMPurify = (root) => createDOMPurify(root);
|
|
1203
|
-
DOMPurify.version = "3.
|
|
1231
|
+
DOMPurify.version = "3.5.0";
|
|
1204
1232
|
DOMPurify.removed = [];
|
|
1205
1233
|
if (!window || !window.document || window.document.nodeType !== NODE_TYPE.document || !window.Element) {
|
|
1206
1234
|
DOMPurify.isSupported = false;
|
|
@@ -1213,6 +1241,7 @@ function createDOMPurify() {
|
|
|
1213
1241
|
const ElementPrototype = Element.prototype;
|
|
1214
1242
|
const cloneNode = lookupGetter(ElementPrototype, "cloneNode");
|
|
1215
1243
|
const remove = lookupGetter(ElementPrototype, "remove");
|
|
1244
|
+
const removeChild = lookupGetter(ElementPrototype, "removeChild");
|
|
1216
1245
|
const removeAttributeNode = lookupGetter(ElementPrototype, "removeAttributeNode");
|
|
1217
1246
|
const getNextSibling = lookupGetter(ElementPrototype, "nextSibling");
|
|
1218
1247
|
const getChildNodes = lookupGetter(ElementPrototype, "childNodes");
|
|
@@ -1232,6 +1261,9 @@ function createDOMPurify() {
|
|
|
1232
1261
|
const _readNamespaceURI = function _readNamespaceURI(element) {
|
|
1233
1262
|
return getNamespaceURI ? getNamespaceURI(element) : element.namespaceURI;
|
|
1234
1263
|
};
|
|
1264
|
+
const _readAttributes = function _readAttributes(node) {
|
|
1265
|
+
return _readNodeType(node) === NODE_TYPE.element ? getAttributes(node) : null;
|
|
1266
|
+
};
|
|
1235
1267
|
if (typeof HTMLTemplateElement === "function") {
|
|
1236
1268
|
const template = document.createElement("template");
|
|
1237
1269
|
if (template.content && template.content.ownerDocument) document = template.content.ownerDocument;
|
|
@@ -1337,6 +1369,7 @@ function createDOMPurify() {
|
|
|
1337
1369
|
let KEEP_CONTENT = true;
|
|
1338
1370
|
let IN_PLACE = false;
|
|
1339
1371
|
let IN_PLACE_VISITED = null;
|
|
1372
|
+
let IN_PLACE_RETURNS = null;
|
|
1340
1373
|
let USE_PROFILES = false;
|
|
1341
1374
|
let FORBID_CONTENTS = null;
|
|
1342
1375
|
const DEFAULT_FORBID_CONTENTS = addToSet({}, [
|
|
@@ -1427,6 +1460,7 @@ function createDOMPurify() {
|
|
|
1427
1460
|
const DEFAULT_PARSER_MEDIA_TYPE = "text/html";
|
|
1428
1461
|
let transformCaseFunc = null;
|
|
1429
1462
|
let CONFIG = null;
|
|
1463
|
+
let ACTIVE_CONFIG = null;
|
|
1430
1464
|
const formElement = document.createElement("form");
|
|
1431
1465
|
const isRegexOrFunction = function isRegexOrFunction(testValue) {
|
|
1432
1466
|
return testValue instanceof RegExp || testValue instanceof Function;
|
|
@@ -1632,6 +1666,7 @@ function createDOMPurify() {
|
|
|
1632
1666
|
*/
|
|
1633
1667
|
const _forceRemove = function _forceRemove(node) {
|
|
1634
1668
|
arrayPush(DOMPurify.removed, { element: node });
|
|
1669
|
+
_unmarkVisited(node);
|
|
1635
1670
|
try {
|
|
1636
1671
|
getParentNode(node).removeChild(node);
|
|
1637
1672
|
} catch (_) {
|
|
@@ -1670,7 +1705,7 @@ function createDOMPurify() {
|
|
|
1670
1705
|
const childNodes = getChildNodes(root);
|
|
1671
1706
|
if (childNodes) arrayForEach(arraySlice(childNodes), (child) => {
|
|
1672
1707
|
try {
|
|
1673
|
-
|
|
1708
|
+
removeChild(root, child);
|
|
1674
1709
|
} catch (_) {}
|
|
1675
1710
|
});
|
|
1676
1711
|
if (_readNodeType(root) === NODE_TYPE.element) _stripAttributes(root, false);
|
|
@@ -1808,6 +1843,18 @@ function createDOMPurify() {
|
|
|
1808
1843
|
_neutralizeEscapedElements(root, before);
|
|
1809
1844
|
return rootRemoved;
|
|
1810
1845
|
};
|
|
1846
|
+
/**
|
|
1847
|
+
* Fail-closed teardown of an in-place tree that cannot be returned: empties
|
|
1848
|
+
* the root and neutralizes everything that was under it, open shadow roots
|
|
1849
|
+
* included.
|
|
1850
|
+
*
|
|
1851
|
+
* @param root the in-place root
|
|
1852
|
+
* @param before the root's nodes, collected before the walk
|
|
1853
|
+
*/
|
|
1854
|
+
const _failClosed = function _failClosed(root, before) {
|
|
1855
|
+
_neutralizeRoot(root);
|
|
1856
|
+
_neutralizeDiscarded(root, before);
|
|
1857
|
+
};
|
|
1811
1858
|
const MAX_UNVISITED_ROUNDS = 8;
|
|
1812
1859
|
/**
|
|
1813
1860
|
* The walk only moves forward, so a node moved to a position it already
|
|
@@ -1864,11 +1911,28 @@ function createDOMPurify() {
|
|
|
1864
1911
|
};
|
|
1865
1912
|
/**
|
|
1866
1913
|
* Records that _sanitizeElements processed `node`. No-op outside IN_PLACE.
|
|
1914
|
+
* Fails closed when a node that left the tree comes back too often.
|
|
1867
1915
|
*
|
|
1868
1916
|
* @param node the node being processed
|
|
1869
1917
|
*/
|
|
1870
1918
|
const _markVisited = function _markVisited(node) {
|
|
1871
|
-
if (IN_PLACE_VISITED)
|
|
1919
|
+
if (!IN_PLACE_VISITED) return;
|
|
1920
|
+
setAdd(IN_PLACE_VISITED, node);
|
|
1921
|
+
const returns = mapGet(IN_PLACE_RETURNS, node);
|
|
1922
|
+
if (returns === void 0) return;
|
|
1923
|
+
if (returns >= MAX_UNVISITED_ROUNDS) throw typeErrorCreate("the tree kept changing during in-place sanitization; refusing to return it");
|
|
1924
|
+
mapSet(IN_PLACE_RETURNS, node, returns + 1);
|
|
1925
|
+
};
|
|
1926
|
+
/**
|
|
1927
|
+
* Forgets that `node` was processed: it was removed or detached. If a hook
|
|
1928
|
+
* or custom element puts it back, _sanitizeUnvisitedNodes handles it again.
|
|
1929
|
+
*
|
|
1930
|
+
* @param node the node that left the tree
|
|
1931
|
+
*/
|
|
1932
|
+
const _unmarkVisited = function _unmarkVisited(node) {
|
|
1933
|
+
if (!IN_PLACE_VISITED) return;
|
|
1934
|
+
setDelete(IN_PLACE_VISITED, node);
|
|
1935
|
+
if (mapGet(IN_PLACE_RETURNS, node) === void 0) mapSet(IN_PLACE_RETURNS, node, 0);
|
|
1872
1936
|
};
|
|
1873
1937
|
/**
|
|
1874
1938
|
* Patch-linkage attributes (declarative partial updates): `patchsrc`
|
|
@@ -1991,6 +2055,47 @@ function createDOMPurify() {
|
|
|
1991
2055
|
if (_isDocumentFragment(tmpl.content)) _scrubTemplateExpressions2(tmpl.content);
|
|
1992
2056
|
});
|
|
1993
2057
|
};
|
|
2058
|
+
const TABLE_STRUCTURE = "table,tbody,thead,tfoot,tr,colgroup";
|
|
2059
|
+
const TABLE_CONTENT = addToSet({}, [
|
|
2060
|
+
"caption",
|
|
2061
|
+
"colgroup",
|
|
2062
|
+
"col",
|
|
2063
|
+
"thead",
|
|
2064
|
+
"tbody",
|
|
2065
|
+
"tfoot",
|
|
2066
|
+
"tr",
|
|
2067
|
+
"td",
|
|
2068
|
+
"th",
|
|
2069
|
+
"style",
|
|
2070
|
+
"script",
|
|
2071
|
+
"template"
|
|
2072
|
+
]);
|
|
2073
|
+
/**
|
|
2074
|
+
* Moves content the HTML parser would foster-parent to where it would put
|
|
2075
|
+
* it: in front of the table. Only a tree the parser did not build, or one
|
|
2076
|
+
* changed after the parse, holds such content. Without this, a reparse
|
|
2077
|
+
* reorders the text and can join fragments that were not neighbours.
|
|
2078
|
+
*
|
|
2079
|
+
* @param root The root whose tables should be checked.
|
|
2080
|
+
*/
|
|
2081
|
+
const _fosterTableContent = function _fosterTableContent(root) {
|
|
2082
|
+
var _root$querySelectorAl;
|
|
2083
|
+
if (PARSER_MEDIA_TYPE === "application/xhtml+xml") return;
|
|
2084
|
+
const structures = (_root$querySelectorAl = root.querySelectorAll) === null || _root$querySelectorAl === void 0 ? void 0 : _root$querySelectorAl.call(root, TABLE_STRUCTURE);
|
|
2085
|
+
if (!structures || structures.length === 0) return;
|
|
2086
|
+
arrayForEach(structures, (structure) => {
|
|
2087
|
+
arrayForEach(arraySlice(getChildNodes(structure)), (child) => {
|
|
2088
|
+
const nodeType = _readNodeType(child);
|
|
2089
|
+
if (!(nodeType === NODE_TYPE.text ? regExpTest(NON_WHITESPACE, child.data) : nodeType === NODE_TYPE.element && !TABLE_CONTENT[stringToLowerCase(_readNodeName(child))])) return;
|
|
2090
|
+
let table = structure;
|
|
2091
|
+
while (table && stringToLowerCase(_readNodeName(table)) !== "table") table = table === root ? null : getParentNode(table);
|
|
2092
|
+
const tableParent = table && table !== root ? getParentNode(table) : null;
|
|
2093
|
+
if (tableParent) try {
|
|
2094
|
+
tableParent.insertBefore(child, table);
|
|
2095
|
+
} catch (_) {}
|
|
2096
|
+
});
|
|
2097
|
+
});
|
|
2098
|
+
};
|
|
1994
2099
|
/**
|
|
1995
2100
|
* Normalizes `node` and strips template expressions from its own character
|
|
1996
2101
|
* data. Template contents and shadow roots are not entered, their own
|
|
@@ -1999,11 +2104,28 @@ function createDOMPurify() {
|
|
|
1999
2104
|
* @param node The root whose own character data should be scrubbed.
|
|
2000
2105
|
*/
|
|
2001
2106
|
const _scrubOwnCharacterData = function _scrubOwnCharacterData(node) {
|
|
2107
|
+
_fosterTableContent(node);
|
|
2002
2108
|
node.normalize();
|
|
2003
2109
|
const walker = _createNodeIterator(node, true);
|
|
2110
|
+
let previousText = null;
|
|
2004
2111
|
let currentNode = walker.nextNode();
|
|
2005
2112
|
while (currentNode) {
|
|
2006
|
-
|
|
2113
|
+
let data = currentNode.data;
|
|
2114
|
+
if (regExpTest(NUL, data)) {
|
|
2115
|
+
data = stringReplace(data, NUL, "");
|
|
2116
|
+
currentNode.data = data;
|
|
2117
|
+
}
|
|
2118
|
+
if (regExpTest(TMPL_MARKER, data)) {
|
|
2119
|
+
data = _stripTemplateExpressions(data);
|
|
2120
|
+
currentNode.data = data;
|
|
2121
|
+
}
|
|
2122
|
+
if (data && _readNodeType(currentNode) === NODE_TYPE.text) {
|
|
2123
|
+
if (previousText) {
|
|
2124
|
+
const tail = previousText.data;
|
|
2125
|
+
if (regExpTest(TMPL_MARKER, tail[tail.length - 1] + data[0])) previousText.data = _stripTemplateExpressions(tail + data[0]);
|
|
2126
|
+
}
|
|
2127
|
+
previousText = currentNode;
|
|
2128
|
+
}
|
|
2007
2129
|
currentNode = walker.nextNode();
|
|
2008
2130
|
}
|
|
2009
2131
|
};
|
|
@@ -2050,6 +2172,27 @@ function createDOMPurify() {
|
|
|
2050
2172
|
});
|
|
2051
2173
|
}
|
|
2052
2174
|
/**
|
|
2175
|
+
* Elements in a state the HTML parser never produces: a void element with
|
|
2176
|
+
* children, a text-only element with an element child or, for literal-text
|
|
2177
|
+
* elements, with markup-like text. See VOID_ELEMENTS, LITERAL_TEXT_ELEMENTS
|
|
2178
|
+
* and ESCAPABLE_TEXT_ELEMENTS. Reads textContent, as an XML document
|
|
2179
|
+
* escapes innerHTML. Elements only: a processing instruction's nodeName is
|
|
2180
|
+
* its target and can collide with these names.
|
|
2181
|
+
*
|
|
2182
|
+
* @param currentNode the element to inspect
|
|
2183
|
+
* @param tagName the element's transformCaseFunc'd tag name
|
|
2184
|
+
* @return true if the element must be removed
|
|
2185
|
+
*/
|
|
2186
|
+
const _isMalformedElement = function _isMalformedElement(currentNode, tagName) {
|
|
2187
|
+
const isVoid = Boolean(VOID_ELEMENTS[tagName]);
|
|
2188
|
+
const literal = Boolean(LITERAL_TEXT_ELEMENTS[tagName]);
|
|
2189
|
+
if (!isVoid && !literal && !ESCAPABLE_TEXT_ELEMENTS[tagName]) return false;
|
|
2190
|
+
if (_readNamespaceURI(currentNode) !== HTML_NAMESPACE) return false;
|
|
2191
|
+
if (isVoid) return currentNode.hasChildNodes();
|
|
2192
|
+
if (_isNode(currentNode.firstElementChild)) return true;
|
|
2193
|
+
return literal && typeof currentNode.textContent === "string" && regExpTest(ELEMENT_MARKUP_PROBE, currentNode.textContent);
|
|
2194
|
+
};
|
|
2195
|
+
/**
|
|
2053
2196
|
* Structural-threat checks that condemn a node regardless of the
|
|
2054
2197
|
* allowlists: mXSS via namespace confusion, risky CSS construction,
|
|
2055
2198
|
* processing instructions, markup-bearing comments. Pure predicate;
|
|
@@ -2062,9 +2205,9 @@ function createDOMPurify() {
|
|
|
2062
2205
|
*/
|
|
2063
2206
|
const _isUnsafeNode = function _isUnsafeNode(currentNode, tagName, nodeType) {
|
|
2064
2207
|
if (SAFE_FOR_XML && nodeType === NODE_TYPE.element && currentNode.hasChildNodes() && !_isNode(currentNode.firstElementChild) && regExpTest(ELEMENT_MARKUP_PROBE, currentNode.textContent) && regExpTest(ELEMENT_MARKUP_PROBE, currentNode.innerHTML)) return true;
|
|
2065
|
-
if (SAFE_FOR_XML &&
|
|
2208
|
+
if (SAFE_FOR_XML && nodeType === NODE_TYPE.element && _isMalformedElement(currentNode, tagName)) return true;
|
|
2066
2209
|
if (nodeType === NODE_TYPE.processingInstruction) return true;
|
|
2067
|
-
if (SAFE_FOR_XML && nodeType === NODE_TYPE.comment && regExpTest(
|
|
2210
|
+
if (SAFE_FOR_XML && nodeType === NODE_TYPE.comment && regExpTest(COMMENT_UNSAFE, currentNode.data)) return true;
|
|
2068
2211
|
return false;
|
|
2069
2212
|
};
|
|
2070
2213
|
/**
|
|
@@ -2140,6 +2283,7 @@ function createDOMPurify() {
|
|
|
2140
2283
|
const _handleHookDetachedNode = function _handleHookDetachedNode(currentNode, root) {
|
|
2141
2284
|
if (currentNode === root || getParentNode(currentNode) !== null) return false;
|
|
2142
2285
|
if (IN_PLACE) _neutralizeSubtree(currentNode);
|
|
2286
|
+
_unmarkVisited(currentNode);
|
|
2143
2287
|
return true;
|
|
2144
2288
|
};
|
|
2145
2289
|
/**
|
|
@@ -2171,14 +2315,7 @@ function createDOMPurify() {
|
|
|
2171
2315
|
_forceRemove(currentNode);
|
|
2172
2316
|
return true;
|
|
2173
2317
|
}
|
|
2174
|
-
if (FORBID_TAGS[tagName] || !(EXTRA_ELEMENT_HANDLING.tagCheck instanceof Function && EXTRA_ELEMENT_HANDLING.tagCheck(tagName)) && !ALLOWED_TAGS[tagName])
|
|
2175
|
-
const removed = _sanitizeDisallowedNode(currentNode, tagName, root);
|
|
2176
|
-
if (removed === false) {
|
|
2177
|
-
_executeHooks(hooks.afterSanitizeElements, currentNode, null);
|
|
2178
|
-
if (_handleHookDetachedNode(currentNode, root)) return true;
|
|
2179
|
-
}
|
|
2180
|
-
return removed;
|
|
2181
|
-
}
|
|
2318
|
+
if ((FORBID_TAGS[tagName] || !(EXTRA_ELEMENT_HANDLING.tagCheck instanceof Function && EXTRA_ELEMENT_HANDLING.tagCheck(tagName)) && !ALLOWED_TAGS[tagName]) && _sanitizeDisallowedNode(currentNode, tagName, root)) return true;
|
|
2182
2319
|
if (nodeType === NODE_TYPE.element && !_checkValidNamespace(currentNode)) {
|
|
2183
2320
|
_forceRemove(currentNode);
|
|
2184
2321
|
return true;
|
|
@@ -2312,7 +2449,7 @@ function createDOMPurify() {
|
|
|
2312
2449
|
const _sanitizeAttributes = function _sanitizeAttributes(currentNode, root) {
|
|
2313
2450
|
_executeHooks(hooks.beforeSanitizeAttributes, currentNode, null);
|
|
2314
2451
|
if (_handleHookDetachedNode(currentNode, root)) return;
|
|
2315
|
-
const attributes = currentNode
|
|
2452
|
+
const attributes = _readAttributes(currentNode);
|
|
2316
2453
|
if (!attributes || _isClobbered(currentNode)) return;
|
|
2317
2454
|
ALLOWED_ATTR = _forkSharedAllowlist(hooks.uponSanitizeAttribute, ALLOWED_ATTR, DEFAULT_ALLOWED_ATTR, SET_CONFIG_ALLOWED_ATTR);
|
|
2318
2455
|
const hookEvent = {
|
|
@@ -2326,6 +2463,7 @@ function createDOMPurify() {
|
|
|
2326
2463
|
const lcTag = transformCaseFunc(_readNodeName(currentNode));
|
|
2327
2464
|
while (l--) {
|
|
2328
2465
|
const attr = attributes[l];
|
|
2466
|
+
if (!attr) continue;
|
|
2329
2467
|
const name = attr.name, namespaceURI = attr.namespaceURI, attrValue = attr.value;
|
|
2330
2468
|
const lcName = transformCaseFunc(name);
|
|
2331
2469
|
const initValue = attrValue;
|
|
@@ -2450,7 +2588,7 @@ function createDOMPurify() {
|
|
|
2450
2588
|
}
|
|
2451
2589
|
}
|
|
2452
2590
|
};
|
|
2453
|
-
|
|
2591
|
+
const _sanitize = function _sanitize(dirty) {
|
|
2454
2592
|
let cfg = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
|
|
2455
2593
|
let body = null;
|
|
2456
2594
|
let importedNode = null;
|
|
@@ -2467,26 +2605,29 @@ function createDOMPurify() {
|
|
|
2467
2605
|
ALLOWED_TAGS = SET_CONFIG_ALLOWED_TAGS;
|
|
2468
2606
|
ALLOWED_ATTR = SET_CONFIG_ALLOWED_ATTR;
|
|
2469
2607
|
} else _parseConfig(cfg);
|
|
2608
|
+
ACTIVE_CONFIG = CONFIG;
|
|
2470
2609
|
DOMPurify.removed = [];
|
|
2471
2610
|
const inPlace = IN_PLACE && typeof dirty !== "string" && _isNode(dirty);
|
|
2472
2611
|
let inPlaceNodes = [];
|
|
2473
2612
|
const outerVisited = IN_PLACE_VISITED;
|
|
2613
|
+
const outerReturns = IN_PLACE_RETURNS;
|
|
2474
2614
|
if (inPlace) {
|
|
2475
2615
|
_neutralizePatchLinkage(dirty);
|
|
2616
|
+
inPlaceNodes = _collectLiveNodes(dirty);
|
|
2476
2617
|
const nn = _readNodeName(dirty);
|
|
2477
2618
|
if (typeof nn === "string") {
|
|
2478
2619
|
const tagName = transformCaseFunc(nn);
|
|
2479
2620
|
if (!ALLOWED_TAGS[tagName] || FORBID_TAGS[tagName]) {
|
|
2480
|
-
|
|
2621
|
+
_failClosed(dirty, inPlaceNodes);
|
|
2481
2622
|
throw typeErrorCreate("root node is forbidden and cannot be sanitized in-place");
|
|
2482
2623
|
}
|
|
2483
2624
|
}
|
|
2484
2625
|
if (_isClobbered(dirty)) {
|
|
2485
|
-
|
|
2626
|
+
_failClosed(dirty, inPlaceNodes);
|
|
2486
2627
|
throw typeErrorCreate("root node is clobbered and cannot be sanitized in-place");
|
|
2487
2628
|
}
|
|
2488
|
-
inPlaceNodes = _collectLiveNodes(dirty);
|
|
2489
2629
|
IN_PLACE_VISITED = setCreate();
|
|
2630
|
+
IN_PLACE_RETURNS = mapCreate();
|
|
2490
2631
|
} else if (_isNode(dirty)) {
|
|
2491
2632
|
body = _initDocument("<!---->");
|
|
2492
2633
|
importedNode = body.ownerDocument.importNode(dirty, true);
|
|
@@ -2507,13 +2648,11 @@ function createDOMPurify() {
|
|
|
2507
2648
|
while (currentNode = nodeIterator.nextNode()) _sanitizeNode(currentNode, walkRoot);
|
|
2508
2649
|
if (inPlace) _sanitizeUnvisitedNodes(dirty, inPlaceNodes);
|
|
2509
2650
|
} catch (error) {
|
|
2510
|
-
if (inPlace)
|
|
2511
|
-
_neutralizeRoot(dirty);
|
|
2512
|
-
_neutralizeDiscarded(dirty, inPlaceNodes);
|
|
2513
|
-
}
|
|
2651
|
+
if (inPlace) _failClosed(dirty, inPlaceNodes);
|
|
2514
2652
|
throw error;
|
|
2515
2653
|
} finally {
|
|
2516
2654
|
IN_PLACE_VISITED = outerVisited;
|
|
2655
|
+
IN_PLACE_RETURNS = outerReturns;
|
|
2517
2656
|
}
|
|
2518
2657
|
if (inPlace) {
|
|
2519
2658
|
if (_neutralizeDiscarded(dirty, inPlaceNodes)) throw typeErrorCreate("a node selected for removal could not be safely returned; refusing to sanitize in place");
|
|
@@ -2529,15 +2668,30 @@ function createDOMPurify() {
|
|
|
2529
2668
|
if (ALLOWED_ATTR.shadowroot || ALLOWED_ATTR.shadowrootmode) returnNode = importNode.call(originalDocument, returnNode, true);
|
|
2530
2669
|
return returnNode;
|
|
2531
2670
|
}
|
|
2532
|
-
|
|
2533
|
-
let serializedHTML =
|
|
2534
|
-
if (SAFE_FOR_TEMPLATES && regExpTest(TMPL_MARKER_SERIALIZED, serializedHTML)) {
|
|
2535
|
-
_scrubOwnCharacterData(body);
|
|
2536
|
-
serializedHTML = serialize();
|
|
2537
|
-
}
|
|
2671
|
+
if (SAFE_FOR_TEMPLATES) _scrubOwnCharacterData(body);
|
|
2672
|
+
let serializedHTML = WHOLE_DOCUMENT ? body.outerHTML : body.innerHTML;
|
|
2538
2673
|
if (WHOLE_DOCUMENT && ALLOWED_TAGS["!doctype"] && body.ownerDocument && body.ownerDocument.doctype && body.ownerDocument.doctype.name && regExpTest(DOCTYPE_NAME, body.ownerDocument.doctype.name)) serializedHTML = "<!DOCTYPE " + body.ownerDocument.doctype.name + ">\n" + serializedHTML;
|
|
2539
2674
|
return _signOutput(serializedHTML);
|
|
2540
2675
|
};
|
|
2676
|
+
DOMPurify.sanitize = function(dirty) {
|
|
2677
|
+
let cfg = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
|
|
2678
|
+
const outerConfig = ACTIVE_CONFIG;
|
|
2679
|
+
const outerTags = ALLOWED_TAGS;
|
|
2680
|
+
const outerAttr = ALLOWED_ATTR;
|
|
2681
|
+
const outerRemoved = DOMPurify.removed;
|
|
2682
|
+
ACTIVE_CONFIG = null;
|
|
2683
|
+
try {
|
|
2684
|
+
return _sanitize(dirty, cfg);
|
|
2685
|
+
} finally {
|
|
2686
|
+
ACTIVE_CONFIG = outerConfig;
|
|
2687
|
+
if (outerConfig) {
|
|
2688
|
+
if (!SET_CONFIG) _parseConfig(outerConfig);
|
|
2689
|
+
ALLOWED_TAGS = outerTags;
|
|
2690
|
+
ALLOWED_ATTR = outerAttr;
|
|
2691
|
+
DOMPurify.removed = outerRemoved;
|
|
2692
|
+
}
|
|
2693
|
+
}
|
|
2694
|
+
};
|
|
2541
2695
|
DOMPurify.setConfig = function() {
|
|
2542
2696
|
let cfg = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
|
|
2543
2697
|
_parseConfig(cfg);
|