ooxml-core 1.25.2 → 1.26.1

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 (103) hide show
  1. package/README.md +16 -0
  2. package/dist/{PptxHandler-AUK27AQD.mjs → PptxHandler-64BZOBWX.mjs} +3 -3
  3. package/dist/{PptxHandler-QBGEZDCO.cjs → PptxHandler-AILFLRH7.cjs} +3 -3
  4. package/dist/PptxHandler-PMLQGMFQ.mjs +4 -0
  5. package/dist/{PresentationBuilder-RX7D75GZ.mjs → PresentationBuilder-EJY2TYWL.mjs} +2 -2
  6. package/dist/{PresentationBuilder-MEETJGEA.mjs → PresentationBuilder-HBCCO2CF.mjs} +3 -3
  7. package/dist/{PresentationBuilder-CI45KEHL.cjs → PresentationBuilder-RBQP6A37.cjs} +5 -5
  8. package/dist/automation/index.cjs +273 -156
  9. package/dist/automation/index.mjs +273 -156
  10. package/dist/automation/xlsx-read.d.ts +2 -8
  11. package/dist/automation/xlsx-read.d.ts.map +1 -1
  12. package/dist/automation/xlsx.d.ts +2 -2
  13. package/dist/chart/index.cjs +89 -47
  14. package/dist/chart/index.mjs +89 -47
  15. package/dist/{chunk-6DHZZD5R.mjs → chunk-2XMK5SXU.mjs} +106 -48
  16. package/dist/{chunk-VGDHSED6.mjs → chunk-DHAZSMC7.mjs} +1 -1
  17. package/dist/{chunk-TX2QFS3J.mjs → chunk-FZBAMWCJ.mjs} +788 -542
  18. package/dist/{chunk-E2PYQQQV.mjs → chunk-JJ37PCNR.mjs} +89 -47
  19. package/dist/{chunk-S5TGOEQX.cjs → chunk-MU3XSASV.cjs} +106 -47
  20. package/dist/{chunk-GMETZZ3V.cjs → chunk-NXTHB2M3.cjs} +1857 -1611
  21. package/dist/{chunk-HVRFRYYS.mjs → chunk-OQPT5IC3.mjs} +5 -5
  22. package/dist/{chunk-5F7OB7PA.mjs → chunk-OTXJVFMY.mjs} +785 -539
  23. package/dist/{chunk-635WPRNJ.mjs → chunk-R7RL7W43.mjs} +19 -3
  24. package/dist/{chunk-E3PRAHL6.mjs → chunk-WRFMS5CL.mjs} +1 -1
  25. package/dist/docx/embedded.cjs +89 -47
  26. package/dist/docx/embedded.mjs +89 -47
  27. package/dist/docx/index.cjs +89 -47
  28. package/dist/docx/index.mjs +89 -47
  29. package/dist/docx/load/index.cjs +89 -47
  30. package/dist/docx/load/index.mjs +89 -47
  31. package/dist/index.cjs +128 -53
  32. package/dist/index.mjs +128 -53
  33. package/dist/opc/index.cjs +90 -47
  34. package/dist/opc/index.mjs +90 -48
  35. package/dist/opc/zip-limits.d.ts +6 -0
  36. package/dist/opc/zip-limits.d.ts.map +1 -1
  37. package/dist/pptx/automation/index.cjs +954 -622
  38. package/dist/pptx/automation/index.d.ts +4 -4
  39. package/dist/pptx/automation/index.mjs +6 -6
  40. package/dist/pptx/chunks/{index-DCbp5fOs.d.ts → index-CbFowkp4.d.ts} +12 -5
  41. package/dist/pptx/chunks/{index-DCbp5fOs.d.ts.map → index-CbFowkp4.d.ts.map} +1 -1
  42. package/dist/pptx/chunks/{index-CX0RM1fF.d.ts → index-D4FnOx6x.d.ts} +3 -3
  43. package/dist/pptx/chunks/{index-CX0RM1fF.d.ts.map → index-D4FnOx6x.d.ts.map} +1 -1
  44. package/dist/pptx/chunks/{index-CgjEEpfK.d.ts → index-D8DNpc1X.d.ts} +289 -118
  45. package/dist/pptx/chunks/index-D8DNpc1X.d.ts.map +1 -0
  46. package/dist/pptx/chunks/{text-operations-CjalmJIi.d.ts → text-operations-CNfUj45U.d.ts} +16 -2
  47. package/dist/pptx/chunks/{text-operations-CjalmJIi.d.ts.map → text-operations-CNfUj45U.d.ts.map} +1 -1
  48. package/dist/pptx/cli/index.cjs +954 -622
  49. package/dist/pptx/cli/index.d.ts +1 -1
  50. package/dist/pptx/cli/index.mjs +5 -5
  51. package/dist/pptx/converter/index.d.ts +1 -1
  52. package/dist/pptx/converter/index.mjs +3 -3
  53. package/dist/pptx/editor/render/editor-history.cjs +21 -0
  54. package/dist/pptx/editor/render/editor-history.d.ts +9 -0
  55. package/dist/pptx/editor/render/editor-history.d.ts.map +1 -1
  56. package/dist/pptx/editor/render/editor-history.mjs +21 -0
  57. package/dist/pptx/editor/render/find-replace.cjs +14 -14
  58. package/dist/pptx/editor/render/find-replace.d.ts +2 -2
  59. package/dist/pptx/editor/render/find-replace.mjs +1 -1
  60. package/dist/pptx/editor/render/slide-operations.cjs +8 -8
  61. package/dist/pptx/editor/render/slide-operations.mjs +2 -2
  62. package/dist/pptx/index.cjs +953 -620
  63. package/dist/pptx/index.d.ts +5 -5
  64. package/dist/pptx/index.mjs +6 -6
  65. package/dist/pptx/node/index.d.ts +1 -1
  66. package/dist/pptx/signature-node/index.cjs +89 -47
  67. package/dist/pptx/signature-node/index.mjs +2 -2
  68. package/dist/visio/index.cjs +266 -150
  69. package/dist/visio/index.mjs +266 -150
  70. package/dist/visio/ui/index.cjs +266 -150
  71. package/dist/visio/ui/index.mjs +266 -150
  72. package/dist/xlsx/index.cjs +518 -153
  73. package/dist/xlsx/index.mjs +518 -154
  74. package/dist/xlsx/load/index.cjs +266 -150
  75. package/dist/xlsx/load/index.mjs +266 -150
  76. package/dist/xlsx/numfmt/view.d.ts +13 -0
  77. package/dist/xlsx/numfmt/view.d.ts.map +1 -0
  78. package/dist/xlsx/read/index.d.ts +1 -0
  79. package/dist/xlsx/read/index.d.ts.map +1 -1
  80. package/dist/xlsx/read/limits.d.ts +5 -0
  81. package/dist/xlsx/read/limits.d.ts.map +1 -1
  82. package/dist/xlsx/read/package.d.ts +6 -0
  83. package/dist/xlsx/read/package.d.ts.map +1 -1
  84. package/dist/xlsx/read/rows-stream.d.ts +12 -0
  85. package/dist/xlsx/read/rows-stream.d.ts.map +1 -0
  86. package/dist/xlsx/read/rows.d.ts +37 -0
  87. package/dist/xlsx/read/rows.d.ts.map +1 -0
  88. package/dist/xlsx/read/shared-strings.d.ts +6 -1
  89. package/dist/xlsx/read/shared-strings.d.ts.map +1 -1
  90. package/dist/xlsx/read/sheet-data-source.d.ts +30 -3
  91. package/dist/xlsx/read/sheet-data-source.d.ts.map +1 -1
  92. package/dist/xlsx/read/sheet-data.d.ts +13 -2
  93. package/dist/xlsx/read/sheet-data.d.ts.map +1 -1
  94. package/dist/xlsx/read/worksheet.d.ts.map +1 -1
  95. package/dist/xlsx/ui/index.cjs +266 -150
  96. package/dist/xlsx/ui/index.mjs +266 -150
  97. package/dist/xml/index.cjs +38 -6
  98. package/dist/xml/index.mjs +37 -7
  99. package/dist/xml/lite.d.ts +15 -0
  100. package/dist/xml/lite.d.ts.map +1 -1
  101. package/package.json +1 -1
  102. package/dist/PptxHandler-5UO5DD5K.mjs +0 -4
  103. package/dist/pptx/chunks/index-CgjEEpfK.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, 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, 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-635WPRNJ.mjs';
2
- import { openPptxZip, DIGITAL_SIGNATURE_ORIGIN_REL_TYPE, openZip, DEFAULT_MAX_UNCOMPRESSED_BYTES, guardZip, ZipBombError, MAX_ZIP_ENTRY_COUNT } from './chunk-E2PYQQQV.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, 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-R7RL7W43.mjs';
2
+ import { openPptxZip, DIGITAL_SIGNATURE_ORIGIN_REL_TYPE, openZip, DEFAULT_MAX_UNCOMPRESSED_BYTES, guardZip, ZipBombError, MAX_ZIP_ENTRY_COUNT } from './chunk-JJ37PCNR.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';
@@ -35257,6 +35257,36 @@ function applyClrMapOverrideToLayoutRoot(root, override) {
35257
35257
  root["p:clrMapOvr"] = { "a:overrideClrMapping": attrs2 };
35258
35258
  }
35259
35259
 
35260
+ // pptx/core/core/runtime/held-format-schemes.ts
35261
+ var HeldFormatSchemes = class {
35262
+ elements = /* @__PURE__ */ new Map();
35263
+ partsByDeckScheme = /* @__PURE__ */ new Map();
35264
+ /** Keep `element`, which `scheme` was parsed from. */
35265
+ hold(scheme, element) {
35266
+ this.elements.set(formatSchemeKey(scheme), structuredClone(element));
35267
+ }
35268
+ /** The element `scheme` was parsed from, if one was held. */
35269
+ element(scheme) {
35270
+ return this.elements.get(formatSchemeKey(scheme));
35271
+ }
35272
+ /** What each part in `parts` held while the deck's scheme was `deckScheme`. */
35273
+ holdParts(deckScheme, parts) {
35274
+ if (parts.size > 0) {
35275
+ this.partsByDeckScheme.set(partsKey(deckScheme, [...parts.keys()]), new Map(parts));
35276
+ }
35277
+ }
35278
+ /**
35279
+ * The element each of `themePaths` held the last time the deck's scheme was `deckScheme` over
35280
+ * exactly those parts, if known.
35281
+ */
35282
+ parts(deckScheme, themePaths) {
35283
+ return this.partsByDeckScheme.get(partsKey(deckScheme, themePaths));
35284
+ }
35285
+ };
35286
+ function partsKey(deckScheme, themePaths) {
35287
+ return JSON.stringify([formatSchemeKey(deckScheme), [...new Set(themePaths)].sort()]);
35288
+ }
35289
+
35260
35290
  // pptx/core/builders/fluent/PptxXmlBuilder.ts
35261
35291
  var PptxXmlBuilder = class _PptxXmlBuilder {
35262
35292
  /** The presentation data being mutated. */
@@ -49829,6 +49859,152 @@ function applyCommonViewContainer(root, name, props) {
49829
49859
  root[key2] = container;
49830
49860
  }
49831
49861
 
49862
+ // pptx/core/core/runtime/chart-part-registration.ts
49863
+ var CHART_GRAPHIC_DATA_URI = "http://schemas.openxmlformats.org/drawingml/2006/chart";
49864
+ var CHART_EX_GRAPHIC_DATA_URI = "http://schemas.microsoft.com/office/drawing/2014/chartex";
49865
+ var NS_R = "http://schemas.openxmlformats.org/officeDocument/2006/relationships";
49866
+ function asArray3(value) {
49867
+ if (value === void 0 || value === null) {
49868
+ return [];
49869
+ }
49870
+ return (Array.isArray(value) ? value : [value]).filter(
49871
+ (entry2) => Boolean(entry2) && typeof entry2 === "object"
49872
+ );
49873
+ }
49874
+ function nextFreeChartPartPath(zip, directory) {
49875
+ let n = 1;
49876
+ while (zip.file(`${directory}/chart${n}.xml`)) {
49877
+ n += 1;
49878
+ }
49879
+ return `${directory}/chart${n}.xml`;
49880
+ }
49881
+ function resolvePartTarget(fromPart, target) {
49882
+ if (target.startsWith("/")) {
49883
+ return target.slice(1);
49884
+ }
49885
+ const segments = fromPart.split("/").slice(0, -1);
49886
+ for (const segment of target.split("/")) {
49887
+ if (segment === "..") {
49888
+ segments.pop();
49889
+ } else if (segment !== "." && segment !== "") {
49890
+ segments.push(segment);
49891
+ }
49892
+ }
49893
+ return segments.join("/");
49894
+ }
49895
+ function relativePartTarget2(fromPart, toPart) {
49896
+ const from = fromPart.split("/").slice(0, -1);
49897
+ const to = toPart.split("/");
49898
+ let common = 0;
49899
+ while (common < from.length && common < to.length - 1 && from[common] === to[common]) {
49900
+ common += 1;
49901
+ }
49902
+ return [...from.slice(common).map(() => ".."), ...to.slice(common)].join("/");
49903
+ }
49904
+ async function ensureContentTypeOverride2(deps, partPath, contentType) {
49905
+ const xml = await deps.zip.file("[Content_Types].xml")?.async("string");
49906
+ if (!xml) {
49907
+ return;
49908
+ }
49909
+ const tree = deps.parser.parse(xml);
49910
+ const types = tree["Types"] ?? {};
49911
+ const overrides = asArray3(types["Override"]);
49912
+ const partName = `/${partPath}`;
49913
+ if (overrides.some((entry2) => String(entry2["@_PartName"]) === partName)) {
49914
+ return;
49915
+ }
49916
+ overrides.push({ "@_PartName": partName, "@_ContentType": contentType });
49917
+ types["Override"] = overrides;
49918
+ tree["Types"] = types;
49919
+ deps.zip.file("[Content_Types].xml", deps.builder.build(tree));
49920
+ }
49921
+ async function rewriteChartRelationship(deps, slidePath, rewrite) {
49922
+ const slash = slidePath.lastIndexOf("/");
49923
+ const relsPath2 = `${slidePath.slice(0, slash + 1)}_rels/${slidePath.slice(slash + 1)}.rels`;
49924
+ const xml = await deps.zip.file(relsPath2)?.async("string");
49925
+ if (!xml) {
49926
+ return void 0;
49927
+ }
49928
+ const tree = deps.parser.parse(xml);
49929
+ const root = tree["Relationships"];
49930
+ const relationships2 = asArray3(root?.["Relationship"]);
49931
+ const match = relationships2.find((rel) => String(rel["@_Id"]) === rewrite.relationshipId) ?? relationships2.find(
49932
+ (rel) => resolvePartTarget(slidePath, String(rel["@_Target"] ?? "")) === rewrite.oldPartPath
49933
+ );
49934
+ if (!match || !root) {
49935
+ return void 0;
49936
+ }
49937
+ match["@_Type"] = rewrite.relationshipType;
49938
+ match["@_Target"] = relativePartTarget2(slidePath, rewrite.newPartPath);
49939
+ delete match["@_TargetMode"];
49940
+ root["Relationship"] = relationships2.length === 1 ? relationships2[0] : relationships2;
49941
+ deps.zip.file(relsPath2, deps.builder.build(tree));
49942
+ return String(match["@_Id"]);
49943
+ }
49944
+ function rebindGraphicData(node, relationshipId, extended) {
49945
+ for (const key2 of Object.keys(node)) {
49946
+ delete node[key2];
49947
+ }
49948
+ node["@_uri"] = extended ? CHART_EX_GRAPHIC_DATA_URI : CHART_GRAPHIC_DATA_URI;
49949
+ if (extended) {
49950
+ node["cx:chart"] = {
49951
+ "@_xmlns:cx": CHART_EX_GRAPHIC_DATA_URI,
49952
+ "@_xmlns:r": NS_R,
49953
+ "@_r:id": relationshipId
49954
+ };
49955
+ } else {
49956
+ node["c:chart"] = {
49957
+ "@_xmlns:c": CHART_GRAPHIC_DATA_URI,
49958
+ "@_xmlns:r": NS_R,
49959
+ "@_r:id": relationshipId
49960
+ };
49961
+ }
49962
+ }
49963
+ function visitGraphicData(node, relationshipId, extended, getLocalName2) {
49964
+ if (!node || typeof node !== "object") {
49965
+ return 0;
49966
+ }
49967
+ if (Array.isArray(node)) {
49968
+ return node.reduce(
49969
+ (count2, entry2) => count2 + visitGraphicData(entry2, relationshipId, extended, getLocalName2),
49970
+ 0
49971
+ );
49972
+ }
49973
+ const object = node;
49974
+ let count = 0;
49975
+ for (const key2 of Object.keys(object)) {
49976
+ if (key2.startsWith("@_")) {
49977
+ continue;
49978
+ }
49979
+ const value = object[key2];
49980
+ if (getLocalName2(key2) === "graphicData" && value && typeof value === "object") {
49981
+ for (const candidate of asArray3(value)) {
49982
+ const chartKey = Object.keys(candidate).find((k) => getLocalName2(k) === "chart");
49983
+ const chart = chartKey ? candidate[chartKey] : void 0;
49984
+ if (chart && String(chart["@_r:id"]) === relationshipId) {
49985
+ rebindGraphicData(candidate, relationshipId, extended);
49986
+ count += 1;
49987
+ }
49988
+ }
49989
+ continue;
49990
+ }
49991
+ count += visitGraphicData(value, relationshipId, extended, getLocalName2);
49992
+ }
49993
+ return count;
49994
+ }
49995
+ async function rewriteChartGraphicFrames(deps, slidePath, relationshipId, extended) {
49996
+ const xml = await deps.zip.file(slidePath)?.async("string");
49997
+ if (!xml) {
49998
+ return 0;
49999
+ }
50000
+ const tree = deps.parser.parse(xml);
50001
+ const count = visitGraphicData(tree, relationshipId, extended, deps.getLocalName);
50002
+ if (count > 0) {
50003
+ deps.zip.file(slidePath, deps.builder.build(tree));
50004
+ }
50005
+ return count;
50006
+ }
50007
+
49832
50008
  // pptx/core/utils/chart-color-style-writer.ts
49833
50009
  var METHODS = /* @__PURE__ */ new Set(["cycle", "withinLinear", "acrossLinear"]);
49834
50010
  var COLOR_NAMES = /* @__PURE__ */ new Set(["scrgbClr", "srgbClr", "hslClr", "sysClr", "schemeClr", "prstClr"]);
@@ -49898,7 +50074,7 @@ function buildChartExLegend(legendPosition) {
49898
50074
  // pptx/core/utils/chart-cx-generator.ts
49899
50075
  var NS_CX = "http://schemas.microsoft.com/office/drawing/2014/chartex";
49900
50076
  var NS_A = "http://schemas.openxmlformats.org/drawingml/2006/main";
49901
- var NS_R = "http://schemas.openxmlformats.org/officeDocument/2006/relationships";
50077
+ var NS_R2 = "http://schemas.openxmlformats.org/officeDocument/2006/relationships";
49902
50078
  var NS_C = "http://schemas.openxmlformats.org/drawingml/2006/chart";
49903
50079
  function points4(values) {
49904
50080
  return values.map((value, index) => ({ "@_idx": String(index), "#text": String(value) }));
@@ -50093,7 +50269,7 @@ function buildChartExSpaceXml(chartData) {
50093
50269
  const chartSpace = {
50094
50270
  "@_xmlns:cx": NS_CX,
50095
50271
  "@_xmlns:a": NS_A,
50096
- "@_xmlns:r": NS_R,
50272
+ "@_xmlns:r": NS_R2,
50097
50273
  "cx:chartData": {
50098
50274
  "cx:data": chartData.series.map(
50099
50275
  (series, index) => buildChartExData(chartData, series, index)
@@ -51656,7 +51832,7 @@ function buildGeneratedSeriesSpPr(series, family) {
51656
51832
  // pptx/core/utils/chart-xml-generator.ts
51657
51833
  var NS_C2 = "http://schemas.openxmlformats.org/drawingml/2006/chart";
51658
51834
  var NS_A2 = "http://schemas.openxmlformats.org/drawingml/2006/main";
51659
- var NS_R2 = "http://schemas.openxmlformats.org/officeDocument/2006/relationships";
51835
+ var NS_R3 = "http://schemas.openxmlformats.org/officeDocument/2006/relationships";
51660
51836
  var CAT_AX_ID = 111111111;
51661
51837
  var VAL_AX_ID = 222222222;
51662
51838
  var SER_AX_ID = 333333333;
@@ -51862,7 +52038,7 @@ function buildChartSpaceXml(chartData) {
51862
52038
  "c:chartSpace": {
51863
52039
  "@_xmlns:c": NS_C2,
51864
52040
  "@_xmlns:a": NS_A2,
51865
- "@_xmlns:r": NS_R2,
52041
+ "@_xmlns:r": NS_R3,
51866
52042
  "c:chart": chart
51867
52043
  }
51868
52044
  };
@@ -53911,7 +54087,7 @@ function buildTitleDefRPr(style, existing, resolveColor2) {
53911
54087
  }
53912
54088
  return rPr;
53913
54089
  }
53914
- function asArray3(value) {
54090
+ function asArray4(value) {
53915
54091
  if (Array.isArray(value)) {
53916
54092
  return value;
53917
54093
  }
@@ -53930,7 +54106,7 @@ function applyRichTitleFont(title, style, getLocalName2, resolveColor2) {
53930
54106
  return txKey;
53931
54107
  }
53932
54108
  const pKey = findKey19(rich, "p", getLocalName2) ?? "a:p";
53933
- const paragraphs = asArray3(rich[pKey]).map((para) => {
54109
+ const paragraphs = asArray4(rich[pKey]).map((para) => {
53934
54110
  const next = { ...para };
53935
54111
  const pPrKey = findKey19(next, "pPr", getLocalName2) ?? "a:pPr";
53936
54112
  const pPr = { ...ensureXmlChildOrCreate(next, pPrKey, "first") };
@@ -53943,7 +54119,7 @@ function applyRichTitleFont(title, style, getLocalName2, resolveColor2) {
53943
54119
  next[pPrKey] = pPr;
53944
54120
  const rKey = findKey19(next, "r", getLocalName2);
53945
54121
  if (rKey) {
53946
- const runs = asArray3(next[rKey]).map((run2) => {
54122
+ const runs = asArray4(next[rKey]).map((run2) => {
53947
54123
  const rPrKey = findKey19(run2, "rPr", getLocalName2) ?? "a:rPr";
53948
54124
  const existingRPr = run2[rPrKey] ?? {};
53949
54125
  const nextRun = { ...run2 };
@@ -54307,7 +54483,7 @@ function saveChartPartThroughNeutral(xml, before, after) {
54307
54483
  function findKey20(node, localName15, getLocalName2) {
54308
54484
  return Object.keys(node).find((key2) => getLocalName2(key2) === localName15);
54309
54485
  }
54310
- function asArray4(value) {
54486
+ function asArray5(value) {
54311
54487
  if (value === void 0 || value === null) {
54312
54488
  return [];
54313
54489
  }
@@ -54321,8 +54497,8 @@ function dimensionType(node) {
54321
54497
  function replaceLevels(target, source, getLocalName2) {
54322
54498
  const targetKey = findKey20(target, "lvl", getLocalName2) ?? "cx:lvl";
54323
54499
  const sourceKey = findKey20(source, "lvl", getLocalName2);
54324
- const oldLevels = asArray4(target[targetKey]);
54325
- const newLevels = asArray4(sourceKey ? source[sourceKey] : void 0).map((level, index) => {
54500
+ const oldLevels = asArray5(target[targetKey]);
54501
+ const newLevels = asArray5(sourceKey ? source[sourceKey] : void 0).map((level, index) => {
54326
54502
  const old = oldLevels[index];
54327
54503
  if (!old) {
54328
54504
  return level;
@@ -54341,8 +54517,8 @@ function replaceChartExDataDimensions(target, fresh, getLocalName2) {
54341
54517
  for (const kind of ["strDim", "numDim"]) {
54342
54518
  const targetKey = findKey20(target, kind, getLocalName2) ?? `cx:${kind}`;
54343
54519
  const freshKey = findKey20(fresh, kind, getLocalName2);
54344
- const existing = asArray4(target[targetKey]);
54345
- const incoming = asArray4(freshKey ? fresh[freshKey] : void 0);
54520
+ const existing = asArray5(target[targetKey]);
54521
+ const incoming = asArray5(freshKey ? fresh[freshKey] : void 0);
54346
54522
  for (const dimension of incoming) {
54347
54523
  const wantedType = dimensionType(dimension);
54348
54524
  let match = existing.find((candidate) => dimensionType(candidate) === wantedType);
@@ -54376,7 +54552,7 @@ function child13(node, localName15, getLocalName2) {
54376
54552
  const value = key2 ? node[key2] : void 0;
54377
54553
  return value && typeof value === "object" && !Array.isArray(value) ? value : void 0;
54378
54554
  }
54379
- function asArray5(value) {
54555
+ function asArray6(value) {
54380
54556
  if (value === void 0 || value === null) {
54381
54557
  return [];
54382
54558
  }
@@ -54558,7 +54734,7 @@ function chartExLayoutChanged(chartSpace, chartData, getLocalName2) {
54558
54734
  getLocalName2
54559
54735
  );
54560
54736
  const seriesKey = region ? findKey21(region, "series", getLocalName2) : void 0;
54561
- const first2 = region && seriesKey ? asArray5(region[seriesKey])[0] : void 0;
54737
+ const first2 = region && seriesKey ? asArray6(region[seriesKey])[0] : void 0;
54562
54738
  const existing = String(first2?.["@_layoutId"] ?? "").toLowerCase();
54563
54739
  const series = chartData.series[0];
54564
54740
  if (!existing || !series) {
@@ -54576,9 +54752,9 @@ function applyChartExUpdate(chartSpace, chartData, getLocalName2) {
54576
54752
  const chartDataKey = findKey21(chartSpace, "chartData", getLocalName2);
54577
54753
  const chartDataNode = (chartDataKey ? chartSpace[chartDataKey] : void 0) ?? {};
54578
54754
  const dataKey = findKey21(chartDataNode, "data", getLocalName2) ?? "cx:data";
54579
- const dataNodes = asArray5(chartDataNode[dataKey]);
54755
+ const dataNodes = asArray6(chartDataNode[dataKey]);
54580
54756
  const seriesKey = findKey21(region, "series", getLocalName2) ?? "cx:series";
54581
- const existing = asArray5(region[seriesKey]);
54757
+ const existing = asArray6(region[seriesKey]);
54582
54758
  const updated = [];
54583
54759
  chartData.series.forEach((series, index) => {
54584
54760
  const node = existing[index];
@@ -54648,152 +54824,6 @@ async function saveChartExternalWorkbookUpdates(deps, chartPartPath, slidePath,
54648
54824
  );
54649
54825
  }
54650
54826
 
54651
- // pptx/core/core/runtime/chart-part-registration.ts
54652
- var CHART_GRAPHIC_DATA_URI = "http://schemas.openxmlformats.org/drawingml/2006/chart";
54653
- var CHART_EX_GRAPHIC_DATA_URI = "http://schemas.microsoft.com/office/drawing/2014/chartex";
54654
- var NS_R3 = "http://schemas.openxmlformats.org/officeDocument/2006/relationships";
54655
- function asArray6(value) {
54656
- if (value === void 0 || value === null) {
54657
- return [];
54658
- }
54659
- return (Array.isArray(value) ? value : [value]).filter(
54660
- (entry2) => Boolean(entry2) && typeof entry2 === "object"
54661
- );
54662
- }
54663
- function nextFreeChartPartPath(zip, directory) {
54664
- let n = 1;
54665
- while (zip.file(`${directory}/chart${n}.xml`)) {
54666
- n += 1;
54667
- }
54668
- return `${directory}/chart${n}.xml`;
54669
- }
54670
- function resolvePartTarget(fromPart, target) {
54671
- if (target.startsWith("/")) {
54672
- return target.slice(1);
54673
- }
54674
- const segments = fromPart.split("/").slice(0, -1);
54675
- for (const segment of target.split("/")) {
54676
- if (segment === "..") {
54677
- segments.pop();
54678
- } else if (segment !== "." && segment !== "") {
54679
- segments.push(segment);
54680
- }
54681
- }
54682
- return segments.join("/");
54683
- }
54684
- function relativePartTarget2(fromPart, toPart) {
54685
- const from = fromPart.split("/").slice(0, -1);
54686
- const to = toPart.split("/");
54687
- let common = 0;
54688
- while (common < from.length && common < to.length - 1 && from[common] === to[common]) {
54689
- common += 1;
54690
- }
54691
- return [...from.slice(common).map(() => ".."), ...to.slice(common)].join("/");
54692
- }
54693
- async function ensureContentTypeOverride2(deps, partPath, contentType) {
54694
- const xml = await deps.zip.file("[Content_Types].xml")?.async("string");
54695
- if (!xml) {
54696
- return;
54697
- }
54698
- const tree = deps.parser.parse(xml);
54699
- const types = tree["Types"] ?? {};
54700
- const overrides = asArray6(types["Override"]);
54701
- const partName = `/${partPath}`;
54702
- if (overrides.some((entry2) => String(entry2["@_PartName"]) === partName)) {
54703
- return;
54704
- }
54705
- overrides.push({ "@_PartName": partName, "@_ContentType": contentType });
54706
- types["Override"] = overrides;
54707
- tree["Types"] = types;
54708
- deps.zip.file("[Content_Types].xml", deps.builder.build(tree));
54709
- }
54710
- async function rewriteChartRelationship(deps, slidePath, rewrite) {
54711
- const slash = slidePath.lastIndexOf("/");
54712
- const relsPath2 = `${slidePath.slice(0, slash + 1)}_rels/${slidePath.slice(slash + 1)}.rels`;
54713
- const xml = await deps.zip.file(relsPath2)?.async("string");
54714
- if (!xml) {
54715
- return void 0;
54716
- }
54717
- const tree = deps.parser.parse(xml);
54718
- const root = tree["Relationships"];
54719
- const relationships2 = asArray6(root?.["Relationship"]);
54720
- const match = relationships2.find((rel) => String(rel["@_Id"]) === rewrite.relationshipId) ?? relationships2.find(
54721
- (rel) => resolvePartTarget(slidePath, String(rel["@_Target"] ?? "")) === rewrite.oldPartPath
54722
- );
54723
- if (!match || !root) {
54724
- return void 0;
54725
- }
54726
- match["@_Type"] = rewrite.relationshipType;
54727
- match["@_Target"] = relativePartTarget2(slidePath, rewrite.newPartPath);
54728
- delete match["@_TargetMode"];
54729
- root["Relationship"] = relationships2.length === 1 ? relationships2[0] : relationships2;
54730
- deps.zip.file(relsPath2, deps.builder.build(tree));
54731
- return String(match["@_Id"]);
54732
- }
54733
- function rebindGraphicData(node, relationshipId, extended) {
54734
- for (const key2 of Object.keys(node)) {
54735
- delete node[key2];
54736
- }
54737
- node["@_uri"] = extended ? CHART_EX_GRAPHIC_DATA_URI : CHART_GRAPHIC_DATA_URI;
54738
- if (extended) {
54739
- node["cx:chart"] = {
54740
- "@_xmlns:cx": CHART_EX_GRAPHIC_DATA_URI,
54741
- "@_xmlns:r": NS_R3,
54742
- "@_r:id": relationshipId
54743
- };
54744
- } else {
54745
- node["c:chart"] = {
54746
- "@_xmlns:c": CHART_GRAPHIC_DATA_URI,
54747
- "@_xmlns:r": NS_R3,
54748
- "@_r:id": relationshipId
54749
- };
54750
- }
54751
- }
54752
- function visitGraphicData(node, relationshipId, extended, getLocalName2) {
54753
- if (!node || typeof node !== "object") {
54754
- return 0;
54755
- }
54756
- if (Array.isArray(node)) {
54757
- return node.reduce(
54758
- (count2, entry2) => count2 + visitGraphicData(entry2, relationshipId, extended, getLocalName2),
54759
- 0
54760
- );
54761
- }
54762
- const object = node;
54763
- let count = 0;
54764
- for (const key2 of Object.keys(object)) {
54765
- if (key2.startsWith("@_")) {
54766
- continue;
54767
- }
54768
- const value = object[key2];
54769
- if (getLocalName2(key2) === "graphicData" && value && typeof value === "object") {
54770
- for (const candidate of asArray6(value)) {
54771
- const chartKey = Object.keys(candidate).find((k) => getLocalName2(k) === "chart");
54772
- const chart = chartKey ? candidate[chartKey] : void 0;
54773
- if (chart && String(chart["@_r:id"]) === relationshipId) {
54774
- rebindGraphicData(candidate, relationshipId, extended);
54775
- count += 1;
54776
- }
54777
- }
54778
- continue;
54779
- }
54780
- count += visitGraphicData(value, relationshipId, extended, getLocalName2);
54781
- }
54782
- return count;
54783
- }
54784
- async function rewriteChartGraphicFrames(deps, slidePath, relationshipId, extended) {
54785
- const xml = await deps.zip.file(slidePath)?.async("string");
54786
- if (!xml) {
54787
- return 0;
54788
- }
54789
- const tree = deps.parser.parse(xml);
54790
- const count = visitGraphicData(tree, relationshipId, extended, deps.getLocalName);
54791
- if (count > 0) {
54792
- deps.zip.file(slidePath, deps.builder.build(tree));
54793
- }
54794
- return count;
54795
- }
54796
-
54797
54827
  // pptx/core/core/runtime/chart-part-family-switch.ts
54798
54828
  var CHART_EX_CONTENT_TYPE = "application/vnd.ms-office.chartex+xml";
54799
54829
  var CHART_CONTENT_TYPE = "application/vnd.openxmlformats-officedocument.drawingml.chart+xml";
@@ -57701,18 +57731,22 @@ var PptxHandlerRuntime3 = class extends PptxHandlerRuntime2 {
57701
57731
  * Write or remove a single `a:hlinkClick` / `a:hlinkHover` node on
57702
57732
  * a `p:cNvPr` parent.
57703
57733
  */
57704
- serializeSingleAction(cNvPr, nodeName, action, resolveHyperlinkRelationshipId) {
57734
+ serializeSingleAction(cNvPr, nodeName, action, links) {
57705
57735
  if (!action) {
57706
57736
  delete cNvPr[nodeName];
57707
57737
  return;
57708
57738
  }
57709
57739
  const node = {};
57740
+ const url = action.url?.trim() || (/^ppaction:\/\/hlinksldjump\b/iu.test(action.action ?? "") && typeof action.targetSlideIndex === "number" ? links.slideTargetAt?.(action.targetSlideIndex) : void 0);
57710
57741
  let rId = action.rId;
57711
- if (!rId && action.url) {
57742
+ if (rId && url && links.getSlideRelationshipMap().get(rId) !== url) {
57743
+ rId = void 0;
57744
+ }
57745
+ if (!rId && url) {
57712
57746
  const forceExternal = /^ppaction:\/\/(program|hlinkfile|hlinkpres)\b/iu.test(
57713
57747
  action.action ?? ""
57714
57748
  );
57715
- rId = resolveHyperlinkRelationshipId(action.url, forceExternal) ?? void 0;
57749
+ rId = links.resolveHyperlinkRelationshipId(url, forceExternal) ?? void 0;
57716
57750
  }
57717
57751
  node["@_r:id"] = rId ?? "";
57718
57752
  if (action.action) {
@@ -57786,7 +57820,7 @@ var PptxHandlerRuntime3 = class extends PptxHandlerRuntime2 {
57786
57820
  * the `a:hlinkClick` and `a:hlinkHover` nodes on the element's
57787
57821
  * non-visual properties.
57788
57822
  */
57789
- serializeElementActions(shape, el, resolveHyperlinkRelationshipId) {
57823
+ serializeElementActions(shape, el, links) {
57790
57824
  const key2 = this.getTreeBucketKeyForElementType(el.type);
57791
57825
  const cNvPr = this.getCnvPrNode(shape, key2);
57792
57826
  if (!cNvPr) {
@@ -57794,8 +57828,8 @@ var PptxHandlerRuntime3 = class extends PptxHandlerRuntime2 {
57794
57828
  }
57795
57829
  const actionClick = "actionClick" in el ? el.actionClick : void 0;
57796
57830
  const actionHover = "actionHover" in el ? el.actionHover : void 0;
57797
- this.serializeSingleAction(cNvPr, "a:hlinkClick", actionClick, resolveHyperlinkRelationshipId);
57798
- this.serializeSingleAction(cNvPr, "a:hlinkHover", actionHover, resolveHyperlinkRelationshipId);
57831
+ this.serializeSingleAction(cNvPr, "a:hlinkClick", actionClick, links);
57832
+ this.serializeSingleAction(cNvPr, "a:hlinkHover", actionHover, links);
57799
57833
  const isDecorative = "isDecorative" in el ? el.isDecorative : void 0;
57800
57834
  serializeDecorativeExtension(cNvPr, isDecorative);
57801
57835
  }
@@ -58646,6 +58680,11 @@ var PptxHandlerRuntime8 = class extends PptxHandlerRuntime7 {
58646
58680
  const upSegments = Array.from({ length: fromParts.length }).fill("..");
58647
58681
  return [...upSegments, ...toParts].join("/");
58648
58682
  }
58683
+ /**
58684
+ * Point a slide master's theme relationship at `themePath`.
58685
+ *
58686
+ * @returns whether the master had a theme relationship to rewrite
58687
+ */
58649
58688
  async setMasterThemeRelationship(masterPath, themePath) {
58650
58689
  const relsPath2 = masterPath.replace(
58651
58690
  /ppt\/slideMasters\/(slideMaster\d+)\.xml/,
@@ -58653,7 +58692,7 @@ var PptxHandlerRuntime8 = class extends PptxHandlerRuntime7 {
58653
58692
  );
58654
58693
  const relsFile = this.zip.file(relsPath2);
58655
58694
  if (!relsFile) {
58656
- return;
58695
+ return false;
58657
58696
  }
58658
58697
  const relsXml = await relsFile.async("string");
58659
58698
  const relsData = this.parser.parse(relsXml);
@@ -58661,28 +58700,13 @@ var PptxHandlerRuntime8 = class extends PptxHandlerRuntime7 {
58661
58700
  const relationships2 = this.ensureArray(relRoot["Relationship"]);
58662
58701
  const themeRel = relationships2.find((rel) => String(rel["@_Type"] || "").includes("/theme"));
58663
58702
  if (!themeRel) {
58664
- return;
58703
+ return false;
58665
58704
  }
58666
58705
  themeRel["@_Target"] = this.buildRelativeTargetPath(masterPath, themePath);
58667
58706
  relRoot["Relationship"] = relationships2;
58668
58707
  relsData["Relationships"] = relRoot;
58669
58708
  this.zip.file(relsPath2, this.builder.build(relsData));
58670
- }
58671
- async setPresentationTheme(themePath, applyToAllMasters = true) {
58672
- const normalizedThemePath = themePath.trim().replace(/\\/g, "/");
58673
- if (!normalizedThemePath.startsWith("ppt/theme/")) {
58674
- return;
58675
- }
58676
- const masterFiles = this.zip.file(/^ppt\/slideMasters\/slideMaster\d+\.xml$/);
58677
- if (!masterFiles || masterFiles.length === 0) {
58678
- return;
58679
- }
58680
- const targetMasters = applyToAllMasters ? masterFiles : [masterFiles[0]];
58681
- await Promise.all(
58682
- targetMasters.map(async (masterFile) => {
58683
- await this.setMasterThemeRelationship(masterFile.name, normalizedThemePath);
58684
- })
58685
- );
58709
+ return true;
58686
58710
  }
58687
58711
  /** The text of a package part, or `undefined` when the package has no such part. */
58688
58712
  async readPartText(path3) {
@@ -58996,8 +59020,6 @@ var PptxHandlerRuntime9 = class _PptxHandlerRuntime extends PptxHandlerRuntime8
58996
59020
  this.masterXmlMap.set(path3, data);
58997
59021
  }
58998
59022
  const masterCSldName = (xmlAttr(sldMaster["p:cSld"], "name") ?? "").trim();
58999
- const bg = sldMaster["p:cSld"]?.["p:bg"];
59000
- const backgroundColor = this.parseBackgroundColor(bg);
59001
59023
  const spTree = sldMaster["p:cSld"]?.["p:spTree"];
59002
59024
  const placeholders = this.extractPlaceholderList(spTree);
59003
59025
  let preserve;
@@ -59051,7 +59073,6 @@ var PptxHandlerRuntime9 = class _PptxHandlerRuntime extends PptxHandlerRuntime8
59051
59073
  results.push({
59052
59074
  path: path3,
59053
59075
  name: masterCSldName.length > 0 ? masterCSldName : void 0,
59054
- backgroundColor,
59055
59076
  themePath,
59056
59077
  layoutPaths: layoutPaths.length > 0 ? layoutPaths : void 0,
59057
59078
  layouts: layouts.length > 0 ? layouts : void 0,
@@ -59189,11 +59210,6 @@ var PptxHandlerRuntime9 = class _PptxHandlerRuntime extends PptxHandlerRuntime8
59189
59210
  layout.clrMapOverride = overrideMap;
59190
59211
  }
59191
59212
  }
59192
- const bg = xmlPath(sldLayout, "p:cSld", "p:bg");
59193
- const bgColor = this.parseBackgroundColor(bg);
59194
- if (bgColor) {
59195
- layout.backgroundColor = bgColor;
59196
- }
59197
59213
  const spTree = xmlPath(sldLayout, "p:cSld", "p:spTree");
59198
59214
  const placeholders = this.extractPlaceholderList(spTree);
59199
59215
  if (placeholders.length > 0) {
@@ -70742,7 +70758,7 @@ var PptxHandlerRuntime41 = class _PptxHandlerRuntime extends PptxHandlerRuntime4
70742
70758
  if (ctx.connectorShapeIds) {
70743
70759
  applyConnectorShapeIds(shape, el, ctx.connectorShapeIds);
70744
70760
  }
70745
- this.serializeElementActions(shape, el, ctx.resolveHyperlinkRelationshipId);
70761
+ this.serializeElementActions(shape, el, ctx);
70746
70762
  this.serializeShapeLocks(shape, el);
70747
70763
  this.applyHiddenToCnvPr(shape, el);
70748
70764
  this.applyNameToCnvPr(shape, el);
@@ -71783,7 +71799,7 @@ var PptxHandlerRuntime42 = class _PptxHandlerRuntime extends PptxHandlerRuntime4
71783
71799
  * Process a single slide during save: update slide XML, process elements,
71784
71800
  * rebuild shape tree, and persist relationships.
71785
71801
  */
71786
- async processSlideForSave(slide, saveSession, constants) {
71802
+ async processSlideForSave(slide, saveSession, constants, slidePaths = []) {
71787
71803
  if (this.canSkipSlideSave(slide)) {
71788
71804
  return;
71789
71805
  }
@@ -71968,6 +71984,10 @@ var PptxHandlerRuntime42 = class _PptxHandlerRuntime extends PptxHandlerRuntime4
71968
71984
  slideRelationshipRegistry,
71969
71985
  resolveHyperlinkRelationshipId: (target, forceExternal) => slideRelationshipRegistry.resolveHyperlinkRelationshipId(target, forceExternal),
71970
71986
  getSlideRelationshipMap: () => slideRelationshipRegistry.toRelationshipMap(),
71987
+ slideTargetAt: (index) => {
71988
+ const target = slidePaths[index];
71989
+ return target ? relativePartTarget2(slide.id, target) : void 0;
71990
+ },
71971
71991
  resolvedMediaBytes,
71972
71992
  saveSession,
71973
71993
  slideImageRelationshipType: constants.slideImageRelationshipType,
@@ -74126,7 +74146,23 @@ var PptxHandlerRuntime54 = class _PptxHandlerRuntime extends PptxHandlerRuntime5
74126
74146
  }
74127
74147
  return this.isStrictOoxml ? "strict" : "transitional";
74128
74148
  }
74149
+ /** The save running now, or the last one: see {@link save}. */
74150
+ saveQueue = Promise.resolve();
74151
+ /**
74152
+ * Saves run one at a time. A save rewrites `this.zip` in place across many awaits and moves
74153
+ * per-part baselines (slide fingerprints, chart data, pending chart updates) while it runs, so
74154
+ * a second save that starts mid-way (a viewer's autosave snapshot firing during the user's own
74155
+ * save) read half-written state: it skipped the slide as unchanged and wrote the chart part's
74156
+ * original XML back over the edit, in both outputs. Each save now waits for the one before it;
74157
+ * one that fails does not hold up the next.
74158
+ */
74129
74159
  async save(slides, options) {
74160
+ const run2 = this.saveQueue.then(() => this.saveNow(slides, options));
74161
+ this.saveQueue = run2.catch(() => void 0);
74162
+ return run2;
74163
+ }
74164
+ /** One save, with the package to itself; callers go through {@link save}. */
74165
+ async saveNow(slides, options) {
74130
74166
  validateSlideGeometry(slides);
74131
74167
  const templates = [
74132
74168
  ...options?.slideMasters ?? [],
@@ -74144,7 +74180,7 @@ var PptxHandlerRuntime54 = class _PptxHandlerRuntime extends PptxHandlerRuntime5
74144
74180
  return this.saveAsLegacyPpt(
74145
74181
  slides,
74146
74182
  options,
74147
- () => this.save(slides, {
74183
+ () => this.saveNow(slides, {
74148
74184
  ...options,
74149
74185
  pptPassword: void 0,
74150
74186
  outputFormat: "pptx",
@@ -74176,8 +74212,9 @@ var PptxHandlerRuntime54 = class _PptxHandlerRuntime extends PptxHandlerRuntime5
74176
74212
  await this.ensureNotesMasterForAuthoredNotes(slides, saveConstants);
74177
74213
  await this.ensureHandoutMasterInfrastructure(options?.handoutMaster, saveConstants);
74178
74214
  this.templateElementBaselines.beginSave();
74215
+ const slidePaths = slides.map((slide) => slide.id);
74179
74216
  for (const slide of slides) {
74180
- await this.processSlideForSave(slide, saveSession, saveConstants);
74217
+ await this.processSlideForSave(slide, saveSession, saveConstants, slidePaths);
74181
74218
  }
74182
74219
  this.templateElementBaselines.commitSave();
74183
74220
  const contentTypesXml3 = await this.zip.file("[Content_Types].xml")?.async("string");
@@ -78945,6 +78982,25 @@ var PptxHandlerRuntime73 = class extends PptxHandlerRuntime72 {
78945
78982
  }
78946
78983
  return void 0;
78947
78984
  }
78985
+ /**
78986
+ * The colour a slide master or layout paints from its own `p:bg`, resolved exactly as a
78987
+ * slide's background is: through the active master's colour map and format scheme, with
78988
+ * `clrMapOverride` (a layout's `p:clrMapOvr`, or `null`) taking precedence. The caller makes
78989
+ * the part's master active first; a master's `bgRef` on `bg1` means `dk1` under a dark
78990
+ * `p:clrMap`, which no other state can tell.
78991
+ */
78992
+ extractTemplateBackgroundColor(partXml, rootTag, clrMapOverride) {
78993
+ if (!partXml) {
78994
+ return void 0;
78995
+ }
78996
+ const previousOverride = this.currentSlideClrMapOverride;
78997
+ this.currentSlideClrMapOverride = clrMapOverride;
78998
+ try {
78999
+ return this.extractBackgroundColor(partXml, rootTag);
79000
+ } finally {
79001
+ this.currentSlideClrMapOverride = previousOverride;
79002
+ }
79003
+ }
78948
79004
  /**
78949
79005
  * Composite a resolved background colour with its `a:alpha` (or
78950
79006
  * `a:alphaMod`/`a:alphaOff`) opacity onto opaque white.
@@ -79502,6 +79558,31 @@ var PptxHandlerRuntime74 = class extends PptxHandlerRuntime73 {
79502
79558
  const masterFormatScheme = this.masterThemeFormatSchemes.get(masterPath);
79503
79559
  this.themeFormatScheme = masterFormatScheme ?? this.globalThemeFormatSchemeSnapshot;
79504
79560
  }
79561
+ /**
79562
+ * Run `work` with one master's theme state active and no slide colour-map override, then
79563
+ * put back whatever state was active before, so a part parsed on request (a layout preview)
79564
+ * resolves through its own master without disturbing the caller's.
79565
+ */
79566
+ async withMasterThemeState(masterPath, work) {
79567
+ const saved = {
79568
+ colors: this.themeColorMap,
79569
+ fonts: this.themeFontMap,
79570
+ format: this.themeFormatScheme,
79571
+ clrMap: this.currentMasterClrMap,
79572
+ slideClrMap: this.currentSlideClrMapOverride
79573
+ };
79574
+ this.applyMasterThemeState(masterPath);
79575
+ this.currentSlideClrMapOverride = null;
79576
+ try {
79577
+ return await work();
79578
+ } finally {
79579
+ this.themeColorMap = saved.colors;
79580
+ this.themeFontMap = saved.fonts;
79581
+ this.themeFormatScheme = saved.format;
79582
+ this.currentMasterClrMap = saved.clrMap;
79583
+ this.currentSlideClrMapOverride = saved.slideClrMap;
79584
+ }
79585
+ }
79505
79586
  /**
79506
79587
  * Extract the `p:bg/@showAnimation` flag from a slide's XML.
79507
79588
  * Returns `true` when the background should animate, `false` when
@@ -80380,18 +80461,33 @@ var PptxHandlerRuntime78 = class extends PptxHandlerRuntime77 {
80380
80461
  this.rememberUnparsedMasterNodes(partPath, spTree, part.elements);
80381
80462
  }
80382
80463
  /**
80383
- * Populate `elements` on every slide master and on each of its layouts.
80464
+ * Resolve the background of every slide master and of each of its layouts,
80465
+ * and populate their `elements`.
80384
80466
  *
80385
- * Scheme colours on a master's own shapes must resolve through that
80386
- * master's colour map and theme, so the active master state is switched
80387
- * per part and reset to the deck-wide snapshot afterwards.
80467
+ * Scheme colours on a master, its own `p:bgRef` included, must resolve
80468
+ * through that master's colour map and theme, so the active master state is
80469
+ * switched per part and reset to the deck-wide snapshot afterwards.
80388
80470
  */
80389
80471
  async enrichSlideMasterElements(masters) {
80390
80472
  for (const master of masters) {
80391
80473
  try {
80392
80474
  this.applyMasterThemeState(master.path);
80475
+ master.backgroundColor = this.extractTemplateBackgroundColor(
80476
+ this.masterXmlMap.get(master.path),
80477
+ "p:sldMaster",
80478
+ null
80479
+ );
80393
80480
  await this.enrichMasterPartElements(master, "p:sldMaster");
80394
80481
  for (const layout of master.layouts ?? []) {
80482
+ const layoutXml3 = this.layoutXmlMap.get(layout.path);
80483
+ const backgroundColor = this.extractTemplateBackgroundColor(
80484
+ layoutXml3,
80485
+ "p:sldLayout",
80486
+ layoutXml3 ? this.parseLayoutClrMapOverride(layoutXml3) : null
80487
+ );
80488
+ if (backgroundColor) {
80489
+ layout.backgroundColor = backgroundColor;
80490
+ }
80395
80491
  await this.enrichMasterPartElements(layout, "p:sldLayout");
80396
80492
  }
80397
80493
  } catch (e) {
@@ -80645,20 +80741,23 @@ var PptxHandlerRuntime80 = class extends PptxHandlerRuntime79 {
80645
80741
  this.layoutCache.delete(layoutPath);
80646
80742
  this.eagerDecodeImages = true;
80647
80743
  }
80648
- let elements2;
80744
+ const masterPath = this.resolveMasterPathForLayout(layoutPath);
80745
+ let parsed;
80649
80746
  try {
80650
- elements2 = await this.getLayoutElementsByPath(layoutPath);
80747
+ parsed = await this.withMasterThemeState(masterPath, async () => ({
80748
+ elements: await this.getLayoutElementsByPath(layoutPath),
80749
+ background: this.resolveLayoutPreviewBackground(layoutXml3, masterPath)
80750
+ }));
80651
80751
  } finally {
80652
80752
  this.eagerDecodeImages = previousEagerDecode;
80653
80753
  }
80654
80754
  const cSld = xmlPath(layoutXml3, "p:sldLayout", "p:cSld");
80655
- const background = this.resolveLayoutPreviewBackground(layoutPath, cSld);
80656
80755
  const preview = {
80657
80756
  path: layoutPath,
80658
80757
  width: this.rawSlideWidthEmu / EMU_PER_PX,
80659
80758
  height: this.rawSlideHeightEmu / EMU_PER_PX,
80660
- ...background,
80661
- elements: elements2,
80759
+ ...parsed.background,
80760
+ elements: parsed.elements,
80662
80761
  placeholders: this.extractPlaceholderList(xmlChild(cSld, "p:spTree"))
80663
80762
  };
80664
80763
  this.layoutPreviewCache.set(layoutPath, preview);
@@ -80694,19 +80793,18 @@ var PptxHandlerRuntime80 = class extends PptxHandlerRuntime79 {
80694
80793
  }
80695
80794
  /**
80696
80795
  * Resolve the background a layout thumbnail should paint, falling back to
80697
- * the layout's master when the layout itself declares none.
80796
+ * the layout's master when the layout itself declares none. Runs with the
80797
+ * master active; the layout's own colour map override applies to an
80798
+ * inherited background too, as a slide's does.
80698
80799
  */
80699
- resolveLayoutPreviewBackground(layoutPath, cSld) {
80700
- const ownBackground = this.parseBackgroundColor(xmlChild(cSld, "p:bg"));
80701
- if (ownBackground) {
80702
- return { backgroundColor: ownBackground };
80703
- }
80704
- const masterPath = this.resolveMasterPathForLayout(layoutPath);
80705
- const masterXml = masterPath ? this.masterXmlMap.get(masterPath) : void 0;
80706
- const masterBackground = this.parseBackgroundColor(
80707
- xmlChild(xmlPath(masterXml, "p:sldMaster", "p:cSld"), "p:bg")
80800
+ resolveLayoutPreviewBackground(layoutXml3, masterPath) {
80801
+ const clrMapOverride = this.parseLayoutClrMapOverride(layoutXml3);
80802
+ const backgroundColor = this.extractTemplateBackgroundColor(layoutXml3, "p:sldLayout", clrMapOverride) ?? this.extractTemplateBackgroundColor(
80803
+ masterPath ? this.masterXmlMap.get(masterPath) : void 0,
80804
+ "p:sldMaster",
80805
+ clrMapOverride
80708
80806
  );
80709
- return masterBackground ? { backgroundColor: masterBackground } : {};
80807
+ return backgroundColor ? { backgroundColor } : {};
80710
80808
  }
80711
80809
  };
80712
80810
 
@@ -81492,11 +81590,275 @@ var PptxHandlerRuntime83 = class extends PptxHandlerRuntime82 {
81492
81590
  }
81493
81591
  };
81494
81592
 
81593
+ // pptx/core/core/runtime/theme-scheme-edit.ts
81594
+ var THEME_COLOR_SCHEME_KEYS = [
81595
+ "dk1",
81596
+ "lt1",
81597
+ "dk2",
81598
+ "lt2",
81599
+ "accent1",
81600
+ "accent2",
81601
+ "accent3",
81602
+ "accent4",
81603
+ "accent5",
81604
+ "accent6",
81605
+ "hlink",
81606
+ "folHlink"
81607
+ ];
81608
+ var DEFAULT_CLR_MAP_ALIASES = {
81609
+ tx1: "dk1",
81610
+ bg1: "lt1",
81611
+ tx2: "dk2",
81612
+ bg2: "lt2"
81613
+ };
81614
+ function normalizeHex2(hex3) {
81615
+ return hex3.replace(/^#/, "").toUpperCase();
81616
+ }
81617
+ function buildSrgbClrNode(hex3) {
81618
+ return { "a:srgbClr": { "@_val": normalizeHex2(hex3) } };
81619
+ }
81620
+ function themeElementsOf(data) {
81621
+ const root = data["a:theme"];
81622
+ return root?.["a:themeElements"];
81623
+ }
81624
+ function applyColorSchemeToThemeXml(data, colorScheme) {
81625
+ const themeElements = themeElementsOf(data);
81626
+ if (!themeElements) {
81627
+ return false;
81628
+ }
81629
+ const clrScheme = themeElements["a:clrScheme"] ?? {};
81630
+ for (const key2 of THEME_COLOR_SCHEME_KEYS) {
81631
+ clrScheme[`a:${key2}`] = buildSrgbClrNode(colorScheme[key2]);
81632
+ }
81633
+ themeElements["a:clrScheme"] = clrScheme;
81634
+ return true;
81635
+ }
81636
+ function applyLatinTypeface(group, latin) {
81637
+ const font = group ?? {};
81638
+ font["a:latin"] = { "@_typeface": latin };
81639
+ if (!font["a:ea"]) {
81640
+ font["a:ea"] = { "@_typeface": "" };
81641
+ }
81642
+ if (!font["a:cs"]) {
81643
+ font["a:cs"] = { "@_typeface": "" };
81644
+ }
81645
+ return font;
81646
+ }
81647
+ function applyFontSchemeToThemeXml(data, fontScheme) {
81648
+ const themeElements = themeElementsOf(data);
81649
+ if (!themeElements) {
81650
+ return false;
81651
+ }
81652
+ const fntScheme = themeElements["a:fontScheme"] ?? {};
81653
+ if (fontScheme.majorFont?.latin) {
81654
+ fntScheme["a:majorFont"] = applyLatinTypeface(
81655
+ fntScheme["a:majorFont"],
81656
+ fontScheme.majorFont.latin
81657
+ );
81658
+ }
81659
+ if (fontScheme.minorFont?.latin) {
81660
+ fntScheme["a:minorFont"] = applyLatinTypeface(
81661
+ fntScheme["a:minorFont"],
81662
+ fontScheme.minorFont.latin
81663
+ );
81664
+ }
81665
+ themeElements["a:fontScheme"] = fntScheme;
81666
+ return true;
81667
+ }
81668
+ function applyColorSchemeToMap(map, colorScheme, clrMap) {
81669
+ for (const key2 of THEME_COLOR_SCHEME_KEYS) {
81670
+ map[key2] = normalizeHex2(colorScheme[key2]);
81671
+ }
81672
+ for (const [alias, defaultTarget] of Object.entries(DEFAULT_CLR_MAP_ALIASES)) {
81673
+ const target = clrMap?.[alias] ?? defaultTarget;
81674
+ const resolved = map[target];
81675
+ if (resolved !== void 0) {
81676
+ map[alias] = resolved;
81677
+ }
81678
+ }
81679
+ }
81680
+ function applyFontSchemeToMap(map, fontScheme) {
81681
+ if (fontScheme.majorFont?.latin) {
81682
+ map["mj-lt"] = fontScheme.majorFont.latin;
81683
+ map["mj-ea"] = fontScheme.majorFont.latin;
81684
+ map["mj-cs"] = fontScheme.majorFont.latin;
81685
+ }
81686
+ if (fontScheme.minorFont?.latin) {
81687
+ map["mn-lt"] = fontScheme.minorFont.latin;
81688
+ map["mn-ea"] = fontScheme.minorFont.latin;
81689
+ map["mn-cs"] = fontScheme.minorFont.latin;
81690
+ }
81691
+ }
81692
+
81693
+ // pptx/core/core/runtime/theme-part-model.ts
81694
+ function colorSchemeFromMap(colorMap) {
81695
+ const scheme = {};
81696
+ for (const key2 of THEME_COLOR_SCHEME_KEYS) {
81697
+ scheme[key2] = colorMap[key2] || "";
81698
+ }
81699
+ return scheme;
81700
+ }
81701
+ function fontGroup(fontMap, prefix, byScript) {
81702
+ const latin = fontMap[`${prefix}-lt`];
81703
+ const eastAsia = fontMap[`${prefix}-ea`];
81704
+ const complexScript = fontMap[`${prefix}-cs`];
81705
+ return {
81706
+ ...latin ? { latin } : {},
81707
+ ...eastAsia ? { eastAsia } : {},
81708
+ ...complexScript ? { complexScript } : {},
81709
+ ...Object.keys(byScript).length > 0 ? { byScript: { ...byScript } } : {}
81710
+ };
81711
+ }
81712
+ function fontSchemeFromMap(fontMap, majorByScript, minorByScript) {
81713
+ return {
81714
+ majorFont: fontGroup(fontMap, "mj", majorByScript),
81715
+ minorFont: fontGroup(fontMap, "mn", minorByScript)
81716
+ };
81717
+ }
81718
+
81719
+ // pptx/core/core/runtime/PptxHandlerRuntimeThemePartModel.ts
81720
+ var FONT_SLOTS = [
81721
+ ["mj", "a:majorFont"],
81722
+ ["mn", "a:minorFont"]
81723
+ ];
81724
+ var PptxHandlerRuntime84 = class extends PptxHandlerRuntime83 {
81725
+ /** Parse one theme part's XML. Side-effect free. */
81726
+ parseThemePartXml(themeXml3) {
81727
+ const themeData = this.parser.parse(themeXml3);
81728
+ const themeRoot = themeData["a:theme"];
81729
+ const themeElements = themeRoot?.["a:themeElements"];
81730
+ const colorScheme = themeElements?.["a:clrScheme"];
81731
+ const fontScheme = themeElements?.["a:fontScheme"];
81732
+ const fmtScheme = themeElements?.["a:fmtScheme"];
81733
+ const text = (value) => String(value || "").trim() || void 0;
81734
+ const colorMap = { ...this.getDefaultSchemeColorMap() };
81735
+ for (const key2 of THEME_COLOR_SCHEME_KEYS) {
81736
+ const parsed = this.parseColorChoice(colorScheme?.[`a:${key2}`]);
81737
+ if (parsed) {
81738
+ colorMap[key2] = parsed;
81739
+ }
81740
+ }
81741
+ const fontMap = {};
81742
+ const typeface = (node) => this.normalizeTypefaceToken(String(node?.["@_typeface"] || ""));
81743
+ for (const [prefix, tag] of FONT_SLOTS) {
81744
+ const group = fontScheme?.[tag];
81745
+ const latin = typeface(group?.["a:latin"]);
81746
+ if (latin) {
81747
+ fontMap[`${prefix}-lt`] = latin;
81748
+ fontMap[`${prefix}-ea`] = latin;
81749
+ fontMap[`${prefix}-cs`] = latin;
81750
+ }
81751
+ const eastAsia = typeface(group?.["a:ea"]);
81752
+ if (eastAsia) {
81753
+ fontMap[`${prefix}-ea`] = eastAsia;
81754
+ }
81755
+ const complexScript = typeface(group?.["a:cs"]);
81756
+ if (complexScript) {
81757
+ fontMap[`${prefix}-cs`] = complexScript;
81758
+ }
81759
+ }
81760
+ const objectDefaultsNode = themeRoot?.["a:objectDefaults"];
81761
+ const objectDefaults = objectDefaultsNode && {
81762
+ spDef: objectDefaultsNode["a:spDef"],
81763
+ lnDef: objectDefaultsNode["a:lnDef"],
81764
+ txDef: objectDefaultsNode["a:txDef"]
81765
+ };
81766
+ const hasObjectDefaults = objectDefaults !== void 0 && (objectDefaults.spDef !== void 0 || objectDefaults.lnDef !== void 0 || objectDefaults.txDef !== void 0);
81767
+ return {
81768
+ name: text(themeRoot?.["@_name"]),
81769
+ colorSchemeName: text(colorScheme?.["@_name"]),
81770
+ fontSchemeName: text(fontScheme?.["@_name"]),
81771
+ colorMap,
81772
+ fontMap,
81773
+ // Per-script fonts (`<a:font script="Hans|Hant|Arab|...">`): M4.
81774
+ majorFontScripts: this.collectFontScriptOverrides(
81775
+ fontScheme?.["a:majorFont"]
81776
+ ),
81777
+ minorFontScripts: this.collectFontScriptOverrides(
81778
+ fontScheme?.["a:minorFont"]
81779
+ ),
81780
+ // objectDefaults: M5.
81781
+ objectDefaults: hasObjectDefaults ? objectDefaults : void 0,
81782
+ extraClrSchemeLst: themeRoot?.["a:extraClrSchemeLst"],
81783
+ custClrLst: themeRoot?.["a:custClrLst"],
81784
+ extLst: themeRoot?.["a:extLst"],
81785
+ formatScheme: fmtScheme ? this.parseFormatScheme(fmtScheme) : void 0
81786
+ };
81787
+ }
81788
+ /**
81789
+ * Record a parsed part under its path: its original XML (byte-stable passthrough on save,
81790
+ * C-H3), its names, per-script fonts and the raw subtrees the save re-emits.
81791
+ */
81792
+ cacheThemePartModel(themePath, themeXml3, model) {
81793
+ this.originalThemeXmlByPath.set(themePath, themeXml3);
81794
+ const keyed = [
81795
+ [this.masterThemeNames, model.name],
81796
+ [this.masterThemeColorSchemeNames, model.colorSchemeName],
81797
+ [this.masterThemeFontSchemeNames, model.fontSchemeName],
81798
+ [this.masterThemeObjectDefaults, model.objectDefaults],
81799
+ [this.masterThemeExtraClrSchemeLst, model.extraClrSchemeLst],
81800
+ [this.masterThemeCustClrLst, model.custClrLst],
81801
+ [this.masterThemeExtLst, model.extLst]
81802
+ ];
81803
+ for (const [map, value] of keyed) {
81804
+ if (value !== void 0) {
81805
+ map.set(themePath, value);
81806
+ }
81807
+ }
81808
+ if (Object.keys(model.majorFontScripts).length > 0) {
81809
+ this.masterThemeMajorFontScripts.set(themePath, model.majorFontScripts);
81810
+ }
81811
+ if (Object.keys(model.minorFontScripts).length > 0) {
81812
+ this.masterThemeMinorFontScripts.set(themePath, model.minorFontScripts);
81813
+ }
81814
+ }
81815
+ /**
81816
+ * Parse `<a:font script="..." typeface="..."/>` children of a major or minor font node into a
81817
+ * `script -> typeface` dictionary. fast-xml-parser collapses repeated tags into arrays, so the
81818
+ * array form is walked regardless of how many siblings are present. Phase 4 Stream A / M4.
81819
+ */
81820
+ collectFontScriptOverrides(fontNode) {
81821
+ const overrides = {};
81822
+ if (!fontNode) {
81823
+ return overrides;
81824
+ }
81825
+ const fontEntries = this.ensureArray(fontNode["a:font"]);
81826
+ for (const entry2 of fontEntries) {
81827
+ const script = String(entry2?.["@_script"] || "").trim();
81828
+ const typeface = this.normalizeTypefaceToken(String(entry2?.["@_typeface"] || ""));
81829
+ if (script && typeface) {
81830
+ overrides[script] = typeface;
81831
+ }
81832
+ }
81833
+ return overrides;
81834
+ }
81835
+ /**
81836
+ * The colour, font and format schemes and name of one theme part in the package, as the part holds
81837
+ * them now (a scheme edit already written to it included). Reads only: the loaded theme, the
81838
+ * masters and what a save writes are unchanged. `undefined` when the package has no such part.
81839
+ */
81840
+ async getThemePartSchemes(themePath) {
81841
+ const path3 = themePath.trim().replace(/\\/g, "/");
81842
+ const themeXml3 = await this.zip.file(path3)?.async("string");
81843
+ if (themeXml3 === void 0) {
81844
+ return void 0;
81845
+ }
81846
+ const model = this.parseThemePartXml(themeXml3);
81847
+ return {
81848
+ path: path3,
81849
+ ...model.name ? { name: model.name } : {},
81850
+ colorScheme: colorSchemeFromMap(model.colorMap),
81851
+ fontScheme: fontSchemeFromMap(model.fontMap, model.majorFontScripts, model.minorFontScripts),
81852
+ ...model.formatScheme ? { formatScheme: model.formatScheme } : {}
81853
+ };
81854
+ }
81855
+ };
81856
+
81495
81857
  // pptx/core/core/runtime/PptxHandlerRuntimeThemeLoading.ts
81496
81858
  function isPresentationThemePartPath(path3) {
81497
81859
  return /^ppt\/theme\/(?!themeOverride)[^/]+\.xml$/iu.test(path3);
81498
81860
  }
81499
- var PptxHandlerRuntime84 = class extends PptxHandlerRuntime83 {
81861
+ var PptxHandlerRuntime85 = class extends PptxHandlerRuntime84 {
81500
81862
  async resolvePrimaryThemePath() {
81501
81863
  const masterFiles = this.zip.file(/^ppt\/slideMasters\/slideMaster\d+\.xml$/);
81502
81864
  if (!masterFiles || masterFiles.length === 0) {
@@ -81572,42 +81934,12 @@ var PptxHandlerRuntime84 = class extends PptxHandlerRuntime83 {
81572
81934
  if (!hasColors && !hasFonts) {
81573
81935
  return void 0;
81574
81936
  }
81575
- let colorScheme;
81576
- if (hasColors) {
81577
- colorScheme = {
81578
- dk1: this.themeColorMap["dk1"] || "",
81579
- lt1: this.themeColorMap["lt1"] || "",
81580
- dk2: this.themeColorMap["dk2"] || "",
81581
- lt2: this.themeColorMap["lt2"] || "",
81582
- accent1: this.themeColorMap["accent1"] || "",
81583
- accent2: this.themeColorMap["accent2"] || "",
81584
- accent3: this.themeColorMap["accent3"] || "",
81585
- accent4: this.themeColorMap["accent4"] || "",
81586
- accent5: this.themeColorMap["accent5"] || "",
81587
- accent6: this.themeColorMap["accent6"] || "",
81588
- hlink: this.themeColorMap["hlink"] || "",
81589
- folHlink: this.themeColorMap["folHlink"] || ""
81590
- };
81591
- }
81592
- let fontScheme;
81593
- if (hasFonts) {
81594
- const majorByScript = this.aggregateFontScriptOverrides(this.masterThemeMajorFontScripts);
81595
- const minorByScript = this.aggregateFontScriptOverrides(this.masterThemeMinorFontScripts);
81596
- fontScheme = {
81597
- majorFont: {
81598
- latin: this.themeFontMap["mj-lt"],
81599
- eastAsia: this.themeFontMap["mj-ea"],
81600
- complexScript: this.themeFontMap["mj-cs"],
81601
- ...Object.keys(majorByScript).length > 0 ? { byScript: majorByScript } : {}
81602
- },
81603
- minorFont: {
81604
- latin: this.themeFontMap["mn-lt"],
81605
- eastAsia: this.themeFontMap["mn-ea"],
81606
- complexScript: this.themeFontMap["mn-cs"],
81607
- ...Object.keys(minorByScript).length > 0 ? { byScript: minorByScript } : {}
81608
- }
81609
- };
81610
- }
81937
+ const colorScheme = hasColors ? colorSchemeFromMap(this.themeColorMap) : void 0;
81938
+ const fontScheme = hasFonts ? fontSchemeFromMap(
81939
+ this.themeFontMap,
81940
+ this.aggregateFontScriptOverrides(this.masterThemeMajorFontScripts),
81941
+ this.aggregateFontScriptOverrides(this.masterThemeMinorFontScripts)
81942
+ ) : void 0;
81611
81943
  return {
81612
81944
  colorScheme,
81613
81945
  fontScheme,
@@ -81684,134 +82016,10 @@ var PptxHandlerRuntime84 = class extends PptxHandlerRuntime83 {
81684
82016
  return null;
81685
82017
  }
81686
82018
  const themeXml3 = await themeFile.async("string");
81687
- this.originalThemeXmlByPath.set(themePath, themeXml3);
81688
- const themeData = this.parser.parse(themeXml3);
81689
- const themeRoot = themeData["a:theme"];
81690
- const themeElements = themeRoot?.["a:themeElements"];
81691
- const colorScheme = themeElements?.["a:clrScheme"];
81692
- const fontScheme = themeElements?.["a:fontScheme"];
81693
- const fmtScheme = themeElements?.["a:fmtScheme"];
81694
- const themeName = String(themeRoot?.["@_name"] || "").trim();
81695
- if (themeName) {
81696
- this.masterThemeNames.set(themePath, themeName);
81697
- }
81698
- const colorSchemeName = String(colorScheme?.["@_name"] || "").trim();
81699
- if (colorSchemeName) {
81700
- this.masterThemeColorSchemeNames.set(themePath, colorSchemeName);
81701
- }
81702
- const fontSchemeName = String(fontScheme?.["@_name"] || "").trim();
81703
- if (fontSchemeName) {
81704
- this.masterThemeFontSchemeNames.set(themePath, fontSchemeName);
81705
- }
81706
- const defaultMap = this.getDefaultSchemeColorMap();
81707
- const colorMap = { ...defaultMap };
81708
- if (colorScheme) {
81709
- const schemeKeys = [
81710
- "dk1",
81711
- "lt1",
81712
- "dk2",
81713
- "lt2",
81714
- "accent1",
81715
- "accent2",
81716
- "accent3",
81717
- "accent4",
81718
- "accent5",
81719
- "accent6",
81720
- "hlink",
81721
- "folHlink"
81722
- ];
81723
- for (const key2 of schemeKeys) {
81724
- const colorNode = colorScheme[`a:${key2}`];
81725
- const parsed = this.parseColorChoice(colorNode);
81726
- if (parsed) {
81727
- colorMap[key2] = parsed;
81728
- }
81729
- }
81730
- }
81731
- const majorFontNode = fontScheme?.["a:majorFont"];
81732
- const minorFontNode = fontScheme?.["a:minorFont"];
81733
- const majorLatin = majorFontNode?.["a:latin"];
81734
- const minorLatin = minorFontNode?.["a:latin"];
81735
- const majorFont = this.normalizeTypefaceToken(String(majorLatin?.["@_typeface"] || ""));
81736
- const minorFont = this.normalizeTypefaceToken(String(minorLatin?.["@_typeface"] || ""));
81737
- const fontMap = {};
81738
- if (majorFont) {
81739
- fontMap["mj-lt"] = majorFont;
81740
- fontMap["mj-ea"] = majorFont;
81741
- fontMap["mj-cs"] = majorFont;
81742
- }
81743
- if (minorFont) {
81744
- fontMap["mn-lt"] = minorFont;
81745
- fontMap["mn-ea"] = minorFont;
81746
- fontMap["mn-cs"] = minorFont;
81747
- }
81748
- const majorEa = this.normalizeTypefaceToken(
81749
- String(majorFontNode?.["a:ea"]?.["@_typeface"] || "")
81750
- );
81751
- if (majorEa) {
81752
- fontMap["mj-ea"] = majorEa;
81753
- }
81754
- const majorCs = this.normalizeTypefaceToken(
81755
- String(majorFontNode?.["a:cs"]?.["@_typeface"] || "")
81756
- );
81757
- if (majorCs) {
81758
- fontMap["mj-cs"] = majorCs;
81759
- }
81760
- const minorEa = this.normalizeTypefaceToken(
81761
- String(minorFontNode?.["a:ea"]?.["@_typeface"] || "")
81762
- );
81763
- if (minorEa) {
81764
- fontMap["mn-ea"] = minorEa;
81765
- }
81766
- const minorCs = this.normalizeTypefaceToken(
81767
- String(minorFontNode?.["a:cs"]?.["@_typeface"] || "")
81768
- );
81769
- if (minorCs) {
81770
- fontMap["mn-cs"] = minorCs;
81771
- }
81772
- const majorScripts = this.collectFontScriptOverrides(majorFontNode);
81773
- if (Object.keys(majorScripts).length > 0) {
81774
- this.masterThemeMajorFontScripts.set(themePath, majorScripts);
81775
- }
81776
- const minorScripts = this.collectFontScriptOverrides(minorFontNode);
81777
- if (Object.keys(minorScripts).length > 0) {
81778
- this.masterThemeMinorFontScripts.set(themePath, minorScripts);
81779
- }
81780
- const objectDefaultsNode = themeRoot?.["a:objectDefaults"];
81781
- if (objectDefaultsNode) {
81782
- const od = {
81783
- spDef: objectDefaultsNode["a:spDef"],
81784
- lnDef: objectDefaultsNode["a:lnDef"],
81785
- txDef: objectDefaultsNode["a:txDef"]
81786
- };
81787
- if (od.spDef !== void 0 || od.lnDef !== void 0 || od.txDef !== void 0) {
81788
- this.masterThemeObjectDefaults.set(themePath, od);
81789
- }
81790
- }
81791
- const extraClrSchemeLst = themeRoot?.["a:extraClrSchemeLst"];
81792
- if (extraClrSchemeLst !== void 0) {
81793
- this.masterThemeExtraClrSchemeLst.set(themePath, extraClrSchemeLst);
81794
- }
81795
- const custClrLst = themeRoot?.["a:custClrLst"];
81796
- if (custClrLst !== void 0) {
81797
- this.masterThemeCustClrLst.set(themePath, custClrLst);
81798
- }
81799
- const themeExtLst = themeRoot?.["a:extLst"];
81800
- if (themeExtLst !== void 0) {
81801
- this.masterThemeExtLst.set(themePath, themeExtLst);
81802
- }
81803
- const formatScheme = fmtScheme ? this.parseFormatScheme(fmtScheme) : void 0;
81804
- return { colorMap, fontMap, formatScheme };
82019
+ const model = this.parseThemePartXml(themeXml3);
82020
+ this.cacheThemePartModel(themePath, themeXml3, model);
82021
+ return { colorMap: model.colorMap, fontMap: model.fontMap, formatScheme: model.formatScheme };
81805
82022
  }
81806
- /**
81807
- * Parse `<a:font script="…" typeface="…"/>` children of a major or
81808
- * minor font node into a `script -> typeface` dictionary.
81809
- *
81810
- * fast-xml-parser collapses repeated tags into arrays, so iterate
81811
- * over the array form regardless of how many siblings are present.
81812
- *
81813
- * Phase 4 Stream A / M4.
81814
- */
81815
82023
  /**
81816
82024
  * Flatten a per-theme-path script-override map (`themePath -> {script ->
81817
82025
  * typeface}`) into a single `{script -> typeface}` lookup for
@@ -81829,21 +82037,6 @@ var PptxHandlerRuntime84 = class extends PptxHandlerRuntime83 {
81829
82037
  }
81830
82038
  return aggregate;
81831
82039
  }
81832
- collectFontScriptOverrides(fontNode) {
81833
- const overrides = {};
81834
- if (!fontNode) {
81835
- return overrides;
81836
- }
81837
- const fontEntries = this.ensureArray(fontNode["a:font"]);
81838
- for (const entry2 of fontEntries) {
81839
- const script = String(entry2?.["@_script"] || "").trim();
81840
- const typeface = this.normalizeTypefaceToken(String(entry2?.["@_typeface"] || ""));
81841
- if (script && typeface) {
81842
- overrides[script] = typeface;
81843
- }
81844
- }
81845
- return overrides;
81846
- }
81847
82040
  /**
81848
82041
  * Resolve the theme file path referenced by a given master's `.rels`.
81849
82042
  * Returns `undefined` when the master has no theme relationship.
@@ -81927,109 +82120,9 @@ var PptxHandlerRuntime84 = class extends PptxHandlerRuntime83 {
81927
82120
  }
81928
82121
  };
81929
82122
 
81930
- // pptx/core/core/runtime/theme-scheme-edit.ts
81931
- var THEME_COLOR_SCHEME_KEYS = [
81932
- "dk1",
81933
- "lt1",
81934
- "dk2",
81935
- "lt2",
81936
- "accent1",
81937
- "accent2",
81938
- "accent3",
81939
- "accent4",
81940
- "accent5",
81941
- "accent6",
81942
- "hlink",
81943
- "folHlink"
81944
- ];
81945
- var DEFAULT_CLR_MAP_ALIASES = {
81946
- tx1: "dk1",
81947
- bg1: "lt1",
81948
- tx2: "dk2",
81949
- bg2: "lt2"
81950
- };
81951
- function normalizeHex2(hex3) {
81952
- return hex3.replace(/^#/, "").toUpperCase();
81953
- }
81954
- function buildSrgbClrNode(hex3) {
81955
- return { "a:srgbClr": { "@_val": normalizeHex2(hex3) } };
81956
- }
81957
- function themeElementsOf(data) {
81958
- const root = data["a:theme"];
81959
- return root?.["a:themeElements"];
81960
- }
81961
- function applyColorSchemeToThemeXml(data, colorScheme) {
81962
- const themeElements = themeElementsOf(data);
81963
- if (!themeElements) {
81964
- return false;
81965
- }
81966
- const clrScheme = themeElements["a:clrScheme"] ?? {};
81967
- for (const key2 of THEME_COLOR_SCHEME_KEYS) {
81968
- clrScheme[`a:${key2}`] = buildSrgbClrNode(colorScheme[key2]);
81969
- }
81970
- themeElements["a:clrScheme"] = clrScheme;
81971
- return true;
81972
- }
81973
- function applyLatinTypeface(group, latin) {
81974
- const font = group ?? {};
81975
- font["a:latin"] = { "@_typeface": latin };
81976
- if (!font["a:ea"]) {
81977
- font["a:ea"] = { "@_typeface": "" };
81978
- }
81979
- if (!font["a:cs"]) {
81980
- font["a:cs"] = { "@_typeface": "" };
81981
- }
81982
- return font;
81983
- }
81984
- function applyFontSchemeToThemeXml(data, fontScheme) {
81985
- const themeElements = themeElementsOf(data);
81986
- if (!themeElements) {
81987
- return false;
81988
- }
81989
- const fntScheme = themeElements["a:fontScheme"] ?? {};
81990
- if (fontScheme.majorFont?.latin) {
81991
- fntScheme["a:majorFont"] = applyLatinTypeface(
81992
- fntScheme["a:majorFont"],
81993
- fontScheme.majorFont.latin
81994
- );
81995
- }
81996
- if (fontScheme.minorFont?.latin) {
81997
- fntScheme["a:minorFont"] = applyLatinTypeface(
81998
- fntScheme["a:minorFont"],
81999
- fontScheme.minorFont.latin
82000
- );
82001
- }
82002
- themeElements["a:fontScheme"] = fntScheme;
82003
- return true;
82004
- }
82005
- function applyColorSchemeToMap(map, colorScheme, clrMap) {
82006
- for (const key2 of THEME_COLOR_SCHEME_KEYS) {
82007
- map[key2] = normalizeHex2(colorScheme[key2]);
82008
- }
82009
- for (const [alias, defaultTarget] of Object.entries(DEFAULT_CLR_MAP_ALIASES)) {
82010
- const target = clrMap?.[alias] ?? defaultTarget;
82011
- const resolved = map[target];
82012
- if (resolved !== void 0) {
82013
- map[alias] = resolved;
82014
- }
82015
- }
82016
- }
82017
- function applyFontSchemeToMap(map, fontScheme) {
82018
- if (fontScheme.majorFont?.latin) {
82019
- map["mj-lt"] = fontScheme.majorFont.latin;
82020
- map["mj-ea"] = fontScheme.majorFont.latin;
82021
- map["mj-cs"] = fontScheme.majorFont.latin;
82022
- }
82023
- if (fontScheme.minorFont?.latin) {
82024
- map["mn-lt"] = fontScheme.minorFont.latin;
82025
- map["mn-ea"] = fontScheme.minorFont.latin;
82026
- map["mn-cs"] = fontScheme.minorFont.latin;
82027
- }
82028
- }
82029
-
82030
82123
  // pptx/core/core/runtime/PptxHandlerRuntimeThemeProcessing.ts
82031
82124
  var THEME_PART_PATTERN = /^ppt\/theme\/theme\d+\.xml$/;
82032
- var PptxHandlerRuntime85 = class extends PptxHandlerRuntime84 {
82125
+ var PptxHandlerRuntime86 = class extends PptxHandlerRuntime85 {
82033
82126
  /**
82034
82127
  * The theme parts an edit should touch, primary theme first.
82035
82128
  *
@@ -82070,8 +82163,9 @@ var PptxHandlerRuntime85 = class extends PptxHandlerRuntime84 {
82070
82163
  return this.parser.parse(xml);
82071
82164
  }
82072
82165
  /**
82073
- * Parse, edit, and write back every target theme part. Parts the edit
82074
- * cannot apply to (no `a:themeElements`) are left untouched.
82166
+ * Parse, edit, and write back every target theme part (`edit` gets the
82167
+ * part's path too). Parts the edit cannot apply to (no `a:themeElements`)
82168
+ * are left untouched.
82075
82169
  *
82076
82170
  * @returns the paths that were rewritten
82077
82171
  */
@@ -82079,7 +82173,7 @@ var PptxHandlerRuntime85 = class extends PptxHandlerRuntime84 {
82079
82173
  const written = [];
82080
82174
  for (const path3 of await this.resolveThemeEditTargets(themePaths)) {
82081
82175
  const data = await this.readThemePart(path3);
82082
- if (!data || !edit(data)) {
82176
+ if (!data || !edit(data, path3)) {
82083
82177
  continue;
82084
82178
  }
82085
82179
  this.zip.file(path3, this.builder.build(data));
@@ -82181,8 +82275,77 @@ var PptxHandlerRuntime85 = class extends PptxHandlerRuntime84 {
82181
82275
  }
82182
82276
  };
82183
82277
 
82278
+ // pptx/core/core/runtime/PptxHandlerRuntimeThemeSwitching.ts
82279
+ var SLIDE_MASTER_PART = /^ppt\/slideMasters\/slideMaster\d+\.xml$/;
82280
+ function themePartPath(themePath) {
82281
+ const path3 = themePath.trim().replace(/\\/g, "/");
82282
+ return path3.startsWith("ppt/theme/") ? path3 : void 0;
82283
+ }
82284
+ var PptxHandlerRuntime87 = class extends PptxHandlerRuntime86 {
82285
+ /**
82286
+ * Point the first slide master, or every one, at a theme part already in the package. Does
82287
+ * nothing when the package has no such part.
82288
+ */
82289
+ async setPresentationTheme(themePath, applyToAllMasters = true) {
82290
+ const path3 = themePartPath(themePath);
82291
+ if (!path3 || !this.zip.file(path3)) {
82292
+ return;
82293
+ }
82294
+ const masters = this.zip.file(SLIDE_MASTER_PART);
82295
+ for (const master of applyToAllMasters ? masters : masters.slice(0, 1)) {
82296
+ await this.retargetMasterTheme(master.name, path3);
82297
+ }
82298
+ }
82299
+ /**
82300
+ * Point one slide master at a theme part already in the package (Undo of a theme switch puts
82301
+ * each master back on its own part). Does nothing when the package has no such master or part.
82302
+ */
82303
+ async setSlideMasterTheme(masterPath, themePath) {
82304
+ const path3 = themePartPath(themePath);
82305
+ if (!path3 || !this.zip.file(path3) || !SLIDE_MASTER_PART.test(masterPath)) {
82306
+ return;
82307
+ }
82308
+ if (this.zip.file(masterPath)) {
82309
+ await this.retargetMasterTheme(masterPath, path3);
82310
+ }
82311
+ }
82312
+ async retargetMasterTheme(masterPath, themePath) {
82313
+ if (await this.setMasterThemeRelationship(masterPath, themePath)) {
82314
+ await this.adoptMasterTheme(masterPath, themePath);
82315
+ }
82316
+ }
82317
+ /** Point the runtime's theme state for `masterPath` at the part it now uses. */
82318
+ async adoptMasterTheme(masterPath, themePath) {
82319
+ const themeXml3 = await this.zip.file(themePath)?.async("string");
82320
+ if (themeXml3 === void 0) {
82321
+ return;
82322
+ }
82323
+ const model = this.parseThemePartXml(themeXml3);
82324
+ if (!this.originalThemeXmlByPath.has(themePath)) {
82325
+ this.cacheThemePartModel(themePath, themeXml3, model);
82326
+ }
82327
+ this.masterThemePaths.set(masterPath, themePath);
82328
+ this.masterThemeColorMaps.set(masterPath, { ...model.colorMap });
82329
+ this.masterThemeFontMaps.set(masterPath, { ...model.fontMap });
82330
+ if (model.formatScheme) {
82331
+ this.masterThemeFormatSchemes.set(masterPath, model.formatScheme);
82332
+ } else {
82333
+ this.masterThemeFormatSchemes.delete(masterPath);
82334
+ }
82335
+ if (this.zip.file(SLIDE_MASTER_PART)[0]?.name !== masterPath) {
82336
+ return;
82337
+ }
82338
+ this.themeColorMap = { ...model.colorMap };
82339
+ this.themeFontMap = { ...model.fontMap };
82340
+ this.themeFormatScheme = model.formatScheme;
82341
+ this.globalThemeColorMapSnapshot = { ...model.colorMap };
82342
+ this.globalThemeFontMapSnapshot = { ...model.fontMap };
82343
+ this.globalThemeFormatSchemeSnapshot = model.formatScheme;
82344
+ }
82345
+ };
82346
+
82184
82347
  // pptx/core/core/runtime/PptxHandlerRuntimeComments.ts
82185
- var PptxHandlerRuntime86 = class _PptxHandlerRuntime extends PptxHandlerRuntime85 {
82348
+ var PptxHandlerRuntime88 = class _PptxHandlerRuntime extends PptxHandlerRuntime87 {
82186
82349
  /**
82187
82350
  * Parse modern threaded comments (PowerPoint 2019+ / Office 365).
82188
82351
  * Modern comments use `p188:cmLst`/`p15:cmLst` roots within
@@ -82409,7 +82572,7 @@ var PptxHandlerRuntime86 = class _PptxHandlerRuntime extends PptxHandlerRuntime8
82409
82572
  };
82410
82573
 
82411
82574
  // pptx/core/core/runtime/PptxHandlerRuntimeSmartArtXmlUtils.ts
82412
- var PptxHandlerRuntime87 = class extends PptxHandlerRuntime86 {
82575
+ var PptxHandlerRuntime89 = class extends PptxHandlerRuntime88 {
82413
82576
  async readXmlPartByRelationshipId(slidePath, relationshipId) {
82414
82577
  const normalizedRelationshipId = String(relationshipId || "").trim();
82415
82578
  if (normalizedRelationshipId.length === 0) {
@@ -82978,7 +83141,7 @@ function resolveSmartArtTextStyles(paragraphs, resolve) {
82978
83141
  }
82979
83142
 
82980
83143
  // pptx/core/core/runtime/PptxHandlerRuntimeSmartArtParsing.ts
82981
- var PptxHandlerRuntime88 = class _PptxHandlerRuntime extends PptxHandlerRuntime87 {
83144
+ var PptxHandlerRuntime90 = class _PptxHandlerRuntime extends PptxHandlerRuntime89 {
82982
83145
  reportIncompleteSmartArtRelationships(graphicFrame, relationshipIds, slidePath) {
82983
83146
  const missing = [
82984
83147
  ["dm", relationshipIds?.dataRelId],
@@ -83352,7 +83515,7 @@ function resolveSmartArtDrawingPart(slidePath, diagramDataRelationshipId, drawin
83352
83515
  }
83353
83516
 
83354
83517
  // pptx/core/core/runtime/PptxHandlerRuntimeSmartArt.ts
83355
- var PptxHandlerRuntime89 = class _PptxHandlerRuntime extends PptxHandlerRuntime88 {
83518
+ var PptxHandlerRuntime91 = class _PptxHandlerRuntime extends PptxHandlerRuntime90 {
83356
83519
  async getSmartArtDataForGraphicFrame(slidePath, graphicFrame) {
83357
83520
  const graphicData = this.xmlLookupService.getChildByLocalName(
83358
83521
  this.xmlLookupService.getChildByLocalName(graphicFrame, "graphic"),
@@ -83526,7 +83689,7 @@ var PptxHandlerRuntime89 = class _PptxHandlerRuntime extends PptxHandlerRuntime8
83526
83689
  };
83527
83690
 
83528
83691
  // pptx/core/core/runtime/PptxHandlerRuntimeChartDetection.ts
83529
- var PptxHandlerRuntime90 = class extends PptxHandlerRuntime89 {
83692
+ var PptxHandlerRuntime92 = class extends PptxHandlerRuntime91 {
83530
83693
  detectChartType(plotArea) {
83531
83694
  if (!plotArea) {
83532
83695
  return "unknown";
@@ -83736,7 +83899,7 @@ function parseNumberVal(node) {
83736
83899
  const num2 = Number.parseFloat(String(raw2));
83737
83900
  return Number.isFinite(num2) ? num2 : void 0;
83738
83901
  }
83739
- var PptxHandlerRuntime91 = class extends PptxHandlerRuntime90 {
83902
+ var PptxHandlerRuntime93 = class extends PptxHandlerRuntime92 {
83740
83903
  /**
83741
83904
  * Parse `c:plotVisOnly` from the chart root element.
83742
83905
  *
@@ -83995,7 +84158,7 @@ var PptxHandlerRuntime91 = class extends PptxHandlerRuntime90 {
83995
84158
 
83996
84159
  // pptx/core/core/runtime/PptxHandlerRuntimeChartExternalData.ts
83997
84160
  var CHART_USER_SHAPES_REL_TYPE2 = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/chartUserShapes";
83998
- var PptxHandlerRuntime92 = class extends PptxHandlerRuntime91 {
84161
+ var PptxHandlerRuntime94 = class extends PptxHandlerRuntime93 {
83999
84162
  /**
84000
84163
  * Parse `c:externalData` from the chart's `c:chartSpace` and resolve
84001
84164
  * the external relationship target from the chart part's .rels file.
@@ -84155,7 +84318,7 @@ var PptxHandlerRuntime92 = class extends PptxHandlerRuntime91 {
84155
84318
  };
84156
84319
 
84157
84320
  // pptx/core/core/runtime/PptxHandlerRuntimeChartColorStyle.ts
84158
- var PptxHandlerRuntime93 = class extends PptxHandlerRuntime92 {
84321
+ var PptxHandlerRuntime95 = class extends PptxHandlerRuntime94 {
84159
84322
  /**
84160
84323
  * Parse the Office 2013+ chart-style part (`ppt/charts/style#.xml`)
84161
84324
  * referenced from the chart's relationships, sibling to
@@ -84314,7 +84477,7 @@ var PptxHandlerRuntime93 = class extends PptxHandlerRuntime92 {
84314
84477
  };
84315
84478
 
84316
84479
  // pptx/core/core/runtime/PptxHandlerRuntimeChartExParsing.ts
84317
- var PptxHandlerRuntime94 = class extends PptxHandlerRuntime93 {
84480
+ var PptxHandlerRuntime96 = class extends PptxHandlerRuntime95 {
84318
84481
  /**
84319
84482
  * The facts of a chart part that live outside the plot (or in other parts): the external data
84320
84483
  * reference and the embedded workbook's rows, pivot source and formats, the colour-style and
@@ -84432,7 +84595,7 @@ var PptxHandlerRuntime94 = class extends PptxHandlerRuntime93 {
84432
84595
  };
84433
84596
 
84434
84597
  // pptx/core/core/runtime/PptxHandlerRuntimeChartParsing.ts
84435
- var PptxHandlerRuntime95 = class extends PptxHandlerRuntime94 {
84598
+ var PptxHandlerRuntime97 = class extends PptxHandlerRuntime96 {
84436
84599
  /**
84437
84600
  * Parse chart data from a graphic frame element on a slide.
84438
84601
  *
@@ -84716,7 +84879,7 @@ var PptxHandlerRuntime95 = class extends PptxHandlerRuntime94 {
84716
84879
  // pptx/core/core/runtime/PptxHandlerRuntimePresentationStructure.ts
84717
84880
  var XSD_INT_MIN = -2147483648;
84718
84881
  var XSD_INT_MAX = 2147483647;
84719
- var PptxHandlerRuntime96 = class extends PptxHandlerRuntime95 {
84882
+ var PptxHandlerRuntime98 = class extends PptxHandlerRuntime97 {
84720
84883
  parseEditorAnimations(slideXml3) {
84721
84884
  return this.editorAnimationService.parseEditorAnimations(slideXml3);
84722
84885
  }
@@ -84917,7 +85080,7 @@ var PptxHandlerRuntime96 = class extends PptxHandlerRuntime95 {
84917
85080
  };
84918
85081
 
84919
85082
  // pptx/core/core/runtime/PptxHandlerRuntimeEmbeddedFonts.ts
84920
- var PptxHandlerRuntime97 = class extends PptxHandlerRuntime96 {
85083
+ var PptxHandlerRuntime99 = class extends PptxHandlerRuntime98 {
84921
85084
  async getEmbeddedFonts(fontList) {
84922
85085
  if (!fontList || fontList.fonts.length === 0) {
84923
85086
  return [];
@@ -85120,7 +85283,7 @@ var PptxHandlerRuntime97 = class extends PptxHandlerRuntime96 {
85120
85283
 
85121
85284
  // pptx/core/core/runtime/PptxHandlerRuntimeLoadSession.ts
85122
85285
  var MAX_OLE_EMBEDDING_BYTES = 25 * 1024 * 1024;
85123
- var PptxHandlerRuntime98 = class _PptxHandlerRuntime extends PptxHandlerRuntime97 {
85286
+ var PptxHandlerRuntime100 = class _PptxHandlerRuntime extends PptxHandlerRuntime99 {
85124
85287
  isZipContainer(data) {
85125
85288
  const bytes = new Uint8Array(data);
85126
85289
  if (bytes.byteLength < 4) {
@@ -85486,7 +85649,7 @@ var PptxHandlerRuntime98 = class _PptxHandlerRuntime extends PptxHandlerRuntime9
85486
85649
  };
85487
85650
 
85488
85651
  // pptx/core/core/runtime/PptxHandlerRuntimeLoadPipeline.ts
85489
- var PptxHandlerRuntime99 = class extends PptxHandlerRuntime98 {
85652
+ var PptxHandlerRuntime101 = class extends PptxHandlerRuntime100 {
85490
85653
  async buildLoadData(presentationState, slidesWithWarnings, slideMasters) {
85491
85654
  const headerFooter = this.extractHeaderFooter();
85492
85655
  const presentationProperties = await this.parsePresentationProperties();
@@ -85984,7 +86147,7 @@ function refIndex(node) {
85984
86147
  const idx = Number.parseInt(String(node["@_idx"] ?? ""), 10);
85985
86148
  return Number.isFinite(idx) ? idx : void 0;
85986
86149
  }
85987
- var PptxHandlerRuntime100 = class extends PptxHandlerRuntime99 {
86150
+ var PptxHandlerRuntime102 = class extends PptxHandlerRuntime101 {
85988
86151
  /**
85989
86152
  * Resolve a `<p:style>` node (`a:lnRef`, `a:fillRef`, `a:effectRef`,
85990
86153
  * `a:fontRef`) against the current theme's format scheme, with the same
@@ -86047,8 +86210,10 @@ function withKeys(style, from, keys) {
86047
86210
  function refNode(idx, colorXml2) {
86048
86211
  return { "@_idx": String(idx), ...colorXml2 ?? {} };
86049
86212
  }
86050
- var PptxHandlerRuntime101 = class extends PptxHandlerRuntime100 {
86213
+ var PptxHandlerRuntime103 = class extends PptxHandlerRuntime102 {
86051
86214
  effectSchemeCache = /* @__PURE__ */ new Map();
86215
+ /** Every `a:fmtScheme` written into a theme part or over one ({@link restoreThemeFormatScheme}). */
86216
+ heldFormatSchemes = new HeldFormatSchemes();
86052
86217
  /**
86053
86218
  * Resolve a `<p:style>` node as the base class does, against built-in effect scheme
86054
86219
  * `effectSchemeId` instead of the deck's own (the Effects gallery draws each tile this way).
@@ -86101,32 +86266,79 @@ var PptxHandlerRuntime101 = class extends PptxHandlerRuntime100 {
86101
86266
  */
86102
86267
  async applyThemeFormatSchemeXml(fmtSchemeXml) {
86103
86268
  const parsed = this.parseEffectScheme({ fmtSchemeXml });
86104
- if (!parsed) {
86105
- return void 0;
86269
+ return parsed ? this.writeFormatScheme(() => parsed.node) : void 0;
86270
+ }
86271
+ /**
86272
+ * Put back a format scheme the deck held before (Undo and Redo of an Effects pick), as the parts
86273
+ * held it: each theme part a master references gets back what it held the last time the deck's
86274
+ * scheme was `scheme` over those same parts, so a part with a scheme of its own gets its own back
86275
+ * (with no such time, `scheme`'s own element goes into every one). With `themePaths`, `scheme`'s
86276
+ * own element goes into those parts only.
86277
+ *
86278
+ * @returns the deck's format scheme now, or `undefined` (nothing written) for a scheme no part
86279
+ * held while this handler wrote into it
86280
+ */
86281
+ async restoreThemeFormatScheme(scheme, themePaths) {
86282
+ const parts = themePaths ? void 0 : this.heldFormatSchemes.parts(scheme, await this.resolveThemeEditTargets());
86283
+ if (parts) {
86284
+ return this.writeFormatScheme((path3) => parts.get(path3));
86106
86285
  }
86107
- const written = await this.rewriteThemeParts(void 0, (data) => {
86286
+ const element = this.heldFormatSchemes.element(scheme);
86287
+ return element ? this.writeFormatScheme(() => element, themePaths) : void 0;
86288
+ }
86289
+ /**
86290
+ * Write `elementFor(part)` into every theme part a master references (or only `themePaths`),
86291
+ * skipping a part it gives none, holding what each part held and now holds, and refresh the
86292
+ * in-memory format schemes of the masters on those parts and, when the deck's part is among
86293
+ * them, the deck's.
86294
+ */
86295
+ async writeFormatScheme(elementFor, themePaths) {
86296
+ const deckBefore = this.getThemeFormatScheme();
86297
+ const replaced = /* @__PURE__ */ new Map();
86298
+ const schemes = /* @__PURE__ */ new Map();
86299
+ const written = await this.rewriteThemeParts(themePaths, (data, path3) => {
86300
+ const element = elementFor(path3);
86108
86301
  const elements2 = data["a:theme"]?.["a:themeElements"];
86109
- if (!elements2) {
86302
+ if (!element || !elements2) {
86110
86303
  return false;
86111
86304
  }
86112
- elements2["a:fmtScheme"] = structuredClone(parsed.node);
86305
+ const previous = elements2["a:fmtScheme"];
86306
+ if (previous) {
86307
+ this.heldFormatSchemes.hold(this.parseFormatScheme(previous), previous);
86308
+ replaced.set(path3, structuredClone(previous));
86309
+ }
86310
+ const scheme = this.parseFormatScheme(element);
86311
+ this.heldFormatSchemes.hold(scheme, element);
86312
+ elements2["a:fmtScheme"] = structuredClone(element);
86313
+ schemes.set(path3, scheme);
86113
86314
  return true;
86114
86315
  });
86115
86316
  if (written.length === 0) {
86116
86317
  return void 0;
86117
86318
  }
86319
+ if (deckBefore) {
86320
+ this.heldFormatSchemes.holdParts(deckBefore, replaced);
86321
+ }
86118
86322
  for (const path3 of written) {
86119
86323
  const xml = await this.zip.file(path3)?.async("string");
86120
86324
  if (xml !== void 0) {
86121
86325
  this.originalThemeXmlByPath.set(path3, xml);
86122
86326
  }
86327
+ for (const masterPath of this.mastersUsingThemes([path3])) {
86328
+ this.masterThemeFormatSchemes.set(masterPath, schemes.get(path3));
86329
+ }
86123
86330
  }
86124
- for (const masterPath of this.mastersUsingThemes(written)) {
86125
- this.masterThemeFormatSchemes.set(masterPath, parsed.scheme);
86331
+ const primary = await this.resolvePrimaryThemePath();
86332
+ const deck = primary === void 0 ? void 0 : schemes.get(primary);
86333
+ if (deck) {
86334
+ this.globalThemeFormatSchemeSnapshot = deck;
86335
+ this.themeFormatScheme = deck;
86336
+ this.heldFormatSchemes.holdParts(
86337
+ deck,
86338
+ new Map(written.map((path3) => [path3, elementFor(path3)]))
86339
+ );
86126
86340
  }
86127
- this.globalThemeFormatSchemeSnapshot = parsed.scheme;
86128
- this.themeFormatScheme = parsed.scheme;
86129
- return parsed.scheme;
86341
+ return this.getThemeFormatScheme();
86130
86342
  }
86131
86343
  /** The real theme variants the loaded package carries, or none. */
86132
86344
  getThemeVariants() {
@@ -86250,7 +86462,7 @@ function schemeFromColorMap(map) {
86250
86462
  folHlink: pick("folHlink")
86251
86463
  };
86252
86464
  }
86253
- var PptxHandlerRuntime102 = class extends PptxHandlerRuntime101 {
86465
+ var PptxHandlerRuntime104 = class extends PptxHandlerRuntime103 {
86254
86466
  resolveBackgroundStyle(preset) {
86255
86467
  const xml = {
86256
86468
  "p:sld": { "p:cSld": { "p:bg": backgroundRefNode(preset.idx, preset.scheme) } }
@@ -86499,7 +86711,7 @@ function applyPlaceholderFrame(shape, inherited, options, emuPerPx, materializeF
86499
86711
  }
86500
86712
 
86501
86713
  // pptx/core/core/runtime/PptxHandlerRuntimeSdkPlaceholders.ts
86502
- var PptxHandlerRuntime103 = class _PptxHandlerRuntime extends PptxHandlerRuntime102 {
86714
+ var PptxHandlerRuntime105 = class _PptxHandlerRuntime extends PptxHandlerRuntime104 {
86503
86715
  createPlaceholderElement(layoutPath, input, type, options) {
86504
86716
  if (input.type !== "text") throw new Error("Placeholder input must be text");
86505
86717
  const layout = this.layoutXmlMap.get(layoutPath);
@@ -86553,7 +86765,7 @@ var PptxHandlerRuntime103 = class _PptxHandlerRuntime extends PptxHandlerRuntime
86553
86765
  };
86554
86766
 
86555
86767
  // pptx/core/core/runtime/PptxHandlerRuntimeImplementation.ts
86556
- var PptxHandlerRuntime104 = class _PptxHandlerRuntime extends PptxHandlerRuntime103 {
86768
+ var PptxHandlerRuntime106 = class _PptxHandlerRuntime extends PptxHandlerRuntime105 {
86557
86769
  constructor(dependencyFactory = new PptxRuntimeDependencyFactory()) {
86558
86770
  super();
86559
86771
  this.dependencyFactory = dependencyFactory;
@@ -86691,7 +86903,7 @@ var PptxHandlerRuntime104 = class _PptxHandlerRuntime extends PptxHandlerRuntime
86691
86903
  };
86692
86904
 
86693
86905
  // pptx/core/core/PptxHandlerRuntime.ts
86694
- var PptxHandlerRuntime105 = class extends PptxHandlerRuntime104 {
86906
+ var PptxHandlerRuntime107 = class extends PptxHandlerRuntime106 {
86695
86907
  };
86696
86908
 
86697
86909
  // pptx/core/core/PptxHandlerRuntimeFactory.ts
@@ -86702,10 +86914,10 @@ var PptxHandlerRuntimeFactory = class {
86702
86914
  * @returns A freshly constructed runtime ready for loading a PPTX file.
86703
86915
  */
86704
86916
  createRuntime() {
86705
- return new PptxHandlerRuntime105();
86917
+ return new PptxHandlerRuntime107();
86706
86918
  }
86707
86919
  };
86708
- var createDefaultPptxHandlerRuntime = () => new PptxHandlerRuntime105();
86920
+ var createDefaultPptxHandlerRuntime = () => new PptxHandlerRuntime107();
86709
86921
 
86710
86922
  // pptx/core/core/runtime/table-style-editor.ts
86711
86923
  function deepClone(value) {
@@ -89737,10 +89949,32 @@ var PptxHandlerCore = class {
89737
89949
  async setPresentationTheme(themePath, applyToAllMasters = true) {
89738
89950
  await this.runtime.setPresentationTheme(themePath, applyToAllMasters);
89739
89951
  }
89952
+ /**
89953
+ * Point one slide master at a theme part already in the package; scheme edits and saves follow
89954
+ * it. Does nothing when the package has no such master or part.
89955
+ *
89956
+ * @param masterPath - The master's part path (e.g. `ppt/slideMasters/slideMaster2.xml`).
89957
+ * @param themePath - The theme part's path (e.g. `ppt/theme/theme1.xml`).
89958
+ */
89959
+ async setSlideMasterTheme(masterPath, themePath) {
89960
+ await this.runtime.setSlideMasterTheme(masterPath, themePath);
89961
+ }
89962
+ /**
89963
+ * Read one theme part's colour, font and format schemes and its name without changing the
89964
+ * loaded theme, for example to show what switching to it would apply.
89965
+ *
89966
+ * @param themePath - The theme part's path (e.g. `ppt/theme/theme2.xml`).
89967
+ * @returns The part's schemes, or `undefined` when the package has no such part.
89968
+ */
89969
+ async getThemePartSchemes(themePath) {
89970
+ return this.runtime.getThemePartSchemes(themePath);
89971
+ }
89740
89972
  /**
89741
89973
  * Modify the theme’s colour scheme (accent colours, background, text, etc.).
89742
89974
  *
89743
89975
  * @param colorScheme - A {@link PptxThemeColorScheme} with hex colour values.
89976
+ * @param themePaths - Only these theme parts (e.g. `ppt/theme/theme2.xml`); every part a slide
89977
+ * master uses when omitted.
89744
89978
  *
89745
89979
  * @example
89746
89980
  * ```ts
@@ -89753,13 +89987,15 @@ var PptxHandlerCore = class {
89753
89987
  * // => void — colour scheme updated in the in-memory theme XML
89754
89988
  * ```
89755
89989
  */
89756
- async updateThemeColorScheme(colorScheme) {
89757
- await this.runtime.updateThemeColorScheme(colorScheme);
89990
+ async updateThemeColorScheme(colorScheme, themePaths) {
89991
+ await this.runtime.updateThemeColorScheme(colorScheme, themePaths);
89758
89992
  }
89759
89993
  /**
89760
89994
  * Update the theme’s font scheme (heading + body typefaces).
89761
89995
  *
89762
89996
  * @param fontScheme - A {@link PptxThemeFontScheme} with font family names.
89997
+ * @param themePaths - Only these theme parts (e.g. `ppt/theme/theme2.xml`); every part a slide
89998
+ * master uses when omitted.
89763
89999
  *
89764
90000
  * @example
89765
90001
  * ```ts
@@ -89770,16 +90006,18 @@ var PptxHandlerCore = class {
89770
90006
  * // => void — font scheme updated in the in-memory theme XML
89771
90007
  * ```
89772
90008
  */
89773
- async updateThemeFontScheme(fontScheme) {
89774
- await this.runtime.updateThemeFontScheme(fontScheme);
90009
+ async updateThemeFontScheme(fontScheme, themePaths) {
90010
+ await this.runtime.updateThemeFontScheme(fontScheme, themePaths);
89775
90011
  }
89776
90012
  /**
89777
90013
  * Rename the presentation theme.
89778
90014
  *
89779
90015
  * @param name - New display name for the theme.
90016
+ * @param themePaths - Only these theme parts (e.g. `ppt/theme/theme2.xml`); every part a slide
90017
+ * master uses when omitted.
89780
90018
  */
89781
- async updateThemeName(name) {
89782
- await this.runtime.updateThemeName(name);
90019
+ async updateThemeName(name, themePaths) {
90020
+ await this.runtime.updateThemeName(name, themePaths);
89783
90021
  }
89784
90022
  /**
89785
90023
  * Resolve a `<p:style>` block (`a:lnRef` / `a:fillRef` / `a:effectRef` /
@@ -89802,6 +90040,14 @@ var PptxHandlerCore = class {
89802
90040
  async applyThemeFormatSchemeXml(fmtSchemeXml) {
89803
90041
  return this.runtime.applyThemeFormatSchemeXml(fmtSchemeXml);
89804
90042
  }
90043
+ /**
90044
+ * Put a format scheme a theme part held before back into the theme parts (or only `themePaths`),
90045
+ * as the part held it: Undo and Redo of an Effects pick. Only a scheme this handler wrote into a
90046
+ * part or over one can come back; for any other it writes nothing and returns `undefined`.
90047
+ */
90048
+ async restoreThemeFormatScheme(scheme, themePaths) {
90049
+ return this.runtime.restoreThemeFormatScheme(scheme, themePaths);
90050
+ }
89805
90051
  /** The real theme variants the loaded package carries (`themeVariants/` parts), or none. */
89806
90052
  getThemeVariants() {
89807
90053
  return this.runtime.getThemeVariants();
@@ -92313,4 +92559,4 @@ var PresentationBuilder = class {
92313
92559
  * `<p:extLst>` (optional)
92314
92560
  */
92315
92561
 
92316
- 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, PptxHandlerRuntime105 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 };
92562
+ 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 };