@aws-cdk/integ-runner 2.197.4 → 2.197.6

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.
@@ -1420,8 +1420,8 @@ var require_helpers = __commonJS({
1420
1420
  var ValidationError = exports2.ValidationError = /* @__PURE__ */ __name(function ValidationError2(message2, instance, schema, path38, name, argument) {
1421
1421
  if (Array.isArray(path38)) {
1422
1422
  this.path = path38;
1423
- this.property = path38.reduce(function(sum3, item) {
1424
- return sum3 + makeSuffix(item);
1423
+ this.property = path38.reduce(function(sum4, item) {
1424
+ return sum4 + makeSuffix(item);
1425
1425
  }, "instance");
1426
1426
  } else if (path38 !== void 0) {
1427
1427
  this.property = path38;
@@ -1522,8 +1522,8 @@ var require_helpers = __commonJS({
1522
1522
  this.options = options;
1523
1523
  if (Array.isArray(path38)) {
1524
1524
  this.path = path38;
1525
- this.propertyPath = path38.reduce(function(sum3, item) {
1526
- return sum3 + makeSuffix(item);
1525
+ this.propertyPath = path38.reduce(function(sum4, item) {
1526
+ return sum4 + makeSuffix(item);
1527
1527
  }, "instance");
1528
1528
  } else {
1529
1529
  this.propertyPath = path38;
@@ -4670,7 +4670,7 @@ var require_semver2 = __commonJS({
4670
4670
  // ../cloud-assembly-schema/cli-version.json
4671
4671
  var require_cli_version = __commonJS({
4672
4672
  "../cloud-assembly-schema/cli-version.json"(exports2, module2) {
4673
- module2.exports = { version: "2.1111.0" };
4673
+ module2.exports = { version: "2.1113.0" };
4674
4674
  }
4675
4675
  });
4676
4676
 
@@ -7028,11 +7028,11 @@ var init_metadata = __esm({
7028
7028
  "../cloud-assembly-api/lib/metadata.ts"() {
7029
7029
  "use strict";
7030
7030
  PATH_METADATA_KEY = "aws:cdk:path";
7031
- SynthesisMessageLevel = /* @__PURE__ */ ((SynthesisMessageLevel3) => {
7032
- SynthesisMessageLevel3["INFO"] = "info";
7033
- SynthesisMessageLevel3["WARNING"] = "warning";
7034
- SynthesisMessageLevel3["ERROR"] = "error";
7035
- return SynthesisMessageLevel3;
7031
+ SynthesisMessageLevel = /* @__PURE__ */ ((SynthesisMessageLevel4) => {
7032
+ SynthesisMessageLevel4["INFO"] = "info";
7033
+ SynthesisMessageLevel4["WARNING"] = "warning";
7034
+ SynthesisMessageLevel4["ERROR"] = "error";
7035
+ return SynthesisMessageLevel4;
7036
7036
  })(SynthesisMessageLevel || {});
7037
7037
  }
7038
7038
  });
@@ -8250,12 +8250,12 @@ var require_metadata = __commonJS({
8250
8250
  Object.defineProperty(exports2, "__esModule", { value: true });
8251
8251
  exports2.SynthesisMessageLevel = exports2.PATH_METADATA_KEY = void 0;
8252
8252
  exports2.PATH_METADATA_KEY = "aws:cdk:path";
8253
- var SynthesisMessageLevel3;
8254
- (function(SynthesisMessageLevel4) {
8255
- SynthesisMessageLevel4["INFO"] = "info";
8256
- SynthesisMessageLevel4["WARNING"] = "warning";
8257
- SynthesisMessageLevel4["ERROR"] = "error";
8258
- })(SynthesisMessageLevel3 || (exports2.SynthesisMessageLevel = SynthesisMessageLevel3 = {}));
8253
+ var SynthesisMessageLevel4;
8254
+ (function(SynthesisMessageLevel5) {
8255
+ SynthesisMessageLevel5["INFO"] = "info";
8256
+ SynthesisMessageLevel5["WARNING"] = "warning";
8257
+ SynthesisMessageLevel5["ERROR"] = "error";
8258
+ })(SynthesisMessageLevel4 || (exports2.SynthesisMessageLevel = SynthesisMessageLevel4 = {}));
8259
8259
  }
8260
8260
  });
8261
8261
 
@@ -8557,7 +8557,7 @@ var require_cloudformation_artifact = __commonJS({
8557
8557
  var environment_1 = require_environment2();
8558
8558
  var error_1 = require_error();
8559
8559
  var CLOUDFORMATION_STACK_ARTIFACT_SYM2 = /* @__PURE__ */ Symbol.for("@aws-cdk/cx-api.CloudFormationStackArtifact");
8560
- var CloudFormationStackArtifact3 = class extends cloud_artifact_1.CloudArtifact {
8560
+ var CloudFormationStackArtifact4 = class extends cloud_artifact_1.CloudArtifact {
8561
8561
  static {
8562
8562
  __name(this, "CloudFormationStackArtifact");
8563
8563
  }
@@ -8627,8 +8627,8 @@ var require_cloudformation_artifact = __commonJS({
8627
8627
  return this._template;
8628
8628
  }
8629
8629
  };
8630
- exports2.CloudFormationStackArtifact = CloudFormationStackArtifact3;
8631
- Object.defineProperty(CloudFormationStackArtifact3.prototype, CLOUDFORMATION_STACK_ARTIFACT_SYM2, {
8630
+ exports2.CloudFormationStackArtifact = CloudFormationStackArtifact4;
8631
+ Object.defineProperty(CloudFormationStackArtifact4.prototype, CLOUDFORMATION_STACK_ARTIFACT_SYM2, {
8632
8632
  value: true,
8633
8633
  enumerable: false,
8634
8634
  writable: false
@@ -9412,12 +9412,12 @@ var require_legacy_moved = __commonJS({
9412
9412
  Object.defineProperty(exports2, "UNKNOWN_REGION", { enumerable: true, get: /* @__PURE__ */ __name(function() {
9413
9413
  return cloud_assembly_api_1.UNKNOWN_REGION;
9414
9414
  }, "get") });
9415
- var SynthesisMessageLevel3;
9416
- (function(SynthesisMessageLevel4) {
9417
- SynthesisMessageLevel4["INFO"] = "info";
9418
- SynthesisMessageLevel4["WARNING"] = "warning";
9419
- SynthesisMessageLevel4["ERROR"] = "error";
9420
- })(SynthesisMessageLevel3 || (exports2.SynthesisMessageLevel = SynthesisMessageLevel3 = {}));
9415
+ var SynthesisMessageLevel4;
9416
+ (function(SynthesisMessageLevel5) {
9417
+ SynthesisMessageLevel5["INFO"] = "info";
9418
+ SynthesisMessageLevel5["WARNING"] = "warning";
9419
+ SynthesisMessageLevel5["ERROR"] = "error";
9420
+ })(SynthesisMessageLevel4 || (exports2.SynthesisMessageLevel = SynthesisMessageLevel4 = {}));
9421
9421
  exports2.CloudAssembly = cloud_assembly_api_1.CloudAssembly;
9422
9422
  exports2.CloudArtifact = cloud_assembly_api_1.CloudArtifact;
9423
9423
  exports2.CloudFormationStackArtifact = cloud_assembly_api_1.CloudFormationStackArtifact;
@@ -66948,10 +66948,10 @@ var require_headers = __commonJS({
66948
66948
  }
66949
66949
  __name(indexOf, "indexOf");
66950
66950
  function cksum(block) {
66951
- let sum3 = 8 * 32;
66952
- for (let i10 = 0; i10 < 148; i10++) sum3 += block[i10];
66953
- for (let j10 = 156; j10 < 512; j10++) sum3 += block[j10];
66954
- return sum3;
66951
+ let sum4 = 8 * 32;
66952
+ for (let i10 = 0; i10 < 148; i10++) sum4 += block[i10];
66953
+ for (let j10 = 156; j10 < 512; j10++) sum4 += block[j10];
66954
+ return sum4;
66955
66955
  }
66956
66956
  __name(cksum, "cksum");
66957
66957
  function encodeOct(val, n10) {
@@ -66988,12 +66988,12 @@ var require_headers = __commonJS({
66988
66988
  if (positive) tuple.push(byte);
66989
66989
  else tuple.push(255 - byte);
66990
66990
  }
66991
- let sum3 = 0;
66991
+ let sum4 = 0;
66992
66992
  const l10 = tuple.length;
66993
66993
  for (i10 = 0; i10 < l10; i10++) {
66994
- sum3 += tuple[i10] * Math.pow(256, i10);
66994
+ sum4 += tuple[i10] * Math.pow(256, i10);
66995
66995
  }
66996
- return positive ? sum3 : -1 * sum3;
66996
+ return positive ? sum4 : -1 * sum4;
66997
66997
  }
66998
66998
  __name(parse256, "parse256");
66999
66999
  function decodeOct(val, offset, length) {
@@ -72614,7 +72614,7 @@ ${indent}${str}`;
72614
72614
  end
72615
72615
  } = flowChars;
72616
72616
  const strings = nodes.map((n10) => n10.str);
72617
- if (hasItemWithNewLine || strings.reduce((sum3, str2) => sum3 + str2.length + 2, 2) > _Collection.maxFlowStringSingleLineLength) {
72617
+ if (hasItemWithNewLine || strings.reduce((sum4, str2) => sum4 + str2.length + 2, 2) > _Collection.maxFlowStringSingleLineLength) {
72618
72618
  str = start;
72619
72619
  for (const s10 of strings) {
72620
72620
  str += s10 ? `
@@ -78081,6 +78081,8 @@ var init_span = __esm({
78081
78081
  spanId;
78082
78082
  startTime;
78083
78083
  timingMsgTemplate;
78084
+ counters = {};
78085
+ openTimers = /* @__PURE__ */ new Set();
78084
78086
  constructor(ioHelper, definition, makeHelper) {
78085
78087
  this.definition = definition;
78086
78088
  this.ioHelper = ioHelper;
@@ -78108,6 +78110,10 @@ var init_span = __esm({
78108
78110
  }
78109
78111
  async end(x10, y4) {
78110
78112
  const duration = this.time();
78113
+ for (const t10 of this.openTimers) {
78114
+ t10.stop();
78115
+ }
78116
+ this.openTimers.clear();
78111
78117
  const endInput = parseArgs(x10, y4);
78112
78118
  const endMsg = endInput.message ?? util2.format(this.timingMsgTemplate, this.definition.name, duration.asSec);
78113
78119
  const endPayload = endInput.payload;
@@ -78115,14 +78121,30 @@ var init_span = __esm({
78115
78121
  endMsg,
78116
78122
  {
78117
78123
  duration: duration.asMs,
78124
+ ...Object.keys(this.counters).length > 0 ? { counters: this.counters } : {},
78118
78125
  ...endPayload
78119
78126
  }
78120
78127
  ));
78121
78128
  return duration;
78122
78129
  }
78130
+ incCounter(name, delta = 1) {
78131
+ this.counters[name] = (this.counters[name] ?? 0) + delta;
78132
+ }
78123
78133
  async requestResponse(msg) {
78124
78134
  return this.ioHelper.requestResponse(withSpanId(this.spanId, msg));
78125
78135
  }
78136
+ startTimer(name) {
78137
+ const start = Date.now();
78138
+ const t10 = {
78139
+ stop: /* @__PURE__ */ __name(() => {
78140
+ this.openTimers.delete(t10);
78141
+ this.incCounter(`${name}_ms`, Math.floor(Date.now() - start) / 1e3);
78142
+ this.incCounter(`${name}_cnt`, 1);
78143
+ }, "stop")
78144
+ };
78145
+ this.openTimers.add(t10);
78146
+ return t10;
78147
+ }
78126
78148
  time() {
78127
78149
  const elapsedTime = (/* @__PURE__ */ new Date()).getTime() - this.startTime;
78128
78150
  return {
@@ -91783,45 +91805,45 @@ var require_fxp = __commonJS({
91783
91805
  "../../../node_modules/@aws-sdk/xml-builder/node_modules/fast-xml-parser/lib/fxp.cjs"(exports2, module2) {
91784
91806
  (() => {
91785
91807
  "use strict";
91786
- var t10 = { d: /* @__PURE__ */ __name((e11, n11) => {
91787
- for (var i11 in n11) t10.o(n11, i11) && !t10.o(e11, i11) && Object.defineProperty(e11, i11, { enumerable: true, get: n11[i11] });
91808
+ var t10 = { d: /* @__PURE__ */ __name((e11, i11) => {
91809
+ for (var n11 in i11) t10.o(i11, n11) && !t10.o(e11, n11) && Object.defineProperty(e11, n11, { enumerable: true, get: i11[n11] });
91788
91810
  }, "d"), o: /* @__PURE__ */ __name((t11, e11) => Object.prototype.hasOwnProperty.call(t11, e11), "o"), r: /* @__PURE__ */ __name((t11) => {
91789
91811
  "undefined" != typeof Symbol && Symbol.toStringTag && Object.defineProperty(t11, Symbol.toStringTag, { value: "Module" }), Object.defineProperty(t11, "__esModule", { value: true });
91790
91812
  }, "r") }, e10 = {};
91791
- t10.r(e10), t10.d(e10, { XMLBuilder: /* @__PURE__ */ __name(() => gt, "XMLBuilder"), XMLParser: /* @__PURE__ */ __name(() => it, "XMLParser"), XMLValidator: /* @__PURE__ */ __name(() => xt, "XMLValidator") });
91792
- const n10 = ":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", i10 = new RegExp("^[" + n10 + "][" + n10 + "\\-.\\d\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*$");
91813
+ t10.r(e10), t10.d(e10, { XMLBuilder: /* @__PURE__ */ __name(() => Ot, "XMLBuilder"), XMLParser: /* @__PURE__ */ __name(() => ft, "XMLParser"), XMLValidator: /* @__PURE__ */ __name(() => $t, "XMLValidator") });
91814
+ const i10 = ":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", n10 = new RegExp("^[" + i10 + "][" + i10 + "\\-.\\d\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*$");
91793
91815
  function s10(t11, e11) {
91794
- const n11 = [];
91795
- let i11 = e11.exec(t11);
91796
- for (; i11; ) {
91816
+ const i11 = [];
91817
+ let n11 = e11.exec(t11);
91818
+ for (; n11; ) {
91797
91819
  const s11 = [];
91798
- s11.startIndex = e11.lastIndex - i11[0].length;
91799
- const r11 = i11.length;
91800
- for (let t12 = 0; t12 < r11; t12++) s11.push(i11[t12]);
91801
- n11.push(s11), i11 = e11.exec(t11);
91820
+ s11.startIndex = e11.lastIndex - n11[0].length;
91821
+ const r11 = n11.length;
91822
+ for (let t12 = 0; t12 < r11; t12++) s11.push(n11[t12]);
91823
+ i11.push(s11), n11 = e11.exec(t11);
91802
91824
  }
91803
- return n11;
91825
+ return i11;
91804
91826
  }
91805
91827
  __name(s10, "s");
91806
91828
  const r10 = /* @__PURE__ */ __name(function(t11) {
91807
- return !(null == i10.exec(t11));
91808
- }, "r"), o10 = { allowBooleanAttributes: false, unpairedTags: [] };
91809
- function a10(t11, e11) {
91810
- e11 = Object.assign({}, o10, e11);
91811
- const n11 = [];
91812
- let i11 = false, s11 = false;
91829
+ return !(null == n10.exec(t11));
91830
+ }, "r"), o10 = ["hasOwnProperty", "toString", "valueOf", "__defineGetter__", "__defineSetter__", "__lookupGetter__", "__lookupSetter__"], a10 = ["__proto__", "constructor", "prototype"], h10 = { allowBooleanAttributes: false, unpairedTags: [] };
91831
+ function l10(t11, e11) {
91832
+ e11 = Object.assign({}, h10, e11);
91833
+ const i11 = [];
91834
+ let n11 = false, s11 = false;
91813
91835
  "\uFEFF" === t11[0] && (t11 = t11.substr(1));
91814
91836
  for (let r11 = 0; r11 < t11.length; r11++) if ("<" === t11[r11] && "?" === t11[r11 + 1]) {
91815
91837
  if (r11 += 2, r11 = u10(t11, r11), r11.err) return r11;
91816
91838
  } else {
91817
91839
  if ("<" !== t11[r11]) {
91818
- if (l10(t11[r11])) continue;
91819
- return m10("InvalidChar", "char '" + t11[r11] + "' is not expected.", N(t11, r11));
91840
+ if (p10(t11[r11])) continue;
91841
+ return b10("InvalidChar", "char '" + t11[r11] + "' is not expected.", w10(t11, r11));
91820
91842
  }
91821
91843
  {
91822
91844
  let o11 = r11;
91823
91845
  if (r11++, "!" === t11[r11]) {
91824
- r11 = d10(t11, r11);
91846
+ r11 = c10(t11, r11);
91825
91847
  continue;
91826
91848
  }
91827
91849
  {
@@ -91829,65 +91851,65 @@ var require_fxp = __commonJS({
91829
91851
  "/" === t11[r11] && (a11 = true, r11++);
91830
91852
  let h11 = "";
91831
91853
  for (; r11 < t11.length && ">" !== t11[r11] && " " !== t11[r11] && " " !== t11[r11] && "\n" !== t11[r11] && "\r" !== t11[r11]; r11++) h11 += t11[r11];
91832
- if (h11 = h11.trim(), "/" === h11[h11.length - 1] && (h11 = h11.substring(0, h11.length - 1), r11--), !b10(h11)) {
91854
+ if (h11 = h11.trim(), "/" === h11[h11.length - 1] && (h11 = h11.substring(0, h11.length - 1), r11--), !y4(h11)) {
91833
91855
  let e12;
91834
- return e12 = 0 === h11.trim().length ? "Invalid space after '<'." : "Tag '" + h11 + "' is an invalid name.", m10("InvalidTag", e12, N(t11, r11));
91856
+ return e12 = 0 === h11.trim().length ? "Invalid space after '<'." : "Tag '" + h11 + "' is an invalid name.", b10("InvalidTag", e12, w10(t11, r11));
91835
91857
  }
91836
- const p11 = c10(t11, r11);
91837
- if (false === p11) return m10("InvalidAttr", "Attributes for '" + h11 + "' have open quote.", N(t11, r11));
91838
- let f11 = p11.value;
91839
- if (r11 = p11.index, "/" === f11[f11.length - 1]) {
91840
- const n12 = r11 - f11.length;
91841
- f11 = f11.substring(0, f11.length - 1);
91842
- const s12 = g10(f11, e11);
91843
- if (true !== s12) return m10(s12.err.code, s12.err.msg, N(t11, n12 + s12.err.line));
91844
- i11 = true;
91858
+ const l11 = g10(t11, r11);
91859
+ if (false === l11) return b10("InvalidAttr", "Attributes for '" + h11 + "' have open quote.", w10(t11, r11));
91860
+ let d11 = l11.value;
91861
+ if (r11 = l11.index, "/" === d11[d11.length - 1]) {
91862
+ const i12 = r11 - d11.length;
91863
+ d11 = d11.substring(0, d11.length - 1);
91864
+ const s12 = x10(d11, e11);
91865
+ if (true !== s12) return b10(s12.err.code, s12.err.msg, w10(t11, i12 + s12.err.line));
91866
+ n11 = true;
91845
91867
  } else if (a11) {
91846
- if (!p11.tagClosed) return m10("InvalidTag", "Closing tag '" + h11 + "' doesn't have proper closing.", N(t11, r11));
91847
- if (f11.trim().length > 0) return m10("InvalidTag", "Closing tag '" + h11 + "' can't have attributes or invalid starting.", N(t11, o11));
91848
- if (0 === n11.length) return m10("InvalidTag", "Closing tag '" + h11 + "' has not been opened.", N(t11, o11));
91868
+ if (!l11.tagClosed) return b10("InvalidTag", "Closing tag '" + h11 + "' doesn't have proper closing.", w10(t11, r11));
91869
+ if (d11.trim().length > 0) return b10("InvalidTag", "Closing tag '" + h11 + "' can't have attributes or invalid starting.", w10(t11, o11));
91870
+ if (0 === i11.length) return b10("InvalidTag", "Closing tag '" + h11 + "' has not been opened.", w10(t11, o11));
91849
91871
  {
91850
- const e12 = n11.pop();
91872
+ const e12 = i11.pop();
91851
91873
  if (h11 !== e12.tagName) {
91852
- let n12 = N(t11, e12.tagStartPos);
91853
- return m10("InvalidTag", "Expected closing tag '" + e12.tagName + "' (opened in line " + n12.line + ", col " + n12.col + ") instead of closing tag '" + h11 + "'.", N(t11, o11));
91874
+ let i12 = w10(t11, e12.tagStartPos);
91875
+ return b10("InvalidTag", "Expected closing tag '" + e12.tagName + "' (opened in line " + i12.line + ", col " + i12.col + ") instead of closing tag '" + h11 + "'.", w10(t11, o11));
91854
91876
  }
91855
- 0 == n11.length && (s11 = true);
91877
+ 0 == i11.length && (s11 = true);
91856
91878
  }
91857
91879
  } else {
91858
- const a12 = g10(f11, e11);
91859
- if (true !== a12) return m10(a12.err.code, a12.err.msg, N(t11, r11 - f11.length + a12.err.line));
91860
- if (true === s11) return m10("InvalidXml", "Multiple possible root nodes found.", N(t11, r11));
91861
- -1 !== e11.unpairedTags.indexOf(h11) || n11.push({ tagName: h11, tagStartPos: o11 }), i11 = true;
91880
+ const a12 = x10(d11, e11);
91881
+ if (true !== a12) return b10(a12.err.code, a12.err.msg, w10(t11, r11 - d11.length + a12.err.line));
91882
+ if (true === s11) return b10("InvalidXml", "Multiple possible root nodes found.", w10(t11, r11));
91883
+ -1 !== e11.unpairedTags.indexOf(h11) || i11.push({ tagName: h11, tagStartPos: o11 }), n11 = true;
91862
91884
  }
91863
91885
  for (r11++; r11 < t11.length; r11++) if ("<" === t11[r11]) {
91864
91886
  if ("!" === t11[r11 + 1]) {
91865
- r11++, r11 = d10(t11, r11);
91887
+ r11++, r11 = c10(t11, r11);
91866
91888
  continue;
91867
91889
  }
91868
91890
  if ("?" !== t11[r11 + 1]) break;
91869
91891
  if (r11 = u10(t11, ++r11), r11.err) return r11;
91870
91892
  } else if ("&" === t11[r11]) {
91871
- const e12 = x10(t11, r11);
91872
- if (-1 == e12) return m10("InvalidChar", "char '&' is not expected.", N(t11, r11));
91893
+ const e12 = N(t11, r11);
91894
+ if (-1 == e12) return b10("InvalidChar", "char '&' is not expected.", w10(t11, r11));
91873
91895
  r11 = e12;
91874
- } else if (true === s11 && !l10(t11[r11])) return m10("InvalidXml", "Extra text at the end", N(t11, r11));
91896
+ } else if (true === s11 && !p10(t11[r11])) return b10("InvalidXml", "Extra text at the end", w10(t11, r11));
91875
91897
  "<" === t11[r11] && r11--;
91876
91898
  }
91877
91899
  }
91878
91900
  }
91879
- return i11 ? 1 == n11.length ? m10("InvalidTag", "Unclosed tag '" + n11[0].tagName + "'.", N(t11, n11[0].tagStartPos)) : !(n11.length > 0) || m10("InvalidXml", "Invalid '" + JSON.stringify(n11.map((t12) => t12.tagName), null, 4).replace(/\r?\n/g, "") + "' found.", { line: 1, col: 1 }) : m10("InvalidXml", "Start tag expected.", 1);
91901
+ return n11 ? 1 == i11.length ? b10("InvalidTag", "Unclosed tag '" + i11[0].tagName + "'.", w10(t11, i11[0].tagStartPos)) : !(i11.length > 0) || b10("InvalidXml", "Invalid '" + JSON.stringify(i11.map((t12) => t12.tagName), null, 4).replace(/\r?\n/g, "") + "' found.", { line: 1, col: 1 }) : b10("InvalidXml", "Start tag expected.", 1);
91880
91902
  }
91881
- __name(a10, "a");
91882
- function l10(t11) {
91903
+ __name(l10, "l");
91904
+ function p10(t11) {
91883
91905
  return " " === t11 || " " === t11 || "\n" === t11 || "\r" === t11;
91884
91906
  }
91885
- __name(l10, "l");
91907
+ __name(p10, "p");
91886
91908
  function u10(t11, e11) {
91887
- const n11 = e11;
91909
+ const i11 = e11;
91888
91910
  for (; e11 < t11.length; e11++) if ("?" == t11[e11] || " " == t11[e11]) {
91889
- const i11 = t11.substr(n11, e11 - n11);
91890
- if (e11 > 5 && "xml" === i11) return m10("InvalidXml", "XML declaration allowed only at the start of the document.", N(t11, e11));
91911
+ const n11 = t11.substr(i11, e11 - i11);
91912
+ if (e11 > 5 && "xml" === n11) return b10("InvalidXml", "XML declaration allowed only at the start of the document.", w10(t11, e11));
91891
91913
  if ("?" == t11[e11] && ">" == t11[e11 + 1]) {
91892
91914
  e11++;
91893
91915
  break;
@@ -91897,16 +91919,16 @@ var require_fxp = __commonJS({
91897
91919
  return e11;
91898
91920
  }
91899
91921
  __name(u10, "u");
91900
- function d10(t11, e11) {
91922
+ function c10(t11, e11) {
91901
91923
  if (t11.length > e11 + 5 && "-" === t11[e11 + 1] && "-" === t11[e11 + 2]) {
91902
91924
  for (e11 += 3; e11 < t11.length; e11++) if ("-" === t11[e11] && "-" === t11[e11 + 1] && ">" === t11[e11 + 2]) {
91903
91925
  e11 += 2;
91904
91926
  break;
91905
91927
  }
91906
91928
  } else if (t11.length > e11 + 8 && "D" === t11[e11 + 1] && "O" === t11[e11 + 2] && "C" === t11[e11 + 3] && "T" === t11[e11 + 4] && "Y" === t11[e11 + 5] && "P" === t11[e11 + 6] && "E" === t11[e11 + 7]) {
91907
- let n11 = 1;
91908
- for (e11 += 8; e11 < t11.length; e11++) if ("<" === t11[e11]) n11++;
91909
- else if (">" === t11[e11] && (n11--, 0 === n11)) break;
91929
+ let i11 = 1;
91930
+ for (e11 += 8; e11 < t11.length; e11++) if ("<" === t11[e11]) i11++;
91931
+ else if (">" === t11[e11] && (i11--, 0 === i11)) break;
91910
91932
  } else if (t11.length > e11 + 9 && "[" === t11[e11 + 1] && "C" === t11[e11 + 2] && "D" === t11[e11 + 3] && "A" === t11[e11 + 4] && "T" === t11[e11 + 5] && "A" === t11[e11 + 6] && "[" === t11[e11 + 7]) {
91911
91933
  for (e11 += 8; e11 < t11.length; e11++) if ("]" === t11[e11] && "]" === t11[e11 + 1] && ">" === t11[e11 + 2]) {
91912
91934
  e11 += 2;
@@ -91915,95 +91937,103 @@ var require_fxp = __commonJS({
91915
91937
  }
91916
91938
  return e11;
91917
91939
  }
91918
- __name(d10, "d");
91919
- const h10 = '"', p10 = "'";
91920
- function c10(t11, e11) {
91921
- let n11 = "", i11 = "", s11 = false;
91940
+ __name(c10, "c");
91941
+ const d10 = '"', f10 = "'";
91942
+ function g10(t11, e11) {
91943
+ let i11 = "", n11 = "", s11 = false;
91922
91944
  for (; e11 < t11.length; e11++) {
91923
- if (t11[e11] === h10 || t11[e11] === p10) "" === i11 ? i11 = t11[e11] : i11 !== t11[e11] || (i11 = "");
91924
- else if (">" === t11[e11] && "" === i11) {
91945
+ if (t11[e11] === d10 || t11[e11] === f10) "" === n11 ? n11 = t11[e11] : n11 !== t11[e11] || (n11 = "");
91946
+ else if (">" === t11[e11] && "" === n11) {
91925
91947
  s11 = true;
91926
91948
  break;
91927
91949
  }
91928
- n11 += t11[e11];
91950
+ i11 += t11[e11];
91929
91951
  }
91930
- return "" === i11 && { value: n11, index: e11, tagClosed: s11 };
91952
+ return "" === n11 && { value: i11, index: e11, tagClosed: s11 };
91931
91953
  }
91932
- __name(c10, "c");
91933
- const f10 = new RegExp(`(\\s*)([^\\s=]+)(\\s*=)?(\\s*(['"])(([\\s\\S])*?)\\5)?`, "g");
91934
- function g10(t11, e11) {
91935
- const n11 = s10(t11, f10), i11 = {};
91936
- for (let t12 = 0; t12 < n11.length; t12++) {
91937
- if (0 === n11[t12][1].length) return m10("InvalidAttr", "Attribute '" + n11[t12][2] + "' has no space in starting.", y4(n11[t12]));
91938
- if (void 0 !== n11[t12][3] && void 0 === n11[t12][4]) return m10("InvalidAttr", "Attribute '" + n11[t12][2] + "' is without value.", y4(n11[t12]));
91939
- if (void 0 === n11[t12][3] && !e11.allowBooleanAttributes) return m10("InvalidAttr", "boolean attribute '" + n11[t12][2] + "' is not allowed.", y4(n11[t12]));
91940
- const s11 = n11[t12][2];
91941
- if (!E3(s11)) return m10("InvalidAttr", "Attribute '" + s11 + "' is an invalid name.", y4(n11[t12]));
91942
- if (Object.prototype.hasOwnProperty.call(i11, s11)) return m10("InvalidAttr", "Attribute '" + s11 + "' is repeated.", y4(n11[t12]));
91943
- i11[s11] = 1;
91954
+ __name(g10, "g");
91955
+ const m10 = new RegExp(`(\\s*)([^\\s=]+)(\\s*=)?(\\s*(['"])(([\\s\\S])*?)\\5)?`, "g");
91956
+ function x10(t11, e11) {
91957
+ const i11 = s10(t11, m10), n11 = {};
91958
+ for (let t12 = 0; t12 < i11.length; t12++) {
91959
+ if (0 === i11[t12][1].length) return b10("InvalidAttr", "Attribute '" + i11[t12][2] + "' has no space in starting.", v11(i11[t12]));
91960
+ if (void 0 !== i11[t12][3] && void 0 === i11[t12][4]) return b10("InvalidAttr", "Attribute '" + i11[t12][2] + "' is without value.", v11(i11[t12]));
91961
+ if (void 0 === i11[t12][3] && !e11.allowBooleanAttributes) return b10("InvalidAttr", "boolean attribute '" + i11[t12][2] + "' is not allowed.", v11(i11[t12]));
91962
+ const s11 = i11[t12][2];
91963
+ if (!E3(s11)) return b10("InvalidAttr", "Attribute '" + s11 + "' is an invalid name.", v11(i11[t12]));
91964
+ if (Object.prototype.hasOwnProperty.call(n11, s11)) return b10("InvalidAttr", "Attribute '" + s11 + "' is repeated.", v11(i11[t12]));
91965
+ n11[s11] = 1;
91944
91966
  }
91945
91967
  return true;
91946
91968
  }
91947
- __name(g10, "g");
91948
- function x10(t11, e11) {
91969
+ __name(x10, "x");
91970
+ function N(t11, e11) {
91949
91971
  if (";" === t11[++e11]) return -1;
91950
91972
  if ("#" === t11[e11]) return (function(t12, e12) {
91951
- let n12 = /\d/;
91952
- for ("x" === t12[e12] && (e12++, n12 = /[\da-fA-F]/); e12 < t12.length; e12++) {
91973
+ let i12 = /\d/;
91974
+ for ("x" === t12[e12] && (e12++, i12 = /[\da-fA-F]/); e12 < t12.length; e12++) {
91953
91975
  if (";" === t12[e12]) return e12;
91954
- if (!t12[e12].match(n12)) break;
91976
+ if (!t12[e12].match(i12)) break;
91955
91977
  }
91956
91978
  return -1;
91957
91979
  })(t11, ++e11);
91958
- let n11 = 0;
91959
- for (; e11 < t11.length; e11++, n11++) if (!(t11[e11].match(/\w/) && n11 < 20)) {
91980
+ let i11 = 0;
91981
+ for (; e11 < t11.length; e11++, i11++) if (!(t11[e11].match(/\w/) && i11 < 20)) {
91960
91982
  if (";" === t11[e11]) break;
91961
91983
  return -1;
91962
91984
  }
91963
91985
  return e11;
91964
91986
  }
91965
- __name(x10, "x");
91966
- function m10(t11, e11, n11) {
91967
- return { err: { code: t11, msg: e11, line: n11.line || n11, col: n11.col } };
91987
+ __name(N, "N");
91988
+ function b10(t11, e11, i11) {
91989
+ return { err: { code: t11, msg: e11, line: i11.line || i11, col: i11.col } };
91968
91990
  }
91969
- __name(m10, "m");
91991
+ __name(b10, "b");
91970
91992
  function E3(t11) {
91971
91993
  return r10(t11);
91972
91994
  }
91973
91995
  __name(E3, "E");
91974
- function b10(t11) {
91996
+ function y4(t11) {
91975
91997
  return r10(t11);
91976
91998
  }
91977
- __name(b10, "b");
91978
- function N(t11, e11) {
91979
- const n11 = t11.substring(0, e11).split(/\r?\n/);
91980
- return { line: n11.length, col: n11[n11.length - 1].length + 1 };
91999
+ __name(y4, "y");
92000
+ function w10(t11, e11) {
92001
+ const i11 = t11.substring(0, e11).split(/\r?\n/);
92002
+ return { line: i11.length, col: i11[i11.length - 1].length + 1 };
91981
92003
  }
91982
- __name(N, "N");
91983
- function y4(t11) {
92004
+ __name(w10, "w");
92005
+ function v11(t11) {
91984
92006
  return t11.startIndex + t11[1].length;
91985
92007
  }
91986
- __name(y4, "y");
91987
- const T = { 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: /* @__PURE__ */ __name(function(t11, e11) {
92008
+ __name(v11, "v");
92009
+ const T = /* @__PURE__ */ __name((t11) => o10.includes(t11) ? "__" + t11 : t11, "T"), P = { 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: /* @__PURE__ */ __name(function(t11, e11) {
91988
92010
  return e11;
91989
92011
  }, "tagValueProcessor"), attributeValueProcessor: /* @__PURE__ */ __name(function(t11, e11) {
91990
92012
  return e11;
91991
- }, "attributeValueProcessor"), stopNodes: [], alwaysCreateTextNode: false, isArray: /* @__PURE__ */ __name(() => false, "isArray"), commentPropName: false, unpairedTags: [], processEntities: true, htmlEntities: false, ignoreDeclaration: false, ignorePiTags: false, transformTagName: false, transformAttributeName: false, updateTag: /* @__PURE__ */ __name(function(t11, e11, n11) {
92013
+ }, "attributeValueProcessor"), stopNodes: [], alwaysCreateTextNode: false, isArray: /* @__PURE__ */ __name(() => false, "isArray"), commentPropName: false, unpairedTags: [], processEntities: true, htmlEntities: false, ignoreDeclaration: false, ignorePiTags: false, transformTagName: false, transformAttributeName: false, updateTag: /* @__PURE__ */ __name(function(t11, e11, i11) {
91992
92014
  return t11;
91993
- }, "updateTag"), captureMetaData: false, maxNestedTags: 100, strictReservedNames: true };
91994
- function w10(t11) {
91995
- return "boolean" == typeof t11 ? { enabled: t11, maxEntitySize: 1e4, maxExpansionDepth: 10, maxTotalExpansions: 1e3, maxExpandedLength: 1e5, allowedTags: null, tagFilter: null } : "object" == typeof t11 && null !== t11 ? { enabled: false !== t11.enabled, maxEntitySize: t11.maxEntitySize ?? 1e4, maxExpansionDepth: t11.maxExpansionDepth ?? 10, maxTotalExpansions: t11.maxTotalExpansions ?? 1e3, maxExpandedLength: t11.maxExpandedLength ?? 1e5, allowedTags: t11.allowedTags ?? null, tagFilter: t11.tagFilter ?? null } : w10(true);
92015
+ }, "updateTag"), captureMetaData: false, maxNestedTags: 100, strictReservedNames: true, jPath: true, onDangerousProperty: T };
92016
+ function S(t11, e11) {
92017
+ if ("string" != typeof t11) return;
92018
+ const i11 = t11.toLowerCase();
92019
+ if (o10.some((t12) => i11 === t12.toLowerCase())) throw new Error(`[SECURITY] Invalid ${e11}: "${t11}" is a reserved JavaScript keyword that could cause prototype pollution`);
92020
+ if (a10.some((t12) => i11 === t12.toLowerCase())) throw new Error(`[SECURITY] Invalid ${e11}: "${t11}" is a reserved JavaScript keyword that could cause prototype pollution`);
91996
92021
  }
91997
- __name(w10, "w");
91998
- const v11 = /* @__PURE__ */ __name(function(t11) {
91999
- const e11 = Object.assign({}, T, t11);
92000
- return e11.processEntities = w10(e11.processEntities), e11;
92001
- }, "v");
92022
+ __name(S, "S");
92023
+ function A3(t11) {
92024
+ return "boolean" == typeof t11 ? { enabled: t11, maxEntitySize: 1e4, maxExpansionDepth: 10, maxTotalExpansions: 1e3, maxExpandedLength: 1e5, maxEntityCount: 100, allowedTags: null, tagFilter: null } : "object" == typeof t11 && null !== t11 ? { enabled: false !== t11.enabled, maxEntitySize: t11.maxEntitySize ?? 1e4, maxExpansionDepth: t11.maxExpansionDepth ?? 10, maxTotalExpansions: t11.maxTotalExpansions ?? 1e3, maxExpandedLength: t11.maxExpandedLength ?? 1e5, maxEntityCount: t11.maxEntityCount ?? 100, allowedTags: t11.allowedTags ?? null, tagFilter: t11.tagFilter ?? null } : A3(true);
92025
+ }
92026
+ __name(A3, "A");
92027
+ const C3 = /* @__PURE__ */ __name(function(t11) {
92028
+ const e11 = Object.assign({}, P, t11), i11 = [{ value: e11.attributeNamePrefix, name: "attributeNamePrefix" }, { value: e11.attributesGroupName, name: "attributesGroupName" }, { value: e11.textNodeName, name: "textNodeName" }, { value: e11.cdataPropName, name: "cdataPropName" }, { value: e11.commentPropName, name: "commentPropName" }];
92029
+ for (const { value: t12, name: e12 } of i11) t12 && S(t12, e12);
92030
+ return null === e11.onDangerousProperty && (e11.onDangerousProperty = T), e11.processEntities = A3(e11.processEntities), e11.stopNodes && Array.isArray(e11.stopNodes) && (e11.stopNodes = e11.stopNodes.map((t12) => "string" == typeof t12 && t12.startsWith("*.") ? ".." + t12.substring(2) : t12)), e11;
92031
+ }, "C");
92002
92032
  let O;
92003
92033
  O = "function" != typeof Symbol ? "@@xmlMetadata" : /* @__PURE__ */ Symbol("XML Node Metadata");
92004
- class I3 {
92034
+ class $ {
92005
92035
  static {
92006
- __name(this, "I");
92036
+ __name(this, "$");
92007
92037
  }
92008
92038
  constructor(t11) {
92009
92039
  this.tagname = t11, this.child = [], this[":@"] = /* @__PURE__ */ Object.create(null);
@@ -92018,201 +92048,418 @@ var require_fxp = __commonJS({
92018
92048
  return O;
92019
92049
  }
92020
92050
  }
92021
- class P {
92051
+ class I3 {
92022
92052
  static {
92023
- __name(this, "P");
92053
+ __name(this, "I");
92024
92054
  }
92025
92055
  constructor(t11) {
92026
92056
  this.suppressValidationErr = !t11, this.options = t11;
92027
92057
  }
92028
92058
  readDocType(t11, e11) {
92029
- const n11 = /* @__PURE__ */ Object.create(null);
92059
+ const i11 = /* @__PURE__ */ Object.create(null);
92060
+ let n11 = 0;
92030
92061
  if ("O" !== t11[e11 + 3] || "C" !== t11[e11 + 4] || "T" !== t11[e11 + 5] || "Y" !== t11[e11 + 6] || "P" !== t11[e11 + 7] || "E" !== t11[e11 + 8]) throw new Error("Invalid Tag instead of DOCTYPE");
92031
92062
  {
92032
92063
  e11 += 9;
92033
- let i11 = 1, s11 = false, r11 = false, o11 = "";
92034
- for (; e11 < t11.length; e11++) if ("<" !== t11[e11] || r11) if (">" === t11[e11]) {
92035
- if (r11 ? "-" === t11[e11 - 1] && "-" === t11[e11 - 2] && (r11 = false, i11--) : i11--, 0 === i11) break;
92036
- } else "[" === t11[e11] ? s11 = true : o11 += t11[e11];
92064
+ let s11 = 1, r11 = false, o11 = false, a11 = "";
92065
+ for (; e11 < t11.length; e11++) if ("<" !== t11[e11] || o11) if (">" === t11[e11]) {
92066
+ if (o11 ? "-" === t11[e11 - 1] && "-" === t11[e11 - 2] && (o11 = false, s11--) : s11--, 0 === s11) break;
92067
+ } else "[" === t11[e11] ? r11 = true : a11 += t11[e11];
92037
92068
  else {
92038
- if (s11 && S(t11, "!ENTITY", e11)) {
92039
- let i12, s12;
92040
- if (e11 += 7, [i12, s12, e11] = this.readEntityExp(t11, e11 + 1, this.suppressValidationErr), -1 === s12.indexOf("&")) {
92041
- const t12 = i12.replace(/[.\-+*:]/g, "\\.");
92042
- n11[i12] = { regx: RegExp(`&${t12};`, "g"), val: s12 };
92069
+ if (r11 && _2(t11, "!ENTITY", e11)) {
92070
+ let s12, r12;
92071
+ if (e11 += 7, [s12, r12, e11] = this.readEntityExp(t11, e11 + 1, this.suppressValidationErr), -1 === r12.indexOf("&")) {
92072
+ if (false !== this.options.enabled && this.options.maxEntityCount && n11 >= this.options.maxEntityCount) throw new Error(`Entity count (${n11 + 1}) exceeds maximum allowed (${this.options.maxEntityCount})`);
92073
+ const t12 = s12.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
92074
+ i11[s12] = { regx: RegExp(`&${t12};`, "g"), val: r12 }, n11++;
92043
92075
  }
92044
- } else if (s11 && S(t11, "!ELEMENT", e11)) {
92076
+ } else if (r11 && _2(t11, "!ELEMENT", e11)) {
92045
92077
  e11 += 8;
92046
- const { index: n12 } = this.readElementExp(t11, e11 + 1);
92047
- e11 = n12;
92048
- } else if (s11 && S(t11, "!ATTLIST", e11)) e11 += 8;
92049
- else if (s11 && S(t11, "!NOTATION", e11)) {
92078
+ const { index: i12 } = this.readElementExp(t11, e11 + 1);
92079
+ e11 = i12;
92080
+ } else if (r11 && _2(t11, "!ATTLIST", e11)) e11 += 8;
92081
+ else if (r11 && _2(t11, "!NOTATION", e11)) {
92050
92082
  e11 += 9;
92051
- const { index: n12 } = this.readNotationExp(t11, e11 + 1, this.suppressValidationErr);
92052
- e11 = n12;
92083
+ const { index: i12 } = this.readNotationExp(t11, e11 + 1, this.suppressValidationErr);
92084
+ e11 = i12;
92053
92085
  } else {
92054
- if (!S(t11, "!--", e11)) throw new Error("Invalid DOCTYPE");
92055
- r11 = true;
92086
+ if (!_2(t11, "!--", e11)) throw new Error("Invalid DOCTYPE");
92087
+ o11 = true;
92056
92088
  }
92057
- i11++, o11 = "";
92089
+ s11++, a11 = "";
92058
92090
  }
92059
- if (0 !== i11) throw new Error("Unclosed DOCTYPE");
92091
+ if (0 !== s11) throw new Error("Unclosed DOCTYPE");
92060
92092
  }
92061
- return { entities: n11, i: e11 };
92093
+ return { entities: i11, i: e11 };
92062
92094
  }
92063
92095
  readEntityExp(t11, e11) {
92064
- e11 = A3(t11, e11);
92065
- let n11 = "";
92066
- for (; e11 < t11.length && !/\s/.test(t11[e11]) && '"' !== t11[e11] && "'" !== t11[e11]; ) n11 += t11[e11], e11++;
92067
- if (C3(n11), e11 = A3(t11, e11), !this.suppressValidationErr) {
92096
+ e11 = j10(t11, e11);
92097
+ let i11 = "";
92098
+ for (; e11 < t11.length && !/\s/.test(t11[e11]) && '"' !== t11[e11] && "'" !== t11[e11]; ) i11 += t11[e11], e11++;
92099
+ if (D3(i11), e11 = j10(t11, e11), !this.suppressValidationErr) {
92068
92100
  if ("SYSTEM" === t11.substring(e11, e11 + 6).toUpperCase()) throw new Error("External entities are not supported");
92069
92101
  if ("%" === t11[e11]) throw new Error("Parameter entities are not supported");
92070
92102
  }
92071
- let i11 = "";
92072
- if ([e11, i11] = this.readIdentifierVal(t11, e11, "entity"), false !== this.options.enabled && this.options.maxEntitySize && i11.length > this.options.maxEntitySize) throw new Error(`Entity "${n11}" size (${i11.length}) exceeds maximum allowed size (${this.options.maxEntitySize})`);
92073
- return [n11, i11, --e11];
92103
+ let n11 = "";
92104
+ if ([e11, n11] = this.readIdentifierVal(t11, e11, "entity"), false !== this.options.enabled && this.options.maxEntitySize && n11.length > this.options.maxEntitySize) throw new Error(`Entity "${i11}" size (${n11.length}) exceeds maximum allowed size (${this.options.maxEntitySize})`);
92105
+ return [i11, n11, --e11];
92074
92106
  }
92075
92107
  readNotationExp(t11, e11) {
92076
- e11 = A3(t11, e11);
92077
- let n11 = "";
92078
- for (; e11 < t11.length && !/\s/.test(t11[e11]); ) n11 += t11[e11], e11++;
92079
- !this.suppressValidationErr && C3(n11), e11 = A3(t11, e11);
92080
- const i11 = t11.substring(e11, e11 + 6).toUpperCase();
92081
- if (!this.suppressValidationErr && "SYSTEM" !== i11 && "PUBLIC" !== i11) throw new Error(`Expected SYSTEM or PUBLIC, found "${i11}"`);
92082
- e11 += i11.length, e11 = A3(t11, e11);
92108
+ e11 = j10(t11, e11);
92109
+ let i11 = "";
92110
+ for (; e11 < t11.length && !/\s/.test(t11[e11]); ) i11 += t11[e11], e11++;
92111
+ !this.suppressValidationErr && D3(i11), e11 = j10(t11, e11);
92112
+ const n11 = t11.substring(e11, e11 + 6).toUpperCase();
92113
+ if (!this.suppressValidationErr && "SYSTEM" !== n11 && "PUBLIC" !== n11) throw new Error(`Expected SYSTEM or PUBLIC, found "${n11}"`);
92114
+ e11 += n11.length, e11 = j10(t11, e11);
92083
92115
  let s11 = null, r11 = null;
92084
- if ("PUBLIC" === i11) [e11, s11] = this.readIdentifierVal(t11, e11, "publicIdentifier"), '"' !== t11[e11 = A3(t11, e11)] && "'" !== t11[e11] || ([e11, r11] = this.readIdentifierVal(t11, e11, "systemIdentifier"));
92085
- else if ("SYSTEM" === i11 && ([e11, r11] = this.readIdentifierVal(t11, e11, "systemIdentifier"), !this.suppressValidationErr && !r11)) throw new Error("Missing mandatory system identifier for SYSTEM notation");
92086
- return { notationName: n11, publicIdentifier: s11, systemIdentifier: r11, index: --e11 };
92116
+ if ("PUBLIC" === n11) [e11, s11] = this.readIdentifierVal(t11, e11, "publicIdentifier"), '"' !== t11[e11 = j10(t11, e11)] && "'" !== t11[e11] || ([e11, r11] = this.readIdentifierVal(t11, e11, "systemIdentifier"));
92117
+ else if ("SYSTEM" === n11 && ([e11, r11] = this.readIdentifierVal(t11, e11, "systemIdentifier"), !this.suppressValidationErr && !r11)) throw new Error("Missing mandatory system identifier for SYSTEM notation");
92118
+ return { notationName: i11, publicIdentifier: s11, systemIdentifier: r11, index: --e11 };
92087
92119
  }
92088
- readIdentifierVal(t11, e11, n11) {
92089
- let i11 = "";
92120
+ readIdentifierVal(t11, e11, i11) {
92121
+ let n11 = "";
92090
92122
  const s11 = t11[e11];
92091
92123
  if ('"' !== s11 && "'" !== s11) throw new Error(`Expected quoted string, found "${s11}"`);
92092
- for (e11++; e11 < t11.length && t11[e11] !== s11; ) i11 += t11[e11], e11++;
92093
- if (t11[e11] !== s11) throw new Error(`Unterminated ${n11} value`);
92094
- return [++e11, i11];
92124
+ for (e11++; e11 < t11.length && t11[e11] !== s11; ) n11 += t11[e11], e11++;
92125
+ if (t11[e11] !== s11) throw new Error(`Unterminated ${i11} value`);
92126
+ return [++e11, n11];
92095
92127
  }
92096
92128
  readElementExp(t11, e11) {
92097
- e11 = A3(t11, e11);
92098
- let n11 = "";
92099
- for (; e11 < t11.length && !/\s/.test(t11[e11]); ) n11 += t11[e11], e11++;
92100
- if (!this.suppressValidationErr && !r10(n11)) throw new Error(`Invalid element name: "${n11}"`);
92129
+ e11 = j10(t11, e11);
92101
92130
  let i11 = "";
92102
- if ("E" === t11[e11 = A3(t11, e11)] && S(t11, "MPTY", e11)) e11 += 4;
92103
- else if ("A" === t11[e11] && S(t11, "NY", e11)) e11 += 2;
92131
+ for (; e11 < t11.length && !/\s/.test(t11[e11]); ) i11 += t11[e11], e11++;
92132
+ if (!this.suppressValidationErr && !r10(i11)) throw new Error(`Invalid element name: "${i11}"`);
92133
+ let n11 = "";
92134
+ if ("E" === t11[e11 = j10(t11, e11)] && _2(t11, "MPTY", e11)) e11 += 4;
92135
+ else if ("A" === t11[e11] && _2(t11, "NY", e11)) e11 += 2;
92104
92136
  else if ("(" === t11[e11]) {
92105
- for (e11++; e11 < t11.length && ")" !== t11[e11]; ) i11 += t11[e11], e11++;
92137
+ for (e11++; e11 < t11.length && ")" !== t11[e11]; ) n11 += t11[e11], e11++;
92106
92138
  if (")" !== t11[e11]) throw new Error("Unterminated content model");
92107
92139
  } else if (!this.suppressValidationErr) throw new Error(`Invalid Element Expression, found "${t11[e11]}"`);
92108
- return { elementName: n11, contentModel: i11.trim(), index: e11 };
92140
+ return { elementName: i11, contentModel: n11.trim(), index: e11 };
92109
92141
  }
92110
92142
  readAttlistExp(t11, e11) {
92111
- e11 = A3(t11, e11);
92112
- let n11 = "";
92113
- for (; e11 < t11.length && !/\s/.test(t11[e11]); ) n11 += t11[e11], e11++;
92114
- C3(n11), e11 = A3(t11, e11);
92143
+ e11 = j10(t11, e11);
92115
92144
  let i11 = "";
92116
92145
  for (; e11 < t11.length && !/\s/.test(t11[e11]); ) i11 += t11[e11], e11++;
92117
- if (!C3(i11)) throw new Error(`Invalid attribute name: "${i11}"`);
92118
- e11 = A3(t11, e11);
92146
+ D3(i11), e11 = j10(t11, e11);
92147
+ let n11 = "";
92148
+ for (; e11 < t11.length && !/\s/.test(t11[e11]); ) n11 += t11[e11], e11++;
92149
+ if (!D3(n11)) throw new Error(`Invalid attribute name: "${n11}"`);
92150
+ e11 = j10(t11, e11);
92119
92151
  let s11 = "";
92120
92152
  if ("NOTATION" === t11.substring(e11, e11 + 8).toUpperCase()) {
92121
- if (s11 = "NOTATION", "(" !== t11[e11 = A3(t11, e11 += 8)]) throw new Error(`Expected '(', found "${t11[e11]}"`);
92153
+ if (s11 = "NOTATION", "(" !== t11[e11 = j10(t11, e11 += 8)]) throw new Error(`Expected '(', found "${t11[e11]}"`);
92122
92154
  e11++;
92123
- let n12 = [];
92155
+ let i12 = [];
92124
92156
  for (; e11 < t11.length && ")" !== t11[e11]; ) {
92125
- let i12 = "";
92126
- for (; e11 < t11.length && "|" !== t11[e11] && ")" !== t11[e11]; ) i12 += t11[e11], e11++;
92127
- if (i12 = i12.trim(), !C3(i12)) throw new Error(`Invalid notation name: "${i12}"`);
92128
- n12.push(i12), "|" === t11[e11] && (e11++, e11 = A3(t11, e11));
92157
+ let n12 = "";
92158
+ for (; e11 < t11.length && "|" !== t11[e11] && ")" !== t11[e11]; ) n12 += t11[e11], e11++;
92159
+ if (n12 = n12.trim(), !D3(n12)) throw new Error(`Invalid notation name: "${n12}"`);
92160
+ i12.push(n12), "|" === t11[e11] && (e11++, e11 = j10(t11, e11));
92129
92161
  }
92130
92162
  if (")" !== t11[e11]) throw new Error("Unterminated list of notations");
92131
- e11++, s11 += " (" + n12.join("|") + ")";
92163
+ e11++, s11 += " (" + i12.join("|") + ")";
92132
92164
  } else {
92133
92165
  for (; e11 < t11.length && !/\s/.test(t11[e11]); ) s11 += t11[e11], e11++;
92134
- const n12 = ["CDATA", "ID", "IDREF", "IDREFS", "ENTITY", "ENTITIES", "NMTOKEN", "NMTOKENS"];
92135
- if (!this.suppressValidationErr && !n12.includes(s11.toUpperCase())) throw new Error(`Invalid attribute type: "${s11}"`);
92166
+ const i12 = ["CDATA", "ID", "IDREF", "IDREFS", "ENTITY", "ENTITIES", "NMTOKEN", "NMTOKENS"];
92167
+ if (!this.suppressValidationErr && !i12.includes(s11.toUpperCase())) throw new Error(`Invalid attribute type: "${s11}"`);
92136
92168
  }
92137
- e11 = A3(t11, e11);
92169
+ e11 = j10(t11, e11);
92138
92170
  let r11 = "";
92139
- return "#REQUIRED" === t11.substring(e11, e11 + 8).toUpperCase() ? (r11 = "#REQUIRED", e11 += 8) : "#IMPLIED" === t11.substring(e11, e11 + 7).toUpperCase() ? (r11 = "#IMPLIED", e11 += 7) : [e11, r11] = this.readIdentifierVal(t11, e11, "ATTLIST"), { elementName: n11, attributeName: i11, attributeType: s11, defaultValue: r11, index: e11 };
92171
+ return "#REQUIRED" === t11.substring(e11, e11 + 8).toUpperCase() ? (r11 = "#REQUIRED", e11 += 8) : "#IMPLIED" === t11.substring(e11, e11 + 7).toUpperCase() ? (r11 = "#IMPLIED", e11 += 7) : [e11, r11] = this.readIdentifierVal(t11, e11, "ATTLIST"), { elementName: i11, attributeName: n11, attributeType: s11, defaultValue: r11, index: e11 };
92140
92172
  }
92141
92173
  }
92142
- const A3 = /* @__PURE__ */ __name((t11, e11) => {
92174
+ const j10 = /* @__PURE__ */ __name((t11, e11) => {
92143
92175
  for (; e11 < t11.length && /\s/.test(t11[e11]); ) e11++;
92144
92176
  return e11;
92145
- }, "A");
92146
- function S(t11, e11, n11) {
92147
- for (let i11 = 0; i11 < e11.length; i11++) if (e11[i11] !== t11[n11 + i11 + 1]) return false;
92177
+ }, "j");
92178
+ function _2(t11, e11, i11) {
92179
+ for (let n11 = 0; n11 < e11.length; n11++) if (e11[n11] !== t11[i11 + n11 + 1]) return false;
92148
92180
  return true;
92149
92181
  }
92150
- __name(S, "S");
92151
- function C3(t11) {
92182
+ __name(_2, "_");
92183
+ function D3(t11) {
92152
92184
  if (r10(t11)) return t11;
92153
92185
  throw new Error(`Invalid entity name ${t11}`);
92154
92186
  }
92155
- __name(C3, "C");
92156
- const $ = /^[-+]?0x[a-fA-F0-9]+$/, V = /^([\-\+])?(0*)([0-9]*(\.[0-9]*)?)$/, D3 = { hex: true, leadingZeros: true, decimalPoint: ".", eNotation: true };
92157
- const j10 = /^([-+])?(0*)(\d*(\.\d*)?[eE][-\+]?\d+)$/;
92158
- class L {
92187
+ __name(D3, "D");
92188
+ const V = /^[-+]?0x[a-fA-F0-9]+$/, k10 = /^([\-\+])?(0*)([0-9]*(\.[0-9]*)?)$/, F3 = { hex: true, leadingZeros: true, decimalPoint: ".", eNotation: true };
92189
+ const L = /^([-+])?(0*)(\d*(\.\d*)?[eE][-\+]?\d+)$/;
92190
+ class M {
92159
92191
  static {
92160
- __name(this, "L");
92192
+ __name(this, "M");
92193
+ }
92194
+ constructor(t11 = {}) {
92195
+ this.separator = t11.separator || ".", this.path = [], this.siblingStacks = [];
92196
+ }
92197
+ push(t11, e11 = null, i11 = null) {
92198
+ this.path.length > 0 && (this.path[this.path.length - 1].values = void 0);
92199
+ const n11 = this.path.length;
92200
+ this.siblingStacks[n11] || (this.siblingStacks[n11] = /* @__PURE__ */ new Map());
92201
+ const s11 = this.siblingStacks[n11], r11 = i11 ? `${i11}:${t11}` : t11, o11 = s11.get(r11) || 0;
92202
+ let a11 = 0;
92203
+ for (const t12 of s11.values()) a11 += t12;
92204
+ s11.set(r11, o11 + 1);
92205
+ const h11 = { tag: t11, position: a11, counter: o11 };
92206
+ null != i11 && (h11.namespace = i11), null != e11 && (h11.values = e11), this.path.push(h11);
92207
+ }
92208
+ pop() {
92209
+ if (0 === this.path.length) return;
92210
+ const t11 = this.path.pop();
92211
+ return this.siblingStacks.length > this.path.length + 1 && (this.siblingStacks.length = this.path.length + 1), t11;
92212
+ }
92213
+ updateCurrent(t11) {
92214
+ if (this.path.length > 0) {
92215
+ const e11 = this.path[this.path.length - 1];
92216
+ null != t11 && (e11.values = t11);
92217
+ }
92218
+ }
92219
+ getCurrentTag() {
92220
+ return this.path.length > 0 ? this.path[this.path.length - 1].tag : void 0;
92221
+ }
92222
+ getCurrentNamespace() {
92223
+ return this.path.length > 0 ? this.path[this.path.length - 1].namespace : void 0;
92224
+ }
92225
+ getAttrValue(t11) {
92226
+ if (0 === this.path.length) return;
92227
+ const e11 = this.path[this.path.length - 1];
92228
+ return e11.values?.[t11];
92229
+ }
92230
+ hasAttr(t11) {
92231
+ if (0 === this.path.length) return false;
92232
+ const e11 = this.path[this.path.length - 1];
92233
+ return void 0 !== e11.values && t11 in e11.values;
92234
+ }
92235
+ getPosition() {
92236
+ return 0 === this.path.length ? -1 : this.path[this.path.length - 1].position ?? 0;
92237
+ }
92238
+ getCounter() {
92239
+ return 0 === this.path.length ? -1 : this.path[this.path.length - 1].counter ?? 0;
92240
+ }
92241
+ getIndex() {
92242
+ return this.getPosition();
92243
+ }
92244
+ getDepth() {
92245
+ return this.path.length;
92246
+ }
92247
+ toString(t11, e11 = true) {
92248
+ const i11 = t11 || this.separator;
92249
+ return this.path.map((t12) => e11 && t12.namespace ? `${t12.namespace}:${t12.tag}` : t12.tag).join(i11);
92250
+ }
92251
+ toArray() {
92252
+ return this.path.map((t11) => t11.tag);
92253
+ }
92254
+ reset() {
92255
+ this.path = [], this.siblingStacks = [];
92256
+ }
92257
+ matches(t11) {
92258
+ const e11 = t11.segments;
92259
+ return 0 !== e11.length && (t11.hasDeepWildcard() ? this._matchWithDeepWildcard(e11) : this._matchSimple(e11));
92260
+ }
92261
+ _matchSimple(t11) {
92262
+ if (this.path.length !== t11.length) return false;
92263
+ for (let e11 = 0; e11 < t11.length; e11++) {
92264
+ const i11 = t11[e11], n11 = this.path[e11], s11 = e11 === this.path.length - 1;
92265
+ if (!this._matchSegment(i11, n11, s11)) return false;
92266
+ }
92267
+ return true;
92268
+ }
92269
+ _matchWithDeepWildcard(t11) {
92270
+ let e11 = this.path.length - 1, i11 = t11.length - 1;
92271
+ for (; i11 >= 0 && e11 >= 0; ) {
92272
+ const n11 = t11[i11];
92273
+ if ("deep-wildcard" === n11.type) {
92274
+ if (i11--, i11 < 0) return true;
92275
+ const n12 = t11[i11];
92276
+ let s11 = false;
92277
+ for (let t12 = e11; t12 >= 0; t12--) {
92278
+ const r11 = t12 === this.path.length - 1;
92279
+ if (this._matchSegment(n12, this.path[t12], r11)) {
92280
+ e11 = t12 - 1, i11--, s11 = true;
92281
+ break;
92282
+ }
92283
+ }
92284
+ if (!s11) return false;
92285
+ } else {
92286
+ const t12 = e11 === this.path.length - 1;
92287
+ if (!this._matchSegment(n11, this.path[e11], t12)) return false;
92288
+ e11--, i11--;
92289
+ }
92290
+ }
92291
+ return i11 < 0;
92292
+ }
92293
+ _matchSegment(t11, e11, i11) {
92294
+ if ("*" !== t11.tag && t11.tag !== e11.tag) return false;
92295
+ if (void 0 !== t11.namespace && "*" !== t11.namespace && t11.namespace !== e11.namespace) return false;
92296
+ if (void 0 !== t11.attrName) {
92297
+ if (!i11) return false;
92298
+ if (!e11.values || !(t11.attrName in e11.values)) return false;
92299
+ if (void 0 !== t11.attrValue) {
92300
+ const i12 = e11.values[t11.attrName];
92301
+ if (String(i12) !== String(t11.attrValue)) return false;
92302
+ }
92303
+ }
92304
+ if (void 0 !== t11.position) {
92305
+ if (!i11) return false;
92306
+ const n11 = e11.counter ?? 0;
92307
+ if ("first" === t11.position && 0 !== n11) return false;
92308
+ if ("odd" === t11.position && n11 % 2 != 1) return false;
92309
+ if ("even" === t11.position && n11 % 2 != 0) return false;
92310
+ if ("nth" === t11.position && n11 !== t11.positionValue) return false;
92311
+ }
92312
+ return true;
92313
+ }
92314
+ snapshot() {
92315
+ return { path: this.path.map((t11) => ({ ...t11 })), siblingStacks: this.siblingStacks.map((t11) => new Map(t11)) };
92316
+ }
92317
+ restore(t11) {
92318
+ this.path = t11.path.map((t12) => ({ ...t12 })), this.siblingStacks = t11.siblingStacks.map((t12) => new Map(t12));
92319
+ }
92320
+ }
92321
+ class G3 {
92322
+ static {
92323
+ __name(this, "G");
92324
+ }
92325
+ constructor(t11, e11 = {}) {
92326
+ this.pattern = t11, this.separator = e11.separator || ".", this.segments = this._parse(t11), this._hasDeepWildcard = this.segments.some((t12) => "deep-wildcard" === t12.type), this._hasAttributeCondition = this.segments.some((t12) => void 0 !== t12.attrName), this._hasPositionSelector = this.segments.some((t12) => void 0 !== t12.position);
92327
+ }
92328
+ _parse(t11) {
92329
+ const e11 = [];
92330
+ let i11 = 0, n11 = "";
92331
+ for (; i11 < t11.length; ) t11[i11] === this.separator ? i11 + 1 < t11.length && t11[i11 + 1] === this.separator ? (n11.trim() && (e11.push(this._parseSegment(n11.trim())), n11 = ""), e11.push({ type: "deep-wildcard" }), i11 += 2) : (n11.trim() && e11.push(this._parseSegment(n11.trim())), n11 = "", i11++) : (n11 += t11[i11], i11++);
92332
+ return n11.trim() && e11.push(this._parseSegment(n11.trim())), e11;
92333
+ }
92334
+ _parseSegment(t11) {
92335
+ const e11 = { type: "tag" };
92336
+ let i11 = null, n11 = t11;
92337
+ const s11 = t11.match(/^([^\[]+)(\[[^\]]*\])(.*)$/);
92338
+ if (s11 && (n11 = s11[1] + s11[3], s11[2])) {
92339
+ const t12 = s11[2].slice(1, -1);
92340
+ t12 && (i11 = t12);
92341
+ }
92342
+ let r11, o11, a11 = n11;
92343
+ if (n11.includes("::")) {
92344
+ const e12 = n11.indexOf("::");
92345
+ if (r11 = n11.substring(0, e12).trim(), a11 = n11.substring(e12 + 2).trim(), !r11) throw new Error(`Invalid namespace in pattern: ${t11}`);
92346
+ }
92347
+ let h11 = null;
92348
+ if (a11.includes(":")) {
92349
+ const t12 = a11.lastIndexOf(":"), e12 = a11.substring(0, t12).trim(), i12 = a11.substring(t12 + 1).trim();
92350
+ ["first", "last", "odd", "even"].includes(i12) || /^nth\(\d+\)$/.test(i12) ? (o11 = e12, h11 = i12) : o11 = a11;
92351
+ } else o11 = a11;
92352
+ if (!o11) throw new Error(`Invalid segment pattern: ${t11}`);
92353
+ if (e11.tag = o11, r11 && (e11.namespace = r11), i11) if (i11.includes("=")) {
92354
+ const t12 = i11.indexOf("=");
92355
+ e11.attrName = i11.substring(0, t12).trim(), e11.attrValue = i11.substring(t12 + 1).trim();
92356
+ } else e11.attrName = i11.trim();
92357
+ if (h11) {
92358
+ const t12 = h11.match(/^nth\((\d+)\)$/);
92359
+ t12 ? (e11.position = "nth", e11.positionValue = parseInt(t12[1], 10)) : e11.position = h11;
92360
+ }
92361
+ return e11;
92362
+ }
92363
+ get length() {
92364
+ return this.segments.length;
92365
+ }
92366
+ hasDeepWildcard() {
92367
+ return this._hasDeepWildcard;
92368
+ }
92369
+ hasAttributeCondition() {
92370
+ return this._hasAttributeCondition;
92371
+ }
92372
+ hasPositionSelector() {
92373
+ return this._hasPositionSelector;
92374
+ }
92375
+ toString() {
92376
+ return this.pattern;
92377
+ }
92378
+ }
92379
+ function R(t11, e11) {
92380
+ if (!t11) return {};
92381
+ const i11 = e11.attributesGroupName ? t11[e11.attributesGroupName] : t11;
92382
+ if (!i11) return {};
92383
+ const n11 = {};
92384
+ for (const t12 in i11) t12.startsWith(e11.attributeNamePrefix) ? n11[t12.substring(e11.attributeNamePrefix.length)] = i11[t12] : n11[t12] = i11[t12];
92385
+ return n11;
92386
+ }
92387
+ __name(R, "R");
92388
+ function U(t11) {
92389
+ if (!t11 || "string" != typeof t11) return;
92390
+ const e11 = t11.indexOf(":");
92391
+ if (-1 !== e11 && e11 > 0) {
92392
+ const i11 = t11.substring(0, e11);
92393
+ if ("xmlns" !== i11) return i11;
92394
+ }
92395
+ }
92396
+ __name(U, "U");
92397
+ class B3 {
92398
+ static {
92399
+ __name(this, "B");
92161
92400
  }
92162
92401
  constructor(t11) {
92163
92402
  var e11;
92164
- if (this.options = t11, 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: /* @__PURE__ */ __name((t12, e12) => K(e12, 10, "&#"), "val") }, num_hex: { regex: /&#x([0-9a-fA-F]{1,6});/g, val: /* @__PURE__ */ __name((t12, e12) => K(e12, 16, "&#x"), "val") } }, this.addExternalEntities = F3, this.parseXml = R, this.parseTextData = M, this.resolveNameSpace = k10, this.buildAttributesMap = U, this.isItStopNode = X, this.replaceEntitiesValue = Y, this.readStopNodeData = q10, this.saveTextToParentTag = G3, this.addChild = B3, this.ignoreAttributesFn = "function" == typeof (e11 = this.options.ignoreAttributes) ? e11 : Array.isArray(e11) ? (t12) => {
92165
- for (const n11 of e11) {
92166
- if ("string" == typeof n11 && t12 === n11) return true;
92167
- if (n11 instanceof RegExp && n11.test(t12)) return true;
92403
+ if (this.options = t11, 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: /* @__PURE__ */ __name((t12, e12) => st(e12, 10, "&#"), "val") }, num_hex: { regex: /&#x([0-9a-fA-F]{1,6});/g, val: /* @__PURE__ */ __name((t12, e12) => st(e12, 16, "&#x"), "val") } }, this.addExternalEntities = W, this.parseXml = Z, this.parseTextData = Y, this.resolveNameSpace = X, this.buildAttributesMap = q10, this.isItStopNode = H3, this.replaceEntitiesValue = K, this.readStopNodeData = it, this.saveTextToParentTag = Q, this.addChild = J3, this.ignoreAttributesFn = "function" == typeof (e11 = this.options.ignoreAttributes) ? e11 : Array.isArray(e11) ? (t12) => {
92404
+ for (const i11 of e11) {
92405
+ if ("string" == typeof i11 && t12 === i11) return true;
92406
+ if (i11 instanceof RegExp && i11.test(t12)) return true;
92168
92407
  }
92169
- } : () => false, this.entityExpansionCount = 0, this.currentExpandedLength = 0, this.options.stopNodes && this.options.stopNodes.length > 0) {
92170
- this.stopNodesExact = /* @__PURE__ */ new Set(), this.stopNodesWildcard = /* @__PURE__ */ new Set();
92408
+ } : () => false, this.entityExpansionCount = 0, this.currentExpandedLength = 0, this.matcher = new M(), this.isCurrentNodeStopNode = false, this.options.stopNodes && this.options.stopNodes.length > 0) {
92409
+ this.stopNodeExpressions = [];
92171
92410
  for (let t12 = 0; t12 < this.options.stopNodes.length; t12++) {
92172
92411
  const e12 = this.options.stopNodes[t12];
92173
- "string" == typeof e12 && (e12.startsWith("*.") ? this.stopNodesWildcard.add(e12.substring(2)) : this.stopNodesExact.add(e12));
92412
+ "string" == typeof e12 ? this.stopNodeExpressions.push(new G3(e12)) : e12 instanceof G3 && this.stopNodeExpressions.push(e12);
92174
92413
  }
92175
92414
  }
92176
92415
  }
92177
92416
  }
92178
- function F3(t11) {
92417
+ function W(t11) {
92179
92418
  const e11 = Object.keys(t11);
92180
- for (let n11 = 0; n11 < e11.length; n11++) {
92181
- const i11 = e11[n11], s11 = i11.replace(/[.\-+*:]/g, "\\.");
92182
- this.lastEntities[i11] = { regex: new RegExp("&" + s11 + ";", "g"), val: t11[i11] };
92419
+ for (let i11 = 0; i11 < e11.length; i11++) {
92420
+ const n11 = e11[i11], s11 = n11.replace(/[.\-+*:]/g, "\\.");
92421
+ this.lastEntities[n11] = { regex: new RegExp("&" + s11 + ";", "g"), val: t11[n11] };
92183
92422
  }
92184
92423
  }
92185
- __name(F3, "F");
92186
- function M(t11, e11, n11, i11, s11, r11, o11) {
92187
- if (void 0 !== t11 && (this.options.trimValues && !i11 && (t11 = t11.trim()), t11.length > 0)) {
92188
- o11 || (t11 = this.replaceEntitiesValue(t11, e11, n11));
92189
- const i12 = this.options.tagValueProcessor(e11, t11, n11, s11, r11);
92190
- return null == i12 ? t11 : typeof i12 != typeof t11 || i12 !== t11 ? i12 : this.options.trimValues || t11.trim() === t11 ? Z(t11, this.options.parseTagValue, this.options.numberParseOptions) : t11;
92424
+ __name(W, "W");
92425
+ function Y(t11, e11, i11, n11, s11, r11, o11) {
92426
+ if (void 0 !== t11 && (this.options.trimValues && !n11 && (t11 = t11.trim()), t11.length > 0)) {
92427
+ o11 || (t11 = this.replaceEntitiesValue(t11, e11, i11));
92428
+ const n12 = this.options.jPath ? i11.toString() : i11, a11 = this.options.tagValueProcessor(e11, t11, n12, s11, r11);
92429
+ return null == a11 ? t11 : typeof a11 != typeof t11 || a11 !== t11 ? a11 : this.options.trimValues || t11.trim() === t11 ? nt(t11, this.options.parseTagValue, this.options.numberParseOptions) : t11;
92191
92430
  }
92192
92431
  }
92193
- __name(M, "M");
92194
- function k10(t11) {
92432
+ __name(Y, "Y");
92433
+ function X(t11) {
92195
92434
  if (this.options.removeNSPrefix) {
92196
- const e11 = t11.split(":"), n11 = "/" === t11.charAt(0) ? "/" : "";
92435
+ const e11 = t11.split(":"), i11 = "/" === t11.charAt(0) ? "/" : "";
92197
92436
  if ("xmlns" === e11[0]) return "";
92198
- 2 === e11.length && (t11 = n11 + e11[1]);
92437
+ 2 === e11.length && (t11 = i11 + e11[1]);
92199
92438
  }
92200
92439
  return t11;
92201
92440
  }
92202
- __name(k10, "k");
92203
- const _2 = new RegExp(`([^\\s=]+)\\s*(=\\s*(['"])([\\s\\S]*?)\\3)?`, "gm");
92204
- function U(t11, e11, n11) {
92441
+ __name(X, "X");
92442
+ const z4 = new RegExp(`([^\\s=]+)\\s*(=\\s*(['"])([\\s\\S]*?)\\3)?`, "gm");
92443
+ function q10(t11, e11, i11) {
92205
92444
  if (true !== this.options.ignoreAttributes && "string" == typeof t11) {
92206
- const i11 = s10(t11, _2), r11 = i11.length, o11 = {};
92445
+ const n11 = s10(t11, z4), r11 = n11.length, o11 = {}, a11 = {};
92207
92446
  for (let t12 = 0; t12 < r11; t12++) {
92208
- const s11 = this.resolveNameSpace(i11[t12][1]);
92209
- if (this.ignoreAttributesFn(s11, e11)) continue;
92210
- let r12 = i11[t12][4], a11 = this.options.attributeNamePrefix + s11;
92211
- if (s11.length) if (this.options.transformAttributeName && (a11 = this.options.transformAttributeName(a11)), "__proto__" === a11 && (a11 = "#__proto__"), void 0 !== r12) {
92212
- this.options.trimValues && (r12 = r12.trim()), r12 = this.replaceEntitiesValue(r12, n11, e11);
92213
- const t13 = this.options.attributeValueProcessor(s11, r12, e11);
92214
- o11[a11] = null == t13 ? r12 : typeof t13 != typeof r12 || t13 !== r12 ? t13 : Z(r12, this.options.parseAttributeValue, this.options.numberParseOptions);
92215
- } else this.options.allowBooleanAttributes && (o11[a11] = true);
92447
+ const s11 = this.resolveNameSpace(n11[t12][1]), r12 = n11[t12][4];
92448
+ if (s11.length && void 0 !== r12) {
92449
+ let t13 = r12;
92450
+ this.options.trimValues && (t13 = t13.trim()), t13 = this.replaceEntitiesValue(t13, i11, e11), a11[s11] = t13;
92451
+ }
92452
+ }
92453
+ Object.keys(a11).length > 0 && "object" == typeof e11 && e11.updateCurrent && e11.updateCurrent(a11);
92454
+ for (let t12 = 0; t12 < r11; t12++) {
92455
+ const s11 = this.resolveNameSpace(n11[t12][1]), r12 = this.options.jPath ? e11.toString() : e11;
92456
+ if (this.ignoreAttributesFn(s11, r12)) continue;
92457
+ let a12 = n11[t12][4], h11 = this.options.attributeNamePrefix + s11;
92458
+ if (s11.length) if (this.options.transformAttributeName && (h11 = this.options.transformAttributeName(h11)), h11 = ot(h11, this.options), void 0 !== a12) {
92459
+ this.options.trimValues && (a12 = a12.trim()), a12 = this.replaceEntitiesValue(a12, i11, e11);
92460
+ const t13 = this.options.jPath ? e11.toString() : e11, n12 = this.options.attributeValueProcessor(s11, a12, t13);
92461
+ o11[h11] = null == n12 ? a12 : typeof n12 != typeof a12 || n12 !== a12 ? n12 : nt(a12, this.options.parseAttributeValue, this.options.numberParseOptions);
92462
+ } else this.options.allowBooleanAttributes && (o11[h11] = true);
92216
92463
  }
92217
92464
  if (!Object.keys(o11).length) return;
92218
92465
  if (this.options.attributesGroupName) {
@@ -92222,307 +92469,346 @@ var require_fxp = __commonJS({
92222
92469
  return o11;
92223
92470
  }
92224
92471
  }
92225
- __name(U, "U");
92226
- const R = /* @__PURE__ */ __name(function(t11) {
92472
+ __name(q10, "q");
92473
+ const Z = /* @__PURE__ */ __name(function(t11) {
92227
92474
  t11 = t11.replace(/\r\n?/g, "\n");
92228
- const e11 = new I3("!xml");
92229
- let n11 = e11, i11 = "", s11 = "";
92230
- this.entityExpansionCount = 0, this.currentExpandedLength = 0;
92231
- const r11 = new P(this.options.processEntities);
92232
- for (let o11 = 0; o11 < t11.length; o11++) if ("<" === t11[o11]) if ("/" === t11[o11 + 1]) {
92233
- const e12 = z4(t11, ">", o11, "Closing Tag is not closed.");
92234
- let r12 = t11.substring(o11 + 2, e12).trim();
92475
+ const e11 = new $("!xml");
92476
+ let i11 = e11, n11 = "";
92477
+ this.matcher.reset(), this.entityExpansionCount = 0, this.currentExpandedLength = 0;
92478
+ const s11 = new I3(this.options.processEntities);
92479
+ for (let r11 = 0; r11 < t11.length; r11++) if ("<" === t11[r11]) if ("/" === t11[r11 + 1]) {
92480
+ const e12 = tt(t11, ">", r11, "Closing Tag is not closed.");
92481
+ let s12 = t11.substring(r11 + 2, e12).trim();
92235
92482
  if (this.options.removeNSPrefix) {
92236
- const t12 = r12.indexOf(":");
92237
- -1 !== t12 && (r12 = r12.substr(t12 + 1));
92238
- }
92239
- this.options.transformTagName && (r12 = this.options.transformTagName(r12)), n11 && (i11 = this.saveTextToParentTag(i11, n11, s11));
92240
- const a11 = s11.substring(s11.lastIndexOf(".") + 1);
92241
- if (r12 && -1 !== this.options.unpairedTags.indexOf(r12)) throw new Error(`Unpaired tag can not be used as closing tag: </${r12}>`);
92242
- let l11 = 0;
92243
- a11 && -1 !== this.options.unpairedTags.indexOf(a11) ? (l11 = s11.lastIndexOf(".", s11.lastIndexOf(".") - 1), this.tagsNodeStack.pop()) : l11 = s11.lastIndexOf("."), s11 = s11.substring(0, l11), n11 = this.tagsNodeStack.pop(), i11 = "", o11 = e12;
92244
- } else if ("?" === t11[o11 + 1]) {
92245
- let e12 = W(t11, o11, false, "?>");
92483
+ const t12 = s12.indexOf(":");
92484
+ -1 !== t12 && (s12 = s12.substr(t12 + 1));
92485
+ }
92486
+ s12 = rt(this.options.transformTagName, s12, "", this.options).tagName, i11 && (n11 = this.saveTextToParentTag(n11, i11, this.matcher));
92487
+ const o11 = this.matcher.getCurrentTag();
92488
+ if (s12 && -1 !== this.options.unpairedTags.indexOf(s12)) throw new Error(`Unpaired tag can not be used as closing tag: </${s12}>`);
92489
+ o11 && -1 !== this.options.unpairedTags.indexOf(o11) && (this.matcher.pop(), this.tagsNodeStack.pop()), this.matcher.pop(), this.isCurrentNodeStopNode = false, i11 = this.tagsNodeStack.pop(), n11 = "", r11 = e12;
92490
+ } else if ("?" === t11[r11 + 1]) {
92491
+ let e12 = et(t11, r11, false, "?>");
92246
92492
  if (!e12) throw new Error("Pi Tag is not closed.");
92247
- if (i11 = this.saveTextToParentTag(i11, n11, s11), this.options.ignoreDeclaration && "?xml" === e12.tagName || this.options.ignorePiTags) ;
92493
+ if (n11 = this.saveTextToParentTag(n11, i11, this.matcher), this.options.ignoreDeclaration && "?xml" === e12.tagName || this.options.ignorePiTags) ;
92248
92494
  else {
92249
- const t12 = new I3(e12.tagName);
92250
- t12.add(this.options.textNodeName, ""), e12.tagName !== e12.tagExp && e12.attrExpPresent && (t12[":@"] = this.buildAttributesMap(e12.tagExp, s11, e12.tagName)), this.addChild(n11, t12, s11, o11);
92495
+ const t12 = new $(e12.tagName);
92496
+ t12.add(this.options.textNodeName, ""), e12.tagName !== e12.tagExp && e12.attrExpPresent && (t12[":@"] = this.buildAttributesMap(e12.tagExp, this.matcher, e12.tagName)), this.addChild(i11, t12, this.matcher, r11);
92251
92497
  }
92252
- o11 = e12.closeIndex + 1;
92253
- } else if ("!--" === t11.substr(o11 + 1, 3)) {
92254
- const e12 = z4(t11, "-->", o11 + 4, "Comment is not closed.");
92498
+ r11 = e12.closeIndex + 1;
92499
+ } else if ("!--" === t11.substr(r11 + 1, 3)) {
92500
+ const e12 = tt(t11, "-->", r11 + 4, "Comment is not closed.");
92255
92501
  if (this.options.commentPropName) {
92256
- const r12 = t11.substring(o11 + 4, e12 - 2);
92257
- i11 = this.saveTextToParentTag(i11, n11, s11), n11.add(this.options.commentPropName, [{ [this.options.textNodeName]: r12 }]);
92258
- }
92259
- o11 = e12;
92260
- } else if ("!D" === t11.substr(o11 + 1, 2)) {
92261
- const e12 = r11.readDocType(t11, o11);
92262
- this.docTypeEntities = e12.entities, o11 = e12.i;
92263
- } else if ("![" === t11.substr(o11 + 1, 2)) {
92264
- const e12 = z4(t11, "]]>", o11, "CDATA is not closed.") - 2, r12 = t11.substring(o11 + 9, e12);
92265
- i11 = this.saveTextToParentTag(i11, n11, s11);
92266
- let a11 = this.parseTextData(r12, n11.tagname, s11, true, false, true, true);
92267
- null == a11 && (a11 = ""), this.options.cdataPropName ? n11.add(this.options.cdataPropName, [{ [this.options.textNodeName]: r12 }]) : n11.add(this.options.textNodeName, a11), o11 = e12 + 2;
92502
+ const s12 = t11.substring(r11 + 4, e12 - 2);
92503
+ n11 = this.saveTextToParentTag(n11, i11, this.matcher), i11.add(this.options.commentPropName, [{ [this.options.textNodeName]: s12 }]);
92504
+ }
92505
+ r11 = e12;
92506
+ } else if ("!D" === t11.substr(r11 + 1, 2)) {
92507
+ const e12 = s11.readDocType(t11, r11);
92508
+ this.docTypeEntities = e12.entities, r11 = e12.i;
92509
+ } else if ("![" === t11.substr(r11 + 1, 2)) {
92510
+ const e12 = tt(t11, "]]>", r11, "CDATA is not closed.") - 2, s12 = t11.substring(r11 + 9, e12);
92511
+ n11 = this.saveTextToParentTag(n11, i11, this.matcher);
92512
+ let o11 = this.parseTextData(s12, i11.tagname, this.matcher, true, false, true, true);
92513
+ null == o11 && (o11 = ""), this.options.cdataPropName ? i11.add(this.options.cdataPropName, [{ [this.options.textNodeName]: s12 }]) : i11.add(this.options.textNodeName, o11), r11 = e12 + 2;
92268
92514
  } else {
92269
- let r12 = W(t11, o11, this.options.removeNSPrefix), a11 = r12.tagName;
92270
- const l11 = r12.rawTagName;
92271
- let u11 = r12.tagExp, d11 = r12.attrExpPresent, h11 = r12.closeIndex;
92272
- if (this.options.transformTagName) {
92273
- const t12 = this.options.transformTagName(a11);
92274
- u11 === a11 && (u11 = t12), a11 = t12;
92275
- }
92276
- if (this.options.strictReservedNames && (a11 === this.options.commentPropName || a11 === this.options.cdataPropName)) throw new Error(`Invalid tag name: ${a11}`);
92277
- n11 && i11 && "!xml" !== n11.tagname && (i11 = this.saveTextToParentTag(i11, n11, s11, false));
92278
- const p11 = n11;
92279
- p11 && -1 !== this.options.unpairedTags.indexOf(p11.tagname) && (n11 = this.tagsNodeStack.pop(), s11 = s11.substring(0, s11.lastIndexOf("."))), a11 !== e11.tagname && (s11 += s11 ? "." + a11 : a11);
92280
- const c11 = o11;
92281
- if (this.isItStopNode(this.stopNodesExact, this.stopNodesWildcard, s11, a11)) {
92515
+ let s12 = et(t11, r11, this.options.removeNSPrefix);
92516
+ if (!s12) {
92517
+ const e12 = t11.substring(Math.max(0, r11 - 50), Math.min(t11.length, r11 + 50));
92518
+ throw new Error(`readTagExp returned undefined at position ${r11}. Context: "${e12}"`);
92519
+ }
92520
+ let o11 = s12.tagName;
92521
+ const a11 = s12.rawTagName;
92522
+ let h11 = s12.tagExp, l11 = s12.attrExpPresent, p11 = s12.closeIndex;
92523
+ if ({ tagName: o11, tagExp: h11 } = rt(this.options.transformTagName, o11, h11, this.options), this.options.strictReservedNames && (o11 === this.options.commentPropName || o11 === this.options.cdataPropName)) throw new Error(`Invalid tag name: ${o11}`);
92524
+ i11 && n11 && "!xml" !== i11.tagname && (n11 = this.saveTextToParentTag(n11, i11, this.matcher, false));
92525
+ const u11 = i11;
92526
+ u11 && -1 !== this.options.unpairedTags.indexOf(u11.tagname) && (i11 = this.tagsNodeStack.pop(), this.matcher.pop());
92527
+ let c11 = false;
92528
+ h11.length > 0 && h11.lastIndexOf("/") === h11.length - 1 && (c11 = true, "/" === o11[o11.length - 1] ? (o11 = o11.substr(0, o11.length - 1), h11 = o11) : h11 = h11.substr(0, h11.length - 1), l11 = o11 !== h11);
92529
+ let d11, f11 = null, g11 = {};
92530
+ d11 = U(a11), o11 !== e11.tagname && this.matcher.push(o11, {}, d11), o11 !== h11 && l11 && (f11 = this.buildAttributesMap(h11, this.matcher, o11), f11 && (g11 = R(f11, this.options))), o11 !== e11.tagname && (this.isCurrentNodeStopNode = this.isItStopNode(this.stopNodeExpressions, this.matcher));
92531
+ const m11 = r11;
92532
+ if (this.isCurrentNodeStopNode) {
92282
92533
  let e12 = "";
92283
- if (u11.length > 0 && u11.lastIndexOf("/") === u11.length - 1) "/" === a11[a11.length - 1] ? (a11 = a11.substr(0, a11.length - 1), s11 = s11.substr(0, s11.length - 1), u11 = a11) : u11 = u11.substr(0, u11.length - 1), o11 = r12.closeIndex;
92284
- else if (-1 !== this.options.unpairedTags.indexOf(a11)) o11 = r12.closeIndex;
92534
+ if (c11) r11 = s12.closeIndex;
92535
+ else if (-1 !== this.options.unpairedTags.indexOf(o11)) r11 = s12.closeIndex;
92285
92536
  else {
92286
- const n12 = this.readStopNodeData(t11, l11, h11 + 1);
92287
- if (!n12) throw new Error(`Unexpected end of ${l11}`);
92288
- o11 = n12.i, e12 = n12.tagContent;
92537
+ const i12 = this.readStopNodeData(t11, a11, p11 + 1);
92538
+ if (!i12) throw new Error(`Unexpected end of ${a11}`);
92539
+ r11 = i12.i, e12 = i12.tagContent;
92289
92540
  }
92290
- const i12 = new I3(a11);
92291
- a11 !== u11 && d11 && (i12[":@"] = this.buildAttributesMap(u11, s11, a11)), e12 && (e12 = this.parseTextData(e12, a11, s11, true, d11, true, true)), s11 = s11.substr(0, s11.lastIndexOf(".")), i12.add(this.options.textNodeName, e12), this.addChild(n11, i12, s11, c11);
92541
+ const n12 = new $(o11);
92542
+ f11 && (n12[":@"] = f11), n12.add(this.options.textNodeName, e12), this.matcher.pop(), this.isCurrentNodeStopNode = false, this.addChild(i11, n12, this.matcher, m11);
92292
92543
  } else {
92293
- if (u11.length > 0 && u11.lastIndexOf("/") === u11.length - 1) {
92294
- if ("/" === a11[a11.length - 1] ? (a11 = a11.substr(0, a11.length - 1), s11 = s11.substr(0, s11.length - 1), u11 = a11) : u11 = u11.substr(0, u11.length - 1), this.options.transformTagName) {
92295
- const t13 = this.options.transformTagName(a11);
92296
- u11 === a11 && (u11 = t13), a11 = t13;
92297
- }
92298
- const t12 = new I3(a11);
92299
- a11 !== u11 && d11 && (t12[":@"] = this.buildAttributesMap(u11, s11, a11)), this.addChild(n11, t12, s11, c11), s11 = s11.substr(0, s11.lastIndexOf("."));
92544
+ if (c11) {
92545
+ ({ tagName: o11, tagExp: h11 } = rt(this.options.transformTagName, o11, h11, this.options));
92546
+ const t12 = new $(o11);
92547
+ f11 && (t12[":@"] = f11), this.addChild(i11, t12, this.matcher, m11), this.matcher.pop(), this.isCurrentNodeStopNode = false;
92300
92548
  } else {
92301
- if (-1 !== this.options.unpairedTags.indexOf(a11)) {
92302
- const t12 = new I3(a11);
92303
- a11 !== u11 && d11 && (t12[":@"] = this.buildAttributesMap(u11, s11)), this.addChild(n11, t12, s11, c11), s11 = s11.substr(0, s11.lastIndexOf(".")), o11 = r12.closeIndex;
92549
+ if (-1 !== this.options.unpairedTags.indexOf(o11)) {
92550
+ const t12 = new $(o11);
92551
+ f11 && (t12[":@"] = f11), this.addChild(i11, t12, this.matcher, m11), this.matcher.pop(), this.isCurrentNodeStopNode = false, r11 = s12.closeIndex;
92304
92552
  continue;
92305
92553
  }
92306
92554
  {
92307
- const t12 = new I3(a11);
92555
+ const t12 = new $(o11);
92308
92556
  if (this.tagsNodeStack.length > this.options.maxNestedTags) throw new Error("Maximum nested tags exceeded");
92309
- this.tagsNodeStack.push(n11), a11 !== u11 && d11 && (t12[":@"] = this.buildAttributesMap(u11, s11, a11)), this.addChild(n11, t12, s11, c11), n11 = t12;
92557
+ this.tagsNodeStack.push(i11), f11 && (t12[":@"] = f11), this.addChild(i11, t12, this.matcher, m11), i11 = t12;
92310
92558
  }
92311
92559
  }
92312
- i11 = "", o11 = h11;
92560
+ n11 = "", r11 = p11;
92313
92561
  }
92314
92562
  }
92315
- else i11 += t11[o11];
92563
+ else n11 += t11[r11];
92316
92564
  return e11.child;
92317
- }, "R");
92318
- function B3(t11, e11, n11, i11) {
92319
- this.options.captureMetaData || (i11 = void 0);
92320
- const s11 = this.options.updateTag(e11.tagname, n11, e11[":@"]);
92321
- false === s11 || ("string" == typeof s11 ? (e11.tagname = s11, t11.addChild(e11, i11)) : t11.addChild(e11, i11));
92322
- }
92323
- __name(B3, "B");
92324
- const Y = /* @__PURE__ */ __name(function(t11, e11, n11) {
92325
- if (-1 === t11.indexOf("&")) return t11;
92326
- const i11 = this.options.processEntities;
92327
- if (!i11.enabled) return t11;
92328
- if (i11.allowedTags && !i11.allowedTags.includes(e11)) return t11;
92329
- if (i11.tagFilter && !i11.tagFilter(e11, n11)) return t11;
92330
- for (let e12 in this.docTypeEntities) {
92331
- const n12 = this.docTypeEntities[e12], s11 = t11.match(n12.regx);
92565
+ }, "Z");
92566
+ function J3(t11, e11, i11, n11) {
92567
+ this.options.captureMetaData || (n11 = void 0);
92568
+ const s11 = this.options.jPath ? i11.toString() : i11, r11 = this.options.updateTag(e11.tagname, s11, e11[":@"]);
92569
+ false === r11 || ("string" == typeof r11 ? (e11.tagname = r11, t11.addChild(e11, n11)) : t11.addChild(e11, n11));
92570
+ }
92571
+ __name(J3, "J");
92572
+ function K(t11, e11, i11) {
92573
+ const n11 = this.options.processEntities;
92574
+ if (!n11 || !n11.enabled) return t11;
92575
+ if (n11.allowedTags) {
92576
+ const s11 = this.options.jPath ? i11.toString() : i11;
92577
+ if (!(Array.isArray(n11.allowedTags) ? n11.allowedTags.includes(e11) : n11.allowedTags(e11, s11))) return t11;
92578
+ }
92579
+ if (n11.tagFilter) {
92580
+ const s11 = this.options.jPath ? i11.toString() : i11;
92581
+ if (!n11.tagFilter(e11, s11)) return t11;
92582
+ }
92583
+ for (const e12 of Object.keys(this.docTypeEntities)) {
92584
+ const i12 = this.docTypeEntities[e12], s11 = t11.match(i12.regx);
92332
92585
  if (s11) {
92333
- if (this.entityExpansionCount += s11.length, i11.maxTotalExpansions && this.entityExpansionCount > i11.maxTotalExpansions) throw new Error(`Entity expansion limit exceeded: ${this.entityExpansionCount} > ${i11.maxTotalExpansions}`);
92586
+ if (this.entityExpansionCount += s11.length, n11.maxTotalExpansions && this.entityExpansionCount > n11.maxTotalExpansions) throw new Error(`Entity expansion limit exceeded: ${this.entityExpansionCount} > ${n11.maxTotalExpansions}`);
92334
92587
  const e13 = t11.length;
92335
- if (t11 = t11.replace(n12.regx, n12.val), i11.maxExpandedLength && (this.currentExpandedLength += t11.length - e13, this.currentExpandedLength > i11.maxExpandedLength)) throw new Error(`Total expanded content size exceeded: ${this.currentExpandedLength} > ${i11.maxExpandedLength}`);
92588
+ if (t11 = t11.replace(i12.regx, i12.val), n11.maxExpandedLength && (this.currentExpandedLength += t11.length - e13, this.currentExpandedLength > n11.maxExpandedLength)) throw new Error(`Total expanded content size exceeded: ${this.currentExpandedLength} > ${n11.maxExpandedLength}`);
92336
92589
  }
92337
92590
  }
92338
- if (-1 === t11.indexOf("&")) return t11;
92339
- for (let e12 in this.lastEntities) {
92340
- const n12 = this.lastEntities[e12];
92341
- t11 = t11.replace(n12.regex, n12.val);
92591
+ for (const e12 of Object.keys(this.lastEntities)) {
92592
+ const i12 = this.lastEntities[e12], s11 = t11.match(i12.regex);
92593
+ if (s11 && (this.entityExpansionCount += s11.length, n11.maxTotalExpansions && this.entityExpansionCount > n11.maxTotalExpansions)) throw new Error(`Entity expansion limit exceeded: ${this.entityExpansionCount} > ${n11.maxTotalExpansions}`);
92594
+ t11 = t11.replace(i12.regex, i12.val);
92342
92595
  }
92343
92596
  if (-1 === t11.indexOf("&")) return t11;
92344
- if (this.options.htmlEntities) for (let e12 in this.htmlEntities) {
92345
- const n12 = this.htmlEntities[e12];
92346
- t11 = t11.replace(n12.regex, n12.val);
92597
+ if (this.options.htmlEntities) for (const e12 of Object.keys(this.htmlEntities)) {
92598
+ const i12 = this.htmlEntities[e12], s11 = t11.match(i12.regex);
92599
+ if (s11 && (this.entityExpansionCount += s11.length, n11.maxTotalExpansions && this.entityExpansionCount > n11.maxTotalExpansions)) throw new Error(`Entity expansion limit exceeded: ${this.entityExpansionCount} > ${n11.maxTotalExpansions}`);
92600
+ t11 = t11.replace(i12.regex, i12.val);
92347
92601
  }
92348
92602
  return t11.replace(this.ampEntity.regex, this.ampEntity.val);
92349
- }, "Y");
92350
- function G3(t11, e11, n11, i11) {
92351
- return t11 && (void 0 === i11 && (i11 = 0 === e11.child.length), void 0 !== (t11 = this.parseTextData(t11, e11.tagname, n11, false, !!e11[":@"] && 0 !== Object.keys(e11[":@"]).length, i11)) && "" !== t11 && e11.add(this.options.textNodeName, t11), t11 = ""), t11;
92352
92603
  }
92353
- __name(G3, "G");
92354
- function X(t11, e11, n11, i11) {
92355
- return !(!e11 || !e11.has(i11)) || !(!t11 || !t11.has(n11));
92604
+ __name(K, "K");
92605
+ function Q(t11, e11, i11, n11) {
92606
+ return t11 && (void 0 === n11 && (n11 = 0 === e11.child.length), void 0 !== (t11 = this.parseTextData(t11, e11.tagname, i11, false, !!e11[":@"] && 0 !== Object.keys(e11[":@"]).length, n11)) && "" !== t11 && e11.add(this.options.textNodeName, t11), t11 = ""), t11;
92356
92607
  }
92357
- __name(X, "X");
92358
- function z4(t11, e11, n11, i11) {
92359
- const s11 = t11.indexOf(e11, n11);
92360
- if (-1 === s11) throw new Error(i11);
92608
+ __name(Q, "Q");
92609
+ function H3(t11, e11) {
92610
+ if (!t11 || 0 === t11.length) return false;
92611
+ for (let i11 = 0; i11 < t11.length; i11++) if (e11.matches(t11[i11])) return true;
92612
+ return false;
92613
+ }
92614
+ __name(H3, "H");
92615
+ function tt(t11, e11, i11, n11) {
92616
+ const s11 = t11.indexOf(e11, i11);
92617
+ if (-1 === s11) throw new Error(n11);
92361
92618
  return s11 + e11.length - 1;
92362
92619
  }
92363
- __name(z4, "z");
92364
- function W(t11, e11, n11, i11 = ">") {
92365
- const s11 = (function(t12, e12, n12 = ">") {
92366
- let i12, s12 = "";
92620
+ __name(tt, "tt");
92621
+ function et(t11, e11, i11, n11 = ">") {
92622
+ const s11 = (function(t12, e12, i12 = ">") {
92623
+ let n12, s12 = "";
92367
92624
  for (let r12 = e12; r12 < t12.length; r12++) {
92368
92625
  let e13 = t12[r12];
92369
- if (i12) e13 === i12 && (i12 = "");
92370
- else if ('"' === e13 || "'" === e13) i12 = e13;
92371
- else if (e13 === n12[0]) {
92372
- if (!n12[1]) return { data: s12, index: r12 };
92373
- if (t12[r12 + 1] === n12[1]) return { data: s12, index: r12 };
92626
+ if (n12) e13 === n12 && (n12 = "");
92627
+ else if ('"' === e13 || "'" === e13) n12 = e13;
92628
+ else if (e13 === i12[0]) {
92629
+ if (!i12[1]) return { data: s12, index: r12 };
92630
+ if (t12[r12 + 1] === i12[1]) return { data: s12, index: r12 };
92374
92631
  } else " " === e13 && (e13 = " ");
92375
92632
  s12 += e13;
92376
92633
  }
92377
- })(t11, e11 + 1, i11);
92634
+ })(t11, e11 + 1, n11);
92378
92635
  if (!s11) return;
92379
92636
  let r11 = s11.data;
92380
92637
  const o11 = s11.index, a11 = r11.search(/\s/);
92381
- let l11 = r11, u11 = true;
92382
- -1 !== a11 && (l11 = r11.substring(0, a11), r11 = r11.substring(a11 + 1).trimStart());
92383
- const d11 = l11;
92384
- if (n11) {
92385
- const t12 = l11.indexOf(":");
92386
- -1 !== t12 && (l11 = l11.substr(t12 + 1), u11 = l11 !== s11.data.substr(t12 + 1));
92638
+ let h11 = r11, l11 = true;
92639
+ -1 !== a11 && (h11 = r11.substring(0, a11), r11 = r11.substring(a11 + 1).trimStart());
92640
+ const p11 = h11;
92641
+ if (i11) {
92642
+ const t12 = h11.indexOf(":");
92643
+ -1 !== t12 && (h11 = h11.substr(t12 + 1), l11 = h11 !== s11.data.substr(t12 + 1));
92387
92644
  }
92388
- return { tagName: l11, tagExp: r11, closeIndex: o11, attrExpPresent: u11, rawTagName: d11 };
92645
+ return { tagName: h11, tagExp: r11, closeIndex: o11, attrExpPresent: l11, rawTagName: p11 };
92389
92646
  }
92390
- __name(W, "W");
92391
- function q10(t11, e11, n11) {
92392
- const i11 = n11;
92647
+ __name(et, "et");
92648
+ function it(t11, e11, i11) {
92649
+ const n11 = i11;
92393
92650
  let s11 = 1;
92394
- for (; n11 < t11.length; n11++) if ("<" === t11[n11]) if ("/" === t11[n11 + 1]) {
92395
- const r11 = z4(t11, ">", n11, `${e11} is not closed`);
92396
- if (t11.substring(n11 + 2, r11).trim() === e11 && (s11--, 0 === s11)) return { tagContent: t11.substring(i11, n11), i: r11 };
92397
- n11 = r11;
92398
- } else if ("?" === t11[n11 + 1]) n11 = z4(t11, "?>", n11 + 1, "StopNode is not closed.");
92399
- else if ("!--" === t11.substr(n11 + 1, 3)) n11 = z4(t11, "-->", n11 + 3, "StopNode is not closed.");
92400
- else if ("![" === t11.substr(n11 + 1, 2)) n11 = z4(t11, "]]>", n11, "StopNode is not closed.") - 2;
92651
+ for (; i11 < t11.length; i11++) if ("<" === t11[i11]) if ("/" === t11[i11 + 1]) {
92652
+ const r11 = tt(t11, ">", i11, `${e11} is not closed`);
92653
+ if (t11.substring(i11 + 2, r11).trim() === e11 && (s11--, 0 === s11)) return { tagContent: t11.substring(n11, i11), i: r11 };
92654
+ i11 = r11;
92655
+ } else if ("?" === t11[i11 + 1]) i11 = tt(t11, "?>", i11 + 1, "StopNode is not closed.");
92656
+ else if ("!--" === t11.substr(i11 + 1, 3)) i11 = tt(t11, "-->", i11 + 3, "StopNode is not closed.");
92657
+ else if ("![" === t11.substr(i11 + 1, 2)) i11 = tt(t11, "]]>", i11, "StopNode is not closed.") - 2;
92401
92658
  else {
92402
- const i12 = W(t11, n11, ">");
92403
- i12 && ((i12 && i12.tagName) === e11 && "/" !== i12.tagExp[i12.tagExp.length - 1] && s11++, n11 = i12.closeIndex);
92659
+ const n12 = et(t11, i11, ">");
92660
+ n12 && ((n12 && n12.tagName) === e11 && "/" !== n12.tagExp[n12.tagExp.length - 1] && s11++, i11 = n12.closeIndex);
92404
92661
  }
92405
92662
  }
92406
- __name(q10, "q");
92407
- function Z(t11, e11, n11) {
92663
+ __name(it, "it");
92664
+ function nt(t11, e11, i11) {
92408
92665
  if (e11 && "string" == typeof t11) {
92409
92666
  const e12 = t11.trim();
92410
92667
  return "true" === e12 || "false" !== e12 && (function(t12, e13 = {}) {
92411
- if (e13 = Object.assign({}, D3, e13), !t12 || "string" != typeof t12) return t12;
92412
- let n12 = t12.trim();
92413
- if (void 0 !== e13.skipLike && e13.skipLike.test(n12)) return t12;
92668
+ if (e13 = Object.assign({}, F3, e13), !t12 || "string" != typeof t12) return t12;
92669
+ let i12 = t12.trim();
92670
+ if (void 0 !== e13.skipLike && e13.skipLike.test(i12)) return t12;
92414
92671
  if ("0" === t12) return 0;
92415
- if (e13.hex && $.test(n12)) return (function(t13) {
92672
+ if (e13.hex && V.test(i12)) return (function(t13) {
92416
92673
  if (parseInt) return parseInt(t13, 16);
92417
92674
  if (Number.parseInt) return Number.parseInt(t13, 16);
92418
92675
  if (window && window.parseInt) return window.parseInt(t13, 16);
92419
92676
  throw new Error("parseInt, Number.parseInt, window.parseInt are not supported");
92420
- })(n12);
92421
- if (n12.includes("e") || n12.includes("E")) return (function(t13, e14, n13) {
92422
- if (!n13.eNotation) return t13;
92423
- const i12 = e14.match(j10);
92424
- if (i12) {
92425
- let s11 = i12[1] || "";
92426
- const r11 = -1 === i12[3].indexOf("e") ? "E" : "e", o11 = i12[2], a11 = s11 ? t13[o11.length + 1] === r11 : t13[o11.length] === r11;
92427
- return o11.length > 1 && a11 ? t13 : 1 !== o11.length || !i12[3].startsWith(`.${r11}`) && i12[3][0] !== r11 ? n13.leadingZeros && !a11 ? (e14 = (i12[1] || "") + i12[3], Number(e14)) : t13 : Number(e14);
92677
+ })(i12);
92678
+ if (i12.includes("e") || i12.includes("E")) return (function(t13, e14, i13) {
92679
+ if (!i13.eNotation) return t13;
92680
+ const n12 = e14.match(L);
92681
+ if (n12) {
92682
+ let s11 = n12[1] || "";
92683
+ const r11 = -1 === n12[3].indexOf("e") ? "E" : "e", o11 = n12[2], a11 = s11 ? t13[o11.length + 1] === r11 : t13[o11.length] === r11;
92684
+ return o11.length > 1 && a11 ? t13 : 1 !== o11.length || !n12[3].startsWith(`.${r11}`) && n12[3][0] !== r11 ? i13.leadingZeros && !a11 ? (e14 = (n12[1] || "") + n12[3], Number(e14)) : t13 : Number(e14);
92428
92685
  }
92429
92686
  return t13;
92430
- })(t12, n12, e13);
92687
+ })(t12, i12, e13);
92431
92688
  {
92432
- const s11 = V.exec(n12);
92689
+ const s11 = k10.exec(i12);
92433
92690
  if (s11) {
92434
92691
  const r11 = s11[1] || "", o11 = s11[2];
92435
- let a11 = (i11 = s11[3]) && -1 !== i11.indexOf(".") ? ("." === (i11 = i11.replace(/0+$/, "")) ? i11 = "0" : "." === i11[0] ? i11 = "0" + i11 : "." === i11[i11.length - 1] && (i11 = i11.substring(0, i11.length - 1)), i11) : i11;
92436
- const l11 = r11 ? "." === t12[o11.length + 1] : "." === t12[o11.length];
92437
- if (!e13.leadingZeros && (o11.length > 1 || 1 === o11.length && !l11)) return t12;
92692
+ let a11 = (n11 = s11[3]) && -1 !== n11.indexOf(".") ? ("." === (n11 = n11.replace(/0+$/, "")) ? n11 = "0" : "." === n11[0] ? n11 = "0" + n11 : "." === n11[n11.length - 1] && (n11 = n11.substring(0, n11.length - 1)), n11) : n11;
92693
+ const h11 = r11 ? "." === t12[o11.length + 1] : "." === t12[o11.length];
92694
+ if (!e13.leadingZeros && (o11.length > 1 || 1 === o11.length && !h11)) return t12;
92438
92695
  {
92439
- const i12 = Number(n12), s12 = String(i12);
92440
- if (0 === i12) return i12;
92441
- if (-1 !== s12.search(/[eE]/)) return e13.eNotation ? i12 : t12;
92442
- if (-1 !== n12.indexOf(".")) return "0" === s12 || s12 === a11 || s12 === `${r11}${a11}` ? i12 : t12;
92443
- let l12 = o11 ? a11 : n12;
92444
- return o11 ? l12 === s12 || r11 + l12 === s12 ? i12 : t12 : l12 === s12 || l12 === r11 + s12 ? i12 : t12;
92696
+ const n12 = Number(i12), s12 = String(n12);
92697
+ if (0 === n12) return n12;
92698
+ if (-1 !== s12.search(/[eE]/)) return e13.eNotation ? n12 : t12;
92699
+ if (-1 !== i12.indexOf(".")) return "0" === s12 || s12 === a11 || s12 === `${r11}${a11}` ? n12 : t12;
92700
+ let h12 = o11 ? a11 : i12;
92701
+ return o11 ? h12 === s12 || r11 + h12 === s12 ? n12 : t12 : h12 === s12 || h12 === r11 + s12 ? n12 : t12;
92445
92702
  }
92446
92703
  }
92447
92704
  return t12;
92448
92705
  }
92449
- var i11;
92450
- })(t11, n11);
92706
+ var n11;
92707
+ })(t11, i11);
92451
92708
  }
92452
92709
  return void 0 !== t11 ? t11 : "";
92453
92710
  }
92454
- __name(Z, "Z");
92455
- function K(t11, e11, n11) {
92456
- const i11 = Number.parseInt(t11, e11);
92457
- return i11 >= 0 && i11 <= 1114111 ? String.fromCodePoint(i11) : n11 + t11 + ";";
92711
+ __name(nt, "nt");
92712
+ function st(t11, e11, i11) {
92713
+ const n11 = Number.parseInt(t11, e11);
92714
+ return n11 >= 0 && n11 <= 1114111 ? String.fromCodePoint(n11) : i11 + t11 + ";";
92458
92715
  }
92459
- __name(K, "K");
92460
- const Q = I3.getMetaDataSymbol();
92461
- function J3(t11, e11) {
92462
- return H3(t11, e11);
92716
+ __name(st, "st");
92717
+ function rt(t11, e11, i11, n11) {
92718
+ if (t11) {
92719
+ const n12 = t11(e11);
92720
+ i11 === e11 && (i11 = n12), e11 = n12;
92721
+ }
92722
+ return { tagName: e11 = ot(e11, n11), tagExp: i11 };
92463
92723
  }
92464
- __name(J3, "J");
92465
- function H3(t11, e11, n11) {
92466
- let i11;
92724
+ __name(rt, "rt");
92725
+ function ot(t11, e11) {
92726
+ if (a10.includes(t11)) throw new Error(`[SECURITY] Invalid name: "${t11}" is a reserved JavaScript keyword that could cause prototype pollution`);
92727
+ return o10.includes(t11) ? e11.onDangerousProperty(t11) : t11;
92728
+ }
92729
+ __name(ot, "ot");
92730
+ const at = $.getMetaDataSymbol();
92731
+ function ht(t11, e11) {
92732
+ if (!t11 || "object" != typeof t11) return {};
92733
+ if (!e11) return t11;
92734
+ const i11 = {};
92735
+ for (const n11 in t11) n11.startsWith(e11) ? i11[n11.substring(e11.length)] = t11[n11] : i11[n11] = t11[n11];
92736
+ return i11;
92737
+ }
92738
+ __name(ht, "ht");
92739
+ function lt(t11, e11, i11) {
92740
+ return pt(t11, e11, i11);
92741
+ }
92742
+ __name(lt, "lt");
92743
+ function pt(t11, e11, i11) {
92744
+ let n11;
92467
92745
  const s11 = {};
92468
92746
  for (let r11 = 0; r11 < t11.length; r11++) {
92469
- const o11 = t11[r11], a11 = tt(o11);
92470
- let l11 = "";
92471
- if (l11 = void 0 === n11 ? a11 : n11 + "." + a11, a11 === e11.textNodeName) void 0 === i11 ? i11 = o11[a11] : i11 += "" + o11[a11];
92747
+ const o11 = t11[r11], a11 = ut(o11);
92748
+ if (void 0 !== a11 && a11 !== e11.textNodeName) {
92749
+ const t12 = ht(o11[":@"] || {}, e11.attributeNamePrefix);
92750
+ i11.push(a11, t12);
92751
+ }
92752
+ if (a11 === e11.textNodeName) void 0 === n11 ? n11 = o11[a11] : n11 += "" + o11[a11];
92472
92753
  else {
92473
92754
  if (void 0 === a11) continue;
92474
92755
  if (o11[a11]) {
92475
- let t12 = H3(o11[a11], e11, l11);
92476
- const n12 = nt(t12, e11);
92477
- o11[":@"] ? et(t12, o11[":@"], l11, e11) : 1 !== Object.keys(t12).length || void 0 === t12[e11.textNodeName] || e11.alwaysCreateTextNode ? 0 === Object.keys(t12).length && (e11.alwaysCreateTextNode ? t12[e11.textNodeName] = "" : t12 = "") : t12 = t12[e11.textNodeName], void 0 !== o11[Q] && "object" == typeof t12 && null !== t12 && (t12[Q] = o11[Q]), void 0 !== s11[a11] && Object.prototype.hasOwnProperty.call(s11, a11) ? (Array.isArray(s11[a11]) || (s11[a11] = [s11[a11]]), s11[a11].push(t12)) : e11.isArray(a11, l11, n12) ? s11[a11] = [t12] : s11[a11] = t12;
92756
+ let t12 = pt(o11[a11], e11, i11);
92757
+ const n12 = dt(t12, e11);
92758
+ if (o11[":@"] ? ct(t12, o11[":@"], i11, e11) : 1 !== Object.keys(t12).length || void 0 === t12[e11.textNodeName] || e11.alwaysCreateTextNode ? 0 === Object.keys(t12).length && (e11.alwaysCreateTextNode ? t12[e11.textNodeName] = "" : t12 = "") : t12 = t12[e11.textNodeName], void 0 !== o11[at] && "object" == typeof t12 && null !== t12 && (t12[at] = o11[at]), void 0 !== s11[a11] && Object.prototype.hasOwnProperty.call(s11, a11)) Array.isArray(s11[a11]) || (s11[a11] = [s11[a11]]), s11[a11].push(t12);
92759
+ else {
92760
+ const r12 = e11.jPath ? i11.toString() : i11;
92761
+ e11.isArray(a11, r12, n12) ? s11[a11] = [t12] : s11[a11] = t12;
92762
+ }
92763
+ void 0 !== a11 && a11 !== e11.textNodeName && i11.pop();
92478
92764
  }
92479
92765
  }
92480
92766
  }
92481
- return "string" == typeof i11 ? i11.length > 0 && (s11[e11.textNodeName] = i11) : void 0 !== i11 && (s11[e11.textNodeName] = i11), s11;
92767
+ return "string" == typeof n11 ? n11.length > 0 && (s11[e11.textNodeName] = n11) : void 0 !== n11 && (s11[e11.textNodeName] = n11), s11;
92482
92768
  }
92483
- __name(H3, "H");
92484
- function tt(t11) {
92769
+ __name(pt, "pt");
92770
+ function ut(t11) {
92485
92771
  const e11 = Object.keys(t11);
92486
92772
  for (let t12 = 0; t12 < e11.length; t12++) {
92487
- const n11 = e11[t12];
92488
- if (":@" !== n11) return n11;
92773
+ const i11 = e11[t12];
92774
+ if (":@" !== i11) return i11;
92489
92775
  }
92490
92776
  }
92491
- __name(tt, "tt");
92492
- function et(t11, e11, n11, i11) {
92777
+ __name(ut, "ut");
92778
+ function ct(t11, e11, i11, n11) {
92493
92779
  if (e11) {
92494
92780
  const s11 = Object.keys(e11), r11 = s11.length;
92495
92781
  for (let o11 = 0; o11 < r11; o11++) {
92496
- const r12 = s11[o11];
92497
- i11.isArray(r12, n11 + "." + r12, true, true) ? t11[r12] = [e11[r12]] : t11[r12] = e11[r12];
92782
+ const r12 = s11[o11], a11 = r12.startsWith(n11.attributeNamePrefix) ? r12.substring(n11.attributeNamePrefix.length) : r12, h11 = n11.jPath ? i11.toString() + "." + a11 : i11;
92783
+ n11.isArray(r12, h11, true, true) ? t11[r12] = [e11[r12]] : t11[r12] = e11[r12];
92498
92784
  }
92499
92785
  }
92500
92786
  }
92501
- __name(et, "et");
92502
- function nt(t11, e11) {
92503
- const { textNodeName: n11 } = e11, i11 = Object.keys(t11).length;
92504
- return 0 === i11 || !(1 !== i11 || !t11[n11] && "boolean" != typeof t11[n11] && 0 !== t11[n11]);
92787
+ __name(ct, "ct");
92788
+ function dt(t11, e11) {
92789
+ const { textNodeName: i11 } = e11, n11 = Object.keys(t11).length;
92790
+ return 0 === n11 || !(1 !== n11 || !t11[i11] && "boolean" != typeof t11[i11] && 0 !== t11[i11]);
92505
92791
  }
92506
- __name(nt, "nt");
92507
- class it {
92792
+ __name(dt, "dt");
92793
+ class ft {
92508
92794
  static {
92509
- __name(this, "it");
92795
+ __name(this, "ft");
92510
92796
  }
92511
92797
  constructor(t11) {
92512
- this.externalEntities = {}, this.options = v11(t11);
92798
+ this.externalEntities = {}, this.options = C3(t11);
92513
92799
  }
92514
92800
  parse(t11, e11) {
92515
92801
  if ("string" != typeof t11 && t11.toString) t11 = t11.toString();
92516
92802
  else if ("string" != typeof t11) throw new Error("XML data is accepted in String or Bytes[] form.");
92517
92803
  if (e11) {
92518
92804
  true === e11 && (e11 = {});
92519
- const n12 = a10(t11, e11);
92520
- if (true !== n12) throw Error(`${n12.err.msg}:${n12.err.line}:${n12.err.col}`);
92805
+ const i12 = l10(t11, e11);
92806
+ if (true !== i12) throw Error(`${i12.err.msg}:${i12.err.line}:${i12.err.col}`);
92521
92807
  }
92522
- const n11 = new L(this.options);
92523
- n11.addExternalEntities(this.externalEntities);
92524
- const i11 = n11.parseXml(t11);
92525
- return this.options.preserveOrder || void 0 === i11 ? i11 : J3(i11, this.options);
92808
+ const i11 = new B3(this.options);
92809
+ i11.addExternalEntities(this.externalEntities);
92810
+ const n11 = i11.parseXml(t11);
92811
+ return this.options.preserveOrder || void 0 === n11 ? n11 : lt(n11, this.options, i11.matcher);
92526
92812
  }
92527
92813
  addEntity(t11, e11) {
92528
92814
  if (-1 !== e11.indexOf("&")) throw new Error("Entity value can't have '&'");
@@ -92531,182 +92817,318 @@ var require_fxp = __commonJS({
92531
92817
  this.externalEntities[t11] = e11;
92532
92818
  }
92533
92819
  static getMetaDataSymbol() {
92534
- return I3.getMetaDataSymbol();
92820
+ return $.getMetaDataSymbol();
92535
92821
  }
92536
92822
  }
92537
- function st(t11, e11) {
92538
- let n11 = "";
92539
- return e11.format && e11.indentBy.length > 0 && (n11 = "\n"), rt(t11, e11, "", n11);
92823
+ function gt(t11, e11) {
92824
+ let i11 = "";
92825
+ e11.format && e11.indentBy.length > 0 && (i11 = "\n");
92826
+ const n11 = [];
92827
+ if (e11.stopNodes && Array.isArray(e11.stopNodes)) for (let t12 = 0; t12 < e11.stopNodes.length; t12++) {
92828
+ const i12 = e11.stopNodes[t12];
92829
+ "string" == typeof i12 ? n11.push(new G3(i12)) : i12 instanceof G3 && n11.push(i12);
92830
+ }
92831
+ return mt(t11, e11, i11, new M(), n11);
92540
92832
  }
92541
- __name(st, "st");
92542
- function rt(t11, e11, n11, i11) {
92543
- let s11 = "", r11 = false;
92833
+ __name(gt, "gt");
92834
+ function mt(t11, e11, i11, n11, s11) {
92835
+ let r11 = "", o11 = false;
92836
+ if (e11.maxNestedTags && n11.getDepth() > e11.maxNestedTags) throw new Error("Maximum nested tags exceeded");
92544
92837
  if (!Array.isArray(t11)) {
92545
92838
  if (null != t11) {
92546
- let n12 = t11.toString();
92547
- return n12 = ut(n12, e11), n12;
92839
+ let i12 = t11.toString();
92840
+ return i12 = vt(i12, e11), i12;
92548
92841
  }
92549
92842
  return "";
92550
92843
  }
92551
- for (let o11 = 0; o11 < t11.length; o11++) {
92552
- const a11 = t11[o11], l11 = ot(a11);
92844
+ for (let a11 = 0; a11 < t11.length; a11++) {
92845
+ const h11 = t11[a11], l11 = Et(h11);
92553
92846
  if (void 0 === l11) continue;
92554
- let u11 = "";
92555
- if (u11 = 0 === n11.length ? l11 : `${n11}.${l11}`, l11 === e11.textNodeName) {
92556
- let t12 = a11[l11];
92557
- lt(u11, e11) || (t12 = e11.tagValueProcessor(l11, t12), t12 = ut(t12, e11)), r11 && (s11 += i11), s11 += t12, r11 = false;
92847
+ const p11 = xt(h11[":@"], e11);
92848
+ n11.push(l11, p11);
92849
+ const u11 = wt(n11, s11);
92850
+ if (l11 === e11.textNodeName) {
92851
+ let t12 = h11[l11];
92852
+ u11 || (t12 = e11.tagValueProcessor(l11, t12), t12 = vt(t12, e11)), o11 && (r11 += i11), r11 += t12, o11 = false, n11.pop();
92558
92853
  continue;
92559
92854
  }
92560
92855
  if (l11 === e11.cdataPropName) {
92561
- r11 && (s11 += i11), s11 += `<![CDATA[${a11[l11][0][e11.textNodeName]}]]>`, r11 = false;
92856
+ o11 && (r11 += i11), r11 += `<![CDATA[${h11[l11][0][e11.textNodeName]}]]>`, o11 = false, n11.pop();
92562
92857
  continue;
92563
92858
  }
92564
92859
  if (l11 === e11.commentPropName) {
92565
- s11 += i11 + `<!--${a11[l11][0][e11.textNodeName]}-->`, r11 = true;
92860
+ r11 += i11 + `<!--${h11[l11][0][e11.textNodeName]}-->`, o11 = true, n11.pop();
92566
92861
  continue;
92567
92862
  }
92568
92863
  if ("?" === l11[0]) {
92569
- const t12 = at(a11[":@"], e11), n12 = "?xml" === l11 ? "" : i11;
92570
- let o12 = a11[l11][0][e11.textNodeName];
92571
- o12 = 0 !== o12.length ? " " + o12 : "", s11 += n12 + `<${l11}${o12}${t12}?>`, r11 = true;
92864
+ const t12 = yt(h11[":@"], e11, u11), s12 = "?xml" === l11 ? "" : i11;
92865
+ let a12 = h11[l11][0][e11.textNodeName];
92866
+ a12 = 0 !== a12.length ? " " + a12 : "", r11 += s12 + `<${l11}${a12}${t12}?>`, o11 = true, n11.pop();
92572
92867
  continue;
92573
92868
  }
92574
- let d11 = i11;
92575
- "" !== d11 && (d11 += e11.indentBy);
92576
- const h11 = i11 + `<${l11}${at(a11[":@"], e11)}`, p11 = rt(a11[l11], e11, u11, d11);
92577
- -1 !== e11.unpairedTags.indexOf(l11) ? e11.suppressUnpairedNode ? s11 += h11 + ">" : s11 += h11 + "/>" : p11 && 0 !== p11.length || !e11.suppressEmptyNode ? p11 && p11.endsWith(">") ? s11 += h11 + `>${p11}${i11}</${l11}>` : (s11 += h11 + ">", p11 && "" !== i11 && (p11.includes("/>") || p11.includes("</")) ? s11 += i11 + e11.indentBy + p11 + i11 : s11 += p11, s11 += `</${l11}>`) : s11 += h11 + "/>", r11 = true;
92869
+ let c11 = i11;
92870
+ "" !== c11 && (c11 += e11.indentBy);
92871
+ const d11 = i11 + `<${l11}${yt(h11[":@"], e11, u11)}`;
92872
+ let f11;
92873
+ f11 = u11 ? Nt(h11[l11], e11) : mt(h11[l11], e11, c11, n11, s11), -1 !== e11.unpairedTags.indexOf(l11) ? e11.suppressUnpairedNode ? r11 += d11 + ">" : r11 += d11 + "/>" : f11 && 0 !== f11.length || !e11.suppressEmptyNode ? f11 && f11.endsWith(">") ? r11 += d11 + `>${f11}${i11}</${l11}>` : (r11 += d11 + ">", f11 && "" !== i11 && (f11.includes("/>") || f11.includes("</")) ? r11 += i11 + e11.indentBy + f11 + i11 : r11 += f11, r11 += `</${l11}>`) : r11 += d11 + "/>", o11 = true, n11.pop();
92874
+ }
92875
+ return r11;
92876
+ }
92877
+ __name(mt, "mt");
92878
+ function xt(t11, e11) {
92879
+ if (!t11 || e11.ignoreAttributes) return null;
92880
+ const i11 = {};
92881
+ let n11 = false;
92882
+ for (let s11 in t11) Object.prototype.hasOwnProperty.call(t11, s11) && (i11[s11.startsWith(e11.attributeNamePrefix) ? s11.substr(e11.attributeNamePrefix.length) : s11] = t11[s11], n11 = true);
92883
+ return n11 ? i11 : null;
92884
+ }
92885
+ __name(xt, "xt");
92886
+ function Nt(t11, e11) {
92887
+ if (!Array.isArray(t11)) return null != t11 ? t11.toString() : "";
92888
+ let i11 = "";
92889
+ for (let n11 = 0; n11 < t11.length; n11++) {
92890
+ const s11 = t11[n11], r11 = Et(s11);
92891
+ if (r11 === e11.textNodeName) i11 += s11[r11];
92892
+ else if (r11 === e11.cdataPropName) i11 += s11[r11][0][e11.textNodeName];
92893
+ else if (r11 === e11.commentPropName) i11 += s11[r11][0][e11.textNodeName];
92894
+ else {
92895
+ if (r11 && "?" === r11[0]) continue;
92896
+ if (r11) {
92897
+ const t12 = bt(s11[":@"], e11), n12 = Nt(s11[r11], e11);
92898
+ n12 && 0 !== n12.length ? i11 += `<${r11}${t12}>${n12}</${r11}>` : i11 += `<${r11}${t12}/>`;
92899
+ }
92900
+ }
92578
92901
  }
92579
- return s11;
92902
+ return i11;
92580
92903
  }
92581
- __name(rt, "rt");
92582
- function ot(t11) {
92904
+ __name(Nt, "Nt");
92905
+ function bt(t11, e11) {
92906
+ let i11 = "";
92907
+ if (t11 && !e11.ignoreAttributes) for (let n11 in t11) {
92908
+ if (!Object.prototype.hasOwnProperty.call(t11, n11)) continue;
92909
+ let s11 = t11[n11];
92910
+ true === s11 && e11.suppressBooleanAttributes ? i11 += ` ${n11.substr(e11.attributeNamePrefix.length)}` : i11 += ` ${n11.substr(e11.attributeNamePrefix.length)}="${s11}"`;
92911
+ }
92912
+ return i11;
92913
+ }
92914
+ __name(bt, "bt");
92915
+ function Et(t11) {
92583
92916
  const e11 = Object.keys(t11);
92584
- for (let n11 = 0; n11 < e11.length; n11++) {
92585
- const i11 = e11[n11];
92586
- if (Object.prototype.hasOwnProperty.call(t11, i11) && ":@" !== i11) return i11;
92917
+ for (let i11 = 0; i11 < e11.length; i11++) {
92918
+ const n11 = e11[i11];
92919
+ if (Object.prototype.hasOwnProperty.call(t11, n11) && ":@" !== n11) return n11;
92587
92920
  }
92588
92921
  }
92589
- __name(ot, "ot");
92590
- function at(t11, e11) {
92922
+ __name(Et, "Et");
92923
+ function yt(t11, e11, i11) {
92591
92924
  let n11 = "";
92592
- if (t11 && !e11.ignoreAttributes) for (let i11 in t11) {
92593
- if (!Object.prototype.hasOwnProperty.call(t11, i11)) continue;
92594
- let s11 = e11.attributeValueProcessor(i11, t11[i11]);
92595
- s11 = ut(s11, e11), true === s11 && e11.suppressBooleanAttributes ? n11 += ` ${i11.substr(e11.attributeNamePrefix.length)}` : n11 += ` ${i11.substr(e11.attributeNamePrefix.length)}="${s11}"`;
92925
+ if (t11 && !e11.ignoreAttributes) for (let s11 in t11) {
92926
+ if (!Object.prototype.hasOwnProperty.call(t11, s11)) continue;
92927
+ let r11;
92928
+ i11 ? r11 = t11[s11] : (r11 = e11.attributeValueProcessor(s11, t11[s11]), r11 = vt(r11, e11)), true === r11 && e11.suppressBooleanAttributes ? n11 += ` ${s11.substr(e11.attributeNamePrefix.length)}` : n11 += ` ${s11.substr(e11.attributeNamePrefix.length)}="${r11}"`;
92596
92929
  }
92597
92930
  return n11;
92598
92931
  }
92599
- __name(at, "at");
92600
- function lt(t11, e11) {
92601
- let n11 = (t11 = t11.substr(0, t11.length - e11.textNodeName.length - 1)).substr(t11.lastIndexOf(".") + 1);
92602
- for (let i11 in e11.stopNodes) if (e11.stopNodes[i11] === t11 || e11.stopNodes[i11] === "*." + n11) return true;
92932
+ __name(yt, "yt");
92933
+ function wt(t11, e11) {
92934
+ if (!e11 || 0 === e11.length) return false;
92935
+ for (let i11 = 0; i11 < e11.length; i11++) if (t11.matches(e11[i11])) return true;
92603
92936
  return false;
92604
92937
  }
92605
- __name(lt, "lt");
92606
- function ut(t11, e11) {
92607
- if (t11 && t11.length > 0 && e11.processEntities) for (let n11 = 0; n11 < e11.entities.length; n11++) {
92608
- const i11 = e11.entities[n11];
92609
- t11 = t11.replace(i11.regex, i11.val);
92938
+ __name(wt, "wt");
92939
+ function vt(t11, e11) {
92940
+ if (t11 && t11.length > 0 && e11.processEntities) for (let i11 = 0; i11 < e11.entities.length; i11++) {
92941
+ const n11 = e11.entities[i11];
92942
+ t11 = t11.replace(n11.regex, n11.val);
92610
92943
  }
92611
92944
  return t11;
92612
92945
  }
92613
- __name(ut, "ut");
92614
- const dt = { attributeNamePrefix: "@_", attributesGroupName: false, textNodeName: "#text", ignoreAttributes: true, cdataPropName: false, format: false, indentBy: " ", suppressEmptyNode: false, suppressUnpairedNode: true, suppressBooleanAttributes: true, tagValueProcessor: /* @__PURE__ */ __name(function(t11, e11) {
92946
+ __name(vt, "vt");
92947
+ const Tt = { attributeNamePrefix: "@_", attributesGroupName: false, textNodeName: "#text", ignoreAttributes: true, cdataPropName: false, format: false, indentBy: " ", suppressEmptyNode: false, suppressUnpairedNode: true, suppressBooleanAttributes: true, tagValueProcessor: /* @__PURE__ */ __name(function(t11, e11) {
92615
92948
  return e11;
92616
92949
  }, "tagValueProcessor"), attributeValueProcessor: /* @__PURE__ */ __name(function(t11, e11) {
92617
92950
  return e11;
92618
- }, "attributeValueProcessor"), 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 };
92619
- function ht(t11) {
92951
+ }, "attributeValueProcessor"), 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 };
92952
+ function Pt(t11) {
92953
+ if (this.options = Object.assign({}, Tt, t11), this.options.stopNodes && Array.isArray(this.options.stopNodes) && (this.options.stopNodes = this.options.stopNodes.map((t12) => "string" == typeof t12 && t12.startsWith("*.") ? ".." + t12.substring(2) : t12)), this.stopNodeExpressions = [], this.options.stopNodes && Array.isArray(this.options.stopNodes)) for (let t12 = 0; t12 < this.options.stopNodes.length; t12++) {
92954
+ const e12 = this.options.stopNodes[t12];
92955
+ "string" == typeof e12 ? this.stopNodeExpressions.push(new G3(e12)) : e12 instanceof G3 && this.stopNodeExpressions.push(e12);
92956
+ }
92620
92957
  var e11;
92621
- this.options = Object.assign({}, dt, t11), true === this.options.ignoreAttributes || this.options.attributesGroupName ? this.isAttribute = function() {
92958
+ true === this.options.ignoreAttributes || this.options.attributesGroupName ? this.isAttribute = function() {
92622
92959
  return false;
92623
92960
  } : (this.ignoreAttributesFn = "function" == typeof (e11 = this.options.ignoreAttributes) ? e11 : Array.isArray(e11) ? (t12) => {
92624
- for (const n11 of e11) {
92625
- if ("string" == typeof n11 && t12 === n11) return true;
92626
- if (n11 instanceof RegExp && n11.test(t12)) return true;
92961
+ for (const i11 of e11) {
92962
+ if ("string" == typeof i11 && t12 === i11) return true;
92963
+ if (i11 instanceof RegExp && i11.test(t12)) return true;
92627
92964
  }
92628
- } : () => false, this.attrPrefixLen = this.options.attributeNamePrefix.length, this.isAttribute = ft), this.processTextOrObjNode = pt, this.options.format ? (this.indentate = ct, this.tagEndChar = ">\n", this.newLine = "\n") : (this.indentate = function() {
92965
+ } : () => false, this.attrPrefixLen = this.options.attributeNamePrefix.length, this.isAttribute = Ct), this.processTextOrObjNode = St, this.options.format ? (this.indentate = At, this.tagEndChar = ">\n", this.newLine = "\n") : (this.indentate = function() {
92629
92966
  return "";
92630
92967
  }, this.tagEndChar = ">", this.newLine = "");
92631
92968
  }
92632
- __name(ht, "ht");
92633
- function pt(t11, e11, n11, i11) {
92634
- const s11 = this.j2x(t11, n11 + 1, i11.concat(e11));
92635
- return void 0 !== t11[this.options.textNodeName] && 1 === Object.keys(t11).length ? this.buildTextValNode(t11[this.options.textNodeName], e11, s11.attrStr, n11) : this.buildObjectNode(s11.val, e11, s11.attrStr, n11);
92969
+ __name(Pt, "Pt");
92970
+ function St(t11, e11, i11, n11) {
92971
+ const s11 = this.extractAttributes(t11);
92972
+ if (n11.push(e11, s11), this.checkStopNode(n11)) {
92973
+ const s12 = this.buildRawContent(t11), r12 = this.buildAttributesForStopNode(t11);
92974
+ return n11.pop(), this.buildObjectNode(s12, e11, r12, i11);
92975
+ }
92976
+ const r11 = this.j2x(t11, i11 + 1, n11);
92977
+ return n11.pop(), void 0 !== t11[this.options.textNodeName] && 1 === Object.keys(t11).length ? this.buildTextValNode(t11[this.options.textNodeName], e11, r11.attrStr, i11, n11) : this.buildObjectNode(r11.val, e11, r11.attrStr, i11);
92636
92978
  }
92637
- __name(pt, "pt");
92638
- function ct(t11) {
92979
+ __name(St, "St");
92980
+ function At(t11) {
92639
92981
  return this.options.indentBy.repeat(t11);
92640
92982
  }
92641
- __name(ct, "ct");
92642
- function ft(t11) {
92983
+ __name(At, "At");
92984
+ function Ct(t11) {
92643
92985
  return !(!t11.startsWith(this.options.attributeNamePrefix) || t11 === this.options.textNodeName) && t11.substr(this.attrPrefixLen);
92644
92986
  }
92645
- __name(ft, "ft");
92646
- ht.prototype.build = function(t11) {
92647
- return this.options.preserveOrder ? st(t11, this.options) : (Array.isArray(t11) && this.options.arrayNodeName && this.options.arrayNodeName.length > 1 && (t11 = { [this.options.arrayNodeName]: t11 }), this.j2x(t11, 0, []).val);
92648
- }, ht.prototype.j2x = function(t11, e11, n11) {
92649
- let i11 = "", s11 = "";
92650
- const r11 = n11.join(".");
92651
- for (let o11 in t11) if (Object.prototype.hasOwnProperty.call(t11, o11)) if (void 0 === t11[o11]) this.isAttribute(o11) && (s11 += "");
92652
- else if (null === t11[o11]) this.isAttribute(o11) || o11 === this.options.cdataPropName ? s11 += "" : "?" === o11[0] ? s11 += this.indentate(e11) + "<" + o11 + "?" + this.tagEndChar : s11 += this.indentate(e11) + "<" + o11 + "/" + this.tagEndChar;
92653
- else if (t11[o11] instanceof Date) s11 += this.buildTextValNode(t11[o11], o11, "", e11);
92654
- else if ("object" != typeof t11[o11]) {
92655
- const n12 = this.isAttribute(o11);
92656
- if (n12 && !this.ignoreAttributesFn(n12, r11)) i11 += this.buildAttrPairStr(n12, "" + t11[o11]);
92657
- else if (!n12) if (o11 === this.options.textNodeName) {
92658
- let e12 = this.options.tagValueProcessor(o11, "" + t11[o11]);
92987
+ __name(Ct, "Ct");
92988
+ Pt.prototype.build = function(t11) {
92989
+ if (this.options.preserveOrder) return gt(t11, this.options);
92990
+ {
92991
+ Array.isArray(t11) && this.options.arrayNodeName && this.options.arrayNodeName.length > 1 && (t11 = { [this.options.arrayNodeName]: t11 });
92992
+ const e11 = new M();
92993
+ return this.j2x(t11, 0, e11).val;
92994
+ }
92995
+ }, Pt.prototype.j2x = function(t11, e11, i11) {
92996
+ let n11 = "", s11 = "";
92997
+ if (this.options.maxNestedTags && i11.getDepth() >= this.options.maxNestedTags) throw new Error("Maximum nested tags exceeded");
92998
+ const r11 = this.options.jPath ? i11.toString() : i11, o11 = this.checkStopNode(i11);
92999
+ for (let a11 in t11) if (Object.prototype.hasOwnProperty.call(t11, a11)) if (void 0 === t11[a11]) this.isAttribute(a11) && (s11 += "");
93000
+ else if (null === t11[a11]) this.isAttribute(a11) || a11 === this.options.cdataPropName ? s11 += "" : "?" === a11[0] ? s11 += this.indentate(e11) + "<" + a11 + "?" + this.tagEndChar : s11 += this.indentate(e11) + "<" + a11 + "/" + this.tagEndChar;
93001
+ else if (t11[a11] instanceof Date) s11 += this.buildTextValNode(t11[a11], a11, "", e11, i11);
93002
+ else if ("object" != typeof t11[a11]) {
93003
+ const h11 = this.isAttribute(a11);
93004
+ if (h11 && !this.ignoreAttributesFn(h11, r11)) n11 += this.buildAttrPairStr(h11, "" + t11[a11], o11);
93005
+ else if (!h11) if (a11 === this.options.textNodeName) {
93006
+ let e12 = this.options.tagValueProcessor(a11, "" + t11[a11]);
92659
93007
  s11 += this.replaceEntitiesValue(e12);
92660
- } else s11 += this.buildTextValNode(t11[o11], o11, "", e11);
92661
- } else if (Array.isArray(t11[o11])) {
92662
- const i12 = t11[o11].length;
92663
- let r12 = "", a11 = "";
92664
- for (let l11 = 0; l11 < i12; l11++) {
92665
- const i13 = t11[o11][l11];
92666
- if (void 0 === i13) ;
92667
- else if (null === i13) "?" === o11[0] ? s11 += this.indentate(e11) + "<" + o11 + "?" + this.tagEndChar : s11 += this.indentate(e11) + "<" + o11 + "/" + this.tagEndChar;
92668
- else if ("object" == typeof i13) if (this.options.oneListGroup) {
92669
- const t12 = this.j2x(i13, e11 + 1, n11.concat(o11));
92670
- r12 += t12.val, this.options.attributesGroupName && i13.hasOwnProperty(this.options.attributesGroupName) && (a11 += t12.attrStr);
92671
- } else r12 += this.processTextOrObjNode(i13, o11, e11, n11);
93008
+ } else {
93009
+ i11.push(a11);
93010
+ const n12 = this.checkStopNode(i11);
93011
+ if (i11.pop(), n12) {
93012
+ const i12 = "" + t11[a11];
93013
+ s11 += "" === i12 ? this.indentate(e11) + "<" + a11 + this.closeTag(a11) + this.tagEndChar : this.indentate(e11) + "<" + a11 + ">" + i12 + "</" + a11 + this.tagEndChar;
93014
+ } else s11 += this.buildTextValNode(t11[a11], a11, "", e11, i11);
93015
+ }
93016
+ } else if (Array.isArray(t11[a11])) {
93017
+ const n12 = t11[a11].length;
93018
+ let r12 = "", o12 = "";
93019
+ for (let h11 = 0; h11 < n12; h11++) {
93020
+ const n13 = t11[a11][h11];
93021
+ if (void 0 === n13) ;
93022
+ else if (null === n13) "?" === a11[0] ? s11 += this.indentate(e11) + "<" + a11 + "?" + this.tagEndChar : s11 += this.indentate(e11) + "<" + a11 + "/" + this.tagEndChar;
93023
+ else if ("object" == typeof n13) if (this.options.oneListGroup) {
93024
+ i11.push(a11);
93025
+ const t12 = this.j2x(n13, e11 + 1, i11);
93026
+ i11.pop(), r12 += t12.val, this.options.attributesGroupName && n13.hasOwnProperty(this.options.attributesGroupName) && (o12 += t12.attrStr);
93027
+ } else r12 += this.processTextOrObjNode(n13, a11, e11, i11);
92672
93028
  else if (this.options.oneListGroup) {
92673
- let t12 = this.options.tagValueProcessor(o11, i13);
93029
+ let t12 = this.options.tagValueProcessor(a11, n13);
92674
93030
  t12 = this.replaceEntitiesValue(t12), r12 += t12;
92675
- } else r12 += this.buildTextValNode(i13, o11, "", e11);
92676
- }
92677
- this.options.oneListGroup && (r12 = this.buildObjectNode(r12, o11, a11, e11)), s11 += r12;
92678
- } else if (this.options.attributesGroupName && o11 === this.options.attributesGroupName) {
92679
- const e12 = Object.keys(t11[o11]), n12 = e12.length;
92680
- for (let s12 = 0; s12 < n12; s12++) i11 += this.buildAttrPairStr(e12[s12], "" + t11[o11][e12[s12]]);
92681
- } else s11 += this.processTextOrObjNode(t11[o11], o11, e11, n11);
92682
- return { attrStr: i11, val: s11 };
92683
- }, ht.prototype.buildAttrPairStr = function(t11, e11) {
92684
- return e11 = this.options.attributeValueProcessor(t11, "" + e11), e11 = this.replaceEntitiesValue(e11), this.options.suppressBooleanAttributes && "true" === e11 ? " " + t11 : " " + t11 + '="' + e11 + '"';
92685
- }, ht.prototype.buildObjectNode = function(t11, e11, n11, i11) {
92686
- if ("" === t11) return "?" === e11[0] ? this.indentate(i11) + "<" + e11 + n11 + "?" + this.tagEndChar : this.indentate(i11) + "<" + e11 + n11 + this.closeTag(e11) + this.tagEndChar;
93031
+ } else {
93032
+ i11.push(a11);
93033
+ const t12 = this.checkStopNode(i11);
93034
+ if (i11.pop(), t12) {
93035
+ const t13 = "" + n13;
93036
+ r12 += "" === t13 ? this.indentate(e11) + "<" + a11 + this.closeTag(a11) + this.tagEndChar : this.indentate(e11) + "<" + a11 + ">" + t13 + "</" + a11 + this.tagEndChar;
93037
+ } else r12 += this.buildTextValNode(n13, a11, "", e11, i11);
93038
+ }
93039
+ }
93040
+ this.options.oneListGroup && (r12 = this.buildObjectNode(r12, a11, o12, e11)), s11 += r12;
93041
+ } else if (this.options.attributesGroupName && a11 === this.options.attributesGroupName) {
93042
+ const e12 = Object.keys(t11[a11]), i12 = e12.length;
93043
+ for (let s12 = 0; s12 < i12; s12++) n11 += this.buildAttrPairStr(e12[s12], "" + t11[a11][e12[s12]], o11);
93044
+ } else s11 += this.processTextOrObjNode(t11[a11], a11, e11, i11);
93045
+ return { attrStr: n11, val: s11 };
93046
+ }, Pt.prototype.buildAttrPairStr = function(t11, e11, i11) {
93047
+ return i11 || (e11 = this.options.attributeValueProcessor(t11, "" + e11), e11 = this.replaceEntitiesValue(e11)), this.options.suppressBooleanAttributes && "true" === e11 ? " " + t11 : " " + t11 + '="' + e11 + '"';
93048
+ }, Pt.prototype.extractAttributes = function(t11) {
93049
+ if (!t11 || "object" != typeof t11) return null;
93050
+ const e11 = {};
93051
+ let i11 = false;
93052
+ if (this.options.attributesGroupName && t11[this.options.attributesGroupName]) {
93053
+ const n11 = t11[this.options.attributesGroupName];
93054
+ for (let t12 in n11) Object.prototype.hasOwnProperty.call(n11, t12) && (e11[t12.startsWith(this.options.attributeNamePrefix) ? t12.substring(this.options.attributeNamePrefix.length) : t12] = n11[t12], i11 = true);
93055
+ } else for (let n11 in t11) {
93056
+ if (!Object.prototype.hasOwnProperty.call(t11, n11)) continue;
93057
+ const s11 = this.isAttribute(n11);
93058
+ s11 && (e11[s11] = t11[n11], i11 = true);
93059
+ }
93060
+ return i11 ? e11 : null;
93061
+ }, Pt.prototype.buildRawContent = function(t11) {
93062
+ if ("string" == typeof t11) return t11;
93063
+ if ("object" != typeof t11 || null === t11) return String(t11);
93064
+ if (void 0 !== t11[this.options.textNodeName]) return t11[this.options.textNodeName];
93065
+ let e11 = "";
93066
+ for (let i11 in t11) {
93067
+ if (!Object.prototype.hasOwnProperty.call(t11, i11)) continue;
93068
+ if (this.isAttribute(i11)) continue;
93069
+ if (this.options.attributesGroupName && i11 === this.options.attributesGroupName) continue;
93070
+ const n11 = t11[i11];
93071
+ if (i11 === this.options.textNodeName) e11 += n11;
93072
+ else if (Array.isArray(n11)) {
93073
+ for (let t12 of n11) if ("string" == typeof t12 || "number" == typeof t12) e11 += `<${i11}>${t12}</${i11}>`;
93074
+ else if ("object" == typeof t12 && null !== t12) {
93075
+ const n12 = this.buildRawContent(t12), s11 = this.buildAttributesForStopNode(t12);
93076
+ e11 += "" === n12 ? `<${i11}${s11}/>` : `<${i11}${s11}>${n12}</${i11}>`;
93077
+ }
93078
+ } else if ("object" == typeof n11 && null !== n11) {
93079
+ const t12 = this.buildRawContent(n11), s11 = this.buildAttributesForStopNode(n11);
93080
+ e11 += "" === t12 ? `<${i11}${s11}/>` : `<${i11}${s11}>${t12}</${i11}>`;
93081
+ } else e11 += `<${i11}>${n11}</${i11}>`;
93082
+ }
93083
+ return e11;
93084
+ }, Pt.prototype.buildAttributesForStopNode = function(t11) {
93085
+ if (!t11 || "object" != typeof t11) return "";
93086
+ let e11 = "";
93087
+ if (this.options.attributesGroupName && t11[this.options.attributesGroupName]) {
93088
+ const i11 = t11[this.options.attributesGroupName];
93089
+ for (let t12 in i11) {
93090
+ if (!Object.prototype.hasOwnProperty.call(i11, t12)) continue;
93091
+ const n11 = t12.startsWith(this.options.attributeNamePrefix) ? t12.substring(this.options.attributeNamePrefix.length) : t12, s11 = i11[t12];
93092
+ true === s11 && this.options.suppressBooleanAttributes ? e11 += " " + n11 : e11 += " " + n11 + '="' + s11 + '"';
93093
+ }
93094
+ } else for (let i11 in t11) {
93095
+ if (!Object.prototype.hasOwnProperty.call(t11, i11)) continue;
93096
+ const n11 = this.isAttribute(i11);
93097
+ if (n11) {
93098
+ const s11 = t11[i11];
93099
+ true === s11 && this.options.suppressBooleanAttributes ? e11 += " " + n11 : e11 += " " + n11 + '="' + s11 + '"';
93100
+ }
93101
+ }
93102
+ return e11;
93103
+ }, Pt.prototype.buildObjectNode = function(t11, e11, i11, n11) {
93104
+ if ("" === t11) return "?" === e11[0] ? this.indentate(n11) + "<" + e11 + i11 + "?" + this.tagEndChar : this.indentate(n11) + "<" + e11 + i11 + this.closeTag(e11) + this.tagEndChar;
92687
93105
  {
92688
93106
  let s11 = "</" + e11 + this.tagEndChar, r11 = "";
92689
- return "?" === e11[0] && (r11 = "?", s11 = ""), !n11 && "" !== n11 || -1 !== t11.indexOf("<") ? false !== this.options.commentPropName && e11 === this.options.commentPropName && 0 === r11.length ? this.indentate(i11) + `<!--${t11}-->` + this.newLine : this.indentate(i11) + "<" + e11 + n11 + r11 + this.tagEndChar + t11 + this.indentate(i11) + s11 : this.indentate(i11) + "<" + e11 + n11 + r11 + ">" + t11 + s11;
93107
+ return "?" === e11[0] && (r11 = "?", s11 = ""), !i11 && "" !== i11 || -1 !== t11.indexOf("<") ? false !== this.options.commentPropName && e11 === this.options.commentPropName && 0 === r11.length ? this.indentate(n11) + `<!--${t11}-->` + this.newLine : this.indentate(n11) + "<" + e11 + i11 + r11 + this.tagEndChar + t11 + this.indentate(n11) + s11 : this.indentate(n11) + "<" + e11 + i11 + r11 + ">" + t11 + s11;
92690
93108
  }
92691
- }, ht.prototype.closeTag = function(t11) {
93109
+ }, Pt.prototype.closeTag = function(t11) {
92692
93110
  let e11 = "";
92693
93111
  return -1 !== this.options.unpairedTags.indexOf(t11) ? this.options.suppressUnpairedNode || (e11 = "/") : e11 = this.options.suppressEmptyNode ? "/" : `></${t11}`, e11;
92694
- }, ht.prototype.buildTextValNode = function(t11, e11, n11, i11) {
92695
- if (false !== this.options.cdataPropName && e11 === this.options.cdataPropName) return this.indentate(i11) + `<![CDATA[${t11}]]>` + this.newLine;
92696
- if (false !== this.options.commentPropName && e11 === this.options.commentPropName) return this.indentate(i11) + `<!--${t11}-->` + this.newLine;
92697
- if ("?" === e11[0]) return this.indentate(i11) + "<" + e11 + n11 + "?" + this.tagEndChar;
93112
+ }, Pt.prototype.checkStopNode = function(t11) {
93113
+ if (!this.stopNodeExpressions || 0 === this.stopNodeExpressions.length) return false;
93114
+ for (let e11 = 0; e11 < this.stopNodeExpressions.length; e11++) if (t11.matches(this.stopNodeExpressions[e11])) return true;
93115
+ return false;
93116
+ }, Pt.prototype.buildTextValNode = function(t11, e11, i11, n11, s11) {
93117
+ if (false !== this.options.cdataPropName && e11 === this.options.cdataPropName) return this.indentate(n11) + `<![CDATA[${t11}]]>` + this.newLine;
93118
+ if (false !== this.options.commentPropName && e11 === this.options.commentPropName) return this.indentate(n11) + `<!--${t11}-->` + this.newLine;
93119
+ if ("?" === e11[0]) return this.indentate(n11) + "<" + e11 + i11 + "?" + this.tagEndChar;
92698
93120
  {
92699
- let s11 = this.options.tagValueProcessor(e11, t11);
92700
- return s11 = this.replaceEntitiesValue(s11), "" === s11 ? this.indentate(i11) + "<" + e11 + n11 + this.closeTag(e11) + this.tagEndChar : this.indentate(i11) + "<" + e11 + n11 + ">" + s11 + "</" + e11 + this.tagEndChar;
93121
+ let s12 = this.options.tagValueProcessor(e11, t11);
93122
+ return s12 = this.replaceEntitiesValue(s12), "" === s12 ? this.indentate(n11) + "<" + e11 + i11 + this.closeTag(e11) + this.tagEndChar : this.indentate(n11) + "<" + e11 + i11 + ">" + s12 + "</" + e11 + this.tagEndChar;
92701
93123
  }
92702
- }, ht.prototype.replaceEntitiesValue = function(t11) {
93124
+ }, Pt.prototype.replaceEntitiesValue = function(t11) {
92703
93125
  if (t11 && t11.length > 0 && this.options.processEntities) for (let e11 = 0; e11 < this.options.entities.length; e11++) {
92704
- const n11 = this.options.entities[e11];
92705
- t11 = t11.replace(n11.regex, n11.val);
93126
+ const i11 = this.options.entities[e11];
93127
+ t11 = t11.replace(i11.regex, i11.val);
92706
93128
  }
92707
93129
  return t11;
92708
93130
  };
92709
- const gt = ht, xt = { validate: a10 };
93131
+ const Ot = Pt, $t = { validate: l10 };
92710
93132
  module2.exports = e10;
92711
93133
  })();
92712
93134
  }
@@ -92721,13 +93143,17 @@ var require_xml_parser = __commonJS({
92721
93143
  var fast_xml_parser_1 = require_fxp();
92722
93144
  var parser = new fast_xml_parser_1.XMLParser({
92723
93145
  attributeNamePrefix: "",
93146
+ processEntities: {
93147
+ enabled: true,
93148
+ maxTotalExpansions: Infinity
93149
+ },
92724
93150
  htmlEntities: true,
92725
93151
  ignoreAttributes: false,
92726
93152
  ignoreDeclaration: true,
92727
93153
  parseTagValue: false,
92728
93154
  trimValues: false,
92729
93155
  tagValueProcessor: /* @__PURE__ */ __name((_2, val) => val.trim() === "" && val.includes("\n") ? "" : void 0, "tagValueProcessor"),
92730
- maxNestedTags: 1024
93156
+ maxNestedTags: Infinity
92731
93157
  });
92732
93158
  parser.addEntity("#xD", "\r");
92733
93159
  parser.addEntity("#10", "\n");
@@ -92743,12 +93169,31 @@ var require_dist_cjs27 = __commonJS({
92743
93169
  "../../../node_modules/@aws-sdk/xml-builder/dist-cjs/index.js"(exports2) {
92744
93170
  "use strict";
92745
93171
  var xmlParser = require_xml_parser();
93172
+ var ATTR_ESCAPE_RE = /[&<>"]/g;
93173
+ var ATTR_ESCAPE_MAP = {
93174
+ "&": "&amp;",
93175
+ "<": "&lt;",
93176
+ ">": "&gt;",
93177
+ '"': "&quot;"
93178
+ };
92746
93179
  function escapeAttribute(value) {
92747
- return value.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;");
93180
+ return value.replace(ATTR_ESCAPE_RE, (ch) => ATTR_ESCAPE_MAP[ch]);
92748
93181
  }
92749
93182
  __name(escapeAttribute, "escapeAttribute");
93183
+ var ELEMENT_ESCAPE_RE = /[&"'<>\r\n\u0085\u2028]/g;
93184
+ var ELEMENT_ESCAPE_MAP = {
93185
+ "&": "&amp;",
93186
+ '"': "&quot;",
93187
+ "'": "&apos;",
93188
+ "<": "&lt;",
93189
+ ">": "&gt;",
93190
+ "\r": "&#x0D;",
93191
+ "\n": "&#x0A;",
93192
+ "\x85": "&#x85;",
93193
+ "\u2028": "&#x2028;"
93194
+ };
92750
93195
  function escapeElement(value) {
92751
- return value.replace(/&/g, "&amp;").replace(/"/g, "&quot;").replace(/'/g, "&apos;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/\r/g, "&#x0D;").replace(/\n/g, "&#x0A;").replace(/\u0085/g, "&#x85;").replace(/\u2028/, "&#x2028;");
93196
+ return value.replace(ELEMENT_ESCAPE_RE, (ch) => ELEMENT_ESCAPE_MAP[ch]);
92752
93197
  }
92753
93198
  __name(escapeElement, "escapeElement");
92754
93199
  var XmlText2 = class {
@@ -295027,7 +295472,7 @@ async function loadTree(assembly, trace3) {
295027
295472
  try {
295028
295473
  const outdir = assembly.directory;
295029
295474
  const fileName = assembly.tree()?.file;
295030
- return fileName ? fs17.readJSONSync(path13.join(outdir, fileName)).tree : {};
295475
+ return fileName ? fs17.readJSONSync(path13.join(outdir, fileName)).tree : void 0;
295031
295476
  } catch (e10) {
295032
295477
  await trace3(`Failed to get tree.json file: ${e10}. Proceeding with empty tree.`);
295033
295478
  return void 0;
@@ -300301,19 +300746,27 @@ function writeContextToEnv(env, context, completeness) {
300301
300746
  }
300302
300747
  };
300303
300748
  }
300304
- async function checkContextOverflowSupport(assembly, ioHelper) {
300305
- const traceFn = /* @__PURE__ */ __name((msg) => ioHelper.defaults.trace(msg), "traceFn");
300306
- const tree = await loadTree(assembly, traceFn);
300749
+ async function checkContextOverflowSupport(tree, ioHelper) {
300307
300750
  if (!frameworkSupportsContextOverflow(tree)) {
300308
300751
  await ioHelper.notify(IO.CDK_ASSEMBLY_W0010.msg("Part of the context could not be sent to the application. Please update the AWS CDK library to the latest version."));
300309
300752
  }
300310
300753
  }
300311
- function frameworkSupportsContextOverflow(tree) {
300312
- return !some(tree, (node) => {
300754
+ function findConstructLibraryVersion(tree) {
300755
+ let ret = void 0;
300756
+ some(tree, (node) => {
300313
300757
  const fqn = node.constructInfo?.fqn;
300314
300758
  const version = node.constructInfo?.version;
300315
- return fqn === "aws-cdk-lib.App" && version !== "0.0.0" && version != null && (0, import_semver.lte)(version, "2.38.0") || fqn === "@aws-cdk/core.App";
300759
+ if (fqn?.startsWith("aws-cdk-lib.") || fqn?.startsWith("@aws-cdk/core.")) {
300760
+ ret = version;
300761
+ return true;
300762
+ }
300763
+ return false;
300316
300764
  });
300765
+ return ret !== "0.0.0" ? ret : void 0;
300766
+ }
300767
+ function frameworkSupportsContextOverflow(tree) {
300768
+ const version = findConstructLibraryVersion(tree);
300769
+ return !version || !(0, import_semver.lte)(version, "2.38.0");
300317
300770
  }
300318
300771
  async function assemblyFromDirectory(assemblyDir, ioHelper, loadOptions = {}) {
300319
300772
  try {
@@ -300323,7 +300776,8 @@ async function assemblyFromDirectory(assemblyDir, ioHelper, loadOptions = {}) {
300323
300776
  // We sort as we deploy
300324
300777
  topoSort: false
300325
300778
  });
300326
- await checkContextOverflowSupport(assembly, ioHelper);
300779
+ const tree = await loadTree(assembly, ioHelper.defaults.trace.bind(ioHelper.defaults));
300780
+ await checkContextOverflowSupport(tree, ioHelper);
300327
300781
  return assembly;
300328
300782
  } catch (err) {
300329
300783
  if (err.message.includes(cxschema7.VERSION_MISMATCH)) {
@@ -300518,6 +300972,7 @@ var init_prepare_source = __esm({
300518
300972
  };
300519
300973
  __name(writeContextToEnv, "writeContextToEnv");
300520
300974
  __name(checkContextOverflowSupport, "checkContextOverflowSupport");
300975
+ __name(findConstructLibraryVersion, "findConstructLibraryVersion");
300521
300976
  __name(frameworkSupportsContextOverflow, "frameworkSupportsContextOverflow");
300522
300977
  __name(assemblyFromDirectory, "assemblyFromDirectory");
300523
300978
  __name(settingsFromSynthOptions, "settingsFromSynthOptions");
@@ -305154,10 +305609,10 @@ var require_utils11 = __commonJS({
305154
305609
  return (_b = (_a3 = input.match(/\s+/g)) === null || _a3 === void 0 ? void 0 : _a3.length) !== null && _b !== void 0 ? _b : 0;
305155
305610
  }, "countSpaceSequence");
305156
305611
  exports2.countSpaceSequence = countSpaceSequence;
305157
- var distributeUnevenly = /* @__PURE__ */ __name((sum3, length) => {
305158
- const result2 = Array.from({ length }).fill(Math.floor(sum3 / length));
305612
+ var distributeUnevenly = /* @__PURE__ */ __name((sum4, length) => {
305613
+ const result2 = Array.from({ length }).fill(Math.floor(sum4 / length));
305159
305614
  return result2.map((element, index) => {
305160
- return element + (index < sum3 % length ? 1 : 0);
305615
+ return element + (index < sum4 % length ? 1 : 0);
305161
305616
  });
305162
305617
  }, "distributeUnevenly");
305163
305618
  exports2.distributeUnevenly = distributeUnevenly;
@@ -313654,6 +314109,9 @@ async function tryHotswapDeployment(sdkProvider, ioHelper, assetParams, cloudFor
313654
314109
  hotswapPropertyOverrides
313655
314110
  );
313656
314111
  await hotswapSpan.end(result2);
314112
+ if (result2.error) {
314113
+ throw result2.error;
314114
+ }
313657
314115
  if (result2?.hotswapped === true) {
313658
314116
  return {
313659
314117
  type: "did-deploy-stack",
@@ -313705,13 +314163,19 @@ async function hotswapDeployment(sdkProvider, ioSpan, assetParams, stack, hotswa
313705
314163
  };
313706
314164
  }
313707
314165
  }
313708
- await applyAllHotswapOperations(sdk, ioSpan, hotswappable);
314166
+ let error4;
314167
+ try {
314168
+ await applyAllHotswapOperations(sdk, ioSpan, hotswappable);
314169
+ } catch (e10) {
314170
+ error4 = e10;
314171
+ }
313709
314172
  return {
313710
314173
  stack,
313711
314174
  mode: hotswapMode,
313712
- hotswapped: true,
314175
+ hotswapped: !error4,
313713
314176
  hotswappableChanges,
313714
- nonHotswappableChanges
314177
+ nonHotswappableChanges,
314178
+ error: error4
313715
314179
  };
313716
314180
  }
313717
314181
  async function classifyResourceChanges(stackChanges, evaluateCfnTemplate, sdk, nestedStackNames, hotswapPropertyOverrides) {
@@ -317189,7 +317653,7 @@ var init_diff_formatter = __esm({
317189
317653
  }
317190
317654
  if (diff.differenceCount && !options.strict) {
317191
317655
  const mangledNewTemplate = JSON.parse((0, import_cloudformation_diff2.mangleLikeCloudFormation)(JSON.stringify(this.newTemplate.template)));
317192
- const mangledDiff = (0, import_cloudformation_diff2.fullDiff)(this.oldTemplate, mangledNewTemplate, this.changeSet);
317656
+ const mangledDiff = (0, import_cloudformation_diff2.fullDiff)(oldTemplate, mangledNewTemplate, this.changeSet);
317193
317657
  filteredChangesCount = Math.max(0, diff.differenceCount - mangledDiff.differenceCount);
317194
317658
  if (filteredChangesCount > 0) {
317195
317659
  diff = mangledDiff;
@@ -318083,6 +318547,20 @@ var init_work_graph = __esm({
318083
318547
  }
318084
318548
  });
318085
318549
  }
318550
+ /**
318551
+ * Execute all stack nodes in dependency order with the given concurrency.
318552
+ *
318553
+ * Unlike `doParallel`, this method only handles stack nodes and takes a
318554
+ * simple callback. Intended for destroy where there are no asset nodes.
318555
+ */
318556
+ processStacks(concurrency, fn) {
318557
+ return this.forAllArtifacts(concurrency, async (x10) => {
318558
+ if (x10.type !== "stack") {
318559
+ return;
318560
+ }
318561
+ await fn(x10);
318562
+ });
318563
+ }
318086
318564
  /**
318087
318565
  * Return the set of unblocked nodes
318088
318566
  */
@@ -318310,11 +318788,45 @@ var init_work_graph = __esm({
318310
318788
  }
318311
318789
  });
318312
318790
 
318791
+ // ../toolkit-lib/lib/api/work-graph/build-destroy-work-graph.ts
318792
+ function buildDestroyWorkGraph(stacks, ioHelper) {
318793
+ const graph = new WorkGraph({}, ioHelper);
318794
+ const selectedIds = new Set(stacks.map((s10) => s10.id));
318795
+ for (const stack of stacks) {
318796
+ graph.addNodes({
318797
+ type: "stack",
318798
+ id: stack.id,
318799
+ dependencies: /* @__PURE__ */ new Set(),
318800
+ stack,
318801
+ deploymentState: "pending" /* PENDING */,
318802
+ priority: 0
318803
+ });
318804
+ }
318805
+ for (const stack of stacks) {
318806
+ for (const dep of stack.dependencies) {
318807
+ if (cxapi6.CloudFormationStackArtifact.isCloudFormationStackArtifact(dep) && selectedIds.has(dep.id)) {
318808
+ graph.addDependency(dep.id, stack.id);
318809
+ }
318810
+ }
318811
+ }
318812
+ return graph;
318813
+ }
318814
+ var cxapi6;
318815
+ var init_build_destroy_work_graph = __esm({
318816
+ "../toolkit-lib/lib/api/work-graph/build-destroy-work-graph.ts"() {
318817
+ "use strict";
318818
+ cxapi6 = __toESM(require_lib3());
318819
+ init_work_graph();
318820
+ init_work_graph_types();
318821
+ __name(buildDestroyWorkGraph, "buildDestroyWorkGraph");
318822
+ }
318823
+ });
318824
+
318313
318825
  // ../toolkit-lib/lib/api/work-graph/work-graph-builder.ts
318314
318826
  function stacksFromAssets(artifacts) {
318315
318827
  const ret = /* @__PURE__ */ new Map();
318316
- for (const stack of artifacts.filter((x10) => cxapi6.CloudFormationStackArtifact.isCloudFormationStackArtifact(x10))) {
318317
- const assetArtifacts = stack.dependencies.filter((x10) => cxapi6.AssetManifestArtifact.isAssetManifestArtifact(x10));
318828
+ for (const stack of artifacts.filter((x10) => cxapi7.CloudFormationStackArtifact.isCloudFormationStackArtifact(x10))) {
318829
+ const assetArtifacts = stack.dependencies.filter((x10) => cxapi7.AssetManifestArtifact.isAssetManifestArtifact(x10));
318318
318830
  for (const art of assetArtifacts) {
318319
318831
  ret.set(art, stack);
318320
318832
  }
@@ -318322,14 +318834,14 @@ function stacksFromAssets(artifacts) {
318322
318834
  return ret;
318323
318835
  }
318324
318836
  function onlyStacks(artifacts) {
318325
- return artifacts.filter((x10) => cxapi6.CloudFormationStackArtifact.isCloudFormationStackArtifact(x10));
318837
+ return artifacts.filter((x10) => cxapi7.CloudFormationStackArtifact.isCloudFormationStackArtifact(x10));
318326
318838
  }
318327
- var import_cdk_assets_lib5, cxapi6, WorkGraphBuilder;
318839
+ var import_cdk_assets_lib5, cxapi7, WorkGraphBuilder;
318328
318840
  var init_work_graph_builder = __esm({
318329
318841
  "../toolkit-lib/lib/api/work-graph/work-graph-builder.ts"() {
318330
318842
  "use strict";
318331
318843
  import_cdk_assets_lib5 = __toESM(require_lib9());
318332
- cxapi6 = __toESM(require_lib3());
318844
+ cxapi7 = __toESM(require_lib3());
318333
318845
  init_work_graph();
318334
318846
  init_work_graph_types();
318335
318847
  init_toolkit_error();
@@ -318422,9 +318934,9 @@ var init_work_graph_builder = __esm({
318422
318934
  build(artifacts) {
318423
318935
  const parentStacks = stacksFromAssets(artifacts);
318424
318936
  for (const artifact of artifacts) {
318425
- if (cxapi6.CloudFormationStackArtifact.isCloudFormationStackArtifact(artifact)) {
318937
+ if (cxapi7.CloudFormationStackArtifact.isCloudFormationStackArtifact(artifact)) {
318426
318938
  this.addStack(artifact);
318427
- } else if (cxapi6.AssetManifestArtifact.isAssetManifestArtifact(artifact)) {
318939
+ } else if (cxapi7.AssetManifestArtifact.isAssetManifestArtifact(artifact)) {
318428
318940
  const manifest = import_cdk_assets_lib5.AssetManifest.fromFile(artifact.file);
318429
318941
  for (const entry of manifest.entries) {
318430
318942
  const parentStack = parentStacks.get(artifact);
@@ -318433,8 +318945,8 @@ var init_work_graph_builder = __esm({
318433
318945
  }
318434
318946
  this.addAsset(parentStack, artifact, manifest, entry);
318435
318947
  }
318436
- } else if (cxapi6.NestedCloudAssemblyArtifact.isNestedCloudAssemblyArtifact(artifact)) {
318437
- const assembly = new cxapi6.CloudAssembly(artifact.fullPath, { topoSort: false });
318948
+ } else if (cxapi7.NestedCloudAssemblyArtifact.isNestedCloudAssemblyArtifact(artifact)) {
318949
+ const assembly = new cxapi7.CloudAssembly(artifact.fullPath, { topoSort: false });
318438
318950
  const nestedGraph = new _WorkGraphBuilder(
318439
318951
  this.ioHelper,
318440
318952
  this.prebuildAssets,
@@ -318449,10 +318961,10 @@ var init_work_graph_builder = __esm({
318449
318961
  return this.graph;
318450
318962
  }
318451
318963
  stackArtifactIds(deps) {
318452
- return deps.flatMap((d10) => cxapi6.CloudFormationStackArtifact.isCloudFormationStackArtifact(d10) ? [this.stackArtifactId(d10)] : []);
318964
+ return deps.flatMap((d10) => cxapi7.CloudFormationStackArtifact.isCloudFormationStackArtifact(d10) ? [this.stackArtifactId(d10)] : []);
318453
318965
  }
318454
318966
  stackArtifactId(artifact) {
318455
- if (!cxapi6.CloudFormationStackArtifact.isCloudFormationStackArtifact(artifact)) {
318967
+ if (!cxapi7.CloudFormationStackArtifact.isCloudFormationStackArtifact(artifact)) {
318456
318968
  throw new ToolkitError(`Can only call this on CloudFormationStackArtifact, got: ${artifact.constructor.name}`);
318457
318969
  }
318458
318970
  return `${this.idPrefix}${artifact.id}`;
@@ -318481,6 +318993,7 @@ var init_work_graph_builder = __esm({
318481
318993
  var init_work_graph2 = __esm({
318482
318994
  "../toolkit-lib/lib/api/work-graph/index.ts"() {
318483
318995
  "use strict";
318996
+ init_build_destroy_work_graph();
318484
318997
  init_work_graph();
318485
318998
  init_work_graph_builder();
318486
318999
  init_work_graph_types();
@@ -318514,6 +319027,7 @@ async function synthAndMeasure(ioHelper, cx, selectStacks) {
318514
319027
  const synthSpan = await ioHelper.span(SPAN.SYNTH_ASSEMBLY).begin({ stacks: selectStacks });
318515
319028
  try {
318516
319029
  const ret = await assemblyFromSource(synthSpan.asHelper, cx);
319030
+ countAssemblyResults(synthSpan, ret.assembly);
318517
319031
  const synthDuration = await synthSpan.end({});
318518
319032
  return Object.assign(ret, { synthDuration });
318519
319033
  } catch (error4) {
@@ -318524,13 +319038,28 @@ async function synthAndMeasure(ioHelper, cx, selectStacks) {
318524
319038
  function zeroTime() {
318525
319039
  return { asMs: 0, asSec: 0 };
318526
319040
  }
318527
- var import_dispose_polyfill5, path31, cxapi7, import_cloud_assembly_schema7, chalk23, fs35, FILE_EVENTS, Toolkit;
319041
+ function countAssemblyResults(span, assembly) {
319042
+ const stacksRecursively = assembly.stacksRecursively;
319043
+ span.incCounter("stacks", stacksRecursively.length);
319044
+ span.incCounter("assemblies", asmCount(assembly));
319045
+ span.incCounter("errorAnns", sum3(stacksRecursively.map((s10) => s10.messages.filter((m10) => m10.level === import_cloud_assembly_api14.SynthesisMessageLevel.ERROR).length)));
319046
+ span.incCounter("warnings", sum3(stacksRecursively.map((s10) => s10.messages.filter((m10) => m10.level === import_cloud_assembly_api14.SynthesisMessageLevel.WARNING).length)));
319047
+ function asmCount(x10) {
319048
+ return 1 + x10.nestedAssemblies.reduce((acc, asm) => acc + asmCount(asm.nestedAssembly), 0);
319049
+ }
319050
+ __name(asmCount, "asmCount");
319051
+ }
319052
+ function sum3(xs) {
319053
+ return xs.reduce((a10, b10) => a10 + b10, 0);
319054
+ }
319055
+ var import_dispose_polyfill5, path31, cxapi8, import_cloud_assembly_api14, import_cloud_assembly_schema7, chalk23, fs35, FILE_EVENTS, Toolkit;
318528
319056
  var init_toolkit = __esm({
318529
319057
  "../toolkit-lib/lib/toolkit/toolkit.ts"() {
318530
319058
  "use strict";
318531
319059
  import_dispose_polyfill5 = __toESM(require_dispose_polyfill());
318532
319060
  path31 = __toESM(require("node:path"));
318533
- cxapi7 = __toESM(require_lib3());
319061
+ cxapi8 = __toESM(require_lib3());
319062
+ import_cloud_assembly_api14 = __toESM(require_lib3());
318534
319063
  import_cloud_assembly_schema7 = __toESM(require_lib2());
318535
319064
  chalk23 = __toESM(require_source());
318536
319065
  init_esm2();
@@ -318960,7 +319489,8 @@ var init_toolkit = __esm({
318960
319489
  `Stack ${stack.displayName} does not define an environment, and AWS credentials could not be obtained from standard locations or no region was configured.`
318961
319490
  );
318962
319491
  }
318963
- if (Object.keys(stack.template.Resources || {}).length === 0) {
319492
+ const resourceCount = Object.keys(stack.template.Resources || {}).length;
319493
+ if (resourceCount === 0) {
318964
319494
  const stackExists = await deployments.stackExists({ stack });
318965
319495
  if (!stackExists) {
318966
319496
  return ioHelper.notify(IO.CDK_TOOLKIT_W5021.msg(`${chalk23.bold(stack.displayName)}: stack has no resources, skipping deployment.`));
@@ -319006,6 +319536,7 @@ Do you wish to deploy these changes`;
319006
319536
  current: stackIndex,
319007
319537
  stack
319008
319538
  });
319539
+ deploySpan.incCounter("resources", resourceCount);
319009
319540
  let tags = options.tags;
319010
319541
  if (!tags || tags.length === 0) {
319011
319542
  tags = tagsForStack(stack);
@@ -319133,7 +319664,7 @@ ${deployResult.stackArn}`));
319133
319664
  const concurrency = options.concurrency || 1;
319134
319665
  const stacksAndTheirAssetManifests = stacks.flatMap((stack) => [
319135
319666
  stack,
319136
- ...stack.dependencies.filter((x10) => cxapi7.AssetManifestArtifact.isAssetManifestArtifact(x10))
319667
+ ...stack.dependencies.filter((x10) => cxapi8.AssetManifestArtifact.isAssetManifestArtifact(x10))
319137
319668
  ]);
319138
319669
  const workGraph = new WorkGraphBuilder(ioHelper, prebuildAssets).build(stacksAndTheirAssetManifests);
319139
319670
  if (!options.forceAssetPublishing) {
@@ -319483,7 +320014,7 @@ ${deployResult.stackArn}`));
319483
320014
  async _destroy(assembly, action, options) {
319484
320015
  const selectStacks = stacksOpt(options);
319485
320016
  const ioHelper = asIoHelper(this.ioHost, action);
319486
- const stacks = (await assembly.selectStacksV2(selectStacks)).reversed();
320017
+ const stacks = await assembly.selectStacksV2(selectStacks);
319487
320018
  const ret = {
319488
320019
  stacks: []
319489
320020
  };
@@ -319494,15 +320025,19 @@ ${deployResult.stackArn}`));
319494
320025
  await ioHelper.notify(IO.CDK_TOOLKIT_E7010.msg("Aborted by user"));
319495
320026
  return ret;
319496
320027
  }
320028
+ const concurrency = options.concurrency || 1;
320029
+ let destroyCount = 0;
319497
320030
  const destroySpan = await ioHelper.span(SPAN.DESTROY_ACTION).begin({
319498
320031
  stacks: stacks.stackArtifacts
319499
320032
  });
319500
320033
  try {
319501
- for (const [index, stack] of stacks.stackArtifacts.entries()) {
320034
+ const destroyStack2 = /* @__PURE__ */ __name(async (stackNode) => {
320035
+ const stack = stackNode.stack;
320036
+ destroyCount++;
319502
320037
  try {
319503
- const singleDestroySpan = await ioHelper.span(SPAN.DESTROY_STACK).begin(chalk23.green(`${chalk23.blue(stack.displayName)}: destroying... [${index + 1}/${stacks.stackCount}]`), {
320038
+ const singleDestroySpan = await ioHelper.span(SPAN.DESTROY_STACK).begin(chalk23.green(`${chalk23.blue(stack.displayName)}: destroying... [${destroyCount}/${stacks.stackCount}]`), {
319504
320039
  total: stacks.stackCount,
319505
- current: index + 1,
320040
+ current: destroyCount,
319506
320041
  stack
319507
320042
  });
319508
320043
  const deployments = await this.deploymentsForAction(action);
@@ -319528,7 +320063,9 @@ ${deployResult.stackArn}`));
319528
320063
  \u274C ${chalk23.blue(stack.displayName)}: ${action} failed ${e10}`, { error: e10 }));
319529
320064
  throw e10;
319530
320065
  }
319531
- }
320066
+ }, "destroyStack");
320067
+ const workGraph = buildDestroyWorkGraph(stacks.stackArtifacts, ioHelper);
320068
+ await workGraph.processStacks(concurrency, destroyStack2);
319532
320069
  return ret;
319533
320070
  } finally {
319534
320071
  await destroySpan.end();
@@ -319628,6 +320165,8 @@ ${deployResult.stackArn}`));
319628
320165
  __name(stacksOpt, "stacksOpt");
319629
320166
  __name(synthAndMeasure, "synthAndMeasure");
319630
320167
  __name(zeroTime, "zeroTime");
320168
+ __name(countAssemblyResults, "countAssemblyResults");
320169
+ __name(sum3, "sum");
319631
320170
  }
319632
320171
  });
319633
320172
 
@@ -319812,12 +320351,12 @@ var require_lib13 = __commonJS({
319812
320351
  });
319813
320352
 
319814
320353
  // lib/engines/toolkit-lib.ts
319815
- var path32, import_cloud_assembly_api14, import_toolkit_lib, chalk24, fs36, ToolkitLibRunnerEngine, IntegRunnerIoHost, NoopIoHost;
320354
+ var path32, import_cloud_assembly_api15, import_toolkit_lib, chalk24, fs36, ToolkitLibRunnerEngine, IntegRunnerIoHost, NoopIoHost;
319816
320355
  var init_toolkit_lib = __esm({
319817
320356
  "lib/engines/toolkit-lib.ts"() {
319818
320357
  "use strict";
319819
320358
  path32 = __toESM(require("node:path"));
319820
- import_cloud_assembly_api14 = __toESM(require_lib3());
320359
+ import_cloud_assembly_api15 = __toESM(require_lib3());
319821
320360
  import_toolkit_lib = __toESM(require_lib13());
319822
320361
  chalk24 = __toESM(require_source());
319823
320362
  fs36 = __toESM(require_lib6());
@@ -320022,11 +320561,11 @@ var init_toolkit_lib = __esm({
320022
320561
  * This catches that misconfiguration.
320023
320562
  */
320024
320563
  async validateRegion(asm) {
320025
- if (this.options.region === import_cloud_assembly_api14.UNKNOWN_REGION) {
320564
+ if (this.options.region === import_cloud_assembly_api15.UNKNOWN_REGION) {
320026
320565
  return;
320027
320566
  }
320028
320567
  for (const stack of asm.cloudAssembly.stacksRecursively) {
320029
- if (stack.environment.region !== this.options.region && stack.environment.region !== import_cloud_assembly_api14.UNKNOWN_REGION) {
320568
+ if (stack.environment.region !== this.options.region && stack.environment.region !== import_cloud_assembly_api15.UNKNOWN_REGION) {
320030
320569
  this.ioHost.notify({
320031
320570
  action: "deploy",
320032
320571
  code: "CDK_RUNNER_W0000",
@@ -320131,13 +320670,13 @@ var init_logger = __esm({
320131
320670
  });
320132
320671
 
320133
320672
  // lib/runner/private/cloud-assembly.ts
320134
- var path33, import_cdk_assets_lib6, import_cloud_assembly_api15, import_cloud_assembly_schema8, fs37, AssemblyManifestReader;
320673
+ var path33, import_cdk_assets_lib6, import_cloud_assembly_api16, import_cloud_assembly_schema8, fs37, AssemblyManifestReader;
320135
320674
  var init_cloud_assembly4 = __esm({
320136
320675
  "lib/runner/private/cloud-assembly.ts"() {
320137
320676
  "use strict";
320138
320677
  path33 = __toESM(require("path"));
320139
320678
  import_cdk_assets_lib6 = __toESM(require_lib9());
320140
- import_cloud_assembly_api15 = __toESM(require_lib3());
320679
+ import_cloud_assembly_api16 = __toESM(require_lib3());
320141
320680
  import_cloud_assembly_schema8 = __toESM(require_lib2());
320142
320681
  fs37 = __toESM(require_lib6());
320143
320682
  AssemblyManifestReader = class _AssemblyManifestReader {
@@ -320271,7 +320810,7 @@ var init_cloud_assembly4 = __esm({
320271
320810
  */
320272
320811
  assetsFromAssemblyManifest(artifact) {
320273
320812
  const assets = [];
320274
- for (const metadata of Object.values(import_cloud_assembly_api15.CloudArtifact.readMetadata(this.directory, artifact) ?? {})) {
320813
+ for (const metadata of Object.values(import_cloud_assembly_api16.CloudArtifact.readMetadata(this.directory, artifact) ?? {})) {
320275
320814
  metadata.forEach((data2) => {
320276
320815
  if (data2.type === import_cloud_assembly_schema8.ArtifactMetadataEntryType.ASSET) {
320277
320816
  const asset = data2.data;
@@ -320372,12 +320911,12 @@ var init_cloud_assembly4 = __esm({
320372
320911
  function currentlyRecommendedAwsCdkLibFlags() {
320373
320912
  return recommended_feature_flags_exports;
320374
320913
  }
320375
- var path34, import_cloud_assembly_api16, import_cx_api, fs38, DESTRUCTIVE_CHANGES, IntegRunner, DEFAULT_SYNTH_OPTIONS;
320914
+ var path34, import_cloud_assembly_api17, import_cx_api, fs38, DESTRUCTIVE_CHANGES, IntegRunner, DEFAULT_SYNTH_OPTIONS;
320376
320915
  var init_runner_base = __esm({
320377
320916
  "lib/runner/runner-base.ts"() {
320378
320917
  "use strict";
320379
320918
  path34 = __toESM(require("path"));
320380
- import_cloud_assembly_api16 = __toESM(require_lib3());
320919
+ import_cloud_assembly_api17 = __toESM(require_lib3());
320381
320920
  import_cx_api = __toESM(require_lib5());
320382
320921
  fs38 = __toESM(require_lib6());
320383
320922
  init_integ_test_suite();
@@ -320683,7 +321222,7 @@ var init_runner_base = __esm({
320683
321222
  };
320684
321223
  DEFAULT_SYNTH_OPTIONS = {
320685
321224
  context: {
320686
- [import_cloud_assembly_api16.AVAILABILITY_ZONE_FALLBACK_CONTEXT_KEY]: ["test-region-1a", "test-region-1b", "test-region-1c"],
321225
+ [import_cloud_assembly_api17.AVAILABILITY_ZONE_FALLBACK_CONTEXT_KEY]: ["test-region-1a", "test-region-1b", "test-region-1c"],
320687
321226
  "availability-zones:account=12345678:region=test-region": ["test-region-1a", "test-region-1b", "test-region-1c"],
320688
321227
  "ssm:account=12345678:parameterName=/aws/service/ami-amazon-linux-latest/amzn-ami-hvm-x86_64-gp2:region=test-region": "ami-1234",
320689
321228
  "ssm:account=12345678:parameterName=/aws/service/ami-amazon-linux-latest/amzn2-ami-hvm-x86_64-gp2:region=test-region": "ami-1234",
@@ -321234,14 +321773,14 @@ https://github.com/aws/aws-cdk/tree/main/packages/%40aws-cdk/integ-tests-alpha`
321234
321773
  });
321235
321774
 
321236
321775
  // lib/runner/snapshot-test-runner.ts
321237
- var path36, import_stream2, import_string_decoder, import_cloud_assembly_api17, import_cloudformation_diff4, IntegSnapshotRunner, StringWritable;
321776
+ var path36, import_stream2, import_string_decoder, import_cloud_assembly_api18, import_cloudformation_diff4, IntegSnapshotRunner, StringWritable;
321238
321777
  var init_snapshot_test_runner = __esm({
321239
321778
  "lib/runner/snapshot-test-runner.ts"() {
321240
321779
  "use strict";
321241
321780
  path36 = __toESM(require("path"));
321242
321781
  import_stream2 = require("stream");
321243
321782
  import_string_decoder = require("string_decoder");
321244
- import_cloud_assembly_api17 = __toESM(require_lib3());
321783
+ import_cloud_assembly_api18 = __toESM(require_lib3());
321245
321784
  import_cloudformation_diff4 = __toESM(require_lib12());
321246
321785
  init_cloud_assembly4();
321247
321786
  init_runner_base();
@@ -321253,7 +321792,7 @@ var init_snapshot_test_runner = __esm({
321253
321792
  constructor(options) {
321254
321793
  super({
321255
321794
  ...options,
321256
- region: import_cloud_assembly_api17.UNKNOWN_REGION
321795
+ region: import_cloud_assembly_api18.UNKNOWN_REGION
321257
321796
  });
321258
321797
  }
321259
321798
  /**