ooxml-core 1.25.1 → 1.26.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (109) hide show
  1. package/README.md +16 -0
  2. package/dist/{PptxHandler-AUK27AQD.mjs → PptxHandler-5QBRBXRX.mjs} +3 -3
  3. package/dist/{PptxHandler-QBGEZDCO.cjs → PptxHandler-CVYP5PAN.cjs} +3 -3
  4. package/dist/PptxHandler-TOAD6P7N.mjs +4 -0
  5. package/dist/{PresentationBuilder-RX7D75GZ.mjs → PresentationBuilder-EBVNYMLE.mjs} +2 -2
  6. package/dist/{PresentationBuilder-MEETJGEA.mjs → PresentationBuilder-M5UXW4AF.mjs} +3 -3
  7. package/dist/{PresentationBuilder-CI45KEHL.cjs → PresentationBuilder-RVQZCTIO.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-TX2QFS3J.mjs → chunk-4IIR2QEH.mjs} +608 -371
  17. package/dist/{chunk-635WPRNJ.mjs → chunk-DNYZX6YG.mjs} +19 -3
  18. package/dist/{chunk-VGDHSED6.mjs → chunk-EBJ724RB.mjs} +1 -1
  19. package/dist/{chunk-GMETZZ3V.cjs → chunk-EEHK52XB.cjs} +1677 -1440
  20. package/dist/{chunk-E2PYQQQV.mjs → chunk-JJ37PCNR.mjs} +89 -47
  21. package/dist/{chunk-5F7OB7PA.mjs → chunk-K6OFJ5GJ.mjs} +605 -368
  22. package/dist/{chunk-HVRFRYYS.mjs → chunk-KONCS53X.mjs} +5 -5
  23. package/dist/{chunk-S5TGOEQX.cjs → chunk-MU3XSASV.cjs} +106 -47
  24. package/dist/{chunk-E3PRAHL6.mjs → chunk-ZXPPM63Y.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/layout/index.cjs +2 -2
  30. package/dist/docx/layout/index.mjs +2 -2
  31. package/dist/docx/layout/input.d.ts +6 -1
  32. package/dist/docx/layout/input.d.ts.map +1 -1
  33. package/dist/docx/layout/result.d.ts +1 -0
  34. package/dist/docx/layout/result.d.ts.map +1 -1
  35. package/dist/docx/load/index.cjs +89 -47
  36. package/dist/docx/load/index.mjs +89 -47
  37. package/dist/index.cjs +128 -53
  38. package/dist/index.mjs +128 -53
  39. package/dist/opc/index.cjs +90 -47
  40. package/dist/opc/index.mjs +90 -48
  41. package/dist/opc/zip-limits.d.ts +6 -0
  42. package/dist/opc/zip-limits.d.ts.map +1 -1
  43. package/dist/pptx/automation/index.cjs +766 -444
  44. package/dist/pptx/automation/index.d.ts +4 -4
  45. package/dist/pptx/automation/index.mjs +6 -6
  46. package/dist/pptx/chunks/{index-CgjEEpfK.d.ts → index-B94RKk84.d.ts} +276 -115
  47. package/dist/pptx/chunks/index-B94RKk84.d.ts.map +1 -0
  48. package/dist/pptx/chunks/{index-CX0RM1fF.d.ts → index-BOpULlxB.d.ts} +3 -3
  49. package/dist/pptx/chunks/{index-CX0RM1fF.d.ts.map → index-BOpULlxB.d.ts.map} +1 -1
  50. package/dist/pptx/chunks/{index-DCbp5fOs.d.ts → index-D3gKRIAi.d.ts} +12 -5
  51. package/dist/pptx/chunks/{index-DCbp5fOs.d.ts.map → index-D3gKRIAi.d.ts.map} +1 -1
  52. package/dist/pptx/chunks/{text-operations-CjalmJIi.d.ts → text-operations-CNfUj45U.d.ts} +16 -2
  53. package/dist/pptx/chunks/{text-operations-CjalmJIi.d.ts.map → text-operations-CNfUj45U.d.ts.map} +1 -1
  54. package/dist/pptx/cli/index.cjs +766 -444
  55. package/dist/pptx/cli/index.d.ts +1 -1
  56. package/dist/pptx/cli/index.mjs +5 -5
  57. package/dist/pptx/converter/index.d.ts +1 -1
  58. package/dist/pptx/converter/index.mjs +3 -3
  59. package/dist/pptx/editor/render/editor-history.cjs +21 -0
  60. package/dist/pptx/editor/render/editor-history.d.ts +9 -0
  61. package/dist/pptx/editor/render/editor-history.d.ts.map +1 -1
  62. package/dist/pptx/editor/render/editor-history.mjs +21 -0
  63. package/dist/pptx/editor/render/find-replace.cjs +14 -14
  64. package/dist/pptx/editor/render/find-replace.d.ts +2 -2
  65. package/dist/pptx/editor/render/find-replace.mjs +1 -1
  66. package/dist/pptx/editor/render/slide-operations.cjs +8 -8
  67. package/dist/pptx/editor/render/slide-operations.mjs +2 -2
  68. package/dist/pptx/index.cjs +765 -442
  69. package/dist/pptx/index.d.ts +5 -5
  70. package/dist/pptx/index.mjs +6 -6
  71. package/dist/pptx/node/index.d.ts +1 -1
  72. package/dist/pptx/signature-node/index.cjs +89 -47
  73. package/dist/pptx/signature-node/index.mjs +2 -2
  74. package/dist/visio/index.cjs +266 -150
  75. package/dist/visio/index.mjs +266 -150
  76. package/dist/visio/ui/index.cjs +266 -150
  77. package/dist/visio/ui/index.mjs +266 -150
  78. package/dist/xlsx/index.cjs +518 -153
  79. package/dist/xlsx/index.mjs +518 -154
  80. package/dist/xlsx/load/index.cjs +266 -150
  81. package/dist/xlsx/load/index.mjs +266 -150
  82. package/dist/xlsx/numfmt/view.d.ts +13 -0
  83. package/dist/xlsx/numfmt/view.d.ts.map +1 -0
  84. package/dist/xlsx/read/index.d.ts +1 -0
  85. package/dist/xlsx/read/index.d.ts.map +1 -1
  86. package/dist/xlsx/read/limits.d.ts +5 -0
  87. package/dist/xlsx/read/limits.d.ts.map +1 -1
  88. package/dist/xlsx/read/package.d.ts +6 -0
  89. package/dist/xlsx/read/package.d.ts.map +1 -1
  90. package/dist/xlsx/read/rows-stream.d.ts +12 -0
  91. package/dist/xlsx/read/rows-stream.d.ts.map +1 -0
  92. package/dist/xlsx/read/rows.d.ts +37 -0
  93. package/dist/xlsx/read/rows.d.ts.map +1 -0
  94. package/dist/xlsx/read/shared-strings.d.ts +6 -1
  95. package/dist/xlsx/read/shared-strings.d.ts.map +1 -1
  96. package/dist/xlsx/read/sheet-data-source.d.ts +30 -3
  97. package/dist/xlsx/read/sheet-data-source.d.ts.map +1 -1
  98. package/dist/xlsx/read/sheet-data.d.ts +13 -2
  99. package/dist/xlsx/read/sheet-data.d.ts.map +1 -1
  100. package/dist/xlsx/read/worksheet.d.ts.map +1 -1
  101. package/dist/xlsx/ui/index.cjs +266 -150
  102. package/dist/xlsx/ui/index.mjs +266 -150
  103. package/dist/xml/index.cjs +38 -6
  104. package/dist/xml/index.mjs +37 -7
  105. package/dist/xml/lite.d.ts +15 -0
  106. package/dist/xml/lite.d.ts.map +1 -1
  107. package/package.json +1 -1
  108. package/dist/PptxHandler-5UO5DD5K.mjs +0 -4
  109. 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-DNYZX6YG.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. */
@@ -58646,6 +58676,11 @@ var PptxHandlerRuntime8 = class extends PptxHandlerRuntime7 {
58646
58676
  const upSegments = Array.from({ length: fromParts.length }).fill("..");
58647
58677
  return [...upSegments, ...toParts].join("/");
58648
58678
  }
58679
+ /**
58680
+ * Point a slide master's theme relationship at `themePath`.
58681
+ *
58682
+ * @returns whether the master had a theme relationship to rewrite
58683
+ */
58649
58684
  async setMasterThemeRelationship(masterPath, themePath) {
58650
58685
  const relsPath2 = masterPath.replace(
58651
58686
  /ppt\/slideMasters\/(slideMaster\d+)\.xml/,
@@ -58653,7 +58688,7 @@ var PptxHandlerRuntime8 = class extends PptxHandlerRuntime7 {
58653
58688
  );
58654
58689
  const relsFile = this.zip.file(relsPath2);
58655
58690
  if (!relsFile) {
58656
- return;
58691
+ return false;
58657
58692
  }
58658
58693
  const relsXml = await relsFile.async("string");
58659
58694
  const relsData = this.parser.parse(relsXml);
@@ -58661,28 +58696,13 @@ var PptxHandlerRuntime8 = class extends PptxHandlerRuntime7 {
58661
58696
  const relationships2 = this.ensureArray(relRoot["Relationship"]);
58662
58697
  const themeRel = relationships2.find((rel) => String(rel["@_Type"] || "").includes("/theme"));
58663
58698
  if (!themeRel) {
58664
- return;
58699
+ return false;
58665
58700
  }
58666
58701
  themeRel["@_Target"] = this.buildRelativeTargetPath(masterPath, themePath);
58667
58702
  relRoot["Relationship"] = relationships2;
58668
58703
  relsData["Relationships"] = relRoot;
58669
58704
  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
- );
58705
+ return true;
58686
58706
  }
58687
58707
  /** The text of a package part, or `undefined` when the package has no such part. */
58688
58708
  async readPartText(path3) {
@@ -58996,8 +59016,6 @@ var PptxHandlerRuntime9 = class _PptxHandlerRuntime extends PptxHandlerRuntime8
58996
59016
  this.masterXmlMap.set(path3, data);
58997
59017
  }
58998
59018
  const masterCSldName = (xmlAttr(sldMaster["p:cSld"], "name") ?? "").trim();
58999
- const bg = sldMaster["p:cSld"]?.["p:bg"];
59000
- const backgroundColor = this.parseBackgroundColor(bg);
59001
59019
  const spTree = sldMaster["p:cSld"]?.["p:spTree"];
59002
59020
  const placeholders = this.extractPlaceholderList(spTree);
59003
59021
  let preserve;
@@ -59051,7 +59069,6 @@ var PptxHandlerRuntime9 = class _PptxHandlerRuntime extends PptxHandlerRuntime8
59051
59069
  results.push({
59052
59070
  path: path3,
59053
59071
  name: masterCSldName.length > 0 ? masterCSldName : void 0,
59054
- backgroundColor,
59055
59072
  themePath,
59056
59073
  layoutPaths: layoutPaths.length > 0 ? layoutPaths : void 0,
59057
59074
  layouts: layouts.length > 0 ? layouts : void 0,
@@ -59189,11 +59206,6 @@ var PptxHandlerRuntime9 = class _PptxHandlerRuntime extends PptxHandlerRuntime8
59189
59206
  layout.clrMapOverride = overrideMap;
59190
59207
  }
59191
59208
  }
59192
- const bg = xmlPath(sldLayout, "p:cSld", "p:bg");
59193
- const bgColor = this.parseBackgroundColor(bg);
59194
- if (bgColor) {
59195
- layout.backgroundColor = bgColor;
59196
- }
59197
59209
  const spTree = xmlPath(sldLayout, "p:cSld", "p:spTree");
59198
59210
  const placeholders = this.extractPlaceholderList(spTree);
59199
59211
  if (placeholders.length > 0) {
@@ -74126,7 +74138,23 @@ var PptxHandlerRuntime54 = class _PptxHandlerRuntime extends PptxHandlerRuntime5
74126
74138
  }
74127
74139
  return this.isStrictOoxml ? "strict" : "transitional";
74128
74140
  }
74141
+ /** The save running now, or the last one: see {@link save}. */
74142
+ saveQueue = Promise.resolve();
74143
+ /**
74144
+ * Saves run one at a time. A save rewrites `this.zip` in place across many awaits and moves
74145
+ * per-part baselines (slide fingerprints, chart data, pending chart updates) while it runs, so
74146
+ * a second save that starts mid-way (a viewer's autosave snapshot firing during the user's own
74147
+ * save) read half-written state: it skipped the slide as unchanged and wrote the chart part's
74148
+ * original XML back over the edit, in both outputs. Each save now waits for the one before it;
74149
+ * one that fails does not hold up the next.
74150
+ */
74129
74151
  async save(slides, options) {
74152
+ const run2 = this.saveQueue.then(() => this.saveNow(slides, options));
74153
+ this.saveQueue = run2.catch(() => void 0);
74154
+ return run2;
74155
+ }
74156
+ /** One save, with the package to itself; callers go through {@link save}. */
74157
+ async saveNow(slides, options) {
74130
74158
  validateSlideGeometry(slides);
74131
74159
  const templates = [
74132
74160
  ...options?.slideMasters ?? [],
@@ -74144,7 +74172,7 @@ var PptxHandlerRuntime54 = class _PptxHandlerRuntime extends PptxHandlerRuntime5
74144
74172
  return this.saveAsLegacyPpt(
74145
74173
  slides,
74146
74174
  options,
74147
- () => this.save(slides, {
74175
+ () => this.saveNow(slides, {
74148
74176
  ...options,
74149
74177
  pptPassword: void 0,
74150
74178
  outputFormat: "pptx",
@@ -78945,6 +78973,25 @@ var PptxHandlerRuntime73 = class extends PptxHandlerRuntime72 {
78945
78973
  }
78946
78974
  return void 0;
78947
78975
  }
78976
+ /**
78977
+ * The colour a slide master or layout paints from its own `p:bg`, resolved exactly as a
78978
+ * slide's background is: through the active master's colour map and format scheme, with
78979
+ * `clrMapOverride` (a layout's `p:clrMapOvr`, or `null`) taking precedence. The caller makes
78980
+ * the part's master active first; a master's `bgRef` on `bg1` means `dk1` under a dark
78981
+ * `p:clrMap`, which no other state can tell.
78982
+ */
78983
+ extractTemplateBackgroundColor(partXml, rootTag, clrMapOverride) {
78984
+ if (!partXml) {
78985
+ return void 0;
78986
+ }
78987
+ const previousOverride = this.currentSlideClrMapOverride;
78988
+ this.currentSlideClrMapOverride = clrMapOverride;
78989
+ try {
78990
+ return this.extractBackgroundColor(partXml, rootTag);
78991
+ } finally {
78992
+ this.currentSlideClrMapOverride = previousOverride;
78993
+ }
78994
+ }
78948
78995
  /**
78949
78996
  * Composite a resolved background colour with its `a:alpha` (or
78950
78997
  * `a:alphaMod`/`a:alphaOff`) opacity onto opaque white.
@@ -79502,6 +79549,31 @@ var PptxHandlerRuntime74 = class extends PptxHandlerRuntime73 {
79502
79549
  const masterFormatScheme = this.masterThemeFormatSchemes.get(masterPath);
79503
79550
  this.themeFormatScheme = masterFormatScheme ?? this.globalThemeFormatSchemeSnapshot;
79504
79551
  }
79552
+ /**
79553
+ * Run `work` with one master's theme state active and no slide colour-map override, then
79554
+ * put back whatever state was active before, so a part parsed on request (a layout preview)
79555
+ * resolves through its own master without disturbing the caller's.
79556
+ */
79557
+ async withMasterThemeState(masterPath, work) {
79558
+ const saved = {
79559
+ colors: this.themeColorMap,
79560
+ fonts: this.themeFontMap,
79561
+ format: this.themeFormatScheme,
79562
+ clrMap: this.currentMasterClrMap,
79563
+ slideClrMap: this.currentSlideClrMapOverride
79564
+ };
79565
+ this.applyMasterThemeState(masterPath);
79566
+ this.currentSlideClrMapOverride = null;
79567
+ try {
79568
+ return await work();
79569
+ } finally {
79570
+ this.themeColorMap = saved.colors;
79571
+ this.themeFontMap = saved.fonts;
79572
+ this.themeFormatScheme = saved.format;
79573
+ this.currentMasterClrMap = saved.clrMap;
79574
+ this.currentSlideClrMapOverride = saved.slideClrMap;
79575
+ }
79576
+ }
79505
79577
  /**
79506
79578
  * Extract the `p:bg/@showAnimation` flag from a slide's XML.
79507
79579
  * Returns `true` when the background should animate, `false` when
@@ -80380,18 +80452,33 @@ var PptxHandlerRuntime78 = class extends PptxHandlerRuntime77 {
80380
80452
  this.rememberUnparsedMasterNodes(partPath, spTree, part.elements);
80381
80453
  }
80382
80454
  /**
80383
- * Populate `elements` on every slide master and on each of its layouts.
80455
+ * Resolve the background of every slide master and of each of its layouts,
80456
+ * and populate their `elements`.
80384
80457
  *
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.
80458
+ * Scheme colours on a master, its own `p:bgRef` included, must resolve
80459
+ * through that master's colour map and theme, so the active master state is
80460
+ * switched per part and reset to the deck-wide snapshot afterwards.
80388
80461
  */
80389
80462
  async enrichSlideMasterElements(masters) {
80390
80463
  for (const master of masters) {
80391
80464
  try {
80392
80465
  this.applyMasterThemeState(master.path);
80466
+ master.backgroundColor = this.extractTemplateBackgroundColor(
80467
+ this.masterXmlMap.get(master.path),
80468
+ "p:sldMaster",
80469
+ null
80470
+ );
80393
80471
  await this.enrichMasterPartElements(master, "p:sldMaster");
80394
80472
  for (const layout of master.layouts ?? []) {
80473
+ const layoutXml3 = this.layoutXmlMap.get(layout.path);
80474
+ const backgroundColor = this.extractTemplateBackgroundColor(
80475
+ layoutXml3,
80476
+ "p:sldLayout",
80477
+ layoutXml3 ? this.parseLayoutClrMapOverride(layoutXml3) : null
80478
+ );
80479
+ if (backgroundColor) {
80480
+ layout.backgroundColor = backgroundColor;
80481
+ }
80395
80482
  await this.enrichMasterPartElements(layout, "p:sldLayout");
80396
80483
  }
80397
80484
  } catch (e) {
@@ -80645,20 +80732,23 @@ var PptxHandlerRuntime80 = class extends PptxHandlerRuntime79 {
80645
80732
  this.layoutCache.delete(layoutPath);
80646
80733
  this.eagerDecodeImages = true;
80647
80734
  }
80648
- let elements2;
80735
+ const masterPath = this.resolveMasterPathForLayout(layoutPath);
80736
+ let parsed;
80649
80737
  try {
80650
- elements2 = await this.getLayoutElementsByPath(layoutPath);
80738
+ parsed = await this.withMasterThemeState(masterPath, async () => ({
80739
+ elements: await this.getLayoutElementsByPath(layoutPath),
80740
+ background: this.resolveLayoutPreviewBackground(layoutXml3, masterPath)
80741
+ }));
80651
80742
  } finally {
80652
80743
  this.eagerDecodeImages = previousEagerDecode;
80653
80744
  }
80654
80745
  const cSld = xmlPath(layoutXml3, "p:sldLayout", "p:cSld");
80655
- const background = this.resolveLayoutPreviewBackground(layoutPath, cSld);
80656
80746
  const preview = {
80657
80747
  path: layoutPath,
80658
80748
  width: this.rawSlideWidthEmu / EMU_PER_PX,
80659
80749
  height: this.rawSlideHeightEmu / EMU_PER_PX,
80660
- ...background,
80661
- elements: elements2,
80750
+ ...parsed.background,
80751
+ elements: parsed.elements,
80662
80752
  placeholders: this.extractPlaceholderList(xmlChild(cSld, "p:spTree"))
80663
80753
  };
80664
80754
  this.layoutPreviewCache.set(layoutPath, preview);
@@ -80694,19 +80784,18 @@ var PptxHandlerRuntime80 = class extends PptxHandlerRuntime79 {
80694
80784
  }
80695
80785
  /**
80696
80786
  * Resolve the background a layout thumbnail should paint, falling back to
80697
- * the layout's master when the layout itself declares none.
80787
+ * the layout's master when the layout itself declares none. Runs with the
80788
+ * master active; the layout's own colour map override applies to an
80789
+ * inherited background too, as a slide's does.
80698
80790
  */
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")
80791
+ resolveLayoutPreviewBackground(layoutXml3, masterPath) {
80792
+ const clrMapOverride = this.parseLayoutClrMapOverride(layoutXml3);
80793
+ const backgroundColor = this.extractTemplateBackgroundColor(layoutXml3, "p:sldLayout", clrMapOverride) ?? this.extractTemplateBackgroundColor(
80794
+ masterPath ? this.masterXmlMap.get(masterPath) : void 0,
80795
+ "p:sldMaster",
80796
+ clrMapOverride
80708
80797
  );
80709
- return masterBackground ? { backgroundColor: masterBackground } : {};
80798
+ return backgroundColor ? { backgroundColor } : {};
80710
80799
  }
80711
80800
  };
80712
80801
 
@@ -81492,11 +81581,275 @@ var PptxHandlerRuntime83 = class extends PptxHandlerRuntime82 {
81492
81581
  }
81493
81582
  };
81494
81583
 
81584
+ // pptx/core/core/runtime/theme-scheme-edit.ts
81585
+ var THEME_COLOR_SCHEME_KEYS = [
81586
+ "dk1",
81587
+ "lt1",
81588
+ "dk2",
81589
+ "lt2",
81590
+ "accent1",
81591
+ "accent2",
81592
+ "accent3",
81593
+ "accent4",
81594
+ "accent5",
81595
+ "accent6",
81596
+ "hlink",
81597
+ "folHlink"
81598
+ ];
81599
+ var DEFAULT_CLR_MAP_ALIASES = {
81600
+ tx1: "dk1",
81601
+ bg1: "lt1",
81602
+ tx2: "dk2",
81603
+ bg2: "lt2"
81604
+ };
81605
+ function normalizeHex2(hex3) {
81606
+ return hex3.replace(/^#/, "").toUpperCase();
81607
+ }
81608
+ function buildSrgbClrNode(hex3) {
81609
+ return { "a:srgbClr": { "@_val": normalizeHex2(hex3) } };
81610
+ }
81611
+ function themeElementsOf(data) {
81612
+ const root = data["a:theme"];
81613
+ return root?.["a:themeElements"];
81614
+ }
81615
+ function applyColorSchemeToThemeXml(data, colorScheme) {
81616
+ const themeElements = themeElementsOf(data);
81617
+ if (!themeElements) {
81618
+ return false;
81619
+ }
81620
+ const clrScheme = themeElements["a:clrScheme"] ?? {};
81621
+ for (const key2 of THEME_COLOR_SCHEME_KEYS) {
81622
+ clrScheme[`a:${key2}`] = buildSrgbClrNode(colorScheme[key2]);
81623
+ }
81624
+ themeElements["a:clrScheme"] = clrScheme;
81625
+ return true;
81626
+ }
81627
+ function applyLatinTypeface(group, latin) {
81628
+ const font = group ?? {};
81629
+ font["a:latin"] = { "@_typeface": latin };
81630
+ if (!font["a:ea"]) {
81631
+ font["a:ea"] = { "@_typeface": "" };
81632
+ }
81633
+ if (!font["a:cs"]) {
81634
+ font["a:cs"] = { "@_typeface": "" };
81635
+ }
81636
+ return font;
81637
+ }
81638
+ function applyFontSchemeToThemeXml(data, fontScheme) {
81639
+ const themeElements = themeElementsOf(data);
81640
+ if (!themeElements) {
81641
+ return false;
81642
+ }
81643
+ const fntScheme = themeElements["a:fontScheme"] ?? {};
81644
+ if (fontScheme.majorFont?.latin) {
81645
+ fntScheme["a:majorFont"] = applyLatinTypeface(
81646
+ fntScheme["a:majorFont"],
81647
+ fontScheme.majorFont.latin
81648
+ );
81649
+ }
81650
+ if (fontScheme.minorFont?.latin) {
81651
+ fntScheme["a:minorFont"] = applyLatinTypeface(
81652
+ fntScheme["a:minorFont"],
81653
+ fontScheme.minorFont.latin
81654
+ );
81655
+ }
81656
+ themeElements["a:fontScheme"] = fntScheme;
81657
+ return true;
81658
+ }
81659
+ function applyColorSchemeToMap(map, colorScheme, clrMap) {
81660
+ for (const key2 of THEME_COLOR_SCHEME_KEYS) {
81661
+ map[key2] = normalizeHex2(colorScheme[key2]);
81662
+ }
81663
+ for (const [alias, defaultTarget] of Object.entries(DEFAULT_CLR_MAP_ALIASES)) {
81664
+ const target = clrMap?.[alias] ?? defaultTarget;
81665
+ const resolved = map[target];
81666
+ if (resolved !== void 0) {
81667
+ map[alias] = resolved;
81668
+ }
81669
+ }
81670
+ }
81671
+ function applyFontSchemeToMap(map, fontScheme) {
81672
+ if (fontScheme.majorFont?.latin) {
81673
+ map["mj-lt"] = fontScheme.majorFont.latin;
81674
+ map["mj-ea"] = fontScheme.majorFont.latin;
81675
+ map["mj-cs"] = fontScheme.majorFont.latin;
81676
+ }
81677
+ if (fontScheme.minorFont?.latin) {
81678
+ map["mn-lt"] = fontScheme.minorFont.latin;
81679
+ map["mn-ea"] = fontScheme.minorFont.latin;
81680
+ map["mn-cs"] = fontScheme.minorFont.latin;
81681
+ }
81682
+ }
81683
+
81684
+ // pptx/core/core/runtime/theme-part-model.ts
81685
+ function colorSchemeFromMap(colorMap) {
81686
+ const scheme = {};
81687
+ for (const key2 of THEME_COLOR_SCHEME_KEYS) {
81688
+ scheme[key2] = colorMap[key2] || "";
81689
+ }
81690
+ return scheme;
81691
+ }
81692
+ function fontGroup(fontMap, prefix, byScript) {
81693
+ const latin = fontMap[`${prefix}-lt`];
81694
+ const eastAsia = fontMap[`${prefix}-ea`];
81695
+ const complexScript = fontMap[`${prefix}-cs`];
81696
+ return {
81697
+ ...latin ? { latin } : {},
81698
+ ...eastAsia ? { eastAsia } : {},
81699
+ ...complexScript ? { complexScript } : {},
81700
+ ...Object.keys(byScript).length > 0 ? { byScript: { ...byScript } } : {}
81701
+ };
81702
+ }
81703
+ function fontSchemeFromMap(fontMap, majorByScript, minorByScript) {
81704
+ return {
81705
+ majorFont: fontGroup(fontMap, "mj", majorByScript),
81706
+ minorFont: fontGroup(fontMap, "mn", minorByScript)
81707
+ };
81708
+ }
81709
+
81710
+ // pptx/core/core/runtime/PptxHandlerRuntimeThemePartModel.ts
81711
+ var FONT_SLOTS = [
81712
+ ["mj", "a:majorFont"],
81713
+ ["mn", "a:minorFont"]
81714
+ ];
81715
+ var PptxHandlerRuntime84 = class extends PptxHandlerRuntime83 {
81716
+ /** Parse one theme part's XML. Side-effect free. */
81717
+ parseThemePartXml(themeXml3) {
81718
+ const themeData = this.parser.parse(themeXml3);
81719
+ const themeRoot = themeData["a:theme"];
81720
+ const themeElements = themeRoot?.["a:themeElements"];
81721
+ const colorScheme = themeElements?.["a:clrScheme"];
81722
+ const fontScheme = themeElements?.["a:fontScheme"];
81723
+ const fmtScheme = themeElements?.["a:fmtScheme"];
81724
+ const text = (value) => String(value || "").trim() || void 0;
81725
+ const colorMap = { ...this.getDefaultSchemeColorMap() };
81726
+ for (const key2 of THEME_COLOR_SCHEME_KEYS) {
81727
+ const parsed = this.parseColorChoice(colorScheme?.[`a:${key2}`]);
81728
+ if (parsed) {
81729
+ colorMap[key2] = parsed;
81730
+ }
81731
+ }
81732
+ const fontMap = {};
81733
+ const typeface = (node) => this.normalizeTypefaceToken(String(node?.["@_typeface"] || ""));
81734
+ for (const [prefix, tag] of FONT_SLOTS) {
81735
+ const group = fontScheme?.[tag];
81736
+ const latin = typeface(group?.["a:latin"]);
81737
+ if (latin) {
81738
+ fontMap[`${prefix}-lt`] = latin;
81739
+ fontMap[`${prefix}-ea`] = latin;
81740
+ fontMap[`${prefix}-cs`] = latin;
81741
+ }
81742
+ const eastAsia = typeface(group?.["a:ea"]);
81743
+ if (eastAsia) {
81744
+ fontMap[`${prefix}-ea`] = eastAsia;
81745
+ }
81746
+ const complexScript = typeface(group?.["a:cs"]);
81747
+ if (complexScript) {
81748
+ fontMap[`${prefix}-cs`] = complexScript;
81749
+ }
81750
+ }
81751
+ const objectDefaultsNode = themeRoot?.["a:objectDefaults"];
81752
+ const objectDefaults = objectDefaultsNode && {
81753
+ spDef: objectDefaultsNode["a:spDef"],
81754
+ lnDef: objectDefaultsNode["a:lnDef"],
81755
+ txDef: objectDefaultsNode["a:txDef"]
81756
+ };
81757
+ const hasObjectDefaults = objectDefaults !== void 0 && (objectDefaults.spDef !== void 0 || objectDefaults.lnDef !== void 0 || objectDefaults.txDef !== void 0);
81758
+ return {
81759
+ name: text(themeRoot?.["@_name"]),
81760
+ colorSchemeName: text(colorScheme?.["@_name"]),
81761
+ fontSchemeName: text(fontScheme?.["@_name"]),
81762
+ colorMap,
81763
+ fontMap,
81764
+ // Per-script fonts (`<a:font script="Hans|Hant|Arab|...">`): M4.
81765
+ majorFontScripts: this.collectFontScriptOverrides(
81766
+ fontScheme?.["a:majorFont"]
81767
+ ),
81768
+ minorFontScripts: this.collectFontScriptOverrides(
81769
+ fontScheme?.["a:minorFont"]
81770
+ ),
81771
+ // objectDefaults: M5.
81772
+ objectDefaults: hasObjectDefaults ? objectDefaults : void 0,
81773
+ extraClrSchemeLst: themeRoot?.["a:extraClrSchemeLst"],
81774
+ custClrLst: themeRoot?.["a:custClrLst"],
81775
+ extLst: themeRoot?.["a:extLst"],
81776
+ formatScheme: fmtScheme ? this.parseFormatScheme(fmtScheme) : void 0
81777
+ };
81778
+ }
81779
+ /**
81780
+ * Record a parsed part under its path: its original XML (byte-stable passthrough on save,
81781
+ * C-H3), its names, per-script fonts and the raw subtrees the save re-emits.
81782
+ */
81783
+ cacheThemePartModel(themePath, themeXml3, model) {
81784
+ this.originalThemeXmlByPath.set(themePath, themeXml3);
81785
+ const keyed = [
81786
+ [this.masterThemeNames, model.name],
81787
+ [this.masterThemeColorSchemeNames, model.colorSchemeName],
81788
+ [this.masterThemeFontSchemeNames, model.fontSchemeName],
81789
+ [this.masterThemeObjectDefaults, model.objectDefaults],
81790
+ [this.masterThemeExtraClrSchemeLst, model.extraClrSchemeLst],
81791
+ [this.masterThemeCustClrLst, model.custClrLst],
81792
+ [this.masterThemeExtLst, model.extLst]
81793
+ ];
81794
+ for (const [map, value] of keyed) {
81795
+ if (value !== void 0) {
81796
+ map.set(themePath, value);
81797
+ }
81798
+ }
81799
+ if (Object.keys(model.majorFontScripts).length > 0) {
81800
+ this.masterThemeMajorFontScripts.set(themePath, model.majorFontScripts);
81801
+ }
81802
+ if (Object.keys(model.minorFontScripts).length > 0) {
81803
+ this.masterThemeMinorFontScripts.set(themePath, model.minorFontScripts);
81804
+ }
81805
+ }
81806
+ /**
81807
+ * Parse `<a:font script="..." typeface="..."/>` children of a major or minor font node into a
81808
+ * `script -> typeface` dictionary. fast-xml-parser collapses repeated tags into arrays, so the
81809
+ * array form is walked regardless of how many siblings are present. Phase 4 Stream A / M4.
81810
+ */
81811
+ collectFontScriptOverrides(fontNode) {
81812
+ const overrides = {};
81813
+ if (!fontNode) {
81814
+ return overrides;
81815
+ }
81816
+ const fontEntries = this.ensureArray(fontNode["a:font"]);
81817
+ for (const entry2 of fontEntries) {
81818
+ const script = String(entry2?.["@_script"] || "").trim();
81819
+ const typeface = this.normalizeTypefaceToken(String(entry2?.["@_typeface"] || ""));
81820
+ if (script && typeface) {
81821
+ overrides[script] = typeface;
81822
+ }
81823
+ }
81824
+ return overrides;
81825
+ }
81826
+ /**
81827
+ * The colour, font and format schemes and name of one theme part in the package, as the part holds
81828
+ * them now (a scheme edit already written to it included). Reads only: the loaded theme, the
81829
+ * masters and what a save writes are unchanged. `undefined` when the package has no such part.
81830
+ */
81831
+ async getThemePartSchemes(themePath) {
81832
+ const path3 = themePath.trim().replace(/\\/g, "/");
81833
+ const themeXml3 = await this.zip.file(path3)?.async("string");
81834
+ if (themeXml3 === void 0) {
81835
+ return void 0;
81836
+ }
81837
+ const model = this.parseThemePartXml(themeXml3);
81838
+ return {
81839
+ path: path3,
81840
+ ...model.name ? { name: model.name } : {},
81841
+ colorScheme: colorSchemeFromMap(model.colorMap),
81842
+ fontScheme: fontSchemeFromMap(model.fontMap, model.majorFontScripts, model.minorFontScripts),
81843
+ ...model.formatScheme ? { formatScheme: model.formatScheme } : {}
81844
+ };
81845
+ }
81846
+ };
81847
+
81495
81848
  // pptx/core/core/runtime/PptxHandlerRuntimeThemeLoading.ts
81496
81849
  function isPresentationThemePartPath(path3) {
81497
81850
  return /^ppt\/theme\/(?!themeOverride)[^/]+\.xml$/iu.test(path3);
81498
81851
  }
81499
- var PptxHandlerRuntime84 = class extends PptxHandlerRuntime83 {
81852
+ var PptxHandlerRuntime85 = class extends PptxHandlerRuntime84 {
81500
81853
  async resolvePrimaryThemePath() {
81501
81854
  const masterFiles = this.zip.file(/^ppt\/slideMasters\/slideMaster\d+\.xml$/);
81502
81855
  if (!masterFiles || masterFiles.length === 0) {
@@ -81572,42 +81925,12 @@ var PptxHandlerRuntime84 = class extends PptxHandlerRuntime83 {
81572
81925
  if (!hasColors && !hasFonts) {
81573
81926
  return void 0;
81574
81927
  }
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
- }
81928
+ const colorScheme = hasColors ? colorSchemeFromMap(this.themeColorMap) : void 0;
81929
+ const fontScheme = hasFonts ? fontSchemeFromMap(
81930
+ this.themeFontMap,
81931
+ this.aggregateFontScriptOverrides(this.masterThemeMajorFontScripts),
81932
+ this.aggregateFontScriptOverrides(this.masterThemeMinorFontScripts)
81933
+ ) : void 0;
81611
81934
  return {
81612
81935
  colorScheme,
81613
81936
  fontScheme,
@@ -81684,134 +82007,10 @@ var PptxHandlerRuntime84 = class extends PptxHandlerRuntime83 {
81684
82007
  return null;
81685
82008
  }
81686
82009
  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 };
82010
+ const model = this.parseThemePartXml(themeXml3);
82011
+ this.cacheThemePartModel(themePath, themeXml3, model);
82012
+ return { colorMap: model.colorMap, fontMap: model.fontMap, formatScheme: model.formatScheme };
81805
82013
  }
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
82014
  /**
81816
82015
  * Flatten a per-theme-path script-override map (`themePath -> {script ->
81817
82016
  * typeface}`) into a single `{script -> typeface}` lookup for
@@ -81829,21 +82028,6 @@ var PptxHandlerRuntime84 = class extends PptxHandlerRuntime83 {
81829
82028
  }
81830
82029
  return aggregate;
81831
82030
  }
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
82031
  /**
81848
82032
  * Resolve the theme file path referenced by a given master's `.rels`.
81849
82033
  * Returns `undefined` when the master has no theme relationship.
@@ -81927,109 +82111,9 @@ var PptxHandlerRuntime84 = class extends PptxHandlerRuntime83 {
81927
82111
  }
81928
82112
  };
81929
82113
 
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
82114
  // pptx/core/core/runtime/PptxHandlerRuntimeThemeProcessing.ts
82031
82115
  var THEME_PART_PATTERN = /^ppt\/theme\/theme\d+\.xml$/;
82032
- var PptxHandlerRuntime85 = class extends PptxHandlerRuntime84 {
82116
+ var PptxHandlerRuntime86 = class extends PptxHandlerRuntime85 {
82033
82117
  /**
82034
82118
  * The theme parts an edit should touch, primary theme first.
82035
82119
  *
@@ -82070,8 +82154,9 @@ var PptxHandlerRuntime85 = class extends PptxHandlerRuntime84 {
82070
82154
  return this.parser.parse(xml);
82071
82155
  }
82072
82156
  /**
82073
- * Parse, edit, and write back every target theme part. Parts the edit
82074
- * cannot apply to (no `a:themeElements`) are left untouched.
82157
+ * Parse, edit, and write back every target theme part (`edit` gets the
82158
+ * part's path too). Parts the edit cannot apply to (no `a:themeElements`)
82159
+ * are left untouched.
82075
82160
  *
82076
82161
  * @returns the paths that were rewritten
82077
82162
  */
@@ -82079,7 +82164,7 @@ var PptxHandlerRuntime85 = class extends PptxHandlerRuntime84 {
82079
82164
  const written = [];
82080
82165
  for (const path3 of await this.resolveThemeEditTargets(themePaths)) {
82081
82166
  const data = await this.readThemePart(path3);
82082
- if (!data || !edit(data)) {
82167
+ if (!data || !edit(data, path3)) {
82083
82168
  continue;
82084
82169
  }
82085
82170
  this.zip.file(path3, this.builder.build(data));
@@ -82181,8 +82266,77 @@ var PptxHandlerRuntime85 = class extends PptxHandlerRuntime84 {
82181
82266
  }
82182
82267
  };
82183
82268
 
82269
+ // pptx/core/core/runtime/PptxHandlerRuntimeThemeSwitching.ts
82270
+ var SLIDE_MASTER_PART = /^ppt\/slideMasters\/slideMaster\d+\.xml$/;
82271
+ function themePartPath(themePath) {
82272
+ const path3 = themePath.trim().replace(/\\/g, "/");
82273
+ return path3.startsWith("ppt/theme/") ? path3 : void 0;
82274
+ }
82275
+ var PptxHandlerRuntime87 = class extends PptxHandlerRuntime86 {
82276
+ /**
82277
+ * Point the first slide master, or every one, at a theme part already in the package. Does
82278
+ * nothing when the package has no such part.
82279
+ */
82280
+ async setPresentationTheme(themePath, applyToAllMasters = true) {
82281
+ const path3 = themePartPath(themePath);
82282
+ if (!path3 || !this.zip.file(path3)) {
82283
+ return;
82284
+ }
82285
+ const masters = this.zip.file(SLIDE_MASTER_PART);
82286
+ for (const master of applyToAllMasters ? masters : masters.slice(0, 1)) {
82287
+ await this.retargetMasterTheme(master.name, path3);
82288
+ }
82289
+ }
82290
+ /**
82291
+ * Point one slide master at a theme part already in the package (Undo of a theme switch puts
82292
+ * each master back on its own part). Does nothing when the package has no such master or part.
82293
+ */
82294
+ async setSlideMasterTheme(masterPath, themePath) {
82295
+ const path3 = themePartPath(themePath);
82296
+ if (!path3 || !this.zip.file(path3) || !SLIDE_MASTER_PART.test(masterPath)) {
82297
+ return;
82298
+ }
82299
+ if (this.zip.file(masterPath)) {
82300
+ await this.retargetMasterTheme(masterPath, path3);
82301
+ }
82302
+ }
82303
+ async retargetMasterTheme(masterPath, themePath) {
82304
+ if (await this.setMasterThemeRelationship(masterPath, themePath)) {
82305
+ await this.adoptMasterTheme(masterPath, themePath);
82306
+ }
82307
+ }
82308
+ /** Point the runtime's theme state for `masterPath` at the part it now uses. */
82309
+ async adoptMasterTheme(masterPath, themePath) {
82310
+ const themeXml3 = await this.zip.file(themePath)?.async("string");
82311
+ if (themeXml3 === void 0) {
82312
+ return;
82313
+ }
82314
+ const model = this.parseThemePartXml(themeXml3);
82315
+ if (!this.originalThemeXmlByPath.has(themePath)) {
82316
+ this.cacheThemePartModel(themePath, themeXml3, model);
82317
+ }
82318
+ this.masterThemePaths.set(masterPath, themePath);
82319
+ this.masterThemeColorMaps.set(masterPath, { ...model.colorMap });
82320
+ this.masterThemeFontMaps.set(masterPath, { ...model.fontMap });
82321
+ if (model.formatScheme) {
82322
+ this.masterThemeFormatSchemes.set(masterPath, model.formatScheme);
82323
+ } else {
82324
+ this.masterThemeFormatSchemes.delete(masterPath);
82325
+ }
82326
+ if (this.zip.file(SLIDE_MASTER_PART)[0]?.name !== masterPath) {
82327
+ return;
82328
+ }
82329
+ this.themeColorMap = { ...model.colorMap };
82330
+ this.themeFontMap = { ...model.fontMap };
82331
+ this.themeFormatScheme = model.formatScheme;
82332
+ this.globalThemeColorMapSnapshot = { ...model.colorMap };
82333
+ this.globalThemeFontMapSnapshot = { ...model.fontMap };
82334
+ this.globalThemeFormatSchemeSnapshot = model.formatScheme;
82335
+ }
82336
+ };
82337
+
82184
82338
  // pptx/core/core/runtime/PptxHandlerRuntimeComments.ts
82185
- var PptxHandlerRuntime86 = class _PptxHandlerRuntime extends PptxHandlerRuntime85 {
82339
+ var PptxHandlerRuntime88 = class _PptxHandlerRuntime extends PptxHandlerRuntime87 {
82186
82340
  /**
82187
82341
  * Parse modern threaded comments (PowerPoint 2019+ / Office 365).
82188
82342
  * Modern comments use `p188:cmLst`/`p15:cmLst` roots within
@@ -82409,7 +82563,7 @@ var PptxHandlerRuntime86 = class _PptxHandlerRuntime extends PptxHandlerRuntime8
82409
82563
  };
82410
82564
 
82411
82565
  // pptx/core/core/runtime/PptxHandlerRuntimeSmartArtXmlUtils.ts
82412
- var PptxHandlerRuntime87 = class extends PptxHandlerRuntime86 {
82566
+ var PptxHandlerRuntime89 = class extends PptxHandlerRuntime88 {
82413
82567
  async readXmlPartByRelationshipId(slidePath, relationshipId) {
82414
82568
  const normalizedRelationshipId = String(relationshipId || "").trim();
82415
82569
  if (normalizedRelationshipId.length === 0) {
@@ -82978,7 +83132,7 @@ function resolveSmartArtTextStyles(paragraphs, resolve) {
82978
83132
  }
82979
83133
 
82980
83134
  // pptx/core/core/runtime/PptxHandlerRuntimeSmartArtParsing.ts
82981
- var PptxHandlerRuntime88 = class _PptxHandlerRuntime extends PptxHandlerRuntime87 {
83135
+ var PptxHandlerRuntime90 = class _PptxHandlerRuntime extends PptxHandlerRuntime89 {
82982
83136
  reportIncompleteSmartArtRelationships(graphicFrame, relationshipIds, slidePath) {
82983
83137
  const missing = [
82984
83138
  ["dm", relationshipIds?.dataRelId],
@@ -83352,7 +83506,7 @@ function resolveSmartArtDrawingPart(slidePath, diagramDataRelationshipId, drawin
83352
83506
  }
83353
83507
 
83354
83508
  // pptx/core/core/runtime/PptxHandlerRuntimeSmartArt.ts
83355
- var PptxHandlerRuntime89 = class _PptxHandlerRuntime extends PptxHandlerRuntime88 {
83509
+ var PptxHandlerRuntime91 = class _PptxHandlerRuntime extends PptxHandlerRuntime90 {
83356
83510
  async getSmartArtDataForGraphicFrame(slidePath, graphicFrame) {
83357
83511
  const graphicData = this.xmlLookupService.getChildByLocalName(
83358
83512
  this.xmlLookupService.getChildByLocalName(graphicFrame, "graphic"),
@@ -83526,7 +83680,7 @@ var PptxHandlerRuntime89 = class _PptxHandlerRuntime extends PptxHandlerRuntime8
83526
83680
  };
83527
83681
 
83528
83682
  // pptx/core/core/runtime/PptxHandlerRuntimeChartDetection.ts
83529
- var PptxHandlerRuntime90 = class extends PptxHandlerRuntime89 {
83683
+ var PptxHandlerRuntime92 = class extends PptxHandlerRuntime91 {
83530
83684
  detectChartType(plotArea) {
83531
83685
  if (!plotArea) {
83532
83686
  return "unknown";
@@ -83736,7 +83890,7 @@ function parseNumberVal(node) {
83736
83890
  const num2 = Number.parseFloat(String(raw2));
83737
83891
  return Number.isFinite(num2) ? num2 : void 0;
83738
83892
  }
83739
- var PptxHandlerRuntime91 = class extends PptxHandlerRuntime90 {
83893
+ var PptxHandlerRuntime93 = class extends PptxHandlerRuntime92 {
83740
83894
  /**
83741
83895
  * Parse `c:plotVisOnly` from the chart root element.
83742
83896
  *
@@ -83995,7 +84149,7 @@ var PptxHandlerRuntime91 = class extends PptxHandlerRuntime90 {
83995
84149
 
83996
84150
  // pptx/core/core/runtime/PptxHandlerRuntimeChartExternalData.ts
83997
84151
  var CHART_USER_SHAPES_REL_TYPE2 = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/chartUserShapes";
83998
- var PptxHandlerRuntime92 = class extends PptxHandlerRuntime91 {
84152
+ var PptxHandlerRuntime94 = class extends PptxHandlerRuntime93 {
83999
84153
  /**
84000
84154
  * Parse `c:externalData` from the chart's `c:chartSpace` and resolve
84001
84155
  * the external relationship target from the chart part's .rels file.
@@ -84155,7 +84309,7 @@ var PptxHandlerRuntime92 = class extends PptxHandlerRuntime91 {
84155
84309
  };
84156
84310
 
84157
84311
  // pptx/core/core/runtime/PptxHandlerRuntimeChartColorStyle.ts
84158
- var PptxHandlerRuntime93 = class extends PptxHandlerRuntime92 {
84312
+ var PptxHandlerRuntime95 = class extends PptxHandlerRuntime94 {
84159
84313
  /**
84160
84314
  * Parse the Office 2013+ chart-style part (`ppt/charts/style#.xml`)
84161
84315
  * referenced from the chart's relationships, sibling to
@@ -84314,7 +84468,7 @@ var PptxHandlerRuntime93 = class extends PptxHandlerRuntime92 {
84314
84468
  };
84315
84469
 
84316
84470
  // pptx/core/core/runtime/PptxHandlerRuntimeChartExParsing.ts
84317
- var PptxHandlerRuntime94 = class extends PptxHandlerRuntime93 {
84471
+ var PptxHandlerRuntime96 = class extends PptxHandlerRuntime95 {
84318
84472
  /**
84319
84473
  * The facts of a chart part that live outside the plot (or in other parts): the external data
84320
84474
  * reference and the embedded workbook's rows, pivot source and formats, the colour-style and
@@ -84432,7 +84586,7 @@ var PptxHandlerRuntime94 = class extends PptxHandlerRuntime93 {
84432
84586
  };
84433
84587
 
84434
84588
  // pptx/core/core/runtime/PptxHandlerRuntimeChartParsing.ts
84435
- var PptxHandlerRuntime95 = class extends PptxHandlerRuntime94 {
84589
+ var PptxHandlerRuntime97 = class extends PptxHandlerRuntime96 {
84436
84590
  /**
84437
84591
  * Parse chart data from a graphic frame element on a slide.
84438
84592
  *
@@ -84716,7 +84870,7 @@ var PptxHandlerRuntime95 = class extends PptxHandlerRuntime94 {
84716
84870
  // pptx/core/core/runtime/PptxHandlerRuntimePresentationStructure.ts
84717
84871
  var XSD_INT_MIN = -2147483648;
84718
84872
  var XSD_INT_MAX = 2147483647;
84719
- var PptxHandlerRuntime96 = class extends PptxHandlerRuntime95 {
84873
+ var PptxHandlerRuntime98 = class extends PptxHandlerRuntime97 {
84720
84874
  parseEditorAnimations(slideXml3) {
84721
84875
  return this.editorAnimationService.parseEditorAnimations(slideXml3);
84722
84876
  }
@@ -84917,7 +85071,7 @@ var PptxHandlerRuntime96 = class extends PptxHandlerRuntime95 {
84917
85071
  };
84918
85072
 
84919
85073
  // pptx/core/core/runtime/PptxHandlerRuntimeEmbeddedFonts.ts
84920
- var PptxHandlerRuntime97 = class extends PptxHandlerRuntime96 {
85074
+ var PptxHandlerRuntime99 = class extends PptxHandlerRuntime98 {
84921
85075
  async getEmbeddedFonts(fontList) {
84922
85076
  if (!fontList || fontList.fonts.length === 0) {
84923
85077
  return [];
@@ -85120,7 +85274,7 @@ var PptxHandlerRuntime97 = class extends PptxHandlerRuntime96 {
85120
85274
 
85121
85275
  // pptx/core/core/runtime/PptxHandlerRuntimeLoadSession.ts
85122
85276
  var MAX_OLE_EMBEDDING_BYTES = 25 * 1024 * 1024;
85123
- var PptxHandlerRuntime98 = class _PptxHandlerRuntime extends PptxHandlerRuntime97 {
85277
+ var PptxHandlerRuntime100 = class _PptxHandlerRuntime extends PptxHandlerRuntime99 {
85124
85278
  isZipContainer(data) {
85125
85279
  const bytes = new Uint8Array(data);
85126
85280
  if (bytes.byteLength < 4) {
@@ -85486,7 +85640,7 @@ var PptxHandlerRuntime98 = class _PptxHandlerRuntime extends PptxHandlerRuntime9
85486
85640
  };
85487
85641
 
85488
85642
  // pptx/core/core/runtime/PptxHandlerRuntimeLoadPipeline.ts
85489
- var PptxHandlerRuntime99 = class extends PptxHandlerRuntime98 {
85643
+ var PptxHandlerRuntime101 = class extends PptxHandlerRuntime100 {
85490
85644
  async buildLoadData(presentationState, slidesWithWarnings, slideMasters) {
85491
85645
  const headerFooter = this.extractHeaderFooter();
85492
85646
  const presentationProperties = await this.parsePresentationProperties();
@@ -85984,7 +86138,7 @@ function refIndex(node) {
85984
86138
  const idx = Number.parseInt(String(node["@_idx"] ?? ""), 10);
85985
86139
  return Number.isFinite(idx) ? idx : void 0;
85986
86140
  }
85987
- var PptxHandlerRuntime100 = class extends PptxHandlerRuntime99 {
86141
+ var PptxHandlerRuntime102 = class extends PptxHandlerRuntime101 {
85988
86142
  /**
85989
86143
  * Resolve a `<p:style>` node (`a:lnRef`, `a:fillRef`, `a:effectRef`,
85990
86144
  * `a:fontRef`) against the current theme's format scheme, with the same
@@ -86047,8 +86201,10 @@ function withKeys(style, from, keys) {
86047
86201
  function refNode(idx, colorXml2) {
86048
86202
  return { "@_idx": String(idx), ...colorXml2 ?? {} };
86049
86203
  }
86050
- var PptxHandlerRuntime101 = class extends PptxHandlerRuntime100 {
86204
+ var PptxHandlerRuntime103 = class extends PptxHandlerRuntime102 {
86051
86205
  effectSchemeCache = /* @__PURE__ */ new Map();
86206
+ /** Every `a:fmtScheme` written into a theme part or over one ({@link restoreThemeFormatScheme}). */
86207
+ heldFormatSchemes = new HeldFormatSchemes();
86052
86208
  /**
86053
86209
  * Resolve a `<p:style>` node as the base class does, against built-in effect scheme
86054
86210
  * `effectSchemeId` instead of the deck's own (the Effects gallery draws each tile this way).
@@ -86101,32 +86257,79 @@ var PptxHandlerRuntime101 = class extends PptxHandlerRuntime100 {
86101
86257
  */
86102
86258
  async applyThemeFormatSchemeXml(fmtSchemeXml) {
86103
86259
  const parsed = this.parseEffectScheme({ fmtSchemeXml });
86104
- if (!parsed) {
86105
- return void 0;
86260
+ return parsed ? this.writeFormatScheme(() => parsed.node) : void 0;
86261
+ }
86262
+ /**
86263
+ * Put back a format scheme the deck held before (Undo and Redo of an Effects pick), as the parts
86264
+ * held it: each theme part a master references gets back what it held the last time the deck's
86265
+ * scheme was `scheme` over those same parts, so a part with a scheme of its own gets its own back
86266
+ * (with no such time, `scheme`'s own element goes into every one). With `themePaths`, `scheme`'s
86267
+ * own element goes into those parts only.
86268
+ *
86269
+ * @returns the deck's format scheme now, or `undefined` (nothing written) for a scheme no part
86270
+ * held while this handler wrote into it
86271
+ */
86272
+ async restoreThemeFormatScheme(scheme, themePaths) {
86273
+ const parts = themePaths ? void 0 : this.heldFormatSchemes.parts(scheme, await this.resolveThemeEditTargets());
86274
+ if (parts) {
86275
+ return this.writeFormatScheme((path3) => parts.get(path3));
86106
86276
  }
86107
- const written = await this.rewriteThemeParts(void 0, (data) => {
86277
+ const element = this.heldFormatSchemes.element(scheme);
86278
+ return element ? this.writeFormatScheme(() => element, themePaths) : void 0;
86279
+ }
86280
+ /**
86281
+ * Write `elementFor(part)` into every theme part a master references (or only `themePaths`),
86282
+ * skipping a part it gives none, holding what each part held and now holds, and refresh the
86283
+ * in-memory format schemes of the masters on those parts and, when the deck's part is among
86284
+ * them, the deck's.
86285
+ */
86286
+ async writeFormatScheme(elementFor, themePaths) {
86287
+ const deckBefore = this.getThemeFormatScheme();
86288
+ const replaced = /* @__PURE__ */ new Map();
86289
+ const schemes = /* @__PURE__ */ new Map();
86290
+ const written = await this.rewriteThemeParts(themePaths, (data, path3) => {
86291
+ const element = elementFor(path3);
86108
86292
  const elements2 = data["a:theme"]?.["a:themeElements"];
86109
- if (!elements2) {
86293
+ if (!element || !elements2) {
86110
86294
  return false;
86111
86295
  }
86112
- elements2["a:fmtScheme"] = structuredClone(parsed.node);
86296
+ const previous = elements2["a:fmtScheme"];
86297
+ if (previous) {
86298
+ this.heldFormatSchemes.hold(this.parseFormatScheme(previous), previous);
86299
+ replaced.set(path3, structuredClone(previous));
86300
+ }
86301
+ const scheme = this.parseFormatScheme(element);
86302
+ this.heldFormatSchemes.hold(scheme, element);
86303
+ elements2["a:fmtScheme"] = structuredClone(element);
86304
+ schemes.set(path3, scheme);
86113
86305
  return true;
86114
86306
  });
86115
86307
  if (written.length === 0) {
86116
86308
  return void 0;
86117
86309
  }
86310
+ if (deckBefore) {
86311
+ this.heldFormatSchemes.holdParts(deckBefore, replaced);
86312
+ }
86118
86313
  for (const path3 of written) {
86119
86314
  const xml = await this.zip.file(path3)?.async("string");
86120
86315
  if (xml !== void 0) {
86121
86316
  this.originalThemeXmlByPath.set(path3, xml);
86122
86317
  }
86318
+ for (const masterPath of this.mastersUsingThemes([path3])) {
86319
+ this.masterThemeFormatSchemes.set(masterPath, schemes.get(path3));
86320
+ }
86123
86321
  }
86124
- for (const masterPath of this.mastersUsingThemes(written)) {
86125
- this.masterThemeFormatSchemes.set(masterPath, parsed.scheme);
86322
+ const primary = await this.resolvePrimaryThemePath();
86323
+ const deck = primary === void 0 ? void 0 : schemes.get(primary);
86324
+ if (deck) {
86325
+ this.globalThemeFormatSchemeSnapshot = deck;
86326
+ this.themeFormatScheme = deck;
86327
+ this.heldFormatSchemes.holdParts(
86328
+ deck,
86329
+ new Map(written.map((path3) => [path3, elementFor(path3)]))
86330
+ );
86126
86331
  }
86127
- this.globalThemeFormatSchemeSnapshot = parsed.scheme;
86128
- this.themeFormatScheme = parsed.scheme;
86129
- return parsed.scheme;
86332
+ return this.getThemeFormatScheme();
86130
86333
  }
86131
86334
  /** The real theme variants the loaded package carries, or none. */
86132
86335
  getThemeVariants() {
@@ -86250,7 +86453,7 @@ function schemeFromColorMap(map) {
86250
86453
  folHlink: pick("folHlink")
86251
86454
  };
86252
86455
  }
86253
- var PptxHandlerRuntime102 = class extends PptxHandlerRuntime101 {
86456
+ var PptxHandlerRuntime104 = class extends PptxHandlerRuntime103 {
86254
86457
  resolveBackgroundStyle(preset) {
86255
86458
  const xml = {
86256
86459
  "p:sld": { "p:cSld": { "p:bg": backgroundRefNode(preset.idx, preset.scheme) } }
@@ -86499,7 +86702,7 @@ function applyPlaceholderFrame(shape, inherited, options, emuPerPx, materializeF
86499
86702
  }
86500
86703
 
86501
86704
  // pptx/core/core/runtime/PptxHandlerRuntimeSdkPlaceholders.ts
86502
- var PptxHandlerRuntime103 = class _PptxHandlerRuntime extends PptxHandlerRuntime102 {
86705
+ var PptxHandlerRuntime105 = class _PptxHandlerRuntime extends PptxHandlerRuntime104 {
86503
86706
  createPlaceholderElement(layoutPath, input, type, options) {
86504
86707
  if (input.type !== "text") throw new Error("Placeholder input must be text");
86505
86708
  const layout = this.layoutXmlMap.get(layoutPath);
@@ -86553,7 +86756,7 @@ var PptxHandlerRuntime103 = class _PptxHandlerRuntime extends PptxHandlerRuntime
86553
86756
  };
86554
86757
 
86555
86758
  // pptx/core/core/runtime/PptxHandlerRuntimeImplementation.ts
86556
- var PptxHandlerRuntime104 = class _PptxHandlerRuntime extends PptxHandlerRuntime103 {
86759
+ var PptxHandlerRuntime106 = class _PptxHandlerRuntime extends PptxHandlerRuntime105 {
86557
86760
  constructor(dependencyFactory = new PptxRuntimeDependencyFactory()) {
86558
86761
  super();
86559
86762
  this.dependencyFactory = dependencyFactory;
@@ -86691,7 +86894,7 @@ var PptxHandlerRuntime104 = class _PptxHandlerRuntime extends PptxHandlerRuntime
86691
86894
  };
86692
86895
 
86693
86896
  // pptx/core/core/PptxHandlerRuntime.ts
86694
- var PptxHandlerRuntime105 = class extends PptxHandlerRuntime104 {
86897
+ var PptxHandlerRuntime107 = class extends PptxHandlerRuntime106 {
86695
86898
  };
86696
86899
 
86697
86900
  // pptx/core/core/PptxHandlerRuntimeFactory.ts
@@ -86702,10 +86905,10 @@ var PptxHandlerRuntimeFactory = class {
86702
86905
  * @returns A freshly constructed runtime ready for loading a PPTX file.
86703
86906
  */
86704
86907
  createRuntime() {
86705
- return new PptxHandlerRuntime105();
86908
+ return new PptxHandlerRuntime107();
86706
86909
  }
86707
86910
  };
86708
- var createDefaultPptxHandlerRuntime = () => new PptxHandlerRuntime105();
86911
+ var createDefaultPptxHandlerRuntime = () => new PptxHandlerRuntime107();
86709
86912
 
86710
86913
  // pptx/core/core/runtime/table-style-editor.ts
86711
86914
  function deepClone(value) {
@@ -89737,10 +89940,32 @@ var PptxHandlerCore = class {
89737
89940
  async setPresentationTheme(themePath, applyToAllMasters = true) {
89738
89941
  await this.runtime.setPresentationTheme(themePath, applyToAllMasters);
89739
89942
  }
89943
+ /**
89944
+ * Point one slide master at a theme part already in the package; scheme edits and saves follow
89945
+ * it. Does nothing when the package has no such master or part.
89946
+ *
89947
+ * @param masterPath - The master's part path (e.g. `ppt/slideMasters/slideMaster2.xml`).
89948
+ * @param themePath - The theme part's path (e.g. `ppt/theme/theme1.xml`).
89949
+ */
89950
+ async setSlideMasterTheme(masterPath, themePath) {
89951
+ await this.runtime.setSlideMasterTheme(masterPath, themePath);
89952
+ }
89953
+ /**
89954
+ * Read one theme part's colour, font and format schemes and its name without changing the
89955
+ * loaded theme, for example to show what switching to it would apply.
89956
+ *
89957
+ * @param themePath - The theme part's path (e.g. `ppt/theme/theme2.xml`).
89958
+ * @returns The part's schemes, or `undefined` when the package has no such part.
89959
+ */
89960
+ async getThemePartSchemes(themePath) {
89961
+ return this.runtime.getThemePartSchemes(themePath);
89962
+ }
89740
89963
  /**
89741
89964
  * Modify the theme’s colour scheme (accent colours, background, text, etc.).
89742
89965
  *
89743
89966
  * @param colorScheme - A {@link PptxThemeColorScheme} with hex colour values.
89967
+ * @param themePaths - Only these theme parts (e.g. `ppt/theme/theme2.xml`); every part a slide
89968
+ * master uses when omitted.
89744
89969
  *
89745
89970
  * @example
89746
89971
  * ```ts
@@ -89753,13 +89978,15 @@ var PptxHandlerCore = class {
89753
89978
  * // => void — colour scheme updated in the in-memory theme XML
89754
89979
  * ```
89755
89980
  */
89756
- async updateThemeColorScheme(colorScheme) {
89757
- await this.runtime.updateThemeColorScheme(colorScheme);
89981
+ async updateThemeColorScheme(colorScheme, themePaths) {
89982
+ await this.runtime.updateThemeColorScheme(colorScheme, themePaths);
89758
89983
  }
89759
89984
  /**
89760
89985
  * Update the theme’s font scheme (heading + body typefaces).
89761
89986
  *
89762
89987
  * @param fontScheme - A {@link PptxThemeFontScheme} with font family names.
89988
+ * @param themePaths - Only these theme parts (e.g. `ppt/theme/theme2.xml`); every part a slide
89989
+ * master uses when omitted.
89763
89990
  *
89764
89991
  * @example
89765
89992
  * ```ts
@@ -89770,16 +89997,18 @@ var PptxHandlerCore = class {
89770
89997
  * // => void — font scheme updated in the in-memory theme XML
89771
89998
  * ```
89772
89999
  */
89773
- async updateThemeFontScheme(fontScheme) {
89774
- await this.runtime.updateThemeFontScheme(fontScheme);
90000
+ async updateThemeFontScheme(fontScheme, themePaths) {
90001
+ await this.runtime.updateThemeFontScheme(fontScheme, themePaths);
89775
90002
  }
89776
90003
  /**
89777
90004
  * Rename the presentation theme.
89778
90005
  *
89779
90006
  * @param name - New display name for the theme.
90007
+ * @param themePaths - Only these theme parts (e.g. `ppt/theme/theme2.xml`); every part a slide
90008
+ * master uses when omitted.
89780
90009
  */
89781
- async updateThemeName(name) {
89782
- await this.runtime.updateThemeName(name);
90010
+ async updateThemeName(name, themePaths) {
90011
+ await this.runtime.updateThemeName(name, themePaths);
89783
90012
  }
89784
90013
  /**
89785
90014
  * Resolve a `<p:style>` block (`a:lnRef` / `a:fillRef` / `a:effectRef` /
@@ -89802,6 +90031,14 @@ var PptxHandlerCore = class {
89802
90031
  async applyThemeFormatSchemeXml(fmtSchemeXml) {
89803
90032
  return this.runtime.applyThemeFormatSchemeXml(fmtSchemeXml);
89804
90033
  }
90034
+ /**
90035
+ * Put a format scheme a theme part held before back into the theme parts (or only `themePaths`),
90036
+ * as the part held it: Undo and Redo of an Effects pick. Only a scheme this handler wrote into a
90037
+ * part or over one can come back; for any other it writes nothing and returns `undefined`.
90038
+ */
90039
+ async restoreThemeFormatScheme(scheme, themePaths) {
90040
+ return this.runtime.restoreThemeFormatScheme(scheme, themePaths);
90041
+ }
89805
90042
  /** The real theme variants the loaded package carries (`themeVariants/` parts), or none. */
89806
90043
  getThemeVariants() {
89807
90044
  return this.runtime.getThemeVariants();
@@ -92313,4 +92550,4 @@ var PresentationBuilder = class {
92313
92550
  * `<p:extLst>` (optional)
92314
92551
  */
92315
92552
 
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 };
92553
+ 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 };