ooxml-core 1.27.2 → 1.28.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (72) hide show
  1. package/dist/{PptxHandler-WRJXTPGV.mjs → PptxHandler-AFVUHNJO.mjs} +3 -3
  2. package/dist/PptxHandler-EZW4YAWL.mjs +4 -0
  3. package/dist/{PptxHandler-FRQKHTCM.cjs → PptxHandler-WI23AJHM.cjs} +3 -3
  4. package/dist/{PresentationBuilder-POXKHTV7.mjs → PresentationBuilder-DYEHCRHX.mjs} +2 -2
  5. package/dist/{PresentationBuilder-YO5YOTA3.cjs → PresentationBuilder-KUNPJTRL.cjs} +5 -5
  6. package/dist/{PresentationBuilder-LWR5X3JA.mjs → PresentationBuilder-WGTZPVOG.mjs} +3 -3
  7. package/dist/automation/index.cjs +16 -7
  8. package/dist/automation/index.mjs +16 -7
  9. package/dist/chart/index.cjs +16 -7
  10. package/dist/chart/index.mjs +16 -7
  11. package/dist/{chunk-36TR3PER.cjs → chunk-A2PC3CBO.cjs} +28 -7
  12. package/dist/{chunk-XW4XB6P4.mjs → chunk-D7CAHL6J.mjs} +1 -1
  13. package/dist/{chunk-JJ37PCNR.mjs → chunk-EYCM7RVL.mjs} +28 -7
  14. package/dist/{chunk-K6DNX3YC.cjs → chunk-IQ7CB7BJ.cjs} +1581 -1232
  15. package/dist/{chunk-G67MARDL.mjs → chunk-LGSBK3BV.mjs} +258 -258
  16. package/dist/{chunk-I57SMSU6.mjs → chunk-LNPVKKR5.mjs} +28 -7
  17. package/dist/{chunk-RNUYMB73.mjs → chunk-N5ROEHEQ.mjs} +509 -160
  18. package/dist/{chunk-TIQWSSGI.mjs → chunk-RCEHCVLC.mjs} +1 -1
  19. package/dist/{chunk-3VIPI6IA.mjs → chunk-V33RUK4D.mjs} +5 -5
  20. package/dist/{chunk-6LCBTFNL.mjs → chunk-YNGMSNF4.mjs} +528 -159
  21. package/dist/docx/embedded.cjs +16 -7
  22. package/dist/docx/embedded.mjs +16 -7
  23. package/dist/docx/index.cjs +16 -7
  24. package/dist/docx/index.mjs +16 -7
  25. package/dist/docx/load/index.cjs +16 -7
  26. package/dist/docx/load/index.mjs +16 -7
  27. package/dist/index.cjs +16 -7
  28. package/dist/index.mjs +16 -7
  29. package/dist/opc/index.cjs +16 -7
  30. package/dist/opc/index.mjs +16 -7
  31. package/dist/opc/zip-limits.d.ts +8 -1
  32. package/dist/opc/zip-limits.d.ts.map +1 -1
  33. package/dist/pptx/automation/index.cjs +807 -418
  34. package/dist/pptx/automation/index.d.ts +4 -4
  35. package/dist/pptx/automation/index.mjs +6 -6
  36. package/dist/pptx/chunks/{index-D_d4NTVP.d.ts → index-0slnMhMO.d.ts} +126 -10
  37. package/dist/pptx/chunks/index-0slnMhMO.d.ts.map +1 -0
  38. package/dist/pptx/chunks/{index-CdRlUz-v.d.ts → index-DP-R2qY1.d.ts} +3 -3
  39. package/dist/pptx/chunks/{index-CdRlUz-v.d.ts.map → index-DP-R2qY1.d.ts.map} +1 -1
  40. package/dist/pptx/chunks/{index-lwMA6pP5.d.ts → index-OQwOyNYK.d.ts} +4 -4
  41. package/dist/pptx/chunks/{index-lwMA6pP5.d.ts.map → index-OQwOyNYK.d.ts.map} +1 -1
  42. package/dist/pptx/chunks/{text-operations-CNfUj45U.d.ts → text-operations-dyvh8gyE.d.ts} +23 -1
  43. package/dist/pptx/chunks/{text-operations-CNfUj45U.d.ts.map → text-operations-dyvh8gyE.d.ts.map} +1 -1
  44. package/dist/pptx/cli/index.cjs +632 -246
  45. package/dist/pptx/cli/index.d.ts +1 -1
  46. package/dist/pptx/cli/index.mjs +5 -5
  47. package/dist/pptx/converter/index.d.ts +1 -1
  48. package/dist/pptx/converter/index.mjs +3 -3
  49. package/dist/pptx/editor/render/find-replace.cjs +14 -14
  50. package/dist/pptx/editor/render/find-replace.d.ts +2 -2
  51. package/dist/pptx/editor/render/find-replace.mjs +1 -1
  52. package/dist/pptx/editor/render/slide-operations.cjs +8 -8
  53. package/dist/pptx/editor/render/slide-operations.mjs +2 -2
  54. package/dist/pptx/index.cjs +1047 -639
  55. package/dist/pptx/index.d.ts +5 -5
  56. package/dist/pptx/index.mjs +6 -6
  57. package/dist/pptx/node/index.d.ts +1 -1
  58. package/dist/pptx/signature-node/index.cjs +28 -7
  59. package/dist/pptx/signature-node/index.mjs +2 -2
  60. package/dist/visio/index.cjs +14 -6
  61. package/dist/visio/index.mjs +14 -6
  62. package/dist/visio/ui/index.cjs +14 -6
  63. package/dist/visio/ui/index.mjs +14 -6
  64. package/dist/xlsx/index.cjs +14 -6
  65. package/dist/xlsx/index.mjs +14 -6
  66. package/dist/xlsx/load/index.cjs +14 -6
  67. package/dist/xlsx/load/index.mjs +14 -6
  68. package/dist/xlsx/ui/index.cjs +14 -6
  69. package/dist/xlsx/ui/index.mjs +14 -6
  70. package/package.json +5 -5
  71. package/dist/PptxHandler-RETSKQ5E.mjs +0 -4
  72. package/dist/pptx/chunks/index-D_d4NTVP.d.ts.map +0 -1
@@ -1525,11 +1525,14 @@ var ZipLimitError = class extends Error {
1525
1525
  limit;
1526
1526
  /** The check that failed (absent when the error was built without one). */
1527
1527
  kind;
1528
+ /** The observed value, when known (a lower bound for a size found while inflating). */
1529
+ actual;
1528
1530
  constructor(message, details) {
1529
1531
  super(message);
1530
1532
  this.name = "ZipLimitError";
1531
1533
  this.limit = details.limit;
1532
1534
  this.kind = details.kind;
1535
+ this.actual = details.actual;
1533
1536
  }
1534
1537
  };
1535
1538
  var mib = (bytes) => Math.round(bytes / 1048576);
@@ -1552,7 +1555,7 @@ function resolveLimits(limits) {
1552
1555
  maxEntryBytes: limits.maxEntryBytes ?? DEFAULT_ZIP_LIMITS.maxEntryBytes,
1553
1556
  maxTotalBytes: limits.maxTotalBytes ?? DEFAULT_ZIP_LIMITS.maxTotalBytes,
1554
1557
  label: limits.label ?? "ZIP",
1555
- fail: (message, limit, kind) => create2 ? create2(message, { limit, kind }) : new ZipLimitError(message, { limit, kind })
1558
+ fail: (message, limit, kind, actual) => create2 ? create2(message, { limit, kind, actual }) : new ZipLimitError(message, { limit, kind, actual })
1556
1559
  };
1557
1560
  }
1558
1561
  async function inflateEntryGuarded(entry2, alreadyRead, limits) {
@@ -1607,7 +1610,8 @@ async function* streamEntryGuarded(entry2, alreadyRead, limits) {
1607
1610
  r.fail(
1608
1611
  `${r.label} part ${entry2.name} inflates past its declared size`,
1609
1612
  r.maxEntryBytes,
1610
- size > declared ? "declaredSize" : "maxEntryBytes"
1613
+ size > declared ? "declaredSize" : "maxEntryBytes",
1614
+ size
1611
1615
  )
1612
1616
  );
1613
1617
  if (alreadyRead + size > r.maxTotalBytes)
@@ -1615,7 +1619,8 @@ async function* streamEntryGuarded(entry2, alreadyRead, limits) {
1615
1619
  r.fail(
1616
1620
  `${r.label} package exceeds the ${mib(r.maxTotalBytes)} MiB uncompressed content limit`,
1617
1621
  r.maxTotalBytes,
1618
- "maxTotalBytes"
1622
+ "maxTotalBytes",
1623
+ alreadyRead + size
1619
1624
  )
1620
1625
  );
1621
1626
  queue.push(chunk);
@@ -1662,7 +1667,8 @@ function guardZip(zip, limits = {}) {
1662
1667
  throw r.fail(
1663
1668
  `${r.label} package exceeds the ${r.maxEntries.toLocaleString("en-US")} part limit`,
1664
1669
  r.maxEntries,
1665
- "maxEntries"
1670
+ "maxEntries",
1671
+ entries.length
1666
1672
  );
1667
1673
  let declared = 0;
1668
1674
  for (const entry2 of entries) {
@@ -1675,7 +1681,8 @@ function guardZip(zip, limits = {}) {
1675
1681
  throw r.fail(
1676
1682
  `${r.label} part ${entry2.name} exceeds the uncompressed part size limit`,
1677
1683
  r.maxEntryBytes,
1678
- "maxEntryBytes"
1684
+ "maxEntryBytes",
1685
+ size
1679
1686
  );
1680
1687
  declared += size;
1681
1688
  }
@@ -1683,7 +1690,8 @@ function guardZip(zip, limits = {}) {
1683
1690
  throw r.fail(
1684
1691
  `${r.label} package exceeds the ${mib(r.maxTotalBytes)} MiB uncompressed content limit`,
1685
1692
  r.maxTotalBytes,
1686
- "maxTotalBytes"
1693
+ "maxTotalBytes",
1694
+ declared
1687
1695
  );
1688
1696
  const produced = /* @__PURE__ */ new Map();
1689
1697
  let total = 0;
@@ -1722,7 +1730,8 @@ async function openZip(input, limits = {}) {
1722
1730
  throw r.fail(
1723
1731
  `${r.label} package exceeds the ${mib(maxInput)} MiB compressed input limit`,
1724
1732
  maxInput,
1725
- "maxInputBytes"
1733
+ "maxInputBytes",
1734
+ bytes.byteLength
1726
1735
  );
1727
1736
  return guardZip(await JSZip__default.default.loadAsync(bytes), limits);
1728
1737
  }
@@ -1519,11 +1519,14 @@ var ZipLimitError = class extends Error {
1519
1519
  limit;
1520
1520
  /** The check that failed (absent when the error was built without one). */
1521
1521
  kind;
1522
+ /** The observed value, when known (a lower bound for a size found while inflating). */
1523
+ actual;
1522
1524
  constructor(message, details) {
1523
1525
  super(message);
1524
1526
  this.name = "ZipLimitError";
1525
1527
  this.limit = details.limit;
1526
1528
  this.kind = details.kind;
1529
+ this.actual = details.actual;
1527
1530
  }
1528
1531
  };
1529
1532
  var mib = (bytes) => Math.round(bytes / 1048576);
@@ -1546,7 +1549,7 @@ function resolveLimits(limits) {
1546
1549
  maxEntryBytes: limits.maxEntryBytes ?? DEFAULT_ZIP_LIMITS.maxEntryBytes,
1547
1550
  maxTotalBytes: limits.maxTotalBytes ?? DEFAULT_ZIP_LIMITS.maxTotalBytes,
1548
1551
  label: limits.label ?? "ZIP",
1549
- fail: (message, limit, kind) => create2 ? create2(message, { limit, kind }) : new ZipLimitError(message, { limit, kind })
1552
+ fail: (message, limit, kind, actual) => create2 ? create2(message, { limit, kind, actual }) : new ZipLimitError(message, { limit, kind, actual })
1550
1553
  };
1551
1554
  }
1552
1555
  async function inflateEntryGuarded(entry2, alreadyRead, limits) {
@@ -1601,7 +1604,8 @@ async function* streamEntryGuarded(entry2, alreadyRead, limits) {
1601
1604
  r.fail(
1602
1605
  `${r.label} part ${entry2.name} inflates past its declared size`,
1603
1606
  r.maxEntryBytes,
1604
- size > declared ? "declaredSize" : "maxEntryBytes"
1607
+ size > declared ? "declaredSize" : "maxEntryBytes",
1608
+ size
1605
1609
  )
1606
1610
  );
1607
1611
  if (alreadyRead + size > r.maxTotalBytes)
@@ -1609,7 +1613,8 @@ async function* streamEntryGuarded(entry2, alreadyRead, limits) {
1609
1613
  r.fail(
1610
1614
  `${r.label} package exceeds the ${mib(r.maxTotalBytes)} MiB uncompressed content limit`,
1611
1615
  r.maxTotalBytes,
1612
- "maxTotalBytes"
1616
+ "maxTotalBytes",
1617
+ alreadyRead + size
1613
1618
  )
1614
1619
  );
1615
1620
  queue.push(chunk);
@@ -1656,7 +1661,8 @@ function guardZip(zip, limits = {}) {
1656
1661
  throw r.fail(
1657
1662
  `${r.label} package exceeds the ${r.maxEntries.toLocaleString("en-US")} part limit`,
1658
1663
  r.maxEntries,
1659
- "maxEntries"
1664
+ "maxEntries",
1665
+ entries.length
1660
1666
  );
1661
1667
  let declared = 0;
1662
1668
  for (const entry2 of entries) {
@@ -1669,7 +1675,8 @@ function guardZip(zip, limits = {}) {
1669
1675
  throw r.fail(
1670
1676
  `${r.label} part ${entry2.name} exceeds the uncompressed part size limit`,
1671
1677
  r.maxEntryBytes,
1672
- "maxEntryBytes"
1678
+ "maxEntryBytes",
1679
+ size
1673
1680
  );
1674
1681
  declared += size;
1675
1682
  }
@@ -1677,7 +1684,8 @@ function guardZip(zip, limits = {}) {
1677
1684
  throw r.fail(
1678
1685
  `${r.label} package exceeds the ${mib(r.maxTotalBytes)} MiB uncompressed content limit`,
1679
1686
  r.maxTotalBytes,
1680
- "maxTotalBytes"
1687
+ "maxTotalBytes",
1688
+ declared
1681
1689
  );
1682
1690
  const produced = /* @__PURE__ */ new Map();
1683
1691
  let total = 0;
@@ -1716,7 +1724,8 @@ async function openZip(input, limits = {}) {
1716
1724
  throw r.fail(
1717
1725
  `${r.label} package exceeds the ${mib(maxInput)} MiB compressed input limit`,
1718
1726
  maxInput,
1719
- "maxInputBytes"
1727
+ "maxInputBytes",
1728
+ bytes.byteLength
1720
1729
  );
1721
1730
  return guardZip(await JSZip.loadAsync(bytes), limits);
1722
1731
  }
@@ -2610,11 +2610,14 @@ var ZipLimitError = class extends Error {
2610
2610
  limit;
2611
2611
  /** The check that failed (absent when the error was built without one). */
2612
2612
  kind;
2613
+ /** The observed value, when known (a lower bound for a size found while inflating). */
2614
+ actual;
2613
2615
  constructor(message, details) {
2614
2616
  super(message);
2615
2617
  this.name = "ZipLimitError";
2616
2618
  this.limit = details.limit;
2617
2619
  this.kind = details.kind;
2620
+ this.actual = details.actual;
2618
2621
  }
2619
2622
  };
2620
2623
  var mib = (bytes) => Math.round(bytes / 1048576);
@@ -2637,7 +2640,7 @@ function resolveLimits(limits) {
2637
2640
  maxEntryBytes: limits.maxEntryBytes ?? DEFAULT_ZIP_LIMITS.maxEntryBytes,
2638
2641
  maxTotalBytes: limits.maxTotalBytes ?? DEFAULT_ZIP_LIMITS.maxTotalBytes,
2639
2642
  label: limits.label ?? "ZIP",
2640
- fail: (message, limit, kind) => create2 ? create2(message, { limit, kind }) : new ZipLimitError(message, { limit, kind })
2643
+ fail: (message, limit, kind, actual) => create2 ? create2(message, { limit, kind, actual }) : new ZipLimitError(message, { limit, kind, actual })
2641
2644
  };
2642
2645
  }
2643
2646
  async function inflateEntryGuarded(entry2, alreadyRead, limits) {
@@ -2692,7 +2695,8 @@ async function* streamEntryGuarded(entry2, alreadyRead, limits) {
2692
2695
  r.fail(
2693
2696
  `${r.label} part ${entry2.name} inflates past its declared size`,
2694
2697
  r.maxEntryBytes,
2695
- size > declared ? "declaredSize" : "maxEntryBytes"
2698
+ size > declared ? "declaredSize" : "maxEntryBytes",
2699
+ size
2696
2700
  )
2697
2701
  );
2698
2702
  if (alreadyRead + size > r.maxTotalBytes)
@@ -2700,7 +2704,8 @@ async function* streamEntryGuarded(entry2, alreadyRead, limits) {
2700
2704
  r.fail(
2701
2705
  `${r.label} package exceeds the ${mib(r.maxTotalBytes)} MiB uncompressed content limit`,
2702
2706
  r.maxTotalBytes,
2703
- "maxTotalBytes"
2707
+ "maxTotalBytes",
2708
+ alreadyRead + size
2704
2709
  )
2705
2710
  );
2706
2711
  queue.push(chunk);
@@ -2747,7 +2752,8 @@ function guardZip(zip, limits = {}) {
2747
2752
  throw r.fail(
2748
2753
  `${r.label} package exceeds the ${r.maxEntries.toLocaleString("en-US")} part limit`,
2749
2754
  r.maxEntries,
2750
- "maxEntries"
2755
+ "maxEntries",
2756
+ entries.length
2751
2757
  );
2752
2758
  let declared = 0;
2753
2759
  for (const entry2 of entries) {
@@ -2760,7 +2766,8 @@ function guardZip(zip, limits = {}) {
2760
2766
  throw r.fail(
2761
2767
  `${r.label} part ${entry2.name} exceeds the uncompressed part size limit`,
2762
2768
  r.maxEntryBytes,
2763
- "maxEntryBytes"
2769
+ "maxEntryBytes",
2770
+ size
2764
2771
  );
2765
2772
  declared += size;
2766
2773
  }
@@ -2768,7 +2775,8 @@ function guardZip(zip, limits = {}) {
2768
2775
  throw r.fail(
2769
2776
  `${r.label} package exceeds the ${mib(r.maxTotalBytes)} MiB uncompressed content limit`,
2770
2777
  r.maxTotalBytes,
2771
- "maxTotalBytes"
2778
+ "maxTotalBytes",
2779
+ declared
2772
2780
  );
2773
2781
  const produced = /* @__PURE__ */ new Map();
2774
2782
  let total = 0;
@@ -2807,7 +2815,8 @@ async function openZip(input, limits = {}) {
2807
2815
  throw r.fail(
2808
2816
  `${r.label} package exceeds the ${mib(maxInput)} MiB compressed input limit`,
2809
2817
  maxInput,
2810
- "maxInputBytes"
2818
+ "maxInputBytes",
2819
+ bytes.byteLength
2811
2820
  );
2812
2821
  return guardZip(await JSZip__default.default.loadAsync(bytes), limits);
2813
2822
  }
@@ -2604,11 +2604,14 @@ var ZipLimitError = class extends Error {
2604
2604
  limit;
2605
2605
  /** The check that failed (absent when the error was built without one). */
2606
2606
  kind;
2607
+ /** The observed value, when known (a lower bound for a size found while inflating). */
2608
+ actual;
2607
2609
  constructor(message, details) {
2608
2610
  super(message);
2609
2611
  this.name = "ZipLimitError";
2610
2612
  this.limit = details.limit;
2611
2613
  this.kind = details.kind;
2614
+ this.actual = details.actual;
2612
2615
  }
2613
2616
  };
2614
2617
  var mib = (bytes) => Math.round(bytes / 1048576);
@@ -2631,7 +2634,7 @@ function resolveLimits(limits) {
2631
2634
  maxEntryBytes: limits.maxEntryBytes ?? DEFAULT_ZIP_LIMITS.maxEntryBytes,
2632
2635
  maxTotalBytes: limits.maxTotalBytes ?? DEFAULT_ZIP_LIMITS.maxTotalBytes,
2633
2636
  label: limits.label ?? "ZIP",
2634
- fail: (message, limit, kind) => create2 ? create2(message, { limit, kind }) : new ZipLimitError(message, { limit, kind })
2637
+ fail: (message, limit, kind, actual) => create2 ? create2(message, { limit, kind, actual }) : new ZipLimitError(message, { limit, kind, actual })
2635
2638
  };
2636
2639
  }
2637
2640
  async function inflateEntryGuarded(entry2, alreadyRead, limits) {
@@ -2686,7 +2689,8 @@ async function* streamEntryGuarded(entry2, alreadyRead, limits) {
2686
2689
  r.fail(
2687
2690
  `${r.label} part ${entry2.name} inflates past its declared size`,
2688
2691
  r.maxEntryBytes,
2689
- size > declared ? "declaredSize" : "maxEntryBytes"
2692
+ size > declared ? "declaredSize" : "maxEntryBytes",
2693
+ size
2690
2694
  )
2691
2695
  );
2692
2696
  if (alreadyRead + size > r.maxTotalBytes)
@@ -2694,7 +2698,8 @@ async function* streamEntryGuarded(entry2, alreadyRead, limits) {
2694
2698
  r.fail(
2695
2699
  `${r.label} package exceeds the ${mib(r.maxTotalBytes)} MiB uncompressed content limit`,
2696
2700
  r.maxTotalBytes,
2697
- "maxTotalBytes"
2701
+ "maxTotalBytes",
2702
+ alreadyRead + size
2698
2703
  )
2699
2704
  );
2700
2705
  queue.push(chunk);
@@ -2741,7 +2746,8 @@ function guardZip(zip, limits = {}) {
2741
2746
  throw r.fail(
2742
2747
  `${r.label} package exceeds the ${r.maxEntries.toLocaleString("en-US")} part limit`,
2743
2748
  r.maxEntries,
2744
- "maxEntries"
2749
+ "maxEntries",
2750
+ entries.length
2745
2751
  );
2746
2752
  let declared = 0;
2747
2753
  for (const entry2 of entries) {
@@ -2754,7 +2760,8 @@ function guardZip(zip, limits = {}) {
2754
2760
  throw r.fail(
2755
2761
  `${r.label} part ${entry2.name} exceeds the uncompressed part size limit`,
2756
2762
  r.maxEntryBytes,
2757
- "maxEntryBytes"
2763
+ "maxEntryBytes",
2764
+ size
2758
2765
  );
2759
2766
  declared += size;
2760
2767
  }
@@ -2762,7 +2769,8 @@ function guardZip(zip, limits = {}) {
2762
2769
  throw r.fail(
2763
2770
  `${r.label} package exceeds the ${mib(r.maxTotalBytes)} MiB uncompressed content limit`,
2764
2771
  r.maxTotalBytes,
2765
- "maxTotalBytes"
2772
+ "maxTotalBytes",
2773
+ declared
2766
2774
  );
2767
2775
  const produced = /* @__PURE__ */ new Map();
2768
2776
  let total = 0;
@@ -2801,7 +2809,8 @@ async function openZip(input, limits = {}) {
2801
2809
  throw r.fail(
2802
2810
  `${r.label} package exceeds the ${mib(maxInput)} MiB compressed input limit`,
2803
2811
  maxInput,
2804
- "maxInputBytes"
2812
+ "maxInputBytes",
2813
+ bytes.byteLength
2805
2814
  );
2806
2815
  return guardZip(await JSZip.loadAsync(bytes), limits);
2807
2816
  }
@@ -3671,11 +3671,14 @@ var ZipLimitError = class extends Error {
3671
3671
  limit;
3672
3672
  /** The check that failed (absent when the error was built without one). */
3673
3673
  kind;
3674
+ /** The observed value, when known (a lower bound for a size found while inflating). */
3675
+ actual;
3674
3676
  constructor(message, details) {
3675
3677
  super(message);
3676
3678
  this.name = "ZipLimitError";
3677
3679
  this.limit = details.limit;
3678
3680
  this.kind = details.kind;
3681
+ this.actual = details.actual;
3679
3682
  }
3680
3683
  };
3681
3684
  var mib = (bytes) => Math.round(bytes / 1048576);
@@ -3698,7 +3701,7 @@ function resolveLimits(limits) {
3698
3701
  maxEntryBytes: limits.maxEntryBytes ?? DEFAULT_ZIP_LIMITS.maxEntryBytes,
3699
3702
  maxTotalBytes: limits.maxTotalBytes ?? DEFAULT_ZIP_LIMITS.maxTotalBytes,
3700
3703
  label: limits.label ?? "ZIP",
3701
- fail: (message, limit, kind) => create2 ? create2(message, { limit, kind }) : new ZipLimitError(message, { limit, kind })
3704
+ fail: (message, limit, kind, actual) => create2 ? create2(message, { limit, kind, actual }) : new ZipLimitError(message, { limit, kind, actual })
3702
3705
  };
3703
3706
  }
3704
3707
  async function inflateEntryGuarded(entry2, alreadyRead, limits) {
@@ -3753,7 +3756,8 @@ async function* streamEntryGuarded(entry2, alreadyRead, limits) {
3753
3756
  r.fail(
3754
3757
  `${r.label} part ${entry2.name} inflates past its declared size`,
3755
3758
  r.maxEntryBytes,
3756
- size > declared ? "declaredSize" : "maxEntryBytes"
3759
+ size > declared ? "declaredSize" : "maxEntryBytes",
3760
+ size
3757
3761
  )
3758
3762
  );
3759
3763
  if (alreadyRead + size > r.maxTotalBytes)
@@ -3761,7 +3765,8 @@ async function* streamEntryGuarded(entry2, alreadyRead, limits) {
3761
3765
  r.fail(
3762
3766
  `${r.label} package exceeds the ${mib(r.maxTotalBytes)} MiB uncompressed content limit`,
3763
3767
  r.maxTotalBytes,
3764
- "maxTotalBytes"
3768
+ "maxTotalBytes",
3769
+ alreadyRead + size
3765
3770
  )
3766
3771
  );
3767
3772
  queue.push(chunk);
@@ -3808,7 +3813,8 @@ function guardZip(zip, limits = {}) {
3808
3813
  throw r.fail(
3809
3814
  `${r.label} package exceeds the ${r.maxEntries.toLocaleString("en-US")} part limit`,
3810
3815
  r.maxEntries,
3811
- "maxEntries"
3816
+ "maxEntries",
3817
+ entries.length
3812
3818
  );
3813
3819
  let declared = 0;
3814
3820
  for (const entry2 of entries) {
@@ -3821,7 +3827,8 @@ function guardZip(zip, limits = {}) {
3821
3827
  throw r.fail(
3822
3828
  `${r.label} part ${entry2.name} exceeds the uncompressed part size limit`,
3823
3829
  r.maxEntryBytes,
3824
- "maxEntryBytes"
3830
+ "maxEntryBytes",
3831
+ size
3825
3832
  );
3826
3833
  declared += size;
3827
3834
  }
@@ -3829,7 +3836,8 @@ function guardZip(zip, limits = {}) {
3829
3836
  throw r.fail(
3830
3837
  `${r.label} package exceeds the ${mib(r.maxTotalBytes)} MiB uncompressed content limit`,
3831
3838
  r.maxTotalBytes,
3832
- "maxTotalBytes"
3839
+ "maxTotalBytes",
3840
+ declared
3833
3841
  );
3834
3842
  const produced = /* @__PURE__ */ new Map();
3835
3843
  let total = 0;
@@ -3868,7 +3876,8 @@ async function openZip(input, limits = {}) {
3868
3876
  throw r.fail(
3869
3877
  `${r.label} package exceeds the ${mib(maxInput)} MiB compressed input limit`,
3870
3878
  maxInput,
3871
- "maxInputBytes"
3879
+ "maxInputBytes",
3880
+ bytes.byteLength
3872
3881
  );
3873
3882
  return guardZip(await JSZip__default.default.loadAsync(bytes), limits);
3874
3883
  }
@@ -3665,11 +3665,14 @@ var ZipLimitError = class extends Error {
3665
3665
  limit;
3666
3666
  /** The check that failed (absent when the error was built without one). */
3667
3667
  kind;
3668
+ /** The observed value, when known (a lower bound for a size found while inflating). */
3669
+ actual;
3668
3670
  constructor(message, details) {
3669
3671
  super(message);
3670
3672
  this.name = "ZipLimitError";
3671
3673
  this.limit = details.limit;
3672
3674
  this.kind = details.kind;
3675
+ this.actual = details.actual;
3673
3676
  }
3674
3677
  };
3675
3678
  var mib = (bytes) => Math.round(bytes / 1048576);
@@ -3692,7 +3695,7 @@ function resolveLimits(limits) {
3692
3695
  maxEntryBytes: limits.maxEntryBytes ?? DEFAULT_ZIP_LIMITS.maxEntryBytes,
3693
3696
  maxTotalBytes: limits.maxTotalBytes ?? DEFAULT_ZIP_LIMITS.maxTotalBytes,
3694
3697
  label: limits.label ?? "ZIP",
3695
- fail: (message, limit, kind) => create2 ? create2(message, { limit, kind }) : new ZipLimitError(message, { limit, kind })
3698
+ fail: (message, limit, kind, actual) => create2 ? create2(message, { limit, kind, actual }) : new ZipLimitError(message, { limit, kind, actual })
3696
3699
  };
3697
3700
  }
3698
3701
  async function inflateEntryGuarded(entry2, alreadyRead, limits) {
@@ -3747,7 +3750,8 @@ async function* streamEntryGuarded(entry2, alreadyRead, limits) {
3747
3750
  r.fail(
3748
3751
  `${r.label} part ${entry2.name} inflates past its declared size`,
3749
3752
  r.maxEntryBytes,
3750
- size > declared ? "declaredSize" : "maxEntryBytes"
3753
+ size > declared ? "declaredSize" : "maxEntryBytes",
3754
+ size
3751
3755
  )
3752
3756
  );
3753
3757
  if (alreadyRead + size > r.maxTotalBytes)
@@ -3755,7 +3759,8 @@ async function* streamEntryGuarded(entry2, alreadyRead, limits) {
3755
3759
  r.fail(
3756
3760
  `${r.label} package exceeds the ${mib(r.maxTotalBytes)} MiB uncompressed content limit`,
3757
3761
  r.maxTotalBytes,
3758
- "maxTotalBytes"
3762
+ "maxTotalBytes",
3763
+ alreadyRead + size
3759
3764
  )
3760
3765
  );
3761
3766
  queue.push(chunk);
@@ -3802,7 +3807,8 @@ function guardZip(zip, limits = {}) {
3802
3807
  throw r.fail(
3803
3808
  `${r.label} package exceeds the ${r.maxEntries.toLocaleString("en-US")} part limit`,
3804
3809
  r.maxEntries,
3805
- "maxEntries"
3810
+ "maxEntries",
3811
+ entries.length
3806
3812
  );
3807
3813
  let declared = 0;
3808
3814
  for (const entry2 of entries) {
@@ -3815,7 +3821,8 @@ function guardZip(zip, limits = {}) {
3815
3821
  throw r.fail(
3816
3822
  `${r.label} part ${entry2.name} exceeds the uncompressed part size limit`,
3817
3823
  r.maxEntryBytes,
3818
- "maxEntryBytes"
3824
+ "maxEntryBytes",
3825
+ size
3819
3826
  );
3820
3827
  declared += size;
3821
3828
  }
@@ -3823,7 +3830,8 @@ function guardZip(zip, limits = {}) {
3823
3830
  throw r.fail(
3824
3831
  `${r.label} package exceeds the ${mib(r.maxTotalBytes)} MiB uncompressed content limit`,
3825
3832
  r.maxTotalBytes,
3826
- "maxTotalBytes"
3833
+ "maxTotalBytes",
3834
+ declared
3827
3835
  );
3828
3836
  const produced = /* @__PURE__ */ new Map();
3829
3837
  let total = 0;
@@ -3862,7 +3870,8 @@ async function openZip(input, limits = {}) {
3862
3870
  throw r.fail(
3863
3871
  `${r.label} package exceeds the ${mib(maxInput)} MiB compressed input limit`,
3864
3872
  maxInput,
3865
- "maxInputBytes"
3873
+ "maxInputBytes",
3874
+ bytes.byteLength
3866
3875
  );
3867
3876
  return guardZip(await JSZip.loadAsync(bytes), limits);
3868
3877
  }
package/dist/index.cjs CHANGED
@@ -12395,11 +12395,14 @@ var ZipLimitError = class extends Error {
12395
12395
  limit;
12396
12396
  /** The check that failed (absent when the error was built without one). */
12397
12397
  kind;
12398
+ /** The observed value, when known (a lower bound for a size found while inflating). */
12399
+ actual;
12398
12400
  constructor(message, details) {
12399
12401
  super(message);
12400
12402
  this.name = "ZipLimitError";
12401
12403
  this.limit = details.limit;
12402
12404
  this.kind = details.kind;
12405
+ this.actual = details.actual;
12403
12406
  }
12404
12407
  };
12405
12408
  var mib = (bytes) => Math.round(bytes / 1048576);
@@ -12422,7 +12425,7 @@ function resolveLimits(limits) {
12422
12425
  maxEntryBytes: limits.maxEntryBytes ?? DEFAULT_ZIP_LIMITS.maxEntryBytes,
12423
12426
  maxTotalBytes: limits.maxTotalBytes ?? DEFAULT_ZIP_LIMITS.maxTotalBytes,
12424
12427
  label: limits.label ?? "ZIP",
12425
- fail: (message, limit, kind) => create2 ? create2(message, { limit, kind }) : new ZipLimitError(message, { limit, kind })
12428
+ fail: (message, limit, kind, actual) => create2 ? create2(message, { limit, kind, actual }) : new ZipLimitError(message, { limit, kind, actual })
12426
12429
  };
12427
12430
  }
12428
12431
  async function inflateEntryGuarded(entry3, alreadyRead, limits) {
@@ -12477,7 +12480,8 @@ async function* streamEntryGuarded(entry3, alreadyRead, limits) {
12477
12480
  r.fail(
12478
12481
  `${r.label} part ${entry3.name} inflates past its declared size`,
12479
12482
  r.maxEntryBytes,
12480
- size > declared ? "declaredSize" : "maxEntryBytes"
12483
+ size > declared ? "declaredSize" : "maxEntryBytes",
12484
+ size
12481
12485
  )
12482
12486
  );
12483
12487
  if (alreadyRead + size > r.maxTotalBytes)
@@ -12485,7 +12489,8 @@ async function* streamEntryGuarded(entry3, alreadyRead, limits) {
12485
12489
  r.fail(
12486
12490
  `${r.label} package exceeds the ${mib(r.maxTotalBytes)} MiB uncompressed content limit`,
12487
12491
  r.maxTotalBytes,
12488
- "maxTotalBytes"
12492
+ "maxTotalBytes",
12493
+ alreadyRead + size
12489
12494
  )
12490
12495
  );
12491
12496
  queue.push(chunk);
@@ -12532,7 +12537,8 @@ function guardZip(zip, limits = {}) {
12532
12537
  throw r.fail(
12533
12538
  `${r.label} package exceeds the ${r.maxEntries.toLocaleString("en-US")} part limit`,
12534
12539
  r.maxEntries,
12535
- "maxEntries"
12540
+ "maxEntries",
12541
+ entries.length
12536
12542
  );
12537
12543
  let declared = 0;
12538
12544
  for (const entry3 of entries) {
@@ -12545,7 +12551,8 @@ function guardZip(zip, limits = {}) {
12545
12551
  throw r.fail(
12546
12552
  `${r.label} part ${entry3.name} exceeds the uncompressed part size limit`,
12547
12553
  r.maxEntryBytes,
12548
- "maxEntryBytes"
12554
+ "maxEntryBytes",
12555
+ size
12549
12556
  );
12550
12557
  declared += size;
12551
12558
  }
@@ -12553,7 +12560,8 @@ function guardZip(zip, limits = {}) {
12553
12560
  throw r.fail(
12554
12561
  `${r.label} package exceeds the ${mib(r.maxTotalBytes)} MiB uncompressed content limit`,
12555
12562
  r.maxTotalBytes,
12556
- "maxTotalBytes"
12563
+ "maxTotalBytes",
12564
+ declared
12557
12565
  );
12558
12566
  const produced = /* @__PURE__ */ new Map();
12559
12567
  let total = 0;
@@ -12592,7 +12600,8 @@ async function openZip(input, limits = {}) {
12592
12600
  throw r.fail(
12593
12601
  `${r.label} package exceeds the ${mib(maxInput)} MiB compressed input limit`,
12594
12602
  maxInput,
12595
- "maxInputBytes"
12603
+ "maxInputBytes",
12604
+ bytes.byteLength
12596
12605
  );
12597
12606
  return guardZip(await JSZip__default.default.loadAsync(bytes), limits);
12598
12607
  }
package/dist/index.mjs CHANGED
@@ -12389,11 +12389,14 @@ var ZipLimitError = class extends Error {
12389
12389
  limit;
12390
12390
  /** The check that failed (absent when the error was built without one). */
12391
12391
  kind;
12392
+ /** The observed value, when known (a lower bound for a size found while inflating). */
12393
+ actual;
12392
12394
  constructor(message, details) {
12393
12395
  super(message);
12394
12396
  this.name = "ZipLimitError";
12395
12397
  this.limit = details.limit;
12396
12398
  this.kind = details.kind;
12399
+ this.actual = details.actual;
12397
12400
  }
12398
12401
  };
12399
12402
  var mib = (bytes) => Math.round(bytes / 1048576);
@@ -12416,7 +12419,7 @@ function resolveLimits(limits) {
12416
12419
  maxEntryBytes: limits.maxEntryBytes ?? DEFAULT_ZIP_LIMITS.maxEntryBytes,
12417
12420
  maxTotalBytes: limits.maxTotalBytes ?? DEFAULT_ZIP_LIMITS.maxTotalBytes,
12418
12421
  label: limits.label ?? "ZIP",
12419
- fail: (message, limit, kind) => create2 ? create2(message, { limit, kind }) : new ZipLimitError(message, { limit, kind })
12422
+ fail: (message, limit, kind, actual) => create2 ? create2(message, { limit, kind, actual }) : new ZipLimitError(message, { limit, kind, actual })
12420
12423
  };
12421
12424
  }
12422
12425
  async function inflateEntryGuarded(entry3, alreadyRead, limits) {
@@ -12471,7 +12474,8 @@ async function* streamEntryGuarded(entry3, alreadyRead, limits) {
12471
12474
  r.fail(
12472
12475
  `${r.label} part ${entry3.name} inflates past its declared size`,
12473
12476
  r.maxEntryBytes,
12474
- size > declared ? "declaredSize" : "maxEntryBytes"
12477
+ size > declared ? "declaredSize" : "maxEntryBytes",
12478
+ size
12475
12479
  )
12476
12480
  );
12477
12481
  if (alreadyRead + size > r.maxTotalBytes)
@@ -12479,7 +12483,8 @@ async function* streamEntryGuarded(entry3, alreadyRead, limits) {
12479
12483
  r.fail(
12480
12484
  `${r.label} package exceeds the ${mib(r.maxTotalBytes)} MiB uncompressed content limit`,
12481
12485
  r.maxTotalBytes,
12482
- "maxTotalBytes"
12486
+ "maxTotalBytes",
12487
+ alreadyRead + size
12483
12488
  )
12484
12489
  );
12485
12490
  queue.push(chunk);
@@ -12526,7 +12531,8 @@ function guardZip(zip, limits = {}) {
12526
12531
  throw r.fail(
12527
12532
  `${r.label} package exceeds the ${r.maxEntries.toLocaleString("en-US")} part limit`,
12528
12533
  r.maxEntries,
12529
- "maxEntries"
12534
+ "maxEntries",
12535
+ entries.length
12530
12536
  );
12531
12537
  let declared = 0;
12532
12538
  for (const entry3 of entries) {
@@ -12539,7 +12545,8 @@ function guardZip(zip, limits = {}) {
12539
12545
  throw r.fail(
12540
12546
  `${r.label} part ${entry3.name} exceeds the uncompressed part size limit`,
12541
12547
  r.maxEntryBytes,
12542
- "maxEntryBytes"
12548
+ "maxEntryBytes",
12549
+ size
12543
12550
  );
12544
12551
  declared += size;
12545
12552
  }
@@ -12547,7 +12554,8 @@ function guardZip(zip, limits = {}) {
12547
12554
  throw r.fail(
12548
12555
  `${r.label} package exceeds the ${mib(r.maxTotalBytes)} MiB uncompressed content limit`,
12549
12556
  r.maxTotalBytes,
12550
- "maxTotalBytes"
12557
+ "maxTotalBytes",
12558
+ declared
12551
12559
  );
12552
12560
  const produced = /* @__PURE__ */ new Map();
12553
12561
  let total = 0;
@@ -12586,7 +12594,8 @@ async function openZip(input, limits = {}) {
12586
12594
  throw r.fail(
12587
12595
  `${r.label} package exceeds the ${mib(maxInput)} MiB compressed input limit`,
12588
12596
  maxInput,
12589
- "maxInputBytes"
12597
+ "maxInputBytes",
12598
+ bytes.byteLength
12590
12599
  );
12591
12600
  return guardZip(await JSZip.loadAsync(bytes), limits);
12592
12601
  }