@harbour-enterprises/superdoc 0.22.1 → 0.23.0-next.10

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 (77) hide show
  1. package/dist/chunks/{PdfViewer-D2BPnEBG.cjs → PdfViewer-BsnSIYxD.cjs} +2 -2
  2. package/dist/chunks/{PdfViewer-CBmOiHsj.es.js → PdfViewer-CPZ7QD5u.es.js} +2 -2
  3. package/dist/chunks/{eventemitter3-CZv6vEhA.es.js → eventemitter3-CR2eBWft.es.js} +1 -1
  4. package/dist/chunks/{eventemitter3-B_kO1Pxm.cjs → eventemitter3-DSRogsNq.cjs} +1 -1
  5. package/dist/chunks/{index-BSDcfSFc.es.js → index-Cd9h9gMj.es.js} +32 -22
  6. package/dist/chunks/{index-B0CI50e4.cjs → index-DOd9uvCv.cjs} +32 -22
  7. package/dist/chunks/{jszip-b7l8QkfH.cjs → jszip-B4LDL19y.cjs} +1 -1
  8. package/dist/chunks/{jszip-B8KIZSNe.es.js → jszip-DAXEPCUv.es.js} +1 -1
  9. package/dist/chunks/{super-editor.es-DOOwW-Iv.cjs → super-editor.es-DAS3_Nt9.cjs} +1786 -1085
  10. package/dist/chunks/{super-editor.es-BW1T3N2-.es.js → super-editor.es-l3dTZlZX.es.js} +1786 -1085
  11. package/dist/chunks/{vue-DWle4Cai.cjs → vue-DKMj1I9B.cjs} +39 -42
  12. package/dist/chunks/{vue-CXxsqYcP.es.js → vue-ZWZLQtoU.es.js} +39 -42
  13. package/dist/chunks/xml-js-Bbc0NeKa.es.js +2 -0
  14. package/dist/chunks/xml-js-CWV8R-ek.cjs +3 -0
  15. package/dist/core/SuperDoc.d.ts +5 -18
  16. package/dist/core/SuperDoc.d.ts.map +1 -1
  17. package/dist/core/types/index.d.ts +29 -1
  18. package/dist/core/types/index.d.ts.map +1 -1
  19. package/dist/stores/superdoc-store.d.ts.map +1 -1
  20. package/dist/style.css +76 -54
  21. package/dist/super-editor/ai-writer.es.js +2 -2
  22. package/dist/super-editor/chunks/{converter-UuZxU-p8.js → converter-ClnqoStR.js} +1476 -1043
  23. package/dist/super-editor/chunks/{docx-zipper-Bss48sB0.js → docx-zipper-DC28ucAi.js} +1 -1
  24. package/dist/super-editor/chunks/{editor--v3HbUU0.js → editor-B2aHhS9B.js} +310 -42
  25. package/dist/super-editor/chunks/{toolbar-BeXlvdV8.js → toolbar-Cgyf_4bW.js} +4 -4
  26. package/dist/super-editor/converter.es.js +1 -1
  27. package/dist/super-editor/docx-zipper.es.js +2 -2
  28. package/dist/super-editor/editor.es.js +3 -3
  29. package/dist/super-editor/file-zipper.es.js +1 -1
  30. package/dist/super-editor/src/core/Attribute.d.ts +2 -2
  31. package/dist/super-editor/src/core/Schema.d.ts +2 -2
  32. package/dist/super-editor/src/core/super-converter/exporter.d.ts +4 -4
  33. package/dist/super-editor/src/core/super-converter/field-references/fld-preprocessors/hyperlink-preprocessor.d.ts +9 -0
  34. package/dist/super-editor/src/core/super-converter/field-references/fld-preprocessors/index.d.ts +2 -0
  35. package/dist/super-editor/src/core/super-converter/field-references/fld-preprocessors/num-pages-preprocessor.d.ts +9 -0
  36. package/dist/super-editor/src/core/super-converter/field-references/fld-preprocessors/page-preprocessor.d.ts +9 -0
  37. package/dist/super-editor/src/core/super-converter/field-references/fld-preprocessors/page-ref-preprocessor.d.ts +9 -0
  38. package/dist/super-editor/src/core/super-converter/field-references/fld-preprocessors/toc-preprocessor.d.ts +8 -0
  39. package/dist/super-editor/src/core/super-converter/field-references/index.d.ts +1 -0
  40. package/dist/super-editor/src/core/super-converter/field-references/preProcessNodesForFldChar.d.ts +21 -0
  41. package/dist/super-editor/src/core/super-converter/v2/exporter/helpers/translateChildNodes.d.ts +3 -3
  42. package/dist/super-editor/src/core/super-converter/v2/importer/pageReferenceImporter.d.ts +4 -0
  43. package/dist/super-editor/src/core/super-converter/v2/importer/tableOfContentsImporter.d.ts +4 -0
  44. package/dist/super-editor/src/core/super-converter/v2/types/index.d.ts +7 -1
  45. package/dist/super-editor/src/core/super-converter/v3/handlers/sd/pageReference/index.d.ts +1 -0
  46. package/dist/super-editor/src/core/super-converter/v3/handlers/sd/pageReference/pageReference-translator.d.ts +7 -0
  47. package/dist/super-editor/src/core/super-converter/v3/handlers/sd/tableOfContents/index.d.ts +1 -0
  48. package/dist/super-editor/src/core/super-converter/v3/handlers/sd/tableOfContents/tableOfContents-translator.d.ts +10 -0
  49. package/dist/super-editor/src/core/super-converter/v3/handlers/w/caps/caps-translator.d.ts +7 -0
  50. package/dist/super-editor/src/core/super-converter/v3/handlers/w/p/helpers/w-p-helpers.d.ts +0 -2
  51. package/dist/super-editor/src/core/super-converter/v3/handlers/w/sdt/helpers/handle-doc-part-obj.d.ts +9 -1
  52. package/dist/super-editor/src/core/super-converter/v3/handlers/w/sdt/helpers/translate-document-part-obj.d.ts +6 -0
  53. package/dist/super-editor/src/core/super-converter/v3/node-translator/node-translator.d.ts +2 -2
  54. package/dist/super-editor/src/extensions/image/imageHelpers/handleBase64.d.ts +4 -0
  55. package/dist/super-editor/src/extensions/image/imageHelpers/imageRegistrationPlugin.d.ts +1 -0
  56. package/dist/super-editor/src/extensions/image/imageHelpers/startImageUpload.d.ts +5 -0
  57. package/dist/super-editor/src/extensions/page-reference/index.d.ts +1 -0
  58. package/dist/super-editor/src/extensions/page-reference/page-reference.d.ts +2 -0
  59. package/dist/super-editor/src/extensions/structured-content/document-part-object.d.ts +2 -0
  60. package/dist/super-editor/src/extensions/structured-content/index.d.ts +1 -0
  61. package/dist/super-editor/src/extensions/structured-content/structuredContentHelpers/getStructuredContentTagsByAlias.d.ts +8 -0
  62. package/dist/super-editor/src/extensions/structured-content/structuredContentHelpers/index.d.ts +1 -0
  63. package/dist/super-editor/src/extensions/tab/helpers/tabDecorations.d.ts +2 -2
  64. package/dist/super-editor/src/extensions/table-of-contents/index.d.ts +1 -0
  65. package/dist/super-editor/src/extensions/table-of-contents/table-of-contents.d.ts +2 -0
  66. package/dist/super-editor/style.css +49 -27
  67. package/dist/super-editor/super-editor.es.js +10 -8
  68. package/dist/super-editor/toolbar.es.js +2 -2
  69. package/dist/super-editor.cjs +2 -2
  70. package/dist/super-editor.es.js +2 -2
  71. package/dist/superdoc.cjs +4 -4
  72. package/dist/superdoc.es.js +4 -4
  73. package/dist/superdoc.umd.js +1846 -1135
  74. package/dist/superdoc.umd.js.map +1 -1
  75. package/package.json +1 -1
  76. package/dist/chunks/xml-js-CX8FH0He.cjs +0 -3
  77. package/dist/chunks/xml-js-D0tLGmKu.es.js +0 -2
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
- const vue = require("./vue-DWle4Cai.cjs");
2
+ const vue = require("./vue-DKMj1I9B.cjs");
3
3
  const Y = require("yjs");
4
4
  function _interopNamespaceDefault(e) {
5
5
  const n = Object.create(null, { [Symbol.toStringTag]: { value: "Module" } });
@@ -5111,6 +5111,19 @@ function requireSafeRegexTest() {
5111
5111
  };
5112
5112
  return safeRegexTest;
5113
5113
  }
5114
+ var generatorFunction;
5115
+ var hasRequiredGeneratorFunction;
5116
+ function requireGeneratorFunction() {
5117
+ if (hasRequiredGeneratorFunction) return generatorFunction;
5118
+ hasRequiredGeneratorFunction = 1;
5119
+ const cached = (
5120
+ /** @type {GeneratorFunctionConstructor} */
5121
+ function* () {
5122
+ }.constructor
5123
+ );
5124
+ generatorFunction = () => cached;
5125
+ return generatorFunction;
5126
+ }
5114
5127
  var isGeneratorFunction;
5115
5128
  var hasRequiredIsGeneratorFunction;
5116
5129
  function requireIsGeneratorFunction() {
@@ -5123,16 +5136,7 @@ function requireIsGeneratorFunction() {
5123
5136
  var getProto2 = requireGetProto();
5124
5137
  var toStr = callBound2("Object.prototype.toString");
5125
5138
  var fnToStr = callBound2("Function.prototype.toString");
5126
- var getGeneratorFunc = function() {
5127
- if (!hasToStringTag) {
5128
- return false;
5129
- }
5130
- try {
5131
- return Function("return function*() {}")();
5132
- } catch (e) {
5133
- }
5134
- };
5135
- var GeneratorFunction;
5139
+ var getGeneratorFunction = /* @__PURE__ */ requireGeneratorFunction();
5136
5140
  isGeneratorFunction = function isGeneratorFunction2(fn2) {
5137
5141
  if (typeof fn2 !== "function") {
5138
5142
  return false;
@@ -5147,14 +5151,8 @@ function requireIsGeneratorFunction() {
5147
5151
  if (!getProto2) {
5148
5152
  return false;
5149
5153
  }
5150
- if (typeof GeneratorFunction === "undefined") {
5151
- var generatorFunc = getGeneratorFunc();
5152
- GeneratorFunction = generatorFunc ? (
5153
- /** @type {GeneratorFunctionConstructor} */
5154
- getProto2(generatorFunc)
5155
- ) : false;
5156
- }
5157
- return getProto2(fn2) === GeneratorFunction;
5154
+ var GeneratorFunction = getGeneratorFunction();
5155
+ return GeneratorFunction && getProto2(fn2) === GeneratorFunction.prototype;
5158
5156
  };
5159
5157
  return isGeneratorFunction;
5160
5158
  }
@@ -22985,13 +22983,56 @@ function translateChildNodes(params2) {
22985
22983
  const { content: nodes } = params2.node;
22986
22984
  if (!nodes) return [];
22987
22985
  const translatedNodes = [];
22988
- nodes.forEach((node) => {
22986
+ const hyperlinkGroup = [];
22987
+ let index2 = 0;
22988
+ while (index2 < nodes.length) {
22989
+ const node = nodes[index2];
22990
+ const linkMark = _isLinkNode(node);
22991
+ if (linkMark) {
22992
+ hyperlinkGroup.push(node);
22993
+ const nextNode = index2 + 1 < nodes.length ? nodes[index2 + 1] : null;
22994
+ const nextIsLink = _isLinkNode(nextNode, linkMark);
22995
+ if (nextIsLink) {
22996
+ index2++;
22997
+ continue;
22998
+ } else {
22999
+ let translatedLinkGroup = exportSchemaToJson({
23000
+ ...params2,
23001
+ node: hyperlinkGroup[0],
23002
+ extraParams: { ...params2.extraParams || {}, hyperlinkGroup: hyperlinkGroup.slice() }
23003
+ });
23004
+ if (translatedLinkGroup instanceof Array) translatedNodes.push(...translatedLinkGroup);
23005
+ else translatedNodes.push(translatedLinkGroup);
23006
+ hyperlinkGroup.length = 0;
23007
+ index2++;
23008
+ continue;
23009
+ }
23010
+ }
22989
23011
  let translatedNode = exportSchemaToJson({ ...params2, node });
22990
23012
  if (translatedNode instanceof Array) translatedNodes.push(...translatedNode);
22991
23013
  else translatedNodes.push(translatedNode);
22992
- });
23014
+ index2++;
23015
+ }
22993
23016
  return translatedNodes.filter((n) => n);
22994
23017
  }
23018
+ function _isLinkNode(node, referenceMark = null) {
23019
+ if (!node || !node.marks && !node.attrs?.marksAsAttrs) return null;
23020
+ const marks = node.marks || node.attrs.marksAsAttrs;
23021
+ const linkMark = marks.find((mark) => mark.type === "link");
23022
+ if (!linkMark) return null;
23023
+ if (referenceMark) {
23024
+ return _isSameLinkMark(linkMark.attrs, referenceMark.attrs) ? linkMark : null;
23025
+ }
23026
+ return linkMark;
23027
+ }
23028
+ function _isSameLinkMark(attrsA, attrsB) {
23029
+ for (let key2 of ["anchor", "docLocation", "history", "href", "rId", "target"]) {
23030
+ if (attrsA[key2] != attrsB[key2]) {
23031
+ return false;
23032
+ }
23033
+ }
23034
+ return true;
23035
+ }
22995
23036
  const baseNumbering = {
22996
23037
  declaration: {
22997
23038
  attributes: {
@@ -24338,37 +24379,37 @@ const _NodeTranslator = class _NodeTranslator2 {
24338
24379
  };
24339
24380
  __publicField$2(_NodeTranslator, "translatorTypes", TranslatorTypes);
24340
24381
  let NodeTranslator = _NodeTranslator;
24341
- const encode$18 = (attributes) => {
24382
+ const encode$1b = (attributes) => {
24342
24383
  return attributes["w:type"];
24343
24384
  };
24344
- const decode$$ = (attrs) => {
24385
+ const decode$11 = (attrs) => {
24345
24386
  const { lineBreakType } = attrs;
24346
24387
  return lineBreakType;
24347
24388
  };
24348
24389
  const attrConfig$F = Object.freeze({
24349
24390
  xmlName: "w:type",
24350
24391
  sdName: "lineBreakType",
24351
- encode: encode$18,
24352
- decode: decode$$
24392
+ encode: encode$1b,
24393
+ decode: decode$11
24353
24394
  });
24354
- const encode$17 = (attributes) => {
24395
+ const encode$1a = (attributes) => {
24355
24396
  const xmlAttrValue = attributes["w:clear"];
24356
24397
  return xmlAttrValue;
24357
24398
  };
24358
- const decode$_ = (attrs) => {
24399
+ const decode$10 = (attrs) => {
24359
24400
  const { clear } = attrs;
24360
24401
  return clear;
24361
24402
  };
24362
24403
  const attrConfig$E = Object.freeze({
24363
24404
  xmlName: "w:clear",
24364
24405
  sdName: "clear",
24365
- encode: encode$17,
24366
- decode: decode$_
24406
+ encode: encode$1a,
24407
+ decode: decode$10
24367
24408
  });
24368
24409
  const validXmlAttributes$m = [attrConfig$F, attrConfig$E];
24369
- const XML_NODE_NAME$u = "w:br";
24370
- const SD_NODE_NAME$d = "lineBreak";
24371
- const encode$16 = (_2, encodedAttrs) => {
24410
+ const XML_NODE_NAME$x = "w:br";
24411
+ const SD_NODE_NAME$f = "lineBreak";
24412
+ const encode$19 = (_2, encodedAttrs) => {
24372
24413
  const isPageBreak = encodedAttrs?.lineBreakType === "page";
24373
24414
  const translated = {
24374
24415
  type: isPageBreak ? "hardBreak" : "lineBreak"
@@ -24378,7 +24419,7 @@ const encode$16 = (_2, encodedAttrs) => {
24378
24419
  }
24379
24420
  return translated;
24380
24421
  };
24381
- const decode$Z = (params2, decodedAttrs) => {
24422
+ const decode$$ = (params2, decodedAttrs) => {
24382
24423
  const { node } = params2;
24383
24424
  if (!node) return;
24384
24425
  const wBreak = { name: "w:br" };
@@ -24395,39 +24436,39 @@ const decode$Z = (params2, decodedAttrs) => {
24395
24436
  };
24396
24437
  return translated;
24397
24438
  };
24398
- const config$s = {
24399
- xmlName: XML_NODE_NAME$u,
24400
- sdNodeOrKeyName: SD_NODE_NAME$d,
24439
+ const config$v = {
24440
+ xmlName: XML_NODE_NAME$x,
24441
+ sdNodeOrKeyName: SD_NODE_NAME$f,
24401
24442
  type: NodeTranslator.translatorTypes.NODE,
24402
- encode: encode$16,
24403
- decode: decode$Z,
24443
+ encode: encode$19,
24444
+ decode: decode$$,
24404
24445
  attributes: validXmlAttributes$m
24405
24446
  };
24406
- const translator$16 = NodeTranslator.from(config$s);
24407
- const encode$15 = (attributes) => attributes?.["w:val"];
24408
- const decode$Y = (attrs) => attrs?.highlight;
24447
+ const translator$19 = NodeTranslator.from(config$v);
24448
+ const encode$18 = (attributes) => attributes?.["w:val"];
24449
+ const decode$_ = (attrs) => attrs?.highlight;
24409
24450
  const attrConfig$D = Object.freeze({
24410
24451
  xmlName: "w:val",
24411
24452
  sdName: "highlight",
24412
- encode: encode$15,
24413
- decode: decode$Y
24453
+ encode: encode$18,
24454
+ decode: decode$_
24414
24455
  });
24415
24456
  const validXmlAttributes$l = [attrConfig$D];
24416
- const XML_NODE_NAME$t = "w:highlight";
24417
- const SD_ATTR_KEY$f = "highlight";
24457
+ const XML_NODE_NAME$w = "w:highlight";
24458
+ const SD_ATTR_KEY$g = "highlight";
24418
24459
  const DISABLED_TOKENS = /* @__PURE__ */ new Set(["transparent", "none", "inherit"]);
24419
- const encode$14 = (params2, encodedAttrs = {}) => {
24460
+ const encode$17 = (params2, encodedAttrs = {}) => {
24420
24461
  const { nodes } = params2;
24421
24462
  const node = nodes?.[0];
24422
24463
  const value = encodedAttrs.highlight ?? node?.attributes?.["w:val"];
24423
24464
  return {
24424
24465
  type: "attr",
24425
- xmlName: XML_NODE_NAME$t,
24426
- sdNodeOrKeyName: SD_ATTR_KEY$f,
24466
+ xmlName: XML_NODE_NAME$w,
24467
+ sdNodeOrKeyName: SD_ATTR_KEY$g,
24427
24468
  attributes: { "w:val": value ?? null }
24428
24469
  };
24429
24470
  };
24430
- const decode$X = (params2) => {
24471
+ const decode$Z = (params2) => {
24431
24472
  const attrs = params2?.node?.attrs || {};
24432
24473
  const highlightValue = attrs.highlight ?? attrs.color ?? null;
24433
24474
  if (!highlightValue) return void 0;
@@ -24435,14 +24476,14 @@ const decode$X = (params2) => {
24435
24476
  if (!normalizedValue) return void 0;
24436
24477
  if (DISABLED_TOKENS.has(normalizedValue)) {
24437
24478
  return {
24438
- name: XML_NODE_NAME$t,
24479
+ name: XML_NODE_NAME$w,
24439
24480
  attributes: { "w:val": "none" }
24440
24481
  };
24441
24482
  }
24442
24483
  const keyword = getDocxHighlightKeywordFromHex(highlightValue);
24443
24484
  if (keyword) {
24444
24485
  return {
24445
- name: XML_NODE_NAME$t,
24486
+ name: XML_NODE_NAME$w,
24446
24487
  attributes: { "w:val": keyword }
24447
24488
  };
24448
24489
  }
@@ -24457,63 +24498,63 @@ const decode$X = (params2) => {
24457
24498
  }
24458
24499
  };
24459
24500
  };
24460
- const config$r = {
24461
- xmlName: XML_NODE_NAME$t,
24462
- sdNodeOrKeyName: SD_ATTR_KEY$f,
24501
+ const config$u = {
24502
+ xmlName: XML_NODE_NAME$w,
24503
+ sdNodeOrKeyName: SD_ATTR_KEY$g,
24463
24504
  type: NodeTranslator.translatorTypes.ATTRIBUTE,
24464
- encode: encode$14,
24465
- decode: decode$X,
24505
+ encode: encode$17,
24506
+ decode: decode$Z,
24466
24507
  attributes: validXmlAttributes$l
24467
24508
  };
24468
- const translator$15 = NodeTranslator.from(config$r);
24469
- const encode$13 = (attributes) => {
24509
+ const translator$18 = NodeTranslator.from(config$u);
24510
+ const encode$16 = (attributes) => {
24470
24511
  return attributes["w:val"];
24471
24512
  };
24472
- const decode$W = (attrs) => {
24513
+ const decode$Y = (attrs) => {
24473
24514
  const { tabSize } = attrs || {};
24474
24515
  return tabSize;
24475
24516
  };
24476
24517
  const attrConfig$C = Object.freeze({
24477
24518
  xmlName: "w:val",
24478
24519
  sdName: "tabSize",
24479
- encode: encode$13,
24480
- decode: decode$W
24520
+ encode: encode$16,
24521
+ decode: decode$Y
24481
24522
  });
24482
- const encode$12 = (attributes) => {
24523
+ const encode$15 = (attributes) => {
24483
24524
  return attributes["w:leader"];
24484
24525
  };
24485
- const decode$V = (attrs) => {
24526
+ const decode$X = (attrs) => {
24486
24527
  const { leader } = attrs || {};
24487
24528
  return leader;
24488
24529
  };
24489
24530
  const attrConfig$B = Object.freeze({
24490
24531
  xmlName: "w:leader",
24491
24532
  sdName: "leader",
24492
- encode: encode$12,
24493
- decode: decode$V
24533
+ encode: encode$15,
24534
+ decode: decode$X
24494
24535
  });
24495
- const encode$11 = (attributes) => {
24536
+ const encode$14 = (attributes) => {
24496
24537
  return attributes["w:pos"];
24497
24538
  };
24498
- const decode$U = (attrs) => {
24539
+ const decode$W = (attrs) => {
24499
24540
  const { pos } = attrs || {};
24500
24541
  return pos;
24501
24542
  };
24502
24543
  const attrConfig$A = Object.freeze({
24503
24544
  xmlName: "w:pos",
24504
24545
  sdName: "pos",
24505
- encode: encode$11,
24506
- decode: decode$U
24546
+ encode: encode$14,
24547
+ decode: decode$W
24507
24548
  });
24508
24549
  const validXmlAttributes$k = [attrConfig$C, attrConfig$A, attrConfig$B];
24509
- const XML_NODE_NAME$s = "w:tab";
24510
- const SD_NODE_NAME$c = "tab";
24511
- const encode$10 = (_2, encodedAttrs = {}) => {
24550
+ const XML_NODE_NAME$v = "w:tab";
24551
+ const SD_NODE_NAME$e = "tab";
24552
+ const encode$13 = (_2, encodedAttrs = {}) => {
24512
24553
  const translated = { type: "tab" };
24513
24554
  if (encodedAttrs) translated.attrs = { ...encodedAttrs };
24514
24555
  return translated;
24515
24556
  };
24516
- const decode$T = (params2, decodedAttrs = {}) => {
24557
+ const decode$V = (params2, decodedAttrs = {}) => {
24517
24558
  const { node } = params2 || {};
24518
24559
  if (!node) return;
24519
24560
  const wTab = { name: "w:tab" };
@@ -24529,15 +24570,15 @@ const decode$T = (params2, decodedAttrs = {}) => {
24529
24570
  }
24530
24571
  return translated;
24531
24572
  };
24532
- const config$q = {
24533
- xmlName: XML_NODE_NAME$s,
24534
- sdNodeOrKeyName: SD_NODE_NAME$c,
24573
+ const config$t = {
24574
+ xmlName: XML_NODE_NAME$v,
24575
+ sdNodeOrKeyName: SD_NODE_NAME$e,
24535
24576
  type: NodeTranslator.translatorTypes.NODE,
24536
- encode: encode$10,
24537
- decode: decode$T,
24577
+ encode: encode$13,
24578
+ decode: decode$V,
24538
24579
  attributes: validXmlAttributes$k
24539
24580
  };
24540
- const translator$14 = NodeTranslator.from(config$q);
24581
+ const translator$17 = NodeTranslator.from(config$t);
24541
24582
  const mergeTextNodes = (nodes) => {
24542
24583
  if (!nodes || !Array.isArray(nodes)) {
24543
24584
  return nodes;
@@ -24911,104 +24952,10 @@ const getDefaultParagraphStyle = (docx, styleId = "") => {
24911
24952
  justify: pPrByIdJcAttr
24912
24953
  };
24913
24954
  };
24914
- const preProcessNodesForFldChar = (nodes = []) => {
24915
- const processedNodes = [];
24916
- let buffer2 = [];
24917
- let collecting = false;
24918
- for (const node of nodes) {
24919
- const fldCharEl = node.elements?.find((el) => el.name === "w:fldChar");
24920
- const fldType = fldCharEl?.attributes?.["w:fldCharType"];
24921
- if (fldType === "begin") {
24922
- buffer2 = [node];
24923
- collecting = true;
24924
- continue;
24925
- }
24926
- if (fldType === "separate" && collecting) {
24927
- buffer2.push(node);
24928
- continue;
24929
- }
24930
- if (fldType === "end" && collecting) {
24931
- buffer2.push(node);
24932
- processedNodes.push(...processCombinedNodesForFldChar(buffer2));
24933
- buffer2 = [];
24934
- collecting = false;
24935
- continue;
24936
- }
24937
- if (collecting) {
24938
- buffer2.push(node);
24939
- } else {
24940
- processedNodes.push(node);
24941
- }
24942
- }
24943
- if (buffer2.length) {
24944
- processedNodes.push(...buffer2);
24945
- }
24946
- return processedNodes;
24947
- };
24948
- const processCombinedNodesForFldChar = (nodesToCombine = []) => {
24949
- let processedNodes = [];
24950
- let hasPageMarker = false;
24951
- let isNumPages = false;
24952
- const textStart = nodesToCombine.findIndex(
24953
- (n) => n.elements?.some((el) => el.name === "w:fldChar" && el.attributes["w:fldCharType"] === "separate")
24954
- );
24955
- const textEnd = nodesToCombine.findIndex(
24956
- (n) => n.elements?.some((el) => el.name === "w:fldChar" && el.attributes["w:fldCharType"] === "end")
24957
- );
24958
- const textNodes = nodesToCombine.slice(textStart + 1, textEnd);
24959
- const instrTextContainer = nodesToCombine.find((n) => n.elements?.some((el) => el.name === "w:instrText"));
24960
- const instrTextNode = instrTextContainer?.elements?.find((el) => el.name === "w:instrText");
24961
- const instrText = instrTextNode?.elements[0].text;
24962
- if (!hasPageMarker) hasPageMarker = instrText?.trim().startsWith("PAGE");
24963
- if (!isNumPages) isNumPages = instrText?.trim().startsWith("NUMPAGES");
24964
- const urlMatch = instrText?.match(/HYPERLINK\s+"([^"]+)"/);
24965
- if (hasPageMarker) {
24966
- const pageNumNode = {
24967
- name: "sd:autoPageNumber",
24968
- type: "element"
24969
- };
24970
- nodesToCombine.forEach((n) => {
24971
- const rPrNode = n.elements.find((el) => el.name === "w:rPr");
24972
- if (rPrNode) pageNumNode.elements = [rPrNode];
24973
- });
24974
- processedNodes.push(pageNumNode);
24975
- } else if (isNumPages) {
24976
- const totalPageNumNode = {
24977
- name: "sd:totalPageNumber",
24978
- type: "element"
24979
- };
24980
- nodesToCombine.forEach((n) => {
24981
- const rPrNode = n.elements.find((el) => el.name === "w:rPr");
24982
- if (rPrNode) totalPageNumNode.elements = [rPrNode];
24983
- });
24984
- processedNodes.push(totalPageNumNode);
24985
- } else if (urlMatch && urlMatch?.length >= 2) {
24986
- const url = urlMatch[1];
24987
- const textMarks = [];
24988
- textNodes.forEach((n) => {
24989
- const rPr2 = n.elements.find((el) => el.name === "w:rPr");
24990
- if (!rPr2) return;
24991
- const { elements } = rPr2;
24992
- elements.forEach((el) => {
24993
- textMarks.push(el);
24994
- });
24995
- });
24996
- const linkMark = { name: "link", attributes: { href: url } };
24997
- const rPr = { name: "w:rPr", type: "element", elements: [linkMark, ...textMarks] };
24998
- processedNodes.push({
24999
- name: "w:r",
25000
- type: "element",
25001
- elements: [rPr, ...textNodes]
25002
- });
25003
- }
25004
- return processedNodes;
25005
- };
25006
24955
  const handleParagraphNode$1 = (params2) => {
25007
24956
  const { nodes, docx, nodeListHandler, filename } = params2;
25008
24957
  const node = carbonCopy(nodes[0]);
25009
24958
  let schemaNode;
25010
- let processedElements = preProcessNodesForFldChar(node.elements);
25011
- node.elements = processedElements;
25012
24959
  const handleStandardNode2 = nodeListHandler.handlerEntities.find(
25013
24960
  (e) => e.handlerName === "standardNodeHandler"
25014
24961
  )?.handler;
@@ -25149,89 +25096,89 @@ const handleParagraphNode$1 = (params2) => {
25149
25096
  }
25150
25097
  return schemaNode;
25151
25098
  };
25152
- const encode$$ = (attributes) => {
25099
+ const encode$12 = (attributes) => {
25153
25100
  return attributes["w:rsidDel"];
25154
25101
  };
25155
- const decode$S = (attrs) => {
25102
+ const decode$U = (attrs) => {
25156
25103
  return attrs.rsidDel;
25157
25104
  };
25158
25105
  const attrConfig$z = Object.freeze({
25159
25106
  xmlName: "w:rsidDel",
25160
25107
  sdName: "rsidDel",
25161
- encode: encode$$,
25162
- decode: decode$S
25108
+ encode: encode$12,
25109
+ decode: decode$U
25163
25110
  });
25164
- const encode$_ = (attributes) => {
25111
+ const encode$11 = (attributes) => {
25165
25112
  return attributes["w:rsidP"];
25166
25113
  };
25167
- const decode$R = (attrs) => {
25114
+ const decode$T = (attrs) => {
25168
25115
  return attrs.rsidP;
25169
25116
  };
25170
25117
  const attrConfig$y = Object.freeze({
25171
25118
  xmlName: "w:rsidP",
25172
25119
  sdName: "rsidP",
25173
- encode: encode$_,
25174
- decode: decode$R
25120
+ encode: encode$11,
25121
+ decode: decode$T
25175
25122
  });
25176
- const encode$Z = (attributes) => {
25123
+ const encode$10 = (attributes) => {
25177
25124
  return attributes["w:rsidR"];
25178
25125
  };
25179
- const decode$Q = (attrs) => {
25126
+ const decode$S = (attrs) => {
25180
25127
  return attrs.rsidR;
25181
25128
  };
25182
25129
  const attrConfig$x = Object.freeze({
25183
25130
  xmlName: "w:rsidR",
25184
25131
  sdName: "rsidR",
25185
- encode: encode$Z,
25186
- decode: decode$Q
25132
+ encode: encode$10,
25133
+ decode: decode$S
25187
25134
  });
25188
- const encode$Y = (attributes) => {
25135
+ const encode$$ = (attributes) => {
25189
25136
  return attributes["w:rsidRPr"];
25190
25137
  };
25191
- const decode$P = (attrs) => {
25138
+ const decode$R = (attrs) => {
25192
25139
  return attrs.rsidRPr;
25193
25140
  };
25194
25141
  const attrConfig$w = Object.freeze({
25195
25142
  xmlName: "w:rsidRPr",
25196
25143
  sdName: "rsidRPr",
25197
- encode: encode$Y,
25198
- decode: decode$P
25144
+ encode: encode$$,
25145
+ decode: decode$R
25199
25146
  });
25200
- const encode$X = (attributes) => {
25147
+ const encode$_ = (attributes) => {
25201
25148
  return attributes["w:rsidRDefault"];
25202
25149
  };
25203
- const decode$O = (attrs) => {
25150
+ const decode$Q = (attrs) => {
25204
25151
  return attrs.rsidRDefault;
25205
25152
  };
25206
25153
  const attrConfig$v = Object.freeze({
25207
25154
  xmlName: "w:rsidRDefault",
25208
25155
  sdName: "rsidRDefault",
25209
- encode: encode$X,
25210
- decode: decode$O
25156
+ encode: encode$_,
25157
+ decode: decode$Q
25211
25158
  });
25212
- const encode$W = (attributes) => {
25159
+ const encode$Z = (attributes) => {
25213
25160
  return attributes["w14:paraId"];
25214
25161
  };
25215
- const decode$N = (attrs) => {
25162
+ const decode$P = (attrs) => {
25216
25163
  return attrs.paraId;
25217
25164
  };
25218
25165
  const attrConfig$u = Object.freeze({
25219
25166
  xmlName: "w14:paraId",
25220
25167
  sdName: "paraId",
25221
- encode: encode$W,
25222
- decode: decode$N
25168
+ encode: encode$Z,
25169
+ decode: decode$P
25223
25170
  });
25224
- const encode$V = (attributes) => {
25171
+ const encode$Y = (attributes) => {
25225
25172
  return attributes["w14:textId"];
25226
25173
  };
25227
- const decode$M = (attrs) => {
25174
+ const decode$O = (attrs) => {
25228
25175
  return attrs.textId;
25229
25176
  };
25230
25177
  const attrConfig$t = Object.freeze({
25231
25178
  xmlName: "w14:textId",
25232
25179
  sdName: "textId",
25233
- encode: encode$V,
25234
- decode: decode$M
25180
+ encode: encode$Y,
25181
+ decode: decode$O
25235
25182
  });
25236
25183
  const validXmlAttributes$j = [
25237
25184
  attrConfig$u,
@@ -25242,9 +25189,9 @@ const validXmlAttributes$j = [
25242
25189
  attrConfig$w,
25243
25190
  attrConfig$z
25244
25191
  ];
25245
- const XML_NODE_NAME$r = "w:p";
25246
- const SD_NODE_NAME$b = "paragraph";
25247
- const encode$U = (params2, encodedAttrs = {}) => {
25192
+ const XML_NODE_NAME$u = "w:p";
25193
+ const SD_NODE_NAME$d = "paragraph";
25194
+ const encode$X = (params2, encodedAttrs = {}) => {
25248
25195
  const node = handleParagraphNode$1(params2);
25249
25196
  if (!node) return void 0;
25250
25197
  if (encodedAttrs && Object.keys(encodedAttrs).length) {
@@ -25252,7 +25199,7 @@ const encode$U = (params2, encodedAttrs = {}) => {
25252
25199
  }
25253
25200
  return node;
25254
25201
  };
25255
- const decode$L = (params2, decodedAttrs = {}) => {
25202
+ const decode$N = (params2, decodedAttrs = {}) => {
25256
25203
  const translated = translateParagraphNode(params2);
25257
25204
  if (!translated) return void 0;
25258
25205
  if (decodedAttrs && Object.keys(decodedAttrs).length) {
@@ -25260,16 +25207,16 @@ const decode$L = (params2, decodedAttrs = {}) => {
25260
25207
  }
25261
25208
  return translated;
25262
25209
  };
25263
- const config$p = {
25264
- xmlName: XML_NODE_NAME$r,
25265
- sdNodeOrKeyName: SD_NODE_NAME$b,
25210
+ const config$s = {
25211
+ xmlName: XML_NODE_NAME$u,
25212
+ sdNodeOrKeyName: SD_NODE_NAME$d,
25266
25213
  type: NodeTranslator.translatorTypes.NODE,
25267
- encode: encode$U,
25268
- decode: decode$L,
25214
+ encode: encode$X,
25215
+ decode: decode$N,
25269
25216
  attributes: validXmlAttributes$j
25270
25217
  };
25271
- const translator$13 = NodeTranslator.from(config$p);
25272
- const encode$T = (attributes) => {
25218
+ const translator$16 = NodeTranslator.from(config$s);
25219
+ const encode$W = (attributes) => {
25273
25220
  const raw = attributes?.["w:val"];
25274
25221
  if (raw === void 0 || raw === null) return void 0;
25275
25222
  if (typeof raw === "boolean") return raw;
@@ -25279,24 +25226,24 @@ const encode$T = (attributes) => {
25279
25226
  if (val === "1" || val === "true" || val === "on") return true;
25280
25227
  return void 0;
25281
25228
  };
25282
- const decode$K = (runProps) => {
25229
+ const decode$M = (runProps) => {
25283
25230
  if (runProps?.bold === false) return "0";
25284
25231
  return void 0;
25285
25232
  };
25286
25233
  const attrConfig$s = Object.freeze({
25287
25234
  xmlName: "w:val",
25288
25235
  sdName: "bold",
25289
- encode: encode$T,
25290
- decode: decode$K
25236
+ encode: encode$W,
25237
+ decode: decode$M
25291
25238
  });
25292
25239
  const validXmlAttributes$i = [attrConfig$s];
25293
- const XML_NODE_NAME$q = "w:b";
25294
- const SD_ATTR_KEY$e = "bold";
25295
- const encode$S = (params2, encodedAttrs = {}) => {
25240
+ const XML_NODE_NAME$t = "w:b";
25241
+ const SD_ATTR_KEY$f = "bold";
25242
+ const encode$V = (params2, encodedAttrs = {}) => {
25296
25243
  const { nodes } = params2;
25297
25244
  const node = nodes[0];
25298
25245
  if (!node) return void 0;
25299
- const val = encodedAttrs?.[SD_ATTR_KEY$e];
25246
+ const val = encodedAttrs?.[SD_ATTR_KEY$f];
25300
25247
  let attributes;
25301
25248
  if (val === false) attributes = { "w:val": "0" };
25302
25249
  else if (val === true)
@@ -25304,85 +25251,85 @@ const encode$S = (params2, encodedAttrs = {}) => {
25304
25251
  else attributes = node.attributes || {};
25305
25252
  return {
25306
25253
  type: "attr",
25307
- xmlName: XML_NODE_NAME$q,
25308
- sdNodeOrKeyName: SD_ATTR_KEY$e,
25254
+ xmlName: XML_NODE_NAME$t,
25255
+ sdNodeOrKeyName: SD_ATTR_KEY$f,
25309
25256
  attributes
25310
25257
  };
25311
25258
  };
25312
- const config$o = {
25313
- xmlName: XML_NODE_NAME$q,
25314
- sdNodeOrKeyName: SD_ATTR_KEY$e,
25259
+ const config$r = {
25260
+ xmlName: XML_NODE_NAME$t,
25261
+ sdNodeOrKeyName: SD_ATTR_KEY$f,
25315
25262
  type: NodeTranslator.translatorTypes.ATTRIBUTE,
25316
- encode: encode$S,
25263
+ encode: encode$V,
25317
25264
  attributes: validXmlAttributes$i
25318
25265
  };
25319
- const translator$12 = NodeTranslator.from(config$o);
25320
- const XML_NODE_NAME$p = "w:i";
25321
- const SD_ATTR_KEY$d = "italic";
25322
- const encode$R = (params2) => {
25266
+ const translator$15 = NodeTranslator.from(config$r);
25267
+ const XML_NODE_NAME$s = "w:i";
25268
+ const SD_ATTR_KEY$e = "italic";
25269
+ const encode$U = (params2) => {
25323
25270
  const { nodes } = params2;
25324
25271
  const node = nodes?.[0];
25325
25272
  if (!node) return void 0;
25326
25273
  return {
25327
25274
  type: "attr",
25328
- xmlName: XML_NODE_NAME$p,
25329
- sdNodeOrKeyName: SD_ATTR_KEY$d,
25275
+ xmlName: XML_NODE_NAME$s,
25276
+ sdNodeOrKeyName: SD_ATTR_KEY$e,
25330
25277
  attributes: {
25331
25278
  "w:val": node.attributes?.["w:val"] ?? null
25332
25279
  }
25333
25280
  };
25334
25281
  };
25335
- const config$n = {
25336
- xmlName: XML_NODE_NAME$p,
25337
- sdNodeOrKeyName: SD_ATTR_KEY$d,
25282
+ const config$q = {
25283
+ xmlName: XML_NODE_NAME$s,
25284
+ sdNodeOrKeyName: SD_ATTR_KEY$e,
25338
25285
  type: NodeTranslator.translatorTypes.ATTRIBUTE,
25339
- encode: encode$R
25286
+ encode: encode$U
25340
25287
  };
25341
- const translator$11 = NodeTranslator.from(config$n);
25342
- const encode$Q = (attributes) => attributes?.["w:val"];
25343
- const decode$J = (attrs) => attrs?.underline;
25288
+ const translator$14 = NodeTranslator.from(config$q);
25289
+ const encode$T = (attributes) => attributes?.["w:val"];
25290
+ const decode$L = (attrs) => attrs?.underline;
25344
25291
  const attrConfig$r = Object.freeze({
25345
25292
  xmlName: "w:val",
25346
25293
  sdName: "underline",
25347
- encode: encode$Q,
25348
- decode: decode$J
25294
+ encode: encode$T,
25295
+ decode: decode$L
25349
25296
  });
25350
- const encode$P = (attributes) => attributes?.["w:color"];
25351
- const decode$I = (attrs) => attrs?.color;
25297
+ const encode$S = (attributes) => attributes?.["w:color"];
25298
+ const decode$K = (attrs) => attrs?.color;
25352
25299
  const attrConfig$q = Object.freeze({
25353
25300
  xmlName: "w:color",
25354
25301
  sdName: "color",
25355
- encode: encode$P,
25356
- decode: decode$I
25302
+ encode: encode$S,
25303
+ decode: decode$K
25357
25304
  });
25358
- const encode$O = (attributes) => attributes?.["w:themeColor"];
25359
- const decode$H = (attrs) => attrs?.themeColor;
25305
+ const encode$R = (attributes) => attributes?.["w:themeColor"];
25306
+ const decode$J = (attrs) => attrs?.themeColor;
25360
25307
  const attrConfig$p = Object.freeze({
25361
25308
  xmlName: "w:themeColor",
25362
25309
  sdName: "themeColor",
25363
- encode: encode$O,
25364
- decode: decode$H
25310
+ encode: encode$R,
25311
+ decode: decode$J
25365
25312
  });
25366
- const encode$N = (attributes) => attributes?.["w:themeTint"];
25367
- const decode$G = (attrs) => attrs?.themeTint;
25313
+ const encode$Q = (attributes) => attributes?.["w:themeTint"];
25314
+ const decode$I = (attrs) => attrs?.themeTint;
25368
25315
  const attrConfig$o = Object.freeze({
25369
25316
  xmlName: "w:themeTint",
25370
25317
  sdName: "themeTint",
25371
- encode: encode$N,
25372
- decode: decode$G
25318
+ encode: encode$Q,
25319
+ decode: decode$I
25373
25320
  });
25374
- const encode$M = (attributes) => attributes?.["w:themeShade"];
25375
- const decode$F = (attrs) => attrs?.themeShade;
25321
+ const encode$P = (attributes) => attributes?.["w:themeShade"];
25322
+ const decode$H = (attrs) => attrs?.themeShade;
25376
25323
  const attrConfig$n = Object.freeze({
25377
25324
  xmlName: "w:themeShade",
25378
25325
  sdName: "themeShade",
25379
- encode: encode$M,
25380
- decode: decode$F
25326
+ encode: encode$P,
25327
+ decode: decode$H
25381
25328
  });
25382
25329
  const validXmlAttributes$h = [attrConfig$r, attrConfig$q, attrConfig$p, attrConfig$o, attrConfig$n];
25383
- const XML_NODE_NAME$o = "w:u";
25384
- const SD_ATTR_KEY$c = "underline";
25385
- const encode$L = (params2, encodedAttrs = {}) => {
25330
+ const XML_NODE_NAME$r = "w:u";
25331
+ const SD_ATTR_KEY$d = "underline";
25332
+ const encode$O = (params2, encodedAttrs = {}) => {
25386
25333
  const { nodes } = params2;
25387
25334
  const node = nodes?.[0];
25388
25335
  const sourceAttrs = node?.attributes || {};
@@ -25398,12 +25345,12 @@ const encode$L = (params2, encodedAttrs = {}) => {
25398
25345
  if (themeShade !== void 0 && themeShade !== null) attributes["w:themeShade"] = themeShade;
25399
25346
  return {
25400
25347
  type: "attr",
25401
- xmlName: XML_NODE_NAME$o,
25402
- sdNodeOrKeyName: SD_ATTR_KEY$c,
25348
+ xmlName: XML_NODE_NAME$r,
25349
+ sdNodeOrKeyName: SD_ATTR_KEY$d,
25403
25350
  attributes
25404
25351
  };
25405
25352
  };
25406
- const decode$E = (params2) => {
25353
+ const decode$G = (params2) => {
25407
25354
  const attrs = params2?.node?.attrs || {};
25408
25355
  const underlineType = attrs.underlineType ?? attrs.underline ?? null;
25409
25356
  const color = attrs.underlineColor ?? attrs.color ?? null;
@@ -25421,20 +25368,20 @@ const decode$E = (params2) => {
25421
25368
  if (themeTint) attributes["w:themeTint"] = themeTint;
25422
25369
  if (themeShade) attributes["w:themeShade"] = themeShade;
25423
25370
  return {
25424
- name: XML_NODE_NAME$o,
25371
+ name: XML_NODE_NAME$r,
25425
25372
  attributes
25426
25373
  };
25427
25374
  };
25428
- const config$m = {
25429
- xmlName: XML_NODE_NAME$o,
25430
- sdNodeOrKeyName: SD_ATTR_KEY$c,
25375
+ const config$p = {
25376
+ xmlName: XML_NODE_NAME$r,
25377
+ sdNodeOrKeyName: SD_ATTR_KEY$d,
25431
25378
  type: NodeTranslator.translatorTypes.ATTRIBUTE,
25432
- encode: encode$L,
25433
- decode: decode$E,
25379
+ encode: encode$O,
25380
+ decode: decode$G,
25434
25381
  attributes: validXmlAttributes$h
25435
25382
  };
25436
- const translator$10 = NodeTranslator.from(config$m);
25437
- const encode$K = (attributes) => {
25383
+ const translator$13 = NodeTranslator.from(config$p);
25384
+ const encode$N = (attributes) => {
25438
25385
  const raw = attributes?.["w:val"];
25439
25386
  if (raw === void 0 || raw === null) return void 0;
25440
25387
  if (typeof raw === "boolean") return raw;
@@ -25444,24 +25391,24 @@ const encode$K = (attributes) => {
25444
25391
  if (val === "1" || val === "true" || val === "on") return true;
25445
25392
  return void 0;
25446
25393
  };
25447
- const decode$D = (attrs) => {
25394
+ const decode$F = (attrs) => {
25448
25395
  if (attrs?.strike === false) return "0";
25449
25396
  return void 0;
25450
25397
  };
25451
25398
  const attrConfig$m = Object.freeze({
25452
25399
  xmlName: "w:val",
25453
25400
  sdName: "strike",
25454
- encode: encode$K,
25455
- decode: decode$D
25401
+ encode: encode$N,
25402
+ decode: decode$F
25456
25403
  });
25457
25404
  const validXmlAttributes$g = [attrConfig$m];
25458
- const XML_NODE_NAME$n = "w:strike";
25459
- const SD_ATTR_KEY$b = "strike";
25460
- const encode$J = (params2, encodedAttrs = {}) => {
25405
+ const XML_NODE_NAME$q = "w:strike";
25406
+ const SD_ATTR_KEY$c = "strike";
25407
+ const encode$M = (params2, encodedAttrs = {}) => {
25461
25408
  const { nodes } = params2;
25462
25409
  const node = nodes?.[0];
25463
25410
  if (!node) return void 0;
25464
- const val = encodedAttrs?.[SD_ATTR_KEY$b];
25411
+ const val = encodedAttrs?.[SD_ATTR_KEY$c];
25465
25412
  let attributes;
25466
25413
  if (val === false) attributes = { "w:val": "0" };
25467
25414
  else if (val === true) attributes = {};
@@ -25470,55 +25417,55 @@ const encode$J = (params2, encodedAttrs = {}) => {
25470
25417
  else if (val === true && attributes["w:val"] === void 0) delete attributes["w:val"];
25471
25418
  return {
25472
25419
  type: "attr",
25473
- xmlName: XML_NODE_NAME$n,
25474
- sdNodeOrKeyName: SD_ATTR_KEY$b,
25420
+ xmlName: XML_NODE_NAME$q,
25421
+ sdNodeOrKeyName: SD_ATTR_KEY$c,
25475
25422
  attributes
25476
25423
  };
25477
25424
  };
25478
- const config$l = {
25479
- xmlName: XML_NODE_NAME$n,
25480
- sdNodeOrKeyName: SD_ATTR_KEY$b,
25425
+ const config$o = {
25426
+ xmlName: XML_NODE_NAME$q,
25427
+ sdNodeOrKeyName: SD_ATTR_KEY$c,
25481
25428
  type: NodeTranslator.translatorTypes.ATTRIBUTE,
25482
- encode: encode$J,
25429
+ encode: encode$M,
25483
25430
  attributes: validXmlAttributes$g
25484
25431
  };
25485
- const translator$$ = NodeTranslator.from(config$l);
25486
- const encode$I = (attributes) => attributes?.["w:val"];
25487
- const decode$C = (attrs) => attrs?.color;
25432
+ const translator$12 = NodeTranslator.from(config$o);
25433
+ const encode$L = (attributes) => attributes?.["w:val"];
25434
+ const decode$E = (attrs) => attrs?.color;
25488
25435
  const attrConfig$l = Object.freeze({
25489
25436
  xmlName: "w:val",
25490
25437
  sdName: "color",
25491
- encode: encode$I,
25492
- decode: decode$C
25438
+ encode: encode$L,
25439
+ decode: decode$E
25493
25440
  });
25494
- const encode$H = (attributes) => attributes?.["w:themeColor"];
25495
- const decode$B = (attrs) => attrs?.themeColor;
25441
+ const encode$K = (attributes) => attributes?.["w:themeColor"];
25442
+ const decode$D = (attrs) => attrs?.themeColor;
25496
25443
  const attrConfig$k = Object.freeze({
25497
25444
  xmlName: "w:themeColor",
25498
25445
  sdName: "themeColor",
25499
- encode: encode$H,
25500
- decode: decode$B
25446
+ encode: encode$K,
25447
+ decode: decode$D
25501
25448
  });
25502
- const encode$G = (attributes) => attributes?.["w:themeTint"];
25503
- const decode$A = (attrs) => attrs?.themeTint;
25449
+ const encode$J = (attributes) => attributes?.["w:themeTint"];
25450
+ const decode$C = (attrs) => attrs?.themeTint;
25504
25451
  const attrConfig$j = Object.freeze({
25505
25452
  xmlName: "w:themeTint",
25506
25453
  sdName: "themeTint",
25507
- encode: encode$G,
25508
- decode: decode$A
25454
+ encode: encode$J,
25455
+ decode: decode$C
25509
25456
  });
25510
- const encode$F = (attributes) => attributes?.["w:themeShade"];
25511
- const decode$z = (attrs) => attrs?.themeShade;
25457
+ const encode$I = (attributes) => attributes?.["w:themeShade"];
25458
+ const decode$B = (attrs) => attrs?.themeShade;
25512
25459
  const attrConfig$i = Object.freeze({
25513
25460
  xmlName: "w:themeShade",
25514
25461
  sdName: "themeShade",
25515
- encode: encode$F,
25516
- decode: decode$z
25462
+ encode: encode$I,
25463
+ decode: decode$B
25517
25464
  });
25518
25465
  const validXmlAttributes$f = [attrConfig$l, attrConfig$k, attrConfig$j, attrConfig$i];
25519
- const XML_NODE_NAME$m = "w:color";
25520
- const SD_ATTR_KEY$a = "color";
25521
- const encode$E = (params2, encodedAttrs = {}) => {
25466
+ const XML_NODE_NAME$p = "w:color";
25467
+ const SD_ATTR_KEY$b = "color";
25468
+ const encode$H = (params2, encodedAttrs = {}) => {
25522
25469
  const { nodes } = params2;
25523
25470
  const node = nodes?.[0];
25524
25471
  const sourceAttrs = node?.attributes || {};
@@ -25533,63 +25480,63 @@ const encode$E = (params2, encodedAttrs = {}) => {
25533
25480
  if (themeShade !== void 0 && themeShade !== null) attributes["w:themeShade"] = themeShade;
25534
25481
  return {
25535
25482
  type: "attr",
25536
- xmlName: XML_NODE_NAME$m,
25537
- sdNodeOrKeyName: SD_ATTR_KEY$a,
25483
+ xmlName: XML_NODE_NAME$p,
25484
+ sdNodeOrKeyName: SD_ATTR_KEY$b,
25538
25485
  attributes
25539
25486
  };
25540
25487
  };
25541
- const config$k = {
25542
- xmlName: XML_NODE_NAME$m,
25543
- sdNodeOrKeyName: SD_ATTR_KEY$a,
25488
+ const config$n = {
25489
+ xmlName: XML_NODE_NAME$p,
25490
+ sdNodeOrKeyName: SD_ATTR_KEY$b,
25544
25491
  type: NodeTranslator.translatorTypes.ATTRIBUTE,
25545
- encode: encode$E,
25492
+ encode: encode$H,
25546
25493
  attributes: validXmlAttributes$f
25547
25494
  };
25548
- const translator$_ = NodeTranslator.from(config$k);
25549
- const encode$D = (attributes) => attributes?.["w:eastAsia"];
25550
- const decode$y = (attrs) => attrs?.eastAsia;
25495
+ const translator$11 = NodeTranslator.from(config$n);
25496
+ const encode$G = (attributes) => attributes?.["w:eastAsia"];
25497
+ const decode$A = (attrs) => attrs?.eastAsia;
25551
25498
  const attrConfig$h = Object.freeze({
25552
25499
  xmlName: "w:eastAsia",
25553
25500
  sdName: "eastAsia",
25554
- encode: encode$D,
25555
- decode: decode$y
25501
+ encode: encode$G,
25502
+ decode: decode$A
25556
25503
  });
25557
- const encode$C = (attributes) => attributes?.["w:ascii"];
25558
- const decode$x = (attrs) => attrs?.ascii;
25504
+ const encode$F = (attributes) => attributes?.["w:ascii"];
25505
+ const decode$z = (attrs) => attrs?.ascii;
25559
25506
  const attrConfig$g = Object.freeze({
25560
25507
  xmlName: "w:ascii",
25561
25508
  sdName: "ascii",
25562
- encode: encode$C,
25563
- decode: decode$x
25509
+ encode: encode$F,
25510
+ decode: decode$z
25564
25511
  });
25565
- const encode$B = (attributes) => attributes?.["w:hAnsi"];
25566
- const decode$w = (attrs) => attrs?.hAnsi;
25512
+ const encode$E = (attributes) => attributes?.["w:hAnsi"];
25513
+ const decode$y = (attrs) => attrs?.hAnsi;
25567
25514
  const attrConfig$f = Object.freeze({
25568
25515
  xmlName: "w:hAnsi",
25569
25516
  sdName: "hAnsi",
25570
- encode: encode$B,
25571
- decode: decode$w
25517
+ encode: encode$E,
25518
+ decode: decode$y
25572
25519
  });
25573
- const encode$A = (attributes) => attributes?.["w:cs"];
25574
- const decode$v = (attrs) => attrs?.cs;
25520
+ const encode$D = (attributes) => attributes?.["w:cs"];
25521
+ const decode$x = (attrs) => attrs?.cs;
25575
25522
  const attrConfig$e = Object.freeze({
25576
25523
  xmlName: "w:cs",
25577
25524
  sdName: "cs",
25578
- encode: encode$A,
25579
- decode: decode$v
25525
+ encode: encode$D,
25526
+ decode: decode$x
25580
25527
  });
25581
- const encode$z = (attributes) => attributes?.["w:val"];
25582
- const decode$u = (attrs) => attrs?.value;
25528
+ const encode$C = (attributes) => attributes?.["w:val"];
25529
+ const decode$w = (attrs) => attrs?.value;
25583
25530
  const attrConfig$d = Object.freeze({
25584
25531
  xmlName: "w:val",
25585
25532
  sdName: "value",
25586
- encode: encode$z,
25587
- decode: decode$u
25533
+ encode: encode$C,
25534
+ decode: decode$w
25588
25535
  });
25589
25536
  const validXmlAttributes$e = [attrConfig$h, attrConfig$g, attrConfig$f, attrConfig$e, attrConfig$d];
25590
- const XML_NODE_NAME$l = "w:rFonts";
25591
- const SD_ATTR_KEY$9 = "fontFamily";
25592
- const encode$y = (params2, encodedAttrs = {}) => {
25537
+ const XML_NODE_NAME$o = "w:rFonts";
25538
+ const SD_ATTR_KEY$a = "fontFamily";
25539
+ const encode$B = (params2, encodedAttrs = {}) => {
25593
25540
  const { nodes } = params2;
25594
25541
  const node = nodes?.[0];
25595
25542
  const sourceAttrs = node?.attributes || {};
@@ -25615,120 +25562,281 @@ const encode$y = (params2, encodedAttrs = {}) => {
25615
25562
  if (attributes["w:val"] === void 0) delete attributes["w:val"];
25616
25563
  return {
25617
25564
  type: "attr",
25618
- xmlName: XML_NODE_NAME$l,
25619
- sdNodeOrKeyName: SD_ATTR_KEY$9,
25565
+ xmlName: XML_NODE_NAME$o,
25566
+ sdNodeOrKeyName: SD_ATTR_KEY$a,
25620
25567
  attributes
25621
25568
  };
25622
25569
  };
25623
- const config$j = {
25624
- xmlName: XML_NODE_NAME$l,
25625
- sdNodeOrKeyName: SD_ATTR_KEY$9,
25570
+ const config$m = {
25571
+ xmlName: XML_NODE_NAME$o,
25572
+ sdNodeOrKeyName: SD_ATTR_KEY$a,
25626
25573
  type: NodeTranslator.translatorTypes.ATTRIBUTE,
25627
- encode: encode$y,
25574
+ encode: encode$B,
25628
25575
  attributes: validXmlAttributes$e
25629
25576
  };
25630
- const translator$Z = NodeTranslator.from(config$j);
25631
- const encode$x = (attributes) => attributes?.["w:val"];
25632
- const decode$t = (attrs) => attrs?.styleId;
25577
+ const translator$10 = NodeTranslator.from(config$m);
25578
+ const encode$A = (attributes) => attributes?.["w:val"];
25579
+ const decode$v = (attrs) => attrs?.styleId;
25633
25580
  const attrConfig$c = Object.freeze({
25634
25581
  xmlName: "w:val",
25635
25582
  sdName: "styleId",
25636
- encode: encode$x,
25637
- decode: decode$t
25583
+ encode: encode$A,
25584
+ decode: decode$v
25638
25585
  });
25639
25586
  const validXmlAttributes$d = [attrConfig$c];
25640
- const XML_NODE_NAME$k = "w:rStyle";
25641
- const SD_ATTR_KEY$8 = "styleId";
25642
- const encode$w = (params2, encodedAttrs = {}) => {
25587
+ const XML_NODE_NAME$n = "w:rStyle";
25588
+ const SD_ATTR_KEY$9 = "styleId";
25589
+ const encode$z = (params2, encodedAttrs = {}) => {
25643
25590
  const { nodes } = params2;
25644
25591
  const node = nodes?.[0];
25645
25592
  const value = encodedAttrs.styleId ?? node?.attributes?.["w:val"];
25646
25593
  return {
25647
25594
  type: "attr",
25648
- xmlName: XML_NODE_NAME$k,
25649
- sdNodeOrKeyName: SD_ATTR_KEY$8,
25595
+ xmlName: XML_NODE_NAME$n,
25596
+ sdNodeOrKeyName: SD_ATTR_KEY$9,
25650
25597
  attributes: { "w:val": value ?? null }
25651
25598
  };
25652
25599
  };
25653
- const config$i = {
25654
- xmlName: XML_NODE_NAME$k,
25655
- sdNodeOrKeyName: SD_ATTR_KEY$8,
25600
+ const config$l = {
25601
+ xmlName: XML_NODE_NAME$n,
25602
+ sdNodeOrKeyName: SD_ATTR_KEY$9,
25656
25603
  type: NodeTranslator.translatorTypes.ATTRIBUTE,
25657
- encode: encode$w,
25604
+ encode: encode$z,
25658
25605
  attributes: validXmlAttributes$d
25659
25606
  };
25660
- const translator$Y = NodeTranslator.from(config$i);
25661
- const encode$v = (attributes) => attributes?.["w:val"];
25662
- const decode$s = (attrs) => attrs?.fontSize;
25607
+ const translator$$ = NodeTranslator.from(config$l);
25608
+ const encode$y = (attributes) => attributes?.["w:val"];
25609
+ const decode$u = (attrs) => attrs?.fontSize;
25663
25610
  const attrConfig$b = Object.freeze({
25664
25611
  xmlName: "w:val",
25665
25612
  sdName: "fontSize",
25666
- encode: encode$v,
25667
- decode: decode$s
25613
+ encode: encode$y,
25614
+ decode: decode$u
25668
25615
  });
25669
25616
  const validXmlAttributes$c = [attrConfig$b];
25670
- const XML_NODE_NAME$j = "w:sz";
25671
- const SD_ATTR_KEY$7 = "fontSize";
25672
- const encode$u = (params2, encodedAttrs = {}) => {
25617
+ const XML_NODE_NAME$m = "w:sz";
25618
+ const SD_ATTR_KEY$8 = "fontSize";
25619
+ const encode$x = (params2, encodedAttrs = {}) => {
25673
25620
  const { nodes } = params2;
25674
25621
  const node = nodes?.[0];
25675
25622
  const value = encodedAttrs.fontSize ?? node?.attributes?.["w:val"];
25676
25623
  return {
25677
25624
  type: "attr",
25678
- xmlName: XML_NODE_NAME$j,
25679
- sdNodeOrKeyName: SD_ATTR_KEY$7,
25625
+ xmlName: XML_NODE_NAME$m,
25626
+ sdNodeOrKeyName: SD_ATTR_KEY$8,
25680
25627
  attributes: { "w:val": value ?? null }
25681
25628
  };
25682
25629
  };
25683
- const config$h = {
25684
- xmlName: XML_NODE_NAME$j,
25685
- sdNodeOrKeyName: SD_ATTR_KEY$7,
25630
+ const config$k = {
25631
+ xmlName: XML_NODE_NAME$m,
25632
+ sdNodeOrKeyName: SD_ATTR_KEY$8,
25686
25633
  type: NodeTranslator.translatorTypes.ATTRIBUTE,
25687
- encode: encode$u,
25634
+ encode: encode$x,
25688
25635
  attributes: validXmlAttributes$c
25689
25636
  };
25690
- const translator$X = NodeTranslator.from(config$h);
25691
- const encode$t = (attributes) => attributes?.["w:val"];
25692
- const decode$r = (attrs) => attrs?.fontSizeCs;
25637
+ const translator$_ = NodeTranslator.from(config$k);
25638
+ const encode$w = (attributes) => attributes?.["w:val"];
25639
+ const decode$t = (attrs) => attrs?.fontSizeCs;
25693
25640
  const attrConfig$a = Object.freeze({
25694
25641
  xmlName: "w:val",
25695
25642
  sdName: "fontSizeCs",
25696
- encode: encode$t,
25697
- decode: decode$r
25643
+ encode: encode$w,
25644
+ decode: decode$t
25698
25645
  });
25699
25646
  const validXmlAttributes$b = [attrConfig$a];
25700
- const XML_NODE_NAME$i = "w:szCs";
25701
- const SD_ATTR_KEY$6 = "fontSizeCs";
25702
- const encode$s = (params2, encodedAttrs = {}) => {
25647
+ const XML_NODE_NAME$l = "w:szCs";
25648
+ const SD_ATTR_KEY$7 = "fontSizeCs";
25649
+ const encode$v = (params2, encodedAttrs = {}) => {
25703
25650
  const { nodes } = params2;
25704
25651
  const node = nodes?.[0];
25705
25652
  const value = encodedAttrs.fontSizeCs ?? node?.attributes?.["w:val"];
25706
25653
  return {
25707
25654
  type: "attr",
25708
- xmlName: XML_NODE_NAME$i,
25709
- sdNodeOrKeyName: SD_ATTR_KEY$6,
25655
+ xmlName: XML_NODE_NAME$l,
25656
+ sdNodeOrKeyName: SD_ATTR_KEY$7,
25710
25657
  attributes: { "w:val": value ?? null }
25711
25658
  };
25712
25659
  };
25713
- const config$g = {
25714
- xmlName: XML_NODE_NAME$i,
25715
- sdNodeOrKeyName: SD_ATTR_KEY$6,
25660
+ const config$j = {
25661
+ xmlName: XML_NODE_NAME$l,
25662
+ sdNodeOrKeyName: SD_ATTR_KEY$7,
25716
25663
  type: NodeTranslator.translatorTypes.ATTRIBUTE,
25717
- encode: encode$s,
25664
+ encode: encode$v,
25718
25665
  attributes: validXmlAttributes$b
25719
25666
  };
25720
- const translator$W = NodeTranslator.from(config$g);
25667
+ const translator$Z = NodeTranslator.from(config$j);
25668
+ const generateV2HandlerEntity = (handlerName, translator2) => ({
25669
+ handlerName,
25670
+ handler: (params2) => {
25671
+ const { nodes } = params2;
25672
+ if (nodes.length === 0 || nodes[0].name !== translator2.xmlName) {
25673
+ return { nodes: [], consumed: 0 };
25674
+ }
25675
+ const result = translator2.encode(params2);
25676
+ if (!result) return { nodes: [], consumed: 0 };
25677
+ return {
25678
+ nodes: Array.isArray(result) ? result : [result],
25679
+ consumed: 1
25680
+ };
25681
+ }
25682
+ });
25683
+ function createSingleAttrPropertyHandler(xmlName, sdName = null, attrName = "w:val", transformEncode = null, transformDecode = null) {
25684
+ if (!sdName) sdName = xmlName.split(":")[1];
25685
+ if (!transformEncode) transformEncode = (v2) => v2;
25686
+ if (!transformDecode) transformDecode = (v2) => v2;
25687
+ return {
25688
+ xmlName,
25689
+ sdNodeOrKeyName: sdName,
25690
+ encode: ({ nodes }) => {
25691
+ return transformEncode(nodes[0].attributes[attrName]) ?? void 0;
25692
+ },
25693
+ decode: ({ node }) => {
25694
+ const value = node.attrs?.[sdName] != null ? transformDecode(node.attrs[sdName]) : void 0;
25695
+ return value != null ? { name: xmlName, attributes: { [attrName]: value } } : void 0;
25696
+ }
25697
+ };
25698
+ }
25699
+ function createMeasurementPropertyHandler(xmlName, sdName = null) {
25700
+ if (!sdName) sdName = xmlName.split(":")[1];
25701
+ return {
25702
+ xmlName,
25703
+ sdNodeOrKeyName: sdName,
25704
+ attributes: [
25705
+ createAttributeHandler("w:w", "value", parseInteger, integerToString),
25706
+ createAttributeHandler("w:type")
25707
+ ],
25708
+ encode: (_2, encodedAttrs) => {
25709
+ return encodedAttrs["value"] != null ? encodedAttrs : void 0;
25710
+ },
25711
+ decode: function({ node }) {
25712
+ const decodedAttrs = this.decodeAttributes({ node: { ...node, attrs: node.attrs[sdName] || {} } });
25713
+ return decodedAttrs["w:w"] != null ? { attributes: decodedAttrs } : void 0;
25714
+ }
25715
+ };
25716
+ }
25717
+ function createBorderPropertyHandler(xmlName, sdName = null) {
25718
+ if (!sdName) sdName = xmlName.split(":")[1];
25719
+ return {
25720
+ xmlName,
25721
+ sdNodeOrKeyName: sdName,
25722
+ attributes: [
25723
+ createAttributeHandler("w:val"),
25724
+ createAttributeHandler("w:color"),
25725
+ createAttributeHandler("w:themeColor"),
25726
+ createAttributeHandler("w:themeTint"),
25727
+ createAttributeHandler("w:themeShade"),
25728
+ createAttributeHandler("w:sz", "size", parseInteger, integerToString),
25729
+ createAttributeHandler("w:space", null, parseInteger, integerToString),
25730
+ createAttributeHandler("w:shadow", null, parseBoolean, booleanToString),
25731
+ createAttributeHandler("w:frame", null, parseBoolean, booleanToString)
25732
+ ],
25733
+ encode: (params2, encodedAttrs) => {
25734
+ return Object.keys(encodedAttrs).length > 0 ? encodedAttrs : void 0;
25735
+ },
25736
+ decode: function({ node }, context) {
25737
+ const decodedAttrs = this.decodeAttributes({ node: { ...node, attrs: node.attrs[sdName] || {} } });
25738
+ return Object.keys(decodedAttrs).length > 0 ? { attributes: decodedAttrs } : void 0;
25739
+ }
25740
+ };
25741
+ }
25742
+ const createAttributeHandler = (xmlName, sdName = null, transformEncode = null, transformDecode = null) => {
25743
+ if (!transformEncode) transformEncode = (v2) => v2;
25744
+ if (!transformDecode) transformDecode = (v2) => v2;
25745
+ if (!sdName) sdName = xmlName.split(":")[1];
25746
+ return {
25747
+ xmlName,
25748
+ sdName,
25749
+ encode: (attributes) => transformEncode(attributes[xmlName]),
25750
+ decode: (attributes) => transformDecode(attributes[sdName])
25751
+ };
25752
+ };
25753
+ function encodeProperties(node, translatorsByXmlName, asArray = false) {
25754
+ if (!node?.elements || node.elements.length === 0) {
25755
+ return asArray ? [] : {};
25756
+ }
25757
+ const attributes = asArray ? [] : {};
25758
+ node.elements.forEach((el) => {
25759
+ const translator2 = translatorsByXmlName[el.name];
25760
+ if (translator2) {
25761
+ const encodedAttr = translator2.encode({ nodes: [el] });
25762
+ if (encodedAttr != null) {
25763
+ if (asArray) {
25764
+ attributes.push({ [translator2.sdNodeOrKeyName]: encodedAttr });
25765
+ } else {
25766
+ attributes[translator2.sdNodeOrKeyName] = encodedAttr;
25767
+ }
25768
+ }
25769
+ }
25770
+ });
25771
+ return attributes;
25772
+ }
25773
+ function decodeProperties(translatorsBySdName, properties) {
25774
+ if (!properties || typeof properties !== "object") {
25775
+ return [];
25776
+ }
25777
+ const elements = [];
25778
+ Object.keys(properties).forEach((key2) => {
25779
+ const translator2 = translatorsBySdName[key2];
25780
+ if (translator2) {
25781
+ const result = translator2.decode({ node: { attrs: { [key2]: properties[key2] } } });
25782
+ if (result != null) {
25783
+ result.name = translator2.xmlName;
25784
+ elements.push(result);
25785
+ }
25786
+ }
25787
+ });
25788
+ return elements;
25789
+ }
25790
+ const parseBoolean = (value) => value != null ? ["1", "true"].includes(value) : void 0;
25791
+ const booleanToString = (value) => value != null ? value ? "1" : "0" : void 0;
25792
+ const parseInteger = (value) => {
25793
+ if (value == null) return void 0;
25794
+ const intValue = parseInt(value, 10);
25795
+ return isNaN(intValue) ? void 0 : intValue;
25796
+ };
25797
+ const integerToString = (value) => {
25798
+ const intValue = parseInteger(value);
25799
+ return intValue != void 0 ? String(intValue) : void 0;
25800
+ };
25801
+ const XML_NODE_NAME$k = "w:caps";
25802
+ const SD_ATTR_KEY$6 = "textTransform";
25803
+ const encode$u = (params2, encodedAttrs = {}) => {
25804
+ const { nodes } = params2;
25805
+ const node = nodes[0];
25806
+ if (!node) return void 0;
25807
+ let result;
25808
+ if (!["false", "0"].includes(encodedAttrs.val)) {
25809
+ result = "uppercase";
25810
+ } else {
25811
+ return void 0;
25812
+ }
25813
+ return {
25814
+ type: "attr",
25815
+ xmlName: XML_NODE_NAME$k,
25816
+ sdNodeOrKeyName: SD_ATTR_KEY$6,
25817
+ attributes: { [SD_ATTR_KEY$6]: result }
25818
+ };
25819
+ };
25820
+ const config$i = {
25821
+ xmlName: XML_NODE_NAME$k,
25822
+ sdNodeOrKeyName: SD_ATTR_KEY$6,
25823
+ type: NodeTranslator.translatorTypes.ATTRIBUTE,
25824
+ encode: encode$u,
25825
+ attributes: [createAttributeHandler("w:val")]
25826
+ };
25827
+ const translator$Y = NodeTranslator.from(config$i);
25721
25828
  const runPropertyTranslators = Object.freeze({
25722
- "w:b": translator$12,
25723
- "w:i": translator$11,
25724
- "w:u": translator$10,
25725
- "w:strike": translator$$,
25726
- "w:color": translator$_,
25727
- "w:highlight": translator$15,
25728
- "w:rFonts": translator$Z,
25729
- "w:rStyle": translator$Y,
25730
- "w:sz": translator$X,
25731
- "w:szCs": translator$W
25829
+ "w:b": translator$15,
25830
+ "w:i": translator$14,
25831
+ "w:u": translator$13,
25832
+ "w:strike": translator$12,
25833
+ "w:color": translator$11,
25834
+ "w:highlight": translator$18,
25835
+ "w:rFonts": translator$10,
25836
+ "w:rStyle": translator$$,
25837
+ "w:sz": translator$_,
25838
+ "w:szCs": translator$Z,
25839
+ "w:caps": translator$Y
25732
25840
  });
25733
25841
  const rawRunPropertyXmlNames = Object.freeze(["w:lang", "w:shd"]);
25734
25842
  const RAW_CHILD_NAME_SET = new Set(rawRunPropertyXmlNames);
@@ -25742,9 +25850,9 @@ const toRunPropertyEntry = (candidate) => {
25742
25850
  attributes: { ...candidate.attributes || {} }
25743
25851
  };
25744
25852
  };
25745
- const XML_NODE_NAME$h = "w:rPr";
25853
+ const XML_NODE_NAME$j = "w:rPr";
25746
25854
  const SD_ATTR_KEY$5 = "runProperties";
25747
- const encode$r = (params2) => {
25855
+ const encode$t = (params2) => {
25748
25856
  const { nodes } = params2;
25749
25857
  const node = nodes?.[0] || {};
25750
25858
  const contents = Array.isArray(node.elements) ? node.elements : [];
@@ -25778,16 +25886,16 @@ const encode$r = (params2) => {
25778
25886
  attributes: runPropsArray
25779
25887
  };
25780
25888
  };
25781
- const config$f = {
25782
- xmlName: XML_NODE_NAME$h,
25889
+ const config$h = {
25890
+ xmlName: XML_NODE_NAME$j,
25783
25891
  sdNodeOrKeyName: SD_ATTR_KEY$5,
25784
25892
  type: NodeTranslator.translatorTypes.ATTRIBUTE,
25785
- encode: encode$r
25893
+ encode: encode$t
25786
25894
  };
25787
- const translator$V = NodeTranslator.from(config$f);
25895
+ const translator$X = NodeTranslator.from(config$h);
25788
25896
  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;
25789
25897
  const containsEastAsianCharacters = (text) => EAST_ASIAN_CHARACTER_REGEX.test(text);
25790
- const collectRunProperties = (params2, rPrNode, translator2 = translator$V) => {
25898
+ const collectRunProperties = (params2, rPrNode, translator2 = translator$X) => {
25791
25899
  if (!rPrNode) return { entries: [], hadRPr: false, styleChangeMarks: [] };
25792
25900
  const result = translator2.encode({ ...params2, nodes: [rPrNode] }) || {};
25793
25901
  let entries = [];
@@ -25856,7 +25964,10 @@ const applyRunMarks = (node, inlineMarks, textStyleAttrs) => {
25856
25964
  };
25857
25965
  const deriveStyleMarks = ({ docx, paragraphStyleId, runStyleId }) => {
25858
25966
  const paragraphStyleMarks = collectStyleMarks(paragraphStyleId, docx);
25859
- const runStyleMarks = collectStyleMarks(runStyleId, docx);
25967
+ if (paragraphStyleId?.startsWith("TOC")) {
25968
+ return paragraphStyleMarks;
25969
+ }
25970
+ let runStyleMarks = collectStyleMarks(runStyleId, docx);
25860
25971
  const inlineMarks = mergeInlineMarkSets(paragraphStyleMarks.inlineMarks, runStyleMarks.inlineMarks);
25861
25972
  const textStyleAttrs = mergeTextStyleAttrs(paragraphStyleMarks.textStyleAttrs, runStyleMarks.textStyleAttrs);
25862
25973
  return { inlineMarks, textStyleAttrs };
@@ -26082,6 +26193,13 @@ const splitRunProperties = (entries = [], docx = null) => {
26082
26193
  }
26083
26194
  break;
26084
26195
  }
26196
+ case "w:caps": {
26197
+ if (attributes["textTransform"] != null) {
26198
+ hasTextStyle = true;
26199
+ textStyleAttrs.textTransform = attributes["textTransform"];
26200
+ }
26201
+ break;
26202
+ }
26085
26203
  case "w:rFonts": {
26086
26204
  const asciiFamily = attributes["w:ascii"] || attributes["w:hAnsi"] || (attributes["w:eastAsia"] ? void 0 : attributes["w:val"]);
26087
26205
  const eastAsiaFamily = attributes["w:eastAsia"];
@@ -26101,9 +26219,10 @@ const splitRunProperties = (entries = [], docx = null) => {
26101
26219
  case "w:sz":
26102
26220
  case "w:szCs": {
26103
26221
  const rawSize = Number(attributes["w:val"]);
26222
+ const attrName = entry.xmlName === "w:sz" ? "fontSize" : "fontSizeCs";
26104
26223
  if (Number.isFinite(rawSize) && rawSize > 0) {
26105
26224
  hasTextStyle = true;
26106
- textStyleAttrs.fontSize = `${rawSize / 2}pt`;
26225
+ textStyleAttrs[attrName] = `${rawSize / 2}pt`;
26107
26226
  }
26108
26227
  break;
26109
26228
  }
@@ -26249,46 +26368,166 @@ const ensureTrackedWrapper = (runs, trackingMarksByType = /* @__PURE__ */ new Ma
26249
26368
  }
26250
26369
  return runs;
26251
26370
  };
26252
- const encode$q = (attributes) => {
26371
+ const XML_NODE_NAME$i = "w:hyperlink";
26372
+ const SD_NODE_NAME$c = "link";
26373
+ const _createAttributeHandler = (xmlName, sdName) => ({
26374
+ xmlName,
26375
+ sdName,
26376
+ encode: (attributes) => attributes[xmlName],
26377
+ decode: (attributes) => attributes[sdName]
26378
+ });
26379
+ const validXmlAttributes$a = [
26380
+ _createAttributeHandler("w:anchor", "anchor"),
26381
+ _createAttributeHandler("w:docLocation", "docLocation"),
26382
+ {
26383
+ xmlName: "w:history",
26384
+ sdName: "history",
26385
+ encode: (attributes) => attributes["w:history"] === "1" || attributes["w:history"] === "true",
26386
+ decode: (attributes) => attributes["history"] ? "1" : "0"
26387
+ },
26388
+ _createAttributeHandler("w:tooltip", "tooltip"),
26389
+ _createAttributeHandler("r:id", "rId"),
26390
+ _createAttributeHandler("w:tgtFrame", "target")
26391
+ ];
26392
+ const encode$s = (params2, encodedAttrs) => {
26393
+ const { nodes, docx, nodeListHandler } = params2;
26394
+ const node = nodes[0];
26395
+ let href = _resolveHref(docx, encodedAttrs);
26396
+ const linkMark = { type: "link", attrs: { ...encodedAttrs, href } };
26397
+ const referenceNodeTypes = ["sd:pageReference", "sd:autoPageNumber", "sd:totalPageNumber"];
26398
+ const contentNodes = node.elements.filter((el) => el.name === "w:r" || referenceNodeTypes.includes(el.name));
26399
+ contentNodes.forEach((contentNode) => {
26400
+ const existingMarks = Array.isArray(contentNode.marks) ? contentNode.marks : [];
26401
+ const marksWithoutLink = existingMarks.filter((mark) => mark?.type !== "link");
26402
+ contentNode.marks = [...marksWithoutLink, linkMark];
26403
+ });
26404
+ const updatedNode = nodeListHandler.handler({
26405
+ ...params2,
26406
+ nodes: contentNodes,
26407
+ path: [...params2.path || [], node]
26408
+ });
26409
+ return updatedNode;
26410
+ };
26411
+ const _resolveHref = (docx, encodedAttrs) => {
26412
+ const rels = docx["word/_rels/document.xml.rels"];
26413
+ const relationships = rels.elements.find((el) => el.name === "Relationships");
26414
+ const { elements } = relationships;
26415
+ const { rId, anchor } = encodedAttrs;
26416
+ let href;
26417
+ if (!rId && anchor) {
26418
+ href = `#${anchor}`;
26419
+ } else if (rId) {
26420
+ const rel = elements.find((el) => el.attributes["Id"] === rId) || {};
26421
+ const { attributes: relAttributes = {} } = rel;
26422
+ href = relAttributes["Target"];
26423
+ }
26424
+ return href;
26425
+ };
26426
+ function decode$s(params2) {
26427
+ const { hyperlinkGroup = [params2.node] } = params2.extraParams || {};
26428
+ const node = hyperlinkGroup[0];
26429
+ const linkMark = node.marks.find((m2) => m2.type === "link");
26430
+ const linkAttrs = this.decodeAttributes({ ...params2, node: linkMark });
26431
+ let { anchor, href: link } = linkMark.attrs;
26432
+ const isExternalLink = !anchor;
26433
+ if (isExternalLink) {
26434
+ linkAttrs["r:id"] = _addNewLinkRelationship(params2, link, linkAttrs["r:id"]);
26435
+ }
26436
+ let contentNodes = [];
26437
+ hyperlinkGroup.forEach((linkNode) => {
26438
+ if ("marks" in linkNode) {
26439
+ linkNode.marks = linkNode.marks.filter((m2) => m2.type !== "link");
26440
+ } else {
26441
+ linkNode.attrs.marksAsAttrs = linkNode.attrs.marksAsAttrs.filter((m2) => m2.type !== "link");
26442
+ }
26443
+ const outputNode = exportSchemaToJson({ ...params2, node: linkNode });
26444
+ if (outputNode) {
26445
+ if (outputNode instanceof Array) contentNodes.push(...outputNode);
26446
+ else contentNodes.push(outputNode);
26447
+ }
26448
+ });
26449
+ const newNode = {
26450
+ name: "w:hyperlink",
26451
+ type: "element",
26452
+ attributes: {
26453
+ ...linkAttrs
26454
+ },
26455
+ elements: contentNodes
26456
+ };
26457
+ return newNode;
26458
+ }
26459
+ function _addNewLinkRelationship(params2, link, rId) {
26460
+ if (!rId) rId = generateDocxRandomId();
26461
+ if (!params2.relationships || !Array.isArray(params2.relationships)) {
26462
+ params2.relationships = [];
26463
+ }
26464
+ const existingRel = params2.relationships.find(
26465
+ (rel) => rel.attributes && rel.attributes.Id === rId && rel.attributes.Target === link
26466
+ );
26467
+ if (existingRel) {
26468
+ return rId;
26469
+ }
26470
+ params2.relationships.push({
26471
+ type: "element",
26472
+ name: "Relationship",
26473
+ attributes: {
26474
+ Id: rId,
26475
+ Type: "http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink",
26476
+ Target: link,
26477
+ TargetMode: "External"
26478
+ }
26479
+ });
26480
+ return rId;
26481
+ }
26482
+ const config$g = {
26483
+ xmlName: XML_NODE_NAME$i,
26484
+ sdNodeOrKeyName: SD_NODE_NAME$c,
26485
+ type: NodeTranslator.translatorTypes.NODE,
26486
+ encode: encode$s,
26487
+ decode: decode$s,
26488
+ attributes: validXmlAttributes$a
26489
+ };
26490
+ const translator$W = NodeTranslator.from(config$g);
26491
+ const encode$r = (attributes) => {
26253
26492
  return attributes["w:rsidR"];
26254
26493
  };
26255
- const decode$q = (attrs) => {
26494
+ const decode$r = (attrs) => {
26256
26495
  return attrs.rsidR;
26257
26496
  };
26258
26497
  const attrConfig$9 = Object.freeze({
26259
26498
  xmlName: "w:rsidR",
26260
26499
  sdName: "rsidR",
26261
- encode: encode$q,
26262
- decode: decode$q
26500
+ encode: encode$r,
26501
+ decode: decode$r
26263
26502
  });
26264
- const encode$p = (attributes) => {
26503
+ const encode$q = (attributes) => {
26265
26504
  return attributes["w:rsidRPr"];
26266
26505
  };
26267
- const decode$p = (attrs) => {
26506
+ const decode$q = (attrs) => {
26268
26507
  return attrs.rsidRPr;
26269
26508
  };
26270
26509
  const attrConfig$8 = Object.freeze({
26271
26510
  xmlName: "w:rsidRPr",
26272
26511
  sdName: "rsidRPr",
26273
- encode: encode$p,
26274
- decode: decode$p
26512
+ encode: encode$q,
26513
+ decode: decode$q
26275
26514
  });
26276
- const encode$o = (attributes) => {
26515
+ const encode$p = (attributes) => {
26277
26516
  return attributes["w:rsidDel"];
26278
26517
  };
26279
- const decode$o = (attrs) => {
26518
+ const decode$p = (attrs) => {
26280
26519
  return attrs.rsidDel;
26281
26520
  };
26282
26521
  const attrConfig$7 = Object.freeze({
26283
26522
  xmlName: "w:rsidDel",
26284
26523
  sdName: "rsidDel",
26285
- encode: encode$o,
26286
- decode: decode$o
26524
+ encode: encode$p,
26525
+ decode: decode$p
26287
26526
  });
26288
- const validXmlAttributes$a = [attrConfig$9, attrConfig$8, attrConfig$7];
26289
- const XML_NODE_NAME$g = "w:r";
26527
+ const validXmlAttributes$9 = [attrConfig$9, attrConfig$8, attrConfig$7];
26528
+ const XML_NODE_NAME$h = "w:r";
26290
26529
  const SD_KEY_NAME = "run";
26291
- const encode$n = (params2, encodedAttrs = {}) => {
26530
+ const encode$o = (params2, encodedAttrs = {}) => {
26292
26531
  const { nodes = [], nodeListHandler } = params2 || {};
26293
26532
  const runNode = nodes[0];
26294
26533
  if (!runNode) return void 0;
@@ -26336,9 +26575,11 @@ const encode$n = (params2, encodedAttrs = {}) => {
26336
26575
  }
26337
26576
  return runNodeResult;
26338
26577
  };
26339
- const decode$n = (params2, decodedAttrs = {}) => {
26578
+ const decode$o = (params2, decodedAttrs = {}) => {
26340
26579
  const { node } = params2 || {};
26341
26580
  if (!node) return void 0;
26581
+ const isLinkNode = node.marks?.some((m2) => m2.type === "link");
26582
+ if (isLinkNode) return translator$W.decode(params2);
26342
26583
  const { runNode: runNodeForExport, trackingMarksByType } = prepareRunTrackingContext(node);
26343
26584
  const runAttrs = runNodeForExport.attrs || {};
26344
26585
  const runProperties = Array.isArray(runAttrs.runProperties) ? runAttrs.runProperties : [];
@@ -26393,7 +26634,7 @@ const decode$n = (params2, decodedAttrs = {}) => {
26393
26634
  runs.push(trackedClone);
26394
26635
  return;
26395
26636
  }
26396
- const runWrapper = { name: XML_NODE_NAME$g, elements: [] };
26637
+ const runWrapper = { name: XML_NODE_NAME$h, elements: [] };
26397
26638
  applyBaseRunProps(runWrapper);
26398
26639
  if (!Array.isArray(runWrapper.elements)) runWrapper.elements = [];
26399
26640
  runWrapper.elements.push(cloneXmlNode(child));
@@ -26401,7 +26642,7 @@ const decode$n = (params2, decodedAttrs = {}) => {
26401
26642
  });
26402
26643
  const trackedRuns = ensureTrackedWrapper(runs, trackingMarksByType);
26403
26644
  if (!trackedRuns.length) {
26404
- const emptyRun = { name: XML_NODE_NAME$g, elements: [] };
26645
+ const emptyRun = { name: XML_NODE_NAME$h, elements: [] };
26405
26646
  applyBaseRunProps(emptyRun);
26406
26647
  trackedRuns.push(emptyRun);
26407
26648
  }
@@ -26415,148 +26656,15 @@ const decode$n = (params2, decodedAttrs = {}) => {
26415
26656
  }
26416
26657
  return trackedRuns;
26417
26658
  };
26418
- const config$e = {
26419
- xmlName: XML_NODE_NAME$g,
26659
+ const config$f = {
26660
+ xmlName: XML_NODE_NAME$h,
26420
26661
  sdNodeOrKeyName: SD_KEY_NAME,
26421
26662
  type: NodeTranslator.translatorTypes.NODE,
26422
- encode: encode$n,
26423
- decode: decode$n,
26424
- attributes: validXmlAttributes$a
26425
- };
26426
- const translator$U = NodeTranslator.from(config$e);
26427
- const generateV2HandlerEntity = (handlerName, translator2) => ({
26428
- handlerName,
26429
- handler: (params2) => {
26430
- const { nodes } = params2;
26431
- if (nodes.length === 0 || nodes[0].name !== translator2.xmlName) {
26432
- return { nodes: [], consumed: 0 };
26433
- }
26434
- const result = translator2.encode(params2);
26435
- if (!result) return { nodes: [], consumed: 0 };
26436
- return {
26437
- nodes: Array.isArray(result) ? result : [result],
26438
- consumed: 1
26439
- };
26440
- }
26441
- });
26442
- function createSingleAttrPropertyHandler(xmlName, sdName = null, attrName = "w:val", transformEncode = null, transformDecode = null) {
26443
- if (!sdName) sdName = xmlName.split(":")[1];
26444
- if (!transformEncode) transformEncode = (v2) => v2;
26445
- if (!transformDecode) transformDecode = (v2) => v2;
26446
- return {
26447
- xmlName,
26448
- sdNodeOrKeyName: sdName,
26449
- encode: ({ nodes }) => {
26450
- return transformEncode(nodes[0].attributes[attrName]) ?? void 0;
26451
- },
26452
- decode: ({ node }) => {
26453
- const value = node.attrs?.[sdName] != null ? transformDecode(node.attrs[sdName]) : void 0;
26454
- return value != null ? { name: xmlName, attributes: { [attrName]: value } } : void 0;
26455
- }
26456
- };
26457
- }
26458
- function createMeasurementPropertyHandler(xmlName, sdName = null) {
26459
- if (!sdName) sdName = xmlName.split(":")[1];
26460
- return {
26461
- xmlName,
26462
- sdNodeOrKeyName: sdName,
26463
- attributes: [
26464
- createAttributeHandler("w:w", "value", parseInteger, integerToString),
26465
- createAttributeHandler("w:type")
26466
- ],
26467
- encode: (_2, encodedAttrs) => {
26468
- return encodedAttrs["value"] != null ? encodedAttrs : void 0;
26469
- },
26470
- decode: function({ node }) {
26471
- const decodedAttrs = this.decodeAttributes({ node: { ...node, attrs: node.attrs[sdName] || {} } });
26472
- return decodedAttrs["w:w"] != null ? { attributes: decodedAttrs } : void 0;
26473
- }
26474
- };
26475
- }
26476
- function createBorderPropertyHandler(xmlName, sdName = null) {
26477
- if (!sdName) sdName = xmlName.split(":")[1];
26478
- return {
26479
- xmlName,
26480
- sdNodeOrKeyName: sdName,
26481
- attributes: [
26482
- createAttributeHandler("w:val"),
26483
- createAttributeHandler("w:color"),
26484
- createAttributeHandler("w:themeColor"),
26485
- createAttributeHandler("w:themeTint"),
26486
- createAttributeHandler("w:themeShade"),
26487
- createAttributeHandler("w:sz", "size", parseInteger, integerToString),
26488
- createAttributeHandler("w:space", null, parseInteger, integerToString),
26489
- createAttributeHandler("w:shadow", null, parseBoolean, booleanToString),
26490
- createAttributeHandler("w:frame", null, parseBoolean, booleanToString)
26491
- ],
26492
- encode: (params2, encodedAttrs) => {
26493
- return Object.keys(encodedAttrs).length > 0 ? encodedAttrs : void 0;
26494
- },
26495
- decode: function({ node }, context) {
26496
- const decodedAttrs = this.decodeAttributes({ node: { ...node, attrs: node.attrs[sdName] || {} } });
26497
- return Object.keys(decodedAttrs).length > 0 ? { attributes: decodedAttrs } : void 0;
26498
- }
26499
- };
26500
- }
26501
- const createAttributeHandler = (xmlName, sdName = null, transformEncode = null, transformDecode = null) => {
26502
- if (!transformEncode) transformEncode = (v2) => v2;
26503
- if (!transformDecode) transformDecode = (v2) => v2;
26504
- if (!sdName) sdName = xmlName.split(":")[1];
26505
- return {
26506
- xmlName,
26507
- sdName,
26508
- encode: (attributes) => transformEncode(attributes[xmlName]),
26509
- decode: (attributes) => transformDecode(attributes[sdName])
26510
- };
26511
- };
26512
- function encodeProperties(node, translatorsByXmlName, asArray = false) {
26513
- if (!node?.elements || node.elements.length === 0) {
26514
- return asArray ? [] : {};
26515
- }
26516
- const attributes = asArray ? [] : {};
26517
- node.elements.forEach((el) => {
26518
- const translator2 = translatorsByXmlName[el.name];
26519
- if (translator2) {
26520
- const encodedAttr = translator2.encode({ nodes: [el] });
26521
- if (encodedAttr != null) {
26522
- if (asArray) {
26523
- attributes.push({ [translator2.sdNodeOrKeyName]: encodedAttr });
26524
- } else {
26525
- attributes[translator2.sdNodeOrKeyName] = encodedAttr;
26526
- }
26527
- }
26528
- }
26529
- });
26530
- return attributes;
26531
- }
26532
- function decodeProperties(translatorsBySdName, properties) {
26533
- if (!properties || typeof properties !== "object") {
26534
- return [];
26535
- }
26536
- const elements = [];
26537
- Object.keys(properties).forEach((key2) => {
26538
- const translator2 = translatorsBySdName[key2];
26539
- if (translator2) {
26540
- const result = translator2.decode({ node: { attrs: { [key2]: properties[key2] } } });
26541
- if (result != null) {
26542
- result.name = translator2.xmlName;
26543
- elements.push(result);
26544
- }
26545
- }
26546
- });
26547
- return elements;
26548
- }
26549
- const parseBoolean = (value) => value != null ? ["1", "true"].includes(value) : void 0;
26550
- const booleanToString = (value) => value != null ? value ? "1" : "0" : void 0;
26551
- const parseInteger = (value) => {
26552
- if (value == null) return void 0;
26553
- const intValue = parseInt(value, 10);
26554
- return isNaN(intValue) ? void 0 : intValue;
26555
- };
26556
- const integerToString = (value) => {
26557
- const intValue = parseInteger(value);
26558
- return intValue != void 0 ? String(intValue) : void 0;
26663
+ encode: encode$o,
26664
+ decode: decode$o,
26665
+ attributes: validXmlAttributes$9
26559
26666
  };
26667
+ const translator$V = NodeTranslator.from(config$f);
26560
26668
  function preProcessVerticalMergeCells(table, { editorSchema }) {
26561
26669
  if (!table || !Array.isArray(table.content)) {
26562
26670
  return table;
@@ -26597,13 +26705,13 @@ function preProcessVerticalMergeCells(table, { editorSchema }) {
26597
26705
  }
26598
26706
  return table;
26599
26707
  }
26600
- const translator$T = NodeTranslator.from({
26708
+ const translator$U = NodeTranslator.from({
26601
26709
  xmlName: "w:cantSplit",
26602
26710
  sdNodeOrKeyName: "cantSplit",
26603
26711
  encode: ({ nodes }) => ["1", "true"].includes(nodes[0].attributes?.["w:val"] ?? "1"),
26604
26712
  decode: ({ node }) => node.attrs?.cantSplit ? { attributes: {} } : void 0
26605
26713
  });
26606
- const translator$S = NodeTranslator.from({
26714
+ const translator$T = NodeTranslator.from({
26607
26715
  xmlName: "w:cnfStyle",
26608
26716
  sdNodeOrKeyName: "cnfStyle",
26609
26717
  attributes: [
@@ -26629,8 +26737,8 @@ const translator$S = NodeTranslator.from({
26629
26737
  return Object.keys(decodedAttrs).length > 0 ? { attributes: decodedAttrs } : void 0;
26630
26738
  }
26631
26739
  });
26632
- const translator$R = NodeTranslator.from(createSingleAttrPropertyHandler("w:divId"));
26633
- const translator$Q = NodeTranslator.from(
26740
+ const translator$S = NodeTranslator.from(createSingleAttrPropertyHandler("w:divId"));
26741
+ const translator$R = NodeTranslator.from(
26634
26742
  createSingleAttrPropertyHandler(
26635
26743
  "w:gridAfter",
26636
26744
  null,
@@ -26639,7 +26747,7 @@ const translator$Q = NodeTranslator.from(
26639
26747
  (v2) => integerToString(v2)
26640
26748
  )
26641
26749
  );
26642
- const translator$P = NodeTranslator.from(
26750
+ const translator$Q = NodeTranslator.from(
26643
26751
  createSingleAttrPropertyHandler(
26644
26752
  "w:gridBefore",
26645
26753
  null,
@@ -26648,21 +26756,21 @@ const translator$P = NodeTranslator.from(
26648
26756
  (v2) => integerToString(v2)
26649
26757
  )
26650
26758
  );
26651
- const translator$O = NodeTranslator.from({
26759
+ const translator$P = NodeTranslator.from({
26652
26760
  xmlName: "w:hidden",
26653
26761
  sdNodeOrKeyName: "hidden",
26654
26762
  encode: ({ nodes }) => parseBoolean(nodes[0].attributes?.["w:val"] ?? "1"),
26655
26763
  decode: ({ node }) => node.attrs.hidden ? { attributes: {} } : void 0
26656
26764
  });
26657
- const translator$N = NodeTranslator.from(createSingleAttrPropertyHandler("w:jc", "justification"));
26658
- const translator$M = NodeTranslator.from(createMeasurementPropertyHandler("w:tblCellSpacing", "tableCellSpacing"));
26659
- const translator$L = NodeTranslator.from({
26765
+ const translator$O = NodeTranslator.from(createSingleAttrPropertyHandler("w:jc", "justification"));
26766
+ const translator$N = NodeTranslator.from(createMeasurementPropertyHandler("w:tblCellSpacing", "tableCellSpacing"));
26767
+ const translator$M = NodeTranslator.from({
26660
26768
  xmlName: "w:tblHeader",
26661
26769
  sdNodeOrKeyName: "repeatHeader",
26662
26770
  encode: ({ nodes }) => parseBoolean(nodes[0].attributes?.["w:val"] ?? "1"),
26663
26771
  decode: ({ node }) => node.attrs.repeatHeader ? { attributes: {} } : void 0
26664
26772
  });
26665
- const translator$K = NodeTranslator.from({
26773
+ const translator$L = NodeTranslator.from({
26666
26774
  xmlName: "w:trHeight",
26667
26775
  sdNodeOrKeyName: "rowHeight",
26668
26776
  encode: ({ nodes }) => {
@@ -26689,11 +26797,11 @@ const translator$K = NodeTranslator.from({
26689
26797
  return Object.keys(heightAttrs).length > 0 ? { attributes: heightAttrs } : void 0;
26690
26798
  }
26691
26799
  });
26692
- const translator$J = NodeTranslator.from(createMeasurementPropertyHandler("w:wAfter"));
26693
- const translator$I = NodeTranslator.from(createMeasurementPropertyHandler("w:wBefore"));
26694
- const XML_NODE_NAME$f = "w:trPr";
26800
+ const translator$K = NodeTranslator.from(createMeasurementPropertyHandler("w:wAfter"));
26801
+ const translator$J = NodeTranslator.from(createMeasurementPropertyHandler("w:wBefore"));
26802
+ const XML_NODE_NAME$g = "w:trPr";
26695
26803
  const SD_ATTR_KEY$4 = "tableRowProperties";
26696
- const encode$m = (params2) => {
26804
+ const encode$n = (params2) => {
26697
26805
  const { nodes } = params2;
26698
26806
  const node = nodes[0];
26699
26807
  let attributes = {
@@ -26707,12 +26815,12 @@ const encode$m = (params2) => {
26707
26815
  };
26708
26816
  return {
26709
26817
  type: NodeTranslator.translatorTypes.ATTRIBUTE,
26710
- xmlName: XML_NODE_NAME$f,
26818
+ xmlName: XML_NODE_NAME$g,
26711
26819
  sdNodeOrKeyName: SD_ATTR_KEY$4,
26712
26820
  attributes
26713
26821
  };
26714
26822
  };
26715
- const decode$m = (params2) => {
26823
+ const decode$n = (params2) => {
26716
26824
  const { tableRowProperties = {} } = params2.node.attrs || {};
26717
26825
  const elements = decodeProperties(propertyTranslatorsBySdName$2, tableRowProperties);
26718
26826
  const newNode = {
@@ -26724,6 +26832,7 @@ const decode$m = (params2) => {
26724
26832
  return newNode;
26725
26833
  };
26726
26834
  const propertyTranslators$3 = [
26835
+ translator$U,
26727
26836
  translator$T,
26728
26837
  translator$S,
26729
26838
  translator$R,
@@ -26734,8 +26843,7 @@ const propertyTranslators$3 = [
26734
26843
  translator$M,
26735
26844
  translator$L,
26736
26845
  translator$K,
26737
- translator$J,
26738
- translator$I
26846
+ translator$J
26739
26847
  ];
26740
26848
  const propertyTranslatorsByXmlName$2 = {};
26741
26849
  propertyTranslators$3.forEach((translator2) => {
@@ -26745,25 +26853,25 @@ const propertyTranslatorsBySdName$2 = {};
26745
26853
  propertyTranslators$3.forEach((translator2) => {
26746
26854
  propertyTranslatorsBySdName$2[translator2.sdNodeOrKeyName] = translator2;
26747
26855
  });
26748
- const config$d = {
26749
- xmlName: XML_NODE_NAME$f,
26856
+ const config$e = {
26857
+ xmlName: XML_NODE_NAME$g,
26750
26858
  sdNodeOrKeyName: SD_ATTR_KEY$4,
26751
26859
  type: NodeTranslator.translatorTypes.ATTRIBUTE,
26752
- encode: encode$m,
26753
- decode: decode$m
26860
+ encode: encode$n,
26861
+ decode: decode$n
26754
26862
  };
26755
- const translator$H = NodeTranslator.from(config$d);
26756
- const XML_NODE_NAME$e = "w:tr";
26757
- const SD_NODE_NAME$a = "tableRow";
26758
- const validXmlAttributes$9 = ["w:rsidDel", "w:rsidR", "w:rsidRPr", "w:rsidTr", "w14:paraId", "w14:textId"].map(
26863
+ const translator$I = NodeTranslator.from(config$e);
26864
+ const XML_NODE_NAME$f = "w:tr";
26865
+ const SD_NODE_NAME$b = "tableRow";
26866
+ const validXmlAttributes$8 = ["w:rsidDel", "w:rsidR", "w:rsidRPr", "w:rsidTr", "w14:paraId", "w14:textId"].map(
26759
26867
  (xmlName) => createAttributeHandler(xmlName)
26760
26868
  );
26761
- const encode$l = (params2, encodedAttrs) => {
26869
+ const encode$m = (params2, encodedAttrs) => {
26762
26870
  const { row } = params2.extraParams;
26763
26871
  let tableRowProperties = {};
26764
26872
  const tPr = row.elements.find((el) => el.name === "w:trPr");
26765
26873
  if (tPr) {
26766
- ({ attributes: tableRowProperties } = translator$H.encode({
26874
+ ({ attributes: tableRowProperties } = translator$I.encode({
26767
26875
  ...params2,
26768
26876
  nodes: [tPr]
26769
26877
  }));
@@ -26776,7 +26884,7 @@ const encode$l = (params2, encodedAttrs) => {
26776
26884
  let currentColumnIndex = 0;
26777
26885
  const content = cellNodes?.map((n) => {
26778
26886
  let columnWidth = gridColumnWidths?.[currentColumnIndex] || null;
26779
- const result = translator$8.encode({
26887
+ const result = translator$9.encode({
26780
26888
  ...params2,
26781
26889
  extraParams: {
26782
26890
  ...params2.extraParams,
@@ -26798,7 +26906,7 @@ const encode$l = (params2, encodedAttrs) => {
26798
26906
  };
26799
26907
  return newNode;
26800
26908
  };
26801
- const decode$l = (params2, decodedAttrs) => {
26909
+ const decode$m = (params2, decodedAttrs) => {
26802
26910
  const { node } = params2;
26803
26911
  const elements = translateChildNodes(params2);
26804
26912
  if (node.attrs?.tableRowProperties) {
@@ -26810,7 +26918,7 @@ const decode$l = (params2, decodedAttrs) => {
26810
26918
  }
26811
26919
  }
26812
26920
  tableRowProperties["cantSplit"] = node.attrs["cantSplit"];
26813
- const trPr = translator$H.decode({
26921
+ const trPr = translator$I.decode({
26814
26922
  ...params2,
26815
26923
  node: { ...node, attrs: { ...node.attrs, tableRowProperties } }
26816
26924
  });
@@ -26822,22 +26930,22 @@ const decode$l = (params2, decodedAttrs) => {
26822
26930
  elements
26823
26931
  };
26824
26932
  };
26825
- const config$c = {
26826
- xmlName: XML_NODE_NAME$e,
26827
- sdNodeOrKeyName: SD_NODE_NAME$a,
26933
+ const config$d = {
26934
+ xmlName: XML_NODE_NAME$f,
26935
+ sdNodeOrKeyName: SD_NODE_NAME$b,
26828
26936
  type: NodeTranslator.translatorTypes.NODE,
26829
- encode: encode$l,
26830
- decode: decode$l,
26831
- attributes: validXmlAttributes$9
26937
+ encode: encode$m,
26938
+ decode: decode$m,
26939
+ attributes: validXmlAttributes$8
26832
26940
  };
26833
- const translator$G = NodeTranslator.from(config$c);
26834
- const translator$F = NodeTranslator.from({
26941
+ const translator$H = NodeTranslator.from(config$d);
26942
+ const translator$G = NodeTranslator.from({
26835
26943
  xmlName: "w:bidiVisual",
26836
26944
  sdNodeOrKeyName: "rightToLeft",
26837
26945
  encode: ({ nodes }) => parseBoolean(nodes[0].attributes?.["w:val"] ?? "1"),
26838
26946
  decode: ({ node }) => node.attrs.rightToLeft ? { attributes: {} } : void 0
26839
26947
  });
26840
- const translator$E = NodeTranslator.from({
26948
+ const translator$F = NodeTranslator.from({
26841
26949
  xmlName: "w:shd",
26842
26950
  sdNodeOrKeyName: "shading",
26843
26951
  attributes: [
@@ -26859,11 +26967,11 @@ const translator$E = NodeTranslator.from({
26859
26967
  return Object.keys(decodedAttrs).length > 0 ? { attributes: decodedAttrs } : void 0;
26860
26968
  }
26861
26969
  });
26862
- const translator$D = NodeTranslator.from(createSingleAttrPropertyHandler("w:tblCaption", "caption"));
26863
- const translator$C = NodeTranslator.from(createSingleAttrPropertyHandler("w:tblDescription", "description"));
26864
- const translator$B = NodeTranslator.from(createMeasurementPropertyHandler("w:tblInd", "tableIndent"));
26865
- const translator$A = NodeTranslator.from(createSingleAttrPropertyHandler("w:tblLayout", "tableLayout", "w:type"));
26866
- const translator$z = NodeTranslator.from({
26970
+ const translator$E = NodeTranslator.from(createSingleAttrPropertyHandler("w:tblCaption", "caption"));
26971
+ const translator$D = NodeTranslator.from(createSingleAttrPropertyHandler("w:tblDescription", "description"));
26972
+ const translator$C = NodeTranslator.from(createMeasurementPropertyHandler("w:tblInd", "tableIndent"));
26973
+ const translator$B = NodeTranslator.from(createSingleAttrPropertyHandler("w:tblLayout", "tableLayout", "w:type"));
26974
+ const translator$A = NodeTranslator.from({
26867
26975
  xmlName: "w:tblLook",
26868
26976
  sdNodeOrKeyName: "tblLook",
26869
26977
  attributes: ["w:firstColumn", "w:firstRow", "w:lastColumn", "w:lastRow", "w:noHBand", "w:noVBand"].map((attr) => createAttributeHandler(attr, null, parseBoolean, booleanToString)).concat([createAttributeHandler("w:val")]),
@@ -26875,16 +26983,16 @@ const translator$z = NodeTranslator.from({
26875
26983
  return Object.keys(decodedAttrs).length > 0 ? { attributes: decodedAttrs } : void 0;
26876
26984
  }
26877
26985
  });
26878
- const translator$y = NodeTranslator.from(createSingleAttrPropertyHandler("w:tblOverlap", "overlap"));
26879
- const translator$x = NodeTranslator.from(createSingleAttrPropertyHandler("w:tblStyle", "tableStyleId"));
26880
- const translator$w = NodeTranslator.from(
26986
+ const translator$z = NodeTranslator.from(createSingleAttrPropertyHandler("w:tblOverlap", "overlap"));
26987
+ const translator$y = NodeTranslator.from(createSingleAttrPropertyHandler("w:tblStyle", "tableStyleId"));
26988
+ const translator$x = NodeTranslator.from(
26881
26989
  createSingleAttrPropertyHandler("w:tblStyleColBandSize", "tableStyleColBandSize")
26882
26990
  );
26883
- const translator$v = NodeTranslator.from(
26991
+ const translator$w = NodeTranslator.from(
26884
26992
  createSingleAttrPropertyHandler("w:tblStyleRowBandSize", "tableStyleRowBandSize")
26885
26993
  );
26886
- const translator$u = NodeTranslator.from(createMeasurementPropertyHandler("w:tblW", "tableWidth"));
26887
- const translator$t = NodeTranslator.from({
26994
+ const translator$v = NodeTranslator.from(createMeasurementPropertyHandler("w:tblW", "tableWidth"));
26995
+ const translator$u = NodeTranslator.from({
26888
26996
  xmlName: "w:tblpPr",
26889
26997
  sdNodeOrKeyName: "floatingTableProperties",
26890
26998
  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))),
@@ -26896,29 +27004,29 @@ const translator$t = NodeTranslator.from({
26896
27004
  return Object.keys(decodedAttrs).length > 0 ? { attributes: decodedAttrs } : void 0;
26897
27005
  }
26898
27006
  });
26899
- const translator$s = NodeTranslator.from(createBorderPropertyHandler("w:bottom"));
26900
- const translator$r = NodeTranslator.from(createMeasurementPropertyHandler("w:bottom", "marginBottom"));
26901
- const translator$q = NodeTranslator.from(createBorderPropertyHandler("w:end"));
26902
- const translator$p = NodeTranslator.from(createMeasurementPropertyHandler("w:end", "marginEnd"));
26903
- const translator$o = NodeTranslator.from(createBorderPropertyHandler("w:insideH"));
26904
- const translator$n = NodeTranslator.from(createBorderPropertyHandler("w:insideV"));
26905
- const translator$m = NodeTranslator.from(createBorderPropertyHandler("w:left"));
26906
- const translator$l = NodeTranslator.from(createMeasurementPropertyHandler("w:left", "marginLeft"));
26907
- const translator$k = NodeTranslator.from(createBorderPropertyHandler("w:right"));
26908
- const translator$j = NodeTranslator.from(createMeasurementPropertyHandler("w:right", "marginRight"));
26909
- const translator$i = NodeTranslator.from(createBorderPropertyHandler("w:start"));
26910
- const translator$h = NodeTranslator.from(createMeasurementPropertyHandler("w:start", "marginStart"));
26911
- const translator$g = NodeTranslator.from(createBorderPropertyHandler("w:top"));
26912
- const translator$f = NodeTranslator.from(createMeasurementPropertyHandler("w:top", "marginTop"));
26913
- const XML_NODE_NAME$d = "w:tblBorders";
27007
+ const translator$t = NodeTranslator.from(createBorderPropertyHandler("w:bottom"));
27008
+ const translator$s = NodeTranslator.from(createMeasurementPropertyHandler("w:bottom", "marginBottom"));
27009
+ const translator$r = NodeTranslator.from(createBorderPropertyHandler("w:end"));
27010
+ const translator$q = NodeTranslator.from(createMeasurementPropertyHandler("w:end", "marginEnd"));
27011
+ const translator$p = NodeTranslator.from(createBorderPropertyHandler("w:insideH"));
27012
+ const translator$o = NodeTranslator.from(createBorderPropertyHandler("w:insideV"));
27013
+ const translator$n = NodeTranslator.from(createBorderPropertyHandler("w:left"));
27014
+ const translator$m = NodeTranslator.from(createMeasurementPropertyHandler("w:left", "marginLeft"));
27015
+ const translator$l = NodeTranslator.from(createBorderPropertyHandler("w:right"));
27016
+ const translator$k = NodeTranslator.from(createMeasurementPropertyHandler("w:right", "marginRight"));
27017
+ const translator$j = NodeTranslator.from(createBorderPropertyHandler("w:start"));
27018
+ const translator$i = NodeTranslator.from(createMeasurementPropertyHandler("w:start", "marginStart"));
27019
+ const translator$h = NodeTranslator.from(createBorderPropertyHandler("w:top"));
27020
+ const translator$g = NodeTranslator.from(createMeasurementPropertyHandler("w:top", "marginTop"));
27021
+ const XML_NODE_NAME$e = "w:tblBorders";
26914
27022
  const SD_ATTR_KEY$3 = "borders";
26915
- const encode$k = (params2) => {
27023
+ const encode$l = (params2) => {
26916
27024
  const { nodes } = params2;
26917
27025
  const node = nodes[0];
26918
27026
  const attributes = encodeProperties(node, tblBordersTranslatorsByXmlName);
26919
27027
  return Object.keys(attributes).length > 0 ? attributes : void 0;
26920
27028
  };
26921
- const decode$k = (params2) => {
27029
+ const decode$l = (params2) => {
26922
27030
  const { borders = {} } = params2.node.attrs || {};
26923
27031
  const elements = decodeProperties(tblBordersTranslatorsBySdName, borders);
26924
27032
  const newNode = {
@@ -26930,14 +27038,14 @@ const decode$k = (params2) => {
26930
27038
  return newNode;
26931
27039
  };
26932
27040
  const propertyTranslators$2 = [
26933
- translator$s,
26934
- translator$q,
27041
+ translator$t,
27042
+ translator$r,
27043
+ translator$p,
26935
27044
  translator$o,
26936
27045
  translator$n,
26937
- translator$m,
26938
- translator$k,
26939
- translator$i,
26940
- translator$g
27046
+ translator$l,
27047
+ translator$j,
27048
+ translator$h
26941
27049
  ];
26942
27050
  const tblBordersTranslatorsByXmlName = {};
26943
27051
  const tblBordersTranslatorsBySdName = {};
@@ -26945,27 +27053,27 @@ propertyTranslators$2.forEach((translator2) => {
26945
27053
  tblBordersTranslatorsByXmlName[translator2.xmlName] = translator2;
26946
27054
  tblBordersTranslatorsBySdName[translator2.sdNodeOrKeyName] = translator2;
26947
27055
  });
26948
- const translator$e = NodeTranslator.from({
26949
- xmlName: XML_NODE_NAME$d,
27056
+ const translator$f = NodeTranslator.from({
27057
+ xmlName: XML_NODE_NAME$e,
26950
27058
  sdNodeOrKeyName: SD_ATTR_KEY$3,
26951
27059
  type: NodeTranslator.translatorTypes.NODE,
26952
27060
  attributes: [],
26953
- encode: encode$k,
26954
- decode: decode$k
27061
+ encode: encode$l,
27062
+ decode: decode$l
26955
27063
  });
26956
- const XML_NODE_NAME$c = "w:tblCellMar";
27064
+ const XML_NODE_NAME$d = "w:tblCellMar";
26957
27065
  const SD_ATTR_KEY$2 = "cellMargins";
26958
- const encode$j = (params2) => {
27066
+ const encode$k = (params2) => {
26959
27067
  const { nodes } = params2;
26960
27068
  const node = nodes[0];
26961
27069
  const attributes = encodeProperties(node, propertyTranslatorsByXmlName$1);
26962
27070
  return Object.keys(attributes).length > 0 ? attributes : void 0;
26963
27071
  };
26964
- const decode$j = (params2) => {
27072
+ const decode$k = (params2) => {
26965
27073
  const { cellMargins = {} } = params2.node.attrs || {};
26966
27074
  const elements = decodeProperties(propertyTranslatorsBySdName$1, cellMargins);
26967
27075
  const newNode = {
26968
- name: XML_NODE_NAME$c,
27076
+ name: XML_NODE_NAME$d,
26969
27077
  type: "element",
26970
27078
  attributes: {},
26971
27079
  elements
@@ -26973,12 +27081,12 @@ const decode$j = (params2) => {
26973
27081
  return newNode;
26974
27082
  };
26975
27083
  const propertyTranslators$1 = [
26976
- translator$r,
26977
- translator$p,
26978
- translator$l,
26979
- translator$j,
26980
- translator$h,
26981
- translator$f
27084
+ translator$s,
27085
+ translator$q,
27086
+ translator$m,
27087
+ translator$k,
27088
+ translator$i,
27089
+ translator$g
26982
27090
  ];
26983
27091
  const propertyTranslatorsByXmlName$1 = {};
26984
27092
  const propertyTranslatorsBySdName$1 = {};
@@ -26986,27 +27094,27 @@ propertyTranslators$1.forEach((translator2) => {
26986
27094
  propertyTranslatorsByXmlName$1[translator2.xmlName] = translator2;
26987
27095
  propertyTranslatorsBySdName$1[translator2.sdNodeOrKeyName] = translator2;
26988
27096
  });
26989
- const translator$d = NodeTranslator.from({
26990
- xmlName: XML_NODE_NAME$c,
27097
+ const translator$e = NodeTranslator.from({
27098
+ xmlName: XML_NODE_NAME$d,
26991
27099
  sdNodeOrKeyName: SD_ATTR_KEY$2,
26992
27100
  type: NodeTranslator.translatorTypes.NODE,
26993
27101
  attributes: [],
26994
- encode: encode$j,
26995
- decode: decode$j
27102
+ encode: encode$k,
27103
+ decode: decode$k
26996
27104
  });
26997
- const XML_NODE_NAME$b = "w:tblPr";
27105
+ const XML_NODE_NAME$c = "w:tblPr";
26998
27106
  const SD_ATTR_KEY$1 = "tableProperties";
26999
- const encode$i = (params2) => {
27107
+ const encode$j = (params2) => {
27000
27108
  const { nodes } = params2;
27001
27109
  const node = nodes[0];
27002
27110
  const attributes = encodeProperties(node, propertyTranslatorsByXmlName);
27003
27111
  return {
27004
- xmlName: XML_NODE_NAME$b,
27112
+ xmlName: XML_NODE_NAME$c,
27005
27113
  sdNodeOrKeyName: SD_ATTR_KEY$1,
27006
27114
  attributes
27007
27115
  };
27008
27116
  };
27009
- const decode$i = (params2) => {
27117
+ const decode$j = (params2) => {
27010
27118
  const { tableProperties = {} } = params2.node.attrs || {};
27011
27119
  const elements = decodeProperties(propertyTranslatorsBySdName, tableProperties);
27012
27120
  const newNode = {
@@ -27018,11 +27126,12 @@ const decode$i = (params2) => {
27018
27126
  return newNode;
27019
27127
  };
27020
27128
  const propertyTranslators = [
27129
+ translator$G,
27130
+ translator$O,
27021
27131
  translator$F,
27022
- translator$N,
27023
27132
  translator$E,
27133
+ translator$N,
27024
27134
  translator$D,
27025
- translator$M,
27026
27135
  translator$C,
27027
27136
  translator$B,
27028
27137
  translator$A,
@@ -27032,9 +27141,8 @@ const propertyTranslators = [
27032
27141
  translator$w,
27033
27142
  translator$v,
27034
27143
  translator$u,
27035
- translator$t,
27036
- translator$e,
27037
- translator$d
27144
+ translator$f,
27145
+ translator$e
27038
27146
  ];
27039
27147
  const propertyTranslatorsByXmlName = {};
27040
27148
  const propertyTranslatorsBySdName = {};
@@ -27042,14 +27150,14 @@ propertyTranslators.forEach((translator2) => {
27042
27150
  propertyTranslatorsByXmlName[translator2.xmlName] = translator2;
27043
27151
  propertyTranslatorsBySdName[translator2.sdNodeOrKeyName] = translator2;
27044
27152
  });
27045
- const config$b = {
27046
- xmlName: XML_NODE_NAME$b,
27153
+ const config$c = {
27154
+ xmlName: XML_NODE_NAME$c,
27047
27155
  sdNodeOrKeyName: SD_ATTR_KEY$1,
27048
- encode: encode$i,
27049
- decode: decode$i
27156
+ encode: encode$j,
27157
+ decode: decode$j
27050
27158
  };
27051
- const translator$c = NodeTranslator.from(config$b);
27052
- const translator$b = NodeTranslator.from(
27159
+ const translator$d = NodeTranslator.from(config$c);
27160
+ const translator$c = NodeTranslator.from(
27053
27161
  createSingleAttrPropertyHandler("w:gridCol", "col", "w:w", parseInteger, integerToString)
27054
27162
  );
27055
27163
  const DEFAULT_COLUMN_WIDTH_PX = 100;
@@ -27099,20 +27207,20 @@ const resolveFallbackColumnWidthTwips = (params2, totalColumns, cellMinWidthTwip
27099
27207
  }
27100
27208
  return Math.max(fallbackWidthTwips, cellMinWidthTwips);
27101
27209
  };
27102
- const XML_NODE_NAME$a = "w:tblGrid";
27210
+ const XML_NODE_NAME$b = "w:tblGrid";
27103
27211
  const SD_ATTR_KEY = "grid";
27104
27212
  const cellMinWidth = pixelsToTwips(10);
27105
- const encode$h = (params2) => {
27213
+ const encode$i = (params2) => {
27106
27214
  const { nodes } = params2;
27107
27215
  const node = nodes[0];
27108
- const attributes = encodeProperties(node, { [translator$b.xmlName]: translator$b }, true);
27216
+ const attributes = encodeProperties(node, { [translator$c.xmlName]: translator$c }, true);
27109
27217
  return {
27110
- xmlName: XML_NODE_NAME$a,
27218
+ xmlName: XML_NODE_NAME$b,
27111
27219
  sdNodeOrKeyName: SD_ATTR_KEY,
27112
27220
  attributes
27113
27221
  };
27114
27222
  };
27115
- const decode$h = (params2) => {
27223
+ const decode$i = (params2) => {
27116
27224
  const { grid: rawGrid } = params2.node.attrs || {};
27117
27225
  const grid = Array.isArray(rawGrid) ? rawGrid : [];
27118
27226
  const { firstRow = {} } = params2.extraParams || {};
@@ -27131,10 +27239,10 @@ const decode$h = (params2) => {
27131
27239
  numericWidth = fallbackColumnWidthTwips;
27132
27240
  }
27133
27241
  numericWidth = Math.max(numericWidth, cellMinWidth);
27134
- const decoded = translator$b.decode({
27242
+ const decoded = translator$c.decode({
27135
27243
  node: { type: (
27136
27244
  /** @type {string} */
27137
- translator$b.sdNodeOrKeyName
27245
+ translator$c.sdNodeOrKeyName
27138
27246
  ), attrs: { col: numericWidth } }
27139
27247
  });
27140
27248
  if (decoded) elements.push(decoded);
@@ -27169,19 +27277,19 @@ const decode$h = (params2) => {
27169
27277
  columnIndex++;
27170
27278
  }
27171
27279
  const newNode = {
27172
- name: XML_NODE_NAME$a,
27280
+ name: XML_NODE_NAME$b,
27173
27281
  attributes: {},
27174
27282
  elements
27175
27283
  };
27176
27284
  return newNode;
27177
27285
  };
27178
- const config$a = {
27179
- xmlName: XML_NODE_NAME$a,
27286
+ const config$b = {
27287
+ xmlName: XML_NODE_NAME$b,
27180
27288
  sdNodeOrKeyName: SD_ATTR_KEY,
27181
- encode: encode$h,
27182
- decode: decode$h
27289
+ encode: encode$i,
27290
+ decode: decode$i
27183
27291
  };
27184
- const translator$a = NodeTranslator.from(config$a);
27292
+ const translator$b = NodeTranslator.from(config$b);
27185
27293
  const DEFAULT_PAGE_WIDTH_TWIPS = 12240;
27186
27294
  const DEFAULT_PAGE_MARGIN_TWIPS = 1440;
27187
27295
  const DEFAULT_CONTENT_WIDTH_TWIPS = DEFAULT_PAGE_WIDTH_TWIPS - 2 * DEFAULT_PAGE_MARGIN_TWIPS;
@@ -27244,19 +27352,19 @@ const buildFallbackGridForTable = ({ params: params2, rows, tableWidth, tableWid
27244
27352
  columnWidths: Array(columnCount).fill(fallbackColumnWidthPx)
27245
27353
  };
27246
27354
  };
27247
- const XML_NODE_NAME$9 = "w:tbl";
27248
- const SD_NODE_NAME$9 = "table";
27249
- const encode$g = (params2, encodedAttrs) => {
27355
+ const XML_NODE_NAME$a = "w:tbl";
27356
+ const SD_NODE_NAME$a = "table";
27357
+ const encode$h = (params2, encodedAttrs) => {
27250
27358
  const { nodes } = params2;
27251
27359
  const node = nodes[0];
27252
27360
  const tblPr = node.elements.find((el) => el.name === "w:tblPr");
27253
27361
  if (tblPr) {
27254
- const encodedProperties = translator$c.encode({ ...params2, nodes: [tblPr] });
27362
+ const encodedProperties = translator$d.encode({ ...params2, nodes: [tblPr] });
27255
27363
  encodedAttrs["tableProperties"] = encodedProperties?.attributes || {};
27256
27364
  }
27257
27365
  const tblGrid = node.elements.find((el) => el.name === "w:tblGrid");
27258
27366
  if (tblGrid) {
27259
- encodedAttrs["grid"] = translator$a.encode({ ...params2, nodes: [tblGrid] }).attributes;
27367
+ encodedAttrs["grid"] = translator$b.encode({ ...params2, nodes: [tblGrid] }).attributes;
27260
27368
  }
27261
27369
  [
27262
27370
  "tableStyleId",
@@ -27323,7 +27431,7 @@ const encode$g = (params2, encodedAttrs) => {
27323
27431
  }
27324
27432
  const content = [];
27325
27433
  rows.forEach((row) => {
27326
- const result = translator$G.encode({
27434
+ const result = translator$H.encode({
27327
27435
  ...params2,
27328
27436
  nodes: [row],
27329
27437
  extraParams: {
@@ -27342,13 +27450,13 @@ const encode$g = (params2, encodedAttrs) => {
27342
27450
  attrs: encodedAttrs
27343
27451
  };
27344
27452
  };
27345
- const decode$g = (params2, decodedAttrs) => {
27453
+ const decode$h = (params2, decodedAttrs) => {
27346
27454
  params2.node = preProcessVerticalMergeCells(params2.node, params2);
27347
27455
  const { node } = params2;
27348
27456
  const elements = translateChildNodes(params2);
27349
27457
  const firstRow = node.content?.find((n) => n.type === "tableRow");
27350
27458
  const properties = node.attrs.grid;
27351
- const element = translator$a.decode({
27459
+ const element = translator$b.decode({
27352
27460
  ...params2,
27353
27461
  node: { ...node, attrs: { ...node.attrs, grid: properties } },
27354
27462
  extraParams: {
@@ -27358,7 +27466,7 @@ const decode$g = (params2, decodedAttrs) => {
27358
27466
  if (element) elements.unshift(element);
27359
27467
  if (node.attrs?.tableProperties) {
27360
27468
  const properties2 = { ...node.attrs.tableProperties };
27361
- const element2 = translator$c.decode({
27469
+ const element2 = translator$d.decode({
27362
27470
  ...params2,
27363
27471
  node: { ...node, attrs: { ...node.attrs, tableProperties: properties2 } }
27364
27472
  });
@@ -27424,7 +27532,7 @@ function _getReferencedTableStyles(tableStyleReference, params2) {
27424
27532
  if (baseTblPr && baseTblPr.elements) {
27425
27533
  tblPr.elements.push(...baseTblPr.elements);
27426
27534
  }
27427
- const tableProperties = translator$c.encode({ ...params2, nodes: [tblPr] }).attributes;
27535
+ const tableProperties = translator$d.encode({ ...params2, nodes: [tblPr] }).attributes;
27428
27536
  const { borders, rowBorders } = _processTableBorders(tableProperties.borders || {});
27429
27537
  if (borders) stylesToReturn.borders = borders;
27430
27538
  if (rowBorders) stylesToReturn.rowBorders = rowBorders;
@@ -27441,16 +27549,16 @@ function _getReferencedTableStyles(tableStyleReference, params2) {
27441
27549
  }
27442
27550
  return stylesToReturn;
27443
27551
  }
27444
- const config$9 = {
27445
- xmlName: XML_NODE_NAME$9,
27446
- sdNodeOrKeyName: SD_NODE_NAME$9,
27552
+ const config$a = {
27553
+ xmlName: XML_NODE_NAME$a,
27554
+ sdNodeOrKeyName: SD_NODE_NAME$a,
27447
27555
  type: NodeTranslator.translatorTypes.NODE,
27448
- encode: encode$g,
27449
- decode: decode$g,
27556
+ encode: encode$h,
27557
+ decode: decode$h,
27450
27558
  attributes: []
27451
27559
  };
27452
- const translator$9 = NodeTranslator.from(config$9);
27453
- const tableNodeHandlerEntity = generateV2HandlerEntity("tableNodeHandler", translator$9);
27560
+ const translator$a = NodeTranslator.from(config$a);
27561
+ const tableNodeHandlerEntity = generateV2HandlerEntity("tableNodeHandler", translator$a);
27454
27562
  function getReferencedTableStyles(tblStyleTag, docx) {
27455
27563
  if (!tblStyleTag) return null;
27456
27564
  const stylesToReturn = {};
@@ -27812,10 +27920,10 @@ function generateCellMargins(cellMargins) {
27812
27920
  if (left2 != null) elements.push({ name: "w:left", attributes: { "w:w": pixelsToTwips(left2) } });
27813
27921
  return elements;
27814
27922
  }
27815
- const XML_NODE_NAME$8 = "w:tc";
27816
- const SD_NODE_NAME$8 = "tableCell";
27817
- const validXmlAttributes$8 = [];
27818
- function encode$f(params2, encodedAttrs) {
27923
+ const XML_NODE_NAME$9 = "w:tc";
27924
+ const SD_NODE_NAME$9 = "tableCell";
27925
+ const validXmlAttributes$7 = [];
27926
+ function encode$g(params2, encodedAttrs) {
27819
27927
  const {
27820
27928
  node,
27821
27929
  table,
@@ -27842,162 +27950,22 @@ function encode$f(params2, encodedAttrs) {
27842
27950
  }
27843
27951
  return schemaNode;
27844
27952
  }
27845
- function decode$f(params2, decodedAttrs) {
27953
+ function decode$g(params2, decodedAttrs) {
27846
27954
  const translated = translateTableCell(params2);
27847
27955
  if (decodedAttrs && Object.keys(decodedAttrs).length) {
27848
27956
  translated.attributes = { ...translated.attributes || {}, ...decodedAttrs };
27849
27957
  }
27850
27958
  return translated;
27851
27959
  }
27852
- const config$8 = {
27853
- xmlName: XML_NODE_NAME$8,
27854
- sdNodeOrKeyName: SD_NODE_NAME$8,
27855
- type: NodeTranslator.translatorTypes.NODE,
27856
- encode: encode$f,
27857
- decode: decode$f,
27858
- attributes: validXmlAttributes$8
27859
- };
27860
- const translator$8 = NodeTranslator.from(config$8);
27861
- const XML_NODE_NAME$7 = "w:hyperlink";
27862
- const SD_NODE_NAME$7 = "link";
27863
- const _createAttributeHandler = (xmlName, sdName) => ({
27864
- xmlName,
27865
- sdName,
27866
- encode: (attributes) => attributes[xmlName],
27867
- decode: (attributes) => attributes[sdName]
27868
- });
27869
- const validXmlAttributes$7 = [
27870
- _createAttributeHandler("w:anchor", "anchor"),
27871
- _createAttributeHandler("w:docLocation", "docLocation"),
27872
- {
27873
- xmlName: "w:history",
27874
- sdName: "history",
27875
- encode: (attributes) => attributes["w:history"] === "1" || attributes["w:history"] === "true",
27876
- decode: (attributes) => attributes["history"] ? "1" : "0"
27877
- },
27878
- _createAttributeHandler("w:tooltip", "tooltip"),
27879
- _createAttributeHandler("r:id", "rId"),
27880
- _createAttributeHandler("w:tgtFrame", "target")
27881
- ];
27882
- const encode$e = (params2, encodedAttrs) => {
27883
- const { nodes, docx, nodeListHandler } = params2;
27884
- const node = nodes[0];
27885
- let href = _resolveHref(docx, encodedAttrs);
27886
- const linkMark = { attrs: { ...encodedAttrs, href } };
27887
- const runNodes = node.elements.filter((el) => el.name === "w:r");
27888
- runNodes.forEach((runNode) => {
27889
- const existingRunMarks = Array.isArray(runNode.marks) ? runNode.marks : [];
27890
- const runMarksWithoutLink = existingRunMarks.filter((mark) => mark?.type !== "link");
27891
- runNode.marks = runMarksWithoutLink;
27892
- });
27893
- const updatedNode = nodeListHandler.handler({
27894
- ...params2,
27895
- nodes: runNodes,
27896
- path: [...params2.path || [], node]
27897
- });
27898
- const cloneMark2 = (mark) => {
27899
- if (!mark || typeof mark !== "object") return mark;
27900
- if (!mark.attrs) return { ...mark };
27901
- return { ...mark, attrs: { ...mark.attrs } };
27902
- };
27903
- const ensureLinkMark = (child) => {
27904
- if (!child || typeof child !== "object") return child;
27905
- if (Array.isArray(child.content)) {
27906
- const updatedContent = child.content.map((item) => ensureLinkMark(item));
27907
- if (updatedContent !== child.content) {
27908
- child = { ...child, content: updatedContent };
27909
- }
27910
- }
27911
- if (child.type === "run") {
27912
- const existingMarks2 = Array.isArray(child.marks) ? child.marks : [];
27913
- const filteredMarks = existingMarks2.filter((mark) => mark?.type !== "link").map((mark) => cloneMark2(mark));
27914
- if (filteredMarks.length !== existingMarks2.length) {
27915
- if (filteredMarks.length) child = { ...child, marks: filteredMarks };
27916
- else {
27917
- const { marks: _removedMarks, ...rest } = child;
27918
- child = rest;
27919
- }
27920
- }
27921
- return child;
27922
- }
27923
- if (child.type !== "text") return child;
27924
- const existingMarks = Array.isArray(child.marks) ? child.marks.map((mark) => cloneMark2(mark)) : [];
27925
- const hasLink = existingMarks.some((mark) => mark?.type === "link");
27926
- if (hasLink) return child;
27927
- const linkClone = { type: "link", attrs: { ...linkMark.attrs } };
27928
- return { ...child, marks: [...existingMarks, linkClone] };
27929
- };
27930
- if (!Array.isArray(updatedNode)) return updatedNode;
27931
- return updatedNode.map((child) => ensureLinkMark(child));
27932
- };
27933
- const _resolveHref = (docx, encodedAttrs) => {
27934
- const rels = docx["word/_rels/document.xml.rels"];
27935
- const relationships = rels.elements.find((el) => el.name === "Relationships");
27936
- const { elements } = relationships;
27937
- const { rId, anchor } = encodedAttrs;
27938
- let href;
27939
- if (!rId && anchor) {
27940
- href = `#${anchor}`;
27941
- } else if (rId) {
27942
- const rel = elements.find((el) => el.attributes["Id"] === rId) || {};
27943
- const { attributes: relAttributes = {} } = rel;
27944
- href = relAttributes["Target"];
27945
- }
27946
- return href;
27947
- };
27948
- function decode$e(params2) {
27949
- const { node } = params2;
27950
- const linkMark = node.marks.find((m2) => m2.type === "link");
27951
- const linkAttrs = this.decodeAttributes({ ...params2, node: linkMark });
27952
- let { anchor, href: link } = linkMark.attrs;
27953
- const isExternalLink = !anchor;
27954
- if (isExternalLink) {
27955
- linkAttrs["r:id"] = _addNewLinkRelationship(params2, link, linkAttrs["r:id"]);
27956
- }
27957
- node.marks = node.marks.filter((m2) => m2.type !== "link");
27958
- const outputNode = exportSchemaToJson({ ...params2, node });
27959
- const newNode = {
27960
- name: "w:hyperlink",
27961
- type: "element",
27962
- attributes: {
27963
- ...linkAttrs
27964
- },
27965
- elements: [outputNode]
27966
- };
27967
- return newNode;
27968
- }
27969
- function _addNewLinkRelationship(params2, link, rId) {
27970
- if (!rId) rId = generateDocxRandomId();
27971
- if (!params2.relationships || !Array.isArray(params2.relationships)) {
27972
- params2.relationships = [];
27973
- }
27974
- const existingRel = params2.relationships.find(
27975
- (rel) => rel.attributes && rel.attributes.Id === rId && rel.attributes.Target === link
27976
- );
27977
- if (existingRel) {
27978
- return rId;
27979
- }
27980
- params2.relationships.push({
27981
- type: "element",
27982
- name: "Relationship",
27983
- attributes: {
27984
- Id: rId,
27985
- Type: "http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink",
27986
- Target: link,
27987
- TargetMode: "External"
27988
- }
27989
- });
27990
- return rId;
27991
- }
27992
- const config$7 = {
27993
- xmlName: XML_NODE_NAME$7,
27994
- sdNodeOrKeyName: SD_NODE_NAME$7,
27960
+ const config$9 = {
27961
+ xmlName: XML_NODE_NAME$9,
27962
+ sdNodeOrKeyName: SD_NODE_NAME$9,
27995
27963
  type: NodeTranslator.translatorTypes.NODE,
27996
- encode: encode$e,
27997
- decode: decode$e,
27964
+ encode: encode$g,
27965
+ decode: decode$g,
27998
27966
  attributes: validXmlAttributes$7
27999
27967
  };
28000
- const translator$7 = NodeTranslator.from(config$7);
27968
+ const translator$9 = NodeTranslator.from(config$9);
28001
27969
  function parseTagValueJSON(json) {
28002
27970
  if (typeof json !== "string") {
28003
27971
  return {};
@@ -28133,12 +28101,32 @@ function handleDocPartObj(params2) {
28133
28101
  }
28134
28102
  const content = node?.elements.find((el) => el.name === "w:sdtContent");
28135
28103
  const handler2 = validGalleryTypeMap[docPartGalleryType];
28136
- const result = handler2({ ...params2, nodes: [content] });
28104
+ const result = handler2({
28105
+ ...params2,
28106
+ nodes: [content],
28107
+ extraParams: { ...params2.extraParams || {}, sdtPr }
28108
+ });
28137
28109
  return result;
28138
28110
  }
28139
28111
  const tableOfContentsHandler = (params2) => {
28140
28112
  const node = params2.nodes[0];
28141
- return params2.nodeListHandler.handler({ ...params2, nodes: node.elements });
28113
+ const translatedContent = params2.nodeListHandler.handler({
28114
+ ...params2,
28115
+ nodes: node.elements,
28116
+ path: [...params2.path || [], node]
28117
+ });
28118
+ const sdtPr = params2.extraParams.sdtPr;
28119
+ const id = sdtPr.elements?.find((el) => el.name === "w:id")?.attributes["w:val"] || "";
28120
+ const result = {
28121
+ type: "documentPartObject",
28122
+ content: translatedContent,
28123
+ attrs: {
28124
+ id,
28125
+ docPartGallery: "Table of Contents",
28126
+ docPartUnique: true
28127
+ }
28128
+ };
28129
+ return result;
28142
28130
  };
28143
28131
  const validGalleryTypeMap = {
28144
28132
  "Table of Contents": tableOfContentsHandler
@@ -28796,32 +28784,32 @@ function translateAnchorNode(params2) {
28796
28784
  elements: [...anchorElements, ...elementsWithWrap]
28797
28785
  };
28798
28786
  }
28799
- const XML_NODE_NAME$6 = "wp:anchor";
28800
- const SD_NODE_NAME$6 = ["image"];
28787
+ const XML_NODE_NAME$8 = "wp:anchor";
28788
+ const SD_NODE_NAME$8 = ["image"];
28801
28789
  const validXmlAttributes$6 = ["distT", "distB", "distL", "distR"].map((xmlName) => createAttributeHandler(xmlName));
28802
- function encode$d(params2) {
28790
+ function encode$f(params2) {
28803
28791
  const { node } = params2.extraParams;
28804
28792
  if (!node || !node.type) {
28805
28793
  return null;
28806
28794
  }
28807
28795
  return handleAnchorNode(params2);
28808
28796
  }
28809
- function decode$d(params2) {
28797
+ function decode$f(params2) {
28810
28798
  const { node } = params2;
28811
28799
  if (!node || !node.type) {
28812
28800
  return null;
28813
28801
  }
28814
28802
  return translateAnchorNode(params2);
28815
28803
  }
28816
- const config$6 = {
28817
- xmlName: XML_NODE_NAME$6,
28818
- sdNodeOrKeyName: SD_NODE_NAME$6,
28804
+ const config$8 = {
28805
+ xmlName: XML_NODE_NAME$8,
28806
+ sdNodeOrKeyName: SD_NODE_NAME$8,
28819
28807
  type: NodeTranslator.translatorTypes.NODE,
28820
- encode: encode$d,
28821
- decode: decode$d,
28808
+ encode: encode$f,
28809
+ decode: decode$f,
28822
28810
  attributes: validXmlAttributes$6
28823
28811
  };
28824
- const translator$6 = NodeTranslator.from(config$6);
28812
+ const translator$8 = NodeTranslator.from(config$8);
28825
28813
  function handleInlineNode(params2) {
28826
28814
  const { node } = params2.extraParams;
28827
28815
  if (node.name !== "wp:inline") {
@@ -28837,41 +28825,41 @@ function translateInlineNode(params2) {
28837
28825
  elements: nodeElements.elements
28838
28826
  };
28839
28827
  }
28840
- const XML_NODE_NAME$5 = "wp:inline";
28841
- const SD_NODE_NAME$5 = ["image"];
28828
+ const XML_NODE_NAME$7 = "wp:inline";
28829
+ const SD_NODE_NAME$7 = ["image"];
28842
28830
  const validXmlAttributes$5 = ["distT", "distB", "distL", "distR"].map((xmlName) => createAttributeHandler(xmlName));
28843
- function encode$c(params2) {
28831
+ function encode$e(params2) {
28844
28832
  const { node } = params2.extraParams;
28845
28833
  if (!node || !node.type) {
28846
28834
  return null;
28847
28835
  }
28848
28836
  return handleInlineNode(params2);
28849
28837
  }
28850
- function decode$c(params2) {
28838
+ function decode$e(params2) {
28851
28839
  const { node } = params2;
28852
28840
  if (!node || !node.type) {
28853
28841
  return null;
28854
28842
  }
28855
28843
  return translateInlineNode(params2);
28856
28844
  }
28857
- const config$5 = {
28858
- xmlName: XML_NODE_NAME$5,
28859
- sdNodeOrKeyName: SD_NODE_NAME$5,
28845
+ const config$7 = {
28846
+ xmlName: XML_NODE_NAME$7,
28847
+ sdNodeOrKeyName: SD_NODE_NAME$7,
28860
28848
  type: NodeTranslator.translatorTypes.NODE,
28861
- encode: encode$c,
28862
- decode: decode$c,
28849
+ encode: encode$e,
28850
+ decode: decode$e,
28863
28851
  attributes: validXmlAttributes$5
28864
28852
  };
28865
- const translator$5 = NodeTranslator.from(config$5);
28866
- const XML_NODE_NAME$4 = "w:drawing";
28867
- const SD_NODE_NAME$4 = [];
28853
+ const translator$7 = NodeTranslator.from(config$7);
28854
+ const XML_NODE_NAME$6 = "w:drawing";
28855
+ const SD_NODE_NAME$6 = [];
28868
28856
  const validXmlAttributes$4 = [];
28869
- function encode$b(params2) {
28857
+ function encode$d(params2) {
28870
28858
  const nodes = params2.nodes;
28871
28859
  const node = nodes[0];
28872
28860
  const translatorByChildName = {
28873
- "wp:anchor": translator$6,
28874
- "wp:inline": translator$5
28861
+ "wp:anchor": translator$8,
28862
+ "wp:inline": translator$7
28875
28863
  };
28876
28864
  return node.elements.reduce((acc, child) => {
28877
28865
  if (acc) return acc;
@@ -28880,12 +28868,12 @@ function encode$b(params2) {
28880
28868
  return translator2.encode({ ...params2, extraParams: { node: child } }) || acc;
28881
28869
  }, null);
28882
28870
  }
28883
- function decode$b(params2) {
28871
+ function decode$d(params2) {
28884
28872
  const { node } = params2;
28885
28873
  if (!node || !node.type) {
28886
28874
  return null;
28887
28875
  }
28888
- const childTranslator = node.attrs.isAnchor ? translator$6 : translator$5;
28876
+ const childTranslator = node.attrs.isAnchor ? translator$8 : translator$7;
28889
28877
  const resultNode = childTranslator.decode(params2);
28890
28878
  return wrapTextInRun(
28891
28879
  {
@@ -28895,15 +28883,15 @@ function decode$b(params2) {
28895
28883
  []
28896
28884
  );
28897
28885
  }
28898
- const config$4 = {
28899
- xmlName: XML_NODE_NAME$4,
28900
- sdNodeOrKeyName: SD_NODE_NAME$4,
28886
+ const config$6 = {
28887
+ xmlName: XML_NODE_NAME$6,
28888
+ sdNodeOrKeyName: SD_NODE_NAME$6,
28901
28889
  type: NodeTranslator.translatorTypes.NODE,
28902
- encode: encode$b,
28903
- decode: decode$b,
28890
+ encode: encode$d,
28891
+ decode: decode$d,
28904
28892
  attributes: validXmlAttributes$4
28905
28893
  };
28906
- const translator$4 = NodeTranslator.from(config$4);
28894
+ const translator$6 = NodeTranslator.from(config$6);
28907
28895
  class CommandService {
28908
28896
  /**
28909
28897
  * @param {import('./commands/types/index.js').CommandServiceOptions} props
@@ -30241,7 +30229,7 @@ function prepareTextAnnotation(params2) {
30241
30229
  return getTextNodeForExport(attrs.displayLabel, [...marks, ...marksFromAttrs], params2);
30242
30230
  }
30243
30231
  function prepareImageAnnotation(params2, imageSize) {
30244
- return translator$4.decode({
30232
+ return translator$6.decode({
30245
30233
  ...params2,
30246
30234
  imageSize
30247
30235
  });
@@ -30461,6 +30449,49 @@ const generateSdtPrTagForDocumentSection = (id, title, tag) => {
30461
30449
  ]
30462
30450
  };
30463
30451
  };
30452
+ function translateDocumentPartObj(params2) {
30453
+ const { node } = params2;
30454
+ const { attrs = {} } = node;
30455
+ const childContent = translateChildNodes({ ...params2, nodes: node.content });
30456
+ const nodeElements = [
30457
+ {
30458
+ name: "w:sdtPr",
30459
+ elements: [
30460
+ {
30461
+ name: "w:id",
30462
+ attributes: {
30463
+ "w:val": attrs.id
30464
+ }
30465
+ },
30466
+ {
30467
+ name: "w:docPartObj",
30468
+ elements: [
30469
+ {
30470
+ name: "w:docPartGallery",
30471
+ attributes: {
30472
+ "w:val": attrs.docPartGallery
30473
+ }
30474
+ },
30475
+ ...attrs.docPartUnique ? [
30476
+ {
30477
+ name: "w:docPartUnique"
30478
+ }
30479
+ ] : []
30480
+ ]
30481
+ }
30482
+ ]
30483
+ },
30484
+ {
30485
+ name: "w:sdtContent",
30486
+ elements: childContent
30487
+ }
30488
+ ];
30489
+ const result = {
30490
+ name: "w:sdt",
30491
+ elements: nodeElements
30492
+ };
30493
+ return result;
30494
+ }
30464
30495
  function translateStructuredContent(params2) {
30465
30496
  const { node } = params2;
30466
30497
  const childContent = translateChildNodes({ ...params2, nodes: node.content });
@@ -30512,10 +30543,10 @@ function generateSdtPrTagForStructuredContent({ node }) {
30512
30543
  };
30513
30544
  return result;
30514
30545
  }
30515
- const XML_NODE_NAME$3 = "w:sdt";
30516
- const SD_NODE_NAME$3 = ["fieldAnnotation", "structuredContent", "structuredContentBlock", "documentSection"];
30546
+ const XML_NODE_NAME$5 = "w:sdt";
30547
+ const SD_NODE_NAME$5 = ["fieldAnnotation", "structuredContent", "structuredContentBlock", "documentSection"];
30517
30548
  const validXmlAttributes$3 = [];
30518
- function encode$a(params2) {
30549
+ function encode$c(params2) {
30519
30550
  const nodes = params2.nodes;
30520
30551
  const node = nodes[0];
30521
30552
  const { type: sdtType, handler: handler2 } = sdtNodeTypeStrategy(node);
@@ -30525,7 +30556,7 @@ function encode$a(params2) {
30525
30556
  const result = handler2(params2);
30526
30557
  return result;
30527
30558
  }
30528
- function decode$a(params2) {
30559
+ function decode$c(params2) {
30529
30560
  const { node } = params2;
30530
30561
  if (!node || !node.type) {
30531
30562
  return null;
@@ -30535,91 +30566,93 @@ function decode$a(params2) {
30535
30566
  structuredContent: () => translateStructuredContent(params2),
30536
30567
  structuredContentBlock: () => translateStructuredContent(params2),
30537
30568
  documentSection: () => translateDocumentSection(params2),
30569
+ documentPartObject: () => translateDocumentPartObj(params2),
30570
+ // Handled in doc-part-obj translator
30538
30571
  default: () => null
30539
30572
  };
30540
30573
  const decoder = types2[node.type] ?? types2.default;
30541
30574
  const result = decoder();
30542
30575
  return result;
30543
30576
  }
30544
- const config$3 = {
30545
- xmlName: XML_NODE_NAME$3,
30546
- sdNodeOrKeyName: SD_NODE_NAME$3,
30577
+ const config$5 = {
30578
+ xmlName: XML_NODE_NAME$5,
30579
+ sdNodeOrKeyName: SD_NODE_NAME$5,
30547
30580
  type: NodeTranslator.translatorTypes.NODE,
30548
- encode: encode$a,
30549
- decode: decode$a,
30581
+ encode: encode$c,
30582
+ decode: decode$c,
30550
30583
  attributes: validXmlAttributes$3
30551
30584
  };
30552
- const translator$3 = NodeTranslator.from(config$3);
30553
- const encode$9 = (attributes) => {
30585
+ const translator$5 = NodeTranslator.from(config$5);
30586
+ const encode$b = (attributes) => {
30554
30587
  return attributes["w:id"];
30555
30588
  };
30556
- const decode$9 = (attrs) => {
30589
+ const decode$b = (attrs) => {
30557
30590
  return attrs.id;
30558
30591
  };
30559
30592
  const attrConfig$6 = Object.freeze({
30560
30593
  xmlName: "w:id",
30561
30594
  sdName: "id",
30562
- encode: encode$9,
30563
- decode: decode$9
30595
+ encode: encode$b,
30596
+ decode: decode$b
30564
30597
  });
30565
- const encode$8 = (attributes) => {
30598
+ const encode$a = (attributes) => {
30566
30599
  return attributes["w:name"];
30567
30600
  };
30568
- const decode$8 = (attrs) => {
30601
+ const decode$a = (attrs) => {
30569
30602
  return attrs.name;
30570
30603
  };
30571
30604
  const attrConfig$5 = Object.freeze({
30572
30605
  xmlName: "w:name",
30573
30606
  sdName: "name",
30574
- encode: encode$8,
30575
- decode: decode$8
30607
+ encode: encode$a,
30608
+ decode: decode$a
30576
30609
  });
30577
- const encode$7 = (attributes) => {
30610
+ const encode$9 = (attributes) => {
30578
30611
  return attributes["w:colFirst"];
30579
30612
  };
30580
- const decode$7 = (attrs) => {
30613
+ const decode$9 = (attrs) => {
30581
30614
  return attrs.colFirst;
30582
30615
  };
30583
30616
  const attrConfig$4 = Object.freeze({
30584
30617
  xmlName: "w:colFirst",
30585
30618
  sdName: "colFirst",
30586
- encode: encode$7,
30587
- decode: decode$7
30619
+ encode: encode$9,
30620
+ decode: decode$9
30588
30621
  });
30589
- const encode$6 = (attributes) => {
30622
+ const encode$8 = (attributes) => {
30590
30623
  return attributes["w:colLast"];
30591
30624
  };
30592
- const decode$6 = (attrs) => {
30625
+ const decode$8 = (attrs) => {
30593
30626
  return attrs.colLast;
30594
30627
  };
30595
30628
  const attrConfig$3 = Object.freeze({
30596
30629
  xmlName: "w:colLast",
30597
30630
  sdName: "colLast",
30598
- encode: encode$6,
30599
- decode: decode$6
30631
+ encode: encode$8,
30632
+ decode: decode$8
30600
30633
  });
30601
- const encode$5 = (attributes) => {
30634
+ const encode$7 = (attributes) => {
30602
30635
  return attributes["w:displacedByCustomXml"];
30603
30636
  };
30604
- const decode$5 = (attrs) => {
30637
+ const decode$7 = (attrs) => {
30605
30638
  return attrs.displacedByCustomXml;
30606
30639
  };
30607
30640
  const attrConfig$2 = Object.freeze({
30608
30641
  xmlName: "w:displacedByCustomXml",
30609
30642
  sdName: "displacedByCustomXml",
30610
- encode: encode$5,
30611
- decode: decode$5
30643
+ encode: encode$7,
30644
+ decode: decode$7
30612
30645
  });
30613
30646
  const validXmlAttributes$2 = [attrConfig$6, attrConfig$5, attrConfig$4, attrConfig$3, attrConfig$2];
30614
- const XML_NODE_NAME$2 = "w:bookmarkStart";
30615
- const SD_NODE_NAME$2 = "bookmarkStart";
30616
- const encode$4 = (params2, encodedAttrs = {}) => {
30647
+ const XML_NODE_NAME$4 = "w:bookmarkStart";
30648
+ const SD_NODE_NAME$4 = "bookmarkStart";
30649
+ const encode$6 = (params2, encodedAttrs = {}) => {
30617
30650
  return {
30618
30651
  type: "bookmarkStart",
30619
30652
  attrs: encodedAttrs
30620
30653
  };
30621
30654
  };
30622
- const decode$4 = (params2, decodedAttrs = {}) => {
30655
+ const decode$6 = (params2, decodedAttrs = {}) => {
30623
30656
  const result = {
30624
30657
  name: "w:bookmarkStart",
30625
30658
  elements: []
@@ -30629,49 +30662,49 @@ const decode$4 = (params2, decodedAttrs = {}) => {
30629
30662
  }
30630
30663
  return result;
30631
30664
  };
30632
- const config$2 = {
30633
- xmlName: XML_NODE_NAME$2,
30634
- sdNodeOrKeyName: SD_NODE_NAME$2,
30665
+ const config$4 = {
30666
+ xmlName: XML_NODE_NAME$4,
30667
+ sdNodeOrKeyName: SD_NODE_NAME$4,
30635
30668
  type: NodeTranslator.translatorTypes.NODE,
30636
- encode: encode$4,
30637
- decode: decode$4,
30669
+ encode: encode$6,
30670
+ decode: decode$6,
30638
30671
  attributes: validXmlAttributes$2
30639
30672
  };
30640
- const translator$2 = NodeTranslator.from(config$2);
30641
- const encode$3 = (attributes) => {
30673
+ const translator$4 = NodeTranslator.from(config$4);
30674
+ const encode$5 = (attributes) => {
30642
30675
  return attributes["w:id"];
30643
30676
  };
30644
- const decode$3 = (attrs) => {
30677
+ const decode$5 = (attrs) => {
30645
30678
  return attrs.id;
30646
30679
  };
30647
30680
  const attrConfig$1 = Object.freeze({
30648
30681
  xmlName: "w:id",
30649
30682
  sdName: "id",
30650
- encode: encode$3,
30651
- decode: decode$3
30683
+ encode: encode$5,
30684
+ decode: decode$5
30652
30685
  });
30653
- const encode$2 = (attributes) => {
30686
+ const encode$4 = (attributes) => {
30654
30687
  return attributes["w:displacedByCustomXml"];
30655
30688
  };
30656
- const decode$2 = (attrs) => {
30689
+ const decode$4 = (attrs) => {
30657
30690
  return attrs.displacedByCustomXml;
30658
30691
  };
30659
30692
  const attrConfig = Object.freeze({
30660
30693
  xmlName: "w:displacedByCustomXml",
30661
30694
  sdName: "displacedByCustomXml",
30662
- encode: encode$2,
30663
- decode: decode$2
30695
+ encode: encode$4,
30696
+ decode: decode$4
30664
30697
  });
30665
30698
  const validXmlAttributes$1 = [attrConfig$1, attrConfig];
30666
- const XML_NODE_NAME$1 = "w:bookmarkEnd";
30667
- const SD_NODE_NAME$1 = "bookmarkEnd";
30668
- const encode$1 = (params2, encodedAttrs = {}) => {
30699
+ const XML_NODE_NAME$3 = "w:bookmarkEnd";
30700
+ const SD_NODE_NAME$3 = "bookmarkEnd";
30701
+ const encode$3 = (params2, encodedAttrs = {}) => {
30669
30702
  return {
30670
30703
  type: "bookmarkEnd",
30671
30704
  attrs: encodedAttrs
30672
30705
  };
30673
30706
  };
30674
- const decode$1 = (params2, decodedAttrs = {}) => {
30707
+ const decode$3 = (params2, decodedAttrs = {}) => {
30675
30708
  const result = {
30676
30709
  name: "w:bookmarkEnd",
30677
30710
  elements: []
@@ -30681,19 +30714,19 @@ const decode$1 = (params2, decodedAttrs = {}) => {
30681
30714
  }
30682
30715
  return result;
30683
30716
  };
30684
- const config$1 = {
30685
- xmlName: XML_NODE_NAME$1,
30686
- sdNodeOrKeyName: SD_NODE_NAME$1,
30717
+ const config$3 = {
30718
+ xmlName: XML_NODE_NAME$3,
30719
+ sdNodeOrKeyName: SD_NODE_NAME$3,
30687
30720
  type: NodeTranslator.translatorTypes.NODE,
30688
- encode: encode$1,
30689
- decode: decode$1,
30721
+ encode: encode$3,
30722
+ decode: decode$3,
30690
30723
  attributes: validXmlAttributes$1
30691
30724
  };
30692
- const translator$1 = NodeTranslator.from(config$1);
30693
- const XML_NODE_NAME = "mc:AlternateContent";
30694
- const SD_NODE_NAME = [];
30725
+ const translator$3 = NodeTranslator.from(config$3);
30726
+ const XML_NODE_NAME$2 = "mc:AlternateContent";
30727
+ const SD_NODE_NAME$2 = [];
30695
30728
  const validXmlAttributes = [];
30696
- function encode$19(params2) {
30729
+ function encode$2(params2) {
30697
30730
  const { nodeListHandler } = params2;
30698
30731
  const { node } = params2.extraParams;
30699
30732
  if (!node || !node.type) {
@@ -30713,7 +30746,7 @@ function encode$19(params2) {
30713
30746
  path: [...params2.path || [], wpsNode]
30714
30747
  });
30715
30748
  }
30716
- function decode(params2) {
30749
+ function decode$2(params2) {
30717
30750
  const { node } = params2;
30718
30751
  const { drawingContent } = node.attrs;
30719
30752
  const drawing = {
@@ -30730,13 +30763,186 @@ function decode(params2) {
30730
30763
  elements: [choice]
30731
30764
  };
30732
30765
  }
30766
+ const config$2 = {
30767
+ xmlName: XML_NODE_NAME$2,
30768
+ sdNodeOrKeyName: SD_NODE_NAME$2,
30769
+ type: NodeTranslator.translatorTypes.NODE,
30770
+ encode: encode$2,
30771
+ decode: decode$2,
30772
+ attributes: validXmlAttributes
30773
+ };
30774
+ const translator$2 = NodeTranslator.from(config$2);
30775
+ const XML_NODE_NAME$1 = "sd:pageReference";
30776
+ const SD_NODE_NAME$1 = "pageReference";
30777
+ const encode$1 = (params2, _2) => {
30778
+ const { nodes = [], nodeListHandler } = params2 || {};
30779
+ const node = nodes[0];
30780
+ const processedText = nodeListHandler.handler({
30781
+ ...params2,
30782
+ nodes: node.elements
30783
+ });
30784
+ const processedNode = {
30785
+ type: "pageReference",
30786
+ attrs: {
30787
+ instruction: node.attributes?.instruction || "",
30788
+ marksAsAttrs: node.marks || []
30789
+ },
30790
+ content: processedText
30791
+ };
30792
+ return processedNode;
30793
+ };
30794
+ const decode$1 = (params2, _2) => {
30795
+ const { node } = params2;
30796
+ const outputMarks = processOutputMarks(node.attrs?.marksAsAttrs || []);
30797
+ const contentNodes = (node.content ?? []).flatMap((n) => exportSchemaToJson({ ...params2, node: n }));
30798
+ const translated = [
30799
+ {
30800
+ name: "w:r",
30801
+ elements: [
30802
+ {
30803
+ name: "w:rPr",
30804
+ elements: outputMarks
30805
+ },
30806
+ {
30807
+ name: "w:fldChar",
30808
+ attributes: {
30809
+ "w:fldCharType": "begin"
30810
+ }
30811
+ }
30812
+ ]
30813
+ },
30814
+ {
30815
+ name: "w:r",
30816
+ elements: [
30817
+ {
30818
+ name: "w:rPr",
30819
+ elements: outputMarks
30820
+ },
30821
+ {
30822
+ name: "w:instrText",
30823
+ attributes: { "xml:space": "preserve" },
30824
+ elements: [
30825
+ {
30826
+ type: "text",
30827
+ text: `${node.attrs.instruction}`
30828
+ }
30829
+ ]
30830
+ }
30831
+ ]
30832
+ },
30833
+ {
30834
+ name: "w:r",
30835
+ elements: [
30836
+ {
30837
+ name: "w:rPr",
30838
+ elements: outputMarks
30839
+ },
30840
+ {
30841
+ name: "w:fldChar",
30842
+ attributes: {
30843
+ "w:fldCharType": "separate"
30844
+ }
30845
+ }
30846
+ ]
30847
+ },
30848
+ ...contentNodes,
30849
+ {
30850
+ name: "w:r",
30851
+ elements: [
30852
+ {
30853
+ name: "w:rPr",
30854
+ elements: outputMarks
30855
+ },
30856
+ {
30857
+ name: "w:fldChar",
30858
+ attributes: {
30859
+ "w:fldCharType": "end"
30860
+ }
30861
+ }
30862
+ ]
30863
+ }
30864
+ ];
30865
+ return translated;
30866
+ };
30867
+ const config$1 = {
30868
+ xmlName: XML_NODE_NAME$1,
30869
+ sdNodeOrKeyName: SD_NODE_NAME$1,
30870
+ type: NodeTranslator.translatorTypes.NODE,
30871
+ encode: encode$1,
30872
+ decode: decode$1
30873
+ };
30874
+ const translator$1 = NodeTranslator.from(config$1);
30875
+ const XML_NODE_NAME = "sd:tableOfContents";
30876
+ const SD_NODE_NAME = "tableOfContents";
30877
+ const encode$1c = (params2, _2) => {
30878
+ const { nodes = [], nodeListHandler } = params2 || {};
30879
+ const node = nodes[0];
30880
+ const processedContent = nodeListHandler.handler({
30881
+ ...params2,
30882
+ nodes: node.elements || []
30883
+ });
30884
+ const processedNode = {
30885
+ type: "tableOfContents",
30886
+ attrs: {
30887
+ instruction: node.attributes?.instruction || ""
30888
+ },
30889
+ content: processedContent
30890
+ };
30891
+ return processedNode;
30892
+ };
30893
+ const decode = (params2, _2) => {
30894
+ const { node } = params2;
30895
+ const contentNodes = node.content.map((n) => exportSchemaToJson({ ...params2, node: n }));
30896
+ const tocBeginElements = [
30897
+ {
30898
+ name: "w:r",
30899
+ elements: [{ name: "w:fldChar", attributes: { "w:fldCharType": "begin" }, elements: [] }]
30900
+ },
30901
+ {
30902
+ name: "w:r",
30903
+ elements: [
30904
+ {
30905
+ name: "w:instrText",
30906
+ attributes: { "xml:space": "preserve" },
30907
+ elements: [{ text: node.attrs?.instruction || "", type: "text", name: "#text", elements: [] }]
30908
+ }
30909
+ ]
30910
+ },
30911
+ { name: "w:r", elements: [{ name: "w:fldChar", attributes: { "w:fldCharType": "separate" }, elements: [] }] }
30912
+ ];
30913
+ if (contentNodes.length > 0) {
30914
+ const firstParagraph = contentNodes[0];
30915
+ let insertIndex = 0;
30916
+ if (firstParagraph.elements) {
30917
+ const pPrIndex = firstParagraph.elements.findIndex((el) => el.name === "w:pPr");
30918
+ insertIndex = pPrIndex >= 0 ? pPrIndex + 1 : 0;
30919
+ } else {
30920
+ firstParagraph.elements = [];
30921
+ }
30922
+ firstParagraph.elements.splice(insertIndex, 0, ...tocBeginElements);
30923
+ } else {
30924
+ contentNodes.push({
30925
+ name: "w:p",
30926
+ elements: tocBeginElements
30927
+ });
30928
+ }
30929
+ const tocEndElements = [
30930
+ { name: "w:r", elements: [{ name: "w:fldChar", attributes: { "w:fldCharType": "end" }, elements: [] }] }
30931
+ ];
30932
+ const lastParagraph = contentNodes[contentNodes.length - 1];
30933
+ if (lastParagraph.elements) {
30934
+ lastParagraph.elements.push(...tocEndElements);
30935
+ } else {
30936
+ lastParagraph.elements = [...tocEndElements];
30937
+ }
30938
+ return contentNodes;
30939
+ };
30733
30940
  const config = {
30734
30941
  xmlName: XML_NODE_NAME,
30735
30942
  sdNodeOrKeyName: SD_NODE_NAME,
30736
30943
  type: NodeTranslator.translatorTypes.NODE,
30737
- encode: encode$19,
30738
- decode,
30739
- attributes: validXmlAttributes
30944
+ encode: encode$1c,
30945
+ decode
30740
30946
  };
30741
30947
  const translator = NodeTranslator.from(config);
30742
30948
  const DEFAULT_SECTION_PROPS_TWIPS = Object.freeze({
@@ -30810,32 +31016,35 @@ function exportSchemaToJson(params2) {
30810
31016
  doc: translateDocumentNode,
30811
31017
  body: translateBodyNode,
30812
31018
  heading: translateHeadingNode,
30813
- paragraph: translator$13,
30814
- run: translator$U,
31019
+ paragraph: translator$16,
31020
+ run: translator$V,
30815
31021
  text: translateTextNode,
30816
31022
  bulletList: translateList,
30817
31023
  orderedList: translateList,
30818
- lineBreak: translator$16,
30819
- table: translator$9,
30820
- tableRow: translator$G,
30821
- tableCell: translator$8,
30822
- bookmarkStart: translator$2,
30823
- bookmarkEnd: translator$1,
30824
- fieldAnnotation: translator$3,
30825
- tab: translator$14,
30826
- image: translator$4,
30827
- hardBreak: translator$16,
31024
+ lineBreak: translator$19,
31025
+ table: translator$a,
31026
+ tableRow: translator$H,
31027
+ tableCell: translator$9,
31028
+ bookmarkStart: translator$4,
31029
+ bookmarkEnd: translator$3,
31030
+ fieldAnnotation: translator$5,
31031
+ tab: translator$17,
31032
+ image: translator$6,
31033
+ hardBreak: translator$19,
30828
31034
  commentRangeStart: () => translateCommentNode(params2, "Start"),
30829
31035
  commentRangeEnd: () => translateCommentNode(params2, "End"),
30830
31036
  commentReference: () => null,
30831
31037
  shapeContainer: translateShapeContainer,
30832
31038
  shapeTextbox: translateShapeTextbox,
30833
31039
  contentBlock: translateContentBlock,
30834
- structuredContent: translator$3,
30835
- structuredContentBlock: translator$3,
30836
- documentSection: translator$3,
31040
+ structuredContent: translator$5,
31041
+ structuredContentBlock: translator$5,
31042
+ documentPartObject: translator$5,
31043
+ documentSection: translator$5,
30837
31044
  "page-number": translatePageNumberNode,
30838
- "total-page-number": translateTotalPageNumberNode
31045
+ "total-page-number": translateTotalPageNumberNode,
31046
+ pageReference: translator$1,
31047
+ tableOfContents: translator
30839
31048
  };
30840
31049
  let handler2 = router[type2];
30841
31050
  if (handler2 && "decode" in handler2 && typeof handler2.decode === "function") {
@@ -31173,8 +31382,6 @@ function translateTextNode(params2) {
31173
31382
  const trackedMarks = [TrackInsertMarkName, TrackDeleteMarkName];
31174
31383
  const isTrackedNode = node.marks?.some((m2) => trackedMarks.includes(m2.type));
31175
31384
  if (isTrackedNode) return translateTrackedNode(params2);
31176
- const isLinkNode = node.marks?.some((m2) => m2.type === "link");
31177
- if (isLinkNode) return translator$7.decode(params2);
31178
31385
  const { text, marks = [] } = node;
31179
31386
  return getTextNodeForExport(text, marks, params2);
31180
31387
  }
@@ -31480,7 +31687,7 @@ function translateMark(mark) {
31480
31687
  markElement.type = "element";
31481
31688
  break;
31482
31689
  case "underline": {
31483
- const translated = translator$10.decode({
31690
+ const translated = translator$13.decode({
31484
31691
  node: {
31485
31692
  attrs: {
31486
31693
  underlineType: attrs.underlineType ?? attrs.underline ?? null,
@@ -31544,7 +31751,7 @@ function translateMark(mark) {
31544
31751
  break;
31545
31752
  case "highlight": {
31546
31753
  const highlightValue = attrs.color ?? attrs.highlight ?? null;
31547
- const translated = translator$15.decode({ node: { attrs: { highlight: highlightValue } } });
31754
+ const translated = translator$18.decode({ node: { attrs: { highlight: highlightValue } } });
31548
31755
  return translated || {};
31549
31756
  }
31550
31757
  }
@@ -31604,7 +31811,7 @@ function translateContentBlock(params2) {
31604
31811
  if (vmlAttributes || horizontalRule) {
31605
31812
  return translateVRectContentBlock(params2);
31606
31813
  }
31607
- const alternateContent = translator.decode(params2);
31814
+ const alternateContent = translator$2.decode(params2);
31608
31815
  return wrapTextInRun(alternateContent);
31609
31816
  }
31610
31817
  function translateVRectContentBlock(params2) {
@@ -31750,6 +31957,7 @@ const getAutoPageJson = (type2, outputMarks = []) => {
31750
31957
  },
31751
31958
  {
31752
31959
  name: "w:instrText",
31960
+ attributes: { "xml:space": "preserve" },
31753
31961
  elements: [
31754
31962
  {
31755
31963
  type: "text",
@@ -31809,7 +32017,7 @@ const handleDrawingNode = (params2) => {
31809
32017
  if (mainNode.name === "w:drawing") node = mainNode;
31810
32018
  else node = mainNode.elements.find((el) => el.name === "w:drawing");
31811
32019
  if (!node) return { nodes: [], consumed: 0 };
31812
- const schemaNode = translator$4.encode(params2);
32020
+ const schemaNode = translator$6.encode(params2);
31813
32021
  const newNodes = schemaNode ? [schemaNode] : [];
31814
32022
  return { nodes: newNodes, consumed: 1 };
31815
32023
  };
@@ -31911,8 +32119,8 @@ const trackChangeNodeHandlerEntity = {
31911
32119
  handlerName: "trackChangeNodeHandler",
31912
32120
  handler: handleTrackChangeNode
31913
32121
  };
31914
- const hyperlinkNodeHandlerEntity = generateV2HandlerEntity("hyperlinkNodeHandler", translator$7);
31915
- const runNodeHandlerEntity = generateV2HandlerEntity("runNodeHandler", translator$U);
32122
+ const hyperlinkNodeHandlerEntity = generateV2HandlerEntity("hyperlinkNodeHandler", translator$W);
32123
+ const runNodeHandlerEntity = generateV2HandlerEntity("runNodeHandler", translator$V);
31916
32124
  const handleTextNode = (params2) => {
31917
32125
  const { nodes, insideTrackChange } = params2;
31918
32126
  if (nodes.length === 0 || !(nodes[0].name === "w:t" || insideTrackChange && nodes[0].name === "w:delText")) {
@@ -31953,7 +32161,7 @@ const handleParagraphNode = (params2) => {
31953
32161
  if (nodes.length === 0 || nodes[0].name !== "w:p") {
31954
32162
  return { nodes: [], consumed: 0 };
31955
32163
  }
31956
- const schemaNode = translator$13.encode(params2);
32164
+ const schemaNode = translator$16.encode(params2);
31957
32165
  const newNodes = schemaNode ? [schemaNode] : [];
31958
32166
  return { nodes: newNodes, consumed: 1 };
31959
32167
  };
@@ -31966,7 +32174,7 @@ const handleSdtNode = (params2) => {
31966
32174
  if (nodes.length === 0 || nodes[0].name !== "w:sdt") {
31967
32175
  return { nodes: [], consumed: 0 };
31968
32176
  }
31969
- const result = translator$3.encode(params2);
32177
+ const result = translator$5.encode(params2);
31970
32178
  if (!result) {
31971
32179
  return { nodes: [], consumed: 0 };
31972
32180
  }
@@ -32056,7 +32264,7 @@ const handler = (params2) => {
32056
32264
  if (nodes.length === 0 || nodes[0].name !== "w:br") {
32057
32265
  return { nodes: [], consumed: 0 };
32058
32266
  }
32059
- const result = translator$16.encode(params2);
32267
+ const result = translator$19.encode(params2);
32060
32268
  if (!result) return { nodes: [], consumed: 0 };
32061
32269
  return {
32062
32270
  nodes: [result],
@@ -32128,7 +32336,7 @@ const handleBookmarkStartNode = (params2) => {
32128
32336
  if (isCustomMarkBookmark(nodes[0], params2.editor)) {
32129
32337
  return handleBookmarkNode(params2);
32130
32338
  }
32131
- const node = translator$2.encode(params2);
32339
+ const node = translator$4.encode(params2);
32132
32340
  if (!node) return { nodes: [], consumed: 0 };
32133
32341
  return { nodes: [node], consumed: 1 };
32134
32342
  };
@@ -32160,7 +32368,7 @@ const handleBookmarkEndNode = (params2) => {
32160
32368
  if (!nodes.length || nodes[0].name !== "w:bookmarkEnd") {
32161
32369
  return { nodes: [], consumed: 0 };
32162
32370
  }
32163
- const node = translator$1.encode(params2);
32371
+ const node = translator$3.encode(params2);
32164
32372
  if (!node) return { nodes: [], consumed: 0 };
32165
32373
  return { nodes: [node], consumed: 1 };
32166
32374
  };
@@ -32293,6 +32501,7 @@ const autoTotalPageCountEntity = {
32293
32501
  handlerName: "autoTotalPageCountEntity",
32294
32502
  handler: handleAutoTotalPageNumber
32295
32503
  };
32504
+ const pageReferenceEntity = generateV2HandlerEntity("pageReferenceNodeHandler", translator$1);
32296
32505
  const handlePictNode = (params2) => {
32297
32506
  const { nodes } = params2;
32298
32507
  if (!nodes.length || nodes[0].name !== "w:p") {
@@ -32791,6 +33000,7 @@ const getDefaultStyleDefinition = (defaultStyleId, docx) => {
32791
33000
  const spacing = pPr?.elements?.find((el) => el.name === "w:spacing");
32792
33001
  const justify = pPr?.elements?.find((el) => el.name === "w:jc");
32793
33002
  const indent = pPr?.elements?.find((el) => el.name === "w:ind");
33003
+ const tabs = pPr?.elements?.find((el) => el.name === "w:tabs");
32794
33004
  let lineSpaceBefore, lineSpaceAfter, line;
32795
33005
  if (spacing) {
32796
33006
  lineSpaceBefore = twipsToPixels(spacing?.attributes["w:before"]);
@@ -32804,6 +33014,22 @@ const getDefaultStyleDefinition = (defaultStyleId, docx) => {
32804
33014
  rightIndent = twipsToPixels(indent?.attributes["w:right"]);
32805
33015
  firstLine = twipsToPixels(indent?.attributes["w:firstLine"]);
32806
33016
  }
33017
+ let tabStops = [];
33018
+ if (tabs) {
33019
+ tabStops = (tabs.elements || []).filter((el) => el.name === "w:tab").map((tab) => {
33020
+ let val = tab.attributes["w:val"];
33021
+ if (val == "left") {
33022
+ val = "start";
33023
+ } else if (val == "right") {
33024
+ val = "end";
33025
+ }
33026
+ return {
33027
+ val,
33028
+ pos: twipsToPixels(tab.attributes["w:pos"]),
33029
+ leader: tab.attributes["w:leader"]
33030
+ };
33031
+ });
33032
+ }
32807
33033
  const keepNext = pPr?.elements?.find((el) => el.name === "w:keepNext");
32808
33034
  const keepLines = pPr?.elements?.find((el) => el.name === "w:keepLines");
32809
33035
  const outlineLevel = pPr?.elements?.find((el) => el.name === "w:outlineLvl");
@@ -32836,7 +33062,8 @@ const getDefaultStyleDefinition = (defaultStyleId, docx) => {
32836
33062
  const parsedStyles = {
32837
33063
  spacing: { lineSpaceAfter, lineSpaceBefore, line },
32838
33064
  textAlign,
32839
- indent: { leftIndent, rightIndent, firstLine }
33065
+ indent: { leftIndent, rightIndent, firstLine },
33066
+ tabStops: tabStops.length > 0 ? tabStops : null
32840
33067
  };
32841
33068
  parsedMarks.forEach((mark) => {
32842
33069
  const { type: type2, attrs } = mark;
@@ -32860,13 +33087,213 @@ const handleTabNode = (params2) => {
32860
33087
  if (!nodes.length || nodes[0].name !== "w:tab") {
32861
33088
  return { nodes: [], consumed: 0 };
32862
33089
  }
32863
- const node = translator$14.encode(params2);
33090
+ const node = translator$17.encode(params2);
32864
33091
  return { nodes: [node], consumed: 1 };
32865
33092
  };
32866
33093
  const tabNodeEntityHandler = {
32867
33094
  handlerName: "w:tabTranslator",
32868
33095
  handler: handleTabNode
32869
33096
  };
33097
+ const tableOfContentsHandlerEntity = generateV2HandlerEntity("tableOfContentsHandler", translator);
33098
+ function preProcessPageInstruction(nodesToCombine, _2, __) {
33099
+ const pageNumNode = {
33100
+ name: "sd:autoPageNumber",
33101
+ type: "element"
33102
+ };
33103
+ nodesToCombine.forEach((n) => {
33104
+ const rPrNode = n.elements.find((el) => el.name === "w:rPr");
33105
+ if (rPrNode) pageNumNode.elements = [rPrNode];
33106
+ });
33107
+ return [pageNumNode];
33108
+ }
33109
+ function preProcessNumPagesInstruction(nodesToCombine, _2, __) {
33110
+ const totalPageNumNode = {
33111
+ name: "sd:totalPageNumber",
33112
+ type: "element"
33113
+ };
33114
+ nodesToCombine.forEach((n) => {
33115
+ const rPrNode = n.elements?.find((el) => el.name === "w:rPr");
33116
+ if (rPrNode) totalPageNumNode.elements = [rPrNode];
33117
+ });
33118
+ return [totalPageNumNode];
33119
+ }
33120
+ function preProcessPageRefInstruction(nodesToCombine, instrText, _2) {
33121
+ const pageRefNode = {
33122
+ name: "sd:pageReference",
33123
+ type: "element",
33124
+ attributes: {
33125
+ instruction: instrText
33126
+ },
33127
+ elements: nodesToCombine
33128
+ };
33129
+ return [pageRefNode];
33130
+ }
33131
+ function preProcessHyperlinkInstruction(nodesToCombine, instruction, docx) {
33132
+ const urlMatch = instruction.match(/HYPERLINK\s+"([^"]+)"/);
33133
+ let linkAttributes;
33134
+ if (urlMatch && urlMatch.length >= 2) {
33135
+ const url = urlMatch[1];
33136
+ const rels = docx["word/_rels/document.xml.rels"];
33137
+ const relationships = rels?.elements.find((el) => el.name === "Relationships");
33138
+ if (relationships) {
33139
+ const rId = generateDocxRandomId();
33140
+ relationships.elements.push({
33141
+ type: "element",
33142
+ name: "Relationship",
33143
+ attributes: {
33144
+ Id: rId,
33145
+ Type: "http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink",
33146
+ Target: url,
33147
+ TargetMode: "External"
33148
+ }
33149
+ });
33150
+ linkAttributes = { "r:id": rId };
33151
+ } else {
33152
+ linkAttributes = { "w:anchor": url };
33153
+ }
33154
+ } else {
33155
+ const availableSwitches = {
33156
+ "w:anchor": `l "(?<value>[^"]+)"`,
33157
+ new_window: `
33158
+ `,
33159
+ "w:tgtFrame": ` "(?<value>[^"]+)"`,
33160
+ "w:tooltip": `o "(?<value>[^"]+)"`
33161
+ };
33162
+ const parsedSwitches = {};
33163
+ for (const [key2, regex] of Object.entries(availableSwitches)) {
33164
+ const match = instruction.match(new RegExp(regex));
33165
+ if (match) {
33166
+ parsedSwitches[key2] = match.groups?.value || true;
33167
+ }
33168
+ }
33169
+ if (parsedSwitches.new_window) {
33170
+ parsedSwitches["w:tgtFrame"] = "_blank";
33171
+ delete parsedSwitches.new_window;
33172
+ }
33173
+ linkAttributes = { ...parsedSwitches };
33174
+ }
33175
+ return [
33176
+ {
33177
+ name: "w:hyperlink",
33178
+ type: "element",
33179
+ attributes: linkAttributes,
33180
+ elements: nodesToCombine
33181
+ }
33182
+ ];
33183
+ }
33184
+ function preProcessTocInstruction(nodesToCombine, instrText) {
33185
+ return [
33186
+ {
33187
+ name: "sd:tableOfContents",
33188
+ type: "element",
33189
+ attributes: {
33190
+ instruction: instrText
33191
+ },
33192
+ elements: nodesToCombine
33193
+ }
33194
+ ];
33195
+ }
33196
+ const getInstructionPreProcessor = (instruction) => {
33197
+ const instructionType = instruction.split(" ")[0];
33198
+ switch (instructionType) {
33199
+ case "PAGE":
33200
+ return preProcessPageInstruction;
33201
+ case "NUMPAGES":
33202
+ return preProcessNumPagesInstruction;
33203
+ case "PAGEREF":
33204
+ return preProcessPageRefInstruction;
33205
+ case "HYPERLINK":
33206
+ return preProcessHyperlinkInstruction;
33207
+ case "TOC":
33208
+ return preProcessTocInstruction;
33209
+ default:
33210
+ return null;
33211
+ }
33212
+ };
33213
+ const preProcessNodesForFldChar = (nodes = [], docx) => {
33214
+ const processedNodes = [];
33215
+ let collectedNodesStack = [];
33216
+ let currentFieldStack = [];
33217
+ let unpairedEnd = null;
33218
+ let collecting = false;
33219
+ const finalizeField = () => {
33220
+ if (collecting) {
33221
+ const collectedNodes = collectedNodesStack.pop().filter((n) => n !== null);
33222
+ const currentField = currentFieldStack.pop();
33223
+ const combined = _processCombinedNodesForFldChar(collectedNodes, currentField.instrText.trim(), docx);
33224
+ if (collectedNodesStack.length === 0) {
33225
+ processedNodes.push(...combined);
33226
+ } else {
33227
+ collectedNodesStack[collectedNodesStack.length - 1].push(...combined);
33228
+ }
33229
+ } else {
33230
+ unpairedEnd = true;
33231
+ }
33232
+ };
33233
+ for (const node of nodes) {
33234
+ const fldCharEl = node.elements?.find((el) => el.name === "w:fldChar");
33235
+ const fldType = fldCharEl?.attributes?.["w:fldCharType"];
33236
+ const instrTextEl = node.elements?.find((el) => el.name === "w:instrText");
33237
+ collecting = collectedNodesStack.length > 0;
33238
+ if (fldType === "begin") {
33239
+ collectedNodesStack.push([null]);
33240
+ currentFieldStack.push({ instrText: "" });
33241
+ continue;
33242
+ }
33243
+ if (instrTextEl && collecting && currentFieldStack.length > 0) {
33244
+ currentFieldStack[currentFieldStack.length - 1].instrText += (instrTextEl.elements?.[0]?.text || "") + " ";
33245
+ continue;
33246
+ }
33247
+ if (fldType === "end") {
33248
+ finalizeField();
33249
+ continue;
33250
+ } else if (fldType === "separate") {
33251
+ continue;
33252
+ }
33253
+ if (Array.isArray(node.elements)) {
33254
+ const childResult = preProcessNodesForFldChar(node.elements, docx);
33255
+ node.elements = childResult.processedNodes;
33256
+ if (childResult.unpairedBegin) {
33257
+ childResult.unpairedBegin.forEach((pendingField) => {
33258
+ currentFieldStack.push(pendingField.fieldInfo);
33259
+ collectedNodesStack.push([node]);
33260
+ });
33261
+ } else if (childResult.unpairedEnd) {
33262
+ collectedNodesStack[collectedNodesStack.length - 1].push(node);
33263
+ finalizeField();
33264
+ } else if (collecting) {
33265
+ collectedNodesStack[collectedNodesStack.length - 1].push(node);
33266
+ } else {
33267
+ processedNodes.push(node);
33268
+ }
33269
+ } else if (collecting) {
33270
+ collectedNodesStack[collectedNodesStack.length - 1].push(node);
33271
+ } else {
33272
+ processedNodes.push(node);
33273
+ }
33274
+ }
33275
+ let unpairedBegin = null;
33276
+ if (collectedNodesStack.length > 0) {
33277
+ unpairedBegin = [];
33278
+ for (let i = 0; i < collectedNodesStack.length; i++) {
33279
+ processedNodes.push(...collectedNodesStack[i].filter((n) => n !== null));
33280
+ unpairedBegin.push({
33281
+ nodes: collectedNodesStack[i],
33282
+ fieldInfo: currentFieldStack[i]
33283
+ });
33284
+ }
33285
+ }
33286
+ return { processedNodes, unpairedBegin, unpairedEnd };
33287
+ };
33288
+ const _processCombinedNodesForFldChar = (nodesToCombine = [], instrText, docx) => {
33289
+ const instructionType = instrText.trim().split(" ")[0];
33290
+ const instructionPreProcessor = getInstructionPreProcessor(instructionType);
33291
+ if (instructionPreProcessor) {
33292
+ return instructionPreProcessor(nodesToCombine, instrText, docx);
33293
+ } else {
33294
+ return nodesToCombine;
33295
+ }
33296
+ };
32870
33297
  const createDocumentJson = (docx, converter, editor) => {
32871
33298
  const json = carbonCopy(getInitialJSON(docx));
32872
33299
  if (!json) return null;
@@ -32896,6 +33323,8 @@ const createDocumentJson = (docx, converter, editor) => {
32896
33323
  if (bodyNode) {
32897
33324
  ensureSectionProperties(bodyNode);
32898
33325
  const node = bodyNode;
33326
+ const { processedNodes } = preProcessNodesForFldChar(node.elements ?? [], docx);
33327
+ node.elements = processedNodes;
32899
33328
  const contentElements = node.elements?.filter((n) => n.name !== "w:sectPr") ?? [];
32900
33329
  const content = pruneIgnoredNodes(contentElements);
32901
33330
  const comments = importCommentData({ docx, converter, editor });
@@ -32951,8 +33380,10 @@ const defaultNodeListHandler = () => {
32951
33380
  trackChangeNodeHandlerEntity,
32952
33381
  tableNodeHandlerEntity,
32953
33382
  tabNodeEntityHandler,
33383
+ tableOfContentsHandlerEntity,
32954
33384
  autoPageHandlerEntity,
32955
33385
  autoTotalPageCountEntity,
33386
+ pageReferenceEntity,
32956
33387
  standardNodeHandlerEntity
32957
33388
  ];
32958
33389
  const handler2 = createNodeListHandler(entities);
@@ -41659,8 +42090,7 @@ function readDOMChange(view, from2, to, typeOver, addedNodes) {
41659
42090
  let $to = parse.doc.resolveNoCache(change.endB - parse.from);
41660
42091
  let $fromA = doc2.resolve(change.start);
41661
42092
  let inlineChange = $from.sameParent($to) && $from.parent.inlineContent && $fromA.end() >= change.endA;
41662
- let nextSel;
41663
- if ((ios && view.input.lastIOSEnter > Date.now() - 225 && (!inlineChange || addedNodes.some((n) => n.nodeName == "DIV" || n.nodeName == "P")) || !inlineChange && $from.pos < parse.doc.content.size && (!$from.sameParent($to) || !$from.parent.inlineContent) && !/\S/.test(parse.doc.textBetween($from.pos, $to.pos, "", "")) && (nextSel = Selection.findFrom(parse.doc.resolve($from.pos + 1), 1, true)) && nextSel.head > $from.pos) && view.someProp("handleKeyDown", (f) => f(view, keyEvent(13, "Enter")))) {
42093
+ if ((ios && view.input.lastIOSEnter > Date.now() - 225 && (!inlineChange || addedNodes.some((n) => n.nodeName == "DIV" || n.nodeName == "P")) || !inlineChange && $from.pos < parse.doc.content.size && (!$from.sameParent($to) || !$from.parent.inlineContent) && $from.pos < $to.pos && !/\S/.test(parse.doc.textBetween($from.pos, $to.pos, "", ""))) && view.someProp("handleKeyDown", (f) => f(view, keyEvent(13, "Enter")))) {
41664
42094
  view.input.lastIOSEnter = 0;
41665
42095
  return;
41666
42096
  }
@@ -53804,6 +54234,17 @@ function getStructuredContentTagsById(idOrIds, state2) {
53804
54234
  });
53805
54235
  return result;
53806
54236
  }
54237
+ function getStructuredContentTagsByAlias(aliasOrAliases, state2) {
54238
+ const result = findChildren$5(state2.doc, (node) => {
54239
+ const isStructuredContent = ["structuredContent", "structuredContentBlock"].includes(node.type.name);
54240
+ if (Array.isArray(aliasOrAliases)) {
54241
+ return isStructuredContent && aliasOrAliases.includes(node.attrs.alias);
54242
+ } else {
54243
+ return isStructuredContent && node.attrs.alias === aliasOrAliases;
54244
+ }
54245
+ });
54246
+ return result;
54247
+ }
53807
54248
  function getStructuredContentTags(state2) {
53808
54249
  const result = findChildren$5(state2.doc, (node) => {
53809
54250
  return node.type.name === "structuredContent" || node.type.name === "structuredContentBlock";
@@ -53823,6 +54264,7 @@ const structuredContentHelpers = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ O
53823
54264
  getStructuredContentBlockTags,
53824
54265
  getStructuredContentInlineTags,
53825
54266
  getStructuredContentTags,
54267
+ getStructuredContentTagsByAlias,
53826
54268
  getStructuredContentTagsById
53827
54269
  }, Symbol.toStringTag, { value: "Module" }));
53828
54270
  const STRUCTURED_CONTENT_NAMES = ["structuredContent", "structuredContentBlock"];
@@ -53911,10 +54353,11 @@ const StructuredContentCommands = Extension.create({
53911
54353
  return true;
53912
54354
  },
53913
54355
  /**
53914
- * Updates a structured content attributes or content.
54356
+ * Updates a single structured content field by its unique ID.
54357
+ * IDs are unique identifiers, so this will update at most one field.
53915
54358
  * If the updated node does not match the schema, it will not be updated.
53916
54359
  * @category Command
53917
- * @param {string} id
54360
+ * @param {string} id - Unique identifier of the field
53918
54361
  * @param {StructuredContentUpdate} options
53919
54362
  */
53920
54363
  updateStructuredContentById: (id, options = {}) => ({ editor, dispatch, state: state2, tr }) => {
@@ -53954,6 +54397,58 @@ const StructuredContentCommands = Extension.create({
53954
54397
  }
53955
54398
  return true;
53956
54399
  },
54400
+ /**
54401
+ * Updates all structured content fields with the same alias.
54402
+ * Unlike IDs (which are unique), aliases can be shared across multiple fields.
54403
+ * This will update every field that matches the given alias.
54404
+ * If any updated node does not match the schema, no updates will be applied.
54405
+ * @category Command
54406
+ * @param {string | string[]} alias - Shared identifier for fields (e.g., "customer_name")
54407
+ * @param {StructuredContentUpdate} options
54408
+ */
54409
+ updateStructuredContentByAlias: (alias, options = {}) => ({ editor, dispatch, state: state2, tr }) => {
54410
+ const structuredContentTags = getStructuredContentTagsByAlias(alias, state2);
54411
+ if (!structuredContentTags.length) {
54412
+ return true;
54413
+ }
54414
+ const { schema } = editor;
54415
+ const createContent = (node) => {
54416
+ if (options.text) {
54417
+ return schema.text(options.text);
54418
+ }
54419
+ if (options.html) {
54420
+ const html = htmlHandler(options.html, editor);
54421
+ const doc2 = DOMParser$1.fromSchema(schema).parse(html);
54422
+ return doc2.content;
54423
+ }
54424
+ if (options.json) {
54425
+ return schema.nodeFromJSON(options.json);
54426
+ }
54427
+ return node.content;
54428
+ };
54429
+ for (const { node } of structuredContentTags) {
54430
+ const content = createContent(node);
54431
+ const updatedNode = node.type.create({ ...node.attrs, ...options.attrs }, content, node.marks);
54432
+ try {
54433
+ updatedNode.check();
54434
+ } catch {
54435
+ console.error("Updated node does not conform to the schema");
54436
+ return false;
54437
+ }
54438
+ }
54439
+ if (dispatch) {
54440
+ structuredContentTags.forEach(({ pos, node }) => {
54441
+ const mappedPos = tr.mapping.map(pos);
54442
+ const currentNode = tr.doc.nodeAt(mappedPos);
54443
+ if (currentNode && node.eq(currentNode)) {
54444
+ const content = createContent(node);
54445
+ const updatedNode = node.type.create({ ...node.attrs, ...options.attrs }, content, node.marks);
54446
+ tr.replaceWith(mappedPos, mappedPos + node.nodeSize, updatedNode);
54447
+ }
54448
+ });
54449
+ }
54450
+ return true;
54451
+ },
53957
54452
  /**
53958
54453
  * Removes a structured content.
53959
54454
  * @category Command
@@ -54407,6 +54902,48 @@ const DocumentSection = Node$1.create({
54407
54902
  };
54408
54903
  }
54409
54904
  });
54905
+ const DocumentPartObject = Node$1.create({
54906
+ name: "documentPartObject",
54907
+ group: "block",
54908
+ content: "block*",
54909
+ isolating: true,
54910
+ addOptions() {
54911
+ return {
54912
+ htmlAttributes: {
54913
+ class: "sd-document-part-object-block",
54914
+ "aria-label": "Structured document part block"
54915
+ }
54916
+ };
54917
+ },
54918
+ parseDOM() {
54919
+ return [
54920
+ {
54921
+ tag: "div.sd-document-part-object-block",
54922
+ priority: 60
54923
+ }
54924
+ ];
54925
+ },
54926
+ renderDOM({ htmlAttributes }) {
54927
+ return ["div", Attribute2.mergeAttributes(this.options.htmlAttributes, htmlAttributes), 0];
54928
+ },
54929
+ addAttributes() {
54930
+ return {
54931
+ sdBlockId: {
54932
+ default: null,
54933
+ keepOnSplit: false,
54934
+ parseDOM: (elem) => elem.getAttribute("data-sd-block-id"),
54935
+ renderDOM: (attrs) => {
54936
+ return attrs.sdBlockId ? { "data-sd-block-id": attrs.sdBlockId } : {};
54937
+ }
54938
+ },
54939
+ id: {},
54940
+ docPartGallery: {},
54941
+ docPartUnique: {
54942
+ default: true
54943
+ }
54944
+ };
54945
+ }
54946
+ });
54410
54947
  const Document = Node$1.create({
54411
54948
  name: "doc",
54412
54949
  topNode: true,
@@ -55543,7 +56080,12 @@ const generateDecorations = (state2, styles) => {
55543
56080
  return { ...base2, ...linkedStyle.definition?.styles || {} };
55544
56081
  };
55545
56082
  const pMap = buildStyleMap(paragraphStyleId);
55546
- const tMap = buildStyleMap(inlineTextStyleId);
56083
+ let tMap;
56084
+ if (paragraphStyleId?.startsWith("TOC")) {
56085
+ tMap = {};
56086
+ } else {
56087
+ tMap = buildStyleMap(inlineTextStyleId);
56088
+ }
55547
56089
  const rMap = buildStyleMap(runStyleId);
55548
56090
  const finalStyles = { ...pMap, ...tMap, ...rMap };
55549
56091
  if (Object.keys(finalStyles).length === 0) return;
@@ -56840,7 +57382,7 @@ const CommentsMark = Mark2.create({
56840
57382
  });
56841
57383
  const defaultTabDistance = 48;
56842
57384
  const defaultLineLength = 816;
56843
- const getTabDecorations = (doc2, view, from2 = 0, to = null) => {
57385
+ const getTabDecorations = (doc2, view, helpers2, from2 = 0, to = null) => {
56844
57386
  const decorations = [];
56845
57387
  const paragraphCache = /* @__PURE__ */ new Map();
56846
57388
  const end2 = to ?? doc2.content.size;
@@ -56848,7 +57390,7 @@ const getTabDecorations = (doc2, view, from2 = 0, to = null) => {
56848
57390
  if (node.type.name !== "tab") return;
56849
57391
  let extraStyles = "";
56850
57392
  const $pos = doc2.resolve(pos);
56851
- const paragraphContext = getParagraphContext($pos, paragraphCache);
57393
+ const paragraphContext = getParagraphContext($pos, paragraphCache, helpers2);
56852
57394
  if (!paragraphContext) return;
56853
57395
  try {
56854
57396
  const { tabStops, flattened, startPos } = paragraphContext;
@@ -56903,18 +57445,27 @@ const getTabDecorations = (doc2, view, from2 = 0, to = null) => {
56903
57445
  });
56904
57446
  return decorations;
56905
57447
  };
56906
- function getParagraphContext($pos, cache2) {
57448
+ function getParagraphContext($pos, cache2, helpers2) {
56907
57449
  for (let depth = $pos.depth; depth >= 0; depth--) {
56908
57450
  const node = $pos.node(depth);
56909
57451
  if (node?.type?.name === "paragraph") {
56910
57452
  const startPos = $pos.start(depth);
56911
57453
  if (!cache2.has(startPos)) {
57454
+ let tabStops = [];
57455
+ if (Array.isArray(node.attrs?.tabStops)) {
57456
+ tabStops = node.attrs.tabStops;
57457
+ } else {
57458
+ const style2 = helpers2.linkedStyles.getStyleById(node.attrs?.styleId);
57459
+ if (Array.isArray(style2?.definition?.styles?.tabStops)) {
57460
+ tabStops = style2.definition.styles.tabStops;
57461
+ }
57462
+ }
56912
57463
  cache2.set(startPos, {
56913
57464
  paragraph: node,
56914
57465
  paragraphDepth: depth,
56915
57466
  startPos,
56916
57467
  indent: node.attrs?.indent || {},
56917
- tabStops: Array.isArray(node.attrs?.tabStops) ? node.attrs.tabStops : [],
57468
+ tabStops,
56918
57469
  flattened: flattenParagraph(node, startPos),
56919
57470
  accumulatedTabWidth: 0
56920
57471
  });
@@ -57080,7 +57631,7 @@ const TabNode = Node$1.create({
57080
57631
  };
57081
57632
  },
57082
57633
  addPmPlugins() {
57083
- const { view } = this.editor;
57634
+ const { view, helpers: helpers2 } = this.editor;
57084
57635
  const tabPlugin = new Plugin({
57085
57636
  name: "tabPlugin",
57086
57637
  key: new PluginKey("tabPlugin"),
@@ -57090,7 +57641,7 @@ const TabNode = Node$1.create({
57090
57641
  },
57091
57642
  apply(tr, { decorations }, _oldState, newState) {
57092
57643
  if (!decorations) {
57093
- decorations = DecorationSet.create(newState.doc, getTabDecorations(newState.doc, view));
57644
+ decorations = DecorationSet.create(newState.doc, getTabDecorations(newState.doc, view, helpers2));
57094
57645
  }
57095
57646
  if (!tr.docChanged) {
57096
57647
  return { decorations };
@@ -57130,7 +57681,7 @@ const TabNode = Node$1.create({
57130
57681
  rangesToRecalculate.forEach(([start2, end2]) => {
57131
57682
  const oldDecorations = decorations.find(start2, end2);
57132
57683
  decorations = decorations.remove(oldDecorations);
57133
- const newDecorations = getTabDecorations(newState.doc, view, start2, end2);
57684
+ const newDecorations = getTabDecorations(newState.doc, view, helpers2, start2, end2);
57134
57685
  decorations = decorations.add(newState.doc, newDecorations);
57135
57686
  });
57136
57687
  return { decorations };
@@ -62039,6 +62590,7 @@ function getFormatAttrsFromMarks(marks) {
62039
62590
  }
62040
62591
  return formatAttrs;
62041
62592
  }
62593
+ const DEFAULT_MIME_TYPE = "application/octet-stream";
62042
62594
  const simpleHash = (str) => {
62043
62595
  let hash2 = 0;
62044
62596
  for (let i = 0; i < str.length; i++) {
@@ -62048,21 +62600,40 @@ const simpleHash = (str) => {
62048
62600
  }
62049
62601
  return Math.abs(hash2).toString();
62050
62602
  };
62051
- const base64ToFile = (base64String) => {
62052
- const arr = base64String.split(",");
62053
- const mimeMatch = arr[0].match(/:(.*?);/);
62054
- const mimeType = mimeMatch ? mimeMatch[1] : "";
62055
- const data = arr[1];
62056
- const binaryString = atob(data);
62603
+ const decodeBase64ToBinaryString = (data) => {
62604
+ if (!data) return "";
62605
+ if (typeof atob === "function") {
62606
+ return atob(data);
62607
+ }
62608
+ if (typeof Buffer2 !== "undefined" && typeof Buffer2.from === "function") {
62609
+ return Buffer2.from(data, "base64").toString("binary");
62610
+ }
62611
+ throw new Error("Unable to decode base64 payload in the current environment.");
62612
+ };
62613
+ const extractBase64Meta = (base64String) => {
62614
+ const [meta = "", payload = ""] = base64String.split(",");
62615
+ const mimeMatch = meta.match(/:(.*?);/);
62616
+ const rawMimeType = mimeMatch ? mimeMatch[1] : "";
62617
+ const mimeType = rawMimeType || DEFAULT_MIME_TYPE;
62618
+ const binaryString = decodeBase64ToBinaryString(payload);
62057
62619
  const hash2 = simpleHash(binaryString);
62058
62620
  const extension = mimeType.split("/")[1] || "bin";
62059
62621
  const filename = `image-${hash2}.${extension}`;
62622
+ return { mimeType, binaryString, filename };
62623
+ };
62624
+ const getBase64FileMeta = (base64String) => {
62625
+ const { mimeType, filename } = extractBase64Meta(base64String);
62626
+ return { mimeType, filename };
62627
+ };
62628
+ const base64ToFile = (base64String) => {
62629
+ const { mimeType, binaryString, filename } = extractBase64Meta(base64String);
62630
+ const fileType = mimeType || DEFAULT_MIME_TYPE;
62060
62631
  const bytes = new Uint8Array(binaryString.length);
62061
62632
  for (let i = 0; i < binaryString.length; i++) {
62062
62633
  bytes[i] = binaryString.charCodeAt(i);
62063
62634
  }
62064
- const blob = new Blob([bytes], { type: mimeType });
62065
- return new File([blob], filename, { type: mimeType });
62635
+ const blob = new Blob([bytes], { type: fileType });
62636
+ return new File([blob], filename, { type: fileType });
62066
62637
  };
62067
62638
  const urlToFile = async (url, filename, mimeType) => {
62068
62639
  try {
@@ -62438,6 +63009,7 @@ function addImageRelationship({ editor, path }) {
62438
63009
  }
62439
63010
  }
62440
63011
  const key = new PluginKey("ImageRegistration");
63012
+ const WORD_MEDIA_PREFIX = "word/";
62441
63013
  const ImageRegistrationPlugin = ({ editor }) => {
62442
63014
  const { view } = editor;
62443
63015
  return new Plugin({
@@ -62458,16 +63030,16 @@ const ImageRegistrationPlugin = ({ editor }) => {
62458
63030
  },
62459
63031
  appendTransaction: (trs, _oldState, state2) => {
62460
63032
  let foundImages = [];
62461
- trs.forEach((tr2) => {
62462
- if (tr2.docChanged) {
62463
- tr2.steps.forEach((step, index2) => {
63033
+ trs.forEach((tr) => {
63034
+ if (tr.docChanged) {
63035
+ tr.steps.forEach((step, index2) => {
62464
63036
  const stepMap = step.getMap();
62465
63037
  foundImages = foundImages.map(({ node, pos, id }) => {
62466
63038
  const mappedPos = stepMap.map(pos, -1);
62467
63039
  return { node, pos: mappedPos, id };
62468
63040
  });
62469
63041
  if (step instanceof ReplaceStep || step instanceof ReplaceAroundStep$1) {
62470
- (tr2.docs[index2 + 1] || tr2.doc).nodesBetween(
63042
+ (tr.docs[index2 + 1] || tr.doc).nodesBetween(
62471
63043
  stepMap.map(step.from, -1),
62472
63044
  stepMap.map(step.to, 1),
62473
63045
  (node, pos) => {
@@ -62486,22 +63058,10 @@ const ImageRegistrationPlugin = ({ editor }) => {
62486
63058
  if (!foundImages || foundImages.length === 0) {
62487
63059
  return null;
62488
63060
  }
62489
- registerImages(foundImages, editor, view);
62490
- const tr = state2.tr;
62491
- let { set } = key.getState(state2);
62492
- foundImages.slice().sort((a, b2) => a.pos - b2.pos).forEach(({ pos, id }) => {
62493
- let deco = Decoration.widget(pos, () => document.createElement("placeholder"), {
62494
- side: -1,
62495
- id
62496
- });
62497
- set = set.add(tr.doc, [deco]);
62498
- });
62499
- foundImages.slice().sort((a, b2) => b2.pos - a.pos).forEach(({ node, pos }) => {
62500
- tr.delete(pos, pos + node.nodeSize);
62501
- });
62502
- set = set.map(tr.mapping, tr.doc);
62503
- tr.setMeta(key, { set });
62504
- return tr;
63061
+ if (editor.options.isHeadless) {
63062
+ return handleNodePath(foundImages, editor, state2);
63063
+ }
63064
+ return handleBrowserPath(foundImages, editor, view, state2);
62505
63065
  },
62506
63066
  props: {
62507
63067
  decorations(state2) {
@@ -62511,6 +63071,59 @@ const ImageRegistrationPlugin = ({ editor }) => {
62511
63071
  }
62512
63072
  });
62513
63073
  };
63074
+ const derivePreferredFileName = (src) => {
63075
+ if (typeof src !== "string" || src.length === 0) {
63076
+ return "image.bin";
63077
+ }
63078
+ if (src.startsWith("data:")) {
63079
+ return getBase64FileMeta(src).filename;
63080
+ }
63081
+ const lastSegment = src.split("/").pop() ?? "";
63082
+ const trimmed = lastSegment.split(/[?#]/)[0];
63083
+ return trimmed || "image.bin";
63084
+ };
63085
+ const handleNodePath = (foundImages, editor, state2) => {
63086
+ const { tr } = state2;
63087
+ const mediaStore = editor.storage.image.media ?? {};
63088
+ if (!editor.storage.image.media) {
63089
+ editor.storage.image.media = mediaStore;
63090
+ }
63091
+ const existingFileNames = new Set(Object.keys(mediaStore).map((key2) => key2.split("/").pop()));
63092
+ foundImages.forEach(({ node, pos }) => {
63093
+ const { src } = node.attrs;
63094
+ const preferredFileName = derivePreferredFileName(src);
63095
+ const uniqueFileName = ensureUniqueFileName(preferredFileName, existingFileNames);
63096
+ existingFileNames.add(uniqueFileName);
63097
+ const mediaPath = buildMediaPath(uniqueFileName);
63098
+ mediaStore[mediaPath] = src;
63099
+ const path = mediaPath.startsWith(WORD_MEDIA_PREFIX) ? mediaPath.slice(WORD_MEDIA_PREFIX.length) : mediaPath;
63100
+ const rId = addImageRelationship({ editor, path });
63101
+ tr.setNodeMarkup(pos, void 0, {
63102
+ ...node.attrs,
63103
+ src: mediaPath,
63104
+ rId
63105
+ });
63106
+ });
63107
+ return tr;
63108
+ };
63109
+ const handleBrowserPath = (foundImages, editor, view, state2) => {
63110
+ registerImages(foundImages, editor, view);
63111
+ const tr = state2.tr;
63112
+ let { set } = key.getState(state2);
63113
+ foundImages.slice().sort((a, b2) => a.pos - b2.pos).forEach(({ pos, id }) => {
63114
+ let deco = Decoration.widget(pos, () => document.createElement("placeholder"), {
63115
+ side: -1,
63116
+ id
63117
+ });
63118
+ set = set.add(tr.doc, [deco]);
63119
+ });
63120
+ foundImages.slice().sort((a, b2) => b2.pos - a.pos).forEach(({ node, pos }) => {
63121
+ tr.delete(pos, pos + node.nodeSize);
63122
+ });
63123
+ set = set.map(tr.mapping, tr.doc);
63124
+ tr.setMeta(key, { set });
63125
+ return tr;
63126
+ };
62514
63127
  const findPlaceholder = (state2, id) => {
62515
63128
  let { set } = key.getState(state2);
62516
63129
  let found2 = set?.find(null, null, (spec) => spec.id === id);
@@ -63411,6 +64024,43 @@ const processMarks = (marks) => {
63411
64024
  });
63412
64025
  return styles;
63413
64026
  };
64027
+ const PageReference = Node$1.create({
64028
+ name: "pageReference",
64029
+ group: "inline",
64030
+ inline: true,
64031
+ atom: true,
64032
+ draggable: false,
64033
+ selectable: false,
64034
+ content: "inline*",
64035
+ addOptions() {
64036
+ return {
64037
+ htmlAttributes: {
64038
+ contenteditable: false,
64039
+ "data-id": "auto-page-reference",
64040
+ "aria-label": "Page reference node",
64041
+ class: "sd-editor-page-reference"
64042
+ }
64043
+ };
64044
+ },
64045
+ addAttributes() {
64046
+ return {
64047
+ marksAsAttrs: {
64048
+ default: null,
64049
+ rendered: false
64050
+ },
64051
+ instruction: {
64052
+ default: "",
64053
+ rendered: false
64054
+ }
64055
+ };
64056
+ },
64057
+ parseDOM() {
64058
+ return [{ tag: 'span[data-id="auto-page-reference"]' }];
64059
+ },
64060
+ renderDOM({ htmlAttributes }) {
64061
+ return ["span", Attribute2.mergeAttributes(this.options.htmlAttributes, htmlAttributes), 0];
64062
+ }
64063
+ });
63414
64064
  const ShapeContainer = Node$1.create({
63415
64065
  name: "shapeContainer",
63416
64066
  group: "block",
@@ -63824,6 +64474,51 @@ const checkForNewBlockNodesInTrs = (transactions) => {
63824
64474
  });
63825
64475
  });
63826
64476
  };
64477
+ const TableOfContents = Node$1.create({
64478
+ name: "tableOfContents",
64479
+ group: "block",
64480
+ content: "paragraph+",
64481
+ inline: false,
64482
+ addOptions() {
64483
+ return {
64484
+ htmlAttributes: {
64485
+ "data-id": "table-of-contents",
64486
+ "aria-label": "Table of Contents"
64487
+ }
64488
+ };
64489
+ },
64490
+ parseDOM() {
64491
+ return [
64492
+ {
64493
+ tag: 'div[data-id="table-of-contents"]'
64494
+ }
64495
+ ];
64496
+ },
64497
+ renderDOM({ htmlAttributes }) {
64498
+ return ["div", Attribute2.mergeAttributes(this.options.htmlAttributes, htmlAttributes), 0];
64499
+ },
64500
+ addAttributes() {
64501
+ return {
64502
+ instruction: {
64503
+ default: null,
64504
+ rendered: false
64505
+ },
64506
+ /**
64507
+ * @private
64508
+ * @category Attribute
64509
+ * @param {string} [sdBlockId] - Internal block tracking ID (not user-configurable)
64510
+ */
64511
+ sdBlockId: {
64512
+ default: null,
64513
+ keepOnSplit: false,
64514
+ parseDOM: (elem) => elem.getAttribute("data-sd-block-id"),
64515
+ renderDOM: (attrs) => {
64516
+ return attrs.sdBlockId ? { "data-sd-block-id": attrs.sdBlockId } : {};
64517
+ }
64518
+ }
64519
+ };
64520
+ }
64521
+ });
63827
64522
  const TextStyle = Mark2.create({
63828
64523
  name: "textStyle",
63829
64524
  addOptions() {
@@ -69546,6 +70241,7 @@ function getActualBreakCoords(view, pos, calculatedThreshold) {
69546
70241
  return actualBreak;
69547
70242
  }
69548
70243
  const onImageLoad = (editor) => {
70244
+ if (typeof requestAnimationFrame !== "function") return;
69549
70245
  requestAnimationFrame(() => {
69550
70246
  const newTr = editor.view.state.tr;
69551
70247
  newTr.setMeta("forceUpdatePagination", true);
@@ -70430,6 +71126,7 @@ const getStarterExtensions = () => {
70430
71126
  SlashMenu,
70431
71127
  Strike,
70432
71128
  TabNode,
71129
+ TableOfContents,
70433
71130
  Text,
70434
71131
  TextAlign,
70435
71132
  TextIndent,
@@ -70464,6 +71161,7 @@ const getStarterExtensions = () => {
70464
71161
  AiLoaderNode,
70465
71162
  PageNumber,
70466
71163
  TotalPageCount,
71164
+ PageReference,
70467
71165
  ShapeContainer,
70468
71166
  ShapeTextbox,
70469
71167
  ContentBlock,
@@ -70472,6 +71170,7 @@ const getStarterExtensions = () => {
70472
71170
  StructuredContentBlock,
70473
71171
  StructuredContentCommands,
70474
71172
  DocumentSection,
71173
+ DocumentPartObject,
70475
71174
  NodeResizer,
70476
71175
  CustomSelection,
70477
71176
  TextTransform
@@ -70754,7 +71453,7 @@ const _sfc_main$4$1 = {
70754
71453
  };
70755
71454
  const handleInputSubmit = () => {
70756
71455
  const value = inlineTextInput.value;
70757
- const cleanValue = value.replace(/[^0-9]/g, "");
71456
+ const cleanValue = value.match(/^\d+(\.5)?$/) ? value : Math.floor(parseFloat(value)).toString();
70758
71457
  emit("textSubmit", cleanValue);
70759
71458
  inlineTextInput.value = cleanValue;
70760
71459
  };
@@ -70836,7 +71535,7 @@ const _sfc_main$4$1 = {
70836
71535
  };
70837
71536
  }
70838
71537
  };
70839
- const ToolbarButton = /* @__PURE__ */ _export_sfc(_sfc_main$4$1, [["__scopeId", "data-v-303b3245"]]);
71538
+ const ToolbarButton = /* @__PURE__ */ _export_sfc(_sfc_main$4$1, [["__scopeId", "data-v-cea02a58"]]);
70840
71539
  const _hoisted_1$2$1 = {
70841
71540
  class: "toolbar-separator",
70842
71541
  role: "separator",
@@ -86008,71 +86707,73 @@ const _sfc_main = {
86008
86707
  };
86009
86708
  const SuperInput = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-4d5cff52"]]);
86010
86709
  const additionalHandlers = Object.freeze({
86011
- "mc:AlternateContent": translator,
86012
- "w:b": translator$12,
86013
- "w:bidiVisual": translator$F,
86014
- "w:bookmarkEnd": translator$1,
86015
- "w:bookmarkStart": translator$2,
86016
- "w:bottom": translator$s,
86017
- "w:br": translator$16,
86018
- "w:cantSplit": translator$T,
86019
- "w:cnfStyle": translator$S,
86020
- "w:color": translator$_,
86021
- "w:divId": translator$R,
86022
- "w:drawing": translator$4,
86023
- "w:end": translator$q,
86024
- "w:gridAfter": translator$Q,
86025
- "w:gridBefore": translator$P,
86026
- "w:gridCol": translator$b,
86027
- "w:hidden": translator$O,
86028
- "w:highlight": translator$15,
86029
- "w:hyperlink": translator$7,
86030
- "w:i": translator$11,
86031
- "w:insideH": translator$o,
86032
- "w:insideV": translator$n,
86033
- "w:jc": translator$N,
86034
- "w:left": translator$m,
86035
- "w:p": translator$13,
86036
- "w:r": translator$U,
86037
- "w:rFonts": translator$Z,
86038
- "w:rPr": translator$V,
86039
- "w:rStyle": translator$Y,
86040
- "w:right": translator$k,
86041
- "w:sdt": translator$3,
86042
- "w:shd": translator$E,
86043
- "w:start": translator$i,
86044
- "w:strike": translator$$,
86045
- "w:sz": translator$X,
86046
- "w:szCs": translator$W,
86047
- "w:tab": translator$14,
86048
- "w:tbl": translator$9,
86049
- "w:tblBorders": translator$e,
86050
- "w:tblCaption": translator$D,
86051
- "w:tblCellMar": translator$d,
86052
- "w:tblCellSpacing": translator$M,
86053
- "w:tblDescription": translator$C,
86054
- "w:tblGrid": translator$a,
86055
- "w:tblHeader": translator$L,
86056
- "w:tblInd": translator$B,
86057
- "w:tblLayout": translator$A,
86058
- "w:tblLook": translator$z,
86059
- "w:tblOverlap": translator$y,
86060
- "w:tblPr": translator$c,
86061
- "w:tblStyle": translator$x,
86062
- "w:tblStyleColBandSize": translator$w,
86063
- "w:tblStyleRowBandSize": translator$v,
86064
- "w:tblW": translator$u,
86065
- "w:tblpPr": translator$t,
86066
- "w:tc": translator$8,
86067
- "w:top": translator$g,
86068
- "w:tr": translator$G,
86069
- "w:trHeight": translator$K,
86070
- "w:trPr": translator$H,
86071
- "w:u": translator$10,
86072
- "w:wAfter": translator$J,
86073
- "w:wBefore": translator$I,
86074
- "wp:anchor": translator$6,
86075
- "wp:inline": translator$5
86710
+ "mc:AlternateContent": translator$2,
86711
+ "sd:pageReference": translator$1,
86712
+ "sd:tableOfContents": translator,
86713
+ "w:b": translator$15,
86714
+ "w:bidiVisual": translator$G,
86715
+ "w:bookmarkEnd": translator$3,
86716
+ "w:bookmarkStart": translator$4,
86717
+ "w:bottom": translator$t,
86718
+ "w:br": translator$19,
86719
+ "w:cantSplit": translator$U,
86720
+ "w:cnfStyle": translator$T,
86721
+ "w:color": translator$11,
86722
+ "w:divId": translator$S,
86723
+ "w:drawing": translator$6,
86724
+ "w:end": translator$r,
86725
+ "w:gridAfter": translator$R,
86726
+ "w:gridBefore": translator$Q,
86727
+ "w:gridCol": translator$c,
86728
+ "w:hidden": translator$P,
86729
+ "w:highlight": translator$18,
86730
+ "w:hyperlink": translator$W,
86731
+ "w:i": translator$14,
86732
+ "w:insideH": translator$p,
86733
+ "w:insideV": translator$o,
86734
+ "w:jc": translator$O,
86735
+ "w:left": translator$n,
86736
+ "w:p": translator$16,
86737
+ "w:r": translator$V,
86738
+ "w:rFonts": translator$10,
86739
+ "w:rPr": translator$X,
86740
+ "w:rStyle": translator$$,
86741
+ "w:right": translator$l,
86742
+ "w:sdt": translator$5,
86743
+ "w:shd": translator$F,
86744
+ "w:start": translator$j,
86745
+ "w:strike": translator$12,
86746
+ "w:sz": translator$_,
86747
+ "w:szCs": translator$Z,
86748
+ "w:tab": translator$17,
86749
+ "w:tbl": translator$a,
86750
+ "w:tblBorders": translator$f,
86751
+ "w:tblCaption": translator$E,
86752
+ "w:tblCellMar": translator$e,
86753
+ "w:tblCellSpacing": translator$N,
86754
+ "w:tblDescription": translator$D,
86755
+ "w:tblGrid": translator$b,
86756
+ "w:tblHeader": translator$M,
86757
+ "w:tblInd": translator$C,
86758
+ "w:tblLayout": translator$B,
86759
+ "w:tblLook": translator$A,
86760
+ "w:tblOverlap": translator$z,
86761
+ "w:tblPr": translator$d,
86762
+ "w:tblStyle": translator$y,
86763
+ "w:tblStyleColBandSize": translator$x,
86764
+ "w:tblStyleRowBandSize": translator$w,
86765
+ "w:tblW": translator$v,
86766
+ "w:tblpPr": translator$u,
86767
+ "w:tc": translator$9,
86768
+ "w:top": translator$h,
86769
+ "w:tr": translator$H,
86770
+ "w:trHeight": translator$L,
86771
+ "w:trPr": translator$I,
86772
+ "w:u": translator$13,
86773
+ "w:wAfter": translator$K,
86774
+ "w:wBefore": translator$J,
86775
+ "wp:anchor": translator$8,
86776
+ "wp:inline": translator$7
86076
86777
  });
86077
86778
  const baseHandlers = {
86078
86779
  ...runPropertyTranslators,