@harbour-enterprises/superdoc 0.24.0-next.2 → 0.24.0-next.3

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.
Files changed (39) hide show
  1. package/dist/chunks/{PdfViewer--Z8scsXq.es.js → PdfViewer-DEWI6Uts.es.js} +1 -1
  2. package/dist/chunks/{PdfViewer-CYiJzT44.cjs → PdfViewer-skWUtg2N.cjs} +1 -1
  3. package/dist/chunks/{index-CBSXpA57.cjs → index-2QL0aZ2S.cjs} +2 -2
  4. package/dist/chunks/{index-CCf_X9Jy.es.js → index-C_AMhrHP.es.js} +2 -2
  5. package/dist/chunks/{super-editor.es-CZFQdEKI.cjs → super-editor.es-CfK_qBM9.cjs} +1484 -897
  6. package/dist/chunks/{super-editor.es-BFco6Gra.es.js → super-editor.es-iMAoOYOw.es.js} +1484 -897
  7. package/dist/core/types/index.d.ts.map +1 -1
  8. package/dist/style.css +5 -4
  9. package/dist/super-editor/ai-writer.es.js +2 -2
  10. package/dist/super-editor/chunks/{converter-nWAUAQ83.js → converter-BueCftlx.js} +1167 -858
  11. package/dist/super-editor/chunks/{docx-zipper-B2uMUaj9.js → docx-zipper-C9jmfWYZ.js} +1 -1
  12. package/dist/super-editor/chunks/{editor-DAyiX5AL.js → editor-BsuNqVvp.js} +332 -53
  13. package/dist/super-editor/chunks/{toolbar-LmzuO_YJ.js → toolbar-DxhfgAoa.js} +2 -2
  14. package/dist/super-editor/converter.es.js +1 -1
  15. package/dist/super-editor/docx-zipper.es.js +2 -2
  16. package/dist/super-editor/editor.es.js +3 -3
  17. package/dist/super-editor/file-zipper.es.js +1 -1
  18. package/dist/super-editor/style.css +5 -4
  19. package/dist/super-editor/super-editor/src/core/super-converter/helpers.d.ts +22 -0
  20. package/dist/super-editor/super-editor/src/core/super-converter/v2/importer/docxImporter.d.ts +1 -0
  21. package/dist/super-editor/super-editor/src/core/super-converter/v2/importer/trackChangesImporter.d.ts +5 -0
  22. package/dist/super-editor/super-editor/src/core/super-converter/v2/importer/types/index.d.ts +1 -0
  23. package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/helpers.d.ts +1 -0
  24. package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/del/del-translator.d.ts +7 -0
  25. package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/del/index.d.ts +1 -0
  26. package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/ins/index.d.ts +1 -0
  27. package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/ins/ins-translator.d.ts +7 -0
  28. package/dist/super-editor/super-editor/src/extensions/image/image.d.ts +1 -1
  29. package/dist/super-editor/super-editor/src/extensions/image/imageHelpers/index.d.ts +1 -0
  30. package/dist/super-editor/super-editor/src/extensions/image/imageHelpers/legacyAttributes.d.ts +17 -0
  31. package/dist/super-editor/super-editor.es.js +7 -7
  32. package/dist/super-editor/toolbar.es.js +2 -2
  33. package/dist/super-editor.cjs +1 -1
  34. package/dist/super-editor.es.js +1 -1
  35. package/dist/superdoc.cjs +2 -2
  36. package/dist/superdoc.es.js +2 -2
  37. package/dist/superdoc.umd.js +1484 -897
  38. package/dist/superdoc.umd.js.map +1 -1
  39. package/package.json +1 -1
@@ -15107,14 +15107,21 @@ function twipsToInches(twips) {
15107
15107
  function twipsToPixels(twips) {
15108
15108
  if (twips == null) return;
15109
15109
  const inches = twipsToInches(twips);
15110
+ return inchesToPixels(inches);
15111
+ }
15112
+ function pixelsToTwips(pixels) {
15113
+ const inches = pixelsToInches(pixels);
15114
+ return inchesToTwips(inches);
15115
+ }
15116
+ function inchesToPixels(inches) {
15110
15117
  if (inches == null) return;
15111
15118
  const pixels = inches * 96;
15112
15119
  return Math.round(pixels * 1e3) / 1e3;
15113
15120
  }
15114
- function pixelsToTwips(pixels) {
15121
+ function pixelsToInches(pixels) {
15115
15122
  if (pixels == null) return;
15116
15123
  const inches = Number(pixels) / 96;
15117
- return inchesToTwips(inches);
15124
+ return inches;
15118
15125
  }
15119
15126
  function twipsToLines(twips) {
15120
15127
  if (twips == null) return;
@@ -15165,6 +15172,71 @@ function degreesToRot(degrees) {
15165
15172
  if (degrees == null) return;
15166
15173
  return degrees * 6e4;
15167
15174
  }
15175
+ function pixelsToPolygonUnits(pixels) {
15176
+ if (pixels == null) return;
15177
+ const pu = pixels * 96;
15178
+ return Math.round(pu);
15179
+ }
15180
+ function polygonUnitsToPixels(pu) {
15181
+ if (pu == null) return;
15182
+ const pixels = Number(pu) / 96;
15183
+ return Math.round(pixels * 1e3) / 1e3;
15184
+ }
15185
+ function polygonToObj(polygonNode) {
15186
+ if (!polygonNode) return null;
15187
+ const points = [];
15188
+ polygonNode.elements.forEach((element) => {
15189
+ if (["wp:start", "wp:lineTo"].includes(element.name)) {
15190
+ const { x, y: y2 } = element.attributes;
15191
+ points.push([polygonUnitsToPixels(x), polygonUnitsToPixels(y2)]);
15192
+ }
15193
+ });
15194
+ if (points.length > 1) {
15195
+ const firstPoint = points[0];
15196
+ const lastPoint = points[points.length - 1];
15197
+ if (firstPoint[0] === lastPoint[0] && firstPoint[1] === lastPoint[1]) {
15198
+ points.pop();
15199
+ }
15200
+ }
15201
+ return points;
15202
+ }
15203
+ function objToPolygon(points) {
15204
+ if (!points || !Array.isArray(points)) return null;
15205
+ const polygonNode = {
15206
+ name: "wp:wrapPolygon",
15207
+ type: "wp:wrapPolygon",
15208
+ attributes: {
15209
+ edited: "0"
15210
+ },
15211
+ elements: []
15212
+ };
15213
+ points.forEach((point, index2) => {
15214
+ const [x, y2] = point;
15215
+ const tagName = index2 === 0 ? "wp:start" : "wp:lineTo";
15216
+ const pointNode = {
15217
+ name: tagName,
15218
+ type: tagName,
15219
+ attributes: {
15220
+ x: pixelsToPolygonUnits(x),
15221
+ y: pixelsToPolygonUnits(y2)
15222
+ }
15223
+ };
15224
+ polygonNode.elements.push(pointNode);
15225
+ });
15226
+ if (points.length > 0) {
15227
+ const [startX, startY] = points[0];
15228
+ const closePointNode = {
15229
+ name: "wp:lineTo",
15230
+ type: "wp:lineTo",
15231
+ attributes: {
15232
+ x: pixelsToPolygonUnits(startX),
15233
+ y: pixelsToPolygonUnits(startY)
15234
+ }
15235
+ };
15236
+ polygonNode.elements.push(closePointNode);
15237
+ }
15238
+ return polygonNode;
15239
+ }
15168
15240
  const getTextIndentExportValue = (indent) => {
15169
15241
  const [value, unit] = parseSizeUnit(indent);
15170
15242
  const functionsMap = {
@@ -24480,37 +24552,37 @@ const _NodeTranslator = class _NodeTranslator2 {
24480
24552
  };
24481
24553
  __publicField$2(_NodeTranslator, "translatorTypes", TranslatorTypes);
24482
24554
  let NodeTranslator = _NodeTranslator;
24483
- const encode$1c = (attributes) => {
24555
+ const encode$1e = (attributes) => {
24484
24556
  return attributes["w:type"];
24485
24557
  };
24486
- const decode$14 = (attrs) => {
24558
+ const decode$16 = (attrs) => {
24487
24559
  const { lineBreakType } = attrs;
24488
24560
  return lineBreakType;
24489
24561
  };
24490
24562
  const attrConfig$G = Object.freeze({
24491
24563
  xmlName: "w:type",
24492
24564
  sdName: "lineBreakType",
24493
- encode: encode$1c,
24494
- decode: decode$14
24565
+ encode: encode$1e,
24566
+ decode: decode$16
24495
24567
  });
24496
- const encode$1b = (attributes) => {
24568
+ const encode$1d = (attributes) => {
24497
24569
  const xmlAttrValue = attributes["w:clear"];
24498
24570
  return xmlAttrValue;
24499
24571
  };
24500
- const decode$13 = (attrs) => {
24572
+ const decode$15 = (attrs) => {
24501
24573
  const { clear } = attrs;
24502
24574
  return clear;
24503
24575
  };
24504
24576
  const attrConfig$F = Object.freeze({
24505
24577
  xmlName: "w:clear",
24506
24578
  sdName: "clear",
24507
- encode: encode$1b,
24508
- decode: decode$13
24579
+ encode: encode$1d,
24580
+ decode: decode$15
24509
24581
  });
24510
- const validXmlAttributes$n = [attrConfig$G, attrConfig$F];
24511
- const XML_NODE_NAME$z = "w:br";
24582
+ const validXmlAttributes$p = [attrConfig$G, attrConfig$F];
24583
+ const XML_NODE_NAME$B = "w:br";
24512
24584
  const SD_NODE_NAME$h = "lineBreak";
24513
- const encode$1a = (_2, encodedAttrs) => {
24585
+ const encode$1c = (_2, encodedAttrs) => {
24514
24586
  const isPageBreak = encodedAttrs?.lineBreakType === "page";
24515
24587
  const translated = {
24516
24588
  type: isPageBreak ? "hardBreak" : "lineBreak"
@@ -24520,7 +24592,7 @@ const encode$1a = (_2, encodedAttrs) => {
24520
24592
  }
24521
24593
  return translated;
24522
24594
  };
24523
- const decode$12 = (params2, decodedAttrs) => {
24595
+ const decode$14 = (params2, decodedAttrs) => {
24524
24596
  const { node } = params2;
24525
24597
  if (!node) return;
24526
24598
  const wBreak = { name: "w:br" };
@@ -24537,39 +24609,39 @@ const decode$12 = (params2, decodedAttrs) => {
24537
24609
  };
24538
24610
  return translated;
24539
24611
  };
24540
- const config$w = {
24541
- xmlName: XML_NODE_NAME$z,
24612
+ const config$y = {
24613
+ xmlName: XML_NODE_NAME$B,
24542
24614
  sdNodeOrKeyName: SD_NODE_NAME$h,
24543
24615
  type: NodeTranslator.translatorTypes.NODE,
24544
- encode: encode$1a,
24545
- decode: decode$12,
24546
- attributes: validXmlAttributes$n
24616
+ encode: encode$1c,
24617
+ decode: decode$14,
24618
+ attributes: validXmlAttributes$p
24547
24619
  };
24548
- const translator$1a = NodeTranslator.from(config$w);
24549
- const encode$19 = (attributes) => attributes?.["w:val"];
24550
- const decode$11 = (attrs) => attrs?.highlight;
24620
+ const translator$1c = NodeTranslator.from(config$y);
24621
+ const encode$1b = (attributes) => attributes?.["w:val"];
24622
+ const decode$13 = (attrs) => attrs?.highlight;
24551
24623
  const attrConfig$E = Object.freeze({
24552
24624
  xmlName: "w:val",
24553
24625
  sdName: "highlight",
24554
- encode: encode$19,
24555
- decode: decode$11
24626
+ encode: encode$1b,
24627
+ decode: decode$13
24556
24628
  });
24557
- const validXmlAttributes$m = [attrConfig$E];
24558
- const XML_NODE_NAME$y = "w:highlight";
24559
- const SD_ATTR_KEY$g = "highlight";
24629
+ const validXmlAttributes$o = [attrConfig$E];
24630
+ const XML_NODE_NAME$A = "w:highlight";
24631
+ const SD_ATTR_KEY$i = "highlight";
24560
24632
  const DISABLED_TOKENS = /* @__PURE__ */ new Set(["transparent", "none", "inherit"]);
24561
- const encode$18 = (params2, encodedAttrs = {}) => {
24633
+ const encode$1a = (params2, encodedAttrs = {}) => {
24562
24634
  const { nodes } = params2;
24563
24635
  const node = nodes?.[0];
24564
24636
  const value = encodedAttrs.highlight ?? node?.attributes?.["w:val"];
24565
24637
  return {
24566
24638
  type: "attr",
24567
- xmlName: XML_NODE_NAME$y,
24568
- sdNodeOrKeyName: SD_ATTR_KEY$g,
24639
+ xmlName: XML_NODE_NAME$A,
24640
+ sdNodeOrKeyName: SD_ATTR_KEY$i,
24569
24641
  attributes: { "w:val": value ?? null }
24570
24642
  };
24571
24643
  };
24572
- const decode$10 = (params2) => {
24644
+ const decode$12 = (params2) => {
24573
24645
  const attrs = params2?.node?.attrs || {};
24574
24646
  const highlightValue = attrs.highlight ?? attrs.color ?? null;
24575
24647
  if (!highlightValue) return void 0;
@@ -24577,14 +24649,14 @@ const decode$10 = (params2) => {
24577
24649
  if (!normalizedValue) return void 0;
24578
24650
  if (DISABLED_TOKENS.has(normalizedValue)) {
24579
24651
  return {
24580
- name: XML_NODE_NAME$y,
24652
+ name: XML_NODE_NAME$A,
24581
24653
  attributes: { "w:val": "none" }
24582
24654
  };
24583
24655
  }
24584
24656
  const keyword = getDocxHighlightKeywordFromHex(highlightValue);
24585
24657
  if (keyword) {
24586
24658
  return {
24587
- name: XML_NODE_NAME$y,
24659
+ name: XML_NODE_NAME$A,
24588
24660
  attributes: { "w:val": keyword }
24589
24661
  };
24590
24662
  }
@@ -24599,63 +24671,63 @@ const decode$10 = (params2) => {
24599
24671
  }
24600
24672
  };
24601
24673
  };
24602
- const config$v = {
24603
- xmlName: XML_NODE_NAME$y,
24604
- sdNodeOrKeyName: SD_ATTR_KEY$g,
24674
+ const config$x = {
24675
+ xmlName: XML_NODE_NAME$A,
24676
+ sdNodeOrKeyName: SD_ATTR_KEY$i,
24605
24677
  type: NodeTranslator.translatorTypes.ATTRIBUTE,
24606
- encode: encode$18,
24607
- decode: decode$10,
24608
- attributes: validXmlAttributes$m
24678
+ encode: encode$1a,
24679
+ decode: decode$12,
24680
+ attributes: validXmlAttributes$o
24609
24681
  };
24610
- const translator$19 = NodeTranslator.from(config$v);
24611
- const encode$17 = (attributes) => {
24682
+ const translator$1b = NodeTranslator.from(config$x);
24683
+ const encode$19 = (attributes) => {
24612
24684
  return attributes["w:val"];
24613
24685
  };
24614
- const decode$$ = (attrs) => {
24686
+ const decode$11 = (attrs) => {
24615
24687
  const { tabSize } = attrs || {};
24616
24688
  return tabSize;
24617
24689
  };
24618
24690
  const attrConfig$D = Object.freeze({
24619
24691
  xmlName: "w:val",
24620
24692
  sdName: "tabSize",
24621
- encode: encode$17,
24622
- decode: decode$$
24693
+ encode: encode$19,
24694
+ decode: decode$11
24623
24695
  });
24624
- const encode$16 = (attributes) => {
24696
+ const encode$18 = (attributes) => {
24625
24697
  return attributes["w:leader"];
24626
24698
  };
24627
- const decode$_ = (attrs) => {
24699
+ const decode$10 = (attrs) => {
24628
24700
  const { leader } = attrs || {};
24629
24701
  return leader;
24630
24702
  };
24631
24703
  const attrConfig$C = Object.freeze({
24632
24704
  xmlName: "w:leader",
24633
24705
  sdName: "leader",
24634
- encode: encode$16,
24635
- decode: decode$_
24706
+ encode: encode$18,
24707
+ decode: decode$10
24636
24708
  });
24637
- const encode$15 = (attributes) => {
24709
+ const encode$17 = (attributes) => {
24638
24710
  return attributes["w:pos"];
24639
24711
  };
24640
- const decode$Z = (attrs) => {
24712
+ const decode$$ = (attrs) => {
24641
24713
  const { pos } = attrs || {};
24642
24714
  return pos;
24643
24715
  };
24644
24716
  const attrConfig$B = Object.freeze({
24645
24717
  xmlName: "w:pos",
24646
24718
  sdName: "pos",
24647
- encode: encode$15,
24648
- decode: decode$Z
24719
+ encode: encode$17,
24720
+ decode: decode$$
24649
24721
  });
24650
- const validXmlAttributes$l = [attrConfig$D, attrConfig$B, attrConfig$C];
24651
- const XML_NODE_NAME$x = "w:tab";
24722
+ const validXmlAttributes$n = [attrConfig$D, attrConfig$B, attrConfig$C];
24723
+ const XML_NODE_NAME$z = "w:tab";
24652
24724
  const SD_NODE_NAME$g = "tab";
24653
- const encode$14 = (_2, encodedAttrs = {}) => {
24725
+ const encode$16 = (_2, encodedAttrs = {}) => {
24654
24726
  const translated = { type: "tab" };
24655
24727
  if (encodedAttrs) translated.attrs = { ...encodedAttrs };
24656
24728
  return translated;
24657
24729
  };
24658
- const decode$Y = (params2, decodedAttrs = {}) => {
24730
+ const decode$_ = (params2, decodedAttrs = {}) => {
24659
24731
  const { node } = params2 || {};
24660
24732
  if (!node) return;
24661
24733
  const wTab = { name: "w:tab" };
@@ -24671,15 +24743,15 @@ const decode$Y = (params2, decodedAttrs = {}) => {
24671
24743
  }
24672
24744
  return translated;
24673
24745
  };
24674
- const config$u = {
24675
- xmlName: XML_NODE_NAME$x,
24746
+ const config$w = {
24747
+ xmlName: XML_NODE_NAME$z,
24676
24748
  sdNodeOrKeyName: SD_NODE_NAME$g,
24677
24749
  type: NodeTranslator.translatorTypes.NODE,
24678
- encode: encode$14,
24679
- decode: decode$Y,
24680
- attributes: validXmlAttributes$l
24750
+ encode: encode$16,
24751
+ decode: decode$_,
24752
+ attributes: validXmlAttributes$n
24681
24753
  };
24682
- const translator$18 = NodeTranslator.from(config$u);
24754
+ const translator$1a = NodeTranslator.from(config$w);
24683
24755
  const mergeTextNodes = (nodes) => {
24684
24756
  if (!nodes || !Array.isArray(nodes)) {
24685
24757
  return nodes;
@@ -25197,91 +25269,91 @@ const handleParagraphNode$1 = (params2) => {
25197
25269
  }
25198
25270
  return schemaNode;
25199
25271
  };
25200
- const encode$13 = (attributes) => {
25272
+ const encode$15 = (attributes) => {
25201
25273
  return attributes["w:rsidDel"];
25202
25274
  };
25203
- const decode$X = (attrs) => {
25275
+ const decode$Z = (attrs) => {
25204
25276
  return attrs.rsidDel;
25205
25277
  };
25206
25278
  const attrConfig$A = Object.freeze({
25207
25279
  xmlName: "w:rsidDel",
25208
25280
  sdName: "rsidDel",
25209
- encode: encode$13,
25210
- decode: decode$X
25281
+ encode: encode$15,
25282
+ decode: decode$Z
25211
25283
  });
25212
- const encode$12 = (attributes) => {
25284
+ const encode$14 = (attributes) => {
25213
25285
  return attributes["w:rsidP"];
25214
25286
  };
25215
- const decode$W = (attrs) => {
25287
+ const decode$Y = (attrs) => {
25216
25288
  return attrs.rsidP;
25217
25289
  };
25218
25290
  const attrConfig$z = Object.freeze({
25219
25291
  xmlName: "w:rsidP",
25220
25292
  sdName: "rsidP",
25221
- encode: encode$12,
25222
- decode: decode$W
25293
+ encode: encode$14,
25294
+ decode: decode$Y
25223
25295
  });
25224
- const encode$11 = (attributes) => {
25296
+ const encode$13 = (attributes) => {
25225
25297
  return attributes["w:rsidR"];
25226
25298
  };
25227
- const decode$V = (attrs) => {
25299
+ const decode$X = (attrs) => {
25228
25300
  return attrs.rsidR;
25229
25301
  };
25230
25302
  const attrConfig$y = Object.freeze({
25231
25303
  xmlName: "w:rsidR",
25232
25304
  sdName: "rsidR",
25233
- encode: encode$11,
25234
- decode: decode$V
25305
+ encode: encode$13,
25306
+ decode: decode$X
25235
25307
  });
25236
- const encode$10 = (attributes) => {
25308
+ const encode$12 = (attributes) => {
25237
25309
  return attributes["w:rsidRPr"];
25238
25310
  };
25239
- const decode$U = (attrs) => {
25311
+ const decode$W = (attrs) => {
25240
25312
  return attrs.rsidRPr;
25241
25313
  };
25242
25314
  const attrConfig$x = Object.freeze({
25243
25315
  xmlName: "w:rsidRPr",
25244
25316
  sdName: "rsidRPr",
25245
- encode: encode$10,
25246
- decode: decode$U
25317
+ encode: encode$12,
25318
+ decode: decode$W
25247
25319
  });
25248
- const encode$$ = (attributes) => {
25320
+ const encode$11 = (attributes) => {
25249
25321
  return attributes["w:rsidRDefault"];
25250
25322
  };
25251
- const decode$T = (attrs) => {
25323
+ const decode$V = (attrs) => {
25252
25324
  return attrs.rsidRDefault;
25253
25325
  };
25254
25326
  const attrConfig$w = Object.freeze({
25255
25327
  xmlName: "w:rsidRDefault",
25256
25328
  sdName: "rsidRDefault",
25257
- encode: encode$$,
25258
- decode: decode$T
25329
+ encode: encode$11,
25330
+ decode: decode$V
25259
25331
  });
25260
- const encode$_ = (attributes) => {
25332
+ const encode$10 = (attributes) => {
25261
25333
  return attributes["w14:paraId"];
25262
25334
  };
25263
- const decode$S = (attrs) => {
25335
+ const decode$U = (attrs) => {
25264
25336
  return attrs.paraId;
25265
25337
  };
25266
25338
  const attrConfig$v = Object.freeze({
25267
25339
  xmlName: "w14:paraId",
25268
25340
  sdName: "paraId",
25269
- encode: encode$_,
25270
- decode: decode$S
25341
+ encode: encode$10,
25342
+ decode: decode$U
25271
25343
  });
25272
- const encode$Z = (attributes) => {
25344
+ const encode$$ = (attributes) => {
25273
25345
  return attributes["w14:textId"];
25274
25346
  };
25275
- const decode$R = (attrs) => {
25347
+ const decode$T = (attrs) => {
25276
25348
  return attrs.textId;
25277
25349
  };
25278
25350
  const attrConfig$u = Object.freeze({
25279
25351
  xmlName: "w14:textId",
25280
25352
  sdName: "textId",
25281
- encode: encode$Z,
25282
- decode: decode$R
25353
+ encode: encode$$,
25354
+ decode: decode$T
25283
25355
  });
25284
- const validXmlAttributes$k = [
25356
+ const validXmlAttributes$m = [
25285
25357
  attrConfig$v,
25286
25358
  attrConfig$u,
25287
25359
  attrConfig$y,
@@ -25290,9 +25362,9 @@ const validXmlAttributes$k = [
25290
25362
  attrConfig$x,
25291
25363
  attrConfig$A
25292
25364
  ];
25293
- const XML_NODE_NAME$w = "w:p";
25365
+ const XML_NODE_NAME$y = "w:p";
25294
25366
  const SD_NODE_NAME$f = "paragraph";
25295
- const encode$Y = (params2, encodedAttrs = {}) => {
25367
+ const encode$_ = (params2, encodedAttrs = {}) => {
25296
25368
  const node = handleParagraphNode$1(params2);
25297
25369
  if (!node) return void 0;
25298
25370
  if (encodedAttrs && Object.keys(encodedAttrs).length) {
@@ -25300,7 +25372,7 @@ const encode$Y = (params2, encodedAttrs = {}) => {
25300
25372
  }
25301
25373
  return node;
25302
25374
  };
25303
- const decode$Q = (params2, decodedAttrs = {}) => {
25375
+ const decode$S = (params2, decodedAttrs = {}) => {
25304
25376
  const translated = translateParagraphNode(params2);
25305
25377
  if (!translated) return void 0;
25306
25378
  if (decodedAttrs && Object.keys(decodedAttrs).length) {
@@ -25308,16 +25380,16 @@ const decode$Q = (params2, decodedAttrs = {}) => {
25308
25380
  }
25309
25381
  return translated;
25310
25382
  };
25311
- const config$t = {
25312
- xmlName: XML_NODE_NAME$w,
25383
+ const config$v = {
25384
+ xmlName: XML_NODE_NAME$y,
25313
25385
  sdNodeOrKeyName: SD_NODE_NAME$f,
25314
25386
  type: NodeTranslator.translatorTypes.NODE,
25315
- encode: encode$Y,
25316
- decode: decode$Q,
25317
- attributes: validXmlAttributes$k
25387
+ encode: encode$_,
25388
+ decode: decode$S,
25389
+ attributes: validXmlAttributes$m
25318
25390
  };
25319
- const translator$17 = NodeTranslator.from(config$t);
25320
- const encode$X = (attributes) => {
25391
+ const translator$19 = NodeTranslator.from(config$v);
25392
+ const encode$Z = (attributes) => {
25321
25393
  const raw = attributes?.["w:val"];
25322
25394
  if (raw === void 0 || raw === null) return void 0;
25323
25395
  if (typeof raw === "boolean") return raw;
@@ -25327,24 +25399,24 @@ const encode$X = (attributes) => {
25327
25399
  if (val === "1" || val === "true" || val === "on") return true;
25328
25400
  return void 0;
25329
25401
  };
25330
- const decode$P = (runProps) => {
25402
+ const decode$R = (runProps) => {
25331
25403
  if (runProps?.bold === false) return "0";
25332
25404
  return void 0;
25333
25405
  };
25334
25406
  const attrConfig$t = Object.freeze({
25335
25407
  xmlName: "w:val",
25336
25408
  sdName: "bold",
25337
- encode: encode$X,
25338
- decode: decode$P
25409
+ encode: encode$Z,
25410
+ decode: decode$R
25339
25411
  });
25340
- const validXmlAttributes$j = [attrConfig$t];
25341
- const XML_NODE_NAME$v = "w:b";
25342
- const SD_ATTR_KEY$f = "bold";
25343
- const encode$W = (params2, encodedAttrs = {}) => {
25412
+ const validXmlAttributes$l = [attrConfig$t];
25413
+ const XML_NODE_NAME$x = "w:b";
25414
+ const SD_ATTR_KEY$h = "bold";
25415
+ const encode$Y = (params2, encodedAttrs = {}) => {
25344
25416
  const { nodes } = params2;
25345
25417
  const node = nodes[0];
25346
25418
  if (!node) return void 0;
25347
- const val = encodedAttrs?.[SD_ATTR_KEY$f];
25419
+ const val = encodedAttrs?.[SD_ATTR_KEY$h];
25348
25420
  let attributes;
25349
25421
  if (val === false) attributes = { "w:val": "0" };
25350
25422
  else if (val === true)
@@ -25352,85 +25424,85 @@ const encode$W = (params2, encodedAttrs = {}) => {
25352
25424
  else attributes = node.attributes || {};
25353
25425
  return {
25354
25426
  type: "attr",
25355
- xmlName: XML_NODE_NAME$v,
25356
- sdNodeOrKeyName: SD_ATTR_KEY$f,
25427
+ xmlName: XML_NODE_NAME$x,
25428
+ sdNodeOrKeyName: SD_ATTR_KEY$h,
25357
25429
  attributes
25358
25430
  };
25359
25431
  };
25360
- const config$s = {
25361
- xmlName: XML_NODE_NAME$v,
25362
- sdNodeOrKeyName: SD_ATTR_KEY$f,
25432
+ const config$u = {
25433
+ xmlName: XML_NODE_NAME$x,
25434
+ sdNodeOrKeyName: SD_ATTR_KEY$h,
25363
25435
  type: NodeTranslator.translatorTypes.ATTRIBUTE,
25364
- encode: encode$W,
25365
- attributes: validXmlAttributes$j
25436
+ encode: encode$Y,
25437
+ attributes: validXmlAttributes$l
25366
25438
  };
25367
- const translator$16 = NodeTranslator.from(config$s);
25368
- const XML_NODE_NAME$u = "w:i";
25369
- const SD_ATTR_KEY$e = "italic";
25370
- const encode$V = (params2) => {
25439
+ const translator$18 = NodeTranslator.from(config$u);
25440
+ const XML_NODE_NAME$w = "w:i";
25441
+ const SD_ATTR_KEY$g = "italic";
25442
+ const encode$X = (params2) => {
25371
25443
  const { nodes } = params2;
25372
25444
  const node = nodes?.[0];
25373
25445
  if (!node) return void 0;
25374
25446
  return {
25375
25447
  type: "attr",
25376
- xmlName: XML_NODE_NAME$u,
25377
- sdNodeOrKeyName: SD_ATTR_KEY$e,
25448
+ xmlName: XML_NODE_NAME$w,
25449
+ sdNodeOrKeyName: SD_ATTR_KEY$g,
25378
25450
  attributes: {
25379
25451
  "w:val": node.attributes?.["w:val"] ?? null
25380
25452
  }
25381
25453
  };
25382
25454
  };
25383
- const config$r = {
25384
- xmlName: XML_NODE_NAME$u,
25385
- sdNodeOrKeyName: SD_ATTR_KEY$e,
25455
+ const config$t = {
25456
+ xmlName: XML_NODE_NAME$w,
25457
+ sdNodeOrKeyName: SD_ATTR_KEY$g,
25386
25458
  type: NodeTranslator.translatorTypes.ATTRIBUTE,
25387
- encode: encode$V
25459
+ encode: encode$X
25388
25460
  };
25389
- const translator$15 = NodeTranslator.from(config$r);
25390
- const encode$U = (attributes) => attributes?.["w:val"];
25391
- const decode$O = (attrs) => attrs?.underline;
25461
+ const translator$17 = NodeTranslator.from(config$t);
25462
+ const encode$W = (attributes) => attributes?.["w:val"];
25463
+ const decode$Q = (attrs) => attrs?.underline;
25392
25464
  const attrConfig$s = Object.freeze({
25393
25465
  xmlName: "w:val",
25394
25466
  sdName: "underline",
25395
- encode: encode$U,
25396
- decode: decode$O
25467
+ encode: encode$W,
25468
+ decode: decode$Q
25397
25469
  });
25398
- const encode$T = (attributes) => attributes?.["w:color"];
25399
- const decode$N = (attrs) => attrs?.color;
25470
+ const encode$V = (attributes) => attributes?.["w:color"];
25471
+ const decode$P = (attrs) => attrs?.color;
25400
25472
  const attrConfig$r = Object.freeze({
25401
25473
  xmlName: "w:color",
25402
25474
  sdName: "color",
25403
- encode: encode$T,
25404
- decode: decode$N
25475
+ encode: encode$V,
25476
+ decode: decode$P
25405
25477
  });
25406
- const encode$S = (attributes) => attributes?.["w:themeColor"];
25407
- const decode$M = (attrs) => attrs?.themeColor;
25478
+ const encode$U = (attributes) => attributes?.["w:themeColor"];
25479
+ const decode$O = (attrs) => attrs?.themeColor;
25408
25480
  const attrConfig$q = Object.freeze({
25409
25481
  xmlName: "w:themeColor",
25410
25482
  sdName: "themeColor",
25411
- encode: encode$S,
25412
- decode: decode$M
25483
+ encode: encode$U,
25484
+ decode: decode$O
25413
25485
  });
25414
- const encode$R = (attributes) => attributes?.["w:themeTint"];
25415
- const decode$L = (attrs) => attrs?.themeTint;
25486
+ const encode$T = (attributes) => attributes?.["w:themeTint"];
25487
+ const decode$N = (attrs) => attrs?.themeTint;
25416
25488
  const attrConfig$p = Object.freeze({
25417
25489
  xmlName: "w:themeTint",
25418
25490
  sdName: "themeTint",
25419
- encode: encode$R,
25420
- decode: decode$L
25491
+ encode: encode$T,
25492
+ decode: decode$N
25421
25493
  });
25422
- const encode$Q = (attributes) => attributes?.["w:themeShade"];
25423
- const decode$K = (attrs) => attrs?.themeShade;
25494
+ const encode$S = (attributes) => attributes?.["w:themeShade"];
25495
+ const decode$M = (attrs) => attrs?.themeShade;
25424
25496
  const attrConfig$o = Object.freeze({
25425
25497
  xmlName: "w:themeShade",
25426
25498
  sdName: "themeShade",
25427
- encode: encode$Q,
25428
- decode: decode$K
25499
+ encode: encode$S,
25500
+ decode: decode$M
25429
25501
  });
25430
- const validXmlAttributes$i = [attrConfig$s, attrConfig$r, attrConfig$q, attrConfig$p, attrConfig$o];
25431
- const XML_NODE_NAME$t = "w:u";
25432
- const SD_ATTR_KEY$d = "underline";
25433
- const encode$P = (params2, encodedAttrs = {}) => {
25502
+ const validXmlAttributes$k = [attrConfig$s, attrConfig$r, attrConfig$q, attrConfig$p, attrConfig$o];
25503
+ const XML_NODE_NAME$v = "w:u";
25504
+ const SD_ATTR_KEY$f = "underline";
25505
+ const encode$R = (params2, encodedAttrs = {}) => {
25434
25506
  const { nodes } = params2;
25435
25507
  const node = nodes?.[0];
25436
25508
  const sourceAttrs = node?.attributes || {};
@@ -25446,12 +25518,12 @@ const encode$P = (params2, encodedAttrs = {}) => {
25446
25518
  if (themeShade !== void 0 && themeShade !== null) attributes["w:themeShade"] = themeShade;
25447
25519
  return {
25448
25520
  type: "attr",
25449
- xmlName: XML_NODE_NAME$t,
25450
- sdNodeOrKeyName: SD_ATTR_KEY$d,
25521
+ xmlName: XML_NODE_NAME$v,
25522
+ sdNodeOrKeyName: SD_ATTR_KEY$f,
25451
25523
  attributes
25452
25524
  };
25453
25525
  };
25454
- const decode$J = (params2) => {
25526
+ const decode$L = (params2) => {
25455
25527
  const attrs = params2?.node?.attrs || {};
25456
25528
  const underlineType = attrs.underlineType ?? attrs.underline ?? null;
25457
25529
  const color = attrs.underlineColor ?? attrs.color ?? null;
@@ -25469,20 +25541,20 @@ const decode$J = (params2) => {
25469
25541
  if (themeTint) attributes["w:themeTint"] = themeTint;
25470
25542
  if (themeShade) attributes["w:themeShade"] = themeShade;
25471
25543
  return {
25472
- name: XML_NODE_NAME$t,
25544
+ name: XML_NODE_NAME$v,
25473
25545
  attributes
25474
25546
  };
25475
25547
  };
25476
- const config$q = {
25477
- xmlName: XML_NODE_NAME$t,
25478
- sdNodeOrKeyName: SD_ATTR_KEY$d,
25548
+ const config$s = {
25549
+ xmlName: XML_NODE_NAME$v,
25550
+ sdNodeOrKeyName: SD_ATTR_KEY$f,
25479
25551
  type: NodeTranslator.translatorTypes.ATTRIBUTE,
25480
- encode: encode$P,
25481
- decode: decode$J,
25482
- attributes: validXmlAttributes$i
25552
+ encode: encode$R,
25553
+ decode: decode$L,
25554
+ attributes: validXmlAttributes$k
25483
25555
  };
25484
- const translator$14 = NodeTranslator.from(config$q);
25485
- const encode$O = (attributes) => {
25556
+ const translator$16 = NodeTranslator.from(config$s);
25557
+ const encode$Q = (attributes) => {
25486
25558
  const raw = attributes?.["w:val"];
25487
25559
  if (raw === void 0 || raw === null) return void 0;
25488
25560
  if (typeof raw === "boolean") return raw;
@@ -25492,24 +25564,24 @@ const encode$O = (attributes) => {
25492
25564
  if (val === "1" || val === "true" || val === "on") return true;
25493
25565
  return void 0;
25494
25566
  };
25495
- const decode$I = (attrs) => {
25567
+ const decode$K = (attrs) => {
25496
25568
  if (attrs?.strike === false) return "0";
25497
25569
  return void 0;
25498
25570
  };
25499
25571
  const attrConfig$n = Object.freeze({
25500
25572
  xmlName: "w:val",
25501
25573
  sdName: "strike",
25502
- encode: encode$O,
25503
- decode: decode$I
25574
+ encode: encode$Q,
25575
+ decode: decode$K
25504
25576
  });
25505
- const validXmlAttributes$h = [attrConfig$n];
25506
- const XML_NODE_NAME$s = "w:strike";
25507
- const SD_ATTR_KEY$c = "strike";
25508
- const encode$N = (params2, encodedAttrs = {}) => {
25577
+ const validXmlAttributes$j = [attrConfig$n];
25578
+ const XML_NODE_NAME$u = "w:strike";
25579
+ const SD_ATTR_KEY$e = "strike";
25580
+ const encode$P = (params2, encodedAttrs = {}) => {
25509
25581
  const { nodes } = params2;
25510
25582
  const node = nodes?.[0];
25511
25583
  if (!node) return void 0;
25512
- const val = encodedAttrs?.[SD_ATTR_KEY$c];
25584
+ const val = encodedAttrs?.[SD_ATTR_KEY$e];
25513
25585
  let attributes;
25514
25586
  if (val === false) attributes = { "w:val": "0" };
25515
25587
  else if (val === true) attributes = {};
@@ -25518,55 +25590,55 @@ const encode$N = (params2, encodedAttrs = {}) => {
25518
25590
  else if (val === true && attributes["w:val"] === void 0) delete attributes["w:val"];
25519
25591
  return {
25520
25592
  type: "attr",
25521
- xmlName: XML_NODE_NAME$s,
25522
- sdNodeOrKeyName: SD_ATTR_KEY$c,
25593
+ xmlName: XML_NODE_NAME$u,
25594
+ sdNodeOrKeyName: SD_ATTR_KEY$e,
25523
25595
  attributes
25524
25596
  };
25525
25597
  };
25526
- const config$p = {
25527
- xmlName: XML_NODE_NAME$s,
25528
- sdNodeOrKeyName: SD_ATTR_KEY$c,
25598
+ const config$r = {
25599
+ xmlName: XML_NODE_NAME$u,
25600
+ sdNodeOrKeyName: SD_ATTR_KEY$e,
25529
25601
  type: NodeTranslator.translatorTypes.ATTRIBUTE,
25530
- encode: encode$N,
25531
- attributes: validXmlAttributes$h
25602
+ encode: encode$P,
25603
+ attributes: validXmlAttributes$j
25532
25604
  };
25533
- const translator$13 = NodeTranslator.from(config$p);
25534
- const encode$M = (attributes) => attributes?.["w:val"];
25535
- const decode$H = (attrs) => attrs?.color;
25605
+ const translator$15 = NodeTranslator.from(config$r);
25606
+ const encode$O = (attributes) => attributes?.["w:val"];
25607
+ const decode$J = (attrs) => attrs?.color;
25536
25608
  const attrConfig$m = Object.freeze({
25537
25609
  xmlName: "w:val",
25538
25610
  sdName: "color",
25539
- encode: encode$M,
25540
- decode: decode$H
25611
+ encode: encode$O,
25612
+ decode: decode$J
25541
25613
  });
25542
- const encode$L = (attributes) => attributes?.["w:themeColor"];
25543
- const decode$G = (attrs) => attrs?.themeColor;
25614
+ const encode$N = (attributes) => attributes?.["w:themeColor"];
25615
+ const decode$I = (attrs) => attrs?.themeColor;
25544
25616
  const attrConfig$l = Object.freeze({
25545
25617
  xmlName: "w:themeColor",
25546
25618
  sdName: "themeColor",
25547
- encode: encode$L,
25548
- decode: decode$G
25619
+ encode: encode$N,
25620
+ decode: decode$I
25549
25621
  });
25550
- const encode$K = (attributes) => attributes?.["w:themeTint"];
25551
- const decode$F = (attrs) => attrs?.themeTint;
25622
+ const encode$M = (attributes) => attributes?.["w:themeTint"];
25623
+ const decode$H = (attrs) => attrs?.themeTint;
25552
25624
  const attrConfig$k = Object.freeze({
25553
25625
  xmlName: "w:themeTint",
25554
25626
  sdName: "themeTint",
25555
- encode: encode$K,
25556
- decode: decode$F
25627
+ encode: encode$M,
25628
+ decode: decode$H
25557
25629
  });
25558
- const encode$J = (attributes) => attributes?.["w:themeShade"];
25559
- const decode$E = (attrs) => attrs?.themeShade;
25630
+ const encode$L = (attributes) => attributes?.["w:themeShade"];
25631
+ const decode$G = (attrs) => attrs?.themeShade;
25560
25632
  const attrConfig$j = Object.freeze({
25561
25633
  xmlName: "w:themeShade",
25562
25634
  sdName: "themeShade",
25563
- encode: encode$J,
25564
- decode: decode$E
25635
+ encode: encode$L,
25636
+ decode: decode$G
25565
25637
  });
25566
- const validXmlAttributes$g = [attrConfig$m, attrConfig$l, attrConfig$k, attrConfig$j];
25567
- const XML_NODE_NAME$r = "w:color";
25568
- const SD_ATTR_KEY$b = "color";
25569
- const encode$I = (params2, encodedAttrs = {}) => {
25638
+ const validXmlAttributes$i = [attrConfig$m, attrConfig$l, attrConfig$k, attrConfig$j];
25639
+ const XML_NODE_NAME$t = "w:color";
25640
+ const SD_ATTR_KEY$d = "color";
25641
+ const encode$K = (params2, encodedAttrs = {}) => {
25570
25642
  const { nodes } = params2;
25571
25643
  const node = nodes?.[0];
25572
25644
  const sourceAttrs = node?.attributes || {};
@@ -25581,63 +25653,63 @@ const encode$I = (params2, encodedAttrs = {}) => {
25581
25653
  if (themeShade !== void 0 && themeShade !== null) attributes["w:themeShade"] = themeShade;
25582
25654
  return {
25583
25655
  type: "attr",
25584
- xmlName: XML_NODE_NAME$r,
25585
- sdNodeOrKeyName: SD_ATTR_KEY$b,
25656
+ xmlName: XML_NODE_NAME$t,
25657
+ sdNodeOrKeyName: SD_ATTR_KEY$d,
25586
25658
  attributes
25587
25659
  };
25588
25660
  };
25589
- const config$o = {
25590
- xmlName: XML_NODE_NAME$r,
25591
- sdNodeOrKeyName: SD_ATTR_KEY$b,
25661
+ const config$q = {
25662
+ xmlName: XML_NODE_NAME$t,
25663
+ sdNodeOrKeyName: SD_ATTR_KEY$d,
25592
25664
  type: NodeTranslator.translatorTypes.ATTRIBUTE,
25593
- encode: encode$I,
25594
- attributes: validXmlAttributes$g
25665
+ encode: encode$K,
25666
+ attributes: validXmlAttributes$i
25595
25667
  };
25596
- const translator$12 = NodeTranslator.from(config$o);
25597
- const encode$H = (attributes) => attributes?.["w:eastAsia"];
25598
- const decode$D = (attrs) => attrs?.eastAsia;
25668
+ const translator$14 = NodeTranslator.from(config$q);
25669
+ const encode$J = (attributes) => attributes?.["w:eastAsia"];
25670
+ const decode$F = (attrs) => attrs?.eastAsia;
25599
25671
  const attrConfig$i = Object.freeze({
25600
25672
  xmlName: "w:eastAsia",
25601
25673
  sdName: "eastAsia",
25602
- encode: encode$H,
25603
- decode: decode$D
25674
+ encode: encode$J,
25675
+ decode: decode$F
25604
25676
  });
25605
- const encode$G = (attributes) => attributes?.["w:ascii"];
25606
- const decode$C = (attrs) => attrs?.ascii;
25677
+ const encode$I = (attributes) => attributes?.["w:ascii"];
25678
+ const decode$E = (attrs) => attrs?.ascii;
25607
25679
  const attrConfig$h = Object.freeze({
25608
25680
  xmlName: "w:ascii",
25609
25681
  sdName: "ascii",
25610
- encode: encode$G,
25611
- decode: decode$C
25682
+ encode: encode$I,
25683
+ decode: decode$E
25612
25684
  });
25613
- const encode$F = (attributes) => attributes?.["w:hAnsi"];
25614
- const decode$B = (attrs) => attrs?.hAnsi;
25685
+ const encode$H = (attributes) => attributes?.["w:hAnsi"];
25686
+ const decode$D = (attrs) => attrs?.hAnsi;
25615
25687
  const attrConfig$g = Object.freeze({
25616
25688
  xmlName: "w:hAnsi",
25617
25689
  sdName: "hAnsi",
25618
- encode: encode$F,
25619
- decode: decode$B
25690
+ encode: encode$H,
25691
+ decode: decode$D
25620
25692
  });
25621
- const encode$E = (attributes) => attributes?.["w:cs"];
25622
- const decode$A = (attrs) => attrs?.cs;
25693
+ const encode$G = (attributes) => attributes?.["w:cs"];
25694
+ const decode$C = (attrs) => attrs?.cs;
25623
25695
  const attrConfig$f = Object.freeze({
25624
25696
  xmlName: "w:cs",
25625
25697
  sdName: "cs",
25626
- encode: encode$E,
25627
- decode: decode$A
25698
+ encode: encode$G,
25699
+ decode: decode$C
25628
25700
  });
25629
- const encode$D = (attributes) => attributes?.["w:val"];
25630
- const decode$z = (attrs) => attrs?.value;
25701
+ const encode$F = (attributes) => attributes?.["w:val"];
25702
+ const decode$B = (attrs) => attrs?.value;
25631
25703
  const attrConfig$e = Object.freeze({
25632
25704
  xmlName: "w:val",
25633
25705
  sdName: "value",
25634
- encode: encode$D,
25635
- decode: decode$z
25706
+ encode: encode$F,
25707
+ decode: decode$B
25636
25708
  });
25637
- const validXmlAttributes$f = [attrConfig$i, attrConfig$h, attrConfig$g, attrConfig$f, attrConfig$e];
25638
- const XML_NODE_NAME$q = "w:rFonts";
25639
- const SD_ATTR_KEY$a = "fontFamily";
25640
- const encode$C = (params2, encodedAttrs = {}) => {
25709
+ const validXmlAttributes$h = [attrConfig$i, attrConfig$h, attrConfig$g, attrConfig$f, attrConfig$e];
25710
+ const XML_NODE_NAME$s = "w:rFonts";
25711
+ const SD_ATTR_KEY$c = "fontFamily";
25712
+ const encode$E = (params2, encodedAttrs = {}) => {
25641
25713
  const { nodes } = params2;
25642
25714
  const node = nodes?.[0];
25643
25715
  const sourceAttrs = node?.attributes || {};
@@ -25663,109 +25735,109 @@ const encode$C = (params2, encodedAttrs = {}) => {
25663
25735
  if (attributes["w:val"] === void 0) delete attributes["w:val"];
25664
25736
  return {
25665
25737
  type: "attr",
25666
- xmlName: XML_NODE_NAME$q,
25667
- sdNodeOrKeyName: SD_ATTR_KEY$a,
25738
+ xmlName: XML_NODE_NAME$s,
25739
+ sdNodeOrKeyName: SD_ATTR_KEY$c,
25668
25740
  attributes
25669
25741
  };
25670
25742
  };
25671
- const config$n = {
25672
- xmlName: XML_NODE_NAME$q,
25673
- sdNodeOrKeyName: SD_ATTR_KEY$a,
25743
+ const config$p = {
25744
+ xmlName: XML_NODE_NAME$s,
25745
+ sdNodeOrKeyName: SD_ATTR_KEY$c,
25674
25746
  type: NodeTranslator.translatorTypes.ATTRIBUTE,
25675
- encode: encode$C,
25676
- attributes: validXmlAttributes$f
25747
+ encode: encode$E,
25748
+ attributes: validXmlAttributes$h
25677
25749
  };
25678
- const translator$11 = NodeTranslator.from(config$n);
25679
- const encode$B = (attributes) => attributes?.["w:val"];
25680
- const decode$y = (attrs) => attrs?.styleId;
25750
+ const translator$13 = NodeTranslator.from(config$p);
25751
+ const encode$D = (attributes) => attributes?.["w:val"];
25752
+ const decode$A = (attrs) => attrs?.styleId;
25681
25753
  const attrConfig$d = Object.freeze({
25682
25754
  xmlName: "w:val",
25683
25755
  sdName: "styleId",
25684
- encode: encode$B,
25685
- decode: decode$y
25756
+ encode: encode$D,
25757
+ decode: decode$A
25686
25758
  });
25687
- const validXmlAttributes$e = [attrConfig$d];
25688
- const XML_NODE_NAME$p = "w:rStyle";
25689
- const SD_ATTR_KEY$9 = "styleId";
25690
- const encode$A = (params2, encodedAttrs = {}) => {
25759
+ const validXmlAttributes$g = [attrConfig$d];
25760
+ const XML_NODE_NAME$r = "w:rStyle";
25761
+ const SD_ATTR_KEY$b = "styleId";
25762
+ const encode$C = (params2, encodedAttrs = {}) => {
25691
25763
  const { nodes } = params2;
25692
25764
  const node = nodes?.[0];
25693
25765
  const value = encodedAttrs.styleId ?? node?.attributes?.["w:val"];
25694
25766
  return {
25695
25767
  type: "attr",
25696
- xmlName: XML_NODE_NAME$p,
25697
- sdNodeOrKeyName: SD_ATTR_KEY$9,
25768
+ xmlName: XML_NODE_NAME$r,
25769
+ sdNodeOrKeyName: SD_ATTR_KEY$b,
25698
25770
  attributes: { "w:val": value ?? null }
25699
25771
  };
25700
25772
  };
25701
- const config$m = {
25702
- xmlName: XML_NODE_NAME$p,
25703
- sdNodeOrKeyName: SD_ATTR_KEY$9,
25773
+ const config$o = {
25774
+ xmlName: XML_NODE_NAME$r,
25775
+ sdNodeOrKeyName: SD_ATTR_KEY$b,
25704
25776
  type: NodeTranslator.translatorTypes.ATTRIBUTE,
25705
- encode: encode$A,
25706
- attributes: validXmlAttributes$e
25777
+ encode: encode$C,
25778
+ attributes: validXmlAttributes$g
25707
25779
  };
25708
- const translator$10 = NodeTranslator.from(config$m);
25709
- const encode$z = (attributes) => attributes?.["w:val"];
25710
- const decode$x = (attrs) => attrs?.fontSize;
25780
+ const translator$12 = NodeTranslator.from(config$o);
25781
+ const encode$B = (attributes) => attributes?.["w:val"];
25782
+ const decode$z = (attrs) => attrs?.fontSize;
25711
25783
  const attrConfig$c = Object.freeze({
25712
25784
  xmlName: "w:val",
25713
25785
  sdName: "fontSize",
25714
- encode: encode$z,
25715
- decode: decode$x
25786
+ encode: encode$B,
25787
+ decode: decode$z
25716
25788
  });
25717
- const validXmlAttributes$d = [attrConfig$c];
25718
- const XML_NODE_NAME$o = "w:sz";
25719
- const SD_ATTR_KEY$8 = "fontSize";
25720
- const encode$y = (params2, encodedAttrs = {}) => {
25789
+ const validXmlAttributes$f = [attrConfig$c];
25790
+ const XML_NODE_NAME$q = "w:sz";
25791
+ const SD_ATTR_KEY$a = "fontSize";
25792
+ const encode$A = (params2, encodedAttrs = {}) => {
25721
25793
  const { nodes } = params2;
25722
25794
  const node = nodes?.[0];
25723
25795
  const value = encodedAttrs.fontSize ?? node?.attributes?.["w:val"];
25724
25796
  return {
25725
25797
  type: "attr",
25726
- xmlName: XML_NODE_NAME$o,
25727
- sdNodeOrKeyName: SD_ATTR_KEY$8,
25798
+ xmlName: XML_NODE_NAME$q,
25799
+ sdNodeOrKeyName: SD_ATTR_KEY$a,
25728
25800
  attributes: { "w:val": value ?? null }
25729
25801
  };
25730
25802
  };
25731
- const config$l = {
25732
- xmlName: XML_NODE_NAME$o,
25733
- sdNodeOrKeyName: SD_ATTR_KEY$8,
25803
+ const config$n = {
25804
+ xmlName: XML_NODE_NAME$q,
25805
+ sdNodeOrKeyName: SD_ATTR_KEY$a,
25734
25806
  type: NodeTranslator.translatorTypes.ATTRIBUTE,
25735
- encode: encode$y,
25736
- attributes: validXmlAttributes$d
25807
+ encode: encode$A,
25808
+ attributes: validXmlAttributes$f
25737
25809
  };
25738
- const translator$$ = NodeTranslator.from(config$l);
25739
- const encode$x = (attributes) => attributes?.["w:val"];
25740
- const decode$w = (attrs) => attrs?.fontSizeCs;
25810
+ const translator$11 = NodeTranslator.from(config$n);
25811
+ const encode$z = (attributes) => attributes?.["w:val"];
25812
+ const decode$y = (attrs) => attrs?.fontSizeCs;
25741
25813
  const attrConfig$b = Object.freeze({
25742
25814
  xmlName: "w:val",
25743
25815
  sdName: "fontSizeCs",
25744
- encode: encode$x,
25745
- decode: decode$w
25816
+ encode: encode$z,
25817
+ decode: decode$y
25746
25818
  });
25747
- const validXmlAttributes$c = [attrConfig$b];
25748
- const XML_NODE_NAME$n = "w:szCs";
25749
- const SD_ATTR_KEY$7 = "fontSizeCs";
25750
- const encode$w = (params2, encodedAttrs = {}) => {
25819
+ const validXmlAttributes$e = [attrConfig$b];
25820
+ const XML_NODE_NAME$p = "w:szCs";
25821
+ const SD_ATTR_KEY$9 = "fontSizeCs";
25822
+ const encode$y = (params2, encodedAttrs = {}) => {
25751
25823
  const { nodes } = params2;
25752
25824
  const node = nodes?.[0];
25753
25825
  const value = encodedAttrs.fontSizeCs ?? node?.attributes?.["w:val"];
25754
25826
  return {
25755
25827
  type: "attr",
25756
- xmlName: XML_NODE_NAME$n,
25757
- sdNodeOrKeyName: SD_ATTR_KEY$7,
25828
+ xmlName: XML_NODE_NAME$p,
25829
+ sdNodeOrKeyName: SD_ATTR_KEY$9,
25758
25830
  attributes: { "w:val": value ?? null }
25759
25831
  };
25760
25832
  };
25761
- const config$k = {
25762
- xmlName: XML_NODE_NAME$n,
25763
- sdNodeOrKeyName: SD_ATTR_KEY$7,
25833
+ const config$m = {
25834
+ xmlName: XML_NODE_NAME$p,
25835
+ sdNodeOrKeyName: SD_ATTR_KEY$9,
25764
25836
  type: NodeTranslator.translatorTypes.ATTRIBUTE,
25765
- encode: encode$w,
25766
- attributes: validXmlAttributes$c
25837
+ encode: encode$y,
25838
+ attributes: validXmlAttributes$e
25767
25839
  };
25768
- const translator$_ = NodeTranslator.from(config$k);
25840
+ const translator$10 = NodeTranslator.from(config$m);
25769
25841
  const generateV2HandlerEntity = (handlerName, translator2) => ({
25770
25842
  handlerName,
25771
25843
  handler: (params2) => {
@@ -25899,9 +25971,9 @@ const integerToString = (value) => {
25899
25971
  const intValue = parseInteger(value);
25900
25972
  return intValue != void 0 ? String(intValue) : void 0;
25901
25973
  };
25902
- const XML_NODE_NAME$m = "w:caps";
25903
- const SD_ATTR_KEY$6 = "textTransform";
25904
- const encode$v = (params2, encodedAttrs = {}) => {
25974
+ const XML_NODE_NAME$o = "w:caps";
25975
+ const SD_ATTR_KEY$8 = "textTransform";
25976
+ const encode$x = (params2, encodedAttrs = {}) => {
25905
25977
  const { nodes } = params2;
25906
25978
  const node = nodes[0];
25907
25979
  if (!node) return void 0;
@@ -25913,31 +25985,31 @@ const encode$v = (params2, encodedAttrs = {}) => {
25913
25985
  }
25914
25986
  return {
25915
25987
  type: "attr",
25916
- xmlName: XML_NODE_NAME$m,
25917
- sdNodeOrKeyName: SD_ATTR_KEY$6,
25918
- attributes: { [SD_ATTR_KEY$6]: result }
25988
+ xmlName: XML_NODE_NAME$o,
25989
+ sdNodeOrKeyName: SD_ATTR_KEY$8,
25990
+ attributes: { [SD_ATTR_KEY$8]: result }
25919
25991
  };
25920
25992
  };
25921
- const config$j = {
25922
- xmlName: XML_NODE_NAME$m,
25923
- sdNodeOrKeyName: SD_ATTR_KEY$6,
25993
+ const config$l = {
25994
+ xmlName: XML_NODE_NAME$o,
25995
+ sdNodeOrKeyName: SD_ATTR_KEY$8,
25924
25996
  type: NodeTranslator.translatorTypes.ATTRIBUTE,
25925
- encode: encode$v,
25997
+ encode: encode$x,
25926
25998
  attributes: [createAttributeHandler("w:val")]
25927
25999
  };
25928
- const translator$Z = NodeTranslator.from(config$j);
26000
+ const translator$$ = NodeTranslator.from(config$l);
25929
26001
  const runPropertyTranslators = Object.freeze({
25930
- "w:b": translator$16,
25931
- "w:i": translator$15,
25932
- "w:u": translator$14,
25933
- "w:strike": translator$13,
25934
- "w:color": translator$12,
25935
- "w:highlight": translator$19,
25936
- "w:rFonts": translator$11,
25937
- "w:rStyle": translator$10,
25938
- "w:sz": translator$$,
25939
- "w:szCs": translator$_,
25940
- "w:caps": translator$Z
26002
+ "w:b": translator$18,
26003
+ "w:i": translator$17,
26004
+ "w:u": translator$16,
26005
+ "w:strike": translator$15,
26006
+ "w:color": translator$14,
26007
+ "w:highlight": translator$1b,
26008
+ "w:rFonts": translator$13,
26009
+ "w:rStyle": translator$12,
26010
+ "w:sz": translator$11,
26011
+ "w:szCs": translator$10,
26012
+ "w:caps": translator$$
25941
26013
  });
25942
26014
  const rawRunPropertyXmlNames = Object.freeze(["w:lang", "w:shd"]);
25943
26015
  const RAW_CHILD_NAME_SET = new Set(rawRunPropertyXmlNames);
@@ -25951,9 +26023,9 @@ const toRunPropertyEntry = (candidate) => {
25951
26023
  attributes: { ...candidate.attributes || {} }
25952
26024
  };
25953
26025
  };
25954
- const XML_NODE_NAME$l = "w:rPr";
25955
- const SD_ATTR_KEY$5 = "runProperties";
25956
- const encode$u = (params2) => {
26026
+ const XML_NODE_NAME$n = "w:rPr";
26027
+ const SD_ATTR_KEY$7 = "runProperties";
26028
+ const encode$w = (params2) => {
25957
26029
  const { nodes } = params2;
25958
26030
  const node = nodes?.[0] || {};
25959
26031
  const contents = Array.isArray(node.elements) ? node.elements : [];
@@ -25987,16 +26059,16 @@ const encode$u = (params2) => {
25987
26059
  attributes: runPropsArray
25988
26060
  };
25989
26061
  };
25990
- const config$i = {
25991
- xmlName: XML_NODE_NAME$l,
25992
- sdNodeOrKeyName: SD_ATTR_KEY$5,
26062
+ const config$k = {
26063
+ xmlName: XML_NODE_NAME$n,
26064
+ sdNodeOrKeyName: SD_ATTR_KEY$7,
25993
26065
  type: NodeTranslator.translatorTypes.ATTRIBUTE,
25994
- encode: encode$u
26066
+ encode: encode$w
25995
26067
  };
25996
- const translator$Y = NodeTranslator.from(config$i);
26068
+ const translator$_ = NodeTranslator.from(config$k);
25997
26069
  const EAST_ASIAN_CHARACTER_REGEX = /[\u1100-\u11FF\u2E80-\u2EFF\u2F00-\u2FDF\u3040-\u30FF\u3100-\u312F\u3130-\u318F\u31A0-\u31BF\u3400-\u4DBF\u4E00-\u9FFF\uA960-\uA97F\uAC00-\uD7AF\uF900-\uFAFF\uFF00-\uFFEF]/u;
25998
26070
  const containsEastAsianCharacters = (text) => EAST_ASIAN_CHARACTER_REGEX.test(text);
25999
- const collectRunProperties = (params2, rPrNode, translator2 = translator$Y) => {
26071
+ const collectRunProperties = (params2, rPrNode, translator2 = translator$_) => {
26000
26072
  if (!rPrNode) return { entries: [], hadRPr: false, styleChangeMarks: [] };
26001
26073
  const result = translator2.encode({ ...params2, nodes: [rPrNode] }) || {};
26002
26074
  let entries = [];
@@ -26469,7 +26541,7 @@ const ensureTrackedWrapper = (runs, trackingMarksByType = /* @__PURE__ */ new Ma
26469
26541
  }
26470
26542
  return runs;
26471
26543
  };
26472
- const XML_NODE_NAME$k = "w:hyperlink";
26544
+ const XML_NODE_NAME$m = "w:hyperlink";
26473
26545
  const SD_NODE_NAME$e = "link";
26474
26546
  const _createAttributeHandler = (xmlName, sdName) => ({
26475
26547
  xmlName,
@@ -26477,7 +26549,7 @@ const _createAttributeHandler = (xmlName, sdName) => ({
26477
26549
  encode: (attributes) => attributes[xmlName],
26478
26550
  decode: (attributes) => attributes[sdName]
26479
26551
  });
26480
- const validXmlAttributes$b = [
26552
+ const validXmlAttributes$d = [
26481
26553
  _createAttributeHandler("w:anchor", "anchor"),
26482
26554
  _createAttributeHandler("w:docLocation", "docLocation"),
26483
26555
  {
@@ -26490,7 +26562,7 @@ const validXmlAttributes$b = [
26490
26562
  _createAttributeHandler("r:id", "rId"),
26491
26563
  _createAttributeHandler("w:tgtFrame", "target")
26492
26564
  ];
26493
- const encode$t = (params2, encodedAttrs) => {
26565
+ const encode$v = (params2, encodedAttrs) => {
26494
26566
  const { nodes, docx, nodeListHandler } = params2;
26495
26567
  const node = nodes[0];
26496
26568
  let href = _resolveHref(docx, encodedAttrs);
@@ -26524,7 +26596,7 @@ const _resolveHref = (docx, encodedAttrs) => {
26524
26596
  }
26525
26597
  return href;
26526
26598
  };
26527
- function decode$v(params2) {
26599
+ function decode$x(params2) {
26528
26600
  const { hyperlinkGroup = [params2.node] } = params2.extraParams || {};
26529
26601
  const node = hyperlinkGroup[0];
26530
26602
  const linkMark = node.marks.find((m2) => m2.type === "link");
@@ -26573,55 +26645,55 @@ function _addNewLinkRelationship(params2, link) {
26573
26645
  });
26574
26646
  return id;
26575
26647
  }
26576
- const config$h = {
26577
- xmlName: XML_NODE_NAME$k,
26648
+ const config$j = {
26649
+ xmlName: XML_NODE_NAME$m,
26578
26650
  sdNodeOrKeyName: SD_NODE_NAME$e,
26579
26651
  type: NodeTranslator.translatorTypes.NODE,
26580
- encode: encode$t,
26581
- decode: decode$v,
26582
- attributes: validXmlAttributes$b
26652
+ encode: encode$v,
26653
+ decode: decode$x,
26654
+ attributes: validXmlAttributes$d
26583
26655
  };
26584
- const translator$X = NodeTranslator.from(config$h);
26585
- const encode$s = (attributes) => {
26656
+ const translator$Z = NodeTranslator.from(config$j);
26657
+ const encode$u = (attributes) => {
26586
26658
  return attributes["w:rsidR"];
26587
26659
  };
26588
- const decode$u = (attrs) => {
26660
+ const decode$w = (attrs) => {
26589
26661
  return attrs.rsidR;
26590
26662
  };
26591
26663
  const attrConfig$a = Object.freeze({
26592
26664
  xmlName: "w:rsidR",
26593
26665
  sdName: "rsidR",
26594
- encode: encode$s,
26595
- decode: decode$u
26666
+ encode: encode$u,
26667
+ decode: decode$w
26596
26668
  });
26597
- const encode$r = (attributes) => {
26669
+ const encode$t = (attributes) => {
26598
26670
  return attributes["w:rsidRPr"];
26599
26671
  };
26600
- const decode$t = (attrs) => {
26672
+ const decode$v = (attrs) => {
26601
26673
  return attrs.rsidRPr;
26602
26674
  };
26603
26675
  const attrConfig$9 = Object.freeze({
26604
26676
  xmlName: "w:rsidRPr",
26605
26677
  sdName: "rsidRPr",
26606
- encode: encode$r,
26607
- decode: decode$t
26678
+ encode: encode$t,
26679
+ decode: decode$v
26608
26680
  });
26609
- const encode$q = (attributes) => {
26681
+ const encode$s = (attributes) => {
26610
26682
  return attributes["w:rsidDel"];
26611
26683
  };
26612
- const decode$s = (attrs) => {
26684
+ const decode$u = (attrs) => {
26613
26685
  return attrs.rsidDel;
26614
26686
  };
26615
26687
  const attrConfig$8 = Object.freeze({
26616
26688
  xmlName: "w:rsidDel",
26617
26689
  sdName: "rsidDel",
26618
- encode: encode$q,
26619
- decode: decode$s
26690
+ encode: encode$s,
26691
+ decode: decode$u
26620
26692
  });
26621
- const validXmlAttributes$a = [attrConfig$a, attrConfig$9, attrConfig$8];
26622
- const XML_NODE_NAME$j = "w:r";
26693
+ const validXmlAttributes$c = [attrConfig$a, attrConfig$9, attrConfig$8];
26694
+ const XML_NODE_NAME$l = "w:r";
26623
26695
  const SD_KEY_NAME = "run";
26624
- const encode$p = (params2, encodedAttrs = {}) => {
26696
+ const encode$r = (params2, encodedAttrs = {}) => {
26625
26697
  const { nodes = [], nodeListHandler } = params2 || {};
26626
26698
  const runNode = nodes[0];
26627
26699
  if (!runNode) return void 0;
@@ -26669,7 +26741,7 @@ const encode$p = (params2, encodedAttrs = {}) => {
26669
26741
  }
26670
26742
  return runNodeResult;
26671
26743
  };
26672
- const decode$r = (params2, decodedAttrs = {}) => {
26744
+ const decode$t = (params2, decodedAttrs = {}) => {
26673
26745
  const { node } = params2 || {};
26674
26746
  if (!node) return void 0;
26675
26747
  const isLinkNode = node.marks?.some((m2) => m2.type === "link");
@@ -26678,7 +26750,7 @@ const decode$r = (params2, decodedAttrs = {}) => {
26678
26750
  ...params2.extraParams,
26679
26751
  linkProcessed: true
26680
26752
  };
26681
- return translator$X.decode({ ...params2, extraParams });
26753
+ return translator$Z.decode({ ...params2, extraParams });
26682
26754
  }
26683
26755
  const { runNode: runNodeForExport, trackingMarksByType } = prepareRunTrackingContext(node);
26684
26756
  const runAttrs = runNodeForExport.attrs || {};
@@ -26734,7 +26806,7 @@ const decode$r = (params2, decodedAttrs = {}) => {
26734
26806
  runs.push(trackedClone);
26735
26807
  return;
26736
26808
  }
26737
- const runWrapper = { name: XML_NODE_NAME$j, elements: [] };
26809
+ const runWrapper = { name: XML_NODE_NAME$l, elements: [] };
26738
26810
  applyBaseRunProps(runWrapper);
26739
26811
  if (!Array.isArray(runWrapper.elements)) runWrapper.elements = [];
26740
26812
  runWrapper.elements.push(cloneXmlNode(child));
@@ -26742,7 +26814,7 @@ const decode$r = (params2, decodedAttrs = {}) => {
26742
26814
  });
26743
26815
  const trackedRuns = ensureTrackedWrapper(runs, trackingMarksByType);
26744
26816
  if (!trackedRuns.length) {
26745
- const emptyRun = { name: XML_NODE_NAME$j, elements: [] };
26817
+ const emptyRun = { name: XML_NODE_NAME$l, elements: [] };
26746
26818
  applyBaseRunProps(emptyRun);
26747
26819
  trackedRuns.push(emptyRun);
26748
26820
  }
@@ -26756,15 +26828,15 @@ const decode$r = (params2, decodedAttrs = {}) => {
26756
26828
  }
26757
26829
  return trackedRuns;
26758
26830
  };
26759
- const config$g = {
26760
- xmlName: XML_NODE_NAME$j,
26831
+ const config$i = {
26832
+ xmlName: XML_NODE_NAME$l,
26761
26833
  sdNodeOrKeyName: SD_KEY_NAME,
26762
26834
  type: NodeTranslator.translatorTypes.NODE,
26763
- encode: encode$p,
26764
- decode: decode$r,
26765
- attributes: validXmlAttributes$a
26835
+ encode: encode$r,
26836
+ decode: decode$t,
26837
+ attributes: validXmlAttributes$c
26766
26838
  };
26767
- const translator$W = NodeTranslator.from(config$g);
26839
+ const translator$Y = NodeTranslator.from(config$i);
26768
26840
  function preProcessVerticalMergeCells(table, { editorSchema }) {
26769
26841
  if (!table || !Array.isArray(table.content)) {
26770
26842
  return table;
@@ -26805,13 +26877,13 @@ function preProcessVerticalMergeCells(table, { editorSchema }) {
26805
26877
  }
26806
26878
  return table;
26807
26879
  }
26808
- const translator$V = NodeTranslator.from({
26880
+ const translator$X = NodeTranslator.from({
26809
26881
  xmlName: "w:cantSplit",
26810
26882
  sdNodeOrKeyName: "cantSplit",
26811
26883
  encode: ({ nodes }) => ["1", "true"].includes(nodes[0].attributes?.["w:val"] ?? "1"),
26812
26884
  decode: ({ node }) => node.attrs?.cantSplit ? { attributes: {} } : void 0
26813
26885
  });
26814
- const translator$U = NodeTranslator.from({
26886
+ const translator$W = NodeTranslator.from({
26815
26887
  xmlName: "w:cnfStyle",
26816
26888
  sdNodeOrKeyName: "cnfStyle",
26817
26889
  attributes: [
@@ -26837,8 +26909,8 @@ const translator$U = NodeTranslator.from({
26837
26909
  return Object.keys(decodedAttrs).length > 0 ? { attributes: decodedAttrs } : void 0;
26838
26910
  }
26839
26911
  });
26840
- const translator$T = NodeTranslator.from(createSingleAttrPropertyHandler("w:divId"));
26841
- const translator$S = NodeTranslator.from(
26912
+ const translator$V = NodeTranslator.from(createSingleAttrPropertyHandler("w:divId"));
26913
+ const translator$U = NodeTranslator.from(
26842
26914
  createSingleAttrPropertyHandler(
26843
26915
  "w:gridAfter",
26844
26916
  null,
@@ -26847,7 +26919,7 @@ const translator$S = NodeTranslator.from(
26847
26919
  (v2) => integerToString(v2)
26848
26920
  )
26849
26921
  );
26850
- const translator$R = NodeTranslator.from(
26922
+ const translator$T = NodeTranslator.from(
26851
26923
  createSingleAttrPropertyHandler(
26852
26924
  "w:gridBefore",
26853
26925
  null,
@@ -26856,21 +26928,21 @@ const translator$R = NodeTranslator.from(
26856
26928
  (v2) => integerToString(v2)
26857
26929
  )
26858
26930
  );
26859
- const translator$Q = NodeTranslator.from({
26931
+ const translator$S = NodeTranslator.from({
26860
26932
  xmlName: "w:hidden",
26861
26933
  sdNodeOrKeyName: "hidden",
26862
26934
  encode: ({ nodes }) => parseBoolean(nodes[0].attributes?.["w:val"] ?? "1"),
26863
26935
  decode: ({ node }) => node.attrs.hidden ? { attributes: {} } : void 0
26864
26936
  });
26865
- const translator$P = NodeTranslator.from(createSingleAttrPropertyHandler("w:jc", "justification"));
26866
- const translator$O = NodeTranslator.from(createMeasurementPropertyHandler("w:tblCellSpacing", "tableCellSpacing"));
26867
- const translator$N = NodeTranslator.from({
26937
+ const translator$R = NodeTranslator.from(createSingleAttrPropertyHandler("w:jc", "justification"));
26938
+ const translator$Q = NodeTranslator.from(createMeasurementPropertyHandler("w:tblCellSpacing", "tableCellSpacing"));
26939
+ const translator$P = NodeTranslator.from({
26868
26940
  xmlName: "w:tblHeader",
26869
26941
  sdNodeOrKeyName: "repeatHeader",
26870
26942
  encode: ({ nodes }) => parseBoolean(nodes[0].attributes?.["w:val"] ?? "1"),
26871
26943
  decode: ({ node }) => node.attrs.repeatHeader ? { attributes: {} } : void 0
26872
26944
  });
26873
- const translator$M = NodeTranslator.from({
26945
+ const translator$O = NodeTranslator.from({
26874
26946
  xmlName: "w:trHeight",
26875
26947
  sdNodeOrKeyName: "rowHeight",
26876
26948
  encode: ({ nodes }) => {
@@ -26897,11 +26969,11 @@ const translator$M = NodeTranslator.from({
26897
26969
  return Object.keys(heightAttrs).length > 0 ? { attributes: heightAttrs } : void 0;
26898
26970
  }
26899
26971
  });
26900
- const translator$L = NodeTranslator.from(createMeasurementPropertyHandler("w:wAfter"));
26901
- const translator$K = NodeTranslator.from(createMeasurementPropertyHandler("w:wBefore"));
26902
- const XML_NODE_NAME$i = "w:trPr";
26903
- const SD_ATTR_KEY$4 = "tableRowProperties";
26904
- const encode$o = (params2) => {
26972
+ const translator$N = NodeTranslator.from(createMeasurementPropertyHandler("w:wAfter"));
26973
+ const translator$M = NodeTranslator.from(createMeasurementPropertyHandler("w:wBefore"));
26974
+ const XML_NODE_NAME$k = "w:trPr";
26975
+ const SD_ATTR_KEY$6 = "tableRowProperties";
26976
+ const encode$q = (params2) => {
26905
26977
  const { nodes } = params2;
26906
26978
  const node = nodes[0];
26907
26979
  let attributes = {
@@ -26915,12 +26987,12 @@ const encode$o = (params2) => {
26915
26987
  };
26916
26988
  return {
26917
26989
  type: NodeTranslator.translatorTypes.ATTRIBUTE,
26918
- xmlName: XML_NODE_NAME$i,
26919
- sdNodeOrKeyName: SD_ATTR_KEY$4,
26990
+ xmlName: XML_NODE_NAME$k,
26991
+ sdNodeOrKeyName: SD_ATTR_KEY$6,
26920
26992
  attributes
26921
26993
  };
26922
26994
  };
26923
- const decode$q = (params2) => {
26995
+ const decode$s = (params2) => {
26924
26996
  const { tableRowProperties = {} } = params2.node.attrs || {};
26925
26997
  const elements = decodeProperties(propertyTranslatorsBySdName$2, tableRowProperties);
26926
26998
  const newNode = {
@@ -26932,6 +27004,8 @@ const decode$q = (params2) => {
26932
27004
  return newNode;
26933
27005
  };
26934
27006
  const propertyTranslators$3 = [
27007
+ translator$X,
27008
+ translator$W,
26935
27009
  translator$V,
26936
27010
  translator$U,
26937
27011
  translator$T,
@@ -26941,9 +27015,7 @@ const propertyTranslators$3 = [
26941
27015
  translator$P,
26942
27016
  translator$O,
26943
27017
  translator$N,
26944
- translator$M,
26945
- translator$L,
26946
- translator$K
27018
+ translator$M
26947
27019
  ];
26948
27020
  const propertyTranslatorsByXmlName$2 = {};
26949
27021
  propertyTranslators$3.forEach((translator2) => {
@@ -26953,25 +27025,25 @@ const propertyTranslatorsBySdName$2 = {};
26953
27025
  propertyTranslators$3.forEach((translator2) => {
26954
27026
  propertyTranslatorsBySdName$2[translator2.sdNodeOrKeyName] = translator2;
26955
27027
  });
26956
- const config$f = {
26957
- xmlName: XML_NODE_NAME$i,
26958
- sdNodeOrKeyName: SD_ATTR_KEY$4,
27028
+ const config$h = {
27029
+ xmlName: XML_NODE_NAME$k,
27030
+ sdNodeOrKeyName: SD_ATTR_KEY$6,
26959
27031
  type: NodeTranslator.translatorTypes.ATTRIBUTE,
26960
- encode: encode$o,
26961
- decode: decode$q
27032
+ encode: encode$q,
27033
+ decode: decode$s
26962
27034
  };
26963
- const translator$J = NodeTranslator.from(config$f);
26964
- const XML_NODE_NAME$h = "w:tr";
27035
+ const translator$L = NodeTranslator.from(config$h);
27036
+ const XML_NODE_NAME$j = "w:tr";
26965
27037
  const SD_NODE_NAME$d = "tableRow";
26966
- const validXmlAttributes$9 = ["w:rsidDel", "w:rsidR", "w:rsidRPr", "w:rsidTr", "w14:paraId", "w14:textId"].map(
27038
+ const validXmlAttributes$b = ["w:rsidDel", "w:rsidR", "w:rsidRPr", "w:rsidTr", "w14:paraId", "w14:textId"].map(
26967
27039
  (xmlName) => createAttributeHandler(xmlName)
26968
27040
  );
26969
- const encode$n = (params2, encodedAttrs) => {
27041
+ const encode$p = (params2, encodedAttrs) => {
26970
27042
  const { row } = params2.extraParams;
26971
27043
  let tableRowProperties = {};
26972
27044
  const tPr = row.elements.find((el) => el.name === "w:trPr");
26973
27045
  if (tPr) {
26974
- ({ attributes: tableRowProperties } = translator$J.encode({
27046
+ ({ attributes: tableRowProperties } = translator$L.encode({
26975
27047
  ...params2,
26976
27048
  nodes: [tPr]
26977
27049
  }));
@@ -26984,7 +27056,7 @@ const encode$n = (params2, encodedAttrs) => {
26984
27056
  let currentColumnIndex = 0;
26985
27057
  const content = cellNodes?.map((n) => {
26986
27058
  let columnWidth = gridColumnWidths?.[currentColumnIndex] || null;
26987
- const result = translator$a.encode({
27059
+ const result = translator$c.encode({
26988
27060
  ...params2,
26989
27061
  extraParams: {
26990
27062
  ...params2.extraParams,
@@ -27006,7 +27078,7 @@ const encode$n = (params2, encodedAttrs) => {
27006
27078
  };
27007
27079
  return newNode;
27008
27080
  };
27009
- const decode$p = (params2, decodedAttrs) => {
27081
+ const decode$r = (params2, decodedAttrs) => {
27010
27082
  const { node } = params2;
27011
27083
  const elements = translateChildNodes(params2);
27012
27084
  if (node.attrs?.tableRowProperties) {
@@ -27018,7 +27090,7 @@ const decode$p = (params2, decodedAttrs) => {
27018
27090
  }
27019
27091
  }
27020
27092
  tableRowProperties["cantSplit"] = node.attrs["cantSplit"];
27021
- const trPr = translator$J.decode({
27093
+ const trPr = translator$L.decode({
27022
27094
  ...params2,
27023
27095
  node: { ...node, attrs: { ...node.attrs, tableRowProperties } }
27024
27096
  });
@@ -27030,22 +27102,22 @@ const decode$p = (params2, decodedAttrs) => {
27030
27102
  elements
27031
27103
  };
27032
27104
  };
27033
- const config$e = {
27034
- xmlName: XML_NODE_NAME$h,
27105
+ const config$g = {
27106
+ xmlName: XML_NODE_NAME$j,
27035
27107
  sdNodeOrKeyName: SD_NODE_NAME$d,
27036
27108
  type: NodeTranslator.translatorTypes.NODE,
27037
- encode: encode$n,
27038
- decode: decode$p,
27039
- attributes: validXmlAttributes$9
27109
+ encode: encode$p,
27110
+ decode: decode$r,
27111
+ attributes: validXmlAttributes$b
27040
27112
  };
27041
- const translator$I = NodeTranslator.from(config$e);
27042
- const translator$H = NodeTranslator.from({
27113
+ const translator$K = NodeTranslator.from(config$g);
27114
+ const translator$J = NodeTranslator.from({
27043
27115
  xmlName: "w:bidiVisual",
27044
27116
  sdNodeOrKeyName: "rightToLeft",
27045
27117
  encode: ({ nodes }) => parseBoolean(nodes[0].attributes?.["w:val"] ?? "1"),
27046
27118
  decode: ({ node }) => node.attrs.rightToLeft ? { attributes: {} } : void 0
27047
27119
  });
27048
- const translator$G = NodeTranslator.from({
27120
+ const translator$I = NodeTranslator.from({
27049
27121
  xmlName: "w:shd",
27050
27122
  sdNodeOrKeyName: "shading",
27051
27123
  attributes: [
@@ -27067,11 +27139,11 @@ const translator$G = NodeTranslator.from({
27067
27139
  return Object.keys(decodedAttrs).length > 0 ? { attributes: decodedAttrs } : void 0;
27068
27140
  }
27069
27141
  });
27070
- const translator$F = NodeTranslator.from(createSingleAttrPropertyHandler("w:tblCaption", "caption"));
27071
- const translator$E = NodeTranslator.from(createSingleAttrPropertyHandler("w:tblDescription", "description"));
27072
- const translator$D = NodeTranslator.from(createMeasurementPropertyHandler("w:tblInd", "tableIndent"));
27073
- const translator$C = NodeTranslator.from(createSingleAttrPropertyHandler("w:tblLayout", "tableLayout", "w:type"));
27074
- const translator$B = NodeTranslator.from({
27142
+ const translator$H = NodeTranslator.from(createSingleAttrPropertyHandler("w:tblCaption", "caption"));
27143
+ const translator$G = NodeTranslator.from(createSingleAttrPropertyHandler("w:tblDescription", "description"));
27144
+ const translator$F = NodeTranslator.from(createMeasurementPropertyHandler("w:tblInd", "tableIndent"));
27145
+ const translator$E = NodeTranslator.from(createSingleAttrPropertyHandler("w:tblLayout", "tableLayout", "w:type"));
27146
+ const translator$D = NodeTranslator.from({
27075
27147
  xmlName: "w:tblLook",
27076
27148
  sdNodeOrKeyName: "tblLook",
27077
27149
  attributes: ["w:firstColumn", "w:firstRow", "w:lastColumn", "w:lastRow", "w:noHBand", "w:noVBand"].map((attr) => createAttributeHandler(attr, null, parseBoolean, booleanToString)).concat([createAttributeHandler("w:val")]),
@@ -27083,16 +27155,16 @@ const translator$B = NodeTranslator.from({
27083
27155
  return Object.keys(decodedAttrs).length > 0 ? { attributes: decodedAttrs } : void 0;
27084
27156
  }
27085
27157
  });
27086
- const translator$A = NodeTranslator.from(createSingleAttrPropertyHandler("w:tblOverlap", "overlap"));
27087
- const translator$z = NodeTranslator.from(createSingleAttrPropertyHandler("w:tblStyle", "tableStyleId"));
27088
- const translator$y = NodeTranslator.from(
27158
+ const translator$C = NodeTranslator.from(createSingleAttrPropertyHandler("w:tblOverlap", "overlap"));
27159
+ const translator$B = NodeTranslator.from(createSingleAttrPropertyHandler("w:tblStyle", "tableStyleId"));
27160
+ const translator$A = NodeTranslator.from(
27089
27161
  createSingleAttrPropertyHandler("w:tblStyleColBandSize", "tableStyleColBandSize")
27090
27162
  );
27091
- const translator$x = NodeTranslator.from(
27163
+ const translator$z = NodeTranslator.from(
27092
27164
  createSingleAttrPropertyHandler("w:tblStyleRowBandSize", "tableStyleRowBandSize")
27093
27165
  );
27094
- const translator$w = NodeTranslator.from(createMeasurementPropertyHandler("w:tblW", "tableWidth"));
27095
- const translator$v = NodeTranslator.from({
27166
+ const translator$y = NodeTranslator.from(createMeasurementPropertyHandler("w:tblW", "tableWidth"));
27167
+ const translator$x = NodeTranslator.from({
27096
27168
  xmlName: "w:tblpPr",
27097
27169
  sdNodeOrKeyName: "floatingTableProperties",
27098
27170
  attributes: ["w:leftFromText", "w:rightFromText", "w:topFromText", "w:bottomFromText", "w:tblpX", "w:tblpY"].map((attr) => createAttributeHandler(attr, null, parseInteger, integerToString)).concat(["w:horzAnchor", "w:vertAnchor", "w:tblpXSpec", "w:tblpYSpec"].map((attr) => createAttributeHandler(attr))),
@@ -27104,29 +27176,29 @@ const translator$v = NodeTranslator.from({
27104
27176
  return Object.keys(decodedAttrs).length > 0 ? { attributes: decodedAttrs } : void 0;
27105
27177
  }
27106
27178
  });
27107
- const translator$u = NodeTranslator.from(createBorderPropertyHandler("w:bottom"));
27108
- const translator$t = NodeTranslator.from(createMeasurementPropertyHandler("w:bottom", "marginBottom"));
27109
- const translator$s = NodeTranslator.from(createBorderPropertyHandler("w:end"));
27110
- const translator$r = NodeTranslator.from(createMeasurementPropertyHandler("w:end", "marginEnd"));
27111
- const translator$q = NodeTranslator.from(createBorderPropertyHandler("w:insideH"));
27112
- const translator$p = NodeTranslator.from(createBorderPropertyHandler("w:insideV"));
27113
- const translator$o = NodeTranslator.from(createBorderPropertyHandler("w:left"));
27114
- const translator$n = NodeTranslator.from(createMeasurementPropertyHandler("w:left", "marginLeft"));
27115
- const translator$m = NodeTranslator.from(createBorderPropertyHandler("w:right"));
27116
- const translator$l = NodeTranslator.from(createMeasurementPropertyHandler("w:right", "marginRight"));
27117
- const translator$k = NodeTranslator.from(createBorderPropertyHandler("w:start"));
27118
- const translator$j = NodeTranslator.from(createMeasurementPropertyHandler("w:start", "marginStart"));
27119
- const translator$i = NodeTranslator.from(createBorderPropertyHandler("w:top"));
27120
- const translator$h = NodeTranslator.from(createMeasurementPropertyHandler("w:top", "marginTop"));
27121
- const XML_NODE_NAME$g = "w:tblBorders";
27122
- const SD_ATTR_KEY$3 = "borders";
27123
- const encode$m = (params2) => {
27179
+ const translator$w = NodeTranslator.from(createBorderPropertyHandler("w:bottom"));
27180
+ const translator$v = NodeTranslator.from(createMeasurementPropertyHandler("w:bottom", "marginBottom"));
27181
+ const translator$u = NodeTranslator.from(createBorderPropertyHandler("w:end"));
27182
+ const translator$t = NodeTranslator.from(createMeasurementPropertyHandler("w:end", "marginEnd"));
27183
+ const translator$s = NodeTranslator.from(createBorderPropertyHandler("w:insideH"));
27184
+ const translator$r = NodeTranslator.from(createBorderPropertyHandler("w:insideV"));
27185
+ const translator$q = NodeTranslator.from(createBorderPropertyHandler("w:left"));
27186
+ const translator$p = NodeTranslator.from(createMeasurementPropertyHandler("w:left", "marginLeft"));
27187
+ const translator$o = NodeTranslator.from(createBorderPropertyHandler("w:right"));
27188
+ const translator$n = NodeTranslator.from(createMeasurementPropertyHandler("w:right", "marginRight"));
27189
+ const translator$m = NodeTranslator.from(createBorderPropertyHandler("w:start"));
27190
+ const translator$l = NodeTranslator.from(createMeasurementPropertyHandler("w:start", "marginStart"));
27191
+ const translator$k = NodeTranslator.from(createBorderPropertyHandler("w:top"));
27192
+ const translator$j = NodeTranslator.from(createMeasurementPropertyHandler("w:top", "marginTop"));
27193
+ const XML_NODE_NAME$i = "w:tblBorders";
27194
+ const SD_ATTR_KEY$5 = "borders";
27195
+ const encode$o = (params2) => {
27124
27196
  const { nodes } = params2;
27125
27197
  const node = nodes[0];
27126
27198
  const attributes = encodeProperties(node, tblBordersTranslatorsByXmlName);
27127
27199
  return Object.keys(attributes).length > 0 ? attributes : void 0;
27128
27200
  };
27129
- const decode$o = (params2) => {
27201
+ const decode$q = (params2) => {
27130
27202
  const { borders = {} } = params2.node.attrs || {};
27131
27203
  const elements = decodeProperties(tblBordersTranslatorsBySdName, borders);
27132
27204
  const newNode = {
@@ -27138,14 +27210,14 @@ const decode$o = (params2) => {
27138
27210
  return newNode;
27139
27211
  };
27140
27212
  const propertyTranslators$2 = [
27213
+ translator$w,
27141
27214
  translator$u,
27142
27215
  translator$s,
27216
+ translator$r,
27143
27217
  translator$q,
27144
- translator$p,
27145
27218
  translator$o,
27146
27219
  translator$m,
27147
- translator$k,
27148
- translator$i
27220
+ translator$k
27149
27221
  ];
27150
27222
  const tblBordersTranslatorsByXmlName = {};
27151
27223
  const tblBordersTranslatorsBySdName = {};
@@ -27153,27 +27225,27 @@ propertyTranslators$2.forEach((translator2) => {
27153
27225
  tblBordersTranslatorsByXmlName[translator2.xmlName] = translator2;
27154
27226
  tblBordersTranslatorsBySdName[translator2.sdNodeOrKeyName] = translator2;
27155
27227
  });
27156
- const translator$g = NodeTranslator.from({
27157
- xmlName: XML_NODE_NAME$g,
27158
- sdNodeOrKeyName: SD_ATTR_KEY$3,
27228
+ const translator$i = NodeTranslator.from({
27229
+ xmlName: XML_NODE_NAME$i,
27230
+ sdNodeOrKeyName: SD_ATTR_KEY$5,
27159
27231
  type: NodeTranslator.translatorTypes.NODE,
27160
27232
  attributes: [],
27161
- encode: encode$m,
27162
- decode: decode$o
27233
+ encode: encode$o,
27234
+ decode: decode$q
27163
27235
  });
27164
- const XML_NODE_NAME$f = "w:tblCellMar";
27165
- const SD_ATTR_KEY$2 = "cellMargins";
27166
- const encode$l = (params2) => {
27236
+ const XML_NODE_NAME$h = "w:tblCellMar";
27237
+ const SD_ATTR_KEY$4 = "cellMargins";
27238
+ const encode$n = (params2) => {
27167
27239
  const { nodes } = params2;
27168
27240
  const node = nodes[0];
27169
27241
  const attributes = encodeProperties(node, propertyTranslatorsByXmlName$1);
27170
27242
  return Object.keys(attributes).length > 0 ? attributes : void 0;
27171
27243
  };
27172
- const decode$n = (params2) => {
27244
+ const decode$p = (params2) => {
27173
27245
  const { cellMargins = {} } = params2.node.attrs || {};
27174
27246
  const elements = decodeProperties(propertyTranslatorsBySdName$1, cellMargins);
27175
27247
  const newNode = {
27176
- name: XML_NODE_NAME$f,
27248
+ name: XML_NODE_NAME$h,
27177
27249
  type: "element",
27178
27250
  attributes: {},
27179
27251
  elements
@@ -27181,12 +27253,12 @@ const decode$n = (params2) => {
27181
27253
  return newNode;
27182
27254
  };
27183
27255
  const propertyTranslators$1 = [
27256
+ translator$v,
27184
27257
  translator$t,
27185
- translator$r,
27258
+ translator$p,
27186
27259
  translator$n,
27187
27260
  translator$l,
27188
- translator$j,
27189
- translator$h
27261
+ translator$j
27190
27262
  ];
27191
27263
  const propertyTranslatorsByXmlName$1 = {};
27192
27264
  const propertyTranslatorsBySdName$1 = {};
@@ -27194,27 +27266,27 @@ propertyTranslators$1.forEach((translator2) => {
27194
27266
  propertyTranslatorsByXmlName$1[translator2.xmlName] = translator2;
27195
27267
  propertyTranslatorsBySdName$1[translator2.sdNodeOrKeyName] = translator2;
27196
27268
  });
27197
- const translator$f = NodeTranslator.from({
27198
- xmlName: XML_NODE_NAME$f,
27199
- sdNodeOrKeyName: SD_ATTR_KEY$2,
27269
+ const translator$h = NodeTranslator.from({
27270
+ xmlName: XML_NODE_NAME$h,
27271
+ sdNodeOrKeyName: SD_ATTR_KEY$4,
27200
27272
  type: NodeTranslator.translatorTypes.NODE,
27201
27273
  attributes: [],
27202
- encode: encode$l,
27203
- decode: decode$n
27274
+ encode: encode$n,
27275
+ decode: decode$p
27204
27276
  });
27205
- const XML_NODE_NAME$e = "w:tblPr";
27206
- const SD_ATTR_KEY$1 = "tableProperties";
27207
- const encode$k = (params2) => {
27277
+ const XML_NODE_NAME$g = "w:tblPr";
27278
+ const SD_ATTR_KEY$3 = "tableProperties";
27279
+ const encode$m = (params2) => {
27208
27280
  const { nodes } = params2;
27209
27281
  const node = nodes[0];
27210
27282
  const attributes = encodeProperties(node, propertyTranslatorsByXmlName);
27211
27283
  return {
27212
- xmlName: XML_NODE_NAME$e,
27213
- sdNodeOrKeyName: SD_ATTR_KEY$1,
27284
+ xmlName: XML_NODE_NAME$g,
27285
+ sdNodeOrKeyName: SD_ATTR_KEY$3,
27214
27286
  attributes
27215
27287
  };
27216
27288
  };
27217
- const decode$m = (params2) => {
27289
+ const decode$o = (params2) => {
27218
27290
  const { tableProperties = {} } = params2.node.attrs || {};
27219
27291
  const elements = decodeProperties(propertyTranslatorsBySdName, tableProperties);
27220
27292
  const newNode = {
@@ -27226,11 +27298,13 @@ const decode$m = (params2) => {
27226
27298
  return newNode;
27227
27299
  };
27228
27300
  const propertyTranslators = [
27301
+ translator$J,
27302
+ translator$R,
27303
+ translator$I,
27229
27304
  translator$H,
27230
- translator$P,
27305
+ translator$Q,
27231
27306
  translator$G,
27232
27307
  translator$F,
27233
- translator$O,
27234
27308
  translator$E,
27235
27309
  translator$D,
27236
27310
  translator$C,
@@ -27239,10 +27313,8 @@ const propertyTranslators = [
27239
27313
  translator$z,
27240
27314
  translator$y,
27241
27315
  translator$x,
27242
- translator$w,
27243
- translator$v,
27244
- translator$g,
27245
- translator$f
27316
+ translator$i,
27317
+ translator$h
27246
27318
  ];
27247
27319
  const propertyTranslatorsByXmlName = {};
27248
27320
  const propertyTranslatorsBySdName = {};
@@ -27250,14 +27322,14 @@ propertyTranslators.forEach((translator2) => {
27250
27322
  propertyTranslatorsByXmlName[translator2.xmlName] = translator2;
27251
27323
  propertyTranslatorsBySdName[translator2.sdNodeOrKeyName] = translator2;
27252
27324
  });
27253
- const config$d = {
27254
- xmlName: XML_NODE_NAME$e,
27255
- sdNodeOrKeyName: SD_ATTR_KEY$1,
27256
- encode: encode$k,
27257
- decode: decode$m
27325
+ const config$f = {
27326
+ xmlName: XML_NODE_NAME$g,
27327
+ sdNodeOrKeyName: SD_ATTR_KEY$3,
27328
+ encode: encode$m,
27329
+ decode: decode$o
27258
27330
  };
27259
- const translator$e = NodeTranslator.from(config$d);
27260
- const translator$d = NodeTranslator.from(
27331
+ const translator$g = NodeTranslator.from(config$f);
27332
+ const translator$f = NodeTranslator.from(
27261
27333
  createSingleAttrPropertyHandler("w:gridCol", "col", "w:w", parseInteger, integerToString)
27262
27334
  );
27263
27335
  const DEFAULT_COLUMN_WIDTH_PX = 100;
@@ -27307,20 +27379,20 @@ const resolveFallbackColumnWidthTwips = (params2, totalColumns, cellMinWidthTwip
27307
27379
  }
27308
27380
  return Math.max(fallbackWidthTwips, cellMinWidthTwips);
27309
27381
  };
27310
- const XML_NODE_NAME$d = "w:tblGrid";
27311
- const SD_ATTR_KEY = "grid";
27382
+ const XML_NODE_NAME$f = "w:tblGrid";
27383
+ const SD_ATTR_KEY$2 = "grid";
27312
27384
  const cellMinWidth = pixelsToTwips(10);
27313
- const encode$j = (params2) => {
27385
+ const encode$l = (params2) => {
27314
27386
  const { nodes } = params2;
27315
27387
  const node = nodes[0];
27316
- const attributes = encodeProperties(node, { [translator$d.xmlName]: translator$d }, true);
27388
+ const attributes = encodeProperties(node, { [translator$f.xmlName]: translator$f }, true);
27317
27389
  return {
27318
- xmlName: XML_NODE_NAME$d,
27319
- sdNodeOrKeyName: SD_ATTR_KEY,
27390
+ xmlName: XML_NODE_NAME$f,
27391
+ sdNodeOrKeyName: SD_ATTR_KEY$2,
27320
27392
  attributes
27321
27393
  };
27322
27394
  };
27323
- const decode$l = (params2) => {
27395
+ const decode$n = (params2) => {
27324
27396
  const { grid: rawGrid } = params2.node.attrs || {};
27325
27397
  const grid = Array.isArray(rawGrid) ? rawGrid : [];
27326
27398
  const { firstRow = {} } = params2.extraParams || {};
@@ -27339,10 +27411,10 @@ const decode$l = (params2) => {
27339
27411
  numericWidth = fallbackColumnWidthTwips;
27340
27412
  }
27341
27413
  numericWidth = Math.max(numericWidth, cellMinWidth);
27342
- const decoded = translator$d.decode({
27414
+ const decoded = translator$f.decode({
27343
27415
  node: { type: (
27344
27416
  /** @type {string} */
27345
- translator$d.sdNodeOrKeyName
27417
+ translator$f.sdNodeOrKeyName
27346
27418
  ), attrs: { col: numericWidth } }
27347
27419
  });
27348
27420
  if (decoded) elements.push(decoded);
@@ -27377,19 +27449,19 @@ const decode$l = (params2) => {
27377
27449
  columnIndex++;
27378
27450
  }
27379
27451
  const newNode = {
27380
- name: XML_NODE_NAME$d,
27452
+ name: XML_NODE_NAME$f,
27381
27453
  attributes: {},
27382
27454
  elements
27383
27455
  };
27384
27456
  return newNode;
27385
27457
  };
27386
- const config$c = {
27387
- xmlName: XML_NODE_NAME$d,
27388
- sdNodeOrKeyName: SD_ATTR_KEY,
27389
- encode: encode$j,
27390
- decode: decode$l
27458
+ const config$e = {
27459
+ xmlName: XML_NODE_NAME$f,
27460
+ sdNodeOrKeyName: SD_ATTR_KEY$2,
27461
+ encode: encode$l,
27462
+ decode: decode$n
27391
27463
  };
27392
- const translator$c = NodeTranslator.from(config$c);
27464
+ const translator$e = NodeTranslator.from(config$e);
27393
27465
  const DEFAULT_PAGE_WIDTH_TWIPS = 12240;
27394
27466
  const DEFAULT_PAGE_MARGIN_TWIPS = 1440;
27395
27467
  const DEFAULT_CONTENT_WIDTH_TWIPS = DEFAULT_PAGE_WIDTH_TWIPS - 2 * DEFAULT_PAGE_MARGIN_TWIPS;
@@ -27452,19 +27524,19 @@ const buildFallbackGridForTable = ({ params: params2, rows, tableWidth, tableWid
27452
27524
  columnWidths: Array(columnCount).fill(fallbackColumnWidthPx)
27453
27525
  };
27454
27526
  };
27455
- const XML_NODE_NAME$c = "w:tbl";
27527
+ const XML_NODE_NAME$e = "w:tbl";
27456
27528
  const SD_NODE_NAME$c = "table";
27457
- const encode$i = (params2, encodedAttrs) => {
27529
+ const encode$k = (params2, encodedAttrs) => {
27458
27530
  const { nodes } = params2;
27459
27531
  const node = nodes[0];
27460
27532
  const tblPr = node.elements.find((el) => el.name === "w:tblPr");
27461
27533
  if (tblPr) {
27462
- const encodedProperties = translator$e.encode({ ...params2, nodes: [tblPr] });
27534
+ const encodedProperties = translator$g.encode({ ...params2, nodes: [tblPr] });
27463
27535
  encodedAttrs["tableProperties"] = encodedProperties?.attributes || {};
27464
27536
  }
27465
27537
  const tblGrid = node.elements.find((el) => el.name === "w:tblGrid");
27466
27538
  if (tblGrid) {
27467
- encodedAttrs["grid"] = translator$c.encode({ ...params2, nodes: [tblGrid] }).attributes;
27539
+ encodedAttrs["grid"] = translator$e.encode({ ...params2, nodes: [tblGrid] }).attributes;
27468
27540
  }
27469
27541
  [
27470
27542
  "tableStyleId",
@@ -27531,7 +27603,7 @@ const encode$i = (params2, encodedAttrs) => {
27531
27603
  }
27532
27604
  const content = [];
27533
27605
  rows.forEach((row) => {
27534
- const result = translator$I.encode({
27606
+ const result = translator$K.encode({
27535
27607
  ...params2,
27536
27608
  nodes: [row],
27537
27609
  extraParams: {
@@ -27550,13 +27622,13 @@ const encode$i = (params2, encodedAttrs) => {
27550
27622
  attrs: encodedAttrs
27551
27623
  };
27552
27624
  };
27553
- const decode$k = (params2, decodedAttrs) => {
27625
+ const decode$m = (params2, decodedAttrs) => {
27554
27626
  params2.node = preProcessVerticalMergeCells(params2.node, params2);
27555
27627
  const { node } = params2;
27556
27628
  const elements = translateChildNodes(params2);
27557
27629
  const firstRow = node.content?.find((n) => n.type === "tableRow");
27558
27630
  const properties = node.attrs.grid;
27559
- const element = translator$c.decode({
27631
+ const element = translator$e.decode({
27560
27632
  ...params2,
27561
27633
  node: { ...node, attrs: { ...node.attrs, grid: properties } },
27562
27634
  extraParams: {
@@ -27566,7 +27638,7 @@ const decode$k = (params2, decodedAttrs) => {
27566
27638
  if (element) elements.unshift(element);
27567
27639
  if (node.attrs?.tableProperties) {
27568
27640
  const properties2 = { ...node.attrs.tableProperties };
27569
- const element2 = translator$e.decode({
27641
+ const element2 = translator$g.decode({
27570
27642
  ...params2,
27571
27643
  node: { ...node, attrs: { ...node.attrs, tableProperties: properties2 } }
27572
27644
  });
@@ -27632,7 +27704,7 @@ function _getReferencedTableStyles(tableStyleReference, params2) {
27632
27704
  if (baseTblPr && baseTblPr.elements) {
27633
27705
  tblPr.elements.push(...baseTblPr.elements);
27634
27706
  }
27635
- const tableProperties = translator$e.encode({ ...params2, nodes: [tblPr] }).attributes;
27707
+ const tableProperties = translator$g.encode({ ...params2, nodes: [tblPr] }).attributes;
27636
27708
  const { borders, rowBorders } = _processTableBorders(tableProperties.borders || {});
27637
27709
  if (borders) stylesToReturn.borders = borders;
27638
27710
  if (rowBorders) stylesToReturn.rowBorders = rowBorders;
@@ -27649,16 +27721,16 @@ function _getReferencedTableStyles(tableStyleReference, params2) {
27649
27721
  }
27650
27722
  return stylesToReturn;
27651
27723
  }
27652
- const config$b = {
27653
- xmlName: XML_NODE_NAME$c,
27724
+ const config$d = {
27725
+ xmlName: XML_NODE_NAME$e,
27654
27726
  sdNodeOrKeyName: SD_NODE_NAME$c,
27655
27727
  type: NodeTranslator.translatorTypes.NODE,
27656
- encode: encode$i,
27657
- decode: decode$k,
27728
+ encode: encode$k,
27729
+ decode: decode$m,
27658
27730
  attributes: []
27659
27731
  };
27660
- const translator$b = NodeTranslator.from(config$b);
27661
- const tableNodeHandlerEntity = generateV2HandlerEntity("tableNodeHandler", translator$b);
27732
+ const translator$d = NodeTranslator.from(config$d);
27733
+ const tableNodeHandlerEntity = generateV2HandlerEntity("tableNodeHandler", translator$d);
27662
27734
  function getReferencedTableStyles(tblStyleTag, docx) {
27663
27735
  if (!tblStyleTag) return null;
27664
27736
  const stylesToReturn = {};
@@ -28020,10 +28092,10 @@ function generateCellMargins(cellMargins) {
28020
28092
  if (left2 != null) elements.push({ name: "w:left", attributes: { "w:w": pixelsToTwips(left2) } });
28021
28093
  return elements;
28022
28094
  }
28023
- const XML_NODE_NAME$b = "w:tc";
28095
+ const XML_NODE_NAME$d = "w:tc";
28024
28096
  const SD_NODE_NAME$b = "tableCell";
28025
- const validXmlAttributes$8 = [];
28026
- function encode$h(params2, encodedAttrs) {
28097
+ const validXmlAttributes$a = [];
28098
+ function encode$j(params2, encodedAttrs) {
28027
28099
  const {
28028
28100
  node,
28029
28101
  table,
@@ -28050,22 +28122,22 @@ function encode$h(params2, encodedAttrs) {
28050
28122
  }
28051
28123
  return schemaNode;
28052
28124
  }
28053
- function decode$j(params2, decodedAttrs) {
28125
+ function decode$l(params2, decodedAttrs) {
28054
28126
  const translated = translateTableCell(params2);
28055
28127
  if (decodedAttrs && Object.keys(decodedAttrs).length) {
28056
28128
  translated.attributes = { ...translated.attributes || {}, ...decodedAttrs };
28057
28129
  }
28058
28130
  return translated;
28059
28131
  }
28060
- const config$a = {
28061
- xmlName: XML_NODE_NAME$b,
28132
+ const config$c = {
28133
+ xmlName: XML_NODE_NAME$d,
28062
28134
  sdNodeOrKeyName: SD_NODE_NAME$b,
28063
28135
  type: NodeTranslator.translatorTypes.NODE,
28064
- encode: encode$h,
28065
- decode: decode$j,
28066
- attributes: validXmlAttributes$8
28136
+ encode: encode$j,
28137
+ decode: decode$l,
28138
+ attributes: validXmlAttributes$a
28067
28139
  };
28068
- const translator$a = NodeTranslator.from(config$a);
28140
+ const translator$c = NodeTranslator.from(config$c);
28069
28141
  function parseTagValueJSON(json) {
28070
28142
  if (typeof json !== "string") {
28071
28143
  return {};
@@ -28492,8 +28564,64 @@ function handleImageNode(node, params2, isAnchor) {
28492
28564
  const vRelativeFrom = positionVTag?.attributes.relativeFrom;
28493
28565
  const alignV = positionVTag?.elements?.find((el) => el.name === "wp:align")?.elements[0]?.text;
28494
28566
  const simplePos = node.elements.find((el) => el.name === "wp:simplePos");
28495
- const wrapSquare = node.elements.find((el) => el.name === "wp:wrapSquare");
28496
- const wrapTopAndBottom = node.elements.find((el) => el.name === "wp:wrapTopAndBottom");
28567
+ const wrapNode = isAnchor ? node.elements.find(
28568
+ (el) => ["wp:wrapNone", "wp:wrapSquare", "wp:wrapThrough", "wp:wrapTight", "wp:wrapTopAndBottom"].includes(el.name)
28569
+ ) : null;
28570
+ const wrap2 = isAnchor ? { type: wrapNode?.name.slice(7) || "None", attrs: {} } : { type: "Inline" };
28571
+ switch (wrap2.type) {
28572
+ case "Square":
28573
+ wrap2.attrs.wrapText = wrapNode.attributes.wrapText;
28574
+ if ("distB" in (wrapNode.attributes || {})) {
28575
+ wrap2.attrs.distBottom = emuToPixels(wrapNode.attributes.distB);
28576
+ }
28577
+ if ("distL" in (wrapNode.attributes || {})) {
28578
+ wrap2.attrs.distLeft = emuToPixels(wrapNode.attributes.distL);
28579
+ }
28580
+ if ("distR" in (wrapNode.attributes || {})) {
28581
+ wrap2.attrs.distRight = emuToPixels(wrapNode.attributes.distR);
28582
+ }
28583
+ if ("distT" in (wrapNode.attributes || {})) {
28584
+ wrap2.attrs.distTop = emuToPixels(wrapNode.attributes.distT);
28585
+ }
28586
+ break;
28587
+ case "Tight":
28588
+ case "Through": {
28589
+ if ("distL" in (wrapNode.attributes || {})) {
28590
+ wrap2.attrs.distLeft = emuToPixels(wrapNode.attributes.distL);
28591
+ }
28592
+ if ("distR" in (wrapNode.attributes || {})) {
28593
+ wrap2.attrs.distRight = emuToPixels(wrapNode.attributes.distR);
28594
+ }
28595
+ if ("distT" in (wrapNode.attributes || {})) {
28596
+ wrap2.attrs.distTop = emuToPixels(wrapNode.attributes.distT);
28597
+ }
28598
+ if ("distB" in (wrapNode.attributes || {})) {
28599
+ wrap2.attrs.distBottom = emuToPixels(wrapNode.attributes.distB);
28600
+ }
28601
+ if ("wrapText" in (wrapNode.attributes || {})) {
28602
+ wrap2.attrs.wrapText = wrapNode.attributes.wrapText;
28603
+ }
28604
+ const polygon = wrapNode.elements?.find((el) => el.name === "wp:wrapPolygon");
28605
+ if (polygon) {
28606
+ wrap2.attrs.polygon = polygonToObj(polygon);
28607
+ if (polygon.attributes?.edited !== void 0) {
28608
+ wrap2.attrs.polygonEdited = polygon.attributes.edited;
28609
+ }
28610
+ }
28611
+ break;
28612
+ }
28613
+ case "TopAndBottom":
28614
+ if ("distB" in (wrapNode.attributes || {})) {
28615
+ wrap2.attrs.distBottom = emuToPixels(wrapNode.attributes.distB);
28616
+ }
28617
+ if ("distT" in (wrapNode.attributes || {})) {
28618
+ wrap2.attrs.distTop = emuToPixels(wrapNode.attributes.distT);
28619
+ }
28620
+ break;
28621
+ case "None":
28622
+ wrap2.attrs.behindDoc = node.attributes?.behindDoc === "1";
28623
+ break;
28624
+ }
28497
28625
  const docPr = node.elements.find((el) => el.name === "wp:docPr");
28498
28626
  let anchorData = null;
28499
28627
  if (hRelativeFrom || alignH || vRelativeFrom || alignV) {
@@ -28505,7 +28633,7 @@ function handleImageNode(node, params2, isAnchor) {
28505
28633
  };
28506
28634
  }
28507
28635
  const marginOffset = {
28508
- left: positionHValue,
28636
+ horizontal: positionHValue,
28509
28637
  top: positionVValue
28510
28638
  };
28511
28639
  const { attributes: blipAttributes = {} } = blip;
@@ -28544,10 +28672,7 @@ function handleImageNode(node, params2, isAnchor) {
28544
28672
  y: simplePos.attributes.y
28545
28673
  }
28546
28674
  },
28547
- ...wrapSquare && {
28548
- wrapText: wrapSquare.attributes.wrapText
28549
- },
28550
- wrapTopAndBottom: !!wrapTopAndBottom,
28675
+ wrap: wrap2,
28551
28676
  originalPadding: {
28552
28677
  distT: attributes["distT"],
28553
28678
  distB: attributes["distB"],
@@ -28895,7 +29020,6 @@ function addNewImageRelationship(params2, imagePath) {
28895
29020
  function translateAnchorNode(params2) {
28896
29021
  const { attrs } = params2.node;
28897
29022
  const anchorElements = [];
28898
- const wrapElements = [];
28899
29023
  if (attrs.simplePos) {
28900
29024
  anchorElements.push({
28901
29025
  name: "wp:simplePos",
@@ -28907,10 +29031,10 @@ function translateAnchorNode(params2) {
28907
29031
  }
28908
29032
  if (attrs.anchorData) {
28909
29033
  const hElements = [];
28910
- if (attrs.marginOffset.left !== void 0) {
29034
+ if (attrs.marginOffset.horizontal !== void 0) {
28911
29035
  hElements.push({
28912
29036
  name: "wp:posOffset",
28913
- elements: [{ type: "text", text: pixelsToEmu(attrs.marginOffset.left).toString() }]
29037
+ elements: [{ type: "text", text: pixelsToEmu(attrs.marginOffset.horizontal).toString() }]
28914
29038
  });
28915
29039
  }
28916
29040
  if (attrs.anchorData.alignH) {
@@ -28943,38 +29067,110 @@ function translateAnchorNode(params2) {
28943
29067
  ...vElements.length && { elements: vElements }
28944
29068
  });
28945
29069
  }
28946
- if (attrs.wrapText) {
28947
- wrapElements.push({
28948
- name: "wp:wrapSquare",
28949
- attributes: {
28950
- wrapText: attrs.wrapText
28951
- }
28952
- });
29070
+ const nodeElements = translateImageNode(params2);
29071
+ const inlineAttrs = {
29072
+ ...attrs.originalAttributes || {},
29073
+ ...nodeElements.attributes || {}
29074
+ };
29075
+ if (inlineAttrs.relativeHeight == null) {
29076
+ inlineAttrs.relativeHeight = 1;
28953
29077
  }
28954
- if (attrs.wrapTopAndBottom) {
28955
- wrapElements.push({
28956
- name: "wp:wrapTopAndBottom"
28957
- });
29078
+ if (attrs.originalAttributes?.simplePos !== void 0) {
29079
+ inlineAttrs.simplePos = attrs.originalAttributes.simplePos;
29080
+ } else if (attrs.simplePos !== void 0) {
29081
+ inlineAttrs.simplePos = attrs.simplePos;
28958
29082
  }
28959
- if (!wrapElements.length) {
28960
- wrapElements.push({
28961
- name: "wp:wrapNone"
28962
- });
29083
+ if (attrs.originalAttributes?.locked !== void 0) {
29084
+ inlineAttrs.locked = attrs.originalAttributes.locked;
28963
29085
  }
28964
- const nodeElements = translateImageNode(params2);
28965
- const inlineAttrs = {
28966
- ...nodeElements.attributes,
28967
- simplePos: attrs.originalAttributes?.simplePos,
28968
- relativeHeight: 1,
28969
- behindDoc: attrs.originalAttributes?.behindDoc,
28970
- locked: attrs.originalAttributes?.locked,
28971
- layoutInCell: attrs.originalAttributes?.layoutInCell,
28972
- allowOverlap: attrs.originalAttributes?.allowOverlap
29086
+ if (attrs.originalAttributes?.layoutInCell !== void 0) {
29087
+ inlineAttrs.layoutInCell = attrs.originalAttributes.layoutInCell;
29088
+ }
29089
+ if (attrs.originalAttributes?.allowOverlap !== void 0) {
29090
+ inlineAttrs.allowOverlap = attrs.originalAttributes.allowOverlap;
29091
+ }
29092
+ const wrapElement = {
29093
+ name: `wp:wrap${attrs.wrap?.type || "None"}`
29094
+ // Important: wp:anchor will break if no wrapping is specified. We need to use wrapNone.
28973
29095
  };
29096
+ switch (attrs.wrap?.type) {
29097
+ case "Square":
29098
+ wrapElement.attributes = {
29099
+ wrapText: attrs.wrap.attrs.wrapText
29100
+ };
29101
+ if ("distBottom" in (attrs.wrap.attrs || {})) {
29102
+ wrapElement.attributes.distB = pixelsToEmu(attrs.wrap.attrs.distBottom);
29103
+ }
29104
+ if ("distLeft" in (attrs.wrap.attrs || {})) {
29105
+ wrapElement.attributes.distL = pixelsToEmu(attrs.wrap.attrs.distLeft);
29106
+ }
29107
+ if ("distRight" in (attrs.wrap.attrs || {})) {
29108
+ wrapElement.attributes.distR = pixelsToEmu(attrs.wrap.attrs.distRight);
29109
+ }
29110
+ if ("distTop" in (attrs.wrap.attrs || {})) {
29111
+ wrapElement.attributes.distT = pixelsToEmu(attrs.wrap.attrs.distTop);
29112
+ }
29113
+ break;
29114
+ case "TopAndBottom": {
29115
+ const attributes = {};
29116
+ let hasKeys = false;
29117
+ if ("distBottom" in (attrs.wrap.attrs || {})) {
29118
+ attributes.distB = pixelsToEmu(attrs.wrap.attrs.distBottom);
29119
+ hasKeys = true;
29120
+ }
29121
+ if ("distTop" in (attrs.wrap.attrs || {})) {
29122
+ attributes.distT = pixelsToEmu(attrs.wrap.attrs.distTop);
29123
+ hasKeys = true;
29124
+ }
29125
+ if (hasKeys) {
29126
+ wrapElement.attributes = attributes;
29127
+ }
29128
+ break;
29129
+ }
29130
+ case "Through":
29131
+ case "Tight": {
29132
+ const attributes = {};
29133
+ if ("distLeft" in (attrs.wrap.attrs || {})) {
29134
+ attributes.distL = pixelsToEmu(attrs.wrap.attrs.distLeft);
29135
+ }
29136
+ if ("distRight" in (attrs.wrap.attrs || {})) {
29137
+ attributes.distR = pixelsToEmu(attrs.wrap.attrs.distRight);
29138
+ }
29139
+ if ("distTop" in (attrs.wrap.attrs || {})) {
29140
+ attributes.distT = pixelsToEmu(attrs.wrap.attrs.distTop);
29141
+ }
29142
+ if ("distBottom" in (attrs.wrap.attrs || {})) {
29143
+ attributes.distB = pixelsToEmu(attrs.wrap.attrs.distBottom);
29144
+ }
29145
+ const wrapText = attrs.wrap.attrs?.wrapText || "bothSides";
29146
+ {
29147
+ attributes.wrapText = wrapText;
29148
+ }
29149
+ if (Object.keys(attributes).length) {
29150
+ wrapElement.attributes = attributes;
29151
+ }
29152
+ if (attrs.wrap.attrs?.polygon) {
29153
+ const polygonNode = objToPolygon(attrs.wrap.attrs.polygon);
29154
+ if (polygonNode) {
29155
+ if (attrs.wrap.attrs?.polygonEdited !== void 0) {
29156
+ polygonNode.attributes = {
29157
+ ...polygonNode.attributes || {},
29158
+ edited: String(attrs.wrap.attrs.polygonEdited)
29159
+ };
29160
+ }
29161
+ wrapElement.elements = [polygonNode];
29162
+ }
29163
+ }
29164
+ break;
29165
+ }
29166
+ case "None":
29167
+ inlineAttrs.behindDoc = attrs.wrap.attrs?.behindDoc ? "1" : "0";
29168
+ break;
29169
+ }
28974
29170
  const effectIndex = nodeElements.elements.findIndex((el) => el.name === "wp:effectExtent");
28975
29171
  const elementsWithWrap = [
28976
29172
  ...nodeElements.elements.slice(0, effectIndex + 1),
28977
- ...wrapElements,
29173
+ wrapElement,
28978
29174
  ...nodeElements.elements.slice(effectIndex + 1)
28979
29175
  ];
28980
29176
  return {
@@ -28983,32 +29179,32 @@ function translateAnchorNode(params2) {
28983
29179
  elements: [...anchorElements, ...elementsWithWrap]
28984
29180
  };
28985
29181
  }
28986
- const XML_NODE_NAME$a = "wp:anchor";
29182
+ const XML_NODE_NAME$c = "wp:anchor";
28987
29183
  const SD_NODE_NAME$a = ["image"];
28988
- const validXmlAttributes$7 = ["distT", "distB", "distL", "distR"].map((xmlName) => createAttributeHandler(xmlName));
28989
- function encode$g(params2) {
29184
+ const validXmlAttributes$9 = ["distT", "distB", "distL", "distR"].map((xmlName) => createAttributeHandler(xmlName));
29185
+ function encode$i(params2) {
28990
29186
  const { node } = params2.extraParams;
28991
29187
  if (!node || !node.type) {
28992
29188
  return null;
28993
29189
  }
28994
29190
  return handleAnchorNode(params2);
28995
29191
  }
28996
- function decode$i(params2) {
29192
+ function decode$k(params2) {
28997
29193
  const { node } = params2;
28998
29194
  if (!node || !node.type) {
28999
29195
  return null;
29000
29196
  }
29001
29197
  return translateAnchorNode(params2);
29002
29198
  }
29003
- const config$9 = {
29004
- xmlName: XML_NODE_NAME$a,
29199
+ const config$b = {
29200
+ xmlName: XML_NODE_NAME$c,
29005
29201
  sdNodeOrKeyName: SD_NODE_NAME$a,
29006
29202
  type: NodeTranslator.translatorTypes.NODE,
29007
- encode: encode$g,
29008
- decode: decode$i,
29009
- attributes: validXmlAttributes$7
29203
+ encode: encode$i,
29204
+ decode: decode$k,
29205
+ attributes: validXmlAttributes$9
29010
29206
  };
29011
- const translator$9 = NodeTranslator.from(config$9);
29207
+ const translator$b = NodeTranslator.from(config$b);
29012
29208
  function handleInlineNode(params2) {
29013
29209
  const { node } = params2.extraParams;
29014
29210
  if (node.name !== "wp:inline") {
@@ -29024,41 +29220,41 @@ function translateInlineNode(params2) {
29024
29220
  elements: nodeElements.elements
29025
29221
  };
29026
29222
  }
29027
- const XML_NODE_NAME$9 = "wp:inline";
29223
+ const XML_NODE_NAME$b = "wp:inline";
29028
29224
  const SD_NODE_NAME$9 = ["image"];
29029
- const validXmlAttributes$6 = ["distT", "distB", "distL", "distR"].map((xmlName) => createAttributeHandler(xmlName));
29030
- function encode$f(params2) {
29225
+ const validXmlAttributes$8 = ["distT", "distB", "distL", "distR"].map((xmlName) => createAttributeHandler(xmlName));
29226
+ function encode$h(params2) {
29031
29227
  const { node } = params2.extraParams;
29032
29228
  if (!node || !node.type) {
29033
29229
  return null;
29034
29230
  }
29035
29231
  return handleInlineNode(params2);
29036
29232
  }
29037
- function decode$h(params2) {
29233
+ function decode$j(params2) {
29038
29234
  const { node } = params2;
29039
29235
  if (!node || !node.type) {
29040
29236
  return null;
29041
29237
  }
29042
29238
  return translateInlineNode(params2);
29043
29239
  }
29044
- const config$8 = {
29045
- xmlName: XML_NODE_NAME$9,
29240
+ const config$a = {
29241
+ xmlName: XML_NODE_NAME$b,
29046
29242
  sdNodeOrKeyName: SD_NODE_NAME$9,
29047
29243
  type: NodeTranslator.translatorTypes.NODE,
29048
- encode: encode$f,
29049
- decode: decode$h,
29050
- attributes: validXmlAttributes$6
29244
+ encode: encode$h,
29245
+ decode: decode$j,
29246
+ attributes: validXmlAttributes$8
29051
29247
  };
29052
- const translator$8 = NodeTranslator.from(config$8);
29053
- const XML_NODE_NAME$8 = "w:drawing";
29248
+ const translator$a = NodeTranslator.from(config$a);
29249
+ const XML_NODE_NAME$a = "w:drawing";
29054
29250
  const SD_NODE_NAME$8 = [];
29055
- const validXmlAttributes$5 = [];
29056
- function encode$e(params2) {
29251
+ const validXmlAttributes$7 = [];
29252
+ function encode$g(params2) {
29057
29253
  const nodes = params2.nodes;
29058
29254
  const node = nodes[0];
29059
29255
  const translatorByChildName = {
29060
- "wp:anchor": translator$9,
29061
- "wp:inline": translator$8
29256
+ "wp:anchor": translator$b,
29257
+ "wp:inline": translator$a
29062
29258
  };
29063
29259
  return node.elements.reduce((acc, child) => {
29064
29260
  if (acc) return acc;
@@ -29067,12 +29263,12 @@ function encode$e(params2) {
29067
29263
  return translator2.encode({ ...params2, extraParams: { node: child } }) || acc;
29068
29264
  }, null);
29069
29265
  }
29070
- function decode$g(params2) {
29266
+ function decode$i(params2) {
29071
29267
  const { node } = params2;
29072
29268
  if (!node || !node.type) {
29073
29269
  return null;
29074
29270
  }
29075
- const childTranslator = node.attrs.isAnchor ? translator$9 : translator$8;
29271
+ const childTranslator = node.attrs.isAnchor ? translator$b : translator$a;
29076
29272
  const resultNode = childTranslator.decode(params2);
29077
29273
  return wrapTextInRun(
29078
29274
  {
@@ -29082,15 +29278,15 @@ function decode$g(params2) {
29082
29278
  []
29083
29279
  );
29084
29280
  }
29085
- const config$7 = {
29086
- xmlName: XML_NODE_NAME$8,
29281
+ const config$9 = {
29282
+ xmlName: XML_NODE_NAME$a,
29087
29283
  sdNodeOrKeyName: SD_NODE_NAME$8,
29088
29284
  type: NodeTranslator.translatorTypes.NODE,
29089
- encode: encode$e,
29090
- decode: decode$g,
29091
- attributes: validXmlAttributes$5
29285
+ encode: encode$g,
29286
+ decode: decode$i,
29287
+ attributes: validXmlAttributes$7
29092
29288
  };
29093
- const translator$7 = NodeTranslator.from(config$7);
29289
+ const translator$9 = NodeTranslator.from(config$9);
29094
29290
  class CommandService {
29095
29291
  /**
29096
29292
  * @param {import('./commands/types/index.js').CommandServiceOptions} props
@@ -30438,7 +30634,7 @@ function prepareTextAnnotation(params2) {
30438
30634
  return getTextNodeForExport(attrs.displayLabel, [...marks, ...marksFromAttrs], params2);
30439
30635
  }
30440
30636
  function prepareImageAnnotation(params2, imageSize) {
30441
- return translator$7.decode({
30637
+ return translator$9.decode({
30442
30638
  ...params2,
30443
30639
  imageSize
30444
30640
  });
@@ -30753,10 +30949,10 @@ function generateSdtPrTagForStructuredContent({ node }) {
30753
30949
  };
30754
30950
  return result;
30755
30951
  }
30756
- const XML_NODE_NAME$7 = "w:sdt";
30952
+ const XML_NODE_NAME$9 = "w:sdt";
30757
30953
  const SD_NODE_NAME$7 = ["fieldAnnotation", "structuredContent", "structuredContentBlock", "documentSection"];
30758
- const validXmlAttributes$4 = [];
30759
- function encode$d(params2) {
30954
+ const validXmlAttributes$6 = [];
30955
+ function encode$f(params2) {
30760
30956
  const nodes = params2.nodes;
30761
30957
  const node = nodes[0];
30762
30958
  const { type: sdtType, handler: handler2 } = sdtNodeTypeStrategy(node);
@@ -30766,7 +30962,7 @@ function encode$d(params2) {
30766
30962
  const result = handler2(params2);
30767
30963
  return result;
30768
30964
  }
30769
- function decode$f(params2) {
30965
+ function decode$h(params2) {
30770
30966
  const { node } = params2;
30771
30967
  if (!node || !node.type) {
30772
30968
  return null;
@@ -30784,85 +30980,85 @@ function decode$f(params2) {
30784
30980
  const result = decoder();
30785
30981
  return result;
30786
30982
  }
30787
- const config$6 = {
30788
- xmlName: XML_NODE_NAME$7,
30983
+ const config$8 = {
30984
+ xmlName: XML_NODE_NAME$9,
30789
30985
  sdNodeOrKeyName: SD_NODE_NAME$7,
30790
30986
  type: NodeTranslator.translatorTypes.NODE,
30791
- encode: encode$d,
30792
- decode: decode$f,
30793
- attributes: validXmlAttributes$4
30987
+ encode: encode$f,
30988
+ decode: decode$h,
30989
+ attributes: validXmlAttributes$6
30794
30990
  };
30795
- const translator$6 = NodeTranslator.from(config$6);
30796
- const encode$c = (attributes) => {
30991
+ const translator$8 = NodeTranslator.from(config$8);
30992
+ const encode$e = (attributes) => {
30797
30993
  return attributes["w:id"];
30798
30994
  };
30799
- const decode$e = (attrs) => {
30995
+ const decode$g = (attrs) => {
30800
30996
  return attrs.id;
30801
30997
  };
30802
30998
  const attrConfig$7 = Object.freeze({
30803
30999
  xmlName: "w:id",
30804
31000
  sdName: "id",
30805
- encode: encode$c,
30806
- decode: decode$e
31001
+ encode: encode$e,
31002
+ decode: decode$g
30807
31003
  });
30808
- const encode$b = (attributes) => {
31004
+ const encode$d = (attributes) => {
30809
31005
  return attributes["w:name"];
30810
31006
  };
30811
- const decode$d = (attrs) => {
31007
+ const decode$f = (attrs) => {
30812
31008
  return attrs.name;
30813
31009
  };
30814
31010
  const attrConfig$6 = Object.freeze({
30815
31011
  xmlName: "w:name",
30816
31012
  sdName: "name",
30817
- encode: encode$b,
30818
- decode: decode$d
31013
+ encode: encode$d,
31014
+ decode: decode$f
30819
31015
  });
30820
- const encode$a = (attributes) => {
31016
+ const encode$c = (attributes) => {
30821
31017
  return attributes["w:colFirst"];
30822
31018
  };
30823
- const decode$c = (attrs) => {
31019
+ const decode$e = (attrs) => {
30824
31020
  return attrs.colFirst;
30825
31021
  };
30826
31022
  const attrConfig$5 = Object.freeze({
30827
31023
  xmlName: "w:colFirst",
30828
31024
  sdName: "colFirst",
30829
- encode: encode$a,
30830
- decode: decode$c
31025
+ encode: encode$c,
31026
+ decode: decode$e
30831
31027
  });
30832
- const encode$9 = (attributes) => {
31028
+ const encode$b = (attributes) => {
30833
31029
  return attributes["w:colLast"];
30834
31030
  };
30835
- const decode$b = (attrs) => {
31031
+ const decode$d = (attrs) => {
30836
31032
  return attrs.colLast;
30837
31033
  };
30838
31034
  const attrConfig$4 = Object.freeze({
30839
31035
  xmlName: "w:colLast",
30840
31036
  sdName: "colLast",
30841
- encode: encode$9,
30842
- decode: decode$b
31037
+ encode: encode$b,
31038
+ decode: decode$d
30843
31039
  });
30844
- const encode$8 = (attributes) => {
31040
+ const encode$a = (attributes) => {
30845
31041
  return attributes["w:displacedByCustomXml"];
30846
31042
  };
30847
- const decode$a = (attrs) => {
31043
+ const decode$c = (attrs) => {
30848
31044
  return attrs.displacedByCustomXml;
30849
31045
  };
30850
31046
  const attrConfig$3 = Object.freeze({
30851
31047
  xmlName: "w:displacedByCustomXml",
30852
31048
  sdName: "displacedByCustomXml",
30853
- encode: encode$8,
30854
- decode: decode$a
31049
+ encode: encode$a,
31050
+ decode: decode$c
30855
31051
  });
30856
- const validXmlAttributes$3 = [attrConfig$7, attrConfig$6, attrConfig$5, attrConfig$4, attrConfig$3];
30857
- const XML_NODE_NAME$6 = "w:bookmarkStart";
31052
+ const validXmlAttributes$5 = [attrConfig$7, attrConfig$6, attrConfig$5, attrConfig$4, attrConfig$3];
31053
+ const XML_NODE_NAME$8 = "w:bookmarkStart";
30858
31054
  const SD_NODE_NAME$6 = "bookmarkStart";
30859
- const encode$7 = (params2, encodedAttrs = {}) => {
31055
+ const encode$9 = (params2, encodedAttrs = {}) => {
30860
31056
  return {
30861
31057
  type: "bookmarkStart",
30862
31058
  attrs: encodedAttrs
30863
31059
  };
30864
31060
  };
30865
- const decode$9 = (params2, decodedAttrs = {}) => {
31061
+ const decode$b = (params2, decodedAttrs = {}) => {
30866
31062
  const result = {
30867
31063
  name: "w:bookmarkStart",
30868
31064
  elements: []
@@ -30872,49 +31068,49 @@ const decode$9 = (params2, decodedAttrs = {}) => {
30872
31068
  }
30873
31069
  return result;
30874
31070
  };
30875
- const config$5 = {
30876
- xmlName: XML_NODE_NAME$6,
31071
+ const config$7 = {
31072
+ xmlName: XML_NODE_NAME$8,
30877
31073
  sdNodeOrKeyName: SD_NODE_NAME$6,
30878
31074
  type: NodeTranslator.translatorTypes.NODE,
30879
- encode: encode$7,
30880
- decode: decode$9,
30881
- attributes: validXmlAttributes$3
31075
+ encode: encode$9,
31076
+ decode: decode$b,
31077
+ attributes: validXmlAttributes$5
30882
31078
  };
30883
- const translator$5 = NodeTranslator.from(config$5);
30884
- const encode$6 = (attributes) => {
31079
+ const translator$7 = NodeTranslator.from(config$7);
31080
+ const encode$8 = (attributes) => {
30885
31081
  return attributes["w:id"];
30886
31082
  };
30887
- const decode$8 = (attrs) => {
31083
+ const decode$a = (attrs) => {
30888
31084
  return attrs.id;
30889
31085
  };
30890
31086
  const attrConfig$2 = Object.freeze({
30891
31087
  xmlName: "w:id",
30892
31088
  sdName: "id",
30893
- encode: encode$6,
30894
- decode: decode$8
31089
+ encode: encode$8,
31090
+ decode: decode$a
30895
31091
  });
30896
- const encode$5 = (attributes) => {
31092
+ const encode$7 = (attributes) => {
30897
31093
  return attributes["w:displacedByCustomXml"];
30898
31094
  };
30899
- const decode$7 = (attrs) => {
31095
+ const decode$9 = (attrs) => {
30900
31096
  return attrs.displacedByCustomXml;
30901
31097
  };
30902
31098
  const attrConfig$1 = Object.freeze({
30903
31099
  xmlName: "w:displacedByCustomXml",
30904
31100
  sdName: "displacedByCustomXml",
30905
- encode: encode$5,
30906
- decode: decode$7
31101
+ encode: encode$7,
31102
+ decode: decode$9
30907
31103
  });
30908
- const validXmlAttributes$2 = [attrConfig$2, attrConfig$1];
30909
- const XML_NODE_NAME$5 = "w:bookmarkEnd";
31104
+ const validXmlAttributes$4 = [attrConfig$2, attrConfig$1];
31105
+ const XML_NODE_NAME$7 = "w:bookmarkEnd";
30910
31106
  const SD_NODE_NAME$5 = "bookmarkEnd";
30911
- const encode$4 = (params2, encodedAttrs = {}) => {
31107
+ const encode$6 = (params2, encodedAttrs = {}) => {
30912
31108
  return {
30913
31109
  type: "bookmarkEnd",
30914
31110
  attrs: encodedAttrs
30915
31111
  };
30916
31112
  };
30917
- const decode$6 = (params2, decodedAttrs = {}) => {
31113
+ const decode$8 = (params2, decodedAttrs = {}) => {
30918
31114
  const result = {
30919
31115
  name: "w:bookmarkEnd",
30920
31116
  elements: []
@@ -30924,27 +31120,27 @@ const decode$6 = (params2, decodedAttrs = {}) => {
30924
31120
  }
30925
31121
  return result;
30926
31122
  };
30927
- const config$4 = {
30928
- xmlName: XML_NODE_NAME$5,
31123
+ const config$6 = {
31124
+ xmlName: XML_NODE_NAME$7,
30929
31125
  sdNodeOrKeyName: SD_NODE_NAME$5,
30930
31126
  type: NodeTranslator.translatorTypes.NODE,
30931
- encode: encode$4,
30932
- decode: decode$6,
30933
- attributes: validXmlAttributes$2
31127
+ encode: encode$6,
31128
+ decode: decode$8,
31129
+ attributes: validXmlAttributes$4
30934
31130
  };
30935
- const translator$4 = NodeTranslator.from(config$4);
30936
- const decode$5 = (attrs) => attrs?.["w:id"];
31131
+ const translator$6 = NodeTranslator.from(config$6);
31132
+ const decode$7 = (attrs) => attrs?.["w:id"];
30937
31133
  const attrConfig = Object.freeze({
30938
31134
  xmlName: "w:id",
30939
31135
  sdName: "w:id",
30940
31136
  // We do not translate it from 'w:id' to 'id' when encoding, so the name is the same
30941
31137
  encode: () => {
30942
31138
  },
30943
- decode: decode$5
31139
+ decode: decode$7
30944
31140
  });
30945
- const XML_NODE_NAME$4 = "w:commentRange";
31141
+ const XML_NODE_NAME$6 = "w:commentRange";
30946
31142
  const SD_NODE_NAME$4 = "commentRange";
30947
- const decode$4 = (params2) => {
31143
+ const decode$6 = (params2) => {
30948
31144
  const { node, comments, commentsExportType, exportedCommentDefs } = params2;
30949
31145
  if (!node) return;
30950
31146
  if (!comments) return;
@@ -30987,19 +31183,19 @@ const getCommentSchema = (type2, commentIndex) => {
30987
31183
  };
30988
31184
  };
30989
31185
  const getConfig = (type2) => ({
30990
- xmlName: `${XML_NODE_NAME$4}${type2}`,
31186
+ xmlName: `${XML_NODE_NAME$6}${type2}`,
30991
31187
  sdNodeOrKeyName: `${SD_NODE_NAME$4}${type2}`,
30992
31188
  type: NodeTranslator.translatorTypes.NODE,
30993
31189
  encode: () => {
30994
31190
  },
30995
- decode: decode$4,
31191
+ decode: decode$6,
30996
31192
  attributes: [attrConfig]
30997
31193
  });
30998
31194
  const commentRangeStartTranslator = NodeTranslator.from(getConfig("Start"));
30999
31195
  const commentRangeEndTranslator = NodeTranslator.from(getConfig("End"));
31000
- const XML_NODE_NAME$3 = "sd:pageReference";
31196
+ const XML_NODE_NAME$5 = "sd:pageReference";
31001
31197
  const SD_NODE_NAME$3 = "pageReference";
31002
- const encode$3 = (params2) => {
31198
+ const encode$5 = (params2) => {
31003
31199
  const { nodes = [], nodeListHandler } = params2 || {};
31004
31200
  const node = nodes[0];
31005
31201
  const processedText = nodeListHandler.handler({
@@ -31016,7 +31212,7 @@ const encode$3 = (params2) => {
31016
31212
  };
31017
31213
  return processedNode;
31018
31214
  };
31019
- const decode$3 = (params2) => {
31215
+ const decode$5 = (params2) => {
31020
31216
  const { node } = params2;
31021
31217
  const outputMarks = processOutputMarks(node.attrs?.marksAsAttrs || []);
31022
31218
  const contentNodes = (node.content ?? []).flatMap((n) => exportSchemaToJson({ ...params2, node: n }));
@@ -31089,17 +31285,17 @@ const decode$3 = (params2) => {
31089
31285
  ];
31090
31286
  return translated;
31091
31287
  };
31092
- const config$3 = {
31093
- xmlName: XML_NODE_NAME$3,
31288
+ const config$5 = {
31289
+ xmlName: XML_NODE_NAME$5,
31094
31290
  sdNodeOrKeyName: SD_NODE_NAME$3,
31095
31291
  type: NodeTranslator.translatorTypes.NODE,
31096
- encode: encode$3,
31097
- decode: decode$3
31292
+ encode: encode$5,
31293
+ decode: decode$5
31098
31294
  };
31099
- const translator$3 = NodeTranslator.from(config$3);
31100
- const XML_NODE_NAME$2 = "sd:tableOfContents";
31295
+ const translator$5 = NodeTranslator.from(config$5);
31296
+ const XML_NODE_NAME$4 = "sd:tableOfContents";
31101
31297
  const SD_NODE_NAME$2 = "tableOfContents";
31102
- const encode$2 = (params2) => {
31298
+ const encode$4 = (params2) => {
31103
31299
  const { nodes = [], nodeListHandler } = params2 || {};
31104
31300
  const node = nodes[0];
31105
31301
  const processedContent = nodeListHandler.handler({
@@ -31115,7 +31311,7 @@ const encode$2 = (params2) => {
31115
31311
  };
31116
31312
  return processedNode;
31117
31313
  };
31118
- const decode$2 = (params2) => {
31314
+ const decode$4 = (params2) => {
31119
31315
  const { node } = params2;
31120
31316
  const contentNodes = node.content.map((n) => exportSchemaToJson({ ...params2, node: n }));
31121
31317
  const tocBeginElements = [
@@ -31162,14 +31358,14 @@ const decode$2 = (params2) => {
31162
31358
  }
31163
31359
  return contentNodes;
31164
31360
  };
31165
- const config$2 = {
31166
- xmlName: XML_NODE_NAME$2,
31361
+ const config$4 = {
31362
+ xmlName: XML_NODE_NAME$4,
31167
31363
  sdNodeOrKeyName: SD_NODE_NAME$2,
31168
31364
  type: NodeTranslator.translatorTypes.NODE,
31169
- encode: encode$2,
31170
- decode: decode$2
31365
+ encode: encode$4,
31366
+ decode: decode$4
31171
31367
  };
31172
- const translator$2 = NodeTranslator.from(config$2);
31368
+ const translator$4 = NodeTranslator.from(config$4);
31173
31369
  function parseInlineStyles(styleString) {
31174
31370
  if (!styleString) return {};
31175
31371
  return styleString.split(";").filter((style2) => !!style2.trim()).reduce((acc, style2) => {
@@ -31303,7 +31499,7 @@ const handleDrawingNode = (params2) => {
31303
31499
  if (mainNode.name === "w:drawing") node = mainNode;
31304
31500
  else node = mainNode.elements.find((el) => el.name === "w:drawing");
31305
31501
  if (!node) return { nodes: [], consumed: 0 };
31306
- const schemaNode = translator$7.encode(params2);
31502
+ const schemaNode = translator$9.encode(params2);
31307
31503
  const newNodes = schemaNode ? [schemaNode] : [];
31308
31504
  return { nodes: newNodes, consumed: 1 };
31309
31505
  };
@@ -31311,6 +31507,203 @@ const drawingNodeHandlerEntity = {
31311
31507
  handlerName: "drawingNodeHandler",
31312
31508
  handler: handleDrawingNode
31313
31509
  };
31510
+ const createTrackStyleMark = (marks) => {
31511
+ const trackStyleMark = marks.find((mark) => mark.type === "trackFormat");
31512
+ if (trackStyleMark) {
31513
+ return {
31514
+ type: "element",
31515
+ name: "w:rPrChange",
31516
+ attributes: {
31517
+ "w:id": trackStyleMark.attrs.id,
31518
+ "w:author": trackStyleMark.attrs.author,
31519
+ "w:authorEmail": trackStyleMark.attrs.authorEmail,
31520
+ "w:date": trackStyleMark.attrs.date
31521
+ },
31522
+ elements: trackStyleMark.attrs.before.map((mark) => processOutputMarks([mark])).filter((r2) => r2 !== void 0)
31523
+ };
31524
+ }
31525
+ return void 0;
31526
+ };
31527
+ const XML_NODE_NAME$3 = "w:del";
31528
+ const SD_ATTR_KEY$1 = "trackDelete";
31529
+ const validXmlAttributes$3 = [
31530
+ createAttributeHandler("w:id", "id"),
31531
+ createAttributeHandler("w:date", "date"),
31532
+ createAttributeHandler("w:author", "author"),
31533
+ createAttributeHandler("w:authorEmail", "authorEmail")
31534
+ ];
31535
+ const encode$3 = (params2, encodedAttrs = {}) => {
31536
+ const { nodeListHandler, extraParams = {} } = params2;
31537
+ const { node } = extraParams;
31538
+ const subs = nodeListHandler.handler({
31539
+ ...params2,
31540
+ insideTrackChange: true,
31541
+ nodes: node.elements,
31542
+ path: [...params2.path || [], node]
31543
+ });
31544
+ encodedAttrs.importedAuthor = `${encodedAttrs.author} (imported)`;
31545
+ subs.forEach((subElement) => {
31546
+ if (subElement.marks === void 0) subElement.marks = [];
31547
+ subElement.marks.push({ type: "trackDelete", attrs: encodedAttrs });
31548
+ });
31549
+ return subs;
31550
+ };
31551
+ function decode$3(params2) {
31552
+ const { node } = params2;
31553
+ if (!node || !node.type) {
31554
+ return null;
31555
+ }
31556
+ const trackingMarks = ["trackInsert", "trackFormat", "trackDelete"];
31557
+ const marks = node.marks;
31558
+ const trackedMark = marks.find((m2) => m2.type === "trackDelete");
31559
+ const trackStyleMark = createTrackStyleMark(marks);
31560
+ node.marks = marks.filter((m2) => !trackingMarks.includes(m2.type));
31561
+ if (trackStyleMark) {
31562
+ node.marks.push(trackStyleMark);
31563
+ }
31564
+ const translatedTextNode = exportSchemaToJson({ ...params2, node });
31565
+ const textNode = translatedTextNode.elements.find((n) => n.name === "w:t");
31566
+ textNode.name = "w:delText";
31567
+ return {
31568
+ name: "w:del",
31569
+ attributes: {
31570
+ "w:id": trackedMark.attrs.id,
31571
+ "w:author": trackedMark.attrs.author,
31572
+ "w:authorEmail": trackedMark.attrs.authorEmail,
31573
+ "w:date": trackedMark.attrs.date
31574
+ },
31575
+ elements: [translatedTextNode]
31576
+ };
31577
+ }
31578
+ const config$3 = {
31579
+ xmlName: XML_NODE_NAME$3,
31580
+ sdNodeOrKeyName: SD_ATTR_KEY$1,
31581
+ type: NodeTranslator.translatorTypes.ATTRIBUTE,
31582
+ encode: encode$3,
31583
+ decode: decode$3,
31584
+ attributes: validXmlAttributes$3
31585
+ };
31586
+ const translator$3 = NodeTranslator.from(config$3);
31587
+ const XML_NODE_NAME$2 = "w:ins";
31588
+ const SD_ATTR_KEY = "trackInsert";
31589
+ const validXmlAttributes$2 = [
31590
+ createAttributeHandler("w:id", "id"),
31591
+ createAttributeHandler("w:date", "date"),
31592
+ createAttributeHandler("w:author", "author"),
31593
+ createAttributeHandler("w:authorEmail", "authorEmail")
31594
+ ];
31595
+ const encode$2 = (params2, encodedAttrs = {}) => {
31596
+ const { nodeListHandler, extraParams = {} } = params2;
31597
+ const { node } = extraParams;
31598
+ const subs = nodeListHandler.handler({
31599
+ ...params2,
31600
+ insideTrackChange: true,
31601
+ nodes: node.elements,
31602
+ path: [...params2.path || [], node]
31603
+ });
31604
+ encodedAttrs.importedAuthor = `${encodedAttrs.author} (imported)`;
31605
+ subs.forEach((subElement) => {
31606
+ if (subElement.marks === void 0) subElement.marks = [];
31607
+ subElement.marks.push({ type: "trackInsert", attrs: encodedAttrs });
31608
+ });
31609
+ return subs;
31610
+ };
31611
+ function decode$2(params2) {
31612
+ const { node } = params2;
31613
+ if (!node || !node.type) {
31614
+ return null;
31615
+ }
31616
+ const trackingMarks = ["trackInsert", "trackFormat", "trackDelete"];
31617
+ const marks = node.marks;
31618
+ const trackedMark = marks.find((m2) => m2.type === "trackInsert");
31619
+ const trackStyleMark = createTrackStyleMark(marks);
31620
+ node.marks = marks.filter((m2) => !trackingMarks.includes(m2.type));
31621
+ if (trackStyleMark) {
31622
+ node.marks.push(trackStyleMark);
31623
+ }
31624
+ const translatedTextNode = exportSchemaToJson({ ...params2, node });
31625
+ return {
31626
+ name: "w:ins",
31627
+ attributes: {
31628
+ "w:id": trackedMark.attrs.id,
31629
+ "w:author": trackedMark.attrs.author,
31630
+ "w:authorEmail": trackedMark.attrs.authorEmail,
31631
+ "w:date": trackedMark.attrs.date
31632
+ },
31633
+ elements: [translatedTextNode]
31634
+ };
31635
+ }
31636
+ const config$2 = {
31637
+ xmlName: XML_NODE_NAME$2,
31638
+ sdNodeOrKeyName: SD_ATTR_KEY,
31639
+ type: NodeTranslator.translatorTypes.ATTRIBUTE,
31640
+ encode: encode$2,
31641
+ decode: decode$2,
31642
+ attributes: validXmlAttributes$2
31643
+ };
31644
+ const translator$2 = NodeTranslator.from(config$2);
31645
+ const isTrackChangeElement = (node) => node?.name === "w:del" || node?.name === "w:ins";
31646
+ const unwrapTrackChangeNode = (node) => {
31647
+ if (!node) {
31648
+ return null;
31649
+ }
31650
+ if (isTrackChangeElement(node)) {
31651
+ return node;
31652
+ }
31653
+ if (node.name === "w:sdt") {
31654
+ const content = node.elements?.find((element) => element.name === "w:sdtContent");
31655
+ if (!content?.elements?.length) {
31656
+ return null;
31657
+ }
31658
+ for (const child of content.elements) {
31659
+ const trackChange = unwrapTrackChangeNode(child);
31660
+ if (trackChange) {
31661
+ return trackChange;
31662
+ }
31663
+ }
31664
+ }
31665
+ return null;
31666
+ };
31667
+ const handleTrackChangeNode = (params2) => {
31668
+ const { nodes } = params2;
31669
+ if (nodes.length === 0) {
31670
+ return { nodes: [], consumed: 0 };
31671
+ }
31672
+ const mainNode = unwrapTrackChangeNode(nodes[0]);
31673
+ if (!mainNode) {
31674
+ return { nodes: [], consumed: 0 };
31675
+ }
31676
+ let result;
31677
+ const translatorParams = {
31678
+ ...params2,
31679
+ nodes: [mainNode]
31680
+ };
31681
+ switch (mainNode.name) {
31682
+ case "w:del":
31683
+ result = translator$3.encode({
31684
+ extraParams: {
31685
+ node: mainNode
31686
+ },
31687
+ ...translatorParams
31688
+ });
31689
+ break;
31690
+ case "w:ins":
31691
+ result = translator$2.encode({
31692
+ extraParams: {
31693
+ node: mainNode
31694
+ },
31695
+ ...translatorParams
31696
+ });
31697
+ break;
31698
+ }
31699
+ return { nodes: result, consumed: 1 };
31700
+ };
31701
+ const trackChangeNodeHandlerEntity = {
31702
+ handlerName: "trackChangeNodeHandler",
31703
+ handler: handleTrackChangeNode
31704
+ };
31705
+ const hyperlinkNodeHandlerEntity = generateV2HandlerEntity("hyperlinkNodeHandler", translator$Z);
31706
+ const runNodeHandlerEntity = generateV2HandlerEntity("runNodeHandler", translator$Y);
31314
31707
  function parseProperties(node) {
31315
31708
  const marks = [];
31316
31709
  const unknownMarks = [];
@@ -31362,51 +31755,6 @@ function getElementName(element) {
31362
31755
  const isPropertiesElement = (element) => {
31363
31756
  return !!SuperConverter.propertyTypes[element.name || element.type];
31364
31757
  };
31365
- const handleTrackChangeNode = (params2) => {
31366
- const { nodes, nodeListHandler } = params2;
31367
- if (nodes.length === 0 || !(nodes[0].name === "w:del" || nodes[0].name === "w:ins" || nodes[0].name === "w:sdt")) {
31368
- return { nodes: [], consumed: 0 };
31369
- }
31370
- const mainNode = nodes[0];
31371
- let node;
31372
- if (["w:ins", "w:del"].includes(mainNode.name)) {
31373
- node = mainNode;
31374
- } else {
31375
- const sdtContent = mainNode.elements.find((el) => el.name === "w:sdtContent");
31376
- const trackedChange = sdtContent?.elements.find((el) => ["w:ins", "w:del"].includes(el.name));
31377
- if (trackedChange) node = trackedChange;
31378
- }
31379
- if (!node) {
31380
- return { nodes: [], consumed: 0 };
31381
- }
31382
- const { name } = node;
31383
- const { attributes, elements } = parseProperties(node);
31384
- const subs = nodeListHandler.handler({
31385
- ...params2,
31386
- insideTrackChange: true,
31387
- nodes: elements,
31388
- path: [...params2.path || [], node]
31389
- });
31390
- const changeType = name === "w:del" ? TrackDeleteMarkName : TrackInsertMarkName;
31391
- const mappedAttributes = {
31392
- id: attributes["w:id"],
31393
- date: attributes["w:date"],
31394
- author: attributes["w:author"],
31395
- authorEmail: attributes["w:authorEmail"],
31396
- importedAuthor: `${attributes["w:author"]} (imported)`
31397
- };
31398
- subs.forEach((subElement) => {
31399
- if (subElement.marks === void 0) subElement.marks = [];
31400
- subElement.marks.push({ type: changeType, attrs: mappedAttributes });
31401
- });
31402
- return { nodes: subs, consumed: 1 };
31403
- };
31404
- const trackChangeNodeHandlerEntity = {
31405
- handlerName: "trackChangeNodeHandler",
31406
- handler: handleTrackChangeNode
31407
- };
31408
- const hyperlinkNodeHandlerEntity = generateV2HandlerEntity("hyperlinkNodeHandler", translator$X);
31409
- const runNodeHandlerEntity = generateV2HandlerEntity("runNodeHandler", translator$W);
31410
31758
  const handleTextNode = (params2) => {
31411
31759
  const { nodes, insideTrackChange } = params2;
31412
31760
  if (nodes.length === 0 || !(nodes[0].name === "w:t" || insideTrackChange && nodes[0].name === "w:delText")) {
@@ -31447,7 +31795,7 @@ const handleParagraphNode = (params2) => {
31447
31795
  if (nodes.length === 0 || nodes[0].name !== "w:p") {
31448
31796
  return { nodes: [], consumed: 0 };
31449
31797
  }
31450
- const schemaNode = translator$17.encode(params2);
31798
+ const schemaNode = translator$19.encode(params2);
31451
31799
  const newNodes = schemaNode ? [schemaNode] : [];
31452
31800
  return { nodes: newNodes, consumed: 1 };
31453
31801
  };
@@ -31460,7 +31808,7 @@ const handleSdtNode = (params2) => {
31460
31808
  if (nodes.length === 0 || nodes[0].name !== "w:sdt") {
31461
31809
  return { nodes: [], consumed: 0 };
31462
31810
  }
31463
- const result = translator$6.encode(params2);
31811
+ const result = translator$8.encode(params2);
31464
31812
  if (!result) {
31465
31813
  return { nodes: [], consumed: 0 };
31466
31814
  }
@@ -31550,7 +31898,7 @@ const handler = (params2) => {
31550
31898
  if (nodes.length === 0 || nodes[0].name !== "w:br") {
31551
31899
  return { nodes: [], consumed: 0 };
31552
31900
  }
31553
- const result = translator$1a.encode(params2);
31901
+ const result = translator$1c.encode(params2);
31554
31902
  if (!result) return { nodes: [], consumed: 0 };
31555
31903
  return {
31556
31904
  nodes: [result],
@@ -31622,7 +31970,7 @@ const handleBookmarkStartNode = (params2) => {
31622
31970
  if (isCustomMarkBookmark(nodes[0], params2.editor)) {
31623
31971
  return handleBookmarkNode(params2);
31624
31972
  }
31625
- const node = translator$5.encode(params2);
31973
+ const node = translator$7.encode(params2);
31626
31974
  if (!node) return { nodes: [], consumed: 0 };
31627
31975
  return { nodes: [node], consumed: 1 };
31628
31976
  };
@@ -31654,7 +32002,7 @@ const handleBookmarkEndNode = (params2) => {
31654
32002
  if (!nodes.length || nodes[0].name !== "w:bookmarkEnd") {
31655
32003
  return { nodes: [], consumed: 0 };
31656
32004
  }
31657
- const node = translator$4.encode(params2);
32005
+ const node = translator$6.encode(params2);
31658
32006
  if (!node) return { nodes: [], consumed: 0 };
31659
32007
  return { nodes: [node], consumed: 1 };
31660
32008
  };
@@ -31787,7 +32135,7 @@ const autoTotalPageCountEntity = {
31787
32135
  handlerName: "autoTotalPageCountEntity",
31788
32136
  handler: handleAutoTotalPageNumber
31789
32137
  };
31790
- const pageReferenceEntity = generateV2HandlerEntity("pageReferenceNodeHandler", translator$3);
32138
+ const pageReferenceEntity = generateV2HandlerEntity("pageReferenceNodeHandler", translator$5);
31791
32139
  const handlePictNode = (params2) => {
31792
32140
  const { nodes } = params2;
31793
32141
  if (!nodes.length || nodes[0].name !== "w:p") {
@@ -32176,14 +32524,14 @@ const handleTabNode = (params2) => {
32176
32524
  if (!nodes.length || nodes[0].name !== "w:tab") {
32177
32525
  return { nodes: [], consumed: 0 };
32178
32526
  }
32179
- const node = translator$18.encode(params2);
32527
+ const node = translator$1a.encode(params2);
32180
32528
  return { nodes: [node], consumed: 1 };
32181
32529
  };
32182
32530
  const tabNodeEntityHandler = {
32183
32531
  handlerName: "w:tabTranslator",
32184
32532
  handler: handleTabNode
32185
32533
  };
32186
- const tableOfContentsHandlerEntity = generateV2HandlerEntity("tableOfContentsHandler", translator$2);
32534
+ const tableOfContentsHandlerEntity = generateV2HandlerEntity("tableOfContentsHandler", translator$4);
32187
32535
  function preProcessPageInstruction(nodesToCombine) {
32188
32536
  const pageNumNode = {
32189
32537
  name: "sd:autoPageNumber",
@@ -33124,7 +33472,7 @@ function translateVRectContentBlock(params2) {
33124
33472
  const XML_NODE_NAME = "w:pict";
33125
33473
  const SD_NODE_NAME = ["shapeContainer", "contentBlock"];
33126
33474
  const validXmlAttributes = [];
33127
- function encode$1d(params2) {
33475
+ function encode$1f(params2) {
33128
33476
  const { node, pNode } = params2.extraParams;
33129
33477
  const { type: pictType, handler: handler2 } = pictNodeTypeStrategy(node);
33130
33478
  if (!handler2 || pictType === "unknown") {
@@ -33156,7 +33504,7 @@ const config = {
33156
33504
  xmlName: XML_NODE_NAME,
33157
33505
  sdNodeOrKeyName: SD_NODE_NAME,
33158
33506
  type: NodeTranslator.translatorTypes.NODE,
33159
- encode: encode$1d,
33507
+ encode: encode$1f,
33160
33508
  decode,
33161
33509
  attributes: validXmlAttributes
33162
33510
  };
@@ -33232,35 +33580,35 @@ function exportSchemaToJson(params2) {
33232
33580
  doc: translateDocumentNode,
33233
33581
  body: translateBodyNode,
33234
33582
  heading: translateHeadingNode,
33235
- paragraph: translator$17,
33236
- run: translator$W,
33583
+ paragraph: translator$19,
33584
+ run: translator$Y,
33237
33585
  text: translateTextNode,
33238
33586
  bulletList: translateList,
33239
33587
  orderedList: translateList,
33240
- lineBreak: translator$1a,
33241
- table: translator$b,
33242
- tableRow: translator$I,
33243
- tableCell: translator$a,
33244
- bookmarkStart: translator$5,
33245
- bookmarkEnd: translator$4,
33246
- fieldAnnotation: translator$6,
33247
- tab: translator$18,
33248
- image: translator$7,
33249
- hardBreak: translator$1a,
33588
+ lineBreak: translator$1c,
33589
+ table: translator$d,
33590
+ tableRow: translator$K,
33591
+ tableCell: translator$c,
33592
+ bookmarkStart: translator$7,
33593
+ bookmarkEnd: translator$6,
33594
+ fieldAnnotation: translator$8,
33595
+ tab: translator$1a,
33596
+ image: translator$9,
33597
+ hardBreak: translator$1c,
33250
33598
  commentRangeStart: commentRangeStartTranslator,
33251
33599
  commentRangeEnd: commentRangeEndTranslator,
33252
33600
  commentReference: () => null,
33253
33601
  shapeContainer: translator,
33254
33602
  shapeTextbox: translator,
33255
33603
  contentBlock: translator,
33256
- structuredContent: translator$6,
33257
- structuredContentBlock: translator$6,
33258
- documentPartObject: translator$6,
33259
- documentSection: translator$6,
33604
+ structuredContent: translator$8,
33605
+ structuredContentBlock: translator$8,
33606
+ documentPartObject: translator$8,
33607
+ documentSection: translator$8,
33260
33608
  "page-number": translatePageNumberNode,
33261
33609
  "total-page-number": translateTotalPageNumberNode,
33262
- pageReference: translator$3,
33263
- tableOfContents: translator$2
33610
+ pageReference: translator$5,
33611
+ tableOfContents: translator$4
33264
33612
  };
33265
33613
  let handler2 = router[type2];
33266
33614
  if (handler2 && "decode" in handler2 && typeof handler2.decode === "function") {
@@ -33596,62 +33944,22 @@ function getTextNodeForExport(text, marks, params2) {
33596
33944
  function translateTextNode(params2) {
33597
33945
  const { node, extraParams } = params2;
33598
33946
  const trackedMarks = [TrackInsertMarkName, TrackDeleteMarkName];
33599
- const isTrackedNode = node.marks?.some((m2) => trackedMarks.includes(m2.type));
33600
- if (isTrackedNode) return translateTrackedNode(params2);
33947
+ const trackedMark = node.marks?.find((m2) => trackedMarks.includes(m2.type));
33948
+ if (trackedMark) {
33949
+ switch (trackedMark.type) {
33950
+ case "trackDelete":
33951
+ return translator$3.decode(params2);
33952
+ case "trackInsert":
33953
+ return translator$2.decode(params2);
33954
+ }
33955
+ }
33601
33956
  const isLinkNode = node.marks?.some((m2) => m2.type === "link");
33602
33957
  if (isLinkNode && !extraParams?.linkProcessed) {
33603
- return translator$X.decode(params2);
33958
+ return translator$Z.decode(params2);
33604
33959
  }
33605
33960
  const { text, marks = [] } = node;
33606
33961
  return getTextNodeForExport(text, marks, params2);
33607
33962
  }
33608
- function createTrackStyleMark(marks) {
33609
- const trackStyleMark = marks.find((mark) => mark.type === TrackFormatMarkName);
33610
- if (trackStyleMark) {
33611
- const markElement = {
33612
- type: "element",
33613
- name: "w:rPrChange",
33614
- attributes: {
33615
- "w:id": trackStyleMark.attrs.id,
33616
- "w:author": trackStyleMark.attrs.author,
33617
- "w:authorEmail": trackStyleMark.attrs.authorEmail,
33618
- "w:date": trackStyleMark.attrs.date
33619
- },
33620
- elements: trackStyleMark.attrs.before.map((mark) => processOutputMarks([mark])).filter((r2) => r2 !== void 0)
33621
- };
33622
- return markElement;
33623
- }
33624
- return void 0;
33625
- }
33626
- function translateTrackedNode(params2) {
33627
- const { node } = params2;
33628
- const marks = node.marks;
33629
- const trackingMarks = [TrackInsertMarkName, TrackDeleteMarkName, TrackFormatMarkName];
33630
- const trackedMark = marks.find((m2) => trackingMarks.includes(m2.type));
33631
- const isInsert = trackedMark.type === TrackInsertMarkName;
33632
- const trackStyleMark = createTrackStyleMark(marks);
33633
- node.marks = marks.filter((m2) => !trackingMarks.includes(m2.type));
33634
- if (trackStyleMark) {
33635
- node.marks.push(trackStyleMark);
33636
- }
33637
- const translatedTextNode = exportSchemaToJson({ ...params2, node });
33638
- if (!isInsert) {
33639
- const textNode = translatedTextNode.elements.find((n) => n.name === "w:t");
33640
- textNode.name = "w:delText";
33641
- }
33642
- const trackedNode = {
33643
- name: isInsert ? "w:ins" : "w:del",
33644
- type: "element",
33645
- attributes: {
33646
- "w:id": trackedMark.attrs.id,
33647
- "w:author": trackedMark.attrs.author,
33648
- "w:authorEmail": trackedMark.attrs.authorEmail,
33649
- "w:date": trackedMark.attrs.date
33650
- },
33651
- elements: [translatedTextNode]
33652
- };
33653
- return trackedNode;
33654
- }
33655
33963
  function wrapTextInRun(nodeOrNodes, marks) {
33656
33964
  let elements = [];
33657
33965
  if (Array.isArray(nodeOrNodes)) elements = nodeOrNodes;
@@ -33907,7 +34215,7 @@ function translateMark(mark) {
33907
34215
  markElement.type = "element";
33908
34216
  break;
33909
34217
  case "underline": {
33910
- const translated = translator$14.decode({
34218
+ const translated = translator$16.decode({
33911
34219
  node: {
33912
34220
  attrs: {
33913
34221
  underlineType: attrs.underlineType ?? attrs.underline ?? null,
@@ -33971,7 +34279,7 @@ function translateMark(mark) {
33971
34279
  break;
33972
34280
  case "highlight": {
33973
34281
  const highlightValue = attrs.color ?? attrs.highlight ?? null;
33974
- const translated = translator$19.decode({ node: { attrs: { highlight: highlightValue } } });
34282
+ const translated = translator$1b.decode({ node: { attrs: { highlight: highlightValue } } });
33975
34283
  return translated || {};
33976
34284
  }
33977
34285
  case "link":
@@ -63914,6 +64222,58 @@ const registerImages = async (foundImages, editor, view) => {
63914
64222
  }
63915
64223
  });
63916
64224
  };
64225
+ const normalizeWrap = (attrs = {}) => {
64226
+ const wrap2 = attrs.wrap;
64227
+ if (wrap2?.type && wrap2.type !== "Inline") {
64228
+ return {
64229
+ type: wrap2.type,
64230
+ attrs: wrap2.attrs ?? {}
64231
+ };
64232
+ }
64233
+ if (wrap2?.type === "Inline" && Object.keys(wrap2.attrs ?? {}).length) {
64234
+ return {
64235
+ type: "Inline",
64236
+ attrs: wrap2.attrs
64237
+ };
64238
+ }
64239
+ if (!wrap2 && attrs.wrapText) {
64240
+ return {
64241
+ type: "Square",
64242
+ attrs: {
64243
+ wrapText: attrs.wrapText
64244
+ }
64245
+ };
64246
+ }
64247
+ if (!wrap2 && attrs.wrapTopAndBottom) {
64248
+ return {
64249
+ type: "TopAndBottom",
64250
+ attrs: {}
64251
+ };
64252
+ }
64253
+ if (wrap2?.type === "Inline") {
64254
+ return {
64255
+ type: "Inline",
64256
+ attrs: wrap2.attrs ?? {}
64257
+ };
64258
+ }
64259
+ return {
64260
+ type: "Inline",
64261
+ attrs: {}
64262
+ };
64263
+ };
64264
+ const normalizeMarginOffset = (marginOffset = {}) => {
64265
+ const { left: left2, horizontal, ...rest } = marginOffset;
64266
+ return {
64267
+ ...rest,
64268
+ horizontal: horizontal ?? left2
64269
+ };
64270
+ };
64271
+ const getNormalizedImageAttrs = (attrs = {}) => {
64272
+ return {
64273
+ wrap: normalizeWrap(attrs),
64274
+ marginOffset: normalizeMarginOffset(attrs.marginOffset ?? {})
64275
+ };
64276
+ };
63917
64277
  const ImagePositionPluginKey = new PluginKey("ImagePosition");
63918
64278
  const ImagePositionPlugin = ({ editor }) => {
63919
64279
  const { view } = editor;
@@ -63961,7 +64321,8 @@ const getImagePositionDecorations = (state2, view) => {
63961
64321
  let style2 = "";
63962
64322
  let className = "";
63963
64323
  const { vRelativeFrom, alignH } = node.attrs.anchorData;
63964
- const { size: size2, padding, marginOffset } = node.attrs;
64324
+ const { size: size2, padding } = node.attrs;
64325
+ const { marginOffset } = getNormalizedImageAttrs(node.attrs);
63965
64326
  const pageBreak = findPreviousDomNodeWithClass(view, pos, "pagination-break-wrapper");
63966
64327
  if (pageBreak) {
63967
64328
  switch (alignH) {
@@ -64078,7 +64439,24 @@ const Image = Node$1.create({
64078
64439
  rendered: false
64079
64440
  },
64080
64441
  originalAttributes: { rendered: false },
64081
- wrapTopAndBottom: { rendered: false },
64442
+ /**
64443
+ * @category Attribute
64444
+ * @param {Object} wrap - Wrapping options
64445
+ * @param {string} wrap.type - Wrap type: "None", "Square", "Through", "Tight", "TopAndBottom", "Inline"
64446
+ * @param {Object} [wrap.attrs] - Wrap attributes (only allowed attributes for the given type will be accepted)
64447
+ * @param {string} [wrap.attrs.wrapText] - Text wrapping mode for Square type: "bothSides", "largest", "left", "right"
64448
+ * @param {number} [wrap.attrs.distTop] - Top distance in pixels
64449
+ * @param {number} [wrap.attrs.distBottom] - Bottom distance in pixels
64450
+ * @param {number} [wrap.attrs.distLeft] - Left distance in pixels
64451
+ * @param {number} [wrap.attrs.distRight] - Right distance in pixels
64452
+ * @param {Array} [wrap.attrs.polygon] - Polygon points for Through/Tight types: [[x1,y1], [x2,y2], ...]
64453
+ * @param {boolean} [wrap.attrs.behindDoc] - Whether image should be behind document text (for wrapNone)
64454
+ */
64455
+ wrap: {
64456
+ default: { type: "Inline" },
64457
+ rendered: false
64458
+ // Handled in main renderDOM
64459
+ },
64082
64460
  anchorData: {
64083
64461
  default: null,
64084
64462
  rendered: false
@@ -64124,7 +64502,6 @@ const Image = Node$1.create({
64124
64502
  * @private
64125
64503
  */
64126
64504
  simplePos: { rendered: false },
64127
- wrapText: { rendered: false },
64128
64505
  extension: { rendered: false },
64129
64506
  size: {
64130
64507
  default: {},
@@ -64140,55 +64517,13 @@ const Image = Node$1.create({
64140
64517
  },
64141
64518
  padding: {
64142
64519
  default: {},
64143
- renderDOM: ({ size: size2 = {}, padding, marginOffset, transformData = {} }) => {
64144
- let { left: left2 = 0, top: top2 = 0, bottom: bottom2 = 0, right: right2 = 0 } = padding ?? {};
64145
- const { rotation } = transformData;
64146
- const { height, width } = size2;
64147
- if (rotation && height && width) {
64148
- const { horizontal, vertical } = getRotationMargins(width, height, rotation);
64149
- left2 += horizontal;
64150
- right2 += horizontal;
64151
- top2 += vertical;
64152
- bottom2 += vertical;
64153
- }
64154
- let style2 = "";
64155
- if (left2 && marginOffset?.left == null) style2 += `margin-left: ${left2}px;`;
64156
- if (top2 && marginOffset?.top == null) style2 += `margin-top: ${top2}px;`;
64157
- if (bottom2) style2 += `margin-bottom: ${bottom2}px;`;
64158
- if (right2) style2 += `margin-right: ${right2}px;`;
64159
- return { style: style2 };
64160
- }
64520
+ rendered: false
64521
+ // Handled in main renderDOM
64161
64522
  },
64162
64523
  marginOffset: {
64163
64524
  default: {},
64164
- renderDOM: ({ marginOffset, anchorData, transformData, size: size2 }) => {
64165
- const hasAnchorData = Boolean(anchorData);
64166
- const hasMarginOffsets = marginOffset?.left != null || marginOffset?.top != null;
64167
- if (!hasAnchorData && !hasMarginOffsets) return {};
64168
- const relativeFromPageV = anchorData?.vRelativeFrom === "page";
64169
- const maxMarginV = 500;
64170
- const baseLeft = marginOffset?.left ?? 0;
64171
- const baseTop = marginOffset?.top ?? 0;
64172
- let rotationLeft = 0;
64173
- let rotationTop = 0;
64174
- const { rotation } = transformData ?? {};
64175
- const { height, width } = size2 ?? {};
64176
- if (rotation && height && width) {
64177
- const { horizontal, vertical } = getRotationMargins(width, height, rotation);
64178
- rotationLeft = horizontal;
64179
- rotationTop = vertical;
64180
- }
64181
- const left2 = baseLeft + rotationLeft;
64182
- const top2 = baseTop + rotationTop;
64183
- let style2 = "";
64184
- if (left2) style2 += `margin-left: ${left2}px;`;
64185
- if (top2) {
64186
- if (relativeFromPageV && top2 >= maxMarginV) style2 += `margin-top: ${maxMarginV}px;`;
64187
- else style2 += `margin-top: ${top2}px;`;
64188
- }
64189
- if (!style2) return {};
64190
- return { style: style2 };
64191
- }
64525
+ rendered: false
64526
+ // Handled in main renderDOM
64192
64527
  },
64193
64528
  style: {
64194
64529
  default: null,
@@ -64207,8 +64542,181 @@ const Image = Node$1.create({
64207
64542
  }
64208
64543
  ];
64209
64544
  },
64210
- renderDOM({ htmlAttributes }) {
64211
- return ["img", Attribute2.mergeAttributes(this.options.htmlAttributes, htmlAttributes)];
64545
+ renderDOM({ node, htmlAttributes }) {
64546
+ const { wrap: wrap2, marginOffset } = getNormalizedImageAttrs(node.attrs);
64547
+ const { anchorData, padding, transformData = {}, size: size2 = { width: 0, height: 0 } } = node.attrs;
64548
+ const margin = {
64549
+ left: 0,
64550
+ right: 0,
64551
+ top: 0,
64552
+ bottom: 0
64553
+ };
64554
+ let centered = false;
64555
+ let floatRight = false;
64556
+ let baseHorizontal = marginOffset?.horizontal || 0;
64557
+ let style2 = "";
64558
+ if (padding) {
64559
+ if (padding.left) margin.left += padding.left;
64560
+ if (padding.right) margin.right += padding.right;
64561
+ if (padding.top) margin.top += padding.top;
64562
+ if (padding.bottom) margin.bottom += padding.bottom;
64563
+ }
64564
+ const { rotation } = transformData;
64565
+ const { height, width } = size2;
64566
+ if (rotation && height && width) {
64567
+ const { horizontal, vertical } = getRotationMargins(width, height, rotation);
64568
+ margin.left += horizontal;
64569
+ margin.right += horizontal;
64570
+ margin.top += vertical;
64571
+ margin.bottom += vertical;
64572
+ }
64573
+ if (wrap2 && wrap2.type) {
64574
+ const { type: type2, attrs = {} } = wrap2;
64575
+ switch (type2) {
64576
+ case "None":
64577
+ style2 += "position: absolute;";
64578
+ if (attrs.behindDoc) {
64579
+ style2 += "z-index: -1;";
64580
+ } else {
64581
+ style2 += "z-index: 1;";
64582
+ }
64583
+ break;
64584
+ case "Square":
64585
+ style2 += "shape-outside: border-box; clear: both;";
64586
+ if (attrs.wrapText === "right") {
64587
+ style2 += "float: left;";
64588
+ } else if (attrs.wrapText === "left") {
64589
+ style2 += "float: right;";
64590
+ floatRight = true;
64591
+ } else if (["largest", "bothSides"].includes(attrs.wrapText)) {
64592
+ const pageStyles2 = this.editor?.converter?.pageStyles;
64593
+ if (pageStyles2?.pageSize && pageStyles2?.pageMargins && size2.width) {
64594
+ const pageWidth = inchesToPixels(pageStyles2.pageSize.width);
64595
+ const leftMargin = inchesToPixels(pageStyles2.pageMargins.left);
64596
+ const rightMargin = inchesToPixels(pageStyles2.pageMargins.right);
64597
+ const contentWidth = pageWidth - leftMargin - rightMargin;
64598
+ const imageWidth = size2.width + (attrs.distLeft || 0) + (attrs.distRight || 0);
64599
+ const leftSpace = marginOffset.horizontal;
64600
+ const rightSpace = contentWidth - leftSpace - imageWidth;
64601
+ if (rightSpace < 0) {
64602
+ style2 += "float: left;";
64603
+ } else if (rightSpace > leftSpace) {
64604
+ style2 += "float: left;";
64605
+ } else {
64606
+ style2 += "float: right;";
64607
+ floatRight = true;
64608
+ baseHorizontal = rightSpace;
64609
+ }
64610
+ } else {
64611
+ style2 += "float: left;";
64612
+ }
64613
+ }
64614
+ if (attrs.distTop) margin.top += attrs.distTop;
64615
+ if (attrs.distBottom) margin.bottom += attrs.distBottom;
64616
+ if (attrs.distLeft) margin.left += attrs.distLeft;
64617
+ if (attrs.distRight) margin.right += attrs.distRight;
64618
+ break;
64619
+ case "Through":
64620
+ case "Tight":
64621
+ style2 += "clear: both;";
64622
+ const pageStyles = this.editor?.converter?.pageStyles;
64623
+ if (pageStyles?.pageSize && pageStyles?.pageMargins && size2.width) {
64624
+ const pageWidth = inchesToPixels(pageStyles.pageSize.width);
64625
+ const leftMargin = inchesToPixels(pageStyles.pageMargins.left);
64626
+ const rightMargin = inchesToPixels(pageStyles.pageMargins.right);
64627
+ const contentWidth = pageWidth - leftMargin - rightMargin;
64628
+ const imageWidth = size2.width + (attrs.distLeft || 0) + (attrs.distRight || 0);
64629
+ const leftSpace = marginOffset.horizontal;
64630
+ const rightSpace = contentWidth - leftSpace - imageWidth;
64631
+ if (rightSpace < 0) {
64632
+ style2 += "float: left;";
64633
+ } else if (rightSpace > leftSpace) {
64634
+ style2 += "float: left;";
64635
+ } else {
64636
+ style2 += "float: right;";
64637
+ floatRight = true;
64638
+ baseHorizontal = rightSpace;
64639
+ }
64640
+ } else {
64641
+ style2 += "float: left;";
64642
+ }
64643
+ if (attrs.distTop) margin.top += attrs.distTop;
64644
+ if (attrs.distBottom) margin.bottom += attrs.distBottom;
64645
+ if (attrs.distLeft) margin.left += attrs.distLeft;
64646
+ if (attrs.distRight) margin.right += attrs.distRight;
64647
+ if (attrs.polygon) {
64648
+ let horizontalOffset = floatRight ? attrs.polygon[0][0] || 0 : marginOffset.horizontal + 15;
64649
+ let maxX = 0;
64650
+ let minX = 0;
64651
+ let minY = 0;
64652
+ let maxY = 0;
64653
+ attrs.polygon.forEach(([x, y2]) => {
64654
+ if (floatRight && x < horizontalOffset) horizontalOffset = x;
64655
+ if (x > maxX) maxX = x;
64656
+ if (x < minX) minX = x;
64657
+ if (y2 > maxY) maxY = y2;
64658
+ if (y2 < minY) minY = y2;
64659
+ });
64660
+ const originalWidth = maxX - minX;
64661
+ const originalHeight = maxY - minY;
64662
+ const scaleWidth = Math.min(1, size2.width / originalWidth);
64663
+ const scaleHeight = Math.min(1, size2.height / originalHeight);
64664
+ const verticalOffset = Math.max(0, marginOffset.top);
64665
+ const points = attrs.polygon.map(([x, y2]) => `${horizontalOffset + x * scaleWidth}px ${verticalOffset + y2 * scaleHeight}px`).join(", ");
64666
+ style2 += `shape-outside: polygon(${points});`;
64667
+ }
64668
+ break;
64669
+ case "TopAndBottom":
64670
+ style2 += "display: block; clear: both;";
64671
+ if (attrs.distTop) margin.top += attrs.distTop;
64672
+ if (attrs.distBottom) margin.bottom += attrs.distBottom;
64673
+ centered = true;
64674
+ break;
64675
+ }
64676
+ }
64677
+ const hasAnchorData = Boolean(anchorData);
64678
+ const hasMarginOffsets = marginOffset?.horizontal != null || marginOffset?.top != null;
64679
+ if (hasAnchorData || hasMarginOffsets) {
64680
+ const relativeFromPageV = anchorData?.vRelativeFrom === "page";
64681
+ const maxMarginV = 500;
64682
+ const baseTop = Math.max(0, marginOffset?.top ?? 0);
64683
+ let rotationHorizontal = 0;
64684
+ let rotationTop = 0;
64685
+ const { rotation: rotation2 } = transformData ?? {};
64686
+ const { height: height2, width: width2 } = size2 ?? {};
64687
+ if (rotation2 && height2 && width2) {
64688
+ const { horizontal: horizontal2, vertical } = getRotationMargins(width2, height2, rotation2);
64689
+ rotationHorizontal = horizontal2;
64690
+ rotationTop = vertical;
64691
+ }
64692
+ const horizontal = baseHorizontal + rotationHorizontal;
64693
+ const top2 = baseTop + rotationTop;
64694
+ if (horizontal) {
64695
+ if (floatRight) {
64696
+ margin.right += horizontal;
64697
+ } else {
64698
+ margin.left += horizontal;
64699
+ }
64700
+ }
64701
+ if (top2) {
64702
+ if (relativeFromPageV && top2 >= maxMarginV) margin.top += maxMarginV;
64703
+ else margin.top += top2;
64704
+ }
64705
+ }
64706
+ if (centered) {
64707
+ style2 += "margin-left: auto; margin-right: auto;";
64708
+ } else {
64709
+ if (margin.left) style2 += `margin-left: ${margin.left}px;`;
64710
+ if (margin.right) style2 += `margin-right: ${margin.right}px;`;
64711
+ }
64712
+ if (margin.top) style2 += `margin-top: ${margin.top}px;`;
64713
+ if (margin.bottom) style2 += `margin-bottom: ${margin.bottom}px;`;
64714
+ const finalAttributes = { ...htmlAttributes };
64715
+ if (style2) {
64716
+ const existingStyle = finalAttributes.style || "";
64717
+ finalAttributes.style = existingStyle + (existingStyle ? " " : "") + style2;
64718
+ }
64719
+ return ["img", Attribute2.mergeAttributes(this.options.htmlAttributes, finalAttributes)];
64212
64720
  },
64213
64721
  addCommands() {
64214
64722
  return {
@@ -64230,6 +64738,85 @@ const Image = Node$1.create({
64230
64738
  type: this.name,
64231
64739
  attrs: options
64232
64740
  });
64741
+ },
64742
+ /**
64743
+ * Set the wrapping mode and attributes for the selected image
64744
+ * @category Command
64745
+ * @param {Object} options - Wrapping options
64746
+ * @param {string} options.type - Wrap type: "None", "Square", "Through", "Tight", "TopAndBottom", "Inline"
64747
+ * @param {Object} [options.attrs] - Wrap attributes (only allowed attributes for the given type will be accepted)
64748
+ * @param {string} [options.attrs.wrapText] - Text wrapping mode for Square type: "bothSides", "largest", "left", "right"
64749
+ * @param {number} [options.attrs.distTop] - Top distance in pixels
64750
+ * @param {number} [options.attrs.distBottom] - Bottom distance in pixels
64751
+ * @param {number} [options.attrs.distLeft] - Left distance in pixels
64752
+ * @param {number} [options.attrs.distRight] - Right distance in pixels
64753
+ * @param {Array} [options.attrs.polygon] - Polygon points for Through/Tight types: [[x1,y1], [x2,y2], ...]
64754
+ * @param {boolean} [options.attrs.behindDoc] - Whether image should be behind document text (for wrapNone)
64755
+ * @example
64756
+ * // No wrapping, behind document
64757
+ * editor.commands.setWrapping({ type: 'None', attrs: {behindDoc: true} })
64758
+ *
64759
+ * // Square wrapping on both sides with distances
64760
+ * editor.commands.setWrapping({
64761
+ * type: 'Square',
64762
+ * attrs: {
64763
+ * wrapText: 'bothSides',
64764
+ * distTop: 10,
64765
+ * distBottom: 10,
64766
+ * distLeft: 10,
64767
+ * distRight: 10
64768
+ * }
64769
+ * })
64770
+ *
64771
+ * // Tight wrapping with polygon
64772
+ * editor.commands.setWrapping({
64773
+ * type: 'Tight',
64774
+ * attrs: {
64775
+ * polygon: [[0, 0], [100, 0], [100, 100], [0, 100]]
64776
+ * }
64777
+ * })
64778
+ *
64779
+ * // Top and bottom wrapping
64780
+ * editor.commands.setWrapping({
64781
+ * type: 'TopAndBottom',
64782
+ * attrs: {
64783
+ * distTop: 15,
64784
+ * distBottom: 15
64785
+ * }
64786
+ * })
64787
+ */
64788
+ setWrapping: (options) => ({ chain, state: state2 }) => {
64789
+ const { selection } = state2;
64790
+ const { $from } = selection;
64791
+ const node = $from.nodeAfter;
64792
+ if (!node || node.type.name !== this.name) {
64793
+ return false;
64794
+ }
64795
+ const { type: type2, attrs = {} } = options;
64796
+ const allowedAttrs = {};
64797
+ const allowedAttributes = {
64798
+ None: ["behindDoc"],
64799
+ Square: ["wrapText", "distTop", "distBottom", "distLeft", "distRight"],
64800
+ Through: ["distTop", "distBottom", "distLeft", "distRight", "polygon"],
64801
+ Tight: ["distTop", "distBottom", "distLeft", "distRight", "polygon"],
64802
+ TopAndBottom: ["distTop", "distBottom"],
64803
+ Inline: []
64804
+ };
64805
+ const allowedForType = allowedAttributes[type2] || [];
64806
+ Object.keys(attrs).forEach((key2) => {
64807
+ if (allowedForType.includes(key2)) {
64808
+ allowedAttrs[key2] = attrs[key2];
64809
+ }
64810
+ });
64811
+ const updatedAttrs = {
64812
+ ...node.attrs,
64813
+ wrap: {
64814
+ type: type2,
64815
+ attrs: allowedAttrs
64816
+ },
64817
+ isAnchor: type2 !== "Inline"
64818
+ };
64819
+ return chain().updateAttributes(this.name, updatedAttrs).run();
64233
64820
  }
64234
64821
  };
64235
64822
  },
@@ -87578,72 +88165,72 @@ const _sfc_main = {
87578
88165
  const SuperInput = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-4d5cff52"]]);
87579
88166
  const additionalHandlers = Object.freeze({
87580
88167
  "mc:AlternateContent": translator$1,
87581
- "sd:pageReference": translator$3,
87582
- "sd:tableOfContents": translator$2,
87583
- "w:b": translator$16,
87584
- "w:bidiVisual": translator$H,
87585
- "w:bookmarkEnd": translator$4,
87586
- "w:bookmarkStart": translator$5,
87587
- "w:bottom": translator$u,
87588
- "w:br": translator$1a,
87589
- "w:cantSplit": translator$V,
87590
- "w:cnfStyle": translator$U,
87591
- "w:color": translator$12,
87592
- "w:divId": translator$T,
87593
- "w:drawing": translator$7,
87594
- "w:end": translator$s,
87595
- "w:gridAfter": translator$S,
87596
- "w:gridBefore": translator$R,
87597
- "w:gridCol": translator$d,
87598
- "w:hidden": translator$Q,
87599
- "w:highlight": translator$19,
87600
- "w:hyperlink": translator$X,
87601
- "w:i": translator$15,
87602
- "w:insideH": translator$q,
87603
- "w:insideV": translator$p,
87604
- "w:jc": translator$P,
87605
- "w:left": translator$o,
87606
- "w:p": translator$17,
87607
- "w:r": translator$W,
87608
- "w:rFonts": translator$11,
87609
- "w:rPr": translator$Y,
87610
- "w:rStyle": translator$10,
87611
- "w:right": translator$m,
87612
- "w:sdt": translator$6,
87613
- "w:shd": translator$G,
87614
- "w:start": translator$k,
87615
- "w:strike": translator$13,
87616
- "w:sz": translator$$,
87617
- "w:szCs": translator$_,
87618
- "w:tab": translator$18,
87619
- "w:tbl": translator$b,
87620
- "w:tblBorders": translator$g,
87621
- "w:tblCaption": translator$F,
87622
- "w:tblCellMar": translator$f,
87623
- "w:tblCellSpacing": translator$O,
87624
- "w:tblDescription": translator$E,
87625
- "w:tblGrid": translator$c,
87626
- "w:tblHeader": translator$N,
87627
- "w:tblInd": translator$D,
87628
- "w:tblLayout": translator$C,
87629
- "w:tblLook": translator$B,
87630
- "w:tblOverlap": translator$A,
87631
- "w:tblPr": translator$e,
87632
- "w:tblStyle": translator$z,
87633
- "w:tblStyleColBandSize": translator$y,
87634
- "w:tblStyleRowBandSize": translator$x,
87635
- "w:tblW": translator$w,
87636
- "w:tblpPr": translator$v,
87637
- "w:tc": translator$a,
87638
- "w:top": translator$i,
87639
- "w:tr": translator$I,
87640
- "w:trHeight": translator$M,
87641
- "w:trPr": translator$J,
87642
- "w:u": translator$14,
87643
- "w:wAfter": translator$L,
87644
- "w:wBefore": translator$K,
87645
- "wp:anchor": translator$9,
87646
- "wp:inline": translator$8,
88168
+ "sd:pageReference": translator$5,
88169
+ "sd:tableOfContents": translator$4,
88170
+ "w:b": translator$18,
88171
+ "w:bidiVisual": translator$J,
88172
+ "w:bookmarkEnd": translator$6,
88173
+ "w:bookmarkStart": translator$7,
88174
+ "w:bottom": translator$w,
88175
+ "w:br": translator$1c,
88176
+ "w:cantSplit": translator$X,
88177
+ "w:cnfStyle": translator$W,
88178
+ "w:color": translator$14,
88179
+ "w:divId": translator$V,
88180
+ "w:drawing": translator$9,
88181
+ "w:end": translator$u,
88182
+ "w:gridAfter": translator$U,
88183
+ "w:gridBefore": translator$T,
88184
+ "w:gridCol": translator$f,
88185
+ "w:hidden": translator$S,
88186
+ "w:highlight": translator$1b,
88187
+ "w:hyperlink": translator$Z,
88188
+ "w:i": translator$17,
88189
+ "w:insideH": translator$s,
88190
+ "w:insideV": translator$r,
88191
+ "w:jc": translator$R,
88192
+ "w:left": translator$q,
88193
+ "w:p": translator$19,
88194
+ "w:r": translator$Y,
88195
+ "w:rFonts": translator$13,
88196
+ "w:rPr": translator$_,
88197
+ "w:rStyle": translator$12,
88198
+ "w:right": translator$o,
88199
+ "w:sdt": translator$8,
88200
+ "w:shd": translator$I,
88201
+ "w:start": translator$m,
88202
+ "w:strike": translator$15,
88203
+ "w:sz": translator$11,
88204
+ "w:szCs": translator$10,
88205
+ "w:tab": translator$1a,
88206
+ "w:tbl": translator$d,
88207
+ "w:tblBorders": translator$i,
88208
+ "w:tblCaption": translator$H,
88209
+ "w:tblCellMar": translator$h,
88210
+ "w:tblCellSpacing": translator$Q,
88211
+ "w:tblDescription": translator$G,
88212
+ "w:tblGrid": translator$e,
88213
+ "w:tblHeader": translator$P,
88214
+ "w:tblInd": translator$F,
88215
+ "w:tblLayout": translator$E,
88216
+ "w:tblLook": translator$D,
88217
+ "w:tblOverlap": translator$C,
88218
+ "w:tblPr": translator$g,
88219
+ "w:tblStyle": translator$B,
88220
+ "w:tblStyleColBandSize": translator$A,
88221
+ "w:tblStyleRowBandSize": translator$z,
88222
+ "w:tblW": translator$y,
88223
+ "w:tblpPr": translator$x,
88224
+ "w:tc": translator$c,
88225
+ "w:top": translator$k,
88226
+ "w:tr": translator$K,
88227
+ "w:trHeight": translator$O,
88228
+ "w:trPr": translator$L,
88229
+ "w:u": translator$16,
88230
+ "w:wAfter": translator$N,
88231
+ "w:wBefore": translator$M,
88232
+ "wp:anchor": translator$b,
88233
+ "wp:inline": translator$a,
87647
88234
  "w:commentRangeStart": commentRangeStartTranslator,
87648
88235
  "w:commentRangeEnd": commentRangeEndTranslator
87649
88236
  });