pptxgenjs-plus 4.1.17 → 4.1.18

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.
@@ -1,4 +1,4 @@
1
- /* PptxGenJS 4.1.17 @ 2026-08-15T04:08:10.950Z */
1
+ /* PptxGenJS 4.1.18 @ 2026-08-19T14:19:18.293Z */
2
2
 
3
3
  import { JSZip } from "@node-projects/jszip";
4
4
 
@@ -237,6 +237,10 @@ var core_enums_ShapeType = /*#__PURE__*/ function(ShapeType) {
237
237
  ShapeType["accentCallout1"] = "accentCallout1";
238
238
  ShapeType["accentCallout2"] = "accentCallout2";
239
239
  ShapeType["accentCallout3"] = "accentCallout3";
240
+ ShapeType["accentCallout4"] = "accentCallout4";
241
+ ShapeType["accentBorderCallout4"] = "accentBorderCallout4";
242
+ ShapeType["borderCallout4"] = "borderCallout4";
243
+ ShapeType["callout4"] = "callout4";
240
244
  ShapeType["actionButtonBackPrevious"] = "actionButtonBackPrevious";
241
245
  ShapeType["actionButtonBeginning"] = "actionButtonBeginning";
242
246
  ShapeType["actionButtonBlank"] = "actionButtonBlank";
@@ -568,7 +572,7 @@ var core_enums_SHAPE_TYPE = /*#__PURE__*/ function(SHAPE_TYPE) {
568
572
  SHAPE_TYPE["LINE_CALLOUT_3_BORDER_AND_ACCENT_BAR"] = "accentBorderCallout3";
569
573
  SHAPE_TYPE["LINE_CALLOUT_3_NO_BORDER"] = "callout3";
570
574
  SHAPE_TYPE["LINE_CALLOUT_4"] = "borderCallout4";
571
- SHAPE_TYPE["LINE_CALLOUT_4_ACCENT_BAR"] = "accentCallout3=4";
575
+ SHAPE_TYPE["LINE_CALLOUT_4_ACCENT_BAR"] = "accentCallout4";
572
576
  SHAPE_TYPE["LINE_CALLOUT_4_BORDER_AND_ACCENT_BAR"] = "accentBorderCallout4";
573
577
  SHAPE_TYPE["LINE_CALLOUT_4_NO_BORDER"] = "callout4";
574
578
  SHAPE_TYPE["LINE"] = "line";
@@ -680,6 +684,7 @@ var core_enums_MASTER_OBJECTS = /*#__PURE__*/ function(MASTER_OBJECTS) {
680
684
  }({});
681
685
  var core_enums_SLIDE_OBJECT_TYPES = /*#__PURE__*/ function(SLIDE_OBJECT_TYPES) {
682
686
  SLIDE_OBJECT_TYPES["chart"] = "chart";
687
+ SLIDE_OBJECT_TYPES["group"] = "group";
683
688
  SLIDE_OBJECT_TYPES["hyperlink"] = "hyperlink";
684
689
  SLIDE_OBJECT_TYPES["image"] = "image";
685
690
  SLIDE_OBJECT_TYPES["media"] = "media";
@@ -694,13 +699,23 @@ var core_enums_SLIDE_OBJECT_TYPES = /*#__PURE__*/ function(SLIDE_OBJECT_TYPES) {
694
699
  SLIDE_OBJECT_TYPES["officeApp"] = "officeApp";
695
700
  return SLIDE_OBJECT_TYPES;
696
701
  }({});
697
- var core_enums_PLACEHOLDER_TYPES = /*#__PURE__*/ function(PLACEHOLDER_TYPES) {
702
+ /** ECMA-376 §4.8.14 `ST_PlaceholderType` (`standards/ecma/part-21_presentationml-reference-material-animation.txt`). Friendly keys `image`/`table` map to `pic`/`tbl`. */ var core_enums_PLACEHOLDER_TYPES = /*#__PURE__*/ function(PLACEHOLDER_TYPES) {
698
703
  PLACEHOLDER_TYPES["title"] = "title";
699
704
  PLACEHOLDER_TYPES["body"] = "body";
700
- PLACEHOLDER_TYPES["image"] = "pic";
705
+ PLACEHOLDER_TYPES["ctrTitle"] = "ctrTitle";
706
+ PLACEHOLDER_TYPES["subTitle"] = "subTitle";
707
+ PLACEHOLDER_TYPES["dt"] = "dt";
708
+ PLACEHOLDER_TYPES["sldNum"] = "sldNum";
709
+ PLACEHOLDER_TYPES["ftr"] = "ftr";
710
+ PLACEHOLDER_TYPES["hdr"] = "hdr";
711
+ PLACEHOLDER_TYPES["obj"] = "obj";
701
712
  PLACEHOLDER_TYPES["chart"] = "chart";
702
713
  PLACEHOLDER_TYPES["table"] = "tbl";
714
+ PLACEHOLDER_TYPES["clipArt"] = "clipArt";
715
+ PLACEHOLDER_TYPES["dgm"] = "dgm";
703
716
  PLACEHOLDER_TYPES["media"] = "media";
717
+ PLACEHOLDER_TYPES["sldImg"] = "sldImg";
718
+ PLACEHOLDER_TYPES["image"] = "pic";
704
719
  return PLACEHOLDER_TYPES;
705
720
  }({});
706
721
  /**
@@ -950,11 +965,11 @@ function _object_spread_props(target, source) {
950
965
  // FIRST: Convert string numeric value if reqd
951
966
  if (typeof size === 'string' && !isNaN(Number(size))) size = Number(size);
952
967
  // CASE 1: Number in inches
953
- // Assume any number less than 100 is inches
954
- if (typeof size === 'number' && size < 100) return inch2Emu(size);
968
+ // Assume any number whose absolute value is less than 100 is inches (off-slide coords are negative)
969
+ if (typeof size === 'number' && Math.abs(size) < 100) return inch2Emu(size);
955
970
  // CASE 2: Number is already converted to something other than inches
956
- // Assume any number greater than 100 sure isnt inches! Just return it (assume value is EMU already).
957
- if (typeof size === 'number' && size >= 100) return size;
971
+ // Assume any number whose absolute value is 100+ is EMU already.
972
+ if (typeof size === 'number' && Math.abs(size) >= 100) return size;
958
973
  // CASE 3: Percentage (ex: '50%')
959
974
  if (typeof size === 'string' && size.includes('%')) {
960
975
  if (xyDir && xyDir === 'X') return Math.round(parseFloat(size) / 100 * layout.width);
@@ -1004,8 +1019,8 @@ function _object_spread_props(target, source) {
1004
1019
  * @returns {number} EMU value
1005
1020
  */ function inch2Emu(inches) {
1006
1021
  // NOTE: Provide Caller Safety: Numbers may get conv<->conv during flight, so be kind and do some simple checks to ensure inches were passed
1007
- // Any value over 100 damn sure isnt inches, so lets assume its in EMU already, therefore, just return the same value
1008
- if (typeof inches === 'number' && inches > 100) return inches;
1022
+ // Any absolute value over 100 is not inches (negative EMU is off-slide), so return it unchanged
1023
+ if (typeof inches === 'number' && Math.abs(inches) > 100) return inches;
1009
1024
  if (typeof inches === 'string') inches = Number(inches.replace(/in*/gi, ''));
1010
1025
  return Math.round((/* inlined export .EMU */914400) * inches);
1011
1026
  }
@@ -1072,23 +1087,33 @@ function _object_spread_props(target, source) {
1072
1087
  * Invalid length or entries fall back to Office defaults (with a warning).
1073
1088
  */ function resolveThemeColors(theme) {
1074
1089
  const input = theme === null || theme === void 0 ? void 0 : theme.themeColors;
1075
- if (!input) return [
1076
- ...DEF_THEME_COLORS
1077
- ];
1078
- if (input.length !== 12) {
1090
+ let colors;
1091
+ if (!input) {
1092
+ colors = [
1093
+ ...DEF_THEME_COLORS
1094
+ ];
1095
+ } else if (input.length !== 12) {
1079
1096
  console.warn(`[pptxgenjs] theme.themeColors must contain exactly 12 hex colors (got ${input.length}); using Office defaults`);
1080
- return [
1097
+ colors = [
1081
1098
  ...DEF_THEME_COLORS
1082
1099
  ];
1100
+ } else {
1101
+ colors = input.map((raw, idx)=>{
1102
+ const hex = String(raw || '').replace('#', '').toUpperCase();
1103
+ if (!REGEX_HEX_COLOR.test(hex)) {
1104
+ console.warn(`[pptxgenjs] theme.themeColors[${idx}]="${raw}" is not a valid 6-digit hex; using default ${DEF_THEME_COLORS[idx]}`);
1105
+ return DEF_THEME_COLORS[idx];
1106
+ }
1107
+ return hex;
1108
+ });
1083
1109
  }
1084
- return input.map((raw, idx)=>{
1085
- const hex = String(raw || '').replace('#', '').toUpperCase();
1086
- if (!REGEX_HEX_COLOR.test(hex)) {
1087
- console.warn(`[pptxgenjs] theme.themeColors[${idx}]="${raw}" is not a valid 6-digit hex; using default ${DEF_THEME_COLORS[idx]}`);
1088
- return DEF_THEME_COLORS[idx];
1089
- }
1090
- return hex;
1091
- });
1110
+ // Additive override for `a:hlink` (ECMA-376 clrScheme). Reject non-strings and invalid hex.
1111
+ if (typeof (theme === null || theme === void 0 ? void 0 : theme.hlinkColor) === 'string') {
1112
+ const hex = theme.hlinkColor.replace('#', '').toUpperCase();
1113
+ if (REGEX_HEX_COLOR.test(hex)) colors[10] = hex;
1114
+ else console.warn(`[pptxgenjs] theme.hlinkColor="${theme.hlinkColor}" is not a valid 6-digit hex; using ${colors[10]}`);
1115
+ }
1116
+ return colors;
1092
1117
  }
1093
1118
  function isModifiedThemeColor(value) {
1094
1119
  return typeof value === 'object' && value !== null && 'baseColor' in value;
@@ -1318,6 +1343,9 @@ function createGlowElement(glow) {
1318
1343
  case 'pattern':
1319
1344
  outText += createPatternFillElement(typeof props === 'string' || isModifiedThemeColor(props) ? undefined : props.pattern, typeof colorVal === 'string' ? colorVal : String(colorVal.baseColor));
1320
1345
  break;
1346
+ case 'none':
1347
+ outText += '<a:noFill/>';
1348
+ break;
1321
1349
  default:
1322
1350
  outText += '';
1323
1351
  break;
@@ -1941,17 +1969,18 @@ function gen_tables_object_spread(target) {
1941
1969
  });
1942
1970
  // IMPORTANT: ^^^ add empty if there are no words to avoid "needs repair" issue triggered when cells have null content
1943
1971
  }
1944
- // 5: increase table height by the curr line height (if we're on the last column)
1945
- if (currCellIdx === numCols - 1) emuTabCurrH += emuLineMaxH;
1946
- // 6: advance column/cell index (or circle back to first one to continue adding lines)
1947
- currCellIdx = currCellIdx < numCols - 1 ? currCellIdx + 1 : 0;
1948
- // 7: WIP: done?
1972
+ // 5: done? Check before adding height so the last line of a non-last column still counts
1973
+ // (dunefront 9a4d283 — otherwise the row under-reports height and overflows the slide).
1949
1974
  const brent = rowCellLines.map((cell)=>{
1950
1975
  var _ref;
1951
1976
  var _cell__lines;
1952
1977
  return (_ref = (_cell__lines = cell._lines) === null || _cell__lines === void 0 ? void 0 : _cell__lines.length) !== null && _ref !== void 0 ? _ref : 0;
1953
1978
  }).reduce((prev, next)=>prev + next);
1954
1979
  if (brent === 0) isDone = true;
1980
+ // 6: increase table height by the curr line height (last column, or the row just finished)
1981
+ if (isDone || currCellIdx === numCols - 1) emuTabCurrH += emuLineMaxH;
1982
+ // 7: advance column/cell index (or circle back to first one to continue adding lines)
1983
+ currCellIdx = currCellIdx < numCols - 1 ? currCellIdx + 1 : 0;
1955
1984
  }
1956
1985
  // F: Flush/capture row buffer before it resets at the top of this loop
1957
1986
  if (currTableRow.length > 0) flushCurrentRowToSlide(newTableRowSlide, currTableRow);
@@ -2289,6 +2318,49 @@ function text_object_spread_props(target, source) {
2289
2318
  /**
2290
2319
  * Text-body, run, and placeholder rendering.
2291
2320
  */
2321
+ /** ECMA-376 §5.1.12.76 `ST_TextShapeType` — used to validate `a:prstTxWarp@prst`. */ const TEXT_SHAPE_TYPES = new Set([
2322
+ 'textNoShape',
2323
+ 'textPlain',
2324
+ 'textStop',
2325
+ 'textTriangle',
2326
+ 'textTriangleInverted',
2327
+ 'textChevron',
2328
+ 'textChevronInverted',
2329
+ 'textRingInside',
2330
+ 'textRingOutside',
2331
+ 'textArchUp',
2332
+ 'textArchDown',
2333
+ 'textCircle',
2334
+ 'textButton',
2335
+ 'textArchUpPour',
2336
+ 'textArchDownPour',
2337
+ 'textCirclePour',
2338
+ 'textButtonPour',
2339
+ 'textCurveUp',
2340
+ 'textCurveDown',
2341
+ 'textCanUp',
2342
+ 'textCanDown',
2343
+ 'textWave1',
2344
+ 'textWave2',
2345
+ 'textDoubleWave1',
2346
+ 'textWave4',
2347
+ 'textInflate',
2348
+ 'textDeflate',
2349
+ 'textInflateBottom',
2350
+ 'textDeflateBottom',
2351
+ 'textInflateTop',
2352
+ 'textDeflateTop',
2353
+ 'textDeflateInflate',
2354
+ 'textDeflateInflateDeflate',
2355
+ 'textFadeRight',
2356
+ 'textFadeLeft',
2357
+ 'textFadeUp',
2358
+ 'textFadeDown',
2359
+ 'textSlantUp',
2360
+ 'textSlantDown',
2361
+ 'textCascadeUp',
2362
+ 'textCascadeDown'
2363
+ ]);
2292
2364
 
2293
2365
  /**
2294
2366
  * Generate XML Paragraph Properties
@@ -2442,11 +2514,20 @@ function text_object_spread_props(target, source) {
2442
2514
  ].includes(opts.caps) ? ` cap="${opts.caps}"` : '';
2443
2515
  runProps += ' dirty="0">';
2444
2516
  // Color / Font / Highlight / Outline are children of <a:rPr>, so add them now before closing the runProperties tag
2445
- if (opts.color || opts.fontFace || opts.outline || typeof opts.underline === 'object' && opts.underline.color) {
2517
+ if (opts.color || opts.gradient || opts.fontFace || opts.fontFaceEa || opts.fontFaceCs || opts.outline || typeof opts.underline === 'object' && opts.underline.color) {
2446
2518
  if (opts.outline && typeof opts.outline === 'object') {
2447
- runProps += `<a:ln w="${valToPts(opts.outline.size || 0.75)}">${genXmlColorSelection(opts.outline.color || 'FFFFFF')}</a:ln>`;
2448
- }
2449
- if (opts.color) runProps += genXmlColorSelection({
2519
+ runProps += `<a:ln w="${valToPts(opts.outline.size || 0.75)}">${genXmlColorSelection({
2520
+ color: opts.outline.color || 'FFFFFF',
2521
+ transparency: opts.outline.transparency
2522
+ })}</a:ln>`;
2523
+ }
2524
+ // Run fill: gradient (`a:gradFill`) takes precedence over solid `color` (WordArt / text gradient)
2525
+ if (opts.gradient) runProps += genXmlColorSelection({
2526
+ type: 'gradient',
2527
+ gradient: opts.gradient,
2528
+ transparency: opts.transparency
2529
+ });
2530
+ else if (opts.color) runProps += genXmlColorSelection({
2450
2531
  color: opts.color,
2451
2532
  transparency: opts.transparency
2452
2533
  });
@@ -2454,9 +2535,14 @@ function text_object_spread_props(target, source) {
2454
2535
  if (typeof opts.underline === 'object' && opts.underline.color) runProps += `<a:uFill>${genXmlColorSelection(opts.underline.color)}</a:uFill>`;
2455
2536
  const resolvedGlow = resolveGlowOptions(opts.glow);
2456
2537
  if (resolvedGlow) runProps += `<a:effectLst>${createGlowElement(resolvedGlow)}</a:effectLst>`;
2457
- if (opts.fontFace) {
2458
- // NOTE: 'cs' = Complex Script, 'ea' = East Asian (use "-120" instead of "0" - per Issue #174); ea must come first (Issue #174)
2459
- runProps += `<a:latin typeface="${opts.fontFace}" pitchFamily="34" charset="0"/><a:ea typeface="${opts.fontFace}" pitchFamily="34" charset="-122"/><a:cs typeface="${opts.fontFace}" pitchFamily="34" charset="-120"/>`;
2538
+ const latin = opts.fontFace;
2539
+ const ea = opts.fontFaceEa || opts.fontFace;
2540
+ const cs = opts.fontFaceCs || opts.fontFace;
2541
+ if (latin || ea || cs) {
2542
+ // NOTE: 'cs' = Complex Script, 'ea' = East Asian (use "-120" instead of "0" - per Issue #174)
2543
+ if (latin) runProps += `<a:latin typeface="${latin}" pitchFamily="34" charset="0"/>`;
2544
+ if (ea) runProps += `<a:ea typeface="${ea}" pitchFamily="34" charset="-122"/>`;
2545
+ if (cs) runProps += `<a:cs typeface="${cs}" pitchFamily="34" charset="-120"/>`;
2460
2546
  }
2461
2547
  }
2462
2548
  // Hyperlink support
@@ -2584,6 +2670,10 @@ function genXmlTextRun(textObj) {
2584
2670
  if (slideObject.options._bodyProp.vert) bodyProperties += ' vert="' + slideObject.options._bodyProp.vert + '"'; // VALS: [eaVert,horz,mongolianVert,vert,vert270,wordArtVert,wordArtVertRtl]
2585
2671
  // E: Close <a:bodyPr element
2586
2672
  bodyProperties += '>';
2673
+ // E.1: WordArt text warp (`a:prstTxWarp`) — first child of CT_TextBodyProperties, before autofit
2674
+ if (slideObject.options.presetShape && TEXT_SHAPE_TYPES.has(slideObject.options.presetShape)) {
2675
+ bodyProperties += `<a:prstTxWarp prst="${slideObject.options.presetShape}"><a:avLst/></a:prstTxWarp>`;
2676
+ }
2587
2677
  /**
2588
2678
  * F: Text Fit/AutoFit/Shrink option
2589
2679
  * @see: http://officeopenxml.com/drwSp-text-bodyPr-fit.php
@@ -2812,7 +2902,7 @@ function genXmlTextRun(textObj) {
2812
2902
  // NOTE: This loop will pick up unecessary keys (`x`, etc.), but it doesnt hurt anything
2813
2903
  // `glow` / softEdge / reflection belong on the shape effectLst (not per-run), unless set on the run itself
2814
2904
  // `omml` is a run-level math payload — inheriting it would replace sibling plain-text runs
2815
- if (key === 'glow' || key === 'softEdge' || key === 'reflection' || key === 'shadow' || key === 'omml') return;
2905
+ if (key === 'glow' || key === 'softEdge' || key === 'reflection' || key === 'shadow' || key === 'blur' || key === 'omml') return;
2816
2906
  if (key !== 'bullet' && !textOpts[key]) textOpts[key] = val;
2817
2907
  });
2818
2908
  // D: Add formatted textrun
@@ -2825,12 +2915,15 @@ function genXmlTextRun(textObj) {
2825
2915
  });
2826
2916
  /* C: Append 'endParaRPr' (when needed) and close current open paragraph
2827
2917
  * NOTE: (ISSUE#20, ISSUE#193): Add 'endParaRPr' with font/size props or PPT default (Arial/18pt en-us) is used making row "too tall"/not honoring options
2828
- */ if (slideObj._type === (/* inlined export .SLIDE_OBJECT_TYPES.tablecell */"tablecell") && (opts.fontSize || opts.fontFace)) {
2829
- if (opts.fontFace) {
2918
+ */ if (slideObj._type === (/* inlined export .SLIDE_OBJECT_TYPES.tablecell */"tablecell") && (opts.fontSize || opts.fontFace || opts.fontFaceEa || opts.fontFaceCs)) {
2919
+ const latin = opts.fontFace;
2920
+ const ea = opts.fontFaceEa || opts.fontFace;
2921
+ const cs = opts.fontFaceCs || opts.fontFace;
2922
+ if (latin || ea || cs) {
2830
2923
  strSlideXml += `<a:endParaRPr lang="${opts.lang || 'en-US'}"` + (opts.fontSize ? ` sz="${Math.round(opts.fontSize * 100)}"` : '') + ' dirty="0">';
2831
- strSlideXml += `<a:latin typeface="${opts.fontFace}" charset="0"/>`;
2832
- strSlideXml += `<a:ea typeface="${opts.fontFace}" charset="0"/>`;
2833
- strSlideXml += `<a:cs typeface="${opts.fontFace}" charset="0"/>`;
2924
+ if (latin) strSlideXml += `<a:latin typeface="${latin}" charset="0"/>`;
2925
+ if (ea) strSlideXml += `<a:ea typeface="${ea}" charset="0"/>`;
2926
+ if (cs) strSlideXml += `<a:cs typeface="${cs}" charset="0"/>`;
2834
2927
  strSlideXml += '</a:endParaRPr>';
2835
2928
  } else {
2836
2929
  strSlideXml += `<a:endParaRPr lang="${opts.lang || 'en-US'}"` + (opts.fontSize ? ` sz="${Math.round(opts.fontSize * 100)}"` : '') + ' dirty="0"/>';
@@ -2904,24 +2997,40 @@ const NS_P232 = 'http://schemas.microsoft.com/office/powerpoint/2023/02/main';
2904
2997
  const body = extraExts.join('') + genXmlNvPrDesignExts(options);
2905
2998
  return body ? `<p:extLst>${body}</p:extLst>` : '';
2906
2999
  }
3000
+ /**
3001
+ * Resolve a placeholder type to the ST_PlaceholderType token written on `p:ph@type`.
3002
+ * ECMA-376 §4.4.1.33 / CT_Placeholder: `type` is `use="optional" default="obj"`
3003
+ * (`standards/ecma/part-20_presentationml-reference-material-slides.txt`).
3004
+ * Omitting the attribute is therefore the generic object placeholder, not a picture/table slot.
3005
+ *
3006
+ * `PlaceholderProps.type` is the OOXML token ('pic', 'tbl', …) while PLACEHOLDER_TYPES is keyed
3007
+ * by friendly name ('image', 'table'). Accept both so `type: 'pic'` and `PLACEHOLDER_TYPES.image`
3008
+ * emit `type="pic"`. Port of gitbrent/PptxGenJS#1526; the prior double lookup dropped pic/tbl.
3009
+ * @param {string} type placeholder type as provided by the user
3010
+ * @returns OOXML placeholder type, or an empty string when unrecognized
3011
+ */ function resolvePlaceholderType(type) {
3012
+ var _ref;
3013
+ var _PLACEHOLDER_TYPES_type;
3014
+ if (!type) return '';
3015
+ // A) OOXML value ('pic'): the documented form of `PlaceholderProps.type`
3016
+ const ooxmlTypes = Object.values(core_enums_PLACEHOLDER_TYPES);
3017
+ if (ooxmlTypes.includes(type)) return type;
3018
+ // B) Enum key ('image'): tolerated so untyped (JS) callers keep working
3019
+ return (_ref = (_PLACEHOLDER_TYPES_type = core_enums_PLACEHOLDER_TYPES[type]) === null || _PLACEHOLDER_TYPES_type === void 0 ? void 0 : _PLACEHOLDER_TYPES_type.toString()) !== null && _ref !== void 0 ? _ref : '';
3020
+ }
2907
3021
  /**
2908
3022
  * Generate an XML Placeholder
2909
3023
  * @param {ISlideObject} placeholderObj
2910
3024
  * @param {ObjectOptions} extraOpts slide-object options (phTypeExt override)
2911
3025
  * @returns XML
2912
3026
  */ function genXmlPlaceholder(placeholderObj, extraOpts) {
2913
- var _ref, _ref1;
2914
- var _placeholderObj_options, _placeholderObj_options1, _PLACEHOLDER_TYPES_placeholderTyp, _placeholderObj_options2;
3027
+ var _ref;
3028
+ var _placeholderObj_options, _placeholderObj_options1, _placeholderObj_options2;
2915
3029
  if (!placeholderObj) return '';
2916
3030
  const placeholderIdx = ((_placeholderObj_options = placeholderObj.options) === null || _placeholderObj_options === void 0 ? void 0 : _placeholderObj_options._placeholderIdx) ? placeholderObj.options._placeholderIdx : '';
2917
- const placeholderTyp = ((_placeholderObj_options1 = placeholderObj.options) === null || _placeholderObj_options1 === void 0 ? void 0 : _placeholderObj_options1._placeholderType) ? placeholderObj.options._placeholderType : '';
2918
- // NOTE: accept both the friendly name ('image', 'table') and the OOXML code it maps to ('pic', 'tbl').
2919
- // The old code looked the mapped code back up in the enum, which only ever hit for the types whose
2920
- // name and code are identical - that is why picture/chart/table placeholders never got a `type` (issue #33).
2921
- const placeholderCodes = Object.values(core_enums_PLACEHOLDER_TYPES);
2922
- const placeholderType = (_ref = (_PLACEHOLDER_TYPES_placeholderTyp = core_enums_PLACEHOLDER_TYPES[placeholderTyp]) === null || _PLACEHOLDER_TYPES_placeholderTyp === void 0 ? void 0 : _PLACEHOLDER_TYPES_placeholderTyp.toString()) !== null && _ref !== void 0 ? _ref : placeholderCodes.includes(placeholderTyp) ? placeholderTyp : '';
3031
+ const placeholderType = resolvePlaceholderType((_placeholderObj_options1 = placeholderObj.options) === null || _placeholderObj_options1 === void 0 ? void 0 : _placeholderObj_options1._placeholderType);
2923
3032
  const attrs = `${placeholderIdx ? ' idx="' + placeholderIdx.toString() + '"' : ''}` + `${placeholderType ? ` type="${placeholderType}"` : ''}` + `${placeholderObj.text && placeholderObj.text.length > 0 ? ' hasCustomPrompt="1"' : ''}`;
2924
- const phTypeExt = (_ref1 = extraOpts === null || extraOpts === void 0 ? void 0 : extraOpts.phTypeExt) !== null && _ref1 !== void 0 ? _ref1 : (_placeholderObj_options2 = placeholderObj.options) === null || _placeholderObj_options2 === void 0 ? void 0 : _placeholderObj_options2.phTypeExt;
3033
+ const phTypeExt = (_ref = extraOpts === null || extraOpts === void 0 ? void 0 : extraOpts.phTypeExt) !== null && _ref !== void 0 ? _ref : (_placeholderObj_options2 = placeholderObj.options) === null || _placeholderObj_options2 === void 0 ? void 0 : _placeholderObj_options2.phTypeExt;
2925
3034
  if (phTypeExt === 'cameo' || phTypeExt === 'unknown') {
2926
3035
  return `<p:ph${attrs}>` + `<p:extLst><p:ext uri="${URI_PH_TYPE_EXT}">` + `<p232:phTypeExt xmlns:p232="${NS_P232}"><p232:type><p232:${phTypeExt}/></p232:type></p232:phTypeExt>` + '</p:ext></p:extLst></p:ph>';
2927
3036
  }
@@ -3092,6 +3201,42 @@ function gen_objects_object_spread_props(target, source) {
3092
3201
  }
3093
3202
  return target;
3094
3203
  }
3204
+ function _object_without_properties(source, excluded) {
3205
+ if (source == null) return {};
3206
+ var target = {}, sourceKeys, key, i;
3207
+ if (typeof Reflect !== "undefined" && Reflect.ownKeys) {
3208
+ sourceKeys = Reflect.ownKeys(Object(source));
3209
+ for(i = 0; i < sourceKeys.length; i++){
3210
+ key = sourceKeys[i];
3211
+ if (excluded.indexOf(key) >= 0) continue;
3212
+ if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
3213
+ target[key] = source[key];
3214
+ }
3215
+ return target;
3216
+ }
3217
+ target = _object_without_properties_loose(source, excluded);
3218
+ if (Object.getOwnPropertySymbols) {
3219
+ sourceKeys = Object.getOwnPropertySymbols(source);
3220
+ for(i = 0; i < sourceKeys.length; i++){
3221
+ key = sourceKeys[i];
3222
+ if (excluded.indexOf(key) >= 0) continue;
3223
+ if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
3224
+ target[key] = source[key];
3225
+ }
3226
+ }
3227
+ return target;
3228
+ }
3229
+ function _object_without_properties_loose(source, excluded) {
3230
+ if (source == null) return {};
3231
+ var target = {}, sourceKeys = Object.getOwnPropertyNames(source), key, i;
3232
+ for(i = 0; i < sourceKeys.length; i++){
3233
+ key = sourceKeys[i];
3234
+ if (excluded.indexOf(key) >= 0) continue;
3235
+ if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
3236
+ target[key] = source[key];
3237
+ }
3238
+ return target;
3239
+ }
3095
3240
  /**
3096
3241
  * PptxGenJS: Slide Object Generators
3097
3242
  */
@@ -3102,6 +3247,13 @@ function gen_objects_object_spread_props(target, source) {
3102
3247
  /** Type guard: true when `arr` is a flat (1-level) array rather than a nested one. */ function isFlatStringArray(arr) {
3103
3248
  return Array.isArray(arr) && (arr.length === 0 || !Array.isArray(arr[0]));
3104
3249
  }
3250
+ /** Unwrap master `text` / placeholder content so TextProps[] is not double-wrapped as a single run. */ function masterTextRuns(text) {
3251
+ return Array.isArray(text) ? text : [
3252
+ {
3253
+ text
3254
+ }
3255
+ ];
3256
+ }
3105
3257
  /**
3106
3258
  * Transforms a slide definition to a slide object that is then passed to the XML transformation process.
3107
3259
  * @param {SlideMasterProps} props - slide definition
@@ -3131,11 +3283,7 @@ function gen_objects_object_spread_props(target, source) {
3131
3283
  throw new Error('defineSlideMaster: tables on a master cannot auto-page');
3132
3284
  };
3133
3285
  addTableDefinition(target, object[key].rows, tableProps, target, target._presLayout, noPaging, noPaging);
3134
- } else if (core_enums_MASTER_OBJECTS[key] && key === 'text') addTextDefinition(target, [
3135
- {
3136
- text: object[key].text
3137
- }
3138
- ], object[key].options, false);
3286
+ } else if (core_enums_MASTER_OBJECTS[key] && key === 'text') addTextDefinition(target, masterTextRuns(object[key].text), object[key].options, false);
3139
3287
  else if (core_enums_MASTER_OBJECTS[key] && key === 'placeholder') {
3140
3288
  // TODO: 20180820: Check for existing `name`?
3141
3289
  object[key].options.placeholder = object[key].options.name;
@@ -3143,11 +3291,7 @@ function gen_objects_object_spread_props(target, source) {
3143
3291
  object[key].options._placeholderType = object[key].options.type;
3144
3292
  delete object[key].options.type; // remap name for earier handling internally
3145
3293
  object[key].options._placeholderIdx = 100 + idx;
3146
- addTextDefinition(target, [
3147
- {
3148
- text: object[key].text
3149
- }
3150
- ], object[key].options, true);
3294
+ addTextDefinition(target, masterTextRuns(object[key].text), object[key].options, true);
3151
3295
  // TODO: ISSUE#599 - only text is suported now (add more below)
3152
3296
  // else if (object[key].image) addImageDefinition(target, object[key].image)
3153
3297
  /* 20200120: So... image placeholders go into the "slideLayoutN.xml" file and addImage doesnt do this yet...
@@ -3271,8 +3415,12 @@ function gen_objects_object_spread_props(target, source) {
3271
3415
  */ // STEP 2: Set default options/decode user options
3272
3416
  // A: Core
3273
3417
  options._type = type;
3274
- options.x = typeof options.x !== 'undefined' && options.x != null && !isNaN(Number(options.x)) ? options.x : 1;
3275
- options.y = typeof options.y !== 'undefined' && options.y != null && !isNaN(Number(options.y)) ? options.y : 1;
3418
+ const explicitChartX = typeof options.x !== 'undefined' && options.x != null && !isNaN(Number(options.x));
3419
+ const explicitChartY = typeof options.y !== 'undefined' && options.y != null && !isNaN(Number(options.y));
3420
+ const explicitChartW = options.w !== undefined && options.w !== null;
3421
+ const explicitChartH = options.h !== undefined && options.h !== null;
3422
+ options.x = explicitChartX ? options.x : 1;
3423
+ options.y = explicitChartY ? options.y : 1;
3276
3424
  options.w = options.w || '50%';
3277
3425
  options.h = options.h || '50%';
3278
3426
  options.objectName = options.objectName ? encodeXmlEntities(options.objectName) : `Chart ${target._slideObjects.filter((obj)=>obj._type === (/* inlined export .SLIDE_OBJECT_TYPES.chart */"chart")).length}`;
@@ -3491,7 +3639,11 @@ function gen_objects_object_spread_props(target, source) {
3491
3639
  // is a color string (vs ObjectOptions' ShapeFillProps) and is never read here, so it
3492
3640
  // is reconciled to undefined to keep the stored object a valid ObjectOptions.
3493
3641
  resultObject.options = gen_objects_object_spread_props(gen_objects_object_spread({}, options), {
3494
- fill: undefined
3642
+ fill: undefined,
3643
+ _explicitX: explicitChartX,
3644
+ _explicitY: explicitChartY,
3645
+ _explicitW: explicitChartW,
3646
+ _explicitH: explicitChartH
3495
3647
  });
3496
3648
  resultObject.chartRid = getNewRelId(target);
3497
3649
  // STEP 5: Add this chart to this Slide Rels (rId/rels count spans all slides! Count all images to get next rId)
@@ -3519,11 +3671,75 @@ function gen_objects_object_spread_props(target, source) {
3519
3671
  * 1000 and slides also reach 1000+), so a layout image `image-1002-1` would collide with slide #1002's
3520
3672
  * `image-1002-1` and one overwrites the other in the zip (issue #1416). Prefix layout/master media with
3521
3673
  * `layout-` so the two namespaces can never collide; the slide namespace keeps its plain `image-<n>-<i>`.
3522
- */ function imageTargetStem(target) {
3674
+ */ function imageBorderToLine(border) {
3675
+ var _side_width;
3676
+ if (!border) return undefined;
3677
+ const side = Array.isArray(border) ? border[0] : border;
3678
+ if (!side || side.type === 'none') return undefined;
3679
+ return {
3680
+ color: side.color,
3681
+ width: (_side_width = side.width) !== null && _side_width !== void 0 ? _side_width : side.pt
3682
+ };
3683
+ }
3684
+ function imageTargetStem(target) {
3523
3685
  // PresSlide has `_rId`; SlideLayout/master does not. Masters number from 1000 and collide with slide #1000+.
3524
3686
  if (!('_rId' in target)) return `layout-image-${target._relsMedia.length + 1}`;
3525
3687
  return `image-${target._slideNum}-${target._relsMedia.length + 1}`;
3526
3688
  }
3689
+ function isSvgFillSource(data, path) {
3690
+ const src = (data || path).toLowerCase();
3691
+ return src.includes('image/svg+xml') || src.endsWith('.svg') || src.includes('.svg?');
3692
+ }
3693
+ /**
3694
+ * Register a table-cell image fill as slide media so `a:blipFill` can embed it
3695
+ * (Dominik-von-Burg PR 1461). Must run at addTable time so encodeSlideMediaRels sees the rels.
3696
+ */ function registerTableCellImageFill(target, fill) {
3697
+ const data = typeof (fill === null || fill === void 0 ? void 0 : fill.data) === 'string' ? fill.data : '';
3698
+ const path = typeof (fill === null || fill === void 0 ? void 0 : fill.path) === 'string' ? fill.path : '';
3699
+ if (!data && !path) return undefined;
3700
+ const isSvg = isSvgFillSource(data, path);
3701
+ if (isSvg) {
3702
+ const pngRid = getNewRelId(target);
3703
+ target._relsMedia.push({
3704
+ path: path || data + 'png',
3705
+ type: 'image/png',
3706
+ extn: 'png',
3707
+ data: data || '',
3708
+ rId: pngRid,
3709
+ isDuplicate: false,
3710
+ isSvgPng: true,
3711
+ Target: `../media/${imageTargetStem(target)}.png`
3712
+ });
3713
+ const svgRid = getNewRelId(target);
3714
+ target._relsMedia.push({
3715
+ path: path || data,
3716
+ type: 'image/svg+xml',
3717
+ extn: 'svg',
3718
+ data: data || '',
3719
+ rId: svgRid,
3720
+ isDuplicate: false,
3721
+ Target: `../media/${imageTargetStem(target)}.svg`
3722
+ });
3723
+ return svgRid;
3724
+ }
3725
+ let extn = (path.split('?')[0].split('#')[0].split('.').pop() || 'png').toLowerCase();
3726
+ const mime = data ? /image\/([\w+]+);/.exec(data) : null;
3727
+ if (mime === null || mime === void 0 ? void 0 : mime[1]) extn = mime[1] === 'svg+xml' ? 'svg' : mime[1];
3728
+ if (extn === 'jpg') extn = 'jpeg';
3729
+ const imgType = 'image/' + extn;
3730
+ const dupeItem = target._relsMedia.filter((item)=>item.type === imgType && !item.isDuplicate && !item.isSvgPng && (path && item.path === path || data && item.data && item.data === data))[0];
3731
+ const rId = getNewRelId(target);
3732
+ target._relsMedia.push({
3733
+ path: path || 'preencoded.' + extn,
3734
+ type: imgType,
3735
+ extn,
3736
+ data: data || '',
3737
+ rId,
3738
+ isDuplicate: !!(dupeItem === null || dupeItem === void 0 ? void 0 : dupeItem.Target),
3739
+ Target: (dupeItem === null || dupeItem === void 0 ? void 0 : dupeItem.Target) ? dupeItem.Target : `../media/${imageTargetStem(target)}.${extn}`
3740
+ });
3741
+ return rId;
3742
+ }
3527
3743
  function addImageDefinition(target, opt) {
3528
3744
  var _strImagePath_substring_split__split_pop;
3529
3745
  const newObject = {
@@ -3591,8 +3807,18 @@ function addImageDefinition(target, opt) {
3591
3807
  transparency: opt.transparency || 0,
3592
3808
  objectName,
3593
3809
  shadow: opt.shadow ? correctShadowOptions(opt.shadow) : undefined,
3594
- line: opt.line,
3810
+ glow: opt.glow,
3811
+ softEdge: opt.softEdge,
3812
+ reflection: opt.reflection,
3813
+ blur: opt.blur,
3814
+ line: opt.line || imageBorderToLine(opt.border),
3595
3815
  _sizeFromImage: !intWidth && !intHeight,
3816
+ // addImage always writes x/y/w/h defaults, so remember which axes the caller actually set
3817
+ // (placeholder geometry must not overwrite explicit placement; fujita-h d7e3e93 / #996).
3818
+ _explicitX: opt.x !== undefined && opt.x !== null,
3819
+ _explicitY: opt.y !== undefined && opt.y !== null,
3820
+ _explicitW: opt.w !== undefined && opt.w !== null,
3821
+ _explicitH: opt.h !== undefined && opt.h !== null,
3596
3822
  // Images build options explicitly (unlike shape/text which pass through opts), so copy animation here
3597
3823
  animation: opt.animation,
3598
3824
  appearOnClick: opt.appearOnClick
@@ -3721,6 +3947,10 @@ function addImageDefinition(target, opt) {
3721
3947
  slideData.options.y = intPosY;
3722
3948
  slideData.options.w = intSizeX;
3723
3949
  slideData.options.h = intSizeY;
3950
+ slideData.options._explicitX = opt.x !== undefined && opt.x !== null;
3951
+ slideData.options._explicitY = opt.y !== undefined && opt.y !== null;
3952
+ slideData.options._explicitW = opt.w !== undefined && opt.w !== null;
3953
+ slideData.options._explicitH = opt.h !== undefined && opt.h !== null;
3724
3954
  slideData.options.objectName = objectName;
3725
3955
  slideData.options.animation = opt.animation;
3726
3956
  slideData.options.appearOnClick = opt.appearOnClick;
@@ -4036,7 +4266,7 @@ function addShapeDefinition(target, shapeName, opts) {
4036
4266
  // 1: ShapeLineProps defaults
4037
4267
  const hasConnectorEnds = options.line.sourceId != null || options.line.targetId != null;
4038
4268
  const newLineOpts = {
4039
- type: options.line.type || 'solid',
4269
+ type: options.line.type || (options.line.gradient ? 'gradient' : 'solid'),
4040
4270
  color: options.line.color || (/* inlined export .DEF_SHAPE_LINE_COLOR */"333333"),
4041
4271
  transparency: options.line.transparency || 0,
4042
4272
  gradient: options.line.gradient,
@@ -4055,6 +4285,11 @@ function addShapeDefinition(target, shapeName, opts) {
4055
4285
  };
4056
4286
  if (typeof options.line === 'object' && options.line.type !== 'none') options.line = newLineOpts;
4057
4287
  // 2: Set options defaults
4288
+ const shapeOpts = options;
4289
+ shapeOpts._explicitX = options.x !== undefined && options.x !== null;
4290
+ shapeOpts._explicitY = options.y !== undefined && options.y !== null;
4291
+ shapeOpts._explicitW = options.w !== undefined && options.w !== null;
4292
+ shapeOpts._explicitH = options.h !== undefined && options.h !== null;
4058
4293
  options.x = options.x || (options.x === 0 ? 0 : 1);
4059
4294
  options.y = options.y || (options.y === 0 ? 0 : 1);
4060
4295
  options.w = options.w || (options.w === 0 ? 0 : 1);
@@ -4103,11 +4338,12 @@ function addShapeDefinition(target, shapeName, opts) {
4103
4338
  // STEP 2: Transform `tableRows` into well-formatted TableCell's
4104
4339
  // tableRows can be object or plain text array: `[{text:'cell 1'}, {text:'cell 2', options:{color:'ff0000'}}]` | `["cell 1", "cell 2"]`
4105
4340
  const arrRows = [];
4341
+ const tableFillRid = registerTableCellImageFill(target, opt.fill);
4106
4342
  tableRows.forEach((row)=>{
4107
4343
  const newRow = [];
4108
4344
  if (Array.isArray(row)) {
4109
4345
  row.forEach((cell)=>{
4110
- var _newCell_options;
4346
+ var _newCell_options, _registerTableCellImageFill;
4111
4347
  // A:
4112
4348
  const newCell = {
4113
4349
  _type: (/* inlined export .SLIDE_OBJECT_TYPES.tablecell */"tablecell"),
@@ -4173,9 +4409,12 @@ function addShapeDefinition(target, shapeName, opts) {
4173
4409
  cellBorder[idx] = {
4174
4410
  type: cellBorder[idx].type || DEF_CELL_BORDER.type,
4175
4411
  color: cellBorder[idx].color || DEF_CELL_BORDER.color,
4176
- pt: (_cellBorder_idx_width = cellBorder[idx].width) !== null && _cellBorder_idx_width !== void 0 ? _cellBorder_idx_width : typeof cellBorder[idx].pt === 'number' ? cellBorder[idx].pt : DEF_CELL_BORDER.pt
4412
+ pt: (_cellBorder_idx_width = cellBorder[idx].width) !== null && _cellBorder_idx_width !== void 0 ? _cellBorder_idx_width : typeof cellBorder[idx].pt === 'number' ? cellBorder[idx].pt : DEF_CELL_BORDER.pt,
4413
+ transparency: typeof cellBorder[idx].transparency === 'number' ? cellBorder[idx].transparency : undefined
4177
4414
  };
4178
4415
  });
4416
+ const fillRid = (_registerTableCellImageFill = registerTableCellImageFill(target, cellOpts.fill)) !== null && _registerTableCellImageFill !== void 0 ? _registerTableCellImageFill : cellOpts.fill ? undefined : tableFillRid;
4417
+ if (fillRid) cellOpts._fillRid = fillRid;
4179
4418
  // LAST:
4180
4419
  newRow.push(newCell);
4181
4420
  });
@@ -4186,6 +4425,11 @@ function addShapeDefinition(target, shapeName, opts) {
4186
4425
  arrRows.push(newRow);
4187
4426
  });
4188
4427
  // STEP 3: Set options
4428
+ const tableOpts = opt;
4429
+ tableOpts._explicitX = opt.x !== undefined && opt.x !== null;
4430
+ tableOpts._explicitY = opt.y !== undefined && opt.y !== null;
4431
+ tableOpts._explicitW = opt.w !== undefined && opt.w !== null;
4432
+ tableOpts._explicitH = opt.h !== undefined && opt.h !== null;
4189
4433
  opt.x = getSmartParseNumber(opt.x || (opt.x === 0 ? 0 : (/* inlined export .EMU */914400) / 2), 'X', presLayout);
4190
4434
  opt.y = getSmartParseNumber(opt.y || (opt.y === 0 ? 0 : (/* inlined export .EMU */914400) / 2), 'Y', presLayout);
4191
4435
  if (opt.h) opt.h = getSmartParseNumber(opt.h, 'Y', presLayout); // NOTE: Dont set default `h` - leaving it null triggers auto-rowH in `makeXMLSlide()`
@@ -4218,7 +4462,8 @@ function addShapeDefinition(target, shapeName, opts) {
4218
4462
  optBorder[idx] = optBorder[idx] ? {
4219
4463
  type: optBorder[idx].type || DEF_CELL_BORDER.type,
4220
4464
  color: optBorder[idx].color || DEF_CELL_BORDER.color,
4221
- pt: (_ref = (_optBorder_idx_width = optBorder[idx].width) !== null && _optBorder_idx_width !== void 0 ? _optBorder_idx_width : optBorder[idx].pt) !== null && _ref !== void 0 ? _ref : DEF_CELL_BORDER.pt
4465
+ pt: (_ref = (_optBorder_idx_width = optBorder[idx].width) !== null && _optBorder_idx_width !== void 0 ? _optBorder_idx_width : optBorder[idx].pt) !== null && _ref !== void 0 ? _ref : DEF_CELL_BORDER.pt,
4466
+ transparency: optBorder[idx].transparency
4222
4467
  } : {
4223
4468
  type: 'none'
4224
4469
  };
@@ -4399,27 +4644,40 @@ function addShapeDefinition(target, shapeName, opts) {
4399
4644
  if (itemOpts.placeholder || isPlaceholder) {
4400
4645
  itemOpts.bullet = itemOpts.bullet || false;
4401
4646
  }
4402
- // A.3: Text targeting a placeholder need to inherit the placeholders options (eg: margin, valign, etc.) (Issue #640)
4647
+ // A.3: Text targeting a placeholder inherits layout defaults (margin, valign, fill, …) (Issue #640).
4648
+ // Caller options win so a user fill/spacing is not wiped by the placeholder (fujita-h 11c4cb6).
4649
+ // Do not share the layout `_bodyProp` object — rebuild it below from the merged public options.
4650
+ itemOpts._explicitX = itemOpts.x !== undefined && itemOpts.x !== null;
4651
+ itemOpts._explicitY = itemOpts.y !== undefined && itemOpts.y !== null;
4652
+ itemOpts._explicitW = itemOpts.w !== undefined && itemOpts.w !== null;
4653
+ itemOpts._explicitH = itemOpts.h !== undefined && itemOpts.h !== null;
4403
4654
  if (itemOpts.placeholder && '_slideLayout' in target && target._slideLayout && target._slideLayout._slideObjects) {
4404
4655
  const placeHold = target._slideLayout._slideObjects.filter((item)=>item._type === 'placeholder' && item.options && item.options.placeholder && item.options.placeholder === itemOpts.placeholder)[0];
4405
- if (placeHold === null || placeHold === void 0 ? void 0 : placeHold.options) itemOpts = gen_objects_object_spread({}, itemOpts, placeHold.options);
4656
+ if (placeHold === null || placeHold === void 0 ? void 0 : placeHold.options) {
4657
+ const _placeHold_options = placeHold.options, { _bodyProp: _ignored } = _placeHold_options, layoutOpts = _object_without_properties(_placeHold_options, [
4658
+ "_bodyProp"
4659
+ ]);
4660
+ itemOpts = gen_objects_object_spread_props(gen_objects_object_spread({}, layoutOpts, itemOpts), {
4661
+ _bodyProp: {}
4662
+ });
4663
+ }
4406
4664
  }
4407
4665
  // A.4: Other options
4408
4666
  itemOpts.objectName = itemOpts.objectName ? encodeXmlEntities(itemOpts.objectName) : `Text ${target._slideObjects.filter((obj)=>obj._type === (/* inlined export .SLIDE_OBJECT_TYPES.text */"text")).length}`;
4409
4667
  // B:
4410
4668
  if (itemOpts.shape === core_enums_SHAPE_TYPE.LINE) {
4411
- var _itemOpts_line, _itemOpts_line1, _itemOpts_line2, _itemOpts_line3, _itemOpts_line4, _itemOpts_line5, _itemOpts_line6, _itemOpts_line7, _itemOpts_line8;
4669
+ var _itemOpts_line, _itemOpts_line1, _itemOpts_line2, _itemOpts_line3, _itemOpts_line4, _itemOpts_line5, _itemOpts_line6, _itemOpts_line7, _itemOpts_line8, _itemOpts_line9;
4412
4670
  // ShapeLineProps defaults
4413
4671
  const newLineOpts = {
4414
- type: ((_itemOpts_line = itemOpts.line) === null || _itemOpts_line === void 0 ? void 0 : _itemOpts_line.type) || 'solid',
4415
- color: ((_itemOpts_line1 = itemOpts.line) === null || _itemOpts_line1 === void 0 ? void 0 : _itemOpts_line1.color) || (/* inlined export .DEF_SHAPE_LINE_COLOR */"333333"),
4416
- transparency: ((_itemOpts_line2 = itemOpts.line) === null || _itemOpts_line2 === void 0 ? void 0 : _itemOpts_line2.transparency) || 0,
4417
- gradient: (_itemOpts_line3 = itemOpts.line) === null || _itemOpts_line3 === void 0 ? void 0 : _itemOpts_line3.gradient,
4418
- width: ((_itemOpts_line4 = itemOpts.line) === null || _itemOpts_line4 === void 0 ? void 0 : _itemOpts_line4.width) || 1,
4419
- dashType: ((_itemOpts_line5 = itemOpts.line) === null || _itemOpts_line5 === void 0 ? void 0 : _itemOpts_line5.dashType) || 'solid',
4420
- cap: (_itemOpts_line6 = itemOpts.line) === null || _itemOpts_line6 === void 0 ? void 0 : _itemOpts_line6.cap,
4421
- beginArrowType: ((_itemOpts_line7 = itemOpts.line) === null || _itemOpts_line7 === void 0 ? void 0 : _itemOpts_line7.beginArrowType) || undefined,
4422
- endArrowType: ((_itemOpts_line8 = itemOpts.line) === null || _itemOpts_line8 === void 0 ? void 0 : _itemOpts_line8.endArrowType) || undefined
4672
+ type: ((_itemOpts_line = itemOpts.line) === null || _itemOpts_line === void 0 ? void 0 : _itemOpts_line.type) || (((_itemOpts_line1 = itemOpts.line) === null || _itemOpts_line1 === void 0 ? void 0 : _itemOpts_line1.gradient) ? 'gradient' : 'solid'),
4673
+ color: ((_itemOpts_line2 = itemOpts.line) === null || _itemOpts_line2 === void 0 ? void 0 : _itemOpts_line2.color) || (/* inlined export .DEF_SHAPE_LINE_COLOR */"333333"),
4674
+ transparency: ((_itemOpts_line3 = itemOpts.line) === null || _itemOpts_line3 === void 0 ? void 0 : _itemOpts_line3.transparency) || 0,
4675
+ gradient: (_itemOpts_line4 = itemOpts.line) === null || _itemOpts_line4 === void 0 ? void 0 : _itemOpts_line4.gradient,
4676
+ width: ((_itemOpts_line5 = itemOpts.line) === null || _itemOpts_line5 === void 0 ? void 0 : _itemOpts_line5.width) || 1,
4677
+ dashType: ((_itemOpts_line6 = itemOpts.line) === null || _itemOpts_line6 === void 0 ? void 0 : _itemOpts_line6.dashType) || 'solid',
4678
+ cap: (_itemOpts_line7 = itemOpts.line) === null || _itemOpts_line7 === void 0 ? void 0 : _itemOpts_line7.cap,
4679
+ beginArrowType: ((_itemOpts_line8 = itemOpts.line) === null || _itemOpts_line8 === void 0 ? void 0 : _itemOpts_line8.beginArrowType) || undefined,
4680
+ endArrowType: ((_itemOpts_line9 = itemOpts.line) === null || _itemOpts_line9 === void 0 ? void 0 : _itemOpts_line9.endArrowType) || undefined
4423
4681
  };
4424
4682
  if (typeof itemOpts.line === 'object') itemOpts.line = newLineOpts;
4425
4683
  // 3: Handle line (lots of deprecated opts)
@@ -4625,6 +4883,77 @@ function addShapeDefinition(target, shapeName, opts) {
4625
4883
  }
4626
4884
  });
4627
4885
  }
4886
+ function makeGroupCollector(parent) {
4887
+ return {
4888
+ _slideObjects: [],
4889
+ _rels: parent._rels,
4890
+ _relsMedia: parent._relsMedia,
4891
+ _relsChart: parent._relsChart,
4892
+ _presLayout: parent._presLayout,
4893
+ _slideNum: parent._slideNum,
4894
+ _allocChartId: parent._allocChartId,
4895
+ _rId: '_rId' in parent ? parent._rId : 0
4896
+ };
4897
+ }
4898
+ /**
4899
+ * Adds a PresentationML group (`p:grpSp`, ECMA-376 §19.3.1.22).
4900
+ * Child coordinates are relative to the group origin (`chOff` 0,0 / `chExt` = group size).
4901
+ */ function addGroupDefinition(target, opts, objects) {
4902
+ var _opts_x, _opts_y, _opts_w, _opts_h, _opts_rotate;
4903
+ const groupCount = target._slideObjects.filter((obj)=>obj._type === (/* inlined export .SLIDE_OBJECT_TYPES.group */"group")).length;
4904
+ const newObject = {
4905
+ _type: (/* inlined export .SLIDE_OBJECT_TYPES.group */"group"),
4906
+ options: {
4907
+ x: (_opts_x = opts.x) !== null && _opts_x !== void 0 ? _opts_x : 0,
4908
+ y: (_opts_y = opts.y) !== null && _opts_y !== void 0 ? _opts_y : 0,
4909
+ w: (_opts_w = opts.w) !== null && _opts_w !== void 0 ? _opts_w : 1,
4910
+ h: (_opts_h = opts.h) !== null && _opts_h !== void 0 ? _opts_h : 1,
4911
+ rotate: (_opts_rotate = opts.rotate) !== null && _opts_rotate !== void 0 ? _opts_rotate : 0,
4912
+ shadow: opts.shadow ? correctShadowOptions(opts.shadow) : undefined,
4913
+ objectName: opts.objectName ? encodeXmlEntities(opts.objectName) : `Group ${groupCount + 1}`
4914
+ },
4915
+ _objects: objects
4916
+ };
4917
+ target._slideObjects.push(newObject);
4918
+ return newObject;
4919
+ }
4920
+ function createGroupBuilder(parent, objects) {
4921
+ const builder = {
4922
+ addShape (shapeName, options) {
4923
+ const collector = makeGroupCollector(parent);
4924
+ addShapeDefinition(collector, shapeName, options !== null && options !== void 0 ? options : {});
4925
+ objects.push(...collector._slideObjects);
4926
+ return builder;
4927
+ },
4928
+ addText (text, options) {
4929
+ const collector = makeGroupCollector(parent);
4930
+ const textParam = typeof text === 'string' || typeof text === 'number' ? [
4931
+ {
4932
+ text,
4933
+ options
4934
+ }
4935
+ ] : text;
4936
+ addTextDefinition(collector, textParam, options !== null && options !== void 0 ? options : {}, false);
4937
+ objects.push(...collector._slideObjects);
4938
+ return builder;
4939
+ },
4940
+ addImage (options) {
4941
+ const collector = makeGroupCollector(parent);
4942
+ addImageDefinition(collector, options);
4943
+ objects.push(...collector._slideObjects);
4944
+ return builder;
4945
+ },
4946
+ addGroup (options, build) {
4947
+ const children = [];
4948
+ if (build) build(createGroupBuilder(parent, children));
4949
+ const collector = makeGroupCollector(parent);
4950
+ addGroupDefinition(collector, options, children);
4951
+ objects.push(...collector._slideObjects);
4952
+ return builder;
4953
+ }
4954
+ };
4955
+ return builder;
4956
+ }
4628
4957
 
4629
4958
  /**
4630
4959
  * PptxGenJS: Slide Class
@@ -4668,6 +4997,7 @@ function slide_object_spread(target) {
4668
4997
  delete runOpts.softEdge;
4669
4998
  delete runOpts.reflection;
4670
4999
  delete runOpts.shadow;
5000
+ delete runOpts.blur;
4671
5001
  return runOpts;
4672
5002
  }
4673
5003
  class Slide {
@@ -4750,6 +5080,18 @@ class Slide {
4750
5080
  addNotesDefinition(this, notes);
4751
5081
  return this;
4752
5082
  }
5083
+ /**
5084
+ * Add a group (`p:grpSp`) to this slide. Child x/y are relative to the group origin.
5085
+ * Existing addShape/addImage/addText APIs are unchanged.
5086
+ * @example slide.addGroup({ x: 1, y: 1, w: 4, h: 3 }, g => { g.addShape(pptx.ShapeType.rect, { x: 0, y: 0, w: 1, h: 1 }) })
5087
+ */ addGroup(options, build) {
5088
+ const children = options._objects ? [
5089
+ ...options._objects
5090
+ ] : [];
5091
+ if (build) build(createGroupBuilder(this, children));
5092
+ addGroupDefinition(this, cloneOpts(options), children);
5093
+ return this;
5094
+ }
4753
5095
  /**
4754
5096
  * Add a slide transition (`<p:transition>`, ECMA-376 §19.3.1.50 / MS-PPTX §2.2.1)
4755
5097
  * @param {SlideTransitionProps} options - transition options
@@ -4872,7 +5214,7 @@ class Slide {
4872
5214
  * @return {Slide} this Slide
4873
5215
  */ addText(text, options) {
4874
5216
  // String/number text is one run. Keep text styling on that run, but leave
4875
- // glow/softEdge/reflection/shadow on the shape `effectLst` (issue #84).
5217
+ // glow/softEdge/reflection/shadow/blur on the shape `effectLst` (issue #84).
4876
5218
  const textParam = typeof text === 'string' || typeof text === 'number' ? [
4877
5219
  {
4878
5220
  text,
@@ -4882,6 +5224,19 @@ class Slide {
4882
5224
  addTextDefinition(this, textParam, cloneOpts(options), false);
4883
5225
  return this;
4884
5226
  }
5227
+ /**
5228
+ * Add WordArt to Slide — text with a DrawingML warp (`a:prstTxWarp`) and/or a gradient run fill.
5229
+ * Defaults to centered `textNoShape` (no transform); options override.
5230
+ * @param {string|TextProps[]} text - text string or complex object
5231
+ * @param {TextPropsOptions} options - text/WordArt options (`presetShape`, `gradient`, etc.)
5232
+ * @return {Slide} this Slide
5233
+ */ addWordArt(text, options) {
5234
+ const opts = slide_object_spread({
5235
+ align: 'center',
5236
+ presetShape: 'textNoShape'
5237
+ }, options);
5238
+ return this.addText(text, opts);
5239
+ }
4885
5240
  constructor(params){
4886
5241
  var _this__slideLayout;
4887
5242
  slide_define_property(this, "_setSlideNum", void 0);
@@ -5173,6 +5528,33 @@ function createLineCap(lineCap) {
5173
5528
  throw new Error(`Invalid chart line cap: ${neverLineCap}`);
5174
5529
  }
5175
5530
  }
5531
+ /** DrawingML `a:prstDash` / ST_PresetLineDashVal — same set as `line.dashType` / chart `lineDash`. */ const CHART_LINE_DASH_TYPES = [
5532
+ 'solid',
5533
+ 'dash',
5534
+ 'dashDot',
5535
+ 'lgDash',
5536
+ 'lgDashDot',
5537
+ 'lgDashDotDot',
5538
+ 'sysDash',
5539
+ 'sysDot'
5540
+ ];
5541
+ /**
5542
+ * Per-series dash wins over chart-level `lineDash`. Unknown values fall back so we never
5543
+ * emit an illegal ST_PresetLineDashVal.
5544
+ */ function resolveSeriesLineDash(seriesDash, chartDash) {
5545
+ if (seriesDash && CHART_LINE_DASH_TYPES.includes(seriesDash)) return seriesDash;
5546
+ if (chartDash && CHART_LINE_DASH_TYPES.includes(chartDash)) return chartDash;
5547
+ return 'solid';
5548
+ }
5549
+ /** Area charts use `c:grouping` / ST_Grouping (standard|stacked|percentStacked), not ST_BarGrouping. */ const AREA_GROUPING = [
5550
+ 'standard',
5551
+ 'stacked',
5552
+ 'percentStacked'
5553
+ ];
5554
+ function resolveAreaGrouping(barGrouping) {
5555
+ if (barGrouping && AREA_GROUPING.includes(barGrouping)) return barGrouping;
5556
+ return 'standard';
5557
+ }
5176
5558
 
5177
5559
  /**
5178
5560
  * Chart axis rendering.
@@ -5731,6 +6113,14 @@ function xml_object_spread_props(target, source) {
5731
6113
  * @example '<c:lineChart>'
5732
6114
  * @return {string} XML chart
5733
6115
  */ /**
6116
+ * Default run properties for scatter `c:dLbls` / `c:txPr` (`a:defRPr`).
6117
+ * ECMA-376 Part 1 §5.7.2.49 `CT_DLbls` + §5.1.5.3.5 `CT_TextCharacterProperties`
6118
+ * (`standards/ecma/part-23_drawingml-reference-material-drawingml-charts.txt`).
6119
+ * An empty `<a:defRPr/>` drops dataLabelFont* on scatter labels (gitbrent #1348).
6120
+ */ function genXmlDataLabelDefRPr(opts) {
6121
+ return `<a:defRPr sz="${Math.round((opts.dataLabelFontSize || (/* inlined export .DEF_FONT_SIZE */12)) * 100)}" b="${opts.dataLabelFontBold ? 1 : 0}" i="${opts.dataLabelFontItalic ? 1 : 0}" u="none" strike="noStrike">` + `<a:solidFill>${createColorElement(opts.dataLabelColor || (/* inlined export .DEF_FONT_COLOR */"000000"))}</a:solidFill>` + `<a:latin typeface="${opts.dataLabelFontFace || 'Arial'}"/>` + '</a:defRPr>';
6122
+ }
6123
+ /**
5734
6124
  * Rich-text body for a custom chart data label (`c:tx` / `c:rich`).
5735
6125
  * Escapes text and applies data-label font options.
5736
6126
  */ function genXmlDataLabelRichText(text, opts) {
@@ -5804,8 +6194,10 @@ function makeChartType(chartType, data, opts, valAxisId, catAxisId, _isMultiType
5804
6194
  case core_enums_CHART_TYPE.RADAR:
5805
6195
  // 1: Start Chart
5806
6196
  strXml += `<c:${chartType}Chart>`;
5807
- if (chartType === core_enums_CHART_TYPE.AREA && opts.barGrouping === 'stacked') {
5808
- strXml += '<c:grouping val="' + opts.barGrouping + '"/>';
6197
+ // Area charts: `c:grouping` / ST_Grouping (ECMA-376 §5.7.2.76 / §5.7.3.17).
6198
+ // `barGrouping` is the public option name; the element is not `c:barGrouping` (that is ST_BarGrouping on bar charts).
6199
+ if (chartType === core_enums_CHART_TYPE.AREA) {
6200
+ strXml += '<c:grouping val="' + resolveAreaGrouping(opts.barGrouping) + '"/>';
5809
6201
  }
5810
6202
  if (chartType === core_enums_CHART_TYPE.BAR || chartType === core_enums_CHART_TYPE.BAR3D) {
5811
6203
  strXml += '<c:barDir val="' + opts.barDir + '"/>';
@@ -5879,7 +6271,7 @@ function makeChartType(chartType, data, opts, valAxisId, catAxisId, _isMultiType
5879
6271
  strXml += '<a:ln><a:noFill/></a:ln>';
5880
6272
  } else {
5881
6273
  strXml += `<a:ln w="${valToPts(opts.lineSize)}" cap="${createLineCap(opts.lineCap)}"><a:solidFill>${createColorElement(seriesColor)}</a:solidFill>`;
5882
- strXml += '<a:prstDash val="' + (opts.lineDash || 'solid') + '"/><a:round/></a:ln>';
6274
+ strXml += '<a:prstDash val="' + resolveSeriesLineDash(obj.lineDash, opts.lineDash) + '"/><a:round/></a:ln>';
5883
6275
  }
5884
6276
  } else if (opts.dataBorder) {
5885
6277
  strXml += `<a:ln w="${valToPts(opts.dataBorder.pt)}" cap="${createLineCap(opts.lineCap)}"><a:solidFill>${createColorElement(opts.dataBorder.color)}</a:solidFill><a:prstDash val="solid"/><a:round/></a:ln>`;
@@ -5942,7 +6334,8 @@ function makeChartType(chartType, data, opts, valAxisId, catAxisId, _isMultiType
5942
6334
  strXml += ' <c:spPr>';
5943
6335
  if (opts.lineSize === 0) {
5944
6336
  strXml += '<a:ln><a:noFill/></a:ln>';
5945
- } else if (chartType === core_enums_CHART_TYPE.BAR) {
6337
+ } else if (chartType === core_enums_CHART_TYPE.BAR || chartType === core_enums_CHART_TYPE.BAR3D) {
6338
+ // CT_DPt.spPr is CT_ShapeProperties: series color is a fill (`a:solidFill`), not an outline (`a:ln`).
5946
6339
  strXml += `<a:solidFill>${createColorElement(arrColors[index % arrColors.length])}</a:solidFill>`;
5947
6340
  } else {
5948
6341
  strXml += `<a:ln><a:solidFill>${createColorElement(arrColors[index % arrColors.length])}</a:solidFill></a:ln>`;
@@ -6113,7 +6506,7 @@ function makeChartType(chartType, data, opts, valAxisId, catAxisId, _isMultiType
6113
6506
  strXml += '<a:ln><a:noFill/></a:ln>';
6114
6507
  } else {
6115
6508
  strXml += `<a:ln w="${valToPts(opts.lineSize)}" cap="${createLineCap(opts.lineCap)}"><a:solidFill>${createColorElement(tmpSerColor)}</a:solidFill>`;
6116
- strXml += `<a:prstDash val="${opts.lineDash || 'solid'}"/><a:round/></a:ln>`;
6509
+ strXml += `<a:prstDash val="${resolveSeriesLineDash(obj.lineDash, opts.lineDash)}"/><a:round/></a:ln>`;
6117
6510
  }
6118
6511
  // Shadow
6119
6512
  strXml += createShadowElement(resolveShadowOptions(opts.shadow));
@@ -6156,7 +6549,7 @@ function makeChartType(chartType, data, opts, valAxisId, catAxisId, _isMultiType
6156
6549
  strXml += ' <a:lstStyle/>';
6157
6550
  strXml += ' <a:p>';
6158
6551
  strXml += ' <a:pPr>';
6159
- strXml += ' <a:defRPr/>';
6552
+ strXml += ` ${genXmlDataLabelDefRPr(opts)}`;
6160
6553
  strXml += ' </a:pPr>';
6161
6554
  strXml += ' <a:r>';
6162
6555
  strXml += ' <a:rPr lang="' + (opts.lang || 'en-US') + '" dirty="0"/>';
@@ -6173,7 +6566,7 @@ function makeChartType(chartType, data, opts, valAxisId, catAxisId, _isMultiType
6173
6566
  strXml += ' <a:fld id="{' + getUuid('xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx') + '}" type="XVALUE">';
6174
6567
  strXml += ' <a:rPr lang="' + (opts.lang || 'en-US') + '" baseline="0"/>';
6175
6568
  strXml += ' <a:pPr>';
6176
- strXml += ' <a:defRPr/>';
6569
+ strXml += ` ${genXmlDataLabelDefRPr(opts)}`;
6177
6570
  strXml += ' </a:pPr>';
6178
6571
  strXml += ' <a:t>[' + encodeXmlEntities(obj.name) + '</a:t>';
6179
6572
  strXml += ' </a:fld>';
@@ -6184,7 +6577,7 @@ function makeChartType(chartType, data, opts, valAxisId, catAxisId, _isMultiType
6184
6577
  strXml += ' <a:fld id="{' + getUuid('xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx') + '}" type="YVALUE">';
6185
6578
  strXml += ' <a:rPr lang="' + (opts.lang || 'en-US') + '" baseline="0"/>';
6186
6579
  strXml += ' <a:pPr>';
6187
- strXml += ' <a:defRPr/>';
6580
+ strXml += ` ${genXmlDataLabelDefRPr(opts)}`;
6188
6581
  strXml += ' </a:pPr>';
6189
6582
  strXml += ' <a:t>[' + encodeXmlEntities(obj.name) + ']</a:t>';
6190
6583
  strXml += ' </a:fld>';
@@ -6239,7 +6632,7 @@ function makeChartType(chartType, data, opts, valAxisId, catAxisId, _isMultiType
6239
6632
  strXml += ' <a:lstStyle/>';
6240
6633
  strXml += ' <a:p>';
6241
6634
  strXml += ' <a:pPr>';
6242
- strXml += ' <a:defRPr/>';
6635
+ strXml += ` ${genXmlDataLabelDefRPr(opts)}`;
6243
6636
  strXml += ' </a:pPr>';
6244
6637
  strXml += ' <a:endParaRPr lang="en-US"/>';
6245
6638
  strXml += ' </a:p>';
@@ -6389,7 +6782,7 @@ function makeChartType(chartType, data, opts, valAxisId, catAxisId, _isMultiType
6389
6782
  strXml += `<a:ln w="${valToPts(opts.dataBorder.pt)}" cap="flat"><a:solidFill>${createColorElement(opts.dataBorder.color)}</a:solidFill><a:prstDash val="solid"/><a:round/></a:ln>`;
6390
6783
  } else {
6391
6784
  strXml += `<a:ln w="${valToPts(opts.lineSize)}" cap="flat"><a:solidFill>${createColorElement(tmpSerColor)}</a:solidFill>`;
6392
- strXml += `<a:prstDash val="${opts.lineDash || 'solid'}"/><a:round/></a:ln>`;
6785
+ strXml += `<a:prstDash val="${resolveSeriesLineDash(obj.lineDash, opts.lineDash)}"/><a:round/></a:ln>`;
6393
6786
  }
6394
6787
  // Shadow
6395
6788
  strXml += createShadowElement(resolveShadowOptions(opts.shadow));
@@ -15325,6 +15718,26 @@ function imageDimensions(bytes) {
15325
15718
  }
15326
15719
  return {};
15327
15720
  }
15721
+ /**
15722
+ * Natural pixel size from encoded image bytes (PNG/JPEG/GIF/BMP headers).
15723
+ * Returns null when the payload is missing, not a supported raster, or claims 0×0
15724
+ * (`imageDimensions` already rejects zero and bomb-sized headers).
15725
+ *
15726
+ * contain/cover `a:srcRect` (ECMA-376 §5.1.10.55) needs the *blip* aspect, not the
15727
+ * placement box — using w/h as imgSize makes srcRect a no-op whenever they match the sizing box.
15728
+ */ function getImagePixelSize(base64Data) {
15729
+ if (typeof base64Data !== 'string' || !base64Data || base64Data === IMG_BROKEN) return null;
15730
+ try {
15731
+ const dims = imageDimensions(base64ToBytes(base64Data));
15732
+ if (dims.width && dims.height) return {
15733
+ w: dims.width,
15734
+ h: dims.height
15735
+ };
15736
+ } catch (unused) {
15737
+ // unrecognized / truncated payload
15738
+ }
15739
+ return null;
15740
+ }
15328
15741
  /**
15329
15742
  * Size images added without `w`/`h` to their natural dimensions (issue #34)
15330
15743
  * @note must run after `encodeSlideMediaRels` has resolved - it reads the encoded image bytes
@@ -15374,11 +15787,19 @@ function imageDimensions(bytes) {
15374
15787
  rel.data = IMG_BROKEN;
15375
15788
  copyMediaToDuplicates(candidates, rel);
15376
15789
  }
15790
+ function mediaLoadFailed(candidates, rel, message, onError) {
15791
+ markMediaBroken(candidates, rel);
15792
+ if (onError === 'placeholder') {
15793
+ console.warn(`WARN: Unable to load image, using placeholder: ${rel.path}${message ? ` (${message})` : ''}`);
15794
+ return 'done';
15795
+ }
15796
+ throw new Error(message);
15797
+ }
15377
15798
  /**
15378
15799
  * Read one Node-local media source and encode it as base64.
15379
15800
  *
15380
15801
  * A read failure is recorded before rejection so duplicate references remain consistent.
15381
- */ function readNodeMediaFile(rel, candidates, fs) {
15802
+ */ function readNodeMediaFile(rel, candidates, fs, onError) {
15382
15803
  return gen_media_async_to_generator(function*() {
15383
15804
  try {
15384
15805
  var _rel_path;
@@ -15398,58 +15819,68 @@ function imageDimensions(bytes) {
15398
15819
  copyMediaToDuplicates(candidates, rel);
15399
15820
  return 'done';
15400
15821
  } catch (ex) {
15401
- markMediaBroken(candidates, rel);
15402
- throw new Error(`ERROR: Unable to read media: "${rel.path}"\n${String(ex)}`, {
15403
- cause: ex
15404
- });
15822
+ return mediaLoadFailed(candidates, rel, `ERROR: Unable to read media: "${rel.path}"\n${String(ex)}`, onError);
15405
15823
  }
15406
15824
  })();
15407
15825
  }
15408
15826
  /**
15409
15827
  * Load one HTTP(S) source in Node, draining error responses and handling both request and response errors.
15410
- */ function loadNodeMediaUrl(rel, candidates, https, http) {
15828
+ */ function loadNodeMediaUrl(rel, candidates, https, http, onError) {
15411
15829
  var _rel_path;
15412
15830
  const httpMod = ((_rel_path = rel.path) === null || _rel_path === void 0 ? void 0 : _rel_path.startsWith('http://')) ? http : https;
15413
15831
  return new Promise((resolve, reject)=>{
15414
- var _rel_path;
15415
15832
  const fail = (message)=>{
15416
- markMediaBroken(candidates, rel);
15417
- reject(new Error(message));
15418
- };
15419
- const req = httpMod.get((_rel_path = rel.path) !== null && _rel_path !== void 0 ? _rel_path : '', (res)=>{
15420
- var _res_statusCode;
15421
- const status = (_res_statusCode = res.statusCode) !== null && _res_statusCode !== void 0 ? _res_statusCode : 0;
15422
- if (status < 200 || status > 299) {
15423
- res.resume(); // drain so the socket is freed
15424
- fail(`ERROR! Unable to load image (HTTP ${status}): ${rel.path}`);
15425
- return;
15833
+ try {
15834
+ resolve(mediaLoadFailed(candidates, rel, message, onError));
15835
+ } catch (ex) {
15836
+ reject(ex);
15426
15837
  }
15427
- let raw = '';
15428
- res.setEncoding('binary'); // IMPORTANT: Only binary encoding works
15429
- res.on('data', (chunk)=>raw += chunk);
15430
- res.on('end', ()=>{
15431
- rel.data = binaryStringToBase64(raw);
15432
- copyMediaToDuplicates(candidates, rel);
15433
- resolve('done');
15838
+ };
15839
+ try {
15840
+ var _rel_path;
15841
+ const req = httpMod.get((_rel_path = rel.path) !== null && _rel_path !== void 0 ? _rel_path : '', (res)=>{
15842
+ var _res_statusCode;
15843
+ const status = (_res_statusCode = res.statusCode) !== null && _res_statusCode !== void 0 ? _res_statusCode : 0;
15844
+ if (status < 200 || status > 299) {
15845
+ res.resume(); // drain so the socket is freed
15846
+ fail(`ERROR! Unable to load image (HTTP ${status}): ${rel.path}`);
15847
+ return;
15848
+ }
15849
+ let raw = '';
15850
+ res.setEncoding('binary'); // IMPORTANT: Only binary encoding works
15851
+ res.on('data', (chunk)=>raw += chunk);
15852
+ res.on('end', ()=>{
15853
+ rel.data = binaryStringToBase64(raw);
15854
+ copyMediaToDuplicates(candidates, rel);
15855
+ resolve('done');
15856
+ });
15857
+ res.on('error', ()=>fail(`ERROR! Unable to load image (response): ${rel.path}`));
15434
15858
  });
15435
- res.on('error', ()=>fail(`ERROR! Unable to load image (response): ${rel.path}`));
15436
- });
15437
- // NOTE: without this, a DNS/TLS/connection failure emits an unhandled 'error' and kills the process
15438
- req.on('error', (ex)=>fail(`ERROR! Unable to load image (request): ${rel.path}\n${String(ex)}`));
15859
+ // NOTE: without this, a DNS/TLS/connection failure emits an unhandled 'error' and kills the process
15860
+ req.on('error', (ex)=>fail(`ERROR! Unable to load image (request): ${rel.path}\n${String(ex)}`));
15861
+ } catch (ex) {
15862
+ fail(`ERROR! Unable to load image (https.get): ${rel.path}\n${String(ex)}`);
15863
+ }
15439
15864
  });
15440
15865
  }
15441
15866
  /**
15442
15867
  * Fetch one browser media source and convert its Blob response to a data URL.
15443
15868
  * SVG previews are produced only after the source relation has been populated.
15444
- */ function loadBrowserMedia(rel, candidates) {
15869
+ */ function loadBrowserMedia(rel, candidates, onError) {
15445
15870
  return new Promise((resolve, reject)=>{
15446
15871
  var _rel_path;
15872
+ const fail = (message)=>{
15873
+ try {
15874
+ resolve(mediaLoadFailed(candidates, rel, message, onError));
15875
+ } catch (ex) {
15876
+ reject(ex);
15877
+ }
15878
+ };
15447
15879
  const xhr = new XMLHttpRequest();
15448
15880
  xhr.onload = ()=>{
15449
15881
  // status 0 = non-HTTP schemes (file://); anything outside 2xx is an error page, not image bytes
15450
15882
  if (xhr.status !== 0 && (xhr.status < 200 || xhr.status > 299)) {
15451
- markMediaBroken(candidates, rel);
15452
- reject(new Error(`ERROR! HTTP status ${xhr.status} loading image: ${rel.path}`));
15883
+ fail(`ERROR! HTTP status ${xhr.status} loading image: ${rel.path}`);
15453
15884
  return;
15454
15885
  }
15455
15886
  const reader = new FileReader();
@@ -15462,22 +15893,21 @@ function imageDimensions(bytes) {
15462
15893
  reader.readAsDataURL(xhr.response);
15463
15894
  };
15464
15895
  xhr.onerror = ()=>{
15465
- markMediaBroken(candidates, rel);
15466
- reject(new Error(`ERROR! Unable to load image (xhr.onerror): ${rel.path}`));
15896
+ fail(`ERROR! Unable to load image (xhr.onerror): ${rel.path}`);
15467
15897
  };
15468
15898
  xhr.open('GET', (_rel_path = rel.path) !== null && _rel_path !== void 0 ? _rel_path : '');
15469
15899
  xhr.responseType = 'blob';
15470
15900
  xhr.send();
15471
15901
  });
15472
15902
  }
15473
- /** Route one source relation to the loader valid for the active runtime. */ function encodeMediaRelation(rel, candidates, isNode, modules, loadNodeModules) {
15903
+ /** Route one source relation to the loader valid for the active runtime. */ function encodeMediaRelation(rel, candidates, isNode, modules, loadNodeModules, onError) {
15474
15904
  return gen_media_async_to_generator(function*() {
15475
15905
  var _rel_path;
15476
15906
  if (!modules.https) yield loadNodeModules();
15477
15907
  const path = (_rel_path = rel.path) !== null && _rel_path !== void 0 ? _rel_path : '';
15478
- if (isNode && modules.fs && !path.startsWith('http')) return readNodeMediaFile(rel, candidates, modules.fs);
15479
- if (isNode && modules.https && modules.http && path.startsWith('http')) return loadNodeMediaUrl(rel, candidates, modules.https, modules.http);
15480
- return loadBrowserMedia(rel, candidates);
15908
+ if (isNode && modules.fs && !path.startsWith('http')) return readNodeMediaFile(rel, candidates, modules.fs, onError);
15909
+ if (isNode && modules.https && modules.http && path.startsWith('http')) return loadNodeMediaUrl(rel, candidates, modules.https, modules.http, onError);
15910
+ return loadBrowserMedia(rel, candidates, onError);
15481
15911
  })();
15482
15912
  }
15483
15913
  /**
@@ -15499,7 +15929,7 @@ function imageDimensions(bytes) {
15499
15929
  * Encode Image/Audio/Video into base64
15500
15930
  * @param {PresSlide | SlideLayout} layout - slide layout
15501
15931
  * @return {Promise} promise
15502
- */ function encodeSlideMediaRels(layout) {
15932
+ */ function encodeSlideMediaRels(layout, opts) {
15503
15933
  // STEP 1: Detect a real Node process. Browser bundles often polyfill `process`
15504
15934
  // (and even `process.versions.node`), so also require a document-less runtime.
15505
15935
  const isNode = isNodeRuntime();
@@ -15521,7 +15951,8 @@ function imageDimensions(bytes) {
15521
15951
  // B: PERF: Mark dupes (same `path`) to avoid loading the same media over-and-over!
15522
15952
  markDuplicateMedia(candidateRels);
15523
15953
  // STEP 4: Read/Encode each unique media item
15524
- candidateRels.filter((rel)=>!rel.isDuplicate).forEach((rel)=>imageProms.push(encodeMediaRelation(rel, candidateRels, isNode, modules, loadNodeDeps)));
15954
+ const onError = (opts === null || opts === void 0 ? void 0 : opts.onError) === 'placeholder' ? 'placeholder' : 'throw';
15955
+ candidateRels.filter((rel)=>!rel.isDuplicate).forEach((rel)=>imageProms.push(encodeMediaRelation(rel, candidateRels, isNode, modules, loadNodeDeps, onError)));
15525
15956
  // STEP 5: SVG-PNG previews
15526
15957
  // ......: "SVG:" base64 data still requires a png to be generated
15527
15958
  // ......: (`isSvgPng` flag this as the preview image, not the SVG itself)
@@ -15675,11 +16106,6 @@ function imageDimensions(bytes) {
15675
16106
  class: 'entr',
15676
16107
  subtype: 16
15677
16108
  },
15678
- grow: {
15679
- id: 3,
15680
- class: 'entr',
15681
- subtype: 0
15682
- },
15683
16109
  growandturn: {
15684
16110
  id: 31,
15685
16111
  class: 'entr',
@@ -17676,7 +18102,13 @@ function imageDimensions(bytes) {
17676
18102
  var _anim_shapeId;
17677
18103
  const shapeId = (_anim_shapeId = anim.shapeId) !== null && _anim_shapeId !== void 0 ? _anim_shapeId : anim.objectIndex + 2 // Shapes start at ID 2
17678
18104
  ;
17679
- xml += `<p:bldP spid="${shapeId}" grpId="0" animBg="1"/>`;
18105
+ // Charts are graphic frames: ECMA-376 §19.5.13 bldGraphic + §19.5.11 bldAsOne
18106
+ // (object-level entrance, not series-by-category).
18107
+ if (anim.buildKind === 'chart') {
18108
+ xml += `<p:bldGraphic spid="${shapeId}" grpId="0"><p:bldAsOne/></p:bldGraphic>`;
18109
+ } else {
18110
+ xml += `<p:bldP spid="${shapeId}" grpId="0" animBg="1"/>`;
18111
+ }
17680
18112
  });
17681
18113
  xml += '</p:bldLst>';
17682
18114
  return xml;
@@ -17896,22 +18328,22 @@ function getNodeType(trigger) {
17896
18328
  return xml;
17897
18329
  }
17898
18330
 
17899
- /**
17900
- * Slide transition XML generation (`<p:transition>`).
17901
- *
17902
- * ECMA-376 §19.3.1.50 `CT_SlideTransition` carries the base transition set.
17903
- * MS-PPTX §2.2.1 adds the 2010+ modern transitions inside an `<mc:AlternateContent>` wrapper
17904
- * (Choice in the `p14`/`p15` namespace, Fallback to a base transition) plus `morph` (§2.6.1.1,
17905
- * `p16` namespace). Modern consumers (PowerPoint 2010+) read the Choice; older readers and other
17906
- * tools use the Fallback, so the file stays valid everywhere.
18331
+ /**
18332
+ * Slide transition XML generation (`<p:transition>`).
18333
+ *
18334
+ * ECMA-376 §19.3.1.50 `CT_SlideTransition` carries the base transition set.
18335
+ * MS-PPTX §2.2.1 adds the 2010+ modern transitions inside an `<mc:AlternateContent>` wrapper
18336
+ * (Choice in the `p14`/`p15` namespace, Fallback to a base transition) plus `morph` (§2.6.1.1,
18337
+ * `p16` namespace). Modern consumers (PowerPoint 2010+) read the Choice; older readers and other
18338
+ * tools use the Fallback, so the file stays valid everywhere.
17907
18339
  */ const gen_transition_P14_NS = 'http://schemas.microsoft.com/office/powerpoint/2010/main';
17908
18340
  const P15_NS = 'http://schemas.microsoft.com/office/powerpoint/2012/main';
17909
18341
  const P16_NS = 'http://schemas.microsoft.com/office/powerpoint/2016/main';
17910
18342
  const gen_transition_MC_NS = 'http://schemas.openxmlformats.org/markup-compatibility/2006';
17911
- /**
17912
- * Base ECMA-376 transition types and the attribute their inner element takes.
17913
- * Maps: type -> [element name, attribute kind]. The attribute kind selects which
17914
- * `dir`/`orient`/`spokes`/`thruBlk` attribute (if any) to emit (ECMA-376 §19.3.1.50 + §A.4).
18343
+ /**
18344
+ * Base ECMA-376 transition types and the attribute their inner element takes.
18345
+ * Maps: type -> [element name, attribute kind]. The attribute kind selects which
18346
+ * `dir`/`orient`/`spokes`/`thruBlk` attribute (if any) to emit (ECMA-376 §19.3.1.50 + §A.4).
17915
18347
  */ const BASE = {
17916
18348
  blinds: [
17917
18349
  'blinds',
@@ -18002,9 +18434,9 @@ const gen_transition_MC_NS = 'http://schemas.openxmlformats.org/markup-compatibi
18002
18434
  'inout'
18003
18435
  ]
18004
18436
  };
18005
- /**
18006
- * Modern (MS-PPTX) transitions: type -> [namespace, attribute kind, fallback base type].
18007
- * morph has no directional attribute (§2.6.3.1 CT_MorphTransition only takes `option`).
18437
+ /**
18438
+ * Modern (MS-PPTX) transitions: type -> [namespace, attribute kind, fallback base type].
18439
+ * morph has no directional attribute (§2.6.3.1 CT_MorphTransition only takes `option`).
18008
18440
  */ const MODERN = {
18009
18441
  conveyor: [
18010
18442
  gen_transition_P14_NS,
@@ -18107,24 +18539,60 @@ const gen_transition_MC_NS = 'http://schemas.openxmlformats.org/markup-compatibi
18107
18539
  'split'
18108
18540
  ]
18109
18541
  };
18542
+ /**
18543
+ * Map friendly caller names to ECMA-376 transition tokens.
18544
+ * OOXML short codes (`l`/`horz`/`ld`) stay as-is. `ll`/`rl` are accepted as aliases
18545
+ * for the spec corner tokens `ld`/`rd` (ST_TransitionCornerDirectionType).
18546
+ */ const DIR_ALIASES = {
18547
+ l: 'l',
18548
+ r: 'r',
18549
+ u: 'u',
18550
+ d: 'd',
18551
+ left: 'l',
18552
+ right: 'r',
18553
+ up: 'u',
18554
+ down: 'd',
18555
+ horz: 'horz',
18556
+ vert: 'vert',
18557
+ horizontal: 'horz',
18558
+ vertical: 'vert',
18559
+ lu: 'lu',
18560
+ ru: 'ru',
18561
+ ld: 'ld',
18562
+ rd: 'rd',
18563
+ leftup: 'lu',
18564
+ rightup: 'ru',
18565
+ leftdown: 'ld',
18566
+ rightdown: 'rd',
18567
+ ll: 'ld',
18568
+ rl: 'rd',
18569
+ in: 'in',
18570
+ out: 'out'
18571
+ };
18572
+ function normalizeDir(value) {
18573
+ var _DIR_ALIASES_key;
18574
+ if (!value) return undefined;
18575
+ const key = value.replace(/[-_\s]/g, '').toLowerCase();
18576
+ return (_DIR_ALIASES_key = DIR_ALIASES[key]) !== null && _DIR_ALIASES_key !== void 0 ? _DIR_ALIASES_key : value;
18577
+ }
18110
18578
  /** Build the inner element + its directional attribute for a base transition. */ function baseInner(type, kind, p) {
18111
18579
  switch(kind){
18112
18580
  case 'none':
18113
18581
  return `<p:${type}/>`;
18114
18582
  case 'side':
18115
- return `<p:${type}${gen_transition_dir([
18583
+ return `<p:${type}${dirAttr([
18116
18584
  'l',
18117
18585
  'r',
18118
18586
  'u',
18119
18587
  'd'
18120
- ], p, 'l')}/>`;
18588
+ ], p)}/>`;
18121
18589
  case 'orient':
18122
- return `<p:${type}${gen_transition_dir([
18590
+ return `<p:${type}${dirAttr([
18123
18591
  'horz',
18124
18592
  'vert'
18125
- ], p, 'horz')}/>`;
18593
+ ], p)}/>`;
18126
18594
  case 'eight':
18127
- return `<p:${type}${gen_transition_dir([
18595
+ return `<p:${type}${dirAttr([
18128
18596
  'l',
18129
18597
  'r',
18130
18598
  'u',
@@ -18133,21 +18601,28 @@ const gen_transition_MC_NS = 'http://schemas.openxmlformats.org/markup-compatibi
18133
18601
  'ru',
18134
18602
  'ld',
18135
18603
  'rd'
18136
- ], p, 'l')}/>`;
18604
+ ], p)}/>`;
18137
18605
  case 'corner':
18138
- return `<p:${type}${gen_transition_dir([
18606
+ return `<p:${type}${dirAttr([
18139
18607
  'lu',
18140
18608
  'ru',
18141
- 'll',
18142
- 'rl'
18143
- ], p, 'lu')}/>`;
18609
+ 'ld',
18610
+ 'rd'
18611
+ ], p)}/>`;
18144
18612
  case 'inout':
18145
- return `<p:${type}${gen_transition_dir([
18613
+ return `<p:${type}${dirAttr([
18146
18614
  'in',
18147
18615
  'out'
18148
- ], p, 'out')}/>`;
18616
+ ], p)}/>`;
18149
18617
  case 'split':
18150
- return `<p:${type} orient="${p.direction === 'vert' ? 'vert' : 'horz'}" dir="${p.direction === 'in' ? 'in' : 'out'}"/>`;
18618
+ {
18619
+ var _normalizeDir;
18620
+ // CT_SplitTransition: orient=ST_Direction (horz|vert), dir=ST_TransitionInOutDirectionType (in|out)
18621
+ const raw = normalizeDir(p.direction);
18622
+ const orient = (_normalizeDir = normalizeDir(p.orient)) !== null && _normalizeDir !== void 0 ? _normalizeDir : raw === 'vert' || raw === 'horz' ? raw : 'horz';
18623
+ const splitDir = raw === 'in' || raw === 'out' ? raw : 'out';
18624
+ return `<p:${type} orient="${orient === 'vert' ? 'vert' : 'horz'}" dir="${splitDir}"/>`;
18625
+ }
18151
18626
  case 'wheel':
18152
18627
  return `<p:${type}${p.spokes ? ` spokes="${p.spokes}"` : ''}/>`;
18153
18628
  case 'black':
@@ -18156,13 +18631,14 @@ const gen_transition_MC_NS = 'http://schemas.openxmlformats.org/markup-compatibi
18156
18631
  return `<p:${type}/>`;
18157
18632
  }
18158
18633
  }
18159
- /** Emit a `dir` attribute when the supplied direction is valid for this transition. */ function gen_transition_dir(valid, p, dflt) {
18160
- const d = p.direction && valid.includes(p.direction) ? p.direction : undefined;
18161
- return d && d !== dflt ? ` dir="${d}"` : d ? ` dir="${d}"` : '';
18634
+ /** Emit a `dir` attribute when the supplied direction is valid for this transition. */ function dirAttr(valid, p) {
18635
+ const d = normalizeDir(p.direction);
18636
+ const token = d && valid.includes(d) ? d : undefined;
18637
+ return token ? ` dir="${token}"` : '';
18162
18638
  }
18163
- /**
18164
- * Generates `<p:transition>...</p:transition>` for a slide, or '' if no transition is set.
18165
- * Placed after `<p:clrMapOvr>` and before `<p:timing>` in the `sld` content model (ECMA-376 §19.3.1.38).
18639
+ /**
18640
+ * Generates `<p:transition>...</p:transition>` for a slide, or '' if no transition is set.
18641
+ * Placed after `<p:clrMapOvr>` and before `<p:timing>` in the `sld` content model (ECMA-376 §19.3.1.38).
18166
18642
  */ function genXmlTransition(slide) {
18167
18643
  const t = slide.transition;
18168
18644
  if (!t || !t.type) return '';
@@ -18178,15 +18654,15 @@ const gen_transition_MC_NS = 'http://schemas.openxmlformats.org/markup-compatibi
18178
18654
  if (MODERN[type]) {
18179
18655
  const [ns, kind, fallbackType] = MODERN[type];
18180
18656
  const prefix = ns === P16_NS ? 'p16' : ns === P15_NS ? 'p15' : 'p14';
18181
- const inner = kind === 'side' ? `<${prefix}:${type}${gen_transition_dir([
18657
+ const inner = kind === 'side' ? `<${prefix}:${type}${dirAttr([
18182
18658
  'l',
18183
18659
  'r',
18184
18660
  'u',
18185
18661
  'd'
18186
- ], t, 'l')}/>` : kind === 'orient' ? `<${prefix}:${type}${gen_transition_dir([
18662
+ ], t)}/>` : kind === 'orient' ? `<${prefix}:${type}${dirAttr([
18187
18663
  'horz',
18188
18664
  'vert'
18189
- ], t, 'horz')}/>` : kind === 'eight' ? `<${prefix}:${type}${gen_transition_dir([
18665
+ ], t)}/>` : kind === 'eight' ? `<${prefix}:${type}${dirAttr([
18190
18666
  'l',
18191
18667
  'r',
18192
18668
  'u',
@@ -18195,10 +18671,10 @@ const gen_transition_MC_NS = 'http://schemas.openxmlformats.org/markup-compatibi
18195
18671
  'ru',
18196
18672
  'ld',
18197
18673
  'rd'
18198
- ], t, 'l')}/>` : kind === 'inout' ? `<${prefix}:${type}${gen_transition_dir([
18674
+ ], t)}/>` : kind === 'inout' ? `<${prefix}:${type}${dirAttr([
18199
18675
  'in',
18200
18676
  'out'
18201
- ], t, 'out')}/>` : `<${prefix}:${type}/>`;
18677
+ ], t)}/>` : `<${prefix}:${type}/>`;
18202
18678
  const [fbName, fbKind] = BASE[fallbackType];
18203
18679
  const fallback = baseInner(fbName, fbKind, {
18204
18680
  type: fallbackType
@@ -18572,7 +19048,11 @@ function replyXml(reply, authors, fallbackDate) {
18572
19048
  });
18573
19049
  (slide._relsChart || []).forEach((rel)=>{
18574
19050
  lastRid = Math.max(lastRid, rel.rId);
18575
- strXml += `<Relationship Id="rId${rel.rId}" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/chart" Target="${rel.Target}"/>`;
19051
+ // OPC Part 2: relationship Target is resolved from the source part. Stored `rel.Target`
19052
+ // is the absolute `/ppt/charts/chartN.xml` form reused as Content_Types PartName.
19053
+ // PowerPoint writes the relative `../charts/chartN.xml`; absolute targets are valid but
19054
+ // non-idiomatic and break stricter consumers (PR 1465 / eliasaronson).
19055
+ strXml += `<Relationship Id="rId${rel.rId}" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/chart" Target="${rel.Target.replace(/^\/ppt\//, '../')}"/>`;
18576
19056
  });
18577
19057
  (slide._relsMedia || []).forEach((rel)=>{
18578
19058
  const relRid = rel.rId.toString();
@@ -18699,7 +19179,7 @@ function replyXml(reply, authors, fallbackDate) {
18699
19179
  * @return {string} XML
18700
19180
  */ function makeXmlNotesMasterRel() {
18701
19181
  return `<?xml version="1.0" encoding="UTF-8" standalone="yes"?>${(/* inlined export .CRLF */"\r\n")}<Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships">
18702
- <Relationship Id="rId1" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/theme" Target="../theme/theme1.xml"/>
19182
+ <Relationship Id="rId1" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/theme" Target="../theme/theme2.xml"/>
18703
19183
  </Relationships>`;
18704
19184
  }
18705
19185
  /**
@@ -18779,6 +19259,55 @@ function unsignedInt(value) {
18779
19259
  return `<?xml version="1.0" encoding="UTF-8" standalone="yes"?>\r\n<pc:chgInfo xmlns:pc="${CHANGES_INFO_NS}"/>`;
18780
19260
  }
18781
19261
 
19262
+ function xml_slide_define_property(obj, key, value) {
19263
+ if (key in obj) {
19264
+ Object.defineProperty(obj, key, {
19265
+ value: value,
19266
+ enumerable: true,
19267
+ configurable: true,
19268
+ writable: true
19269
+ });
19270
+ } else obj[key] = value;
19271
+ return obj;
19272
+ }
19273
+ function xml_slide_object_spread(target) {
19274
+ for(var i = 1; i < arguments.length; i++){
19275
+ var source = arguments[i] != null ? arguments[i] : {};
19276
+ var ownKeys = Object.keys(source);
19277
+ if (typeof Object.getOwnPropertySymbols === "function") {
19278
+ ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
19279
+ return Object.getOwnPropertyDescriptor(source, sym).enumerable;
19280
+ }));
19281
+ }
19282
+ ownKeys.forEach(function(key) {
19283
+ xml_slide_define_property(target, key, source[key]);
19284
+ });
19285
+ }
19286
+ return target;
19287
+ }
19288
+ function slide_ownKeys(object, enumerableOnly) {
19289
+ var keys = Object.keys(object);
19290
+ if (Object.getOwnPropertySymbols) {
19291
+ var symbols = Object.getOwnPropertySymbols(object);
19292
+ if (enumerableOnly) {
19293
+ symbols = symbols.filter(function(sym) {
19294
+ return Object.getOwnPropertyDescriptor(object, sym).enumerable;
19295
+ });
19296
+ }
19297
+ keys.push.apply(keys, symbols);
19298
+ }
19299
+ return keys;
19300
+ }
19301
+ function slide_object_spread_props(target, source) {
19302
+ source = source != null ? source : {};
19303
+ if (Object.getOwnPropertyDescriptors) Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
19304
+ else {
19305
+ slide_ownKeys(Object(source)).forEach(function(key) {
19306
+ Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
19307
+ });
19308
+ }
19309
+ return target;
19310
+ }
18782
19311
  /**
18783
19312
  * Slide, layout, and master shape-tree rendering.
18784
19313
  */
@@ -18786,6 +19315,7 @@ function unsignedInt(value) {
18786
19315
 
18787
19316
 
18788
19317
 
19318
+
18789
19319
  function nvPrModIdExt(modId) {
18790
19320
  return genXmlModIdExt(modId).replace(/^<p:extLst>|<\/p:extLst>$/g, '');
18791
19321
  }
@@ -18892,7 +19422,12 @@ function genXmlLine(line) {
18892
19422
  'rnd'
18893
19423
  ].includes(line.cap) ? ` cap="${line.cap}"` : '');
18894
19424
  let xml = `<a:ln${attrs}>`;
18895
- if (line.color) xml += genXmlColorSelection(line);
19425
+ const hasGrad = !!(line.gradient || line.type === 'gradient' || line.type === 'linearGradient');
19426
+ if (line.type !== 'none' && (line.color || hasGrad)) {
19427
+ xml += genXmlColorSelection(hasGrad && !line.type ? slide_object_spread_props(xml_slide_object_spread({}, line), {
19428
+ type: 'gradient'
19429
+ }) : line);
19430
+ }
18896
19431
  if (line.dashType) xml += `<a:prstDash val="${line.dashType}"/>`;
18897
19432
  if (line.beginArrowType) xml += `<a:headEnd type="${line.beginArrowType}"/>`;
18898
19433
  if (line.endArrowType) xml += `<a:tailEnd type="${line.endArrowType}"/>`;
@@ -18933,11 +19468,19 @@ function genXmlLine(line) {
18933
19468
  return `<a:reflection blurRad="${blur}" stA="${stA}" endA="0" dist="${dist}" dir="${dir}" sy="${sy}" algn="bl" rotWithShape="0"/>`;
18934
19469
  }
18935
19470
  /**
18936
- * Create the shape/image `a:effectLst` block (shadow + glow + reflection + softEdge).
18937
- * Child order follows ECMA-376 `CT_EffectList`: glow, innerShdw, outerShdw, reflection, softEdge.
19471
+ * Create `a:blur` (ECMA-376 `CT_BlurEffect`). `rad` is EMUs; `grow` omitted unless set.
19472
+ */ function genXmlBlurElement(blur) {
19473
+ const rad = valToPts(blur.radius);
19474
+ const grow = blur.grow === false ? ' grow="0"' : blur.grow === true ? ' grow="1"' : '';
19475
+ return `<a:blur rad="${rad}"${grow}/>`;
19476
+ }
19477
+ /**
19478
+ * Create the shape/image `a:effectLst` block (blur + glow + shadow + reflection + softEdge).
19479
+ * Child order follows ECMA-376 `CT_EffectList`: blur, glow, innerShdw, outerShdw, reflection, softEdge.
18938
19480
  * @note pure - unit conversion must NOT be written back to the caller's options object (issue #20)
18939
19481
  */ function genXmlEffectLst(opts) {
18940
19482
  const parts = [];
19483
+ if (opts.blur && typeof opts.blur.radius === 'number') parts.push(genXmlBlurElement(opts.blur));
18941
19484
  const resolvedGlow = resolveGlowOptions(opts.glow);
18942
19485
  if (resolvedGlow) parts.push(createGlowElement(resolvedGlow));
18943
19486
  const shadow = opts.shadow;
@@ -19028,15 +19571,97 @@ function findShapeCoord(list, id) {
19028
19571
  flipV
19029
19572
  };
19030
19573
  }
19574
+ /**
19575
+ * DrawingML `a:ext` uses ST_PositiveCoordinate, so extents cannot be negative.
19576
+ * Lines treat w/h as endpoint deltas: fold a negative axis into the offset and
19577
+ * flip that axis so the same endpoints (and therefore head/tail arrows) remain.
19578
+ */ function normalizeLineExtents(x, y, cx, cy, flipH, flipV) {
19579
+ if (cx < 0) {
19580
+ x += cx;
19581
+ cx = -cx;
19582
+ flipH = !flipH;
19583
+ }
19584
+ if (cy < 0) {
19585
+ y += cy;
19586
+ cy = -cy;
19587
+ flipV = !flipV;
19588
+ }
19589
+ return {
19590
+ x,
19591
+ y,
19592
+ cx,
19593
+ cy,
19594
+ flipH,
19595
+ flipV
19596
+ };
19597
+ }
19031
19598
  function resolveShapeId(options, idx, usedIds) {
19032
19599
  const requested = options === null || options === void 0 ? void 0 : options.sId;
19033
- const shapeId = requested != null ? requested : idx + 2;
19034
- if (usedIds.has(shapeId)) {
19035
- throw new Error(requested != null ? `sId ${shapeId} is already in use on this slide — object/shape ids must be unique` : `auto-generated shape id ${shapeId} conflicts with an explicit sId — use a higher sId`);
19600
+ let shapeId = requested != null ? requested : idx + 2;
19601
+ if (requested != null) {
19602
+ if (usedIds.has(shapeId)) {
19603
+ throw new Error(`sId ${shapeId} is already in use on this slide — object/shape ids must be unique`);
19604
+ }
19605
+ } else {
19606
+ while(usedIds.has(shapeId))shapeId++;
19036
19607
  }
19037
19608
  usedIds.add(shapeId);
19038
19609
  return shapeId;
19039
19610
  }
19611
+ /** Next unused `p:cNvPr@id` (ECMA-376 §5.1.2.1.9 `CT_NonVisualDrawingProps`). Slide-number used to hardcode 25 (SCV-Soft 9f66206). */ function nextUnusedShapeId(usedIds, start = 2) {
19612
+ let shapeId = start;
19613
+ while(usedIds.has(shapeId))shapeId++;
19614
+ usedIds.add(shapeId);
19615
+ return shapeId;
19616
+ }
19617
+ /**
19618
+ * DrawingML `a:custGeom` (ECMA-376 §5.1.11.5).
19619
+ * `pathW`/`pathH` mean coordinates are already in the path EMU space (SVG-derived paths).
19620
+ */ function genCustGeomXml(slideItemObj, cx, cy, slide) {
19621
+ var _ref, _ref1;
19622
+ var _opts_paths;
19623
+ const opts = slideItemObj.options;
19624
+ const pathArrays = (opts === null || opts === void 0 ? void 0 : (_opts_paths = opts.paths) === null || _opts_paths === void 0 ? void 0 : _opts_paths.length) ? opts.paths : (opts === null || opts === void 0 ? void 0 : opts.points) ? [
19625
+ opts.points
19626
+ ] : [];
19627
+ const pathW = (_ref = opts === null || opts === void 0 ? void 0 : opts.pathW) !== null && _ref !== void 0 ? _ref : cx;
19628
+ const pathH = (_ref1 = opts === null || opts === void 0 ? void 0 : opts.pathH) !== null && _ref1 !== void 0 ? _ref1 : cy;
19629
+ const rawEmu = typeof (opts === null || opts === void 0 ? void 0 : opts.pathW) === 'number';
19630
+ const emuX = (v)=>rawEmu ? Math.round(Number(v) || 0) : getSmartParseNumber(v !== null && v !== void 0 ? v : 0, 'X', slide._presLayout);
19631
+ const emuY = (v)=>rawEmu ? Math.round(Number(v) || 0) : getSmartParseNumber(v !== null && v !== void 0 ? v : 0, 'Y', slide._presLayout);
19632
+ let xml = '<a:custGeom><a:avLst /><a:gdLst></a:gdLst><a:ahLst /><a:cxnLst></a:cxnLst>';
19633
+ xml += '<a:rect l="l" t="t" r="r" b="b" />';
19634
+ xml += '<a:pathLst>';
19635
+ for (const points of pathArrays){
19636
+ xml += `<a:path w="${Math.round(pathW)}" h="${Math.round(pathH)}">`;
19637
+ points === null || points === void 0 ? void 0 : points.forEach((point, i)=>{
19638
+ if ('curve' in point) {
19639
+ switch(point.curve.type){
19640
+ case 'arc':
19641
+ xml += `<a:arcTo hR="${emuY(point.curve.hR)}" wR="${emuX(point.curve.wR)}" stAng="${convertRotationDegrees(point.curve.stAng)}" swAng="${convertRotationDegrees(point.curve.swAng)}" />`;
19642
+ break;
19643
+ case 'cubic':
19644
+ xml += `<a:cubicBezTo><a:pt x="${emuX(point.curve.x1)}" y="${emuY(point.curve.y1)}" /><a:pt x="${emuX(point.curve.x2)}" y="${emuY(point.curve.y2)}" /><a:pt x="${emuX(point.x)}" y="${emuY(point.y)}" /></a:cubicBezTo>`;
19645
+ break;
19646
+ case 'quadratic':
19647
+ xml += `<a:quadBezTo><a:pt x="${emuX(point.curve.x1)}" y="${emuY(point.curve.y1)}" /><a:pt x="${emuX(point.x)}" y="${emuY(point.y)}" /></a:quadBezTo>`;
19648
+ break;
19649
+ default:
19650
+ break;
19651
+ }
19652
+ } else if ('close' in point) {
19653
+ xml += '<a:close />';
19654
+ } else if (point.moveTo || i === 0) {
19655
+ xml += `<a:moveTo><a:pt x="${emuX(point.x)}" y="${emuY(point.y)}" /></a:moveTo>`;
19656
+ } else {
19657
+ xml += `<a:lnTo><a:pt x="${emuX(point.x)}" y="${emuY(point.y)}" /></a:lnTo>`;
19658
+ }
19659
+ });
19660
+ xml += '</a:path>';
19661
+ }
19662
+ xml += '</a:pathLst></a:custGeom>';
19663
+ return xml;
19664
+ }
19040
19665
  /**
19041
19666
  * Transforms a slide or slideLayout to resulting XML string - Creates `ppt/slide*.xml`
19042
19667
  * @param {PresSlide|SlideLayout} slideObject - slide object created within createSlideObject
@@ -19078,142 +19703,154 @@ function slideObjectToXml(slide) {
19078
19703
  // STEP 3: Loop over all Slide.data objects and add them to this slide
19079
19704
  const usedShapeIds = new Set();
19080
19705
  const shapeCoordinates = [];
19081
- slide._slideObjects.forEach((slideItemObj, idx)=>{
19082
- var _slideItemObj_options, _slideItemObj_options1, _slide__slideLayout, _slideItemObj_options_line, _slideItemObj_options_sizing, _slideItemObj_options2;
19083
- let x = 0;
19084
- let y = 0;
19085
- let cx = getSmartParseNumber('75%', 'X', slide._presLayout);
19086
- let cy = 0;
19087
- let placeholderObj;
19088
- let locationAttr = '';
19089
- let arrTabRows = [];
19090
- let objTabOpts = {};
19091
- slideItemObj.options = slideItemObj.options || {};
19092
- const shapeId = resolveShapeId(slideItemObj.options, idx, usedShapeIds);
19093
- // Keep resolved id on options so animations / later passes can target the same cNvPr id
19094
- slideItemObj.options.sId = shapeId;
19095
- shapeCoordinates.push({
19096
- id: shapeId,
19097
- position: {
19098
- x: slideItemObj.options.x,
19099
- y: slideItemObj.options.y,
19100
- w: slideItemObj.options.w,
19101
- h: slideItemObj.options.h
19706
+ const renderObjectList = (objects)=>{
19707
+ objects.forEach((slideItemObj, idx)=>{
19708
+ var _slideItemObj_options, _slideItemObj_options1, _slide__slideLayout, _slideItemObj_options_line, _slideItemObj_options_sizing, _slideItemObj_options2;
19709
+ let x = 0;
19710
+ let y = 0;
19711
+ let cx = getSmartParseNumber('75%', 'X', slide._presLayout);
19712
+ let cy = 0;
19713
+ let placeholderObj;
19714
+ let locationAttr = '';
19715
+ let arrTabRows = [];
19716
+ let objTabOpts = {};
19717
+ slideItemObj.options = slideItemObj.options || {};
19718
+ const shapeId = resolveShapeId(slideItemObj.options, idx, usedShapeIds);
19719
+ // Keep resolved id on options so animations / later passes can target the same cNvPr id
19720
+ slideItemObj.options.sId = shapeId;
19721
+ shapeCoordinates.push({
19722
+ id: shapeId,
19723
+ position: {
19724
+ x: slideItemObj.options.x,
19725
+ y: slideItemObj.options.y,
19726
+ w: slideItemObj.options.w,
19727
+ h: slideItemObj.options.h
19728
+ }
19729
+ });
19730
+ let intColCnt = 0;
19731
+ let cellOpts;
19732
+ let strXml = '';
19733
+ const sizing = (_slideItemObj_options = slideItemObj.options) === null || _slideItemObj_options === void 0 ? void 0 : _slideItemObj_options.sizing;
19734
+ const rounding = (_slideItemObj_options1 = slideItemObj.options) === null || _slideItemObj_options1 === void 0 ? void 0 : _slideItemObj_options1.rounding;
19735
+ if ('_slideLayout' in slide && ((_slide__slideLayout = slide._slideLayout) === null || _slide__slideLayout === void 0 ? void 0 : _slide__slideLayout._slideObjects) !== undefined && slideItemObj.options && slideItemObj.options.placeholder) {
19736
+ placeholderObj = slide._slideLayout._slideObjects.filter((object)=>{
19737
+ var _object_options, _slideItemObj_options;
19738
+ return ((_object_options = object.options) === null || _object_options === void 0 ? void 0 : _object_options.placeholder) === ((_slideItemObj_options = slideItemObj.options) === null || _slideItemObj_options === void 0 ? void 0 : _slideItemObj_options.placeholder);
19739
+ })[0];
19102
19740
  }
19103
- });
19104
- let intColCnt = 0;
19105
- let cellOpts;
19106
- let strXml = '';
19107
- const sizing = (_slideItemObj_options = slideItemObj.options) === null || _slideItemObj_options === void 0 ? void 0 : _slideItemObj_options.sizing;
19108
- const rounding = (_slideItemObj_options1 = slideItemObj.options) === null || _slideItemObj_options1 === void 0 ? void 0 : _slideItemObj_options1.rounding;
19109
- if ('_slideLayout' in slide && ((_slide__slideLayout = slide._slideLayout) === null || _slide__slideLayout === void 0 ? void 0 : _slide__slideLayout._slideObjects) !== undefined && slideItemObj.options && slideItemObj.options.placeholder) {
19110
- placeholderObj = slide._slideLayout._slideObjects.filter((object)=>{
19111
- var _object_options, _slideItemObj_options;
19112
- return ((_object_options = object.options) === null || _object_options === void 0 ? void 0 : _object_options.placeholder) === ((_slideItemObj_options = slideItemObj.options) === null || _slideItemObj_options === void 0 ? void 0 : _slideItemObj_options.placeholder);
19113
- })[0];
19114
- }
19115
- // A: Geometry — connectors may auto-size from source/target shape boxes (ZentoSoft)
19116
- const connectorLayout = ((_slideItemObj_options_line = slideItemObj.options.line) === null || _slideItemObj_options_line === void 0 ? void 0 : _slideItemObj_options_line.isConnector) ? applyConnectorAutoLayout(slideItemObj.options.line, shapeCoordinates, slide._presLayout) : undefined;
19117
- if (connectorLayout) {
19118
- x = connectorLayout.x;
19119
- y = connectorLayout.y;
19120
- cx = connectorLayout.cx;
19121
- cy = connectorLayout.cy;
19122
- slideItemObj.options.flipH = connectorLayout.flipH;
19123
- slideItemObj.options.flipV = connectorLayout.flipV;
19124
- } else {
19125
- if (typeof slideItemObj.options.x !== 'undefined') x = getSmartParseNumber(slideItemObj.options.x, 'X', slide._presLayout);
19126
- if (typeof slideItemObj.options.y !== 'undefined') y = getSmartParseNumber(slideItemObj.options.y, 'Y', slide._presLayout);
19127
- if (typeof slideItemObj.options.w !== 'undefined') cx = getSmartParseNumber(slideItemObj.options.w, 'X', slide._presLayout);
19128
- if (typeof slideItemObj.options.h !== 'undefined') cy = getSmartParseNumber(slideItemObj.options.h, 'Y', slide._presLayout);
19129
- }
19130
- // Set w/h now that smart parse is done.
19131
- // `getSmartParseNumber` guesses units per-value (<100=inches, >=100=EMU), so `w:2899, h:97` mixes EMU
19132
- // and inches. The sizing fns only use imgSize for a *ratio*, so normalize to a common unit before they
19133
- // corrupt `srcRect` with a garbage aspect (issue #1286). Frame `cx`/`cy` below keep their own values.
19134
- let imgWidth = cx;
19135
- let imgHeight = cy;
19136
- if ((_slideItemObj_options2 = slideItemObj.options) === null || _slideItemObj_options2 === void 0 ? void 0 : (_slideItemObj_options_sizing = _slideItemObj_options2.sizing) === null || _slideItemObj_options_sizing === void 0 ? void 0 : _slideItemObj_options_sizing.type) {
19137
- // `getSmartParseNumber` guesses units per-value (<100=inches, >=100=EMU), so `w:2899, h:97` mixes
19138
- // EMU and inches and corrupts the sizing aspect/`srcRect` (issue #1286). boxDim is always EMU, so
19139
- // coerce both image dims to EMU: whichever raw value was taken as inches (<100) is re-read as EMU.
19140
- const rawW = slideItemObj.options.w;
19141
- const rawH = slideItemObj.options.h;
19142
- if (typeof rawW === 'number' && rawW < 100 && typeof rawH === 'number' && rawH >= 100) imgWidth = rawW;
19143
- else if (typeof rawH === 'number' && rawH < 100 && typeof rawW === 'number' && rawW >= 100) imgHeight = rawH;
19144
- }
19145
- // If using a placeholder then inherit it's position
19146
- if (placeholderObj) {
19147
- var _placeholderObj_options, _placeholderObj_options1, _placeholderObj_options2, _placeholderObj_options3, _placeholderObj_options4, _placeholderObj_options5, _placeholderObj_options6, _placeholderObj_options7, _placeholderObj_options8, _placeholderObj_options9, _placeholderObj_options10, _placeholderObj_options11;
19148
- if (((_placeholderObj_options = placeholderObj.options) === null || _placeholderObj_options === void 0 ? void 0 : _placeholderObj_options.x) || ((_placeholderObj_options1 = placeholderObj.options) === null || _placeholderObj_options1 === void 0 ? void 0 : _placeholderObj_options1.x) === 0) x = getSmartParseNumber((_placeholderObj_options2 = placeholderObj.options) === null || _placeholderObj_options2 === void 0 ? void 0 : _placeholderObj_options2.x, 'X', slide._presLayout);
19149
- if (((_placeholderObj_options3 = placeholderObj.options) === null || _placeholderObj_options3 === void 0 ? void 0 : _placeholderObj_options3.y) || ((_placeholderObj_options4 = placeholderObj.options) === null || _placeholderObj_options4 === void 0 ? void 0 : _placeholderObj_options4.y) === 0) y = getSmartParseNumber((_placeholderObj_options5 = placeholderObj.options) === null || _placeholderObj_options5 === void 0 ? void 0 : _placeholderObj_options5.y, 'Y', slide._presLayout);
19150
- if (((_placeholderObj_options6 = placeholderObj.options) === null || _placeholderObj_options6 === void 0 ? void 0 : _placeholderObj_options6.w) || ((_placeholderObj_options7 = placeholderObj.options) === null || _placeholderObj_options7 === void 0 ? void 0 : _placeholderObj_options7.w) === 0) cx = getSmartParseNumber((_placeholderObj_options8 = placeholderObj.options) === null || _placeholderObj_options8 === void 0 ? void 0 : _placeholderObj_options8.w, 'X', slide._presLayout);
19151
- if (((_placeholderObj_options9 = placeholderObj.options) === null || _placeholderObj_options9 === void 0 ? void 0 : _placeholderObj_options9.h) || ((_placeholderObj_options10 = placeholderObj.options) === null || _placeholderObj_options10 === void 0 ? void 0 : _placeholderObj_options10.h) === 0) cy = getSmartParseNumber((_placeholderObj_options11 = placeholderObj.options) === null || _placeholderObj_options11 === void 0 ? void 0 : _placeholderObj_options11.h, 'Y', slide._presLayout);
19152
- // Re-sync the image frame: imgWidth/imgHeight were snapshotted from cx/cy before this block, so a
19153
- // placeholder's w/h would otherwise be lost and the frame stay at the 1x1 default (issue #996).
19154
- imgWidth = cx;
19155
- imgHeight = cy;
19156
- }
19157
- //
19158
- if (slideItemObj.options.flipH) locationAttr += ' flipH="1"';
19159
- if (slideItemObj.options.flipV) locationAttr += ' flipV="1"';
19160
- if (slideItemObj.options.rotate) locationAttr += ` rot="${convertRotationDegrees(slideItemObj.options.rotate)}"`;
19161
- // B: Add OBJECT to the current Slide
19162
- switch(slideItemObj._type){
19163
- case (/* inlined export .SLIDE_OBJECT_TYPES.table */"table"):
19164
- {
19165
- var _slideItemObj_arrTabRows, _slide__slideNum;
19166
- arrTabRows = (_slideItemObj_arrTabRows = slideItemObj.arrTabRows) !== null && _slideItemObj_arrTabRows !== void 0 ? _slideItemObj_arrTabRows : [];
19167
- objTabOpts = slideItemObj.options;
19168
- intColCnt = 0;
19169
- // Calc number of columns
19170
- // NOTE: Cells may have a colspan, so merely taking the length of the [0] (or any other) row is not
19171
- // ....: sufficient to determine column count. Therefore, check each cell for a colspan and total cols as reqd
19172
- arrTabRows[0].forEach((cell)=>{
19173
- cellOpts = cell.options;
19174
- intColCnt += (cellOpts === null || cellOpts === void 0 ? void 0 : cellOpts.colspan) ? Number(cellOpts.colspan) : 1;
19175
- });
19176
- // STEP 1: Start Table XML
19177
- // NOTE: Non-numeric cNvPr id values will trigger "presentation needs repair" type warning in MS-PPT-2013
19178
- strXml = `<p:graphicFrame><p:nvGraphicFramePr><p:cNvPr id="${intTableNum * ((_slide__slideNum = slide._slideNum) !== null && _slide__slideNum !== void 0 ? _slide__slideNum : 0) + 1}" name="${slideItemObj.options.objectName}"/>`;
19179
- // When the table binds to a master/layout placeholder, emit `<p:ph type="tbl"/>` (ECMA-376 §4.4.1.33, issue #856)
19180
- const tblPh = placeholderObj ? genXmlPlaceholder(placeholderObj, slideItemObj.options) : '';
19181
- const tblModId = '<p:ext uri="{D42A27DB-BD31-4B8C-83A1-F6EECF244321}"><p14:modId xmlns:p14="http://schemas.microsoft.com/office/powerpoint/2010/main" val="1579011935"/></p:ext>';
19182
- strXml += '<p:cNvGraphicFramePr><a:graphicFrameLocks noGrp="1"/></p:cNvGraphicFramePr>' + ` ${genXmlNvPr(slideItemObj.options, tblPh, [
19183
- typeof slideItemObj.options.modId === 'number' ? nvPrModIdExt(slideItemObj.options.modId) : tblModId
19184
- ])}` + '</p:nvGraphicFramePr>';
19185
- strXml += `<p:xfrm><a:off x="${x || (x === 0 ? 0 : (/* inlined export .EMU */914400))}" y="${y || (y === 0 ? 0 : (/* inlined export .EMU */914400))}"/><a:ext cx="${cx || (cx === 0 ? 0 : (/* inlined export .EMU */914400))}" cy="${cy || (/* inlined export .EMU */914400)}"/></p:xfrm>`;
19186
- strXml += '<a:graphic><a:graphicData uri="http://schemas.openxmlformats.org/drawingml/2006/table">';
19187
- // NOTE: banding/emphasis only renders when a table style is applied - either `tableStyleId` here or a theme default
19188
- strXml += `<a:tbl>${genXmlTblPr(objTabOpts)}`;
19189
- // STEP 2: Set column widths
19190
- // Evenly distribute cols/rows across size provided when applicable (calc them if only overall dimensions were provided)
19191
- // A: Col widths provided?
19192
- // B: Table Width provided without colW? Then distribute cols
19193
- if (Array.isArray(objTabOpts.colW)) {
19194
- strXml += '<a:tblGrid>';
19195
- for(let col = 0; col < intColCnt; col++){
19196
- let w = inch2Emu(objTabOpts.colW[col]);
19197
- if (w == null || isNaN(w)) {
19198
- w = (typeof slideItemObj.options.w === 'number' ? slideItemObj.options.w : 1) / intColCnt;
19741
+ // A: Geometry — connectors may auto-size from source/target shape boxes (ZentoSoft)
19742
+ const connectorLayout = ((_slideItemObj_options_line = slideItemObj.options.line) === null || _slideItemObj_options_line === void 0 ? void 0 : _slideItemObj_options_line.isConnector) ? applyConnectorAutoLayout(slideItemObj.options.line, shapeCoordinates, slide._presLayout) : undefined;
19743
+ if (connectorLayout) {
19744
+ x = connectorLayout.x;
19745
+ y = connectorLayout.y;
19746
+ cx = connectorLayout.cx;
19747
+ cy = connectorLayout.cy;
19748
+ slideItemObj.options.flipH = connectorLayout.flipH;
19749
+ slideItemObj.options.flipV = connectorLayout.flipV;
19750
+ } else {
19751
+ if (typeof slideItemObj.options.x !== 'undefined') x = getSmartParseNumber(slideItemObj.options.x, 'X', slide._presLayout);
19752
+ if (typeof slideItemObj.options.y !== 'undefined') y = getSmartParseNumber(slideItemObj.options.y, 'Y', slide._presLayout);
19753
+ if (typeof slideItemObj.options.w !== 'undefined') cx = getSmartParseNumber(slideItemObj.options.w, 'X', slide._presLayout);
19754
+ if (typeof slideItemObj.options.h !== 'undefined') cy = getSmartParseNumber(slideItemObj.options.h, 'Y', slide._presLayout);
19755
+ }
19756
+ // Set w/h now that smart parse is done.
19757
+ // `getSmartParseNumber` guesses units per-value (<100=inches, >=100=EMU), so `w:2899, h:97` mixes EMU
19758
+ // and inches. The sizing fns only use imgSize for a *ratio*, so normalize to a common unit before they
19759
+ // corrupt `srcRect` with a garbage aspect (issue #1286). Frame `cx`/`cy` below keep their own values.
19760
+ let imgWidth = cx;
19761
+ let imgHeight = cy;
19762
+ if ((_slideItemObj_options2 = slideItemObj.options) === null || _slideItemObj_options2 === void 0 ? void 0 : (_slideItemObj_options_sizing = _slideItemObj_options2.sizing) === null || _slideItemObj_options_sizing === void 0 ? void 0 : _slideItemObj_options_sizing.type) {
19763
+ // `getSmartParseNumber` guesses units per-value (<100=inches, >=100=EMU), so `w:2899, h:97` mixes
19764
+ // EMU and inches and corrupts the sizing aspect/`srcRect` (issue #1286). boxDim is always EMU, so
19765
+ // coerce both image dims to EMU: whichever raw value was taken as inches (<100) is re-read as EMU.
19766
+ const rawW = slideItemObj.options.w;
19767
+ const rawH = slideItemObj.options.h;
19768
+ if (typeof rawW === 'number' && rawW < 100 && typeof rawH === 'number' && rawH >= 100) imgWidth = rawW;
19769
+ else if (typeof rawH === 'number' && rawH < 100 && typeof rawW === 'number' && rawW >= 100) imgHeight = rawH;
19770
+ }
19771
+ // Inherit placeholder geometry only for axes the caller did not set (fujita-h d7e3e93).
19772
+ // addImage always writes x/y/w/h defaults, so `_explicit*` distinguishes unset vs explicit.
19773
+ if (placeholderObj) {
19774
+ var _placeholderObj_options, _placeholderObj_options1, _placeholderObj_options2, _placeholderObj_options3, _placeholderObj_options4, _placeholderObj_options5, _placeholderObj_options6, _placeholderObj_options7, _placeholderObj_options8, _placeholderObj_options9, _placeholderObj_options10, _placeholderObj_options11;
19775
+ if (!slideItemObj.options._explicitX && (((_placeholderObj_options = placeholderObj.options) === null || _placeholderObj_options === void 0 ? void 0 : _placeholderObj_options.x) || ((_placeholderObj_options1 = placeholderObj.options) === null || _placeholderObj_options1 === void 0 ? void 0 : _placeholderObj_options1.x) === 0)) x = getSmartParseNumber((_placeholderObj_options2 = placeholderObj.options) === null || _placeholderObj_options2 === void 0 ? void 0 : _placeholderObj_options2.x, 'X', slide._presLayout);
19776
+ if (!slideItemObj.options._explicitY && (((_placeholderObj_options3 = placeholderObj.options) === null || _placeholderObj_options3 === void 0 ? void 0 : _placeholderObj_options3.y) || ((_placeholderObj_options4 = placeholderObj.options) === null || _placeholderObj_options4 === void 0 ? void 0 : _placeholderObj_options4.y) === 0)) y = getSmartParseNumber((_placeholderObj_options5 = placeholderObj.options) === null || _placeholderObj_options5 === void 0 ? void 0 : _placeholderObj_options5.y, 'Y', slide._presLayout);
19777
+ if (!slideItemObj.options._explicitW && (((_placeholderObj_options6 = placeholderObj.options) === null || _placeholderObj_options6 === void 0 ? void 0 : _placeholderObj_options6.w) || ((_placeholderObj_options7 = placeholderObj.options) === null || _placeholderObj_options7 === void 0 ? void 0 : _placeholderObj_options7.w) === 0)) cx = getSmartParseNumber((_placeholderObj_options8 = placeholderObj.options) === null || _placeholderObj_options8 === void 0 ? void 0 : _placeholderObj_options8.w, 'X', slide._presLayout);
19778
+ if (!slideItemObj.options._explicitH && (((_placeholderObj_options9 = placeholderObj.options) === null || _placeholderObj_options9 === void 0 ? void 0 : _placeholderObj_options9.h) || ((_placeholderObj_options10 = placeholderObj.options) === null || _placeholderObj_options10 === void 0 ? void 0 : _placeholderObj_options10.h) === 0)) cy = getSmartParseNumber((_placeholderObj_options11 = placeholderObj.options) === null || _placeholderObj_options11 === void 0 ? void 0 : _placeholderObj_options11.h, 'Y', slide._presLayout);
19779
+ // Re-sync the image frame: imgWidth/imgHeight were snapshotted from cx/cy before this block, so a
19780
+ // placeholder's w/h would otherwise be lost and the frame stay at the 1x1 default (issue #996).
19781
+ imgWidth = cx;
19782
+ imgHeight = cy;
19783
+ }
19784
+ let flipH = !!slideItemObj.options.flipH;
19785
+ let flipV = !!slideItemObj.options.flipV;
19786
+ if (slideItemObj.shape === core_enums_SHAPE_TYPE.LINE) {
19787
+ const line = normalizeLineExtents(x, y, cx, cy, flipH, flipV);
19788
+ x = line.x;
19789
+ y = line.y;
19790
+ cx = line.cx;
19791
+ cy = line.cy;
19792
+ flipH = line.flipH;
19793
+ flipV = line.flipV;
19794
+ }
19795
+ if (flipH) locationAttr += ' flipH="1"';
19796
+ if (flipV) locationAttr += ' flipV="1"';
19797
+ if (slideItemObj.options.rotate) locationAttr += ` rot="${convertRotationDegrees(slideItemObj.options.rotate)}"`;
19798
+ // B: Add OBJECT to the current Slide
19799
+ switch(slideItemObj._type){
19800
+ case (/* inlined export .SLIDE_OBJECT_TYPES.table */"table"):
19801
+ {
19802
+ var _slideItemObj_arrTabRows, _slide__slideNum;
19803
+ arrTabRows = (_slideItemObj_arrTabRows = slideItemObj.arrTabRows) !== null && _slideItemObj_arrTabRows !== void 0 ? _slideItemObj_arrTabRows : [];
19804
+ objTabOpts = slideItemObj.options;
19805
+ intColCnt = 0;
19806
+ // Calc number of columns
19807
+ // NOTE: Cells may have a colspan, so merely taking the length of the [0] (or any other) row is not
19808
+ // ....: sufficient to determine column count. Therefore, check each cell for a colspan and total cols as reqd
19809
+ arrTabRows[0].forEach((cell)=>{
19810
+ cellOpts = cell.options;
19811
+ intColCnt += (cellOpts === null || cellOpts === void 0 ? void 0 : cellOpts.colspan) ? Number(cellOpts.colspan) : 1;
19812
+ });
19813
+ // STEP 1: Start Table XML
19814
+ // NOTE: Non-numeric cNvPr id values will trigger "presentation needs repair" type warning in MS-PPT-2013
19815
+ strXml = `<p:graphicFrame><p:nvGraphicFramePr><p:cNvPr id="${intTableNum * ((_slide__slideNum = slide._slideNum) !== null && _slide__slideNum !== void 0 ? _slide__slideNum : 0) + 1}" name="${slideItemObj.options.objectName}"/>`;
19816
+ // When the table binds to a master/layout placeholder, emit `<p:ph type="tbl"/>` (ECMA-376 §4.4.1.33, issue #856)
19817
+ const tblPh = placeholderObj ? genXmlPlaceholder(placeholderObj, slideItemObj.options) : '';
19818
+ const tblModId = '<p:ext uri="{D42A27DB-BD31-4B8C-83A1-F6EECF244321}"><p14:modId xmlns:p14="http://schemas.microsoft.com/office/powerpoint/2010/main" val="1579011935"/></p:ext>';
19819
+ strXml += '<p:cNvGraphicFramePr><a:graphicFrameLocks noGrp="1"/></p:cNvGraphicFramePr>' + ` ${genXmlNvPr(slideItemObj.options, tblPh, [
19820
+ typeof slideItemObj.options.modId === 'number' ? nvPrModIdExt(slideItemObj.options.modId) : tblModId
19821
+ ])}` + '</p:nvGraphicFramePr>';
19822
+ strXml += `<p:xfrm><a:off x="${x || (x === 0 ? 0 : (/* inlined export .EMU */914400))}" y="${y || (y === 0 ? 0 : (/* inlined export .EMU */914400))}"/><a:ext cx="${cx || (cx === 0 ? 0 : (/* inlined export .EMU */914400))}" cy="${cy || (/* inlined export .EMU */914400)}"/></p:xfrm>`;
19823
+ strXml += '<a:graphic><a:graphicData uri="http://schemas.openxmlformats.org/drawingml/2006/table">';
19824
+ // NOTE: banding/emphasis only renders when a table style is applied - either `tableStyleId` here or a theme default
19825
+ strXml += `<a:tbl>${genXmlTblPr(objTabOpts)}`;
19826
+ // STEP 2: Set column widths
19827
+ // Evenly distribute cols/rows across size provided when applicable (calc them if only overall dimensions were provided)
19828
+ // A: Col widths provided?
19829
+ // B: Table Width provided without colW? Then distribute cols
19830
+ if (Array.isArray(objTabOpts.colW)) {
19831
+ strXml += '<a:tblGrid>';
19832
+ for(let col = 0; col < intColCnt; col++){
19833
+ let w = inch2Emu(objTabOpts.colW[col]);
19834
+ if (w == null || isNaN(w)) {
19835
+ w = (typeof slideItemObj.options.w === 'number' ? slideItemObj.options.w : 1) / intColCnt;
19836
+ }
19837
+ strXml += `<a:gridCol w="${Math.round(w)}"/>`;
19199
19838
  }
19200
- strXml += `<a:gridCol w="${Math.round(w)}"/>`;
19201
- }
19202
- strXml += '</a:tblGrid>';
19203
- } else {
19204
- let intColW = objTabOpts.colW ? objTabOpts.colW : (/* inlined export .EMU */914400);
19205
- if (slideItemObj.options.w && !objTabOpts.colW) intColW = Math.round((typeof slideItemObj.options.w === 'number' ? slideItemObj.options.w : 1) / intColCnt);
19206
- strXml += '<a:tblGrid>';
19207
- for(let colw = 0; colw < intColCnt; colw++){
19208
- strXml += `<a:gridCol w="${intColW}"/>`;
19839
+ strXml += '</a:tblGrid>';
19840
+ } else {
19841
+ let intColW = objTabOpts.colW ? objTabOpts.colW : (/* inlined export .EMU */914400);
19842
+ if (slideItemObj.options.w && !objTabOpts.colW) intColW = Math.round((typeof slideItemObj.options.w === 'number' ? slideItemObj.options.w : 1) / intColCnt);
19843
+ strXml += '<a:tblGrid>';
19844
+ for(let colw = 0; colw < intColCnt; colw++){
19845
+ strXml += `<a:gridCol w="${intColW}"/>`;
19846
+ }
19847
+ strXml += '</a:tblGrid>';
19209
19848
  }
19210
- strXml += '</a:tblGrid>';
19211
- }
19212
- // STEP 3: Build our row arrays into an actual grid to match the XML we will be building next (ISSUE #36)
19213
- // Note row arrays can arrive "lopsided" as in row1:[1,2,3] row2:[3] when first two cols rowspan!,
19214
- // so a simple loop below in XML building wont suffice to build table correctly.
19215
- // We have to build an actual grid now
19216
- /*
19849
+ // STEP 3: Build our row arrays into an actual grid to match the XML we will be building next (ISSUE #36)
19850
+ // Note row arrays can arrive "lopsided" as in row1:[1,2,3] row2:[3] when first two cols rowspan!,
19851
+ // so a simple loop below in XML building wont suffice to build table correctly.
19852
+ // We have to build an actual grid now
19853
+ /*
19217
19854
  EX: (A0:rowspan=3, B1:rowspan=2, C1:colspan=2)
19218
19855
 
19219
19856
  /------|------|------|------\
@@ -19222,567 +19859,582 @@ function slideObjectToXml(slide) {
19222
19859
  | | | C2 | D2 |
19223
19860
  \------|------|------|------/
19224
19861
  */ // A: add _hmerge cell for colspan. should reserve rowspan
19225
- arrTabRows.forEach((cells)=>{
19226
- for(let cIdx = 0; cIdx < cells.length;){
19227
- var _cell_options, _cell_options1;
19228
- const cell = cells[cIdx];
19229
- const colspan = (_cell_options = cell.options) === null || _cell_options === void 0 ? void 0 : _cell_options.colspan;
19230
- const rowspan = (_cell_options1 = cell.options) === null || _cell_options1 === void 0 ? void 0 : _cell_options1.rowspan;
19231
- if (colspan && colspan > 1) {
19232
- const vMergeCells = new Array(colspan - 1).fill(undefined).map(()=>{
19233
- return {
19862
+ arrTabRows.forEach((cells)=>{
19863
+ for(let cIdx = 0; cIdx < cells.length;){
19864
+ var _cell_options, _cell_options1;
19865
+ const cell = cells[cIdx];
19866
+ const colspan = (_cell_options = cell.options) === null || _cell_options === void 0 ? void 0 : _cell_options.colspan;
19867
+ const rowspan = (_cell_options1 = cell.options) === null || _cell_options1 === void 0 ? void 0 : _cell_options1.rowspan;
19868
+ if (colspan && colspan > 1) {
19869
+ const vMergeCells = new Array(colspan - 1).fill(undefined).map(()=>{
19870
+ return {
19871
+ _type: (/* inlined export .SLIDE_OBJECT_TYPES.tablecell */"tablecell"),
19872
+ options: {
19873
+ rowspan
19874
+ },
19875
+ _hmerge: true
19876
+ };
19877
+ });
19878
+ cells.splice(cIdx + 1, 0, ...vMergeCells);
19879
+ cIdx += colspan;
19880
+ } else {
19881
+ cIdx += 1;
19882
+ }
19883
+ }
19884
+ });
19885
+ // B: add _vmerge cell for rowspan. should reserve colspan/_hmerge
19886
+ arrTabRows.forEach((cells, rIdx)=>{
19887
+ const nextRow = arrTabRows[rIdx + 1];
19888
+ if (!nextRow) return;
19889
+ cells.forEach((cell, cIdx)=>{
19890
+ var _cell_options, _cell_options1;
19891
+ const rowspan = cell._rowContinue || ((_cell_options = cell.options) === null || _cell_options === void 0 ? void 0 : _cell_options.rowspan);
19892
+ const colspan = (_cell_options1 = cell.options) === null || _cell_options1 === void 0 ? void 0 : _cell_options1.colspan;
19893
+ const _hmerge = cell._hmerge;
19894
+ if (rowspan && rowspan > 1) {
19895
+ const hMergeCell = {
19234
19896
  _type: (/* inlined export .SLIDE_OBJECT_TYPES.tablecell */"tablecell"),
19235
19897
  options: {
19236
- rowspan
19898
+ colspan
19237
19899
  },
19238
- _hmerge: true
19900
+ _rowContinue: rowspan - 1,
19901
+ _vmerge: true,
19902
+ _hmerge
19239
19903
  };
19240
- });
19241
- cells.splice(cIdx + 1, 0, ...vMergeCells);
19242
- cIdx += colspan;
19243
- } else {
19244
- cIdx += 1;
19245
- }
19246
- }
19247
- });
19248
- // B: add _vmerge cell for rowspan. should reserve colspan/_hmerge
19249
- arrTabRows.forEach((cells, rIdx)=>{
19250
- const nextRow = arrTabRows[rIdx + 1];
19251
- if (!nextRow) return;
19252
- cells.forEach((cell, cIdx)=>{
19253
- var _cell_options, _cell_options1;
19254
- const rowspan = cell._rowContinue || ((_cell_options = cell.options) === null || _cell_options === void 0 ? void 0 : _cell_options.rowspan);
19255
- const colspan = (_cell_options1 = cell.options) === null || _cell_options1 === void 0 ? void 0 : _cell_options1.colspan;
19256
- const _hmerge = cell._hmerge;
19257
- if (rowspan && rowspan > 1) {
19258
- const hMergeCell = {
19259
- _type: (/* inlined export .SLIDE_OBJECT_TYPES.tablecell */"tablecell"),
19260
- options: {
19261
- colspan
19262
- },
19263
- _rowContinue: rowspan - 1,
19264
- _vmerge: true,
19265
- _hmerge
19266
- };
19267
- nextRow.splice(cIdx, 0, hMergeCell);
19268
- }
19904
+ nextRow.splice(cIdx, 0, hMergeCell);
19905
+ }
19906
+ });
19269
19907
  });
19270
- });
19271
- // STEP 4: Build table rows/cells
19272
- arrTabRows.forEach((cells, rIdx)=>{
19273
- var _slideItemObj_options;
19274
- const itemOpts = (_slideItemObj_options = slideItemObj.options) !== null && _slideItemObj_options !== void 0 ? _slideItemObj_options : {};
19275
- // A: Table Height provided without rowH? Then distribute rows
19276
- let intRowH = 0 // IMPORTANT: Default must be zero for auto-sizing to work
19277
- ;
19278
- if (Array.isArray(objTabOpts.rowH) && objTabOpts.rowH[rIdx]) intRowH = inch2Emu(Number(objTabOpts.rowH[rIdx]));
19279
- else if (objTabOpts.rowH && !isNaN(Number(objTabOpts.rowH))) intRowH = inch2Emu(Number(objTabOpts.rowH));
19280
- else if (itemOpts.cy || itemOpts.h) {
19281
- intRowH = Math.round((itemOpts.h ? inch2Emu(itemOpts.h) : typeof itemOpts.cy === 'number' ? itemOpts.cy : 1) / arrTabRows.length);
19282
- }
19283
- // B: Start row
19284
- strXml += `<a:tr h="${intRowH}">`;
19285
- // C: Loop over each CELL
19286
- cells.forEach((cellObj)=>{
19287
- var _ref, _ref1;
19288
- var _cell_options, _cell_options1, _cell_options2, _cell_options3, _cell__optImp_fill, _cell__optImp, _cell__optImp1;
19289
- const cell = cellObj;
19290
- const cellSpanAttrs = {
19291
- rowSpan: ((_ref = (_cell_options = cell.options) === null || _cell_options === void 0 ? void 0 : _cell_options.rowspan) !== null && _ref !== void 0 ? _ref : 0) > 1 ? (_cell_options1 = cell.options) === null || _cell_options1 === void 0 ? void 0 : _cell_options1.rowspan : undefined,
19292
- gridSpan: ((_ref1 = (_cell_options2 = cell.options) === null || _cell_options2 === void 0 ? void 0 : _cell_options2.colspan) !== null && _ref1 !== void 0 ? _ref1 : 0) > 1 ? (_cell_options3 = cell.options) === null || _cell_options3 === void 0 ? void 0 : _cell_options3.colspan : undefined,
19293
- vMerge: cell._vmerge ? 1 : undefined,
19294
- hMerge: cell._hmerge ? 1 : undefined
19295
- };
19296
- let cellSpanAttrStr = Object.keys(cellSpanAttrs).map((k)=>[
19297
- k,
19298
- cellSpanAttrs[k]
19299
- ]).filter(([, v])=>!!v).map(([k, v])=>`${String(k)}="${String(v)}"`).join(' ');
19300
- if (cellSpanAttrStr) cellSpanAttrStr = ' ' + cellSpanAttrStr;
19301
- // 1: COLSPAN/ROWSPAN: Add dummy cells for any active colspan/rowspan
19302
- if (cell._hmerge || cell._vmerge) {
19303
- strXml += `<a:tc${cellSpanAttrStr}><a:tcPr/></a:tc>`;
19304
- return;
19908
+ // STEP 4: Build table rows/cells
19909
+ arrTabRows.forEach((cells, rIdx)=>{
19910
+ var _slideItemObj_options;
19911
+ const itemOpts = (_slideItemObj_options = slideItemObj.options) !== null && _slideItemObj_options !== void 0 ? _slideItemObj_options : {};
19912
+ // A: Table Height provided without rowH? Then distribute rows
19913
+ let intRowH = 0 // IMPORTANT: Default must be zero for auto-sizing to work
19914
+ ;
19915
+ if (Array.isArray(objTabOpts.rowH) && objTabOpts.rowH[rIdx]) intRowH = inch2Emu(Number(objTabOpts.rowH[rIdx]));
19916
+ else if (objTabOpts.rowH && !isNaN(Number(objTabOpts.rowH))) intRowH = inch2Emu(Number(objTabOpts.rowH));
19917
+ else if (itemOpts.cy || itemOpts.h) {
19918
+ intRowH = Math.round((itemOpts.h ? inch2Emu(itemOpts.h) : typeof itemOpts.cy === 'number' ? itemOpts.cy : 1) / arrTabRows.length);
19305
19919
  }
19306
- // 2: OPTIONS: Build/set cell options
19307
- const cellOpts = cell.options || {};
19308
- cell.options = cellOpts;
19309
- [
19310
- 'align',
19311
- 'bold',
19312
- 'border',
19313
- 'color',
19314
- 'fill',
19315
- 'fontFace',
19316
- 'fontSize',
19317
- 'margin',
19318
- 'textDirection',
19319
- 'vert',
19320
- 'underline',
19321
- 'valign'
19322
- ].forEach((name)=>{
19323
- if (objTabOpts[name] && !cellOpts[name] && cellOpts[name] !== 0) cellOpts[name] = objTabOpts[name];
19324
- });
19325
- const cellValign = cellOpts.valign ? ` anchor="${cellOpts.valign.replace(/^c$/i, 'ctr').replace(/^m$/i, 'ctr').replace('center', 'ctr').replace('middle', 'ctr').replace('top', 't').replace('btm', 'b').replace('bottom', 'b')}"` : '';
19326
- // `vert` = Martin-N alias of `textDirection`
19327
- const cellDir = cellOpts.textDirection || cellOpts.vert;
19328
- const cellTextDir = cellDir && cellDir !== 'horz' ? ` vert="${cellDir}"` : '';
19329
- let fillColor = ((_cell__optImp = cell._optImp) === null || _cell__optImp === void 0 ? void 0 : (_cell__optImp_fill = _cell__optImp.fill) === null || _cell__optImp_fill === void 0 ? void 0 : _cell__optImp_fill.color) ? cell._optImp.fill.color : ((_cell__optImp1 = cell._optImp) === null || _cell__optImp1 === void 0 ? void 0 : _cell__optImp1.fill) && typeof cell._optImp.fill === 'string' ? cell._optImp.fill : '';
19330
- fillColor = fillColor || cellOpts.fill ? cellOpts.fill : '';
19331
- const cellFill = fillColor ? genXmlColorSelection(fillColor) : '';
19332
- let cellMargin = cellOpts.margin === 0 || cellOpts.margin ? cellOpts.margin : DEF_CELL_MARGIN_IN;
19333
- if (!Array.isArray(cellMargin) && typeof cellMargin === 'number') cellMargin = [
19334
- cellMargin,
19335
- cellMargin,
19336
- cellMargin,
19337
- cellMargin
19338
- ];
19339
- // Guard against non-number/non-array margins (e.g. object/string) which otherwise yield marL="NaN" and trigger PowerPoint repair
19340
- if (!Array.isArray(cellMargin)) cellMargin = DEF_CELL_MARGIN_IN;
19341
- cellMargin = cellMargin.map((v)=>typeof v === 'number' && isFinite(v) ? v : 0);
19342
- /** FUTURE: DEPRECATED:
19343
- * - Backwards-Compat: Oops! Discovered we were still using points for cell margin before v3.8.0 (UGH!)
19344
- * - We cant introduce a breaking change before v4.0, so...
19345
- */ const cellMarginXml = cellMargin[0] >= 1 ? ` marL="${valToPts(cellMargin[3])}" marR="${valToPts(cellMargin[1])}" marT="${valToPts(cellMargin[0])}" marB="${valToPts(cellMargin[2])}"` : ` marL="${inch2Emu(cellMargin[3])}" marR="${inch2Emu(cellMargin[1])}" marT="${inch2Emu(cellMargin[0])}" marB="${inch2Emu(cellMargin[2])}"`;
19346
- // FUTURE: Cell NOWRAP property (textwrap: add to a:tcPr (horzOverflow="overflow" or whatever options exist)
19347
- // 4: Set CELL content and properties ==================================
19348
- strXml += `<a:tc${cellSpanAttrStr}>${genXmlTextBody(cell)}<a:tcPr${cellMarginXml}${cellValign}${cellTextDir}>`;
19349
- // strXml += `<a:tc${cellColspan}${cellRowspan}>${genXmlTextBody(cell)}<a:tcPr${cellMarginXml}${cellValign}${cellTextDir}>`
19350
- // FIXME: 20200525: ^^^
19351
- // <a:tcPr marL="38100" marR="38100" marT="38100" marB="38100" vert="vert270">
19352
- // 5: Borders: Add any borders
19353
- if (cellOpts.border && Array.isArray(cellOpts.border)) {
19354
- const border = cellOpts.border;
19920
+ // B: Start row
19921
+ strXml += `<a:tr h="${intRowH}">`;
19922
+ // C: Loop over each CELL
19923
+ cells.forEach((cellObj)=>{
19924
+ var _ref, _ref1;
19925
+ var _cell_options, _cell_options1, _cell_options2, _cell_options3, _cell__optImp_fill, _cell__optImp, _cell__optImp1;
19926
+ const cell = cellObj;
19927
+ const cellSpanAttrs = {
19928
+ rowSpan: ((_ref = (_cell_options = cell.options) === null || _cell_options === void 0 ? void 0 : _cell_options.rowspan) !== null && _ref !== void 0 ? _ref : 0) > 1 ? (_cell_options1 = cell.options) === null || _cell_options1 === void 0 ? void 0 : _cell_options1.rowspan : undefined,
19929
+ gridSpan: ((_ref1 = (_cell_options2 = cell.options) === null || _cell_options2 === void 0 ? void 0 : _cell_options2.colspan) !== null && _ref1 !== void 0 ? _ref1 : 0) > 1 ? (_cell_options3 = cell.options) === null || _cell_options3 === void 0 ? void 0 : _cell_options3.colspan : undefined,
19930
+ vMerge: cell._vmerge ? 1 : undefined,
19931
+ hMerge: cell._hmerge ? 1 : undefined
19932
+ };
19933
+ let cellSpanAttrStr = Object.keys(cellSpanAttrs).map((k)=>[
19934
+ k,
19935
+ cellSpanAttrs[k]
19936
+ ]).filter(([, v])=>!!v).map(([k, v])=>`${String(k)}="${String(v)}"`).join(' ');
19937
+ if (cellSpanAttrStr) cellSpanAttrStr = ' ' + cellSpanAttrStr;
19938
+ // 1: COLSPAN/ROWSPAN: Add dummy cells for any active colspan/rowspan
19939
+ if (cell._hmerge || cell._vmerge) {
19940
+ strXml += `<a:tc${cellSpanAttrStr}><a:tcPr/></a:tc>`;
19941
+ return;
19942
+ }
19943
+ // 2: OPTIONS: Build/set cell options
19944
+ const cellOpts = cell.options || {};
19945
+ cell.options = cellOpts;
19355
19946
  [
19356
- {
19357
- idx: 3,
19358
- name: 'lnL'
19359
- },
19360
- {
19361
- idx: 1,
19362
- name: 'lnR'
19363
- },
19364
- {
19365
- idx: 0,
19366
- name: 'lnT'
19367
- },
19368
- {
19369
- idx: 2,
19370
- name: 'lnB'
19371
- }
19372
- ].forEach((obj)=>{
19373
- if (border[obj.idx].type !== 'none') {
19374
- strXml += `<a:${obj.name} w="${valToPts(border[obj.idx].pt)}" cap="flat" cmpd="sng" algn="ctr">`;
19375
- strXml += `<a:solidFill>${createColorElement(border[obj.idx].color)}</a:solidFill>`;
19376
- strXml += `<a:prstDash val="${border[obj.idx].type === 'dash' ? 'sysDash' : 'solid'}"/><a:round/><a:headEnd type="none" w="med" len="med"/><a:tailEnd type="none" w="med" len="med"/>`;
19377
- strXml += `</a:${obj.name}>`;
19947
+ 'align',
19948
+ 'bold',
19949
+ 'border',
19950
+ 'color',
19951
+ 'fill',
19952
+ 'fontFace',
19953
+ 'fontSize',
19954
+ 'margin',
19955
+ 'textDirection',
19956
+ 'vert',
19957
+ 'underline',
19958
+ 'valign'
19959
+ ].forEach((name)=>{
19960
+ if (objTabOpts[name] && !cellOpts[name] && cellOpts[name] !== 0) cellOpts[name] = objTabOpts[name];
19961
+ });
19962
+ const cellValign = cellOpts.valign ? ` anchor="${cellOpts.valign.replace(/^c$/i, 'ctr').replace(/^m$/i, 'ctr').replace('center', 'ctr').replace('middle', 'ctr').replace('top', 't').replace('btm', 'b').replace('bottom', 'b')}"` : '';
19963
+ // `vert` = Martin-N alias of `textDirection`
19964
+ const cellDir = cellOpts.textDirection || cellOpts.vert;
19965
+ const cellTextDir = cellDir && cellDir !== 'horz' ? ` vert="${cellDir}"` : '';
19966
+ let fillColor = ((_cell__optImp = cell._optImp) === null || _cell__optImp === void 0 ? void 0 : (_cell__optImp_fill = _cell__optImp.fill) === null || _cell__optImp_fill === void 0 ? void 0 : _cell__optImp_fill.color) ? cell._optImp.fill.color : ((_cell__optImp1 = cell._optImp) === null || _cell__optImp1 === void 0 ? void 0 : _cell__optImp1.fill) && typeof cell._optImp.fill === 'string' ? cell._optImp.fill : '';
19967
+ fillColor = fillColor || cellOpts.fill ? cellOpts.fill : '';
19968
+ let cellFill;
19969
+ if (cellOpts._fillRid) {
19970
+ const fillRel = (slide._relsMedia || []).find((rel)=>rel.rId === cellOpts._fillRid);
19971
+ if ((fillRel === null || fillRel === void 0 ? void 0 : fillRel.extn) === 'svg') {
19972
+ var _cellOpts__fillRid;
19973
+ const pngRid = ((_cellOpts__fillRid = cellOpts._fillRid) !== null && _cellOpts__fillRid !== void 0 ? _cellOpts__fillRid : 0) - 1;
19974
+ cellFill = `<a:blipFill dpi="0" rotWithShape="1"><a:blip r:embed="rId${pngRid}"><a:extLst><a:ext uri="{96DAC541-7B7A-43D3-8B79-37D633B846F1}"><asvg:svgBlip xmlns:asvg="http://schemas.microsoft.com/office/drawing/2016/SVG/main" r:embed="rId${cellOpts._fillRid}"/></a:ext></a:extLst></a:blip><a:stretch><a:fillRect/></a:stretch></a:blipFill>`;
19378
19975
  } else {
19379
- strXml += `<a:${obj.name} w="0" cap="flat" cmpd="sng" algn="ctr"><a:noFill/></a:${obj.name}>`;
19976
+ cellFill = `<a:blipFill dpi="0" rotWithShape="1"><a:blip r:embed="rId${cellOpts._fillRid}"/><a:stretch><a:fillRect/></a:stretch></a:blipFill>`;
19380
19977
  }
19381
- });
19382
- }
19383
- // 6: Close cell Properties & Cell
19384
- strXml += cellFill;
19385
- strXml += ' </a:tcPr>';
19386
- strXml += ' </a:tc>';
19978
+ } else {
19979
+ cellFill = fillColor ? genXmlColorSelection(fillColor) : '';
19980
+ }
19981
+ let cellMargin = cellOpts.margin === 0 || cellOpts.margin ? cellOpts.margin : DEF_CELL_MARGIN_IN;
19982
+ if (!Array.isArray(cellMargin) && typeof cellMargin === 'number') cellMargin = [
19983
+ cellMargin,
19984
+ cellMargin,
19985
+ cellMargin,
19986
+ cellMargin
19987
+ ];
19988
+ // Guard against non-number/non-array margins (e.g. object/string) which otherwise yield marL="NaN" and trigger PowerPoint repair
19989
+ if (!Array.isArray(cellMargin)) cellMargin = DEF_CELL_MARGIN_IN;
19990
+ cellMargin = cellMargin.map((v)=>typeof v === 'number' && isFinite(v) ? v : 0);
19991
+ /** FUTURE: DEPRECATED:
19992
+ * - Backwards-Compat: Oops! Discovered we were still using points for cell margin before v3.8.0 (UGH!)
19993
+ * - We cant introduce a breaking change before v4.0, so...
19994
+ */ const cellMarginXml = cellMargin[0] >= 1 ? ` marL="${valToPts(cellMargin[3])}" marR="${valToPts(cellMargin[1])}" marT="${valToPts(cellMargin[0])}" marB="${valToPts(cellMargin[2])}"` : ` marL="${inch2Emu(cellMargin[3])}" marR="${inch2Emu(cellMargin[1])}" marT="${inch2Emu(cellMargin[0])}" marB="${inch2Emu(cellMargin[2])}"`;
19995
+ // FUTURE: Cell NOWRAP property (textwrap: add to a:tcPr (horzOverflow="overflow" or whatever options exist)
19996
+ // 4: Set CELL content and properties ==================================
19997
+ strXml += `<a:tc${cellSpanAttrStr}>${genXmlTextBody(cell)}<a:tcPr${cellMarginXml}${cellValign}${cellTextDir}>`;
19998
+ // strXml += `<a:tc${cellColspan}${cellRowspan}>${genXmlTextBody(cell)}<a:tcPr${cellMarginXml}${cellValign}${cellTextDir}>`
19999
+ // FIXME: 20200525: ^^^
20000
+ // <a:tcPr marL="38100" marR="38100" marT="38100" marB="38100" vert="vert270">
20001
+ // 5: Borders: Add any borders
20002
+ if (cellOpts.border && Array.isArray(cellOpts.border)) {
20003
+ const border = cellOpts.border;
20004
+ [
20005
+ {
20006
+ idx: 3,
20007
+ name: 'lnL'
20008
+ },
20009
+ {
20010
+ idx: 1,
20011
+ name: 'lnR'
20012
+ },
20013
+ {
20014
+ idx: 0,
20015
+ name: 'lnT'
20016
+ },
20017
+ {
20018
+ idx: 2,
20019
+ name: 'lnB'
20020
+ }
20021
+ ].forEach((obj)=>{
20022
+ if (border[obj.idx].type !== 'none') {
20023
+ const borderTransparency = border[obj.idx].transparency;
20024
+ const borderAlpha = typeof borderTransparency === 'number' ? `<a:alpha val="${Math.round((100 - Math.min(100, Math.max(0, borderTransparency))) * 1000)}"/>` : '';
20025
+ strXml += `<a:${obj.name} w="${valToPts(border[obj.idx].pt)}" cap="flat" cmpd="sng" algn="ctr">`;
20026
+ strXml += `<a:solidFill>${createColorElement(border[obj.idx].color, borderAlpha)}</a:solidFill>`;
20027
+ strXml += `<a:prstDash val="${border[obj.idx].type === 'dash' ? 'sysDash' : 'solid'}"/><a:round/><a:headEnd type="none" w="med" len="med"/><a:tailEnd type="none" w="med" len="med"/>`;
20028
+ strXml += `</a:${obj.name}>`;
20029
+ } else {
20030
+ strXml += `<a:${obj.name} w="0" cap="flat" cmpd="sng" algn="ctr"><a:noFill/></a:${obj.name}>`;
20031
+ }
20032
+ });
20033
+ }
20034
+ // 6: Close cell Properties & Cell
20035
+ strXml += cellFill;
20036
+ strXml += ' </a:tcPr>';
20037
+ strXml += ' </a:tc>';
20038
+ });
20039
+ // D: Complete row
20040
+ strXml += '</a:tr>';
19387
20041
  });
19388
- // D: Complete row
19389
- strXml += '</a:tr>';
19390
- });
19391
- // STEP 5: Complete table
19392
- strXml += ' </a:tbl>';
19393
- strXml += ' </a:graphicData>';
19394
- strXml += ' </a:graphic>';
19395
- strXml += '</p:graphicFrame>';
19396
- // STEP 6: Set table XML
19397
- strSlideXml += strXml;
19398
- // LAST: Increment counter
19399
- intTableNum++;
19400
- break;
19401
- }
19402
- case (/* inlined export .SLIDE_OBJECT_TYPES.text */"text"):
19403
- case (/* inlined export .SLIDE_OBJECT_TYPES.placeholder */"placeholder"):
19404
- {
19405
- var _slideItemObj_options_line1;
19406
- const isConnector = !!((_slideItemObj_options_line1 = slideItemObj.options.line) === null || _slideItemObj_options_line1 === void 0 ? void 0 : _slideItemObj_options_line1.isConnector);
19407
- // Lines can have zero cy, but text should not
19408
- if (!slideItemObj.options.line && cy === 0) cy = (/* inlined export .EMU */914400) * 0.3;
19409
- // Text margins are applied in addTextDefinition → `_bodyProp` (TRBL)
19410
- // A: Start SHAPE / CONNECTOR ============================================
19411
- if (isConnector) {
19412
- var _ref, _ref1;
19413
- var _slideItemObj_options_line2, _slideItemObj_options_line3, _slideItemObj_options_line4, _slideItemObj_options_line5;
19414
- strSlideXml += '<p:cxnSp>';
19415
- strSlideXml += `<p:nvCxnSpPr><p:cNvPr id="${shapeId}" name="${slideItemObj.options.objectName}"></p:cNvPr>`;
19416
- strSlideXml += `<p:cNvCxnSpPr><a:stCxn id="${(_slideItemObj_options_line2 = slideItemObj.options.line) === null || _slideItemObj_options_line2 === void 0 ? void 0 : _slideItemObj_options_line2.sourceId}" idx="${(_ref = (_slideItemObj_options_line3 = slideItemObj.options.line) === null || _slideItemObj_options_line3 === void 0 ? void 0 : _slideItemObj_options_line3.sourceAnchorPos) !== null && _ref !== void 0 ? _ref : 0}"/><a:endCxn id="${(_slideItemObj_options_line4 = slideItemObj.options.line) === null || _slideItemObj_options_line4 === void 0 ? void 0 : _slideItemObj_options_line4.targetId}" idx="${(_ref1 = (_slideItemObj_options_line5 = slideItemObj.options.line) === null || _slideItemObj_options_line5 === void 0 ? void 0 : _slideItemObj_options_line5.targetAnchorPos) !== null && _ref1 !== void 0 ? _ref1 : 0}"/></p:cNvCxnSpPr>`;
19417
- strSlideXml += `${genXmlNvPr(slideItemObj.options, '', [
19418
- nvPrModIdExt(slideItemObj.options.modId)
19419
- ])}</p:nvCxnSpPr><p:spPr>`;
19420
- } else {
19421
- var _slideItemObj_options_hyperlink, _slideItemObj_options_hyperlink1, _slideItemObj_options3;
19422
- strSlideXml += '<p:sp>';
19423
- // B: The addition of the "txBox" attribute is the sole determiner of if an object is a shape or textbox
19424
- strSlideXml += `<p:nvSpPr><p:cNvPr id="${shapeId}" name="${slideItemObj.options.objectName}">`;
19425
- // <Hyperlink>
19426
- if ((_slideItemObj_options_hyperlink = slideItemObj.options.hyperlink) === null || _slideItemObj_options_hyperlink === void 0 ? void 0 : _slideItemObj_options_hyperlink.url) {
19427
- strSlideXml += `<a:hlinkClick r:id="rId${slideItemObj.options.hyperlink._rId}" tooltip="${slideItemObj.options.hyperlink.tooltip ? encodeXmlEntities(slideItemObj.options.hyperlink.tooltip) : ''}"/>`;
19428
- }
19429
- if ((_slideItemObj_options_hyperlink1 = slideItemObj.options.hyperlink) === null || _slideItemObj_options_hyperlink1 === void 0 ? void 0 : _slideItemObj_options_hyperlink1.slide) {
19430
- strSlideXml += `<a:hlinkClick r:id="rId${slideItemObj.options.hyperlink._rId}" tooltip="${slideItemObj.options.hyperlink.tooltip ? encodeXmlEntities(slideItemObj.options.hyperlink.tooltip) : ''}" action="ppaction://hlinksldjump"/>`;
19431
- }
19432
- // </Hyperlink>
19433
- strSlideXml += '</p:cNvPr>';
19434
- // PowerPoint math zones are authored in text boxes; force txBox when OMML is present
19435
- const useTxBox = Boolean((_slideItemObj_options3 = slideItemObj.options) === null || _slideItemObj_options3 === void 0 ? void 0 : _slideItemObj_options3.isTextBox) || textRunsHaveOmml(slideItemObj.text);
19436
- strSlideXml += '<p:cNvSpPr' + (useTxBox ? ' txBox="1"/>' : '/>');
19437
- strSlideXml += genXmlNvPr(slideItemObj.options, slideItemObj._type === 'placeholder' ? genXmlPlaceholder(slideItemObj, slideItemObj.options) : genXmlPlaceholder(placeholderObj, slideItemObj.options), [
19438
- nvPrModIdExt(slideItemObj.options.modId)
19439
- ]);
19440
- strSlideXml += '</p:nvSpPr><p:spPr>';
20042
+ // STEP 5: Complete table
20043
+ strXml += ' </a:tbl>';
20044
+ strXml += ' </a:graphicData>';
20045
+ strXml += ' </a:graphic>';
20046
+ strXml += '</p:graphicFrame>';
20047
+ // STEP 6: Set table XML
20048
+ strSlideXml += strXml;
20049
+ // LAST: Increment counter
20050
+ intTableNum++;
20051
+ break;
19441
20052
  }
19442
- strSlideXml += `<a:xfrm${locationAttr}>`;
19443
- strSlideXml += `<a:off x="${x}" y="${y}"/>`;
19444
- strSlideXml += `<a:ext cx="${cx}" cy="${cy}"/></a:xfrm>`;
19445
- if (!isConnector && slideItemObj.shape === 'custGeom') {
19446
- var _slideItemObj_options_points;
19447
- strSlideXml += '<a:custGeom><a:avLst />';
19448
- strSlideXml += '<a:gdLst>';
19449
- strSlideXml += '</a:gdLst>';
19450
- strSlideXml += '<a:ahLst />';
19451
- strSlideXml += '<a:cxnLst>';
19452
- strSlideXml += '</a:cxnLst>';
19453
- strSlideXml += '<a:rect l="l" t="t" r="r" b="b" />';
19454
- strSlideXml += '<a:pathLst>';
19455
- strSlideXml += `<a:path w="${cx}" h="${cy}">`;
19456
- (_slideItemObj_options_points = slideItemObj.options.points) === null || _slideItemObj_options_points === void 0 ? void 0 : _slideItemObj_options_points.forEach((point, i)=>{
19457
- if ('curve' in point) {
19458
- switch(point.curve.type){
19459
- case 'arc':
19460
- strSlideXml += `<a:arcTo hR="${getSmartParseNumber(point.curve.hR, 'Y', slide._presLayout)}" wR="${getSmartParseNumber(point.curve.wR, 'X', slide._presLayout)}" stAng="${convertRotationDegrees(point.curve.stAng)}" swAng="${convertRotationDegrees(point.curve.swAng)}" />`;
19461
- break;
19462
- case 'cubic':
19463
- strSlideXml += `<a:cubicBezTo>
19464
- <a:pt x="${getSmartParseNumber(point.curve.x1, 'X', slide._presLayout)}" y="${getSmartParseNumber(point.curve.y1, 'Y', slide._presLayout)}" />
19465
- <a:pt x="${getSmartParseNumber(point.curve.x2, 'X', slide._presLayout)}" y="${getSmartParseNumber(point.curve.y2, 'Y', slide._presLayout)}" />
19466
- <a:pt x="${getSmartParseNumber(point.x, 'X', slide._presLayout)}" y="${getSmartParseNumber(point.y, 'Y', slide._presLayout)}" />
19467
- </a:cubicBezTo>`;
19468
- break;
19469
- case 'quadratic':
19470
- strSlideXml += `<a:quadBezTo>
19471
- <a:pt x="${getSmartParseNumber(point.curve.x1, 'X', slide._presLayout)}" y="${getSmartParseNumber(point.curve.y1, 'Y', slide._presLayout)}" />
19472
- <a:pt x="${getSmartParseNumber(point.x, 'X', slide._presLayout)}" y="${getSmartParseNumber(point.y, 'Y', slide._presLayout)}" />
19473
- </a:quadBezTo>`;
19474
- break;
19475
- default:
19476
- break;
20053
+ case (/* inlined export .SLIDE_OBJECT_TYPES.text */"text"):
20054
+ case (/* inlined export .SLIDE_OBJECT_TYPES.placeholder */"placeholder"):
20055
+ {
20056
+ var _slideItemObj_options_line1;
20057
+ const isConnector = !!((_slideItemObj_options_line1 = slideItemObj.options.line) === null || _slideItemObj_options_line1 === void 0 ? void 0 : _slideItemObj_options_line1.isConnector);
20058
+ // Lines can have zero cy, but text should not
20059
+ if (!slideItemObj.options.line && cy === 0) cy = (/* inlined export .EMU */914400) * 0.3;
20060
+ // Text margins are applied in addTextDefinition → `_bodyProp` (TRBL)
20061
+ // A: Start SHAPE / CONNECTOR ============================================
20062
+ if (isConnector) {
20063
+ var _ref, _ref1;
20064
+ var _slideItemObj_options_line2, _slideItemObj_options_line3, _slideItemObj_options_line4, _slideItemObj_options_line5;
20065
+ strSlideXml += '<p:cxnSp>';
20066
+ strSlideXml += `<p:nvCxnSpPr><p:cNvPr id="${shapeId}" name="${slideItemObj.options.objectName}"></p:cNvPr>`;
20067
+ strSlideXml += `<p:cNvCxnSpPr><a:stCxn id="${(_slideItemObj_options_line2 = slideItemObj.options.line) === null || _slideItemObj_options_line2 === void 0 ? void 0 : _slideItemObj_options_line2.sourceId}" idx="${(_ref = (_slideItemObj_options_line3 = slideItemObj.options.line) === null || _slideItemObj_options_line3 === void 0 ? void 0 : _slideItemObj_options_line3.sourceAnchorPos) !== null && _ref !== void 0 ? _ref : 0}"/><a:endCxn id="${(_slideItemObj_options_line4 = slideItemObj.options.line) === null || _slideItemObj_options_line4 === void 0 ? void 0 : _slideItemObj_options_line4.targetId}" idx="${(_ref1 = (_slideItemObj_options_line5 = slideItemObj.options.line) === null || _slideItemObj_options_line5 === void 0 ? void 0 : _slideItemObj_options_line5.targetAnchorPos) !== null && _ref1 !== void 0 ? _ref1 : 0}"/></p:cNvCxnSpPr>`;
20068
+ strSlideXml += `${genXmlNvPr(slideItemObj.options, '', [
20069
+ nvPrModIdExt(slideItemObj.options.modId)
20070
+ ])}</p:nvCxnSpPr><p:spPr>`;
20071
+ } else {
20072
+ var _slideItemObj_options_hyperlink, _slideItemObj_options_hyperlink1, _slideItemObj_options3;
20073
+ strSlideXml += '<p:sp>';
20074
+ // B: The addition of the "txBox" attribute is the sole determiner of if an object is a shape or textbox
20075
+ strSlideXml += `<p:nvSpPr><p:cNvPr id="${shapeId}" name="${slideItemObj.options.objectName}">`;
20076
+ // <Hyperlink>
20077
+ if ((_slideItemObj_options_hyperlink = slideItemObj.options.hyperlink) === null || _slideItemObj_options_hyperlink === void 0 ? void 0 : _slideItemObj_options_hyperlink.url) {
20078
+ strSlideXml += `<a:hlinkClick r:id="rId${slideItemObj.options.hyperlink._rId}" tooltip="${slideItemObj.options.hyperlink.tooltip ? encodeXmlEntities(slideItemObj.options.hyperlink.tooltip) : ''}"/>`;
20079
+ }
20080
+ if ((_slideItemObj_options_hyperlink1 = slideItemObj.options.hyperlink) === null || _slideItemObj_options_hyperlink1 === void 0 ? void 0 : _slideItemObj_options_hyperlink1.slide) {
20081
+ strSlideXml += `<a:hlinkClick r:id="rId${slideItemObj.options.hyperlink._rId}" tooltip="${slideItemObj.options.hyperlink.tooltip ? encodeXmlEntities(slideItemObj.options.hyperlink.tooltip) : ''}" action="ppaction://hlinksldjump"/>`;
20082
+ }
20083
+ // </Hyperlink>
20084
+ strSlideXml += '</p:cNvPr>';
20085
+ // PowerPoint math zones are authored in text boxes; force txBox when OMML is present
20086
+ const useTxBox = Boolean((_slideItemObj_options3 = slideItemObj.options) === null || _slideItemObj_options3 === void 0 ? void 0 : _slideItemObj_options3.isTextBox) || textRunsHaveOmml(slideItemObj.text);
20087
+ strSlideXml += '<p:cNvSpPr' + (useTxBox ? ' txBox="1"/>' : '/>');
20088
+ strSlideXml += genXmlNvPr(slideItemObj.options, slideItemObj._type === 'placeholder' ? genXmlPlaceholder(slideItemObj, slideItemObj.options) : genXmlPlaceholder(placeholderObj, slideItemObj.options), [
20089
+ nvPrModIdExt(slideItemObj.options.modId)
20090
+ ]);
20091
+ strSlideXml += '</p:nvSpPr><p:spPr>';
20092
+ }
20093
+ strSlideXml += `<a:xfrm${locationAttr}>`;
20094
+ strSlideXml += `<a:off x="${x}" y="${y}"/>`;
20095
+ strSlideXml += `<a:ext cx="${cx}" cy="${cy}"/></a:xfrm>`;
20096
+ if (!isConnector && slideItemObj.shape === 'custGeom') {
20097
+ strSlideXml += genCustGeomXml(slideItemObj, cx, cy, slide);
20098
+ } else {
20099
+ var _slideItemObj_options_line_curveadjust, _slideItemObj_options_line6;
20100
+ strSlideXml += '<a:prstGeom prst="' + slideItemObj.shape + '"><a:avLst>';
20101
+ // `rectRadius: 0` is a valid sharp-corner adj (ECMA-376 §5.1.11 preset geom `gd name="adj"`).
20102
+ if (typeof slideItemObj.options.rectRadius === 'number' && Number.isFinite(slideItemObj.options.rectRadius) && slideItemObj.options.rectRadius >= 0) {
20103
+ strSlideXml += `<a:gd name="adj" fmla="val ${Math.round(slideItemObj.options.rectRadius * (/* inlined export .EMU */914400) * 100000 / Math.min(cx, cy))}"/>`;
20104
+ } else if (slideItemObj.options.angleRange) {
20105
+ for(let i = 0; i < 2; i++){
20106
+ const angle = slideItemObj.options.angleRange[i];
20107
+ strSlideXml += `<a:gd name="adj${i + 1}" fmla="val ${convertRotationDegrees(angle)}" />`;
19477
20108
  }
19478
- } else if ('close' in point) {
19479
- strSlideXml += '<a:close />';
19480
- } else if (point.moveTo || i === 0) {
19481
- strSlideXml += `<a:moveTo><a:pt x="${getSmartParseNumber(point.x, 'X', slide._presLayout)}" y="${getSmartParseNumber(point.y, 'Y', slide._presLayout)}" /></a:moveTo>`;
19482
- } else {
19483
- strSlideXml += `<a:lnTo><a:pt x="${getSmartParseNumber(point.x, 'X', slide._presLayout)}" y="${getSmartParseNumber(point.y, 'Y', slide._presLayout)}" /></a:lnTo>`;
20109
+ if (slideItemObj.options.arcThicknessRatio) {
20110
+ strSlideXml += `<a:gd name="adj3" fmla="val ${Math.round(slideItemObj.options.arcThicknessRatio * 50000)}" />`;
20111
+ }
20112
+ }
20113
+ if (isConnector && ((_slideItemObj_options_line6 = slideItemObj.options.line) === null || _slideItemObj_options_line6 === void 0 ? void 0 : (_slideItemObj_options_line_curveadjust = _slideItemObj_options_line6.curveadjust) === null || _slideItemObj_options_line_curveadjust === void 0 ? void 0 : _slideItemObj_options_line_curveadjust.length)) {
20114
+ slideItemObj.options.line.curveadjust.forEach((adj, i)=>{
20115
+ strSlideXml += `<a:gd name="adj${i + 1}" fmla="val ${Math.round(Number(adj))}"/>`;
20116
+ });
19484
20117
  }
20118
+ strSlideXml += '</a:avLst></a:prstGeom>';
20119
+ }
20120
+ // Option: FILL
20121
+ strSlideXml += slideItemObj.options.fill ? genXmlColorSelection(slideItemObj.options.fill) : '<a:noFill/>';
20122
+ // shape Type: LINE: line color
20123
+ if (slideItemObj.options.line) strSlideXml += genXmlLine(slideItemObj.options.line);
20124
+ // EFFECTS: shadow / glow / softEdge / reflection
20125
+ // REF: @see http://officeopenxml.com/drwSp-effects.php
20126
+ strSlideXml += genXmlEffectLst({
20127
+ shadow: slideItemObj.options.shadow,
20128
+ glow: slideItemObj.options.glow,
20129
+ softEdge: slideItemObj.options.softEdge,
20130
+ reflection: slideItemObj.options.reflection,
20131
+ blur: slideItemObj.options.blur
19485
20132
  });
19486
- strSlideXml += '</a:path>';
19487
- strSlideXml += '</a:pathLst>';
19488
- strSlideXml += '</a:custGeom>';
20133
+ // B: Close shape Properties
20134
+ strSlideXml += '</p:spPr>';
20135
+ if (isConnector) {
20136
+ // Connectors have no text body
20137
+ strSlideXml += '</p:cxnSp>';
20138
+ } else {
20139
+ // C: Add formatted text (text body "bodyPr")
20140
+ strSlideXml += genXmlTextBody(slideItemObj);
20141
+ // LAST: Close SHAPE =======================================================
20142
+ strSlideXml += '</p:sp>';
20143
+ }
20144
+ break;
20145
+ }
20146
+ case (/* inlined export .SLIDE_OBJECT_TYPES.image */"image"):
20147
+ var _slideItemObj_hyperlink, _slideItemObj_hyperlink1;
20148
+ strSlideXml += '<p:pic>';
20149
+ strSlideXml += ' <p:nvPicPr>';
20150
+ strSlideXml += `<p:cNvPr id="${shapeId}" name="${slideItemObj.options.objectName}" descr="${encodeXmlEntities(slideItemObj.options.altText || slideItemObj.image)}">`;
20151
+ if ((_slideItemObj_hyperlink = slideItemObj.hyperlink) === null || _slideItemObj_hyperlink === void 0 ? void 0 : _slideItemObj_hyperlink.url) {
20152
+ strSlideXml += `<a:hlinkClick r:id="rId${slideItemObj.hyperlink._rId}" tooltip="${slideItemObj.hyperlink.tooltip ? encodeXmlEntities(slideItemObj.hyperlink.tooltip) : ''}"/>`;
20153
+ }
20154
+ if ((_slideItemObj_hyperlink1 = slideItemObj.hyperlink) === null || _slideItemObj_hyperlink1 === void 0 ? void 0 : _slideItemObj_hyperlink1.slide) {
20155
+ strSlideXml += `<a:hlinkClick r:id="rId${slideItemObj.hyperlink._rId}" tooltip="${slideItemObj.hyperlink.tooltip ? encodeXmlEntities(slideItemObj.hyperlink.tooltip) : ''}" action="ppaction://hlinksldjump"/>`;
20156
+ }
20157
+ strSlideXml += ' </p:cNvPr>';
20158
+ strSlideXml += ' <p:cNvPicPr><a:picLocks noChangeAspect="1"/></p:cNvPicPr>';
20159
+ strSlideXml += genXmlNvPr(slideItemObj.options, genXmlPlaceholder(placeholderObj, slideItemObj.options), [
20160
+ nvPrModIdExt(slideItemObj.options.modId)
20161
+ ]);
20162
+ strSlideXml += ' </p:nvPicPr>';
20163
+ strSlideXml += '<p:blipFill>';
20164
+ // NOTE: This works for both cases: either `path` or `data` contains the SVG
20165
+ if ((slide._relsMedia || []).filter((rel)=>rel.rId === slideItemObj.imageRid)[0] && (slide._relsMedia || []).filter((rel)=>rel.rId === slideItemObj.imageRid)[0].extn === 'svg') {
20166
+ var _slideItemObj_imageRid;
20167
+ strSlideXml += `<a:blip r:embed="rId${((_slideItemObj_imageRid = slideItemObj.imageRid) !== null && _slideItemObj_imageRid !== void 0 ? _slideItemObj_imageRid : 0) - 1}">`;
20168
+ strSlideXml += slideItemObj.options.transparency ? ` <a:alphaModFix amt="${Math.round((100 - slideItemObj.options.transparency) * 1000)}"/>` : '';
20169
+ strSlideXml += ' <a:extLst>';
20170
+ strSlideXml += ' <a:ext uri="{96DAC541-7B7A-43D3-8B79-37D633B846F1}">';
20171
+ strSlideXml += ` <asvg:svgBlip xmlns:asvg="http://schemas.microsoft.com/office/drawing/2016/SVG/main" r:embed="rId${slideItemObj.imageRid}"/>`;
20172
+ strSlideXml += ' </a:ext>';
20173
+ strSlideXml += ' </a:extLst>';
20174
+ strSlideXml += '</a:blip>';
19489
20175
  } else {
19490
- var _slideItemObj_options_line_curveadjust, _slideItemObj_options_line6;
19491
- strSlideXml += '<a:prstGeom prst="' + slideItemObj.shape + '"><a:avLst>';
19492
- if (slideItemObj.options.rectRadius) {
19493
- strSlideXml += `<a:gd name="adj" fmla="val ${Math.round(slideItemObj.options.rectRadius * (/* inlined export .EMU */914400) * 100000 / Math.min(cx, cy))}"/>`;
19494
- } else if (slideItemObj.options.angleRange) {
19495
- for(let i = 0; i < 2; i++){
19496
- const angle = slideItemObj.options.angleRange[i];
19497
- strSlideXml += `<a:gd name="adj${i + 1}" fmla="val ${convertRotationDegrees(angle)}" />`;
19498
- }
19499
- if (slideItemObj.options.arcThicknessRatio) {
19500
- strSlideXml += `<a:gd name="adj3" fmla="val ${Math.round(slideItemObj.options.arcThicknessRatio * 50000)}" />`;
19501
- }
20176
+ strSlideXml += `<a:blip r:embed="rId${slideItemObj.imageRid}">`;
20177
+ strSlideXml += slideItemObj.options.transparency ? `<a:alphaModFix amt="${Math.round((100 - slideItemObj.options.transparency) * 1000)}"/>` : '';
20178
+ strSlideXml += '</a:blip>';
20179
+ }
20180
+ if (sizing === null || sizing === void 0 ? void 0 : sizing.type) {
20181
+ const boxW = sizing.w ? getSmartParseNumber(sizing.w, 'X', slide._presLayout) : cx;
20182
+ const boxH = sizing.h ? getSmartParseNumber(sizing.h, 'Y', slide._presLayout) : cy;
20183
+ const boxX = getSmartParseNumber(sizing.x || 0, 'X', slide._presLayout);
20184
+ const boxY = getSmartParseNumber(sizing.y || 0, 'Y', slide._presLayout);
20185
+ let sourceSize = sizing.type !== 'crop' && typeof slideItemObj.options.w === 'number' && typeof slideItemObj.options.h === 'number' ? {
20186
+ w: slideItemObj.options.w,
20187
+ h: slideItemObj.options.h
20188
+ } : {
20189
+ w: imgWidth,
20190
+ h: imgHeight
20191
+ };
20192
+ // contain/cover only use imgSize as an aspect ratio. Prefer real pixel dims from the
20193
+ // blip so a square placement box does not yield an all-zero `a:srcRect` (no-op crop).
20194
+ // Crop offsets stay in placed-image EMU (ECMA-376 §5.1.10.55).
20195
+ if (sizing.type === 'contain' || sizing.type === 'cover') {
20196
+ const imgRel = (slide._relsMedia || []).find((rel)=>rel.rId === slideItemObj.imageRid);
20197
+ const pixelSize = getImagePixelSize(imgRel === null || imgRel === void 0 ? void 0 : imgRel.data);
20198
+ if (pixelSize) sourceSize = pixelSize;
19502
20199
  }
19503
- if (isConnector && ((_slideItemObj_options_line6 = slideItemObj.options.line) === null || _slideItemObj_options_line6 === void 0 ? void 0 : (_slideItemObj_options_line_curveadjust = _slideItemObj_options_line6.curveadjust) === null || _slideItemObj_options_line_curveadjust === void 0 ? void 0 : _slideItemObj_options_line_curveadjust.length)) {
19504
- slideItemObj.options.line.curveadjust.forEach((adj, i)=>{
19505
- strSlideXml += `<a:gd name="adj${i + 1}" fmla="val ${Math.round(Number(adj))}"/>`;
20200
+ if (sourceSize.w > 0 && sourceSize.h > 0) {
20201
+ strSlideXml += ImageSizingXml[sizing.type](sourceSize, {
20202
+ w: boxW,
20203
+ h: boxH,
20204
+ x: boxX,
20205
+ y: boxY
19506
20206
  });
20207
+ } else {
20208
+ strSlideXml += ' <a:stretch><a:fillRect/></a:stretch>';
20209
+ }
20210
+ // ECMA-376 §5.1.10.55: `srcRect` crops the source blip; the `<a:ext>` frame is the independent
20211
+ // on-slide bounding box. Only `cover`/`contain` resize the frame to the fitted box. For `crop`
20212
+ // the frame must keep the user's w/h container - collapsing it to the crop box (or 0) breaks
20213
+ // rendering (issue #1399).
20214
+ if (sizing.type !== 'crop') {
20215
+ imgWidth = boxW;
20216
+ imgHeight = boxH;
19507
20217
  }
19508
- strSlideXml += '</a:avLst></a:prstGeom>';
20218
+ } else {
20219
+ strSlideXml += ' <a:stretch><a:fillRect/></a:stretch>';
20220
+ }
20221
+ strSlideXml += '</p:blipFill>';
20222
+ strSlideXml += '<p:spPr>';
20223
+ strSlideXml += ' <a:xfrm' + locationAttr + '>';
20224
+ strSlideXml += ` <a:off x="${x}" y="${y}"/>`;
20225
+ strSlideXml += ` <a:ext cx="${imgWidth}" cy="${imgHeight}"/>`;
20226
+ strSlideXml += ' </a:xfrm>';
20227
+ // Geometry: rectRadius → roundRect; rounding (legacy) → ellipse; else rect
20228
+ // Selective port of niranjan-uma-shankar/feature/html-to-pptx (keeps ellipse back-compat)
20229
+ if (typeof slideItemObj.options.rectRadius === 'number' && Number.isFinite(slideItemObj.options.rectRadius) && slideItemObj.options.rectRadius >= 0) {
20230
+ const adjValue = Math.round(slideItemObj.options.rectRadius * (/* inlined export .EMU */914400) * 100000 / Math.min(imgWidth, imgHeight));
20231
+ strSlideXml += ` <a:prstGeom prst="roundRect"><a:avLst><a:gd name="adj" fmla="val ${adjValue}"/></a:avLst></a:prstGeom>`;
20232
+ } else {
20233
+ strSlideXml += ` <a:prstGeom prst="${rounding ? 'ellipse' : 'rect'}"><a:avLst/></a:prstGeom>`;
19509
20234
  }
19510
- // Option: FILL
19511
- strSlideXml += slideItemObj.options.fill ? genXmlColorSelection(slideItemObj.options.fill) : '<a:noFill/>';
19512
- // shape Type: LINE: line color
20235
+ // OUTLINE: picture border/frame (issue #35)
19513
20236
  if (slideItemObj.options.line) strSlideXml += genXmlLine(slideItemObj.options.line);
19514
20237
  // EFFECTS: shadow / glow / softEdge / reflection
19515
- // REF: @see http://officeopenxml.com/drwSp-effects.php
19516
20238
  strSlideXml += genXmlEffectLst({
19517
20239
  shadow: slideItemObj.options.shadow,
19518
20240
  glow: slideItemObj.options.glow,
19519
20241
  softEdge: slideItemObj.options.softEdge,
19520
- reflection: slideItemObj.options.reflection
20242
+ reflection: slideItemObj.options.reflection,
20243
+ blur: slideItemObj.options.blur
19521
20244
  });
19522
- // B: Close shape Properties
19523
20245
  strSlideXml += '</p:spPr>';
19524
- if (isConnector) {
19525
- // Connectors have no text body
19526
- strSlideXml += '</p:cxnSp>';
20246
+ strSlideXml += '</p:pic>';
20247
+ break;
20248
+ case (/* inlined export .SLIDE_OBJECT_TYPES.media */"media"):
20249
+ if (slideItemObj.mtype === 'online') {
20250
+ var _slideItemObj_mediaRid, _slideItemObj_mediaRid1;
20251
+ strSlideXml += '<p:pic>';
20252
+ strSlideXml += ' <p:nvPicPr>';
20253
+ // IMPORTANT: <p:cNvPr id="" value is critical - if its not the same number as preview image `rId`, PowerPoint throws error!
20254
+ strSlideXml += `<p:cNvPr id="${((_slideItemObj_mediaRid = slideItemObj.mediaRid) !== null && _slideItemObj_mediaRid !== void 0 ? _slideItemObj_mediaRid : 0) + 2}" name="${slideItemObj.options.objectName}"/>`;
20255
+ strSlideXml += ' <p:cNvPicPr/>';
20256
+ strSlideXml += genXmlNvPr(slideItemObj.options, `<a:videoFile r:link="rId${slideItemObj.mediaRid}"/>`);
20257
+ strSlideXml += ' </p:nvPicPr>';
20258
+ // NOTE: `blip` is diferent than videos; also there's no preview "p:extLst" above but exists in videos
20259
+ strSlideXml += ` <p:blipFill><a:blip r:embed="rId${((_slideItemObj_mediaRid1 = slideItemObj.mediaRid) !== null && _slideItemObj_mediaRid1 !== void 0 ? _slideItemObj_mediaRid1 : 0) + 1}"/><a:stretch><a:fillRect/></a:stretch></p:blipFill>`; // NOTE: Preview image is required!
20260
+ strSlideXml += ' <p:spPr>';
20261
+ strSlideXml += ` <a:xfrm${locationAttr}><a:off x="${x}" y="${y}"/><a:ext cx="${cx}" cy="${cy}"/></a:xfrm>`;
20262
+ strSlideXml += ' <a:prstGeom prst="rect"><a:avLst/></a:prstGeom>';
20263
+ strSlideXml += ' </p:spPr>';
20264
+ strSlideXml += '</p:pic>';
19527
20265
  } else {
19528
- // C: Add formatted text (text body "bodyPr")
19529
- strSlideXml += genXmlTextBody(slideItemObj);
19530
- // LAST: Close SHAPE =======================================================
19531
- strSlideXml += '</p:sp>';
20266
+ var _slideItemObj_mediaRid2, _slideItemObj_mediaRid3, _slideItemObj_mediaRid4, _slideItemObj_mediaRid5;
20267
+ // ECMA-376: audio uses `<a:audioFile>`, video uses `<a:videoFile>` under nvPr.
20268
+ const mediaFileTag = slideItemObj.mtype === 'audio' ? 'a:audioFile' : 'a:videoFile';
20269
+ strSlideXml += '<p:pic>';
20270
+ strSlideXml += ' <p:nvPicPr>';
20271
+ // IMPORTANT: <p:cNvPr id="" value is critical - if not the same number as preiew image rId, PowerPoint throws error!
20272
+ strSlideXml += `<p:cNvPr id="${((_slideItemObj_mediaRid2 = slideItemObj.mediaRid) !== null && _slideItemObj_mediaRid2 !== void 0 ? _slideItemObj_mediaRid2 : 0) + 2}" name="${slideItemObj.options.objectName}"><a:hlinkClick r:id="" action="ppaction://media"/></p:cNvPr>`;
20273
+ strSlideXml += ' <p:cNvPicPr><a:picLocks noChangeAspect="1"/></p:cNvPicPr>';
20274
+ const mediaExtras = genXmlMediaExtras(slideItemObj.options);
20275
+ const mediaExt = '<p:ext uri="{DAA4B4D4-6D71-4841-9C94-3DE7FCFB9230}">' + (mediaExtras ? ` <p14:media xmlns:p14="http://schemas.microsoft.com/office/powerpoint/2010/main" r:embed="rId${((_slideItemObj_mediaRid3 = slideItemObj.mediaRid) !== null && _slideItemObj_mediaRid3 !== void 0 ? _slideItemObj_mediaRid3 : 0) + 1}">${mediaExtras} </p14:media>` : ` <p14:media xmlns:p14="http://schemas.microsoft.com/office/powerpoint/2010/main" r:embed="rId${((_slideItemObj_mediaRid4 = slideItemObj.mediaRid) !== null && _slideItemObj_mediaRid4 !== void 0 ? _slideItemObj_mediaRid4 : 0) + 1}"/>`) + '</p:ext>';
20276
+ const narrationExt = slideItemObj.options.isNarration ? '<p:ext uri="{42D2F446-02D8-4167-A562-619A0277C38B}"><p15:isNarration xmlns:p15="http://schemas.microsoft.com/office/powerpoint/2012/main" val="1"/></p:ext>' : '';
20277
+ strSlideXml += genXmlNvPr(slideItemObj.options, `<${mediaFileTag} r:link="rId${slideItemObj.mediaRid}"/>`, narrationExt ? [
20278
+ mediaExt,
20279
+ narrationExt
20280
+ ] : [
20281
+ mediaExt
20282
+ ]);
20283
+ strSlideXml += ' </p:nvPicPr>';
20284
+ strSlideXml += ` <p:blipFill><a:blip r:embed="rId${((_slideItemObj_mediaRid5 = slideItemObj.mediaRid) !== null && _slideItemObj_mediaRid5 !== void 0 ? _slideItemObj_mediaRid5 : 0) + 2}"/><a:stretch><a:fillRect/></a:stretch></p:blipFill>`; // NOTE: Preview image is required!
20285
+ strSlideXml += ' <p:spPr>';
20286
+ strSlideXml += ` <a:xfrm${locationAttr}><a:off x="${x}" y="${y}"/><a:ext cx="${cx}" cy="${cy}"/></a:xfrm>`;
20287
+ strSlideXml += ' <a:prstGeom prst="rect"><a:avLst/></a:prstGeom>';
20288
+ strSlideXml += ' </p:spPr>';
20289
+ strSlideXml += '</p:pic>';
19532
20290
  }
19533
20291
  break;
19534
- }
19535
- case (/* inlined export .SLIDE_OBJECT_TYPES.image */"image"):
19536
- var _slideItemObj_hyperlink, _slideItemObj_hyperlink1;
19537
- strSlideXml += '<p:pic>';
19538
- strSlideXml += ' <p:nvPicPr>';
19539
- strSlideXml += `<p:cNvPr id="${shapeId}" name="${slideItemObj.options.objectName}" descr="${encodeXmlEntities(slideItemObj.options.altText || slideItemObj.image)}">`;
19540
- if ((_slideItemObj_hyperlink = slideItemObj.hyperlink) === null || _slideItemObj_hyperlink === void 0 ? void 0 : _slideItemObj_hyperlink.url) {
19541
- strSlideXml += `<a:hlinkClick r:id="rId${slideItemObj.hyperlink._rId}" tooltip="${slideItemObj.hyperlink.tooltip ? encodeXmlEntities(slideItemObj.hyperlink.tooltip) : ''}"/>`;
19542
- }
19543
- if ((_slideItemObj_hyperlink1 = slideItemObj.hyperlink) === null || _slideItemObj_hyperlink1 === void 0 ? void 0 : _slideItemObj_hyperlink1.slide) {
19544
- strSlideXml += `<a:hlinkClick r:id="rId${slideItemObj.hyperlink._rId}" tooltip="${slideItemObj.hyperlink.tooltip ? encodeXmlEntities(slideItemObj.hyperlink.tooltip) : ''}" action="ppaction://hlinksldjump"/>`;
19545
- }
19546
- strSlideXml += ' </p:cNvPr>';
19547
- strSlideXml += ' <p:cNvPicPr><a:picLocks noChangeAspect="1"/></p:cNvPicPr>';
19548
- strSlideXml += genXmlNvPr(slideItemObj.options, genXmlPlaceholder(placeholderObj, slideItemObj.options), [
19549
- nvPrModIdExt(slideItemObj.options.modId)
19550
- ]);
19551
- strSlideXml += ' </p:nvPicPr>';
19552
- strSlideXml += '<p:blipFill>';
19553
- // NOTE: This works for both cases: either `path` or `data` contains the SVG
19554
- if ((slide._relsMedia || []).filter((rel)=>rel.rId === slideItemObj.imageRid)[0] && (slide._relsMedia || []).filter((rel)=>rel.rId === slideItemObj.imageRid)[0].extn === 'svg') {
19555
- var _slideItemObj_imageRid;
19556
- strSlideXml += `<a:blip r:embed="rId${((_slideItemObj_imageRid = slideItemObj.imageRid) !== null && _slideItemObj_imageRid !== void 0 ? _slideItemObj_imageRid : 0) - 1}">`;
19557
- strSlideXml += slideItemObj.options.transparency ? ` <a:alphaModFix amt="${Math.round((100 - slideItemObj.options.transparency) * 1000)}"/>` : '';
19558
- strSlideXml += ' <a:extLst>';
19559
- strSlideXml += ' <a:ext uri="{96DAC541-7B7A-43D3-8B79-37D633B846F1}">';
19560
- strSlideXml += ` <asvg:svgBlip xmlns:asvg="http://schemas.microsoft.com/office/drawing/2016/SVG/main" r:embed="rId${slideItemObj.imageRid}"/>`;
19561
- strSlideXml += ' </a:ext>';
19562
- strSlideXml += ' </a:extLst>';
19563
- strSlideXml += '</a:blip>';
19564
- } else {
19565
- strSlideXml += `<a:blip r:embed="rId${slideItemObj.imageRid}">`;
19566
- strSlideXml += slideItemObj.options.transparency ? `<a:alphaModFix amt="${Math.round((100 - slideItemObj.options.transparency) * 1000)}"/>` : '';
19567
- strSlideXml += '</a:blip>';
19568
- }
19569
- if (sizing === null || sizing === void 0 ? void 0 : sizing.type) {
19570
- const boxW = sizing.w ? getSmartParseNumber(sizing.w, 'X', slide._presLayout) : cx;
19571
- const boxH = sizing.h ? getSmartParseNumber(sizing.h, 'Y', slide._presLayout) : cy;
19572
- const boxX = getSmartParseNumber(sizing.x || 0, 'X', slide._presLayout);
19573
- const boxY = getSmartParseNumber(sizing.y || 0, 'Y', slide._presLayout);
19574
- const sourceSize = sizing.type !== 'crop' && typeof slideItemObj.options.w === 'number' && typeof slideItemObj.options.h === 'number' ? {
19575
- w: slideItemObj.options.w,
19576
- h: slideItemObj.options.h
19577
- } : {
19578
- w: imgWidth,
19579
- h: imgHeight
19580
- };
19581
- strSlideXml += ImageSizingXml[sizing.type](sourceSize, {
19582
- w: boxW,
19583
- h: boxH,
19584
- x: boxX,
19585
- y: boxY
19586
- });
19587
- // ECMA-376 §5.1.10.55: `srcRect` crops the source blip; the `<a:ext>` frame is the independent
19588
- // on-slide bounding box. Only `cover`/`contain` resize the frame to the fitted box. For `crop`
19589
- // the frame must keep the user's w/h container - collapsing it to the crop box (or 0) breaks
19590
- // rendering (issue #1399).
19591
- if (sizing.type !== 'crop') {
19592
- imgWidth = boxW;
19593
- imgHeight = boxH;
20292
+ case (/* inlined export .SLIDE_OBJECT_TYPES.zoom */"zoom"):
20293
+ {
20294
+ var _slideItemObj_zoomKind, _slideItemObj_zoomRid;
20295
+ // MS-PPTX §2.2.15: mc:AlternateContent { Choice p16:{sldZm|sectionZm|summaryZm} | Fallback }.
20296
+ const zOpts = slideItemObj.options;
20297
+ const zKind = (_slideItemObj_zoomKind = slideItemObj.zoomKind) !== null && _slideItemObj_zoomKind !== void 0 ? _slideItemObj_zoomKind : 'slide';
20298
+ const zRid = (_slideItemObj_zoomRid = slideItemObj.zoomRid) !== null && _slideItemObj_zoomRid !== void 0 ? _slideItemObj_zoomRid : 0;
20299
+ const zId = getUuid('{xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx}');
20300
+ const zRet = zOpts.returnToParent === false ? '0' : '1';
20301
+ const zShowBg = zOpts.showBg === false ? '0' : '1';
20302
+ const zDur = typeof zOpts.transitionDur === 'number' ? ` p14:transitionDur="${Math.round(zOpts.transitionDur)}"` : '';
20303
+ const zGeom = `<a:xfrm${locationAttr}><a:off x="${x}" y="${y}"/><a:ext cx="${cx}" cy="${cy}"/></a:xfrm><a:prstGeom prst="rect"><a:avLst/></a:prstGeom>`;
20304
+ const zFill = `<p:blipFill><a:blip r:embed="rId${zRid}"/><a:stretch><a:fillRect/></a:stretch></p:blipFill>`;
20305
+ const zmPr = `<p166:zmPr id="${zId}" returnToParent="${zRet}" showBg="${zShowBg}" imageType="preview"${zDur}>${zFill}<p:spPr>${zGeom}</p:spPr></p166:zmPr>`;
20306
+ const nsMap = {
20307
+ slide: 'http://schemas.microsoft.com/office/powerpoint/2016/slidezoom',
20308
+ section: 'http://schemas.microsoft.com/office/powerpoint/2016/sectionzoom',
20309
+ summary: 'http://schemas.microsoft.com/office/powerpoint/2016/summaryzoom'
20310
+ };
20311
+ const zNs = nsMap[zKind];
20312
+ strSlideXml += '<mc:AlternateContent xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006">';
20313
+ strSlideXml += `<mc:Choice Requires="p16" xmlns:p16="${zNs}" xmlns:p166="http://schemas.microsoft.com/office/powerpoint/2016/6/main" xmlns:p14="http://schemas.microsoft.com/office/powerpoint/2010/main">`;
20314
+ if (zKind === 'slide') {
20315
+ var _slideItemObj_zoomSlideNum;
20316
+ const zSldId = 255 + ((_slideItemObj_zoomSlideNum = slideItemObj.zoomSlideNum) !== null && _slideItemObj_zoomSlideNum !== void 0 ? _slideItemObj_zoomSlideNum : 1);
20317
+ strSlideXml += `<p16:sldZm><p16:sldZmObj sldId="${zSldId}">${zmPr}</p16:sldZmObj></p16:sldZm>`;
20318
+ } else if (zKind === 'section') {
20319
+ strSlideXml += `<p16:sectionZm><p16:sectionZmObj sectionId="${slideItemObj.zoomSectionId}">${zmPr}</p16:sectionZmObj></p16:sectionZm>`;
20320
+ } else {
20321
+ // §2.11 CT_SummaryZoom: summaryZmObj(s) + required layout choice (gridLayout/fixedLayout).
20322
+ const szTitle = zOpts.zoomTitle ? ` title="${encodeXmlEntities(zOpts.zoomTitle)}"` : '';
20323
+ const szDescr = zOpts.zoomDescr ? ` descr="${encodeXmlEntities(zOpts.zoomDescr)}"` : '';
20324
+ const szOff = (typeof zOpts.offsetFactorX === 'number' ? ` offsetFactorX="${Math.round(zOpts.offsetFactorX)}"` : '') + (typeof zOpts.offsetFactorY === 'number' ? ` offsetFactorY="${Math.round(zOpts.offsetFactorY)}"` : '');
20325
+ const szScale = (typeof zOpts.scaleFactorX === 'number' ? ` scaleFactorX="${Math.round(zOpts.scaleFactorX)}"` : '') + (typeof zOpts.scaleFactorY === 'number' ? ` scaleFactorY="${Math.round(zOpts.scaleFactorY)}"` : '');
20326
+ strSlideXml += `<p16:summaryZm><p16:summaryZmObj sectionId="${slideItemObj.zoomSectionId}"${szTitle}${szDescr}${szOff}${szScale}>${zmPr}</p16:summaryZmObj><p16:gridLayout/></p16:summaryZm>`;
20327
+ }
20328
+ strSlideXml += '</mc:Choice>';
20329
+ // Fallback for older readers: pic for slide/section zoom; grpSp for summary zoom (§2.2.15).
20330
+ if (zKind === 'summary') {
20331
+ strSlideXml += `<mc:Fallback><p:grpSp><p:nvGrpSpPr><p:cNvPr id="${shapeId}" name="${zOpts.objectName}"/><p:cNvGrpSpPr/><p:nvPr/></p:nvGrpSpPr><p:grpSpPr><a:xfrm><a:off x="${x}" y="${y}"/><a:ext cx="${cx}" cy="${cy}"/><a:chOff x="0" y="0"/><a:chExt cx="0" cy="0"/></a:xfrm></p:grpSpPr></p:grpSp></mc:Fallback>`;
20332
+ } else {
20333
+ strSlideXml += '<mc:Fallback><p:pic><p:nvPicPr>';
20334
+ strSlideXml += `<p:cNvPr id="${shapeId}" name="${zOpts.objectName}" descr="${encodeXmlEntities(zOpts.altText || '')}"/>`;
20335
+ strSlideXml += '<p:cNvPicPr><a:picLocks noChangeAspect="1"/></p:cNvPicPr><p:nvPr/></p:nvPicPr>';
20336
+ strSlideXml += zFill;
20337
+ strSlideXml += `<p:spPr>${zGeom}</p:spPr></p:pic></mc:Fallback>`;
20338
+ }
20339
+ strSlideXml += '</mc:AlternateContent>';
20340
+ break;
19594
20341
  }
19595
- } else {
19596
- strSlideXml += ' <a:stretch><a:fillRect/></a:stretch>';
19597
- }
19598
- strSlideXml += '</p:blipFill>';
19599
- strSlideXml += '<p:spPr>';
19600
- strSlideXml += ' <a:xfrm' + locationAttr + '>';
19601
- strSlideXml += ` <a:off x="${x}" y="${y}"/>`;
19602
- strSlideXml += ` <a:ext cx="${imgWidth}" cy="${imgHeight}"/>`;
19603
- strSlideXml += ' </a:xfrm>';
19604
- // Geometry: rectRadius → roundRect; rounding (legacy) → ellipse; else rect
19605
- // Selective port of niranjan-uma-shankar/feature/html-to-pptx (keeps ellipse back-compat)
19606
- if (typeof slideItemObj.options.rectRadius === 'number') {
19607
- const adjValue = Math.round(slideItemObj.options.rectRadius * (/* inlined export .EMU */914400) * 100000 / Math.min(imgWidth, imgHeight));
19608
- strSlideXml += ` <a:prstGeom prst="roundRect"><a:avLst><a:gd name="adj" fmla="val ${adjValue}"/></a:avLst></a:prstGeom>`;
19609
- } else {
19610
- strSlideXml += ` <a:prstGeom prst="${rounding ? 'ellipse' : 'rect'}"><a:avLst/></a:prstGeom>`;
19611
- }
19612
- // OUTLINE: picture border/frame (issue #35)
19613
- if (slideItemObj.options.line) strSlideXml += genXmlLine(slideItemObj.options.line);
19614
- // EFFECTS: shadow / glow / softEdge / reflection
19615
- strSlideXml += genXmlEffectLst({
19616
- shadow: slideItemObj.options.shadow,
19617
- glow: slideItemObj.options.glow,
19618
- softEdge: slideItemObj.options.softEdge,
19619
- reflection: slideItemObj.options.reflection
19620
- });
19621
- strSlideXml += '</p:spPr>';
19622
- strSlideXml += '</p:pic>';
19623
- break;
19624
- case (/* inlined export .SLIDE_OBJECT_TYPES.media */"media"):
19625
- if (slideItemObj.mtype === 'online') {
19626
- var _slideItemObj_mediaRid, _slideItemObj_mediaRid1;
19627
- strSlideXml += '<p:pic>';
19628
- strSlideXml += ' <p:nvPicPr>';
19629
- // IMPORTANT: <p:cNvPr id="" value is critical - if its not the same number as preview image `rId`, PowerPoint throws error!
19630
- strSlideXml += `<p:cNvPr id="${((_slideItemObj_mediaRid = slideItemObj.mediaRid) !== null && _slideItemObj_mediaRid !== void 0 ? _slideItemObj_mediaRid : 0) + 2}" name="${slideItemObj.options.objectName}"/>`;
19631
- strSlideXml += ' <p:cNvPicPr/>';
19632
- strSlideXml += genXmlNvPr(slideItemObj.options, `<a:videoFile r:link="rId${slideItemObj.mediaRid}"/>`);
19633
- strSlideXml += ' </p:nvPicPr>';
19634
- // NOTE: `blip` is diferent than videos; also there's no preview "p:extLst" above but exists in videos
19635
- strSlideXml += ` <p:blipFill><a:blip r:embed="rId${((_slideItemObj_mediaRid1 = slideItemObj.mediaRid) !== null && _slideItemObj_mediaRid1 !== void 0 ? _slideItemObj_mediaRid1 : 0) + 1}"/><a:stretch><a:fillRect/></a:stretch></p:blipFill>`; // NOTE: Preview image is required!
19636
- strSlideXml += ' <p:spPr>';
19637
- strSlideXml += ` <a:xfrm${locationAttr}><a:off x="${x}" y="${y}"/><a:ext cx="${cx}" cy="${cy}"/></a:xfrm>`;
19638
- strSlideXml += ' <a:prstGeom prst="rect"><a:avLst/></a:prstGeom>';
19639
- strSlideXml += ' </p:spPr>';
19640
- strSlideXml += '</p:pic>';
19641
- } else {
19642
- var _slideItemObj_mediaRid2, _slideItemObj_mediaRid3, _slideItemObj_mediaRid4, _slideItemObj_mediaRid5;
19643
- // ECMA-376: audio uses `<a:audioFile>`, video uses `<a:videoFile>` under nvPr.
19644
- const mediaFileTag = slideItemObj.mtype === 'audio' ? 'a:audioFile' : 'a:videoFile';
19645
- strSlideXml += '<p:pic>';
19646
- strSlideXml += ' <p:nvPicPr>';
19647
- // IMPORTANT: <p:cNvPr id="" value is critical - if not the same number as preiew image rId, PowerPoint throws error!
19648
- strSlideXml += `<p:cNvPr id="${((_slideItemObj_mediaRid2 = slideItemObj.mediaRid) !== null && _slideItemObj_mediaRid2 !== void 0 ? _slideItemObj_mediaRid2 : 0) + 2}" name="${slideItemObj.options.objectName}"><a:hlinkClick r:id="" action="ppaction://media"/></p:cNvPr>`;
19649
- strSlideXml += ' <p:cNvPicPr><a:picLocks noChangeAspect="1"/></p:cNvPicPr>';
19650
- const mediaExtras = genXmlMediaExtras(slideItemObj.options);
19651
- const mediaExt = '<p:ext uri="{DAA4B4D4-6D71-4841-9C94-3DE7FCFB9230}">' + (mediaExtras ? ` <p14:media xmlns:p14="http://schemas.microsoft.com/office/powerpoint/2010/main" r:embed="rId${((_slideItemObj_mediaRid3 = slideItemObj.mediaRid) !== null && _slideItemObj_mediaRid3 !== void 0 ? _slideItemObj_mediaRid3 : 0) + 1}">${mediaExtras} </p14:media>` : ` <p14:media xmlns:p14="http://schemas.microsoft.com/office/powerpoint/2010/main" r:embed="rId${((_slideItemObj_mediaRid4 = slideItemObj.mediaRid) !== null && _slideItemObj_mediaRid4 !== void 0 ? _slideItemObj_mediaRid4 : 0) + 1}"/>`) + '</p:ext>';
19652
- const narrationExt = slideItemObj.options.isNarration ? '<p:ext uri="{42D2F446-02D8-4167-A562-619A0277C38B}"><p15:isNarration xmlns:p15="http://schemas.microsoft.com/office/powerpoint/2012/main" val="1"/></p:ext>' : '';
19653
- strSlideXml += genXmlNvPr(slideItemObj.options, `<${mediaFileTag} r:link="rId${slideItemObj.mediaRid}"/>`, narrationExt ? [
19654
- mediaExt,
19655
- narrationExt
19656
- ] : [
19657
- mediaExt
19658
- ]);
19659
- strSlideXml += ' </p:nvPicPr>';
19660
- strSlideXml += ` <p:blipFill><a:blip r:embed="rId${((_slideItemObj_mediaRid5 = slideItemObj.mediaRid) !== null && _slideItemObj_mediaRid5 !== void 0 ? _slideItemObj_mediaRid5 : 0) + 2}"/><a:stretch><a:fillRect/></a:stretch></p:blipFill>`; // NOTE: Preview image is required!
19661
- strSlideXml += ' <p:spPr>';
19662
- strSlideXml += ` <a:xfrm${locationAttr}><a:off x="${x}" y="${y}"/><a:ext cx="${cx}" cy="${cy}"/></a:xfrm>`;
19663
- strSlideXml += ' <a:prstGeom prst="rect"><a:avLst/></a:prstGeom>';
19664
- strSlideXml += ' </p:spPr>';
19665
- strSlideXml += '</p:pic>';
19666
- }
19667
- break;
19668
- case (/* inlined export .SLIDE_OBJECT_TYPES.zoom */"zoom"):
19669
- {
19670
- var _slideItemObj_zoomKind, _slideItemObj_zoomRid;
19671
- // MS-PPTX §2.2.15: mc:AlternateContent { Choice p16:{sldZm|sectionZm|summaryZm} | Fallback }.
19672
- const zOpts = slideItemObj.options;
19673
- const zKind = (_slideItemObj_zoomKind = slideItemObj.zoomKind) !== null && _slideItemObj_zoomKind !== void 0 ? _slideItemObj_zoomKind : 'slide';
19674
- const zRid = (_slideItemObj_zoomRid = slideItemObj.zoomRid) !== null && _slideItemObj_zoomRid !== void 0 ? _slideItemObj_zoomRid : 0;
19675
- const zId = getUuid('{xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx}');
19676
- const zRet = zOpts.returnToParent === false ? '0' : '1';
19677
- const zShowBg = zOpts.showBg === false ? '0' : '1';
19678
- const zDur = typeof zOpts.transitionDur === 'number' ? ` p14:transitionDur="${Math.round(zOpts.transitionDur)}"` : '';
19679
- const zGeom = `<a:xfrm${locationAttr}><a:off x="${x}" y="${y}"/><a:ext cx="${cx}" cy="${cy}"/></a:xfrm><a:prstGeom prst="rect"><a:avLst/></a:prstGeom>`;
19680
- const zFill = `<p:blipFill><a:blip r:embed="rId${zRid}"/><a:stretch><a:fillRect/></a:stretch></p:blipFill>`;
19681
- const zmPr = `<p166:zmPr id="${zId}" returnToParent="${zRet}" showBg="${zShowBg}" imageType="preview"${zDur}>${zFill}<p:spPr>${zGeom}</p:spPr></p166:zmPr>`;
19682
- const nsMap = {
19683
- slide: 'http://schemas.microsoft.com/office/powerpoint/2016/slidezoom',
19684
- section: 'http://schemas.microsoft.com/office/powerpoint/2016/sectionzoom',
19685
- summary: 'http://schemas.microsoft.com/office/powerpoint/2016/summaryzoom'
19686
- };
19687
- const zNs = nsMap[zKind];
19688
- strSlideXml += '<mc:AlternateContent xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006">';
19689
- strSlideXml += `<mc:Choice Requires="p16" xmlns:p16="${zNs}" xmlns:p166="http://schemas.microsoft.com/office/powerpoint/2016/6/main" xmlns:p14="http://schemas.microsoft.com/office/powerpoint/2010/main">`;
19690
- if (zKind === 'slide') {
19691
- var _slideItemObj_zoomSlideNum;
19692
- const zSldId = 255 + ((_slideItemObj_zoomSlideNum = slideItemObj.zoomSlideNum) !== null && _slideItemObj_zoomSlideNum !== void 0 ? _slideItemObj_zoomSlideNum : 1);
19693
- strSlideXml += `<p16:sldZm><p16:sldZmObj sldId="${zSldId}">${zmPr}</p16:sldZmObj></p16:sldZm>`;
19694
- } else if (zKind === 'section') {
19695
- strSlideXml += `<p16:sectionZm><p16:sectionZmObj sectionId="${slideItemObj.zoomSectionId}">${zmPr}</p16:sectionZmObj></p16:sectionZm>`;
19696
- } else {
19697
- // §2.11 CT_SummaryZoom: summaryZmObj(s) + required layout choice (gridLayout/fixedLayout).
19698
- const szTitle = zOpts.zoomTitle ? ` title="${encodeXmlEntities(zOpts.zoomTitle)}"` : '';
19699
- const szDescr = zOpts.zoomDescr ? ` descr="${encodeXmlEntities(zOpts.zoomDescr)}"` : '';
19700
- const szOff = (typeof zOpts.offsetFactorX === 'number' ? ` offsetFactorX="${Math.round(zOpts.offsetFactorX)}"` : '') + (typeof zOpts.offsetFactorY === 'number' ? ` offsetFactorY="${Math.round(zOpts.offsetFactorY)}"` : '');
19701
- const szScale = (typeof zOpts.scaleFactorX === 'number' ? ` scaleFactorX="${Math.round(zOpts.scaleFactorX)}"` : '') + (typeof zOpts.scaleFactorY === 'number' ? ` scaleFactorY="${Math.round(zOpts.scaleFactorY)}"` : '');
19702
- strSlideXml += `<p16:summaryZm><p16:summaryZmObj sectionId="${slideItemObj.zoomSectionId}"${szTitle}${szDescr}${szOff}${szScale}>${zmPr}</p16:summaryZmObj><p16:gridLayout/></p16:summaryZm>`;
20342
+ case (/* inlined export .SLIDE_OBJECT_TYPES.contentPart */"contentPart"):
20343
+ {
20344
+ var _slideItemObj_contentPartRid;
20345
+ // MS-PPTX §2.2.3 / §2.2.3.1: mc:AlternateContent { Choice contentPart | Fallback sp|pic }.
20346
+ const cpKind = slideItemObj.contentPartKind === 'ink' ? 'ink' : 'content';
20347
+ strSlideXml += genXmlContentPartAlternate({
20348
+ kind: cpKind,
20349
+ rId: (_slideItemObj_contentPartRid = slideItemObj.contentPartRid) !== null && _slideItemObj_contentPartRid !== void 0 ? _slideItemObj_contentPartRid : 0,
20350
+ shapeId,
20351
+ name: slideItemObj.options.objectName || (cpKind === 'ink' ? 'Ink 1' : 'Content Part 1'),
20352
+ altText: slideItemObj.options.altText || '',
20353
+ x,
20354
+ y,
20355
+ cx,
20356
+ cy,
20357
+ locationAttr,
20358
+ bwMode: slideItemObj.contentPartBwMode,
20359
+ coverRid: slideItemObj.coverRid
20360
+ });
20361
+ break;
19703
20362
  }
19704
- strSlideXml += '</mc:Choice>';
19705
- // Fallback for older readers: pic for slide/section zoom; grpSp for summary zoom (§2.2.15).
19706
- if (zKind === 'summary') {
19707
- strSlideXml += `<mc:Fallback><p:grpSp><p:nvGrpSpPr><p:cNvPr id="${shapeId}" name="${zOpts.objectName}"/><p:cNvGrpSpPr/><p:nvPr/></p:nvGrpSpPr><p:grpSpPr><a:xfrm><a:off x="${x}" y="${y}"/><a:ext cx="${cx}" cy="${cy}"/><a:chOff x="0" y="0"/><a:chExt cx="0" cy="0"/></a:xfrm></p:grpSpPr></p:grpSp></mc:Fallback>`;
19708
- } else {
19709
- strSlideXml += '<mc:Fallback><p:pic><p:nvPicPr>';
19710
- strSlideXml += `<p:cNvPr id="${shapeId}" name="${zOpts.objectName}" descr="${encodeXmlEntities(zOpts.altText || '')}"/>`;
19711
- strSlideXml += '<p:cNvPicPr><a:picLocks noChangeAspect="1"/></p:cNvPicPr><p:nvPr/></p:nvPicPr>';
19712
- strSlideXml += zFill;
19713
- strSlideXml += `<p:spPr>${zGeom}</p:spPr></p:pic></mc:Fallback>`;
20363
+ case (/* inlined export .SLIDE_OBJECT_TYPES.officeApp */"officeApp"):
20364
+ {
20365
+ var _slideItemObj_contentPartRid1, _slideItemObj_coverRid;
20366
+ // MS-PPTX §2.2.13: mc:AlternateContent { Choice we:webextensionref | Fallback pic }.
20367
+ strSlideXml += genXmlOfficeAppAlternate({
20368
+ rId: (_slideItemObj_contentPartRid1 = slideItemObj.contentPartRid) !== null && _slideItemObj_contentPartRid1 !== void 0 ? _slideItemObj_contentPartRid1 : 0,
20369
+ shapeId,
20370
+ name: slideItemObj.options.objectName || 'Office App 1',
20371
+ altText: slideItemObj.options.altText || '',
20372
+ x,
20373
+ y,
20374
+ cx,
20375
+ cy,
20376
+ locationAttr,
20377
+ coverRid: (_slideItemObj_coverRid = slideItemObj.coverRid) !== null && _slideItemObj_coverRid !== void 0 ? _slideItemObj_coverRid : 0
20378
+ });
20379
+ break;
19714
20380
  }
19715
- strSlideXml += '</mc:AlternateContent>';
19716
- break;
19717
- }
19718
- case (/* inlined export .SLIDE_OBJECT_TYPES.contentPart */"contentPart"):
19719
- {
19720
- var _slideItemObj_contentPartRid;
19721
- // MS-PPTX §2.2.3 / §2.2.3.1: mc:AlternateContent { Choice contentPart | Fallback sp|pic }.
19722
- const cpKind = slideItemObj.contentPartKind === 'ink' ? 'ink' : 'content';
19723
- strSlideXml += genXmlContentPartAlternate({
19724
- kind: cpKind,
19725
- rId: (_slideItemObj_contentPartRid = slideItemObj.contentPartRid) !== null && _slideItemObj_contentPartRid !== void 0 ? _slideItemObj_contentPartRid : 0,
19726
- shapeId,
19727
- name: slideItemObj.options.objectName || (cpKind === 'ink' ? 'Ink 1' : 'Content Part 1'),
19728
- altText: slideItemObj.options.altText || '',
19729
- x,
19730
- y,
19731
- cx,
19732
- cy,
19733
- locationAttr,
19734
- bwMode: slideItemObj.contentPartBwMode,
19735
- coverRid: slideItemObj.coverRid
19736
- });
20381
+ case (/* inlined export .SLIDE_OBJECT_TYPES.chart */"chart"):
20382
+ strSlideXml += '<p:graphicFrame>';
20383
+ strSlideXml += ' <p:nvGraphicFramePr>';
20384
+ strSlideXml += ` <p:cNvPr id="${shapeId}" name="${slideItemObj.options.objectName}" descr="${encodeXmlEntities(slideItemObj.options.altText || '')}"/>`;
20385
+ strSlideXml += ' <p:cNvGraphicFramePr/>';
20386
+ strSlideXml += genXmlNvPr(slideItemObj.options, genXmlPlaceholder(placeholderObj, slideItemObj.options), [
20387
+ nvPrModIdExt(slideItemObj.options.modId)
20388
+ ]);
20389
+ strSlideXml += ' </p:nvGraphicFramePr>';
20390
+ strSlideXml += ` <p:xfrm><a:off x="${x}" y="${y}"/><a:ext cx="${cx}" cy="${cy}"/></p:xfrm>`;
20391
+ strSlideXml += ' <a:graphic xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main">';
20392
+ strSlideXml += ' <a:graphicData uri="http://schemas.openxmlformats.org/drawingml/2006/chart">';
20393
+ strSlideXml += ` <c:chart r:id="rId${slideItemObj.chartRid}" xmlns:c="http://schemas.openxmlformats.org/drawingml/2006/chart"/>`;
20394
+ strSlideXml += ' </a:graphicData>';
20395
+ strSlideXml += ' </a:graphic>';
20396
+ strSlideXml += '</p:graphicFrame>';
19737
20397
  break;
19738
- }
19739
- case (/* inlined export .SLIDE_OBJECT_TYPES.officeApp */"officeApp"):
19740
- {
19741
- var _slideItemObj_contentPartRid1, _slideItemObj_coverRid;
19742
- // MS-PPTX §2.2.13: mc:AlternateContent { Choice we:webextensionref | Fallback pic }.
19743
- strSlideXml += genXmlOfficeAppAlternate({
19744
- rId: (_slideItemObj_contentPartRid1 = slideItemObj.contentPartRid) !== null && _slideItemObj_contentPartRid1 !== void 0 ? _slideItemObj_contentPartRid1 : 0,
19745
- shapeId,
19746
- name: slideItemObj.options.objectName || 'Office App 1',
19747
- altText: slideItemObj.options.altText || '',
19748
- x,
19749
- y,
19750
- cx,
19751
- cy,
19752
- locationAttr,
19753
- coverRid: (_slideItemObj_coverRid = slideItemObj.coverRid) !== null && _slideItemObj_coverRid !== void 0 ? _slideItemObj_coverRid : 0
19754
- });
20398
+ case (/* inlined export .SLIDE_OBJECT_TYPES.group */"group"):
20399
+ {
20400
+ var _slideItemObj__objects;
20401
+ // PresentationML `p:grpSp` (ECMA-376 §19.3.1.22): nvGrpSpPr + grpSpPr + children.
20402
+ // Child coords are group-relative; chOff is 0,0 and chExt matches the group size.
20403
+ strSlideXml += '<p:grpSp>';
20404
+ strSlideXml += `<p:nvGrpSpPr><p:cNvPr id="${shapeId}" name="${encodeXmlEntities(slideItemObj.options.objectName || `Group ${shapeId}`)}"/>`;
20405
+ strSlideXml += '<p:cNvGrpSpPr/><p:nvPr/></p:nvGrpSpPr>';
20406
+ strSlideXml += '<p:grpSpPr>';
20407
+ strSlideXml += `<a:xfrm${locationAttr}>`;
20408
+ strSlideXml += `<a:off x="${x}" y="${y}"/><a:ext cx="${cx}" cy="${cy}"/>`;
20409
+ strSlideXml += `<a:chOff x="0" y="0"/><a:chExt cx="${cx}" cy="${cy}"/>`;
20410
+ strSlideXml += '</a:xfrm>';
20411
+ strSlideXml += genXmlEffectLst({
20412
+ shadow: slideItemObj.options.shadow,
20413
+ glow: slideItemObj.options.glow,
20414
+ softEdge: slideItemObj.options.softEdge,
20415
+ reflection: slideItemObj.options.reflection,
20416
+ blur: slideItemObj.options.blur
20417
+ });
20418
+ strSlideXml += '</p:grpSpPr>';
20419
+ renderObjectList((_slideItemObj__objects = slideItemObj._objects) !== null && _slideItemObj__objects !== void 0 ? _slideItemObj__objects : []);
20420
+ strSlideXml += '</p:grpSp>';
20421
+ break;
20422
+ }
20423
+ default:
20424
+ strSlideXml += '';
19755
20425
  break;
19756
- }
19757
- case (/* inlined export .SLIDE_OBJECT_TYPES.chart */"chart"):
19758
- strSlideXml += '<p:graphicFrame>';
19759
- strSlideXml += ' <p:nvGraphicFramePr>';
19760
- strSlideXml += ` <p:cNvPr id="${shapeId}" name="${slideItemObj.options.objectName}" descr="${encodeXmlEntities(slideItemObj.options.altText || '')}"/>`;
19761
- strSlideXml += ' <p:cNvGraphicFramePr/>';
19762
- strSlideXml += genXmlNvPr(slideItemObj.options, genXmlPlaceholder(placeholderObj, slideItemObj.options), [
19763
- nvPrModIdExt(slideItemObj.options.modId)
19764
- ]);
19765
- strSlideXml += ' </p:nvGraphicFramePr>';
19766
- strSlideXml += ` <p:xfrm><a:off x="${x}" y="${y}"/><a:ext cx="${cx}" cy="${cy}"/></p:xfrm>`;
19767
- strSlideXml += ' <a:graphic xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main">';
19768
- strSlideXml += ' <a:graphicData uri="http://schemas.openxmlformats.org/drawingml/2006/chart">';
19769
- strSlideXml += ` <c:chart r:id="rId${slideItemObj.chartRid}" xmlns:c="http://schemas.openxmlformats.org/drawingml/2006/chart"/>`;
19770
- strSlideXml += ' </a:graphicData>';
19771
- strSlideXml += ' </a:graphic>';
19772
- strSlideXml += '</p:graphicFrame>';
19773
- break;
19774
- default:
19775
- strSlideXml += '';
19776
- break;
19777
- }
19778
- });
20426
+ }
20427
+ });
20428
+ };
20429
+ renderObjectList(slide._slideObjects);
19779
20430
  // STEP 4: Add slide numbers (if any) last
19780
20431
  if (slide._slideNumberProps) {
19781
20432
  // Set some defaults (done here b/c SlideNumber canbe added to masters or slides and has numerous entry points)
19782
20433
  if (!slide._slideNumberProps.align) slide._slideNumberProps.align = 'left';
20434
+ const slideNumId = nextUnusedShapeId(usedShapeIds);
19783
20435
  strSlideXml += '<p:sp>';
19784
20436
  strSlideXml += ' <p:nvSpPr>';
19785
- strSlideXml += ' <p:cNvPr id="25" name="Slide Number Placeholder 0"/><p:cNvSpPr><a:spLocks noGrp="1"/></p:cNvSpPr>';
20437
+ strSlideXml += ` <p:cNvPr id="${slideNumId}" name="Slide Number Placeholder 0"/><p:cNvSpPr><a:spLocks noGrp="1"/></p:cNvSpPr>`;
19786
20438
  strSlideXml += ' <p:nvPr><p:ph type="sldNum" sz="quarter" idx="4294967295"/></p:nvPr>';
19787
20439
  strSlideXml += ' </p:nvSpPr>';
19788
20440
  strSlideXml += ' <p:spPr>';
@@ -19962,6 +20614,7 @@ function slideShowExtLst(slide) {
19962
20614
  strXml += '<Override PartName="/ppt/presProps.xml" ContentType="application/vnd.openxmlformats-officedocument.presentationml.presProps+xml"/>';
19963
20615
  strXml += '<Override PartName="/ppt/viewProps.xml" ContentType="application/vnd.openxmlformats-officedocument.presentationml.viewProps+xml"/>';
19964
20616
  strXml += '<Override PartName="/ppt/theme/theme1.xml" ContentType="application/vnd.openxmlformats-officedocument.theme+xml"/>';
20617
+ strXml += '<Override PartName="/ppt/theme/theme2.xml" ContentType="application/vnd.openxmlformats-officedocument.theme+xml"/>';
19965
20618
  strXml += '<Override PartName="/ppt/tableStyles.xml" ContentType="application/vnd.openxmlformats-officedocument.presentationml.tableStyles+xml"/>';
19966
20619
  // STEP 4: Add Slide Layouts
19967
20620
  slideLayouts.forEach((layout, idx)=>{
@@ -20067,8 +20720,12 @@ function slideShowExtLst(slide) {
20067
20720
  * @param {string} subject - metadata data
20068
20721
  * @param {string} author - metadata value
20069
20722
  * @param {string} revision - metadata value
20723
+ * @param {Date} [created] - OPC `dcterms:created` (defaults to now)
20724
+ * @param {Date} [modified] - OPC `dcterms:modified` (defaults to now)
20070
20725
  * @returns XML
20071
- */ function makeXmlCore(title, subject, author, revision) {
20726
+ */ function makeXmlCore(title, subject, author, revision, created, modified) {
20727
+ const createdAt = (created !== null && created !== void 0 ? created : new Date()).toISOString().replace(/\.\d\d\dZ/, 'Z');
20728
+ const modifiedAt = (modified !== null && modified !== void 0 ? modified : new Date()).toISOString().replace(/\.\d\d\dZ/, 'Z');
20072
20729
  return `<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
20073
20730
  <cp:coreProperties xmlns:cp="http://schemas.openxmlformats.org/package/2006/metadata/core-properties" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:dcterms="http://purl.org/dc/terms/" xmlns:dcmitype="http://purl.org/dc/dcmitype/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
20074
20731
  <dc:title>${encodeXmlEntities(title)}</dc:title>
@@ -20076,8 +20733,8 @@ function slideShowExtLst(slide) {
20076
20733
  <dc:creator>${encodeXmlEntities(author)}</dc:creator>
20077
20734
  <cp:lastModifiedBy>${encodeXmlEntities(author)}</cp:lastModifiedBy>
20078
20735
  <cp:revision>${revision}</cp:revision>
20079
- <dcterms:created xsi:type="dcterms:W3CDTF">${new Date().toISOString().replace(/\.\d\d\dZ/, 'Z')}</dcterms:created>
20080
- <dcterms:modified xsi:type="dcterms:W3CDTF">${new Date().toISOString().replace(/\.\d\d\dZ/, 'Z')}</dcterms:modified>
20736
+ <dcterms:created xsi:type="dcterms:W3CDTF">${createdAt}</dcterms:created>
20737
+ <dcterms:modified xsi:type="dcterms:W3CDTF">${modifiedAt}</dcterms:modified>
20081
20738
  </cp:coreProperties>`;
20082
20739
  }
20083
20740
  /**
@@ -20179,10 +20836,13 @@ function collectSlideAnimations(slide) {
20179
20836
  delay: 0
20180
20837
  }, animConfig);
20181
20838
  }
20839
+ // Media cNvPr id is mediaRid+2 (not the auto shape index). Charts keep index+2 / sId.
20840
+ const shapeId = slideObj._type === (/* inlined export .SLIDE_OBJECT_TYPES.media */"media") && slideObj.mediaRid != null ? slideObj.mediaRid + 2 : (_ref = (_slideObj_options2 = slideObj.options) === null || _slideObj_options2 === void 0 ? void 0 : _slideObj_options2.sId) !== null && _ref !== void 0 ? _ref : index + 2;
20182
20841
  animations.push({
20183
20842
  objectIndex: index,
20184
- shapeId: (_ref = (_slideObj_options2 = slideObj.options) === null || _slideObj_options2 === void 0 ? void 0 : _slideObj_options2.sId) !== null && _ref !== void 0 ? _ref : index + 2,
20185
- animation
20843
+ shapeId,
20844
+ animation,
20845
+ buildKind: slideObj._type === (/* inlined export .SLIDE_OBJECT_TYPES.chart */"chart") ? 'chart' : 'shape'
20186
20846
  });
20187
20847
  });
20188
20848
  return animations;
@@ -20241,7 +20901,12 @@ function collectSlideAnimations(slide) {
20241
20901
  * @param {PresSlide} slide - the slide object to transform into XML
20242
20902
  * @return {string} XML
20243
20903
  */ function makeXmlNotesSlide(slide) {
20244
- return `<?xml version="1.0" encoding="UTF-8" standalone="yes"?>${(/* inlined export .CRLF */"\r\n")}<p:notes xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships" xmlns:p="http://schemas.openxmlformats.org/presentationml/2006/main"><p:cSld><p:spTree><p:nvGrpSpPr><p:cNvPr id="1" name=""/><p:cNvGrpSpPr/><p:nvPr/></p:nvGrpSpPr><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><p:sp><p:nvSpPr><p:cNvPr id="2" name="Slide Image Placeholder 1"/><p:cNvSpPr><a:spLocks noGrp="1" noRot="1" noChangeAspect="1"/></p:cNvSpPr><p:nvPr><p:ph type="sldImg"/></p:nvPr></p:nvSpPr><p:spPr/></p:sp><p:sp><p:nvSpPr><p:cNvPr id="3" name="Notes Placeholder 2"/><p:cNvSpPr><a:spLocks noGrp="1"/></p:cNvSpPr><p:nvPr><p:ph type="body" idx="1"/></p:nvPr></p:nvSpPr><p:spPr/><p:txBody><a:bodyPr/><a:lstStyle/><a:p><a:r><a:rPr lang="en-US" dirty="0"/><a:t>${encodeXmlEntities(getNotesFromSlide(slide))}</a:t></a:r><a:endParaRPr lang="en-US" dirty="0"/></a:p></p:txBody></p:sp><p:sp><p:nvSpPr><p:cNvPr id="4" name="Slide Number Placeholder 3"/><p:cNvSpPr><a:spLocks noGrp="1"/></p:cNvSpPr><p:nvPr><p:ph type="sldNum" sz="quarter" idx="10"/></p:nvPr></p:nvSpPr><p:spPr/><p:txBody><a:bodyPr/><a:lstStyle/><a:p><a:fld id="${SLDNUMFLDID}" type="slidenum"><a:rPr lang="en-US"/><a:t>${slide._slideNum}</a:t></a:fld><a:endParaRPr lang="en-US"/></a:p></p:txBody></p:sp></p:spTree><p:extLst><p:ext uri="{BB962C8B-B14F-4D97-AF65-F5344CB8AC3E}"><p14:creationId xmlns:p14="http://schemas.microsoft.com/office/powerpoint/2010/main" val="1024086991"/></p:ext></p:extLst></p:cSld><p:clrMapOvr><a:masterClrMapping/></p:clrMapOvr></p:notes>`;
20904
+ const notesText = getNotesFromSlide(slide);
20905
+ // ECMA-376 §5.1.5.2.6 `CT_RegularTextRun` / `a:t` (`standards/ecma/part-22_drawingml-reference-material-drawingml-main.txt`):
20906
+ // an empty run is invalid. PowerPoint repair flags `<a:t></a:t>` on notesSlide (Juliussssssss 3260b6e).
20907
+ // Empty notes keep a valid paragraph with only `a:endParaRPr` (`CT_TextParagraph`).
20908
+ const notesRun = notesText ? `<a:r><a:rPr lang="en-US" dirty="0"/><a:t>${encodeXmlEntities(notesText)}</a:t></a:r>` : '';
20909
+ return `<?xml version="1.0" encoding="UTF-8" standalone="yes"?>${(/* inlined export .CRLF */"\r\n")}<p:notes xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships" xmlns:p="http://schemas.openxmlformats.org/presentationml/2006/main"><p:cSld><p:spTree><p:nvGrpSpPr><p:cNvPr id="1" name=""/><p:cNvGrpSpPr/><p:nvPr/></p:nvGrpSpPr><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><p:sp><p:nvSpPr><p:cNvPr id="2" name="Slide Image Placeholder 1"/><p:cNvSpPr><a:spLocks noGrp="1" noRot="1" noChangeAspect="1"/></p:cNvSpPr><p:nvPr><p:ph type="sldImg"/></p:nvPr></p:nvSpPr><p:spPr/></p:sp><p:sp><p:nvSpPr><p:cNvPr id="3" name="Notes Placeholder 2"/><p:cNvSpPr><a:spLocks noGrp="1"/></p:cNvSpPr><p:nvPr><p:ph type="body" idx="1"/></p:nvPr></p:nvSpPr><p:spPr/><p:txBody><a:bodyPr/><a:lstStyle/><a:p>${notesRun}<a:endParaRPr lang="en-US" dirty="0"/></a:p></p:txBody></p:sp><p:sp><p:nvSpPr><p:cNvPr id="4" name="Slide Number Placeholder 3"/><p:cNvSpPr><a:spLocks noGrp="1"/></p:cNvSpPr><p:nvPr><p:ph type="sldNum" sz="quarter" idx="10"/></p:nvPr></p:nvSpPr><p:spPr/><p:txBody><a:bodyPr/><a:lstStyle/><a:p><a:fld id="${SLDNUMFLDID}" type="slidenum"><a:rPr lang="en-US"/><a:t>${slide._slideNum}</a:t></a:fld><a:endParaRPr lang="en-US"/></a:p></p:txBody></p:sp></p:spTree><p:extLst><p:ext uri="{BB962C8B-B14F-4D97-AF65-F5344CB8AC3E}"><p14:creationId xmlns:p14="http://schemas.microsoft.com/office/powerpoint/2010/main" val="1024086991"/></p:ext></p:extLst></p:cSld><p:clrMapOvr><a:masterClrMapping/></p:clrMapOvr></p:notes>`;
20245
20910
  }
20246
20911
  /**
20247
20912
  * Generates the XML layout resource from a layout object
@@ -20266,25 +20931,35 @@ function collectSlideAnimations(slide) {
20266
20931
  strXml += slideObjectToXml(slide);
20267
20932
  strXml += '<p:clrMap bg1="lt1" tx1="dk1" bg2="lt2" tx2="dk2" accent1="accent1" accent2="accent2" accent3="accent3" accent4="accent4" accent5="accent5" accent6="accent6" hlink="hlink" folHlink="folHlink"/>';
20268
20933
  strXml += '<p:sldLayoutIdLst>' + layoutDefs.join('') + '</p:sldLayoutIdLst>';
20269
- strXml += '<p:hf sldNum="0" hdr="0" ftr="0" dt="0"/>';
20934
+ // ECMA-376 §4.4.1.22 `p:hf@sldNum` (default true) enables the slide-number placeholder.
20935
+ // Honour it only when the user set slideNumber — otherwise keep it off so unused masters
20936
+ // do not surface a default sldNum slot.
20937
+ strXml += `<p:hf sldNum="${slide._slideNumberProps ? '1' : '0'}" hdr="0" ftr="0" dt="0"/>`;
20270
20938
  strXml += '<p:txStyles>' + ' <p:titleStyle>' + ' <a:lvl1pPr algn="ctr" defTabSz="914400" rtl="0" eaLnBrk="1" latinLnBrk="0" hangingPunct="1"><a:spcBef><a:spcPct val="0"/></a:spcBef><a:buNone/><a:defRPr sz="4400" kern="1200"><a:solidFill><a:schemeClr val="tx1"/></a:solidFill><a:latin typeface="+mj-lt"/><a:ea typeface="+mj-ea"/><a:cs typeface="+mj-cs"/></a:defRPr></a:lvl1pPr>' + ' </p:titleStyle>' + ' <p:bodyStyle>' + ' <a:lvl1pPr marL="342900" indent="-342900" algn="l" defTabSz="914400" rtl="0" eaLnBrk="1" latinLnBrk="0" hangingPunct="1"><a:spcBef><a:spcPct val="20000"/></a:spcBef><a:buFont typeface="Arial" pitchFamily="34" charset="0"/><a:buChar char="•"/><a:defRPr sz="3200" kern="1200"><a:solidFill><a:schemeClr val="tx1"/></a:solidFill><a:latin typeface="+mn-lt"/><a:ea typeface="+mn-ea"/><a:cs typeface="+mn-cs"/></a:defRPr></a:lvl1pPr>' + ' <a:lvl2pPr marL="742950" indent="-285750" algn="l" defTabSz="914400" rtl="0" eaLnBrk="1" latinLnBrk="0" hangingPunct="1"><a:spcBef><a:spcPct val="20000"/></a:spcBef><a:buFont typeface="Arial" pitchFamily="34" charset="0"/><a:buChar char="–"/><a:defRPr sz="2800" kern="1200"><a:solidFill><a:schemeClr val="tx1"/></a:solidFill><a:latin typeface="+mn-lt"/><a:ea typeface="+mn-ea"/><a:cs typeface="+mn-cs"/></a:defRPr></a:lvl2pPr>' + ' <a:lvl3pPr marL="1143000" indent="-228600" algn="l" defTabSz="914400" rtl="0" eaLnBrk="1" latinLnBrk="0" hangingPunct="1"><a:spcBef><a:spcPct val="20000"/></a:spcBef><a:buFont typeface="Arial" pitchFamily="34" charset="0"/><a:buChar char="•"/><a:defRPr sz="2400" kern="1200"><a:solidFill><a:schemeClr val="tx1"/></a:solidFill><a:latin typeface="+mn-lt"/><a:ea typeface="+mn-ea"/><a:cs typeface="+mn-cs"/></a:defRPr></a:lvl3pPr>' + ' <a:lvl4pPr marL="1600200" indent="-228600" algn="l" defTabSz="914400" rtl="0" eaLnBrk="1" latinLnBrk="0" hangingPunct="1"><a:spcBef><a:spcPct val="20000"/></a:spcBef><a:buFont typeface="Arial" pitchFamily="34" charset="0"/><a:buChar char="–"/><a:defRPr sz="2000" kern="1200"><a:solidFill><a:schemeClr val="tx1"/></a:solidFill><a:latin typeface="+mn-lt"/><a:ea typeface="+mn-ea"/><a:cs typeface="+mn-cs"/></a:defRPr></a:lvl4pPr>' + ' <a:lvl5pPr marL="2057400" indent="-228600" algn="l" defTabSz="914400" rtl="0" eaLnBrk="1" latinLnBrk="0" hangingPunct="1"><a:spcBef><a:spcPct val="20000"/></a:spcBef><a:buFont typeface="Arial" pitchFamily="34" charset="0"/><a:buChar char="»"/><a:defRPr sz="2000" kern="1200"><a:solidFill><a:schemeClr val="tx1"/></a:solidFill><a:latin typeface="+mn-lt"/><a:ea typeface="+mn-ea"/><a:cs typeface="+mn-cs"/></a:defRPr></a:lvl5pPr>' + ' <a:lvl6pPr marL="2514600" indent="-228600" algn="l" defTabSz="914400" rtl="0" eaLnBrk="1" latinLnBrk="0" hangingPunct="1"><a:spcBef><a:spcPct val="20000"/></a:spcBef><a:buFont typeface="Arial" pitchFamily="34" charset="0"/><a:buChar char="•"/><a:defRPr sz="2000" kern="1200"><a:solidFill><a:schemeClr val="tx1"/></a:solidFill><a:latin typeface="+mn-lt"/><a:ea typeface="+mn-ea"/><a:cs typeface="+mn-cs"/></a:defRPr></a:lvl6pPr>' + ' <a:lvl7pPr marL="2971800" indent="-228600" algn="l" defTabSz="914400" rtl="0" eaLnBrk="1" latinLnBrk="0" hangingPunct="1"><a:spcBef><a:spcPct val="20000"/></a:spcBef><a:buFont typeface="Arial" pitchFamily="34" charset="0"/><a:buChar char="•"/><a:defRPr sz="2000" kern="1200"><a:solidFill><a:schemeClr val="tx1"/></a:solidFill><a:latin typeface="+mn-lt"/><a:ea typeface="+mn-ea"/><a:cs typeface="+mn-cs"/></a:defRPr></a:lvl7pPr>' + ' <a:lvl8pPr marL="3429000" indent="-228600" algn="l" defTabSz="914400" rtl="0" eaLnBrk="1" latinLnBrk="0" hangingPunct="1"><a:spcBef><a:spcPct val="20000"/></a:spcBef><a:buFont typeface="Arial" pitchFamily="34" charset="0"/><a:buChar char="•"/><a:defRPr sz="2000" kern="1200"><a:solidFill><a:schemeClr val="tx1"/></a:solidFill><a:latin typeface="+mn-lt"/><a:ea typeface="+mn-ea"/><a:cs typeface="+mn-cs"/></a:defRPr></a:lvl8pPr>' + ' <a:lvl9pPr marL="3886200" indent="-228600" algn="l" defTabSz="914400" rtl="0" eaLnBrk="1" latinLnBrk="0" hangingPunct="1"><a:spcBef><a:spcPct val="20000"/></a:spcBef><a:buFont typeface="Arial" pitchFamily="34" charset="0"/><a:buChar char="•"/><a:defRPr sz="2000" kern="1200"><a:solidFill><a:schemeClr val="tx1"/></a:solidFill><a:latin typeface="+mn-lt"/><a:ea typeface="+mn-ea"/><a:cs typeface="+mn-cs"/></a:defRPr></a:lvl9pPr>' + ' </p:bodyStyle>' + ' <p:otherStyle>' + ' <a:defPPr><a:defRPr lang="en-US"/></a:defPPr>' + ' <a:lvl1pPr marL="0" algn="l" defTabSz="914400" rtl="0" eaLnBrk="1" latinLnBrk="0" hangingPunct="1"><a:defRPr sz="1800" kern="1200"><a:solidFill><a:schemeClr val="tx1"/></a:solidFill><a:latin typeface="+mn-lt"/><a:ea typeface="+mn-ea"/><a:cs typeface="+mn-cs"/></a:defRPr></a:lvl1pPr>' + ' <a:lvl2pPr marL="457200" algn="l" defTabSz="914400" rtl="0" eaLnBrk="1" latinLnBrk="0" hangingPunct="1"><a:defRPr sz="1800" kern="1200"><a:solidFill><a:schemeClr val="tx1"/></a:solidFill><a:latin typeface="+mn-lt"/><a:ea typeface="+mn-ea"/><a:cs typeface="+mn-cs"/></a:defRPr></a:lvl2pPr>' + ' <a:lvl3pPr marL="914400" algn="l" defTabSz="914400" rtl="0" eaLnBrk="1" latinLnBrk="0" hangingPunct="1"><a:defRPr sz="1800" kern="1200"><a:solidFill><a:schemeClr val="tx1"/></a:solidFill><a:latin typeface="+mn-lt"/><a:ea typeface="+mn-ea"/><a:cs typeface="+mn-cs"/></a:defRPr></a:lvl3pPr>' + ' <a:lvl4pPr marL="1371600" algn="l" defTabSz="914400" rtl="0" eaLnBrk="1" latinLnBrk="0" hangingPunct="1"><a:defRPr sz="1800" kern="1200"><a:solidFill><a:schemeClr val="tx1"/></a:solidFill><a:latin typeface="+mn-lt"/><a:ea typeface="+mn-ea"/><a:cs typeface="+mn-cs"/></a:defRPr></a:lvl4pPr>' + ' <a:lvl5pPr marL="1828800" algn="l" defTabSz="914400" rtl="0" eaLnBrk="1" latinLnBrk="0" hangingPunct="1"><a:defRPr sz="1800" kern="1200"><a:solidFill><a:schemeClr val="tx1"/></a:solidFill><a:latin typeface="+mn-lt"/><a:ea typeface="+mn-ea"/><a:cs typeface="+mn-cs"/></a:defRPr></a:lvl5pPr>' + ' <a:lvl6pPr marL="2286000" algn="l" defTabSz="914400" rtl="0" eaLnBrk="1" latinLnBrk="0" hangingPunct="1"><a:defRPr sz="1800" kern="1200"><a:solidFill><a:schemeClr val="tx1"/></a:solidFill><a:latin typeface="+mn-lt"/><a:ea typeface="+mn-ea"/><a:cs typeface="+mn-cs"/></a:defRPr></a:lvl6pPr>' + ' <a:lvl7pPr marL="2743200" algn="l" defTabSz="914400" rtl="0" eaLnBrk="1" latinLnBrk="0" hangingPunct="1"><a:defRPr sz="1800" kern="1200"><a:solidFill><a:schemeClr val="tx1"/></a:solidFill><a:latin typeface="+mn-lt"/><a:ea typeface="+mn-ea"/><a:cs typeface="+mn-cs"/></a:defRPr></a:lvl7pPr>' + ' <a:lvl8pPr marL="3200400" algn="l" defTabSz="914400" rtl="0" eaLnBrk="1" latinLnBrk="0" hangingPunct="1"><a:defRPr sz="1800" kern="1200"><a:solidFill><a:schemeClr val="tx1"/></a:solidFill><a:latin typeface="+mn-lt"/><a:ea typeface="+mn-ea"/><a:cs typeface="+mn-cs"/></a:defRPr></a:lvl8pPr>' + ' <a:lvl9pPr marL="3657600" algn="l" defTabSz="914400" rtl="0" eaLnBrk="1" latinLnBrk="0" hangingPunct="1"><a:defRPr sz="1800" kern="1200"><a:solidFill><a:schemeClr val="tx1"/></a:solidFill><a:latin typeface="+mn-lt"/><a:ea typeface="+mn-ea"/><a:cs typeface="+mn-cs"/></a:defRPr></a:lvl9pPr>' + ' </p:otherStyle>' + '</p:txStyles>';
20271
20939
  strXml += '</p:sldMaster>';
20272
20940
  return strXml;
20273
20941
  }
20274
20942
  // XML-GEN: Last 5 functions create root /ppt files
20275
20943
  /**
20276
- * Creates `ppt/theme/theme1.xml`
20944
+ * Creates `ppt/theme/theme1.xml` (slide master) or `ppt/theme/theme2.xml` (notes master).
20945
+ * Distinct `thm15:themeFamily` ids keep the notes theme from being a byte-identical twin
20946
+ * (Office repair creates theme2 when notesMaster shares theme1; Juliussssssss 9bdfe09 / SCV-Soft 1a1998e).
20277
20947
  * @return {string} XML
20278
- */ function makeXmlTheme(pres) {
20279
- var _pres_theme, _pres_theme1, _pres_theme2, _pres_theme3, _pres_theme4;
20948
+ */ function makeXmlTheme(pres, variant = 'slide') {
20949
+ var _ref, _ref1;
20950
+ var _pres_theme, _pres_theme1, _pres_theme2, _pres_theme3, _pres_theme4, _pres_theme5, _pres_theme6;
20280
20951
  const majorFont = ((_pres_theme = pres.theme) === null || _pres_theme === void 0 ? void 0 : _pres_theme.headFontFace) ? `<a:latin typeface="${(_pres_theme1 = pres.theme) === null || _pres_theme1 === void 0 ? void 0 : _pres_theme1.headFontFace}"/>` : '<a:latin typeface="Calibri Light" panose="020F0302020204030204"/>';
20281
20952
  const minorFont = ((_pres_theme2 = pres.theme) === null || _pres_theme2 === void 0 ? void 0 : _pres_theme2.bodyFontFace) ? `<a:latin typeface="${(_pres_theme3 = pres.theme) === null || _pres_theme3 === void 0 ? void 0 : _pres_theme3.bodyFontFace}"/>` : '<a:latin typeface="Calibri" panose="020F0502020204030204"/>';
20953
+ const eaFace = (_ref = (_pres_theme4 = pres.theme) === null || _pres_theme4 === void 0 ? void 0 : _pres_theme4.eaFontFace) !== null && _ref !== void 0 ? _ref : '';
20954
+ const csFace = (_ref1 = (_pres_theme5 = pres.theme) === null || _pres_theme5 === void 0 ? void 0 : _pres_theme5.csFontFace) !== null && _ref1 !== void 0 ? _ref1 : '';
20955
+ const themeFamilyId = variant === 'notes' ? '{2E142A2C-CD16-42D6-873A-C26D2A0506FA}' : '{62F939B6-93AF-4DB8-9C6B-D6C7DFDC589F}';
20956
+ const themeFamilyVid = variant === 'notes' ? '{1BDDFF52-6CD6-40A5-AB3C-68EB2F1E4D0A}' : '{4A3C46E8-61CC-4603-A589-7422A47A8E4A}';
20282
20957
  // Exactly 12 hex colors required (upstream only checked truthy `.length`, which allowed short arrays → undefined attrs)
20283
- const isCustomColors = Array.isArray((_pres_theme4 = pres.theme) === null || _pres_theme4 === void 0 ? void 0 : _pres_theme4.themeColors) && pres.theme.themeColors.length === 12;
20958
+ const isCustomColors = Array.isArray((_pres_theme6 = pres.theme) === null || _pres_theme6 === void 0 ? void 0 : _pres_theme6.themeColors) && pres.theme.themeColors.length === 12;
20284
20959
  const c = resolveThemeColors(pres.theme);
20285
20960
  const themeName = isCustomColors ? 'Custom Theme' : 'Office Theme';
20286
20961
  const schemeName = isCustomColors ? 'Custom' : 'Office';
20287
- return `<?xml version="1.0" encoding="UTF-8" standalone="yes"?><a:theme xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main" name="${themeName}"><a:themeElements><a:clrScheme name="${schemeName}"><a:dk1><a:sysClr val="windowText" lastClr="${c[0]}"/></a:dk1><a:lt1><a:sysClr val="window" lastClr="${c[1]}"/></a:lt1><a:dk2><a:srgbClr val="${c[2]}"/></a:dk2><a:lt2><a:srgbClr val="${c[3]}"/></a:lt2><a:accent1><a:srgbClr val="${c[4]}"/></a:accent1><a:accent2><a:srgbClr val="${c[5]}"/></a:accent2><a:accent3><a:srgbClr val="${c[6]}"/></a:accent3><a:accent4><a:srgbClr val="${c[7]}"/></a:accent4><a:accent5><a:srgbClr val="${c[8]}"/></a:accent5><a:accent6><a:srgbClr val="${c[9]}"/></a:accent6><a:hlink><a:srgbClr val="${c[10]}"/></a:hlink><a:folHlink><a:srgbClr val="${c[11]}"/></a:folHlink></a:clrScheme><a:fontScheme name="Office"><a:majorFont>${majorFont}<a:ea typeface=""/><a:cs typeface=""/><a:font script="Jpan" typeface="游ゴシック Light"/><a:font script="Hang" typeface="맑은 고딕"/><a:font script="Hans" typeface="等线 Light"/><a:font script="Hant" typeface="新細明體"/><a:font script="Arab" typeface="Times New Roman"/><a:font script="Hebr" typeface="Times New Roman"/><a:font script="Thai" typeface="Angsana New"/><a:font script="Ethi" typeface="Nyala"/><a:font script="Beng" typeface="Vrinda"/><a:font script="Gujr" typeface="Shruti"/><a:font script="Khmr" typeface="MoolBoran"/><a:font script="Knda" typeface="Tunga"/><a:font script="Guru" typeface="Raavi"/><a:font script="Cans" typeface="Euphemia"/><a:font script="Cher" typeface="Plantagenet Cherokee"/><a:font script="Yiii" typeface="Microsoft Yi Baiti"/><a:font script="Tibt" typeface="Microsoft Himalaya"/><a:font script="Thaa" typeface="MV Boli"/><a:font script="Deva" typeface="Mangal"/><a:font script="Telu" typeface="Gautami"/><a:font script="Taml" typeface="Latha"/><a:font script="Syrc" typeface="Estrangelo Edessa"/><a:font script="Orya" typeface="Kalinga"/><a:font script="Mlym" typeface="Kartika"/><a:font script="Laoo" typeface="DokChampa"/><a:font script="Sinh" typeface="Iskoola Pota"/><a:font script="Mong" typeface="Mongolian Baiti"/><a:font script="Viet" typeface="Times New Roman"/><a:font script="Uigh" typeface="Microsoft Uighur"/><a:font script="Geor" typeface="Sylfaen"/><a:font script="Armn" typeface="Arial"/><a:font script="Bugi" typeface="Leelawadee UI"/><a:font script="Bopo" typeface="Microsoft JhengHei"/><a:font script="Java" typeface="Javanese Text"/><a:font script="Lisu" typeface="Segoe UI"/><a:font script="Mymr" typeface="Myanmar Text"/><a:font script="Nkoo" typeface="Ebrima"/><a:font script="Olck" typeface="Nirmala UI"/><a:font script="Osma" typeface="Ebrima"/><a:font script="Phag" typeface="Phagspa"/><a:font script="Syrn" typeface="Estrangelo Edessa"/><a:font script="Syrj" typeface="Estrangelo Edessa"/><a:font script="Syre" typeface="Estrangelo Edessa"/><a:font script="Sora" typeface="Nirmala UI"/><a:font script="Tale" typeface="Microsoft Tai Le"/><a:font script="Talu" typeface="Microsoft New Tai Lue"/><a:font script="Tfng" typeface="Ebrima"/></a:majorFont><a:minorFont>${minorFont}<a:ea typeface=""/><a:cs typeface=""/><a:font script="Jpan" typeface="游ゴシック"/><a:font script="Hang" typeface="맑은 고딕"/><a:font script="Hans" typeface="等线"/><a:font script="Hant" typeface="新細明體"/><a:font script="Arab" typeface="Arial"/><a:font script="Hebr" typeface="Arial"/><a:font script="Thai" typeface="Cordia New"/><a:font script="Ethi" typeface="Nyala"/><a:font script="Beng" typeface="Vrinda"/><a:font script="Gujr" typeface="Shruti"/><a:font script="Khmr" typeface="DaunPenh"/><a:font script="Knda" typeface="Tunga"/><a:font script="Guru" typeface="Raavi"/><a:font script="Cans" typeface="Euphemia"/><a:font script="Cher" typeface="Plantagenet Cherokee"/><a:font script="Yiii" typeface="Microsoft Yi Baiti"/><a:font script="Tibt" typeface="Microsoft Himalaya"/><a:font script="Thaa" typeface="MV Boli"/><a:font script="Deva" typeface="Mangal"/><a:font script="Telu" typeface="Gautami"/><a:font script="Taml" typeface="Latha"/><a:font script="Syrc" typeface="Estrangelo Edessa"/><a:font script="Orya" typeface="Kalinga"/><a:font script="Mlym" typeface="Kartika"/><a:font script="Laoo" typeface="DokChampa"/><a:font script="Sinh" typeface="Iskoola Pota"/><a:font script="Mong" typeface="Mongolian Baiti"/><a:font script="Viet" typeface="Arial"/><a:font script="Uigh" typeface="Microsoft Uighur"/><a:font script="Geor" typeface="Sylfaen"/><a:font script="Armn" typeface="Arial"/><a:font script="Bugi" typeface="Leelawadee UI"/><a:font script="Bopo" typeface="Microsoft JhengHei"/><a:font script="Java" typeface="Javanese Text"/><a:font script="Lisu" typeface="Segoe UI"/><a:font script="Mymr" typeface="Myanmar Text"/><a:font script="Nkoo" typeface="Ebrima"/><a:font script="Olck" typeface="Nirmala UI"/><a:font script="Osma" typeface="Ebrima"/><a:font script="Phag" typeface="Phagspa"/><a:font script="Syrn" typeface="Estrangelo Edessa"/><a:font script="Syrj" typeface="Estrangelo Edessa"/><a:font script="Syre" typeface="Estrangelo Edessa"/><a:font script="Sora" typeface="Nirmala UI"/><a:font script="Tale" typeface="Microsoft Tai Le"/><a:font script="Talu" typeface="Microsoft New Tai Lue"/><a:font script="Tfng" typeface="Ebrima"/></a:minorFont></a:fontScheme><a:fmtScheme name="Office"><a:fillStyleLst><a:solidFill><a:schemeClr val="phClr"/></a:solidFill><a:gradFill rotWithShape="1"><a:gsLst><a:gs pos="0"><a:schemeClr val="phClr"><a:lumMod val="110000"/><a:satMod val="105000"/><a:tint val="67000"/></a:schemeClr></a:gs><a:gs pos="50000"><a:schemeClr val="phClr"><a:lumMod val="105000"/><a:satMod val="103000"/><a:tint val="73000"/></a:schemeClr></a:gs><a:gs pos="100000"><a:schemeClr val="phClr"><a:lumMod val="105000"/><a:satMod val="109000"/><a:tint val="81000"/></a:schemeClr></a:gs></a:gsLst><a:lin ang="5400000" scaled="0"/></a:gradFill><a:gradFill rotWithShape="1"><a:gsLst><a:gs pos="0"><a:schemeClr val="phClr"><a:satMod val="103000"/><a:lumMod val="102000"/><a:tint val="94000"/></a:schemeClr></a:gs><a:gs pos="50000"><a:schemeClr val="phClr"><a:satMod val="110000"/><a:lumMod val="100000"/><a:shade val="100000"/></a:schemeClr></a:gs><a:gs pos="100000"><a:schemeClr val="phClr"><a:lumMod val="99000"/><a:satMod val="120000"/><a:shade val="78000"/></a:schemeClr></a:gs></a:gsLst><a:lin ang="5400000" scaled="0"/></a:gradFill></a:fillStyleLst><a:lnStyleLst><a:ln w="6350" cap="flat" cmpd="sng" algn="ctr"><a:solidFill><a:schemeClr val="phClr"/></a:solidFill><a:prstDash val="solid"/><a:miter lim="800000"/></a:ln><a:ln w="12700" cap="flat" cmpd="sng" algn="ctr"><a:solidFill><a:schemeClr val="phClr"/></a:solidFill><a:prstDash val="solid"/><a:miter lim="800000"/></a:ln><a:ln w="19050" cap="flat" cmpd="sng" algn="ctr"><a:solidFill><a:schemeClr val="phClr"/></a:solidFill><a:prstDash val="solid"/><a:miter lim="800000"/></a:ln></a:lnStyleLst><a:effectStyleLst><a:effectStyle><a:effectLst/></a:effectStyle><a:effectStyle><a:effectLst/></a:effectStyle><a:effectStyle><a:effectLst><a:outerShdw blurRad="57150" dist="19050" dir="5400000" algn="ctr" rotWithShape="0"><a:srgbClr val="000000"><a:alpha val="63000"/></a:srgbClr></a:outerShdw></a:effectLst></a:effectStyle></a:effectStyleLst><a:bgFillStyleLst><a:solidFill><a:schemeClr val="phClr"/></a:solidFill><a:solidFill><a:schemeClr val="phClr"><a:tint val="95000"/><a:satMod val="170000"/></a:schemeClr></a:solidFill><a:gradFill rotWithShape="1"><a:gsLst><a:gs pos="0"><a:schemeClr val="phClr"><a:tint val="93000"/><a:satMod val="150000"/><a:shade val="98000"/><a:lumMod val="102000"/></a:schemeClr></a:gs><a:gs pos="50000"><a:schemeClr val="phClr"><a:tint val="98000"/><a:satMod val="130000"/><a:shade val="90000"/><a:lumMod val="103000"/></a:schemeClr></a:gs><a:gs pos="100000"><a:schemeClr val="phClr"><a:shade val="63000"/><a:satMod val="120000"/></a:schemeClr></a:gs></a:gsLst><a:lin ang="5400000" scaled="0"/></a:gradFill></a:bgFillStyleLst></a:fmtScheme></a:themeElements><a:objectDefaults/><a:extraClrSchemeLst/><a:extLst><a:ext uri="{05A4C25C-085E-4340-85A3-A5531E510DB2}"><thm15:themeFamily xmlns:thm15="http://schemas.microsoft.com/office/thememl/2012/main" name="Office Theme" id="{62F939B6-93AF-4DB8-9C6B-D6C7DFDC589F}" vid="{4A3C46E8-61CC-4603-A589-7422A47A8E4A}"/></a:ext></a:extLst></a:theme>`;
20962
+ return `<?xml version="1.0" encoding="UTF-8" standalone="yes"?><a:theme xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main" name="${themeName}"><a:themeElements><a:clrScheme name="${schemeName}"><a:dk1><a:sysClr val="windowText" lastClr="${c[0]}"/></a:dk1><a:lt1><a:sysClr val="window" lastClr="${c[1]}"/></a:lt1><a:dk2><a:srgbClr val="${c[2]}"/></a:dk2><a:lt2><a:srgbClr val="${c[3]}"/></a:lt2><a:accent1><a:srgbClr val="${c[4]}"/></a:accent1><a:accent2><a:srgbClr val="${c[5]}"/></a:accent2><a:accent3><a:srgbClr val="${c[6]}"/></a:accent3><a:accent4><a:srgbClr val="${c[7]}"/></a:accent4><a:accent5><a:srgbClr val="${c[8]}"/></a:accent5><a:accent6><a:srgbClr val="${c[9]}"/></a:accent6><a:hlink><a:srgbClr val="${c[10]}"/></a:hlink><a:folHlink><a:srgbClr val="${c[11]}"/></a:folHlink></a:clrScheme><a:fontScheme name="Office"><a:majorFont>${majorFont}<a:ea typeface="${eaFace}"/><a:cs typeface="${csFace}"/><a:font script="Jpan" typeface="游ゴシック Light"/><a:font script="Hang" typeface="맑은 고딕"/><a:font script="Hans" typeface="等线 Light"/><a:font script="Hant" typeface="新細明體"/><a:font script="Arab" typeface="Times New Roman"/><a:font script="Hebr" typeface="Times New Roman"/><a:font script="Thai" typeface="Angsana New"/><a:font script="Ethi" typeface="Nyala"/><a:font script="Beng" typeface="Vrinda"/><a:font script="Gujr" typeface="Shruti"/><a:font script="Khmr" typeface="MoolBoran"/><a:font script="Knda" typeface="Tunga"/><a:font script="Guru" typeface="Raavi"/><a:font script="Cans" typeface="Euphemia"/><a:font script="Cher" typeface="Plantagenet Cherokee"/><a:font script="Yiii" typeface="Microsoft Yi Baiti"/><a:font script="Tibt" typeface="Microsoft Himalaya"/><a:font script="Thaa" typeface="MV Boli"/><a:font script="Deva" typeface="Mangal"/><a:font script="Telu" typeface="Gautami"/><a:font script="Taml" typeface="Latha"/><a:font script="Syrc" typeface="Estrangelo Edessa"/><a:font script="Orya" typeface="Kalinga"/><a:font script="Mlym" typeface="Kartika"/><a:font script="Laoo" typeface="DokChampa"/><a:font script="Sinh" typeface="Iskoola Pota"/><a:font script="Mong" typeface="Mongolian Baiti"/><a:font script="Viet" typeface="Times New Roman"/><a:font script="Uigh" typeface="Microsoft Uighur"/><a:font script="Geor" typeface="Sylfaen"/><a:font script="Armn" typeface="Arial"/><a:font script="Bugi" typeface="Leelawadee UI"/><a:font script="Bopo" typeface="Microsoft JhengHei"/><a:font script="Java" typeface="Javanese Text"/><a:font script="Lisu" typeface="Segoe UI"/><a:font script="Mymr" typeface="Myanmar Text"/><a:font script="Nkoo" typeface="Ebrima"/><a:font script="Olck" typeface="Nirmala UI"/><a:font script="Osma" typeface="Ebrima"/><a:font script="Phag" typeface="Phagspa"/><a:font script="Syrn" typeface="Estrangelo Edessa"/><a:font script="Syrj" typeface="Estrangelo Edessa"/><a:font script="Syre" typeface="Estrangelo Edessa"/><a:font script="Sora" typeface="Nirmala UI"/><a:font script="Tale" typeface="Microsoft Tai Le"/><a:font script="Talu" typeface="Microsoft New Tai Lue"/><a:font script="Tfng" typeface="Ebrima"/></a:majorFont><a:minorFont>${minorFont}<a:ea typeface="${eaFace}"/><a:cs typeface="${csFace}"/><a:font script="Jpan" typeface="游ゴシック"/><a:font script="Hang" typeface="맑은 고딕"/><a:font script="Hans" typeface="等线"/><a:font script="Hant" typeface="新細明體"/><a:font script="Arab" typeface="Arial"/><a:font script="Hebr" typeface="Arial"/><a:font script="Thai" typeface="Cordia New"/><a:font script="Ethi" typeface="Nyala"/><a:font script="Beng" typeface="Vrinda"/><a:font script="Gujr" typeface="Shruti"/><a:font script="Khmr" typeface="DaunPenh"/><a:font script="Knda" typeface="Tunga"/><a:font script="Guru" typeface="Raavi"/><a:font script="Cans" typeface="Euphemia"/><a:font script="Cher" typeface="Plantagenet Cherokee"/><a:font script="Yiii" typeface="Microsoft Yi Baiti"/><a:font script="Tibt" typeface="Microsoft Himalaya"/><a:font script="Thaa" typeface="MV Boli"/><a:font script="Deva" typeface="Mangal"/><a:font script="Telu" typeface="Gautami"/><a:font script="Taml" typeface="Latha"/><a:font script="Syrc" typeface="Estrangelo Edessa"/><a:font script="Orya" typeface="Kalinga"/><a:font script="Mlym" typeface="Kartika"/><a:font script="Laoo" typeface="DokChampa"/><a:font script="Sinh" typeface="Iskoola Pota"/><a:font script="Mong" typeface="Mongolian Baiti"/><a:font script="Viet" typeface="Arial"/><a:font script="Uigh" typeface="Microsoft Uighur"/><a:font script="Geor" typeface="Sylfaen"/><a:font script="Armn" typeface="Arial"/><a:font script="Bugi" typeface="Leelawadee UI"/><a:font script="Bopo" typeface="Microsoft JhengHei"/><a:font script="Java" typeface="Javanese Text"/><a:font script="Lisu" typeface="Segoe UI"/><a:font script="Mymr" typeface="Myanmar Text"/><a:font script="Nkoo" typeface="Ebrima"/><a:font script="Olck" typeface="Nirmala UI"/><a:font script="Osma" typeface="Ebrima"/><a:font script="Phag" typeface="Phagspa"/><a:font script="Syrn" typeface="Estrangelo Edessa"/><a:font script="Syrj" typeface="Estrangelo Edessa"/><a:font script="Syre" typeface="Estrangelo Edessa"/><a:font script="Sora" typeface="Nirmala UI"/><a:font script="Tale" typeface="Microsoft Tai Le"/><a:font script="Talu" typeface="Microsoft New Tai Lue"/><a:font script="Tfng" typeface="Ebrima"/></a:minorFont></a:fontScheme><a:fmtScheme name="Office"><a:fillStyleLst><a:solidFill><a:schemeClr val="phClr"/></a:solidFill><a:gradFill rotWithShape="1"><a:gsLst><a:gs pos="0"><a:schemeClr val="phClr"><a:lumMod val="110000"/><a:satMod val="105000"/><a:tint val="67000"/></a:schemeClr></a:gs><a:gs pos="50000"><a:schemeClr val="phClr"><a:lumMod val="105000"/><a:satMod val="103000"/><a:tint val="73000"/></a:schemeClr></a:gs><a:gs pos="100000"><a:schemeClr val="phClr"><a:lumMod val="105000"/><a:satMod val="109000"/><a:tint val="81000"/></a:schemeClr></a:gs></a:gsLst><a:lin ang="5400000" scaled="0"/></a:gradFill><a:gradFill rotWithShape="1"><a:gsLst><a:gs pos="0"><a:schemeClr val="phClr"><a:satMod val="103000"/><a:lumMod val="102000"/><a:tint val="94000"/></a:schemeClr></a:gs><a:gs pos="50000"><a:schemeClr val="phClr"><a:satMod val="110000"/><a:lumMod val="100000"/><a:shade val="100000"/></a:schemeClr></a:gs><a:gs pos="100000"><a:schemeClr val="phClr"><a:lumMod val="99000"/><a:satMod val="120000"/><a:shade val="78000"/></a:schemeClr></a:gs></a:gsLst><a:lin ang="5400000" scaled="0"/></a:gradFill></a:fillStyleLst><a:lnStyleLst><a:ln w="6350" cap="flat" cmpd="sng" algn="ctr"><a:solidFill><a:schemeClr val="phClr"/></a:solidFill><a:prstDash val="solid"/><a:miter lim="800000"/></a:ln><a:ln w="12700" cap="flat" cmpd="sng" algn="ctr"><a:solidFill><a:schemeClr val="phClr"/></a:solidFill><a:prstDash val="solid"/><a:miter lim="800000"/></a:ln><a:ln w="19050" cap="flat" cmpd="sng" algn="ctr"><a:solidFill><a:schemeClr val="phClr"/></a:solidFill><a:prstDash val="solid"/><a:miter lim="800000"/></a:ln></a:lnStyleLst><a:effectStyleLst><a:effectStyle><a:effectLst/></a:effectStyle><a:effectStyle><a:effectLst/></a:effectStyle><a:effectStyle><a:effectLst><a:outerShdw blurRad="57150" dist="19050" dir="5400000" algn="ctr" rotWithShape="0"><a:srgbClr val="000000"><a:alpha val="63000"/></a:srgbClr></a:outerShdw></a:effectLst></a:effectStyle></a:effectStyleLst><a:bgFillStyleLst><a:solidFill><a:schemeClr val="phClr"/></a:solidFill><a:solidFill><a:schemeClr val="phClr"><a:tint val="95000"/><a:satMod val="170000"/></a:schemeClr></a:solidFill><a:gradFill rotWithShape="1"><a:gsLst><a:gs pos="0"><a:schemeClr val="phClr"><a:tint val="93000"/><a:satMod val="150000"/><a:shade val="98000"/><a:lumMod val="102000"/></a:schemeClr></a:gs><a:gs pos="50000"><a:schemeClr val="phClr"><a:tint val="98000"/><a:satMod val="130000"/><a:shade val="90000"/><a:lumMod val="103000"/></a:schemeClr></a:gs><a:gs pos="100000"><a:schemeClr val="phClr"><a:shade val="63000"/><a:satMod val="120000"/></a:schemeClr></a:gs></a:gsLst><a:lin ang="5400000" scaled="0"/></a:gradFill></a:bgFillStyleLst></a:fmtScheme></a:themeElements><a:objectDefaults/><a:extraClrSchemeLst/><a:extLst><a:ext uri="{05A4C25C-085E-4340-85A3-A5531E510DB2}"><thm15:themeFamily xmlns:thm15="http://schemas.microsoft.com/office/thememl/2012/main" name="Office Theme" id="${themeFamilyId}" vid="${themeFamilyVid}"/></a:ext></a:extLst></a:theme>`;
20288
20963
  }
20289
20964
  const package_P15_NS = 'http://schemas.microsoft.com/office/powerpoint/2012/main';
20290
20965
  const SLD_GUIDE_URI = '{EFAFB233-063F-42B5-8137-9DF3F51BA10A}';
@@ -20538,6 +21213,24 @@ class PptxGenJS {
20538
21213
  get author() {
20539
21214
  return this._author;
20540
21215
  }
21216
+ set created(value) {
21217
+ this._created = value;
21218
+ }
21219
+ get created() {
21220
+ return this._created;
21221
+ }
21222
+ set modified(value) {
21223
+ this._modified = value;
21224
+ }
21225
+ get modified() {
21226
+ return this._modified;
21227
+ }
21228
+ set mediaOnError(value) {
21229
+ this._mediaOnError = value === 'placeholder' ? 'placeholder' : 'throw';
21230
+ }
21231
+ get mediaOnError() {
21232
+ return this._mediaOnError;
21233
+ }
20541
21234
  set company(value) {
20542
21235
  this._company = value;
20543
21236
  }
@@ -20822,6 +21515,7 @@ class PptxGenJS {
20822
21515
  });
20823
21516
  }
20824
21517
  }
21518
+ if (options === null || options === void 0 ? void 0 : options.transition) newSlide.transition = options.transition;
20825
21519
  return newSlide;
20826
21520
  }
20827
21521
  /**
@@ -20904,10 +21598,19 @@ class PptxGenJS {
20904
21598
  */ pptxgen_define_property(this, "_layout", void 0);
20905
21599
  /**
20906
21600
  * PptxGenJS Library Version
20907
- */ pptxgen_define_property(this, "_version", (/* inlined export .VERSION */"4.1.17"));
21601
+ */ pptxgen_define_property(this, "_version", (/* inlined export .VERSION */"4.1.18"));
20908
21602
  /**
20909
21603
  * @type {string}
20910
21604
  */ pptxgen_define_property(this, "_author", void 0);
21605
+ /**
21606
+ * OPC `dcterms:created` written to `docProps/core.xml`.
21607
+ */ pptxgen_define_property(this, "_created", void 0);
21608
+ /**
21609
+ * OPC `dcterms:modified` written to `docProps/core.xml`.
21610
+ */ pptxgen_define_property(this, "_modified", void 0);
21611
+ /**
21612
+ * Failed image/media load policy. Default throws so invalid input still fails the export.
21613
+ */ pptxgen_define_property(this, "_mediaOnError", 'throw');
20911
21614
  /**
20912
21615
  * @type {string}
20913
21616
  */ pptxgen_define_property(this, "_company", void 0);
@@ -21037,7 +21740,7 @@ class PptxGenJS {
21037
21740
  * @param {PresSlide | SlideLayout} slide - slide with rels
21038
21741
  * @param {JSZip} zip - JSZip instance
21039
21742
  * @param {Promise<string>[]} chartPromises - promise array
21040
- */ pptxgen_define_property(this, "createChartMediaRels", (slide, zip, chartPromises)=>{
21743
+ */ pptxgen_define_property(this, "createChartMediaRels", (slide, zip, chartPromises, mediaPaths)=>{
21041
21744
  slide._relsChart.forEach((rel)=>chartPromises.push(createExcelWorksheet(rel, zip)));
21042
21745
  slide._relsMedia.forEach((rel)=>{
21043
21746
  if (rel.type !== 'online' && rel.type !== 'hyperlink') {
@@ -21048,8 +21751,11 @@ class PptxGenJS {
21048
21751
  if (!data.includes(',') && !data.includes(';')) data = 'image/png;base64,' + data;
21049
21752
  else if (!data.includes(',')) data = 'image/png;base64,' + data;
21050
21753
  else if (!data.includes(';')) data = 'image/png;' + data;
21051
- // C: Add media
21052
- zip.file(rel.Target.replace(/\.\./g, 'ppt'), (_data_split_pop = data.split(',').pop()) !== null && _data_split_pop !== void 0 ? _data_split_pop : '', {
21754
+ // C: Add media (skip if another rel already wrote this OPC part)
21755
+ const mediaPath = rel.Target.replace(/\.\./g, 'ppt');
21756
+ if (mediaPaths.has(mediaPath)) return;
21757
+ mediaPaths.add(mediaPath);
21758
+ zip.file(mediaPath, (_data_split_pop = data.split(',').pop()) !== null && _data_split_pop !== void 0 ? _data_split_pop : '', {
21053
21759
  base64: true
21054
21760
  });
21055
21761
  }
@@ -21097,12 +21803,18 @@ class PptxGenJS {
21097
21803
  const zip = new JSZip();
21098
21804
  // STEP 1: Read/Encode all Media before zip as base64 content, etc. is required
21099
21805
  this.slides.forEach((slide)=>{
21100
- arrMediaPromises = arrMediaPromises.concat(encodeSlideMediaRels(slide));
21806
+ arrMediaPromises = arrMediaPromises.concat(encodeSlideMediaRels(slide, {
21807
+ onError: this._mediaOnError
21808
+ }));
21101
21809
  });
21102
21810
  this.slideLayouts.forEach((layout)=>{
21103
- arrMediaPromises = arrMediaPromises.concat(encodeSlideMediaRels(layout));
21811
+ arrMediaPromises = arrMediaPromises.concat(encodeSlideMediaRels(layout, {
21812
+ onError: this._mediaOnError
21813
+ }));
21104
21814
  });
21105
- arrMediaPromises = arrMediaPromises.concat(encodeSlideMediaRels(this.masterSlide));
21815
+ arrMediaPromises = arrMediaPromises.concat(encodeSlideMediaRels(this.masterSlide, {
21816
+ onError: this._mediaOnError
21817
+ }));
21106
21818
  // STEP 2: Wait for Promises (if any) then generate the PPTX file
21107
21819
  return yield Promise.all(arrMediaPromises).then(()=>pptxgen_async_to_generator(function*() {
21108
21820
  var _zip_folder, _zip_folder1, _zip_folder2, _zip_folder3, _zip_folder4, _zip_folder5, _zip_folder6;
@@ -21134,9 +21846,11 @@ class PptxGenJS {
21134
21846
  zip.file('[Content_Types].xml', makeXmlContTypes(this.slides, this.slideLayouts, this.masterSlide, trackingParts)); // TODO: pass only `this` like below! 20200206
21135
21847
  zip.file('_rels/.rels', makeXmlRootRels());
21136
21848
  zip.file('docProps/app.xml', makeXmlApp(this.slides, this.company)); // TODO: pass only `this` like below! 20200206
21137
- zip.file('docProps/core.xml', makeXmlCore(this.title, this.subject, this.author, this.revision)); // TODO: pass only `this` like below! 20200206
21849
+ zip.file('docProps/core.xml', makeXmlCore(this.title, this.subject, this.author, this.revision, this.created, this.modified)); // TODO: pass only `this` like below! 20200206
21138
21850
  zip.file('ppt/_rels/presentation.xml.rels', makeXmlPresentationRels(this.slides, trackingParts));
21139
21851
  zip.file('ppt/theme/theme1.xml', makeXmlTheme(this));
21852
+ // notesMaster gets its own theme part (Office repair creates theme2 when notesMaster shares theme1; Juliussssssss 9bdfe09).
21853
+ zip.file('ppt/theme/theme2.xml', makeXmlTheme(this, 'notes'));
21140
21854
  zip.file('ppt/presentation.xml', makeXmlPresentation(this));
21141
21855
  zip.file('ppt/presProps.xml', makeXmlPresProps(this));
21142
21856
  zip.file('ppt/tableStyles.xml', makeXmlTableStyles());
@@ -21180,13 +21894,14 @@ class PptxGenJS {
21180
21894
  zip.file('ppt/notesMasters/notesMaster1.xml', makeXmlNotesMaster());
21181
21895
  zip.file('ppt/notesMasters/_rels/notesMaster1.xml.rels', makeXmlNotesMasterRel());
21182
21896
  // D: Create all Rels (images, media, chart data)
21897
+ const mediaPaths = new Set();
21183
21898
  this.slideLayouts.forEach((layout)=>{
21184
- this.createChartMediaRels(layout, zip, arrChartPromises);
21899
+ this.createChartMediaRels(layout, zip, arrChartPromises, mediaPaths);
21185
21900
  });
21186
21901
  this.slides.forEach((slide)=>{
21187
- this.createChartMediaRels(slide, zip, arrChartPromises);
21902
+ this.createChartMediaRels(slide, zip, arrChartPromises, mediaPaths);
21188
21903
  });
21189
- this.createChartMediaRels(this.masterSlide, zip, arrChartPromises);
21904
+ this.createChartMediaRels(this.masterSlide, zip, arrChartPromises, mediaPaths);
21190
21905
  // E: Wait for Promises (if any) then generate the PPTX file
21191
21906
  return yield Promise.all(arrChartPromises).then(()=>pptxgen_async_to_generator(function*() {
21192
21907
  // E2: Embed custom fonts into the zip before packing (`addFont` → ppt/fonts/*.fntdata)
@@ -21305,6 +22020,8 @@ class PptxGenJS {
21305
22020
  addShape: notOnMaster,
21306
22021
  addTable: notOnMaster,
21307
22022
  addText: notOnMaster,
22023
+ addGroup: notOnMaster,
22024
+ addWordArt: notOnMaster,
21308
22025
  addTransition: notOnMaster,
21309
22026
  addAnimation: notOnMaster,
21310
22027
  addComment: notOnMaster,