@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
@@ -15090,14 +15090,21 @@ function twipsToInches(twips) {
15090
15090
  function twipsToPixels(twips) {
15091
15091
  if (twips == null) return;
15092
15092
  const inches = twipsToInches(twips);
15093
+ return inchesToPixels(inches);
15094
+ }
15095
+ function pixelsToTwips(pixels) {
15096
+ const inches = pixelsToInches(pixels);
15097
+ return inchesToTwips(inches);
15098
+ }
15099
+ function inchesToPixels(inches) {
15093
15100
  if (inches == null) return;
15094
15101
  const pixels = inches * 96;
15095
15102
  return Math.round(pixels * 1e3) / 1e3;
15096
15103
  }
15097
- function pixelsToTwips(pixels) {
15104
+ function pixelsToInches(pixels) {
15098
15105
  if (pixels == null) return;
15099
15106
  const inches = Number(pixels) / 96;
15100
- return inchesToTwips(inches);
15107
+ return inches;
15101
15108
  }
15102
15109
  function twipsToLines(twips) {
15103
15110
  if (twips == null) return;
@@ -15148,6 +15155,71 @@ function degreesToRot(degrees) {
15148
15155
  if (degrees == null) return;
15149
15156
  return degrees * 6e4;
15150
15157
  }
15158
+ function pixelsToPolygonUnits(pixels) {
15159
+ if (pixels == null) return;
15160
+ const pu = pixels * 96;
15161
+ return Math.round(pu);
15162
+ }
15163
+ function polygonUnitsToPixels(pu) {
15164
+ if (pu == null) return;
15165
+ const pixels = Number(pu) / 96;
15166
+ return Math.round(pixels * 1e3) / 1e3;
15167
+ }
15168
+ function polygonToObj(polygonNode) {
15169
+ if (!polygonNode) return null;
15170
+ const points = [];
15171
+ polygonNode.elements.forEach((element) => {
15172
+ if (["wp:start", "wp:lineTo"].includes(element.name)) {
15173
+ const { x, y: y2 } = element.attributes;
15174
+ points.push([polygonUnitsToPixels(x), polygonUnitsToPixels(y2)]);
15175
+ }
15176
+ });
15177
+ if (points.length > 1) {
15178
+ const firstPoint = points[0];
15179
+ const lastPoint = points[points.length - 1];
15180
+ if (firstPoint[0] === lastPoint[0] && firstPoint[1] === lastPoint[1]) {
15181
+ points.pop();
15182
+ }
15183
+ }
15184
+ return points;
15185
+ }
15186
+ function objToPolygon(points) {
15187
+ if (!points || !Array.isArray(points)) return null;
15188
+ const polygonNode = {
15189
+ name: "wp:wrapPolygon",
15190
+ type: "wp:wrapPolygon",
15191
+ attributes: {
15192
+ edited: "0"
15193
+ },
15194
+ elements: []
15195
+ };
15196
+ points.forEach((point, index2) => {
15197
+ const [x, y2] = point;
15198
+ const tagName = index2 === 0 ? "wp:start" : "wp:lineTo";
15199
+ const pointNode = {
15200
+ name: tagName,
15201
+ type: tagName,
15202
+ attributes: {
15203
+ x: pixelsToPolygonUnits(x),
15204
+ y: pixelsToPolygonUnits(y2)
15205
+ }
15206
+ };
15207
+ polygonNode.elements.push(pointNode);
15208
+ });
15209
+ if (points.length > 0) {
15210
+ const [startX, startY] = points[0];
15211
+ const closePointNode = {
15212
+ name: "wp:lineTo",
15213
+ type: "wp:lineTo",
15214
+ attributes: {
15215
+ x: pixelsToPolygonUnits(startX),
15216
+ y: pixelsToPolygonUnits(startY)
15217
+ }
15218
+ };
15219
+ polygonNode.elements.push(closePointNode);
15220
+ }
15221
+ return polygonNode;
15222
+ }
15151
15223
  const getTextIndentExportValue = (indent) => {
15152
15224
  const [value, unit] = parseSizeUnit(indent);
15153
15225
  const functionsMap = {
@@ -24463,37 +24535,37 @@ const _NodeTranslator = class _NodeTranslator2 {
24463
24535
  };
24464
24536
  __publicField$2(_NodeTranslator, "translatorTypes", TranslatorTypes);
24465
24537
  let NodeTranslator = _NodeTranslator;
24466
- const encode$1c = (attributes) => {
24538
+ const encode$1e = (attributes) => {
24467
24539
  return attributes["w:type"];
24468
24540
  };
24469
- const decode$14 = (attrs) => {
24541
+ const decode$16 = (attrs) => {
24470
24542
  const { lineBreakType } = attrs;
24471
24543
  return lineBreakType;
24472
24544
  };
24473
24545
  const attrConfig$G = Object.freeze({
24474
24546
  xmlName: "w:type",
24475
24547
  sdName: "lineBreakType",
24476
- encode: encode$1c,
24477
- decode: decode$14
24548
+ encode: encode$1e,
24549
+ decode: decode$16
24478
24550
  });
24479
- const encode$1b = (attributes) => {
24551
+ const encode$1d = (attributes) => {
24480
24552
  const xmlAttrValue = attributes["w:clear"];
24481
24553
  return xmlAttrValue;
24482
24554
  };
24483
- const decode$13 = (attrs) => {
24555
+ const decode$15 = (attrs) => {
24484
24556
  const { clear } = attrs;
24485
24557
  return clear;
24486
24558
  };
24487
24559
  const attrConfig$F = Object.freeze({
24488
24560
  xmlName: "w:clear",
24489
24561
  sdName: "clear",
24490
- encode: encode$1b,
24491
- decode: decode$13
24562
+ encode: encode$1d,
24563
+ decode: decode$15
24492
24564
  });
24493
- const validXmlAttributes$n = [attrConfig$G, attrConfig$F];
24494
- const XML_NODE_NAME$z = "w:br";
24565
+ const validXmlAttributes$p = [attrConfig$G, attrConfig$F];
24566
+ const XML_NODE_NAME$B = "w:br";
24495
24567
  const SD_NODE_NAME$h = "lineBreak";
24496
- const encode$1a = (_2, encodedAttrs) => {
24568
+ const encode$1c = (_2, encodedAttrs) => {
24497
24569
  const isPageBreak = encodedAttrs?.lineBreakType === "page";
24498
24570
  const translated = {
24499
24571
  type: isPageBreak ? "hardBreak" : "lineBreak"
@@ -24503,7 +24575,7 @@ const encode$1a = (_2, encodedAttrs) => {
24503
24575
  }
24504
24576
  return translated;
24505
24577
  };
24506
- const decode$12 = (params2, decodedAttrs) => {
24578
+ const decode$14 = (params2, decodedAttrs) => {
24507
24579
  const { node } = params2;
24508
24580
  if (!node) return;
24509
24581
  const wBreak = { name: "w:br" };
@@ -24520,39 +24592,39 @@ const decode$12 = (params2, decodedAttrs) => {
24520
24592
  };
24521
24593
  return translated;
24522
24594
  };
24523
- const config$w = {
24524
- xmlName: XML_NODE_NAME$z,
24595
+ const config$y = {
24596
+ xmlName: XML_NODE_NAME$B,
24525
24597
  sdNodeOrKeyName: SD_NODE_NAME$h,
24526
24598
  type: NodeTranslator.translatorTypes.NODE,
24527
- encode: encode$1a,
24528
- decode: decode$12,
24529
- attributes: validXmlAttributes$n
24599
+ encode: encode$1c,
24600
+ decode: decode$14,
24601
+ attributes: validXmlAttributes$p
24530
24602
  };
24531
- const translator$1a = NodeTranslator.from(config$w);
24532
- const encode$19 = (attributes) => attributes?.["w:val"];
24533
- const decode$11 = (attrs) => attrs?.highlight;
24603
+ const translator$1c = NodeTranslator.from(config$y);
24604
+ const encode$1b = (attributes) => attributes?.["w:val"];
24605
+ const decode$13 = (attrs) => attrs?.highlight;
24534
24606
  const attrConfig$E = Object.freeze({
24535
24607
  xmlName: "w:val",
24536
24608
  sdName: "highlight",
24537
- encode: encode$19,
24538
- decode: decode$11
24609
+ encode: encode$1b,
24610
+ decode: decode$13
24539
24611
  });
24540
- const validXmlAttributes$m = [attrConfig$E];
24541
- const XML_NODE_NAME$y = "w:highlight";
24542
- const SD_ATTR_KEY$g = "highlight";
24612
+ const validXmlAttributes$o = [attrConfig$E];
24613
+ const XML_NODE_NAME$A = "w:highlight";
24614
+ const SD_ATTR_KEY$i = "highlight";
24543
24615
  const DISABLED_TOKENS = /* @__PURE__ */ new Set(["transparent", "none", "inherit"]);
24544
- const encode$18 = (params2, encodedAttrs = {}) => {
24616
+ const encode$1a = (params2, encodedAttrs = {}) => {
24545
24617
  const { nodes } = params2;
24546
24618
  const node = nodes?.[0];
24547
24619
  const value = encodedAttrs.highlight ?? node?.attributes?.["w:val"];
24548
24620
  return {
24549
24621
  type: "attr",
24550
- xmlName: XML_NODE_NAME$y,
24551
- sdNodeOrKeyName: SD_ATTR_KEY$g,
24622
+ xmlName: XML_NODE_NAME$A,
24623
+ sdNodeOrKeyName: SD_ATTR_KEY$i,
24552
24624
  attributes: { "w:val": value ?? null }
24553
24625
  };
24554
24626
  };
24555
- const decode$10 = (params2) => {
24627
+ const decode$12 = (params2) => {
24556
24628
  const attrs = params2?.node?.attrs || {};
24557
24629
  const highlightValue = attrs.highlight ?? attrs.color ?? null;
24558
24630
  if (!highlightValue) return void 0;
@@ -24560,14 +24632,14 @@ const decode$10 = (params2) => {
24560
24632
  if (!normalizedValue) return void 0;
24561
24633
  if (DISABLED_TOKENS.has(normalizedValue)) {
24562
24634
  return {
24563
- name: XML_NODE_NAME$y,
24635
+ name: XML_NODE_NAME$A,
24564
24636
  attributes: { "w:val": "none" }
24565
24637
  };
24566
24638
  }
24567
24639
  const keyword = getDocxHighlightKeywordFromHex(highlightValue);
24568
24640
  if (keyword) {
24569
24641
  return {
24570
- name: XML_NODE_NAME$y,
24642
+ name: XML_NODE_NAME$A,
24571
24643
  attributes: { "w:val": keyword }
24572
24644
  };
24573
24645
  }
@@ -24582,63 +24654,63 @@ const decode$10 = (params2) => {
24582
24654
  }
24583
24655
  };
24584
24656
  };
24585
- const config$v = {
24586
- xmlName: XML_NODE_NAME$y,
24587
- sdNodeOrKeyName: SD_ATTR_KEY$g,
24657
+ const config$x = {
24658
+ xmlName: XML_NODE_NAME$A,
24659
+ sdNodeOrKeyName: SD_ATTR_KEY$i,
24588
24660
  type: NodeTranslator.translatorTypes.ATTRIBUTE,
24589
- encode: encode$18,
24590
- decode: decode$10,
24591
- attributes: validXmlAttributes$m
24661
+ encode: encode$1a,
24662
+ decode: decode$12,
24663
+ attributes: validXmlAttributes$o
24592
24664
  };
24593
- const translator$19 = NodeTranslator.from(config$v);
24594
- const encode$17 = (attributes) => {
24665
+ const translator$1b = NodeTranslator.from(config$x);
24666
+ const encode$19 = (attributes) => {
24595
24667
  return attributes["w:val"];
24596
24668
  };
24597
- const decode$$ = (attrs) => {
24669
+ const decode$11 = (attrs) => {
24598
24670
  const { tabSize } = attrs || {};
24599
24671
  return tabSize;
24600
24672
  };
24601
24673
  const attrConfig$D = Object.freeze({
24602
24674
  xmlName: "w:val",
24603
24675
  sdName: "tabSize",
24604
- encode: encode$17,
24605
- decode: decode$$
24676
+ encode: encode$19,
24677
+ decode: decode$11
24606
24678
  });
24607
- const encode$16 = (attributes) => {
24679
+ const encode$18 = (attributes) => {
24608
24680
  return attributes["w:leader"];
24609
24681
  };
24610
- const decode$_ = (attrs) => {
24682
+ const decode$10 = (attrs) => {
24611
24683
  const { leader } = attrs || {};
24612
24684
  return leader;
24613
24685
  };
24614
24686
  const attrConfig$C = Object.freeze({
24615
24687
  xmlName: "w:leader",
24616
24688
  sdName: "leader",
24617
- encode: encode$16,
24618
- decode: decode$_
24689
+ encode: encode$18,
24690
+ decode: decode$10
24619
24691
  });
24620
- const encode$15 = (attributes) => {
24692
+ const encode$17 = (attributes) => {
24621
24693
  return attributes["w:pos"];
24622
24694
  };
24623
- const decode$Z = (attrs) => {
24695
+ const decode$$ = (attrs) => {
24624
24696
  const { pos } = attrs || {};
24625
24697
  return pos;
24626
24698
  };
24627
24699
  const attrConfig$B = Object.freeze({
24628
24700
  xmlName: "w:pos",
24629
24701
  sdName: "pos",
24630
- encode: encode$15,
24631
- decode: decode$Z
24702
+ encode: encode$17,
24703
+ decode: decode$$
24632
24704
  });
24633
- const validXmlAttributes$l = [attrConfig$D, attrConfig$B, attrConfig$C];
24634
- const XML_NODE_NAME$x = "w:tab";
24705
+ const validXmlAttributes$n = [attrConfig$D, attrConfig$B, attrConfig$C];
24706
+ const XML_NODE_NAME$z = "w:tab";
24635
24707
  const SD_NODE_NAME$g = "tab";
24636
- const encode$14 = (_2, encodedAttrs = {}) => {
24708
+ const encode$16 = (_2, encodedAttrs = {}) => {
24637
24709
  const translated = { type: "tab" };
24638
24710
  if (encodedAttrs) translated.attrs = { ...encodedAttrs };
24639
24711
  return translated;
24640
24712
  };
24641
- const decode$Y = (params2, decodedAttrs = {}) => {
24713
+ const decode$_ = (params2, decodedAttrs = {}) => {
24642
24714
  const { node } = params2 || {};
24643
24715
  if (!node) return;
24644
24716
  const wTab = { name: "w:tab" };
@@ -24654,15 +24726,15 @@ const decode$Y = (params2, decodedAttrs = {}) => {
24654
24726
  }
24655
24727
  return translated;
24656
24728
  };
24657
- const config$u = {
24658
- xmlName: XML_NODE_NAME$x,
24729
+ const config$w = {
24730
+ xmlName: XML_NODE_NAME$z,
24659
24731
  sdNodeOrKeyName: SD_NODE_NAME$g,
24660
24732
  type: NodeTranslator.translatorTypes.NODE,
24661
- encode: encode$14,
24662
- decode: decode$Y,
24663
- attributes: validXmlAttributes$l
24733
+ encode: encode$16,
24734
+ decode: decode$_,
24735
+ attributes: validXmlAttributes$n
24664
24736
  };
24665
- const translator$18 = NodeTranslator.from(config$u);
24737
+ const translator$1a = NodeTranslator.from(config$w);
24666
24738
  const mergeTextNodes = (nodes) => {
24667
24739
  if (!nodes || !Array.isArray(nodes)) {
24668
24740
  return nodes;
@@ -25180,91 +25252,91 @@ const handleParagraphNode$1 = (params2) => {
25180
25252
  }
25181
25253
  return schemaNode;
25182
25254
  };
25183
- const encode$13 = (attributes) => {
25255
+ const encode$15 = (attributes) => {
25184
25256
  return attributes["w:rsidDel"];
25185
25257
  };
25186
- const decode$X = (attrs) => {
25258
+ const decode$Z = (attrs) => {
25187
25259
  return attrs.rsidDel;
25188
25260
  };
25189
25261
  const attrConfig$A = Object.freeze({
25190
25262
  xmlName: "w:rsidDel",
25191
25263
  sdName: "rsidDel",
25192
- encode: encode$13,
25193
- decode: decode$X
25264
+ encode: encode$15,
25265
+ decode: decode$Z
25194
25266
  });
25195
- const encode$12 = (attributes) => {
25267
+ const encode$14 = (attributes) => {
25196
25268
  return attributes["w:rsidP"];
25197
25269
  };
25198
- const decode$W = (attrs) => {
25270
+ const decode$Y = (attrs) => {
25199
25271
  return attrs.rsidP;
25200
25272
  };
25201
25273
  const attrConfig$z = Object.freeze({
25202
25274
  xmlName: "w:rsidP",
25203
25275
  sdName: "rsidP",
25204
- encode: encode$12,
25205
- decode: decode$W
25276
+ encode: encode$14,
25277
+ decode: decode$Y
25206
25278
  });
25207
- const encode$11 = (attributes) => {
25279
+ const encode$13 = (attributes) => {
25208
25280
  return attributes["w:rsidR"];
25209
25281
  };
25210
- const decode$V = (attrs) => {
25282
+ const decode$X = (attrs) => {
25211
25283
  return attrs.rsidR;
25212
25284
  };
25213
25285
  const attrConfig$y = Object.freeze({
25214
25286
  xmlName: "w:rsidR",
25215
25287
  sdName: "rsidR",
25216
- encode: encode$11,
25217
- decode: decode$V
25288
+ encode: encode$13,
25289
+ decode: decode$X
25218
25290
  });
25219
- const encode$10 = (attributes) => {
25291
+ const encode$12 = (attributes) => {
25220
25292
  return attributes["w:rsidRPr"];
25221
25293
  };
25222
- const decode$U = (attrs) => {
25294
+ const decode$W = (attrs) => {
25223
25295
  return attrs.rsidRPr;
25224
25296
  };
25225
25297
  const attrConfig$x = Object.freeze({
25226
25298
  xmlName: "w:rsidRPr",
25227
25299
  sdName: "rsidRPr",
25228
- encode: encode$10,
25229
- decode: decode$U
25300
+ encode: encode$12,
25301
+ decode: decode$W
25230
25302
  });
25231
- const encode$$ = (attributes) => {
25303
+ const encode$11 = (attributes) => {
25232
25304
  return attributes["w:rsidRDefault"];
25233
25305
  };
25234
- const decode$T = (attrs) => {
25306
+ const decode$V = (attrs) => {
25235
25307
  return attrs.rsidRDefault;
25236
25308
  };
25237
25309
  const attrConfig$w = Object.freeze({
25238
25310
  xmlName: "w:rsidRDefault",
25239
25311
  sdName: "rsidRDefault",
25240
- encode: encode$$,
25241
- decode: decode$T
25312
+ encode: encode$11,
25313
+ decode: decode$V
25242
25314
  });
25243
- const encode$_ = (attributes) => {
25315
+ const encode$10 = (attributes) => {
25244
25316
  return attributes["w14:paraId"];
25245
25317
  };
25246
- const decode$S = (attrs) => {
25318
+ const decode$U = (attrs) => {
25247
25319
  return attrs.paraId;
25248
25320
  };
25249
25321
  const attrConfig$v = Object.freeze({
25250
25322
  xmlName: "w14:paraId",
25251
25323
  sdName: "paraId",
25252
- encode: encode$_,
25253
- decode: decode$S
25324
+ encode: encode$10,
25325
+ decode: decode$U
25254
25326
  });
25255
- const encode$Z = (attributes) => {
25327
+ const encode$$ = (attributes) => {
25256
25328
  return attributes["w14:textId"];
25257
25329
  };
25258
- const decode$R = (attrs) => {
25330
+ const decode$T = (attrs) => {
25259
25331
  return attrs.textId;
25260
25332
  };
25261
25333
  const attrConfig$u = Object.freeze({
25262
25334
  xmlName: "w14:textId",
25263
25335
  sdName: "textId",
25264
- encode: encode$Z,
25265
- decode: decode$R
25336
+ encode: encode$$,
25337
+ decode: decode$T
25266
25338
  });
25267
- const validXmlAttributes$k = [
25339
+ const validXmlAttributes$m = [
25268
25340
  attrConfig$v,
25269
25341
  attrConfig$u,
25270
25342
  attrConfig$y,
@@ -25273,9 +25345,9 @@ const validXmlAttributes$k = [
25273
25345
  attrConfig$x,
25274
25346
  attrConfig$A
25275
25347
  ];
25276
- const XML_NODE_NAME$w = "w:p";
25348
+ const XML_NODE_NAME$y = "w:p";
25277
25349
  const SD_NODE_NAME$f = "paragraph";
25278
- const encode$Y = (params2, encodedAttrs = {}) => {
25350
+ const encode$_ = (params2, encodedAttrs = {}) => {
25279
25351
  const node = handleParagraphNode$1(params2);
25280
25352
  if (!node) return void 0;
25281
25353
  if (encodedAttrs && Object.keys(encodedAttrs).length) {
@@ -25283,7 +25355,7 @@ const encode$Y = (params2, encodedAttrs = {}) => {
25283
25355
  }
25284
25356
  return node;
25285
25357
  };
25286
- const decode$Q = (params2, decodedAttrs = {}) => {
25358
+ const decode$S = (params2, decodedAttrs = {}) => {
25287
25359
  const translated = translateParagraphNode(params2);
25288
25360
  if (!translated) return void 0;
25289
25361
  if (decodedAttrs && Object.keys(decodedAttrs).length) {
@@ -25291,16 +25363,16 @@ const decode$Q = (params2, decodedAttrs = {}) => {
25291
25363
  }
25292
25364
  return translated;
25293
25365
  };
25294
- const config$t = {
25295
- xmlName: XML_NODE_NAME$w,
25366
+ const config$v = {
25367
+ xmlName: XML_NODE_NAME$y,
25296
25368
  sdNodeOrKeyName: SD_NODE_NAME$f,
25297
25369
  type: NodeTranslator.translatorTypes.NODE,
25298
- encode: encode$Y,
25299
- decode: decode$Q,
25300
- attributes: validXmlAttributes$k
25370
+ encode: encode$_,
25371
+ decode: decode$S,
25372
+ attributes: validXmlAttributes$m
25301
25373
  };
25302
- const translator$17 = NodeTranslator.from(config$t);
25303
- const encode$X = (attributes) => {
25374
+ const translator$19 = NodeTranslator.from(config$v);
25375
+ const encode$Z = (attributes) => {
25304
25376
  const raw = attributes?.["w:val"];
25305
25377
  if (raw === void 0 || raw === null) return void 0;
25306
25378
  if (typeof raw === "boolean") return raw;
@@ -25310,24 +25382,24 @@ const encode$X = (attributes) => {
25310
25382
  if (val === "1" || val === "true" || val === "on") return true;
25311
25383
  return void 0;
25312
25384
  };
25313
- const decode$P = (runProps) => {
25385
+ const decode$R = (runProps) => {
25314
25386
  if (runProps?.bold === false) return "0";
25315
25387
  return void 0;
25316
25388
  };
25317
25389
  const attrConfig$t = Object.freeze({
25318
25390
  xmlName: "w:val",
25319
25391
  sdName: "bold",
25320
- encode: encode$X,
25321
- decode: decode$P
25392
+ encode: encode$Z,
25393
+ decode: decode$R
25322
25394
  });
25323
- const validXmlAttributes$j = [attrConfig$t];
25324
- const XML_NODE_NAME$v = "w:b";
25325
- const SD_ATTR_KEY$f = "bold";
25326
- const encode$W = (params2, encodedAttrs = {}) => {
25395
+ const validXmlAttributes$l = [attrConfig$t];
25396
+ const XML_NODE_NAME$x = "w:b";
25397
+ const SD_ATTR_KEY$h = "bold";
25398
+ const encode$Y = (params2, encodedAttrs = {}) => {
25327
25399
  const { nodes } = params2;
25328
25400
  const node = nodes[0];
25329
25401
  if (!node) return void 0;
25330
- const val = encodedAttrs?.[SD_ATTR_KEY$f];
25402
+ const val = encodedAttrs?.[SD_ATTR_KEY$h];
25331
25403
  let attributes;
25332
25404
  if (val === false) attributes = { "w:val": "0" };
25333
25405
  else if (val === true)
@@ -25335,85 +25407,85 @@ const encode$W = (params2, encodedAttrs = {}) => {
25335
25407
  else attributes = node.attributes || {};
25336
25408
  return {
25337
25409
  type: "attr",
25338
- xmlName: XML_NODE_NAME$v,
25339
- sdNodeOrKeyName: SD_ATTR_KEY$f,
25410
+ xmlName: XML_NODE_NAME$x,
25411
+ sdNodeOrKeyName: SD_ATTR_KEY$h,
25340
25412
  attributes
25341
25413
  };
25342
25414
  };
25343
- const config$s = {
25344
- xmlName: XML_NODE_NAME$v,
25345
- sdNodeOrKeyName: SD_ATTR_KEY$f,
25415
+ const config$u = {
25416
+ xmlName: XML_NODE_NAME$x,
25417
+ sdNodeOrKeyName: SD_ATTR_KEY$h,
25346
25418
  type: NodeTranslator.translatorTypes.ATTRIBUTE,
25347
- encode: encode$W,
25348
- attributes: validXmlAttributes$j
25419
+ encode: encode$Y,
25420
+ attributes: validXmlAttributes$l
25349
25421
  };
25350
- const translator$16 = NodeTranslator.from(config$s);
25351
- const XML_NODE_NAME$u = "w:i";
25352
- const SD_ATTR_KEY$e = "italic";
25353
- const encode$V = (params2) => {
25422
+ const translator$18 = NodeTranslator.from(config$u);
25423
+ const XML_NODE_NAME$w = "w:i";
25424
+ const SD_ATTR_KEY$g = "italic";
25425
+ const encode$X = (params2) => {
25354
25426
  const { nodes } = params2;
25355
25427
  const node = nodes?.[0];
25356
25428
  if (!node) return void 0;
25357
25429
  return {
25358
25430
  type: "attr",
25359
- xmlName: XML_NODE_NAME$u,
25360
- sdNodeOrKeyName: SD_ATTR_KEY$e,
25431
+ xmlName: XML_NODE_NAME$w,
25432
+ sdNodeOrKeyName: SD_ATTR_KEY$g,
25361
25433
  attributes: {
25362
25434
  "w:val": node.attributes?.["w:val"] ?? null
25363
25435
  }
25364
25436
  };
25365
25437
  };
25366
- const config$r = {
25367
- xmlName: XML_NODE_NAME$u,
25368
- sdNodeOrKeyName: SD_ATTR_KEY$e,
25438
+ const config$t = {
25439
+ xmlName: XML_NODE_NAME$w,
25440
+ sdNodeOrKeyName: SD_ATTR_KEY$g,
25369
25441
  type: NodeTranslator.translatorTypes.ATTRIBUTE,
25370
- encode: encode$V
25442
+ encode: encode$X
25371
25443
  };
25372
- const translator$15 = NodeTranslator.from(config$r);
25373
- const encode$U = (attributes) => attributes?.["w:val"];
25374
- const decode$O = (attrs) => attrs?.underline;
25444
+ const translator$17 = NodeTranslator.from(config$t);
25445
+ const encode$W = (attributes) => attributes?.["w:val"];
25446
+ const decode$Q = (attrs) => attrs?.underline;
25375
25447
  const attrConfig$s = Object.freeze({
25376
25448
  xmlName: "w:val",
25377
25449
  sdName: "underline",
25378
- encode: encode$U,
25379
- decode: decode$O
25450
+ encode: encode$W,
25451
+ decode: decode$Q
25380
25452
  });
25381
- const encode$T = (attributes) => attributes?.["w:color"];
25382
- const decode$N = (attrs) => attrs?.color;
25453
+ const encode$V = (attributes) => attributes?.["w:color"];
25454
+ const decode$P = (attrs) => attrs?.color;
25383
25455
  const attrConfig$r = Object.freeze({
25384
25456
  xmlName: "w:color",
25385
25457
  sdName: "color",
25386
- encode: encode$T,
25387
- decode: decode$N
25458
+ encode: encode$V,
25459
+ decode: decode$P
25388
25460
  });
25389
- const encode$S = (attributes) => attributes?.["w:themeColor"];
25390
- const decode$M = (attrs) => attrs?.themeColor;
25461
+ const encode$U = (attributes) => attributes?.["w:themeColor"];
25462
+ const decode$O = (attrs) => attrs?.themeColor;
25391
25463
  const attrConfig$q = Object.freeze({
25392
25464
  xmlName: "w:themeColor",
25393
25465
  sdName: "themeColor",
25394
- encode: encode$S,
25395
- decode: decode$M
25466
+ encode: encode$U,
25467
+ decode: decode$O
25396
25468
  });
25397
- const encode$R = (attributes) => attributes?.["w:themeTint"];
25398
- const decode$L = (attrs) => attrs?.themeTint;
25469
+ const encode$T = (attributes) => attributes?.["w:themeTint"];
25470
+ const decode$N = (attrs) => attrs?.themeTint;
25399
25471
  const attrConfig$p = Object.freeze({
25400
25472
  xmlName: "w:themeTint",
25401
25473
  sdName: "themeTint",
25402
- encode: encode$R,
25403
- decode: decode$L
25474
+ encode: encode$T,
25475
+ decode: decode$N
25404
25476
  });
25405
- const encode$Q = (attributes) => attributes?.["w:themeShade"];
25406
- const decode$K = (attrs) => attrs?.themeShade;
25477
+ const encode$S = (attributes) => attributes?.["w:themeShade"];
25478
+ const decode$M = (attrs) => attrs?.themeShade;
25407
25479
  const attrConfig$o = Object.freeze({
25408
25480
  xmlName: "w:themeShade",
25409
25481
  sdName: "themeShade",
25410
- encode: encode$Q,
25411
- decode: decode$K
25482
+ encode: encode$S,
25483
+ decode: decode$M
25412
25484
  });
25413
- const validXmlAttributes$i = [attrConfig$s, attrConfig$r, attrConfig$q, attrConfig$p, attrConfig$o];
25414
- const XML_NODE_NAME$t = "w:u";
25415
- const SD_ATTR_KEY$d = "underline";
25416
- const encode$P = (params2, encodedAttrs = {}) => {
25485
+ const validXmlAttributes$k = [attrConfig$s, attrConfig$r, attrConfig$q, attrConfig$p, attrConfig$o];
25486
+ const XML_NODE_NAME$v = "w:u";
25487
+ const SD_ATTR_KEY$f = "underline";
25488
+ const encode$R = (params2, encodedAttrs = {}) => {
25417
25489
  const { nodes } = params2;
25418
25490
  const node = nodes?.[0];
25419
25491
  const sourceAttrs = node?.attributes || {};
@@ -25429,12 +25501,12 @@ const encode$P = (params2, encodedAttrs = {}) => {
25429
25501
  if (themeShade !== void 0 && themeShade !== null) attributes["w:themeShade"] = themeShade;
25430
25502
  return {
25431
25503
  type: "attr",
25432
- xmlName: XML_NODE_NAME$t,
25433
- sdNodeOrKeyName: SD_ATTR_KEY$d,
25504
+ xmlName: XML_NODE_NAME$v,
25505
+ sdNodeOrKeyName: SD_ATTR_KEY$f,
25434
25506
  attributes
25435
25507
  };
25436
25508
  };
25437
- const decode$J = (params2) => {
25509
+ const decode$L = (params2) => {
25438
25510
  const attrs = params2?.node?.attrs || {};
25439
25511
  const underlineType = attrs.underlineType ?? attrs.underline ?? null;
25440
25512
  const color = attrs.underlineColor ?? attrs.color ?? null;
@@ -25452,20 +25524,20 @@ const decode$J = (params2) => {
25452
25524
  if (themeTint) attributes["w:themeTint"] = themeTint;
25453
25525
  if (themeShade) attributes["w:themeShade"] = themeShade;
25454
25526
  return {
25455
- name: XML_NODE_NAME$t,
25527
+ name: XML_NODE_NAME$v,
25456
25528
  attributes
25457
25529
  };
25458
25530
  };
25459
- const config$q = {
25460
- xmlName: XML_NODE_NAME$t,
25461
- sdNodeOrKeyName: SD_ATTR_KEY$d,
25531
+ const config$s = {
25532
+ xmlName: XML_NODE_NAME$v,
25533
+ sdNodeOrKeyName: SD_ATTR_KEY$f,
25462
25534
  type: NodeTranslator.translatorTypes.ATTRIBUTE,
25463
- encode: encode$P,
25464
- decode: decode$J,
25465
- attributes: validXmlAttributes$i
25535
+ encode: encode$R,
25536
+ decode: decode$L,
25537
+ attributes: validXmlAttributes$k
25466
25538
  };
25467
- const translator$14 = NodeTranslator.from(config$q);
25468
- const encode$O = (attributes) => {
25539
+ const translator$16 = NodeTranslator.from(config$s);
25540
+ const encode$Q = (attributes) => {
25469
25541
  const raw = attributes?.["w:val"];
25470
25542
  if (raw === void 0 || raw === null) return void 0;
25471
25543
  if (typeof raw === "boolean") return raw;
@@ -25475,24 +25547,24 @@ const encode$O = (attributes) => {
25475
25547
  if (val === "1" || val === "true" || val === "on") return true;
25476
25548
  return void 0;
25477
25549
  };
25478
- const decode$I = (attrs) => {
25550
+ const decode$K = (attrs) => {
25479
25551
  if (attrs?.strike === false) return "0";
25480
25552
  return void 0;
25481
25553
  };
25482
25554
  const attrConfig$n = Object.freeze({
25483
25555
  xmlName: "w:val",
25484
25556
  sdName: "strike",
25485
- encode: encode$O,
25486
- decode: decode$I
25557
+ encode: encode$Q,
25558
+ decode: decode$K
25487
25559
  });
25488
- const validXmlAttributes$h = [attrConfig$n];
25489
- const XML_NODE_NAME$s = "w:strike";
25490
- const SD_ATTR_KEY$c = "strike";
25491
- const encode$N = (params2, encodedAttrs = {}) => {
25560
+ const validXmlAttributes$j = [attrConfig$n];
25561
+ const XML_NODE_NAME$u = "w:strike";
25562
+ const SD_ATTR_KEY$e = "strike";
25563
+ const encode$P = (params2, encodedAttrs = {}) => {
25492
25564
  const { nodes } = params2;
25493
25565
  const node = nodes?.[0];
25494
25566
  if (!node) return void 0;
25495
- const val = encodedAttrs?.[SD_ATTR_KEY$c];
25567
+ const val = encodedAttrs?.[SD_ATTR_KEY$e];
25496
25568
  let attributes;
25497
25569
  if (val === false) attributes = { "w:val": "0" };
25498
25570
  else if (val === true) attributes = {};
@@ -25501,55 +25573,55 @@ const encode$N = (params2, encodedAttrs = {}) => {
25501
25573
  else if (val === true && attributes["w:val"] === void 0) delete attributes["w:val"];
25502
25574
  return {
25503
25575
  type: "attr",
25504
- xmlName: XML_NODE_NAME$s,
25505
- sdNodeOrKeyName: SD_ATTR_KEY$c,
25576
+ xmlName: XML_NODE_NAME$u,
25577
+ sdNodeOrKeyName: SD_ATTR_KEY$e,
25506
25578
  attributes
25507
25579
  };
25508
25580
  };
25509
- const config$p = {
25510
- xmlName: XML_NODE_NAME$s,
25511
- sdNodeOrKeyName: SD_ATTR_KEY$c,
25581
+ const config$r = {
25582
+ xmlName: XML_NODE_NAME$u,
25583
+ sdNodeOrKeyName: SD_ATTR_KEY$e,
25512
25584
  type: NodeTranslator.translatorTypes.ATTRIBUTE,
25513
- encode: encode$N,
25514
- attributes: validXmlAttributes$h
25585
+ encode: encode$P,
25586
+ attributes: validXmlAttributes$j
25515
25587
  };
25516
- const translator$13 = NodeTranslator.from(config$p);
25517
- const encode$M = (attributes) => attributes?.["w:val"];
25518
- const decode$H = (attrs) => attrs?.color;
25588
+ const translator$15 = NodeTranslator.from(config$r);
25589
+ const encode$O = (attributes) => attributes?.["w:val"];
25590
+ const decode$J = (attrs) => attrs?.color;
25519
25591
  const attrConfig$m = Object.freeze({
25520
25592
  xmlName: "w:val",
25521
25593
  sdName: "color",
25522
- encode: encode$M,
25523
- decode: decode$H
25594
+ encode: encode$O,
25595
+ decode: decode$J
25524
25596
  });
25525
- const encode$L = (attributes) => attributes?.["w:themeColor"];
25526
- const decode$G = (attrs) => attrs?.themeColor;
25597
+ const encode$N = (attributes) => attributes?.["w:themeColor"];
25598
+ const decode$I = (attrs) => attrs?.themeColor;
25527
25599
  const attrConfig$l = Object.freeze({
25528
25600
  xmlName: "w:themeColor",
25529
25601
  sdName: "themeColor",
25530
- encode: encode$L,
25531
- decode: decode$G
25602
+ encode: encode$N,
25603
+ decode: decode$I
25532
25604
  });
25533
- const encode$K = (attributes) => attributes?.["w:themeTint"];
25534
- const decode$F = (attrs) => attrs?.themeTint;
25605
+ const encode$M = (attributes) => attributes?.["w:themeTint"];
25606
+ const decode$H = (attrs) => attrs?.themeTint;
25535
25607
  const attrConfig$k = Object.freeze({
25536
25608
  xmlName: "w:themeTint",
25537
25609
  sdName: "themeTint",
25538
- encode: encode$K,
25539
- decode: decode$F
25610
+ encode: encode$M,
25611
+ decode: decode$H
25540
25612
  });
25541
- const encode$J = (attributes) => attributes?.["w:themeShade"];
25542
- const decode$E = (attrs) => attrs?.themeShade;
25613
+ const encode$L = (attributes) => attributes?.["w:themeShade"];
25614
+ const decode$G = (attrs) => attrs?.themeShade;
25543
25615
  const attrConfig$j = Object.freeze({
25544
25616
  xmlName: "w:themeShade",
25545
25617
  sdName: "themeShade",
25546
- encode: encode$J,
25547
- decode: decode$E
25618
+ encode: encode$L,
25619
+ decode: decode$G
25548
25620
  });
25549
- const validXmlAttributes$g = [attrConfig$m, attrConfig$l, attrConfig$k, attrConfig$j];
25550
- const XML_NODE_NAME$r = "w:color";
25551
- const SD_ATTR_KEY$b = "color";
25552
- const encode$I = (params2, encodedAttrs = {}) => {
25621
+ const validXmlAttributes$i = [attrConfig$m, attrConfig$l, attrConfig$k, attrConfig$j];
25622
+ const XML_NODE_NAME$t = "w:color";
25623
+ const SD_ATTR_KEY$d = "color";
25624
+ const encode$K = (params2, encodedAttrs = {}) => {
25553
25625
  const { nodes } = params2;
25554
25626
  const node = nodes?.[0];
25555
25627
  const sourceAttrs = node?.attributes || {};
@@ -25564,63 +25636,63 @@ const encode$I = (params2, encodedAttrs = {}) => {
25564
25636
  if (themeShade !== void 0 && themeShade !== null) attributes["w:themeShade"] = themeShade;
25565
25637
  return {
25566
25638
  type: "attr",
25567
- xmlName: XML_NODE_NAME$r,
25568
- sdNodeOrKeyName: SD_ATTR_KEY$b,
25639
+ xmlName: XML_NODE_NAME$t,
25640
+ sdNodeOrKeyName: SD_ATTR_KEY$d,
25569
25641
  attributes
25570
25642
  };
25571
25643
  };
25572
- const config$o = {
25573
- xmlName: XML_NODE_NAME$r,
25574
- sdNodeOrKeyName: SD_ATTR_KEY$b,
25644
+ const config$q = {
25645
+ xmlName: XML_NODE_NAME$t,
25646
+ sdNodeOrKeyName: SD_ATTR_KEY$d,
25575
25647
  type: NodeTranslator.translatorTypes.ATTRIBUTE,
25576
- encode: encode$I,
25577
- attributes: validXmlAttributes$g
25648
+ encode: encode$K,
25649
+ attributes: validXmlAttributes$i
25578
25650
  };
25579
- const translator$12 = NodeTranslator.from(config$o);
25580
- const encode$H = (attributes) => attributes?.["w:eastAsia"];
25581
- const decode$D = (attrs) => attrs?.eastAsia;
25651
+ const translator$14 = NodeTranslator.from(config$q);
25652
+ const encode$J = (attributes) => attributes?.["w:eastAsia"];
25653
+ const decode$F = (attrs) => attrs?.eastAsia;
25582
25654
  const attrConfig$i = Object.freeze({
25583
25655
  xmlName: "w:eastAsia",
25584
25656
  sdName: "eastAsia",
25585
- encode: encode$H,
25586
- decode: decode$D
25657
+ encode: encode$J,
25658
+ decode: decode$F
25587
25659
  });
25588
- const encode$G = (attributes) => attributes?.["w:ascii"];
25589
- const decode$C = (attrs) => attrs?.ascii;
25660
+ const encode$I = (attributes) => attributes?.["w:ascii"];
25661
+ const decode$E = (attrs) => attrs?.ascii;
25590
25662
  const attrConfig$h = Object.freeze({
25591
25663
  xmlName: "w:ascii",
25592
25664
  sdName: "ascii",
25593
- encode: encode$G,
25594
- decode: decode$C
25665
+ encode: encode$I,
25666
+ decode: decode$E
25595
25667
  });
25596
- const encode$F = (attributes) => attributes?.["w:hAnsi"];
25597
- const decode$B = (attrs) => attrs?.hAnsi;
25668
+ const encode$H = (attributes) => attributes?.["w:hAnsi"];
25669
+ const decode$D = (attrs) => attrs?.hAnsi;
25598
25670
  const attrConfig$g = Object.freeze({
25599
25671
  xmlName: "w:hAnsi",
25600
25672
  sdName: "hAnsi",
25601
- encode: encode$F,
25602
- decode: decode$B
25673
+ encode: encode$H,
25674
+ decode: decode$D
25603
25675
  });
25604
- const encode$E = (attributes) => attributes?.["w:cs"];
25605
- const decode$A = (attrs) => attrs?.cs;
25676
+ const encode$G = (attributes) => attributes?.["w:cs"];
25677
+ const decode$C = (attrs) => attrs?.cs;
25606
25678
  const attrConfig$f = Object.freeze({
25607
25679
  xmlName: "w:cs",
25608
25680
  sdName: "cs",
25609
- encode: encode$E,
25610
- decode: decode$A
25681
+ encode: encode$G,
25682
+ decode: decode$C
25611
25683
  });
25612
- const encode$D = (attributes) => attributes?.["w:val"];
25613
- const decode$z = (attrs) => attrs?.value;
25684
+ const encode$F = (attributes) => attributes?.["w:val"];
25685
+ const decode$B = (attrs) => attrs?.value;
25614
25686
  const attrConfig$e = Object.freeze({
25615
25687
  xmlName: "w:val",
25616
25688
  sdName: "value",
25617
- encode: encode$D,
25618
- decode: decode$z
25689
+ encode: encode$F,
25690
+ decode: decode$B
25619
25691
  });
25620
- const validXmlAttributes$f = [attrConfig$i, attrConfig$h, attrConfig$g, attrConfig$f, attrConfig$e];
25621
- const XML_NODE_NAME$q = "w:rFonts";
25622
- const SD_ATTR_KEY$a = "fontFamily";
25623
- const encode$C = (params2, encodedAttrs = {}) => {
25692
+ const validXmlAttributes$h = [attrConfig$i, attrConfig$h, attrConfig$g, attrConfig$f, attrConfig$e];
25693
+ const XML_NODE_NAME$s = "w:rFonts";
25694
+ const SD_ATTR_KEY$c = "fontFamily";
25695
+ const encode$E = (params2, encodedAttrs = {}) => {
25624
25696
  const { nodes } = params2;
25625
25697
  const node = nodes?.[0];
25626
25698
  const sourceAttrs = node?.attributes || {};
@@ -25646,109 +25718,109 @@ const encode$C = (params2, encodedAttrs = {}) => {
25646
25718
  if (attributes["w:val"] === void 0) delete attributes["w:val"];
25647
25719
  return {
25648
25720
  type: "attr",
25649
- xmlName: XML_NODE_NAME$q,
25650
- sdNodeOrKeyName: SD_ATTR_KEY$a,
25721
+ xmlName: XML_NODE_NAME$s,
25722
+ sdNodeOrKeyName: SD_ATTR_KEY$c,
25651
25723
  attributes
25652
25724
  };
25653
25725
  };
25654
- const config$n = {
25655
- xmlName: XML_NODE_NAME$q,
25656
- sdNodeOrKeyName: SD_ATTR_KEY$a,
25726
+ const config$p = {
25727
+ xmlName: XML_NODE_NAME$s,
25728
+ sdNodeOrKeyName: SD_ATTR_KEY$c,
25657
25729
  type: NodeTranslator.translatorTypes.ATTRIBUTE,
25658
- encode: encode$C,
25659
- attributes: validXmlAttributes$f
25730
+ encode: encode$E,
25731
+ attributes: validXmlAttributes$h
25660
25732
  };
25661
- const translator$11 = NodeTranslator.from(config$n);
25662
- const encode$B = (attributes) => attributes?.["w:val"];
25663
- const decode$y = (attrs) => attrs?.styleId;
25733
+ const translator$13 = NodeTranslator.from(config$p);
25734
+ const encode$D = (attributes) => attributes?.["w:val"];
25735
+ const decode$A = (attrs) => attrs?.styleId;
25664
25736
  const attrConfig$d = Object.freeze({
25665
25737
  xmlName: "w:val",
25666
25738
  sdName: "styleId",
25667
- encode: encode$B,
25668
- decode: decode$y
25739
+ encode: encode$D,
25740
+ decode: decode$A
25669
25741
  });
25670
- const validXmlAttributes$e = [attrConfig$d];
25671
- const XML_NODE_NAME$p = "w:rStyle";
25672
- const SD_ATTR_KEY$9 = "styleId";
25673
- const encode$A = (params2, encodedAttrs = {}) => {
25742
+ const validXmlAttributes$g = [attrConfig$d];
25743
+ const XML_NODE_NAME$r = "w:rStyle";
25744
+ const SD_ATTR_KEY$b = "styleId";
25745
+ const encode$C = (params2, encodedAttrs = {}) => {
25674
25746
  const { nodes } = params2;
25675
25747
  const node = nodes?.[0];
25676
25748
  const value = encodedAttrs.styleId ?? node?.attributes?.["w:val"];
25677
25749
  return {
25678
25750
  type: "attr",
25679
- xmlName: XML_NODE_NAME$p,
25680
- sdNodeOrKeyName: SD_ATTR_KEY$9,
25751
+ xmlName: XML_NODE_NAME$r,
25752
+ sdNodeOrKeyName: SD_ATTR_KEY$b,
25681
25753
  attributes: { "w:val": value ?? null }
25682
25754
  };
25683
25755
  };
25684
- const config$m = {
25685
- xmlName: XML_NODE_NAME$p,
25686
- sdNodeOrKeyName: SD_ATTR_KEY$9,
25756
+ const config$o = {
25757
+ xmlName: XML_NODE_NAME$r,
25758
+ sdNodeOrKeyName: SD_ATTR_KEY$b,
25687
25759
  type: NodeTranslator.translatorTypes.ATTRIBUTE,
25688
- encode: encode$A,
25689
- attributes: validXmlAttributes$e
25760
+ encode: encode$C,
25761
+ attributes: validXmlAttributes$g
25690
25762
  };
25691
- const translator$10 = NodeTranslator.from(config$m);
25692
- const encode$z = (attributes) => attributes?.["w:val"];
25693
- const decode$x = (attrs) => attrs?.fontSize;
25763
+ const translator$12 = NodeTranslator.from(config$o);
25764
+ const encode$B = (attributes) => attributes?.["w:val"];
25765
+ const decode$z = (attrs) => attrs?.fontSize;
25694
25766
  const attrConfig$c = Object.freeze({
25695
25767
  xmlName: "w:val",
25696
25768
  sdName: "fontSize",
25697
- encode: encode$z,
25698
- decode: decode$x
25769
+ encode: encode$B,
25770
+ decode: decode$z
25699
25771
  });
25700
- const validXmlAttributes$d = [attrConfig$c];
25701
- const XML_NODE_NAME$o = "w:sz";
25702
- const SD_ATTR_KEY$8 = "fontSize";
25703
- const encode$y = (params2, encodedAttrs = {}) => {
25772
+ const validXmlAttributes$f = [attrConfig$c];
25773
+ const XML_NODE_NAME$q = "w:sz";
25774
+ const SD_ATTR_KEY$a = "fontSize";
25775
+ const encode$A = (params2, encodedAttrs = {}) => {
25704
25776
  const { nodes } = params2;
25705
25777
  const node = nodes?.[0];
25706
25778
  const value = encodedAttrs.fontSize ?? node?.attributes?.["w:val"];
25707
25779
  return {
25708
25780
  type: "attr",
25709
- xmlName: XML_NODE_NAME$o,
25710
- sdNodeOrKeyName: SD_ATTR_KEY$8,
25781
+ xmlName: XML_NODE_NAME$q,
25782
+ sdNodeOrKeyName: SD_ATTR_KEY$a,
25711
25783
  attributes: { "w:val": value ?? null }
25712
25784
  };
25713
25785
  };
25714
- const config$l = {
25715
- xmlName: XML_NODE_NAME$o,
25716
- sdNodeOrKeyName: SD_ATTR_KEY$8,
25786
+ const config$n = {
25787
+ xmlName: XML_NODE_NAME$q,
25788
+ sdNodeOrKeyName: SD_ATTR_KEY$a,
25717
25789
  type: NodeTranslator.translatorTypes.ATTRIBUTE,
25718
- encode: encode$y,
25719
- attributes: validXmlAttributes$d
25790
+ encode: encode$A,
25791
+ attributes: validXmlAttributes$f
25720
25792
  };
25721
- const translator$$ = NodeTranslator.from(config$l);
25722
- const encode$x = (attributes) => attributes?.["w:val"];
25723
- const decode$w = (attrs) => attrs?.fontSizeCs;
25793
+ const translator$11 = NodeTranslator.from(config$n);
25794
+ const encode$z = (attributes) => attributes?.["w:val"];
25795
+ const decode$y = (attrs) => attrs?.fontSizeCs;
25724
25796
  const attrConfig$b = Object.freeze({
25725
25797
  xmlName: "w:val",
25726
25798
  sdName: "fontSizeCs",
25727
- encode: encode$x,
25728
- decode: decode$w
25799
+ encode: encode$z,
25800
+ decode: decode$y
25729
25801
  });
25730
- const validXmlAttributes$c = [attrConfig$b];
25731
- const XML_NODE_NAME$n = "w:szCs";
25732
- const SD_ATTR_KEY$7 = "fontSizeCs";
25733
- const encode$w = (params2, encodedAttrs = {}) => {
25802
+ const validXmlAttributes$e = [attrConfig$b];
25803
+ const XML_NODE_NAME$p = "w:szCs";
25804
+ const SD_ATTR_KEY$9 = "fontSizeCs";
25805
+ const encode$y = (params2, encodedAttrs = {}) => {
25734
25806
  const { nodes } = params2;
25735
25807
  const node = nodes?.[0];
25736
25808
  const value = encodedAttrs.fontSizeCs ?? node?.attributes?.["w:val"];
25737
25809
  return {
25738
25810
  type: "attr",
25739
- xmlName: XML_NODE_NAME$n,
25740
- sdNodeOrKeyName: SD_ATTR_KEY$7,
25811
+ xmlName: XML_NODE_NAME$p,
25812
+ sdNodeOrKeyName: SD_ATTR_KEY$9,
25741
25813
  attributes: { "w:val": value ?? null }
25742
25814
  };
25743
25815
  };
25744
- const config$k = {
25745
- xmlName: XML_NODE_NAME$n,
25746
- sdNodeOrKeyName: SD_ATTR_KEY$7,
25816
+ const config$m = {
25817
+ xmlName: XML_NODE_NAME$p,
25818
+ sdNodeOrKeyName: SD_ATTR_KEY$9,
25747
25819
  type: NodeTranslator.translatorTypes.ATTRIBUTE,
25748
- encode: encode$w,
25749
- attributes: validXmlAttributes$c
25820
+ encode: encode$y,
25821
+ attributes: validXmlAttributes$e
25750
25822
  };
25751
- const translator$_ = NodeTranslator.from(config$k);
25823
+ const translator$10 = NodeTranslator.from(config$m);
25752
25824
  const generateV2HandlerEntity = (handlerName, translator2) => ({
25753
25825
  handlerName,
25754
25826
  handler: (params2) => {
@@ -25882,9 +25954,9 @@ const integerToString = (value) => {
25882
25954
  const intValue = parseInteger(value);
25883
25955
  return intValue != void 0 ? String(intValue) : void 0;
25884
25956
  };
25885
- const XML_NODE_NAME$m = "w:caps";
25886
- const SD_ATTR_KEY$6 = "textTransform";
25887
- const encode$v = (params2, encodedAttrs = {}) => {
25957
+ const XML_NODE_NAME$o = "w:caps";
25958
+ const SD_ATTR_KEY$8 = "textTransform";
25959
+ const encode$x = (params2, encodedAttrs = {}) => {
25888
25960
  const { nodes } = params2;
25889
25961
  const node = nodes[0];
25890
25962
  if (!node) return void 0;
@@ -25896,31 +25968,31 @@ const encode$v = (params2, encodedAttrs = {}) => {
25896
25968
  }
25897
25969
  return {
25898
25970
  type: "attr",
25899
- xmlName: XML_NODE_NAME$m,
25900
- sdNodeOrKeyName: SD_ATTR_KEY$6,
25901
- attributes: { [SD_ATTR_KEY$6]: result }
25971
+ xmlName: XML_NODE_NAME$o,
25972
+ sdNodeOrKeyName: SD_ATTR_KEY$8,
25973
+ attributes: { [SD_ATTR_KEY$8]: result }
25902
25974
  };
25903
25975
  };
25904
- const config$j = {
25905
- xmlName: XML_NODE_NAME$m,
25906
- sdNodeOrKeyName: SD_ATTR_KEY$6,
25976
+ const config$l = {
25977
+ xmlName: XML_NODE_NAME$o,
25978
+ sdNodeOrKeyName: SD_ATTR_KEY$8,
25907
25979
  type: NodeTranslator.translatorTypes.ATTRIBUTE,
25908
- encode: encode$v,
25980
+ encode: encode$x,
25909
25981
  attributes: [createAttributeHandler("w:val")]
25910
25982
  };
25911
- const translator$Z = NodeTranslator.from(config$j);
25983
+ const translator$$ = NodeTranslator.from(config$l);
25912
25984
  const runPropertyTranslators = Object.freeze({
25913
- "w:b": translator$16,
25914
- "w:i": translator$15,
25915
- "w:u": translator$14,
25916
- "w:strike": translator$13,
25917
- "w:color": translator$12,
25918
- "w:highlight": translator$19,
25919
- "w:rFonts": translator$11,
25920
- "w:rStyle": translator$10,
25921
- "w:sz": translator$$,
25922
- "w:szCs": translator$_,
25923
- "w:caps": translator$Z
25985
+ "w:b": translator$18,
25986
+ "w:i": translator$17,
25987
+ "w:u": translator$16,
25988
+ "w:strike": translator$15,
25989
+ "w:color": translator$14,
25990
+ "w:highlight": translator$1b,
25991
+ "w:rFonts": translator$13,
25992
+ "w:rStyle": translator$12,
25993
+ "w:sz": translator$11,
25994
+ "w:szCs": translator$10,
25995
+ "w:caps": translator$$
25924
25996
  });
25925
25997
  const rawRunPropertyXmlNames = Object.freeze(["w:lang", "w:shd"]);
25926
25998
  const RAW_CHILD_NAME_SET = new Set(rawRunPropertyXmlNames);
@@ -25934,9 +26006,9 @@ const toRunPropertyEntry = (candidate) => {
25934
26006
  attributes: { ...candidate.attributes || {} }
25935
26007
  };
25936
26008
  };
25937
- const XML_NODE_NAME$l = "w:rPr";
25938
- const SD_ATTR_KEY$5 = "runProperties";
25939
- const encode$u = (params2) => {
26009
+ const XML_NODE_NAME$n = "w:rPr";
26010
+ const SD_ATTR_KEY$7 = "runProperties";
26011
+ const encode$w = (params2) => {
25940
26012
  const { nodes } = params2;
25941
26013
  const node = nodes?.[0] || {};
25942
26014
  const contents = Array.isArray(node.elements) ? node.elements : [];
@@ -25970,16 +26042,16 @@ const encode$u = (params2) => {
25970
26042
  attributes: runPropsArray
25971
26043
  };
25972
26044
  };
25973
- const config$i = {
25974
- xmlName: XML_NODE_NAME$l,
25975
- sdNodeOrKeyName: SD_ATTR_KEY$5,
26045
+ const config$k = {
26046
+ xmlName: XML_NODE_NAME$n,
26047
+ sdNodeOrKeyName: SD_ATTR_KEY$7,
25976
26048
  type: NodeTranslator.translatorTypes.ATTRIBUTE,
25977
- encode: encode$u
26049
+ encode: encode$w
25978
26050
  };
25979
- const translator$Y = NodeTranslator.from(config$i);
26051
+ const translator$_ = NodeTranslator.from(config$k);
25980
26052
  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;
25981
26053
  const containsEastAsianCharacters = (text) => EAST_ASIAN_CHARACTER_REGEX.test(text);
25982
- const collectRunProperties = (params2, rPrNode, translator2 = translator$Y) => {
26054
+ const collectRunProperties = (params2, rPrNode, translator2 = translator$_) => {
25983
26055
  if (!rPrNode) return { entries: [], hadRPr: false, styleChangeMarks: [] };
25984
26056
  const result = translator2.encode({ ...params2, nodes: [rPrNode] }) || {};
25985
26057
  let entries = [];
@@ -26452,7 +26524,7 @@ const ensureTrackedWrapper = (runs, trackingMarksByType = /* @__PURE__ */ new Ma
26452
26524
  }
26453
26525
  return runs;
26454
26526
  };
26455
- const XML_NODE_NAME$k = "w:hyperlink";
26527
+ const XML_NODE_NAME$m = "w:hyperlink";
26456
26528
  const SD_NODE_NAME$e = "link";
26457
26529
  const _createAttributeHandler = (xmlName, sdName) => ({
26458
26530
  xmlName,
@@ -26460,7 +26532,7 @@ const _createAttributeHandler = (xmlName, sdName) => ({
26460
26532
  encode: (attributes) => attributes[xmlName],
26461
26533
  decode: (attributes) => attributes[sdName]
26462
26534
  });
26463
- const validXmlAttributes$b = [
26535
+ const validXmlAttributes$d = [
26464
26536
  _createAttributeHandler("w:anchor", "anchor"),
26465
26537
  _createAttributeHandler("w:docLocation", "docLocation"),
26466
26538
  {
@@ -26473,7 +26545,7 @@ const validXmlAttributes$b = [
26473
26545
  _createAttributeHandler("r:id", "rId"),
26474
26546
  _createAttributeHandler("w:tgtFrame", "target")
26475
26547
  ];
26476
- const encode$t = (params2, encodedAttrs) => {
26548
+ const encode$v = (params2, encodedAttrs) => {
26477
26549
  const { nodes, docx, nodeListHandler } = params2;
26478
26550
  const node = nodes[0];
26479
26551
  let href = _resolveHref(docx, encodedAttrs);
@@ -26507,7 +26579,7 @@ const _resolveHref = (docx, encodedAttrs) => {
26507
26579
  }
26508
26580
  return href;
26509
26581
  };
26510
- function decode$v(params2) {
26582
+ function decode$x(params2) {
26511
26583
  const { hyperlinkGroup = [params2.node] } = params2.extraParams || {};
26512
26584
  const node = hyperlinkGroup[0];
26513
26585
  const linkMark = node.marks.find((m2) => m2.type === "link");
@@ -26556,55 +26628,55 @@ function _addNewLinkRelationship(params2, link) {
26556
26628
  });
26557
26629
  return id;
26558
26630
  }
26559
- const config$h = {
26560
- xmlName: XML_NODE_NAME$k,
26631
+ const config$j = {
26632
+ xmlName: XML_NODE_NAME$m,
26561
26633
  sdNodeOrKeyName: SD_NODE_NAME$e,
26562
26634
  type: NodeTranslator.translatorTypes.NODE,
26563
- encode: encode$t,
26564
- decode: decode$v,
26565
- attributes: validXmlAttributes$b
26635
+ encode: encode$v,
26636
+ decode: decode$x,
26637
+ attributes: validXmlAttributes$d
26566
26638
  };
26567
- const translator$X = NodeTranslator.from(config$h);
26568
- const encode$s = (attributes) => {
26639
+ const translator$Z = NodeTranslator.from(config$j);
26640
+ const encode$u = (attributes) => {
26569
26641
  return attributes["w:rsidR"];
26570
26642
  };
26571
- const decode$u = (attrs) => {
26643
+ const decode$w = (attrs) => {
26572
26644
  return attrs.rsidR;
26573
26645
  };
26574
26646
  const attrConfig$a = Object.freeze({
26575
26647
  xmlName: "w:rsidR",
26576
26648
  sdName: "rsidR",
26577
- encode: encode$s,
26578
- decode: decode$u
26649
+ encode: encode$u,
26650
+ decode: decode$w
26579
26651
  });
26580
- const encode$r = (attributes) => {
26652
+ const encode$t = (attributes) => {
26581
26653
  return attributes["w:rsidRPr"];
26582
26654
  };
26583
- const decode$t = (attrs) => {
26655
+ const decode$v = (attrs) => {
26584
26656
  return attrs.rsidRPr;
26585
26657
  };
26586
26658
  const attrConfig$9 = Object.freeze({
26587
26659
  xmlName: "w:rsidRPr",
26588
26660
  sdName: "rsidRPr",
26589
- encode: encode$r,
26590
- decode: decode$t
26661
+ encode: encode$t,
26662
+ decode: decode$v
26591
26663
  });
26592
- const encode$q = (attributes) => {
26664
+ const encode$s = (attributes) => {
26593
26665
  return attributes["w:rsidDel"];
26594
26666
  };
26595
- const decode$s = (attrs) => {
26667
+ const decode$u = (attrs) => {
26596
26668
  return attrs.rsidDel;
26597
26669
  };
26598
26670
  const attrConfig$8 = Object.freeze({
26599
26671
  xmlName: "w:rsidDel",
26600
26672
  sdName: "rsidDel",
26601
- encode: encode$q,
26602
- decode: decode$s
26673
+ encode: encode$s,
26674
+ decode: decode$u
26603
26675
  });
26604
- const validXmlAttributes$a = [attrConfig$a, attrConfig$9, attrConfig$8];
26605
- const XML_NODE_NAME$j = "w:r";
26676
+ const validXmlAttributes$c = [attrConfig$a, attrConfig$9, attrConfig$8];
26677
+ const XML_NODE_NAME$l = "w:r";
26606
26678
  const SD_KEY_NAME = "run";
26607
- const encode$p = (params2, encodedAttrs = {}) => {
26679
+ const encode$r = (params2, encodedAttrs = {}) => {
26608
26680
  const { nodes = [], nodeListHandler } = params2 || {};
26609
26681
  const runNode = nodes[0];
26610
26682
  if (!runNode) return void 0;
@@ -26652,7 +26724,7 @@ const encode$p = (params2, encodedAttrs = {}) => {
26652
26724
  }
26653
26725
  return runNodeResult;
26654
26726
  };
26655
- const decode$r = (params2, decodedAttrs = {}) => {
26727
+ const decode$t = (params2, decodedAttrs = {}) => {
26656
26728
  const { node } = params2 || {};
26657
26729
  if (!node) return void 0;
26658
26730
  const isLinkNode = node.marks?.some((m2) => m2.type === "link");
@@ -26661,7 +26733,7 @@ const decode$r = (params2, decodedAttrs = {}) => {
26661
26733
  ...params2.extraParams,
26662
26734
  linkProcessed: true
26663
26735
  };
26664
- return translator$X.decode({ ...params2, extraParams });
26736
+ return translator$Z.decode({ ...params2, extraParams });
26665
26737
  }
26666
26738
  const { runNode: runNodeForExport, trackingMarksByType } = prepareRunTrackingContext(node);
26667
26739
  const runAttrs = runNodeForExport.attrs || {};
@@ -26717,7 +26789,7 @@ const decode$r = (params2, decodedAttrs = {}) => {
26717
26789
  runs.push(trackedClone);
26718
26790
  return;
26719
26791
  }
26720
- const runWrapper = { name: XML_NODE_NAME$j, elements: [] };
26792
+ const runWrapper = { name: XML_NODE_NAME$l, elements: [] };
26721
26793
  applyBaseRunProps(runWrapper);
26722
26794
  if (!Array.isArray(runWrapper.elements)) runWrapper.elements = [];
26723
26795
  runWrapper.elements.push(cloneXmlNode(child));
@@ -26725,7 +26797,7 @@ const decode$r = (params2, decodedAttrs = {}) => {
26725
26797
  });
26726
26798
  const trackedRuns = ensureTrackedWrapper(runs, trackingMarksByType);
26727
26799
  if (!trackedRuns.length) {
26728
- const emptyRun = { name: XML_NODE_NAME$j, elements: [] };
26800
+ const emptyRun = { name: XML_NODE_NAME$l, elements: [] };
26729
26801
  applyBaseRunProps(emptyRun);
26730
26802
  trackedRuns.push(emptyRun);
26731
26803
  }
@@ -26739,15 +26811,15 @@ const decode$r = (params2, decodedAttrs = {}) => {
26739
26811
  }
26740
26812
  return trackedRuns;
26741
26813
  };
26742
- const config$g = {
26743
- xmlName: XML_NODE_NAME$j,
26814
+ const config$i = {
26815
+ xmlName: XML_NODE_NAME$l,
26744
26816
  sdNodeOrKeyName: SD_KEY_NAME,
26745
26817
  type: NodeTranslator.translatorTypes.NODE,
26746
- encode: encode$p,
26747
- decode: decode$r,
26748
- attributes: validXmlAttributes$a
26818
+ encode: encode$r,
26819
+ decode: decode$t,
26820
+ attributes: validXmlAttributes$c
26749
26821
  };
26750
- const translator$W = NodeTranslator.from(config$g);
26822
+ const translator$Y = NodeTranslator.from(config$i);
26751
26823
  function preProcessVerticalMergeCells(table, { editorSchema }) {
26752
26824
  if (!table || !Array.isArray(table.content)) {
26753
26825
  return table;
@@ -26788,13 +26860,13 @@ function preProcessVerticalMergeCells(table, { editorSchema }) {
26788
26860
  }
26789
26861
  return table;
26790
26862
  }
26791
- const translator$V = NodeTranslator.from({
26863
+ const translator$X = NodeTranslator.from({
26792
26864
  xmlName: "w:cantSplit",
26793
26865
  sdNodeOrKeyName: "cantSplit",
26794
26866
  encode: ({ nodes }) => ["1", "true"].includes(nodes[0].attributes?.["w:val"] ?? "1"),
26795
26867
  decode: ({ node }) => node.attrs?.cantSplit ? { attributes: {} } : void 0
26796
26868
  });
26797
- const translator$U = NodeTranslator.from({
26869
+ const translator$W = NodeTranslator.from({
26798
26870
  xmlName: "w:cnfStyle",
26799
26871
  sdNodeOrKeyName: "cnfStyle",
26800
26872
  attributes: [
@@ -26820,8 +26892,8 @@ const translator$U = NodeTranslator.from({
26820
26892
  return Object.keys(decodedAttrs).length > 0 ? { attributes: decodedAttrs } : void 0;
26821
26893
  }
26822
26894
  });
26823
- const translator$T = NodeTranslator.from(createSingleAttrPropertyHandler("w:divId"));
26824
- const translator$S = NodeTranslator.from(
26895
+ const translator$V = NodeTranslator.from(createSingleAttrPropertyHandler("w:divId"));
26896
+ const translator$U = NodeTranslator.from(
26825
26897
  createSingleAttrPropertyHandler(
26826
26898
  "w:gridAfter",
26827
26899
  null,
@@ -26830,7 +26902,7 @@ const translator$S = NodeTranslator.from(
26830
26902
  (v2) => integerToString(v2)
26831
26903
  )
26832
26904
  );
26833
- const translator$R = NodeTranslator.from(
26905
+ const translator$T = NodeTranslator.from(
26834
26906
  createSingleAttrPropertyHandler(
26835
26907
  "w:gridBefore",
26836
26908
  null,
@@ -26839,21 +26911,21 @@ const translator$R = NodeTranslator.from(
26839
26911
  (v2) => integerToString(v2)
26840
26912
  )
26841
26913
  );
26842
- const translator$Q = NodeTranslator.from({
26914
+ const translator$S = NodeTranslator.from({
26843
26915
  xmlName: "w:hidden",
26844
26916
  sdNodeOrKeyName: "hidden",
26845
26917
  encode: ({ nodes }) => parseBoolean(nodes[0].attributes?.["w:val"] ?? "1"),
26846
26918
  decode: ({ node }) => node.attrs.hidden ? { attributes: {} } : void 0
26847
26919
  });
26848
- const translator$P = NodeTranslator.from(createSingleAttrPropertyHandler("w:jc", "justification"));
26849
- const translator$O = NodeTranslator.from(createMeasurementPropertyHandler("w:tblCellSpacing", "tableCellSpacing"));
26850
- const translator$N = NodeTranslator.from({
26920
+ const translator$R = NodeTranslator.from(createSingleAttrPropertyHandler("w:jc", "justification"));
26921
+ const translator$Q = NodeTranslator.from(createMeasurementPropertyHandler("w:tblCellSpacing", "tableCellSpacing"));
26922
+ const translator$P = NodeTranslator.from({
26851
26923
  xmlName: "w:tblHeader",
26852
26924
  sdNodeOrKeyName: "repeatHeader",
26853
26925
  encode: ({ nodes }) => parseBoolean(nodes[0].attributes?.["w:val"] ?? "1"),
26854
26926
  decode: ({ node }) => node.attrs.repeatHeader ? { attributes: {} } : void 0
26855
26927
  });
26856
- const translator$M = NodeTranslator.from({
26928
+ const translator$O = NodeTranslator.from({
26857
26929
  xmlName: "w:trHeight",
26858
26930
  sdNodeOrKeyName: "rowHeight",
26859
26931
  encode: ({ nodes }) => {
@@ -26880,11 +26952,11 @@ const translator$M = NodeTranslator.from({
26880
26952
  return Object.keys(heightAttrs).length > 0 ? { attributes: heightAttrs } : void 0;
26881
26953
  }
26882
26954
  });
26883
- const translator$L = NodeTranslator.from(createMeasurementPropertyHandler("w:wAfter"));
26884
- const translator$K = NodeTranslator.from(createMeasurementPropertyHandler("w:wBefore"));
26885
- const XML_NODE_NAME$i = "w:trPr";
26886
- const SD_ATTR_KEY$4 = "tableRowProperties";
26887
- const encode$o = (params2) => {
26955
+ const translator$N = NodeTranslator.from(createMeasurementPropertyHandler("w:wAfter"));
26956
+ const translator$M = NodeTranslator.from(createMeasurementPropertyHandler("w:wBefore"));
26957
+ const XML_NODE_NAME$k = "w:trPr";
26958
+ const SD_ATTR_KEY$6 = "tableRowProperties";
26959
+ const encode$q = (params2) => {
26888
26960
  const { nodes } = params2;
26889
26961
  const node = nodes[0];
26890
26962
  let attributes = {
@@ -26898,12 +26970,12 @@ const encode$o = (params2) => {
26898
26970
  };
26899
26971
  return {
26900
26972
  type: NodeTranslator.translatorTypes.ATTRIBUTE,
26901
- xmlName: XML_NODE_NAME$i,
26902
- sdNodeOrKeyName: SD_ATTR_KEY$4,
26973
+ xmlName: XML_NODE_NAME$k,
26974
+ sdNodeOrKeyName: SD_ATTR_KEY$6,
26903
26975
  attributes
26904
26976
  };
26905
26977
  };
26906
- const decode$q = (params2) => {
26978
+ const decode$s = (params2) => {
26907
26979
  const { tableRowProperties = {} } = params2.node.attrs || {};
26908
26980
  const elements = decodeProperties(propertyTranslatorsBySdName$2, tableRowProperties);
26909
26981
  const newNode = {
@@ -26915,6 +26987,8 @@ const decode$q = (params2) => {
26915
26987
  return newNode;
26916
26988
  };
26917
26989
  const propertyTranslators$3 = [
26990
+ translator$X,
26991
+ translator$W,
26918
26992
  translator$V,
26919
26993
  translator$U,
26920
26994
  translator$T,
@@ -26924,9 +26998,7 @@ const propertyTranslators$3 = [
26924
26998
  translator$P,
26925
26999
  translator$O,
26926
27000
  translator$N,
26927
- translator$M,
26928
- translator$L,
26929
- translator$K
27001
+ translator$M
26930
27002
  ];
26931
27003
  const propertyTranslatorsByXmlName$2 = {};
26932
27004
  propertyTranslators$3.forEach((translator2) => {
@@ -26936,25 +27008,25 @@ const propertyTranslatorsBySdName$2 = {};
26936
27008
  propertyTranslators$3.forEach((translator2) => {
26937
27009
  propertyTranslatorsBySdName$2[translator2.sdNodeOrKeyName] = translator2;
26938
27010
  });
26939
- const config$f = {
26940
- xmlName: XML_NODE_NAME$i,
26941
- sdNodeOrKeyName: SD_ATTR_KEY$4,
27011
+ const config$h = {
27012
+ xmlName: XML_NODE_NAME$k,
27013
+ sdNodeOrKeyName: SD_ATTR_KEY$6,
26942
27014
  type: NodeTranslator.translatorTypes.ATTRIBUTE,
26943
- encode: encode$o,
26944
- decode: decode$q
27015
+ encode: encode$q,
27016
+ decode: decode$s
26945
27017
  };
26946
- const translator$J = NodeTranslator.from(config$f);
26947
- const XML_NODE_NAME$h = "w:tr";
27018
+ const translator$L = NodeTranslator.from(config$h);
27019
+ const XML_NODE_NAME$j = "w:tr";
26948
27020
  const SD_NODE_NAME$d = "tableRow";
26949
- const validXmlAttributes$9 = ["w:rsidDel", "w:rsidR", "w:rsidRPr", "w:rsidTr", "w14:paraId", "w14:textId"].map(
27021
+ const validXmlAttributes$b = ["w:rsidDel", "w:rsidR", "w:rsidRPr", "w:rsidTr", "w14:paraId", "w14:textId"].map(
26950
27022
  (xmlName) => createAttributeHandler(xmlName)
26951
27023
  );
26952
- const encode$n = (params2, encodedAttrs) => {
27024
+ const encode$p = (params2, encodedAttrs) => {
26953
27025
  const { row } = params2.extraParams;
26954
27026
  let tableRowProperties = {};
26955
27027
  const tPr = row.elements.find((el) => el.name === "w:trPr");
26956
27028
  if (tPr) {
26957
- ({ attributes: tableRowProperties } = translator$J.encode({
27029
+ ({ attributes: tableRowProperties } = translator$L.encode({
26958
27030
  ...params2,
26959
27031
  nodes: [tPr]
26960
27032
  }));
@@ -26967,7 +27039,7 @@ const encode$n = (params2, encodedAttrs) => {
26967
27039
  let currentColumnIndex = 0;
26968
27040
  const content = cellNodes?.map((n) => {
26969
27041
  let columnWidth = gridColumnWidths?.[currentColumnIndex] || null;
26970
- const result = translator$a.encode({
27042
+ const result = translator$c.encode({
26971
27043
  ...params2,
26972
27044
  extraParams: {
26973
27045
  ...params2.extraParams,
@@ -26989,7 +27061,7 @@ const encode$n = (params2, encodedAttrs) => {
26989
27061
  };
26990
27062
  return newNode;
26991
27063
  };
26992
- const decode$p = (params2, decodedAttrs) => {
27064
+ const decode$r = (params2, decodedAttrs) => {
26993
27065
  const { node } = params2;
26994
27066
  const elements = translateChildNodes(params2);
26995
27067
  if (node.attrs?.tableRowProperties) {
@@ -27001,7 +27073,7 @@ const decode$p = (params2, decodedAttrs) => {
27001
27073
  }
27002
27074
  }
27003
27075
  tableRowProperties["cantSplit"] = node.attrs["cantSplit"];
27004
- const trPr = translator$J.decode({
27076
+ const trPr = translator$L.decode({
27005
27077
  ...params2,
27006
27078
  node: { ...node, attrs: { ...node.attrs, tableRowProperties } }
27007
27079
  });
@@ -27013,22 +27085,22 @@ const decode$p = (params2, decodedAttrs) => {
27013
27085
  elements
27014
27086
  };
27015
27087
  };
27016
- const config$e = {
27017
- xmlName: XML_NODE_NAME$h,
27088
+ const config$g = {
27089
+ xmlName: XML_NODE_NAME$j,
27018
27090
  sdNodeOrKeyName: SD_NODE_NAME$d,
27019
27091
  type: NodeTranslator.translatorTypes.NODE,
27020
- encode: encode$n,
27021
- decode: decode$p,
27022
- attributes: validXmlAttributes$9
27092
+ encode: encode$p,
27093
+ decode: decode$r,
27094
+ attributes: validXmlAttributes$b
27023
27095
  };
27024
- const translator$I = NodeTranslator.from(config$e);
27025
- const translator$H = NodeTranslator.from({
27096
+ const translator$K = NodeTranslator.from(config$g);
27097
+ const translator$J = NodeTranslator.from({
27026
27098
  xmlName: "w:bidiVisual",
27027
27099
  sdNodeOrKeyName: "rightToLeft",
27028
27100
  encode: ({ nodes }) => parseBoolean(nodes[0].attributes?.["w:val"] ?? "1"),
27029
27101
  decode: ({ node }) => node.attrs.rightToLeft ? { attributes: {} } : void 0
27030
27102
  });
27031
- const translator$G = NodeTranslator.from({
27103
+ const translator$I = NodeTranslator.from({
27032
27104
  xmlName: "w:shd",
27033
27105
  sdNodeOrKeyName: "shading",
27034
27106
  attributes: [
@@ -27050,11 +27122,11 @@ const translator$G = NodeTranslator.from({
27050
27122
  return Object.keys(decodedAttrs).length > 0 ? { attributes: decodedAttrs } : void 0;
27051
27123
  }
27052
27124
  });
27053
- const translator$F = NodeTranslator.from(createSingleAttrPropertyHandler("w:tblCaption", "caption"));
27054
- const translator$E = NodeTranslator.from(createSingleAttrPropertyHandler("w:tblDescription", "description"));
27055
- const translator$D = NodeTranslator.from(createMeasurementPropertyHandler("w:tblInd", "tableIndent"));
27056
- const translator$C = NodeTranslator.from(createSingleAttrPropertyHandler("w:tblLayout", "tableLayout", "w:type"));
27057
- const translator$B = NodeTranslator.from({
27125
+ const translator$H = NodeTranslator.from(createSingleAttrPropertyHandler("w:tblCaption", "caption"));
27126
+ const translator$G = NodeTranslator.from(createSingleAttrPropertyHandler("w:tblDescription", "description"));
27127
+ const translator$F = NodeTranslator.from(createMeasurementPropertyHandler("w:tblInd", "tableIndent"));
27128
+ const translator$E = NodeTranslator.from(createSingleAttrPropertyHandler("w:tblLayout", "tableLayout", "w:type"));
27129
+ const translator$D = NodeTranslator.from({
27058
27130
  xmlName: "w:tblLook",
27059
27131
  sdNodeOrKeyName: "tblLook",
27060
27132
  attributes: ["w:firstColumn", "w:firstRow", "w:lastColumn", "w:lastRow", "w:noHBand", "w:noVBand"].map((attr) => createAttributeHandler(attr, null, parseBoolean, booleanToString)).concat([createAttributeHandler("w:val")]),
@@ -27066,16 +27138,16 @@ const translator$B = NodeTranslator.from({
27066
27138
  return Object.keys(decodedAttrs).length > 0 ? { attributes: decodedAttrs } : void 0;
27067
27139
  }
27068
27140
  });
27069
- const translator$A = NodeTranslator.from(createSingleAttrPropertyHandler("w:tblOverlap", "overlap"));
27070
- const translator$z = NodeTranslator.from(createSingleAttrPropertyHandler("w:tblStyle", "tableStyleId"));
27071
- const translator$y = NodeTranslator.from(
27141
+ const translator$C = NodeTranslator.from(createSingleAttrPropertyHandler("w:tblOverlap", "overlap"));
27142
+ const translator$B = NodeTranslator.from(createSingleAttrPropertyHandler("w:tblStyle", "tableStyleId"));
27143
+ const translator$A = NodeTranslator.from(
27072
27144
  createSingleAttrPropertyHandler("w:tblStyleColBandSize", "tableStyleColBandSize")
27073
27145
  );
27074
- const translator$x = NodeTranslator.from(
27146
+ const translator$z = NodeTranslator.from(
27075
27147
  createSingleAttrPropertyHandler("w:tblStyleRowBandSize", "tableStyleRowBandSize")
27076
27148
  );
27077
- const translator$w = NodeTranslator.from(createMeasurementPropertyHandler("w:tblW", "tableWidth"));
27078
- const translator$v = NodeTranslator.from({
27149
+ const translator$y = NodeTranslator.from(createMeasurementPropertyHandler("w:tblW", "tableWidth"));
27150
+ const translator$x = NodeTranslator.from({
27079
27151
  xmlName: "w:tblpPr",
27080
27152
  sdNodeOrKeyName: "floatingTableProperties",
27081
27153
  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))),
@@ -27087,29 +27159,29 @@ const translator$v = NodeTranslator.from({
27087
27159
  return Object.keys(decodedAttrs).length > 0 ? { attributes: decodedAttrs } : void 0;
27088
27160
  }
27089
27161
  });
27090
- const translator$u = NodeTranslator.from(createBorderPropertyHandler("w:bottom"));
27091
- const translator$t = NodeTranslator.from(createMeasurementPropertyHandler("w:bottom", "marginBottom"));
27092
- const translator$s = NodeTranslator.from(createBorderPropertyHandler("w:end"));
27093
- const translator$r = NodeTranslator.from(createMeasurementPropertyHandler("w:end", "marginEnd"));
27094
- const translator$q = NodeTranslator.from(createBorderPropertyHandler("w:insideH"));
27095
- const translator$p = NodeTranslator.from(createBorderPropertyHandler("w:insideV"));
27096
- const translator$o = NodeTranslator.from(createBorderPropertyHandler("w:left"));
27097
- const translator$n = NodeTranslator.from(createMeasurementPropertyHandler("w:left", "marginLeft"));
27098
- const translator$m = NodeTranslator.from(createBorderPropertyHandler("w:right"));
27099
- const translator$l = NodeTranslator.from(createMeasurementPropertyHandler("w:right", "marginRight"));
27100
- const translator$k = NodeTranslator.from(createBorderPropertyHandler("w:start"));
27101
- const translator$j = NodeTranslator.from(createMeasurementPropertyHandler("w:start", "marginStart"));
27102
- const translator$i = NodeTranslator.from(createBorderPropertyHandler("w:top"));
27103
- const translator$h = NodeTranslator.from(createMeasurementPropertyHandler("w:top", "marginTop"));
27104
- const XML_NODE_NAME$g = "w:tblBorders";
27105
- const SD_ATTR_KEY$3 = "borders";
27106
- const encode$m = (params2) => {
27162
+ const translator$w = NodeTranslator.from(createBorderPropertyHandler("w:bottom"));
27163
+ const translator$v = NodeTranslator.from(createMeasurementPropertyHandler("w:bottom", "marginBottom"));
27164
+ const translator$u = NodeTranslator.from(createBorderPropertyHandler("w:end"));
27165
+ const translator$t = NodeTranslator.from(createMeasurementPropertyHandler("w:end", "marginEnd"));
27166
+ const translator$s = NodeTranslator.from(createBorderPropertyHandler("w:insideH"));
27167
+ const translator$r = NodeTranslator.from(createBorderPropertyHandler("w:insideV"));
27168
+ const translator$q = NodeTranslator.from(createBorderPropertyHandler("w:left"));
27169
+ const translator$p = NodeTranslator.from(createMeasurementPropertyHandler("w:left", "marginLeft"));
27170
+ const translator$o = NodeTranslator.from(createBorderPropertyHandler("w:right"));
27171
+ const translator$n = NodeTranslator.from(createMeasurementPropertyHandler("w:right", "marginRight"));
27172
+ const translator$m = NodeTranslator.from(createBorderPropertyHandler("w:start"));
27173
+ const translator$l = NodeTranslator.from(createMeasurementPropertyHandler("w:start", "marginStart"));
27174
+ const translator$k = NodeTranslator.from(createBorderPropertyHandler("w:top"));
27175
+ const translator$j = NodeTranslator.from(createMeasurementPropertyHandler("w:top", "marginTop"));
27176
+ const XML_NODE_NAME$i = "w:tblBorders";
27177
+ const SD_ATTR_KEY$5 = "borders";
27178
+ const encode$o = (params2) => {
27107
27179
  const { nodes } = params2;
27108
27180
  const node = nodes[0];
27109
27181
  const attributes = encodeProperties(node, tblBordersTranslatorsByXmlName);
27110
27182
  return Object.keys(attributes).length > 0 ? attributes : void 0;
27111
27183
  };
27112
- const decode$o = (params2) => {
27184
+ const decode$q = (params2) => {
27113
27185
  const { borders = {} } = params2.node.attrs || {};
27114
27186
  const elements = decodeProperties(tblBordersTranslatorsBySdName, borders);
27115
27187
  const newNode = {
@@ -27121,14 +27193,14 @@ const decode$o = (params2) => {
27121
27193
  return newNode;
27122
27194
  };
27123
27195
  const propertyTranslators$2 = [
27196
+ translator$w,
27124
27197
  translator$u,
27125
27198
  translator$s,
27199
+ translator$r,
27126
27200
  translator$q,
27127
- translator$p,
27128
27201
  translator$o,
27129
27202
  translator$m,
27130
- translator$k,
27131
- translator$i
27203
+ translator$k
27132
27204
  ];
27133
27205
  const tblBordersTranslatorsByXmlName = {};
27134
27206
  const tblBordersTranslatorsBySdName = {};
@@ -27136,27 +27208,27 @@ propertyTranslators$2.forEach((translator2) => {
27136
27208
  tblBordersTranslatorsByXmlName[translator2.xmlName] = translator2;
27137
27209
  tblBordersTranslatorsBySdName[translator2.sdNodeOrKeyName] = translator2;
27138
27210
  });
27139
- const translator$g = NodeTranslator.from({
27140
- xmlName: XML_NODE_NAME$g,
27141
- sdNodeOrKeyName: SD_ATTR_KEY$3,
27211
+ const translator$i = NodeTranslator.from({
27212
+ xmlName: XML_NODE_NAME$i,
27213
+ sdNodeOrKeyName: SD_ATTR_KEY$5,
27142
27214
  type: NodeTranslator.translatorTypes.NODE,
27143
27215
  attributes: [],
27144
- encode: encode$m,
27145
- decode: decode$o
27216
+ encode: encode$o,
27217
+ decode: decode$q
27146
27218
  });
27147
- const XML_NODE_NAME$f = "w:tblCellMar";
27148
- const SD_ATTR_KEY$2 = "cellMargins";
27149
- const encode$l = (params2) => {
27219
+ const XML_NODE_NAME$h = "w:tblCellMar";
27220
+ const SD_ATTR_KEY$4 = "cellMargins";
27221
+ const encode$n = (params2) => {
27150
27222
  const { nodes } = params2;
27151
27223
  const node = nodes[0];
27152
27224
  const attributes = encodeProperties(node, propertyTranslatorsByXmlName$1);
27153
27225
  return Object.keys(attributes).length > 0 ? attributes : void 0;
27154
27226
  };
27155
- const decode$n = (params2) => {
27227
+ const decode$p = (params2) => {
27156
27228
  const { cellMargins = {} } = params2.node.attrs || {};
27157
27229
  const elements = decodeProperties(propertyTranslatorsBySdName$1, cellMargins);
27158
27230
  const newNode = {
27159
- name: XML_NODE_NAME$f,
27231
+ name: XML_NODE_NAME$h,
27160
27232
  type: "element",
27161
27233
  attributes: {},
27162
27234
  elements
@@ -27164,12 +27236,12 @@ const decode$n = (params2) => {
27164
27236
  return newNode;
27165
27237
  };
27166
27238
  const propertyTranslators$1 = [
27239
+ translator$v,
27167
27240
  translator$t,
27168
- translator$r,
27241
+ translator$p,
27169
27242
  translator$n,
27170
27243
  translator$l,
27171
- translator$j,
27172
- translator$h
27244
+ translator$j
27173
27245
  ];
27174
27246
  const propertyTranslatorsByXmlName$1 = {};
27175
27247
  const propertyTranslatorsBySdName$1 = {};
@@ -27177,27 +27249,27 @@ propertyTranslators$1.forEach((translator2) => {
27177
27249
  propertyTranslatorsByXmlName$1[translator2.xmlName] = translator2;
27178
27250
  propertyTranslatorsBySdName$1[translator2.sdNodeOrKeyName] = translator2;
27179
27251
  });
27180
- const translator$f = NodeTranslator.from({
27181
- xmlName: XML_NODE_NAME$f,
27182
- sdNodeOrKeyName: SD_ATTR_KEY$2,
27252
+ const translator$h = NodeTranslator.from({
27253
+ xmlName: XML_NODE_NAME$h,
27254
+ sdNodeOrKeyName: SD_ATTR_KEY$4,
27183
27255
  type: NodeTranslator.translatorTypes.NODE,
27184
27256
  attributes: [],
27185
- encode: encode$l,
27186
- decode: decode$n
27257
+ encode: encode$n,
27258
+ decode: decode$p
27187
27259
  });
27188
- const XML_NODE_NAME$e = "w:tblPr";
27189
- const SD_ATTR_KEY$1 = "tableProperties";
27190
- const encode$k = (params2) => {
27260
+ const XML_NODE_NAME$g = "w:tblPr";
27261
+ const SD_ATTR_KEY$3 = "tableProperties";
27262
+ const encode$m = (params2) => {
27191
27263
  const { nodes } = params2;
27192
27264
  const node = nodes[0];
27193
27265
  const attributes = encodeProperties(node, propertyTranslatorsByXmlName);
27194
27266
  return {
27195
- xmlName: XML_NODE_NAME$e,
27196
- sdNodeOrKeyName: SD_ATTR_KEY$1,
27267
+ xmlName: XML_NODE_NAME$g,
27268
+ sdNodeOrKeyName: SD_ATTR_KEY$3,
27197
27269
  attributes
27198
27270
  };
27199
27271
  };
27200
- const decode$m = (params2) => {
27272
+ const decode$o = (params2) => {
27201
27273
  const { tableProperties = {} } = params2.node.attrs || {};
27202
27274
  const elements = decodeProperties(propertyTranslatorsBySdName, tableProperties);
27203
27275
  const newNode = {
@@ -27209,11 +27281,13 @@ const decode$m = (params2) => {
27209
27281
  return newNode;
27210
27282
  };
27211
27283
  const propertyTranslators = [
27284
+ translator$J,
27285
+ translator$R,
27286
+ translator$I,
27212
27287
  translator$H,
27213
- translator$P,
27288
+ translator$Q,
27214
27289
  translator$G,
27215
27290
  translator$F,
27216
- translator$O,
27217
27291
  translator$E,
27218
27292
  translator$D,
27219
27293
  translator$C,
@@ -27222,10 +27296,8 @@ const propertyTranslators = [
27222
27296
  translator$z,
27223
27297
  translator$y,
27224
27298
  translator$x,
27225
- translator$w,
27226
- translator$v,
27227
- translator$g,
27228
- translator$f
27299
+ translator$i,
27300
+ translator$h
27229
27301
  ];
27230
27302
  const propertyTranslatorsByXmlName = {};
27231
27303
  const propertyTranslatorsBySdName = {};
@@ -27233,14 +27305,14 @@ propertyTranslators.forEach((translator2) => {
27233
27305
  propertyTranslatorsByXmlName[translator2.xmlName] = translator2;
27234
27306
  propertyTranslatorsBySdName[translator2.sdNodeOrKeyName] = translator2;
27235
27307
  });
27236
- const config$d = {
27237
- xmlName: XML_NODE_NAME$e,
27238
- sdNodeOrKeyName: SD_ATTR_KEY$1,
27239
- encode: encode$k,
27240
- decode: decode$m
27308
+ const config$f = {
27309
+ xmlName: XML_NODE_NAME$g,
27310
+ sdNodeOrKeyName: SD_ATTR_KEY$3,
27311
+ encode: encode$m,
27312
+ decode: decode$o
27241
27313
  };
27242
- const translator$e = NodeTranslator.from(config$d);
27243
- const translator$d = NodeTranslator.from(
27314
+ const translator$g = NodeTranslator.from(config$f);
27315
+ const translator$f = NodeTranslator.from(
27244
27316
  createSingleAttrPropertyHandler("w:gridCol", "col", "w:w", parseInteger, integerToString)
27245
27317
  );
27246
27318
  const DEFAULT_COLUMN_WIDTH_PX = 100;
@@ -27290,20 +27362,20 @@ const resolveFallbackColumnWidthTwips = (params2, totalColumns, cellMinWidthTwip
27290
27362
  }
27291
27363
  return Math.max(fallbackWidthTwips, cellMinWidthTwips);
27292
27364
  };
27293
- const XML_NODE_NAME$d = "w:tblGrid";
27294
- const SD_ATTR_KEY = "grid";
27365
+ const XML_NODE_NAME$f = "w:tblGrid";
27366
+ const SD_ATTR_KEY$2 = "grid";
27295
27367
  const cellMinWidth = pixelsToTwips(10);
27296
- const encode$j = (params2) => {
27368
+ const encode$l = (params2) => {
27297
27369
  const { nodes } = params2;
27298
27370
  const node = nodes[0];
27299
- const attributes = encodeProperties(node, { [translator$d.xmlName]: translator$d }, true);
27371
+ const attributes = encodeProperties(node, { [translator$f.xmlName]: translator$f }, true);
27300
27372
  return {
27301
- xmlName: XML_NODE_NAME$d,
27302
- sdNodeOrKeyName: SD_ATTR_KEY,
27373
+ xmlName: XML_NODE_NAME$f,
27374
+ sdNodeOrKeyName: SD_ATTR_KEY$2,
27303
27375
  attributes
27304
27376
  };
27305
27377
  };
27306
- const decode$l = (params2) => {
27378
+ const decode$n = (params2) => {
27307
27379
  const { grid: rawGrid } = params2.node.attrs || {};
27308
27380
  const grid = Array.isArray(rawGrid) ? rawGrid : [];
27309
27381
  const { firstRow = {} } = params2.extraParams || {};
@@ -27322,10 +27394,10 @@ const decode$l = (params2) => {
27322
27394
  numericWidth = fallbackColumnWidthTwips;
27323
27395
  }
27324
27396
  numericWidth = Math.max(numericWidth, cellMinWidth);
27325
- const decoded = translator$d.decode({
27397
+ const decoded = translator$f.decode({
27326
27398
  node: { type: (
27327
27399
  /** @type {string} */
27328
- translator$d.sdNodeOrKeyName
27400
+ translator$f.sdNodeOrKeyName
27329
27401
  ), attrs: { col: numericWidth } }
27330
27402
  });
27331
27403
  if (decoded) elements.push(decoded);
@@ -27360,19 +27432,19 @@ const decode$l = (params2) => {
27360
27432
  columnIndex++;
27361
27433
  }
27362
27434
  const newNode = {
27363
- name: XML_NODE_NAME$d,
27435
+ name: XML_NODE_NAME$f,
27364
27436
  attributes: {},
27365
27437
  elements
27366
27438
  };
27367
27439
  return newNode;
27368
27440
  };
27369
- const config$c = {
27370
- xmlName: XML_NODE_NAME$d,
27371
- sdNodeOrKeyName: SD_ATTR_KEY,
27372
- encode: encode$j,
27373
- decode: decode$l
27441
+ const config$e = {
27442
+ xmlName: XML_NODE_NAME$f,
27443
+ sdNodeOrKeyName: SD_ATTR_KEY$2,
27444
+ encode: encode$l,
27445
+ decode: decode$n
27374
27446
  };
27375
- const translator$c = NodeTranslator.from(config$c);
27447
+ const translator$e = NodeTranslator.from(config$e);
27376
27448
  const DEFAULT_PAGE_WIDTH_TWIPS = 12240;
27377
27449
  const DEFAULT_PAGE_MARGIN_TWIPS = 1440;
27378
27450
  const DEFAULT_CONTENT_WIDTH_TWIPS = DEFAULT_PAGE_WIDTH_TWIPS - 2 * DEFAULT_PAGE_MARGIN_TWIPS;
@@ -27435,19 +27507,19 @@ const buildFallbackGridForTable = ({ params: params2, rows, tableWidth, tableWid
27435
27507
  columnWidths: Array(columnCount).fill(fallbackColumnWidthPx)
27436
27508
  };
27437
27509
  };
27438
- const XML_NODE_NAME$c = "w:tbl";
27510
+ const XML_NODE_NAME$e = "w:tbl";
27439
27511
  const SD_NODE_NAME$c = "table";
27440
- const encode$i = (params2, encodedAttrs) => {
27512
+ const encode$k = (params2, encodedAttrs) => {
27441
27513
  const { nodes } = params2;
27442
27514
  const node = nodes[0];
27443
27515
  const tblPr = node.elements.find((el) => el.name === "w:tblPr");
27444
27516
  if (tblPr) {
27445
- const encodedProperties = translator$e.encode({ ...params2, nodes: [tblPr] });
27517
+ const encodedProperties = translator$g.encode({ ...params2, nodes: [tblPr] });
27446
27518
  encodedAttrs["tableProperties"] = encodedProperties?.attributes || {};
27447
27519
  }
27448
27520
  const tblGrid = node.elements.find((el) => el.name === "w:tblGrid");
27449
27521
  if (tblGrid) {
27450
- encodedAttrs["grid"] = translator$c.encode({ ...params2, nodes: [tblGrid] }).attributes;
27522
+ encodedAttrs["grid"] = translator$e.encode({ ...params2, nodes: [tblGrid] }).attributes;
27451
27523
  }
27452
27524
  [
27453
27525
  "tableStyleId",
@@ -27514,7 +27586,7 @@ const encode$i = (params2, encodedAttrs) => {
27514
27586
  }
27515
27587
  const content = [];
27516
27588
  rows.forEach((row) => {
27517
- const result = translator$I.encode({
27589
+ const result = translator$K.encode({
27518
27590
  ...params2,
27519
27591
  nodes: [row],
27520
27592
  extraParams: {
@@ -27533,13 +27605,13 @@ const encode$i = (params2, encodedAttrs) => {
27533
27605
  attrs: encodedAttrs
27534
27606
  };
27535
27607
  };
27536
- const decode$k = (params2, decodedAttrs) => {
27608
+ const decode$m = (params2, decodedAttrs) => {
27537
27609
  params2.node = preProcessVerticalMergeCells(params2.node, params2);
27538
27610
  const { node } = params2;
27539
27611
  const elements = translateChildNodes(params2);
27540
27612
  const firstRow = node.content?.find((n) => n.type === "tableRow");
27541
27613
  const properties = node.attrs.grid;
27542
- const element = translator$c.decode({
27614
+ const element = translator$e.decode({
27543
27615
  ...params2,
27544
27616
  node: { ...node, attrs: { ...node.attrs, grid: properties } },
27545
27617
  extraParams: {
@@ -27549,7 +27621,7 @@ const decode$k = (params2, decodedAttrs) => {
27549
27621
  if (element) elements.unshift(element);
27550
27622
  if (node.attrs?.tableProperties) {
27551
27623
  const properties2 = { ...node.attrs.tableProperties };
27552
- const element2 = translator$e.decode({
27624
+ const element2 = translator$g.decode({
27553
27625
  ...params2,
27554
27626
  node: { ...node, attrs: { ...node.attrs, tableProperties: properties2 } }
27555
27627
  });
@@ -27615,7 +27687,7 @@ function _getReferencedTableStyles(tableStyleReference, params2) {
27615
27687
  if (baseTblPr && baseTblPr.elements) {
27616
27688
  tblPr.elements.push(...baseTblPr.elements);
27617
27689
  }
27618
- const tableProperties = translator$e.encode({ ...params2, nodes: [tblPr] }).attributes;
27690
+ const tableProperties = translator$g.encode({ ...params2, nodes: [tblPr] }).attributes;
27619
27691
  const { borders, rowBorders } = _processTableBorders(tableProperties.borders || {});
27620
27692
  if (borders) stylesToReturn.borders = borders;
27621
27693
  if (rowBorders) stylesToReturn.rowBorders = rowBorders;
@@ -27632,16 +27704,16 @@ function _getReferencedTableStyles(tableStyleReference, params2) {
27632
27704
  }
27633
27705
  return stylesToReturn;
27634
27706
  }
27635
- const config$b = {
27636
- xmlName: XML_NODE_NAME$c,
27707
+ const config$d = {
27708
+ xmlName: XML_NODE_NAME$e,
27637
27709
  sdNodeOrKeyName: SD_NODE_NAME$c,
27638
27710
  type: NodeTranslator.translatorTypes.NODE,
27639
- encode: encode$i,
27640
- decode: decode$k,
27711
+ encode: encode$k,
27712
+ decode: decode$m,
27641
27713
  attributes: []
27642
27714
  };
27643
- const translator$b = NodeTranslator.from(config$b);
27644
- const tableNodeHandlerEntity = generateV2HandlerEntity("tableNodeHandler", translator$b);
27715
+ const translator$d = NodeTranslator.from(config$d);
27716
+ const tableNodeHandlerEntity = generateV2HandlerEntity("tableNodeHandler", translator$d);
27645
27717
  function getReferencedTableStyles(tblStyleTag, docx) {
27646
27718
  if (!tblStyleTag) return null;
27647
27719
  const stylesToReturn = {};
@@ -28003,10 +28075,10 @@ function generateCellMargins(cellMargins) {
28003
28075
  if (left2 != null) elements.push({ name: "w:left", attributes: { "w:w": pixelsToTwips(left2) } });
28004
28076
  return elements;
28005
28077
  }
28006
- const XML_NODE_NAME$b = "w:tc";
28078
+ const XML_NODE_NAME$d = "w:tc";
28007
28079
  const SD_NODE_NAME$b = "tableCell";
28008
- const validXmlAttributes$8 = [];
28009
- function encode$h(params2, encodedAttrs) {
28080
+ const validXmlAttributes$a = [];
28081
+ function encode$j(params2, encodedAttrs) {
28010
28082
  const {
28011
28083
  node,
28012
28084
  table,
@@ -28033,22 +28105,22 @@ function encode$h(params2, encodedAttrs) {
28033
28105
  }
28034
28106
  return schemaNode;
28035
28107
  }
28036
- function decode$j(params2, decodedAttrs) {
28108
+ function decode$l(params2, decodedAttrs) {
28037
28109
  const translated = translateTableCell(params2);
28038
28110
  if (decodedAttrs && Object.keys(decodedAttrs).length) {
28039
28111
  translated.attributes = { ...translated.attributes || {}, ...decodedAttrs };
28040
28112
  }
28041
28113
  return translated;
28042
28114
  }
28043
- const config$a = {
28044
- xmlName: XML_NODE_NAME$b,
28115
+ const config$c = {
28116
+ xmlName: XML_NODE_NAME$d,
28045
28117
  sdNodeOrKeyName: SD_NODE_NAME$b,
28046
28118
  type: NodeTranslator.translatorTypes.NODE,
28047
- encode: encode$h,
28048
- decode: decode$j,
28049
- attributes: validXmlAttributes$8
28119
+ encode: encode$j,
28120
+ decode: decode$l,
28121
+ attributes: validXmlAttributes$a
28050
28122
  };
28051
- const translator$a = NodeTranslator.from(config$a);
28123
+ const translator$c = NodeTranslator.from(config$c);
28052
28124
  function parseTagValueJSON(json) {
28053
28125
  if (typeof json !== "string") {
28054
28126
  return {};
@@ -28475,8 +28547,64 @@ function handleImageNode(node, params2, isAnchor) {
28475
28547
  const vRelativeFrom = positionVTag?.attributes.relativeFrom;
28476
28548
  const alignV = positionVTag?.elements?.find((el) => el.name === "wp:align")?.elements[0]?.text;
28477
28549
  const simplePos = node.elements.find((el) => el.name === "wp:simplePos");
28478
- const wrapSquare = node.elements.find((el) => el.name === "wp:wrapSquare");
28479
- const wrapTopAndBottom = node.elements.find((el) => el.name === "wp:wrapTopAndBottom");
28550
+ const wrapNode = isAnchor ? node.elements.find(
28551
+ (el) => ["wp:wrapNone", "wp:wrapSquare", "wp:wrapThrough", "wp:wrapTight", "wp:wrapTopAndBottom"].includes(el.name)
28552
+ ) : null;
28553
+ const wrap2 = isAnchor ? { type: wrapNode?.name.slice(7) || "None", attrs: {} } : { type: "Inline" };
28554
+ switch (wrap2.type) {
28555
+ case "Square":
28556
+ wrap2.attrs.wrapText = wrapNode.attributes.wrapText;
28557
+ if ("distB" in (wrapNode.attributes || {})) {
28558
+ wrap2.attrs.distBottom = emuToPixels(wrapNode.attributes.distB);
28559
+ }
28560
+ if ("distL" in (wrapNode.attributes || {})) {
28561
+ wrap2.attrs.distLeft = emuToPixels(wrapNode.attributes.distL);
28562
+ }
28563
+ if ("distR" in (wrapNode.attributes || {})) {
28564
+ wrap2.attrs.distRight = emuToPixels(wrapNode.attributes.distR);
28565
+ }
28566
+ if ("distT" in (wrapNode.attributes || {})) {
28567
+ wrap2.attrs.distTop = emuToPixels(wrapNode.attributes.distT);
28568
+ }
28569
+ break;
28570
+ case "Tight":
28571
+ case "Through": {
28572
+ if ("distL" in (wrapNode.attributes || {})) {
28573
+ wrap2.attrs.distLeft = emuToPixels(wrapNode.attributes.distL);
28574
+ }
28575
+ if ("distR" in (wrapNode.attributes || {})) {
28576
+ wrap2.attrs.distRight = emuToPixels(wrapNode.attributes.distR);
28577
+ }
28578
+ if ("distT" in (wrapNode.attributes || {})) {
28579
+ wrap2.attrs.distTop = emuToPixels(wrapNode.attributes.distT);
28580
+ }
28581
+ if ("distB" in (wrapNode.attributes || {})) {
28582
+ wrap2.attrs.distBottom = emuToPixels(wrapNode.attributes.distB);
28583
+ }
28584
+ if ("wrapText" in (wrapNode.attributes || {})) {
28585
+ wrap2.attrs.wrapText = wrapNode.attributes.wrapText;
28586
+ }
28587
+ const polygon = wrapNode.elements?.find((el) => el.name === "wp:wrapPolygon");
28588
+ if (polygon) {
28589
+ wrap2.attrs.polygon = polygonToObj(polygon);
28590
+ if (polygon.attributes?.edited !== void 0) {
28591
+ wrap2.attrs.polygonEdited = polygon.attributes.edited;
28592
+ }
28593
+ }
28594
+ break;
28595
+ }
28596
+ case "TopAndBottom":
28597
+ if ("distB" in (wrapNode.attributes || {})) {
28598
+ wrap2.attrs.distBottom = emuToPixels(wrapNode.attributes.distB);
28599
+ }
28600
+ if ("distT" in (wrapNode.attributes || {})) {
28601
+ wrap2.attrs.distTop = emuToPixels(wrapNode.attributes.distT);
28602
+ }
28603
+ break;
28604
+ case "None":
28605
+ wrap2.attrs.behindDoc = node.attributes?.behindDoc === "1";
28606
+ break;
28607
+ }
28480
28608
  const docPr = node.elements.find((el) => el.name === "wp:docPr");
28481
28609
  let anchorData = null;
28482
28610
  if (hRelativeFrom || alignH || vRelativeFrom || alignV) {
@@ -28488,7 +28616,7 @@ function handleImageNode(node, params2, isAnchor) {
28488
28616
  };
28489
28617
  }
28490
28618
  const marginOffset = {
28491
- left: positionHValue,
28619
+ horizontal: positionHValue,
28492
28620
  top: positionVValue
28493
28621
  };
28494
28622
  const { attributes: blipAttributes = {} } = blip;
@@ -28527,10 +28655,7 @@ function handleImageNode(node, params2, isAnchor) {
28527
28655
  y: simplePos.attributes.y
28528
28656
  }
28529
28657
  },
28530
- ...wrapSquare && {
28531
- wrapText: wrapSquare.attributes.wrapText
28532
- },
28533
- wrapTopAndBottom: !!wrapTopAndBottom,
28658
+ wrap: wrap2,
28534
28659
  originalPadding: {
28535
28660
  distT: attributes["distT"],
28536
28661
  distB: attributes["distB"],
@@ -28878,7 +29003,6 @@ function addNewImageRelationship(params2, imagePath) {
28878
29003
  function translateAnchorNode(params2) {
28879
29004
  const { attrs } = params2.node;
28880
29005
  const anchorElements = [];
28881
- const wrapElements = [];
28882
29006
  if (attrs.simplePos) {
28883
29007
  anchorElements.push({
28884
29008
  name: "wp:simplePos",
@@ -28890,10 +29014,10 @@ function translateAnchorNode(params2) {
28890
29014
  }
28891
29015
  if (attrs.anchorData) {
28892
29016
  const hElements = [];
28893
- if (attrs.marginOffset.left !== void 0) {
29017
+ if (attrs.marginOffset.horizontal !== void 0) {
28894
29018
  hElements.push({
28895
29019
  name: "wp:posOffset",
28896
- elements: [{ type: "text", text: pixelsToEmu(attrs.marginOffset.left).toString() }]
29020
+ elements: [{ type: "text", text: pixelsToEmu(attrs.marginOffset.horizontal).toString() }]
28897
29021
  });
28898
29022
  }
28899
29023
  if (attrs.anchorData.alignH) {
@@ -28926,38 +29050,110 @@ function translateAnchorNode(params2) {
28926
29050
  ...vElements.length && { elements: vElements }
28927
29051
  });
28928
29052
  }
28929
- if (attrs.wrapText) {
28930
- wrapElements.push({
28931
- name: "wp:wrapSquare",
28932
- attributes: {
28933
- wrapText: attrs.wrapText
28934
- }
28935
- });
29053
+ const nodeElements = translateImageNode(params2);
29054
+ const inlineAttrs = {
29055
+ ...attrs.originalAttributes || {},
29056
+ ...nodeElements.attributes || {}
29057
+ };
29058
+ if (inlineAttrs.relativeHeight == null) {
29059
+ inlineAttrs.relativeHeight = 1;
28936
29060
  }
28937
- if (attrs.wrapTopAndBottom) {
28938
- wrapElements.push({
28939
- name: "wp:wrapTopAndBottom"
28940
- });
29061
+ if (attrs.originalAttributes?.simplePos !== void 0) {
29062
+ inlineAttrs.simplePos = attrs.originalAttributes.simplePos;
29063
+ } else if (attrs.simplePos !== void 0) {
29064
+ inlineAttrs.simplePos = attrs.simplePos;
28941
29065
  }
28942
- if (!wrapElements.length) {
28943
- wrapElements.push({
28944
- name: "wp:wrapNone"
28945
- });
29066
+ if (attrs.originalAttributes?.locked !== void 0) {
29067
+ inlineAttrs.locked = attrs.originalAttributes.locked;
28946
29068
  }
28947
- const nodeElements = translateImageNode(params2);
28948
- const inlineAttrs = {
28949
- ...nodeElements.attributes,
28950
- simplePos: attrs.originalAttributes?.simplePos,
28951
- relativeHeight: 1,
28952
- behindDoc: attrs.originalAttributes?.behindDoc,
28953
- locked: attrs.originalAttributes?.locked,
28954
- layoutInCell: attrs.originalAttributes?.layoutInCell,
28955
- allowOverlap: attrs.originalAttributes?.allowOverlap
29069
+ if (attrs.originalAttributes?.layoutInCell !== void 0) {
29070
+ inlineAttrs.layoutInCell = attrs.originalAttributes.layoutInCell;
29071
+ }
29072
+ if (attrs.originalAttributes?.allowOverlap !== void 0) {
29073
+ inlineAttrs.allowOverlap = attrs.originalAttributes.allowOverlap;
29074
+ }
29075
+ const wrapElement = {
29076
+ name: `wp:wrap${attrs.wrap?.type || "None"}`
29077
+ // Important: wp:anchor will break if no wrapping is specified. We need to use wrapNone.
28956
29078
  };
29079
+ switch (attrs.wrap?.type) {
29080
+ case "Square":
29081
+ wrapElement.attributes = {
29082
+ wrapText: attrs.wrap.attrs.wrapText
29083
+ };
29084
+ if ("distBottom" in (attrs.wrap.attrs || {})) {
29085
+ wrapElement.attributes.distB = pixelsToEmu(attrs.wrap.attrs.distBottom);
29086
+ }
29087
+ if ("distLeft" in (attrs.wrap.attrs || {})) {
29088
+ wrapElement.attributes.distL = pixelsToEmu(attrs.wrap.attrs.distLeft);
29089
+ }
29090
+ if ("distRight" in (attrs.wrap.attrs || {})) {
29091
+ wrapElement.attributes.distR = pixelsToEmu(attrs.wrap.attrs.distRight);
29092
+ }
29093
+ if ("distTop" in (attrs.wrap.attrs || {})) {
29094
+ wrapElement.attributes.distT = pixelsToEmu(attrs.wrap.attrs.distTop);
29095
+ }
29096
+ break;
29097
+ case "TopAndBottom": {
29098
+ const attributes = {};
29099
+ let hasKeys = false;
29100
+ if ("distBottom" in (attrs.wrap.attrs || {})) {
29101
+ attributes.distB = pixelsToEmu(attrs.wrap.attrs.distBottom);
29102
+ hasKeys = true;
29103
+ }
29104
+ if ("distTop" in (attrs.wrap.attrs || {})) {
29105
+ attributes.distT = pixelsToEmu(attrs.wrap.attrs.distTop);
29106
+ hasKeys = true;
29107
+ }
29108
+ if (hasKeys) {
29109
+ wrapElement.attributes = attributes;
29110
+ }
29111
+ break;
29112
+ }
29113
+ case "Through":
29114
+ case "Tight": {
29115
+ const attributes = {};
29116
+ if ("distLeft" in (attrs.wrap.attrs || {})) {
29117
+ attributes.distL = pixelsToEmu(attrs.wrap.attrs.distLeft);
29118
+ }
29119
+ if ("distRight" in (attrs.wrap.attrs || {})) {
29120
+ attributes.distR = pixelsToEmu(attrs.wrap.attrs.distRight);
29121
+ }
29122
+ if ("distTop" in (attrs.wrap.attrs || {})) {
29123
+ attributes.distT = pixelsToEmu(attrs.wrap.attrs.distTop);
29124
+ }
29125
+ if ("distBottom" in (attrs.wrap.attrs || {})) {
29126
+ attributes.distB = pixelsToEmu(attrs.wrap.attrs.distBottom);
29127
+ }
29128
+ const wrapText = attrs.wrap.attrs?.wrapText || "bothSides";
29129
+ {
29130
+ attributes.wrapText = wrapText;
29131
+ }
29132
+ if (Object.keys(attributes).length) {
29133
+ wrapElement.attributes = attributes;
29134
+ }
29135
+ if (attrs.wrap.attrs?.polygon) {
29136
+ const polygonNode = objToPolygon(attrs.wrap.attrs.polygon);
29137
+ if (polygonNode) {
29138
+ if (attrs.wrap.attrs?.polygonEdited !== void 0) {
29139
+ polygonNode.attributes = {
29140
+ ...polygonNode.attributes || {},
29141
+ edited: String(attrs.wrap.attrs.polygonEdited)
29142
+ };
29143
+ }
29144
+ wrapElement.elements = [polygonNode];
29145
+ }
29146
+ }
29147
+ break;
29148
+ }
29149
+ case "None":
29150
+ inlineAttrs.behindDoc = attrs.wrap.attrs?.behindDoc ? "1" : "0";
29151
+ break;
29152
+ }
28957
29153
  const effectIndex = nodeElements.elements.findIndex((el) => el.name === "wp:effectExtent");
28958
29154
  const elementsWithWrap = [
28959
29155
  ...nodeElements.elements.slice(0, effectIndex + 1),
28960
- ...wrapElements,
29156
+ wrapElement,
28961
29157
  ...nodeElements.elements.slice(effectIndex + 1)
28962
29158
  ];
28963
29159
  return {
@@ -28966,32 +29162,32 @@ function translateAnchorNode(params2) {
28966
29162
  elements: [...anchorElements, ...elementsWithWrap]
28967
29163
  };
28968
29164
  }
28969
- const XML_NODE_NAME$a = "wp:anchor";
29165
+ const XML_NODE_NAME$c = "wp:anchor";
28970
29166
  const SD_NODE_NAME$a = ["image"];
28971
- const validXmlAttributes$7 = ["distT", "distB", "distL", "distR"].map((xmlName) => createAttributeHandler(xmlName));
28972
- function encode$g(params2) {
29167
+ const validXmlAttributes$9 = ["distT", "distB", "distL", "distR"].map((xmlName) => createAttributeHandler(xmlName));
29168
+ function encode$i(params2) {
28973
29169
  const { node } = params2.extraParams;
28974
29170
  if (!node || !node.type) {
28975
29171
  return null;
28976
29172
  }
28977
29173
  return handleAnchorNode(params2);
28978
29174
  }
28979
- function decode$i(params2) {
29175
+ function decode$k(params2) {
28980
29176
  const { node } = params2;
28981
29177
  if (!node || !node.type) {
28982
29178
  return null;
28983
29179
  }
28984
29180
  return translateAnchorNode(params2);
28985
29181
  }
28986
- const config$9 = {
28987
- xmlName: XML_NODE_NAME$a,
29182
+ const config$b = {
29183
+ xmlName: XML_NODE_NAME$c,
28988
29184
  sdNodeOrKeyName: SD_NODE_NAME$a,
28989
29185
  type: NodeTranslator.translatorTypes.NODE,
28990
- encode: encode$g,
28991
- decode: decode$i,
28992
- attributes: validXmlAttributes$7
29186
+ encode: encode$i,
29187
+ decode: decode$k,
29188
+ attributes: validXmlAttributes$9
28993
29189
  };
28994
- const translator$9 = NodeTranslator.from(config$9);
29190
+ const translator$b = NodeTranslator.from(config$b);
28995
29191
  function handleInlineNode(params2) {
28996
29192
  const { node } = params2.extraParams;
28997
29193
  if (node.name !== "wp:inline") {
@@ -29007,41 +29203,41 @@ function translateInlineNode(params2) {
29007
29203
  elements: nodeElements.elements
29008
29204
  };
29009
29205
  }
29010
- const XML_NODE_NAME$9 = "wp:inline";
29206
+ const XML_NODE_NAME$b = "wp:inline";
29011
29207
  const SD_NODE_NAME$9 = ["image"];
29012
- const validXmlAttributes$6 = ["distT", "distB", "distL", "distR"].map((xmlName) => createAttributeHandler(xmlName));
29013
- function encode$f(params2) {
29208
+ const validXmlAttributes$8 = ["distT", "distB", "distL", "distR"].map((xmlName) => createAttributeHandler(xmlName));
29209
+ function encode$h(params2) {
29014
29210
  const { node } = params2.extraParams;
29015
29211
  if (!node || !node.type) {
29016
29212
  return null;
29017
29213
  }
29018
29214
  return handleInlineNode(params2);
29019
29215
  }
29020
- function decode$h(params2) {
29216
+ function decode$j(params2) {
29021
29217
  const { node } = params2;
29022
29218
  if (!node || !node.type) {
29023
29219
  return null;
29024
29220
  }
29025
29221
  return translateInlineNode(params2);
29026
29222
  }
29027
- const config$8 = {
29028
- xmlName: XML_NODE_NAME$9,
29223
+ const config$a = {
29224
+ xmlName: XML_NODE_NAME$b,
29029
29225
  sdNodeOrKeyName: SD_NODE_NAME$9,
29030
29226
  type: NodeTranslator.translatorTypes.NODE,
29031
- encode: encode$f,
29032
- decode: decode$h,
29033
- attributes: validXmlAttributes$6
29227
+ encode: encode$h,
29228
+ decode: decode$j,
29229
+ attributes: validXmlAttributes$8
29034
29230
  };
29035
- const translator$8 = NodeTranslator.from(config$8);
29036
- const XML_NODE_NAME$8 = "w:drawing";
29231
+ const translator$a = NodeTranslator.from(config$a);
29232
+ const XML_NODE_NAME$a = "w:drawing";
29037
29233
  const SD_NODE_NAME$8 = [];
29038
- const validXmlAttributes$5 = [];
29039
- function encode$e(params2) {
29234
+ const validXmlAttributes$7 = [];
29235
+ function encode$g(params2) {
29040
29236
  const nodes = params2.nodes;
29041
29237
  const node = nodes[0];
29042
29238
  const translatorByChildName = {
29043
- "wp:anchor": translator$9,
29044
- "wp:inline": translator$8
29239
+ "wp:anchor": translator$b,
29240
+ "wp:inline": translator$a
29045
29241
  };
29046
29242
  return node.elements.reduce((acc, child) => {
29047
29243
  if (acc) return acc;
@@ -29050,12 +29246,12 @@ function encode$e(params2) {
29050
29246
  return translator2.encode({ ...params2, extraParams: { node: child } }) || acc;
29051
29247
  }, null);
29052
29248
  }
29053
- function decode$g(params2) {
29249
+ function decode$i(params2) {
29054
29250
  const { node } = params2;
29055
29251
  if (!node || !node.type) {
29056
29252
  return null;
29057
29253
  }
29058
- const childTranslator = node.attrs.isAnchor ? translator$9 : translator$8;
29254
+ const childTranslator = node.attrs.isAnchor ? translator$b : translator$a;
29059
29255
  const resultNode = childTranslator.decode(params2);
29060
29256
  return wrapTextInRun(
29061
29257
  {
@@ -29065,15 +29261,15 @@ function decode$g(params2) {
29065
29261
  []
29066
29262
  );
29067
29263
  }
29068
- const config$7 = {
29069
- xmlName: XML_NODE_NAME$8,
29264
+ const config$9 = {
29265
+ xmlName: XML_NODE_NAME$a,
29070
29266
  sdNodeOrKeyName: SD_NODE_NAME$8,
29071
29267
  type: NodeTranslator.translatorTypes.NODE,
29072
- encode: encode$e,
29073
- decode: decode$g,
29074
- attributes: validXmlAttributes$5
29268
+ encode: encode$g,
29269
+ decode: decode$i,
29270
+ attributes: validXmlAttributes$7
29075
29271
  };
29076
- const translator$7 = NodeTranslator.from(config$7);
29272
+ const translator$9 = NodeTranslator.from(config$9);
29077
29273
  class CommandService {
29078
29274
  /**
29079
29275
  * @param {import('./commands/types/index.js').CommandServiceOptions} props
@@ -30421,7 +30617,7 @@ function prepareTextAnnotation(params2) {
30421
30617
  return getTextNodeForExport(attrs.displayLabel, [...marks, ...marksFromAttrs], params2);
30422
30618
  }
30423
30619
  function prepareImageAnnotation(params2, imageSize) {
30424
- return translator$7.decode({
30620
+ return translator$9.decode({
30425
30621
  ...params2,
30426
30622
  imageSize
30427
30623
  });
@@ -30736,10 +30932,10 @@ function generateSdtPrTagForStructuredContent({ node }) {
30736
30932
  };
30737
30933
  return result;
30738
30934
  }
30739
- const XML_NODE_NAME$7 = "w:sdt";
30935
+ const XML_NODE_NAME$9 = "w:sdt";
30740
30936
  const SD_NODE_NAME$7 = ["fieldAnnotation", "structuredContent", "structuredContentBlock", "documentSection"];
30741
- const validXmlAttributes$4 = [];
30742
- function encode$d(params2) {
30937
+ const validXmlAttributes$6 = [];
30938
+ function encode$f(params2) {
30743
30939
  const nodes = params2.nodes;
30744
30940
  const node = nodes[0];
30745
30941
  const { type: sdtType, handler: handler2 } = sdtNodeTypeStrategy(node);
@@ -30749,7 +30945,7 @@ function encode$d(params2) {
30749
30945
  const result = handler2(params2);
30750
30946
  return result;
30751
30947
  }
30752
- function decode$f(params2) {
30948
+ function decode$h(params2) {
30753
30949
  const { node } = params2;
30754
30950
  if (!node || !node.type) {
30755
30951
  return null;
@@ -30767,85 +30963,85 @@ function decode$f(params2) {
30767
30963
  const result = decoder();
30768
30964
  return result;
30769
30965
  }
30770
- const config$6 = {
30771
- xmlName: XML_NODE_NAME$7,
30966
+ const config$8 = {
30967
+ xmlName: XML_NODE_NAME$9,
30772
30968
  sdNodeOrKeyName: SD_NODE_NAME$7,
30773
30969
  type: NodeTranslator.translatorTypes.NODE,
30774
- encode: encode$d,
30775
- decode: decode$f,
30776
- attributes: validXmlAttributes$4
30970
+ encode: encode$f,
30971
+ decode: decode$h,
30972
+ attributes: validXmlAttributes$6
30777
30973
  };
30778
- const translator$6 = NodeTranslator.from(config$6);
30779
- const encode$c = (attributes) => {
30974
+ const translator$8 = NodeTranslator.from(config$8);
30975
+ const encode$e = (attributes) => {
30780
30976
  return attributes["w:id"];
30781
30977
  };
30782
- const decode$e = (attrs) => {
30978
+ const decode$g = (attrs) => {
30783
30979
  return attrs.id;
30784
30980
  };
30785
30981
  const attrConfig$7 = Object.freeze({
30786
30982
  xmlName: "w:id",
30787
30983
  sdName: "id",
30788
- encode: encode$c,
30789
- decode: decode$e
30984
+ encode: encode$e,
30985
+ decode: decode$g
30790
30986
  });
30791
- const encode$b = (attributes) => {
30987
+ const encode$d = (attributes) => {
30792
30988
  return attributes["w:name"];
30793
30989
  };
30794
- const decode$d = (attrs) => {
30990
+ const decode$f = (attrs) => {
30795
30991
  return attrs.name;
30796
30992
  };
30797
30993
  const attrConfig$6 = Object.freeze({
30798
30994
  xmlName: "w:name",
30799
30995
  sdName: "name",
30800
- encode: encode$b,
30801
- decode: decode$d
30996
+ encode: encode$d,
30997
+ decode: decode$f
30802
30998
  });
30803
- const encode$a = (attributes) => {
30999
+ const encode$c = (attributes) => {
30804
31000
  return attributes["w:colFirst"];
30805
31001
  };
30806
- const decode$c = (attrs) => {
31002
+ const decode$e = (attrs) => {
30807
31003
  return attrs.colFirst;
30808
31004
  };
30809
31005
  const attrConfig$5 = Object.freeze({
30810
31006
  xmlName: "w:colFirst",
30811
31007
  sdName: "colFirst",
30812
- encode: encode$a,
30813
- decode: decode$c
31008
+ encode: encode$c,
31009
+ decode: decode$e
30814
31010
  });
30815
- const encode$9 = (attributes) => {
31011
+ const encode$b = (attributes) => {
30816
31012
  return attributes["w:colLast"];
30817
31013
  };
30818
- const decode$b = (attrs) => {
31014
+ const decode$d = (attrs) => {
30819
31015
  return attrs.colLast;
30820
31016
  };
30821
31017
  const attrConfig$4 = Object.freeze({
30822
31018
  xmlName: "w:colLast",
30823
31019
  sdName: "colLast",
30824
- encode: encode$9,
30825
- decode: decode$b
31020
+ encode: encode$b,
31021
+ decode: decode$d
30826
31022
  });
30827
- const encode$8 = (attributes) => {
31023
+ const encode$a = (attributes) => {
30828
31024
  return attributes["w:displacedByCustomXml"];
30829
31025
  };
30830
- const decode$a = (attrs) => {
31026
+ const decode$c = (attrs) => {
30831
31027
  return attrs.displacedByCustomXml;
30832
31028
  };
30833
31029
  const attrConfig$3 = Object.freeze({
30834
31030
  xmlName: "w:displacedByCustomXml",
30835
31031
  sdName: "displacedByCustomXml",
30836
- encode: encode$8,
30837
- decode: decode$a
31032
+ encode: encode$a,
31033
+ decode: decode$c
30838
31034
  });
30839
- const validXmlAttributes$3 = [attrConfig$7, attrConfig$6, attrConfig$5, attrConfig$4, attrConfig$3];
30840
- const XML_NODE_NAME$6 = "w:bookmarkStart";
31035
+ const validXmlAttributes$5 = [attrConfig$7, attrConfig$6, attrConfig$5, attrConfig$4, attrConfig$3];
31036
+ const XML_NODE_NAME$8 = "w:bookmarkStart";
30841
31037
  const SD_NODE_NAME$6 = "bookmarkStart";
30842
- const encode$7 = (params2, encodedAttrs = {}) => {
31038
+ const encode$9 = (params2, encodedAttrs = {}) => {
30843
31039
  return {
30844
31040
  type: "bookmarkStart",
30845
31041
  attrs: encodedAttrs
30846
31042
  };
30847
31043
  };
30848
- const decode$9 = (params2, decodedAttrs = {}) => {
31044
+ const decode$b = (params2, decodedAttrs = {}) => {
30849
31045
  const result = {
30850
31046
  name: "w:bookmarkStart",
30851
31047
  elements: []
@@ -30855,49 +31051,49 @@ const decode$9 = (params2, decodedAttrs = {}) => {
30855
31051
  }
30856
31052
  return result;
30857
31053
  };
30858
- const config$5 = {
30859
- xmlName: XML_NODE_NAME$6,
31054
+ const config$7 = {
31055
+ xmlName: XML_NODE_NAME$8,
30860
31056
  sdNodeOrKeyName: SD_NODE_NAME$6,
30861
31057
  type: NodeTranslator.translatorTypes.NODE,
30862
- encode: encode$7,
30863
- decode: decode$9,
30864
- attributes: validXmlAttributes$3
31058
+ encode: encode$9,
31059
+ decode: decode$b,
31060
+ attributes: validXmlAttributes$5
30865
31061
  };
30866
- const translator$5 = NodeTranslator.from(config$5);
30867
- const encode$6 = (attributes) => {
31062
+ const translator$7 = NodeTranslator.from(config$7);
31063
+ const encode$8 = (attributes) => {
30868
31064
  return attributes["w:id"];
30869
31065
  };
30870
- const decode$8 = (attrs) => {
31066
+ const decode$a = (attrs) => {
30871
31067
  return attrs.id;
30872
31068
  };
30873
31069
  const attrConfig$2 = Object.freeze({
30874
31070
  xmlName: "w:id",
30875
31071
  sdName: "id",
30876
- encode: encode$6,
30877
- decode: decode$8
31072
+ encode: encode$8,
31073
+ decode: decode$a
30878
31074
  });
30879
- const encode$5 = (attributes) => {
31075
+ const encode$7 = (attributes) => {
30880
31076
  return attributes["w:displacedByCustomXml"];
30881
31077
  };
30882
- const decode$7 = (attrs) => {
31078
+ const decode$9 = (attrs) => {
30883
31079
  return attrs.displacedByCustomXml;
30884
31080
  };
30885
31081
  const attrConfig$1 = Object.freeze({
30886
31082
  xmlName: "w:displacedByCustomXml",
30887
31083
  sdName: "displacedByCustomXml",
30888
- encode: encode$5,
30889
- decode: decode$7
31084
+ encode: encode$7,
31085
+ decode: decode$9
30890
31086
  });
30891
- const validXmlAttributes$2 = [attrConfig$2, attrConfig$1];
30892
- const XML_NODE_NAME$5 = "w:bookmarkEnd";
31087
+ const validXmlAttributes$4 = [attrConfig$2, attrConfig$1];
31088
+ const XML_NODE_NAME$7 = "w:bookmarkEnd";
30893
31089
  const SD_NODE_NAME$5 = "bookmarkEnd";
30894
- const encode$4 = (params2, encodedAttrs = {}) => {
31090
+ const encode$6 = (params2, encodedAttrs = {}) => {
30895
31091
  return {
30896
31092
  type: "bookmarkEnd",
30897
31093
  attrs: encodedAttrs
30898
31094
  };
30899
31095
  };
30900
- const decode$6 = (params2, decodedAttrs = {}) => {
31096
+ const decode$8 = (params2, decodedAttrs = {}) => {
30901
31097
  const result = {
30902
31098
  name: "w:bookmarkEnd",
30903
31099
  elements: []
@@ -30907,27 +31103,27 @@ const decode$6 = (params2, decodedAttrs = {}) => {
30907
31103
  }
30908
31104
  return result;
30909
31105
  };
30910
- const config$4 = {
30911
- xmlName: XML_NODE_NAME$5,
31106
+ const config$6 = {
31107
+ xmlName: XML_NODE_NAME$7,
30912
31108
  sdNodeOrKeyName: SD_NODE_NAME$5,
30913
31109
  type: NodeTranslator.translatorTypes.NODE,
30914
- encode: encode$4,
30915
- decode: decode$6,
30916
- attributes: validXmlAttributes$2
31110
+ encode: encode$6,
31111
+ decode: decode$8,
31112
+ attributes: validXmlAttributes$4
30917
31113
  };
30918
- const translator$4 = NodeTranslator.from(config$4);
30919
- const decode$5 = (attrs) => attrs?.["w:id"];
31114
+ const translator$6 = NodeTranslator.from(config$6);
31115
+ const decode$7 = (attrs) => attrs?.["w:id"];
30920
31116
  const attrConfig = Object.freeze({
30921
31117
  xmlName: "w:id",
30922
31118
  sdName: "w:id",
30923
31119
  // We do not translate it from 'w:id' to 'id' when encoding, so the name is the same
30924
31120
  encode: () => {
30925
31121
  },
30926
- decode: decode$5
31122
+ decode: decode$7
30927
31123
  });
30928
- const XML_NODE_NAME$4 = "w:commentRange";
31124
+ const XML_NODE_NAME$6 = "w:commentRange";
30929
31125
  const SD_NODE_NAME$4 = "commentRange";
30930
- const decode$4 = (params2) => {
31126
+ const decode$6 = (params2) => {
30931
31127
  const { node, comments, commentsExportType, exportedCommentDefs } = params2;
30932
31128
  if (!node) return;
30933
31129
  if (!comments) return;
@@ -30970,19 +31166,19 @@ const getCommentSchema = (type2, commentIndex) => {
30970
31166
  };
30971
31167
  };
30972
31168
  const getConfig = (type2) => ({
30973
- xmlName: `${XML_NODE_NAME$4}${type2}`,
31169
+ xmlName: `${XML_NODE_NAME$6}${type2}`,
30974
31170
  sdNodeOrKeyName: `${SD_NODE_NAME$4}${type2}`,
30975
31171
  type: NodeTranslator.translatorTypes.NODE,
30976
31172
  encode: () => {
30977
31173
  },
30978
- decode: decode$4,
31174
+ decode: decode$6,
30979
31175
  attributes: [attrConfig]
30980
31176
  });
30981
31177
  const commentRangeStartTranslator = NodeTranslator.from(getConfig("Start"));
30982
31178
  const commentRangeEndTranslator = NodeTranslator.from(getConfig("End"));
30983
- const XML_NODE_NAME$3 = "sd:pageReference";
31179
+ const XML_NODE_NAME$5 = "sd:pageReference";
30984
31180
  const SD_NODE_NAME$3 = "pageReference";
30985
- const encode$3 = (params2) => {
31181
+ const encode$5 = (params2) => {
30986
31182
  const { nodes = [], nodeListHandler } = params2 || {};
30987
31183
  const node = nodes[0];
30988
31184
  const processedText = nodeListHandler.handler({
@@ -30999,7 +31195,7 @@ const encode$3 = (params2) => {
30999
31195
  };
31000
31196
  return processedNode;
31001
31197
  };
31002
- const decode$3 = (params2) => {
31198
+ const decode$5 = (params2) => {
31003
31199
  const { node } = params2;
31004
31200
  const outputMarks = processOutputMarks(node.attrs?.marksAsAttrs || []);
31005
31201
  const contentNodes = (node.content ?? []).flatMap((n) => exportSchemaToJson({ ...params2, node: n }));
@@ -31072,17 +31268,17 @@ const decode$3 = (params2) => {
31072
31268
  ];
31073
31269
  return translated;
31074
31270
  };
31075
- const config$3 = {
31076
- xmlName: XML_NODE_NAME$3,
31271
+ const config$5 = {
31272
+ xmlName: XML_NODE_NAME$5,
31077
31273
  sdNodeOrKeyName: SD_NODE_NAME$3,
31078
31274
  type: NodeTranslator.translatorTypes.NODE,
31079
- encode: encode$3,
31080
- decode: decode$3
31275
+ encode: encode$5,
31276
+ decode: decode$5
31081
31277
  };
31082
- const translator$3 = NodeTranslator.from(config$3);
31083
- const XML_NODE_NAME$2 = "sd:tableOfContents";
31278
+ const translator$5 = NodeTranslator.from(config$5);
31279
+ const XML_NODE_NAME$4 = "sd:tableOfContents";
31084
31280
  const SD_NODE_NAME$2 = "tableOfContents";
31085
- const encode$2 = (params2) => {
31281
+ const encode$4 = (params2) => {
31086
31282
  const { nodes = [], nodeListHandler } = params2 || {};
31087
31283
  const node = nodes[0];
31088
31284
  const processedContent = nodeListHandler.handler({
@@ -31098,7 +31294,7 @@ const encode$2 = (params2) => {
31098
31294
  };
31099
31295
  return processedNode;
31100
31296
  };
31101
- const decode$2 = (params2) => {
31297
+ const decode$4 = (params2) => {
31102
31298
  const { node } = params2;
31103
31299
  const contentNodes = node.content.map((n) => exportSchemaToJson({ ...params2, node: n }));
31104
31300
  const tocBeginElements = [
@@ -31145,14 +31341,14 @@ const decode$2 = (params2) => {
31145
31341
  }
31146
31342
  return contentNodes;
31147
31343
  };
31148
- const config$2 = {
31149
- xmlName: XML_NODE_NAME$2,
31344
+ const config$4 = {
31345
+ xmlName: XML_NODE_NAME$4,
31150
31346
  sdNodeOrKeyName: SD_NODE_NAME$2,
31151
31347
  type: NodeTranslator.translatorTypes.NODE,
31152
- encode: encode$2,
31153
- decode: decode$2
31348
+ encode: encode$4,
31349
+ decode: decode$4
31154
31350
  };
31155
- const translator$2 = NodeTranslator.from(config$2);
31351
+ const translator$4 = NodeTranslator.from(config$4);
31156
31352
  function parseInlineStyles(styleString) {
31157
31353
  if (!styleString) return {};
31158
31354
  return styleString.split(";").filter((style2) => !!style2.trim()).reduce((acc, style2) => {
@@ -31286,7 +31482,7 @@ const handleDrawingNode = (params2) => {
31286
31482
  if (mainNode.name === "w:drawing") node = mainNode;
31287
31483
  else node = mainNode.elements.find((el) => el.name === "w:drawing");
31288
31484
  if (!node) return { nodes: [], consumed: 0 };
31289
- const schemaNode = translator$7.encode(params2);
31485
+ const schemaNode = translator$9.encode(params2);
31290
31486
  const newNodes = schemaNode ? [schemaNode] : [];
31291
31487
  return { nodes: newNodes, consumed: 1 };
31292
31488
  };
@@ -31294,6 +31490,203 @@ const drawingNodeHandlerEntity = {
31294
31490
  handlerName: "drawingNodeHandler",
31295
31491
  handler: handleDrawingNode
31296
31492
  };
31493
+ const createTrackStyleMark = (marks) => {
31494
+ const trackStyleMark = marks.find((mark) => mark.type === "trackFormat");
31495
+ if (trackStyleMark) {
31496
+ return {
31497
+ type: "element",
31498
+ name: "w:rPrChange",
31499
+ attributes: {
31500
+ "w:id": trackStyleMark.attrs.id,
31501
+ "w:author": trackStyleMark.attrs.author,
31502
+ "w:authorEmail": trackStyleMark.attrs.authorEmail,
31503
+ "w:date": trackStyleMark.attrs.date
31504
+ },
31505
+ elements: trackStyleMark.attrs.before.map((mark) => processOutputMarks([mark])).filter((r2) => r2 !== void 0)
31506
+ };
31507
+ }
31508
+ return void 0;
31509
+ };
31510
+ const XML_NODE_NAME$3 = "w:del";
31511
+ const SD_ATTR_KEY$1 = "trackDelete";
31512
+ const validXmlAttributes$3 = [
31513
+ createAttributeHandler("w:id", "id"),
31514
+ createAttributeHandler("w:date", "date"),
31515
+ createAttributeHandler("w:author", "author"),
31516
+ createAttributeHandler("w:authorEmail", "authorEmail")
31517
+ ];
31518
+ const encode$3 = (params2, encodedAttrs = {}) => {
31519
+ const { nodeListHandler, extraParams = {} } = params2;
31520
+ const { node } = extraParams;
31521
+ const subs = nodeListHandler.handler({
31522
+ ...params2,
31523
+ insideTrackChange: true,
31524
+ nodes: node.elements,
31525
+ path: [...params2.path || [], node]
31526
+ });
31527
+ encodedAttrs.importedAuthor = `${encodedAttrs.author} (imported)`;
31528
+ subs.forEach((subElement) => {
31529
+ if (subElement.marks === void 0) subElement.marks = [];
31530
+ subElement.marks.push({ type: "trackDelete", attrs: encodedAttrs });
31531
+ });
31532
+ return subs;
31533
+ };
31534
+ function decode$3(params2) {
31535
+ const { node } = params2;
31536
+ if (!node || !node.type) {
31537
+ return null;
31538
+ }
31539
+ const trackingMarks = ["trackInsert", "trackFormat", "trackDelete"];
31540
+ const marks = node.marks;
31541
+ const trackedMark = marks.find((m2) => m2.type === "trackDelete");
31542
+ const trackStyleMark = createTrackStyleMark(marks);
31543
+ node.marks = marks.filter((m2) => !trackingMarks.includes(m2.type));
31544
+ if (trackStyleMark) {
31545
+ node.marks.push(trackStyleMark);
31546
+ }
31547
+ const translatedTextNode = exportSchemaToJson({ ...params2, node });
31548
+ const textNode = translatedTextNode.elements.find((n) => n.name === "w:t");
31549
+ textNode.name = "w:delText";
31550
+ return {
31551
+ name: "w:del",
31552
+ attributes: {
31553
+ "w:id": trackedMark.attrs.id,
31554
+ "w:author": trackedMark.attrs.author,
31555
+ "w:authorEmail": trackedMark.attrs.authorEmail,
31556
+ "w:date": trackedMark.attrs.date
31557
+ },
31558
+ elements: [translatedTextNode]
31559
+ };
31560
+ }
31561
+ const config$3 = {
31562
+ xmlName: XML_NODE_NAME$3,
31563
+ sdNodeOrKeyName: SD_ATTR_KEY$1,
31564
+ type: NodeTranslator.translatorTypes.ATTRIBUTE,
31565
+ encode: encode$3,
31566
+ decode: decode$3,
31567
+ attributes: validXmlAttributes$3
31568
+ };
31569
+ const translator$3 = NodeTranslator.from(config$3);
31570
+ const XML_NODE_NAME$2 = "w:ins";
31571
+ const SD_ATTR_KEY = "trackInsert";
31572
+ const validXmlAttributes$2 = [
31573
+ createAttributeHandler("w:id", "id"),
31574
+ createAttributeHandler("w:date", "date"),
31575
+ createAttributeHandler("w:author", "author"),
31576
+ createAttributeHandler("w:authorEmail", "authorEmail")
31577
+ ];
31578
+ const encode$2 = (params2, encodedAttrs = {}) => {
31579
+ const { nodeListHandler, extraParams = {} } = params2;
31580
+ const { node } = extraParams;
31581
+ const subs = nodeListHandler.handler({
31582
+ ...params2,
31583
+ insideTrackChange: true,
31584
+ nodes: node.elements,
31585
+ path: [...params2.path || [], node]
31586
+ });
31587
+ encodedAttrs.importedAuthor = `${encodedAttrs.author} (imported)`;
31588
+ subs.forEach((subElement) => {
31589
+ if (subElement.marks === void 0) subElement.marks = [];
31590
+ subElement.marks.push({ type: "trackInsert", attrs: encodedAttrs });
31591
+ });
31592
+ return subs;
31593
+ };
31594
+ function decode$2(params2) {
31595
+ const { node } = params2;
31596
+ if (!node || !node.type) {
31597
+ return null;
31598
+ }
31599
+ const trackingMarks = ["trackInsert", "trackFormat", "trackDelete"];
31600
+ const marks = node.marks;
31601
+ const trackedMark = marks.find((m2) => m2.type === "trackInsert");
31602
+ const trackStyleMark = createTrackStyleMark(marks);
31603
+ node.marks = marks.filter((m2) => !trackingMarks.includes(m2.type));
31604
+ if (trackStyleMark) {
31605
+ node.marks.push(trackStyleMark);
31606
+ }
31607
+ const translatedTextNode = exportSchemaToJson({ ...params2, node });
31608
+ return {
31609
+ name: "w:ins",
31610
+ attributes: {
31611
+ "w:id": trackedMark.attrs.id,
31612
+ "w:author": trackedMark.attrs.author,
31613
+ "w:authorEmail": trackedMark.attrs.authorEmail,
31614
+ "w:date": trackedMark.attrs.date
31615
+ },
31616
+ elements: [translatedTextNode]
31617
+ };
31618
+ }
31619
+ const config$2 = {
31620
+ xmlName: XML_NODE_NAME$2,
31621
+ sdNodeOrKeyName: SD_ATTR_KEY,
31622
+ type: NodeTranslator.translatorTypes.ATTRIBUTE,
31623
+ encode: encode$2,
31624
+ decode: decode$2,
31625
+ attributes: validXmlAttributes$2
31626
+ };
31627
+ const translator$2 = NodeTranslator.from(config$2);
31628
+ const isTrackChangeElement = (node) => node?.name === "w:del" || node?.name === "w:ins";
31629
+ const unwrapTrackChangeNode = (node) => {
31630
+ if (!node) {
31631
+ return null;
31632
+ }
31633
+ if (isTrackChangeElement(node)) {
31634
+ return node;
31635
+ }
31636
+ if (node.name === "w:sdt") {
31637
+ const content = node.elements?.find((element) => element.name === "w:sdtContent");
31638
+ if (!content?.elements?.length) {
31639
+ return null;
31640
+ }
31641
+ for (const child of content.elements) {
31642
+ const trackChange = unwrapTrackChangeNode(child);
31643
+ if (trackChange) {
31644
+ return trackChange;
31645
+ }
31646
+ }
31647
+ }
31648
+ return null;
31649
+ };
31650
+ const handleTrackChangeNode = (params2) => {
31651
+ const { nodes } = params2;
31652
+ if (nodes.length === 0) {
31653
+ return { nodes: [], consumed: 0 };
31654
+ }
31655
+ const mainNode = unwrapTrackChangeNode(nodes[0]);
31656
+ if (!mainNode) {
31657
+ return { nodes: [], consumed: 0 };
31658
+ }
31659
+ let result;
31660
+ const translatorParams = {
31661
+ ...params2,
31662
+ nodes: [mainNode]
31663
+ };
31664
+ switch (mainNode.name) {
31665
+ case "w:del":
31666
+ result = translator$3.encode({
31667
+ extraParams: {
31668
+ node: mainNode
31669
+ },
31670
+ ...translatorParams
31671
+ });
31672
+ break;
31673
+ case "w:ins":
31674
+ result = translator$2.encode({
31675
+ extraParams: {
31676
+ node: mainNode
31677
+ },
31678
+ ...translatorParams
31679
+ });
31680
+ break;
31681
+ }
31682
+ return { nodes: result, consumed: 1 };
31683
+ };
31684
+ const trackChangeNodeHandlerEntity = {
31685
+ handlerName: "trackChangeNodeHandler",
31686
+ handler: handleTrackChangeNode
31687
+ };
31688
+ const hyperlinkNodeHandlerEntity = generateV2HandlerEntity("hyperlinkNodeHandler", translator$Z);
31689
+ const runNodeHandlerEntity = generateV2HandlerEntity("runNodeHandler", translator$Y);
31297
31690
  function parseProperties(node) {
31298
31691
  const marks = [];
31299
31692
  const unknownMarks = [];
@@ -31345,51 +31738,6 @@ function getElementName(element) {
31345
31738
  const isPropertiesElement = (element) => {
31346
31739
  return !!SuperConverter.propertyTypes[element.name || element.type];
31347
31740
  };
31348
- const handleTrackChangeNode = (params2) => {
31349
- const { nodes, nodeListHandler } = params2;
31350
- if (nodes.length === 0 || !(nodes[0].name === "w:del" || nodes[0].name === "w:ins" || nodes[0].name === "w:sdt")) {
31351
- return { nodes: [], consumed: 0 };
31352
- }
31353
- const mainNode = nodes[0];
31354
- let node;
31355
- if (["w:ins", "w:del"].includes(mainNode.name)) {
31356
- node = mainNode;
31357
- } else {
31358
- const sdtContent = mainNode.elements.find((el) => el.name === "w:sdtContent");
31359
- const trackedChange = sdtContent?.elements.find((el) => ["w:ins", "w:del"].includes(el.name));
31360
- if (trackedChange) node = trackedChange;
31361
- }
31362
- if (!node) {
31363
- return { nodes: [], consumed: 0 };
31364
- }
31365
- const { name } = node;
31366
- const { attributes, elements } = parseProperties(node);
31367
- const subs = nodeListHandler.handler({
31368
- ...params2,
31369
- insideTrackChange: true,
31370
- nodes: elements,
31371
- path: [...params2.path || [], node]
31372
- });
31373
- const changeType = name === "w:del" ? TrackDeleteMarkName : TrackInsertMarkName;
31374
- const mappedAttributes = {
31375
- id: attributes["w:id"],
31376
- date: attributes["w:date"],
31377
- author: attributes["w:author"],
31378
- authorEmail: attributes["w:authorEmail"],
31379
- importedAuthor: `${attributes["w:author"]} (imported)`
31380
- };
31381
- subs.forEach((subElement) => {
31382
- if (subElement.marks === void 0) subElement.marks = [];
31383
- subElement.marks.push({ type: changeType, attrs: mappedAttributes });
31384
- });
31385
- return { nodes: subs, consumed: 1 };
31386
- };
31387
- const trackChangeNodeHandlerEntity = {
31388
- handlerName: "trackChangeNodeHandler",
31389
- handler: handleTrackChangeNode
31390
- };
31391
- const hyperlinkNodeHandlerEntity = generateV2HandlerEntity("hyperlinkNodeHandler", translator$X);
31392
- const runNodeHandlerEntity = generateV2HandlerEntity("runNodeHandler", translator$W);
31393
31741
  const handleTextNode = (params2) => {
31394
31742
  const { nodes, insideTrackChange } = params2;
31395
31743
  if (nodes.length === 0 || !(nodes[0].name === "w:t" || insideTrackChange && nodes[0].name === "w:delText")) {
@@ -31430,7 +31778,7 @@ const handleParagraphNode = (params2) => {
31430
31778
  if (nodes.length === 0 || nodes[0].name !== "w:p") {
31431
31779
  return { nodes: [], consumed: 0 };
31432
31780
  }
31433
- const schemaNode = translator$17.encode(params2);
31781
+ const schemaNode = translator$19.encode(params2);
31434
31782
  const newNodes = schemaNode ? [schemaNode] : [];
31435
31783
  return { nodes: newNodes, consumed: 1 };
31436
31784
  };
@@ -31443,7 +31791,7 @@ const handleSdtNode = (params2) => {
31443
31791
  if (nodes.length === 0 || nodes[0].name !== "w:sdt") {
31444
31792
  return { nodes: [], consumed: 0 };
31445
31793
  }
31446
- const result = translator$6.encode(params2);
31794
+ const result = translator$8.encode(params2);
31447
31795
  if (!result) {
31448
31796
  return { nodes: [], consumed: 0 };
31449
31797
  }
@@ -31533,7 +31881,7 @@ const handler = (params2) => {
31533
31881
  if (nodes.length === 0 || nodes[0].name !== "w:br") {
31534
31882
  return { nodes: [], consumed: 0 };
31535
31883
  }
31536
- const result = translator$1a.encode(params2);
31884
+ const result = translator$1c.encode(params2);
31537
31885
  if (!result) return { nodes: [], consumed: 0 };
31538
31886
  return {
31539
31887
  nodes: [result],
@@ -31605,7 +31953,7 @@ const handleBookmarkStartNode = (params2) => {
31605
31953
  if (isCustomMarkBookmark(nodes[0], params2.editor)) {
31606
31954
  return handleBookmarkNode(params2);
31607
31955
  }
31608
- const node = translator$5.encode(params2);
31956
+ const node = translator$7.encode(params2);
31609
31957
  if (!node) return { nodes: [], consumed: 0 };
31610
31958
  return { nodes: [node], consumed: 1 };
31611
31959
  };
@@ -31637,7 +31985,7 @@ const handleBookmarkEndNode = (params2) => {
31637
31985
  if (!nodes.length || nodes[0].name !== "w:bookmarkEnd") {
31638
31986
  return { nodes: [], consumed: 0 };
31639
31987
  }
31640
- const node = translator$4.encode(params2);
31988
+ const node = translator$6.encode(params2);
31641
31989
  if (!node) return { nodes: [], consumed: 0 };
31642
31990
  return { nodes: [node], consumed: 1 };
31643
31991
  };
@@ -31770,7 +32118,7 @@ const autoTotalPageCountEntity = {
31770
32118
  handlerName: "autoTotalPageCountEntity",
31771
32119
  handler: handleAutoTotalPageNumber
31772
32120
  };
31773
- const pageReferenceEntity = generateV2HandlerEntity("pageReferenceNodeHandler", translator$3);
32121
+ const pageReferenceEntity = generateV2HandlerEntity("pageReferenceNodeHandler", translator$5);
31774
32122
  const handlePictNode = (params2) => {
31775
32123
  const { nodes } = params2;
31776
32124
  if (!nodes.length || nodes[0].name !== "w:p") {
@@ -32159,14 +32507,14 @@ const handleTabNode = (params2) => {
32159
32507
  if (!nodes.length || nodes[0].name !== "w:tab") {
32160
32508
  return { nodes: [], consumed: 0 };
32161
32509
  }
32162
- const node = translator$18.encode(params2);
32510
+ const node = translator$1a.encode(params2);
32163
32511
  return { nodes: [node], consumed: 1 };
32164
32512
  };
32165
32513
  const tabNodeEntityHandler = {
32166
32514
  handlerName: "w:tabTranslator",
32167
32515
  handler: handleTabNode
32168
32516
  };
32169
- const tableOfContentsHandlerEntity = generateV2HandlerEntity("tableOfContentsHandler", translator$2);
32517
+ const tableOfContentsHandlerEntity = generateV2HandlerEntity("tableOfContentsHandler", translator$4);
32170
32518
  function preProcessPageInstruction(nodesToCombine) {
32171
32519
  const pageNumNode = {
32172
32520
  name: "sd:autoPageNumber",
@@ -33107,7 +33455,7 @@ function translateVRectContentBlock(params2) {
33107
33455
  const XML_NODE_NAME = "w:pict";
33108
33456
  const SD_NODE_NAME = ["shapeContainer", "contentBlock"];
33109
33457
  const validXmlAttributes = [];
33110
- function encode$1d(params2) {
33458
+ function encode$1f(params2) {
33111
33459
  const { node, pNode } = params2.extraParams;
33112
33460
  const { type: pictType, handler: handler2 } = pictNodeTypeStrategy(node);
33113
33461
  if (!handler2 || pictType === "unknown") {
@@ -33139,7 +33487,7 @@ const config = {
33139
33487
  xmlName: XML_NODE_NAME,
33140
33488
  sdNodeOrKeyName: SD_NODE_NAME,
33141
33489
  type: NodeTranslator.translatorTypes.NODE,
33142
- encode: encode$1d,
33490
+ encode: encode$1f,
33143
33491
  decode,
33144
33492
  attributes: validXmlAttributes
33145
33493
  };
@@ -33215,35 +33563,35 @@ function exportSchemaToJson(params2) {
33215
33563
  doc: translateDocumentNode,
33216
33564
  body: translateBodyNode,
33217
33565
  heading: translateHeadingNode,
33218
- paragraph: translator$17,
33219
- run: translator$W,
33566
+ paragraph: translator$19,
33567
+ run: translator$Y,
33220
33568
  text: translateTextNode,
33221
33569
  bulletList: translateList,
33222
33570
  orderedList: translateList,
33223
- lineBreak: translator$1a,
33224
- table: translator$b,
33225
- tableRow: translator$I,
33226
- tableCell: translator$a,
33227
- bookmarkStart: translator$5,
33228
- bookmarkEnd: translator$4,
33229
- fieldAnnotation: translator$6,
33230
- tab: translator$18,
33231
- image: translator$7,
33232
- hardBreak: translator$1a,
33571
+ lineBreak: translator$1c,
33572
+ table: translator$d,
33573
+ tableRow: translator$K,
33574
+ tableCell: translator$c,
33575
+ bookmarkStart: translator$7,
33576
+ bookmarkEnd: translator$6,
33577
+ fieldAnnotation: translator$8,
33578
+ tab: translator$1a,
33579
+ image: translator$9,
33580
+ hardBreak: translator$1c,
33233
33581
  commentRangeStart: commentRangeStartTranslator,
33234
33582
  commentRangeEnd: commentRangeEndTranslator,
33235
33583
  commentReference: () => null,
33236
33584
  shapeContainer: translator,
33237
33585
  shapeTextbox: translator,
33238
33586
  contentBlock: translator,
33239
- structuredContent: translator$6,
33240
- structuredContentBlock: translator$6,
33241
- documentPartObject: translator$6,
33242
- documentSection: translator$6,
33587
+ structuredContent: translator$8,
33588
+ structuredContentBlock: translator$8,
33589
+ documentPartObject: translator$8,
33590
+ documentSection: translator$8,
33243
33591
  "page-number": translatePageNumberNode,
33244
33592
  "total-page-number": translateTotalPageNumberNode,
33245
- pageReference: translator$3,
33246
- tableOfContents: translator$2
33593
+ pageReference: translator$5,
33594
+ tableOfContents: translator$4
33247
33595
  };
33248
33596
  let handler2 = router[type2];
33249
33597
  if (handler2 && "decode" in handler2 && typeof handler2.decode === "function") {
@@ -33579,62 +33927,22 @@ function getTextNodeForExport(text, marks, params2) {
33579
33927
  function translateTextNode(params2) {
33580
33928
  const { node, extraParams } = params2;
33581
33929
  const trackedMarks = [TrackInsertMarkName, TrackDeleteMarkName];
33582
- const isTrackedNode = node.marks?.some((m2) => trackedMarks.includes(m2.type));
33583
- if (isTrackedNode) return translateTrackedNode(params2);
33930
+ const trackedMark = node.marks?.find((m2) => trackedMarks.includes(m2.type));
33931
+ if (trackedMark) {
33932
+ switch (trackedMark.type) {
33933
+ case "trackDelete":
33934
+ return translator$3.decode(params2);
33935
+ case "trackInsert":
33936
+ return translator$2.decode(params2);
33937
+ }
33938
+ }
33584
33939
  const isLinkNode = node.marks?.some((m2) => m2.type === "link");
33585
33940
  if (isLinkNode && !extraParams?.linkProcessed) {
33586
- return translator$X.decode(params2);
33941
+ return translator$Z.decode(params2);
33587
33942
  }
33588
33943
  const { text, marks = [] } = node;
33589
33944
  return getTextNodeForExport(text, marks, params2);
33590
33945
  }
33591
- function createTrackStyleMark(marks) {
33592
- const trackStyleMark = marks.find((mark) => mark.type === TrackFormatMarkName);
33593
- if (trackStyleMark) {
33594
- const markElement = {
33595
- type: "element",
33596
- name: "w:rPrChange",
33597
- attributes: {
33598
- "w:id": trackStyleMark.attrs.id,
33599
- "w:author": trackStyleMark.attrs.author,
33600
- "w:authorEmail": trackStyleMark.attrs.authorEmail,
33601
- "w:date": trackStyleMark.attrs.date
33602
- },
33603
- elements: trackStyleMark.attrs.before.map((mark) => processOutputMarks([mark])).filter((r2) => r2 !== void 0)
33604
- };
33605
- return markElement;
33606
- }
33607
- return void 0;
33608
- }
33609
- function translateTrackedNode(params2) {
33610
- const { node } = params2;
33611
- const marks = node.marks;
33612
- const trackingMarks = [TrackInsertMarkName, TrackDeleteMarkName, TrackFormatMarkName];
33613
- const trackedMark = marks.find((m2) => trackingMarks.includes(m2.type));
33614
- const isInsert = trackedMark.type === TrackInsertMarkName;
33615
- const trackStyleMark = createTrackStyleMark(marks);
33616
- node.marks = marks.filter((m2) => !trackingMarks.includes(m2.type));
33617
- if (trackStyleMark) {
33618
- node.marks.push(trackStyleMark);
33619
- }
33620
- const translatedTextNode = exportSchemaToJson({ ...params2, node });
33621
- if (!isInsert) {
33622
- const textNode = translatedTextNode.elements.find((n) => n.name === "w:t");
33623
- textNode.name = "w:delText";
33624
- }
33625
- const trackedNode = {
33626
- name: isInsert ? "w:ins" : "w:del",
33627
- type: "element",
33628
- attributes: {
33629
- "w:id": trackedMark.attrs.id,
33630
- "w:author": trackedMark.attrs.author,
33631
- "w:authorEmail": trackedMark.attrs.authorEmail,
33632
- "w:date": trackedMark.attrs.date
33633
- },
33634
- elements: [translatedTextNode]
33635
- };
33636
- return trackedNode;
33637
- }
33638
33946
  function wrapTextInRun(nodeOrNodes, marks) {
33639
33947
  let elements = [];
33640
33948
  if (Array.isArray(nodeOrNodes)) elements = nodeOrNodes;
@@ -33890,7 +34198,7 @@ function translateMark(mark) {
33890
34198
  markElement.type = "element";
33891
34199
  break;
33892
34200
  case "underline": {
33893
- const translated = translator$14.decode({
34201
+ const translated = translator$16.decode({
33894
34202
  node: {
33895
34203
  attrs: {
33896
34204
  underlineType: attrs.underlineType ?? attrs.underline ?? null,
@@ -33954,7 +34262,7 @@ function translateMark(mark) {
33954
34262
  break;
33955
34263
  case "highlight": {
33956
34264
  const highlightValue = attrs.color ?? attrs.highlight ?? null;
33957
- const translated = translator$19.decode({ node: { attrs: { highlight: highlightValue } } });
34265
+ const translated = translator$1b.decode({ node: { attrs: { highlight: highlightValue } } });
33958
34266
  return translated || {};
33959
34267
  }
33960
34268
  case "link":
@@ -63897,6 +64205,58 @@ const registerImages = async (foundImages, editor, view) => {
63897
64205
  }
63898
64206
  });
63899
64207
  };
64208
+ const normalizeWrap = (attrs = {}) => {
64209
+ const wrap2 = attrs.wrap;
64210
+ if (wrap2?.type && wrap2.type !== "Inline") {
64211
+ return {
64212
+ type: wrap2.type,
64213
+ attrs: wrap2.attrs ?? {}
64214
+ };
64215
+ }
64216
+ if (wrap2?.type === "Inline" && Object.keys(wrap2.attrs ?? {}).length) {
64217
+ return {
64218
+ type: "Inline",
64219
+ attrs: wrap2.attrs
64220
+ };
64221
+ }
64222
+ if (!wrap2 && attrs.wrapText) {
64223
+ return {
64224
+ type: "Square",
64225
+ attrs: {
64226
+ wrapText: attrs.wrapText
64227
+ }
64228
+ };
64229
+ }
64230
+ if (!wrap2 && attrs.wrapTopAndBottom) {
64231
+ return {
64232
+ type: "TopAndBottom",
64233
+ attrs: {}
64234
+ };
64235
+ }
64236
+ if (wrap2?.type === "Inline") {
64237
+ return {
64238
+ type: "Inline",
64239
+ attrs: wrap2.attrs ?? {}
64240
+ };
64241
+ }
64242
+ return {
64243
+ type: "Inline",
64244
+ attrs: {}
64245
+ };
64246
+ };
64247
+ const normalizeMarginOffset = (marginOffset = {}) => {
64248
+ const { left: left2, horizontal, ...rest } = marginOffset;
64249
+ return {
64250
+ ...rest,
64251
+ horizontal: horizontal ?? left2
64252
+ };
64253
+ };
64254
+ const getNormalizedImageAttrs = (attrs = {}) => {
64255
+ return {
64256
+ wrap: normalizeWrap(attrs),
64257
+ marginOffset: normalizeMarginOffset(attrs.marginOffset ?? {})
64258
+ };
64259
+ };
63900
64260
  const ImagePositionPluginKey = new PluginKey("ImagePosition");
63901
64261
  const ImagePositionPlugin = ({ editor }) => {
63902
64262
  const { view } = editor;
@@ -63944,7 +64304,8 @@ const getImagePositionDecorations = (state2, view) => {
63944
64304
  let style2 = "";
63945
64305
  let className = "";
63946
64306
  const { vRelativeFrom, alignH } = node.attrs.anchorData;
63947
- const { size: size2, padding, marginOffset } = node.attrs;
64307
+ const { size: size2, padding } = node.attrs;
64308
+ const { marginOffset } = getNormalizedImageAttrs(node.attrs);
63948
64309
  const pageBreak = findPreviousDomNodeWithClass(view, pos, "pagination-break-wrapper");
63949
64310
  if (pageBreak) {
63950
64311
  switch (alignH) {
@@ -64061,7 +64422,24 @@ const Image = Node$1.create({
64061
64422
  rendered: false
64062
64423
  },
64063
64424
  originalAttributes: { rendered: false },
64064
- wrapTopAndBottom: { rendered: false },
64425
+ /**
64426
+ * @category Attribute
64427
+ * @param {Object} wrap - Wrapping options
64428
+ * @param {string} wrap.type - Wrap type: "None", "Square", "Through", "Tight", "TopAndBottom", "Inline"
64429
+ * @param {Object} [wrap.attrs] - Wrap attributes (only allowed attributes for the given type will be accepted)
64430
+ * @param {string} [wrap.attrs.wrapText] - Text wrapping mode for Square type: "bothSides", "largest", "left", "right"
64431
+ * @param {number} [wrap.attrs.distTop] - Top distance in pixels
64432
+ * @param {number} [wrap.attrs.distBottom] - Bottom distance in pixels
64433
+ * @param {number} [wrap.attrs.distLeft] - Left distance in pixels
64434
+ * @param {number} [wrap.attrs.distRight] - Right distance in pixels
64435
+ * @param {Array} [wrap.attrs.polygon] - Polygon points for Through/Tight types: [[x1,y1], [x2,y2], ...]
64436
+ * @param {boolean} [wrap.attrs.behindDoc] - Whether image should be behind document text (for wrapNone)
64437
+ */
64438
+ wrap: {
64439
+ default: { type: "Inline" },
64440
+ rendered: false
64441
+ // Handled in main renderDOM
64442
+ },
64065
64443
  anchorData: {
64066
64444
  default: null,
64067
64445
  rendered: false
@@ -64107,7 +64485,6 @@ const Image = Node$1.create({
64107
64485
  * @private
64108
64486
  */
64109
64487
  simplePos: { rendered: false },
64110
- wrapText: { rendered: false },
64111
64488
  extension: { rendered: false },
64112
64489
  size: {
64113
64490
  default: {},
@@ -64123,55 +64500,13 @@ const Image = Node$1.create({
64123
64500
  },
64124
64501
  padding: {
64125
64502
  default: {},
64126
- renderDOM: ({ size: size2 = {}, padding, marginOffset, transformData = {} }) => {
64127
- let { left: left2 = 0, top: top2 = 0, bottom: bottom2 = 0, right: right2 = 0 } = padding ?? {};
64128
- const { rotation } = transformData;
64129
- const { height, width } = size2;
64130
- if (rotation && height && width) {
64131
- const { horizontal, vertical } = getRotationMargins(width, height, rotation);
64132
- left2 += horizontal;
64133
- right2 += horizontal;
64134
- top2 += vertical;
64135
- bottom2 += vertical;
64136
- }
64137
- let style2 = "";
64138
- if (left2 && marginOffset?.left == null) style2 += `margin-left: ${left2}px;`;
64139
- if (top2 && marginOffset?.top == null) style2 += `margin-top: ${top2}px;`;
64140
- if (bottom2) style2 += `margin-bottom: ${bottom2}px;`;
64141
- if (right2) style2 += `margin-right: ${right2}px;`;
64142
- return { style: style2 };
64143
- }
64503
+ rendered: false
64504
+ // Handled in main renderDOM
64144
64505
  },
64145
64506
  marginOffset: {
64146
64507
  default: {},
64147
- renderDOM: ({ marginOffset, anchorData, transformData, size: size2 }) => {
64148
- const hasAnchorData = Boolean(anchorData);
64149
- const hasMarginOffsets = marginOffset?.left != null || marginOffset?.top != null;
64150
- if (!hasAnchorData && !hasMarginOffsets) return {};
64151
- const relativeFromPageV = anchorData?.vRelativeFrom === "page";
64152
- const maxMarginV = 500;
64153
- const baseLeft = marginOffset?.left ?? 0;
64154
- const baseTop = marginOffset?.top ?? 0;
64155
- let rotationLeft = 0;
64156
- let rotationTop = 0;
64157
- const { rotation } = transformData ?? {};
64158
- const { height, width } = size2 ?? {};
64159
- if (rotation && height && width) {
64160
- const { horizontal, vertical } = getRotationMargins(width, height, rotation);
64161
- rotationLeft = horizontal;
64162
- rotationTop = vertical;
64163
- }
64164
- const left2 = baseLeft + rotationLeft;
64165
- const top2 = baseTop + rotationTop;
64166
- let style2 = "";
64167
- if (left2) style2 += `margin-left: ${left2}px;`;
64168
- if (top2) {
64169
- if (relativeFromPageV && top2 >= maxMarginV) style2 += `margin-top: ${maxMarginV}px;`;
64170
- else style2 += `margin-top: ${top2}px;`;
64171
- }
64172
- if (!style2) return {};
64173
- return { style: style2 };
64174
- }
64508
+ rendered: false
64509
+ // Handled in main renderDOM
64175
64510
  },
64176
64511
  style: {
64177
64512
  default: null,
@@ -64190,8 +64525,181 @@ const Image = Node$1.create({
64190
64525
  }
64191
64526
  ];
64192
64527
  },
64193
- renderDOM({ htmlAttributes }) {
64194
- return ["img", Attribute2.mergeAttributes(this.options.htmlAttributes, htmlAttributes)];
64528
+ renderDOM({ node, htmlAttributes }) {
64529
+ const { wrap: wrap2, marginOffset } = getNormalizedImageAttrs(node.attrs);
64530
+ const { anchorData, padding, transformData = {}, size: size2 = { width: 0, height: 0 } } = node.attrs;
64531
+ const margin = {
64532
+ left: 0,
64533
+ right: 0,
64534
+ top: 0,
64535
+ bottom: 0
64536
+ };
64537
+ let centered = false;
64538
+ let floatRight = false;
64539
+ let baseHorizontal = marginOffset?.horizontal || 0;
64540
+ let style2 = "";
64541
+ if (padding) {
64542
+ if (padding.left) margin.left += padding.left;
64543
+ if (padding.right) margin.right += padding.right;
64544
+ if (padding.top) margin.top += padding.top;
64545
+ if (padding.bottom) margin.bottom += padding.bottom;
64546
+ }
64547
+ const { rotation } = transformData;
64548
+ const { height, width } = size2;
64549
+ if (rotation && height && width) {
64550
+ const { horizontal, vertical } = getRotationMargins(width, height, rotation);
64551
+ margin.left += horizontal;
64552
+ margin.right += horizontal;
64553
+ margin.top += vertical;
64554
+ margin.bottom += vertical;
64555
+ }
64556
+ if (wrap2 && wrap2.type) {
64557
+ const { type: type2, attrs = {} } = wrap2;
64558
+ switch (type2) {
64559
+ case "None":
64560
+ style2 += "position: absolute;";
64561
+ if (attrs.behindDoc) {
64562
+ style2 += "z-index: -1;";
64563
+ } else {
64564
+ style2 += "z-index: 1;";
64565
+ }
64566
+ break;
64567
+ case "Square":
64568
+ style2 += "shape-outside: border-box; clear: both;";
64569
+ if (attrs.wrapText === "right") {
64570
+ style2 += "float: left;";
64571
+ } else if (attrs.wrapText === "left") {
64572
+ style2 += "float: right;";
64573
+ floatRight = true;
64574
+ } else if (["largest", "bothSides"].includes(attrs.wrapText)) {
64575
+ const pageStyles2 = this.editor?.converter?.pageStyles;
64576
+ if (pageStyles2?.pageSize && pageStyles2?.pageMargins && size2.width) {
64577
+ const pageWidth = inchesToPixels(pageStyles2.pageSize.width);
64578
+ const leftMargin = inchesToPixels(pageStyles2.pageMargins.left);
64579
+ const rightMargin = inchesToPixels(pageStyles2.pageMargins.right);
64580
+ const contentWidth = pageWidth - leftMargin - rightMargin;
64581
+ const imageWidth = size2.width + (attrs.distLeft || 0) + (attrs.distRight || 0);
64582
+ const leftSpace = marginOffset.horizontal;
64583
+ const rightSpace = contentWidth - leftSpace - imageWidth;
64584
+ if (rightSpace < 0) {
64585
+ style2 += "float: left;";
64586
+ } else if (rightSpace > leftSpace) {
64587
+ style2 += "float: left;";
64588
+ } else {
64589
+ style2 += "float: right;";
64590
+ floatRight = true;
64591
+ baseHorizontal = rightSpace;
64592
+ }
64593
+ } else {
64594
+ style2 += "float: left;";
64595
+ }
64596
+ }
64597
+ if (attrs.distTop) margin.top += attrs.distTop;
64598
+ if (attrs.distBottom) margin.bottom += attrs.distBottom;
64599
+ if (attrs.distLeft) margin.left += attrs.distLeft;
64600
+ if (attrs.distRight) margin.right += attrs.distRight;
64601
+ break;
64602
+ case "Through":
64603
+ case "Tight":
64604
+ style2 += "clear: both;";
64605
+ const pageStyles = this.editor?.converter?.pageStyles;
64606
+ if (pageStyles?.pageSize && pageStyles?.pageMargins && size2.width) {
64607
+ const pageWidth = inchesToPixels(pageStyles.pageSize.width);
64608
+ const leftMargin = inchesToPixels(pageStyles.pageMargins.left);
64609
+ const rightMargin = inchesToPixels(pageStyles.pageMargins.right);
64610
+ const contentWidth = pageWidth - leftMargin - rightMargin;
64611
+ const imageWidth = size2.width + (attrs.distLeft || 0) + (attrs.distRight || 0);
64612
+ const leftSpace = marginOffset.horizontal;
64613
+ const rightSpace = contentWidth - leftSpace - imageWidth;
64614
+ if (rightSpace < 0) {
64615
+ style2 += "float: left;";
64616
+ } else if (rightSpace > leftSpace) {
64617
+ style2 += "float: left;";
64618
+ } else {
64619
+ style2 += "float: right;";
64620
+ floatRight = true;
64621
+ baseHorizontal = rightSpace;
64622
+ }
64623
+ } else {
64624
+ style2 += "float: left;";
64625
+ }
64626
+ if (attrs.distTop) margin.top += attrs.distTop;
64627
+ if (attrs.distBottom) margin.bottom += attrs.distBottom;
64628
+ if (attrs.distLeft) margin.left += attrs.distLeft;
64629
+ if (attrs.distRight) margin.right += attrs.distRight;
64630
+ if (attrs.polygon) {
64631
+ let horizontalOffset = floatRight ? attrs.polygon[0][0] || 0 : marginOffset.horizontal + 15;
64632
+ let maxX = 0;
64633
+ let minX = 0;
64634
+ let minY = 0;
64635
+ let maxY = 0;
64636
+ attrs.polygon.forEach(([x, y2]) => {
64637
+ if (floatRight && x < horizontalOffset) horizontalOffset = x;
64638
+ if (x > maxX) maxX = x;
64639
+ if (x < minX) minX = x;
64640
+ if (y2 > maxY) maxY = y2;
64641
+ if (y2 < minY) minY = y2;
64642
+ });
64643
+ const originalWidth = maxX - minX;
64644
+ const originalHeight = maxY - minY;
64645
+ const scaleWidth = Math.min(1, size2.width / originalWidth);
64646
+ const scaleHeight = Math.min(1, size2.height / originalHeight);
64647
+ const verticalOffset = Math.max(0, marginOffset.top);
64648
+ const points = attrs.polygon.map(([x, y2]) => `${horizontalOffset + x * scaleWidth}px ${verticalOffset + y2 * scaleHeight}px`).join(", ");
64649
+ style2 += `shape-outside: polygon(${points});`;
64650
+ }
64651
+ break;
64652
+ case "TopAndBottom":
64653
+ style2 += "display: block; clear: both;";
64654
+ if (attrs.distTop) margin.top += attrs.distTop;
64655
+ if (attrs.distBottom) margin.bottom += attrs.distBottom;
64656
+ centered = true;
64657
+ break;
64658
+ }
64659
+ }
64660
+ const hasAnchorData = Boolean(anchorData);
64661
+ const hasMarginOffsets = marginOffset?.horizontal != null || marginOffset?.top != null;
64662
+ if (hasAnchorData || hasMarginOffsets) {
64663
+ const relativeFromPageV = anchorData?.vRelativeFrom === "page";
64664
+ const maxMarginV = 500;
64665
+ const baseTop = Math.max(0, marginOffset?.top ?? 0);
64666
+ let rotationHorizontal = 0;
64667
+ let rotationTop = 0;
64668
+ const { rotation: rotation2 } = transformData ?? {};
64669
+ const { height: height2, width: width2 } = size2 ?? {};
64670
+ if (rotation2 && height2 && width2) {
64671
+ const { horizontal: horizontal2, vertical } = getRotationMargins(width2, height2, rotation2);
64672
+ rotationHorizontal = horizontal2;
64673
+ rotationTop = vertical;
64674
+ }
64675
+ const horizontal = baseHorizontal + rotationHorizontal;
64676
+ const top2 = baseTop + rotationTop;
64677
+ if (horizontal) {
64678
+ if (floatRight) {
64679
+ margin.right += horizontal;
64680
+ } else {
64681
+ margin.left += horizontal;
64682
+ }
64683
+ }
64684
+ if (top2) {
64685
+ if (relativeFromPageV && top2 >= maxMarginV) margin.top += maxMarginV;
64686
+ else margin.top += top2;
64687
+ }
64688
+ }
64689
+ if (centered) {
64690
+ style2 += "margin-left: auto; margin-right: auto;";
64691
+ } else {
64692
+ if (margin.left) style2 += `margin-left: ${margin.left}px;`;
64693
+ if (margin.right) style2 += `margin-right: ${margin.right}px;`;
64694
+ }
64695
+ if (margin.top) style2 += `margin-top: ${margin.top}px;`;
64696
+ if (margin.bottom) style2 += `margin-bottom: ${margin.bottom}px;`;
64697
+ const finalAttributes = { ...htmlAttributes };
64698
+ if (style2) {
64699
+ const existingStyle = finalAttributes.style || "";
64700
+ finalAttributes.style = existingStyle + (existingStyle ? " " : "") + style2;
64701
+ }
64702
+ return ["img", Attribute2.mergeAttributes(this.options.htmlAttributes, finalAttributes)];
64195
64703
  },
64196
64704
  addCommands() {
64197
64705
  return {
@@ -64213,6 +64721,85 @@ const Image = Node$1.create({
64213
64721
  type: this.name,
64214
64722
  attrs: options
64215
64723
  });
64724
+ },
64725
+ /**
64726
+ * Set the wrapping mode and attributes for the selected image
64727
+ * @category Command
64728
+ * @param {Object} options - Wrapping options
64729
+ * @param {string} options.type - Wrap type: "None", "Square", "Through", "Tight", "TopAndBottom", "Inline"
64730
+ * @param {Object} [options.attrs] - Wrap attributes (only allowed attributes for the given type will be accepted)
64731
+ * @param {string} [options.attrs.wrapText] - Text wrapping mode for Square type: "bothSides", "largest", "left", "right"
64732
+ * @param {number} [options.attrs.distTop] - Top distance in pixels
64733
+ * @param {number} [options.attrs.distBottom] - Bottom distance in pixels
64734
+ * @param {number} [options.attrs.distLeft] - Left distance in pixels
64735
+ * @param {number} [options.attrs.distRight] - Right distance in pixels
64736
+ * @param {Array} [options.attrs.polygon] - Polygon points for Through/Tight types: [[x1,y1], [x2,y2], ...]
64737
+ * @param {boolean} [options.attrs.behindDoc] - Whether image should be behind document text (for wrapNone)
64738
+ * @example
64739
+ * // No wrapping, behind document
64740
+ * editor.commands.setWrapping({ type: 'None', attrs: {behindDoc: true} })
64741
+ *
64742
+ * // Square wrapping on both sides with distances
64743
+ * editor.commands.setWrapping({
64744
+ * type: 'Square',
64745
+ * attrs: {
64746
+ * wrapText: 'bothSides',
64747
+ * distTop: 10,
64748
+ * distBottom: 10,
64749
+ * distLeft: 10,
64750
+ * distRight: 10
64751
+ * }
64752
+ * })
64753
+ *
64754
+ * // Tight wrapping with polygon
64755
+ * editor.commands.setWrapping({
64756
+ * type: 'Tight',
64757
+ * attrs: {
64758
+ * polygon: [[0, 0], [100, 0], [100, 100], [0, 100]]
64759
+ * }
64760
+ * })
64761
+ *
64762
+ * // Top and bottom wrapping
64763
+ * editor.commands.setWrapping({
64764
+ * type: 'TopAndBottom',
64765
+ * attrs: {
64766
+ * distTop: 15,
64767
+ * distBottom: 15
64768
+ * }
64769
+ * })
64770
+ */
64771
+ setWrapping: (options) => ({ chain, state: state2 }) => {
64772
+ const { selection } = state2;
64773
+ const { $from } = selection;
64774
+ const node = $from.nodeAfter;
64775
+ if (!node || node.type.name !== this.name) {
64776
+ return false;
64777
+ }
64778
+ const { type: type2, attrs = {} } = options;
64779
+ const allowedAttrs = {};
64780
+ const allowedAttributes = {
64781
+ None: ["behindDoc"],
64782
+ Square: ["wrapText", "distTop", "distBottom", "distLeft", "distRight"],
64783
+ Through: ["distTop", "distBottom", "distLeft", "distRight", "polygon"],
64784
+ Tight: ["distTop", "distBottom", "distLeft", "distRight", "polygon"],
64785
+ TopAndBottom: ["distTop", "distBottom"],
64786
+ Inline: []
64787
+ };
64788
+ const allowedForType = allowedAttributes[type2] || [];
64789
+ Object.keys(attrs).forEach((key2) => {
64790
+ if (allowedForType.includes(key2)) {
64791
+ allowedAttrs[key2] = attrs[key2];
64792
+ }
64793
+ });
64794
+ const updatedAttrs = {
64795
+ ...node.attrs,
64796
+ wrap: {
64797
+ type: type2,
64798
+ attrs: allowedAttrs
64799
+ },
64800
+ isAnchor: type2 !== "Inline"
64801
+ };
64802
+ return chain().updateAttributes(this.name, updatedAttrs).run();
64216
64803
  }
64217
64804
  };
64218
64805
  },
@@ -87561,72 +88148,72 @@ const _sfc_main = {
87561
88148
  const SuperInput = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-4d5cff52"]]);
87562
88149
  const additionalHandlers = Object.freeze({
87563
88150
  "mc:AlternateContent": translator$1,
87564
- "sd:pageReference": translator$3,
87565
- "sd:tableOfContents": translator$2,
87566
- "w:b": translator$16,
87567
- "w:bidiVisual": translator$H,
87568
- "w:bookmarkEnd": translator$4,
87569
- "w:bookmarkStart": translator$5,
87570
- "w:bottom": translator$u,
87571
- "w:br": translator$1a,
87572
- "w:cantSplit": translator$V,
87573
- "w:cnfStyle": translator$U,
87574
- "w:color": translator$12,
87575
- "w:divId": translator$T,
87576
- "w:drawing": translator$7,
87577
- "w:end": translator$s,
87578
- "w:gridAfter": translator$S,
87579
- "w:gridBefore": translator$R,
87580
- "w:gridCol": translator$d,
87581
- "w:hidden": translator$Q,
87582
- "w:highlight": translator$19,
87583
- "w:hyperlink": translator$X,
87584
- "w:i": translator$15,
87585
- "w:insideH": translator$q,
87586
- "w:insideV": translator$p,
87587
- "w:jc": translator$P,
87588
- "w:left": translator$o,
87589
- "w:p": translator$17,
87590
- "w:r": translator$W,
87591
- "w:rFonts": translator$11,
87592
- "w:rPr": translator$Y,
87593
- "w:rStyle": translator$10,
87594
- "w:right": translator$m,
87595
- "w:sdt": translator$6,
87596
- "w:shd": translator$G,
87597
- "w:start": translator$k,
87598
- "w:strike": translator$13,
87599
- "w:sz": translator$$,
87600
- "w:szCs": translator$_,
87601
- "w:tab": translator$18,
87602
- "w:tbl": translator$b,
87603
- "w:tblBorders": translator$g,
87604
- "w:tblCaption": translator$F,
87605
- "w:tblCellMar": translator$f,
87606
- "w:tblCellSpacing": translator$O,
87607
- "w:tblDescription": translator$E,
87608
- "w:tblGrid": translator$c,
87609
- "w:tblHeader": translator$N,
87610
- "w:tblInd": translator$D,
87611
- "w:tblLayout": translator$C,
87612
- "w:tblLook": translator$B,
87613
- "w:tblOverlap": translator$A,
87614
- "w:tblPr": translator$e,
87615
- "w:tblStyle": translator$z,
87616
- "w:tblStyleColBandSize": translator$y,
87617
- "w:tblStyleRowBandSize": translator$x,
87618
- "w:tblW": translator$w,
87619
- "w:tblpPr": translator$v,
87620
- "w:tc": translator$a,
87621
- "w:top": translator$i,
87622
- "w:tr": translator$I,
87623
- "w:trHeight": translator$M,
87624
- "w:trPr": translator$J,
87625
- "w:u": translator$14,
87626
- "w:wAfter": translator$L,
87627
- "w:wBefore": translator$K,
87628
- "wp:anchor": translator$9,
87629
- "wp:inline": translator$8,
88151
+ "sd:pageReference": translator$5,
88152
+ "sd:tableOfContents": translator$4,
88153
+ "w:b": translator$18,
88154
+ "w:bidiVisual": translator$J,
88155
+ "w:bookmarkEnd": translator$6,
88156
+ "w:bookmarkStart": translator$7,
88157
+ "w:bottom": translator$w,
88158
+ "w:br": translator$1c,
88159
+ "w:cantSplit": translator$X,
88160
+ "w:cnfStyle": translator$W,
88161
+ "w:color": translator$14,
88162
+ "w:divId": translator$V,
88163
+ "w:drawing": translator$9,
88164
+ "w:end": translator$u,
88165
+ "w:gridAfter": translator$U,
88166
+ "w:gridBefore": translator$T,
88167
+ "w:gridCol": translator$f,
88168
+ "w:hidden": translator$S,
88169
+ "w:highlight": translator$1b,
88170
+ "w:hyperlink": translator$Z,
88171
+ "w:i": translator$17,
88172
+ "w:insideH": translator$s,
88173
+ "w:insideV": translator$r,
88174
+ "w:jc": translator$R,
88175
+ "w:left": translator$q,
88176
+ "w:p": translator$19,
88177
+ "w:r": translator$Y,
88178
+ "w:rFonts": translator$13,
88179
+ "w:rPr": translator$_,
88180
+ "w:rStyle": translator$12,
88181
+ "w:right": translator$o,
88182
+ "w:sdt": translator$8,
88183
+ "w:shd": translator$I,
88184
+ "w:start": translator$m,
88185
+ "w:strike": translator$15,
88186
+ "w:sz": translator$11,
88187
+ "w:szCs": translator$10,
88188
+ "w:tab": translator$1a,
88189
+ "w:tbl": translator$d,
88190
+ "w:tblBorders": translator$i,
88191
+ "w:tblCaption": translator$H,
88192
+ "w:tblCellMar": translator$h,
88193
+ "w:tblCellSpacing": translator$Q,
88194
+ "w:tblDescription": translator$G,
88195
+ "w:tblGrid": translator$e,
88196
+ "w:tblHeader": translator$P,
88197
+ "w:tblInd": translator$F,
88198
+ "w:tblLayout": translator$E,
88199
+ "w:tblLook": translator$D,
88200
+ "w:tblOverlap": translator$C,
88201
+ "w:tblPr": translator$g,
88202
+ "w:tblStyle": translator$B,
88203
+ "w:tblStyleColBandSize": translator$A,
88204
+ "w:tblStyleRowBandSize": translator$z,
88205
+ "w:tblW": translator$y,
88206
+ "w:tblpPr": translator$x,
88207
+ "w:tc": translator$c,
88208
+ "w:top": translator$k,
88209
+ "w:tr": translator$K,
88210
+ "w:trHeight": translator$O,
88211
+ "w:trPr": translator$L,
88212
+ "w:u": translator$16,
88213
+ "w:wAfter": translator$N,
88214
+ "w:wBefore": translator$M,
88215
+ "wp:anchor": translator$b,
88216
+ "wp:inline": translator$a,
87630
88217
  "w:commentRangeStart": commentRangeStartTranslator,
87631
88218
  "w:commentRangeEnd": commentRangeEndTranslator
87632
88219
  });