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

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 (55) hide show
  1. package/dist/chunks/{PdfViewer-D2BPnEBG.cjs → PdfViewer-BItyloFT.cjs} +1 -1
  2. package/dist/chunks/{PdfViewer-CBmOiHsj.es.js → PdfViewer-MPmm-SUD.es.js} +1 -1
  3. package/dist/chunks/{index-B0CI50e4.cjs → index-CdJOxoqt.cjs} +2 -2
  4. package/dist/chunks/{index-BSDcfSFc.es.js → index-OVF3JhUR.es.js} +2 -2
  5. package/dist/chunks/{super-editor.es-DOOwW-Iv.cjs → super-editor.es-C7stybby.cjs} +1608 -1032
  6. package/dist/chunks/{super-editor.es-BW1T3N2-.es.js → super-editor.es-DQnqUJZs.es.js} +1608 -1032
  7. package/dist/style.css +3 -0
  8. package/dist/super-editor/ai-writer.es.js +2 -2
  9. package/dist/super-editor/chunks/{converter-UuZxU-p8.js → converter-BVirrB35.js} +1463 -1028
  10. package/dist/super-editor/chunks/{docx-zipper-Bss48sB0.js → docx-zipper-Cpb9d2an.js} +1 -1
  11. package/dist/super-editor/chunks/{editor--v3HbUU0.js → editor-DIINh50j.js} +151 -10
  12. package/dist/super-editor/chunks/{toolbar-BeXlvdV8.js → toolbar-CmDmkPHL.js} +2 -2
  13. package/dist/super-editor/converter.es.js +1 -1
  14. package/dist/super-editor/docx-zipper.es.js +2 -2
  15. package/dist/super-editor/editor.es.js +3 -3
  16. package/dist/super-editor/file-zipper.es.js +1 -1
  17. package/dist/super-editor/src/core/super-converter/exporter.d.ts +4 -4
  18. package/dist/super-editor/src/core/super-converter/field-references/fld-preprocessors/hyperlink-preprocessor.d.ts +9 -0
  19. package/dist/super-editor/src/core/super-converter/field-references/fld-preprocessors/index.d.ts +2 -0
  20. package/dist/super-editor/src/core/super-converter/field-references/fld-preprocessors/num-pages-preprocessor.d.ts +9 -0
  21. package/dist/super-editor/src/core/super-converter/field-references/fld-preprocessors/page-preprocessor.d.ts +9 -0
  22. package/dist/super-editor/src/core/super-converter/field-references/fld-preprocessors/page-ref-preprocessor.d.ts +9 -0
  23. package/dist/super-editor/src/core/super-converter/field-references/fld-preprocessors/toc-preprocessor.d.ts +8 -0
  24. package/dist/super-editor/src/core/super-converter/field-references/index.d.ts +1 -0
  25. package/dist/super-editor/src/core/super-converter/field-references/preProcessNodesForFldChar.d.ts +21 -0
  26. package/dist/super-editor/src/core/super-converter/v2/exporter/helpers/translateChildNodes.d.ts +3 -3
  27. package/dist/super-editor/src/core/super-converter/v2/importer/pageReferenceImporter.d.ts +4 -0
  28. package/dist/super-editor/src/core/super-converter/v2/importer/tableOfContentsImporter.d.ts +4 -0
  29. package/dist/super-editor/src/core/super-converter/v2/types/index.d.ts +7 -1
  30. package/dist/super-editor/src/core/super-converter/v3/handlers/sd/pageReference/index.d.ts +1 -0
  31. package/dist/super-editor/src/core/super-converter/v3/handlers/sd/pageReference/pageReference-translator.d.ts +7 -0
  32. package/dist/super-editor/src/core/super-converter/v3/handlers/sd/tableOfContents/index.d.ts +1 -0
  33. package/dist/super-editor/src/core/super-converter/v3/handlers/sd/tableOfContents/tableOfContents-translator.d.ts +10 -0
  34. package/dist/super-editor/src/core/super-converter/v3/handlers/w/caps/caps-translator.d.ts +7 -0
  35. package/dist/super-editor/src/core/super-converter/v3/handlers/w/p/helpers/w-p-helpers.d.ts +0 -2
  36. package/dist/super-editor/src/core/super-converter/v3/handlers/w/sdt/helpers/handle-doc-part-obj.d.ts +9 -1
  37. package/dist/super-editor/src/core/super-converter/v3/handlers/w/sdt/helpers/translate-document-part-obj.d.ts +6 -0
  38. package/dist/super-editor/src/core/super-converter/v3/node-translator/node-translator.d.ts +2 -2
  39. package/dist/super-editor/src/extensions/page-reference/index.d.ts +1 -0
  40. package/dist/super-editor/src/extensions/page-reference/page-reference.d.ts +2 -0
  41. package/dist/super-editor/src/extensions/structured-content/document-part-object.d.ts +2 -0
  42. package/dist/super-editor/src/extensions/structured-content/index.d.ts +1 -0
  43. package/dist/super-editor/src/extensions/tab/helpers/tabDecorations.d.ts +2 -2
  44. package/dist/super-editor/src/extensions/table-of-contents/index.d.ts +1 -0
  45. package/dist/super-editor/src/extensions/table-of-contents/table-of-contents.d.ts +2 -0
  46. package/dist/super-editor/style.css +3 -0
  47. package/dist/super-editor/super-editor.es.js +10 -8
  48. package/dist/super-editor/toolbar.es.js +2 -2
  49. package/dist/super-editor.cjs +1 -1
  50. package/dist/super-editor.es.js +1 -1
  51. package/dist/superdoc.cjs +2 -2
  52. package/dist/superdoc.es.js +2 -2
  53. package/dist/superdoc.umd.js +1608 -1032
  54. package/dist/superdoc.umd.js.map +1 -1
  55. package/package.json +1 -1
@@ -22968,13 +22968,56 @@ function translateChildNodes(params2) {
22968
22968
  const { content: nodes } = params2.node;
22969
22969
  if (!nodes) return [];
22970
22970
  const translatedNodes = [];
22971
- nodes.forEach((node) => {
22971
+ const hyperlinkGroup = [];
22972
+ let index2 = 0;
22973
+ while (index2 < nodes.length) {
22974
+ const node = nodes[index2];
22975
+ const linkMark = _isLinkNode(node);
22976
+ if (linkMark) {
22977
+ hyperlinkGroup.push(node);
22978
+ const nextNode = index2 + 1 < nodes.length ? nodes[index2 + 1] : null;
22979
+ const nextIsLink = _isLinkNode(nextNode, linkMark);
22980
+ if (nextIsLink) {
22981
+ index2++;
22982
+ continue;
22983
+ } else {
22984
+ let translatedLinkGroup = exportSchemaToJson({
22985
+ ...params2,
22986
+ node: hyperlinkGroup[0],
22987
+ extraParams: { ...params2.extraParams || {}, hyperlinkGroup: hyperlinkGroup.slice() }
22988
+ });
22989
+ if (translatedLinkGroup instanceof Array) translatedNodes.push(...translatedLinkGroup);
22990
+ else translatedNodes.push(translatedLinkGroup);
22991
+ hyperlinkGroup.length = 0;
22992
+ index2++;
22993
+ continue;
22994
+ }
22995
+ }
22972
22996
  let translatedNode = exportSchemaToJson({ ...params2, node });
22973
22997
  if (translatedNode instanceof Array) translatedNodes.push(...translatedNode);
22974
22998
  else translatedNodes.push(translatedNode);
22975
- });
22999
+ index2++;
23000
+ }
22976
23001
  return translatedNodes.filter((n) => n);
22977
23002
  }
23003
+ function _isLinkNode(node, referenceMark = null) {
23004
+ if (!node || !node.marks && !node.attrs?.marksAsAttrs) return null;
23005
+ const marks = node.marks || node.attrs.marksAsAttrs;
23006
+ const linkMark = marks.find((mark) => mark.type === "link");
23007
+ if (!linkMark) return null;
23008
+ if (referenceMark) {
23009
+ return _isSameLinkMark(linkMark.attrs, referenceMark.attrs) ? linkMark : null;
23010
+ }
23011
+ return linkMark;
23012
+ }
23013
+ function _isSameLinkMark(attrsA, attrsB) {
23014
+ for (let key2 of ["anchor", "docLocation", "history", "href", "rId", "target"]) {
23015
+ if (attrsA[key2] != attrsB[key2]) {
23016
+ return false;
23017
+ }
23018
+ }
23019
+ return true;
23020
+ }
22978
23021
  const baseNumbering = {
22979
23022
  declaration: {
22980
23023
  attributes: {
@@ -24321,37 +24364,37 @@ const _NodeTranslator = class _NodeTranslator2 {
24321
24364
  };
24322
24365
  __publicField$2(_NodeTranslator, "translatorTypes", TranslatorTypes);
24323
24366
  let NodeTranslator = _NodeTranslator;
24324
- const encode$18 = (attributes) => {
24367
+ const encode$1b = (attributes) => {
24325
24368
  return attributes["w:type"];
24326
24369
  };
24327
- const decode$$ = (attrs) => {
24370
+ const decode$11 = (attrs) => {
24328
24371
  const { lineBreakType } = attrs;
24329
24372
  return lineBreakType;
24330
24373
  };
24331
24374
  const attrConfig$F = Object.freeze({
24332
24375
  xmlName: "w:type",
24333
24376
  sdName: "lineBreakType",
24334
- encode: encode$18,
24335
- decode: decode$$
24377
+ encode: encode$1b,
24378
+ decode: decode$11
24336
24379
  });
24337
- const encode$17 = (attributes) => {
24380
+ const encode$1a = (attributes) => {
24338
24381
  const xmlAttrValue = attributes["w:clear"];
24339
24382
  return xmlAttrValue;
24340
24383
  };
24341
- const decode$_ = (attrs) => {
24384
+ const decode$10 = (attrs) => {
24342
24385
  const { clear } = attrs;
24343
24386
  return clear;
24344
24387
  };
24345
24388
  const attrConfig$E = Object.freeze({
24346
24389
  xmlName: "w:clear",
24347
24390
  sdName: "clear",
24348
- encode: encode$17,
24349
- decode: decode$_
24391
+ encode: encode$1a,
24392
+ decode: decode$10
24350
24393
  });
24351
24394
  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) => {
24395
+ const XML_NODE_NAME$x = "w:br";
24396
+ const SD_NODE_NAME$f = "lineBreak";
24397
+ const encode$19 = (_2, encodedAttrs) => {
24355
24398
  const isPageBreak = encodedAttrs?.lineBreakType === "page";
24356
24399
  const translated = {
24357
24400
  type: isPageBreak ? "hardBreak" : "lineBreak"
@@ -24361,7 +24404,7 @@ const encode$16 = (_2, encodedAttrs) => {
24361
24404
  }
24362
24405
  return translated;
24363
24406
  };
24364
- const decode$Z = (params2, decodedAttrs) => {
24407
+ const decode$$ = (params2, decodedAttrs) => {
24365
24408
  const { node } = params2;
24366
24409
  if (!node) return;
24367
24410
  const wBreak = { name: "w:br" };
@@ -24378,39 +24421,39 @@ const decode$Z = (params2, decodedAttrs) => {
24378
24421
  };
24379
24422
  return translated;
24380
24423
  };
24381
- const config$s = {
24382
- xmlName: XML_NODE_NAME$u,
24383
- sdNodeOrKeyName: SD_NODE_NAME$d,
24424
+ const config$v = {
24425
+ xmlName: XML_NODE_NAME$x,
24426
+ sdNodeOrKeyName: SD_NODE_NAME$f,
24384
24427
  type: NodeTranslator.translatorTypes.NODE,
24385
- encode: encode$16,
24386
- decode: decode$Z,
24428
+ encode: encode$19,
24429
+ decode: decode$$,
24387
24430
  attributes: validXmlAttributes$m
24388
24431
  };
24389
- const translator$16 = NodeTranslator.from(config$s);
24390
- const encode$15 = (attributes) => attributes?.["w:val"];
24391
- const decode$Y = (attrs) => attrs?.highlight;
24432
+ const translator$19 = NodeTranslator.from(config$v);
24433
+ const encode$18 = (attributes) => attributes?.["w:val"];
24434
+ const decode$_ = (attrs) => attrs?.highlight;
24392
24435
  const attrConfig$D = Object.freeze({
24393
24436
  xmlName: "w:val",
24394
24437
  sdName: "highlight",
24395
- encode: encode$15,
24396
- decode: decode$Y
24438
+ encode: encode$18,
24439
+ decode: decode$_
24397
24440
  });
24398
24441
  const validXmlAttributes$l = [attrConfig$D];
24399
- const XML_NODE_NAME$t = "w:highlight";
24400
- const SD_ATTR_KEY$f = "highlight";
24442
+ const XML_NODE_NAME$w = "w:highlight";
24443
+ const SD_ATTR_KEY$g = "highlight";
24401
24444
  const DISABLED_TOKENS = /* @__PURE__ */ new Set(["transparent", "none", "inherit"]);
24402
- const encode$14 = (params2, encodedAttrs = {}) => {
24445
+ const encode$17 = (params2, encodedAttrs = {}) => {
24403
24446
  const { nodes } = params2;
24404
24447
  const node = nodes?.[0];
24405
24448
  const value = encodedAttrs.highlight ?? node?.attributes?.["w:val"];
24406
24449
  return {
24407
24450
  type: "attr",
24408
- xmlName: XML_NODE_NAME$t,
24409
- sdNodeOrKeyName: SD_ATTR_KEY$f,
24451
+ xmlName: XML_NODE_NAME$w,
24452
+ sdNodeOrKeyName: SD_ATTR_KEY$g,
24410
24453
  attributes: { "w:val": value ?? null }
24411
24454
  };
24412
24455
  };
24413
- const decode$X = (params2) => {
24456
+ const decode$Z = (params2) => {
24414
24457
  const attrs = params2?.node?.attrs || {};
24415
24458
  const highlightValue = attrs.highlight ?? attrs.color ?? null;
24416
24459
  if (!highlightValue) return void 0;
@@ -24418,14 +24461,14 @@ const decode$X = (params2) => {
24418
24461
  if (!normalizedValue) return void 0;
24419
24462
  if (DISABLED_TOKENS.has(normalizedValue)) {
24420
24463
  return {
24421
- name: XML_NODE_NAME$t,
24464
+ name: XML_NODE_NAME$w,
24422
24465
  attributes: { "w:val": "none" }
24423
24466
  };
24424
24467
  }
24425
24468
  const keyword = getDocxHighlightKeywordFromHex(highlightValue);
24426
24469
  if (keyword) {
24427
24470
  return {
24428
- name: XML_NODE_NAME$t,
24471
+ name: XML_NODE_NAME$w,
24429
24472
  attributes: { "w:val": keyword }
24430
24473
  };
24431
24474
  }
@@ -24440,63 +24483,63 @@ const decode$X = (params2) => {
24440
24483
  }
24441
24484
  };
24442
24485
  };
24443
- const config$r = {
24444
- xmlName: XML_NODE_NAME$t,
24445
- sdNodeOrKeyName: SD_ATTR_KEY$f,
24486
+ const config$u = {
24487
+ xmlName: XML_NODE_NAME$w,
24488
+ sdNodeOrKeyName: SD_ATTR_KEY$g,
24446
24489
  type: NodeTranslator.translatorTypes.ATTRIBUTE,
24447
- encode: encode$14,
24448
- decode: decode$X,
24490
+ encode: encode$17,
24491
+ decode: decode$Z,
24449
24492
  attributes: validXmlAttributes$l
24450
24493
  };
24451
- const translator$15 = NodeTranslator.from(config$r);
24452
- const encode$13 = (attributes) => {
24494
+ const translator$18 = NodeTranslator.from(config$u);
24495
+ const encode$16 = (attributes) => {
24453
24496
  return attributes["w:val"];
24454
24497
  };
24455
- const decode$W = (attrs) => {
24498
+ const decode$Y = (attrs) => {
24456
24499
  const { tabSize } = attrs || {};
24457
24500
  return tabSize;
24458
24501
  };
24459
24502
  const attrConfig$C = Object.freeze({
24460
24503
  xmlName: "w:val",
24461
24504
  sdName: "tabSize",
24462
- encode: encode$13,
24463
- decode: decode$W
24505
+ encode: encode$16,
24506
+ decode: decode$Y
24464
24507
  });
24465
- const encode$12 = (attributes) => {
24508
+ const encode$15 = (attributes) => {
24466
24509
  return attributes["w:leader"];
24467
24510
  };
24468
- const decode$V = (attrs) => {
24511
+ const decode$X = (attrs) => {
24469
24512
  const { leader } = attrs || {};
24470
24513
  return leader;
24471
24514
  };
24472
24515
  const attrConfig$B = Object.freeze({
24473
24516
  xmlName: "w:leader",
24474
24517
  sdName: "leader",
24475
- encode: encode$12,
24476
- decode: decode$V
24518
+ encode: encode$15,
24519
+ decode: decode$X
24477
24520
  });
24478
- const encode$11 = (attributes) => {
24521
+ const encode$14 = (attributes) => {
24479
24522
  return attributes["w:pos"];
24480
24523
  };
24481
- const decode$U = (attrs) => {
24524
+ const decode$W = (attrs) => {
24482
24525
  const { pos } = attrs || {};
24483
24526
  return pos;
24484
24527
  };
24485
24528
  const attrConfig$A = Object.freeze({
24486
24529
  xmlName: "w:pos",
24487
24530
  sdName: "pos",
24488
- encode: encode$11,
24489
- decode: decode$U
24531
+ encode: encode$14,
24532
+ decode: decode$W
24490
24533
  });
24491
24534
  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 = {}) => {
24535
+ const XML_NODE_NAME$v = "w:tab";
24536
+ const SD_NODE_NAME$e = "tab";
24537
+ const encode$13 = (_2, encodedAttrs = {}) => {
24495
24538
  const translated = { type: "tab" };
24496
24539
  if (encodedAttrs) translated.attrs = { ...encodedAttrs };
24497
24540
  return translated;
24498
24541
  };
24499
- const decode$T = (params2, decodedAttrs = {}) => {
24542
+ const decode$V = (params2, decodedAttrs = {}) => {
24500
24543
  const { node } = params2 || {};
24501
24544
  if (!node) return;
24502
24545
  const wTab = { name: "w:tab" };
@@ -24512,15 +24555,15 @@ const decode$T = (params2, decodedAttrs = {}) => {
24512
24555
  }
24513
24556
  return translated;
24514
24557
  };
24515
- const config$q = {
24516
- xmlName: XML_NODE_NAME$s,
24517
- sdNodeOrKeyName: SD_NODE_NAME$c,
24558
+ const config$t = {
24559
+ xmlName: XML_NODE_NAME$v,
24560
+ sdNodeOrKeyName: SD_NODE_NAME$e,
24518
24561
  type: NodeTranslator.translatorTypes.NODE,
24519
- encode: encode$10,
24520
- decode: decode$T,
24562
+ encode: encode$13,
24563
+ decode: decode$V,
24521
24564
  attributes: validXmlAttributes$k
24522
24565
  };
24523
- const translator$14 = NodeTranslator.from(config$q);
24566
+ const translator$17 = NodeTranslator.from(config$t);
24524
24567
  const mergeTextNodes = (nodes) => {
24525
24568
  if (!nodes || !Array.isArray(nodes)) {
24526
24569
  return nodes;
@@ -24894,104 +24937,10 @@ const getDefaultParagraphStyle = (docx, styleId = "") => {
24894
24937
  justify: pPrByIdJcAttr
24895
24938
  };
24896
24939
  };
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
24940
  const handleParagraphNode$1 = (params2) => {
24990
24941
  const { nodes, docx, nodeListHandler, filename } = params2;
24991
24942
  const node = carbonCopy(nodes[0]);
24992
24943
  let schemaNode;
24993
- let processedElements = preProcessNodesForFldChar(node.elements);
24994
- node.elements = processedElements;
24995
24944
  const handleStandardNode2 = nodeListHandler.handlerEntities.find(
24996
24945
  (e) => e.handlerName === "standardNodeHandler"
24997
24946
  )?.handler;
@@ -25132,89 +25081,89 @@ const handleParagraphNode$1 = (params2) => {
25132
25081
  }
25133
25082
  return schemaNode;
25134
25083
  };
25135
- const encode$$ = (attributes) => {
25084
+ const encode$12 = (attributes) => {
25136
25085
  return attributes["w:rsidDel"];
25137
25086
  };
25138
- const decode$S = (attrs) => {
25087
+ const decode$U = (attrs) => {
25139
25088
  return attrs.rsidDel;
25140
25089
  };
25141
25090
  const attrConfig$z = Object.freeze({
25142
25091
  xmlName: "w:rsidDel",
25143
25092
  sdName: "rsidDel",
25144
- encode: encode$$,
25145
- decode: decode$S
25093
+ encode: encode$12,
25094
+ decode: decode$U
25146
25095
  });
25147
- const encode$_ = (attributes) => {
25096
+ const encode$11 = (attributes) => {
25148
25097
  return attributes["w:rsidP"];
25149
25098
  };
25150
- const decode$R = (attrs) => {
25099
+ const decode$T = (attrs) => {
25151
25100
  return attrs.rsidP;
25152
25101
  };
25153
25102
  const attrConfig$y = Object.freeze({
25154
25103
  xmlName: "w:rsidP",
25155
25104
  sdName: "rsidP",
25156
- encode: encode$_,
25157
- decode: decode$R
25105
+ encode: encode$11,
25106
+ decode: decode$T
25158
25107
  });
25159
- const encode$Z = (attributes) => {
25108
+ const encode$10 = (attributes) => {
25160
25109
  return attributes["w:rsidR"];
25161
25110
  };
25162
- const decode$Q = (attrs) => {
25111
+ const decode$S = (attrs) => {
25163
25112
  return attrs.rsidR;
25164
25113
  };
25165
25114
  const attrConfig$x = Object.freeze({
25166
25115
  xmlName: "w:rsidR",
25167
25116
  sdName: "rsidR",
25168
- encode: encode$Z,
25169
- decode: decode$Q
25117
+ encode: encode$10,
25118
+ decode: decode$S
25170
25119
  });
25171
- const encode$Y = (attributes) => {
25120
+ const encode$$ = (attributes) => {
25172
25121
  return attributes["w:rsidRPr"];
25173
25122
  };
25174
- const decode$P = (attrs) => {
25123
+ const decode$R = (attrs) => {
25175
25124
  return attrs.rsidRPr;
25176
25125
  };
25177
25126
  const attrConfig$w = Object.freeze({
25178
25127
  xmlName: "w:rsidRPr",
25179
25128
  sdName: "rsidRPr",
25180
- encode: encode$Y,
25181
- decode: decode$P
25129
+ encode: encode$$,
25130
+ decode: decode$R
25182
25131
  });
25183
- const encode$X = (attributes) => {
25132
+ const encode$_ = (attributes) => {
25184
25133
  return attributes["w:rsidRDefault"];
25185
25134
  };
25186
- const decode$O = (attrs) => {
25135
+ const decode$Q = (attrs) => {
25187
25136
  return attrs.rsidRDefault;
25188
25137
  };
25189
25138
  const attrConfig$v = Object.freeze({
25190
25139
  xmlName: "w:rsidRDefault",
25191
25140
  sdName: "rsidRDefault",
25192
- encode: encode$X,
25193
- decode: decode$O
25141
+ encode: encode$_,
25142
+ decode: decode$Q
25194
25143
  });
25195
- const encode$W = (attributes) => {
25144
+ const encode$Z = (attributes) => {
25196
25145
  return attributes["w14:paraId"];
25197
25146
  };
25198
- const decode$N = (attrs) => {
25147
+ const decode$P = (attrs) => {
25199
25148
  return attrs.paraId;
25200
25149
  };
25201
25150
  const attrConfig$u = Object.freeze({
25202
25151
  xmlName: "w14:paraId",
25203
25152
  sdName: "paraId",
25204
- encode: encode$W,
25205
- decode: decode$N
25153
+ encode: encode$Z,
25154
+ decode: decode$P
25206
25155
  });
25207
- const encode$V = (attributes) => {
25156
+ const encode$Y = (attributes) => {
25208
25157
  return attributes["w14:textId"];
25209
25158
  };
25210
- const decode$M = (attrs) => {
25159
+ const decode$O = (attrs) => {
25211
25160
  return attrs.textId;
25212
25161
  };
25213
25162
  const attrConfig$t = Object.freeze({
25214
25163
  xmlName: "w14:textId",
25215
25164
  sdName: "textId",
25216
- encode: encode$V,
25217
- decode: decode$M
25165
+ encode: encode$Y,
25166
+ decode: decode$O
25218
25167
  });
25219
25168
  const validXmlAttributes$j = [
25220
25169
  attrConfig$u,
@@ -25225,9 +25174,9 @@ const validXmlAttributes$j = [
25225
25174
  attrConfig$w,
25226
25175
  attrConfig$z
25227
25176
  ];
25228
- const XML_NODE_NAME$r = "w:p";
25229
- const SD_NODE_NAME$b = "paragraph";
25230
- const encode$U = (params2, encodedAttrs = {}) => {
25177
+ const XML_NODE_NAME$u = "w:p";
25178
+ const SD_NODE_NAME$d = "paragraph";
25179
+ const encode$X = (params2, encodedAttrs = {}) => {
25231
25180
  const node = handleParagraphNode$1(params2);
25232
25181
  if (!node) return void 0;
25233
25182
  if (encodedAttrs && Object.keys(encodedAttrs).length) {
@@ -25235,7 +25184,7 @@ const encode$U = (params2, encodedAttrs = {}) => {
25235
25184
  }
25236
25185
  return node;
25237
25186
  };
25238
- const decode$L = (params2, decodedAttrs = {}) => {
25187
+ const decode$N = (params2, decodedAttrs = {}) => {
25239
25188
  const translated = translateParagraphNode(params2);
25240
25189
  if (!translated) return void 0;
25241
25190
  if (decodedAttrs && Object.keys(decodedAttrs).length) {
@@ -25243,16 +25192,16 @@ const decode$L = (params2, decodedAttrs = {}) => {
25243
25192
  }
25244
25193
  return translated;
25245
25194
  };
25246
- const config$p = {
25247
- xmlName: XML_NODE_NAME$r,
25248
- sdNodeOrKeyName: SD_NODE_NAME$b,
25195
+ const config$s = {
25196
+ xmlName: XML_NODE_NAME$u,
25197
+ sdNodeOrKeyName: SD_NODE_NAME$d,
25249
25198
  type: NodeTranslator.translatorTypes.NODE,
25250
- encode: encode$U,
25251
- decode: decode$L,
25199
+ encode: encode$X,
25200
+ decode: decode$N,
25252
25201
  attributes: validXmlAttributes$j
25253
25202
  };
25254
- const translator$13 = NodeTranslator.from(config$p);
25255
- const encode$T = (attributes) => {
25203
+ const translator$16 = NodeTranslator.from(config$s);
25204
+ const encode$W = (attributes) => {
25256
25205
  const raw = attributes?.["w:val"];
25257
25206
  if (raw === void 0 || raw === null) return void 0;
25258
25207
  if (typeof raw === "boolean") return raw;
@@ -25262,24 +25211,24 @@ const encode$T = (attributes) => {
25262
25211
  if (val === "1" || val === "true" || val === "on") return true;
25263
25212
  return void 0;
25264
25213
  };
25265
- const decode$K = (runProps) => {
25214
+ const decode$M = (runProps) => {
25266
25215
  if (runProps?.bold === false) return "0";
25267
25216
  return void 0;
25268
25217
  };
25269
25218
  const attrConfig$s = Object.freeze({
25270
25219
  xmlName: "w:val",
25271
25220
  sdName: "bold",
25272
- encode: encode$T,
25273
- decode: decode$K
25221
+ encode: encode$W,
25222
+ decode: decode$M
25274
25223
  });
25275
25224
  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 = {}) => {
25225
+ const XML_NODE_NAME$t = "w:b";
25226
+ const SD_ATTR_KEY$f = "bold";
25227
+ const encode$V = (params2, encodedAttrs = {}) => {
25279
25228
  const { nodes } = params2;
25280
25229
  const node = nodes[0];
25281
25230
  if (!node) return void 0;
25282
- const val = encodedAttrs?.[SD_ATTR_KEY$e];
25231
+ const val = encodedAttrs?.[SD_ATTR_KEY$f];
25283
25232
  let attributes;
25284
25233
  if (val === false) attributes = { "w:val": "0" };
25285
25234
  else if (val === true)
@@ -25287,85 +25236,85 @@ const encode$S = (params2, encodedAttrs = {}) => {
25287
25236
  else attributes = node.attributes || {};
25288
25237
  return {
25289
25238
  type: "attr",
25290
- xmlName: XML_NODE_NAME$q,
25291
- sdNodeOrKeyName: SD_ATTR_KEY$e,
25239
+ xmlName: XML_NODE_NAME$t,
25240
+ sdNodeOrKeyName: SD_ATTR_KEY$f,
25292
25241
  attributes
25293
25242
  };
25294
25243
  };
25295
- const config$o = {
25296
- xmlName: XML_NODE_NAME$q,
25297
- sdNodeOrKeyName: SD_ATTR_KEY$e,
25244
+ const config$r = {
25245
+ xmlName: XML_NODE_NAME$t,
25246
+ sdNodeOrKeyName: SD_ATTR_KEY$f,
25298
25247
  type: NodeTranslator.translatorTypes.ATTRIBUTE,
25299
- encode: encode$S,
25248
+ encode: encode$V,
25300
25249
  attributes: validXmlAttributes$i
25301
25250
  };
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) => {
25251
+ const translator$15 = NodeTranslator.from(config$r);
25252
+ const XML_NODE_NAME$s = "w:i";
25253
+ const SD_ATTR_KEY$e = "italic";
25254
+ const encode$U = (params2) => {
25306
25255
  const { nodes } = params2;
25307
25256
  const node = nodes?.[0];
25308
25257
  if (!node) return void 0;
25309
25258
  return {
25310
25259
  type: "attr",
25311
- xmlName: XML_NODE_NAME$p,
25312
- sdNodeOrKeyName: SD_ATTR_KEY$d,
25260
+ xmlName: XML_NODE_NAME$s,
25261
+ sdNodeOrKeyName: SD_ATTR_KEY$e,
25313
25262
  attributes: {
25314
25263
  "w:val": node.attributes?.["w:val"] ?? null
25315
25264
  }
25316
25265
  };
25317
25266
  };
25318
- const config$n = {
25319
- xmlName: XML_NODE_NAME$p,
25320
- sdNodeOrKeyName: SD_ATTR_KEY$d,
25267
+ const config$q = {
25268
+ xmlName: XML_NODE_NAME$s,
25269
+ sdNodeOrKeyName: SD_ATTR_KEY$e,
25321
25270
  type: NodeTranslator.translatorTypes.ATTRIBUTE,
25322
- encode: encode$R
25271
+ encode: encode$U
25323
25272
  };
25324
- const translator$11 = NodeTranslator.from(config$n);
25325
- const encode$Q = (attributes) => attributes?.["w:val"];
25326
- const decode$J = (attrs) => attrs?.underline;
25273
+ const translator$14 = NodeTranslator.from(config$q);
25274
+ const encode$T = (attributes) => attributes?.["w:val"];
25275
+ const decode$L = (attrs) => attrs?.underline;
25327
25276
  const attrConfig$r = Object.freeze({
25328
25277
  xmlName: "w:val",
25329
25278
  sdName: "underline",
25330
- encode: encode$Q,
25331
- decode: decode$J
25279
+ encode: encode$T,
25280
+ decode: decode$L
25332
25281
  });
25333
- const encode$P = (attributes) => attributes?.["w:color"];
25334
- const decode$I = (attrs) => attrs?.color;
25282
+ const encode$S = (attributes) => attributes?.["w:color"];
25283
+ const decode$K = (attrs) => attrs?.color;
25335
25284
  const attrConfig$q = Object.freeze({
25336
25285
  xmlName: "w:color",
25337
25286
  sdName: "color",
25338
- encode: encode$P,
25339
- decode: decode$I
25287
+ encode: encode$S,
25288
+ decode: decode$K
25340
25289
  });
25341
- const encode$O = (attributes) => attributes?.["w:themeColor"];
25342
- const decode$H = (attrs) => attrs?.themeColor;
25290
+ const encode$R = (attributes) => attributes?.["w:themeColor"];
25291
+ const decode$J = (attrs) => attrs?.themeColor;
25343
25292
  const attrConfig$p = Object.freeze({
25344
25293
  xmlName: "w:themeColor",
25345
25294
  sdName: "themeColor",
25346
- encode: encode$O,
25347
- decode: decode$H
25295
+ encode: encode$R,
25296
+ decode: decode$J
25348
25297
  });
25349
- const encode$N = (attributes) => attributes?.["w:themeTint"];
25350
- const decode$G = (attrs) => attrs?.themeTint;
25298
+ const encode$Q = (attributes) => attributes?.["w:themeTint"];
25299
+ const decode$I = (attrs) => attrs?.themeTint;
25351
25300
  const attrConfig$o = Object.freeze({
25352
25301
  xmlName: "w:themeTint",
25353
25302
  sdName: "themeTint",
25354
- encode: encode$N,
25355
- decode: decode$G
25303
+ encode: encode$Q,
25304
+ decode: decode$I
25356
25305
  });
25357
- const encode$M = (attributes) => attributes?.["w:themeShade"];
25358
- const decode$F = (attrs) => attrs?.themeShade;
25306
+ const encode$P = (attributes) => attributes?.["w:themeShade"];
25307
+ const decode$H = (attrs) => attrs?.themeShade;
25359
25308
  const attrConfig$n = Object.freeze({
25360
25309
  xmlName: "w:themeShade",
25361
25310
  sdName: "themeShade",
25362
- encode: encode$M,
25363
- decode: decode$F
25311
+ encode: encode$P,
25312
+ decode: decode$H
25364
25313
  });
25365
25314
  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 = {}) => {
25315
+ const XML_NODE_NAME$r = "w:u";
25316
+ const SD_ATTR_KEY$d = "underline";
25317
+ const encode$O = (params2, encodedAttrs = {}) => {
25369
25318
  const { nodes } = params2;
25370
25319
  const node = nodes?.[0];
25371
25320
  const sourceAttrs = node?.attributes || {};
@@ -25381,12 +25330,12 @@ const encode$L = (params2, encodedAttrs = {}) => {
25381
25330
  if (themeShade !== void 0 && themeShade !== null) attributes["w:themeShade"] = themeShade;
25382
25331
  return {
25383
25332
  type: "attr",
25384
- xmlName: XML_NODE_NAME$o,
25385
- sdNodeOrKeyName: SD_ATTR_KEY$c,
25333
+ xmlName: XML_NODE_NAME$r,
25334
+ sdNodeOrKeyName: SD_ATTR_KEY$d,
25386
25335
  attributes
25387
25336
  };
25388
25337
  };
25389
- const decode$E = (params2) => {
25338
+ const decode$G = (params2) => {
25390
25339
  const attrs = params2?.node?.attrs || {};
25391
25340
  const underlineType = attrs.underlineType ?? attrs.underline ?? null;
25392
25341
  const color = attrs.underlineColor ?? attrs.color ?? null;
@@ -25404,20 +25353,20 @@ const decode$E = (params2) => {
25404
25353
  if (themeTint) attributes["w:themeTint"] = themeTint;
25405
25354
  if (themeShade) attributes["w:themeShade"] = themeShade;
25406
25355
  return {
25407
- name: XML_NODE_NAME$o,
25356
+ name: XML_NODE_NAME$r,
25408
25357
  attributes
25409
25358
  };
25410
25359
  };
25411
- const config$m = {
25412
- xmlName: XML_NODE_NAME$o,
25413
- sdNodeOrKeyName: SD_ATTR_KEY$c,
25360
+ const config$p = {
25361
+ xmlName: XML_NODE_NAME$r,
25362
+ sdNodeOrKeyName: SD_ATTR_KEY$d,
25414
25363
  type: NodeTranslator.translatorTypes.ATTRIBUTE,
25415
- encode: encode$L,
25416
- decode: decode$E,
25364
+ encode: encode$O,
25365
+ decode: decode$G,
25417
25366
  attributes: validXmlAttributes$h
25418
25367
  };
25419
- const translator$10 = NodeTranslator.from(config$m);
25420
- const encode$K = (attributes) => {
25368
+ const translator$13 = NodeTranslator.from(config$p);
25369
+ const encode$N = (attributes) => {
25421
25370
  const raw = attributes?.["w:val"];
25422
25371
  if (raw === void 0 || raw === null) return void 0;
25423
25372
  if (typeof raw === "boolean") return raw;
@@ -25427,24 +25376,24 @@ const encode$K = (attributes) => {
25427
25376
  if (val === "1" || val === "true" || val === "on") return true;
25428
25377
  return void 0;
25429
25378
  };
25430
- const decode$D = (attrs) => {
25379
+ const decode$F = (attrs) => {
25431
25380
  if (attrs?.strike === false) return "0";
25432
25381
  return void 0;
25433
25382
  };
25434
25383
  const attrConfig$m = Object.freeze({
25435
25384
  xmlName: "w:val",
25436
25385
  sdName: "strike",
25437
- encode: encode$K,
25438
- decode: decode$D
25386
+ encode: encode$N,
25387
+ decode: decode$F
25439
25388
  });
25440
25389
  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 = {}) => {
25390
+ const XML_NODE_NAME$q = "w:strike";
25391
+ const SD_ATTR_KEY$c = "strike";
25392
+ const encode$M = (params2, encodedAttrs = {}) => {
25444
25393
  const { nodes } = params2;
25445
25394
  const node = nodes?.[0];
25446
25395
  if (!node) return void 0;
25447
- const val = encodedAttrs?.[SD_ATTR_KEY$b];
25396
+ const val = encodedAttrs?.[SD_ATTR_KEY$c];
25448
25397
  let attributes;
25449
25398
  if (val === false) attributes = { "w:val": "0" };
25450
25399
  else if (val === true) attributes = {};
@@ -25453,55 +25402,55 @@ const encode$J = (params2, encodedAttrs = {}) => {
25453
25402
  else if (val === true && attributes["w:val"] === void 0) delete attributes["w:val"];
25454
25403
  return {
25455
25404
  type: "attr",
25456
- xmlName: XML_NODE_NAME$n,
25457
- sdNodeOrKeyName: SD_ATTR_KEY$b,
25405
+ xmlName: XML_NODE_NAME$q,
25406
+ sdNodeOrKeyName: SD_ATTR_KEY$c,
25458
25407
  attributes
25459
25408
  };
25460
25409
  };
25461
- const config$l = {
25462
- xmlName: XML_NODE_NAME$n,
25463
- sdNodeOrKeyName: SD_ATTR_KEY$b,
25410
+ const config$o = {
25411
+ xmlName: XML_NODE_NAME$q,
25412
+ sdNodeOrKeyName: SD_ATTR_KEY$c,
25464
25413
  type: NodeTranslator.translatorTypes.ATTRIBUTE,
25465
- encode: encode$J,
25414
+ encode: encode$M,
25466
25415
  attributes: validXmlAttributes$g
25467
25416
  };
25468
- const translator$$ = NodeTranslator.from(config$l);
25469
- const encode$I = (attributes) => attributes?.["w:val"];
25470
- const decode$C = (attrs) => attrs?.color;
25417
+ const translator$12 = NodeTranslator.from(config$o);
25418
+ const encode$L = (attributes) => attributes?.["w:val"];
25419
+ const decode$E = (attrs) => attrs?.color;
25471
25420
  const attrConfig$l = Object.freeze({
25472
25421
  xmlName: "w:val",
25473
25422
  sdName: "color",
25474
- encode: encode$I,
25475
- decode: decode$C
25423
+ encode: encode$L,
25424
+ decode: decode$E
25476
25425
  });
25477
- const encode$H = (attributes) => attributes?.["w:themeColor"];
25478
- const decode$B = (attrs) => attrs?.themeColor;
25426
+ const encode$K = (attributes) => attributes?.["w:themeColor"];
25427
+ const decode$D = (attrs) => attrs?.themeColor;
25479
25428
  const attrConfig$k = Object.freeze({
25480
25429
  xmlName: "w:themeColor",
25481
25430
  sdName: "themeColor",
25482
- encode: encode$H,
25483
- decode: decode$B
25431
+ encode: encode$K,
25432
+ decode: decode$D
25484
25433
  });
25485
- const encode$G = (attributes) => attributes?.["w:themeTint"];
25486
- const decode$A = (attrs) => attrs?.themeTint;
25434
+ const encode$J = (attributes) => attributes?.["w:themeTint"];
25435
+ const decode$C = (attrs) => attrs?.themeTint;
25487
25436
  const attrConfig$j = Object.freeze({
25488
25437
  xmlName: "w:themeTint",
25489
25438
  sdName: "themeTint",
25490
- encode: encode$G,
25491
- decode: decode$A
25439
+ encode: encode$J,
25440
+ decode: decode$C
25492
25441
  });
25493
- const encode$F = (attributes) => attributes?.["w:themeShade"];
25494
- const decode$z = (attrs) => attrs?.themeShade;
25442
+ const encode$I = (attributes) => attributes?.["w:themeShade"];
25443
+ const decode$B = (attrs) => attrs?.themeShade;
25495
25444
  const attrConfig$i = Object.freeze({
25496
25445
  xmlName: "w:themeShade",
25497
25446
  sdName: "themeShade",
25498
- encode: encode$F,
25499
- decode: decode$z
25447
+ encode: encode$I,
25448
+ decode: decode$B
25500
25449
  });
25501
25450
  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 = {}) => {
25451
+ const XML_NODE_NAME$p = "w:color";
25452
+ const SD_ATTR_KEY$b = "color";
25453
+ const encode$H = (params2, encodedAttrs = {}) => {
25505
25454
  const { nodes } = params2;
25506
25455
  const node = nodes?.[0];
25507
25456
  const sourceAttrs = node?.attributes || {};
@@ -25516,63 +25465,63 @@ const encode$E = (params2, encodedAttrs = {}) => {
25516
25465
  if (themeShade !== void 0 && themeShade !== null) attributes["w:themeShade"] = themeShade;
25517
25466
  return {
25518
25467
  type: "attr",
25519
- xmlName: XML_NODE_NAME$m,
25520
- sdNodeOrKeyName: SD_ATTR_KEY$a,
25468
+ xmlName: XML_NODE_NAME$p,
25469
+ sdNodeOrKeyName: SD_ATTR_KEY$b,
25521
25470
  attributes
25522
25471
  };
25523
25472
  };
25524
- const config$k = {
25525
- xmlName: XML_NODE_NAME$m,
25526
- sdNodeOrKeyName: SD_ATTR_KEY$a,
25473
+ const config$n = {
25474
+ xmlName: XML_NODE_NAME$p,
25475
+ sdNodeOrKeyName: SD_ATTR_KEY$b,
25527
25476
  type: NodeTranslator.translatorTypes.ATTRIBUTE,
25528
- encode: encode$E,
25477
+ encode: encode$H,
25529
25478
  attributes: validXmlAttributes$f
25530
25479
  };
25531
- const translator$_ = NodeTranslator.from(config$k);
25532
- const encode$D = (attributes) => attributes?.["w:eastAsia"];
25533
- const decode$y = (attrs) => attrs?.eastAsia;
25480
+ const translator$11 = NodeTranslator.from(config$n);
25481
+ const encode$G = (attributes) => attributes?.["w:eastAsia"];
25482
+ const decode$A = (attrs) => attrs?.eastAsia;
25534
25483
  const attrConfig$h = Object.freeze({
25535
25484
  xmlName: "w:eastAsia",
25536
25485
  sdName: "eastAsia",
25537
- encode: encode$D,
25538
- decode: decode$y
25486
+ encode: encode$G,
25487
+ decode: decode$A
25539
25488
  });
25540
- const encode$C = (attributes) => attributes?.["w:ascii"];
25541
- const decode$x = (attrs) => attrs?.ascii;
25489
+ const encode$F = (attributes) => attributes?.["w:ascii"];
25490
+ const decode$z = (attrs) => attrs?.ascii;
25542
25491
  const attrConfig$g = Object.freeze({
25543
25492
  xmlName: "w:ascii",
25544
25493
  sdName: "ascii",
25545
- encode: encode$C,
25546
- decode: decode$x
25494
+ encode: encode$F,
25495
+ decode: decode$z
25547
25496
  });
25548
- const encode$B = (attributes) => attributes?.["w:hAnsi"];
25549
- const decode$w = (attrs) => attrs?.hAnsi;
25497
+ const encode$E = (attributes) => attributes?.["w:hAnsi"];
25498
+ const decode$y = (attrs) => attrs?.hAnsi;
25550
25499
  const attrConfig$f = Object.freeze({
25551
25500
  xmlName: "w:hAnsi",
25552
25501
  sdName: "hAnsi",
25553
- encode: encode$B,
25554
- decode: decode$w
25502
+ encode: encode$E,
25503
+ decode: decode$y
25555
25504
  });
25556
- const encode$A = (attributes) => attributes?.["w:cs"];
25557
- const decode$v = (attrs) => attrs?.cs;
25505
+ const encode$D = (attributes) => attributes?.["w:cs"];
25506
+ const decode$x = (attrs) => attrs?.cs;
25558
25507
  const attrConfig$e = Object.freeze({
25559
25508
  xmlName: "w:cs",
25560
25509
  sdName: "cs",
25561
- encode: encode$A,
25562
- decode: decode$v
25510
+ encode: encode$D,
25511
+ decode: decode$x
25563
25512
  });
25564
- const encode$z = (attributes) => attributes?.["w:val"];
25565
- const decode$u = (attrs) => attrs?.value;
25513
+ const encode$C = (attributes) => attributes?.["w:val"];
25514
+ const decode$w = (attrs) => attrs?.value;
25566
25515
  const attrConfig$d = Object.freeze({
25567
25516
  xmlName: "w:val",
25568
25517
  sdName: "value",
25569
- encode: encode$z,
25570
- decode: decode$u
25518
+ encode: encode$C,
25519
+ decode: decode$w
25571
25520
  });
25572
25521
  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 = {}) => {
25522
+ const XML_NODE_NAME$o = "w:rFonts";
25523
+ const SD_ATTR_KEY$a = "fontFamily";
25524
+ const encode$B = (params2, encodedAttrs = {}) => {
25576
25525
  const { nodes } = params2;
25577
25526
  const node = nodes?.[0];
25578
25527
  const sourceAttrs = node?.attributes || {};
@@ -25598,120 +25547,281 @@ const encode$y = (params2, encodedAttrs = {}) => {
25598
25547
  if (attributes["w:val"] === void 0) delete attributes["w:val"];
25599
25548
  return {
25600
25549
  type: "attr",
25601
- xmlName: XML_NODE_NAME$l,
25602
- sdNodeOrKeyName: SD_ATTR_KEY$9,
25550
+ xmlName: XML_NODE_NAME$o,
25551
+ sdNodeOrKeyName: SD_ATTR_KEY$a,
25603
25552
  attributes
25604
25553
  };
25605
25554
  };
25606
- const config$j = {
25607
- xmlName: XML_NODE_NAME$l,
25608
- sdNodeOrKeyName: SD_ATTR_KEY$9,
25555
+ const config$m = {
25556
+ xmlName: XML_NODE_NAME$o,
25557
+ sdNodeOrKeyName: SD_ATTR_KEY$a,
25609
25558
  type: NodeTranslator.translatorTypes.ATTRIBUTE,
25610
- encode: encode$y,
25559
+ encode: encode$B,
25611
25560
  attributes: validXmlAttributes$e
25612
25561
  };
25613
- const translator$Z = NodeTranslator.from(config$j);
25614
- const encode$x = (attributes) => attributes?.["w:val"];
25615
- const decode$t = (attrs) => attrs?.styleId;
25562
+ const translator$10 = NodeTranslator.from(config$m);
25563
+ const encode$A = (attributes) => attributes?.["w:val"];
25564
+ const decode$v = (attrs) => attrs?.styleId;
25616
25565
  const attrConfig$c = Object.freeze({
25617
25566
  xmlName: "w:val",
25618
25567
  sdName: "styleId",
25619
- encode: encode$x,
25620
- decode: decode$t
25568
+ encode: encode$A,
25569
+ decode: decode$v
25621
25570
  });
25622
25571
  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 = {}) => {
25572
+ const XML_NODE_NAME$n = "w:rStyle";
25573
+ const SD_ATTR_KEY$9 = "styleId";
25574
+ const encode$z = (params2, encodedAttrs = {}) => {
25626
25575
  const { nodes } = params2;
25627
25576
  const node = nodes?.[0];
25628
25577
  const value = encodedAttrs.styleId ?? node?.attributes?.["w:val"];
25629
25578
  return {
25630
25579
  type: "attr",
25631
- xmlName: XML_NODE_NAME$k,
25632
- sdNodeOrKeyName: SD_ATTR_KEY$8,
25580
+ xmlName: XML_NODE_NAME$n,
25581
+ sdNodeOrKeyName: SD_ATTR_KEY$9,
25633
25582
  attributes: { "w:val": value ?? null }
25634
25583
  };
25635
25584
  };
25636
- const config$i = {
25637
- xmlName: XML_NODE_NAME$k,
25638
- sdNodeOrKeyName: SD_ATTR_KEY$8,
25585
+ const config$l = {
25586
+ xmlName: XML_NODE_NAME$n,
25587
+ sdNodeOrKeyName: SD_ATTR_KEY$9,
25639
25588
  type: NodeTranslator.translatorTypes.ATTRIBUTE,
25640
- encode: encode$w,
25589
+ encode: encode$z,
25641
25590
  attributes: validXmlAttributes$d
25642
25591
  };
25643
- const translator$Y = NodeTranslator.from(config$i);
25644
- const encode$v = (attributes) => attributes?.["w:val"];
25645
- const decode$s = (attrs) => attrs?.fontSize;
25592
+ const translator$$ = NodeTranslator.from(config$l);
25593
+ const encode$y = (attributes) => attributes?.["w:val"];
25594
+ const decode$u = (attrs) => attrs?.fontSize;
25646
25595
  const attrConfig$b = Object.freeze({
25647
25596
  xmlName: "w:val",
25648
25597
  sdName: "fontSize",
25649
- encode: encode$v,
25650
- decode: decode$s
25598
+ encode: encode$y,
25599
+ decode: decode$u
25651
25600
  });
25652
25601
  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 = {}) => {
25602
+ const XML_NODE_NAME$m = "w:sz";
25603
+ const SD_ATTR_KEY$8 = "fontSize";
25604
+ const encode$x = (params2, encodedAttrs = {}) => {
25656
25605
  const { nodes } = params2;
25657
25606
  const node = nodes?.[0];
25658
25607
  const value = encodedAttrs.fontSize ?? node?.attributes?.["w:val"];
25659
25608
  return {
25660
25609
  type: "attr",
25661
- xmlName: XML_NODE_NAME$j,
25662
- sdNodeOrKeyName: SD_ATTR_KEY$7,
25610
+ xmlName: XML_NODE_NAME$m,
25611
+ sdNodeOrKeyName: SD_ATTR_KEY$8,
25663
25612
  attributes: { "w:val": value ?? null }
25664
25613
  };
25665
25614
  };
25666
- const config$h = {
25667
- xmlName: XML_NODE_NAME$j,
25668
- sdNodeOrKeyName: SD_ATTR_KEY$7,
25615
+ const config$k = {
25616
+ xmlName: XML_NODE_NAME$m,
25617
+ sdNodeOrKeyName: SD_ATTR_KEY$8,
25669
25618
  type: NodeTranslator.translatorTypes.ATTRIBUTE,
25670
- encode: encode$u,
25619
+ encode: encode$x,
25671
25620
  attributes: validXmlAttributes$c
25672
25621
  };
25673
- const translator$X = NodeTranslator.from(config$h);
25674
- const encode$t = (attributes) => attributes?.["w:val"];
25675
- const decode$r = (attrs) => attrs?.fontSizeCs;
25622
+ const translator$_ = NodeTranslator.from(config$k);
25623
+ const encode$w = (attributes) => attributes?.["w:val"];
25624
+ const decode$t = (attrs) => attrs?.fontSizeCs;
25676
25625
  const attrConfig$a = Object.freeze({
25677
25626
  xmlName: "w:val",
25678
25627
  sdName: "fontSizeCs",
25679
- encode: encode$t,
25680
- decode: decode$r
25628
+ encode: encode$w,
25629
+ decode: decode$t
25681
25630
  });
25682
25631
  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 = {}) => {
25632
+ const XML_NODE_NAME$l = "w:szCs";
25633
+ const SD_ATTR_KEY$7 = "fontSizeCs";
25634
+ const encode$v = (params2, encodedAttrs = {}) => {
25686
25635
  const { nodes } = params2;
25687
25636
  const node = nodes?.[0];
25688
25637
  const value = encodedAttrs.fontSizeCs ?? node?.attributes?.["w:val"];
25689
25638
  return {
25690
25639
  type: "attr",
25691
- xmlName: XML_NODE_NAME$i,
25692
- sdNodeOrKeyName: SD_ATTR_KEY$6,
25640
+ xmlName: XML_NODE_NAME$l,
25641
+ sdNodeOrKeyName: SD_ATTR_KEY$7,
25693
25642
  attributes: { "w:val": value ?? null }
25694
25643
  };
25695
25644
  };
25696
- const config$g = {
25697
- xmlName: XML_NODE_NAME$i,
25698
- sdNodeOrKeyName: SD_ATTR_KEY$6,
25645
+ const config$j = {
25646
+ xmlName: XML_NODE_NAME$l,
25647
+ sdNodeOrKeyName: SD_ATTR_KEY$7,
25699
25648
  type: NodeTranslator.translatorTypes.ATTRIBUTE,
25700
- encode: encode$s,
25649
+ encode: encode$v,
25701
25650
  attributes: validXmlAttributes$b
25702
25651
  };
25703
- const translator$W = NodeTranslator.from(config$g);
25652
+ const translator$Z = NodeTranslator.from(config$j);
25653
+ const generateV2HandlerEntity = (handlerName, translator2) => ({
25654
+ handlerName,
25655
+ handler: (params2) => {
25656
+ const { nodes } = params2;
25657
+ if (nodes.length === 0 || nodes[0].name !== translator2.xmlName) {
25658
+ return { nodes: [], consumed: 0 };
25659
+ }
25660
+ const result = translator2.encode(params2);
25661
+ if (!result) return { nodes: [], consumed: 0 };
25662
+ return {
25663
+ nodes: Array.isArray(result) ? result : [result],
25664
+ consumed: 1
25665
+ };
25666
+ }
25667
+ });
25668
+ function createSingleAttrPropertyHandler(xmlName, sdName = null, attrName = "w:val", transformEncode = null, transformDecode = null) {
25669
+ if (!sdName) sdName = xmlName.split(":")[1];
25670
+ if (!transformEncode) transformEncode = (v2) => v2;
25671
+ if (!transformDecode) transformDecode = (v2) => v2;
25672
+ return {
25673
+ xmlName,
25674
+ sdNodeOrKeyName: sdName,
25675
+ encode: ({ nodes }) => {
25676
+ return transformEncode(nodes[0].attributes[attrName]) ?? void 0;
25677
+ },
25678
+ decode: ({ node }) => {
25679
+ const value = node.attrs?.[sdName] != null ? transformDecode(node.attrs[sdName]) : void 0;
25680
+ return value != null ? { name: xmlName, attributes: { [attrName]: value } } : void 0;
25681
+ }
25682
+ };
25683
+ }
25684
+ function createMeasurementPropertyHandler(xmlName, sdName = null) {
25685
+ if (!sdName) sdName = xmlName.split(":")[1];
25686
+ return {
25687
+ xmlName,
25688
+ sdNodeOrKeyName: sdName,
25689
+ attributes: [
25690
+ createAttributeHandler("w:w", "value", parseInteger, integerToString),
25691
+ createAttributeHandler("w:type")
25692
+ ],
25693
+ encode: (_2, encodedAttrs) => {
25694
+ return encodedAttrs["value"] != null ? encodedAttrs : void 0;
25695
+ },
25696
+ decode: function({ node }) {
25697
+ const decodedAttrs = this.decodeAttributes({ node: { ...node, attrs: node.attrs[sdName] || {} } });
25698
+ return decodedAttrs["w:w"] != null ? { attributes: decodedAttrs } : void 0;
25699
+ }
25700
+ };
25701
+ }
25702
+ function createBorderPropertyHandler(xmlName, sdName = null) {
25703
+ if (!sdName) sdName = xmlName.split(":")[1];
25704
+ return {
25705
+ xmlName,
25706
+ sdNodeOrKeyName: sdName,
25707
+ attributes: [
25708
+ createAttributeHandler("w:val"),
25709
+ createAttributeHandler("w:color"),
25710
+ createAttributeHandler("w:themeColor"),
25711
+ createAttributeHandler("w:themeTint"),
25712
+ createAttributeHandler("w:themeShade"),
25713
+ createAttributeHandler("w:sz", "size", parseInteger, integerToString),
25714
+ createAttributeHandler("w:space", null, parseInteger, integerToString),
25715
+ createAttributeHandler("w:shadow", null, parseBoolean, booleanToString),
25716
+ createAttributeHandler("w:frame", null, parseBoolean, booleanToString)
25717
+ ],
25718
+ encode: (params2, encodedAttrs) => {
25719
+ return Object.keys(encodedAttrs).length > 0 ? encodedAttrs : void 0;
25720
+ },
25721
+ decode: function({ node }, context) {
25722
+ const decodedAttrs = this.decodeAttributes({ node: { ...node, attrs: node.attrs[sdName] || {} } });
25723
+ return Object.keys(decodedAttrs).length > 0 ? { attributes: decodedAttrs } : void 0;
25724
+ }
25725
+ };
25726
+ }
25727
+ const createAttributeHandler = (xmlName, sdName = null, transformEncode = null, transformDecode = null) => {
25728
+ if (!transformEncode) transformEncode = (v2) => v2;
25729
+ if (!transformDecode) transformDecode = (v2) => v2;
25730
+ if (!sdName) sdName = xmlName.split(":")[1];
25731
+ return {
25732
+ xmlName,
25733
+ sdName,
25734
+ encode: (attributes) => transformEncode(attributes[xmlName]),
25735
+ decode: (attributes) => transformDecode(attributes[sdName])
25736
+ };
25737
+ };
25738
+ function encodeProperties(node, translatorsByXmlName, asArray = false) {
25739
+ if (!node?.elements || node.elements.length === 0) {
25740
+ return asArray ? [] : {};
25741
+ }
25742
+ const attributes = asArray ? [] : {};
25743
+ node.elements.forEach((el) => {
25744
+ const translator2 = translatorsByXmlName[el.name];
25745
+ if (translator2) {
25746
+ const encodedAttr = translator2.encode({ nodes: [el] });
25747
+ if (encodedAttr != null) {
25748
+ if (asArray) {
25749
+ attributes.push({ [translator2.sdNodeOrKeyName]: encodedAttr });
25750
+ } else {
25751
+ attributes[translator2.sdNodeOrKeyName] = encodedAttr;
25752
+ }
25753
+ }
25754
+ }
25755
+ });
25756
+ return attributes;
25757
+ }
25758
+ function decodeProperties(translatorsBySdName, properties) {
25759
+ if (!properties || typeof properties !== "object") {
25760
+ return [];
25761
+ }
25762
+ const elements = [];
25763
+ Object.keys(properties).forEach((key2) => {
25764
+ const translator2 = translatorsBySdName[key2];
25765
+ if (translator2) {
25766
+ const result = translator2.decode({ node: { attrs: { [key2]: properties[key2] } } });
25767
+ if (result != null) {
25768
+ result.name = translator2.xmlName;
25769
+ elements.push(result);
25770
+ }
25771
+ }
25772
+ });
25773
+ return elements;
25774
+ }
25775
+ const parseBoolean = (value) => value != null ? ["1", "true"].includes(value) : void 0;
25776
+ const booleanToString = (value) => value != null ? value ? "1" : "0" : void 0;
25777
+ const parseInteger = (value) => {
25778
+ if (value == null) return void 0;
25779
+ const intValue = parseInt(value, 10);
25780
+ return isNaN(intValue) ? void 0 : intValue;
25781
+ };
25782
+ const integerToString = (value) => {
25783
+ const intValue = parseInteger(value);
25784
+ return intValue != void 0 ? String(intValue) : void 0;
25785
+ };
25786
+ const XML_NODE_NAME$k = "w:caps";
25787
+ const SD_ATTR_KEY$6 = "textTransform";
25788
+ const encode$u = (params2, encodedAttrs = {}) => {
25789
+ const { nodes } = params2;
25790
+ const node = nodes[0];
25791
+ if (!node) return void 0;
25792
+ let result;
25793
+ if (!["false", "0"].includes(encodedAttrs.val)) {
25794
+ result = "uppercase";
25795
+ } else {
25796
+ return void 0;
25797
+ }
25798
+ return {
25799
+ type: "attr",
25800
+ xmlName: XML_NODE_NAME$k,
25801
+ sdNodeOrKeyName: SD_ATTR_KEY$6,
25802
+ attributes: { [SD_ATTR_KEY$6]: result }
25803
+ };
25804
+ };
25805
+ const config$i = {
25806
+ xmlName: XML_NODE_NAME$k,
25807
+ sdNodeOrKeyName: SD_ATTR_KEY$6,
25808
+ type: NodeTranslator.translatorTypes.ATTRIBUTE,
25809
+ encode: encode$u,
25810
+ attributes: [createAttributeHandler("w:val")]
25811
+ };
25812
+ const translator$Y = NodeTranslator.from(config$i);
25704
25813
  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
25814
+ "w:b": translator$15,
25815
+ "w:i": translator$14,
25816
+ "w:u": translator$13,
25817
+ "w:strike": translator$12,
25818
+ "w:color": translator$11,
25819
+ "w:highlight": translator$18,
25820
+ "w:rFonts": translator$10,
25821
+ "w:rStyle": translator$$,
25822
+ "w:sz": translator$_,
25823
+ "w:szCs": translator$Z,
25824
+ "w:caps": translator$Y
25715
25825
  });
25716
25826
  const rawRunPropertyXmlNames = Object.freeze(["w:lang", "w:shd"]);
25717
25827
  const RAW_CHILD_NAME_SET = new Set(rawRunPropertyXmlNames);
@@ -25725,9 +25835,9 @@ const toRunPropertyEntry = (candidate) => {
25725
25835
  attributes: { ...candidate.attributes || {} }
25726
25836
  };
25727
25837
  };
25728
- const XML_NODE_NAME$h = "w:rPr";
25838
+ const XML_NODE_NAME$j = "w:rPr";
25729
25839
  const SD_ATTR_KEY$5 = "runProperties";
25730
- const encode$r = (params2) => {
25840
+ const encode$t = (params2) => {
25731
25841
  const { nodes } = params2;
25732
25842
  const node = nodes?.[0] || {};
25733
25843
  const contents = Array.isArray(node.elements) ? node.elements : [];
@@ -25761,16 +25871,16 @@ const encode$r = (params2) => {
25761
25871
  attributes: runPropsArray
25762
25872
  };
25763
25873
  };
25764
- const config$f = {
25765
- xmlName: XML_NODE_NAME$h,
25874
+ const config$h = {
25875
+ xmlName: XML_NODE_NAME$j,
25766
25876
  sdNodeOrKeyName: SD_ATTR_KEY$5,
25767
25877
  type: NodeTranslator.translatorTypes.ATTRIBUTE,
25768
- encode: encode$r
25878
+ encode: encode$t
25769
25879
  };
25770
- const translator$V = NodeTranslator.from(config$f);
25880
+ const translator$X = NodeTranslator.from(config$h);
25771
25881
  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
25882
  const containsEastAsianCharacters = (text) => EAST_ASIAN_CHARACTER_REGEX.test(text);
25773
- const collectRunProperties = (params2, rPrNode, translator2 = translator$V) => {
25883
+ const collectRunProperties = (params2, rPrNode, translator2 = translator$X) => {
25774
25884
  if (!rPrNode) return { entries: [], hadRPr: false, styleChangeMarks: [] };
25775
25885
  const result = translator2.encode({ ...params2, nodes: [rPrNode] }) || {};
25776
25886
  let entries = [];
@@ -25839,7 +25949,10 @@ const applyRunMarks = (node, inlineMarks, textStyleAttrs) => {
25839
25949
  };
25840
25950
  const deriveStyleMarks = ({ docx, paragraphStyleId, runStyleId }) => {
25841
25951
  const paragraphStyleMarks = collectStyleMarks(paragraphStyleId, docx);
25842
- const runStyleMarks = collectStyleMarks(runStyleId, docx);
25952
+ if (paragraphStyleId?.startsWith("TOC")) {
25953
+ return paragraphStyleMarks;
25954
+ }
25955
+ let runStyleMarks = collectStyleMarks(runStyleId, docx);
25843
25956
  const inlineMarks = mergeInlineMarkSets(paragraphStyleMarks.inlineMarks, runStyleMarks.inlineMarks);
25844
25957
  const textStyleAttrs = mergeTextStyleAttrs(paragraphStyleMarks.textStyleAttrs, runStyleMarks.textStyleAttrs);
25845
25958
  return { inlineMarks, textStyleAttrs };
@@ -26065,6 +26178,13 @@ const splitRunProperties = (entries = [], docx = null) => {
26065
26178
  }
26066
26179
  break;
26067
26180
  }
26181
+ case "w:caps": {
26182
+ if (attributes["textTransform"] != null) {
26183
+ hasTextStyle = true;
26184
+ textStyleAttrs.textTransform = attributes["textTransform"];
26185
+ }
26186
+ break;
26187
+ }
26068
26188
  case "w:rFonts": {
26069
26189
  const asciiFamily = attributes["w:ascii"] || attributes["w:hAnsi"] || (attributes["w:eastAsia"] ? void 0 : attributes["w:val"]);
26070
26190
  const eastAsiaFamily = attributes["w:eastAsia"];
@@ -26084,9 +26204,10 @@ const splitRunProperties = (entries = [], docx = null) => {
26084
26204
  case "w:sz":
26085
26205
  case "w:szCs": {
26086
26206
  const rawSize = Number(attributes["w:val"]);
26207
+ const attrName = entry.xmlName === "w:sz" ? "fontSize" : "fontSizeCs";
26087
26208
  if (Number.isFinite(rawSize) && rawSize > 0) {
26088
26209
  hasTextStyle = true;
26089
- textStyleAttrs.fontSize = `${rawSize / 2}pt`;
26210
+ textStyleAttrs[attrName] = `${rawSize / 2}pt`;
26090
26211
  }
26091
26212
  break;
26092
26213
  }
@@ -26232,46 +26353,166 @@ const ensureTrackedWrapper = (runs, trackingMarksByType = /* @__PURE__ */ new Ma
26232
26353
  }
26233
26354
  return runs;
26234
26355
  };
26235
- const encode$q = (attributes) => {
26356
+ const XML_NODE_NAME$i = "w:hyperlink";
26357
+ const SD_NODE_NAME$c = "link";
26358
+ const _createAttributeHandler = (xmlName, sdName) => ({
26359
+ xmlName,
26360
+ sdName,
26361
+ encode: (attributes) => attributes[xmlName],
26362
+ decode: (attributes) => attributes[sdName]
26363
+ });
26364
+ const validXmlAttributes$a = [
26365
+ _createAttributeHandler("w:anchor", "anchor"),
26366
+ _createAttributeHandler("w:docLocation", "docLocation"),
26367
+ {
26368
+ xmlName: "w:history",
26369
+ sdName: "history",
26370
+ encode: (attributes) => attributes["w:history"] === "1" || attributes["w:history"] === "true",
26371
+ decode: (attributes) => attributes["history"] ? "1" : "0"
26372
+ },
26373
+ _createAttributeHandler("w:tooltip", "tooltip"),
26374
+ _createAttributeHandler("r:id", "rId"),
26375
+ _createAttributeHandler("w:tgtFrame", "target")
26376
+ ];
26377
+ const encode$s = (params2, encodedAttrs) => {
26378
+ const { nodes, docx, nodeListHandler } = params2;
26379
+ const node = nodes[0];
26380
+ let href = _resolveHref(docx, encodedAttrs);
26381
+ const linkMark = { type: "link", attrs: { ...encodedAttrs, href } };
26382
+ const referenceNodeTypes = ["sd:pageReference", "sd:autoPageNumber", "sd:totalPageNumber"];
26383
+ const contentNodes = node.elements.filter((el) => el.name === "w:r" || referenceNodeTypes.includes(el.name));
26384
+ contentNodes.forEach((contentNode) => {
26385
+ const existingMarks = Array.isArray(contentNode.marks) ? contentNode.marks : [];
26386
+ const marksWithoutLink = existingMarks.filter((mark) => mark?.type !== "link");
26387
+ contentNode.marks = [...marksWithoutLink, linkMark];
26388
+ });
26389
+ const updatedNode = nodeListHandler.handler({
26390
+ ...params2,
26391
+ nodes: contentNodes,
26392
+ path: [...params2.path || [], node]
26393
+ });
26394
+ return updatedNode;
26395
+ };
26396
+ const _resolveHref = (docx, encodedAttrs) => {
26397
+ const rels = docx["word/_rels/document.xml.rels"];
26398
+ const relationships = rels.elements.find((el) => el.name === "Relationships");
26399
+ const { elements } = relationships;
26400
+ const { rId, anchor } = encodedAttrs;
26401
+ let href;
26402
+ if (!rId && anchor) {
26403
+ href = `#${anchor}`;
26404
+ } else if (rId) {
26405
+ const rel = elements.find((el) => el.attributes["Id"] === rId) || {};
26406
+ const { attributes: relAttributes = {} } = rel;
26407
+ href = relAttributes["Target"];
26408
+ }
26409
+ return href;
26410
+ };
26411
+ function decode$s(params2) {
26412
+ const { hyperlinkGroup = [params2.node] } = params2.extraParams || {};
26413
+ const node = hyperlinkGroup[0];
26414
+ const linkMark = node.marks.find((m2) => m2.type === "link");
26415
+ const linkAttrs = this.decodeAttributes({ ...params2, node: linkMark });
26416
+ let { anchor, href: link } = linkMark.attrs;
26417
+ const isExternalLink = !anchor;
26418
+ if (isExternalLink) {
26419
+ linkAttrs["r:id"] = _addNewLinkRelationship(params2, link, linkAttrs["r:id"]);
26420
+ }
26421
+ let contentNodes = [];
26422
+ hyperlinkGroup.forEach((linkNode) => {
26423
+ if ("marks" in linkNode) {
26424
+ linkNode.marks = linkNode.marks.filter((m2) => m2.type !== "link");
26425
+ } else {
26426
+ linkNode.attrs.marksAsAttrs = linkNode.attrs.marksAsAttrs.filter((m2) => m2.type !== "link");
26427
+ }
26428
+ const outputNode = exportSchemaToJson({ ...params2, node: linkNode });
26429
+ if (outputNode) {
26430
+ if (outputNode instanceof Array) contentNodes.push(...outputNode);
26431
+ else contentNodes.push(outputNode);
26432
+ }
26433
+ });
26434
+ const newNode = {
26435
+ name: "w:hyperlink",
26436
+ type: "element",
26437
+ attributes: {
26438
+ ...linkAttrs
26439
+ },
26440
+ elements: contentNodes
26441
+ };
26442
+ return newNode;
26443
+ }
26444
+ function _addNewLinkRelationship(params2, link, rId) {
26445
+ if (!rId) rId = generateDocxRandomId();
26446
+ if (!params2.relationships || !Array.isArray(params2.relationships)) {
26447
+ params2.relationships = [];
26448
+ }
26449
+ const existingRel = params2.relationships.find(
26450
+ (rel) => rel.attributes && rel.attributes.Id === rId && rel.attributes.Target === link
26451
+ );
26452
+ if (existingRel) {
26453
+ return rId;
26454
+ }
26455
+ params2.relationships.push({
26456
+ type: "element",
26457
+ name: "Relationship",
26458
+ attributes: {
26459
+ Id: rId,
26460
+ Type: "http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink",
26461
+ Target: link,
26462
+ TargetMode: "External"
26463
+ }
26464
+ });
26465
+ return rId;
26466
+ }
26467
+ const config$g = {
26468
+ xmlName: XML_NODE_NAME$i,
26469
+ sdNodeOrKeyName: SD_NODE_NAME$c,
26470
+ type: NodeTranslator.translatorTypes.NODE,
26471
+ encode: encode$s,
26472
+ decode: decode$s,
26473
+ attributes: validXmlAttributes$a
26474
+ };
26475
+ const translator$W = NodeTranslator.from(config$g);
26476
+ const encode$r = (attributes) => {
26236
26477
  return attributes["w:rsidR"];
26237
26478
  };
26238
- const decode$q = (attrs) => {
26479
+ const decode$r = (attrs) => {
26239
26480
  return attrs.rsidR;
26240
26481
  };
26241
26482
  const attrConfig$9 = Object.freeze({
26242
26483
  xmlName: "w:rsidR",
26243
26484
  sdName: "rsidR",
26244
- encode: encode$q,
26245
- decode: decode$q
26485
+ encode: encode$r,
26486
+ decode: decode$r
26246
26487
  });
26247
- const encode$p = (attributes) => {
26488
+ const encode$q = (attributes) => {
26248
26489
  return attributes["w:rsidRPr"];
26249
26490
  };
26250
- const decode$p = (attrs) => {
26491
+ const decode$q = (attrs) => {
26251
26492
  return attrs.rsidRPr;
26252
26493
  };
26253
26494
  const attrConfig$8 = Object.freeze({
26254
26495
  xmlName: "w:rsidRPr",
26255
26496
  sdName: "rsidRPr",
26256
- encode: encode$p,
26257
- decode: decode$p
26497
+ encode: encode$q,
26498
+ decode: decode$q
26258
26499
  });
26259
- const encode$o = (attributes) => {
26500
+ const encode$p = (attributes) => {
26260
26501
  return attributes["w:rsidDel"];
26261
26502
  };
26262
- const decode$o = (attrs) => {
26503
+ const decode$p = (attrs) => {
26263
26504
  return attrs.rsidDel;
26264
26505
  };
26265
26506
  const attrConfig$7 = Object.freeze({
26266
26507
  xmlName: "w:rsidDel",
26267
26508
  sdName: "rsidDel",
26268
- encode: encode$o,
26269
- decode: decode$o
26509
+ encode: encode$p,
26510
+ decode: decode$p
26270
26511
  });
26271
- const validXmlAttributes$a = [attrConfig$9, attrConfig$8, attrConfig$7];
26272
- const XML_NODE_NAME$g = "w:r";
26512
+ const validXmlAttributes$9 = [attrConfig$9, attrConfig$8, attrConfig$7];
26513
+ const XML_NODE_NAME$h = "w:r";
26273
26514
  const SD_KEY_NAME = "run";
26274
- const encode$n = (params2, encodedAttrs = {}) => {
26515
+ const encode$o = (params2, encodedAttrs = {}) => {
26275
26516
  const { nodes = [], nodeListHandler } = params2 || {};
26276
26517
  const runNode = nodes[0];
26277
26518
  if (!runNode) return void 0;
@@ -26319,9 +26560,11 @@ const encode$n = (params2, encodedAttrs = {}) => {
26319
26560
  }
26320
26561
  return runNodeResult;
26321
26562
  };
26322
- const decode$n = (params2, decodedAttrs = {}) => {
26563
+ const decode$o = (params2, decodedAttrs = {}) => {
26323
26564
  const { node } = params2 || {};
26324
26565
  if (!node) return void 0;
26566
+ const isLinkNode = node.marks?.some((m2) => m2.type === "link");
26567
+ if (isLinkNode) return translator$W.decode(params2);
26325
26568
  const { runNode: runNodeForExport, trackingMarksByType } = prepareRunTrackingContext(node);
26326
26569
  const runAttrs = runNodeForExport.attrs || {};
26327
26570
  const runProperties = Array.isArray(runAttrs.runProperties) ? runAttrs.runProperties : [];
@@ -26376,7 +26619,7 @@ const decode$n = (params2, decodedAttrs = {}) => {
26376
26619
  runs.push(trackedClone);
26377
26620
  return;
26378
26621
  }
26379
- const runWrapper = { name: XML_NODE_NAME$g, elements: [] };
26622
+ const runWrapper = { name: XML_NODE_NAME$h, elements: [] };
26380
26623
  applyBaseRunProps(runWrapper);
26381
26624
  if (!Array.isArray(runWrapper.elements)) runWrapper.elements = [];
26382
26625
  runWrapper.elements.push(cloneXmlNode(child));
@@ -26384,7 +26627,7 @@ const decode$n = (params2, decodedAttrs = {}) => {
26384
26627
  });
26385
26628
  const trackedRuns = ensureTrackedWrapper(runs, trackingMarksByType);
26386
26629
  if (!trackedRuns.length) {
26387
- const emptyRun = { name: XML_NODE_NAME$g, elements: [] };
26630
+ const emptyRun = { name: XML_NODE_NAME$h, elements: [] };
26388
26631
  applyBaseRunProps(emptyRun);
26389
26632
  trackedRuns.push(emptyRun);
26390
26633
  }
@@ -26398,148 +26641,15 @@ const decode$n = (params2, decodedAttrs = {}) => {
26398
26641
  }
26399
26642
  return trackedRuns;
26400
26643
  };
26401
- const config$e = {
26402
- xmlName: XML_NODE_NAME$g,
26644
+ const config$f = {
26645
+ xmlName: XML_NODE_NAME$h,
26403
26646
  sdNodeOrKeyName: SD_KEY_NAME,
26404
26647
  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;
26648
+ encode: encode$o,
26649
+ decode: decode$o,
26650
+ attributes: validXmlAttributes$9
26542
26651
  };
26652
+ const translator$V = NodeTranslator.from(config$f);
26543
26653
  function preProcessVerticalMergeCells(table, { editorSchema }) {
26544
26654
  if (!table || !Array.isArray(table.content)) {
26545
26655
  return table;
@@ -26580,13 +26690,13 @@ function preProcessVerticalMergeCells(table, { editorSchema }) {
26580
26690
  }
26581
26691
  return table;
26582
26692
  }
26583
- const translator$T = NodeTranslator.from({
26693
+ const translator$U = NodeTranslator.from({
26584
26694
  xmlName: "w:cantSplit",
26585
26695
  sdNodeOrKeyName: "cantSplit",
26586
26696
  encode: ({ nodes }) => ["1", "true"].includes(nodes[0].attributes?.["w:val"] ?? "1"),
26587
26697
  decode: ({ node }) => node.attrs?.cantSplit ? { attributes: {} } : void 0
26588
26698
  });
26589
- const translator$S = NodeTranslator.from({
26699
+ const translator$T = NodeTranslator.from({
26590
26700
  xmlName: "w:cnfStyle",
26591
26701
  sdNodeOrKeyName: "cnfStyle",
26592
26702
  attributes: [
@@ -26612,8 +26722,8 @@ const translator$S = NodeTranslator.from({
26612
26722
  return Object.keys(decodedAttrs).length > 0 ? { attributes: decodedAttrs } : void 0;
26613
26723
  }
26614
26724
  });
26615
- const translator$R = NodeTranslator.from(createSingleAttrPropertyHandler("w:divId"));
26616
- const translator$Q = NodeTranslator.from(
26725
+ const translator$S = NodeTranslator.from(createSingleAttrPropertyHandler("w:divId"));
26726
+ const translator$R = NodeTranslator.from(
26617
26727
  createSingleAttrPropertyHandler(
26618
26728
  "w:gridAfter",
26619
26729
  null,
@@ -26622,7 +26732,7 @@ const translator$Q = NodeTranslator.from(
26622
26732
  (v2) => integerToString(v2)
26623
26733
  )
26624
26734
  );
26625
- const translator$P = NodeTranslator.from(
26735
+ const translator$Q = NodeTranslator.from(
26626
26736
  createSingleAttrPropertyHandler(
26627
26737
  "w:gridBefore",
26628
26738
  null,
@@ -26631,21 +26741,21 @@ const translator$P = NodeTranslator.from(
26631
26741
  (v2) => integerToString(v2)
26632
26742
  )
26633
26743
  );
26634
- const translator$O = NodeTranslator.from({
26744
+ const translator$P = NodeTranslator.from({
26635
26745
  xmlName: "w:hidden",
26636
26746
  sdNodeOrKeyName: "hidden",
26637
26747
  encode: ({ nodes }) => parseBoolean(nodes[0].attributes?.["w:val"] ?? "1"),
26638
26748
  decode: ({ node }) => node.attrs.hidden ? { attributes: {} } : void 0
26639
26749
  });
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({
26750
+ const translator$O = NodeTranslator.from(createSingleAttrPropertyHandler("w:jc", "justification"));
26751
+ const translator$N = NodeTranslator.from(createMeasurementPropertyHandler("w:tblCellSpacing", "tableCellSpacing"));
26752
+ const translator$M = NodeTranslator.from({
26643
26753
  xmlName: "w:tblHeader",
26644
26754
  sdNodeOrKeyName: "repeatHeader",
26645
26755
  encode: ({ nodes }) => parseBoolean(nodes[0].attributes?.["w:val"] ?? "1"),
26646
26756
  decode: ({ node }) => node.attrs.repeatHeader ? { attributes: {} } : void 0
26647
26757
  });
26648
- const translator$K = NodeTranslator.from({
26758
+ const translator$L = NodeTranslator.from({
26649
26759
  xmlName: "w:trHeight",
26650
26760
  sdNodeOrKeyName: "rowHeight",
26651
26761
  encode: ({ nodes }) => {
@@ -26672,11 +26782,11 @@ const translator$K = NodeTranslator.from({
26672
26782
  return Object.keys(heightAttrs).length > 0 ? { attributes: heightAttrs } : void 0;
26673
26783
  }
26674
26784
  });
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";
26785
+ const translator$K = NodeTranslator.from(createMeasurementPropertyHandler("w:wAfter"));
26786
+ const translator$J = NodeTranslator.from(createMeasurementPropertyHandler("w:wBefore"));
26787
+ const XML_NODE_NAME$g = "w:trPr";
26678
26788
  const SD_ATTR_KEY$4 = "tableRowProperties";
26679
- const encode$m = (params2) => {
26789
+ const encode$n = (params2) => {
26680
26790
  const { nodes } = params2;
26681
26791
  const node = nodes[0];
26682
26792
  let attributes = {
@@ -26690,12 +26800,12 @@ const encode$m = (params2) => {
26690
26800
  };
26691
26801
  return {
26692
26802
  type: NodeTranslator.translatorTypes.ATTRIBUTE,
26693
- xmlName: XML_NODE_NAME$f,
26803
+ xmlName: XML_NODE_NAME$g,
26694
26804
  sdNodeOrKeyName: SD_ATTR_KEY$4,
26695
26805
  attributes
26696
26806
  };
26697
26807
  };
26698
- const decode$m = (params2) => {
26808
+ const decode$n = (params2) => {
26699
26809
  const { tableRowProperties = {} } = params2.node.attrs || {};
26700
26810
  const elements = decodeProperties(propertyTranslatorsBySdName$2, tableRowProperties);
26701
26811
  const newNode = {
@@ -26707,6 +26817,7 @@ const decode$m = (params2) => {
26707
26817
  return newNode;
26708
26818
  };
26709
26819
  const propertyTranslators$3 = [
26820
+ translator$U,
26710
26821
  translator$T,
26711
26822
  translator$S,
26712
26823
  translator$R,
@@ -26717,8 +26828,7 @@ const propertyTranslators$3 = [
26717
26828
  translator$M,
26718
26829
  translator$L,
26719
26830
  translator$K,
26720
- translator$J,
26721
- translator$I
26831
+ translator$J
26722
26832
  ];
26723
26833
  const propertyTranslatorsByXmlName$2 = {};
26724
26834
  propertyTranslators$3.forEach((translator2) => {
@@ -26728,25 +26838,25 @@ const propertyTranslatorsBySdName$2 = {};
26728
26838
  propertyTranslators$3.forEach((translator2) => {
26729
26839
  propertyTranslatorsBySdName$2[translator2.sdNodeOrKeyName] = translator2;
26730
26840
  });
26731
- const config$d = {
26732
- xmlName: XML_NODE_NAME$f,
26841
+ const config$e = {
26842
+ xmlName: XML_NODE_NAME$g,
26733
26843
  sdNodeOrKeyName: SD_ATTR_KEY$4,
26734
26844
  type: NodeTranslator.translatorTypes.ATTRIBUTE,
26735
- encode: encode$m,
26736
- decode: decode$m
26845
+ encode: encode$n,
26846
+ decode: decode$n
26737
26847
  };
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(
26848
+ const translator$I = NodeTranslator.from(config$e);
26849
+ const XML_NODE_NAME$f = "w:tr";
26850
+ const SD_NODE_NAME$b = "tableRow";
26851
+ const validXmlAttributes$8 = ["w:rsidDel", "w:rsidR", "w:rsidRPr", "w:rsidTr", "w14:paraId", "w14:textId"].map(
26742
26852
  (xmlName) => createAttributeHandler(xmlName)
26743
26853
  );
26744
- const encode$l = (params2, encodedAttrs) => {
26854
+ const encode$m = (params2, encodedAttrs) => {
26745
26855
  const { row } = params2.extraParams;
26746
26856
  let tableRowProperties = {};
26747
26857
  const tPr = row.elements.find((el) => el.name === "w:trPr");
26748
26858
  if (tPr) {
26749
- ({ attributes: tableRowProperties } = translator$H.encode({
26859
+ ({ attributes: tableRowProperties } = translator$I.encode({
26750
26860
  ...params2,
26751
26861
  nodes: [tPr]
26752
26862
  }));
@@ -26759,7 +26869,7 @@ const encode$l = (params2, encodedAttrs) => {
26759
26869
  let currentColumnIndex = 0;
26760
26870
  const content = cellNodes?.map((n) => {
26761
26871
  let columnWidth = gridColumnWidths?.[currentColumnIndex] || null;
26762
- const result = translator$8.encode({
26872
+ const result = translator$9.encode({
26763
26873
  ...params2,
26764
26874
  extraParams: {
26765
26875
  ...params2.extraParams,
@@ -26781,7 +26891,7 @@ const encode$l = (params2, encodedAttrs) => {
26781
26891
  };
26782
26892
  return newNode;
26783
26893
  };
26784
- const decode$l = (params2, decodedAttrs) => {
26894
+ const decode$m = (params2, decodedAttrs) => {
26785
26895
  const { node } = params2;
26786
26896
  const elements = translateChildNodes(params2);
26787
26897
  if (node.attrs?.tableRowProperties) {
@@ -26793,7 +26903,7 @@ const decode$l = (params2, decodedAttrs) => {
26793
26903
  }
26794
26904
  }
26795
26905
  tableRowProperties["cantSplit"] = node.attrs["cantSplit"];
26796
- const trPr = translator$H.decode({
26906
+ const trPr = translator$I.decode({
26797
26907
  ...params2,
26798
26908
  node: { ...node, attrs: { ...node.attrs, tableRowProperties } }
26799
26909
  });
@@ -26805,22 +26915,22 @@ const decode$l = (params2, decodedAttrs) => {
26805
26915
  elements
26806
26916
  };
26807
26917
  };
26808
- const config$c = {
26809
- xmlName: XML_NODE_NAME$e,
26810
- sdNodeOrKeyName: SD_NODE_NAME$a,
26918
+ const config$d = {
26919
+ xmlName: XML_NODE_NAME$f,
26920
+ sdNodeOrKeyName: SD_NODE_NAME$b,
26811
26921
  type: NodeTranslator.translatorTypes.NODE,
26812
- encode: encode$l,
26813
- decode: decode$l,
26814
- attributes: validXmlAttributes$9
26922
+ encode: encode$m,
26923
+ decode: decode$m,
26924
+ attributes: validXmlAttributes$8
26815
26925
  };
26816
- const translator$G = NodeTranslator.from(config$c);
26817
- const translator$F = NodeTranslator.from({
26926
+ const translator$H = NodeTranslator.from(config$d);
26927
+ const translator$G = NodeTranslator.from({
26818
26928
  xmlName: "w:bidiVisual",
26819
26929
  sdNodeOrKeyName: "rightToLeft",
26820
26930
  encode: ({ nodes }) => parseBoolean(nodes[0].attributes?.["w:val"] ?? "1"),
26821
26931
  decode: ({ node }) => node.attrs.rightToLeft ? { attributes: {} } : void 0
26822
26932
  });
26823
- const translator$E = NodeTranslator.from({
26933
+ const translator$F = NodeTranslator.from({
26824
26934
  xmlName: "w:shd",
26825
26935
  sdNodeOrKeyName: "shading",
26826
26936
  attributes: [
@@ -26842,11 +26952,11 @@ const translator$E = NodeTranslator.from({
26842
26952
  return Object.keys(decodedAttrs).length > 0 ? { attributes: decodedAttrs } : void 0;
26843
26953
  }
26844
26954
  });
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({
26955
+ const translator$E = NodeTranslator.from(createSingleAttrPropertyHandler("w:tblCaption", "caption"));
26956
+ const translator$D = NodeTranslator.from(createSingleAttrPropertyHandler("w:tblDescription", "description"));
26957
+ const translator$C = NodeTranslator.from(createMeasurementPropertyHandler("w:tblInd", "tableIndent"));
26958
+ const translator$B = NodeTranslator.from(createSingleAttrPropertyHandler("w:tblLayout", "tableLayout", "w:type"));
26959
+ const translator$A = NodeTranslator.from({
26850
26960
  xmlName: "w:tblLook",
26851
26961
  sdNodeOrKeyName: "tblLook",
26852
26962
  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 +26968,16 @@ const translator$z = NodeTranslator.from({
26858
26968
  return Object.keys(decodedAttrs).length > 0 ? { attributes: decodedAttrs } : void 0;
26859
26969
  }
26860
26970
  });
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(
26971
+ const translator$z = NodeTranslator.from(createSingleAttrPropertyHandler("w:tblOverlap", "overlap"));
26972
+ const translator$y = NodeTranslator.from(createSingleAttrPropertyHandler("w:tblStyle", "tableStyleId"));
26973
+ const translator$x = NodeTranslator.from(
26864
26974
  createSingleAttrPropertyHandler("w:tblStyleColBandSize", "tableStyleColBandSize")
26865
26975
  );
26866
- const translator$v = NodeTranslator.from(
26976
+ const translator$w = NodeTranslator.from(
26867
26977
  createSingleAttrPropertyHandler("w:tblStyleRowBandSize", "tableStyleRowBandSize")
26868
26978
  );
26869
- const translator$u = NodeTranslator.from(createMeasurementPropertyHandler("w:tblW", "tableWidth"));
26870
- const translator$t = NodeTranslator.from({
26979
+ const translator$v = NodeTranslator.from(createMeasurementPropertyHandler("w:tblW", "tableWidth"));
26980
+ const translator$u = NodeTranslator.from({
26871
26981
  xmlName: "w:tblpPr",
26872
26982
  sdNodeOrKeyName: "floatingTableProperties",
26873
26983
  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 +26989,29 @@ const translator$t = NodeTranslator.from({
26879
26989
  return Object.keys(decodedAttrs).length > 0 ? { attributes: decodedAttrs } : void 0;
26880
26990
  }
26881
26991
  });
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";
26992
+ const translator$t = NodeTranslator.from(createBorderPropertyHandler("w:bottom"));
26993
+ const translator$s = NodeTranslator.from(createMeasurementPropertyHandler("w:bottom", "marginBottom"));
26994
+ const translator$r = NodeTranslator.from(createBorderPropertyHandler("w:end"));
26995
+ const translator$q = NodeTranslator.from(createMeasurementPropertyHandler("w:end", "marginEnd"));
26996
+ const translator$p = NodeTranslator.from(createBorderPropertyHandler("w:insideH"));
26997
+ const translator$o = NodeTranslator.from(createBorderPropertyHandler("w:insideV"));
26998
+ const translator$n = NodeTranslator.from(createBorderPropertyHandler("w:left"));
26999
+ const translator$m = NodeTranslator.from(createMeasurementPropertyHandler("w:left", "marginLeft"));
27000
+ const translator$l = NodeTranslator.from(createBorderPropertyHandler("w:right"));
27001
+ const translator$k = NodeTranslator.from(createMeasurementPropertyHandler("w:right", "marginRight"));
27002
+ const translator$j = NodeTranslator.from(createBorderPropertyHandler("w:start"));
27003
+ const translator$i = NodeTranslator.from(createMeasurementPropertyHandler("w:start", "marginStart"));
27004
+ const translator$h = NodeTranslator.from(createBorderPropertyHandler("w:top"));
27005
+ const translator$g = NodeTranslator.from(createMeasurementPropertyHandler("w:top", "marginTop"));
27006
+ const XML_NODE_NAME$e = "w:tblBorders";
26897
27007
  const SD_ATTR_KEY$3 = "borders";
26898
- const encode$k = (params2) => {
27008
+ const encode$l = (params2) => {
26899
27009
  const { nodes } = params2;
26900
27010
  const node = nodes[0];
26901
27011
  const attributes = encodeProperties(node, tblBordersTranslatorsByXmlName);
26902
27012
  return Object.keys(attributes).length > 0 ? attributes : void 0;
26903
27013
  };
26904
- const decode$k = (params2) => {
27014
+ const decode$l = (params2) => {
26905
27015
  const { borders = {} } = params2.node.attrs || {};
26906
27016
  const elements = decodeProperties(tblBordersTranslatorsBySdName, borders);
26907
27017
  const newNode = {
@@ -26913,14 +27023,14 @@ const decode$k = (params2) => {
26913
27023
  return newNode;
26914
27024
  };
26915
27025
  const propertyTranslators$2 = [
26916
- translator$s,
26917
- translator$q,
27026
+ translator$t,
27027
+ translator$r,
27028
+ translator$p,
26918
27029
  translator$o,
26919
27030
  translator$n,
26920
- translator$m,
26921
- translator$k,
26922
- translator$i,
26923
- translator$g
27031
+ translator$l,
27032
+ translator$j,
27033
+ translator$h
26924
27034
  ];
26925
27035
  const tblBordersTranslatorsByXmlName = {};
26926
27036
  const tblBordersTranslatorsBySdName = {};
@@ -26928,27 +27038,27 @@ propertyTranslators$2.forEach((translator2) => {
26928
27038
  tblBordersTranslatorsByXmlName[translator2.xmlName] = translator2;
26929
27039
  tblBordersTranslatorsBySdName[translator2.sdNodeOrKeyName] = translator2;
26930
27040
  });
26931
- const translator$e = NodeTranslator.from({
26932
- xmlName: XML_NODE_NAME$d,
27041
+ const translator$f = NodeTranslator.from({
27042
+ xmlName: XML_NODE_NAME$e,
26933
27043
  sdNodeOrKeyName: SD_ATTR_KEY$3,
26934
27044
  type: NodeTranslator.translatorTypes.NODE,
26935
27045
  attributes: [],
26936
- encode: encode$k,
26937
- decode: decode$k
27046
+ encode: encode$l,
27047
+ decode: decode$l
26938
27048
  });
26939
- const XML_NODE_NAME$c = "w:tblCellMar";
27049
+ const XML_NODE_NAME$d = "w:tblCellMar";
26940
27050
  const SD_ATTR_KEY$2 = "cellMargins";
26941
- const encode$j = (params2) => {
27051
+ const encode$k = (params2) => {
26942
27052
  const { nodes } = params2;
26943
27053
  const node = nodes[0];
26944
27054
  const attributes = encodeProperties(node, propertyTranslatorsByXmlName$1);
26945
27055
  return Object.keys(attributes).length > 0 ? attributes : void 0;
26946
27056
  };
26947
- const decode$j = (params2) => {
27057
+ const decode$k = (params2) => {
26948
27058
  const { cellMargins = {} } = params2.node.attrs || {};
26949
27059
  const elements = decodeProperties(propertyTranslatorsBySdName$1, cellMargins);
26950
27060
  const newNode = {
26951
- name: XML_NODE_NAME$c,
27061
+ name: XML_NODE_NAME$d,
26952
27062
  type: "element",
26953
27063
  attributes: {},
26954
27064
  elements
@@ -26956,12 +27066,12 @@ const decode$j = (params2) => {
26956
27066
  return newNode;
26957
27067
  };
26958
27068
  const propertyTranslators$1 = [
26959
- translator$r,
26960
- translator$p,
26961
- translator$l,
26962
- translator$j,
26963
- translator$h,
26964
- translator$f
27069
+ translator$s,
27070
+ translator$q,
27071
+ translator$m,
27072
+ translator$k,
27073
+ translator$i,
27074
+ translator$g
26965
27075
  ];
26966
27076
  const propertyTranslatorsByXmlName$1 = {};
26967
27077
  const propertyTranslatorsBySdName$1 = {};
@@ -26969,27 +27079,27 @@ propertyTranslators$1.forEach((translator2) => {
26969
27079
  propertyTranslatorsByXmlName$1[translator2.xmlName] = translator2;
26970
27080
  propertyTranslatorsBySdName$1[translator2.sdNodeOrKeyName] = translator2;
26971
27081
  });
26972
- const translator$d = NodeTranslator.from({
26973
- xmlName: XML_NODE_NAME$c,
27082
+ const translator$e = NodeTranslator.from({
27083
+ xmlName: XML_NODE_NAME$d,
26974
27084
  sdNodeOrKeyName: SD_ATTR_KEY$2,
26975
27085
  type: NodeTranslator.translatorTypes.NODE,
26976
27086
  attributes: [],
26977
- encode: encode$j,
26978
- decode: decode$j
27087
+ encode: encode$k,
27088
+ decode: decode$k
26979
27089
  });
26980
- const XML_NODE_NAME$b = "w:tblPr";
27090
+ const XML_NODE_NAME$c = "w:tblPr";
26981
27091
  const SD_ATTR_KEY$1 = "tableProperties";
26982
- const encode$i = (params2) => {
27092
+ const encode$j = (params2) => {
26983
27093
  const { nodes } = params2;
26984
27094
  const node = nodes[0];
26985
27095
  const attributes = encodeProperties(node, propertyTranslatorsByXmlName);
26986
27096
  return {
26987
- xmlName: XML_NODE_NAME$b,
27097
+ xmlName: XML_NODE_NAME$c,
26988
27098
  sdNodeOrKeyName: SD_ATTR_KEY$1,
26989
27099
  attributes
26990
27100
  };
26991
27101
  };
26992
- const decode$i = (params2) => {
27102
+ const decode$j = (params2) => {
26993
27103
  const { tableProperties = {} } = params2.node.attrs || {};
26994
27104
  const elements = decodeProperties(propertyTranslatorsBySdName, tableProperties);
26995
27105
  const newNode = {
@@ -27001,11 +27111,12 @@ const decode$i = (params2) => {
27001
27111
  return newNode;
27002
27112
  };
27003
27113
  const propertyTranslators = [
27114
+ translator$G,
27115
+ translator$O,
27004
27116
  translator$F,
27005
- translator$N,
27006
27117
  translator$E,
27118
+ translator$N,
27007
27119
  translator$D,
27008
- translator$M,
27009
27120
  translator$C,
27010
27121
  translator$B,
27011
27122
  translator$A,
@@ -27015,9 +27126,8 @@ const propertyTranslators = [
27015
27126
  translator$w,
27016
27127
  translator$v,
27017
27128
  translator$u,
27018
- translator$t,
27019
- translator$e,
27020
- translator$d
27129
+ translator$f,
27130
+ translator$e
27021
27131
  ];
27022
27132
  const propertyTranslatorsByXmlName = {};
27023
27133
  const propertyTranslatorsBySdName = {};
@@ -27025,14 +27135,14 @@ propertyTranslators.forEach((translator2) => {
27025
27135
  propertyTranslatorsByXmlName[translator2.xmlName] = translator2;
27026
27136
  propertyTranslatorsBySdName[translator2.sdNodeOrKeyName] = translator2;
27027
27137
  });
27028
- const config$b = {
27029
- xmlName: XML_NODE_NAME$b,
27138
+ const config$c = {
27139
+ xmlName: XML_NODE_NAME$c,
27030
27140
  sdNodeOrKeyName: SD_ATTR_KEY$1,
27031
- encode: encode$i,
27032
- decode: decode$i
27141
+ encode: encode$j,
27142
+ decode: decode$j
27033
27143
  };
27034
- const translator$c = NodeTranslator.from(config$b);
27035
- const translator$b = NodeTranslator.from(
27144
+ const translator$d = NodeTranslator.from(config$c);
27145
+ const translator$c = NodeTranslator.from(
27036
27146
  createSingleAttrPropertyHandler("w:gridCol", "col", "w:w", parseInteger, integerToString)
27037
27147
  );
27038
27148
  const DEFAULT_COLUMN_WIDTH_PX = 100;
@@ -27082,20 +27192,20 @@ const resolveFallbackColumnWidthTwips = (params2, totalColumns, cellMinWidthTwip
27082
27192
  }
27083
27193
  return Math.max(fallbackWidthTwips, cellMinWidthTwips);
27084
27194
  };
27085
- const XML_NODE_NAME$a = "w:tblGrid";
27195
+ const XML_NODE_NAME$b = "w:tblGrid";
27086
27196
  const SD_ATTR_KEY = "grid";
27087
27197
  const cellMinWidth = pixelsToTwips(10);
27088
- const encode$h = (params2) => {
27198
+ const encode$i = (params2) => {
27089
27199
  const { nodes } = params2;
27090
27200
  const node = nodes[0];
27091
- const attributes = encodeProperties(node, { [translator$b.xmlName]: translator$b }, true);
27201
+ const attributes = encodeProperties(node, { [translator$c.xmlName]: translator$c }, true);
27092
27202
  return {
27093
- xmlName: XML_NODE_NAME$a,
27203
+ xmlName: XML_NODE_NAME$b,
27094
27204
  sdNodeOrKeyName: SD_ATTR_KEY,
27095
27205
  attributes
27096
27206
  };
27097
27207
  };
27098
- const decode$h = (params2) => {
27208
+ const decode$i = (params2) => {
27099
27209
  const { grid: rawGrid } = params2.node.attrs || {};
27100
27210
  const grid = Array.isArray(rawGrid) ? rawGrid : [];
27101
27211
  const { firstRow = {} } = params2.extraParams || {};
@@ -27114,10 +27224,10 @@ const decode$h = (params2) => {
27114
27224
  numericWidth = fallbackColumnWidthTwips;
27115
27225
  }
27116
27226
  numericWidth = Math.max(numericWidth, cellMinWidth);
27117
- const decoded = translator$b.decode({
27227
+ const decoded = translator$c.decode({
27118
27228
  node: { type: (
27119
27229
  /** @type {string} */
27120
- translator$b.sdNodeOrKeyName
27230
+ translator$c.sdNodeOrKeyName
27121
27231
  ), attrs: { col: numericWidth } }
27122
27232
  });
27123
27233
  if (decoded) elements.push(decoded);
@@ -27152,19 +27262,19 @@ const decode$h = (params2) => {
27152
27262
  columnIndex++;
27153
27263
  }
27154
27264
  const newNode = {
27155
- name: XML_NODE_NAME$a,
27265
+ name: XML_NODE_NAME$b,
27156
27266
  attributes: {},
27157
27267
  elements
27158
27268
  };
27159
27269
  return newNode;
27160
27270
  };
27161
- const config$a = {
27162
- xmlName: XML_NODE_NAME$a,
27271
+ const config$b = {
27272
+ xmlName: XML_NODE_NAME$b,
27163
27273
  sdNodeOrKeyName: SD_ATTR_KEY,
27164
- encode: encode$h,
27165
- decode: decode$h
27274
+ encode: encode$i,
27275
+ decode: decode$i
27166
27276
  };
27167
- const translator$a = NodeTranslator.from(config$a);
27277
+ const translator$b = NodeTranslator.from(config$b);
27168
27278
  const DEFAULT_PAGE_WIDTH_TWIPS = 12240;
27169
27279
  const DEFAULT_PAGE_MARGIN_TWIPS = 1440;
27170
27280
  const DEFAULT_CONTENT_WIDTH_TWIPS = DEFAULT_PAGE_WIDTH_TWIPS - 2 * DEFAULT_PAGE_MARGIN_TWIPS;
@@ -27227,19 +27337,19 @@ const buildFallbackGridForTable = ({ params: params2, rows, tableWidth, tableWid
27227
27337
  columnWidths: Array(columnCount).fill(fallbackColumnWidthPx)
27228
27338
  };
27229
27339
  };
27230
- const XML_NODE_NAME$9 = "w:tbl";
27231
- const SD_NODE_NAME$9 = "table";
27232
- const encode$g = (params2, encodedAttrs) => {
27340
+ const XML_NODE_NAME$a = "w:tbl";
27341
+ const SD_NODE_NAME$a = "table";
27342
+ const encode$h = (params2, encodedAttrs) => {
27233
27343
  const { nodes } = params2;
27234
27344
  const node = nodes[0];
27235
27345
  const tblPr = node.elements.find((el) => el.name === "w:tblPr");
27236
27346
  if (tblPr) {
27237
- const encodedProperties = translator$c.encode({ ...params2, nodes: [tblPr] });
27347
+ const encodedProperties = translator$d.encode({ ...params2, nodes: [tblPr] });
27238
27348
  encodedAttrs["tableProperties"] = encodedProperties?.attributes || {};
27239
27349
  }
27240
27350
  const tblGrid = node.elements.find((el) => el.name === "w:tblGrid");
27241
27351
  if (tblGrid) {
27242
- encodedAttrs["grid"] = translator$a.encode({ ...params2, nodes: [tblGrid] }).attributes;
27352
+ encodedAttrs["grid"] = translator$b.encode({ ...params2, nodes: [tblGrid] }).attributes;
27243
27353
  }
27244
27354
  [
27245
27355
  "tableStyleId",
@@ -27306,7 +27416,7 @@ const encode$g = (params2, encodedAttrs) => {
27306
27416
  }
27307
27417
  const content = [];
27308
27418
  rows.forEach((row) => {
27309
- const result = translator$G.encode({
27419
+ const result = translator$H.encode({
27310
27420
  ...params2,
27311
27421
  nodes: [row],
27312
27422
  extraParams: {
@@ -27325,13 +27435,13 @@ const encode$g = (params2, encodedAttrs) => {
27325
27435
  attrs: encodedAttrs
27326
27436
  };
27327
27437
  };
27328
- const decode$g = (params2, decodedAttrs) => {
27438
+ const decode$h = (params2, decodedAttrs) => {
27329
27439
  params2.node = preProcessVerticalMergeCells(params2.node, params2);
27330
27440
  const { node } = params2;
27331
27441
  const elements = translateChildNodes(params2);
27332
27442
  const firstRow = node.content?.find((n) => n.type === "tableRow");
27333
27443
  const properties = node.attrs.grid;
27334
- const element = translator$a.decode({
27444
+ const element = translator$b.decode({
27335
27445
  ...params2,
27336
27446
  node: { ...node, attrs: { ...node.attrs, grid: properties } },
27337
27447
  extraParams: {
@@ -27341,7 +27451,7 @@ const decode$g = (params2, decodedAttrs) => {
27341
27451
  if (element) elements.unshift(element);
27342
27452
  if (node.attrs?.tableProperties) {
27343
27453
  const properties2 = { ...node.attrs.tableProperties };
27344
- const element2 = translator$c.decode({
27454
+ const element2 = translator$d.decode({
27345
27455
  ...params2,
27346
27456
  node: { ...node, attrs: { ...node.attrs, tableProperties: properties2 } }
27347
27457
  });
@@ -27407,7 +27517,7 @@ function _getReferencedTableStyles(tableStyleReference, params2) {
27407
27517
  if (baseTblPr && baseTblPr.elements) {
27408
27518
  tblPr.elements.push(...baseTblPr.elements);
27409
27519
  }
27410
- const tableProperties = translator$c.encode({ ...params2, nodes: [tblPr] }).attributes;
27520
+ const tableProperties = translator$d.encode({ ...params2, nodes: [tblPr] }).attributes;
27411
27521
  const { borders, rowBorders } = _processTableBorders(tableProperties.borders || {});
27412
27522
  if (borders) stylesToReturn.borders = borders;
27413
27523
  if (rowBorders) stylesToReturn.rowBorders = rowBorders;
@@ -27424,16 +27534,16 @@ function _getReferencedTableStyles(tableStyleReference, params2) {
27424
27534
  }
27425
27535
  return stylesToReturn;
27426
27536
  }
27427
- const config$9 = {
27428
- xmlName: XML_NODE_NAME$9,
27429
- sdNodeOrKeyName: SD_NODE_NAME$9,
27537
+ const config$a = {
27538
+ xmlName: XML_NODE_NAME$a,
27539
+ sdNodeOrKeyName: SD_NODE_NAME$a,
27430
27540
  type: NodeTranslator.translatorTypes.NODE,
27431
- encode: encode$g,
27432
- decode: decode$g,
27541
+ encode: encode$h,
27542
+ decode: decode$h,
27433
27543
  attributes: []
27434
27544
  };
27435
- const translator$9 = NodeTranslator.from(config$9);
27436
- const tableNodeHandlerEntity = generateV2HandlerEntity("tableNodeHandler", translator$9);
27545
+ const translator$a = NodeTranslator.from(config$a);
27546
+ const tableNodeHandlerEntity = generateV2HandlerEntity("tableNodeHandler", translator$a);
27437
27547
  function getReferencedTableStyles(tblStyleTag, docx) {
27438
27548
  if (!tblStyleTag) return null;
27439
27549
  const stylesToReturn = {};
@@ -27795,10 +27905,10 @@ function generateCellMargins(cellMargins) {
27795
27905
  if (left2 != null) elements.push({ name: "w:left", attributes: { "w:w": pixelsToTwips(left2) } });
27796
27906
  return elements;
27797
27907
  }
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) {
27908
+ const XML_NODE_NAME$9 = "w:tc";
27909
+ const SD_NODE_NAME$9 = "tableCell";
27910
+ const validXmlAttributes$7 = [];
27911
+ function encode$g(params2, encodedAttrs) {
27802
27912
  const {
27803
27913
  node,
27804
27914
  table,
@@ -27825,162 +27935,22 @@ function encode$f(params2, encodedAttrs) {
27825
27935
  }
27826
27936
  return schemaNode;
27827
27937
  }
27828
- function decode$f(params2, decodedAttrs) {
27938
+ function decode$g(params2, decodedAttrs) {
27829
27939
  const translated = translateTableCell(params2);
27830
27940
  if (decodedAttrs && Object.keys(decodedAttrs).length) {
27831
27941
  translated.attributes = { ...translated.attributes || {}, ...decodedAttrs };
27832
27942
  }
27833
27943
  return translated;
27834
27944
  }
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,
27945
+ const config$9 = {
27946
+ xmlName: XML_NODE_NAME$9,
27947
+ sdNodeOrKeyName: SD_NODE_NAME$9,
27978
27948
  type: NodeTranslator.translatorTypes.NODE,
27979
- encode: encode$e,
27980
- decode: decode$e,
27949
+ encode: encode$g,
27950
+ decode: decode$g,
27981
27951
  attributes: validXmlAttributes$7
27982
27952
  };
27983
- const translator$7 = NodeTranslator.from(config$7);
27953
+ const translator$9 = NodeTranslator.from(config$9);
27984
27954
  function parseTagValueJSON(json) {
27985
27955
  if (typeof json !== "string") {
27986
27956
  return {};
@@ -28116,12 +28086,32 @@ function handleDocPartObj(params2) {
28116
28086
  }
28117
28087
  const content = node?.elements.find((el) => el.name === "w:sdtContent");
28118
28088
  const handler2 = validGalleryTypeMap[docPartGalleryType];
28119
- const result = handler2({ ...params2, nodes: [content] });
28089
+ const result = handler2({
28090
+ ...params2,
28091
+ nodes: [content],
28092
+ extraParams: { ...params2.extraParams || {}, sdtPr }
28093
+ });
28120
28094
  return result;
28121
28095
  }
28122
28096
  const tableOfContentsHandler = (params2) => {
28123
28097
  const node = params2.nodes[0];
28124
- return params2.nodeListHandler.handler({ ...params2, nodes: node.elements });
28098
+ const translatedContent = params2.nodeListHandler.handler({
28099
+ ...params2,
28100
+ nodes: node.elements,
28101
+ path: [...params2.path || [], node]
28102
+ });
28103
+ const sdtPr = params2.extraParams.sdtPr;
28104
+ const id = sdtPr.elements?.find((el) => el.name === "w:id")?.attributes["w:val"] || "";
28105
+ const result = {
28106
+ type: "documentPartObject",
28107
+ content: translatedContent,
28108
+ attrs: {
28109
+ id,
28110
+ docPartGallery: "Table of Contents",
28111
+ docPartUnique: true
28112
+ }
28113
+ };
28114
+ return result;
28125
28115
  };
28126
28116
  const validGalleryTypeMap = {
28127
28117
  "Table of Contents": tableOfContentsHandler
@@ -28779,32 +28769,32 @@ function translateAnchorNode(params2) {
28779
28769
  elements: [...anchorElements, ...elementsWithWrap]
28780
28770
  };
28781
28771
  }
28782
- const XML_NODE_NAME$6 = "wp:anchor";
28783
- const SD_NODE_NAME$6 = ["image"];
28772
+ const XML_NODE_NAME$8 = "wp:anchor";
28773
+ const SD_NODE_NAME$8 = ["image"];
28784
28774
  const validXmlAttributes$6 = ["distT", "distB", "distL", "distR"].map((xmlName) => createAttributeHandler(xmlName));
28785
- function encode$d(params2) {
28775
+ function encode$f(params2) {
28786
28776
  const { node } = params2.extraParams;
28787
28777
  if (!node || !node.type) {
28788
28778
  return null;
28789
28779
  }
28790
28780
  return handleAnchorNode(params2);
28791
28781
  }
28792
- function decode$d(params2) {
28782
+ function decode$f(params2) {
28793
28783
  const { node } = params2;
28794
28784
  if (!node || !node.type) {
28795
28785
  return null;
28796
28786
  }
28797
28787
  return translateAnchorNode(params2);
28798
28788
  }
28799
- const config$6 = {
28800
- xmlName: XML_NODE_NAME$6,
28801
- sdNodeOrKeyName: SD_NODE_NAME$6,
28789
+ const config$8 = {
28790
+ xmlName: XML_NODE_NAME$8,
28791
+ sdNodeOrKeyName: SD_NODE_NAME$8,
28802
28792
  type: NodeTranslator.translatorTypes.NODE,
28803
- encode: encode$d,
28804
- decode: decode$d,
28793
+ encode: encode$f,
28794
+ decode: decode$f,
28805
28795
  attributes: validXmlAttributes$6
28806
28796
  };
28807
- const translator$6 = NodeTranslator.from(config$6);
28797
+ const translator$8 = NodeTranslator.from(config$8);
28808
28798
  function handleInlineNode(params2) {
28809
28799
  const { node } = params2.extraParams;
28810
28800
  if (node.name !== "wp:inline") {
@@ -28820,41 +28810,41 @@ function translateInlineNode(params2) {
28820
28810
  elements: nodeElements.elements
28821
28811
  };
28822
28812
  }
28823
- const XML_NODE_NAME$5 = "wp:inline";
28824
- const SD_NODE_NAME$5 = ["image"];
28813
+ const XML_NODE_NAME$7 = "wp:inline";
28814
+ const SD_NODE_NAME$7 = ["image"];
28825
28815
  const validXmlAttributes$5 = ["distT", "distB", "distL", "distR"].map((xmlName) => createAttributeHandler(xmlName));
28826
- function encode$c(params2) {
28816
+ function encode$e(params2) {
28827
28817
  const { node } = params2.extraParams;
28828
28818
  if (!node || !node.type) {
28829
28819
  return null;
28830
28820
  }
28831
28821
  return handleInlineNode(params2);
28832
28822
  }
28833
- function decode$c(params2) {
28823
+ function decode$e(params2) {
28834
28824
  const { node } = params2;
28835
28825
  if (!node || !node.type) {
28836
28826
  return null;
28837
28827
  }
28838
28828
  return translateInlineNode(params2);
28839
28829
  }
28840
- const config$5 = {
28841
- xmlName: XML_NODE_NAME$5,
28842
- sdNodeOrKeyName: SD_NODE_NAME$5,
28830
+ const config$7 = {
28831
+ xmlName: XML_NODE_NAME$7,
28832
+ sdNodeOrKeyName: SD_NODE_NAME$7,
28843
28833
  type: NodeTranslator.translatorTypes.NODE,
28844
- encode: encode$c,
28845
- decode: decode$c,
28834
+ encode: encode$e,
28835
+ decode: decode$e,
28846
28836
  attributes: validXmlAttributes$5
28847
28837
  };
28848
- const translator$5 = NodeTranslator.from(config$5);
28849
- const XML_NODE_NAME$4 = "w:drawing";
28850
- const SD_NODE_NAME$4 = [];
28838
+ const translator$7 = NodeTranslator.from(config$7);
28839
+ const XML_NODE_NAME$6 = "w:drawing";
28840
+ const SD_NODE_NAME$6 = [];
28851
28841
  const validXmlAttributes$4 = [];
28852
- function encode$b(params2) {
28842
+ function encode$d(params2) {
28853
28843
  const nodes = params2.nodes;
28854
28844
  const node = nodes[0];
28855
28845
  const translatorByChildName = {
28856
- "wp:anchor": translator$6,
28857
- "wp:inline": translator$5
28846
+ "wp:anchor": translator$8,
28847
+ "wp:inline": translator$7
28858
28848
  };
28859
28849
  return node.elements.reduce((acc, child) => {
28860
28850
  if (acc) return acc;
@@ -28863,12 +28853,12 @@ function encode$b(params2) {
28863
28853
  return translator2.encode({ ...params2, extraParams: { node: child } }) || acc;
28864
28854
  }, null);
28865
28855
  }
28866
- function decode$b(params2) {
28856
+ function decode$d(params2) {
28867
28857
  const { node } = params2;
28868
28858
  if (!node || !node.type) {
28869
28859
  return null;
28870
28860
  }
28871
- const childTranslator = node.attrs.isAnchor ? translator$6 : translator$5;
28861
+ const childTranslator = node.attrs.isAnchor ? translator$8 : translator$7;
28872
28862
  const resultNode = childTranslator.decode(params2);
28873
28863
  return wrapTextInRun(
28874
28864
  {
@@ -28878,15 +28868,15 @@ function decode$b(params2) {
28878
28868
  []
28879
28869
  );
28880
28870
  }
28881
- const config$4 = {
28882
- xmlName: XML_NODE_NAME$4,
28883
- sdNodeOrKeyName: SD_NODE_NAME$4,
28871
+ const config$6 = {
28872
+ xmlName: XML_NODE_NAME$6,
28873
+ sdNodeOrKeyName: SD_NODE_NAME$6,
28884
28874
  type: NodeTranslator.translatorTypes.NODE,
28885
- encode: encode$b,
28886
- decode: decode$b,
28875
+ encode: encode$d,
28876
+ decode: decode$d,
28887
28877
  attributes: validXmlAttributes$4
28888
28878
  };
28889
- const translator$4 = NodeTranslator.from(config$4);
28879
+ const translator$6 = NodeTranslator.from(config$6);
28890
28880
  class CommandService {
28891
28881
  /**
28892
28882
  * @param {import('./commands/types/index.js').CommandServiceOptions} props
@@ -30224,7 +30214,7 @@ function prepareTextAnnotation(params2) {
30224
30214
  return getTextNodeForExport(attrs.displayLabel, [...marks, ...marksFromAttrs], params2);
30225
30215
  }
30226
30216
  function prepareImageAnnotation(params2, imageSize) {
30227
- return translator$4.decode({
30217
+ return translator$6.decode({
30228
30218
  ...params2,
30229
30219
  imageSize
30230
30220
  });
@@ -30444,6 +30434,49 @@ const generateSdtPrTagForDocumentSection = (id, title, tag) => {
30444
30434
  ]
30445
30435
  };
30446
30436
  };
30437
+ function translateDocumentPartObj(params2) {
30438
+ const { node } = params2;
30439
+ const { attrs = {} } = node;
30440
+ const childContent = translateChildNodes({ ...params2, nodes: node.content });
30441
+ const nodeElements = [
30442
+ {
30443
+ name: "w:sdtPr",
30444
+ elements: [
30445
+ {
30446
+ name: "w:id",
30447
+ attributes: {
30448
+ "w:val": attrs.id
30449
+ }
30450
+ },
30451
+ {
30452
+ name: "w:docPartObj",
30453
+ elements: [
30454
+ {
30455
+ name: "w:docPartGallery",
30456
+ attributes: {
30457
+ "w:val": attrs.docPartGallery
30458
+ }
30459
+ },
30460
+ ...attrs.docPartUnique ? [
30461
+ {
30462
+ name: "w:docPartUnique"
30463
+ }
30464
+ ] : []
30465
+ ]
30466
+ }
30467
+ ]
30468
+ },
30469
+ {
30470
+ name: "w:sdtContent",
30471
+ elements: childContent
30472
+ }
30473
+ ];
30474
+ const result = {
30475
+ name: "w:sdt",
30476
+ elements: nodeElements
30477
+ };
30478
+ return result;
30479
+ }
30447
30480
  function translateStructuredContent(params2) {
30448
30481
  const { node } = params2;
30449
30482
  const childContent = translateChildNodes({ ...params2, nodes: node.content });
@@ -30495,10 +30528,10 @@ function generateSdtPrTagForStructuredContent({ node }) {
30495
30528
  };
30496
30529
  return result;
30497
30530
  }
30498
- const XML_NODE_NAME$3 = "w:sdt";
30499
- const SD_NODE_NAME$3 = ["fieldAnnotation", "structuredContent", "structuredContentBlock", "documentSection"];
30531
+ const XML_NODE_NAME$5 = "w:sdt";
30532
+ const SD_NODE_NAME$5 = ["fieldAnnotation", "structuredContent", "structuredContentBlock", "documentSection"];
30500
30533
  const validXmlAttributes$3 = [];
30501
- function encode$a(params2) {
30534
+ function encode$c(params2) {
30502
30535
  const nodes = params2.nodes;
30503
30536
  const node = nodes[0];
30504
30537
  const { type: sdtType, handler: handler2 } = sdtNodeTypeStrategy(node);
@@ -30508,7 +30541,7 @@ function encode$a(params2) {
30508
30541
  const result = handler2(params2);
30509
30542
  return result;
30510
30543
  }
30511
- function decode$a(params2) {
30544
+ function decode$c(params2) {
30512
30545
  const { node } = params2;
30513
30546
  if (!node || !node.type) {
30514
30547
  return null;
@@ -30518,91 +30551,93 @@ function decode$a(params2) {
30518
30551
  structuredContent: () => translateStructuredContent(params2),
30519
30552
  structuredContentBlock: () => translateStructuredContent(params2),
30520
30553
  documentSection: () => translateDocumentSection(params2),
30554
+ documentPartObject: () => translateDocumentPartObj(params2),
30555
+ // Handled in doc-part-obj translator
30521
30556
  default: () => null
30522
30557
  };
30523
30558
  const decoder = types2[node.type] ?? types2.default;
30524
30559
  const result = decoder();
30525
30560
  return result;
30526
30561
  }
30527
- const config$3 = {
30528
- xmlName: XML_NODE_NAME$3,
30529
- sdNodeOrKeyName: SD_NODE_NAME$3,
30562
+ const config$5 = {
30563
+ xmlName: XML_NODE_NAME$5,
30564
+ sdNodeOrKeyName: SD_NODE_NAME$5,
30530
30565
  type: NodeTranslator.translatorTypes.NODE,
30531
- encode: encode$a,
30532
- decode: decode$a,
30566
+ encode: encode$c,
30567
+ decode: decode$c,
30533
30568
  attributes: validXmlAttributes$3
30534
30569
  };
30535
- const translator$3 = NodeTranslator.from(config$3);
30536
- const encode$9 = (attributes) => {
30570
+ const translator$5 = NodeTranslator.from(config$5);
30571
+ const encode$b = (attributes) => {
30537
30572
  return attributes["w:id"];
30538
30573
  };
30539
- const decode$9 = (attrs) => {
30574
+ const decode$b = (attrs) => {
30540
30575
  return attrs.id;
30541
30576
  };
30542
30577
  const attrConfig$6 = Object.freeze({
30543
30578
  xmlName: "w:id",
30544
30579
  sdName: "id",
30545
- encode: encode$9,
30546
- decode: decode$9
30580
+ encode: encode$b,
30581
+ decode: decode$b
30547
30582
  });
30548
- const encode$8 = (attributes) => {
30583
+ const encode$a = (attributes) => {
30549
30584
  return attributes["w:name"];
30550
30585
  };
30551
- const decode$8 = (attrs) => {
30586
+ const decode$a = (attrs) => {
30552
30587
  return attrs.name;
30553
30588
  };
30554
30589
  const attrConfig$5 = Object.freeze({
30555
30590
  xmlName: "w:name",
30556
30591
  sdName: "name",
30557
- encode: encode$8,
30558
- decode: decode$8
30592
+ encode: encode$a,
30593
+ decode: decode$a
30559
30594
  });
30560
- const encode$7 = (attributes) => {
30595
+ const encode$9 = (attributes) => {
30561
30596
  return attributes["w:colFirst"];
30562
30597
  };
30563
- const decode$7 = (attrs) => {
30598
+ const decode$9 = (attrs) => {
30564
30599
  return attrs.colFirst;
30565
30600
  };
30566
30601
  const attrConfig$4 = Object.freeze({
30567
30602
  xmlName: "w:colFirst",
30568
30603
  sdName: "colFirst",
30569
- encode: encode$7,
30570
- decode: decode$7
30604
+ encode: encode$9,
30605
+ decode: decode$9
30571
30606
  });
30572
- const encode$6 = (attributes) => {
30607
+ const encode$8 = (attributes) => {
30573
30608
  return attributes["w:colLast"];
30574
30609
  };
30575
- const decode$6 = (attrs) => {
30610
+ const decode$8 = (attrs) => {
30576
30611
  return attrs.colLast;
30577
30612
  };
30578
30613
  const attrConfig$3 = Object.freeze({
30579
30614
  xmlName: "w:colLast",
30580
30615
  sdName: "colLast",
30581
- encode: encode$6,
30582
- decode: decode$6
30616
+ encode: encode$8,
30617
+ decode: decode$8
30583
30618
  });
30584
- const encode$5 = (attributes) => {
30619
+ const encode$7 = (attributes) => {
30585
30620
  return attributes["w:displacedByCustomXml"];
30586
30621
  };
30587
- const decode$5 = (attrs) => {
30622
+ const decode$7 = (attrs) => {
30588
30623
  return attrs.displacedByCustomXml;
30589
30624
  };
30590
30625
  const attrConfig$2 = Object.freeze({
30591
30626
  xmlName: "w:displacedByCustomXml",
30592
30627
  sdName: "displacedByCustomXml",
30593
- encode: encode$5,
30594
- decode: decode$5
30628
+ encode: encode$7,
30629
+ decode: decode$7
30595
30630
  });
30596
30631
  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 = {}) => {
30632
+ const XML_NODE_NAME$4 = "w:bookmarkStart";
30633
+ const SD_NODE_NAME$4 = "bookmarkStart";
30634
+ const encode$6 = (params2, encodedAttrs = {}) => {
30600
30635
  return {
30601
30636
  type: "bookmarkStart",
30602
30637
  attrs: encodedAttrs
30603
30638
  };
30604
30639
  };
30605
- const decode$4 = (params2, decodedAttrs = {}) => {
30640
+ const decode$6 = (params2, decodedAttrs = {}) => {
30606
30641
  const result = {
30607
30642
  name: "w:bookmarkStart",
30608
30643
  elements: []
@@ -30612,49 +30647,49 @@ const decode$4 = (params2, decodedAttrs = {}) => {
30612
30647
  }
30613
30648
  return result;
30614
30649
  };
30615
- const config$2 = {
30616
- xmlName: XML_NODE_NAME$2,
30617
- sdNodeOrKeyName: SD_NODE_NAME$2,
30650
+ const config$4 = {
30651
+ xmlName: XML_NODE_NAME$4,
30652
+ sdNodeOrKeyName: SD_NODE_NAME$4,
30618
30653
  type: NodeTranslator.translatorTypes.NODE,
30619
- encode: encode$4,
30620
- decode: decode$4,
30654
+ encode: encode$6,
30655
+ decode: decode$6,
30621
30656
  attributes: validXmlAttributes$2
30622
30657
  };
30623
- const translator$2 = NodeTranslator.from(config$2);
30624
- const encode$3 = (attributes) => {
30658
+ const translator$4 = NodeTranslator.from(config$4);
30659
+ const encode$5 = (attributes) => {
30625
30660
  return attributes["w:id"];
30626
30661
  };
30627
- const decode$3 = (attrs) => {
30662
+ const decode$5 = (attrs) => {
30628
30663
  return attrs.id;
30629
30664
  };
30630
30665
  const attrConfig$1 = Object.freeze({
30631
30666
  xmlName: "w:id",
30632
30667
  sdName: "id",
30633
- encode: encode$3,
30634
- decode: decode$3
30668
+ encode: encode$5,
30669
+ decode: decode$5
30635
30670
  });
30636
- const encode$2 = (attributes) => {
30671
+ const encode$4 = (attributes) => {
30637
30672
  return attributes["w:displacedByCustomXml"];
30638
30673
  };
30639
- const decode$2 = (attrs) => {
30674
+ const decode$4 = (attrs) => {
30640
30675
  return attrs.displacedByCustomXml;
30641
30676
  };
30642
30677
  const attrConfig = Object.freeze({
30643
30678
  xmlName: "w:displacedByCustomXml",
30644
30679
  sdName: "displacedByCustomXml",
30645
- encode: encode$2,
30646
- decode: decode$2
30680
+ encode: encode$4,
30681
+ decode: decode$4
30647
30682
  });
30648
30683
  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 = {}) => {
30684
+ const XML_NODE_NAME$3 = "w:bookmarkEnd";
30685
+ const SD_NODE_NAME$3 = "bookmarkEnd";
30686
+ const encode$3 = (params2, encodedAttrs = {}) => {
30652
30687
  return {
30653
30688
  type: "bookmarkEnd",
30654
30689
  attrs: encodedAttrs
30655
30690
  };
30656
30691
  };
30657
- const decode$1 = (params2, decodedAttrs = {}) => {
30692
+ const decode$3 = (params2, decodedAttrs = {}) => {
30658
30693
  const result = {
30659
30694
  name: "w:bookmarkEnd",
30660
30695
  elements: []
@@ -30664,19 +30699,19 @@ const decode$1 = (params2, decodedAttrs = {}) => {
30664
30699
  }
30665
30700
  return result;
30666
30701
  };
30667
- const config$1 = {
30668
- xmlName: XML_NODE_NAME$1,
30669
- sdNodeOrKeyName: SD_NODE_NAME$1,
30702
+ const config$3 = {
30703
+ xmlName: XML_NODE_NAME$3,
30704
+ sdNodeOrKeyName: SD_NODE_NAME$3,
30670
30705
  type: NodeTranslator.translatorTypes.NODE,
30671
- encode: encode$1,
30672
- decode: decode$1,
30706
+ encode: encode$3,
30707
+ decode: decode$3,
30673
30708
  attributes: validXmlAttributes$1
30674
30709
  };
30675
- const translator$1 = NodeTranslator.from(config$1);
30676
- const XML_NODE_NAME = "mc:AlternateContent";
30677
- const SD_NODE_NAME = [];
30710
+ const translator$3 = NodeTranslator.from(config$3);
30711
+ const XML_NODE_NAME$2 = "mc:AlternateContent";
30712
+ const SD_NODE_NAME$2 = [];
30678
30713
  const validXmlAttributes = [];
30679
- function encode$19(params2) {
30714
+ function encode$2(params2) {
30680
30715
  const { nodeListHandler } = params2;
30681
30716
  const { node } = params2.extraParams;
30682
30717
  if (!node || !node.type) {
@@ -30696,7 +30731,7 @@ function encode$19(params2) {
30696
30731
  path: [...params2.path || [], wpsNode]
30697
30732
  });
30698
30733
  }
30699
- function decode(params2) {
30734
+ function decode$2(params2) {
30700
30735
  const { node } = params2;
30701
30736
  const { drawingContent } = node.attrs;
30702
30737
  const drawing = {
@@ -30713,13 +30748,186 @@ function decode(params2) {
30713
30748
  elements: [choice]
30714
30749
  };
30715
30750
  }
30751
+ const config$2 = {
30752
+ xmlName: XML_NODE_NAME$2,
30753
+ sdNodeOrKeyName: SD_NODE_NAME$2,
30754
+ type: NodeTranslator.translatorTypes.NODE,
30755
+ encode: encode$2,
30756
+ decode: decode$2,
30757
+ attributes: validXmlAttributes
30758
+ };
30759
+ const translator$2 = NodeTranslator.from(config$2);
30760
+ const XML_NODE_NAME$1 = "sd:pageReference";
30761
+ const SD_NODE_NAME$1 = "pageReference";
30762
+ const encode$1 = (params2, _2) => {
30763
+ const { nodes = [], nodeListHandler } = params2 || {};
30764
+ const node = nodes[0];
30765
+ const processedText = nodeListHandler.handler({
30766
+ ...params2,
30767
+ nodes: node.elements
30768
+ });
30769
+ const processedNode = {
30770
+ type: "pageReference",
30771
+ attrs: {
30772
+ instruction: node.attributes?.instruction || "",
30773
+ marksAsAttrs: node.marks || []
30774
+ },
30775
+ content: processedText
30776
+ };
30777
+ return processedNode;
30778
+ };
30779
+ const decode$1 = (params2, _2) => {
30780
+ const { node } = params2;
30781
+ const outputMarks = processOutputMarks(node.attrs?.marksAsAttrs || []);
30782
+ const contentNodes = (node.content ?? []).flatMap((n) => exportSchemaToJson({ ...params2, node: n }));
30783
+ const translated = [
30784
+ {
30785
+ name: "w:r",
30786
+ elements: [
30787
+ {
30788
+ name: "w:rPr",
30789
+ elements: outputMarks
30790
+ },
30791
+ {
30792
+ name: "w:fldChar",
30793
+ attributes: {
30794
+ "w:fldCharType": "begin"
30795
+ }
30796
+ }
30797
+ ]
30798
+ },
30799
+ {
30800
+ name: "w:r",
30801
+ elements: [
30802
+ {
30803
+ name: "w:rPr",
30804
+ elements: outputMarks
30805
+ },
30806
+ {
30807
+ name: "w:instrText",
30808
+ attributes: { "xml:space": "preserve" },
30809
+ elements: [
30810
+ {
30811
+ type: "text",
30812
+ text: `${node.attrs.instruction}`
30813
+ }
30814
+ ]
30815
+ }
30816
+ ]
30817
+ },
30818
+ {
30819
+ name: "w:r",
30820
+ elements: [
30821
+ {
30822
+ name: "w:rPr",
30823
+ elements: outputMarks
30824
+ },
30825
+ {
30826
+ name: "w:fldChar",
30827
+ attributes: {
30828
+ "w:fldCharType": "separate"
30829
+ }
30830
+ }
30831
+ ]
30832
+ },
30833
+ ...contentNodes,
30834
+ {
30835
+ name: "w:r",
30836
+ elements: [
30837
+ {
30838
+ name: "w:rPr",
30839
+ elements: outputMarks
30840
+ },
30841
+ {
30842
+ name: "w:fldChar",
30843
+ attributes: {
30844
+ "w:fldCharType": "end"
30845
+ }
30846
+ }
30847
+ ]
30848
+ }
30849
+ ];
30850
+ return translated;
30851
+ };
30852
+ const config$1 = {
30853
+ xmlName: XML_NODE_NAME$1,
30854
+ sdNodeOrKeyName: SD_NODE_NAME$1,
30855
+ type: NodeTranslator.translatorTypes.NODE,
30856
+ encode: encode$1,
30857
+ decode: decode$1
30858
+ };
30859
+ const translator$1 = NodeTranslator.from(config$1);
30860
+ const XML_NODE_NAME = "sd:tableOfContents";
30861
+ const SD_NODE_NAME = "tableOfContents";
30862
+ const encode$1c = (params2, _2) => {
30863
+ const { nodes = [], nodeListHandler } = params2 || {};
30864
+ const node = nodes[0];
30865
+ const processedContent = nodeListHandler.handler({
30866
+ ...params2,
30867
+ nodes: node.elements || []
30868
+ });
30869
+ const processedNode = {
30870
+ type: "tableOfContents",
30871
+ attrs: {
30872
+ instruction: node.attributes?.instruction || ""
30873
+ },
30874
+ content: processedContent
30875
+ };
30876
+ return processedNode;
30877
+ };
30878
+ const decode = (params2, _2) => {
30879
+ const { node } = params2;
30880
+ const contentNodes = node.content.map((n) => exportSchemaToJson({ ...params2, node: n }));
30881
+ const tocBeginElements = [
30882
+ {
30883
+ name: "w:r",
30884
+ elements: [{ name: "w:fldChar", attributes: { "w:fldCharType": "begin" }, elements: [] }]
30885
+ },
30886
+ {
30887
+ name: "w:r",
30888
+ elements: [
30889
+ {
30890
+ name: "w:instrText",
30891
+ attributes: { "xml:space": "preserve" },
30892
+ elements: [{ text: node.attrs?.instruction || "", type: "text", name: "#text", elements: [] }]
30893
+ }
30894
+ ]
30895
+ },
30896
+ { name: "w:r", elements: [{ name: "w:fldChar", attributes: { "w:fldCharType": "separate" }, elements: [] }] }
30897
+ ];
30898
+ if (contentNodes.length > 0) {
30899
+ const firstParagraph = contentNodes[0];
30900
+ let insertIndex = 0;
30901
+ if (firstParagraph.elements) {
30902
+ const pPrIndex = firstParagraph.elements.findIndex((el) => el.name === "w:pPr");
30903
+ insertIndex = pPrIndex >= 0 ? pPrIndex + 1 : 0;
30904
+ } else {
30905
+ firstParagraph.elements = [];
30906
+ }
30907
+ firstParagraph.elements.splice(insertIndex, 0, ...tocBeginElements);
30908
+ } else {
30909
+ contentNodes.push({
30910
+ name: "w:p",
30911
+ elements: tocBeginElements
30912
+ });
30913
+ }
30914
+ const tocEndElements = [
30915
+ { name: "w:r", elements: [{ name: "w:fldChar", attributes: { "w:fldCharType": "end" }, elements: [] }] }
30916
+ ];
30917
+ const lastParagraph = contentNodes[contentNodes.length - 1];
30918
+ if (lastParagraph.elements) {
30919
+ lastParagraph.elements.push(...tocEndElements);
30920
+ } else {
30921
+ lastParagraph.elements = [...tocEndElements];
30922
+ }
30923
+ return contentNodes;
30924
+ };
30716
30925
  const config = {
30717
30926
  xmlName: XML_NODE_NAME,
30718
30927
  sdNodeOrKeyName: SD_NODE_NAME,
30719
30928
  type: NodeTranslator.translatorTypes.NODE,
30720
- encode: encode$19,
30721
- decode,
30722
- attributes: validXmlAttributes
30929
+ encode: encode$1c,
30930
+ decode
30723
30931
  };
30724
30932
  const translator = NodeTranslator.from(config);
30725
30933
  const DEFAULT_SECTION_PROPS_TWIPS = Object.freeze({
@@ -30793,32 +31001,35 @@ function exportSchemaToJson(params2) {
30793
31001
  doc: translateDocumentNode,
30794
31002
  body: translateBodyNode,
30795
31003
  heading: translateHeadingNode,
30796
- paragraph: translator$13,
30797
- run: translator$U,
31004
+ paragraph: translator$16,
31005
+ run: translator$V,
30798
31006
  text: translateTextNode,
30799
31007
  bulletList: translateList,
30800
31008
  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,
31009
+ lineBreak: translator$19,
31010
+ table: translator$a,
31011
+ tableRow: translator$H,
31012
+ tableCell: translator$9,
31013
+ bookmarkStart: translator$4,
31014
+ bookmarkEnd: translator$3,
31015
+ fieldAnnotation: translator$5,
31016
+ tab: translator$17,
31017
+ image: translator$6,
31018
+ hardBreak: translator$19,
30811
31019
  commentRangeStart: () => translateCommentNode(params2, "Start"),
30812
31020
  commentRangeEnd: () => translateCommentNode(params2, "End"),
30813
31021
  commentReference: () => null,
30814
31022
  shapeContainer: translateShapeContainer,
30815
31023
  shapeTextbox: translateShapeTextbox,
30816
31024
  contentBlock: translateContentBlock,
30817
- structuredContent: translator$3,
30818
- structuredContentBlock: translator$3,
30819
- documentSection: translator$3,
31025
+ structuredContent: translator$5,
31026
+ structuredContentBlock: translator$5,
31027
+ documentPartObject: translator$5,
31028
+ documentSection: translator$5,
30820
31029
  "page-number": translatePageNumberNode,
30821
- "total-page-number": translateTotalPageNumberNode
31030
+ "total-page-number": translateTotalPageNumberNode,
31031
+ pageReference: translator$1,
31032
+ tableOfContents: translator
30822
31033
  };
30823
31034
  let handler2 = router[type2];
30824
31035
  if (handler2 && "decode" in handler2 && typeof handler2.decode === "function") {
@@ -31156,8 +31367,6 @@ function translateTextNode(params2) {
31156
31367
  const trackedMarks = [TrackInsertMarkName, TrackDeleteMarkName];
31157
31368
  const isTrackedNode = node.marks?.some((m2) => trackedMarks.includes(m2.type));
31158
31369
  if (isTrackedNode) return translateTrackedNode(params2);
31159
- const isLinkNode = node.marks?.some((m2) => m2.type === "link");
31160
- if (isLinkNode) return translator$7.decode(params2);
31161
31370
  const { text, marks = [] } = node;
31162
31371
  return getTextNodeForExport(text, marks, params2);
31163
31372
  }
@@ -31463,7 +31672,7 @@ function translateMark(mark) {
31463
31672
  markElement.type = "element";
31464
31673
  break;
31465
31674
  case "underline": {
31466
- const translated = translator$10.decode({
31675
+ const translated = translator$13.decode({
31467
31676
  node: {
31468
31677
  attrs: {
31469
31678
  underlineType: attrs.underlineType ?? attrs.underline ?? null,
@@ -31527,7 +31736,7 @@ function translateMark(mark) {
31527
31736
  break;
31528
31737
  case "highlight": {
31529
31738
  const highlightValue = attrs.color ?? attrs.highlight ?? null;
31530
- const translated = translator$15.decode({ node: { attrs: { highlight: highlightValue } } });
31739
+ const translated = translator$18.decode({ node: { attrs: { highlight: highlightValue } } });
31531
31740
  return translated || {};
31532
31741
  }
31533
31742
  }
@@ -31587,7 +31796,7 @@ function translateContentBlock(params2) {
31587
31796
  if (vmlAttributes || horizontalRule) {
31588
31797
  return translateVRectContentBlock(params2);
31589
31798
  }
31590
- const alternateContent = translator.decode(params2);
31799
+ const alternateContent = translator$2.decode(params2);
31591
31800
  return wrapTextInRun(alternateContent);
31592
31801
  }
31593
31802
  function translateVRectContentBlock(params2) {
@@ -31733,6 +31942,7 @@ const getAutoPageJson = (type2, outputMarks = []) => {
31733
31942
  },
31734
31943
  {
31735
31944
  name: "w:instrText",
31945
+ attributes: { "xml:space": "preserve" },
31736
31946
  elements: [
31737
31947
  {
31738
31948
  type: "text",
@@ -31792,7 +32002,7 @@ const handleDrawingNode = (params2) => {
31792
32002
  if (mainNode.name === "w:drawing") node = mainNode;
31793
32003
  else node = mainNode.elements.find((el) => el.name === "w:drawing");
31794
32004
  if (!node) return { nodes: [], consumed: 0 };
31795
- const schemaNode = translator$4.encode(params2);
32005
+ const schemaNode = translator$6.encode(params2);
31796
32006
  const newNodes = schemaNode ? [schemaNode] : [];
31797
32007
  return { nodes: newNodes, consumed: 1 };
31798
32008
  };
@@ -31894,8 +32104,8 @@ const trackChangeNodeHandlerEntity = {
31894
32104
  handlerName: "trackChangeNodeHandler",
31895
32105
  handler: handleTrackChangeNode
31896
32106
  };
31897
- const hyperlinkNodeHandlerEntity = generateV2HandlerEntity("hyperlinkNodeHandler", translator$7);
31898
- const runNodeHandlerEntity = generateV2HandlerEntity("runNodeHandler", translator$U);
32107
+ const hyperlinkNodeHandlerEntity = generateV2HandlerEntity("hyperlinkNodeHandler", translator$W);
32108
+ const runNodeHandlerEntity = generateV2HandlerEntity("runNodeHandler", translator$V);
31899
32109
  const handleTextNode = (params2) => {
31900
32110
  const { nodes, insideTrackChange } = params2;
31901
32111
  if (nodes.length === 0 || !(nodes[0].name === "w:t" || insideTrackChange && nodes[0].name === "w:delText")) {
@@ -31936,7 +32146,7 @@ const handleParagraphNode = (params2) => {
31936
32146
  if (nodes.length === 0 || nodes[0].name !== "w:p") {
31937
32147
  return { nodes: [], consumed: 0 };
31938
32148
  }
31939
- const schemaNode = translator$13.encode(params2);
32149
+ const schemaNode = translator$16.encode(params2);
31940
32150
  const newNodes = schemaNode ? [schemaNode] : [];
31941
32151
  return { nodes: newNodes, consumed: 1 };
31942
32152
  };
@@ -31949,7 +32159,7 @@ const handleSdtNode = (params2) => {
31949
32159
  if (nodes.length === 0 || nodes[0].name !== "w:sdt") {
31950
32160
  return { nodes: [], consumed: 0 };
31951
32161
  }
31952
- const result = translator$3.encode(params2);
32162
+ const result = translator$5.encode(params2);
31953
32163
  if (!result) {
31954
32164
  return { nodes: [], consumed: 0 };
31955
32165
  }
@@ -32039,7 +32249,7 @@ const handler = (params2) => {
32039
32249
  if (nodes.length === 0 || nodes[0].name !== "w:br") {
32040
32250
  return { nodes: [], consumed: 0 };
32041
32251
  }
32042
- const result = translator$16.encode(params2);
32252
+ const result = translator$19.encode(params2);
32043
32253
  if (!result) return { nodes: [], consumed: 0 };
32044
32254
  return {
32045
32255
  nodes: [result],
@@ -32111,7 +32321,7 @@ const handleBookmarkStartNode = (params2) => {
32111
32321
  if (isCustomMarkBookmark(nodes[0], params2.editor)) {
32112
32322
  return handleBookmarkNode(params2);
32113
32323
  }
32114
- const node = translator$2.encode(params2);
32324
+ const node = translator$4.encode(params2);
32115
32325
  if (!node) return { nodes: [], consumed: 0 };
32116
32326
  return { nodes: [node], consumed: 1 };
32117
32327
  };
@@ -32143,7 +32353,7 @@ const handleBookmarkEndNode = (params2) => {
32143
32353
  if (!nodes.length || nodes[0].name !== "w:bookmarkEnd") {
32144
32354
  return { nodes: [], consumed: 0 };
32145
32355
  }
32146
- const node = translator$1.encode(params2);
32356
+ const node = translator$3.encode(params2);
32147
32357
  if (!node) return { nodes: [], consumed: 0 };
32148
32358
  return { nodes: [node], consumed: 1 };
32149
32359
  };
@@ -32276,6 +32486,7 @@ const autoTotalPageCountEntity = {
32276
32486
  handlerName: "autoTotalPageCountEntity",
32277
32487
  handler: handleAutoTotalPageNumber
32278
32488
  };
32489
+ const pageReferenceEntity = generateV2HandlerEntity("pageReferenceNodeHandler", translator$1);
32279
32490
  const handlePictNode = (params2) => {
32280
32491
  const { nodes } = params2;
32281
32492
  if (!nodes.length || nodes[0].name !== "w:p") {
@@ -32774,6 +32985,7 @@ const getDefaultStyleDefinition = (defaultStyleId, docx) => {
32774
32985
  const spacing = pPr?.elements?.find((el) => el.name === "w:spacing");
32775
32986
  const justify = pPr?.elements?.find((el) => el.name === "w:jc");
32776
32987
  const indent = pPr?.elements?.find((el) => el.name === "w:ind");
32988
+ const tabs = pPr?.elements?.find((el) => el.name === "w:tabs");
32777
32989
  let lineSpaceBefore, lineSpaceAfter, line;
32778
32990
  if (spacing) {
32779
32991
  lineSpaceBefore = twipsToPixels(spacing?.attributes["w:before"]);
@@ -32787,6 +32999,22 @@ const getDefaultStyleDefinition = (defaultStyleId, docx) => {
32787
32999
  rightIndent = twipsToPixels(indent?.attributes["w:right"]);
32788
33000
  firstLine = twipsToPixels(indent?.attributes["w:firstLine"]);
32789
33001
  }
33002
+ let tabStops = [];
33003
+ if (tabs) {
33004
+ tabStops = (tabs.elements || []).filter((el) => el.name === "w:tab").map((tab) => {
33005
+ let val = tab.attributes["w:val"];
33006
+ if (val == "left") {
33007
+ val = "start";
33008
+ } else if (val == "right") {
33009
+ val = "end";
33010
+ }
33011
+ return {
33012
+ val,
33013
+ pos: twipsToPixels(tab.attributes["w:pos"]),
33014
+ leader: tab.attributes["w:leader"]
33015
+ };
33016
+ });
33017
+ }
32790
33018
  const keepNext = pPr?.elements?.find((el) => el.name === "w:keepNext");
32791
33019
  const keepLines = pPr?.elements?.find((el) => el.name === "w:keepLines");
32792
33020
  const outlineLevel = pPr?.elements?.find((el) => el.name === "w:outlineLvl");
@@ -32819,7 +33047,8 @@ const getDefaultStyleDefinition = (defaultStyleId, docx) => {
32819
33047
  const parsedStyles = {
32820
33048
  spacing: { lineSpaceAfter, lineSpaceBefore, line },
32821
33049
  textAlign,
32822
- indent: { leftIndent, rightIndent, firstLine }
33050
+ indent: { leftIndent, rightIndent, firstLine },
33051
+ tabStops: tabStops.length > 0 ? tabStops : null
32823
33052
  };
32824
33053
  parsedMarks.forEach((mark) => {
32825
33054
  const { type: type2, attrs } = mark;
@@ -32843,13 +33072,213 @@ const handleTabNode = (params2) => {
32843
33072
  if (!nodes.length || nodes[0].name !== "w:tab") {
32844
33073
  return { nodes: [], consumed: 0 };
32845
33074
  }
32846
- const node = translator$14.encode(params2);
33075
+ const node = translator$17.encode(params2);
32847
33076
  return { nodes: [node], consumed: 1 };
32848
33077
  };
32849
33078
  const tabNodeEntityHandler = {
32850
33079
  handlerName: "w:tabTranslator",
32851
33080
  handler: handleTabNode
32852
33081
  };
33082
+ const tableOfContentsHandlerEntity = generateV2HandlerEntity("tableOfContentsHandler", translator);
33083
+ function preProcessPageInstruction(nodesToCombine, _2, __) {
33084
+ const pageNumNode = {
33085
+ name: "sd:autoPageNumber",
33086
+ type: "element"
33087
+ };
33088
+ nodesToCombine.forEach((n) => {
33089
+ const rPrNode = n.elements.find((el) => el.name === "w:rPr");
33090
+ if (rPrNode) pageNumNode.elements = [rPrNode];
33091
+ });
33092
+ return [pageNumNode];
33093
+ }
33094
+ function preProcessNumPagesInstruction(nodesToCombine, _2, __) {
33095
+ const totalPageNumNode = {
33096
+ name: "sd:totalPageNumber",
33097
+ type: "element"
33098
+ };
33099
+ nodesToCombine.forEach((n) => {
33100
+ const rPrNode = n.elements?.find((el) => el.name === "w:rPr");
33101
+ if (rPrNode) totalPageNumNode.elements = [rPrNode];
33102
+ });
33103
+ return [totalPageNumNode];
33104
+ }
33105
+ function preProcessPageRefInstruction(nodesToCombine, instrText, _2) {
33106
+ const pageRefNode = {
33107
+ name: "sd:pageReference",
33108
+ type: "element",
33109
+ attributes: {
33110
+ instruction: instrText
33111
+ },
33112
+ elements: nodesToCombine
33113
+ };
33114
+ return [pageRefNode];
33115
+ }
33116
+ function preProcessHyperlinkInstruction(nodesToCombine, instruction, docx) {
33117
+ const urlMatch = instruction.match(/HYPERLINK\s+"([^"]+)"/);
33118
+ let linkAttributes;
33119
+ if (urlMatch && urlMatch.length >= 2) {
33120
+ const url = urlMatch[1];
33121
+ const rels = docx["word/_rels/document.xml.rels"];
33122
+ const relationships = rels?.elements.find((el) => el.name === "Relationships");
33123
+ if (relationships) {
33124
+ const rId = generateDocxRandomId();
33125
+ relationships.elements.push({
33126
+ type: "element",
33127
+ name: "Relationship",
33128
+ attributes: {
33129
+ Id: rId,
33130
+ Type: "http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink",
33131
+ Target: url,
33132
+ TargetMode: "External"
33133
+ }
33134
+ });
33135
+ linkAttributes = { "r:id": rId };
33136
+ } else {
33137
+ linkAttributes = { "w:anchor": url };
33138
+ }
33139
+ } else {
33140
+ const availableSwitches = {
33141
+ "w:anchor": `l "(?<value>[^"]+)"`,
33142
+ new_window: `
33143
+ `,
33144
+ "w:tgtFrame": ` "(?<value>[^"]+)"`,
33145
+ "w:tooltip": `o "(?<value>[^"]+)"`
33146
+ };
33147
+ const parsedSwitches = {};
33148
+ for (const [key2, regex] of Object.entries(availableSwitches)) {
33149
+ const match = instruction.match(new RegExp(regex));
33150
+ if (match) {
33151
+ parsedSwitches[key2] = match.groups?.value || true;
33152
+ }
33153
+ }
33154
+ if (parsedSwitches.new_window) {
33155
+ parsedSwitches["w:tgtFrame"] = "_blank";
33156
+ delete parsedSwitches.new_window;
33157
+ }
33158
+ linkAttributes = { ...parsedSwitches };
33159
+ }
33160
+ return [
33161
+ {
33162
+ name: "w:hyperlink",
33163
+ type: "element",
33164
+ attributes: linkAttributes,
33165
+ elements: nodesToCombine
33166
+ }
33167
+ ];
33168
+ }
33169
+ function preProcessTocInstruction(nodesToCombine, instrText) {
33170
+ return [
33171
+ {
33172
+ name: "sd:tableOfContents",
33173
+ type: "element",
33174
+ attributes: {
33175
+ instruction: instrText
33176
+ },
33177
+ elements: nodesToCombine
33178
+ }
33179
+ ];
33180
+ }
33181
+ const getInstructionPreProcessor = (instruction) => {
33182
+ const instructionType = instruction.split(" ")[0];
33183
+ switch (instructionType) {
33184
+ case "PAGE":
33185
+ return preProcessPageInstruction;
33186
+ case "NUMPAGES":
33187
+ return preProcessNumPagesInstruction;
33188
+ case "PAGEREF":
33189
+ return preProcessPageRefInstruction;
33190
+ case "HYPERLINK":
33191
+ return preProcessHyperlinkInstruction;
33192
+ case "TOC":
33193
+ return preProcessTocInstruction;
33194
+ default:
33195
+ return null;
33196
+ }
33197
+ };
33198
+ const preProcessNodesForFldChar = (nodes = [], docx) => {
33199
+ const processedNodes = [];
33200
+ let collectedNodesStack = [];
33201
+ let currentFieldStack = [];
33202
+ let unpairedEnd = null;
33203
+ let collecting = false;
33204
+ const finalizeField = () => {
33205
+ if (collecting) {
33206
+ const collectedNodes = collectedNodesStack.pop().filter((n) => n !== null);
33207
+ const currentField = currentFieldStack.pop();
33208
+ const combined = _processCombinedNodesForFldChar(collectedNodes, currentField.instrText.trim(), docx);
33209
+ if (collectedNodesStack.length === 0) {
33210
+ processedNodes.push(...combined);
33211
+ } else {
33212
+ collectedNodesStack[collectedNodesStack.length - 1].push(...combined);
33213
+ }
33214
+ } else {
33215
+ unpairedEnd = true;
33216
+ }
33217
+ };
33218
+ for (const node of nodes) {
33219
+ const fldCharEl = node.elements?.find((el) => el.name === "w:fldChar");
33220
+ const fldType = fldCharEl?.attributes?.["w:fldCharType"];
33221
+ const instrTextEl = node.elements?.find((el) => el.name === "w:instrText");
33222
+ collecting = collectedNodesStack.length > 0;
33223
+ if (fldType === "begin") {
33224
+ collectedNodesStack.push([null]);
33225
+ currentFieldStack.push({ instrText: "" });
33226
+ continue;
33227
+ }
33228
+ if (instrTextEl && collecting && currentFieldStack.length > 0) {
33229
+ currentFieldStack[currentFieldStack.length - 1].instrText += (instrTextEl.elements?.[0]?.text || "") + " ";
33230
+ continue;
33231
+ }
33232
+ if (fldType === "end") {
33233
+ finalizeField();
33234
+ continue;
33235
+ } else if (fldType === "separate") {
33236
+ continue;
33237
+ }
33238
+ if (Array.isArray(node.elements)) {
33239
+ const childResult = preProcessNodesForFldChar(node.elements, docx);
33240
+ node.elements = childResult.processedNodes;
33241
+ if (childResult.unpairedBegin) {
33242
+ childResult.unpairedBegin.forEach((pendingField) => {
33243
+ currentFieldStack.push(pendingField.fieldInfo);
33244
+ collectedNodesStack.push([node]);
33245
+ });
33246
+ } else if (childResult.unpairedEnd) {
33247
+ collectedNodesStack[collectedNodesStack.length - 1].push(node);
33248
+ finalizeField();
33249
+ } else if (collecting) {
33250
+ collectedNodesStack[collectedNodesStack.length - 1].push(node);
33251
+ } else {
33252
+ processedNodes.push(node);
33253
+ }
33254
+ } else if (collecting) {
33255
+ collectedNodesStack[collectedNodesStack.length - 1].push(node);
33256
+ } else {
33257
+ processedNodes.push(node);
33258
+ }
33259
+ }
33260
+ let unpairedBegin = null;
33261
+ if (collectedNodesStack.length > 0) {
33262
+ unpairedBegin = [];
33263
+ for (let i = 0; i < collectedNodesStack.length; i++) {
33264
+ processedNodes.push(...collectedNodesStack[i].filter((n) => n !== null));
33265
+ unpairedBegin.push({
33266
+ nodes: collectedNodesStack[i],
33267
+ fieldInfo: currentFieldStack[i]
33268
+ });
33269
+ }
33270
+ }
33271
+ return { processedNodes, unpairedBegin, unpairedEnd };
33272
+ };
33273
+ const _processCombinedNodesForFldChar = (nodesToCombine = [], instrText, docx) => {
33274
+ const instructionType = instrText.trim().split(" ")[0];
33275
+ const instructionPreProcessor = getInstructionPreProcessor(instructionType);
33276
+ if (instructionPreProcessor) {
33277
+ return instructionPreProcessor(nodesToCombine, instrText, docx);
33278
+ } else {
33279
+ return nodesToCombine;
33280
+ }
33281
+ };
32853
33282
  const createDocumentJson = (docx, converter, editor) => {
32854
33283
  const json = carbonCopy(getInitialJSON(docx));
32855
33284
  if (!json) return null;
@@ -32879,6 +33308,8 @@ const createDocumentJson = (docx, converter, editor) => {
32879
33308
  if (bodyNode) {
32880
33309
  ensureSectionProperties(bodyNode);
32881
33310
  const node = bodyNode;
33311
+ const { processedNodes } = preProcessNodesForFldChar(node.elements ?? [], docx);
33312
+ node.elements = processedNodes;
32882
33313
  const contentElements = node.elements?.filter((n) => n.name !== "w:sectPr") ?? [];
32883
33314
  const content = pruneIgnoredNodes(contentElements);
32884
33315
  const comments = importCommentData({ docx, converter, editor });
@@ -32934,8 +33365,10 @@ const defaultNodeListHandler = () => {
32934
33365
  trackChangeNodeHandlerEntity,
32935
33366
  tableNodeHandlerEntity,
32936
33367
  tabNodeEntityHandler,
33368
+ tableOfContentsHandlerEntity,
32937
33369
  autoPageHandlerEntity,
32938
33370
  autoTotalPageCountEntity,
33371
+ pageReferenceEntity,
32939
33372
  standardNodeHandlerEntity
32940
33373
  ];
32941
33374
  const handler2 = createNodeListHandler(entities);
@@ -54390,6 +54823,48 @@ const DocumentSection = Node$1.create({
54390
54823
  };
54391
54824
  }
54392
54825
  });
54826
+ const DocumentPartObject = Node$1.create({
54827
+ name: "documentPartObject",
54828
+ group: "block",
54829
+ content: "block*",
54830
+ isolating: true,
54831
+ addOptions() {
54832
+ return {
54833
+ htmlAttributes: {
54834
+ class: "sd-document-part-object-block",
54835
+ "aria-label": "Structured document part block"
54836
+ }
54837
+ };
54838
+ },
54839
+ parseDOM() {
54840
+ return [
54841
+ {
54842
+ tag: "div.sd-document-part-object-block",
54843
+ priority: 60
54844
+ }
54845
+ ];
54846
+ },
54847
+ renderDOM({ htmlAttributes }) {
54848
+ return ["div", Attribute2.mergeAttributes(this.options.htmlAttributes, htmlAttributes), 0];
54849
+ },
54850
+ addAttributes() {
54851
+ return {
54852
+ sdBlockId: {
54853
+ default: null,
54854
+ keepOnSplit: false,
54855
+ parseDOM: (elem) => elem.getAttribute("data-sd-block-id"),
54856
+ renderDOM: (attrs) => {
54857
+ return attrs.sdBlockId ? { "data-sd-block-id": attrs.sdBlockId } : {};
54858
+ }
54859
+ },
54860
+ id: {},
54861
+ docPartGallery: {},
54862
+ docPartUnique: {
54863
+ default: true
54864
+ }
54865
+ };
54866
+ }
54867
+ });
54393
54868
  const Document = Node$1.create({
54394
54869
  name: "doc",
54395
54870
  topNode: true,
@@ -55526,7 +56001,12 @@ const generateDecorations = (state2, styles) => {
55526
56001
  return { ...base2, ...linkedStyle.definition?.styles || {} };
55527
56002
  };
55528
56003
  const pMap = buildStyleMap(paragraphStyleId);
55529
- const tMap = buildStyleMap(inlineTextStyleId);
56004
+ let tMap;
56005
+ if (paragraphStyleId?.startsWith("TOC")) {
56006
+ tMap = {};
56007
+ } else {
56008
+ tMap = buildStyleMap(inlineTextStyleId);
56009
+ }
55530
56010
  const rMap = buildStyleMap(runStyleId);
55531
56011
  const finalStyles = { ...pMap, ...tMap, ...rMap };
55532
56012
  if (Object.keys(finalStyles).length === 0) return;
@@ -56823,7 +57303,7 @@ const CommentsMark = Mark2.create({
56823
57303
  });
56824
57304
  const defaultTabDistance = 48;
56825
57305
  const defaultLineLength = 816;
56826
- const getTabDecorations = (doc2, view, from2 = 0, to = null) => {
57306
+ const getTabDecorations = (doc2, view, helpers2, from2 = 0, to = null) => {
56827
57307
  const decorations = [];
56828
57308
  const paragraphCache = /* @__PURE__ */ new Map();
56829
57309
  const end2 = to ?? doc2.content.size;
@@ -56831,7 +57311,7 @@ const getTabDecorations = (doc2, view, from2 = 0, to = null) => {
56831
57311
  if (node.type.name !== "tab") return;
56832
57312
  let extraStyles = "";
56833
57313
  const $pos = doc2.resolve(pos);
56834
- const paragraphContext = getParagraphContext($pos, paragraphCache);
57314
+ const paragraphContext = getParagraphContext($pos, paragraphCache, helpers2);
56835
57315
  if (!paragraphContext) return;
56836
57316
  try {
56837
57317
  const { tabStops, flattened, startPos } = paragraphContext;
@@ -56886,18 +57366,27 @@ const getTabDecorations = (doc2, view, from2 = 0, to = null) => {
56886
57366
  });
56887
57367
  return decorations;
56888
57368
  };
56889
- function getParagraphContext($pos, cache2) {
57369
+ function getParagraphContext($pos, cache2, helpers2) {
56890
57370
  for (let depth = $pos.depth; depth >= 0; depth--) {
56891
57371
  const node = $pos.node(depth);
56892
57372
  if (node?.type?.name === "paragraph") {
56893
57373
  const startPos = $pos.start(depth);
56894
57374
  if (!cache2.has(startPos)) {
57375
+ let tabStops = [];
57376
+ if (Array.isArray(node.attrs?.tabStops)) {
57377
+ tabStops = node.attrs.tabStops;
57378
+ } else {
57379
+ const style2 = helpers2.linkedStyles.getStyleById(node.attrs?.styleId);
57380
+ if (Array.isArray(style2?.definition?.styles?.tabStops)) {
57381
+ tabStops = style2.definition.styles.tabStops;
57382
+ }
57383
+ }
56895
57384
  cache2.set(startPos, {
56896
57385
  paragraph: node,
56897
57386
  paragraphDepth: depth,
56898
57387
  startPos,
56899
57388
  indent: node.attrs?.indent || {},
56900
- tabStops: Array.isArray(node.attrs?.tabStops) ? node.attrs.tabStops : [],
57389
+ tabStops,
56901
57390
  flattened: flattenParagraph(node, startPos),
56902
57391
  accumulatedTabWidth: 0
56903
57392
  });
@@ -57063,7 +57552,7 @@ const TabNode = Node$1.create({
57063
57552
  };
57064
57553
  },
57065
57554
  addPmPlugins() {
57066
- const { view } = this.editor;
57555
+ const { view, helpers: helpers2 } = this.editor;
57067
57556
  const tabPlugin = new Plugin({
57068
57557
  name: "tabPlugin",
57069
57558
  key: new PluginKey("tabPlugin"),
@@ -57073,7 +57562,7 @@ const TabNode = Node$1.create({
57073
57562
  },
57074
57563
  apply(tr, { decorations }, _oldState, newState) {
57075
57564
  if (!decorations) {
57076
- decorations = DecorationSet.create(newState.doc, getTabDecorations(newState.doc, view));
57565
+ decorations = DecorationSet.create(newState.doc, getTabDecorations(newState.doc, view, helpers2));
57077
57566
  }
57078
57567
  if (!tr.docChanged) {
57079
57568
  return { decorations };
@@ -57113,7 +57602,7 @@ const TabNode = Node$1.create({
57113
57602
  rangesToRecalculate.forEach(([start2, end2]) => {
57114
57603
  const oldDecorations = decorations.find(start2, end2);
57115
57604
  decorations = decorations.remove(oldDecorations);
57116
- const newDecorations = getTabDecorations(newState.doc, view, start2, end2);
57605
+ const newDecorations = getTabDecorations(newState.doc, view, helpers2, start2, end2);
57117
57606
  decorations = decorations.add(newState.doc, newDecorations);
57118
57607
  });
57119
57608
  return { decorations };
@@ -63394,6 +63883,43 @@ const processMarks = (marks) => {
63394
63883
  });
63395
63884
  return styles;
63396
63885
  };
63886
+ const PageReference = Node$1.create({
63887
+ name: "pageReference",
63888
+ group: "inline",
63889
+ inline: true,
63890
+ atom: true,
63891
+ draggable: false,
63892
+ selectable: false,
63893
+ content: "inline*",
63894
+ addOptions() {
63895
+ return {
63896
+ htmlAttributes: {
63897
+ contenteditable: false,
63898
+ "data-id": "auto-page-reference",
63899
+ "aria-label": "Page reference node",
63900
+ class: "sd-editor-page-reference"
63901
+ }
63902
+ };
63903
+ },
63904
+ addAttributes() {
63905
+ return {
63906
+ marksAsAttrs: {
63907
+ default: null,
63908
+ rendered: false
63909
+ },
63910
+ instruction: {
63911
+ default: "",
63912
+ rendered: false
63913
+ }
63914
+ };
63915
+ },
63916
+ parseDOM() {
63917
+ return [{ tag: 'span[data-id="auto-page-reference"]' }];
63918
+ },
63919
+ renderDOM({ htmlAttributes }) {
63920
+ return ["span", Attribute2.mergeAttributes(this.options.htmlAttributes, htmlAttributes), 0];
63921
+ }
63922
+ });
63397
63923
  const ShapeContainer = Node$1.create({
63398
63924
  name: "shapeContainer",
63399
63925
  group: "block",
@@ -63807,6 +64333,51 @@ const checkForNewBlockNodesInTrs = (transactions) => {
63807
64333
  });
63808
64334
  });
63809
64335
  };
64336
+ const TableOfContents = Node$1.create({
64337
+ name: "tableOfContents",
64338
+ group: "block",
64339
+ content: "paragraph+",
64340
+ inline: false,
64341
+ addOptions() {
64342
+ return {
64343
+ htmlAttributes: {
64344
+ "data-id": "table-of-contents",
64345
+ "aria-label": "Table of Contents"
64346
+ }
64347
+ };
64348
+ },
64349
+ parseDOM() {
64350
+ return [
64351
+ {
64352
+ tag: 'div[data-id="table-of-contents"]'
64353
+ }
64354
+ ];
64355
+ },
64356
+ renderDOM({ htmlAttributes }) {
64357
+ return ["div", Attribute2.mergeAttributes(this.options.htmlAttributes, htmlAttributes), 0];
64358
+ },
64359
+ addAttributes() {
64360
+ return {
64361
+ instruction: {
64362
+ default: null,
64363
+ rendered: false
64364
+ },
64365
+ /**
64366
+ * @private
64367
+ * @category Attribute
64368
+ * @param {string} [sdBlockId] - Internal block tracking ID (not user-configurable)
64369
+ */
64370
+ sdBlockId: {
64371
+ default: null,
64372
+ keepOnSplit: false,
64373
+ parseDOM: (elem) => elem.getAttribute("data-sd-block-id"),
64374
+ renderDOM: (attrs) => {
64375
+ return attrs.sdBlockId ? { "data-sd-block-id": attrs.sdBlockId } : {};
64376
+ }
64377
+ }
64378
+ };
64379
+ }
64380
+ });
63810
64381
  const TextStyle = Mark2.create({
63811
64382
  name: "textStyle",
63812
64383
  addOptions() {
@@ -70413,6 +70984,7 @@ const getStarterExtensions = () => {
70413
70984
  SlashMenu,
70414
70985
  Strike,
70415
70986
  TabNode,
70987
+ TableOfContents,
70416
70988
  Text,
70417
70989
  TextAlign,
70418
70990
  TextIndent,
@@ -70447,6 +71019,7 @@ const getStarterExtensions = () => {
70447
71019
  AiLoaderNode,
70448
71020
  PageNumber,
70449
71021
  TotalPageCount,
71022
+ PageReference,
70450
71023
  ShapeContainer,
70451
71024
  ShapeTextbox,
70452
71025
  ContentBlock,
@@ -70455,6 +71028,7 @@ const getStarterExtensions = () => {
70455
71028
  StructuredContentBlock,
70456
71029
  StructuredContentCommands,
70457
71030
  DocumentSection,
71031
+ DocumentPartObject,
70458
71032
  NodeResizer,
70459
71033
  CustomSelection,
70460
71034
  TextTransform
@@ -85991,71 +86565,73 @@ const _sfc_main = {
85991
86565
  };
85992
86566
  const SuperInput = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-4d5cff52"]]);
85993
86567
  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
86568
+ "mc:AlternateContent": translator$2,
86569
+ "sd:pageReference": translator$1,
86570
+ "sd:tableOfContents": translator,
86571
+ "w:b": translator$15,
86572
+ "w:bidiVisual": translator$G,
86573
+ "w:bookmarkEnd": translator$3,
86574
+ "w:bookmarkStart": translator$4,
86575
+ "w:bottom": translator$t,
86576
+ "w:br": translator$19,
86577
+ "w:cantSplit": translator$U,
86578
+ "w:cnfStyle": translator$T,
86579
+ "w:color": translator$11,
86580
+ "w:divId": translator$S,
86581
+ "w:drawing": translator$6,
86582
+ "w:end": translator$r,
86583
+ "w:gridAfter": translator$R,
86584
+ "w:gridBefore": translator$Q,
86585
+ "w:gridCol": translator$c,
86586
+ "w:hidden": translator$P,
86587
+ "w:highlight": translator$18,
86588
+ "w:hyperlink": translator$W,
86589
+ "w:i": translator$14,
86590
+ "w:insideH": translator$p,
86591
+ "w:insideV": translator$o,
86592
+ "w:jc": translator$O,
86593
+ "w:left": translator$n,
86594
+ "w:p": translator$16,
86595
+ "w:r": translator$V,
86596
+ "w:rFonts": translator$10,
86597
+ "w:rPr": translator$X,
86598
+ "w:rStyle": translator$$,
86599
+ "w:right": translator$l,
86600
+ "w:sdt": translator$5,
86601
+ "w:shd": translator$F,
86602
+ "w:start": translator$j,
86603
+ "w:strike": translator$12,
86604
+ "w:sz": translator$_,
86605
+ "w:szCs": translator$Z,
86606
+ "w:tab": translator$17,
86607
+ "w:tbl": translator$a,
86608
+ "w:tblBorders": translator$f,
86609
+ "w:tblCaption": translator$E,
86610
+ "w:tblCellMar": translator$e,
86611
+ "w:tblCellSpacing": translator$N,
86612
+ "w:tblDescription": translator$D,
86613
+ "w:tblGrid": translator$b,
86614
+ "w:tblHeader": translator$M,
86615
+ "w:tblInd": translator$C,
86616
+ "w:tblLayout": translator$B,
86617
+ "w:tblLook": translator$A,
86618
+ "w:tblOverlap": translator$z,
86619
+ "w:tblPr": translator$d,
86620
+ "w:tblStyle": translator$y,
86621
+ "w:tblStyleColBandSize": translator$x,
86622
+ "w:tblStyleRowBandSize": translator$w,
86623
+ "w:tblW": translator$v,
86624
+ "w:tblpPr": translator$u,
86625
+ "w:tc": translator$9,
86626
+ "w:top": translator$h,
86627
+ "w:tr": translator$H,
86628
+ "w:trHeight": translator$L,
86629
+ "w:trPr": translator$I,
86630
+ "w:u": translator$13,
86631
+ "w:wAfter": translator$K,
86632
+ "w:wBefore": translator$J,
86633
+ "wp:anchor": translator$8,
86634
+ "wp:inline": translator$7
86059
86635
  });
86060
86636
  const baseHandlers = {
86061
86637
  ...runPropertyTranslators,