aws-cdk 2.1111.0 → 2.1113.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/index.js CHANGED
@@ -349,8 +349,8 @@ var require_helpers = __commonJS({
349
349
  var ValidationError = exports2.ValidationError = /* @__PURE__ */ __name(function ValidationError2(message2, instance, schema, path43, name, argument) {
350
350
  if (Array.isArray(path43)) {
351
351
  this.path = path43;
352
- this.property = path43.reduce(function(sum3, item) {
353
- return sum3 + makeSuffix(item);
352
+ this.property = path43.reduce(function(sum5, item) {
353
+ return sum5 + makeSuffix(item);
354
354
  }, "instance");
355
355
  } else if (path43 !== void 0) {
356
356
  this.property = path43;
@@ -451,8 +451,8 @@ var require_helpers = __commonJS({
451
451
  this.options = options;
452
452
  if (Array.isArray(path43)) {
453
453
  this.path = path43;
454
- this.propertyPath = path43.reduce(function(sum3, item) {
455
- return sum3 + makeSuffix(item);
454
+ this.propertyPath = path43.reduce(function(sum5, item) {
455
+ return sum5 + makeSuffix(item);
456
456
  }, "instance");
457
457
  } else {
458
458
  this.propertyPath = path43;
@@ -3599,7 +3599,7 @@ var require_semver2 = __commonJS({
3599
3599
  // ../@aws-cdk/cloud-assembly-schema/cli-version.json
3600
3600
  var require_cli_version = __commonJS({
3601
3601
  "../@aws-cdk/cloud-assembly-schema/cli-version.json"(exports2, module2) {
3602
- module2.exports = { version: "2.1111.0" };
3602
+ module2.exports = { version: "2.1113.0" };
3603
3603
  }
3604
3604
  });
3605
3605
 
@@ -5957,11 +5957,11 @@ var init_metadata = __esm({
5957
5957
  "../@aws-cdk/cloud-assembly-api/lib/metadata.ts"() {
5958
5958
  "use strict";
5959
5959
  PATH_METADATA_KEY = "aws:cdk:path";
5960
- SynthesisMessageLevel = /* @__PURE__ */ ((SynthesisMessageLevel3) => {
5961
- SynthesisMessageLevel3["INFO"] = "info";
5962
- SynthesisMessageLevel3["WARNING"] = "warning";
5963
- SynthesisMessageLevel3["ERROR"] = "error";
5964
- return SynthesisMessageLevel3;
5960
+ SynthesisMessageLevel = /* @__PURE__ */ ((SynthesisMessageLevel5) => {
5961
+ SynthesisMessageLevel5["INFO"] = "info";
5962
+ SynthesisMessageLevel5["WARNING"] = "warning";
5963
+ SynthesisMessageLevel5["ERROR"] = "error";
5964
+ return SynthesisMessageLevel5;
5965
5965
  })(SynthesisMessageLevel || {});
5966
5966
  }
5967
5967
  });
@@ -57629,10 +57629,10 @@ var require_headers = __commonJS({
57629
57629
  }
57630
57630
  __name(indexOf, "indexOf");
57631
57631
  function cksum(block) {
57632
- let sum3 = 8 * 32;
57633
- for (let i10 = 0; i10 < 148; i10++) sum3 += block[i10];
57634
- for (let j10 = 156; j10 < 512; j10++) sum3 += block[j10];
57635
- return sum3;
57632
+ let sum5 = 8 * 32;
57633
+ for (let i10 = 0; i10 < 148; i10++) sum5 += block[i10];
57634
+ for (let j10 = 156; j10 < 512; j10++) sum5 += block[j10];
57635
+ return sum5;
57636
57636
  }
57637
57637
  __name(cksum, "cksum");
57638
57638
  function encodeOct(val, n10) {
@@ -57669,12 +57669,12 @@ var require_headers = __commonJS({
57669
57669
  if (positive) tuple.push(byte);
57670
57670
  else tuple.push(255 - byte);
57671
57671
  }
57672
- let sum3 = 0;
57672
+ let sum5 = 0;
57673
57673
  const l10 = tuple.length;
57674
57674
  for (i10 = 0; i10 < l10; i10++) {
57675
- sum3 += tuple[i10] * Math.pow(256, i10);
57675
+ sum5 += tuple[i10] * Math.pow(256, i10);
57676
57676
  }
57677
- return positive ? sum3 : -1 * sum3;
57677
+ return positive ? sum5 : -1 * sum5;
57678
57678
  }
57679
57679
  __name(parse256, "parse256");
57680
57680
  function decodeOct(val, offset, length) {
@@ -71384,45 +71384,45 @@ var require_fxp = __commonJS({
71384
71384
  "../../node_modules/@aws-sdk/xml-builder/node_modules/fast-xml-parser/lib/fxp.cjs"(exports2, module2) {
71385
71385
  (() => {
71386
71386
  "use strict";
71387
- var t10 = { d: /* @__PURE__ */ __name((e11, n11) => {
71388
- for (var i11 in n11) t10.o(n11, i11) && !t10.o(e11, i11) && Object.defineProperty(e11, i11, { enumerable: true, get: n11[i11] });
71387
+ var t10 = { d: /* @__PURE__ */ __name((e11, i11) => {
71388
+ for (var n11 in i11) t10.o(i11, n11) && !t10.o(e11, n11) && Object.defineProperty(e11, n11, { enumerable: true, get: i11[n11] });
71389
71389
  }, "d"), o: /* @__PURE__ */ __name((t11, e11) => Object.prototype.hasOwnProperty.call(t11, e11), "o"), r: /* @__PURE__ */ __name((t11) => {
71390
71390
  "undefined" != typeof Symbol && Symbol.toStringTag && Object.defineProperty(t11, Symbol.toStringTag, { value: "Module" }), Object.defineProperty(t11, "__esModule", { value: true });
71391
71391
  }, "r") }, e10 = {};
71392
- t10.r(e10), t10.d(e10, { XMLBuilder: /* @__PURE__ */ __name(() => gt, "XMLBuilder"), XMLParser: /* @__PURE__ */ __name(() => it, "XMLParser"), XMLValidator: /* @__PURE__ */ __name(() => xt, "XMLValidator") });
71393
- 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]*$");
71392
+ t10.r(e10), t10.d(e10, { XMLBuilder: /* @__PURE__ */ __name(() => Ot, "XMLBuilder"), XMLParser: /* @__PURE__ */ __name(() => ft, "XMLParser"), XMLValidator: /* @__PURE__ */ __name(() => $t, "XMLValidator") });
71393
+ 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]*$");
71394
71394
  function s10(t11, e11) {
71395
- const n11 = [];
71396
- let i11 = e11.exec(t11);
71397
- for (; i11; ) {
71395
+ const i11 = [];
71396
+ let n11 = e11.exec(t11);
71397
+ for (; n11; ) {
71398
71398
  const s11 = [];
71399
- s11.startIndex = e11.lastIndex - i11[0].length;
71400
- const r11 = i11.length;
71401
- for (let t12 = 0; t12 < r11; t12++) s11.push(i11[t12]);
71402
- n11.push(s11), i11 = e11.exec(t11);
71399
+ s11.startIndex = e11.lastIndex - n11[0].length;
71400
+ const r11 = n11.length;
71401
+ for (let t12 = 0; t12 < r11; t12++) s11.push(n11[t12]);
71402
+ i11.push(s11), n11 = e11.exec(t11);
71403
71403
  }
71404
- return n11;
71404
+ return i11;
71405
71405
  }
71406
71406
  __name(s10, "s");
71407
71407
  const r10 = /* @__PURE__ */ __name(function(t11) {
71408
- return !(null == i10.exec(t11));
71409
- }, "r"), o10 = { allowBooleanAttributes: false, unpairedTags: [] };
71410
- function a10(t11, e11) {
71411
- e11 = Object.assign({}, o10, e11);
71412
- const n11 = [];
71413
- let i11 = false, s11 = false;
71408
+ return !(null == n10.exec(t11));
71409
+ }, "r"), o10 = ["hasOwnProperty", "toString", "valueOf", "__defineGetter__", "__defineSetter__", "__lookupGetter__", "__lookupSetter__"], a10 = ["__proto__", "constructor", "prototype"], h10 = { allowBooleanAttributes: false, unpairedTags: [] };
71410
+ function l10(t11, e11) {
71411
+ e11 = Object.assign({}, h10, e11);
71412
+ const i11 = [];
71413
+ let n11 = false, s11 = false;
71414
71414
  "\uFEFF" === t11[0] && (t11 = t11.substr(1));
71415
71415
  for (let r11 = 0; r11 < t11.length; r11++) if ("<" === t11[r11] && "?" === t11[r11 + 1]) {
71416
71416
  if (r11 += 2, r11 = u10(t11, r11), r11.err) return r11;
71417
71417
  } else {
71418
71418
  if ("<" !== t11[r11]) {
71419
- if (l10(t11[r11])) continue;
71420
- return m10("InvalidChar", "char '" + t11[r11] + "' is not expected.", N(t11, r11));
71419
+ if (p10(t11[r11])) continue;
71420
+ return b10("InvalidChar", "char '" + t11[r11] + "' is not expected.", w10(t11, r11));
71421
71421
  }
71422
71422
  {
71423
71423
  let o11 = r11;
71424
71424
  if (r11++, "!" === t11[r11]) {
71425
- r11 = d10(t11, r11);
71425
+ r11 = c10(t11, r11);
71426
71426
  continue;
71427
71427
  }
71428
71428
  {
@@ -71430,65 +71430,65 @@ var require_fxp = __commonJS({
71430
71430
  "/" === t11[r11] && (a11 = true, r11++);
71431
71431
  let h11 = "";
71432
71432
  for (; r11 < t11.length && ">" !== t11[r11] && " " !== t11[r11] && " " !== t11[r11] && "\n" !== t11[r11] && "\r" !== t11[r11]; r11++) h11 += t11[r11];
71433
- if (h11 = h11.trim(), "/" === h11[h11.length - 1] && (h11 = h11.substring(0, h11.length - 1), r11--), !b10(h11)) {
71433
+ if (h11 = h11.trim(), "/" === h11[h11.length - 1] && (h11 = h11.substring(0, h11.length - 1), r11--), !y4(h11)) {
71434
71434
  let e12;
71435
- return e12 = 0 === h11.trim().length ? "Invalid space after '<'." : "Tag '" + h11 + "' is an invalid name.", m10("InvalidTag", e12, N(t11, r11));
71435
+ return e12 = 0 === h11.trim().length ? "Invalid space after '<'." : "Tag '" + h11 + "' is an invalid name.", b10("InvalidTag", e12, w10(t11, r11));
71436
71436
  }
71437
- const p11 = c10(t11, r11);
71438
- if (false === p11) return m10("InvalidAttr", "Attributes for '" + h11 + "' have open quote.", N(t11, r11));
71439
- let f11 = p11.value;
71440
- if (r11 = p11.index, "/" === f11[f11.length - 1]) {
71441
- const n12 = r11 - f11.length;
71442
- f11 = f11.substring(0, f11.length - 1);
71443
- const s12 = g10(f11, e11);
71444
- if (true !== s12) return m10(s12.err.code, s12.err.msg, N(t11, n12 + s12.err.line));
71445
- i11 = true;
71437
+ const l11 = g10(t11, r11);
71438
+ if (false === l11) return b10("InvalidAttr", "Attributes for '" + h11 + "' have open quote.", w10(t11, r11));
71439
+ let d11 = l11.value;
71440
+ if (r11 = l11.index, "/" === d11[d11.length - 1]) {
71441
+ const i12 = r11 - d11.length;
71442
+ d11 = d11.substring(0, d11.length - 1);
71443
+ const s12 = x10(d11, e11);
71444
+ if (true !== s12) return b10(s12.err.code, s12.err.msg, w10(t11, i12 + s12.err.line));
71445
+ n11 = true;
71446
71446
  } else if (a11) {
71447
- if (!p11.tagClosed) return m10("InvalidTag", "Closing tag '" + h11 + "' doesn't have proper closing.", N(t11, r11));
71448
- if (f11.trim().length > 0) return m10("InvalidTag", "Closing tag '" + h11 + "' can't have attributes or invalid starting.", N(t11, o11));
71449
- if (0 === n11.length) return m10("InvalidTag", "Closing tag '" + h11 + "' has not been opened.", N(t11, o11));
71447
+ if (!l11.tagClosed) return b10("InvalidTag", "Closing tag '" + h11 + "' doesn't have proper closing.", w10(t11, r11));
71448
+ if (d11.trim().length > 0) return b10("InvalidTag", "Closing tag '" + h11 + "' can't have attributes or invalid starting.", w10(t11, o11));
71449
+ if (0 === i11.length) return b10("InvalidTag", "Closing tag '" + h11 + "' has not been opened.", w10(t11, o11));
71450
71450
  {
71451
- const e12 = n11.pop();
71451
+ const e12 = i11.pop();
71452
71452
  if (h11 !== e12.tagName) {
71453
- let n12 = N(t11, e12.tagStartPos);
71454
- return m10("InvalidTag", "Expected closing tag '" + e12.tagName + "' (opened in line " + n12.line + ", col " + n12.col + ") instead of closing tag '" + h11 + "'.", N(t11, o11));
71453
+ let i12 = w10(t11, e12.tagStartPos);
71454
+ return b10("InvalidTag", "Expected closing tag '" + e12.tagName + "' (opened in line " + i12.line + ", col " + i12.col + ") instead of closing tag '" + h11 + "'.", w10(t11, o11));
71455
71455
  }
71456
- 0 == n11.length && (s11 = true);
71456
+ 0 == i11.length && (s11 = true);
71457
71457
  }
71458
71458
  } else {
71459
- const a12 = g10(f11, e11);
71460
- if (true !== a12) return m10(a12.err.code, a12.err.msg, N(t11, r11 - f11.length + a12.err.line));
71461
- if (true === s11) return m10("InvalidXml", "Multiple possible root nodes found.", N(t11, r11));
71462
- -1 !== e11.unpairedTags.indexOf(h11) || n11.push({ tagName: h11, tagStartPos: o11 }), i11 = true;
71459
+ const a12 = x10(d11, e11);
71460
+ if (true !== a12) return b10(a12.err.code, a12.err.msg, w10(t11, r11 - d11.length + a12.err.line));
71461
+ if (true === s11) return b10("InvalidXml", "Multiple possible root nodes found.", w10(t11, r11));
71462
+ -1 !== e11.unpairedTags.indexOf(h11) || i11.push({ tagName: h11, tagStartPos: o11 }), n11 = true;
71463
71463
  }
71464
71464
  for (r11++; r11 < t11.length; r11++) if ("<" === t11[r11]) {
71465
71465
  if ("!" === t11[r11 + 1]) {
71466
- r11++, r11 = d10(t11, r11);
71466
+ r11++, r11 = c10(t11, r11);
71467
71467
  continue;
71468
71468
  }
71469
71469
  if ("?" !== t11[r11 + 1]) break;
71470
71470
  if (r11 = u10(t11, ++r11), r11.err) return r11;
71471
71471
  } else if ("&" === t11[r11]) {
71472
- const e12 = x10(t11, r11);
71473
- if (-1 == e12) return m10("InvalidChar", "char '&' is not expected.", N(t11, r11));
71472
+ const e12 = N(t11, r11);
71473
+ if (-1 == e12) return b10("InvalidChar", "char '&' is not expected.", w10(t11, r11));
71474
71474
  r11 = e12;
71475
- } else if (true === s11 && !l10(t11[r11])) return m10("InvalidXml", "Extra text at the end", N(t11, r11));
71475
+ } else if (true === s11 && !p10(t11[r11])) return b10("InvalidXml", "Extra text at the end", w10(t11, r11));
71476
71476
  "<" === t11[r11] && r11--;
71477
71477
  }
71478
71478
  }
71479
71479
  }
71480
- 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);
71480
+ 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);
71481
71481
  }
71482
- __name(a10, "a");
71483
- function l10(t11) {
71482
+ __name(l10, "l");
71483
+ function p10(t11) {
71484
71484
  return " " === t11 || " " === t11 || "\n" === t11 || "\r" === t11;
71485
71485
  }
71486
- __name(l10, "l");
71486
+ __name(p10, "p");
71487
71487
  function u10(t11, e11) {
71488
- const n11 = e11;
71488
+ const i11 = e11;
71489
71489
  for (; e11 < t11.length; e11++) if ("?" == t11[e11] || " " == t11[e11]) {
71490
- const i11 = t11.substr(n11, e11 - n11);
71491
- if (e11 > 5 && "xml" === i11) return m10("InvalidXml", "XML declaration allowed only at the start of the document.", N(t11, e11));
71490
+ const n11 = t11.substr(i11, e11 - i11);
71491
+ if (e11 > 5 && "xml" === n11) return b10("InvalidXml", "XML declaration allowed only at the start of the document.", w10(t11, e11));
71492
71492
  if ("?" == t11[e11] && ">" == t11[e11 + 1]) {
71493
71493
  e11++;
71494
71494
  break;
@@ -71498,16 +71498,16 @@ var require_fxp = __commonJS({
71498
71498
  return e11;
71499
71499
  }
71500
71500
  __name(u10, "u");
71501
- function d10(t11, e11) {
71501
+ function c10(t11, e11) {
71502
71502
  if (t11.length > e11 + 5 && "-" === t11[e11 + 1] && "-" === t11[e11 + 2]) {
71503
71503
  for (e11 += 3; e11 < t11.length; e11++) if ("-" === t11[e11] && "-" === t11[e11 + 1] && ">" === t11[e11 + 2]) {
71504
71504
  e11 += 2;
71505
71505
  break;
71506
71506
  }
71507
71507
  } 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]) {
71508
- let n11 = 1;
71509
- for (e11 += 8; e11 < t11.length; e11++) if ("<" === t11[e11]) n11++;
71510
- else if (">" === t11[e11] && (n11--, 0 === n11)) break;
71508
+ let i11 = 1;
71509
+ for (e11 += 8; e11 < t11.length; e11++) if ("<" === t11[e11]) i11++;
71510
+ else if (">" === t11[e11] && (i11--, 0 === i11)) break;
71511
71511
  } 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]) {
71512
71512
  for (e11 += 8; e11 < t11.length; e11++) if ("]" === t11[e11] && "]" === t11[e11 + 1] && ">" === t11[e11 + 2]) {
71513
71513
  e11 += 2;
@@ -71516,95 +71516,103 @@ var require_fxp = __commonJS({
71516
71516
  }
71517
71517
  return e11;
71518
71518
  }
71519
- __name(d10, "d");
71520
- const h10 = '"', p10 = "'";
71521
- function c10(t11, e11) {
71522
- let n11 = "", i11 = "", s11 = false;
71519
+ __name(c10, "c");
71520
+ const d10 = '"', f10 = "'";
71521
+ function g10(t11, e11) {
71522
+ let i11 = "", n11 = "", s11 = false;
71523
71523
  for (; e11 < t11.length; e11++) {
71524
- if (t11[e11] === h10 || t11[e11] === p10) "" === i11 ? i11 = t11[e11] : i11 !== t11[e11] || (i11 = "");
71525
- else if (">" === t11[e11] && "" === i11) {
71524
+ if (t11[e11] === d10 || t11[e11] === f10) "" === n11 ? n11 = t11[e11] : n11 !== t11[e11] || (n11 = "");
71525
+ else if (">" === t11[e11] && "" === n11) {
71526
71526
  s11 = true;
71527
71527
  break;
71528
71528
  }
71529
- n11 += t11[e11];
71529
+ i11 += t11[e11];
71530
71530
  }
71531
- return "" === i11 && { value: n11, index: e11, tagClosed: s11 };
71531
+ return "" === n11 && { value: i11, index: e11, tagClosed: s11 };
71532
71532
  }
71533
- __name(c10, "c");
71534
- const f10 = new RegExp(`(\\s*)([^\\s=]+)(\\s*=)?(\\s*(['"])(([\\s\\S])*?)\\5)?`, "g");
71535
- function g10(t11, e11) {
71536
- const n11 = s10(t11, f10), i11 = {};
71537
- for (let t12 = 0; t12 < n11.length; t12++) {
71538
- if (0 === n11[t12][1].length) return m10("InvalidAttr", "Attribute '" + n11[t12][2] + "' has no space in starting.", y4(n11[t12]));
71539
- if (void 0 !== n11[t12][3] && void 0 === n11[t12][4]) return m10("InvalidAttr", "Attribute '" + n11[t12][2] + "' is without value.", y4(n11[t12]));
71540
- if (void 0 === n11[t12][3] && !e11.allowBooleanAttributes) return m10("InvalidAttr", "boolean attribute '" + n11[t12][2] + "' is not allowed.", y4(n11[t12]));
71541
- const s11 = n11[t12][2];
71542
- if (!E3(s11)) return m10("InvalidAttr", "Attribute '" + s11 + "' is an invalid name.", y4(n11[t12]));
71543
- if (Object.prototype.hasOwnProperty.call(i11, s11)) return m10("InvalidAttr", "Attribute '" + s11 + "' is repeated.", y4(n11[t12]));
71544
- i11[s11] = 1;
71533
+ __name(g10, "g");
71534
+ const m10 = new RegExp(`(\\s*)([^\\s=]+)(\\s*=)?(\\s*(['"])(([\\s\\S])*?)\\5)?`, "g");
71535
+ function x10(t11, e11) {
71536
+ const i11 = s10(t11, m10), n11 = {};
71537
+ for (let t12 = 0; t12 < i11.length; t12++) {
71538
+ if (0 === i11[t12][1].length) return b10("InvalidAttr", "Attribute '" + i11[t12][2] + "' has no space in starting.", v10(i11[t12]));
71539
+ if (void 0 !== i11[t12][3] && void 0 === i11[t12][4]) return b10("InvalidAttr", "Attribute '" + i11[t12][2] + "' is without value.", v10(i11[t12]));
71540
+ if (void 0 === i11[t12][3] && !e11.allowBooleanAttributes) return b10("InvalidAttr", "boolean attribute '" + i11[t12][2] + "' is not allowed.", v10(i11[t12]));
71541
+ const s11 = i11[t12][2];
71542
+ if (!E3(s11)) return b10("InvalidAttr", "Attribute '" + s11 + "' is an invalid name.", v10(i11[t12]));
71543
+ if (Object.prototype.hasOwnProperty.call(n11, s11)) return b10("InvalidAttr", "Attribute '" + s11 + "' is repeated.", v10(i11[t12]));
71544
+ n11[s11] = 1;
71545
71545
  }
71546
71546
  return true;
71547
71547
  }
71548
- __name(g10, "g");
71549
- function x10(t11, e11) {
71548
+ __name(x10, "x");
71549
+ function N(t11, e11) {
71550
71550
  if (";" === t11[++e11]) return -1;
71551
71551
  if ("#" === t11[e11]) return (function(t12, e12) {
71552
- let n12 = /\d/;
71553
- for ("x" === t12[e12] && (e12++, n12 = /[\da-fA-F]/); e12 < t12.length; e12++) {
71552
+ let i12 = /\d/;
71553
+ for ("x" === t12[e12] && (e12++, i12 = /[\da-fA-F]/); e12 < t12.length; e12++) {
71554
71554
  if (";" === t12[e12]) return e12;
71555
- if (!t12[e12].match(n12)) break;
71555
+ if (!t12[e12].match(i12)) break;
71556
71556
  }
71557
71557
  return -1;
71558
71558
  })(t11, ++e11);
71559
- let n11 = 0;
71560
- for (; e11 < t11.length; e11++, n11++) if (!(t11[e11].match(/\w/) && n11 < 20)) {
71559
+ let i11 = 0;
71560
+ for (; e11 < t11.length; e11++, i11++) if (!(t11[e11].match(/\w/) && i11 < 20)) {
71561
71561
  if (";" === t11[e11]) break;
71562
71562
  return -1;
71563
71563
  }
71564
71564
  return e11;
71565
71565
  }
71566
- __name(x10, "x");
71567
- function m10(t11, e11, n11) {
71568
- return { err: { code: t11, msg: e11, line: n11.line || n11, col: n11.col } };
71566
+ __name(N, "N");
71567
+ function b10(t11, e11, i11) {
71568
+ return { err: { code: t11, msg: e11, line: i11.line || i11, col: i11.col } };
71569
71569
  }
71570
- __name(m10, "m");
71570
+ __name(b10, "b");
71571
71571
  function E3(t11) {
71572
71572
  return r10(t11);
71573
71573
  }
71574
71574
  __name(E3, "E");
71575
- function b10(t11) {
71575
+ function y4(t11) {
71576
71576
  return r10(t11);
71577
71577
  }
71578
- __name(b10, "b");
71579
- function N(t11, e11) {
71580
- const n11 = t11.substring(0, e11).split(/\r?\n/);
71581
- return { line: n11.length, col: n11[n11.length - 1].length + 1 };
71578
+ __name(y4, "y");
71579
+ function w10(t11, e11) {
71580
+ const i11 = t11.substring(0, e11).split(/\r?\n/);
71581
+ return { line: i11.length, col: i11[i11.length - 1].length + 1 };
71582
71582
  }
71583
- __name(N, "N");
71584
- function y4(t11) {
71583
+ __name(w10, "w");
71584
+ function v10(t11) {
71585
71585
  return t11.startIndex + t11[1].length;
71586
71586
  }
71587
- __name(y4, "y");
71588
- 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) {
71587
+ __name(v10, "v");
71588
+ 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) {
71589
71589
  return e11;
71590
71590
  }, "tagValueProcessor"), attributeValueProcessor: /* @__PURE__ */ __name(function(t11, e11) {
71591
71591
  return e11;
71592
- }, "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) {
71592
+ }, "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) {
71593
71593
  return t11;
71594
- }, "updateTag"), captureMetaData: false, maxNestedTags: 100, strictReservedNames: true };
71595
- function w10(t11) {
71596
- 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);
71594
+ }, "updateTag"), captureMetaData: false, maxNestedTags: 100, strictReservedNames: true, jPath: true, onDangerousProperty: T };
71595
+ function S(t11, e11) {
71596
+ if ("string" != typeof t11) return;
71597
+ const i11 = t11.toLowerCase();
71598
+ if (o10.some((t12) => i11 === t12.toLowerCase())) throw new Error(`[SECURITY] Invalid ${e11}: "${t11}" is a reserved JavaScript keyword that could cause prototype pollution`);
71599
+ if (a10.some((t12) => i11 === t12.toLowerCase())) throw new Error(`[SECURITY] Invalid ${e11}: "${t11}" is a reserved JavaScript keyword that could cause prototype pollution`);
71597
71600
  }
71598
- __name(w10, "w");
71599
- const v10 = /* @__PURE__ */ __name(function(t11) {
71600
- const e11 = Object.assign({}, T, t11);
71601
- return e11.processEntities = w10(e11.processEntities), e11;
71602
- }, "v");
71601
+ __name(S, "S");
71602
+ function A3(t11) {
71603
+ 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);
71604
+ }
71605
+ __name(A3, "A");
71606
+ const C3 = /* @__PURE__ */ __name(function(t11) {
71607
+ 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" }];
71608
+ for (const { value: t12, name: e12 } of i11) t12 && S(t12, e12);
71609
+ 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;
71610
+ }, "C");
71603
71611
  let O;
71604
71612
  O = "function" != typeof Symbol ? "@@xmlMetadata" : /* @__PURE__ */ Symbol("XML Node Metadata");
71605
- class I3 {
71613
+ class $ {
71606
71614
  static {
71607
- __name(this, "I");
71615
+ __name(this, "$");
71608
71616
  }
71609
71617
  constructor(t11) {
71610
71618
  this.tagname = t11, this.child = [], this[":@"] = /* @__PURE__ */ Object.create(null);
@@ -71619,201 +71627,418 @@ var require_fxp = __commonJS({
71619
71627
  return O;
71620
71628
  }
71621
71629
  }
71622
- class P {
71630
+ class I3 {
71623
71631
  static {
71624
- __name(this, "P");
71632
+ __name(this, "I");
71625
71633
  }
71626
71634
  constructor(t11) {
71627
71635
  this.suppressValidationErr = !t11, this.options = t11;
71628
71636
  }
71629
71637
  readDocType(t11, e11) {
71630
- const n11 = /* @__PURE__ */ Object.create(null);
71638
+ const i11 = /* @__PURE__ */ Object.create(null);
71639
+ let n11 = 0;
71631
71640
  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");
71632
71641
  {
71633
71642
  e11 += 9;
71634
- let i11 = 1, s11 = false, r11 = false, o11 = "";
71635
- for (; e11 < t11.length; e11++) if ("<" !== t11[e11] || r11) if (">" === t11[e11]) {
71636
- if (r11 ? "-" === t11[e11 - 1] && "-" === t11[e11 - 2] && (r11 = false, i11--) : i11--, 0 === i11) break;
71637
- } else "[" === t11[e11] ? s11 = true : o11 += t11[e11];
71643
+ let s11 = 1, r11 = false, o11 = false, a11 = "";
71644
+ for (; e11 < t11.length; e11++) if ("<" !== t11[e11] || o11) if (">" === t11[e11]) {
71645
+ if (o11 ? "-" === t11[e11 - 1] && "-" === t11[e11 - 2] && (o11 = false, s11--) : s11--, 0 === s11) break;
71646
+ } else "[" === t11[e11] ? r11 = true : a11 += t11[e11];
71638
71647
  else {
71639
- if (s11 && S(t11, "!ENTITY", e11)) {
71640
- let i12, s12;
71641
- if (e11 += 7, [i12, s12, e11] = this.readEntityExp(t11, e11 + 1, this.suppressValidationErr), -1 === s12.indexOf("&")) {
71642
- const t12 = i12.replace(/[.\-+*:]/g, "\\.");
71643
- n11[i12] = { regx: RegExp(`&${t12};`, "g"), val: s12 };
71648
+ if (r11 && _2(t11, "!ENTITY", e11)) {
71649
+ let s12, r12;
71650
+ if (e11 += 7, [s12, r12, e11] = this.readEntityExp(t11, e11 + 1, this.suppressValidationErr), -1 === r12.indexOf("&")) {
71651
+ 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})`);
71652
+ const t12 = s12.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
71653
+ i11[s12] = { regx: RegExp(`&${t12};`, "g"), val: r12 }, n11++;
71644
71654
  }
71645
- } else if (s11 && S(t11, "!ELEMENT", e11)) {
71655
+ } else if (r11 && _2(t11, "!ELEMENT", e11)) {
71646
71656
  e11 += 8;
71647
- const { index: n12 } = this.readElementExp(t11, e11 + 1);
71648
- e11 = n12;
71649
- } else if (s11 && S(t11, "!ATTLIST", e11)) e11 += 8;
71650
- else if (s11 && S(t11, "!NOTATION", e11)) {
71657
+ const { index: i12 } = this.readElementExp(t11, e11 + 1);
71658
+ e11 = i12;
71659
+ } else if (r11 && _2(t11, "!ATTLIST", e11)) e11 += 8;
71660
+ else if (r11 && _2(t11, "!NOTATION", e11)) {
71651
71661
  e11 += 9;
71652
- const { index: n12 } = this.readNotationExp(t11, e11 + 1, this.suppressValidationErr);
71653
- e11 = n12;
71662
+ const { index: i12 } = this.readNotationExp(t11, e11 + 1, this.suppressValidationErr);
71663
+ e11 = i12;
71654
71664
  } else {
71655
- if (!S(t11, "!--", e11)) throw new Error("Invalid DOCTYPE");
71656
- r11 = true;
71665
+ if (!_2(t11, "!--", e11)) throw new Error("Invalid DOCTYPE");
71666
+ o11 = true;
71657
71667
  }
71658
- i11++, o11 = "";
71668
+ s11++, a11 = "";
71659
71669
  }
71660
- if (0 !== i11) throw new Error("Unclosed DOCTYPE");
71670
+ if (0 !== s11) throw new Error("Unclosed DOCTYPE");
71661
71671
  }
71662
- return { entities: n11, i: e11 };
71672
+ return { entities: i11, i: e11 };
71663
71673
  }
71664
71674
  readEntityExp(t11, e11) {
71665
- e11 = A3(t11, e11);
71666
- let n11 = "";
71667
- for (; e11 < t11.length && !/\s/.test(t11[e11]) && '"' !== t11[e11] && "'" !== t11[e11]; ) n11 += t11[e11], e11++;
71668
- if (C3(n11), e11 = A3(t11, e11), !this.suppressValidationErr) {
71675
+ e11 = j10(t11, e11);
71676
+ let i11 = "";
71677
+ for (; e11 < t11.length && !/\s/.test(t11[e11]) && '"' !== t11[e11] && "'" !== t11[e11]; ) i11 += t11[e11], e11++;
71678
+ if (D3(i11), e11 = j10(t11, e11), !this.suppressValidationErr) {
71669
71679
  if ("SYSTEM" === t11.substring(e11, e11 + 6).toUpperCase()) throw new Error("External entities are not supported");
71670
71680
  if ("%" === t11[e11]) throw new Error("Parameter entities are not supported");
71671
71681
  }
71672
- let i11 = "";
71673
- 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})`);
71674
- return [n11, i11, --e11];
71682
+ let n11 = "";
71683
+ 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})`);
71684
+ return [i11, n11, --e11];
71675
71685
  }
71676
71686
  readNotationExp(t11, e11) {
71677
- e11 = A3(t11, e11);
71678
- let n11 = "";
71679
- for (; e11 < t11.length && !/\s/.test(t11[e11]); ) n11 += t11[e11], e11++;
71680
- !this.suppressValidationErr && C3(n11), e11 = A3(t11, e11);
71681
- const i11 = t11.substring(e11, e11 + 6).toUpperCase();
71682
- if (!this.suppressValidationErr && "SYSTEM" !== i11 && "PUBLIC" !== i11) throw new Error(`Expected SYSTEM or PUBLIC, found "${i11}"`);
71683
- e11 += i11.length, e11 = A3(t11, e11);
71687
+ e11 = j10(t11, e11);
71688
+ let i11 = "";
71689
+ for (; e11 < t11.length && !/\s/.test(t11[e11]); ) i11 += t11[e11], e11++;
71690
+ !this.suppressValidationErr && D3(i11), e11 = j10(t11, e11);
71691
+ const n11 = t11.substring(e11, e11 + 6).toUpperCase();
71692
+ if (!this.suppressValidationErr && "SYSTEM" !== n11 && "PUBLIC" !== n11) throw new Error(`Expected SYSTEM or PUBLIC, found "${n11}"`);
71693
+ e11 += n11.length, e11 = j10(t11, e11);
71684
71694
  let s11 = null, r11 = null;
71685
- if ("PUBLIC" === i11) [e11, s11] = this.readIdentifierVal(t11, e11, "publicIdentifier"), '"' !== t11[e11 = A3(t11, e11)] && "'" !== t11[e11] || ([e11, r11] = this.readIdentifierVal(t11, e11, "systemIdentifier"));
71686
- else if ("SYSTEM" === i11 && ([e11, r11] = this.readIdentifierVal(t11, e11, "systemIdentifier"), !this.suppressValidationErr && !r11)) throw new Error("Missing mandatory system identifier for SYSTEM notation");
71687
- return { notationName: n11, publicIdentifier: s11, systemIdentifier: r11, index: --e11 };
71695
+ if ("PUBLIC" === n11) [e11, s11] = this.readIdentifierVal(t11, e11, "publicIdentifier"), '"' !== t11[e11 = j10(t11, e11)] && "'" !== t11[e11] || ([e11, r11] = this.readIdentifierVal(t11, e11, "systemIdentifier"));
71696
+ else if ("SYSTEM" === n11 && ([e11, r11] = this.readIdentifierVal(t11, e11, "systemIdentifier"), !this.suppressValidationErr && !r11)) throw new Error("Missing mandatory system identifier for SYSTEM notation");
71697
+ return { notationName: i11, publicIdentifier: s11, systemIdentifier: r11, index: --e11 };
71688
71698
  }
71689
- readIdentifierVal(t11, e11, n11) {
71690
- let i11 = "";
71699
+ readIdentifierVal(t11, e11, i11) {
71700
+ let n11 = "";
71691
71701
  const s11 = t11[e11];
71692
71702
  if ('"' !== s11 && "'" !== s11) throw new Error(`Expected quoted string, found "${s11}"`);
71693
- for (e11++; e11 < t11.length && t11[e11] !== s11; ) i11 += t11[e11], e11++;
71694
- if (t11[e11] !== s11) throw new Error(`Unterminated ${n11} value`);
71695
- return [++e11, i11];
71703
+ for (e11++; e11 < t11.length && t11[e11] !== s11; ) n11 += t11[e11], e11++;
71704
+ if (t11[e11] !== s11) throw new Error(`Unterminated ${i11} value`);
71705
+ return [++e11, n11];
71696
71706
  }
71697
71707
  readElementExp(t11, e11) {
71698
- e11 = A3(t11, e11);
71699
- let n11 = "";
71700
- for (; e11 < t11.length && !/\s/.test(t11[e11]); ) n11 += t11[e11], e11++;
71701
- if (!this.suppressValidationErr && !r10(n11)) throw new Error(`Invalid element name: "${n11}"`);
71708
+ e11 = j10(t11, e11);
71702
71709
  let i11 = "";
71703
- if ("E" === t11[e11 = A3(t11, e11)] && S(t11, "MPTY", e11)) e11 += 4;
71704
- else if ("A" === t11[e11] && S(t11, "NY", e11)) e11 += 2;
71710
+ for (; e11 < t11.length && !/\s/.test(t11[e11]); ) i11 += t11[e11], e11++;
71711
+ if (!this.suppressValidationErr && !r10(i11)) throw new Error(`Invalid element name: "${i11}"`);
71712
+ let n11 = "";
71713
+ if ("E" === t11[e11 = j10(t11, e11)] && _2(t11, "MPTY", e11)) e11 += 4;
71714
+ else if ("A" === t11[e11] && _2(t11, "NY", e11)) e11 += 2;
71705
71715
  else if ("(" === t11[e11]) {
71706
- for (e11++; e11 < t11.length && ")" !== t11[e11]; ) i11 += t11[e11], e11++;
71716
+ for (e11++; e11 < t11.length && ")" !== t11[e11]; ) n11 += t11[e11], e11++;
71707
71717
  if (")" !== t11[e11]) throw new Error("Unterminated content model");
71708
71718
  } else if (!this.suppressValidationErr) throw new Error(`Invalid Element Expression, found "${t11[e11]}"`);
71709
- return { elementName: n11, contentModel: i11.trim(), index: e11 };
71719
+ return { elementName: i11, contentModel: n11.trim(), index: e11 };
71710
71720
  }
71711
71721
  readAttlistExp(t11, e11) {
71712
- e11 = A3(t11, e11);
71713
- let n11 = "";
71714
- for (; e11 < t11.length && !/\s/.test(t11[e11]); ) n11 += t11[e11], e11++;
71715
- C3(n11), e11 = A3(t11, e11);
71722
+ e11 = j10(t11, e11);
71716
71723
  let i11 = "";
71717
71724
  for (; e11 < t11.length && !/\s/.test(t11[e11]); ) i11 += t11[e11], e11++;
71718
- if (!C3(i11)) throw new Error(`Invalid attribute name: "${i11}"`);
71719
- e11 = A3(t11, e11);
71725
+ D3(i11), e11 = j10(t11, e11);
71726
+ let n11 = "";
71727
+ for (; e11 < t11.length && !/\s/.test(t11[e11]); ) n11 += t11[e11], e11++;
71728
+ if (!D3(n11)) throw new Error(`Invalid attribute name: "${n11}"`);
71729
+ e11 = j10(t11, e11);
71720
71730
  let s11 = "";
71721
71731
  if ("NOTATION" === t11.substring(e11, e11 + 8).toUpperCase()) {
71722
- if (s11 = "NOTATION", "(" !== t11[e11 = A3(t11, e11 += 8)]) throw new Error(`Expected '(', found "${t11[e11]}"`);
71732
+ if (s11 = "NOTATION", "(" !== t11[e11 = j10(t11, e11 += 8)]) throw new Error(`Expected '(', found "${t11[e11]}"`);
71723
71733
  e11++;
71724
- let n12 = [];
71734
+ let i12 = [];
71725
71735
  for (; e11 < t11.length && ")" !== t11[e11]; ) {
71726
- let i12 = "";
71727
- for (; e11 < t11.length && "|" !== t11[e11] && ")" !== t11[e11]; ) i12 += t11[e11], e11++;
71728
- if (i12 = i12.trim(), !C3(i12)) throw new Error(`Invalid notation name: "${i12}"`);
71729
- n12.push(i12), "|" === t11[e11] && (e11++, e11 = A3(t11, e11));
71736
+ let n12 = "";
71737
+ for (; e11 < t11.length && "|" !== t11[e11] && ")" !== t11[e11]; ) n12 += t11[e11], e11++;
71738
+ if (n12 = n12.trim(), !D3(n12)) throw new Error(`Invalid notation name: "${n12}"`);
71739
+ i12.push(n12), "|" === t11[e11] && (e11++, e11 = j10(t11, e11));
71730
71740
  }
71731
71741
  if (")" !== t11[e11]) throw new Error("Unterminated list of notations");
71732
- e11++, s11 += " (" + n12.join("|") + ")";
71742
+ e11++, s11 += " (" + i12.join("|") + ")";
71733
71743
  } else {
71734
71744
  for (; e11 < t11.length && !/\s/.test(t11[e11]); ) s11 += t11[e11], e11++;
71735
- const n12 = ["CDATA", "ID", "IDREF", "IDREFS", "ENTITY", "ENTITIES", "NMTOKEN", "NMTOKENS"];
71736
- if (!this.suppressValidationErr && !n12.includes(s11.toUpperCase())) throw new Error(`Invalid attribute type: "${s11}"`);
71745
+ const i12 = ["CDATA", "ID", "IDREF", "IDREFS", "ENTITY", "ENTITIES", "NMTOKEN", "NMTOKENS"];
71746
+ if (!this.suppressValidationErr && !i12.includes(s11.toUpperCase())) throw new Error(`Invalid attribute type: "${s11}"`);
71737
71747
  }
71738
- e11 = A3(t11, e11);
71748
+ e11 = j10(t11, e11);
71739
71749
  let r11 = "";
71740
- 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 };
71750
+ 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 };
71741
71751
  }
71742
71752
  }
71743
- const A3 = /* @__PURE__ */ __name((t11, e11) => {
71753
+ const j10 = /* @__PURE__ */ __name((t11, e11) => {
71744
71754
  for (; e11 < t11.length && /\s/.test(t11[e11]); ) e11++;
71745
71755
  return e11;
71746
- }, "A");
71747
- function S(t11, e11, n11) {
71748
- for (let i11 = 0; i11 < e11.length; i11++) if (e11[i11] !== t11[n11 + i11 + 1]) return false;
71756
+ }, "j");
71757
+ function _2(t11, e11, i11) {
71758
+ for (let n11 = 0; n11 < e11.length; n11++) if (e11[n11] !== t11[i11 + n11 + 1]) return false;
71749
71759
  return true;
71750
71760
  }
71751
- __name(S, "S");
71752
- function C3(t11) {
71761
+ __name(_2, "_");
71762
+ function D3(t11) {
71753
71763
  if (r10(t11)) return t11;
71754
71764
  throw new Error(`Invalid entity name ${t11}`);
71755
71765
  }
71756
- __name(C3, "C");
71757
- const $ = /^[-+]?0x[a-fA-F0-9]+$/, V = /^([\-\+])?(0*)([0-9]*(\.[0-9]*)?)$/, D3 = { hex: true, leadingZeros: true, decimalPoint: ".", eNotation: true };
71758
- const j10 = /^([-+])?(0*)(\d*(\.\d*)?[eE][-\+]?\d+)$/;
71759
- class L {
71766
+ __name(D3, "D");
71767
+ const V = /^[-+]?0x[a-fA-F0-9]+$/, k10 = /^([\-\+])?(0*)([0-9]*(\.[0-9]*)?)$/, F3 = { hex: true, leadingZeros: true, decimalPoint: ".", eNotation: true };
71768
+ const L = /^([-+])?(0*)(\d*(\.\d*)?[eE][-\+]?\d+)$/;
71769
+ class M {
71770
+ static {
71771
+ __name(this, "M");
71772
+ }
71773
+ constructor(t11 = {}) {
71774
+ this.separator = t11.separator || ".", this.path = [], this.siblingStacks = [];
71775
+ }
71776
+ push(t11, e11 = null, i11 = null) {
71777
+ this.path.length > 0 && (this.path[this.path.length - 1].values = void 0);
71778
+ const n11 = this.path.length;
71779
+ this.siblingStacks[n11] || (this.siblingStacks[n11] = /* @__PURE__ */ new Map());
71780
+ const s11 = this.siblingStacks[n11], r11 = i11 ? `${i11}:${t11}` : t11, o11 = s11.get(r11) || 0;
71781
+ let a11 = 0;
71782
+ for (const t12 of s11.values()) a11 += t12;
71783
+ s11.set(r11, o11 + 1);
71784
+ const h11 = { tag: t11, position: a11, counter: o11 };
71785
+ null != i11 && (h11.namespace = i11), null != e11 && (h11.values = e11), this.path.push(h11);
71786
+ }
71787
+ pop() {
71788
+ if (0 === this.path.length) return;
71789
+ const t11 = this.path.pop();
71790
+ return this.siblingStacks.length > this.path.length + 1 && (this.siblingStacks.length = this.path.length + 1), t11;
71791
+ }
71792
+ updateCurrent(t11) {
71793
+ if (this.path.length > 0) {
71794
+ const e11 = this.path[this.path.length - 1];
71795
+ null != t11 && (e11.values = t11);
71796
+ }
71797
+ }
71798
+ getCurrentTag() {
71799
+ return this.path.length > 0 ? this.path[this.path.length - 1].tag : void 0;
71800
+ }
71801
+ getCurrentNamespace() {
71802
+ return this.path.length > 0 ? this.path[this.path.length - 1].namespace : void 0;
71803
+ }
71804
+ getAttrValue(t11) {
71805
+ if (0 === this.path.length) return;
71806
+ const e11 = this.path[this.path.length - 1];
71807
+ return e11.values?.[t11];
71808
+ }
71809
+ hasAttr(t11) {
71810
+ if (0 === this.path.length) return false;
71811
+ const e11 = this.path[this.path.length - 1];
71812
+ return void 0 !== e11.values && t11 in e11.values;
71813
+ }
71814
+ getPosition() {
71815
+ return 0 === this.path.length ? -1 : this.path[this.path.length - 1].position ?? 0;
71816
+ }
71817
+ getCounter() {
71818
+ return 0 === this.path.length ? -1 : this.path[this.path.length - 1].counter ?? 0;
71819
+ }
71820
+ getIndex() {
71821
+ return this.getPosition();
71822
+ }
71823
+ getDepth() {
71824
+ return this.path.length;
71825
+ }
71826
+ toString(t11, e11 = true) {
71827
+ const i11 = t11 || this.separator;
71828
+ return this.path.map((t12) => e11 && t12.namespace ? `${t12.namespace}:${t12.tag}` : t12.tag).join(i11);
71829
+ }
71830
+ toArray() {
71831
+ return this.path.map((t11) => t11.tag);
71832
+ }
71833
+ reset() {
71834
+ this.path = [], this.siblingStacks = [];
71835
+ }
71836
+ matches(t11) {
71837
+ const e11 = t11.segments;
71838
+ return 0 !== e11.length && (t11.hasDeepWildcard() ? this._matchWithDeepWildcard(e11) : this._matchSimple(e11));
71839
+ }
71840
+ _matchSimple(t11) {
71841
+ if (this.path.length !== t11.length) return false;
71842
+ for (let e11 = 0; e11 < t11.length; e11++) {
71843
+ const i11 = t11[e11], n11 = this.path[e11], s11 = e11 === this.path.length - 1;
71844
+ if (!this._matchSegment(i11, n11, s11)) return false;
71845
+ }
71846
+ return true;
71847
+ }
71848
+ _matchWithDeepWildcard(t11) {
71849
+ let e11 = this.path.length - 1, i11 = t11.length - 1;
71850
+ for (; i11 >= 0 && e11 >= 0; ) {
71851
+ const n11 = t11[i11];
71852
+ if ("deep-wildcard" === n11.type) {
71853
+ if (i11--, i11 < 0) return true;
71854
+ const n12 = t11[i11];
71855
+ let s11 = false;
71856
+ for (let t12 = e11; t12 >= 0; t12--) {
71857
+ const r11 = t12 === this.path.length - 1;
71858
+ if (this._matchSegment(n12, this.path[t12], r11)) {
71859
+ e11 = t12 - 1, i11--, s11 = true;
71860
+ break;
71861
+ }
71862
+ }
71863
+ if (!s11) return false;
71864
+ } else {
71865
+ const t12 = e11 === this.path.length - 1;
71866
+ if (!this._matchSegment(n11, this.path[e11], t12)) return false;
71867
+ e11--, i11--;
71868
+ }
71869
+ }
71870
+ return i11 < 0;
71871
+ }
71872
+ _matchSegment(t11, e11, i11) {
71873
+ if ("*" !== t11.tag && t11.tag !== e11.tag) return false;
71874
+ if (void 0 !== t11.namespace && "*" !== t11.namespace && t11.namespace !== e11.namespace) return false;
71875
+ if (void 0 !== t11.attrName) {
71876
+ if (!i11) return false;
71877
+ if (!e11.values || !(t11.attrName in e11.values)) return false;
71878
+ if (void 0 !== t11.attrValue) {
71879
+ const i12 = e11.values[t11.attrName];
71880
+ if (String(i12) !== String(t11.attrValue)) return false;
71881
+ }
71882
+ }
71883
+ if (void 0 !== t11.position) {
71884
+ if (!i11) return false;
71885
+ const n11 = e11.counter ?? 0;
71886
+ if ("first" === t11.position && 0 !== n11) return false;
71887
+ if ("odd" === t11.position && n11 % 2 != 1) return false;
71888
+ if ("even" === t11.position && n11 % 2 != 0) return false;
71889
+ if ("nth" === t11.position && n11 !== t11.positionValue) return false;
71890
+ }
71891
+ return true;
71892
+ }
71893
+ snapshot() {
71894
+ return { path: this.path.map((t11) => ({ ...t11 })), siblingStacks: this.siblingStacks.map((t11) => new Map(t11)) };
71895
+ }
71896
+ restore(t11) {
71897
+ this.path = t11.path.map((t12) => ({ ...t12 })), this.siblingStacks = t11.siblingStacks.map((t12) => new Map(t12));
71898
+ }
71899
+ }
71900
+ class G3 {
71760
71901
  static {
71761
- __name(this, "L");
71902
+ __name(this, "G");
71903
+ }
71904
+ constructor(t11, e11 = {}) {
71905
+ 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);
71906
+ }
71907
+ _parse(t11) {
71908
+ const e11 = [];
71909
+ let i11 = 0, n11 = "";
71910
+ 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++);
71911
+ return n11.trim() && e11.push(this._parseSegment(n11.trim())), e11;
71912
+ }
71913
+ _parseSegment(t11) {
71914
+ const e11 = { type: "tag" };
71915
+ let i11 = null, n11 = t11;
71916
+ const s11 = t11.match(/^([^\[]+)(\[[^\]]*\])(.*)$/);
71917
+ if (s11 && (n11 = s11[1] + s11[3], s11[2])) {
71918
+ const t12 = s11[2].slice(1, -1);
71919
+ t12 && (i11 = t12);
71920
+ }
71921
+ let r11, o11, a11 = n11;
71922
+ if (n11.includes("::")) {
71923
+ const e12 = n11.indexOf("::");
71924
+ if (r11 = n11.substring(0, e12).trim(), a11 = n11.substring(e12 + 2).trim(), !r11) throw new Error(`Invalid namespace in pattern: ${t11}`);
71925
+ }
71926
+ let h11 = null;
71927
+ if (a11.includes(":")) {
71928
+ const t12 = a11.lastIndexOf(":"), e12 = a11.substring(0, t12).trim(), i12 = a11.substring(t12 + 1).trim();
71929
+ ["first", "last", "odd", "even"].includes(i12) || /^nth\(\d+\)$/.test(i12) ? (o11 = e12, h11 = i12) : o11 = a11;
71930
+ } else o11 = a11;
71931
+ if (!o11) throw new Error(`Invalid segment pattern: ${t11}`);
71932
+ if (e11.tag = o11, r11 && (e11.namespace = r11), i11) if (i11.includes("=")) {
71933
+ const t12 = i11.indexOf("=");
71934
+ e11.attrName = i11.substring(0, t12).trim(), e11.attrValue = i11.substring(t12 + 1).trim();
71935
+ } else e11.attrName = i11.trim();
71936
+ if (h11) {
71937
+ const t12 = h11.match(/^nth\((\d+)\)$/);
71938
+ t12 ? (e11.position = "nth", e11.positionValue = parseInt(t12[1], 10)) : e11.position = h11;
71939
+ }
71940
+ return e11;
71941
+ }
71942
+ get length() {
71943
+ return this.segments.length;
71944
+ }
71945
+ hasDeepWildcard() {
71946
+ return this._hasDeepWildcard;
71947
+ }
71948
+ hasAttributeCondition() {
71949
+ return this._hasAttributeCondition;
71950
+ }
71951
+ hasPositionSelector() {
71952
+ return this._hasPositionSelector;
71953
+ }
71954
+ toString() {
71955
+ return this.pattern;
71956
+ }
71957
+ }
71958
+ function R(t11, e11) {
71959
+ if (!t11) return {};
71960
+ const i11 = e11.attributesGroupName ? t11[e11.attributesGroupName] : t11;
71961
+ if (!i11) return {};
71962
+ const n11 = {};
71963
+ for (const t12 in i11) t12.startsWith(e11.attributeNamePrefix) ? n11[t12.substring(e11.attributeNamePrefix.length)] = i11[t12] : n11[t12] = i11[t12];
71964
+ return n11;
71965
+ }
71966
+ __name(R, "R");
71967
+ function U(t11) {
71968
+ if (!t11 || "string" != typeof t11) return;
71969
+ const e11 = t11.indexOf(":");
71970
+ if (-1 !== e11 && e11 > 0) {
71971
+ const i11 = t11.substring(0, e11);
71972
+ if ("xmlns" !== i11) return i11;
71973
+ }
71974
+ }
71975
+ __name(U, "U");
71976
+ class B3 {
71977
+ static {
71978
+ __name(this, "B");
71762
71979
  }
71763
71980
  constructor(t11) {
71764
71981
  var e11;
71765
- 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) => {
71766
- for (const n11 of e11) {
71767
- if ("string" == typeof n11 && t12 === n11) return true;
71768
- if (n11 instanceof RegExp && n11.test(t12)) return true;
71982
+ 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) => {
71983
+ for (const i11 of e11) {
71984
+ if ("string" == typeof i11 && t12 === i11) return true;
71985
+ if (i11 instanceof RegExp && i11.test(t12)) return true;
71769
71986
  }
71770
- } : () => false, this.entityExpansionCount = 0, this.currentExpandedLength = 0, this.options.stopNodes && this.options.stopNodes.length > 0) {
71771
- this.stopNodesExact = /* @__PURE__ */ new Set(), this.stopNodesWildcard = /* @__PURE__ */ new Set();
71987
+ } : () => false, this.entityExpansionCount = 0, this.currentExpandedLength = 0, this.matcher = new M(), this.isCurrentNodeStopNode = false, this.options.stopNodes && this.options.stopNodes.length > 0) {
71988
+ this.stopNodeExpressions = [];
71772
71989
  for (let t12 = 0; t12 < this.options.stopNodes.length; t12++) {
71773
71990
  const e12 = this.options.stopNodes[t12];
71774
- "string" == typeof e12 && (e12.startsWith("*.") ? this.stopNodesWildcard.add(e12.substring(2)) : this.stopNodesExact.add(e12));
71991
+ "string" == typeof e12 ? this.stopNodeExpressions.push(new G3(e12)) : e12 instanceof G3 && this.stopNodeExpressions.push(e12);
71775
71992
  }
71776
71993
  }
71777
71994
  }
71778
71995
  }
71779
- function F3(t11) {
71996
+ function W(t11) {
71780
71997
  const e11 = Object.keys(t11);
71781
- for (let n11 = 0; n11 < e11.length; n11++) {
71782
- const i11 = e11[n11], s11 = i11.replace(/[.\-+*:]/g, "\\.");
71783
- this.lastEntities[i11] = { regex: new RegExp("&" + s11 + ";", "g"), val: t11[i11] };
71998
+ for (let i11 = 0; i11 < e11.length; i11++) {
71999
+ const n11 = e11[i11], s11 = n11.replace(/[.\-+*:]/g, "\\.");
72000
+ this.lastEntities[n11] = { regex: new RegExp("&" + s11 + ";", "g"), val: t11[n11] };
71784
72001
  }
71785
72002
  }
71786
- __name(F3, "F");
71787
- function M(t11, e11, n11, i11, s11, r11, o11) {
71788
- if (void 0 !== t11 && (this.options.trimValues && !i11 && (t11 = t11.trim()), t11.length > 0)) {
71789
- o11 || (t11 = this.replaceEntitiesValue(t11, e11, n11));
71790
- const i12 = this.options.tagValueProcessor(e11, t11, n11, s11, r11);
71791
- 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;
72003
+ __name(W, "W");
72004
+ function Y(t11, e11, i11, n11, s11, r11, o11) {
72005
+ if (void 0 !== t11 && (this.options.trimValues && !n11 && (t11 = t11.trim()), t11.length > 0)) {
72006
+ o11 || (t11 = this.replaceEntitiesValue(t11, e11, i11));
72007
+ const n12 = this.options.jPath ? i11.toString() : i11, a11 = this.options.tagValueProcessor(e11, t11, n12, s11, r11);
72008
+ 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;
71792
72009
  }
71793
72010
  }
71794
- __name(M, "M");
71795
- function k10(t11) {
72011
+ __name(Y, "Y");
72012
+ function X(t11) {
71796
72013
  if (this.options.removeNSPrefix) {
71797
- const e11 = t11.split(":"), n11 = "/" === t11.charAt(0) ? "/" : "";
72014
+ const e11 = t11.split(":"), i11 = "/" === t11.charAt(0) ? "/" : "";
71798
72015
  if ("xmlns" === e11[0]) return "";
71799
- 2 === e11.length && (t11 = n11 + e11[1]);
72016
+ 2 === e11.length && (t11 = i11 + e11[1]);
71800
72017
  }
71801
72018
  return t11;
71802
72019
  }
71803
- __name(k10, "k");
71804
- const _2 = new RegExp(`([^\\s=]+)\\s*(=\\s*(['"])([\\s\\S]*?)\\3)?`, "gm");
71805
- function U(t11, e11, n11) {
72020
+ __name(X, "X");
72021
+ const z4 = new RegExp(`([^\\s=]+)\\s*(=\\s*(['"])([\\s\\S]*?)\\3)?`, "gm");
72022
+ function q10(t11, e11, i11) {
71806
72023
  if (true !== this.options.ignoreAttributes && "string" == typeof t11) {
71807
- const i11 = s10(t11, _2), r11 = i11.length, o11 = {};
72024
+ const n11 = s10(t11, z4), r11 = n11.length, o11 = {}, a11 = {};
72025
+ for (let t12 = 0; t12 < r11; t12++) {
72026
+ const s11 = this.resolveNameSpace(n11[t12][1]), r12 = n11[t12][4];
72027
+ if (s11.length && void 0 !== r12) {
72028
+ let t13 = r12;
72029
+ this.options.trimValues && (t13 = t13.trim()), t13 = this.replaceEntitiesValue(t13, i11, e11), a11[s11] = t13;
72030
+ }
72031
+ }
72032
+ Object.keys(a11).length > 0 && "object" == typeof e11 && e11.updateCurrent && e11.updateCurrent(a11);
71808
72033
  for (let t12 = 0; t12 < r11; t12++) {
71809
- const s11 = this.resolveNameSpace(i11[t12][1]);
71810
- if (this.ignoreAttributesFn(s11, e11)) continue;
71811
- let r12 = i11[t12][4], a11 = this.options.attributeNamePrefix + s11;
71812
- if (s11.length) if (this.options.transformAttributeName && (a11 = this.options.transformAttributeName(a11)), "__proto__" === a11 && (a11 = "#__proto__"), void 0 !== r12) {
71813
- this.options.trimValues && (r12 = r12.trim()), r12 = this.replaceEntitiesValue(r12, n11, e11);
71814
- const t13 = this.options.attributeValueProcessor(s11, r12, e11);
71815
- o11[a11] = null == t13 ? r12 : typeof t13 != typeof r12 || t13 !== r12 ? t13 : Z(r12, this.options.parseAttributeValue, this.options.numberParseOptions);
71816
- } else this.options.allowBooleanAttributes && (o11[a11] = true);
72034
+ const s11 = this.resolveNameSpace(n11[t12][1]), r12 = this.options.jPath ? e11.toString() : e11;
72035
+ if (this.ignoreAttributesFn(s11, r12)) continue;
72036
+ let a12 = n11[t12][4], h11 = this.options.attributeNamePrefix + s11;
72037
+ if (s11.length) if (this.options.transformAttributeName && (h11 = this.options.transformAttributeName(h11)), h11 = ot(h11, this.options), void 0 !== a12) {
72038
+ this.options.trimValues && (a12 = a12.trim()), a12 = this.replaceEntitiesValue(a12, i11, e11);
72039
+ const t13 = this.options.jPath ? e11.toString() : e11, n12 = this.options.attributeValueProcessor(s11, a12, t13);
72040
+ o11[h11] = null == n12 ? a12 : typeof n12 != typeof a12 || n12 !== a12 ? n12 : nt(a12, this.options.parseAttributeValue, this.options.numberParseOptions);
72041
+ } else this.options.allowBooleanAttributes && (o11[h11] = true);
71817
72042
  }
71818
72043
  if (!Object.keys(o11).length) return;
71819
72044
  if (this.options.attributesGroupName) {
@@ -71823,307 +72048,346 @@ var require_fxp = __commonJS({
71823
72048
  return o11;
71824
72049
  }
71825
72050
  }
71826
- __name(U, "U");
71827
- const R = /* @__PURE__ */ __name(function(t11) {
72051
+ __name(q10, "q");
72052
+ const Z = /* @__PURE__ */ __name(function(t11) {
71828
72053
  t11 = t11.replace(/\r\n?/g, "\n");
71829
- const e11 = new I3("!xml");
71830
- let n11 = e11, i11 = "", s11 = "";
71831
- this.entityExpansionCount = 0, this.currentExpandedLength = 0;
71832
- const r11 = new P(this.options.processEntities);
71833
- for (let o11 = 0; o11 < t11.length; o11++) if ("<" === t11[o11]) if ("/" === t11[o11 + 1]) {
71834
- const e12 = z4(t11, ">", o11, "Closing Tag is not closed.");
71835
- let r12 = t11.substring(o11 + 2, e12).trim();
72054
+ const e11 = new $("!xml");
72055
+ let i11 = e11, n11 = "";
72056
+ this.matcher.reset(), this.entityExpansionCount = 0, this.currentExpandedLength = 0;
72057
+ const s11 = new I3(this.options.processEntities);
72058
+ for (let r11 = 0; r11 < t11.length; r11++) if ("<" === t11[r11]) if ("/" === t11[r11 + 1]) {
72059
+ const e12 = tt(t11, ">", r11, "Closing Tag is not closed.");
72060
+ let s12 = t11.substring(r11 + 2, e12).trim();
71836
72061
  if (this.options.removeNSPrefix) {
71837
- const t12 = r12.indexOf(":");
71838
- -1 !== t12 && (r12 = r12.substr(t12 + 1));
71839
- }
71840
- this.options.transformTagName && (r12 = this.options.transformTagName(r12)), n11 && (i11 = this.saveTextToParentTag(i11, n11, s11));
71841
- const a11 = s11.substring(s11.lastIndexOf(".") + 1);
71842
- if (r12 && -1 !== this.options.unpairedTags.indexOf(r12)) throw new Error(`Unpaired tag can not be used as closing tag: </${r12}>`);
71843
- let l11 = 0;
71844
- 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;
71845
- } else if ("?" === t11[o11 + 1]) {
71846
- let e12 = W(t11, o11, false, "?>");
72062
+ const t12 = s12.indexOf(":");
72063
+ -1 !== t12 && (s12 = s12.substr(t12 + 1));
72064
+ }
72065
+ s12 = rt(this.options.transformTagName, s12, "", this.options).tagName, i11 && (n11 = this.saveTextToParentTag(n11, i11, this.matcher));
72066
+ const o11 = this.matcher.getCurrentTag();
72067
+ if (s12 && -1 !== this.options.unpairedTags.indexOf(s12)) throw new Error(`Unpaired tag can not be used as closing tag: </${s12}>`);
72068
+ 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;
72069
+ } else if ("?" === t11[r11 + 1]) {
72070
+ let e12 = et(t11, r11, false, "?>");
71847
72071
  if (!e12) throw new Error("Pi Tag is not closed.");
71848
- if (i11 = this.saveTextToParentTag(i11, n11, s11), this.options.ignoreDeclaration && "?xml" === e12.tagName || this.options.ignorePiTags) ;
72072
+ if (n11 = this.saveTextToParentTag(n11, i11, this.matcher), this.options.ignoreDeclaration && "?xml" === e12.tagName || this.options.ignorePiTags) ;
71849
72073
  else {
71850
- const t12 = new I3(e12.tagName);
71851
- 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);
72074
+ const t12 = new $(e12.tagName);
72075
+ 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);
71852
72076
  }
71853
- o11 = e12.closeIndex + 1;
71854
- } else if ("!--" === t11.substr(o11 + 1, 3)) {
71855
- const e12 = z4(t11, "-->", o11 + 4, "Comment is not closed.");
72077
+ r11 = e12.closeIndex + 1;
72078
+ } else if ("!--" === t11.substr(r11 + 1, 3)) {
72079
+ const e12 = tt(t11, "-->", r11 + 4, "Comment is not closed.");
71856
72080
  if (this.options.commentPropName) {
71857
- const r12 = t11.substring(o11 + 4, e12 - 2);
71858
- i11 = this.saveTextToParentTag(i11, n11, s11), n11.add(this.options.commentPropName, [{ [this.options.textNodeName]: r12 }]);
71859
- }
71860
- o11 = e12;
71861
- } else if ("!D" === t11.substr(o11 + 1, 2)) {
71862
- const e12 = r11.readDocType(t11, o11);
71863
- this.docTypeEntities = e12.entities, o11 = e12.i;
71864
- } else if ("![" === t11.substr(o11 + 1, 2)) {
71865
- const e12 = z4(t11, "]]>", o11, "CDATA is not closed.") - 2, r12 = t11.substring(o11 + 9, e12);
71866
- i11 = this.saveTextToParentTag(i11, n11, s11);
71867
- let a11 = this.parseTextData(r12, n11.tagname, s11, true, false, true, true);
71868
- null == a11 && (a11 = ""), this.options.cdataPropName ? n11.add(this.options.cdataPropName, [{ [this.options.textNodeName]: r12 }]) : n11.add(this.options.textNodeName, a11), o11 = e12 + 2;
72081
+ const s12 = t11.substring(r11 + 4, e12 - 2);
72082
+ n11 = this.saveTextToParentTag(n11, i11, this.matcher), i11.add(this.options.commentPropName, [{ [this.options.textNodeName]: s12 }]);
72083
+ }
72084
+ r11 = e12;
72085
+ } else if ("!D" === t11.substr(r11 + 1, 2)) {
72086
+ const e12 = s11.readDocType(t11, r11);
72087
+ this.docTypeEntities = e12.entities, r11 = e12.i;
72088
+ } else if ("![" === t11.substr(r11 + 1, 2)) {
72089
+ const e12 = tt(t11, "]]>", r11, "CDATA is not closed.") - 2, s12 = t11.substring(r11 + 9, e12);
72090
+ n11 = this.saveTextToParentTag(n11, i11, this.matcher);
72091
+ let o11 = this.parseTextData(s12, i11.tagname, this.matcher, true, false, true, true);
72092
+ null == o11 && (o11 = ""), this.options.cdataPropName ? i11.add(this.options.cdataPropName, [{ [this.options.textNodeName]: s12 }]) : i11.add(this.options.textNodeName, o11), r11 = e12 + 2;
71869
72093
  } else {
71870
- let r12 = W(t11, o11, this.options.removeNSPrefix), a11 = r12.tagName;
71871
- const l11 = r12.rawTagName;
71872
- let u11 = r12.tagExp, d11 = r12.attrExpPresent, h11 = r12.closeIndex;
71873
- if (this.options.transformTagName) {
71874
- const t12 = this.options.transformTagName(a11);
71875
- u11 === a11 && (u11 = t12), a11 = t12;
71876
- }
71877
- if (this.options.strictReservedNames && (a11 === this.options.commentPropName || a11 === this.options.cdataPropName)) throw new Error(`Invalid tag name: ${a11}`);
71878
- n11 && i11 && "!xml" !== n11.tagname && (i11 = this.saveTextToParentTag(i11, n11, s11, false));
71879
- const p11 = n11;
71880
- 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);
71881
- const c11 = o11;
71882
- if (this.isItStopNode(this.stopNodesExact, this.stopNodesWildcard, s11, a11)) {
72094
+ let s12 = et(t11, r11, this.options.removeNSPrefix);
72095
+ if (!s12) {
72096
+ const e12 = t11.substring(Math.max(0, r11 - 50), Math.min(t11.length, r11 + 50));
72097
+ throw new Error(`readTagExp returned undefined at position ${r11}. Context: "${e12}"`);
72098
+ }
72099
+ let o11 = s12.tagName;
72100
+ const a11 = s12.rawTagName;
72101
+ let h11 = s12.tagExp, l11 = s12.attrExpPresent, p11 = s12.closeIndex;
72102
+ 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}`);
72103
+ i11 && n11 && "!xml" !== i11.tagname && (n11 = this.saveTextToParentTag(n11, i11, this.matcher, false));
72104
+ const u11 = i11;
72105
+ u11 && -1 !== this.options.unpairedTags.indexOf(u11.tagname) && (i11 = this.tagsNodeStack.pop(), this.matcher.pop());
72106
+ let c11 = false;
72107
+ 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);
72108
+ let d11, f11 = null, g11 = {};
72109
+ 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));
72110
+ const m11 = r11;
72111
+ if (this.isCurrentNodeStopNode) {
71883
72112
  let e12 = "";
71884
- 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;
71885
- else if (-1 !== this.options.unpairedTags.indexOf(a11)) o11 = r12.closeIndex;
72113
+ if (c11) r11 = s12.closeIndex;
72114
+ else if (-1 !== this.options.unpairedTags.indexOf(o11)) r11 = s12.closeIndex;
71886
72115
  else {
71887
- const n12 = this.readStopNodeData(t11, l11, h11 + 1);
71888
- if (!n12) throw new Error(`Unexpected end of ${l11}`);
71889
- o11 = n12.i, e12 = n12.tagContent;
72116
+ const i12 = this.readStopNodeData(t11, a11, p11 + 1);
72117
+ if (!i12) throw new Error(`Unexpected end of ${a11}`);
72118
+ r11 = i12.i, e12 = i12.tagContent;
71890
72119
  }
71891
- const i12 = new I3(a11);
71892
- 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);
72120
+ const n12 = new $(o11);
72121
+ f11 && (n12[":@"] = f11), n12.add(this.options.textNodeName, e12), this.matcher.pop(), this.isCurrentNodeStopNode = false, this.addChild(i11, n12, this.matcher, m11);
71893
72122
  } else {
71894
- if (u11.length > 0 && u11.lastIndexOf("/") === u11.length - 1) {
71895
- 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) {
71896
- const t13 = this.options.transformTagName(a11);
71897
- u11 === a11 && (u11 = t13), a11 = t13;
71898
- }
71899
- const t12 = new I3(a11);
71900
- a11 !== u11 && d11 && (t12[":@"] = this.buildAttributesMap(u11, s11, a11)), this.addChild(n11, t12, s11, c11), s11 = s11.substr(0, s11.lastIndexOf("."));
72123
+ if (c11) {
72124
+ ({ tagName: o11, tagExp: h11 } = rt(this.options.transformTagName, o11, h11, this.options));
72125
+ const t12 = new $(o11);
72126
+ f11 && (t12[":@"] = f11), this.addChild(i11, t12, this.matcher, m11), this.matcher.pop(), this.isCurrentNodeStopNode = false;
71901
72127
  } else {
71902
- if (-1 !== this.options.unpairedTags.indexOf(a11)) {
71903
- const t12 = new I3(a11);
71904
- a11 !== u11 && d11 && (t12[":@"] = this.buildAttributesMap(u11, s11)), this.addChild(n11, t12, s11, c11), s11 = s11.substr(0, s11.lastIndexOf(".")), o11 = r12.closeIndex;
72128
+ if (-1 !== this.options.unpairedTags.indexOf(o11)) {
72129
+ const t12 = new $(o11);
72130
+ f11 && (t12[":@"] = f11), this.addChild(i11, t12, this.matcher, m11), this.matcher.pop(), this.isCurrentNodeStopNode = false, r11 = s12.closeIndex;
71905
72131
  continue;
71906
72132
  }
71907
72133
  {
71908
- const t12 = new I3(a11);
72134
+ const t12 = new $(o11);
71909
72135
  if (this.tagsNodeStack.length > this.options.maxNestedTags) throw new Error("Maximum nested tags exceeded");
71910
- this.tagsNodeStack.push(n11), a11 !== u11 && d11 && (t12[":@"] = this.buildAttributesMap(u11, s11, a11)), this.addChild(n11, t12, s11, c11), n11 = t12;
72136
+ this.tagsNodeStack.push(i11), f11 && (t12[":@"] = f11), this.addChild(i11, t12, this.matcher, m11), i11 = t12;
71911
72137
  }
71912
72138
  }
71913
- i11 = "", o11 = h11;
72139
+ n11 = "", r11 = p11;
71914
72140
  }
71915
72141
  }
71916
- else i11 += t11[o11];
72142
+ else n11 += t11[r11];
71917
72143
  return e11.child;
71918
- }, "R");
71919
- function B3(t11, e11, n11, i11) {
71920
- this.options.captureMetaData || (i11 = void 0);
71921
- const s11 = this.options.updateTag(e11.tagname, n11, e11[":@"]);
71922
- false === s11 || ("string" == typeof s11 ? (e11.tagname = s11, t11.addChild(e11, i11)) : t11.addChild(e11, i11));
71923
- }
71924
- __name(B3, "B");
71925
- const Y = /* @__PURE__ */ __name(function(t11, e11, n11) {
71926
- if (-1 === t11.indexOf("&")) return t11;
71927
- const i11 = this.options.processEntities;
71928
- if (!i11.enabled) return t11;
71929
- if (i11.allowedTags && !i11.allowedTags.includes(e11)) return t11;
71930
- if (i11.tagFilter && !i11.tagFilter(e11, n11)) return t11;
71931
- for (let e12 in this.docTypeEntities) {
71932
- const n12 = this.docTypeEntities[e12], s11 = t11.match(n12.regx);
72144
+ }, "Z");
72145
+ function J3(t11, e11, i11, n11) {
72146
+ this.options.captureMetaData || (n11 = void 0);
72147
+ const s11 = this.options.jPath ? i11.toString() : i11, r11 = this.options.updateTag(e11.tagname, s11, e11[":@"]);
72148
+ false === r11 || ("string" == typeof r11 ? (e11.tagname = r11, t11.addChild(e11, n11)) : t11.addChild(e11, n11));
72149
+ }
72150
+ __name(J3, "J");
72151
+ function K(t11, e11, i11) {
72152
+ const n11 = this.options.processEntities;
72153
+ if (!n11 || !n11.enabled) return t11;
72154
+ if (n11.allowedTags) {
72155
+ const s11 = this.options.jPath ? i11.toString() : i11;
72156
+ if (!(Array.isArray(n11.allowedTags) ? n11.allowedTags.includes(e11) : n11.allowedTags(e11, s11))) return t11;
72157
+ }
72158
+ if (n11.tagFilter) {
72159
+ const s11 = this.options.jPath ? i11.toString() : i11;
72160
+ if (!n11.tagFilter(e11, s11)) return t11;
72161
+ }
72162
+ for (const e12 of Object.keys(this.docTypeEntities)) {
72163
+ const i12 = this.docTypeEntities[e12], s11 = t11.match(i12.regx);
71933
72164
  if (s11) {
71934
- if (this.entityExpansionCount += s11.length, i11.maxTotalExpansions && this.entityExpansionCount > i11.maxTotalExpansions) throw new Error(`Entity expansion limit exceeded: ${this.entityExpansionCount} > ${i11.maxTotalExpansions}`);
72165
+ if (this.entityExpansionCount += s11.length, n11.maxTotalExpansions && this.entityExpansionCount > n11.maxTotalExpansions) throw new Error(`Entity expansion limit exceeded: ${this.entityExpansionCount} > ${n11.maxTotalExpansions}`);
71935
72166
  const e13 = t11.length;
71936
- 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}`);
72167
+ 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}`);
71937
72168
  }
71938
72169
  }
71939
- if (-1 === t11.indexOf("&")) return t11;
71940
- for (let e12 in this.lastEntities) {
71941
- const n12 = this.lastEntities[e12];
71942
- t11 = t11.replace(n12.regex, n12.val);
72170
+ for (const e12 of Object.keys(this.lastEntities)) {
72171
+ const i12 = this.lastEntities[e12], s11 = t11.match(i12.regex);
72172
+ if (s11 && (this.entityExpansionCount += s11.length, n11.maxTotalExpansions && this.entityExpansionCount > n11.maxTotalExpansions)) throw new Error(`Entity expansion limit exceeded: ${this.entityExpansionCount} > ${n11.maxTotalExpansions}`);
72173
+ t11 = t11.replace(i12.regex, i12.val);
71943
72174
  }
71944
72175
  if (-1 === t11.indexOf("&")) return t11;
71945
- if (this.options.htmlEntities) for (let e12 in this.htmlEntities) {
71946
- const n12 = this.htmlEntities[e12];
71947
- t11 = t11.replace(n12.regex, n12.val);
72176
+ if (this.options.htmlEntities) for (const e12 of Object.keys(this.htmlEntities)) {
72177
+ const i12 = this.htmlEntities[e12], s11 = t11.match(i12.regex);
72178
+ if (s11 && (this.entityExpansionCount += s11.length, n11.maxTotalExpansions && this.entityExpansionCount > n11.maxTotalExpansions)) throw new Error(`Entity expansion limit exceeded: ${this.entityExpansionCount} > ${n11.maxTotalExpansions}`);
72179
+ t11 = t11.replace(i12.regex, i12.val);
71948
72180
  }
71949
72181
  return t11.replace(this.ampEntity.regex, this.ampEntity.val);
71950
- }, "Y");
71951
- function G3(t11, e11, n11, i11) {
71952
- 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;
71953
72182
  }
71954
- __name(G3, "G");
71955
- function X(t11, e11, n11, i11) {
71956
- return !(!e11 || !e11.has(i11)) || !(!t11 || !t11.has(n11));
72183
+ __name(K, "K");
72184
+ function Q(t11, e11, i11, n11) {
72185
+ 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;
72186
+ }
72187
+ __name(Q, "Q");
72188
+ function H3(t11, e11) {
72189
+ if (!t11 || 0 === t11.length) return false;
72190
+ for (let i11 = 0; i11 < t11.length; i11++) if (e11.matches(t11[i11])) return true;
72191
+ return false;
71957
72192
  }
71958
- __name(X, "X");
71959
- function z4(t11, e11, n11, i11) {
71960
- const s11 = t11.indexOf(e11, n11);
71961
- if (-1 === s11) throw new Error(i11);
72193
+ __name(H3, "H");
72194
+ function tt(t11, e11, i11, n11) {
72195
+ const s11 = t11.indexOf(e11, i11);
72196
+ if (-1 === s11) throw new Error(n11);
71962
72197
  return s11 + e11.length - 1;
71963
72198
  }
71964
- __name(z4, "z");
71965
- function W(t11, e11, n11, i11 = ">") {
71966
- const s11 = (function(t12, e12, n12 = ">") {
71967
- let i12, s12 = "";
72199
+ __name(tt, "tt");
72200
+ function et(t11, e11, i11, n11 = ">") {
72201
+ const s11 = (function(t12, e12, i12 = ">") {
72202
+ let n12, s12 = "";
71968
72203
  for (let r12 = e12; r12 < t12.length; r12++) {
71969
72204
  let e13 = t12[r12];
71970
- if (i12) e13 === i12 && (i12 = "");
71971
- else if ('"' === e13 || "'" === e13) i12 = e13;
71972
- else if (e13 === n12[0]) {
71973
- if (!n12[1]) return { data: s12, index: r12 };
71974
- if (t12[r12 + 1] === n12[1]) return { data: s12, index: r12 };
72205
+ if (n12) e13 === n12 && (n12 = "");
72206
+ else if ('"' === e13 || "'" === e13) n12 = e13;
72207
+ else if (e13 === i12[0]) {
72208
+ if (!i12[1]) return { data: s12, index: r12 };
72209
+ if (t12[r12 + 1] === i12[1]) return { data: s12, index: r12 };
71975
72210
  } else " " === e13 && (e13 = " ");
71976
72211
  s12 += e13;
71977
72212
  }
71978
- })(t11, e11 + 1, i11);
72213
+ })(t11, e11 + 1, n11);
71979
72214
  if (!s11) return;
71980
72215
  let r11 = s11.data;
71981
72216
  const o11 = s11.index, a11 = r11.search(/\s/);
71982
- let l11 = r11, u11 = true;
71983
- -1 !== a11 && (l11 = r11.substring(0, a11), r11 = r11.substring(a11 + 1).trimStart());
71984
- const d11 = l11;
71985
- if (n11) {
71986
- const t12 = l11.indexOf(":");
71987
- -1 !== t12 && (l11 = l11.substr(t12 + 1), u11 = l11 !== s11.data.substr(t12 + 1));
72217
+ let h11 = r11, l11 = true;
72218
+ -1 !== a11 && (h11 = r11.substring(0, a11), r11 = r11.substring(a11 + 1).trimStart());
72219
+ const p11 = h11;
72220
+ if (i11) {
72221
+ const t12 = h11.indexOf(":");
72222
+ -1 !== t12 && (h11 = h11.substr(t12 + 1), l11 = h11 !== s11.data.substr(t12 + 1));
71988
72223
  }
71989
- return { tagName: l11, tagExp: r11, closeIndex: o11, attrExpPresent: u11, rawTagName: d11 };
72224
+ return { tagName: h11, tagExp: r11, closeIndex: o11, attrExpPresent: l11, rawTagName: p11 };
71990
72225
  }
71991
- __name(W, "W");
71992
- function q10(t11, e11, n11) {
71993
- const i11 = n11;
72226
+ __name(et, "et");
72227
+ function it(t11, e11, i11) {
72228
+ const n11 = i11;
71994
72229
  let s11 = 1;
71995
- for (; n11 < t11.length; n11++) if ("<" === t11[n11]) if ("/" === t11[n11 + 1]) {
71996
- const r11 = z4(t11, ">", n11, `${e11} is not closed`);
71997
- if (t11.substring(n11 + 2, r11).trim() === e11 && (s11--, 0 === s11)) return { tagContent: t11.substring(i11, n11), i: r11 };
71998
- n11 = r11;
71999
- } else if ("?" === t11[n11 + 1]) n11 = z4(t11, "?>", n11 + 1, "StopNode is not closed.");
72000
- else if ("!--" === t11.substr(n11 + 1, 3)) n11 = z4(t11, "-->", n11 + 3, "StopNode is not closed.");
72001
- else if ("![" === t11.substr(n11 + 1, 2)) n11 = z4(t11, "]]>", n11, "StopNode is not closed.") - 2;
72230
+ for (; i11 < t11.length; i11++) if ("<" === t11[i11]) if ("/" === t11[i11 + 1]) {
72231
+ const r11 = tt(t11, ">", i11, `${e11} is not closed`);
72232
+ if (t11.substring(i11 + 2, r11).trim() === e11 && (s11--, 0 === s11)) return { tagContent: t11.substring(n11, i11), i: r11 };
72233
+ i11 = r11;
72234
+ } else if ("?" === t11[i11 + 1]) i11 = tt(t11, "?>", i11 + 1, "StopNode is not closed.");
72235
+ else if ("!--" === t11.substr(i11 + 1, 3)) i11 = tt(t11, "-->", i11 + 3, "StopNode is not closed.");
72236
+ else if ("![" === t11.substr(i11 + 1, 2)) i11 = tt(t11, "]]>", i11, "StopNode is not closed.") - 2;
72002
72237
  else {
72003
- const i12 = W(t11, n11, ">");
72004
- i12 && ((i12 && i12.tagName) === e11 && "/" !== i12.tagExp[i12.tagExp.length - 1] && s11++, n11 = i12.closeIndex);
72238
+ const n12 = et(t11, i11, ">");
72239
+ n12 && ((n12 && n12.tagName) === e11 && "/" !== n12.tagExp[n12.tagExp.length - 1] && s11++, i11 = n12.closeIndex);
72005
72240
  }
72006
72241
  }
72007
- __name(q10, "q");
72008
- function Z(t11, e11, n11) {
72242
+ __name(it, "it");
72243
+ function nt(t11, e11, i11) {
72009
72244
  if (e11 && "string" == typeof t11) {
72010
72245
  const e12 = t11.trim();
72011
72246
  return "true" === e12 || "false" !== e12 && (function(t12, e13 = {}) {
72012
- if (e13 = Object.assign({}, D3, e13), !t12 || "string" != typeof t12) return t12;
72013
- let n12 = t12.trim();
72014
- if (void 0 !== e13.skipLike && e13.skipLike.test(n12)) return t12;
72247
+ if (e13 = Object.assign({}, F3, e13), !t12 || "string" != typeof t12) return t12;
72248
+ let i12 = t12.trim();
72249
+ if (void 0 !== e13.skipLike && e13.skipLike.test(i12)) return t12;
72015
72250
  if ("0" === t12) return 0;
72016
- if (e13.hex && $.test(n12)) return (function(t13) {
72251
+ if (e13.hex && V.test(i12)) return (function(t13) {
72017
72252
  if (parseInt) return parseInt(t13, 16);
72018
72253
  if (Number.parseInt) return Number.parseInt(t13, 16);
72019
72254
  if (window && window.parseInt) return window.parseInt(t13, 16);
72020
72255
  throw new Error("parseInt, Number.parseInt, window.parseInt are not supported");
72021
- })(n12);
72022
- if (n12.includes("e") || n12.includes("E")) return (function(t13, e14, n13) {
72023
- if (!n13.eNotation) return t13;
72024
- const i12 = e14.match(j10);
72025
- if (i12) {
72026
- let s11 = i12[1] || "";
72027
- const r11 = -1 === i12[3].indexOf("e") ? "E" : "e", o11 = i12[2], a11 = s11 ? t13[o11.length + 1] === r11 : t13[o11.length] === r11;
72028
- 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);
72256
+ })(i12);
72257
+ if (i12.includes("e") || i12.includes("E")) return (function(t13, e14, i13) {
72258
+ if (!i13.eNotation) return t13;
72259
+ const n12 = e14.match(L);
72260
+ if (n12) {
72261
+ let s11 = n12[1] || "";
72262
+ const r11 = -1 === n12[3].indexOf("e") ? "E" : "e", o11 = n12[2], a11 = s11 ? t13[o11.length + 1] === r11 : t13[o11.length] === r11;
72263
+ 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);
72029
72264
  }
72030
72265
  return t13;
72031
- })(t12, n12, e13);
72266
+ })(t12, i12, e13);
72032
72267
  {
72033
- const s11 = V.exec(n12);
72268
+ const s11 = k10.exec(i12);
72034
72269
  if (s11) {
72035
72270
  const r11 = s11[1] || "", o11 = s11[2];
72036
- 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;
72037
- const l11 = r11 ? "." === t12[o11.length + 1] : "." === t12[o11.length];
72038
- if (!e13.leadingZeros && (o11.length > 1 || 1 === o11.length && !l11)) return t12;
72271
+ 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;
72272
+ const h11 = r11 ? "." === t12[o11.length + 1] : "." === t12[o11.length];
72273
+ if (!e13.leadingZeros && (o11.length > 1 || 1 === o11.length && !h11)) return t12;
72039
72274
  {
72040
- const i12 = Number(n12), s12 = String(i12);
72041
- if (0 === i12) return i12;
72042
- if (-1 !== s12.search(/[eE]/)) return e13.eNotation ? i12 : t12;
72043
- if (-1 !== n12.indexOf(".")) return "0" === s12 || s12 === a11 || s12 === `${r11}${a11}` ? i12 : t12;
72044
- let l12 = o11 ? a11 : n12;
72045
- return o11 ? l12 === s12 || r11 + l12 === s12 ? i12 : t12 : l12 === s12 || l12 === r11 + s12 ? i12 : t12;
72275
+ const n12 = Number(i12), s12 = String(n12);
72276
+ if (0 === n12) return n12;
72277
+ if (-1 !== s12.search(/[eE]/)) return e13.eNotation ? n12 : t12;
72278
+ if (-1 !== i12.indexOf(".")) return "0" === s12 || s12 === a11 || s12 === `${r11}${a11}` ? n12 : t12;
72279
+ let h12 = o11 ? a11 : i12;
72280
+ return o11 ? h12 === s12 || r11 + h12 === s12 ? n12 : t12 : h12 === s12 || h12 === r11 + s12 ? n12 : t12;
72046
72281
  }
72047
72282
  }
72048
72283
  return t12;
72049
72284
  }
72050
- var i11;
72051
- })(t11, n11);
72285
+ var n11;
72286
+ })(t11, i11);
72052
72287
  }
72053
72288
  return void 0 !== t11 ? t11 : "";
72054
72289
  }
72055
- __name(Z, "Z");
72056
- function K(t11, e11, n11) {
72057
- const i11 = Number.parseInt(t11, e11);
72058
- return i11 >= 0 && i11 <= 1114111 ? String.fromCodePoint(i11) : n11 + t11 + ";";
72290
+ __name(nt, "nt");
72291
+ function st(t11, e11, i11) {
72292
+ const n11 = Number.parseInt(t11, e11);
72293
+ return n11 >= 0 && n11 <= 1114111 ? String.fromCodePoint(n11) : i11 + t11 + ";";
72294
+ }
72295
+ __name(st, "st");
72296
+ function rt(t11, e11, i11, n11) {
72297
+ if (t11) {
72298
+ const n12 = t11(e11);
72299
+ i11 === e11 && (i11 = n12), e11 = n12;
72300
+ }
72301
+ return { tagName: e11 = ot(e11, n11), tagExp: i11 };
72059
72302
  }
72060
- __name(K, "K");
72061
- const Q = I3.getMetaDataSymbol();
72062
- function J3(t11, e11) {
72063
- return H3(t11, e11);
72303
+ __name(rt, "rt");
72304
+ function ot(t11, e11) {
72305
+ if (a10.includes(t11)) throw new Error(`[SECURITY] Invalid name: "${t11}" is a reserved JavaScript keyword that could cause prototype pollution`);
72306
+ return o10.includes(t11) ? e11.onDangerousProperty(t11) : t11;
72064
72307
  }
72065
- __name(J3, "J");
72066
- function H3(t11, e11, n11) {
72067
- let i11;
72308
+ __name(ot, "ot");
72309
+ const at = $.getMetaDataSymbol();
72310
+ function ht(t11, e11) {
72311
+ if (!t11 || "object" != typeof t11) return {};
72312
+ if (!e11) return t11;
72313
+ const i11 = {};
72314
+ for (const n11 in t11) n11.startsWith(e11) ? i11[n11.substring(e11.length)] = t11[n11] : i11[n11] = t11[n11];
72315
+ return i11;
72316
+ }
72317
+ __name(ht, "ht");
72318
+ function lt(t11, e11, i11) {
72319
+ return pt(t11, e11, i11);
72320
+ }
72321
+ __name(lt, "lt");
72322
+ function pt(t11, e11, i11) {
72323
+ let n11;
72068
72324
  const s11 = {};
72069
72325
  for (let r11 = 0; r11 < t11.length; r11++) {
72070
- const o11 = t11[r11], a11 = tt(o11);
72071
- let l11 = "";
72072
- if (l11 = void 0 === n11 ? a11 : n11 + "." + a11, a11 === e11.textNodeName) void 0 === i11 ? i11 = o11[a11] : i11 += "" + o11[a11];
72326
+ const o11 = t11[r11], a11 = ut(o11);
72327
+ if (void 0 !== a11 && a11 !== e11.textNodeName) {
72328
+ const t12 = ht(o11[":@"] || {}, e11.attributeNamePrefix);
72329
+ i11.push(a11, t12);
72330
+ }
72331
+ if (a11 === e11.textNodeName) void 0 === n11 ? n11 = o11[a11] : n11 += "" + o11[a11];
72073
72332
  else {
72074
72333
  if (void 0 === a11) continue;
72075
72334
  if (o11[a11]) {
72076
- let t12 = H3(o11[a11], e11, l11);
72077
- const n12 = nt(t12, e11);
72078
- 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;
72335
+ let t12 = pt(o11[a11], e11, i11);
72336
+ const n12 = dt(t12, e11);
72337
+ 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);
72338
+ else {
72339
+ const r12 = e11.jPath ? i11.toString() : i11;
72340
+ e11.isArray(a11, r12, n12) ? s11[a11] = [t12] : s11[a11] = t12;
72341
+ }
72342
+ void 0 !== a11 && a11 !== e11.textNodeName && i11.pop();
72079
72343
  }
72080
72344
  }
72081
72345
  }
72082
- return "string" == typeof i11 ? i11.length > 0 && (s11[e11.textNodeName] = i11) : void 0 !== i11 && (s11[e11.textNodeName] = i11), s11;
72346
+ return "string" == typeof n11 ? n11.length > 0 && (s11[e11.textNodeName] = n11) : void 0 !== n11 && (s11[e11.textNodeName] = n11), s11;
72083
72347
  }
72084
- __name(H3, "H");
72085
- function tt(t11) {
72348
+ __name(pt, "pt");
72349
+ function ut(t11) {
72086
72350
  const e11 = Object.keys(t11);
72087
72351
  for (let t12 = 0; t12 < e11.length; t12++) {
72088
- const n11 = e11[t12];
72089
- if (":@" !== n11) return n11;
72352
+ const i11 = e11[t12];
72353
+ if (":@" !== i11) return i11;
72090
72354
  }
72091
72355
  }
72092
- __name(tt, "tt");
72093
- function et(t11, e11, n11, i11) {
72356
+ __name(ut, "ut");
72357
+ function ct(t11, e11, i11, n11) {
72094
72358
  if (e11) {
72095
72359
  const s11 = Object.keys(e11), r11 = s11.length;
72096
72360
  for (let o11 = 0; o11 < r11; o11++) {
72097
- const r12 = s11[o11];
72098
- i11.isArray(r12, n11 + "." + r12, true, true) ? t11[r12] = [e11[r12]] : t11[r12] = e11[r12];
72361
+ const r12 = s11[o11], a11 = r12.startsWith(n11.attributeNamePrefix) ? r12.substring(n11.attributeNamePrefix.length) : r12, h11 = n11.jPath ? i11.toString() + "." + a11 : i11;
72362
+ n11.isArray(r12, h11, true, true) ? t11[r12] = [e11[r12]] : t11[r12] = e11[r12];
72099
72363
  }
72100
72364
  }
72101
72365
  }
72102
- __name(et, "et");
72103
- function nt(t11, e11) {
72104
- const { textNodeName: n11 } = e11, i11 = Object.keys(t11).length;
72105
- return 0 === i11 || !(1 !== i11 || !t11[n11] && "boolean" != typeof t11[n11] && 0 !== t11[n11]);
72366
+ __name(ct, "ct");
72367
+ function dt(t11, e11) {
72368
+ const { textNodeName: i11 } = e11, n11 = Object.keys(t11).length;
72369
+ return 0 === n11 || !(1 !== n11 || !t11[i11] && "boolean" != typeof t11[i11] && 0 !== t11[i11]);
72106
72370
  }
72107
- __name(nt, "nt");
72108
- class it {
72371
+ __name(dt, "dt");
72372
+ class ft {
72109
72373
  static {
72110
- __name(this, "it");
72374
+ __name(this, "ft");
72111
72375
  }
72112
72376
  constructor(t11) {
72113
- this.externalEntities = {}, this.options = v10(t11);
72377
+ this.externalEntities = {}, this.options = C3(t11);
72114
72378
  }
72115
72379
  parse(t11, e11) {
72116
72380
  if ("string" != typeof t11 && t11.toString) t11 = t11.toString();
72117
72381
  else if ("string" != typeof t11) throw new Error("XML data is accepted in String or Bytes[] form.");
72118
72382
  if (e11) {
72119
72383
  true === e11 && (e11 = {});
72120
- const n12 = a10(t11, e11);
72121
- if (true !== n12) throw Error(`${n12.err.msg}:${n12.err.line}:${n12.err.col}`);
72384
+ const i12 = l10(t11, e11);
72385
+ if (true !== i12) throw Error(`${i12.err.msg}:${i12.err.line}:${i12.err.col}`);
72122
72386
  }
72123
- const n11 = new L(this.options);
72124
- n11.addExternalEntities(this.externalEntities);
72125
- const i11 = n11.parseXml(t11);
72126
- return this.options.preserveOrder || void 0 === i11 ? i11 : J3(i11, this.options);
72387
+ const i11 = new B3(this.options);
72388
+ i11.addExternalEntities(this.externalEntities);
72389
+ const n11 = i11.parseXml(t11);
72390
+ return this.options.preserveOrder || void 0 === n11 ? n11 : lt(n11, this.options, i11.matcher);
72127
72391
  }
72128
72392
  addEntity(t11, e11) {
72129
72393
  if (-1 !== e11.indexOf("&")) throw new Error("Entity value can't have '&'");
@@ -72132,182 +72396,318 @@ var require_fxp = __commonJS({
72132
72396
  this.externalEntities[t11] = e11;
72133
72397
  }
72134
72398
  static getMetaDataSymbol() {
72135
- return I3.getMetaDataSymbol();
72399
+ return $.getMetaDataSymbol();
72136
72400
  }
72137
72401
  }
72138
- function st(t11, e11) {
72139
- let n11 = "";
72140
- return e11.format && e11.indentBy.length > 0 && (n11 = "\n"), rt(t11, e11, "", n11);
72402
+ function gt(t11, e11) {
72403
+ let i11 = "";
72404
+ e11.format && e11.indentBy.length > 0 && (i11 = "\n");
72405
+ const n11 = [];
72406
+ if (e11.stopNodes && Array.isArray(e11.stopNodes)) for (let t12 = 0; t12 < e11.stopNodes.length; t12++) {
72407
+ const i12 = e11.stopNodes[t12];
72408
+ "string" == typeof i12 ? n11.push(new G3(i12)) : i12 instanceof G3 && n11.push(i12);
72409
+ }
72410
+ return mt(t11, e11, i11, new M(), n11);
72141
72411
  }
72142
- __name(st, "st");
72143
- function rt(t11, e11, n11, i11) {
72144
- let s11 = "", r11 = false;
72412
+ __name(gt, "gt");
72413
+ function mt(t11, e11, i11, n11, s11) {
72414
+ let r11 = "", o11 = false;
72415
+ if (e11.maxNestedTags && n11.getDepth() > e11.maxNestedTags) throw new Error("Maximum nested tags exceeded");
72145
72416
  if (!Array.isArray(t11)) {
72146
72417
  if (null != t11) {
72147
- let n12 = t11.toString();
72148
- return n12 = ut(n12, e11), n12;
72418
+ let i12 = t11.toString();
72419
+ return i12 = vt(i12, e11), i12;
72149
72420
  }
72150
72421
  return "";
72151
72422
  }
72152
- for (let o11 = 0; o11 < t11.length; o11++) {
72153
- const a11 = t11[o11], l11 = ot(a11);
72423
+ for (let a11 = 0; a11 < t11.length; a11++) {
72424
+ const h11 = t11[a11], l11 = Et(h11);
72154
72425
  if (void 0 === l11) continue;
72155
- let u11 = "";
72156
- if (u11 = 0 === n11.length ? l11 : `${n11}.${l11}`, l11 === e11.textNodeName) {
72157
- let t12 = a11[l11];
72158
- lt(u11, e11) || (t12 = e11.tagValueProcessor(l11, t12), t12 = ut(t12, e11)), r11 && (s11 += i11), s11 += t12, r11 = false;
72426
+ const p11 = xt(h11[":@"], e11);
72427
+ n11.push(l11, p11);
72428
+ const u11 = wt(n11, s11);
72429
+ if (l11 === e11.textNodeName) {
72430
+ let t12 = h11[l11];
72431
+ u11 || (t12 = e11.tagValueProcessor(l11, t12), t12 = vt(t12, e11)), o11 && (r11 += i11), r11 += t12, o11 = false, n11.pop();
72159
72432
  continue;
72160
72433
  }
72161
72434
  if (l11 === e11.cdataPropName) {
72162
- r11 && (s11 += i11), s11 += `<![CDATA[${a11[l11][0][e11.textNodeName]}]]>`, r11 = false;
72435
+ o11 && (r11 += i11), r11 += `<![CDATA[${h11[l11][0][e11.textNodeName]}]]>`, o11 = false, n11.pop();
72163
72436
  continue;
72164
72437
  }
72165
72438
  if (l11 === e11.commentPropName) {
72166
- s11 += i11 + `<!--${a11[l11][0][e11.textNodeName]}-->`, r11 = true;
72439
+ r11 += i11 + `<!--${h11[l11][0][e11.textNodeName]}-->`, o11 = true, n11.pop();
72167
72440
  continue;
72168
72441
  }
72169
72442
  if ("?" === l11[0]) {
72170
- const t12 = at(a11[":@"], e11), n12 = "?xml" === l11 ? "" : i11;
72171
- let o12 = a11[l11][0][e11.textNodeName];
72172
- o12 = 0 !== o12.length ? " " + o12 : "", s11 += n12 + `<${l11}${o12}${t12}?>`, r11 = true;
72443
+ const t12 = yt(h11[":@"], e11, u11), s12 = "?xml" === l11 ? "" : i11;
72444
+ let a12 = h11[l11][0][e11.textNodeName];
72445
+ a12 = 0 !== a12.length ? " " + a12 : "", r11 += s12 + `<${l11}${a12}${t12}?>`, o11 = true, n11.pop();
72173
72446
  continue;
72174
72447
  }
72175
- let d11 = i11;
72176
- "" !== d11 && (d11 += e11.indentBy);
72177
- const h11 = i11 + `<${l11}${at(a11[":@"], e11)}`, p11 = rt(a11[l11], e11, u11, d11);
72178
- -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;
72448
+ let c11 = i11;
72449
+ "" !== c11 && (c11 += e11.indentBy);
72450
+ const d11 = i11 + `<${l11}${yt(h11[":@"], e11, u11)}`;
72451
+ let f11;
72452
+ 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();
72453
+ }
72454
+ return r11;
72455
+ }
72456
+ __name(mt, "mt");
72457
+ function xt(t11, e11) {
72458
+ if (!t11 || e11.ignoreAttributes) return null;
72459
+ const i11 = {};
72460
+ let n11 = false;
72461
+ 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);
72462
+ return n11 ? i11 : null;
72463
+ }
72464
+ __name(xt, "xt");
72465
+ function Nt(t11, e11) {
72466
+ if (!Array.isArray(t11)) return null != t11 ? t11.toString() : "";
72467
+ let i11 = "";
72468
+ for (let n11 = 0; n11 < t11.length; n11++) {
72469
+ const s11 = t11[n11], r11 = Et(s11);
72470
+ if (r11 === e11.textNodeName) i11 += s11[r11];
72471
+ else if (r11 === e11.cdataPropName) i11 += s11[r11][0][e11.textNodeName];
72472
+ else if (r11 === e11.commentPropName) i11 += s11[r11][0][e11.textNodeName];
72473
+ else {
72474
+ if (r11 && "?" === r11[0]) continue;
72475
+ if (r11) {
72476
+ const t12 = bt(s11[":@"], e11), n12 = Nt(s11[r11], e11);
72477
+ n12 && 0 !== n12.length ? i11 += `<${r11}${t12}>${n12}</${r11}>` : i11 += `<${r11}${t12}/>`;
72478
+ }
72479
+ }
72179
72480
  }
72180
- return s11;
72481
+ return i11;
72181
72482
  }
72182
- __name(rt, "rt");
72183
- function ot(t11) {
72483
+ __name(Nt, "Nt");
72484
+ function bt(t11, e11) {
72485
+ let i11 = "";
72486
+ if (t11 && !e11.ignoreAttributes) for (let n11 in t11) {
72487
+ if (!Object.prototype.hasOwnProperty.call(t11, n11)) continue;
72488
+ let s11 = t11[n11];
72489
+ true === s11 && e11.suppressBooleanAttributes ? i11 += ` ${n11.substr(e11.attributeNamePrefix.length)}` : i11 += ` ${n11.substr(e11.attributeNamePrefix.length)}="${s11}"`;
72490
+ }
72491
+ return i11;
72492
+ }
72493
+ __name(bt, "bt");
72494
+ function Et(t11) {
72184
72495
  const e11 = Object.keys(t11);
72185
- for (let n11 = 0; n11 < e11.length; n11++) {
72186
- const i11 = e11[n11];
72187
- if (Object.prototype.hasOwnProperty.call(t11, i11) && ":@" !== i11) return i11;
72496
+ for (let i11 = 0; i11 < e11.length; i11++) {
72497
+ const n11 = e11[i11];
72498
+ if (Object.prototype.hasOwnProperty.call(t11, n11) && ":@" !== n11) return n11;
72188
72499
  }
72189
72500
  }
72190
- __name(ot, "ot");
72191
- function at(t11, e11) {
72501
+ __name(Et, "Et");
72502
+ function yt(t11, e11, i11) {
72192
72503
  let n11 = "";
72193
- if (t11 && !e11.ignoreAttributes) for (let i11 in t11) {
72194
- if (!Object.prototype.hasOwnProperty.call(t11, i11)) continue;
72195
- let s11 = e11.attributeValueProcessor(i11, t11[i11]);
72196
- s11 = ut(s11, e11), true === s11 && e11.suppressBooleanAttributes ? n11 += ` ${i11.substr(e11.attributeNamePrefix.length)}` : n11 += ` ${i11.substr(e11.attributeNamePrefix.length)}="${s11}"`;
72504
+ if (t11 && !e11.ignoreAttributes) for (let s11 in t11) {
72505
+ if (!Object.prototype.hasOwnProperty.call(t11, s11)) continue;
72506
+ let r11;
72507
+ 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}"`;
72197
72508
  }
72198
72509
  return n11;
72199
72510
  }
72200
- __name(at, "at");
72201
- function lt(t11, e11) {
72202
- let n11 = (t11 = t11.substr(0, t11.length - e11.textNodeName.length - 1)).substr(t11.lastIndexOf(".") + 1);
72203
- for (let i11 in e11.stopNodes) if (e11.stopNodes[i11] === t11 || e11.stopNodes[i11] === "*." + n11) return true;
72511
+ __name(yt, "yt");
72512
+ function wt(t11, e11) {
72513
+ if (!e11 || 0 === e11.length) return false;
72514
+ for (let i11 = 0; i11 < e11.length; i11++) if (t11.matches(e11[i11])) return true;
72204
72515
  return false;
72205
72516
  }
72206
- __name(lt, "lt");
72207
- function ut(t11, e11) {
72208
- if (t11 && t11.length > 0 && e11.processEntities) for (let n11 = 0; n11 < e11.entities.length; n11++) {
72209
- const i11 = e11.entities[n11];
72210
- t11 = t11.replace(i11.regex, i11.val);
72517
+ __name(wt, "wt");
72518
+ function vt(t11, e11) {
72519
+ if (t11 && t11.length > 0 && e11.processEntities) for (let i11 = 0; i11 < e11.entities.length; i11++) {
72520
+ const n11 = e11.entities[i11];
72521
+ t11 = t11.replace(n11.regex, n11.val);
72211
72522
  }
72212
72523
  return t11;
72213
72524
  }
72214
- __name(ut, "ut");
72215
- 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) {
72525
+ __name(vt, "vt");
72526
+ 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) {
72216
72527
  return e11;
72217
72528
  }, "tagValueProcessor"), attributeValueProcessor: /* @__PURE__ */ __name(function(t11, e11) {
72218
72529
  return e11;
72219
- }, "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 };
72220
- function ht(t11) {
72530
+ }, "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 };
72531
+ function Pt(t11) {
72532
+ 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++) {
72533
+ const e12 = this.options.stopNodes[t12];
72534
+ "string" == typeof e12 ? this.stopNodeExpressions.push(new G3(e12)) : e12 instanceof G3 && this.stopNodeExpressions.push(e12);
72535
+ }
72221
72536
  var e11;
72222
- this.options = Object.assign({}, dt, t11), true === this.options.ignoreAttributes || this.options.attributesGroupName ? this.isAttribute = function() {
72537
+ true === this.options.ignoreAttributes || this.options.attributesGroupName ? this.isAttribute = function() {
72223
72538
  return false;
72224
72539
  } : (this.ignoreAttributesFn = "function" == typeof (e11 = this.options.ignoreAttributes) ? e11 : Array.isArray(e11) ? (t12) => {
72225
- for (const n11 of e11) {
72226
- if ("string" == typeof n11 && t12 === n11) return true;
72227
- if (n11 instanceof RegExp && n11.test(t12)) return true;
72540
+ for (const i11 of e11) {
72541
+ if ("string" == typeof i11 && t12 === i11) return true;
72542
+ if (i11 instanceof RegExp && i11.test(t12)) return true;
72228
72543
  }
72229
- } : () => 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() {
72544
+ } : () => 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() {
72230
72545
  return "";
72231
72546
  }, this.tagEndChar = ">", this.newLine = "");
72232
72547
  }
72233
- __name(ht, "ht");
72234
- function pt(t11, e11, n11, i11) {
72235
- const s11 = this.j2x(t11, n11 + 1, i11.concat(e11));
72236
- 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);
72548
+ __name(Pt, "Pt");
72549
+ function St(t11, e11, i11, n11) {
72550
+ const s11 = this.extractAttributes(t11);
72551
+ if (n11.push(e11, s11), this.checkStopNode(n11)) {
72552
+ const s12 = this.buildRawContent(t11), r12 = this.buildAttributesForStopNode(t11);
72553
+ return n11.pop(), this.buildObjectNode(s12, e11, r12, i11);
72554
+ }
72555
+ const r11 = this.j2x(t11, i11 + 1, n11);
72556
+ 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);
72237
72557
  }
72238
- __name(pt, "pt");
72239
- function ct(t11) {
72558
+ __name(St, "St");
72559
+ function At(t11) {
72240
72560
  return this.options.indentBy.repeat(t11);
72241
72561
  }
72242
- __name(ct, "ct");
72243
- function ft(t11) {
72562
+ __name(At, "At");
72563
+ function Ct(t11) {
72244
72564
  return !(!t11.startsWith(this.options.attributeNamePrefix) || t11 === this.options.textNodeName) && t11.substr(this.attrPrefixLen);
72245
72565
  }
72246
- __name(ft, "ft");
72247
- ht.prototype.build = function(t11) {
72248
- 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);
72249
- }, ht.prototype.j2x = function(t11, e11, n11) {
72250
- let i11 = "", s11 = "";
72251
- const r11 = n11.join(".");
72252
- for (let o11 in t11) if (Object.prototype.hasOwnProperty.call(t11, o11)) if (void 0 === t11[o11]) this.isAttribute(o11) && (s11 += "");
72253
- 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;
72254
- else if (t11[o11] instanceof Date) s11 += this.buildTextValNode(t11[o11], o11, "", e11);
72255
- else if ("object" != typeof t11[o11]) {
72256
- const n12 = this.isAttribute(o11);
72257
- if (n12 && !this.ignoreAttributesFn(n12, r11)) i11 += this.buildAttrPairStr(n12, "" + t11[o11]);
72258
- else if (!n12) if (o11 === this.options.textNodeName) {
72259
- let e12 = this.options.tagValueProcessor(o11, "" + t11[o11]);
72566
+ __name(Ct, "Ct");
72567
+ Pt.prototype.build = function(t11) {
72568
+ if (this.options.preserveOrder) return gt(t11, this.options);
72569
+ {
72570
+ Array.isArray(t11) && this.options.arrayNodeName && this.options.arrayNodeName.length > 1 && (t11 = { [this.options.arrayNodeName]: t11 });
72571
+ const e11 = new M();
72572
+ return this.j2x(t11, 0, e11).val;
72573
+ }
72574
+ }, Pt.prototype.j2x = function(t11, e11, i11) {
72575
+ let n11 = "", s11 = "";
72576
+ if (this.options.maxNestedTags && i11.getDepth() >= this.options.maxNestedTags) throw new Error("Maximum nested tags exceeded");
72577
+ const r11 = this.options.jPath ? i11.toString() : i11, o11 = this.checkStopNode(i11);
72578
+ for (let a11 in t11) if (Object.prototype.hasOwnProperty.call(t11, a11)) if (void 0 === t11[a11]) this.isAttribute(a11) && (s11 += "");
72579
+ 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;
72580
+ else if (t11[a11] instanceof Date) s11 += this.buildTextValNode(t11[a11], a11, "", e11, i11);
72581
+ else if ("object" != typeof t11[a11]) {
72582
+ const h11 = this.isAttribute(a11);
72583
+ if (h11 && !this.ignoreAttributesFn(h11, r11)) n11 += this.buildAttrPairStr(h11, "" + t11[a11], o11);
72584
+ else if (!h11) if (a11 === this.options.textNodeName) {
72585
+ let e12 = this.options.tagValueProcessor(a11, "" + t11[a11]);
72260
72586
  s11 += this.replaceEntitiesValue(e12);
72261
- } else s11 += this.buildTextValNode(t11[o11], o11, "", e11);
72262
- } else if (Array.isArray(t11[o11])) {
72263
- const i12 = t11[o11].length;
72264
- let r12 = "", a11 = "";
72265
- for (let l11 = 0; l11 < i12; l11++) {
72266
- const i13 = t11[o11][l11];
72267
- if (void 0 === i13) ;
72268
- else if (null === i13) "?" === o11[0] ? s11 += this.indentate(e11) + "<" + o11 + "?" + this.tagEndChar : s11 += this.indentate(e11) + "<" + o11 + "/" + this.tagEndChar;
72269
- else if ("object" == typeof i13) if (this.options.oneListGroup) {
72270
- const t12 = this.j2x(i13, e11 + 1, n11.concat(o11));
72271
- r12 += t12.val, this.options.attributesGroupName && i13.hasOwnProperty(this.options.attributesGroupName) && (a11 += t12.attrStr);
72272
- } else r12 += this.processTextOrObjNode(i13, o11, e11, n11);
72587
+ } else {
72588
+ i11.push(a11);
72589
+ const n12 = this.checkStopNode(i11);
72590
+ if (i11.pop(), n12) {
72591
+ const i12 = "" + t11[a11];
72592
+ s11 += "" === i12 ? this.indentate(e11) + "<" + a11 + this.closeTag(a11) + this.tagEndChar : this.indentate(e11) + "<" + a11 + ">" + i12 + "</" + a11 + this.tagEndChar;
72593
+ } else s11 += this.buildTextValNode(t11[a11], a11, "", e11, i11);
72594
+ }
72595
+ } else if (Array.isArray(t11[a11])) {
72596
+ const n12 = t11[a11].length;
72597
+ let r12 = "", o12 = "";
72598
+ for (let h11 = 0; h11 < n12; h11++) {
72599
+ const n13 = t11[a11][h11];
72600
+ if (void 0 === n13) ;
72601
+ else if (null === n13) "?" === a11[0] ? s11 += this.indentate(e11) + "<" + a11 + "?" + this.tagEndChar : s11 += this.indentate(e11) + "<" + a11 + "/" + this.tagEndChar;
72602
+ else if ("object" == typeof n13) if (this.options.oneListGroup) {
72603
+ i11.push(a11);
72604
+ const t12 = this.j2x(n13, e11 + 1, i11);
72605
+ i11.pop(), r12 += t12.val, this.options.attributesGroupName && n13.hasOwnProperty(this.options.attributesGroupName) && (o12 += t12.attrStr);
72606
+ } else r12 += this.processTextOrObjNode(n13, a11, e11, i11);
72273
72607
  else if (this.options.oneListGroup) {
72274
- let t12 = this.options.tagValueProcessor(o11, i13);
72608
+ let t12 = this.options.tagValueProcessor(a11, n13);
72275
72609
  t12 = this.replaceEntitiesValue(t12), r12 += t12;
72276
- } else r12 += this.buildTextValNode(i13, o11, "", e11);
72277
- }
72278
- this.options.oneListGroup && (r12 = this.buildObjectNode(r12, o11, a11, e11)), s11 += r12;
72279
- } else if (this.options.attributesGroupName && o11 === this.options.attributesGroupName) {
72280
- const e12 = Object.keys(t11[o11]), n12 = e12.length;
72281
- for (let s12 = 0; s12 < n12; s12++) i11 += this.buildAttrPairStr(e12[s12], "" + t11[o11][e12[s12]]);
72282
- } else s11 += this.processTextOrObjNode(t11[o11], o11, e11, n11);
72283
- return { attrStr: i11, val: s11 };
72284
- }, ht.prototype.buildAttrPairStr = function(t11, e11) {
72285
- return e11 = this.options.attributeValueProcessor(t11, "" + e11), e11 = this.replaceEntitiesValue(e11), this.options.suppressBooleanAttributes && "true" === e11 ? " " + t11 : " " + t11 + '="' + e11 + '"';
72286
- }, ht.prototype.buildObjectNode = function(t11, e11, n11, i11) {
72287
- if ("" === t11) return "?" === e11[0] ? this.indentate(i11) + "<" + e11 + n11 + "?" + this.tagEndChar : this.indentate(i11) + "<" + e11 + n11 + this.closeTag(e11) + this.tagEndChar;
72610
+ } else {
72611
+ i11.push(a11);
72612
+ const t12 = this.checkStopNode(i11);
72613
+ if (i11.pop(), t12) {
72614
+ const t13 = "" + n13;
72615
+ r12 += "" === t13 ? this.indentate(e11) + "<" + a11 + this.closeTag(a11) + this.tagEndChar : this.indentate(e11) + "<" + a11 + ">" + t13 + "</" + a11 + this.tagEndChar;
72616
+ } else r12 += this.buildTextValNode(n13, a11, "", e11, i11);
72617
+ }
72618
+ }
72619
+ this.options.oneListGroup && (r12 = this.buildObjectNode(r12, a11, o12, e11)), s11 += r12;
72620
+ } else if (this.options.attributesGroupName && a11 === this.options.attributesGroupName) {
72621
+ const e12 = Object.keys(t11[a11]), i12 = e12.length;
72622
+ for (let s12 = 0; s12 < i12; s12++) n11 += this.buildAttrPairStr(e12[s12], "" + t11[a11][e12[s12]], o11);
72623
+ } else s11 += this.processTextOrObjNode(t11[a11], a11, e11, i11);
72624
+ return { attrStr: n11, val: s11 };
72625
+ }, Pt.prototype.buildAttrPairStr = function(t11, e11, i11) {
72626
+ return i11 || (e11 = this.options.attributeValueProcessor(t11, "" + e11), e11 = this.replaceEntitiesValue(e11)), this.options.suppressBooleanAttributes && "true" === e11 ? " " + t11 : " " + t11 + '="' + e11 + '"';
72627
+ }, Pt.prototype.extractAttributes = function(t11) {
72628
+ if (!t11 || "object" != typeof t11) return null;
72629
+ const e11 = {};
72630
+ let i11 = false;
72631
+ if (this.options.attributesGroupName && t11[this.options.attributesGroupName]) {
72632
+ const n11 = t11[this.options.attributesGroupName];
72633
+ 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);
72634
+ } else for (let n11 in t11) {
72635
+ if (!Object.prototype.hasOwnProperty.call(t11, n11)) continue;
72636
+ const s11 = this.isAttribute(n11);
72637
+ s11 && (e11[s11] = t11[n11], i11 = true);
72638
+ }
72639
+ return i11 ? e11 : null;
72640
+ }, Pt.prototype.buildRawContent = function(t11) {
72641
+ if ("string" == typeof t11) return t11;
72642
+ if ("object" != typeof t11 || null === t11) return String(t11);
72643
+ if (void 0 !== t11[this.options.textNodeName]) return t11[this.options.textNodeName];
72644
+ let e11 = "";
72645
+ for (let i11 in t11) {
72646
+ if (!Object.prototype.hasOwnProperty.call(t11, i11)) continue;
72647
+ if (this.isAttribute(i11)) continue;
72648
+ if (this.options.attributesGroupName && i11 === this.options.attributesGroupName) continue;
72649
+ const n11 = t11[i11];
72650
+ if (i11 === this.options.textNodeName) e11 += n11;
72651
+ else if (Array.isArray(n11)) {
72652
+ for (let t12 of n11) if ("string" == typeof t12 || "number" == typeof t12) e11 += `<${i11}>${t12}</${i11}>`;
72653
+ else if ("object" == typeof t12 && null !== t12) {
72654
+ const n12 = this.buildRawContent(t12), s11 = this.buildAttributesForStopNode(t12);
72655
+ e11 += "" === n12 ? `<${i11}${s11}/>` : `<${i11}${s11}>${n12}</${i11}>`;
72656
+ }
72657
+ } else if ("object" == typeof n11 && null !== n11) {
72658
+ const t12 = this.buildRawContent(n11), s11 = this.buildAttributesForStopNode(n11);
72659
+ e11 += "" === t12 ? `<${i11}${s11}/>` : `<${i11}${s11}>${t12}</${i11}>`;
72660
+ } else e11 += `<${i11}>${n11}</${i11}>`;
72661
+ }
72662
+ return e11;
72663
+ }, Pt.prototype.buildAttributesForStopNode = function(t11) {
72664
+ if (!t11 || "object" != typeof t11) return "";
72665
+ let e11 = "";
72666
+ if (this.options.attributesGroupName && t11[this.options.attributesGroupName]) {
72667
+ const i11 = t11[this.options.attributesGroupName];
72668
+ for (let t12 in i11) {
72669
+ if (!Object.prototype.hasOwnProperty.call(i11, t12)) continue;
72670
+ const n11 = t12.startsWith(this.options.attributeNamePrefix) ? t12.substring(this.options.attributeNamePrefix.length) : t12, s11 = i11[t12];
72671
+ true === s11 && this.options.suppressBooleanAttributes ? e11 += " " + n11 : e11 += " " + n11 + '="' + s11 + '"';
72672
+ }
72673
+ } else for (let i11 in t11) {
72674
+ if (!Object.prototype.hasOwnProperty.call(t11, i11)) continue;
72675
+ const n11 = this.isAttribute(i11);
72676
+ if (n11) {
72677
+ const s11 = t11[i11];
72678
+ true === s11 && this.options.suppressBooleanAttributes ? e11 += " " + n11 : e11 += " " + n11 + '="' + s11 + '"';
72679
+ }
72680
+ }
72681
+ return e11;
72682
+ }, Pt.prototype.buildObjectNode = function(t11, e11, i11, n11) {
72683
+ if ("" === t11) return "?" === e11[0] ? this.indentate(n11) + "<" + e11 + i11 + "?" + this.tagEndChar : this.indentate(n11) + "<" + e11 + i11 + this.closeTag(e11) + this.tagEndChar;
72288
72684
  {
72289
72685
  let s11 = "</" + e11 + this.tagEndChar, r11 = "";
72290
- 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;
72686
+ 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;
72291
72687
  }
72292
- }, ht.prototype.closeTag = function(t11) {
72688
+ }, Pt.prototype.closeTag = function(t11) {
72293
72689
  let e11 = "";
72294
72690
  return -1 !== this.options.unpairedTags.indexOf(t11) ? this.options.suppressUnpairedNode || (e11 = "/") : e11 = this.options.suppressEmptyNode ? "/" : `></${t11}`, e11;
72295
- }, ht.prototype.buildTextValNode = function(t11, e11, n11, i11) {
72296
- if (false !== this.options.cdataPropName && e11 === this.options.cdataPropName) return this.indentate(i11) + `<![CDATA[${t11}]]>` + this.newLine;
72297
- if (false !== this.options.commentPropName && e11 === this.options.commentPropName) return this.indentate(i11) + `<!--${t11}-->` + this.newLine;
72298
- if ("?" === e11[0]) return this.indentate(i11) + "<" + e11 + n11 + "?" + this.tagEndChar;
72691
+ }, Pt.prototype.checkStopNode = function(t11) {
72692
+ if (!this.stopNodeExpressions || 0 === this.stopNodeExpressions.length) return false;
72693
+ for (let e11 = 0; e11 < this.stopNodeExpressions.length; e11++) if (t11.matches(this.stopNodeExpressions[e11])) return true;
72694
+ return false;
72695
+ }, Pt.prototype.buildTextValNode = function(t11, e11, i11, n11, s11) {
72696
+ if (false !== this.options.cdataPropName && e11 === this.options.cdataPropName) return this.indentate(n11) + `<![CDATA[${t11}]]>` + this.newLine;
72697
+ if (false !== this.options.commentPropName && e11 === this.options.commentPropName) return this.indentate(n11) + `<!--${t11}-->` + this.newLine;
72698
+ if ("?" === e11[0]) return this.indentate(n11) + "<" + e11 + i11 + "?" + this.tagEndChar;
72299
72699
  {
72300
- let s11 = this.options.tagValueProcessor(e11, t11);
72301
- 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;
72700
+ let s12 = this.options.tagValueProcessor(e11, t11);
72701
+ 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;
72302
72702
  }
72303
- }, ht.prototype.replaceEntitiesValue = function(t11) {
72703
+ }, Pt.prototype.replaceEntitiesValue = function(t11) {
72304
72704
  if (t11 && t11.length > 0 && this.options.processEntities) for (let e11 = 0; e11 < this.options.entities.length; e11++) {
72305
- const n11 = this.options.entities[e11];
72306
- t11 = t11.replace(n11.regex, n11.val);
72705
+ const i11 = this.options.entities[e11];
72706
+ t11 = t11.replace(i11.regex, i11.val);
72307
72707
  }
72308
72708
  return t11;
72309
72709
  };
72310
- const gt = ht, xt = { validate: a10 };
72710
+ const Ot = Pt, $t = { validate: l10 };
72311
72711
  module2.exports = e10;
72312
72712
  })();
72313
72713
  }
@@ -72322,13 +72722,17 @@ var require_xml_parser = __commonJS({
72322
72722
  var fast_xml_parser_1 = require_fxp();
72323
72723
  var parser = new fast_xml_parser_1.XMLParser({
72324
72724
  attributeNamePrefix: "",
72725
+ processEntities: {
72726
+ enabled: true,
72727
+ maxTotalExpansions: Infinity
72728
+ },
72325
72729
  htmlEntities: true,
72326
72730
  ignoreAttributes: false,
72327
72731
  ignoreDeclaration: true,
72328
72732
  parseTagValue: false,
72329
72733
  trimValues: false,
72330
72734
  tagValueProcessor: /* @__PURE__ */ __name((_2, val) => val.trim() === "" && val.includes("\n") ? "" : void 0, "tagValueProcessor"),
72331
- maxNestedTags: 1024
72735
+ maxNestedTags: Infinity
72332
72736
  });
72333
72737
  parser.addEntity("#xD", "\r");
72334
72738
  parser.addEntity("#10", "\n");
@@ -72344,12 +72748,31 @@ var require_dist_cjs27 = __commonJS({
72344
72748
  "../../node_modules/@aws-sdk/xml-builder/dist-cjs/index.js"(exports2) {
72345
72749
  "use strict";
72346
72750
  var xmlParser = require_xml_parser();
72751
+ var ATTR_ESCAPE_RE = /[&<>"]/g;
72752
+ var ATTR_ESCAPE_MAP = {
72753
+ "&": "&amp;",
72754
+ "<": "&lt;",
72755
+ ">": "&gt;",
72756
+ '"': "&quot;"
72757
+ };
72347
72758
  function escapeAttribute(value) {
72348
- return value.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;");
72759
+ return value.replace(ATTR_ESCAPE_RE, (ch) => ATTR_ESCAPE_MAP[ch]);
72349
72760
  }
72350
72761
  __name(escapeAttribute, "escapeAttribute");
72762
+ var ELEMENT_ESCAPE_RE = /[&"'<>\r\n\u0085\u2028]/g;
72763
+ var ELEMENT_ESCAPE_MAP = {
72764
+ "&": "&amp;",
72765
+ '"': "&quot;",
72766
+ "'": "&apos;",
72767
+ "<": "&lt;",
72768
+ ">": "&gt;",
72769
+ "\r": "&#x0D;",
72770
+ "\n": "&#x0A;",
72771
+ "\x85": "&#x85;",
72772
+ "\u2028": "&#x2028;"
72773
+ };
72351
72774
  function escapeElement(value) {
72352
- 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;");
72775
+ return value.replace(ELEMENT_ESCAPE_RE, (ch) => ELEMENT_ESCAPE_MAP[ch]);
72353
72776
  }
72354
72777
  __name(escapeElement, "escapeElement");
72355
72778
  var XmlText2 = class {
@@ -116043,7 +116466,7 @@ ${indent}${str}`;
116043
116466
  end
116044
116467
  } = flowChars;
116045
116468
  const strings = nodes.map((n10) => n10.str);
116046
- if (hasItemWithNewLine || strings.reduce((sum3, str2) => sum3 + str2.length + 2, 2) > _Collection.maxFlowStringSingleLineLength) {
116469
+ if (hasItemWithNewLine || strings.reduce((sum5, str2) => sum5 + str2.length + 2, 2) > _Collection.maxFlowStringSingleLineLength) {
116047
116470
  str = start;
116048
116471
  for (const s10 of strings) {
116049
116472
  str += s10 ? `
@@ -121557,6 +121980,8 @@ var init_span = __esm({
121557
121980
  spanId;
121558
121981
  startTime;
121559
121982
  timingMsgTemplate;
121983
+ counters = {};
121984
+ openTimers = /* @__PURE__ */ new Set();
121560
121985
  constructor(ioHelper, definition, makeHelper) {
121561
121986
  this.definition = definition;
121562
121987
  this.ioHelper = ioHelper;
@@ -121584,6 +122009,10 @@ var init_span = __esm({
121584
122009
  }
121585
122010
  async end(x10, y4) {
121586
122011
  const duration = this.time();
122012
+ for (const t10 of this.openTimers) {
122013
+ t10.stop();
122014
+ }
122015
+ this.openTimers.clear();
121587
122016
  const endInput = parseArgs(x10, y4);
121588
122017
  const endMsg = endInput.message ?? util2.format(this.timingMsgTemplate, this.definition.name, duration.asSec);
121589
122018
  const endPayload = endInput.payload;
@@ -121591,14 +122020,30 @@ var init_span = __esm({
121591
122020
  endMsg,
121592
122021
  {
121593
122022
  duration: duration.asMs,
122023
+ ...Object.keys(this.counters).length > 0 ? { counters: this.counters } : {},
121594
122024
  ...endPayload
121595
122025
  }
121596
122026
  ));
121597
122027
  return duration;
121598
122028
  }
122029
+ incCounter(name, delta = 1) {
122030
+ this.counters[name] = (this.counters[name] ?? 0) + delta;
122031
+ }
121599
122032
  async requestResponse(msg) {
121600
122033
  return this.ioHelper.requestResponse(withSpanId(this.spanId, msg));
121601
122034
  }
122035
+ startTimer(name) {
122036
+ const start = Date.now();
122037
+ const t10 = {
122038
+ stop: /* @__PURE__ */ __name(() => {
122039
+ this.openTimers.delete(t10);
122040
+ this.incCounter(`${name}_ms`, Math.floor(Date.now() - start) / 1e3);
122041
+ this.incCounter(`${name}_cnt`, 1);
122042
+ }, "stop")
122043
+ };
122044
+ this.openTimers.add(t10);
122045
+ return t10;
122046
+ }
121602
122047
  time() {
121603
122048
  const elapsedTime = (/* @__PURE__ */ new Date()).getTime() - this.startTime;
121604
122049
  return {
@@ -132405,7 +132850,7 @@ async function loadTree(assembly, trace3) {
132405
132850
  try {
132406
132851
  const outdir = assembly.directory;
132407
132852
  const fileName = assembly.tree()?.file;
132408
- return fileName ? fs19.readJSONSync(path19.join(outdir, fileName)).tree : {};
132853
+ return fileName ? fs19.readJSONSync(path19.join(outdir, fileName)).tree : void 0;
132409
132854
  } catch (e10) {
132410
132855
  await trace3(`Failed to get tree.json file: ${e10}. Proceeding with empty tree.`);
132411
132856
  return void 0;
@@ -137465,10 +137910,10 @@ var require_utils11 = __commonJS({
137465
137910
  return (_b = (_a3 = input.match(/\s+/g)) === null || _a3 === void 0 ? void 0 : _a3.length) !== null && _b !== void 0 ? _b : 0;
137466
137911
  }, "countSpaceSequence");
137467
137912
  exports2.countSpaceSequence = countSpaceSequence;
137468
- var distributeUnevenly = /* @__PURE__ */ __name((sum3, length) => {
137469
- const result2 = Array.from({ length }).fill(Math.floor(sum3 / length));
137913
+ var distributeUnevenly = /* @__PURE__ */ __name((sum5, length) => {
137914
+ const result2 = Array.from({ length }).fill(Math.floor(sum5 / length));
137470
137915
  return result2.map((element, index) => {
137471
- return element + (index < sum3 % length ? 1 : 0);
137916
+ return element + (index < sum5 % length ? 1 : 0);
137472
137917
  });
137473
137918
  }, "distributeUnevenly");
137474
137919
  exports2.distributeUnevenly = distributeUnevenly;
@@ -145496,6 +145941,9 @@ async function tryHotswapDeployment(sdkProvider, ioHelper, assetParams, cloudFor
145496
145941
  hotswapPropertyOverrides
145497
145942
  );
145498
145943
  await hotswapSpan.end(result2);
145944
+ if (result2.error) {
145945
+ throw result2.error;
145946
+ }
145499
145947
  if (result2?.hotswapped === true) {
145500
145948
  return {
145501
145949
  type: "did-deploy-stack",
@@ -145547,13 +145995,19 @@ async function hotswapDeployment(sdkProvider, ioSpan, assetParams, stack, hotswa
145547
145995
  };
145548
145996
  }
145549
145997
  }
145550
- await applyAllHotswapOperations(sdk, ioSpan, hotswappable);
145998
+ let error5;
145999
+ try {
146000
+ await applyAllHotswapOperations(sdk, ioSpan, hotswappable);
146001
+ } catch (e10) {
146002
+ error5 = e10;
146003
+ }
145551
146004
  return {
145552
146005
  stack,
145553
146006
  mode: hotswapMode,
145554
- hotswapped: true,
146007
+ hotswapped: !error5,
145555
146008
  hotswappableChanges,
145556
- nonHotswappableChanges
146009
+ nonHotswappableChanges,
146010
+ error: error5
145557
146011
  };
145558
146012
  }
145559
146013
  async function classifyResourceChanges(stackChanges, evaluateCfnTemplate, sdk, nestedStackNames, hotswapPropertyOverrides) {
@@ -305837,12 +306291,12 @@ var require_metadata = __commonJS({
305837
306291
  Object.defineProperty(exports2, "__esModule", { value: true });
305838
306292
  exports2.SynthesisMessageLevel = exports2.PATH_METADATA_KEY = void 0;
305839
306293
  exports2.PATH_METADATA_KEY = "aws:cdk:path";
305840
- var SynthesisMessageLevel3;
305841
- (function(SynthesisMessageLevel4) {
305842
- SynthesisMessageLevel4["INFO"] = "info";
305843
- SynthesisMessageLevel4["WARNING"] = "warning";
305844
- SynthesisMessageLevel4["ERROR"] = "error";
305845
- })(SynthesisMessageLevel3 || (exports2.SynthesisMessageLevel = SynthesisMessageLevel3 = {}));
306294
+ var SynthesisMessageLevel5;
306295
+ (function(SynthesisMessageLevel6) {
306296
+ SynthesisMessageLevel6["INFO"] = "info";
306297
+ SynthesisMessageLevel6["WARNING"] = "warning";
306298
+ SynthesisMessageLevel6["ERROR"] = "error";
306299
+ })(SynthesisMessageLevel5 || (exports2.SynthesisMessageLevel = SynthesisMessageLevel5 = {}));
305846
306300
  }
305847
306301
  });
305848
306302
 
@@ -306144,7 +306598,7 @@ var require_cloudformation_artifact = __commonJS({
306144
306598
  var environment_1 = require_environment();
306145
306599
  var error_1 = require_error3();
306146
306600
  var CLOUDFORMATION_STACK_ARTIFACT_SYM2 = /* @__PURE__ */ Symbol.for("@aws-cdk/cx-api.CloudFormationStackArtifact");
306147
- var CloudFormationStackArtifact3 = class extends cloud_artifact_1.CloudArtifact {
306601
+ var CloudFormationStackArtifact4 = class extends cloud_artifact_1.CloudArtifact {
306148
306602
  static {
306149
306603
  __name(this, "CloudFormationStackArtifact");
306150
306604
  }
@@ -306214,8 +306668,8 @@ var require_cloudformation_artifact = __commonJS({
306214
306668
  return this._template;
306215
306669
  }
306216
306670
  };
306217
- exports2.CloudFormationStackArtifact = CloudFormationStackArtifact3;
306218
- Object.defineProperty(CloudFormationStackArtifact3.prototype, CLOUDFORMATION_STACK_ARTIFACT_SYM2, {
306671
+ exports2.CloudFormationStackArtifact = CloudFormationStackArtifact4;
306672
+ Object.defineProperty(CloudFormationStackArtifact4.prototype, CLOUDFORMATION_STACK_ARTIFACT_SYM2, {
306219
306673
  value: true,
306220
306674
  enumerable: false,
306221
306675
  writable: false
@@ -306999,12 +307453,12 @@ var require_legacy_moved = __commonJS({
306999
307453
  Object.defineProperty(exports2, "UNKNOWN_REGION", { enumerable: true, get: /* @__PURE__ */ __name(function() {
307000
307454
  return cloud_assembly_api_1.UNKNOWN_REGION;
307001
307455
  }, "get") });
307002
- var SynthesisMessageLevel3;
307003
- (function(SynthesisMessageLevel4) {
307004
- SynthesisMessageLevel4["INFO"] = "info";
307005
- SynthesisMessageLevel4["WARNING"] = "warning";
307006
- SynthesisMessageLevel4["ERROR"] = "error";
307007
- })(SynthesisMessageLevel3 || (exports2.SynthesisMessageLevel = SynthesisMessageLevel3 = {}));
307456
+ var SynthesisMessageLevel5;
307457
+ (function(SynthesisMessageLevel6) {
307458
+ SynthesisMessageLevel6["INFO"] = "info";
307459
+ SynthesisMessageLevel6["WARNING"] = "warning";
307460
+ SynthesisMessageLevel6["ERROR"] = "error";
307461
+ })(SynthesisMessageLevel5 || (exports2.SynthesisMessageLevel = SynthesisMessageLevel5 = {}));
307008
307462
  exports2.CloudAssembly = cloud_assembly_api_1.CloudAssembly;
307009
307463
  exports2.CloudArtifact = cloud_assembly_api_1.CloudArtifact;
307010
307464
  exports2.CloudFormationStackArtifact = cloud_assembly_api_1.CloudFormationStackArtifact;
@@ -308949,19 +309403,27 @@ function writeContextToEnv(env2, context, completeness) {
308949
309403
  }
308950
309404
  };
308951
309405
  }
308952
- async function checkContextOverflowSupport(assembly, ioHelper) {
308953
- const traceFn = /* @__PURE__ */ __name((msg) => ioHelper.defaults.trace(msg), "traceFn");
308954
- const tree = await loadTree(assembly, traceFn);
309406
+ async function checkContextOverflowSupport(tree, ioHelper) {
308955
309407
  if (!frameworkSupportsContextOverflow(tree)) {
308956
309408
  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."));
308957
309409
  }
308958
309410
  }
308959
- function frameworkSupportsContextOverflow(tree) {
308960
- return !some(tree, (node) => {
309411
+ function findConstructLibraryVersion(tree) {
309412
+ let ret = void 0;
309413
+ some(tree, (node) => {
308961
309414
  const fqn = node.constructInfo?.fqn;
308962
309415
  const version = node.constructInfo?.version;
308963
- 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";
309416
+ if (fqn?.startsWith("aws-cdk-lib.") || fqn?.startsWith("@aws-cdk/core.")) {
309417
+ ret = version;
309418
+ return true;
309419
+ }
309420
+ return false;
308964
309421
  });
309422
+ return ret !== "0.0.0" ? ret : void 0;
309423
+ }
309424
+ function frameworkSupportsContextOverflow(tree) {
309425
+ const version = findConstructLibraryVersion(tree);
309426
+ return !version || !(0, import_semver.lte)(version, "2.38.0");
308965
309427
  }
308966
309428
  async function assemblyFromDirectory(assemblyDir, ioHelper, loadOptions = {}) {
308967
309429
  try {
@@ -308971,7 +309433,8 @@ async function assemblyFromDirectory(assemblyDir, ioHelper, loadOptions = {}) {
308971
309433
  // We sort as we deploy
308972
309434
  topoSort: false
308973
309435
  });
308974
- await checkContextOverflowSupport(assembly, ioHelper);
309436
+ const tree = await loadTree(assembly, ioHelper.defaults.trace.bind(ioHelper.defaults));
309437
+ await checkContextOverflowSupport(tree, ioHelper);
308975
309438
  return assembly;
308976
309439
  } catch (err) {
308977
309440
  if (err.message.includes(cxschema8.VERSION_MISMATCH)) {
@@ -309166,6 +309629,7 @@ var init_prepare_source = __esm({
309166
309629
  };
309167
309630
  __name(writeContextToEnv, "writeContextToEnv");
309168
309631
  __name(checkContextOverflowSupport, "checkContextOverflowSupport");
309632
+ __name(findConstructLibraryVersion, "findConstructLibraryVersion");
309169
309633
  __name(frameworkSupportsContextOverflow, "frameworkSupportsContextOverflow");
309170
309634
  __name(assemblyFromDirectory, "assemblyFromDirectory");
309171
309635
  __name(settingsFromSynthOptions, "settingsFromSynthOptions");
@@ -310201,7 +310665,7 @@ var init_diff_formatter = __esm({
310201
310665
  }
310202
310666
  if (diff.differenceCount && !options.strict) {
310203
310667
  const mangledNewTemplate = JSON.parse((0, import_cloudformation_diff.mangleLikeCloudFormation)(JSON.stringify(this.newTemplate.template)));
310204
- const mangledDiff = (0, import_cloudformation_diff.fullDiff)(this.oldTemplate, mangledNewTemplate, this.changeSet);
310668
+ const mangledDiff = (0, import_cloudformation_diff.fullDiff)(oldTemplate, mangledNewTemplate, this.changeSet);
310205
310669
  filteredChangesCount = Math.max(0, diff.differenceCount - mangledDiff.differenceCount);
310206
310670
  if (filteredChangesCount > 0) {
310207
310671
  diff = mangledDiff;
@@ -311131,6 +311595,20 @@ var init_work_graph = __esm({
311131
311595
  }
311132
311596
  });
311133
311597
  }
311598
+ /**
311599
+ * Execute all stack nodes in dependency order with the given concurrency.
311600
+ *
311601
+ * Unlike `doParallel`, this method only handles stack nodes and takes a
311602
+ * simple callback. Intended for destroy where there are no asset nodes.
311603
+ */
311604
+ processStacks(concurrency, fn) {
311605
+ return this.forAllArtifacts(concurrency, async (x10) => {
311606
+ if (x10.type !== "stack") {
311607
+ return;
311608
+ }
311609
+ await fn(x10);
311610
+ });
311611
+ }
311134
311612
  /**
311135
311613
  * Return the set of unblocked nodes
311136
311614
  */
@@ -311358,11 +311836,45 @@ var init_work_graph = __esm({
311358
311836
  }
311359
311837
  });
311360
311838
 
311839
+ // ../@aws-cdk/toolkit-lib/lib/api/work-graph/build-destroy-work-graph.ts
311840
+ function buildDestroyWorkGraph(stacks, ioHelper) {
311841
+ const graph = new WorkGraph({}, ioHelper);
311842
+ const selectedIds = new Set(stacks.map((s10) => s10.id));
311843
+ for (const stack of stacks) {
311844
+ graph.addNodes({
311845
+ type: "stack",
311846
+ id: stack.id,
311847
+ dependencies: /* @__PURE__ */ new Set(),
311848
+ stack,
311849
+ deploymentState: "pending" /* PENDING */,
311850
+ priority: 0
311851
+ });
311852
+ }
311853
+ for (const stack of stacks) {
311854
+ for (const dep of stack.dependencies) {
311855
+ if (cxapi6.CloudFormationStackArtifact.isCloudFormationStackArtifact(dep) && selectedIds.has(dep.id)) {
311856
+ graph.addDependency(dep.id, stack.id);
311857
+ }
311858
+ }
311859
+ }
311860
+ return graph;
311861
+ }
311862
+ var cxapi6;
311863
+ var init_build_destroy_work_graph = __esm({
311864
+ "../@aws-cdk/toolkit-lib/lib/api/work-graph/build-destroy-work-graph.ts"() {
311865
+ "use strict";
311866
+ cxapi6 = __toESM(require_lib3());
311867
+ init_work_graph();
311868
+ init_work_graph_types();
311869
+ __name(buildDestroyWorkGraph, "buildDestroyWorkGraph");
311870
+ }
311871
+ });
311872
+
311361
311873
  // ../@aws-cdk/toolkit-lib/lib/api/work-graph/work-graph-builder.ts
311362
311874
  function stacksFromAssets(artifacts) {
311363
311875
  const ret = /* @__PURE__ */ new Map();
311364
- for (const stack of artifacts.filter((x10) => cxapi6.CloudFormationStackArtifact.isCloudFormationStackArtifact(x10))) {
311365
- const assetArtifacts = stack.dependencies.filter((x10) => cxapi6.AssetManifestArtifact.isAssetManifestArtifact(x10));
311876
+ for (const stack of artifacts.filter((x10) => cxapi7.CloudFormationStackArtifact.isCloudFormationStackArtifact(x10))) {
311877
+ const assetArtifacts = stack.dependencies.filter((x10) => cxapi7.AssetManifestArtifact.isAssetManifestArtifact(x10));
311366
311878
  for (const art of assetArtifacts) {
311367
311879
  ret.set(art, stack);
311368
311880
  }
@@ -311370,14 +311882,14 @@ function stacksFromAssets(artifacts) {
311370
311882
  return ret;
311371
311883
  }
311372
311884
  function onlyStacks(artifacts) {
311373
- return artifacts.filter((x10) => cxapi6.CloudFormationStackArtifact.isCloudFormationStackArtifact(x10));
311885
+ return artifacts.filter((x10) => cxapi7.CloudFormationStackArtifact.isCloudFormationStackArtifact(x10));
311374
311886
  }
311375
- var import_cdk_assets_lib4, cxapi6, WorkGraphBuilder;
311887
+ var import_cdk_assets_lib4, cxapi7, WorkGraphBuilder;
311376
311888
  var init_work_graph_builder = __esm({
311377
311889
  "../@aws-cdk/toolkit-lib/lib/api/work-graph/work-graph-builder.ts"() {
311378
311890
  "use strict";
311379
311891
  import_cdk_assets_lib4 = __toESM(require_lib6());
311380
- cxapi6 = __toESM(require_lib3());
311892
+ cxapi7 = __toESM(require_lib3());
311381
311893
  init_work_graph();
311382
311894
  init_work_graph_types();
311383
311895
  init_toolkit_error();
@@ -311470,9 +311982,9 @@ var init_work_graph_builder = __esm({
311470
311982
  build(artifacts) {
311471
311983
  const parentStacks = stacksFromAssets(artifacts);
311472
311984
  for (const artifact of artifacts) {
311473
- if (cxapi6.CloudFormationStackArtifact.isCloudFormationStackArtifact(artifact)) {
311985
+ if (cxapi7.CloudFormationStackArtifact.isCloudFormationStackArtifact(artifact)) {
311474
311986
  this.addStack(artifact);
311475
- } else if (cxapi6.AssetManifestArtifact.isAssetManifestArtifact(artifact)) {
311987
+ } else if (cxapi7.AssetManifestArtifact.isAssetManifestArtifact(artifact)) {
311476
311988
  const manifest = import_cdk_assets_lib4.AssetManifest.fromFile(artifact.file);
311477
311989
  for (const entry of manifest.entries) {
311478
311990
  const parentStack = parentStacks.get(artifact);
@@ -311481,8 +311993,8 @@ var init_work_graph_builder = __esm({
311481
311993
  }
311482
311994
  this.addAsset(parentStack, artifact, manifest, entry);
311483
311995
  }
311484
- } else if (cxapi6.NestedCloudAssemblyArtifact.isNestedCloudAssemblyArtifact(artifact)) {
311485
- const assembly = new cxapi6.CloudAssembly(artifact.fullPath, { topoSort: false });
311996
+ } else if (cxapi7.NestedCloudAssemblyArtifact.isNestedCloudAssemblyArtifact(artifact)) {
311997
+ const assembly = new cxapi7.CloudAssembly(artifact.fullPath, { topoSort: false });
311486
311998
  const nestedGraph = new _WorkGraphBuilder(
311487
311999
  this.ioHelper,
311488
312000
  this.prebuildAssets,
@@ -311497,10 +312009,10 @@ var init_work_graph_builder = __esm({
311497
312009
  return this.graph;
311498
312010
  }
311499
312011
  stackArtifactIds(deps) {
311500
- return deps.flatMap((d10) => cxapi6.CloudFormationStackArtifact.isCloudFormationStackArtifact(d10) ? [this.stackArtifactId(d10)] : []);
312012
+ return deps.flatMap((d10) => cxapi7.CloudFormationStackArtifact.isCloudFormationStackArtifact(d10) ? [this.stackArtifactId(d10)] : []);
311501
312013
  }
311502
312014
  stackArtifactId(artifact) {
311503
- if (!cxapi6.CloudFormationStackArtifact.isCloudFormationStackArtifact(artifact)) {
312015
+ if (!cxapi7.CloudFormationStackArtifact.isCloudFormationStackArtifact(artifact)) {
311504
312016
  throw new ToolkitError(`Can only call this on CloudFormationStackArtifact, got: ${artifact.constructor.name}`);
311505
312017
  }
311506
312018
  return `${this.idPrefix}${artifact.id}`;
@@ -311529,6 +312041,7 @@ var init_work_graph_builder = __esm({
311529
312041
  var init_work_graph2 = __esm({
311530
312042
  "../@aws-cdk/toolkit-lib/lib/api/work-graph/index.ts"() {
311531
312043
  "use strict";
312044
+ init_build_destroy_work_graph();
311532
312045
  init_work_graph();
311533
312046
  init_work_graph_builder();
311534
312047
  init_work_graph_types();
@@ -312410,6 +312923,7 @@ __export(api_exports, {
312410
312923
  addMetadataAssetsToManifest: () => addMetadataAssetsToManifest,
312411
312924
  assemblyFromDirectory: () => assemblyFromDirectory,
312412
312925
  assertIsSuccessfulDeployStackResult: () => assertIsSuccessfulDeployStackResult,
312926
+ buildDestroyWorkGraph: () => buildDestroyWorkGraph,
312413
312927
  cached: () => cached2,
312414
312928
  contextFromSettings: () => contextFromSettings,
312415
312929
  credentialsAboutToExpire: () => credentialsAboutToExpire,
@@ -312417,6 +312931,7 @@ __export(api_exports, {
312417
312931
  determineAllowCrossAccountAssetPublishing: () => determineAllowCrossAccountAssetPublishing,
312418
312932
  execInChildProcess: () => execInChildProcess,
312419
312933
  findCloudWatchLogGroups: () => findCloudWatchLogGroups,
312934
+ findConstructLibraryVersion: () => findConstructLibraryVersion,
312420
312935
  formatSdkLoggerContent: () => formatSdkLoggerContent,
312421
312936
  frameworkSupportsContextOverflow: () => frameworkSupportsContextOverflow,
312422
312937
  getBootstrapStackInfo: () => getBootstrapStackInfo,
@@ -316634,6 +317149,7 @@ async function synthAndMeasure(ioHelper, cx, selectStacks) {
316634
317149
  const synthSpan = await ioHelper.span(SPAN.SYNTH_ASSEMBLY).begin({ stacks: selectStacks });
316635
317150
  try {
316636
317151
  const ret = await assemblyFromSource(synthSpan.asHelper, cx);
317152
+ countAssemblyResults(synthSpan, ret.assembly);
316637
317153
  const synthDuration = await synthSpan.end({});
316638
317154
  return Object.assign(ret, { synthDuration });
316639
317155
  } catch (error5) {
@@ -316644,13 +317160,28 @@ async function synthAndMeasure(ioHelper, cx, selectStacks) {
316644
317160
  function zeroTime() {
316645
317161
  return { asMs: 0, asSec: 0 };
316646
317162
  }
316647
- var import_dispose_polyfill5, path32, cxapi7, import_cloud_assembly_schema5, chalk25, fs34, FILE_EVENTS, Toolkit;
317163
+ function countAssemblyResults(span, assembly) {
317164
+ const stacksRecursively = assembly.stacksRecursively;
317165
+ span.incCounter("stacks", stacksRecursively.length);
317166
+ span.incCounter("assemblies", asmCount(assembly));
317167
+ span.incCounter("errorAnns", sum3(stacksRecursively.map((s10) => s10.messages.filter((m10) => m10.level === import_cloud_assembly_api14.SynthesisMessageLevel.ERROR).length)));
317168
+ span.incCounter("warnings", sum3(stacksRecursively.map((s10) => s10.messages.filter((m10) => m10.level === import_cloud_assembly_api14.SynthesisMessageLevel.WARNING).length)));
317169
+ function asmCount(x10) {
317170
+ return 1 + x10.nestedAssemblies.reduce((acc, asm) => acc + asmCount(asm.nestedAssembly), 0);
317171
+ }
317172
+ __name(asmCount, "asmCount");
317173
+ }
317174
+ function sum3(xs) {
317175
+ return xs.reduce((a10, b10) => a10 + b10, 0);
317176
+ }
317177
+ var import_dispose_polyfill5, path32, cxapi8, import_cloud_assembly_api14, import_cloud_assembly_schema5, chalk25, fs34, FILE_EVENTS, Toolkit;
316648
317178
  var init_toolkit = __esm({
316649
317179
  "../@aws-cdk/toolkit-lib/lib/toolkit/toolkit.ts"() {
316650
317180
  "use strict";
316651
317181
  import_dispose_polyfill5 = __toESM(require_dispose_polyfill());
316652
317182
  path32 = __toESM(require("node:path"));
316653
- cxapi7 = __toESM(require_lib3());
317183
+ cxapi8 = __toESM(require_lib3());
317184
+ import_cloud_assembly_api14 = __toESM(require_lib3());
316654
317185
  import_cloud_assembly_schema5 = __toESM(require_lib2());
316655
317186
  chalk25 = __toESM(require_source());
316656
317187
  init_esm3();
@@ -317080,7 +317611,8 @@ var init_toolkit = __esm({
317080
317611
  `Stack ${stack.displayName} does not define an environment, and AWS credentials could not be obtained from standard locations or no region was configured.`
317081
317612
  );
317082
317613
  }
317083
- if (Object.keys(stack.template.Resources || {}).length === 0) {
317614
+ const resourceCount = Object.keys(stack.template.Resources || {}).length;
317615
+ if (resourceCount === 0) {
317084
317616
  const stackExists = await deployments.stackExists({ stack });
317085
317617
  if (!stackExists) {
317086
317618
  return ioHelper.notify(IO.CDK_TOOLKIT_W5021.msg(`${chalk25.bold(stack.displayName)}: stack has no resources, skipping deployment.`));
@@ -317126,6 +317658,7 @@ Do you wish to deploy these changes`;
317126
317658
  current: stackIndex,
317127
317659
  stack
317128
317660
  });
317661
+ deploySpan.incCounter("resources", resourceCount);
317129
317662
  let tags = options.tags;
317130
317663
  if (!tags || tags.length === 0) {
317131
317664
  tags = tagsForStack(stack);
@@ -317253,7 +317786,7 @@ ${deployResult.stackArn}`));
317253
317786
  const concurrency = options.concurrency || 1;
317254
317787
  const stacksAndTheirAssetManifests = stacks.flatMap((stack) => [
317255
317788
  stack,
317256
- ...stack.dependencies.filter((x10) => cxapi7.AssetManifestArtifact.isAssetManifestArtifact(x10))
317789
+ ...stack.dependencies.filter((x10) => cxapi8.AssetManifestArtifact.isAssetManifestArtifact(x10))
317257
317790
  ]);
317258
317791
  const workGraph = new WorkGraphBuilder(ioHelper, prebuildAssets).build(stacksAndTheirAssetManifests);
317259
317792
  if (!options.forceAssetPublishing) {
@@ -317603,7 +318136,7 @@ ${deployResult.stackArn}`));
317603
318136
  async _destroy(assembly, action, options) {
317604
318137
  const selectStacks = stacksOpt(options);
317605
318138
  const ioHelper = asIoHelper(this.ioHost, action);
317606
- const stacks = (await assembly.selectStacksV2(selectStacks)).reversed();
318139
+ const stacks = await assembly.selectStacksV2(selectStacks);
317607
318140
  const ret = {
317608
318141
  stacks: []
317609
318142
  };
@@ -317614,15 +318147,19 @@ ${deployResult.stackArn}`));
317614
318147
  await ioHelper.notify(IO.CDK_TOOLKIT_E7010.msg("Aborted by user"));
317615
318148
  return ret;
317616
318149
  }
318150
+ const concurrency = options.concurrency || 1;
318151
+ let destroyCount = 0;
317617
318152
  const destroySpan = await ioHelper.span(SPAN.DESTROY_ACTION).begin({
317618
318153
  stacks: stacks.stackArtifacts
317619
318154
  });
317620
318155
  try {
317621
- for (const [index, stack] of stacks.stackArtifacts.entries()) {
318156
+ const destroyStack2 = /* @__PURE__ */ __name(async (stackNode) => {
318157
+ const stack = stackNode.stack;
318158
+ destroyCount++;
317622
318159
  try {
317623
- const singleDestroySpan = await ioHelper.span(SPAN.DESTROY_STACK).begin(chalk25.green(`${chalk25.blue(stack.displayName)}: destroying... [${index + 1}/${stacks.stackCount}]`), {
318160
+ const singleDestroySpan = await ioHelper.span(SPAN.DESTROY_STACK).begin(chalk25.green(`${chalk25.blue(stack.displayName)}: destroying... [${destroyCount}/${stacks.stackCount}]`), {
317624
318161
  total: stacks.stackCount,
317625
- current: index + 1,
318162
+ current: destroyCount,
317626
318163
  stack
317627
318164
  });
317628
318165
  const deployments = await this.deploymentsForAction(action);
@@ -317648,7 +318185,9 @@ ${deployResult.stackArn}`));
317648
318185
  \u274C ${chalk25.blue(stack.displayName)}: ${action} failed ${e10}`, { error: e10 }));
317649
318186
  throw e10;
317650
318187
  }
317651
- }
318188
+ }, "destroyStack");
318189
+ const workGraph = buildDestroyWorkGraph(stacks.stackArtifacts, ioHelper);
318190
+ await workGraph.processStacks(concurrency, destroyStack2);
317652
318191
  return ret;
317653
318192
  } finally {
317654
318193
  await destroySpan.end();
@@ -317748,6 +318287,8 @@ ${deployResult.stackArn}`));
317748
318287
  __name(stacksOpt, "stacksOpt");
317749
318288
  __name(synthAndMeasure, "synthAndMeasure");
317750
318289
  __name(zeroTime, "zeroTime");
318290
+ __name(countAssemblyResults, "countAssemblyResults");
318291
+ __name(sum3, "sum");
317751
318292
  }
317752
318293
  });
317753
318294
 
@@ -320105,6 +320646,41 @@ var init_collect_telemetry = __esm({
320105
320646
  }
320106
320647
  });
320107
320648
 
320649
+ // lib/cli/telemetry/schema.ts
320650
+ var ErrorName;
320651
+ var init_schema5 = __esm({
320652
+ "lib/cli/telemetry/schema.ts"() {
320653
+ "use strict";
320654
+ ErrorName = /* @__PURE__ */ ((ErrorName2) => {
320655
+ ErrorName2["TOOLKIT_ERROR"] = "ToolkitError";
320656
+ ErrorName2["AUTHENTICATION_ERROR"] = "AuthenticationError";
320657
+ ErrorName2["ASSEMBLY_ERROR"] = "AssemblyError";
320658
+ ErrorName2["CONTEXT_PROVIDER_ERROR"] = "ContextProviderError";
320659
+ ErrorName2["UNKNOWN_ERROR"] = "UnknownError";
320660
+ return ErrorName2;
320661
+ })(ErrorName || {});
320662
+ }
320663
+ });
320664
+
320665
+ // lib/cli/telemetry/error.ts
320666
+ function cdkCliErrorName(name) {
320667
+ if (!isKnownErrorName(name)) {
320668
+ return "UnknownError" /* UNKNOWN_ERROR */;
320669
+ }
320670
+ return name;
320671
+ }
320672
+ function isKnownErrorName(name) {
320673
+ return Object.values(ErrorName).includes(name);
320674
+ }
320675
+ var init_error2 = __esm({
320676
+ "lib/cli/telemetry/error.ts"() {
320677
+ "use strict";
320678
+ init_schema5();
320679
+ __name(cdkCliErrorName, "cdkCliErrorName");
320680
+ __name(isKnownErrorName, "isKnownErrorName");
320681
+ }
320682
+ });
320683
+
320108
320684
  // lib/cli/telemetry/messages.ts
320109
320685
  var CLI_PRIVATE_IO, CLI_PRIVATE_SPAN;
320110
320686
  var init_messages2 = __esm({
@@ -321093,6 +321669,12 @@ var require_cli_type_registry = __commonJS({
321093
321669
  type: "boolean",
321094
321670
  alias: "f",
321095
321671
  desc: "Do not ask for confirmation before destroying the stacks"
321672
+ },
321673
+ concurrency: {
321674
+ type: "number",
321675
+ desc: "Maximum number of simultaneous destroys (dependency permitting) to execute.",
321676
+ default: 1,
321677
+ requiresArg: true
321096
321678
  }
321097
321679
  }
321098
321680
  },
@@ -321509,22 +322091,6 @@ var init_sanitation = __esm({
321509
322091
  }
321510
322092
  });
321511
322093
 
321512
- // lib/cli/telemetry/schema.ts
321513
- var ErrorName;
321514
- var init_schema5 = __esm({
321515
- "lib/cli/telemetry/schema.ts"() {
321516
- "use strict";
321517
- ErrorName = /* @__PURE__ */ ((ErrorName2) => {
321518
- ErrorName2["TOOLKIT_ERROR"] = "ToolkitError";
321519
- ErrorName2["AUTHENTICATION_ERROR"] = "AuthenticationError";
321520
- ErrorName2["ASSEMBLY_ERROR"] = "AssemblyError";
321521
- ErrorName2["CONTEXT_PROVIDER_ERROR"] = "ContextProviderError";
321522
- ErrorName2["UNKNOWN_ERROR"] = "UnknownError";
321523
- return ErrorName2;
321524
- })(ErrorName || {});
321525
- }
321526
- });
321527
-
321528
322094
  // lib/cli/ci-systems.ts
321529
322095
  function detectCiSystem() {
321530
322096
  for (const ciSystem of CI_SYSTEMS) {
@@ -321665,6 +322231,9 @@ function isAbortedError(error5) {
321665
322231
  }
321666
322232
  return false;
321667
322233
  }
322234
+ function mutable(x10) {
322235
+ return x10;
322236
+ }
321668
322237
  var import_crypto7, import_toolkit_lib2, ABORTED_ERROR_MESSAGE, TelemetrySession;
321669
322238
  var init_session = __esm({
321670
322239
  "lib/cli/telemetry/session.ts"() {
@@ -321738,6 +322307,43 @@ var init_session = __esm({
321738
322307
  region
321739
322308
  };
321740
322309
  }
322310
+ /**
322311
+ * Attach a language guess
322312
+ */
322313
+ attachLanguage(language) {
322314
+ if (!this._sessionInfo) {
322315
+ return;
322316
+ }
322317
+ if (language) {
322318
+ mutable(this.sessionInfo.project).language = language;
322319
+ }
322320
+ }
322321
+ /**
322322
+ * Attach our best guess at running under an agent or not
322323
+ */
322324
+ attachAgent(isAgent) {
322325
+ if (!this._sessionInfo) {
322326
+ return;
322327
+ }
322328
+ mutable(this.sessionInfo.environment).agent = isAgent;
322329
+ }
322330
+ /**
322331
+ * Attach the CDK library version
322332
+ *
322333
+ * By default the telemetry will guess at the CDK library version if it so
322334
+ * happens that the CDK project is an NPM project and the CDK CLI is executed
322335
+ * in the root of NPM project with `aws-cdk-lib` available in `node_modules`.
322336
+ * This may succeed or may fail.
322337
+ *
322338
+ * Once we have produced and loaded the cloud assembly more accurate
322339
+ * information becomes available that we can add in.
322340
+ */
322341
+ attachCdkLibVersion(libVersion) {
322342
+ if (!this._sessionInfo) {
322343
+ return;
322344
+ }
322345
+ mutable(this.sessionInfo.identifiers).cdkLibraryVersion = libVersion;
322346
+ }
321741
322347
  /**
321742
322348
  * When the command is complete, so is the CliIoHost. Ends the span of the entire CliIoHost
321743
322349
  * and notifies with an optional error message in the data.
@@ -321769,7 +322375,8 @@ var init_session = __esm({
321769
322375
  error: {
321770
322376
  name: event.error.name
321771
322377
  }
321772
- } : {}
322378
+ } : {},
322379
+ ...event.counters && Object.keys(event.counters).length > 0 ? { counters: event.counters } : {}
321773
322380
  });
321774
322381
  }
321775
322382
  get sessionInfo() {
@@ -321781,6 +322388,7 @@ var init_session = __esm({
321781
322388
  };
321782
322389
  __name(getState, "getState");
321783
322390
  __name(isAbortedError, "isAbortedError");
322391
+ __name(mutable, "mutable");
321784
322392
  }
321785
322393
  });
321786
322394
 
@@ -322005,16 +322613,36 @@ function eventFromMessage(msg) {
322005
322613
  if (CLI_PRIVATE_IO.CDK_CLI_I3001.is(msg)) {
322006
322614
  return eventResult("DEPLOY", msg);
322007
322615
  }
322616
+ if (IO.CDK_TOOLKIT_I5410.is(msg)) {
322617
+ return hotswapToEventResult(msg.data);
322618
+ }
322008
322619
  return void 0;
322009
322620
  function eventResult(eventType, m10) {
322010
322621
  return {
322011
322622
  eventType,
322012
322623
  duration: m10.data.duration,
322013
- error: m10.data.error
322624
+ error: m10.data.error,
322625
+ counters: m10.data.counters
322014
322626
  };
322015
322627
  }
322016
322628
  __name(eventResult, "eventResult");
322017
322629
  }
322630
+ function hotswapToEventResult(result2) {
322631
+ return {
322632
+ eventType: "HOTSWAP",
322633
+ duration: result2.duration,
322634
+ ...result2.error ? {
322635
+ error: {
322636
+ name: cdkCliErrorName(result2.error.name)
322637
+ }
322638
+ } : {},
322639
+ counters: {
322640
+ hotswapped: result2.hotswapped ? 1 : 0,
322641
+ hotswappableChanges: result2.hotswappableChanges.length,
322642
+ nonHotswappableChanges: result2.nonHotswappableChanges.length
322643
+ }
322644
+ };
322645
+ }
322018
322646
  var util10, import_cloud_assembly_schema6, import_toolkit_lib6, chalk26, promptly, CliIoHost, styleMap2;
322019
322647
  var init_cli_io_host = __esm({
322020
322648
  "lib/cli/io-host/cli-io-host.ts"() {
@@ -322027,6 +322655,7 @@ var init_cli_io_host = __esm({
322027
322655
  init_api_private();
322028
322656
  init_deploy4();
322029
322657
  init_collect_telemetry();
322658
+ init_error2();
322030
322659
  init_messages2();
322031
322660
  init_session();
322032
322661
  init_endpoint_sink();
@@ -322227,7 +322856,7 @@ var init_cli_io_host = __esm({
322227
322856
  skipApprovalStep(msg) {
322228
322857
  const approvalToolkitCodes = ["CDK_TOOLKIT_I5060"];
322229
322858
  if (!(msg.code && approvalToolkitCodes.includes(msg.code))) {
322230
- false;
322859
+ return false;
322231
322860
  }
322232
322861
  switch (this.requireDeployApproval) {
322233
322862
  // Never require approval
@@ -322364,6 +322993,7 @@ var init_cli_io_host = __esm({
322364
322993
  __name(targetStreamObject, "targetStreamObject");
322365
322994
  __name(isNoticesMessage, "isNoticesMessage");
322366
322995
  __name(eventFromMessage, "eventFromMessage");
322996
+ __name(hotswapToEventResult, "hotswapToEventResult");
322367
322997
  }
322368
322998
  });
322369
322999
 
@@ -322776,25 +323406,6 @@ var init_singleton_plugin_host = __esm({
322776
323406
  }
322777
323407
  });
322778
323408
 
322779
- // lib/cli/telemetry/error.ts
322780
- function cdkCliErrorName(name) {
322781
- if (!isKnownErrorName(name)) {
322782
- return "UnknownError" /* UNKNOWN_ERROR */;
322783
- }
322784
- return name;
322785
- }
322786
- function isKnownErrorName(name) {
322787
- return Object.values(ErrorName).includes(name);
322788
- }
322789
- var init_error2 = __esm({
322790
- "lib/cli/telemetry/error.ts"() {
322791
- "use strict";
322792
- init_schema5();
322793
- __name(cdkCliErrorName, "cdkCliErrorName");
322794
- __name(isKnownErrorName, "isKnownErrorName");
322795
- }
322796
- });
322797
-
322798
323409
  // lib/context-providers.ts
322799
323410
  var init_context_providers2 = __esm({
322800
323411
  "lib/context-providers.ts"() {
@@ -322818,10 +323429,25 @@ function setsEqual(a10, b10) {
322818
323429
  }
322819
323430
  return true;
322820
323431
  }
322821
- var import_toolkit_lib9, CloudExecutable;
323432
+ function countAssemblyResults2(span, assembly) {
323433
+ const stacksRecursively = assembly.stacksRecursively;
323434
+ span.incCounter("stacks", stacksRecursively.length);
323435
+ span.incCounter("errorAnns", sum4(stacksRecursively.map((s10) => s10.messages.filter((m10) => m10.level === import_cloud_assembly_api15.SynthesisMessageLevel.ERROR).length)));
323436
+ span.incCounter("warnings", sum4(stacksRecursively.map((s10) => s10.messages.filter((m10) => m10.level === import_cloud_assembly_api15.SynthesisMessageLevel.WARNING).length)));
323437
+ span.incCounter("assemblies", asmCount(assembly));
323438
+ function asmCount(x10) {
323439
+ return 1 + x10.nestedAssemblies.reduce((acc, asm) => acc + asmCount(asm.nestedAssembly), 0);
323440
+ }
323441
+ __name(asmCount, "asmCount");
323442
+ }
323443
+ function sum4(xs) {
323444
+ return xs.reduce((a10, b10) => a10 + b10, 0);
323445
+ }
323446
+ var import_cloud_assembly_api15, import_toolkit_lib9, CloudExecutable;
322822
323447
  var init_cloud_executable = __esm({
322823
323448
  "lib/cxapp/cloud-executable.ts"() {
322824
323449
  "use strict";
323450
+ import_cloud_assembly_api15 = __toESM(require_lib3());
322825
323451
  import_toolkit_lib9 = __toESM(require_lib13());
322826
323452
  init_cloud_assembly5();
322827
323453
  init_api_private();
@@ -322880,20 +323506,26 @@ var init_cloud_executable = __esm({
322880
323506
  }
322881
323507
  previouslyMissingKeys = missingKeys;
322882
323508
  if (tryLookup) {
322883
- await this.props.ioHelper.defaults.debug("Some context information is missing. Fetching...");
322884
- const updates = await provideContextValues(
322885
- assembly.manifest.missing,
322886
- this.props.sdkProvider,
322887
- GLOBAL_PLUGIN_HOST,
322888
- this.props.ioHelper
322889
- );
322890
- for (const [key, value] of Object.entries(updates)) {
322891
- this.props.configuration.context.set(key, value);
323509
+ const lookupsTimer = synthSpan.startTimer("lookups");
323510
+ try {
323511
+ await this.props.ioHelper.defaults.debug("Some context information is missing. Fetching...");
323512
+ const updates = await provideContextValues(
323513
+ assembly.manifest.missing,
323514
+ this.props.sdkProvider,
323515
+ GLOBAL_PLUGIN_HOST,
323516
+ this.props.ioHelper
323517
+ );
323518
+ for (const [key, value] of Object.entries(updates)) {
323519
+ this.props.configuration.context.set(key, value);
323520
+ }
323521
+ await this.props.configuration.saveContext();
323522
+ } finally {
323523
+ lookupsTimer.stop();
322892
323524
  }
322893
- await this.props.configuration.saveContext();
322894
323525
  continue;
322895
323526
  }
322896
323527
  }
323528
+ countAssemblyResults2(synthSpan, assembly);
322897
323529
  return new CloudAssembly5(assembly, this.props.ioHelper);
322898
323530
  }
322899
323531
  } catch (e10) {
@@ -322911,6 +323543,8 @@ var init_cloud_executable = __esm({
322911
323543
  };
322912
323544
  __name(missingContextKeys2, "missingContextKeys");
322913
323545
  __name(setsEqual, "setsEqual");
323546
+ __name(countAssemblyResults2, "countAssemblyResults");
323547
+ __name(sum4, "sum");
322914
323548
  }
322915
323549
  });
322916
323550
 
@@ -323019,10 +323653,10 @@ async function execProgram(aws, ioHelper, config) {
323019
323653
  throw new import_toolkit_lib11.ToolkitError(`Could not create output directory ${outdir} (${error5.message})`);
323020
323654
  }
323021
323655
  await debugFn(`outdir: ${outdir}`);
323022
- env2[cxapi8.OUTDIR_ENV] = outdir;
323656
+ env2[cxapi9.OUTDIR_ENV] = outdir;
323023
323657
  const writerLock = await new RWLock(outdir).acquireWrite();
323024
- env2[cxapi8.CLI_ASM_VERSION_ENV] = cxschema11.Manifest.version();
323025
- env2[cxapi8.CLI_VERSION_ENV] = versionNumber2();
323658
+ env2[cxapi9.CLI_ASM_VERSION_ENV] = cxschema11.Manifest.version();
323659
+ env2[cxapi9.CLI_VERSION_ENV] = versionNumber2();
323026
323660
  await debugFn((0, import_util68.format)("env:", env2));
323027
323661
  const cleanupTemp = writeContextToEnv(env2, context, "add-process-env-later");
323028
323662
  try {
@@ -323065,7 +323699,7 @@ async function execProgram(aws, ioHelper, config) {
323065
323699
  }
323066
323700
  function createAssembly(appDir) {
323067
323701
  try {
323068
- return new import_cloud_assembly_api14.CloudAssembly(appDir, {
323702
+ return new import_cloud_assembly_api16.CloudAssembly(appDir, {
323069
323703
  // We sort as we deploy
323070
323704
  topoSort: false
323071
323705
  });
@@ -323080,15 +323714,15 @@ function createAssembly(appDir) {
323080
323714
  function noUndefined2(xs) {
323081
323715
  return Object.fromEntries(Object.entries(xs).filter(([_2, v10]) => v10 !== void 0));
323082
323716
  }
323083
- var childProcess, import_util68, import_cloud_assembly_api14, cxschema11, cxapi8, import_toolkit_lib11, fs40;
323717
+ var childProcess, import_util68, import_cloud_assembly_api16, cxschema11, cxapi9, import_toolkit_lib11, fs40;
323084
323718
  var init_exec2 = __esm({
323085
323719
  "lib/cxapp/exec.ts"() {
323086
323720
  "use strict";
323087
323721
  childProcess = __toESM(require("child_process"));
323088
323722
  import_util68 = require("util");
323089
- import_cloud_assembly_api14 = __toESM(require_lib3());
323723
+ import_cloud_assembly_api16 = __toESM(require_lib3());
323090
323724
  cxschema11 = __toESM(require_lib2());
323091
- cxapi8 = __toESM(require_lib12());
323725
+ cxapi9 = __toESM(require_lib12());
323092
323726
  import_toolkit_lib11 = __toESM(require_lib13());
323093
323727
  fs40 = __toESM(require_lib14());
323094
323728
  init_api();
@@ -324467,8 +325101,8 @@ function chunks(list2, chunkSize) {
324467
325101
  }
324468
325102
  function setEnvironment(account, region) {
324469
325103
  return {
324470
- account: account ?? import_cloud_assembly_api15.UNKNOWN_ACCOUNT,
324471
- region: region ?? import_cloud_assembly_api15.UNKNOWN_REGION,
325104
+ account: account ?? import_cloud_assembly_api17.UNKNOWN_ACCOUNT,
325105
+ region: region ?? import_cloud_assembly_api17.UNKNOWN_REGION,
324472
325106
  name: "cdk-migrate-env"
324473
325107
  };
324474
325108
  }
@@ -324651,13 +325285,13 @@ function deduplicateResources(resources) {
324651
325285
  }
324652
325286
  return Object.values(uniqueResources);
324653
325287
  }
324654
- var fs42, path39, import_cloud_assembly_api15, import_toolkit_lib15, cdk_from_cfn, chalk29, camelCase2, decamelize2, MIGRATE_SUPPORTED_LANGUAGES, FilterType, CfnTemplateGeneratorProvider;
325288
+ var fs42, path39, import_cloud_assembly_api17, import_toolkit_lib15, cdk_from_cfn, chalk29, camelCase2, decamelize2, MIGRATE_SUPPORTED_LANGUAGES, FilterType, CfnTemplateGeneratorProvider;
324655
325289
  var init_migrate = __esm({
324656
325290
  "lib/commands/migrate.ts"() {
324657
325291
  "use strict";
324658
325292
  fs42 = __toESM(require("fs"));
324659
325293
  path39 = __toESM(require("path"));
324660
- import_cloud_assembly_api15 = __toESM(require_lib3());
325294
+ import_cloud_assembly_api17 = __toESM(require_lib3());
324661
325295
  import_toolkit_lib15 = __toESM(require_lib13());
324662
325296
  cdk_from_cfn = __toESM(require_cdk_from_cfn());
324663
325297
  chalk29 = __toESM(require_source());
@@ -325980,13 +326614,13 @@ function stackMetadataLogger(ioHelper, verbose) {
325980
326614
  function requiresApproval(requireApproval, permissionChangeType) {
325981
326615
  return requireApproval === import_cloud_assembly_schema7.RequireApproval.ANYCHANGE || requireApproval === import_cloud_assembly_schema7.RequireApproval.BROADENING && permissionChangeType === import_toolkit_lib17.PermissionChangeType.BROADENING;
325982
326616
  }
325983
- var path41, import_util72, cxapi9, import_cloud_assembly_schema7, import_toolkit_lib17, chalk31, fs44, pLimit5, FILE_EVENTS2, InternalToolkit, CdkToolkit;
326617
+ var path41, import_util72, cxapi10, import_cloud_assembly_schema7, import_toolkit_lib17, chalk31, fs44, pLimit5, FILE_EVENTS2, InternalToolkit, CdkToolkit;
325984
326618
  var init_cdk_toolkit = __esm({
325985
326619
  "lib/cli/cdk-toolkit.ts"() {
325986
326620
  "use strict";
325987
326621
  path41 = __toESM(require("path"));
325988
326622
  import_util72 = require("util");
325989
- cxapi9 = __toESM(require_lib3());
326623
+ cxapi10 = __toESM(require_lib3());
325990
326624
  import_cloud_assembly_schema7 = __toESM(require_lib2());
325991
326625
  import_toolkit_lib17 = __toESM(require_lib13());
325992
326626
  chalk31 = __toESM(require_source());
@@ -326271,7 +326905,8 @@ var init_cdk_toolkit = __esm({
326271
326905
  `Stack ${stack.displayName} does not define an environment, and AWS credentials could not be obtained from standard locations or no region was configured.`
326272
326906
  );
326273
326907
  }
326274
- if (Object.keys(stack.template.Resources || {}).length === 0) {
326908
+ const resourceCount = Object.keys(stack.template.Resources || {}).length;
326909
+ if (resourceCount === 0) {
326275
326910
  if (!await this.props.deployments.stackExists({ stack })) {
326276
326911
  await this.ioHost.asIoHelper().defaults.warn("%s: stack has no resources, skipping deployment.", chalk31.bold(stack.displayName));
326277
326912
  } else {
@@ -326296,8 +326931,9 @@ var init_cdk_toolkit = __esm({
326296
326931
  });
326297
326932
  const securityDiff = formatter.formatSecurityDiff();
326298
326933
  if (requiresApproval(requireApproval, securityDiff.permissionChangeType)) {
326299
- const motivation = '"--require-approval" is enabled and stack includes security-sensitive updates';
326934
+ const motivation = requireApproval === import_cloud_assembly_schema7.RequireApproval.ANYCHANGE ? `"--require-approval" is set to '${import_cloud_assembly_schema7.RequireApproval.ANYCHANGE}'` : '"--require-approval" is enabled and stack includes security-sensitive updates';
326300
326935
  await this.ioHost.asIoHelper().defaults.info(securityDiff.formattedDiff);
326936
+ this.ioHost.requireDeployApproval = requireApproval;
326301
326937
  await askUserConfirmation(
326302
326938
  this.ioHost,
326303
326939
  IO.CDK_TOOLKIT_I5060.req(`${motivation}: 'Do you wish to deploy these changes'`, {
@@ -326323,6 +326959,7 @@ var init_cdk_toolkit = __esm({
326323
326959
  tags = tagsForStack(stack);
326324
326960
  }
326325
326961
  const deploySpan = await this.ioHost.asIoHelper().span(CLI_PRIVATE_SPAN.DEPLOY).begin({});
326962
+ deploySpan.incCounter("resources", resourceCount);
326326
326963
  let error5;
326327
326964
  let elapsedDeployTime = 0;
326328
326965
  try {
@@ -326454,7 +327091,7 @@ var init_cdk_toolkit = __esm({
326454
327091
  }
326455
327092
  const stacksAndTheirAssetManifests = stacks.flatMap((stack) => [
326456
327093
  stack,
326457
- ...stack.dependencies.filter((x10) => cxapi9.AssetManifestArtifact.isAssetManifestArtifact(x10))
327094
+ ...stack.dependencies.filter((x10) => cxapi10.AssetManifestArtifact.isAssetManifestArtifact(x10))
326458
327095
  ]);
326459
327096
  const workGraph = new WorkGraphBuilder(
326460
327097
  asIoHelper(this.ioHost, "deploy"),
@@ -326671,7 +327308,7 @@ var init_cdk_toolkit = __esm({
326671
327308
  }
326672
327309
  async destroy(options) {
326673
327310
  const ioHelper = this.ioHost.asIoHelper();
326674
- const stacks = (await this.selectStacksForDestroy(options.selector, options.exclusively)).reversed();
327311
+ const stacks = await this.selectStacksForDestroy(options.selector, options.exclusively);
326675
327312
  if (!options.force) {
326676
327313
  const motivation = "Destroying stacks is an irreversible action";
326677
327314
  const question2 = `Are you sure you want to delete: ${chalk31.blue(stacks.stackArtifacts.map((s10) => s10.hierarchicalId).join(", "))}`;
@@ -326685,9 +327322,16 @@ var init_cdk_toolkit = __esm({
326685
327322
  return;
326686
327323
  }
326687
327324
  }
327325
+ const concurrency = options.concurrency || 1;
326688
327326
  const action = options.fromDeploy ? "deploy" : "destroy";
326689
- for (const [index, stack] of stacks.stackArtifacts.entries()) {
326690
- await ioHelper.defaults.info(chalk31.green("%s: destroying... [%s/%s]"), chalk31.blue(stack.displayName), index + 1, stacks.stackCount);
327327
+ let destroyCount = 0;
327328
+ if (concurrency > 1) {
327329
+ this.ioHost.stackProgress = "events" /* EVENTS */;
327330
+ }
327331
+ const destroyStack2 = /* @__PURE__ */ __name(async (stackNode) => {
327332
+ const stack = stackNode.stack;
327333
+ destroyCount++;
327334
+ await ioHelper.defaults.info(chalk31.green("%s: destroying... [%s/%s]"), chalk31.blue(stack.displayName), destroyCount, stacks.stackCount);
326691
327335
  try {
326692
327336
  await this.props.deployments.destroyStack({
326693
327337
  stack,
@@ -326701,7 +327345,9 @@ var init_cdk_toolkit = __esm({
326701
327345
  \u274C %s: ${action} failed`, chalk31.blue(stack.displayName), e10);
326702
327346
  throw e10;
326703
327347
  }
326704
- }
327348
+ }, "destroyStack");
327349
+ const workGraph = buildDestroyWorkGraph(stacks.stackArtifacts, ioHelper);
327350
+ await workGraph.processStacks(concurrency, destroyStack2);
326705
327351
  }
326706
327352
  async list(selectors, options = {}) {
326707
327353
  const stacks = await listStacks2(this, {
@@ -332684,6 +333330,11 @@ function parseCommandLineArguments(args) {
332684
333330
  type: "boolean",
332685
333331
  alias: "f",
332686
333332
  desc: "Do not ask for confirmation before destroying the stacks"
333333
+ }).option("concurrency", {
333334
+ default: 1,
333335
+ type: "number",
333336
+ desc: "Maximum number of simultaneous destroys (dependency permitting) to execute.",
333337
+ requiresArg: true
332687
333338
  })
332688
333339
  ).command(
332689
333340
  "diff [STACKS..]",
@@ -361137,7 +361788,7 @@ async function displayCdkEnvironmentVariables(ioHelper) {
361137
361788
  await ioHelper.defaults.info("\u2139\uFE0F CDK environment variables:");
361138
361789
  let healthy = true;
361139
361790
  for (const key of keys.sort()) {
361140
- if (key === cxapi10.CONTEXT_ENV || key === cxapi10.CONTEXT_OVERFLOW_LOCATION_ENV || key === cxapi10.OUTDIR_ENV) {
361791
+ if (key === cxapi11.CONTEXT_ENV || key === cxapi11.CONTEXT_OVERFLOW_LOCATION_ENV || key === cxapi11.OUTDIR_ENV) {
361141
361792
  await ioHelper.defaults.info(` - ${chalk36.red(key)} = ${chalk36.green(process2.env[key])} (\u26A0\uFE0F reserved for use by the CDK toolkit)`);
361142
361793
  healthy = false;
361143
361794
  } else {
@@ -361155,12 +361806,12 @@ function anonymizeAwsVariable(name, value) {
361155
361806
  }
361156
361807
  return value;
361157
361808
  }
361158
- var process2, cxapi10, chalk36, verifications;
361809
+ var process2, cxapi11, chalk36, verifications;
361159
361810
  var init_doctor = __esm({
361160
361811
  "lib/commands/doctor.ts"() {
361161
361812
  "use strict";
361162
361813
  process2 = __toESM(require("process"));
361163
- cxapi10 = __toESM(require_lib12());
361814
+ cxapi11 = __toESM(require_lib12());
361164
361815
  chalk36 = __toESM(require_source());
361165
361816
  init_display_version();
361166
361817
  init_version();
@@ -366081,6 +366732,33 @@ var init_flags = __esm({
366081
366732
  }
366082
366733
  });
366083
366734
 
366735
+ // lib/cli/util/guess-agent.ts
366736
+ function guessAgent() {
366737
+ const awsExecutionEnv = (process.env.AWS_EXECUTION_ENV ?? "").toLocaleLowerCase();
366738
+ if (awsExecutionEnv.includes("amazonq") || awsExecutionEnv.includes("kiro")) {
366739
+ return true;
366740
+ }
366741
+ if (process.env.CLAUDECODE) {
366742
+ return true;
366743
+ }
366744
+ if (Object.keys(process.env).some((x10) => x10.startsWith("CODEX_"))) {
366745
+ return true;
366746
+ }
366747
+ if (process.env.CURSOR_AGENT) {
366748
+ return true;
366749
+ }
366750
+ if (Object.keys(process.env).some((x10) => x10.startsWith("CLINE_"))) {
366751
+ return true;
366752
+ }
366753
+ return void 0;
366754
+ }
366755
+ var init_guess_agent = __esm({
366756
+ "lib/cli/util/guess-agent.ts"() {
366757
+ "use strict";
366758
+ __name(guessAgent, "guessAgent");
366759
+ }
366760
+ });
366761
+
366084
366762
  // lib/cli/cli.ts
366085
366763
  var cli_exports = {};
366086
366764
  __export(cli_exports, {
@@ -366146,6 +366824,8 @@ async function exec4(args, synthesizer) {
366146
366824
  } catch (e10) {
366147
366825
  await ioHost.asIoHelper().defaults.trace(`Telemetry instantiation failed: ${e10.message}`);
366148
366826
  }
366827
+ ioHost.telemetry?.attachLanguage(await guessLanguage(process.cwd()));
366828
+ ioHost.telemetry?.attachAgent(guessAgent());
366149
366829
  const isSafeToWriteNotices = !isCI2() || Boolean(ciSystemIsStdErrSafe());
366150
366830
  let shouldDisplayNotices;
366151
366831
  if (argv.notices !== void 0) {
@@ -366191,6 +366871,13 @@ async function exec4(args, synthesizer) {
366191
366871
  await outDirLock?.release();
366192
366872
  const { assembly, lock } = await execProgram(aws, ioHost.asIoHelper(), config);
366193
366873
  outDirLock = lock;
366874
+ const tree = await loadTree(assembly, ioHelper.defaults.trace.bind(ioHelper.defaults));
366875
+ if (tree) {
366876
+ const v10 = findConstructLibraryVersion(tree);
366877
+ if (v10) {
366878
+ ioHost.telemetry?.attachCdkLibVersion(v10);
366879
+ }
366880
+ }
366194
366881
  return assembly;
366195
366882
  }),
366196
366883
  ioHelper: ioHost.asIoHelper()
@@ -366286,7 +366973,7 @@ async function exec4(args, synthesizer) {
366286
366973
  });
366287
366974
  case "diff":
366288
366975
  ioHost.currentAction = "diff";
366289
- const enableDiffNoFail = isFeatureEnabled(configuration, cxapi11.ENABLE_DIFF_NO_FAIL_CONTEXT);
366976
+ const enableDiffNoFail = isFeatureEnabled(configuration, cxapi12.ENABLE_DIFF_NO_FAIL_CONTEXT);
366290
366977
  return cli2.diff({
366291
366978
  stackNames: args2.STACKS,
366292
366979
  exclusively: args2.exclusively,
@@ -366439,7 +367126,8 @@ async function exec4(args, synthesizer) {
366439
367126
  selector,
366440
367127
  exclusively: args2.exclusively,
366441
367128
  force: args2.force,
366442
- roleArn: args2.roleArn
367129
+ roleArn: args2.roleArn,
367130
+ concurrency: args2.concurrency
366443
367131
  });
366444
367132
  case "gc":
366445
367133
  ioHost.currentAction = "gc";
@@ -366563,7 +367251,7 @@ async function determineBootstrapVersion(ioHost, args) {
366563
367251
  return source;
366564
367252
  }
366565
367253
  function isFeatureEnabled(configuration, featureFlag) {
366566
- return configuration.context.get(featureFlag) ?? cxapi11.futureFlagDefault(featureFlag);
367254
+ return configuration.context.get(featureFlag) ?? cxapi12.futureFlagDefault(featureFlag);
366567
367255
  }
366568
367256
  function arrayFromYargs(xs) {
366569
367257
  if (xs.length === 0) {
@@ -366672,11 +367360,11 @@ function cli(args = process.argv.slice(2)) {
366672
367360
  }
366673
367361
  });
366674
367362
  }
366675
- var cxapi11, import_toolkit_lib21, chalk37;
367363
+ var cxapi12, import_toolkit_lib21, chalk37;
366676
367364
  var init_cli = __esm({
366677
367365
  "lib/cli/cli.ts"() {
366678
367366
  "use strict";
366679
- cxapi11 = __toESM(require_lib12());
367367
+ cxapi12 = __toESM(require_lib12());
366680
367368
  import_toolkit_lib21 = __toESM(require_lib13());
366681
367369
  chalk37 = __toESM(require_source());
366682
367370
  init_util7();
@@ -366708,6 +367396,7 @@ var init_cli = __esm({
366708
367396
  init_migrate();
366709
367397
  init_cxapp();
366710
367398
  init_ci();
367399
+ init_guess_agent();
366711
367400
  __name(exec4, "exec");
366712
367401
  __name(determineBootstrapVersion, "determineBootstrapVersion");
366713
367402
  __name(isFeatureEnabled, "isFeatureEnabled");