diff --git a/lib/entry-points.js b/lib/entry-points.js
index 7ff11d2666..961a879416 100644
--- a/lib/entry-points.js
+++ b/lib/entry-points.js
@@ -54591,103 +54591,90 @@ var require_fxp = __commonJS({
}, o: (t2, e2) => Object.prototype.hasOwnProperty.call(t2, e2), r: (t2) => {
"undefined" != typeof Symbol && Symbol.toStringTag && Object.defineProperty(t2, Symbol.toStringTag, { value: "Module" }), Object.defineProperty(t2, "__esModule", { value: true });
} }, e = {};
- t.r(e), t.d(e, { XMLBuilder: () => Bt, XMLParser: () => Tt, XMLValidator: () => Ut });
- const n = ":A-Za-z_\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD", i = new RegExp("^[" + n + "][" + n + "\\-.\\d\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*$");
- function s(t2, e2) {
- const n2 = [];
- let i2 = e2.exec(t2);
- for (; i2; ) {
- const s2 = [];
- s2.startIndex = e2.lastIndex - i2[0].length;
- const r2 = i2.length;
- for (let t3 = 0; t3 < r2; t3++) s2.push(i2[t3]);
- n2.push(s2), i2 = e2.exec(t2);
- }
- return n2;
- }
- const r = function(t2) {
+ t.r(e), t.d(e, { XMLBuilder: () => $e, XMLParser: () => ce, XMLValidator: () => Oe });
+ const n = ":A-Za-z_\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD", i = new RegExp("^[" + n + "][" + n + "\\-.\\d\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*$"), r = function(t2) {
return !(null == i.exec(t2));
- }, o = ["hasOwnProperty", "toString", "valueOf", "__defineGetter__", "__defineSetter__", "__lookupGetter__", "__lookupSetter__"], a = ["__proto__", "constructor", "prototype"], h = { allowBooleanAttributes: false, unpairedTags: [] };
+ }, s = ["hasOwnProperty", "toString", "valueOf", "__defineGetter__", "__defineSetter__", "__lookupGetter__", "__lookupSetter__"], o = ["__proto__", "constructor", "prototype"], a = { allowBooleanAttributes: false, unpairedTags: [] };
function l(t2, e2) {
- e2 = Object.assign({}, h, e2);
+ e2 = Object.assign({}, a, e2);
const n2 = [];
- let i2 = false, s2 = false;
+ let i2 = false, r2 = false;
"\uFEFF" === t2[0] && (t2 = t2.substr(1));
- for (let r2 = 0; r2 < t2.length; r2++) if ("<" === t2[r2] && "?" === t2[r2 + 1]) {
- if (r2 += 2, r2 = p(t2, r2), r2.err) return r2;
+ for (let s2 = 0; s2 < t2.length; s2++) if ("<" === t2[s2] && "?" === t2[s2 + 1]) {
+ if (s2 += 2, s2 = p(t2, s2), s2.err) return s2;
} else {
- if ("<" !== t2[r2]) {
- if (u(t2[r2])) continue;
- return b("InvalidChar", "char '" + t2[r2] + "' is not expected.", w(t2, r2));
+ if ("<" !== t2[s2]) {
+ if (c(t2[s2])) continue;
+ return x("InvalidChar", "char '" + t2[s2] + "' is not expected.", N(t2, s2));
}
{
- let o2 = r2;
- if (r2++, "!" === t2[r2]) {
- r2 = c(t2, r2);
+ let o2 = s2;
+ if (s2++, "!" === t2[s2]) {
+ s2 = h(t2, s2);
continue;
}
{
let a2 = false;
- "/" === t2[r2] && (a2 = true, r2++);
- let h2 = "";
- for (; r2 < t2.length && ">" !== t2[r2] && " " !== t2[r2] && " " !== t2[r2] && "\n" !== t2[r2] && "\r" !== t2[r2]; r2++) h2 += t2[r2];
- if (h2 = h2.trim(), "/" === h2[h2.length - 1] && (h2 = h2.substring(0, h2.length - 1), r2--), !E(h2)) {
+ "/" === t2[s2] && (a2 = true, s2++);
+ let l2 = "";
+ for (; s2 < t2.length && ">" !== t2[s2] && " " !== t2[s2] && " " !== t2[s2] && "\n" !== t2[s2] && "\r" !== t2[s2]; s2++) l2 += t2[s2];
+ if (l2 = l2.trim(), "/" === l2[l2.length - 1] && (l2 = l2.substring(0, l2.length - 1), s2--), !y(l2)) {
let e3;
- return e3 = 0 === h2.trim().length ? "Invalid space after '<'." : "Tag '" + h2 + "' is an invalid name.", b("InvalidTag", e3, w(t2, r2));
- }
- const l2 = g(t2, r2);
- if (false === l2) return b("InvalidAttr", "Attributes for '" + h2 + "' have open quote.", w(t2, r2));
- let d2 = l2.value;
- if (r2 = l2.index, "/" === d2[d2.length - 1]) {
- const n3 = r2 - d2.length;
- d2 = d2.substring(0, d2.length - 1);
- const s3 = x(d2, e2);
- if (true !== s3) return b(s3.err.code, s3.err.msg, w(t2, n3 + s3.err.line));
+ return e3 = 0 === l2.trim().length ? "Invalid space after '<'." : "Tag '" + l2 + "' is an invalid name.", x("InvalidTag", e3, N(t2, s2));
+ }
+ const d2 = f(t2, s2);
+ if (false === d2) return x("InvalidAttr", "Attributes for '" + l2 + "' have open quote.", N(t2, s2));
+ let u2 = d2.value;
+ if (s2 = d2.index, "/" === u2[u2.length - 1]) {
+ const n3 = s2 - u2.length;
+ u2 = u2.substring(0, u2.length - 1);
+ const r3 = g(u2, e2);
+ if (true !== r3) return x(r3.err.code, r3.err.msg, N(t2, n3 + r3.err.line));
i2 = true;
} else if (a2) {
- if (!l2.tagClosed) return b("InvalidTag", "Closing tag '" + h2 + "' doesn't have proper closing.", w(t2, r2));
- if (d2.trim().length > 0) return b("InvalidTag", "Closing tag '" + h2 + "' can't have attributes or invalid starting.", w(t2, o2));
- if (0 === n2.length) return b("InvalidTag", "Closing tag '" + h2 + "' has not been opened.", w(t2, o2));
+ if (!d2.tagClosed) return x("InvalidTag", "Closing tag '" + l2 + "' doesn't have proper closing.", N(t2, s2));
+ if (u2.trim().length > 0) return x("InvalidTag", "Closing tag '" + l2 + "' can't have attributes or invalid starting.", N(t2, o2));
+ if (0 === n2.length) return x("InvalidTag", "Closing tag '" + l2 + "' has not been opened.", N(t2, o2));
{
const e3 = n2.pop();
- if (h2 !== e3.tagName) {
- let n3 = w(t2, e3.tagStartPos);
- return b("InvalidTag", "Expected closing tag '" + e3.tagName + "' (opened in line " + n3.line + ", col " + n3.col + ") instead of closing tag '" + h2 + "'.", w(t2, o2));
+ if (l2 !== e3.tagName) {
+ let n3 = N(t2, e3.tagStartPos);
+ return x("InvalidTag", "Expected closing tag '" + e3.tagName + "' (opened in line " + n3.line + ", col " + n3.col + ") instead of closing tag '" + l2 + "'.", N(t2, o2));
}
- 0 == n2.length && (s2 = true);
+ 0 == n2.length && (r2 = true);
}
} else {
- const a3 = x(d2, e2);
- if (true !== a3) return b(a3.err.code, a3.err.msg, w(t2, r2 - d2.length + a3.err.line));
- if (true === s2) return b("InvalidXml", "Multiple possible root nodes found.", w(t2, r2));
- -1 !== e2.unpairedTags.indexOf(h2) || n2.push({ tagName: h2, tagStartPos: o2 }), i2 = true;
- }
- for (r2++; r2 < t2.length; r2++) if ("<" === t2[r2]) {
- if ("!" === t2[r2 + 1]) {
- r2++, r2 = c(t2, r2);
+ const a3 = g(u2, e2);
+ if (true !== a3) return x(a3.err.code, a3.err.msg, N(t2, s2 - u2.length + a3.err.line));
+ if (true === r2) return x("InvalidXml", "Multiple possible root nodes found.", N(t2, s2));
+ -1 !== e2.unpairedTags.indexOf(l2) || n2.push({ tagName: l2, tagStartPos: o2 }), i2 = true;
+ }
+ for (s2++; s2 < t2.length; s2++) if ("<" === t2[s2]) {
+ if ("!" === t2[s2 + 1]) {
+ s2++, s2 = h(t2, s2);
continue;
}
- if ("?" !== t2[r2 + 1]) break;
- if (r2 = p(t2, ++r2), r2.err) return r2;
- } else if ("&" === t2[r2]) {
- const e3 = N(t2, r2);
- if (-1 == e3) return b("InvalidChar", "char '&' is not expected.", w(t2, r2));
- r2 = e3;
- } else if (true === s2 && !u(t2[r2])) return b("InvalidXml", "Extra text at the end", w(t2, r2));
- "<" === t2[r2] && r2--;
+ if ("?" !== t2[s2 + 1]) break;
+ if (s2 = p(t2, ++s2), s2.err) return s2;
+ } else if ("&" === t2[s2]) {
+ const e3 = m(t2, s2);
+ if (-1 == e3) return x("InvalidChar", "char '&' is not expected.", N(t2, s2));
+ s2 = e3;
+ } else if (true === r2 && !c(t2[s2])) return x("InvalidXml", "Extra text at the end", N(t2, s2));
+ "<" === t2[s2] && s2--;
}
}
}
- return i2 ? 1 == n2.length ? b("InvalidTag", "Unclosed tag '" + n2[0].tagName + "'.", w(t2, n2[0].tagStartPos)) : !(n2.length > 0) || b("InvalidXml", "Invalid '" + JSON.stringify(n2.map((t3) => t3.tagName), null, 4).replace(/\r?\n/g, "") + "' found.", { line: 1, col: 1 }) : b("InvalidXml", "Start tag expected.", 1);
+ return i2 ? 1 == n2.length ? x("InvalidTag", "Unclosed tag '" + n2[0].tagName + "'.", N(t2, n2[0].tagStartPos)) : !(n2.length > 0) || x("InvalidXml", "Invalid '" + JSON.stringify(n2.map((t3) => t3.tagName), null, 4).replace(/\r?\n/g, "") + "' found.", { line: 1, col: 1 }) : x("InvalidXml", "Start tag expected.", 1);
}
- function u(t2) {
+ function c(t2) {
return " " === t2 || " " === t2 || "\n" === t2 || "\r" === t2;
}
function p(t2, e2) {
const n2 = e2;
for (; e2 < t2.length; e2++) if ("?" == t2[e2] || " " == t2[e2]) {
const i2 = t2.substr(n2, e2 - n2);
- if (e2 > 5 && "xml" === i2) return b("InvalidXml", "XML declaration allowed only at the start of the document.", w(t2, e2));
+ if (e2 > 5 && "xml" === i2) return x("InvalidXml", "XML declaration allowed only at the start of the document.", N(t2, e2));
if ("?" == t2[e2] && ">" == t2[e2 + 1]) {
e2++;
break;
@@ -54696,7 +54683,7 @@ var require_fxp = __commonJS({
}
return e2;
}
- function c(t2, e2) {
+ function h(t2, e2) {
if (t2.length > e2 + 5 && "-" === t2[e2 + 1] && "-" === t2[e2 + 2]) {
for (e2 += 3; e2 < t2.length; e2++) if ("-" === t2[e2] && "-" === t2[e2 + 1] && ">" === t2[e2 + 2]) {
e2 += 2;
@@ -54714,34 +54701,60 @@ var require_fxp = __commonJS({
}
return e2;
}
- const d = '"', f = "'";
- function g(t2, e2) {
- let n2 = "", i2 = "", s2 = false;
+ const d = '"', u = "'";
+ function f(t2, e2) {
+ let n2 = "", i2 = "", r2 = false;
for (; e2 < t2.length; e2++) {
- if (t2[e2] === d || t2[e2] === f) "" === i2 ? i2 = t2[e2] : i2 !== t2[e2] || (i2 = "");
+ if (t2[e2] === d || t2[e2] === u) "" === i2 ? i2 = t2[e2] : i2 !== t2[e2] || (i2 = "");
else if (">" === t2[e2] && "" === i2) {
- s2 = true;
+ r2 = true;
break;
}
n2 += t2[e2];
}
- return "" === i2 && { value: n2, index: e2, tagClosed: s2 };
+ return "" === i2 && { value: n2, index: e2, tagClosed: r2 };
}
- const m = new RegExp(`(\\s*)([^\\s=]+)(\\s*=)?(\\s*(['"])(([\\s\\S])*?)\\5)?`, "g");
- function x(t2, e2) {
- const n2 = s(t2, m), i2 = {};
+ function g(t2, e2) {
+ const n2 = (function(t3) {
+ const e3 = [], n3 = t3.length;
+ let i3 = 0;
+ for (; i3 < n3; ) {
+ const r2 = i3;
+ for (; i3 < n3 && c(t3[i3]); ) i3++;
+ if (i3 >= n3) break;
+ if ("=" === t3[i3]) {
+ i3++;
+ continue;
+ }
+ const s2 = t3.slice(r2, i3), o2 = i3;
+ for (; i3 < n3 && !c(t3[i3]) && "=" !== t3[i3]; ) i3++;
+ const a2 = t3.slice(o2, i3);
+ let l2, p2, h2, d2 = i3;
+ for (; d2 < n3 && c(t3[d2]); ) d2++;
+ d2 < n3 && "=" === t3[d2] && (l2 = t3.slice(i3, d2 + 1), i3 = d2 + 1);
+ let u2 = i3;
+ for (; u2 < n3 && c(t3[u2]); ) u2++;
+ if (u2 < n3 && ('"' === t3[u2] || "'" === t3[u2])) {
+ const e4 = u2 + 1, n4 = t3.indexOf(t3[u2], e4);
+ -1 !== n4 && (p2 = t3[u2], h2 = t3.slice(e4, n4), i3 = n4 + 1);
+ }
+ const f2 = { startIndex: r2 };
+ f2[1] = s2, f2[2] = a2, f2[3] = l2, f2[4] = void 0 !== p2 || void 0, f2[5] = p2, f2[6] = h2, e3.push(f2);
+ }
+ return e3;
+ })(t2), i2 = {};
for (let t3 = 0; t3 < n2.length; t3++) {
- if (0 === n2[t3][1].length) return b("InvalidAttr", "Attribute '" + n2[t3][2] + "' has no space in starting.", v(n2[t3]));
- if (void 0 !== n2[t3][3] && void 0 === n2[t3][4]) return b("InvalidAttr", "Attribute '" + n2[t3][2] + "' is without value.", v(n2[t3]));
- if (void 0 === n2[t3][3] && !e2.allowBooleanAttributes) return b("InvalidAttr", "boolean attribute '" + n2[t3][2] + "' is not allowed.", v(n2[t3]));
- const s2 = n2[t3][2];
- if (!y(s2)) return b("InvalidAttr", "Attribute '" + s2 + "' is an invalid name.", v(n2[t3]));
- if (Object.prototype.hasOwnProperty.call(i2, s2)) return b("InvalidAttr", "Attribute '" + s2 + "' is repeated.", v(n2[t3]));
- i2[s2] = 1;
+ if (0 === n2[t3][1].length) return x("InvalidAttr", "Attribute '" + n2[t3][2] + "' has no space in starting.", E(n2[t3]));
+ if (void 0 !== n2[t3][3] && void 0 === n2[t3][4]) return x("InvalidAttr", "Attribute '" + n2[t3][2] + "' is without value.", E(n2[t3]));
+ if (void 0 === n2[t3][3] && !e2.allowBooleanAttributes) return x("InvalidAttr", "boolean attribute '" + n2[t3][2] + "' is not allowed.", E(n2[t3]));
+ const r2 = n2[t3][2];
+ if (!b(r2)) return x("InvalidAttr", "Attribute '" + r2 + "' is an invalid name.", E(n2[t3]));
+ if (Object.prototype.hasOwnProperty.call(i2, r2)) return x("InvalidAttr", "Attribute '" + r2 + "' is repeated.", E(n2[t3]));
+ i2[r2] = 1;
}
return true;
}
- function N(t2, e2) {
+ function m(t2, e2) {
if (";" === t2[++e2]) return -1;
if ("#" === t2[e2]) return (function(t3, e3) {
let n3 = /\d/;
@@ -54758,46 +54771,46 @@ var require_fxp = __commonJS({
}
return e2;
}
- function b(t2, e2, n2) {
+ function x(t2, e2, n2) {
return { err: { code: t2, msg: e2, line: n2.line || n2, col: n2.col } };
}
- function y(t2) {
+ function b(t2) {
return r(t2);
}
- function E(t2) {
+ function y(t2) {
return r(t2);
}
- function w(t2, e2) {
+ function N(t2, e2) {
const n2 = t2.substring(0, e2).split(/\r?\n/);
return { line: n2.length, col: n2[n2.length - 1].length + 1 };
}
- function v(t2) {
+ function E(t2) {
return t2.startIndex + t2[1].length;
}
- const S = (t2) => o.includes(t2) ? "__" + t2 : t2, _2 = { preserveOrder: false, attributeNamePrefix: "@_", attributesGroupName: false, textNodeName: "#text", ignoreAttributes: true, removeNSPrefix: false, allowBooleanAttributes: false, parseTagValue: true, parseAttributeValue: false, trimValues: true, cdataPropName: false, numberParseOptions: { hex: true, leadingZeros: true, eNotation: true }, tagValueProcessor: function(t2, e2) {
+ const w = (t2) => s.includes(t2) ? "__" + t2 : t2, v = { preserveOrder: false, attributeNamePrefix: "@_", attributesGroupName: false, textNodeName: "#text", ignoreAttributes: true, removeNSPrefix: false, allowBooleanAttributes: false, parseTagValue: true, parseAttributeValue: false, trimValues: true, cdataPropName: false, numberParseOptions: { hex: true, leadingZeros: true, eNotation: true, unicode: false }, tagValueProcessor: function(t2, e2) {
return e2;
}, attributeValueProcessor: function(t2, e2) {
return e2;
}, stopNodes: [], alwaysCreateTextNode: false, isArray: () => false, commentPropName: false, unpairedTags: [], processEntities: true, htmlEntities: false, entityDecoder: null, ignoreDeclaration: false, ignorePiTags: false, transformTagName: false, transformAttributeName: false, updateTag: function(t2, e2, n2) {
return t2;
- }, captureMetaData: false, maxNestedTags: 100, strictReservedNames: true, jPath: true, onDangerousProperty: S };
- function A(t2, e2) {
+ }, captureMetaData: false, maxNestedTags: 100, strictReservedNames: true, jPath: true, onDangerousProperty: w };
+ function S(t2, e2) {
if ("string" != typeof t2) return;
const n2 = t2.toLowerCase();
+ if (s.some((t3) => n2 === t3.toLowerCase())) throw new Error(`[SECURITY] Invalid ${e2}: "${t2}" is a reserved JavaScript keyword that could cause prototype pollution`);
if (o.some((t3) => n2 === t3.toLowerCase())) throw new Error(`[SECURITY] Invalid ${e2}: "${t2}" is a reserved JavaScript keyword that could cause prototype pollution`);
- if (a.some((t3) => n2 === t3.toLowerCase())) throw new Error(`[SECURITY] Invalid ${e2}: "${t2}" is a reserved JavaScript keyword that could cause prototype pollution`);
}
- function T(t2, e2) {
- return "boolean" == typeof t2 ? { enabled: t2, maxEntitySize: 1e4, maxExpansionDepth: 1e4, maxTotalExpansions: 1 / 0, maxExpandedLength: 1e5, maxEntityCount: 1e3, allowedTags: null, tagFilter: null, appliesTo: "all" } : "object" == typeof t2 && null !== t2 ? { enabled: false !== t2.enabled, maxEntitySize: Math.max(1, t2.maxEntitySize ?? 1e4), maxExpansionDepth: Math.max(1, t2.maxExpansionDepth ?? 1e4), maxTotalExpansions: Math.max(1, t2.maxTotalExpansions ?? 1 / 0), maxExpandedLength: Math.max(1, t2.maxExpandedLength ?? 1e5), maxEntityCount: Math.max(1, t2.maxEntityCount ?? 1e3), allowedTags: t2.allowedTags ?? null, tagFilter: t2.tagFilter ?? null, appliesTo: t2.appliesTo ?? "all" } : T(true);
+ function A(t2, e2) {
+ return "boolean" == typeof t2 ? { enabled: t2, maxEntitySize: 1e4, maxExpansionDepth: 1e4, maxTotalExpansions: 1 / 0, maxExpandedLength: 1e5, maxEntityCount: 1e3, allowedTags: null, tagFilter: null, appliesTo: "all" } : "object" == typeof t2 && null !== t2 ? { enabled: false !== t2.enabled, maxEntitySize: Math.max(1, t2.maxEntitySize ?? 1e4), maxExpansionDepth: Math.max(1, t2.maxExpansionDepth ?? 1e4), maxTotalExpansions: Math.max(1, t2.maxTotalExpansions ?? 1 / 0), maxExpandedLength: Math.max(1, t2.maxExpandedLength ?? 1e5), maxEntityCount: Math.max(1, t2.maxEntityCount ?? 1e3), allowedTags: t2.allowedTags ?? null, tagFilter: t2.tagFilter ?? null, appliesTo: t2.appliesTo ?? "all" } : A(true);
}
- const C = function(t2) {
- const e2 = Object.assign({}, _2, t2), n2 = [{ value: e2.attributeNamePrefix, name: "attributeNamePrefix" }, { value: e2.attributesGroupName, name: "attributesGroupName" }, { value: e2.textNodeName, name: "textNodeName" }, { value: e2.cdataPropName, name: "cdataPropName" }, { value: e2.commentPropName, name: "commentPropName" }];
- for (const { value: t3, name: e3 } of n2) t3 && A(t3, e3);
- return null === e2.onDangerousProperty && (e2.onDangerousProperty = S), e2.processEntities = T(e2.processEntities, e2.htmlEntities), e2.unpairedTagsSet = new Set(e2.unpairedTags), e2.stopNodes && Array.isArray(e2.stopNodes) && (e2.stopNodes = e2.stopNodes.map((t3) => "string" == typeof t3 && t3.startsWith("*.") ? ".." + t3.substring(2) : t3)), e2;
+ const T = function(t2) {
+ const e2 = Object.assign({}, v, t2), n2 = [{ value: e2.attributeNamePrefix, name: "attributeNamePrefix" }, { value: e2.attributesGroupName, name: "attributesGroupName" }, { value: e2.textNodeName, name: "textNodeName" }, { value: e2.cdataPropName, name: "cdataPropName" }, { value: e2.commentPropName, name: "commentPropName" }];
+ for (const { value: t3, name: e3 } of n2) t3 && S(t3, e3);
+ return null === e2.onDangerousProperty && (e2.onDangerousProperty = w), e2.processEntities = A(e2.processEntities, e2.htmlEntities), e2.unpairedTagsSet = new Set(e2.unpairedTags), e2.stopNodes && Array.isArray(e2.stopNodes) && (e2.stopNodes = e2.stopNodes.map((t3) => "string" == typeof t3 && t3.startsWith("*.") ? ".." + t3.substring(2) : t3)), e2;
};
- let P;
- P = "function" != typeof Symbol ? "@@xmlMetadata" : /* @__PURE__ */ Symbol("XML Node Metadata");
- class O {
+ let _2;
+ _2 = "function" != typeof Symbol ? "@@xmlMetadata" : /* @__PURE__ */ Symbol("XML Node Metadata");
+ class C {
constructor(t2) {
this.tagname = t2, this.child = [], this[":@"] = /* @__PURE__ */ Object.create(null);
}
@@ -54805,15 +54818,42 @@ var require_fxp = __commonJS({
"__proto__" === t2 && (t2 = "#__proto__"), this.child.push({ [t2]: e2 });
}
addChild(t2, e2) {
- "__proto__" === t2.tagname && (t2.tagname = "#__proto__"), t2[":@"] && Object.keys(t2[":@"]).length > 0 ? this.child.push({ [t2.tagname]: t2.child, ":@": t2[":@"] }) : this.child.push({ [t2.tagname]: t2.child }), void 0 !== e2 && (this.child[this.child.length - 1][P] = { startIndex: e2 });
+ "__proto__" === t2.tagname && (t2.tagname = "#__proto__"), t2[":@"] && Object.keys(t2[":@"]).length > 0 ? this.child.push({ [t2.tagname]: t2.child, ":@": t2[":@"] }) : this.child.push({ [t2.tagname]: t2.child }), this.addStartIndex(e2);
+ }
+ addStartIndex(t2) {
+ void 0 !== t2 && (this.child[this.child.length - 1][_2] = { startIndex: t2 });
+ }
+ addEndIndex(t2) {
+ const e2 = this.child[this.child.length - 1];
+ void 0 !== e2 && void 0 !== e2[_2] && void 0 === e2[_2].endIndex && (e2[_2].endIndex = t2);
}
static getMetaDataSymbol() {
- return P;
+ return _2;
+ }
+ }
+ const $ = ":A-Za-z_\xC0-\xD6\xD8-\xF6\xF8-\u02FF\u0370-\u037D\u037F-\u0486\u0488-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD", O = ":A-Za-z_\xC0-\u02FF\u0370-\u037D\u037F-\u0486\u0488-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\u{10000}-\u{EFFFF}", P = O + "\\-\\.\\d\xB7\u0300-\u036F\u0487\u203F-\u2040", j = (t2, e2, n2 = "") => {
+ const i2 = `[${t2.replace(":", "")}][${e2.replace(":", "")}]*`;
+ return { name: new RegExp(`^[${t2}][${e2}]*$`, n2), ncName: new RegExp(`^${i2}$`, n2), qName: new RegExp(`^${i2}(?::${i2})?$`, n2), nmToken: new RegExp(`^[${e2}]+$`, n2), nmTokens: new RegExp(`^[${e2}]+(?:\\s+[${e2}]+)*$`, n2) };
+ }, I = j($, $ + "\\-\\.\\d\xB7\u0300-\u036F\u203F-\u2040"), k = j(O, P, "u"), L = ":A-Za-z_", D = j(L, L + "\\-\\.\\d"), M = (t2 = "1.0", e2 = false) => e2 ? D : "1.1" === t2 ? k : I, R = (t2, { xmlVersion: e2 = "1.0", asciiOnly: n2 = false } = {}) => M(e2, n2).qName.test(t2), V = ["name", "ncName", "qName", "nmToken", "nmTokens"], q = (t2, { xmlVersion: e2 = "1.0", asciiOnly: n2 = false, maxCacheSize: i2 = 2048 } = {}) => {
+ if (!V.includes(t2)) throw new TypeError(`Unknown production "${t2}". Must be one of: ${V.join(", ")}`);
+ const r2 = M(e2, n2)[t2];
+ let s2 = /* @__PURE__ */ new Map();
+ const o2 = (t3) => {
+ const e3 = s2.get(t3);
+ if (void 0 !== e3) return e3;
+ const n3 = r2.test(t3);
+ return s2.size < i2 && s2.set(t3, n3), n3;
+ };
+ return o2.reset = () => {
+ s2 = /* @__PURE__ */ new Map();
+ }, o2;
+ };
+ class F {
+ constructor(t2, e2) {
+ this.suppressValidationErr = !t2, this.options = t2, this.xmlVersion = e2 || 1;
}
- }
- class $ {
- constructor(t2) {
- this.suppressValidationErr = !t2, this.options = t2;
+ setXmlVersion(t2 = 1) {
+ this.xmlVersion = t2;
}
readDocType(t2, e2) {
const n2 = /* @__PURE__ */ Object.create(null);
@@ -54821,134 +54861,277 @@ var require_fxp = __commonJS({
if ("O" !== t2[e2 + 3] || "C" !== t2[e2 + 4] || "T" !== t2[e2 + 5] || "Y" !== t2[e2 + 6] || "P" !== t2[e2 + 7] || "E" !== t2[e2 + 8]) throw new Error("Invalid Tag instead of DOCTYPE");
{
e2 += 9;
- let s2 = 1, r2 = false, o2 = false, a2 = "";
- for (; e2 < t2.length; e2++) if ("<" !== t2[e2] || o2) if (">" === t2[e2]) {
- if (o2 ? "-" === t2[e2 - 1] && "-" === t2[e2 - 2] && (o2 = false, s2--) : s2--, 0 === s2) break;
- } else "[" === t2[e2] ? r2 = true : a2 += t2[e2];
+ let r2 = 1, s2 = false, o2 = false, a2 = null, l2 = "";
+ for (; e2 < t2.length; e2++) if (null === a2) if (s2 || o2 || '"' !== t2[e2] && "'" !== t2[e2]) if ("<" !== t2[e2] || o2) if (">" === t2[e2]) {
+ if (o2 ? "-" === t2[e2 - 1] && "-" === t2[e2 - 2] && (o2 = false, r2--) : r2--, 0 === r2) break;
+ } else "[" === t2[e2] ? s2 = true : l2 += t2[e2];
else {
- if (r2 && D(t2, "!ENTITY", e2)) {
- let s3, r3;
- if (e2 += 7, [s3, r3, e2] = this.readEntityExp(t2, e2 + 1, this.suppressValidationErr), -1 === r3.indexOf("&")) {
+ if (s2 && B(t2, "!ENTITY", e2)) {
+ let r3, s3;
+ if (e2 += 7, [r3, s3, e2] = this.readEntityExp(t2, e2 + 1, this.suppressValidationErr), -1 === s3.indexOf("&")) {
if (false !== this.options.enabled && null != this.options.maxEntityCount && i2 >= this.options.maxEntityCount) throw new Error(`Entity count (${i2 + 1}) exceeds maximum allowed (${this.options.maxEntityCount})`);
- n2[s3] = r3, i2++;
+ n2[r3] = s3, i2++;
}
- } else if (r2 && D(t2, "!ELEMENT", e2)) {
+ } else if (s2 && B(t2, "!ELEMENT", e2)) {
e2 += 8;
const { index: n3 } = this.readElementExp(t2, e2 + 1);
e2 = n3;
- } else if (r2 && D(t2, "!ATTLIST", e2)) e2 += 8;
- else if (r2 && D(t2, "!NOTATION", e2)) {
+ } else if (s2 && B(t2, "!ATTLIST", e2)) e2 += 8;
+ else if (s2 && B(t2, "!NOTATION", e2)) {
e2 += 9;
const { index: n3 } = this.readNotationExp(t2, e2 + 1, this.suppressValidationErr);
e2 = n3;
} else {
- if (!D(t2, "!--", e2)) throw new Error("Invalid DOCTYPE");
+ if (!B(t2, "!--", e2)) throw new Error("Invalid DOCTYPE");
o2 = true;
}
- s2++, a2 = "";
+ r2++, l2 = "";
}
- if (0 !== s2) throw new Error("Unclosed DOCTYPE");
+ else a2 = t2[e2], l2 += t2[e2];
+ else t2[e2] === a2 && (a2 = null), l2 += t2[e2];
+ if (null !== a2 || 0 !== r2) throw new Error("Unclosed DOCTYPE");
}
return { entities: n2, i: e2 };
}
readEntityExp(t2, e2) {
- const n2 = e2 = I(t2, e2);
+ const n2 = e2 = U(t2, e2);
for (; e2 < t2.length && !/\s/.test(t2[e2]) && '"' !== t2[e2] && "'" !== t2[e2]; ) e2++;
let i2 = t2.substring(n2, e2);
- if (M(i2), e2 = I(t2, e2), !this.suppressValidationErr) {
+ if (G(i2, { xmlVersion: this.xmlVersion }), e2 = U(t2, e2), !this.suppressValidationErr) {
if ("SYSTEM" === t2.substring(e2, e2 + 6).toUpperCase()) throw new Error("External entities are not supported");
if ("%" === t2[e2]) throw new Error("Parameter entities are not supported");
}
- let s2 = "";
- if ([e2, s2] = this.readIdentifierVal(t2, e2, "entity"), false !== this.options.enabled && null != this.options.maxEntitySize && s2.length > this.options.maxEntitySize) throw new Error(`Entity "${i2}" size (${s2.length}) exceeds maximum allowed size (${this.options.maxEntitySize})`);
- return [i2, s2, --e2];
+ let r2 = "";
+ if ([e2, r2] = this.readIdentifierVal(t2, e2, "entity"), false !== this.options.enabled && null != this.options.maxEntitySize && r2.length > this.options.maxEntitySize) throw new Error(`Entity "${i2}" size (${r2.length}) exceeds maximum allowed size (${this.options.maxEntitySize})`);
+ return [i2, r2, --e2];
}
readNotationExp(t2, e2) {
- const n2 = e2 = I(t2, e2);
+ const n2 = e2 = U(t2, e2);
for (; e2 < t2.length && !/\s/.test(t2[e2]); ) e2++;
let i2 = t2.substring(n2, e2);
- !this.suppressValidationErr && M(i2), e2 = I(t2, e2);
- const s2 = t2.substring(e2, e2 + 6).toUpperCase();
- if (!this.suppressValidationErr && "SYSTEM" !== s2 && "PUBLIC" !== s2) throw new Error(`Expected SYSTEM or PUBLIC, found "${s2}"`);
- e2 += s2.length, e2 = I(t2, e2);
- let r2 = null, o2 = null;
- if ("PUBLIC" === s2) [e2, r2] = this.readIdentifierVal(t2, e2, "publicIdentifier"), '"' !== t2[e2 = I(t2, e2)] && "'" !== t2[e2] || ([e2, o2] = this.readIdentifierVal(t2, e2, "systemIdentifier"));
- else if ("SYSTEM" === s2 && ([e2, o2] = this.readIdentifierVal(t2, e2, "systemIdentifier"), !this.suppressValidationErr && !o2)) throw new Error("Missing mandatory system identifier for SYSTEM notation");
- return { notationName: i2, publicIdentifier: r2, systemIdentifier: o2, index: --e2 };
+ !this.suppressValidationErr && G(i2, { xmlVersion: this.xmlVersion }), e2 = U(t2, e2);
+ const r2 = t2.substring(e2, e2 + 6).toUpperCase();
+ if (!this.suppressValidationErr && "SYSTEM" !== r2 && "PUBLIC" !== r2) throw new Error(`Expected SYSTEM or PUBLIC, found "${r2}"`);
+ e2 += r2.length, e2 = U(t2, e2);
+ let s2 = null, o2 = null;
+ if ("PUBLIC" === r2) [e2, s2] = this.readIdentifierVal(t2, e2, "publicIdentifier"), '"' !== t2[e2 = U(t2, e2)] && "'" !== t2[e2] || ([e2, o2] = this.readIdentifierVal(t2, e2, "systemIdentifier"));
+ else if ("SYSTEM" === r2 && ([e2, o2] = this.readIdentifierVal(t2, e2, "systemIdentifier"), !this.suppressValidationErr && !o2)) throw new Error("Missing mandatory system identifier for SYSTEM notation");
+ return { notationName: i2, publicIdentifier: s2, systemIdentifier: o2, index: --e2 };
}
readIdentifierVal(t2, e2, n2) {
let i2 = "";
- const s2 = t2[e2];
- if ('"' !== s2 && "'" !== s2) throw new Error(`Expected quoted string, found "${s2}"`);
- const r2 = ++e2;
- for (; e2 < t2.length && t2[e2] !== s2; ) e2++;
- if (i2 = t2.substring(r2, e2), t2[e2] !== s2) throw new Error(`Unterminated ${n2} value`);
+ const r2 = t2[e2];
+ if ('"' !== r2 && "'" !== r2) throw new Error(`Expected quoted string, found "${r2}"`);
+ const s2 = ++e2;
+ for (; e2 < t2.length && t2[e2] !== r2; ) e2++;
+ if (i2 = t2.substring(s2, e2), t2[e2] !== r2) throw new Error(`Unterminated ${n2} value`);
return [++e2, i2];
}
readElementExp(t2, e2) {
- const n2 = e2 = I(t2, e2);
+ const n2 = e2 = U(t2, e2);
for (; e2 < t2.length && !/\s/.test(t2[e2]); ) e2++;
let i2 = t2.substring(n2, e2);
- if (!this.suppressValidationErr && !r(i2)) throw new Error(`Invalid element name: "${i2}"`);
- let s2 = "";
- if ("E" === t2[e2 = I(t2, e2)] && D(t2, "MPTY", e2)) e2 += 4;
- else if ("A" === t2[e2] && D(t2, "NY", e2)) e2 += 2;
+ if (!this.suppressValidationErr && !R(i2, { xmlVersion: this.xmlVersion })) throw new Error(`Invalid element name: "${i2}"`);
+ let r2 = "";
+ if ("E" === t2[e2 = U(t2, e2)] && B(t2, "MPTY", e2)) e2 += 4;
+ else if ("A" === t2[e2] && B(t2, "NY", e2)) e2 += 2;
else if ("(" === t2[e2]) {
const n3 = ++e2;
for (; e2 < t2.length && ")" !== t2[e2]; ) e2++;
- if (s2 = t2.substring(n3, e2), ")" !== t2[e2]) throw new Error("Unterminated content model");
+ if (r2 = t2.substring(n3, e2), ")" !== t2[e2]) throw new Error("Unterminated content model");
} else if (!this.suppressValidationErr) throw new Error(`Invalid Element Expression, found "${t2[e2]}"`);
- return { elementName: i2, contentModel: s2.trim(), index: e2 };
+ return { elementName: i2, contentModel: r2.trim(), index: e2 };
}
readAttlistExp(t2, e2) {
- let n2 = e2 = I(t2, e2);
+ let n2 = e2 = U(t2, e2);
for (; e2 < t2.length && !/\s/.test(t2[e2]); ) e2++;
let i2 = t2.substring(n2, e2);
- for (M(i2), n2 = e2 = I(t2, e2); e2 < t2.length && !/\s/.test(t2[e2]); ) e2++;
- let s2 = t2.substring(n2, e2);
- if (!M(s2)) throw new Error(`Invalid attribute name: "${s2}"`);
- e2 = I(t2, e2);
- let r2 = "";
+ for (G(i2, { xmlVersion: this.xmlVersion }), n2 = e2 = U(t2, e2); e2 < t2.length && !/\s/.test(t2[e2]); ) e2++;
+ let r2 = t2.substring(n2, e2);
+ if (!G(r2, { xmlVersion: this.xmlVersion })) throw new Error(`Invalid attribute name: "${r2}"`);
+ e2 = U(t2, e2);
+ let s2 = "";
if ("NOTATION" === t2.substring(e2, e2 + 8).toUpperCase()) {
- if (r2 = "NOTATION", "(" !== t2[e2 = I(t2, e2 += 8)]) throw new Error(`Expected '(', found "${t2[e2]}"`);
+ if (s2 = "NOTATION", "(" !== t2[e2 = U(t2, e2 += 8)]) throw new Error(`Expected '(', found "${t2[e2]}"`);
e2++;
let n3 = [];
for (; e2 < t2.length && ")" !== t2[e2]; ) {
const i3 = e2;
for (; e2 < t2.length && "|" !== t2[e2] && ")" !== t2[e2]; ) e2++;
- let s3 = t2.substring(i3, e2);
- if (s3 = s3.trim(), !M(s3)) throw new Error(`Invalid notation name: "${s3}"`);
- n3.push(s3), "|" === t2[e2] && (e2++, e2 = I(t2, e2));
+ let r3 = t2.substring(i3, e2);
+ if (r3 = r3.trim(), !G(r3, { xmlVersion: this.xmlVersion })) throw new Error(`Invalid notation name: "${r3}"`);
+ n3.push(r3), "|" === t2[e2] && (e2++, e2 = U(t2, e2));
}
if (")" !== t2[e2]) throw new Error("Unterminated list of notations");
- e2++, r2 += " (" + n3.join("|") + ")";
+ e2++, s2 += " (" + n3.join("|") + ")";
} else {
const n3 = e2;
for (; e2 < t2.length && !/\s/.test(t2[e2]); ) e2++;
- r2 += t2.substring(n3, e2);
+ s2 += t2.substring(n3, e2);
const i3 = ["CDATA", "ID", "IDREF", "IDREFS", "ENTITY", "ENTITIES", "NMTOKEN", "NMTOKENS"];
- if (!this.suppressValidationErr && !i3.includes(r2.toUpperCase())) throw new Error(`Invalid attribute type: "${r2}"`);
+ if (!this.suppressValidationErr && !i3.includes(s2.toUpperCase())) throw new Error(`Invalid attribute type: "${s2}"`);
}
- e2 = I(t2, e2);
+ e2 = U(t2, e2);
let o2 = "";
- return "#REQUIRED" === t2.substring(e2, e2 + 8).toUpperCase() ? (o2 = "#REQUIRED", e2 += 8) : "#IMPLIED" === t2.substring(e2, e2 + 7).toUpperCase() ? (o2 = "#IMPLIED", e2 += 7) : [e2, o2] = this.readIdentifierVal(t2, e2, "ATTLIST"), { elementName: i2, attributeName: s2, attributeType: r2, defaultValue: o2, index: e2 };
+ return "#REQUIRED" === t2.substring(e2, e2 + 8).toUpperCase() ? (o2 = "#REQUIRED", e2 += 8) : "#IMPLIED" === t2.substring(e2, e2 + 7).toUpperCase() ? (o2 = "#IMPLIED", e2 += 7) : [e2, o2] = this.readIdentifierVal(t2, e2, "ATTLIST"), { elementName: i2, attributeName: r2, attributeType: s2, defaultValue: o2, index: e2 };
}
}
- const I = (t2, e2) => {
+ const U = (t2, e2) => {
for (; e2 < t2.length && /\s/.test(t2[e2]); ) e2++;
return e2;
};
- function D(t2, e2, n2) {
+ function B(t2, e2, n2) {
for (let i2 = 0; i2 < e2.length; i2++) if (e2[i2] !== t2[n2 + i2 + 1]) return false;
return true;
}
- function M(t2) {
- if (r(t2)) return t2;
+ function G(t2, e2) {
+ if (R(t2, { xmlVersion: e2 })) return t2;
throw new Error(`Invalid entity name ${t2}`);
}
- const j = /^[-+]?0x[a-fA-F0-9]+$/, V = /^([\-\+])?(0*)([0-9]*(\.[0-9]*)?)$/, L = { hex: true, leadingZeros: true, decimalPoint: ".", eNotation: true, infinity: "original" };
- const k = /^([-+])?(0*)(\d*(\.\d*)?[eE][-\+]?\d+)$/;
- class F {
+ const X = [48, 1632, 1776, 2406, 2534, 2662, 2790, 2918, 3046, 3174, 3302, 3430, 3558, 3664, 3792, 3872, 4160, 4240, 6112, 6160, 6470, 6608, 6784, 6800, 6992, 7088, 7232, 7248, 65296, 120782, 120792, 120802, 120812, 120822, 66720, 68912, 69734, 69872, 69942, 70096, 70384, 70736, 70864, 71248, 71360, 71472, 71904, 72016, 72688, 72784, 73040, 73120, 73552, 92768, 92864, 93008, 123200, 123632, 124144, 125264, 130032], W = /* @__PURE__ */ new Map(), z = 1632, Y = new Uint8Array(63904).fill(255);
+ for (const t2 of X) for (let e2 = 0; e2 < 10; e2++) {
+ const n2 = t2 + e2;
+ n2 <= 65535 ? Y[n2 - z] = e2 : W.set(n2, e2);
+ }
+ const H = /* @__PURE__ */ new Set([8722, 65293, 65123]), Q = /^[-+]?0x[a-fA-F0-9]+$/, J = /^0b[01]+$/, Z = /^0o[0-7]+$/, K = /^([\-\+])?(0*)([0-9]*(\.[0-9]*)?)$/, tt = { hex: true, binary: false, octal: false, leadingZeros: true, decimalPoint: ".", eNotation: true, infinity: "original", unicode: false };
+ function et(t2, e2 = {}) {
+ if (e2 = Object.assign({}, tt, e2), !t2 || "string" != typeof t2) return t2;
+ let n2 = t2.trim();
+ if (0 === n2.length) return t2;
+ if (void 0 !== e2.skipLike && e2.skipLike.test(n2)) return t2;
+ if ("0" === n2) return 0;
+ if (e2.unicode && (n2 = (function(t3) {
+ if ("string" != typeof t3) return t3;
+ const e3 = t3.length;
+ if (0 === e3) return t3;
+ let n3 = -1;
+ for (let i3 = 0; i3 < e3; i3++) {
+ const r2 = t3.charCodeAt(i3);
+ if (!(r2 >= 48 && r2 <= 57 || 45 === r2)) {
+ if (r2 < z) {
+ if (H.has(r2)) {
+ n3 = i3;
+ break;
+ }
+ } else if (r2 >= 55296 && r2 <= 56319) {
+ if (i3 + 1 < e3) {
+ const e4 = t3.charCodeAt(i3 + 1);
+ if (e4 >= 56320 && e4 <= 57343) {
+ const t4 = 65536 + (r2 - 55296 << 10) + (e4 - 56320);
+ if (W.has(t4)) {
+ n3 = i3;
+ break;
+ }
+ }
+ }
+ } else if (255 !== Y[r2 - z] || H.has(r2)) {
+ n3 = i3;
+ break;
+ }
+ }
+ }
+ if (-1 === n3) return t3;
+ const i2 = [];
+ n3 > 0 && i2.push(t3.slice(0, n3));
+ for (let r2 = n3; r2 < e3; r2++) {
+ const n4 = t3.charCodeAt(r2);
+ if (n4 >= 48 && n4 <= 57 || 45 === n4) {
+ i2.push(t3[r2]);
+ continue;
+ }
+ if (n4 < z) {
+ i2.push(H.has(n4) ? "-" : t3[r2]);
+ continue;
+ }
+ if (n4 >= 55296 && n4 <= 56319) {
+ if (r2 + 1 < e3) {
+ const e4 = t3.charCodeAt(r2 + 1);
+ if (e4 >= 56320 && e4 <= 57343) {
+ const t4 = 65536 + (n4 - 55296 << 10) + (e4 - 56320), s3 = W.get(t4);
+ if (void 0 !== s3) {
+ i2.push(String.fromCharCode(s3 + 48)), r2++;
+ continue;
+ }
+ }
+ }
+ i2.push(t3[r2]);
+ continue;
+ }
+ if (H.has(n4)) {
+ i2.push("-");
+ continue;
+ }
+ const s2 = Y[n4 - z];
+ i2.push(255 !== s2 ? String.fromCharCode(s2 + 48) : t3[r2]);
+ }
+ return i2.join("");
+ })(n2), "0" === n2)) return 0;
+ if (e2.hex && Q.test(n2)) return it(n2, 16);
+ if (e2.binary && J.test(n2)) return it(n2, 2);
+ if (e2.octal && Z.test(n2)) return it(n2, 8);
+ if (isFinite(n2)) {
+ if (n2.includes("e") || n2.includes("E")) return (function(t3, e3, n3) {
+ if (!n3.eNotation) return t3;
+ const i2 = e3.match(nt);
+ if (i2) {
+ let r2 = i2[1] || "";
+ const s2 = -1 === i2[3].indexOf("e") ? "E" : "e", o2 = i2[2], a2 = r2 ? e3[o2.length + 1] === s2 : e3[o2.length] === s2;
+ return o2.length > 1 && a2 ? t3 : (1 !== o2.length || !i2[3].startsWith(`.${s2}`) && i2[3][0] !== s2) && o2.length > 0 ? n3.leadingZeros && !a2 ? Number(e3) : t3 : Number(e3);
+ }
+ return t3;
+ })(t2, n2, e2);
+ {
+ const i2 = K.exec(n2);
+ if (i2) {
+ const r2 = i2[1] || "", s2 = i2[2];
+ let o2 = (function(t3) {
+ if (t3 && -1 !== t3.indexOf(".")) {
+ let e3 = t3.length;
+ for (; e3 > 0 && 48 === t3.charCodeAt(e3 - 1); ) e3--;
+ return "." === (t3 = t3.slice(0, e3)) ? t3 = "0" : "." === t3[0] ? t3 = "0" + t3 : "." === t3[t3.length - 1] && (t3 = t3.substring(0, t3.length - 1)), t3;
+ }
+ return t3;
+ })(i2[3]);
+ const a2 = r2 ? "." === n2[s2.length + 1] : "." === n2[s2.length];
+ if (!e2.leadingZeros && (s2.length > 1 || 1 === s2.length && !a2)) return t2;
+ {
+ const i3 = Number(n2), a3 = String(i3);
+ if (0 === i3) return i3;
+ if (-1 !== a3.search(/[eE]/)) return e2.eNotation ? i3 : t2;
+ if (-1 !== n2.indexOf(".")) return "0" === a3 || a3 === o2 || a3 === `${r2}${o2}` ? i3 : t2;
+ let l2 = s2 ? o2 : n2;
+ return s2 ? l2 === a3 || r2 + l2 === a3 ? i3 : t2 : l2 === a3 || l2 === r2 + a3 ? i3 : t2;
+ }
+ }
+ return t2;
+ }
+ }
+ {
+ const i2 = Number(n2);
+ return Number.isNaN(i2) ? t2 : (function(t3, e3, n3) {
+ const i3 = e3 === 1 / 0;
+ switch (n3.infinity.toLowerCase()) {
+ case "null":
+ return null;
+ case "infinity":
+ return e3;
+ case "string":
+ return i3 ? "Infinity" : "-Infinity";
+ default:
+ return t3;
+ }
+ })(t2, i2, e2);
+ }
+ }
+ const nt = /^([-+])?(0*)(\d*(\.\d*)?[eE][-\+]?\d+)$/;
+ function it(t2, e2) {
+ const n2 = t2.trim();
+ if (2 !== e2 && 8 !== e2 || (t2 = n2.substring(2)), parseInt) return parseInt(t2, e2);
+ if (Number.parseInt) return Number.parseInt(t2, e2);
+ if (window && window.parseInt) return window.parseInt(t2, e2);
+ throw new Error("parseInt, Number.parseInt, window.parseInt are not supported");
+ }
+ class rt {
constructor(t2) {
this._matcher = t2;
}
@@ -54973,6 +55156,12 @@ var require_fxp = __commonJS({
const n2 = e2[e2.length - 1];
return void 0 !== n2.values && t2 in n2.values;
}
+ getAnyParentAttr(t2) {
+ return this._matcher.getAnyParentAttr(t2);
+ }
+ hasAnyParentAttr(t2) {
+ return this._matcher.hasAnyParentAttr(t2);
+ }
getPosition() {
const t2 = this._matcher.path;
return 0 === t2.length ? -1 : t2[t2.length - 1].position ?? 0;
@@ -55000,26 +55189,33 @@ var require_fxp = __commonJS({
return t2.matchesAny(this._matcher);
}
}
- class R {
+ class st {
constructor(t2 = {}) {
- this.separator = t2.separator || ".", this.path = [], this.siblingStacks = [], this._pathStringCache = null, this._view = new F(this);
+ this.separator = t2.separator || ".", this.path = [], this.siblingStacks = [], this._pathStringCache = null, this._view = new rt(this), this._keptAttrs = [];
}
- push(t2, e2 = null, n2 = null) {
+ push(t2, e2 = null, n2 = null, i2 = null) {
this._pathStringCache = null, this.path.length > 0 && (this.path[this.path.length - 1].values = void 0);
- const i2 = this.path.length;
- this.siblingStacks[i2] || (this.siblingStacks[i2] = /* @__PURE__ */ new Map());
- const s2 = this.siblingStacks[i2], r2 = n2 ? `${n2}:${t2}` : t2, o2 = s2.get(r2) || 0;
- let a2 = 0;
- for (const t3 of s2.values()) a2 += t3;
- s2.set(r2, o2 + 1);
- const h2 = { tag: t2, position: a2, counter: o2 };
- null != n2 && (h2.namespace = n2), null != e2 && (h2.values = e2), this.path.push(h2);
+ const r2 = this.path.length;
+ let s2 = this.siblingStacks[r2];
+ s2 || (s2 = { counts: /* @__PURE__ */ new Map(), total: 0 }, this.siblingStacks[r2] = s2);
+ const o2 = n2 ? `${n2}:${t2}` : t2, a2 = s2.counts.get(o2) || 0, l2 = s2.total;
+ s2.counts.set(o2, a2 + 1), s2.total++;
+ const c2 = { tag: t2, position: l2, counter: a2 };
+ null != n2 && (c2.namespace = n2), null != e2 && (c2.values = e2), this.path.push(c2);
+ const p2 = this.path.length, h2 = null !== i2 ? i2.keep : null;
+ if (null != h2 && h2.length > 0 && e2) for (let t3 = 0; t3 < h2.length; t3++) {
+ const n3 = h2[t3];
+ void 0 !== e2[n3] && this._keptAttrs.push({ depth: p2, name: n3, value: e2[n3] });
+ }
}
pop() {
if (0 === this.path.length) return;
this._pathStringCache = null;
const t2 = this.path.pop();
- return this.siblingStacks.length > this.path.length + 1 && (this.siblingStacks.length = this.path.length + 1), t2;
+ this.siblingStacks.length > this.path.length + 1 && (this.siblingStacks.length = this.path.length + 1);
+ const e2 = this.path.length + 1;
+ for (; this._keptAttrs.length > 0 && this._keptAttrs[this._keptAttrs.length - 1].depth >= e2; ) this._keptAttrs.pop();
+ return t2;
}
updateCurrent(t2) {
if (this.path.length > 0) {
@@ -55041,6 +55237,15 @@ var require_fxp = __commonJS({
const e2 = this.path[this.path.length - 1];
return void 0 !== e2.values && t2 in e2.values;
}
+ getAnyParentAttr(t2) {
+ const e2 = this._keptAttrs;
+ for (let n2 = e2.length - 1; n2 >= 0; n2--) if (e2[n2].name === t2) return e2[n2].value;
+ }
+ hasAnyParentAttr(t2) {
+ const e2 = this._keptAttrs;
+ for (let n2 = e2.length - 1; n2 >= 0; n2--) if (e2[n2].name === t2) return true;
+ return false;
+ }
getPosition() {
return 0 === this.path.length ? -1 : this.path[this.path.length - 1].position ?? 0;
}
@@ -55066,7 +55271,7 @@ var require_fxp = __commonJS({
return this.path.map((t2) => t2.tag);
}
reset() {
- this._pathStringCache = null, this.path = [], this.siblingStacks = [];
+ this._pathStringCache = null, this.path = [], this.siblingStacks = [], this._keptAttrs = [];
}
matches(t2) {
const e2 = t2.segments;
@@ -55084,12 +55289,12 @@ var require_fxp = __commonJS({
if ("deep-wildcard" === i2.type) {
if (n2--, n2 < 0) return true;
const i3 = t2[n2];
- let s2 = false;
+ let r2 = false;
for (let t3 = e2; t3 >= 0; t3--) if (this._matchSegment(i3, this.path[t3], t3 === this.path.length - 1)) {
- e2 = t3 - 1, n2--, s2 = true;
+ e2 = t3 - 1, n2--, r2 = true;
break;
}
- if (!s2) return false;
+ if (!r2) return false;
} else {
if (!this._matchSegment(i2, this.path[e2], e2 === this.path.length - 1)) return false;
e2--, n2--;
@@ -55119,16 +55324,16 @@ var require_fxp = __commonJS({
return t2.matchesAny(this);
}
snapshot() {
- return { path: this.path.map((t2) => ({ ...t2 })), siblingStacks: this.siblingStacks.map((t2) => new Map(t2)) };
+ return { path: this.path.map((t2) => ({ ...t2 })), siblingStacks: this.siblingStacks.map((t2) => t2 ? { counts: new Map(t2.counts), total: t2.total } : t2), keptAttrs: this._keptAttrs.map((t2) => ({ ...t2 })) };
}
restore(t2) {
- this._pathStringCache = null, this.path = t2.path.map((t3) => ({ ...t3 })), this.siblingStacks = t2.siblingStacks.map((t3) => new Map(t3));
+ this._pathStringCache = null, this.path = t2.path.map((t3) => ({ ...t3 })), this.siblingStacks = t2.siblingStacks.map((t3) => t3 ? { counts: new Map(t3.counts), total: t3.total } : t3), this._keptAttrs = (t2.keptAttrs || []).map((t3) => ({ ...t3 }));
}
readOnly() {
return this._view;
}
}
- class G {
+ class ot {
constructor(t2, e2 = {}, n2) {
this.pattern = t2, this.separator = e2.separator || ".", this.segments = this._parse(t2), this.data = n2, this._hasDeepWildcard = this.segments.some((t3) => "deep-wildcard" === t3.type), this._hasAttributeCondition = this.segments.some((t3) => void 0 !== t3.attrName), this._hasPositionSelector = this.segments.some((t3) => void 0 !== t3.position);
}
@@ -55141,29 +55346,29 @@ var require_fxp = __commonJS({
_parseSegment(t2) {
const e2 = { type: "tag" };
let n2 = null, i2 = t2;
- const s2 = t2.match(/^([^\[]+)(\[[^\]]*\])(.*)$/);
- if (s2 && (i2 = s2[1] + s2[3], s2[2])) {
- const t3 = s2[2].slice(1, -1);
+ const r2 = t2.match(/^([^\[]+)(\[[^\]]*\])(.*)$/);
+ if (r2 && (i2 = r2[1] + r2[3], r2[2])) {
+ const t3 = r2[2].slice(1, -1);
t3 && (n2 = t3);
}
- let r2, o2, a2 = i2;
+ let s2, o2, a2 = i2;
if (i2.includes("::")) {
const e3 = i2.indexOf("::");
- if (r2 = i2.substring(0, e3).trim(), a2 = i2.substring(e3 + 2).trim(), !r2) throw new Error(`Invalid namespace in pattern: ${t2}`);
+ if (s2 = i2.substring(0, e3).trim(), a2 = i2.substring(e3 + 2).trim(), !s2) throw new Error(`Invalid namespace in pattern: ${t2}`);
}
- let h2 = null;
+ let l2 = null;
if (a2.includes(":")) {
const t3 = a2.lastIndexOf(":"), e3 = a2.substring(0, t3).trim(), n3 = a2.substring(t3 + 1).trim();
- ["first", "last", "odd", "even"].includes(n3) || /^nth\(\d+\)$/.test(n3) ? (o2 = e3, h2 = n3) : o2 = a2;
+ ["first", "last", "odd", "even"].includes(n3) || /^nth\(\d+\)$/.test(n3) ? (o2 = e3, l2 = n3) : o2 = a2;
} else o2 = a2;
if (!o2) throw new Error(`Invalid segment pattern: ${t2}`);
- if (e2.tag = o2, r2 && (e2.namespace = r2), n2) if (n2.includes("=")) {
+ if (e2.tag = o2, s2 && (e2.namespace = s2), n2) if (n2.includes("=")) {
const t3 = n2.indexOf("=");
e2.attrName = n2.substring(0, t3).trim(), e2.attrValue = n2.substring(t3 + 1).trim();
} else e2.attrName = n2.trim();
- if (h2) {
- const t3 = h2.match(/^nth\((\d+)\)$/);
- t3 ? (e2.position = "nth", e2.positionValue = parseInt(t3[1], 10)) : e2.position = h2;
+ if (l2) {
+ const t3 = l2.match(/^nth\((\d+)\)$/);
+ t3 ? (e2.position = "nth", e2.positionValue = parseInt(t3[1], 10)) : e2.position = l2;
}
return e2;
}
@@ -55183,14 +55388,21 @@ var require_fxp = __commonJS({
return this.pattern;
}
}
- class B {
+ class at {
constructor() {
- this._byDepthAndTag = /* @__PURE__ */ new Map(), this._wildcardByDepth = /* @__PURE__ */ new Map(), this._deepWildcards = [], this._patterns = /* @__PURE__ */ new Set(), this._sealed = false;
+ this._byDepthAndTag = /* @__PURE__ */ new Map(), this._wildcardByDepth = /* @__PURE__ */ new Map(), this._deepWildcards = [], this._deepByTerminalTag = /* @__PURE__ */ new Map(), this._patterns = /* @__PURE__ */ new Set(), this._sealed = false;
}
add(t2) {
if (this._sealed) throw new TypeError("ExpressionSet is sealed. Create a new ExpressionSet to add more expressions.");
if (this._patterns.has(t2.pattern)) return this;
- if (this._patterns.add(t2.pattern), t2.hasDeepWildcard()) return this._deepWildcards.push(t2), this;
+ if (this._patterns.add(t2.pattern), t2.hasDeepWildcard()) {
+ const e3 = t2.segments[t2.segments.length - 1];
+ if (e3 && "deep-wildcard" !== e3.type && "*" !== e3.tag) {
+ const n3 = e3.tag;
+ this._deepByTerminalTag.has(n3) || this._deepByTerminalTag.set(n3, []), this._deepByTerminalTag.get(n3).push(t2);
+ } else this._deepWildcards.push(t2);
+ return this;
+ }
const e2 = t2.length, n2 = t2.segments[t2.segments.length - 1], i2 = n2?.tag;
if (i2 && "*" !== i2) {
const n3 = `${e2}:${i2}`;
@@ -55218,25 +55430,29 @@ var require_fxp = __commonJS({
return null !== this.findMatch(t2);
}
findMatch(t2) {
- const e2 = t2.getDepth(), n2 = `${e2}:${t2.getCurrentTag()}`, i2 = this._byDepthAndTag.get(n2);
- if (i2) {
- for (let e3 = 0; e3 < i2.length; e3++) if (t2.matches(i2[e3])) return i2[e3];
+ const e2 = t2.getDepth(), n2 = t2.getCurrentTag(), i2 = `${e2}:${n2}`, r2 = this._byDepthAndTag.get(i2);
+ if (r2) {
+ for (let e3 = 0; e3 < r2.length; e3++) if (t2.matches(r2[e3])) return r2[e3];
}
const s2 = this._wildcardByDepth.get(e2);
if (s2) {
for (let e3 = 0; e3 < s2.length; e3++) if (t2.matches(s2[e3])) return s2[e3];
}
+ const o2 = this._deepByTerminalTag.get(n2);
+ if (o2) {
+ for (let e3 = 0; e3 < o2.length; e3++) if (t2.matches(o2[e3])) return o2[e3];
+ }
for (let e3 = 0; e3 < this._deepWildcards.length; e3++) if (t2.matches(this._deepWildcards[e3])) return this._deepWildcards[e3];
return null;
}
}
- const U = { cent: "\xA2", pound: "\xA3", curren: "\xA4", yen: "\xA5", euro: "\u20AC", dollar: "$", euro: "\u20AC", fnof: "\u0192", inr: "\u20B9", af: "\u060B", birr: "\u1265\u122D", peso: "\u20B1", rub: "\u20BD", won: "\u20A9", yuan: "\xA5", cedil: "\xB8" }, W = { amp: "&", apos: "'", gt: ">", lt: "<", quot: '"' }, X = { nbsp: "\xA0", copy: "\xA9", reg: "\xAE", trade: "\u2122", mdash: "\u2014", ndash: "\u2013", hellip: "\u2026", laquo: "\xAB", raquo: "\xBB", lsquo: "\u2018", rsquo: "\u2019", ldquo: "\u201C", rdquo: "\u201D", bull: "\u2022", para: "\xB6", sect: "\xA7", deg: "\xB0", frac12: "\xBD", frac14: "\xBC", frac34: "\xBE" }, Y = new Set("!?\\\\/[]$%{}^&*()<>|+");
- function z(t2) {
+ const lt2 = { cent: "\xA2", pound: "\xA3", curren: "\xA4", yen: "\xA5", euro: "\u20AC", dollar: "$", fnof: "\u0192", inr: "\u20B9", af: "\u060B", birr: "\u1265\u122D", peso: "\u20B1", rub: "\u20BD", won: "\u20A9", yuan: "\xA5", cedil: "\xB8" }, ct = { amp: "&", apos: "'", gt: ">", lt: "<", quot: '"' }, pt = { nbsp: "\xA0", copy: "\xA9", reg: "\xAE", trade: "\u2122", mdash: "\u2014", ndash: "\u2013", hellip: "\u2026", laquo: "\xAB", raquo: "\xBB", lsquo: "\u2018", rsquo: "\u2019", ldquo: "\u201C", rdquo: "\u201D", bull: "\u2022", para: "\xB6", sect: "\xA7", deg: "\xB0", frac12: "\xBD", frac14: "\xBC", frac34: "\xBE" }, ht = Object.freeze({ ALLOW: "allow", BLOCK: "block", THROW: "throw" }), dt = new Set("!?\\\\/[]$%{}^&*()<>|+");
+ function ut(t2) {
if ("#" === t2[0]) throw new Error(`[EntityReplacer] Invalid character '#' in entity name: "${t2}"`);
- for (const e2 of t2) if (Y.has(e2)) throw new Error(`[EntityReplacer] Invalid character '${e2}' in entity name: "${t2}"`);
+ for (const e2 of t2) if (dt.has(e2)) throw new Error(`[EntityReplacer] Invalid character '${e2}' in entity name: "${t2}"`);
return t2;
}
- function q(...t2) {
+ function ft(...t2) {
const e2 = /* @__PURE__ */ Object.create(null);
for (const n2 of t2) if (n2) for (const t3 of Object.keys(n2)) {
const i2 = n2[t3];
@@ -55248,27 +55464,40 @@ var require_fxp = __commonJS({
}
return e2;
}
- const Z = "external", J = "base", K = "all", Q = Object.freeze({ allow: 0, leave: 1, remove: 2, throw: 3 }), H = /* @__PURE__ */ new Set([9, 10, 13]);
- class tt {
+ const gt = "external", mt = "base", xt = "all", bt = Object.freeze({ allow: 0, leave: 1, remove: 2, throw: 3 }), yt = /* @__PURE__ */ new Set([9, 10, 13]);
+ class Nt {
constructor(t2 = {}) {
var e2;
- this._limit = t2.limit || {}, this._maxTotalExpansions = this._limit.maxTotalExpansions || 0, this._maxExpandedLength = this._limit.maxExpandedLength || 0, this._postCheck = "function" == typeof t2.postCheck ? t2.postCheck : (t3) => t3, this._limitTiers = (e2 = this._limit.applyLimitsTo ?? Z) && e2 !== Z ? e2 === K ? /* @__PURE__ */ new Set([K]) : e2 === J ? /* @__PURE__ */ new Set([J]) : Array.isArray(e2) ? new Set(e2) : /* @__PURE__ */ new Set([Z]) : /* @__PURE__ */ new Set([Z]), this._numericAllowed = t2.numericAllowed ?? true, this._baseMap = q(W, t2.namedEntities || null), this._externalMap = /* @__PURE__ */ Object.create(null), this._inputMap = /* @__PURE__ */ Object.create(null), this._totalExpansions = 0, this._expandedLength = 0, this._removeSet = new Set(t2.remove && Array.isArray(t2.remove) ? t2.remove : []), this._leaveSet = new Set(t2.leave && Array.isArray(t2.leave) ? t2.leave : []);
+ this._limit = t2.limit || {}, this._maxTotalExpansions = this._limit.maxTotalExpansions || 0, this._maxExpandedLength = this._limit.maxExpandedLength || 0, this._postCheck = "function" == typeof t2.postCheck ? t2.postCheck : (t3) => t3, this._limitTiers = (e2 = this._limit.applyLimitsTo ?? gt) && e2 !== gt ? e2 === xt ? /* @__PURE__ */ new Set([xt]) : e2 === mt ? /* @__PURE__ */ new Set([mt]) : Array.isArray(e2) ? new Set(e2) : /* @__PURE__ */ new Set([gt]) : /* @__PURE__ */ new Set([gt]), this._numericAllowed = t2.numericAllowed ?? true, this._baseMap = ft(ct, t2.namedEntities || null), this._externalMap = /* @__PURE__ */ Object.create(null), this._inputMap = /* @__PURE__ */ Object.create(null), this._totalExpansions = 0, this._expandedLength = 0, this._removeSet = new Set(t2.remove && Array.isArray(t2.remove) ? t2.remove : []), this._leaveSet = new Set(t2.leave && Array.isArray(t2.leave) ? t2.leave : []);
const n2 = (function(t3) {
- if (!t3) return { xmlVersion: 1, onLevel: Q.allow, nullLevel: Q.remove };
- const e3 = 1.1 === t3.xmlVersion ? 1.1 : 1, n3 = Q[t3.onNCR] ?? Q.allow, i2 = Q[t3.nullNCR] ?? Q.remove;
- return { xmlVersion: e3, onLevel: n3, nullLevel: Math.max(i2, Q.remove) };
+ if (!t3) return { xmlVersion: 1, onLevel: bt.allow, nullLevel: bt.remove };
+ const e3 = 1.1 === t3.xmlVersion ? 1.1 : 1, n3 = bt[t3.onNCR] ?? bt.allow, i2 = bt[t3.nullNCR] ?? bt.remove;
+ return { xmlVersion: e3, onLevel: n3, nullLevel: Math.max(i2, bt.remove) };
})(t2.ncr);
- this._ncrXmlVersion = n2.xmlVersion, this._ncrOnLevel = n2.onLevel, this._ncrNullLevel = n2.nullLevel;
+ this._ncrXmlVersion = n2.xmlVersion, this._ncrOnLevel = n2.onLevel, this._ncrNullLevel = n2.nullLevel, this._onExternalEntity = "function" == typeof t2.onExternalEntity ? t2.onExternalEntity : null, this._onInputEntity = "function" == typeof t2.onInputEntity ? t2.onInputEntity : null;
+ }
+ _applyRegistrationHook(t2, e2, n2, i2) {
+ if (!t2) return true;
+ const r2 = t2(e2, n2);
+ if (r2 === ht.BLOCK) return false;
+ if (r2 === ht.THROW) throw new Error(`[EntityDecoder] Registration of ${i2} entity "&${e2};" was rejected by hook`);
+ return true;
}
setExternalEntities(t2) {
- if (t2) for (const e2 of Object.keys(t2)) z(e2);
- this._externalMap = q(t2);
+ if (t2) for (const e3 of Object.keys(t2)) ut(e3);
+ if (!this._onExternalEntity) return void (this._externalMap = ft(t2));
+ const e2 = ft(t2), n2 = /* @__PURE__ */ Object.create(null);
+ for (const [t3, i2] of Object.entries(e2)) this._applyRegistrationHook(this._onExternalEntity, t3, i2, "external") && (n2[t3] = i2);
+ this._externalMap = n2;
}
addExternalEntity(t2, e2) {
- z(t2), "string" == typeof e2 && -1 === e2.indexOf("&") && (this._externalMap[t2] = e2);
+ ut(t2), "string" == typeof e2 && -1 === e2.indexOf("&") && this._applyRegistrationHook(this._onExternalEntity, t2, e2, "external") && (this._externalMap[t2] = e2);
}
addInputEntities(t2) {
- this._totalExpansions = 0, this._expandedLength = 0, this._inputMap = q(t2);
+ if (this._totalExpansions = 0, this._expandedLength = 0, !this._onInputEntity) return void (this._inputMap = ft(t2));
+ const e2 = ft(t2), n2 = /* @__PURE__ */ Object.create(null);
+ for (const [t3, i2] of Object.entries(e2)) this._applyRegistrationHook(this._onInputEntity, t3, i2, "input") && (n2[t3] = i2);
+ this._inputMap = n2;
}
reset() {
return this._inputMap = /* @__PURE__ */ Object.create(null), this._totalExpansions = 0, this._expandedLength = 0, this;
@@ -55278,76 +55507,77 @@ var require_fxp = __commonJS({
}
decode(t2) {
if ("string" != typeof t2 || 0 === t2.length) return t2;
+ if (-1 === t2.indexOf("&")) return t2;
const e2 = t2, n2 = [], i2 = t2.length;
- let s2 = 0, r2 = 0;
- const o2 = this._maxTotalExpansions > 0, a2 = this._maxExpandedLength > 0, h2 = o2 || a2;
- for (; r2 < i2; ) {
- if (38 !== t2.charCodeAt(r2)) {
- r2++;
+ let r2 = 0, s2 = 0;
+ const o2 = this._maxTotalExpansions > 0, a2 = this._maxExpandedLength > 0, l2 = o2 || a2;
+ for (; s2 < i2; ) {
+ if (38 !== t2.charCodeAt(s2)) {
+ s2++;
continue;
}
- let e3 = r2 + 1;
- for (; e3 < i2 && 59 !== t2.charCodeAt(e3) && e3 - r2 <= 32; ) e3++;
+ let e3 = s2 + 1;
+ for (; e3 < i2 && 59 !== t2.charCodeAt(e3) && e3 - s2 <= 32; ) e3++;
if (e3 >= i2 || 59 !== t2.charCodeAt(e3)) {
- r2++;
+ s2++;
continue;
}
- const l3 = t2.slice(r2 + 1, e3);
- if (0 === l3.length) {
- r2++;
+ const c3 = t2.slice(s2 + 1, e3);
+ if (0 === c3.length) {
+ s2++;
continue;
}
- let u2, p2;
- if (this._removeSet.has(l3)) u2 = "", void 0 === p2 && (p2 = Z);
+ let p2, h2;
+ if (this._removeSet.has(c3)) p2 = "", void 0 === h2 && (h2 = gt);
else {
- if (this._leaveSet.has(l3)) {
- r2++;
+ if (this._leaveSet.has(c3)) {
+ s2++;
continue;
}
- if (35 === l3.charCodeAt(0)) {
- const t3 = this._resolveNCR(l3);
+ if (35 === c3.charCodeAt(0)) {
+ const t3 = this._resolveNCR(c3);
if (void 0 === t3) {
- r2++;
+ s2++;
continue;
}
- u2 = t3, p2 = J;
+ p2 = t3, h2 = mt;
} else {
- const t3 = this._resolveName(l3);
- u2 = t3?.value, p2 = t3?.tier;
+ const t3 = this._resolveName(c3);
+ p2 = t3?.value, h2 = t3?.tier;
}
}
- if (void 0 !== u2) {
- if (r2 > s2 && n2.push(t2.slice(s2, r2)), n2.push(u2), s2 = e3 + 1, r2 = s2, h2 && this._tierCounts(p2)) {
+ if (void 0 !== p2) {
+ if (s2 > r2 && n2.push(t2.slice(r2, s2)), n2.push(p2), r2 = e3 + 1, s2 = r2, l2 && this._tierCounts(h2)) {
if (o2 && (this._totalExpansions++, this._totalExpansions > this._maxTotalExpansions)) throw new Error(`[EntityReplacer] Entity expansion count limit exceeded: ${this._totalExpansions} > ${this._maxTotalExpansions}`);
if (a2) {
- const t3 = u2.length - (l3.length + 2);
+ const t3 = p2.length - (c3.length + 2);
if (t3 > 0 && (this._expandedLength += t3, this._expandedLength > this._maxExpandedLength)) throw new Error(`[EntityReplacer] Expanded content length limit exceeded: ${this._expandedLength} > ${this._maxExpandedLength}`);
}
}
- } else r2++;
+ } else s2++;
}
- s2 < i2 && n2.push(t2.slice(s2));
- const l2 = 0 === n2.length ? t2 : n2.join("");
- return this._postCheck(l2, e2);
+ r2 < i2 && n2.push(t2.slice(r2));
+ const c2 = 0 === n2.length ? t2 : n2.join("");
+ return this._postCheck(c2, e2);
}
_tierCounts(t2) {
- return !!this._limitTiers.has(K) || this._limitTiers.has(t2);
+ return !!this._limitTiers.has(xt) || this._limitTiers.has(t2);
}
_resolveName(t2) {
- return t2 in this._inputMap ? { value: this._inputMap[t2], tier: Z } : t2 in this._externalMap ? { value: this._externalMap[t2], tier: Z } : t2 in this._baseMap ? { value: this._baseMap[t2], tier: J } : void 0;
+ return t2 in this._inputMap ? { value: this._inputMap[t2], tier: gt } : t2 in this._externalMap ? { value: this._externalMap[t2], tier: gt } : t2 in this._baseMap ? { value: this._baseMap[t2], tier: mt } : void 0;
}
_classifyNCR(t2) {
- return 0 === t2 ? this._ncrNullLevel : t2 >= 55296 && t2 <= 57343 || 1 === this._ncrXmlVersion && t2 >= 1 && t2 <= 31 && !H.has(t2) ? Q.remove : -1;
+ return 0 === t2 ? this._ncrNullLevel : t2 >= 55296 && t2 <= 57343 || 1 === this._ncrXmlVersion && t2 >= 1 && t2 <= 31 && !yt.has(t2) ? bt.remove : -1;
}
_applyNCRAction(t2, e2, n2) {
switch (t2) {
- case Q.allow:
+ case bt.allow:
return String.fromCodePoint(n2);
- case Q.remove:
+ case bt.remove:
return "";
- case Q.leave:
+ case bt.leave:
return;
- case Q.throw:
+ case bt.throw:
throw new Error(`[EntityDecoder] Prohibited numeric character reference &${e2}; (U+${n2.toString(16).toUpperCase().padStart(4, "0")})`);
default:
return String.fromCodePoint(n2);
@@ -55358,12 +55588,46 @@ var require_fxp = __commonJS({
let n2;
if (n2 = 120 === e2 || 88 === e2 ? parseInt(t2.slice(2), 16) : parseInt(t2.slice(1), 10), Number.isNaN(n2) || n2 < 0 || n2 > 1114111) return;
const i2 = this._classifyNCR(n2);
- if (!this._numericAllowed && i2 < Q.remove) return;
- const s2 = -1 === i2 ? this._ncrOnLevel : Math.max(this._ncrOnLevel, i2);
- return this._applyNCRAction(s2, t2, n2);
+ if (!this._numericAllowed && i2 < bt.remove) return;
+ const r2 = -1 === i2 ? this._ncrOnLevel : Math.max(this._ncrOnLevel, i2);
+ return this._applyNCRAction(r2, t2, n2);
}
}
- function et(t2, e2) {
+ const Et = [{ id: "sql-block-comment-open", description: "SQL block comment open: /* ... */ \u2014 unusual in legitimate user text", pattern: /\/\*/ }, { id: "sql-union-select", description: "UNION SELECT \u2014 most common SQL injection aggregation attack", pattern: /\bUNION\s{1,20}(?:ALL\s{1,20})?SELECT\b/i }, { id: "sql-drop-table", description: "DROP TABLE \u2014 destructive DDL injection", pattern: /\bDROP\s{1,20}TABLE\b/i }, { id: "sql-drop-database", description: "DROP DATABASE \u2014 destructive DDL injection", pattern: /\bDROP\s{1,20}DATABASE\b/i }, { id: "sql-insert-into", description: "INSERT INTO \u2014 data injection", pattern: /\bINSERT\s{1,20}INTO\b/i }, { id: "sql-delete-from", description: "DELETE FROM \u2014 data deletion injection", pattern: /\bDELETE\s{1,20}FROM\b/i }, { id: "sql-update-set", description: "UPDATE ... SET \u2014 data modification injection", pattern: /\bUPDATE\b[\s\S]{1,60}\bSET\b/i }, { id: "sql-exec-xp", description: "EXEC xp_ \u2014 MSSQL extended stored procedure execution", pattern: /\bEXEC(?:UTE)?\s{1,20}xp_/i }, { id: "sql-tautology-string", description: `Classic string tautology: ' OR '1'='1 or " OR "1"="1"`, pattern: /'\s{0,10}OR\s{0,10}'[^']{0,20}'\s*=\s*'[^']{0,20}/i }, { id: "sql-tautology-numeric", description: "Numeric tautology: OR 1=1", pattern: /\bOR\s{1,10}1\s*=\s*1\b/i }, { id: "sql-always-true-zero", description: "Numeric tautology: OR 0=0", pattern: /\bOR\s{1,10}0\s*=\s*0\b/i }, { id: "sql-sleep-benchmark", description: "Time-based blind injection: SLEEP() or BENCHMARK()", pattern: /\b(?:SLEEP|BENCHMARK)\s*\(/i }, { id: "sql-waitfor-delay", description: "MSSQL time-based blind injection: WAITFOR DELAY", pattern: /\bWAITFOR\s{1,20}DELAY\b/i }, { id: "sql-char-function", description: "CHAR() function \u2014 used to obfuscate injected strings", pattern: /\bCHAR\s*\(\s*\d{1,3}/i }, { id: "sql-information-schema", description: "INFORMATION_SCHEMA \u2014 reconnaissance query for table/column enumeration", pattern: /\bINFORMATION_SCHEMA\b/i }], wt = [...Et, { id: "sql-line-comment", description: "SQL line comment: -- followed by whitespace or end of string", pattern: /--(?:\s|$)/ }, { id: "sql-stacked-query", description: "Stacked queries: semicolon immediately followed by a SQL keyword", pattern: /;\s{0,10}(?:SELECT|INSERT|UPDATE|DELETE|DROP|CREATE|ALTER|EXEC)\b/i }, { id: "sql-hex-encoding", description: "Hex-encoded string injection: 0x41414141 style (MySQL)", pattern: /\b0x[0-9a-f]{4,}/i }], vt = Object.freeze({ colon: ":", Tab: " ", NewLine: "\n" }), St = /&(?:#[xX]0*([0-9a-fA-F]{1,6});?|#0*([0-9]{1,7});?|([a-zA-Z][a-zA-Z0-9]{1,15});)/g, At = [{ id: "html-script-open", description: "]/i }, { id: "html-javascript-protocol", description: "javascript: URI scheme (with optional whitespace/encoding)", pattern: /j[\t\n\r ]*a[\t\n\r ]*v[\t\n\r ]*a[\t\n\r ]*s[\t\n\r ]*c[\t\n\r ]*r[\t\n\r ]*i[\t\n\r ]*p[\t\n\r ]*t[\t\n\r ]*:/i }, { id: "html-vbscript-protocol", description: "vbscript: URI scheme", pattern: /vbscript[\t\n\r ]*:/i }, { id: "html-data-html", description: "data:text/html URI \u2014 can execute scripts in browsers", pattern: /data[\t\n\r ]*:[\t\n\r ]*text\/html/i }, { id: "html-data-xhtml", description: "data:application/xhtml+xml URI", pattern: /data[\t\n\r ]*:[\t\n\r ]*application\/xhtml/i }, { id: "html-data-svg", description: "data:image/svg+xml URI \u2014 can execute scripts", pattern: /data[\t\n\r ]*:[\t\n\r ]*image\/svg\+xml/i }, { id: "html-inline-event-handler", description: "Inline event handler attributes: onclick=, onerror=, onload=, etc.", pattern: /\bon\w{1,30}\s*=/i }, { id: "html-entity-obfuscated-script", description: "HTML-entity-encoded