@office-open/pptx 0.3.0 → 0.3.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -1,11 +1,11 @@
1
1
  import { n as __reExport, r as __require, t as __exportAll } from "./_chunks/chunk-C8fdooHg.mjs";
2
- import { AppProperties, BaseXmlComponent, BuilderElement, Formatter, ImportedXmlComponent, NextAttributeComponent, Relationships, StringContainer, XmlComponent, chartAttr, convertEmuToInches as emusToInches, convertEmuToPixels as emusToPixels, convertEmuToPoints as emusToPoints, convertInchesToEmu as inchesToEmus, convertPixelsToEmu as pixelsToEmus, convertPointsToEmu as pointsToEmus, getImageType, hashedId, parseCoreProperties, parseRels, readXmlFromZip, uint8ToBase64, uniqueId, uniqueNumericIdCreator, uniqueUuid, unzipToMap, wrapEl } from "@office-open/core";
2
+ import { AppProperties, BaseXmlComponent, BuilderElement, Formatter, ImportedXmlComponent, NextAttributeComponent, RawPassthrough, Relationships, StringContainer, XmlComponent, chartAttr, collectPlaceholderKeys, convertEmuToInches as emusToInches, convertEmuToPixels as emusToPixels, convertEmuToPoints as emusToPoints, convertInchesToEmu as inchesToEmus, convertPixelsToEmu as pixelsToEmus, convertPointsToEmu as pointsToEmus, getImageType, hasPlaceholders, hashedId, isRaw, parseCoreProperties, parseRels, readAllXmlParts, readXmlFromZip, uint8ToBase64, uniqueId, uniqueNumericIdCreator, uniqueUuid, unzipToMap, wrapEl } from "@office-open/core";
3
3
  import { ChartCollection, ChartTitle, createChartType } from "@office-open/core/chart";
4
+ import { attr, attrBool, attrNum, attrs, children, escapeXml, findChild, findDeep, textOf, xml } from "@office-open/xml";
4
5
  import { BevelPresetType, CompoundLine, LineCap, LineJoin, PathShadeType, PenAlignment, PresetDash, PresetMaterialType, TileFlipMode, buildFill, createBevel, createBottomBevel, createColorElement, createColorTransforms, createEffectList, createGradientFill, createGradientStop, createOutline, createOutline as createOutline$1, createScene3D, createShape3D, extractBlipFillMedia } from "@office-open/core/drawingml";
5
6
  import { COLOR_CATEGORIES, LAYOUT_CATEGORIES, STYLE_CATEGORIES, SmartArtCollection, createDataModel } from "@office-open/core/smartart";
6
7
  import { Readable } from "stream";
7
8
  import { Zip, ZipDeflate, ZipPassThrough, zipSync } from "fflate";
8
- import { attr, attrBool, attrNum, children, findChild, findDeep, textOf, xml } from "@office-open/xml";
9
9
  export * from "@office-open/core/values";
10
10
  //#region src/file/content-types/content-types.ts
11
11
  /**
@@ -378,6 +378,9 @@ var GroupShapeNonVisualProperties = class extends BuilderElement {
378
378
  function buildEndParagraphRunProperties(lang = "en-US") {
379
379
  return { "a:endParaRPr": { _attr: { lang } } };
380
380
  }
381
+ function buildEndParagraphRunPropertiesXml(lang = "en-US") {
382
+ return `<a:endParaRPr${attrs({ lang })}/>`;
383
+ }
381
384
  /**
382
385
  * a:endParaRPr — End paragraph run properties.
383
386
  * Lazy: stores lang, builds XML object in prepForXml.
@@ -458,7 +461,48 @@ var ParagraphProperties = class extends XmlComponent {
458
461
  prepForXml(_context) {
459
462
  return buildParagraphProperties(this.options);
460
463
  }
464
+ toXml() {
465
+ return buildParagraphPropertiesXml(this.options);
466
+ }
461
467
  };
468
+ function buildBulletChildrenXml(options) {
469
+ if (options.type === "none") return "<a:buNone/>";
470
+ let s = "";
471
+ if (options.color) s += `<a:buClr><a:srgbClr${attrs({ val: options.color.replace("#", "") })}/></a:buClr>`;
472
+ if (options.size !== void 0) s += `<a:buSzPct${attrs({ val: `${options.size}%` })}/>`;
473
+ s += `<a:buFont${attrs({
474
+ typeface: "Arial",
475
+ panose: "020B0604020202020204",
476
+ pitchFamily: "34",
477
+ charset: "0"
478
+ })}/>`;
479
+ if (options.type === "char") s += `<a:buChar${attrs({ char: options.char ?? "•" })}/>`;
480
+ else if (options.type === "autoNum") {
481
+ const buAttrs = { type: options.format ?? "arabicPeriod" };
482
+ if (options.startAt !== void 0) buAttrs.startAt = options.startAt;
483
+ s += `<a:buAutoNum${attrs(buAttrs)}/>`;
484
+ }
485
+ return s;
486
+ }
487
+ function buildParagraphPropertiesXml(options) {
488
+ const attrStr = attrs({
489
+ algn: options.alignment ? TextAlignment[options.alignment] : void 0,
490
+ lvl: options.indentLevel,
491
+ marL: options.marginIndent,
492
+ marR: options.marginRight,
493
+ defTabSz: options.defTabSize
494
+ });
495
+ const body = [];
496
+ if (options.lineSpacing !== void 0) body.push(`<a:lnSpc><a:spcPct${attrs({ val: options.lineSpacing * 1e3 })}/></a:lnSpc>`);
497
+ if (options.lineSpacingPoints !== void 0) body.push(`<a:lnSpc><a:spcPts${attrs({ val: options.lineSpacingPoints * 100 })}/></a:lnSpc>`);
498
+ if (options.marginBottom !== void 0 || options.marginTop !== void 0) body.push(`<a:spcAft><a:spcPts${attrs({ val: options.marginBottom ?? 0 })}/></a:spcAft>`);
499
+ if (options.marginTop !== void 0) body.push(`<a:spcBef><a:spcPts${attrs({ val: options.marginTop })}/></a:spcBef>`);
500
+ if (options.bullet) body.push(buildBulletChildrenXml(options.bullet));
501
+ else if (options.bulletNone !== false) body.push("<a:buNone/>");
502
+ if (!attrStr && body.length === 0) return "";
503
+ if (body.length === 0) return `<a:pPr${attrStr}/>`;
504
+ return `<a:pPr${attrStr}>${body.join("")}</a:pPr>`;
505
+ }
462
506
  //#endregion
463
507
  //#region src/file/shape/paragraph/run-properties.ts
464
508
  let nextHyperlinkId = 1;
@@ -492,7 +536,7 @@ function buildRunProperties(options, hyperlinkKey, fillObject) {
492
536
  if (options.lang) attrs.lang = options.lang;
493
537
  if (options.strike) attrs.strike = StrikeStyle[options.strike];
494
538
  if (options.baseline !== void 0) attrs.baseline = options.baseline;
495
- if (options.capitalization) attrs.cap = TextCapitalization[options.capitalization];
539
+ if (options.capitalization) attrs.cap = TextCapitalization[options.capitalization] ?? options.capitalization;
496
540
  if (options.spacing !== void 0) attrs.spc = options.spacing;
497
541
  if (options.noProof !== void 0) attrs.noProof = options.noProof;
498
542
  if (options.dirty !== void 0) attrs.dirty = options.dirty;
@@ -535,7 +579,48 @@ var RunProperties = class extends XmlComponent {
535
579
  if (opts.fill !== void 0) fillObj = buildFill(opts.fill).prepForXml(context) ?? void 0;
536
580
  return buildRunProperties(opts, hyperlinkKey, fillObj);
537
581
  }
582
+ toXml(context) {
583
+ const opts = this.options;
584
+ let hyperlinkKey;
585
+ if (opts.hyperlink) {
586
+ hyperlinkKey = `hlink_${nextHyperlinkId++}`;
587
+ context.fileData?.Hyperlinks?.addHyperlink(hyperlinkKey, opts.hyperlink.url, opts.hyperlink.tooltip);
588
+ }
589
+ let fillObj;
590
+ if (opts.fill !== void 0) fillObj = buildFill(opts.fill).prepForXml(context) ?? void 0;
591
+ return buildRunPropertiesXml(opts, hyperlinkKey, fillObj);
592
+ }
538
593
  };
594
+ /**
595
+ * String version of buildRunProperties for zero-allocation serialization.
596
+ */
597
+ function buildRunPropertiesXml(options, hyperlinkKey, fillObject) {
598
+ const a = {};
599
+ if (options.fontSize) a.sz = options.fontSize * 100;
600
+ if (options.bold !== void 0) a.b = options.bold;
601
+ if (options.italic !== void 0) a.i = options.italic;
602
+ if (options.underline) a.u = UnderlineStyle[options.underline];
603
+ if (options.lang) a.lang = options.lang;
604
+ if (options.strike) a.strike = StrikeStyle[options.strike];
605
+ if (options.baseline !== void 0) a.baseline = options.baseline;
606
+ if (options.capitalization) a.cap = TextCapitalization[options.capitalization] ?? options.capitalization;
607
+ if (options.spacing !== void 0) a.spc = options.spacing;
608
+ if (options.noProof !== void 0) a.noProof = options.noProof;
609
+ if (options.dirty !== void 0) a.dirty = options.dirty;
610
+ const attrStr = attrs(a);
611
+ const body = [];
612
+ if (options.font) body.push(`<a:latin${attrs({ typeface: options.font })}/><a:ea${attrs({ typeface: options.font })}/>`);
613
+ if (options.hyperlink && hyperlinkKey) {
614
+ const h = { "r:id": `{hlink:${hyperlinkKey}}` };
615
+ if (options.hyperlink.tooltip) h.tooltip = options.hyperlink.tooltip;
616
+ body.push(`<a:hlinkClick${attrs(h)}/>`);
617
+ }
618
+ if (options.rightToLeft !== void 0) body.push(`<a:rtl${attrs({ val: options.rightToLeft ? 1 : 0 })}/>`);
619
+ if (fillObject) body.push(xml(fillObject));
620
+ if (!attrStr && body.length === 0) return "";
621
+ if (body.length === 0) return `<a:rPr${attrStr}/>`;
622
+ return `<a:rPr${attrStr}>${body.join("")}</a:rPr>`;
623
+ }
539
624
  //#endregion
540
625
  //#region src/file/shape/paragraph/run.ts
541
626
  /**
@@ -557,6 +642,16 @@ var Run = class extends XmlComponent {
557
642
  if (this.options.text) children.push({ "a:t": [this.options.text] });
558
643
  return { "a:r": children.length === 0 ? {} : children.length === 1 && "_attr" in children[0] ? children[0] : children };
559
644
  }
645
+ toXml(context) {
646
+ let s = "<a:r>";
647
+ if (RunProperties.hasProperties(this.options)) {
648
+ const rp = new RunProperties(this.options);
649
+ s += rp.toXml(context);
650
+ }
651
+ if (this.options.text) s += `<a:t>${escapeXml(this.options.text)}</a:t>`;
652
+ s += "</a:r>";
653
+ return s;
654
+ }
560
655
  };
561
656
  //#endregion
562
657
  //#region src/file/shape/paragraph/paragraph.ts
@@ -581,6 +676,15 @@ var Paragraph = class extends XmlComponent {
581
676
  children.push(buildEndParagraphRunProperties());
582
677
  return { "a:p": children };
583
678
  }
679
+ toXml(context) {
680
+ let s = "<a:p>";
681
+ const pPr = buildParagraphPropertiesXml(this.options.properties ?? {});
682
+ if (pPr) s += pPr;
683
+ if (this.options.children) for (const child of this.options.children) s += child.toXml(context);
684
+ s += buildEndParagraphRunPropertiesXml();
685
+ s += "</a:p>";
686
+ return s;
687
+ }
584
688
  };
585
689
  //#endregion
586
690
  //#region src/file/table/table-cell-properties.ts
@@ -697,6 +801,25 @@ function buildBodyPr(options) {
697
801
  bodyPrContent.push(...bodyPrChildren);
698
802
  return { "a:bodyPr": bodyPrContent.length === 1 && "_attr" in bodyPrContent[0] ? bodyPrContent[0] : bodyPrContent.length > 0 ? bodyPrContent : {} };
699
803
  }
804
+ function buildBodyPrXml(options) {
805
+ let s = "<a:bodyPr";
806
+ const a = {};
807
+ if (options.vertical) a.vert = options.vertical;
808
+ if (options.anchor) a.anchor = VerticalAlignment[options.anchor];
809
+ if (options.wrap) a.wrap = options.wrap;
810
+ if (options.margins?.top !== void 0) a.tIns = options.margins.top;
811
+ if (options.margins?.bottom !== void 0) a.bIns = options.margins.bottom;
812
+ if (options.margins?.left !== void 0) a.lIns = options.margins.left;
813
+ if (options.margins?.right !== void 0) a.rIns = options.margins.right;
814
+ if (options.columns !== void 0) a.numCol = options.columns;
815
+ if (options.columnSpacing !== void 0) a.spcCol = options.columnSpacing * 100;
816
+ s += attrs(a);
817
+ let inner = "";
818
+ if (options.autoFit === "normal") inner += "<a:normAutofit/>";
819
+ else if (options.autoFit === "shape") inner += "<a:spAutoFit/>";
820
+ else if (options.autoFit === "none") inner += "<a:noAutofit/>";
821
+ return inner ? `${s}>${inner}</a:bodyPr>` : `${s}/>`;
822
+ }
700
823
  /**
701
824
  * p:txBody — Text body within a shape.
702
825
  * Lazy: stores options, builds XML object in prepForXml.
@@ -721,6 +844,18 @@ var TextBody = class extends XmlComponent {
721
844
  }
722
845
  return { "p:txBody": children };
723
846
  }
847
+ toXml(context) {
848
+ let s = "<p:txBody>";
849
+ s += buildBodyPrXml(this.options);
850
+ s += "<a:lstStyle/>";
851
+ if (this.options.paragraphs) for (const p of this.options.paragraphs) {
852
+ const para = typeof p === "string" ? new Paragraph({ children: [new Run({ text: p })] }) : p;
853
+ s += para.toXml(context);
854
+ }
855
+ else s += new Paragraph().toXml(context);
856
+ s += "</p:txBody>";
857
+ return s;
858
+ }
724
859
  };
725
860
  //#endregion
726
861
  //#region src/file/notes/notes-slide.ts
@@ -931,7 +1066,7 @@ var PresentationProperties = class PresentationProperties extends ImportedXmlCom
931
1066
  };
932
1067
  //#endregion
933
1068
  //#region src/file/presentation/presentation.ts
934
- const DEFAULT_TEXT_STYLE_OBJ = ImportedXmlComponent.fromXmlString(`<p:defaultTextStyle xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main">
1069
+ const DEFAULT_TEXT_STYLE_XML = `<p:defaultTextStyle xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main">
935
1070
  <a:defPPr><a:defRPr/></a:defPPr>
936
1071
  <a:lvl1pPr marL="0" algn="l" defTabSz="914400" rtl="0" eaLnBrk="1" latinLnBrk="0" hangingPunct="1">
937
1072
  <a:defRPr sz="1800" kern="1200"><a:solidFill><a:schemeClr val="tx1"/></a:solidFill><a:latin typeface="+mn-lt"/><a:ea typeface="+mn-ea"/><a:cs typeface="+mn-cs"/></a:defRPr>
@@ -960,7 +1095,8 @@ const DEFAULT_TEXT_STYLE_OBJ = ImportedXmlComponent.fromXmlString(`<p:defaultTex
960
1095
  <a:lvl9pPr marL="3657600" algn="l" defTabSz="914400" rtl="0" eaLnBrk="1" latinLnBrk="0" hangingPunct="1">
961
1096
  <a:defRPr sz="1800" kern="1200"><a:solidFill><a:schemeClr val="tx1"/></a:solidFill><a:latin typeface="+mn-lt"/><a:ea typeface="+mn-ea"/><a:cs typeface="+mn-cs"/></a:defRPr>
962
1097
  </a:lvl9pPr>
963
- </p:defaultTextStyle>`).prepForXml({ stack: [] });
1098
+ </p:defaultTextStyle>`;
1099
+ const DEFAULT_TEXT_STYLE_OBJ = ImportedXmlComponent.fromXmlString(DEFAULT_TEXT_STYLE_XML).prepForXml({ stack: [] });
964
1100
  /**
965
1101
  * p:presentation — Root element of a PPTX file.
966
1102
  * Lazy: stores options, builds XML object directly in prepForXml.
@@ -1002,6 +1138,22 @@ var Presentation = class extends BaseXmlComponent {
1002
1138
  children.push(DEFAULT_TEXT_STYLE_OBJ);
1003
1139
  return { "p:presentation": children };
1004
1140
  }
1141
+ toXml(_context) {
1142
+ const opts = this.options;
1143
+ const cx = opts.slideWidth ?? 9144e3;
1144
+ const cy = opts.slideHeight ?? 6858e3;
1145
+ const typeAttr = cx === 914400 && cy === 6858e3 ? " type=\"screen4x3\"" : "";
1146
+ let s = `<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">`;
1147
+ s += "<p:sldMasterIdLst><p:sldMasterId id=\"2147483648\" r:id=\"rId1\"/></p:sldMasterIdLst>";
1148
+ s += "<p:sldIdLst>";
1149
+ for (let i = 0; i < opts.slideIds.length; i++) s += `<p:sldId id="${opts.slideIds[i]}" r:id="rId${i + 2}"/>`;
1150
+ s += "</p:sldIdLst>";
1151
+ s += `<p:sldSz cx="${cx}" cy="${cy}"${typeAttr}/>`;
1152
+ s += "<p:notesSz cx=\"6858000\" cy=\"9144000\"/>";
1153
+ s += DEFAULT_TEXT_STYLE_XML;
1154
+ s += "</p:presentation>";
1155
+ return s;
1156
+ }
1005
1157
  };
1006
1158
  //#endregion
1007
1159
  //#region src/file/presentation/presentation-wrapper.ts
@@ -2238,6 +2390,49 @@ var Shape = class Shape extends XmlComponent {
2238
2390
  if (txBodyObj) children.push(txBodyObj);
2239
2391
  return { "p:sp": children };
2240
2392
  }
2393
+ toXml(context) {
2394
+ const opts = this.options;
2395
+ const id = this.shapeId;
2396
+ const name = escapeXml(opts.name ?? `Shape ${id}`);
2397
+ let s = "<p:sp><p:nvSpPr>";
2398
+ s += `<p:cNvPr${attrs({
2399
+ id,
2400
+ name
2401
+ })}/>`;
2402
+ s += "<p:cNvSpPr/>";
2403
+ if (opts.placeholder) {
2404
+ const phAttrs = { type: opts.placeholder };
2405
+ if (opts.placeholderIndex !== void 0) phAttrs.idx = opts.placeholderIndex;
2406
+ s += `<p:nvPr><p:ph${attrs(phAttrs)}/></p:nvPr>`;
2407
+ } else s += "<p:nvPr/>";
2408
+ s += "</p:nvSpPr>";
2409
+ const spPrObj = new ShapeProperties({
2410
+ x: opts.x !== void 0 ? pixelsToEmus(opts.x) : void 0,
2411
+ y: opts.y !== void 0 ? pixelsToEmus(opts.y) : void 0,
2412
+ width: opts.width !== void 0 ? pixelsToEmus(opts.width) : void 0,
2413
+ height: opts.height !== void 0 ? pixelsToEmus(opts.height) : void 0,
2414
+ geometry: opts.geometry,
2415
+ fill: opts.fill,
2416
+ outline: opts.outline,
2417
+ effects: opts.effects,
2418
+ flipH: opts.flipH,
2419
+ rotation: opts.rotation
2420
+ }).prepForXml(context);
2421
+ if (spPrObj) s += xml(spPrObj);
2422
+ const txBodyOpts = {
2423
+ paragraphs: opts.paragraphs ?? (opts.text ? [new Paragraph({ children: [new Run({ text: opts.text })] })] : void 0),
2424
+ vertical: opts.textVertical,
2425
+ anchor: opts.textAnchor,
2426
+ autoFit: opts.textAutoFit,
2427
+ wrap: opts.textWrap,
2428
+ margins: opts.textMargins,
2429
+ columns: opts.textColumns,
2430
+ columnSpacing: opts.textColumnSpacing
2431
+ };
2432
+ s += new TextBody(txBodyOpts).toXml(context);
2433
+ s += "</p:sp>";
2434
+ return s;
2435
+ }
2241
2436
  };
2242
2437
  //#endregion
2243
2438
  //#region src/file/transition/transition.ts
@@ -2289,47 +2484,10 @@ var Transition = class extends BaseXmlComponent {
2289
2484
  };
2290
2485
  //#endregion
2291
2486
  //#region src/file/slide/slide.ts
2292
- /**
2293
- * p:nvGrpSpPr singleton non-visual properties for shape tree.
2294
- */
2295
- const NV_GRP_SP_PR = { "p:nvGrpSpPr": [
2296
- { "p:cNvPr": { _attr: {
2297
- id: 1,
2298
- name: ""
2299
- } } },
2300
- { "p:cNvGrpSpPr": {} },
2301
- { "p:nvPr": {} }
2302
- ] };
2303
- /**
2304
- * p:grpSpPr singleton — group shape properties with default transform.
2305
- */
2306
- const GRP_SP_PR = { "p:grpSpPr": { "a:xfrm": [
2307
- { "a:off": { _attr: {
2308
- x: 0,
2309
- y: 0
2310
- } } },
2311
- { "a:ext": { _attr: {
2312
- cx: 0,
2313
- cy: 0
2314
- } } },
2315
- { "a:chOff": { _attr: {
2316
- x: 0,
2317
- y: 0
2318
- } } },
2319
- { "a:chExt": { _attr: {
2320
- cx: 0,
2321
- cy: 0
2322
- } } }
2323
- ] } };
2324
- /**
2325
- * p:clrMapOvr singleton — color map override.
2326
- */
2327
- const CLR_MAP_OVR = { "p:clrMapOvr": [{ "a:masterClrMapping": {} }] };
2328
- const XMLNS_ATTRS = { _attr: {
2329
- "xmlns:a": "http://schemas.openxmlformats.org/drawingml/2006/main",
2330
- "xmlns:r": "http://schemas.openxmlformats.org/officeDocument/2006/relationships",
2331
- "xmlns:p": "http://schemas.openxmlformats.org/presentationml/2006/main"
2332
- } };
2487
+ const NV_GRP_SP_PR = "<p:nvGrpSpPr><p:cNvPr id=\"1\" name=\"\"/><p:cNvGrpSpPr/><p:nvPr/></p:nvGrpSpPr>";
2488
+ const GRP_SP_PR = "<p:grpSpPr><a:xfrm><a:off x=\"0\" y=\"0\"/><a:ext cx=\"0\" cy=\"0\"/><a:chOff x=\"0\" y=\"0\"/><a:chExt cx=\"0\" cy=\"0\"/></a:xfrm></p:grpSpPr>";
2489
+ const CLR_MAP_OVR = "<p:clrMapOvr><a:masterClrMapping/></p:clrMapOvr>";
2490
+ const XMLNS = " 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\"";
2333
2491
  function collectAnimations(children) {
2334
2492
  const entries = [];
2335
2493
  for (const child of children) if (child instanceof Shape) {
@@ -2359,20 +2517,48 @@ var Slide = class extends BaseXmlComponent {
2359
2517
  }
2360
2518
  prepForXml(context) {
2361
2519
  const children = [];
2362
- children.push(XMLNS_ATTRS);
2520
+ children.push({ _attr: {
2521
+ "xmlns:a": "http://schemas.openxmlformats.org/drawingml/2006/main",
2522
+ "xmlns:r": "http://schemas.openxmlformats.org/officeDocument/2006/relationships",
2523
+ "xmlns:p": "http://schemas.openxmlformats.org/presentationml/2006/main"
2524
+ } });
2363
2525
  const cSldChildren = [];
2364
2526
  if (this.background) {
2365
2527
  const bgObj = this.background.prepForXml(context);
2366
2528
  if (bgObj) cSldChildren.push(bgObj);
2367
2529
  }
2368
- const spTreeChildren = [NV_GRP_SP_PR, GRP_SP_PR];
2530
+ const spTreeChildren = [{ "p:nvGrpSpPr": [
2531
+ { "p:cNvPr": { _attr: {
2532
+ id: 1,
2533
+ name: ""
2534
+ } } },
2535
+ { "p:cNvGrpSpPr": {} },
2536
+ { "p:nvPr": {} }
2537
+ ] }, { "p:grpSpPr": { "a:xfrm": [
2538
+ { "a:off": { _attr: {
2539
+ x: 0,
2540
+ y: 0
2541
+ } } },
2542
+ { "a:ext": { _attr: {
2543
+ cx: 0,
2544
+ cy: 0
2545
+ } } },
2546
+ { "a:chOff": { _attr: {
2547
+ x: 0,
2548
+ y: 0
2549
+ } } },
2550
+ { "a:chExt": { _attr: {
2551
+ cx: 0,
2552
+ cy: 0
2553
+ } } }
2554
+ ] } }];
2369
2555
  for (const child of this.children) {
2370
2556
  const obj = child.prepForXml(context);
2371
2557
  if (obj) spTreeChildren.push(obj);
2372
2558
  }
2373
2559
  cSldChildren.push({ "p:spTree": spTreeChildren });
2374
2560
  children.push({ "p:cSld": cSldChildren });
2375
- children.push(CLR_MAP_OVR);
2561
+ children.push({ "p:clrMapOvr": [{ "a:masterClrMapping": {} }] });
2376
2562
  if (this.transition) {
2377
2563
  const transObj = buildTransition(this.transition);
2378
2564
  if (transObj) children.push(transObj);
@@ -2384,6 +2570,35 @@ var Slide = class extends BaseXmlComponent {
2384
2570
  }
2385
2571
  return { "p:sld": children };
2386
2572
  }
2573
+ toXml(context) {
2574
+ let s = `<p:sld${XMLNS}>`;
2575
+ s += "<p:cSld>";
2576
+ if (this.background) {
2577
+ const bgObj = this.background.prepForXml(context);
2578
+ if (bgObj) s += xml(bgObj);
2579
+ }
2580
+ s += "<p:spTree>";
2581
+ s += NV_GRP_SP_PR;
2582
+ s += GRP_SP_PR;
2583
+ for (const child of this.children) if (typeof child.toXml === "function") s += child.toXml(context);
2584
+ else {
2585
+ const obj = child.prepForXml(context);
2586
+ if (obj) s += xml(obj);
2587
+ }
2588
+ s += "</p:spTree></p:cSld>";
2589
+ s += CLR_MAP_OVR;
2590
+ if (this.transition) {
2591
+ const transObj = buildTransition(this.transition);
2592
+ if (transObj) s += xml(transObj);
2593
+ }
2594
+ const animations = collectAnimations(this.children);
2595
+ if (animations.length > 0) {
2596
+ const timingObj = new SlideTiming(animations).prepForXml(context);
2597
+ if (timingObj) s += xml(timingObj);
2598
+ }
2599
+ s += "</p:sld>";
2600
+ return s;
2601
+ }
2387
2602
  };
2388
2603
  //#endregion
2389
2604
  //#region src/file/table-styles.ts
@@ -4412,38 +4627,23 @@ var Compiler = class {
4412
4627
  }
4413
4628
  };
4414
4629
  mapping["Theme"] = {
4415
- data: xml(this.formatter.format(file.Theme, context), {
4416
- declaration,
4417
- indent
4418
- }),
4630
+ data: this.formatter.formatToXml(file.Theme, context, declaration),
4419
4631
  path: "ppt/theme/theme1.xml"
4420
4632
  };
4421
4633
  mapping["TableStyles"] = {
4422
- data: xml(this.formatter.format(file.TableStyles, context), {
4423
- declaration,
4424
- indent
4425
- }),
4634
+ data: this.formatter.formatToXml(file.TableStyles, context, declaration),
4426
4635
  path: "ppt/tableStyles.xml"
4427
4636
  };
4428
4637
  mapping["PresProps"] = {
4429
- data: xml(this.formatter.format(file.PresProps, context), {
4430
- declaration,
4431
- indent
4432
- }),
4638
+ data: this.formatter.formatToXml(file.PresProps, context, declaration),
4433
4639
  path: "ppt/presProps.xml"
4434
4640
  };
4435
4641
  mapping["ViewProps"] = {
4436
- data: xml(this.formatter.format(file.ViewProps, context), {
4437
- declaration,
4438
- indent
4439
- }),
4642
+ data: this.formatter.formatToXml(file.ViewProps, context, declaration),
4440
4643
  path: "ppt/viewProps.xml"
4441
4644
  };
4442
4645
  mapping["SlideMaster"] = {
4443
- data: xml(this.formatter.format(file.SlideMaster, context), {
4444
- declaration,
4445
- indent
4446
- }),
4646
+ data: this.formatter.formatToXml(file.SlideMaster, context, declaration),
4447
4647
  path: "ppt/slideMasters/slideMaster1.xml"
4448
4648
  };
4449
4649
  mapping["SlideMasterRelationships"] = {
@@ -4451,10 +4651,7 @@ var Compiler = class {
4451
4651
  path: "ppt/slideMasters/_rels/slideMaster1.xml.rels"
4452
4652
  };
4453
4653
  mapping["SlideLayout"] = {
4454
- data: xml(this.formatter.format(file.SlideLayout, context), {
4455
- declaration,
4456
- indent
4457
- }),
4654
+ data: this.formatter.formatToXml(file.SlideLayout, context, declaration),
4458
4655
  path: "ppt/slideLayouts/slideLayout1.xml"
4459
4656
  };
4460
4657
  mapping["SlideLayoutRelationships"] = {
@@ -4475,10 +4672,7 @@ var Compiler = class {
4475
4672
  path: "ppt/notesMasters/_rels/notesMaster1.xml.rels"
4476
4673
  };
4477
4674
  }
4478
- const presentationXml = xml(this.formatter.format(file.PresentationWrapper.View, context), {
4479
- declaration,
4480
- indent
4481
- });
4675
+ const presentationXml = this.formatter.formatToXml(file.PresentationWrapper.View, context, declaration);
4482
4676
  let currentImageCount = 0;
4483
4677
  const mediaData = this.imageReplacer.getMediaData(presentationXml, file.Media);
4484
4678
  const presImageOffset = file.PresentationWrapper.Relationships.RelationshipCount + 1;
@@ -4497,10 +4691,7 @@ var Compiler = class {
4497
4691
  };
4498
4692
  for (let i = 0; i < file.Slides.length; i++) {
4499
4693
  const slideWrapper = file.SlideWrappers[i];
4500
- const slideXml = xml(this.formatter.format(slideWrapper.View, context), {
4501
- declaration,
4502
- indent
4503
- });
4694
+ const slideXml = this.formatter.formatToXml(slideWrapper.View, context, declaration);
4504
4695
  const slideMediaData = this.imageReplacer.getMediaData(slideXml, file.Media);
4505
4696
  const slideImageOffset = slideWrapper.Relationships.RelationshipCount + 1;
4506
4697
  slideMediaData.forEach((image, idx) => {
@@ -4508,58 +4699,50 @@ var Compiler = class {
4508
4699
  });
4509
4700
  let replacedSlideXml = this.imageReplacer.replace(slideXml, slideMediaData, slideImageOffset);
4510
4701
  currentImageCount += slideMediaData.length;
4511
- const chartPlaceholderRegex = /\{chart:([^}]+)\}/g;
4512
- const slideChartKeys = [];
4513
- let match;
4514
- const slideXmlForCharts = replacedSlideXml;
4515
- while ((match = chartPlaceholderRegex.exec(slideXmlForCharts)) !== null) if (!slideChartKeys.includes(match[1])) slideChartKeys.push(match[1]);
4516
- if (slideChartKeys.length > 0) {
4517
- const slideChartOffset = slideWrapper.Relationships.RelationshipCount + 1;
4518
- const slideCharts = file.Charts.Array.filter((c) => slideChartKeys.includes(c.key));
4519
- replacedSlideXml = this.chartReplacer.replace(replacedSlideXml, { Array: slideCharts }, slideChartOffset);
4520
- slideCharts.forEach((chartData, ci) => {
4521
- const globalIndex = file.Charts.Array.indexOf(chartData);
4522
- slideWrapper.Relationships.addRelationship(slideChartOffset + ci, "http://schemas.openxmlformats.org/officeDocument/2006/relationships/chart", `../charts/chart${globalIndex + 1}.xml`);
4523
- });
4524
- }
4525
- const slideSmartArtKeys = [];
4526
- const smartArtRegex = /\{smartart:([^}]+)\}/g;
4527
- let saMatch;
4528
- while ((saMatch = smartArtRegex.exec(replacedSlideXml)) !== null) if (!slideSmartArtKeys.includes(saMatch[1])) slideSmartArtKeys.push(saMatch[1]);
4529
- if (slideSmartArtKeys.length > 0) {
4530
- const slideSmartArts = file.SmartArts.Array.filter((s) => slideSmartArtKeys.includes(s.key));
4531
- const saOffset = slideWrapper.Relationships.RelationshipCount + 1;
4532
- replacedSlideXml = this.smartArtReplacer.replace(replacedSlideXml, { Array: slideSmartArts }, saOffset);
4533
- const saGlobalStart = file.SmartArts.Array.indexOf(slideSmartArts[0]);
4534
- this.smartArtReplacer.addRelationships({ Array: slideSmartArts }, (id, type, target) => {
4535
- slideWrapper.Relationships.addRelationship(id, type, target);
4536
- }, saOffset, saGlobalStart);
4537
- }
4538
- const hlinkPlaceholderRegex = /\{hlink:([^}]+)\}/g;
4539
- const slideHlinkKeys = [];
4540
- let hlinkMatch;
4541
- while ((hlinkMatch = hlinkPlaceholderRegex.exec(replacedSlideXml)) !== null) if (!slideHlinkKeys.includes(hlinkMatch[1])) slideHlinkKeys.push(hlinkMatch[1]);
4542
- if (slideHlinkKeys.length > 0) {
4543
- const slideHlinks = file.Hyperlinks.Array.filter((h) => slideHlinkKeys.includes(h.key));
4544
- const hlinkOffset = slideWrapper.Relationships.RelationshipCount + 1;
4545
- replacedSlideXml = this.hyperlinkReplacer.replace(replacedSlideXml, slideHlinks, hlinkOffset);
4546
- slideHlinks.forEach((hlink, hi) => {
4547
- slideWrapper.Relationships.addRelationship(hlinkOffset + hi, "http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink", hlink.url, "External");
4548
- });
4549
- }
4550
- const slideMediaRefs = this.mediaReplacer.getMediaRefs(replacedSlideXml, file.Media);
4551
- const slideVideoRefs = this.mediaReplacer.getVideoRefs(replacedSlideXml, file.Media);
4552
- if ([...slideMediaRefs, ...slideVideoRefs].length > 0) {
4553
- const mediaOffset = slideWrapper.Relationships.RelationshipCount + 1;
4554
- const videoOffset = mediaOffset + slideMediaRefs.length;
4555
- replacedSlideXml = this.mediaReplacer.replaceMedia(replacedSlideXml, slideMediaRefs, mediaOffset);
4556
- replacedSlideXml = this.mediaReplacer.replaceVideo(replacedSlideXml, slideVideoRefs, videoOffset);
4557
- slideMediaRefs.forEach((media, mi) => {
4558
- slideWrapper.Relationships.addRelationship(mediaOffset + mi, "http://schemas.microsoft.com/office/2007/relationships/media", `../media/${media.fileName}`);
4559
- });
4560
- slideVideoRefs.forEach((video, vi) => {
4561
- slideWrapper.Relationships.addRelationship(videoOffset + vi, "http://schemas.openxmlformats.org/officeDocument/2006/relationships/video", `../media/${video.fileName}`);
4562
- });
4702
+ if (hasPlaceholders(replacedSlideXml)) {
4703
+ const slideChartKeys = collectPlaceholderKeys(replacedSlideXml, "chart:");
4704
+ if (slideChartKeys.length > 0) {
4705
+ const slideChartOffset = slideWrapper.Relationships.RelationshipCount + 1;
4706
+ const slideCharts = file.Charts.Array.filter((c) => slideChartKeys.includes(c.key));
4707
+ replacedSlideXml = this.chartReplacer.replace(replacedSlideXml, { Array: slideCharts }, slideChartOffset);
4708
+ slideCharts.forEach((chartData, ci) => {
4709
+ const globalIndex = file.Charts.Array.indexOf(chartData);
4710
+ slideWrapper.Relationships.addRelationship(slideChartOffset + ci, "http://schemas.openxmlformats.org/officeDocument/2006/relationships/chart", `../charts/chart${globalIndex + 1}.xml`);
4711
+ });
4712
+ }
4713
+ const slideSmartArtKeys = collectPlaceholderKeys(replacedSlideXml, "smartart:");
4714
+ if (slideSmartArtKeys.length > 0) {
4715
+ const slideSmartArts = file.SmartArts.Array.filter((s) => slideSmartArtKeys.includes(s.key));
4716
+ const saOffset = slideWrapper.Relationships.RelationshipCount + 1;
4717
+ replacedSlideXml = this.smartArtReplacer.replace(replacedSlideXml, { Array: slideSmartArts }, saOffset);
4718
+ const saGlobalStart = file.SmartArts.Array.indexOf(slideSmartArts[0]);
4719
+ this.smartArtReplacer.addRelationships({ Array: slideSmartArts }, (id, type, target) => {
4720
+ slideWrapper.Relationships.addRelationship(id, type, target);
4721
+ }, saOffset, saGlobalStart);
4722
+ }
4723
+ const slideHlinkKeys = collectPlaceholderKeys(replacedSlideXml, "hlink:");
4724
+ if (slideHlinkKeys.length > 0) {
4725
+ const slideHlinks = file.Hyperlinks.Array.filter((h) => slideHlinkKeys.includes(h.key));
4726
+ const hlinkOffset = slideWrapper.Relationships.RelationshipCount + 1;
4727
+ replacedSlideXml = this.hyperlinkReplacer.replace(replacedSlideXml, slideHlinks, hlinkOffset);
4728
+ slideHlinks.forEach((hlink, hi) => {
4729
+ slideWrapper.Relationships.addRelationship(hlinkOffset + hi, "http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink", hlink.url, "External");
4730
+ });
4731
+ }
4732
+ const slideMediaRefs = this.mediaReplacer.getMediaRefs(replacedSlideXml, file.Media);
4733
+ const slideVideoRefs = this.mediaReplacer.getVideoRefs(replacedSlideXml, file.Media);
4734
+ if (slideMediaRefs.length > 0 || slideVideoRefs.length > 0) {
4735
+ const mediaOffset = slideWrapper.Relationships.RelationshipCount + 1;
4736
+ const videoOffset = mediaOffset + slideMediaRefs.length;
4737
+ replacedSlideXml = this.mediaReplacer.replaceMedia(replacedSlideXml, slideMediaRefs, mediaOffset);
4738
+ replacedSlideXml = this.mediaReplacer.replaceVideo(replacedSlideXml, slideVideoRefs, videoOffset);
4739
+ slideMediaRefs.forEach((media, mi) => {
4740
+ slideWrapper.Relationships.addRelationship(mediaOffset + mi, "http://schemas.microsoft.com/office/2007/relationships/media", `../media/${media.fileName}`);
4741
+ });
4742
+ slideVideoRefs.forEach((video, vi) => {
4743
+ slideWrapper.Relationships.addRelationship(videoOffset + vi, "http://schemas.openxmlformats.org/officeDocument/2006/relationships/video", `../media/${video.fileName}`);
4744
+ });
4745
+ }
4563
4746
  }
4564
4747
  mapping[`Slide${i}`] = {
4565
4748
  data: replacedSlideXml,
@@ -4587,41 +4770,41 @@ var Compiler = class {
4587
4770
  const files = {};
4588
4771
  for (const key of Object.keys(mapping)) {
4589
4772
  const entry = mapping[key];
4590
- files[entry.path] = textToUint8Array(entry.data);
4773
+ files[entry.path] = [textToUint8Array(entry.data), { level: 0 }];
4591
4774
  }
4592
4775
  for (const override of overrides) files[override.path] = override.data instanceof Uint8Array ? override.data : textToUint8Array(override.data);
4593
4776
  for (let i = 0; i < file.Charts.Array.length; i++) {
4594
4777
  const chartData = file.Charts.Array[i];
4595
- files[`ppt/charts/chart${i + 1}.xml`] = textToUint8Array(xml(this.formatter.format(chartData.chartSpace, context), {
4778
+ files[`ppt/charts/chart${i + 1}.xml`] = [textToUint8Array(xml(this.formatter.format(chartData.chartSpace, context), {
4596
4779
  declaration,
4597
4780
  indent
4598
- }));
4599
- files[`ppt/charts/_rels/chart${i + 1}.xml.rels`] = textToUint8Array(xml({ Relationships: { _attr: { xmlns: "http://schemas.openxmlformats.org/package/2006/relationships" } } }, { declaration: {
4781
+ })), { level: 0 }];
4782
+ files[`ppt/charts/_rels/chart${i + 1}.xml.rels`] = [textToUint8Array(xml({ Relationships: { _attr: { xmlns: "http://schemas.openxmlformats.org/package/2006/relationships" } } }, { declaration: {
4600
4783
  encoding: "UTF-8",
4601
4784
  standalone: "yes"
4602
- } }));
4785
+ } })), { level: 0 }];
4603
4786
  }
4604
4787
  for (let i = 0; i < file.SmartArts.Array.length; i++) {
4605
4788
  const smartArtData = file.SmartArts.Array[i];
4606
- files[`ppt/diagrams/data${i + 1}.xml`] = textToUint8Array(xml(this.formatter.format(smartArtData.dataModel, context), {
4789
+ files[`ppt/diagrams/data${i + 1}.xml`] = [textToUint8Array(xml(this.formatter.format(smartArtData.dataModel, context), {
4607
4790
  declaration,
4608
4791
  indent
4609
- }));
4610
- files[`ppt/diagrams/layout${i + 1}.xml`] = textToUint8Array(getLayoutXml(smartArtData.layout));
4611
- files[`ppt/diagrams/quickStyle${i + 1}.xml`] = textToUint8Array(getStyleXml(smartArtData.style));
4612
- files[`ppt/diagrams/colors${i + 1}.xml`] = textToUint8Array(getColorXml(smartArtData.color));
4613
- files[`ppt/diagrams/drawing${i + 1}.xml`] = textToUint8Array(DEFAULT_DRAWING_XML);
4792
+ })), { level: 0 }];
4793
+ files[`ppt/diagrams/layout${i + 1}.xml`] = [textToUint8Array(getLayoutXml(smartArtData.layout)), { level: 0 }];
4794
+ files[`ppt/diagrams/quickStyle${i + 1}.xml`] = [textToUint8Array(getStyleXml(smartArtData.style)), { level: 0 }];
4795
+ files[`ppt/diagrams/colors${i + 1}.xml`] = [textToUint8Array(getColorXml(smartArtData.color)), { level: 0 }];
4796
+ files[`ppt/diagrams/drawing${i + 1}.xml`] = [textToUint8Array(DEFAULT_DRAWING_XML), { level: 0 }];
4614
4797
  }
4615
4798
  for (let i = 0; i < file.NotesSlides.length; i++) {
4616
4799
  const notesSlide = file.NotesSlides[i];
4617
- files[`ppt/notesSlides/notesSlide${i + 1}.xml`] = textToUint8Array(xml(this.formatter.format(notesSlide, context), {
4800
+ files[`ppt/notesSlides/notesSlide${i + 1}.xml`] = [textToUint8Array(xml(this.formatter.format(notesSlide, context), {
4618
4801
  declaration,
4619
4802
  indent
4620
- }));
4621
- files[`ppt/notesSlides/_rels/notesSlide${i + 1}.xml.rels`] = textToUint8Array(xml({ Relationships: { _attr: { xmlns: "http://schemas.openxmlformats.org/package/2006/relationships" } } }, { declaration: {
4803
+ })), { level: 0 }];
4804
+ files[`ppt/notesSlides/_rels/notesSlide${i + 1}.xml.rels`] = [textToUint8Array(xml({ Relationships: { _attr: { xmlns: "http://schemas.openxmlformats.org/package/2006/relationships" } } }, { declaration: {
4622
4805
  encoding: "UTF-8",
4623
4806
  standalone: "yes"
4624
- } }));
4807
+ } })), { level: 0 }];
4625
4808
  }
4626
4809
  for (const image of file.Media.Array) {
4627
4810
  files[`ppt/media/${image.fileName}`] = [image.data, { level: 0 }];
@@ -4749,7 +4932,10 @@ function resolveSlideMediaPath(relsTarget) {
4749
4932
  if (relsTarget.startsWith("../")) return `ppt/${relsTarget.replace("../", "")}`;
4750
4933
  return `ppt/${relsTarget}`;
4751
4934
  }
4935
+ const relsCache = /* @__PURE__ */ new Map();
4752
4936
  function getSlideRels(ctx, slidePath) {
4937
+ const cached = relsCache.get(slidePath);
4938
+ if (cached) return cached;
4753
4939
  const relsMap = /* @__PURE__ */ new Map();
4754
4940
  const relsPath = slidePath.replace("ppt/slides/", "ppt/slides/_rels/") + ".rels";
4755
4941
  const rels = parseRels(ctx.zip, relsPath);
@@ -4757,6 +4943,7 @@ function getSlideRels(ctx, slidePath) {
4757
4943
  target: rel.target,
4758
4944
  type: rel.type
4759
4945
  });
4946
+ relsCache.set(slidePath, relsMap);
4760
4947
  return relsMap;
4761
4948
  }
4762
4949
  //#endregion
@@ -4814,16 +5001,72 @@ function parseFill(spPr) {
4814
5001
  color
4815
5002
  });
4816
5003
  }
4817
- const angle = attrNum(gradFill, "lin") ? attrNum(findChild(gradFill, "a:lin"), "ang") : void 0;
4818
- return {
5004
+ const result = {
4819
5005
  type: "gradient",
4820
- stops,
4821
- ...angle !== void 0 && { angle }
5006
+ stops
4822
5007
  };
5008
+ const lin = findChild(gradFill, "a:lin");
5009
+ if (lin) {
5010
+ const angle = attrNum(lin, "ang");
5011
+ const scaled = attr(lin, "scaled");
5012
+ if (angle !== void 0) result.angle = angle;
5013
+ if (scaled !== void 0) result.scaled = scaled === "1";
5014
+ }
5015
+ const path = findChild(gradFill, "a:path");
5016
+ if (path) {
5017
+ result.path = attr(path, "path") ?? "circle";
5018
+ const fillToRect = findChild(path, "a:fillToRect");
5019
+ if (fillToRect) result.fillToRect = {
5020
+ l: attr(fillToRect, "l"),
5021
+ t: attr(fillToRect, "t"),
5022
+ r: attr(fillToRect, "r"),
5023
+ b: attr(fillToRect, "b")
5024
+ };
5025
+ }
5026
+ return result;
4823
5027
  }
4824
5028
  if (findChild(spPr, "a:noFill")) return { type: "none" };
4825
- if (findChild(spPr, "a:pattFill")) return { type: "pattern" };
4826
- if (findChild(spPr, "a:blipFill")) return { type: "blip" };
5029
+ const pattFill = findChild(spPr, "a:pattFill");
5030
+ if (pattFill) {
5031
+ const prst = attr(pattFill, "prst");
5032
+ const fgClr = findChild(pattFill, "a:fgClr");
5033
+ const bgClr = findChild(pattFill, "a:bgClr");
5034
+ const fg = fgClr ? findChild(fgClr, "a:srgbClr") ? attr(findChild(fgClr, "a:srgbClr"), "val") : findChild(fgClr, "a:schemeClr") ? attr(findChild(fgClr, "a:schemeClr"), "val") : void 0 : void 0;
5035
+ const bg = bgClr ? findChild(bgClr, "a:srgbClr") ? attr(findChild(bgClr, "a:srgbClr"), "val") : findChild(bgClr, "a:schemeClr") ? attr(findChild(bgClr, "a:schemeClr"), "val") : void 0 : void 0;
5036
+ return {
5037
+ type: "pattern",
5038
+ pattern: prst,
5039
+ ...fg && { fg },
5040
+ ...bg && { bg }
5041
+ };
5042
+ }
5043
+ const blipFill = findChild(spPr, "a:blipFill");
5044
+ if (blipFill) {
5045
+ const result = { type: "blip" };
5046
+ const blip = findChild(blipFill, "a:blip");
5047
+ if (blip) {
5048
+ const embed = attr(blip, "r:embed");
5049
+ const link = attr(blip, "r:link");
5050
+ if (embed) result.embed = embed;
5051
+ if (link) result.link = link;
5052
+ }
5053
+ const stretch = findChild(blipFill, "a:stretch");
5054
+ if (stretch) {
5055
+ result.stretch = true;
5056
+ const fillRect = findChild(stretch, "a:fillRect");
5057
+ if (fillRect) result.fillRect = {
5058
+ l: attr(fillRect, "l"),
5059
+ t: attr(fillRect, "t"),
5060
+ r: attr(fillRect, "r"),
5061
+ b: attr(fillRect, "b")
5062
+ };
5063
+ }
5064
+ if (findChild(blipFill, "a:tile")) {
5065
+ delete result.stretch;
5066
+ result.tile = true;
5067
+ }
5068
+ return result;
5069
+ }
4827
5070
  }
4828
5071
  function parseOutline(spPr) {
4829
5072
  const ln = findChild(spPr, "a:ln");
@@ -4851,6 +5094,33 @@ function parseOutline(spPr) {
4851
5094
  }
4852
5095
  if (findChild(ln, "a:round")) result.round = true;
4853
5096
  if (findChild(ln, "a:bevel")) result.bevel = true;
5097
+ const headEnd = findChild(ln, "a:headEnd");
5098
+ if (headEnd) {
5099
+ const he = {};
5100
+ const type = attr(headEnd, "type");
5101
+ const w = attrNum(headEnd, "w");
5102
+ const len = attrNum(headEnd, "len");
5103
+ if (type) he.type = type;
5104
+ if (w !== void 0) he.width = w;
5105
+ if (len !== void 0) he.length = len;
5106
+ if (Object.keys(he).length > 0) result.headEnd = he;
5107
+ }
5108
+ const tailEnd = findChild(ln, "a:tailEnd");
5109
+ if (tailEnd) {
5110
+ const te = {};
5111
+ const type = attr(tailEnd, "type");
5112
+ const w = attrNum(tailEnd, "w");
5113
+ const len = attrNum(tailEnd, "len");
5114
+ if (type) te.type = type;
5115
+ if (w !== void 0) te.width = w;
5116
+ if (len !== void 0) te.length = len;
5117
+ if (Object.keys(te).length > 0) result.tailEnd = te;
5118
+ }
5119
+ const join = findChild(ln, "a:join");
5120
+ if (join) {
5121
+ const type = attr(join, "type");
5122
+ if (type) result.join = type;
5123
+ }
4854
5124
  if (findChild(ln, "a:noFill")) result.width = 0;
4855
5125
  return Object.keys(result).length > 0 ? result : void 0;
4856
5126
  }
@@ -4878,13 +5148,55 @@ function parseEffects(spPr) {
4878
5148
  }
4879
5149
  result.outerShadow = shadow;
4880
5150
  }
4881
- if (findChild(effectLst, "a:innerShdw")) result.innerShadow = {};
5151
+ const innerShdw = findChild(effectLst, "a:innerShdw");
5152
+ if (innerShdw) {
5153
+ const shadow = {};
5154
+ const blurRad = attrNum(innerShdw, "blurRad");
5155
+ const dist = attrNum(innerShdw, "dist");
5156
+ const dir = attrNum(innerShdw, "dir");
5157
+ const rotWithShape = attr(innerShdw, "rotWithShape");
5158
+ if (blurRad !== void 0) shadow.blurRadius = blurRad;
5159
+ if (dist !== void 0) shadow.distance = dist;
5160
+ if (dir !== void 0) shadow.direction = dir;
5161
+ if (rotWithShape !== void 0) shadow.rotateWithShape = rotWithShape === "1";
5162
+ const solidFill = findChild(innerShdw, "a:solidFill");
5163
+ if (solidFill) {
5164
+ const srgbClr = findChild(solidFill, "a:srgbClr");
5165
+ if (srgbClr) shadow.color = attr(srgbClr, "val");
5166
+ }
5167
+ result.innerShadow = shadow;
5168
+ }
4882
5169
  const glow = findChild(effectLst, "a:glow");
4883
5170
  if (glow) {
4884
5171
  const radius = attrNum(glow, "rad");
4885
- if (radius !== void 0) result.glow = { radius };
5172
+ const glowObj = {};
5173
+ if (radius !== void 0) glowObj.radius = radius;
5174
+ const solidFill = findChild(glow, "a:solidFill");
5175
+ if (solidFill) {
5176
+ const srgbClr = findChild(solidFill, "a:srgbClr");
5177
+ if (srgbClr) glowObj.color = attr(srgbClr, "val");
5178
+ }
5179
+ if (Object.keys(glowObj).length > 0) result.glow = glowObj;
5180
+ }
5181
+ const reflection = findChild(effectLst, "a:reflection");
5182
+ if (reflection) {
5183
+ const refObj = {};
5184
+ const blurRad = attrNum(reflection, "blurRad");
5185
+ const dist = attrNum(reflection, "dist");
5186
+ const dir = attrNum(reflection, "dir");
5187
+ const fadeDir = attrNum(reflection, "fadeDir");
5188
+ const stA = attrNum(reflection, "stA");
5189
+ const stB = attrNum(reflection, "stB");
5190
+ const rotWithShape = attr(reflection, "rotWithShape");
5191
+ if (blurRad !== void 0) refObj.blurRadius = blurRad;
5192
+ if (dist !== void 0) refObj.distance = dist;
5193
+ if (dir !== void 0) refObj.direction = dir;
5194
+ if (fadeDir !== void 0) refObj.fadeDirection = fadeDir;
5195
+ if (stA !== void 0) refObj.startAlpha = stA;
5196
+ if (stB !== void 0) refObj.endAlpha = stB;
5197
+ if (rotWithShape !== void 0) refObj.rotateWithShape = rotWithShape === "1";
5198
+ if (Object.keys(refObj).length > 0) result.reflection = refObj;
4886
5199
  }
4887
- if (findChild(effectLst, "a:reflection")) result.reflection = {};
4888
5200
  return Object.keys(result).length > 0 ? result : void 0;
4889
5201
  }
4890
5202
  //#endregion
@@ -5209,6 +5521,23 @@ function parsePptxTable(graphicFrame, ctx) {
5209
5521
  }
5210
5522
  const tbl = findDeep(graphicFrame, "a:tbl")[0];
5211
5523
  if (!tbl) return void 0;
5524
+ const tblPr = findChild(tbl, "a:tblPr");
5525
+ if (tblPr) {
5526
+ const bandRow = attr(tblPr, "bandRow");
5527
+ const bandCol = attr(tblPr, "bandCol");
5528
+ const firstRow = attr(tblPr, "firstRow");
5529
+ const firstCol = attr(tblPr, "firstCol");
5530
+ const lastRow = attr(tblPr, "lastRow");
5531
+ const lastCol = attr(tblPr, "lastCol");
5532
+ if (bandRow || bandCol || firstRow || firstCol || lastRow || lastCol) result.tableStyle = {
5533
+ ...bandRow === "1" && { bandRow: true },
5534
+ ...bandCol === "1" && { bandCol: true },
5535
+ ...firstRow === "1" && { firstRow: true },
5536
+ ...firstCol === "1" && { firstCol: true },
5537
+ ...lastRow === "1" && { lastRow: true },
5538
+ ...lastCol === "1" && { lastCol: true }
5539
+ };
5540
+ }
5212
5541
  for (const tr of tbl.elements ?? []) {
5213
5542
  if (tr.name !== "a:tr") continue;
5214
5543
  const row = { cells: [] };
@@ -5250,6 +5579,32 @@ function parsePptxTable(graphicFrame, ctx) {
5250
5579
  }
5251
5580
  const tcW = attrNum(tcPr, "w");
5252
5581
  if (tcW !== void 0) cell.width = tcW;
5582
+ const tcBorders = findChild(tcPr, "a:tcBorders");
5583
+ if (tcBorders) {
5584
+ const borders = {};
5585
+ for (const border of tcBorders.elements ?? []) if (border.name?.startsWith("a:")) {
5586
+ const borderName = border.name.replace("a:", "");
5587
+ const w = attrNum(border, "w");
5588
+ if (w !== void 0) {
5589
+ const borderDef = { width: w };
5590
+ const solidFill = findChild(border, "a:solidFill");
5591
+ if (solidFill) {
5592
+ const srgbClr = findChild(solidFill, "a:srgbClr");
5593
+ if (srgbClr) {
5594
+ const color = attr(srgbClr, "val");
5595
+ if (color) borderDef.color = color;
5596
+ }
5597
+ }
5598
+ const prstDash = findChild(border, "a:prstDash");
5599
+ if (prstDash) {
5600
+ const dashVal = attr(prstDash, "val");
5601
+ if (dashVal) borderDef.dashStyle = dashVal;
5602
+ }
5603
+ borders[borderName] = borderDef;
5604
+ }
5605
+ }
5606
+ if (Object.keys(borders).length > 0) cell.borders = borders;
5607
+ }
5253
5608
  }
5254
5609
  const txBody = findChild(tc, "a:txBody");
5255
5610
  if (txBody) {
@@ -5273,11 +5628,25 @@ function parseSlide(slideXml, ctx, slidePath) {
5273
5628
  if (bg) result.background = parseSlideBackground(bg);
5274
5629
  const spTree = findChild(cSld, "p:spTree");
5275
5630
  if (spTree) for (const child of spTree.elements ?? []) {
5631
+ if (child.name === "p:nvGrpSpPr" || child.name === "p:grpSpPr") continue;
5276
5632
  const parsed = parseShapeTreeElement(child, ctx, slideRels);
5277
5633
  if (parsed) result.children.push(parsed);
5278
5634
  }
5279
5635
  const transition = findChild(slideXml, "p:transition");
5280
5636
  if (transition) result.transition = parseTransition(transition);
5637
+ let notesTarget;
5638
+ for (const [, rel] of slideRels) if (rel.type.includes("notesSlide")) {
5639
+ notesTarget = rel.target;
5640
+ break;
5641
+ }
5642
+ if (notesTarget) {
5643
+ const notesPath = notesTarget.startsWith("../") ? notesTarget.replace("../", "ppt/") : `ppt/${notesTarget}`;
5644
+ const notesXml = readXmlFromZip(ctx.zip, notesPath);
5645
+ if (notesXml) {
5646
+ const notesContent = parseSlideNotes(notesXml, ctx);
5647
+ if (notesContent) result.notes = notesContent;
5648
+ }
5649
+ }
5281
5650
  return result;
5282
5651
  }
5283
5652
  function parseShapeTreeElement(el, ctx, slideRels) {
@@ -5285,9 +5654,78 @@ function parseShapeTreeElement(el, ctx, slideRels) {
5285
5654
  case "p:sp": return parseShape(el, ctx, slideRels);
5286
5655
  case "p:pic": return parsePicture(el, ctx, slideRels);
5287
5656
  case "p:cxnSp": return parseConnector(el, ctx);
5288
- case "p:graphicFrame": return parsePptxTable(el, ctx);
5289
- case "p:grpSp": return;
5290
- default: return;
5657
+ case "p:graphicFrame": return parsePptxTable(el, ctx) ?? {
5658
+ $raw: true,
5659
+ element: el
5660
+ };
5661
+ case "p:grpSp": return parseGroupShape(el, ctx, slideRels);
5662
+ default: return {
5663
+ $raw: true,
5664
+ element: el
5665
+ };
5666
+ }
5667
+ }
5668
+ /** Recursively parse group shapes */
5669
+ function parseGroupShape(grpSp, ctx, slideRels) {
5670
+ const result = { $type: "groupShape" };
5671
+ const nvSpPr = findChild(grpSp, "p:nvGrpSpPr");
5672
+ const cNvPr = findChild(nvSpPr, "p:cNvPr") ?? findChild(nvSpPr, "p:nvPr");
5673
+ if (cNvPr) {
5674
+ const id = attrNum(cNvPr, "id");
5675
+ const name = attr(cNvPr, "name");
5676
+ if (id !== void 0) result.id = id;
5677
+ if (name) result.name = name;
5678
+ }
5679
+ const grpSpPr = findChild(grpSp, "p:grpSpPr");
5680
+ if (grpSpPr) {
5681
+ const xfrm = findChild(grpSpPr, "a:xfrm");
5682
+ if (xfrm) {
5683
+ const off = findChild(xfrm, "a:off");
5684
+ const ext = findChild(xfrm, "a:ext");
5685
+ if (off) {
5686
+ result.x = attrNum(off, "x");
5687
+ result.y = attrNum(off, "y");
5688
+ }
5689
+ if (ext) {
5690
+ result.width = attrNum(ext, "cx");
5691
+ result.height = attrNum(ext, "cy");
5692
+ }
5693
+ const rot = attrNum(xfrm, "rot");
5694
+ if (rot !== void 0 && rot !== 0) result.rotation = rot / 6e4;
5695
+ const flipH = attr(xfrm, "flipH");
5696
+ const flipV = attr(xfrm, "flipV");
5697
+ if (flipH === "1") result.flipH = true;
5698
+ if (flipV === "1") result.flipV = true;
5699
+ }
5700
+ }
5701
+ const childSource = findChild(grpSp, "p:spTree") ?? grpSp;
5702
+ const children = [];
5703
+ for (const child of childSource.elements ?? []) {
5704
+ if (child.name === "p:nvGrpSpPr" || child.name === "p:grpSpPr") continue;
5705
+ const parsed = parseShapeTreeElement(child, ctx, slideRels);
5706
+ if (parsed) children.push(parsed);
5707
+ }
5708
+ if (children.length > 0) result.children = children;
5709
+ return result;
5710
+ }
5711
+ /** Parse slide notes content */
5712
+ function parseSlideNotes(notesXml, ctx) {
5713
+ const cSld = findChild(notesXml, "p:cSld");
5714
+ if (!cSld) return void 0;
5715
+ const spTree = findChild(cSld, "p:spTree");
5716
+ if (!spTree) return void 0;
5717
+ for (const child of spTree.elements ?? []) if (child.name === "p:sp") {
5718
+ const nvPr = findChild(findChild(child, "p:nvSpPr"), "p:nvPr");
5719
+ if (nvPr) {
5720
+ const ph = findChild(nvPr, "p:ph");
5721
+ if (ph && (attr(ph, "type") === "body" || attr(ph, "type") === void 0)) {
5722
+ const txBody = findChild(child, "p:txBody");
5723
+ if (txBody) {
5724
+ const parsed = parseTextBody(txBody, ctx);
5725
+ if (parsed.paragraphs && parsed.paragraphs.length > 0) return parsed.paragraphs;
5726
+ }
5727
+ }
5728
+ }
5291
5729
  }
5292
5730
  }
5293
5731
  function parseSlideBackground(bg) {
@@ -5304,22 +5742,31 @@ function parseSlideBackground(bg) {
5304
5742
  }
5305
5743
  function parseTransition(transition) {
5306
5744
  const result = {};
5307
- for (const child of transition.elements ?? []) if (child.name?.startsWith("p:")) {
5308
- const type = child.name.replace("p:", "");
5309
- const spd = attr(transition, "spd");
5310
- const advClick = attr(transition, "advClick");
5311
- result.type = type;
5312
- if (spd) result.speed = spd;
5313
- if (advClick !== void 0) result.advanceOnClick = advClick === "1";
5745
+ const spd = attr(transition, "spd");
5746
+ const advClick = attr(transition, "advClick");
5747
+ const advTm = attrNum(transition, "advTm");
5748
+ const p14Dur = attrNum(transition, "p14:dur");
5749
+ if (spd) result.speed = spd;
5750
+ if (advClick !== void 0) result.advanceOnClick = advClick === "1";
5751
+ if (advTm !== void 0) result.advanceAfterMs = advTm;
5752
+ if (p14Dur !== void 0) result.durationMs = p14Dur;
5753
+ for (const child of transition.elements ?? []) if (child.name?.startsWith("p:") && child.name !== "p:transition") {
5754
+ result.type = child.name.replace("p:", "");
5755
+ const p14Prst = findChild(child, "p14:prst");
5756
+ if (p14Prst) {
5757
+ const prstVal = attr(p14Prst, "val");
5758
+ if (prstVal) result.preset = prstVal;
5759
+ }
5314
5760
  break;
5315
5761
  }
5316
5762
  return result;
5317
5763
  }
5318
5764
  //#endregion
5319
5765
  //#region src/parse/document.ts
5320
- async function parsePptx(data) {
5766
+ async function parsePptx(data, options) {
5321
5767
  const zip = unzipToMap(data);
5322
5768
  const ctx = createPptxParseContext(zip);
5769
+ const includeRawParts = options?.includeRawParts !== false;
5323
5770
  const coreProps = parseCoreProperties(zip);
5324
5771
  const slides = [];
5325
5772
  for (const slidePath of ctx.slidePaths) {
@@ -5328,8 +5775,11 @@ async function parsePptx(data) {
5328
5775
  const slide = parseSlide(slideXml, ctx, slidePath);
5329
5776
  slides.push(slide);
5330
5777
  }
5778
+ let $parts;
5779
+ if (includeRawParts) $parts = readAllXmlParts(zip, { skipPaths: ctx.slidePaths });
5331
5780
  return {
5332
5781
  slides,
5782
+ ...$parts && { $parts },
5333
5783
  ...ctx.slideWidth !== void 0 && { slideWidth: ctx.slideWidth },
5334
5784
  ...ctx.slideHeight !== void 0 && { slideHeight: ctx.slideHeight },
5335
5785
  ...coreProps.title && { title: coreProps.title },
@@ -5340,6 +5790,210 @@ async function parsePptx(data) {
5340
5790
  ...coreProps.lastModifiedBy && { lastModifiedBy: coreProps.lastModifiedBy }
5341
5791
  };
5342
5792
  }
5793
+ //#endregion
5794
+ //#region src/parse/convert.ts
5795
+ const EMU_PER_PIXEL = 9525;
5796
+ /**
5797
+ * Convert parsed slide children to constructor-ready BaseXmlComponent[].
5798
+ */
5799
+ function toSlideChildren(children) {
5800
+ return children.map(convertSlideChild);
5801
+ }
5802
+ function convertSlideChild(child) {
5803
+ if (isRaw(child)) return new RawPassthrough(child.element);
5804
+ switch (child.$type) {
5805
+ case "shape": return convertShape(child);
5806
+ case "picture": return convertPicture(child);
5807
+ case "connectorShape": return convertConnectorShape(child);
5808
+ case "table": return convertTable(child);
5809
+ case "groupShape": return convertGroupShape(child);
5810
+ default: return new RawPassthrough(child.element);
5811
+ }
5812
+ }
5813
+ function convertShape(json) {
5814
+ const { paragraphs, fill, outline, x, y, width, height, rotation, ...rest } = json;
5815
+ return new Shape({
5816
+ ...rest,
5817
+ x: x != null ? Math.round(x / EMU_PER_PIXEL) : void 0,
5818
+ y: y != null ? Math.round(y / EMU_PER_PIXEL) : void 0,
5819
+ width: width != null ? Math.round(width / EMU_PER_PIXEL) : void 0,
5820
+ height: height != null ? Math.round(height / EMU_PER_PIXEL) : void 0,
5821
+ rotation: rotation != null ? rotation * 6e4 : void 0,
5822
+ fill: convertFill(fill),
5823
+ outline: convertOutline(outline),
5824
+ paragraphs: paragraphs?.map(convertParagraph)
5825
+ });
5826
+ }
5827
+ function convertPicture(json) {
5828
+ const { data, type, x, y, width, height, ...rest } = json;
5829
+ return new Picture({
5830
+ ...rest,
5831
+ data: base64ToUint8Array(data),
5832
+ type,
5833
+ x: x != null ? Math.round(x / EMU_PER_PIXEL) : void 0,
5834
+ y: y != null ? Math.round(y / EMU_PER_PIXEL) : void 0,
5835
+ width: width != null ? Math.round(width / EMU_PER_PIXEL) : void 0,
5836
+ height: height != null ? Math.round(height / EMU_PER_PIXEL) : void 0
5837
+ });
5838
+ }
5839
+ function convertConnectorShape(json) {
5840
+ const { outline, x, y, width, height, ...rest } = json;
5841
+ const x1 = x != null ? Math.round(x / EMU_PER_PIXEL) : 0;
5842
+ const y1 = y != null ? Math.round(y / EMU_PER_PIXEL) : 0;
5843
+ const x2 = x != null && width != null ? Math.round((x + width) / EMU_PER_PIXEL) : x1 + 100;
5844
+ const y2 = y != null && height != null ? Math.round((y + height) / EMU_PER_PIXEL) : y1 + 100;
5845
+ return new ConnectorShape({
5846
+ ...rest,
5847
+ x1,
5848
+ y1,
5849
+ x2,
5850
+ y2,
5851
+ outline: convertOutline(outline)
5852
+ });
5853
+ }
5854
+ function convertTable(json) {
5855
+ const { rows, ...rest } = json;
5856
+ return new Table({
5857
+ ...rest,
5858
+ rows: rows.map(convertTableRow)
5859
+ });
5860
+ }
5861
+ function convertGroupShape(json) {
5862
+ const { children, x, y, width, height, rotation, ...rest } = json;
5863
+ return new GroupShape({
5864
+ ...rest,
5865
+ x: x != null ? Math.round(x / EMU_PER_PIXEL) : void 0,
5866
+ y: y != null ? Math.round(y / EMU_PER_PIXEL) : void 0,
5867
+ width: width != null ? Math.round(width / EMU_PER_PIXEL) : void 0,
5868
+ height: height != null ? Math.round(height / EMU_PER_PIXEL) : void 0,
5869
+ rotation: rotation != null ? rotation * 6e4 : void 0,
5870
+ children: children ? toSlideChildren(children) : []
5871
+ });
5872
+ }
5873
+ function convertTableRow(row) {
5874
+ return {
5875
+ cells: (row.cells ?? []).map(convertTableCell),
5876
+ height: row.height
5877
+ };
5878
+ }
5879
+ function convertTableCell(cell) {
5880
+ return {
5881
+ paragraphs: cell.paragraphs?.map(convertParagraph),
5882
+ columnSpan: cell.columnSpan,
5883
+ rowSpan: cell.rowSpan,
5884
+ fill: convertFill(cell.fill),
5885
+ borders: convertCellBorders(cell.borders),
5886
+ verticalAlign: cell.verticalAlign,
5887
+ width: cell.width
5888
+ };
5889
+ }
5890
+ function convertParagraph(json) {
5891
+ const { children, text, ...rest } = json;
5892
+ const runs = children?.map(convertRun) ?? (text ? [new Run({ text })] : void 0);
5893
+ return new Paragraph({
5894
+ ...rest,
5895
+ children: runs
5896
+ });
5897
+ }
5898
+ function convertRun(json) {
5899
+ const { fill, underline, strike, capitalization, fontSize, ...rest } = json;
5900
+ return new Run({
5901
+ ...rest,
5902
+ fontSize: fontSize != null ? Math.round(fontSize / 100) : void 0,
5903
+ fill: convertFill(fill),
5904
+ underline: mapUnderline(underline),
5905
+ strike: mapStrike(strike),
5906
+ capitalization: mapCapitalization(capitalization)
5907
+ });
5908
+ }
5909
+ const BORDER_KEY_MAP = {
5910
+ lnT: "top",
5911
+ lnB: "bottom",
5912
+ lnL: "left",
5913
+ lnR: "right",
5914
+ lnH: "insideHorizontal",
5915
+ lnV: "insideVertical"
5916
+ };
5917
+ function convertCellBorders(borders) {
5918
+ if (!borders) return void 0;
5919
+ const result = {};
5920
+ for (const [key, value] of Object.entries(borders)) {
5921
+ const mappedKey = BORDER_KEY_MAP[key] ?? key;
5922
+ result[mappedKey] = value;
5923
+ }
5924
+ return Object.keys(result).length > 0 ? result : void 0;
5925
+ }
5926
+ function convertFill(fill) {
5927
+ if (!fill || typeof fill === "string") return fill;
5928
+ return fill;
5929
+ }
5930
+ function convertOutline(outline) {
5931
+ if (!outline) return void 0;
5932
+ const result = {};
5933
+ if (outline.width != null) result.width = outline.width;
5934
+ if (outline.color != null) result.color = outline.color;
5935
+ if (outline.dashStyle != null) result.dashStyle = mapDash(outline.dashStyle);
5936
+ if (outline.cap != null) result.cap = outline.cap;
5937
+ if (outline.compound != null) result.compound = outline.compound;
5938
+ if (outline.headEnd) result.headEnd = outline.headEnd;
5939
+ if (outline.tailEnd) result.tailEnd = outline.tailEnd;
5940
+ if (outline.join != null) result.join = outline.join;
5941
+ return Object.keys(result).length > 0 ? result : void 0;
5942
+ }
5943
+ function base64ToUint8Array(base64) {
5944
+ const binary = atob(base64);
5945
+ const bytes = new Uint8Array(binary.length);
5946
+ for (let i = 0; i < binary.length; i++) bytes[i] = binary.charCodeAt(i);
5947
+ return bytes;
5948
+ }
5949
+ const UNDERLINE_MAP = {
5950
+ sng: "SINGLE",
5951
+ dbl: "DOUBLE",
5952
+ heavy: "HEAVY",
5953
+ dotted: "DOTTED",
5954
+ dash: "DASH",
5955
+ dashDot: "DASH_DOT",
5956
+ dashDotDot: "DASH_DOT_DOT",
5957
+ sysDash: "SYS_DASH",
5958
+ sysDotDash: "SYS_DOT_DASH"
5959
+ };
5960
+ const STRIKE_MAP = {
5961
+ noStrike: "NONE",
5962
+ sngStrike: "SINGLE",
5963
+ dblStrike: "DOUBLE",
5964
+ heavyStrike: "DOUBLE"
5965
+ };
5966
+ const CAPITALIZATION_MAP = {
5967
+ none: "NONE",
5968
+ small: "SMALL",
5969
+ all: "ALL"
5970
+ };
5971
+ const DASH_MAP = {
5972
+ solid: "SOLID",
5973
+ dash: "DASH",
5974
+ dashDot: "DASH_DOT",
5975
+ dashDotDot: "LG_DASH_DOT",
5976
+ dot: "DOT",
5977
+ lgDash: "LARGE_DASH",
5978
+ sysDash: "SYS_DASH",
5979
+ sysDotDash: "SYS_DOT_DASH"
5980
+ };
5981
+ function mapUnderline(value) {
5982
+ if (!value) return void 0;
5983
+ return UNDERLINE_MAP[value] ?? value;
5984
+ }
5985
+ function mapStrike(value) {
5986
+ if (!value) return void 0;
5987
+ return STRIKE_MAP[value] ?? value;
5988
+ }
5989
+ function mapCapitalization(value) {
5990
+ if (!value) return void 0;
5991
+ return CAPITALIZATION_MAP[value] ?? value;
5992
+ }
5993
+ function mapDash(value) {
5994
+ if (!value) return void 0;
5995
+ return DASH_MAP[value] ?? value;
5996
+ }
5343
5997
  __reExport(/* @__PURE__ */ __exportAll({
5344
5998
  AppProperties: () => AppProperties,
5345
5999
  AudioFrame: () => AudioFrame,
@@ -5434,15 +6088,17 @@ __reExport(/* @__PURE__ */ __exportAll({
5434
6088
  extractBlipFillMedia: () => extractBlipFillMedia,
5435
6089
  hashedId: () => hashedId,
5436
6090
  inchesToEmus: () => inchesToEmus,
6091
+ isRaw: () => isRaw,
5437
6092
  parsePptx: () => parsePptx,
5438
6093
  percentToTHousandths: () => percentToTHousandths,
5439
6094
  pixelsToEmus: () => pixelsToEmus,
5440
6095
  pointsToEmus: () => pointsToEmus,
6096
+ toSlideChildren: () => toSlideChildren,
5441
6097
  uniqueId: () => uniqueId,
5442
6098
  uniqueNumericIdCreator: () => uniqueNumericIdCreator,
5443
6099
  uniqueUuid: () => uniqueUuid
5444
6100
  }), util_exports);
5445
6101
  //#endregion
5446
- export { AppProperties, AudioFrame, Background, BevelPresetType, BlipFill, ChartCollection, ChartFrame, ChartSpace, CompoundLine, ConnectorShape, ContentTypes, CoreProperties, DateTimeField, DefaultNotesMaster, DefaultSlideLayout, DefaultSlideMaster, DefaultTheme, EffectList, EndParagraphRunProperties, Field, File, File as Presentation, GroupShape, GroupShapeProperties, GroupTransform2D, HeaderFooter, LineCap, LineJoin, LineShape, Media, NonVisualDrawingProperties, NonVisualPictureProperties, NonVisualShapeProperties, NotesSlide, Packer, Paragraph, ParagraphProperties, PathShadeType, PenAlignment, Picture, PresentationWrapper, PresetDash, PresetGeometry, PresetMaterialType, PrettifyType, ReflectionAlignment, Relationships, Run, RunProperties, Shape, ShapeProperties, ShapeTree, Slide, SlideNumberField, SlideSizePreset, SmartArtFrame, StrikeStyle, Table, TableCell, TableCellProperties, TableFrame, TableProperties, TableRow, Text, TextAlignment, TextBody, TextCapitalization, TileFlipMode, Transform2D, Transition, UnderlineStyle, VerticalAlignment, VideoFrame, buildFill, convertOutput, createBevel, createBottomBevel, createColorElement, createColorTransforms, createEffectList, createGradientFill, createGradientStop, createOutline, createOutlineCompat, createScene3D, createShape3D, createTransformation, emusToInches, emusToPixels, emusToPoints, extractBlipFillMedia, hashedId, inchesToEmus, parsePptx, percentToTHousandths, pixelsToEmus, pointsToEmus, uniqueId, uniqueNumericIdCreator, uniqueUuid };
6102
+ export { AppProperties, AudioFrame, Background, BevelPresetType, BlipFill, ChartCollection, ChartFrame, ChartSpace, CompoundLine, ConnectorShape, ContentTypes, CoreProperties, DateTimeField, DefaultNotesMaster, DefaultSlideLayout, DefaultSlideMaster, DefaultTheme, EffectList, EndParagraphRunProperties, Field, File, File as Presentation, GroupShape, GroupShapeProperties, GroupTransform2D, HeaderFooter, LineCap, LineJoin, LineShape, Media, NonVisualDrawingProperties, NonVisualPictureProperties, NonVisualShapeProperties, NotesSlide, Packer, Paragraph, ParagraphProperties, PathShadeType, PenAlignment, Picture, PresentationWrapper, PresetDash, PresetGeometry, PresetMaterialType, PrettifyType, ReflectionAlignment, Relationships, Run, RunProperties, Shape, ShapeProperties, ShapeTree, Slide, SlideNumberField, SlideSizePreset, SmartArtFrame, StrikeStyle, Table, TableCell, TableCellProperties, TableFrame, TableProperties, TableRow, Text, TextAlignment, TextBody, TextCapitalization, TileFlipMode, Transform2D, Transition, UnderlineStyle, VerticalAlignment, VideoFrame, buildFill, convertOutput, createBevel, createBottomBevel, createColorElement, createColorTransforms, createEffectList, createGradientFill, createGradientStop, createOutline, createOutlineCompat, createScene3D, createShape3D, createTransformation, emusToInches, emusToPixels, emusToPoints, extractBlipFillMedia, hashedId, inchesToEmus, isRaw, parsePptx, percentToTHousandths, pixelsToEmus, pointsToEmus, toSlideChildren, uniqueId, uniqueNumericIdCreator, uniqueUuid };
5447
6103
 
5448
6104
  //# sourceMappingURL=index.mjs.map