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
@@ -1,5 +1,5 @@
1
- import { NS, SMART_ART_DEFINITION_PARTS, VML_SHAPE_TAGS, isAlternateContentChoiceXmlSupported, parseVmlElement, unwrapAlternateContent, xmlChild, xmlAttr, parseDrawingMediaReference, cropShapeForPresetGeometry, isHeaderFooterPlaceholder, xmlPath, inheritedPlaceholderFieldType, parseParagraphLevel, xmlHasChild, parseParagraphExtraAttributes, parseParagraphMargins, parseAlignmentAttr, parseParagraphRtl, parseTabStops, resolveParagraphAlignment, xmlText, parseBodyPrBooleanAttrs, selectAlternateContentBranch, parseBulletSizePercent, extractColorChoiceXml, formatAutoNumberMarker, parseParagraphSpacingPx, createBuiltinVariables, resolveCoordinate, readPathListCommandOrder, parseStructuredCustomGeometry, parseAdjustmentValues, parseGuideDefinitions, evaluateGuides, evaluateGeometryPaths, inheritCustomGeometryCommandOrder, parseInkMlContent, parseModel3DScene, remapElementShapeIds, parseShapeId, isTemplateElementId, remapShapeIdReferences, reapplyAlternateContentToTree, buildOle2, SHAPE_TREE_ELEMENT_TAGS, MAX_SHAPE_ID, orderedXmlKey, safeResolveZipPath, parseXml, elements, parseDataUrlToBytes, base64Decode, EMU_PER_PX, reorderObjectKeys, encodeCompressedPng, zlibStore, hash, concatArrays, encodePasswordUtf16LE, COLOR_MAP_ALIAS_KEYS, DEFAULT_COLOR_MAP, uint32LE, pptxActionToElementAction, buildClrMapOverrideXml, applyActiveXControlsToSlide, BLIP_FILL_ORDER, SP_PR_ORDER, hasShapeProperties, ensureXmlChild, hasTextProperties, inkElementToStrokes, buildInkMlContent, ensureXmlChildOrCreate, isXmlNode, applyChartLayouts, stripXmlOrderSuffix, serializeTabStop, readCommentMentions, rebaseCommentMentions, applyCommentMentions, colorsEqual, generateFontGuid, applyBubbleChartOptions, applyChartUpDownBars, applyDataLabelsRangeToDLbls, applyChartAxisScaling, applyChartAxisLabelFormatting, upsertChartAxisChild, applyChartDateAxisUnits, applyChartAxisDisplayUnitsToXml, writeChartShapeProps, resolveTxPrDefRPr, buildDefRPrTextProperties, buildChartGradFillXml, applySeriesMarkerToXml, applySeriesDataPointsToXml, chartColorHex, applyChartManualLayout, chartTrendlineType, buildTrendlineLabel, serializeColorChoice, replaceOleEmbedding, findKey, collectAllText, buildNodeGuidMap, buildPresentationGuidMap, regenerateSmartArtDrawingShapes, buildFabricatedDrawingXml, buildFabricatedDiagramDataXml, DIAGRAM_DRAWING_CONTENT_TYPE, DIAGRAM_DRAWING_REL_TYPE, applyDiagramRelationshipIds, buildSaveTimeCustomGeometryXml, applyCustomGeometryGuideOverrides, avLstForPreset, filterValidShapeAdjustmentEntries, applyDrawingMediaReference, DIAGRAM_XML_PROLOG, DIAGRAM_DATA_XMLNS, escapeDiagramXml, writeBodyPrBooleanAttrs, applyTextBodySp3d, writeShapeEffects, SHAPE_STYLE_ORDER, roundCoordinate, scaleVectorToIntegers, EMU_PER_PIXEL, P14_GUIDE_URI, P15_GUIDE_URI, buildGuideListExtension, resetSpPrFormattingForStyleMatrix, fillIsPurelyStyleMatrix, serializeColorChoiceWithRef, createLineStyleGate, applyDrawingLineDash, getSignaturePathsToStrip, mergeSmartArtPointXml, mergeSmartArtConnectionXml, obfuscateFont, containsConvertibleStrictNamespaceAttribute, convertXmlToStrict, applySeriesPictureOptionsToXml, findChartExtByUri, findChildByLocalName, regenerateClonedUniqueId, buildChartUniqueIdExtLst, createOfficeGuid, isContentPoint, newSmartArtGuid, parseChartUserShapesDrawing, xmlChildren, applyChartGradientToSpPr, setAutoTitleDeleted, insertAt, replaceFirstText, shouldRebuildFromParagraphs, buildPointFromParagraphs, shouldRebuildFromRuns, buildPointFromRuns, buildPointText, ensureXmlChildren, TC_PR_BORDERS_ORDER, relAttr, buildXml, writeChartColorChoice, first, stripParentDirSegments, children, parseChartUniqueId, buildChartMarkerXml, chartGradientsEqual, chartColorChoiceValue, parseChartFormulaRange, expandRangeAddresses, applyCellWritesToWorksheet, attr, childrenNamed, childNamed, parseCellAddress, readChartManualLayoutValues, worksheetData, formatCellAddress, buildEffectDagTreeFromXml, syncPictureShapeTypeWithCropShape, buildSrgbColorChoice, fetchUrlToBytes, parseChartWideTextStyle, hasLocalName, parseDefRPrTextStyle, parseChartDataLabelOptions, shadowOffsetToDistanceAndDirection, positiveFixedAngleAttribute, xmlAttrNumber, parseCustomShows, parseShapeProps, parseActiveXControlsFromSlide, convertMetafileToDataUrl, blobUrlToDataUrl, ooxmlGradientAngleToCssDegrees, isAlternateContentChoiceSupported, SvgExporter, detectStrictConformance, normalizeStrictXml, normalizeStShapeType, applyCustomShows, applySections, reorderObjectKeysByLocalName, PRESENTATION_CHILD_ORDER, applyKinsokuToXml, normalizeNamespaceUri, backgroundStyleRefIsCurrent, backgroundRefNode, captureStyleBaseline, STYLE_MATRIX_FILL_KEYS, STYLE_MATRIX_LINE_KEYS, STYLE_MATRIX_EFFECT_KEYS, detectOleObjectType, inferOleExtensionFromTarget, deriveSlideTitles, parseSlideDrawingGuides, slideBackgroundStyleRefFromNode, parseP14DirectChild, parseP14FromExtLst, P14_TRANSITION_TYPES, decodeXmlEntities, preservesXmlWhitespace, annotateCustomGeometryCommandOrder, annotateSmartArtTextOrder, encodeXmlAttributeValue, encodeXmlTextValue, stripXmlOrderMarkers, CHART_ERROR_VALUE_TYPES, CHART_ERROR_BAR_TYPES, CHART_ERROR_BAR_DIRECTIONS, MIN_ELEMENT_SIZE, createDrawingObjectId, DEFAULT_TEXT_FONT_SIZE, EncryptedFileError, decodePptxJsonText, deserializePptxFromJson, applyImportedPptxData, DEFAULT_CHART_GRADIENT_ANGLE, supportsChartGradientFill, svgToCustomGeometryPaths, escAttr, MIN_TABLE_DIMENSION, MAX_TABLE_DIMENSION, SYSTEM_COLOR_MAP, PRESET_COLOR_MAP, effectChild, mergeEffectNode, mergeAttributeEffectNode, estimateMediaDurationMs, parseVmlElements, prismFamilyFlags, prismFamilyTypeOfNode, prismFamilyTypeForFlags, P14_DIR_IS_ORIENTATION_TYPE, IncorrectPasswordError, applyThemeToData, detectFileFormat, parseOle2, decryptPptx, encryptPptx, escText, parseDrawingLineDash, parseLineSpacingMultiplier, parseLineSpacingExactPt, parseEncryptionInfo, RC4_ALG_ID, isOle2CompoundFile, ENTRY_TYPE_ROOT, PML_XMLNS, solidFill, esc, OOXML_PERCENT_UNITS, backgroundStylePreset, isDarkColorMap, backgroundStyleColorMap, reResolveElementsForColorMapChange, findThemeEffectScheme, wrapFormatSchemeXml, effectIsPurelyStyleMatrix, emu, formatSchemeKey, gradFill, loadThemeVariants, parsePresentationDrawingGuides, parsePresentationSmartTags, resolveLayoutDisplayName, detectDigitalSignatures, unwrapOleEmbedding, mimeTypeForOleFile, oleBytesToDataUrl, extractGuidFromPartName, deobfuscateFont, detectFontFormat, parseKinsoku, parseLineStyle, parseChartUpDownBars, parseDataTable, parseChart3DSurfaces, parseChartAxes, parseBubbleChartOptions, parseChartLayouts, parseCxChartSeries, parseChartDataPointPictureBlipRel, parseSeriesDataPoints, parseMarker, parseSeriesDataLabels, parseChartDataPointPicture, parseImplicitBlipPictureFill, parseEmbeddedXlsx, EMU_PER_POINT, chartTrendlineKind, parseChartManualLayout, parseDiagramRelationshipIds, parseSmartArtTextParagraphs, firstParagraphRuns, smartArtParagraphsText, parseSmartArtPresLayoutVars, parseSmartArtConnection, projectSmartArtNodeText, resolveSmartArtNodeStyleRoles, resolveSmartArtNodeCoherent3DOff, parseSmartArtDefinitionMetadata, parseSmartArtColorStyleLabels, buildSmartArtColorLists, buildSmartArtColorRoleMap, parseSmartArtQuickStyleLabels, resolveSmartArtEffectIntensity, parseSmartArtStyleLabelRefs, extractStyleReferenceColorXml, withThemePlaceholderColor, getElementOrientationMatrix, isTextOrientationMatrix, TEXT_ORIENTATION_IDENTITY, multiplyTextOrientationMatrices } from './chunk-G67MARDL.mjs';
2
- import { openPptxZip, DIGITAL_SIGNATURE_ORIGIN_REL_TYPE, openZip, DEFAULT_MAX_UNCOMPRESSED_BYTES, guardZip, ZipBombError, MAX_ZIP_ENTRY_COUNT } from './chunk-JJ37PCNR.mjs';
1
+ import { NS, SMART_ART_DEFINITION_PARTS, VML_SHAPE_TAGS, isAlternateContentChoiceXmlSupported, parseVmlElement, unwrapAlternateContent, xmlChild, xmlAttr, parseDrawingMediaReference, cropShapeForPresetGeometry, isHeaderFooterPlaceholder, xmlPath, inheritedPlaceholderFieldType, parseParagraphLevel, xmlHasChild, parseParagraphExtraAttributes, parseParagraphMargins, parseAlignmentAttr, parseParagraphRtl, parseTabStops, resolveParagraphAlignment, xmlText, parseBodyPrBooleanAttrs, selectAlternateContentBranch, parseBulletSizePercent, extractColorChoiceXml, formatAutoNumberMarker, parseParagraphSpacingPx, createBuiltinVariables, resolveCoordinate, readPathListCommandOrder, parseStructuredCustomGeometry, parseAdjustmentValues, parseGuideDefinitions, evaluateGuides, evaluateGeometryPaths, inheritCustomGeometryCommandOrder, parseInkMlContent, parseModel3DScene, remapElementShapeIds, parseShapeId, isTemplateElementId, remapShapeIdReferences, reapplyAlternateContentToTree, buildOle2, SHAPE_TREE_ELEMENT_TAGS, MAX_SHAPE_ID, orderedXmlKey, safeResolveZipPath, parseXml, elements, parseDataUrlToBytes, base64Decode, EMU_PER_PX, reorderObjectKeys, encodeCompressedPng, zlibStore, hash, concatArrays, encodePasswordUtf16LE, COLOR_MAP_ALIAS_KEYS, DEFAULT_COLOR_MAP, uint32LE, pptxActionToElementAction, buildClrMapOverrideXml, applyActiveXControlsToSlide, BLIP_FILL_ORDER, SP_PR_ORDER, hasShapeProperties, ensureXmlChild, hasTextProperties, inkElementToStrokes, buildInkMlContent, ensureXmlChildOrCreate, isXmlNode, applyChartLayouts, stripXmlOrderSuffix, serializeTabStop, readCommentMentions, rebaseCommentMentions, applyCommentMentions, colorsEqual, generateFontGuid, applyBubbleChartOptions, applyChartUpDownBars, applyDataLabelsRangeToDLbls, applyChartAxisScaling, applyChartAxisLabelFormatting, upsertChartAxisChild, applyChartDateAxisUnits, applyChartAxisDisplayUnitsToXml, writeChartShapeProps, resolveTxPrDefRPr, buildDefRPrTextProperties, buildChartGradFillXml, applySeriesMarkerToXml, applySeriesDataPointsToXml, chartColorHex, applyChartManualLayout, chartTrendlineType, buildTrendlineLabel, serializeColorChoice, replaceOleEmbedding, findKey, collectAllText, buildNodeGuidMap, buildPresentationGuidMap, regenerateSmartArtDrawingShapes, buildFabricatedDrawingXml, buildFabricatedDiagramDataXml, DIAGRAM_DRAWING_CONTENT_TYPE, DIAGRAM_DRAWING_REL_TYPE, applyDiagramRelationshipIds, buildSaveTimeCustomGeometryXml, applyCustomGeometryGuideOverrides, avLstForPreset, filterValidShapeAdjustmentEntries, applyDrawingMediaReference, DIAGRAM_XML_PROLOG, DIAGRAM_DATA_XMLNS, escapeDiagramXml, writeBodyPrBooleanAttrs, applyTextBodySp3d, writeShapeEffects, SHAPE_STYLE_ORDER, roundCoordinate, scaleVectorToIntegers, EMU_PER_PIXEL, P14_GUIDE_URI, P15_GUIDE_URI, buildGuideListExtension, resetSpPrFormattingForStyleMatrix, fillIsPurelyStyleMatrix, serializeColorChoiceWithRef, createLineStyleGate, applyDrawingLineDash, getSignaturePathsToStrip, mergeSmartArtPointXml, mergeSmartArtConnectionXml, obfuscateFont, containsConvertibleStrictNamespaceAttribute, convertXmlToStrict, applySeriesPictureOptionsToXml, findChartExtByUri, findChildByLocalName, regenerateClonedUniqueId, buildChartUniqueIdExtLst, createOfficeGuid, isContentPoint, newSmartArtGuid, parseChartUserShapesDrawing, xmlChildren, applyChartGradientToSpPr, setAutoTitleDeleted, insertAt, replaceFirstText, shouldRebuildFromParagraphs, buildPointFromParagraphs, shouldRebuildFromRuns, buildPointFromRuns, buildPointText, ensureXmlChildren, TC_PR_BORDERS_ORDER, relAttr, buildXml, writeChartColorChoice, first, stripParentDirSegments, children, parseChartUniqueId, buildChartMarkerXml, chartGradientsEqual, chartColorChoiceValue, parseChartFormulaRange, expandRangeAddresses, applyCellWritesToWorksheet, attr, childrenNamed, childNamed, parseCellAddress, readChartManualLayoutValues, worksheetData, formatCellAddress, buildEffectDagTreeFromXml, syncPictureShapeTypeWithCropShape, buildSrgbColorChoice, fetchUrlToBytes, parseChartWideTextStyle, hasLocalName, parseDefRPrTextStyle, parseChartDataLabelOptions, shadowOffsetToDistanceAndDirection, positiveFixedAngleAttribute, xmlAttrNumber, parseCustomShows, parseShapeProps, parseActiveXControlsFromSlide, convertMetafileToDataUrl, blobUrlToDataUrl, ooxmlGradientAngleToCssDegrees, isAlternateContentChoiceSupported, SvgExporter, detectStrictConformance, normalizeStrictXml, normalizeStShapeType, applyCustomShows, applySections, reorderObjectKeysByLocalName, PRESENTATION_CHILD_ORDER, applyKinsokuToXml, normalizeNamespaceUri, backgroundStyleRefIsCurrent, backgroundRefNode, captureStyleBaseline, STYLE_MATRIX_FILL_KEYS, STYLE_MATRIX_LINE_KEYS, STYLE_MATRIX_EFFECT_KEYS, detectOleObjectType, inferOleExtensionFromTarget, deriveSlideTitles, parseSlideDrawingGuides, slideBackgroundStyleRefFromNode, parseP14DirectChild, parseP14FromExtLst, P14_TRANSITION_TYPES, decodeXmlEntities, preservesXmlWhitespace, annotateCustomGeometryCommandOrder, annotateSmartArtTextOrder, encodeXmlAttributeValue, encodeXmlTextValue, stripXmlOrderMarkers, CHART_ERROR_VALUE_TYPES, CHART_ERROR_BAR_TYPES, CHART_ERROR_BAR_DIRECTIONS, MIN_ELEMENT_SIZE, createDrawingObjectId, DEFAULT_TEXT_FONT_SIZE, EncryptedFileError, decodePptxJsonText, parsePptxJson, pptxDataFromJsonDocument, applyImportedPptxData, DEFAULT_CHART_GRADIENT_ANGLE, supportsChartGradientFill, svgToCustomGeometryPaths, escAttr, MIN_TABLE_DIMENSION, MAX_TABLE_DIMENSION, SYSTEM_COLOR_MAP, PRESET_COLOR_MAP, effectChild, mergeEffectNode, mergeAttributeEffectNode, estimateMediaDurationMs, parseVmlElements, prismFamilyFlags, prismFamilyTypeOfNode, prismFamilyTypeForFlags, P14_DIR_IS_ORIENTATION_TYPE, IncorrectPasswordError, applyThemeToData, detectFileFormat, parseOle2, decryptPptx, encryptPptx, escText, parseDrawingLineDash, parseLineSpacingMultiplier, parseLineSpacingExactPt, parseEncryptionInfo, RC4_ALG_ID, isOle2CompoundFile, ENTRY_TYPE_ROOT, PML_XMLNS, solidFill, esc, OOXML_PERCENT_UNITS, backgroundStylePreset, isDarkColorMap, backgroundStyleColorMap, reResolveElementsForColorMapChange, findThemeEffectScheme, wrapFormatSchemeXml, effectIsPurelyStyleMatrix, emu, formatSchemeKey, gradFill, loadThemeVariants, parsePresentationDrawingGuides, parsePresentationSmartTags, resolveLayoutDisplayName, detectDigitalSignatures, unwrapOleEmbedding, mimeTypeForOleFile, oleBytesToDataUrl, parseKinsoku, deobfuscateFont, detectFontFormat, parseLineStyle, parseChartUpDownBars, parseDataTable, parseChart3DSurfaces, parseChartAxes, parseBubbleChartOptions, extractGuidFromPartName, parseChartLayouts, parseCxChartSeries, parseChartDataPointPictureBlipRel, parseSeriesDataPoints, parseMarker, parseSeriesDataLabels, parseChartDataPointPicture, parseImplicitBlipPictureFill, parseEmbeddedXlsx, EMU_PER_POINT, chartTrendlineKind, parseChartManualLayout, parseDiagramRelationshipIds, parseSmartArtTextParagraphs, firstParagraphRuns, smartArtParagraphsText, parseSmartArtPresLayoutVars, parseSmartArtConnection, projectSmartArtNodeText, resolveSmartArtNodeStyleRoles, resolveSmartArtNodeCoherent3DOff, parseSmartArtDefinitionMetadata, parseSmartArtColorStyleLabels, buildSmartArtColorLists, buildSmartArtColorRoleMap, parseSmartArtQuickStyleLabels, resolveSmartArtEffectIntensity, parseSmartArtStyleLabelRefs, extractStyleReferenceColorXml, withThemePlaceholderColor, getElementOrientationMatrix, isTextOrientationMatrix, TEXT_ORIENTATION_IDENTITY, multiplyTextOrientationMatrices } from './chunk-LGSBK3BV.mjs';
2
+ import { openPptxZip, DIGITAL_SIGNATURE_ORIGIN_REL_TYPE, openZip, MAX_ZIP_ENTRY_COUNT, DEFAULT_MAX_UNCOMPRESSED_BYTES, guardZip, ZipBombError } from './chunk-EYCM7RVL.mjs';
3
3
  import { resolveSmartArtLayoutCategory } from './chunk-3GXV5MPC.mjs';
4
4
  import { cloneXmlObject, applySmartArtLayoutDefinition, cloneSlide, parseSmartArtLayoutDefinition } from './chunk-54S5A5PZ.mjs';
5
5
  import { themeColorRefFromColorChoice, parseOoxmlPercent, themeColorRefToSolidFillWithOpacity, applyDrawingColorTransforms, parseDrawingFraction, scrgbLinearToSrgb8, parseDrawingHueDegrees, hslToRgb, themeColorRefToXml, themeColorRefFromSchemeClr, blendColorOntoWhite } from './chunk-KII4AAYH.mjs';
@@ -7,6 +7,198 @@ import JSZip from 'jszip';
7
7
  import { XMLParser, XMLBuilder } from 'fast-xml-parser';
8
8
  import { decompressEotFont } from 'mtx-decompressor';
9
9
 
10
+ // pptx/core/core/load-limits.ts
11
+ var DEFAULT_PPTX_LOAD_LIMITS = Object.freeze({
12
+ maxInputBytes: Number.POSITIVE_INFINITY,
13
+ maxUncompressedBytes: DEFAULT_MAX_UNCOMPRESSED_BYTES,
14
+ maxEntries: MAX_ZIP_ENTRY_COUNT,
15
+ maxSlides: Number.POSITIVE_INFINITY,
16
+ maxShapes: Number.POSITIVE_INFINITY
17
+ });
18
+ var LIMIT_NAMES = Object.keys(DEFAULT_PPTX_LOAD_LIMITS);
19
+ var PptxLoadLimitError = class extends Error {
20
+ code = "PPTX_LOAD_LIMIT";
21
+ /** The limit that was exceeded. */
22
+ limit;
23
+ /** The value of that limit. */
24
+ maximum;
25
+ /**
26
+ * The observed value: exact for `maxSlides` and for `maxInputBytes` on
27
+ * `load()`; for `maxShapes`, and for `maxInputBytes` on `loadFromJson()`
28
+ * (which stops counting once past the limit), a lower bound.
29
+ */
30
+ actual;
31
+ constructor(message, limit, maximum, actual) {
32
+ super(message);
33
+ this.name = "PptxLoadLimitError";
34
+ this.limit = limit;
35
+ this.maximum = maximum;
36
+ this.actual = actual;
37
+ }
38
+ };
39
+ function isLimitName(value) {
40
+ return typeof value === "string" && LIMIT_NAMES.includes(value);
41
+ }
42
+ function getPptxLoadLimitViolation(error) {
43
+ if (typeof error !== "object" || error === null) {
44
+ return void 0;
45
+ }
46
+ const fields = error;
47
+ const actual = typeof fields.actual === "number" ? fields.actual : void 0;
48
+ if (fields.code === "PPTX_LOAD_LIMIT" && isLimitName(fields.limit) && typeof fields.maximum === "number") {
49
+ return { limit: fields.limit, maximum: fields.maximum, actual };
50
+ }
51
+ if (fields.code === "ZIP_BOMB" && isLimitName(fields.loadLimit) && typeof fields.limit === "number") {
52
+ return { limit: fields.loadLimit, maximum: fields.limit, actual };
53
+ }
54
+ return void 0;
55
+ }
56
+ function resolvePptxLoadLimits(options = {}) {
57
+ const resolved = { ...DEFAULT_PPTX_LOAD_LIMITS };
58
+ const legacy = options.maxUncompressedBytes;
59
+ if (typeof legacy === "number" && legacy > 0) {
60
+ resolved.maxUncompressedBytes = legacy;
61
+ }
62
+ const limits = options.limits;
63
+ if (limits === void 0 || limits === null) {
64
+ return resolved;
65
+ }
66
+ for (const name of LIMIT_NAMES) {
67
+ const value = limits[name];
68
+ if (value === void 0) {
69
+ continue;
70
+ }
71
+ if (typeof value !== "number" || !Number.isFinite(value) || value <= 0) {
72
+ throw new RangeError(`limits.${name} must be a positive finite number`);
73
+ }
74
+ if (name === "maxEntries" && value > MAX_ZIP_ENTRY_COUNT) {
75
+ throw new RangeError(`limits.maxEntries must not exceed ${MAX_ZIP_ENTRY_COUNT}`);
76
+ }
77
+ resolved[name] = value;
78
+ }
79
+ return resolved;
80
+ }
81
+ function createPptxZipBombError(message, details) {
82
+ const { limit, kind, actual } = details;
83
+ if (kind === "maxEntries") {
84
+ return new ZipBombError(message, {
85
+ limit,
86
+ loadLimit: "maxEntries",
87
+ ...actual === void 0 ? {} : { entryCount: actual, actual }
88
+ });
89
+ }
90
+ if (kind === "maxEntryBytes" || kind === "maxTotalBytes") {
91
+ return new ZipBombError(message, {
92
+ limit,
93
+ loadLimit: "maxUncompressedBytes",
94
+ ...actual === void 0 ? {} : { uncompressedBytes: actual, actual }
95
+ });
96
+ }
97
+ return new ZipBombError(message, { limit });
98
+ }
99
+ var count = (value) => value.toLocaleString("en-US");
100
+ function assertPptxInputWithinLimits(byteLength, limits) {
101
+ if (byteLength > limits.maxInputBytes) {
102
+ throw new PptxLoadLimitError(
103
+ `PPTX input is ${count(byteLength)} bytes, more than the maxInputBytes limit of ${count(limits.maxInputBytes)}`,
104
+ "maxInputBytes",
105
+ limits.maxInputBytes,
106
+ byteLength
107
+ );
108
+ }
109
+ }
110
+ function assertPptxTextWithinLimits(text, limits) {
111
+ const maximum = limits.maxInputBytes;
112
+ if (text.length * 3 <= maximum) {
113
+ return;
114
+ }
115
+ const bytes = text.length > maximum ? text.length : utf8ByteLengthPast(text, maximum);
116
+ if (bytes > maximum) {
117
+ throw new PptxLoadLimitError(
118
+ `PPTX input is at least ${count(bytes)} bytes, more than the maxInputBytes limit of ${count(maximum)}`,
119
+ "maxInputBytes",
120
+ maximum,
121
+ bytes
122
+ );
123
+ }
124
+ }
125
+ function utf8ByteLengthPast(text, maximum) {
126
+ let bytes = 0;
127
+ for (let index = 0; index < text.length && bytes <= maximum; index++) {
128
+ const unit = text.charCodeAt(index);
129
+ if (unit < 128) {
130
+ bytes += 1;
131
+ } else if (unit < 2048) {
132
+ bytes += 2;
133
+ } else if (unit >= 55296 && unit <= 56319 && isLowSurrogate(text.charCodeAt(index + 1))) {
134
+ bytes += 4;
135
+ index++;
136
+ } else {
137
+ bytes += 3;
138
+ }
139
+ }
140
+ return bytes;
141
+ }
142
+ function isLowSurrogate(unit) {
143
+ return unit >= 56320 && unit <= 57343;
144
+ }
145
+ function assertPptxSlideCountWithinLimits(slideCount, limits) {
146
+ if (slideCount > limits.maxSlides) {
147
+ throw new PptxLoadLimitError(
148
+ `PPTX presentation has ${count(slideCount)} slides, more than the maxSlides limit of ${count(limits.maxSlides)}`,
149
+ "maxSlides",
150
+ limits.maxSlides,
151
+ slideCount
152
+ );
153
+ }
154
+ }
155
+ function countPptxShapesWithinLimits(counted, elements2, limits) {
156
+ const maximum = limits.maxShapes;
157
+ if (maximum === Number.POSITIVE_INFINITY) {
158
+ return counted;
159
+ }
160
+ const total = counted + countAuthoredElements(elements2);
161
+ if (total > maximum) {
162
+ throw new PptxLoadLimitError(
163
+ `PPTX presentation has at least ${count(total)} shapes, more than the maxShapes limit of ${count(maximum)}`,
164
+ "maxShapes",
165
+ maximum,
166
+ total
167
+ );
168
+ }
169
+ return total;
170
+ }
171
+ function countAuthoredElements(elements2) {
172
+ let total = 0;
173
+ const lists = [elements2];
174
+ const positions = [0];
175
+ while (lists.length > 0) {
176
+ const top = lists.length - 1;
177
+ const list2 = lists[top];
178
+ const position2 = positions[top];
179
+ if (position2 >= list2.length) {
180
+ lists.pop();
181
+ positions.pop();
182
+ continue;
183
+ }
184
+ positions[top] = position2 + 1;
185
+ const element = list2[position2];
186
+ if (typeof element !== "object" || element === null) {
187
+ continue;
188
+ }
189
+ const { id, type, children: children6 } = element;
190
+ if (typeof id === "string" && isTemplateElementId(id)) {
191
+ continue;
192
+ }
193
+ total++;
194
+ if (type === "group" && Array.isArray(children6) && children6.length > 0) {
195
+ lists.push(children6);
196
+ positions.push(0);
197
+ }
198
+ }
199
+ return total;
200
+ }
201
+
10
202
  // drawingml/dom.ts
11
203
  function attributeReader(element) {
12
204
  return (name) => {
@@ -644,8 +836,8 @@ function readPairs(element, vt) {
644
836
  const out = [];
645
837
  for (let i = 0; i + 1 < variants.length; i += 2) {
646
838
  const name = variants[i]?.textContent ?? "";
647
- const count = Number.parseInt(variants[i + 1]?.textContent ?? "", 10);
648
- out.push({ name, count: Number.isFinite(count) ? count : 0 });
839
+ const count2 = Number.parseInt(variants[i + 1]?.textContent ?? "", 10);
840
+ out.push({ name, count: Number.isFinite(count2) ? count2 : 0 });
649
841
  }
650
842
  return out;
651
843
  }
@@ -815,9 +1007,9 @@ function customPropertyFromText(name, type, text) {
815
1007
  function titleGroups(headingPairs, titlesOfParts) {
816
1008
  let offset = 0;
817
1009
  return headingPairs.map((pair) => {
818
- const count = Math.max(0, pair.count);
819
- const titles = titlesOfParts.slice(offset, offset + count);
820
- offset += count;
1010
+ const count2 = Math.max(0, pair.count);
1011
+ const titles = titlesOfParts.slice(offset, offset + count2);
1012
+ offset += count2;
821
1013
  return { name: pair.name, titles };
822
1014
  });
823
1015
  }
@@ -7156,7 +7348,7 @@ function parsedParagraphSignature(paragraph2) {
7156
7348
  return signatureOf(counts);
7157
7349
  }
7158
7350
  function signatureOf(counts) {
7159
- return [...counts.entries()].sort((a, b) => a[0] < b[0] ? -1 : 1).map(([name, count]) => `${name}:${count}`).join(",");
7351
+ return [...counts.entries()].sort((a, b) => a[0] < b[0] ? -1 : 1).map(([name, count2]) => `${name}:${count2}`).join(",");
7160
7352
  }
7161
7353
  function collectParsedParagraphs(root) {
7162
7354
  const result = [];
@@ -10310,23 +10502,23 @@ function classify(chars, index) {
10310
10502
  }
10311
10503
  function countParagraphWords(text) {
10312
10504
  const chars = Array.from(text);
10313
- let count = 0;
10505
+ let count2 = 0;
10314
10506
  let previous = "none";
10315
10507
  for (let index = 0; index < chars.length; index++) {
10316
10508
  const kind = classify(chars, index);
10317
10509
  if (kind === "space") {
10318
10510
  if (previous === "none" || previous === "control") {
10319
- count++;
10511
+ count2++;
10320
10512
  }
10321
10513
  previous = "space";
10322
10514
  continue;
10323
10515
  }
10324
10516
  if (kind === "ideograph" || kind === "control" || kind !== previous) {
10325
- count++;
10517
+ count2++;
10326
10518
  }
10327
10519
  previous = kind;
10328
10520
  }
10329
- return count;
10521
+ return count2;
10330
10522
  }
10331
10523
 
10332
10524
  // pptx/core/utils/app-properties-text-stats.ts
@@ -13220,10 +13412,10 @@ function assertAfterAnimationClearSupported(effectCTn) {
13220
13412
  if (!isXmlObject3(sub)) return;
13221
13413
  const countAfterFlags = (value) => {
13222
13414
  if (Array.isArray(value))
13223
- return value.reduce((count, child16) => count + countAfterFlags(child16), 0);
13415
+ return value.reduce((count2, child16) => count2 + countAfterFlags(child16), 0);
13224
13416
  if (!isXmlObject3(value)) return 0;
13225
13417
  return Object.entries(value).reduce(
13226
- (count, [key2, child16]) => count + (key2 === "@_afterEffect" && ["1", "true"].includes(String(child16)) ? 1 : countAfterFlags(child16)),
13418
+ (count2, [key2, child16]) => count2 + (key2 === "@_afterEffect" && ["1", "true"].includes(String(child16)) ? 1 : countAfterFlags(child16)),
13227
13419
  0
13228
13420
  );
13229
13421
  };
@@ -34911,8 +35103,8 @@ function reorderContainer(node, rawInner) {
34911
35103
  if (isGroupedByTag(children6.map((child16) => child16.tag))) {
34912
35104
  return;
34913
35105
  }
34914
- for (const [tag, count] of occurrence) {
34915
- if (ensureItems(node[tag]).length !== count) {
35106
+ for (const [tag, count2] of occurrence) {
35107
+ if (ensureItems(node[tag]).length !== count2) {
34916
35108
  return;
34917
35109
  }
34918
35110
  }
@@ -34934,8 +35126,8 @@ function annotateOmmlSiblingOrder(xml, parsed) {
34934
35126
  return;
34935
35127
  }
34936
35128
  const nodes = collectParsedOmathNodes(parsed);
34937
- const count = Math.min(fragments.length, nodes.length);
34938
- for (let index = 0; index < count; index++) {
35129
+ const count2 = Math.min(fragments.length, nodes.length);
35130
+ for (let index = 0; index < count2; index++) {
34939
35131
  if (fragments[index]) {
34940
35132
  reorderContainer(nodes[index], fragments[index]);
34941
35133
  }
@@ -35993,6 +36185,174 @@ function extractFontFromEot(data) {
35993
36185
  return { fontData, header };
35994
36186
  }
35995
36187
 
36188
+ // pptx/core/utils/deferred-embedded-font.ts
36189
+ function resolveEmbeddedFontGuid(source) {
36190
+ if (isEotFormat(source.originalPartBytes)) {
36191
+ return void 0;
36192
+ }
36193
+ const { fontKey } = source;
36194
+ const fromKey = fontKey ? extractGuidFromPartName(fontKey) ?? fontKey.replace(/[{}]/g, "").trim() : null;
36195
+ return fromKey || extractGuidFromPartName(source.partPath) || void 0;
36196
+ }
36197
+ function hasSfntSignature(bytes) {
36198
+ if (bytes.length < 4) {
36199
+ return false;
36200
+ }
36201
+ const [v0, v1, v2, v3] = bytes;
36202
+ return v0 === 0 && v1 === 1 && v2 === 0 && v3 === 0 || v0 === 79 && v1 === 84 && v2 === 84 && v3 === 79 || v0 === 116 && v1 === 116 && v2 === 99 && v3 === 102 || v0 === 119 && v1 === 79 && v2 === 70 && (v3 === 70 || v3 === 50);
36203
+ }
36204
+ function warnInvalidSignature(name, bytes) {
36205
+ const hex3 = Array.from(bytes.subarray(0, 4), (b) => b.toString(16)).join(",");
36206
+ console.warn(
36207
+ `[pptx-viewer] Embedded font "${name}" has invalid sfnt header [${hex3}] after processing; skipping (web font fallback will be used)`
36208
+ );
36209
+ }
36210
+ function isEmbeddedFontPartPlausible(source) {
36211
+ const bytes = source.originalPartBytes;
36212
+ if (bytes.length === 0) {
36213
+ return false;
36214
+ }
36215
+ if (isEotFormat(bytes)) {
36216
+ return true;
36217
+ }
36218
+ const guid = resolveEmbeddedFontGuid(source);
36219
+ if (!guid) {
36220
+ console.warn(
36221
+ `[pptx-viewer] Embedded font "${source.name}" at "${source.partPath}" has no fontKey attribute and no GUID in filename; skipping`
36222
+ );
36223
+ return false;
36224
+ }
36225
+ const header = deobfuscateFont(bytes.subarray(0, Math.min(bytes.length, 32)), guid);
36226
+ if (header.length < 4) {
36227
+ return false;
36228
+ }
36229
+ if (!hasSfntSignature(header)) {
36230
+ warnInvalidSignature(source.name, header);
36231
+ return false;
36232
+ }
36233
+ return true;
36234
+ }
36235
+ function uint8ArrayToBase64(bytes) {
36236
+ let binary = "";
36237
+ const chunkSize = 8192;
36238
+ for (let i = 0; i < bytes.length; i += chunkSize) {
36239
+ const chunk = bytes.subarray(i, Math.min(i + chunkSize, bytes.length));
36240
+ for (let j = 0; j < chunk.length; j++) {
36241
+ binary += String.fromCharCode(chunk[j]);
36242
+ }
36243
+ }
36244
+ return btoa(binary);
36245
+ }
36246
+ function decodeEmbeddedFontPart(source) {
36247
+ const { name, partPath, originalPartBytes } = source;
36248
+ try {
36249
+ let fontData;
36250
+ const fontGuid = resolveEmbeddedFontGuid(source);
36251
+ if (isEotFormat(originalPartBytes)) {
36252
+ const extracted = extractFontFromEot(originalPartBytes);
36253
+ if (!extracted) {
36254
+ const header = parseEotHeader(originalPartBytes);
36255
+ console.info(
36256
+ `[pptx-viewer] Embedded font "${name}" uses EOT format${header?.isCompressed ? " with MTX compression" : ""}; extraction failed, will use web font fallback`
36257
+ );
36258
+ return null;
36259
+ }
36260
+ fontData = extracted.fontData;
36261
+ } else if (fontGuid) {
36262
+ fontData = deobfuscateFont(originalPartBytes, fontGuid);
36263
+ } else {
36264
+ console.warn(
36265
+ `[pptx-viewer] Embedded font "${name}" at "${partPath}" has no fontKey attribute and no GUID in filename; skipping`
36266
+ );
36267
+ return null;
36268
+ }
36269
+ if (fontData.length < 4) {
36270
+ return null;
36271
+ }
36272
+ if (!hasSfntSignature(fontData)) {
36273
+ warnInvalidSignature(name, fontData);
36274
+ return null;
36275
+ }
36276
+ const format = detectFontFormat(fontData);
36277
+ const mimeType = format === "woff2" ? "font/woff2" : format === "woff" ? "font/woff" : format === "opentype" ? "font/otf" : "font/ttf";
36278
+ return {
36279
+ name,
36280
+ dataUrl: `data:${mimeType};base64,${uint8ArrayToBase64(fontData)}`,
36281
+ bold: source.bold,
36282
+ italic: source.italic,
36283
+ format,
36284
+ rawFontData: fontData,
36285
+ partPath,
36286
+ fontGuid,
36287
+ originalRId: source.originalRId,
36288
+ originalPartBytes
36289
+ };
36290
+ } catch {
36291
+ return null;
36292
+ }
36293
+ }
36294
+ function createDeferredEmbeddedFont(source) {
36295
+ const fontGuid = resolveEmbeddedFontGuid(source);
36296
+ let fields;
36297
+ let pending;
36298
+ const decode = () => {
36299
+ if (!fields) {
36300
+ const decoded = decodeEmbeddedFontPart(source);
36301
+ fields = {
36302
+ dataUrl: decoded?.dataUrl ?? "",
36303
+ format: decoded?.format,
36304
+ rawFontData: decoded?.rawFontData
36305
+ };
36306
+ }
36307
+ return fields;
36308
+ };
36309
+ const font = {
36310
+ name: source.name,
36311
+ get dataUrl() {
36312
+ return decode().dataUrl;
36313
+ },
36314
+ set dataUrl(value) {
36315
+ decode().dataUrl = value;
36316
+ },
36317
+ bold: source.bold,
36318
+ italic: source.italic,
36319
+ get format() {
36320
+ return decode().format;
36321
+ },
36322
+ set format(value) {
36323
+ decode().format = value;
36324
+ },
36325
+ get rawFontData() {
36326
+ return decode().rawFontData;
36327
+ },
36328
+ set rawFontData(value) {
36329
+ decode().rawFontData = value;
36330
+ },
36331
+ partPath: source.partPath,
36332
+ fontGuid,
36333
+ originalRId: source.originalRId,
36334
+ originalPartBytes: source.originalPartBytes
36335
+ };
36336
+ Object.defineProperties(font, {
36337
+ load: {
36338
+ value: () => pending ??= Promise.resolve().then(
36339
+ () => decode().rawFontData?.length || decode().dataUrl ? font : null
36340
+ )
36341
+ },
36342
+ isLoaded: { get: () => fields !== void 0 }
36343
+ });
36344
+ return font;
36345
+ }
36346
+ function shouldSaveEmbeddedFontVerbatim(font) {
36347
+ if (font.isLoaded === void 0 || !font.originalPartBytes?.length) {
36348
+ return false;
36349
+ }
36350
+ if (!font.originalRId || !font.partPath) {
36351
+ return false;
36352
+ }
36353
+ return font.isLoaded === false || !font.rawFontData?.length;
36354
+ }
36355
+
35996
36356
  // pptx/core/core/runtime/header-footer-parts.ts
35997
36357
  var DEFAULT_DATE_FIELD_TYPE = "datetime1";
35998
36358
  function asArray2(value) {
@@ -38054,10 +38414,10 @@ function collectFilteredSeriesIndices(container, xmlLookup) {
38054
38414
  }
38055
38415
  return reserved;
38056
38416
  }
38057
- function assignSeriesIndices(count, reservedIndices) {
38417
+ function assignSeriesIndices(count2, reservedIndices) {
38058
38418
  const assigned = [];
38059
38419
  let cursor = 0;
38060
- for (let i = 0; i < count; i++) {
38420
+ for (let i = 0; i < count2; i++) {
38061
38421
  while (reservedIndices.has(cursor)) {
38062
38422
  cursor++;
38063
38423
  }
@@ -38376,8 +38736,8 @@ function parseCache(node) {
38376
38736
  return point;
38377
38737
  })
38378
38738
  };
38379
- const count = Number(cVal(node, "ptCount") ?? Number.NaN);
38380
- if (Number.isInteger(count) && count >= 0) cache2.pointCount = count;
38739
+ const count2 = Number(cVal(node, "ptCount") ?? Number.NaN);
38740
+ if (Number.isInteger(count2) && count2 >= 0) cache2.pointCount = count2;
38381
38741
  const formatCode2 = cChild(node, "formatCode")?.textContent;
38382
38742
  if (formatCode2) cache2.formatCode = formatCode2;
38383
38743
  return cache2;
@@ -38395,8 +38755,8 @@ function parseDataSource(element) {
38395
38755
  const levels = cChild(ref, "multiLvlStrCache");
38396
38756
  if (levels) {
38397
38757
  source.levels = children(levels, "lvl", NS.c).map(parseCache);
38398
- const count = Number(cVal(levels, "ptCount") ?? Number.NaN);
38399
- if (Number.isInteger(count) && count >= 0) source.levelPointCount = count;
38758
+ const count2 = Number(cVal(levels, "ptCount") ?? Number.NaN);
38759
+ if (Number.isInteger(count2) && count2 >= 0) source.levelPointCount = count2;
38400
38760
  }
38401
38761
  return source;
38402
38762
  }
@@ -46973,9 +47333,9 @@ function buildFopt(simple, complex = []) {
46973
47333
  payload.bytes(bytes);
46974
47334
  }
46975
47335
  }
46976
- const count = simple.length + complex.length;
47336
+ const count2 = simple.length + complex.length;
46977
47337
  const data = new ByteWriter().append(entries).append(payload).toBytes();
46978
- return record(OA.FOPT, data, count, false, 3);
47338
+ return record(OA.FOPT, data, count2, false, 3);
46979
47339
  }
46980
47340
  var METRO_BLOB_OPID = 937;
46981
47341
  function buildMetroBlobTertiaryFopt(metroBlob) {
@@ -47012,9 +47372,9 @@ function buildDgg(shapesPerDrawing, totalShapes) {
47012
47372
  const cidcl = drawingCount + 1;
47013
47373
  const cspSaved = totalShapes - drawingCount;
47014
47374
  const w = new ByteWriter().u32(maxShapeId).u32(cidcl).u32(cspSaved).u32(drawingCount);
47015
- shapesPerDrawing.forEach((count, i) => {
47375
+ shapesPerDrawing.forEach((count2, i) => {
47016
47376
  const drawingId = i + 1;
47017
- w.u32(drawingId).u32(count);
47377
+ w.u32(drawingId).u32(count2);
47018
47378
  });
47019
47379
  return record(OA.Dgg, w.toBytes(), 0, false, 0);
47020
47380
  }
@@ -47811,8 +48171,8 @@ function atom(recType, data) {
47811
48171
  function textHeader(textType) {
47812
48172
  return atom(RT.TextHeaderAtom, new ByteWriter().u32(textType).toBytes());
47813
48173
  }
47814
- function textSpecInfo(count) {
47815
- return atom(RT.TextSpecInfoAtom, new ByteWriter().u32(count).u32(1).u16(0).toBytes());
48174
+ function textSpecInfo(count2) {
48175
+ return atom(RT.TextSpecInfoAtom, new ByteWriter().u32(count2).u32(1).u16(0).toBytes());
47816
48176
  }
47817
48177
  function promptText(textType, paragraphs) {
47818
48178
  const text = paragraphs.join("\r");
@@ -48460,17 +48820,17 @@ function slideMasterIndex(masterIndex, masterCount) {
48460
48820
  return masterIndex !== void 0 && Number.isInteger(masterIndex) && masterIndex >= 0 && masterIndex < masterCount ? masterIndex : 0;
48461
48821
  }
48462
48822
  function countDrawingShapes(shapes) {
48463
- let count = 1;
48823
+ let count2 = 1;
48464
48824
  const walk = (list2) => {
48465
48825
  for (const shape of list2) {
48466
- count++;
48826
+ count2++;
48467
48827
  if (shape.kind === "group") {
48468
48828
  walk(shape.children);
48469
48829
  }
48470
48830
  }
48471
48831
  };
48472
48832
  walk(shapes);
48473
- return count;
48833
+ return count2;
48474
48834
  }
48475
48835
  function collectFonts(deck, masters) {
48476
48836
  const collect = (shape) => {
@@ -48979,7 +49339,7 @@ function toLevel(style = {}, themeFonts = {}) {
48979
49339
  }
48980
49340
  };
48981
49341
  }
48982
- function toLevels(levels, count, themeFonts) {
49342
+ function toLevels(levels, count2, themeFonts) {
48983
49343
  if (!levels) {
48984
49344
  return void 0;
48985
49345
  }
@@ -48989,7 +49349,7 @@ function toLevels(levels, count, themeFonts) {
48989
49349
  }
48990
49350
  const base = levels[-1];
48991
49351
  return Array.from(
48992
- { length: count },
49352
+ { length: count2 },
48993
49353
  (_, i) => toLevel(base || levels[i] ? { ...base, ...levels[i] } : void 0, themeFonts)
48994
49354
  );
48995
49355
  }
@@ -49825,12 +50185,12 @@ function visitGraphicData(node, relationshipId, extended, getLocalName2) {
49825
50185
  }
49826
50186
  if (Array.isArray(node)) {
49827
50187
  return node.reduce(
49828
- (count2, entry2) => count2 + visitGraphicData(entry2, relationshipId, extended, getLocalName2),
50188
+ (count3, entry2) => count3 + visitGraphicData(entry2, relationshipId, extended, getLocalName2),
49829
50189
  0
49830
50190
  );
49831
50191
  }
49832
50192
  const object = node;
49833
- let count = 0;
50193
+ let count2 = 0;
49834
50194
  for (const key2 of Object.keys(object)) {
49835
50195
  if (key2.startsWith("@_")) {
49836
50196
  continue;
@@ -49842,14 +50202,14 @@ function visitGraphicData(node, relationshipId, extended, getLocalName2) {
49842
50202
  const chart = chartKey ? candidate[chartKey] : void 0;
49843
50203
  if (chart && String(chart["@_r:id"]) === relationshipId) {
49844
50204
  rebindGraphicData(candidate, relationshipId, extended);
49845
- count += 1;
50205
+ count2 += 1;
49846
50206
  }
49847
50207
  }
49848
50208
  continue;
49849
50209
  }
49850
- count += visitGraphicData(value, relationshipId, extended, getLocalName2);
50210
+ count2 += visitGraphicData(value, relationshipId, extended, getLocalName2);
49851
50211
  }
49852
- return count;
50212
+ return count2;
49853
50213
  }
49854
50214
  async function rewriteChartGraphicFrames(deps, slidePath, relationshipId, extended) {
49855
50215
  const xml = await deps.zip.file(slidePath)?.async("string");
@@ -49857,11 +50217,11 @@ async function rewriteChartGraphicFrames(deps, slidePath, relationshipId, extend
49857
50217
  return 0;
49858
50218
  }
49859
50219
  const tree = deps.parser.parse(xml);
49860
- const count = visitGraphicData(tree, relationshipId, extended, deps.getLocalName);
49861
- if (count > 0) {
50220
+ const count2 = visitGraphicData(tree, relationshipId, extended, deps.getLocalName);
50221
+ if (count2 > 0) {
49862
50222
  deps.zip.file(slidePath, deps.builder.build(tree));
49863
50223
  }
49864
- return count;
50224
+ return count2;
49865
50225
  }
49866
50226
 
49867
50227
  // pptx/core/utils/chart-color-style-writer.ts
@@ -56986,6 +57346,8 @@ var PptxHandlerRuntime = class {
56986
57346
  alternateContentBlockByRawXml = /* @__PURE__ */ new WeakMap();
56987
57347
  /** Embedded fonts extracted during load, preserved for automatic re-embedding on save. */
56988
57348
  loadedEmbeddedFonts = [];
57349
+ /** Decode every embedded font variant during load (see `PptxHandlerLoadOptions`). */
57350
+ eagerDecodeEmbeddedFonts = false;
56989
57351
  /** Typed source metadata for lossless embedded-font list round trips. */
56990
57352
  loadedEmbeddedFontList;
56991
57353
  /**
@@ -61578,10 +61940,10 @@ function detectDominantScript(text) {
61578
61940
  }
61579
61941
  let best;
61580
61942
  let bestCount = 0;
61581
- for (const [cat, count] of Object.entries(counts)) {
61582
- if (count > bestCount) {
61943
+ for (const [cat, count2] of Object.entries(counts)) {
61944
+ if (count2 > bestCount) {
61583
61945
  best = cat;
61584
- bestCount = count;
61946
+ bestCount = count2;
61585
61947
  }
61586
61948
  }
61587
61949
  return best;
@@ -64322,9 +64684,9 @@ function applyTableStructureEditXml(table, source, next, edit) {
64322
64684
  if (axis !== "row" && axis !== "column" || action !== "insert" && action !== "delete") {
64323
64685
  return false;
64324
64686
  }
64325
- const count = axis === "row" ? rows.length : columns.length;
64687
+ const count2 = axis === "row" ? rows.length : columns.length;
64326
64688
  const delta = action === "insert" ? 1 : -1;
64327
- if (!grid || !Number.isInteger(index) || index < 0 || index > count - (action === "delete" ? 1 : 0) || action === "delete" && count <= 1 || next.rows.length !== rows.length + (axis === "row" ? delta : 0) || next.columnWidths.length !== columns.length + (axis === "column" ? delta : 0)) {
64689
+ if (!grid || !Number.isInteger(index) || index < 0 || index > count2 - (action === "delete" ? 1 : 0) || action === "delete" && count2 <= 1 || next.rows.length !== rows.length + (axis === "row" ? delta : 0) || next.columnWidths.length !== columns.length + (axis === "column" ? delta : 0)) {
64328
64690
  return false;
64329
64691
  }
64330
64692
  if (axis === "row") {
@@ -67249,7 +67611,9 @@ var PptxHandlerRuntime25 = class _PptxHandlerRuntime extends PptxHandlerRuntime2
67249
67611
  return;
67250
67612
  }
67251
67613
  const fonts = explicitFonts ?? this.loadedEmbeddedFonts;
67252
- const fontsWithData = fonts.filter((f) => f.rawFontData && f.rawFontData.length > 0);
67614
+ const fontsWithData = fonts.filter(
67615
+ (f) => shouldSaveEmbeddedFontVerbatim(f) || f.rawFontData && f.rawFontData.length > 0
67616
+ );
67253
67617
  if (fontsWithData.length === 0) {
67254
67618
  const metadata = explicitFontList ?? this.loadedEmbeddedFontList;
67255
67619
  if (metadata && this.presentationData) {
@@ -67292,10 +67656,11 @@ var PptxHandlerRuntime25 = class _PptxHandlerRuntime extends PptxHandlerRuntime2
67292
67656
  "p:font": { "@_typeface": typeface }
67293
67657
  };
67294
67658
  for (const variant of variants) {
67295
- const fontData = variant.rawFontData;
67659
+ const verbatim = shouldSaveEmbeddedFontVerbatim(variant);
67660
+ const fontData = verbatim ? void 0 : variant.rawFontData;
67296
67661
  const hasOriginal = Boolean(variant.originalRId && variant.partPath);
67297
- const reuseObfuscation = hasOriginal && Boolean(variant.fontGuid);
67298
- const reuseVerbatim = hasOriginal && !variant.fontGuid && Boolean(variant.originalPartBytes);
67662
+ const reuseObfuscation = hasOriginal && !verbatim && Boolean(variant.fontGuid);
67663
+ const reuseVerbatim = hasOriginal && (verbatim || !variant.fontGuid) && Boolean(variant.originalPartBytes);
67299
67664
  let guid;
67300
67665
  let fontPartPath;
67301
67666
  let relativeTarget4;
@@ -70737,13 +71102,13 @@ function countDeclaredIds(node, counts, ensureArray12) {
70737
71102
  if (!countDeclaredIds(branch, branchCounts, ensureArray12)) {
70738
71103
  return false;
70739
71104
  }
70740
- for (const [id, count] of branchCounts) {
70741
- merged.set(id, Math.max(merged.get(id) ?? 0, count));
71105
+ for (const [id, count2] of branchCounts) {
71106
+ merged.set(id, Math.max(merged.get(id) ?? 0, count2));
70742
71107
  }
70743
71108
  }
70744
71109
  }
70745
- for (const [id, count] of merged) {
70746
- counts.set(id, (counts.get(id) ?? 0) + count);
71110
+ for (const [id, count2] of merged) {
71111
+ counts.set(id, (counts.get(id) ?? 0) + count2);
70747
71112
  }
70748
71113
  }
70749
71114
  return true;
@@ -70753,8 +71118,8 @@ function hasStructuralIdDefects(spTree, ensureArray12) {
70753
71118
  if (!countDeclaredIds(spTree, counts, ensureArray12)) {
70754
71119
  return true;
70755
71120
  }
70756
- for (const count of counts.values()) {
70757
- if (count > 1) {
71121
+ for (const count2 of counts.values()) {
71122
+ if (count2 > 1) {
70758
71123
  return true;
70759
71124
  }
70760
71125
  }
@@ -85034,7 +85399,13 @@ var PptxHandlerRuntime99 = class extends PptxHandlerRuntime98 {
85034
85399
  }
85035
85400
  return map;
85036
85401
  }
85037
- /** Extract, de-obfuscate, and encode a single font variant. */
85402
+ /**
85403
+ * Read one variant's part. By default the result is a deferred descriptor
85404
+ * that decodes on first use (see `createDeferredEmbeddedFont`); parts that
85405
+ * fail the checks possible without decoding are skipped, as before. With
85406
+ * `eagerDecodeEmbeddedFonts` the variant is decoded now and skipped when
85407
+ * decoding fails.
85408
+ */
85038
85409
  async extractEmbeddedFontVariant(typeface, rId, bold, italic, relsMap, fontKey) {
85039
85410
  const fontPath = relsMap.get(rId);
85040
85411
  if (!fontPath) {
@@ -85045,80 +85416,25 @@ var PptxHandlerRuntime99 = class extends PptxHandlerRuntime98 {
85045
85416
  if (!fontBinary || fontBinary.length === 0) {
85046
85417
  return null;
85047
85418
  }
85048
- const originalPartBytes = new Uint8Array(fontBinary);
85049
- let fontData;
85050
- let resolvedGuid;
85051
- if (isEotFormat(fontBinary)) {
85052
- const extracted = extractFontFromEot(fontBinary);
85053
- if (extracted) {
85054
- fontData = extracted.fontData;
85055
- } else {
85056
- const header = parseEotHeader(fontBinary);
85057
- console.info(
85058
- `[pptx-viewer] Embedded font "${typeface}" uses EOT format${header?.isCompressed ? " with MTX compression" : ""} \u2014 extraction failed, will use web font fallback`
85059
- );
85060
- return null;
85061
- }
85062
- } else {
85063
- const guidFromKey = fontKey ? extractGuidFromPartName(fontKey) ?? fontKey.replace(/[{}]/g, "").trim() : null;
85064
- const guidFromPath = extractGuidFromPartName(fontPath);
85065
- const guid = guidFromKey || guidFromPath;
85066
- if (guid) {
85067
- fontData = deobfuscateFont(fontBinary, guid);
85068
- resolvedGuid = guid;
85069
- } else {
85070
- console.warn(
85071
- `[pptx-viewer] Embedded font "${typeface}" at "${fontPath}" has no fontKey attribute and no GUID in filename \u2014 skipping`
85072
- );
85073
- return null;
85074
- }
85075
- }
85076
- if (fontData.length < 4) {
85077
- return null;
85078
- }
85079
- const v0 = fontData[0], v1 = fontData[1], v2 = fontData[2], v3 = fontData[3];
85080
- const isTrueType = v0 === 0 && v1 === 1 && v2 === 0 && v3 === 0;
85081
- const isOTTO = v0 === 79 && v1 === 84 && v2 === 84 && v3 === 79;
85082
- const isTTC = v0 === 116 && v1 === 116 && v2 === 99 && v3 === 102;
85083
- const isWOFF = v0 === 119 && v1 === 79 && v2 === 70 && (v3 === 70 || v3 === 50);
85084
- if (!(isTrueType || isOTTO || isTTC || isWOFF)) {
85085
- console.warn(
85086
- `[pptx-viewer] Embedded font "${typeface}" has invalid sfnt header [${v0.toString(16)},${v1.toString(16)},${v2.toString(16)},${v3.toString(16)}] after processing \u2014 skipping (web font fallback will be used)`
85087
- );
85088
- return null;
85089
- }
85090
- const format = detectFontFormat(fontData);
85091
- const mimeType = format === "woff2" ? "font/woff2" : format === "woff" ? "font/woff" : format === "opentype" ? "font/otf" : "font/ttf";
85092
- const base64 = this.uint8ArrayToBase64(fontData);
85093
- const dataUrl = `data:${mimeType};base64,${base64}`;
85094
- return {
85419
+ const source = {
85095
85420
  name: typeface,
85096
- dataUrl,
85097
85421
  bold,
85098
85422
  italic,
85099
- format,
85100
- rawFontData: fontData,
85101
- partPath: fontPath,
85102
- fontGuid: resolvedGuid,
85103
85423
  originalRId: rId,
85104
- originalPartBytes
85424
+ partPath: fontPath,
85425
+ // The descriptor owns a copy, so it outlives this handler's ZIP and
85426
+ // the save pipeline can write it back verbatim.
85427
+ originalPartBytes: new Uint8Array(fontBinary),
85428
+ fontKey
85105
85429
  };
85430
+ if (this.eagerDecodeEmbeddedFonts) {
85431
+ return decodeEmbeddedFontPart(source);
85432
+ }
85433
+ return isEmbeddedFontPartPlausible(source) ? createDeferredEmbeddedFont(source) : null;
85106
85434
  } catch {
85107
85435
  return null;
85108
85436
  }
85109
85437
  }
85110
- /** Convert Uint8Array to base64 string. */
85111
- uint8ArrayToBase64(bytes) {
85112
- let binary = "";
85113
- const chunkSize = 8192;
85114
- for (let i = 0; i < bytes.length; i += chunkSize) {
85115
- const chunk = bytes.subarray(i, Math.min(i + chunkSize, bytes.length));
85116
- for (let j = 0; j < chunk.length; j++) {
85117
- binary += String.fromCharCode(chunk[j]);
85118
- }
85119
- }
85120
- return btoa(binary);
85121
- }
85122
85438
  getLayoutOptions() {
85123
85439
  const options = [];
85124
85440
  for (const [path3, xmlObj] of this.layoutXmlMap.entries()) {
@@ -85166,6 +85482,10 @@ var PptxHandlerRuntime99 = class extends PptxHandlerRuntime98 {
85166
85482
  // pptx/core/core/runtime/PptxHandlerRuntimeLoadSession.ts
85167
85483
  var MAX_OLE_EMBEDDING_BYTES = 25 * 1024 * 1024;
85168
85484
  var PptxHandlerRuntime100 = class _PptxHandlerRuntime extends PptxHandlerRuntime99 {
85485
+ /** The limits of the load in progress (see `PptxHandlerLoadOptions.limits`). */
85486
+ loadLimits = { ...DEFAULT_PPTX_LOAD_LIMITS };
85487
+ /** Slide elements parsed so far by the load in progress, for `maxShapes`. */
85488
+ loadedShapeCount = 0;
85169
85489
  isZipContainer(data) {
85170
85490
  const bytes = new Uint8Array(data);
85171
85491
  if (bytes.byteLength < 4) {
@@ -85174,7 +85494,9 @@ var PptxHandlerRuntime100 = class _PptxHandlerRuntime extends PptxHandlerRuntime
85174
85494
  return bytes[0] === 80 && bytes[1] === 75 && (bytes[2] === 3 && bytes[3] === 4 || bytes[2] === 5 && bytes[3] === 6 || bytes[2] === 7 && bytes[3] === 8);
85175
85495
  }
85176
85496
  async initializeLoadSession(data, options) {
85497
+ const limits = resolvePptxLoadLimits(options);
85177
85498
  this.eagerDecodeImages = options.eagerDecodeImages ?? false;
85499
+ this.eagerDecodeEmbeddedFonts = options.eagerDecodeEmbeddedFonts === true;
85178
85500
  this.allowExternalImages = options.allowExternalImages === true;
85179
85501
  if (data.byteLength < 4) {
85180
85502
  throw new Error("Invalid PPTX binary: file is empty or truncated.");
@@ -85184,7 +85506,7 @@ var PptxHandlerRuntime100 = class _PptxHandlerRuntime extends PptxHandlerRuntime
85184
85506
  "Invalid PPTX binary: not a ZIP/OpenXML package. The file is neither an OpenXML archive nor an OLE compound file (which is how legacy .ppt and encrypted presentations arrive), so it is most likely corrupt, truncated, or not a presentation at all."
85185
85507
  );
85186
85508
  }
85187
- const maxBytes = typeof options.maxUncompressedBytes === "number" && options.maxUncompressedBytes > 0 ? options.maxUncompressedBytes : DEFAULT_MAX_UNCOMPRESSED_BYTES;
85509
+ const maxBytes = limits.maxUncompressedBytes;
85188
85510
  let loaded;
85189
85511
  try {
85190
85512
  loaded = await JSZip.loadAsync(data);
@@ -85194,11 +85516,13 @@ var PptxHandlerRuntime100 = class _PptxHandlerRuntime extends PptxHandlerRuntime
85194
85516
  }
85195
85517
  this.zip = guardZip(loaded, {
85196
85518
  label: "PPTX",
85197
- maxEntries: MAX_ZIP_ENTRY_COUNT,
85519
+ maxEntries: limits.maxEntries,
85198
85520
  maxEntryBytes: maxBytes,
85199
85521
  maxTotalBytes: maxBytes,
85200
- createError: (message, details) => new ZipBombError(message, details)
85522
+ createError: createPptxZipBombError
85201
85523
  });
85524
+ this.loadLimits = limits;
85525
+ this.loadedShapeCount = 0;
85202
85526
  try {
85203
85527
  this.documentPropertiesUpdater = this.dependencyFactory.createDocumentPropertiesUpdater(
85204
85528
  this.zip,
@@ -85364,6 +85688,11 @@ var PptxHandlerRuntime100 = class _PptxHandlerRuntime extends PptxHandlerRuntime
85364
85688
  }
85365
85689
  this.presentationData = this.parser.parse(presentationXml3);
85366
85690
  this.detectAndSetStrictConformance(this.presentationData);
85691
+ const slideIds = this.presentationData?.["p:presentation"]?.["p:sldIdLst"]?.["p:sldId"];
85692
+ assertPptxSlideCountWithinLimits(
85693
+ Array.isArray(slideIds) ? slideIds.length : slideIds ? 1 : 0,
85694
+ this.loadLimits
85695
+ );
85367
85696
  await this.loadThemeData();
85368
85697
  this.parsePresentationDefaultTextStyle();
85369
85698
  await this.loadCommentAuthors();
@@ -85493,7 +85822,17 @@ var PptxHandlerRuntime100 = class _PptxHandlerRuntime extends PptxHandlerRuntime
85493
85822
  loadThemeOverride: (partBasePath) => this.loadThemeOverride(partBasePath),
85494
85823
  applyThemeOverrideState: (override) => this.applyThemeOverrideState(override),
85495
85824
  getLayoutElements: (slidePath) => this.getLayoutElements(slidePath),
85496
- parseSlide: (slideXml3, slidePath) => this.parseSlide(slideXml3, slidePath),
85825
+ // `maxShapes`: each slide's own elements are counted as soon as they are
85826
+ // parsed, before that slide's media is resolved and before the next slide.
85827
+ parseSlide: async (slideXml3, slidePath) => {
85828
+ const elements2 = await this.parseSlide(slideXml3, slidePath);
85829
+ this.loadedShapeCount = countPptxShapesWithinLimits(
85830
+ this.loadedShapeCount,
85831
+ elements2,
85832
+ this.loadLimits
85833
+ );
85834
+ return elements2;
85835
+ },
85497
85836
  extractMediaTimingMap: (slideXml3, slidePath) => this.extractMediaTimingMap(slideXml3, slidePath),
85498
85837
  enrichMediaElementsWithTiming: (elements2, timingMap) => this.enrichMediaElementsWithTiming(elements2, timingMap),
85499
85838
  enrichOleElementsWithEmbeddedData: (elements2, slidePath) => this.enrichOleElementsWithEmbeddedData(elements2, slidePath),
@@ -85730,21 +86069,31 @@ var PptxHandlerRuntime101 = class extends PptxHandlerRuntime100 {
85730
86069
  try {
85731
86070
  await this.initializeLoadSession(data, options);
85732
86071
  reader = this.beginPartReads();
85733
- await this.detectAndPreserveVbaProject();
85734
- this.detectDigitalSignatureParts();
85735
- await this.parseCustomXmlParts();
85736
- const presentationState = await this.loadPresentationState();
85737
- const slideMasters = await this.parseSlideMasters();
85738
- await this.enrichSlideMastersWithTxStyles(slideMasters);
85739
- const slides = await this.loadSlidesForPresentation(presentationState.sectionBySlideId);
85740
- const slidesWithWarnings = this.attachSlideWarnings(slides);
85741
- this.resetElementIdCounter(slides);
85742
- recordSlideFingerprints(this.savedSlideFingerprints, slidesWithWarnings);
85743
- return await this.buildLoadData(presentationState, slidesWithWarnings, slideMasters);
86072
+ try {
86073
+ return await this.loadInitializedSession();
86074
+ } catch (error) {
86075
+ if (error instanceof PptxLoadLimitError) {
86076
+ this.dispose();
86077
+ }
86078
+ throw error;
86079
+ }
85744
86080
  } finally {
85745
86081
  this.endPartReads(reader);
85746
86082
  }
85747
86083
  }
86084
+ async loadInitializedSession() {
86085
+ await this.detectAndPreserveVbaProject();
86086
+ this.detectDigitalSignatureParts();
86087
+ await this.parseCustomXmlParts();
86088
+ const presentationState = await this.loadPresentationState();
86089
+ const slideMasters = await this.parseSlideMasters();
86090
+ await this.enrichSlideMastersWithTxStyles(slideMasters);
86091
+ const slides = await this.loadSlidesForPresentation(presentationState.sectionBySlideId);
86092
+ const slidesWithWarnings = this.attachSlideWarnings(slides);
86093
+ this.resetElementIdCounter(slides);
86094
+ recordSlideFingerprints(this.savedSlideFingerprints, slidesWithWarnings);
86095
+ return this.buildLoadData(presentationState, slidesWithWarnings, slideMasters);
86096
+ }
85748
86097
  /**
85749
86098
  * Retrieve the current background colour for a layout or master.
85750
86099
  */
@@ -87178,24 +87527,24 @@ function parseStyleTextPropAtom(view, dataOffset, dataLen, textLength, scheme) {
87178
87527
  const charRuns = [];
87179
87528
  let covered = 0;
87180
87529
  while (covered < total && c.canRead(6)) {
87181
- const count = c.u32();
87530
+ const count2 = c.u32();
87182
87531
  const indentLevel = c.u16();
87183
- const props = { count, indentLevel };
87532
+ const props = { count: count2, indentLevel };
87184
87533
  if (!parsePfException(c, scheme, props)) {
87185
87534
  break;
87186
87535
  }
87187
87536
  paragraphRuns.push(props);
87188
- covered += count;
87537
+ covered += count2;
87189
87538
  }
87190
87539
  covered = 0;
87191
87540
  while (covered < total && c.canRead(8)) {
87192
- const count = c.u32();
87193
- const props = { count };
87541
+ const count2 = c.u32();
87542
+ const props = { count: count2 };
87194
87543
  if (!parseCfException(c, scheme, props)) {
87195
87544
  break;
87196
87545
  }
87197
87546
  charRuns.push(props);
87198
- covered += count;
87547
+ covered += count2;
87199
87548
  }
87200
87549
  return { paragraphRuns, charRuns };
87201
87550
  }
@@ -88192,13 +88541,13 @@ var OPT2 = {
88192
88541
  function parseProperties2(view, data, rec) {
88193
88542
  const values = /* @__PURE__ */ new Map();
88194
88543
  const complex = /* @__PURE__ */ new Map();
88195
- const count = rec.recInstance;
88196
- const entriesEnd = rec.dataOffset + count * 6;
88544
+ const count2 = rec.recInstance;
88545
+ const entriesEnd = rec.dataOffset + count2 * 6;
88197
88546
  if (entriesEnd > rec.dataOffset + rec.recLen) {
88198
88547
  return { values, complex };
88199
88548
  }
88200
88549
  const complexRefs = [];
88201
- for (let i = 0; i < count; i++) {
88550
+ for (let i = 0; i < count2; i++) {
88202
88551
  const at = rec.dataOffset + i * 6;
88203
88552
  const opid = view.getUint16(at, true);
88204
88553
  const value = view.getUint32(at + 2, true);
@@ -89244,8 +89593,8 @@ function levelXml(tag, level, fallbackSizePt) {
89244
89593
  }
89245
89594
  function styleLevels(levels, fallbackSizePt) {
89246
89595
  const result = [];
89247
- const count = Math.max(1, Math.min(levels.length, 9));
89248
- for (let i = 0; i < count; i++) {
89596
+ const count2 = Math.max(1, Math.min(levels.length, 9));
89597
+ for (let i = 0; i < count2; i++) {
89249
89598
  result.push(levelXml(`lvl${i + 1}pPr`, levels[i] ?? {}, fallbackSizePt));
89250
89599
  }
89251
89600
  return result.join("");
@@ -90073,6 +90422,7 @@ var PptxHandlerCore = class {
90073
90422
  * ```
90074
90423
  */
90075
90424
  async load(data, options = {}) {
90425
+ assertPptxInputWithinLimits(data.byteLength, resolvePptxLoadLimits(options));
90076
90426
  const detection = detectFileFormat(data);
90077
90427
  if (detection.format === "ole") {
90078
90428
  let ole;
@@ -90384,13 +90734,15 @@ var PptxHandler = class extends PptxHandlerCore {
90384
90734
  * archives and portable `pptx-viewer-json` documents.
90385
90735
  *
90386
90736
  * The buffer is sniffed first: JSON documents (leading `{` plus the
90387
- * `"pptx-viewer-json"` format marker) are routed to {@link loadFromJson};
90388
- * everything else goes through the regular ZIP/OLE2 pipeline.
90737
+ * `"pptx-viewer-json"` format marker) are imported as {@link loadFromJson}
90738
+ * does; everything else goes through the regular ZIP/OLE2 pipeline.
90389
90739
  */
90390
90740
  async load(data, options = {}) {
90741
+ const limits = resolvePptxLoadLimits(options);
90742
+ assertPptxInputWithinLimits(data.byteLength, limits);
90391
90743
  const jsonText = decodePptxJsonText(data);
90392
90744
  if (jsonText !== null) {
90393
- return this.loadFromJson(jsonText, options);
90745
+ return this.importJson(jsonText, options, limits);
90394
90746
  }
90395
90747
  return super.load(data, options);
90396
90748
  }
@@ -90401,9 +90753,26 @@ var PptxHandler = class extends PptxHandlerCore {
90401
90753
  * handler keeps a valid in-memory archive (editing and {@link save} keep
90402
90754
  * working), then the imported model is overlaid on top: imported
90403
90755
  * presentation fields win, and the slide array is replaced wholesale.
90756
+ *
90757
+ * `options.limits` applies as it does for {@link load}: `maxInputBytes` to
90758
+ * the UTF-8 size of `text` (checked before it is parsed), and `maxSlides`
90759
+ * and `maxShapes` to the document's slides with the same counting rule as
90760
+ * a `.pptx` package (layout and master elements are not counted).
90404
90761
  */
90405
90762
  async loadFromJson(text, options = {}) {
90406
- const imported = deserializePptxFromJson(text);
90763
+ const limits = resolvePptxLoadLimits(options);
90764
+ assertPptxTextWithinLimits(text, limits);
90765
+ return this.importJson(text, options, limits);
90766
+ }
90767
+ async importJson(text, options, limits) {
90768
+ const document2 = parsePptxJson(text);
90769
+ assertPptxSlideCountWithinLimits(document2.slides.length, limits);
90770
+ let shapes = 0;
90771
+ for (const slide of document2.slides) {
90772
+ const elements2 = Array.isArray(slide.elements) ? slide.elements : [];
90773
+ shapes = countPptxShapesWithinLimits(shapes, elements2, limits);
90774
+ }
90775
+ const imported = pptxDataFromJsonDocument(document2);
90407
90776
  const blankBytes = await buildBlankPresentationArchive({
90408
90777
  width: imported.widthEmu,
90409
90778
  height: imported.heightEmu,
@@ -90411,7 +90780,7 @@ var PptxHandler = class extends PptxHandlerCore {
90411
90780
  // the overlaid model, so the archive must carry the value itself.
90412
90781
  firstSlideNumber: imported.firstSlideNumber
90413
90782
  });
90414
- const base = await super.load(blankBytes, options);
90783
+ const base = await super.load(blankBytes, { ...options, limits: void 0 });
90415
90784
  return applyImportedPptxData(base, imported);
90416
90785
  }
90417
90786
  };
@@ -91841,13 +92210,13 @@ function layoutRelsXml(masterIndex = 1) {
91841
92210
  </Relationships>`;
91842
92211
  }
91843
92212
  function countExistingLayouts(zip) {
91844
- let count = 0;
92213
+ let count2 = 0;
91845
92214
  zip.forEach((relativePath) => {
91846
92215
  if (/^ppt\/slideLayouts\/slideLayout\d+\.xml$/.test(relativePath)) {
91847
- count++;
92216
+ count2++;
91848
92217
  }
91849
92218
  });
91850
- return count;
92219
+ return count2;
91851
92220
  }
91852
92221
  async function addLayoutToSlideMaster(zip, layoutIndex, masterIndex = 1) {
91853
92222
  const masterRelsPath = `ppt/slideMasters/_rels/slideMaster${masterIndex}.xml.rels`;
@@ -92449,4 +92818,4 @@ var PresentationBuilder = class {
92449
92818
  * `<p:extLst>` (optional)
92450
92819
  */
92451
92820
 
92452
- export { AFTER_ANIMATION_VALUES, ConnectorXmlFactory, DEFAULT_AFTER_ANIMATION_DIM_COLOR, DEFAULT_ANIMATION_DURATION_MS, DEFAULT_ANIMATION_TRIGGER, DEFAULT_POWERPOINT_TABLE_STYLE_ID, ELEMENT_PARAGRAPH_GEOMETRY_KEYS, EncryptedPptError, MediaGraphicFrameXmlFactory, OOXML_TO_PRESET_EMPH, OOXML_TO_PRESET_ENTR, OOXML_TO_PRESET_EXIT, PRESET_TO_OOXML, PictureXmlFactory, PptxAnimationWriteService, PptxColorStyleCodec, PptxCommentAuthorsXmlFactory, PptxCommentXmlFactoryProvider, PptxCompatibilityService, PptxConnectorParser, PptxContentTypesBuilder, PptxDocumentPropertiesUpdater, PptxEditorAnimationService, PptxElementTransformUpdater, PptxElementXmlBuilder, PptxGraphicFrameParser, PptxHandler, PptxHandlerRuntime107 as PptxHandlerRuntime, PptxHandlerRuntimeFactory, PptxLoadDataBuilder, PptxMediaDataParser, PptxNativeAnimationService, PptxPresentationSaveBuilder, PptxPresentationSlidesReconciler, PptxRuntimeDependencyFactory, PptxSaveConstantsFactory, PptxSaveState, PptxSaveStateBuilder, PptxShapeIdValidator, PptxShapeStyleExtractor, PptxSlideBackgroundBuilder, PptxSlideBuilder, PptxSlideCommentPartWriter, PptxSlideCommentsXmlFactory, PptxSlideElementsBuilder, PptxSlideLoaderService, PptxSlideMediaRelationshipBuilder, PptxSlideNotesBuilder, PptxSlideNotesPartUpdater, PptxSlideRelationshipRegistry, PptxSlideTransitionService, PptxTableDataParser, PptxTemplateBackgroundService, PptxXmlBuilder, PptxXmlFactoryProvider, PptxXmlLookupService, PresentationBuilder, STANDARD_LAYOUTS, SlideBuilder, TABLE_STYLE_PART_SEQUENCE, TextShapeXmlFactory, addChartCategory, addChartSeries, addLayoutContentType, addLayoutToSlideMaster, addTableStyleToMap, animationFor, applyAfterAnimationBehavior, applyAfterAnimationFromEditorList, applyChartGroupOptionsInput, applyConnectorShapeIds, applySoundToEffectCTn, applySpeedToDuration, applyTableCellTextAndStyle, assertChartGradientSupported, breakAutoNumberRun, buildBlankPresentationArchive, buildRelationshipsXml, buildSingleEffectNode, buildSlideReferenceRemap, capturedPresetIds, capturedPresetNativeAnimation, capturedSubtypes, chartFormatTargetKey, clonePartGraph, convertPptToPptx, countExistingLayouts, createAutoNumberSequence, createChartElement, createConnectorElement, createDefaultPptxHandlerRuntime, createFreeformElement, createGroupElement, createImageElement, createLayout, createLayouts, createMediaElement, createPptxSaveConstants, createShapeElement, createTableCellXml, createTableElement, createTableGraphicFrameRawXml, createTableStyleEntry, createTextElement, deleteTableStyleFromMap, ensureChartData, ensureDataPoint, extractAfterAnimationFromSubTnLst, extractGraphicBuilds, extractTableCellTextRuns, findLayoutByName, findLayoutByType, generateLayoutXml, generateTableStyleGuid, getAfterAnimation, getAfterAnimationState, getCapturedPreset, getCapturedTree, hasAnimation, isEncryptedLegacyPpt, isLegacyPpt, isLineDrawnChartType, isNativeAfterAnimationOnly, layoutRelsXml, mergeNativeAfterAnimationIntoEditorAnimations, mergeNativeSoundIntoEditorAnimations, nextAutoNumber, nextRelationshipId, normalizeTableStyleGuid, ooxmlToPresetName, parseAnimEffectFilter, parseChartFormatTargetKey, parseCondition, parseConditionList, parseFilterToken, parseRelationships, parseTimeTargetElement, rebuildTableStructureInRawXml, reconcileAnimationTargets, relationshipsPartFor, relativePartTarget, remapEditorAnimationsToShapeIds, removeChartCategory, removeChartSeries, removeEmptyDataPoint, resetIdCounter, resolveConnectorShapeIds, resolveDirectionSubtype, resolveEffectTiming, resolveIterationCount, resolveOoxmlPresetMapping, resolveOpacitySet, resolvePartPath, resolveTableBackgroundFillRef, resolveTableStyleLineRef, resolveTableStyleLineRefColor, resolveVisibilitySetTiming, serializeCondition, serializeConditionList, serializeGraphicBuild, serializeTimeTargetElement, setAfterAnimation, setAfterAnimationColor, setChartAreaFormat, setChartAxis2 as setChartAxis, setChartAxisGridlineStyle, setChartAxisLogScale, setChartAxisTitleStyle, setChartCategories2 as setChartCategories, setChartDataLabels, setChartDataPointExplosion, setChartDataPointFill, setChartDataPointLabel, setChartDataPointMarker, setChartGroupOptions, setChartGrouping, setChartLegend2 as setChartLegend, setChartSeriesChartType, setChartSeriesColor, setChartSeriesErrorBars, setChartSeriesMarker, setChartSeriesTrendline, setChartTitle2 as setChartTitle, setChartType, shouldHoldEndState, timingCurveToAccelDecel, toChartGradientFill, updateCellTextInRawXml, updateCellTextStyleInRawXml, updateChartDataPoint, updateChartSeriesValues, updateMergeAttrsInRawXml, upsert, validateSeriesIndex };
92821
+ export { AFTER_ANIMATION_VALUES, ConnectorXmlFactory, DEFAULT_AFTER_ANIMATION_DIM_COLOR, DEFAULT_ANIMATION_DURATION_MS, DEFAULT_ANIMATION_TRIGGER, DEFAULT_POWERPOINT_TABLE_STYLE_ID, DEFAULT_PPTX_LOAD_LIMITS, ELEMENT_PARAGRAPH_GEOMETRY_KEYS, EncryptedPptError, MediaGraphicFrameXmlFactory, OOXML_TO_PRESET_EMPH, OOXML_TO_PRESET_ENTR, OOXML_TO_PRESET_EXIT, PRESET_TO_OOXML, PictureXmlFactory, PptxAnimationWriteService, PptxColorStyleCodec, PptxCommentAuthorsXmlFactory, PptxCommentXmlFactoryProvider, PptxCompatibilityService, PptxConnectorParser, PptxContentTypesBuilder, PptxDocumentPropertiesUpdater, PptxEditorAnimationService, PptxElementTransformUpdater, PptxElementXmlBuilder, PptxGraphicFrameParser, PptxHandler, PptxHandlerRuntime107 as PptxHandlerRuntime, PptxHandlerRuntimeFactory, PptxLoadDataBuilder, PptxLoadLimitError, PptxMediaDataParser, PptxNativeAnimationService, PptxPresentationSaveBuilder, PptxPresentationSlidesReconciler, PptxRuntimeDependencyFactory, PptxSaveConstantsFactory, PptxSaveState, PptxSaveStateBuilder, PptxShapeIdValidator, PptxShapeStyleExtractor, PptxSlideBackgroundBuilder, PptxSlideBuilder, PptxSlideCommentPartWriter, PptxSlideCommentsXmlFactory, PptxSlideElementsBuilder, PptxSlideLoaderService, PptxSlideMediaRelationshipBuilder, PptxSlideNotesBuilder, PptxSlideNotesPartUpdater, PptxSlideRelationshipRegistry, PptxSlideTransitionService, PptxTableDataParser, PptxTemplateBackgroundService, PptxXmlBuilder, PptxXmlFactoryProvider, PptxXmlLookupService, PresentationBuilder, STANDARD_LAYOUTS, SlideBuilder, TABLE_STYLE_PART_SEQUENCE, TextShapeXmlFactory, addChartCategory, addChartSeries, addLayoutContentType, addLayoutToSlideMaster, addTableStyleToMap, animationFor, applyAfterAnimationBehavior, applyAfterAnimationFromEditorList, applyChartGroupOptionsInput, applyConnectorShapeIds, applySoundToEffectCTn, applySpeedToDuration, applyTableCellTextAndStyle, assertChartGradientSupported, breakAutoNumberRun, buildBlankPresentationArchive, buildRelationshipsXml, buildSingleEffectNode, buildSlideReferenceRemap, capturedPresetIds, capturedPresetNativeAnimation, capturedSubtypes, chartFormatTargetKey, clonePartGraph, convertPptToPptx, countExistingLayouts, createAutoNumberSequence, createChartElement, createConnectorElement, createDefaultPptxHandlerRuntime, createFreeformElement, createGroupElement, createImageElement, createLayout, createLayouts, createMediaElement, createPptxSaveConstants, createShapeElement, createTableCellXml, createTableElement, createTableGraphicFrameRawXml, createTableStyleEntry, createTextElement, deleteTableStyleFromMap, ensureChartData, ensureDataPoint, extractAfterAnimationFromSubTnLst, extractGraphicBuilds, extractTableCellTextRuns, findLayoutByName, findLayoutByType, generateLayoutXml, generateTableStyleGuid, getAfterAnimation, getAfterAnimationState, getCapturedPreset, getCapturedTree, getPptxLoadLimitViolation, hasAnimation, isEncryptedLegacyPpt, isLegacyPpt, isLineDrawnChartType, isNativeAfterAnimationOnly, layoutRelsXml, mergeNativeAfterAnimationIntoEditorAnimations, mergeNativeSoundIntoEditorAnimations, nextAutoNumber, nextRelationshipId, normalizeTableStyleGuid, ooxmlToPresetName, parseAnimEffectFilter, parseChartFormatTargetKey, parseCondition, parseConditionList, parseFilterToken, parseRelationships, parseTimeTargetElement, rebuildTableStructureInRawXml, reconcileAnimationTargets, relationshipsPartFor, relativePartTarget, remapEditorAnimationsToShapeIds, removeChartCategory, removeChartSeries, removeEmptyDataPoint, resetIdCounter, resolveConnectorShapeIds, resolveDirectionSubtype, resolveEffectTiming, resolveIterationCount, resolveOoxmlPresetMapping, resolveOpacitySet, resolvePartPath, resolveTableBackgroundFillRef, resolveTableStyleLineRef, resolveTableStyleLineRefColor, resolveVisibilitySetTiming, serializeCondition, serializeConditionList, serializeGraphicBuild, serializeTimeTargetElement, setAfterAnimation, setAfterAnimationColor, setChartAreaFormat, setChartAxis2 as setChartAxis, setChartAxisGridlineStyle, setChartAxisLogScale, setChartAxisTitleStyle, setChartCategories2 as setChartCategories, setChartDataLabels, setChartDataPointExplosion, setChartDataPointFill, setChartDataPointLabel, setChartDataPointMarker, setChartGroupOptions, setChartGrouping, setChartLegend2 as setChartLegend, setChartSeriesChartType, setChartSeriesColor, setChartSeriesErrorBars, setChartSeriesMarker, setChartSeriesTrendline, setChartTitle2 as setChartTitle, setChartType, shouldHoldEndState, timingCurveToAccelDecel, toChartGradientFill, updateCellTextInRawXml, updateCellTextStyleInRawXml, updateChartDataPoint, updateChartSeriesValues, updateMergeAttrsInRawXml, upsert, validateSeriesIndex };