@office-open/docx 0.6.7 → 0.6.8

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,5 +1,5 @@
1
1
  import { i as __toCommonJS, n as __exportAll, r as __reExport, t as __esmMin } from "./chunk-090QGkrx.mjs";
2
- import { AppProperties, BaseXmlComponent, BuilderElement, BuilderElement as BuilderElement$1, DOCX_NS, EMPTY_OBJECT, EmptyElement, Formatter, Formatter as Formatter$1, IgnoreIfEmptyXmlComponent, ImportedRootElementAttributes, ImportedXmlComponent, InitializableXmlComponent, NextAttributeComponent, OoxmlMimeType, RawPassthrough, Relationships, TargetModeType, XmlAttributeComponent, XmlAttributeComponent as XmlAttributeComponent$1, XmlComponent, ZIP_STORED_LEVEL, addSmartArtRelationships, appendContentType, appendRelationship, attrObj, chartAttr, convertEmuToPixels, convertInchesToTwip, convertMillimetersToTwip, convertPixelsToEmu, convertToXmlComponent, createDefault, createOverride, createPacker, createReplacer, createTraverser, getNextRelationshipIndex, getReferencedMedia, hasPlaceholders, hashedId, hpsMeasureObj, hpsMeasureObj as hpsMeasureObj$1, numberValObj, numberValObj as numberValObj$1, onOffObj, onOffObj as onOffObj$1, parseArchive, parseCorePropsElement, replaceChartPlaceholders, replaceImagePlaceholders, replaceSmartArtPlaceholders, strFromU8, stringContainerObj, stringEnumValObj, stringEnumValObj as stringEnumValObj$1, stringValObj, stringValObj as stringValObj$1, toJson, uniqueId, uniqueNumericIdCreator, uniqueNumericIdCreator as uniqueNumericIdCreator$1, uniqueUuid, unzipSync, wrapEl, xsdVerticalMergeRev, zipAndConvert } from "@office-open/core";
2
+ import { AppProperties, BaseXmlComponent, BuilderElement, BuilderElement as BuilderElement$1, DOCX_NS, EMPTY_OBJECT, EmptyElement, Formatter, Formatter as Formatter$1, IgnoreIfEmptyXmlComponent, ImportedRootElementAttributes, ImportedXmlComponent, InitializableXmlComponent, OoxmlMimeType, RawPassthrough, Relationships, TargetModeType, XmlComponent, ZIP_STORED_LEVEL, addSmartArtRelationships, appendContentType, appendRelationship, attrObj, chartAttr, convertEmuToPixels, convertInchesToTwip, convertMillimetersToTwip, convertPixelsToEmu, convertToXmlComponent, createDefault, createOverride, createPacker, createReplacer, createTraverser, getNextRelationshipIndex, getReferencedMedia, hasPlaceholders, hashedId, hpsMeasureObj, hpsMeasureObj as hpsMeasureObj$1, numberValObj, numberValObj as numberValObj$1, onOffObj, onOffObj as onOffObj$1, parseArchive, parseCorePropsElement, replaceChartPlaceholders, replaceImagePlaceholders, replaceSmartArtPlaceholders, strFromU8, stringContainerObj, stringEnumValObj, stringEnumValObj as stringEnumValObj$1, stringValObj, stringValObj as stringValObj$1, toJson, uniqueId, uniqueNumericIdCreator, uniqueNumericIdCreator as uniqueNumericIdCreator$1, uniqueUuid, unzipSync, wrapEl, xsdVerticalMergeRev, zipAndConvert } from "@office-open/core";
3
3
  import { attr, attrBool, attrNum, children, colorAttr, findChild, findDeep, js2xml, textOf, xml, xml2js } from "@office-open/xml";
4
4
  import { toUint8Array } from "undio";
5
5
  import { PresetGeometry, buildFill, createBlipFill, createCustomGeometry, createEffectDag, createEffectList, createOutline, createScene3D, createShape3D, createTransform2D, extractBlipFillMedia } from "@office-open/core/drawingml";
@@ -10,46 +10,6 @@ export * from "@office-open/core/smartart";
10
10
  //#region src/file/xml-components/base.ts
11
11
  var init_base = __esmMin((() => {}));
12
12
  //#endregion
13
- //#region src/file/xml-components/attributes.ts
14
- /**
15
- * Common XML attributes module for WordprocessingML elements.
16
- *
17
- * This module provides a reusable Attributes class with commonly used
18
- * WordprocessingML attribute mappings.
19
- *
20
- * @module
21
- */
22
- var Attributes;
23
- var init_attributes = __esmMin((() => {
24
- Attributes = class extends XmlAttributeComponent$1 {
25
- xmlKeys = {
26
- bottom: "w:bottom",
27
- color: "w:color",
28
- fill: "w:fill",
29
- footer: "w:footer",
30
- gutter: "w:gutter",
31
- h: "w:h",
32
- header: "w:header",
33
- left: "w:left",
34
- linePitch: "w:linePitch",
35
- pos: "w:pos",
36
- right: "w:right",
37
- rsidR: "w:rsidR",
38
- rsidRPr: "w:rsidRPr",
39
- rsidSect: "w:rsidSect",
40
- space: "w:space",
41
- sz: "w:sz",
42
- themeColor: "w:themeColor",
43
- themeShade: "w:themeShade",
44
- themeTint: "w:themeTint",
45
- top: "w:top",
46
- type: "w:type",
47
- val: "w:val",
48
- w: "w:w"
49
- };
50
- };
51
- }));
52
- //#endregion
53
13
  //#region src/file/xml-components/simple-elements.ts
54
14
  /**
55
15
  * Docx-specific simple element helpers.
@@ -70,7 +30,6 @@ var init_simple_elements = __esmMin((() => {
70
30
  //#region src/file/xml-components/index.ts
71
31
  var init_xml_components = __esmMin((() => {
72
32
  init_base();
73
- init_attributes();
74
33
  init_simple_elements();
75
34
  }));
76
35
  //#endregion
@@ -1761,7 +1720,7 @@ var init_shape_properties = __esmMin((() => {
1761
1720
  if (scene3d) this.root.push(createScene3D(scene3d));
1762
1721
  if (shape3d) this.root.push(createShape3D(shape3d));
1763
1722
  }
1764
- prepForXml(context) {
1723
+ toXml(context) {
1765
1724
  const media = this.fillOptions ? extractBlipFillMedia(this.fillOptions) : void 0;
1766
1725
  if (media) context.file.media.addImage(media.fileName, {
1767
1726
  data: media.data,
@@ -1778,7 +1737,7 @@ var init_shape_properties = __esmMin((() => {
1778
1737
  }
1779
1738
  }
1780
1739
  });
1781
- return super.prepForXml(context);
1740
+ return super.toXml(context);
1782
1741
  }
1783
1742
  };
1784
1743
  }));
@@ -2076,7 +2035,8 @@ var init_non_visual_properties = __esmMin((() => {
2076
2035
  descr: ""
2077
2036
  } });
2078
2037
  }
2079
- prepForXml(context) {
2038
+ toXml(context) {
2039
+ const start = this.root.length;
2080
2040
  let hasStackClick = false;
2081
2041
  for (let i = context.stack.length - 1; i >= 0; i--) {
2082
2042
  const element = context.stack[i];
@@ -2097,7 +2057,9 @@ var init_non_visual_properties = __esmMin((() => {
2097
2057
  this.root.push(buildHyperlinkHoverObj(linkId, false));
2098
2058
  }
2099
2059
  }
2100
- return super.prepForXml(context);
2060
+ const result = super.toXml(context);
2061
+ this.root.length = start;
2062
+ return result;
2101
2063
  }
2102
2064
  };
2103
2065
  }));
@@ -2719,7 +2681,8 @@ var init_doc_properties = __esmMin((() => {
2719
2681
  if (title !== null && title !== void 0) attributes.title = title;
2720
2682
  this.root.push({ _attr: attributes });
2721
2683
  }
2722
- prepForXml(context) {
2684
+ toXml(context) {
2685
+ const start = this.root.length;
2723
2686
  let hasStackClick = false;
2724
2687
  for (let i = context.stack.length - 1; i >= 0; i--) {
2725
2688
  const element = context.stack[i];
@@ -2740,7 +2703,9 @@ var init_doc_properties = __esmMin((() => {
2740
2703
  this.root.push(buildHyperlinkHoverObj(linkId, true));
2741
2704
  }
2742
2705
  }
2743
- return super.prepForXml(context);
2706
+ const result = super.toXml(context);
2707
+ this.root.length = start;
2708
+ return result;
2744
2709
  }
2745
2710
  };
2746
2711
  }));
@@ -6283,22 +6248,7 @@ var init_properties = __esmMin((() => {
6283
6248
  this.root.push(item);
6284
6249
  }
6285
6250
  /**
6286
- * Prepares the paragraph properties for XML serialization.
6287
- *
6288
- * This method creates concrete numbering instances for any numbering references
6289
- * before the properties are converted to XML.
6290
- *
6291
- * @param context - The XML context containing document and file information
6292
- * @returns The prepared XML object, or undefined if the component should be ignored
6293
- */
6294
- prepForXml(context) {
6295
- if (!(context.viewWrapper instanceof FontWrapper)) for (const reference of this.numberingReferences) context.file.numbering.createConcreteNumberingInstance(reference.reference, reference.instance);
6296
- return super.prepForXml(context);
6297
- }
6298
- /**
6299
6251
  * Register numbering references (side effect) before serialization.
6300
- * toXml() bypasses prepForXml(), so numbering registration must be
6301
- * triggered explicitly here.
6302
6252
  */
6303
6253
  toXml(context) {
6304
6254
  if (!(context.viewWrapper instanceof FontWrapper)) for (const reference of this.numberingReferences) context.file.numbering.createConcreteNumberingInstance(reference.reference, reference.instance);
@@ -6357,102 +6307,6 @@ var init_paragraph$1 = __esmMin((() => {
6357
6307
  this._props = buildParagraphProperties(this.options);
6358
6308
  this._textRun = this.options.text ? new TextRun(this.options.text) : void 0;
6359
6309
  }
6360
- prepForXml(context) {
6361
- const children = [];
6362
- const { xml: pPrObj, numberingReferences } = this._props;
6363
- if (!(context.viewWrapper instanceof FontWrapper)) for (const reference of numberingReferences) context.file.numbering.createConcreteNumberingInstance(reference.reference, reference.instance);
6364
- let finalPPrObj = pPrObj;
6365
- if (this.sectionProperties) {
6366
- const sectPrObj = this.sectionProperties.prepForXml(context);
6367
- if (sectPrObj) if (finalPPrObj) finalPPrObj["w:pPr"].push(sectPrObj);
6368
- else finalPPrObj = { "w:pPr": [sectPrObj] };
6369
- }
6370
- if (finalPPrObj) children.push(finalPPrObj);
6371
- for (const run of this.frontRuns) {
6372
- const obj = run.prepForXml(context);
6373
- if (obj) children.push(obj);
6374
- }
6375
- if (this._textRun) {
6376
- const obj = this._textRun.prepForXml(context);
6377
- if (obj) children.push(obj);
6378
- }
6379
- if (this.options.children) for (const rawChild of this.options.children) {
6380
- if (rawChild instanceof ExternalHyperlink) {
6381
- const concreteHyperlink = new ConcreteHyperlink(rawChild.options.children, uniqueId(), { tooltip: rawChild.options.tooltip });
6382
- context.viewWrapper.relationships.addRelationship(concreteHyperlink.linkId, "http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink", rawChild.options.link, TargetModeType.EXTERNAL);
6383
- const obj = concreteHyperlink.prepForXml(context);
6384
- if (obj) children.push(obj);
6385
- continue;
6386
- }
6387
- if (rawChild instanceof Bookmark) {
6388
- const startObj = rawChild.start.prepForXml(context);
6389
- if (startObj) children.push(startObj);
6390
- for (const textRun of rawChild.children) if (textRun instanceof BaseXmlComponent) {
6391
- const obj = textRun.prepForXml(context);
6392
- if (obj) children.push(obj);
6393
- }
6394
- const endObj = rawChild.end.prepForXml(context);
6395
- if (endObj) children.push(endObj);
6396
- continue;
6397
- }
6398
- let child;
6399
- if (typeof rawChild === "string") child = new TextRun(rawChild);
6400
- else if (rawChild instanceof BaseXmlComponent) child = rawChild;
6401
- else if ("chart" in rawChild) child = new ChartRun(rawChild.chart);
6402
- else if ("smartArt" in rawChild) child = new SmartArtRun(rawChild.smartArt);
6403
- else if ("image" in rawChild) child = new ImageRun(rawChild.image);
6404
- else if (typeof rawChild === "object" && rawChild !== null && "hyperlink" in rawChild) {
6405
- const { hyperlink, ...runOpts } = rawChild;
6406
- const hlChildren = hyperlink.children;
6407
- const textRuns = [];
6408
- if (hlChildren && hlChildren.length > 0) for (const rc of hlChildren) textRuns.push(new TextRun(rc));
6409
- else textRuns.push(new TextRun(runOpts));
6410
- if ("link" in hyperlink) {
6411
- const ext = new ExternalHyperlink({
6412
- link: hyperlink.link,
6413
- tooltip: hyperlink.tooltip,
6414
- children: textRuns
6415
- });
6416
- const concrete = new ConcreteHyperlink(ext.options.children, uniqueId(), { tooltip: ext.options.tooltip });
6417
- context.viewWrapper.relationships.addRelationship(concrete.linkId, "http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink", ext.options.link, TargetModeType.EXTERNAL);
6418
- const obj = concrete.prepForXml(context);
6419
- if (obj) children.push(obj);
6420
- } else if ("anchor" in hyperlink) {
6421
- const obj = new InternalHyperlink({
6422
- anchor: hyperlink.anchor,
6423
- tooltip: hyperlink.tooltip,
6424
- children: textRuns
6425
- }).prepForXml(context);
6426
- if (obj) children.push(obj);
6427
- }
6428
- continue;
6429
- } else if ("math" in rawChild && typeof rawChild === "object" && rawChild !== null && typeof rawChild.math === "object" && rawChild.math !== null) {
6430
- const coercedChildren = rawChild.math.children?.map(coerceMathJson);
6431
- child = new Math$1(coercedChildren ? { children: coercedChildren } : { children: [] });
6432
- } else if ("symbolRun" in rawChild) child = new SymbolRun(rawChild.symbolRun);
6433
- else if ("footnoteReference" in rawChild) child = new FootnoteReferenceRun(rawChild.footnoteReference);
6434
- else if ("endnoteReference" in rawChild) child = new EndnoteReferenceRun(rawChild.endnoteReference);
6435
- else if ("pageBreak" in rawChild) child = new PageBreak();
6436
- else if ("columnBreak" in rawChild) child = new ColumnBreak();
6437
- else if ("commentRangeStart" in rawChild) child = new CommentRangeStart(rawChild.commentRangeStart);
6438
- else if ("commentRangeEnd" in rawChild) child = new CommentRangeEnd(rawChild.commentRangeEnd);
6439
- else if ("commentReference" in rawChild) child = new TextRun({ children: [new CommentReference(rawChild.commentReference)] });
6440
- else if ("bookmarkStart" in rawChild) {
6441
- const startObj = new BookmarkStart(rawChild.bookmarkStart.name, rawChild.bookmarkStart.id).prepForXml(context);
6442
- if (startObj) children.push(startObj);
6443
- continue;
6444
- } else if ("bookmarkEnd" in rawChild) {
6445
- const endObj = new BookmarkEnd(rawChild.bookmarkEnd).prepForXml(context);
6446
- if (endObj) children.push(endObj);
6447
- continue;
6448
- } else if ("insertion" in rawChild) child = new InsertedTextRun(rawChild.insertion);
6449
- else if ("deletion" in rawChild) child = new DeletedTextRun(rawChild.deletion);
6450
- else child = new TextRun(rawChild);
6451
- const obj = child.prepForXml(context);
6452
- if (obj) children.push(obj);
6453
- }
6454
- return { "w:p": children.length > 0 ? children : {} };
6455
- }
6456
6310
  addRunToFront(run) {
6457
6311
  this.frontRuns.push(run);
6458
6312
  return this;
@@ -6968,10 +6822,9 @@ var init_alt_chunk = __esmMin((() => {
6968
6822
  this.root.push(altChunkPr);
6969
6823
  }
6970
6824
  }
6971
- prepForXml(context) {
6825
+ toXml(context) {
6972
6826
  const relId = uniqueId();
6973
6827
  const extension = this.options.extension;
6974
- this.root.splice(0, 0, { _attr: { "r:id": `rId${relId}` } });
6975
6828
  const partPath = `afchunks/afchunk${relId}.${extension}`;
6976
6829
  const rawData = typeof this.options.data === "string" ? new TextEncoder().encode(this.options.data) : this.options.data;
6977
6830
  const data = this.options.contentType === "text/html" && typeof this.options.data === "string" ? new TextEncoder().encode(wrapHtmlDocument(this.options.data)) : rawData;
@@ -6984,7 +6837,10 @@ var init_alt_chunk = __esmMin((() => {
6984
6837
  contentType: this.options.contentType
6985
6838
  });
6986
6839
  context.file.contentTypes.addAltChunk(`/word/${partPath}`, this.options.contentType, extension);
6987
- return super.prepForXml(context);
6840
+ this.root.splice(0, 0, { _attr: { "r:id": `rId${relId}` } });
6841
+ const result = super.toXml(context);
6842
+ this.root.splice(0, 1);
6843
+ return result;
6988
6844
  }
6989
6845
  };
6990
6846
  }));
@@ -7363,10 +7219,9 @@ var init_sub_doc = __esmMin((() => {
7363
7219
  super("w:subDoc");
7364
7220
  this.options = options;
7365
7221
  }
7366
- prepForXml(context) {
7222
+ toXml(context) {
7367
7223
  const relId = uniqueId();
7368
7224
  const partPath = `subdocs/subdoc${relId}.docx`;
7369
- this.root.splice(0, 0, { _attr: { "r:id": `rId${relId}` } });
7370
7225
  const data = typeof this.options.data === "string" ? new TextEncoder().encode(this.options.data) : this.options.data;
7371
7226
  context.viewWrapper.relationships.addRelationship(relId, SUBDOC_RELATIONSHIP_TYPE, partPath);
7372
7227
  context.file.subDocs.addSubDoc(relId, {
@@ -7374,7 +7229,10 @@ var init_sub_doc = __esmMin((() => {
7374
7229
  path: partPath
7375
7230
  });
7376
7231
  context.file.contentTypes.addSubDoc(`/word/${partPath}`);
7377
- return super.prepForXml(context);
7232
+ this.root.splice(0, 0, { _attr: { "r:id": `rId${relId}` } });
7233
+ const result = super.toXml(context);
7234
+ this.root.splice(0, 1);
7235
+ return result;
7378
7236
  }
7379
7237
  };
7380
7238
  }));
@@ -8431,26 +8289,6 @@ var init_table_row$1 = __esmMin((() => {
8431
8289
  }
8432
8290
  return idx;
8433
8291
  }
8434
- prepForXml(context) {
8435
- const children = [];
8436
- if (this.options.propertyExceptions) {
8437
- const obj = new TablePropertyExceptions(this.options.propertyExceptions).prepForXml(context);
8438
- if (obj) children.push(obj);
8439
- }
8440
- const trPrObj = buildTableRowProperties(this.options);
8441
- if (trPrObj) children.push(trPrObj);
8442
- const prefixCount = children.length;
8443
- for (const child of this.coercedChildren) {
8444
- const obj = child.prepForXml(context);
8445
- if (obj) children.push(obj);
8446
- }
8447
- if (this.extraCells.length > 0) for (const { cell, columnIndex } of this.extraCells) {
8448
- const insertIdx = this.findInsertIndex(columnIndex, prefixCount);
8449
- const obj = cell.prepForXml(context);
8450
- if (obj) children.splice(insertIdx, 0, obj);
8451
- }
8452
- return { "w:tr": children.length ? children : EMPTY_OBJECT };
8453
- }
8454
8292
  toXml(context) {
8455
8293
  const parts = [];
8456
8294
  if (this.options.propertyExceptions) parts.push(new TablePropertyExceptions(this.options.propertyExceptions).toXml(context));
@@ -8636,18 +8474,6 @@ var init_table_cell = __esmMin((() => {
8636
8474
  super("w:tc");
8637
8475
  this.options = options;
8638
8476
  }
8639
- prepForXml(context) {
8640
- const children = [];
8641
- const tPrObj = buildTableCellProperties(this.options);
8642
- if (tPrObj) children.push(tPrObj);
8643
- const coerced = this.options.children.map((c) => c instanceof BaseXmlComponent ? c : lazyCoerce(c));
8644
- for (const child of coerced) {
8645
- const obj = child.prepForXml(context);
8646
- if (obj) children.push(obj);
8647
- }
8648
- if (!(coerced[coerced.length - 1] instanceof Paragraph)) children.push(new Paragraph({}).prepForXml(context));
8649
- return { "w:tc": children };
8650
- }
8651
8477
  toXml(context) {
8652
8478
  const parts = [];
8653
8479
  const tPrObj = buildTableCellProperties(this.options);
@@ -8766,35 +8592,6 @@ var init_table = __esmMin((() => {
8766
8592
  });
8767
8593
  });
8768
8594
  }
8769
- prepForXml(context) {
8770
- const children = [];
8771
- const tblPrObj = new TableProperties({
8772
- alignment: this.options.alignment,
8773
- borders: this.options.borders ?? {},
8774
- caption: this.options.caption,
8775
- cellMargin: this.options.margins,
8776
- cellSpacing: this.options.cellSpacing,
8777
- description: this.options.description,
8778
- float: this.options.float,
8779
- indent: this.options.indent,
8780
- layout: this.options.layout,
8781
- revision: this.options.revision,
8782
- style: this.options.style,
8783
- styleColBandSize: this.options.styleColBandSize,
8784
- styleRowBandSize: this.options.styleRowBandSize,
8785
- tableLook: this.options.tableLook,
8786
- visuallyRightToLeft: this.options.visuallyRightToLeft,
8787
- width: this.options.width ?? { size: 100 }
8788
- }).prepForXml(context);
8789
- if (tblPrObj) children.push(tblPrObj);
8790
- const gridObj = new TableGrid(this.columnWidths, this.options.columnWidthsRevision).prepForXml(context);
8791
- if (gridObj) children.push(gridObj);
8792
- for (const row of this.rows) {
8793
- const obj = row.prepForXml(context);
8794
- if (obj) children.push(obj);
8795
- }
8796
- return { "w:tbl": children };
8797
- }
8798
8595
  toXml(context) {
8799
8596
  const parts = [];
8800
8597
  const tblPr = new TableProperties({
@@ -9478,12 +9275,10 @@ var CustomProperties = class extends XmlComponent {
9478
9275
  this.nextId = 2;
9479
9276
  for (const property of properties) this.addCustomProperty(property);
9480
9277
  }
9481
- prepForXml(context) {
9482
- this.properties.forEach((x) => this.root.push(x));
9483
- return super.prepForXml(context);
9484
- }
9485
9278
  addCustomProperty(property) {
9486
- this.properties.push(new CustomProperty(this.nextId++, property));
9279
+ const prop = new CustomProperty(this.nextId++, property);
9280
+ this.properties.push(prop);
9281
+ this.root.push(prop);
9487
9282
  }
9488
9283
  };
9489
9284
  //#endregion
@@ -10575,22 +10370,6 @@ var Body = class extends XmlComponent {
10575
10370
  this.sections.push(new SectionProperties(options));
10576
10371
  }
10577
10372
  /**
10578
- * Prepares the body element for XML serialization.
10579
- *
10580
- * Ensures that the last section's properties are placed as a direct child of the body
10581
- * element, as required by the OOXML specification.
10582
- *
10583
- * @param context - The XML serialization context
10584
- * @returns The prepared XML object or undefined
10585
- */
10586
- prepForXml(context) {
10587
- if (this.sections.length === 1) {
10588
- this.root.splice(0, 1);
10589
- this.root.push(this.sections.pop());
10590
- }
10591
- return super.prepForXml(context);
10592
- }
10593
- /**
10594
10373
  * Direct XML serialization — ensures section properties are appended
10595
10374
  * before delegating to the default XmlComponent.toXml() traversal.
10596
10375
  */
@@ -10713,7 +10492,7 @@ var DocumentBackground = class extends XmlComponent {
10713
10492
  };
10714
10493
  }
10715
10494
  }
10716
- prepForXml(context) {
10495
+ toXml(context) {
10717
10496
  if (this.imageData) {
10718
10497
  context.file.media.addImage(this.imageData.fileName, {
10719
10498
  type: this.imageData.type,
@@ -10759,7 +10538,7 @@ var DocumentBackground = class extends XmlComponent {
10759
10538
  name: "v:background"
10760
10539
  }));
10761
10540
  }
10762
- return super.prepForXml(context);
10541
+ return super.toXml(context);
10763
10542
  }
10764
10543
  };
10765
10544
  //#endregion
@@ -12389,18 +12168,13 @@ var Numbering = class extends XmlComponent {
12389
12168
  this.referenceConfigMap.set(con.reference, con.levels);
12390
12169
  }
12391
12170
  }
12392
- /**
12393
- * Prepares the numbering definitions for XML serialization.
12394
- *
12395
- * Adds all abstract and concrete numbering definitions to the XML tree.
12396
- *
12397
- * @param context - The XML context
12398
- * @returns The prepared XML object
12399
- */
12400
- prepForXml(context) {
12171
+ toXml(context) {
12172
+ const start = this.root.length;
12401
12173
  for (const numbering of this.abstractNumberingMap.values()) this.root.push(numbering);
12402
12174
  for (const numbering of this.concreteNumberingMap.values()) this.root.push(numbering);
12403
- return super.prepForXml(context);
12175
+ const result = super.toXml(context);
12176
+ this.root.length = start;
12177
+ return result;
12404
12178
  }
12405
12179
  /**
12406
12180
  * Creates a concrete numbering instance from an abstract numbering definition.
@@ -14267,7 +14041,6 @@ var file_exports = /* @__PURE__ */ __exportAll({
14267
14041
  AltChunk: () => AltChunk,
14268
14042
  AltChunkCollection: () => AltChunkCollection,
14269
14043
  AnnotationReference: () => AnnotationReference,
14270
- Attributes: () => Attributes,
14271
14044
  BaseXmlComponent: () => BaseXmlComponent,
14272
14045
  Bdo: () => Bdo,
14273
14046
  Bibliography: () => Bibliography,
@@ -14402,7 +14175,6 @@ var file_exports = /* @__PURE__ */ __exportAll({
14402
14175
  MoveToRangeStart: () => MoveToRangeStart,
14403
14176
  MovedFromTextRun: () => MovedFromTextRun,
14404
14177
  MovedToTextRun: () => MovedToTextRun,
14405
- NextAttributeComponent: () => NextAttributeComponent,
14406
14178
  NoBreakHyphen: () => NoBreakHyphen,
14407
14179
  NumberFormat: () => NumberFormat,
14408
14180
  NumberProperties: () => NumberProperties,
@@ -14512,7 +14284,6 @@ var file_exports = /* @__PURE__ */ __exportAll({
14512
14284
  WidthType: () => WidthType,
14513
14285
  WpgGroupRun: () => WpgGroupRun,
14514
14286
  WpsShapeRun: () => WpsShapeRun,
14515
- XmlAttributeComponent: () => XmlAttributeComponent,
14516
14287
  XmlComponent: () => XmlComponent,
14517
14288
  YearLong: () => YearLong,
14518
14289
  YearShort: () => YearShort,
@@ -17825,7 +17596,6 @@ var src_exports = /* @__PURE__ */ __exportAll({
17825
17596
  AltChunk: () => AltChunk,
17826
17597
  AltChunkCollection: () => AltChunkCollection,
17827
17598
  AnnotationReference: () => AnnotationReference,
17828
- Attributes: () => Attributes,
17829
17599
  BaseXmlComponent: () => BaseXmlComponent,
17830
17600
  Bdo: () => Bdo,
17831
17601
  Bibliography: () => Bibliography,
@@ -17960,7 +17730,6 @@ var src_exports = /* @__PURE__ */ __exportAll({
17960
17730
  MoveToRangeStart: () => MoveToRangeStart,
17961
17731
  MovedFromTextRun: () => MovedFromTextRun,
17962
17732
  MovedToTextRun: () => MovedToTextRun,
17963
- NextAttributeComponent: () => NextAttributeComponent,
17964
17733
  NoBreakHyphen: () => NoBreakHyphen,
17965
17734
  NumberFormat: () => NumberFormat,
17966
17735
  NumberProperties: () => NumberProperties,
@@ -18072,7 +17841,6 @@ var src_exports = /* @__PURE__ */ __exportAll({
18072
17841
  WidthType: () => WidthType,
18073
17842
  WpgGroupRun: () => WpgGroupRun,
18074
17843
  WpsShapeRun: () => WpsShapeRun,
18075
- XmlAttributeComponent: () => XmlAttributeComponent,
18076
17844
  XmlComponent: () => XmlComponent,
18077
17845
  YearLong: () => YearLong,
18078
17846
  YearShort: () => YearShort,
@@ -18219,6 +17987,6 @@ var src_exports = /* @__PURE__ */ __exportAll({
18219
17987
  __reExport(src_exports, file_exports);
18220
17988
  __reExport(src_exports, util_exports);
18221
17989
  //#endregion
18222
- export { AbstractNumbering, AlignmentType, AltChunk, AltChunkCollection, AnnotationReference, Attributes, BaseXmlComponent, Bdo, Bibliography, Body, Bookmark, BookmarkEnd, BookmarkStart, Border, BorderStyle, BuilderElement, COLOR_CATEGORIES, CarriageReturn, CellMerge, CharacterSet, ChartCollection, ChartRun, ChartSpace, CheckBox, CheckBoxSymbolElement, CheckBoxUtil, Column, ColumnBreak, Comment, CommentRangeEnd, CommentRangeStart, CommentReference, Comments, ConcreteHyperlink, ConcreteNumbering, ContinuationSeparator, DEFAULT_DRAWING_XML, DayLong, DayShort, DeletedTableCell, DeletedTableRow, DeletedTextRun, Dir, File as Document, File, DocumentAttributeNamespaces, DocumentBackground, DocumentDefaults, DocumentGridType, Drawing, DropCapType, EMPTY_OBJECT, EditGroupType, EmphasisMarkType, EmptyElement, EndnoteIdReference, EndnoteReference, EndnoteReferenceRun, Endnotes, ExternalHyperlink, FootNotes, Footer, FooterWrapper, FootnoteReference, FootnoteReferenceElement, FootnoteReferenceRun, FormFieldTextType, FractionType, FrameAnchorType, FrameWrap, GridSpan, Header, HeaderFooterReferenceType, HeaderFooterType, HeaderWrapper, HeadingLevel, HeightRule, HighlightColor, HorizontalPositionAlign, HorizontalPositionRelativeFrom, HyperlinkType, IgnoreIfEmptyXmlComponent, ImageRun, ImportedRootElementAttributes, ImportedXmlComponent, InitializableXmlComponent, InsertedTableCell, InsertedTableRow, InsertedTextRun, InternalHyperlink, LAYOUT_CATEGORIES, LastRenderedPageBreak, LeaderType, Level, LevelBase, LevelForOverride, LevelFormat, LevelOverride, LevelSuffix, LineNumberRestartFormat, LineRuleType, Math$1 as Math, MathAngledBrackets, MathBorderBox, MathBox, MathCurlyBrackets, MathDegree, MathDenominator, MathEqArr, MathFraction, MathFunction, MathFunctionName, MathGroupChr, MathIntegral, MathLimit, MathLimitLower, MathLimitUpper, MathMatrix, MathNumerator, MathParagraph, MathPhant, MathPreSubSuperScript, MathRadical, MathRadicalProperties, MathRoundBrackets, MathRun, MathSquareBrackets, MathSubScript, MathSubSuperScript, MathSum, MathSuperScript, Media, MonthLong, MonthShort, MoveFromRangeEnd, MoveFromRangeStart, MoveToRangeEnd, MoveToRangeStart, MovedFromTextRun, MovedToTextRun, NextAttributeComponent, NoBreakHyphen, NumberFormat, NumberProperties, NumberedItemReference, NumberedItemReferenceFormat, Numbering, OverlapType, Packer, PageBorderDisplay, PageBorderOffsetFrom, PageBorderZOrder, PageBorders, PageBreak, PageBreakBefore, PageNumber, PageNumberElement, PageNumberSeparator, PageOrientation, PageReference, PageTextDirection, PageTextDirectionType, Paragraph, ParagraphProperties, ParagraphPropertiesChange, ParagraphPropertiesDefaults, ParagraphRunProperties, PatchType, PermEnd, PermStart, PositionalTab, PositionalTabAlignment, PositionalTabLeader, PositionalTabRelativeTo, RelativeHorizontalPosition, RelativeVerticalPosition, RubyAlign, Run, RunProperties, RunPropertiesChange, RunPropertiesDefaults, STYLE_CATEGORIES, SdtDateMappingType, SdtLock, SectionProperties, SectionPropertiesChange, SectionType, Separator, SequentialIdentifier, ShadingType, SimpleField, SimpleMailMergeField, SmartArtCollection, SmartArtRun, SoftHyphen, SpaceType, StructuredDocumentTagBlock, StructuredDocumentTagCell, StructuredDocumentTagContent, StructuredDocumentTagProperties, StructuredDocumentTagRow, StructuredDocumentTagRun, StyleForCharacter, StyleForParagraph, StyleLevel, Styles, SubDoc, SubDocCollection, SymbolRun, TDirection, Tab, TabStopPosition, TabStopType, Table, TableAnchorType, TableBorders, TableCell, TableCellBorders, TableLayoutType, TableOfContents, TableProperties, TablePropertyExceptions, TableRow, TableRowProperties, TableRowPropertiesChange, TextAlignmentType, TextBodyWrappingType, TextDirection, TextEffect, TextHorzOverflowType, TextRun, TextVertOverflowType, TextVerticalType, TextWrappingSide, TextWrappingType, Textbox, TextboxTightWrapType, ThematicBreak, UnderlineType, VerticalAlignSection, VerticalAlignTable, VerticalAnchor, VerticalMerge, VerticalMergeRevisionType, VerticalMergeType, VerticalPositionAlign, VerticalPositionRelativeFrom, WORKAROUND2, WORKAROUND4, WidthType, WpgGroupRun, WpsShapeRun, XmlAttributeComponent, XmlComponent, YearLong, YearShort, abstractNumUniqueNumericIdGen, attrObj, bookmarkUniqueNumericIdGen, buildBorderObj, buildCellMergeObj, buildCnfStyleObj, buildDeletedTableCellObj, buildDeletedTableRowObj, buildDivIdObj, buildDocumentAttributes, buildEmphasisMarkObj, buildFramePropertiesObj, buildGridSpan, buildIndentObj, buildInsertedTableCellObj, buildInsertedTableRowObj, buildNumberProperties, buildOutlineLevelObj, buildParagraphBorders, buildParagraphProperties, buildRunFontsObj, buildRunProperties, buildShadingObj, buildSpacingObj, buildTabStopObj, buildTableBorders, buildTableCellBorders, buildTableFloatPropertiesObj, buildTableProperties, buildTableRowProperties, buildTableRowPropertiesChangeObj, buildTableWidthObj, buildTextDirection, buildThematicBreakObj, buildUnderlineObj, buildVerticalMerge, chartAttr, coerceMathJson, coerceSectionChild, concreteNumUniqueNumericIdGen, convertInchesToTwip, convertMillimetersToTwip, convertToXmlComponent, createAlignment, createBodyProperties, createBorderElement, createBreak, createCnfStyle, createColumns, createDataModel, createDivId, createDocumentGrid, createDotEmphasisMark, createEmphasisMark, createFormFieldData, createFrameProperties, createHeaderFooterReference, createHorizontalPosition, createIndent, createLineNumberType, createMathAccent, createMathAccentCharacter, createMathAccentProperties, createMathBar, createMathBarProperties, createMathBase, createMathBorderBoxProperties, createMathBoxProperties, createMathControlProperties, createMathEqArrProperties, createMathFractionProperties, createMathFunctionProperties, createMathGroupChrProperties, createMathLimitLocation, createMathLimitLowProperties, createMathLimitUpperProperties, createMathMatrixProperties, createMathNAryProperties, createMathPhantProperties, createMathPreSubSuperScriptProperties, createMathProperties, createMathRunProperties, createMathSubScriptElement, createMathSubScriptProperties, createMathSubSuperScriptProperties, createMathSuperScriptElement, createMathSuperScriptProperties, createOutlineLevel, createPageMargin, createPageNumberType, createPageSize, createParagraphStyle, createRuby, createRunFonts, createSectionType, createShading, createSimplePos, createSpacing, createStringElement, createTabStop, createTabStopItem, createTableFloatProperties, createTableLayout, createTableLook, createTableOverlap, createTableRowHeight, createTableWidthElement, createTransformation, createUnderline, createVerticalAlign, createVerticalPosition, createWrapNone, createWrapSquare, createWrapThrough, createWrapTight, createWrapTopAndBottom, docPropertiesUniqueNumericIdGen, getColorXml, getLayoutXml, getStyleXml, hashedId, hpsMeasureObj, numberValObj, onOffObj, parseArchive, parseDocument, parseDocx, parseMathChildren, patchDetector, patchDocument, sectionMarginDefaults, sectionPageSizeDefaults, stringContainerObj, stringEnumValObj, stringValObj, uniqueId, uniqueNumericIdCreator, uniqueUuid, wrapEl };
17990
+ export { AbstractNumbering, AlignmentType, AltChunk, AltChunkCollection, AnnotationReference, BaseXmlComponent, Bdo, Bibliography, Body, Bookmark, BookmarkEnd, BookmarkStart, Border, BorderStyle, BuilderElement, COLOR_CATEGORIES, CarriageReturn, CellMerge, CharacterSet, ChartCollection, ChartRun, ChartSpace, CheckBox, CheckBoxSymbolElement, CheckBoxUtil, Column, ColumnBreak, Comment, CommentRangeEnd, CommentRangeStart, CommentReference, Comments, ConcreteHyperlink, ConcreteNumbering, ContinuationSeparator, DEFAULT_DRAWING_XML, DayLong, DayShort, DeletedTableCell, DeletedTableRow, DeletedTextRun, Dir, File as Document, File, DocumentAttributeNamespaces, DocumentBackground, DocumentDefaults, DocumentGridType, Drawing, DropCapType, EMPTY_OBJECT, EditGroupType, EmphasisMarkType, EmptyElement, EndnoteIdReference, EndnoteReference, EndnoteReferenceRun, Endnotes, ExternalHyperlink, FootNotes, Footer, FooterWrapper, FootnoteReference, FootnoteReferenceElement, FootnoteReferenceRun, FormFieldTextType, FractionType, FrameAnchorType, FrameWrap, GridSpan, Header, HeaderFooterReferenceType, HeaderFooterType, HeaderWrapper, HeadingLevel, HeightRule, HighlightColor, HorizontalPositionAlign, HorizontalPositionRelativeFrom, HyperlinkType, IgnoreIfEmptyXmlComponent, ImageRun, ImportedRootElementAttributes, ImportedXmlComponent, InitializableXmlComponent, InsertedTableCell, InsertedTableRow, InsertedTextRun, InternalHyperlink, LAYOUT_CATEGORIES, LastRenderedPageBreak, LeaderType, Level, LevelBase, LevelForOverride, LevelFormat, LevelOverride, LevelSuffix, LineNumberRestartFormat, LineRuleType, Math$1 as Math, MathAngledBrackets, MathBorderBox, MathBox, MathCurlyBrackets, MathDegree, MathDenominator, MathEqArr, MathFraction, MathFunction, MathFunctionName, MathGroupChr, MathIntegral, MathLimit, MathLimitLower, MathLimitUpper, MathMatrix, MathNumerator, MathParagraph, MathPhant, MathPreSubSuperScript, MathRadical, MathRadicalProperties, MathRoundBrackets, MathRun, MathSquareBrackets, MathSubScript, MathSubSuperScript, MathSum, MathSuperScript, Media, MonthLong, MonthShort, MoveFromRangeEnd, MoveFromRangeStart, MoveToRangeEnd, MoveToRangeStart, MovedFromTextRun, MovedToTextRun, NoBreakHyphen, NumberFormat, NumberProperties, NumberedItemReference, NumberedItemReferenceFormat, Numbering, OverlapType, Packer, PageBorderDisplay, PageBorderOffsetFrom, PageBorderZOrder, PageBorders, PageBreak, PageBreakBefore, PageNumber, PageNumberElement, PageNumberSeparator, PageOrientation, PageReference, PageTextDirection, PageTextDirectionType, Paragraph, ParagraphProperties, ParagraphPropertiesChange, ParagraphPropertiesDefaults, ParagraphRunProperties, PatchType, PermEnd, PermStart, PositionalTab, PositionalTabAlignment, PositionalTabLeader, PositionalTabRelativeTo, RelativeHorizontalPosition, RelativeVerticalPosition, RubyAlign, Run, RunProperties, RunPropertiesChange, RunPropertiesDefaults, STYLE_CATEGORIES, SdtDateMappingType, SdtLock, SectionProperties, SectionPropertiesChange, SectionType, Separator, SequentialIdentifier, ShadingType, SimpleField, SimpleMailMergeField, SmartArtCollection, SmartArtRun, SoftHyphen, SpaceType, StructuredDocumentTagBlock, StructuredDocumentTagCell, StructuredDocumentTagContent, StructuredDocumentTagProperties, StructuredDocumentTagRow, StructuredDocumentTagRun, StyleForCharacter, StyleForParagraph, StyleLevel, Styles, SubDoc, SubDocCollection, SymbolRun, TDirection, Tab, TabStopPosition, TabStopType, Table, TableAnchorType, TableBorders, TableCell, TableCellBorders, TableLayoutType, TableOfContents, TableProperties, TablePropertyExceptions, TableRow, TableRowProperties, TableRowPropertiesChange, TextAlignmentType, TextBodyWrappingType, TextDirection, TextEffect, TextHorzOverflowType, TextRun, TextVertOverflowType, TextVerticalType, TextWrappingSide, TextWrappingType, Textbox, TextboxTightWrapType, ThematicBreak, UnderlineType, VerticalAlignSection, VerticalAlignTable, VerticalAnchor, VerticalMerge, VerticalMergeRevisionType, VerticalMergeType, VerticalPositionAlign, VerticalPositionRelativeFrom, WORKAROUND2, WORKAROUND4, WidthType, WpgGroupRun, WpsShapeRun, XmlComponent, YearLong, YearShort, abstractNumUniqueNumericIdGen, attrObj, bookmarkUniqueNumericIdGen, buildBorderObj, buildCellMergeObj, buildCnfStyleObj, buildDeletedTableCellObj, buildDeletedTableRowObj, buildDivIdObj, buildDocumentAttributes, buildEmphasisMarkObj, buildFramePropertiesObj, buildGridSpan, buildIndentObj, buildInsertedTableCellObj, buildInsertedTableRowObj, buildNumberProperties, buildOutlineLevelObj, buildParagraphBorders, buildParagraphProperties, buildRunFontsObj, buildRunProperties, buildShadingObj, buildSpacingObj, buildTabStopObj, buildTableBorders, buildTableCellBorders, buildTableFloatPropertiesObj, buildTableProperties, buildTableRowProperties, buildTableRowPropertiesChangeObj, buildTableWidthObj, buildTextDirection, buildThematicBreakObj, buildUnderlineObj, buildVerticalMerge, chartAttr, coerceMathJson, coerceSectionChild, concreteNumUniqueNumericIdGen, convertInchesToTwip, convertMillimetersToTwip, convertToXmlComponent, createAlignment, createBodyProperties, createBorderElement, createBreak, createCnfStyle, createColumns, createDataModel, createDivId, createDocumentGrid, createDotEmphasisMark, createEmphasisMark, createFormFieldData, createFrameProperties, createHeaderFooterReference, createHorizontalPosition, createIndent, createLineNumberType, createMathAccent, createMathAccentCharacter, createMathAccentProperties, createMathBar, createMathBarProperties, createMathBase, createMathBorderBoxProperties, createMathBoxProperties, createMathControlProperties, createMathEqArrProperties, createMathFractionProperties, createMathFunctionProperties, createMathGroupChrProperties, createMathLimitLocation, createMathLimitLowProperties, createMathLimitUpperProperties, createMathMatrixProperties, createMathNAryProperties, createMathPhantProperties, createMathPreSubSuperScriptProperties, createMathProperties, createMathRunProperties, createMathSubScriptElement, createMathSubScriptProperties, createMathSubSuperScriptProperties, createMathSuperScriptElement, createMathSuperScriptProperties, createOutlineLevel, createPageMargin, createPageNumberType, createPageSize, createParagraphStyle, createRuby, createRunFonts, createSectionType, createShading, createSimplePos, createSpacing, createStringElement, createTabStop, createTabStopItem, createTableFloatProperties, createTableLayout, createTableLook, createTableOverlap, createTableRowHeight, createTableWidthElement, createTransformation, createUnderline, createVerticalAlign, createVerticalPosition, createWrapNone, createWrapSquare, createWrapThrough, createWrapTight, createWrapTopAndBottom, docPropertiesUniqueNumericIdGen, getColorXml, getLayoutXml, getStyleXml, hashedId, hpsMeasureObj, numberValObj, onOffObj, parseArchive, parseDocument, parseDocx, parseMathChildren, patchDetector, patchDocument, sectionMarginDefaults, sectionPageSizeDefaults, stringContainerObj, stringEnumValObj, stringValObj, uniqueId, uniqueNumericIdCreator, uniqueUuid, wrapEl };
18223
17991
 
18224
17992
  //# sourceMappingURL=index.mjs.map