@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,4 +1,4 @@
1
- import { g as global$2, c as createElementBlock, o as openBlock, a as createBaseVNode, r as ref$1, b as createApp, d as computed, F as Fragment$1, e as renderList, n as normalizeClass, w as withModifiers, f as createCommentVNode, t as toDisplayString, i as inject, h as onBeforeMount, j as onMounted, k as onBeforeUnmount, l as watch, m as defineComponent, p as getCurrentInstance, q as onDeactivated, s as nextTick, u as createBlock, v as createVNode, x as unref, y as withCtx, z as createTextVNode, A as normalizeStyle, B as h$1, C as toRef, D as provide, E as mergeProps, G as cloneVNode, T as Text$2, H as withDirectives, I as watchEffect, J as shallowRef, K as vModelText, L as withKeys, M as reactive, N as readonly, O as Transition, P as vShow, Q as Comment, R as renderSlot, S as onActivated, U as Teleport, V as isVNode, W as onUnmounted, X as resolveDynamicComponent, Y as normalizeProps, Z as guardReactiveProps, _ as markRaw } from "./vue-CXxsqYcP.es.js";
1
+ import { g as global$2, c as createElementBlock, o as openBlock, a as createBaseVNode, r as ref$1, b as createApp, d as computed, F as Fragment$1, e as renderList, n as normalizeClass, w as withModifiers, f as createCommentVNode, t as toDisplayString, i as inject, h as onBeforeMount, j as onMounted, k as onBeforeUnmount, l as watch, m as defineComponent, p as getCurrentInstance, q as onDeactivated, s as nextTick, u as createBlock, v as createVNode, x as unref, y as withCtx, z as createTextVNode, A as normalizeStyle, B as h$1, C as toRef, D as provide, E as mergeProps, G as cloneVNode, T as Text$2, H as withDirectives, I as watchEffect, J as shallowRef, K as vModelText, L as withKeys, M as reactive, N as readonly, O as Transition, P as vShow, Q as Comment, R as renderSlot, S as onActivated, U as Teleport, V as isVNode, W as onUnmounted, X as resolveDynamicComponent, Y as normalizeProps, Z as guardReactiveProps, _ as markRaw } from "./vue-ZWZLQtoU.es.js";
2
2
  import * as Y from "yjs";
3
3
  import { UndoManager, Item as Item$2, ContentType, Text as Text$1, XmlElement, encodeStateAsUpdate } from "yjs";
4
4
  var __defProp$2 = Object.defineProperty;
@@ -5094,6 +5094,19 @@ function requireSafeRegexTest() {
5094
5094
  };
5095
5095
  return safeRegexTest;
5096
5096
  }
5097
+ var generatorFunction;
5098
+ var hasRequiredGeneratorFunction;
5099
+ function requireGeneratorFunction() {
5100
+ if (hasRequiredGeneratorFunction) return generatorFunction;
5101
+ hasRequiredGeneratorFunction = 1;
5102
+ const cached = (
5103
+ /** @type {GeneratorFunctionConstructor} */
5104
+ function* () {
5105
+ }.constructor
5106
+ );
5107
+ generatorFunction = () => cached;
5108
+ return generatorFunction;
5109
+ }
5097
5110
  var isGeneratorFunction;
5098
5111
  var hasRequiredIsGeneratorFunction;
5099
5112
  function requireIsGeneratorFunction() {
@@ -5106,16 +5119,7 @@ function requireIsGeneratorFunction() {
5106
5119
  var getProto2 = requireGetProto();
5107
5120
  var toStr = callBound2("Object.prototype.toString");
5108
5121
  var fnToStr = callBound2("Function.prototype.toString");
5109
- var getGeneratorFunc = function() {
5110
- if (!hasToStringTag) {
5111
- return false;
5112
- }
5113
- try {
5114
- return Function("return function*() {}")();
5115
- } catch (e) {
5116
- }
5117
- };
5118
- var GeneratorFunction;
5122
+ var getGeneratorFunction = /* @__PURE__ */ requireGeneratorFunction();
5119
5123
  isGeneratorFunction = function isGeneratorFunction2(fn2) {
5120
5124
  if (typeof fn2 !== "function") {
5121
5125
  return false;
@@ -5130,14 +5134,8 @@ function requireIsGeneratorFunction() {
5130
5134
  if (!getProto2) {
5131
5135
  return false;
5132
5136
  }
5133
- if (typeof GeneratorFunction === "undefined") {
5134
- var generatorFunc = getGeneratorFunc();
5135
- GeneratorFunction = generatorFunc ? (
5136
- /** @type {GeneratorFunctionConstructor} */
5137
- getProto2(generatorFunc)
5138
- ) : false;
5139
- }
5140
- return getProto2(fn2) === GeneratorFunction;
5137
+ var GeneratorFunction = getGeneratorFunction();
5138
+ return GeneratorFunction && getProto2(fn2) === GeneratorFunction.prototype;
5141
5139
  };
5142
5140
  return isGeneratorFunction;
5143
5141
  }
@@ -22968,13 +22966,56 @@ function translateChildNodes(params2) {
22968
22966
  const { content: nodes } = params2.node;
22969
22967
  if (!nodes) return [];
22970
22968
  const translatedNodes = [];
22971
- nodes.forEach((node) => {
22969
+ const hyperlinkGroup = [];
22970
+ let index2 = 0;
22971
+ while (index2 < nodes.length) {
22972
+ const node = nodes[index2];
22973
+ const linkMark = _isLinkNode(node);
22974
+ if (linkMark) {
22975
+ hyperlinkGroup.push(node);
22976
+ const nextNode = index2 + 1 < nodes.length ? nodes[index2 + 1] : null;
22977
+ const nextIsLink = _isLinkNode(nextNode, linkMark);
22978
+ if (nextIsLink) {
22979
+ index2++;
22980
+ continue;
22981
+ } else {
22982
+ let translatedLinkGroup = exportSchemaToJson({
22983
+ ...params2,
22984
+ node: hyperlinkGroup[0],
22985
+ extraParams: { ...params2.extraParams || {}, hyperlinkGroup: hyperlinkGroup.slice() }
22986
+ });
22987
+ if (translatedLinkGroup instanceof Array) translatedNodes.push(...translatedLinkGroup);
22988
+ else translatedNodes.push(translatedLinkGroup);
22989
+ hyperlinkGroup.length = 0;
22990
+ index2++;
22991
+ continue;
22992
+ }
22993
+ }
22972
22994
  let translatedNode = exportSchemaToJson({ ...params2, node });
22973
22995
  if (translatedNode instanceof Array) translatedNodes.push(...translatedNode);
22974
22996
  else translatedNodes.push(translatedNode);
22975
- });
22997
+ index2++;
22998
+ }
22976
22999
  return translatedNodes.filter((n) => n);
22977
23000
  }
23001
+ function _isLinkNode(node, referenceMark = null) {
23002
+ if (!node || !node.marks && !node.attrs?.marksAsAttrs) return null;
23003
+ const marks = node.marks || node.attrs.marksAsAttrs;
23004
+ const linkMark = marks.find((mark) => mark.type === "link");
23005
+ if (!linkMark) return null;
23006
+ if (referenceMark) {
23007
+ return _isSameLinkMark(linkMark.attrs, referenceMark.attrs) ? linkMark : null;
23008
+ }
23009
+ return linkMark;
23010
+ }
23011
+ function _isSameLinkMark(attrsA, attrsB) {
23012
+ for (let key2 of ["anchor", "docLocation", "history", "href", "rId", "target"]) {
23013
+ if (attrsA[key2] != attrsB[key2]) {
23014
+ return false;
23015
+ }
23016
+ }
23017
+ return true;
23018
+ }
22978
23019
  const baseNumbering = {
22979
23020
  declaration: {
22980
23021
  attributes: {
@@ -24321,37 +24362,37 @@ const _NodeTranslator = class _NodeTranslator2 {
24321
24362
  };
24322
24363
  __publicField$2(_NodeTranslator, "translatorTypes", TranslatorTypes);
24323
24364
  let NodeTranslator = _NodeTranslator;
24324
- const encode$18 = (attributes) => {
24365
+ const encode$1b = (attributes) => {
24325
24366
  return attributes["w:type"];
24326
24367
  };
24327
- const decode$$ = (attrs) => {
24368
+ const decode$11 = (attrs) => {
24328
24369
  const { lineBreakType } = attrs;
24329
24370
  return lineBreakType;
24330
24371
  };
24331
24372
  const attrConfig$F = Object.freeze({
24332
24373
  xmlName: "w:type",
24333
24374
  sdName: "lineBreakType",
24334
- encode: encode$18,
24335
- decode: decode$$
24375
+ encode: encode$1b,
24376
+ decode: decode$11
24336
24377
  });
24337
- const encode$17 = (attributes) => {
24378
+ const encode$1a = (attributes) => {
24338
24379
  const xmlAttrValue = attributes["w:clear"];
24339
24380
  return xmlAttrValue;
24340
24381
  };
24341
- const decode$_ = (attrs) => {
24382
+ const decode$10 = (attrs) => {
24342
24383
  const { clear } = attrs;
24343
24384
  return clear;
24344
24385
  };
24345
24386
  const attrConfig$E = Object.freeze({
24346
24387
  xmlName: "w:clear",
24347
24388
  sdName: "clear",
24348
- encode: encode$17,
24349
- decode: decode$_
24389
+ encode: encode$1a,
24390
+ decode: decode$10
24350
24391
  });
24351
24392
  const validXmlAttributes$m = [attrConfig$F, attrConfig$E];
24352
- const XML_NODE_NAME$u = "w:br";
24353
- const SD_NODE_NAME$d = "lineBreak";
24354
- const encode$16 = (_2, encodedAttrs) => {
24393
+ const XML_NODE_NAME$x = "w:br";
24394
+ const SD_NODE_NAME$f = "lineBreak";
24395
+ const encode$19 = (_2, encodedAttrs) => {
24355
24396
  const isPageBreak = encodedAttrs?.lineBreakType === "page";
24356
24397
  const translated = {
24357
24398
  type: isPageBreak ? "hardBreak" : "lineBreak"
@@ -24361,7 +24402,7 @@ const encode$16 = (_2, encodedAttrs) => {
24361
24402
  }
24362
24403
  return translated;
24363
24404
  };
24364
- const decode$Z = (params2, decodedAttrs) => {
24405
+ const decode$$ = (params2, decodedAttrs) => {
24365
24406
  const { node } = params2;
24366
24407
  if (!node) return;
24367
24408
  const wBreak = { name: "w:br" };
@@ -24378,39 +24419,39 @@ const decode$Z = (params2, decodedAttrs) => {
24378
24419
  };
24379
24420
  return translated;
24380
24421
  };
24381
- const config$s = {
24382
- xmlName: XML_NODE_NAME$u,
24383
- sdNodeOrKeyName: SD_NODE_NAME$d,
24422
+ const config$v = {
24423
+ xmlName: XML_NODE_NAME$x,
24424
+ sdNodeOrKeyName: SD_NODE_NAME$f,
24384
24425
  type: NodeTranslator.translatorTypes.NODE,
24385
- encode: encode$16,
24386
- decode: decode$Z,
24426
+ encode: encode$19,
24427
+ decode: decode$$,
24387
24428
  attributes: validXmlAttributes$m
24388
24429
  };
24389
- const translator$16 = NodeTranslator.from(config$s);
24390
- const encode$15 = (attributes) => attributes?.["w:val"];
24391
- const decode$Y = (attrs) => attrs?.highlight;
24430
+ const translator$19 = NodeTranslator.from(config$v);
24431
+ const encode$18 = (attributes) => attributes?.["w:val"];
24432
+ const decode$_ = (attrs) => attrs?.highlight;
24392
24433
  const attrConfig$D = Object.freeze({
24393
24434
  xmlName: "w:val",
24394
24435
  sdName: "highlight",
24395
- encode: encode$15,
24396
- decode: decode$Y
24436
+ encode: encode$18,
24437
+ decode: decode$_
24397
24438
  });
24398
24439
  const validXmlAttributes$l = [attrConfig$D];
24399
- const XML_NODE_NAME$t = "w:highlight";
24400
- const SD_ATTR_KEY$f = "highlight";
24440
+ const XML_NODE_NAME$w = "w:highlight";
24441
+ const SD_ATTR_KEY$g = "highlight";
24401
24442
  const DISABLED_TOKENS = /* @__PURE__ */ new Set(["transparent", "none", "inherit"]);
24402
- const encode$14 = (params2, encodedAttrs = {}) => {
24443
+ const encode$17 = (params2, encodedAttrs = {}) => {
24403
24444
  const { nodes } = params2;
24404
24445
  const node = nodes?.[0];
24405
24446
  const value = encodedAttrs.highlight ?? node?.attributes?.["w:val"];
24406
24447
  return {
24407
24448
  type: "attr",
24408
- xmlName: XML_NODE_NAME$t,
24409
- sdNodeOrKeyName: SD_ATTR_KEY$f,
24449
+ xmlName: XML_NODE_NAME$w,
24450
+ sdNodeOrKeyName: SD_ATTR_KEY$g,
24410
24451
  attributes: { "w:val": value ?? null }
24411
24452
  };
24412
24453
  };
24413
- const decode$X = (params2) => {
24454
+ const decode$Z = (params2) => {
24414
24455
  const attrs = params2?.node?.attrs || {};
24415
24456
  const highlightValue = attrs.highlight ?? attrs.color ?? null;
24416
24457
  if (!highlightValue) return void 0;
@@ -24418,14 +24459,14 @@ const decode$X = (params2) => {
24418
24459
  if (!normalizedValue) return void 0;
24419
24460
  if (DISABLED_TOKENS.has(normalizedValue)) {
24420
24461
  return {
24421
- name: XML_NODE_NAME$t,
24462
+ name: XML_NODE_NAME$w,
24422
24463
  attributes: { "w:val": "none" }
24423
24464
  };
24424
24465
  }
24425
24466
  const keyword = getDocxHighlightKeywordFromHex(highlightValue);
24426
24467
  if (keyword) {
24427
24468
  return {
24428
- name: XML_NODE_NAME$t,
24469
+ name: XML_NODE_NAME$w,
24429
24470
  attributes: { "w:val": keyword }
24430
24471
  };
24431
24472
  }
@@ -24440,63 +24481,63 @@ const decode$X = (params2) => {
24440
24481
  }
24441
24482
  };
24442
24483
  };
24443
- const config$r = {
24444
- xmlName: XML_NODE_NAME$t,
24445
- sdNodeOrKeyName: SD_ATTR_KEY$f,
24484
+ const config$u = {
24485
+ xmlName: XML_NODE_NAME$w,
24486
+ sdNodeOrKeyName: SD_ATTR_KEY$g,
24446
24487
  type: NodeTranslator.translatorTypes.ATTRIBUTE,
24447
- encode: encode$14,
24448
- decode: decode$X,
24488
+ encode: encode$17,
24489
+ decode: decode$Z,
24449
24490
  attributes: validXmlAttributes$l
24450
24491
  };
24451
- const translator$15 = NodeTranslator.from(config$r);
24452
- const encode$13 = (attributes) => {
24492
+ const translator$18 = NodeTranslator.from(config$u);
24493
+ const encode$16 = (attributes) => {
24453
24494
  return attributes["w:val"];
24454
24495
  };
24455
- const decode$W = (attrs) => {
24496
+ const decode$Y = (attrs) => {
24456
24497
  const { tabSize } = attrs || {};
24457
24498
  return tabSize;
24458
24499
  };
24459
24500
  const attrConfig$C = Object.freeze({
24460
24501
  xmlName: "w:val",
24461
24502
  sdName: "tabSize",
24462
- encode: encode$13,
24463
- decode: decode$W
24503
+ encode: encode$16,
24504
+ decode: decode$Y
24464
24505
  });
24465
- const encode$12 = (attributes) => {
24506
+ const encode$15 = (attributes) => {
24466
24507
  return attributes["w:leader"];
24467
24508
  };
24468
- const decode$V = (attrs) => {
24509
+ const decode$X = (attrs) => {
24469
24510
  const { leader } = attrs || {};
24470
24511
  return leader;
24471
24512
  };
24472
24513
  const attrConfig$B = Object.freeze({
24473
24514
  xmlName: "w:leader",
24474
24515
  sdName: "leader",
24475
- encode: encode$12,
24476
- decode: decode$V
24516
+ encode: encode$15,
24517
+ decode: decode$X
24477
24518
  });
24478
- const encode$11 = (attributes) => {
24519
+ const encode$14 = (attributes) => {
24479
24520
  return attributes["w:pos"];
24480
24521
  };
24481
- const decode$U = (attrs) => {
24522
+ const decode$W = (attrs) => {
24482
24523
  const { pos } = attrs || {};
24483
24524
  return pos;
24484
24525
  };
24485
24526
  const attrConfig$A = Object.freeze({
24486
24527
  xmlName: "w:pos",
24487
24528
  sdName: "pos",
24488
- encode: encode$11,
24489
- decode: decode$U
24529
+ encode: encode$14,
24530
+ decode: decode$W
24490
24531
  });
24491
24532
  const validXmlAttributes$k = [attrConfig$C, attrConfig$A, attrConfig$B];
24492
- const XML_NODE_NAME$s = "w:tab";
24493
- const SD_NODE_NAME$c = "tab";
24494
- const encode$10 = (_2, encodedAttrs = {}) => {
24533
+ const XML_NODE_NAME$v = "w:tab";
24534
+ const SD_NODE_NAME$e = "tab";
24535
+ const encode$13 = (_2, encodedAttrs = {}) => {
24495
24536
  const translated = { type: "tab" };
24496
24537
  if (encodedAttrs) translated.attrs = { ...encodedAttrs };
24497
24538
  return translated;
24498
24539
  };
24499
- const decode$T = (params2, decodedAttrs = {}) => {
24540
+ const decode$V = (params2, decodedAttrs = {}) => {
24500
24541
  const { node } = params2 || {};
24501
24542
  if (!node) return;
24502
24543
  const wTab = { name: "w:tab" };
@@ -24512,15 +24553,15 @@ const decode$T = (params2, decodedAttrs = {}) => {
24512
24553
  }
24513
24554
  return translated;
24514
24555
  };
24515
- const config$q = {
24516
- xmlName: XML_NODE_NAME$s,
24517
- sdNodeOrKeyName: SD_NODE_NAME$c,
24556
+ const config$t = {
24557
+ xmlName: XML_NODE_NAME$v,
24558
+ sdNodeOrKeyName: SD_NODE_NAME$e,
24518
24559
  type: NodeTranslator.translatorTypes.NODE,
24519
- encode: encode$10,
24520
- decode: decode$T,
24560
+ encode: encode$13,
24561
+ decode: decode$V,
24521
24562
  attributes: validXmlAttributes$k
24522
24563
  };
24523
- const translator$14 = NodeTranslator.from(config$q);
24564
+ const translator$17 = NodeTranslator.from(config$t);
24524
24565
  const mergeTextNodes = (nodes) => {
24525
24566
  if (!nodes || !Array.isArray(nodes)) {
24526
24567
  return nodes;
@@ -24894,104 +24935,10 @@ const getDefaultParagraphStyle = (docx, styleId = "") => {
24894
24935
  justify: pPrByIdJcAttr
24895
24936
  };
24896
24937
  };
24897
- const preProcessNodesForFldChar = (nodes = []) => {
24898
- const processedNodes = [];
24899
- let buffer2 = [];
24900
- let collecting = false;
24901
- for (const node of nodes) {
24902
- const fldCharEl = node.elements?.find((el) => el.name === "w:fldChar");
24903
- const fldType = fldCharEl?.attributes?.["w:fldCharType"];
24904
- if (fldType === "begin") {
24905
- buffer2 = [node];
24906
- collecting = true;
24907
- continue;
24908
- }
24909
- if (fldType === "separate" && collecting) {
24910
- buffer2.push(node);
24911
- continue;
24912
- }
24913
- if (fldType === "end" && collecting) {
24914
- buffer2.push(node);
24915
- processedNodes.push(...processCombinedNodesForFldChar(buffer2));
24916
- buffer2 = [];
24917
- collecting = false;
24918
- continue;
24919
- }
24920
- if (collecting) {
24921
- buffer2.push(node);
24922
- } else {
24923
- processedNodes.push(node);
24924
- }
24925
- }
24926
- if (buffer2.length) {
24927
- processedNodes.push(...buffer2);
24928
- }
24929
- return processedNodes;
24930
- };
24931
- const processCombinedNodesForFldChar = (nodesToCombine = []) => {
24932
- let processedNodes = [];
24933
- let hasPageMarker = false;
24934
- let isNumPages = false;
24935
- const textStart = nodesToCombine.findIndex(
24936
- (n) => n.elements?.some((el) => el.name === "w:fldChar" && el.attributes["w:fldCharType"] === "separate")
24937
- );
24938
- const textEnd = nodesToCombine.findIndex(
24939
- (n) => n.elements?.some((el) => el.name === "w:fldChar" && el.attributes["w:fldCharType"] === "end")
24940
- );
24941
- const textNodes = nodesToCombine.slice(textStart + 1, textEnd);
24942
- const instrTextContainer = nodesToCombine.find((n) => n.elements?.some((el) => el.name === "w:instrText"));
24943
- const instrTextNode = instrTextContainer?.elements?.find((el) => el.name === "w:instrText");
24944
- const instrText = instrTextNode?.elements[0].text;
24945
- if (!hasPageMarker) hasPageMarker = instrText?.trim().startsWith("PAGE");
24946
- if (!isNumPages) isNumPages = instrText?.trim().startsWith("NUMPAGES");
24947
- const urlMatch = instrText?.match(/HYPERLINK\s+"([^"]+)"/);
24948
- if (hasPageMarker) {
24949
- const pageNumNode = {
24950
- name: "sd:autoPageNumber",
24951
- type: "element"
24952
- };
24953
- nodesToCombine.forEach((n) => {
24954
- const rPrNode = n.elements.find((el) => el.name === "w:rPr");
24955
- if (rPrNode) pageNumNode.elements = [rPrNode];
24956
- });
24957
- processedNodes.push(pageNumNode);
24958
- } else if (isNumPages) {
24959
- const totalPageNumNode = {
24960
- name: "sd:totalPageNumber",
24961
- type: "element"
24962
- };
24963
- nodesToCombine.forEach((n) => {
24964
- const rPrNode = n.elements.find((el) => el.name === "w:rPr");
24965
- if (rPrNode) totalPageNumNode.elements = [rPrNode];
24966
- });
24967
- processedNodes.push(totalPageNumNode);
24968
- } else if (urlMatch && urlMatch?.length >= 2) {
24969
- const url = urlMatch[1];
24970
- const textMarks = [];
24971
- textNodes.forEach((n) => {
24972
- const rPr2 = n.elements.find((el) => el.name === "w:rPr");
24973
- if (!rPr2) return;
24974
- const { elements } = rPr2;
24975
- elements.forEach((el) => {
24976
- textMarks.push(el);
24977
- });
24978
- });
24979
- const linkMark = { name: "link", attributes: { href: url } };
24980
- const rPr = { name: "w:rPr", type: "element", elements: [linkMark, ...textMarks] };
24981
- processedNodes.push({
24982
- name: "w:r",
24983
- type: "element",
24984
- elements: [rPr, ...textNodes]
24985
- });
24986
- }
24987
- return processedNodes;
24988
- };
24989
24938
  const handleParagraphNode$1 = (params2) => {
24990
24939
  const { nodes, docx, nodeListHandler, filename } = params2;
24991
24940
  const node = carbonCopy(nodes[0]);
24992
24941
  let schemaNode;
24993
- let processedElements = preProcessNodesForFldChar(node.elements);
24994
- node.elements = processedElements;
24995
24942
  const handleStandardNode2 = nodeListHandler.handlerEntities.find(
24996
24943
  (e) => e.handlerName === "standardNodeHandler"
24997
24944
  )?.handler;
@@ -25132,89 +25079,89 @@ const handleParagraphNode$1 = (params2) => {
25132
25079
  }
25133
25080
  return schemaNode;
25134
25081
  };
25135
- const encode$$ = (attributes) => {
25082
+ const encode$12 = (attributes) => {
25136
25083
  return attributes["w:rsidDel"];
25137
25084
  };
25138
- const decode$S = (attrs) => {
25085
+ const decode$U = (attrs) => {
25139
25086
  return attrs.rsidDel;
25140
25087
  };
25141
25088
  const attrConfig$z = Object.freeze({
25142
25089
  xmlName: "w:rsidDel",
25143
25090
  sdName: "rsidDel",
25144
- encode: encode$$,
25145
- decode: decode$S
25091
+ encode: encode$12,
25092
+ decode: decode$U
25146
25093
  });
25147
- const encode$_ = (attributes) => {
25094
+ const encode$11 = (attributes) => {
25148
25095
  return attributes["w:rsidP"];
25149
25096
  };
25150
- const decode$R = (attrs) => {
25097
+ const decode$T = (attrs) => {
25151
25098
  return attrs.rsidP;
25152
25099
  };
25153
25100
  const attrConfig$y = Object.freeze({
25154
25101
  xmlName: "w:rsidP",
25155
25102
  sdName: "rsidP",
25156
- encode: encode$_,
25157
- decode: decode$R
25103
+ encode: encode$11,
25104
+ decode: decode$T
25158
25105
  });
25159
- const encode$Z = (attributes) => {
25106
+ const encode$10 = (attributes) => {
25160
25107
  return attributes["w:rsidR"];
25161
25108
  };
25162
- const decode$Q = (attrs) => {
25109
+ const decode$S = (attrs) => {
25163
25110
  return attrs.rsidR;
25164
25111
  };
25165
25112
  const attrConfig$x = Object.freeze({
25166
25113
  xmlName: "w:rsidR",
25167
25114
  sdName: "rsidR",
25168
- encode: encode$Z,
25169
- decode: decode$Q
25115
+ encode: encode$10,
25116
+ decode: decode$S
25170
25117
  });
25171
- const encode$Y = (attributes) => {
25118
+ const encode$$ = (attributes) => {
25172
25119
  return attributes["w:rsidRPr"];
25173
25120
  };
25174
- const decode$P = (attrs) => {
25121
+ const decode$R = (attrs) => {
25175
25122
  return attrs.rsidRPr;
25176
25123
  };
25177
25124
  const attrConfig$w = Object.freeze({
25178
25125
  xmlName: "w:rsidRPr",
25179
25126
  sdName: "rsidRPr",
25180
- encode: encode$Y,
25181
- decode: decode$P
25127
+ encode: encode$$,
25128
+ decode: decode$R
25182
25129
  });
25183
- const encode$X = (attributes) => {
25130
+ const encode$_ = (attributes) => {
25184
25131
  return attributes["w:rsidRDefault"];
25185
25132
  };
25186
- const decode$O = (attrs) => {
25133
+ const decode$Q = (attrs) => {
25187
25134
  return attrs.rsidRDefault;
25188
25135
  };
25189
25136
  const attrConfig$v = Object.freeze({
25190
25137
  xmlName: "w:rsidRDefault",
25191
25138
  sdName: "rsidRDefault",
25192
- encode: encode$X,
25193
- decode: decode$O
25139
+ encode: encode$_,
25140
+ decode: decode$Q
25194
25141
  });
25195
- const encode$W = (attributes) => {
25142
+ const encode$Z = (attributes) => {
25196
25143
  return attributes["w14:paraId"];
25197
25144
  };
25198
- const decode$N = (attrs) => {
25145
+ const decode$P = (attrs) => {
25199
25146
  return attrs.paraId;
25200
25147
  };
25201
25148
  const attrConfig$u = Object.freeze({
25202
25149
  xmlName: "w14:paraId",
25203
25150
  sdName: "paraId",
25204
- encode: encode$W,
25205
- decode: decode$N
25151
+ encode: encode$Z,
25152
+ decode: decode$P
25206
25153
  });
25207
- const encode$V = (attributes) => {
25154
+ const encode$Y = (attributes) => {
25208
25155
  return attributes["w14:textId"];
25209
25156
  };
25210
- const decode$M = (attrs) => {
25157
+ const decode$O = (attrs) => {
25211
25158
  return attrs.textId;
25212
25159
  };
25213
25160
  const attrConfig$t = Object.freeze({
25214
25161
  xmlName: "w14:textId",
25215
25162
  sdName: "textId",
25216
- encode: encode$V,
25217
- decode: decode$M
25163
+ encode: encode$Y,
25164
+ decode: decode$O
25218
25165
  });
25219
25166
  const validXmlAttributes$j = [
25220
25167
  attrConfig$u,
@@ -25225,9 +25172,9 @@ const validXmlAttributes$j = [
25225
25172
  attrConfig$w,
25226
25173
  attrConfig$z
25227
25174
  ];
25228
- const XML_NODE_NAME$r = "w:p";
25229
- const SD_NODE_NAME$b = "paragraph";
25230
- const encode$U = (params2, encodedAttrs = {}) => {
25175
+ const XML_NODE_NAME$u = "w:p";
25176
+ const SD_NODE_NAME$d = "paragraph";
25177
+ const encode$X = (params2, encodedAttrs = {}) => {
25231
25178
  const node = handleParagraphNode$1(params2);
25232
25179
  if (!node) return void 0;
25233
25180
  if (encodedAttrs && Object.keys(encodedAttrs).length) {
@@ -25235,7 +25182,7 @@ const encode$U = (params2, encodedAttrs = {}) => {
25235
25182
  }
25236
25183
  return node;
25237
25184
  };
25238
- const decode$L = (params2, decodedAttrs = {}) => {
25185
+ const decode$N = (params2, decodedAttrs = {}) => {
25239
25186
  const translated = translateParagraphNode(params2);
25240
25187
  if (!translated) return void 0;
25241
25188
  if (decodedAttrs && Object.keys(decodedAttrs).length) {
@@ -25243,16 +25190,16 @@ const decode$L = (params2, decodedAttrs = {}) => {
25243
25190
  }
25244
25191
  return translated;
25245
25192
  };
25246
- const config$p = {
25247
- xmlName: XML_NODE_NAME$r,
25248
- sdNodeOrKeyName: SD_NODE_NAME$b,
25193
+ const config$s = {
25194
+ xmlName: XML_NODE_NAME$u,
25195
+ sdNodeOrKeyName: SD_NODE_NAME$d,
25249
25196
  type: NodeTranslator.translatorTypes.NODE,
25250
- encode: encode$U,
25251
- decode: decode$L,
25197
+ encode: encode$X,
25198
+ decode: decode$N,
25252
25199
  attributes: validXmlAttributes$j
25253
25200
  };
25254
- const translator$13 = NodeTranslator.from(config$p);
25255
- const encode$T = (attributes) => {
25201
+ const translator$16 = NodeTranslator.from(config$s);
25202
+ const encode$W = (attributes) => {
25256
25203
  const raw = attributes?.["w:val"];
25257
25204
  if (raw === void 0 || raw === null) return void 0;
25258
25205
  if (typeof raw === "boolean") return raw;
@@ -25262,24 +25209,24 @@ const encode$T = (attributes) => {
25262
25209
  if (val === "1" || val === "true" || val === "on") return true;
25263
25210
  return void 0;
25264
25211
  };
25265
- const decode$K = (runProps) => {
25212
+ const decode$M = (runProps) => {
25266
25213
  if (runProps?.bold === false) return "0";
25267
25214
  return void 0;
25268
25215
  };
25269
25216
  const attrConfig$s = Object.freeze({
25270
25217
  xmlName: "w:val",
25271
25218
  sdName: "bold",
25272
- encode: encode$T,
25273
- decode: decode$K
25219
+ encode: encode$W,
25220
+ decode: decode$M
25274
25221
  });
25275
25222
  const validXmlAttributes$i = [attrConfig$s];
25276
- const XML_NODE_NAME$q = "w:b";
25277
- const SD_ATTR_KEY$e = "bold";
25278
- const encode$S = (params2, encodedAttrs = {}) => {
25223
+ const XML_NODE_NAME$t = "w:b";
25224
+ const SD_ATTR_KEY$f = "bold";
25225
+ const encode$V = (params2, encodedAttrs = {}) => {
25279
25226
  const { nodes } = params2;
25280
25227
  const node = nodes[0];
25281
25228
  if (!node) return void 0;
25282
- const val = encodedAttrs?.[SD_ATTR_KEY$e];
25229
+ const val = encodedAttrs?.[SD_ATTR_KEY$f];
25283
25230
  let attributes;
25284
25231
  if (val === false) attributes = { "w:val": "0" };
25285
25232
  else if (val === true)
@@ -25287,85 +25234,85 @@ const encode$S = (params2, encodedAttrs = {}) => {
25287
25234
  else attributes = node.attributes || {};
25288
25235
  return {
25289
25236
  type: "attr",
25290
- xmlName: XML_NODE_NAME$q,
25291
- sdNodeOrKeyName: SD_ATTR_KEY$e,
25237
+ xmlName: XML_NODE_NAME$t,
25238
+ sdNodeOrKeyName: SD_ATTR_KEY$f,
25292
25239
  attributes
25293
25240
  };
25294
25241
  };
25295
- const config$o = {
25296
- xmlName: XML_NODE_NAME$q,
25297
- sdNodeOrKeyName: SD_ATTR_KEY$e,
25242
+ const config$r = {
25243
+ xmlName: XML_NODE_NAME$t,
25244
+ sdNodeOrKeyName: SD_ATTR_KEY$f,
25298
25245
  type: NodeTranslator.translatorTypes.ATTRIBUTE,
25299
- encode: encode$S,
25246
+ encode: encode$V,
25300
25247
  attributes: validXmlAttributes$i
25301
25248
  };
25302
- const translator$12 = NodeTranslator.from(config$o);
25303
- const XML_NODE_NAME$p = "w:i";
25304
- const SD_ATTR_KEY$d = "italic";
25305
- const encode$R = (params2) => {
25249
+ const translator$15 = NodeTranslator.from(config$r);
25250
+ const XML_NODE_NAME$s = "w:i";
25251
+ const SD_ATTR_KEY$e = "italic";
25252
+ const encode$U = (params2) => {
25306
25253
  const { nodes } = params2;
25307
25254
  const node = nodes?.[0];
25308
25255
  if (!node) return void 0;
25309
25256
  return {
25310
25257
  type: "attr",
25311
- xmlName: XML_NODE_NAME$p,
25312
- sdNodeOrKeyName: SD_ATTR_KEY$d,
25258
+ xmlName: XML_NODE_NAME$s,
25259
+ sdNodeOrKeyName: SD_ATTR_KEY$e,
25313
25260
  attributes: {
25314
25261
  "w:val": node.attributes?.["w:val"] ?? null
25315
25262
  }
25316
25263
  };
25317
25264
  };
25318
- const config$n = {
25319
- xmlName: XML_NODE_NAME$p,
25320
- sdNodeOrKeyName: SD_ATTR_KEY$d,
25265
+ const config$q = {
25266
+ xmlName: XML_NODE_NAME$s,
25267
+ sdNodeOrKeyName: SD_ATTR_KEY$e,
25321
25268
  type: NodeTranslator.translatorTypes.ATTRIBUTE,
25322
- encode: encode$R
25269
+ encode: encode$U
25323
25270
  };
25324
- const translator$11 = NodeTranslator.from(config$n);
25325
- const encode$Q = (attributes) => attributes?.["w:val"];
25326
- const decode$J = (attrs) => attrs?.underline;
25271
+ const translator$14 = NodeTranslator.from(config$q);
25272
+ const encode$T = (attributes) => attributes?.["w:val"];
25273
+ const decode$L = (attrs) => attrs?.underline;
25327
25274
  const attrConfig$r = Object.freeze({
25328
25275
  xmlName: "w:val",
25329
25276
  sdName: "underline",
25330
- encode: encode$Q,
25331
- decode: decode$J
25277
+ encode: encode$T,
25278
+ decode: decode$L
25332
25279
  });
25333
- const encode$P = (attributes) => attributes?.["w:color"];
25334
- const decode$I = (attrs) => attrs?.color;
25280
+ const encode$S = (attributes) => attributes?.["w:color"];
25281
+ const decode$K = (attrs) => attrs?.color;
25335
25282
  const attrConfig$q = Object.freeze({
25336
25283
  xmlName: "w:color",
25337
25284
  sdName: "color",
25338
- encode: encode$P,
25339
- decode: decode$I
25285
+ encode: encode$S,
25286
+ decode: decode$K
25340
25287
  });
25341
- const encode$O = (attributes) => attributes?.["w:themeColor"];
25342
- const decode$H = (attrs) => attrs?.themeColor;
25288
+ const encode$R = (attributes) => attributes?.["w:themeColor"];
25289
+ const decode$J = (attrs) => attrs?.themeColor;
25343
25290
  const attrConfig$p = Object.freeze({
25344
25291
  xmlName: "w:themeColor",
25345
25292
  sdName: "themeColor",
25346
- encode: encode$O,
25347
- decode: decode$H
25293
+ encode: encode$R,
25294
+ decode: decode$J
25348
25295
  });
25349
- const encode$N = (attributes) => attributes?.["w:themeTint"];
25350
- const decode$G = (attrs) => attrs?.themeTint;
25296
+ const encode$Q = (attributes) => attributes?.["w:themeTint"];
25297
+ const decode$I = (attrs) => attrs?.themeTint;
25351
25298
  const attrConfig$o = Object.freeze({
25352
25299
  xmlName: "w:themeTint",
25353
25300
  sdName: "themeTint",
25354
- encode: encode$N,
25355
- decode: decode$G
25301
+ encode: encode$Q,
25302
+ decode: decode$I
25356
25303
  });
25357
- const encode$M = (attributes) => attributes?.["w:themeShade"];
25358
- const decode$F = (attrs) => attrs?.themeShade;
25304
+ const encode$P = (attributes) => attributes?.["w:themeShade"];
25305
+ const decode$H = (attrs) => attrs?.themeShade;
25359
25306
  const attrConfig$n = Object.freeze({
25360
25307
  xmlName: "w:themeShade",
25361
25308
  sdName: "themeShade",
25362
- encode: encode$M,
25363
- decode: decode$F
25309
+ encode: encode$P,
25310
+ decode: decode$H
25364
25311
  });
25365
25312
  const validXmlAttributes$h = [attrConfig$r, attrConfig$q, attrConfig$p, attrConfig$o, attrConfig$n];
25366
- const XML_NODE_NAME$o = "w:u";
25367
- const SD_ATTR_KEY$c = "underline";
25368
- const encode$L = (params2, encodedAttrs = {}) => {
25313
+ const XML_NODE_NAME$r = "w:u";
25314
+ const SD_ATTR_KEY$d = "underline";
25315
+ const encode$O = (params2, encodedAttrs = {}) => {
25369
25316
  const { nodes } = params2;
25370
25317
  const node = nodes?.[0];
25371
25318
  const sourceAttrs = node?.attributes || {};
@@ -25381,12 +25328,12 @@ const encode$L = (params2, encodedAttrs = {}) => {
25381
25328
  if (themeShade !== void 0 && themeShade !== null) attributes["w:themeShade"] = themeShade;
25382
25329
  return {
25383
25330
  type: "attr",
25384
- xmlName: XML_NODE_NAME$o,
25385
- sdNodeOrKeyName: SD_ATTR_KEY$c,
25331
+ xmlName: XML_NODE_NAME$r,
25332
+ sdNodeOrKeyName: SD_ATTR_KEY$d,
25386
25333
  attributes
25387
25334
  };
25388
25335
  };
25389
- const decode$E = (params2) => {
25336
+ const decode$G = (params2) => {
25390
25337
  const attrs = params2?.node?.attrs || {};
25391
25338
  const underlineType = attrs.underlineType ?? attrs.underline ?? null;
25392
25339
  const color = attrs.underlineColor ?? attrs.color ?? null;
@@ -25404,20 +25351,20 @@ const decode$E = (params2) => {
25404
25351
  if (themeTint) attributes["w:themeTint"] = themeTint;
25405
25352
  if (themeShade) attributes["w:themeShade"] = themeShade;
25406
25353
  return {
25407
- name: XML_NODE_NAME$o,
25354
+ name: XML_NODE_NAME$r,
25408
25355
  attributes
25409
25356
  };
25410
25357
  };
25411
- const config$m = {
25412
- xmlName: XML_NODE_NAME$o,
25413
- sdNodeOrKeyName: SD_ATTR_KEY$c,
25358
+ const config$p = {
25359
+ xmlName: XML_NODE_NAME$r,
25360
+ sdNodeOrKeyName: SD_ATTR_KEY$d,
25414
25361
  type: NodeTranslator.translatorTypes.ATTRIBUTE,
25415
- encode: encode$L,
25416
- decode: decode$E,
25362
+ encode: encode$O,
25363
+ decode: decode$G,
25417
25364
  attributes: validXmlAttributes$h
25418
25365
  };
25419
- const translator$10 = NodeTranslator.from(config$m);
25420
- const encode$K = (attributes) => {
25366
+ const translator$13 = NodeTranslator.from(config$p);
25367
+ const encode$N = (attributes) => {
25421
25368
  const raw = attributes?.["w:val"];
25422
25369
  if (raw === void 0 || raw === null) return void 0;
25423
25370
  if (typeof raw === "boolean") return raw;
@@ -25427,24 +25374,24 @@ const encode$K = (attributes) => {
25427
25374
  if (val === "1" || val === "true" || val === "on") return true;
25428
25375
  return void 0;
25429
25376
  };
25430
- const decode$D = (attrs) => {
25377
+ const decode$F = (attrs) => {
25431
25378
  if (attrs?.strike === false) return "0";
25432
25379
  return void 0;
25433
25380
  };
25434
25381
  const attrConfig$m = Object.freeze({
25435
25382
  xmlName: "w:val",
25436
25383
  sdName: "strike",
25437
- encode: encode$K,
25438
- decode: decode$D
25384
+ encode: encode$N,
25385
+ decode: decode$F
25439
25386
  });
25440
25387
  const validXmlAttributes$g = [attrConfig$m];
25441
- const XML_NODE_NAME$n = "w:strike";
25442
- const SD_ATTR_KEY$b = "strike";
25443
- const encode$J = (params2, encodedAttrs = {}) => {
25388
+ const XML_NODE_NAME$q = "w:strike";
25389
+ const SD_ATTR_KEY$c = "strike";
25390
+ const encode$M = (params2, encodedAttrs = {}) => {
25444
25391
  const { nodes } = params2;
25445
25392
  const node = nodes?.[0];
25446
25393
  if (!node) return void 0;
25447
- const val = encodedAttrs?.[SD_ATTR_KEY$b];
25394
+ const val = encodedAttrs?.[SD_ATTR_KEY$c];
25448
25395
  let attributes;
25449
25396
  if (val === false) attributes = { "w:val": "0" };
25450
25397
  else if (val === true) attributes = {};
@@ -25453,55 +25400,55 @@ const encode$J = (params2, encodedAttrs = {}) => {
25453
25400
  else if (val === true && attributes["w:val"] === void 0) delete attributes["w:val"];
25454
25401
  return {
25455
25402
  type: "attr",
25456
- xmlName: XML_NODE_NAME$n,
25457
- sdNodeOrKeyName: SD_ATTR_KEY$b,
25403
+ xmlName: XML_NODE_NAME$q,
25404
+ sdNodeOrKeyName: SD_ATTR_KEY$c,
25458
25405
  attributes
25459
25406
  };
25460
25407
  };
25461
- const config$l = {
25462
- xmlName: XML_NODE_NAME$n,
25463
- sdNodeOrKeyName: SD_ATTR_KEY$b,
25408
+ const config$o = {
25409
+ xmlName: XML_NODE_NAME$q,
25410
+ sdNodeOrKeyName: SD_ATTR_KEY$c,
25464
25411
  type: NodeTranslator.translatorTypes.ATTRIBUTE,
25465
- encode: encode$J,
25412
+ encode: encode$M,
25466
25413
  attributes: validXmlAttributes$g
25467
25414
  };
25468
- const translator$$ = NodeTranslator.from(config$l);
25469
- const encode$I = (attributes) => attributes?.["w:val"];
25470
- const decode$C = (attrs) => attrs?.color;
25415
+ const translator$12 = NodeTranslator.from(config$o);
25416
+ const encode$L = (attributes) => attributes?.["w:val"];
25417
+ const decode$E = (attrs) => attrs?.color;
25471
25418
  const attrConfig$l = Object.freeze({
25472
25419
  xmlName: "w:val",
25473
25420
  sdName: "color",
25474
- encode: encode$I,
25475
- decode: decode$C
25421
+ encode: encode$L,
25422
+ decode: decode$E
25476
25423
  });
25477
- const encode$H = (attributes) => attributes?.["w:themeColor"];
25478
- const decode$B = (attrs) => attrs?.themeColor;
25424
+ const encode$K = (attributes) => attributes?.["w:themeColor"];
25425
+ const decode$D = (attrs) => attrs?.themeColor;
25479
25426
  const attrConfig$k = Object.freeze({
25480
25427
  xmlName: "w:themeColor",
25481
25428
  sdName: "themeColor",
25482
- encode: encode$H,
25483
- decode: decode$B
25429
+ encode: encode$K,
25430
+ decode: decode$D
25484
25431
  });
25485
- const encode$G = (attributes) => attributes?.["w:themeTint"];
25486
- const decode$A = (attrs) => attrs?.themeTint;
25432
+ const encode$J = (attributes) => attributes?.["w:themeTint"];
25433
+ const decode$C = (attrs) => attrs?.themeTint;
25487
25434
  const attrConfig$j = Object.freeze({
25488
25435
  xmlName: "w:themeTint",
25489
25436
  sdName: "themeTint",
25490
- encode: encode$G,
25491
- decode: decode$A
25437
+ encode: encode$J,
25438
+ decode: decode$C
25492
25439
  });
25493
- const encode$F = (attributes) => attributes?.["w:themeShade"];
25494
- const decode$z = (attrs) => attrs?.themeShade;
25440
+ const encode$I = (attributes) => attributes?.["w:themeShade"];
25441
+ const decode$B = (attrs) => attrs?.themeShade;
25495
25442
  const attrConfig$i = Object.freeze({
25496
25443
  xmlName: "w:themeShade",
25497
25444
  sdName: "themeShade",
25498
- encode: encode$F,
25499
- decode: decode$z
25445
+ encode: encode$I,
25446
+ decode: decode$B
25500
25447
  });
25501
25448
  const validXmlAttributes$f = [attrConfig$l, attrConfig$k, attrConfig$j, attrConfig$i];
25502
- const XML_NODE_NAME$m = "w:color";
25503
- const SD_ATTR_KEY$a = "color";
25504
- const encode$E = (params2, encodedAttrs = {}) => {
25449
+ const XML_NODE_NAME$p = "w:color";
25450
+ const SD_ATTR_KEY$b = "color";
25451
+ const encode$H = (params2, encodedAttrs = {}) => {
25505
25452
  const { nodes } = params2;
25506
25453
  const node = nodes?.[0];
25507
25454
  const sourceAttrs = node?.attributes || {};
@@ -25516,63 +25463,63 @@ const encode$E = (params2, encodedAttrs = {}) => {
25516
25463
  if (themeShade !== void 0 && themeShade !== null) attributes["w:themeShade"] = themeShade;
25517
25464
  return {
25518
25465
  type: "attr",
25519
- xmlName: XML_NODE_NAME$m,
25520
- sdNodeOrKeyName: SD_ATTR_KEY$a,
25466
+ xmlName: XML_NODE_NAME$p,
25467
+ sdNodeOrKeyName: SD_ATTR_KEY$b,
25521
25468
  attributes
25522
25469
  };
25523
25470
  };
25524
- const config$k = {
25525
- xmlName: XML_NODE_NAME$m,
25526
- sdNodeOrKeyName: SD_ATTR_KEY$a,
25471
+ const config$n = {
25472
+ xmlName: XML_NODE_NAME$p,
25473
+ sdNodeOrKeyName: SD_ATTR_KEY$b,
25527
25474
  type: NodeTranslator.translatorTypes.ATTRIBUTE,
25528
- encode: encode$E,
25475
+ encode: encode$H,
25529
25476
  attributes: validXmlAttributes$f
25530
25477
  };
25531
- const translator$_ = NodeTranslator.from(config$k);
25532
- const encode$D = (attributes) => attributes?.["w:eastAsia"];
25533
- const decode$y = (attrs) => attrs?.eastAsia;
25478
+ const translator$11 = NodeTranslator.from(config$n);
25479
+ const encode$G = (attributes) => attributes?.["w:eastAsia"];
25480
+ const decode$A = (attrs) => attrs?.eastAsia;
25534
25481
  const attrConfig$h = Object.freeze({
25535
25482
  xmlName: "w:eastAsia",
25536
25483
  sdName: "eastAsia",
25537
- encode: encode$D,
25538
- decode: decode$y
25484
+ encode: encode$G,
25485
+ decode: decode$A
25539
25486
  });
25540
- const encode$C = (attributes) => attributes?.["w:ascii"];
25541
- const decode$x = (attrs) => attrs?.ascii;
25487
+ const encode$F = (attributes) => attributes?.["w:ascii"];
25488
+ const decode$z = (attrs) => attrs?.ascii;
25542
25489
  const attrConfig$g = Object.freeze({
25543
25490
  xmlName: "w:ascii",
25544
25491
  sdName: "ascii",
25545
- encode: encode$C,
25546
- decode: decode$x
25492
+ encode: encode$F,
25493
+ decode: decode$z
25547
25494
  });
25548
- const encode$B = (attributes) => attributes?.["w:hAnsi"];
25549
- const decode$w = (attrs) => attrs?.hAnsi;
25495
+ const encode$E = (attributes) => attributes?.["w:hAnsi"];
25496
+ const decode$y = (attrs) => attrs?.hAnsi;
25550
25497
  const attrConfig$f = Object.freeze({
25551
25498
  xmlName: "w:hAnsi",
25552
25499
  sdName: "hAnsi",
25553
- encode: encode$B,
25554
- decode: decode$w
25500
+ encode: encode$E,
25501
+ decode: decode$y
25555
25502
  });
25556
- const encode$A = (attributes) => attributes?.["w:cs"];
25557
- const decode$v = (attrs) => attrs?.cs;
25503
+ const encode$D = (attributes) => attributes?.["w:cs"];
25504
+ const decode$x = (attrs) => attrs?.cs;
25558
25505
  const attrConfig$e = Object.freeze({
25559
25506
  xmlName: "w:cs",
25560
25507
  sdName: "cs",
25561
- encode: encode$A,
25562
- decode: decode$v
25508
+ encode: encode$D,
25509
+ decode: decode$x
25563
25510
  });
25564
- const encode$z = (attributes) => attributes?.["w:val"];
25565
- const decode$u = (attrs) => attrs?.value;
25511
+ const encode$C = (attributes) => attributes?.["w:val"];
25512
+ const decode$w = (attrs) => attrs?.value;
25566
25513
  const attrConfig$d = Object.freeze({
25567
25514
  xmlName: "w:val",
25568
25515
  sdName: "value",
25569
- encode: encode$z,
25570
- decode: decode$u
25516
+ encode: encode$C,
25517
+ decode: decode$w
25571
25518
  });
25572
25519
  const validXmlAttributes$e = [attrConfig$h, attrConfig$g, attrConfig$f, attrConfig$e, attrConfig$d];
25573
- const XML_NODE_NAME$l = "w:rFonts";
25574
- const SD_ATTR_KEY$9 = "fontFamily";
25575
- const encode$y = (params2, encodedAttrs = {}) => {
25520
+ const XML_NODE_NAME$o = "w:rFonts";
25521
+ const SD_ATTR_KEY$a = "fontFamily";
25522
+ const encode$B = (params2, encodedAttrs = {}) => {
25576
25523
  const { nodes } = params2;
25577
25524
  const node = nodes?.[0];
25578
25525
  const sourceAttrs = node?.attributes || {};
@@ -25598,120 +25545,281 @@ const encode$y = (params2, encodedAttrs = {}) => {
25598
25545
  if (attributes["w:val"] === void 0) delete attributes["w:val"];
25599
25546
  return {
25600
25547
  type: "attr",
25601
- xmlName: XML_NODE_NAME$l,
25602
- sdNodeOrKeyName: SD_ATTR_KEY$9,
25548
+ xmlName: XML_NODE_NAME$o,
25549
+ sdNodeOrKeyName: SD_ATTR_KEY$a,
25603
25550
  attributes
25604
25551
  };
25605
25552
  };
25606
- const config$j = {
25607
- xmlName: XML_NODE_NAME$l,
25608
- sdNodeOrKeyName: SD_ATTR_KEY$9,
25553
+ const config$m = {
25554
+ xmlName: XML_NODE_NAME$o,
25555
+ sdNodeOrKeyName: SD_ATTR_KEY$a,
25609
25556
  type: NodeTranslator.translatorTypes.ATTRIBUTE,
25610
- encode: encode$y,
25557
+ encode: encode$B,
25611
25558
  attributes: validXmlAttributes$e
25612
25559
  };
25613
- const translator$Z = NodeTranslator.from(config$j);
25614
- const encode$x = (attributes) => attributes?.["w:val"];
25615
- const decode$t = (attrs) => attrs?.styleId;
25560
+ const translator$10 = NodeTranslator.from(config$m);
25561
+ const encode$A = (attributes) => attributes?.["w:val"];
25562
+ const decode$v = (attrs) => attrs?.styleId;
25616
25563
  const attrConfig$c = Object.freeze({
25617
25564
  xmlName: "w:val",
25618
25565
  sdName: "styleId",
25619
- encode: encode$x,
25620
- decode: decode$t
25566
+ encode: encode$A,
25567
+ decode: decode$v
25621
25568
  });
25622
25569
  const validXmlAttributes$d = [attrConfig$c];
25623
- const XML_NODE_NAME$k = "w:rStyle";
25624
- const SD_ATTR_KEY$8 = "styleId";
25625
- const encode$w = (params2, encodedAttrs = {}) => {
25570
+ const XML_NODE_NAME$n = "w:rStyle";
25571
+ const SD_ATTR_KEY$9 = "styleId";
25572
+ const encode$z = (params2, encodedAttrs = {}) => {
25626
25573
  const { nodes } = params2;
25627
25574
  const node = nodes?.[0];
25628
25575
  const value = encodedAttrs.styleId ?? node?.attributes?.["w:val"];
25629
25576
  return {
25630
25577
  type: "attr",
25631
- xmlName: XML_NODE_NAME$k,
25632
- sdNodeOrKeyName: SD_ATTR_KEY$8,
25578
+ xmlName: XML_NODE_NAME$n,
25579
+ sdNodeOrKeyName: SD_ATTR_KEY$9,
25633
25580
  attributes: { "w:val": value ?? null }
25634
25581
  };
25635
25582
  };
25636
- const config$i = {
25637
- xmlName: XML_NODE_NAME$k,
25638
- sdNodeOrKeyName: SD_ATTR_KEY$8,
25583
+ const config$l = {
25584
+ xmlName: XML_NODE_NAME$n,
25585
+ sdNodeOrKeyName: SD_ATTR_KEY$9,
25639
25586
  type: NodeTranslator.translatorTypes.ATTRIBUTE,
25640
- encode: encode$w,
25587
+ encode: encode$z,
25641
25588
  attributes: validXmlAttributes$d
25642
25589
  };
25643
- const translator$Y = NodeTranslator.from(config$i);
25644
- const encode$v = (attributes) => attributes?.["w:val"];
25645
- const decode$s = (attrs) => attrs?.fontSize;
25590
+ const translator$$ = NodeTranslator.from(config$l);
25591
+ const encode$y = (attributes) => attributes?.["w:val"];
25592
+ const decode$u = (attrs) => attrs?.fontSize;
25646
25593
  const attrConfig$b = Object.freeze({
25647
25594
  xmlName: "w:val",
25648
25595
  sdName: "fontSize",
25649
- encode: encode$v,
25650
- decode: decode$s
25596
+ encode: encode$y,
25597
+ decode: decode$u
25651
25598
  });
25652
25599
  const validXmlAttributes$c = [attrConfig$b];
25653
- const XML_NODE_NAME$j = "w:sz";
25654
- const SD_ATTR_KEY$7 = "fontSize";
25655
- const encode$u = (params2, encodedAttrs = {}) => {
25600
+ const XML_NODE_NAME$m = "w:sz";
25601
+ const SD_ATTR_KEY$8 = "fontSize";
25602
+ const encode$x = (params2, encodedAttrs = {}) => {
25656
25603
  const { nodes } = params2;
25657
25604
  const node = nodes?.[0];
25658
25605
  const value = encodedAttrs.fontSize ?? node?.attributes?.["w:val"];
25659
25606
  return {
25660
25607
  type: "attr",
25661
- xmlName: XML_NODE_NAME$j,
25662
- sdNodeOrKeyName: SD_ATTR_KEY$7,
25608
+ xmlName: XML_NODE_NAME$m,
25609
+ sdNodeOrKeyName: SD_ATTR_KEY$8,
25663
25610
  attributes: { "w:val": value ?? null }
25664
25611
  };
25665
25612
  };
25666
- const config$h = {
25667
- xmlName: XML_NODE_NAME$j,
25668
- sdNodeOrKeyName: SD_ATTR_KEY$7,
25613
+ const config$k = {
25614
+ xmlName: XML_NODE_NAME$m,
25615
+ sdNodeOrKeyName: SD_ATTR_KEY$8,
25669
25616
  type: NodeTranslator.translatorTypes.ATTRIBUTE,
25670
- encode: encode$u,
25617
+ encode: encode$x,
25671
25618
  attributes: validXmlAttributes$c
25672
25619
  };
25673
- const translator$X = NodeTranslator.from(config$h);
25674
- const encode$t = (attributes) => attributes?.["w:val"];
25675
- const decode$r = (attrs) => attrs?.fontSizeCs;
25620
+ const translator$_ = NodeTranslator.from(config$k);
25621
+ const encode$w = (attributes) => attributes?.["w:val"];
25622
+ const decode$t = (attrs) => attrs?.fontSizeCs;
25676
25623
  const attrConfig$a = Object.freeze({
25677
25624
  xmlName: "w:val",
25678
25625
  sdName: "fontSizeCs",
25679
- encode: encode$t,
25680
- decode: decode$r
25626
+ encode: encode$w,
25627
+ decode: decode$t
25681
25628
  });
25682
25629
  const validXmlAttributes$b = [attrConfig$a];
25683
- const XML_NODE_NAME$i = "w:szCs";
25684
- const SD_ATTR_KEY$6 = "fontSizeCs";
25685
- const encode$s = (params2, encodedAttrs = {}) => {
25630
+ const XML_NODE_NAME$l = "w:szCs";
25631
+ const SD_ATTR_KEY$7 = "fontSizeCs";
25632
+ const encode$v = (params2, encodedAttrs = {}) => {
25686
25633
  const { nodes } = params2;
25687
25634
  const node = nodes?.[0];
25688
25635
  const value = encodedAttrs.fontSizeCs ?? node?.attributes?.["w:val"];
25689
25636
  return {
25690
25637
  type: "attr",
25691
- xmlName: XML_NODE_NAME$i,
25692
- sdNodeOrKeyName: SD_ATTR_KEY$6,
25638
+ xmlName: XML_NODE_NAME$l,
25639
+ sdNodeOrKeyName: SD_ATTR_KEY$7,
25693
25640
  attributes: { "w:val": value ?? null }
25694
25641
  };
25695
25642
  };
25696
- const config$g = {
25697
- xmlName: XML_NODE_NAME$i,
25698
- sdNodeOrKeyName: SD_ATTR_KEY$6,
25643
+ const config$j = {
25644
+ xmlName: XML_NODE_NAME$l,
25645
+ sdNodeOrKeyName: SD_ATTR_KEY$7,
25699
25646
  type: NodeTranslator.translatorTypes.ATTRIBUTE,
25700
- encode: encode$s,
25647
+ encode: encode$v,
25701
25648
  attributes: validXmlAttributes$b
25702
25649
  };
25703
- const translator$W = NodeTranslator.from(config$g);
25650
+ const translator$Z = NodeTranslator.from(config$j);
25651
+ const generateV2HandlerEntity = (handlerName, translator2) => ({
25652
+ handlerName,
25653
+ handler: (params2) => {
25654
+ const { nodes } = params2;
25655
+ if (nodes.length === 0 || nodes[0].name !== translator2.xmlName) {
25656
+ return { nodes: [], consumed: 0 };
25657
+ }
25658
+ const result = translator2.encode(params2);
25659
+ if (!result) return { nodes: [], consumed: 0 };
25660
+ return {
25661
+ nodes: Array.isArray(result) ? result : [result],
25662
+ consumed: 1
25663
+ };
25664
+ }
25665
+ });
25666
+ function createSingleAttrPropertyHandler(xmlName, sdName = null, attrName = "w:val", transformEncode = null, transformDecode = null) {
25667
+ if (!sdName) sdName = xmlName.split(":")[1];
25668
+ if (!transformEncode) transformEncode = (v2) => v2;
25669
+ if (!transformDecode) transformDecode = (v2) => v2;
25670
+ return {
25671
+ xmlName,
25672
+ sdNodeOrKeyName: sdName,
25673
+ encode: ({ nodes }) => {
25674
+ return transformEncode(nodes[0].attributes[attrName]) ?? void 0;
25675
+ },
25676
+ decode: ({ node }) => {
25677
+ const value = node.attrs?.[sdName] != null ? transformDecode(node.attrs[sdName]) : void 0;
25678
+ return value != null ? { name: xmlName, attributes: { [attrName]: value } } : void 0;
25679
+ }
25680
+ };
25681
+ }
25682
+ function createMeasurementPropertyHandler(xmlName, sdName = null) {
25683
+ if (!sdName) sdName = xmlName.split(":")[1];
25684
+ return {
25685
+ xmlName,
25686
+ sdNodeOrKeyName: sdName,
25687
+ attributes: [
25688
+ createAttributeHandler("w:w", "value", parseInteger, integerToString),
25689
+ createAttributeHandler("w:type")
25690
+ ],
25691
+ encode: (_2, encodedAttrs) => {
25692
+ return encodedAttrs["value"] != null ? encodedAttrs : void 0;
25693
+ },
25694
+ decode: function({ node }) {
25695
+ const decodedAttrs = this.decodeAttributes({ node: { ...node, attrs: node.attrs[sdName] || {} } });
25696
+ return decodedAttrs["w:w"] != null ? { attributes: decodedAttrs } : void 0;
25697
+ }
25698
+ };
25699
+ }
25700
+ function createBorderPropertyHandler(xmlName, sdName = null) {
25701
+ if (!sdName) sdName = xmlName.split(":")[1];
25702
+ return {
25703
+ xmlName,
25704
+ sdNodeOrKeyName: sdName,
25705
+ attributes: [
25706
+ createAttributeHandler("w:val"),
25707
+ createAttributeHandler("w:color"),
25708
+ createAttributeHandler("w:themeColor"),
25709
+ createAttributeHandler("w:themeTint"),
25710
+ createAttributeHandler("w:themeShade"),
25711
+ createAttributeHandler("w:sz", "size", parseInteger, integerToString),
25712
+ createAttributeHandler("w:space", null, parseInteger, integerToString),
25713
+ createAttributeHandler("w:shadow", null, parseBoolean, booleanToString),
25714
+ createAttributeHandler("w:frame", null, parseBoolean, booleanToString)
25715
+ ],
25716
+ encode: (params2, encodedAttrs) => {
25717
+ return Object.keys(encodedAttrs).length > 0 ? encodedAttrs : void 0;
25718
+ },
25719
+ decode: function({ node }, context) {
25720
+ const decodedAttrs = this.decodeAttributes({ node: { ...node, attrs: node.attrs[sdName] || {} } });
25721
+ return Object.keys(decodedAttrs).length > 0 ? { attributes: decodedAttrs } : void 0;
25722
+ }
25723
+ };
25724
+ }
25725
+ const createAttributeHandler = (xmlName, sdName = null, transformEncode = null, transformDecode = null) => {
25726
+ if (!transformEncode) transformEncode = (v2) => v2;
25727
+ if (!transformDecode) transformDecode = (v2) => v2;
25728
+ if (!sdName) sdName = xmlName.split(":")[1];
25729
+ return {
25730
+ xmlName,
25731
+ sdName,
25732
+ encode: (attributes) => transformEncode(attributes[xmlName]),
25733
+ decode: (attributes) => transformDecode(attributes[sdName])
25734
+ };
25735
+ };
25736
+ function encodeProperties(node, translatorsByXmlName, asArray = false) {
25737
+ if (!node?.elements || node.elements.length === 0) {
25738
+ return asArray ? [] : {};
25739
+ }
25740
+ const attributes = asArray ? [] : {};
25741
+ node.elements.forEach((el) => {
25742
+ const translator2 = translatorsByXmlName[el.name];
25743
+ if (translator2) {
25744
+ const encodedAttr = translator2.encode({ nodes: [el] });
25745
+ if (encodedAttr != null) {
25746
+ if (asArray) {
25747
+ attributes.push({ [translator2.sdNodeOrKeyName]: encodedAttr });
25748
+ } else {
25749
+ attributes[translator2.sdNodeOrKeyName] = encodedAttr;
25750
+ }
25751
+ }
25752
+ }
25753
+ });
25754
+ return attributes;
25755
+ }
25756
+ function decodeProperties(translatorsBySdName, properties) {
25757
+ if (!properties || typeof properties !== "object") {
25758
+ return [];
25759
+ }
25760
+ const elements = [];
25761
+ Object.keys(properties).forEach((key2) => {
25762
+ const translator2 = translatorsBySdName[key2];
25763
+ if (translator2) {
25764
+ const result = translator2.decode({ node: { attrs: { [key2]: properties[key2] } } });
25765
+ if (result != null) {
25766
+ result.name = translator2.xmlName;
25767
+ elements.push(result);
25768
+ }
25769
+ }
25770
+ });
25771
+ return elements;
25772
+ }
25773
+ const parseBoolean = (value) => value != null ? ["1", "true"].includes(value) : void 0;
25774
+ const booleanToString = (value) => value != null ? value ? "1" : "0" : void 0;
25775
+ const parseInteger = (value) => {
25776
+ if (value == null) return void 0;
25777
+ const intValue = parseInt(value, 10);
25778
+ return isNaN(intValue) ? void 0 : intValue;
25779
+ };
25780
+ const integerToString = (value) => {
25781
+ const intValue = parseInteger(value);
25782
+ return intValue != void 0 ? String(intValue) : void 0;
25783
+ };
25784
+ const XML_NODE_NAME$k = "w:caps";
25785
+ const SD_ATTR_KEY$6 = "textTransform";
25786
+ const encode$u = (params2, encodedAttrs = {}) => {
25787
+ const { nodes } = params2;
25788
+ const node = nodes[0];
25789
+ if (!node) return void 0;
25790
+ let result;
25791
+ if (!["false", "0"].includes(encodedAttrs.val)) {
25792
+ result = "uppercase";
25793
+ } else {
25794
+ return void 0;
25795
+ }
25796
+ return {
25797
+ type: "attr",
25798
+ xmlName: XML_NODE_NAME$k,
25799
+ sdNodeOrKeyName: SD_ATTR_KEY$6,
25800
+ attributes: { [SD_ATTR_KEY$6]: result }
25801
+ };
25802
+ };
25803
+ const config$i = {
25804
+ xmlName: XML_NODE_NAME$k,
25805
+ sdNodeOrKeyName: SD_ATTR_KEY$6,
25806
+ type: NodeTranslator.translatorTypes.ATTRIBUTE,
25807
+ encode: encode$u,
25808
+ attributes: [createAttributeHandler("w:val")]
25809
+ };
25810
+ const translator$Y = NodeTranslator.from(config$i);
25704
25811
  const runPropertyTranslators = Object.freeze({
25705
- "w:b": translator$12,
25706
- "w:i": translator$11,
25707
- "w:u": translator$10,
25708
- "w:strike": translator$$,
25709
- "w:color": translator$_,
25710
- "w:highlight": translator$15,
25711
- "w:rFonts": translator$Z,
25712
- "w:rStyle": translator$Y,
25713
- "w:sz": translator$X,
25714
- "w:szCs": translator$W
25812
+ "w:b": translator$15,
25813
+ "w:i": translator$14,
25814
+ "w:u": translator$13,
25815
+ "w:strike": translator$12,
25816
+ "w:color": translator$11,
25817
+ "w:highlight": translator$18,
25818
+ "w:rFonts": translator$10,
25819
+ "w:rStyle": translator$$,
25820
+ "w:sz": translator$_,
25821
+ "w:szCs": translator$Z,
25822
+ "w:caps": translator$Y
25715
25823
  });
25716
25824
  const rawRunPropertyXmlNames = Object.freeze(["w:lang", "w:shd"]);
25717
25825
  const RAW_CHILD_NAME_SET = new Set(rawRunPropertyXmlNames);
@@ -25725,9 +25833,9 @@ const toRunPropertyEntry = (candidate) => {
25725
25833
  attributes: { ...candidate.attributes || {} }
25726
25834
  };
25727
25835
  };
25728
- const XML_NODE_NAME$h = "w:rPr";
25836
+ const XML_NODE_NAME$j = "w:rPr";
25729
25837
  const SD_ATTR_KEY$5 = "runProperties";
25730
- const encode$r = (params2) => {
25838
+ const encode$t = (params2) => {
25731
25839
  const { nodes } = params2;
25732
25840
  const node = nodes?.[0] || {};
25733
25841
  const contents = Array.isArray(node.elements) ? node.elements : [];
@@ -25761,16 +25869,16 @@ const encode$r = (params2) => {
25761
25869
  attributes: runPropsArray
25762
25870
  };
25763
25871
  };
25764
- const config$f = {
25765
- xmlName: XML_NODE_NAME$h,
25872
+ const config$h = {
25873
+ xmlName: XML_NODE_NAME$j,
25766
25874
  sdNodeOrKeyName: SD_ATTR_KEY$5,
25767
25875
  type: NodeTranslator.translatorTypes.ATTRIBUTE,
25768
- encode: encode$r
25876
+ encode: encode$t
25769
25877
  };
25770
- const translator$V = NodeTranslator.from(config$f);
25878
+ const translator$X = NodeTranslator.from(config$h);
25771
25879
  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;
25772
25880
  const containsEastAsianCharacters = (text) => EAST_ASIAN_CHARACTER_REGEX.test(text);
25773
- const collectRunProperties = (params2, rPrNode, translator2 = translator$V) => {
25881
+ const collectRunProperties = (params2, rPrNode, translator2 = translator$X) => {
25774
25882
  if (!rPrNode) return { entries: [], hadRPr: false, styleChangeMarks: [] };
25775
25883
  const result = translator2.encode({ ...params2, nodes: [rPrNode] }) || {};
25776
25884
  let entries = [];
@@ -25839,7 +25947,10 @@ const applyRunMarks = (node, inlineMarks, textStyleAttrs) => {
25839
25947
  };
25840
25948
  const deriveStyleMarks = ({ docx, paragraphStyleId, runStyleId }) => {
25841
25949
  const paragraphStyleMarks = collectStyleMarks(paragraphStyleId, docx);
25842
- const runStyleMarks = collectStyleMarks(runStyleId, docx);
25950
+ if (paragraphStyleId?.startsWith("TOC")) {
25951
+ return paragraphStyleMarks;
25952
+ }
25953
+ let runStyleMarks = collectStyleMarks(runStyleId, docx);
25843
25954
  const inlineMarks = mergeInlineMarkSets(paragraphStyleMarks.inlineMarks, runStyleMarks.inlineMarks);
25844
25955
  const textStyleAttrs = mergeTextStyleAttrs(paragraphStyleMarks.textStyleAttrs, runStyleMarks.textStyleAttrs);
25845
25956
  return { inlineMarks, textStyleAttrs };
@@ -26065,6 +26176,13 @@ const splitRunProperties = (entries = [], docx = null) => {
26065
26176
  }
26066
26177
  break;
26067
26178
  }
26179
+ case "w:caps": {
26180
+ if (attributes["textTransform"] != null) {
26181
+ hasTextStyle = true;
26182
+ textStyleAttrs.textTransform = attributes["textTransform"];
26183
+ }
26184
+ break;
26185
+ }
26068
26186
  case "w:rFonts": {
26069
26187
  const asciiFamily = attributes["w:ascii"] || attributes["w:hAnsi"] || (attributes["w:eastAsia"] ? void 0 : attributes["w:val"]);
26070
26188
  const eastAsiaFamily = attributes["w:eastAsia"];
@@ -26084,9 +26202,10 @@ const splitRunProperties = (entries = [], docx = null) => {
26084
26202
  case "w:sz":
26085
26203
  case "w:szCs": {
26086
26204
  const rawSize = Number(attributes["w:val"]);
26205
+ const attrName = entry.xmlName === "w:sz" ? "fontSize" : "fontSizeCs";
26087
26206
  if (Number.isFinite(rawSize) && rawSize > 0) {
26088
26207
  hasTextStyle = true;
26089
- textStyleAttrs.fontSize = `${rawSize / 2}pt`;
26208
+ textStyleAttrs[attrName] = `${rawSize / 2}pt`;
26090
26209
  }
26091
26210
  break;
26092
26211
  }
@@ -26232,46 +26351,166 @@ const ensureTrackedWrapper = (runs, trackingMarksByType = /* @__PURE__ */ new Ma
26232
26351
  }
26233
26352
  return runs;
26234
26353
  };
26235
- const encode$q = (attributes) => {
26354
+ const XML_NODE_NAME$i = "w:hyperlink";
26355
+ const SD_NODE_NAME$c = "link";
26356
+ const _createAttributeHandler = (xmlName, sdName) => ({
26357
+ xmlName,
26358
+ sdName,
26359
+ encode: (attributes) => attributes[xmlName],
26360
+ decode: (attributes) => attributes[sdName]
26361
+ });
26362
+ const validXmlAttributes$a = [
26363
+ _createAttributeHandler("w:anchor", "anchor"),
26364
+ _createAttributeHandler("w:docLocation", "docLocation"),
26365
+ {
26366
+ xmlName: "w:history",
26367
+ sdName: "history",
26368
+ encode: (attributes) => attributes["w:history"] === "1" || attributes["w:history"] === "true",
26369
+ decode: (attributes) => attributes["history"] ? "1" : "0"
26370
+ },
26371
+ _createAttributeHandler("w:tooltip", "tooltip"),
26372
+ _createAttributeHandler("r:id", "rId"),
26373
+ _createAttributeHandler("w:tgtFrame", "target")
26374
+ ];
26375
+ const encode$s = (params2, encodedAttrs) => {
26376
+ const { nodes, docx, nodeListHandler } = params2;
26377
+ const node = nodes[0];
26378
+ let href = _resolveHref(docx, encodedAttrs);
26379
+ const linkMark = { type: "link", attrs: { ...encodedAttrs, href } };
26380
+ const referenceNodeTypes = ["sd:pageReference", "sd:autoPageNumber", "sd:totalPageNumber"];
26381
+ const contentNodes = node.elements.filter((el) => el.name === "w:r" || referenceNodeTypes.includes(el.name));
26382
+ contentNodes.forEach((contentNode) => {
26383
+ const existingMarks = Array.isArray(contentNode.marks) ? contentNode.marks : [];
26384
+ const marksWithoutLink = existingMarks.filter((mark) => mark?.type !== "link");
26385
+ contentNode.marks = [...marksWithoutLink, linkMark];
26386
+ });
26387
+ const updatedNode = nodeListHandler.handler({
26388
+ ...params2,
26389
+ nodes: contentNodes,
26390
+ path: [...params2.path || [], node]
26391
+ });
26392
+ return updatedNode;
26393
+ };
26394
+ const _resolveHref = (docx, encodedAttrs) => {
26395
+ const rels = docx["word/_rels/document.xml.rels"];
26396
+ const relationships = rels.elements.find((el) => el.name === "Relationships");
26397
+ const { elements } = relationships;
26398
+ const { rId, anchor } = encodedAttrs;
26399
+ let href;
26400
+ if (!rId && anchor) {
26401
+ href = `#${anchor}`;
26402
+ } else if (rId) {
26403
+ const rel = elements.find((el) => el.attributes["Id"] === rId) || {};
26404
+ const { attributes: relAttributes = {} } = rel;
26405
+ href = relAttributes["Target"];
26406
+ }
26407
+ return href;
26408
+ };
26409
+ function decode$s(params2) {
26410
+ const { hyperlinkGroup = [params2.node] } = params2.extraParams || {};
26411
+ const node = hyperlinkGroup[0];
26412
+ const linkMark = node.marks.find((m2) => m2.type === "link");
26413
+ const linkAttrs = this.decodeAttributes({ ...params2, node: linkMark });
26414
+ let { anchor, href: link } = linkMark.attrs;
26415
+ const isExternalLink = !anchor;
26416
+ if (isExternalLink) {
26417
+ linkAttrs["r:id"] = _addNewLinkRelationship(params2, link, linkAttrs["r:id"]);
26418
+ }
26419
+ let contentNodes = [];
26420
+ hyperlinkGroup.forEach((linkNode) => {
26421
+ if ("marks" in linkNode) {
26422
+ linkNode.marks = linkNode.marks.filter((m2) => m2.type !== "link");
26423
+ } else {
26424
+ linkNode.attrs.marksAsAttrs = linkNode.attrs.marksAsAttrs.filter((m2) => m2.type !== "link");
26425
+ }
26426
+ const outputNode = exportSchemaToJson({ ...params2, node: linkNode });
26427
+ if (outputNode) {
26428
+ if (outputNode instanceof Array) contentNodes.push(...outputNode);
26429
+ else contentNodes.push(outputNode);
26430
+ }
26431
+ });
26432
+ const newNode = {
26433
+ name: "w:hyperlink",
26434
+ type: "element",
26435
+ attributes: {
26436
+ ...linkAttrs
26437
+ },
26438
+ elements: contentNodes
26439
+ };
26440
+ return newNode;
26441
+ }
26442
+ function _addNewLinkRelationship(params2, link, rId) {
26443
+ if (!rId) rId = generateDocxRandomId();
26444
+ if (!params2.relationships || !Array.isArray(params2.relationships)) {
26445
+ params2.relationships = [];
26446
+ }
26447
+ const existingRel = params2.relationships.find(
26448
+ (rel) => rel.attributes && rel.attributes.Id === rId && rel.attributes.Target === link
26449
+ );
26450
+ if (existingRel) {
26451
+ return rId;
26452
+ }
26453
+ params2.relationships.push({
26454
+ type: "element",
26455
+ name: "Relationship",
26456
+ attributes: {
26457
+ Id: rId,
26458
+ Type: "http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink",
26459
+ Target: link,
26460
+ TargetMode: "External"
26461
+ }
26462
+ });
26463
+ return rId;
26464
+ }
26465
+ const config$g = {
26466
+ xmlName: XML_NODE_NAME$i,
26467
+ sdNodeOrKeyName: SD_NODE_NAME$c,
26468
+ type: NodeTranslator.translatorTypes.NODE,
26469
+ encode: encode$s,
26470
+ decode: decode$s,
26471
+ attributes: validXmlAttributes$a
26472
+ };
26473
+ const translator$W = NodeTranslator.from(config$g);
26474
+ const encode$r = (attributes) => {
26236
26475
  return attributes["w:rsidR"];
26237
26476
  };
26238
- const decode$q = (attrs) => {
26477
+ const decode$r = (attrs) => {
26239
26478
  return attrs.rsidR;
26240
26479
  };
26241
26480
  const attrConfig$9 = Object.freeze({
26242
26481
  xmlName: "w:rsidR",
26243
26482
  sdName: "rsidR",
26244
- encode: encode$q,
26245
- decode: decode$q
26483
+ encode: encode$r,
26484
+ decode: decode$r
26246
26485
  });
26247
- const encode$p = (attributes) => {
26486
+ const encode$q = (attributes) => {
26248
26487
  return attributes["w:rsidRPr"];
26249
26488
  };
26250
- const decode$p = (attrs) => {
26489
+ const decode$q = (attrs) => {
26251
26490
  return attrs.rsidRPr;
26252
26491
  };
26253
26492
  const attrConfig$8 = Object.freeze({
26254
26493
  xmlName: "w:rsidRPr",
26255
26494
  sdName: "rsidRPr",
26256
- encode: encode$p,
26257
- decode: decode$p
26495
+ encode: encode$q,
26496
+ decode: decode$q
26258
26497
  });
26259
- const encode$o = (attributes) => {
26498
+ const encode$p = (attributes) => {
26260
26499
  return attributes["w:rsidDel"];
26261
26500
  };
26262
- const decode$o = (attrs) => {
26501
+ const decode$p = (attrs) => {
26263
26502
  return attrs.rsidDel;
26264
26503
  };
26265
26504
  const attrConfig$7 = Object.freeze({
26266
26505
  xmlName: "w:rsidDel",
26267
26506
  sdName: "rsidDel",
26268
- encode: encode$o,
26269
- decode: decode$o
26507
+ encode: encode$p,
26508
+ decode: decode$p
26270
26509
  });
26271
- const validXmlAttributes$a = [attrConfig$9, attrConfig$8, attrConfig$7];
26272
- const XML_NODE_NAME$g = "w:r";
26510
+ const validXmlAttributes$9 = [attrConfig$9, attrConfig$8, attrConfig$7];
26511
+ const XML_NODE_NAME$h = "w:r";
26273
26512
  const SD_KEY_NAME = "run";
26274
- const encode$n = (params2, encodedAttrs = {}) => {
26513
+ const encode$o = (params2, encodedAttrs = {}) => {
26275
26514
  const { nodes = [], nodeListHandler } = params2 || {};
26276
26515
  const runNode = nodes[0];
26277
26516
  if (!runNode) return void 0;
@@ -26319,9 +26558,11 @@ const encode$n = (params2, encodedAttrs = {}) => {
26319
26558
  }
26320
26559
  return runNodeResult;
26321
26560
  };
26322
- const decode$n = (params2, decodedAttrs = {}) => {
26561
+ const decode$o = (params2, decodedAttrs = {}) => {
26323
26562
  const { node } = params2 || {};
26324
26563
  if (!node) return void 0;
26564
+ const isLinkNode = node.marks?.some((m2) => m2.type === "link");
26565
+ if (isLinkNode) return translator$W.decode(params2);
26325
26566
  const { runNode: runNodeForExport, trackingMarksByType } = prepareRunTrackingContext(node);
26326
26567
  const runAttrs = runNodeForExport.attrs || {};
26327
26568
  const runProperties = Array.isArray(runAttrs.runProperties) ? runAttrs.runProperties : [];
@@ -26376,7 +26617,7 @@ const decode$n = (params2, decodedAttrs = {}) => {
26376
26617
  runs.push(trackedClone);
26377
26618
  return;
26378
26619
  }
26379
- const runWrapper = { name: XML_NODE_NAME$g, elements: [] };
26620
+ const runWrapper = { name: XML_NODE_NAME$h, elements: [] };
26380
26621
  applyBaseRunProps(runWrapper);
26381
26622
  if (!Array.isArray(runWrapper.elements)) runWrapper.elements = [];
26382
26623
  runWrapper.elements.push(cloneXmlNode(child));
@@ -26384,7 +26625,7 @@ const decode$n = (params2, decodedAttrs = {}) => {
26384
26625
  });
26385
26626
  const trackedRuns = ensureTrackedWrapper(runs, trackingMarksByType);
26386
26627
  if (!trackedRuns.length) {
26387
- const emptyRun = { name: XML_NODE_NAME$g, elements: [] };
26628
+ const emptyRun = { name: XML_NODE_NAME$h, elements: [] };
26388
26629
  applyBaseRunProps(emptyRun);
26389
26630
  trackedRuns.push(emptyRun);
26390
26631
  }
@@ -26398,148 +26639,15 @@ const decode$n = (params2, decodedAttrs = {}) => {
26398
26639
  }
26399
26640
  return trackedRuns;
26400
26641
  };
26401
- const config$e = {
26402
- xmlName: XML_NODE_NAME$g,
26642
+ const config$f = {
26643
+ xmlName: XML_NODE_NAME$h,
26403
26644
  sdNodeOrKeyName: SD_KEY_NAME,
26404
26645
  type: NodeTranslator.translatorTypes.NODE,
26405
- encode: encode$n,
26406
- decode: decode$n,
26407
- attributes: validXmlAttributes$a
26408
- };
26409
- const translator$U = NodeTranslator.from(config$e);
26410
- const generateV2HandlerEntity = (handlerName, translator2) => ({
26411
- handlerName,
26412
- handler: (params2) => {
26413
- const { nodes } = params2;
26414
- if (nodes.length === 0 || nodes[0].name !== translator2.xmlName) {
26415
- return { nodes: [], consumed: 0 };
26416
- }
26417
- const result = translator2.encode(params2);
26418
- if (!result) return { nodes: [], consumed: 0 };
26419
- return {
26420
- nodes: Array.isArray(result) ? result : [result],
26421
- consumed: 1
26422
- };
26423
- }
26424
- });
26425
- function createSingleAttrPropertyHandler(xmlName, sdName = null, attrName = "w:val", transformEncode = null, transformDecode = null) {
26426
- if (!sdName) sdName = xmlName.split(":")[1];
26427
- if (!transformEncode) transformEncode = (v2) => v2;
26428
- if (!transformDecode) transformDecode = (v2) => v2;
26429
- return {
26430
- xmlName,
26431
- sdNodeOrKeyName: sdName,
26432
- encode: ({ nodes }) => {
26433
- return transformEncode(nodes[0].attributes[attrName]) ?? void 0;
26434
- },
26435
- decode: ({ node }) => {
26436
- const value = node.attrs?.[sdName] != null ? transformDecode(node.attrs[sdName]) : void 0;
26437
- return value != null ? { name: xmlName, attributes: { [attrName]: value } } : void 0;
26438
- }
26439
- };
26440
- }
26441
- function createMeasurementPropertyHandler(xmlName, sdName = null) {
26442
- if (!sdName) sdName = xmlName.split(":")[1];
26443
- return {
26444
- xmlName,
26445
- sdNodeOrKeyName: sdName,
26446
- attributes: [
26447
- createAttributeHandler("w:w", "value", parseInteger, integerToString),
26448
- createAttributeHandler("w:type")
26449
- ],
26450
- encode: (_2, encodedAttrs) => {
26451
- return encodedAttrs["value"] != null ? encodedAttrs : void 0;
26452
- },
26453
- decode: function({ node }) {
26454
- const decodedAttrs = this.decodeAttributes({ node: { ...node, attrs: node.attrs[sdName] || {} } });
26455
- return decodedAttrs["w:w"] != null ? { attributes: decodedAttrs } : void 0;
26456
- }
26457
- };
26458
- }
26459
- function createBorderPropertyHandler(xmlName, sdName = null) {
26460
- if (!sdName) sdName = xmlName.split(":")[1];
26461
- return {
26462
- xmlName,
26463
- sdNodeOrKeyName: sdName,
26464
- attributes: [
26465
- createAttributeHandler("w:val"),
26466
- createAttributeHandler("w:color"),
26467
- createAttributeHandler("w:themeColor"),
26468
- createAttributeHandler("w:themeTint"),
26469
- createAttributeHandler("w:themeShade"),
26470
- createAttributeHandler("w:sz", "size", parseInteger, integerToString),
26471
- createAttributeHandler("w:space", null, parseInteger, integerToString),
26472
- createAttributeHandler("w:shadow", null, parseBoolean, booleanToString),
26473
- createAttributeHandler("w:frame", null, parseBoolean, booleanToString)
26474
- ],
26475
- encode: (params2, encodedAttrs) => {
26476
- return Object.keys(encodedAttrs).length > 0 ? encodedAttrs : void 0;
26477
- },
26478
- decode: function({ node }, context) {
26479
- const decodedAttrs = this.decodeAttributes({ node: { ...node, attrs: node.attrs[sdName] || {} } });
26480
- return Object.keys(decodedAttrs).length > 0 ? { attributes: decodedAttrs } : void 0;
26481
- }
26482
- };
26483
- }
26484
- const createAttributeHandler = (xmlName, sdName = null, transformEncode = null, transformDecode = null) => {
26485
- if (!transformEncode) transformEncode = (v2) => v2;
26486
- if (!transformDecode) transformDecode = (v2) => v2;
26487
- if (!sdName) sdName = xmlName.split(":")[1];
26488
- return {
26489
- xmlName,
26490
- sdName,
26491
- encode: (attributes) => transformEncode(attributes[xmlName]),
26492
- decode: (attributes) => transformDecode(attributes[sdName])
26493
- };
26494
- };
26495
- function encodeProperties(node, translatorsByXmlName, asArray = false) {
26496
- if (!node?.elements || node.elements.length === 0) {
26497
- return asArray ? [] : {};
26498
- }
26499
- const attributes = asArray ? [] : {};
26500
- node.elements.forEach((el) => {
26501
- const translator2 = translatorsByXmlName[el.name];
26502
- if (translator2) {
26503
- const encodedAttr = translator2.encode({ nodes: [el] });
26504
- if (encodedAttr != null) {
26505
- if (asArray) {
26506
- attributes.push({ [translator2.sdNodeOrKeyName]: encodedAttr });
26507
- } else {
26508
- attributes[translator2.sdNodeOrKeyName] = encodedAttr;
26509
- }
26510
- }
26511
- }
26512
- });
26513
- return attributes;
26514
- }
26515
- function decodeProperties(translatorsBySdName, properties) {
26516
- if (!properties || typeof properties !== "object") {
26517
- return [];
26518
- }
26519
- const elements = [];
26520
- Object.keys(properties).forEach((key2) => {
26521
- const translator2 = translatorsBySdName[key2];
26522
- if (translator2) {
26523
- const result = translator2.decode({ node: { attrs: { [key2]: properties[key2] } } });
26524
- if (result != null) {
26525
- result.name = translator2.xmlName;
26526
- elements.push(result);
26527
- }
26528
- }
26529
- });
26530
- return elements;
26531
- }
26532
- const parseBoolean = (value) => value != null ? ["1", "true"].includes(value) : void 0;
26533
- const booleanToString = (value) => value != null ? value ? "1" : "0" : void 0;
26534
- const parseInteger = (value) => {
26535
- if (value == null) return void 0;
26536
- const intValue = parseInt(value, 10);
26537
- return isNaN(intValue) ? void 0 : intValue;
26538
- };
26539
- const integerToString = (value) => {
26540
- const intValue = parseInteger(value);
26541
- return intValue != void 0 ? String(intValue) : void 0;
26646
+ encode: encode$o,
26647
+ decode: decode$o,
26648
+ attributes: validXmlAttributes$9
26542
26649
  };
26650
+ const translator$V = NodeTranslator.from(config$f);
26543
26651
  function preProcessVerticalMergeCells(table, { editorSchema }) {
26544
26652
  if (!table || !Array.isArray(table.content)) {
26545
26653
  return table;
@@ -26580,13 +26688,13 @@ function preProcessVerticalMergeCells(table, { editorSchema }) {
26580
26688
  }
26581
26689
  return table;
26582
26690
  }
26583
- const translator$T = NodeTranslator.from({
26691
+ const translator$U = NodeTranslator.from({
26584
26692
  xmlName: "w:cantSplit",
26585
26693
  sdNodeOrKeyName: "cantSplit",
26586
26694
  encode: ({ nodes }) => ["1", "true"].includes(nodes[0].attributes?.["w:val"] ?? "1"),
26587
26695
  decode: ({ node }) => node.attrs?.cantSplit ? { attributes: {} } : void 0
26588
26696
  });
26589
- const translator$S = NodeTranslator.from({
26697
+ const translator$T = NodeTranslator.from({
26590
26698
  xmlName: "w:cnfStyle",
26591
26699
  sdNodeOrKeyName: "cnfStyle",
26592
26700
  attributes: [
@@ -26612,8 +26720,8 @@ const translator$S = NodeTranslator.from({
26612
26720
  return Object.keys(decodedAttrs).length > 0 ? { attributes: decodedAttrs } : void 0;
26613
26721
  }
26614
26722
  });
26615
- const translator$R = NodeTranslator.from(createSingleAttrPropertyHandler("w:divId"));
26616
- const translator$Q = NodeTranslator.from(
26723
+ const translator$S = NodeTranslator.from(createSingleAttrPropertyHandler("w:divId"));
26724
+ const translator$R = NodeTranslator.from(
26617
26725
  createSingleAttrPropertyHandler(
26618
26726
  "w:gridAfter",
26619
26727
  null,
@@ -26622,7 +26730,7 @@ const translator$Q = NodeTranslator.from(
26622
26730
  (v2) => integerToString(v2)
26623
26731
  )
26624
26732
  );
26625
- const translator$P = NodeTranslator.from(
26733
+ const translator$Q = NodeTranslator.from(
26626
26734
  createSingleAttrPropertyHandler(
26627
26735
  "w:gridBefore",
26628
26736
  null,
@@ -26631,21 +26739,21 @@ const translator$P = NodeTranslator.from(
26631
26739
  (v2) => integerToString(v2)
26632
26740
  )
26633
26741
  );
26634
- const translator$O = NodeTranslator.from({
26742
+ const translator$P = NodeTranslator.from({
26635
26743
  xmlName: "w:hidden",
26636
26744
  sdNodeOrKeyName: "hidden",
26637
26745
  encode: ({ nodes }) => parseBoolean(nodes[0].attributes?.["w:val"] ?? "1"),
26638
26746
  decode: ({ node }) => node.attrs.hidden ? { attributes: {} } : void 0
26639
26747
  });
26640
- const translator$N = NodeTranslator.from(createSingleAttrPropertyHandler("w:jc", "justification"));
26641
- const translator$M = NodeTranslator.from(createMeasurementPropertyHandler("w:tblCellSpacing", "tableCellSpacing"));
26642
- const translator$L = NodeTranslator.from({
26748
+ const translator$O = NodeTranslator.from(createSingleAttrPropertyHandler("w:jc", "justification"));
26749
+ const translator$N = NodeTranslator.from(createMeasurementPropertyHandler("w:tblCellSpacing", "tableCellSpacing"));
26750
+ const translator$M = NodeTranslator.from({
26643
26751
  xmlName: "w:tblHeader",
26644
26752
  sdNodeOrKeyName: "repeatHeader",
26645
26753
  encode: ({ nodes }) => parseBoolean(nodes[0].attributes?.["w:val"] ?? "1"),
26646
26754
  decode: ({ node }) => node.attrs.repeatHeader ? { attributes: {} } : void 0
26647
26755
  });
26648
- const translator$K = NodeTranslator.from({
26756
+ const translator$L = NodeTranslator.from({
26649
26757
  xmlName: "w:trHeight",
26650
26758
  sdNodeOrKeyName: "rowHeight",
26651
26759
  encode: ({ nodes }) => {
@@ -26672,11 +26780,11 @@ const translator$K = NodeTranslator.from({
26672
26780
  return Object.keys(heightAttrs).length > 0 ? { attributes: heightAttrs } : void 0;
26673
26781
  }
26674
26782
  });
26675
- const translator$J = NodeTranslator.from(createMeasurementPropertyHandler("w:wAfter"));
26676
- const translator$I = NodeTranslator.from(createMeasurementPropertyHandler("w:wBefore"));
26677
- const XML_NODE_NAME$f = "w:trPr";
26783
+ const translator$K = NodeTranslator.from(createMeasurementPropertyHandler("w:wAfter"));
26784
+ const translator$J = NodeTranslator.from(createMeasurementPropertyHandler("w:wBefore"));
26785
+ const XML_NODE_NAME$g = "w:trPr";
26678
26786
  const SD_ATTR_KEY$4 = "tableRowProperties";
26679
- const encode$m = (params2) => {
26787
+ const encode$n = (params2) => {
26680
26788
  const { nodes } = params2;
26681
26789
  const node = nodes[0];
26682
26790
  let attributes = {
@@ -26690,12 +26798,12 @@ const encode$m = (params2) => {
26690
26798
  };
26691
26799
  return {
26692
26800
  type: NodeTranslator.translatorTypes.ATTRIBUTE,
26693
- xmlName: XML_NODE_NAME$f,
26801
+ xmlName: XML_NODE_NAME$g,
26694
26802
  sdNodeOrKeyName: SD_ATTR_KEY$4,
26695
26803
  attributes
26696
26804
  };
26697
26805
  };
26698
- const decode$m = (params2) => {
26806
+ const decode$n = (params2) => {
26699
26807
  const { tableRowProperties = {} } = params2.node.attrs || {};
26700
26808
  const elements = decodeProperties(propertyTranslatorsBySdName$2, tableRowProperties);
26701
26809
  const newNode = {
@@ -26707,6 +26815,7 @@ const decode$m = (params2) => {
26707
26815
  return newNode;
26708
26816
  };
26709
26817
  const propertyTranslators$3 = [
26818
+ translator$U,
26710
26819
  translator$T,
26711
26820
  translator$S,
26712
26821
  translator$R,
@@ -26717,8 +26826,7 @@ const propertyTranslators$3 = [
26717
26826
  translator$M,
26718
26827
  translator$L,
26719
26828
  translator$K,
26720
- translator$J,
26721
- translator$I
26829
+ translator$J
26722
26830
  ];
26723
26831
  const propertyTranslatorsByXmlName$2 = {};
26724
26832
  propertyTranslators$3.forEach((translator2) => {
@@ -26728,25 +26836,25 @@ const propertyTranslatorsBySdName$2 = {};
26728
26836
  propertyTranslators$3.forEach((translator2) => {
26729
26837
  propertyTranslatorsBySdName$2[translator2.sdNodeOrKeyName] = translator2;
26730
26838
  });
26731
- const config$d = {
26732
- xmlName: XML_NODE_NAME$f,
26839
+ const config$e = {
26840
+ xmlName: XML_NODE_NAME$g,
26733
26841
  sdNodeOrKeyName: SD_ATTR_KEY$4,
26734
26842
  type: NodeTranslator.translatorTypes.ATTRIBUTE,
26735
- encode: encode$m,
26736
- decode: decode$m
26843
+ encode: encode$n,
26844
+ decode: decode$n
26737
26845
  };
26738
- const translator$H = NodeTranslator.from(config$d);
26739
- const XML_NODE_NAME$e = "w:tr";
26740
- const SD_NODE_NAME$a = "tableRow";
26741
- const validXmlAttributes$9 = ["w:rsidDel", "w:rsidR", "w:rsidRPr", "w:rsidTr", "w14:paraId", "w14:textId"].map(
26846
+ const translator$I = NodeTranslator.from(config$e);
26847
+ const XML_NODE_NAME$f = "w:tr";
26848
+ const SD_NODE_NAME$b = "tableRow";
26849
+ const validXmlAttributes$8 = ["w:rsidDel", "w:rsidR", "w:rsidRPr", "w:rsidTr", "w14:paraId", "w14:textId"].map(
26742
26850
  (xmlName) => createAttributeHandler(xmlName)
26743
26851
  );
26744
- const encode$l = (params2, encodedAttrs) => {
26852
+ const encode$m = (params2, encodedAttrs) => {
26745
26853
  const { row } = params2.extraParams;
26746
26854
  let tableRowProperties = {};
26747
26855
  const tPr = row.elements.find((el) => el.name === "w:trPr");
26748
26856
  if (tPr) {
26749
- ({ attributes: tableRowProperties } = translator$H.encode({
26857
+ ({ attributes: tableRowProperties } = translator$I.encode({
26750
26858
  ...params2,
26751
26859
  nodes: [tPr]
26752
26860
  }));
@@ -26759,7 +26867,7 @@ const encode$l = (params2, encodedAttrs) => {
26759
26867
  let currentColumnIndex = 0;
26760
26868
  const content = cellNodes?.map((n) => {
26761
26869
  let columnWidth = gridColumnWidths?.[currentColumnIndex] || null;
26762
- const result = translator$8.encode({
26870
+ const result = translator$9.encode({
26763
26871
  ...params2,
26764
26872
  extraParams: {
26765
26873
  ...params2.extraParams,
@@ -26781,7 +26889,7 @@ const encode$l = (params2, encodedAttrs) => {
26781
26889
  };
26782
26890
  return newNode;
26783
26891
  };
26784
- const decode$l = (params2, decodedAttrs) => {
26892
+ const decode$m = (params2, decodedAttrs) => {
26785
26893
  const { node } = params2;
26786
26894
  const elements = translateChildNodes(params2);
26787
26895
  if (node.attrs?.tableRowProperties) {
@@ -26793,7 +26901,7 @@ const decode$l = (params2, decodedAttrs) => {
26793
26901
  }
26794
26902
  }
26795
26903
  tableRowProperties["cantSplit"] = node.attrs["cantSplit"];
26796
- const trPr = translator$H.decode({
26904
+ const trPr = translator$I.decode({
26797
26905
  ...params2,
26798
26906
  node: { ...node, attrs: { ...node.attrs, tableRowProperties } }
26799
26907
  });
@@ -26805,22 +26913,22 @@ const decode$l = (params2, decodedAttrs) => {
26805
26913
  elements
26806
26914
  };
26807
26915
  };
26808
- const config$c = {
26809
- xmlName: XML_NODE_NAME$e,
26810
- sdNodeOrKeyName: SD_NODE_NAME$a,
26916
+ const config$d = {
26917
+ xmlName: XML_NODE_NAME$f,
26918
+ sdNodeOrKeyName: SD_NODE_NAME$b,
26811
26919
  type: NodeTranslator.translatorTypes.NODE,
26812
- encode: encode$l,
26813
- decode: decode$l,
26814
- attributes: validXmlAttributes$9
26920
+ encode: encode$m,
26921
+ decode: decode$m,
26922
+ attributes: validXmlAttributes$8
26815
26923
  };
26816
- const translator$G = NodeTranslator.from(config$c);
26817
- const translator$F = NodeTranslator.from({
26924
+ const translator$H = NodeTranslator.from(config$d);
26925
+ const translator$G = NodeTranslator.from({
26818
26926
  xmlName: "w:bidiVisual",
26819
26927
  sdNodeOrKeyName: "rightToLeft",
26820
26928
  encode: ({ nodes }) => parseBoolean(nodes[0].attributes?.["w:val"] ?? "1"),
26821
26929
  decode: ({ node }) => node.attrs.rightToLeft ? { attributes: {} } : void 0
26822
26930
  });
26823
- const translator$E = NodeTranslator.from({
26931
+ const translator$F = NodeTranslator.from({
26824
26932
  xmlName: "w:shd",
26825
26933
  sdNodeOrKeyName: "shading",
26826
26934
  attributes: [
@@ -26842,11 +26950,11 @@ const translator$E = NodeTranslator.from({
26842
26950
  return Object.keys(decodedAttrs).length > 0 ? { attributes: decodedAttrs } : void 0;
26843
26951
  }
26844
26952
  });
26845
- const translator$D = NodeTranslator.from(createSingleAttrPropertyHandler("w:tblCaption", "caption"));
26846
- const translator$C = NodeTranslator.from(createSingleAttrPropertyHandler("w:tblDescription", "description"));
26847
- const translator$B = NodeTranslator.from(createMeasurementPropertyHandler("w:tblInd", "tableIndent"));
26848
- const translator$A = NodeTranslator.from(createSingleAttrPropertyHandler("w:tblLayout", "tableLayout", "w:type"));
26849
- const translator$z = NodeTranslator.from({
26953
+ const translator$E = NodeTranslator.from(createSingleAttrPropertyHandler("w:tblCaption", "caption"));
26954
+ const translator$D = NodeTranslator.from(createSingleAttrPropertyHandler("w:tblDescription", "description"));
26955
+ const translator$C = NodeTranslator.from(createMeasurementPropertyHandler("w:tblInd", "tableIndent"));
26956
+ const translator$B = NodeTranslator.from(createSingleAttrPropertyHandler("w:tblLayout", "tableLayout", "w:type"));
26957
+ const translator$A = NodeTranslator.from({
26850
26958
  xmlName: "w:tblLook",
26851
26959
  sdNodeOrKeyName: "tblLook",
26852
26960
  attributes: ["w:firstColumn", "w:firstRow", "w:lastColumn", "w:lastRow", "w:noHBand", "w:noVBand"].map((attr) => createAttributeHandler(attr, null, parseBoolean, booleanToString)).concat([createAttributeHandler("w:val")]),
@@ -26858,16 +26966,16 @@ const translator$z = NodeTranslator.from({
26858
26966
  return Object.keys(decodedAttrs).length > 0 ? { attributes: decodedAttrs } : void 0;
26859
26967
  }
26860
26968
  });
26861
- const translator$y = NodeTranslator.from(createSingleAttrPropertyHandler("w:tblOverlap", "overlap"));
26862
- const translator$x = NodeTranslator.from(createSingleAttrPropertyHandler("w:tblStyle", "tableStyleId"));
26863
- const translator$w = NodeTranslator.from(
26969
+ const translator$z = NodeTranslator.from(createSingleAttrPropertyHandler("w:tblOverlap", "overlap"));
26970
+ const translator$y = NodeTranslator.from(createSingleAttrPropertyHandler("w:tblStyle", "tableStyleId"));
26971
+ const translator$x = NodeTranslator.from(
26864
26972
  createSingleAttrPropertyHandler("w:tblStyleColBandSize", "tableStyleColBandSize")
26865
26973
  );
26866
- const translator$v = NodeTranslator.from(
26974
+ const translator$w = NodeTranslator.from(
26867
26975
  createSingleAttrPropertyHandler("w:tblStyleRowBandSize", "tableStyleRowBandSize")
26868
26976
  );
26869
- const translator$u = NodeTranslator.from(createMeasurementPropertyHandler("w:tblW", "tableWidth"));
26870
- const translator$t = NodeTranslator.from({
26977
+ const translator$v = NodeTranslator.from(createMeasurementPropertyHandler("w:tblW", "tableWidth"));
26978
+ const translator$u = NodeTranslator.from({
26871
26979
  xmlName: "w:tblpPr",
26872
26980
  sdNodeOrKeyName: "floatingTableProperties",
26873
26981
  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))),
@@ -26879,29 +26987,29 @@ const translator$t = NodeTranslator.from({
26879
26987
  return Object.keys(decodedAttrs).length > 0 ? { attributes: decodedAttrs } : void 0;
26880
26988
  }
26881
26989
  });
26882
- const translator$s = NodeTranslator.from(createBorderPropertyHandler("w:bottom"));
26883
- const translator$r = NodeTranslator.from(createMeasurementPropertyHandler("w:bottom", "marginBottom"));
26884
- const translator$q = NodeTranslator.from(createBorderPropertyHandler("w:end"));
26885
- const translator$p = NodeTranslator.from(createMeasurementPropertyHandler("w:end", "marginEnd"));
26886
- const translator$o = NodeTranslator.from(createBorderPropertyHandler("w:insideH"));
26887
- const translator$n = NodeTranslator.from(createBorderPropertyHandler("w:insideV"));
26888
- const translator$m = NodeTranslator.from(createBorderPropertyHandler("w:left"));
26889
- const translator$l = NodeTranslator.from(createMeasurementPropertyHandler("w:left", "marginLeft"));
26890
- const translator$k = NodeTranslator.from(createBorderPropertyHandler("w:right"));
26891
- const translator$j = NodeTranslator.from(createMeasurementPropertyHandler("w:right", "marginRight"));
26892
- const translator$i = NodeTranslator.from(createBorderPropertyHandler("w:start"));
26893
- const translator$h = NodeTranslator.from(createMeasurementPropertyHandler("w:start", "marginStart"));
26894
- const translator$g = NodeTranslator.from(createBorderPropertyHandler("w:top"));
26895
- const translator$f = NodeTranslator.from(createMeasurementPropertyHandler("w:top", "marginTop"));
26896
- const XML_NODE_NAME$d = "w:tblBorders";
26990
+ const translator$t = NodeTranslator.from(createBorderPropertyHandler("w:bottom"));
26991
+ const translator$s = NodeTranslator.from(createMeasurementPropertyHandler("w:bottom", "marginBottom"));
26992
+ const translator$r = NodeTranslator.from(createBorderPropertyHandler("w:end"));
26993
+ const translator$q = NodeTranslator.from(createMeasurementPropertyHandler("w:end", "marginEnd"));
26994
+ const translator$p = NodeTranslator.from(createBorderPropertyHandler("w:insideH"));
26995
+ const translator$o = NodeTranslator.from(createBorderPropertyHandler("w:insideV"));
26996
+ const translator$n = NodeTranslator.from(createBorderPropertyHandler("w:left"));
26997
+ const translator$m = NodeTranslator.from(createMeasurementPropertyHandler("w:left", "marginLeft"));
26998
+ const translator$l = NodeTranslator.from(createBorderPropertyHandler("w:right"));
26999
+ const translator$k = NodeTranslator.from(createMeasurementPropertyHandler("w:right", "marginRight"));
27000
+ const translator$j = NodeTranslator.from(createBorderPropertyHandler("w:start"));
27001
+ const translator$i = NodeTranslator.from(createMeasurementPropertyHandler("w:start", "marginStart"));
27002
+ const translator$h = NodeTranslator.from(createBorderPropertyHandler("w:top"));
27003
+ const translator$g = NodeTranslator.from(createMeasurementPropertyHandler("w:top", "marginTop"));
27004
+ const XML_NODE_NAME$e = "w:tblBorders";
26897
27005
  const SD_ATTR_KEY$3 = "borders";
26898
- const encode$k = (params2) => {
27006
+ const encode$l = (params2) => {
26899
27007
  const { nodes } = params2;
26900
27008
  const node = nodes[0];
26901
27009
  const attributes = encodeProperties(node, tblBordersTranslatorsByXmlName);
26902
27010
  return Object.keys(attributes).length > 0 ? attributes : void 0;
26903
27011
  };
26904
- const decode$k = (params2) => {
27012
+ const decode$l = (params2) => {
26905
27013
  const { borders = {} } = params2.node.attrs || {};
26906
27014
  const elements = decodeProperties(tblBordersTranslatorsBySdName, borders);
26907
27015
  const newNode = {
@@ -26913,14 +27021,14 @@ const decode$k = (params2) => {
26913
27021
  return newNode;
26914
27022
  };
26915
27023
  const propertyTranslators$2 = [
26916
- translator$s,
26917
- translator$q,
27024
+ translator$t,
27025
+ translator$r,
27026
+ translator$p,
26918
27027
  translator$o,
26919
27028
  translator$n,
26920
- translator$m,
26921
- translator$k,
26922
- translator$i,
26923
- translator$g
27029
+ translator$l,
27030
+ translator$j,
27031
+ translator$h
26924
27032
  ];
26925
27033
  const tblBordersTranslatorsByXmlName = {};
26926
27034
  const tblBordersTranslatorsBySdName = {};
@@ -26928,27 +27036,27 @@ propertyTranslators$2.forEach((translator2) => {
26928
27036
  tblBordersTranslatorsByXmlName[translator2.xmlName] = translator2;
26929
27037
  tblBordersTranslatorsBySdName[translator2.sdNodeOrKeyName] = translator2;
26930
27038
  });
26931
- const translator$e = NodeTranslator.from({
26932
- xmlName: XML_NODE_NAME$d,
27039
+ const translator$f = NodeTranslator.from({
27040
+ xmlName: XML_NODE_NAME$e,
26933
27041
  sdNodeOrKeyName: SD_ATTR_KEY$3,
26934
27042
  type: NodeTranslator.translatorTypes.NODE,
26935
27043
  attributes: [],
26936
- encode: encode$k,
26937
- decode: decode$k
27044
+ encode: encode$l,
27045
+ decode: decode$l
26938
27046
  });
26939
- const XML_NODE_NAME$c = "w:tblCellMar";
27047
+ const XML_NODE_NAME$d = "w:tblCellMar";
26940
27048
  const SD_ATTR_KEY$2 = "cellMargins";
26941
- const encode$j = (params2) => {
27049
+ const encode$k = (params2) => {
26942
27050
  const { nodes } = params2;
26943
27051
  const node = nodes[0];
26944
27052
  const attributes = encodeProperties(node, propertyTranslatorsByXmlName$1);
26945
27053
  return Object.keys(attributes).length > 0 ? attributes : void 0;
26946
27054
  };
26947
- const decode$j = (params2) => {
27055
+ const decode$k = (params2) => {
26948
27056
  const { cellMargins = {} } = params2.node.attrs || {};
26949
27057
  const elements = decodeProperties(propertyTranslatorsBySdName$1, cellMargins);
26950
27058
  const newNode = {
26951
- name: XML_NODE_NAME$c,
27059
+ name: XML_NODE_NAME$d,
26952
27060
  type: "element",
26953
27061
  attributes: {},
26954
27062
  elements
@@ -26956,12 +27064,12 @@ const decode$j = (params2) => {
26956
27064
  return newNode;
26957
27065
  };
26958
27066
  const propertyTranslators$1 = [
26959
- translator$r,
26960
- translator$p,
26961
- translator$l,
26962
- translator$j,
26963
- translator$h,
26964
- translator$f
27067
+ translator$s,
27068
+ translator$q,
27069
+ translator$m,
27070
+ translator$k,
27071
+ translator$i,
27072
+ translator$g
26965
27073
  ];
26966
27074
  const propertyTranslatorsByXmlName$1 = {};
26967
27075
  const propertyTranslatorsBySdName$1 = {};
@@ -26969,27 +27077,27 @@ propertyTranslators$1.forEach((translator2) => {
26969
27077
  propertyTranslatorsByXmlName$1[translator2.xmlName] = translator2;
26970
27078
  propertyTranslatorsBySdName$1[translator2.sdNodeOrKeyName] = translator2;
26971
27079
  });
26972
- const translator$d = NodeTranslator.from({
26973
- xmlName: XML_NODE_NAME$c,
27080
+ const translator$e = NodeTranslator.from({
27081
+ xmlName: XML_NODE_NAME$d,
26974
27082
  sdNodeOrKeyName: SD_ATTR_KEY$2,
26975
27083
  type: NodeTranslator.translatorTypes.NODE,
26976
27084
  attributes: [],
26977
- encode: encode$j,
26978
- decode: decode$j
27085
+ encode: encode$k,
27086
+ decode: decode$k
26979
27087
  });
26980
- const XML_NODE_NAME$b = "w:tblPr";
27088
+ const XML_NODE_NAME$c = "w:tblPr";
26981
27089
  const SD_ATTR_KEY$1 = "tableProperties";
26982
- const encode$i = (params2) => {
27090
+ const encode$j = (params2) => {
26983
27091
  const { nodes } = params2;
26984
27092
  const node = nodes[0];
26985
27093
  const attributes = encodeProperties(node, propertyTranslatorsByXmlName);
26986
27094
  return {
26987
- xmlName: XML_NODE_NAME$b,
27095
+ xmlName: XML_NODE_NAME$c,
26988
27096
  sdNodeOrKeyName: SD_ATTR_KEY$1,
26989
27097
  attributes
26990
27098
  };
26991
27099
  };
26992
- const decode$i = (params2) => {
27100
+ const decode$j = (params2) => {
26993
27101
  const { tableProperties = {} } = params2.node.attrs || {};
26994
27102
  const elements = decodeProperties(propertyTranslatorsBySdName, tableProperties);
26995
27103
  const newNode = {
@@ -27001,11 +27109,12 @@ const decode$i = (params2) => {
27001
27109
  return newNode;
27002
27110
  };
27003
27111
  const propertyTranslators = [
27112
+ translator$G,
27113
+ translator$O,
27004
27114
  translator$F,
27005
- translator$N,
27006
27115
  translator$E,
27116
+ translator$N,
27007
27117
  translator$D,
27008
- translator$M,
27009
27118
  translator$C,
27010
27119
  translator$B,
27011
27120
  translator$A,
@@ -27015,9 +27124,8 @@ const propertyTranslators = [
27015
27124
  translator$w,
27016
27125
  translator$v,
27017
27126
  translator$u,
27018
- translator$t,
27019
- translator$e,
27020
- translator$d
27127
+ translator$f,
27128
+ translator$e
27021
27129
  ];
27022
27130
  const propertyTranslatorsByXmlName = {};
27023
27131
  const propertyTranslatorsBySdName = {};
@@ -27025,14 +27133,14 @@ propertyTranslators.forEach((translator2) => {
27025
27133
  propertyTranslatorsByXmlName[translator2.xmlName] = translator2;
27026
27134
  propertyTranslatorsBySdName[translator2.sdNodeOrKeyName] = translator2;
27027
27135
  });
27028
- const config$b = {
27029
- xmlName: XML_NODE_NAME$b,
27136
+ const config$c = {
27137
+ xmlName: XML_NODE_NAME$c,
27030
27138
  sdNodeOrKeyName: SD_ATTR_KEY$1,
27031
- encode: encode$i,
27032
- decode: decode$i
27139
+ encode: encode$j,
27140
+ decode: decode$j
27033
27141
  };
27034
- const translator$c = NodeTranslator.from(config$b);
27035
- const translator$b = NodeTranslator.from(
27142
+ const translator$d = NodeTranslator.from(config$c);
27143
+ const translator$c = NodeTranslator.from(
27036
27144
  createSingleAttrPropertyHandler("w:gridCol", "col", "w:w", parseInteger, integerToString)
27037
27145
  );
27038
27146
  const DEFAULT_COLUMN_WIDTH_PX = 100;
@@ -27082,20 +27190,20 @@ const resolveFallbackColumnWidthTwips = (params2, totalColumns, cellMinWidthTwip
27082
27190
  }
27083
27191
  return Math.max(fallbackWidthTwips, cellMinWidthTwips);
27084
27192
  };
27085
- const XML_NODE_NAME$a = "w:tblGrid";
27193
+ const XML_NODE_NAME$b = "w:tblGrid";
27086
27194
  const SD_ATTR_KEY = "grid";
27087
27195
  const cellMinWidth = pixelsToTwips(10);
27088
- const encode$h = (params2) => {
27196
+ const encode$i = (params2) => {
27089
27197
  const { nodes } = params2;
27090
27198
  const node = nodes[0];
27091
- const attributes = encodeProperties(node, { [translator$b.xmlName]: translator$b }, true);
27199
+ const attributes = encodeProperties(node, { [translator$c.xmlName]: translator$c }, true);
27092
27200
  return {
27093
- xmlName: XML_NODE_NAME$a,
27201
+ xmlName: XML_NODE_NAME$b,
27094
27202
  sdNodeOrKeyName: SD_ATTR_KEY,
27095
27203
  attributes
27096
27204
  };
27097
27205
  };
27098
- const decode$h = (params2) => {
27206
+ const decode$i = (params2) => {
27099
27207
  const { grid: rawGrid } = params2.node.attrs || {};
27100
27208
  const grid = Array.isArray(rawGrid) ? rawGrid : [];
27101
27209
  const { firstRow = {} } = params2.extraParams || {};
@@ -27114,10 +27222,10 @@ const decode$h = (params2) => {
27114
27222
  numericWidth = fallbackColumnWidthTwips;
27115
27223
  }
27116
27224
  numericWidth = Math.max(numericWidth, cellMinWidth);
27117
- const decoded = translator$b.decode({
27225
+ const decoded = translator$c.decode({
27118
27226
  node: { type: (
27119
27227
  /** @type {string} */
27120
- translator$b.sdNodeOrKeyName
27228
+ translator$c.sdNodeOrKeyName
27121
27229
  ), attrs: { col: numericWidth } }
27122
27230
  });
27123
27231
  if (decoded) elements.push(decoded);
@@ -27152,19 +27260,19 @@ const decode$h = (params2) => {
27152
27260
  columnIndex++;
27153
27261
  }
27154
27262
  const newNode = {
27155
- name: XML_NODE_NAME$a,
27263
+ name: XML_NODE_NAME$b,
27156
27264
  attributes: {},
27157
27265
  elements
27158
27266
  };
27159
27267
  return newNode;
27160
27268
  };
27161
- const config$a = {
27162
- xmlName: XML_NODE_NAME$a,
27269
+ const config$b = {
27270
+ xmlName: XML_NODE_NAME$b,
27163
27271
  sdNodeOrKeyName: SD_ATTR_KEY,
27164
- encode: encode$h,
27165
- decode: decode$h
27272
+ encode: encode$i,
27273
+ decode: decode$i
27166
27274
  };
27167
- const translator$a = NodeTranslator.from(config$a);
27275
+ const translator$b = NodeTranslator.from(config$b);
27168
27276
  const DEFAULT_PAGE_WIDTH_TWIPS = 12240;
27169
27277
  const DEFAULT_PAGE_MARGIN_TWIPS = 1440;
27170
27278
  const DEFAULT_CONTENT_WIDTH_TWIPS = DEFAULT_PAGE_WIDTH_TWIPS - 2 * DEFAULT_PAGE_MARGIN_TWIPS;
@@ -27227,19 +27335,19 @@ const buildFallbackGridForTable = ({ params: params2, rows, tableWidth, tableWid
27227
27335
  columnWidths: Array(columnCount).fill(fallbackColumnWidthPx)
27228
27336
  };
27229
27337
  };
27230
- const XML_NODE_NAME$9 = "w:tbl";
27231
- const SD_NODE_NAME$9 = "table";
27232
- const encode$g = (params2, encodedAttrs) => {
27338
+ const XML_NODE_NAME$a = "w:tbl";
27339
+ const SD_NODE_NAME$a = "table";
27340
+ const encode$h = (params2, encodedAttrs) => {
27233
27341
  const { nodes } = params2;
27234
27342
  const node = nodes[0];
27235
27343
  const tblPr = node.elements.find((el) => el.name === "w:tblPr");
27236
27344
  if (tblPr) {
27237
- const encodedProperties = translator$c.encode({ ...params2, nodes: [tblPr] });
27345
+ const encodedProperties = translator$d.encode({ ...params2, nodes: [tblPr] });
27238
27346
  encodedAttrs["tableProperties"] = encodedProperties?.attributes || {};
27239
27347
  }
27240
27348
  const tblGrid = node.elements.find((el) => el.name === "w:tblGrid");
27241
27349
  if (tblGrid) {
27242
- encodedAttrs["grid"] = translator$a.encode({ ...params2, nodes: [tblGrid] }).attributes;
27350
+ encodedAttrs["grid"] = translator$b.encode({ ...params2, nodes: [tblGrid] }).attributes;
27243
27351
  }
27244
27352
  [
27245
27353
  "tableStyleId",
@@ -27306,7 +27414,7 @@ const encode$g = (params2, encodedAttrs) => {
27306
27414
  }
27307
27415
  const content = [];
27308
27416
  rows.forEach((row) => {
27309
- const result = translator$G.encode({
27417
+ const result = translator$H.encode({
27310
27418
  ...params2,
27311
27419
  nodes: [row],
27312
27420
  extraParams: {
@@ -27325,13 +27433,13 @@ const encode$g = (params2, encodedAttrs) => {
27325
27433
  attrs: encodedAttrs
27326
27434
  };
27327
27435
  };
27328
- const decode$g = (params2, decodedAttrs) => {
27436
+ const decode$h = (params2, decodedAttrs) => {
27329
27437
  params2.node = preProcessVerticalMergeCells(params2.node, params2);
27330
27438
  const { node } = params2;
27331
27439
  const elements = translateChildNodes(params2);
27332
27440
  const firstRow = node.content?.find((n) => n.type === "tableRow");
27333
27441
  const properties = node.attrs.grid;
27334
- const element = translator$a.decode({
27442
+ const element = translator$b.decode({
27335
27443
  ...params2,
27336
27444
  node: { ...node, attrs: { ...node.attrs, grid: properties } },
27337
27445
  extraParams: {
@@ -27341,7 +27449,7 @@ const decode$g = (params2, decodedAttrs) => {
27341
27449
  if (element) elements.unshift(element);
27342
27450
  if (node.attrs?.tableProperties) {
27343
27451
  const properties2 = { ...node.attrs.tableProperties };
27344
- const element2 = translator$c.decode({
27452
+ const element2 = translator$d.decode({
27345
27453
  ...params2,
27346
27454
  node: { ...node, attrs: { ...node.attrs, tableProperties: properties2 } }
27347
27455
  });
@@ -27407,7 +27515,7 @@ function _getReferencedTableStyles(tableStyleReference, params2) {
27407
27515
  if (baseTblPr && baseTblPr.elements) {
27408
27516
  tblPr.elements.push(...baseTblPr.elements);
27409
27517
  }
27410
- const tableProperties = translator$c.encode({ ...params2, nodes: [tblPr] }).attributes;
27518
+ const tableProperties = translator$d.encode({ ...params2, nodes: [tblPr] }).attributes;
27411
27519
  const { borders, rowBorders } = _processTableBorders(tableProperties.borders || {});
27412
27520
  if (borders) stylesToReturn.borders = borders;
27413
27521
  if (rowBorders) stylesToReturn.rowBorders = rowBorders;
@@ -27424,16 +27532,16 @@ function _getReferencedTableStyles(tableStyleReference, params2) {
27424
27532
  }
27425
27533
  return stylesToReturn;
27426
27534
  }
27427
- const config$9 = {
27428
- xmlName: XML_NODE_NAME$9,
27429
- sdNodeOrKeyName: SD_NODE_NAME$9,
27535
+ const config$a = {
27536
+ xmlName: XML_NODE_NAME$a,
27537
+ sdNodeOrKeyName: SD_NODE_NAME$a,
27430
27538
  type: NodeTranslator.translatorTypes.NODE,
27431
- encode: encode$g,
27432
- decode: decode$g,
27539
+ encode: encode$h,
27540
+ decode: decode$h,
27433
27541
  attributes: []
27434
27542
  };
27435
- const translator$9 = NodeTranslator.from(config$9);
27436
- const tableNodeHandlerEntity = generateV2HandlerEntity("tableNodeHandler", translator$9);
27543
+ const translator$a = NodeTranslator.from(config$a);
27544
+ const tableNodeHandlerEntity = generateV2HandlerEntity("tableNodeHandler", translator$a);
27437
27545
  function getReferencedTableStyles(tblStyleTag, docx) {
27438
27546
  if (!tblStyleTag) return null;
27439
27547
  const stylesToReturn = {};
@@ -27795,10 +27903,10 @@ function generateCellMargins(cellMargins) {
27795
27903
  if (left2 != null) elements.push({ name: "w:left", attributes: { "w:w": pixelsToTwips(left2) } });
27796
27904
  return elements;
27797
27905
  }
27798
- const XML_NODE_NAME$8 = "w:tc";
27799
- const SD_NODE_NAME$8 = "tableCell";
27800
- const validXmlAttributes$8 = [];
27801
- function encode$f(params2, encodedAttrs) {
27906
+ const XML_NODE_NAME$9 = "w:tc";
27907
+ const SD_NODE_NAME$9 = "tableCell";
27908
+ const validXmlAttributes$7 = [];
27909
+ function encode$g(params2, encodedAttrs) {
27802
27910
  const {
27803
27911
  node,
27804
27912
  table,
@@ -27825,162 +27933,22 @@ function encode$f(params2, encodedAttrs) {
27825
27933
  }
27826
27934
  return schemaNode;
27827
27935
  }
27828
- function decode$f(params2, decodedAttrs) {
27936
+ function decode$g(params2, decodedAttrs) {
27829
27937
  const translated = translateTableCell(params2);
27830
27938
  if (decodedAttrs && Object.keys(decodedAttrs).length) {
27831
27939
  translated.attributes = { ...translated.attributes || {}, ...decodedAttrs };
27832
27940
  }
27833
27941
  return translated;
27834
27942
  }
27835
- const config$8 = {
27836
- xmlName: XML_NODE_NAME$8,
27837
- sdNodeOrKeyName: SD_NODE_NAME$8,
27838
- type: NodeTranslator.translatorTypes.NODE,
27839
- encode: encode$f,
27840
- decode: decode$f,
27841
- attributes: validXmlAttributes$8
27842
- };
27843
- const translator$8 = NodeTranslator.from(config$8);
27844
- const XML_NODE_NAME$7 = "w:hyperlink";
27845
- const SD_NODE_NAME$7 = "link";
27846
- const _createAttributeHandler = (xmlName, sdName) => ({
27847
- xmlName,
27848
- sdName,
27849
- encode: (attributes) => attributes[xmlName],
27850
- decode: (attributes) => attributes[sdName]
27851
- });
27852
- const validXmlAttributes$7 = [
27853
- _createAttributeHandler("w:anchor", "anchor"),
27854
- _createAttributeHandler("w:docLocation", "docLocation"),
27855
- {
27856
- xmlName: "w:history",
27857
- sdName: "history",
27858
- encode: (attributes) => attributes["w:history"] === "1" || attributes["w:history"] === "true",
27859
- decode: (attributes) => attributes["history"] ? "1" : "0"
27860
- },
27861
- _createAttributeHandler("w:tooltip", "tooltip"),
27862
- _createAttributeHandler("r:id", "rId"),
27863
- _createAttributeHandler("w:tgtFrame", "target")
27864
- ];
27865
- const encode$e = (params2, encodedAttrs) => {
27866
- const { nodes, docx, nodeListHandler } = params2;
27867
- const node = nodes[0];
27868
- let href = _resolveHref(docx, encodedAttrs);
27869
- const linkMark = { attrs: { ...encodedAttrs, href } };
27870
- const runNodes = node.elements.filter((el) => el.name === "w:r");
27871
- runNodes.forEach((runNode) => {
27872
- const existingRunMarks = Array.isArray(runNode.marks) ? runNode.marks : [];
27873
- const runMarksWithoutLink = existingRunMarks.filter((mark) => mark?.type !== "link");
27874
- runNode.marks = runMarksWithoutLink;
27875
- });
27876
- const updatedNode = nodeListHandler.handler({
27877
- ...params2,
27878
- nodes: runNodes,
27879
- path: [...params2.path || [], node]
27880
- });
27881
- const cloneMark2 = (mark) => {
27882
- if (!mark || typeof mark !== "object") return mark;
27883
- if (!mark.attrs) return { ...mark };
27884
- return { ...mark, attrs: { ...mark.attrs } };
27885
- };
27886
- const ensureLinkMark = (child) => {
27887
- if (!child || typeof child !== "object") return child;
27888
- if (Array.isArray(child.content)) {
27889
- const updatedContent = child.content.map((item) => ensureLinkMark(item));
27890
- if (updatedContent !== child.content) {
27891
- child = { ...child, content: updatedContent };
27892
- }
27893
- }
27894
- if (child.type === "run") {
27895
- const existingMarks2 = Array.isArray(child.marks) ? child.marks : [];
27896
- const filteredMarks = existingMarks2.filter((mark) => mark?.type !== "link").map((mark) => cloneMark2(mark));
27897
- if (filteredMarks.length !== existingMarks2.length) {
27898
- if (filteredMarks.length) child = { ...child, marks: filteredMarks };
27899
- else {
27900
- const { marks: _removedMarks, ...rest } = child;
27901
- child = rest;
27902
- }
27903
- }
27904
- return child;
27905
- }
27906
- if (child.type !== "text") return child;
27907
- const existingMarks = Array.isArray(child.marks) ? child.marks.map((mark) => cloneMark2(mark)) : [];
27908
- const hasLink = existingMarks.some((mark) => mark?.type === "link");
27909
- if (hasLink) return child;
27910
- const linkClone = { type: "link", attrs: { ...linkMark.attrs } };
27911
- return { ...child, marks: [...existingMarks, linkClone] };
27912
- };
27913
- if (!Array.isArray(updatedNode)) return updatedNode;
27914
- return updatedNode.map((child) => ensureLinkMark(child));
27915
- };
27916
- const _resolveHref = (docx, encodedAttrs) => {
27917
- const rels = docx["word/_rels/document.xml.rels"];
27918
- const relationships = rels.elements.find((el) => el.name === "Relationships");
27919
- const { elements } = relationships;
27920
- const { rId, anchor } = encodedAttrs;
27921
- let href;
27922
- if (!rId && anchor) {
27923
- href = `#${anchor}`;
27924
- } else if (rId) {
27925
- const rel = elements.find((el) => el.attributes["Id"] === rId) || {};
27926
- const { attributes: relAttributes = {} } = rel;
27927
- href = relAttributes["Target"];
27928
- }
27929
- return href;
27930
- };
27931
- function decode$e(params2) {
27932
- const { node } = params2;
27933
- const linkMark = node.marks.find((m2) => m2.type === "link");
27934
- const linkAttrs = this.decodeAttributes({ ...params2, node: linkMark });
27935
- let { anchor, href: link } = linkMark.attrs;
27936
- const isExternalLink = !anchor;
27937
- if (isExternalLink) {
27938
- linkAttrs["r:id"] = _addNewLinkRelationship(params2, link, linkAttrs["r:id"]);
27939
- }
27940
- node.marks = node.marks.filter((m2) => m2.type !== "link");
27941
- const outputNode = exportSchemaToJson({ ...params2, node });
27942
- const newNode = {
27943
- name: "w:hyperlink",
27944
- type: "element",
27945
- attributes: {
27946
- ...linkAttrs
27947
- },
27948
- elements: [outputNode]
27949
- };
27950
- return newNode;
27951
- }
27952
- function _addNewLinkRelationship(params2, link, rId) {
27953
- if (!rId) rId = generateDocxRandomId();
27954
- if (!params2.relationships || !Array.isArray(params2.relationships)) {
27955
- params2.relationships = [];
27956
- }
27957
- const existingRel = params2.relationships.find(
27958
- (rel) => rel.attributes && rel.attributes.Id === rId && rel.attributes.Target === link
27959
- );
27960
- if (existingRel) {
27961
- return rId;
27962
- }
27963
- params2.relationships.push({
27964
- type: "element",
27965
- name: "Relationship",
27966
- attributes: {
27967
- Id: rId,
27968
- Type: "http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink",
27969
- Target: link,
27970
- TargetMode: "External"
27971
- }
27972
- });
27973
- return rId;
27974
- }
27975
- const config$7 = {
27976
- xmlName: XML_NODE_NAME$7,
27977
- sdNodeOrKeyName: SD_NODE_NAME$7,
27943
+ const config$9 = {
27944
+ xmlName: XML_NODE_NAME$9,
27945
+ sdNodeOrKeyName: SD_NODE_NAME$9,
27978
27946
  type: NodeTranslator.translatorTypes.NODE,
27979
- encode: encode$e,
27980
- decode: decode$e,
27947
+ encode: encode$g,
27948
+ decode: decode$g,
27981
27949
  attributes: validXmlAttributes$7
27982
27950
  };
27983
- const translator$7 = NodeTranslator.from(config$7);
27951
+ const translator$9 = NodeTranslator.from(config$9);
27984
27952
  function parseTagValueJSON(json) {
27985
27953
  if (typeof json !== "string") {
27986
27954
  return {};
@@ -28116,12 +28084,32 @@ function handleDocPartObj(params2) {
28116
28084
  }
28117
28085
  const content = node?.elements.find((el) => el.name === "w:sdtContent");
28118
28086
  const handler2 = validGalleryTypeMap[docPartGalleryType];
28119
- const result = handler2({ ...params2, nodes: [content] });
28087
+ const result = handler2({
28088
+ ...params2,
28089
+ nodes: [content],
28090
+ extraParams: { ...params2.extraParams || {}, sdtPr }
28091
+ });
28120
28092
  return result;
28121
28093
  }
28122
28094
  const tableOfContentsHandler = (params2) => {
28123
28095
  const node = params2.nodes[0];
28124
- return params2.nodeListHandler.handler({ ...params2, nodes: node.elements });
28096
+ const translatedContent = params2.nodeListHandler.handler({
28097
+ ...params2,
28098
+ nodes: node.elements,
28099
+ path: [...params2.path || [], node]
28100
+ });
28101
+ const sdtPr = params2.extraParams.sdtPr;
28102
+ const id = sdtPr.elements?.find((el) => el.name === "w:id")?.attributes["w:val"] || "";
28103
+ const result = {
28104
+ type: "documentPartObject",
28105
+ content: translatedContent,
28106
+ attrs: {
28107
+ id,
28108
+ docPartGallery: "Table of Contents",
28109
+ docPartUnique: true
28110
+ }
28111
+ };
28112
+ return result;
28125
28113
  };
28126
28114
  const validGalleryTypeMap = {
28127
28115
  "Table of Contents": tableOfContentsHandler
@@ -28779,32 +28767,32 @@ function translateAnchorNode(params2) {
28779
28767
  elements: [...anchorElements, ...elementsWithWrap]
28780
28768
  };
28781
28769
  }
28782
- const XML_NODE_NAME$6 = "wp:anchor";
28783
- const SD_NODE_NAME$6 = ["image"];
28770
+ const XML_NODE_NAME$8 = "wp:anchor";
28771
+ const SD_NODE_NAME$8 = ["image"];
28784
28772
  const validXmlAttributes$6 = ["distT", "distB", "distL", "distR"].map((xmlName) => createAttributeHandler(xmlName));
28785
- function encode$d(params2) {
28773
+ function encode$f(params2) {
28786
28774
  const { node } = params2.extraParams;
28787
28775
  if (!node || !node.type) {
28788
28776
  return null;
28789
28777
  }
28790
28778
  return handleAnchorNode(params2);
28791
28779
  }
28792
- function decode$d(params2) {
28780
+ function decode$f(params2) {
28793
28781
  const { node } = params2;
28794
28782
  if (!node || !node.type) {
28795
28783
  return null;
28796
28784
  }
28797
28785
  return translateAnchorNode(params2);
28798
28786
  }
28799
- const config$6 = {
28800
- xmlName: XML_NODE_NAME$6,
28801
- sdNodeOrKeyName: SD_NODE_NAME$6,
28787
+ const config$8 = {
28788
+ xmlName: XML_NODE_NAME$8,
28789
+ sdNodeOrKeyName: SD_NODE_NAME$8,
28802
28790
  type: NodeTranslator.translatorTypes.NODE,
28803
- encode: encode$d,
28804
- decode: decode$d,
28791
+ encode: encode$f,
28792
+ decode: decode$f,
28805
28793
  attributes: validXmlAttributes$6
28806
28794
  };
28807
- const translator$6 = NodeTranslator.from(config$6);
28795
+ const translator$8 = NodeTranslator.from(config$8);
28808
28796
  function handleInlineNode(params2) {
28809
28797
  const { node } = params2.extraParams;
28810
28798
  if (node.name !== "wp:inline") {
@@ -28820,41 +28808,41 @@ function translateInlineNode(params2) {
28820
28808
  elements: nodeElements.elements
28821
28809
  };
28822
28810
  }
28823
- const XML_NODE_NAME$5 = "wp:inline";
28824
- const SD_NODE_NAME$5 = ["image"];
28811
+ const XML_NODE_NAME$7 = "wp:inline";
28812
+ const SD_NODE_NAME$7 = ["image"];
28825
28813
  const validXmlAttributes$5 = ["distT", "distB", "distL", "distR"].map((xmlName) => createAttributeHandler(xmlName));
28826
- function encode$c(params2) {
28814
+ function encode$e(params2) {
28827
28815
  const { node } = params2.extraParams;
28828
28816
  if (!node || !node.type) {
28829
28817
  return null;
28830
28818
  }
28831
28819
  return handleInlineNode(params2);
28832
28820
  }
28833
- function decode$c(params2) {
28821
+ function decode$e(params2) {
28834
28822
  const { node } = params2;
28835
28823
  if (!node || !node.type) {
28836
28824
  return null;
28837
28825
  }
28838
28826
  return translateInlineNode(params2);
28839
28827
  }
28840
- const config$5 = {
28841
- xmlName: XML_NODE_NAME$5,
28842
- sdNodeOrKeyName: SD_NODE_NAME$5,
28828
+ const config$7 = {
28829
+ xmlName: XML_NODE_NAME$7,
28830
+ sdNodeOrKeyName: SD_NODE_NAME$7,
28843
28831
  type: NodeTranslator.translatorTypes.NODE,
28844
- encode: encode$c,
28845
- decode: decode$c,
28832
+ encode: encode$e,
28833
+ decode: decode$e,
28846
28834
  attributes: validXmlAttributes$5
28847
28835
  };
28848
- const translator$5 = NodeTranslator.from(config$5);
28849
- const XML_NODE_NAME$4 = "w:drawing";
28850
- const SD_NODE_NAME$4 = [];
28836
+ const translator$7 = NodeTranslator.from(config$7);
28837
+ const XML_NODE_NAME$6 = "w:drawing";
28838
+ const SD_NODE_NAME$6 = [];
28851
28839
  const validXmlAttributes$4 = [];
28852
- function encode$b(params2) {
28840
+ function encode$d(params2) {
28853
28841
  const nodes = params2.nodes;
28854
28842
  const node = nodes[0];
28855
28843
  const translatorByChildName = {
28856
- "wp:anchor": translator$6,
28857
- "wp:inline": translator$5
28844
+ "wp:anchor": translator$8,
28845
+ "wp:inline": translator$7
28858
28846
  };
28859
28847
  return node.elements.reduce((acc, child) => {
28860
28848
  if (acc) return acc;
@@ -28863,12 +28851,12 @@ function encode$b(params2) {
28863
28851
  return translator2.encode({ ...params2, extraParams: { node: child } }) || acc;
28864
28852
  }, null);
28865
28853
  }
28866
- function decode$b(params2) {
28854
+ function decode$d(params2) {
28867
28855
  const { node } = params2;
28868
28856
  if (!node || !node.type) {
28869
28857
  return null;
28870
28858
  }
28871
- const childTranslator = node.attrs.isAnchor ? translator$6 : translator$5;
28859
+ const childTranslator = node.attrs.isAnchor ? translator$8 : translator$7;
28872
28860
  const resultNode = childTranslator.decode(params2);
28873
28861
  return wrapTextInRun(
28874
28862
  {
@@ -28878,15 +28866,15 @@ function decode$b(params2) {
28878
28866
  []
28879
28867
  );
28880
28868
  }
28881
- const config$4 = {
28882
- xmlName: XML_NODE_NAME$4,
28883
- sdNodeOrKeyName: SD_NODE_NAME$4,
28869
+ const config$6 = {
28870
+ xmlName: XML_NODE_NAME$6,
28871
+ sdNodeOrKeyName: SD_NODE_NAME$6,
28884
28872
  type: NodeTranslator.translatorTypes.NODE,
28885
- encode: encode$b,
28886
- decode: decode$b,
28873
+ encode: encode$d,
28874
+ decode: decode$d,
28887
28875
  attributes: validXmlAttributes$4
28888
28876
  };
28889
- const translator$4 = NodeTranslator.from(config$4);
28877
+ const translator$6 = NodeTranslator.from(config$6);
28890
28878
  class CommandService {
28891
28879
  /**
28892
28880
  * @param {import('./commands/types/index.js').CommandServiceOptions} props
@@ -30224,7 +30212,7 @@ function prepareTextAnnotation(params2) {
30224
30212
  return getTextNodeForExport(attrs.displayLabel, [...marks, ...marksFromAttrs], params2);
30225
30213
  }
30226
30214
  function prepareImageAnnotation(params2, imageSize) {
30227
- return translator$4.decode({
30215
+ return translator$6.decode({
30228
30216
  ...params2,
30229
30217
  imageSize
30230
30218
  });
@@ -30444,6 +30432,49 @@ const generateSdtPrTagForDocumentSection = (id, title, tag) => {
30444
30432
  ]
30445
30433
  };
30446
30434
  };
30435
+ function translateDocumentPartObj(params2) {
30436
+ const { node } = params2;
30437
+ const { attrs = {} } = node;
30438
+ const childContent = translateChildNodes({ ...params2, nodes: node.content });
30439
+ const nodeElements = [
30440
+ {
30441
+ name: "w:sdtPr",
30442
+ elements: [
30443
+ {
30444
+ name: "w:id",
30445
+ attributes: {
30446
+ "w:val": attrs.id
30447
+ }
30448
+ },
30449
+ {
30450
+ name: "w:docPartObj",
30451
+ elements: [
30452
+ {
30453
+ name: "w:docPartGallery",
30454
+ attributes: {
30455
+ "w:val": attrs.docPartGallery
30456
+ }
30457
+ },
30458
+ ...attrs.docPartUnique ? [
30459
+ {
30460
+ name: "w:docPartUnique"
30461
+ }
30462
+ ] : []
30463
+ ]
30464
+ }
30465
+ ]
30466
+ },
30467
+ {
30468
+ name: "w:sdtContent",
30469
+ elements: childContent
30470
+ }
30471
+ ];
30472
+ const result = {
30473
+ name: "w:sdt",
30474
+ elements: nodeElements
30475
+ };
30476
+ return result;
30477
+ }
30447
30478
  function translateStructuredContent(params2) {
30448
30479
  const { node } = params2;
30449
30480
  const childContent = translateChildNodes({ ...params2, nodes: node.content });
@@ -30495,10 +30526,10 @@ function generateSdtPrTagForStructuredContent({ node }) {
30495
30526
  };
30496
30527
  return result;
30497
30528
  }
30498
- const XML_NODE_NAME$3 = "w:sdt";
30499
- const SD_NODE_NAME$3 = ["fieldAnnotation", "structuredContent", "structuredContentBlock", "documentSection"];
30529
+ const XML_NODE_NAME$5 = "w:sdt";
30530
+ const SD_NODE_NAME$5 = ["fieldAnnotation", "structuredContent", "structuredContentBlock", "documentSection"];
30500
30531
  const validXmlAttributes$3 = [];
30501
- function encode$a(params2) {
30532
+ function encode$c(params2) {
30502
30533
  const nodes = params2.nodes;
30503
30534
  const node = nodes[0];
30504
30535
  const { type: sdtType, handler: handler2 } = sdtNodeTypeStrategy(node);
@@ -30508,7 +30539,7 @@ function encode$a(params2) {
30508
30539
  const result = handler2(params2);
30509
30540
  return result;
30510
30541
  }
30511
- function decode$a(params2) {
30542
+ function decode$c(params2) {
30512
30543
  const { node } = params2;
30513
30544
  if (!node || !node.type) {
30514
30545
  return null;
@@ -30518,91 +30549,93 @@ function decode$a(params2) {
30518
30549
  structuredContent: () => translateStructuredContent(params2),
30519
30550
  structuredContentBlock: () => translateStructuredContent(params2),
30520
30551
  documentSection: () => translateDocumentSection(params2),
30552
+ documentPartObject: () => translateDocumentPartObj(params2),
30553
+ // Handled in doc-part-obj translator
30521
30554
  default: () => null
30522
30555
  };
30523
30556
  const decoder = types2[node.type] ?? types2.default;
30524
30557
  const result = decoder();
30525
30558
  return result;
30526
30559
  }
30527
- const config$3 = {
30528
- xmlName: XML_NODE_NAME$3,
30529
- sdNodeOrKeyName: SD_NODE_NAME$3,
30560
+ const config$5 = {
30561
+ xmlName: XML_NODE_NAME$5,
30562
+ sdNodeOrKeyName: SD_NODE_NAME$5,
30530
30563
  type: NodeTranslator.translatorTypes.NODE,
30531
- encode: encode$a,
30532
- decode: decode$a,
30564
+ encode: encode$c,
30565
+ decode: decode$c,
30533
30566
  attributes: validXmlAttributes$3
30534
30567
  };
30535
- const translator$3 = NodeTranslator.from(config$3);
30536
- const encode$9 = (attributes) => {
30568
+ const translator$5 = NodeTranslator.from(config$5);
30569
+ const encode$b = (attributes) => {
30537
30570
  return attributes["w:id"];
30538
30571
  };
30539
- const decode$9 = (attrs) => {
30572
+ const decode$b = (attrs) => {
30540
30573
  return attrs.id;
30541
30574
  };
30542
30575
  const attrConfig$6 = Object.freeze({
30543
30576
  xmlName: "w:id",
30544
30577
  sdName: "id",
30545
- encode: encode$9,
30546
- decode: decode$9
30578
+ encode: encode$b,
30579
+ decode: decode$b
30547
30580
  });
30548
- const encode$8 = (attributes) => {
30581
+ const encode$a = (attributes) => {
30549
30582
  return attributes["w:name"];
30550
30583
  };
30551
- const decode$8 = (attrs) => {
30584
+ const decode$a = (attrs) => {
30552
30585
  return attrs.name;
30553
30586
  };
30554
30587
  const attrConfig$5 = Object.freeze({
30555
30588
  xmlName: "w:name",
30556
30589
  sdName: "name",
30557
- encode: encode$8,
30558
- decode: decode$8
30590
+ encode: encode$a,
30591
+ decode: decode$a
30559
30592
  });
30560
- const encode$7 = (attributes) => {
30593
+ const encode$9 = (attributes) => {
30561
30594
  return attributes["w:colFirst"];
30562
30595
  };
30563
- const decode$7 = (attrs) => {
30596
+ const decode$9 = (attrs) => {
30564
30597
  return attrs.colFirst;
30565
30598
  };
30566
30599
  const attrConfig$4 = Object.freeze({
30567
30600
  xmlName: "w:colFirst",
30568
30601
  sdName: "colFirst",
30569
- encode: encode$7,
30570
- decode: decode$7
30602
+ encode: encode$9,
30603
+ decode: decode$9
30571
30604
  });
30572
- const encode$6 = (attributes) => {
30605
+ const encode$8 = (attributes) => {
30573
30606
  return attributes["w:colLast"];
30574
30607
  };
30575
- const decode$6 = (attrs) => {
30608
+ const decode$8 = (attrs) => {
30576
30609
  return attrs.colLast;
30577
30610
  };
30578
30611
  const attrConfig$3 = Object.freeze({
30579
30612
  xmlName: "w:colLast",
30580
30613
  sdName: "colLast",
30581
- encode: encode$6,
30582
- decode: decode$6
30614
+ encode: encode$8,
30615
+ decode: decode$8
30583
30616
  });
30584
- const encode$5 = (attributes) => {
30617
+ const encode$7 = (attributes) => {
30585
30618
  return attributes["w:displacedByCustomXml"];
30586
30619
  };
30587
- const decode$5 = (attrs) => {
30620
+ const decode$7 = (attrs) => {
30588
30621
  return attrs.displacedByCustomXml;
30589
30622
  };
30590
30623
  const attrConfig$2 = Object.freeze({
30591
30624
  xmlName: "w:displacedByCustomXml",
30592
30625
  sdName: "displacedByCustomXml",
30593
- encode: encode$5,
30594
- decode: decode$5
30626
+ encode: encode$7,
30627
+ decode: decode$7
30595
30628
  });
30596
30629
  const validXmlAttributes$2 = [attrConfig$6, attrConfig$5, attrConfig$4, attrConfig$3, attrConfig$2];
30597
- const XML_NODE_NAME$2 = "w:bookmarkStart";
30598
- const SD_NODE_NAME$2 = "bookmarkStart";
30599
- const encode$4 = (params2, encodedAttrs = {}) => {
30630
+ const XML_NODE_NAME$4 = "w:bookmarkStart";
30631
+ const SD_NODE_NAME$4 = "bookmarkStart";
30632
+ const encode$6 = (params2, encodedAttrs = {}) => {
30600
30633
  return {
30601
30634
  type: "bookmarkStart",
30602
30635
  attrs: encodedAttrs
30603
30636
  };
30604
30637
  };
30605
- const decode$4 = (params2, decodedAttrs = {}) => {
30638
+ const decode$6 = (params2, decodedAttrs = {}) => {
30606
30639
  const result = {
30607
30640
  name: "w:bookmarkStart",
30608
30641
  elements: []
@@ -30612,49 +30645,49 @@ const decode$4 = (params2, decodedAttrs = {}) => {
30612
30645
  }
30613
30646
  return result;
30614
30647
  };
30615
- const config$2 = {
30616
- xmlName: XML_NODE_NAME$2,
30617
- sdNodeOrKeyName: SD_NODE_NAME$2,
30648
+ const config$4 = {
30649
+ xmlName: XML_NODE_NAME$4,
30650
+ sdNodeOrKeyName: SD_NODE_NAME$4,
30618
30651
  type: NodeTranslator.translatorTypes.NODE,
30619
- encode: encode$4,
30620
- decode: decode$4,
30652
+ encode: encode$6,
30653
+ decode: decode$6,
30621
30654
  attributes: validXmlAttributes$2
30622
30655
  };
30623
- const translator$2 = NodeTranslator.from(config$2);
30624
- const encode$3 = (attributes) => {
30656
+ const translator$4 = NodeTranslator.from(config$4);
30657
+ const encode$5 = (attributes) => {
30625
30658
  return attributes["w:id"];
30626
30659
  };
30627
- const decode$3 = (attrs) => {
30660
+ const decode$5 = (attrs) => {
30628
30661
  return attrs.id;
30629
30662
  };
30630
30663
  const attrConfig$1 = Object.freeze({
30631
30664
  xmlName: "w:id",
30632
30665
  sdName: "id",
30633
- encode: encode$3,
30634
- decode: decode$3
30666
+ encode: encode$5,
30667
+ decode: decode$5
30635
30668
  });
30636
- const encode$2 = (attributes) => {
30669
+ const encode$4 = (attributes) => {
30637
30670
  return attributes["w:displacedByCustomXml"];
30638
30671
  };
30639
- const decode$2 = (attrs) => {
30672
+ const decode$4 = (attrs) => {
30640
30673
  return attrs.displacedByCustomXml;
30641
30674
  };
30642
30675
  const attrConfig = Object.freeze({
30643
30676
  xmlName: "w:displacedByCustomXml",
30644
30677
  sdName: "displacedByCustomXml",
30645
- encode: encode$2,
30646
- decode: decode$2
30678
+ encode: encode$4,
30679
+ decode: decode$4
30647
30680
  });
30648
30681
  const validXmlAttributes$1 = [attrConfig$1, attrConfig];
30649
- const XML_NODE_NAME$1 = "w:bookmarkEnd";
30650
- const SD_NODE_NAME$1 = "bookmarkEnd";
30651
- const encode$1 = (params2, encodedAttrs = {}) => {
30682
+ const XML_NODE_NAME$3 = "w:bookmarkEnd";
30683
+ const SD_NODE_NAME$3 = "bookmarkEnd";
30684
+ const encode$3 = (params2, encodedAttrs = {}) => {
30652
30685
  return {
30653
30686
  type: "bookmarkEnd",
30654
30687
  attrs: encodedAttrs
30655
30688
  };
30656
30689
  };
30657
- const decode$1 = (params2, decodedAttrs = {}) => {
30690
+ const decode$3 = (params2, decodedAttrs = {}) => {
30658
30691
  const result = {
30659
30692
  name: "w:bookmarkEnd",
30660
30693
  elements: []
@@ -30664,19 +30697,19 @@ const decode$1 = (params2, decodedAttrs = {}) => {
30664
30697
  }
30665
30698
  return result;
30666
30699
  };
30667
- const config$1 = {
30668
- xmlName: XML_NODE_NAME$1,
30669
- sdNodeOrKeyName: SD_NODE_NAME$1,
30700
+ const config$3 = {
30701
+ xmlName: XML_NODE_NAME$3,
30702
+ sdNodeOrKeyName: SD_NODE_NAME$3,
30670
30703
  type: NodeTranslator.translatorTypes.NODE,
30671
- encode: encode$1,
30672
- decode: decode$1,
30704
+ encode: encode$3,
30705
+ decode: decode$3,
30673
30706
  attributes: validXmlAttributes$1
30674
30707
  };
30675
- const translator$1 = NodeTranslator.from(config$1);
30676
- const XML_NODE_NAME = "mc:AlternateContent";
30677
- const SD_NODE_NAME = [];
30708
+ const translator$3 = NodeTranslator.from(config$3);
30709
+ const XML_NODE_NAME$2 = "mc:AlternateContent";
30710
+ const SD_NODE_NAME$2 = [];
30678
30711
  const validXmlAttributes = [];
30679
- function encode$19(params2) {
30712
+ function encode$2(params2) {
30680
30713
  const { nodeListHandler } = params2;
30681
30714
  const { node } = params2.extraParams;
30682
30715
  if (!node || !node.type) {
@@ -30696,7 +30729,7 @@ function encode$19(params2) {
30696
30729
  path: [...params2.path || [], wpsNode]
30697
30730
  });
30698
30731
  }
30699
- function decode(params2) {
30732
+ function decode$2(params2) {
30700
30733
  const { node } = params2;
30701
30734
  const { drawingContent } = node.attrs;
30702
30735
  const drawing = {
@@ -30713,13 +30746,186 @@ function decode(params2) {
30713
30746
  elements: [choice]
30714
30747
  };
30715
30748
  }
30749
+ const config$2 = {
30750
+ xmlName: XML_NODE_NAME$2,
30751
+ sdNodeOrKeyName: SD_NODE_NAME$2,
30752
+ type: NodeTranslator.translatorTypes.NODE,
30753
+ encode: encode$2,
30754
+ decode: decode$2,
30755
+ attributes: validXmlAttributes
30756
+ };
30757
+ const translator$2 = NodeTranslator.from(config$2);
30758
+ const XML_NODE_NAME$1 = "sd:pageReference";
30759
+ const SD_NODE_NAME$1 = "pageReference";
30760
+ const encode$1 = (params2, _2) => {
30761
+ const { nodes = [], nodeListHandler } = params2 || {};
30762
+ const node = nodes[0];
30763
+ const processedText = nodeListHandler.handler({
30764
+ ...params2,
30765
+ nodes: node.elements
30766
+ });
30767
+ const processedNode = {
30768
+ type: "pageReference",
30769
+ attrs: {
30770
+ instruction: node.attributes?.instruction || "",
30771
+ marksAsAttrs: node.marks || []
30772
+ },
30773
+ content: processedText
30774
+ };
30775
+ return processedNode;
30776
+ };
30777
+ const decode$1 = (params2, _2) => {
30778
+ const { node } = params2;
30779
+ const outputMarks = processOutputMarks(node.attrs?.marksAsAttrs || []);
30780
+ const contentNodes = (node.content ?? []).flatMap((n) => exportSchemaToJson({ ...params2, node: n }));
30781
+ const translated = [
30782
+ {
30783
+ name: "w:r",
30784
+ elements: [
30785
+ {
30786
+ name: "w:rPr",
30787
+ elements: outputMarks
30788
+ },
30789
+ {
30790
+ name: "w:fldChar",
30791
+ attributes: {
30792
+ "w:fldCharType": "begin"
30793
+ }
30794
+ }
30795
+ ]
30796
+ },
30797
+ {
30798
+ name: "w:r",
30799
+ elements: [
30800
+ {
30801
+ name: "w:rPr",
30802
+ elements: outputMarks
30803
+ },
30804
+ {
30805
+ name: "w:instrText",
30806
+ attributes: { "xml:space": "preserve" },
30807
+ elements: [
30808
+ {
30809
+ type: "text",
30810
+ text: `${node.attrs.instruction}`
30811
+ }
30812
+ ]
30813
+ }
30814
+ ]
30815
+ },
30816
+ {
30817
+ name: "w:r",
30818
+ elements: [
30819
+ {
30820
+ name: "w:rPr",
30821
+ elements: outputMarks
30822
+ },
30823
+ {
30824
+ name: "w:fldChar",
30825
+ attributes: {
30826
+ "w:fldCharType": "separate"
30827
+ }
30828
+ }
30829
+ ]
30830
+ },
30831
+ ...contentNodes,
30832
+ {
30833
+ name: "w:r",
30834
+ elements: [
30835
+ {
30836
+ name: "w:rPr",
30837
+ elements: outputMarks
30838
+ },
30839
+ {
30840
+ name: "w:fldChar",
30841
+ attributes: {
30842
+ "w:fldCharType": "end"
30843
+ }
30844
+ }
30845
+ ]
30846
+ }
30847
+ ];
30848
+ return translated;
30849
+ };
30850
+ const config$1 = {
30851
+ xmlName: XML_NODE_NAME$1,
30852
+ sdNodeOrKeyName: SD_NODE_NAME$1,
30853
+ type: NodeTranslator.translatorTypes.NODE,
30854
+ encode: encode$1,
30855
+ decode: decode$1
30856
+ };
30857
+ const translator$1 = NodeTranslator.from(config$1);
30858
+ const XML_NODE_NAME = "sd:tableOfContents";
30859
+ const SD_NODE_NAME = "tableOfContents";
30860
+ const encode$1c = (params2, _2) => {
30861
+ const { nodes = [], nodeListHandler } = params2 || {};
30862
+ const node = nodes[0];
30863
+ const processedContent = nodeListHandler.handler({
30864
+ ...params2,
30865
+ nodes: node.elements || []
30866
+ });
30867
+ const processedNode = {
30868
+ type: "tableOfContents",
30869
+ attrs: {
30870
+ instruction: node.attributes?.instruction || ""
30871
+ },
30872
+ content: processedContent
30873
+ };
30874
+ return processedNode;
30875
+ };
30876
+ const decode = (params2, _2) => {
30877
+ const { node } = params2;
30878
+ const contentNodes = node.content.map((n) => exportSchemaToJson({ ...params2, node: n }));
30879
+ const tocBeginElements = [
30880
+ {
30881
+ name: "w:r",
30882
+ elements: [{ name: "w:fldChar", attributes: { "w:fldCharType": "begin" }, elements: [] }]
30883
+ },
30884
+ {
30885
+ name: "w:r",
30886
+ elements: [
30887
+ {
30888
+ name: "w:instrText",
30889
+ attributes: { "xml:space": "preserve" },
30890
+ elements: [{ text: node.attrs?.instruction || "", type: "text", name: "#text", elements: [] }]
30891
+ }
30892
+ ]
30893
+ },
30894
+ { name: "w:r", elements: [{ name: "w:fldChar", attributes: { "w:fldCharType": "separate" }, elements: [] }] }
30895
+ ];
30896
+ if (contentNodes.length > 0) {
30897
+ const firstParagraph = contentNodes[0];
30898
+ let insertIndex = 0;
30899
+ if (firstParagraph.elements) {
30900
+ const pPrIndex = firstParagraph.elements.findIndex((el) => el.name === "w:pPr");
30901
+ insertIndex = pPrIndex >= 0 ? pPrIndex + 1 : 0;
30902
+ } else {
30903
+ firstParagraph.elements = [];
30904
+ }
30905
+ firstParagraph.elements.splice(insertIndex, 0, ...tocBeginElements);
30906
+ } else {
30907
+ contentNodes.push({
30908
+ name: "w:p",
30909
+ elements: tocBeginElements
30910
+ });
30911
+ }
30912
+ const tocEndElements = [
30913
+ { name: "w:r", elements: [{ name: "w:fldChar", attributes: { "w:fldCharType": "end" }, elements: [] }] }
30914
+ ];
30915
+ const lastParagraph = contentNodes[contentNodes.length - 1];
30916
+ if (lastParagraph.elements) {
30917
+ lastParagraph.elements.push(...tocEndElements);
30918
+ } else {
30919
+ lastParagraph.elements = [...tocEndElements];
30920
+ }
30921
+ return contentNodes;
30922
+ };
30716
30923
  const config = {
30717
30924
  xmlName: XML_NODE_NAME,
30718
30925
  sdNodeOrKeyName: SD_NODE_NAME,
30719
30926
  type: NodeTranslator.translatorTypes.NODE,
30720
- encode: encode$19,
30721
- decode,
30722
- attributes: validXmlAttributes
30927
+ encode: encode$1c,
30928
+ decode
30723
30929
  };
30724
30930
  const translator = NodeTranslator.from(config);
30725
30931
  const DEFAULT_SECTION_PROPS_TWIPS = Object.freeze({
@@ -30793,32 +30999,35 @@ function exportSchemaToJson(params2) {
30793
30999
  doc: translateDocumentNode,
30794
31000
  body: translateBodyNode,
30795
31001
  heading: translateHeadingNode,
30796
- paragraph: translator$13,
30797
- run: translator$U,
31002
+ paragraph: translator$16,
31003
+ run: translator$V,
30798
31004
  text: translateTextNode,
30799
31005
  bulletList: translateList,
30800
31006
  orderedList: translateList,
30801
- lineBreak: translator$16,
30802
- table: translator$9,
30803
- tableRow: translator$G,
30804
- tableCell: translator$8,
30805
- bookmarkStart: translator$2,
30806
- bookmarkEnd: translator$1,
30807
- fieldAnnotation: translator$3,
30808
- tab: translator$14,
30809
- image: translator$4,
30810
- hardBreak: translator$16,
31007
+ lineBreak: translator$19,
31008
+ table: translator$a,
31009
+ tableRow: translator$H,
31010
+ tableCell: translator$9,
31011
+ bookmarkStart: translator$4,
31012
+ bookmarkEnd: translator$3,
31013
+ fieldAnnotation: translator$5,
31014
+ tab: translator$17,
31015
+ image: translator$6,
31016
+ hardBreak: translator$19,
30811
31017
  commentRangeStart: () => translateCommentNode(params2, "Start"),
30812
31018
  commentRangeEnd: () => translateCommentNode(params2, "End"),
30813
31019
  commentReference: () => null,
30814
31020
  shapeContainer: translateShapeContainer,
30815
31021
  shapeTextbox: translateShapeTextbox,
30816
31022
  contentBlock: translateContentBlock,
30817
- structuredContent: translator$3,
30818
- structuredContentBlock: translator$3,
30819
- documentSection: translator$3,
31023
+ structuredContent: translator$5,
31024
+ structuredContentBlock: translator$5,
31025
+ documentPartObject: translator$5,
31026
+ documentSection: translator$5,
30820
31027
  "page-number": translatePageNumberNode,
30821
- "total-page-number": translateTotalPageNumberNode
31028
+ "total-page-number": translateTotalPageNumberNode,
31029
+ pageReference: translator$1,
31030
+ tableOfContents: translator
30822
31031
  };
30823
31032
  let handler2 = router[type2];
30824
31033
  if (handler2 && "decode" in handler2 && typeof handler2.decode === "function") {
@@ -31156,8 +31365,6 @@ function translateTextNode(params2) {
31156
31365
  const trackedMarks = [TrackInsertMarkName, TrackDeleteMarkName];
31157
31366
  const isTrackedNode = node.marks?.some((m2) => trackedMarks.includes(m2.type));
31158
31367
  if (isTrackedNode) return translateTrackedNode(params2);
31159
- const isLinkNode = node.marks?.some((m2) => m2.type === "link");
31160
- if (isLinkNode) return translator$7.decode(params2);
31161
31368
  const { text, marks = [] } = node;
31162
31369
  return getTextNodeForExport(text, marks, params2);
31163
31370
  }
@@ -31463,7 +31670,7 @@ function translateMark(mark) {
31463
31670
  markElement.type = "element";
31464
31671
  break;
31465
31672
  case "underline": {
31466
- const translated = translator$10.decode({
31673
+ const translated = translator$13.decode({
31467
31674
  node: {
31468
31675
  attrs: {
31469
31676
  underlineType: attrs.underlineType ?? attrs.underline ?? null,
@@ -31527,7 +31734,7 @@ function translateMark(mark) {
31527
31734
  break;
31528
31735
  case "highlight": {
31529
31736
  const highlightValue = attrs.color ?? attrs.highlight ?? null;
31530
- const translated = translator$15.decode({ node: { attrs: { highlight: highlightValue } } });
31737
+ const translated = translator$18.decode({ node: { attrs: { highlight: highlightValue } } });
31531
31738
  return translated || {};
31532
31739
  }
31533
31740
  }
@@ -31587,7 +31794,7 @@ function translateContentBlock(params2) {
31587
31794
  if (vmlAttributes || horizontalRule) {
31588
31795
  return translateVRectContentBlock(params2);
31589
31796
  }
31590
- const alternateContent = translator.decode(params2);
31797
+ const alternateContent = translator$2.decode(params2);
31591
31798
  return wrapTextInRun(alternateContent);
31592
31799
  }
31593
31800
  function translateVRectContentBlock(params2) {
@@ -31733,6 +31940,7 @@ const getAutoPageJson = (type2, outputMarks = []) => {
31733
31940
  },
31734
31941
  {
31735
31942
  name: "w:instrText",
31943
+ attributes: { "xml:space": "preserve" },
31736
31944
  elements: [
31737
31945
  {
31738
31946
  type: "text",
@@ -31792,7 +32000,7 @@ const handleDrawingNode = (params2) => {
31792
32000
  if (mainNode.name === "w:drawing") node = mainNode;
31793
32001
  else node = mainNode.elements.find((el) => el.name === "w:drawing");
31794
32002
  if (!node) return { nodes: [], consumed: 0 };
31795
- const schemaNode = translator$4.encode(params2);
32003
+ const schemaNode = translator$6.encode(params2);
31796
32004
  const newNodes = schemaNode ? [schemaNode] : [];
31797
32005
  return { nodes: newNodes, consumed: 1 };
31798
32006
  };
@@ -31894,8 +32102,8 @@ const trackChangeNodeHandlerEntity = {
31894
32102
  handlerName: "trackChangeNodeHandler",
31895
32103
  handler: handleTrackChangeNode
31896
32104
  };
31897
- const hyperlinkNodeHandlerEntity = generateV2HandlerEntity("hyperlinkNodeHandler", translator$7);
31898
- const runNodeHandlerEntity = generateV2HandlerEntity("runNodeHandler", translator$U);
32105
+ const hyperlinkNodeHandlerEntity = generateV2HandlerEntity("hyperlinkNodeHandler", translator$W);
32106
+ const runNodeHandlerEntity = generateV2HandlerEntity("runNodeHandler", translator$V);
31899
32107
  const handleTextNode = (params2) => {
31900
32108
  const { nodes, insideTrackChange } = params2;
31901
32109
  if (nodes.length === 0 || !(nodes[0].name === "w:t" || insideTrackChange && nodes[0].name === "w:delText")) {
@@ -31936,7 +32144,7 @@ const handleParagraphNode = (params2) => {
31936
32144
  if (nodes.length === 0 || nodes[0].name !== "w:p") {
31937
32145
  return { nodes: [], consumed: 0 };
31938
32146
  }
31939
- const schemaNode = translator$13.encode(params2);
32147
+ const schemaNode = translator$16.encode(params2);
31940
32148
  const newNodes = schemaNode ? [schemaNode] : [];
31941
32149
  return { nodes: newNodes, consumed: 1 };
31942
32150
  };
@@ -31949,7 +32157,7 @@ const handleSdtNode = (params2) => {
31949
32157
  if (nodes.length === 0 || nodes[0].name !== "w:sdt") {
31950
32158
  return { nodes: [], consumed: 0 };
31951
32159
  }
31952
- const result = translator$3.encode(params2);
32160
+ const result = translator$5.encode(params2);
31953
32161
  if (!result) {
31954
32162
  return { nodes: [], consumed: 0 };
31955
32163
  }
@@ -32039,7 +32247,7 @@ const handler = (params2) => {
32039
32247
  if (nodes.length === 0 || nodes[0].name !== "w:br") {
32040
32248
  return { nodes: [], consumed: 0 };
32041
32249
  }
32042
- const result = translator$16.encode(params2);
32250
+ const result = translator$19.encode(params2);
32043
32251
  if (!result) return { nodes: [], consumed: 0 };
32044
32252
  return {
32045
32253
  nodes: [result],
@@ -32111,7 +32319,7 @@ const handleBookmarkStartNode = (params2) => {
32111
32319
  if (isCustomMarkBookmark(nodes[0], params2.editor)) {
32112
32320
  return handleBookmarkNode(params2);
32113
32321
  }
32114
- const node = translator$2.encode(params2);
32322
+ const node = translator$4.encode(params2);
32115
32323
  if (!node) return { nodes: [], consumed: 0 };
32116
32324
  return { nodes: [node], consumed: 1 };
32117
32325
  };
@@ -32143,7 +32351,7 @@ const handleBookmarkEndNode = (params2) => {
32143
32351
  if (!nodes.length || nodes[0].name !== "w:bookmarkEnd") {
32144
32352
  return { nodes: [], consumed: 0 };
32145
32353
  }
32146
- const node = translator$1.encode(params2);
32354
+ const node = translator$3.encode(params2);
32147
32355
  if (!node) return { nodes: [], consumed: 0 };
32148
32356
  return { nodes: [node], consumed: 1 };
32149
32357
  };
@@ -32276,6 +32484,7 @@ const autoTotalPageCountEntity = {
32276
32484
  handlerName: "autoTotalPageCountEntity",
32277
32485
  handler: handleAutoTotalPageNumber
32278
32486
  };
32487
+ const pageReferenceEntity = generateV2HandlerEntity("pageReferenceNodeHandler", translator$1);
32279
32488
  const handlePictNode = (params2) => {
32280
32489
  const { nodes } = params2;
32281
32490
  if (!nodes.length || nodes[0].name !== "w:p") {
@@ -32774,6 +32983,7 @@ const getDefaultStyleDefinition = (defaultStyleId, docx) => {
32774
32983
  const spacing = pPr?.elements?.find((el) => el.name === "w:spacing");
32775
32984
  const justify = pPr?.elements?.find((el) => el.name === "w:jc");
32776
32985
  const indent = pPr?.elements?.find((el) => el.name === "w:ind");
32986
+ const tabs = pPr?.elements?.find((el) => el.name === "w:tabs");
32777
32987
  let lineSpaceBefore, lineSpaceAfter, line;
32778
32988
  if (spacing) {
32779
32989
  lineSpaceBefore = twipsToPixels(spacing?.attributes["w:before"]);
@@ -32787,6 +32997,22 @@ const getDefaultStyleDefinition = (defaultStyleId, docx) => {
32787
32997
  rightIndent = twipsToPixels(indent?.attributes["w:right"]);
32788
32998
  firstLine = twipsToPixels(indent?.attributes["w:firstLine"]);
32789
32999
  }
33000
+ let tabStops = [];
33001
+ if (tabs) {
33002
+ tabStops = (tabs.elements || []).filter((el) => el.name === "w:tab").map((tab) => {
33003
+ let val = tab.attributes["w:val"];
33004
+ if (val == "left") {
33005
+ val = "start";
33006
+ } else if (val == "right") {
33007
+ val = "end";
33008
+ }
33009
+ return {
33010
+ val,
33011
+ pos: twipsToPixels(tab.attributes["w:pos"]),
33012
+ leader: tab.attributes["w:leader"]
33013
+ };
33014
+ });
33015
+ }
32790
33016
  const keepNext = pPr?.elements?.find((el) => el.name === "w:keepNext");
32791
33017
  const keepLines = pPr?.elements?.find((el) => el.name === "w:keepLines");
32792
33018
  const outlineLevel = pPr?.elements?.find((el) => el.name === "w:outlineLvl");
@@ -32819,7 +33045,8 @@ const getDefaultStyleDefinition = (defaultStyleId, docx) => {
32819
33045
  const parsedStyles = {
32820
33046
  spacing: { lineSpaceAfter, lineSpaceBefore, line },
32821
33047
  textAlign,
32822
- indent: { leftIndent, rightIndent, firstLine }
33048
+ indent: { leftIndent, rightIndent, firstLine },
33049
+ tabStops: tabStops.length > 0 ? tabStops : null
32823
33050
  };
32824
33051
  parsedMarks.forEach((mark) => {
32825
33052
  const { type: type2, attrs } = mark;
@@ -32843,13 +33070,213 @@ const handleTabNode = (params2) => {
32843
33070
  if (!nodes.length || nodes[0].name !== "w:tab") {
32844
33071
  return { nodes: [], consumed: 0 };
32845
33072
  }
32846
- const node = translator$14.encode(params2);
33073
+ const node = translator$17.encode(params2);
32847
33074
  return { nodes: [node], consumed: 1 };
32848
33075
  };
32849
33076
  const tabNodeEntityHandler = {
32850
33077
  handlerName: "w:tabTranslator",
32851
33078
  handler: handleTabNode
32852
33079
  };
33080
+ const tableOfContentsHandlerEntity = generateV2HandlerEntity("tableOfContentsHandler", translator);
33081
+ function preProcessPageInstruction(nodesToCombine, _2, __) {
33082
+ const pageNumNode = {
33083
+ name: "sd:autoPageNumber",
33084
+ type: "element"
33085
+ };
33086
+ nodesToCombine.forEach((n) => {
33087
+ const rPrNode = n.elements.find((el) => el.name === "w:rPr");
33088
+ if (rPrNode) pageNumNode.elements = [rPrNode];
33089
+ });
33090
+ return [pageNumNode];
33091
+ }
33092
+ function preProcessNumPagesInstruction(nodesToCombine, _2, __) {
33093
+ const totalPageNumNode = {
33094
+ name: "sd:totalPageNumber",
33095
+ type: "element"
33096
+ };
33097
+ nodesToCombine.forEach((n) => {
33098
+ const rPrNode = n.elements?.find((el) => el.name === "w:rPr");
33099
+ if (rPrNode) totalPageNumNode.elements = [rPrNode];
33100
+ });
33101
+ return [totalPageNumNode];
33102
+ }
33103
+ function preProcessPageRefInstruction(nodesToCombine, instrText, _2) {
33104
+ const pageRefNode = {
33105
+ name: "sd:pageReference",
33106
+ type: "element",
33107
+ attributes: {
33108
+ instruction: instrText
33109
+ },
33110
+ elements: nodesToCombine
33111
+ };
33112
+ return [pageRefNode];
33113
+ }
33114
+ function preProcessHyperlinkInstruction(nodesToCombine, instruction, docx) {
33115
+ const urlMatch = instruction.match(/HYPERLINK\s+"([^"]+)"/);
33116
+ let linkAttributes;
33117
+ if (urlMatch && urlMatch.length >= 2) {
33118
+ const url = urlMatch[1];
33119
+ const rels = docx["word/_rels/document.xml.rels"];
33120
+ const relationships = rels?.elements.find((el) => el.name === "Relationships");
33121
+ if (relationships) {
33122
+ const rId = generateDocxRandomId();
33123
+ relationships.elements.push({
33124
+ type: "element",
33125
+ name: "Relationship",
33126
+ attributes: {
33127
+ Id: rId,
33128
+ Type: "http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink",
33129
+ Target: url,
33130
+ TargetMode: "External"
33131
+ }
33132
+ });
33133
+ linkAttributes = { "r:id": rId };
33134
+ } else {
33135
+ linkAttributes = { "w:anchor": url };
33136
+ }
33137
+ } else {
33138
+ const availableSwitches = {
33139
+ "w:anchor": `l "(?<value>[^"]+)"`,
33140
+ new_window: `
33141
+ `,
33142
+ "w:tgtFrame": ` "(?<value>[^"]+)"`,
33143
+ "w:tooltip": `o "(?<value>[^"]+)"`
33144
+ };
33145
+ const parsedSwitches = {};
33146
+ for (const [key2, regex] of Object.entries(availableSwitches)) {
33147
+ const match = instruction.match(new RegExp(regex));
33148
+ if (match) {
33149
+ parsedSwitches[key2] = match.groups?.value || true;
33150
+ }
33151
+ }
33152
+ if (parsedSwitches.new_window) {
33153
+ parsedSwitches["w:tgtFrame"] = "_blank";
33154
+ delete parsedSwitches.new_window;
33155
+ }
33156
+ linkAttributes = { ...parsedSwitches };
33157
+ }
33158
+ return [
33159
+ {
33160
+ name: "w:hyperlink",
33161
+ type: "element",
33162
+ attributes: linkAttributes,
33163
+ elements: nodesToCombine
33164
+ }
33165
+ ];
33166
+ }
33167
+ function preProcessTocInstruction(nodesToCombine, instrText) {
33168
+ return [
33169
+ {
33170
+ name: "sd:tableOfContents",
33171
+ type: "element",
33172
+ attributes: {
33173
+ instruction: instrText
33174
+ },
33175
+ elements: nodesToCombine
33176
+ }
33177
+ ];
33178
+ }
33179
+ const getInstructionPreProcessor = (instruction) => {
33180
+ const instructionType = instruction.split(" ")[0];
33181
+ switch (instructionType) {
33182
+ case "PAGE":
33183
+ return preProcessPageInstruction;
33184
+ case "NUMPAGES":
33185
+ return preProcessNumPagesInstruction;
33186
+ case "PAGEREF":
33187
+ return preProcessPageRefInstruction;
33188
+ case "HYPERLINK":
33189
+ return preProcessHyperlinkInstruction;
33190
+ case "TOC":
33191
+ return preProcessTocInstruction;
33192
+ default:
33193
+ return null;
33194
+ }
33195
+ };
33196
+ const preProcessNodesForFldChar = (nodes = [], docx) => {
33197
+ const processedNodes = [];
33198
+ let collectedNodesStack = [];
33199
+ let currentFieldStack = [];
33200
+ let unpairedEnd = null;
33201
+ let collecting = false;
33202
+ const finalizeField = () => {
33203
+ if (collecting) {
33204
+ const collectedNodes = collectedNodesStack.pop().filter((n) => n !== null);
33205
+ const currentField = currentFieldStack.pop();
33206
+ const combined = _processCombinedNodesForFldChar(collectedNodes, currentField.instrText.trim(), docx);
33207
+ if (collectedNodesStack.length === 0) {
33208
+ processedNodes.push(...combined);
33209
+ } else {
33210
+ collectedNodesStack[collectedNodesStack.length - 1].push(...combined);
33211
+ }
33212
+ } else {
33213
+ unpairedEnd = true;
33214
+ }
33215
+ };
33216
+ for (const node of nodes) {
33217
+ const fldCharEl = node.elements?.find((el) => el.name === "w:fldChar");
33218
+ const fldType = fldCharEl?.attributes?.["w:fldCharType"];
33219
+ const instrTextEl = node.elements?.find((el) => el.name === "w:instrText");
33220
+ collecting = collectedNodesStack.length > 0;
33221
+ if (fldType === "begin") {
33222
+ collectedNodesStack.push([null]);
33223
+ currentFieldStack.push({ instrText: "" });
33224
+ continue;
33225
+ }
33226
+ if (instrTextEl && collecting && currentFieldStack.length > 0) {
33227
+ currentFieldStack[currentFieldStack.length - 1].instrText += (instrTextEl.elements?.[0]?.text || "") + " ";
33228
+ continue;
33229
+ }
33230
+ if (fldType === "end") {
33231
+ finalizeField();
33232
+ continue;
33233
+ } else if (fldType === "separate") {
33234
+ continue;
33235
+ }
33236
+ if (Array.isArray(node.elements)) {
33237
+ const childResult = preProcessNodesForFldChar(node.elements, docx);
33238
+ node.elements = childResult.processedNodes;
33239
+ if (childResult.unpairedBegin) {
33240
+ childResult.unpairedBegin.forEach((pendingField) => {
33241
+ currentFieldStack.push(pendingField.fieldInfo);
33242
+ collectedNodesStack.push([node]);
33243
+ });
33244
+ } else if (childResult.unpairedEnd) {
33245
+ collectedNodesStack[collectedNodesStack.length - 1].push(node);
33246
+ finalizeField();
33247
+ } else if (collecting) {
33248
+ collectedNodesStack[collectedNodesStack.length - 1].push(node);
33249
+ } else {
33250
+ processedNodes.push(node);
33251
+ }
33252
+ } else if (collecting) {
33253
+ collectedNodesStack[collectedNodesStack.length - 1].push(node);
33254
+ } else {
33255
+ processedNodes.push(node);
33256
+ }
33257
+ }
33258
+ let unpairedBegin = null;
33259
+ if (collectedNodesStack.length > 0) {
33260
+ unpairedBegin = [];
33261
+ for (let i = 0; i < collectedNodesStack.length; i++) {
33262
+ processedNodes.push(...collectedNodesStack[i].filter((n) => n !== null));
33263
+ unpairedBegin.push({
33264
+ nodes: collectedNodesStack[i],
33265
+ fieldInfo: currentFieldStack[i]
33266
+ });
33267
+ }
33268
+ }
33269
+ return { processedNodes, unpairedBegin, unpairedEnd };
33270
+ };
33271
+ const _processCombinedNodesForFldChar = (nodesToCombine = [], instrText, docx) => {
33272
+ const instructionType = instrText.trim().split(" ")[0];
33273
+ const instructionPreProcessor = getInstructionPreProcessor(instructionType);
33274
+ if (instructionPreProcessor) {
33275
+ return instructionPreProcessor(nodesToCombine, instrText, docx);
33276
+ } else {
33277
+ return nodesToCombine;
33278
+ }
33279
+ };
32853
33280
  const createDocumentJson = (docx, converter, editor) => {
32854
33281
  const json = carbonCopy(getInitialJSON(docx));
32855
33282
  if (!json) return null;
@@ -32879,6 +33306,8 @@ const createDocumentJson = (docx, converter, editor) => {
32879
33306
  if (bodyNode) {
32880
33307
  ensureSectionProperties(bodyNode);
32881
33308
  const node = bodyNode;
33309
+ const { processedNodes } = preProcessNodesForFldChar(node.elements ?? [], docx);
33310
+ node.elements = processedNodes;
32882
33311
  const contentElements = node.elements?.filter((n) => n.name !== "w:sectPr") ?? [];
32883
33312
  const content = pruneIgnoredNodes(contentElements);
32884
33313
  const comments = importCommentData({ docx, converter, editor });
@@ -32934,8 +33363,10 @@ const defaultNodeListHandler = () => {
32934
33363
  trackChangeNodeHandlerEntity,
32935
33364
  tableNodeHandlerEntity,
32936
33365
  tabNodeEntityHandler,
33366
+ tableOfContentsHandlerEntity,
32937
33367
  autoPageHandlerEntity,
32938
33368
  autoTotalPageCountEntity,
33369
+ pageReferenceEntity,
32939
33370
  standardNodeHandlerEntity
32940
33371
  ];
32941
33372
  const handler2 = createNodeListHandler(entities);
@@ -41642,8 +42073,7 @@ function readDOMChange(view, from2, to, typeOver, addedNodes) {
41642
42073
  let $to = parse.doc.resolveNoCache(change.endB - parse.from);
41643
42074
  let $fromA = doc2.resolve(change.start);
41644
42075
  let inlineChange = $from.sameParent($to) && $from.parent.inlineContent && $fromA.end() >= change.endA;
41645
- let nextSel;
41646
- 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")))) {
42076
+ 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")))) {
41647
42077
  view.input.lastIOSEnter = 0;
41648
42078
  return;
41649
42079
  }
@@ -53787,6 +54217,17 @@ function getStructuredContentTagsById(idOrIds, state2) {
53787
54217
  });
53788
54218
  return result;
53789
54219
  }
54220
+ function getStructuredContentTagsByAlias(aliasOrAliases, state2) {
54221
+ const result = findChildren$5(state2.doc, (node) => {
54222
+ const isStructuredContent = ["structuredContent", "structuredContentBlock"].includes(node.type.name);
54223
+ if (Array.isArray(aliasOrAliases)) {
54224
+ return isStructuredContent && aliasOrAliases.includes(node.attrs.alias);
54225
+ } else {
54226
+ return isStructuredContent && node.attrs.alias === aliasOrAliases;
54227
+ }
54228
+ });
54229
+ return result;
54230
+ }
53790
54231
  function getStructuredContentTags(state2) {
53791
54232
  const result = findChildren$5(state2.doc, (node) => {
53792
54233
  return node.type.name === "structuredContent" || node.type.name === "structuredContentBlock";
@@ -53806,6 +54247,7 @@ const structuredContentHelpers = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ O
53806
54247
  getStructuredContentBlockTags,
53807
54248
  getStructuredContentInlineTags,
53808
54249
  getStructuredContentTags,
54250
+ getStructuredContentTagsByAlias,
53809
54251
  getStructuredContentTagsById
53810
54252
  }, Symbol.toStringTag, { value: "Module" }));
53811
54253
  const STRUCTURED_CONTENT_NAMES = ["structuredContent", "structuredContentBlock"];
@@ -53894,10 +54336,11 @@ const StructuredContentCommands = Extension.create({
53894
54336
  return true;
53895
54337
  },
53896
54338
  /**
53897
- * Updates a structured content attributes or content.
54339
+ * Updates a single structured content field by its unique ID.
54340
+ * IDs are unique identifiers, so this will update at most one field.
53898
54341
  * If the updated node does not match the schema, it will not be updated.
53899
54342
  * @category Command
53900
- * @param {string} id
54343
+ * @param {string} id - Unique identifier of the field
53901
54344
  * @param {StructuredContentUpdate} options
53902
54345
  */
53903
54346
  updateStructuredContentById: (id, options = {}) => ({ editor, dispatch, state: state2, tr }) => {
@@ -53937,6 +54380,58 @@ const StructuredContentCommands = Extension.create({
53937
54380
  }
53938
54381
  return true;
53939
54382
  },
54383
+ /**
54384
+ * Updates all structured content fields with the same alias.
54385
+ * Unlike IDs (which are unique), aliases can be shared across multiple fields.
54386
+ * This will update every field that matches the given alias.
54387
+ * If any updated node does not match the schema, no updates will be applied.
54388
+ * @category Command
54389
+ * @param {string | string[]} alias - Shared identifier for fields (e.g., "customer_name")
54390
+ * @param {StructuredContentUpdate} options
54391
+ */
54392
+ updateStructuredContentByAlias: (alias, options = {}) => ({ editor, dispatch, state: state2, tr }) => {
54393
+ const structuredContentTags = getStructuredContentTagsByAlias(alias, state2);
54394
+ if (!structuredContentTags.length) {
54395
+ return true;
54396
+ }
54397
+ const { schema } = editor;
54398
+ const createContent = (node) => {
54399
+ if (options.text) {
54400
+ return schema.text(options.text);
54401
+ }
54402
+ if (options.html) {
54403
+ const html = htmlHandler(options.html, editor);
54404
+ const doc2 = DOMParser$1.fromSchema(schema).parse(html);
54405
+ return doc2.content;
54406
+ }
54407
+ if (options.json) {
54408
+ return schema.nodeFromJSON(options.json);
54409
+ }
54410
+ return node.content;
54411
+ };
54412
+ for (const { node } of structuredContentTags) {
54413
+ const content = createContent(node);
54414
+ const updatedNode = node.type.create({ ...node.attrs, ...options.attrs }, content, node.marks);
54415
+ try {
54416
+ updatedNode.check();
54417
+ } catch {
54418
+ console.error("Updated node does not conform to the schema");
54419
+ return false;
54420
+ }
54421
+ }
54422
+ if (dispatch) {
54423
+ structuredContentTags.forEach(({ pos, node }) => {
54424
+ const mappedPos = tr.mapping.map(pos);
54425
+ const currentNode = tr.doc.nodeAt(mappedPos);
54426
+ if (currentNode && node.eq(currentNode)) {
54427
+ const content = createContent(node);
54428
+ const updatedNode = node.type.create({ ...node.attrs, ...options.attrs }, content, node.marks);
54429
+ tr.replaceWith(mappedPos, mappedPos + node.nodeSize, updatedNode);
54430
+ }
54431
+ });
54432
+ }
54433
+ return true;
54434
+ },
53940
54435
  /**
53941
54436
  * Removes a structured content.
53942
54437
  * @category Command
@@ -54390,6 +54885,48 @@ const DocumentSection = Node$1.create({
54390
54885
  };
54391
54886
  }
54392
54887
  });
54888
+ const DocumentPartObject = Node$1.create({
54889
+ name: "documentPartObject",
54890
+ group: "block",
54891
+ content: "block*",
54892
+ isolating: true,
54893
+ addOptions() {
54894
+ return {
54895
+ htmlAttributes: {
54896
+ class: "sd-document-part-object-block",
54897
+ "aria-label": "Structured document part block"
54898
+ }
54899
+ };
54900
+ },
54901
+ parseDOM() {
54902
+ return [
54903
+ {
54904
+ tag: "div.sd-document-part-object-block",
54905
+ priority: 60
54906
+ }
54907
+ ];
54908
+ },
54909
+ renderDOM({ htmlAttributes }) {
54910
+ return ["div", Attribute2.mergeAttributes(this.options.htmlAttributes, htmlAttributes), 0];
54911
+ },
54912
+ addAttributes() {
54913
+ return {
54914
+ sdBlockId: {
54915
+ default: null,
54916
+ keepOnSplit: false,
54917
+ parseDOM: (elem) => elem.getAttribute("data-sd-block-id"),
54918
+ renderDOM: (attrs) => {
54919
+ return attrs.sdBlockId ? { "data-sd-block-id": attrs.sdBlockId } : {};
54920
+ }
54921
+ },
54922
+ id: {},
54923
+ docPartGallery: {},
54924
+ docPartUnique: {
54925
+ default: true
54926
+ }
54927
+ };
54928
+ }
54929
+ });
54393
54930
  const Document = Node$1.create({
54394
54931
  name: "doc",
54395
54932
  topNode: true,
@@ -55526,7 +56063,12 @@ const generateDecorations = (state2, styles) => {
55526
56063
  return { ...base2, ...linkedStyle.definition?.styles || {} };
55527
56064
  };
55528
56065
  const pMap = buildStyleMap(paragraphStyleId);
55529
- const tMap = buildStyleMap(inlineTextStyleId);
56066
+ let tMap;
56067
+ if (paragraphStyleId?.startsWith("TOC")) {
56068
+ tMap = {};
56069
+ } else {
56070
+ tMap = buildStyleMap(inlineTextStyleId);
56071
+ }
55530
56072
  const rMap = buildStyleMap(runStyleId);
55531
56073
  const finalStyles = { ...pMap, ...tMap, ...rMap };
55532
56074
  if (Object.keys(finalStyles).length === 0) return;
@@ -56823,7 +57365,7 @@ const CommentsMark = Mark2.create({
56823
57365
  });
56824
57366
  const defaultTabDistance = 48;
56825
57367
  const defaultLineLength = 816;
56826
- const getTabDecorations = (doc2, view, from2 = 0, to = null) => {
57368
+ const getTabDecorations = (doc2, view, helpers2, from2 = 0, to = null) => {
56827
57369
  const decorations = [];
56828
57370
  const paragraphCache = /* @__PURE__ */ new Map();
56829
57371
  const end2 = to ?? doc2.content.size;
@@ -56831,7 +57373,7 @@ const getTabDecorations = (doc2, view, from2 = 0, to = null) => {
56831
57373
  if (node.type.name !== "tab") return;
56832
57374
  let extraStyles = "";
56833
57375
  const $pos = doc2.resolve(pos);
56834
- const paragraphContext = getParagraphContext($pos, paragraphCache);
57376
+ const paragraphContext = getParagraphContext($pos, paragraphCache, helpers2);
56835
57377
  if (!paragraphContext) return;
56836
57378
  try {
56837
57379
  const { tabStops, flattened, startPos } = paragraphContext;
@@ -56886,18 +57428,27 @@ const getTabDecorations = (doc2, view, from2 = 0, to = null) => {
56886
57428
  });
56887
57429
  return decorations;
56888
57430
  };
56889
- function getParagraphContext($pos, cache2) {
57431
+ function getParagraphContext($pos, cache2, helpers2) {
56890
57432
  for (let depth = $pos.depth; depth >= 0; depth--) {
56891
57433
  const node = $pos.node(depth);
56892
57434
  if (node?.type?.name === "paragraph") {
56893
57435
  const startPos = $pos.start(depth);
56894
57436
  if (!cache2.has(startPos)) {
57437
+ let tabStops = [];
57438
+ if (Array.isArray(node.attrs?.tabStops)) {
57439
+ tabStops = node.attrs.tabStops;
57440
+ } else {
57441
+ const style2 = helpers2.linkedStyles.getStyleById(node.attrs?.styleId);
57442
+ if (Array.isArray(style2?.definition?.styles?.tabStops)) {
57443
+ tabStops = style2.definition.styles.tabStops;
57444
+ }
57445
+ }
56895
57446
  cache2.set(startPos, {
56896
57447
  paragraph: node,
56897
57448
  paragraphDepth: depth,
56898
57449
  startPos,
56899
57450
  indent: node.attrs?.indent || {},
56900
- tabStops: Array.isArray(node.attrs?.tabStops) ? node.attrs.tabStops : [],
57451
+ tabStops,
56901
57452
  flattened: flattenParagraph(node, startPos),
56902
57453
  accumulatedTabWidth: 0
56903
57454
  });
@@ -57063,7 +57614,7 @@ const TabNode = Node$1.create({
57063
57614
  };
57064
57615
  },
57065
57616
  addPmPlugins() {
57066
- const { view } = this.editor;
57617
+ const { view, helpers: helpers2 } = this.editor;
57067
57618
  const tabPlugin = new Plugin({
57068
57619
  name: "tabPlugin",
57069
57620
  key: new PluginKey("tabPlugin"),
@@ -57073,7 +57624,7 @@ const TabNode = Node$1.create({
57073
57624
  },
57074
57625
  apply(tr, { decorations }, _oldState, newState) {
57075
57626
  if (!decorations) {
57076
- decorations = DecorationSet.create(newState.doc, getTabDecorations(newState.doc, view));
57627
+ decorations = DecorationSet.create(newState.doc, getTabDecorations(newState.doc, view, helpers2));
57077
57628
  }
57078
57629
  if (!tr.docChanged) {
57079
57630
  return { decorations };
@@ -57113,7 +57664,7 @@ const TabNode = Node$1.create({
57113
57664
  rangesToRecalculate.forEach(([start2, end2]) => {
57114
57665
  const oldDecorations = decorations.find(start2, end2);
57115
57666
  decorations = decorations.remove(oldDecorations);
57116
- const newDecorations = getTabDecorations(newState.doc, view, start2, end2);
57667
+ const newDecorations = getTabDecorations(newState.doc, view, helpers2, start2, end2);
57117
57668
  decorations = decorations.add(newState.doc, newDecorations);
57118
57669
  });
57119
57670
  return { decorations };
@@ -62022,6 +62573,7 @@ function getFormatAttrsFromMarks(marks) {
62022
62573
  }
62023
62574
  return formatAttrs;
62024
62575
  }
62576
+ const DEFAULT_MIME_TYPE = "application/octet-stream";
62025
62577
  const simpleHash = (str) => {
62026
62578
  let hash2 = 0;
62027
62579
  for (let i = 0; i < str.length; i++) {
@@ -62031,21 +62583,40 @@ const simpleHash = (str) => {
62031
62583
  }
62032
62584
  return Math.abs(hash2).toString();
62033
62585
  };
62034
- const base64ToFile = (base64String) => {
62035
- const arr = base64String.split(",");
62036
- const mimeMatch = arr[0].match(/:(.*?);/);
62037
- const mimeType = mimeMatch ? mimeMatch[1] : "";
62038
- const data = arr[1];
62039
- const binaryString = atob(data);
62586
+ const decodeBase64ToBinaryString = (data) => {
62587
+ if (!data) return "";
62588
+ if (typeof atob === "function") {
62589
+ return atob(data);
62590
+ }
62591
+ if (typeof Buffer2 !== "undefined" && typeof Buffer2.from === "function") {
62592
+ return Buffer2.from(data, "base64").toString("binary");
62593
+ }
62594
+ throw new Error("Unable to decode base64 payload in the current environment.");
62595
+ };
62596
+ const extractBase64Meta = (base64String) => {
62597
+ const [meta = "", payload = ""] = base64String.split(",");
62598
+ const mimeMatch = meta.match(/:(.*?);/);
62599
+ const rawMimeType = mimeMatch ? mimeMatch[1] : "";
62600
+ const mimeType = rawMimeType || DEFAULT_MIME_TYPE;
62601
+ const binaryString = decodeBase64ToBinaryString(payload);
62040
62602
  const hash2 = simpleHash(binaryString);
62041
62603
  const extension = mimeType.split("/")[1] || "bin";
62042
62604
  const filename = `image-${hash2}.${extension}`;
62605
+ return { mimeType, binaryString, filename };
62606
+ };
62607
+ const getBase64FileMeta = (base64String) => {
62608
+ const { mimeType, filename } = extractBase64Meta(base64String);
62609
+ return { mimeType, filename };
62610
+ };
62611
+ const base64ToFile = (base64String) => {
62612
+ const { mimeType, binaryString, filename } = extractBase64Meta(base64String);
62613
+ const fileType = mimeType || DEFAULT_MIME_TYPE;
62043
62614
  const bytes = new Uint8Array(binaryString.length);
62044
62615
  for (let i = 0; i < binaryString.length; i++) {
62045
62616
  bytes[i] = binaryString.charCodeAt(i);
62046
62617
  }
62047
- const blob = new Blob([bytes], { type: mimeType });
62048
- return new File([blob], filename, { type: mimeType });
62618
+ const blob = new Blob([bytes], { type: fileType });
62619
+ return new File([blob], filename, { type: fileType });
62049
62620
  };
62050
62621
  const urlToFile = async (url, filename, mimeType) => {
62051
62622
  try {
@@ -62421,6 +62992,7 @@ function addImageRelationship({ editor, path }) {
62421
62992
  }
62422
62993
  }
62423
62994
  const key = new PluginKey("ImageRegistration");
62995
+ const WORD_MEDIA_PREFIX = "word/";
62424
62996
  const ImageRegistrationPlugin = ({ editor }) => {
62425
62997
  const { view } = editor;
62426
62998
  return new Plugin({
@@ -62441,16 +63013,16 @@ const ImageRegistrationPlugin = ({ editor }) => {
62441
63013
  },
62442
63014
  appendTransaction: (trs, _oldState, state2) => {
62443
63015
  let foundImages = [];
62444
- trs.forEach((tr2) => {
62445
- if (tr2.docChanged) {
62446
- tr2.steps.forEach((step, index2) => {
63016
+ trs.forEach((tr) => {
63017
+ if (tr.docChanged) {
63018
+ tr.steps.forEach((step, index2) => {
62447
63019
  const stepMap = step.getMap();
62448
63020
  foundImages = foundImages.map(({ node, pos, id }) => {
62449
63021
  const mappedPos = stepMap.map(pos, -1);
62450
63022
  return { node, pos: mappedPos, id };
62451
63023
  });
62452
63024
  if (step instanceof ReplaceStep || step instanceof ReplaceAroundStep$1) {
62453
- (tr2.docs[index2 + 1] || tr2.doc).nodesBetween(
63025
+ (tr.docs[index2 + 1] || tr.doc).nodesBetween(
62454
63026
  stepMap.map(step.from, -1),
62455
63027
  stepMap.map(step.to, 1),
62456
63028
  (node, pos) => {
@@ -62469,22 +63041,10 @@ const ImageRegistrationPlugin = ({ editor }) => {
62469
63041
  if (!foundImages || foundImages.length === 0) {
62470
63042
  return null;
62471
63043
  }
62472
- registerImages(foundImages, editor, view);
62473
- const tr = state2.tr;
62474
- let { set } = key.getState(state2);
62475
- foundImages.slice().sort((a, b2) => a.pos - b2.pos).forEach(({ pos, id }) => {
62476
- let deco = Decoration.widget(pos, () => document.createElement("placeholder"), {
62477
- side: -1,
62478
- id
62479
- });
62480
- set = set.add(tr.doc, [deco]);
62481
- });
62482
- foundImages.slice().sort((a, b2) => b2.pos - a.pos).forEach(({ node, pos }) => {
62483
- tr.delete(pos, pos + node.nodeSize);
62484
- });
62485
- set = set.map(tr.mapping, tr.doc);
62486
- tr.setMeta(key, { set });
62487
- return tr;
63044
+ if (editor.options.isHeadless) {
63045
+ return handleNodePath(foundImages, editor, state2);
63046
+ }
63047
+ return handleBrowserPath(foundImages, editor, view, state2);
62488
63048
  },
62489
63049
  props: {
62490
63050
  decorations(state2) {
@@ -62494,6 +63054,59 @@ const ImageRegistrationPlugin = ({ editor }) => {
62494
63054
  }
62495
63055
  });
62496
63056
  };
63057
+ const derivePreferredFileName = (src) => {
63058
+ if (typeof src !== "string" || src.length === 0) {
63059
+ return "image.bin";
63060
+ }
63061
+ if (src.startsWith("data:")) {
63062
+ return getBase64FileMeta(src).filename;
63063
+ }
63064
+ const lastSegment = src.split("/").pop() ?? "";
63065
+ const trimmed = lastSegment.split(/[?#]/)[0];
63066
+ return trimmed || "image.bin";
63067
+ };
63068
+ const handleNodePath = (foundImages, editor, state2) => {
63069
+ const { tr } = state2;
63070
+ const mediaStore = editor.storage.image.media ?? {};
63071
+ if (!editor.storage.image.media) {
63072
+ editor.storage.image.media = mediaStore;
63073
+ }
63074
+ const existingFileNames = new Set(Object.keys(mediaStore).map((key2) => key2.split("/").pop()));
63075
+ foundImages.forEach(({ node, pos }) => {
63076
+ const { src } = node.attrs;
63077
+ const preferredFileName = derivePreferredFileName(src);
63078
+ const uniqueFileName = ensureUniqueFileName(preferredFileName, existingFileNames);
63079
+ existingFileNames.add(uniqueFileName);
63080
+ const mediaPath = buildMediaPath(uniqueFileName);
63081
+ mediaStore[mediaPath] = src;
63082
+ const path = mediaPath.startsWith(WORD_MEDIA_PREFIX) ? mediaPath.slice(WORD_MEDIA_PREFIX.length) : mediaPath;
63083
+ const rId = addImageRelationship({ editor, path });
63084
+ tr.setNodeMarkup(pos, void 0, {
63085
+ ...node.attrs,
63086
+ src: mediaPath,
63087
+ rId
63088
+ });
63089
+ });
63090
+ return tr;
63091
+ };
63092
+ const handleBrowserPath = (foundImages, editor, view, state2) => {
63093
+ registerImages(foundImages, editor, view);
63094
+ const tr = state2.tr;
63095
+ let { set } = key.getState(state2);
63096
+ foundImages.slice().sort((a, b2) => a.pos - b2.pos).forEach(({ pos, id }) => {
63097
+ let deco = Decoration.widget(pos, () => document.createElement("placeholder"), {
63098
+ side: -1,
63099
+ id
63100
+ });
63101
+ set = set.add(tr.doc, [deco]);
63102
+ });
63103
+ foundImages.slice().sort((a, b2) => b2.pos - a.pos).forEach(({ node, pos }) => {
63104
+ tr.delete(pos, pos + node.nodeSize);
63105
+ });
63106
+ set = set.map(tr.mapping, tr.doc);
63107
+ tr.setMeta(key, { set });
63108
+ return tr;
63109
+ };
62497
63110
  const findPlaceholder = (state2, id) => {
62498
63111
  let { set } = key.getState(state2);
62499
63112
  let found2 = set?.find(null, null, (spec) => spec.id === id);
@@ -63394,6 +64007,43 @@ const processMarks = (marks) => {
63394
64007
  });
63395
64008
  return styles;
63396
64009
  };
64010
+ const PageReference = Node$1.create({
64011
+ name: "pageReference",
64012
+ group: "inline",
64013
+ inline: true,
64014
+ atom: true,
64015
+ draggable: false,
64016
+ selectable: false,
64017
+ content: "inline*",
64018
+ addOptions() {
64019
+ return {
64020
+ htmlAttributes: {
64021
+ contenteditable: false,
64022
+ "data-id": "auto-page-reference",
64023
+ "aria-label": "Page reference node",
64024
+ class: "sd-editor-page-reference"
64025
+ }
64026
+ };
64027
+ },
64028
+ addAttributes() {
64029
+ return {
64030
+ marksAsAttrs: {
64031
+ default: null,
64032
+ rendered: false
64033
+ },
64034
+ instruction: {
64035
+ default: "",
64036
+ rendered: false
64037
+ }
64038
+ };
64039
+ },
64040
+ parseDOM() {
64041
+ return [{ tag: 'span[data-id="auto-page-reference"]' }];
64042
+ },
64043
+ renderDOM({ htmlAttributes }) {
64044
+ return ["span", Attribute2.mergeAttributes(this.options.htmlAttributes, htmlAttributes), 0];
64045
+ }
64046
+ });
63397
64047
  const ShapeContainer = Node$1.create({
63398
64048
  name: "shapeContainer",
63399
64049
  group: "block",
@@ -63807,6 +64457,51 @@ const checkForNewBlockNodesInTrs = (transactions) => {
63807
64457
  });
63808
64458
  });
63809
64459
  };
64460
+ const TableOfContents = Node$1.create({
64461
+ name: "tableOfContents",
64462
+ group: "block",
64463
+ content: "paragraph+",
64464
+ inline: false,
64465
+ addOptions() {
64466
+ return {
64467
+ htmlAttributes: {
64468
+ "data-id": "table-of-contents",
64469
+ "aria-label": "Table of Contents"
64470
+ }
64471
+ };
64472
+ },
64473
+ parseDOM() {
64474
+ return [
64475
+ {
64476
+ tag: 'div[data-id="table-of-contents"]'
64477
+ }
64478
+ ];
64479
+ },
64480
+ renderDOM({ htmlAttributes }) {
64481
+ return ["div", Attribute2.mergeAttributes(this.options.htmlAttributes, htmlAttributes), 0];
64482
+ },
64483
+ addAttributes() {
64484
+ return {
64485
+ instruction: {
64486
+ default: null,
64487
+ rendered: false
64488
+ },
64489
+ /**
64490
+ * @private
64491
+ * @category Attribute
64492
+ * @param {string} [sdBlockId] - Internal block tracking ID (not user-configurable)
64493
+ */
64494
+ sdBlockId: {
64495
+ default: null,
64496
+ keepOnSplit: false,
64497
+ parseDOM: (elem) => elem.getAttribute("data-sd-block-id"),
64498
+ renderDOM: (attrs) => {
64499
+ return attrs.sdBlockId ? { "data-sd-block-id": attrs.sdBlockId } : {};
64500
+ }
64501
+ }
64502
+ };
64503
+ }
64504
+ });
63810
64505
  const TextStyle = Mark2.create({
63811
64506
  name: "textStyle",
63812
64507
  addOptions() {
@@ -69529,6 +70224,7 @@ function getActualBreakCoords(view, pos, calculatedThreshold) {
69529
70224
  return actualBreak;
69530
70225
  }
69531
70226
  const onImageLoad = (editor) => {
70227
+ if (typeof requestAnimationFrame !== "function") return;
69532
70228
  requestAnimationFrame(() => {
69533
70229
  const newTr = editor.view.state.tr;
69534
70230
  newTr.setMeta("forceUpdatePagination", true);
@@ -70413,6 +71109,7 @@ const getStarterExtensions = () => {
70413
71109
  SlashMenu,
70414
71110
  Strike,
70415
71111
  TabNode,
71112
+ TableOfContents,
70416
71113
  Text,
70417
71114
  TextAlign,
70418
71115
  TextIndent,
@@ -70447,6 +71144,7 @@ const getStarterExtensions = () => {
70447
71144
  AiLoaderNode,
70448
71145
  PageNumber,
70449
71146
  TotalPageCount,
71147
+ PageReference,
70450
71148
  ShapeContainer,
70451
71149
  ShapeTextbox,
70452
71150
  ContentBlock,
@@ -70455,6 +71153,7 @@ const getStarterExtensions = () => {
70455
71153
  StructuredContentBlock,
70456
71154
  StructuredContentCommands,
70457
71155
  DocumentSection,
71156
+ DocumentPartObject,
70458
71157
  NodeResizer,
70459
71158
  CustomSelection,
70460
71159
  TextTransform
@@ -70737,7 +71436,7 @@ const _sfc_main$4$1 = {
70737
71436
  };
70738
71437
  const handleInputSubmit = () => {
70739
71438
  const value = inlineTextInput.value;
70740
- const cleanValue = value.replace(/[^0-9]/g, "");
71439
+ const cleanValue = value.match(/^\d+(\.5)?$/) ? value : Math.floor(parseFloat(value)).toString();
70741
71440
  emit("textSubmit", cleanValue);
70742
71441
  inlineTextInput.value = cleanValue;
70743
71442
  };
@@ -70819,7 +71518,7 @@ const _sfc_main$4$1 = {
70819
71518
  };
70820
71519
  }
70821
71520
  };
70822
- const ToolbarButton = /* @__PURE__ */ _export_sfc(_sfc_main$4$1, [["__scopeId", "data-v-303b3245"]]);
71521
+ const ToolbarButton = /* @__PURE__ */ _export_sfc(_sfc_main$4$1, [["__scopeId", "data-v-cea02a58"]]);
70823
71522
  const _hoisted_1$2$1 = {
70824
71523
  class: "toolbar-separator",
70825
71524
  role: "separator",
@@ -85991,71 +86690,73 @@ const _sfc_main = {
85991
86690
  };
85992
86691
  const SuperInput = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-4d5cff52"]]);
85993
86692
  const additionalHandlers = Object.freeze({
85994
- "mc:AlternateContent": translator,
85995
- "w:b": translator$12,
85996
- "w:bidiVisual": translator$F,
85997
- "w:bookmarkEnd": translator$1,
85998
- "w:bookmarkStart": translator$2,
85999
- "w:bottom": translator$s,
86000
- "w:br": translator$16,
86001
- "w:cantSplit": translator$T,
86002
- "w:cnfStyle": translator$S,
86003
- "w:color": translator$_,
86004
- "w:divId": translator$R,
86005
- "w:drawing": translator$4,
86006
- "w:end": translator$q,
86007
- "w:gridAfter": translator$Q,
86008
- "w:gridBefore": translator$P,
86009
- "w:gridCol": translator$b,
86010
- "w:hidden": translator$O,
86011
- "w:highlight": translator$15,
86012
- "w:hyperlink": translator$7,
86013
- "w:i": translator$11,
86014
- "w:insideH": translator$o,
86015
- "w:insideV": translator$n,
86016
- "w:jc": translator$N,
86017
- "w:left": translator$m,
86018
- "w:p": translator$13,
86019
- "w:r": translator$U,
86020
- "w:rFonts": translator$Z,
86021
- "w:rPr": translator$V,
86022
- "w:rStyle": translator$Y,
86023
- "w:right": translator$k,
86024
- "w:sdt": translator$3,
86025
- "w:shd": translator$E,
86026
- "w:start": translator$i,
86027
- "w:strike": translator$$,
86028
- "w:sz": translator$X,
86029
- "w:szCs": translator$W,
86030
- "w:tab": translator$14,
86031
- "w:tbl": translator$9,
86032
- "w:tblBorders": translator$e,
86033
- "w:tblCaption": translator$D,
86034
- "w:tblCellMar": translator$d,
86035
- "w:tblCellSpacing": translator$M,
86036
- "w:tblDescription": translator$C,
86037
- "w:tblGrid": translator$a,
86038
- "w:tblHeader": translator$L,
86039
- "w:tblInd": translator$B,
86040
- "w:tblLayout": translator$A,
86041
- "w:tblLook": translator$z,
86042
- "w:tblOverlap": translator$y,
86043
- "w:tblPr": translator$c,
86044
- "w:tblStyle": translator$x,
86045
- "w:tblStyleColBandSize": translator$w,
86046
- "w:tblStyleRowBandSize": translator$v,
86047
- "w:tblW": translator$u,
86048
- "w:tblpPr": translator$t,
86049
- "w:tc": translator$8,
86050
- "w:top": translator$g,
86051
- "w:tr": translator$G,
86052
- "w:trHeight": translator$K,
86053
- "w:trPr": translator$H,
86054
- "w:u": translator$10,
86055
- "w:wAfter": translator$J,
86056
- "w:wBefore": translator$I,
86057
- "wp:anchor": translator$6,
86058
- "wp:inline": translator$5
86693
+ "mc:AlternateContent": translator$2,
86694
+ "sd:pageReference": translator$1,
86695
+ "sd:tableOfContents": translator,
86696
+ "w:b": translator$15,
86697
+ "w:bidiVisual": translator$G,
86698
+ "w:bookmarkEnd": translator$3,
86699
+ "w:bookmarkStart": translator$4,
86700
+ "w:bottom": translator$t,
86701
+ "w:br": translator$19,
86702
+ "w:cantSplit": translator$U,
86703
+ "w:cnfStyle": translator$T,
86704
+ "w:color": translator$11,
86705
+ "w:divId": translator$S,
86706
+ "w:drawing": translator$6,
86707
+ "w:end": translator$r,
86708
+ "w:gridAfter": translator$R,
86709
+ "w:gridBefore": translator$Q,
86710
+ "w:gridCol": translator$c,
86711
+ "w:hidden": translator$P,
86712
+ "w:highlight": translator$18,
86713
+ "w:hyperlink": translator$W,
86714
+ "w:i": translator$14,
86715
+ "w:insideH": translator$p,
86716
+ "w:insideV": translator$o,
86717
+ "w:jc": translator$O,
86718
+ "w:left": translator$n,
86719
+ "w:p": translator$16,
86720
+ "w:r": translator$V,
86721
+ "w:rFonts": translator$10,
86722
+ "w:rPr": translator$X,
86723
+ "w:rStyle": translator$$,
86724
+ "w:right": translator$l,
86725
+ "w:sdt": translator$5,
86726
+ "w:shd": translator$F,
86727
+ "w:start": translator$j,
86728
+ "w:strike": translator$12,
86729
+ "w:sz": translator$_,
86730
+ "w:szCs": translator$Z,
86731
+ "w:tab": translator$17,
86732
+ "w:tbl": translator$a,
86733
+ "w:tblBorders": translator$f,
86734
+ "w:tblCaption": translator$E,
86735
+ "w:tblCellMar": translator$e,
86736
+ "w:tblCellSpacing": translator$N,
86737
+ "w:tblDescription": translator$D,
86738
+ "w:tblGrid": translator$b,
86739
+ "w:tblHeader": translator$M,
86740
+ "w:tblInd": translator$C,
86741
+ "w:tblLayout": translator$B,
86742
+ "w:tblLook": translator$A,
86743
+ "w:tblOverlap": translator$z,
86744
+ "w:tblPr": translator$d,
86745
+ "w:tblStyle": translator$y,
86746
+ "w:tblStyleColBandSize": translator$x,
86747
+ "w:tblStyleRowBandSize": translator$w,
86748
+ "w:tblW": translator$v,
86749
+ "w:tblpPr": translator$u,
86750
+ "w:tc": translator$9,
86751
+ "w:top": translator$h,
86752
+ "w:tr": translator$H,
86753
+ "w:trHeight": translator$L,
86754
+ "w:trPr": translator$I,
86755
+ "w:u": translator$13,
86756
+ "w:wAfter": translator$K,
86757
+ "w:wBefore": translator$J,
86758
+ "wp:anchor": translator$8,
86759
+ "wp:inline": translator$7
86059
86760
  });
86060
86761
  const baseHandlers = {
86061
86762
  ...runPropertyTranslators,