@abaplint/cli 2.117.0 → 2.117.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/build/cli.js +909 -481
- package/package.json +4 -4
package/build/cli.js
CHANGED
|
@@ -8799,9 +8799,10 @@ const combi_1 = __webpack_require__(/*! ../combi */ "./node_modules/@abaplint/co
|
|
|
8799
8799
|
const _1 = __webpack_require__(/*! . */ "./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/index.js");
|
|
8800
8800
|
const wparen_leftw_1 = __webpack_require__(/*! ../../1_lexer/tokens/wparen_leftw */ "./node_modules/@abaplint/core/build/src/abap/1_lexer/tokens/wparen_leftw.js");
|
|
8801
8801
|
const wparen_left_1 = __webpack_require__(/*! ../../1_lexer/tokens/wparen_left */ "./node_modules/@abaplint/core/build/src/abap/1_lexer/tokens/wparen_left.js");
|
|
8802
|
+
const version_1 = __webpack_require__(/*! ../../../version */ "./node_modules/@abaplint/core/build/src/version.js");
|
|
8802
8803
|
class SQLIntoList extends combi_1.Expression {
|
|
8803
8804
|
getRunnable() {
|
|
8804
|
-
const intoList = (0, combi_1.seq)((0, combi_1.altPrio)((0, combi_1.tok)(wparen_left_1.WParenLeft), (0, combi_1.tok)(wparen_leftw_1.WParenLeftW)), (0, combi_1.starPrio)((0, combi_1.seq)(_1.SQLTarget, ",")), _1.SQLTarget, ")");
|
|
8805
|
+
const intoList = (0, combi_1.seq)((0, combi_1.altPrio)((0, combi_1.tok)(wparen_left_1.WParenLeft), (0, combi_1.ver)(version_1.Version.v740sp02, (0, combi_1.tok)(wparen_leftw_1.WParenLeftW))), (0, combi_1.starPrio)((0, combi_1.seq)(_1.SQLTarget, ",")), _1.SQLTarget, ")");
|
|
8805
8806
|
return (0, combi_1.seq)("INTO", intoList);
|
|
8806
8807
|
}
|
|
8807
8808
|
}
|
|
@@ -29012,36 +29013,36 @@ class SQLCompare {
|
|
|
29012
29013
|
if (sqlin) {
|
|
29013
29014
|
sql_in_1.SQLIn.runSyntax(sqlin, input);
|
|
29014
29015
|
}
|
|
29015
|
-
const fieldName = (_b = node.findDirectExpression(Expressions.SQLFieldName)) === null || _b === void 0 ? void 0 : _b.concatTokens();
|
|
29016
|
+
const fieldName = (_b = node.findDirectExpression(Expressions.SQLFieldName)) === null || _b === void 0 ? void 0 : _b.concatTokens().toUpperCase();
|
|
29016
29017
|
if (fieldName && sourceType && token) {
|
|
29017
29018
|
// check compatibility for rule sql_value_conversion
|
|
29018
29019
|
const targetType = this.findType(fieldName, tables, input.scope);
|
|
29019
29020
|
let message = "";
|
|
29020
29021
|
if (sourceType instanceof basic_1.IntegerType
|
|
29021
29022
|
&& targetType instanceof basic_1.CharacterType) {
|
|
29022
|
-
message =
|
|
29023
|
+
message = `${fieldName}: Integer to CHAR conversion`;
|
|
29023
29024
|
}
|
|
29024
29025
|
else if (sourceType instanceof basic_1.IntegerType
|
|
29025
29026
|
&& targetType instanceof basic_1.NumericType) {
|
|
29026
|
-
message =
|
|
29027
|
+
message = `${fieldName}: Integer to NUMC conversion`;
|
|
29027
29028
|
}
|
|
29028
29029
|
else if (sourceType instanceof basic_1.NumericType
|
|
29029
29030
|
&& targetType instanceof basic_1.IntegerType) {
|
|
29030
|
-
message =
|
|
29031
|
+
message = `${fieldName}: NUMC to Integer conversion`;
|
|
29031
29032
|
}
|
|
29032
29033
|
else if (sourceType instanceof basic_1.CharacterType
|
|
29033
29034
|
&& targetType instanceof basic_1.IntegerType) {
|
|
29034
|
-
message =
|
|
29035
|
+
message = `${fieldName}: CHAR to Integer conversion`;
|
|
29035
29036
|
}
|
|
29036
29037
|
else if (sourceType instanceof basic_1.CharacterType
|
|
29037
29038
|
&& targetType instanceof basic_1.CharacterType
|
|
29038
29039
|
&& sourceType.getLength() > targetType.getLength()) {
|
|
29039
|
-
message =
|
|
29040
|
+
message = `${fieldName}: Source field longer than database field, CHAR -> CHAR`;
|
|
29040
29041
|
}
|
|
29041
29042
|
else if (sourceType instanceof basic_1.NumericType
|
|
29042
29043
|
&& targetType instanceof basic_1.NumericType
|
|
29043
29044
|
&& sourceType.getLength() > targetType.getLength()) {
|
|
29044
|
-
message =
|
|
29045
|
+
message = `${fieldName}: Source field longer than database field, NUMC -> NUMC`;
|
|
29045
29046
|
}
|
|
29046
29047
|
if (message !== "") {
|
|
29047
29048
|
input.scope.addSQLConversion(fieldName, message, token);
|
|
@@ -47104,6 +47105,12 @@ exports.AbstractObject = AbstractObject;
|
|
|
47104
47105
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
47105
47106
|
exports.parseDynpros = parseDynpros;
|
|
47106
47107
|
const xml_utils_1 = __webpack_require__(/*! ../xml_utils */ "./node_modules/@abaplint/core/build/src/xml_utils.js");
|
|
47108
|
+
function parseNumber(value) {
|
|
47109
|
+
if (value === undefined) {
|
|
47110
|
+
return 0;
|
|
47111
|
+
}
|
|
47112
|
+
return parseInt(value, 10);
|
|
47113
|
+
}
|
|
47107
47114
|
function parseDynpros(parsed) {
|
|
47108
47115
|
var _a, _b, _c, _d;
|
|
47109
47116
|
const dynpros = [];
|
|
@@ -47115,7 +47122,10 @@ function parseDynpros(parsed) {
|
|
|
47115
47122
|
fields.push({
|
|
47116
47123
|
name: f.NAME,
|
|
47117
47124
|
type: f.TYPE,
|
|
47118
|
-
length: f.LENGTH,
|
|
47125
|
+
length: parseNumber(f.LENGTH),
|
|
47126
|
+
line: parseNumber(f.LINE),
|
|
47127
|
+
column: parseNumber(f.COLUMN),
|
|
47128
|
+
height: parseNumber(f.HEIGHT),
|
|
47119
47129
|
});
|
|
47120
47130
|
}
|
|
47121
47131
|
dynpros.push({
|
|
@@ -55805,7 +55815,7 @@ class Registry {
|
|
|
55805
55815
|
}
|
|
55806
55816
|
static abaplintVersion() {
|
|
55807
55817
|
// magic, see build script "version.sh"
|
|
55808
|
-
return "2.117.
|
|
55818
|
+
return "2.117.1";
|
|
55809
55819
|
}
|
|
55810
55820
|
getDDICReferences() {
|
|
55811
55821
|
return this.ddicReferences;
|
|
@@ -64109,7 +64119,7 @@ class DynproChecks {
|
|
|
64109
64119
|
key: "dynpro_checks",
|
|
64110
64120
|
title: "Dynpro Checks",
|
|
64111
64121
|
shortDescription: `Various Dynpro checks`,
|
|
64112
|
-
extendedInformation: `* Check length of PUSH elements less than 132`,
|
|
64122
|
+
extendedInformation: `* Check length of PUSH elements less than 132\n* Check for overlapping screen elements`,
|
|
64113
64123
|
tags: [_irule_1.RuleTag.Syntax],
|
|
64114
64124
|
};
|
|
64115
64125
|
}
|
|
@@ -64138,9 +64148,43 @@ class DynproChecks {
|
|
|
64138
64148
|
ret.push(issue_1.Issue.atPosition(file, new position_1.Position(1, 1), message, this.getMetadata().key, this.getConfig().severity));
|
|
64139
64149
|
}
|
|
64140
64150
|
}
|
|
64151
|
+
ret.push(...this.findOverlappingFields(dynpro, file));
|
|
64152
|
+
}
|
|
64153
|
+
return ret;
|
|
64154
|
+
}
|
|
64155
|
+
findOverlappingFields(dynpro, file) {
|
|
64156
|
+
const ret = [];
|
|
64157
|
+
for (let index = 0; index < dynpro.fields.length; index++) {
|
|
64158
|
+
const current = dynpro.fields[index];
|
|
64159
|
+
if (current.name === undefined) {
|
|
64160
|
+
continue;
|
|
64161
|
+
}
|
|
64162
|
+
for (let compare = index + 1; compare < dynpro.fields.length; compare++) {
|
|
64163
|
+
const other = dynpro.fields[compare];
|
|
64164
|
+
if (other.name === undefined || this.overlaps(current, other) === false) {
|
|
64165
|
+
continue;
|
|
64166
|
+
}
|
|
64167
|
+
const message = `Screen ${dynpro.number}, fields ${current.name} and ${other.name} are overlapping`;
|
|
64168
|
+
ret.push(issue_1.Issue.atPosition(file, new position_1.Position(1, 1), message, this.getMetadata().key, this.getConfig().severity));
|
|
64169
|
+
}
|
|
64141
64170
|
}
|
|
64142
64171
|
return ret;
|
|
64143
64172
|
}
|
|
64173
|
+
overlaps(first, second) {
|
|
64174
|
+
if (first.line === 0 || second.line === 0 || first.column === 0 || second.column === 0) {
|
|
64175
|
+
return false;
|
|
64176
|
+
}
|
|
64177
|
+
const firstHeight = Math.max(first.height, 1);
|
|
64178
|
+
const secondHeight = Math.max(second.height, 1);
|
|
64179
|
+
const firstLastLine = first.line + firstHeight - 1;
|
|
64180
|
+
const secondLastLine = second.line + secondHeight - 1;
|
|
64181
|
+
if (firstLastLine < second.line || secondLastLine < first.line) {
|
|
64182
|
+
return false;
|
|
64183
|
+
}
|
|
64184
|
+
const firstLastColumn = first.column + Math.max(first.length, 1) - 1;
|
|
64185
|
+
const secondLastColumn = second.column + Math.max(second.length, 1) - 1;
|
|
64186
|
+
return first.column <= secondLastColumn && second.column <= firstLastColumn;
|
|
64187
|
+
}
|
|
64144
64188
|
}
|
|
64145
64189
|
exports.DynproChecks = DynproChecks;
|
|
64146
64190
|
//# sourceMappingURL=dynpro_checks.js.map
|
|
@@ -86037,289 +86081,14 @@ module.exports = require("zlib");
|
|
|
86037
86081
|
|
|
86038
86082
|
/***/ },
|
|
86039
86083
|
|
|
86040
|
-
/***/ "./node_modules/@isaacs/balanced-match/dist/commonjs/index.js"
|
|
86041
|
-
/*!********************************************************************!*\
|
|
86042
|
-
!*** ./node_modules/@isaacs/balanced-match/dist/commonjs/index.js ***!
|
|
86043
|
-
\********************************************************************/
|
|
86044
|
-
(__unused_webpack_module, exports) {
|
|
86045
|
-
|
|
86046
|
-
"use strict";
|
|
86047
|
-
|
|
86048
|
-
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
86049
|
-
exports.range = exports.balanced = void 0;
|
|
86050
|
-
const balanced = (a, b, str) => {
|
|
86051
|
-
const ma = a instanceof RegExp ? maybeMatch(a, str) : a;
|
|
86052
|
-
const mb = b instanceof RegExp ? maybeMatch(b, str) : b;
|
|
86053
|
-
const r = ma !== null && mb != null && (0, exports.range)(ma, mb, str);
|
|
86054
|
-
return (r && {
|
|
86055
|
-
start: r[0],
|
|
86056
|
-
end: r[1],
|
|
86057
|
-
pre: str.slice(0, r[0]),
|
|
86058
|
-
body: str.slice(r[0] + ma.length, r[1]),
|
|
86059
|
-
post: str.slice(r[1] + mb.length),
|
|
86060
|
-
});
|
|
86061
|
-
};
|
|
86062
|
-
exports.balanced = balanced;
|
|
86063
|
-
const maybeMatch = (reg, str) => {
|
|
86064
|
-
const m = str.match(reg);
|
|
86065
|
-
return m ? m[0] : null;
|
|
86066
|
-
};
|
|
86067
|
-
const range = (a, b, str) => {
|
|
86068
|
-
let begs, beg, left, right = undefined, result;
|
|
86069
|
-
let ai = str.indexOf(a);
|
|
86070
|
-
let bi = str.indexOf(b, ai + 1);
|
|
86071
|
-
let i = ai;
|
|
86072
|
-
if (ai >= 0 && bi > 0) {
|
|
86073
|
-
if (a === b) {
|
|
86074
|
-
return [ai, bi];
|
|
86075
|
-
}
|
|
86076
|
-
begs = [];
|
|
86077
|
-
left = str.length;
|
|
86078
|
-
while (i >= 0 && !result) {
|
|
86079
|
-
if (i === ai) {
|
|
86080
|
-
begs.push(i);
|
|
86081
|
-
ai = str.indexOf(a, i + 1);
|
|
86082
|
-
}
|
|
86083
|
-
else if (begs.length === 1) {
|
|
86084
|
-
const r = begs.pop();
|
|
86085
|
-
if (r !== undefined)
|
|
86086
|
-
result = [r, bi];
|
|
86087
|
-
}
|
|
86088
|
-
else {
|
|
86089
|
-
beg = begs.pop();
|
|
86090
|
-
if (beg !== undefined && beg < left) {
|
|
86091
|
-
left = beg;
|
|
86092
|
-
right = bi;
|
|
86093
|
-
}
|
|
86094
|
-
bi = str.indexOf(b, i + 1);
|
|
86095
|
-
}
|
|
86096
|
-
i = ai < bi && ai >= 0 ? ai : bi;
|
|
86097
|
-
}
|
|
86098
|
-
if (begs.length && right !== undefined) {
|
|
86099
|
-
result = [left, right];
|
|
86100
|
-
}
|
|
86101
|
-
}
|
|
86102
|
-
return result;
|
|
86103
|
-
};
|
|
86104
|
-
exports.range = range;
|
|
86105
|
-
//# sourceMappingURL=index.js.map
|
|
86106
|
-
|
|
86107
|
-
/***/ },
|
|
86108
|
-
|
|
86109
|
-
/***/ "./node_modules/@isaacs/brace-expansion/dist/commonjs/index.js"
|
|
86110
|
-
/*!*********************************************************************!*\
|
|
86111
|
-
!*** ./node_modules/@isaacs/brace-expansion/dist/commonjs/index.js ***!
|
|
86112
|
-
\*********************************************************************/
|
|
86113
|
-
(__unused_webpack_module, exports, __webpack_require__) {
|
|
86114
|
-
|
|
86115
|
-
"use strict";
|
|
86116
|
-
|
|
86117
|
-
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
86118
|
-
exports.expand = expand;
|
|
86119
|
-
const balanced_match_1 = __webpack_require__(/*! @isaacs/balanced-match */ "./node_modules/@isaacs/balanced-match/dist/commonjs/index.js");
|
|
86120
|
-
const escSlash = '\0SLASH' + Math.random() + '\0';
|
|
86121
|
-
const escOpen = '\0OPEN' + Math.random() + '\0';
|
|
86122
|
-
const escClose = '\0CLOSE' + Math.random() + '\0';
|
|
86123
|
-
const escComma = '\0COMMA' + Math.random() + '\0';
|
|
86124
|
-
const escPeriod = '\0PERIOD' + Math.random() + '\0';
|
|
86125
|
-
const escSlashPattern = new RegExp(escSlash, 'g');
|
|
86126
|
-
const escOpenPattern = new RegExp(escOpen, 'g');
|
|
86127
|
-
const escClosePattern = new RegExp(escClose, 'g');
|
|
86128
|
-
const escCommaPattern = new RegExp(escComma, 'g');
|
|
86129
|
-
const escPeriodPattern = new RegExp(escPeriod, 'g');
|
|
86130
|
-
const slashPattern = /\\\\/g;
|
|
86131
|
-
const openPattern = /\\{/g;
|
|
86132
|
-
const closePattern = /\\}/g;
|
|
86133
|
-
const commaPattern = /\\,/g;
|
|
86134
|
-
const periodPattern = /\\./g;
|
|
86135
|
-
function numeric(str) {
|
|
86136
|
-
return !isNaN(str) ? parseInt(str, 10) : str.charCodeAt(0);
|
|
86137
|
-
}
|
|
86138
|
-
function escapeBraces(str) {
|
|
86139
|
-
return str
|
|
86140
|
-
.replace(slashPattern, escSlash)
|
|
86141
|
-
.replace(openPattern, escOpen)
|
|
86142
|
-
.replace(closePattern, escClose)
|
|
86143
|
-
.replace(commaPattern, escComma)
|
|
86144
|
-
.replace(periodPattern, escPeriod);
|
|
86145
|
-
}
|
|
86146
|
-
function unescapeBraces(str) {
|
|
86147
|
-
return str
|
|
86148
|
-
.replace(escSlashPattern, '\\')
|
|
86149
|
-
.replace(escOpenPattern, '{')
|
|
86150
|
-
.replace(escClosePattern, '}')
|
|
86151
|
-
.replace(escCommaPattern, ',')
|
|
86152
|
-
.replace(escPeriodPattern, '.');
|
|
86153
|
-
}
|
|
86154
|
-
/**
|
|
86155
|
-
* Basically just str.split(","), but handling cases
|
|
86156
|
-
* where we have nested braced sections, which should be
|
|
86157
|
-
* treated as individual members, like {a,{b,c},d}
|
|
86158
|
-
*/
|
|
86159
|
-
function parseCommaParts(str) {
|
|
86160
|
-
if (!str) {
|
|
86161
|
-
return [''];
|
|
86162
|
-
}
|
|
86163
|
-
const parts = [];
|
|
86164
|
-
const m = (0, balanced_match_1.balanced)('{', '}', str);
|
|
86165
|
-
if (!m) {
|
|
86166
|
-
return str.split(',');
|
|
86167
|
-
}
|
|
86168
|
-
const { pre, body, post } = m;
|
|
86169
|
-
const p = pre.split(',');
|
|
86170
|
-
p[p.length - 1] += '{' + body + '}';
|
|
86171
|
-
const postParts = parseCommaParts(post);
|
|
86172
|
-
if (post.length) {
|
|
86173
|
-
;
|
|
86174
|
-
p[p.length - 1] += postParts.shift();
|
|
86175
|
-
p.push.apply(p, postParts);
|
|
86176
|
-
}
|
|
86177
|
-
parts.push.apply(parts, p);
|
|
86178
|
-
return parts;
|
|
86179
|
-
}
|
|
86180
|
-
function expand(str) {
|
|
86181
|
-
if (!str) {
|
|
86182
|
-
return [];
|
|
86183
|
-
}
|
|
86184
|
-
// I don't know why Bash 4.3 does this, but it does.
|
|
86185
|
-
// Anything starting with {} will have the first two bytes preserved
|
|
86186
|
-
// but *only* at the top level, so {},a}b will not expand to anything,
|
|
86187
|
-
// but a{},b}c will be expanded to [a}c,abc].
|
|
86188
|
-
// One could argue that this is a bug in Bash, but since the goal of
|
|
86189
|
-
// this module is to match Bash's rules, we escape a leading {}
|
|
86190
|
-
if (str.slice(0, 2) === '{}') {
|
|
86191
|
-
str = '\\{\\}' + str.slice(2);
|
|
86192
|
-
}
|
|
86193
|
-
return expand_(escapeBraces(str), true).map(unescapeBraces);
|
|
86194
|
-
}
|
|
86195
|
-
function embrace(str) {
|
|
86196
|
-
return '{' + str + '}';
|
|
86197
|
-
}
|
|
86198
|
-
function isPadded(el) {
|
|
86199
|
-
return /^-?0\d/.test(el);
|
|
86200
|
-
}
|
|
86201
|
-
function lte(i, y) {
|
|
86202
|
-
return i <= y;
|
|
86203
|
-
}
|
|
86204
|
-
function gte(i, y) {
|
|
86205
|
-
return i >= y;
|
|
86206
|
-
}
|
|
86207
|
-
function expand_(str, isTop) {
|
|
86208
|
-
/** @type {string[]} */
|
|
86209
|
-
const expansions = [];
|
|
86210
|
-
const m = (0, balanced_match_1.balanced)('{', '}', str);
|
|
86211
|
-
if (!m)
|
|
86212
|
-
return [str];
|
|
86213
|
-
// no need to expand pre, since it is guaranteed to be free of brace-sets
|
|
86214
|
-
const pre = m.pre;
|
|
86215
|
-
const post = m.post.length ? expand_(m.post, false) : [''];
|
|
86216
|
-
if (/\$$/.test(m.pre)) {
|
|
86217
|
-
for (let k = 0; k < post.length; k++) {
|
|
86218
|
-
const expansion = pre + '{' + m.body + '}' + post[k];
|
|
86219
|
-
expansions.push(expansion);
|
|
86220
|
-
}
|
|
86221
|
-
}
|
|
86222
|
-
else {
|
|
86223
|
-
const isNumericSequence = /^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(m.body);
|
|
86224
|
-
const isAlphaSequence = /^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(m.body);
|
|
86225
|
-
const isSequence = isNumericSequence || isAlphaSequence;
|
|
86226
|
-
const isOptions = m.body.indexOf(',') >= 0;
|
|
86227
|
-
if (!isSequence && !isOptions) {
|
|
86228
|
-
// {a},b}
|
|
86229
|
-
if (m.post.match(/,(?!,).*\}/)) {
|
|
86230
|
-
str = m.pre + '{' + m.body + escClose + m.post;
|
|
86231
|
-
return expand_(str);
|
|
86232
|
-
}
|
|
86233
|
-
return [str];
|
|
86234
|
-
}
|
|
86235
|
-
let n;
|
|
86236
|
-
if (isSequence) {
|
|
86237
|
-
n = m.body.split(/\.\./);
|
|
86238
|
-
}
|
|
86239
|
-
else {
|
|
86240
|
-
n = parseCommaParts(m.body);
|
|
86241
|
-
if (n.length === 1 && n[0] !== undefined) {
|
|
86242
|
-
// x{{a,b}}y ==> x{a}y x{b}y
|
|
86243
|
-
n = expand_(n[0], false).map(embrace);
|
|
86244
|
-
//XXX is this necessary? Can't seem to hit it in tests.
|
|
86245
|
-
/* c8 ignore start */
|
|
86246
|
-
if (n.length === 1) {
|
|
86247
|
-
return post.map(p => m.pre + n[0] + p);
|
|
86248
|
-
}
|
|
86249
|
-
/* c8 ignore stop */
|
|
86250
|
-
}
|
|
86251
|
-
}
|
|
86252
|
-
// at this point, n is the parts, and we know it's not a comma set
|
|
86253
|
-
// with a single entry.
|
|
86254
|
-
let N;
|
|
86255
|
-
if (isSequence && n[0] !== undefined && n[1] !== undefined) {
|
|
86256
|
-
const x = numeric(n[0]);
|
|
86257
|
-
const y = numeric(n[1]);
|
|
86258
|
-
const width = Math.max(n[0].length, n[1].length);
|
|
86259
|
-
let incr = n.length === 3 && n[2] !== undefined ? Math.abs(numeric(n[2])) : 1;
|
|
86260
|
-
let test = lte;
|
|
86261
|
-
const reverse = y < x;
|
|
86262
|
-
if (reverse) {
|
|
86263
|
-
incr *= -1;
|
|
86264
|
-
test = gte;
|
|
86265
|
-
}
|
|
86266
|
-
const pad = n.some(isPadded);
|
|
86267
|
-
N = [];
|
|
86268
|
-
for (let i = x; test(i, y); i += incr) {
|
|
86269
|
-
let c;
|
|
86270
|
-
if (isAlphaSequence) {
|
|
86271
|
-
c = String.fromCharCode(i);
|
|
86272
|
-
if (c === '\\') {
|
|
86273
|
-
c = '';
|
|
86274
|
-
}
|
|
86275
|
-
}
|
|
86276
|
-
else {
|
|
86277
|
-
c = String(i);
|
|
86278
|
-
if (pad) {
|
|
86279
|
-
const need = width - c.length;
|
|
86280
|
-
if (need > 0) {
|
|
86281
|
-
const z = new Array(need + 1).join('0');
|
|
86282
|
-
if (i < 0) {
|
|
86283
|
-
c = '-' + z + c.slice(1);
|
|
86284
|
-
}
|
|
86285
|
-
else {
|
|
86286
|
-
c = z + c;
|
|
86287
|
-
}
|
|
86288
|
-
}
|
|
86289
|
-
}
|
|
86290
|
-
}
|
|
86291
|
-
N.push(c);
|
|
86292
|
-
}
|
|
86293
|
-
}
|
|
86294
|
-
else {
|
|
86295
|
-
N = [];
|
|
86296
|
-
for (let j = 0; j < n.length; j++) {
|
|
86297
|
-
N.push.apply(N, expand_(n[j], false));
|
|
86298
|
-
}
|
|
86299
|
-
}
|
|
86300
|
-
for (let j = 0; j < N.length; j++) {
|
|
86301
|
-
for (let k = 0; k < post.length; k++) {
|
|
86302
|
-
const expansion = pre + N[j] + post[k];
|
|
86303
|
-
if (!isTop || isSequence || expansion) {
|
|
86304
|
-
expansions.push(expansion);
|
|
86305
|
-
}
|
|
86306
|
-
}
|
|
86307
|
-
}
|
|
86308
|
-
}
|
|
86309
|
-
return expansions;
|
|
86310
|
-
}
|
|
86311
|
-
//# sourceMappingURL=index.js.map
|
|
86312
|
-
|
|
86313
|
-
/***/ },
|
|
86314
|
-
|
|
86315
86084
|
/***/ "./node_modules/fast-xml-parser/lib/fxp.cjs"
|
|
86316
86085
|
/*!**************************************************!*\
|
|
86317
86086
|
!*** ./node_modules/fast-xml-parser/lib/fxp.cjs ***!
|
|
86318
86087
|
\**************************************************/
|
|
86319
86088
|
(module) {
|
|
86320
86089
|
|
|
86321
|
-
(()=>{"use strict";var t={d:(e,i)=>{for(var n in i)t.o(i,n)&&!t.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:i[n]})},o:(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r:t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})}},e={};t.r(e),t.d(e,{XMLBuilder:()=>vt,XMLParser:()=>ht,XMLValidator:()=>Tt});const i=":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",n=new RegExp("^["+i+"]["+i+"\\-.\\d\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*$");function s(t,e){const i=[];let n=e.exec(t);for(;n;){const s=[];s.startIndex=e.lastIndex-n[0].length;const r=n.length;for(let t=0;t<r;t++)s.push(n[t]);i.push(s),n=e.exec(t)}return i}const r=function(t){return!(null==n.exec(t))},o={allowBooleanAttributes:!1,unpairedTags:[]};function a(t,e){e=Object.assign({},o,e);const i=[];let n=!1,s=!1;"\ufeff"===t[0]&&(t=t.substr(1));for(let r=0;r<t.length;r++)if("<"===t[r]&&"?"===t[r+1]){if(r+=2,r=l(t,r),r.err)return r}else{if("<"!==t[r]){if(h(t[r]))continue;return x("InvalidChar","char '"+t[r]+"' is not expected.",E(t,r))}{let o=r;if(r++,"!"===t[r]){r=p(t,r);continue}{let a=!1;"/"===t[r]&&(a=!0,r++);let u="";for(;r<t.length&&">"!==t[r]&&" "!==t[r]&&"\t"!==t[r]&&"\n"!==t[r]&&"\r"!==t[r];r++)u+=t[r];if(u=u.trim(),"/"===u[u.length-1]&&(u=u.substring(0,u.length-1),r--),!b(u)){let e;return e=0===u.trim().length?"Invalid space after '<'.":"Tag '"+u+"' is an invalid name.",x("InvalidTag",e,E(t,r))}const c=d(t,r);if(!1===c)return x("InvalidAttr","Attributes for '"+u+"' have open quote.",E(t,r));let f=c.value;if(r=c.index,"/"===f[f.length-1]){const i=r-f.length;f=f.substring(0,f.length-1);const s=g(f,e);if(!0!==s)return x(s.err.code,s.err.msg,E(t,i+s.err.line));n=!0}else if(a){if(!c.tagClosed)return x("InvalidTag","Closing tag '"+u+"' doesn't have proper closing.",E(t,r));if(f.trim().length>0)return x("InvalidTag","Closing tag '"+u+"' can't have attributes or invalid starting.",E(t,o));if(0===i.length)return x("InvalidTag","Closing tag '"+u+"' has not been opened.",E(t,o));{const e=i.pop();if(u!==e.tagName){let i=E(t,e.tagStartPos);return x("InvalidTag","Expected closing tag '"+e.tagName+"' (opened in line "+i.line+", col "+i.col+") instead of closing tag '"+u+"'.",E(t,o))}0==i.length&&(s=!0)}}else{const a=g(f,e);if(!0!==a)return x(a.err.code,a.err.msg,E(t,r-f.length+a.err.line));if(!0===s)return x("InvalidXml","Multiple possible root nodes found.",E(t,r));-1!==e.unpairedTags.indexOf(u)||i.push({tagName:u,tagStartPos:o}),n=!0}for(r++;r<t.length;r++)if("<"===t[r]){if("!"===t[r+1]){r++,r=p(t,r);continue}if("?"!==t[r+1])break;if(r=l(t,++r),r.err)return r}else if("&"===t[r]){const e=m(t,r);if(-1==e)return x("InvalidChar","char '&' is not expected.",E(t,r));r=e}else if(!0===s&&!h(t[r]))return x("InvalidXml","Extra text at the end",E(t,r));"<"===t[r]&&r--}}}return n?1==i.length?x("InvalidTag","Unclosed tag '"+i[0].tagName+"'.",E(t,i[0].tagStartPos)):!(i.length>0)||x("InvalidXml","Invalid '"+JSON.stringify(i.map(t=>t.tagName),null,4).replace(/\r?\n/g,"")+"' found.",{line:1,col:1}):x("InvalidXml","Start tag expected.",1)}function h(t){return" "===t||"\t"===t||"\n"===t||"\r"===t}function l(t,e){const i=e;for(;e<t.length;e++)if("?"==t[e]||" "==t[e]){const n=t.substr(i,e-i);if(e>5&&"xml"===n)return x("InvalidXml","XML declaration allowed only at the start of the document.",E(t,e));if("?"==t[e]&&">"==t[e+1]){e++;break}continue}return e}function p(t,e){if(t.length>e+5&&"-"===t[e+1]&&"-"===t[e+2]){for(e+=3;e<t.length;e++)if("-"===t[e]&&"-"===t[e+1]&&">"===t[e+2]){e+=2;break}}else if(t.length>e+8&&"D"===t[e+1]&&"O"===t[e+2]&&"C"===t[e+3]&&"T"===t[e+4]&&"Y"===t[e+5]&&"P"===t[e+6]&&"E"===t[e+7]){let i=1;for(e+=8;e<t.length;e++)if("<"===t[e])i++;else if(">"===t[e]&&(i--,0===i))break}else if(t.length>e+9&&"["===t[e+1]&&"C"===t[e+2]&&"D"===t[e+3]&&"A"===t[e+4]&&"T"===t[e+5]&&"A"===t[e+6]&&"["===t[e+7])for(e+=8;e<t.length;e++)if("]"===t[e]&&"]"===t[e+1]&&">"===t[e+2]){e+=2;break}return e}const u='"',c="'";function d(t,e){let i="",n="",s=!1;for(;e<t.length;e++){if(t[e]===u||t[e]===c)""===n?n=t[e]:n!==t[e]||(n="");else if(">"===t[e]&&""===n){s=!0;break}i+=t[e]}return""===n&&{value:i,index:e,tagClosed:s}}const f=new RegExp("(\\s*)([^\\s=]+)(\\s*=)?(\\s*(['\"])(([\\s\\S])*?)\\5)?","g");function g(t,e){const i=s(t,f),n={};for(let t=0;t<i.length;t++){if(0===i[t][1].length)return x("InvalidAttr","Attribute '"+i[t][2]+"' has no space in starting.",y(i[t]));if(void 0!==i[t][3]&&void 0===i[t][4])return x("InvalidAttr","Attribute '"+i[t][2]+"' is without value.",y(i[t]));if(void 0===i[t][3]&&!e.allowBooleanAttributes)return x("InvalidAttr","boolean attribute '"+i[t][2]+"' is not allowed.",y(i[t]));const s=i[t][2];if(!N(s))return x("InvalidAttr","Attribute '"+s+"' is an invalid name.",y(i[t]));if(Object.prototype.hasOwnProperty.call(n,s))return x("InvalidAttr","Attribute '"+s+"' is repeated.",y(i[t]));n[s]=1}return!0}function m(t,e){if(";"===t[++e])return-1;if("#"===t[e])return function(t,e){let i=/\d/;for("x"===t[e]&&(e++,i=/[\da-fA-F]/);e<t.length;e++){if(";"===t[e])return e;if(!t[e].match(i))break}return-1}(t,++e);let i=0;for(;e<t.length;e++,i++)if(!(t[e].match(/\w/)&&i<20)){if(";"===t[e])break;return-1}return e}function x(t,e,i){return{err:{code:t,msg:e,line:i.line||i,col:i.col}}}function N(t){return r(t)}function b(t){return r(t)}function E(t,e){const i=t.substring(0,e).split(/\r?\n/);return{line:i.length,col:i[i.length-1].length+1}}function y(t){return t.startIndex+t[1].length}const w={preserveOrder:!1,attributeNamePrefix:"@_",attributesGroupName:!1,textNodeName:"#text",ignoreAttributes:!0,removeNSPrefix:!1,allowBooleanAttributes:!1,parseTagValue:!0,parseAttributeValue:!1,trimValues:!0,cdataPropName:!1,numberParseOptions:{hex:!0,leadingZeros:!0,eNotation:!0},tagValueProcessor:function(t,e){return e},attributeValueProcessor:function(t,e){return e},stopNodes:[],alwaysCreateTextNode:!1,isArray:()=>!1,commentPropName:!1,unpairedTags:[],processEntities:!0,htmlEntities:!1,ignoreDeclaration:!1,ignorePiTags:!1,transformTagName:!1,transformAttributeName:!1,updateTag:function(t,e,i){return t},captureMetaData:!1,maxNestedTags:100,strictReservedNames:!0,jPath:!0};function v(t){return"boolean"==typeof t?{enabled:t,maxEntitySize:1e4,maxExpansionDepth:10,maxTotalExpansions:1e3,maxExpandedLength:1e5,maxEntityCount:100,allowedTags:null,tagFilter:null}:"object"==typeof t&&null!==t?{enabled:!1!==t.enabled,maxEntitySize:t.maxEntitySize??1e4,maxExpansionDepth:t.maxExpansionDepth??10,maxTotalExpansions:t.maxTotalExpansions??1e3,maxExpandedLength:t.maxExpandedLength??1e5,maxEntityCount:t.maxEntityCount??100,allowedTags:t.allowedTags??null,tagFilter:t.tagFilter??null}:v(!0)}const T=function(t){const e=Object.assign({},w,t);return e.processEntities=v(e.processEntities),e.stopNodes&&Array.isArray(e.stopNodes)&&(e.stopNodes=e.stopNodes.map(t=>"string"==typeof t&&t.startsWith("*.")?".."+t.substring(2):t)),e};let P;P="function"!=typeof Symbol?"@@xmlMetadata":Symbol("XML Node Metadata");class S{constructor(t){this.tagname=t,this.child=[],this[":@"]=Object.create(null)}add(t,e){"__proto__"===t&&(t="#__proto__"),this.child.push({[t]:e})}addChild(t,e){"__proto__"===t.tagname&&(t.tagname="#__proto__"),t[":@"]&&Object.keys(t[":@"]).length>0?this.child.push({[t.tagname]:t.child,":@":t[":@"]}):this.child.push({[t.tagname]:t.child}),void 0!==e&&(this.child[this.child.length-1][P]={startIndex:e})}static getMetaDataSymbol(){return P}}class A{constructor(t){this.suppressValidationErr=!t,this.options=t}readDocType(t,e){const i=Object.create(null);let n=0;if("O"!==t[e+3]||"C"!==t[e+4]||"T"!==t[e+5]||"Y"!==t[e+6]||"P"!==t[e+7]||"E"!==t[e+8])throw new Error("Invalid Tag instead of DOCTYPE");{e+=9;let s=1,r=!1,o=!1,a="";for(;e<t.length;e++)if("<"!==t[e]||o)if(">"===t[e]){if(o?"-"===t[e-1]&&"-"===t[e-2]&&(o=!1,s--):s--,0===s)break}else"["===t[e]?r=!0:a+=t[e];else{if(r&&C(t,"!ENTITY",e)){let s,r;if(e+=7,[s,r,e]=this.readEntityExp(t,e+1,this.suppressValidationErr),-1===r.indexOf("&")){if(!1!==this.options.enabled&&this.options.maxEntityCount&&n>=this.options.maxEntityCount)throw new Error(`Entity count (${n+1}) exceeds maximum allowed (${this.options.maxEntityCount})`);const t=s.replace(/[.\-+*:]/g,"\\.");i[s]={regx:RegExp(`&${t};`,"g"),val:r},n++}}else if(r&&C(t,"!ELEMENT",e)){e+=8;const{index:i}=this.readElementExp(t,e+1);e=i}else if(r&&C(t,"!ATTLIST",e))e+=8;else if(r&&C(t,"!NOTATION",e)){e+=9;const{index:i}=this.readNotationExp(t,e+1,this.suppressValidationErr);e=i}else{if(!C(t,"!--",e))throw new Error("Invalid DOCTYPE");o=!0}s++,a=""}if(0!==s)throw new Error("Unclosed DOCTYPE")}return{entities:i,i:e}}readEntityExp(t,e){e=O(t,e);let i="";for(;e<t.length&&!/\s/.test(t[e])&&'"'!==t[e]&&"'"!==t[e];)i+=t[e],e++;if(I(i),e=O(t,e),!this.suppressValidationErr){if("SYSTEM"===t.substring(e,e+6).toUpperCase())throw new Error("External entities are not supported");if("%"===t[e])throw new Error("Parameter entities are not supported")}let n="";if([e,n]=this.readIdentifierVal(t,e,"entity"),!1!==this.options.enabled&&this.options.maxEntitySize&&n.length>this.options.maxEntitySize)throw new Error(`Entity "${i}" size (${n.length}) exceeds maximum allowed size (${this.options.maxEntitySize})`);return[i,n,--e]}readNotationExp(t,e){e=O(t,e);let i="";for(;e<t.length&&!/\s/.test(t[e]);)i+=t[e],e++;!this.suppressValidationErr&&I(i),e=O(t,e);const n=t.substring(e,e+6).toUpperCase();if(!this.suppressValidationErr&&"SYSTEM"!==n&&"PUBLIC"!==n)throw new Error(`Expected SYSTEM or PUBLIC, found "${n}"`);e+=n.length,e=O(t,e);let s=null,r=null;if("PUBLIC"===n)[e,s]=this.readIdentifierVal(t,e,"publicIdentifier"),'"'!==t[e=O(t,e)]&&"'"!==t[e]||([e,r]=this.readIdentifierVal(t,e,"systemIdentifier"));else if("SYSTEM"===n&&([e,r]=this.readIdentifierVal(t,e,"systemIdentifier"),!this.suppressValidationErr&&!r))throw new Error("Missing mandatory system identifier for SYSTEM notation");return{notationName:i,publicIdentifier:s,systemIdentifier:r,index:--e}}readIdentifierVal(t,e,i){let n="";const s=t[e];if('"'!==s&&"'"!==s)throw new Error(`Expected quoted string, found "${s}"`);for(e++;e<t.length&&t[e]!==s;)n+=t[e],e++;if(t[e]!==s)throw new Error(`Unterminated ${i} value`);return[++e,n]}readElementExp(t,e){e=O(t,e);let i="";for(;e<t.length&&!/\s/.test(t[e]);)i+=t[e],e++;if(!this.suppressValidationErr&&!r(i))throw new Error(`Invalid element name: "${i}"`);let n="";if("E"===t[e=O(t,e)]&&C(t,"MPTY",e))e+=4;else if("A"===t[e]&&C(t,"NY",e))e+=2;else if("("===t[e]){for(e++;e<t.length&&")"!==t[e];)n+=t[e],e++;if(")"!==t[e])throw new Error("Unterminated content model")}else if(!this.suppressValidationErr)throw new Error(`Invalid Element Expression, found "${t[e]}"`);return{elementName:i,contentModel:n.trim(),index:e}}readAttlistExp(t,e){e=O(t,e);let i="";for(;e<t.length&&!/\s/.test(t[e]);)i+=t[e],e++;I(i),e=O(t,e);let n="";for(;e<t.length&&!/\s/.test(t[e]);)n+=t[e],e++;if(!I(n))throw new Error(`Invalid attribute name: "${n}"`);e=O(t,e);let s="";if("NOTATION"===t.substring(e,e+8).toUpperCase()){if(s="NOTATION","("!==t[e=O(t,e+=8)])throw new Error(`Expected '(', found "${t[e]}"`);e++;let i=[];for(;e<t.length&&")"!==t[e];){let n="";for(;e<t.length&&"|"!==t[e]&&")"!==t[e];)n+=t[e],e++;if(n=n.trim(),!I(n))throw new Error(`Invalid notation name: "${n}"`);i.push(n),"|"===t[e]&&(e++,e=O(t,e))}if(")"!==t[e])throw new Error("Unterminated list of notations");e++,s+=" ("+i.join("|")+")"}else{for(;e<t.length&&!/\s/.test(t[e]);)s+=t[e],e++;const i=["CDATA","ID","IDREF","IDREFS","ENTITY","ENTITIES","NMTOKEN","NMTOKENS"];if(!this.suppressValidationErr&&!i.includes(s.toUpperCase()))throw new Error(`Invalid attribute type: "${s}"`)}e=O(t,e);let r="";return"#REQUIRED"===t.substring(e,e+8).toUpperCase()?(r="#REQUIRED",e+=8):"#IMPLIED"===t.substring(e,e+7).toUpperCase()?(r="#IMPLIED",e+=7):[e,r]=this.readIdentifierVal(t,e,"ATTLIST"),{elementName:i,attributeName:n,attributeType:s,defaultValue:r,index:e}}}const O=(t,e)=>{for(;e<t.length&&/\s/.test(t[e]);)e++;return e};function C(t,e,i){for(let n=0;n<e.length;n++)if(e[n]!==t[i+n+1])return!1;return!0}function I(t){if(r(t))return t;throw new Error(`Invalid entity name ${t}`)}const $=/^[-+]?0x[a-fA-F0-9]+$/,j=/^([\-\+])?(0*)([0-9]*(\.[0-9]*)?)$/,V={hex:!0,leadingZeros:!0,decimalPoint:".",eNotation:!0};const D=/^([-+])?(0*)(\d*(\.\d*)?[eE][-\+]?\d+)$/;class _{constructor(t={}){this.separator=t.separator||".",this.path=[],this.siblingStacks=[]}push(t,e=null,i=null){this.path.length>0&&(this.path[this.path.length-1].values=void 0);const n=this.path.length;this.siblingStacks[n]||(this.siblingStacks[n]=new Map);const s=this.siblingStacks[n],r=i?`${i}:${t}`:t,o=s.get(r)||0;let a=0;for(const t of s.values())a+=t;s.set(r,o+1);const h={tag:t,position:a,counter:o};null!=i&&(h.namespace=i),null!=e&&(h.values=e),this.path.push(h)}pop(){if(0===this.path.length)return;const t=this.path.pop();return this.siblingStacks.length>this.path.length+1&&(this.siblingStacks.length=this.path.length+1),t}updateCurrent(t){if(this.path.length>0){const e=this.path[this.path.length-1];null!=t&&(e.values=t)}}getCurrentTag(){return this.path.length>0?this.path[this.path.length-1].tag:void 0}getCurrentNamespace(){return this.path.length>0?this.path[this.path.length-1].namespace:void 0}getAttrValue(t){if(0===this.path.length)return;const e=this.path[this.path.length-1];return e.values?.[t]}hasAttr(t){if(0===this.path.length)return!1;const e=this.path[this.path.length-1];return void 0!==e.values&&t in e.values}getPosition(){return 0===this.path.length?-1:this.path[this.path.length-1].position??0}getCounter(){return 0===this.path.length?-1:this.path[this.path.length-1].counter??0}getIndex(){return this.getPosition()}getDepth(){return this.path.length}toString(t,e=!0){const i=t||this.separator;return this.path.map(t=>e&&t.namespace?`${t.namespace}:${t.tag}`:t.tag).join(i)}toArray(){return this.path.map(t=>t.tag)}reset(){this.path=[],this.siblingStacks=[]}matches(t){const e=t.segments;return 0!==e.length&&(t.hasDeepWildcard()?this._matchWithDeepWildcard(e):this._matchSimple(e))}_matchSimple(t){if(this.path.length!==t.length)return!1;for(let e=0;e<t.length;e++){const i=t[e],n=this.path[e],s=e===this.path.length-1;if(!this._matchSegment(i,n,s))return!1}return!0}_matchWithDeepWildcard(t){let e=this.path.length-1,i=t.length-1;for(;i>=0&&e>=0;){const n=t[i];if("deep-wildcard"===n.type){if(i--,i<0)return!0;const n=t[i];let s=!1;for(let t=e;t>=0;t--){const r=t===this.path.length-1;if(this._matchSegment(n,this.path[t],r)){e=t-1,i--,s=!0;break}}if(!s)return!1}else{const t=e===this.path.length-1;if(!this._matchSegment(n,this.path[e],t))return!1;e--,i--}}return i<0}_matchSegment(t,e,i){if("*"!==t.tag&&t.tag!==e.tag)return!1;if(void 0!==t.namespace&&"*"!==t.namespace&&t.namespace!==e.namespace)return!1;if(void 0!==t.attrName){if(!i)return!1;if(!e.values||!(t.attrName in e.values))return!1;if(void 0!==t.attrValue){const i=e.values[t.attrName];if(String(i)!==String(t.attrValue))return!1}}if(void 0!==t.position){if(!i)return!1;const n=e.counter??0;if("first"===t.position&&0!==n)return!1;if("odd"===t.position&&n%2!=1)return!1;if("even"===t.position&&n%2!=0)return!1;if("nth"===t.position&&n!==t.positionValue)return!1}return!0}snapshot(){return{path:this.path.map(t=>({...t})),siblingStacks:this.siblingStacks.map(t=>new Map(t))}}restore(t){this.path=t.path.map(t=>({...t})),this.siblingStacks=t.siblingStacks.map(t=>new Map(t))}}class k{constructor(t,e={}){this.pattern=t,this.separator=e.separator||".",this.segments=this._parse(t),this._hasDeepWildcard=this.segments.some(t=>"deep-wildcard"===t.type),this._hasAttributeCondition=this.segments.some(t=>void 0!==t.attrName),this._hasPositionSelector=this.segments.some(t=>void 0!==t.position)}_parse(t){const e=[];let i=0,n="";for(;i<t.length;)t[i]===this.separator?i+1<t.length&&t[i+1]===this.separator?(n.trim()&&(e.push(this._parseSegment(n.trim())),n=""),e.push({type:"deep-wildcard"}),i+=2):(n.trim()&&e.push(this._parseSegment(n.trim())),n="",i++):(n+=t[i],i++);return n.trim()&&e.push(this._parseSegment(n.trim())),e}_parseSegment(t){const e={type:"tag"};let i=null,n=t;const s=t.match(/^([^\[]+)(\[[^\]]*\])(.*)$/);if(s&&(n=s[1]+s[3],s[2])){const t=s[2].slice(1,-1);t&&(i=t)}let r,o,a=n;if(n.includes("::")){const e=n.indexOf("::");if(r=n.substring(0,e).trim(),a=n.substring(e+2).trim(),!r)throw new Error(`Invalid namespace in pattern: ${t}`)}let h=null;if(a.includes(":")){const t=a.lastIndexOf(":"),e=a.substring(0,t).trim(),i=a.substring(t+1).trim();["first","last","odd","even"].includes(i)||/^nth\(\d+\)$/.test(i)?(o=e,h=i):o=a}else o=a;if(!o)throw new Error(`Invalid segment pattern: ${t}`);if(e.tag=o,r&&(e.namespace=r),i)if(i.includes("=")){const t=i.indexOf("=");e.attrName=i.substring(0,t).trim(),e.attrValue=i.substring(t+1).trim()}else e.attrName=i.trim();if(h){const t=h.match(/^nth\((\d+)\)$/);t?(e.position="nth",e.positionValue=parseInt(t[1],10)):e.position=h}return e}get length(){return this.segments.length}hasDeepWildcard(){return this._hasDeepWildcard}hasAttributeCondition(){return this._hasAttributeCondition}hasPositionSelector(){return this._hasPositionSelector}toString(){return this.pattern}}function F(t,e){if(!t)return{};const i=e.attributesGroupName?t[e.attributesGroupName]:t;if(!i)return{};const n={};for(const t in i)t.startsWith(e.attributeNamePrefix)?n[t.substring(e.attributeNamePrefix.length)]=i[t]:n[t]=i[t];return n}function M(t){if(!t||"string"!=typeof t)return;const e=t.indexOf(":");if(-1!==e&&e>0){const i=t.substring(0,e);if("xmlns"!==i)return i}}class L{constructor(t){var e;if(this.options=t,this.currentNode=null,this.tagsNodeStack=[],this.docTypeEntities={},this.lastEntities={apos:{regex:/&(apos|#39|#x27);/g,val:"'"},gt:{regex:/&(gt|#62|#x3E);/g,val:">"},lt:{regex:/&(lt|#60|#x3C);/g,val:"<"},quot:{regex:/&(quot|#34|#x22);/g,val:'"'}},this.ampEntity={regex:/&(amp|#38|#x26);/g,val:"&"},this.htmlEntities={space:{regex:/&(nbsp|#160);/g,val:" "},cent:{regex:/&(cent|#162);/g,val:"¢"},pound:{regex:/&(pound|#163);/g,val:"£"},yen:{regex:/&(yen|#165);/g,val:"¥"},euro:{regex:/&(euro|#8364);/g,val:"€"},copyright:{regex:/&(copy|#169);/g,val:"©"},reg:{regex:/&(reg|#174);/g,val:"®"},inr:{regex:/&(inr|#8377);/g,val:"₹"},num_dec:{regex:/&#([0-9]{1,7});/g,val:(t,e)=>tt(e,10,"&#")},num_hex:{regex:/&#x([0-9a-fA-F]{1,6});/g,val:(t,e)=>tt(e,16,"&#x")}},this.addExternalEntities=R,this.parseXml=Y,this.parseTextData=G,this.resolveNameSpace=B,this.buildAttributesMap=W,this.isItStopNode=Z,this.replaceEntitiesValue=z,this.readStopNodeData=J,this.saveTextToParentTag=q,this.addChild=X,this.ignoreAttributesFn="function"==typeof(e=this.options.ignoreAttributes)?e:Array.isArray(e)?t=>{for(const i of e){if("string"==typeof i&&t===i)return!0;if(i instanceof RegExp&&i.test(t))return!0}}:()=>!1,this.entityExpansionCount=0,this.currentExpandedLength=0,this.matcher=new _,this.isCurrentNodeStopNode=!1,this.options.stopNodes&&this.options.stopNodes.length>0){this.stopNodeExpressions=[];for(let t=0;t<this.options.stopNodes.length;t++){const e=this.options.stopNodes[t];"string"==typeof e?this.stopNodeExpressions.push(new k(e)):e instanceof k&&this.stopNodeExpressions.push(e)}}}}function R(t){const e=Object.keys(t);for(let i=0;i<e.length;i++){const n=e[i],s=n.replace(/[.\-+*:]/g,"\\.");this.lastEntities[n]={regex:new RegExp("&"+s+";","g"),val:t[n]}}}function G(t,e,i,n,s,r,o){if(void 0!==t&&(this.options.trimValues&&!n&&(t=t.trim()),t.length>0)){o||(t=this.replaceEntitiesValue(t,e,i));const n=this.options.jPath?i.toString():i,a=this.options.tagValueProcessor(e,t,n,s,r);return null==a?t:typeof a!=typeof t||a!==t?a:this.options.trimValues||t.trim()===t?H(t,this.options.parseTagValue,this.options.numberParseOptions):t}}function B(t){if(this.options.removeNSPrefix){const e=t.split(":"),i="/"===t.charAt(0)?"/":"";if("xmlns"===e[0])return"";2===e.length&&(t=i+e[1])}return t}const U=new RegExp("([^\\s=]+)\\s*(=\\s*(['\"])([\\s\\S]*?)\\3)?","gm");function W(t,e,i){if(!0!==this.options.ignoreAttributes&&"string"==typeof t){const n=s(t,U),r=n.length,o={},a={};for(let t=0;t<r;t++){const s=this.resolveNameSpace(n[t][1]),r=n[t][4];if(s.length&&void 0!==r){let t=r;this.options.trimValues&&(t=t.trim()),t=this.replaceEntitiesValue(t,i,e),a[s]=t}}Object.keys(a).length>0&&"object"==typeof e&&e.updateCurrent&&e.updateCurrent(a);for(let t=0;t<r;t++){const s=this.resolveNameSpace(n[t][1]),r=this.options.jPath?e.toString():e;if(this.ignoreAttributesFn(s,r))continue;let a=n[t][4],h=this.options.attributeNamePrefix+s;if(s.length)if(this.options.transformAttributeName&&(h=this.options.transformAttributeName(h)),"__proto__"===h&&(h="#__proto__"),void 0!==a){this.options.trimValues&&(a=a.trim()),a=this.replaceEntitiesValue(a,i,e);const t=this.options.jPath?e.toString():e,n=this.options.attributeValueProcessor(s,a,t);o[h]=null==n?a:typeof n!=typeof a||n!==a?n:H(a,this.options.parseAttributeValue,this.options.numberParseOptions)}else this.options.allowBooleanAttributes&&(o[h]=!0)}if(!Object.keys(o).length)return;if(this.options.attributesGroupName){const t={};return t[this.options.attributesGroupName]=o,t}return o}}const Y=function(t){t=t.replace(/\r\n?/g,"\n");const e=new S("!xml");let i=e,n="";this.matcher.reset(),this.entityExpansionCount=0,this.currentExpandedLength=0;const s=new A(this.options.processEntities);for(let r=0;r<t.length;r++)if("<"===t[r])if("/"===t[r+1]){const e=K(t,">",r,"Closing Tag is not closed.");let s=t.substring(r+2,e).trim();if(this.options.removeNSPrefix){const t=s.indexOf(":");-1!==t&&(s=s.substr(t+1))}this.options.transformTagName&&(s=this.options.transformTagName(s)),i&&(n=this.saveTextToParentTag(n,i,this.matcher));const o=this.matcher.getCurrentTag();if(s&&-1!==this.options.unpairedTags.indexOf(s))throw new Error(`Unpaired tag can not be used as closing tag: </${s}>`);o&&-1!==this.options.unpairedTags.indexOf(o)&&(this.matcher.pop(),this.tagsNodeStack.pop()),this.matcher.pop(),this.isCurrentNodeStopNode=!1,i=this.tagsNodeStack.pop(),n="",r=e}else if("?"===t[r+1]){let e=Q(t,r,!1,"?>");if(!e)throw new Error("Pi Tag is not closed.");if(n=this.saveTextToParentTag(n,i,this.matcher),this.options.ignoreDeclaration&&"?xml"===e.tagName||this.options.ignorePiTags);else{const t=new S(e.tagName);t.add(this.options.textNodeName,""),e.tagName!==e.tagExp&&e.attrExpPresent&&(t[":@"]=this.buildAttributesMap(e.tagExp,this.matcher,e.tagName)),this.addChild(i,t,this.matcher,r)}r=e.closeIndex+1}else if("!--"===t.substr(r+1,3)){const e=K(t,"--\x3e",r+4,"Comment is not closed.");if(this.options.commentPropName){const s=t.substring(r+4,e-2);n=this.saveTextToParentTag(n,i,this.matcher),i.add(this.options.commentPropName,[{[this.options.textNodeName]:s}])}r=e}else if("!D"===t.substr(r+1,2)){const e=s.readDocType(t,r);this.docTypeEntities=e.entities,r=e.i}else if("!["===t.substr(r+1,2)){const e=K(t,"]]>",r,"CDATA is not closed.")-2,s=t.substring(r+9,e);n=this.saveTextToParentTag(n,i,this.matcher);let o=this.parseTextData(s,i.tagname,this.matcher,!0,!1,!0,!0);null==o&&(o=""),this.options.cdataPropName?i.add(this.options.cdataPropName,[{[this.options.textNodeName]:s}]):i.add(this.options.textNodeName,o),r=e+2}else{let s=Q(t,r,this.options.removeNSPrefix);if(!s){const e=t.substring(Math.max(0,r-50),Math.min(t.length,r+50));throw new Error(`readTagExp returned undefined at position ${r}. Context: "${e}"`)}let o=s.tagName;const a=s.rawTagName;let h=s.tagExp,l=s.attrExpPresent,p=s.closeIndex;if(this.options.transformTagName){const t=this.options.transformTagName(o);h===o&&(h=t),o=t}if(this.options.strictReservedNames&&(o===this.options.commentPropName||o===this.options.cdataPropName))throw new Error(`Invalid tag name: ${o}`);i&&n&&"!xml"!==i.tagname&&(n=this.saveTextToParentTag(n,i,this.matcher,!1));const u=i;u&&-1!==this.options.unpairedTags.indexOf(u.tagname)&&(i=this.tagsNodeStack.pop(),this.matcher.pop());let c=!1;h.length>0&&h.lastIndexOf("/")===h.length-1&&(c=!0,"/"===o[o.length-1]?(o=o.substr(0,o.length-1),h=o):h=h.substr(0,h.length-1),l=o!==h);let d,f=null,g={};d=M(a),o!==e.tagname&&this.matcher.push(o,{},d),o!==h&&l&&(f=this.buildAttributesMap(h,this.matcher,o),f&&(g=F(f,this.options))),o!==e.tagname&&(this.isCurrentNodeStopNode=this.isItStopNode(this.stopNodeExpressions,this.matcher));const m=r;if(this.isCurrentNodeStopNode){let e="";if(c)r=s.closeIndex;else if(-1!==this.options.unpairedTags.indexOf(o))r=s.closeIndex;else{const i=this.readStopNodeData(t,a,p+1);if(!i)throw new Error(`Unexpected end of ${a}`);r=i.i,e=i.tagContent}const n=new S(o);f&&(n[":@"]=f),n.add(this.options.textNodeName,e),this.matcher.pop(),this.isCurrentNodeStopNode=!1,this.addChild(i,n,this.matcher,m)}else{if(c){if(this.options.transformTagName){const t=this.options.transformTagName(o);h===o&&(h=t),o=t}const t=new S(o);f&&(t[":@"]=f),this.addChild(i,t,this.matcher,m),this.matcher.pop(),this.isCurrentNodeStopNode=!1}else{if(-1!==this.options.unpairedTags.indexOf(o)){const t=new S(o);f&&(t[":@"]=f),this.addChild(i,t,this.matcher,m),this.matcher.pop(),this.isCurrentNodeStopNode=!1,r=s.closeIndex;continue}{const t=new S(o);if(this.tagsNodeStack.length>this.options.maxNestedTags)throw new Error("Maximum nested tags exceeded");this.tagsNodeStack.push(i),f&&(t[":@"]=f),this.addChild(i,t,this.matcher,m),i=t}}n="",r=p}}else n+=t[r];return e.child};function X(t,e,i,n){this.options.captureMetaData||(n=void 0);const s=this.options.jPath?i.toString():i,r=this.options.updateTag(e.tagname,s,e[":@"]);!1===r||("string"==typeof r?(e.tagname=r,t.addChild(e,n)):t.addChild(e,n))}function z(t,e,i){const n=this.options.processEntities;if(!n||!n.enabled)return t;if(n.allowedTags){const s=this.options.jPath?i.toString():i;if(!(Array.isArray(n.allowedTags)?n.allowedTags.includes(e):n.allowedTags(e,s)))return t}if(n.tagFilter){const s=this.options.jPath?i.toString():i;if(!n.tagFilter(e,s))return t}for(let e in this.docTypeEntities){const i=this.docTypeEntities[e],s=t.match(i.regx);if(s){if(this.entityExpansionCount+=s.length,n.maxTotalExpansions&&this.entityExpansionCount>n.maxTotalExpansions)throw new Error(`Entity expansion limit exceeded: ${this.entityExpansionCount} > ${n.maxTotalExpansions}`);const e=t.length;if(t=t.replace(i.regx,i.val),n.maxExpandedLength&&(this.currentExpandedLength+=t.length-e,this.currentExpandedLength>n.maxExpandedLength))throw new Error(`Total expanded content size exceeded: ${this.currentExpandedLength} > ${n.maxExpandedLength}`)}}if(-1===t.indexOf("&"))return t;for(let e in this.lastEntities){const i=this.lastEntities[e];t=t.replace(i.regex,i.val)}if(-1===t.indexOf("&"))return t;if(this.options.htmlEntities)for(let e in this.htmlEntities){const i=this.htmlEntities[e];t=t.replace(i.regex,i.val)}return t.replace(this.ampEntity.regex,this.ampEntity.val)}function q(t,e,i,n){return t&&(void 0===n&&(n=0===e.child.length),void 0!==(t=this.parseTextData(t,e.tagname,i,!1,!!e[":@"]&&0!==Object.keys(e[":@"]).length,n))&&""!==t&&e.add(this.options.textNodeName,t),t=""),t}function Z(t,e){if(!t||0===t.length)return!1;for(let i=0;i<t.length;i++)if(e.matches(t[i]))return!0;return!1}function K(t,e,i,n){const s=t.indexOf(e,i);if(-1===s)throw new Error(n);return s+e.length-1}function Q(t,e,i,n=">"){const s=function(t,e,i=">"){let n,s="";for(let r=e;r<t.length;r++){let e=t[r];if(n)e===n&&(n="");else if('"'===e||"'"===e)n=e;else if(e===i[0]){if(!i[1])return{data:s,index:r};if(t[r+1]===i[1])return{data:s,index:r}}else"\t"===e&&(e=" ");s+=e}}(t,e+1,n);if(!s)return;let r=s.data;const o=s.index,a=r.search(/\s/);let h=r,l=!0;-1!==a&&(h=r.substring(0,a),r=r.substring(a+1).trimStart());const p=h;if(i){const t=h.indexOf(":");-1!==t&&(h=h.substr(t+1),l=h!==s.data.substr(t+1))}return{tagName:h,tagExp:r,closeIndex:o,attrExpPresent:l,rawTagName:p}}function J(t,e,i){const n=i;let s=1;for(;i<t.length;i++)if("<"===t[i])if("/"===t[i+1]){const r=K(t,">",i,`${e} is not closed`);if(t.substring(i+2,r).trim()===e&&(s--,0===s))return{tagContent:t.substring(n,i),i:r};i=r}else if("?"===t[i+1])i=K(t,"?>",i+1,"StopNode is not closed.");else if("!--"===t.substr(i+1,3))i=K(t,"--\x3e",i+3,"StopNode is not closed.");else if("!["===t.substr(i+1,2))i=K(t,"]]>",i,"StopNode is not closed.")-2;else{const n=Q(t,i,">");n&&((n&&n.tagName)===e&&"/"!==n.tagExp[n.tagExp.length-1]&&s++,i=n.closeIndex)}}function H(t,e,i){if(e&&"string"==typeof t){const e=t.trim();return"true"===e||"false"!==e&&function(t,e={}){if(e=Object.assign({},V,e),!t||"string"!=typeof t)return t;let i=t.trim();if(void 0!==e.skipLike&&e.skipLike.test(i))return t;if("0"===t)return 0;if(e.hex&&$.test(i))return function(t){if(parseInt)return parseInt(t,16);if(Number.parseInt)return Number.parseInt(t,16);if(window&&window.parseInt)return window.parseInt(t,16);throw new Error("parseInt, Number.parseInt, window.parseInt are not supported")}(i);if(i.includes("e")||i.includes("E"))return function(t,e,i){if(!i.eNotation)return t;const n=e.match(D);if(n){let s=n[1]||"";const r=-1===n[3].indexOf("e")?"E":"e",o=n[2],a=s?t[o.length+1]===r:t[o.length]===r;return o.length>1&&a?t:1!==o.length||!n[3].startsWith(`.${r}`)&&n[3][0]!==r?i.leadingZeros&&!a?(e=(n[1]||"")+n[3],Number(e)):t:Number(e)}return t}(t,i,e);{const s=j.exec(i);if(s){const r=s[1]||"",o=s[2];let a=(n=s[3])&&-1!==n.indexOf(".")?("."===(n=n.replace(/0+$/,""))?n="0":"."===n[0]?n="0"+n:"."===n[n.length-1]&&(n=n.substring(0,n.length-1)),n):n;const h=r?"."===t[o.length+1]:"."===t[o.length];if(!e.leadingZeros&&(o.length>1||1===o.length&&!h))return t;{const n=Number(i),s=String(n);if(0===n)return n;if(-1!==s.search(/[eE]/))return e.eNotation?n:t;if(-1!==i.indexOf("."))return"0"===s||s===a||s===`${r}${a}`?n:t;let h=o?a:i;return o?h===s||r+h===s?n:t:h===s||h===r+s?n:t}}return t}// removed by dead control flow
|
|
86322
|
-
var n; }(t,i)}return void 0!==t?t:""}function tt(t,e,i){const n=Number.parseInt(t,e);return n>=0&&n<=1114111?String.fromCodePoint(n):i+t+";"}const et=S.getMetaDataSymbol();function it(t,e){if(!t||"object"!=typeof t)return{};if(!e)return t;const i={};for(const n in t)n.startsWith(e)?i[n.substring(e.length)]=t[n]:i[n]=t[n];return i}function nt(t,e,i){return st(t,e,i)}function st(t,e,i){let n;const s={};for(let r=0;r<t.length;r++){const o=t[r],a=rt(o);if(void 0!==a&&a!==e.textNodeName){const t=it(o[":@"]||{},e.attributeNamePrefix);i.push(a,t)}if(a===e.textNodeName)void 0===n?n=o[a]:n+=""+o[a];else{if(void 0===a)continue;if(o[a]){let t=st(o[a],e,i);const n=at(t,e);if(o[":@"]?ot(t,o[":@"],i,e):1!==Object.keys(t).length||void 0===t[e.textNodeName]||e.alwaysCreateTextNode?0===Object.keys(t).length&&(e.alwaysCreateTextNode?t[e.textNodeName]="":t=""):t=t[e.textNodeName],void 0!==o[et]&&"object"==typeof t&&null!==t&&(t[et]=o[et]),void 0!==s[a]&&Object.prototype.hasOwnProperty.call(s,a))Array.isArray(s[a])||(s[a]=[s[a]]),s[a].push(t);else{const r=e.jPath?i.toString():i;e.isArray(a,r,n)?s[a]=[t]:s[a]=t}void 0!==a&&a!==e.textNodeName&&i.pop()}}}return"string"==typeof n?n.length>0&&(s[e.textNodeName]=n):void 0!==n&&(s[e.textNodeName]=n),s}function rt(t){const e=Object.keys(t);for(let t=0;t<e.length;t++){const i=e[t];if(":@"!==i)return i}}function ot(t,e,i,n){if(e){const s=Object.keys(e),r=s.length;for(let o=0;o<r;o++){const r=s[o],a=r.startsWith(n.attributeNamePrefix)?r.substring(n.attributeNamePrefix.length):r,h=n.jPath?i.toString()+"."+a:i;n.isArray(r,h,!0,!0)?t[r]=[e[r]]:t[r]=e[r]}}}function at(t,e){const{textNodeName:i}=e,n=Object.keys(t).length;return 0===n||!(1!==n||!t[i]&&"boolean"!=typeof t[i]&&0!==t[i])}class ht{constructor(t){this.externalEntities={},this.options=T(t)}parse(t,e){if("string"!=typeof t&&t.toString)t=t.toString();else if("string"!=typeof t)throw new Error("XML data is accepted in String or Bytes[] form.");if(e){!0===e&&(e={});const i=a(t,e);if(!0!==i)throw Error(`${i.err.msg}:${i.err.line}:${i.err.col}`)}const i=new L(this.options);i.addExternalEntities(this.externalEntities);const n=i.parseXml(t);return this.options.preserveOrder||void 0===n?n:nt(n,this.options,i.matcher)}addEntity(t,e){if(-1!==e.indexOf("&"))throw new Error("Entity value can't have '&'");if(-1!==t.indexOf("&")||-1!==t.indexOf(";"))throw new Error("An entity must be set without '&' and ';'. Eg. use '#xD' for '
'");if("&"===e)throw new Error("An entity with value '&' is not permitted");this.externalEntities[t]=e}static getMetaDataSymbol(){return S.getMetaDataSymbol()}}function lt(t,e){let i="";e.format&&e.indentBy.length>0&&(i="\n");const n=[];if(e.stopNodes&&Array.isArray(e.stopNodes))for(let t=0;t<e.stopNodes.length;t++){const i=e.stopNodes[t];"string"==typeof i?n.push(new k(i)):i instanceof k&&n.push(i)}return pt(t,e,i,new _,n)}function pt(t,e,i,n,s){let r="",o=!1;if(!Array.isArray(t)){if(null!=t){let i=t.toString();return i=xt(i,e),i}return""}for(let a=0;a<t.length;a++){const h=t[a],l=ft(h);if(void 0===l)continue;const p=ut(h[":@"],e);n.push(l,p);const u=mt(n,s);if(l===e.textNodeName){let t=h[l];u||(t=e.tagValueProcessor(l,t),t=xt(t,e)),o&&(r+=i),r+=t,o=!1,n.pop();continue}if(l===e.cdataPropName){o&&(r+=i),r+=`<![CDATA[${h[l][0][e.textNodeName]}]]>`,o=!1,n.pop();continue}if(l===e.commentPropName){r+=i+`\x3c!--${h[l][0][e.textNodeName]}--\x3e`,o=!0,n.pop();continue}if("?"===l[0]){const t=gt(h[":@"],e,u),s="?xml"===l?"":i;let a=h[l][0][e.textNodeName];a=0!==a.length?" "+a:"",r+=s+`<${l}${a}${t}?>`,o=!0,n.pop();continue}let c=i;""!==c&&(c+=e.indentBy);const d=i+`<${l}${gt(h[":@"],e,u)}`;let f;f=u?ct(h[l],e):pt(h[l],e,c,n,s),-1!==e.unpairedTags.indexOf(l)?e.suppressUnpairedNode?r+=d+">":r+=d+"/>":f&&0!==f.length||!e.suppressEmptyNode?f&&f.endsWith(">")?r+=d+`>${f}${i}</${l}>`:(r+=d+">",f&&""!==i&&(f.includes("/>")||f.includes("</"))?r+=i+e.indentBy+f+i:r+=f,r+=`</${l}>`):r+=d+"/>",o=!0,n.pop()}return r}function ut(t,e){if(!t||e.ignoreAttributes)return null;const i={};let n=!1;for(let s in t)Object.prototype.hasOwnProperty.call(t,s)&&(i[s.startsWith(e.attributeNamePrefix)?s.substr(e.attributeNamePrefix.length):s]=t[s],n=!0);return n?i:null}function ct(t,e){if(!Array.isArray(t))return null!=t?t.toString():"";let i="";for(let n=0;n<t.length;n++){const s=t[n],r=ft(s);if(r===e.textNodeName)i+=s[r];else if(r===e.cdataPropName)i+=s[r][0][e.textNodeName];else if(r===e.commentPropName)i+=s[r][0][e.textNodeName];else{if(r&&"?"===r[0])continue;if(r){const t=dt(s[":@"],e),n=ct(s[r],e);n&&0!==n.length?i+=`<${r}${t}>${n}</${r}>`:i+=`<${r}${t}/>`}}}return i}function dt(t,e){let i="";if(t&&!e.ignoreAttributes)for(let n in t){if(!Object.prototype.hasOwnProperty.call(t,n))continue;let s=t[n];!0===s&&e.suppressBooleanAttributes?i+=` ${n.substr(e.attributeNamePrefix.length)}`:i+=` ${n.substr(e.attributeNamePrefix.length)}="${s}"`}return i}function ft(t){const e=Object.keys(t);for(let i=0;i<e.length;i++){const n=e[i];if(Object.prototype.hasOwnProperty.call(t,n)&&":@"!==n)return n}}function gt(t,e,i){let n="";if(t&&!e.ignoreAttributes)for(let s in t){if(!Object.prototype.hasOwnProperty.call(t,s))continue;let r;i?r=t[s]:(r=e.attributeValueProcessor(s,t[s]),r=xt(r,e)),!0===r&&e.suppressBooleanAttributes?n+=` ${s.substr(e.attributeNamePrefix.length)}`:n+=` ${s.substr(e.attributeNamePrefix.length)}="${r}"`}return n}function mt(t,e){if(!e||0===e.length)return!1;for(let i=0;i<e.length;i++)if(t.matches(e[i]))return!0;return!1}function xt(t,e){if(t&&t.length>0&&e.processEntities)for(let i=0;i<e.entities.length;i++){const n=e.entities[i];t=t.replace(n.regex,n.val)}return t}const Nt={attributeNamePrefix:"@_",attributesGroupName:!1,textNodeName:"#text",ignoreAttributes:!0,cdataPropName:!1,format:!1,indentBy:" ",suppressEmptyNode:!1,suppressUnpairedNode:!0,suppressBooleanAttributes:!0,tagValueProcessor:function(t,e){return e},attributeValueProcessor:function(t,e){return e},preserveOrder:!1,commentPropName:!1,unpairedTags:[],entities:[{regex:new RegExp("&","g"),val:"&"},{regex:new RegExp(">","g"),val:">"},{regex:new RegExp("<","g"),val:"<"},{regex:new RegExp("'","g"),val:"'"},{regex:new RegExp('"',"g"),val:"""}],processEntities:!0,stopNodes:[],oneListGroup:!1,jPath:!0};function bt(t){if(this.options=Object.assign({},Nt,t),this.options.stopNodes&&Array.isArray(this.options.stopNodes)&&(this.options.stopNodes=this.options.stopNodes.map(t=>"string"==typeof t&&t.startsWith("*.")?".."+t.substring(2):t)),this.stopNodeExpressions=[],this.options.stopNodes&&Array.isArray(this.options.stopNodes))for(let t=0;t<this.options.stopNodes.length;t++){const e=this.options.stopNodes[t];"string"==typeof e?this.stopNodeExpressions.push(new k(e)):e instanceof k&&this.stopNodeExpressions.push(e)}var e;!0===this.options.ignoreAttributes||this.options.attributesGroupName?this.isAttribute=function(){return!1}:(this.ignoreAttributesFn="function"==typeof(e=this.options.ignoreAttributes)?e:Array.isArray(e)?t=>{for(const i of e){if("string"==typeof i&&t===i)return!0;if(i instanceof RegExp&&i.test(t))return!0}}:()=>!1,this.attrPrefixLen=this.options.attributeNamePrefix.length,this.isAttribute=wt),this.processTextOrObjNode=Et,this.options.format?(this.indentate=yt,this.tagEndChar=">\n",this.newLine="\n"):(this.indentate=function(){return""},this.tagEndChar=">",this.newLine="")}function Et(t,e,i,n){const s=this.extractAttributes(t);if(n.push(e,s),this.checkStopNode(n)){const s=this.buildRawContent(t),r=this.buildAttributesForStopNode(t);return n.pop(),this.buildObjectNode(s,e,r,i)}const r=this.j2x(t,i+1,n);return n.pop(),void 0!==t[this.options.textNodeName]&&1===Object.keys(t).length?this.buildTextValNode(t[this.options.textNodeName],e,r.attrStr,i,n):this.buildObjectNode(r.val,e,r.attrStr,i)}function yt(t){return this.options.indentBy.repeat(t)}function wt(t){return!(!t.startsWith(this.options.attributeNamePrefix)||t===this.options.textNodeName)&&t.substr(this.attrPrefixLen)}bt.prototype.build=function(t){if(this.options.preserveOrder)return lt(t,this.options);{Array.isArray(t)&&this.options.arrayNodeName&&this.options.arrayNodeName.length>1&&(t={[this.options.arrayNodeName]:t});const e=new _;return this.j2x(t,0,e).val}},bt.prototype.j2x=function(t,e,i){let n="",s="";const r=this.options.jPath?i.toString():i,o=this.checkStopNode(i);for(let a in t)if(Object.prototype.hasOwnProperty.call(t,a))if(void 0===t[a])this.isAttribute(a)&&(s+="");else if(null===t[a])this.isAttribute(a)||a===this.options.cdataPropName?s+="":"?"===a[0]?s+=this.indentate(e)+"<"+a+"?"+this.tagEndChar:s+=this.indentate(e)+"<"+a+"/"+this.tagEndChar;else if(t[a]instanceof Date)s+=this.buildTextValNode(t[a],a,"",e,i);else if("object"!=typeof t[a]){const h=this.isAttribute(a);if(h&&!this.ignoreAttributesFn(h,r))n+=this.buildAttrPairStr(h,""+t[a],o);else if(!h)if(a===this.options.textNodeName){let e=this.options.tagValueProcessor(a,""+t[a]);s+=this.replaceEntitiesValue(e)}else{i.push(a);const n=this.checkStopNode(i);if(i.pop(),n){const i=""+t[a];s+=""===i?this.indentate(e)+"<"+a+this.closeTag(a)+this.tagEndChar:this.indentate(e)+"<"+a+">"+i+"</"+a+this.tagEndChar}else s+=this.buildTextValNode(t[a],a,"",e,i)}}else if(Array.isArray(t[a])){const n=t[a].length;let r="",o="";for(let h=0;h<n;h++){const n=t[a][h];if(void 0===n);else if(null===n)"?"===a[0]?s+=this.indentate(e)+"<"+a+"?"+this.tagEndChar:s+=this.indentate(e)+"<"+a+"/"+this.tagEndChar;else if("object"==typeof n)if(this.options.oneListGroup){i.push(a);const t=this.j2x(n,e+1,i);i.pop(),r+=t.val,this.options.attributesGroupName&&n.hasOwnProperty(this.options.attributesGroupName)&&(o+=t.attrStr)}else r+=this.processTextOrObjNode(n,a,e,i);else if(this.options.oneListGroup){let t=this.options.tagValueProcessor(a,n);t=this.replaceEntitiesValue(t),r+=t}else{i.push(a);const t=this.checkStopNode(i);if(i.pop(),t){const t=""+n;r+=""===t?this.indentate(e)+"<"+a+this.closeTag(a)+this.tagEndChar:this.indentate(e)+"<"+a+">"+t+"</"+a+this.tagEndChar}else r+=this.buildTextValNode(n,a,"",e,i)}}this.options.oneListGroup&&(r=this.buildObjectNode(r,a,o,e)),s+=r}else if(this.options.attributesGroupName&&a===this.options.attributesGroupName){const e=Object.keys(t[a]),i=e.length;for(let s=0;s<i;s++)n+=this.buildAttrPairStr(e[s],""+t[a][e[s]],o)}else s+=this.processTextOrObjNode(t[a],a,e,i);return{attrStr:n,val:s}},bt.prototype.buildAttrPairStr=function(t,e,i){return i||(e=this.options.attributeValueProcessor(t,""+e),e=this.replaceEntitiesValue(e)),this.options.suppressBooleanAttributes&&"true"===e?" "+t:" "+t+'="'+e+'"'},bt.prototype.extractAttributes=function(t){if(!t||"object"!=typeof t)return null;const e={};let i=!1;if(this.options.attributesGroupName&&t[this.options.attributesGroupName]){const n=t[this.options.attributesGroupName];for(let t in n)Object.prototype.hasOwnProperty.call(n,t)&&(e[t.startsWith(this.options.attributeNamePrefix)?t.substring(this.options.attributeNamePrefix.length):t]=n[t],i=!0)}else for(let n in t){if(!Object.prototype.hasOwnProperty.call(t,n))continue;const s=this.isAttribute(n);s&&(e[s]=t[n],i=!0)}return i?e:null},bt.prototype.buildRawContent=function(t){if("string"==typeof t)return t;if("object"!=typeof t||null===t)return String(t);if(void 0!==t[this.options.textNodeName])return t[this.options.textNodeName];let e="";for(let i in t){if(!Object.prototype.hasOwnProperty.call(t,i))continue;if(this.isAttribute(i))continue;if(this.options.attributesGroupName&&i===this.options.attributesGroupName)continue;const n=t[i];if(i===this.options.textNodeName)e+=n;else if(Array.isArray(n)){for(let t of n)if("string"==typeof t||"number"==typeof t)e+=`<${i}>${t}</${i}>`;else if("object"==typeof t&&null!==t){const n=this.buildRawContent(t),s=this.buildAttributesForStopNode(t);e+=""===n?`<${i}${s}/>`:`<${i}${s}>${n}</${i}>`}}else if("object"==typeof n&&null!==n){const t=this.buildRawContent(n),s=this.buildAttributesForStopNode(n);e+=""===t?`<${i}${s}/>`:`<${i}${s}>${t}</${i}>`}else e+=`<${i}>${n}</${i}>`}return e},bt.prototype.buildAttributesForStopNode=function(t){if(!t||"object"!=typeof t)return"";let e="";if(this.options.attributesGroupName&&t[this.options.attributesGroupName]){const i=t[this.options.attributesGroupName];for(let t in i){if(!Object.prototype.hasOwnProperty.call(i,t))continue;const n=t.startsWith(this.options.attributeNamePrefix)?t.substring(this.options.attributeNamePrefix.length):t,s=i[t];!0===s&&this.options.suppressBooleanAttributes?e+=" "+n:e+=" "+n+'="'+s+'"'}}else for(let i in t){if(!Object.prototype.hasOwnProperty.call(t,i))continue;const n=this.isAttribute(i);if(n){const s=t[i];!0===s&&this.options.suppressBooleanAttributes?e+=" "+n:e+=" "+n+'="'+s+'"'}}return e},bt.prototype.buildObjectNode=function(t,e,i,n){if(""===t)return"?"===e[0]?this.indentate(n)+"<"+e+i+"?"+this.tagEndChar:this.indentate(n)+"<"+e+i+this.closeTag(e)+this.tagEndChar;{let s="</"+e+this.tagEndChar,r="";return"?"===e[0]&&(r="?",s=""),!i&&""!==i||-1!==t.indexOf("<")?!1!==this.options.commentPropName&&e===this.options.commentPropName&&0===r.length?this.indentate(n)+`\x3c!--${t}--\x3e`+this.newLine:this.indentate(n)+"<"+e+i+r+this.tagEndChar+t+this.indentate(n)+s:this.indentate(n)+"<"+e+i+r+">"+t+s}},bt.prototype.closeTag=function(t){let e="";return-1!==this.options.unpairedTags.indexOf(t)?this.options.suppressUnpairedNode||(e="/"):e=this.options.suppressEmptyNode?"/":`></${t}`,e},bt.prototype.checkStopNode=function(t){if(!this.stopNodeExpressions||0===this.stopNodeExpressions.length)return!1;for(let e=0;e<this.stopNodeExpressions.length;e++)if(t.matches(this.stopNodeExpressions[e]))return!0;return!1},bt.prototype.buildTextValNode=function(t,e,i,n,s){if(!1!==this.options.cdataPropName&&e===this.options.cdataPropName)return this.indentate(n)+`<![CDATA[${t}]]>`+this.newLine;if(!1!==this.options.commentPropName&&e===this.options.commentPropName)return this.indentate(n)+`\x3c!--${t}--\x3e`+this.newLine;if("?"===e[0])return this.indentate(n)+"<"+e+i+"?"+this.tagEndChar;{let s=this.options.tagValueProcessor(e,t);return s=this.replaceEntitiesValue(s),""===s?this.indentate(n)+"<"+e+i+this.closeTag(e)+this.tagEndChar:this.indentate(n)+"<"+e+i+">"+s+"</"+e+this.tagEndChar}},bt.prototype.replaceEntitiesValue=function(t){if(t&&t.length>0&&this.options.processEntities)for(let e=0;e<this.options.entities.length;e++){const i=this.options.entities[e];t=t.replace(i.regex,i.val)}return t};const vt=bt,Tt={validate:a};module.exports=e})();
|
|
86090
|
+
(()=>{"use strict";var t={d:(e,i)=>{for(var n in i)t.o(i,n)&&!t.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:i[n]})},o:(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r:t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})}},e={};t.r(e),t.d(e,{XMLBuilder:()=>Ct,XMLParser:()=>ft,XMLValidator:()=>It});const i=":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",n=new RegExp("^["+i+"]["+i+"\\-.\\d\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*$");function s(t,e){const i=[];let n=e.exec(t);for(;n;){const s=[];s.startIndex=e.lastIndex-n[0].length;const r=n.length;for(let t=0;t<r;t++)s.push(n[t]);i.push(s),n=e.exec(t)}return i}const r=function(t){return!(null==n.exec(t))},o=["hasOwnProperty","toString","valueOf","__defineGetter__","__defineSetter__","__lookupGetter__","__lookupSetter__"],a=["__proto__","constructor","prototype"],l={allowBooleanAttributes:!1,unpairedTags:[]};function h(t,e){e=Object.assign({},l,e);const i=[];let n=!1,s=!1;"\ufeff"===t[0]&&(t=t.substr(1));for(let r=0;r<t.length;r++)if("<"===t[r]&&"?"===t[r+1]){if(r+=2,r=u(t,r),r.err)return r}else{if("<"!==t[r]){if(p(t[r]))continue;return b("InvalidChar","char '"+t[r]+"' is not expected.",w(t,r))}{let o=r;if(r++,"!"===t[r]){r=c(t,r);continue}{let a=!1;"/"===t[r]&&(a=!0,r++);let l="";for(;r<t.length&&">"!==t[r]&&" "!==t[r]&&"\t"!==t[r]&&"\n"!==t[r]&&"\r"!==t[r];r++)l+=t[r];if(l=l.trim(),"/"===l[l.length-1]&&(l=l.substring(0,l.length-1),r--),!y(l)){let e;return e=0===l.trim().length?"Invalid space after '<'.":"Tag '"+l+"' is an invalid name.",b("InvalidTag",e,w(t,r))}const h=g(t,r);if(!1===h)return b("InvalidAttr","Attributes for '"+l+"' have open quote.",w(t,r));let d=h.value;if(r=h.index,"/"===d[d.length-1]){const i=r-d.length;d=d.substring(0,d.length-1);const s=x(d,e);if(!0!==s)return b(s.err.code,s.err.msg,w(t,i+s.err.line));n=!0}else if(a){if(!h.tagClosed)return b("InvalidTag","Closing tag '"+l+"' doesn't have proper closing.",w(t,r));if(d.trim().length>0)return b("InvalidTag","Closing tag '"+l+"' can't have attributes or invalid starting.",w(t,o));if(0===i.length)return b("InvalidTag","Closing tag '"+l+"' has not been opened.",w(t,o));{const e=i.pop();if(l!==e.tagName){let i=w(t,e.tagStartPos);return b("InvalidTag","Expected closing tag '"+e.tagName+"' (opened in line "+i.line+", col "+i.col+") instead of closing tag '"+l+"'.",w(t,o))}0==i.length&&(s=!0)}}else{const a=x(d,e);if(!0!==a)return b(a.err.code,a.err.msg,w(t,r-d.length+a.err.line));if(!0===s)return b("InvalidXml","Multiple possible root nodes found.",w(t,r));-1!==e.unpairedTags.indexOf(l)||i.push({tagName:l,tagStartPos:o}),n=!0}for(r++;r<t.length;r++)if("<"===t[r]){if("!"===t[r+1]){r++,r=c(t,r);continue}if("?"!==t[r+1])break;if(r=u(t,++r),r.err)return r}else if("&"===t[r]){const e=N(t,r);if(-1==e)return b("InvalidChar","char '&' is not expected.",w(t,r));r=e}else if(!0===s&&!p(t[r]))return b("InvalidXml","Extra text at the end",w(t,r));"<"===t[r]&&r--}}}return n?1==i.length?b("InvalidTag","Unclosed tag '"+i[0].tagName+"'.",w(t,i[0].tagStartPos)):!(i.length>0)||b("InvalidXml","Invalid '"+JSON.stringify(i.map(t=>t.tagName),null,4).replace(/\r?\n/g,"")+"' found.",{line:1,col:1}):b("InvalidXml","Start tag expected.",1)}function p(t){return" "===t||"\t"===t||"\n"===t||"\r"===t}function u(t,e){const i=e;for(;e<t.length;e++)if("?"==t[e]||" "==t[e]){const n=t.substr(i,e-i);if(e>5&&"xml"===n)return b("InvalidXml","XML declaration allowed only at the start of the document.",w(t,e));if("?"==t[e]&&">"==t[e+1]){e++;break}continue}return e}function c(t,e){if(t.length>e+5&&"-"===t[e+1]&&"-"===t[e+2]){for(e+=3;e<t.length;e++)if("-"===t[e]&&"-"===t[e+1]&&">"===t[e+2]){e+=2;break}}else if(t.length>e+8&&"D"===t[e+1]&&"O"===t[e+2]&&"C"===t[e+3]&&"T"===t[e+4]&&"Y"===t[e+5]&&"P"===t[e+6]&&"E"===t[e+7]){let i=1;for(e+=8;e<t.length;e++)if("<"===t[e])i++;else if(">"===t[e]&&(i--,0===i))break}else if(t.length>e+9&&"["===t[e+1]&&"C"===t[e+2]&&"D"===t[e+3]&&"A"===t[e+4]&&"T"===t[e+5]&&"A"===t[e+6]&&"["===t[e+7])for(e+=8;e<t.length;e++)if("]"===t[e]&&"]"===t[e+1]&&">"===t[e+2]){e+=2;break}return e}const d='"',f="'";function g(t,e){let i="",n="",s=!1;for(;e<t.length;e++){if(t[e]===d||t[e]===f)""===n?n=t[e]:n!==t[e]||(n="");else if(">"===t[e]&&""===n){s=!0;break}i+=t[e]}return""===n&&{value:i,index:e,tagClosed:s}}const m=new RegExp("(\\s*)([^\\s=]+)(\\s*=)?(\\s*(['\"])(([\\s\\S])*?)\\5)?","g");function x(t,e){const i=s(t,m),n={};for(let t=0;t<i.length;t++){if(0===i[t][1].length)return b("InvalidAttr","Attribute '"+i[t][2]+"' has no space in starting.",v(i[t]));if(void 0!==i[t][3]&&void 0===i[t][4])return b("InvalidAttr","Attribute '"+i[t][2]+"' is without value.",v(i[t]));if(void 0===i[t][3]&&!e.allowBooleanAttributes)return b("InvalidAttr","boolean attribute '"+i[t][2]+"' is not allowed.",v(i[t]));const s=i[t][2];if(!E(s))return b("InvalidAttr","Attribute '"+s+"' is an invalid name.",v(i[t]));if(Object.prototype.hasOwnProperty.call(n,s))return b("InvalidAttr","Attribute '"+s+"' is repeated.",v(i[t]));n[s]=1}return!0}function N(t,e){if(";"===t[++e])return-1;if("#"===t[e])return function(t,e){let i=/\d/;for("x"===t[e]&&(e++,i=/[\da-fA-F]/);e<t.length;e++){if(";"===t[e])return e;if(!t[e].match(i))break}return-1}(t,++e);let i=0;for(;e<t.length;e++,i++)if(!(t[e].match(/\w/)&&i<20)){if(";"===t[e])break;return-1}return e}function b(t,e,i){return{err:{code:t,msg:e,line:i.line||i,col:i.col}}}function E(t){return r(t)}function y(t){return r(t)}function w(t,e){const i=t.substring(0,e).split(/\r?\n/);return{line:i.length,col:i[i.length-1].length+1}}function v(t){return t.startIndex+t[1].length}const P=t=>o.includes(t)?"__"+t:t,T={preserveOrder:!1,attributeNamePrefix:"@_",attributesGroupName:!1,textNodeName:"#text",ignoreAttributes:!0,removeNSPrefix:!1,allowBooleanAttributes:!1,parseTagValue:!0,parseAttributeValue:!1,trimValues:!0,cdataPropName:!1,numberParseOptions:{hex:!0,leadingZeros:!0,eNotation:!0},tagValueProcessor:function(t,e){return e},attributeValueProcessor:function(t,e){return e},stopNodes:[],alwaysCreateTextNode:!1,isArray:()=>!1,commentPropName:!1,unpairedTags:[],processEntities:!0,htmlEntities:!1,ignoreDeclaration:!1,ignorePiTags:!1,transformTagName:!1,transformAttributeName:!1,updateTag:function(t,e,i){return t},captureMetaData:!1,maxNestedTags:100,strictReservedNames:!0,jPath:!0,onDangerousProperty:P};function S(t,e){if("string"!=typeof t)return;const i=t.toLowerCase();if(o.some(t=>i===t.toLowerCase()))throw new Error(`[SECURITY] Invalid ${e}: "${t}" is a reserved JavaScript keyword that could cause prototype pollution`);if(a.some(t=>i===t.toLowerCase()))throw new Error(`[SECURITY] Invalid ${e}: "${t}" is a reserved JavaScript keyword that could cause prototype pollution`)}function A(t){return"boolean"==typeof t?{enabled:t,maxEntitySize:1e4,maxExpansionDepth:10,maxTotalExpansions:1e3,maxExpandedLength:1e5,maxEntityCount:100,allowedTags:null,tagFilter:null}:"object"==typeof t&&null!==t?{enabled:!1!==t.enabled,maxEntitySize:t.maxEntitySize??1e4,maxExpansionDepth:t.maxExpansionDepth??10,maxTotalExpansions:t.maxTotalExpansions??1e3,maxExpandedLength:t.maxExpandedLength??1e5,maxEntityCount:t.maxEntityCount??100,allowedTags:t.allowedTags??null,tagFilter:t.tagFilter??null}:A(!0)}const O=function(t){const e=Object.assign({},T,t),i=[{value:e.attributeNamePrefix,name:"attributeNamePrefix"},{value:e.attributesGroupName,name:"attributesGroupName"},{value:e.textNodeName,name:"textNodeName"},{value:e.cdataPropName,name:"cdataPropName"},{value:e.commentPropName,name:"commentPropName"}];for(const{value:t,name:e}of i)t&&S(t,e);return null===e.onDangerousProperty&&(e.onDangerousProperty=P),e.processEntities=A(e.processEntities),e.stopNodes&&Array.isArray(e.stopNodes)&&(e.stopNodes=e.stopNodes.map(t=>"string"==typeof t&&t.startsWith("*.")?".."+t.substring(2):t)),e};let C;C="function"!=typeof Symbol?"@@xmlMetadata":Symbol("XML Node Metadata");class I{constructor(t){this.tagname=t,this.child=[],this[":@"]=Object.create(null)}add(t,e){"__proto__"===t&&(t="#__proto__"),this.child.push({[t]:e})}addChild(t,e){"__proto__"===t.tagname&&(t.tagname="#__proto__"),t[":@"]&&Object.keys(t[":@"]).length>0?this.child.push({[t.tagname]:t.child,":@":t[":@"]}):this.child.push({[t.tagname]:t.child}),void 0!==e&&(this.child[this.child.length-1][C]={startIndex:e})}static getMetaDataSymbol(){return C}}class ${constructor(t){this.suppressValidationErr=!t,this.options=t}readDocType(t,e){const i=Object.create(null);let n=0;if("O"!==t[e+3]||"C"!==t[e+4]||"T"!==t[e+5]||"Y"!==t[e+6]||"P"!==t[e+7]||"E"!==t[e+8])throw new Error("Invalid Tag instead of DOCTYPE");{e+=9;let s=1,r=!1,o=!1,a="";for(;e<t.length;e++)if("<"!==t[e]||o)if(">"===t[e]){if(o?"-"===t[e-1]&&"-"===t[e-2]&&(o=!1,s--):s--,0===s)break}else"["===t[e]?r=!0:a+=t[e];else{if(r&&_(t,"!ENTITY",e)){let s,r;if(e+=7,[s,r,e]=this.readEntityExp(t,e+1,this.suppressValidationErr),-1===r.indexOf("&")){if(!1!==this.options.enabled&&this.options.maxEntityCount&&n>=this.options.maxEntityCount)throw new Error(`Entity count (${n+1}) exceeds maximum allowed (${this.options.maxEntityCount})`);const t=s.replace(/[.\-+*:]/g,"\\.");i[s]={regx:RegExp(`&${t};`,"g"),val:r},n++}}else if(r&&_(t,"!ELEMENT",e)){e+=8;const{index:i}=this.readElementExp(t,e+1);e=i}else if(r&&_(t,"!ATTLIST",e))e+=8;else if(r&&_(t,"!NOTATION",e)){e+=9;const{index:i}=this.readNotationExp(t,e+1,this.suppressValidationErr);e=i}else{if(!_(t,"!--",e))throw new Error("Invalid DOCTYPE");o=!0}s++,a=""}if(0!==s)throw new Error("Unclosed DOCTYPE")}return{entities:i,i:e}}readEntityExp(t,e){e=j(t,e);let i="";for(;e<t.length&&!/\s/.test(t[e])&&'"'!==t[e]&&"'"!==t[e];)i+=t[e],e++;if(V(i),e=j(t,e),!this.suppressValidationErr){if("SYSTEM"===t.substring(e,e+6).toUpperCase())throw new Error("External entities are not supported");if("%"===t[e])throw new Error("Parameter entities are not supported")}let n="";if([e,n]=this.readIdentifierVal(t,e,"entity"),!1!==this.options.enabled&&this.options.maxEntitySize&&n.length>this.options.maxEntitySize)throw new Error(`Entity "${i}" size (${n.length}) exceeds maximum allowed size (${this.options.maxEntitySize})`);return[i,n,--e]}readNotationExp(t,e){e=j(t,e);let i="";for(;e<t.length&&!/\s/.test(t[e]);)i+=t[e],e++;!this.suppressValidationErr&&V(i),e=j(t,e);const n=t.substring(e,e+6).toUpperCase();if(!this.suppressValidationErr&&"SYSTEM"!==n&&"PUBLIC"!==n)throw new Error(`Expected SYSTEM or PUBLIC, found "${n}"`);e+=n.length,e=j(t,e);let s=null,r=null;if("PUBLIC"===n)[e,s]=this.readIdentifierVal(t,e,"publicIdentifier"),'"'!==t[e=j(t,e)]&&"'"!==t[e]||([e,r]=this.readIdentifierVal(t,e,"systemIdentifier"));else if("SYSTEM"===n&&([e,r]=this.readIdentifierVal(t,e,"systemIdentifier"),!this.suppressValidationErr&&!r))throw new Error("Missing mandatory system identifier for SYSTEM notation");return{notationName:i,publicIdentifier:s,systemIdentifier:r,index:--e}}readIdentifierVal(t,e,i){let n="";const s=t[e];if('"'!==s&&"'"!==s)throw new Error(`Expected quoted string, found "${s}"`);for(e++;e<t.length&&t[e]!==s;)n+=t[e],e++;if(t[e]!==s)throw new Error(`Unterminated ${i} value`);return[++e,n]}readElementExp(t,e){e=j(t,e);let i="";for(;e<t.length&&!/\s/.test(t[e]);)i+=t[e],e++;if(!this.suppressValidationErr&&!r(i))throw new Error(`Invalid element name: "${i}"`);let n="";if("E"===t[e=j(t,e)]&&_(t,"MPTY",e))e+=4;else if("A"===t[e]&&_(t,"NY",e))e+=2;else if("("===t[e]){for(e++;e<t.length&&")"!==t[e];)n+=t[e],e++;if(")"!==t[e])throw new Error("Unterminated content model")}else if(!this.suppressValidationErr)throw new Error(`Invalid Element Expression, found "${t[e]}"`);return{elementName:i,contentModel:n.trim(),index:e}}readAttlistExp(t,e){e=j(t,e);let i="";for(;e<t.length&&!/\s/.test(t[e]);)i+=t[e],e++;V(i),e=j(t,e);let n="";for(;e<t.length&&!/\s/.test(t[e]);)n+=t[e],e++;if(!V(n))throw new Error(`Invalid attribute name: "${n}"`);e=j(t,e);let s="";if("NOTATION"===t.substring(e,e+8).toUpperCase()){if(s="NOTATION","("!==t[e=j(t,e+=8)])throw new Error(`Expected '(', found "${t[e]}"`);e++;let i=[];for(;e<t.length&&")"!==t[e];){let n="";for(;e<t.length&&"|"!==t[e]&&")"!==t[e];)n+=t[e],e++;if(n=n.trim(),!V(n))throw new Error(`Invalid notation name: "${n}"`);i.push(n),"|"===t[e]&&(e++,e=j(t,e))}if(")"!==t[e])throw new Error("Unterminated list of notations");e++,s+=" ("+i.join("|")+")"}else{for(;e<t.length&&!/\s/.test(t[e]);)s+=t[e],e++;const i=["CDATA","ID","IDREF","IDREFS","ENTITY","ENTITIES","NMTOKEN","NMTOKENS"];if(!this.suppressValidationErr&&!i.includes(s.toUpperCase()))throw new Error(`Invalid attribute type: "${s}"`)}e=j(t,e);let r="";return"#REQUIRED"===t.substring(e,e+8).toUpperCase()?(r="#REQUIRED",e+=8):"#IMPLIED"===t.substring(e,e+7).toUpperCase()?(r="#IMPLIED",e+=7):[e,r]=this.readIdentifierVal(t,e,"ATTLIST"),{elementName:i,attributeName:n,attributeType:s,defaultValue:r,index:e}}}const j=(t,e)=>{for(;e<t.length&&/\s/.test(t[e]);)e++;return e};function _(t,e,i){for(let n=0;n<e.length;n++)if(e[n]!==t[i+n+1])return!1;return!0}function V(t){if(r(t))return t;throw new Error(`Invalid entity name ${t}`)}const D=/^[-+]?0x[a-fA-F0-9]+$/,k=/^([\-\+])?(0*)([0-9]*(\.[0-9]*)?)$/,F={hex:!0,leadingZeros:!0,decimalPoint:".",eNotation:!0};const L=/^([-+])?(0*)(\d*(\.\d*)?[eE][-\+]?\d+)$/;class M{constructor(t={}){this.separator=t.separator||".",this.path=[],this.siblingStacks=[]}push(t,e=null,i=null){this.path.length>0&&(this.path[this.path.length-1].values=void 0);const n=this.path.length;this.siblingStacks[n]||(this.siblingStacks[n]=new Map);const s=this.siblingStacks[n],r=i?`${i}:${t}`:t,o=s.get(r)||0;let a=0;for(const t of s.values())a+=t;s.set(r,o+1);const l={tag:t,position:a,counter:o};null!=i&&(l.namespace=i),null!=e&&(l.values=e),this.path.push(l)}pop(){if(0===this.path.length)return;const t=this.path.pop();return this.siblingStacks.length>this.path.length+1&&(this.siblingStacks.length=this.path.length+1),t}updateCurrent(t){if(this.path.length>0){const e=this.path[this.path.length-1];null!=t&&(e.values=t)}}getCurrentTag(){return this.path.length>0?this.path[this.path.length-1].tag:void 0}getCurrentNamespace(){return this.path.length>0?this.path[this.path.length-1].namespace:void 0}getAttrValue(t){if(0===this.path.length)return;const e=this.path[this.path.length-1];return e.values?.[t]}hasAttr(t){if(0===this.path.length)return!1;const e=this.path[this.path.length-1];return void 0!==e.values&&t in e.values}getPosition(){return 0===this.path.length?-1:this.path[this.path.length-1].position??0}getCounter(){return 0===this.path.length?-1:this.path[this.path.length-1].counter??0}getIndex(){return this.getPosition()}getDepth(){return this.path.length}toString(t,e=!0){const i=t||this.separator;return this.path.map(t=>e&&t.namespace?`${t.namespace}:${t.tag}`:t.tag).join(i)}toArray(){return this.path.map(t=>t.tag)}reset(){this.path=[],this.siblingStacks=[]}matches(t){const e=t.segments;return 0!==e.length&&(t.hasDeepWildcard()?this._matchWithDeepWildcard(e):this._matchSimple(e))}_matchSimple(t){if(this.path.length!==t.length)return!1;for(let e=0;e<t.length;e++){const i=t[e],n=this.path[e],s=e===this.path.length-1;if(!this._matchSegment(i,n,s))return!1}return!0}_matchWithDeepWildcard(t){let e=this.path.length-1,i=t.length-1;for(;i>=0&&e>=0;){const n=t[i];if("deep-wildcard"===n.type){if(i--,i<0)return!0;const n=t[i];let s=!1;for(let t=e;t>=0;t--){const r=t===this.path.length-1;if(this._matchSegment(n,this.path[t],r)){e=t-1,i--,s=!0;break}}if(!s)return!1}else{const t=e===this.path.length-1;if(!this._matchSegment(n,this.path[e],t))return!1;e--,i--}}return i<0}_matchSegment(t,e,i){if("*"!==t.tag&&t.tag!==e.tag)return!1;if(void 0!==t.namespace&&"*"!==t.namespace&&t.namespace!==e.namespace)return!1;if(void 0!==t.attrName){if(!i)return!1;if(!e.values||!(t.attrName in e.values))return!1;if(void 0!==t.attrValue){const i=e.values[t.attrName];if(String(i)!==String(t.attrValue))return!1}}if(void 0!==t.position){if(!i)return!1;const n=e.counter??0;if("first"===t.position&&0!==n)return!1;if("odd"===t.position&&n%2!=1)return!1;if("even"===t.position&&n%2!=0)return!1;if("nth"===t.position&&n!==t.positionValue)return!1}return!0}snapshot(){return{path:this.path.map(t=>({...t})),siblingStacks:this.siblingStacks.map(t=>new Map(t))}}restore(t){this.path=t.path.map(t=>({...t})),this.siblingStacks=t.siblingStacks.map(t=>new Map(t))}}class G{constructor(t,e={}){this.pattern=t,this.separator=e.separator||".",this.segments=this._parse(t),this._hasDeepWildcard=this.segments.some(t=>"deep-wildcard"===t.type),this._hasAttributeCondition=this.segments.some(t=>void 0!==t.attrName),this._hasPositionSelector=this.segments.some(t=>void 0!==t.position)}_parse(t){const e=[];let i=0,n="";for(;i<t.length;)t[i]===this.separator?i+1<t.length&&t[i+1]===this.separator?(n.trim()&&(e.push(this._parseSegment(n.trim())),n=""),e.push({type:"deep-wildcard"}),i+=2):(n.trim()&&e.push(this._parseSegment(n.trim())),n="",i++):(n+=t[i],i++);return n.trim()&&e.push(this._parseSegment(n.trim())),e}_parseSegment(t){const e={type:"tag"};let i=null,n=t;const s=t.match(/^([^\[]+)(\[[^\]]*\])(.*)$/);if(s&&(n=s[1]+s[3],s[2])){const t=s[2].slice(1,-1);t&&(i=t)}let r,o,a=n;if(n.includes("::")){const e=n.indexOf("::");if(r=n.substring(0,e).trim(),a=n.substring(e+2).trim(),!r)throw new Error(`Invalid namespace in pattern: ${t}`)}let l=null;if(a.includes(":")){const t=a.lastIndexOf(":"),e=a.substring(0,t).trim(),i=a.substring(t+1).trim();["first","last","odd","even"].includes(i)||/^nth\(\d+\)$/.test(i)?(o=e,l=i):o=a}else o=a;if(!o)throw new Error(`Invalid segment pattern: ${t}`);if(e.tag=o,r&&(e.namespace=r),i)if(i.includes("=")){const t=i.indexOf("=");e.attrName=i.substring(0,t).trim(),e.attrValue=i.substring(t+1).trim()}else e.attrName=i.trim();if(l){const t=l.match(/^nth\((\d+)\)$/);t?(e.position="nth",e.positionValue=parseInt(t[1],10)):e.position=l}return e}get length(){return this.segments.length}hasDeepWildcard(){return this._hasDeepWildcard}hasAttributeCondition(){return this._hasAttributeCondition}hasPositionSelector(){return this._hasPositionSelector}toString(){return this.pattern}}function R(t,e){if(!t)return{};const i=e.attributesGroupName?t[e.attributesGroupName]:t;if(!i)return{};const n={};for(const t in i)t.startsWith(e.attributeNamePrefix)?n[t.substring(e.attributeNamePrefix.length)]=i[t]:n[t]=i[t];return n}function U(t){if(!t||"string"!=typeof t)return;const e=t.indexOf(":");if(-1!==e&&e>0){const i=t.substring(0,e);if("xmlns"!==i)return i}}class B{constructor(t){var e;if(this.options=t,this.currentNode=null,this.tagsNodeStack=[],this.docTypeEntities={},this.lastEntities={apos:{regex:/&(apos|#39|#x27);/g,val:"'"},gt:{regex:/&(gt|#62|#x3E);/g,val:">"},lt:{regex:/&(lt|#60|#x3C);/g,val:"<"},quot:{regex:/&(quot|#34|#x22);/g,val:'"'}},this.ampEntity={regex:/&(amp|#38|#x26);/g,val:"&"},this.htmlEntities={space:{regex:/&(nbsp|#160);/g,val:" "},cent:{regex:/&(cent|#162);/g,val:"¢"},pound:{regex:/&(pound|#163);/g,val:"£"},yen:{regex:/&(yen|#165);/g,val:"¥"},euro:{regex:/&(euro|#8364);/g,val:"€"},copyright:{regex:/&(copy|#169);/g,val:"©"},reg:{regex:/&(reg|#174);/g,val:"®"},inr:{regex:/&(inr|#8377);/g,val:"₹"},num_dec:{regex:/&#([0-9]{1,7});/g,val:(t,e)=>st(e,10,"&#")},num_hex:{regex:/&#x([0-9a-fA-F]{1,6});/g,val:(t,e)=>st(e,16,"&#x")}},this.addExternalEntities=W,this.parseXml=Z,this.parseTextData=Y,this.resolveNameSpace=X,this.buildAttributesMap=q,this.isItStopNode=H,this.replaceEntitiesValue=K,this.readStopNodeData=it,this.saveTextToParentTag=Q,this.addChild=J,this.ignoreAttributesFn="function"==typeof(e=this.options.ignoreAttributes)?e:Array.isArray(e)?t=>{for(const i of e){if("string"==typeof i&&t===i)return!0;if(i instanceof RegExp&&i.test(t))return!0}}:()=>!1,this.entityExpansionCount=0,this.currentExpandedLength=0,this.matcher=new M,this.isCurrentNodeStopNode=!1,this.options.stopNodes&&this.options.stopNodes.length>0){this.stopNodeExpressions=[];for(let t=0;t<this.options.stopNodes.length;t++){const e=this.options.stopNodes[t];"string"==typeof e?this.stopNodeExpressions.push(new G(e)):e instanceof G&&this.stopNodeExpressions.push(e)}}}}function W(t){const e=Object.keys(t);for(let i=0;i<e.length;i++){const n=e[i],s=n.replace(/[.\-+*:]/g,"\\.");this.lastEntities[n]={regex:new RegExp("&"+s+";","g"),val:t[n]}}}function Y(t,e,i,n,s,r,o){if(void 0!==t&&(this.options.trimValues&&!n&&(t=t.trim()),t.length>0)){o||(t=this.replaceEntitiesValue(t,e,i));const n=this.options.jPath?i.toString():i,a=this.options.tagValueProcessor(e,t,n,s,r);return null==a?t:typeof a!=typeof t||a!==t?a:this.options.trimValues||t.trim()===t?nt(t,this.options.parseTagValue,this.options.numberParseOptions):t}}function X(t){if(this.options.removeNSPrefix){const e=t.split(":"),i="/"===t.charAt(0)?"/":"";if("xmlns"===e[0])return"";2===e.length&&(t=i+e[1])}return t}const z=new RegExp("([^\\s=]+)\\s*(=\\s*(['\"])([\\s\\S]*?)\\3)?","gm");function q(t,e,i){if(!0!==this.options.ignoreAttributes&&"string"==typeof t){const n=s(t,z),r=n.length,o={},a={};for(let t=0;t<r;t++){const s=this.resolveNameSpace(n[t][1]),r=n[t][4];if(s.length&&void 0!==r){let t=r;this.options.trimValues&&(t=t.trim()),t=this.replaceEntitiesValue(t,i,e),a[s]=t}}Object.keys(a).length>0&&"object"==typeof e&&e.updateCurrent&&e.updateCurrent(a);for(let t=0;t<r;t++){const s=this.resolveNameSpace(n[t][1]),r=this.options.jPath?e.toString():e;if(this.ignoreAttributesFn(s,r))continue;let a=n[t][4],l=this.options.attributeNamePrefix+s;if(s.length)if(this.options.transformAttributeName&&(l=this.options.transformAttributeName(l)),l=ot(l,this.options),void 0!==a){this.options.trimValues&&(a=a.trim()),a=this.replaceEntitiesValue(a,i,e);const t=this.options.jPath?e.toString():e,n=this.options.attributeValueProcessor(s,a,t);o[l]=null==n?a:typeof n!=typeof a||n!==a?n:nt(a,this.options.parseAttributeValue,this.options.numberParseOptions)}else this.options.allowBooleanAttributes&&(o[l]=!0)}if(!Object.keys(o).length)return;if(this.options.attributesGroupName){const t={};return t[this.options.attributesGroupName]=o,t}return o}}const Z=function(t){t=t.replace(/\r\n?/g,"\n");const e=new I("!xml");let i=e,n="";this.matcher.reset(),this.entityExpansionCount=0,this.currentExpandedLength=0;const s=new $(this.options.processEntities);for(let r=0;r<t.length;r++)if("<"===t[r])if("/"===t[r+1]){const e=tt(t,">",r,"Closing Tag is not closed.");let s=t.substring(r+2,e).trim();if(this.options.removeNSPrefix){const t=s.indexOf(":");-1!==t&&(s=s.substr(t+1))}s=rt(this.options.transformTagName,s,"",this.options).tagName,i&&(n=this.saveTextToParentTag(n,i,this.matcher));const o=this.matcher.getCurrentTag();if(s&&-1!==this.options.unpairedTags.indexOf(s))throw new Error(`Unpaired tag can not be used as closing tag: </${s}>`);o&&-1!==this.options.unpairedTags.indexOf(o)&&(this.matcher.pop(),this.tagsNodeStack.pop()),this.matcher.pop(),this.isCurrentNodeStopNode=!1,i=this.tagsNodeStack.pop(),n="",r=e}else if("?"===t[r+1]){let e=et(t,r,!1,"?>");if(!e)throw new Error("Pi Tag is not closed.");if(n=this.saveTextToParentTag(n,i,this.matcher),this.options.ignoreDeclaration&&"?xml"===e.tagName||this.options.ignorePiTags);else{const t=new I(e.tagName);t.add(this.options.textNodeName,""),e.tagName!==e.tagExp&&e.attrExpPresent&&(t[":@"]=this.buildAttributesMap(e.tagExp,this.matcher,e.tagName)),this.addChild(i,t,this.matcher,r)}r=e.closeIndex+1}else if("!--"===t.substr(r+1,3)){const e=tt(t,"--\x3e",r+4,"Comment is not closed.");if(this.options.commentPropName){const s=t.substring(r+4,e-2);n=this.saveTextToParentTag(n,i,this.matcher),i.add(this.options.commentPropName,[{[this.options.textNodeName]:s}])}r=e}else if("!D"===t.substr(r+1,2)){const e=s.readDocType(t,r);this.docTypeEntities=e.entities,r=e.i}else if("!["===t.substr(r+1,2)){const e=tt(t,"]]>",r,"CDATA is not closed.")-2,s=t.substring(r+9,e);n=this.saveTextToParentTag(n,i,this.matcher);let o=this.parseTextData(s,i.tagname,this.matcher,!0,!1,!0,!0);null==o&&(o=""),this.options.cdataPropName?i.add(this.options.cdataPropName,[{[this.options.textNodeName]:s}]):i.add(this.options.textNodeName,o),r=e+2}else{let s=et(t,r,this.options.removeNSPrefix);if(!s){const e=t.substring(Math.max(0,r-50),Math.min(t.length,r+50));throw new Error(`readTagExp returned undefined at position ${r}. Context: "${e}"`)}let o=s.tagName;const a=s.rawTagName;let l=s.tagExp,h=s.attrExpPresent,p=s.closeIndex;if(({tagName:o,tagExp:l}=rt(this.options.transformTagName,o,l,this.options)),this.options.strictReservedNames&&(o===this.options.commentPropName||o===this.options.cdataPropName))throw new Error(`Invalid tag name: ${o}`);i&&n&&"!xml"!==i.tagname&&(n=this.saveTextToParentTag(n,i,this.matcher,!1));const u=i;u&&-1!==this.options.unpairedTags.indexOf(u.tagname)&&(i=this.tagsNodeStack.pop(),this.matcher.pop());let c=!1;l.length>0&&l.lastIndexOf("/")===l.length-1&&(c=!0,"/"===o[o.length-1]?(o=o.substr(0,o.length-1),l=o):l=l.substr(0,l.length-1),h=o!==l);let d,f=null,g={};d=U(a),o!==e.tagname&&this.matcher.push(o,{},d),o!==l&&h&&(f=this.buildAttributesMap(l,this.matcher,o),f&&(g=R(f,this.options))),o!==e.tagname&&(this.isCurrentNodeStopNode=this.isItStopNode(this.stopNodeExpressions,this.matcher));const m=r;if(this.isCurrentNodeStopNode){let e="";if(c)r=s.closeIndex;else if(-1!==this.options.unpairedTags.indexOf(o))r=s.closeIndex;else{const i=this.readStopNodeData(t,a,p+1);if(!i)throw new Error(`Unexpected end of ${a}`);r=i.i,e=i.tagContent}const n=new I(o);f&&(n[":@"]=f),n.add(this.options.textNodeName,e),this.matcher.pop(),this.isCurrentNodeStopNode=!1,this.addChild(i,n,this.matcher,m)}else{if(c){({tagName:o,tagExp:l}=rt(this.options.transformTagName,o,l,this.options));const t=new I(o);f&&(t[":@"]=f),this.addChild(i,t,this.matcher,m),this.matcher.pop(),this.isCurrentNodeStopNode=!1}else{if(-1!==this.options.unpairedTags.indexOf(o)){const t=new I(o);f&&(t[":@"]=f),this.addChild(i,t,this.matcher,m),this.matcher.pop(),this.isCurrentNodeStopNode=!1,r=s.closeIndex;continue}{const t=new I(o);if(this.tagsNodeStack.length>this.options.maxNestedTags)throw new Error("Maximum nested tags exceeded");this.tagsNodeStack.push(i),f&&(t[":@"]=f),this.addChild(i,t,this.matcher,m),i=t}}n="",r=p}}else n+=t[r];return e.child};function J(t,e,i,n){this.options.captureMetaData||(n=void 0);const s=this.options.jPath?i.toString():i,r=this.options.updateTag(e.tagname,s,e[":@"]);!1===r||("string"==typeof r?(e.tagname=r,t.addChild(e,n)):t.addChild(e,n))}function K(t,e,i){const n=this.options.processEntities;if(!n||!n.enabled)return t;if(n.allowedTags){const s=this.options.jPath?i.toString():i;if(!(Array.isArray(n.allowedTags)?n.allowedTags.includes(e):n.allowedTags(e,s)))return t}if(n.tagFilter){const s=this.options.jPath?i.toString():i;if(!n.tagFilter(e,s))return t}for(let e in this.docTypeEntities){const i=this.docTypeEntities[e],s=t.match(i.regx);if(s){if(this.entityExpansionCount+=s.length,n.maxTotalExpansions&&this.entityExpansionCount>n.maxTotalExpansions)throw new Error(`Entity expansion limit exceeded: ${this.entityExpansionCount} > ${n.maxTotalExpansions}`);const e=t.length;if(t=t.replace(i.regx,i.val),n.maxExpandedLength&&(this.currentExpandedLength+=t.length-e,this.currentExpandedLength>n.maxExpandedLength))throw new Error(`Total expanded content size exceeded: ${this.currentExpandedLength} > ${n.maxExpandedLength}`)}}if(-1===t.indexOf("&"))return t;for(let e in this.lastEntities){const i=this.lastEntities[e];t=t.replace(i.regex,i.val)}if(-1===t.indexOf("&"))return t;if(this.options.htmlEntities)for(let e in this.htmlEntities){const i=this.htmlEntities[e];t=t.replace(i.regex,i.val)}return t.replace(this.ampEntity.regex,this.ampEntity.val)}function Q(t,e,i,n){return t&&(void 0===n&&(n=0===e.child.length),void 0!==(t=this.parseTextData(t,e.tagname,i,!1,!!e[":@"]&&0!==Object.keys(e[":@"]).length,n))&&""!==t&&e.add(this.options.textNodeName,t),t=""),t}function H(t,e){if(!t||0===t.length)return!1;for(let i=0;i<t.length;i++)if(e.matches(t[i]))return!0;return!1}function tt(t,e,i,n){const s=t.indexOf(e,i);if(-1===s)throw new Error(n);return s+e.length-1}function et(t,e,i,n=">"){const s=function(t,e,i=">"){let n,s="";for(let r=e;r<t.length;r++){let e=t[r];if(n)e===n&&(n="");else if('"'===e||"'"===e)n=e;else if(e===i[0]){if(!i[1])return{data:s,index:r};if(t[r+1]===i[1])return{data:s,index:r}}else"\t"===e&&(e=" ");s+=e}}(t,e+1,n);if(!s)return;let r=s.data;const o=s.index,a=r.search(/\s/);let l=r,h=!0;-1!==a&&(l=r.substring(0,a),r=r.substring(a+1).trimStart());const p=l;if(i){const t=l.indexOf(":");-1!==t&&(l=l.substr(t+1),h=l!==s.data.substr(t+1))}return{tagName:l,tagExp:r,closeIndex:o,attrExpPresent:h,rawTagName:p}}function it(t,e,i){const n=i;let s=1;for(;i<t.length;i++)if("<"===t[i])if("/"===t[i+1]){const r=tt(t,">",i,`${e} is not closed`);if(t.substring(i+2,r).trim()===e&&(s--,0===s))return{tagContent:t.substring(n,i),i:r};i=r}else if("?"===t[i+1])i=tt(t,"?>",i+1,"StopNode is not closed.");else if("!--"===t.substr(i+1,3))i=tt(t,"--\x3e",i+3,"StopNode is not closed.");else if("!["===t.substr(i+1,2))i=tt(t,"]]>",i,"StopNode is not closed.")-2;else{const n=et(t,i,">");n&&((n&&n.tagName)===e&&"/"!==n.tagExp[n.tagExp.length-1]&&s++,i=n.closeIndex)}}function nt(t,e,i){if(e&&"string"==typeof t){const e=t.trim();return"true"===e||"false"!==e&&function(t,e={}){if(e=Object.assign({},F,e),!t||"string"!=typeof t)return t;let i=t.trim();if(void 0!==e.skipLike&&e.skipLike.test(i))return t;if("0"===t)return 0;if(e.hex&&D.test(i))return function(t){if(parseInt)return parseInt(t,16);if(Number.parseInt)return Number.parseInt(t,16);if(window&&window.parseInt)return window.parseInt(t,16);throw new Error("parseInt, Number.parseInt, window.parseInt are not supported")}(i);if(i.includes("e")||i.includes("E"))return function(t,e,i){if(!i.eNotation)return t;const n=e.match(L);if(n){let s=n[1]||"";const r=-1===n[3].indexOf("e")?"E":"e",o=n[2],a=s?t[o.length+1]===r:t[o.length]===r;return o.length>1&&a?t:1!==o.length||!n[3].startsWith(`.${r}`)&&n[3][0]!==r?i.leadingZeros&&!a?(e=(n[1]||"")+n[3],Number(e)):t:Number(e)}return t}(t,i,e);{const s=k.exec(i);if(s){const r=s[1]||"",o=s[2];let a=(n=s[3])&&-1!==n.indexOf(".")?("."===(n=n.replace(/0+$/,""))?n="0":"."===n[0]?n="0"+n:"."===n[n.length-1]&&(n=n.substring(0,n.length-1)),n):n;const l=r?"."===t[o.length+1]:"."===t[o.length];if(!e.leadingZeros&&(o.length>1||1===o.length&&!l))return t;{const n=Number(i),s=String(n);if(0===n)return n;if(-1!==s.search(/[eE]/))return e.eNotation?n:t;if(-1!==i.indexOf("."))return"0"===s||s===a||s===`${r}${a}`?n:t;let l=o?a:i;return o?l===s||r+l===s?n:t:l===s||l===r+s?n:t}}return t}// removed by dead control flow
|
|
86091
|
+
var n; }(t,i)}return void 0!==t?t:""}function st(t,e,i){const n=Number.parseInt(t,e);return n>=0&&n<=1114111?String.fromCodePoint(n):i+t+";"}function rt(t,e,i,n){if(t){const n=t(e);i===e&&(i=n),e=n}return{tagName:e=ot(e,n),tagExp:i}}function ot(t,e){if(a.includes(t))throw new Error(`[SECURITY] Invalid name: "${t}" is a reserved JavaScript keyword that could cause prototype pollution`);return o.includes(t)?e.onDangerousProperty(t):t}const at=I.getMetaDataSymbol();function lt(t,e){if(!t||"object"!=typeof t)return{};if(!e)return t;const i={};for(const n in t)n.startsWith(e)?i[n.substring(e.length)]=t[n]:i[n]=t[n];return i}function ht(t,e,i){return pt(t,e,i)}function pt(t,e,i){let n;const s={};for(let r=0;r<t.length;r++){const o=t[r],a=ut(o);if(void 0!==a&&a!==e.textNodeName){const t=lt(o[":@"]||{},e.attributeNamePrefix);i.push(a,t)}if(a===e.textNodeName)void 0===n?n=o[a]:n+=""+o[a];else{if(void 0===a)continue;if(o[a]){let t=pt(o[a],e,i);const n=dt(t,e);if(o[":@"]?ct(t,o[":@"],i,e):1!==Object.keys(t).length||void 0===t[e.textNodeName]||e.alwaysCreateTextNode?0===Object.keys(t).length&&(e.alwaysCreateTextNode?t[e.textNodeName]="":t=""):t=t[e.textNodeName],void 0!==o[at]&&"object"==typeof t&&null!==t&&(t[at]=o[at]),void 0!==s[a]&&Object.prototype.hasOwnProperty.call(s,a))Array.isArray(s[a])||(s[a]=[s[a]]),s[a].push(t);else{const r=e.jPath?i.toString():i;e.isArray(a,r,n)?s[a]=[t]:s[a]=t}void 0!==a&&a!==e.textNodeName&&i.pop()}}}return"string"==typeof n?n.length>0&&(s[e.textNodeName]=n):void 0!==n&&(s[e.textNodeName]=n),s}function ut(t){const e=Object.keys(t);for(let t=0;t<e.length;t++){const i=e[t];if(":@"!==i)return i}}function ct(t,e,i,n){if(e){const s=Object.keys(e),r=s.length;for(let o=0;o<r;o++){const r=s[o],a=r.startsWith(n.attributeNamePrefix)?r.substring(n.attributeNamePrefix.length):r,l=n.jPath?i.toString()+"."+a:i;n.isArray(r,l,!0,!0)?t[r]=[e[r]]:t[r]=e[r]}}}function dt(t,e){const{textNodeName:i}=e,n=Object.keys(t).length;return 0===n||!(1!==n||!t[i]&&"boolean"!=typeof t[i]&&0!==t[i])}class ft{constructor(t){this.externalEntities={},this.options=O(t)}parse(t,e){if("string"!=typeof t&&t.toString)t=t.toString();else if("string"!=typeof t)throw new Error("XML data is accepted in String or Bytes[] form.");if(e){!0===e&&(e={});const i=h(t,e);if(!0!==i)throw Error(`${i.err.msg}:${i.err.line}:${i.err.col}`)}const i=new B(this.options);i.addExternalEntities(this.externalEntities);const n=i.parseXml(t);return this.options.preserveOrder||void 0===n?n:ht(n,this.options,i.matcher)}addEntity(t,e){if(-1!==e.indexOf("&"))throw new Error("Entity value can't have '&'");if(-1!==t.indexOf("&")||-1!==t.indexOf(";"))throw new Error("An entity must be set without '&' and ';'. Eg. use '#xD' for '
'");if("&"===e)throw new Error("An entity with value '&' is not permitted");this.externalEntities[t]=e}static getMetaDataSymbol(){return I.getMetaDataSymbol()}}function gt(t,e){let i="";e.format&&e.indentBy.length>0&&(i="\n");const n=[];if(e.stopNodes&&Array.isArray(e.stopNodes))for(let t=0;t<e.stopNodes.length;t++){const i=e.stopNodes[t];"string"==typeof i?n.push(new G(i)):i instanceof G&&n.push(i)}return mt(t,e,i,new M,n)}function mt(t,e,i,n,s){let r="",o=!1;if(!Array.isArray(t)){if(null!=t){let i=t.toString();return i=vt(i,e),i}return""}for(let a=0;a<t.length;a++){const l=t[a],h=Et(l);if(void 0===h)continue;const p=xt(l[":@"],e);n.push(h,p);const u=wt(n,s);if(h===e.textNodeName){let t=l[h];u||(t=e.tagValueProcessor(h,t),t=vt(t,e)),o&&(r+=i),r+=t,o=!1,n.pop();continue}if(h===e.cdataPropName){o&&(r+=i),r+=`<![CDATA[${l[h][0][e.textNodeName]}]]>`,o=!1,n.pop();continue}if(h===e.commentPropName){r+=i+`\x3c!--${l[h][0][e.textNodeName]}--\x3e`,o=!0,n.pop();continue}if("?"===h[0]){const t=yt(l[":@"],e,u),s="?xml"===h?"":i;let a=l[h][0][e.textNodeName];a=0!==a.length?" "+a:"",r+=s+`<${h}${a}${t}?>`,o=!0,n.pop();continue}let c=i;""!==c&&(c+=e.indentBy);const d=i+`<${h}${yt(l[":@"],e,u)}`;let f;f=u?Nt(l[h],e):mt(l[h],e,c,n,s),-1!==e.unpairedTags.indexOf(h)?e.suppressUnpairedNode?r+=d+">":r+=d+"/>":f&&0!==f.length||!e.suppressEmptyNode?f&&f.endsWith(">")?r+=d+`>${f}${i}</${h}>`:(r+=d+">",f&&""!==i&&(f.includes("/>")||f.includes("</"))?r+=i+e.indentBy+f+i:r+=f,r+=`</${h}>`):r+=d+"/>",o=!0,n.pop()}return r}function xt(t,e){if(!t||e.ignoreAttributes)return null;const i={};let n=!1;for(let s in t)Object.prototype.hasOwnProperty.call(t,s)&&(i[s.startsWith(e.attributeNamePrefix)?s.substr(e.attributeNamePrefix.length):s]=t[s],n=!0);return n?i:null}function Nt(t,e){if(!Array.isArray(t))return null!=t?t.toString():"";let i="";for(let n=0;n<t.length;n++){const s=t[n],r=Et(s);if(r===e.textNodeName)i+=s[r];else if(r===e.cdataPropName)i+=s[r][0][e.textNodeName];else if(r===e.commentPropName)i+=s[r][0][e.textNodeName];else{if(r&&"?"===r[0])continue;if(r){const t=bt(s[":@"],e),n=Nt(s[r],e);n&&0!==n.length?i+=`<${r}${t}>${n}</${r}>`:i+=`<${r}${t}/>`}}}return i}function bt(t,e){let i="";if(t&&!e.ignoreAttributes)for(let n in t){if(!Object.prototype.hasOwnProperty.call(t,n))continue;let s=t[n];!0===s&&e.suppressBooleanAttributes?i+=` ${n.substr(e.attributeNamePrefix.length)}`:i+=` ${n.substr(e.attributeNamePrefix.length)}="${s}"`}return i}function Et(t){const e=Object.keys(t);for(let i=0;i<e.length;i++){const n=e[i];if(Object.prototype.hasOwnProperty.call(t,n)&&":@"!==n)return n}}function yt(t,e,i){let n="";if(t&&!e.ignoreAttributes)for(let s in t){if(!Object.prototype.hasOwnProperty.call(t,s))continue;let r;i?r=t[s]:(r=e.attributeValueProcessor(s,t[s]),r=vt(r,e)),!0===r&&e.suppressBooleanAttributes?n+=` ${s.substr(e.attributeNamePrefix.length)}`:n+=` ${s.substr(e.attributeNamePrefix.length)}="${r}"`}return n}function wt(t,e){if(!e||0===e.length)return!1;for(let i=0;i<e.length;i++)if(t.matches(e[i]))return!0;return!1}function vt(t,e){if(t&&t.length>0&&e.processEntities)for(let i=0;i<e.entities.length;i++){const n=e.entities[i];t=t.replace(n.regex,n.val)}return t}const Pt={attributeNamePrefix:"@_",attributesGroupName:!1,textNodeName:"#text",ignoreAttributes:!0,cdataPropName:!1,format:!1,indentBy:" ",suppressEmptyNode:!1,suppressUnpairedNode:!0,suppressBooleanAttributes:!0,tagValueProcessor:function(t,e){return e},attributeValueProcessor:function(t,e){return e},preserveOrder:!1,commentPropName:!1,unpairedTags:[],entities:[{regex:new RegExp("&","g"),val:"&"},{regex:new RegExp(">","g"),val:">"},{regex:new RegExp("<","g"),val:"<"},{regex:new RegExp("'","g"),val:"'"},{regex:new RegExp('"',"g"),val:"""}],processEntities:!0,stopNodes:[],oneListGroup:!1,jPath:!0};function Tt(t){if(this.options=Object.assign({},Pt,t),this.options.stopNodes&&Array.isArray(this.options.stopNodes)&&(this.options.stopNodes=this.options.stopNodes.map(t=>"string"==typeof t&&t.startsWith("*.")?".."+t.substring(2):t)),this.stopNodeExpressions=[],this.options.stopNodes&&Array.isArray(this.options.stopNodes))for(let t=0;t<this.options.stopNodes.length;t++){const e=this.options.stopNodes[t];"string"==typeof e?this.stopNodeExpressions.push(new G(e)):e instanceof G&&this.stopNodeExpressions.push(e)}var e;!0===this.options.ignoreAttributes||this.options.attributesGroupName?this.isAttribute=function(){return!1}:(this.ignoreAttributesFn="function"==typeof(e=this.options.ignoreAttributes)?e:Array.isArray(e)?t=>{for(const i of e){if("string"==typeof i&&t===i)return!0;if(i instanceof RegExp&&i.test(t))return!0}}:()=>!1,this.attrPrefixLen=this.options.attributeNamePrefix.length,this.isAttribute=Ot),this.processTextOrObjNode=St,this.options.format?(this.indentate=At,this.tagEndChar=">\n",this.newLine="\n"):(this.indentate=function(){return""},this.tagEndChar=">",this.newLine="")}function St(t,e,i,n){const s=this.extractAttributes(t);if(n.push(e,s),this.checkStopNode(n)){const s=this.buildRawContent(t),r=this.buildAttributesForStopNode(t);return n.pop(),this.buildObjectNode(s,e,r,i)}const r=this.j2x(t,i+1,n);return n.pop(),void 0!==t[this.options.textNodeName]&&1===Object.keys(t).length?this.buildTextValNode(t[this.options.textNodeName],e,r.attrStr,i,n):this.buildObjectNode(r.val,e,r.attrStr,i)}function At(t){return this.options.indentBy.repeat(t)}function Ot(t){return!(!t.startsWith(this.options.attributeNamePrefix)||t===this.options.textNodeName)&&t.substr(this.attrPrefixLen)}Tt.prototype.build=function(t){if(this.options.preserveOrder)return gt(t,this.options);{Array.isArray(t)&&this.options.arrayNodeName&&this.options.arrayNodeName.length>1&&(t={[this.options.arrayNodeName]:t});const e=new M;return this.j2x(t,0,e).val}},Tt.prototype.j2x=function(t,e,i){let n="",s="";const r=this.options.jPath?i.toString():i,o=this.checkStopNode(i);for(let a in t)if(Object.prototype.hasOwnProperty.call(t,a))if(void 0===t[a])this.isAttribute(a)&&(s+="");else if(null===t[a])this.isAttribute(a)||a===this.options.cdataPropName?s+="":"?"===a[0]?s+=this.indentate(e)+"<"+a+"?"+this.tagEndChar:s+=this.indentate(e)+"<"+a+"/"+this.tagEndChar;else if(t[a]instanceof Date)s+=this.buildTextValNode(t[a],a,"",e,i);else if("object"!=typeof t[a]){const l=this.isAttribute(a);if(l&&!this.ignoreAttributesFn(l,r))n+=this.buildAttrPairStr(l,""+t[a],o);else if(!l)if(a===this.options.textNodeName){let e=this.options.tagValueProcessor(a,""+t[a]);s+=this.replaceEntitiesValue(e)}else{i.push(a);const n=this.checkStopNode(i);if(i.pop(),n){const i=""+t[a];s+=""===i?this.indentate(e)+"<"+a+this.closeTag(a)+this.tagEndChar:this.indentate(e)+"<"+a+">"+i+"</"+a+this.tagEndChar}else s+=this.buildTextValNode(t[a],a,"",e,i)}}else if(Array.isArray(t[a])){const n=t[a].length;let r="",o="";for(let l=0;l<n;l++){const n=t[a][l];if(void 0===n);else if(null===n)"?"===a[0]?s+=this.indentate(e)+"<"+a+"?"+this.tagEndChar:s+=this.indentate(e)+"<"+a+"/"+this.tagEndChar;else if("object"==typeof n)if(this.options.oneListGroup){i.push(a);const t=this.j2x(n,e+1,i);i.pop(),r+=t.val,this.options.attributesGroupName&&n.hasOwnProperty(this.options.attributesGroupName)&&(o+=t.attrStr)}else r+=this.processTextOrObjNode(n,a,e,i);else if(this.options.oneListGroup){let t=this.options.tagValueProcessor(a,n);t=this.replaceEntitiesValue(t),r+=t}else{i.push(a);const t=this.checkStopNode(i);if(i.pop(),t){const t=""+n;r+=""===t?this.indentate(e)+"<"+a+this.closeTag(a)+this.tagEndChar:this.indentate(e)+"<"+a+">"+t+"</"+a+this.tagEndChar}else r+=this.buildTextValNode(n,a,"",e,i)}}this.options.oneListGroup&&(r=this.buildObjectNode(r,a,o,e)),s+=r}else if(this.options.attributesGroupName&&a===this.options.attributesGroupName){const e=Object.keys(t[a]),i=e.length;for(let s=0;s<i;s++)n+=this.buildAttrPairStr(e[s],""+t[a][e[s]],o)}else s+=this.processTextOrObjNode(t[a],a,e,i);return{attrStr:n,val:s}},Tt.prototype.buildAttrPairStr=function(t,e,i){return i||(e=this.options.attributeValueProcessor(t,""+e),e=this.replaceEntitiesValue(e)),this.options.suppressBooleanAttributes&&"true"===e?" "+t:" "+t+'="'+e+'"'},Tt.prototype.extractAttributes=function(t){if(!t||"object"!=typeof t)return null;const e={};let i=!1;if(this.options.attributesGroupName&&t[this.options.attributesGroupName]){const n=t[this.options.attributesGroupName];for(let t in n)Object.prototype.hasOwnProperty.call(n,t)&&(e[t.startsWith(this.options.attributeNamePrefix)?t.substring(this.options.attributeNamePrefix.length):t]=n[t],i=!0)}else for(let n in t){if(!Object.prototype.hasOwnProperty.call(t,n))continue;const s=this.isAttribute(n);s&&(e[s]=t[n],i=!0)}return i?e:null},Tt.prototype.buildRawContent=function(t){if("string"==typeof t)return t;if("object"!=typeof t||null===t)return String(t);if(void 0!==t[this.options.textNodeName])return t[this.options.textNodeName];let e="";for(let i in t){if(!Object.prototype.hasOwnProperty.call(t,i))continue;if(this.isAttribute(i))continue;if(this.options.attributesGroupName&&i===this.options.attributesGroupName)continue;const n=t[i];if(i===this.options.textNodeName)e+=n;else if(Array.isArray(n)){for(let t of n)if("string"==typeof t||"number"==typeof t)e+=`<${i}>${t}</${i}>`;else if("object"==typeof t&&null!==t){const n=this.buildRawContent(t),s=this.buildAttributesForStopNode(t);e+=""===n?`<${i}${s}/>`:`<${i}${s}>${n}</${i}>`}}else if("object"==typeof n&&null!==n){const t=this.buildRawContent(n),s=this.buildAttributesForStopNode(n);e+=""===t?`<${i}${s}/>`:`<${i}${s}>${t}</${i}>`}else e+=`<${i}>${n}</${i}>`}return e},Tt.prototype.buildAttributesForStopNode=function(t){if(!t||"object"!=typeof t)return"";let e="";if(this.options.attributesGroupName&&t[this.options.attributesGroupName]){const i=t[this.options.attributesGroupName];for(let t in i){if(!Object.prototype.hasOwnProperty.call(i,t))continue;const n=t.startsWith(this.options.attributeNamePrefix)?t.substring(this.options.attributeNamePrefix.length):t,s=i[t];!0===s&&this.options.suppressBooleanAttributes?e+=" "+n:e+=" "+n+'="'+s+'"'}}else for(let i in t){if(!Object.prototype.hasOwnProperty.call(t,i))continue;const n=this.isAttribute(i);if(n){const s=t[i];!0===s&&this.options.suppressBooleanAttributes?e+=" "+n:e+=" "+n+'="'+s+'"'}}return e},Tt.prototype.buildObjectNode=function(t,e,i,n){if(""===t)return"?"===e[0]?this.indentate(n)+"<"+e+i+"?"+this.tagEndChar:this.indentate(n)+"<"+e+i+this.closeTag(e)+this.tagEndChar;{let s="</"+e+this.tagEndChar,r="";return"?"===e[0]&&(r="?",s=""),!i&&""!==i||-1!==t.indexOf("<")?!1!==this.options.commentPropName&&e===this.options.commentPropName&&0===r.length?this.indentate(n)+`\x3c!--${t}--\x3e`+this.newLine:this.indentate(n)+"<"+e+i+r+this.tagEndChar+t+this.indentate(n)+s:this.indentate(n)+"<"+e+i+r+">"+t+s}},Tt.prototype.closeTag=function(t){let e="";return-1!==this.options.unpairedTags.indexOf(t)?this.options.suppressUnpairedNode||(e="/"):e=this.options.suppressEmptyNode?"/":`></${t}`,e},Tt.prototype.checkStopNode=function(t){if(!this.stopNodeExpressions||0===this.stopNodeExpressions.length)return!1;for(let e=0;e<this.stopNodeExpressions.length;e++)if(t.matches(this.stopNodeExpressions[e]))return!0;return!1},Tt.prototype.buildTextValNode=function(t,e,i,n,s){if(!1!==this.options.cdataPropName&&e===this.options.cdataPropName)return this.indentate(n)+`<![CDATA[${t}]]>`+this.newLine;if(!1!==this.options.commentPropName&&e===this.options.commentPropName)return this.indentate(n)+`\x3c!--${t}--\x3e`+this.newLine;if("?"===e[0])return this.indentate(n)+"<"+e+i+"?"+this.tagEndChar;{let s=this.options.tagValueProcessor(e,t);return s=this.replaceEntitiesValue(s),""===s?this.indentate(n)+"<"+e+i+this.closeTag(e)+this.tagEndChar:this.indentate(n)+"<"+e+i+">"+s+"</"+e+this.tagEndChar}},Tt.prototype.replaceEntitiesValue=function(t){if(t&&t.length>0&&this.options.processEntities)for(let e=0;e<this.options.entities.length;e++){const i=this.options.entities[e];t=t.replace(i.regex,i.val)}return t};const Ct=Tt,It={validate:h};module.exports=e})();
|
|
86323
86092
|
|
|
86324
86093
|
/***/ },
|
|
86325
86094
|
|
|
@@ -87761,6 +87530,284 @@ exports.GlobStream = GlobStream;
|
|
|
87761
87530
|
|
|
87762
87531
|
/***/ },
|
|
87763
87532
|
|
|
87533
|
+
/***/ "./node_modules/glob/node_modules/balanced-match/dist/commonjs/index.js"
|
|
87534
|
+
/*!******************************************************************************!*\
|
|
87535
|
+
!*** ./node_modules/glob/node_modules/balanced-match/dist/commonjs/index.js ***!
|
|
87536
|
+
\******************************************************************************/
|
|
87537
|
+
(__unused_webpack_module, exports) {
|
|
87538
|
+
|
|
87539
|
+
"use strict";
|
|
87540
|
+
|
|
87541
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
87542
|
+
exports.range = exports.balanced = void 0;
|
|
87543
|
+
const balanced = (a, b, str) => {
|
|
87544
|
+
const ma = a instanceof RegExp ? maybeMatch(a, str) : a;
|
|
87545
|
+
const mb = b instanceof RegExp ? maybeMatch(b, str) : b;
|
|
87546
|
+
const r = ma !== null && mb != null && (0, exports.range)(ma, mb, str);
|
|
87547
|
+
return (r && {
|
|
87548
|
+
start: r[0],
|
|
87549
|
+
end: r[1],
|
|
87550
|
+
pre: str.slice(0, r[0]),
|
|
87551
|
+
body: str.slice(r[0] + ma.length, r[1]),
|
|
87552
|
+
post: str.slice(r[1] + mb.length),
|
|
87553
|
+
});
|
|
87554
|
+
};
|
|
87555
|
+
exports.balanced = balanced;
|
|
87556
|
+
const maybeMatch = (reg, str) => {
|
|
87557
|
+
const m = str.match(reg);
|
|
87558
|
+
return m ? m[0] : null;
|
|
87559
|
+
};
|
|
87560
|
+
const range = (a, b, str) => {
|
|
87561
|
+
let begs, beg, left, right = undefined, result;
|
|
87562
|
+
let ai = str.indexOf(a);
|
|
87563
|
+
let bi = str.indexOf(b, ai + 1);
|
|
87564
|
+
let i = ai;
|
|
87565
|
+
if (ai >= 0 && bi > 0) {
|
|
87566
|
+
if (a === b) {
|
|
87567
|
+
return [ai, bi];
|
|
87568
|
+
}
|
|
87569
|
+
begs = [];
|
|
87570
|
+
left = str.length;
|
|
87571
|
+
while (i >= 0 && !result) {
|
|
87572
|
+
if (i === ai) {
|
|
87573
|
+
begs.push(i);
|
|
87574
|
+
ai = str.indexOf(a, i + 1);
|
|
87575
|
+
}
|
|
87576
|
+
else if (begs.length === 1) {
|
|
87577
|
+
const r = begs.pop();
|
|
87578
|
+
if (r !== undefined)
|
|
87579
|
+
result = [r, bi];
|
|
87580
|
+
}
|
|
87581
|
+
else {
|
|
87582
|
+
beg = begs.pop();
|
|
87583
|
+
if (beg !== undefined && beg < left) {
|
|
87584
|
+
left = beg;
|
|
87585
|
+
right = bi;
|
|
87586
|
+
}
|
|
87587
|
+
bi = str.indexOf(b, i + 1);
|
|
87588
|
+
}
|
|
87589
|
+
i = ai < bi && ai >= 0 ? ai : bi;
|
|
87590
|
+
}
|
|
87591
|
+
if (begs.length && right !== undefined) {
|
|
87592
|
+
result = [left, right];
|
|
87593
|
+
}
|
|
87594
|
+
}
|
|
87595
|
+
return result;
|
|
87596
|
+
};
|
|
87597
|
+
exports.range = range;
|
|
87598
|
+
//# sourceMappingURL=index.js.map
|
|
87599
|
+
|
|
87600
|
+
/***/ },
|
|
87601
|
+
|
|
87602
|
+
/***/ "./node_modules/glob/node_modules/brace-expansion/dist/commonjs/index.js"
|
|
87603
|
+
/*!*******************************************************************************!*\
|
|
87604
|
+
!*** ./node_modules/glob/node_modules/brace-expansion/dist/commonjs/index.js ***!
|
|
87605
|
+
\*******************************************************************************/
|
|
87606
|
+
(__unused_webpack_module, exports, __webpack_require__) {
|
|
87607
|
+
|
|
87608
|
+
"use strict";
|
|
87609
|
+
|
|
87610
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
87611
|
+
exports.EXPANSION_MAX = void 0;
|
|
87612
|
+
exports.expand = expand;
|
|
87613
|
+
const balanced_match_1 = __webpack_require__(/*! balanced-match */ "./node_modules/glob/node_modules/balanced-match/dist/commonjs/index.js");
|
|
87614
|
+
const escSlash = '\0SLASH' + Math.random() + '\0';
|
|
87615
|
+
const escOpen = '\0OPEN' + Math.random() + '\0';
|
|
87616
|
+
const escClose = '\0CLOSE' + Math.random() + '\0';
|
|
87617
|
+
const escComma = '\0COMMA' + Math.random() + '\0';
|
|
87618
|
+
const escPeriod = '\0PERIOD' + Math.random() + '\0';
|
|
87619
|
+
const escSlashPattern = new RegExp(escSlash, 'g');
|
|
87620
|
+
const escOpenPattern = new RegExp(escOpen, 'g');
|
|
87621
|
+
const escClosePattern = new RegExp(escClose, 'g');
|
|
87622
|
+
const escCommaPattern = new RegExp(escComma, 'g');
|
|
87623
|
+
const escPeriodPattern = new RegExp(escPeriod, 'g');
|
|
87624
|
+
const slashPattern = /\\\\/g;
|
|
87625
|
+
const openPattern = /\\{/g;
|
|
87626
|
+
const closePattern = /\\}/g;
|
|
87627
|
+
const commaPattern = /\\,/g;
|
|
87628
|
+
const periodPattern = /\\\./g;
|
|
87629
|
+
exports.EXPANSION_MAX = 100_000;
|
|
87630
|
+
function numeric(str) {
|
|
87631
|
+
return !isNaN(str) ? parseInt(str, 10) : str.charCodeAt(0);
|
|
87632
|
+
}
|
|
87633
|
+
function escapeBraces(str) {
|
|
87634
|
+
return str
|
|
87635
|
+
.replace(slashPattern, escSlash)
|
|
87636
|
+
.replace(openPattern, escOpen)
|
|
87637
|
+
.replace(closePattern, escClose)
|
|
87638
|
+
.replace(commaPattern, escComma)
|
|
87639
|
+
.replace(periodPattern, escPeriod);
|
|
87640
|
+
}
|
|
87641
|
+
function unescapeBraces(str) {
|
|
87642
|
+
return str
|
|
87643
|
+
.replace(escSlashPattern, '\\')
|
|
87644
|
+
.replace(escOpenPattern, '{')
|
|
87645
|
+
.replace(escClosePattern, '}')
|
|
87646
|
+
.replace(escCommaPattern, ',')
|
|
87647
|
+
.replace(escPeriodPattern, '.');
|
|
87648
|
+
}
|
|
87649
|
+
/**
|
|
87650
|
+
* Basically just str.split(","), but handling cases
|
|
87651
|
+
* where we have nested braced sections, which should be
|
|
87652
|
+
* treated as individual members, like {a,{b,c},d}
|
|
87653
|
+
*/
|
|
87654
|
+
function parseCommaParts(str) {
|
|
87655
|
+
if (!str) {
|
|
87656
|
+
return [''];
|
|
87657
|
+
}
|
|
87658
|
+
const parts = [];
|
|
87659
|
+
const m = (0, balanced_match_1.balanced)('{', '}', str);
|
|
87660
|
+
if (!m) {
|
|
87661
|
+
return str.split(',');
|
|
87662
|
+
}
|
|
87663
|
+
const { pre, body, post } = m;
|
|
87664
|
+
const p = pre.split(',');
|
|
87665
|
+
p[p.length - 1] += '{' + body + '}';
|
|
87666
|
+
const postParts = parseCommaParts(post);
|
|
87667
|
+
if (post.length) {
|
|
87668
|
+
;
|
|
87669
|
+
p[p.length - 1] += postParts.shift();
|
|
87670
|
+
p.push.apply(p, postParts);
|
|
87671
|
+
}
|
|
87672
|
+
parts.push.apply(parts, p);
|
|
87673
|
+
return parts;
|
|
87674
|
+
}
|
|
87675
|
+
function expand(str, options = {}) {
|
|
87676
|
+
if (!str) {
|
|
87677
|
+
return [];
|
|
87678
|
+
}
|
|
87679
|
+
const { max = exports.EXPANSION_MAX } = options;
|
|
87680
|
+
// I don't know why Bash 4.3 does this, but it does.
|
|
87681
|
+
// Anything starting with {} will have the first two bytes preserved
|
|
87682
|
+
// but *only* at the top level, so {},a}b will not expand to anything,
|
|
87683
|
+
// but a{},b}c will be expanded to [a}c,abc].
|
|
87684
|
+
// One could argue that this is a bug in Bash, but since the goal of
|
|
87685
|
+
// this module is to match Bash's rules, we escape a leading {}
|
|
87686
|
+
if (str.slice(0, 2) === '{}') {
|
|
87687
|
+
str = '\\{\\}' + str.slice(2);
|
|
87688
|
+
}
|
|
87689
|
+
return expand_(escapeBraces(str), max, true).map(unescapeBraces);
|
|
87690
|
+
}
|
|
87691
|
+
function embrace(str) {
|
|
87692
|
+
return '{' + str + '}';
|
|
87693
|
+
}
|
|
87694
|
+
function isPadded(el) {
|
|
87695
|
+
return /^-?0\d/.test(el);
|
|
87696
|
+
}
|
|
87697
|
+
function lte(i, y) {
|
|
87698
|
+
return i <= y;
|
|
87699
|
+
}
|
|
87700
|
+
function gte(i, y) {
|
|
87701
|
+
return i >= y;
|
|
87702
|
+
}
|
|
87703
|
+
function expand_(str, max, isTop) {
|
|
87704
|
+
/** @type {string[]} */
|
|
87705
|
+
const expansions = [];
|
|
87706
|
+
const m = (0, balanced_match_1.balanced)('{', '}', str);
|
|
87707
|
+
if (!m)
|
|
87708
|
+
return [str];
|
|
87709
|
+
// no need to expand pre, since it is guaranteed to be free of brace-sets
|
|
87710
|
+
const pre = m.pre;
|
|
87711
|
+
const post = m.post.length ? expand_(m.post, max, false) : [''];
|
|
87712
|
+
if (/\$$/.test(m.pre)) {
|
|
87713
|
+
for (let k = 0; k < post.length && k < max; k++) {
|
|
87714
|
+
const expansion = pre + '{' + m.body + '}' + post[k];
|
|
87715
|
+
expansions.push(expansion);
|
|
87716
|
+
}
|
|
87717
|
+
}
|
|
87718
|
+
else {
|
|
87719
|
+
const isNumericSequence = /^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(m.body);
|
|
87720
|
+
const isAlphaSequence = /^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(m.body);
|
|
87721
|
+
const isSequence = isNumericSequence || isAlphaSequence;
|
|
87722
|
+
const isOptions = m.body.indexOf(',') >= 0;
|
|
87723
|
+
if (!isSequence && !isOptions) {
|
|
87724
|
+
// {a},b}
|
|
87725
|
+
if (m.post.match(/,(?!,).*\}/)) {
|
|
87726
|
+
str = m.pre + '{' + m.body + escClose + m.post;
|
|
87727
|
+
return expand_(str, max, true);
|
|
87728
|
+
}
|
|
87729
|
+
return [str];
|
|
87730
|
+
}
|
|
87731
|
+
let n;
|
|
87732
|
+
if (isSequence) {
|
|
87733
|
+
n = m.body.split(/\.\./);
|
|
87734
|
+
}
|
|
87735
|
+
else {
|
|
87736
|
+
n = parseCommaParts(m.body);
|
|
87737
|
+
if (n.length === 1 && n[0] !== undefined) {
|
|
87738
|
+
// x{{a,b}}y ==> x{a}y x{b}y
|
|
87739
|
+
n = expand_(n[0], max, false).map(embrace);
|
|
87740
|
+
//XXX is this necessary? Can't seem to hit it in tests.
|
|
87741
|
+
/* c8 ignore start */
|
|
87742
|
+
if (n.length === 1) {
|
|
87743
|
+
return post.map(p => m.pre + n[0] + p);
|
|
87744
|
+
}
|
|
87745
|
+
/* c8 ignore stop */
|
|
87746
|
+
}
|
|
87747
|
+
}
|
|
87748
|
+
// at this point, n is the parts, and we know it's not a comma set
|
|
87749
|
+
// with a single entry.
|
|
87750
|
+
let N;
|
|
87751
|
+
if (isSequence && n[0] !== undefined && n[1] !== undefined) {
|
|
87752
|
+
const x = numeric(n[0]);
|
|
87753
|
+
const y = numeric(n[1]);
|
|
87754
|
+
const width = Math.max(n[0].length, n[1].length);
|
|
87755
|
+
let incr = n.length === 3 && n[2] !== undefined ? Math.abs(numeric(n[2])) : 1;
|
|
87756
|
+
let test = lte;
|
|
87757
|
+
const reverse = y < x;
|
|
87758
|
+
if (reverse) {
|
|
87759
|
+
incr *= -1;
|
|
87760
|
+
test = gte;
|
|
87761
|
+
}
|
|
87762
|
+
const pad = n.some(isPadded);
|
|
87763
|
+
N = [];
|
|
87764
|
+
for (let i = x; test(i, y); i += incr) {
|
|
87765
|
+
let c;
|
|
87766
|
+
if (isAlphaSequence) {
|
|
87767
|
+
c = String.fromCharCode(i);
|
|
87768
|
+
if (c === '\\') {
|
|
87769
|
+
c = '';
|
|
87770
|
+
}
|
|
87771
|
+
}
|
|
87772
|
+
else {
|
|
87773
|
+
c = String(i);
|
|
87774
|
+
if (pad) {
|
|
87775
|
+
const need = width - c.length;
|
|
87776
|
+
if (need > 0) {
|
|
87777
|
+
const z = new Array(need + 1).join('0');
|
|
87778
|
+
if (i < 0) {
|
|
87779
|
+
c = '-' + z + c.slice(1);
|
|
87780
|
+
}
|
|
87781
|
+
else {
|
|
87782
|
+
c = z + c;
|
|
87783
|
+
}
|
|
87784
|
+
}
|
|
87785
|
+
}
|
|
87786
|
+
}
|
|
87787
|
+
N.push(c);
|
|
87788
|
+
}
|
|
87789
|
+
}
|
|
87790
|
+
else {
|
|
87791
|
+
N = [];
|
|
87792
|
+
for (let j = 0; j < n.length; j++) {
|
|
87793
|
+
N.push.apply(N, expand_(n[j], max, false));
|
|
87794
|
+
}
|
|
87795
|
+
}
|
|
87796
|
+
for (let j = 0; j < N.length; j++) {
|
|
87797
|
+
for (let k = 0; k < post.length && expansions.length < max; k++) {
|
|
87798
|
+
const expansion = pre + N[j] + post[k];
|
|
87799
|
+
if (!isTop || isSequence || expansion) {
|
|
87800
|
+
expansions.push(expansion);
|
|
87801
|
+
}
|
|
87802
|
+
}
|
|
87803
|
+
}
|
|
87804
|
+
}
|
|
87805
|
+
return expansions;
|
|
87806
|
+
}
|
|
87807
|
+
//# sourceMappingURL=index.js.map
|
|
87808
|
+
|
|
87809
|
+
/***/ },
|
|
87810
|
+
|
|
87764
87811
|
/***/ "./node_modules/glob/node_modules/lru-cache/dist/commonjs/index.js"
|
|
87765
87812
|
/*!*************************************************************************!*\
|
|
87766
87813
|
!*** ./node_modules/glob/node_modules/lru-cache/dist/commonjs/index.js ***!
|
|
@@ -89368,12 +89415,114 @@ exports.assertValidPattern = assertValidPattern;
|
|
|
89368
89415
|
"use strict";
|
|
89369
89416
|
|
|
89370
89417
|
// parse a single path portion
|
|
89418
|
+
var _a;
|
|
89371
89419
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
89372
89420
|
exports.AST = void 0;
|
|
89373
89421
|
const brace_expressions_js_1 = __webpack_require__(/*! ./brace-expressions.js */ "./node_modules/glob/node_modules/minimatch/dist/commonjs/brace-expressions.js");
|
|
89374
89422
|
const unescape_js_1 = __webpack_require__(/*! ./unescape.js */ "./node_modules/glob/node_modules/minimatch/dist/commonjs/unescape.js");
|
|
89375
89423
|
const types = new Set(['!', '?', '+', '*', '@']);
|
|
89376
89424
|
const isExtglobType = (c) => types.has(c);
|
|
89425
|
+
const isExtglobAST = (c) => isExtglobType(c.type);
|
|
89426
|
+
// Map of which extglob types can adopt the children of a nested extglob
|
|
89427
|
+
//
|
|
89428
|
+
// anything but ! can adopt a matching type:
|
|
89429
|
+
// +(a|+(b|c)|d) => +(a|b|c|d)
|
|
89430
|
+
// *(a|*(b|c)|d) => *(a|b|c|d)
|
|
89431
|
+
// @(a|@(b|c)|d) => @(a|b|c|d)
|
|
89432
|
+
// ?(a|?(b|c)|d) => ?(a|b|c|d)
|
|
89433
|
+
//
|
|
89434
|
+
// * can adopt anything, because 0 or repetition is allowed
|
|
89435
|
+
// *(a|?(b|c)|d) => *(a|b|c|d)
|
|
89436
|
+
// *(a|+(b|c)|d) => *(a|b|c|d)
|
|
89437
|
+
// *(a|@(b|c)|d) => *(a|b|c|d)
|
|
89438
|
+
//
|
|
89439
|
+
// + can adopt @, because 1 or repetition is allowed
|
|
89440
|
+
// +(a|@(b|c)|d) => +(a|b|c|d)
|
|
89441
|
+
//
|
|
89442
|
+
// + and @ CANNOT adopt *, because 0 would be allowed
|
|
89443
|
+
// +(a|*(b|c)|d) => would match "", on *(b|c)
|
|
89444
|
+
// @(a|*(b|c)|d) => would match "", on *(b|c)
|
|
89445
|
+
//
|
|
89446
|
+
// + and @ CANNOT adopt ?, because 0 would be allowed
|
|
89447
|
+
// +(a|?(b|c)|d) => would match "", on ?(b|c)
|
|
89448
|
+
// @(a|?(b|c)|d) => would match "", on ?(b|c)
|
|
89449
|
+
//
|
|
89450
|
+
// ? can adopt @, because 0 or 1 is allowed
|
|
89451
|
+
// ?(a|@(b|c)|d) => ?(a|b|c|d)
|
|
89452
|
+
//
|
|
89453
|
+
// ? and @ CANNOT adopt * or +, because >1 would be allowed
|
|
89454
|
+
// ?(a|*(b|c)|d) => would match bbb on *(b|c)
|
|
89455
|
+
// @(a|*(b|c)|d) => would match bbb on *(b|c)
|
|
89456
|
+
// ?(a|+(b|c)|d) => would match bbb on +(b|c)
|
|
89457
|
+
// @(a|+(b|c)|d) => would match bbb on +(b|c)
|
|
89458
|
+
//
|
|
89459
|
+
// ! CANNOT adopt ! (nothing else can either)
|
|
89460
|
+
// !(a|!(b|c)|d) => !(a|b|c|d) would fail to match on b (not not b|c)
|
|
89461
|
+
//
|
|
89462
|
+
// ! can adopt @
|
|
89463
|
+
// !(a|@(b|c)|d) => !(a|b|c|d)
|
|
89464
|
+
//
|
|
89465
|
+
// ! CANNOT adopt *
|
|
89466
|
+
// !(a|*(b|c)|d) => !(a|b|c|d) would match on bbb, not allowed
|
|
89467
|
+
//
|
|
89468
|
+
// ! CANNOT adopt +
|
|
89469
|
+
// !(a|+(b|c)|d) => !(a|b|c|d) would match on bbb, not allowed
|
|
89470
|
+
//
|
|
89471
|
+
// ! CANNOT adopt ?
|
|
89472
|
+
// x!(a|?(b|c)|d) => x!(a|b|c|d) would fail to match "x"
|
|
89473
|
+
const adoptionMap = new Map([
|
|
89474
|
+
['!', ['@']],
|
|
89475
|
+
['?', ['?', '@']],
|
|
89476
|
+
['@', ['@']],
|
|
89477
|
+
['*', ['*', '+', '?', '@']],
|
|
89478
|
+
['+', ['+', '@']],
|
|
89479
|
+
]);
|
|
89480
|
+
// nested extglobs that can be adopted in, but with the addition of
|
|
89481
|
+
// a blank '' element.
|
|
89482
|
+
const adoptionWithSpaceMap = new Map([
|
|
89483
|
+
['!', ['?']],
|
|
89484
|
+
['@', ['?']],
|
|
89485
|
+
['+', ['?', '*']],
|
|
89486
|
+
]);
|
|
89487
|
+
// union of the previous two maps
|
|
89488
|
+
const adoptionAnyMap = new Map([
|
|
89489
|
+
['!', ['?', '@']],
|
|
89490
|
+
['?', ['?', '@']],
|
|
89491
|
+
['@', ['?', '@']],
|
|
89492
|
+
['*', ['*', '+', '?', '@']],
|
|
89493
|
+
['+', ['+', '@', '?', '*']],
|
|
89494
|
+
]);
|
|
89495
|
+
// Extglobs that can take over their parent if they are the only child
|
|
89496
|
+
// the key is parent, value maps child to resulting extglob parent type
|
|
89497
|
+
// '@' is omitted because it's a special case. An `@` extglob with a single
|
|
89498
|
+
// member can always be usurped by that subpattern.
|
|
89499
|
+
const usurpMap = new Map([
|
|
89500
|
+
['!', new Map([['!', '@']])],
|
|
89501
|
+
[
|
|
89502
|
+
'?',
|
|
89503
|
+
new Map([
|
|
89504
|
+
['*', '*'],
|
|
89505
|
+
['+', '*'],
|
|
89506
|
+
]),
|
|
89507
|
+
],
|
|
89508
|
+
[
|
|
89509
|
+
'@',
|
|
89510
|
+
new Map([
|
|
89511
|
+
['!', '!'],
|
|
89512
|
+
['?', '?'],
|
|
89513
|
+
['@', '@'],
|
|
89514
|
+
['*', '*'],
|
|
89515
|
+
['+', '+'],
|
|
89516
|
+
]),
|
|
89517
|
+
],
|
|
89518
|
+
[
|
|
89519
|
+
'+',
|
|
89520
|
+
new Map([
|
|
89521
|
+
['?', '*'],
|
|
89522
|
+
['*', '*'],
|
|
89523
|
+
]),
|
|
89524
|
+
],
|
|
89525
|
+
]);
|
|
89377
89526
|
// Patterns that get prepended to bind to the start of either the
|
|
89378
89527
|
// entire string, or just a single path portion, to prevent dots
|
|
89379
89528
|
// and/or traversal patterns, when needed.
|
|
@@ -89397,6 +89546,7 @@ const star = qmark + '*?';
|
|
|
89397
89546
|
const starNoEmpty = qmark + '+?';
|
|
89398
89547
|
// remove the \ chars that we added if we end up doing a nonmagic compare
|
|
89399
89548
|
// const deslash = (s: string) => s.replace(/\\(.)/g, '$1')
|
|
89549
|
+
let ID = 0;
|
|
89400
89550
|
class AST {
|
|
89401
89551
|
type;
|
|
89402
89552
|
#root;
|
|
@@ -89412,6 +89562,22 @@ class AST {
|
|
|
89412
89562
|
// set to true if it's an extglob with no children
|
|
89413
89563
|
// (which really means one child of '')
|
|
89414
89564
|
#emptyExt = false;
|
|
89565
|
+
id = ++ID;
|
|
89566
|
+
get depth() {
|
|
89567
|
+
return (this.#parent?.depth ?? -1) + 1;
|
|
89568
|
+
}
|
|
89569
|
+
[Symbol.for('nodejs.util.inspect.custom')]() {
|
|
89570
|
+
return {
|
|
89571
|
+
'@@type': 'AST',
|
|
89572
|
+
id: this.id,
|
|
89573
|
+
type: this.type,
|
|
89574
|
+
root: this.#root.id,
|
|
89575
|
+
parent: this.#parent?.id,
|
|
89576
|
+
depth: this.depth,
|
|
89577
|
+
partsLength: this.#parts.length,
|
|
89578
|
+
parts: this.#parts,
|
|
89579
|
+
};
|
|
89580
|
+
}
|
|
89415
89581
|
constructor(type, parent, options = {}) {
|
|
89416
89582
|
this.type = type;
|
|
89417
89583
|
// extglobs are inherently magical
|
|
@@ -89490,7 +89656,8 @@ class AST {
|
|
|
89490
89656
|
if (p === '')
|
|
89491
89657
|
continue;
|
|
89492
89658
|
/* c8 ignore start */
|
|
89493
|
-
if (typeof p !== 'string' &&
|
|
89659
|
+
if (typeof p !== 'string' &&
|
|
89660
|
+
!(p instanceof _a && p.#parent === this)) {
|
|
89494
89661
|
throw new Error('invalid part: ' + p);
|
|
89495
89662
|
}
|
|
89496
89663
|
/* c8 ignore stop */
|
|
@@ -89498,8 +89665,10 @@ class AST {
|
|
|
89498
89665
|
}
|
|
89499
89666
|
}
|
|
89500
89667
|
toJSON() {
|
|
89501
|
-
const ret = this.type === null
|
|
89502
|
-
|
|
89668
|
+
const ret = this.type === null ?
|
|
89669
|
+
this.#parts
|
|
89670
|
+
.slice()
|
|
89671
|
+
.map(p => (typeof p === 'string' ? p : p.toJSON()))
|
|
89503
89672
|
: [this.type, ...this.#parts.map(p => p.toJSON())];
|
|
89504
89673
|
if (this.isStart() && !this.type)
|
|
89505
89674
|
ret.unshift([]);
|
|
@@ -89522,7 +89691,7 @@ class AST {
|
|
|
89522
89691
|
const p = this.#parent;
|
|
89523
89692
|
for (let i = 0; i < this.#parentIndex; i++) {
|
|
89524
89693
|
const pp = p.#parts[i];
|
|
89525
|
-
if (!(pp instanceof
|
|
89694
|
+
if (!(pp instanceof _a && pp.type === '!')) {
|
|
89526
89695
|
return false;
|
|
89527
89696
|
}
|
|
89528
89697
|
}
|
|
@@ -89550,13 +89719,14 @@ class AST {
|
|
|
89550
89719
|
this.push(part.clone(this));
|
|
89551
89720
|
}
|
|
89552
89721
|
clone(parent) {
|
|
89553
|
-
const c = new
|
|
89722
|
+
const c = new _a(this.type, parent);
|
|
89554
89723
|
for (const p of this.#parts) {
|
|
89555
89724
|
c.copyIn(p);
|
|
89556
89725
|
}
|
|
89557
89726
|
return c;
|
|
89558
89727
|
}
|
|
89559
|
-
static #parseAST(str, ast, pos, opt) {
|
|
89728
|
+
static #parseAST(str, ast, pos, opt, extDepth) {
|
|
89729
|
+
const maxDepth = opt.maxExtglobRecursion ?? 2;
|
|
89560
89730
|
let escaping = false;
|
|
89561
89731
|
let inBrace = false;
|
|
89562
89732
|
let braceStart = -1;
|
|
@@ -89593,11 +89763,17 @@ class AST {
|
|
|
89593
89763
|
acc += c;
|
|
89594
89764
|
continue;
|
|
89595
89765
|
}
|
|
89596
|
-
|
|
89766
|
+
// we don't have to check for adoption here, because that's
|
|
89767
|
+
// done at the other recursion point.
|
|
89768
|
+
const doRecurse = !opt.noext &&
|
|
89769
|
+
isExtglobType(c) &&
|
|
89770
|
+
str.charAt(i) === '(' &&
|
|
89771
|
+
extDepth <= maxDepth;
|
|
89772
|
+
if (doRecurse) {
|
|
89597
89773
|
ast.push(acc);
|
|
89598
89774
|
acc = '';
|
|
89599
|
-
const ext = new
|
|
89600
|
-
i =
|
|
89775
|
+
const ext = new _a(c, ast);
|
|
89776
|
+
i = _a.#parseAST(str, ext, i, opt, extDepth + 1);
|
|
89601
89777
|
ast.push(ext);
|
|
89602
89778
|
continue;
|
|
89603
89779
|
}
|
|
@@ -89609,7 +89785,7 @@ class AST {
|
|
|
89609
89785
|
// some kind of extglob, pos is at the (
|
|
89610
89786
|
// find the next | or )
|
|
89611
89787
|
let i = pos + 1;
|
|
89612
|
-
let part = new
|
|
89788
|
+
let part = new _a(null, ast);
|
|
89613
89789
|
const parts = [];
|
|
89614
89790
|
let acc = '';
|
|
89615
89791
|
while (i < str.length) {
|
|
@@ -89640,19 +89816,26 @@ class AST {
|
|
|
89640
89816
|
acc += c;
|
|
89641
89817
|
continue;
|
|
89642
89818
|
}
|
|
89643
|
-
|
|
89819
|
+
const doRecurse = !opt.noext &&
|
|
89820
|
+
isExtglobType(c) &&
|
|
89821
|
+
str.charAt(i) === '(' &&
|
|
89822
|
+
/* c8 ignore start - the maxDepth is sufficient here */
|
|
89823
|
+
(extDepth <= maxDepth || (ast && ast.#canAdoptType(c)));
|
|
89824
|
+
/* c8 ignore stop */
|
|
89825
|
+
if (doRecurse) {
|
|
89826
|
+
const depthAdd = ast && ast.#canAdoptType(c) ? 0 : 1;
|
|
89644
89827
|
part.push(acc);
|
|
89645
89828
|
acc = '';
|
|
89646
|
-
const ext = new
|
|
89829
|
+
const ext = new _a(c, part);
|
|
89647
89830
|
part.push(ext);
|
|
89648
|
-
i =
|
|
89831
|
+
i = _a.#parseAST(str, ext, i, opt, extDepth + depthAdd);
|
|
89649
89832
|
continue;
|
|
89650
89833
|
}
|
|
89651
89834
|
if (c === '|') {
|
|
89652
89835
|
part.push(acc);
|
|
89653
89836
|
acc = '';
|
|
89654
89837
|
parts.push(part);
|
|
89655
|
-
part = new
|
|
89838
|
+
part = new _a(null, ast);
|
|
89656
89839
|
continue;
|
|
89657
89840
|
}
|
|
89658
89841
|
if (c === ')') {
|
|
@@ -89674,9 +89857,82 @@ class AST {
|
|
|
89674
89857
|
ast.#parts = [str.substring(pos - 1)];
|
|
89675
89858
|
return i;
|
|
89676
89859
|
}
|
|
89860
|
+
#canAdoptWithSpace(child) {
|
|
89861
|
+
return this.#canAdopt(child, adoptionWithSpaceMap);
|
|
89862
|
+
}
|
|
89863
|
+
#canAdopt(child, map = adoptionMap) {
|
|
89864
|
+
if (!child ||
|
|
89865
|
+
typeof child !== 'object' ||
|
|
89866
|
+
child.type !== null ||
|
|
89867
|
+
child.#parts.length !== 1 ||
|
|
89868
|
+
this.type === null) {
|
|
89869
|
+
return false;
|
|
89870
|
+
}
|
|
89871
|
+
const gc = child.#parts[0];
|
|
89872
|
+
if (!gc || typeof gc !== 'object' || gc.type === null) {
|
|
89873
|
+
return false;
|
|
89874
|
+
}
|
|
89875
|
+
return this.#canAdoptType(gc.type, map);
|
|
89876
|
+
}
|
|
89877
|
+
#canAdoptType(c, map = adoptionAnyMap) {
|
|
89878
|
+
return !!map.get(this.type)?.includes(c);
|
|
89879
|
+
}
|
|
89880
|
+
#adoptWithSpace(child, index) {
|
|
89881
|
+
const gc = child.#parts[0];
|
|
89882
|
+
const blank = new _a(null, gc, this.options);
|
|
89883
|
+
blank.#parts.push('');
|
|
89884
|
+
gc.push(blank);
|
|
89885
|
+
this.#adopt(child, index);
|
|
89886
|
+
}
|
|
89887
|
+
#adopt(child, index) {
|
|
89888
|
+
const gc = child.#parts[0];
|
|
89889
|
+
this.#parts.splice(index, 1, ...gc.#parts);
|
|
89890
|
+
for (const p of gc.#parts) {
|
|
89891
|
+
if (typeof p === 'object')
|
|
89892
|
+
p.#parent = this;
|
|
89893
|
+
}
|
|
89894
|
+
this.#toString = undefined;
|
|
89895
|
+
}
|
|
89896
|
+
#canUsurpType(c) {
|
|
89897
|
+
const m = usurpMap.get(this.type);
|
|
89898
|
+
return !!(m?.has(c));
|
|
89899
|
+
}
|
|
89900
|
+
#canUsurp(child) {
|
|
89901
|
+
if (!child ||
|
|
89902
|
+
typeof child !== 'object' ||
|
|
89903
|
+
child.type !== null ||
|
|
89904
|
+
child.#parts.length !== 1 ||
|
|
89905
|
+
this.type === null ||
|
|
89906
|
+
this.#parts.length !== 1) {
|
|
89907
|
+
return false;
|
|
89908
|
+
}
|
|
89909
|
+
const gc = child.#parts[0];
|
|
89910
|
+
if (!gc || typeof gc !== 'object' || gc.type === null) {
|
|
89911
|
+
return false;
|
|
89912
|
+
}
|
|
89913
|
+
return this.#canUsurpType(gc.type);
|
|
89914
|
+
}
|
|
89915
|
+
#usurp(child) {
|
|
89916
|
+
const m = usurpMap.get(this.type);
|
|
89917
|
+
const gc = child.#parts[0];
|
|
89918
|
+
const nt = m?.get(gc.type);
|
|
89919
|
+
/* c8 ignore start - impossible */
|
|
89920
|
+
if (!nt)
|
|
89921
|
+
return false;
|
|
89922
|
+
/* c8 ignore stop */
|
|
89923
|
+
this.#parts = gc.#parts;
|
|
89924
|
+
for (const p of this.#parts) {
|
|
89925
|
+
if (typeof p === 'object') {
|
|
89926
|
+
p.#parent = this;
|
|
89927
|
+
}
|
|
89928
|
+
}
|
|
89929
|
+
this.type = nt;
|
|
89930
|
+
this.#toString = undefined;
|
|
89931
|
+
this.#emptyExt = false;
|
|
89932
|
+
}
|
|
89677
89933
|
static fromGlob(pattern, options = {}) {
|
|
89678
|
-
const ast = new
|
|
89679
|
-
|
|
89934
|
+
const ast = new _a(null, undefined, options);
|
|
89935
|
+
_a.#parseAST(pattern, ast, 0, options, 0);
|
|
89680
89936
|
return ast;
|
|
89681
89937
|
}
|
|
89682
89938
|
// returns the regular expression if there's magic, or the unescaped
|
|
@@ -89780,14 +90036,18 @@ class AST {
|
|
|
89780
90036
|
// or start or whatever) and prepend ^ or / at the Regexp construction.
|
|
89781
90037
|
toRegExpSource(allowDot) {
|
|
89782
90038
|
const dot = allowDot ?? !!this.#options.dot;
|
|
89783
|
-
if (this.#root === this)
|
|
90039
|
+
if (this.#root === this) {
|
|
90040
|
+
this.#flatten();
|
|
89784
90041
|
this.#fillNegs();
|
|
89785
|
-
|
|
89786
|
-
|
|
90042
|
+
}
|
|
90043
|
+
if (!isExtglobAST(this)) {
|
|
90044
|
+
const noEmpty = this.isStart() &&
|
|
90045
|
+
this.isEnd() &&
|
|
90046
|
+
!this.#parts.some(s => typeof s !== 'string');
|
|
89787
90047
|
const src = this.#parts
|
|
89788
90048
|
.map(p => {
|
|
89789
|
-
const [re, _, hasMagic, uflag] = typeof p === 'string'
|
|
89790
|
-
|
|
90049
|
+
const [re, _, hasMagic, uflag] = typeof p === 'string' ?
|
|
90050
|
+
_a.#parseGlob(p, this.#hasMagic, noEmpty)
|
|
89791
90051
|
: p.toRegExpSource(allowDot);
|
|
89792
90052
|
this.#hasMagic = this.#hasMagic || hasMagic;
|
|
89793
90053
|
this.#uflag = this.#uflag || uflag;
|
|
@@ -89816,7 +90076,10 @@ class AST {
|
|
|
89816
90076
|
// no need to prevent dots if it can't match a dot, or if a
|
|
89817
90077
|
// sub-pattern will be preventing it anyway.
|
|
89818
90078
|
const needNoDot = !dot && !allowDot && aps.has(src.charAt(0));
|
|
89819
|
-
start =
|
|
90079
|
+
start =
|
|
90080
|
+
needNoTrav ? startNoTraversal
|
|
90081
|
+
: needNoDot ? startNoDot
|
|
90082
|
+
: '';
|
|
89820
90083
|
}
|
|
89821
90084
|
}
|
|
89822
90085
|
}
|
|
@@ -89846,14 +90109,14 @@ class AST {
|
|
|
89846
90109
|
// invalid extglob, has to at least be *something* present, if it's
|
|
89847
90110
|
// the entire path portion.
|
|
89848
90111
|
const s = this.toString();
|
|
89849
|
-
|
|
89850
|
-
|
|
89851
|
-
|
|
90112
|
+
const me = this;
|
|
90113
|
+
me.#parts = [s];
|
|
90114
|
+
me.type = null;
|
|
90115
|
+
me.#hasMagic = undefined;
|
|
89852
90116
|
return [s, (0, unescape_js_1.unescape)(this.toString()), false, false];
|
|
89853
90117
|
}
|
|
89854
|
-
|
|
89855
|
-
|
|
89856
|
-
? ''
|
|
90118
|
+
let bodyDotAllowed = !repeated || allowDot || dot || !startNoDot ?
|
|
90119
|
+
''
|
|
89857
90120
|
: this.#partsToRegExp(true);
|
|
89858
90121
|
if (bodyDotAllowed === body) {
|
|
89859
90122
|
bodyDotAllowed = '';
|
|
@@ -89867,20 +90130,16 @@ class AST {
|
|
|
89867
90130
|
final = (this.isStart() && !dot ? startNoDot : '') + starNoEmpty;
|
|
89868
90131
|
}
|
|
89869
90132
|
else {
|
|
89870
|
-
const close = this.type === '!'
|
|
89871
|
-
|
|
89872
|
-
|
|
89873
|
-
|
|
89874
|
-
|
|
89875
|
-
|
|
89876
|
-
: this.type === '@'
|
|
89877
|
-
? ')'
|
|
89878
|
-
|
|
89879
|
-
|
|
89880
|
-
: this.type === '+' && bodyDotAllowed
|
|
89881
|
-
? ')'
|
|
89882
|
-
: this.type === '*' && bodyDotAllowed
|
|
89883
|
-
? `)?`
|
|
90133
|
+
const close = this.type === '!' ?
|
|
90134
|
+
// !() must match something,but !(x) can match ''
|
|
90135
|
+
'))' +
|
|
90136
|
+
(this.isStart() && !dot && !allowDot ? startNoDot : '') +
|
|
90137
|
+
star +
|
|
90138
|
+
')'
|
|
90139
|
+
: this.type === '@' ? ')'
|
|
90140
|
+
: this.type === '?' ? ')?'
|
|
90141
|
+
: this.type === '+' && bodyDotAllowed ? ')'
|
|
90142
|
+
: this.type === '*' && bodyDotAllowed ? `)?`
|
|
89884
90143
|
: `)${this.type}`;
|
|
89885
90144
|
final = start + body + close;
|
|
89886
90145
|
}
|
|
@@ -89891,6 +90150,42 @@ class AST {
|
|
|
89891
90150
|
this.#uflag,
|
|
89892
90151
|
];
|
|
89893
90152
|
}
|
|
90153
|
+
#flatten() {
|
|
90154
|
+
if (!isExtglobAST(this)) {
|
|
90155
|
+
for (const p of this.#parts) {
|
|
90156
|
+
if (typeof p === 'object') {
|
|
90157
|
+
p.#flatten();
|
|
90158
|
+
}
|
|
90159
|
+
}
|
|
90160
|
+
}
|
|
90161
|
+
else {
|
|
90162
|
+
// do up to 10 passes to flatten as much as possible
|
|
90163
|
+
let iterations = 0;
|
|
90164
|
+
let done = false;
|
|
90165
|
+
do {
|
|
90166
|
+
done = true;
|
|
90167
|
+
for (let i = 0; i < this.#parts.length; i++) {
|
|
90168
|
+
const c = this.#parts[i];
|
|
90169
|
+
if (typeof c === 'object') {
|
|
90170
|
+
c.#flatten();
|
|
90171
|
+
if (this.#canAdopt(c)) {
|
|
90172
|
+
done = false;
|
|
90173
|
+
this.#adopt(c, i);
|
|
90174
|
+
}
|
|
90175
|
+
else if (this.#canAdoptWithSpace(c)) {
|
|
90176
|
+
done = false;
|
|
90177
|
+
this.#adoptWithSpace(c, i);
|
|
90178
|
+
}
|
|
90179
|
+
else if (this.#canUsurp(c)) {
|
|
90180
|
+
done = false;
|
|
90181
|
+
this.#usurp(c);
|
|
90182
|
+
}
|
|
90183
|
+
}
|
|
90184
|
+
}
|
|
90185
|
+
} while (!done && ++iterations < 10);
|
|
90186
|
+
}
|
|
90187
|
+
this.#toString = undefined;
|
|
90188
|
+
}
|
|
89894
90189
|
#partsToRegExp(dot) {
|
|
89895
90190
|
return this.#parts
|
|
89896
90191
|
.map(p => {
|
|
@@ -89912,6 +90207,8 @@ class AST {
|
|
|
89912
90207
|
let escaping = false;
|
|
89913
90208
|
let re = '';
|
|
89914
90209
|
let uflag = false;
|
|
90210
|
+
// multiple stars that aren't globstars coalesce into one *
|
|
90211
|
+
let inStar = false;
|
|
89915
90212
|
for (let i = 0; i < glob.length; i++) {
|
|
89916
90213
|
const c = glob.charAt(i);
|
|
89917
90214
|
if (escaping) {
|
|
@@ -89919,6 +90216,17 @@ class AST {
|
|
|
89919
90216
|
re += (reSpecials.has(c) ? '\\' : '') + c;
|
|
89920
90217
|
continue;
|
|
89921
90218
|
}
|
|
90219
|
+
if (c === '*') {
|
|
90220
|
+
if (inStar)
|
|
90221
|
+
continue;
|
|
90222
|
+
inStar = true;
|
|
90223
|
+
re += noEmpty && /^[*]+$/.test(glob) ? starNoEmpty : star;
|
|
90224
|
+
hasMagic = true;
|
|
90225
|
+
continue;
|
|
90226
|
+
}
|
|
90227
|
+
else {
|
|
90228
|
+
inStar = false;
|
|
90229
|
+
}
|
|
89922
90230
|
if (c === '\\') {
|
|
89923
90231
|
if (i === glob.length - 1) {
|
|
89924
90232
|
re += '\\\\';
|
|
@@ -89938,14 +90246,6 @@ class AST {
|
|
|
89938
90246
|
continue;
|
|
89939
90247
|
}
|
|
89940
90248
|
}
|
|
89941
|
-
if (c === '*') {
|
|
89942
|
-
if (noEmpty && glob === '*')
|
|
89943
|
-
re += starNoEmpty;
|
|
89944
|
-
else
|
|
89945
|
-
re += star;
|
|
89946
|
-
hasMagic = true;
|
|
89947
|
-
continue;
|
|
89948
|
-
}
|
|
89949
90249
|
if (c === '?') {
|
|
89950
90250
|
re += qmark;
|
|
89951
90251
|
hasMagic = true;
|
|
@@ -89957,6 +90257,7 @@ class AST {
|
|
|
89957
90257
|
}
|
|
89958
90258
|
}
|
|
89959
90259
|
exports.AST = AST;
|
|
90260
|
+
_a = AST;
|
|
89960
90261
|
//# sourceMappingURL=ast.js.map
|
|
89961
90262
|
|
|
89962
90263
|
/***/ },
|
|
@@ -90111,10 +90412,8 @@ const parseClass = (glob, position) => {
|
|
|
90111
90412
|
}
|
|
90112
90413
|
const sranges = '[' + (negate ? '^' : '') + rangesToString(ranges) + ']';
|
|
90113
90414
|
const snegs = '[' + (negate ? '' : '^') + rangesToString(negs) + ']';
|
|
90114
|
-
const comb = ranges.length && negs.length
|
|
90115
|
-
|
|
90116
|
-
: ranges.length
|
|
90117
|
-
? sranges
|
|
90415
|
+
const comb = ranges.length && negs.length ? '(' + sranges + '|' + snegs + ')'
|
|
90416
|
+
: ranges.length ? sranges
|
|
90118
90417
|
: snegs;
|
|
90119
90418
|
return [comb, uflag, endPos - pos, true];
|
|
90120
90419
|
};
|
|
@@ -90136,18 +90435,26 @@ exports.escape = void 0;
|
|
|
90136
90435
|
/**
|
|
90137
90436
|
* Escape all magic characters in a glob pattern.
|
|
90138
90437
|
*
|
|
90139
|
-
* If the {@link
|
|
90438
|
+
* If the {@link MinimatchOptions.windowsPathsNoEscape}
|
|
90140
90439
|
* option is used, then characters are escaped by wrapping in `[]`, because
|
|
90141
90440
|
* a magic character wrapped in a character class can only be satisfied by
|
|
90142
90441
|
* that exact character. In this mode, `\` is _not_ escaped, because it is
|
|
90143
90442
|
* not interpreted as a magic character, but instead as a path separator.
|
|
90443
|
+
*
|
|
90444
|
+
* If the {@link MinimatchOptions.magicalBraces} option is used,
|
|
90445
|
+
* then braces (`{` and `}`) will be escaped.
|
|
90144
90446
|
*/
|
|
90145
|
-
const escape = (s, { windowsPathsNoEscape = false, } = {}) => {
|
|
90447
|
+
const escape = (s, { windowsPathsNoEscape = false, magicalBraces = false, } = {}) => {
|
|
90146
90448
|
// don't need to escape +@! because we escape the parens
|
|
90147
90449
|
// that make those magic, and escaping ! as [!] isn't valid,
|
|
90148
90450
|
// because [!]] is a valid glob class meaning not ']'.
|
|
90149
|
-
|
|
90150
|
-
|
|
90451
|
+
if (magicalBraces) {
|
|
90452
|
+
return windowsPathsNoEscape ?
|
|
90453
|
+
s.replace(/[?*()[\]{}]/g, '[$&]')
|
|
90454
|
+
: s.replace(/[?*()[\]\\{}]/g, '\\$&');
|
|
90455
|
+
}
|
|
90456
|
+
return windowsPathsNoEscape ?
|
|
90457
|
+
s.replace(/[?*()[\]]/g, '[$&]')
|
|
90151
90458
|
: s.replace(/[?*()[\]\\]/g, '\\$&');
|
|
90152
90459
|
};
|
|
90153
90460
|
exports.escape = escape;
|
|
@@ -90165,7 +90472,7 @@ exports.escape = escape;
|
|
|
90165
90472
|
|
|
90166
90473
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
90167
90474
|
exports.unescape = exports.escape = exports.AST = exports.Minimatch = exports.match = exports.makeRe = exports.braceExpand = exports.defaults = exports.filter = exports.GLOBSTAR = exports.sep = exports.minimatch = void 0;
|
|
90168
|
-
const brace_expansion_1 = __webpack_require__(/*!
|
|
90475
|
+
const brace_expansion_1 = __webpack_require__(/*! brace-expansion */ "./node_modules/glob/node_modules/brace-expansion/dist/commonjs/index.js");
|
|
90169
90476
|
const assert_valid_pattern_js_1 = __webpack_require__(/*! ./assert-valid-pattern.js */ "./node_modules/glob/node_modules/minimatch/dist/commonjs/assert-valid-pattern.js");
|
|
90170
90477
|
const ast_js_1 = __webpack_require__(/*! ./ast.js */ "./node_modules/glob/node_modules/minimatch/dist/commonjs/ast.js");
|
|
90171
90478
|
const escape_js_1 = __webpack_require__(/*! ./escape.js */ "./node_modules/glob/node_modules/minimatch/dist/commonjs/escape.js");
|
|
@@ -90231,8 +90538,8 @@ const qmarksTestNoExtDot = ([$0]) => {
|
|
|
90231
90538
|
return (f) => f.length === len && f !== '.' && f !== '..';
|
|
90232
90539
|
};
|
|
90233
90540
|
/* c8 ignore start */
|
|
90234
|
-
const defaultPlatform = (typeof process === 'object' && process
|
|
90235
|
-
|
|
90541
|
+
const defaultPlatform = (typeof process === 'object' && process ?
|
|
90542
|
+
(typeof process.env === 'object' &&
|
|
90236
90543
|
process.env &&
|
|
90237
90544
|
process.env.__MINIMATCH_TESTING_PLATFORM__) ||
|
|
90238
90545
|
process.platform
|
|
@@ -90318,7 +90625,7 @@ const braceExpand = (pattern, options = {}) => {
|
|
|
90318
90625
|
// shortcut. no need to expand.
|
|
90319
90626
|
return [pattern];
|
|
90320
90627
|
}
|
|
90321
|
-
return (0, brace_expansion_1.expand)(pattern);
|
|
90628
|
+
return (0, brace_expansion_1.expand)(pattern, { max: options.braceExpandMax });
|
|
90322
90629
|
};
|
|
90323
90630
|
exports.braceExpand = braceExpand;
|
|
90324
90631
|
exports.minimatch.braceExpand = exports.braceExpand;
|
|
@@ -90366,16 +90673,20 @@ class Minimatch {
|
|
|
90366
90673
|
isWindows;
|
|
90367
90674
|
platform;
|
|
90368
90675
|
windowsNoMagicRoot;
|
|
90676
|
+
maxGlobstarRecursion;
|
|
90369
90677
|
regexp;
|
|
90370
90678
|
constructor(pattern, options = {}) {
|
|
90371
90679
|
(0, assert_valid_pattern_js_1.assertValidPattern)(pattern);
|
|
90372
90680
|
options = options || {};
|
|
90373
90681
|
this.options = options;
|
|
90682
|
+
this.maxGlobstarRecursion = options.maxGlobstarRecursion ?? 200;
|
|
90374
90683
|
this.pattern = pattern;
|
|
90375
90684
|
this.platform = options.platform || defaultPlatform;
|
|
90376
90685
|
this.isWindows = this.platform === 'win32';
|
|
90686
|
+
// avoid the annoying deprecation flag lol
|
|
90687
|
+
const awe = ('allowWindow' + 'sEscape');
|
|
90377
90688
|
this.windowsPathsNoEscape =
|
|
90378
|
-
!!options.windowsPathsNoEscape || options
|
|
90689
|
+
!!options.windowsPathsNoEscape || options[awe] === false;
|
|
90379
90690
|
if (this.windowsPathsNoEscape) {
|
|
90380
90691
|
this.pattern = this.pattern.replace(/\\/g, '/');
|
|
90381
90692
|
}
|
|
@@ -90388,8 +90699,8 @@ class Minimatch {
|
|
|
90388
90699
|
this.partial = !!options.partial;
|
|
90389
90700
|
this.nocase = !!this.options.nocase;
|
|
90390
90701
|
this.windowsNoMagicRoot =
|
|
90391
|
-
options.windowsNoMagicRoot !== undefined
|
|
90392
|
-
|
|
90702
|
+
options.windowsNoMagicRoot !== undefined ?
|
|
90703
|
+
options.windowsNoMagicRoot
|
|
90393
90704
|
: !!(this.isWindows && this.nocase);
|
|
90394
90705
|
this.globSet = [];
|
|
90395
90706
|
this.globParts = [];
|
|
@@ -90452,7 +90763,10 @@ class Minimatch {
|
|
|
90452
90763
|
!globMagic.test(s[3]);
|
|
90453
90764
|
const isDrive = /^[a-z]:/i.test(s[0]);
|
|
90454
90765
|
if (isUNC) {
|
|
90455
|
-
return [
|
|
90766
|
+
return [
|
|
90767
|
+
...s.slice(0, 4),
|
|
90768
|
+
...s.slice(4).map(ss => this.parse(ss)),
|
|
90769
|
+
];
|
|
90456
90770
|
}
|
|
90457
90771
|
else if (isDrive) {
|
|
90458
90772
|
return [s[0], ...s.slice(1).map(ss => this.parse(ss))];
|
|
@@ -90484,7 +90798,7 @@ class Minimatch {
|
|
|
90484
90798
|
// to the right as possible, even if it increases the number
|
|
90485
90799
|
// of patterns that we have to process.
|
|
90486
90800
|
preprocess(globParts) {
|
|
90487
|
-
// if we're not in globstar mode, then turn
|
|
90801
|
+
// if we're not in globstar mode, then turn ** into *
|
|
90488
90802
|
if (this.options.noglobstar) {
|
|
90489
90803
|
for (let i = 0; i < globParts.length; i++) {
|
|
90490
90804
|
for (let j = 0; j < globParts[i].length; j++) {
|
|
@@ -90770,7 +91084,8 @@ class Minimatch {
|
|
|
90770
91084
|
// out of pattern, then that's fine, as long as all
|
|
90771
91085
|
// the parts match.
|
|
90772
91086
|
matchOne(file, pattern, partial = false) {
|
|
90773
|
-
|
|
91087
|
+
let fileStartIndex = 0;
|
|
91088
|
+
let patternStartIndex = 0;
|
|
90774
91089
|
// UNC paths like //?/X:/... can match X:/... and vice versa
|
|
90775
91090
|
// Drive letters in absolute drive or unc paths are always compared
|
|
90776
91091
|
// case-insensitively.
|
|
@@ -90788,120 +91103,210 @@ class Minimatch {
|
|
|
90788
91103
|
pattern[2] === '?' &&
|
|
90789
91104
|
typeof pattern[3] === 'string' &&
|
|
90790
91105
|
/^[a-z]:$/i.test(pattern[3]);
|
|
90791
|
-
const fdi = fileUNC ? 3
|
|
90792
|
-
|
|
91106
|
+
const fdi = fileUNC ? 3
|
|
91107
|
+
: fileDrive ? 0
|
|
91108
|
+
: undefined;
|
|
91109
|
+
const pdi = patternUNC ? 3
|
|
91110
|
+
: patternDrive ? 0
|
|
91111
|
+
: undefined;
|
|
90793
91112
|
if (typeof fdi === 'number' && typeof pdi === 'number') {
|
|
90794
|
-
const [fd, pd] = [
|
|
91113
|
+
const [fd, pd] = [
|
|
91114
|
+
file[fdi],
|
|
91115
|
+
pattern[pdi],
|
|
91116
|
+
];
|
|
91117
|
+
// start matching at the drive letter index of each
|
|
90795
91118
|
if (fd.toLowerCase() === pd.toLowerCase()) {
|
|
90796
91119
|
pattern[pdi] = fd;
|
|
90797
|
-
|
|
90798
|
-
|
|
90799
|
-
}
|
|
90800
|
-
else if (fdi > pdi) {
|
|
90801
|
-
file = file.slice(fdi);
|
|
90802
|
-
}
|
|
91120
|
+
patternStartIndex = pdi;
|
|
91121
|
+
fileStartIndex = fdi;
|
|
90803
91122
|
}
|
|
90804
91123
|
}
|
|
90805
91124
|
}
|
|
90806
91125
|
// resolve and reduce . and .. portions in the file as well.
|
|
90807
|
-
//
|
|
91126
|
+
// don't need to do the second phase, because it's only one string[]
|
|
90808
91127
|
const { optimizationLevel = 1 } = this.options;
|
|
90809
91128
|
if (optimizationLevel >= 2) {
|
|
90810
91129
|
file = this.levelTwoFileOptimize(file);
|
|
90811
91130
|
}
|
|
90812
|
-
|
|
90813
|
-
|
|
90814
|
-
|
|
91131
|
+
if (pattern.includes(exports.GLOBSTAR)) {
|
|
91132
|
+
return this.#matchGlobstar(file, pattern, partial, fileStartIndex, patternStartIndex);
|
|
91133
|
+
}
|
|
91134
|
+
return this.#matchOne(file, pattern, partial, fileStartIndex, patternStartIndex);
|
|
91135
|
+
}
|
|
91136
|
+
#matchGlobstar(file, pattern, partial, fileIndex, patternIndex) {
|
|
91137
|
+
// split the pattern into head, tail, and middle of ** delimited parts
|
|
91138
|
+
const firstgs = pattern.indexOf(exports.GLOBSTAR, patternIndex);
|
|
91139
|
+
const lastgs = pattern.lastIndexOf(exports.GLOBSTAR);
|
|
91140
|
+
// split the pattern up into globstar-delimited sections
|
|
91141
|
+
// the tail has to be at the end, and the others just have
|
|
91142
|
+
// to be found in order from the head.
|
|
91143
|
+
const [head, body, tail] = partial ? [
|
|
91144
|
+
pattern.slice(patternIndex, firstgs),
|
|
91145
|
+
pattern.slice(firstgs + 1),
|
|
91146
|
+
[],
|
|
91147
|
+
] : [
|
|
91148
|
+
pattern.slice(patternIndex, firstgs),
|
|
91149
|
+
pattern.slice(firstgs + 1, lastgs),
|
|
91150
|
+
pattern.slice(lastgs + 1),
|
|
91151
|
+
];
|
|
91152
|
+
// check the head, from the current file/pattern index.
|
|
91153
|
+
if (head.length) {
|
|
91154
|
+
const fileHead = file.slice(fileIndex, fileIndex + head.length);
|
|
91155
|
+
if (!this.#matchOne(fileHead, head, partial, 0, 0)) {
|
|
91156
|
+
return false;
|
|
91157
|
+
}
|
|
91158
|
+
fileIndex += head.length;
|
|
91159
|
+
patternIndex += head.length;
|
|
91160
|
+
}
|
|
91161
|
+
// now we know the head matches!
|
|
91162
|
+
// if the last portion is not empty, it MUST match the end
|
|
91163
|
+
// check the tail
|
|
91164
|
+
let fileTailMatch = 0;
|
|
91165
|
+
if (tail.length) {
|
|
91166
|
+
// if head + tail > file, then we cannot possibly match
|
|
91167
|
+
if (tail.length + fileIndex > file.length)
|
|
91168
|
+
return false;
|
|
91169
|
+
// try to match the tail
|
|
91170
|
+
let tailStart = file.length - tail.length;
|
|
91171
|
+
if (this.#matchOne(file, tail, partial, tailStart, 0)) {
|
|
91172
|
+
fileTailMatch = tail.length;
|
|
91173
|
+
}
|
|
91174
|
+
else {
|
|
91175
|
+
// affordance for stuff like a/**/* matching a/b/
|
|
91176
|
+
// if the last file portion is '', and there's more to the pattern
|
|
91177
|
+
// then try without the '' bit.
|
|
91178
|
+
if (file[file.length - 1] !== '' ||
|
|
91179
|
+
fileIndex + tail.length === file.length) {
|
|
91180
|
+
return false;
|
|
91181
|
+
}
|
|
91182
|
+
tailStart--;
|
|
91183
|
+
if (!this.#matchOne(file, tail, partial, tailStart, 0)) {
|
|
91184
|
+
return false;
|
|
91185
|
+
}
|
|
91186
|
+
fileTailMatch = tail.length + 1;
|
|
91187
|
+
}
|
|
91188
|
+
}
|
|
91189
|
+
// now we know the tail matches!
|
|
91190
|
+
// the middle is zero or more portions wrapped in **, possibly
|
|
91191
|
+
// containing more ** sections.
|
|
91192
|
+
// so a/**/b/**/c/**/d has become **/b/**/c/**
|
|
91193
|
+
// if it's empty, it means a/**/b, just verify we have no bad dots
|
|
91194
|
+
// if there's no tail, so it ends on /**, then we must have *something*
|
|
91195
|
+
// after the head, or it's not a matc
|
|
91196
|
+
if (!body.length) {
|
|
91197
|
+
let sawSome = !!fileTailMatch;
|
|
91198
|
+
for (let i = fileIndex; i < file.length - fileTailMatch; i++) {
|
|
91199
|
+
const f = String(file[i]);
|
|
91200
|
+
sawSome = true;
|
|
91201
|
+
if (f === '.' ||
|
|
91202
|
+
f === '..' ||
|
|
91203
|
+
(!this.options.dot && f.startsWith('.'))) {
|
|
91204
|
+
return false;
|
|
91205
|
+
}
|
|
91206
|
+
}
|
|
91207
|
+
// in partial mode, we just need to get past all file parts
|
|
91208
|
+
return partial || sawSome;
|
|
91209
|
+
}
|
|
91210
|
+
// now we know that there's one or more body sections, which can
|
|
91211
|
+
// be matched anywhere from the 0 index (because the head was pruned)
|
|
91212
|
+
// through to the length-fileTailMatch index.
|
|
91213
|
+
// split the body up into sections, and note the minimum index it can
|
|
91214
|
+
// be found at (start with the length of all previous segments)
|
|
91215
|
+
// [section, before, after]
|
|
91216
|
+
const bodySegments = [[[], 0]];
|
|
91217
|
+
let currentBody = bodySegments[0];
|
|
91218
|
+
let nonGsParts = 0;
|
|
91219
|
+
const nonGsPartsSums = [0];
|
|
91220
|
+
for (const b of body) {
|
|
91221
|
+
if (b === exports.GLOBSTAR) {
|
|
91222
|
+
nonGsPartsSums.push(nonGsParts);
|
|
91223
|
+
currentBody = [[], 0];
|
|
91224
|
+
bodySegments.push(currentBody);
|
|
91225
|
+
}
|
|
91226
|
+
else {
|
|
91227
|
+
currentBody[0].push(b);
|
|
91228
|
+
nonGsParts++;
|
|
91229
|
+
}
|
|
91230
|
+
}
|
|
91231
|
+
let i = bodySegments.length - 1;
|
|
91232
|
+
const fileLength = file.length - fileTailMatch;
|
|
91233
|
+
for (const b of bodySegments) {
|
|
91234
|
+
b[1] = fileLength - (nonGsPartsSums[i--] + b[0].length);
|
|
91235
|
+
}
|
|
91236
|
+
return !!this.#matchGlobStarBodySections(file, bodySegments, fileIndex, 0, partial, 0, !!fileTailMatch);
|
|
91237
|
+
}
|
|
91238
|
+
// return false for "nope, not matching"
|
|
91239
|
+
// return null for "not matching, cannot keep trying"
|
|
91240
|
+
#matchGlobStarBodySections(file,
|
|
91241
|
+
// pattern section, last possible position for it
|
|
91242
|
+
bodySegments, fileIndex, bodyIndex, partial, globStarDepth, sawTail) {
|
|
91243
|
+
// take the first body segment, and walk from fileIndex to its "after"
|
|
91244
|
+
// value at the end
|
|
91245
|
+
// If it doesn't match at that position, we increment, until we hit
|
|
91246
|
+
// that final possible position, and give up.
|
|
91247
|
+
// If it does match, then advance and try to rest.
|
|
91248
|
+
// If any of them fail we keep walking forward.
|
|
91249
|
+
// this is still a bit recursively painful, but it's more constrained
|
|
91250
|
+
// than previous implementations, because we never test something that
|
|
91251
|
+
// can't possibly be a valid matching condition.
|
|
91252
|
+
const bs = bodySegments[bodyIndex];
|
|
91253
|
+
if (!bs) {
|
|
91254
|
+
// just make sure that there's no bad dots
|
|
91255
|
+
for (let i = fileIndex; i < file.length; i++) {
|
|
91256
|
+
sawTail = true;
|
|
91257
|
+
const f = file[i];
|
|
91258
|
+
if (f === '.' ||
|
|
91259
|
+
f === '..' ||
|
|
91260
|
+
(!this.options.dot && f.startsWith('.'))) {
|
|
91261
|
+
return false;
|
|
91262
|
+
}
|
|
91263
|
+
}
|
|
91264
|
+
return sawTail;
|
|
91265
|
+
}
|
|
91266
|
+
// have a non-globstar body section to test
|
|
91267
|
+
const [body, after] = bs;
|
|
91268
|
+
while (fileIndex <= after) {
|
|
91269
|
+
const m = this.#matchOne(file.slice(0, fileIndex + body.length), body, partial, fileIndex, 0);
|
|
91270
|
+
// if limit exceeded, no match. intentional false negative,
|
|
91271
|
+
// acceptable break in correctness for security.
|
|
91272
|
+
if (m && globStarDepth < this.maxGlobstarRecursion) {
|
|
91273
|
+
// match! see if the rest match. if so, we're done!
|
|
91274
|
+
const sub = this.#matchGlobStarBodySections(file, bodySegments, fileIndex + body.length, bodyIndex + 1, partial, globStarDepth + 1, sawTail);
|
|
91275
|
+
if (sub !== false) {
|
|
91276
|
+
return sub;
|
|
91277
|
+
}
|
|
91278
|
+
}
|
|
91279
|
+
const f = file[fileIndex];
|
|
91280
|
+
if (f === '.' ||
|
|
91281
|
+
f === '..' ||
|
|
91282
|
+
(!this.options.dot && f.startsWith('.'))) {
|
|
91283
|
+
return false;
|
|
91284
|
+
}
|
|
91285
|
+
fileIndex++;
|
|
91286
|
+
}
|
|
91287
|
+
// walked off. no point continuing
|
|
91288
|
+
return partial || null;
|
|
91289
|
+
}
|
|
91290
|
+
#matchOne(file, pattern, partial, fileIndex, patternIndex) {
|
|
91291
|
+
let fi;
|
|
91292
|
+
let pi;
|
|
91293
|
+
let pl;
|
|
91294
|
+
let fl;
|
|
91295
|
+
for (fi = fileIndex,
|
|
91296
|
+
pi = patternIndex,
|
|
91297
|
+
fl = file.length,
|
|
91298
|
+
pl = pattern.length; fi < fl && pi < pl; fi++, pi++) {
|
|
90815
91299
|
this.debug('matchOne loop');
|
|
90816
|
-
|
|
90817
|
-
|
|
91300
|
+
let p = pattern[pi];
|
|
91301
|
+
let f = file[fi];
|
|
90818
91302
|
this.debug(pattern, p, f);
|
|
90819
91303
|
// should be impossible.
|
|
90820
91304
|
// some invalid regexp stuff in the set.
|
|
90821
91305
|
/* c8 ignore start */
|
|
90822
|
-
if (p === false) {
|
|
91306
|
+
if (p === false || p === exports.GLOBSTAR) {
|
|
90823
91307
|
return false;
|
|
90824
91308
|
}
|
|
90825
91309
|
/* c8 ignore stop */
|
|
90826
|
-
if (p === exports.GLOBSTAR) {
|
|
90827
|
-
this.debug('GLOBSTAR', [pattern, p, f]);
|
|
90828
|
-
// "**"
|
|
90829
|
-
// a/**/b/**/c would match the following:
|
|
90830
|
-
// a/b/x/y/z/c
|
|
90831
|
-
// a/x/y/z/b/c
|
|
90832
|
-
// a/b/x/b/x/c
|
|
90833
|
-
// a/b/c
|
|
90834
|
-
// To do this, take the rest of the pattern after
|
|
90835
|
-
// the **, and see if it would match the file remainder.
|
|
90836
|
-
// If so, return success.
|
|
90837
|
-
// If not, the ** "swallows" a segment, and try again.
|
|
90838
|
-
// This is recursively awful.
|
|
90839
|
-
//
|
|
90840
|
-
// a/**/b/**/c matching a/b/x/y/z/c
|
|
90841
|
-
// - a matches a
|
|
90842
|
-
// - doublestar
|
|
90843
|
-
// - matchOne(b/x/y/z/c, b/**/c)
|
|
90844
|
-
// - b matches b
|
|
90845
|
-
// - doublestar
|
|
90846
|
-
// - matchOne(x/y/z/c, c) -> no
|
|
90847
|
-
// - matchOne(y/z/c, c) -> no
|
|
90848
|
-
// - matchOne(z/c, c) -> no
|
|
90849
|
-
// - matchOne(c, c) yes, hit
|
|
90850
|
-
var fr = fi;
|
|
90851
|
-
var pr = pi + 1;
|
|
90852
|
-
if (pr === pl) {
|
|
90853
|
-
this.debug('** at the end');
|
|
90854
|
-
// a ** at the end will just swallow the rest.
|
|
90855
|
-
// We have found a match.
|
|
90856
|
-
// however, it will not swallow /.x, unless
|
|
90857
|
-
// options.dot is set.
|
|
90858
|
-
// . and .. are *never* matched by **, for explosively
|
|
90859
|
-
// exponential reasons.
|
|
90860
|
-
for (; fi < fl; fi++) {
|
|
90861
|
-
if (file[fi] === '.' ||
|
|
90862
|
-
file[fi] === '..' ||
|
|
90863
|
-
(!options.dot && file[fi].charAt(0) === '.'))
|
|
90864
|
-
return false;
|
|
90865
|
-
}
|
|
90866
|
-
return true;
|
|
90867
|
-
}
|
|
90868
|
-
// ok, let's see if we can swallow whatever we can.
|
|
90869
|
-
while (fr < fl) {
|
|
90870
|
-
var swallowee = file[fr];
|
|
90871
|
-
this.debug('\nglobstar while', file, fr, pattern, pr, swallowee);
|
|
90872
|
-
// XXX remove this slice. Just pass the start index.
|
|
90873
|
-
if (this.matchOne(file.slice(fr), pattern.slice(pr), partial)) {
|
|
90874
|
-
this.debug('globstar found match!', fr, fl, swallowee);
|
|
90875
|
-
// found a match.
|
|
90876
|
-
return true;
|
|
90877
|
-
}
|
|
90878
|
-
else {
|
|
90879
|
-
// can't swallow "." or ".." ever.
|
|
90880
|
-
// can only swallow ".foo" when explicitly asked.
|
|
90881
|
-
if (swallowee === '.' ||
|
|
90882
|
-
swallowee === '..' ||
|
|
90883
|
-
(!options.dot && swallowee.charAt(0) === '.')) {
|
|
90884
|
-
this.debug('dot detected!', file, fr, pattern, pr);
|
|
90885
|
-
break;
|
|
90886
|
-
}
|
|
90887
|
-
// ** swallows a segment, and continue.
|
|
90888
|
-
this.debug('globstar swallow a segment, and continue');
|
|
90889
|
-
fr++;
|
|
90890
|
-
}
|
|
90891
|
-
}
|
|
90892
|
-
// no match was found.
|
|
90893
|
-
// However, in partial mode, we can't say this is necessarily over.
|
|
90894
|
-
/* c8 ignore start */
|
|
90895
|
-
if (partial) {
|
|
90896
|
-
// ran out of file
|
|
90897
|
-
this.debug('\n>>> no match, partial?', file, fr, pattern, pr);
|
|
90898
|
-
if (fr === fl) {
|
|
90899
|
-
return true;
|
|
90900
|
-
}
|
|
90901
|
-
}
|
|
90902
|
-
/* c8 ignore stop */
|
|
90903
|
-
return false;
|
|
90904
|
-
}
|
|
90905
91310
|
// something other than **
|
|
90906
91311
|
// non-magic patterns just have to match exactly
|
|
90907
91312
|
// patterns with magic have been turned into regexps.
|
|
@@ -90972,21 +91377,19 @@ class Minimatch {
|
|
|
90972
91377
|
fastTest = options.dot ? starTestDot : starTest;
|
|
90973
91378
|
}
|
|
90974
91379
|
else if ((m = pattern.match(starDotExtRE))) {
|
|
90975
|
-
fastTest = (options.nocase
|
|
90976
|
-
|
|
90977
|
-
|
|
91380
|
+
fastTest = (options.nocase ?
|
|
91381
|
+
options.dot ?
|
|
91382
|
+
starDotExtTestNocaseDot
|
|
90978
91383
|
: starDotExtTestNocase
|
|
90979
|
-
: options.dot
|
|
90980
|
-
? starDotExtTestDot
|
|
91384
|
+
: options.dot ? starDotExtTestDot
|
|
90981
91385
|
: starDotExtTest)(m[1]);
|
|
90982
91386
|
}
|
|
90983
91387
|
else if ((m = pattern.match(qmarksRE))) {
|
|
90984
|
-
fastTest = (options.nocase
|
|
90985
|
-
|
|
90986
|
-
|
|
91388
|
+
fastTest = (options.nocase ?
|
|
91389
|
+
options.dot ?
|
|
91390
|
+
qmarksTestNocaseDot
|
|
90987
91391
|
: qmarksTestNocase
|
|
90988
|
-
: options.dot
|
|
90989
|
-
? qmarksTestDot
|
|
91392
|
+
: options.dot ? qmarksTestDot
|
|
90990
91393
|
: qmarksTest)(m);
|
|
90991
91394
|
}
|
|
90992
91395
|
else if ((m = pattern.match(starDotStarRE))) {
|
|
@@ -91017,10 +91420,8 @@ class Minimatch {
|
|
|
91017
91420
|
return this.regexp;
|
|
91018
91421
|
}
|
|
91019
91422
|
const options = this.options;
|
|
91020
|
-
const twoStar = options.noglobstar
|
|
91021
|
-
?
|
|
91022
|
-
: options.dot
|
|
91023
|
-
? twoStarDot
|
|
91423
|
+
const twoStar = options.noglobstar ? star
|
|
91424
|
+
: options.dot ? twoStarDot
|
|
91024
91425
|
: twoStarNoDot;
|
|
91025
91426
|
const flags = new Set(options.nocase ? ['i'] : []);
|
|
91026
91427
|
// regexpify non-globstar patterns
|
|
@@ -91036,11 +91437,9 @@ class Minimatch {
|
|
|
91036
91437
|
for (const f of p.flags.split(''))
|
|
91037
91438
|
flags.add(f);
|
|
91038
91439
|
}
|
|
91039
|
-
return typeof p === 'string'
|
|
91040
|
-
?
|
|
91041
|
-
|
|
91042
|
-
? exports.GLOBSTAR
|
|
91043
|
-
: p._src;
|
|
91440
|
+
return (typeof p === 'string' ? regExpEscape(p)
|
|
91441
|
+
: p === exports.GLOBSTAR ? exports.GLOBSTAR
|
|
91442
|
+
: p._src);
|
|
91044
91443
|
});
|
|
91045
91444
|
pp.forEach((p, i) => {
|
|
91046
91445
|
const next = pp[i + 1];
|
|
@@ -91057,14 +91456,25 @@ class Minimatch {
|
|
|
91057
91456
|
}
|
|
91058
91457
|
}
|
|
91059
91458
|
else if (next === undefined) {
|
|
91060
|
-
pp[i - 1] = prev + '(
|
|
91459
|
+
pp[i - 1] = prev + '(?:\\/|\\/' + twoStar + ')?';
|
|
91061
91460
|
}
|
|
91062
91461
|
else if (next !== exports.GLOBSTAR) {
|
|
91063
91462
|
pp[i - 1] = prev + '(?:\\/|\\/' + twoStar + '\\/)' + next;
|
|
91064
91463
|
pp[i + 1] = exports.GLOBSTAR;
|
|
91065
91464
|
}
|
|
91066
91465
|
});
|
|
91067
|
-
|
|
91466
|
+
const filtered = pp.filter(p => p !== exports.GLOBSTAR);
|
|
91467
|
+
// For partial matches, we need to make the pattern match
|
|
91468
|
+
// any prefix of the full path. We do this by generating
|
|
91469
|
+
// alternative patterns that match progressively longer prefixes.
|
|
91470
|
+
if (this.partial && filtered.length >= 1) {
|
|
91471
|
+
const prefixes = [];
|
|
91472
|
+
for (let i = 1; i <= filtered.length; i++) {
|
|
91473
|
+
prefixes.push(filtered.slice(0, i).join('/'));
|
|
91474
|
+
}
|
|
91475
|
+
return '(?:' + prefixes.join('|') + ')';
|
|
91476
|
+
}
|
|
91477
|
+
return filtered.join('/');
|
|
91068
91478
|
})
|
|
91069
91479
|
.join('|');
|
|
91070
91480
|
// need to wrap in parens if we had more than one thing with |,
|
|
@@ -91073,6 +91483,10 @@ class Minimatch {
|
|
|
91073
91483
|
// must match entire pattern
|
|
91074
91484
|
// ending in a * or ** will make it less strict.
|
|
91075
91485
|
re = '^' + open + re + close + '$';
|
|
91486
|
+
// In partial mode, '/' should always match as it's a valid prefix for any pattern
|
|
91487
|
+
if (this.partial) {
|
|
91488
|
+
re = '^(?:\\/|' + open + re.slice(1, -1) + close + ')$';
|
|
91489
|
+
}
|
|
91076
91490
|
// can match anything, as long as it's not this.
|
|
91077
91491
|
if (this.negate)
|
|
91078
91492
|
re = '^(?!' + re + ').+$';
|
|
@@ -91192,21 +91606,35 @@ exports.unescape = void 0;
|
|
|
91192
91606
|
/**
|
|
91193
91607
|
* Un-escape a string that has been escaped with {@link escape}.
|
|
91194
91608
|
*
|
|
91195
|
-
* If the {@link windowsPathsNoEscape} option is used, then
|
|
91196
|
-
* escapes are removed, but not backslash escapes.
|
|
91197
|
-
* the string `'[*]'` into `*`, but it will not turn `'\\*'` into `'*'`,
|
|
91198
|
-
* becuase `\` is a path separator in `windowsPathsNoEscape` mode.
|
|
91609
|
+
* If the {@link MinimatchOptions.windowsPathsNoEscape} option is used, then
|
|
91610
|
+
* square-bracket escapes are removed, but not backslash escapes.
|
|
91199
91611
|
*
|
|
91200
|
-
*
|
|
91612
|
+
* For example, it will turn the string `'[*]'` into `*`, but it will not
|
|
91613
|
+
* turn `'\\*'` into `'*'`, because `\` is a path separator in
|
|
91614
|
+
* `windowsPathsNoEscape` mode.
|
|
91615
|
+
*
|
|
91616
|
+
* When `windowsPathsNoEscape` is not set, then both square-bracket escapes and
|
|
91201
91617
|
* backslash escapes are removed.
|
|
91202
91618
|
*
|
|
91203
91619
|
* Slashes (and backslashes in `windowsPathsNoEscape` mode) cannot be escaped
|
|
91204
91620
|
* or unescaped.
|
|
91621
|
+
*
|
|
91622
|
+
* When `magicalBraces` is not set, escapes of braces (`{` and `}`) will not be
|
|
91623
|
+
* unescaped.
|
|
91205
91624
|
*/
|
|
91206
|
-
const unescape = (s, { windowsPathsNoEscape = false, } = {}) => {
|
|
91207
|
-
|
|
91208
|
-
|
|
91209
|
-
|
|
91625
|
+
const unescape = (s, { windowsPathsNoEscape = false, magicalBraces = true, } = {}) => {
|
|
91626
|
+
if (magicalBraces) {
|
|
91627
|
+
return windowsPathsNoEscape ?
|
|
91628
|
+
s.replace(/\[([^\/\\])\]/g, '$1')
|
|
91629
|
+
: s
|
|
91630
|
+
.replace(/((?!\\).|^)\[([^\/\\])\]/g, '$1$2')
|
|
91631
|
+
.replace(/\\([^\/])/g, '$1');
|
|
91632
|
+
}
|
|
91633
|
+
return windowsPathsNoEscape ?
|
|
91634
|
+
s.replace(/\[([^\/\\{}])\]/g, '$1')
|
|
91635
|
+
: s
|
|
91636
|
+
.replace(/((?!\\).|^)\[([^\/\\{}])\]/g, '$1$2')
|
|
91637
|
+
.replace(/\\([^\/{}])/g, '$1');
|
|
91210
91638
|
};
|
|
91211
91639
|
exports.unescape = unescape;
|
|
91212
91640
|
//# sourceMappingURL=unescape.js.map
|