pptxgenjs-plus 4.1.20 → 4.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
- /* PptxGenJS 4.1.20 @ 2026-08-21T04:05:04.745Z */
1
+ /* PptxGenJS 4.2.1 @ 2026-08-24T13:58:39.969Z */
2
2
 
3
3
  import { JSZip } from "@node-projects/jszip";
4
4
  import { parseXml } from "@rgrove/parse-xml";
@@ -15,6 +15,34 @@ const ONEPT = 12700 // One (1) point (pt)
15
15
  const CRLF = '\r\n' // AKA: Chr(13) & Chr(10)
16
16
  ;
17
17
  const LAYOUT_IDX_SERIES_BASE = 2147483649;
18
+ /** ECMA-376 20.1.10.55 ST_RectAlignment — where a tiled picture fill starts */ const TILE_ALIGNMENTS = new Set([
19
+ 'tl',
20
+ 't',
21
+ 'tr',
22
+ 'l',
23
+ 'ctr',
24
+ 'r',
25
+ 'bl',
26
+ 'b',
27
+ 'br'
28
+ ]);
29
+ /**
30
+ * ECMA-376 20.1.6.2 CT_ColorMapping - the identity map, which is what `a:masterClrMapping` means
31
+ * - all twelve attributes are required, so a partial `colorMapOverride` is filled from this
32
+ */ const DEF_COLOR_MAP = Object.freeze({
33
+ bg1: 'lt1',
34
+ tx1: 'dk1',
35
+ bg2: 'lt2',
36
+ tx2: 'dk2',
37
+ accent1: 'accent1',
38
+ accent2: 'accent2',
39
+ accent3: 'accent3',
40
+ accent4: 'accent4',
41
+ accent5: 'accent5',
42
+ accent6: 'accent6',
43
+ hlink: 'hlink',
44
+ folHlink: 'folHlink'
45
+ });
18
46
  const REGEX_HEX_COLOR = /^[0-9a-fA-F]{6}$/;
19
47
  const LINEH_MODIFIER = 1.67 // AKA: Golden Ratio Typography
20
48
  ;
@@ -90,6 +118,306 @@ const AXIS_ID_VALUE_SECONDARY = '2094734553';
90
118
  const AXIS_ID_CATEGORY_PRIMARY = '2094734554';
91
119
  const AXIS_ID_CATEGORY_SECONDARY = '2094734555';
92
120
  const AXIS_ID_SERIES_PRIMARY = '2094734556';
121
+ /** ECMA-376 20.1.10.51 ST_SchemeColorVal - every slot `a:schemeClr@val` accepts */ const SCHEME_COLOR_VALUES = new Set([
122
+ 'bg1',
123
+ 'tx1',
124
+ 'bg2',
125
+ 'tx2',
126
+ 'dk1',
127
+ 'lt1',
128
+ 'dk2',
129
+ 'lt2',
130
+ 'accent1',
131
+ 'accent2',
132
+ 'accent3',
133
+ 'accent4',
134
+ 'accent5',
135
+ 'accent6',
136
+ 'hlink',
137
+ 'folHlink',
138
+ 'phClr'
139
+ ]);
140
+ /** ECMA-376 20.1.10.58 ST_SystemColorVal - `a:sysClr@val` */ const SYSTEM_COLOR_VALUES = new Set([
141
+ 'scrollBar',
142
+ 'background',
143
+ 'activeCaption',
144
+ 'inactiveCaption',
145
+ 'menu',
146
+ 'window',
147
+ 'windowFrame',
148
+ 'menuText',
149
+ 'windowText',
150
+ 'captionText',
151
+ 'activeBorder',
152
+ 'inactiveBorder',
153
+ 'appWorkspace',
154
+ 'highlight',
155
+ 'highlightText',
156
+ 'btnFace',
157
+ 'btnShadow',
158
+ 'grayText',
159
+ 'btnText',
160
+ 'inactiveCaptionText',
161
+ 'btnHighlight',
162
+ '3dDkShadow',
163
+ '3dLight',
164
+ 'infoText',
165
+ 'infoBk',
166
+ 'hotLight',
167
+ 'gradientActiveCaption',
168
+ 'gradientInactiveCaption',
169
+ 'menuHighlight',
170
+ 'menuBar'
171
+ ]);
172
+ /** ECMA-376 20.1.10.48 ST_PresetColorVal - the 140 named preset colors for `a:prstClr@val` */ const PRESET_COLOR_VALUES = new Set([
173
+ 'aliceBlue',
174
+ 'antiqueWhite',
175
+ 'aqua',
176
+ 'aquamarine',
177
+ 'azure',
178
+ 'beige',
179
+ 'bisque',
180
+ 'black',
181
+ 'blanchedAlmond',
182
+ 'blue',
183
+ 'blueViolet',
184
+ 'brown',
185
+ 'burlyWood',
186
+ 'cadetBlue',
187
+ 'chartreuse',
188
+ 'chocolate',
189
+ 'coral',
190
+ 'cornflowerBlue',
191
+ 'cornsilk',
192
+ 'crimson',
193
+ 'cyan',
194
+ 'darkBlue',
195
+ 'darkCyan',
196
+ 'darkGoldenrod',
197
+ 'darkGray',
198
+ 'darkGrey',
199
+ 'darkGreen',
200
+ 'darkKhaki',
201
+ 'darkMagenta',
202
+ 'darkOliveGreen',
203
+ 'darkOrange',
204
+ 'darkOrchid',
205
+ 'darkRed',
206
+ 'darkSalmon',
207
+ 'darkSeaGreen',
208
+ 'darkSlateBlue',
209
+ 'darkSlateGray',
210
+ 'darkSlateGrey',
211
+ 'darkTurquoise',
212
+ 'darkViolet',
213
+ 'deepPink',
214
+ 'deepSkyBlue',
215
+ 'dimGray',
216
+ 'dimGrey',
217
+ 'dkBlue',
218
+ 'dkCyan',
219
+ 'dkGoldenrod',
220
+ 'dkGray',
221
+ 'dkGrey',
222
+ 'dkGreen',
223
+ 'dkKhaki',
224
+ 'dkMagenta',
225
+ 'dkOliveGreen',
226
+ 'dkOrange',
227
+ 'dkOrchid',
228
+ 'dkRed',
229
+ 'dkSalmon',
230
+ 'dkSeaGreen',
231
+ 'dkSlateBlue',
232
+ 'dkSlateGray',
233
+ 'dkSlateGrey',
234
+ 'dkTurquoise',
235
+ 'dkViolet',
236
+ 'dodgerBlue',
237
+ 'firebrick',
238
+ 'floralWhite',
239
+ 'forestGreen',
240
+ 'fuchsia',
241
+ 'gainsboro',
242
+ 'ghostWhite',
243
+ 'gold',
244
+ 'goldenrod',
245
+ 'gray',
246
+ 'grey',
247
+ 'green',
248
+ 'greenYellow',
249
+ 'honeydew',
250
+ 'hotPink',
251
+ 'indianRed',
252
+ 'indigo',
253
+ 'ivory',
254
+ 'khaki',
255
+ 'lavender',
256
+ 'lavenderBlush',
257
+ 'lawnGreen',
258
+ 'lemonChiffon',
259
+ 'lightBlue',
260
+ 'lightCoral',
261
+ 'lightCyan',
262
+ 'lightGoldenrodYellow',
263
+ 'lightGray',
264
+ 'lightGrey',
265
+ 'lightGreen',
266
+ 'lightPink',
267
+ 'lightSalmon',
268
+ 'lightSeaGreen',
269
+ 'lightSkyBlue',
270
+ 'lightSlateGray',
271
+ 'lightSlateGrey',
272
+ 'lightSteelBlue',
273
+ 'lightYellow',
274
+ 'lime',
275
+ 'limeGreen',
276
+ 'linen',
277
+ 'ltBlue',
278
+ 'ltCoral',
279
+ 'ltCyan',
280
+ 'ltGoldenrodYellow',
281
+ 'ltGray',
282
+ 'ltGrey',
283
+ 'ltGreen',
284
+ 'ltPink',
285
+ 'ltSalmon',
286
+ 'ltSeaGreen',
287
+ 'ltSkyBlue',
288
+ 'ltSlateGray',
289
+ 'ltSlateGrey',
290
+ 'ltSteelBlue',
291
+ 'ltYellow',
292
+ 'magenta',
293
+ 'maroon',
294
+ 'medAquamarine',
295
+ 'medBlue',
296
+ 'medOrchid',
297
+ 'medPurple',
298
+ 'medSeaGreen',
299
+ 'medSlateBlue',
300
+ 'medSpringGreen',
301
+ 'medTurquoise',
302
+ 'medVioletRed',
303
+ 'mediumAquamarine',
304
+ 'mediumBlue',
305
+ 'mediumOrchid',
306
+ 'mediumPurple',
307
+ 'mediumSeaGreen',
308
+ 'mediumSlateBlue',
309
+ 'mediumSpringGreen',
310
+ 'mediumTurquoise',
311
+ 'mediumVioletRed',
312
+ 'midnightBlue',
313
+ 'mintCream',
314
+ 'mistyRose',
315
+ 'moccasin',
316
+ 'navajoWhite',
317
+ 'navy',
318
+ 'oldLace',
319
+ 'olive',
320
+ 'oliveDrab',
321
+ 'orange',
322
+ 'orangeRed',
323
+ 'orchid',
324
+ 'paleGoldenrod',
325
+ 'paleGreen',
326
+ 'paleTurquoise',
327
+ 'paleVioletRed',
328
+ 'papayaWhip',
329
+ 'peachPuff',
330
+ 'peru',
331
+ 'pink',
332
+ 'plum',
333
+ 'powderBlue',
334
+ 'purple',
335
+ 'red',
336
+ 'rosyBrown',
337
+ 'royalBlue',
338
+ 'saddleBrown',
339
+ 'salmon',
340
+ 'sandyBrown',
341
+ 'seaGreen',
342
+ 'seaShell',
343
+ 'sienna',
344
+ 'silver',
345
+ 'skyBlue',
346
+ 'slateBlue',
347
+ 'slateGray',
348
+ 'slateGrey',
349
+ 'snow',
350
+ 'springGreen',
351
+ 'steelBlue',
352
+ 'tan',
353
+ 'teal',
354
+ 'thistle',
355
+ 'tomato',
356
+ 'turquoise',
357
+ 'violet',
358
+ 'wheat',
359
+ 'white',
360
+ 'whiteSmoke',
361
+ 'yellow',
362
+ 'yellowGreen'
363
+ ]);
364
+ /** ECMA-376 20.1.10.23 ST_CompoundLine - `a:ln@cmpd` */ const COMPOUND_TYPES = new Set([
365
+ 'sng',
366
+ 'dbl',
367
+ 'thickThin',
368
+ 'thinThick',
369
+ 'tri'
370
+ ]);
371
+ /** ECMA-376 20.1.10.34/35 ST_LineEndWidth and ST_LineEndLength - arrow sizing */ const ARROW_SIZES = new Set([
372
+ 'sm',
373
+ 'med',
374
+ 'lg'
375
+ ]);
376
+ /**
377
+ * Chart style and chart colour-style parts (MS-ODRAWXML)
378
+ * - verified against Microsoft's own `ChartStylePart`/`ChartColorStylePart` definitions in
379
+ * dotnet/Open-XML-SDK, cross-checked against LibreOffice, rubyXL and OpenXLSX
380
+ * - note the asymmetry: the namespace is dated 2012, the relationships 2011. That is correct.
381
+ */ const CHART_STYLE = Object.freeze({
382
+ ns: 'http://schemas.microsoft.com/office/drawing/2012/chartStyle',
383
+ styleContentType: 'application/vnd.ms-office.chartstyle+xml',
384
+ colorsContentType: 'application/vnd.ms-office.chartcolorstyle+xml',
385
+ styleRelType: 'http://schemas.microsoft.com/office/2011/relationships/chartStyle',
386
+ colorsRelType: 'http://schemas.microsoft.com/office/2011/relationships/chartColorStyle'
387
+ });
388
+ /**
389
+ * ChartEx (PowerPoint 2016+) package contract - MS-ODRAWXML 2.1.
390
+ *
391
+ * These chart types have no ECMA-376 representation: they live in their own `cx:chartSpace` part with a
392
+ * Microsoft content type and relationship type, and the slide-level `p:graphicFrame` must sit inside an
393
+ * `mc:AlternateContent` so consumers that predate them still get a fallback.
394
+ *
395
+ * The `requires` namespace is the schema generation a consumer must understand before it may take the
396
+ * `mc:Choice`; funnel arrived a revision after the 2016 launch set, so it gates on a later one.
397
+ */ const OOXML_CHARTEX = {
398
+ /** `cx` - the chartex part's own namespace, and the `a:graphicData@uri` that identifies the frame */ ns: 'http://schemas.microsoft.com/office/drawing/2014/chartex',
399
+ partContentType: 'application/vnd.ms-office.chartex+xml',
400
+ relType: 'http://schemas.microsoft.com/office/2014/relationships/chartEx',
401
+ /** `mc:Choice@Requires` namespace for the Office 2016 launch layouts */ requires2016: 'http://schemas.microsoft.com/office/drawing/2015/9/8/chartex',
402
+ /** `mc:Choice@Requires` namespace for funnel, which shipped a schema revision later */ requiresFunnel: 'http://schemas.microsoft.com/office/drawing/2015/10/21/chartex'
403
+ };
404
+ /** `cx:series@layoutId` per chart type - a histogram is a `clusteredColumn` layout carrying `cx:binning` */ const CHARTEX_LAYOUT_ID = {
405
+ boxWhisker: 'boxWhisker',
406
+ funnel: 'funnel',
407
+ histogram: 'clusteredColumn',
408
+ sunburst: 'sunburst',
409
+ treemap: 'treemap',
410
+ waterfall: 'waterfall'
411
+ };
412
+ /**
413
+ * `mc:Choice@Requires` namespace gating a chartex chart type
414
+ * - funnel arrived a schema revision after the 2016 launch layouts, so it gates on a later generation
415
+ */ function chartExRequiresNs(chartType) {
416
+ return chartType === 'funnel' ? OOXML_CHARTEX.requiresFunnel : OOXML_CHARTEX.requires2016;
417
+ }
418
+ /** True when `type` is emitted through the chartex pipeline rather than the ECMA-376 one */ function isChartexType(type) {
419
+ return typeof type === 'string' && Object.prototype.hasOwnProperty.call(CHARTEX_LAYOUT_ID, type);
420
+ }
93
421
  /**
94
422
  * Slide transition type.
95
423
  * Base set is ECMA-376 §19.3.1.50; the rest are MS-PPTX §2.2.1 modern transitions (emitted via mc:AlternateContent).
@@ -206,6 +534,27 @@ var core_enums_TEXT_VALIGN = /*#__PURE__*/ function(TEXT_VALIGN) {
206
534
  return TEXT_VALIGN;
207
535
  }({});
208
536
  const SLDNUMFLDID = '{F7021451-1387-4CA6-816F-3879F97B5CBC}';
537
+ /** ECMA-376 21.1.2.2.4 — `a:fld@type` values PowerPoint refreshes */ const TEXT_FIELD_TYPES = new Set([
538
+ 'slidenum',
539
+ 'datetime',
540
+ 'datetimeFigureOut',
541
+ 'datetime1',
542
+ 'datetime2',
543
+ 'datetime3',
544
+ 'datetime4',
545
+ 'datetime5',
546
+ 'datetime6',
547
+ 'datetime7',
548
+ 'datetime8',
549
+ 'datetime9',
550
+ 'datetime10',
551
+ 'datetime11',
552
+ 'datetime12',
553
+ 'datetime13',
554
+ 'headerfooter',
555
+ 'hdr',
556
+ 'ftr'
557
+ ]);
209
558
  // ENUM
210
559
  // TODO: 3.5 or v4.0: rationalize ts-def exported enum names/case!
211
560
  // NOTE: First tsdef enum named correctly (shapes -> 'Shape', colors -> 'Color'), etc.
@@ -229,6 +578,12 @@ var core_enums_ChartType = /*#__PURE__*/ function(ChartType) {
229
578
  ChartType["pie"] = "pie";
230
579
  ChartType["radar"] = "radar";
231
580
  ChartType["scatter"] = "scatter";
581
+ ChartType["boxWhisker"] = "boxWhisker";
582
+ ChartType["funnel"] = "funnel";
583
+ ChartType["histogram"] = "histogram";
584
+ ChartType["sunburst"] = "sunburst";
585
+ ChartType["treemap"] = "treemap";
586
+ ChartType["waterfall"] = "waterfall";
232
587
  return ChartType;
233
588
  }({});
234
589
  var core_enums_ShapeType = /*#__PURE__*/ function(ShapeType) {
@@ -256,6 +611,10 @@ var core_enums_ShapeType = /*#__PURE__*/ function(ShapeType) {
256
611
  ShapeType["actionButtonSound"] = "actionButtonSound";
257
612
  ShapeType["arc"] = "arc";
258
613
  ShapeType["bentArrow"] = "bentArrow";
614
+ ShapeType["bentConnector2"] = "bentConnector2";
615
+ ShapeType["bentConnector3"] = "bentConnector3";
616
+ ShapeType["bentConnector4"] = "bentConnector4";
617
+ ShapeType["bentConnector5"] = "bentConnector5";
259
618
  ShapeType["bentUpArrow"] = "bentUpArrow";
260
619
  ShapeType["bevel"] = "bevel";
261
620
  ShapeType["blockArc"] = "blockArc";
@@ -279,6 +638,10 @@ var core_enums_ShapeType = /*#__PURE__*/ function(ShapeType) {
279
638
  ShapeType["corner"] = "corner";
280
639
  ShapeType["cornerTabs"] = "cornerTabs";
281
640
  ShapeType["cube"] = "cube";
641
+ ShapeType["curvedConnector2"] = "curvedConnector2";
642
+ ShapeType["curvedConnector3"] = "curvedConnector3";
643
+ ShapeType["curvedConnector4"] = "curvedConnector4";
644
+ ShapeType["curvedConnector5"] = "curvedConnector5";
282
645
  ShapeType["curvedDownArrow"] = "curvedDownArrow";
283
646
  ShapeType["curvedLeftArrow"] = "curvedLeftArrow";
284
647
  ShapeType["curvedRightArrow"] = "curvedRightArrow";
@@ -399,6 +762,7 @@ var core_enums_ShapeType = /*#__PURE__*/ function(ShapeType) {
399
762
  ShapeType["star6"] = "star6";
400
763
  ShapeType["star7"] = "star7";
401
764
  ShapeType["star8"] = "star8";
765
+ ShapeType["straightConnector1"] = "straightConnector1";
402
766
  ShapeType["stripedRightArrow"] = "stripedRightArrow";
403
767
  ShapeType["sun"] = "sun";
404
768
  ShapeType["swooshArrow"] = "swooshArrow";
@@ -430,6 +794,13 @@ var core_enums_ShapeType = /*#__PURE__*/ function(ShapeType) {
430
794
  SchemeColor["accent4"] = "accent4";
431
795
  SchemeColor["accent5"] = "accent5";
432
796
  SchemeColor["accent6"] = "accent6";
797
+ SchemeColor["dk1"] = "dk1";
798
+ SchemeColor["lt1"] = "lt1";
799
+ SchemeColor["dk2"] = "dk2";
800
+ SchemeColor["lt2"] = "lt2";
801
+ SchemeColor["hlink"] = "hlink";
802
+ SchemeColor["folHlink"] = "folHlink";
803
+ SchemeColor["phClr"] = "phClr";
433
804
  return SchemeColor;
434
805
  }({});
435
806
  var core_enums_AlignH = /*#__PURE__*/ function(AlignH) {
@@ -472,6 +843,10 @@ var core_enums_SHAPE_TYPE = /*#__PURE__*/ function(SHAPE_TYPE) {
472
843
  SHAPE_TYPE["ARC"] = "arc";
473
844
  SHAPE_TYPE["BALLOON"] = "wedgeRoundRectCallout";
474
845
  SHAPE_TYPE["BENT_ARROW"] = "bentArrow";
846
+ SHAPE_TYPE["BENT_CONNECTOR_2"] = "bentConnector2";
847
+ SHAPE_TYPE["BENT_CONNECTOR_3"] = "bentConnector3";
848
+ SHAPE_TYPE["BENT_CONNECTOR_4"] = "bentConnector4";
849
+ SHAPE_TYPE["BENT_CONNECTOR_5"] = "bentConnector5";
475
850
  SHAPE_TYPE["BENT_UP_ARROW"] = "bentUpArrow";
476
851
  SHAPE_TYPE["BEVEL"] = "bevel";
477
852
  SHAPE_TYPE["BLOCK_ARC"] = "blockArc";
@@ -488,6 +863,10 @@ var core_enums_SHAPE_TYPE = /*#__PURE__*/ function(SHAPE_TYPE) {
488
863
  SHAPE_TYPE["CORNER_TABS"] = "cornerTabs";
489
864
  SHAPE_TYPE["CROSS"] = "plus";
490
865
  SHAPE_TYPE["CUBE"] = "cube";
866
+ SHAPE_TYPE["CURVED_CONNECTOR_2"] = "curvedConnector2";
867
+ SHAPE_TYPE["CURVED_CONNECTOR_3"] = "curvedConnector3";
868
+ SHAPE_TYPE["CURVED_CONNECTOR_4"] = "curvedConnector4";
869
+ SHAPE_TYPE["CURVED_CONNECTOR_5"] = "curvedConnector5";
491
870
  SHAPE_TYPE["CURVED_DOWN_ARROW"] = "curvedDownArrow";
492
871
  SHAPE_TYPE["CURVED_DOWN_RIBBON"] = "ellipseRibbon";
493
872
  SHAPE_TYPE["CURVED_LEFT_ARROW"] = "curvedLeftArrow";
@@ -629,6 +1008,7 @@ var core_enums_SHAPE_TYPE = /*#__PURE__*/ function(SHAPE_TYPE) {
629
1008
  SHAPE_TYPE["STAR_6_POINT"] = "star6";
630
1009
  SHAPE_TYPE["STAR_7_POINT"] = "star7";
631
1010
  SHAPE_TYPE["STAR_8_POINT"] = "star8";
1011
+ SHAPE_TYPE["STRAIGHT_CONNECTOR_1"] = "straightConnector1";
632
1012
  SHAPE_TYPE["STRIPED_RIGHT_ARROW"] = "stripedRightArrow";
633
1013
  SHAPE_TYPE["SUN"] = "sun";
634
1014
  SHAPE_TYPE["SWOOSH_ARROW"] = "swooshArrow";
@@ -648,13 +1028,19 @@ var core_enums_CHART_TYPE = /*#__PURE__*/ function(CHART_TYPE) {
648
1028
  CHART_TYPE["AREA"] = "area";
649
1029
  CHART_TYPE["BAR"] = "bar";
650
1030
  CHART_TYPE["BAR3D"] = "bar3D";
1031
+ CHART_TYPE["BOX_WHISKER"] = "boxWhisker";
651
1032
  CHART_TYPE["BUBBLE"] = "bubble";
652
1033
  CHART_TYPE["BUBBLE3D"] = "bubble3D";
653
1034
  CHART_TYPE["DOUGHNUT"] = "doughnut";
1035
+ CHART_TYPE["FUNNEL"] = "funnel";
1036
+ CHART_TYPE["HISTOGRAM"] = "histogram";
654
1037
  CHART_TYPE["LINE"] = "line";
655
1038
  CHART_TYPE["PIE"] = "pie";
656
1039
  CHART_TYPE["RADAR"] = "radar";
657
1040
  CHART_TYPE["SCATTER"] = "scatter";
1041
+ CHART_TYPE["SUNBURST"] = "sunburst";
1042
+ CHART_TYPE["TREEMAP"] = "treemap";
1043
+ CHART_TYPE["WATERFALL"] = "waterfall";
658
1044
  return CHART_TYPE;
659
1045
  }({});
660
1046
  var core_enums_SCHEME_COLOR_NAMES = /*#__PURE__*/ function(SCHEME_COLOR_NAMES) {
@@ -954,13 +1340,37 @@ function _object_spread_props(target, source) {
954
1340
  }
955
1341
  return code;
956
1342
  }
1343
+ /** Units per inch, for the length suffixes accepted on `x`/`y`/`w`/`h` and the other inch-valued options */ const UNITS_PER_INCH = {
1344
+ in: 1,
1345
+ cm: 2.54,
1346
+ mm: 25.4,
1347
+ pt: 72
1348
+ };
1349
+ /**
1350
+ * A number with a length suffix - `'2.5cm'`, `'-4mm'`, `'18pt'`, `'5in'`
1351
+ * - the mantissa alternates rather than using `\d*\.?\d+`: that form lets the two digit runs
1352
+ * split a plain integer many ways, so a long non-matching digit string backtracks quadratically
1353
+ */ const REGEX_UNIT_LENGTH = /^\s*(-?(?:\d+(?:\.\d+)?|\.\d+))\s*(in|cm|mm|pt)\s*$/i;
1354
+ /**
1355
+ * Parse a unit-suffixed length into inches
1356
+ * - a suffixed value carries its own unit, so it bypasses the inches-vs-EMU magnitude heuristic entirely
1357
+ * @param {string} value - ex: `'2.5cm'`, `'18pt'`
1358
+ * @returns {number|undefined} inches, or `undefined` when `value` is not a suffixed length
1359
+ */ function parseUnitLength(value) {
1360
+ const match = REGEX_UNIT_LENGTH.exec(value);
1361
+ if (!match) return undefined;
1362
+ const num = Number(match[1]);
1363
+ if (!Number.isFinite(num)) return undefined;
1364
+ return num / UNITS_PER_INCH[match[2].toLowerCase()];
1365
+ }
957
1366
  /**
958
1367
  * Translates any type of `x`/`y`/`w`/`h` prop to EMU
959
1368
  * - guaranteed to return a result regardless of undefined, null, etc. (0)
960
1369
  * - {number} - 12800 (EMU)
961
1370
  * - {number} - 0.5 (inches)
962
1371
  * - {string} - "75%"
963
- * @param {number|string} size - numeric ("5.5") or percentage ("90%")
1372
+ * - {string} - "2.5cm" (also in/mm/pt)
1373
+ * @param {number|string} size - numeric ("5.5"), unit-suffixed ("2.5cm") or percentage ("90%")
964
1374
  * @param {'X' | 'Y'} xyDir - direction
965
1375
  * @param {PresLayout} layout - presentation layout
966
1376
  * @returns {number} calculated size
@@ -973,7 +1383,12 @@ function _object_spread_props(target, source) {
973
1383
  // CASE 2: Number is already converted to something other than inches
974
1384
  // Assume any number whose absolute value is 100+ is EMU already.
975
1385
  if (typeof size === 'number' && Math.abs(size) >= 100) return size;
976
- // CASE 3: Percentage (ex: '50%')
1386
+ // CASE 3: Unit-suffixed length (ex: '2.5cm') - unambiguous, so no magnitude heuristic
1387
+ if (typeof size === 'string') {
1388
+ const inches = parseUnitLength(size);
1389
+ if (inches !== undefined) return Math.round((/* inlined export .EMU */914400) * inches);
1390
+ }
1391
+ // CASE 4: Percentage (ex: '50%')
977
1392
  if (typeof size === 'string' && size.includes('%')) {
978
1393
  if (xyDir && xyDir === 'X') return Math.round(parseFloat(size) / 100 * layout.width);
979
1394
  if (xyDir && xyDir === 'Y') return Math.round(parseFloat(size) / 100 * layout.height);
@@ -1037,6 +1452,11 @@ function _object_spread_props(target, source) {
1037
1452
  * @param {number|string} inches - as string or number
1038
1453
  * @returns {number} EMU value
1039
1454
  */ function inch2Emu(inches) {
1455
+ // A unit-suffixed string states its own unit - convert it before any inches assumption
1456
+ if (typeof inches === 'string') {
1457
+ const parsed = parseUnitLength(inches);
1458
+ if (parsed !== undefined) return Math.round((/* inlined export .EMU */914400) * parsed);
1459
+ }
1040
1460
  // NOTE: Provide Caller Safety: Numbers may get conv<->conv during flight, so be kind and do some simple checks to ensure inches were passed
1041
1461
  // Any absolute value over 100 is not inches (negative EMU is off-slide), so return it unchanged
1042
1462
  if (typeof inches === 'number' && Math.abs(inches) > 100) return inches;
@@ -1137,6 +1557,20 @@ function _object_spread_props(target, source) {
1137
1557
  function isModifiedThemeColor(value) {
1138
1558
  return typeof value === 'object' && value !== null && 'baseColor' in value;
1139
1559
  }
1560
+ /**
1561
+ * Whether a value is a DrawingML color object rather than a fill object
1562
+ * - the six specification fields are unique to `ColorProps`
1563
+ */ function isColorProps(value) {
1564
+ if (!value || typeof value !== 'object') return false;
1565
+ return [
1566
+ 'hex',
1567
+ 'scheme',
1568
+ 'system',
1569
+ 'preset',
1570
+ 'hsl',
1571
+ 'scrgb'
1572
+ ].some((key)=>key in value);
1573
+ }
1140
1574
  /** Percent-based OOXML color transforms (0-100 → val*1000) */ const PERCENT_COLOR_MODIFIERS = [
1141
1575
  'alpha',
1142
1576
  'alphaMod',
@@ -1198,11 +1632,86 @@ const FLAG_COLOR_MODIFIERS = [
1198
1632
  * @example [gen-charts.tx] `strXml += '<a:solidFill>' + createColorElement(seriesColor, `<a:alpha val="${Math.round(opts.chartColorsOpacity * 1000)}"/>`) + '</a:solidFill>'`
1199
1633
  * Thi sis wrong. We s/b calling `genXmlColorSelection()` instead as it returns `<a:solidfill>BLAH</a:solidFill>`!!
1200
1634
  */ /**
1635
+ * DrawingML stores percentages in 1000ths of a percent
1636
+ * - `CT_PositiveFixedPercentage` (tint, shade, alpha) is 0-100
1637
+ * - `CT_FixedPercentage` (the `*Off` transforms) is -100 to 100
1638
+ * - `CT_PositivePercentage` (the `*Mod` transforms) is a *scale* and is unbounded above
1639
+ */ function gen_utils_pct(value, min = 0, max = 100) {
1640
+ const clamped = Math.min(max, Math.max(min, isFinite(value) ? value : 0));
1641
+ return String(Math.round(clamped * 1000));
1642
+ }
1643
+ /**
1644
+ * Create the color transform children shared by every ColorProps element (ECMA-376 20.1.2.3)
1645
+ */ function createColorTransforms(props) {
1646
+ let xml = '';
1647
+ if (typeof props.tint === 'number') xml += `<a:tint val="${gen_utils_pct(props.tint)}"/>`;
1648
+ if (typeof props.shade === 'number') xml += `<a:shade val="${gen_utils_pct(props.shade)}"/>`;
1649
+ if (props.inverse === true) xml += '<a:inv/>';
1650
+ if (props.grayscale === true) xml += '<a:gray/>';
1651
+ if (typeof props.alpha === 'number') xml += `<a:alpha val="${gen_utils_pct(props.alpha)}"/>`;
1652
+ if (typeof props.alphaOff === 'number') xml += `<a:alphaOff val="${gen_utils_pct(props.alphaOff, -100, 100)}"/>`;
1653
+ if (typeof props.alphaMod === 'number') xml += `<a:alphaMod val="${gen_utils_pct(props.alphaMod, 0, Number.MAX_SAFE_INTEGER)}"/>`;
1654
+ if (typeof props.hueMod === 'number') xml += `<a:hueMod val="${gen_utils_pct(props.hueMod, 0, Number.MAX_SAFE_INTEGER)}"/>`;
1655
+ if (typeof props.hueOff === 'number') xml += `<a:hueOff val="${Math.round(Math.min(360, Math.max(-360, isFinite(props.hueOff) ? props.hueOff : 0)) * 60000)}"/>`;
1656
+ if (typeof props.satMod === 'number') xml += `<a:satMod val="${gen_utils_pct(props.satMod, 0, Number.MAX_SAFE_INTEGER)}"/>`;
1657
+ if (typeof props.satOff === 'number') xml += `<a:satOff val="${gen_utils_pct(props.satOff, -100, 100)}"/>`;
1658
+ if (typeof props.lumMod === 'number') xml += `<a:lumMod val="${gen_utils_pct(props.lumMod, 0, Number.MAX_SAFE_INTEGER)}"/>`;
1659
+ if (typeof props.lumOff === 'number') xml += `<a:lumOff val="${gen_utils_pct(props.lumOff, -100, 100)}"/>`;
1660
+ if (props.complement === true) xml += '<a:comp/>';
1661
+ if (props.gamma === true) xml += '<a:gamma/>';
1662
+ if (props.inverseGamma === true) xml += '<a:invGamma/>';
1663
+ return xml;
1664
+ }
1665
+ /**
1666
+ * Create the color element for a `ColorProps` object
1667
+ */ function createColorPropsElement(props, extra) {
1668
+ const inner = createColorTransforms(props) + extra;
1669
+ const wrap = (tag, attrs)=>inner ? `<a:${tag} ${attrs}>${inner}</a:${tag}>` : `<a:${tag} ${attrs}/>`;
1670
+ if ('hex' in props) {
1671
+ var _props_hex;
1672
+ const hex = String((_props_hex = props.hex) !== null && _props_hex !== void 0 ? _props_hex : '').replace('#', '');
1673
+ if (!REGEX_HEX_COLOR.test(hex)) {
1674
+ console.warn(`[pptxgenjs] "${hex}" is not a 6-digit hex color - "${(/* inlined export .DEF_FONT_COLOR */"000000")}" used instead`);
1675
+ return wrap('srgbClr', `val="${(/* inlined export .DEF_FONT_COLOR */"000000")}"`);
1676
+ }
1677
+ return wrap('srgbClr', `val="${hex.toUpperCase()}"`);
1678
+ }
1679
+ if ('scheme' in props) {
1680
+ if (!SCHEME_COLOR_VALUES.has(props.scheme)) {
1681
+ console.warn(`[pptxgenjs] "${String(props.scheme)}" is not a theme color slot - "${(/* inlined export .DEF_FONT_COLOR */"000000")}" used instead`);
1682
+ return wrap('srgbClr', `val="${(/* inlined export .DEF_FONT_COLOR */"000000")}"`);
1683
+ }
1684
+ return wrap('schemeClr', `val="${props.scheme}"`);
1685
+ }
1686
+ if ('system' in props) {
1687
+ if (!SYSTEM_COLOR_VALUES.has(props.system)) {
1688
+ console.warn(`[pptxgenjs] "${String(props.system)}" is not a system color - "${(/* inlined export .DEF_FONT_COLOR */"000000")}" used instead`);
1689
+ return wrap('srgbClr', `val="${(/* inlined export .DEF_FONT_COLOR */"000000")}"`);
1690
+ }
1691
+ const last = props.lastColor && REGEX_HEX_COLOR.test(props.lastColor.replace('#', '')) ? ` lastClr="${props.lastColor.replace('#', '').toUpperCase()}"` : '';
1692
+ return wrap('sysClr', `val="${props.system}"${last}`);
1693
+ }
1694
+ if ('preset' in props) {
1695
+ if (!PRESET_COLOR_VALUES.has(props.preset)) {
1696
+ console.warn(`[pptxgenjs] "${String(props.preset)}" is not a preset color name - "${(/* inlined export .DEF_FONT_COLOR */"000000")}" used instead`);
1697
+ return wrap('srgbClr', `val="${(/* inlined export .DEF_FONT_COLOR */"000000")}"`);
1698
+ }
1699
+ return wrap('prstClr', `val="${props.preset}"`);
1700
+ }
1701
+ if ('hsl' in props) {
1702
+ const hue = Math.round(((props.hsl.hue % 360 + 360) % 360 || 0) * 60000);
1703
+ return wrap('hslClr', `hue="${isFinite(hue) ? hue : 0}" sat="${gen_utils_pct(props.hsl.sat)}" lum="${gen_utils_pct(props.hsl.lum)}"`);
1704
+ }
1705
+ return wrap('scrgbClr', `r="${gen_utils_pct(props.scrgb.r)}" g="${gen_utils_pct(props.scrgb.g)}" b="${gen_utils_pct(props.scrgb.b)}"`);
1706
+ }
1707
+ /**
1201
1708
  * Create either a `a:schemeClr` - (scheme color) or `a:srgbClr` (hexa representation).
1202
- * @param {Color|SCHEME_COLORS} colorInput - hex, scheme token, or ModifiedThemeColor
1709
+ * Object forms (`ColorProps`, `ModifiedThemeColor`) reach the rest of the DrawingML color model.
1710
+ * @param {Color|SCHEME_COLORS} colorInput - hex, scheme token, ModifiedThemeColor, or ColorProps
1203
1711
  * @param {string} innerElements - additional elements that adjust the color and are enclosed by the color element
1204
1712
  * @returns {string} XML string
1205
1713
  */ function createColorElement(colorInput, innerElements) {
1714
+ if (isColorProps(colorInput)) return createColorPropsElement(colorInput, innerElements !== null && innerElements !== void 0 ? innerElements : '');
1206
1715
  const base = isModifiedThemeColor(colorInput) ? colorInput.baseColor : colorInput;
1207
1716
  const colorStr = typeof base === 'string' ? base : (/* inlined export .DEF_FONT_COLOR */"000000");
1208
1717
  let colorVal = (colorStr || '').replace('#', '');
@@ -1210,7 +1719,7 @@ const FLAG_COLOR_MODIFIERS = [
1210
1719
  if (isModifiedThemeColor(colorInput)) {
1211
1720
  kids += handleModifiedColorProps(colorInput);
1212
1721
  }
1213
- if (!REGEX_HEX_COLOR.test(colorVal) && colorVal !== core_enums_SchemeColor.background1 && colorVal !== core_enums_SchemeColor.background2 && colorVal !== core_enums_SchemeColor.text1 && colorVal !== core_enums_SchemeColor.text2 && colorVal !== core_enums_SchemeColor.accent1 && colorVal !== core_enums_SchemeColor.accent2 && colorVal !== core_enums_SchemeColor.accent3 && colorVal !== core_enums_SchemeColor.accent4 && colorVal !== core_enums_SchemeColor.accent5 && colorVal !== core_enums_SchemeColor.accent6) {
1722
+ if (!REGEX_HEX_COLOR.test(colorVal) && !SCHEME_COLOR_VALUES.has(colorVal)) {
1214
1723
  console.warn(`"${colorVal}" is not a valid scheme color or hex RGB! "${(/* inlined export .DEF_FONT_COLOR */"000000")}" used instead. Only provide 6-digit RGB or 'pptx.SchemeColor' values!`);
1215
1724
  colorVal = (/* inlined export .DEF_FONT_COLOR */"000000");
1216
1725
  }
@@ -1330,6 +1839,23 @@ function createGlowElement(glow) {
1330
1839
  const bg = String((pattern === null || pattern === void 0 ? void 0 : pattern.bgColor) || 'FFFFFF');
1331
1840
  return `<a:pattFill prst="${prst}"><a:bgClr>${createColorElement(bg)}</a:bgClr><a:fgClr>${createColorElement(fg)}</a:fgClr></a:pattFill>`;
1332
1841
  }
1842
+ /**
1843
+ * Create a DrawingML `a:blipFill` for a picture fill (ECMA-376 20.1.8.14)
1844
+ * - the image relationship is resolved when the object is created
1845
+ */ function createImageFillElement(image, rId) {
1846
+ let mode = '<a:stretch><a:fillRect/></a:stretch>';
1847
+ if (image.sizing === 'tile') {
1848
+ var _image_alignment;
1849
+ const scale = typeof image.scale === 'number' && isFinite(image.scale) && image.scale > 0 ? Math.round(image.scale * 1000) : 100000;
1850
+ const rawAlgn = (_image_alignment = image.alignment) !== null && _image_alignment !== void 0 ? _image_alignment : 'tl';
1851
+ const algn = TILE_ALIGNMENTS.has(rawAlgn) ? rawAlgn : 'tl';
1852
+ if (image.alignment && !TILE_ALIGNMENTS.has(image.alignment)) {
1853
+ console.warn(`[pptxgenjs] unknown tile alignment "${String(image.alignment)}" - "tl" used instead`);
1854
+ }
1855
+ mode = `<a:tile tx="0" ty="0" sx="${scale}" sy="${scale}" flip="none" algn="${algn}"/>`;
1856
+ }
1857
+ return `<a:blipFill rotWithShape="${image.rotateWithShape === false ? '0' : '1'}"><a:blip r:embed="rId${rId}"/>${mode}</a:blipFill>`;
1858
+ }
1333
1859
  /**
1334
1860
  * Create color selection
1335
1861
  * @param {Color | ShapeFillProps | ShapeLineProps} props fill props
@@ -1340,27 +1866,45 @@ function createGlowElement(glow) {
1340
1866
  let internalElements = '';
1341
1867
  let outText = '';
1342
1868
  if (props) {
1343
- // ModifiedThemeColor as a bare Color value (must not be treated as ShapeFillProps)
1869
+ // A bare color - string, ModifiedThemeColor, or ColorProps - is a solid fill of that color
1344
1870
  if (typeof props === 'string') {
1345
1871
  colorVal = props;
1346
- } else if (isModifiedThemeColor(props)) {
1872
+ } else if (isModifiedThemeColor(props) || isColorProps(props)) {
1347
1873
  colorVal = props;
1348
1874
  } else {
1875
+ var _props_image;
1349
1876
  if (props.type) fillType = props.type;
1877
+ else if (((_props_image = props.image) === null || _props_image === void 0 ? void 0 : _props_image._rId) || props._rId) fillType = 'image';
1350
1878
  if (props.color) colorVal = props.color;
1351
1879
  if (props.alpha) internalElements += `<a:alpha val="${Math.round((100 - props.alpha) * 1000)}"/>`; // DEPRECATED: @deprecated v3.3.0
1352
1880
  if (props.transparency) internalElements += `<a:alpha val="${Math.round((100 - props.transparency) * 1000)}"/>`;
1353
1881
  }
1882
+ const isBareColor = typeof props === 'string' || isModifiedThemeColor(props) || isColorProps(props);
1354
1883
  switch(fillType){
1355
1884
  case 'solid':
1356
1885
  outText += `<a:solidFill>${createColorElement(colorVal, internalElements)}</a:solidFill>`;
1357
1886
  break;
1358
1887
  case 'gradient':
1359
1888
  case 'linearGradient':
1360
- outText += createGradientFillElement(typeof props === 'string' || isModifiedThemeColor(props) ? undefined : resolveGradientProps(props), colorVal || '', internalElements);
1889
+ outText += createGradientFillElement(isBareColor ? undefined : resolveGradientProps(props), colorVal || '', internalElements);
1361
1890
  break;
1362
1891
  case 'pattern':
1363
- outText += createPatternFillElement(typeof props === 'string' || isModifiedThemeColor(props) ? undefined : props.pattern, typeof colorVal === 'string' ? colorVal : String(colorVal.baseColor));
1892
+ outText += createPatternFillElement(isBareColor ? undefined : props.pattern, typeof colorVal === 'string' ? colorVal : isModifiedThemeColor(colorVal) ? String(colorVal.baseColor) : (/* inlined export .DEF_FONT_COLOR */"000000"));
1893
+ break;
1894
+ case 'image':
1895
+ {
1896
+ var _ref;
1897
+ const image = isBareColor ? undefined : props.image;
1898
+ const rId = (_ref = image === null || image === void 0 ? void 0 : image._rId) !== null && _ref !== void 0 ? _ref : isBareColor ? undefined : props._rId;
1899
+ if (rId) {
1900
+ outText += createImageFillElement(image !== null && image !== void 0 ? image : {}, rId);
1901
+ } else {
1902
+ console.warn('[pptxgenjs] `fill.type:"image"` requires `fill.image.data` or `fill.image.path` - fill omitted');
1903
+ }
1904
+ break;
1905
+ }
1906
+ case 'group':
1907
+ outText += '<a:grpFill/>';
1364
1908
  break;
1365
1909
  case 'none':
1366
1910
  outText += '<a:noFill/>';
@@ -1390,8 +1934,8 @@ function createGlowElement(glow) {
1390
1934
  // Work on a copy - never mutate the caller's options object
1391
1935
  ShadowProps = _object_spread({}, ShadowProps);
1392
1936
  // OPT: `type`
1393
- if (ShadowProps.type !== 'outer' && ShadowProps.type !== 'inner' && ShadowProps.type !== 'none') {
1394
- console.warn('Warning: shadow.type options are `outer`, `inner` or `none`.');
1937
+ if (ShadowProps.type !== 'outer' && ShadowProps.type !== 'inner' && ShadowProps.type !== 'none' && ShadowProps.type !== 'preset') {
1938
+ console.warn('Warning: shadow.type options are `outer`, `inner`, `preset` or `none`.');
1395
1939
  ShadowProps.type = 'outer';
1396
1940
  }
1397
1941
  // OPT: `angle`
@@ -2285,6 +2829,188 @@ function gen_tables_object_spread(target) {
2285
2829
  });
2286
2830
  }
2287
2831
 
2832
+ /**
2833
+ * Hyperlinks and mouse-over actions.
2834
+ *
2835
+ * DrawingML gives the same concept two element names depending on where it appears:
2836
+ *
2837
+ * | host | click | mouse-over |
2838
+ * | :-- | :-- | :-- |
2839
+ * | `p:cNvPr` (shapes, pictures) | `a:hlinkClick` (20.1.2.2.22) | `a:hlinkHover` (20.1.2.2.23) |
2840
+ * | `a:rPr` (text runs) | `a:hlinkClick` | `a:hlinkMouseOver` (21.1.2.3.6) |
2841
+ *
2842
+ * Emitting `a:hlinkHover` inside `a:rPr` — or `a:hlinkMouseOver` inside `p:cNvPr` — produces markup
2843
+ * PowerPoint cannot parse, so the host decides the element name here rather than at each call site.
2844
+ */
2845
+ /**
2846
+ * Build one `a:hlinkClick` / mouse-over element
2847
+ * @param {HyperlinkProps} link - link props
2848
+ * @param {'click' | 'hover'} trigger - which interaction this element describes
2849
+ * @param {HyperlinkHost} host - the element the link is attached to
2850
+ * @param {string} children - child elements (`a:snd`, `a:extLst`); self-closes when empty
2851
+ * @returns {string} XML string
2852
+ */ function genXmlHyperlink(link, trigger, host, children = '') {
2853
+ var _link__rId;
2854
+ const tag = trigger === 'click' ? 'a:hlinkClick' : host === 'run' ? 'a:hlinkMouseOver' : 'a:hlinkHover';
2855
+ let attrs = `r:id="rId${(_link__rId = link._rId) !== null && _link__rId !== void 0 ? _link__rId : 0}"`;
2856
+ if (link.slide) {
2857
+ // an internal jump has no URL; the action attribute names the target kind
2858
+ attrs += ' action="ppaction://hlinksldjump"';
2859
+ } else {
2860
+ attrs += ' invalidUrl="" action="" tgtFrame=""';
2861
+ }
2862
+ attrs += ` tooltip="${link.tooltip ? encodeXmlEntities(link.tooltip) : ''}"`;
2863
+ if (!link.slide) attrs += ' history="1"';
2864
+ // both default to false in the schema, so only write them when turned on
2865
+ if (link.highlightClick === true) attrs += ' highlightClick="1"';
2866
+ if (link.stopSoundsOnClick === true) attrs += ' endSnd="1"';
2867
+ const sound = genXmlHyperlinkSound(link);
2868
+ const inner = sound + children;
2869
+ return inner ? `<${tag} ${attrs}>${inner}</${tag}>` : `<${tag} ${attrs}/>`;
2870
+ }
2871
+ /**
2872
+ * Build the `a:snd` action sound (ECMA-376 20.1.2.2.32 `CT_EmbeddedWAVAudioFile`)
2873
+ * - the relationship is resolved when the object is created, so `_sndRId` is set by then
2874
+ * @param {HyperlinkProps} link - link props
2875
+ * @returns {string} XML string
2876
+ */ function genXmlHyperlinkSound(link) {
2877
+ var _link_sound_name;
2878
+ var _link_sound;
2879
+ if (!((_link_sound = link.sound) === null || _link_sound === void 0 ? void 0 : _link_sound._sndRId)) return '';
2880
+ return `<a:snd r:embed="rId${link.sound._sndRId}" name="${encodeXmlEntities((_link_sound_name = link.sound.name) !== null && _link_sound_name !== void 0 ? _link_sound_name : 'sound.wav')}"/>`;
2881
+ }
2882
+
2883
+ function line_define_property(obj, key, value) {
2884
+ if (key in obj) {
2885
+ Object.defineProperty(obj, key, {
2886
+ value: value,
2887
+ enumerable: true,
2888
+ configurable: true,
2889
+ writable: true
2890
+ });
2891
+ } else obj[key] = value;
2892
+ return obj;
2893
+ }
2894
+ function line_object_spread(target) {
2895
+ for(var i = 1; i < arguments.length; i++){
2896
+ var source = arguments[i] != null ? arguments[i] : {};
2897
+ var ownKeys = Object.keys(source);
2898
+ if (typeof Object.getOwnPropertySymbols === "function") {
2899
+ ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
2900
+ return Object.getOwnPropertyDescriptor(source, sym).enumerable;
2901
+ }));
2902
+ }
2903
+ ownKeys.forEach(function(key) {
2904
+ line_define_property(target, key, source[key]);
2905
+ });
2906
+ }
2907
+ return target;
2908
+ }
2909
+ function line_ownKeys(object, enumerableOnly) {
2910
+ var keys = Object.keys(object);
2911
+ if (Object.getOwnPropertySymbols) {
2912
+ var symbols = Object.getOwnPropertySymbols(object);
2913
+ if (enumerableOnly) {
2914
+ symbols = symbols.filter(function(sym) {
2915
+ return Object.getOwnPropertyDescriptor(object, sym).enumerable;
2916
+ });
2917
+ }
2918
+ keys.push.apply(keys, symbols);
2919
+ }
2920
+ return keys;
2921
+ }
2922
+ function line_object_spread_props(target, source) {
2923
+ source = source != null ? source : {};
2924
+ if (Object.getOwnPropertyDescriptors) Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
2925
+ else {
2926
+ line_ownKeys(Object(source)).forEach(function(key) {
2927
+ Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
2928
+ });
2929
+ }
2930
+ return target;
2931
+ }
2932
+ /**
2933
+ * PptxGenJS: Line properties (`a:ln` and its aliases)
2934
+ *
2935
+ * The same `CT_LineProperties` content model is used by shape outlines (`a:ln`), underlines
2936
+ * (`a:uLn`), and table cell borders, so the element name is a parameter rather than baked in.
2937
+ */
2938
+
2939
+ /**
2940
+ * Create a line element
2941
+ * @param {ShapeLineProps} line - line options
2942
+ * @param {string} tag - element name; `a:ln` for a shape outline, `a:uLn` for an underline
2943
+ * @return {string} XML
2944
+ */ function genXmlLine(line, tag = 'a:ln') {
2945
+ // ECMA-376 §5.1.2.1.34: `<a:ln>` carries `w`, `cap`, and `cmpd` attributes
2946
+ const cap = line.cap && [
2947
+ 'flat',
2948
+ 'sq',
2949
+ 'rnd'
2950
+ ].includes(line.cap) ? ` cap="${line.cap}"` : '';
2951
+ const compound = COMPOUND_TYPES.has(String(line.compound)) ? ` cmpd="${String(line.compound)}"` : '';
2952
+ if (line.compound && !COMPOUND_TYPES.has(String(line.compound))) {
2953
+ console.warn(`[pptxgenjs] line \`compound\` must be one of ${[
2954
+ ...COMPOUND_TYPES
2955
+ ].join(', ')} - "${String(line.compound)}" ignored`);
2956
+ }
2957
+ const attrs = (line.width ? ` w="${valToPts(line.width)}"` : '') + cap + compound;
2958
+ let xml = `<${tag}${attrs}>`;
2959
+ const hasGrad = !!(line.gradient || line.type === 'gradient' || line.type === 'linearGradient');
2960
+ if (line.type !== 'none' && (line.color || hasGrad)) {
2961
+ xml += genXmlColorSelection(hasGrad && !line.type ? line_object_spread_props(line_object_spread({}, line), {
2962
+ type: 'gradient'
2963
+ }) : line);
2964
+ }
2965
+ // CT_LineProperties sequence: fill, dash, join, headEnd, tailEnd. A custom pattern replaces
2966
+ // the preset one - emitting both would be ambiguous, since `a:custDash` is the same choice.
2967
+ xml += genXmlDash(line);
2968
+ xml += genXmlJoin(line);
2969
+ xml += genXmlArrow('a:headEnd', line.beginArrowType, line.beginArrowSize);
2970
+ xml += genXmlArrow('a:tailEnd', line.endArrowType, line.endArrowSize);
2971
+ xml += `</${tag}>`;
2972
+ return xml;
2973
+ }
2974
+ /** The dash choice: a custom pattern when given, otherwise the preset */ function genXmlDash(line) {
2975
+ var _line_custDash;
2976
+ const stops = ((_line_custDash = line.custDash) !== null && _line_custDash !== void 0 ? _line_custDash : []).filter((stop)=>{
2977
+ const ok = typeof (stop === null || stop === void 0 ? void 0 : stop.dash) === 'number' && isFinite(stop.dash) && stop.dash > 0 && typeof stop.space === 'number' && isFinite(stop.space) && stop.space >= 0;
2978
+ if (!ok) console.warn('[pptxgenjs] each `custDash` stop needs a positive `dash` and a non-negative `space` (percent of line width) - stop ignored');
2979
+ return ok;
2980
+ });
2981
+ if (stops.length > 0) {
2982
+ const items = stops.map((stop)=>`<a:ds d="${Math.round(stop.dash * 1000)}" sp="${Math.round(stop.space * 1000)}"/>`).join('');
2983
+ return `<a:custDash>${items}</a:custDash>`;
2984
+ }
2985
+ return line.dashType ? `<a:prstDash val="${line.dashType}"/>` : '';
2986
+ }
2987
+ /** The join choice: `a:round`, `a:bevel`, or `a:miter` with its limit */ function genXmlJoin(line) {
2988
+ if (!line.join) return '';
2989
+ if (line.join === 'round') return '<a:round/>';
2990
+ if (line.join === 'bevel') return '<a:bevel/>';
2991
+ if (line.join === 'miter') {
2992
+ const lim = typeof line.miterLimit === 'number' && isFinite(line.miterLimit) && line.miterLimit >= 0 ? line.miterLimit : 800;
2993
+ return `<a:miter lim="${Math.round(lim * 1000)}"/>`;
2994
+ }
2995
+ console.warn(`[pptxgenjs] line \`join\` must be 'round' | 'bevel' | 'miter' - "${String(line.join)}" ignored`);
2996
+ return '';
2997
+ }
2998
+ function resolveArrowSize(size) {
2999
+ if (!size) return undefined;
3000
+ if (typeof size === 'string') return {
3001
+ width: size,
3002
+ length: size
3003
+ };
3004
+ return size;
3005
+ }
3006
+ /** An arrow end with its optional sizing */ function genXmlArrow(tag, type, size) {
3007
+ if (!type) return '';
3008
+ const resolved = resolveArrowSize(size);
3009
+ const w = ARROW_SIZES.has(String(resolved === null || resolved === void 0 ? void 0 : resolved.width)) ? ` w="${String(resolved === null || resolved === void 0 ? void 0 : resolved.width)}"` : '';
3010
+ const len = ARROW_SIZES.has(String(resolved === null || resolved === void 0 ? void 0 : resolved.length)) ? ` len="${String(resolved === null || resolved === void 0 ? void 0 : resolved.length)}"` : '';
3011
+ return `<${tag} type="${type}"${w}${len}/>`;
3012
+ }
3013
+
2288
3014
  function text_define_property(obj, key, value) {
2289
3015
  if (key in obj) {
2290
3016
  Object.defineProperty(obj, key, {
@@ -2337,6 +3063,7 @@ function text_object_spread_props(target, source) {
2337
3063
  /**
2338
3064
  * Text-body, run, and placeholder rendering.
2339
3065
  */
3066
+
2340
3067
  /** ECMA-376 §5.1.12.76 `ST_TextShapeType` — used to validate `a:prstTxWarp@prst`. */ const TEXT_SHAPE_TYPES = new Set([
2341
3068
  'textNoShape',
2342
3069
  'textPlain',
@@ -2381,6 +3108,26 @@ function text_object_spread_props(target, source) {
2381
3108
  'textCascadeDown'
2382
3109
  ]);
2383
3110
 
3111
+
3112
+ /**
3113
+ * Build the `a:buClr` / `a:buSzPct` / `a:buSzPts` / `a:buFont` prefix shared by every bullet kind
3114
+ * - the size defaults to 100% because that is what every branch emitted before
3115
+ */ function genXmlBulletPrefix(bullet) {
3116
+ let xml = '';
3117
+ if (bullet.color) xml += `<a:buClr>${createColorElement(bullet.color)}</a:buClr>`;
3118
+ // `a:buSzPct` and `a:buSzPts` are the same choice, so only one may appear
3119
+ if (typeof bullet.sizePts === 'number' && isFinite(bullet.sizePts) && bullet.sizePts > 0) {
3120
+ xml += `<a:buSzPts val="${Math.round(bullet.sizePts * 100)}"/>`;
3121
+ } else {
3122
+ const pct = typeof bullet.size === 'number' && isFinite(bullet.size) ? Math.min(400, Math.max(25, bullet.size)) : 100;
3123
+ if (typeof bullet.size === 'number' && (bullet.size < 25 || bullet.size > 400)) {
3124
+ console.warn(`[pptxgenjs] bullet \`size\` must be between 25 and 400 percent - "${String(bullet.size)}" clamped`);
3125
+ }
3126
+ xml += `<a:buSzPct val="${Math.round(pct * 1000)}"/>`;
3127
+ }
3128
+ if (bullet.fontFace) xml += `<a:buFont typeface="${encodeXmlEntities(bullet.fontFace)}"/>`;
3129
+ return xml;
3130
+ }
2384
3131
  /**
2385
3132
  * Generate XML Paragraph Properties
2386
3133
  * @param {ISlideObject|TextProps} textObj - text object
@@ -2389,7 +3136,6 @@ function text_object_spread_props(target, source) {
2389
3136
  */ function genXmlParagraphProperties(textObj, isDefault) {
2390
3137
  var _textObj_options;
2391
3138
  let strXmlBullet = '';
2392
- let strXmlBulletColor = '';
2393
3139
  let strXmlLnSpc = '';
2394
3140
  let strXmlParaSpc = '';
2395
3141
  let strXmlTabStops = '';
@@ -2428,6 +3174,21 @@ function text_object_spread_props(target, source) {
2428
3174
  if (options.indentLevel && !isNaN(Number(options.indentLevel)) && options.indentLevel > 0) {
2429
3175
  paragraphPropXml += ` lvl="${options.indentLevel}"`;
2430
3176
  }
3177
+ // Remaining CT_TextParagraphProperties attributes - omitted unless set
3178
+ const para = options;
3179
+ if (typeof para.marR === 'number' && isFinite(para.marR) && para.marR >= 0) paragraphPropXml += ` marR="${inch2Emu(para.marR)}"`;
3180
+ if (typeof para.defTabSz === 'number' && isFinite(para.defTabSz) && para.defTabSz > 0) paragraphPropXml += ` defTabSz="${inch2Emu(para.defTabSz)}"`;
3181
+ if ([
3182
+ 'auto',
3183
+ 't',
3184
+ 'ctr',
3185
+ 'base',
3186
+ 'b'
3187
+ ].includes(String(para.fontAlgn))) paragraphPropXml += ` fontAlgn="${String(para.fontAlgn)}"`;
3188
+ // these three default to true in the schema, so only write them when turned off
3189
+ if (para.eaLnBrk === false) paragraphPropXml += ' eaLnBrk="0"';
3190
+ if (para.latinLnBrk === false) paragraphPropXml += ' latinLnBrk="0"';
3191
+ if (para.hangingPunct === false) paragraphPropXml += ' hangingPunct="0"';
2431
3192
  // OPTION: Paragraph Spacing: Before/After
2432
3193
  if (options.paraSpaceBefore && !isNaN(Number(options.paraSpaceBefore)) && options.paraSpaceBefore > 0) {
2433
3194
  strXmlParaSpc += `<a:spcBef><a:spcPts val="${Math.round(options.paraSpaceBefore * 100)}"/></a:spcBef>`;
@@ -2441,10 +3202,17 @@ function text_object_spread_props(target, source) {
2441
3202
  if (typeof options.bullet === 'object') {
2442
3203
  var _options_bullet;
2443
3204
  if ((_options_bullet = options.bullet) === null || _options_bullet === void 0 ? void 0 : _options_bullet.indent) bulletMarL = valToPts(options.bullet.indent);
2444
- if (options.bullet.type && options.bullet.type.toString().toLowerCase() === 'number') {
3205
+ const buPrefix = genXmlBulletPrefix(options.bullet);
3206
+ const buIndent = ` marL="${options.indentLevel && options.indentLevel > 0 ? bulletMarL + bulletMarL * options.indentLevel : bulletMarL}" indent="-${bulletMarL}"`;
3207
+ if (options.bullet.image && options.bullet._imageRId) {
3208
+ // `a:buBlip` replaces the character or number bullet entirely
3209
+ paragraphPropXml += buIndent;
3210
+ strXmlBullet = `${buPrefix}<a:buBlip><a:blip r:embed="rId${options.bullet._imageRId}"/></a:buBlip>`;
3211
+ } else if (options.bullet.type && options.bullet.type.toString().toLowerCase() === 'number') {
2445
3212
  // NOTE: only `type: 'number'` is a distinct branch; any other `type` (e.g. 'bullet') falls through to the char-bullet cases below (issue #1432)
2446
- paragraphPropXml += ` marL="${options.indentLevel && options.indentLevel > 0 ? bulletMarL + bulletMarL * options.indentLevel : bulletMarL}" indent="-${bulletMarL}"`;
2447
- strXmlBullet = `<a:buSzPct val="100000"/><a:buFont typeface="+mj-lt"/><a:buAutoNum type="${options.bullet.style || 'arabicPeriod'}" startAt="${options.bullet.numberStartAt || options.bullet.startAt || '1'}"/>`;
3213
+ paragraphPropXml += buIndent;
3214
+ // auto-numbered bullets fall back to the major latin face when none is given
3215
+ strXmlBullet = `${buPrefix}${options.bullet.fontFace ? '' : '<a:buFont typeface="+mj-lt"/>'}<a:buAutoNum type="${options.bullet.numberType || options.bullet.style || 'arabicPeriod'}" startAt="${options.bullet.numberStartAt || options.bullet.startAt || '1'}"/>`;
2448
3216
  } else if (options.bullet.characterCode) {
2449
3217
  let bulletCode = `&#x${options.bullet.characterCode};`;
2450
3218
  // Check value for hex-ness (s/b 4 char hex)
@@ -2452,8 +3220,8 @@ function text_object_spread_props(target, source) {
2452
3220
  console.warn('Warning: `bullet.characterCode should be a 4-digit unicode charatcer (ex: 22AB)`!');
2453
3221
  bulletCode = (/* inlined export .BULLET_TYPES.DEFAULT */"&#x2022;");
2454
3222
  }
2455
- paragraphPropXml += ` marL="${options.indentLevel && options.indentLevel > 0 ? bulletMarL + bulletMarL * options.indentLevel : bulletMarL}" indent="-${bulletMarL}"`;
2456
- strXmlBullet = '<a:buSzPct val="100000"/><a:buChar char="' + bulletCode + '"/>';
3223
+ paragraphPropXml += buIndent;
3224
+ strXmlBullet = `${buPrefix}<a:buChar char="${bulletCode}"/>`;
2457
3225
  } else if (options.bullet.code) {
2458
3226
  // @deprecated `bullet.code` v3.3.0
2459
3227
  let bulletCode = `&#x${options.bullet.code};`;
@@ -2462,15 +3230,11 @@ function text_object_spread_props(target, source) {
2462
3230
  console.warn('Warning: `bullet.code should be a 4-digit hex code (ex: 22AB)`!');
2463
3231
  bulletCode = (/* inlined export .BULLET_TYPES.DEFAULT */"&#x2022;");
2464
3232
  }
2465
- paragraphPropXml += ` marL="${options.indentLevel && options.indentLevel > 0 ? bulletMarL + bulletMarL * options.indentLevel : bulletMarL}" indent="-${bulletMarL}"`;
2466
- strXmlBullet = '<a:buSzPct val="100000"/><a:buChar char="' + bulletCode + '"/>';
3233
+ paragraphPropXml += buIndent;
3234
+ strXmlBullet = `${buPrefix}<a:buChar char="${bulletCode}"/>`;
2467
3235
  } else {
2468
- paragraphPropXml += ` marL="${options.indentLevel && options.indentLevel > 0 ? bulletMarL + bulletMarL * options.indentLevel : bulletMarL}" indent="-${bulletMarL}"`;
2469
- strXmlBullet = `<a:buSzPct val="100000"/><a:buChar char="${(/* inlined export .BULLET_TYPES.DEFAULT */"&#x2022;")}"/>`;
2470
- }
2471
- // mikemeerschaert/add-color-option-to-bullets — buClr must precede buSz*/buChar (OOXML order)
2472
- if (options.bullet.color) {
2473
- strXmlBulletColor = `<a:buClr>${createColorElement(options.bullet.color)}</a:buClr>`;
3236
+ paragraphPropXml += buIndent;
3237
+ strXmlBullet = `${buPrefix}<a:buChar char="${(/* inlined export .BULLET_TYPES.DEFAULT */"&#x2022;")}"/>`;
2474
3238
  }
2475
3239
  } else if (options.bullet) {
2476
3240
  paragraphPropXml += ` marL="${options.indentLevel && options.indentLevel > 0 ? bulletMarL + bulletMarL * options.indentLevel : bulletMarL}" indent="-${bulletMarL}"`;
@@ -2487,7 +3251,7 @@ function text_object_spread_props(target, source) {
2487
3251
  }
2488
3252
  // B: Close Paragraph-Properties
2489
3253
  // IMPORTANT: strXmlLnSpc, strXmlParaSpc, buClr, and strXmlBullet require strict ordering - anything out of order is ignored. (PPT-Online, PPT for Mac)
2490
- paragraphPropXml += '>' + strXmlLnSpc + strXmlParaSpc + strXmlBulletColor + strXmlBullet + strXmlTabStops;
3254
+ paragraphPropXml += '>' + strXmlLnSpc + strXmlParaSpc + strXmlBullet + strXmlTabStops;
2491
3255
  if (isDefault) paragraphPropXml += genXmlTextRunProperties(options, true);
2492
3256
  paragraphPropXml += '</' + tag + '>';
2493
3257
  }
@@ -2499,7 +3263,7 @@ function text_object_spread_props(target, source) {
2499
3263
  * @param {boolean} isDefault - whether these are the default text run properties
2500
3264
  * @return {string} XML
2501
3265
  */ function genXmlTextRunProperties(opts, isDefault) {
2502
- var _opts_underline;
3266
+ var _opts_underline, _opts_hyperlinkHover;
2503
3267
  let runProps = '';
2504
3268
  const runPropsTag = isDefault ? 'a:defRPr' : 'a:rPr';
2505
3269
  // BEGIN runProperties (ex: `<a:rPr lang="en-US" sz="1600" b="1" dirty="0">`)
@@ -2531,9 +3295,14 @@ function text_object_spread_props(target, source) {
2531
3295
  'small',
2532
3296
  'all'
2533
3297
  ].includes(opts.caps) ? ` cap="${opts.caps}"` : '';
2534
- runProps += ' dirty="0">';
2535
- // Color / Font / Highlight / Outline are children of <a:rPr>, so add them now before closing the runProperties tag
2536
- if (opts.color || opts.gradient || opts.fontFace || opts.fontFaceEa || opts.fontFaceCs || opts.outline || typeof opts.underline === 'object' && opts.underline.color) {
3298
+ if (opts.kumimoji === true) runProps += ' kumimoji="1"';
3299
+ const run = opts;
3300
+ if (run.normalizeH === true) runProps += ' normalizeH="1"';
3301
+ if (run.noProof === true) runProps += ' noProof="1"';
3302
+ // `dirty` was hardcoded to 0; it stays the default so existing output does not change
3303
+ runProps += ` dirty="${run.dirty === true ? '1' : '0'}">`;
3304
+ // CT_TextCharacterProperties child order: ln, fill, effect, highlight, uLn, uFill, latin, ea, cs, sym
3305
+ if (opts.color || opts.gradient || opts.fontFace || opts.fontFaceEa || opts.fontFaceCs || opts.fontFaceSym || opts.outline || opts.glow || opts.highlight || run.underlineLine || typeof opts.underline === 'object' && opts.underline.color) {
2537
3306
  if (opts.outline && typeof opts.outline === 'object') {
2538
3307
  runProps += `<a:ln w="${valToPts(opts.outline.size || 0.75)}">${genXmlColorSelection({
2539
3308
  color: opts.outline.color || 'FFFFFF',
@@ -2550,10 +3319,12 @@ function text_object_spread_props(target, source) {
2550
3319
  color: opts.color,
2551
3320
  transparency: opts.transparency
2552
3321
  });
2553
- if (opts.highlight) runProps += `<a:highlight>${createColorElement(opts.highlight)}</a:highlight>`;
2554
- if (typeof opts.underline === 'object' && opts.underline.color) runProps += `<a:uFill>${genXmlColorSelection(opts.underline.color)}</a:uFill>`;
2555
3322
  const resolvedGlow = resolveGlowOptions(opts.glow);
2556
3323
  if (resolvedGlow) runProps += `<a:effectLst>${createGlowElement(resolvedGlow)}</a:effectLst>`;
3324
+ if (opts.highlight) runProps += `<a:highlight>${createColorElement(opts.highlight)}</a:highlight>`;
3325
+ if (run.underlineLine === 'text') runProps += '<a:uLnTx/>';
3326
+ else if (run.underlineLine && typeof run.underlineLine === 'object') runProps += genXmlLine(run.underlineLine, 'a:uLn');
3327
+ if (typeof opts.underline === 'object' && opts.underline.color) runProps += `<a:uFill>${genXmlColorSelection(opts.underline.color)}</a:uFill>`;
2557
3328
  const latin = opts.fontFace;
2558
3329
  const ea = opts.fontFaceEa || opts.fontFace;
2559
3330
  const cs = opts.fontFaceCs || opts.fontFace;
@@ -2563,26 +3334,19 @@ function text_object_spread_props(target, source) {
2563
3334
  if (ea) runProps += `<a:ea typeface="${encodeXmlEntities(ea)}" pitchFamily="34" charset="-122"/>`;
2564
3335
  if (cs) runProps += `<a:cs typeface="${encodeXmlEntities(cs)}" pitchFamily="34" charset="-120"/>`;
2565
3336
  }
3337
+ if (opts.fontFaceSym) runProps += `<a:sym typeface="${encodeXmlEntities(opts.fontFaceSym)}"/>`;
2566
3338
  }
2567
3339
  // Hyperlink support
2568
3340
  if (opts.hyperlink) {
2569
3341
  if (typeof opts.hyperlink !== 'object') throw new Error('ERROR: text `hyperlink` option should be an object. Ex: `hyperlink:{url:\'https://github.com\'}` ');
2570
3342
  else if (!opts.hyperlink.url && !opts.hyperlink.slide) throw new Error('ERROR: \'hyperlink requires either `url` or `slide`\'');
2571
- else if (opts.hyperlink.url) {
2572
- // runProps += '<a:uFill>'+ genXmlColorSelection('0000FF') +'</a:uFill>'; // Breaks PPT2010! (Issue#74)
2573
- runProps += `<a:hlinkClick r:id="rId${opts.hyperlink._rId}" invalidUrl="" action="" tgtFrame="" tooltip="${opts.hyperlink.tooltip ? encodeXmlEntities(opts.hyperlink.tooltip) : ''}" history="1" highlightClick="0" endSnd="0"${opts.color ? '>' : '/>'}`;
2574
- } else if (opts.hyperlink.slide) {
2575
- runProps += `<a:hlinkClick r:id="rId${opts.hyperlink._rId}" action="ppaction://hlinksldjump" tooltip="${opts.hyperlink.tooltip ? encodeXmlEntities(opts.hyperlink.tooltip) : ''}"${opts.color ? '>' : '/>'}`;
2576
- }
2577
- if (opts.color) {
2578
- runProps += ' <a:extLst>';
2579
- runProps += ' <a:ext uri="{A12FA001-AC4F-418D-AE19-62706E023703}">';
2580
- runProps += ' <ahyp:hlinkClr xmlns:ahyp="http://schemas.microsoft.com/office/drawing/2018/hyperlinkcolor" val="tx"/>';
2581
- runProps += ' </a:ext>';
2582
- runProps += ' </a:extLst>';
2583
- runProps += '</a:hlinkClick>';
2584
- }
3343
+ // A colored link keeps its run color instead of the theme's hyperlink color (issue #74: an
3344
+ // `a:uFill` here breaks PPT2010, so the extension is used rather than an underline fill)
3345
+ const linkColorExt = opts.color ? '<a:extLst><a:ext uri="{A12FA001-AC4F-418D-AE19-62706E023703}"><ahyp:hlinkClr xmlns:ahyp="http://schemas.microsoft.com/office/drawing/2018/hyperlinkcolor" val="tx"/></a:ext></a:extLst>' : '';
3346
+ runProps += genXmlHyperlink(opts.hyperlink, 'click', 'run', linkColorExt);
2585
3347
  }
3348
+ // `a:hlinkMouseOver` follows `a:hlinkClick` in CT_TextCharacterProperties
3349
+ if ((_opts_hyperlinkHover = opts.hyperlinkHover) === null || _opts_hyperlinkHover === void 0 ? void 0 : _opts_hyperlinkHover._rId) runProps += genXmlHyperlink(opts.hyperlinkHover, 'hover', 'run');
2586
3350
  // END runProperties
2587
3351
  runProps += `</${runPropsTag}>`;
2588
3352
  return runProps;
@@ -2621,6 +3385,15 @@ const P1710_NS = 'http://schemas.microsoft.com/office/powerpoint/2017/10/main';
2621
3385
  }
2622
3386
  return `<a14:m xmlns:a14="${A14_NS}">${trimmed}</a14:m>`;
2623
3387
  }
3388
+ /**
3389
+ * A stable GUID for a field, derived from its type and cached value
3390
+ * - `a:fld@id` must be a GUID; deriving it keeps repeated exports byte-identical
3391
+ */ function fieldGuid(type, cached) {
3392
+ let hash = 0;
3393
+ for (const char of `${type}:${cached}`)hash = hash * 31 + char.charCodeAt(0) >>> 0;
3394
+ const hex = hash.toString(16).padStart(8, '0');
3395
+ return `{${hex}-0000-0000-0000-${hex}0000}`;
3396
+ }
2624
3397
  function textRunsHaveOmml(text) {
2625
3398
  if (!Array.isArray(text)) return false;
2626
3399
  return text.some((t)=>{
@@ -2630,7 +3403,7 @@ function textRunsHaveOmml(text) {
2630
3403
  }
2631
3404
  function genXmlTextRun(textObj) {
2632
3405
  var _textObj_options;
2633
- var _textObj_options1;
3406
+ var _textObj_options1, _textObj_options2;
2634
3407
  // Native Office Math run — editable in PowerPoint (not an image).
2635
3408
  const omml = (_textObj_options1 = textObj.options) === null || _textObj_options1 === void 0 ? void 0 : _textObj_options1.omml;
2636
3409
  if (typeof omml === 'string' && omml.trim()) {
@@ -2661,7 +3434,18 @@ function genXmlTextRun(textObj) {
2661
3434
  </a:r>
2662
3435
  <a:endParaRPr lang="en-US" dirty="0"/>
2663
3436
  </a:p>
2664
- */ // Return paragraph with text run
3437
+ */ /* A field is a run the consumer refreshes on open (ECMA-376 21.1.2.2.4). The `a:t` child holds
3438
+ * the cached value so a consumer that does not refresh still renders something. `id` must be a
3439
+ * GUID; it is derived from the field type and text so repeated exports stay reproducible. */ const field = (_textObj_options2 = textObj.options) === null || _textObj_options2 === void 0 ? void 0 : _textObj_options2.field;
3440
+ if (field) {
3441
+ if (!TEXT_FIELD_TYPES.has(field)) {
3442
+ console.warn(`[pptxgenjs] unknown text field "${String(field)}" - run emitted as plain text instead`);
3443
+ } else {
3444
+ var _textObj_text, _textObj_options3, _textObj_text1;
3445
+ return `<a:fld id="${fieldGuid(field, (_textObj_text = textObj.text) !== null && _textObj_text !== void 0 ? _textObj_text : '')}" type="${field}">` + genXmlTextRunProperties((_textObj_options3 = textObj.options) !== null && _textObj_options3 !== void 0 ? _textObj_options3 : {}, false) + `<a:t>${encodeXmlEntities((_textObj_text1 = textObj.text) !== null && _textObj_text1 !== void 0 ? _textObj_text1 : '')}</a:t>` + '</a:fld>';
3446
+ }
3447
+ }
3448
+ // Return paragraph with text run
2665
3449
  return textObj.text ? `<a:r>${genXmlTextRunProperties((_textObj_options = textObj.options) !== null && _textObj_options !== void 0 ? _textObj_options : {}, false)}<a:t>${encodeXmlEntities(textObj.text)}</a:t></a:r>` : '';
2666
3450
  }
2667
3451
  /**
@@ -2683,13 +3467,22 @@ function genXmlTextRun(textObj) {
2683
3467
  if (slideObject.options._bodyProp.tIns || slideObject.options._bodyProp.tIns === 0) bodyProperties += ` tIns="${slideObject.options._bodyProp.tIns}"`;
2684
3468
  if (slideObject.options._bodyProp.rIns || slideObject.options._bodyProp.rIns === 0) bodyProperties += ` rIns="${slideObject.options._bodyProp.rIns}"`;
2685
3469
  if (slideObject.options._bodyProp.bIns || slideObject.options._bodyProp.bIns === 0) bodyProperties += ` bIns="${slideObject.options._bodyProp.bIns}"`;
2686
- // C: Add rtl after margins
2687
- bodyProperties += ' rtlCol="0"';
3470
+ // Remaining CT_TextBodyProperties attributes - each omitted unless asked for
3471
+ const body = slideObject.options;
3472
+ if (body.upright === true) bodyProperties += ' upright="1"';
3473
+ if (typeof body.textRotate === 'number' && isFinite(body.textRotate)) bodyProperties += ` rot="${convertRotationDegrees(body.textRotate)}"`;
3474
+ if (body.anchorCtr === true) bodyProperties += ' anchorCtr="1"';
3475
+ if (body.spcFirstLastPara === true) bodyProperties += ' spcFirstLastPara="1"';
3476
+ if (body.compatLnSpc === true) bodyProperties += ' compatLnSpc="1"';
3477
+ if (body.forceAA === true) bodyProperties += ' forceAA="1"';
2688
3478
  // Text columns — ECMA-376 §5.1.5.1.4 CT_TextBodyProperties@numCol/@spcCol (issue #1320)
2689
3479
  if (slideObject.options._bodyProp.numCol && slideObject.options._bodyProp.numCol > 1) {
2690
3480
  bodyProperties += ` numCol="${slideObject.options._bodyProp.numCol}"`;
2691
3481
  if (slideObject.options._bodyProp.spcCol) bodyProperties += ` spcCol="${slideObject.options._bodyProp.spcCol}"`;
2692
3482
  }
3483
+ // `rtlCol` follows the text box's RTL mode unless overridden, so RTL columns flow correctly
3484
+ const rtlCols = typeof slideObject.options.rtlColumns === 'boolean' ? slideObject.options.rtlColumns : slideObject.options.rtlMode === true;
3485
+ bodyProperties += ` rtlCol="${rtlCols ? '1' : '0'}"`;
2693
3486
  // D: Add anchorPoints
2694
3487
  if (slideObject.options._bodyProp.anchor) bodyProperties += ' anchor="' + slideObject.options._bodyProp.anchor + '"'; // VALS: [t,ctr,b]
2695
3488
  if (slideObject.options._bodyProp.vert) bodyProperties += ' vert="' + slideObject.options._bodyProp.vert + '"'; // VALS: [eaVert,horz,mongolianVert,vert,vert270,wordArtVert,wordArtVertRtl]
@@ -2725,7 +3518,9 @@ function genXmlTextRun(textObj) {
2725
3518
  bodyProperties += '</a:bodyPr>';
2726
3519
  } else {
2727
3520
  // DEFAULT:
2728
- bodyProperties += ' wrap="square" rtlCol="0">';
3521
+ const opts = slideObject.options;
3522
+ const rtlCols = typeof (opts === null || opts === void 0 ? void 0 : opts.rtlColumns) === 'boolean' ? opts.rtlColumns : (opts === null || opts === void 0 ? void 0 : opts.rtlMode) === true;
3523
+ bodyProperties += ` wrap="square" rtlCol="${rtlCols ? '1' : '0'}">`;
2729
3524
  bodyProperties += '</a:bodyPr>';
2730
3525
  }
2731
3526
  // LAST: Return Close _bodyProp
@@ -2812,6 +3607,8 @@ function genXmlTextRun(textObj) {
2812
3607
  delete runOpts.softEdge;
2813
3608
  delete runOpts.reflection;
2814
3609
  delete runOpts.shadow;
3610
+ delete runOpts.fillOverlay;
3611
+ delete runOpts.effectDag;
2815
3612
  itext.options = runOpts;
2816
3613
  }
2817
3614
  if (idx === 0 && itext.options && !itext.options.bullet && opts.bullet) itext.options.bullet = opts.bullet;
@@ -2927,7 +3724,7 @@ function genXmlTextRun(textObj) {
2927
3724
  // NOTE: This loop will pick up unecessary keys (`x`, etc.), but it doesnt hurt anything
2928
3725
  // `glow` / softEdge / reflection belong on the shape effectLst (not per-run), unless set on the run itself
2929
3726
  // `omml` is a run-level math payload — inheriting it would replace sibling plain-text runs
2930
- if (key === 'glow' || key === 'softEdge' || key === 'reflection' || key === 'shadow' || key === 'blur' || key === 'omml') return;
3727
+ if (key === 'glow' || key === 'softEdge' || key === 'reflection' || key === 'shadow' || key === 'blur' || key === 'fillOverlay' || key === 'effectDag' || key === 'omml') return;
2931
3728
  if (key !== 'bullet' && !textOpts[key]) textOpts[key] = val;
2932
3729
  });
2933
3730
  // D: Add formatted textrun
@@ -3050,12 +3847,15 @@ const NS_P232 = 'http://schemas.microsoft.com/office/powerpoint/2023/02/main';
3050
3847
  * @returns XML
3051
3848
  */ function genXmlPlaceholder(placeholderObj, extraOpts) {
3052
3849
  var _ref;
3053
- var _placeholderObj_options, _placeholderObj_options1, _placeholderObj_options2;
3850
+ var _placeholderObj_options, _placeholderObj_options1, _placeholderObj_options2, _placeholderObj_options3, _placeholderObj_options4, _placeholderObj_options5;
3054
3851
  if (!placeholderObj) return '';
3055
3852
  const placeholderIdx = ((_placeholderObj_options = placeholderObj.options) === null || _placeholderObj_options === void 0 ? void 0 : _placeholderObj_options._placeholderIdx) ? placeholderObj.options._placeholderIdx : '';
3056
3853
  const placeholderType = resolvePlaceholderType((_placeholderObj_options1 = placeholderObj.options) === null || _placeholderObj_options1 === void 0 ? void 0 : _placeholderObj_options1._placeholderType);
3057
- const attrs = `${placeholderIdx ? ' idx="' + placeholderIdx.toString() + '"' : ''}` + `${placeholderType ? ` type="${placeholderType}"` : ''}` + `${placeholderObj.text && placeholderObj.text.length > 0 ? ' hasCustomPrompt="1"' : ''}`;
3058
- 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;
3854
+ // `orient` and `sz` default to horz/full in the schema, so only a non-default is written
3855
+ const placeholderOrient = ((_placeholderObj_options2 = placeholderObj.options) === null || _placeholderObj_options2 === void 0 ? void 0 : _placeholderObj_options2.orient) === 'vert' ? ' orient="vert"' : '';
3856
+ const placeholderSize = ((_placeholderObj_options3 = placeholderObj.options) === null || _placeholderObj_options3 === void 0 ? void 0 : _placeholderObj_options3.sz) === 'half' || ((_placeholderObj_options4 = placeholderObj.options) === null || _placeholderObj_options4 === void 0 ? void 0 : _placeholderObj_options4.sz) === 'quarter' ? ` sz="${placeholderObj.options.sz}"` : '';
3857
+ const attrs = `${placeholderIdx ? ' idx="' + placeholderIdx.toString() + '"' : ''}` + `${placeholderType ? ` type="${placeholderType}"` : ''}` + placeholderOrient + placeholderSize + `${placeholderObj.text && placeholderObj.text.length > 0 ? ' hasCustomPrompt="1"' : ''}`;
3858
+ const phTypeExt = (_ref = extraOpts === null || extraOpts === void 0 ? void 0 : extraOpts.phTypeExt) !== null && _ref !== void 0 ? _ref : (_placeholderObj_options5 = placeholderObj.options) === null || _placeholderObj_options5 === void 0 ? void 0 : _placeholderObj_options5.phTypeExt;
3059
3859
  if (phTypeExt === 'cameo' || phTypeExt === 'unknown') {
3060
3860
  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>';
3061
3861
  }
@@ -3399,6 +4199,10 @@ function _object_without_properties_loose(source, excluded) {
3399
4199
  let tmpOpt;
3400
4200
  let tmpData = [];
3401
4201
  if (Array.isArray(type)) {
4202
+ // A chartex layout owns the whole `cx:plotArea` and cannot share one with an ECMA-376 chart type,
4203
+ // so a multi-type spec that names one would silently render as an empty frame
4204
+ const chartexSpec = type.find((obj)=>isChartexType(obj.type));
4205
+ if (chartexSpec) throw new Error(`pptxgenjs: chart type "${String(chartexSpec.type)}" cannot be combined in a multi-type chart`);
3402
4206
  // For multi-type charts there needs to be data for each type,
3403
4207
  // as well as a single data source for non-series operations.
3404
4208
  // The data is indexed below to keep the data in order when segmented
@@ -3486,8 +4290,21 @@ function _object_without_properties_loose(source, excluded) {
3486
4290
  // NOTE: a multi-type chart has no single type to validate against, so only the name translation applies there
3487
4291
  if (options.dataLabelPosition) {
3488
4292
  const chartType = Array.isArray(options._type) ? undefined : options._type;
3489
- options.dataLabelPosition = resolveDataLabelPosition(options.dataLabelPosition, chartType, options.barGrouping);
3490
- if (!options.dataLabelPosition) delete options.dataLabelPosition;
4293
+ if (isChartexType(chartType)) {
4294
+ // `cx:dataLabels@pos` is its own vocabulary, not `c:dLblPos`; these three are the values the
4295
+ // shipped chartex writers emit, so anything else falls back to the layout's own default
4296
+ if (![
4297
+ 'ctr',
4298
+ 'inEnd',
4299
+ 'outEnd'
4300
+ ].includes(options.dataLabelPosition)) {
4301
+ console.warn(`[pptxgenjs] dataLabelPosition '${options.dataLabelPosition}' is not valid for a '${chartType}' chart - ignoring it (valid: ctr, inEnd, outEnd)`);
4302
+ delete options.dataLabelPosition;
4303
+ }
4304
+ } else {
4305
+ options.dataLabelPosition = resolveDataLabelPosition(options.dataLabelPosition, chartType, options.barGrouping);
4306
+ if (!options.dataLabelPosition) delete options.dataLabelPosition;
4307
+ }
3491
4308
  }
3492
4309
  options.dataLabelBkgrdColors = options.dataLabelBkgrdColors || !options.dataLabelBkgrdColors ? options.dataLabelBkgrdColors : false;
3493
4310
  if (![
@@ -3659,6 +4476,59 @@ function _object_without_properties_loose(source, excluded) {
3659
4476
  } else {
3660
4477
  delete options.catAxisMultiLevelLabels;
3661
4478
  }
4479
+ // ChartEx: reject values PowerPoint would reject, so a bad option degrades to the layout default
4480
+ // rather than to the repair dialog
4481
+ if (isChartexType(options._type)) {
4482
+ // Only box & whisker plots more than one distribution; the other layouts own the whole plot area
4483
+ // and a second `cx:series` is either dropped or flagged for repair
4484
+ if (options._type !== core_enums_CHART_TYPE.BOX_WHISKER && tmpData.length > 1) {
4485
+ console.warn(`Warning: a ${options._type} chart plots one series - ignoring ${tmpData.length - 1} extra series.`);
4486
+ tmpData = tmpData.slice(0, 1);
4487
+ }
4488
+ tmpData.forEach((item)=>{
4489
+ var _item_values;
4490
+ var _item_labels;
4491
+ // ChartEx cell references assume one label column; the multi-level worksheet layout shifts the
4492
+ // series columns right, so the extra levels are dropped rather than silently misaddressed
4493
+ if (item.labels && item.labels.length > 1) {
4494
+ console.warn('Warning: chartex charts take single-level category labels - using the first level.');
4495
+ item.labels = [
4496
+ item.labels[0]
4497
+ ];
4498
+ }
4499
+ // A histogram bins raw values and needs no categories, but the embedded worksheet still writes a
4500
+ // row per label, so a label-less series is padded rather than left to fail during write()
4501
+ const labels = (_item_labels = item.labels) === null || _item_labels === void 0 ? void 0 : _item_labels[0];
4502
+ if (!labels || labels.length === 0) item.labels = [
4503
+ Array(((_item_values = item.values) !== null && _item_values !== void 0 ? _item_values : []).length).fill('')
4504
+ ];
4505
+ });
4506
+ const pointCount = Math.max(...tmpData.map((item)=>{
4507
+ var _item_values;
4508
+ return ((_item_values = item.values) !== null && _item_values !== void 0 ? _item_values : []).length;
4509
+ }), 0);
4510
+ if (options.chartExSubtotals) {
4511
+ const valid = options.chartExSubtotals.filter((idx)=>Number.isInteger(idx) && idx >= 0 && idx < pointCount);
4512
+ if (valid.length !== options.chartExSubtotals.length) console.warn(`Warning: chart.chartExSubtotals must be data point indexes 0-${pointCount - 1}.`);
4513
+ options.chartExSubtotals = valid;
4514
+ }
4515
+ if (options.chartExBinCount !== undefined && (!Number.isInteger(options.chartExBinCount) || options.chartExBinCount < 1)) {
4516
+ console.warn('Warning: chart.chartExBinCount must be a positive integer.');
4517
+ delete options.chartExBinCount;
4518
+ }
4519
+ if (options.chartExBinSize !== undefined && (isNaN(options.chartExBinSize) || options.chartExBinSize <= 0)) {
4520
+ console.warn('Warning: chart.chartExBinSize must be greater than 0.');
4521
+ delete options.chartExBinSize;
4522
+ }
4523
+ if (options.chartExParentLabels && ![
4524
+ 'none',
4525
+ 'overlapping',
4526
+ 'banner'
4527
+ ].includes(options.chartExParentLabels)) {
4528
+ console.warn('Warning: chart.chartExParentLabels options: `none`, `overlapping`, `banner`.');
4529
+ delete options.chartExParentLabels;
4530
+ }
4531
+ }
3662
4532
  // STEP 4: Set props (_type already set to chart on the literal above).
3663
4533
  // The chart object stores the position/placeholder that gen-xml reads; chart `fill`
3664
4534
  // is a color string (vs ObjectOptions' ShapeFillProps) and is never read here, so it
@@ -3672,14 +4542,17 @@ function _object_without_properties_loose(source, excluded) {
3672
4542
  });
3673
4543
  resultObject.chartRid = getNewRelId(target);
3674
4544
  // STEP 5: Add this chart to this Slide Rels (rId/rels count spans all slides! Count all images to get next rId)
4545
+ // ChartEx charts are a separate part type with their own content type and relationship type,
4546
+ // so the file name is what every downstream emitter keys off (see `xml/package.ts`)
4547
+ const fileName = isChartexType(options._type) ? `chartEx${chartId}.xml` : `chart${chartId}.xml`;
3675
4548
  target._relsChart.push({
3676
4549
  rId: getNewRelId(target),
3677
4550
  data: tmpData,
3678
4551
  opts: options,
3679
4552
  type: options._type,
3680
4553
  globalId: chartId,
3681
- fileName: `chart${chartId}.xml`,
3682
- Target: `/ppt/charts/chart${chartId}.xml`
4554
+ fileName,
4555
+ Target: `/ppt/charts/${fileName}`
3683
4556
  });
3684
4557
  target._slideObjects.push(resultObject);
3685
4558
  return resultObject;
@@ -3765,8 +4638,45 @@ function isSvgFillSource(data, path) {
3765
4638
  });
3766
4639
  return rId;
3767
4640
  }
4641
+ function isStructuredImageFill(fill) {
4642
+ return !!fill && (fill.type === 'image' || !!fill.image);
4643
+ }
4644
+ /**
4645
+ * Resolve a picture fill's image into a slide relationship.
4646
+ * `genXmlColorSelection` is pure, so the rId has to be attached before XML is generated.
4647
+ */ function resolveImageFill(target, fill) {
4648
+ var _ref, _ref1, _ref2, _ref3;
4649
+ var _fill_image, _fill_image1;
4650
+ if (!fill || typeof fill !== 'object') return;
4651
+ if (!isStructuredImageFill(fill) && !(fill.data || fill.path)) return;
4652
+ if (!isStructuredImageFill(fill) && (fill.color || fill.type && fill.type !== 'image')) return;
4653
+ const data = (_ref = (_ref1 = (_fill_image = fill.image) === null || _fill_image === void 0 ? void 0 : _fill_image.data) !== null && _ref1 !== void 0 ? _ref1 : fill.data) !== null && _ref !== void 0 ? _ref : '';
4654
+ const path = (_ref2 = (_ref3 = (_fill_image1 = fill.image) === null || _fill_image1 === void 0 ? void 0 : _fill_image1.path) !== null && _ref3 !== void 0 ? _ref3 : fill.path) !== null && _ref2 !== void 0 ? _ref2 : '';
4655
+ if (!data && !path) {
4656
+ console.warn('[pptxgenjs] `fill.type:"image"` requires `fill.image.data` or `fill.image.path` - fill ignored');
4657
+ return;
4658
+ }
4659
+ if (data && !data.toLowerCase().includes('base64,')) {
4660
+ console.warn('[pptxgenjs] `fill.image.data` lacks a base64 header (ex: \'image/png;base64,iV[...]\') - fill ignored');
4661
+ return;
4662
+ }
4663
+ const rId = registerTableCellImageFill(target, {
4664
+ data,
4665
+ path
4666
+ });
4667
+ if (!rId) return;
4668
+ if (fill.image) fill.image._rId = rId;
4669
+ else fill._rId = rId;
4670
+ }
4671
+ function resolveObjectImageFills(target, options) {
4672
+ var _options_fillOverlay;
4673
+ if (!options) return;
4674
+ if (options.fill) resolveImageFill(target, options.fill);
4675
+ if ((_options_fillOverlay = options.fillOverlay) === null || _options_fillOverlay === void 0 ? void 0 : _options_fillOverlay.fill) resolveImageFill(target, options.fillOverlay.fill);
4676
+ }
3768
4677
  function addImageDefinition(target, opt) {
3769
- var _strImagePath_substring_split__split_pop;
4678
+ var _opt_fillOverlay, _strImagePath_substring_split__split_pop;
4679
+ if ((_opt_fillOverlay = opt.fillOverlay) === null || _opt_fillOverlay === void 0 ? void 0 : _opt_fillOverlay.fill) resolveImageFill(target, opt.fillOverlay.fill);
3770
4680
  const newObject = {
3771
4681
  _type: (/* inlined export .SLIDE_OBJECT_TYPES.image */"image"),
3772
4682
  text: undefined,
@@ -3836,7 +4746,16 @@ function addImageDefinition(target, opt) {
3836
4746
  softEdge: opt.softEdge,
3837
4747
  reflection: opt.reflection,
3838
4748
  blur: opt.blur,
4749
+ fillOverlay: opt.fillOverlay,
4750
+ effectDag: opt.effectDag,
4751
+ alphaEffects: opt.alphaEffects,
4752
+ recolor: opt.recolor,
4753
+ styleRef: opt.styleRef,
3839
4754
  line: opt.line || imageBorderToLine(opt.border),
4755
+ // non-visual props and locks are part of the object's identity, not its geometry
4756
+ title: opt.title,
4757
+ hidden: opt.hidden,
4758
+ lock: opt.lock,
3840
4759
  _sizeFromImage: !intWidth && !intHeight,
3841
4760
  // addImage always writes x/y/w/h defaults, so remember which axes the caller actually set
3842
4761
  // (placeholder geometry must not overwrite explicit placement; fujita-h d7e3e93 / #996).
@@ -3916,8 +4835,14 @@ function addImageDefinition(target, opt) {
3916
4835
  });
3917
4836
  objHyperlink._rId = imageRelId;
3918
4837
  newObject.hyperlink = objHyperlink;
4838
+ // the action sound (if any) needs its own relationship
4839
+ resolveHyperlinkRels(target, objHyperlink);
3919
4840
  }
3920
4841
  }
4842
+ if (typeof opt.hyperlinkHover === 'object') {
4843
+ resolveHyperlinkRels(target, opt.hyperlinkHover);
4844
+ newObject.hyperlinkHover = opt.hyperlinkHover;
4845
+ }
3921
4846
  // STEP 6: Add object to slide
3922
4847
  target._slideObjects.push(newObject);
3923
4848
  }
@@ -3940,12 +4865,25 @@ function addImageDefinition(target, opt) {
3940
4865
  const slideData = {
3941
4866
  _type: (/* inlined export .SLIDE_OBJECT_TYPES.media */"media")
3942
4867
  };
3943
- // STEP 1: REALITY-CHECK
3944
- if (!strPath && !strData && strType !== 'online') {
4868
+ // `link` with no `path`/`data` used to throw, so treating it as "reference, do not embed" cannot
4869
+ // change any deck that works today
4870
+ const isLinked = !!strLink && !strPath && !strData && (strType === 'audio' || strType === 'video');
4871
+ if (strLink && (strPath || strData) && strType !== 'online') {
4872
+ console.warn('[pptxgenjs] addMedia: `link` is ignored when `path` or `data` is given - the media is embedded');
4873
+ }
4874
+ // STEP 1: REALITY-CHECK - what each media kind needs, rather than one chain of conditions
4875
+ if (strType === 'audioCd') {
4876
+ var _opt_audioCd_start, _opt_audioCd, _opt_audioCd_end, _opt_audioCd1;
4877
+ // `a:st`/`a:end` and their `@track` are all required by CT_AudioCD
4878
+ if (typeof ((_opt_audioCd = opt.audioCd) === null || _opt_audioCd === void 0 ? void 0 : (_opt_audioCd_start = _opt_audioCd.start) === null || _opt_audioCd_start === void 0 ? void 0 : _opt_audioCd_start.track) !== 'number' || typeof ((_opt_audioCd1 = opt.audioCd) === null || _opt_audioCd1 === void 0 ? void 0 : (_opt_audioCd_end = _opt_audioCd1.end) === null || _opt_audioCd_end === void 0 ? void 0 : _opt_audioCd_end.track) !== 'number') {
4879
+ throw new Error('addMedia() error: `type:"audioCd"` requires `audioCd.start.track` and `audioCd.end.track`');
4880
+ }
4881
+ } else if (!strPath && !strData && strType !== 'online' && !isLinked) {
3945
4882
  throw new Error('addMedia() error: either `data` or `path` are required!');
3946
4883
  } else if (strData && !strData.toLowerCase().includes('base64,')) {
3947
4884
  throw new Error('addMedia() error: `data` value lacks a base64 header! Ex: \'video/mpeg;base64,NMP[...]\')');
3948
- } else if (strCover && !strCover.toLowerCase().includes('base64,')) {
4885
+ }
4886
+ if (strCover && !strCover.toLowerCase().includes('base64,')) {
3949
4887
  throw new Error('addMedia() error: `cover` value lacks a base64 header! Ex: \'data:image/png;base64,iV[...]\')');
3950
4888
  }
3951
4889
  // Online Video: requires `link`
@@ -3954,7 +4892,7 @@ function addImageDefinition(target, opt) {
3954
4892
  }
3955
4893
  // Timing-tree playback (ECMA-376 §19.5 CT_TLMediaNode): no silent fallbacks.
3956
4894
  // `fullScrn` exists only on CT_TLMediaNodeVideo; linked `online` media has no embedded media node.
3957
- if (strType === 'audio' && opt.fullScreen) {
4895
+ if (opt.fullScreen && strType !== 'video') {
3958
4896
  throw new Error('addMedia() error: `fullScreen` is only valid on type "video"');
3959
4897
  }
3960
4898
  if (strType === 'online' && (opt.autoplay || opt.loop || opt.fullScreen || opt.mute)) {
@@ -3962,7 +4900,7 @@ function addImageDefinition(target, opt) {
3962
4900
  }
3963
4901
  // FIXME: 20190707
3964
4902
  // strType = strData ? strData.split(';')[0].split('/')[0] : strType
3965
- strExtn = opt.extn || (strData ? strData.split(';')[0].split('/')[1] : strPath.split('.').pop()) || 'mp3';
4903
+ strExtn = opt.extn || (strType === 'wav' ? 'wav' : strData ? strData.split(';')[0].split('/')[1] : (strPath || strLink).split('.').pop()) || 'mp3';
3966
4904
  // STEP 2: Set type, media
3967
4905
  slideData.mtype = strType;
3968
4906
  slideData.media = strPath || 'preencoded.mov';
@@ -3989,6 +4927,11 @@ function addImageDefinition(target, opt) {
3989
4927
  slideData.options.loop = opt.loop;
3990
4928
  slideData.options.fullScreen = opt.fullScreen;
3991
4929
  slideData.options.mute = opt.mute;
4930
+ slideData.options.contentType = opt.contentType;
4931
+ slideData.options.audioCd = opt.audioCd;
4932
+ slideData.options.isPhoto = opt.isPhoto;
4933
+ slideData.options.userDrawn = opt.userDrawn;
4934
+ slideData.options.isLinked = isLinked;
3992
4935
  // STEP 4: Add this media to this Slide Rels (rId/rels count spans all slides! Count all media to get next rId)
3993
4936
  /**
3994
4937
  * NOTE:
@@ -3998,7 +4941,41 @@ function addImageDefinition(target, opt) {
3998
4941
  * - Audio/Video files consume *TWO* rId's:
3999
4942
  * <Relationship Id="rId2" Target="../media/media1.mov" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/video"/>
4000
4943
  * <Relationship Id="rId3" Target="../media/media1.mov" Type="http://schemas.microsoft.com/office/2007/relationships/media"/>
4001
- */ if (strType === 'online') {
4944
+ */ if (strType === 'audioCd') {
4945
+ // CD audio references the listener's drive: no media part, no media relationship, cover only
4946
+ const coverRid = getNewRelId(target);
4947
+ target._relsMedia.push({
4948
+ path: 'preencoded.png',
4949
+ type: 'image/png',
4950
+ extn: 'png',
4951
+ data: strCover,
4952
+ rId: coverRid,
4953
+ Target: `../media/${imageTargetStem(target)}.png`
4954
+ });
4955
+ slideData._coverRid = coverRid;
4956
+ } else if (strType === 'wav') {
4957
+ // `a:wavAudioFile` is the legacy embedded-WAV element: one audio relationship, no `p14:media`
4958
+ const relId1 = getNewRelId(target);
4959
+ target._relsMedia.push({
4960
+ path: strPath || 'preencoded.wav',
4961
+ type: 'audio/wav',
4962
+ extn: 'wav',
4963
+ data: strData || '',
4964
+ rId: relId1,
4965
+ Target: `../media/media-${target._slideNum}-${target._relsMedia.length + 1}.wav`
4966
+ });
4967
+ slideData.mediaRid = relId1;
4968
+ const coverRid = getNewRelId(target);
4969
+ target._relsMedia.push({
4970
+ path: 'preencoded.png',
4971
+ type: 'image/png',
4972
+ extn: 'png',
4973
+ data: strCover,
4974
+ rId: coverRid,
4975
+ Target: `../media/${imageTargetStem(target)}.png`
4976
+ });
4977
+ slideData._coverRid = coverRid;
4978
+ } else if (strType === 'online') {
4002
4979
  const relId1 = getNewRelId(target);
4003
4980
  // A: Add video
4004
4981
  target._relsMedia.push({
@@ -4023,6 +5000,8 @@ function addImageDefinition(target, opt) {
4023
5000
  // PERF: Duplicate media should reuse existing `Target` value and not create an additional copy
4024
5001
  const dupeItem = target._relsMedia.filter((item)=>item.path && item.path === strPath && item.type === strType + '/' + strExtn && !item.isDuplicate)[0];
4025
5002
  // A: "relationships/video"
5003
+ // Linked media keeps this exact three-relationship shape - the rIds the emitter derives from
5004
+ // `mediaRid` stay valid - and only points the targets outside the package
4026
5005
  const relId1 = getNewRelId(target);
4027
5006
  target._relsMedia.push({
4028
5007
  path: strPath || 'preencoded' + strExtn,
@@ -4031,7 +5010,8 @@ function addImageDefinition(target, opt) {
4031
5010
  data: strData || '',
4032
5011
  rId: relId1,
4033
5012
  isDuplicate: !!(dupeItem === null || dupeItem === void 0 ? void 0 : dupeItem.Target),
4034
- Target: (dupeItem === null || dupeItem === void 0 ? void 0 : dupeItem.Target) ? dupeItem.Target : `../media/media-${target._slideNum}-${target._relsMedia.length + 1}.${strExtn}`
5013
+ isLinked,
5014
+ Target: isLinked ? strLink : (dupeItem === null || dupeItem === void 0 ? void 0 : dupeItem.Target) ? dupeItem.Target : `../media/media-${target._slideNum}-${target._relsMedia.length + 1}.${strExtn}`
4035
5015
  });
4036
5016
  slideData.mediaRid = relId1;
4037
5017
  // B: "relationships/media"
@@ -4042,7 +5022,8 @@ function addImageDefinition(target, opt) {
4042
5022
  data: strData || '',
4043
5023
  rId: getNewRelId(target),
4044
5024
  isDuplicate: !!(dupeItem === null || dupeItem === void 0 ? void 0 : dupeItem.Target),
4045
- Target: (dupeItem === null || dupeItem === void 0 ? void 0 : dupeItem.Target) ? dupeItem.Target : `../media/media-${target._slideNum}-${target._relsMedia.length + 0}.${strExtn}`
5025
+ isLinked,
5026
+ Target: isLinked ? strLink : (dupeItem === null || dupeItem === void 0 ? void 0 : dupeItem.Target) ? dupeItem.Target : `../media/media-${target._slideNum}-${target._relsMedia.length + 0}.${strExtn}`
4046
5027
  });
4047
5028
  // C: Add cover (preview/overlay) image
4048
5029
  target._relsMedia.push({
@@ -4278,11 +5259,107 @@ function nextExtPartName(target, prefix, extn) {
4278
5259
  opts.line.endArrowType = opts.lineTail;
4279
5260
  }
4280
5261
  }
5262
+ /**
5263
+ * Create the relationships a hyperlink needs: the link target, and its action sound when set
5264
+ * - `genXmlHyperlink` is pure, so both ids have to exist before the XML is generated
5265
+ */ function resolveHyperlinkRels(target, link) {
5266
+ if (!link || typeof link !== 'object') return;
5267
+ if (!link._rId) {
5268
+ var _link_url;
5269
+ var _link_slide;
5270
+ if (!link.url && !link.slide) {
5271
+ console.warn('[pptxgenjs] a hyperlink requires either `url` or `slide` - link ignored');
5272
+ return;
5273
+ }
5274
+ const relId = getNewRelId(target);
5275
+ target._rels.push({
5276
+ type: (/* inlined export .SLIDE_OBJECT_TYPES.hyperlink */"hyperlink"),
5277
+ data: link.slide ? 'slide' : 'dummy',
5278
+ rId: relId,
5279
+ Target: encodeXmlEntities((_link_url = link.url) !== null && _link_url !== void 0 ? _link_url : '') || ((_link_slide = link.slide) === null || _link_slide === void 0 ? void 0 : _link_slide.toString()) || ''
5280
+ });
5281
+ link._rId = relId;
5282
+ } else if (target._rels.filter((rel)=>rel.rId === link._rId).length === 0) {
5283
+ var _link_url1;
5284
+ var _link_slide1;
5285
+ target._rels.push({
5286
+ type: (/* inlined export .SLIDE_OBJECT_TYPES.hyperlink */"hyperlink"),
5287
+ data: link.slide ? 'slide' : 'dummy',
5288
+ rId: link._rId,
5289
+ Target: encodeXmlEntities((_link_url1 = link.url) !== null && _link_url1 !== void 0 ? _link_url1 : '') || ((_link_slide1 = link.slide) === null || _link_slide1 === void 0 ? void 0 : _link_slide1.toString()) || ''
5290
+ });
5291
+ }
5292
+ // ECMA-376 20.1.2.2.32 allows only WAV here, so anything else is dropped rather than linked
5293
+ const sound = link.sound;
5294
+ if (!sound) return;
5295
+ if (!sound._sndRId) {
5296
+ var _sound_data, _sound_path;
5297
+ const data = (_sound_data = sound.data) !== null && _sound_data !== void 0 ? _sound_data : '';
5298
+ const path = (_sound_path = sound.path) !== null && _sound_path !== void 0 ? _sound_path : '';
5299
+ if (!data && !path) {
5300
+ console.warn('[pptxgenjs] hyperlink `sound` requires `data` or `path` - sound ignored');
5301
+ link.sound = undefined;
5302
+ return;
5303
+ }
5304
+ if (data && !data.toLowerCase().includes('base64,')) {
5305
+ console.warn('[pptxgenjs] hyperlink `sound.data` lacks a base64 header - sound ignored');
5306
+ link.sound = undefined;
5307
+ return;
5308
+ }
5309
+ const rId = getNewRelId(target);
5310
+ target._relsMedia.push({
5311
+ path: path || 'preencoded.wav',
5312
+ type: 'audio/wav',
5313
+ extn: 'wav',
5314
+ data,
5315
+ rId,
5316
+ Target: `../media/audio-${target._slideNum}-${target._relsMedia.length + 1}.wav`
5317
+ });
5318
+ sound._sndRId = rId;
5319
+ } else if (!target._relsMedia.some((rel)=>rel.rId === sound._sndRId)) {
5320
+ target._relsMedia.push({
5321
+ path: sound.path || 'preencoded.wav',
5322
+ type: 'audio/wav',
5323
+ extn: 'wav',
5324
+ data: sound.data,
5325
+ rId: sound._sndRId,
5326
+ Target: `../media/audio-${target._slideNum}-${target._relsMedia.length + 1}.wav`
5327
+ });
5328
+ }
5329
+ }
5330
+ /**
5331
+ * Resolve a picture bullet's image into a slide relationship
5332
+ * - the paragraph emitter is pure, so the rId has to exist before the XML is generated
5333
+ */ function resolveBulletImage(target, opts) {
5334
+ var _ref;
5335
+ var _exec;
5336
+ const bullet = typeof (opts === null || opts === void 0 ? void 0 : opts.bullet) === 'object' ? opts.bullet : undefined;
5337
+ if (!(bullet === null || bullet === void 0 ? void 0 : bullet.image) || bullet._imageRId) return;
5338
+ if (!bullet.image.toLowerCase().includes('base64,')) {
5339
+ console.warn('[pptxgenjs] `bullet.image` must be base64 image data (ex: \'image/png;base64,iV[...]\') - picture bullet ignored');
5340
+ bullet.image = undefined;
5341
+ return;
5342
+ }
5343
+ const extn = (_ref = (_exec = /image\/(\w+);/.exec(bullet.image)) === null || _exec === void 0 ? void 0 : _exec[1]) !== null && _ref !== void 0 ? _ref : 'png';
5344
+ const rId = getNewRelId(target);
5345
+ target._relsMedia.push({
5346
+ path: `preencoded.${extn}`,
5347
+ type: `image/${extn}`,
5348
+ extn,
5349
+ data: bullet.image,
5350
+ rId,
5351
+ Target: `../media/${imageTargetStem(target)}.${extn}`
5352
+ });
5353
+ bullet._imageRId = rId;
5354
+ }
4281
5355
  function addShapeDefinition(target, shapeName, opts) {
4282
5356
  const options = typeof opts === 'object' ? opts : {};
4283
5357
  options.line = options.line || {
4284
5358
  type: 'none'
4285
5359
  };
5360
+ resolveHyperlinkRels(target, options.hyperlink);
5361
+ resolveHyperlinkRels(target, options.hyperlinkHover);
5362
+ resolveObjectImageFills(target, options);
4286
5363
  const newObject = {
4287
5364
  _type: (/* inlined export .SLIDE_OBJECT_TYPES.text */"text"),
4288
5365
  shape: shapeName || core_enums_SHAPE_TYPE.RECTANGLE,
@@ -4299,7 +5376,7 @@ function addShapeDefinition(target, shapeName, opts) {
4299
5376
  }
4300
5377
  // 1: ShapeLineProps defaults
4301
5378
  const hasConnectorEnds = options.line.sourceId != null || options.line.targetId != null;
4302
- const newLineOpts = {
5379
+ const newLineOpts = gen_objects_object_spread_props(gen_objects_object_spread({}, options.line), {
4303
5380
  type: options.line.type || (options.line.gradient ? 'gradient' : 'solid'),
4304
5381
  color: options.line.color || (/* inlined export .DEF_SHAPE_LINE_COLOR */"333333"),
4305
5382
  transparency: options.line.transparency || 0,
@@ -4315,8 +5392,10 @@ function addShapeDefinition(target, shapeName, opts) {
4315
5392
  sourceAnchorPos: options.line.sourceAnchorPos,
4316
5393
  targetAnchorPos: options.line.targetAnchorPos,
4317
5394
  isConnector: options.line.isConnector || hasConnectorEnds,
4318
- curveadjust: options.line.curveadjust
4319
- };
5395
+ curveadjust: options.line.curveadjust,
5396
+ _sourceName: options.line._sourceName,
5397
+ _targetName: options.line._targetName
5398
+ });
4320
5399
  if (typeof options.line === 'object' && options.line.type !== 'none') options.line = newLineOpts;
4321
5400
  // 2: Set options defaults
4322
5401
  const shapeOpts = options;
@@ -4372,12 +5451,13 @@ function addShapeDefinition(target, shapeName, opts) {
4372
5451
  // STEP 2: Transform `tableRows` into well-formatted TableCell's
4373
5452
  // tableRows can be object or plain text array: `[{text:'cell 1'}, {text:'cell 2', options:{color:'ff0000'}}]` | `["cell 1", "cell 2"]`
4374
5453
  const arrRows = [];
4375
- const tableFillRid = registerTableCellImageFill(target, opt.fill);
5454
+ if (isStructuredImageFill(opt.fill)) resolveImageFill(target, opt.fill);
5455
+ const tableFillRid = isStructuredImageFill(opt.fill) ? undefined : registerTableCellImageFill(target, opt.fill);
4376
5456
  tableRows.forEach((row)=>{
4377
5457
  const newRow = [];
4378
5458
  if (Array.isArray(row)) {
4379
5459
  row.forEach((cell)=>{
4380
- var _newCell_options, _registerTableCellImageFill;
5460
+ var _newCell_options;
4381
5461
  // A:
4382
5462
  const newCell = {
4383
5463
  _type: (/* inlined export .SLIDE_OBJECT_TYPES.tablecell */"tablecell"),
@@ -4447,8 +5527,13 @@ function addShapeDefinition(target, shapeName, opts) {
4447
5527
  transparency: typeof cellBorder[idx].transparency === 'number' ? cellBorder[idx].transparency : undefined
4448
5528
  };
4449
5529
  });
4450
- const fillRid = (_registerTableCellImageFill = registerTableCellImageFill(target, cellOpts.fill)) !== null && _registerTableCellImageFill !== void 0 ? _registerTableCellImageFill : cellOpts.fill ? undefined : tableFillRid;
4451
- if (fillRid) cellOpts._fillRid = fillRid;
5530
+ if (isStructuredImageFill(cellOpts.fill)) {
5531
+ resolveImageFill(target, cellOpts.fill);
5532
+ } else {
5533
+ var _registerTableCellImageFill;
5534
+ const fillRid = (_registerTableCellImageFill = registerTableCellImageFill(target, cellOpts.fill)) !== null && _registerTableCellImageFill !== void 0 ? _registerTableCellImageFill : cellOpts.fill ? undefined : tableFillRid;
5535
+ if (fillRid) cellOpts._fillRid = fillRid;
5536
+ }
4452
5537
  // LAST:
4453
5538
  newRow.push(newCell);
4454
5539
  });
@@ -4655,7 +5740,8 @@ function addShapeDefinition(target, shapeName, opts) {
4655
5740
  */ function addTextDefinition(target, text, opts, isPlaceholder) {
4656
5741
  var _newObject_options;
4657
5742
  var // STEP 2: Create/Clean text options
4658
- _newObject_text;
5743
+ _newObject_text, _newObject_options1, _newObject_options2, _newObject_text1;
5744
+ resolveObjectImageFills(target, opts);
4659
5745
  const newObject = {
4660
5746
  _type: isPlaceholder ? (/* inlined export .SLIDE_OBJECT_TYPES.placeholder */"placeholder") : (/* inlined export .SLIDE_OBJECT_TYPES.text */"text"),
4661
5747
  shape: (opts === null || opts === void 0 ? void 0 : opts.shape) || core_enums_SHAPE_TYPE.RECTANGLE,
@@ -4702,7 +5788,7 @@ function addShapeDefinition(target, shapeName, opts) {
4702
5788
  if (itemOpts.shape === core_enums_SHAPE_TYPE.LINE) {
4703
5789
  var _itemOpts_line, _itemOpts_line1, _itemOpts_line2, _itemOpts_line3, _itemOpts_line4, _itemOpts_line5, _itemOpts_line6, _itemOpts_line7, _itemOpts_line8, _itemOpts_line9;
4704
5790
  // ShapeLineProps defaults
4705
- const newLineOpts = {
5791
+ const newLineOpts = gen_objects_object_spread_props(gen_objects_object_spread({}, itemOpts.line), {
4706
5792
  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'),
4707
5793
  color: ((_itemOpts_line2 = itemOpts.line) === null || _itemOpts_line2 === void 0 ? void 0 : _itemOpts_line2.color) || (/* inlined export .DEF_SHAPE_LINE_COLOR */"333333"),
4708
5794
  transparency: ((_itemOpts_line3 = itemOpts.line) === null || _itemOpts_line3 === void 0 ? void 0 : _itemOpts_line3.transparency) || 0,
@@ -4712,7 +5798,7 @@ function addShapeDefinition(target, shapeName, opts) {
4712
5798
  cap: (_itemOpts_line7 = itemOpts.line) === null || _itemOpts_line7 === void 0 ? void 0 : _itemOpts_line7.cap,
4713
5799
  beginArrowType: ((_itemOpts_line8 = itemOpts.line) === null || _itemOpts_line8 === void 0 ? void 0 : _itemOpts_line8.beginArrowType) || undefined,
4714
5800
  endArrowType: ((_itemOpts_line9 = itemOpts.line) === null || _itemOpts_line9 === void 0 ? void 0 : _itemOpts_line9.endArrowType) || undefined
4715
- };
5801
+ });
4716
5802
  if (typeof itemOpts.line === 'object') itemOpts.line = newLineOpts;
4717
5803
  // 3: Handle line (lots of deprecated opts)
4718
5804
  normalizeDeprecatedLineProps(itemOpts, newLineOpts);
@@ -4786,8 +5872,18 @@ function addShapeDefinition(target, shapeName, opts) {
4786
5872
  // STEP 1: Create/Clean object options
4787
5873
  newObject.options = cleanOpts((_newObject_options = newObject.options) !== null && _newObject_options !== void 0 ? _newObject_options : {});
4788
5874
  (_newObject_text = newObject.text) === null || _newObject_text === void 0 ? void 0 : _newObject_text.forEach((item)=>item.options = cleanOpts(item.options || {}));
4789
- // STEP 3: Create hyperlinks
5875
+ // STEP 3: Create hyperlinks, hover actions, and any picture-bullet relationships
4790
5876
  createHyperlinkRels(target, newObject.text || '');
5877
+ resolveHyperlinkRels(target, (_newObject_options1 = newObject.options) === null || _newObject_options1 === void 0 ? void 0 : _newObject_options1.hyperlink);
5878
+ resolveHyperlinkRels(target, (_newObject_options2 = newObject.options) === null || _newObject_options2 === void 0 ? void 0 : _newObject_options2.hyperlinkHover);
5879
+ resolveBulletImage(target, newObject.options);
5880
+ (_newObject_text1 = newObject.text) === null || _newObject_text1 === void 0 ? void 0 : _newObject_text1.forEach((item)=>{
5881
+ var _item_options, _item_options_hyperlink, _item_options1;
5882
+ resolveHyperlinkRels(target, (_item_options = item.options) === null || _item_options === void 0 ? void 0 : _item_options.hyperlinkHover);
5883
+ // a click link already has its target rel; this adds its action sound
5884
+ if ((_item_options1 = item.options) === null || _item_options1 === void 0 ? void 0 : (_item_options_hyperlink = _item_options1.hyperlink) === null || _item_options_hyperlink === void 0 ? void 0 : _item_options_hyperlink.sound) resolveHyperlinkRels(target, item.options.hyperlink);
5885
+ resolveBulletImage(target, item.options);
5886
+ });
4791
5887
  // LAST: Add object to Slide
4792
5888
  target._slideObjects.push(newObject);
4793
5889
  }
@@ -4915,6 +6011,11 @@ function addShapeDefinition(target, shapeName, opts) {
4915
6011
  });
4916
6012
  }
4917
6013
  }
6014
+ if (text && typeof text === 'object' && !Array.isArray(text) && text.options) {
6015
+ var _text_options_hyperlink;
6016
+ resolveHyperlinkRels(target, text.options.hyperlinkHover);
6017
+ if ((_text_options_hyperlink = text.options.hyperlink) === null || _text_options_hyperlink === void 0 ? void 0 : _text_options_hyperlink.sound) resolveHyperlinkRels(target, text.options.hyperlink);
6018
+ }
4918
6019
  });
4919
6020
  }
4920
6021
  function makeGroupCollector(parent) {
@@ -4934,6 +6035,7 @@ function makeGroupCollector(parent) {
4934
6035
  * Child coordinates are relative to the group origin (`chOff` 0,0 / `chExt` = group size).
4935
6036
  */ function addGroupDefinition(target, opts, objects) {
4936
6037
  var _opts_x, _opts_y, _opts_w, _opts_h, _opts_rotate;
6038
+ if (opts.fill) resolveImageFill(target, opts.fill);
4937
6039
  const groupCount = target._slideObjects.filter((obj)=>obj._type === (/* inlined export .SLIDE_OBJECT_TYPES.group */"group")).length;
4938
6040
  const newObject = {
4939
6041
  _type: (/* inlined export .SLIDE_OBJECT_TYPES.group */"group"),
@@ -4944,7 +6046,11 @@ function makeGroupCollector(parent) {
4944
6046
  h: (_opts_h = opts.h) !== null && _opts_h !== void 0 ? _opts_h : 1,
4945
6047
  rotate: (_opts_rotate = opts.rotate) !== null && _opts_rotate !== void 0 ? _opts_rotate : 0,
4946
6048
  shadow: opts.shadow ? correctShadowOptions(opts.shadow) : undefined,
4947
- objectName: opts.objectName ? encodeXmlEntities(opts.objectName) : `Group ${groupCount + 1}`
6049
+ fill: opts.fill,
6050
+ objectName: opts.objectName ? encodeXmlEntities(opts.objectName) : `Group ${groupCount + 1}`,
6051
+ title: opts.title,
6052
+ hidden: opts.hidden,
6053
+ lock: opts.lock
4948
6054
  },
4949
6055
  _objects: objects
4950
6056
  };
@@ -4984,10 +6090,60 @@ function createGroupBuilder(parent, objects) {
4984
6090
  addGroupDefinition(collector, options, children);
4985
6091
  objects.push(...collector._slideObjects);
4986
6092
  return builder;
6093
+ },
6094
+ addConnector (options) {
6095
+ const collector = makeGroupCollector(parent);
6096
+ addConnectorDefinition(collector, options !== null && options !== void 0 ? options : {});
6097
+ objects.push(...collector._slideObjects);
6098
+ return builder;
4987
6099
  }
4988
6100
  };
4989
6101
  return builder;
4990
6102
  }
6103
+ const CONNECTOR_PRESETS = new Set([
6104
+ 'line',
6105
+ 'straightConnector1',
6106
+ 'bentConnector2',
6107
+ 'bentConnector3',
6108
+ 'bentConnector4',
6109
+ 'bentConnector5',
6110
+ 'curvedConnector2',
6111
+ 'curvedConnector3',
6112
+ 'curvedConnector4',
6113
+ 'curvedConnector5'
6114
+ ]);
6115
+ /**
6116
+ * Additive connector convenience: maps onto `addShape` + `line.isConnector`.
6117
+ * `start`/`end` `objectName`s are resolved to `sourceId`/`targetId` at emit time.
6118
+ */ function addConnectorDefinition(target, opt) {
6119
+ var _opt_line, _ref, _ref1;
6120
+ var _opt_line1, _opt_line2, _opt_start, _opt_line3, _opt_end, _opt_line4, _opt_start1, _opt_end1;
6121
+ const requested = opt.type && CONNECTOR_PRESETS.has(opt.type) ? opt.type : 'straightConnector1';
6122
+ const shapeName = requested === 'line' ? core_enums_SHAPE_TYPE.LINE : requested;
6123
+ const line = gen_objects_object_spread_props(gen_objects_object_spread({}, (_opt_line = opt.line) !== null && _opt_line !== void 0 ? _opt_line : {}), {
6124
+ isConnector: true,
6125
+ sourceId: (_opt_line1 = opt.line) === null || _opt_line1 === void 0 ? void 0 : _opt_line1.sourceId,
6126
+ targetId: (_opt_line2 = opt.line) === null || _opt_line2 === void 0 ? void 0 : _opt_line2.targetId,
6127
+ sourceAnchorPos: (_ref = (_opt_start = opt.start) === null || _opt_start === void 0 ? void 0 : _opt_start.site) !== null && _ref !== void 0 ? _ref : (_opt_line3 = opt.line) === null || _opt_line3 === void 0 ? void 0 : _opt_line3.sourceAnchorPos,
6128
+ targetAnchorPos: (_ref1 = (_opt_end = opt.end) === null || _opt_end === void 0 ? void 0 : _opt_end.site) !== null && _ref1 !== void 0 ? _ref1 : (_opt_line4 = opt.line) === null || _opt_line4 === void 0 ? void 0 : _opt_line4.targetAnchorPos,
6129
+ _sourceName: (_opt_start1 = opt.start) === null || _opt_start1 === void 0 ? void 0 : _opt_start1.shape,
6130
+ _targetName: (_opt_end1 = opt.end) === null || _opt_end1 === void 0 ? void 0 : _opt_end1.shape
6131
+ });
6132
+ addShapeDefinition(target, shapeName, {
6133
+ x: opt.x,
6134
+ y: opt.y,
6135
+ w: opt.w,
6136
+ h: opt.h,
6137
+ objectName: opt.objectName,
6138
+ rotate: opt.rotate,
6139
+ flipH: opt.flipH,
6140
+ flipV: opt.flipV,
6141
+ fill: opt.fill,
6142
+ shadow: opt.shadow,
6143
+ styleRef: opt.styleRef,
6144
+ line
6145
+ });
6146
+ }
4991
6147
 
4992
6148
  /**
4993
6149
  * PptxGenJS: Slide Class
@@ -5032,6 +6188,8 @@ function slide_object_spread(target) {
5032
6188
  delete runOpts.reflection;
5033
6189
  delete runOpts.shadow;
5034
6190
  delete runOpts.blur;
6191
+ delete runOpts.fillOverlay;
6192
+ delete runOpts.effectDag;
5035
6193
  return runOpts;
5036
6194
  }
5037
6195
  class Slide {
@@ -5126,6 +6284,14 @@ class Slide {
5126
6284
  addGroupDefinition(this, cloneOpts(options), children);
5127
6285
  return this;
5128
6286
  }
6287
+ /**
6288
+ * Add a connector (`p:cxnSp`). Additive convenience over `line.isConnector`.
6289
+ * Glue with `start`/`end` `objectName`s, or pass numeric `line.sourceId`/`targetId`.
6290
+ * @example slide.addConnector({ type: 'straightConnector1', start: { shape: 'BoxA', site: 3 }, end: { shape: 'BoxB', site: 1 } })
6291
+ */ addConnector(options) {
6292
+ addConnectorDefinition(this, cloneOpts(options !== null && options !== void 0 ? options : {}));
6293
+ return this;
6294
+ }
5129
6295
  /**
5130
6296
  * Add a slide transition (`<p:transition>`, ECMA-376 §19.3.1.50 / MS-PPTX §2.2.1)
5131
6297
  * @param {SlideTransitionProps} options - transition options
@@ -5339,64 +6505,6 @@ class Slide {
5339
6505
 
5340
6506
 
5341
6507
 
5342
- /**
5343
- * Chart title rendering.
5344
- */
5345
-
5346
- /**
5347
- * Create char title elements
5348
- * @param {IChartPropsTitle} opts - options
5349
- * @return {string} XML `<c:title>`
5350
- */ function genXmlTitle(opts, chartX, chartY) {
5351
- const align = opts.titleAlign === 'left' || opts.titleAlign === 'right' ? `<a:pPr algn="${opts.titleAlign.substring(0, 1)}">` : '<a:pPr>';
5352
- const rotate = opts.titleRotate ? `<a:bodyPr rot="${convertRotationDegrees(opts.titleRotate)}"/>` : '<a:bodyPr/>' // don't specify rotation to get default (ex. vertical for cat axis)
5353
- ;
5354
- const sizeAttr = opts.fontSize ? `sz="${Math.round(opts.fontSize * 100)}"` : '' // only set the font size if specified. Powerpoint will handle the default size
5355
- ;
5356
- const titleBold = opts.titleBold ? 1 : 0;
5357
- const titleItalic = opts.titleItalic ? 1 : 0;
5358
- let layout = '<c:layout/>';
5359
- if (opts.titlePos && typeof opts.titlePos.x === 'number' && typeof opts.titlePos.y === 'number') {
5360
- // NOTE: manualLayout x/y vals are *relative to entire slide*
5361
- const totalX = opts.titlePos.x + (chartX !== null && chartX !== void 0 ? chartX : 0);
5362
- const totalY = opts.titlePos.y + (chartY !== null && chartY !== void 0 ? chartY : 0);
5363
- let valX = totalX === 0 ? 0 : totalX * (totalX / 5) / 10;
5364
- if (valX >= 1) valX = valX / 10;
5365
- if (valX >= 0.1) valX = valX / 10;
5366
- let valY = totalY === 0 ? 0 : totalY * (totalY / 5) / 10;
5367
- if (valY >= 1) valY = valY / 10;
5368
- if (valY >= 0.1) valY = valY / 10;
5369
- layout = `<c:layout><c:manualLayout><c:xMode val="edge"/><c:yMode val="edge"/><c:x val="${valX}"/><c:y val="${valY}"/></c:manualLayout></c:layout>`;
5370
- }
5371
- return `<c:title>
5372
- <c:tx>
5373
- <c:rich>
5374
- ${rotate}
5375
- <a:lstStyle/>
5376
- <a:p>
5377
- ${align}
5378
- <a:defRPr ${sizeAttr} b="${titleBold}" i="${titleItalic}" u="none" strike="noStrike">
5379
- <a:solidFill>${createColorElement(opts.color || (/* inlined export .DEF_FONT_COLOR */"000000"))}</a:solidFill>
5380
- <a:latin typeface="${encodeXmlEntities(opts.fontFace) || 'Arial'}"/>
5381
- <a:ea typeface="${encodeXmlEntities(opts.fontFace) || 'Arial'}"/>
5382
- </a:defRPr>
5383
- </a:pPr>
5384
- <a:r>
5385
- <a:rPr ${sizeAttr} b="${titleBold}" i="${titleItalic}" u="none" strike="noStrike">
5386
- <a:solidFill>${createColorElement(opts.color || (/* inlined export .DEF_FONT_COLOR */"000000"))}</a:solidFill>
5387
- <a:latin typeface="${encodeXmlEntities(opts.fontFace) || 'Arial'}"/>
5388
- <a:ea typeface="${encodeXmlEntities(opts.fontFace) || 'Arial'}"/>
5389
- </a:rPr>
5390
- <a:t>${encodeXmlEntities(opts.title) || ''}</a:t>
5391
- </a:r>
5392
- </a:p>
5393
- </c:rich>
5394
- </c:tx>
5395
- ${layout}
5396
- <c:overlay val="0"/>
5397
- </c:title>`;
5398
- }
5399
-
5400
6508
  function utils_define_property(obj, key, value) {
5401
6509
  if (key in obj) {
5402
6510
  Object.defineProperty(obj, key, {
@@ -5575,21 +6683,317 @@ function createLineCap(lineCap) {
5575
6683
  'sysDot'
5576
6684
  ];
5577
6685
  /**
5578
- * Per-series dash wins over chart-level `lineDash`. Unknown values fall back so we never
5579
- * emit an illegal ST_PresetLineDashVal.
5580
- */ function resolveSeriesLineDash(seriesDash, chartDash) {
5581
- if (seriesDash && CHART_LINE_DASH_TYPES.includes(seriesDash)) return seriesDash;
5582
- if (chartDash && CHART_LINE_DASH_TYPES.includes(chartDash)) return chartDash;
5583
- return 'solid';
6686
+ * Per-series dash wins over chart-level `lineDash`. Unknown values fall back so we never
6687
+ * emit an illegal ST_PresetLineDashVal.
6688
+ */ function resolveSeriesLineDash(seriesDash, chartDash) {
6689
+ if (seriesDash && CHART_LINE_DASH_TYPES.includes(seriesDash)) return seriesDash;
6690
+ if (chartDash && CHART_LINE_DASH_TYPES.includes(chartDash)) return chartDash;
6691
+ return 'solid';
6692
+ }
6693
+ /** Area charts use `c:grouping` / ST_Grouping (standard|stacked|percentStacked), not ST_BarGrouping. */ const AREA_GROUPING = [
6694
+ 'standard',
6695
+ 'stacked',
6696
+ 'percentStacked'
6697
+ ];
6698
+ function resolveAreaGrouping(barGrouping) {
6699
+ if (barGrouping && AREA_GROUPING.includes(barGrouping)) return barGrouping;
6700
+ return 'standard';
6701
+ }
6702
+
6703
+ /**
6704
+ * ChartEx (`cx:chartSpace`) rendering - MS-ODRAWXML 2.1.
6705
+ *
6706
+ * PowerPoint 2016 introduced chart layouts that ECMA-376 has no markup for. They are written to their
6707
+ * own part, in the `cx` namespace, and share nothing with the `c:` emitter in `xml.ts` beyond the
6708
+ * embedded workbook: the data lives in `cx:chartData` (one `cx:data` per series) and the layout is
6709
+ * selected by `cx:series@layoutId` rather than by the element name.
6710
+ *
6711
+ * The cell references point at the same worksheet `workbook.ts` writes for classic charts - column A
6712
+ * holds the category labels, columns B.. hold one series each, row 1 holds the series names - so no
6713
+ * chartex-specific workbook layout is needed.
6714
+ */
6715
+
6716
+
6717
+ /** Sheet name written by `workbook.ts`; chartex cell references are absolute and always single-sheet */ const SHEET = 'Sheet1';
6718
+ /**
6719
+ * Category-axis gap width per layout, matching what PowerPoint writes for a freshly inserted chart.
6720
+ * A layout absent here (treemap, sunburst) draws no axes at all.
6721
+ */ const CAT_GAP_WIDTH = {
6722
+ boxWhisker: '1',
6723
+ funnel: '0.0599999987',
6724
+ histogram: '0',
6725
+ waterfall: '0.5'
6726
+ };
6727
+ function firstLabelLevel(data) {
6728
+ var _data_;
6729
+ const labels = (_data_ = data[0]) === null || _data_ === void 0 ? void 0 : _data_.labels;
6730
+ if (!labels || labels.length === 0) return [];
6731
+ const level = labels[0];
6732
+ return Array.isArray(level) ? level : [];
6733
+ }
6734
+ /**
6735
+ * `<cx:pt idx="N">value</cx:pt>` for every point of one dimension
6736
+ * - a missing point is written empty: `cx:pt` inside a `cx:numDim` must be a number, so the string
6737
+ * "null" would be a schema violation (the ECMA-376 emitter blanks the same case)
6738
+ */ function makePoints(values) {
6739
+ return values.map((value, idx)=>`<cx:pt idx="${idx}">${value === null || value === undefined ? '' : encodeXmlEntities(String(value))}</cx:pt>`).join('');
6740
+ }
6741
+ /**
6742
+ * Absolute A1 reference for one column of the embedded worksheet, excluding the header row.
6743
+ * The range length must equal the dimension's own `ptCount`, so each dimension passes its own.
6744
+ */ function columnRef(colIdx, pointCount) {
6745
+ const col = getExcelColName(colIdx);
6746
+ return `${SHEET}!$${col}$2:$${col}$${pointCount + 1}`;
6747
+ }
6748
+ /**
6749
+ * One `cx:data` block per series.
6750
+ * - hierarchical layouts (treemap, sunburst) size their segments through a `size` dimension
6751
+ * - a histogram bins raw values itself, so it carries no category dimension at all
6752
+ */ function makeChartData(rel, chartType) {
6753
+ const labels = firstLabelLevel(rel.data);
6754
+ const dimType = chartType === 'treemap' || chartType === 'sunburst' ? 'size' : 'val';
6755
+ return rel.data.map((series, seriesIdx)=>{
6756
+ var _series_values;
6757
+ const values = (_series_values = series.values) !== null && _series_values !== void 0 ? _series_values : [];
6758
+ const catDim = chartType === 'histogram' || labels.length === 0 ? '' : `<cx:strDim type="cat"><cx:f>${columnRef(1, labels.length)}</cx:f><cx:lvl ptCount="${labels.length}">${makePoints(labels)}</cx:lvl></cx:strDim>`;
6759
+ const valDim = `<cx:numDim type="${dimType}"><cx:f>${columnRef(seriesIdx + 2, values.length)}</cx:f>` + `<cx:lvl ptCount="${values.length}" formatCode="General">${makePoints(values)}</cx:lvl></cx:numDim>`;
6760
+ return `<cx:data id="${seriesIdx}">${catDim}${valDim}</cx:data>`;
6761
+ }).join('');
6762
+ }
6763
+ /** `cx:dataLabels` - chartex has no `c:dLbls`, visibility is a single element with three flags */ function makeDataLabels(opts, chartType) {
6764
+ var _opts_showValue, _opts_showLabel, _opts_dataLabelPosition;
6765
+ const showValue = (_opts_showValue = opts.showValue) !== null && _opts_showValue !== void 0 ? _opts_showValue : false;
6766
+ const showCategory = (_opts_showLabel = opts.showLabel) !== null && _opts_showLabel !== void 0 ? _opts_showLabel : false;
6767
+ if (!showValue && !showCategory) return '';
6768
+ // `outEnd` is invalid on the layouts that draw labels inside their segments
6769
+ const defaultPos = chartType === 'treemap' || chartType === 'sunburst' || chartType === 'funnel' ? 'ctr' : 'outEnd';
6770
+ const pos = (_opts_dataLabelPosition = opts.dataLabelPosition) !== null && _opts_dataLabelPosition !== void 0 ? _opts_dataLabelPosition : defaultPos;
6771
+ const size = Math.round((opts.dataLabelFontSize || (/* inlined export .DEF_FONT_SIZE */12)) * 100);
6772
+ const txPr = '<cx:txPr><a:bodyPr/><a:lstStyle/><a:p><a:pPr>' + `<a:defRPr sz="${size}" b="${opts.dataLabelFontBold ? 1 : 0}" i="${opts.dataLabelFontItalic ? 1 : 0}">` + `<a:solidFill>${createColorElement(opts.dataLabelColor || (/* inlined export .DEF_FONT_COLOR */"000000"))}</a:solidFill>` + `<a:latin typeface="${encodeXmlEntities(opts.dataLabelFontFace || 'Arial')}"/>` + '</a:defRPr></a:pPr></a:p></cx:txPr>';
6773
+ const numFmt = opts.dataLabelFormatCode ? `<cx:numFmt formatCode="${encodeXmlEntities(opts.dataLabelFormatCode)}" sourceLinked="0"/>` : '';
6774
+ return `<cx:dataLabels pos="${pos}">` + `<cx:visibility seriesName="0" categoryName="${showCategory ? 1 : 0}" value="${showValue ? 1 : 0}"/>` + numFmt + txPr + '</cx:dataLabels>';
6775
+ }
6776
+ /**
6777
+ * `cx:layoutPr` carries everything that is layout-specific rather than series-generic.
6778
+ * Anything absent here is left to PowerPoint's own default for that layout.
6779
+ */ function makeLayoutProps(opts, chartType) {
6780
+ switch(chartType){
6781
+ case 'waterfall':
6782
+ {
6783
+ var _opts_chartExSubtotals;
6784
+ const subtotals = (_opts_chartExSubtotals = opts.chartExSubtotals) !== null && _opts_chartExSubtotals !== void 0 ? _opts_chartExSubtotals : [];
6785
+ if (subtotals.length === 0) return '';
6786
+ return `<cx:layoutPr><cx:subtotals>${subtotals.map((idx)=>`<cx:idx val="${idx}"/>`).join('')}</cx:subtotals></cx:layoutPr>`;
6787
+ }
6788
+ case 'histogram':
6789
+ {
6790
+ const binSize = opts.chartExBinSize;
6791
+ const binCount = opts.chartExBinCount;
6792
+ // PowerPoint accepts exactly one binning rule; an explicit size wins over a count, and neither
6793
+ // means "let PowerPoint choose" (its automatic Scott's-rule binning)
6794
+ const rule = binSize !== undefined ? `<cx:binSize val="${binSize}"/>` : binCount !== undefined ? `<cx:binCount val="${binCount}"/>` : '';
6795
+ const binning = rule ? `<cx:binning intervalClosed="r">${rule}</cx:binning>` : '<cx:binning intervalClosed="r"/>';
6796
+ return `<cx:layoutPr>${binning}</cx:layoutPr>`;
6797
+ }
6798
+ case 'boxWhisker':
6799
+ return '<cx:layoutPr>' + `<cx:visibility meanLine="${opts.chartExMeanLine ? 1 : 0}" meanMarker="1" nonoutliers="0" outliers="1"/>` + '<cx:statistics quartileMethod="exclusive"/>' + '</cx:layoutPr>';
6800
+ case 'treemap':
6801
+ var _opts_chartExParentLabels;
6802
+ return `<cx:layoutPr><cx:parentLabelLayout val="${(_opts_chartExParentLabels = opts.chartExParentLabels) !== null && _opts_chartExParentLabels !== void 0 ? _opts_chartExParentLabels : 'overlapping'}"/></cx:layoutPr>`;
6803
+ default:
6804
+ return '';
6805
+ }
6806
+ }
6807
+ /** One `cx:series` per data row. Order follows CT_Series: tx, spPr, dataLabels, dataId, layoutPr, axisId. */ function makeSeries(rel, chartType) {
6808
+ const layoutId = CHARTEX_LAYOUT_ID[chartType];
6809
+ const dataLabels = makeDataLabels(rel.opts, chartType);
6810
+ const layoutPr = makeLayoutProps(rel.opts, chartType);
6811
+ return rel.data.map((series, idx)=>{
6812
+ var _series_name;
6813
+ const nameCell = `${SHEET}!$${getExcelColName(idx + 2)}$1`;
6814
+ // These layouts color each data point from the chart color style, so `chartColors` does not
6815
+ // apply - a series-level fill would flatten a treemap to one color. Only `color` overrides it.
6816
+ const spPr = series.color && series.color !== 'transparent' ? `<cx:spPr><a:solidFill>${createColorElement(series.color)}</a:solidFill></cx:spPr>` : '';
6817
+ return `<cx:series layoutId="${layoutId}" uniqueId="{${getUuid('xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx').toUpperCase()}}">` + `<cx:tx><cx:txData><cx:f>${nameCell}</cx:f><cx:v>${encodeXmlEntities((_series_name = series.name) !== null && _series_name !== void 0 ? _series_name : `Series ${idx + 1}`)}</cx:v></cx:txData></cx:tx>` + spPr + dataLabels + `<cx:dataId val="${idx}"/>` + layoutPr + '</cx:series>';
6818
+ }).join('');
6819
+ }
6820
+ /**
6821
+ * `cx:axis` elements for the layouts that have axes. CT_Axis order: scaling, gridlines, tickLabels.
6822
+ * - a funnel is drawn along a single category axis, which PowerPoint numbers `1`
6823
+ * - treemap and sunburst have no axes; the series carries no `cx:axisId` in either case
6824
+ */ function makeAxes(rel, chartType) {
6825
+ var _rel_opts_valGridLine;
6826
+ const gapWidth = CAT_GAP_WIDTH[chartType];
6827
+ if (gapWidth === undefined) return '';
6828
+ if (chartType === 'funnel') return `<cx:axis id="1"><cx:catScaling gapWidth="${gapWidth}"/><cx:tickLabels/></cx:axis>`;
6829
+ const valGridlines = ((_rel_opts_valGridLine = rel.opts.valGridLine) === null || _rel_opts_valGridLine === void 0 ? void 0 : _rel_opts_valGridLine.style) === 'none' ? '' : '<cx:majorGridlines/>';
6830
+ return `<cx:axis id="0"><cx:catScaling gapWidth="${gapWidth}"/><cx:tickLabels/></cx:axis>` + `<cx:axis id="1"><cx:valScaling/>${valGridlines}<cx:tickLabels/></cx:axis>`;
6831
+ }
6832
+ function makeTitle(opts) {
6833
+ if (!opts.showTitle) return '';
6834
+ const size = Math.round((opts.titleFontSize || (/* inlined export .DEF_FONT_TITLE_SIZE */18)) * 100);
6835
+ const color = opts.titleColor ? `<a:solidFill>${createColorElement(opts.titleColor)}</a:solidFill>` : '';
6836
+ const face = opts.titleFontFace ? `<a:latin typeface="${encodeXmlEntities(opts.titleFontFace)}"/>` : '';
6837
+ return '<cx:title pos="t" align="ctr" overlay="0"><cx:tx><cx:rich><a:bodyPr/><a:lstStyle/><a:p><a:pPr algn="ctr"/><a:r>' + `<a:rPr lang="${opts.lang || 'en-US'}" sz="${size}" b="${opts.titleBold ? 1 : 0}">${color}${face}</a:rPr>` + `<a:t>${encodeXmlEntities(opts.title || 'Chart Title')}</a:t>` + '</a:r></a:p></cx:rich></cx:tx></cx:title>';
6838
+ }
6839
+ function makeLegend(opts) {
6840
+ if (!opts.showLegend) return '';
6841
+ // `cx:legend@pos` takes l/r/t/b only; PowerPoint stores the library's `tr` as a top-aligned right legend
6842
+ const isTopRight = opts.legendPos === 'tr';
6843
+ return `<cx:legend pos="${isTopRight ? 'r' : opts.legendPos || 'r'}" align="${isTopRight ? 'min' : 'ctr'}" overlay="0"/>`;
6844
+ }
6845
+ /**
6846
+ * Build the `cx:chartSpace` part for one chartex chart.
6847
+ * @param {ISlideRelChart} rel - chart relationship, with `opts._type` narrowed to a chartex type
6848
+ * @returns {string} chartex part XML
6849
+ */ function makeXmlChartEx(rel) {
6850
+ const type = rel.opts._type;
6851
+ if (!isChartexType(type)) throw new Error(`pptxgenjs: "${String(type)}" is not a chartex chart type`);
6852
+ return '<?xml version="1.0" encoding="UTF-8" standalone="yes"?>' + '<cx:chartSpace xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main"' + ' xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships"' + ` xmlns:cx="${OOXML_CHARTEX.ns}">` + '<cx:chartData>' + '<cx:externalData r:id="rId1" cx:autoUpdate="0"/>' + makeChartData(rel, type) + '</cx:chartData>' + '<cx:chart>' + makeTitle(rel.opts) + '<cx:plotArea>' + `<cx:plotAreaRegion>${makeSeries(rel, type)}</cx:plotAreaRegion>` + makeAxes(rel, type) + '</cx:plotArea>' + makeLegend(rel.opts) + '</cx:chart>' + '</cx:chartSpace>';
6853
+ }
6854
+
6855
+ /**
6856
+ * Chart style and chart colour-style parts (`ppt/charts/styleN.xml`, `ppt/charts/colorsN.xml`).
6857
+ *
6858
+ * Classic `c:chart` parts write these only when `chartStyle` or `chartColorStyle` is set.
6859
+ * ChartEx layouts always need both: PowerPoint resolves their visual properties through them.
6860
+ *
6861
+ * PowerPoint finds both parts by relationship type from the chart's own `.rels` - nothing inside
6862
+ * `chartN.xml` points at them.
6863
+ */
6864
+
6865
+ const XML_HEADER = '<?xml version="1.0" encoding="UTF-8" standalone="yes"?>';
6866
+ const NS_ATTRS = `xmlns:cs="${CHART_STYLE.ns}" xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main"`;
6867
+ /** The luminance variations Office writes for a six-colour cycling palette */ const DEF_VARIATIONS = [
6868
+ '',
6869
+ '<a:lumMod val="60000"/>',
6870
+ '<a:lumMod val="80000"/><a:lumOff val="20000"/>',
6871
+ '<a:lumMod val="80000"/>',
6872
+ '<a:lumMod val="60000"/><a:lumOff val="40000"/>',
6873
+ '<a:lumMod val="50000"/>',
6874
+ '<a:lumMod val="70000"/><a:lumOff val="30000"/>',
6875
+ '<a:lumMod val="70000"/>',
6876
+ '<a:lumMod val="50000"/><a:lumOff val="50000"/>'
6877
+ ];
6878
+ /** The six theme accents, which is what Office's default colour style cycles through */ const DEF_ACCENTS = [
6879
+ 'accent1',
6880
+ 'accent2',
6881
+ 'accent3',
6882
+ 'accent4',
6883
+ 'accent5',
6884
+ 'accent6'
6885
+ ];
6886
+ /**
6887
+ * Whether this chart should write `styleN.xml` / `colorsN.xml`.
6888
+ * ChartEx always needs them; classic charts only write them when the caller opts in.
6889
+ */ function wantsChartStyleParts(opts) {
6890
+ if (!opts) return false;
6891
+ if (isChartexType(opts._type)) return true;
6892
+ return opts.chartStyle !== undefined || opts.chartColorStyle !== undefined;
6893
+ }
6894
+ /**
6895
+ * Part name for a chart's colour style, matching the chart's own number
6896
+ * @param {number} chartNum - the N in `chartN.xml`
6897
+ * @returns {string} part name
6898
+ */ function chartColorsPartName(chartNum) {
6899
+ return `ppt/charts/colors${chartNum}.xml`;
6900
+ }
6901
+ /**
6902
+ * Part name for a chart's style, matching the chart's own number
6903
+ * @param {number} chartNum - the N in `chartN.xml`
6904
+ * @returns {string} part name
6905
+ */ function chartStylePartName(chartNum) {
6906
+ return `ppt/charts/style${chartNum}.xml`;
6907
+ }
6908
+ /**
6909
+ * Creates a chart's colour-style part (`cs:colorStyle`).
6910
+ * @param {ChartColorStyleProps} [props] - colour style options
6911
+ * @returns {string} XML
6912
+ */ function makeXmlChartColors(props) {
6913
+ const methods = [
6914
+ 'cycle',
6915
+ 'withinLinear',
6916
+ 'acrossLinear',
6917
+ 'withinLinearReversed',
6918
+ 'acrossLinearReversed'
6919
+ ];
6920
+ const method = (props === null || props === void 0 ? void 0 : props.method) && methods.includes(props.method) ? props.method : 'cycle';
6921
+ const id = typeof (props === null || props === void 0 ? void 0 : props.id) === 'number' && isFinite(props.id) && props.id > 0 ? Math.round(props.id) : 10;
6922
+ const colors = Array.isArray(props === null || props === void 0 ? void 0 : props.colors) && props.colors.length > 0 ? props.colors.map((color)=>createColorElement(color)).join('') : DEF_ACCENTS.map((accent)=>`<a:schemeClr val="${accent}"/>`).join('');
6923
+ return `${XML_HEADER}<cs:colorStyle ${NS_ATTRS} meth="${method}" id="${id}">` + colors + DEF_VARIATIONS.map((variation)=>variation ? `<cs:variation>${variation}</cs:variation>` : '<cs:variation/>').join('') + '</cs:colorStyle>';
5584
6924
  }
5585
- /** Area charts use `c:grouping` / ST_Grouping (standard|stacked|percentStacked), not ST_BarGrouping. */ const AREA_GROUPING = [
5586
- 'standard',
5587
- 'stacked',
5588
- 'percentStacked'
5589
- ];
5590
- function resolveAreaGrouping(barGrouping) {
5591
- if (barGrouping && AREA_GROUPING.includes(barGrouping)) return barGrouping;
5592
- return 'standard';
6925
+ /**
6926
+ * Office's default chart style definitions, verbatim.
6927
+ *
6928
+ * The `@id` names which entry of PowerPoint's gallery is selected; the ~30 `cs:*` children are the
6929
+ * definitions themselves. Only this one set is shipped - reproducing every gallery entry would mean
6930
+ * ~150 more, none of which can be verified from a published schema.
6931
+ */ const DEF_CHART_STYLE = '<cs:chartStyle xmlns:cs="http://schemas.microsoft.com/office/drawing/2012/chartStyle" xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main" id="201"><cs:axisTitle><cs:lnRef idx="0"/><cs:fillRef idx="0"/><cs:effectRef idx="0"/><cs:fontRef idx="minor"><a:schemeClr val="tx1"><a:lumMod val="65000"/><a:lumOff val="35000"/></a:schemeClr></cs:fontRef><cs:defRPr sz="1330" kern="1200"/></cs:axisTitle><cs:categoryAxis><cs:lnRef idx="0"/><cs:fillRef idx="0"/><cs:effectRef idx="0"/><cs:fontRef idx="minor"><a:schemeClr val="tx1"><a:lumMod val="65000"/><a:lumOff val="35000"/></a:schemeClr></cs:fontRef><cs:spPr><a:ln w="9525" cap="flat" cmpd="sng" algn="ctr"><a:solidFill><a:schemeClr val="tx1"><a:lumMod val="15000"/><a:lumOff val="85000"/></a:schemeClr></a:solidFill><a:round/></a:ln></cs:spPr><cs:defRPr sz="1197" kern="1200"/></cs:categoryAxis><cs:chartArea mods="allowNoFillOverride allowNoLineOverride"><cs:lnRef idx="0"/><cs:fillRef idx="0"/><cs:effectRef idx="0"/><cs:fontRef idx="minor"><a:schemeClr val="tx1"/></cs:fontRef><cs:spPr><a:solidFill><a:schemeClr val="bg1"/></a:solidFill><a:ln w="9525" cap="flat" cmpd="sng" algn="ctr"><a:solidFill><a:schemeClr val="tx1"><a:lumMod val="15000"/><a:lumOff val="85000"/></a:schemeClr></a:solidFill><a:round/></a:ln></cs:spPr><cs:defRPr sz="1330" kern="1200"/></cs:chartArea><cs:dataLabel><cs:lnRef idx="0"/><cs:fillRef idx="0"/><cs:effectRef idx="0"/><cs:fontRef idx="minor"><a:schemeClr val="tx1"><a:lumMod val="75000"/><a:lumOff val="25000"/></a:schemeClr></cs:fontRef><cs:defRPr sz="1197" kern="1200"/></cs:dataLabel><cs:dataLabelCallout><cs:lnRef idx="0"/><cs:fillRef idx="0"/><cs:effectRef idx="0"/><cs:fontRef idx="minor"><a:schemeClr val="dk1"><a:lumMod val="65000"/><a:lumOff val="35000"/></a:schemeClr></cs:fontRef><cs:spPr><a:solidFill><a:schemeClr val="lt1"/></a:solidFill><a:ln><a:solidFill><a:schemeClr val="dk1"><a:lumMod val="25000"/><a:lumOff val="75000"/></a:schemeClr></a:solidFill></a:ln></cs:spPr><cs:defRPr sz="1197" kern="1200"/><cs:bodyPr rot="0" spcFirstLastPara="1" vertOverflow="clip" horzOverflow="clip" vert="horz" wrap="square" lIns="36576" tIns="18288" rIns="36576" bIns="18288" anchor="ctr" anchorCtr="1"><a:spAutoFit/></cs:bodyPr></cs:dataLabelCallout><cs:dataPoint><cs:lnRef idx="0"/><cs:fillRef idx="1"><cs:styleClr val="auto"/></cs:fillRef><cs:effectRef idx="0"/><cs:fontRef idx="minor"><a:schemeClr val="tx1"/></cs:fontRef></cs:dataPoint><cs:dataPoint3D><cs:lnRef idx="0"/><cs:fillRef idx="1"><cs:styleClr val="auto"/></cs:fillRef><cs:effectRef idx="0"/><cs:fontRef idx="minor"><a:schemeClr val="tx1"/></cs:fontRef></cs:dataPoint3D><cs:dataPointLine><cs:lnRef idx="0"><cs:styleClr val="auto"/></cs:lnRef><cs:fillRef idx="1"/><cs:effectRef idx="0"/><cs:fontRef idx="minor"><a:schemeClr val="tx1"/></cs:fontRef><cs:spPr><a:ln w="28575" cap="rnd"><a:solidFill><a:schemeClr val="phClr"/></a:solidFill><a:round/></a:ln></cs:spPr></cs:dataPointLine><cs:dataPointMarker><cs:lnRef idx="0"><cs:styleClr val="auto"/></cs:lnRef><cs:fillRef idx="1"><cs:styleClr val="auto"/></cs:fillRef><cs:effectRef idx="0"/><cs:fontRef idx="minor"><a:schemeClr val="tx1"/></cs:fontRef><cs:spPr><a:ln w="9525"><a:solidFill><a:schemeClr val="phClr"/></a:solidFill></a:ln></cs:spPr></cs:dataPointMarker><cs:dataPointMarkerLayout symbol="circle" size="5"/><cs:dataPointWireframe><cs:lnRef idx="0"><cs:styleClr val="auto"/></cs:lnRef><cs:fillRef idx="1"/><cs:effectRef idx="0"/><cs:fontRef idx="minor"><a:schemeClr val="tx1"/></cs:fontRef><cs:spPr><a:ln w="9525" cap="rnd"><a:solidFill><a:schemeClr val="phClr"/></a:solidFill><a:round/></a:ln></cs:spPr></cs:dataPointWireframe><cs:dataTable><cs:lnRef idx="0"/><cs:fillRef idx="0"/><cs:effectRef idx="0"/><cs:fontRef idx="minor"><a:schemeClr val="tx1"><a:lumMod val="65000"/><a:lumOff val="35000"/></a:schemeClr></cs:fontRef><cs:spPr><a:noFill/><a:ln w="9525" cap="flat" cmpd="sng" algn="ctr"><a:solidFill><a:schemeClr val="tx1"><a:lumMod val="15000"/><a:lumOff val="85000"/></a:schemeClr></a:solidFill><a:round/></a:ln></cs:spPr><cs:defRPr sz="1197" kern="1200"/></cs:dataTable><cs:downBar><cs:lnRef idx="0"/><cs:fillRef idx="0"/><cs:effectRef idx="0"/><cs:fontRef idx="minor"><a:schemeClr val="dk1"/></cs:fontRef><cs:spPr><a:solidFill><a:schemeClr val="dk1"><a:lumMod val="65000"/><a:lumOff val="35000"/></a:schemeClr></a:solidFill><a:ln w="9525"><a:solidFill><a:schemeClr val="tx1"><a:lumMod val="65000"/><a:lumOff val="35000"/></a:schemeClr></a:solidFill></a:ln></cs:spPr></cs:downBar><cs:dropLine><cs:lnRef idx="0"/><cs:fillRef idx="0"/><cs:effectRef idx="0"/><cs:fontRef idx="minor"><a:schemeClr val="tx1"/></cs:fontRef><cs:spPr><a:ln w="9525" cap="flat" cmpd="sng" algn="ctr"><a:solidFill><a:schemeClr val="tx1"><a:lumMod val="35000"/><a:lumOff val="65000"/></a:schemeClr></a:solidFill><a:round/></a:ln></cs:spPr></cs:dropLine><cs:errorBar><cs:lnRef idx="0"/><cs:fillRef idx="0"/><cs:effectRef idx="0"/><cs:fontRef idx="minor"><a:schemeClr val="tx1"/></cs:fontRef><cs:spPr><a:ln w="9525" cap="flat" cmpd="sng" algn="ctr"><a:solidFill><a:schemeClr val="tx1"><a:lumMod val="65000"/><a:lumOff val="35000"/></a:schemeClr></a:solidFill><a:round/></a:ln></cs:spPr></cs:errorBar><cs:floor><cs:lnRef idx="0"/><cs:fillRef idx="0"/><cs:effectRef idx="0"/><cs:fontRef idx="minor"><a:schemeClr val="tx1"/></cs:fontRef><cs:spPr><a:noFill/><a:ln><a:noFill/></a:ln></cs:spPr></cs:floor><cs:gridlineMajor><cs:lnRef idx="0"/><cs:fillRef idx="0"/><cs:effectRef idx="0"/><cs:fontRef idx="minor"><a:schemeClr val="tx1"/></cs:fontRef><cs:spPr><a:ln w="9525" cap="flat" cmpd="sng" algn="ctr"><a:solidFill><a:schemeClr val="tx1"><a:lumMod val="15000"/><a:lumOff val="85000"/></a:schemeClr></a:solidFill><a:round/></a:ln></cs:spPr></cs:gridlineMajor><cs:gridlineMinor><cs:lnRef idx="0"/><cs:fillRef idx="0"/><cs:effectRef idx="0"/><cs:fontRef idx="minor"><a:schemeClr val="tx1"/></cs:fontRef><cs:spPr><a:ln w="9525" cap="flat" cmpd="sng" algn="ctr"><a:solidFill><a:schemeClr val="tx1"><a:lumMod val="5000"/><a:lumOff val="95000"/></a:schemeClr></a:solidFill><a:round/></a:ln></cs:spPr></cs:gridlineMinor><cs:hiLoLine><cs:lnRef idx="0"/><cs:fillRef idx="0"/><cs:effectRef idx="0"/><cs:fontRef idx="minor"><a:schemeClr val="tx1"/></cs:fontRef><cs:spPr><a:ln w="9525" cap="flat" cmpd="sng" algn="ctr"><a:solidFill><a:schemeClr val="tx1"><a:lumMod val="75000"/><a:lumOff val="25000"/></a:schemeClr></a:solidFill><a:round/></a:ln></cs:spPr></cs:hiLoLine><cs:leaderLine><cs:lnRef idx="0"/><cs:fillRef idx="0"/><cs:effectRef idx="0"/><cs:fontRef idx="minor"><a:schemeClr val="tx1"/></cs:fontRef><cs:spPr><a:ln w="9525" cap="flat" cmpd="sng" algn="ctr"><a:solidFill><a:schemeClr val="tx1"><a:lumMod val="35000"/><a:lumOff val="65000"/></a:schemeClr></a:solidFill><a:round/></a:ln></cs:spPr></cs:leaderLine><cs:legend><cs:lnRef idx="0"/><cs:fillRef idx="0"/><cs:effectRef idx="0"/><cs:fontRef idx="minor"><a:schemeClr val="tx1"><a:lumMod val="65000"/><a:lumOff val="35000"/></a:schemeClr></cs:fontRef><cs:defRPr sz="1197" kern="1200"/></cs:legend><cs:plotArea mods="allowNoFillOverride allowNoLineOverride"><cs:lnRef idx="0"/><cs:fillRef idx="0"/><cs:effectRef idx="0"/><cs:fontRef idx="minor"><a:schemeClr val="tx1"/></cs:fontRef></cs:plotArea><cs:plotArea3D mods="allowNoFillOverride allowNoLineOverride"><cs:lnRef idx="0"/><cs:fillRef idx="0"/><cs:effectRef idx="0"/><cs:fontRef idx="minor"><a:schemeClr val="tx1"/></cs:fontRef></cs:plotArea3D><cs:seriesAxis><cs:lnRef idx="0"/><cs:fillRef idx="0"/><cs:effectRef idx="0"/><cs:fontRef idx="minor"><a:schemeClr val="tx1"><a:lumMod val="65000"/><a:lumOff val="35000"/></a:schemeClr></cs:fontRef><cs:defRPr sz="1197" kern="1200"/></cs:seriesAxis><cs:seriesLine><cs:lnRef idx="0"/><cs:fillRef idx="0"/><cs:effectRef idx="0"/><cs:fontRef idx="minor"><a:schemeClr val="tx1"/></cs:fontRef><cs:spPr><a:ln w="9525" cap="flat" cmpd="sng" algn="ctr"><a:solidFill><a:schemeClr val="tx1"><a:lumMod val="35000"/><a:lumOff val="65000"/></a:schemeClr></a:solidFill><a:round/></a:ln></cs:spPr></cs:seriesLine><cs:title><cs:lnRef idx="0"/><cs:fillRef idx="0"/><cs:effectRef idx="0"/><cs:fontRef idx="minor"><a:schemeClr val="tx1"><a:lumMod val="65000"/><a:lumOff val="35000"/></a:schemeClr></cs:fontRef><cs:defRPr sz="1862" b="0" kern="1200" spc="0" baseline="0"/></cs:title><cs:trendline><cs:lnRef idx="0"><cs:styleClr val="auto"/></cs:lnRef><cs:fillRef idx="0"/><cs:effectRef idx="0"/><cs:fontRef idx="minor"><a:schemeClr val="tx1"/></cs:fontRef><cs:spPr><a:ln w="19050" cap="rnd"><a:solidFill><a:schemeClr val="phClr"/></a:solidFill><a:prstDash val="sysDot"/></a:ln></cs:spPr></cs:trendline><cs:trendlineLabel><cs:lnRef idx="0"/><cs:fillRef idx="0"/><cs:effectRef idx="0"/><cs:fontRef idx="minor"><a:schemeClr val="tx1"><a:lumMod val="65000"/><a:lumOff val="35000"/></a:schemeClr></cs:fontRef><cs:defRPr sz="1197" kern="1200"/></cs:trendlineLabel><cs:upBar><cs:lnRef idx="0"/><cs:fillRef idx="0"/><cs:effectRef idx="0"/><cs:fontRef idx="minor"><a:schemeClr val="dk1"/></cs:fontRef><cs:spPr><a:solidFill><a:schemeClr val="lt1"/></a:solidFill><a:ln w="9525"><a:solidFill><a:schemeClr val="tx1"><a:lumMod val="15000"/><a:lumOff val="85000"/></a:schemeClr></a:solidFill></a:ln></cs:spPr></cs:upBar><cs:valueAxis><cs:lnRef idx="0"/><cs:fillRef idx="0"/><cs:effectRef idx="0"/><cs:fontRef idx="minor"><a:schemeClr val="tx1"><a:lumMod val="65000"/><a:lumOff val="35000"/></a:schemeClr></cs:fontRef><cs:defRPr sz="1197" kern="1200"/></cs:valueAxis><cs:wall><cs:lnRef idx="0"/><cs:fillRef idx="0"/><cs:effectRef idx="0"/><cs:fontRef idx="minor"><a:schemeClr val="tx1"/></cs:fontRef><cs:spPr><a:noFill/><a:ln><a:noFill/></a:ln></cs:spPr></cs:wall></cs:chartStyle>';
6932
+ /**
6933
+ * Creates a chart's style part (`cs:chartStyle`).
6934
+ * @param {number} [styleId] - which gallery entry is selected; the definitions are Office's defaults
6935
+ * @returns {string} XML
6936
+ */ function makeXmlChartStyle(styleId) {
6937
+ const body = typeof styleId === 'number' && isFinite(styleId) && styleId > 0 ? DEF_CHART_STYLE.replace(/ id="\d+">/, ` id="${Math.round(styleId)}">`) : DEF_CHART_STYLE;
6938
+ return XML_HEADER + body;
6939
+ }
6940
+
6941
+ /**
6942
+ * Chart title rendering.
6943
+ */
6944
+
6945
+ /**
6946
+ * Create char title elements
6947
+ * @param {IChartPropsTitle} opts - options
6948
+ * @return {string} XML `<c:title>`
6949
+ */ function genXmlTitle(opts, chartX, chartY) {
6950
+ const align = opts.titleAlign === 'left' || opts.titleAlign === 'right' ? `<a:pPr algn="${opts.titleAlign.substring(0, 1)}">` : '<a:pPr>';
6951
+ const rotate = opts.titleRotate ? `<a:bodyPr rot="${convertRotationDegrees(opts.titleRotate)}"/>` : '<a:bodyPr/>' // don't specify rotation to get default (ex. vertical for cat axis)
6952
+ ;
6953
+ const sizeAttr = opts.fontSize ? `sz="${Math.round(opts.fontSize * 100)}"` : '' // only set the font size if specified. Powerpoint will handle the default size
6954
+ ;
6955
+ const titleBold = opts.titleBold ? 1 : 0;
6956
+ const titleItalic = opts.titleItalic ? 1 : 0;
6957
+ let layout = '<c:layout/>';
6958
+ if (opts.titlePos && typeof opts.titlePos.x === 'number' && typeof opts.titlePos.y === 'number') {
6959
+ // NOTE: manualLayout x/y vals are *relative to entire slide*
6960
+ const totalX = opts.titlePos.x + (chartX !== null && chartX !== void 0 ? chartX : 0);
6961
+ const totalY = opts.titlePos.y + (chartY !== null && chartY !== void 0 ? chartY : 0);
6962
+ let valX = totalX === 0 ? 0 : totalX * (totalX / 5) / 10;
6963
+ if (valX >= 1) valX = valX / 10;
6964
+ if (valX >= 0.1) valX = valX / 10;
6965
+ let valY = totalY === 0 ? 0 : totalY * (totalY / 5) / 10;
6966
+ if (valY >= 1) valY = valY / 10;
6967
+ if (valY >= 0.1) valY = valY / 10;
6968
+ layout = `<c:layout><c:manualLayout><c:xMode val="edge"/><c:yMode val="edge"/><c:x val="${valX}"/><c:y val="${valY}"/></c:manualLayout></c:layout>`;
6969
+ }
6970
+ return `<c:title>
6971
+ <c:tx>
6972
+ <c:rich>
6973
+ ${rotate}
6974
+ <a:lstStyle/>
6975
+ <a:p>
6976
+ ${align}
6977
+ <a:defRPr ${sizeAttr} b="${titleBold}" i="${titleItalic}" u="none" strike="noStrike">
6978
+ <a:solidFill>${createColorElement(opts.color || (/* inlined export .DEF_FONT_COLOR */"000000"))}</a:solidFill>
6979
+ <a:latin typeface="${encodeXmlEntities(opts.fontFace) || 'Arial'}"/>
6980
+ <a:ea typeface="${encodeXmlEntities(opts.fontFace) || 'Arial'}"/>
6981
+ </a:defRPr>
6982
+ </a:pPr>
6983
+ <a:r>
6984
+ <a:rPr ${sizeAttr} b="${titleBold}" i="${titleItalic}" u="none" strike="noStrike">
6985
+ <a:solidFill>${createColorElement(opts.color || (/* inlined export .DEF_FONT_COLOR */"000000"))}</a:solidFill>
6986
+ <a:latin typeface="${encodeXmlEntities(opts.fontFace) || 'Arial'}"/>
6987
+ <a:ea typeface="${encodeXmlEntities(opts.fontFace) || 'Arial'}"/>
6988
+ </a:rPr>
6989
+ <a:t>${encodeXmlEntities(opts.title) || ''}</a:t>
6990
+ </a:r>
6991
+ </a:p>
6992
+ </c:rich>
6993
+ </c:tx>
6994
+ ${layout}
6995
+ <c:overlay val="0"/>
6996
+ </c:title>`;
5593
6997
  }
5594
6998
 
5595
6999
  /**
@@ -6012,7 +7416,7 @@ function xml_object_spread_props(target, source) {
6012
7416
  usesSecondaryValAxis = usesSecondaryValAxis || ((_options_secondaryValAxis = options.secondaryValAxis) !== null && _options_secondaryValAxis !== void 0 ? _options_secondaryValAxis : false);
6013
7417
  strXml += makeChartType(type.type, type.data, options, valAxisId, catAxisId, true, rel.data);
6014
7418
  });
6015
- } else if (rel.opts._type) {
7419
+ } else if (rel.opts._type && !isChartexType(rel.opts._type)) {
6016
7420
  strXml += makeChartType(rel.opts._type, rel.data, rel.opts, AXIS_ID_VALUE_PRIMARY, AXIS_ID_CATEGORY_PRIMARY, false, rel.data);
6017
7421
  }
6018
7422
  // B: Axes -----------------------------------------------------------
@@ -7057,6 +8461,8 @@ function _async_to_generator(fn) {
7057
8461
 
7058
8462
 
7059
8463
 
8464
+
8465
+
7060
8466
  function getDataTableStyles(chartObject) {
7061
8467
  const dataTableFormats = Array.isArray(chartObject.opts._type) ? chartObject.opts._type.flatMap((type)=>{
7062
8468
  var _ref;
@@ -7561,8 +8967,19 @@ function makeNumberStyles(formats) {
7561
8967
  base64: true
7562
8968
  });
7563
8969
  // 2: Create the chart.xml and rel files
7564
- zip.file('ppt/charts/_rels/' + chartObject.fileName + '.rels', '<?xml version="1.0" encoding="UTF-8" standalone="yes"?>' + '<Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships">' + `<Relationship Id="rId1" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/package" Target="../embeddings/Microsoft_Excel_Worksheet${chartObject.globalId}.xlsx"/>` + '</Relationships>');
7565
- zip.file(`ppt/charts/${chartObject.fileName}`, makeXmlCharts(chartObject));
8970
+ // PowerPoint finds the style and colour-style parts by relationship type, so they are
8971
+ // declared here rather than referenced from inside `chartN.xml`.
8972
+ // Classic charts write them only when requested; ChartEx layouts always need them.
8973
+ const isChartex = isChartexType(chartObject.opts._type);
8974
+ const writeStyleParts = wantsChartStyleParts(chartObject.opts);
8975
+ const styleRels = writeStyleParts ? `<Relationship Id="rId2" Type="${CHART_STYLE.colorsRelType}" Target="colors${chartObject.globalId}.xml"/>` + `<Relationship Id="rId3" Type="${CHART_STYLE.styleRelType}" Target="style${chartObject.globalId}.xml"/>` : '';
8976
+ zip.file('ppt/charts/_rels/' + chartObject.fileName + '.rels', '<?xml version="1.0" encoding="UTF-8" standalone="yes"?>' + '<Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships">' + `<Relationship Id="rId1" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/package" Target="../embeddings/Microsoft_Excel_Worksheet${chartObject.globalId}.xlsx"/>` + styleRels + '</Relationships>');
8977
+ zip.file(`ppt/charts/${chartObject.fileName}`, isChartex ? makeXmlChartEx(chartObject) : makeXmlCharts(chartObject));
8978
+ if (writeStyleParts) {
8979
+ var _chartObject_opts, _chartObject_opts1;
8980
+ zip.file(chartColorsPartName(chartObject.globalId), makeXmlChartColors((_chartObject_opts = chartObject.opts) === null || _chartObject_opts === void 0 ? void 0 : _chartObject_opts.chartColorStyle));
8981
+ zip.file(chartStylePartName(chartObject.globalId), makeXmlChartStyle((_chartObject_opts1 = chartObject.opts) === null || _chartObject_opts1 === void 0 ? void 0 : _chartObject_opts1.chartStyle));
8982
+ }
7566
8983
  // 3: Done
7567
8984
  resolve('');
7568
8985
  }).catch((strErr)=>{
@@ -7574,6 +8991,8 @@ function makeNumberStyles(formats) {
7574
8991
 
7575
8992
 
7576
8993
 
8994
+
8995
+
7577
8996
  /**
7578
8997
  * @file 语言相关函数
7579
8998
  * @author mengke01(kekee000@gmail.com)
@@ -15805,7 +17224,7 @@ function imageDimensions(bytes) {
15805
17224
  });
15806
17225
  }
15807
17226
  /** Select relations that still need their local or remote media encoded. */ function getMediaCandidates(layout) {
15808
- return layout._relsMedia.filter((rel)=>rel.type !== 'online' && !rel.data && (!rel.path || rel.path && !rel.path.includes('preencoded')));
17227
+ return layout._relsMedia.filter((rel)=>!rel.isLinked && rel.type !== 'online' && !rel.data && (!rel.path || rel.path && !rel.path.includes('preencoded')));
15809
17228
  }
15810
17229
  /**
15811
17230
  * Mark repeated source paths so only the first relation performs I/O.
@@ -19094,7 +20513,8 @@ function replyXml(reply, authors, fallbackDate) {
19094
20513
  // is the absolute `/ppt/charts/chartN.xml` form reused as Content_Types PartName.
19095
20514
  // PowerPoint writes the relative `../charts/chartN.xml`; absolute targets are valid but
19096
20515
  // non-idiomatic and break stricter consumers (PR 1465 / eliasaronson).
19097
- strXml += `<Relationship Id="rId${rel.rId}" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/chart" Target="${rel.Target.replace(/^\/ppt\//, '../')}"/>`;
20516
+ const relType = isChartexType(rel.opts._type) ? OOXML_CHARTEX.relType : 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/chart';
20517
+ strXml += `<Relationship Id="rId${rel.rId}" Type="${relType}" Target="${rel.Target.replace(/^\/ppt\//, '../')}"/>`;
19098
20518
  });
19099
20519
  (slide._relsMedia || []).forEach((rel)=>{
19100
20520
  const relRid = rel.rId.toString();
@@ -19103,17 +20523,19 @@ function replyXml(reply, authors, fallbackDate) {
19103
20523
  strXml += '<Relationship Id="rId' + relRid + '" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/image" Target="' + rel.Target + '"/>';
19104
20524
  } else if (rel.type.toLowerCase().includes('audio')) {
19105
20525
  // As media has *TWO* rel entries per item, check for first one, if found add second rel with alt style
20526
+ const externalAttr = rel.isLinked ? ' TargetMode="External"' : '';
19106
20527
  if (strXml.includes(' Target="' + rel.Target + '"')) {
19107
- strXml += '<Relationship Id="rId' + relRid + '" Type="http://schemas.microsoft.com/office/2007/relationships/media" Target="' + rel.Target + '"/>';
20528
+ strXml += '<Relationship Id="rId' + relRid + '" Type="http://schemas.microsoft.com/office/2007/relationships/media" Target="' + rel.Target + '"' + externalAttr + '/>';
19108
20529
  } else {
19109
- strXml += '<Relationship Id="rId' + relRid + '" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/audio" Target="' + rel.Target + '"/>';
20530
+ strXml += '<Relationship Id="rId' + relRid + '" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/audio" Target="' + rel.Target + '"' + externalAttr + '/>';
19110
20531
  }
19111
20532
  } else if (rel.type.toLowerCase().includes('video')) {
19112
20533
  // As media has *TWO* rel entries per item, check for first one, if found add second rel with alt style
20534
+ const externalAttr = rel.isLinked ? ' TargetMode="External"' : '';
19113
20535
  if (strXml.includes(' Target="' + rel.Target + '"')) {
19114
- strXml += '<Relationship Id="rId' + relRid + '" Type="http://schemas.microsoft.com/office/2007/relationships/media" Target="' + rel.Target + '"/>';
20536
+ strXml += '<Relationship Id="rId' + relRid + '" Type="http://schemas.microsoft.com/office/2007/relationships/media" Target="' + rel.Target + '"' + externalAttr + '/>';
19115
20537
  } else {
19116
- strXml += '<Relationship Id="rId' + relRid + '" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/video" Target="' + rel.Target + '"/>';
20538
+ strXml += '<Relationship Id="rId' + relRid + '" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/video" Target="' + rel.Target + '"' + externalAttr + '/>';
19117
20539
  }
19118
20540
  } else if (rel.type.toLowerCase().includes('online')) {
19119
20541
  // As media has *TWO* rel entries per item, check for first one, if found add second rel with alt style
@@ -19319,6 +20741,170 @@ function unsignedInt(value) {
19319
20741
  return `<?xml version="1.0" encoding="UTF-8" standalone="yes"?>\r\n<pc:chgInfo xmlns:pc="${CHANGES_INFO_NS}"/>`;
19320
20742
  }
19321
20743
 
20744
+ /**
20745
+ * PptxGenJS: Non-visual drawing properties (`p:cNvPr`) and editing locks
20746
+ *
20747
+ * Every drawable object carries a `p:cNvPr` with its id, name, and alt text, and a sibling
20748
+ * `p:cNv*Pr` holding the lock element for its kind - `a:spLocks` for shapes, `a:picLocks` for
20749
+ * pictures, `a:graphicFrameLocks` for frames, `a:grpSpLocks` for groups, `a:cxnSpLocks` for
20750
+ * connectors. The lock attributes are shared, so one emitter serves all five.
20751
+ */
20752
+ /** Lock attribute names, in the order the schema declares them */ const LOCK_ATTRS = [
20753
+ [
20754
+ 'noGroup',
20755
+ 'noGrp'
20756
+ ],
20757
+ [
20758
+ 'noSelect',
20759
+ 'noSelect'
20760
+ ],
20761
+ [
20762
+ 'noRotate',
20763
+ 'noRot'
20764
+ ],
20765
+ [
20766
+ 'noChangeAspect',
20767
+ 'noChangeAspect'
20768
+ ],
20769
+ [
20770
+ 'noMove',
20771
+ 'noMove'
20772
+ ],
20773
+ [
20774
+ 'noResize',
20775
+ 'noResize'
20776
+ ],
20777
+ [
20778
+ 'noEditPoints',
20779
+ 'noEditPoints'
20780
+ ],
20781
+ [
20782
+ 'noAdjustHandles',
20783
+ 'noAdjustHandles'
20784
+ ],
20785
+ [
20786
+ 'noChangeArrowheads',
20787
+ 'noChangeArrowheads'
20788
+ ],
20789
+ [
20790
+ 'noChangeShapeType',
20791
+ 'noChangeShapeType'
20792
+ ],
20793
+ [
20794
+ 'noTextEdit',
20795
+ 'noTextEdit'
20796
+ ],
20797
+ [
20798
+ 'noCrop',
20799
+ 'noCrop'
20800
+ ]
20801
+ ];
20802
+ /** Which lock attributes each element actually permits */ const ALLOWED = {
20803
+ 'a:spLocks': new Set([
20804
+ 'noGrp',
20805
+ 'noSelect',
20806
+ 'noRot',
20807
+ 'noChangeAspect',
20808
+ 'noMove',
20809
+ 'noResize',
20810
+ 'noEditPoints',
20811
+ 'noAdjustHandles',
20812
+ 'noChangeArrowheads',
20813
+ 'noChangeShapeType',
20814
+ 'noTextEdit'
20815
+ ]),
20816
+ 'a:picLocks': new Set([
20817
+ 'noGrp',
20818
+ 'noSelect',
20819
+ 'noRot',
20820
+ 'noChangeAspect',
20821
+ 'noMove',
20822
+ 'noResize',
20823
+ 'noEditPoints',
20824
+ 'noAdjustHandles',
20825
+ 'noChangeArrowheads',
20826
+ 'noChangeShapeType',
20827
+ 'noCrop'
20828
+ ]),
20829
+ 'a:graphicFrameLocks': new Set([
20830
+ 'noGrp',
20831
+ 'noSelect',
20832
+ 'noChangeAspect',
20833
+ 'noMove',
20834
+ 'noResize',
20835
+ 'noDrilldown'
20836
+ ]),
20837
+ 'a:grpSpLocks': new Set([
20838
+ 'noGrp',
20839
+ 'noSelect',
20840
+ 'noRot',
20841
+ 'noChangeAspect',
20842
+ 'noMove',
20843
+ 'noResize',
20844
+ 'noUngrp'
20845
+ ]),
20846
+ 'a:cxnSpLocks': new Set([
20847
+ 'noGrp',
20848
+ 'noSelect',
20849
+ 'noRot',
20850
+ 'noChangeAspect',
20851
+ 'noMove',
20852
+ 'noResize',
20853
+ 'noEditPoints',
20854
+ 'noAdjustHandles',
20855
+ 'noChangeArrowheads',
20856
+ 'noChangeShapeType'
20857
+ ])
20858
+ };
20859
+ /**
20860
+ * Create a lock element, or `''` when nothing is locked
20861
+ * - attributes the element does not permit are dropped: an unexpected one is a schema violation
20862
+ * @param {string} tag - lock element name for the object's kind
20863
+ * @param {ShapeLockProps} lock - lock props
20864
+ * @param {string} defaults - attributes the library already emits for this object
20865
+ * @returns {string} XML string
20866
+ */ function genXmlLocks(tag, lock, defaults = '') {
20867
+ var _ALLOWED_tag;
20868
+ const allowed = (_ALLOWED_tag = ALLOWED[tag]) !== null && _ALLOWED_tag !== void 0 ? _ALLOWED_tag : new Set();
20869
+ let attrs = defaults;
20870
+ LOCK_ATTRS.forEach(([prop, attr])=>{
20871
+ if ((lock === null || lock === void 0 ? void 0 : lock[prop]) !== true) return;
20872
+ if (!allowed.has(attr)) {
20873
+ console.warn(`[pptxgenjs] \`${String(prop)}\` does not apply to this object type - ignored`);
20874
+ return;
20875
+ }
20876
+ // do not repeat an attribute the caller already gets by default
20877
+ if (defaults.includes(`${attr}="`)) return;
20878
+ attrs += ` ${attr}="1"`;
20879
+ });
20880
+ return attrs ? `<${tag}${attrs}/>` : '';
20881
+ }
20882
+ /**
20883
+ * Create the `p:cNvPr` element
20884
+ * @param {number} id - shape id, unique on the slide
20885
+ * @param {string} name - shape name shown in the selection pane (already XML-escaped by callers)
20886
+ * @param {NonVisualProps} props - non-visual options
20887
+ * @param {string} descr - alt-text description
20888
+ * @param {string} children - child elements (ex: hyperlinks); self-closes when empty
20889
+ * @returns {string} XML string
20890
+ */ function genXmlCNvPr(id, name, props, descr = '', children = '') {
20891
+ let attrs = `id="${id}" name="${name}"`;
20892
+ // `descr` is the alt-text description; `title` is the separate alt-text title
20893
+ if (descr) attrs += ` descr="${encodeXmlEntities(descr)}"`;
20894
+ if (props === null || props === void 0 ? void 0 : props.title) attrs += ` title="${encodeXmlEntities(props.title)}"`;
20895
+ if ((props === null || props === void 0 ? void 0 : props.hidden) === true) attrs += ' hidden="1"';
20896
+ return children ? `<p:cNvPr ${attrs}>${children}</p:cNvPr>` : `<p:cNvPr ${attrs}/>`;
20897
+ }
20898
+ /**
20899
+ * Create `p:cNvSpPr`, carrying the text-box flag and any shape locks
20900
+ * @param {object} options - shape options
20901
+ * @returns {string} XML string
20902
+ */ function genXmlCNvSpPr(options) {
20903
+ const txBox = (options === null || options === void 0 ? void 0 : options.isTextBox) ? ' txBox="1"' : '';
20904
+ const locks = genXmlLocks('a:spLocks', options === null || options === void 0 ? void 0 : options.lock);
20905
+ return locks ? `<p:cNvSpPr${txBox}>${locks}</p:cNvSpPr>` : `<p:cNvSpPr${txBox}/>`;
20906
+ }
20907
+
19322
20908
  function xml_slide_define_property(obj, key, value) {
19323
20909
  if (key in obj) {
19324
20910
  Object.defineProperty(obj, key, {
@@ -19376,11 +20962,34 @@ function slide_object_spread_props(target, source) {
19376
20962
 
19377
20963
 
19378
20964
 
20965
+
20966
+
20967
+
19379
20968
  function nvPrModIdExt(modId) {
19380
20969
  return genXmlModIdExt(modId).replace(/^<p:extLst>|<\/p:extLst>$/g, '');
19381
20970
  }
19382
20971
  function genXmlNvPr(options, phXml = '', extraExts = []) {
19383
- return `<p:nvPr>${phXml}${genXmlNvPrExtLst(options, extraExts)}</p:nvPr>`;
20972
+ const attrs = ((options === null || options === void 0 ? void 0 : options.isPhoto) === true ? ' isPhoto="1"' : '') + ((options === null || options === void 0 ? void 0 : options.userDrawn) === true ? ' userDrawn="1"' : '');
20973
+ return `<p:nvPr${attrs}>${phXml}${genXmlNvPrExtLst(options, extraExts)}</p:nvPr>`;
20974
+ }
20975
+ /**
20976
+ * Fallback shape for a chartex graphic frame (`mc:Fallback`).
20977
+ *
20978
+ * PowerPoint writes a rendered preview picture here, which this library cannot produce without a
20979
+ * rasterizer. A locked, non-editable text shape occupying the same box is the closest honest
20980
+ * substitute: a consumer that rejects the `mc:Choice` still sees where the chart is and why it is
20981
+ * not drawn, and cannot silently edit it into something that no longer matches the chart part.
20982
+ */ function genXmlChartExFallback(shapeId, slideItemObj, box) {
20983
+ var _slideItemObj_options, _options_objectName, _options_altText;
20984
+ const options = (_slideItemObj_options = slideItemObj.options) !== null && _slideItemObj_options !== void 0 ? _slideItemObj_options : {};
20985
+ const name = (_options_objectName = options.objectName) !== null && _options_objectName !== void 0 ? _options_objectName : 'Chart';
20986
+ const message = 'This chart is not available in your version of PowerPoint. Editing this shape or saving this file in a different format will permanently break the chart.';
20987
+ // A chart's `title` is the chart title, not the alt-text title `p:cNvPr@title` carries.
20988
+ // `noTextEdit` is not optional: an edited fallback would no longer match the chart part.
20989
+ return '<p:sp>' + '<p:nvSpPr>' + `<p:cNvPr id="${shapeId}" name="${encodeXmlEntities(name)}" descr="${encodeXmlEntities((_options_altText = options.altText) !== null && _options_altText !== void 0 ? _options_altText : message)}"/>` + '<p:cNvSpPr><a:spLocks noTextEdit="1"/></p:cNvSpPr>' + '<p:nvPr/>' + '</p:nvSpPr>' + `<p:spPr><a:xfrm><a:off x="${box.x}" y="${box.y}"/><a:ext cx="${box.cx}" cy="${box.cy}"/></a:xfrm>` + '<a:prstGeom prst="rect"><a:avLst/></a:prstGeom>' + '<a:solidFill><a:prstClr val="white"/></a:solidFill>' + '<a:ln><a:solidFill><a:prstClr val="black"/></a:solidFill></a:ln></p:spPr>' + '<p:txBody><a:bodyPr vertOverflow="clip" horzOverflow="clip" wrap="square"><a:normAutofit/></a:bodyPr><a:lstStyle/>' + `<a:p><a:r><a:rPr lang="en-US" sz="1100"/><a:t>${encodeXmlEntities(message)}</a:t></a:r></a:p>` + '</p:txBody>' + '</p:sp>';
20990
+ }
20991
+ function genXmlCNvPrLinks(click, hover) {
20992
+ return ((click === null || click === void 0 ? void 0 : click._rId) ? genXmlHyperlink(click, 'click', 'shape') : '') + ((hover === null || hover === void 0 ? void 0 : hover._rId) ? genXmlHyperlink(hover, 'hover', 'shape') : '');
19384
20993
  }
19385
20994
  const ImageSizingXml = {
19386
20995
  cover: function(imgSize, boxDim) {
@@ -19461,10 +21070,6 @@ const ImageSizingXml = {
19461
21070
  return opts.tableStyleId ? `<a:tblPr${attrs}><a:tableStyleId>${encodeXmlEntities(opts.tableStyleId)}</a:tableStyleId></a:tblPr>` : `<a:tblPr${attrs}/>`;
19462
21071
  }
19463
21072
  /**
19464
- * Create the `a:ln` outline block for a shape/image
19465
- * @param {ShapeLineProps} line - line options
19466
- * @return {string} XML
19467
- */ /**
19468
21073
  * Builds `<p14:trim>` / `<p14:fade>` / `<p14:bmkLst>` children of `<p14:media>` (MS-PPTX §2.3.3.14).
19469
21074
  * Times are ST_UniversalTimeOffset (ms).
19470
21075
  */ function genXmlMediaExtras(opts) {
@@ -19474,40 +21079,47 @@ const ImageSizingXml = {
19474
21079
  if (opts.bookmarks && opts.bookmarks.length > 0) xml += `<p14:bmkLst>${opts.bookmarks.map((b)=>`<p14:bmk name="${encodeXmlEntities(b.name)}" time="${Math.round(b.time)}"/>`).join('')}</p14:bmkLst>`;
19475
21080
  return xml;
19476
21081
  }
19477
- function genXmlLine(line) {
19478
- // ECMA-376 §5.1.2.1.34: `<a:ln>` carries `w` and `cap` attributes (cap = line ending style, issue #782)
19479
- const attrs = (line.width ? ` w="${valToPts(line.width)}"` : '') + (line.cap && [
19480
- 'flat',
19481
- 'sq',
19482
- 'rnd'
19483
- ].includes(line.cap) ? ` cap="${line.cap}"` : '');
19484
- let xml = `<a:ln${attrs}>`;
19485
- const hasGrad = !!(line.gradient || line.type === 'gradient' || line.type === 'linearGradient');
19486
- if (line.type !== 'none' && (line.color || hasGrad)) {
19487
- xml += genXmlColorSelection(hasGrad && !line.type ? slide_object_spread_props(xml_slide_object_spread({}, line), {
19488
- type: 'gradient'
19489
- }) : line);
19490
- }
19491
- if (line.dashType) xml += `<a:prstDash val="${line.dashType}"/>`;
19492
- if (line.beginArrowType) xml += `<a:headEnd type="${line.beginArrowType}"/>`;
19493
- if (line.endArrowType) xml += `<a:tailEnd type="${line.endArrowType}"/>`;
19494
- // FUTURE: `endArrowSize` < a: headEnd type = "arrow" w = "lg" len = "lg" /> 'sm' | 'med' | 'lg'(values are 1 - 9, making a 3x3 grid of w / len possibilities)
19495
- xml += '</a:ln>';
19496
- return xml;
21082
+ /**
21083
+ * One `a:tcPr` border line (`a:lnL`, `a:lnTlToBr`, ...)
21084
+ * - the four edges and the two diagonals share CT_LineProperties, so they share this emitter
21085
+ * @param {string} name - element name without the `a:` prefix
21086
+ * @param {BorderProps} border - border definition
21087
+ * @returns {string} XML
21088
+ */ function genXmlCellBorder(name, border) {
21089
+ var _ref, _border_width, _border_color;
21090
+ if (border.type === 'none') return `<a:${name} w="0" cap="flat" cmpd="sng" algn="ctr"><a:noFill/></a:${name}>`;
21091
+ const width = (_ref = (_border_width = border.width) !== null && _border_width !== void 0 ? _border_width : border.pt) !== null && _ref !== void 0 ? _ref : DEF_CELL_BORDER.pt;
21092
+ const borderTransparency = border.transparency;
21093
+ const borderAlpha = typeof borderTransparency === 'number' ? `<a:alpha val="${Math.round((100 - Math.min(100, Math.max(0, borderTransparency))) * 1000)}"/>` : '';
21094
+ return `<a:${name} w="${valToPts(width)}" cap="flat" cmpd="sng" algn="ctr">` + `<a:solidFill>${createColorElement((_border_color = border.color) !== null && _border_color !== void 0 ? _border_color : DEF_CELL_BORDER.color, borderAlpha)}</a:solidFill>` + `<a:prstDash val="${border.type === 'dash' ? 'sysDash' : 'solid'}"/><a:round/>` + '<a:headEnd type="none" w="med" len="med"/><a:tailEnd type="none" w="med" len="med"/>' + `</a:${name}>`;
21095
+ }
21096
+ /**
21097
+ * One `a:audioCd` endpoint (`a:st` or `a:end`).
21098
+ * - `@track` is required and is an `xsd:unsignedByte`, so it is clamped; `@time` defaults to 0
21099
+ */ function genXmlAudioCdTime(tag, point) {
21100
+ var _ref;
21101
+ const track = Math.min(255, Math.max(0, Math.round((_ref = point === null || point === void 0 ? void 0 : point.track) !== null && _ref !== void 0 ? _ref : 0)));
21102
+ const time = typeof (point === null || point === void 0 ? void 0 : point.time) === 'number' && isFinite(point.time) && point.time > 0 ? ` time="${Math.round(point.time)}"` : '';
21103
+ return `<${tag} track="${track}"${time}/>`;
19497
21104
  }
19498
21105
  /**
19499
21106
  * Create a single `a:outerShdw` / `a:innerShdw` element (no `effectLst` wrapper).
19500
21107
  * @note pure - unit conversion must NOT mutate the caller's options (issue #20)
19501
21108
  */ function genXmlShadowElement(shadow) {
19502
- var _shadow_blur, _shadow_offset, _shadow_angle, _shadow_opacity;
19503
- const type = shadow.type === 'inner' ? 'inner' : 'outer';
19504
- const blur = valToPts((_shadow_blur = shadow.blur) !== null && _shadow_blur !== void 0 ? _shadow_blur : 8);
21109
+ var _shadow_offset, _shadow_angle, _shadow_opacity, _shadow_blur;
19505
21110
  const offset = valToPts((_shadow_offset = shadow.offset) !== null && _shadow_offset !== void 0 ? _shadow_offset : 4);
19506
21111
  const angle = Math.round(((_shadow_angle = shadow.angle) !== null && _shadow_angle !== void 0 ? _shadow_angle : 270) * 60000);
19507
21112
  const opacity = Math.round(((_shadow_opacity = shadow.opacity) !== null && _shadow_opacity !== void 0 ? _shadow_opacity : 0.75) * 100000);
19508
21113
  const color = shadow.color || DEF_TEXT_SHADOW.color;
21114
+ const colorXml = `<a:srgbClr val="${color}"><a:alpha val="${opacity}"/></a:srgbClr>`;
21115
+ if (shadow.type === 'preset') {
21116
+ if (!shadow.preset) return '';
21117
+ return `<a:prstShdw prst="${shadow.preset}" dist="${offset}" dir="${angle}">${colorXml}</a:prstShdw>`;
21118
+ }
21119
+ const type = shadow.type === 'inner' ? 'inner' : 'outer';
21120
+ const blur = valToPts((_shadow_blur = shadow.blur) !== null && _shadow_blur !== void 0 ? _shadow_blur : 8);
19509
21121
  const attrs = type === 'outer' ? 'sx="100000" sy="100000" kx="0" ky="0" algn="bl" rotWithShape="0"' : '';
19510
- return `<a:${type}Shdw ${attrs} blurRad="${blur}" dist="${offset}" dir="${angle}"><a:srgbClr val="${color}"><a:alpha val="${opacity}"/></a:srgbClr></a:${type}Shdw>`;
21122
+ return `<a:${type}Shdw ${attrs} blurRad="${blur}" dist="${offset}" dir="${angle}">${colorXml}</a:${type}Shdw>`;
19511
21123
  }
19512
21124
  /**
19513
21125
  * Create `a:softEdge` element
@@ -19535,22 +21147,98 @@ function genXmlLine(line) {
19535
21147
  return `<a:blur rad="${rad}"${grow}/>`;
19536
21148
  }
19537
21149
  /**
19538
- * Create the shape/image `a:effectLst` block (blur + glow + shadow + reflection + softEdge).
19539
- * Child order follows ECMA-376 `CT_EffectList`: blur, glow, innerShdw, outerShdw, reflection, softEdge.
21150
+ * Create `a:fillOverlay` (CT_FillOverlayEffect). `@blend` and a fill are both required.
21151
+ */ function genXmlFillOverlayElement(overlay) {
21152
+ if (!overlay.blend || !overlay.fill) return '';
21153
+ const fill = genXmlColorSelection(overlay.fill);
21154
+ return fill ? `<a:fillOverlay blend="${overlay.blend}">${fill}</a:fillOverlay>` : '';
21155
+ }
21156
+ /**
21157
+ * Create the shape/image effect block (blur + fillOverlay + glow + shadow + reflection + softEdge).
21158
+ * Child order follows ECMA-376 `CT_EffectList`: blur, fillOverlay, glow, innerShdw, outerShdw,
21159
+ * prstShdw, reflection, softEdge. `effectDag` replaces `effectLst` (EG_EffectProperties choice).
19540
21160
  * @note pure - unit conversion must NOT be written back to the caller's options object (issue #20)
19541
21161
  */ function genXmlEffectLst(opts) {
19542
21162
  const parts = [];
19543
21163
  if (opts.blur && typeof opts.blur.radius === 'number') parts.push(genXmlBlurElement(opts.blur));
21164
+ if (opts.fillOverlay) {
21165
+ const overlay = genXmlFillOverlayElement(opts.fillOverlay);
21166
+ if (overlay) parts.push(overlay);
21167
+ }
19544
21168
  const resolvedGlow = resolveGlowOptions(opts.glow);
19545
21169
  if (resolvedGlow) parts.push(createGlowElement(resolvedGlow));
19546
21170
  const shadow = opts.shadow;
19547
21171
  if (shadow && shadow.type !== 'none') {
19548
- parts.push(genXmlShadowElement(shadow));
21172
+ const shadowXml = genXmlShadowElement(shadow);
21173
+ if (shadowXml) parts.push(shadowXml);
19549
21174
  }
19550
21175
  if (opts.reflection) parts.push(genXmlReflectionElement(opts.reflection));
19551
21176
  if (opts.softEdge) parts.push(genXmlSoftEdgeElement(opts.softEdge));
19552
21177
  if (!parts.length) return '';
19553
- return `<a:effectLst>${parts.join('')}</a:effectLst>`;
21178
+ const xml = parts.join('');
21179
+ if (opts.effectDag) return `<a:effectDag type="${opts.effectDag.type === 'tree' ? 'tree' : 'sib'}">${xml}</a:effectDag>`;
21180
+ return `<a:effectLst>${xml}</a:effectLst>`;
21181
+ }
21182
+ /**
21183
+ * Theme style references for a shape (`p:style`).
21184
+ * CT_ShapeStyle requires all four children; an unset property references nothing (`idx="0"` / `none`).
21185
+ */ function genXmlShapeStyle(style) {
21186
+ var _style_color;
21187
+ if (!style) return '';
21188
+ let color = (_style_color = style.color) !== null && _style_color !== void 0 ? _style_color : 'accent1';
21189
+ if (color === 'phClr') {
21190
+ console.warn('[pptxgenjs] `styleRef.color` cannot be `phClr` - it is the placeholder a theme reference resolves, not a color. Using `accent1`.');
21191
+ color = 'accent1';
21192
+ }
21193
+ let fontColor = style.fontColor;
21194
+ if (fontColor === 'phClr') {
21195
+ console.warn('[pptxgenjs] `styleRef.fontColor` cannot be `phClr` - using `lt1`.');
21196
+ fontColor = undefined;
21197
+ }
21198
+ const idx = (value)=>typeof value === 'number' && isFinite(value) && value > 0 ? Math.round(value) : 0;
21199
+ const matrixColor = createColorElement(color);
21200
+ const fontColorXml = fontColor ? createColorElement(fontColor) : '<a:schemeClr val="lt1"/>';
21201
+ return '<p:style>' + `<a:lnRef idx="${idx(style.line)}">${matrixColor}</a:lnRef>` + `<a:fillRef idx="${idx(style.fill)}">${matrixColor}</a:fillRef>` + `<a:effectRef idx="${idx(style.effect)}">${matrixColor}</a:effectRef>` + `<a:fontRef idx="${style.font === 'major' || style.font === 'minor' ? style.font : 'none'}">${fontColorXml}</a:fontRef>` + '</p:style>';
21202
+ }
21203
+ /**
21204
+ * Recolor and correction effects for an image's `a:blip`.
21205
+ */ function genXmlBlipRecolor(recolor) {
21206
+ if (!recolor) return '';
21207
+ let xml = '';
21208
+ if (Array.isArray(recolor.duotone)) {
21209
+ if (recolor.duotone.length === 2) xml += `<a:duotone>${recolor.duotone.map((color)=>createColorElement(color)).join('')}</a:duotone>`;
21210
+ else console.warn(`[pptxgenjs] image \`recolor.duotone\` needs exactly two colors - ${recolor.duotone.length} given, effect omitted`);
21211
+ }
21212
+ if (recolor.grayscale === true) xml += '<a:grayscl/>';
21213
+ const bright = typeof recolor.brightness === 'number' && isFinite(recolor.brightness) ? Math.round(Math.min(100, Math.max(-100, recolor.brightness)) * 1000) : undefined;
21214
+ const contrast = typeof recolor.contrast === 'number' && isFinite(recolor.contrast) ? Math.round(Math.min(100, Math.max(-100, recolor.contrast)) * 1000) : undefined;
21215
+ if (bright !== undefined || contrast !== undefined) {
21216
+ xml += `<a:lum${bright !== undefined ? ` bright="${bright}"` : ''}${contrast !== undefined ? ` contrast="${contrast}"` : ''}/>`;
21217
+ }
21218
+ if (typeof recolor.blackWhiteThreshold === 'number' && isFinite(recolor.blackWhiteThreshold)) {
21219
+ xml += `<a:biLevel thresh="${Math.round(Math.min(100, Math.max(0, recolor.blackWhiteThreshold)) * 1000)}"/>`;
21220
+ }
21221
+ if (recolor.colorChange) {
21222
+ if (recolor.colorChange.from && recolor.colorChange.to) {
21223
+ const useA = recolor.colorChange.useAlpha === false ? ' useA="0"' : '';
21224
+ xml += `<a:clrChange${useA}><a:clrFrom>${createColorElement(recolor.colorChange.from)}</a:clrFrom><a:clrTo>${createColorElement(recolor.colorChange.to)}</a:clrTo></a:clrChange>`;
21225
+ } else {
21226
+ console.warn('[pptxgenjs] image `recolor.colorChange` needs both `from` and `to` - effect omitted');
21227
+ }
21228
+ }
21229
+ return xml;
21230
+ }
21231
+ /**
21232
+ * Alpha + recolor effects for an image's `a:blip`.
21233
+ */ function genXmlBlipEffects(transparency, alpha, recolor) {
21234
+ let xml = transparency ? `<a:alphaModFix amt="${Math.round((100 - transparency) * 1000)}"/>` : '';
21235
+ xml += genXmlBlipRecolor(recolor);
21236
+ if (!alpha) return xml;
21237
+ if (typeof alpha.replace === 'number' && isFinite(alpha.replace)) xml += `<a:alphaRepl a="${Math.round(Math.min(100, Math.max(0, alpha.replace)) * 1000)}"/>`;
21238
+ if (alpha.invert === true) xml += '<a:alphaInv/>';
21239
+ if (alpha.floor === true) xml += '<a:alphaFloor/>';
21240
+ if (alpha.ceiling === true) xml += '<a:alphaCeiling/>';
21241
+ return xml;
19554
21242
  }
19555
21243
  function findShapeCoord(list, id) {
19556
21244
  if (id == null) return undefined;
@@ -19595,7 +21283,19 @@ function findShapeCoord(list, id) {
19595
21283
  /**
19596
21284
  * When a connector references shapes with numeric inch positions + rect anchors,
19597
21285
  * compute the line's x/y/w/h and flip flags (ZentoSoft auto-layout).
19598
- */ function applyConnectorAutoLayout(line, coordinates, presLayout) {
21286
+ */ function resolveConnectorObjectNames(line, coordinates) {
21287
+ if (line._sourceName) {
21288
+ const found = coordinates.find((item)=>item.objectName === line._sourceName);
21289
+ if (found) line.sourceId = found.id;
21290
+ else console.warn(`[pptxgenjs] connector start shape "${line._sourceName}" not found - attachment omitted`);
21291
+ }
21292
+ if (line._targetName) {
21293
+ const found = coordinates.find((item)=>item.objectName === line._targetName);
21294
+ if (found) line.targetId = found.id;
21295
+ else console.warn(`[pptxgenjs] connector end shape "${line._targetName}" not found - attachment omitted`);
21296
+ }
21297
+ }
21298
+ function applyConnectorAutoLayout(line, coordinates, presLayout) {
19599
21299
  const source = findShapeCoord(coordinates, line.sourceId);
19600
21300
  const target = findShapeCoord(coordinates, line.targetId);
19601
21301
  if (!source || !target) return undefined;
@@ -19752,7 +21452,9 @@ function slideObjectToXml(slide) {
19752
21452
  let intTableNum = 1;
19753
21453
  // STEP 1: Add background color/image (ensure only a single `<p:bg>` tag is created, ex: when master-baskground has both `color` and `path`)
19754
21454
  if (slide._bkgdImgRid) {
19755
- strSlideXml += `<p:bg><p:bgPr><a:blipFill dpi="0" rotWithShape="1"><a:blip r:embed="rId${slide._bkgdImgRid}"><a:lum/></a:blip><a:srcRect/><a:stretch><a:fillRect/></a:stretch></a:blipFill><a:effectLst/></p:bgPr></p:bg>`;
21455
+ var _slide_background3;
21456
+ const bkgdEffects = genXmlBlipRecolor((_slide_background3 = slide.background) === null || _slide_background3 === void 0 ? void 0 : _slide_background3.recolor);
21457
+ strSlideXml += `<p:bg><p:bgPr><a:blipFill dpi="0" rotWithShape="1"><a:blip r:embed="rId${slide._bkgdImgRid}">${bkgdEffects || '<a:lum/>'}</a:blip><a:srcRect/><a:stretch><a:fillRect/></a:stretch></a:blipFill><a:effectLst/></p:bgPr></p:bg>`;
19756
21458
  } else if (((_slide_background = slide.background) === null || _slide_background === void 0 ? void 0 : _slide_background.color) || ((_slide_background1 = slide.background) === null || _slide_background1 === void 0 ? void 0 : _slide_background1.type) === 'gradient' && slide.background.gradient || ((_slide_background2 = slide.background) === null || _slide_background2 === void 0 ? void 0 : _slide_background2.type) === 'linearGradient' && ((_ref = (_slide_background_stops = slide.background.stops) === null || _slide_background_stops === void 0 ? void 0 : _slide_background_stops.length) !== null && _ref !== void 0 ? _ref : 0) >= 2) {
19757
21459
  // NOTE: `<a:effectLst/>` is required by PowerPoint (matches image-bg path above); omitting it triggers the repair dialog
19758
21460
  strSlideXml += `<p:bg><p:bgPr>${genXmlColorSelection(slide.background)}<a:effectLst/></p:bgPr></p:bg>`;
@@ -19770,7 +21472,7 @@ function slideObjectToXml(slide) {
19770
21472
  const shapeCoordinates = [];
19771
21473
  const renderObjectList = (objects)=>{
19772
21474
  objects.forEach((slideItemObj, idx)=>{
19773
- var _slideItemObj_options, _slideItemObj_options1, _slide__slideLayout, _slideItemObj_options_line, _slideItemObj_options_sizing, _slideItemObj_options2;
21475
+ var _slideItemObj_options, _slideItemObj_options1, _slide__slideLayout, _slideItemObj_options_line, _slideItemObj_options_line1, _slideItemObj_options_sizing, _slideItemObj_options2;
19774
21476
  let x = 0;
19775
21477
  let y = 0;
19776
21478
  let cx = getSmartParseNumber('75%', 'X', slide._presLayout);
@@ -19785,6 +21487,7 @@ function slideObjectToXml(slide) {
19785
21487
  slideItemObj.options.sId = shapeId;
19786
21488
  shapeCoordinates.push({
19787
21489
  id: shapeId,
21490
+ objectName: slideItemObj.options.objectName,
19788
21491
  position: {
19789
21492
  x: slideItemObj.options.x,
19790
21493
  y: slideItemObj.options.y,
@@ -19804,7 +21507,10 @@ function slideObjectToXml(slide) {
19804
21507
  })[0];
19805
21508
  }
19806
21509
  // A: Geometry — connectors may auto-size from source/target shape boxes (ZentoSoft)
19807
- 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;
21510
+ if ((_slideItemObj_options_line = slideItemObj.options.line) === null || _slideItemObj_options_line === void 0 ? void 0 : _slideItemObj_options_line.isConnector) {
21511
+ resolveConnectorObjectNames(slideItemObj.options.line, shapeCoordinates);
21512
+ }
21513
+ const connectorLayout = ((_slideItemObj_options_line1 = slideItemObj.options.line) === null || _slideItemObj_options_line1 === void 0 ? void 0 : _slideItemObj_options_line1.isConnector) ? applyConnectorAutoLayout(slideItemObj.options.line, shapeCoordinates, slide._presLayout) : undefined;
19808
21514
  if (connectorLayout) {
19809
21515
  x = connectorLayout.x;
19810
21516
  y = connectorLayout.y;
@@ -19864,7 +21570,7 @@ function slideObjectToXml(slide) {
19864
21570
  switch(slideItemObj._type){
19865
21571
  case (/* inlined export .SLIDE_OBJECT_TYPES.table */"table"):
19866
21572
  {
19867
- var _slideItemObj_arrTabRows, _slide__slideNum;
21573
+ var _slideItemObj_arrTabRows, _slide__slideNum, _slideItemObj_options_objectName;
19868
21574
  arrTabRows = (_slideItemObj_arrTabRows = slideItemObj.arrTabRows) !== null && _slideItemObj_arrTabRows !== void 0 ? _slideItemObj_arrTabRows : [];
19869
21575
  objTabOpts = slideItemObj.options;
19870
21576
  intColCnt = 0;
@@ -19877,12 +21583,12 @@ function slideObjectToXml(slide) {
19877
21583
  });
19878
21584
  // STEP 1: Start Table XML
19879
21585
  // NOTE: Non-numeric cNvPr id values will trigger "presentation needs repair" type warning in MS-PPT-2013
19880
- 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}"/>`;
21586
+ strXml = '<p:graphicFrame><p:nvGraphicFramePr>' + genXmlCNvPr(intTableNum * ((_slide__slideNum = slide._slideNum) !== null && _slide__slideNum !== void 0 ? _slide__slideNum : 0) + 1, String((_slideItemObj_options_objectName = slideItemObj.options.objectName) !== null && _slideItemObj_options_objectName !== void 0 ? _slideItemObj_options_objectName : ''), slideItemObj.options);
19881
21587
  // When the table binds to a master/layout placeholder, emit `<p:ph type="tbl"/>` (ECMA-376 §4.4.1.33, issue #856)
19882
21588
  const tblPh = placeholderObj ? genXmlPlaceholder(placeholderObj, slideItemObj.options) : '';
19883
21589
  // MS-PPTX §2.3.1.19: each p14:modId must be unique on the slide (not a constant).
19884
21590
  const tableModId = typeof slideItemObj.options.modId === 'number' ? slideItemObj.options.modId : TABLE_MOD_ID_BASE + idx;
19885
- strXml += '<p:cNvGraphicFramePr><a:graphicFrameLocks noGrp="1"/></p:cNvGraphicFramePr>' + ` ${genXmlNvPr(slideItemObj.options, tblPh, [
21591
+ strXml += `<p:cNvGraphicFramePr>${genXmlLocks('a:graphicFrameLocks', slideItemObj.options.lock, ' noGrp="1"')}</p:cNvGraphicFramePr>` + ` ${genXmlNvPr(slideItemObj.options, tblPh, [
19886
21592
  nvPrModIdExt(tableModId)
19887
21593
  ])}` + '</p:nvGraphicFramePr>';
19888
21594
  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>`;
@@ -19978,8 +21684,10 @@ function slideObjectToXml(slide) {
19978
21684
  // A: Table Height provided without rowH? Then distribute rows
19979
21685
  let intRowH = 0 // IMPORTANT: Default must be zero for auto-sizing to work
19980
21686
  ;
19981
- if (Array.isArray(objTabOpts.rowH) && objTabOpts.rowH[rIdx]) intRowH = inch2Emu(Number(objTabOpts.rowH[rIdx]));
19982
- else if (objTabOpts.rowH && !isNaN(Number(objTabOpts.rowH))) intRowH = inch2Emu(Number(objTabOpts.rowH));
21687
+ // `rowH` is either one value for every row or a per-row array; `inch2Emu` resolves inches, EMU and unit-suffixed strings alike
21688
+ const rowHOpt = Array.isArray(objTabOpts.rowH) ? objTabOpts.rowH[rIdx] : objTabOpts.rowH;
21689
+ const rowHEmu = rowHOpt ? inch2Emu(rowHOpt) : NaN;
21690
+ if (!isNaN(rowHEmu)) intRowH = rowHEmu;
19983
21691
  else if (itemOpts.cy || itemOpts.h) {
19984
21692
  intRowH = Math.round((itemOpts.h ? inch2Emu(itemOpts.h) : typeof itemOpts.cy === 'number' ? itemOpts.cy : 1) / arrTabRows.length);
19985
21693
  }
@@ -20058,9 +21766,10 @@ function slideObjectToXml(slide) {
20058
21766
  * - Backwards-Compat: Oops! Discovered we were still using points for cell margin before v3.8.0 (UGH!)
20059
21767
  * - We cant introduce a breaking change before v4.0, so...
20060
21768
  */ 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])}"`;
20061
- // FUTURE: Cell NOWRAP property (textwrap: add to a:tcPr (horzOverflow="overflow" or whatever options exist)
21769
+ const cellOverflow = cellOpts.horzOverflow === 'overflow' || cellOpts.horzOverflow === 'clip' ? ` horzOverflow="${cellOpts.horzOverflow}"` : '';
21770
+ const cellAnchorCtr = cellOpts.anchorCtr === true ? ' anchorCtr="1"' : '';
20062
21771
  // 4: Set CELL content and properties ==================================
20063
- strXml += `<a:tc${cellSpanAttrStr}>${genXmlTextBody(cell)}<a:tcPr${cellMarginXml}${cellValign}${cellTextDir}>`;
21772
+ strXml += `<a:tc${cellSpanAttrStr}>${genXmlTextBody(cell)}<a:tcPr${cellMarginXml}${cellValign}${cellTextDir}${cellAnchorCtr}${cellOverflow}>`;
20064
21773
  // strXml += `<a:tc${cellColspan}${cellRowspan}>${genXmlTextBody(cell)}<a:tcPr${cellMarginXml}${cellValign}${cellTextDir}>`
20065
21774
  // FIXME: 20200525: ^^^
20066
21775
  // <a:tcPr marL="38100" marR="38100" marT="38100" marB="38100" vert="vert270">
@@ -20085,18 +21794,29 @@ function slideObjectToXml(slide) {
20085
21794
  name: 'lnB'
20086
21795
  }
20087
21796
  ].forEach((obj)=>{
20088
- if (border[obj.idx].type !== 'none') {
20089
- const borderTransparency = border[obj.idx].transparency;
20090
- const borderAlpha = typeof borderTransparency === 'number' ? `<a:alpha val="${Math.round((100 - Math.min(100, Math.max(0, borderTransparency))) * 1000)}"/>` : '';
20091
- strXml += `<a:${obj.name} w="${valToPts(border[obj.idx].pt)}" cap="flat" cmpd="sng" algn="ctr">`;
20092
- strXml += `<a:solidFill>${createColorElement(border[obj.idx].color, borderAlpha)}</a:solidFill>`;
20093
- 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"/>`;
20094
- strXml += `</a:${obj.name}>`;
20095
- } else {
20096
- strXml += `<a:${obj.name} w="0" cap="flat" cmpd="sng" algn="ctr"><a:noFill/></a:${obj.name}>`;
20097
- }
21797
+ strXml += genXmlCellBorder(obj.name, border[obj.idx]);
20098
21798
  });
20099
21799
  }
21800
+ // 5b: Diagonals follow the four edges in the CT_TableCellProperties sequence, and are
21801
+ // written only when asked for - unlike the edges, which are always emitted as a set
21802
+ if (cellOpts.borderDiagonalDown) strXml += genXmlCellBorder('lnTlToBr', cellOpts.borderDiagonalDown);
21803
+ if (cellOpts.borderDiagonalUp) strXml += genXmlCellBorder('lnBlToTr', cellOpts.borderDiagonalUp);
21804
+ // 5c: `a:cell3D` follows the diagonals and precedes the fill
21805
+ if (cellOpts.cell3D) {
21806
+ var _cell3D_bevel;
21807
+ var _cell3D_lightRig;
21808
+ const cell3D = cellOpts.cell3D;
21809
+ const bevel = (_cell3D_bevel = cell3D.bevel) !== null && _cell3D_bevel !== void 0 ? _cell3D_bevel : {};
21810
+ let bevelAttrs = '';
21811
+ if (typeof bevel.width === 'number' && isFinite(bevel.width) && bevel.width >= 0) bevelAttrs += ` w="${inch2Emu(bevel.width)}"`;
21812
+ if (typeof bevel.height === 'number' && isFinite(bevel.height) && bevel.height >= 0) bevelAttrs += ` h="${inch2Emu(bevel.height)}"`;
21813
+ if (bevel.preset) bevelAttrs += ` prst="${bevel.preset}"`;
21814
+ // `rig` and `dir` are both required on CT_LightRig, so a partial rig is dropped rather
21815
+ // than emitted as an element PowerPoint would refuse to open
21816
+ const lightRig = ((_cell3D_lightRig = cell3D.lightRig) === null || _cell3D_lightRig === void 0 ? void 0 : _cell3D_lightRig.rig) && cell3D.lightRig.dir ? `<a:lightRig rig="${cell3D.lightRig.rig}" dir="${cell3D.lightRig.dir}"/>` : '';
21817
+ // `a:bevel` is required by the schema, so it is always written
21818
+ strXml += `<a:cell3D${cell3D.material ? ` prstMaterial="${cell3D.material}"` : ''}><a:bevel${bevelAttrs}/>${lightRig}</a:cell3D>`;
21819
+ }
20100
21820
  // 6: Close cell Properties & Cell
20101
21821
  strXml += cellFill;
20102
21822
  strXml += ' </a:tcPr>';
@@ -20119,38 +21839,38 @@ function slideObjectToXml(slide) {
20119
21839
  case (/* inlined export .SLIDE_OBJECT_TYPES.text */"text"):
20120
21840
  case (/* inlined export .SLIDE_OBJECT_TYPES.placeholder */"placeholder"):
20121
21841
  {
20122
- var _slideItemObj_options_line1;
20123
- const isConnector = !!((_slideItemObj_options_line1 = slideItemObj.options.line) === null || _slideItemObj_options_line1 === void 0 ? void 0 : _slideItemObj_options_line1.isConnector);
21842
+ var _slideItemObj_options_line2, _slideItemObj_options_styleRef;
21843
+ const isConnector = !!((_slideItemObj_options_line2 = slideItemObj.options.line) === null || _slideItemObj_options_line2 === void 0 ? void 0 : _slideItemObj_options_line2.isConnector);
20124
21844
  // Lines can have zero cy, but text should not
20125
21845
  if (!slideItemObj.options.line && cy === 0) cy = (/* inlined export .EMU */914400) * 0.3;
20126
21846
  // Text margins are applied in addTextDefinition → `_bodyProp` (TRBL)
20127
21847
  // A: Start SHAPE / CONNECTOR ============================================
20128
21848
  if (isConnector) {
20129
- var _ref, _ref1;
20130
- var _slideItemObj_options_line2, _slideItemObj_options_line3, _slideItemObj_options_line4, _slideItemObj_options_line5;
21849
+ var _slideItemObj_options_objectName1, _ref, _ref1;
21850
+ var _slideItemObj_options_line3, _slideItemObj_options_line4, _slideItemObj_options_line5, _slideItemObj_options_line6;
20131
21851
  strSlideXml += '<p:cxnSp>';
20132
- strSlideXml += `<p:nvCxnSpPr><p:cNvPr id="${shapeId}" name="${slideItemObj.options.objectName}"></p:cNvPr>`;
20133
- 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>`;
21852
+ strSlideXml += `<p:nvCxnSpPr>${genXmlCNvPr(shapeId, String((_slideItemObj_options_objectName1 = slideItemObj.options.objectName) !== null && _slideItemObj_options_objectName1 !== void 0 ? _slideItemObj_options_objectName1 : ''), slideItemObj.options)}`;
21853
+ const cxnLocks = genXmlLocks('a:cxnSpLocks', slideItemObj.options.lock);
21854
+ const stId = (_slideItemObj_options_line3 = slideItemObj.options.line) === null || _slideItemObj_options_line3 === void 0 ? void 0 : _slideItemObj_options_line3.sourceId;
21855
+ const endId = (_slideItemObj_options_line4 = slideItemObj.options.line) === null || _slideItemObj_options_line4 === void 0 ? void 0 : _slideItemObj_options_line4.targetId;
21856
+ strSlideXml += `<p:cNvCxnSpPr>${cxnLocks}`;
21857
+ if (stId != null) strSlideXml += `<a:stCxn id="${stId}" idx="${(_ref = (_slideItemObj_options_line5 = slideItemObj.options.line) === null || _slideItemObj_options_line5 === void 0 ? void 0 : _slideItemObj_options_line5.sourceAnchorPos) !== null && _ref !== void 0 ? _ref : 0}"/>`;
21858
+ if (endId != null) strSlideXml += `<a:endCxn id="${endId}" idx="${(_ref1 = (_slideItemObj_options_line6 = slideItemObj.options.line) === null || _slideItemObj_options_line6 === void 0 ? void 0 : _slideItemObj_options_line6.targetAnchorPos) !== null && _ref1 !== void 0 ? _ref1 : 0}"/>`;
21859
+ strSlideXml += '</p:cNvCxnSpPr>';
20134
21860
  strSlideXml += `${genXmlNvPr(slideItemObj.options, '', [
20135
21861
  nvPrModIdExt(slideItemObj.options.modId)
20136
21862
  ])}</p:nvCxnSpPr><p:spPr>`;
20137
21863
  } else {
20138
- var _slideItemObj_options_hyperlink, _slideItemObj_options_hyperlink1, _slideItemObj_options3;
21864
+ var _slideItemObj_options_objectName2;
21865
+ var _slideItemObj_options3;
20139
21866
  strSlideXml += '<p:sp>';
20140
21867
  // B: The addition of the "txBox" attribute is the sole determiner of if an object is a shape or textbox
20141
- strSlideXml += `<p:nvSpPr><p:cNvPr id="${shapeId}" name="${slideItemObj.options.objectName}">`;
20142
- // <Hyperlink>
20143
- if ((_slideItemObj_options_hyperlink = slideItemObj.options.hyperlink) === null || _slideItemObj_options_hyperlink === void 0 ? void 0 : _slideItemObj_options_hyperlink.url) {
20144
- strSlideXml += `<a:hlinkClick r:id="rId${slideItemObj.options.hyperlink._rId}" tooltip="${slideItemObj.options.hyperlink.tooltip ? encodeXmlEntities(slideItemObj.options.hyperlink.tooltip) : ''}"/>`;
20145
- }
20146
- if ((_slideItemObj_options_hyperlink1 = slideItemObj.options.hyperlink) === null || _slideItemObj_options_hyperlink1 === void 0 ? void 0 : _slideItemObj_options_hyperlink1.slide) {
20147
- strSlideXml += `<a:hlinkClick r:id="rId${slideItemObj.options.hyperlink._rId}" tooltip="${slideItemObj.options.hyperlink.tooltip ? encodeXmlEntities(slideItemObj.options.hyperlink.tooltip) : ''}" action="ppaction://hlinksldjump"/>`;
20148
- }
20149
- // </Hyperlink>
20150
- strSlideXml += '</p:cNvPr>';
21868
+ strSlideXml += '<p:nvSpPr>' + genXmlCNvPr(shapeId, String((_slideItemObj_options_objectName2 = slideItemObj.options.objectName) !== null && _slideItemObj_options_objectName2 !== void 0 ? _slideItemObj_options_objectName2 : ''), slideItemObj.options, '', genXmlCNvPrLinks(slideItemObj.options.hyperlink, slideItemObj.options.hyperlinkHover));
20151
21869
  // PowerPoint math zones are authored in text boxes; force txBox when OMML is present
20152
21870
  const useTxBox = Boolean((_slideItemObj_options3 = slideItemObj.options) === null || _slideItemObj_options3 === void 0 ? void 0 : _slideItemObj_options3.isTextBox) || textRunsHaveOmml(slideItemObj.text);
20153
- strSlideXml += '<p:cNvSpPr' + (useTxBox ? ' txBox="1"/>' : '/>');
21871
+ strSlideXml += genXmlCNvSpPr(slide_object_spread_props(xml_slide_object_spread({}, slideItemObj.options), {
21872
+ isTextBox: useTxBox
21873
+ }));
20154
21874
  strSlideXml += genXmlNvPr(slideItemObj.options, slideItemObj._type === 'placeholder' ? genXmlPlaceholder(slideItemObj, slideItemObj.options) : genXmlPlaceholder(placeholderObj, slideItemObj.options), [
20155
21875
  nvPrModIdExt(slideItemObj.options.modId)
20156
21876
  ]);
@@ -20162,7 +21882,7 @@ function slideObjectToXml(slide) {
20162
21882
  if (!isConnector && slideItemObj.shape === 'custGeom') {
20163
21883
  strSlideXml += genCustGeomXml(slideItemObj, cx, cy, slide);
20164
21884
  } else {
20165
- var _slideItemObj_options_line_curveadjust, _slideItemObj_options_line6;
21885
+ var _slideItemObj_options_line_curveadjust, _slideItemObj_options_line7;
20166
21886
  strSlideXml += '<a:prstGeom prst="' + slideItemObj.shape + '"><a:avLst>';
20167
21887
  // `rectRadius: 0` is a valid sharp-corner adj (ECMA-376 §5.1.11 preset geom `gd name="adj"`).
20168
21888
  if (typeof slideItemObj.options.rectRadius === 'number' && Number.isFinite(slideItemObj.options.rectRadius) && slideItemObj.options.rectRadius >= 0) {
@@ -20176,7 +21896,7 @@ function slideObjectToXml(slide) {
20176
21896
  strSlideXml += `<a:gd name="adj3" fmla="val ${Math.round(slideItemObj.options.arcThicknessRatio * 50000)}" />`;
20177
21897
  }
20178
21898
  }
20179
- 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)) {
21899
+ if (isConnector && ((_slideItemObj_options_line7 = slideItemObj.options.line) === null || _slideItemObj_options_line7 === void 0 ? void 0 : (_slideItemObj_options_line_curveadjust = _slideItemObj_options_line7.curveadjust) === null || _slideItemObj_options_line_curveadjust === void 0 ? void 0 : _slideItemObj_options_line_curveadjust.length)) {
20180
21900
  slideItemObj.options.line.curveadjust.forEach((adj, i)=>{
20181
21901
  strSlideXml += `<a:gd name="adj${i + 1}" fmla="val ${Math.round(Number(adj))}"/>`;
20182
21902
  });
@@ -20184,20 +21904,26 @@ function slideObjectToXml(slide) {
20184
21904
  strSlideXml += '</a:avLst></a:prstGeom>';
20185
21905
  }
20186
21906
  // Option: FILL
20187
- strSlideXml += slideItemObj.options.fill ? genXmlColorSelection(slideItemObj.options.fill) : '<a:noFill/>';
21907
+ // With a fillRef and no explicit fill, omit the fill element so the theme inherits
21908
+ if (slideItemObj.options.fill) strSlideXml += genXmlColorSelection(slideItemObj.options.fill);
21909
+ else if (!((_slideItemObj_options_styleRef = slideItemObj.options.styleRef) === null || _slideItemObj_options_styleRef === void 0 ? void 0 : _slideItemObj_options_styleRef.fill)) strSlideXml += '<a:noFill/>';
20188
21910
  // shape Type: LINE: line color
20189
21911
  if (slideItemObj.options.line) strSlideXml += genXmlLine(slideItemObj.options.line);
20190
- // EFFECTS: shadow / glow / softEdge / reflection
21912
+ // EFFECTS: shadow / glow / softEdge / reflection / fillOverlay / blur
20191
21913
  // REF: @see http://officeopenxml.com/drwSp-effects.php
20192
21914
  strSlideXml += genXmlEffectLst({
20193
21915
  shadow: slideItemObj.options.shadow,
20194
21916
  glow: slideItemObj.options.glow,
20195
21917
  softEdge: slideItemObj.options.softEdge,
20196
21918
  reflection: slideItemObj.options.reflection,
20197
- blur: slideItemObj.options.blur
21919
+ blur: slideItemObj.options.blur,
21920
+ fillOverlay: slideItemObj.options.fillOverlay,
21921
+ effectDag: slideItemObj.options.effectDag
20198
21922
  });
20199
21923
  // B: Close shape Properties
20200
21924
  strSlideXml += '</p:spPr>';
21925
+ // `p:style` follows `p:spPr` in CT_Shape / CT_Connector
21926
+ strSlideXml += genXmlShapeStyle(slideItemObj.options.styleRef);
20201
21927
  if (isConnector) {
20202
21928
  // Connectors have no text body
20203
21929
  strSlideXml += '</p:cxnSp>';
@@ -20210,18 +21936,13 @@ function slideObjectToXml(slide) {
20210
21936
  break;
20211
21937
  }
20212
21938
  case (/* inlined export .SLIDE_OBJECT_TYPES.image */"image"):
20213
- var _slideItemObj_hyperlink, _slideItemObj_hyperlink1;
21939
+ var _slideItemObj_options_objectName3;
21940
+ var _slideItemObj_options_lock;
20214
21941
  strSlideXml += '<p:pic>';
20215
21942
  strSlideXml += ' <p:nvPicPr>';
20216
- strSlideXml += `<p:cNvPr id="${shapeId}" name="${slideItemObj.options.objectName}" descr="${encodeXmlEntities(slideItemObj.options.altText || slideItemObj.image)}">`;
20217
- if ((_slideItemObj_hyperlink = slideItemObj.hyperlink) === null || _slideItemObj_hyperlink === void 0 ? void 0 : _slideItemObj_hyperlink.url) {
20218
- strSlideXml += `<a:hlinkClick r:id="rId${slideItemObj.hyperlink._rId}" tooltip="${slideItemObj.hyperlink.tooltip ? encodeXmlEntities(slideItemObj.hyperlink.tooltip) : ''}"/>`;
20219
- }
20220
- if ((_slideItemObj_hyperlink1 = slideItemObj.hyperlink) === null || _slideItemObj_hyperlink1 === void 0 ? void 0 : _slideItemObj_hyperlink1.slide) {
20221
- strSlideXml += `<a:hlinkClick r:id="rId${slideItemObj.hyperlink._rId}" tooltip="${slideItemObj.hyperlink.tooltip ? encodeXmlEntities(slideItemObj.hyperlink.tooltip) : ''}" action="ppaction://hlinksldjump"/>`;
20222
- }
20223
- strSlideXml += ' </p:cNvPr>';
20224
- strSlideXml += ' <p:cNvPicPr><a:picLocks noChangeAspect="1"/></p:cNvPicPr>';
21943
+ strSlideXml += genXmlCNvPr(shapeId, String((_slideItemObj_options_objectName3 = slideItemObj.options.objectName) !== null && _slideItemObj_options_objectName3 !== void 0 ? _slideItemObj_options_objectName3 : ''), slideItemObj.options, slideItemObj.options.altText || slideItemObj.image, genXmlCNvPrLinks(slideItemObj.hyperlink, slideItemObj.hyperlinkHover));
21944
+ // `noChangeAspect` has always been emitted here; caller locks are added to it
21945
+ strSlideXml += ` <p:cNvPicPr${((_slideItemObj_options_lock = slideItemObj.options.lock) === null || _slideItemObj_options_lock === void 0 ? void 0 : _slideItemObj_options_lock.preferRelativeResize) === true ? ' preferRelativeResize="1"' : ''}>${genXmlLocks('a:picLocks', slideItemObj.options.lock, ' noChangeAspect="1"')}</p:cNvPicPr>`;
20225
21946
  strSlideXml += genXmlNvPr(slideItemObj.options, genXmlPlaceholder(placeholderObj, slideItemObj.options), [
20226
21947
  nvPrModIdExt(slideItemObj.options.modId)
20227
21948
  ]);
@@ -20231,7 +21952,7 @@ function slideObjectToXml(slide) {
20231
21952
  if ((slide._relsMedia || []).filter((rel)=>rel.rId === slideItemObj.imageRid)[0] && (slide._relsMedia || []).filter((rel)=>rel.rId === slideItemObj.imageRid)[0].extn === 'svg') {
20232
21953
  var _slideItemObj_imageRid;
20233
21954
  strSlideXml += `<a:blip r:embed="rId${((_slideItemObj_imageRid = slideItemObj.imageRid) !== null && _slideItemObj_imageRid !== void 0 ? _slideItemObj_imageRid : 0) - 1}">`;
20234
- strSlideXml += slideItemObj.options.transparency ? ` <a:alphaModFix amt="${Math.round((100 - slideItemObj.options.transparency) * 1000)}"/>` : '';
21955
+ strSlideXml += genXmlBlipEffects(slideItemObj.options.transparency, slideItemObj.options.alphaEffects, slideItemObj.options.recolor);
20235
21956
  strSlideXml += ' <a:extLst>';
20236
21957
  strSlideXml += ' <a:ext uri="{96DAC541-7B7A-43D3-8B79-37D633B846F1}">';
20237
21958
  strSlideXml += ` <asvg:svgBlip xmlns:asvg="http://schemas.microsoft.com/office/drawing/2016/SVG/main" r:embed="rId${slideItemObj.imageRid}"/>`;
@@ -20240,7 +21961,7 @@ function slideObjectToXml(slide) {
20240
21961
  strSlideXml += '</a:blip>';
20241
21962
  } else {
20242
21963
  strSlideXml += `<a:blip r:embed="rId${slideItemObj.imageRid}">`;
20243
- strSlideXml += slideItemObj.options.transparency ? `<a:alphaModFix amt="${Math.round((100 - slideItemObj.options.transparency) * 1000)}"/>` : '';
21964
+ strSlideXml += genXmlBlipEffects(slideItemObj.options.transparency, slideItemObj.options.alphaEffects, slideItemObj.options.recolor);
20244
21965
  strSlideXml += '</a:blip>';
20245
21966
  }
20246
21967
  if (sizing === null || sizing === void 0 ? void 0 : sizing.type) {
@@ -20300,26 +22021,53 @@ function slideObjectToXml(slide) {
20300
22021
  }
20301
22022
  // OUTLINE: picture border/frame (issue #35)
20302
22023
  if (slideItemObj.options.line) strSlideXml += genXmlLine(slideItemObj.options.line);
20303
- // EFFECTS: shadow / glow / softEdge / reflection
22024
+ // EFFECTS: shadow / glow / softEdge / reflection / fillOverlay / blur
20304
22025
  strSlideXml += genXmlEffectLst({
20305
22026
  shadow: slideItemObj.options.shadow,
20306
22027
  glow: slideItemObj.options.glow,
20307
22028
  softEdge: slideItemObj.options.softEdge,
20308
22029
  reflection: slideItemObj.options.reflection,
20309
- blur: slideItemObj.options.blur
22030
+ blur: slideItemObj.options.blur,
22031
+ fillOverlay: slideItemObj.options.fillOverlay,
22032
+ effectDag: slideItemObj.options.effectDag
20310
22033
  });
20311
22034
  strSlideXml += '</p:spPr>';
22035
+ strSlideXml += genXmlShapeStyle(slideItemObj.options.styleRef);
20312
22036
  strSlideXml += '</p:pic>';
20313
22037
  break;
20314
22038
  case (/* inlined export .SLIDE_OBJECT_TYPES.media */"media"):
20315
- if (slideItemObj.mtype === 'online') {
22039
+ if (slideItemObj.mtype === 'audioCd' || slideItemObj.mtype === 'wav') {
22040
+ var _slideItemObj__coverRid;
22041
+ // EG_Media is a choice, so these carry exactly one media element and no `p14:media`:
22042
+ // `a:audioCd` references the listener's drive and `a:wavAudioFile` is the legacy
22043
+ // embedded-WAV element, so neither has an embedded media part to point at
22044
+ const coverRid = (_slideItemObj__coverRid = slideItemObj._coverRid) !== null && _slideItemObj__coverRid !== void 0 ? _slideItemObj__coverRid : 2;
22045
+ strSlideXml += '<p:pic>';
22046
+ strSlideXml += ' <p:nvPicPr>';
22047
+ strSlideXml += `<p:cNvPr id="${coverRid}" name="${slideItemObj.options.objectName}"><a:hlinkClick r:id="" action="ppaction://media"/></p:cNvPr>`;
22048
+ strSlideXml += ' <p:cNvPicPr><a:picLocks noChangeAspect="1"/></p:cNvPicPr>';
22049
+ if (slideItemObj.mtype === 'audioCd') {
22050
+ const cd = slideItemObj.options.audioCd;
22051
+ strSlideXml += genXmlNvPr(slideItemObj.options, `<a:audioCd>${genXmlAudioCdTime('a:st', cd === null || cd === void 0 ? void 0 : cd.start)}${genXmlAudioCdTime('a:end', cd === null || cd === void 0 ? void 0 : cd.end)}</a:audioCd>`);
22052
+ } else {
22053
+ strSlideXml += genXmlNvPr(slideItemObj.options, `<a:wavAudioFile r:embed="rId${slideItemObj.mediaRid}"${slideItemObj.options.objectName ? ` name="${slideItemObj.options.objectName}"` : ''}/>`);
22054
+ }
22055
+ strSlideXml += ' </p:nvPicPr>';
22056
+ strSlideXml += ` <p:blipFill><a:blip r:embed="rId${coverRid}"/><a:stretch><a:fillRect/></a:stretch></p:blipFill>`;
22057
+ strSlideXml += ' <p:spPr>';
22058
+ strSlideXml += ` <a:xfrm${locationAttr}><a:off x="${x}" y="${y}"/><a:ext cx="${cx}" cy="${cy}"/></a:xfrm>`;
22059
+ strSlideXml += ' <a:prstGeom prst="rect"><a:avLst/></a:prstGeom>';
22060
+ strSlideXml += ' </p:spPr>';
22061
+ strSlideXml += '</p:pic>';
22062
+ } else if (slideItemObj.mtype === 'online') {
20316
22063
  var _slideItemObj_mediaRid, _slideItemObj_mediaRid1;
22064
+ const contentType = slideItemObj.options.contentType ? ` contentType="${encodeXmlEntities(slideItemObj.options.contentType)}"` : '';
20317
22065
  strSlideXml += '<p:pic>';
20318
22066
  strSlideXml += ' <p:nvPicPr>';
20319
22067
  // IMPORTANT: <p:cNvPr id="" value is critical - if its not the same number as preview image `rId`, PowerPoint throws error!
20320
22068
  strSlideXml += `<p:cNvPr id="${((_slideItemObj_mediaRid = slideItemObj.mediaRid) !== null && _slideItemObj_mediaRid !== void 0 ? _slideItemObj_mediaRid : 0) + 2}" name="${slideItemObj.options.objectName}"/>`;
20321
22069
  strSlideXml += ' <p:cNvPicPr/>';
20322
- strSlideXml += genXmlNvPr(slideItemObj.options, `<a:videoFile r:link="rId${slideItemObj.mediaRid}"/>`);
22070
+ strSlideXml += genXmlNvPr(slideItemObj.options, `<a:videoFile r:link="rId${slideItemObj.mediaRid}"${contentType}/>`);
20323
22071
  strSlideXml += ' </p:nvPicPr>';
20324
22072
  // NOTE: `blip` is diferent than videos; also there's no preview "p:extLst" above but exists in videos
20325
22073
  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!
@@ -20332,6 +22080,7 @@ function slideObjectToXml(slide) {
20332
22080
  var _slideItemObj_mediaRid2, _slideItemObj_mediaRid3, _slideItemObj_mediaRid4, _slideItemObj_mediaRid5;
20333
22081
  // ECMA-376: audio uses `<a:audioFile>`, video uses `<a:videoFile>` under nvPr.
20334
22082
  const mediaFileTag = slideItemObj.mtype === 'audio' ? 'a:audioFile' : 'a:videoFile';
22083
+ const contentType = slideItemObj.options.contentType ? ` contentType="${encodeXmlEntities(slideItemObj.options.contentType)}"` : '';
20335
22084
  strSlideXml += '<p:pic>';
20336
22085
  strSlideXml += ' <p:nvPicPr>';
20337
22086
  // IMPORTANT: <p:cNvPr id="" value is critical - if not the same number as preiew image rId, PowerPoint throws error!
@@ -20340,7 +22089,7 @@ function slideObjectToXml(slide) {
20340
22089
  const mediaExtras = genXmlMediaExtras(slideItemObj.options);
20341
22090
  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>';
20342
22091
  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>' : '';
20343
- strSlideXml += genXmlNvPr(slideItemObj.options, `<${mediaFileTag} r:link="rId${slideItemObj.mediaRid}"/>`, narrationExt ? [
22092
+ strSlideXml += genXmlNvPr(slideItemObj.options, `<${mediaFileTag} r:link="rId${slideItemObj.mediaRid}"${contentType}/>`, narrationExt ? [
20344
22093
  mediaExt,
20345
22094
  narrationExt
20346
22095
  ] : [
@@ -20447,41 +22196,64 @@ function slideObjectToXml(slide) {
20447
22196
  break;
20448
22197
  }
20449
22198
  case (/* inlined export .SLIDE_OBJECT_TYPES.chart */"chart"):
20450
- strSlideXml += '<p:graphicFrame>';
20451
- strSlideXml += ' <p:nvGraphicFramePr>';
20452
- strSlideXml += ` <p:cNvPr id="${shapeId}" name="${slideItemObj.options.objectName}" descr="${encodeXmlEntities(slideItemObj.options.altText || '')}"/>`;
20453
- strSlideXml += ' <p:cNvGraphicFramePr/>';
20454
- strSlideXml += genXmlNvPr(slideItemObj.options, genXmlPlaceholder(placeholderObj, slideItemObj.options), [
20455
- nvPrModIdExt(slideItemObj.options.modId)
20456
- ]);
20457
- strSlideXml += ' </p:nvGraphicFramePr>';
20458
- strSlideXml += ` <p:xfrm><a:off x="${x}" y="${y}"/><a:ext cx="${cx}" cy="${cy}"/></p:xfrm>`;
20459
- strSlideXml += ' <a:graphic xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main">';
20460
- strSlideXml += ' <a:graphicData uri="http://schemas.openxmlformats.org/drawingml/2006/chart">';
20461
- strSlideXml += ` <c:chart r:id="rId${slideItemObj.chartRid}" xmlns:c="http://schemas.openxmlformats.org/drawingml/2006/chart"/>`;
20462
- strSlideXml += ' </a:graphicData>';
20463
- strSlideXml += ' </a:graphic>';
20464
- strSlideXml += '</p:graphicFrame>';
20465
- break;
22199
+ {
22200
+ var _slideItemObj_options_objectName4;
22201
+ var _slideItemObj_options4;
22202
+ const chartType = (_slideItemObj_options4 = slideItemObj.options) === null || _slideItemObj_options4 === void 0 ? void 0 : _slideItemObj_options4._type;
22203
+ const isChartex = isChartexType(chartType);
22204
+ const graphicDataUri = isChartex ? OOXML_CHARTEX.ns : 'http://schemas.openxmlformats.org/drawingml/2006/chart';
22205
+ const chartRef = isChartex ? `<cx:chart xmlns:cx="${OOXML_CHARTEX.ns}" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships" r:id="rId${slideItemObj.chartRid}"/>` : `<c:chart r:id="rId${slideItemObj.chartRid}" xmlns:c="http://schemas.openxmlformats.org/drawingml/2006/chart"/>`;
22206
+ const chartLocks = genXmlLocks('a:graphicFrameLocks', slideItemObj.options.lock);
22207
+ let frameXml = '<p:graphicFrame>';
22208
+ frameXml += ' <p:nvGraphicFramePr>';
22209
+ frameXml += genXmlCNvPr(shapeId, String((_slideItemObj_options_objectName4 = slideItemObj.options.objectName) !== null && _slideItemObj_options_objectName4 !== void 0 ? _slideItemObj_options_objectName4 : ''), slideItemObj.options, slideItemObj.options.altText || '');
22210
+ frameXml += chartLocks ? ` <p:cNvGraphicFramePr>${chartLocks}</p:cNvGraphicFramePr>` : ' <p:cNvGraphicFramePr/>';
22211
+ frameXml += genXmlNvPr(slideItemObj.options, genXmlPlaceholder(placeholderObj, slideItemObj.options), [
22212
+ nvPrModIdExt(slideItemObj.options.modId)
22213
+ ]);
22214
+ frameXml += ' </p:nvGraphicFramePr>';
22215
+ frameXml += ` <p:xfrm><a:off x="${x}" y="${y}"/><a:ext cx="${cx}" cy="${cy}"/></p:xfrm>`;
22216
+ frameXml += ' <a:graphic xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main">';
22217
+ frameXml += ` <a:graphicData uri="${graphicDataUri}">`;
22218
+ frameXml += ` ${chartRef}`;
22219
+ frameXml += ' </a:graphicData>';
22220
+ frameXml += ' </a:graphic>';
22221
+ frameXml += '</p:graphicFrame>';
22222
+ // A chartex frame replaces a standard graphic frame, so MS-PPTX 2.2 requires it be offered
22223
+ // through `mc:AlternateContent`. PowerPoint's own fallback is a rendered preview image, which
22224
+ // cannot be produced here - a locked text shape carrying the same message is the honest
22225
+ // equivalent for a consumer that does not understand the chartex namespace.
22226
+ strSlideXml += isChartex ? `<mc:AlternateContent xmlns:mc="${MC_NS}">` + `<mc:Choice xmlns:cx1="${chartExRequiresNs(chartType)}" Requires="cx1">` + frameXml + '</mc:Choice>' + `<mc:Fallback>${genXmlChartExFallback(shapeId, slideItemObj, {
22227
+ x,
22228
+ y,
22229
+ cx,
22230
+ cy
22231
+ })}</mc:Fallback>` + '</mc:AlternateContent>' : frameXml;
22232
+ break;
22233
+ }
20466
22234
  case (/* inlined export .SLIDE_OBJECT_TYPES.group */"group"):
20467
22235
  {
20468
22236
  var _slideItemObj__objects;
20469
22237
  // PresentationML `p:grpSp` (ECMA-376 §19.3.1.22): nvGrpSpPr + grpSpPr + children.
20470
22238
  // Child coords are group-relative; chOff is 0,0 and chExt matches the group size.
20471
22239
  strSlideXml += '<p:grpSp>';
20472
- strSlideXml += `<p:nvGrpSpPr><p:cNvPr id="${shapeId}" name="${encodeXmlEntities(slideItemObj.options.objectName || `Group ${shapeId}`)}"/>`;
20473
- strSlideXml += '<p:cNvGrpSpPr/><p:nvPr/></p:nvGrpSpPr>';
22240
+ strSlideXml += `<p:nvGrpSpPr>${genXmlCNvPr(shapeId, slideItemObj.options.objectName || `Group ${shapeId}`, slideItemObj.options)}`;
22241
+ const grpLocks = genXmlLocks('a:grpSpLocks', slideItemObj.options.lock);
22242
+ strSlideXml += (grpLocks ? `<p:cNvGrpSpPr>${grpLocks}</p:cNvGrpSpPr>` : '<p:cNvGrpSpPr/>') + `${genXmlNvPr(slideItemObj.options)}</p:nvGrpSpPr>`;
20474
22243
  strSlideXml += '<p:grpSpPr>';
20475
22244
  strSlideXml += `<a:xfrm${locationAttr}>`;
20476
22245
  strSlideXml += `<a:off x="${x}" y="${y}"/><a:ext cx="${cx}" cy="${cy}"/>`;
20477
22246
  strSlideXml += `<a:chOff x="0" y="0"/><a:chExt cx="${cx}" cy="${cy}"/>`;
20478
22247
  strSlideXml += '</a:xfrm>';
22248
+ if (slideItemObj.options.fill) strSlideXml += genXmlColorSelection(slideItemObj.options.fill);
20479
22249
  strSlideXml += genXmlEffectLst({
20480
22250
  shadow: slideItemObj.options.shadow,
20481
22251
  glow: slideItemObj.options.glow,
20482
22252
  softEdge: slideItemObj.options.softEdge,
20483
22253
  reflection: slideItemObj.options.reflection,
20484
- blur: slideItemObj.options.blur
22254
+ blur: slideItemObj.options.blur,
22255
+ fillOverlay: slideItemObj.options.fillOverlay,
22256
+ effectDag: slideItemObj.options.effectDag
20485
22257
  });
20486
22258
  strSlideXml += '</p:grpSpPr>';
20487
22259
  renderObjectList((_slideItemObj__objects = slideItemObj._objects) !== null && _slideItemObj__objects !== void 0 ? _slideItemObj__objects : []);
@@ -20589,6 +22361,21 @@ function package_object_spread(target) {
20589
22361
 
20590
22362
 
20591
22363
 
22364
+
22365
+
22366
+ /**
22367
+ * Content-type overrides a chart needs: the chart itself plus, when requested, its style and colour-style parts.
22368
+ * - one helper because charts appear on slides, layouts and the master, and a part with no declared
22369
+ * content type is a repair-dialog cause
22370
+ */ function chartContentTypes(rel) {
22371
+ const partContentType = isChartexType(rel.opts._type) ? OOXML_CHARTEX.partContentType : 'application/vnd.openxmlformats-officedocument.drawingml.chart+xml';
22372
+ let xml = `<Override PartName="${rel.Target}" ContentType="${partContentType}"/>`;
22373
+ if (wantsChartStyleParts(rel.opts)) {
22374
+ xml += `<Override PartName="/${chartColorsPartName(rel.globalId)}" ContentType="${CHART_STYLE.colorsContentType}"/>`;
22375
+ xml += `<Override PartName="/${chartStylePartName(rel.globalId)}" ContentType="${CHART_STYLE.styleContentType}"/>`;
22376
+ }
22377
+ return xml;
22378
+ }
20592
22379
  /** MS-PPTX §2.2.6 showPr browseMode */ const URI_BROWSE_MODE = '{F99C55AA-B7CB-42B0-86F8-08522FDF87E8}';
20593
22380
  /** MS-PPTX §2.2.6 showPr laserClr */ const URI_LASER_CLR = '{EC167BDD-8182-4AB7-AECC-EB403E3ABB37}';
20594
22381
  /** MS-PPTX §2.2.6 sld laserTraceLst */ const URI_LASER_TRACE_LST = '{3A86A75C-4F4B-4683-9AE1-C65F6400EC91}';
@@ -20654,7 +22441,7 @@ function slideShowExtLst(slide) {
20654
22441
  strXml += '<Default Extension="mp4" ContentType="video/mp4"/>'; // NOTE: Hard-Code this extension as it wont be created in loop below (as extn !== type)
20655
22442
  slides.forEach((slide)=>{
20656
22443
  (slide._relsMedia || []).forEach((rel)=>{
20657
- if (rel.type !== 'image' && rel.type !== 'online' && rel.type !== 'chart' && rel.extn !== 'm4v' && !strXml.includes(rel.type)) {
22444
+ if (!rel.isLinked && rel.type !== 'image' && rel.type !== 'online' && rel.type !== 'chart' && rel.extn !== 'm4v' && !strXml.includes(rel.type)) {
20658
22445
  strXml += '<Default Extension="' + rel.extn + '" ContentType="' + rel.type + '"/>';
20659
22446
  }
20660
22447
  });
@@ -20675,7 +22462,7 @@ function slideShowExtLst(slide) {
20675
22462
  strXml += `<Override PartName="/ppt/slides/slide${idx + 1}.xml" ContentType="application/vnd.openxmlformats-officedocument.presentationml.slide+xml"/>`;
20676
22463
  // Add charts if any
20677
22464
  slide._relsChart.forEach((rel)=>{
20678
- strXml += `<Override PartName="${rel.Target}" ContentType="application/vnd.openxmlformats-officedocument.drawingml.chart+xml"/>`;
22465
+ strXml += chartContentTypes(rel);
20679
22466
  });
20680
22467
  });
20681
22468
  // STEP 3: Core PPT
@@ -20688,7 +22475,7 @@ function slideShowExtLst(slide) {
20688
22475
  slideLayouts.forEach((layout, idx)=>{
20689
22476
  strXml += `<Override PartName="/ppt/slideLayouts/slideLayout${idx + 1}.xml" ContentType="application/vnd.openxmlformats-officedocument.presentationml.slideLayout+xml"/>`;
20690
22477
  (layout._relsChart || []).forEach((rel)=>{
20691
- strXml += ' <Override PartName="' + rel.Target + '" ContentType="application/vnd.openxmlformats-officedocument.drawingml.chart+xml"/>';
22478
+ strXml += chartContentTypes(rel);
20692
22479
  });
20693
22480
  });
20694
22481
  // STEP 5: Add notes slide(s)
@@ -20717,10 +22504,10 @@ function slideShowExtLst(slide) {
20717
22504
  if (tracking === null || tracking === void 0 ? void 0 : tracking.revisionInfo) strXml += `<Override PartName="/ppt/revisionInfo.xml" ContentType="${REVISION_INFO_CONTENT_TYPE}"/>`;
20718
22505
  if (tracking === null || tracking === void 0 ? void 0 : tracking.changesInfo) strXml += `<Override PartName="/ppt/changesInfo.xml" ContentType="${CHANGES_INFO_CONTENT_TYPE}"/>`;
20719
22506
  ((_ref = masterSlide === null || masterSlide === void 0 ? void 0 : masterSlide._relsChart) !== null && _ref !== void 0 ? _ref : []).forEach((rel)=>{
20720
- strXml += ' <Override PartName="' + rel.Target + '" ContentType="application/vnd.openxmlformats-officedocument.drawingml.chart+xml"/>';
22507
+ strXml += chartContentTypes(rel);
20721
22508
  });
20722
22509
  ((_ref1 = masterSlide === null || masterSlide === void 0 ? void 0 : masterSlide._relsMedia) !== null && _ref1 !== void 0 ? _ref1 : []).forEach((rel)=>{
20723
- if (rel.type !== 'image' && rel.type !== 'online' && rel.type !== 'chart' && rel.extn !== 'm4v' && !strXml.includes(rel.type)) {
22510
+ if (!rel.isLinked && rel.type !== 'image' && rel.type !== 'online' && rel.type !== 'chart' && rel.extn !== 'm4v' && !strXml.includes(rel.type)) {
20724
22511
  strXml += ' <Default Extension="' + rel.extn + '" ContentType="' + rel.type + '"/>';
20725
22512
  }
20726
22513
  });
@@ -20740,22 +22527,46 @@ function slideShowExtLst(slide) {
20740
22527
  <Relationship Id="rId3" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument" Target="ppt/presentation.xml"/>
20741
22528
  </Relationships>`;
20742
22529
  }
22530
+ /**
22531
+ * Count text paragraphs across the deck for `app.xml`
22532
+ * - derived rather than exposed: the value is a fact about the deck, not a caller preference
22533
+ * @param {PresSlide[]} slides - presentation slides
22534
+ * @returns {number} paragraph count
22535
+ */ function countParagraphs(slides) {
22536
+ return slides.reduce((total, slide)=>{
22537
+ var _slide__slideObjects;
22538
+ return total + ((_slide__slideObjects = slide._slideObjects) !== null && _slide__slideObjects !== void 0 ? _slide__slideObjects : []).reduce((count, obj)=>{
22539
+ var _obj_text;
22540
+ if (obj._type !== (/* inlined export .SLIDE_OBJECT_TYPES.text */"text") && obj._type !== (/* inlined export .SLIDE_OBJECT_TYPES.placeholder */"placeholder")) return count;
22541
+ return count + Math.max(1, ((_obj_text = obj.text) !== null && _obj_text !== void 0 ? _obj_text : []).length);
22542
+ }, 0);
22543
+ }, 0);
22544
+ }
20743
22545
  /**
20744
22546
  * Creates `docProps/app.xml`
20745
22547
  * @param {PresSlide[]} slides - Presenation Slides
20746
22548
  * @param {string} company - "Company" metadata
22549
+ * @param {DocumentProps} [props] - optional extended properties
20747
22550
  * @returns XML
20748
- */ function makeXmlApp(slides, company) {
22551
+ */ function makeXmlApp(slides, company, props) {
20749
22552
  return `<?xml version="1.0" encoding="UTF-8" standalone="yes"?>${(/* inlined export .CRLF */"\r\n")}<Properties xmlns="http://schemas.openxmlformats.org/officeDocument/2006/extended-properties" xmlns:vt="http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes">
20750
- <TotalTime>0</TotalTime>
22553
+ ${(props === null || props === void 0 ? void 0 : props.template) ? `<Template>${encodeXmlEntities(props.template)}</Template>` : ''}
22554
+ ${(props === null || props === void 0 ? void 0 : props.manager) ? `<Manager>${encodeXmlEntities(props.manager)}</Manager>` : ''}
22555
+ <TotalTime>${typeof (props === null || props === void 0 ? void 0 : props.totalEditTime) === 'number' && isFinite(props.totalEditTime) && props.totalEditTime >= 0 ? Math.round(props.totalEditTime) : 0}</TotalTime>
20751
22556
  <Words>0</Words>
20752
22557
  <Application>Microsoft Office PowerPoint</Application>
20753
22558
  <PresentationFormat>On-screen Show (16:9)</PresentationFormat>
20754
- <Paragraphs>0</Paragraphs>
22559
+ <Paragraphs>${countParagraphs(slides)}</Paragraphs>
20755
22560
  <Slides>${slides.length}</Slides>
20756
- <Notes>${slides.length}</Notes>
20757
- <HiddenSlides>0</HiddenSlides>
20758
- <MMClips>0</MMClips>
22561
+ <Notes>${slides.filter((slide)=>{
22562
+ var _slide__slideObjects;
22563
+ return ((_slide__slideObjects = slide._slideObjects) !== null && _slide__slideObjects !== void 0 ? _slide__slideObjects : []).some((obj)=>obj._type === (/* inlined export .SLIDE_OBJECT_TYPES.notes */"notes"));
22564
+ }).length}</Notes>
22565
+ <HiddenSlides>${slides.filter((slide)=>slide.hidden).length}</HiddenSlides>
22566
+ <MMClips>${slides.reduce((sum, slide)=>{
22567
+ var _slide__slideObjects;
22568
+ return sum + ((_slide__slideObjects = slide._slideObjects) !== null && _slide__slideObjects !== void 0 ? _slide__slideObjects : []).filter((obj)=>obj._type === (/* inlined export .SLIDE_OBJECT_TYPES.media */"media")).length;
22569
+ }, 0)}</MMClips>
20759
22570
  <ScaleCrop>false</ScaleCrop>
20760
22571
  <HeadingPairs>
20761
22572
  <vt:vector size="6" baseType="variant">
@@ -20778,6 +22589,7 @@ function slideShowExtLst(slide) {
20778
22589
  <Company>${encodeXmlEntities(company)}</Company>
20779
22590
  <LinksUpToDate>false</LinksUpToDate>
20780
22591
  <SharedDoc>false</SharedDoc>
22592
+ ${(props === null || props === void 0 ? void 0 : props.hyperlinkBase) ? `<HyperlinkBase>${encodeXmlEntities(props.hyperlinkBase)}</HyperlinkBase>` : ''}
20781
22593
  <HyperlinksChanged>false</HyperlinksChanged>
20782
22594
  <AppVersion>16.0000</AppVersion>
20783
22595
  </Properties>`;
@@ -20790,14 +22602,23 @@ function slideShowExtLst(slide) {
20790
22602
  * @param {string} revision - metadata value
20791
22603
  * @param {Date} [created] - OPC `dcterms:created` (defaults to now)
20792
22604
  * @param {Date} [modified] - OPC `dcterms:modified` (defaults to now)
22605
+ * @param {DocumentProps} [props] - optional extra core properties
20793
22606
  * @returns XML
20794
- */ function makeXmlCore(title, subject, author, revision, created, modified) {
22607
+ */ function makeXmlCore(title, subject, author, revision, created, modified, props) {
20795
22608
  const createdAt = (created !== null && created !== void 0 ? created : new Date()).toISOString().replace(/\.\d\d\dZ/, 'Z');
20796
22609
  const modifiedAt = (modified !== null && modified !== void 0 ? modified : new Date()).toISOString().replace(/\.\d\d\dZ/, 'Z');
20797
22610
  return `<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
20798
22611
  <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">
20799
22612
  <dc:title>${encodeXmlEntities(title)}</dc:title>
20800
22613
  <dc:subject>${encodeXmlEntities(subject)}</dc:subject>
22614
+ ${(props === null || props === void 0 ? void 0 : props.description) ? `<dc:description>${encodeXmlEntities(props.description)}</dc:description>` : ''}
22615
+ ${(props === null || props === void 0 ? void 0 : props.keywords) ? `<cp:keywords>${encodeXmlEntities(props.keywords)}</cp:keywords>` : ''}
22616
+ ${(props === null || props === void 0 ? void 0 : props.category) ? `<cp:category>${encodeXmlEntities(props.category)}</cp:category>` : ''}
22617
+ ${(props === null || props === void 0 ? void 0 : props.contentStatus) ? `<cp:contentStatus>${encodeXmlEntities(props.contentStatus)}</cp:contentStatus>` : ''}
22618
+ ${(props === null || props === void 0 ? void 0 : props.version) ? `<cp:version>${encodeXmlEntities(props.version)}</cp:version>` : ''}
22619
+ ${(props === null || props === void 0 ? void 0 : props.language) ? `<dc:language>${encodeXmlEntities(props.language)}</dc:language>` : ''}
22620
+ ${(props === null || props === void 0 ? void 0 : props.identifier) ? `<dc:identifier>${encodeXmlEntities(props.identifier)}</dc:identifier>` : ''}
22621
+ ${(props === null || props === void 0 ? void 0 : props.lastPrinted) ? `<cp:lastPrinted>${encodeXmlEntities(props.lastPrinted)}</cp:lastPrinted>` : ''}
20801
22622
  <dc:creator>${encodeXmlEntities(author)}</dc:creator>
20802
22623
  <cp:lastModifiedBy>${encodeXmlEntities(author)}</cp:lastModifiedBy>
20803
22624
  <cp:revision>${revision}</cp:revision>
@@ -20846,7 +22667,7 @@ function slideShowExtLst(slide) {
20846
22667
  const entries = [];
20847
22668
  ((_slide__slideObjects = slide._slideObjects) !== null && _slide__slideObjects !== void 0 ? _slide__slideObjects : []).forEach((obj)=>{
20848
22669
  var _obj_mediaRid;
20849
- if (obj._type !== (/* inlined export .SLIDE_OBJECT_TYPES.media */"media") || obj.mtype === 'online') return;
22670
+ if (obj._type !== (/* inlined export .SLIDE_OBJECT_TYPES.media */"media") || obj.mtype !== 'audio' && obj.mtype !== 'video') return;
20850
22671
  const o = obj.options;
20851
22672
  // Defaults are all false: no timing node unless at least one playback flag is set.
20852
22673
  if (!o || !(o.autoplay || o.loop || o.fullScreen || o.mute)) return;
@@ -20981,10 +22802,29 @@ function collectSlideAnimations(slide) {
20981
22802
  * @param {SlideLayout} layout - slide layout (master)
20982
22803
  * @return {string} XML
20983
22804
  */ function makeXmlLayout(layout) {
22805
+ // `preserve` has always been written as "1", so it stays on unless the caller turns it off
22806
+ let attrs = layout.preserve === false ? '' : ' preserve="1"';
22807
+ if (layout.layoutType) attrs += ` type="${layout.layoutType}"`;
22808
+ if (layout.matchingName) attrs += ` matchingName="${encodeXmlEntities(layout.matchingName)}"`;
22809
+ // both default to true in the schema, so only the "off" case is written
22810
+ if (layout.showMasterShapes === false) attrs += ' showMasterSp="0"';
22811
+ if (layout.showMasterPlaceholderAnimation === false) attrs += ' showMasterPhAnim="0"';
22812
+ if (layout.userDrawn === true) attrs += ' userDrawn="1"';
22813
+ // CT_ColorMapping requires all twelve attributes, so a partial override is filled from the
22814
+ // identity map - which is exactly what inheriting `a:masterClrMapping` means
22815
+ const clrMapOvr = layout.colorMapOverride ? `<p:clrMapOvr><a:overrideClrMapping${Object.entries(DEF_COLOR_MAP).map(([slot, fallback])=>{
22816
+ var _ref;
22817
+ var _layout_colorMapOverride;
22818
+ return ` ${slot}="${(_ref = (_layout_colorMapOverride = layout.colorMapOverride) === null || _layout_colorMapOverride === void 0 ? void 0 : _layout_colorMapOverride[slot]) !== null && _ref !== void 0 ? _ref : fallback}"`;
22819
+ }).join('')}/></p:clrMapOvr>` : '<p:clrMapOvr><a:masterClrMapping/></p:clrMapOvr>';
22820
+ const transitionXml = genXmlTransition(layout);
22821
+ const hasP14 = transitionXml.includes('p14:') || transitionXml.includes('xmlns:p14');
22822
+ const ns = hasP14 ? ` xmlns:p14="${P14_NS}"` : '';
22823
+ // CT_SlideLayout sequence: cSld, clrMapOvr, transition, timing, hf, extLst
20984
22824
  return `<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
20985
- <p:sldLayout 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" preserve="1">
22825
+ <p:sldLayout 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"${ns}${attrs}>
20986
22826
  ${slideObjectToXml(layout)}
20987
- <p:clrMapOvr><a:masterClrMapping/></p:clrMapOvr></p:sldLayout>`;
22827
+ ${clrMapOvr}${transitionXml}</p:sldLayout>`;
20988
22828
  }
20989
22829
  /**
20990
22830
  * Creates Slide Master 1 (`ppt/slideMasters/slideMaster1.xml`)
@@ -21055,6 +22895,7 @@ const NOTES_GUIDE_URI = '{2D200454-40CA-4A62-9FC3-DE9A4176ACB9}';
21055
22895
  * @param {IPresentationProps} pres - presentation
21056
22896
  * @return {string} XML
21057
22897
  */ function makeXmlPresentation(pres) {
22898
+ var _pres_kinsoku;
21058
22899
  let strXml = `<?xml version="1.0" encoding="UTF-8" standalone="yes"?>${(/* inlined export .CRLF */"\r\n")}` + '<p:presentation 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" firstSlideNum="${pres.firstSlideNum}" ${pres.rtlMode ? 'rtl="1"' : ''} saveSubsetFonts="1" autoCompressPictures="0">`;
21059
22900
  // STEP 1: Add slide master (SPEC: tag 1 under <presentation>)
21060
22901
  strXml += '<p:sldMasterIdLst><p:sldMasterId id="2147483648" r:id="rId1"/></p:sldMasterIdLst>';
@@ -21078,8 +22919,26 @@ const NOTES_GUIDE_URI = '{2D200454-40CA-4A62-9FC3-DE9A4176ACB9}';
21078
22919
  // Presentations open without warning without this line, but then they aren't previewed in Finder or viewable on iOS.
21079
22920
  strXml += `<p:notesMasterIdLst><p:notesMasterId r:id="rId${pres.slides.length + 2}"/></p:notesMasterIdLst>`;
21080
22921
  // STEP 4: Add sizes
21081
- strXml += `<p:sldSz cx="${pres.presLayout.width}" cy="${pres.presLayout.height}"/>`;
22922
+ // `@type` records which preset the dimensions match; omitted when the caller does not say
22923
+ strXml += `<p:sldSz cx="${pres.presLayout.width}" cy="${pres.presLayout.height}"${pres.slideSizeType ? ` type="${pres.slideSizeType}"` : ''}/>`;
21082
22924
  strXml += `<p:notesSz cx="${pres.presLayout.height}" cy="${pres.presLayout.width}"/>`;
22925
+ // CT_Presentation sequence puts these between `notesSz` and `defaultTextStyle` (photoAlbum, kinsoku)
22926
+ if (pres.photoAlbum) {
22927
+ const album = pres.photoAlbum;
22928
+ let attrs = '';
22929
+ if (album.blackWhite === true) attrs += ' bw="1"';
22930
+ if (album.showCaptions === true) attrs += ' showCaptions="1"';
22931
+ if (album.layout) attrs += ` layout="${album.layout}"`;
22932
+ if (album.frame) attrs += ` frame="${album.frame}"`;
22933
+ strXml += `<p:photoAlbum${attrs}/>`;
22934
+ }
22935
+ // `invalStChars` and `invalEndChars` are required on CT_Kinsoku, so a partial value is dropped
22936
+ // rather than emitted as an element PowerPoint would refuse to open
22937
+ if (((_pres_kinsoku = pres.kinsoku) === null || _pres_kinsoku === void 0 ? void 0 : _pres_kinsoku.invalidStartChars) && pres.kinsoku.invalidEndChars) {
22938
+ const kin = pres.kinsoku;
22939
+ const lang = kin.lang ? ` lang="${encodeXmlEntities(kin.lang)}"` : '';
22940
+ strXml += `<p:kinsoku${lang} invalStChars="${encodeXmlEntities(kin.invalidStartChars)}" invalEndChars="${encodeXmlEntities(kin.invalidEndChars)}"/>`;
22941
+ }
21083
22942
  // STEP 5: Add text styles
21084
22943
  strXml += '<p:defaultTextStyle>';
21085
22944
  for(let idy = 1; idy < 10; idy++){
@@ -21119,10 +22978,28 @@ const NOTES_GUIDE_URI = '{2D200454-40CA-4A62-9FC3-DE9A4176ACB9}';
21119
22978
  * Create `ppt/presProps.xml`
21120
22979
  * @return {string} XML
21121
22980
  */ function makeXmlPresProps(pres) {
21122
- // CT_PresentationProperties sequence: showPr then extLst. Opt-in: emit nothing extra unless set.
22981
+ // CT_PresentationProperties sequence: htmlPubPr, webPr, prnPr, showPr, clrMru, extLst.
22982
+ // Opt-in: emit nothing extra unless set. prnPr/clrMru live here (not on CT_Presentation).
22983
+ const prnPr = makeXmlPrnPr(pres);
21123
22984
  const showPr = makeXmlShowPr(pres);
22985
+ const clrMru = makeXmlClrMru(pres);
21124
22986
  const extLst = makeXmlPresPropsExtLst(pres);
21125
- return `<?xml version="1.0" encoding="UTF-8" standalone="yes"?>${(/* inlined export .CRLF */"\r\n")}` + '<p:presentationPr 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">' + `${showPr}${extLst}</p:presentationPr>`;
22987
+ return `<?xml version="1.0" encoding="UTF-8" standalone="yes"?>${(/* inlined export .CRLF */"\r\n")}` + '<p:presentationPr 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">' + `${prnPr}${showPr}${clrMru}${extLst}</p:presentationPr>`;
22988
+ }
22989
+ function makeXmlPrnPr(pres) {
22990
+ if (!(pres === null || pres === void 0 ? void 0 : pres.printProps)) return '';
22991
+ const prn = pres.printProps;
22992
+ let attrs = '';
22993
+ if (prn.what) attrs += ` prnWhat="${prn.what}"`;
22994
+ if (prn.colorMode) attrs += ` clrMode="${prn.colorMode}"`;
22995
+ if (prn.hiddenSlides === true) attrs += ' hiddenSlides="1"';
22996
+ if (prn.scaleToFitPaper === true) attrs += ' scaleToFitPaper="1"';
22997
+ if (prn.frameSlides === true) attrs += ' frameSlides="1"';
22998
+ return `<p:prnPr${attrs}/>`;
22999
+ }
23000
+ function makeXmlClrMru(pres) {
23001
+ if (!Array.isArray(pres === null || pres === void 0 ? void 0 : pres.recentColors) || pres.recentColors.length === 0) return '';
23002
+ return `<p:clrMru>${pres.recentColors.map((color)=>createColorElement(color)).join('')}</p:clrMru>`;
21126
23003
  }
21127
23004
  /**
21128
23005
  * `p:showPr` for slide-show options, or '' when none are set.
@@ -21171,14 +23048,144 @@ function makeXmlPresPropsExtLst(pres) {
21171
23048
  * Create `ppt/tableStyles.xml`
21172
23049
  * @see: http://openxmldeveloper.org/discussions/formats/f/13/p/2398/8107.aspx
21173
23050
  * @return {string} XML
21174
- */ function makeXmlTableStyles() {
21175
- return `<?xml version="1.0" encoding="UTF-8" standalone="yes"?>${(/* inlined export .CRLF */"\r\n")}<a:tblStyleLst xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main" def="{5C22544A-7EE6-4342-B048-85BDC9FD1C3A}"/>`;
23051
+ */ /**
23052
+ * The GUID `a:tblStyleLst@def` has always carried - PowerPoint's "Medium Style 2 - Accent 1"
23053
+ */ const DEF_TABLE_STYLE_ID = '{5C22544A-7EE6-4342-B048-85BDC9FD1C3A}';
23054
+ /**
23055
+ * CT_TableStyle fixes this child order, and it is neither alphabetical nor the intuitive one:
23056
+ * `lastCol` precedes `firstCol`, and `firstRow` sits between `swCell` and `neCell`.
23057
+ */ const TABLE_STYLE_PARTS = [
23058
+ [
23059
+ 'wholeTable',
23060
+ 'wholeTbl'
23061
+ ],
23062
+ [
23063
+ 'band1H',
23064
+ 'band1H'
23065
+ ],
23066
+ [
23067
+ 'band2H',
23068
+ 'band2H'
23069
+ ],
23070
+ [
23071
+ 'band1V',
23072
+ 'band1V'
23073
+ ],
23074
+ [
23075
+ 'band2V',
23076
+ 'band2V'
23077
+ ],
23078
+ [
23079
+ 'lastCol',
23080
+ 'lastCol'
23081
+ ],
23082
+ [
23083
+ 'firstCol',
23084
+ 'firstCol'
23085
+ ],
23086
+ [
23087
+ 'lastRow',
23088
+ 'lastRow'
23089
+ ],
23090
+ [
23091
+ 'seCell',
23092
+ 'seCell'
23093
+ ],
23094
+ [
23095
+ 'swCell',
23096
+ 'swCell'
23097
+ ],
23098
+ [
23099
+ 'firstRow',
23100
+ 'firstRow'
23101
+ ],
23102
+ [
23103
+ 'neCell',
23104
+ 'neCell'
23105
+ ],
23106
+ [
23107
+ 'nwCell',
23108
+ 'nwCell'
23109
+ ]
23110
+ ];
23111
+ /** CT_TableCellBorderStyle child order */ const TABLE_STYLE_BORDERS = [
23112
+ 'left',
23113
+ 'right',
23114
+ 'top',
23115
+ 'bottom',
23116
+ 'insideH',
23117
+ 'insideV'
23118
+ ];
23119
+ /**
23120
+ * One part of a table style (`a:wholeTbl`, `a:band1H`, ...).
23121
+ * - `a:tcTxStyle` precedes `a:tcStyle`; inside the cell style, `a:tcBdr` precedes the fill
23122
+ */ function genXmlTableStylePart(tag, part) {
23123
+ // `b`/`i` are ST_OnOffStyleType: an unset property means "def", i.e. leave it to the theme
23124
+ const bold = typeof part.bold === 'boolean' ? ` b="${part.bold ? 'on' : 'off'}"` : '';
23125
+ const italic = typeof part.italic === 'boolean' ? ` i="${part.italic ? 'on' : 'off'}"` : '';
23126
+ const txStyle = bold || italic || part.color ? `<a:tcTxStyle${bold}${italic}>${part.color ? createColorElement(part.color) : ''}</a:tcTxStyle>` : '';
23127
+ const borders = TABLE_STYLE_BORDERS.filter((edge)=>{
23128
+ var _part_borders;
23129
+ return (_part_borders = part.borders) === null || _part_borders === void 0 ? void 0 : _part_borders[edge];
23130
+ }).map((edge)=>{
23131
+ var _part_borders;
23132
+ const line = (_part_borders = part.borders) === null || _part_borders === void 0 ? void 0 : _part_borders[edge];
23133
+ return line ? `<a:${edge}>${genXmlLine(line)}</a:${edge}>` : '';
23134
+ }).join('');
23135
+ const fill = part.fill ? `<a:fill>${genXmlColorSelection(part.fill)}</a:fill>` : '';
23136
+ const cellStyle = borders || fill ? `<a:tcStyle>${borders ? `<a:tcBdr>${borders}</a:tcBdr>` : ''}${fill}</a:tcStyle>` : '';
23137
+ return txStyle || cellStyle ? `<a:${tag}>${txStyle}${cellStyle}</a:${tag}>` : '';
23138
+ }
23139
+ /**
23140
+ * Creates `ppt/tableStyles.xml`
23141
+ * - with no custom styles this is the same self-closing stub earlier versions wrote
23142
+ * @param {TableStyleProps[]} [styles] - custom table style definitions
23143
+ * @return {string} XML
23144
+ */ function makeXmlTableStyles(styles) {
23145
+ const valid = (styles !== null && styles !== void 0 ? styles : []).filter((style)=>{
23146
+ var _ref;
23147
+ // `@styleId` is an ST_Guid and `@styleName` is required; a malformed id would be rejected on open
23148
+ if (!/^\{[0-9A-Fa-f]{8}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{12}\}$/.test((_ref = style === null || style === void 0 ? void 0 : style.id) !== null && _ref !== void 0 ? _ref : '')) {
23149
+ console.warn(`[pptxgenjs] table style \`id\` must be a braced GUID, e.g. '{5C22544A-7EE6-4342-B048-85BDC9FD1C3A}' - "${String(style === null || style === void 0 ? void 0 : style.id)}" ignored`);
23150
+ return false;
23151
+ }
23152
+ if (!style.name) {
23153
+ console.warn(`[pptxgenjs] table style ${style.id} has no \`name\` - ignored`);
23154
+ return false;
23155
+ }
23156
+ return true;
23157
+ });
23158
+ const head = `<?xml version="1.0" encoding="UTF-8" standalone="yes"?>${(/* inlined export .CRLF */"\r\n")}<a:tblStyleLst xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main" def="${DEF_TABLE_STYLE_ID}"`;
23159
+ if (valid.length === 0) return `${head}/>`;
23160
+ const body = valid.map((style)=>{
23161
+ const parts = TABLE_STYLE_PARTS.map(([prop, tag])=>{
23162
+ const part = style[prop];
23163
+ return part && typeof part === 'object' ? genXmlTableStylePart(tag, part) : '';
23164
+ }).join('');
23165
+ return `<a:tblStyle styleId="${style.id}" styleName="${encodeXmlEntities(style.name)}">${parts}</a:tblStyle>`;
23166
+ }).join('');
23167
+ return `${head}>${body}</a:tblStyleLst>`;
21176
23168
  }
21177
23169
  /**
21178
23170
  * Creates `ppt/viewProps.xml`
23171
+ * - the hardcoded literal is kept when the caller sets no `viewProps`, so default packages stay byte-identical
21179
23172
  * @return {string} XML
21180
- */ function makeXmlViewProps() {
21181
- return `<?xml version="1.0" encoding="UTF-8" standalone="yes"?>${(/* inlined export .CRLF */"\r\n")}<p:viewPr 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:normalViewPr horzBarState="maximized"><p:restoredLeft sz="15611"/><p:restoredTop sz="94610"/></p:normalViewPr><p:slideViewPr><p:cSldViewPr snapToGrid="0" snapToObjects="1"><p:cViewPr varScale="1"><p:scale><a:sx n="136" d="100"/><a:sy n="136" d="100"/></p:scale><p:origin x="216" y="312"/></p:cViewPr><p:guideLst/></p:cSldViewPr></p:slideViewPr><p:notesTextViewPr><p:cViewPr><p:scale><a:sx n="1" d="1"/><a:sy n="1" d="1"/></p:scale><p:origin x="0" y="0"/></p:cViewPr></p:notesTextViewPr><p:gridSpacing cx="76200" cy="76200"/></p:viewPr>`;
23173
+ */ function makeXmlViewProps(pres) {
23174
+ var _view_guides;
23175
+ if (!(pres === null || pres === void 0 ? void 0 : pres.viewProps)) {
23176
+ return `<?xml version="1.0" encoding="UTF-8" standalone="yes"?>${(/* inlined export .CRLF */"\r\n")}<p:viewPr 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:normalViewPr horzBarState="maximized"><p:restoredLeft sz="15611"/><p:restoredTop sz="94610"/></p:normalViewPr><p:slideViewPr><p:cSldViewPr snapToGrid="0" snapToObjects="1"><p:cViewPr varScale="1"><p:scale><a:sx n="136" d="100"/><a:sy n="136" d="100"/></p:scale><p:origin x="216" y="312"/></p:cViewPr><p:guideLst/></p:cSldViewPr></p:slideViewPr><p:notesTextViewPr><p:cViewPr><p:scale><a:sx n="1" d="1"/><a:sy n="1" d="1"/></p:scale><p:origin x="0" y="0"/></p:cViewPr></p:notesTextViewPr><p:gridSpacing cx="76200" cy="76200"/></p:viewPr>`;
23177
+ }
23178
+ const view = pres.viewProps;
23179
+ const zoom = typeof view.zoom === 'number' && isFinite(view.zoom) && view.zoom > 0 ? Math.round(view.zoom) : 136;
23180
+ const grid = typeof view.gridSpacing === 'number' && isFinite(view.gridSpacing) && view.gridSpacing > 0 ? inch2Emu(view.gridSpacing) : 76200;
23181
+ const snapGrid = view.snapToGrid === true ? '1' : '0';
23182
+ const snapObj = view.snapToObjects === false ? '0' : '1';
23183
+ const showGuides = view.showGuides === true ? ' showGuides="1"' : '';
23184
+ const showComments = view.showComments === false ? ' showComments="0"' : '';
23185
+ const lastView = view.lastView ? ` lastView="${view.lastView}"` : '';
23186
+ // `p:guideLst` is the classic guide list, distinct from the MS-PPTX `p15:sldGuideLst` extension
23187
+ const guides = ((_view_guides = view.guides) !== null && _view_guides !== void 0 ? _view_guides : []).filter((guide)=>typeof guide.pos === 'number' && isFinite(guide.pos) && guide.pos >= 0).map((guide)=>`<p:guide${guide.orient === 'vert' ? ' orient="vert"' : ''} pos="${Math.round(guide.pos * 96)}"/>`).join('');
23188
+ return `<?xml version="1.0" encoding="UTF-8" standalone="yes"?>${(/* inlined export .CRLF */"\r\n")}` + `<p:viewPr 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"${lastView}${showComments}>` + '<p:normalViewPr horzBarState="maximized"><p:restoredLeft sz="15611"/><p:restoredTop sz="94610"/></p:normalViewPr>' + `<p:slideViewPr><p:cSldViewPr snapToGrid="${snapGrid}" snapToObjects="${snapObj}"${showGuides}>` + `<p:cViewPr varScale="1"><p:scale><a:sx n="${zoom}" d="100"/><a:sy n="${zoom}" d="100"/></p:scale><p:origin x="216" y="312"/></p:cViewPr>` + (guides ? `<p:guideLst>${guides}</p:guideLst>` : '<p:guideLst/>') + '</p:cSldViewPr></p:slideViewPr>' + '<p:notesTextViewPr><p:cViewPr><p:scale><a:sx n="1" d="1"/><a:sy n="1" d="1"/></p:scale><p:origin x="0" y="0"/></p:cViewPr></p:notesTextViewPr>' + `<p:gridSpacing cx="${grid}" cy="${grid}"/>` + '</p:viewPr>';
21182
23189
  }
21183
23190
 
21184
23191
 
@@ -21187,6 +23194,8 @@ function makeXmlPresPropsExtLst(pres) {
21187
23194
 
21188
23195
 
21189
23196
 
23197
+
23198
+
21190
23199
  function pptxgen_asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
21191
23200
  try {
21192
23201
  var info = gen[key](arg);
@@ -21369,6 +23378,12 @@ class PptxGenJS {
21369
23378
  get rtlMode() {
21370
23379
  return this._rtlMode;
21371
23380
  }
23381
+ set tableStyles(value) {
23382
+ this._tableStyles = value;
23383
+ }
23384
+ get tableStyles() {
23385
+ return this._tableStyles;
23386
+ }
21372
23387
  get firstSlideNum() {
21373
23388
  return this._firstSlideNum;
21374
23389
  }
@@ -21664,7 +23679,15 @@ class PptxGenJS {
21664
23679
  _slideNumberProps: propsClone.slideNumber || null,
21665
23680
  _slideObjects: [],
21666
23681
  background: propsClone.background || null,
21667
- bkgd: propsClone.bkgd || null
23682
+ bkgd: propsClone.bkgd || null,
23683
+ layoutType: propsClone.layoutType,
23684
+ matchingName: propsClone.matchingName,
23685
+ preserve: propsClone.preserve,
23686
+ showMasterShapes: propsClone.showMasterShapes,
23687
+ showMasterPlaceholderAnimation: propsClone.showMasterPlaceholderAnimation,
23688
+ userDrawn: propsClone.userDrawn,
23689
+ colorMapOverride: propsClone.colorMapOverride,
23690
+ transition: propsClone.transition
21668
23691
  };
21669
23692
  // STEP 1: Create the Slide Master/Layout
21670
23693
  createSlideMaster(propsClone, newLayout);
@@ -21700,7 +23723,7 @@ class PptxGenJS {
21700
23723
  */ pptxgen_define_property(this, "_layout", void 0);
21701
23724
  /**
21702
23725
  * PptxGenJS Library Version
21703
- */ pptxgen_define_property(this, "_version", (/* inlined export .VERSION */"4.1.20"));
23726
+ */ pptxgen_define_property(this, "_version", (/* inlined export .VERSION */"4.2.1"));
21704
23727
  /**
21705
23728
  * @type {string}
21706
23729
  */ pptxgen_define_property(this, "_author", void 0);
@@ -21733,6 +23756,7 @@ class PptxGenJS {
21733
23756
  * Whether Right-to-Left (RTL) mode is enabled
21734
23757
  * @type {boolean}
21735
23758
  */ pptxgen_define_property(this, "_rtlMode", void 0);
23759
+ /** tableStyles - custom table style definitions written into `ppt/tableStyles.xml` */ pptxgen_define_property(this, "_tableStyles", void 0);
21736
23760
  /**
21737
23761
  * Starting slide number (`p:presentation@firstSlideNum`)
21738
23762
  * @default 1
@@ -21768,6 +23792,13 @@ class PptxGenJS {
21768
23792
  * Notes-page alignment guides (MS-PPTX §2.4.1.3). Emitted as `p15:notesGuideLst`.
21769
23793
  * @example pptx.notesGuides = [{ orient: 'horz', pos: 2 }]
21770
23794
  */ pptxgen_define_property(this, "notesGuides", []);
23795
+ /** Additional document properties written to `docProps`. */ pptxgen_define_property(this, "documentProps", void 0);
23796
+ /** Slide-size preset (`p:sldSz@type`). */ pptxgen_define_property(this, "slideSizeType", void 0);
23797
+ /** Photo-album mode (`p:photoAlbum`). */ pptxgen_define_property(this, "photoAlbum", void 0);
23798
+ /** East Asian line-breaking rules (`p:kinsoku`). */ pptxgen_define_property(this, "kinsoku", void 0);
23799
+ /** Print defaults (`p:prnPr` on `presentationPr`). */ pptxgen_define_property(this, "printProps", void 0);
23800
+ /** Recently-used colours (`p:clrMru` on `presentationPr`). */ pptxgen_define_property(this, "recentColors", void 0);
23801
+ /** View properties (`ppt/viewProps.xml`). Unset keeps the previous hardcoded viewPr. */ pptxgen_define_property(this, "viewProps", void 0);
21771
23802
  /**
21772
23803
  * Modern comment authors (MS-PPTX §2.16). Emitted to `ppt/authors.xml`.
21773
23804
  * Auto-populated from slide `addComment` author names if left empty.
@@ -21849,7 +23880,7 @@ class PptxGenJS {
21849
23880
  */ pptxgen_define_property(this, "createChartMediaRels", (slide, zip, chartPromises, mediaPaths)=>{
21850
23881
  slide._relsChart.forEach((rel)=>chartPromises.push(createExcelWorksheet(rel, zip)));
21851
23882
  slide._relsMedia.forEach((rel)=>{
21852
- if (rel.type !== 'online' && rel.type !== 'hyperlink') {
23883
+ if (!rel.isLinked && rel.type !== 'online' && rel.type !== 'hyperlink') {
21853
23884
  var _data_split_pop;
21854
23885
  // A: Loop vars
21855
23886
  let data = rel.data && typeof rel.data === 'string' ? rel.data : '';
@@ -21951,16 +23982,16 @@ class PptxGenJS {
21951
23982
  };
21952
23983
  zip.file('[Content_Types].xml', makeXmlContTypes(this.slides, this.slideLayouts, this.masterSlide, trackingParts)); // TODO: pass only `this` like below! 20200206
21953
23984
  zip.file('_rels/.rels', makeXmlRootRels());
21954
- zip.file('docProps/app.xml', makeXmlApp(this.slides, this.company)); // TODO: pass only `this` like below! 20200206
21955
- 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
23985
+ zip.file('docProps/app.xml', makeXmlApp(this.slides, this.company, this.documentProps)); // TODO: pass only `this` like below! 20200206
23986
+ zip.file('docProps/core.xml', makeXmlCore(this.title, this.subject, this.author, this.revision, this.created, this.modified, this.documentProps)); // TODO: pass only `this` like below! 20200206
21956
23987
  zip.file('ppt/_rels/presentation.xml.rels', makeXmlPresentationRels(this.slides, trackingParts));
21957
23988
  zip.file('ppt/theme/theme1.xml', makeXmlTheme(this));
21958
23989
  // notesMaster gets its own theme part (Office repair creates theme2 when notesMaster shares theme1; Juliussssssss 9bdfe09).
21959
23990
  zip.file('ppt/theme/theme2.xml', makeXmlTheme(this, 'notes'));
21960
23991
  zip.file('ppt/presentation.xml', makeXmlPresentation(this));
21961
23992
  zip.file('ppt/presProps.xml', makeXmlPresProps(this));
21962
- zip.file('ppt/tableStyles.xml', makeXmlTableStyles());
21963
- zip.file('ppt/viewProps.xml', makeXmlViewProps());
23993
+ zip.file('ppt/tableStyles.xml', makeXmlTableStyles(this._tableStyles));
23994
+ zip.file('ppt/viewProps.xml', makeXmlViewProps(this));
21964
23995
  // C: Create a Layout/Master/Rel/Slide file for each SlideLayout and Slide
21965
23996
  this.slideLayouts.forEach((layout, idx)=>{
21966
23997
  zip.file(`ppt/slideLayouts/slideLayout${idx + 1}.xml`, makeXmlLayout(layout));
@@ -22127,6 +24158,7 @@ class PptxGenJS {
22127
24158
  addTable: notOnMaster,
22128
24159
  addText: notOnMaster,
22129
24160
  addGroup: notOnMaster,
24161
+ addConnector: notOnMaster,
22130
24162
  addWordArt: notOnMaster,
22131
24163
  addTransition: notOnMaster,
22132
24164
  addAnimation: notOnMaster,