@sentry/craft 2.24.2 → 2.25.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/craft +1944 -736
  2. package/package.json +4 -4
package/dist/craft CHANGED
@@ -104254,7 +104254,7 @@ var init_storage = __esm({
104254
104254
  }
104255
104255
  });
104256
104256
 
104257
- // node_modules/.pnpm/fast-xml-parser@5.3.8/node_modules/fast-xml-parser/src/util.js
104257
+ // node_modules/.pnpm/fast-xml-parser@5.5.7/node_modules/fast-xml-parser/src/util.js
104258
104258
  function getAllMatches(string, regex2) {
104259
104259
  const matches = [];
104260
104260
  let match2 = regex2.exec(string);
@@ -104273,9 +104273,9 @@ function getAllMatches(string, regex2) {
104273
104273
  function isExist(v9) {
104274
104274
  return typeof v9 !== "undefined";
104275
104275
  }
104276
- var nameStartChar, nameChar, nameRegexp, regexName, isName;
104276
+ var nameStartChar, nameChar, nameRegexp, regexName, isName, DANGEROUS_PROPERTY_NAMES, criticalProperties;
104277
104277
  var init_util5 = __esm({
104278
- "node_modules/.pnpm/fast-xml-parser@5.3.8/node_modules/fast-xml-parser/src/util.js"() {
104278
+ "node_modules/.pnpm/fast-xml-parser@5.5.7/node_modules/fast-xml-parser/src/util.js"() {
104279
104279
  "use strict";
104280
104280
  init_import_meta_url();
104281
104281
  nameStartChar = ":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";
@@ -104286,10 +104286,23 @@ var init_util5 = __esm({
104286
104286
  const match2 = regexName.exec(string);
104287
104287
  return !(match2 === null || typeof match2 === "undefined");
104288
104288
  };
104289
+ DANGEROUS_PROPERTY_NAMES = [
104290
+ // '__proto__',
104291
+ // 'constructor',
104292
+ // 'prototype',
104293
+ "hasOwnProperty",
104294
+ "toString",
104295
+ "valueOf",
104296
+ "__defineGetter__",
104297
+ "__defineSetter__",
104298
+ "__lookupGetter__",
104299
+ "__lookupSetter__"
104300
+ ];
104301
+ criticalProperties = ["__proto__", "constructor", "prototype"];
104289
104302
  }
104290
104303
  });
104291
104304
 
104292
- // node_modules/.pnpm/fast-xml-parser@5.3.8/node_modules/fast-xml-parser/src/validator.js
104305
+ // node_modules/.pnpm/fast-xml-parser@5.5.7/node_modules/fast-xml-parser/src/validator.js
104293
104306
  function validate3(xmlData, options) {
104294
104307
  options = Object.assign({}, defaultOptions2, options);
104295
104308
  const tags = [];
@@ -104588,7 +104601,7 @@ function getPositionFromMatch(match2) {
104588
104601
  }
104589
104602
  var defaultOptions2, doubleQuote, singleQuote, validAttrStrRegxp;
104590
104603
  var init_validator = __esm({
104591
- "node_modules/.pnpm/fast-xml-parser@5.3.8/node_modules/fast-xml-parser/src/validator.js"() {
104604
+ "node_modules/.pnpm/fast-xml-parser@5.5.7/node_modules/fast-xml-parser/src/validator.js"() {
104592
104605
  "use strict";
104593
104606
  init_import_meta_url();
104594
104607
  init_util5();
@@ -104603,7 +104616,23 @@ var init_validator = __esm({
104603
104616
  }
104604
104617
  });
104605
104618
 
104606
- // node_modules/.pnpm/fast-xml-parser@5.3.8/node_modules/fast-xml-parser/src/xmlparser/OptionsBuilder.js
104619
+ // node_modules/.pnpm/fast-xml-parser@5.5.7/node_modules/fast-xml-parser/src/xmlparser/OptionsBuilder.js
104620
+ function validatePropertyName(propertyName, optionName) {
104621
+ if (typeof propertyName !== "string") {
104622
+ return;
104623
+ }
104624
+ const normalized = propertyName.toLowerCase();
104625
+ if (DANGEROUS_PROPERTY_NAMES.some((dangerous) => normalized === dangerous.toLowerCase())) {
104626
+ throw new Error(
104627
+ `[SECURITY] Invalid ${optionName}: "${propertyName}" is a reserved JavaScript keyword that could cause prototype pollution`
104628
+ );
104629
+ }
104630
+ if (criticalProperties.some((dangerous) => normalized === dangerous.toLowerCase())) {
104631
+ throw new Error(
104632
+ `[SECURITY] Invalid ${optionName}: "${propertyName}" is a reserved JavaScript keyword that could cause prototype pollution`
104633
+ );
104634
+ }
104635
+ }
104607
104636
  function normalizeProcessEntities(value) {
104608
104637
  if (typeof value === "boolean") {
104609
104638
  return {
@@ -104613,6 +104642,7 @@ function normalizeProcessEntities(value) {
104613
104642
  maxExpansionDepth: 10,
104614
104643
  maxTotalExpansions: 1e3,
104615
104644
  maxExpandedLength: 1e5,
104645
+ maxEntityCount: 100,
104616
104646
  allowedTags: null,
104617
104647
  tagFilter: null
104618
104648
  };
@@ -104620,21 +104650,28 @@ function normalizeProcessEntities(value) {
104620
104650
  if (typeof value === "object" && value !== null) {
104621
104651
  return {
104622
104652
  enabled: value.enabled !== false,
104623
- // default true if not specified
104624
- maxEntitySize: value.maxEntitySize ?? 1e4,
104625
- maxExpansionDepth: value.maxExpansionDepth ?? 10,
104626
- maxTotalExpansions: value.maxTotalExpansions ?? 1e3,
104627
- maxExpandedLength: value.maxExpandedLength ?? 1e5,
104653
+ maxEntitySize: Math.max(1, value.maxEntitySize ?? 1e4),
104654
+ maxExpansionDepth: Math.max(1, value.maxExpansionDepth ?? 10),
104655
+ maxTotalExpansions: Math.max(1, value.maxTotalExpansions ?? 1e3),
104656
+ maxExpandedLength: Math.max(1, value.maxExpandedLength ?? 1e5),
104657
+ maxEntityCount: Math.max(1, value.maxEntityCount ?? 100),
104628
104658
  allowedTags: value.allowedTags ?? null,
104629
104659
  tagFilter: value.tagFilter ?? null
104630
104660
  };
104631
104661
  }
104632
104662
  return normalizeProcessEntities(true);
104633
104663
  }
104634
- var defaultOptions3, buildOptions;
104664
+ var defaultOnDangerousProperty, defaultOptions3, buildOptions;
104635
104665
  var init_OptionsBuilder = __esm({
104636
- "node_modules/.pnpm/fast-xml-parser@5.3.8/node_modules/fast-xml-parser/src/xmlparser/OptionsBuilder.js"() {
104666
+ "node_modules/.pnpm/fast-xml-parser@5.5.7/node_modules/fast-xml-parser/src/xmlparser/OptionsBuilder.js"() {
104637
104667
  init_import_meta_url();
104668
+ init_util5();
104669
+ defaultOnDangerousProperty = (name) => {
104670
+ if (DANGEROUS_PROPERTY_NAMES.includes(name)) {
104671
+ return "__" + name;
104672
+ }
104673
+ return name;
104674
+ };
104638
104675
  defaultOptions3 = {
104639
104676
  preserveOrder: false,
104640
104677
  attributeNamePrefix: "@_",
@@ -104679,20 +104716,47 @@ var init_OptionsBuilder = __esm({
104679
104716
  },
104680
104717
  // skipEmptyListItem: false
104681
104718
  captureMetaData: false,
104682
- maxNestedTags: 100
104719
+ maxNestedTags: 100,
104720
+ strictReservedNames: true,
104721
+ jPath: true,
104722
+ // if true, pass jPath string to callbacks; if false, pass matcher instance
104723
+ onDangerousProperty: defaultOnDangerousProperty
104683
104724
  };
104684
104725
  buildOptions = function(options) {
104685
104726
  const built = Object.assign({}, defaultOptions3, options);
104727
+ const propertyNameOptions = [
104728
+ { value: built.attributeNamePrefix, name: "attributeNamePrefix" },
104729
+ { value: built.attributesGroupName, name: "attributesGroupName" },
104730
+ { value: built.textNodeName, name: "textNodeName" },
104731
+ { value: built.cdataPropName, name: "cdataPropName" },
104732
+ { value: built.commentPropName, name: "commentPropName" }
104733
+ ];
104734
+ for (const { value, name } of propertyNameOptions) {
104735
+ if (value) {
104736
+ validatePropertyName(value, name);
104737
+ }
104738
+ }
104739
+ if (built.onDangerousProperty === null) {
104740
+ built.onDangerousProperty = defaultOnDangerousProperty;
104741
+ }
104686
104742
  built.processEntities = normalizeProcessEntities(built.processEntities);
104743
+ if (built.stopNodes && Array.isArray(built.stopNodes)) {
104744
+ built.stopNodes = built.stopNodes.map((node2) => {
104745
+ if (typeof node2 === "string" && node2.startsWith("*.")) {
104746
+ return ".." + node2.substring(2);
104747
+ }
104748
+ return node2;
104749
+ });
104750
+ }
104687
104751
  return built;
104688
104752
  };
104689
104753
  }
104690
104754
  });
104691
104755
 
104692
- // node_modules/.pnpm/fast-xml-parser@5.3.8/node_modules/fast-xml-parser/src/xmlparser/xmlNode.js
104756
+ // node_modules/.pnpm/fast-xml-parser@5.5.7/node_modules/fast-xml-parser/src/xmlparser/xmlNode.js
104693
104757
  var METADATA_SYMBOL, XmlNode;
104694
104758
  var init_xmlNode = __esm({
104695
- "node_modules/.pnpm/fast-xml-parser@5.3.8/node_modules/fast-xml-parser/src/xmlparser/xmlNode.js"() {
104759
+ "node_modules/.pnpm/fast-xml-parser@5.5.7/node_modules/fast-xml-parser/src/xmlparser/xmlNode.js"() {
104696
104760
  "use strict";
104697
104761
  init_import_meta_url();
104698
104762
  if (typeof Symbol !== "function") {
@@ -104729,7 +104793,7 @@ var init_xmlNode = __esm({
104729
104793
  }
104730
104794
  });
104731
104795
 
104732
- // node_modules/.pnpm/fast-xml-parser@5.3.8/node_modules/fast-xml-parser/src/xmlparser/DocTypeReader.js
104796
+ // node_modules/.pnpm/fast-xml-parser@5.5.7/node_modules/fast-xml-parser/src/xmlparser/DocTypeReader.js
104733
104797
  function hasSeq(data2, seq2, i4) {
104734
104798
  for (let j6 = 0; j6 < seq2.length; j6++) {
104735
104799
  if (seq2[j6] !== data2[i4 + j6 + 1]) return false;
@@ -104744,7 +104808,7 @@ function validateEntityName(name) {
104744
104808
  }
104745
104809
  var DocTypeReader, skipWhitespace;
104746
104810
  var init_DocTypeReader = __esm({
104747
- "node_modules/.pnpm/fast-xml-parser@5.3.8/node_modules/fast-xml-parser/src/xmlparser/DocTypeReader.js"() {
104811
+ "node_modules/.pnpm/fast-xml-parser@5.5.7/node_modules/fast-xml-parser/src/xmlparser/DocTypeReader.js"() {
104748
104812
  init_import_meta_url();
104749
104813
  init_util5();
104750
104814
  DocTypeReader = class {
@@ -104754,6 +104818,7 @@ var init_DocTypeReader = __esm({
104754
104818
  }
104755
104819
  readDocType(xmlData, i4) {
104756
104820
  const entities = /* @__PURE__ */ Object.create(null);
104821
+ let entityCount = 0;
104757
104822
  if (xmlData[i4 + 3] === "O" && xmlData[i4 + 4] === "C" && xmlData[i4 + 5] === "T" && xmlData[i4 + 6] === "Y" && xmlData[i4 + 7] === "P" && xmlData[i4 + 8] === "E") {
104758
104823
  i4 = i4 + 9;
104759
104824
  let angleBracketsCount = 1;
@@ -104766,11 +104831,17 @@ var init_DocTypeReader = __esm({
104766
104831
  let entityName, val;
104767
104832
  [entityName, val, i4] = this.readEntityExp(xmlData, i4 + 1, this.suppressValidationErr);
104768
104833
  if (val.indexOf("&") === -1) {
104769
- const escaped = entityName.replace(/[.\-+*:]/g, "\\.");
104834
+ if (this.options.enabled !== false && this.options.maxEntityCount != null && entityCount >= this.options.maxEntityCount) {
104835
+ throw new Error(
104836
+ `Entity count (${entityCount + 1}) exceeds maximum allowed (${this.options.maxEntityCount})`
104837
+ );
104838
+ }
104839
+ const escaped = entityName.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
104770
104840
  entities[entityName] = {
104771
104841
  regx: RegExp(`&${escaped};`, "g"),
104772
104842
  val
104773
104843
  };
104844
+ entityCount++;
104774
104845
  }
104775
104846
  } else if (hasBody && hasSeq(xmlData, "!ELEMENT", i4)) {
104776
104847
  i4 += 8;
@@ -104814,11 +104885,11 @@ var init_DocTypeReader = __esm({
104814
104885
  }
104815
104886
  readEntityExp(xmlData, i4) {
104816
104887
  i4 = skipWhitespace(xmlData, i4);
104817
- let entityName = "";
104888
+ const startIndex = i4;
104818
104889
  while (i4 < xmlData.length && !/\s/.test(xmlData[i4]) && xmlData[i4] !== '"' && xmlData[i4] !== "'") {
104819
- entityName += xmlData[i4];
104820
104890
  i4++;
104821
104891
  }
104892
+ let entityName = xmlData.substring(startIndex, i4);
104822
104893
  validateEntityName(entityName);
104823
104894
  i4 = skipWhitespace(xmlData, i4);
104824
104895
  if (!this.suppressValidationErr) {
@@ -104830,7 +104901,7 @@ var init_DocTypeReader = __esm({
104830
104901
  }
104831
104902
  let entityValue = "";
104832
104903
  [i4, entityValue] = this.readIdentifierVal(xmlData, i4, "entity");
104833
- if (this.options.enabled !== false && this.options.maxEntitySize && entityValue.length > this.options.maxEntitySize) {
104904
+ if (this.options.enabled !== false && this.options.maxEntitySize != null && entityValue.length > this.options.maxEntitySize) {
104834
104905
  throw new Error(
104835
104906
  `Entity "${entityName}" size (${entityValue.length}) exceeds maximum allowed size (${this.options.maxEntitySize})`
104836
104907
  );
@@ -104840,11 +104911,11 @@ var init_DocTypeReader = __esm({
104840
104911
  }
104841
104912
  readNotationExp(xmlData, i4) {
104842
104913
  i4 = skipWhitespace(xmlData, i4);
104843
- let notationName = "";
104914
+ const startIndex = i4;
104844
104915
  while (i4 < xmlData.length && !/\s/.test(xmlData[i4])) {
104845
- notationName += xmlData[i4];
104846
104916
  i4++;
104847
104917
  }
104918
+ let notationName = xmlData.substring(startIndex, i4);
104848
104919
  !this.suppressValidationErr && validateEntityName(notationName);
104849
104920
  i4 = skipWhitespace(xmlData, i4);
104850
104921
  const identifierType = xmlData.substring(i4, i4 + 6).toUpperCase();
@@ -104876,10 +104947,11 @@ var init_DocTypeReader = __esm({
104876
104947
  throw new Error(`Expected quoted string, found "${startChar}"`);
104877
104948
  }
104878
104949
  i4++;
104950
+ const startIndex = i4;
104879
104951
  while (i4 < xmlData.length && xmlData[i4] !== startChar) {
104880
- identifierVal += xmlData[i4];
104881
104952
  i4++;
104882
104953
  }
104954
+ identifierVal = xmlData.substring(startIndex, i4);
104883
104955
  if (xmlData[i4] !== startChar) {
104884
104956
  throw new Error(`Unterminated ${type2} value`);
104885
104957
  }
@@ -104888,11 +104960,11 @@ var init_DocTypeReader = __esm({
104888
104960
  }
104889
104961
  readElementExp(xmlData, i4) {
104890
104962
  i4 = skipWhitespace(xmlData, i4);
104891
- let elementName = "";
104963
+ const startIndex = i4;
104892
104964
  while (i4 < xmlData.length && !/\s/.test(xmlData[i4])) {
104893
- elementName += xmlData[i4];
104894
104965
  i4++;
104895
104966
  }
104967
+ let elementName = xmlData.substring(startIndex, i4);
104896
104968
  if (!this.suppressValidationErr && !isName(elementName)) {
104897
104969
  throw new Error(`Invalid element name: "${elementName}"`);
104898
104970
  }
@@ -104902,10 +104974,11 @@ var init_DocTypeReader = __esm({
104902
104974
  else if (xmlData[i4] === "A" && hasSeq(xmlData, "NY", i4)) i4 += 2;
104903
104975
  else if (xmlData[i4] === "(") {
104904
104976
  i4++;
104977
+ const startIndex2 = i4;
104905
104978
  while (i4 < xmlData.length && xmlData[i4] !== ")") {
104906
- contentModel += xmlData[i4];
104907
104979
  i4++;
104908
104980
  }
104981
+ contentModel = xmlData.substring(startIndex2, i4);
104909
104982
  if (xmlData[i4] !== ")") {
104910
104983
  throw new Error("Unterminated content model");
104911
104984
  }
@@ -104920,18 +104993,18 @@ var init_DocTypeReader = __esm({
104920
104993
  }
104921
104994
  readAttlistExp(xmlData, i4) {
104922
104995
  i4 = skipWhitespace(xmlData, i4);
104923
- let elementName = "";
104996
+ let startIndex = i4;
104924
104997
  while (i4 < xmlData.length && !/\s/.test(xmlData[i4])) {
104925
- elementName += xmlData[i4];
104926
104998
  i4++;
104927
104999
  }
105000
+ let elementName = xmlData.substring(startIndex, i4);
104928
105001
  validateEntityName(elementName);
104929
105002
  i4 = skipWhitespace(xmlData, i4);
104930
- let attributeName = "";
105003
+ startIndex = i4;
104931
105004
  while (i4 < xmlData.length && !/\s/.test(xmlData[i4])) {
104932
- attributeName += xmlData[i4];
104933
105005
  i4++;
104934
105006
  }
105007
+ let attributeName = xmlData.substring(startIndex, i4);
104935
105008
  if (!validateEntityName(attributeName)) {
104936
105009
  throw new Error(`Invalid attribute name: "${attributeName}"`);
104937
105010
  }
@@ -104947,11 +105020,11 @@ var init_DocTypeReader = __esm({
104947
105020
  i4++;
104948
105021
  let allowedNotations = [];
104949
105022
  while (i4 < xmlData.length && xmlData[i4] !== ")") {
104950
- let notation = "";
105023
+ const startIndex2 = i4;
104951
105024
  while (i4 < xmlData.length && xmlData[i4] !== "|" && xmlData[i4] !== ")") {
104952
- notation += xmlData[i4];
104953
105025
  i4++;
104954
105026
  }
105027
+ let notation = xmlData.substring(startIndex2, i4);
104955
105028
  notation = notation.trim();
104956
105029
  if (!validateEntityName(notation)) {
104957
105030
  throw new Error(`Invalid notation name: "${notation}"`);
@@ -104968,10 +105041,11 @@ var init_DocTypeReader = __esm({
104968
105041
  i4++;
104969
105042
  attributeType += " (" + allowedNotations.join("|") + ")";
104970
105043
  } else {
105044
+ const startIndex2 = i4;
104971
105045
  while (i4 < xmlData.length && !/\s/.test(xmlData[i4])) {
104972
- attributeType += xmlData[i4];
104973
105046
  i4++;
104974
105047
  }
105048
+ attributeType += xmlData.substring(startIndex2, i4);
104975
105049
  const validTypes = ["CDATA", "ID", "IDREF", "IDREFS", "ENTITY", "ENTITIES", "NMTOKEN", "NMTOKENS"];
104976
105050
  if (!this.suppressValidationErr && !validTypes.includes(attributeType.toUpperCase())) {
104977
105051
  throw new Error(`Invalid attribute type: "${attributeType}"`);
@@ -105006,7 +105080,7 @@ var init_DocTypeReader = __esm({
105006
105080
  }
105007
105081
  });
105008
105082
 
105009
- // node_modules/.pnpm/strnum@2.1.2/node_modules/strnum/strnum.js
105083
+ // node_modules/.pnpm/strnum@2.2.1/node_modules/strnum/strnum.js
105010
105084
  function toNumber2(str2, options = {}) {
105011
105085
  options = Object.assign({}, consider, options);
105012
105086
  if (!str2 || typeof str2 !== "string") return str2;
@@ -105015,6 +105089,8 @@ function toNumber2(str2, options = {}) {
105015
105089
  else if (str2 === "0") return 0;
105016
105090
  else if (options.hex && hexRegex.test(trimmedStr)) {
105017
105091
  return parse_int(trimmedStr, 16);
105092
+ } else if (!isFinite(trimmedStr)) {
105093
+ return handleInfinity(str2, Number(trimmedStr), options);
105018
105094
  } else if (trimmedStr.includes("e") || trimmedStr.includes("E")) {
105019
105095
  return resolveEnotation(str2, trimmedStr, options);
105020
105096
  } else {
@@ -105068,10 +105144,14 @@ function resolveEnotation(str2, trimmedStr, options) {
105068
105144
  if (leadingZeros.length > 1 && eAdjacentToLeadingZeros) return str2;
105069
105145
  else if (leadingZeros.length === 1 && (notation[3].startsWith(`.${eChar}`) || notation[3][0] === eChar)) {
105070
105146
  return Number(trimmedStr);
105071
- } else if (options.leadingZeros && !eAdjacentToLeadingZeros) {
105072
- trimmedStr = (notation[1] || "") + notation[3];
105147
+ } else if (leadingZeros.length > 0) {
105148
+ if (options.leadingZeros && !eAdjacentToLeadingZeros) {
105149
+ trimmedStr = (notation[1] || "") + notation[3];
105150
+ return Number(trimmedStr);
105151
+ } else return str2;
105152
+ } else {
105073
105153
  return Number(trimmedStr);
105074
- } else return str2;
105154
+ }
105075
105155
  } else {
105076
105156
  return str2;
105077
105157
  }
@@ -105092,9 +105172,24 @@ function parse_int(numStr, base) {
105092
105172
  else if (window && window.parseInt) return window.parseInt(numStr, base);
105093
105173
  else throw new Error("parseInt, Number.parseInt, window.parseInt are not supported");
105094
105174
  }
105175
+ function handleInfinity(str2, num, options) {
105176
+ const isPositive = num === Infinity;
105177
+ switch (options.infinity.toLowerCase()) {
105178
+ case "null":
105179
+ return null;
105180
+ case "infinity":
105181
+ return num;
105182
+ // Return Infinity or -Infinity
105183
+ case "string":
105184
+ return isPositive ? "Infinity" : "-Infinity";
105185
+ case "original":
105186
+ default:
105187
+ return str2;
105188
+ }
105189
+ }
105095
105190
  var hexRegex, numRegex, consider, eNotationRegx;
105096
105191
  var init_strnum = __esm({
105097
- "node_modules/.pnpm/strnum@2.1.2/node_modules/strnum/strnum.js"() {
105192
+ "node_modules/.pnpm/strnum@2.2.1/node_modules/strnum/strnum.js"() {
105098
105193
  init_import_meta_url();
105099
105194
  hexRegex = /^[-+]?0x[a-fA-F0-9]+$/;
105100
105195
  numRegex = /^([\-\+])?(0*)([0-9]*(\.[0-9]*)?)$/;
@@ -105103,14 +105198,16 @@ var init_strnum = __esm({
105103
105198
  // oct: false,
105104
105199
  leadingZeros: true,
105105
105200
  decimalPoint: ".",
105106
- eNotation: true
105107
- //skipLike: /regex/
105201
+ eNotation: true,
105202
+ //skipLike: /regex/,
105203
+ infinity: "original"
105204
+ // "null", "infinity" (Infinity type), "string" ("Infinity" (the string literal))
105108
105205
  };
105109
105206
  eNotationRegx = /^([-+])?(0*)(\d*(\.\d*)?[eE][-\+]?\d+)$/;
105110
105207
  }
105111
105208
  });
105112
105209
 
105113
- // node_modules/.pnpm/fast-xml-parser@5.3.8/node_modules/fast-xml-parser/src/ignoreAttributes.js
105210
+ // node_modules/.pnpm/fast-xml-parser@5.5.7/node_modules/fast-xml-parser/src/ignoreAttributes.js
105114
105211
  function getIgnoreAttributesFn(ignoreAttributes) {
105115
105212
  if (typeof ignoreAttributes === "function") {
105116
105213
  return ignoreAttributes;
@@ -105130,12 +105227,532 @@ function getIgnoreAttributesFn(ignoreAttributes) {
105130
105227
  return () => false;
105131
105228
  }
105132
105229
  var init_ignoreAttributes = __esm({
105133
- "node_modules/.pnpm/fast-xml-parser@5.3.8/node_modules/fast-xml-parser/src/ignoreAttributes.js"() {
105230
+ "node_modules/.pnpm/fast-xml-parser@5.5.7/node_modules/fast-xml-parser/src/ignoreAttributes.js"() {
105231
+ init_import_meta_url();
105232
+ }
105233
+ });
105234
+
105235
+ // node_modules/.pnpm/path-expression-matcher@1.1.3/node_modules/path-expression-matcher/src/Expression.js
105236
+ var Expression;
105237
+ var init_Expression = __esm({
105238
+ "node_modules/.pnpm/path-expression-matcher@1.1.3/node_modules/path-expression-matcher/src/Expression.js"() {
105239
+ init_import_meta_url();
105240
+ Expression = class {
105241
+ /**
105242
+ * Create a new Expression
105243
+ * @param {string} pattern - Pattern string (e.g., "root.users.user", "..user[id]")
105244
+ * @param {Object} options - Configuration options
105245
+ * @param {string} options.separator - Path separator (default: '.')
105246
+ */
105247
+ constructor(pattern, options = {}) {
105248
+ this.pattern = pattern;
105249
+ this.separator = options.separator || ".";
105250
+ this.segments = this._parse(pattern);
105251
+ this._hasDeepWildcard = this.segments.some((seg) => seg.type === "deep-wildcard");
105252
+ this._hasAttributeCondition = this.segments.some((seg) => seg.attrName !== void 0);
105253
+ this._hasPositionSelector = this.segments.some((seg) => seg.position !== void 0);
105254
+ }
105255
+ /**
105256
+ * Parse pattern string into segments
105257
+ * @private
105258
+ * @param {string} pattern - Pattern to parse
105259
+ * @returns {Array} Array of segment objects
105260
+ */
105261
+ _parse(pattern) {
105262
+ const segments = [];
105263
+ let i4 = 0;
105264
+ let currentPart = "";
105265
+ while (i4 < pattern.length) {
105266
+ if (pattern[i4] === this.separator) {
105267
+ if (i4 + 1 < pattern.length && pattern[i4 + 1] === this.separator) {
105268
+ if (currentPart.trim()) {
105269
+ segments.push(this._parseSegment(currentPart.trim()));
105270
+ currentPart = "";
105271
+ }
105272
+ segments.push({ type: "deep-wildcard" });
105273
+ i4 += 2;
105274
+ } else {
105275
+ if (currentPart.trim()) {
105276
+ segments.push(this._parseSegment(currentPart.trim()));
105277
+ }
105278
+ currentPart = "";
105279
+ i4++;
105280
+ }
105281
+ } else {
105282
+ currentPart += pattern[i4];
105283
+ i4++;
105284
+ }
105285
+ }
105286
+ if (currentPart.trim()) {
105287
+ segments.push(this._parseSegment(currentPart.trim()));
105288
+ }
105289
+ return segments;
105290
+ }
105291
+ /**
105292
+ * Parse a single segment
105293
+ * @private
105294
+ * @param {string} part - Segment string (e.g., "user", "ns::user", "user[id]", "ns::user:first")
105295
+ * @returns {Object} Segment object
105296
+ */
105297
+ _parseSegment(part) {
105298
+ const segment = { type: "tag" };
105299
+ let bracketContent = null;
105300
+ let withoutBrackets = part;
105301
+ const bracketMatch = part.match(/^([^\[]+)(\[[^\]]*\])(.*)$/);
105302
+ if (bracketMatch) {
105303
+ withoutBrackets = bracketMatch[1] + bracketMatch[3];
105304
+ if (bracketMatch[2]) {
105305
+ const content = bracketMatch[2].slice(1, -1);
105306
+ if (content) {
105307
+ bracketContent = content;
105308
+ }
105309
+ }
105310
+ }
105311
+ let namespace = void 0;
105312
+ let tagAndPosition = withoutBrackets;
105313
+ if (withoutBrackets.includes("::")) {
105314
+ const nsIndex = withoutBrackets.indexOf("::");
105315
+ namespace = withoutBrackets.substring(0, nsIndex).trim();
105316
+ tagAndPosition = withoutBrackets.substring(nsIndex + 2).trim();
105317
+ if (!namespace) {
105318
+ throw new Error(`Invalid namespace in pattern: ${part}`);
105319
+ }
105320
+ }
105321
+ let tag2 = void 0;
105322
+ let positionMatch = null;
105323
+ if (tagAndPosition.includes(":")) {
105324
+ const colonIndex = tagAndPosition.lastIndexOf(":");
105325
+ const tagPart = tagAndPosition.substring(0, colonIndex).trim();
105326
+ const posPart = tagAndPosition.substring(colonIndex + 1).trim();
105327
+ const isPositionKeyword = ["first", "last", "odd", "even"].includes(posPart) || /^nth\(\d+\)$/.test(posPart);
105328
+ if (isPositionKeyword) {
105329
+ tag2 = tagPart;
105330
+ positionMatch = posPart;
105331
+ } else {
105332
+ tag2 = tagAndPosition;
105333
+ }
105334
+ } else {
105335
+ tag2 = tagAndPosition;
105336
+ }
105337
+ if (!tag2) {
105338
+ throw new Error(`Invalid segment pattern: ${part}`);
105339
+ }
105340
+ segment.tag = tag2;
105341
+ if (namespace) {
105342
+ segment.namespace = namespace;
105343
+ }
105344
+ if (bracketContent) {
105345
+ if (bracketContent.includes("=")) {
105346
+ const eqIndex = bracketContent.indexOf("=");
105347
+ segment.attrName = bracketContent.substring(0, eqIndex).trim();
105348
+ segment.attrValue = bracketContent.substring(eqIndex + 1).trim();
105349
+ } else {
105350
+ segment.attrName = bracketContent.trim();
105351
+ }
105352
+ }
105353
+ if (positionMatch) {
105354
+ const nthMatch = positionMatch.match(/^nth\((\d+)\)$/);
105355
+ if (nthMatch) {
105356
+ segment.position = "nth";
105357
+ segment.positionValue = parseInt(nthMatch[1], 10);
105358
+ } else {
105359
+ segment.position = positionMatch;
105360
+ }
105361
+ }
105362
+ return segment;
105363
+ }
105364
+ /**
105365
+ * Get the number of segments
105366
+ * @returns {number}
105367
+ */
105368
+ get length() {
105369
+ return this.segments.length;
105370
+ }
105371
+ /**
105372
+ * Check if expression contains deep wildcard
105373
+ * @returns {boolean}
105374
+ */
105375
+ hasDeepWildcard() {
105376
+ return this._hasDeepWildcard;
105377
+ }
105378
+ /**
105379
+ * Check if expression has attribute conditions
105380
+ * @returns {boolean}
105381
+ */
105382
+ hasAttributeCondition() {
105383
+ return this._hasAttributeCondition;
105384
+ }
105385
+ /**
105386
+ * Check if expression has position selectors
105387
+ * @returns {boolean}
105388
+ */
105389
+ hasPositionSelector() {
105390
+ return this._hasPositionSelector;
105391
+ }
105392
+ /**
105393
+ * Get string representation
105394
+ * @returns {string}
105395
+ */
105396
+ toString() {
105397
+ return this.pattern;
105398
+ }
105399
+ };
105400
+ }
105401
+ });
105402
+
105403
+ // node_modules/.pnpm/path-expression-matcher@1.1.3/node_modules/path-expression-matcher/src/Matcher.js
105404
+ var Matcher;
105405
+ var init_Matcher = __esm({
105406
+ "node_modules/.pnpm/path-expression-matcher@1.1.3/node_modules/path-expression-matcher/src/Matcher.js"() {
105407
+ init_import_meta_url();
105408
+ Matcher = class {
105409
+ /**
105410
+ * Create a new Matcher
105411
+ * @param {Object} options - Configuration options
105412
+ * @param {string} options.separator - Default path separator (default: '.')
105413
+ */
105414
+ constructor(options = {}) {
105415
+ this.separator = options.separator || ".";
105416
+ this.path = [];
105417
+ this.siblingStacks = [];
105418
+ }
105419
+ /**
105420
+ * Push a new tag onto the path
105421
+ * @param {string} tagName - Name of the tag
105422
+ * @param {Object} attrValues - Attribute key-value pairs for current node (optional)
105423
+ * @param {string} namespace - Namespace for the tag (optional)
105424
+ */
105425
+ push(tagName, attrValues = null, namespace = null) {
105426
+ if (this.path.length > 0) {
105427
+ const prev = this.path[this.path.length - 1];
105428
+ prev.values = void 0;
105429
+ }
105430
+ const currentLevel = this.path.length;
105431
+ if (!this.siblingStacks[currentLevel]) {
105432
+ this.siblingStacks[currentLevel] = /* @__PURE__ */ new Map();
105433
+ }
105434
+ const siblings = this.siblingStacks[currentLevel];
105435
+ const siblingKey = namespace ? `${namespace}:${tagName}` : tagName;
105436
+ const counter = siblings.get(siblingKey) || 0;
105437
+ let position = 0;
105438
+ for (const count of siblings.values()) {
105439
+ position += count;
105440
+ }
105441
+ siblings.set(siblingKey, counter + 1);
105442
+ const node2 = {
105443
+ tag: tagName,
105444
+ position,
105445
+ counter
105446
+ };
105447
+ if (namespace !== null && namespace !== void 0) {
105448
+ node2.namespace = namespace;
105449
+ }
105450
+ if (attrValues !== null && attrValues !== void 0) {
105451
+ node2.values = attrValues;
105452
+ }
105453
+ this.path.push(node2);
105454
+ }
105455
+ /**
105456
+ * Pop the last tag from the path
105457
+ * @returns {Object|undefined} The popped node
105458
+ */
105459
+ pop() {
105460
+ if (this.path.length === 0) {
105461
+ return void 0;
105462
+ }
105463
+ const node2 = this.path.pop();
105464
+ if (this.siblingStacks.length > this.path.length + 1) {
105465
+ this.siblingStacks.length = this.path.length + 1;
105466
+ }
105467
+ return node2;
105468
+ }
105469
+ /**
105470
+ * Update current node's attribute values
105471
+ * Useful when attributes are parsed after push
105472
+ * @param {Object} attrValues - Attribute values
105473
+ */
105474
+ updateCurrent(attrValues) {
105475
+ if (this.path.length > 0) {
105476
+ const current = this.path[this.path.length - 1];
105477
+ if (attrValues !== null && attrValues !== void 0) {
105478
+ current.values = attrValues;
105479
+ }
105480
+ }
105481
+ }
105482
+ /**
105483
+ * Get current tag name
105484
+ * @returns {string|undefined}
105485
+ */
105486
+ getCurrentTag() {
105487
+ return this.path.length > 0 ? this.path[this.path.length - 1].tag : void 0;
105488
+ }
105489
+ /**
105490
+ * Get current namespace
105491
+ * @returns {string|undefined}
105492
+ */
105493
+ getCurrentNamespace() {
105494
+ return this.path.length > 0 ? this.path[this.path.length - 1].namespace : void 0;
105495
+ }
105496
+ /**
105497
+ * Get current node's attribute value
105498
+ * @param {string} attrName - Attribute name
105499
+ * @returns {*} Attribute value or undefined
105500
+ */
105501
+ getAttrValue(attrName) {
105502
+ if (this.path.length === 0) return void 0;
105503
+ const current = this.path[this.path.length - 1];
105504
+ return current.values?.[attrName];
105505
+ }
105506
+ /**
105507
+ * Check if current node has an attribute
105508
+ * @param {string} attrName - Attribute name
105509
+ * @returns {boolean}
105510
+ */
105511
+ hasAttr(attrName) {
105512
+ if (this.path.length === 0) return false;
105513
+ const current = this.path[this.path.length - 1];
105514
+ return current.values !== void 0 && attrName in current.values;
105515
+ }
105516
+ /**
105517
+ * Get current node's sibling position (child index in parent)
105518
+ * @returns {number}
105519
+ */
105520
+ getPosition() {
105521
+ if (this.path.length === 0) return -1;
105522
+ return this.path[this.path.length - 1].position ?? 0;
105523
+ }
105524
+ /**
105525
+ * Get current node's repeat counter (occurrence count of this tag name)
105526
+ * @returns {number}
105527
+ */
105528
+ getCounter() {
105529
+ if (this.path.length === 0) return -1;
105530
+ return this.path[this.path.length - 1].counter ?? 0;
105531
+ }
105532
+ /**
105533
+ * Get current node's sibling index (alias for getPosition for backward compatibility)
105534
+ * @returns {number}
105535
+ * @deprecated Use getPosition() or getCounter() instead
105536
+ */
105537
+ getIndex() {
105538
+ return this.getPosition();
105539
+ }
105540
+ /**
105541
+ * Get current path depth
105542
+ * @returns {number}
105543
+ */
105544
+ getDepth() {
105545
+ return this.path.length;
105546
+ }
105547
+ /**
105548
+ * Get path as string
105549
+ * @param {string} separator - Optional separator (uses default if not provided)
105550
+ * @param {boolean} includeNamespace - Whether to include namespace in output (default: true)
105551
+ * @returns {string}
105552
+ */
105553
+ toString(separator, includeNamespace = true) {
105554
+ const sep4 = separator || this.separator;
105555
+ return this.path.map((n4) => {
105556
+ if (includeNamespace && n4.namespace) {
105557
+ return `${n4.namespace}:${n4.tag}`;
105558
+ }
105559
+ return n4.tag;
105560
+ }).join(sep4);
105561
+ }
105562
+ /**
105563
+ * Get path as array of tag names
105564
+ * @returns {string[]}
105565
+ */
105566
+ toArray() {
105567
+ return this.path.map((n4) => n4.tag);
105568
+ }
105569
+ /**
105570
+ * Reset the path to empty
105571
+ */
105572
+ reset() {
105573
+ this.path = [];
105574
+ this.siblingStacks = [];
105575
+ }
105576
+ /**
105577
+ * Match current path against an Expression
105578
+ * @param {Expression} expression - The expression to match against
105579
+ * @returns {boolean} True if current path matches the expression
105580
+ */
105581
+ matches(expression) {
105582
+ const segments = expression.segments;
105583
+ if (segments.length === 0) {
105584
+ return false;
105585
+ }
105586
+ if (expression.hasDeepWildcard()) {
105587
+ return this._matchWithDeepWildcard(segments);
105588
+ }
105589
+ return this._matchSimple(segments);
105590
+ }
105591
+ /**
105592
+ * Match simple path (no deep wildcards)
105593
+ * @private
105594
+ */
105595
+ _matchSimple(segments) {
105596
+ if (this.path.length !== segments.length) {
105597
+ return false;
105598
+ }
105599
+ for (let i4 = 0; i4 < segments.length; i4++) {
105600
+ const segment = segments[i4];
105601
+ const node2 = this.path[i4];
105602
+ const isCurrentNode = i4 === this.path.length - 1;
105603
+ if (!this._matchSegment(segment, node2, isCurrentNode)) {
105604
+ return false;
105605
+ }
105606
+ }
105607
+ return true;
105608
+ }
105609
+ /**
105610
+ * Match path with deep wildcards
105611
+ * @private
105612
+ */
105613
+ _matchWithDeepWildcard(segments) {
105614
+ let pathIdx = this.path.length - 1;
105615
+ let segIdx = segments.length - 1;
105616
+ while (segIdx >= 0 && pathIdx >= 0) {
105617
+ const segment = segments[segIdx];
105618
+ if (segment.type === "deep-wildcard") {
105619
+ segIdx--;
105620
+ if (segIdx < 0) {
105621
+ return true;
105622
+ }
105623
+ const nextSeg = segments[segIdx];
105624
+ let found = false;
105625
+ for (let i4 = pathIdx; i4 >= 0; i4--) {
105626
+ const isCurrentNode = i4 === this.path.length - 1;
105627
+ if (this._matchSegment(nextSeg, this.path[i4], isCurrentNode)) {
105628
+ pathIdx = i4 - 1;
105629
+ segIdx--;
105630
+ found = true;
105631
+ break;
105632
+ }
105633
+ }
105634
+ if (!found) {
105635
+ return false;
105636
+ }
105637
+ } else {
105638
+ const isCurrentNode = pathIdx === this.path.length - 1;
105639
+ if (!this._matchSegment(segment, this.path[pathIdx], isCurrentNode)) {
105640
+ return false;
105641
+ }
105642
+ pathIdx--;
105643
+ segIdx--;
105644
+ }
105645
+ }
105646
+ return segIdx < 0;
105647
+ }
105648
+ /**
105649
+ * Match a single segment against a node
105650
+ * @private
105651
+ * @param {Object} segment - Segment from Expression
105652
+ * @param {Object} node - Node from path
105653
+ * @param {boolean} isCurrentNode - Whether this is the current (last) node
105654
+ * @returns {boolean}
105655
+ */
105656
+ _matchSegment(segment, node2, isCurrentNode) {
105657
+ if (segment.tag !== "*" && segment.tag !== node2.tag) {
105658
+ return false;
105659
+ }
105660
+ if (segment.namespace !== void 0) {
105661
+ if (segment.namespace !== "*" && segment.namespace !== node2.namespace) {
105662
+ return false;
105663
+ }
105664
+ }
105665
+ if (segment.attrName !== void 0) {
105666
+ if (!isCurrentNode) {
105667
+ return false;
105668
+ }
105669
+ if (!node2.values || !(segment.attrName in node2.values)) {
105670
+ return false;
105671
+ }
105672
+ if (segment.attrValue !== void 0) {
105673
+ const actualValue = node2.values[segment.attrName];
105674
+ if (String(actualValue) !== String(segment.attrValue)) {
105675
+ return false;
105676
+ }
105677
+ }
105678
+ }
105679
+ if (segment.position !== void 0) {
105680
+ if (!isCurrentNode) {
105681
+ return false;
105682
+ }
105683
+ const counter = node2.counter ?? 0;
105684
+ if (segment.position === "first" && counter !== 0) {
105685
+ return false;
105686
+ } else if (segment.position === "odd" && counter % 2 !== 1) {
105687
+ return false;
105688
+ } else if (segment.position === "even" && counter % 2 !== 0) {
105689
+ return false;
105690
+ } else if (segment.position === "nth") {
105691
+ if (counter !== segment.positionValue) {
105692
+ return false;
105693
+ }
105694
+ }
105695
+ }
105696
+ return true;
105697
+ }
105698
+ /**
105699
+ * Create a snapshot of current state
105700
+ * @returns {Object} State snapshot
105701
+ */
105702
+ snapshot() {
105703
+ return {
105704
+ path: this.path.map((node2) => ({ ...node2 })),
105705
+ siblingStacks: this.siblingStacks.map((map3) => new Map(map3))
105706
+ };
105707
+ }
105708
+ /**
105709
+ * Restore state from snapshot
105710
+ * @param {Object} snapshot - State snapshot
105711
+ */
105712
+ restore(snapshot) {
105713
+ this.path = snapshot.path.map((node2) => ({ ...node2 }));
105714
+ this.siblingStacks = snapshot.siblingStacks.map((map3) => new Map(map3));
105715
+ }
105716
+ };
105717
+ }
105718
+ });
105719
+
105720
+ // node_modules/.pnpm/path-expression-matcher@1.1.3/node_modules/path-expression-matcher/src/index.js
105721
+ var init_src = __esm({
105722
+ "node_modules/.pnpm/path-expression-matcher@1.1.3/node_modules/path-expression-matcher/src/index.js"() {
105134
105723
  init_import_meta_url();
105724
+ init_Expression();
105725
+ init_Matcher();
105135
105726
  }
105136
105727
  });
105137
105728
 
105138
- // node_modules/.pnpm/fast-xml-parser@5.3.8/node_modules/fast-xml-parser/src/xmlparser/OrderedObjParser.js
105729
+ // node_modules/.pnpm/fast-xml-parser@5.5.7/node_modules/fast-xml-parser/src/xmlparser/OrderedObjParser.js
105730
+ function extractRawAttributes(prefixedAttrs, options) {
105731
+ if (!prefixedAttrs) return {};
105732
+ const attrs = options.attributesGroupName ? prefixedAttrs[options.attributesGroupName] : prefixedAttrs;
105733
+ if (!attrs) return {};
105734
+ const rawAttrs = {};
105735
+ for (const key in attrs) {
105736
+ if (key.startsWith(options.attributeNamePrefix)) {
105737
+ const rawName = key.substring(options.attributeNamePrefix.length);
105738
+ rawAttrs[rawName] = attrs[key];
105739
+ } else {
105740
+ rawAttrs[key] = attrs[key];
105741
+ }
105742
+ }
105743
+ return rawAttrs;
105744
+ }
105745
+ function extractNamespace(rawTagName) {
105746
+ if (!rawTagName || typeof rawTagName !== "string") return void 0;
105747
+ const colonIndex = rawTagName.indexOf(":");
105748
+ if (colonIndex !== -1 && colonIndex > 0) {
105749
+ const ns2 = rawTagName.substring(0, colonIndex);
105750
+ if (ns2 !== "xmlns") {
105751
+ return ns2;
105752
+ }
105753
+ }
105754
+ return void 0;
105755
+ }
105139
105756
  function addExternalEntities(externalEntities) {
105140
105757
  const entKeys = Object.keys(externalEntities);
105141
105758
  for (let i4 = 0; i4 < entKeys.length; i4++) {
@@ -105154,7 +105771,8 @@ function parseTextData(val, tagName, jPath, dontTrim, hasAttributes, isLeafNode,
105154
105771
  }
105155
105772
  if (val.length > 0) {
105156
105773
  if (!escapeEntities) val = this.replaceEntitiesValue(val, tagName, jPath);
105157
- const newval = this.options.tagValueProcessor(tagName, val, jPath, hasAttributes, isLeafNode);
105774
+ const jPathOrMatcher = this.options.jPath ? jPath.toString() : jPath;
105775
+ const newval = this.options.tagValueProcessor(tagName, val, jPathOrMatcher, hasAttributes, isLeafNode);
105158
105776
  if (newval === null || newval === void 0) {
105159
105777
  return val;
105160
105778
  } else if (typeof newval !== typeof val || newval !== val) {
@@ -105190,9 +105808,26 @@ function buildAttributesMap(attrStr, jPath, tagName) {
105190
105808
  const matches = getAllMatches(attrStr, attrsRegx);
105191
105809
  const len = matches.length;
105192
105810
  const attrs = {};
105811
+ const rawAttrsForMatcher = {};
105812
+ for (let i4 = 0; i4 < len; i4++) {
105813
+ const attrName = this.resolveNameSpace(matches[i4][1]);
105814
+ const oldVal = matches[i4][4];
105815
+ if (attrName.length && oldVal !== void 0) {
105816
+ let parsedVal = oldVal;
105817
+ if (this.options.trimValues) {
105818
+ parsedVal = parsedVal.trim();
105819
+ }
105820
+ parsedVal = this.replaceEntitiesValue(parsedVal, tagName, jPath);
105821
+ rawAttrsForMatcher[attrName] = parsedVal;
105822
+ }
105823
+ }
105824
+ if (Object.keys(rawAttrsForMatcher).length > 0 && typeof jPath === "object" && jPath.updateCurrent) {
105825
+ jPath.updateCurrent(rawAttrsForMatcher);
105826
+ }
105193
105827
  for (let i4 = 0; i4 < len; i4++) {
105194
105828
  const attrName = this.resolveNameSpace(matches[i4][1]);
105195
- if (this.ignoreAttributesFn(attrName, jPath)) {
105829
+ const jPathStr = this.options.jPath ? jPath.toString() : jPath;
105830
+ if (this.ignoreAttributesFn(attrName, jPathStr)) {
105196
105831
  continue;
105197
105832
  }
105198
105833
  let oldVal = matches[i4][4];
@@ -105201,13 +105836,14 @@ function buildAttributesMap(attrStr, jPath, tagName) {
105201
105836
  if (this.options.transformAttributeName) {
105202
105837
  aName = this.options.transformAttributeName(aName);
105203
105838
  }
105204
- if (aName === "__proto__") aName = "#__proto__";
105839
+ aName = sanitizeName(aName, this.options);
105205
105840
  if (oldVal !== void 0) {
105206
105841
  if (this.options.trimValues) {
105207
105842
  oldVal = oldVal.trim();
105208
105843
  }
105209
105844
  oldVal = this.replaceEntitiesValue(oldVal, tagName, jPath);
105210
- const newVal = this.options.attributeValueProcessor(attrName, oldVal, jPath);
105845
+ const jPathOrMatcher = this.options.jPath ? jPath.toString() : jPath;
105846
+ const newVal = this.options.attributeValueProcessor(attrName, oldVal, jPathOrMatcher);
105211
105847
  if (newVal === null || newVal === void 0) {
105212
105848
  attrs[aName] = oldVal;
105213
105849
  } else if (typeof newVal !== typeof oldVal || newVal !== oldVal) {
@@ -105235,9 +105871,10 @@ function buildAttributesMap(attrStr, jPath, tagName) {
105235
105871
  return attrs;
105236
105872
  }
105237
105873
  }
105238
- function addChild(currentNode, childNode, jPath, startIndex) {
105874
+ function addChild(currentNode, childNode, matcher, startIndex) {
105239
105875
  if (!this.options.captureMetaData) startIndex = void 0;
105240
- const result = this.options.updateTag(childNode.tagname, jPath, childNode[":@"]);
105876
+ const jPathOrMatcher = this.options.jPath ? matcher.toString() : matcher;
105877
+ const result = this.options.updateTag(childNode.tagname, jPathOrMatcher, childNode[":@"]);
105241
105878
  if (result === false) {
105242
105879
  } else if (typeof result === "string") {
105243
105880
  childNode.tagname = result;
@@ -105246,26 +105883,102 @@ function addChild(currentNode, childNode, jPath, startIndex) {
105246
105883
  currentNode.addChild(childNode, startIndex);
105247
105884
  }
105248
105885
  }
105249
- function saveTextToParentTag(textData, currentNode, jPath, isLeafNode) {
105886
+ function replaceEntitiesValue(val, tagName, jPath) {
105887
+ const entityConfig = this.options.processEntities;
105888
+ if (!entityConfig || !entityConfig.enabled) {
105889
+ return val;
105890
+ }
105891
+ if (entityConfig.allowedTags) {
105892
+ const jPathOrMatcher = this.options.jPath ? jPath.toString() : jPath;
105893
+ const allowed = Array.isArray(entityConfig.allowedTags) ? entityConfig.allowedTags.includes(tagName) : entityConfig.allowedTags(tagName, jPathOrMatcher);
105894
+ if (!allowed) {
105895
+ return val;
105896
+ }
105897
+ }
105898
+ if (entityConfig.tagFilter) {
105899
+ const jPathOrMatcher = this.options.jPath ? jPath.toString() : jPath;
105900
+ if (!entityConfig.tagFilter(tagName, jPathOrMatcher)) {
105901
+ return val;
105902
+ }
105903
+ }
105904
+ for (const entityName of Object.keys(this.docTypeEntities)) {
105905
+ const entity = this.docTypeEntities[entityName];
105906
+ const matches = val.match(entity.regx);
105907
+ if (matches) {
105908
+ this.entityExpansionCount += matches.length;
105909
+ if (entityConfig.maxTotalExpansions && this.entityExpansionCount > entityConfig.maxTotalExpansions) {
105910
+ throw new Error(
105911
+ `Entity expansion limit exceeded: ${this.entityExpansionCount} > ${entityConfig.maxTotalExpansions}`
105912
+ );
105913
+ }
105914
+ const lengthBefore = val.length;
105915
+ val = val.replace(entity.regx, entity.val);
105916
+ if (entityConfig.maxExpandedLength) {
105917
+ this.currentExpandedLength += val.length - lengthBefore;
105918
+ if (this.currentExpandedLength > entityConfig.maxExpandedLength) {
105919
+ throw new Error(
105920
+ `Total expanded content size exceeded: ${this.currentExpandedLength} > ${entityConfig.maxExpandedLength}`
105921
+ );
105922
+ }
105923
+ }
105924
+ }
105925
+ }
105926
+ for (const entityName of Object.keys(this.lastEntities)) {
105927
+ const entity = this.lastEntities[entityName];
105928
+ const matches = val.match(entity.regex);
105929
+ if (matches) {
105930
+ this.entityExpansionCount += matches.length;
105931
+ if (entityConfig.maxTotalExpansions && this.entityExpansionCount > entityConfig.maxTotalExpansions) {
105932
+ throw new Error(
105933
+ `Entity expansion limit exceeded: ${this.entityExpansionCount} > ${entityConfig.maxTotalExpansions}`
105934
+ );
105935
+ }
105936
+ }
105937
+ val = val.replace(entity.regex, entity.val);
105938
+ }
105939
+ if (val.indexOf("&") === -1) return val;
105940
+ if (this.options.htmlEntities) {
105941
+ for (const entityName of Object.keys(this.htmlEntities)) {
105942
+ const entity = this.htmlEntities[entityName];
105943
+ const matches = val.match(entity.regex);
105944
+ if (matches) {
105945
+ this.entityExpansionCount += matches.length;
105946
+ if (entityConfig.maxTotalExpansions && this.entityExpansionCount > entityConfig.maxTotalExpansions) {
105947
+ throw new Error(
105948
+ `Entity expansion limit exceeded: ${this.entityExpansionCount} > ${entityConfig.maxTotalExpansions}`
105949
+ );
105950
+ }
105951
+ }
105952
+ val = val.replace(entity.regex, entity.val);
105953
+ }
105954
+ }
105955
+ val = val.replace(this.ampEntity.regex, this.ampEntity.val);
105956
+ return val;
105957
+ }
105958
+ function saveTextToParentTag(textData, parentNode, matcher, isLeafNode) {
105250
105959
  if (textData) {
105251
- if (isLeafNode === void 0) isLeafNode = currentNode.child.length === 0;
105960
+ if (isLeafNode === void 0) isLeafNode = parentNode.child.length === 0;
105252
105961
  textData = this.parseTextData(
105253
105962
  textData,
105254
- currentNode.tagname,
105255
- jPath,
105963
+ parentNode.tagname,
105964
+ matcher,
105256
105965
  false,
105257
- currentNode[":@"] ? Object.keys(currentNode[":@"]).length !== 0 : false,
105966
+ parentNode[":@"] ? Object.keys(parentNode[":@"]).length !== 0 : false,
105258
105967
  isLeafNode
105259
105968
  );
105260
105969
  if (textData !== void 0 && textData !== "")
105261
- currentNode.add(this.options.textNodeName, textData);
105970
+ parentNode.add(this.options.textNodeName, textData);
105262
105971
  textData = "";
105263
105972
  }
105264
105973
  return textData;
105265
105974
  }
105266
- function isItStopNode(stopNodesExact, stopNodesWildcard, jPath, currentTagName) {
105267
- if (stopNodesWildcard && stopNodesWildcard.has(currentTagName)) return true;
105268
- if (stopNodesExact && stopNodesExact.has(jPath)) return true;
105975
+ function isItStopNode(stopNodeExpressions, matcher) {
105976
+ if (!stopNodeExpressions || stopNodeExpressions.length === 0) return false;
105977
+ for (let i4 = 0; i4 < stopNodeExpressions.length; i4++) {
105978
+ if (matcher.matches(stopNodeExpressions[i4])) {
105979
+ return true;
105980
+ }
105981
+ }
105269
105982
  return false;
105270
105983
  }
105271
105984
  function tagExpWithClosingIndex(xmlData, i4, closingChar = ">") {
@@ -105395,9 +106108,28 @@ function fromCodePoint2(str2, base, prefix) {
105395
106108
  return prefix + str2 + ";";
105396
106109
  }
105397
106110
  }
105398
- var OrderedObjParser, attrsRegx, parseXml, replaceEntitiesValue;
106111
+ function transformTagName(fn2, tagName, tagExp, options) {
106112
+ if (fn2) {
106113
+ const newTagName = fn2(tagName);
106114
+ if (tagExp === tagName) {
106115
+ tagExp = newTagName;
106116
+ }
106117
+ tagName = newTagName;
106118
+ }
106119
+ tagName = sanitizeName(tagName, options);
106120
+ return { tagName, tagExp };
106121
+ }
106122
+ function sanitizeName(name, options) {
106123
+ if (criticalProperties.includes(name)) {
106124
+ throw new Error(`[SECURITY] Invalid name: "${name}" is a reserved JavaScript keyword that could cause prototype pollution`);
106125
+ } else if (DANGEROUS_PROPERTY_NAMES.includes(name)) {
106126
+ return options.onDangerousProperty(name);
106127
+ }
106128
+ return name;
106129
+ }
106130
+ var OrderedObjParser, attrsRegx, parseXml;
105399
106131
  var init_OrderedObjParser = __esm({
105400
- "node_modules/.pnpm/fast-xml-parser@5.3.8/node_modules/fast-xml-parser/src/xmlparser/OrderedObjParser.js"() {
106132
+ "node_modules/.pnpm/fast-xml-parser@5.5.7/node_modules/fast-xml-parser/src/xmlparser/OrderedObjParser.js"() {
105401
106133
  "use strict";
105402
106134
  init_import_meta_url();
105403
106135
  init_util5();
@@ -105405,6 +106137,7 @@ var init_OrderedObjParser = __esm({
105405
106137
  init_DocTypeReader();
105406
106138
  init_strnum();
105407
106139
  init_ignoreAttributes();
106140
+ init_src();
105408
106141
  OrderedObjParser = class {
105409
106142
  constructor(options) {
105410
106143
  this.options = options;
@@ -105448,16 +106181,16 @@ var init_OrderedObjParser = __esm({
105448
106181
  this.ignoreAttributesFn = getIgnoreAttributesFn(this.options.ignoreAttributes);
105449
106182
  this.entityExpansionCount = 0;
105450
106183
  this.currentExpandedLength = 0;
106184
+ this.matcher = new Matcher();
106185
+ this.isCurrentNodeStopNode = false;
105451
106186
  if (this.options.stopNodes && this.options.stopNodes.length > 0) {
105452
- this.stopNodesExact = /* @__PURE__ */ new Set();
105453
- this.stopNodesWildcard = /* @__PURE__ */ new Set();
106187
+ this.stopNodeExpressions = [];
105454
106188
  for (let i4 = 0; i4 < this.options.stopNodes.length; i4++) {
105455
106189
  const stopNodeExp = this.options.stopNodes[i4];
105456
- if (typeof stopNodeExp !== "string") continue;
105457
- if (stopNodeExp.startsWith("*.")) {
105458
- this.stopNodesWildcard.add(stopNodeExp.substring(2));
105459
- } else {
105460
- this.stopNodesExact.add(stopNodeExp);
106190
+ if (typeof stopNodeExp === "string") {
106191
+ this.stopNodeExpressions.push(new Expression(stopNodeExp));
106192
+ } else if (stopNodeExp instanceof Expression) {
106193
+ this.stopNodeExpressions.push(stopNodeExp);
105461
106194
  }
105462
106195
  }
105463
106196
  }
@@ -105469,7 +106202,7 @@ var init_OrderedObjParser = __esm({
105469
106202
  const xmlObj = new XmlNode("!xml");
105470
106203
  let currentNode = xmlObj;
105471
106204
  let textData = "";
105472
- let jPath = "";
106205
+ this.matcher.reset();
105473
106206
  this.entityExpansionCount = 0;
105474
106207
  this.currentExpandedLength = 0;
105475
106208
  const docTypeReader = new DocTypeReader(this.options.processEntities);
@@ -105485,46 +106218,42 @@ var init_OrderedObjParser = __esm({
105485
106218
  tagName = tagName.substr(colonIndex + 1);
105486
106219
  }
105487
106220
  }
105488
- if (this.options.transformTagName) {
105489
- tagName = this.options.transformTagName(tagName);
105490
- }
106221
+ tagName = transformTagName(this.options.transformTagName, tagName, "", this.options).tagName;
105491
106222
  if (currentNode) {
105492
- textData = this.saveTextToParentTag(textData, currentNode, jPath);
106223
+ textData = this.saveTextToParentTag(textData, currentNode, this.matcher);
105493
106224
  }
105494
- const lastTagName = jPath.substring(jPath.lastIndexOf(".") + 1);
106225
+ const lastTagName = this.matcher.getCurrentTag();
105495
106226
  if (tagName && this.options.unpairedTags.indexOf(tagName) !== -1) {
105496
106227
  throw new Error(`Unpaired tag can not be used as closing tag: </${tagName}>`);
105497
106228
  }
105498
- let propIndex = 0;
105499
106229
  if (lastTagName && this.options.unpairedTags.indexOf(lastTagName) !== -1) {
105500
- propIndex = jPath.lastIndexOf(".", jPath.lastIndexOf(".") - 1);
106230
+ this.matcher.pop();
105501
106231
  this.tagsNodeStack.pop();
105502
- } else {
105503
- propIndex = jPath.lastIndexOf(".");
105504
106232
  }
105505
- jPath = jPath.substring(0, propIndex);
106233
+ this.matcher.pop();
106234
+ this.isCurrentNodeStopNode = false;
105506
106235
  currentNode = this.tagsNodeStack.pop();
105507
106236
  textData = "";
105508
106237
  i4 = closeIndex;
105509
106238
  } else if (xmlData[i4 + 1] === "?") {
105510
106239
  let tagData = readTagExp(xmlData, i4, false, "?>");
105511
106240
  if (!tagData) throw new Error("Pi Tag is not closed.");
105512
- textData = this.saveTextToParentTag(textData, currentNode, jPath);
106241
+ textData = this.saveTextToParentTag(textData, currentNode, this.matcher);
105513
106242
  if (this.options.ignoreDeclaration && tagData.tagName === "?xml" || this.options.ignorePiTags) {
105514
106243
  } else {
105515
106244
  const childNode = new XmlNode(tagData.tagName);
105516
106245
  childNode.add(this.options.textNodeName, "");
105517
106246
  if (tagData.tagName !== tagData.tagExp && tagData.attrExpPresent) {
105518
- childNode[":@"] = this.buildAttributesMap(tagData.tagExp, jPath, tagData.tagName);
106247
+ childNode[":@"] = this.buildAttributesMap(tagData.tagExp, this.matcher, tagData.tagName);
105519
106248
  }
105520
- this.addChild(currentNode, childNode, jPath, i4);
106249
+ this.addChild(currentNode, childNode, this.matcher, i4);
105521
106250
  }
105522
106251
  i4 = tagData.closeIndex + 1;
105523
106252
  } else if (xmlData.substr(i4 + 1, 3) === "!--") {
105524
106253
  const endIndex = findClosingIndex(xmlData, "-->", i4 + 4, "Comment is not closed.");
105525
106254
  if (this.options.commentPropName) {
105526
106255
  const comment = xmlData.substring(i4 + 4, endIndex - 2);
105527
- textData = this.saveTextToParentTag(textData, currentNode, jPath);
106256
+ textData = this.saveTextToParentTag(textData, currentNode, this.matcher);
105528
106257
  currentNode.add(this.options.commentPropName, [{ [this.options.textNodeName]: comment }]);
105529
106258
  }
105530
106259
  i4 = endIndex;
@@ -105535,8 +106264,8 @@ var init_OrderedObjParser = __esm({
105535
106264
  } else if (xmlData.substr(i4 + 1, 2) === "![") {
105536
106265
  const closeIndex = findClosingIndex(xmlData, "]]>", i4, "CDATA is not closed.") - 2;
105537
106266
  const tagExp = xmlData.substring(i4 + 9, closeIndex);
105538
- textData = this.saveTextToParentTag(textData, currentNode, jPath);
105539
- let val = this.parseTextData(tagExp, currentNode.tagname, jPath, true, false, true, true);
106267
+ textData = this.saveTextToParentTag(textData, currentNode, this.matcher);
106268
+ let val = this.parseTextData(tagExp, currentNode.tagname, this.matcher, true, false, true, true);
105540
106269
  if (val == void 0) val = "";
105541
106270
  if (this.options.cdataPropName) {
105542
106271
  currentNode.add(this.options.cdataPropName, [{ [this.options.textNodeName]: tagExp }]);
@@ -105546,42 +106275,60 @@ var init_OrderedObjParser = __esm({
105546
106275
  i4 = closeIndex + 2;
105547
106276
  } else {
105548
106277
  let result = readTagExp(xmlData, i4, this.options.removeNSPrefix);
106278
+ if (!result) {
106279
+ const context2 = xmlData.substring(Math.max(0, i4 - 50), Math.min(xmlData.length, i4 + 50));
106280
+ throw new Error(`readTagExp returned undefined at position ${i4}. Context: "${context2}"`);
106281
+ }
105549
106282
  let tagName = result.tagName;
105550
106283
  const rawTagName = result.rawTagName;
105551
106284
  let tagExp = result.tagExp;
105552
106285
  let attrExpPresent = result.attrExpPresent;
105553
106286
  let closeIndex = result.closeIndex;
105554
- if (this.options.transformTagName) {
105555
- const newTagName = this.options.transformTagName(tagName);
105556
- if (tagExp === tagName) {
105557
- tagExp = newTagName;
105558
- }
105559
- tagName = newTagName;
106287
+ ({ tagName, tagExp } = transformTagName(this.options.transformTagName, tagName, tagExp, this.options));
106288
+ if (this.options.strictReservedNames && (tagName === this.options.commentPropName || tagName === this.options.cdataPropName || tagName === this.options.textNodeName || tagName === this.options.attributesGroupName)) {
106289
+ throw new Error(`Invalid tag name: ${tagName}`);
105560
106290
  }
105561
106291
  if (currentNode && textData) {
105562
106292
  if (currentNode.tagname !== "!xml") {
105563
- textData = this.saveTextToParentTag(textData, currentNode, jPath, false);
106293
+ textData = this.saveTextToParentTag(textData, currentNode, this.matcher, false);
105564
106294
  }
105565
106295
  }
105566
106296
  const lastTag = currentNode;
105567
106297
  if (lastTag && this.options.unpairedTags.indexOf(lastTag.tagname) !== -1) {
105568
106298
  currentNode = this.tagsNodeStack.pop();
105569
- jPath = jPath.substring(0, jPath.lastIndexOf("."));
106299
+ this.matcher.pop();
106300
+ }
106301
+ let isSelfClosing = false;
106302
+ if (tagExp.length > 0 && tagExp.lastIndexOf("/") === tagExp.length - 1) {
106303
+ isSelfClosing = true;
106304
+ if (tagName[tagName.length - 1] === "/") {
106305
+ tagName = tagName.substr(0, tagName.length - 1);
106306
+ tagExp = tagName;
106307
+ } else {
106308
+ tagExp = tagExp.substr(0, tagExp.length - 1);
106309
+ }
106310
+ attrExpPresent = tagName !== tagExp;
106311
+ }
106312
+ let prefixedAttrs = null;
106313
+ let rawAttrs = {};
106314
+ let namespace = void 0;
106315
+ namespace = extractNamespace(rawTagName);
106316
+ if (tagName !== xmlObj.tagname) {
106317
+ this.matcher.push(tagName, {}, namespace);
106318
+ }
106319
+ if (tagName !== tagExp && attrExpPresent) {
106320
+ prefixedAttrs = this.buildAttributesMap(tagExp, this.matcher, tagName);
106321
+ if (prefixedAttrs) {
106322
+ rawAttrs = extractRawAttributes(prefixedAttrs, this.options);
106323
+ }
105570
106324
  }
105571
106325
  if (tagName !== xmlObj.tagname) {
105572
- jPath += jPath ? "." + tagName : tagName;
106326
+ this.isCurrentNodeStopNode = this.isItStopNode(this.stopNodeExpressions, this.matcher);
105573
106327
  }
105574
106328
  const startIndex = i4;
105575
- if (this.isItStopNode(this.stopNodesExact, this.stopNodesWildcard, jPath, tagName)) {
106329
+ if (this.isCurrentNodeStopNode) {
105576
106330
  let tagContent = "";
105577
- if (tagExp.length > 0 && tagExp.lastIndexOf("/") === tagExp.length - 1) {
105578
- if (tagName[tagName.length - 1] === "/") {
105579
- tagName = tagName.substr(0, tagName.length - 1);
105580
- jPath = jPath.substr(0, jPath.length - 1);
105581
- tagExp = tagName;
105582
- } else {
105583
- tagExp = tagExp.substr(0, tagExp.length - 1);
105584
- }
106331
+ if (isSelfClosing) {
105585
106332
  i4 = result.closeIndex;
105586
106333
  } else if (this.options.unpairedTags.indexOf(tagName) !== -1) {
105587
106334
  i4 = result.closeIndex;
@@ -105592,47 +106339,43 @@ var init_OrderedObjParser = __esm({
105592
106339
  tagContent = result2.tagContent;
105593
106340
  }
105594
106341
  const childNode = new XmlNode(tagName);
105595
- if (tagName !== tagExp && attrExpPresent) {
105596
- childNode[":@"] = this.buildAttributesMap(tagExp, jPath, tagName);
105597
- }
105598
- if (tagContent) {
105599
- tagContent = this.parseTextData(tagContent, tagName, jPath, true, attrExpPresent, true, true);
106342
+ if (prefixedAttrs) {
106343
+ childNode[":@"] = prefixedAttrs;
105600
106344
  }
105601
- jPath = jPath.substr(0, jPath.lastIndexOf("."));
105602
106345
  childNode.add(this.options.textNodeName, tagContent);
105603
- this.addChild(currentNode, childNode, jPath, startIndex);
106346
+ this.matcher.pop();
106347
+ this.isCurrentNodeStopNode = false;
106348
+ this.addChild(currentNode, childNode, this.matcher, startIndex);
105604
106349
  } else {
105605
- if (tagExp.length > 0 && tagExp.lastIndexOf("/") === tagExp.length - 1) {
105606
- if (tagName[tagName.length - 1] === "/") {
105607
- tagName = tagName.substr(0, tagName.length - 1);
105608
- jPath = jPath.substr(0, jPath.length - 1);
105609
- tagExp = tagName;
105610
- } else {
105611
- tagExp = tagExp.substr(0, tagExp.length - 1);
105612
- }
105613
- if (this.options.transformTagName) {
105614
- const newTagName = this.options.transformTagName(tagName);
105615
- if (tagExp === tagName) {
105616
- tagExp = newTagName;
105617
- }
105618
- tagName = newTagName;
106350
+ if (isSelfClosing) {
106351
+ ({ tagName, tagExp } = transformTagName(this.options.transformTagName, tagName, tagExp, this.options));
106352
+ const childNode = new XmlNode(tagName);
106353
+ if (prefixedAttrs) {
106354
+ childNode[":@"] = prefixedAttrs;
105619
106355
  }
106356
+ this.addChild(currentNode, childNode, this.matcher, startIndex);
106357
+ this.matcher.pop();
106358
+ this.isCurrentNodeStopNode = false;
106359
+ } else if (this.options.unpairedTags.indexOf(tagName) !== -1) {
105620
106360
  const childNode = new XmlNode(tagName);
105621
- if (tagName !== tagExp && attrExpPresent) {
105622
- childNode[":@"] = this.buildAttributesMap(tagExp, jPath, tagName);
106361
+ if (prefixedAttrs) {
106362
+ childNode[":@"] = prefixedAttrs;
105623
106363
  }
105624
- this.addChild(currentNode, childNode, jPath, startIndex);
105625
- jPath = jPath.substr(0, jPath.lastIndexOf("."));
106364
+ this.addChild(currentNode, childNode, this.matcher, startIndex);
106365
+ this.matcher.pop();
106366
+ this.isCurrentNodeStopNode = false;
106367
+ i4 = result.closeIndex;
106368
+ continue;
105626
106369
  } else {
105627
106370
  const childNode = new XmlNode(tagName);
105628
106371
  if (this.tagsNodeStack.length > this.options.maxNestedTags) {
105629
106372
  throw new Error("Maximum nested tags exceeded");
105630
106373
  }
105631
106374
  this.tagsNodeStack.push(currentNode);
105632
- if (tagName !== tagExp && attrExpPresent) {
105633
- childNode[":@"] = this.buildAttributesMap(tagExp, jPath, tagName);
106375
+ if (prefixedAttrs) {
106376
+ childNode[":@"] = prefixedAttrs;
105634
106377
  }
105635
- this.addChild(currentNode, childNode, jPath, startIndex);
106378
+ this.addChild(currentNode, childNode, this.matcher, startIndex);
105636
106379
  currentNode = childNode;
105637
106380
  }
105638
106381
  textData = "";
@@ -105645,87 +106388,50 @@ var init_OrderedObjParser = __esm({
105645
106388
  }
105646
106389
  return xmlObj.child;
105647
106390
  };
105648
- replaceEntitiesValue = function(val, tagName, jPath) {
105649
- if (val.indexOf("&") === -1) {
105650
- return val;
105651
- }
105652
- const entityConfig = this.options.processEntities;
105653
- if (!entityConfig.enabled) {
105654
- return val;
105655
- }
105656
- if (entityConfig.allowedTags) {
105657
- if (!entityConfig.allowedTags.includes(tagName)) {
105658
- return val;
105659
- }
105660
- }
105661
- if (entityConfig.tagFilter) {
105662
- if (!entityConfig.tagFilter(tagName, jPath)) {
105663
- return val;
105664
- }
105665
- }
105666
- for (let entityName in this.docTypeEntities) {
105667
- const entity = this.docTypeEntities[entityName];
105668
- const matches = val.match(entity.regx);
105669
- if (matches) {
105670
- this.entityExpansionCount += matches.length;
105671
- if (entityConfig.maxTotalExpansions && this.entityExpansionCount > entityConfig.maxTotalExpansions) {
105672
- throw new Error(
105673
- `Entity expansion limit exceeded: ${this.entityExpansionCount} > ${entityConfig.maxTotalExpansions}`
105674
- );
105675
- }
105676
- const lengthBefore = val.length;
105677
- val = val.replace(entity.regx, entity.val);
105678
- if (entityConfig.maxExpandedLength) {
105679
- this.currentExpandedLength += val.length - lengthBefore;
105680
- if (this.currentExpandedLength > entityConfig.maxExpandedLength) {
105681
- throw new Error(
105682
- `Total expanded content size exceeded: ${this.currentExpandedLength} > ${entityConfig.maxExpandedLength}`
105683
- );
105684
- }
105685
- }
105686
- }
105687
- }
105688
- if (val.indexOf("&") === -1) return val;
105689
- for (let entityName in this.lastEntities) {
105690
- const entity = this.lastEntities[entityName];
105691
- val = val.replace(entity.regex, entity.val);
105692
- }
105693
- if (val.indexOf("&") === -1) return val;
105694
- if (this.options.htmlEntities) {
105695
- for (let entityName in this.htmlEntities) {
105696
- const entity = this.htmlEntities[entityName];
105697
- val = val.replace(entity.regex, entity.val);
105698
- }
105699
- }
105700
- val = val.replace(this.ampEntity.regex, this.ampEntity.val);
105701
- return val;
105702
- };
105703
106391
  }
105704
106392
  });
105705
106393
 
105706
- // node_modules/.pnpm/fast-xml-parser@5.3.8/node_modules/fast-xml-parser/src/xmlparser/node2json.js
105707
- function prettify(node2, options) {
105708
- return compress(node2, options);
106394
+ // node_modules/.pnpm/fast-xml-parser@5.5.7/node_modules/fast-xml-parser/src/xmlparser/node2json.js
106395
+ function stripAttributePrefix(attrs, prefix) {
106396
+ if (!attrs || typeof attrs !== "object") return {};
106397
+ if (!prefix) return attrs;
106398
+ const rawAttrs = {};
106399
+ for (const key in attrs) {
106400
+ if (key.startsWith(prefix)) {
106401
+ const rawName = key.substring(prefix.length);
106402
+ rawAttrs[rawName] = attrs[key];
106403
+ } else {
106404
+ rawAttrs[key] = attrs[key];
106405
+ }
106406
+ }
106407
+ return rawAttrs;
105709
106408
  }
105710
- function compress(arr, options, jPath) {
106409
+ function prettify(node2, options, matcher) {
106410
+ return compress(node2, options, matcher);
106411
+ }
106412
+ function compress(arr, options, matcher) {
105711
106413
  let text;
105712
106414
  const compressedObj = {};
105713
106415
  for (let i4 = 0; i4 < arr.length; i4++) {
105714
106416
  const tagObj = arr[i4];
105715
106417
  const property = propName(tagObj);
105716
- let newJpath = "";
105717
- if (jPath === void 0) newJpath = property;
105718
- else newJpath = jPath + "." + property;
106418
+ if (property !== void 0 && property !== options.textNodeName) {
106419
+ const rawAttrs = stripAttributePrefix(
106420
+ tagObj[":@"] || {},
106421
+ options.attributeNamePrefix
106422
+ );
106423
+ matcher.push(property, rawAttrs);
106424
+ }
105719
106425
  if (property === options.textNodeName) {
105720
106426
  if (text === void 0) text = tagObj[property];
105721
106427
  else text += "" + tagObj[property];
105722
106428
  } else if (property === void 0) {
105723
106429
  continue;
105724
106430
  } else if (tagObj[property]) {
105725
- let val = compress(tagObj[property], options, newJpath);
106431
+ let val = compress(tagObj[property], options, matcher);
105726
106432
  const isLeaf = isLeafTag(val, options);
105727
106433
  if (tagObj[":@"]) {
105728
- assignAttributes(val, tagObj[":@"], newJpath, options);
106434
+ assignAttributes(val, tagObj[":@"], matcher, options);
105729
106435
  } else if (Object.keys(val).length === 1 && val[options.textNodeName] !== void 0 && !options.alwaysCreateTextNode) {
105730
106436
  val = val[options.textNodeName];
105731
106437
  } else if (Object.keys(val).length === 0) {
@@ -105741,12 +106447,16 @@ function compress(arr, options, jPath) {
105741
106447
  }
105742
106448
  compressedObj[property].push(val);
105743
106449
  } else {
105744
- if (options.isArray(property, newJpath, isLeaf)) {
106450
+ const jPathOrMatcher = options.jPath ? matcher.toString() : matcher;
106451
+ if (options.isArray(property, jPathOrMatcher, isLeaf)) {
105745
106452
  compressedObj[property] = [val];
105746
106453
  } else {
105747
106454
  compressedObj[property] = val;
105748
106455
  }
105749
106456
  }
106457
+ if (property !== void 0 && property !== options.textNodeName) {
106458
+ matcher.pop();
106459
+ }
105750
106460
  }
105751
106461
  }
105752
106462
  if (typeof text === "string") {
@@ -105761,13 +106471,15 @@ function propName(obj) {
105761
106471
  if (key !== ":@") return key;
105762
106472
  }
105763
106473
  }
105764
- function assignAttributes(obj, attrMap, jpath, options) {
106474
+ function assignAttributes(obj, attrMap, matcher, options) {
105765
106475
  if (attrMap) {
105766
106476
  const keys = Object.keys(attrMap);
105767
106477
  const len = keys.length;
105768
106478
  for (let i4 = 0; i4 < len; i4++) {
105769
106479
  const atrrName = keys[i4];
105770
- if (options.isArray(atrrName, jpath + "." + atrrName, true, true)) {
106480
+ const rawAttrName = atrrName.startsWith(options.attributeNamePrefix) ? atrrName.substring(options.attributeNamePrefix.length) : atrrName;
106481
+ const jPathOrMatcher = options.jPath ? matcher.toString() + "." + rawAttrName : matcher;
106482
+ if (options.isArray(atrrName, jPathOrMatcher, true, true)) {
105771
106483
  obj[atrrName] = [attrMap[atrrName]];
105772
106484
  } else {
105773
106485
  obj[atrrName] = attrMap[atrrName];
@@ -105788,7 +106500,7 @@ function isLeafTag(obj, options) {
105788
106500
  }
105789
106501
  var METADATA_SYMBOL2;
105790
106502
  var init_node2json = __esm({
105791
- "node_modules/.pnpm/fast-xml-parser@5.3.8/node_modules/fast-xml-parser/src/xmlparser/node2json.js"() {
106503
+ "node_modules/.pnpm/fast-xml-parser@5.5.7/node_modules/fast-xml-parser/src/xmlparser/node2json.js"() {
105792
106504
  "use strict";
105793
106505
  init_import_meta_url();
105794
106506
  init_xmlNode();
@@ -105796,10 +106508,10 @@ var init_node2json = __esm({
105796
106508
  }
105797
106509
  });
105798
106510
 
105799
- // node_modules/.pnpm/fast-xml-parser@5.3.8/node_modules/fast-xml-parser/src/xmlparser/XMLParser.js
106511
+ // node_modules/.pnpm/fast-xml-parser@5.5.7/node_modules/fast-xml-parser/src/xmlparser/XMLParser.js
105800
106512
  var XMLParser;
105801
106513
  var init_XMLParser = __esm({
105802
- "node_modules/.pnpm/fast-xml-parser@5.3.8/node_modules/fast-xml-parser/src/xmlparser/XMLParser.js"() {
106514
+ "node_modules/.pnpm/fast-xml-parser@5.5.7/node_modules/fast-xml-parser/src/xmlparser/XMLParser.js"() {
105803
106515
  init_import_meta_url();
105804
106516
  init_OptionsBuilder();
105805
106517
  init_OrderedObjParser();
@@ -105833,7 +106545,7 @@ var init_XMLParser = __esm({
105833
106545
  orderedObjParser.addExternalEntities(this.externalEntities);
105834
106546
  const orderedResult = orderedObjParser.parseXml(xmlData);
105835
106547
  if (this.options.preserveOrder || orderedResult === void 0) return orderedResult;
105836
- else return prettify(orderedResult, this.options);
106548
+ else return prettify(orderedResult, this.options, orderedObjParser.matcher);
105837
106549
  }
105838
106550
  /**
105839
106551
  * Add Entity which is not by default supported by this library
@@ -105868,9 +106580,9 @@ var init_XMLParser = __esm({
105868
106580
  }
105869
106581
  });
105870
106582
 
105871
- // node_modules/.pnpm/fast-xml-parser@5.3.8/node_modules/fast-xml-parser/src/fxp.js
106583
+ // node_modules/.pnpm/fast-xml-parser@5.5.7/node_modules/fast-xml-parser/src/fxp.js
105872
106584
  var init_fxp = __esm({
105873
- "node_modules/.pnpm/fast-xml-parser@5.3.8/node_modules/fast-xml-parser/src/fxp.js"() {
106585
+ "node_modules/.pnpm/fast-xml-parser@5.5.7/node_modules/fast-xml-parser/src/fxp.js"() {
105874
106586
  "use strict";
105875
106587
  init_import_meta_url();
105876
106588
  init_XMLParser();
@@ -105931,7 +106643,7 @@ var init_transfer_manager = __esm({
105931
106643
  });
105932
106644
 
105933
106645
  // node_modules/.pnpm/@google-cloud+storage@7.18.0/node_modules/@google-cloud/storage/build/esm/src/index.js
105934
- var init_src = __esm({
106646
+ var init_src2 = __esm({
105935
106647
  "node_modules/.pnpm/@google-cloud+storage@7.18.0/node_modules/@google-cloud/storage/build/esm/src/index.js"() {
105936
106648
  init_import_meta_url();
105937
106649
  init_nodejs_common();
@@ -105993,7 +106705,7 @@ var init_gcsApi = __esm({
105993
106705
  init_import_meta_url();
105994
106706
  fs8 = __toESM(require("fs"));
105995
106707
  path8 = __toESM(require("path"));
105996
- init_src();
106708
+ init_src2();
105997
106709
  init_logger2();
105998
106710
  init_errors2();
105999
106711
  init_dryRun();
@@ -113258,20 +113970,20 @@ ${data2}`);
113258
113970
  });
113259
113971
 
113260
113972
  // src/targets/cocoapods.ts
113261
- var fs9, import_path8, import_util23, writeFile2, DEFAULT_COCOAPODS_BIN, COCOAPODS_BIN, CocoapodsTarget;
113973
+ var fs9, import_path8, import_util24, writeFile2, DEFAULT_COCOAPODS_BIN, COCOAPODS_BIN, CocoapodsTarget;
113262
113974
  var init_cocoapods = __esm({
113263
113975
  "src/targets/cocoapods.ts"() {
113264
113976
  "use strict";
113265
113977
  init_import_meta_url();
113266
113978
  fs9 = __toESM(require("fs"));
113267
113979
  import_path8 = require("path");
113268
- import_util23 = require("util");
113980
+ import_util24 = require("util");
113269
113981
  init_errors2();
113270
113982
  init_files();
113271
113983
  init_githubApi();
113272
113984
  init_system();
113273
113985
  init_base5();
113274
- writeFile2 = (0, import_util23.promisify)(fs9.writeFile);
113986
+ writeFile2 = (0, import_util24.promisify)(fs9.writeFile);
113275
113987
  DEFAULT_COCOAPODS_BIN = "pod";
113276
113988
  COCOAPODS_BIN = process.env.COCOAPODS_BIN || DEFAULT_COCOAPODS_BIN;
113277
113989
  CocoapodsTarget = class extends BaseTarget {
@@ -124698,18 +125410,44 @@ async function getPackageManifest(baseDir, type2, canonicalName, version2, initi
124698
125410
  );
124699
125411
  throw new Error("Unreachable");
124700
125412
  }
125413
+ let effectiveManifestData = initialManifestData;
125414
+ if (!initialManifestData.name) {
125415
+ reportError(
125416
+ `"name" is required for new package "${canonicalName}". Add \`name\` to the registry target config in your .craft.yml.`
125417
+ );
125418
+ throw new Error("Unreachable");
125419
+ }
125420
+ if (!initialManifestData.mainDocsUrl) {
125421
+ logger.warn(
125422
+ `"mainDocsUrl" is not set for "${canonicalName}". Falling back to repo_url ("${initialManifestData.repoUrl}"). Set \`mainDocsUrl\` in the registry target config in .craft.yml to avoid this warning.`
125423
+ );
125424
+ effectiveManifestData = {
125425
+ ...initialManifestData,
125426
+ mainDocsUrl: initialManifestData.repoUrl
125427
+ };
125428
+ }
125429
+ if (initialManifestData.sdkName && !initialManifestData.packageUrl) {
125430
+ reportError(
125431
+ `"packageUrl" is required for new SDK "${canonicalName}". Add \`packageUrl\` to the registry target config in your .craft.yml.`
125432
+ );
125433
+ throw new Error("Unreachable");
125434
+ }
124701
125435
  if (!(0, import_fs18.existsSync)(fullPackageDir)) {
124702
125436
  logger.info(
124703
125437
  `Creating new package directory for "${canonicalName}" at "${packageDirPath}"...`
124704
125438
  );
124705
125439
  (0, import_fs18.mkdirSync)(fullPackageDir, { recursive: true });
124706
125440
  }
124707
- if (initialManifestData.sdkName) {
124708
- const sdkSymlinkPath = path15.join(baseDir, "sdks", initialManifestData.sdkName);
125441
+ if (effectiveManifestData.sdkName) {
125442
+ const sdkSymlinkPath = path15.join(
125443
+ baseDir,
125444
+ "sdks",
125445
+ effectiveManifestData.sdkName
125446
+ );
124709
125447
  if (!(0, import_fs18.existsSync)(sdkSymlinkPath)) {
124710
125448
  const relativeTarget = path15.join("..", packageDirPath);
124711
125449
  logger.info(
124712
- `Creating sdks symlink "${initialManifestData.sdkName}" -> "${relativeTarget}"...`
125450
+ `Creating sdks symlink "${effectiveManifestData.sdkName}" -> "${relativeTarget}"...`
124713
125451
  );
124714
125452
  (0, import_fs18.symlinkSync)(relativeTarget, sdkSymlinkPath);
124715
125453
  }
@@ -124719,10 +125457,13 @@ async function getPackageManifest(baseDir, type2, canonicalName, version2, initi
124719
125457
  );
124720
125458
  return {
124721
125459
  versionFilePath,
124722
- packageManifest: createInitialManifest(initialManifestData)
125460
+ packageManifest: createInitialManifest(effectiveManifestData)
124723
125461
  };
124724
125462
  }
124725
- logger.debug("Reading the current configuration from", packageManifestPath);
125463
+ logger.debug(
125464
+ "Reading the already existing configuration from",
125465
+ packageManifestPath
125466
+ );
124726
125467
  return {
124727
125468
  versionFilePath,
124728
125469
  packageManifest: JSON.parse(
@@ -136961,50 +137702,50 @@ var init_awsExpectUnion = __esm({
136961
137702
  }
136962
137703
  });
136963
137704
 
136964
- // node_modules/.pnpm/fast-xml-parser@5.3.8/node_modules/fast-xml-parser/lib/fxp.cjs
137705
+ // node_modules/.pnpm/fast-xml-parser@5.5.7/node_modules/fast-xml-parser/lib/fxp.cjs
136965
137706
  var require_fxp = __commonJS({
136966
- "node_modules/.pnpm/fast-xml-parser@5.3.8/node_modules/fast-xml-parser/lib/fxp.cjs"(exports2, module2) {
137707
+ "node_modules/.pnpm/fast-xml-parser@5.5.7/node_modules/fast-xml-parser/lib/fxp.cjs"(exports2, module2) {
136967
137708
  init_import_meta_url();
136968
137709
  (() => {
136969
137710
  "use strict";
136970
- var t4 = { d: (e5, n5) => {
136971
- for (var i5 in n5) t4.o(n5, i5) && !t4.o(e5, i5) && Object.defineProperty(e5, i5, { enumerable: true, get: n5[i5] });
137711
+ var t4 = { d: (e5, i5) => {
137712
+ for (var n5 in i5) t4.o(i5, n5) && !t4.o(e5, n5) && Object.defineProperty(e5, n5, { enumerable: true, get: i5[n5] });
136972
137713
  }, o: (t5, e5) => Object.prototype.hasOwnProperty.call(t5, e5), r: (t5) => {
136973
137714
  "undefined" != typeof Symbol && Symbol.toStringTag && Object.defineProperty(t5, Symbol.toStringTag, { value: "Module" }), Object.defineProperty(t5, "__esModule", { value: true });
136974
137715
  } }, e4 = {};
136975
- t4.r(e4), t4.d(e4, { XMLBuilder: () => pt2, XMLParser: () => st2, XMLValidator: () => xt2 });
136976
- const n4 = ":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", i4 = new RegExp("^[" + n4 + "][" + n4 + "\\-.\\d\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*$");
137716
+ t4.r(e4), t4.d(e4, { XMLBuilder: () => Ot2, XMLParser: () => ft2, XMLValidator: () => $t2 });
137717
+ const i4 = ":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", n4 = new RegExp("^[" + i4 + "][" + i4 + "\\-.\\d\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*$");
136977
137718
  function s6(t5, e5) {
136978
- const n5 = [];
136979
- let i5 = e5.exec(t5);
136980
- for (; i5; ) {
137719
+ const i5 = [];
137720
+ let n5 = e5.exec(t5);
137721
+ for (; n5; ) {
136981
137722
  const s7 = [];
136982
- s7.startIndex = e5.lastIndex - i5[0].length;
136983
- const r5 = i5.length;
136984
- for (let t6 = 0; t6 < r5; t6++) s7.push(i5[t6]);
136985
- n5.push(s7), i5 = e5.exec(t5);
137723
+ s7.startIndex = e5.lastIndex - n5[0].length;
137724
+ const r5 = n5.length;
137725
+ for (let t6 = 0; t6 < r5; t6++) s7.push(n5[t6]);
137726
+ i5.push(s7), n5 = e5.exec(t5);
136986
137727
  }
136987
- return n5;
137728
+ return i5;
136988
137729
  }
136989
137730
  const r4 = function(t5) {
136990
- return !(null == i4.exec(t5));
136991
- }, o4 = { allowBooleanAttributes: false, unpairedTags: [] };
136992
- function a4(t5, e5) {
136993
- e5 = Object.assign({}, o4, e5);
136994
- const n5 = [];
136995
- let i5 = false, s7 = false;
137731
+ return !(null == n4.exec(t5));
137732
+ }, o4 = ["hasOwnProperty", "toString", "valueOf", "__defineGetter__", "__defineSetter__", "__lookupGetter__", "__lookupSetter__"], a4 = ["__proto__", "constructor", "prototype"], h4 = { allowBooleanAttributes: false, unpairedTags: [] };
137733
+ function l4(t5, e5) {
137734
+ e5 = Object.assign({}, h4, e5);
137735
+ const i5 = [];
137736
+ let n5 = false, s7 = false;
136996
137737
  "\uFEFF" === t5[0] && (t5 = t5.substr(1));
136997
137738
  for (let r5 = 0; r5 < t5.length; r5++) if ("<" === t5[r5] && "?" === t5[r5 + 1]) {
136998
137739
  if (r5 += 2, r5 = u7(t5, r5), r5.err) return r5;
136999
137740
  } else {
137000
137741
  if ("<" !== t5[r5]) {
137001
- if (l4(t5[r5])) continue;
137002
- return m6("InvalidChar", "char '" + t5[r5] + "' is not expected.", N2(t5, r5));
137742
+ if (p5(t5[r5])) continue;
137743
+ return b6("InvalidChar", "char '" + t5[r5] + "' is not expected.", w6(t5, r5));
137003
137744
  }
137004
137745
  {
137005
137746
  let o5 = r5;
137006
137747
  if (r5++, "!" === t5[r5]) {
137007
- r5 = d5(t5, r5);
137748
+ r5 = c4(t5, r5);
137008
137749
  continue;
137009
137750
  }
137010
137751
  {
@@ -137012,63 +137753,63 @@ var require_fxp = __commonJS({
137012
137753
  "/" === t5[r5] && (a5 = true, r5++);
137013
137754
  let h5 = "";
137014
137755
  for (; r5 < t5.length && ">" !== t5[r5] && " " !== t5[r5] && " " !== t5[r5] && "\n" !== t5[r5] && "\r" !== t5[r5]; r5++) h5 += t5[r5];
137015
- if (h5 = h5.trim(), "/" === h5[h5.length - 1] && (h5 = h5.substring(0, h5.length - 1), r5--), !b6(h5)) {
137756
+ if (h5 = h5.trim(), "/" === h5[h5.length - 1] && (h5 = h5.substring(0, h5.length - 1), r5--), !y4(h5)) {
137016
137757
  let e6;
137017
- return e6 = 0 === h5.trim().length ? "Invalid space after '<'." : "Tag '" + h5 + "' is an invalid name.", m6("InvalidTag", e6, N2(t5, r5));
137758
+ return e6 = 0 === h5.trim().length ? "Invalid space after '<'." : "Tag '" + h5 + "' is an invalid name.", b6("InvalidTag", e6, w6(t5, r5));
137018
137759
  }
137019
- const p6 = c4(t5, r5);
137020
- if (false === p6) return m6("InvalidAttr", "Attributes for '" + h5 + "' have open quote.", N2(t5, r5));
137021
- let f6 = p6.value;
137022
- if (r5 = p6.index, "/" === f6[f6.length - 1]) {
137023
- const n6 = r5 - f6.length;
137024
- f6 = f6.substring(0, f6.length - 1);
137025
- const s8 = g5(f6, e5);
137026
- if (true !== s8) return m6(s8.err.code, s8.err.msg, N2(t5, n6 + s8.err.line));
137027
- i5 = true;
137760
+ const l5 = g5(t5, r5);
137761
+ if (false === l5) return b6("InvalidAttr", "Attributes for '" + h5 + "' have open quote.", w6(t5, r5));
137762
+ let d6 = l5.value;
137763
+ if (r5 = l5.index, "/" === d6[d6.length - 1]) {
137764
+ const i6 = r5 - d6.length;
137765
+ d6 = d6.substring(0, d6.length - 1);
137766
+ const s8 = x5(d6, e5);
137767
+ if (true !== s8) return b6(s8.err.code, s8.err.msg, w6(t5, i6 + s8.err.line));
137768
+ n5 = true;
137028
137769
  } else if (a5) {
137029
- if (!p6.tagClosed) return m6("InvalidTag", "Closing tag '" + h5 + "' doesn't have proper closing.", N2(t5, r5));
137030
- if (f6.trim().length > 0) return m6("InvalidTag", "Closing tag '" + h5 + "' can't have attributes or invalid starting.", N2(t5, o5));
137031
- if (0 === n5.length) return m6("InvalidTag", "Closing tag '" + h5 + "' has not been opened.", N2(t5, o5));
137770
+ if (!l5.tagClosed) return b6("InvalidTag", "Closing tag '" + h5 + "' doesn't have proper closing.", w6(t5, r5));
137771
+ if (d6.trim().length > 0) return b6("InvalidTag", "Closing tag '" + h5 + "' can't have attributes or invalid starting.", w6(t5, o5));
137772
+ if (0 === i5.length) return b6("InvalidTag", "Closing tag '" + h5 + "' has not been opened.", w6(t5, o5));
137032
137773
  {
137033
- const e6 = n5.pop();
137774
+ const e6 = i5.pop();
137034
137775
  if (h5 !== e6.tagName) {
137035
- let n6 = N2(t5, e6.tagStartPos);
137036
- return m6("InvalidTag", "Expected closing tag '" + e6.tagName + "' (opened in line " + n6.line + ", col " + n6.col + ") instead of closing tag '" + h5 + "'.", N2(t5, o5));
137776
+ let i6 = w6(t5, e6.tagStartPos);
137777
+ return b6("InvalidTag", "Expected closing tag '" + e6.tagName + "' (opened in line " + i6.line + ", col " + i6.col + ") instead of closing tag '" + h5 + "'.", w6(t5, o5));
137037
137778
  }
137038
- 0 == n5.length && (s7 = true);
137779
+ 0 == i5.length && (s7 = true);
137039
137780
  }
137040
137781
  } else {
137041
- const a6 = g5(f6, e5);
137042
- if (true !== a6) return m6(a6.err.code, a6.err.msg, N2(t5, r5 - f6.length + a6.err.line));
137043
- if (true === s7) return m6("InvalidXml", "Multiple possible root nodes found.", N2(t5, r5));
137044
- -1 !== e5.unpairedTags.indexOf(h5) || n5.push({ tagName: h5, tagStartPos: o5 }), i5 = true;
137782
+ const a6 = x5(d6, e5);
137783
+ if (true !== a6) return b6(a6.err.code, a6.err.msg, w6(t5, r5 - d6.length + a6.err.line));
137784
+ if (true === s7) return b6("InvalidXml", "Multiple possible root nodes found.", w6(t5, r5));
137785
+ -1 !== e5.unpairedTags.indexOf(h5) || i5.push({ tagName: h5, tagStartPos: o5 }), n5 = true;
137045
137786
  }
137046
137787
  for (r5++; r5 < t5.length; r5++) if ("<" === t5[r5]) {
137047
137788
  if ("!" === t5[r5 + 1]) {
137048
- r5++, r5 = d5(t5, r5);
137789
+ r5++, r5 = c4(t5, r5);
137049
137790
  continue;
137050
137791
  }
137051
137792
  if ("?" !== t5[r5 + 1]) break;
137052
137793
  if (r5 = u7(t5, ++r5), r5.err) return r5;
137053
137794
  } else if ("&" === t5[r5]) {
137054
- const e6 = x5(t5, r5);
137055
- if (-1 == e6) return m6("InvalidChar", "char '&' is not expected.", N2(t5, r5));
137795
+ const e6 = N2(t5, r5);
137796
+ if (-1 == e6) return b6("InvalidChar", "char '&' is not expected.", w6(t5, r5));
137056
137797
  r5 = e6;
137057
- } else if (true === s7 && !l4(t5[r5])) return m6("InvalidXml", "Extra text at the end", N2(t5, r5));
137798
+ } else if (true === s7 && !p5(t5[r5])) return b6("InvalidXml", "Extra text at the end", w6(t5, r5));
137058
137799
  "<" === t5[r5] && r5--;
137059
137800
  }
137060
137801
  }
137061
137802
  }
137062
- return i5 ? 1 == n5.length ? m6("InvalidTag", "Unclosed tag '" + n5[0].tagName + "'.", N2(t5, n5[0].tagStartPos)) : !(n5.length > 0) || m6("InvalidXml", "Invalid '" + JSON.stringify(n5.map((t6) => t6.tagName), null, 4).replace(/\r?\n/g, "") + "' found.", { line: 1, col: 1 }) : m6("InvalidXml", "Start tag expected.", 1);
137803
+ return n5 ? 1 == i5.length ? b6("InvalidTag", "Unclosed tag '" + i5[0].tagName + "'.", w6(t5, i5[0].tagStartPos)) : !(i5.length > 0) || b6("InvalidXml", "Invalid '" + JSON.stringify(i5.map((t6) => t6.tagName), null, 4).replace(/\r?\n/g, "") + "' found.", { line: 1, col: 1 }) : b6("InvalidXml", "Start tag expected.", 1);
137063
137804
  }
137064
- function l4(t5) {
137805
+ function p5(t5) {
137065
137806
  return " " === t5 || " " === t5 || "\n" === t5 || "\r" === t5;
137066
137807
  }
137067
137808
  function u7(t5, e5) {
137068
- const n5 = e5;
137809
+ const i5 = e5;
137069
137810
  for (; e5 < t5.length; e5++) if ("?" == t5[e5] || " " == t5[e5]) {
137070
- const i5 = t5.substr(n5, e5 - n5);
137071
- if (e5 > 5 && "xml" === i5) return m6("InvalidXml", "XML declaration allowed only at the start of the document.", N2(t5, e5));
137811
+ const n5 = t5.substr(i5, e5 - i5);
137812
+ if (e5 > 5 && "xml" === n5) return b6("InvalidXml", "XML declaration allowed only at the start of the document.", w6(t5, e5));
137072
137813
  if ("?" == t5[e5] && ">" == t5[e5 + 1]) {
137073
137814
  e5++;
137074
137815
  break;
@@ -137077,16 +137818,16 @@ var require_fxp = __commonJS({
137077
137818
  }
137078
137819
  return e5;
137079
137820
  }
137080
- function d5(t5, e5) {
137821
+ function c4(t5, e5) {
137081
137822
  if (t5.length > e5 + 5 && "-" === t5[e5 + 1] && "-" === t5[e5 + 2]) {
137082
137823
  for (e5 += 3; e5 < t5.length; e5++) if ("-" === t5[e5] && "-" === t5[e5 + 1] && ">" === t5[e5 + 2]) {
137083
137824
  e5 += 2;
137084
137825
  break;
137085
137826
  }
137086
137827
  } else if (t5.length > e5 + 8 && "D" === t5[e5 + 1] && "O" === t5[e5 + 2] && "C" === t5[e5 + 3] && "T" === t5[e5 + 4] && "Y" === t5[e5 + 5] && "P" === t5[e5 + 6] && "E" === t5[e5 + 7]) {
137087
- let n5 = 1;
137088
- for (e5 += 8; e5 < t5.length; e5++) if ("<" === t5[e5]) n5++;
137089
- else if (">" === t5[e5] && (n5--, 0 === n5)) break;
137828
+ let i5 = 1;
137829
+ for (e5 += 8; e5 < t5.length; e5++) if ("<" === t5[e5]) i5++;
137830
+ else if (">" === t5[e5] && (i5--, 0 === i5)) break;
137090
137831
  } else if (t5.length > e5 + 9 && "[" === t5[e5 + 1] && "C" === t5[e5 + 2] && "D" === t5[e5 + 3] && "A" === t5[e5 + 4] && "T" === t5[e5 + 5] && "A" === t5[e5 + 6] && "[" === t5[e5 + 7]) {
137091
137832
  for (e5 += 8; e5 < t5.length; e5++) if ("]" === t5[e5] && "]" === t5[e5 + 1] && ">" === t5[e5 + 2]) {
137092
137833
  e5 += 2;
@@ -137095,83 +137836,90 @@ var require_fxp = __commonJS({
137095
137836
  }
137096
137837
  return e5;
137097
137838
  }
137098
- const h4 = '"', p5 = "'";
137099
- function c4(t5, e5) {
137100
- let n5 = "", i5 = "", s7 = false;
137839
+ const d5 = '"', f5 = "'";
137840
+ function g5(t5, e5) {
137841
+ let i5 = "", n5 = "", s7 = false;
137101
137842
  for (; e5 < t5.length; e5++) {
137102
- if (t5[e5] === h4 || t5[e5] === p5) "" === i5 ? i5 = t5[e5] : i5 !== t5[e5] || (i5 = "");
137103
- else if (">" === t5[e5] && "" === i5) {
137843
+ if (t5[e5] === d5 || t5[e5] === f5) "" === n5 ? n5 = t5[e5] : n5 !== t5[e5] || (n5 = "");
137844
+ else if (">" === t5[e5] && "" === n5) {
137104
137845
  s7 = true;
137105
137846
  break;
137106
137847
  }
137107
- n5 += t5[e5];
137848
+ i5 += t5[e5];
137108
137849
  }
137109
- return "" === i5 && { value: n5, index: e5, tagClosed: s7 };
137850
+ return "" === n5 && { value: i5, index: e5, tagClosed: s7 };
137110
137851
  }
137111
- const f5 = new RegExp(`(\\s*)([^\\s=]+)(\\s*=)?(\\s*(['"])(([\\s\\S])*?)\\5)?`, "g");
137112
- function g5(t5, e5) {
137113
- const n5 = s6(t5, f5), i5 = {};
137114
- for (let t6 = 0; t6 < n5.length; t6++) {
137115
- if (0 === n5[t6][1].length) return m6("InvalidAttr", "Attribute '" + n5[t6][2] + "' has no space in starting.", y4(n5[t6]));
137116
- if (void 0 !== n5[t6][3] && void 0 === n5[t6][4]) return m6("InvalidAttr", "Attribute '" + n5[t6][2] + "' is without value.", y4(n5[t6]));
137117
- if (void 0 === n5[t6][3] && !e5.allowBooleanAttributes) return m6("InvalidAttr", "boolean attribute '" + n5[t6][2] + "' is not allowed.", y4(n5[t6]));
137118
- const s7 = n5[t6][2];
137119
- if (!E3(s7)) return m6("InvalidAttr", "Attribute '" + s7 + "' is an invalid name.", y4(n5[t6]));
137120
- if (Object.prototype.hasOwnProperty.call(i5, s7)) return m6("InvalidAttr", "Attribute '" + s7 + "' is repeated.", y4(n5[t6]));
137121
- i5[s7] = 1;
137852
+ const m6 = new RegExp(`(\\s*)([^\\s=]+)(\\s*=)?(\\s*(['"])(([\\s\\S])*?)\\5)?`, "g");
137853
+ function x5(t5, e5) {
137854
+ const i5 = s6(t5, m6), n5 = {};
137855
+ for (let t6 = 0; t6 < i5.length; t6++) {
137856
+ if (0 === i5[t6][1].length) return b6("InvalidAttr", "Attribute '" + i5[t6][2] + "' has no space in starting.", v9(i5[t6]));
137857
+ if (void 0 !== i5[t6][3] && void 0 === i5[t6][4]) return b6("InvalidAttr", "Attribute '" + i5[t6][2] + "' is without value.", v9(i5[t6]));
137858
+ if (void 0 === i5[t6][3] && !e5.allowBooleanAttributes) return b6("InvalidAttr", "boolean attribute '" + i5[t6][2] + "' is not allowed.", v9(i5[t6]));
137859
+ const s7 = i5[t6][2];
137860
+ if (!E3(s7)) return b6("InvalidAttr", "Attribute '" + s7 + "' is an invalid name.", v9(i5[t6]));
137861
+ if (Object.prototype.hasOwnProperty.call(n5, s7)) return b6("InvalidAttr", "Attribute '" + s7 + "' is repeated.", v9(i5[t6]));
137862
+ n5[s7] = 1;
137122
137863
  }
137123
137864
  return true;
137124
137865
  }
137125
- function x5(t5, e5) {
137866
+ function N2(t5, e5) {
137126
137867
  if (";" === t5[++e5]) return -1;
137127
137868
  if ("#" === t5[e5]) return (function(t6, e6) {
137128
- let n6 = /\d/;
137129
- for ("x" === t6[e6] && (e6++, n6 = /[\da-fA-F]/); e6 < t6.length; e6++) {
137869
+ let i6 = /\d/;
137870
+ for ("x" === t6[e6] && (e6++, i6 = /[\da-fA-F]/); e6 < t6.length; e6++) {
137130
137871
  if (";" === t6[e6]) return e6;
137131
- if (!t6[e6].match(n6)) break;
137872
+ if (!t6[e6].match(i6)) break;
137132
137873
  }
137133
137874
  return -1;
137134
137875
  })(t5, ++e5);
137135
- let n5 = 0;
137136
- for (; e5 < t5.length; e5++, n5++) if (!(t5[e5].match(/\w/) && n5 < 20)) {
137876
+ let i5 = 0;
137877
+ for (; e5 < t5.length; e5++, i5++) if (!(t5[e5].match(/\w/) && i5 < 20)) {
137137
137878
  if (";" === t5[e5]) break;
137138
137879
  return -1;
137139
137880
  }
137140
137881
  return e5;
137141
137882
  }
137142
- function m6(t5, e5, n5) {
137143
- return { err: { code: t5, msg: e5, line: n5.line || n5, col: n5.col } };
137883
+ function b6(t5, e5, i5) {
137884
+ return { err: { code: t5, msg: e5, line: i5.line || i5, col: i5.col } };
137144
137885
  }
137145
137886
  function E3(t5) {
137146
137887
  return r4(t5);
137147
137888
  }
137148
- function b6(t5) {
137889
+ function y4(t5) {
137149
137890
  return r4(t5);
137150
137891
  }
137151
- function N2(t5, e5) {
137152
- const n5 = t5.substring(0, e5).split(/\r?\n/);
137153
- return { line: n5.length, col: n5[n5.length - 1].length + 1 };
137892
+ function w6(t5, e5) {
137893
+ const i5 = t5.substring(0, e5).split(/\r?\n/);
137894
+ return { line: i5.length, col: i5[i5.length - 1].length + 1 };
137154
137895
  }
137155
- function y4(t5) {
137896
+ function v9(t5) {
137156
137897
  return t5.startIndex + t5[1].length;
137157
137898
  }
137158
- const T2 = { preserveOrder: false, attributeNamePrefix: "@_", attributesGroupName: false, textNodeName: "#text", ignoreAttributes: true, removeNSPrefix: false, allowBooleanAttributes: false, parseTagValue: true, parseAttributeValue: false, trimValues: true, cdataPropName: false, numberParseOptions: { hex: true, leadingZeros: true, eNotation: true }, tagValueProcessor: function(t5, e5) {
137899
+ const T2 = (t5) => o4.includes(t5) ? "__" + t5 : t5, P3 = { preserveOrder: false, attributeNamePrefix: "@_", attributesGroupName: false, textNodeName: "#text", ignoreAttributes: true, removeNSPrefix: false, allowBooleanAttributes: false, parseTagValue: true, parseAttributeValue: false, trimValues: true, cdataPropName: false, numberParseOptions: { hex: true, leadingZeros: true, eNotation: true }, tagValueProcessor: function(t5, e5) {
137159
137900
  return e5;
137160
137901
  }, attributeValueProcessor: function(t5, e5) {
137161
137902
  return e5;
137162
- }, stopNodes: [], alwaysCreateTextNode: false, isArray: () => false, commentPropName: false, unpairedTags: [], processEntities: true, htmlEntities: false, ignoreDeclaration: false, ignorePiTags: false, transformTagName: false, transformAttributeName: false, updateTag: function(t5, e5, n5) {
137903
+ }, stopNodes: [], alwaysCreateTextNode: false, isArray: () => false, commentPropName: false, unpairedTags: [], processEntities: true, htmlEntities: false, ignoreDeclaration: false, ignorePiTags: false, transformTagName: false, transformAttributeName: false, updateTag: function(t5, e5, i5) {
137163
137904
  return t5;
137164
- }, captureMetaData: false, maxNestedTags: 100 };
137165
- function w6(t5) {
137166
- return "boolean" == typeof t5 ? { enabled: t5, maxEntitySize: 1e4, maxExpansionDepth: 10, maxTotalExpansions: 1e3, maxExpandedLength: 1e5, allowedTags: null, tagFilter: null } : "object" == typeof t5 && null !== t5 ? { enabled: false !== t5.enabled, maxEntitySize: t5.maxEntitySize ?? 1e4, maxExpansionDepth: t5.maxExpansionDepth ?? 10, maxTotalExpansions: t5.maxTotalExpansions ?? 1e3, maxExpandedLength: t5.maxExpandedLength ?? 1e5, allowedTags: t5.allowedTags ?? null, tagFilter: t5.tagFilter ?? null } : w6(true);
137905
+ }, captureMetaData: false, maxNestedTags: 100, strictReservedNames: true, jPath: true, onDangerousProperty: T2 };
137906
+ function S2(t5, e5) {
137907
+ if ("string" != typeof t5) return;
137908
+ const i5 = t5.toLowerCase();
137909
+ if (o4.some((t6) => i5 === t6.toLowerCase())) throw new Error(`[SECURITY] Invalid ${e5}: "${t5}" is a reserved JavaScript keyword that could cause prototype pollution`);
137910
+ if (a4.some((t6) => i5 === t6.toLowerCase())) throw new Error(`[SECURITY] Invalid ${e5}: "${t5}" is a reserved JavaScript keyword that could cause prototype pollution`);
137167
137911
  }
137168
- const v9 = function(t5) {
137169
- const e5 = Object.assign({}, T2, t5);
137170
- return e5.processEntities = w6(e5.processEntities), e5;
137912
+ function A3(t5) {
137913
+ return "boolean" == typeof t5 ? { enabled: t5, maxEntitySize: 1e4, maxExpansionDepth: 10, maxTotalExpansions: 1e3, maxExpandedLength: 1e5, maxEntityCount: 100, allowedTags: null, tagFilter: null } : "object" == typeof t5 && null !== t5 ? { enabled: false !== t5.enabled, maxEntitySize: Math.max(1, t5.maxEntitySize ?? 1e4), maxExpansionDepth: Math.max(1, t5.maxExpansionDepth ?? 10), maxTotalExpansions: Math.max(1, t5.maxTotalExpansions ?? 1e3), maxExpandedLength: Math.max(1, t5.maxExpandedLength ?? 1e5), maxEntityCount: Math.max(1, t5.maxEntityCount ?? 100), allowedTags: t5.allowedTags ?? null, tagFilter: t5.tagFilter ?? null } : A3(true);
137914
+ }
137915
+ const C4 = function(t5) {
137916
+ const e5 = Object.assign({}, P3, t5), i5 = [{ value: e5.attributeNamePrefix, name: "attributeNamePrefix" }, { value: e5.attributesGroupName, name: "attributesGroupName" }, { value: e5.textNodeName, name: "textNodeName" }, { value: e5.cdataPropName, name: "cdataPropName" }, { value: e5.commentPropName, name: "commentPropName" }];
137917
+ for (const { value: t6, name: e6 } of i5) t6 && S2(t6, e6);
137918
+ return null === e5.onDangerousProperty && (e5.onDangerousProperty = T2), e5.processEntities = A3(e5.processEntities), e5.stopNodes && Array.isArray(e5.stopNodes) && (e5.stopNodes = e5.stopNodes.map((t6) => "string" == typeof t6 && t6.startsWith("*.") ? ".." + t6.substring(2) : t6)), e5;
137171
137919
  };
137172
137920
  let O2;
137173
137921
  O2 = "function" != typeof Symbol ? "@@xmlMetadata" : Symbol("XML Node Metadata");
137174
- class I4 {
137922
+ class $3 {
137175
137923
  constructor(t5) {
137176
137924
  this.tagname = t5, this.child = [], this[":@"] = /* @__PURE__ */ Object.create(null);
137177
137925
  }
@@ -137185,192 +137933,403 @@ var require_fxp = __commonJS({
137185
137933
  return O2;
137186
137934
  }
137187
137935
  }
137188
- class P3 {
137936
+ class I4 {
137189
137937
  constructor(t5) {
137190
137938
  this.suppressValidationErr = !t5, this.options = t5;
137191
137939
  }
137192
137940
  readDocType(t5, e5) {
137193
- const n5 = /* @__PURE__ */ Object.create(null);
137941
+ const i5 = /* @__PURE__ */ Object.create(null);
137942
+ let n5 = 0;
137194
137943
  if ("O" !== t5[e5 + 3] || "C" !== t5[e5 + 4] || "T" !== t5[e5 + 5] || "Y" !== t5[e5 + 6] || "P" !== t5[e5 + 7] || "E" !== t5[e5 + 8]) throw new Error("Invalid Tag instead of DOCTYPE");
137195
137944
  {
137196
137945
  e5 += 9;
137197
- let i5 = 1, s7 = false, r5 = false, o5 = "";
137198
- for (; e5 < t5.length; e5++) if ("<" !== t5[e5] || r5) if (">" === t5[e5]) {
137199
- if (r5 ? "-" === t5[e5 - 1] && "-" === t5[e5 - 2] && (r5 = false, i5--) : i5--, 0 === i5) break;
137200
- } else "[" === t5[e5] ? s7 = true : o5 += t5[e5];
137946
+ let s7 = 1, r5 = false, o5 = false, a5 = "";
137947
+ for (; e5 < t5.length; e5++) if ("<" !== t5[e5] || o5) if (">" === t5[e5]) {
137948
+ if (o5 ? "-" === t5[e5 - 1] && "-" === t5[e5 - 2] && (o5 = false, s7--) : s7--, 0 === s7) break;
137949
+ } else "[" === t5[e5] ? r5 = true : a5 += t5[e5];
137201
137950
  else {
137202
- if (s7 && S2(t5, "!ENTITY", e5)) {
137203
- let i6, s8;
137204
- if (e5 += 7, [i6, s8, e5] = this.readEntityExp(t5, e5 + 1, this.suppressValidationErr), -1 === s8.indexOf("&")) {
137205
- const t6 = i6.replace(/[.\-+*:]/g, "\\.");
137206
- n5[i6] = { regx: RegExp(`&${t6};`, "g"), val: s8 };
137951
+ if (r5 && _3(t5, "!ENTITY", e5)) {
137952
+ let s8, r6;
137953
+ if (e5 += 7, [s8, r6, e5] = this.readEntityExp(t5, e5 + 1, this.suppressValidationErr), -1 === r6.indexOf("&")) {
137954
+ if (false !== this.options.enabled && null != this.options.maxEntityCount && n5 >= this.options.maxEntityCount) throw new Error(`Entity count (${n5 + 1}) exceeds maximum allowed (${this.options.maxEntityCount})`);
137955
+ const t6 = s8.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
137956
+ i5[s8] = { regx: RegExp(`&${t6};`, "g"), val: r6 }, n5++;
137207
137957
  }
137208
- } else if (s7 && S2(t5, "!ELEMENT", e5)) {
137958
+ } else if (r5 && _3(t5, "!ELEMENT", e5)) {
137209
137959
  e5 += 8;
137210
- const { index: n6 } = this.readElementExp(t5, e5 + 1);
137211
- e5 = n6;
137212
- } else if (s7 && S2(t5, "!ATTLIST", e5)) e5 += 8;
137213
- else if (s7 && S2(t5, "!NOTATION", e5)) {
137960
+ const { index: i6 } = this.readElementExp(t5, e5 + 1);
137961
+ e5 = i6;
137962
+ } else if (r5 && _3(t5, "!ATTLIST", e5)) e5 += 8;
137963
+ else if (r5 && _3(t5, "!NOTATION", e5)) {
137214
137964
  e5 += 9;
137215
- const { index: n6 } = this.readNotationExp(t5, e5 + 1, this.suppressValidationErr);
137216
- e5 = n6;
137965
+ const { index: i6 } = this.readNotationExp(t5, e5 + 1, this.suppressValidationErr);
137966
+ e5 = i6;
137217
137967
  } else {
137218
- if (!S2(t5, "!--", e5)) throw new Error("Invalid DOCTYPE");
137219
- r5 = true;
137968
+ if (!_3(t5, "!--", e5)) throw new Error("Invalid DOCTYPE");
137969
+ o5 = true;
137220
137970
  }
137221
- i5++, o5 = "";
137971
+ s7++, a5 = "";
137222
137972
  }
137223
- if (0 !== i5) throw new Error("Unclosed DOCTYPE");
137973
+ if (0 !== s7) throw new Error("Unclosed DOCTYPE");
137224
137974
  }
137225
- return { entities: n5, i: e5 };
137975
+ return { entities: i5, i: e5 };
137226
137976
  }
137227
137977
  readEntityExp(t5, e5) {
137228
- e5 = A3(t5, e5);
137229
- let n5 = "";
137230
- for (; e5 < t5.length && !/\s/.test(t5[e5]) && '"' !== t5[e5] && "'" !== t5[e5]; ) n5 += t5[e5], e5++;
137231
- if (C4(n5), e5 = A3(t5, e5), !this.suppressValidationErr) {
137978
+ const i5 = e5 = j6(t5, e5);
137979
+ for (; e5 < t5.length && !/\s/.test(t5[e5]) && '"' !== t5[e5] && "'" !== t5[e5]; ) e5++;
137980
+ let n5 = t5.substring(i5, e5);
137981
+ if (D4(n5), e5 = j6(t5, e5), !this.suppressValidationErr) {
137232
137982
  if ("SYSTEM" === t5.substring(e5, e5 + 6).toUpperCase()) throw new Error("External entities are not supported");
137233
137983
  if ("%" === t5[e5]) throw new Error("Parameter entities are not supported");
137234
137984
  }
137235
- let i5 = "";
137236
- if ([e5, i5] = this.readIdentifierVal(t5, e5, "entity"), false !== this.options.enabled && this.options.maxEntitySize && i5.length > this.options.maxEntitySize) throw new Error(`Entity "${n5}" size (${i5.length}) exceeds maximum allowed size (${this.options.maxEntitySize})`);
137237
- return [n5, i5, --e5];
137985
+ let s7 = "";
137986
+ if ([e5, s7] = this.readIdentifierVal(t5, e5, "entity"), false !== this.options.enabled && null != this.options.maxEntitySize && s7.length > this.options.maxEntitySize) throw new Error(`Entity "${n5}" size (${s7.length}) exceeds maximum allowed size (${this.options.maxEntitySize})`);
137987
+ return [n5, s7, --e5];
137238
137988
  }
137239
137989
  readNotationExp(t5, e5) {
137240
- e5 = A3(t5, e5);
137990
+ const i5 = e5 = j6(t5, e5);
137991
+ for (; e5 < t5.length && !/\s/.test(t5[e5]); ) e5++;
137992
+ let n5 = t5.substring(i5, e5);
137993
+ !this.suppressValidationErr && D4(n5), e5 = j6(t5, e5);
137994
+ const s7 = t5.substring(e5, e5 + 6).toUpperCase();
137995
+ if (!this.suppressValidationErr && "SYSTEM" !== s7 && "PUBLIC" !== s7) throw new Error(`Expected SYSTEM or PUBLIC, found "${s7}"`);
137996
+ e5 += s7.length, e5 = j6(t5, e5);
137997
+ let r5 = null, o5 = null;
137998
+ if ("PUBLIC" === s7) [e5, r5] = this.readIdentifierVal(t5, e5, "publicIdentifier"), '"' !== t5[e5 = j6(t5, e5)] && "'" !== t5[e5] || ([e5, o5] = this.readIdentifierVal(t5, e5, "systemIdentifier"));
137999
+ else if ("SYSTEM" === s7 && ([e5, o5] = this.readIdentifierVal(t5, e5, "systemIdentifier"), !this.suppressValidationErr && !o5)) throw new Error("Missing mandatory system identifier for SYSTEM notation");
138000
+ return { notationName: n5, publicIdentifier: r5, systemIdentifier: o5, index: --e5 };
138001
+ }
138002
+ readIdentifierVal(t5, e5, i5) {
137241
138003
  let n5 = "";
137242
- for (; e5 < t5.length && !/\s/.test(t5[e5]); ) n5 += t5[e5], e5++;
137243
- !this.suppressValidationErr && C4(n5), e5 = A3(t5, e5);
137244
- const i5 = t5.substring(e5, e5 + 6).toUpperCase();
137245
- if (!this.suppressValidationErr && "SYSTEM" !== i5 && "PUBLIC" !== i5) throw new Error(`Expected SYSTEM or PUBLIC, found "${i5}"`);
137246
- e5 += i5.length, e5 = A3(t5, e5);
137247
- let s7 = null, r5 = null;
137248
- if ("PUBLIC" === i5) [e5, s7] = this.readIdentifierVal(t5, e5, "publicIdentifier"), '"' !== t5[e5 = A3(t5, e5)] && "'" !== t5[e5] || ([e5, r5] = this.readIdentifierVal(t5, e5, "systemIdentifier"));
137249
- else if ("SYSTEM" === i5 && ([e5, r5] = this.readIdentifierVal(t5, e5, "systemIdentifier"), !this.suppressValidationErr && !r5)) throw new Error("Missing mandatory system identifier for SYSTEM notation");
137250
- return { notationName: n5, publicIdentifier: s7, systemIdentifier: r5, index: --e5 };
137251
- }
137252
- readIdentifierVal(t5, e5, n5) {
137253
- let i5 = "";
137254
138004
  const s7 = t5[e5];
137255
138005
  if ('"' !== s7 && "'" !== s7) throw new Error(`Expected quoted string, found "${s7}"`);
137256
- for (e5++; e5 < t5.length && t5[e5] !== s7; ) i5 += t5[e5], e5++;
137257
- if (t5[e5] !== s7) throw new Error(`Unterminated ${n5} value`);
137258
- return [++e5, i5];
138006
+ const r5 = ++e5;
138007
+ for (; e5 < t5.length && t5[e5] !== s7; ) e5++;
138008
+ if (n5 = t5.substring(r5, e5), t5[e5] !== s7) throw new Error(`Unterminated ${i5} value`);
138009
+ return [++e5, n5];
137259
138010
  }
137260
138011
  readElementExp(t5, e5) {
137261
- e5 = A3(t5, e5);
137262
- let n5 = "";
137263
- for (; e5 < t5.length && !/\s/.test(t5[e5]); ) n5 += t5[e5], e5++;
138012
+ const i5 = e5 = j6(t5, e5);
138013
+ for (; e5 < t5.length && !/\s/.test(t5[e5]); ) e5++;
138014
+ let n5 = t5.substring(i5, e5);
137264
138015
  if (!this.suppressValidationErr && !r4(n5)) throw new Error(`Invalid element name: "${n5}"`);
137265
- let i5 = "";
137266
- if ("E" === t5[e5 = A3(t5, e5)] && S2(t5, "MPTY", e5)) e5 += 4;
137267
- else if ("A" === t5[e5] && S2(t5, "NY", e5)) e5 += 2;
138016
+ let s7 = "";
138017
+ if ("E" === t5[e5 = j6(t5, e5)] && _3(t5, "MPTY", e5)) e5 += 4;
138018
+ else if ("A" === t5[e5] && _3(t5, "NY", e5)) e5 += 2;
137268
138019
  else if ("(" === t5[e5]) {
137269
- for (e5++; e5 < t5.length && ")" !== t5[e5]; ) i5 += t5[e5], e5++;
137270
- if (")" !== t5[e5]) throw new Error("Unterminated content model");
138020
+ const i6 = ++e5;
138021
+ for (; e5 < t5.length && ")" !== t5[e5]; ) e5++;
138022
+ if (s7 = t5.substring(i6, e5), ")" !== t5[e5]) throw new Error("Unterminated content model");
137271
138023
  } else if (!this.suppressValidationErr) throw new Error(`Invalid Element Expression, found "${t5[e5]}"`);
137272
- return { elementName: n5, contentModel: i5.trim(), index: e5 };
138024
+ return { elementName: n5, contentModel: s7.trim(), index: e5 };
137273
138025
  }
137274
138026
  readAttlistExp(t5, e5) {
137275
- e5 = A3(t5, e5);
137276
- let n5 = "";
137277
- for (; e5 < t5.length && !/\s/.test(t5[e5]); ) n5 += t5[e5], e5++;
137278
- C4(n5), e5 = A3(t5, e5);
137279
- let i5 = "";
137280
- for (; e5 < t5.length && !/\s/.test(t5[e5]); ) i5 += t5[e5], e5++;
137281
- if (!C4(i5)) throw new Error(`Invalid attribute name: "${i5}"`);
137282
- e5 = A3(t5, e5);
137283
- let s7 = "";
138027
+ let i5 = e5 = j6(t5, e5);
138028
+ for (; e5 < t5.length && !/\s/.test(t5[e5]); ) e5++;
138029
+ let n5 = t5.substring(i5, e5);
138030
+ for (D4(n5), i5 = e5 = j6(t5, e5); e5 < t5.length && !/\s/.test(t5[e5]); ) e5++;
138031
+ let s7 = t5.substring(i5, e5);
138032
+ if (!D4(s7)) throw new Error(`Invalid attribute name: "${s7}"`);
138033
+ e5 = j6(t5, e5);
138034
+ let r5 = "";
137284
138035
  if ("NOTATION" === t5.substring(e5, e5 + 8).toUpperCase()) {
137285
- if (s7 = "NOTATION", "(" !== t5[e5 = A3(t5, e5 += 8)]) throw new Error(`Expected '(', found "${t5[e5]}"`);
138036
+ if (r5 = "NOTATION", "(" !== t5[e5 = j6(t5, e5 += 8)]) throw new Error(`Expected '(', found "${t5[e5]}"`);
137286
138037
  e5++;
137287
- let n6 = [];
138038
+ let i6 = [];
137288
138039
  for (; e5 < t5.length && ")" !== t5[e5]; ) {
137289
- let i6 = "";
137290
- for (; e5 < t5.length && "|" !== t5[e5] && ")" !== t5[e5]; ) i6 += t5[e5], e5++;
137291
- if (i6 = i6.trim(), !C4(i6)) throw new Error(`Invalid notation name: "${i6}"`);
137292
- n6.push(i6), "|" === t5[e5] && (e5++, e5 = A3(t5, e5));
138040
+ const n6 = e5;
138041
+ for (; e5 < t5.length && "|" !== t5[e5] && ")" !== t5[e5]; ) e5++;
138042
+ let s8 = t5.substring(n6, e5);
138043
+ if (s8 = s8.trim(), !D4(s8)) throw new Error(`Invalid notation name: "${s8}"`);
138044
+ i6.push(s8), "|" === t5[e5] && (e5++, e5 = j6(t5, e5));
137293
138045
  }
137294
138046
  if (")" !== t5[e5]) throw new Error("Unterminated list of notations");
137295
- e5++, s7 += " (" + n6.join("|") + ")";
138047
+ e5++, r5 += " (" + i6.join("|") + ")";
137296
138048
  } else {
137297
- for (; e5 < t5.length && !/\s/.test(t5[e5]); ) s7 += t5[e5], e5++;
138049
+ const i6 = e5;
138050
+ for (; e5 < t5.length && !/\s/.test(t5[e5]); ) e5++;
138051
+ r5 += t5.substring(i6, e5);
137298
138052
  const n6 = ["CDATA", "ID", "IDREF", "IDREFS", "ENTITY", "ENTITIES", "NMTOKEN", "NMTOKENS"];
137299
- if (!this.suppressValidationErr && !n6.includes(s7.toUpperCase())) throw new Error(`Invalid attribute type: "${s7}"`);
138053
+ if (!this.suppressValidationErr && !n6.includes(r5.toUpperCase())) throw new Error(`Invalid attribute type: "${r5}"`);
137300
138054
  }
137301
- e5 = A3(t5, e5);
137302
- let r5 = "";
137303
- return "#REQUIRED" === t5.substring(e5, e5 + 8).toUpperCase() ? (r5 = "#REQUIRED", e5 += 8) : "#IMPLIED" === t5.substring(e5, e5 + 7).toUpperCase() ? (r5 = "#IMPLIED", e5 += 7) : [e5, r5] = this.readIdentifierVal(t5, e5, "ATTLIST"), { elementName: n5, attributeName: i5, attributeType: s7, defaultValue: r5, index: e5 };
138055
+ e5 = j6(t5, e5);
138056
+ let o5 = "";
138057
+ return "#REQUIRED" === t5.substring(e5, e5 + 8).toUpperCase() ? (o5 = "#REQUIRED", e5 += 8) : "#IMPLIED" === t5.substring(e5, e5 + 7).toUpperCase() ? (o5 = "#IMPLIED", e5 += 7) : [e5, o5] = this.readIdentifierVal(t5, e5, "ATTLIST"), { elementName: n5, attributeName: s7, attributeType: r5, defaultValue: o5, index: e5 };
137304
138058
  }
137305
138059
  }
137306
- const A3 = (t5, e5) => {
138060
+ const j6 = (t5, e5) => {
137307
138061
  for (; e5 < t5.length && /\s/.test(t5[e5]); ) e5++;
137308
138062
  return e5;
137309
138063
  };
137310
- function S2(t5, e5, n5) {
137311
- for (let i5 = 0; i5 < e5.length; i5++) if (e5[i5] !== t5[n5 + i5 + 1]) return false;
138064
+ function _3(t5, e5, i5) {
138065
+ for (let n5 = 0; n5 < e5.length; n5++) if (e5[n5] !== t5[i5 + n5 + 1]) return false;
137312
138066
  return true;
137313
138067
  }
137314
- function C4(t5) {
138068
+ function D4(t5) {
137315
138069
  if (r4(t5)) return t5;
137316
138070
  throw new Error(`Invalid entity name ${t5}`);
137317
138071
  }
137318
- const $3 = /^[-+]?0x[a-fA-F0-9]+$/, V2 = /^([\-\+])?(0*)([0-9]*(\.[0-9]*)?)$/, D4 = { hex: true, leadingZeros: true, decimalPoint: ".", eNotation: true };
137319
- const j6 = /^([-+])?(0*)(\d*(\.\d*)?[eE][-\+]?\d+)$/;
137320
- function L3(t5) {
137321
- return "function" == typeof t5 ? t5 : Array.isArray(t5) ? (e5) => {
137322
- for (const n5 of t5) {
137323
- if ("string" == typeof n5 && e5 === n5) return true;
137324
- if (n5 instanceof RegExp && n5.test(e5)) return true;
138072
+ const V2 = /^[-+]?0x[a-fA-F0-9]+$/, k6 = /^([\-\+])?(0*)([0-9]*(\.[0-9]*)?)$/, M3 = { hex: true, leadingZeros: true, decimalPoint: ".", eNotation: true, infinity: "original" };
138073
+ const F4 = /^([-+])?(0*)(\d*(\.\d*)?[eE][-\+]?\d+)$/;
138074
+ class L3 {
138075
+ constructor(t5 = {}) {
138076
+ this.separator = t5.separator || ".", this.path = [], this.siblingStacks = [];
138077
+ }
138078
+ push(t5, e5 = null, i5 = null) {
138079
+ this.path.length > 0 && (this.path[this.path.length - 1].values = void 0);
138080
+ const n5 = this.path.length;
138081
+ this.siblingStacks[n5] || (this.siblingStacks[n5] = /* @__PURE__ */ new Map());
138082
+ const s7 = this.siblingStacks[n5], r5 = i5 ? `${i5}:${t5}` : t5, o5 = s7.get(r5) || 0;
138083
+ let a5 = 0;
138084
+ for (const t6 of s7.values()) a5 += t6;
138085
+ s7.set(r5, o5 + 1);
138086
+ const h5 = { tag: t5, position: a5, counter: o5 };
138087
+ null != i5 && (h5.namespace = i5), null != e5 && (h5.values = e5), this.path.push(h5);
138088
+ }
138089
+ pop() {
138090
+ if (0 === this.path.length) return;
138091
+ const t5 = this.path.pop();
138092
+ return this.siblingStacks.length > this.path.length + 1 && (this.siblingStacks.length = this.path.length + 1), t5;
138093
+ }
138094
+ updateCurrent(t5) {
138095
+ if (this.path.length > 0) {
138096
+ const e5 = this.path[this.path.length - 1];
138097
+ null != t5 && (e5.values = t5);
138098
+ }
138099
+ }
138100
+ getCurrentTag() {
138101
+ return this.path.length > 0 ? this.path[this.path.length - 1].tag : void 0;
138102
+ }
138103
+ getCurrentNamespace() {
138104
+ return this.path.length > 0 ? this.path[this.path.length - 1].namespace : void 0;
138105
+ }
138106
+ getAttrValue(t5) {
138107
+ if (0 === this.path.length) return;
138108
+ const e5 = this.path[this.path.length - 1];
138109
+ return e5.values?.[t5];
138110
+ }
138111
+ hasAttr(t5) {
138112
+ if (0 === this.path.length) return false;
138113
+ const e5 = this.path[this.path.length - 1];
138114
+ return void 0 !== e5.values && t5 in e5.values;
138115
+ }
138116
+ getPosition() {
138117
+ return 0 === this.path.length ? -1 : this.path[this.path.length - 1].position ?? 0;
138118
+ }
138119
+ getCounter() {
138120
+ return 0 === this.path.length ? -1 : this.path[this.path.length - 1].counter ?? 0;
138121
+ }
138122
+ getIndex() {
138123
+ return this.getPosition();
138124
+ }
138125
+ getDepth() {
138126
+ return this.path.length;
138127
+ }
138128
+ toString(t5, e5 = true) {
138129
+ const i5 = t5 || this.separator;
138130
+ return this.path.map((t6) => e5 && t6.namespace ? `${t6.namespace}:${t6.tag}` : t6.tag).join(i5);
138131
+ }
138132
+ toArray() {
138133
+ return this.path.map((t5) => t5.tag);
138134
+ }
138135
+ reset() {
138136
+ this.path = [], this.siblingStacks = [];
138137
+ }
138138
+ matches(t5) {
138139
+ const e5 = t5.segments;
138140
+ return 0 !== e5.length && (t5.hasDeepWildcard() ? this._matchWithDeepWildcard(e5) : this._matchSimple(e5));
138141
+ }
138142
+ _matchSimple(t5) {
138143
+ if (this.path.length !== t5.length) return false;
138144
+ for (let e5 = 0; e5 < t5.length; e5++) {
138145
+ const i5 = t5[e5], n5 = this.path[e5], s7 = e5 === this.path.length - 1;
138146
+ if (!this._matchSegment(i5, n5, s7)) return false;
137325
138147
  }
137326
- } : () => false;
138148
+ return true;
138149
+ }
138150
+ _matchWithDeepWildcard(t5) {
138151
+ let e5 = this.path.length - 1, i5 = t5.length - 1;
138152
+ for (; i5 >= 0 && e5 >= 0; ) {
138153
+ const n5 = t5[i5];
138154
+ if ("deep-wildcard" === n5.type) {
138155
+ if (i5--, i5 < 0) return true;
138156
+ const n6 = t5[i5];
138157
+ let s7 = false;
138158
+ for (let t6 = e5; t6 >= 0; t6--) {
138159
+ const r5 = t6 === this.path.length - 1;
138160
+ if (this._matchSegment(n6, this.path[t6], r5)) {
138161
+ e5 = t6 - 1, i5--, s7 = true;
138162
+ break;
138163
+ }
138164
+ }
138165
+ if (!s7) return false;
138166
+ } else {
138167
+ const t6 = e5 === this.path.length - 1;
138168
+ if (!this._matchSegment(n5, this.path[e5], t6)) return false;
138169
+ e5--, i5--;
138170
+ }
138171
+ }
138172
+ return i5 < 0;
138173
+ }
138174
+ _matchSegment(t5, e5, i5) {
138175
+ if ("*" !== t5.tag && t5.tag !== e5.tag) return false;
138176
+ if (void 0 !== t5.namespace && "*" !== t5.namespace && t5.namespace !== e5.namespace) return false;
138177
+ if (void 0 !== t5.attrName) {
138178
+ if (!i5) return false;
138179
+ if (!e5.values || !(t5.attrName in e5.values)) return false;
138180
+ if (void 0 !== t5.attrValue) {
138181
+ const i6 = e5.values[t5.attrName];
138182
+ if (String(i6) !== String(t5.attrValue)) return false;
138183
+ }
138184
+ }
138185
+ if (void 0 !== t5.position) {
138186
+ if (!i5) return false;
138187
+ const n5 = e5.counter ?? 0;
138188
+ if ("first" === t5.position && 0 !== n5) return false;
138189
+ if ("odd" === t5.position && n5 % 2 != 1) return false;
138190
+ if ("even" === t5.position && n5 % 2 != 0) return false;
138191
+ if ("nth" === t5.position && n5 !== t5.positionValue) return false;
138192
+ }
138193
+ return true;
138194
+ }
138195
+ snapshot() {
138196
+ return { path: this.path.map((t5) => ({ ...t5 })), siblingStacks: this.siblingStacks.map((t5) => new Map(t5)) };
138197
+ }
138198
+ restore(t5) {
138199
+ this.path = t5.path.map((t6) => ({ ...t6 })), this.siblingStacks = t5.siblingStacks.map((t6) => new Map(t6));
138200
+ }
138201
+ }
138202
+ class G4 {
138203
+ constructor(t5, e5 = {}) {
138204
+ this.pattern = t5, this.separator = e5.separator || ".", this.segments = this._parse(t5), this._hasDeepWildcard = this.segments.some((t6) => "deep-wildcard" === t6.type), this._hasAttributeCondition = this.segments.some((t6) => void 0 !== t6.attrName), this._hasPositionSelector = this.segments.some((t6) => void 0 !== t6.position);
138205
+ }
138206
+ _parse(t5) {
138207
+ const e5 = [];
138208
+ let i5 = 0, n5 = "";
138209
+ for (; i5 < t5.length; ) t5[i5] === this.separator ? i5 + 1 < t5.length && t5[i5 + 1] === this.separator ? (n5.trim() && (e5.push(this._parseSegment(n5.trim())), n5 = ""), e5.push({ type: "deep-wildcard" }), i5 += 2) : (n5.trim() && e5.push(this._parseSegment(n5.trim())), n5 = "", i5++) : (n5 += t5[i5], i5++);
138210
+ return n5.trim() && e5.push(this._parseSegment(n5.trim())), e5;
138211
+ }
138212
+ _parseSegment(t5) {
138213
+ const e5 = { type: "tag" };
138214
+ let i5 = null, n5 = t5;
138215
+ const s7 = t5.match(/^([^\[]+)(\[[^\]]*\])(.*)$/);
138216
+ if (s7 && (n5 = s7[1] + s7[3], s7[2])) {
138217
+ const t6 = s7[2].slice(1, -1);
138218
+ t6 && (i5 = t6);
138219
+ }
138220
+ let r5, o5, a5 = n5;
138221
+ if (n5.includes("::")) {
138222
+ const e6 = n5.indexOf("::");
138223
+ if (r5 = n5.substring(0, e6).trim(), a5 = n5.substring(e6 + 2).trim(), !r5) throw new Error(`Invalid namespace in pattern: ${t5}`);
138224
+ }
138225
+ let h5 = null;
138226
+ if (a5.includes(":")) {
138227
+ const t6 = a5.lastIndexOf(":"), e6 = a5.substring(0, t6).trim(), i6 = a5.substring(t6 + 1).trim();
138228
+ ["first", "last", "odd", "even"].includes(i6) || /^nth\(\d+\)$/.test(i6) ? (o5 = e6, h5 = i6) : o5 = a5;
138229
+ } else o5 = a5;
138230
+ if (!o5) throw new Error(`Invalid segment pattern: ${t5}`);
138231
+ if (e5.tag = o5, r5 && (e5.namespace = r5), i5) if (i5.includes("=")) {
138232
+ const t6 = i5.indexOf("=");
138233
+ e5.attrName = i5.substring(0, t6).trim(), e5.attrValue = i5.substring(t6 + 1).trim();
138234
+ } else e5.attrName = i5.trim();
138235
+ if (h5) {
138236
+ const t6 = h5.match(/^nth\((\d+)\)$/);
138237
+ t6 ? (e5.position = "nth", e5.positionValue = parseInt(t6[1], 10)) : e5.position = h5;
138238
+ }
138239
+ return e5;
138240
+ }
138241
+ get length() {
138242
+ return this.segments.length;
138243
+ }
138244
+ hasDeepWildcard() {
138245
+ return this._hasDeepWildcard;
138246
+ }
138247
+ hasAttributeCondition() {
138248
+ return this._hasAttributeCondition;
138249
+ }
138250
+ hasPositionSelector() {
138251
+ return this._hasPositionSelector;
138252
+ }
138253
+ toString() {
138254
+ return this.pattern;
138255
+ }
137327
138256
  }
137328
- class F4 {
138257
+ function R2(t5, e5) {
138258
+ if (!t5) return {};
138259
+ const i5 = e5.attributesGroupName ? t5[e5.attributesGroupName] : t5;
138260
+ if (!i5) return {};
138261
+ const n5 = {};
138262
+ for (const t6 in i5) t6.startsWith(e5.attributeNamePrefix) ? n5[t6.substring(e5.attributeNamePrefix.length)] = i5[t6] : n5[t6] = i5[t6];
138263
+ return n5;
138264
+ }
138265
+ function U3(t5) {
138266
+ if (!t5 || "string" != typeof t5) return;
138267
+ const e5 = t5.indexOf(":");
138268
+ if (-1 !== e5 && e5 > 0) {
138269
+ const i5 = t5.substring(0, e5);
138270
+ if ("xmlns" !== i5) return i5;
138271
+ }
138272
+ }
138273
+ class B4 {
137329
138274
  constructor(t5) {
137330
- if (this.options = t5, 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: "\xA2" }, pound: { regex: /&(pound|#163);/g, val: "\xA3" }, yen: { regex: /&(yen|#165);/g, val: "\xA5" }, euro: { regex: /&(euro|#8364);/g, val: "\u20AC" }, copyright: { regex: /&(copy|#169);/g, val: "\xA9" }, reg: { regex: /&(reg|#174);/g, val: "\xAE" }, inr: { regex: /&(inr|#8377);/g, val: "\u20B9" }, num_dec: { regex: /&#([0-9]{1,7});/g, val: (t6, e5) => Q3(e5, 10, "&#") }, num_hex: { regex: /&#x([0-9a-fA-F]{1,6});/g, val: (t6, e5) => Q3(e5, 16, "&#x") } }, this.addExternalEntities = M3, this.parseXml = R2, this.parseTextData = k6, this.resolveNameSpace = _3, this.buildAttributesMap = B4, this.isItStopNode = z4, this.replaceEntitiesValue = G4, this.readStopNodeData = Z3, this.saveTextToParentTag = X3, this.addChild = Y2, this.ignoreAttributesFn = L3(this.options.ignoreAttributes), this.entityExpansionCount = 0, this.currentExpandedLength = 0, this.options.stopNodes && this.options.stopNodes.length > 0) {
137331
- this.stopNodesExact = /* @__PURE__ */ new Set(), this.stopNodesWildcard = /* @__PURE__ */ new Set();
138275
+ var e5;
138276
+ if (this.options = t5, 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: "\xA2" }, pound: { regex: /&(pound|#163);/g, val: "\xA3" }, yen: { regex: /&(yen|#165);/g, val: "\xA5" }, euro: { regex: /&(euro|#8364);/g, val: "\u20AC" }, copyright: { regex: /&(copy|#169);/g, val: "\xA9" }, reg: { regex: /&(reg|#174);/g, val: "\xAE" }, inr: { regex: /&(inr|#8377);/g, val: "\u20B9" }, num_dec: { regex: /&#([0-9]{1,7});/g, val: (t6, e6) => st2(e6, 10, "&#") }, num_hex: { regex: /&#x([0-9a-fA-F]{1,6});/g, val: (t6, e6) => st2(e6, 16, "&#x") } }, this.addExternalEntities = W3, this.parseXml = Z3, this.parseTextData = Y2, this.resolveNameSpace = X3, this.buildAttributesMap = q6, this.isItStopNode = H3, this.replaceEntitiesValue = K3, this.readStopNodeData = it2, this.saveTextToParentTag = Q3, this.addChild = J4, this.ignoreAttributesFn = "function" == typeof (e5 = this.options.ignoreAttributes) ? e5 : Array.isArray(e5) ? (t6) => {
138277
+ for (const i5 of e5) {
138278
+ if ("string" == typeof i5 && t6 === i5) return true;
138279
+ if (i5 instanceof RegExp && i5.test(t6)) return true;
138280
+ }
138281
+ } : () => false, this.entityExpansionCount = 0, this.currentExpandedLength = 0, this.matcher = new L3(), this.isCurrentNodeStopNode = false, this.options.stopNodes && this.options.stopNodes.length > 0) {
138282
+ this.stopNodeExpressions = [];
137332
138283
  for (let t6 = 0; t6 < this.options.stopNodes.length; t6++) {
137333
- const e5 = this.options.stopNodes[t6];
137334
- "string" == typeof e5 && (e5.startsWith("*.") ? this.stopNodesWildcard.add(e5.substring(2)) : this.stopNodesExact.add(e5));
138284
+ const e6 = this.options.stopNodes[t6];
138285
+ "string" == typeof e6 ? this.stopNodeExpressions.push(new G4(e6)) : e6 instanceof G4 && this.stopNodeExpressions.push(e6);
137335
138286
  }
137336
138287
  }
137337
138288
  }
137338
138289
  }
137339
- function M3(t5) {
138290
+ function W3(t5) {
137340
138291
  const e5 = Object.keys(t5);
137341
- for (let n5 = 0; n5 < e5.length; n5++) {
137342
- const i5 = e5[n5], s7 = i5.replace(/[.\-+*:]/g, "\\.");
137343
- this.lastEntities[i5] = { regex: new RegExp("&" + s7 + ";", "g"), val: t5[i5] };
138292
+ for (let i5 = 0; i5 < e5.length; i5++) {
138293
+ const n5 = e5[i5], s7 = n5.replace(/[.\-+*:]/g, "\\.");
138294
+ this.lastEntities[n5] = { regex: new RegExp("&" + s7 + ";", "g"), val: t5[n5] };
137344
138295
  }
137345
138296
  }
137346
- function k6(t5, e5, n5, i5, s7, r5, o5) {
137347
- if (void 0 !== t5 && (this.options.trimValues && !i5 && (t5 = t5.trim()), t5.length > 0)) {
137348
- o5 || (t5 = this.replaceEntitiesValue(t5, e5, n5));
137349
- const i6 = this.options.tagValueProcessor(e5, t5, n5, s7, r5);
137350
- return null == i6 ? t5 : typeof i6 != typeof t5 || i6 !== t5 ? i6 : this.options.trimValues || t5.trim() === t5 ? K3(t5, this.options.parseTagValue, this.options.numberParseOptions) : t5;
138297
+ function Y2(t5, e5, i5, n5, s7, r5, o5) {
138298
+ if (void 0 !== t5 && (this.options.trimValues && !n5 && (t5 = t5.trim()), t5.length > 0)) {
138299
+ o5 || (t5 = this.replaceEntitiesValue(t5, e5, i5));
138300
+ const n6 = this.options.jPath ? i5.toString() : i5, a5 = this.options.tagValueProcessor(e5, t5, n6, s7, r5);
138301
+ return null == a5 ? t5 : typeof a5 != typeof t5 || a5 !== t5 ? a5 : this.options.trimValues || t5.trim() === t5 ? nt2(t5, this.options.parseTagValue, this.options.numberParseOptions) : t5;
137351
138302
  }
137352
138303
  }
137353
- function _3(t5) {
138304
+ function X3(t5) {
137354
138305
  if (this.options.removeNSPrefix) {
137355
- const e5 = t5.split(":"), n5 = "/" === t5.charAt(0) ? "/" : "";
138306
+ const e5 = t5.split(":"), i5 = "/" === t5.charAt(0) ? "/" : "";
137356
138307
  if ("xmlns" === e5[0]) return "";
137357
- 2 === e5.length && (t5 = n5 + e5[1]);
138308
+ 2 === e5.length && (t5 = i5 + e5[1]);
137358
138309
  }
137359
138310
  return t5;
137360
138311
  }
137361
- const U3 = new RegExp(`([^\\s=]+)\\s*(=\\s*(['"])([\\s\\S]*?)\\3)?`, "gm");
137362
- function B4(t5, e5, n5) {
138312
+ const z4 = new RegExp(`([^\\s=]+)\\s*(=\\s*(['"])([\\s\\S]*?)\\3)?`, "gm");
138313
+ function q6(t5, e5, i5) {
137363
138314
  if (true !== this.options.ignoreAttributes && "string" == typeof t5) {
137364
- const i5 = s6(t5, U3), r5 = i5.length, o5 = {};
138315
+ const n5 = s6(t5, z4), r5 = n5.length, o5 = {}, a5 = {};
137365
138316
  for (let t6 = 0; t6 < r5; t6++) {
137366
- const s7 = this.resolveNameSpace(i5[t6][1]);
137367
- if (this.ignoreAttributesFn(s7, e5)) continue;
137368
- let r6 = i5[t6][4], a5 = this.options.attributeNamePrefix + s7;
137369
- if (s7.length) if (this.options.transformAttributeName && (a5 = this.options.transformAttributeName(a5)), "__proto__" === a5 && (a5 = "#__proto__"), void 0 !== r6) {
137370
- this.options.trimValues && (r6 = r6.trim()), r6 = this.replaceEntitiesValue(r6, n5, e5);
137371
- const t7 = this.options.attributeValueProcessor(s7, r6, e5);
137372
- o5[a5] = null == t7 ? r6 : typeof t7 != typeof r6 || t7 !== r6 ? t7 : K3(r6, this.options.parseAttributeValue, this.options.numberParseOptions);
137373
- } else this.options.allowBooleanAttributes && (o5[a5] = true);
138317
+ const s7 = this.resolveNameSpace(n5[t6][1]), r6 = n5[t6][4];
138318
+ if (s7.length && void 0 !== r6) {
138319
+ let t7 = r6;
138320
+ this.options.trimValues && (t7 = t7.trim()), t7 = this.replaceEntitiesValue(t7, i5, e5), a5[s7] = t7;
138321
+ }
138322
+ }
138323
+ Object.keys(a5).length > 0 && "object" == typeof e5 && e5.updateCurrent && e5.updateCurrent(a5);
138324
+ for (let t6 = 0; t6 < r5; t6++) {
138325
+ const s7 = this.resolveNameSpace(n5[t6][1]), r6 = this.options.jPath ? e5.toString() : e5;
138326
+ if (this.ignoreAttributesFn(s7, r6)) continue;
138327
+ let a6 = n5[t6][4], h5 = this.options.attributeNamePrefix + s7;
138328
+ if (s7.length) if (this.options.transformAttributeName && (h5 = this.options.transformAttributeName(h5)), h5 = ot2(h5, this.options), void 0 !== a6) {
138329
+ this.options.trimValues && (a6 = a6.trim()), a6 = this.replaceEntitiesValue(a6, i5, e5);
138330
+ const t7 = this.options.jPath ? e5.toString() : e5, n6 = this.options.attributeValueProcessor(s7, a6, t7);
138331
+ o5[h5] = null == n6 ? a6 : typeof n6 != typeof a6 || n6 !== a6 ? n6 : nt2(a6, this.options.parseAttributeValue, this.options.numberParseOptions);
138332
+ } else this.options.allowBooleanAttributes && (o5[h5] = true);
137374
138333
  }
137375
138334
  if (!Object.keys(o5).length) return;
137376
138335
  if (this.options.attributesGroupName) {
@@ -137380,282 +138339,340 @@ var require_fxp = __commonJS({
137380
138339
  return o5;
137381
138340
  }
137382
138341
  }
137383
- const R2 = function(t5) {
138342
+ const Z3 = function(t5) {
137384
138343
  t5 = t5.replace(/\r\n?/g, "\n");
137385
- const e5 = new I4("!xml");
137386
- let n5 = e5, i5 = "", s7 = "";
137387
- this.entityExpansionCount = 0, this.currentExpandedLength = 0;
137388
- const r5 = new P3(this.options.processEntities);
137389
- for (let o5 = 0; o5 < t5.length; o5++) if ("<" === t5[o5]) if ("/" === t5[o5 + 1]) {
137390
- const e6 = W3(t5, ">", o5, "Closing Tag is not closed.");
137391
- let r6 = t5.substring(o5 + 2, e6).trim();
138344
+ const e5 = new $3("!xml");
138345
+ let i5 = e5, n5 = "";
138346
+ this.matcher.reset(), this.entityExpansionCount = 0, this.currentExpandedLength = 0;
138347
+ const s7 = new I4(this.options.processEntities);
138348
+ for (let r5 = 0; r5 < t5.length; r5++) if ("<" === t5[r5]) if ("/" === t5[r5 + 1]) {
138349
+ const e6 = tt2(t5, ">", r5, "Closing Tag is not closed.");
138350
+ let s8 = t5.substring(r5 + 2, e6).trim();
137392
138351
  if (this.options.removeNSPrefix) {
137393
- const t6 = r6.indexOf(":");
137394
- -1 !== t6 && (r6 = r6.substr(t6 + 1));
137395
- }
137396
- this.options.transformTagName && (r6 = this.options.transformTagName(r6)), n5 && (i5 = this.saveTextToParentTag(i5, n5, s7));
137397
- const a5 = s7.substring(s7.lastIndexOf(".") + 1);
137398
- if (r6 && -1 !== this.options.unpairedTags.indexOf(r6)) throw new Error(`Unpaired tag can not be used as closing tag: </${r6}>`);
137399
- let l5 = 0;
137400
- a5 && -1 !== this.options.unpairedTags.indexOf(a5) ? (l5 = s7.lastIndexOf(".", s7.lastIndexOf(".") - 1), this.tagsNodeStack.pop()) : l5 = s7.lastIndexOf("."), s7 = s7.substring(0, l5), n5 = this.tagsNodeStack.pop(), i5 = "", o5 = e6;
137401
- } else if ("?" === t5[o5 + 1]) {
137402
- let e6 = q6(t5, o5, false, "?>");
138352
+ const t6 = s8.indexOf(":");
138353
+ -1 !== t6 && (s8 = s8.substr(t6 + 1));
138354
+ }
138355
+ s8 = rt2(this.options.transformTagName, s8, "", this.options).tagName, i5 && (n5 = this.saveTextToParentTag(n5, i5, this.matcher));
138356
+ const o5 = this.matcher.getCurrentTag();
138357
+ if (s8 && -1 !== this.options.unpairedTags.indexOf(s8)) throw new Error(`Unpaired tag can not be used as closing tag: </${s8}>`);
138358
+ o5 && -1 !== this.options.unpairedTags.indexOf(o5) && (this.matcher.pop(), this.tagsNodeStack.pop()), this.matcher.pop(), this.isCurrentNodeStopNode = false, i5 = this.tagsNodeStack.pop(), n5 = "", r5 = e6;
138359
+ } else if ("?" === t5[r5 + 1]) {
138360
+ let e6 = et2(t5, r5, false, "?>");
137403
138361
  if (!e6) throw new Error("Pi Tag is not closed.");
137404
- if (i5 = this.saveTextToParentTag(i5, n5, s7), this.options.ignoreDeclaration && "?xml" === e6.tagName || this.options.ignorePiTags) ;
138362
+ if (n5 = this.saveTextToParentTag(n5, i5, this.matcher), this.options.ignoreDeclaration && "?xml" === e6.tagName || this.options.ignorePiTags) ;
137405
138363
  else {
137406
- const t6 = new I4(e6.tagName);
137407
- t6.add(this.options.textNodeName, ""), e6.tagName !== e6.tagExp && e6.attrExpPresent && (t6[":@"] = this.buildAttributesMap(e6.tagExp, s7, e6.tagName)), this.addChild(n5, t6, s7, o5);
138364
+ const t6 = new $3(e6.tagName);
138365
+ t6.add(this.options.textNodeName, ""), e6.tagName !== e6.tagExp && e6.attrExpPresent && (t6[":@"] = this.buildAttributesMap(e6.tagExp, this.matcher, e6.tagName)), this.addChild(i5, t6, this.matcher, r5);
137408
138366
  }
137409
- o5 = e6.closeIndex + 1;
137410
- } else if ("!--" === t5.substr(o5 + 1, 3)) {
137411
- const e6 = W3(t5, "-->", o5 + 4, "Comment is not closed.");
138367
+ r5 = e6.closeIndex + 1;
138368
+ } else if ("!--" === t5.substr(r5 + 1, 3)) {
138369
+ const e6 = tt2(t5, "-->", r5 + 4, "Comment is not closed.");
137412
138370
  if (this.options.commentPropName) {
137413
- const r6 = t5.substring(o5 + 4, e6 - 2);
137414
- i5 = this.saveTextToParentTag(i5, n5, s7), n5.add(this.options.commentPropName, [{ [this.options.textNodeName]: r6 }]);
137415
- }
137416
- o5 = e6;
137417
- } else if ("!D" === t5.substr(o5 + 1, 2)) {
137418
- const e6 = r5.readDocType(t5, o5);
137419
- this.docTypeEntities = e6.entities, o5 = e6.i;
137420
- } else if ("![" === t5.substr(o5 + 1, 2)) {
137421
- const e6 = W3(t5, "]]>", o5, "CDATA is not closed.") - 2, r6 = t5.substring(o5 + 9, e6);
137422
- i5 = this.saveTextToParentTag(i5, n5, s7);
137423
- let a5 = this.parseTextData(r6, n5.tagname, s7, true, false, true, true);
137424
- null == a5 && (a5 = ""), this.options.cdataPropName ? n5.add(this.options.cdataPropName, [{ [this.options.textNodeName]: r6 }]) : n5.add(this.options.textNodeName, a5), o5 = e6 + 2;
138371
+ const s8 = t5.substring(r5 + 4, e6 - 2);
138372
+ n5 = this.saveTextToParentTag(n5, i5, this.matcher), i5.add(this.options.commentPropName, [{ [this.options.textNodeName]: s8 }]);
138373
+ }
138374
+ r5 = e6;
138375
+ } else if ("!D" === t5.substr(r5 + 1, 2)) {
138376
+ const e6 = s7.readDocType(t5, r5);
138377
+ this.docTypeEntities = e6.entities, r5 = e6.i;
138378
+ } else if ("![" === t5.substr(r5 + 1, 2)) {
138379
+ const e6 = tt2(t5, "]]>", r5, "CDATA is not closed.") - 2, s8 = t5.substring(r5 + 9, e6);
138380
+ n5 = this.saveTextToParentTag(n5, i5, this.matcher);
138381
+ let o5 = this.parseTextData(s8, i5.tagname, this.matcher, true, false, true, true);
138382
+ null == o5 && (o5 = ""), this.options.cdataPropName ? i5.add(this.options.cdataPropName, [{ [this.options.textNodeName]: s8 }]) : i5.add(this.options.textNodeName, o5), r5 = e6 + 2;
137425
138383
  } else {
137426
- let r6 = q6(t5, o5, this.options.removeNSPrefix), a5 = r6.tagName;
137427
- const l5 = r6.rawTagName;
137428
- let u8 = r6.tagExp, d6 = r6.attrExpPresent, h5 = r6.closeIndex;
137429
- if (this.options.transformTagName) {
137430
- const t6 = this.options.transformTagName(a5);
137431
- u8 === a5 && (u8 = t6), a5 = t6;
137432
- }
137433
- n5 && i5 && "!xml" !== n5.tagname && (i5 = this.saveTextToParentTag(i5, n5, s7, false));
137434
- const p6 = n5;
137435
- p6 && -1 !== this.options.unpairedTags.indexOf(p6.tagname) && (n5 = this.tagsNodeStack.pop(), s7 = s7.substring(0, s7.lastIndexOf("."))), a5 !== e5.tagname && (s7 += s7 ? "." + a5 : a5);
137436
- const c5 = o5;
137437
- if (this.isItStopNode(this.stopNodesExact, this.stopNodesWildcard, s7, a5)) {
138384
+ let s8 = et2(t5, r5, this.options.removeNSPrefix);
138385
+ if (!s8) {
138386
+ const e6 = t5.substring(Math.max(0, r5 - 50), Math.min(t5.length, r5 + 50));
138387
+ throw new Error(`readTagExp returned undefined at position ${r5}. Context: "${e6}"`);
138388
+ }
138389
+ let o5 = s8.tagName;
138390
+ const a5 = s8.rawTagName;
138391
+ let h5 = s8.tagExp, l5 = s8.attrExpPresent, p6 = s8.closeIndex;
138392
+ if ({ tagName: o5, tagExp: h5 } = rt2(this.options.transformTagName, o5, h5, this.options), this.options.strictReservedNames && (o5 === this.options.commentPropName || o5 === this.options.cdataPropName || o5 === this.options.textNodeName || o5 === this.options.attributesGroupName)) throw new Error(`Invalid tag name: ${o5}`);
138393
+ i5 && n5 && "!xml" !== i5.tagname && (n5 = this.saveTextToParentTag(n5, i5, this.matcher, false));
138394
+ const u8 = i5;
138395
+ u8 && -1 !== this.options.unpairedTags.indexOf(u8.tagname) && (i5 = this.tagsNodeStack.pop(), this.matcher.pop());
138396
+ let c5 = false;
138397
+ h5.length > 0 && h5.lastIndexOf("/") === h5.length - 1 && (c5 = true, "/" === o5[o5.length - 1] ? (o5 = o5.substr(0, o5.length - 1), h5 = o5) : h5 = h5.substr(0, h5.length - 1), l5 = o5 !== h5);
138398
+ let d6, f6 = null, g6 = {};
138399
+ d6 = U3(a5), o5 !== e5.tagname && this.matcher.push(o5, {}, d6), o5 !== h5 && l5 && (f6 = this.buildAttributesMap(h5, this.matcher, o5), f6 && (g6 = R2(f6, this.options))), o5 !== e5.tagname && (this.isCurrentNodeStopNode = this.isItStopNode(this.stopNodeExpressions, this.matcher));
138400
+ const m7 = r5;
138401
+ if (this.isCurrentNodeStopNode) {
137438
138402
  let e6 = "";
137439
- if (u8.length > 0 && u8.lastIndexOf("/") === u8.length - 1) "/" === a5[a5.length - 1] ? (a5 = a5.substr(0, a5.length - 1), s7 = s7.substr(0, s7.length - 1), u8 = a5) : u8 = u8.substr(0, u8.length - 1), o5 = r6.closeIndex;
137440
- else if (-1 !== this.options.unpairedTags.indexOf(a5)) o5 = r6.closeIndex;
138403
+ if (c5) r5 = s8.closeIndex;
138404
+ else if (-1 !== this.options.unpairedTags.indexOf(o5)) r5 = s8.closeIndex;
137441
138405
  else {
137442
- const n6 = this.readStopNodeData(t5, l5, h5 + 1);
137443
- if (!n6) throw new Error(`Unexpected end of ${l5}`);
137444
- o5 = n6.i, e6 = n6.tagContent;
138406
+ const i6 = this.readStopNodeData(t5, a5, p6 + 1);
138407
+ if (!i6) throw new Error(`Unexpected end of ${a5}`);
138408
+ r5 = i6.i, e6 = i6.tagContent;
137445
138409
  }
137446
- const i6 = new I4(a5);
137447
- a5 !== u8 && d6 && (i6[":@"] = this.buildAttributesMap(u8, s7, a5)), e6 && (e6 = this.parseTextData(e6, a5, s7, true, d6, true, true)), s7 = s7.substr(0, s7.lastIndexOf(".")), i6.add(this.options.textNodeName, e6), this.addChild(n5, i6, s7, c5);
138410
+ const n6 = new $3(o5);
138411
+ f6 && (n6[":@"] = f6), n6.add(this.options.textNodeName, e6), this.matcher.pop(), this.isCurrentNodeStopNode = false, this.addChild(i5, n6, this.matcher, m7);
137448
138412
  } else {
137449
- if (u8.length > 0 && u8.lastIndexOf("/") === u8.length - 1) {
137450
- if ("/" === a5[a5.length - 1] ? (a5 = a5.substr(0, a5.length - 1), s7 = s7.substr(0, s7.length - 1), u8 = a5) : u8 = u8.substr(0, u8.length - 1), this.options.transformTagName) {
137451
- const t7 = this.options.transformTagName(a5);
137452
- u8 === a5 && (u8 = t7), a5 = t7;
137453
- }
137454
- const t6 = new I4(a5);
137455
- a5 !== u8 && d6 && (t6[":@"] = this.buildAttributesMap(u8, s7, a5)), this.addChild(n5, t6, s7, c5), s7 = s7.substr(0, s7.lastIndexOf("."));
138413
+ if (c5) {
138414
+ ({ tagName: o5, tagExp: h5 } = rt2(this.options.transformTagName, o5, h5, this.options));
138415
+ const t6 = new $3(o5);
138416
+ f6 && (t6[":@"] = f6), this.addChild(i5, t6, this.matcher, m7), this.matcher.pop(), this.isCurrentNodeStopNode = false;
137456
138417
  } else {
137457
- const t6 = new I4(a5);
137458
- if (this.tagsNodeStack.length > this.options.maxNestedTags) throw new Error("Maximum nested tags exceeded");
137459
- this.tagsNodeStack.push(n5), a5 !== u8 && d6 && (t6[":@"] = this.buildAttributesMap(u8, s7, a5)), this.addChild(n5, t6, s7, c5), n5 = t6;
138418
+ if (-1 !== this.options.unpairedTags.indexOf(o5)) {
138419
+ const t6 = new $3(o5);
138420
+ f6 && (t6[":@"] = f6), this.addChild(i5, t6, this.matcher, m7), this.matcher.pop(), this.isCurrentNodeStopNode = false, r5 = s8.closeIndex;
138421
+ continue;
138422
+ }
138423
+ {
138424
+ const t6 = new $3(o5);
138425
+ if (this.tagsNodeStack.length > this.options.maxNestedTags) throw new Error("Maximum nested tags exceeded");
138426
+ this.tagsNodeStack.push(i5), f6 && (t6[":@"] = f6), this.addChild(i5, t6, this.matcher, m7), i5 = t6;
138427
+ }
137460
138428
  }
137461
- i5 = "", o5 = h5;
138429
+ n5 = "", r5 = p6;
137462
138430
  }
137463
138431
  }
137464
- else i5 += t5[o5];
138432
+ else n5 += t5[r5];
137465
138433
  return e5.child;
137466
138434
  };
137467
- function Y2(t5, e5, n5, i5) {
137468
- this.options.captureMetaData || (i5 = void 0);
137469
- const s7 = this.options.updateTag(e5.tagname, n5, e5[":@"]);
137470
- false === s7 || ("string" == typeof s7 ? (e5.tagname = s7, t5.addChild(e5, i5)) : t5.addChild(e5, i5));
138435
+ function J4(t5, e5, i5, n5) {
138436
+ this.options.captureMetaData || (n5 = void 0);
138437
+ const s7 = this.options.jPath ? i5.toString() : i5, r5 = this.options.updateTag(e5.tagname, s7, e5[":@"]);
138438
+ false === r5 || ("string" == typeof r5 ? (e5.tagname = r5, t5.addChild(e5, n5)) : t5.addChild(e5, n5));
137471
138439
  }
137472
- const G4 = function(t5, e5, n5) {
137473
- if (-1 === t5.indexOf("&")) return t5;
137474
- const i5 = this.options.processEntities;
137475
- if (!i5.enabled) return t5;
137476
- if (i5.allowedTags && !i5.allowedTags.includes(e5)) return t5;
137477
- if (i5.tagFilter && !i5.tagFilter(e5, n5)) return t5;
137478
- for (let e6 in this.docTypeEntities) {
137479
- const n6 = this.docTypeEntities[e6], s7 = t5.match(n6.regx);
138440
+ function K3(t5, e5, i5) {
138441
+ const n5 = this.options.processEntities;
138442
+ if (!n5 || !n5.enabled) return t5;
138443
+ if (n5.allowedTags) {
138444
+ const s7 = this.options.jPath ? i5.toString() : i5;
138445
+ if (!(Array.isArray(n5.allowedTags) ? n5.allowedTags.includes(e5) : n5.allowedTags(e5, s7))) return t5;
138446
+ }
138447
+ if (n5.tagFilter) {
138448
+ const s7 = this.options.jPath ? i5.toString() : i5;
138449
+ if (!n5.tagFilter(e5, s7)) return t5;
138450
+ }
138451
+ for (const e6 of Object.keys(this.docTypeEntities)) {
138452
+ const i6 = this.docTypeEntities[e6], s7 = t5.match(i6.regx);
137480
138453
  if (s7) {
137481
- if (this.entityExpansionCount += s7.length, i5.maxTotalExpansions && this.entityExpansionCount > i5.maxTotalExpansions) throw new Error(`Entity expansion limit exceeded: ${this.entityExpansionCount} > ${i5.maxTotalExpansions}`);
138454
+ if (this.entityExpansionCount += s7.length, n5.maxTotalExpansions && this.entityExpansionCount > n5.maxTotalExpansions) throw new Error(`Entity expansion limit exceeded: ${this.entityExpansionCount} > ${n5.maxTotalExpansions}`);
137482
138455
  const e7 = t5.length;
137483
- if (t5 = t5.replace(n6.regx, n6.val), i5.maxExpandedLength && (this.currentExpandedLength += t5.length - e7, this.currentExpandedLength > i5.maxExpandedLength)) throw new Error(`Total expanded content size exceeded: ${this.currentExpandedLength} > ${i5.maxExpandedLength}`);
138456
+ if (t5 = t5.replace(i6.regx, i6.val), n5.maxExpandedLength && (this.currentExpandedLength += t5.length - e7, this.currentExpandedLength > n5.maxExpandedLength)) throw new Error(`Total expanded content size exceeded: ${this.currentExpandedLength} > ${n5.maxExpandedLength}`);
137484
138457
  }
137485
138458
  }
137486
- if (-1 === t5.indexOf("&")) return t5;
137487
- for (let e6 in this.lastEntities) {
137488
- const n6 = this.lastEntities[e6];
137489
- t5 = t5.replace(n6.regex, n6.val);
138459
+ for (const e6 of Object.keys(this.lastEntities)) {
138460
+ const i6 = this.lastEntities[e6], s7 = t5.match(i6.regex);
138461
+ if (s7 && (this.entityExpansionCount += s7.length, n5.maxTotalExpansions && this.entityExpansionCount > n5.maxTotalExpansions)) throw new Error(`Entity expansion limit exceeded: ${this.entityExpansionCount} > ${n5.maxTotalExpansions}`);
138462
+ t5 = t5.replace(i6.regex, i6.val);
137490
138463
  }
137491
138464
  if (-1 === t5.indexOf("&")) return t5;
137492
- if (this.options.htmlEntities) for (let e6 in this.htmlEntities) {
137493
- const n6 = this.htmlEntities[e6];
137494
- t5 = t5.replace(n6.regex, n6.val);
138465
+ if (this.options.htmlEntities) for (const e6 of Object.keys(this.htmlEntities)) {
138466
+ const i6 = this.htmlEntities[e6], s7 = t5.match(i6.regex);
138467
+ if (s7 && (this.entityExpansionCount += s7.length, n5.maxTotalExpansions && this.entityExpansionCount > n5.maxTotalExpansions)) throw new Error(`Entity expansion limit exceeded: ${this.entityExpansionCount} > ${n5.maxTotalExpansions}`);
138468
+ t5 = t5.replace(i6.regex, i6.val);
137495
138469
  }
137496
138470
  return t5.replace(this.ampEntity.regex, this.ampEntity.val);
137497
- };
137498
- function X3(t5, e5, n5, i5) {
137499
- return t5 && (void 0 === i5 && (i5 = 0 === e5.child.length), void 0 !== (t5 = this.parseTextData(t5, e5.tagname, n5, false, !!e5[":@"] && 0 !== Object.keys(e5[":@"]).length, i5)) && "" !== t5 && e5.add(this.options.textNodeName, t5), t5 = ""), t5;
137500
138471
  }
137501
- function z4(t5, e5, n5, i5) {
137502
- return !(!e5 || !e5.has(i5)) || !(!t5 || !t5.has(n5));
138472
+ function Q3(t5, e5, i5, n5) {
138473
+ return t5 && (void 0 === n5 && (n5 = 0 === e5.child.length), void 0 !== (t5 = this.parseTextData(t5, e5.tagname, i5, false, !!e5[":@"] && 0 !== Object.keys(e5[":@"]).length, n5)) && "" !== t5 && e5.add(this.options.textNodeName, t5), t5 = ""), t5;
138474
+ }
138475
+ function H3(t5, e5) {
138476
+ if (!t5 || 0 === t5.length) return false;
138477
+ for (let i5 = 0; i5 < t5.length; i5++) if (e5.matches(t5[i5])) return true;
138478
+ return false;
137503
138479
  }
137504
- function W3(t5, e5, n5, i5) {
137505
- const s7 = t5.indexOf(e5, n5);
137506
- if (-1 === s7) throw new Error(i5);
138480
+ function tt2(t5, e5, i5, n5) {
138481
+ const s7 = t5.indexOf(e5, i5);
138482
+ if (-1 === s7) throw new Error(n5);
137507
138483
  return s7 + e5.length - 1;
137508
138484
  }
137509
- function q6(t5, e5, n5, i5 = ">") {
137510
- const s7 = (function(t6, e6, n6 = ">") {
137511
- let i6, s8 = "";
138485
+ function et2(t5, e5, i5, n5 = ">") {
138486
+ const s7 = (function(t6, e6, i6 = ">") {
138487
+ let n6, s8 = "";
137512
138488
  for (let r6 = e6; r6 < t6.length; r6++) {
137513
138489
  let e7 = t6[r6];
137514
- if (i6) e7 === i6 && (i6 = "");
137515
- else if ('"' === e7 || "'" === e7) i6 = e7;
137516
- else if (e7 === n6[0]) {
137517
- if (!n6[1]) return { data: s8, index: r6 };
137518
- if (t6[r6 + 1] === n6[1]) return { data: s8, index: r6 };
138490
+ if (n6) e7 === n6 && (n6 = "");
138491
+ else if ('"' === e7 || "'" === e7) n6 = e7;
138492
+ else if (e7 === i6[0]) {
138493
+ if (!i6[1]) return { data: s8, index: r6 };
138494
+ if (t6[r6 + 1] === i6[1]) return { data: s8, index: r6 };
137519
138495
  } else " " === e7 && (e7 = " ");
137520
138496
  s8 += e7;
137521
138497
  }
137522
- })(t5, e5 + 1, i5);
138498
+ })(t5, e5 + 1, n5);
137523
138499
  if (!s7) return;
137524
138500
  let r5 = s7.data;
137525
138501
  const o5 = s7.index, a5 = r5.search(/\s/);
137526
- let l5 = r5, u8 = true;
137527
- -1 !== a5 && (l5 = r5.substring(0, a5), r5 = r5.substring(a5 + 1).trimStart());
137528
- const d6 = l5;
137529
- if (n5) {
137530
- const t6 = l5.indexOf(":");
137531
- -1 !== t6 && (l5 = l5.substr(t6 + 1), u8 = l5 !== s7.data.substr(t6 + 1));
138502
+ let h5 = r5, l5 = true;
138503
+ -1 !== a5 && (h5 = r5.substring(0, a5), r5 = r5.substring(a5 + 1).trimStart());
138504
+ const p6 = h5;
138505
+ if (i5) {
138506
+ const t6 = h5.indexOf(":");
138507
+ -1 !== t6 && (h5 = h5.substr(t6 + 1), l5 = h5 !== s7.data.substr(t6 + 1));
137532
138508
  }
137533
- return { tagName: l5, tagExp: r5, closeIndex: o5, attrExpPresent: u8, rawTagName: d6 };
138509
+ return { tagName: h5, tagExp: r5, closeIndex: o5, attrExpPresent: l5, rawTagName: p6 };
137534
138510
  }
137535
- function Z3(t5, e5, n5) {
137536
- const i5 = n5;
138511
+ function it2(t5, e5, i5) {
138512
+ const n5 = i5;
137537
138513
  let s7 = 1;
137538
- for (; n5 < t5.length; n5++) if ("<" === t5[n5]) if ("/" === t5[n5 + 1]) {
137539
- const r5 = W3(t5, ">", n5, `${e5} is not closed`);
137540
- if (t5.substring(n5 + 2, r5).trim() === e5 && (s7--, 0 === s7)) return { tagContent: t5.substring(i5, n5), i: r5 };
137541
- n5 = r5;
137542
- } else if ("?" === t5[n5 + 1]) n5 = W3(t5, "?>", n5 + 1, "StopNode is not closed.");
137543
- else if ("!--" === t5.substr(n5 + 1, 3)) n5 = W3(t5, "-->", n5 + 3, "StopNode is not closed.");
137544
- else if ("![" === t5.substr(n5 + 1, 2)) n5 = W3(t5, "]]>", n5, "StopNode is not closed.") - 2;
138514
+ for (; i5 < t5.length; i5++) if ("<" === t5[i5]) if ("/" === t5[i5 + 1]) {
138515
+ const r5 = tt2(t5, ">", i5, `${e5} is not closed`);
138516
+ if (t5.substring(i5 + 2, r5).trim() === e5 && (s7--, 0 === s7)) return { tagContent: t5.substring(n5, i5), i: r5 };
138517
+ i5 = r5;
138518
+ } else if ("?" === t5[i5 + 1]) i5 = tt2(t5, "?>", i5 + 1, "StopNode is not closed.");
138519
+ else if ("!--" === t5.substr(i5 + 1, 3)) i5 = tt2(t5, "-->", i5 + 3, "StopNode is not closed.");
138520
+ else if ("![" === t5.substr(i5 + 1, 2)) i5 = tt2(t5, "]]>", i5, "StopNode is not closed.") - 2;
137545
138521
  else {
137546
- const i6 = q6(t5, n5, ">");
137547
- i6 && ((i6 && i6.tagName) === e5 && "/" !== i6.tagExp[i6.tagExp.length - 1] && s7++, n5 = i6.closeIndex);
138522
+ const n6 = et2(t5, i5, ">");
138523
+ n6 && ((n6 && n6.tagName) === e5 && "/" !== n6.tagExp[n6.tagExp.length - 1] && s7++, i5 = n6.closeIndex);
137548
138524
  }
137549
138525
  }
137550
- function K3(t5, e5, n5) {
138526
+ function nt2(t5, e5, i5) {
137551
138527
  if (e5 && "string" == typeof t5) {
137552
138528
  const e6 = t5.trim();
137553
138529
  return "true" === e6 || "false" !== e6 && (function(t6, e7 = {}) {
137554
- if (e7 = Object.assign({}, D4, e7), !t6 || "string" != typeof t6) return t6;
137555
- let n6 = t6.trim();
137556
- if (void 0 !== e7.skipLike && e7.skipLike.test(n6)) return t6;
138530
+ if (e7 = Object.assign({}, M3, e7), !t6 || "string" != typeof t6) return t6;
138531
+ let i6 = t6.trim();
138532
+ if (void 0 !== e7.skipLike && e7.skipLike.test(i6)) return t6;
137557
138533
  if ("0" === t6) return 0;
137558
- if (e7.hex && $3.test(n6)) return (function(t7) {
138534
+ if (e7.hex && V2.test(i6)) return (function(t7) {
137559
138535
  if (parseInt) return parseInt(t7, 16);
137560
138536
  if (Number.parseInt) return Number.parseInt(t7, 16);
137561
138537
  if (window && window.parseInt) return window.parseInt(t7, 16);
137562
138538
  throw new Error("parseInt, Number.parseInt, window.parseInt are not supported");
137563
- })(n6);
137564
- if (n6.includes("e") || n6.includes("E")) return (function(t7, e8, n7) {
137565
- if (!n7.eNotation) return t7;
137566
- const i6 = e8.match(j6);
137567
- if (i6) {
137568
- let s7 = i6[1] || "";
137569
- const r5 = -1 === i6[3].indexOf("e") ? "E" : "e", o5 = i6[2], a5 = s7 ? t7[o5.length + 1] === r5 : t7[o5.length] === r5;
137570
- return o5.length > 1 && a5 ? t7 : 1 !== o5.length || !i6[3].startsWith(`.${r5}`) && i6[3][0] !== r5 ? n7.leadingZeros && !a5 ? (e8 = (i6[1] || "") + i6[3], Number(e8)) : t7 : Number(e8);
137571
- }
137572
- return t7;
137573
- })(t6, n6, e7);
137574
- {
137575
- const s7 = V2.exec(n6);
137576
- if (s7) {
137577
- const r5 = s7[1] || "", o5 = s7[2];
137578
- let a5 = (i5 = s7[3]) && -1 !== i5.indexOf(".") ? ("." === (i5 = i5.replace(/0+$/, "")) ? i5 = "0" : "." === i5[0] ? i5 = "0" + i5 : "." === i5[i5.length - 1] && (i5 = i5.substring(0, i5.length - 1)), i5) : i5;
137579
- const l5 = r5 ? "." === t6[o5.length + 1] : "." === t6[o5.length];
137580
- if (!e7.leadingZeros && (o5.length > 1 || 1 === o5.length && !l5)) return t6;
137581
- {
137582
- const i6 = Number(n6), s8 = String(i6);
137583
- if (0 === i6) return i6;
137584
- if (-1 !== s8.search(/[eE]/)) return e7.eNotation ? i6 : t6;
137585
- if (-1 !== n6.indexOf(".")) return "0" === s8 || s8 === a5 || s8 === `${r5}${a5}` ? i6 : t6;
137586
- let l6 = o5 ? a5 : n6;
137587
- return o5 ? l6 === s8 || r5 + l6 === s8 ? i6 : t6 : l6 === s8 || l6 === r5 + s8 ? i6 : t6;
138539
+ })(i6);
138540
+ if (isFinite(i6)) {
138541
+ if (i6.includes("e") || i6.includes("E")) return (function(t7, e8, i7) {
138542
+ if (!i7.eNotation) return t7;
138543
+ const n6 = e8.match(F4);
138544
+ if (n6) {
138545
+ let s7 = n6[1] || "";
138546
+ const r5 = -1 === n6[3].indexOf("e") ? "E" : "e", o5 = n6[2], a5 = s7 ? t7[o5.length + 1] === r5 : t7[o5.length] === r5;
138547
+ return o5.length > 1 && a5 ? t7 : (1 !== o5.length || !n6[3].startsWith(`.${r5}`) && n6[3][0] !== r5) && o5.length > 0 ? i7.leadingZeros && !a5 ? (e8 = (n6[1] || "") + n6[3], Number(e8)) : t7 : Number(e8);
138548
+ }
138549
+ return t7;
138550
+ })(t6, i6, e7);
138551
+ {
138552
+ const s7 = k6.exec(i6);
138553
+ if (s7) {
138554
+ const r5 = s7[1] || "", o5 = s7[2];
138555
+ let a5 = (n5 = s7[3]) && -1 !== n5.indexOf(".") ? ("." === (n5 = n5.replace(/0+$/, "")) ? n5 = "0" : "." === n5[0] ? n5 = "0" + n5 : "." === n5[n5.length - 1] && (n5 = n5.substring(0, n5.length - 1)), n5) : n5;
138556
+ const h5 = r5 ? "." === t6[o5.length + 1] : "." === t6[o5.length];
138557
+ if (!e7.leadingZeros && (o5.length > 1 || 1 === o5.length && !h5)) return t6;
138558
+ {
138559
+ const n6 = Number(i6), s8 = String(n6);
138560
+ if (0 === n6) return n6;
138561
+ if (-1 !== s8.search(/[eE]/)) return e7.eNotation ? n6 : t6;
138562
+ if (-1 !== i6.indexOf(".")) return "0" === s8 || s8 === a5 || s8 === `${r5}${a5}` ? n6 : t6;
138563
+ let h6 = o5 ? a5 : i6;
138564
+ return o5 ? h6 === s8 || r5 + h6 === s8 ? n6 : t6 : h6 === s8 || h6 === r5 + s8 ? n6 : t6;
138565
+ }
137588
138566
  }
138567
+ return t6;
137589
138568
  }
137590
- return t6;
137591
138569
  }
137592
- var i5;
137593
- })(t5, n5);
138570
+ var n5;
138571
+ return (function(t7, e8, i7) {
138572
+ const n6 = e8 === 1 / 0;
138573
+ switch (i7.infinity.toLowerCase()) {
138574
+ case "null":
138575
+ return null;
138576
+ case "infinity":
138577
+ return e8;
138578
+ case "string":
138579
+ return n6 ? "Infinity" : "-Infinity";
138580
+ default:
138581
+ return t7;
138582
+ }
138583
+ })(t6, Number(i6), e7);
138584
+ })(t5, i5);
137594
138585
  }
137595
138586
  return void 0 !== t5 ? t5 : "";
137596
138587
  }
137597
- function Q3(t5, e5, n5) {
137598
- const i5 = Number.parseInt(t5, e5);
137599
- return i5 >= 0 && i5 <= 1114111 ? String.fromCodePoint(i5) : n5 + t5 + ";";
138588
+ function st2(t5, e5, i5) {
138589
+ const n5 = Number.parseInt(t5, e5);
138590
+ return n5 >= 0 && n5 <= 1114111 ? String.fromCodePoint(n5) : i5 + t5 + ";";
137600
138591
  }
137601
- const J4 = I4.getMetaDataSymbol();
137602
- function H3(t5, e5) {
137603
- return tt2(t5, e5);
138592
+ function rt2(t5, e5, i5, n5) {
138593
+ if (t5) {
138594
+ const n6 = t5(e5);
138595
+ i5 === e5 && (i5 = n6), e5 = n6;
138596
+ }
138597
+ return { tagName: e5 = ot2(e5, n5), tagExp: i5 };
138598
+ }
138599
+ function ot2(t5, e5) {
138600
+ if (a4.includes(t5)) throw new Error(`[SECURITY] Invalid name: "${t5}" is a reserved JavaScript keyword that could cause prototype pollution`);
138601
+ return o4.includes(t5) ? e5.onDangerousProperty(t5) : t5;
137604
138602
  }
137605
- function tt2(t5, e5, n5) {
137606
- let i5;
138603
+ const at2 = $3.getMetaDataSymbol();
138604
+ function ht2(t5, e5) {
138605
+ if (!t5 || "object" != typeof t5) return {};
138606
+ if (!e5) return t5;
138607
+ const i5 = {};
138608
+ for (const n5 in t5) n5.startsWith(e5) ? i5[n5.substring(e5.length)] = t5[n5] : i5[n5] = t5[n5];
138609
+ return i5;
138610
+ }
138611
+ function lt2(t5, e5, i5) {
138612
+ return pt2(t5, e5, i5);
138613
+ }
138614
+ function pt2(t5, e5, i5) {
138615
+ let n5;
137607
138616
  const s7 = {};
137608
138617
  for (let r5 = 0; r5 < t5.length; r5++) {
137609
- const o5 = t5[r5], a5 = et2(o5);
137610
- let l5 = "";
137611
- if (l5 = void 0 === n5 ? a5 : n5 + "." + a5, a5 === e5.textNodeName) void 0 === i5 ? i5 = o5[a5] : i5 += "" + o5[a5];
138618
+ const o5 = t5[r5], a5 = ut2(o5);
138619
+ if (void 0 !== a5 && a5 !== e5.textNodeName) {
138620
+ const t6 = ht2(o5[":@"] || {}, e5.attributeNamePrefix);
138621
+ i5.push(a5, t6);
138622
+ }
138623
+ if (a5 === e5.textNodeName) void 0 === n5 ? n5 = o5[a5] : n5 += "" + o5[a5];
137612
138624
  else {
137613
138625
  if (void 0 === a5) continue;
137614
138626
  if (o5[a5]) {
137615
- let t6 = tt2(o5[a5], e5, l5);
137616
- const n6 = it2(t6, e5);
137617
- o5[":@"] ? nt2(t6, o5[":@"], l5, e5) : 1 !== Object.keys(t6).length || void 0 === t6[e5.textNodeName] || e5.alwaysCreateTextNode ? 0 === Object.keys(t6).length && (e5.alwaysCreateTextNode ? t6[e5.textNodeName] = "" : t6 = "") : t6 = t6[e5.textNodeName], void 0 !== o5[J4] && "object" == typeof t6 && null !== t6 && (t6[J4] = o5[J4]), void 0 !== s7[a5] && Object.prototype.hasOwnProperty.call(s7, a5) ? (Array.isArray(s7[a5]) || (s7[a5] = [s7[a5]]), s7[a5].push(t6)) : e5.isArray(a5, l5, n6) ? s7[a5] = [t6] : s7[a5] = t6;
138627
+ let t6 = pt2(o5[a5], e5, i5);
138628
+ const n6 = dt2(t6, e5);
138629
+ if (o5[":@"] ? ct2(t6, o5[":@"], i5, e5) : 1 !== Object.keys(t6).length || void 0 === t6[e5.textNodeName] || e5.alwaysCreateTextNode ? 0 === Object.keys(t6).length && (e5.alwaysCreateTextNode ? t6[e5.textNodeName] = "" : t6 = "") : t6 = t6[e5.textNodeName], void 0 !== o5[at2] && "object" == typeof t6 && null !== t6 && (t6[at2] = o5[at2]), void 0 !== s7[a5] && Object.prototype.hasOwnProperty.call(s7, a5)) Array.isArray(s7[a5]) || (s7[a5] = [s7[a5]]), s7[a5].push(t6);
138630
+ else {
138631
+ const r6 = e5.jPath ? i5.toString() : i5;
138632
+ e5.isArray(a5, r6, n6) ? s7[a5] = [t6] : s7[a5] = t6;
138633
+ }
138634
+ void 0 !== a5 && a5 !== e5.textNodeName && i5.pop();
137618
138635
  }
137619
138636
  }
137620
138637
  }
137621
- return "string" == typeof i5 ? i5.length > 0 && (s7[e5.textNodeName] = i5) : void 0 !== i5 && (s7[e5.textNodeName] = i5), s7;
138638
+ return "string" == typeof n5 ? n5.length > 0 && (s7[e5.textNodeName] = n5) : void 0 !== n5 && (s7[e5.textNodeName] = n5), s7;
137622
138639
  }
137623
- function et2(t5) {
138640
+ function ut2(t5) {
137624
138641
  const e5 = Object.keys(t5);
137625
138642
  for (let t6 = 0; t6 < e5.length; t6++) {
137626
- const n5 = e5[t6];
137627
- if (":@" !== n5) return n5;
138643
+ const i5 = e5[t6];
138644
+ if (":@" !== i5) return i5;
137628
138645
  }
137629
138646
  }
137630
- function nt2(t5, e5, n5, i5) {
138647
+ function ct2(t5, e5, i5, n5) {
137631
138648
  if (e5) {
137632
138649
  const s7 = Object.keys(e5), r5 = s7.length;
137633
138650
  for (let o5 = 0; o5 < r5; o5++) {
137634
- const r6 = s7[o5];
137635
- i5.isArray(r6, n5 + "." + r6, true, true) ? t5[r6] = [e5[r6]] : t5[r6] = e5[r6];
138651
+ const r6 = s7[o5], a5 = r6.startsWith(n5.attributeNamePrefix) ? r6.substring(n5.attributeNamePrefix.length) : r6, h5 = n5.jPath ? i5.toString() + "." + a5 : i5;
138652
+ n5.isArray(r6, h5, true, true) ? t5[r6] = [e5[r6]] : t5[r6] = e5[r6];
137636
138653
  }
137637
138654
  }
137638
138655
  }
137639
- function it2(t5, e5) {
137640
- const { textNodeName: n5 } = e5, i5 = Object.keys(t5).length;
137641
- return 0 === i5 || !(1 !== i5 || !t5[n5] && "boolean" != typeof t5[n5] && 0 !== t5[n5]);
138656
+ function dt2(t5, e5) {
138657
+ const { textNodeName: i5 } = e5, n5 = Object.keys(t5).length;
138658
+ return 0 === n5 || !(1 !== n5 || !t5[i5] && "boolean" != typeof t5[i5] && 0 !== t5[i5]);
137642
138659
  }
137643
- class st2 {
138660
+ class ft2 {
137644
138661
  constructor(t5) {
137645
- this.externalEntities = {}, this.options = v9(t5);
138662
+ this.externalEntities = {}, this.options = C4(t5);
137646
138663
  }
137647
138664
  parse(t5, e5) {
137648
138665
  if ("string" != typeof t5 && t5.toString) t5 = t5.toString();
137649
138666
  else if ("string" != typeof t5) throw new Error("XML data is accepted in String or Bytes[] form.");
137650
138667
  if (e5) {
137651
138668
  true === e5 && (e5 = {});
137652
- const n6 = a4(t5, e5);
137653
- if (true !== n6) throw Error(`${n6.err.msg}:${n6.err.line}:${n6.err.col}`);
138669
+ const i6 = l4(t5, e5);
138670
+ if (true !== i6) throw Error(`${i6.err.msg}:${i6.err.line}:${i6.err.col}`);
137654
138671
  }
137655
- const n5 = new F4(this.options);
137656
- n5.addExternalEntities(this.externalEntities);
137657
- const i5 = n5.parseXml(t5);
137658
- return this.options.preserveOrder || void 0 === i5 ? i5 : H3(i5, this.options);
138672
+ const i5 = new B4(this.options);
138673
+ i5.addExternalEntities(this.externalEntities);
138674
+ const n5 = i5.parseXml(t5);
138675
+ return this.options.preserveOrder || void 0 === n5 ? n5 : lt2(n5, this.options, i5.matcher);
137659
138676
  }
137660
138677
  addEntity(t5, e5) {
137661
138678
  if (-1 !== e5.indexOf("&")) throw new Error("Entity value can't have '&'");
@@ -137664,166 +138681,305 @@ var require_fxp = __commonJS({
137664
138681
  this.externalEntities[t5] = e5;
137665
138682
  }
137666
138683
  static getMetaDataSymbol() {
137667
- return I4.getMetaDataSymbol();
138684
+ return $3.getMetaDataSymbol();
137668
138685
  }
137669
138686
  }
137670
- function rt2(t5, e5) {
137671
- let n5 = "";
137672
- return e5.format && e5.indentBy.length > 0 && (n5 = "\n"), ot2(t5, e5, "", n5);
138687
+ function gt2(t5, e5) {
138688
+ let i5 = "";
138689
+ e5.format && e5.indentBy.length > 0 && (i5 = "\n");
138690
+ const n5 = [];
138691
+ if (e5.stopNodes && Array.isArray(e5.stopNodes)) for (let t6 = 0; t6 < e5.stopNodes.length; t6++) {
138692
+ const i6 = e5.stopNodes[t6];
138693
+ "string" == typeof i6 ? n5.push(new G4(i6)) : i6 instanceof G4 && n5.push(i6);
138694
+ }
138695
+ return mt2(t5, e5, i5, new L3(), n5);
137673
138696
  }
137674
- function ot2(t5, e5, n5, i5) {
137675
- let s7 = "", r5 = false;
138697
+ function mt2(t5, e5, i5, n5, s7) {
138698
+ let r5 = "", o5 = false;
138699
+ if (e5.maxNestedTags && n5.getDepth() > e5.maxNestedTags) throw new Error("Maximum nested tags exceeded");
137676
138700
  if (!Array.isArray(t5)) {
137677
138701
  if (null != t5) {
137678
- let n6 = t5.toString();
137679
- return n6 = dt2(n6, e5), n6;
138702
+ let i6 = t5.toString();
138703
+ return i6 = vt2(i6, e5), i6;
137680
138704
  }
137681
138705
  return "";
137682
138706
  }
137683
- for (let o5 = 0; o5 < t5.length; o5++) {
137684
- const a5 = t5[o5], l5 = at2(a5);
138707
+ for (let a5 = 0; a5 < t5.length; a5++) {
138708
+ const h5 = t5[a5], l5 = Et2(h5);
137685
138709
  if (void 0 === l5) continue;
137686
- let u8 = "";
137687
- if (u8 = 0 === n5.length ? l5 : `${n5}.${l5}`, l5 === e5.textNodeName) {
137688
- let t6 = a5[l5];
137689
- ut2(u8, e5) || (t6 = e5.tagValueProcessor(l5, t6), t6 = dt2(t6, e5)), r5 && (s7 += i5), s7 += t6, r5 = false;
138710
+ const p6 = xt2(h5[":@"], e5);
138711
+ n5.push(l5, p6);
138712
+ const u8 = wt2(n5, s7);
138713
+ if (l5 === e5.textNodeName) {
138714
+ let t6 = h5[l5];
138715
+ u8 || (t6 = e5.tagValueProcessor(l5, t6), t6 = vt2(t6, e5)), o5 && (r5 += i5), r5 += t6, o5 = false, n5.pop();
137690
138716
  continue;
137691
138717
  }
137692
138718
  if (l5 === e5.cdataPropName) {
137693
- r5 && (s7 += i5), s7 += `<![CDATA[${a5[l5][0][e5.textNodeName]}]]>`, r5 = false;
138719
+ o5 && (r5 += i5), r5 += `<![CDATA[${h5[l5][0][e5.textNodeName]}]]>`, o5 = false, n5.pop();
137694
138720
  continue;
137695
138721
  }
137696
138722
  if (l5 === e5.commentPropName) {
137697
- s7 += i5 + `<!--${a5[l5][0][e5.textNodeName]}-->`, r5 = true;
138723
+ r5 += i5 + `<!--${h5[l5][0][e5.textNodeName]}-->`, o5 = true, n5.pop();
137698
138724
  continue;
137699
138725
  }
137700
138726
  if ("?" === l5[0]) {
137701
- const t6 = lt2(a5[":@"], e5), n6 = "?xml" === l5 ? "" : i5;
137702
- let o6 = a5[l5][0][e5.textNodeName];
137703
- o6 = 0 !== o6.length ? " " + o6 : "", s7 += n6 + `<${l5}${o6}${t6}?>`, r5 = true;
138727
+ const t6 = yt2(h5[":@"], e5, u8), s8 = "?xml" === l5 ? "" : i5;
138728
+ let a6 = h5[l5][0][e5.textNodeName];
138729
+ a6 = 0 !== a6.length ? " " + a6 : "", r5 += s8 + `<${l5}${a6}${t6}?>`, o5 = true, n5.pop();
137704
138730
  continue;
137705
138731
  }
137706
- let d6 = i5;
137707
- "" !== d6 && (d6 += e5.indentBy);
137708
- const h5 = i5 + `<${l5}${lt2(a5[":@"], e5)}`, p6 = ot2(a5[l5], e5, u8, d6);
137709
- -1 !== e5.unpairedTags.indexOf(l5) ? e5.suppressUnpairedNode ? s7 += h5 + ">" : s7 += h5 + "/>" : p6 && 0 !== p6.length || !e5.suppressEmptyNode ? p6 && p6.endsWith(">") ? s7 += h5 + `>${p6}${i5}</${l5}>` : (s7 += h5 + ">", p6 && "" !== i5 && (p6.includes("/>") || p6.includes("</")) ? s7 += i5 + e5.indentBy + p6 + i5 : s7 += p6, s7 += `</${l5}>`) : s7 += h5 + "/>", r5 = true;
138732
+ let c5 = i5;
138733
+ "" !== c5 && (c5 += e5.indentBy);
138734
+ const d6 = i5 + `<${l5}${yt2(h5[":@"], e5, u8)}`;
138735
+ let f6;
138736
+ f6 = u8 ? Nt3(h5[l5], e5) : mt2(h5[l5], e5, c5, n5, s7), -1 !== e5.unpairedTags.indexOf(l5) ? e5.suppressUnpairedNode ? r5 += d6 + ">" : r5 += d6 + "/>" : f6 && 0 !== f6.length || !e5.suppressEmptyNode ? f6 && f6.endsWith(">") ? r5 += d6 + `>${f6}${i5}</${l5}>` : (r5 += d6 + ">", f6 && "" !== i5 && (f6.includes("/>") || f6.includes("</")) ? r5 += i5 + e5.indentBy + f6 + i5 : r5 += f6, r5 += `</${l5}>`) : r5 += d6 + "/>", o5 = true, n5.pop();
138737
+ }
138738
+ return r5;
138739
+ }
138740
+ function xt2(t5, e5) {
138741
+ if (!t5 || e5.ignoreAttributes) return null;
138742
+ const i5 = {};
138743
+ let n5 = false;
138744
+ for (let s7 in t5) Object.prototype.hasOwnProperty.call(t5, s7) && (i5[s7.startsWith(e5.attributeNamePrefix) ? s7.substr(e5.attributeNamePrefix.length) : s7] = t5[s7], n5 = true);
138745
+ return n5 ? i5 : null;
138746
+ }
138747
+ function Nt3(t5, e5) {
138748
+ if (!Array.isArray(t5)) return null != t5 ? t5.toString() : "";
138749
+ let i5 = "";
138750
+ for (let n5 = 0; n5 < t5.length; n5++) {
138751
+ const s7 = t5[n5], r5 = Et2(s7);
138752
+ if (r5 === e5.textNodeName) i5 += s7[r5];
138753
+ else if (r5 === e5.cdataPropName) i5 += s7[r5][0][e5.textNodeName];
138754
+ else if (r5 === e5.commentPropName) i5 += s7[r5][0][e5.textNodeName];
138755
+ else {
138756
+ if (r5 && "?" === r5[0]) continue;
138757
+ if (r5) {
138758
+ const t6 = bt2(s7[":@"], e5), n6 = Nt3(s7[r5], e5);
138759
+ n6 && 0 !== n6.length ? i5 += `<${r5}${t6}>${n6}</${r5}>` : i5 += `<${r5}${t6}/>`;
138760
+ }
138761
+ }
138762
+ }
138763
+ return i5;
138764
+ }
138765
+ function bt2(t5, e5) {
138766
+ let i5 = "";
138767
+ if (t5 && !e5.ignoreAttributes) for (let n5 in t5) {
138768
+ if (!Object.prototype.hasOwnProperty.call(t5, n5)) continue;
138769
+ let s7 = t5[n5];
138770
+ true === s7 && e5.suppressBooleanAttributes ? i5 += ` ${n5.substr(e5.attributeNamePrefix.length)}` : i5 += ` ${n5.substr(e5.attributeNamePrefix.length)}="${s7}"`;
137710
138771
  }
137711
- return s7;
138772
+ return i5;
137712
138773
  }
137713
- function at2(t5) {
138774
+ function Et2(t5) {
137714
138775
  const e5 = Object.keys(t5);
137715
- for (let n5 = 0; n5 < e5.length; n5++) {
137716
- const i5 = e5[n5];
137717
- if (Object.prototype.hasOwnProperty.call(t5, i5) && ":@" !== i5) return i5;
138776
+ for (let i5 = 0; i5 < e5.length; i5++) {
138777
+ const n5 = e5[i5];
138778
+ if (Object.prototype.hasOwnProperty.call(t5, n5) && ":@" !== n5) return n5;
137718
138779
  }
137719
138780
  }
137720
- function lt2(t5, e5) {
138781
+ function yt2(t5, e5, i5) {
137721
138782
  let n5 = "";
137722
- if (t5 && !e5.ignoreAttributes) for (let i5 in t5) {
137723
- if (!Object.prototype.hasOwnProperty.call(t5, i5)) continue;
137724
- let s7 = e5.attributeValueProcessor(i5, t5[i5]);
137725
- s7 = dt2(s7, e5), true === s7 && e5.suppressBooleanAttributes ? n5 += ` ${i5.substr(e5.attributeNamePrefix.length)}` : n5 += ` ${i5.substr(e5.attributeNamePrefix.length)}="${s7}"`;
138783
+ if (t5 && !e5.ignoreAttributes) for (let s7 in t5) {
138784
+ if (!Object.prototype.hasOwnProperty.call(t5, s7)) continue;
138785
+ let r5;
138786
+ i5 ? r5 = t5[s7] : (r5 = e5.attributeValueProcessor(s7, t5[s7]), r5 = vt2(r5, e5)), true === r5 && e5.suppressBooleanAttributes ? n5 += ` ${s7.substr(e5.attributeNamePrefix.length)}` : n5 += ` ${s7.substr(e5.attributeNamePrefix.length)}="${r5}"`;
137726
138787
  }
137727
138788
  return n5;
137728
138789
  }
137729
- function ut2(t5, e5) {
137730
- let n5 = (t5 = t5.substr(0, t5.length - e5.textNodeName.length - 1)).substr(t5.lastIndexOf(".") + 1);
137731
- for (let i5 in e5.stopNodes) if (e5.stopNodes[i5] === t5 || e5.stopNodes[i5] === "*." + n5) return true;
138790
+ function wt2(t5, e5) {
138791
+ if (!e5 || 0 === e5.length) return false;
138792
+ for (let i5 = 0; i5 < e5.length; i5++) if (t5.matches(e5[i5])) return true;
137732
138793
  return false;
137733
138794
  }
137734
- function dt2(t5, e5) {
137735
- if (t5 && t5.length > 0 && e5.processEntities) for (let n5 = 0; n5 < e5.entities.length; n5++) {
137736
- const i5 = e5.entities[n5];
137737
- t5 = t5.replace(i5.regex, i5.val);
138795
+ function vt2(t5, e5) {
138796
+ if (t5 && t5.length > 0 && e5.processEntities) for (let i5 = 0; i5 < e5.entities.length; i5++) {
138797
+ const n5 = e5.entities[i5];
138798
+ t5 = t5.replace(n5.regex, n5.val);
137738
138799
  }
137739
138800
  return t5;
137740
138801
  }
137741
- const ht2 = { attributeNamePrefix: "@_", attributesGroupName: false, textNodeName: "#text", ignoreAttributes: true, cdataPropName: false, format: false, indentBy: " ", suppressEmptyNode: false, suppressUnpairedNode: true, suppressBooleanAttributes: true, tagValueProcessor: function(t5, e5) {
138802
+ const Tt2 = { attributeNamePrefix: "@_", attributesGroupName: false, textNodeName: "#text", ignoreAttributes: true, cdataPropName: false, format: false, indentBy: " ", suppressEmptyNode: false, suppressUnpairedNode: true, suppressBooleanAttributes: true, tagValueProcessor: function(t5, e5) {
137742
138803
  return e5;
137743
138804
  }, attributeValueProcessor: function(t5, e5) {
137744
138805
  return e5;
137745
- }, preserveOrder: false, commentPropName: false, unpairedTags: [], entities: [{ regex: new RegExp("&", "g"), val: "&amp;" }, { regex: new RegExp(">", "g"), val: "&gt;" }, { regex: new RegExp("<", "g"), val: "&lt;" }, { regex: new RegExp("'", "g"), val: "&apos;" }, { regex: new RegExp('"', "g"), val: "&quot;" }], processEntities: true, stopNodes: [], oneListGroup: false };
137746
- function pt2(t5) {
137747
- this.options = Object.assign({}, ht2, t5), true === this.options.ignoreAttributes || this.options.attributesGroupName ? this.isAttribute = function() {
138806
+ }, preserveOrder: false, commentPropName: false, unpairedTags: [], entities: [{ regex: new RegExp("&", "g"), val: "&amp;" }, { regex: new RegExp(">", "g"), val: "&gt;" }, { regex: new RegExp("<", "g"), val: "&lt;" }, { regex: new RegExp("'", "g"), val: "&apos;" }, { regex: new RegExp('"', "g"), val: "&quot;" }], processEntities: true, stopNodes: [], oneListGroup: false, maxNestedTags: 100, jPath: true };
138807
+ function Pt2(t5) {
138808
+ if (this.options = Object.assign({}, Tt2, t5), this.options.stopNodes && Array.isArray(this.options.stopNodes) && (this.options.stopNodes = this.options.stopNodes.map((t6) => "string" == typeof t6 && t6.startsWith("*.") ? ".." + t6.substring(2) : t6)), this.stopNodeExpressions = [], this.options.stopNodes && Array.isArray(this.options.stopNodes)) for (let t6 = 0; t6 < this.options.stopNodes.length; t6++) {
138809
+ const e6 = this.options.stopNodes[t6];
138810
+ "string" == typeof e6 ? this.stopNodeExpressions.push(new G4(e6)) : e6 instanceof G4 && this.stopNodeExpressions.push(e6);
138811
+ }
138812
+ var e5;
138813
+ true === this.options.ignoreAttributes || this.options.attributesGroupName ? this.isAttribute = function() {
137748
138814
  return false;
137749
- } : (this.ignoreAttributesFn = L3(this.options.ignoreAttributes), this.attrPrefixLen = this.options.attributeNamePrefix.length, this.isAttribute = gt2), this.processTextOrObjNode = ct2, this.options.format ? (this.indentate = ft2, this.tagEndChar = ">\n", this.newLine = "\n") : (this.indentate = function() {
138815
+ } : (this.ignoreAttributesFn = "function" == typeof (e5 = this.options.ignoreAttributes) ? e5 : Array.isArray(e5) ? (t6) => {
138816
+ for (const i5 of e5) {
138817
+ if ("string" == typeof i5 && t6 === i5) return true;
138818
+ if (i5 instanceof RegExp && i5.test(t6)) return true;
138819
+ }
138820
+ } : () => false, this.attrPrefixLen = this.options.attributeNamePrefix.length, this.isAttribute = Ct2), this.processTextOrObjNode = St2, this.options.format ? (this.indentate = At2, this.tagEndChar = ">\n", this.newLine = "\n") : (this.indentate = function() {
137750
138821
  return "";
137751
138822
  }, this.tagEndChar = ">", this.newLine = "");
137752
138823
  }
137753
- function ct2(t5, e5, n5, i5) {
137754
- const s7 = this.j2x(t5, n5 + 1, i5.concat(e5));
137755
- return void 0 !== t5[this.options.textNodeName] && 1 === Object.keys(t5).length ? this.buildTextValNode(t5[this.options.textNodeName], e5, s7.attrStr, n5) : this.buildObjectNode(s7.val, e5, s7.attrStr, n5);
138824
+ function St2(t5, e5, i5, n5) {
138825
+ const s7 = this.extractAttributes(t5);
138826
+ if (n5.push(e5, s7), this.checkStopNode(n5)) {
138827
+ const s8 = this.buildRawContent(t5), r6 = this.buildAttributesForStopNode(t5);
138828
+ return n5.pop(), this.buildObjectNode(s8, e5, r6, i5);
138829
+ }
138830
+ const r5 = this.j2x(t5, i5 + 1, n5);
138831
+ return n5.pop(), void 0 !== t5[this.options.textNodeName] && 1 === Object.keys(t5).length ? this.buildTextValNode(t5[this.options.textNodeName], e5, r5.attrStr, i5, n5) : this.buildObjectNode(r5.val, e5, r5.attrStr, i5);
137756
138832
  }
137757
- function ft2(t5) {
138833
+ function At2(t5) {
137758
138834
  return this.options.indentBy.repeat(t5);
137759
138835
  }
137760
- function gt2(t5) {
138836
+ function Ct2(t5) {
137761
138837
  return !(!t5.startsWith(this.options.attributeNamePrefix) || t5 === this.options.textNodeName) && t5.substr(this.attrPrefixLen);
137762
138838
  }
137763
- pt2.prototype.build = function(t5) {
137764
- return this.options.preserveOrder ? rt2(t5, this.options) : (Array.isArray(t5) && this.options.arrayNodeName && this.options.arrayNodeName.length > 1 && (t5 = { [this.options.arrayNodeName]: t5 }), this.j2x(t5, 0, []).val);
137765
- }, pt2.prototype.j2x = function(t5, e5, n5) {
137766
- let i5 = "", s7 = "";
137767
- const r5 = n5.join(".");
137768
- for (let o5 in t5) if (Object.prototype.hasOwnProperty.call(t5, o5)) if (void 0 === t5[o5]) this.isAttribute(o5) && (s7 += "");
137769
- else if (null === t5[o5]) this.isAttribute(o5) || o5 === this.options.cdataPropName ? s7 += "" : "?" === o5[0] ? s7 += this.indentate(e5) + "<" + o5 + "?" + this.tagEndChar : s7 += this.indentate(e5) + "<" + o5 + "/" + this.tagEndChar;
137770
- else if (t5[o5] instanceof Date) s7 += this.buildTextValNode(t5[o5], o5, "", e5);
137771
- else if ("object" != typeof t5[o5]) {
137772
- const n6 = this.isAttribute(o5);
137773
- if (n6 && !this.ignoreAttributesFn(n6, r5)) i5 += this.buildAttrPairStr(n6, "" + t5[o5]);
137774
- else if (!n6) if (o5 === this.options.textNodeName) {
137775
- let e6 = this.options.tagValueProcessor(o5, "" + t5[o5]);
138839
+ Pt2.prototype.build = function(t5) {
138840
+ if (this.options.preserveOrder) return gt2(t5, this.options);
138841
+ {
138842
+ Array.isArray(t5) && this.options.arrayNodeName && this.options.arrayNodeName.length > 1 && (t5 = { [this.options.arrayNodeName]: t5 });
138843
+ const e5 = new L3();
138844
+ return this.j2x(t5, 0, e5).val;
138845
+ }
138846
+ }, Pt2.prototype.j2x = function(t5, e5, i5) {
138847
+ let n5 = "", s7 = "";
138848
+ if (this.options.maxNestedTags && i5.getDepth() >= this.options.maxNestedTags) throw new Error("Maximum nested tags exceeded");
138849
+ const r5 = this.options.jPath ? i5.toString() : i5, o5 = this.checkStopNode(i5);
138850
+ for (let a5 in t5) if (Object.prototype.hasOwnProperty.call(t5, a5)) if (void 0 === t5[a5]) this.isAttribute(a5) && (s7 += "");
138851
+ else if (null === t5[a5]) this.isAttribute(a5) || a5 === this.options.cdataPropName ? s7 += "" : "?" === a5[0] ? s7 += this.indentate(e5) + "<" + a5 + "?" + this.tagEndChar : s7 += this.indentate(e5) + "<" + a5 + "/" + this.tagEndChar;
138852
+ else if (t5[a5] instanceof Date) s7 += this.buildTextValNode(t5[a5], a5, "", e5, i5);
138853
+ else if ("object" != typeof t5[a5]) {
138854
+ const h5 = this.isAttribute(a5);
138855
+ if (h5 && !this.ignoreAttributesFn(h5, r5)) n5 += this.buildAttrPairStr(h5, "" + t5[a5], o5);
138856
+ else if (!h5) if (a5 === this.options.textNodeName) {
138857
+ let e6 = this.options.tagValueProcessor(a5, "" + t5[a5]);
137776
138858
  s7 += this.replaceEntitiesValue(e6);
137777
- } else s7 += this.buildTextValNode(t5[o5], o5, "", e5);
137778
- } else if (Array.isArray(t5[o5])) {
137779
- const i6 = t5[o5].length;
137780
- let r6 = "", a5 = "";
137781
- for (let l5 = 0; l5 < i6; l5++) {
137782
- const i7 = t5[o5][l5];
137783
- if (void 0 === i7) ;
137784
- else if (null === i7) "?" === o5[0] ? s7 += this.indentate(e5) + "<" + o5 + "?" + this.tagEndChar : s7 += this.indentate(e5) + "<" + o5 + "/" + this.tagEndChar;
137785
- else if ("object" == typeof i7) if (this.options.oneListGroup) {
137786
- const t6 = this.j2x(i7, e5 + 1, n5.concat(o5));
137787
- r6 += t6.val, this.options.attributesGroupName && i7.hasOwnProperty(this.options.attributesGroupName) && (a5 += t6.attrStr);
137788
- } else r6 += this.processTextOrObjNode(i7, o5, e5, n5);
138859
+ } else {
138860
+ i5.push(a5);
138861
+ const n6 = this.checkStopNode(i5);
138862
+ if (i5.pop(), n6) {
138863
+ const i6 = "" + t5[a5];
138864
+ s7 += "" === i6 ? this.indentate(e5) + "<" + a5 + this.closeTag(a5) + this.tagEndChar : this.indentate(e5) + "<" + a5 + ">" + i6 + "</" + a5 + this.tagEndChar;
138865
+ } else s7 += this.buildTextValNode(t5[a5], a5, "", e5, i5);
138866
+ }
138867
+ } else if (Array.isArray(t5[a5])) {
138868
+ const n6 = t5[a5].length;
138869
+ let r6 = "", o6 = "";
138870
+ for (let h5 = 0; h5 < n6; h5++) {
138871
+ const n7 = t5[a5][h5];
138872
+ if (void 0 === n7) ;
138873
+ else if (null === n7) "?" === a5[0] ? s7 += this.indentate(e5) + "<" + a5 + "?" + this.tagEndChar : s7 += this.indentate(e5) + "<" + a5 + "/" + this.tagEndChar;
138874
+ else if ("object" == typeof n7) if (this.options.oneListGroup) {
138875
+ i5.push(a5);
138876
+ const t6 = this.j2x(n7, e5 + 1, i5);
138877
+ i5.pop(), r6 += t6.val, this.options.attributesGroupName && n7.hasOwnProperty(this.options.attributesGroupName) && (o6 += t6.attrStr);
138878
+ } else r6 += this.processTextOrObjNode(n7, a5, e5, i5);
137789
138879
  else if (this.options.oneListGroup) {
137790
- let t6 = this.options.tagValueProcessor(o5, i7);
138880
+ let t6 = this.options.tagValueProcessor(a5, n7);
137791
138881
  t6 = this.replaceEntitiesValue(t6), r6 += t6;
137792
- } else r6 += this.buildTextValNode(i7, o5, "", e5);
137793
- }
137794
- this.options.oneListGroup && (r6 = this.buildObjectNode(r6, o5, a5, e5)), s7 += r6;
137795
- } else if (this.options.attributesGroupName && o5 === this.options.attributesGroupName) {
137796
- const e6 = Object.keys(t5[o5]), n6 = e6.length;
137797
- for (let s8 = 0; s8 < n6; s8++) i5 += this.buildAttrPairStr(e6[s8], "" + t5[o5][e6[s8]]);
137798
- } else s7 += this.processTextOrObjNode(t5[o5], o5, e5, n5);
137799
- return { attrStr: i5, val: s7 };
137800
- }, pt2.prototype.buildAttrPairStr = function(t5, e5) {
137801
- return e5 = this.options.attributeValueProcessor(t5, "" + e5), e5 = this.replaceEntitiesValue(e5), this.options.suppressBooleanAttributes && "true" === e5 ? " " + t5 : " " + t5 + '="' + e5 + '"';
137802
- }, pt2.prototype.buildObjectNode = function(t5, e5, n5, i5) {
137803
- if ("" === t5) return "?" === e5[0] ? this.indentate(i5) + "<" + e5 + n5 + "?" + this.tagEndChar : this.indentate(i5) + "<" + e5 + n5 + this.closeTag(e5) + this.tagEndChar;
138882
+ } else {
138883
+ i5.push(a5);
138884
+ const t6 = this.checkStopNode(i5);
138885
+ if (i5.pop(), t6) {
138886
+ const t7 = "" + n7;
138887
+ r6 += "" === t7 ? this.indentate(e5) + "<" + a5 + this.closeTag(a5) + this.tagEndChar : this.indentate(e5) + "<" + a5 + ">" + t7 + "</" + a5 + this.tagEndChar;
138888
+ } else r6 += this.buildTextValNode(n7, a5, "", e5, i5);
138889
+ }
138890
+ }
138891
+ this.options.oneListGroup && (r6 = this.buildObjectNode(r6, a5, o6, e5)), s7 += r6;
138892
+ } else if (this.options.attributesGroupName && a5 === this.options.attributesGroupName) {
138893
+ const e6 = Object.keys(t5[a5]), i6 = e6.length;
138894
+ for (let s8 = 0; s8 < i6; s8++) n5 += this.buildAttrPairStr(e6[s8], "" + t5[a5][e6[s8]], o5);
138895
+ } else s7 += this.processTextOrObjNode(t5[a5], a5, e5, i5);
138896
+ return { attrStr: n5, val: s7 };
138897
+ }, Pt2.prototype.buildAttrPairStr = function(t5, e5, i5) {
138898
+ return i5 || (e5 = this.options.attributeValueProcessor(t5, "" + e5), e5 = this.replaceEntitiesValue(e5)), this.options.suppressBooleanAttributes && "true" === e5 ? " " + t5 : " " + t5 + '="' + e5 + '"';
138899
+ }, Pt2.prototype.extractAttributes = function(t5) {
138900
+ if (!t5 || "object" != typeof t5) return null;
138901
+ const e5 = {};
138902
+ let i5 = false;
138903
+ if (this.options.attributesGroupName && t5[this.options.attributesGroupName]) {
138904
+ const n5 = t5[this.options.attributesGroupName];
138905
+ for (let t6 in n5) Object.prototype.hasOwnProperty.call(n5, t6) && (e5[t6.startsWith(this.options.attributeNamePrefix) ? t6.substring(this.options.attributeNamePrefix.length) : t6] = n5[t6], i5 = true);
138906
+ } else for (let n5 in t5) {
138907
+ if (!Object.prototype.hasOwnProperty.call(t5, n5)) continue;
138908
+ const s7 = this.isAttribute(n5);
138909
+ s7 && (e5[s7] = t5[n5], i5 = true);
138910
+ }
138911
+ return i5 ? e5 : null;
138912
+ }, Pt2.prototype.buildRawContent = function(t5) {
138913
+ if ("string" == typeof t5) return t5;
138914
+ if ("object" != typeof t5 || null === t5) return String(t5);
138915
+ if (void 0 !== t5[this.options.textNodeName]) return t5[this.options.textNodeName];
138916
+ let e5 = "";
138917
+ for (let i5 in t5) {
138918
+ if (!Object.prototype.hasOwnProperty.call(t5, i5)) continue;
138919
+ if (this.isAttribute(i5)) continue;
138920
+ if (this.options.attributesGroupName && i5 === this.options.attributesGroupName) continue;
138921
+ const n5 = t5[i5];
138922
+ if (i5 === this.options.textNodeName) e5 += n5;
138923
+ else if (Array.isArray(n5)) {
138924
+ for (let t6 of n5) if ("string" == typeof t6 || "number" == typeof t6) e5 += `<${i5}>${t6}</${i5}>`;
138925
+ else if ("object" == typeof t6 && null !== t6) {
138926
+ const n6 = this.buildRawContent(t6), s7 = this.buildAttributesForStopNode(t6);
138927
+ e5 += "" === n6 ? `<${i5}${s7}/>` : `<${i5}${s7}>${n6}</${i5}>`;
138928
+ }
138929
+ } else if ("object" == typeof n5 && null !== n5) {
138930
+ const t6 = this.buildRawContent(n5), s7 = this.buildAttributesForStopNode(n5);
138931
+ e5 += "" === t6 ? `<${i5}${s7}/>` : `<${i5}${s7}>${t6}</${i5}>`;
138932
+ } else e5 += `<${i5}>${n5}</${i5}>`;
138933
+ }
138934
+ return e5;
138935
+ }, Pt2.prototype.buildAttributesForStopNode = function(t5) {
138936
+ if (!t5 || "object" != typeof t5) return "";
138937
+ let e5 = "";
138938
+ if (this.options.attributesGroupName && t5[this.options.attributesGroupName]) {
138939
+ const i5 = t5[this.options.attributesGroupName];
138940
+ for (let t6 in i5) {
138941
+ if (!Object.prototype.hasOwnProperty.call(i5, t6)) continue;
138942
+ const n5 = t6.startsWith(this.options.attributeNamePrefix) ? t6.substring(this.options.attributeNamePrefix.length) : t6, s7 = i5[t6];
138943
+ true === s7 && this.options.suppressBooleanAttributes ? e5 += " " + n5 : e5 += " " + n5 + '="' + s7 + '"';
138944
+ }
138945
+ } else for (let i5 in t5) {
138946
+ if (!Object.prototype.hasOwnProperty.call(t5, i5)) continue;
138947
+ const n5 = this.isAttribute(i5);
138948
+ if (n5) {
138949
+ const s7 = t5[i5];
138950
+ true === s7 && this.options.suppressBooleanAttributes ? e5 += " " + n5 : e5 += " " + n5 + '="' + s7 + '"';
138951
+ }
138952
+ }
138953
+ return e5;
138954
+ }, Pt2.prototype.buildObjectNode = function(t5, e5, i5, n5) {
138955
+ if ("" === t5) return "?" === e5[0] ? this.indentate(n5) + "<" + e5 + i5 + "?" + this.tagEndChar : this.indentate(n5) + "<" + e5 + i5 + this.closeTag(e5) + this.tagEndChar;
137804
138956
  {
137805
138957
  let s7 = "</" + e5 + this.tagEndChar, r5 = "";
137806
- return "?" === e5[0] && (r5 = "?", s7 = ""), !n5 && "" !== n5 || -1 !== t5.indexOf("<") ? false !== this.options.commentPropName && e5 === this.options.commentPropName && 0 === r5.length ? this.indentate(i5) + `<!--${t5}-->` + this.newLine : this.indentate(i5) + "<" + e5 + n5 + r5 + this.tagEndChar + t5 + this.indentate(i5) + s7 : this.indentate(i5) + "<" + e5 + n5 + r5 + ">" + t5 + s7;
138958
+ return "?" === e5[0] && (r5 = "?", s7 = ""), !i5 && "" !== i5 || -1 !== t5.indexOf("<") ? false !== this.options.commentPropName && e5 === this.options.commentPropName && 0 === r5.length ? this.indentate(n5) + `<!--${t5}-->` + this.newLine : this.indentate(n5) + "<" + e5 + i5 + r5 + this.tagEndChar + t5 + this.indentate(n5) + s7 : this.indentate(n5) + "<" + e5 + i5 + r5 + ">" + t5 + s7;
137807
138959
  }
137808
- }, pt2.prototype.closeTag = function(t5) {
138960
+ }, Pt2.prototype.closeTag = function(t5) {
137809
138961
  let e5 = "";
137810
138962
  return -1 !== this.options.unpairedTags.indexOf(t5) ? this.options.suppressUnpairedNode || (e5 = "/") : e5 = this.options.suppressEmptyNode ? "/" : `></${t5}`, e5;
137811
- }, pt2.prototype.buildTextValNode = function(t5, e5, n5, i5) {
137812
- if (false !== this.options.cdataPropName && e5 === this.options.cdataPropName) return this.indentate(i5) + `<![CDATA[${t5}]]>` + this.newLine;
137813
- if (false !== this.options.commentPropName && e5 === this.options.commentPropName) return this.indentate(i5) + `<!--${t5}-->` + this.newLine;
137814
- if ("?" === e5[0]) return this.indentate(i5) + "<" + e5 + n5 + "?" + this.tagEndChar;
138963
+ }, Pt2.prototype.checkStopNode = function(t5) {
138964
+ if (!this.stopNodeExpressions || 0 === this.stopNodeExpressions.length) return false;
138965
+ for (let e5 = 0; e5 < this.stopNodeExpressions.length; e5++) if (t5.matches(this.stopNodeExpressions[e5])) return true;
138966
+ return false;
138967
+ }, Pt2.prototype.buildTextValNode = function(t5, e5, i5, n5, s7) {
138968
+ if (false !== this.options.cdataPropName && e5 === this.options.cdataPropName) return this.indentate(n5) + `<![CDATA[${t5}]]>` + this.newLine;
138969
+ if (false !== this.options.commentPropName && e5 === this.options.commentPropName) return this.indentate(n5) + `<!--${t5}-->` + this.newLine;
138970
+ if ("?" === e5[0]) return this.indentate(n5) + "<" + e5 + i5 + "?" + this.tagEndChar;
137815
138971
  {
137816
- let s7 = this.options.tagValueProcessor(e5, t5);
137817
- return s7 = this.replaceEntitiesValue(s7), "" === s7 ? this.indentate(i5) + "<" + e5 + n5 + this.closeTag(e5) + this.tagEndChar : this.indentate(i5) + "<" + e5 + n5 + ">" + s7 + "</" + e5 + this.tagEndChar;
138972
+ let s8 = this.options.tagValueProcessor(e5, t5);
138973
+ return s8 = this.replaceEntitiesValue(s8), "" === s8 ? this.indentate(n5) + "<" + e5 + i5 + this.closeTag(e5) + this.tagEndChar : this.indentate(n5) + "<" + e5 + i5 + ">" + s8 + "</" + e5 + this.tagEndChar;
137818
138974
  }
137819
- }, pt2.prototype.replaceEntitiesValue = function(t5) {
138975
+ }, Pt2.prototype.replaceEntitiesValue = function(t5) {
137820
138976
  if (t5 && t5.length > 0 && this.options.processEntities) for (let e5 = 0; e5 < this.options.entities.length; e5++) {
137821
- const n5 = this.options.entities[e5];
137822
- t5 = t5.replace(n5.regex, n5.val);
138977
+ const i5 = this.options.entities[e5];
138978
+ t5 = t5.replace(i5.regex, i5.val);
137823
138979
  }
137824
138980
  return t5;
137825
138981
  };
137826
- const xt2 = { validate: a4 };
138982
+ const Ot2 = Pt2, $t2 = { validate: l4 };
137827
138983
  module2.exports = e4;
137828
138984
  })();
137829
138985
  }
@@ -157896,7 +159052,7 @@ var require_package6 = __commonJS({
157896
159052
  "package.json"(exports2, module2) {
157897
159053
  module2.exports = {
157898
159054
  name: "@sentry/craft",
157899
- version: "2.24.2",
159055
+ version: "2.25.0",
157900
159056
  description: "The universal sentry workflow CLI",
157901
159057
  main: "dist/craft",
157902
159058
  repository: "https://github.com/getsentry/craft",
@@ -157942,7 +159098,7 @@ var require_package6 = __commonJS({
157942
159098
  "eslint-config-prettier": "^9.1.0",
157943
159099
  "eslint-formatter-github-annotations": "^0.1.0",
157944
159100
  "extract-zip": "^2.0.1",
157945
- "fast-xml-parser": "^5.3.4",
159101
+ "fast-xml-parser": "^5.5.7",
157946
159102
  "git-url-parse": "^16.1.0",
157947
159103
  glob: "^11.0.0",
157948
159104
  "is-ci": "^2.0.0",
@@ -157997,11 +159153,11 @@ var require_package6 = __commonJS({
157997
159153
  },
157998
159154
  pnpm: {
157999
159155
  overrides: {
158000
- "fast-xml-parser": "^5.3.4",
159156
+ "fast-xml-parser": "^5.5.7",
158001
159157
  minimatch: "^10.2.1",
158002
159158
  "ajv@<6.14.0": "^6.14.0",
158003
159159
  rollup: "^4.59.0",
158004
- flatted: "^3.4.0"
159160
+ flatted: "^3.4.2"
158005
159161
  }
158006
159162
  }
158007
159163
  };
@@ -158065,7 +159221,7 @@ function getPackage() {
158065
159221
  }
158066
159222
  function getPackageVersion() {
158067
159223
  const { version: version2 } = getPackage();
158068
- const buildInfo = "78da70b88de5cf6245d5d7e3263a9e8952667dec";
159224
+ const buildInfo = "f4889d04564e47311038ecb6b910fef6b6cf1363";
158069
159225
  return buildInfo ? `${version2} (${buildInfo})` : version2;
158070
159226
  }
158071
159227
  function semVerToString(s6) {
@@ -161350,12 +162506,12 @@ function sync_default(start, callback) {
161350
162506
  }
161351
162507
 
161352
162508
  // node_modules/.pnpm/yargs@18.0.0/node_modules/yargs/lib/platform-shims/esm.mjs
161353
- var import_util26 = require("util");
162509
+ var import_util27 = require("util");
161354
162510
  var import_url4 = require("url");
161355
162511
 
161356
162512
  // node_modules/.pnpm/yargs-parser@22.0.0/node_modules/yargs-parser/build/lib/index.js
161357
162513
  init_import_meta_url();
161358
- var import_util24 = require("util");
162514
+ var import_util25 = require("util");
161359
162515
  var import_path24 = require("path");
161360
162516
 
161361
162517
  // node_modules/.pnpm/yargs-parser@22.0.0/node_modules/yargs-parser/build/lib/string-utils.js
@@ -162320,7 +163476,7 @@ var parser4 = new YargsParser({
162320
163476
  env: () => {
162321
163477
  return env;
162322
163478
  },
162323
- format: import_util24.format,
163479
+ format: import_util25.format,
162324
163480
  normalize: import_path24.normalize,
162325
163481
  resolve: import_path24.resolve,
162326
163482
  require: (path19) => {
@@ -162371,14 +163527,14 @@ init_import_meta_url();
162371
163527
  // node_modules/.pnpm/y18n@5.0.8/node_modules/y18n/build/lib/platform-shims/node.js
162372
163528
  init_import_meta_url();
162373
163529
  var import_fs28 = require("fs");
162374
- var import_util25 = require("util");
163530
+ var import_util26 = require("util");
162375
163531
  var import_path25 = require("path");
162376
163532
  var node_default = {
162377
163533
  fs: {
162378
163534
  readFileSync: import_fs28.readFileSync,
162379
163535
  writeFile: import_fs28.writeFile
162380
163536
  },
162381
- format: import_util25.format,
163537
+ format: import_util26.format,
162382
163538
  resolve: import_path25.resolve,
162383
163539
  exists: (file) => {
162384
163540
  try {
@@ -162574,7 +163730,7 @@ var esm_default3 = {
162574
163730
  getEnv: (key) => {
162575
163731
  return process.env[key];
162576
163732
  },
162577
- inspect: import_util26.inspect,
163733
+ inspect: import_util27.inspect,
162578
163734
  getProcessArgvBin,
162579
163735
  mainFilename: mainFilename || process.cwd(),
162580
163736
  Parser: lib_default,
@@ -166131,6 +167287,7 @@ __export(publish_exports, {
166131
167287
  builder: () => builder,
166132
167288
  command: () => command2,
166133
167289
  description: () => description,
167290
+ handleReleaseBranch: () => handleReleaseBranch,
166134
167291
  handler: () => handler2,
166135
167292
  publishMain: () => publishMain,
166136
167293
  runPostReleaseCommand: () => runPostReleaseCommand
@@ -166153,6 +167310,7 @@ init_helpers();
166153
167310
  init_strings();
166154
167311
  init_system();
166155
167312
  init_version9();
167313
+ init_esm9();
166156
167314
  init_git();
166157
167315
  init_tracing3();
166158
167316
  var DEFAULT_POST_RELEASE_SCRIPT_PATH = (0, import_path27.join)("scripts", "post-release.sh");
@@ -166370,8 +167528,41 @@ async function handleReleaseBranch(git, remoteName, branch, mergeTarget, keepBra
166370
167528
  }
166371
167529
  logger.debug(`Checking out merge target branch:`, mergeTarget);
166372
167530
  await git.checkout(mergeTarget);
167531
+ logger.debug(`Pulling latest changes from ${remoteName}/${mergeTarget}`);
167532
+ try {
167533
+ await git.pull(remoteName, mergeTarget, ["--rebase"]);
167534
+ } catch (pullError) {
167535
+ try {
167536
+ await git.raw(["rebase", "--abort"]);
167537
+ } catch (_abortError) {
167538
+ logger.trace("git rebase --abort failed (may be no rebase in progress)");
167539
+ }
167540
+ throw pullError;
167541
+ }
166373
167542
  logger.debug(`Merging ${branch} into: ${mergeTarget}`);
166374
- await git.pull(remoteName, mergeTarget, ["--rebase"]).merge(["--no-ff", "--no-edit", branch]).push(remoteName, mergeTarget);
167543
+ try {
167544
+ await git.merge(["--no-ff", "--no-edit", branch]);
167545
+ } catch (mergeError) {
167546
+ logger.warn(
167547
+ `Merge with default strategy failed (${mergeError instanceof Error ? mergeError.message : mergeError}), retrying with "resolve" strategy...`
167548
+ );
167549
+ try {
167550
+ await git.merge(["--abort"]);
167551
+ } catch (_abortError) {
167552
+ logger.trace("git merge --abort failed (may be no merge in progress)");
167553
+ }
167554
+ try {
167555
+ await git.merge(["-s", "resolve", "--no-ff", "--no-edit", branch]);
167556
+ } catch (resolveError) {
167557
+ try {
167558
+ await git.merge(["--abort"]);
167559
+ } catch (_abortError) {
167560
+ logger.trace("git merge --abort failed after resolve strategy");
167561
+ }
167562
+ throw resolveError;
167563
+ }
167564
+ }
167565
+ await git.push(remoteName, mergeTarget);
166375
167566
  if (keepBranch) {
166376
167567
  logger.info("Not deleting the release branch.");
166377
167568
  } else {
@@ -166561,13 +167752,30 @@ Original error: ${err instanceof Error ? err.message : String(err)}`;
166561
167752
  "Not merging because cannot determine a branch name to merge from."
166562
167753
  );
166563
167754
  } else if (targetsToPublish.has("all" /* All */) || targetsToPublish.has("none" /* None */) || earlierStateExists) {
166564
- await handleReleaseBranch(
166565
- git,
166566
- argv.remote,
166567
- branchName,
166568
- argv.mergeTarget,
166569
- argv.keepBranch
166570
- );
167755
+ try {
167756
+ await handleReleaseBranch(
167757
+ git,
167758
+ argv.remote,
167759
+ branchName,
167760
+ argv.mergeTarget,
167761
+ argv.keepBranch
167762
+ );
167763
+ } catch (mergeError) {
167764
+ captureException(mergeError);
167765
+ logger.warn(
167766
+ [
167767
+ `Failed to merge release branch "${branchName}" into the target branch.`,
167768
+ `This is likely due to a merge conflict (e.g., in CHANGELOG.md).`,
167769
+ `All publish targets completed successfully \u2014 only the post-publish merge failed.`,
167770
+ ``,
167771
+ `To resolve manually:`,
167772
+ ` 1. Merge the release branch into the target branch, resolving conflicts`,
167773
+ ` 2. Delete the release branch: git push ${argv.remote} --delete ${branchName}`,
167774
+ ``,
167775
+ `Error: ${mergeError instanceof Error ? mergeError.message : String(mergeError)}`
167776
+ ].join("\n")
167777
+ );
167778
+ }
166571
167779
  safeFs.unlink(publishStateFile).catch(
166572
167780
  (err) => logger.trace("Couldn't remove publish state file: ", err)
166573
167781
  );