ooxml-core 1.46.0 → 1.48.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.
- package/dist/PptxHandler-6UQWMUVU.cjs +14 -0
- package/dist/{PptxHandler-HWEOIHEA.mjs → PptxHandler-PLSH2BAS.mjs} +2 -2
- package/dist/PptxHandler-QLKZVYCG.mjs +5 -0
- package/dist/{PresentationBuilder-66RV4F45.mjs → PresentationBuilder-3QXOJNRO.mjs} +2 -2
- package/dist/{PresentationBuilder-2BCCMZW7.cjs → PresentationBuilder-CRBFFHNW.cjs} +6 -6
- package/dist/{PresentationBuilder-AFD72LIG.mjs → PresentationBuilder-DQ3XFU4R.mjs} +3 -3
- package/dist/{chunk-G6LEU3Y5.mjs → chunk-32K7JG2Z.mjs} +1 -1
- package/dist/{chunk-5TOVSCVT.cjs → chunk-7RCBSNXT.cjs} +3 -3
- package/dist/{chunk-EI6555OK.mjs → chunk-CXIDPUT6.mjs} +1 -1
- package/dist/{chunk-E2TTMUKU.mjs → chunk-EKEE6BTU.mjs} +745 -65
- package/dist/{chunk-QUAFASFC.cjs → chunk-HBQBS7PO.cjs} +65 -0
- package/dist/{chunk-LXVE2VKR.mjs → chunk-I5REMIZR.mjs} +65 -1
- package/dist/{chunk-L6MJGE3Q.mjs → chunk-IKFTITJ7.mjs} +5 -5
- package/dist/{chunk-X2DC7XRL.mjs → chunk-K5G6MV37.mjs} +66 -2
- package/dist/{chunk-IBRV3AK3.cjs → chunk-RRA262A6.cjs} +2032 -1340
- package/dist/{chunk-H43QQVJU.mjs → chunk-WAYEYX4G.mjs} +1 -1
- package/dist/{chunk-HH3AYM63.mjs → chunk-WLKOLTBH.mjs} +760 -68
- package/dist/pptx/automation/index.cjs +45721 -44894
- package/dist/pptx/automation/index.d.ts +6 -6
- package/dist/pptx/automation/index.mjs +5 -5
- package/dist/pptx/chunks/{elements-B4Z6N-Gz.d.ts → elements-CValElsy.d.ts} +3 -428
- package/dist/pptx/chunks/elements-CValElsy.d.ts.map +1 -0
- package/dist/pptx/chunks/{index-DtFoPmk7.d.ts → index-BaBgJR8i.d.ts} +203 -15
- package/dist/pptx/chunks/index-BaBgJR8i.d.ts.map +1 -0
- package/dist/pptx/chunks/{index-BPGaFlm5.d.ts → index-ClHCBGOf.d.ts} +10 -8
- package/dist/pptx/chunks/{index-BPGaFlm5.d.ts.map → index-ClHCBGOf.d.ts.map} +1 -1
- package/dist/pptx/chunks/{index-D4-WJQ1r.d.ts → index-DqkBjVqR.d.ts} +4 -4
- package/dist/pptx/chunks/{index-D4-WJQ1r.d.ts.map → index-DqkBjVqR.d.ts.map} +1 -1
- package/dist/pptx/chunks/{table-BfgZfw5R.d.ts → table-DUO1H9-r.d.ts} +441 -2
- package/dist/pptx/chunks/table-DUO1H9-r.d.ts.map +1 -0
- package/dist/pptx/chunks/{text-operations-CVHXOSit.d.ts → text-operations-B3lZjvs_.d.ts} +3 -3
- package/dist/pptx/chunks/{text-operations-CVHXOSit.d.ts.map → text-operations-B3lZjvs_.d.ts.map} +1 -1
- package/dist/pptx/cli/index.cjs +1047 -220
- package/dist/pptx/cli/index.d.ts +1 -1
- package/dist/pptx/cli/index.mjs +4 -4
- package/dist/pptx/converter/index.d.ts +1 -1
- package/dist/pptx/converter/index.mjs +2 -2
- package/dist/pptx/editor/render/custom-show-operations.cjs +2 -2
- package/dist/pptx/editor/render/custom-show-operations.mjs +1 -1
- package/dist/pptx/editor/render/find-replace.cjs +15 -15
- package/dist/pptx/editor/render/find-replace.d.ts +2 -2
- package/dist/pptx/editor/render/find-replace.mjs +2 -2
- package/dist/pptx/editor/render/slide-operations.cjs +9 -9
- package/dist/pptx/editor/render/slide-operations.mjs +3 -3
- package/dist/pptx/editor/render/table-layout.d.ts +1 -1
- package/dist/pptx/editor/render/text-runs-style-patch.d.ts +1 -1
- package/dist/pptx/editor/render/text-style-scope.d.ts +1 -1
- package/dist/pptx/index.cjs +51837 -51026
- package/dist/pptx/index.d.ts +7 -7
- package/dist/pptx/index.mjs +5 -5
- package/dist/pptx/node/index.d.ts +1 -1
- package/package.json +1 -1
- package/dist/PptxHandler-FZ43IJFP.mjs +0 -5
- package/dist/PptxHandler-XAUKKK36.cjs +0 -14
- package/dist/pptx/chunks/elements-B4Z6N-Gz.d.ts.map +0 -1
- package/dist/pptx/chunks/index-DtFoPmk7.d.ts.map +0 -1
- package/dist/pptx/chunks/table-BfgZfw5R.d.ts.map +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { DEFAULT_ROW_HEIGHT_EMU, createDefaultXmlCell, tableCellTextBodyMatches } from './chunk-
|
|
2
|
-
import { NS, RELATIONSHIP_TYPES, 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, themeColorRefFromColorChoice, formatAutoNumberMarker, readText3DValues, cloneXmlObject, readScene3DValues, parseParagraphSpacingPx, parseOoxmlPercent, createBuiltinVariables, resolveCoordinate, readPathListCommandOrder, parseAdjustmentValues, parseGuideDefinitions, evaluateGuides, orderedPathCommandEntries, ooxmlArcToSvg, inheritCustomGeometryCommandOrder, parseInkMlContent, parseModel3DScene, nextRelationshipId, remapElementShapeIds, normalizeCustomShowIds, mapCustomShowActions, parseShapeId, isTemplateElementId, remapShapeIdReferences, reapplyAlternateContentToTree, openPptxZip, buildOle2, SHAPE_TREE_ELEMENT_TAGS, MAX_SHAPE_ID, parseRelationships, resolvePartPath, orderedXmlKey, safeResolveZipPath, parseDataUrlToBytes, base64Decode, reorderObjectKeys, encodeCompressedPng, zlibStore, hash, concatArrays, encodePasswordUtf16LE, COLOR_MAP_ALIAS_KEYS, DEFAULT_COLOR_MAP, uint32LE, LN_CHILD_ORDER, pptxActionToElementAction, buildClrMapOverrideXml, applyActiveXControlsToSlide, BLIP_FILL_ORDER, SP_PR_ORDER, ensureXmlChild, inkElementToStrokes, buildInkMlContent, ensureXmlChildOrCreate, isXmlNode, applyChartLayouts, stripXmlOrderSuffix, ooxmlGradientAngleToCssDegrees, serializeTabStop, readCommentMentions, rebaseCommentMentions, applyCommentMentions, colorsEqual, generateFontGuid, applyBubbleChartOptions, applyChartUpDownBars, applyDataLabelsRangeToDLbls, applyChartAxisScaling, applyChartAxisLabelFormatting, upsertChartAxisChild, applyChartDateAxisUnits, applyChartAxisDisplayUnitsToXml, writeChartShapeProps, resolveTxPrDefRPr, buildDefRPrTextProperties, buildChartGradFillXml, applySeriesMarkerToXml, applySeriesDataPointsToXml, chartColorHex, drawingLineXml, parseDrawingTextBody, parseXml, parseDrawingFill, parseDrawingLine, first, buildXml, setDrawingFillXml, fillElementOf, patchDrawingLine, elements,
|
|
1
|
+
import { DEFAULT_ROW_HEIGHT_EMU, createDefaultXmlCell, tableCellTextBodyMatches } from './chunk-CXIDPUT6.mjs';
|
|
2
|
+
import { NS, RELATIONSHIP_TYPES, 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, themeColorRefFromColorChoice, formatAutoNumberMarker, readText3DValues, cloneXmlObject, readScene3DValues, parseParagraphSpacingPx, parseOoxmlPercent, createBuiltinVariables, resolveCoordinate, readPathListCommandOrder, parseAdjustmentValues, parseGuideDefinitions, evaluateGuides, orderedPathCommandEntries, ooxmlArcToSvg, inheritCustomGeometryCommandOrder, parseInkMlContent, parseModel3DScene, nextRelationshipId, remapElementShapeIds, normalizeCustomShowIds, mapCustomShowActions, parseShapeId, isTemplateElementId, remapShapeIdReferences, reapplyAlternateContentToTree, openPptxZip, buildOle2, SHAPE_TREE_ELEMENT_TAGS, MAX_SHAPE_ID, parseRelationships, resolvePartPath, orderedXmlKey, safeResolveZipPath, parseDataUrlToBytes, base64Decode, reorderObjectKeys, encodeCompressedPng, zlibStore, hash, concatArrays, encodePasswordUtf16LE, COLOR_MAP_ALIAS_KEYS, DEFAULT_COLOR_MAP, uint32LE, LN_CHILD_ORDER, pptxActionToElementAction, buildClrMapOverrideXml, applyActiveXControlsToSlide, BLIP_FILL_ORDER, SP_PR_ORDER, ensureXmlChild, inkElementToStrokes, buildInkMlContent, ensureXmlChildOrCreate, isXmlNode, applyChartLayouts, stripXmlOrderSuffix, ooxmlGradientAngleToCssDegrees, serializeTabStop, readCommentMentions, rebaseCommentMentions, applyCommentMentions, colorsEqual, generateFontGuid, applyBubbleChartOptions, applyChartUpDownBars, applyDataLabelsRangeToDLbls, applyChartAxisScaling, applyChartAxisLabelFormatting, upsertChartAxisChild, applyChartDateAxisUnits, applyChartAxisDisplayUnitsToXml, writeChartShapeProps, resolveTxPrDefRPr, buildDefRPrTextProperties, buildChartGradFillXml, drawingFillXml, applySeriesMarkerToXml, applySeriesDataPointsToXml, chartColorHex, drawingLineXml, parseDrawingTextBody, parseXml, parseDrawingFill, parseDrawingLine, first, buildXml, setDrawingFillXml, fillElementOf, patchDrawingLine, elements, applyChartManualLayout, serializeColorChoice, replaceOleEmbedding, findKey, collectAllText, buildNodeGuidMap, buildPresentationGuidMap, regenerateSmartArtDrawingShapes, buildFabricatedDrawingXml, buildFabricatedDiagramDataXml, DIAGRAM_DRAWING_CONTENT_TYPE, DIAGRAM_DRAWING_REL_TYPE, drawingColorXml, applyDiagramRelationshipIds, applyDrawingMediaReference, DIAGRAM_XML_PROLOG, DIAGRAM_DATA_XMLNS, escapeDiagramXml, writeBodyPrBooleanAttrs, applyTextBodySp3d, customGeometryPathsToXml, ensureArrayValue, lookupPresetShape, writeShapeEffects, SHAPE_STYLE_ORDER, CAMERA_PRESETS, LIGHT_RIGS, LIGHT_DIRECTIONS, roundCoordinate, scaleVectorToIntegers, P14_GUIDE_URI, P15_GUIDE_URI, buildGuideListExtension, resetSpPrFormattingForStyleMatrix, restorePathListCommandOrder, fillIsPurelyStyleMatrix, serializeColorChoiceWithRef, createLineStyleGate, applyDrawingLineDash, reorderObjectKeysByLocalName, getSignaturePathsToStrip, DIGITAL_SIGNATURE_ORIGIN_REL_TYPE, mergeSmartArtPointXml, mergeSmartArtConnectionXml, withDiagramPictureSources, diagramPictureRelationships, applySmartArtLayoutDefinition, obfuscateFont, containsConvertibleStrictNamespaceAttribute, convertXmlToStrict, applySeriesPictureOptionsToXml, findChartExtByUri, findChildByLocalName, regenerateClonedUniqueId, buildChartUniqueIdExtLst, createOfficeGuid, isContentPoint, newSmartArtGuid, parseDiagramDataModel, DEFAULT_GENERATED_DIAGRAM_SCHEME, previewDiagramLayout, parseDiagramColors, resolveDrawingColor, children, parseDrawingRichTextBody, writeGeneratedDiagramDrawing, descendants, GENERATED_DIAGRAM_CACHE_NS, generatedDrawingDigest, parseChartUserShapesDrawing, xmlChildren, applyChartGradientToSpPr, setAutoTitleDeleted, insertAt, replaceFirstText, shouldRebuildFromParagraphs, buildPointFromParagraphs, shouldRebuildFromRuns, buildPointFromRuns, buildPointText, resolveThemeFillStyle, resolveThemeLineStyle, resolveThemeEffectStyle, relAttr, ensureXmlChildren, TC_PR_BORDERS_ORDER, writeChartColorChoice, relationshipsPartFor, stripParentDirSegments, parseChartUniqueId, buildChartMarkerXml, chartGradientsEqual, chartColorChoiceValue, openZip, attr, parseDrawingEffects, drawingEffectsXml, readChartManualLayoutValues, buildEffectDagTreeFromXml, appendInSchemaOrder, RUN_PROPERTIES_ORDER, syncPictureShapeTypeWithCropShape, buildSrgbColorChoice, picturePercentage, ARTISTIC_PRIMARY_ATTRIBUTE, fetchUrlToBytes, parseChartWideTextStyle, hasLocalName, parseDefRPrTextStyle, parseChartDataLabelOptions, shadowOffsetToDistanceAndDirection, positiveFixedAngleAttribute, xmlAttrNumber, parseCustomShows, parseShapeProps, parseActiveXControlsFromSlide, convertMetafileToDataUrl, readPictureEffect, isAlternateContentChoiceSupported, detectStrictConformance, normalizeStrictXml, relayoutSmartArt, patchDrawingColorIn, themeColorRefToSolidFillWithOpacity, FONT_ADVANCE_TABLES, DEFAULT_FONT_ADVANCE_TABLE, measureTextWidth, applyDrawingColorTransforms, applyThemeToData, detectFileFormat, parseOle2, EncryptedFileError, decryptPptx, encryptPptx, MAX_ZIP_ENTRY_COUNT, DEFAULT_MAX_UNCOMPRESSED_BYTES, encodeXmlAttributeValue, encodeXmlTextValue, cssDegreesToOoxmlGradientAngle, svgToCustomGeometryPaths, IncorrectPasswordError, patchPictureEffects, parseEncryptionInfo, RC4_ALG_ID, isOle2CompoundFile, ENTRY_TYPE_ROOT, supportsChartGradientFill, DEFAULT_CHART_GRADIENT_ANGLE, decodeXmlEntities, preservesXmlWhitespace, annotateCustomGeometryCommandOrder, annotateSmartArtTextOrder, stripXmlOrderMarkers, normalizeStShapeType, applyCustomShows, applySections, PRESENTATION_CHILD_ORDER, applyKinsokuToXml, normalizeNamespaceUri, backgroundStyleRefIsCurrent, backgroundRefNode, captureStyleBaseline, STYLE_MATRIX_FILL_KEYS, STYLE_MATRIX_LINE_KEYS, STYLE_MATRIX_EFFECT_KEYS, xmlAttrBool, detectOleObjectType, inferOleExtensionFromTarget, backgroundStylePreset, isDarkColorMap, backgroundStyleColorMap, reResolveElementsForColorMapChange, deriveSlideTitles, parseP14DirectChild, parseP14FromExtLst, P14_TRANSITION_TYPES, parseSlideDrawingGuides, slideBackgroundStyleRefFromNode, cloneSlide, parseDrawingFraction, scrgbLinearToSrgb8, parseDrawingHueDegrees, hslToRgb, themeColorRefToXml, effectChild, mergeEffectNode, mergeAttributeEffectNode, parseDrawingLineDash, findThemeEffectScheme, wrapFormatSchemeXml, effectIsPurelyStyleMatrix, prismFamilyFlags, prismFamilyTypeOfNode, prismFamilyTypeForFlags, P14_DIR_IS_ORIENTATION_TYPE, estimateMediaDurationMs, parseVmlElements, parseLineSpacingMultiplier, parseLineSpacingExactPt, formatSchemeKey, buildRelationshipsXml, loadThemeVariants, parsePresentationDrawingGuides, parsePresentationSmartTags, resolveLayoutDisplayName, guardZip, detectDigitalSignatures, unwrapOleEmbedding, mimeTypeForOleFile, oleBytesToDataUrl, themeColorRefFromSchemeClr, ZipBombError, parseKinsoku, deobfuscateFont, detectFontFormat, parseDataTable, parseChartAxes, parseBubbleChartOptions, extractGuidFromPartName, parseChartLayouts, parseCxChartSeries, parseChartDataPointPictureBlipRel, extractCxSeriesColor, parseCxDataLabels, parseCxRegionMapOptions, parseCxAxes, parseSeriesDataLabels, parseChartDataPointPicture, parseImplicitBlipPictureFill, parseEmbeddedXlsx, parseChartManualLayout, parseDiagramRelationshipIds, parseSmartArtTextParagraphs, firstParagraphRuns, smartArtParagraphsText, parseSmartArtLayoutDefinition, decodeBase64, parseSmartArtPresLayoutVars, parseDrawingColorIn, parseSmartArtConnection, connectionLabel, projectSmartArtNodeText, resolveSmartArtNodeStyleRoles, resolveSmartArtNodeCoherent3DOff, resolveDiagramLayoutCategory, captureDiagramPictures, parseDiagramDrawing, parseSmartArtDefinitionMetadata, parseSmartArtColorStyleLabels, buildSmartArtColorLists, buildSmartArtColorRoleMap, collectTransitionText, parseSmartArtQuickStyleLabels, parseDiagramQuickStyle, parseDiagramLayoutSummary, resolveSmartArtEffectIntensity, parseSmartArtStyleLabelRefs, extractStyleReferenceColorXml, withThemePlaceholderColor, blendColorOntoWhite } from './chunk-I5REMIZR.mjs';
|
|
3
3
|
import { hasShapeProperties, hasTextProperties } from './chunk-GXHKNSZX.mjs';
|
|
4
4
|
import { EMU_PER_PX, EMU_PER_PIXEL, SYSTEM_COLOR_MAP, PRESET_COLOR_MAP, OOXML_PERCENT_UNITS, EMU_PER_POINT } from './chunk-CA7KCNL3.mjs';
|
|
5
5
|
import JSZip2 from 'jszip';
|
|
@@ -2005,6 +2005,18 @@ async function loadDiagram(hostPart, relationshipIds, host) {
|
|
|
2005
2005
|
};
|
|
2006
2006
|
}
|
|
2007
2007
|
|
|
2008
|
+
// pptx/core/utils/modify-verifier-codec.ts
|
|
2009
|
+
function base64Encode(bytes) {
|
|
2010
|
+
if (typeof Buffer !== "undefined") {
|
|
2011
|
+
return Buffer.from(bytes).toString("base64");
|
|
2012
|
+
}
|
|
2013
|
+
let binary = "";
|
|
2014
|
+
for (let i = 0; i < bytes.length; i++) {
|
|
2015
|
+
binary += String.fromCharCode(bytes[i]);
|
|
2016
|
+
}
|
|
2017
|
+
return btoa(binary);
|
|
2018
|
+
}
|
|
2019
|
+
|
|
2008
2020
|
// chart/model-analysis.ts
|
|
2009
2021
|
var KIND_OF_TYPE = {
|
|
2010
2022
|
linear: "linear",
|
|
@@ -7681,41 +7693,41 @@ function parseBorderSide(side) {
|
|
|
7681
7693
|
}
|
|
7682
7694
|
const ln = typeof side["a:ln"] === "object" ? side["a:ln"] : {};
|
|
7683
7695
|
const border = {};
|
|
7684
|
-
let
|
|
7696
|
+
let has3 = false;
|
|
7685
7697
|
if (ln["a:noFill"] !== void 0) {
|
|
7686
7698
|
border.noFill = true;
|
|
7687
|
-
|
|
7699
|
+
has3 = true;
|
|
7688
7700
|
}
|
|
7689
7701
|
const widthEmu = parseInt(String(ln["@_w"] || "0"), 10);
|
|
7690
7702
|
if (widthEmu > 0) {
|
|
7691
7703
|
border.width = Math.max(1, Math.round(widthEmu / EMU_PER_PIXEL2));
|
|
7692
|
-
|
|
7704
|
+
has3 = true;
|
|
7693
7705
|
}
|
|
7694
7706
|
const prstDash = ln["a:prstDash"];
|
|
7695
7707
|
const dashVal = prstDash ? String(prstDash["@_val"] || "").trim() : "";
|
|
7696
7708
|
if (dashVal) {
|
|
7697
7709
|
border.dash = dashVal;
|
|
7698
|
-
|
|
7710
|
+
has3 = true;
|
|
7699
7711
|
}
|
|
7700
7712
|
const cmpd = String(ln["@_cmpd"] || "").trim();
|
|
7701
7713
|
if (cmpd && cmpd !== "sng") {
|
|
7702
7714
|
border.compound = cmpd;
|
|
7703
|
-
|
|
7715
|
+
has3 = true;
|
|
7704
7716
|
}
|
|
7705
7717
|
const solidFill2 = ln["a:solidFill"];
|
|
7706
7718
|
const fill3 = parseSolidFillStyle(solidFill2);
|
|
7707
7719
|
if (fill3) {
|
|
7708
7720
|
border.fill = fill3;
|
|
7709
|
-
|
|
7721
|
+
has3 = true;
|
|
7710
7722
|
} else {
|
|
7711
7723
|
const srgb = solidFill2?.["a:srgbClr"];
|
|
7712
7724
|
const hex3 = srgb ? String(srgb["@_val"] || "").trim() : "";
|
|
7713
7725
|
if (hex3) {
|
|
7714
7726
|
border.color = hex3.startsWith("#") ? hex3 : `#${hex3}`;
|
|
7715
|
-
|
|
7727
|
+
has3 = true;
|
|
7716
7728
|
}
|
|
7717
7729
|
}
|
|
7718
|
-
return
|
|
7730
|
+
return has3 ? border : void 0;
|
|
7719
7731
|
}
|
|
7720
7732
|
function parseTableStyleBorders(tcStyle) {
|
|
7721
7733
|
const tcBdr = tcStyle?.["a:tcBdr"];
|
|
@@ -7723,16 +7735,16 @@ function parseTableStyleBorders(tcStyle) {
|
|
|
7723
7735
|
return void 0;
|
|
7724
7736
|
}
|
|
7725
7737
|
const result = {};
|
|
7726
|
-
let
|
|
7738
|
+
let has3 = false;
|
|
7727
7739
|
for (const name of BORDER_SIDES) {
|
|
7728
7740
|
const node = tcBdr[`a:${name}`] ?? (name === "tr2bl" ? tcBdr["a:bl2tr"] : void 0);
|
|
7729
7741
|
const border = parseBorderSide(node);
|
|
7730
7742
|
if (border) {
|
|
7731
7743
|
result[name] = border;
|
|
7732
|
-
|
|
7744
|
+
has3 = true;
|
|
7733
7745
|
}
|
|
7734
7746
|
}
|
|
7735
|
-
return
|
|
7747
|
+
return has3 ? result : void 0;
|
|
7736
7748
|
}
|
|
7737
7749
|
function parseTableStyleSectionCell3D(tcStyle) {
|
|
7738
7750
|
const cell3DNode = tcStyle?.["a:cell3D"];
|
|
@@ -10539,6 +10551,8 @@ var PptxSaveState = class {
|
|
|
10539
10551
|
emuPerPx;
|
|
10540
10552
|
usedSlideNumbers = /* @__PURE__ */ new Set();
|
|
10541
10553
|
usedMediaPaths = /* @__PURE__ */ new Set();
|
|
10554
|
+
/** New pictures' media parts in this save, by content (see `mediaPathForContent`). */
|
|
10555
|
+
newMediaByContent = /* @__PURE__ */ new Map();
|
|
10542
10556
|
usedInkPaths = /* @__PURE__ */ new Set();
|
|
10543
10557
|
maxInkPartIndex = 0;
|
|
10544
10558
|
existingCommentPaths = /* @__PURE__ */ new Set();
|
|
@@ -10579,6 +10593,23 @@ var PptxSaveState = class {
|
|
|
10579
10593
|
this.usedMediaPaths.add(filePath);
|
|
10580
10594
|
return filePath;
|
|
10581
10595
|
}
|
|
10596
|
+
/**
|
|
10597
|
+
* The media part for a NEW picture's bytes: the part an identical picture
|
|
10598
|
+
* already got in this save, or a fresh one. Pictures loaded from the deck
|
|
10599
|
+
* keep their own parts and never come through here.
|
|
10600
|
+
*/
|
|
10601
|
+
mediaPathForContent(bytes, extension) {
|
|
10602
|
+
const key2 = `${extension.toLowerCase()}:${bytes.length}:${fnv1a(bytes)}`;
|
|
10603
|
+
const candidates = this.newMediaByContent.get(key2) ?? [];
|
|
10604
|
+
const same6 = candidates.find((candidate) => sameBytes(candidate.bytes, bytes));
|
|
10605
|
+
if (same6) {
|
|
10606
|
+
return { path: same6.path, reused: true };
|
|
10607
|
+
}
|
|
10608
|
+
const path3 = this.nextMediaPath(extension);
|
|
10609
|
+
candidates.push({ bytes, path: path3 });
|
|
10610
|
+
this.newMediaByContent.set(key2, candidates);
|
|
10611
|
+
return { path: path3, reused: false };
|
|
10612
|
+
}
|
|
10582
10613
|
getUsedMediaPaths() {
|
|
10583
10614
|
return this.usedMediaPaths;
|
|
10584
10615
|
}
|
|
@@ -10775,6 +10806,25 @@ var PptxSaveStateBuilder = class {
|
|
|
10775
10806
|
});
|
|
10776
10807
|
}
|
|
10777
10808
|
};
|
|
10809
|
+
function fnv1a(bytes) {
|
|
10810
|
+
let hash2 = 2166136261;
|
|
10811
|
+
for (const byte of bytes) {
|
|
10812
|
+
hash2 ^= byte;
|
|
10813
|
+
hash2 = Math.imul(hash2, 16777619) >>> 0;
|
|
10814
|
+
}
|
|
10815
|
+
return hash2;
|
|
10816
|
+
}
|
|
10817
|
+
function sameBytes(a, b) {
|
|
10818
|
+
if (a.length !== b.length) {
|
|
10819
|
+
return false;
|
|
10820
|
+
}
|
|
10821
|
+
for (let i = 0; i < a.length; i++) {
|
|
10822
|
+
if (a[i] !== b[i]) {
|
|
10823
|
+
return false;
|
|
10824
|
+
}
|
|
10825
|
+
}
|
|
10826
|
+
return true;
|
|
10827
|
+
}
|
|
10778
10828
|
|
|
10779
10829
|
// pptx/core/core/builders/PptxShapeIdValidator.ts
|
|
10780
10830
|
function collectCnvPrNodes(node, results, ensureArray12) {
|
|
@@ -57134,6 +57184,27 @@ function buildChartSpaceXml(chartData) {
|
|
|
57134
57184
|
return result;
|
|
57135
57185
|
}
|
|
57136
57186
|
|
|
57187
|
+
// pptx/core/core/runtime/picture-svg-blip.ts
|
|
57188
|
+
var SVG_BLIP_EXT_URI = "{96DAC541-7B7A-43D3-8B79-37D633B846F1}";
|
|
57189
|
+
var SVG_NS = "http://schemas.microsoft.com/office/drawing/2016/SVG/main";
|
|
57190
|
+
var TRANSPARENT_PNG_DATA_URL = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVR42mNgAAIAAAUAAen63NgAAAAASUVORK5CYII=";
|
|
57191
|
+
function addSvgBlipExtension(picture, relationshipId) {
|
|
57192
|
+
const blipFill = picture["p:blipFill"];
|
|
57193
|
+
const blip = blipFill?.["a:blip"];
|
|
57194
|
+
if (!blip || typeof blip !== "object") {
|
|
57195
|
+
return;
|
|
57196
|
+
}
|
|
57197
|
+
const ext = {
|
|
57198
|
+
"@_uri": SVG_BLIP_EXT_URI,
|
|
57199
|
+
"asvg:svgBlip": { "@_xmlns:asvg": SVG_NS, "@_r:embed": relationshipId }
|
|
57200
|
+
};
|
|
57201
|
+
const extLst = blip["a:extLst"] ?? {};
|
|
57202
|
+
const existing = extLst["a:ext"];
|
|
57203
|
+
const list2 = existing === void 0 ? [] : Array.isArray(existing) ? existing : [existing];
|
|
57204
|
+
extLst["a:ext"] = list2.length === 0 ? ext : [...list2, ext];
|
|
57205
|
+
blip["a:extLst"] = extLst;
|
|
57206
|
+
}
|
|
57207
|
+
|
|
57137
57208
|
// pptx/core/core/runtime/paragraph-scoped-segment-state.ts
|
|
57138
57209
|
function paragraphStateOf(segment) {
|
|
57139
57210
|
const state = {};
|
|
@@ -62471,6 +62542,17 @@ function applyImageAlphaEffects(blip, effects2, parseColor) {
|
|
|
62471
62542
|
);
|
|
62472
62543
|
}
|
|
62473
62544
|
|
|
62545
|
+
// pptx/core/core/runtime/blip-extension-order.ts
|
|
62546
|
+
function keepExtensionListLast(blip) {
|
|
62547
|
+
const key2 = Object.keys(blip).find((candidate) => candidate.split(":").at(-1) === "extLst");
|
|
62548
|
+
if (key2 === void 0) {
|
|
62549
|
+
return;
|
|
62550
|
+
}
|
|
62551
|
+
const value = blip[key2];
|
|
62552
|
+
delete blip[key2];
|
|
62553
|
+
blip[key2] = value;
|
|
62554
|
+
}
|
|
62555
|
+
|
|
62474
62556
|
// pptx/core/core/runtime/image-color-effects.ts
|
|
62475
62557
|
var localName13 = (key2) => key2.split(":").at(-1) ?? key2;
|
|
62476
62558
|
function child16(parent, name) {
|
|
@@ -63884,7 +63966,7 @@ function renderZoomPreviewSvg(element2) {
|
|
|
63884
63966
|
}
|
|
63885
63967
|
|
|
63886
63968
|
// pptx/converter/SvgExporter.ts
|
|
63887
|
-
var
|
|
63969
|
+
var SVG_NS2 = "http://www.w3.org/2000/svg";
|
|
63888
63970
|
var XLINK_NS = "http://www.w3.org/1999/xlink";
|
|
63889
63971
|
function escXml(s) {
|
|
63890
63972
|
return s.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
@@ -64329,7 +64411,7 @@ var SvgExporter = class _SvgExporter {
|
|
|
64329
64411
|
}
|
|
64330
64412
|
const defsBlock = ctx.defs.length ? `<defs>${ctx.defs.join("")}</defs>` : "";
|
|
64331
64413
|
return `<svg${attrs2({
|
|
64332
|
-
xmlns:
|
|
64414
|
+
xmlns: SVG_NS2,
|
|
64333
64415
|
"xmlns:xlink": XLINK_NS,
|
|
64334
64416
|
viewBox: `0 0 ${width} ${height}`,
|
|
64335
64417
|
width,
|
|
@@ -65369,17 +65451,37 @@ var PptxHandlerRuntime2 = class _PptxHandlerRuntime extends PptxHandlerRuntime {
|
|
|
65369
65451
|
|
|
65370
65452
|
// pptx/core/core/runtime/PptxHandlerRuntimeElementActions.ts
|
|
65371
65453
|
var PptxHandlerRuntime3 = class extends PptxHandlerRuntime2 {
|
|
65454
|
+
/**
|
|
65455
|
+
* Report a slide jump whose index names no slide of the deck being saved.
|
|
65456
|
+
* It is not written: PowerPoint does not open a file with a slide jump that
|
|
65457
|
+
* has no slide relationship.
|
|
65458
|
+
*/
|
|
65459
|
+
reportMissingSlideJumpTarget(elementId, index) {
|
|
65460
|
+
this.compatibilityService?.reportWarning({
|
|
65461
|
+
code: "SAVE_SLIDE_JUMP_TARGET_MISSING",
|
|
65462
|
+
message: `A slide jump to slide index ${index} has no such slide in the saved deck; the link was not written.`,
|
|
65463
|
+
severity: "warning",
|
|
65464
|
+
scope: "element",
|
|
65465
|
+
...elementId ? { elementId } : {}
|
|
65466
|
+
});
|
|
65467
|
+
}
|
|
65372
65468
|
/**
|
|
65373
65469
|
* Write or remove a single `a:hlinkClick` / `a:hlinkHover` node on
|
|
65374
65470
|
* a `p:cNvPr` parent.
|
|
65375
65471
|
*/
|
|
65376
|
-
serializeSingleAction(cNvPr, nodeName, action, links) {
|
|
65472
|
+
serializeSingleAction(cNvPr, nodeName, action, links, elementId) {
|
|
65377
65473
|
if (!action) {
|
|
65378
65474
|
delete cNvPr[nodeName];
|
|
65379
65475
|
return;
|
|
65380
65476
|
}
|
|
65381
65477
|
const node = {};
|
|
65382
|
-
const
|
|
65478
|
+
const slideJumpIndex = /^ppaction:\/\/hlinksldjump\b/iu.test(action.action ?? "") && typeof action.targetSlideIndex === "number" ? action.targetSlideIndex : void 0;
|
|
65479
|
+
const url = action.url?.trim() || (slideJumpIndex !== void 0 ? links.slideTargetAt?.(slideJumpIndex) : void 0);
|
|
65480
|
+
if (!url && slideJumpIndex !== void 0 && links.slideTargetAt) {
|
|
65481
|
+
this.reportMissingSlideJumpTarget(elementId, slideJumpIndex);
|
|
65482
|
+
delete cNvPr[nodeName];
|
|
65483
|
+
return;
|
|
65484
|
+
}
|
|
65383
65485
|
let rId = action.rId;
|
|
65384
65486
|
if (rId && url && links.getSlideRelationshipMap().get(rId) !== url) {
|
|
65385
65487
|
rId = void 0;
|
|
@@ -65470,8 +65572,8 @@ var PptxHandlerRuntime3 = class extends PptxHandlerRuntime2 {
|
|
|
65470
65572
|
}
|
|
65471
65573
|
const actionClick = "actionClick" in el ? el.actionClick : void 0;
|
|
65472
65574
|
const actionHover = "actionHover" in el ? el.actionHover : void 0;
|
|
65473
|
-
this.serializeSingleAction(cNvPr, "a:hlinkClick", actionClick, links);
|
|
65474
|
-
this.serializeSingleAction(cNvPr, "a:hlinkHover", actionHover, links);
|
|
65575
|
+
this.serializeSingleAction(cNvPr, "a:hlinkClick", actionClick, links, el.id);
|
|
65576
|
+
this.serializeSingleAction(cNvPr, "a:hlinkHover", actionHover, links, el.id);
|
|
65475
65577
|
const isDecorative = "isDecorative" in el ? el.isDecorative : void 0;
|
|
65476
65578
|
serializeDecorativeExtension(cNvPr, isDecorative);
|
|
65477
65579
|
}
|
|
@@ -69219,6 +69321,7 @@ var PptxHandlerRuntime16 = class extends PptxHandlerRuntime15 {
|
|
|
69219
69321
|
delete blip["a:blur"];
|
|
69220
69322
|
}
|
|
69221
69323
|
applyA14ImageExtension(blip, nextEffects);
|
|
69324
|
+
keepExtensionListLast(blip);
|
|
69222
69325
|
}
|
|
69223
69326
|
normalizePresetGeometry(shapeType) {
|
|
69224
69327
|
return this.elementXmlBuilder.normalizePresetGeometry(shapeType);
|
|
@@ -75789,6 +75892,53 @@ var PptxHandlerRuntime30 = class extends PptxHandlerRuntime29 {
|
|
|
75789
75892
|
}
|
|
75790
75893
|
};
|
|
75791
75894
|
|
|
75895
|
+
// pptx/core/core/runtime/run-slide-jump-targets.ts
|
|
75896
|
+
var SLIDE_JUMP_ACTION = "ppaction://hlinksldjump";
|
|
75897
|
+
function withRunSlideJumpTarget(style, slideTargetAt, onMissing) {
|
|
75898
|
+
if (!style || !slideTargetAt) {
|
|
75899
|
+
return style;
|
|
75900
|
+
}
|
|
75901
|
+
const index = style.hyperlinkTargetSlideIndex;
|
|
75902
|
+
if (typeof index !== "number" || style.hyperlinkRId) {
|
|
75903
|
+
return style;
|
|
75904
|
+
}
|
|
75905
|
+
const hyperlink = style.hyperlink?.trim();
|
|
75906
|
+
if (hyperlink && !hyperlink.startsWith("ppaction://")) {
|
|
75907
|
+
return style;
|
|
75908
|
+
}
|
|
75909
|
+
if (style.hyperlinkAction && style.hyperlinkAction !== SLIDE_JUMP_ACTION) {
|
|
75910
|
+
return style;
|
|
75911
|
+
}
|
|
75912
|
+
const target = slideTargetAt(index);
|
|
75913
|
+
if (!target) {
|
|
75914
|
+
onMissing?.(index);
|
|
75915
|
+
const {
|
|
75916
|
+
hyperlink: _hyperlink,
|
|
75917
|
+
hyperlinkAction: _action,
|
|
75918
|
+
hyperlinkTargetSlideIndex: _index,
|
|
75919
|
+
hyperlinkTooltip: _tooltip,
|
|
75920
|
+
...rest
|
|
75921
|
+
} = style;
|
|
75922
|
+
return rest;
|
|
75923
|
+
}
|
|
75924
|
+
return { ...style, hyperlink: target, hyperlinkAction: SLIDE_JUMP_ACTION };
|
|
75925
|
+
}
|
|
75926
|
+
function withSegmentSlideJumpTargets(segments, slideTargetAt, onMissing) {
|
|
75927
|
+
if (!segments || !slideTargetAt) {
|
|
75928
|
+
return segments;
|
|
75929
|
+
}
|
|
75930
|
+
let changed = false;
|
|
75931
|
+
const next = segments.map((segment) => {
|
|
75932
|
+
const style = withRunSlideJumpTarget(segment.style, slideTargetAt, onMissing);
|
|
75933
|
+
if (style === segment.style) {
|
|
75934
|
+
return segment;
|
|
75935
|
+
}
|
|
75936
|
+
changed = true;
|
|
75937
|
+
return { ...segment, style };
|
|
75938
|
+
});
|
|
75939
|
+
return changed ? next : segments;
|
|
75940
|
+
}
|
|
75941
|
+
|
|
75792
75942
|
// pptx/core/core/runtime/PptxHandlerRuntimeSaveTextWriter.ts
|
|
75793
75943
|
var ADJ1_WARP_PRESETS = /* @__PURE__ */ new Set([
|
|
75794
75944
|
"textWave1",
|
|
@@ -75813,7 +75963,7 @@ var PptxHandlerRuntime31 = class _PptxHandlerRuntime extends PptxHandlerRuntime3
|
|
|
75813
75963
|
* text chains), and delegates paragraph creation to
|
|
75814
75964
|
* `createParagraphsFromTextContent`.
|
|
75815
75965
|
*/
|
|
75816
|
-
applyTextBodyContent(shape2, el, resolveHyperlinkRelationshipId, getSlideRelationshipMap) {
|
|
75966
|
+
applyTextBodyContent(shape2, el, resolveHyperlinkRelationshipId, getSlideRelationshipMap, slideTargetAt) {
|
|
75817
75967
|
const hasEditableTextContent = typeof el.text === "string" || (el.textSegments?.length ?? 0) > 0;
|
|
75818
75968
|
if (!hasEditableTextContent) {
|
|
75819
75969
|
return;
|
|
@@ -75936,10 +76086,15 @@ var PptxHandlerRuntime31 = class _PptxHandlerRuntime extends PptxHandlerRuntime3
|
|
|
75936
76086
|
);
|
|
75937
76087
|
}
|
|
75938
76088
|
txBody["a:bodyPr"] = bodyPr;
|
|
76089
|
+
const onMissing = (index) => this.reportMissingSlideJumpTarget(el.id, index);
|
|
75939
76090
|
txBody["a:p"] = this.createParagraphsFromTextContent(
|
|
75940
76091
|
textValueForSave,
|
|
75941
|
-
|
|
75942
|
-
|
|
76092
|
+
withRunSlideJumpTarget(
|
|
76093
|
+
this.routeElementParagraphGeometry(txBody, el.textStyle),
|
|
76094
|
+
slideTargetAt,
|
|
76095
|
+
onMissing
|
|
76096
|
+
),
|
|
76097
|
+
withSegmentSlideJumpTargets(textSegmentsForSave, slideTargetAt, onMissing),
|
|
75943
76098
|
resolveHyperlinkRelationshipId
|
|
75944
76099
|
);
|
|
75945
76100
|
}
|
|
@@ -76050,6 +76205,94 @@ function shouldWritePictureGeometry(el, spPr) {
|
|
|
76050
76205
|
return Boolean(spPr["a:prstGeom"] || spPr["a:custGeom"]);
|
|
76051
76206
|
}
|
|
76052
76207
|
|
|
76208
|
+
// pptx/core/core/runtime/save-picture-fill.ts
|
|
76209
|
+
var has2 = (value) => value !== void 0;
|
|
76210
|
+
function drawingPictureLayout(layout, emuPerPx) {
|
|
76211
|
+
const offset = (px) => px === void 0 ? void 0 : Math.round(px * emuPerPx);
|
|
76212
|
+
if ([
|
|
76213
|
+
layout.tileOffsetX,
|
|
76214
|
+
layout.tileOffsetY,
|
|
76215
|
+
layout.tileScaleX,
|
|
76216
|
+
layout.tileScaleY,
|
|
76217
|
+
layout.tileFlip,
|
|
76218
|
+
layout.tileAlignment
|
|
76219
|
+
].some(has2)) {
|
|
76220
|
+
const tile = {};
|
|
76221
|
+
const offsetX = offset(layout.tileOffsetX);
|
|
76222
|
+
const offsetY = offset(layout.tileOffsetY);
|
|
76223
|
+
if (offsetX !== void 0) tile.offsetXEmu = offsetX;
|
|
76224
|
+
if (offsetY !== void 0) tile.offsetYEmu = offsetY;
|
|
76225
|
+
if (layout.tileScaleX !== void 0) tile.scaleX = layout.tileScaleX;
|
|
76226
|
+
if (layout.tileScaleY !== void 0) tile.scaleY = layout.tileScaleY;
|
|
76227
|
+
if (layout.tileFlip !== void 0) tile.flip = layout.tileFlip;
|
|
76228
|
+
if (layout.tileAlignment !== void 0) tile.alignment = layout.tileAlignment;
|
|
76229
|
+
return { tile };
|
|
76230
|
+
}
|
|
76231
|
+
if ([layout.fillRectLeft, layout.fillRectTop, layout.fillRectRight, layout.fillRectBottom].some(has2)) {
|
|
76232
|
+
return {
|
|
76233
|
+
fillRect: {
|
|
76234
|
+
l: layout.fillRectLeft ?? 0,
|
|
76235
|
+
t: layout.fillRectTop ?? 0,
|
|
76236
|
+
r: layout.fillRectRight ?? 0,
|
|
76237
|
+
b: layout.fillRectBottom ?? 0
|
|
76238
|
+
}
|
|
76239
|
+
};
|
|
76240
|
+
}
|
|
76241
|
+
return void 0;
|
|
76242
|
+
}
|
|
76243
|
+
function blipFillXml(relId, layout, parse) {
|
|
76244
|
+
const xml = drawingFillXml({ kind: "picture", relId, layout }) ?? "";
|
|
76245
|
+
const node = parse(xml)["a:blipFill"];
|
|
76246
|
+
delete node["@_xmlns:a"];
|
|
76247
|
+
delete node["@_xmlns:r"];
|
|
76248
|
+
return node;
|
|
76249
|
+
}
|
|
76250
|
+
function checkedBlipFill(relId, layout, ctx) {
|
|
76251
|
+
try {
|
|
76252
|
+
return blipFillXml(relId, layout, ctx.parse);
|
|
76253
|
+
} catch (error) {
|
|
76254
|
+
if (!(error instanceof RangeError)) {
|
|
76255
|
+
throw error;
|
|
76256
|
+
}
|
|
76257
|
+
ctx.warn(
|
|
76258
|
+
"SAVE_PICTURE_LAYOUT_INVALID",
|
|
76259
|
+
`Picture tile or fill rectangle could not be written (${error.message}); the picture is stretched over its frame instead.`
|
|
76260
|
+
);
|
|
76261
|
+
const { rotWithShape } = layout;
|
|
76262
|
+
return blipFillXml(relId, rotWithShape === void 0 ? {} : { rotWithShape }, ctx.parse);
|
|
76263
|
+
}
|
|
76264
|
+
}
|
|
76265
|
+
function writeNewShapePictureFill(spPr, style, ctx) {
|
|
76266
|
+
const relId = style.fillImageUrl ? ctx.embed(style.fillImageUrl) : void 0;
|
|
76267
|
+
if (!relId) {
|
|
76268
|
+
ctx.warn(
|
|
76269
|
+
"SAVE_SHAPE_PICTURE_FILL_UNSUPPORTED",
|
|
76270
|
+
"Shape picture fill could not be embedded (it needs a data: URL); the shape was saved without a fill."
|
|
76271
|
+
);
|
|
76272
|
+
return;
|
|
76273
|
+
}
|
|
76274
|
+
const layout = {
|
|
76275
|
+
...drawingPictureLayout(style.fillImageLayout ?? {}, ctx.emuPerPx),
|
|
76276
|
+
rotWithShape: style.fillImageRotWithShape ?? true
|
|
76277
|
+
};
|
|
76278
|
+
setFillChoice(spPr, "a:blipFill", checkedBlipFill(relId, layout, ctx));
|
|
76279
|
+
}
|
|
76280
|
+
function applyNewPictureLayout(blipFill, layout, ctx) {
|
|
76281
|
+
const drawingLayout = drawingPictureLayout(layout, ctx.emuPerPx);
|
|
76282
|
+
const relId = blipFill["a:blip"]?.["@_r:embed"];
|
|
76283
|
+
if (!drawingLayout || typeof relId !== "string") {
|
|
76284
|
+
return;
|
|
76285
|
+
}
|
|
76286
|
+
const built = checkedBlipFill(relId, drawingLayout, ctx);
|
|
76287
|
+
delete blipFill["a:stretch"];
|
|
76288
|
+
delete blipFill["a:tile"];
|
|
76289
|
+
for (const key2 of ["a:tile", "a:stretch"]) {
|
|
76290
|
+
if (built[key2] !== void 0) {
|
|
76291
|
+
blipFill[key2] = built[key2];
|
|
76292
|
+
}
|
|
76293
|
+
}
|
|
76294
|
+
}
|
|
76295
|
+
|
|
76053
76296
|
// pptx/core/core/runtime/PptxHandlerRuntimeSaveElementEmbedding.ts
|
|
76054
76297
|
function getMediaReferenceContainer(shape2) {
|
|
76055
76298
|
if (!shape2) {
|
|
@@ -76061,7 +76304,7 @@ function getMediaReferenceContainer(shape2) {
|
|
|
76061
76304
|
}
|
|
76062
76305
|
return shape2["a:graphic"]?.["a:graphicData"];
|
|
76063
76306
|
}
|
|
76064
|
-
var PptxHandlerRuntime32 = class extends PptxHandlerRuntime31 {
|
|
76307
|
+
var PptxHandlerRuntime32 = class _PptxHandlerRuntime extends PptxHandlerRuntime31 {
|
|
76065
76308
|
/** Serialize table, chart, and SmartArt data when applicable. */
|
|
76066
76309
|
applyDataSerialization(shape2, el, slideId) {
|
|
76067
76310
|
if (el.type === "table" && "tableData" in el && el.tableData) {
|
|
@@ -76148,15 +76391,29 @@ var PptxHandlerRuntime32 = class extends PptxHandlerRuntime31 {
|
|
|
76148
76391
|
if (parsedImage) {
|
|
76149
76392
|
let targetImagePath = el.imagePath;
|
|
76150
76393
|
if (!targetImagePath) {
|
|
76151
|
-
|
|
76152
|
-
|
|
76394
|
+
const media = ctx.saveSession.mediaPathForContent(parsedImage.bytes, parsedImage.extension);
|
|
76395
|
+
targetImagePath = media.path;
|
|
76153
76396
|
const relativeMediaPath = targetImagePath.replace(/^ppt\//u, "../");
|
|
76154
|
-
ctx.slideRelationships.
|
|
76155
|
-
"@
|
|
76156
|
-
|
|
76157
|
-
|
|
76158
|
-
|
|
76397
|
+
const existingRelationshipId = media.reused ? ctx.slideRelationships.find(
|
|
76398
|
+
(rel) => rel["@_Type"] === ctx.slideImageRelationshipType && rel["@_Target"] === relativeMediaPath
|
|
76399
|
+
)?.["@_Id"] : void 0;
|
|
76400
|
+
const relationshipId = typeof existingRelationshipId === "string" ? existingRelationshipId : ctx.slideRelationshipRegistry.nextRelationshipId();
|
|
76401
|
+
if (relationshipId !== existingRelationshipId) {
|
|
76402
|
+
ctx.slideRelationships.push({
|
|
76403
|
+
"@_Id": relationshipId,
|
|
76404
|
+
"@_Type": ctx.slideImageRelationshipType,
|
|
76405
|
+
"@_Target": relativeMediaPath
|
|
76406
|
+
});
|
|
76407
|
+
}
|
|
76159
76408
|
shape2 = this.createPictureXml(el, relationshipId);
|
|
76409
|
+
this.embedNewSvgVariant(el, shape2, ctx);
|
|
76410
|
+
const blipFill = shape2["p:blipFill"];
|
|
76411
|
+
if (blipFill) {
|
|
76412
|
+
applyNewPictureLayout(blipFill, el, this.pictureFillSaveContext(el, ctx));
|
|
76413
|
+
}
|
|
76414
|
+
if (media.reused) {
|
|
76415
|
+
return shape2;
|
|
76416
|
+
}
|
|
76160
76417
|
}
|
|
76161
76418
|
if (targetImagePath) {
|
|
76162
76419
|
const targetExt = targetImagePath.toLowerCase().match(/\.(?<ext>[^./\\]+)$/u)?.groups?.["ext"];
|
|
@@ -76177,6 +76434,71 @@ var PptxHandlerRuntime32 = class extends PptxHandlerRuntime31 {
|
|
|
76177
76434
|
}
|
|
76178
76435
|
return shape2;
|
|
76179
76436
|
}
|
|
76437
|
+
/** Add an image relationship from the slide to `mediaPath`; its id. */
|
|
76438
|
+
addSlideImageRelationship(mediaPath, ctx) {
|
|
76439
|
+
const relationshipId = ctx.slideRelationshipRegistry.nextRelationshipId();
|
|
76440
|
+
ctx.slideRelationships.push({
|
|
76441
|
+
"@_Id": relationshipId,
|
|
76442
|
+
"@_Type": ctx.slideImageRelationshipType,
|
|
76443
|
+
"@_Target": mediaPath.replace(/^ppt\//u, "../")
|
|
76444
|
+
});
|
|
76445
|
+
return relationshipId;
|
|
76446
|
+
}
|
|
76447
|
+
/** What the picture-fill writers need, bound to `el` on the slide being saved. */
|
|
76448
|
+
pictureFillSaveContext(el, ctx) {
|
|
76449
|
+
return {
|
|
76450
|
+
emuPerPx: _PptxHandlerRuntime.EMU_PER_PX,
|
|
76451
|
+
parse: (xml) => this.parser.parse(xml),
|
|
76452
|
+
embed: (dataUrl) => {
|
|
76453
|
+
const parsed = this.parseDataUrlToBytes(dataUrl);
|
|
76454
|
+
if (!parsed) {
|
|
76455
|
+
return void 0;
|
|
76456
|
+
}
|
|
76457
|
+
const mediaPath = ctx.saveSession.nextMediaPath(parsed.extension);
|
|
76458
|
+
this.zip.file(mediaPath, parsed.bytes);
|
|
76459
|
+
return this.addSlideImageRelationship(mediaPath, ctx);
|
|
76460
|
+
},
|
|
76461
|
+
warn: (code, message) => this.compatibilityService.reportWarning({
|
|
76462
|
+
code,
|
|
76463
|
+
message,
|
|
76464
|
+
scope: "element",
|
|
76465
|
+
slideId: ctx.slide.id,
|
|
76466
|
+
elementId: el.id
|
|
76467
|
+
})
|
|
76468
|
+
};
|
|
76469
|
+
}
|
|
76470
|
+
/**
|
|
76471
|
+
* For a new SVG picture (`svgData` without a part yet), write the SVG part
|
|
76472
|
+
* and point the blip's `asvg:svgBlip` extension at it; the blip itself
|
|
76473
|
+
* embeds the raster (`imageData`).
|
|
76474
|
+
*/
|
|
76475
|
+
embedNewSvgVariant(el, picture, ctx) {
|
|
76476
|
+
const svgData = el.svgData;
|
|
76477
|
+
if (!svgData || el.svgPath) {
|
|
76478
|
+
return;
|
|
76479
|
+
}
|
|
76480
|
+
const parsed = this.parseDataUrlToBytes(svgData);
|
|
76481
|
+
if (!parsed || parsed.extension.toLowerCase() !== "svg") {
|
|
76482
|
+
return;
|
|
76483
|
+
}
|
|
76484
|
+
const media = ctx.saveSession.mediaPathForContent(parsed.bytes, "svg");
|
|
76485
|
+
const target = media.path.replace(/^ppt\//u, "../");
|
|
76486
|
+
const existing = media.reused ? ctx.slideRelationships.find(
|
|
76487
|
+
(rel) => rel["@_Type"] === ctx.slideImageRelationshipType && rel["@_Target"] === target
|
|
76488
|
+
)?.["@_Id"] : void 0;
|
|
76489
|
+
const relationshipId = typeof existing === "string" ? existing : ctx.slideRelationshipRegistry.nextRelationshipId();
|
|
76490
|
+
if (relationshipId !== existing) {
|
|
76491
|
+
ctx.slideRelationships.push({
|
|
76492
|
+
"@_Id": relationshipId,
|
|
76493
|
+
"@_Type": ctx.slideImageRelationshipType,
|
|
76494
|
+
"@_Target": target
|
|
76495
|
+
});
|
|
76496
|
+
}
|
|
76497
|
+
if (!media.reused) {
|
|
76498
|
+
this.zip.file(media.path, parsed.bytes);
|
|
76499
|
+
}
|
|
76500
|
+
addSvgBlipExtension(picture, relationshipId);
|
|
76501
|
+
}
|
|
76180
76502
|
/** Embed media data and manage relationships for media elements. */
|
|
76181
76503
|
processMediaEmbedding(mediaElement, shape2, ctx) {
|
|
76182
76504
|
const mediaType = mediaElement.mediaType === "audio" ? "audio" : "video";
|
|
@@ -77858,6 +78180,10 @@ var PptxHandlerRuntime41 = class _PptxHandlerRuntime extends PptxHandlerRuntime4
|
|
|
77858
78180
|
}
|
|
77859
78181
|
if (!shape2 && (el.type === "text" || el.type === "shape")) {
|
|
77860
78182
|
shape2 = this.createElementXml(el);
|
|
78183
|
+
const spPr = ensureXmlChild(shape2, "p:spPr");
|
|
78184
|
+
if (spPr && el.shapeStyle?.fillMode === "image") {
|
|
78185
|
+
writeNewShapePictureFill(spPr, el.shapeStyle, this.pictureFillSaveContext(el, ctx));
|
|
78186
|
+
}
|
|
77861
78187
|
}
|
|
77862
78188
|
if (!shape2 && el.type === "connector") {
|
|
77863
78189
|
shape2 = this.createConnectorXml(el);
|
|
@@ -77970,7 +78296,8 @@ var PptxHandlerRuntime41 = class _PptxHandlerRuntime extends PptxHandlerRuntime4
|
|
|
77970
78296
|
shape2,
|
|
77971
78297
|
el,
|
|
77972
78298
|
ctx.resolveHyperlinkRelationshipId,
|
|
77973
|
-
ctx.getSlideRelationshipMap
|
|
78299
|
+
ctx.getSlideRelationshipMap,
|
|
78300
|
+
ctx.slideTargetAt
|
|
77974
78301
|
);
|
|
77975
78302
|
}
|
|
77976
78303
|
this.applyDataSerialization(shape2, el, ctx.slide.id);
|
|
@@ -98097,6 +98424,215 @@ function applyChartInputLayout(element2, input) {
|
|
|
98097
98424
|
}
|
|
98098
98425
|
}
|
|
98099
98426
|
|
|
98427
|
+
// pptx/core/builders/sdk/picture-layout-input.ts
|
|
98428
|
+
var FLIPS = /* @__PURE__ */ new Set(["none", "x", "y", "xy"]);
|
|
98429
|
+
var ALIGNMENTS = /* @__PURE__ */ new Set([
|
|
98430
|
+
"tl",
|
|
98431
|
+
"t",
|
|
98432
|
+
"tr",
|
|
98433
|
+
"l",
|
|
98434
|
+
"ctr",
|
|
98435
|
+
"r",
|
|
98436
|
+
"bl",
|
|
98437
|
+
"b",
|
|
98438
|
+
"br"
|
|
98439
|
+
]);
|
|
98440
|
+
var MAX_INSET = 10;
|
|
98441
|
+
function finite4(where, name, value) {
|
|
98442
|
+
if (typeof value !== "number" || !Number.isFinite(value)) {
|
|
98443
|
+
throw new RangeError(`${where}.${name} must be a finite number, got ${String(value)}`);
|
|
98444
|
+
}
|
|
98445
|
+
return value;
|
|
98446
|
+
}
|
|
98447
|
+
function tileLayout(where, tile) {
|
|
98448
|
+
const scale = (name) => {
|
|
98449
|
+
const value = finite4(where, `tile.${name}`, tile[name] ?? 1);
|
|
98450
|
+
if (value <= 0) {
|
|
98451
|
+
throw new RangeError(`${where}.tile.${name} must be above 0, got ${value}`);
|
|
98452
|
+
}
|
|
98453
|
+
return value;
|
|
98454
|
+
};
|
|
98455
|
+
const flip = tile.flip ?? "none";
|
|
98456
|
+
if (!FLIPS.has(flip)) {
|
|
98457
|
+
throw new RangeError(`${where}.tile.flip must be none, x, y or xy, got ${String(flip)}`);
|
|
98458
|
+
}
|
|
98459
|
+
const alignment = tile.alignment ?? "tl";
|
|
98460
|
+
if (!ALIGNMENTS.has(alignment)) {
|
|
98461
|
+
throw new RangeError(
|
|
98462
|
+
`${where}.tile.alignment must be one of ${[...ALIGNMENTS].join(", ")}, got ${String(alignment)}`
|
|
98463
|
+
);
|
|
98464
|
+
}
|
|
98465
|
+
return {
|
|
98466
|
+
tileOffsetX: finite4(where, "tile.offsetX", tile.offsetX ?? 0),
|
|
98467
|
+
tileOffsetY: finite4(where, "tile.offsetY", tile.offsetY ?? 0),
|
|
98468
|
+
tileScaleX: scale("scaleX"),
|
|
98469
|
+
tileScaleY: scale("scaleY"),
|
|
98470
|
+
tileFlip: flip,
|
|
98471
|
+
tileAlignment: alignment
|
|
98472
|
+
};
|
|
98473
|
+
}
|
|
98474
|
+
function fillRectLayout(where, rect) {
|
|
98475
|
+
const inset = (name) => {
|
|
98476
|
+
const value = finite4(where, `fillRect.${name}`, rect[name]);
|
|
98477
|
+
if (Math.abs(value) > MAX_INSET) {
|
|
98478
|
+
throw new RangeError(
|
|
98479
|
+
`${where}.fillRect.${name} must be between -${MAX_INSET} and ${MAX_INSET}, got ${value}`
|
|
98480
|
+
);
|
|
98481
|
+
}
|
|
98482
|
+
return value;
|
|
98483
|
+
};
|
|
98484
|
+
const layout = {
|
|
98485
|
+
fillRectLeft: inset("l"),
|
|
98486
|
+
fillRectTop: inset("t"),
|
|
98487
|
+
fillRectRight: inset("r"),
|
|
98488
|
+
fillRectBottom: inset("b")
|
|
98489
|
+
};
|
|
98490
|
+
if (layout.fillRectLeft + layout.fillRectRight >= 1) {
|
|
98491
|
+
throw new RangeError(`${where}.fillRect.l + r must be below 1, which leaves no picture`);
|
|
98492
|
+
}
|
|
98493
|
+
if (layout.fillRectTop + layout.fillRectBottom >= 1) {
|
|
98494
|
+
throw new RangeError(`${where}.fillRect.t + b must be below 1, which leaves no picture`);
|
|
98495
|
+
}
|
|
98496
|
+
return layout;
|
|
98497
|
+
}
|
|
98498
|
+
function mapPictureLayoutInput(where, input) {
|
|
98499
|
+
const { mode, tile, fillRect } = input;
|
|
98500
|
+
if (mode !== void 0 && mode !== "stretch" && mode !== "tile") {
|
|
98501
|
+
throw new RangeError(`${where}.mode must be 'stretch' or 'tile', got ${String(mode)}`);
|
|
98502
|
+
}
|
|
98503
|
+
if (tile && fillRect) {
|
|
98504
|
+
throw new RangeError(`${where} takes a tile or a fillRect, not both`);
|
|
98505
|
+
}
|
|
98506
|
+
if (tile && mode === "stretch") {
|
|
98507
|
+
throw new RangeError(`${where}.tile needs mode 'tile', got 'stretch'`);
|
|
98508
|
+
}
|
|
98509
|
+
if (fillRect && mode === "tile") {
|
|
98510
|
+
throw new RangeError(`${where}.fillRect needs mode 'stretch', got 'tile'`);
|
|
98511
|
+
}
|
|
98512
|
+
if (tile || mode === "tile") {
|
|
98513
|
+
return tileLayout(where, tile ?? {});
|
|
98514
|
+
}
|
|
98515
|
+
return fillRect ? fillRectLayout(where, fillRect) : void 0;
|
|
98516
|
+
}
|
|
98517
|
+
|
|
98518
|
+
// pptx/core/builders/sdk/link-input.ts
|
|
98519
|
+
var SLIDE_JUMP_ACTION2 = "ppaction://hlinksldjump";
|
|
98520
|
+
function mapLinkToAction(link) {
|
|
98521
|
+
if (!link) {
|
|
98522
|
+
return void 0;
|
|
98523
|
+
}
|
|
98524
|
+
const tooltip = link.tooltip !== void 0 ? { tooltip: link.tooltip } : {};
|
|
98525
|
+
if ("url" in link) {
|
|
98526
|
+
return { url: assertUrl(link.url), ...tooltip };
|
|
98527
|
+
}
|
|
98528
|
+
assertSlideIndex(link.slideIndex);
|
|
98529
|
+
return { action: SLIDE_JUMP_ACTION2, targetSlideIndex: link.slideIndex, ...tooltip };
|
|
98530
|
+
}
|
|
98531
|
+
function mapLinkToRunStyle(link) {
|
|
98532
|
+
if (!link) {
|
|
98533
|
+
return {};
|
|
98534
|
+
}
|
|
98535
|
+
const tooltip = link.tooltip !== void 0 ? { hyperlinkTooltip: link.tooltip } : {};
|
|
98536
|
+
if ("url" in link) {
|
|
98537
|
+
return { hyperlink: assertUrl(link.url), ...tooltip };
|
|
98538
|
+
}
|
|
98539
|
+
assertSlideIndex(link.slideIndex);
|
|
98540
|
+
return {
|
|
98541
|
+
hyperlink: SLIDE_JUMP_ACTION2,
|
|
98542
|
+
hyperlinkAction: SLIDE_JUMP_ACTION2,
|
|
98543
|
+
hyperlinkTargetSlideIndex: link.slideIndex,
|
|
98544
|
+
...tooltip
|
|
98545
|
+
};
|
|
98546
|
+
}
|
|
98547
|
+
function assertUrl(url) {
|
|
98548
|
+
if (typeof url !== "string" || url.trim() === "") {
|
|
98549
|
+
throw new RangeError("LinkInput.url must be a non-empty address");
|
|
98550
|
+
}
|
|
98551
|
+
return url;
|
|
98552
|
+
}
|
|
98553
|
+
function assertSlideIndex(index) {
|
|
98554
|
+
if (!Number.isInteger(index) || index < 0) {
|
|
98555
|
+
throw new RangeError(`LinkInput.slideIndex must be a 0-based slide position, got ${index}`);
|
|
98556
|
+
}
|
|
98557
|
+
}
|
|
98558
|
+
|
|
98559
|
+
// pptx/core/builders/sdk/svg-picture-input.ts
|
|
98560
|
+
var SVG_DATA_URL = /^data:image\/svg\+xml(?<params>[^,]*),(?<payload>[\s\S]*)$/iu;
|
|
98561
|
+
function svgPictureSource(source, svgFallback) {
|
|
98562
|
+
if (svgFallback !== void 0 && SVG_DATA_URL.test(svgFallback)) {
|
|
98563
|
+
throw new RangeError("ImageOptions.svgFallback must be a raster image, not SVG");
|
|
98564
|
+
}
|
|
98565
|
+
const match = SVG_DATA_URL.exec(source);
|
|
98566
|
+
if (!match?.groups) {
|
|
98567
|
+
if (svgFallback !== void 0) {
|
|
98568
|
+
throw new RangeError("ImageOptions.svgFallback applies only to an SVG data URL source");
|
|
98569
|
+
}
|
|
98570
|
+
return void 0;
|
|
98571
|
+
}
|
|
98572
|
+
const params = match.groups["params"] ?? "";
|
|
98573
|
+
const payload = match.groups["payload"] ?? "";
|
|
98574
|
+
const base64 = /;base64$/iu.test(params);
|
|
98575
|
+
const text = base64 ? decodeBase64Text(payload) : decodeURIComponent(payload);
|
|
98576
|
+
if (!/<svg[\s>]/iu.test(text)) {
|
|
98577
|
+
throw new RangeError("An SVG picture source must hold an <svg> element");
|
|
98578
|
+
}
|
|
98579
|
+
return {
|
|
98580
|
+
svgData: base64 ? `data:image/svg+xml;base64,${payload.replace(/\s+/gu, "")}` : `data:image/svg+xml;base64,${base64Encode(new TextEncoder().encode(text))}`,
|
|
98581
|
+
raster: svgFallback ?? TRANSPARENT_PNG_DATA_URL
|
|
98582
|
+
};
|
|
98583
|
+
}
|
|
98584
|
+
function decodeBase64Text(payload) {
|
|
98585
|
+
try {
|
|
98586
|
+
const binary = atob(payload.replace(/\s+/gu, ""));
|
|
98587
|
+
const bytes = Uint8Array.from(binary, (ch) => ch.charCodeAt(0));
|
|
98588
|
+
return new TextDecoder().decode(bytes);
|
|
98589
|
+
} catch {
|
|
98590
|
+
throw new RangeError("An SVG picture source has base64 data that cannot be read");
|
|
98591
|
+
}
|
|
98592
|
+
}
|
|
98593
|
+
|
|
98594
|
+
// pptx/core/builders/sdk/picture-effects-input.ts
|
|
98595
|
+
function pictureEffectsFromInput(options2) {
|
|
98596
|
+
const { opacity: opacity2, brightness, contrast } = options2 ?? {};
|
|
98597
|
+
if (opacity2 !== void 0 && !(opacity2 >= 0 && opacity2 <= 1)) {
|
|
98598
|
+
throw new RangeError(`ImageOptions.opacity must be between 0 and 1, got ${opacity2}`);
|
|
98599
|
+
}
|
|
98600
|
+
const patch = {};
|
|
98601
|
+
if (opacity2 !== void 0 && opacity2 < 1) {
|
|
98602
|
+
patch.alpha = opacity2;
|
|
98603
|
+
}
|
|
98604
|
+
if (brightness !== void 0) {
|
|
98605
|
+
patch.brightness = brightness / 100;
|
|
98606
|
+
}
|
|
98607
|
+
if (contrast !== void 0) {
|
|
98608
|
+
patch.contrast = contrast / 100;
|
|
98609
|
+
}
|
|
98610
|
+
if (Object.keys(patch).length === 0) {
|
|
98611
|
+
return void 0;
|
|
98612
|
+
}
|
|
98613
|
+
let patched;
|
|
98614
|
+
try {
|
|
98615
|
+
patched = patchPictureEffects([], patch);
|
|
98616
|
+
} catch (error) {
|
|
98617
|
+
throw new RangeError(
|
|
98618
|
+
`ImageOptions.brightness and contrast must be finite percentages from -100 to 100 (${String(error)})`
|
|
98619
|
+
);
|
|
98620
|
+
}
|
|
98621
|
+
let effects2;
|
|
98622
|
+
for (const effect of patched) {
|
|
98623
|
+
effects2 ??= {};
|
|
98624
|
+
if (effect.kind === "alphaModFix") {
|
|
98625
|
+
effects2.alphaModFix = effect.amount * 100;
|
|
98626
|
+
} else if (effect.kind === "luminance") {
|
|
98627
|
+
effects2.lum = {
|
|
98628
|
+
...effect.brightness !== void 0 ? { bright: effect.brightness * 100 } : {},
|
|
98629
|
+
...effect.contrast !== void 0 ? { contrast: effect.contrast * 100 } : {}
|
|
98630
|
+
};
|
|
98631
|
+
}
|
|
98632
|
+
}
|
|
98633
|
+
return effects2;
|
|
98634
|
+
}
|
|
98635
|
+
|
|
98100
98636
|
// pptx/core/builders/sdk/shape-style-input.ts
|
|
98101
98637
|
var DASH_UNITS_PER_WIDTH = 1e5;
|
|
98102
98638
|
var MITER_UNITS_PER_RATIO = 1e5;
|
|
@@ -98135,12 +98671,18 @@ function mapFillToShapeStyle(fill3) {
|
|
|
98135
98671
|
...fill3.foreground !== void 0 ? { fillColor: fill3.foreground } : {},
|
|
98136
98672
|
fillPatternBackgroundColor: fill3.background
|
|
98137
98673
|
};
|
|
98138
|
-
case "image":
|
|
98674
|
+
case "image": {
|
|
98675
|
+
if (typeof fill3.url !== "string" || !fill3.url.startsWith("data:")) {
|
|
98676
|
+
throw new RangeError("FillInput.url of an image fill must be a data: URL");
|
|
98677
|
+
}
|
|
98678
|
+
const layout = mapPictureLayoutInput("FillInput", fill3);
|
|
98139
98679
|
return {
|
|
98140
98680
|
fillMode: "image",
|
|
98141
98681
|
fillImageUrl: fill3.url,
|
|
98142
|
-
fillImageMode:
|
|
98682
|
+
fillImageMode: layout?.tileScaleX !== void 0 ? "tile" : "stretch",
|
|
98683
|
+
...layout ? { fillImageLayout: layout } : {}
|
|
98143
98684
|
};
|
|
98685
|
+
}
|
|
98144
98686
|
case "none":
|
|
98145
98687
|
return { fillMode: "none" };
|
|
98146
98688
|
default:
|
|
@@ -98483,6 +99025,62 @@ function columnFractions(columnWidths, columnCount) {
|
|
|
98483
99025
|
return columnWidths.map((w) => w / sum);
|
|
98484
99026
|
}
|
|
98485
99027
|
|
|
99028
|
+
// pptx/core/builders/sdk/text-body-input.ts
|
|
99029
|
+
var EMU_PER_PX5 = 9525;
|
|
99030
|
+
var MAX_INSET_EMU = 51206400;
|
|
99031
|
+
var MAX_SPC = 4e5;
|
|
99032
|
+
var INSET_FIELDS = {
|
|
99033
|
+
left: "bodyInsetLeft",
|
|
99034
|
+
top: "bodyInsetTop",
|
|
99035
|
+
right: "bodyInsetRight",
|
|
99036
|
+
bottom: "bodyInsetBottom"
|
|
99037
|
+
};
|
|
99038
|
+
var AUTO_FIT = {
|
|
99039
|
+
// The model's `autoFitMode` names read the other way round: `'normal'` is
|
|
99040
|
+
// `a:normAutofit` (PowerPoint shrinks the text on overflow) and `'shrink'`
|
|
99041
|
+
// is `a:spAutoFit` (the shape grows to fit the text).
|
|
99042
|
+
shrinkText: { autoFit: true, autoFitMode: "normal" },
|
|
99043
|
+
resizeShape: { autoFit: true, autoFitMode: "shrink" },
|
|
99044
|
+
none: { autoFit: false, autoFitMode: "none" }
|
|
99045
|
+
};
|
|
99046
|
+
function mapTextBodyInput(input) {
|
|
99047
|
+
const style = {};
|
|
99048
|
+
if (!input) {
|
|
99049
|
+
return style;
|
|
99050
|
+
}
|
|
99051
|
+
const { insets, autoFit, wrap: wrap2 } = input;
|
|
99052
|
+
for (const side of Object.keys(INSET_FIELDS)) {
|
|
99053
|
+
const value = insets?.[side];
|
|
99054
|
+
if (value === void 0) {
|
|
99055
|
+
continue;
|
|
99056
|
+
}
|
|
99057
|
+
if (!Number.isFinite(value) || Math.abs(value * EMU_PER_PX5) > MAX_INSET_EMU) {
|
|
99058
|
+
throw new RangeError(`insets.${side} must be a finite px length, got ${value}`);
|
|
99059
|
+
}
|
|
99060
|
+
style[INSET_FIELDS[side]] = value;
|
|
99061
|
+
}
|
|
99062
|
+
if (autoFit !== void 0) {
|
|
99063
|
+
const mapped = AUTO_FIT[autoFit];
|
|
99064
|
+
if (!mapped) {
|
|
99065
|
+
throw new RangeError(
|
|
99066
|
+
`autoFit must be 'none', 'shrinkText' or 'resizeShape', got ${String(autoFit)}`
|
|
99067
|
+
);
|
|
99068
|
+
}
|
|
99069
|
+
Object.assign(style, mapped);
|
|
99070
|
+
}
|
|
99071
|
+
if (wrap2 !== void 0) {
|
|
99072
|
+
style.textWrap = wrap2 ? "square" : "none";
|
|
99073
|
+
}
|
|
99074
|
+
return style;
|
|
99075
|
+
}
|
|
99076
|
+
function characterSpacingToSpc(px) {
|
|
99077
|
+
const spc = Math.round(px * 75);
|
|
99078
|
+
if (!Number.isFinite(px) || Math.abs(spc) > MAX_SPC) {
|
|
99079
|
+
throw new RangeError(`characterSpacing must be a finite px length, got ${px}`);
|
|
99080
|
+
}
|
|
99081
|
+
return spc;
|
|
99082
|
+
}
|
|
99083
|
+
|
|
98486
99084
|
// pptx/core/builders/sdk/text-segment-style.ts
|
|
98487
99085
|
var RUN_KEYS = [
|
|
98488
99086
|
"fontFamily",
|
|
@@ -98591,6 +99189,12 @@ function mapTextStyleInput(opts) {
|
|
|
98591
99189
|
if (opts.spaceAfter !== void 0) {
|
|
98592
99190
|
ts.paragraphSpacingAfter = opts.spaceAfter;
|
|
98593
99191
|
}
|
|
99192
|
+
if (opts.characterSpacing !== void 0) {
|
|
99193
|
+
ts.characterSpacing = characterSpacingToSpc(opts.characterSpacing);
|
|
99194
|
+
}
|
|
99195
|
+
if (opts.link !== void 0) {
|
|
99196
|
+
Object.assign(ts, mapLinkToRunStyle(opts.link));
|
|
99197
|
+
}
|
|
98594
99198
|
return ts;
|
|
98595
99199
|
}
|
|
98596
99200
|
function buildTextSegments(input, baseStyle) {
|
|
@@ -98615,6 +99219,34 @@ function buildTextSegments(input, baseStyle) {
|
|
|
98615
99219
|
style: { ...base, ...mapTextStyleInput(seg.style) }
|
|
98616
99220
|
}));
|
|
98617
99221
|
}
|
|
99222
|
+
function flipsOf(options2) {
|
|
99223
|
+
return {
|
|
99224
|
+
...options2?.flipHorizontal ? { flipHorizontal: true } : {},
|
|
99225
|
+
...options2?.flipVertical ? { flipVertical: true } : {}
|
|
99226
|
+
};
|
|
99227
|
+
}
|
|
99228
|
+
function applyShapeText(el, options2) {
|
|
99229
|
+
const text = options2?.text;
|
|
99230
|
+
if (!text || text.length === 0) {
|
|
99231
|
+
const body = mapTextBodyInput(options2);
|
|
99232
|
+
if (Object.keys(body).length > 0) {
|
|
99233
|
+
el.text = "";
|
|
99234
|
+
el.textStyle = body;
|
|
99235
|
+
}
|
|
99236
|
+
return;
|
|
99237
|
+
}
|
|
99238
|
+
const textSegments = buildTextSegments(text, options2.textStyle);
|
|
99239
|
+
el.text = typeof text === "string" ? text : text.map((s) => s.text).join("");
|
|
99240
|
+
el.textStyle = {
|
|
99241
|
+
...elementStyleForSegments(mapTextStyleInput(options2.textStyle), textSegments),
|
|
99242
|
+
...mapTextBodyInput(options2)
|
|
99243
|
+
};
|
|
99244
|
+
el.textSegments = textSegments;
|
|
99245
|
+
}
|
|
99246
|
+
function withAction(link) {
|
|
99247
|
+
const actionClick = mapLinkToAction(link);
|
|
99248
|
+
return actionClick ? { actionClick } : {};
|
|
99249
|
+
}
|
|
98618
99250
|
var DEFAULTS = {
|
|
98619
99251
|
text: { x: 100, y: 100, width: 600, height: 50 },
|
|
98620
99252
|
shape: { x: 200, y: 200, width: 300, height: 200 },
|
|
@@ -98655,32 +99287,36 @@ function createTextElement(text, options2) {
|
|
|
98655
99287
|
id: generateId("txt"),
|
|
98656
99288
|
...p,
|
|
98657
99289
|
rotation: options2?.rotation,
|
|
99290
|
+
...flipsOf(options2),
|
|
98658
99291
|
opacity: options2?.opacity,
|
|
98659
99292
|
text: plainText,
|
|
98660
|
-
textStyle:
|
|
99293
|
+
textStyle: {
|
|
99294
|
+
...elementStyleForSegments(mapTextStyleInput(textStyleBase), textSegments),
|
|
99295
|
+
...mapTextBodyInput(options2)
|
|
99296
|
+
},
|
|
98661
99297
|
textSegments,
|
|
98662
|
-
shapeStyle: buildShapeStyle(effectInputs(options2, options2?.fill))
|
|
99298
|
+
shapeStyle: buildShapeStyle(effectInputs(options2, options2?.fill)),
|
|
99299
|
+
...withAction(options2?.link)
|
|
98663
99300
|
};
|
|
98664
99301
|
}
|
|
98665
|
-
|
|
99302
|
+
var DEFAULT_SHAPE_FILL = { type: "solid", color: "#4472C4" };
|
|
99303
|
+
function createShapeElement(shapeType, options2, defaults) {
|
|
98666
99304
|
const p = pos("shape", options2);
|
|
98667
99305
|
const el = {
|
|
98668
99306
|
type: "shape",
|
|
98669
99307
|
id: generateId("shp"),
|
|
98670
99308
|
...p,
|
|
98671
99309
|
rotation: options2?.rotation,
|
|
99310
|
+
...flipsOf(options2),
|
|
98672
99311
|
opacity: options2?.opacity,
|
|
98673
99312
|
shapeType,
|
|
98674
99313
|
shapeAdjustments: options2?.adjustments,
|
|
98675
99314
|
shapeStyle: buildShapeStyle(
|
|
98676
|
-
effectInputs(options2, options2?.fill ??
|
|
98677
|
-
)
|
|
99315
|
+
effectInputs(options2, options2?.fill ?? defaults?.fill ?? DEFAULT_SHAPE_FILL)
|
|
99316
|
+
),
|
|
99317
|
+
...withAction(options2?.link)
|
|
98678
99318
|
};
|
|
98679
|
-
|
|
98680
|
-
el.text = options2.text;
|
|
98681
|
-
el.textStyle = mapTextStyleInput(options2.textStyle);
|
|
98682
|
-
el.textSegments = buildTextSegments(options2.text, options2.textStyle);
|
|
98683
|
-
}
|
|
99319
|
+
applyShapeText(el, options2);
|
|
98684
99320
|
return el;
|
|
98685
99321
|
}
|
|
98686
99322
|
function createConnectorElement(options2) {
|
|
@@ -98716,26 +99352,41 @@ function createConnectorElement(options2) {
|
|
|
98716
99352
|
id: generateId("cxn"),
|
|
98717
99353
|
...p,
|
|
98718
99354
|
rotation: options2?.rotation,
|
|
99355
|
+
...flipsOf(options2),
|
|
98719
99356
|
shapeType: connType,
|
|
98720
99357
|
shapeStyle: style
|
|
98721
99358
|
};
|
|
98722
99359
|
}
|
|
98723
99360
|
function createImageElement(source, options2) {
|
|
98724
99361
|
const p = pos("image", options2);
|
|
99362
|
+
const svg = svgPictureSource(source, options2?.svgFallback);
|
|
99363
|
+
if (svg) {
|
|
99364
|
+
const { svgFallback: _raster, ...rest } = options2 ?? {};
|
|
99365
|
+
const svgPicture = createImageElement(svg.raster, rest);
|
|
99366
|
+
svgPicture.svgData = svg.svgData;
|
|
99367
|
+
return svgPicture;
|
|
99368
|
+
}
|
|
98725
99369
|
const isDataUrl = source.startsWith("data:");
|
|
99370
|
+
const imageEffects = pictureEffectsFromInput(options2);
|
|
98726
99371
|
return {
|
|
98727
99372
|
type: "image",
|
|
98728
99373
|
id: generateId("img"),
|
|
98729
99374
|
...p,
|
|
98730
99375
|
rotation: options2?.rotation,
|
|
98731
|
-
|
|
99376
|
+
...flipsOf(options2),
|
|
99377
|
+
...imageEffects ? { imageEffects } : {},
|
|
98732
99378
|
imagePath: isDataUrl ? void 0 : source,
|
|
98733
99379
|
imageData: isDataUrl ? source : void 0,
|
|
98734
99380
|
altText: options2?.altText,
|
|
98735
99381
|
cropLeft: options2?.cropLeft,
|
|
98736
99382
|
cropTop: options2?.cropTop,
|
|
98737
99383
|
cropRight: options2?.cropRight,
|
|
98738
|
-
cropBottom: options2?.cropBottom
|
|
99384
|
+
cropBottom: options2?.cropBottom,
|
|
99385
|
+
...mapPictureLayoutInput("ImageOptions", {
|
|
99386
|
+
tile: options2?.tile,
|
|
99387
|
+
fillRect: options2?.fillRect
|
|
99388
|
+
}),
|
|
99389
|
+
...withAction(options2?.link)
|
|
98739
99390
|
};
|
|
98740
99391
|
}
|
|
98741
99392
|
function createTableCell(cellInput) {
|
|
@@ -98840,6 +99491,7 @@ function createMediaElement(mediaType, source, options2) {
|
|
|
98840
99491
|
id: generateId("med"),
|
|
98841
99492
|
...p,
|
|
98842
99493
|
rotation: options2?.rotation,
|
|
99494
|
+
...flipsOf(options2),
|
|
98843
99495
|
mediaType,
|
|
98844
99496
|
mediaPath: isDataUrl ? void 0 : source,
|
|
98845
99497
|
mediaData: isDataUrl ? source : void 0,
|
|
@@ -98858,6 +99510,7 @@ function createGroupElement(children6, options2) {
|
|
|
98858
99510
|
id: generateId("grp"),
|
|
98859
99511
|
...p,
|
|
98860
99512
|
rotation: options2?.rotation,
|
|
99513
|
+
...flipsOf(options2),
|
|
98861
99514
|
children: children6
|
|
98862
99515
|
};
|
|
98863
99516
|
}
|
|
@@ -98871,6 +99524,7 @@ function createFreeformElement(pathData, options2) {
|
|
|
98871
99524
|
id: generateId("frm"),
|
|
98872
99525
|
...p,
|
|
98873
99526
|
rotation: options2?.rotation,
|
|
99527
|
+
...flipsOf(options2),
|
|
98874
99528
|
opacity: options2?.opacity,
|
|
98875
99529
|
shapeType: "custom",
|
|
98876
99530
|
pathData,
|
|
@@ -98880,13 +99534,10 @@ function createFreeformElement(pathData, options2) {
|
|
|
98880
99534
|
shapeStyle: buildShapeStyle({
|
|
98881
99535
|
...effectInputs(options2, options2?.fill ?? { type: "none" }),
|
|
98882
99536
|
stroke: options2?.stroke ?? { color: "#000000", width: 2 }
|
|
98883
|
-
})
|
|
99537
|
+
}),
|
|
99538
|
+
...withAction(options2?.link)
|
|
98884
99539
|
};
|
|
98885
|
-
|
|
98886
|
-
el.text = options2.text;
|
|
98887
|
-
el.textStyle = mapTextStyleInput(options2.textStyle);
|
|
98888
|
-
el.textSegments = buildTextSegments(options2.text, options2.textStyle);
|
|
98889
|
-
}
|
|
99540
|
+
applyShapeText(el, options2);
|
|
98890
99541
|
return el;
|
|
98891
99542
|
}
|
|
98892
99543
|
|
|
@@ -98897,9 +99548,12 @@ var SlideBuilder = class {
|
|
|
98897
99548
|
* @param layoutPath - Optional layout archive path.
|
|
98898
99549
|
* @param layoutName - Optional layout display name.
|
|
98899
99550
|
* @param handler - Loaded deck context for placeholder geometry and text styles.
|
|
99551
|
+
* @param shapeDefaults - What `addShape` uses for an omitted option
|
|
99552
|
+
* (`PresentationOptions.shapeDefaults`).
|
|
98900
99553
|
*/
|
|
98901
|
-
constructor(slideNumber, layoutPath, layoutName, handler) {
|
|
99554
|
+
constructor(slideNumber, layoutPath, layoutName, handler, shapeDefaults) {
|
|
98902
99555
|
this.handler = handler;
|
|
99556
|
+
this.shapeDefaults = shapeDefaults;
|
|
98903
99557
|
this.slide = {
|
|
98904
99558
|
id: `slide${slideNumber}`,
|
|
98905
99559
|
rId: `rId${slideNumber + 1}`,
|
|
@@ -98910,6 +99564,7 @@ var SlideBuilder = class {
|
|
|
98910
99564
|
};
|
|
98911
99565
|
}
|
|
98912
99566
|
handler;
|
|
99567
|
+
shapeDefaults;
|
|
98913
99568
|
slide;
|
|
98914
99569
|
/** Add a text box to the slide. */
|
|
98915
99570
|
addText(text, options2) {
|
|
@@ -98957,7 +99612,7 @@ var SlideBuilder = class {
|
|
|
98957
99612
|
}
|
|
98958
99613
|
/** Add a shape to the slide. */
|
|
98959
99614
|
addShape(shapeType, options2) {
|
|
98960
|
-
this.slide.elements.push(createShapeElement(shapeType, options2));
|
|
99615
|
+
this.slide.elements.push(createShapeElement(shapeType, options2, this.shapeDefaults));
|
|
98961
99616
|
return this;
|
|
98962
99617
|
}
|
|
98963
99618
|
/** Add a connector (line) to the slide. */
|
|
@@ -99260,6 +99915,56 @@ ${phShapes}
|
|
|
99260
99915
|
</p:sldLayout>`;
|
|
99261
99916
|
}
|
|
99262
99917
|
|
|
99918
|
+
// pptx/core/builders/sdk/presentation-app-properties.ts
|
|
99919
|
+
var INPUT_FIELDS = /* @__PURE__ */ new Set([
|
|
99920
|
+
"application",
|
|
99921
|
+
"appVersion",
|
|
99922
|
+
"presentationFormat",
|
|
99923
|
+
"company",
|
|
99924
|
+
"manager",
|
|
99925
|
+
"template"
|
|
99926
|
+
]);
|
|
99927
|
+
var APP_VERSION = /^\d+\.\d{4}$/u;
|
|
99928
|
+
function blankAppXml(slideCount) {
|
|
99929
|
+
return `<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
|
99930
|
+
<Properties xmlns="http://schemas.openxmlformats.org/officeDocument/2006/extended-properties"
|
|
99931
|
+
xmlns:vt="http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes">
|
|
99932
|
+
<Application>pptx-viewer-sdk</Application>
|
|
99933
|
+
<Slides>${slideCount}</Slides>
|
|
99934
|
+
<ScaleCrop>false</ScaleCrop>
|
|
99935
|
+
<LinksUpToDate>false</LinksUpToDate>
|
|
99936
|
+
<SharedDoc>false</SharedDoc>
|
|
99937
|
+
<HyperlinksChanged>false</HyperlinksChanged>
|
|
99938
|
+
<AppVersion>1.0000</AppVersion>
|
|
99939
|
+
</Properties>`;
|
|
99940
|
+
}
|
|
99941
|
+
function validate(input) {
|
|
99942
|
+
for (const [field, value] of Object.entries(input)) {
|
|
99943
|
+
if (!INPUT_FIELDS.has(field)) {
|
|
99944
|
+
throw new RangeError(
|
|
99945
|
+
`appProperties.${field} cannot be set when a presentation is created; it takes ${[...INPUT_FIELDS].join(", ")} (counts are computed on save)`
|
|
99946
|
+
);
|
|
99947
|
+
}
|
|
99948
|
+
if (value !== void 0 && typeof value !== "string") {
|
|
99949
|
+
throw new RangeError(`appProperties.${field} must be a string`);
|
|
99950
|
+
}
|
|
99951
|
+
}
|
|
99952
|
+
const version = input.appVersion?.trim();
|
|
99953
|
+
if (version && !APP_VERSION.test(version)) {
|
|
99954
|
+
throw new RangeError(
|
|
99955
|
+
`appProperties.appVersion must be digits, a dot and four digits (e.g. "16.0000"), got "${input.appVersion}"`
|
|
99956
|
+
);
|
|
99957
|
+
}
|
|
99958
|
+
}
|
|
99959
|
+
function newPresentationAppXml(slideCount, input) {
|
|
99960
|
+
const xml = blankAppXml(slideCount);
|
|
99961
|
+
if (input === void 0) {
|
|
99962
|
+
return xml;
|
|
99963
|
+
}
|
|
99964
|
+
validate(input);
|
|
99965
|
+
return writeAppProperties(applyAppOverrides(parseAppProperties(xml), input), xml);
|
|
99966
|
+
}
|
|
99967
|
+
|
|
99263
99968
|
// pptx/core/builders/sdk/standard-layout-placeholders.ts
|
|
99264
99969
|
function standardLayoutPlaceholders(type, width, height) {
|
|
99265
99970
|
if (type === "blank") return [];
|
|
@@ -99617,19 +100322,6 @@ function corePropsXml(title, creator) {
|
|
|
99617
100322
|
<dcterms:modified xsi:type="dcterms:W3CDTF">${now}</dcterms:modified>
|
|
99618
100323
|
</cp:coreProperties>`;
|
|
99619
100324
|
}
|
|
99620
|
-
function appPropsXml(slideCount) {
|
|
99621
|
-
return `<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
|
99622
|
-
<Properties xmlns="http://schemas.openxmlformats.org/officeDocument/2006/extended-properties"
|
|
99623
|
-
xmlns:vt="http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes">
|
|
99624
|
-
<Application>pptx-viewer-sdk</Application>
|
|
99625
|
-
<Slides>${slideCount}</Slides>
|
|
99626
|
-
<ScaleCrop>false</ScaleCrop>
|
|
99627
|
-
<LinksUpToDate>false</LinksUpToDate>
|
|
99628
|
-
<SharedDoc>false</SharedDoc>
|
|
99629
|
-
<HyperlinksChanged>false</HyperlinksChanged>
|
|
99630
|
-
<AppVersion>1.0000</AppVersion>
|
|
99631
|
-
</Properties>`;
|
|
99632
|
-
}
|
|
99633
100325
|
async function buildBlankPresentationArchive(options2) {
|
|
99634
100326
|
const width = options2?.width ?? DEFAULT_WIDTH;
|
|
99635
100327
|
const height = options2?.height ?? DEFAULT_HEIGHT;
|
|
@@ -99671,7 +100363,7 @@ async function buildBlankPresentationArchive(options2) {
|
|
|
99671
100363
|
zip.file("ppt/viewProps.xml", viewPropsXml());
|
|
99672
100364
|
zip.file("ppt/tableStyles.xml", tableStylesXml());
|
|
99673
100365
|
zip.file("docProps/core.xml", corePropsXml(options2?.title, options2?.creator));
|
|
99674
|
-
zip.file("docProps/app.xml",
|
|
100366
|
+
zip.file("docProps/app.xml", newPresentationAppXml(initialSlideCount, options2?.appProperties));
|
|
99675
100367
|
return zip.generateAsync({ type: "arraybuffer" });
|
|
99676
100368
|
}
|
|
99677
100369
|
var PresentationBuilder = class {
|
|
@@ -99696,7 +100388,7 @@ var PresentationBuilder = class {
|
|
|
99696
100388
|
const layoutIdx = STANDARD_LAYOUTS.findIndex((l) => l.name === layoutName) + 1 || 7;
|
|
99697
100389
|
const layoutPath = `ppt/slideLayouts/slideLayout${layoutIdx}.xml`;
|
|
99698
100390
|
const resolvedName = layoutName ?? STANDARD_LAYOUTS[layoutIdx - 1]?.name ?? "Blank";
|
|
99699
|
-
return new SlideBuilder(slideNum, layoutPath, resolvedName, handler);
|
|
100391
|
+
return new SlideBuilder(slideNum, layoutPath, resolvedName, handler, options2?.shapeDefaults);
|
|
99700
100392
|
};
|
|
99701
100393
|
return { handler, data, createSlide };
|
|
99702
100394
|
}
|