ooxml-core 1.19.1 → 1.20.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 (88) hide show
  1. package/README.md +12 -1
  2. package/dist/{PptxHandler-2V4PQL6O.mjs → PptxHandler-FYD7IYXT.mjs} +2 -2
  3. package/dist/PptxHandler-SITN3K3F.mjs +4 -0
  4. package/dist/{PptxHandler-6TNIQ7S5.cjs → PptxHandler-TEKISCJO.cjs} +3 -3
  5. package/dist/{PresentationBuilder-HQ6C7L4V.mjs → PresentationBuilder-EYI6Z2JP.mjs} +2 -2
  6. package/dist/{PresentationBuilder-G7MPEGXJ.mjs → PresentationBuilder-IMB4DVRN.mjs} +2 -2
  7. package/dist/{PresentationBuilder-RM52LCVN.cjs → PresentationBuilder-NCKASKXU.cjs} +5 -5
  8. package/dist/automation/index.cjs +424 -90
  9. package/dist/automation/index.mjs +423 -91
  10. package/dist/automation/xlsx-read.d.ts +56 -0
  11. package/dist/automation/xlsx-read.d.ts.map +1 -0
  12. package/dist/automation/xlsx.d.ts +105 -4
  13. package/dist/automation/xlsx.d.ts.map +1 -1
  14. package/dist/{chunk-M6GDBVQ7.mjs → chunk-GQYQQ3GA.mjs} +1 -1
  15. package/dist/{chunk-SLNQNVQM.mjs → chunk-LEV2SVMK.mjs} +1 -1
  16. package/dist/{chunk-JUABSM7C.mjs → chunk-LVM3IZJ2.mjs} +1 -1
  17. package/dist/{chunk-TJPUAUWL.mjs → chunk-MN27HKHM.mjs} +8 -194
  18. package/dist/{chunk-4FTUAD2B.mjs → chunk-MNXKRXFB.mjs} +715 -200
  19. package/dist/{chunk-R5FIHHGB.cjs → chunk-NXKATFM5.cjs} +1598 -1204
  20. package/dist/{chunk-ZJ2OKIJN.mjs → chunk-WXY5EDGT.mjs} +592 -198
  21. package/dist/docx/embedded.cjs +4 -1
  22. package/dist/docx/embedded.mjs +4 -1
  23. package/dist/docx/index.cjs +4 -1
  24. package/dist/docx/index.mjs +4 -1
  25. package/dist/docx/load/index.cjs +4 -1
  26. package/dist/docx/load/index.mjs +4 -1
  27. package/dist/docx/write-table.d.ts.map +1 -1
  28. package/dist/index.cjs +25 -0
  29. package/dist/index.mjs +25 -0
  30. package/dist/pptx/automation/index.cjs +887 -453
  31. package/dist/pptx/automation/index.d.ts +2 -2
  32. package/dist/pptx/automation/index.mjs +5 -5
  33. package/dist/pptx/chunks/{index-Bqm-jFG-.d.ts → index-CgFX0T7b.d.ts} +7573 -7508
  34. package/dist/pptx/chunks/index-CgFX0T7b.d.ts.map +1 -0
  35. package/dist/pptx/chunks/{index-B9x557hr.d.ts → index-qwVYoFn6.d.ts} +2 -2
  36. package/dist/pptx/chunks/{index-B9x557hr.d.ts.map → index-qwVYoFn6.d.ts.map} +1 -1
  37. package/dist/pptx/cli/index.cjs +654 -221
  38. package/dist/pptx/cli/index.mjs +4 -4
  39. package/dist/pptx/converter/index.d.ts +1 -1
  40. package/dist/pptx/converter/index.mjs +2 -2
  41. package/dist/pptx/editor/render/find-replace.cjs +14 -14
  42. package/dist/pptx/editor/render/find-replace.d.ts +1 -1
  43. package/dist/pptx/editor/render/find-replace.mjs +1 -1
  44. package/dist/pptx/editor/render/slide-operations.cjs +8 -8
  45. package/dist/pptx/editor/render/slide-operations.mjs +2 -2
  46. package/dist/pptx/index.cjs +991 -619
  47. package/dist/pptx/index.d.ts +3 -3
  48. package/dist/pptx/index.mjs +5 -5
  49. package/dist/visio/index.cjs +61 -7
  50. package/dist/visio/index.mjs +61 -7
  51. package/dist/visio/ui/contract.d.ts +2 -1
  52. package/dist/visio/ui/contract.d.ts.map +1 -1
  53. package/dist/visio/ui/index.cjs +62 -7
  54. package/dist/visio/ui/index.mjs +62 -7
  55. package/dist/xlsx/edit/dimensions.d.ts.map +1 -1
  56. package/dist/xlsx/edit/history-rows.d.ts +7 -0
  57. package/dist/xlsx/edit/history-rows.d.ts.map +1 -0
  58. package/dist/xlsx/edit/history.d.ts +11 -1
  59. package/dist/xlsx/edit/history.d.ts.map +1 -1
  60. package/dist/xlsx/edit/outline.d.ts.map +1 -1
  61. package/dist/xlsx/edit/row-autofit.d.ts.map +1 -1
  62. package/dist/xlsx/index.cjs +235 -54
  63. package/dist/xlsx/index.mjs +235 -54
  64. package/dist/xlsx/layout/merge-sweep.d.ts +36 -0
  65. package/dist/xlsx/layout/merge-sweep.d.ts.map +1 -0
  66. package/dist/xlsx/layout/metrics.d.ts +5 -0
  67. package/dist/xlsx/layout/metrics.d.ts.map +1 -1
  68. package/dist/xlsx/layout/row-autofit.d.ts +6 -0
  69. package/dist/xlsx/layout/row-autofit.d.ts.map +1 -1
  70. package/dist/xlsx/load/index.cjs +61 -7
  71. package/dist/xlsx/load/index.mjs +61 -7
  72. package/dist/xlsx/numfmt/format.d.ts +8 -0
  73. package/dist/xlsx/numfmt/format.d.ts.map +1 -1
  74. package/dist/xlsx/read/sheet-data-source.d.ts.map +1 -1
  75. package/dist/xlsx/ui/index.cjs +281 -55
  76. package/dist/xlsx/ui/index.d.ts +1 -0
  77. package/dist/xlsx/ui/index.d.ts.map +1 -1
  78. package/dist/xlsx/ui/index.mjs +281 -56
  79. package/dist/xlsx/ui/selection-format.d.ts +13 -0
  80. package/dist/xlsx/ui/selection-format.d.ts.map +1 -0
  81. package/dist/xml/index.cjs +25 -0
  82. package/dist/xml/index.mjs +25 -0
  83. package/dist/xml/lite.d.ts.map +1 -1
  84. package/package.json +2 -2
  85. package/dist/PptxHandler-HSPKEP5E.mjs +0 -4
  86. package/dist/pptx/chunks/index-Bqm-jFG-.d.ts.map +0 -1
  87. /package/dist/{chunk-NYTR4UZ5.cjs → chunk-3IENHIFD.cjs} +0 -0
  88. /package/dist/{chunk-XTSHZGSM.mjs → chunk-CC5UNZOO.mjs} +0 -0
@@ -1,4 +1,4 @@
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, XML_PROLOG, DGM_XMLNS, xmlEscape, 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, writeChartColorChoice, parseChartFormulaRange, expandRangeAddresses, applyCellWritesToWorksheet, stripParentDirSegments, parseChartUniqueId, buildChartMarkerXml, chartGradientsEqual, chartColorChoiceValue, preservesSpreadsheetXmlWhitespace, buildEffectDagTreeFromXml, syncPictureShapeTypeWithCropShape, buildSrgbColorChoice, fetchUrlToBytes, parseChartWideTextStyle, parseDefRPrTextStyle, parseChartDataLabelOptions, shadowOffsetToDistanceAndDirection, positiveFixedAngleAttribute, xmlAttrNumber, parseCustomShows, parseShapeProps, parseActiveXControlsFromSlide, convertMetafileToDataUrl, blobUrlToDataUrl, first, children, 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, MIN_ELEMENT_SIZE, createDrawingObjectId, DEFAULT_TEXT_FONT_SIZE, EncryptedFileError, decodePptxJsonText, deserializePptxFromJson, applyImportedPptxData, DEFAULT_CHART_GRADIENT_ANGLE, supportsChartGradientFill, svgToCustomGeometryPaths, 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, escAttr, escText, parseDrawingLineDash, parseLineSpacingMultiplier, parseLineSpacingExactPt, backgroundStylePreset, isDarkColorMap, backgroundStyleColorMap, reResolveElementsForColorMapChange, parseEncryptionInfo, RC4_ALG_ID, isOle2CompoundFile, ENTRY_TYPE_ROOT, PML_XMLNS, solidFill, esc, OOXML_PERCENT_UNITS, findThemeEffectScheme, wrapFormatSchemeXml, effectIsPurelyStyleMatrix, emu, loadThemeVariants, parsePresentationDrawingGuides, parsePresentationSmartTags, resolveLayoutDisplayName, gradFill, detectDigitalSignatures, unwrapOleEmbedding, mimeTypeForOleFile, oleBytesToDataUrl, extractGuidFromPartName, deobfuscateFont, detectFontFormat, parseKinsoku, parseLineStyle, parseChartUpDownBars, parseDataTable, parseChart3DSurfaces, parseChartAxes, parseBubbleChartOptions, parseChartLayouts, parseCxChartSeries, parseChartDataPointPictureBlipRel, parseSeriesDataPoints, parseMarker, parseSeriesDataLabels, parseChartDataPointPicture, parseImplicitBlipPictureFill, parseEmbeddedXlsx, relAttr, buildXml, EMU_PER_POINT, chartTrendlineKind, parseChartManualLayout, parseDiagramRelationshipIds, parseSmartArtTextParagraphs, firstParagraphRuns, smartArtParagraphsText, parseSmartArtPresLayoutVars, readChartManualLayoutValues, parseSmartArtConnection, projectSmartArtNodeText, resolveSmartArtNodeStyleRoles, resolveSmartArtNodeCoherent3DOff, parseSmartArtDefinitionMetadata, parseSmartArtColorStyleLabels, buildSmartArtColorLists, buildSmartArtColorRoleMap, parseSmartArtQuickStyleLabels, resolveSmartArtEffectIntensity, parseSmartArtStyleLabelRefs, extractStyleReferenceColorXml, withThemePlaceholderColor, getElementOrientationMatrix, isTextOrientationMatrix, TEXT_ORIENTATION_IDENTITY, multiplyTextOrientationMatrices, CHART_ERROR_VALUE_TYPES, CHART_ERROR_BAR_TYPES, CHART_ERROR_BAR_DIRECTIONS } from './chunk-SLNQNVQM.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, XML_PROLOG, DGM_XMLNS, xmlEscape, 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, writeChartColorChoice, parseChartFormulaRange, expandRangeAddresses, applyCellWritesToWorksheet, stripParentDirSegments, parseChartUniqueId, buildChartMarkerXml, chartGradientsEqual, chartColorChoiceValue, preservesSpreadsheetXmlWhitespace, buildEffectDagTreeFromXml, syncPictureShapeTypeWithCropShape, buildSrgbColorChoice, fetchUrlToBytes, parseChartWideTextStyle, parseDefRPrTextStyle, parseChartDataLabelOptions, shadowOffsetToDistanceAndDirection, positiveFixedAngleAttribute, xmlAttrNumber, parseCustomShows, parseShapeProps, parseActiveXControlsFromSlide, convertMetafileToDataUrl, blobUrlToDataUrl, first, children, 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, 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, relAttr, buildXml, EMU_PER_POINT, chartTrendlineKind, parseChartManualLayout, parseDiagramRelationshipIds, parseSmartArtTextParagraphs, firstParagraphRuns, smartArtParagraphsText, parseSmartArtPresLayoutVars, readChartManualLayoutValues, parseSmartArtConnection, projectSmartArtNodeText, resolveSmartArtNodeStyleRoles, resolveSmartArtNodeCoherent3DOff, parseSmartArtDefinitionMetadata, parseSmartArtColorStyleLabels, buildSmartArtColorLists, buildSmartArtColorRoleMap, parseSmartArtQuickStyleLabels, resolveSmartArtEffectIntensity, parseSmartArtStyleLabelRefs, extractStyleReferenceColorXml, withThemePlaceholderColor, getElementOrientationMatrix, isTextOrientationMatrix, TEXT_ORIENTATION_IDENTITY, multiplyTextOrientationMatrices, CHART_ERROR_VALUE_TYPES, CHART_ERROR_BAR_TYPES, CHART_ERROR_BAR_DIRECTIONS } from './chunk-LEV2SVMK.mjs';
2
2
  import { openPptxZip, DIGITAL_SIGNATURE_ORIGIN_REL_TYPE, openNestedZip, DEFAULT_MAX_UNCOMPRESSED_BYTES, guardZip, ZipBombError, MAX_ZIP_ENTRY_COUNT } from './chunk-M4XLF4R7.mjs';
3
3
  import { resolveSmartArtLayoutCategory } from './chunk-3GXV5MPC.mjs';
4
4
  import { cloneXmlObject, applySmartArtLayoutDefinition, cloneSlide, parseSmartArtLayoutDefinition } from './chunk-54S5A5PZ.mjs';
@@ -3236,6 +3236,153 @@ function materializeInheritedShapeTransform(shape, element) {
3236
3236
  return transform2;
3237
3237
  }
3238
3238
 
3239
+ // pptx/core/utils/placeholder-xml.ts
3240
+ function findNonVisualProps(rawXml) {
3241
+ for (const container of ["p:nvSpPr", "p:nvPicPr", "p:nvGraphicFramePr"]) {
3242
+ const parent = rawXml[container];
3243
+ const nvPr = parent?.["p:nvPr"];
3244
+ if (nvPr) {
3245
+ return nvPr;
3246
+ }
3247
+ }
3248
+ return void 0;
3249
+ }
3250
+ function retargetPlaceholder(rawXml, target) {
3251
+ const nvPr = findNonVisualProps(rawXml);
3252
+ if (!nvPr) {
3253
+ return;
3254
+ }
3255
+ const ph = nvPr["p:ph"] ?? {};
3256
+ nvPr["p:ph"] = ph;
3257
+ if (target.type) {
3258
+ ph["@_type"] = target.type;
3259
+ } else {
3260
+ delete ph["@_type"];
3261
+ }
3262
+ if (target.idx !== void 0) {
3263
+ ph["@_idx"] = target.idx;
3264
+ } else {
3265
+ delete ph["@_idx"];
3266
+ }
3267
+ }
3268
+ function setRawXmlTransform(rawXml, xEmu, yEmu, cxEmu, cyEmu) {
3269
+ const spPr = rawXml["p:spPr"];
3270
+ if (!spPr) {
3271
+ return;
3272
+ }
3273
+ const xfrm = spPr["a:xfrm"] ?? {};
3274
+ spPr["a:xfrm"] = xfrm;
3275
+ const off = xfrm["a:off"] ?? {};
3276
+ xfrm["a:off"] = off;
3277
+ off["@_x"] = String(xEmu);
3278
+ off["@_y"] = String(yEmu);
3279
+ const ext = xfrm["a:ext"] ?? {};
3280
+ xfrm["a:ext"] = ext;
3281
+ ext["@_cx"] = String(cxEmu);
3282
+ ext["@_cy"] = String(cyEmu);
3283
+ }
3284
+ function createEmptyPlaceholderElement(target, xEmu, yEmu, cxEmu, cyEmu, uniqueId) {
3285
+ if (cxEmu <= 0 || cyEmu <= 0) {
3286
+ return null;
3287
+ }
3288
+ const phNode = {};
3289
+ if (target.type) {
3290
+ phNode["@_type"] = target.type;
3291
+ }
3292
+ if (target.idx !== void 0) {
3293
+ phNode["@_idx"] = target.idx;
3294
+ }
3295
+ const rawXml = {
3296
+ "p:nvSpPr": {
3297
+ "p:cNvPr": {
3298
+ "@_id": uniqueId,
3299
+ "@_name": `Placeholder ${target.type || "content"}`
3300
+ },
3301
+ "p:cNvSpPr": {
3302
+ "a:spLocks": { "@_noGrp": "1" }
3303
+ },
3304
+ "p:nvPr": {
3305
+ "p:ph": phNode
3306
+ }
3307
+ },
3308
+ "p:spPr": {
3309
+ "a:xfrm": {
3310
+ "a:off": { "@_x": String(xEmu), "@_y": String(yEmu) },
3311
+ "a:ext": { "@_cx": String(cxEmu), "@_cy": String(cyEmu) }
3312
+ }
3313
+ },
3314
+ "p:txBody": {
3315
+ "a:bodyPr": {},
3316
+ "a:lstStyle": {},
3317
+ "a:p": { "a:endParaRPr": { "@_lang": "en-US" } }
3318
+ }
3319
+ };
3320
+ return {
3321
+ type: "text",
3322
+ id: `ph-${target.type || "content"}-${target.idx ?? "0"}-${uniqueId}`,
3323
+ x: Math.round(xEmu / EMU_PER_PX),
3324
+ y: Math.round(yEmu / EMU_PER_PX),
3325
+ width: Math.round(cxEmu / EMU_PER_PX),
3326
+ height: Math.round(cyEmu / EMU_PER_PX),
3327
+ text: "",
3328
+ rawXml
3329
+ };
3330
+ }
3331
+
3332
+ // pptx/core/core/runtime/save-geometry-validation.ts
3333
+ var FRAME_FIELDS = ["x", "y", "width", "height"];
3334
+ var OPTIONAL_FIELDS = [
3335
+ "xEmu",
3336
+ "yEmu",
3337
+ "widthEmu",
3338
+ "heightEmu",
3339
+ "rotation",
3340
+ "skewX",
3341
+ "skewY",
3342
+ "chOffXEmu",
3343
+ "chOffYEmu",
3344
+ "chExtWidthEmu",
3345
+ "chExtHeightEmu"
3346
+ ];
3347
+ function omitsInheritedFrame(element) {
3348
+ if (!["text", "shape", "picture", "media"].includes(element.type) || !element.rawXml)
3349
+ return false;
3350
+ if (!xmlHasChild(findNonVisualProps(element.rawXml), "p:ph")) return false;
3351
+ if (xmlHasChild(xmlChild(element.rawXml, "p:spPr"), "a:xfrm") || xmlHasChild(element.rawXml, "p:xfrm"))
3352
+ return false;
3353
+ const baseline = element.inheritedTransform;
3354
+ if (!baseline) return FRAME_FIELDS.every((key2) => element[key2] === void 0);
3355
+ return FRAME_FIELDS.every(
3356
+ (key2) => Number.isFinite(baseline[key2]) && (element[key2] === void 0 || element[key2] === baseline[key2])
3357
+ ) && ["rotation", "skewX", "skewY", "flipHorizontal", "flipVertical"].every(
3358
+ (key2) => (element[key2] ?? 0) === (baseline[key2] ?? 0)
3359
+ );
3360
+ }
3361
+ function validateElementGeometry(element, context, emuPerPx = 9525) {
3362
+ const inherited = omitsInheritedFrame(element);
3363
+ const record2 = element;
3364
+ const fields = [...inherited ? [] : FRAME_FIELDS, ...OPTIONAL_FIELDS];
3365
+ for (const field of fields) {
3366
+ const value = record2[field];
3367
+ if (OPTIONAL_FIELDS.includes(field) && value === void 0) continue;
3368
+ if (typeof value !== "number" || !Number.isFinite(value) || !Number.isFinite(value * emuPerPx)) {
3369
+ throw new Error(
3370
+ `${context}: element '${element.id}' (${element.name ?? "unnamed"}, type=${element.type}) has invalid ${field}=${String(value)}; expected a finite number`
3371
+ );
3372
+ }
3373
+ }
3374
+ if (element.type === "group") {
3375
+ for (const child16 of element.children) validateElementGeometry(child16, context, emuPerPx);
3376
+ }
3377
+ }
3378
+ function validateSlideGeometry(slides) {
3379
+ for (const slide of slides) {
3380
+ for (const element of slide.elements) {
3381
+ validateElementGeometry(element, `Slide ${slide.slideNumber} (${slide.id})`);
3382
+ }
3383
+ }
3384
+ }
3385
+
3239
3386
  // pptx/core/core/builders/PptxElementTransformUpdater.ts
3240
3387
  var PptxElementTransformUpdater = class {
3241
3388
  applyTransform(shape, element, emuPerPx, enclosingGroupChildSpace) {
@@ -3244,6 +3391,7 @@ var PptxElementTransformUpdater = class {
3244
3391
  if (!transform2) {
3245
3392
  return;
3246
3393
  }
3394
+ validateElementGeometry(element, "Transform writer", emuPerPx);
3247
3395
  if (!transform2["a:off"]) {
3248
3396
  transform2["a:off"] = {};
3249
3397
  }
@@ -34871,6 +35019,75 @@ var PptxSaveConstantsFactory = class {
34871
35019
  var defaultPptxSaveConstantsFactory = new PptxSaveConstantsFactory();
34872
35020
  var createPptxSaveConstants = (conformance = "transitional") => defaultPptxSaveConstantsFactory.create(conformance);
34873
35021
 
35022
+ // pptx/core/utils/placeholder-remap.ts
35023
+ var TITLE_ROLE = /* @__PURE__ */ new Set(["title", "ctrtitle"]);
35024
+ var CONTENT_ROLE = /* @__PURE__ */ new Set([
35025
+ "body",
35026
+ "obj",
35027
+ "subtitle",
35028
+ "pic",
35029
+ "chart",
35030
+ "tbl",
35031
+ "media",
35032
+ "clipart",
35033
+ "dgm"
35034
+ ]);
35035
+ function placeholderContentRole(type) {
35036
+ const declared = (type ?? "").trim().toLowerCase() || "body";
35037
+ if (TITLE_ROLE.has(declared)) {
35038
+ return "title";
35039
+ }
35040
+ if (CONTENT_ROLE.has(declared)) {
35041
+ return "content";
35042
+ }
35043
+ return declared;
35044
+ }
35045
+ function preferredPlaceholderTypes(element) {
35046
+ switch (element.type) {
35047
+ case "image":
35048
+ case "picture":
35049
+ return ["pic", "obj", "body"];
35050
+ case "chart":
35051
+ return ["chart", "obj", "body"];
35052
+ case "table":
35053
+ return ["tbl", "obj", "body"];
35054
+ case "media":
35055
+ case "model3d":
35056
+ return ["media", "pic", "obj", "body"];
35057
+ case "smartArt":
35058
+ return ["dgm", "obj", "body"];
35059
+ case "text":
35060
+ return ["body", "subtitle", "obj"];
35061
+ default:
35062
+ return ["obj", "body"];
35063
+ }
35064
+ }
35065
+ function scorePlaceholderMatch(element, source, target) {
35066
+ if (placeholderContentRole(source.type) !== placeholderContentRole(target.type)) {
35067
+ return -1;
35068
+ }
35069
+ const sourceType = normalizeType(source.type);
35070
+ const targetType = normalizeType(target.type);
35071
+ let score = 1;
35072
+ if (source.idx !== void 0 && source.idx === target.idx) {
35073
+ score += 100;
35074
+ }
35075
+ if (sourceType === targetType) {
35076
+ score += 50;
35077
+ }
35078
+ const preferred = preferredPlaceholderTypes(element).indexOf(targetType);
35079
+ if (preferred >= 0) {
35080
+ score += 30 - preferred * 5;
35081
+ }
35082
+ if (targetType === "obj") {
35083
+ score += 10;
35084
+ }
35085
+ return score;
35086
+ }
35087
+ function normalizeType(type) {
35088
+ return (type ?? "").trim().toLowerCase() || "body";
35089
+ }
35090
+
34874
35091
  // pptx/core/core/runtime/master-save-helpers.ts
34875
35092
  function applyHeaderFooterFlagsToNode(root, flags) {
34876
35093
  if (!flags || Object.keys(flags).length === 0) {
@@ -52902,168 +53119,6 @@ function buildChartUserShapesDrawingXml(shapes) {
52902
53119
  return { "c:userShapes": root };
52903
53120
  }
52904
53121
 
52905
- // pptx/core/utils/placeholder-remap.ts
52906
- var TITLE_ROLE = /* @__PURE__ */ new Set(["title", "ctrtitle"]);
52907
- var CONTENT_ROLE = /* @__PURE__ */ new Set([
52908
- "body",
52909
- "obj",
52910
- "subtitle",
52911
- "pic",
52912
- "chart",
52913
- "tbl",
52914
- "media",
52915
- "clipart",
52916
- "dgm"
52917
- ]);
52918
- function placeholderContentRole(type) {
52919
- const declared = (type ?? "").trim().toLowerCase() || "body";
52920
- if (TITLE_ROLE.has(declared)) {
52921
- return "title";
52922
- }
52923
- if (CONTENT_ROLE.has(declared)) {
52924
- return "content";
52925
- }
52926
- return declared;
52927
- }
52928
- function preferredPlaceholderTypes(element) {
52929
- switch (element.type) {
52930
- case "image":
52931
- case "picture":
52932
- return ["pic", "obj", "body"];
52933
- case "chart":
52934
- return ["chart", "obj", "body"];
52935
- case "table":
52936
- return ["tbl", "obj", "body"];
52937
- case "media":
52938
- case "model3d":
52939
- return ["media", "pic", "obj", "body"];
52940
- case "smartArt":
52941
- return ["dgm", "obj", "body"];
52942
- case "text":
52943
- return ["body", "subtitle", "obj"];
52944
- default:
52945
- return ["obj", "body"];
52946
- }
52947
- }
52948
- function scorePlaceholderMatch(element, source, target) {
52949
- if (placeholderContentRole(source.type) !== placeholderContentRole(target.type)) {
52950
- return -1;
52951
- }
52952
- const sourceType = normalizeType(source.type);
52953
- const targetType = normalizeType(target.type);
52954
- let score = 1;
52955
- if (source.idx !== void 0 && source.idx === target.idx) {
52956
- score += 100;
52957
- }
52958
- if (sourceType === targetType) {
52959
- score += 50;
52960
- }
52961
- const preferred = preferredPlaceholderTypes(element).indexOf(targetType);
52962
- if (preferred >= 0) {
52963
- score += 30 - preferred * 5;
52964
- }
52965
- if (targetType === "obj") {
52966
- score += 10;
52967
- }
52968
- return score;
52969
- }
52970
- function normalizeType(type) {
52971
- return (type ?? "").trim().toLowerCase() || "body";
52972
- }
52973
-
52974
- // pptx/core/utils/placeholder-xml.ts
52975
- function findNonVisualProps(rawXml) {
52976
- for (const container of ["p:nvSpPr", "p:nvPicPr", "p:nvGraphicFramePr"]) {
52977
- const parent = rawXml[container];
52978
- const nvPr = parent?.["p:nvPr"];
52979
- if (nvPr) {
52980
- return nvPr;
52981
- }
52982
- }
52983
- return void 0;
52984
- }
52985
- function retargetPlaceholder(rawXml, target) {
52986
- const nvPr = findNonVisualProps(rawXml);
52987
- if (!nvPr) {
52988
- return;
52989
- }
52990
- const ph = nvPr["p:ph"] ?? {};
52991
- nvPr["p:ph"] = ph;
52992
- if (target.type) {
52993
- ph["@_type"] = target.type;
52994
- } else {
52995
- delete ph["@_type"];
52996
- }
52997
- if (target.idx !== void 0) {
52998
- ph["@_idx"] = target.idx;
52999
- } else {
53000
- delete ph["@_idx"];
53001
- }
53002
- }
53003
- function setRawXmlTransform(rawXml, xEmu, yEmu, cxEmu, cyEmu) {
53004
- const spPr = rawXml["p:spPr"];
53005
- if (!spPr) {
53006
- return;
53007
- }
53008
- const xfrm = spPr["a:xfrm"] ?? {};
53009
- spPr["a:xfrm"] = xfrm;
53010
- const off = xfrm["a:off"] ?? {};
53011
- xfrm["a:off"] = off;
53012
- off["@_x"] = String(xEmu);
53013
- off["@_y"] = String(yEmu);
53014
- const ext = xfrm["a:ext"] ?? {};
53015
- xfrm["a:ext"] = ext;
53016
- ext["@_cx"] = String(cxEmu);
53017
- ext["@_cy"] = String(cyEmu);
53018
- }
53019
- function createEmptyPlaceholderElement(target, xEmu, yEmu, cxEmu, cyEmu, uniqueId) {
53020
- if (cxEmu <= 0 || cyEmu <= 0) {
53021
- return null;
53022
- }
53023
- const phNode = {};
53024
- if (target.type) {
53025
- phNode["@_type"] = target.type;
53026
- }
53027
- if (target.idx !== void 0) {
53028
- phNode["@_idx"] = target.idx;
53029
- }
53030
- const rawXml = {
53031
- "p:nvSpPr": {
53032
- "p:cNvPr": {
53033
- "@_id": uniqueId,
53034
- "@_name": `Placeholder ${target.type || "content"}`
53035
- },
53036
- "p:cNvSpPr": {
53037
- "a:spLocks": { "@_noGrp": "1" }
53038
- },
53039
- "p:nvPr": {
53040
- "p:ph": phNode
53041
- }
53042
- },
53043
- "p:spPr": {
53044
- "a:xfrm": {
53045
- "a:off": { "@_x": String(xEmu), "@_y": String(yEmu) },
53046
- "a:ext": { "@_cx": String(cxEmu), "@_cy": String(cyEmu) }
53047
- }
53048
- },
53049
- "p:txBody": {
53050
- "a:bodyPr": {},
53051
- "a:lstStyle": {},
53052
- "a:p": { "a:endParaRPr": { "@_lang": "en-US" } }
53053
- }
53054
- };
53055
- return {
53056
- type: "text",
53057
- id: `ph-${target.type || "content"}-${target.idx ?? "0"}-${uniqueId}`,
53058
- x: Math.round(xEmu / EMU_PER_PX),
53059
- y: Math.round(yEmu / EMU_PER_PX),
53060
- width: Math.round(cxEmu / EMU_PER_PX),
53061
- height: Math.round(cyEmu / EMU_PER_PX),
53062
- text: "",
53063
- rawXml
53064
- };
53065
- }
53066
-
53067
53122
  // pptx/core/utils/text-fill-blip.ts
53068
53123
  function resolveTextFillBlip(blipFill, lookupTarget, resolveArchivePath, allowExternal) {
53069
53124
  const blip = blipFill["a:blip"];
@@ -71966,6 +72021,19 @@ var PptxHandlerRuntime54 = class _PptxHandlerRuntime extends PptxHandlerRuntime5
71966
72021
  return this.isStrictOoxml ? "strict" : "transitional";
71967
72022
  }
71968
72023
  async save(slides, options) {
72024
+ validateSlideGeometry(slides);
72025
+ const templates = [
72026
+ ...options?.slideMasters ?? [],
72027
+ ...options?.slideLayouts ?? [],
72028
+ ...options?.slideMasters?.flatMap((master) => master.layouts ?? []) ?? [],
72029
+ ...options?.notesMaster ? [options.notesMaster] : [],
72030
+ ...options?.handoutMaster ? [options.handoutMaster] : []
72031
+ ];
72032
+ for (const template of templates) {
72033
+ for (const element of template.elements ?? []) {
72034
+ validateElementGeometry(element, `Template (${template.path})`);
72035
+ }
72036
+ }
71969
72037
  if (options?.outputFormat === "ppt") {
71970
72038
  return this.saveAsLegacyPpt(
71971
72039
  slides,
@@ -72895,8 +72963,7 @@ var PptxHandlerRuntime59 = class extends PptxHandlerRuntime58 {
72895
72963
  return this.scanPlaceholderBuckets(spTree, (info) => info?.type === type);
72896
72964
  }
72897
72965
  /** The layout and master counterparts of a placeholder, unmerged. */
72898
- findPlaceholderContexts(slidePath, expected) {
72899
- const layoutPath = this.resolveLayoutPathForSlide(slidePath);
72966
+ findPlaceholderContexts(slidePath, expected, layoutPath = this.resolveLayoutPathForSlide(slidePath)) {
72900
72967
  if (!layoutPath) {
72901
72968
  return {};
72902
72969
  }
@@ -72908,10 +72975,11 @@ var PptxHandlerRuntime59 = class extends PptxHandlerRuntime58 {
72908
72975
  const master = this.findPlaceholderInShapeTree(masterSpTree, expected) ?? this.findSingletonPlaceholderInShapeTree(masterSpTree, expected);
72909
72976
  return { layout, master };
72910
72977
  }
72911
- findPlaceholderContext(slidePath, expected) {
72978
+ findPlaceholderContext(slidePath, expected, layoutPath) {
72912
72979
  const { layout: layoutContext, master: masterContext } = this.findPlaceholderContexts(
72913
72980
  slidePath,
72914
- expected
72981
+ expected,
72982
+ layoutPath
72915
72983
  );
72916
72984
  if (!layoutContext) {
72917
72985
  return masterContext;
@@ -72937,8 +73005,8 @@ var PptxHandlerRuntime59 = class extends PptxHandlerRuntime58 {
72937
73005
  * a master `p:sp`), so the layout keeps winning exactly as it does when
72938
73006
  * both are shapes.
72939
73007
  */
72940
- findPlaceholderNode(slidePath, expected) {
72941
- const { layout, master } = this.findPlaceholderContexts(slidePath, expected);
73008
+ findPlaceholderNode(slidePath, expected, layoutPath) {
73009
+ const { layout, master } = this.findPlaceholderContexts(slidePath, expected, layoutPath);
72942
73010
  const firstNode2 = (context) => context?.shape ?? context?.picture ?? context?.graphicFrame;
72943
73011
  const layoutNode = firstNode2(layout);
72944
73012
  const masterNode = firstNode2(master);
@@ -72979,8 +73047,7 @@ var PptxHandlerRuntime59 = class extends PptxHandlerRuntime58 {
72979
73047
  * reference. Checks the layout cache first, then the master cache, and
72980
73048
  * merges them so that layout values take priority over master values.
72981
73049
  */
72982
- lookupPlaceholderDefaults(slidePath, phInfo) {
72983
- const layoutPath = this.resolveLayoutPathForSlide(slidePath);
73050
+ lookupPlaceholderDefaults(slidePath, phInfo, layoutPath = this.resolveLayoutPathForSlide(slidePath)) {
72984
73051
  if (!layoutPath) {
72985
73052
  return void 0;
72986
73053
  }
@@ -75066,14 +75133,14 @@ var PptxHandlerRuntime66 = class extends PptxHandlerRuntime65 {
75066
75133
 
75067
75134
  // pptx/core/core/runtime/PptxHandlerRuntimeShapeParsing.ts
75068
75135
  var PptxHandlerRuntime67 = class _PptxHandlerRuntime extends PptxHandlerRuntime66 {
75069
- parseShape(shape, id, slidePath) {
75136
+ parseShape(shape, id, slidePath, layoutPath) {
75070
75137
  try {
75071
75138
  const spPr = shape["p:spPr"];
75072
75139
  const slideRelationshipMap = slidePath ? this.slideRelsMap.get(slidePath) : void 0;
75073
75140
  const placeholderInfo = this.extractPlaceholderInfo(
75074
75141
  shape?.["p:nvSpPr"]?.["p:nvPr"]
75075
75142
  );
75076
- const inheritedPlaceholder = slidePath && placeholderInfo ? this.findPlaceholderContext(slidePath, placeholderInfo) : void 0;
75143
+ const inheritedPlaceholder = (slidePath || layoutPath) && placeholderInfo ? this.findPlaceholderContext(slidePath ?? "", placeholderInfo, layoutPath) : void 0;
75077
75144
  const inheritedSpPr = inheritedPlaceholder?.shape?.["p:spPr"] || inheritedPlaceholder?.picture?.["p:spPr"];
75078
75145
  const effectiveSpPr = spPr ? {
75079
75146
  ...spPr,
@@ -75199,7 +75266,7 @@ var PptxHandlerRuntime67 = class _PptxHandlerRuntime extends PptxHandlerRuntime6
75199
75266
  );
75200
75267
  const linkedTxbxId = bodyPropResult.linkedTxbxId;
75201
75268
  const linkedTxbxSeq = bodyPropResult.linkedTxbxSeq;
75202
- const phDefaults = slidePath && placeholderInfo ? this.lookupPlaceholderDefaults(slidePath, placeholderInfo) : void 0;
75269
+ const phDefaults = (slidePath || layoutPath) && placeholderInfo ? this.lookupPlaceholderDefaults(slidePath ?? "", placeholderInfo, layoutPath) : void 0;
75203
75270
  if (phDefaults) {
75204
75271
  this.applyPlaceholderBodyDefaults(textStyle, phDefaults);
75205
75272
  }
@@ -84163,8 +84230,175 @@ var PptxHandlerRuntime102 = class extends PptxHandlerRuntime101 {
84163
84230
  }
84164
84231
  };
84165
84232
 
84166
- // pptx/core/core/runtime/PptxHandlerRuntimeImplementation.ts
84233
+ // pptx/core/core/runtime/sdk-placeholder.ts
84234
+ var TEXT_PLACEHOLDER_TYPES = /* @__PURE__ */ new Set([
84235
+ "title",
84236
+ "ctrtitle",
84237
+ "subtitle",
84238
+ "body",
84239
+ "obj",
84240
+ "dt",
84241
+ "ftr",
84242
+ "hdr",
84243
+ "sldnum"
84244
+ ]);
84245
+ function selectTextPlaceholder(input, type, options, slots) {
84246
+ if (!TEXT_PLACEHOLDER_TYPES.has(type.toLowerCase())) {
84247
+ throw new Error(`Unsupported text placeholder type: ${type}`);
84248
+ }
84249
+ if (options.idx !== void 0 && (!Number.isInteger(options.idx) || options.idx < 0 || options.idx > 4294967295)) {
84250
+ throw new Error("Placeholder idx must be an unsigned 32-bit integer");
84251
+ }
84252
+ const source = {
84253
+ type: type.toLowerCase(),
84254
+ ...options.idx !== void 0 ? { idx: String(options.idx) } : {}
84255
+ };
84256
+ let best;
84257
+ let bestScore = 0;
84258
+ for (const slot of slots) {
84259
+ if (!TEXT_PLACEHOLDER_TYPES.has(slot.phInfo.type ?? "obj")) continue;
84260
+ if (source.idx !== void 0 && source.idx !== (slot.phInfo.idx ?? "0")) continue;
84261
+ const score = scorePlaceholderMatch(input, source, slot.phInfo);
84262
+ if (score > bestScore) {
84263
+ best = slot;
84264
+ bestScore = score;
84265
+ }
84266
+ }
84267
+ return best ? { type: canonicalPlaceholderType(best.phInfo.type ?? "obj"), idx: best.phInfo.idx } : { type: canonicalPlaceholderType(source.type), idx: source.idx };
84268
+ }
84269
+ function withoutFallbackLanguage(properties) {
84270
+ const { "@_lang": language, ...rest } = properties;
84271
+ if (language !== "en-US") return properties;
84272
+ const keys = Object.keys(rest);
84273
+ return keys.length === 0 || keys.length === 1 && rest["@_dirty"] === "0" ? void 0 : rest;
84274
+ }
84275
+ function stripFallbackLanguage(node, key2) {
84276
+ const properties = node[key2];
84277
+ if (!properties || typeof properties !== "object") return node;
84278
+ const next = withoutFallbackLanguage(properties);
84279
+ if (next === properties) return node;
84280
+ const result = {};
84281
+ for (const [name, value] of Object.entries(node)) {
84282
+ if (name !== key2) result[name] = value;
84283
+ else if (next) result[name] = next;
84284
+ }
84285
+ return result;
84286
+ }
84287
+ function withoutFallbackLanguages(paragraphs) {
84288
+ return paragraphs.map((paragraph) => {
84289
+ const next = { ...stripFallbackLanguage(paragraph, "a:endParaRPr") };
84290
+ for (const child16 of ["a:r", "a:br", "a:fld"]) {
84291
+ const nodes = next[child16];
84292
+ if (nodes === void 0) continue;
84293
+ next[child16] = Array.isArray(nodes) ? nodes.map((node) => stripFallbackLanguage(node, "a:rPr")) : stripFallbackLanguage(nodes, "a:rPr");
84294
+ }
84295
+ return next;
84296
+ });
84297
+ }
84298
+ function placeholderShape2(identity, paragraphs) {
84299
+ paragraphs = withoutFallbackLanguages(paragraphs);
84300
+ return {
84301
+ "p:nvSpPr": {
84302
+ "p:cNvPr": { "@_id": "2", "@_name": `Placeholder ${identity.type}` },
84303
+ "p:cNvSpPr": { "a:spLocks": { "@_noGrp": "1" } },
84304
+ "p:nvPr": {
84305
+ "p:ph": {
84306
+ "@_type": identity.type,
84307
+ ...identity.idx !== void 0 ? { "@_idx": identity.idx } : {}
84308
+ }
84309
+ }
84310
+ },
84311
+ "p:spPr": {},
84312
+ "p:txBody": { "a:bodyPr": {}, "a:lstStyle": {}, "a:p": paragraphs }
84313
+ };
84314
+ }
84315
+ function applyPlaceholderFrame(shape, inherited, options, emuPerPx, materializeFrame = false) {
84316
+ for (const key2 of ["x", "y", "width", "height"]) {
84317
+ if (options[key2] !== void 0 && !Number.isFinite(options[key2])) {
84318
+ throw new Error(`Invalid placeholder frame for ${key2}: expected a finite number`);
84319
+ }
84320
+ }
84321
+ const off = xmlPath(inherited, "p:spPr", "a:xfrm", "a:off");
84322
+ const ext = xmlPath(inherited, "p:spPr", "a:xfrm", "a:ext");
84323
+ const frame = {
84324
+ x: options.x ?? (off?.["@_x"] !== void 0 ? Number(off["@_x"]) / emuPerPx : void 0),
84325
+ y: options.y ?? (off?.["@_y"] !== void 0 ? Number(off["@_y"]) / emuPerPx : void 0),
84326
+ width: options.width ?? (ext?.["@_cx"] !== void 0 ? Number(ext["@_cx"]) / emuPerPx : void 0),
84327
+ height: options.height ?? (ext?.["@_cy"] !== void 0 ? Number(ext["@_cy"]) / emuPerPx : void 0)
84328
+ };
84329
+ for (const [key2, value] of Object.entries(frame)) {
84330
+ if (!Number.isFinite(value)) {
84331
+ throw new Error(
84332
+ `No matching placeholder frame for ${key2}; supply a complete explicit frame or choose a layout containing this slot`
84333
+ );
84334
+ }
84335
+ }
84336
+ if (materializeFrame || ["x", "y", "width", "height"].some((key2) => options[key2] !== void 0)) {
84337
+ setRawXmlTransform(
84338
+ shape,
84339
+ ...["x", "y", "width", "height"].map(
84340
+ (key2) => Math.round(frame[key2] * emuPerPx)
84341
+ )
84342
+ );
84343
+ }
84344
+ }
84345
+
84346
+ // pptx/core/core/runtime/PptxHandlerRuntimeSdkPlaceholders.ts
84167
84347
  var PptxHandlerRuntime103 = class _PptxHandlerRuntime extends PptxHandlerRuntime102 {
84348
+ createPlaceholderElement(layoutPath, input, type, options) {
84349
+ if (input.type !== "text") throw new Error("Placeholder input must be text");
84350
+ const layout = this.layoutXmlMap.get(layoutPath);
84351
+ if (!layout) throw new Error(`Unknown layout: ${layoutPath}`);
84352
+ const identity = selectTextPlaceholder(
84353
+ input,
84354
+ type,
84355
+ options,
84356
+ this.extractLayoutPlaceholders(layout, layoutPath)
84357
+ );
84358
+ const shape = placeholderShape2(
84359
+ identity,
84360
+ this.createParagraphsFromTextContent(input.text, void 0, input.textSegments)
84361
+ );
84362
+ const inherited = this.findPlaceholderNode(
84363
+ "",
84364
+ { type: identity.type.toLowerCase(), idx: identity.idx },
84365
+ layoutPath
84366
+ );
84367
+ const fallback = this.sdkMasterFrame(layoutPath, identity.type, identity.idx, inherited);
84368
+ applyPlaceholderFrame(
84369
+ shape,
84370
+ fallback ?? inherited,
84371
+ options,
84372
+ _PptxHandlerRuntime.EMU_PER_PX,
84373
+ fallback !== void 0
84374
+ );
84375
+ const element = this.parseShape(shape, input.id, void 0, layoutPath);
84376
+ if (!element) throw new Error("Unable to resolve placeholder content");
84377
+ if ((element.type === "text" || element.type === "shape") && !element.textStyle && element.textSegments?.[0]?.style) {
84378
+ element.textStyle = { ...element.textSegments[0].style };
84379
+ }
84380
+ return element;
84381
+ }
84382
+ sdkMasterFrame(layoutPath, type, idx, inherited) {
84383
+ if (!inherited) return void 0;
84384
+ if (xmlPath(inherited, "p:spPr", "a:xfrm", "a:off") && xmlPath(inherited, "p:spPr", "a:xfrm", "a:ext"))
84385
+ return void 0;
84386
+ const masterPath = this.resolveMasterPathForLayout(layoutPath);
84387
+ const tree = masterPath ? xmlPath(this.masterXmlMap.get(masterPath), "p:sldMaster", "p:cSld", "p:spTree") : void 0;
84388
+ const role = placeholderContentRole(type.toLowerCase());
84389
+ const candidates = this.ensureArray(tree?.["p:sp"]).filter((shape) => {
84390
+ const info = this.extractPlaceholderInfo(xmlPath(shape, "p:nvSpPr", "p:nvPr"));
84391
+ return info && placeholderContentRole(info.type) === role;
84392
+ });
84393
+ const master = candidates.find(
84394
+ (shape) => this.extractPlaceholderInfo(xmlPath(shape, "p:nvSpPr", "p:nvPr"))?.idx === idx
84395
+ ) ?? candidates[0];
84396
+ return master ? this.mergeXmlObjects(master, inherited) : void 0;
84397
+ }
84398
+ };
84399
+
84400
+ // pptx/core/core/runtime/PptxHandlerRuntimeImplementation.ts
84401
+ var PptxHandlerRuntime104 = class _PptxHandlerRuntime extends PptxHandlerRuntime103 {
84168
84402
  constructor(dependencyFactory = new PptxRuntimeDependencyFactory()) {
84169
84403
  super();
84170
84404
  this.dependencyFactory = dependencyFactory;
@@ -84302,7 +84536,7 @@ var PptxHandlerRuntime103 = class _PptxHandlerRuntime extends PptxHandlerRuntime
84302
84536
  };
84303
84537
 
84304
84538
  // pptx/core/core/PptxHandlerRuntime.ts
84305
- var PptxHandlerRuntime104 = class extends PptxHandlerRuntime103 {
84539
+ var PptxHandlerRuntime105 = class extends PptxHandlerRuntime104 {
84306
84540
  };
84307
84541
 
84308
84542
  // pptx/core/core/PptxHandlerRuntimeFactory.ts
@@ -84313,10 +84547,10 @@ var PptxHandlerRuntimeFactory = class {
84313
84547
  * @returns A freshly constructed runtime ready for loading a PPTX file.
84314
84548
  */
84315
84549
  createRuntime() {
84316
- return new PptxHandlerRuntime104();
84550
+ return new PptxHandlerRuntime105();
84317
84551
  }
84318
84552
  };
84319
- var createDefaultPptxHandlerRuntime = () => new PptxHandlerRuntime104();
84553
+ var createDefaultPptxHandlerRuntime = () => new PptxHandlerRuntime105();
84320
84554
 
84321
84555
  // pptx/core/core/runtime/table-style-editor.ts
84322
84556
  function deepClone(value) {
@@ -87263,6 +87497,13 @@ var PptxHandlerCore = class {
87263
87497
  getLayoutOptions() {
87264
87498
  return this.runtime.getLayoutOptions();
87265
87499
  }
87500
+ /** Resolve a text placeholder in this loaded deck, preserving layout inheritance. */
87501
+ createPlaceholderElement(layoutPath, input, type, options = {}) {
87502
+ if (!this.runtime.createPlaceholderElement) {
87503
+ throw new Error("This runtime does not support creating layout placeholders");
87504
+ }
87505
+ return this.runtime.createPlaceholderElement(layoutPath, input, type, options);
87506
+ }
87266
87507
  /**
87267
87508
  * Build the artwork thumbnails backing the New Slide / Layout galleries.
87268
87509
  *
@@ -88935,13 +89176,14 @@ function createFreeformElement(pathData, options) {
88935
89176
 
88936
89177
  // pptx/core/builders/sdk/SlideBuilder.ts
88937
89178
  var SlideBuilder = class {
88938
- slide;
88939
89179
  /**
88940
89180
  * @param slideNumber - 1-based slide number.
88941
89181
  * @param layoutPath - Optional layout archive path.
88942
89182
  * @param layoutName - Optional layout display name.
89183
+ * @param handler - Loaded deck context for placeholder geometry and text styles.
88943
89184
  */
88944
- constructor(slideNumber, layoutPath, layoutName) {
89185
+ constructor(slideNumber, layoutPath, layoutName, handler) {
89186
+ this.handler = handler;
88945
89187
  this.slide = {
88946
89188
  id: `slide${slideNumber}`,
88947
89189
  rId: `rId${slideNumber + 1}`,
@@ -88951,11 +89193,52 @@ var SlideBuilder = class {
88951
89193
  layoutName: layoutName ?? "Title Slide"
88952
89194
  };
88953
89195
  }
89196
+ handler;
89197
+ slide;
88954
89198
  /** Add a text box to the slide. */
88955
89199
  addText(text, options) {
88956
89200
  this.slide.elements.push(createTextElement(text, options));
88957
89201
  return this;
88958
89202
  }
89203
+ /**
89204
+ * Fill a layout placeholder, inheriting its frame and text styles.
89205
+ *
89206
+ * Unlike addText, this writes a real p:ph binding, not a free text box.
89207
+ * Use idx to select repeated slots (for example, Two Content's 1 and 2).
89208
+ * Explicit frame fields override the layout; all other fields inherit.
89209
+ * A standalone builder requires the fourth constructor argument (a loaded
89210
+ * handler), even with an explicit frame, so text styles resolve consistently.
89211
+ * Missing slots without a complete frame throw instead of creating a text box.
89212
+ * Master frames requiring compatible-role fallback are materialized locally
89213
+ * for new content only, keeping existing-deck loading unchanged.
89214
+ *
89215
+ * @example
89216
+ * ```ts
89217
+ * createSlide('Title Slide')
89218
+ * .addPlaceholder('ctrTitle', 'Quarterly review')
89219
+ * .addPlaceholder('subTitle', 'October 2026');
89220
+ * createSlide('Two Content').addPlaceholder('body', 'Right column', { idx: 2 });
89221
+ * ```
89222
+ */
89223
+ addPlaceholder(type, text, options = {}) {
89224
+ const input = createTextElement(text);
89225
+ const context = `Slide ${this.slide.slideNumber} (${this.slide.id}), placeholder ${type} idx=${options.idx ?? "auto"}, layout ${this.slide.layoutName} (${this.slide.layoutPath})`;
89226
+ try {
89227
+ if (!this.handler) {
89228
+ throw new Error(
89229
+ "addPlaceholder requires a loaded handler as the fourth SlideBuilder constructor argument"
89230
+ );
89231
+ }
89232
+ this.slide.elements.push(
89233
+ this.handler.createPlaceholderElement(this.slide.layoutPath, input, type, options)
89234
+ );
89235
+ } catch (error) {
89236
+ throw new Error(`${context}: ${error instanceof Error ? error.message : String(error)}`, {
89237
+ cause: error
89238
+ });
89239
+ }
89240
+ return this;
89241
+ }
88959
89242
  /** Add a shape to the slide. */
88960
89243
  addShape(shapeType, options) {
88961
89244
  this.slide.elements.push(createShapeElement(shapeType, options));
@@ -89194,6 +89477,246 @@ var SlideBuilder = class {
89194
89477
  }
89195
89478
  };
89196
89479
 
89480
+ // pptx/core/builders/sdk/layout-operations.ts
89481
+ var EMU_PER_PIXEL4 = 9525;
89482
+ function pxToEmu(px) {
89483
+ return Math.round(px * EMU_PER_PIXEL4);
89484
+ }
89485
+ function placeholderSpXml(ph, shapeId) {
89486
+ const name = ph.name ?? `${ph.type.charAt(0).toUpperCase() + ph.type.slice(1)} Placeholder ${shapeId - 1}`;
89487
+ const x = pxToEmu(ph.x);
89488
+ const y = pxToEmu(ph.y);
89489
+ const cx = pxToEmu(ph.width);
89490
+ const cy = pxToEmu(ph.height);
89491
+ const idxAttr = ph.idx !== void 0 ? ` idx="${Math.max(0, Math.round(ph.idx))}"` : "";
89492
+ return ` <p:sp>
89493
+ <p:nvSpPr>
89494
+ <p:cNvPr id="${shapeId}" name="${escAttr(name)}"/>
89495
+ <p:cNvSpPr><a:spLocks noGrp="1"/></p:cNvSpPr>
89496
+ <p:nvPr><p:ph type="${escAttr(ph.type)}"${idxAttr}/></p:nvPr>
89497
+ </p:nvSpPr>
89498
+ <p:spPr>
89499
+ <a:xfrm><a:off x="${x}" y="${y}"/><a:ext cx="${cx}" cy="${cy}"/></a:xfrm>
89500
+ </p:spPr>
89501
+ <p:txBody>
89502
+ <a:bodyPr/>
89503
+ <a:lstStyle/>
89504
+ <a:p><a:endParaRPr lang="en-US"/></a:p>
89505
+ </p:txBody>
89506
+ </p:sp>`;
89507
+ }
89508
+ function normalizeSrgbHex(color) {
89509
+ if (!color) {
89510
+ return void 0;
89511
+ }
89512
+ const raw = color.trim().replace(/^#/, "").toUpperCase();
89513
+ if (/^[0-9A-F]{6}$/.test(raw)) {
89514
+ return raw;
89515
+ }
89516
+ if (/^[0-9A-F]{3}$/.test(raw)) {
89517
+ return raw.replace(/./g, (ch) => ch + ch);
89518
+ }
89519
+ return void 0;
89520
+ }
89521
+ function generateLayoutXml(definition) {
89522
+ const layoutType = definition.type ?? "obj";
89523
+ const placeholders = definition.placeholders ?? [];
89524
+ const phShapes = placeholders.map((ph, i) => placeholderSpXml(ph, i + 2)).join("\n");
89525
+ let bgXml = "";
89526
+ const hex3 = normalizeSrgbHex(definition.backgroundColor);
89527
+ if (hex3) {
89528
+ bgXml = ` <p:bg><p:bgPr><a:solidFill><a:srgbClr val="${hex3}"/></a:solidFill><a:effectLst/></p:bgPr></p:bg>
89529
+ `;
89530
+ }
89531
+ return `<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
89532
+ <p:sldLayout xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main"
89533
+ xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships"
89534
+ xmlns:p="http://schemas.openxmlformats.org/presentationml/2006/main"
89535
+ type="${escAttr(layoutType)}" preserve="1">
89536
+ <p:cSld name="${escAttr(definition.name)}">
89537
+ ${bgXml} <p:spTree>
89538
+ <p:nvGrpSpPr><p:cNvPr id="1" name=""/><p:cNvGrpSpPr/><p:nvPr/></p:nvGrpSpPr>
89539
+ <p:grpSpPr><a:xfrm><a:off x="0" y="0"/><a:ext cx="0" cy="0"/><a:chOff x="0" y="0"/><a:chExt cx="0" cy="0"/></a:xfrm></p:grpSpPr>
89540
+ ${phShapes}
89541
+ </p:spTree>
89542
+ </p:cSld>
89543
+ <p:clrMapOvr><a:masterClrMapping/></p:clrMapOvr>
89544
+ </p:sldLayout>`;
89545
+ }
89546
+ function layoutRelsXml(masterIndex = 1) {
89547
+ return `<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
89548
+ <Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships">
89549
+ <Relationship Id="rId1" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/slideMaster" Target="../slideMasters/slideMaster${masterIndex}.xml"/>
89550
+ </Relationships>`;
89551
+ }
89552
+ function countExistingLayouts(zip) {
89553
+ let count = 0;
89554
+ zip.forEach((relativePath) => {
89555
+ if (/^ppt\/slideLayouts\/slideLayout\d+\.xml$/.test(relativePath)) {
89556
+ count++;
89557
+ }
89558
+ });
89559
+ return count;
89560
+ }
89561
+ async function addLayoutToSlideMaster(zip, layoutIndex, masterIndex = 1) {
89562
+ const masterRelsPath = `ppt/slideMasters/_rels/slideMaster${masterIndex}.xml.rels`;
89563
+ const masterRelsContent = await zip.file(masterRelsPath)?.async("string");
89564
+ if (!masterRelsContent) {
89565
+ throw new Error(`Slide master rels not found at ${masterRelsPath}`);
89566
+ }
89567
+ const rIdMatches = [...masterRelsContent.matchAll(/rId(\d+)/g)];
89568
+ const maxRId = rIdMatches.reduce((max, m) => Math.max(max, parseInt(m[1], 10)), 0);
89569
+ const newRId = `rId${maxRId + 1}`;
89570
+ const newRel = ` <Relationship Id="${newRId}" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/slideLayout" Target="../slideLayouts/slideLayout${layoutIndex}.xml"/>`;
89571
+ const updatedRels = masterRelsContent.replace("</Relationships>", `${newRel}
89572
+ </Relationships>`);
89573
+ zip.file(masterRelsPath, updatedRels);
89574
+ const masterPath = `ppt/slideMasters/slideMaster${masterIndex}.xml`;
89575
+ const masterContent = await zip.file(masterPath)?.async("string");
89576
+ if (!masterContent) {
89577
+ throw new Error(`Slide master not found at ${masterPath}`);
89578
+ }
89579
+ const idMatches = [...masterContent.matchAll(/sldLayoutId\s+id="(\d+)"/g)];
89580
+ const maxLayoutId = idMatches.reduce((max, m) => Math.max(max, parseInt(m[1], 10)), 2147483648);
89581
+ const newLayoutId = maxLayoutId + 1;
89582
+ const newLayoutIdEntry = ` <p:sldLayoutId id="${newLayoutId}" r:id="${newRId}"/>`;
89583
+ const updatedMaster = masterContent.replace(
89584
+ "</p:sldLayoutIdLst>",
89585
+ `${newLayoutIdEntry}
89586
+ </p:sldLayoutIdLst>`
89587
+ );
89588
+ zip.file(masterPath, updatedMaster);
89589
+ }
89590
+ async function addLayoutContentType(zip, layoutIndex) {
89591
+ const ctPath = "[Content_Types].xml";
89592
+ const ctContent = await zip.file(ctPath)?.async("string");
89593
+ if (!ctContent) {
89594
+ throw new Error("Content types file not found");
89595
+ }
89596
+ const override = ` <Override PartName="/ppt/slideLayouts/slideLayout${layoutIndex}.xml" ContentType="application/vnd.openxmlformats-officedocument.presentationml.slideLayout+xml"/>`;
89597
+ const updatedCt = ctContent.replace("</Types>", `${override}
89598
+ </Types>`);
89599
+ zip.file(ctPath, updatedCt);
89600
+ }
89601
+ async function createLayout(handler, data, definition, masterIndex = 1) {
89602
+ const bytes = await handler.save(data.slides);
89603
+ const zip = await openPptxZip(bytes);
89604
+ const existingCount = countExistingLayouts(zip);
89605
+ const newIndex = existingCount + 1;
89606
+ const layoutPath = `ppt/slideLayouts/slideLayout${newIndex}.xml`;
89607
+ zip.file(layoutPath, generateLayoutXml(definition));
89608
+ zip.file(`ppt/slideLayouts/_rels/slideLayout${newIndex}.xml.rels`, layoutRelsXml(masterIndex));
89609
+ await addLayoutToSlideMaster(zip, newIndex, masterIndex);
89610
+ await addLayoutContentType(zip, newIndex);
89611
+ const updatedBuffer = await zip.generateAsync({ type: "arraybuffer" });
89612
+ const newHandler = new PptxHandler();
89613
+ const newData = await newHandler.load(updatedBuffer);
89614
+ return {
89615
+ layoutPath,
89616
+ layoutName: definition.name,
89617
+ handler: newHandler,
89618
+ data: newData
89619
+ };
89620
+ }
89621
+ async function createLayouts(handler, data, definitions, masterIndex = 1) {
89622
+ if (definitions.length === 0) {
89623
+ return { layoutPaths: [], handler, data };
89624
+ }
89625
+ const bytes = await handler.save(data.slides);
89626
+ const zip = await openPptxZip(bytes);
89627
+ const existingCount = countExistingLayouts(zip);
89628
+ const layoutPaths = [];
89629
+ for (let i = 0; i < definitions.length; i++) {
89630
+ const def = definitions[i];
89631
+ const newIndex = existingCount + i + 1;
89632
+ const layoutPath = `ppt/slideLayouts/slideLayout${newIndex}.xml`;
89633
+ zip.file(layoutPath, generateLayoutXml(def));
89634
+ zip.file(`ppt/slideLayouts/_rels/slideLayout${newIndex}.xml.rels`, layoutRelsXml(masterIndex));
89635
+ await addLayoutToSlideMaster(zip, newIndex, masterIndex);
89636
+ await addLayoutContentType(zip, newIndex);
89637
+ layoutPaths.push(layoutPath);
89638
+ }
89639
+ const updatedBuffer = await zip.generateAsync({ type: "arraybuffer" });
89640
+ const newHandler = new PptxHandler();
89641
+ const newData = await newHandler.load(updatedBuffer);
89642
+ return { layoutPaths, handler: newHandler, data: newData };
89643
+ }
89644
+ function findLayoutByName(data, name) {
89645
+ const lowerName = name.toLowerCase();
89646
+ const fromOptions = data.layoutOptions?.find((l) => l.name.toLowerCase() === lowerName);
89647
+ if (fromOptions) {
89648
+ return fromOptions;
89649
+ }
89650
+ if (data.slideMasters) {
89651
+ for (const master of data.slideMasters) {
89652
+ const layout = master.layouts?.find((l) => l.name?.toLowerCase() === lowerName);
89653
+ if (layout) {
89654
+ return { path: layout.path, name: layout.name ?? name };
89655
+ }
89656
+ }
89657
+ }
89658
+ return void 0;
89659
+ }
89660
+ function findLayoutByType(data, type) {
89661
+ const fromOptions = data.layoutOptions?.find((l) => l.type === type);
89662
+ if (fromOptions) {
89663
+ return fromOptions;
89664
+ }
89665
+ return void 0;
89666
+ }
89667
+
89668
+ // pptx/core/builders/sdk/standard-layout-placeholders.ts
89669
+ function standardLayoutPlaceholders(type, width, height) {
89670
+ if (type === "blank") return [];
89671
+ const box = (type2, idx, x, y, w, h) => ({
89672
+ type: type2,
89673
+ idx,
89674
+ x: x * width,
89675
+ y: y * height,
89676
+ width: w * width,
89677
+ height: h * height
89678
+ });
89679
+ const title = box("title", 0, 0.05, 0.04, 0.9, 0.15);
89680
+ const content2 = box("obj", 1, 0.05, 0.23, 0.9, 0.64);
89681
+ let slots;
89682
+ switch (type) {
89683
+ case "title":
89684
+ slots = [
89685
+ box("ctrTitle", 0, 0.08, 0.24, 0.84, 0.22),
89686
+ box("subTitle", 1, 0.12, 0.49, 0.76, 0.2)
89687
+ ];
89688
+ break;
89689
+ case "secHead":
89690
+ slots = [box("title", 0, 0.05, 0.37, 0.9, 0.2), box("body", 1, 0.05, 0.6, 0.9, 0.23)];
89691
+ break;
89692
+ case "twoObj":
89693
+ case "twoTxTwoObj":
89694
+ slots = [title, box("obj", 1, 0.05, 0.27, 0.43, 0.6), box("obj", 2, 0.52, 0.27, 0.43, 0.6)];
89695
+ if (type === "twoTxTwoObj")
89696
+ slots.push(box("body", 3, 0.05, 0.2, 0.43, 0.07), box("body", 4, 0.52, 0.2, 0.43, 0.07));
89697
+ break;
89698
+ case "titleOnly":
89699
+ slots = [title];
89700
+ break;
89701
+ case "objTx":
89702
+ case "picTx":
89703
+ slots = [
89704
+ title,
89705
+ box(type === "picTx" ? "pic" : "obj", 1, 0.36, 0.23, 0.59, 0.64),
89706
+ box("body", 2, 0.05, 0.23, 0.27, 0.64)
89707
+ ];
89708
+ break;
89709
+ default:
89710
+ slots = [title, content2];
89711
+ }
89712
+ return [
89713
+ ...slots,
89714
+ box("dt", 10, 0.05, 0.92, 0.25, 0.04),
89715
+ box("ftr", 11, 0.33, 0.92, 0.34, 0.04),
89716
+ box("sldNum", 12, 0.75, 0.92, 0.2, 0.04)
89717
+ ];
89718
+ }
89719
+
89197
89720
  // pptx/core/builders/sdk/PresentationBuilder.ts
89198
89721
  var DEFAULT_WIDTH = 12192e3;
89199
89722
  var DEFAULT_HEIGHT = 6858e3;
@@ -89213,7 +89736,7 @@ var DEFAULT_COLORS = {
89213
89736
  };
89214
89737
  var DEFAULT_MAJOR_FONT = "Calibri Light";
89215
89738
  var DEFAULT_MINOR_FONT = "Calibri";
89216
- function normalizeSrgbHex(color) {
89739
+ function normalizeSrgbHex2(color) {
89217
89740
  if (!color) {
89218
89741
  return void 0;
89219
89742
  }
@@ -89229,7 +89752,7 @@ function normalizeSrgbHex(color) {
89229
89752
  function resolveThemeColors(overrides) {
89230
89753
  const resolved = {};
89231
89754
  for (const [key2, fallback] of Object.entries(DEFAULT_COLORS)) {
89232
- resolved[key2] = normalizeSrgbHex(overrides?.[key2]) ?? normalizeSrgbHex(fallback) ?? "000000";
89755
+ resolved[key2] = normalizeSrgbHex2(overrides?.[key2]) ?? normalizeSrgbHex2(fallback) ?? "000000";
89233
89756
  }
89234
89757
  return resolved;
89235
89758
  }
@@ -89386,21 +89909,6 @@ ${layoutRels}
89386
89909
  <Relationship Id="rId${layoutCount + 1}" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/theme" Target="../theme/theme1.xml"/>
89387
89910
  </Relationships>`;
89388
89911
  }
89389
- function slideLayoutXml2(name, layoutType) {
89390
- return `<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
89391
- <p:sldLayout xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main"
89392
- xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships"
89393
- xmlns:p="http://schemas.openxmlformats.org/presentationml/2006/main"
89394
- type="${escAttr(layoutType)}" preserve="1">
89395
- <p:cSld name="${escAttr(name)}">
89396
- <p:spTree>
89397
- <p:nvGrpSpPr><p:cNvPr id="1" name=""/><p:cNvGrpSpPr/><p:nvPr/></p:nvGrpSpPr>
89398
- <p:grpSpPr><a:xfrm><a:off x="0" y="0"/><a:ext cx="0" cy="0"/><a:chOff x="0" y="0"/><a:chExt cx="0" cy="0"/></a:xfrm></p:grpSpPr>
89399
- </p:spTree>
89400
- </p:cSld>
89401
- <p:clrMapOvr><a:masterClrMapping/></p:clrMapOvr>
89402
- </p:sldLayout>`;
89403
- }
89404
89912
  function slideLayoutRelsXml() {
89405
89913
  return `<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
89406
89914
  <Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships">
@@ -89549,7 +90057,14 @@ async function buildBlankPresentationArchive(options) {
89549
90057
  zip.file("ppt/slideMasters/_rels/slideMaster1.xml.rels", slideMasterRelsXml(layoutCount));
89550
90058
  for (let i = 0; i < layoutCount; i++) {
89551
90059
  const layout = STANDARD_LAYOUTS[i];
89552
- zip.file(`ppt/slideLayouts/slideLayout${i + 1}.xml`, slideLayoutXml2(layout.name, layout.type));
90060
+ zip.file(
90061
+ `ppt/slideLayouts/slideLayout${i + 1}.xml`,
90062
+ generateLayoutXml({
90063
+ name: layout.name,
90064
+ type: layout.type,
90065
+ placeholders: standardLayoutPlaceholders(layout.type, width / 9525, height / 9525)
90066
+ })
90067
+ );
89553
90068
  zip.file(`ppt/slideLayouts/_rels/slideLayout${i + 1}.xml.rels`, slideLayoutRelsXml());
89554
90069
  }
89555
90070
  for (let i = 0; i < initialSlideCount; i++) {
@@ -89586,7 +90101,7 @@ var PresentationBuilder = class {
89586
90101
  const layoutIdx = STANDARD_LAYOUTS.findIndex((l) => l.name === layoutName) + 1 || 7;
89587
90102
  const layoutPath = `ppt/slideLayouts/slideLayout${layoutIdx}.xml`;
89588
90103
  const resolvedName = layoutName ?? STANDARD_LAYOUTS[layoutIdx - 1]?.name ?? "Blank";
89589
- return new SlideBuilder(slideNum, layoutPath, resolvedName);
90104
+ return new SlideBuilder(slideNum, layoutPath, resolvedName, handler);
89590
90105
  };
89591
90106
  return { handler, data, createSlide };
89592
90107
  }
@@ -89643,4 +90158,4 @@ var PresentationBuilder = class {
89643
90158
  * `<p:extLst>` (optional)
89644
90159
  */
89645
90160
 
89646
- 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, PptxHandlerRuntime104 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, addTableStyleToMap, animationFor, applyAfterAnimationBehavior, applyAfterAnimationFromEditorList, applyChartGroupOptionsInput, applyConnectorShapeIds, applySoundToEffectCTn, applySpeedToDuration, applyTableCellTextAndStyle, assertChartGradientSupported, breakAutoNumberRun, buildBlankPresentationArchive, buildRelationshipsXml, buildSingleEffectNode, buildSlideReferenceRemap, capturedPresetIds, capturedPresetNativeAnimation, capturedSubtypes, chartFormatTargetKey, clonePartGraph, convertPptToPptx, createAutoNumberSequence, createChartElement, createConnectorElement, createDefaultPptxHandlerRuntime, createFreeformElement, createGroupElement, createImageElement, createMediaElement, createPptxSaveConstants, createShapeElement, createTableCellXml, createTableElement, createTableGraphicFrameRawXml, createTableStyleEntry, createTextElement, deleteTableStyleFromMap, ensureChartData, ensureDataPoint, extractAfterAnimationFromSubTnLst, extractGraphicBuilds, extractTableCellTextRuns, generateTableStyleGuid, getAfterAnimation, getAfterAnimationState, getCapturedPreset, getCapturedTree, hasAnimation, isEncryptedLegacyPpt, isLegacyPpt, isLineDrawnChartType, isNativeAfterAnimationOnly, 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, setChartAxis, setChartAxisGridlineStyle, setChartAxisLogScale, setChartAxisTitleStyle, setChartCategories, setChartDataLabels, setChartDataPointExplosion, setChartDataPointFill, setChartDataPointLabel, setChartDataPointMarker, setChartGroupOptions, setChartGrouping, setChartLegend, setChartSeriesChartType, setChartSeriesColor, setChartSeriesErrorBars, setChartSeriesMarker, setChartSeriesTrendline, setChartTitle, setChartType, shouldHoldEndState, timingCurveToAccelDecel, toChartGradientFill, updateCellTextInRawXml, updateCellTextStyleInRawXml, updateChartDataPoint, updateChartSeriesValues, updateMergeAttrsInRawXml, upsert, validateSeriesIndex };
90161
+ 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, setChartAxis, setChartAxisGridlineStyle, setChartAxisLogScale, setChartAxisTitleStyle, setChartCategories, setChartDataLabels, setChartDataPointExplosion, setChartDataPointFill, setChartDataPointLabel, setChartDataPointMarker, setChartGroupOptions, setChartGrouping, setChartLegend, setChartSeriesChartType, setChartSeriesColor, setChartSeriesErrorBars, setChartSeriesMarker, setChartSeriesTrendline, setChartTitle, setChartType, shouldHoldEndState, timingCurveToAccelDecel, toChartGradientFill, updateCellTextInRawXml, updateCellTextStyleInRawXml, updateChartDataPoint, updateChartSeriesValues, updateMergeAttrsInRawXml, upsert, validateSeriesIndex };