@harbour-enterprises/superdoc 0.19.0-next.3 → 0.19.0-next.5

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 (65) hide show
  1. package/dist/chunks/{PdfViewer-e5Sqf3uK.es.js → PdfViewer-C2898kqZ.es.js} +1 -1
  2. package/dist/chunks/{PdfViewer-BXpR6HYz.cjs → PdfViewer-DaZtoNpm.cjs} +1 -1
  3. package/dist/chunks/{index-Bgbca9Qo.es.js → index-CkJ5hnvC.es.js} +107 -7
  4. package/dist/chunks/{index-Dg8DEGbE.cjs → index-Di9R4Aas.cjs} +107 -7
  5. package/dist/chunks/{super-editor.es-BbN2QJLe.cjs → super-editor.es-DG-S6GN9.cjs} +503 -208
  6. package/dist/chunks/{super-editor.es-Dga1v3zZ.es.js → super-editor.es-kuaVTS8t.es.js} +503 -208
  7. package/dist/core/SuperDoc.d.ts +6 -6
  8. package/dist/core/SuperDoc.d.ts.map +1 -1
  9. package/dist/core/helpers/file.d.ts +44 -0
  10. package/dist/core/helpers/file.d.ts.map +1 -0
  11. package/dist/stores/superdoc-store.d.ts.map +1 -1
  12. package/dist/style.css +9 -9
  13. package/dist/super-editor/ai-writer.es.js +2 -2
  14. package/dist/super-editor/chunks/{converter-CMajoq-M.js → converter-CrJvpQ8J.js} +456 -203
  15. package/dist/super-editor/chunks/{docx-zipper-C5rg6GNf.js → docx-zipper-CHHaFCfj.js} +1 -1
  16. package/dist/super-editor/chunks/{editor-CH3sE8Fq.js → editor-DlzGbfD-.js} +45 -3
  17. package/dist/super-editor/chunks/{toolbar-BHnLBr61.js → toolbar-DeKOVf4h.js} +2 -2
  18. package/dist/super-editor/converter.es.js +1 -1
  19. package/dist/super-editor/docx-zipper.es.js +2 -2
  20. package/dist/super-editor/editor.es.js +3 -3
  21. package/dist/super-editor/file-zipper.es.js +1 -1
  22. package/dist/super-editor/src/core/Editor.d.ts +3 -3
  23. package/dist/super-editor/src/core/super-converter/exporter.d.ts +0 -7
  24. package/dist/super-editor/src/core/super-converter/v2/importer/tableImporter.d.ts +0 -22
  25. package/dist/super-editor/src/core/super-converter/v3/handlers/utils.d.ts +37 -0
  26. package/dist/super-editor/src/core/super-converter/v3/handlers/w/cantSplit/cantSplit-translator.d.ts +6 -0
  27. package/dist/super-editor/src/core/super-converter/v3/handlers/w/cantSplit/index.d.ts +1 -0
  28. package/dist/super-editor/src/core/super-converter/v3/handlers/w/cnfStyle/cnfStyle-translator.d.ts +7 -0
  29. package/dist/super-editor/src/core/super-converter/v3/handlers/w/cnfStyle/index.d.ts +1 -0
  30. package/dist/super-editor/src/core/super-converter/v3/handlers/w/divId/divId-translator.d.ts +6 -0
  31. package/dist/super-editor/src/core/super-converter/v3/handlers/w/divId/index.d.ts +1 -0
  32. package/dist/super-editor/src/core/super-converter/v3/handlers/w/gridAfter/gridAfter-translator.d.ts +6 -0
  33. package/dist/super-editor/src/core/super-converter/v3/handlers/w/gridAfter/index.d.ts +1 -0
  34. package/dist/super-editor/src/core/super-converter/v3/handlers/w/gridBefore/gridBefore-translator.d.ts +6 -0
  35. package/dist/super-editor/src/core/super-converter/v3/handlers/w/gridBefore/index.d.ts +1 -0
  36. package/dist/super-editor/src/core/super-converter/v3/handlers/w/hidden/hidden-translator.d.ts +6 -0
  37. package/dist/super-editor/src/core/super-converter/v3/handlers/w/hidden/index.d.ts +1 -0
  38. package/dist/super-editor/src/core/super-converter/v3/handlers/w/jc/index.d.ts +1 -0
  39. package/dist/super-editor/src/core/super-converter/v3/handlers/w/jc/jc-translator.d.ts +6 -0
  40. package/dist/super-editor/src/core/super-converter/v3/handlers/w/tblCellSpacing/index.d.ts +1 -0
  41. package/dist/super-editor/src/core/super-converter/v3/handlers/w/tblCellSpacing/tblCellSpacing-translator.d.ts +6 -0
  42. package/dist/super-editor/src/core/super-converter/v3/handlers/w/tblHeader/index.d.ts +1 -0
  43. package/dist/super-editor/src/core/super-converter/v3/handlers/w/tblHeader/tblHeader-translator.d.ts +6 -0
  44. package/dist/super-editor/src/core/super-converter/v3/handlers/w/tr/index.d.ts +1 -0
  45. package/dist/super-editor/src/core/super-converter/v3/handlers/w/tr/tr-translator.d.ts +7 -0
  46. package/dist/super-editor/src/core/super-converter/v3/handlers/w/trHeight/index.d.ts +1 -0
  47. package/dist/super-editor/src/core/super-converter/v3/handlers/w/trHeight/trHeight-translator.d.ts +6 -0
  48. package/dist/super-editor/src/core/super-converter/v3/handlers/w/trPr/index.d.ts +1 -0
  49. package/dist/super-editor/src/core/super-converter/v3/handlers/w/trPr/trPr-translator.d.ts +5 -0
  50. package/dist/super-editor/src/core/super-converter/v3/handlers/w/wAfter/index.d.ts +1 -0
  51. package/dist/super-editor/src/core/super-converter/v3/handlers/w/wAfter/wAfter-translator.d.ts +6 -0
  52. package/dist/super-editor/src/core/super-converter/v3/handlers/w/wBefore/index.d.ts +1 -0
  53. package/dist/super-editor/src/core/super-converter/v3/handlers/w/wBefore/wBefore-translator.d.ts +6 -0
  54. package/dist/super-editor/src/core/super-converter/v3/node-translator/node-translator.d.ts +2 -1
  55. package/dist/super-editor/src/extensions/table-row/table-row.d.ts +149 -0
  56. package/dist/super-editor/style.css +6 -6
  57. package/dist/super-editor/super-editor.es.js +8 -8
  58. package/dist/super-editor/toolbar.es.js +2 -2
  59. package/dist/super-editor.cjs +1 -1
  60. package/dist/super-editor.es.js +1 -1
  61. package/dist/superdoc.cjs +2 -2
  62. package/dist/superdoc.es.js +2 -2
  63. package/dist/superdoc.umd.js +608 -213
  64. package/dist/superdoc.umd.js.map +1 -1
  65. package/package.json +1 -1
@@ -25601,37 +25601,37 @@ const _NodeTranslator = class _NodeTranslator {
25601
25601
  /** @type {typeof TranslatorTypes} */
25602
25602
  __publicField(_NodeTranslator, "translatorTypes", TranslatorTypes);
25603
25603
  let NodeTranslator = _NodeTranslator;
25604
- const encode$g = (attributes) => {
25604
+ const encode$i = (attributes) => {
25605
25605
  return attributes["w:type"];
25606
25606
  };
25607
- const decode$g = (attrs) => {
25607
+ const decode$i = (attrs) => {
25608
25608
  const { lineBreakType } = attrs;
25609
25609
  return lineBreakType;
25610
25610
  };
25611
25611
  const attrConfig$b = Object.freeze({
25612
25612
  xmlName: "w:type",
25613
25613
  sdName: "lineBreakType",
25614
- encode: encode$g,
25615
- decode: decode$g
25614
+ encode: encode$i,
25615
+ decode: decode$i
25616
25616
  });
25617
- const encode$f = (attributes) => {
25617
+ const encode$h = (attributes) => {
25618
25618
  const xmlAttrValue = attributes["w:clear"];
25619
25619
  return xmlAttrValue;
25620
25620
  };
25621
- const decode$f = (attrs) => {
25621
+ const decode$h = (attrs) => {
25622
25622
  const { clear } = attrs;
25623
25623
  return clear;
25624
25624
  };
25625
25625
  const attrConfig$a = Object.freeze({
25626
25626
  xmlName: "w:clear",
25627
25627
  sdName: "clear",
25628
- encode: encode$f,
25629
- decode: decode$f
25628
+ encode: encode$h,
25629
+ decode: decode$h
25630
25630
  });
25631
- const validXmlAttributes$4 = [attrConfig$b, attrConfig$a];
25632
- const XML_NODE_NAME$4 = "w:br";
25633
- const SD_NODE_NAME$4 = "lineBreak";
25634
- const encode$e = (_2, encodedAttrs) => {
25631
+ const validXmlAttributes$5 = [attrConfig$b, attrConfig$a];
25632
+ const XML_NODE_NAME$6 = "w:br";
25633
+ const SD_NODE_NAME$5 = "lineBreak";
25634
+ const encode$g = (_2, encodedAttrs) => {
25635
25635
  const isPageBreak = encodedAttrs?.lineBreakType === "page";
25636
25636
  const translated = {
25637
25637
  type: isPageBreak ? "hardBreak" : "lineBreak"
@@ -25641,7 +25641,7 @@ const encode$e = (_2, encodedAttrs) => {
25641
25641
  }
25642
25642
  return translated;
25643
25643
  };
25644
- const decode$e = (params, decodedAttrs) => {
25644
+ const decode$g = (params, decodedAttrs) => {
25645
25645
  const { node: node2 } = params;
25646
25646
  if (!node2) return;
25647
25647
  const wBreak = { name: "w:br" };
@@ -25658,63 +25658,63 @@ const decode$e = (params, decodedAttrs) => {
25658
25658
  };
25659
25659
  return translated;
25660
25660
  };
25661
- const config$4 = {
25662
- xmlName: XML_NODE_NAME$4,
25663
- sdNodeOrKeyName: SD_NODE_NAME$4,
25661
+ const config$6 = {
25662
+ xmlName: XML_NODE_NAME$6,
25663
+ sdNodeOrKeyName: SD_NODE_NAME$5,
25664
25664
  type: NodeTranslator.translatorTypes.NODE,
25665
- encode: encode$e,
25666
- decode: decode$e,
25667
- attributes: validXmlAttributes$4
25665
+ encode: encode$g,
25666
+ decode: decode$g,
25667
+ attributes: validXmlAttributes$5
25668
25668
  };
25669
- const translator$4 = NodeTranslator.from(config$4);
25670
- const encode$d = (attributes) => {
25669
+ const translator$i = NodeTranslator.from(config$6);
25670
+ const encode$f = (attributes) => {
25671
25671
  return attributes["w:val"];
25672
25672
  };
25673
- const decode$d = (attrs) => {
25673
+ const decode$f = (attrs) => {
25674
25674
  const { tabSize } = attrs || {};
25675
25675
  return tabSize;
25676
25676
  };
25677
25677
  const attrConfig$9 = Object.freeze({
25678
25678
  xmlName: "w:val",
25679
25679
  sdName: "tabSize",
25680
- encode: encode$d,
25681
- decode: decode$d
25680
+ encode: encode$f,
25681
+ decode: decode$f
25682
25682
  });
25683
- const encode$c = (attributes) => {
25683
+ const encode$e = (attributes) => {
25684
25684
  return attributes["w:leader"];
25685
25685
  };
25686
- const decode$c = (attrs) => {
25686
+ const decode$e = (attrs) => {
25687
25687
  const { leader } = attrs || {};
25688
25688
  return leader;
25689
25689
  };
25690
25690
  const attrConfig$8 = Object.freeze({
25691
25691
  xmlName: "w:leader",
25692
25692
  sdName: "leader",
25693
- encode: encode$c,
25694
- decode: decode$c
25693
+ encode: encode$e,
25694
+ decode: decode$e
25695
25695
  });
25696
- const encode$b = (attributes) => {
25696
+ const encode$d = (attributes) => {
25697
25697
  return attributes["w:pos"];
25698
25698
  };
25699
- const decode$b = (attrs) => {
25699
+ const decode$d = (attrs) => {
25700
25700
  const { pos } = attrs || {};
25701
25701
  return pos;
25702
25702
  };
25703
25703
  const attrConfig$7 = Object.freeze({
25704
25704
  xmlName: "w:pos",
25705
25705
  sdName: "pos",
25706
- encode: encode$b,
25707
- decode: decode$b
25706
+ encode: encode$d,
25707
+ decode: decode$d
25708
25708
  });
25709
- const validXmlAttributes$3 = [attrConfig$9, attrConfig$7, attrConfig$8];
25710
- const XML_NODE_NAME$3 = "w:tab";
25711
- const SD_NODE_NAME$3 = "tab";
25712
- const encode$a = (_2, encodedAttrs = {}) => {
25709
+ const validXmlAttributes$4 = [attrConfig$9, attrConfig$7, attrConfig$8];
25710
+ const XML_NODE_NAME$5 = "w:tab";
25711
+ const SD_NODE_NAME$4 = "tab";
25712
+ const encode$c = (_2, encodedAttrs = {}) => {
25713
25713
  const translated = { type: "tab" };
25714
25714
  if (encodedAttrs) translated.attrs = { ...encodedAttrs };
25715
25715
  return translated;
25716
25716
  };
25717
- const decode$a = (params, decodedAttrs = {}) => {
25717
+ const decode$c = (params, decodedAttrs = {}) => {
25718
25718
  const { node: node2 } = params || {};
25719
25719
  if (!node2) return;
25720
25720
  const wTab = { name: "w:tab" };
@@ -25730,15 +25730,15 @@ const decode$a = (params, decodedAttrs = {}) => {
25730
25730
  }
25731
25731
  return translated;
25732
25732
  };
25733
- const config$3 = {
25734
- xmlName: XML_NODE_NAME$3,
25735
- sdNodeOrKeyName: SD_NODE_NAME$3,
25733
+ const config$5 = {
25734
+ xmlName: XML_NODE_NAME$5,
25735
+ sdNodeOrKeyName: SD_NODE_NAME$4,
25736
25736
  type: NodeTranslator.translatorTypes.NODE,
25737
- encode: encode$a,
25738
- decode: decode$a,
25739
- attributes: validXmlAttributes$3
25737
+ encode: encode$c,
25738
+ decode: decode$c,
25739
+ attributes: validXmlAttributes$4
25740
25740
  };
25741
- const translator$3 = NodeTranslator.from(config$3);
25741
+ const translator$h = NodeTranslator.from(config$5);
25742
25742
  const mergeTextNodes = (nodes) => {
25743
25743
  if (!nodes || !Array.isArray(nodes)) {
25744
25744
  return nodes;
@@ -26308,91 +26308,91 @@ const handleParagraphNode$1 = (params) => {
26308
26308
  }
26309
26309
  return schemaNode;
26310
26310
  };
26311
- const encode$9 = (attributes) => {
26311
+ const encode$b = (attributes) => {
26312
26312
  return attributes["w:rsidDel"];
26313
26313
  };
26314
- const decode$9 = (attrs) => {
26314
+ const decode$b = (attrs) => {
26315
26315
  return attrs.rsidDel;
26316
26316
  };
26317
26317
  const attrConfig$6 = Object.freeze({
26318
26318
  xmlName: "w:rsidDel",
26319
26319
  sdName: "rsidDel",
26320
- encode: encode$9,
26321
- decode: decode$9
26320
+ encode: encode$b,
26321
+ decode: decode$b
26322
26322
  });
26323
- const encode$8 = (attributes) => {
26323
+ const encode$a = (attributes) => {
26324
26324
  return attributes["w:rsidP"];
26325
26325
  };
26326
- const decode$8 = (attrs) => {
26326
+ const decode$a = (attrs) => {
26327
26327
  return attrs.rsidP;
26328
26328
  };
26329
26329
  const attrConfig$5 = Object.freeze({
26330
26330
  xmlName: "w:rsidP",
26331
26331
  sdName: "rsidP",
26332
- encode: encode$8,
26333
- decode: decode$8
26332
+ encode: encode$a,
26333
+ decode: decode$a
26334
26334
  });
26335
- const encode$7 = (attributes) => {
26335
+ const encode$9 = (attributes) => {
26336
26336
  return attributes["w:rsidR"];
26337
26337
  };
26338
- const decode$7 = (attrs) => {
26338
+ const decode$9 = (attrs) => {
26339
26339
  return attrs.rsidR;
26340
26340
  };
26341
26341
  const attrConfig$4 = Object.freeze({
26342
26342
  xmlName: "w:rsidR",
26343
26343
  sdName: "rsidR",
26344
- encode: encode$7,
26345
- decode: decode$7
26344
+ encode: encode$9,
26345
+ decode: decode$9
26346
26346
  });
26347
- const encode$6 = (attributes) => {
26347
+ const encode$8 = (attributes) => {
26348
26348
  return attributes["w:rsidRPr"];
26349
26349
  };
26350
- const decode$6 = (attrs) => {
26350
+ const decode$8 = (attrs) => {
26351
26351
  return attrs.rsidRPr;
26352
26352
  };
26353
26353
  const attrConfig$3 = Object.freeze({
26354
26354
  xmlName: "w:rsidRPr",
26355
26355
  sdName: "rsidRPr",
26356
- encode: encode$6,
26357
- decode: decode$6
26356
+ encode: encode$8,
26357
+ decode: decode$8
26358
26358
  });
26359
- const encode$5 = (attributes) => {
26359
+ const encode$7 = (attributes) => {
26360
26360
  return attributes["w:rsidRDefault"];
26361
26361
  };
26362
- const decode$5 = (attrs) => {
26362
+ const decode$7 = (attrs) => {
26363
26363
  return attrs.rsidRDefault;
26364
26364
  };
26365
26365
  const attrConfig$2 = Object.freeze({
26366
26366
  xmlName: "w:rsidRDefault",
26367
26367
  sdName: "rsidRDefault",
26368
- encode: encode$5,
26369
- decode: decode$5
26368
+ encode: encode$7,
26369
+ decode: decode$7
26370
26370
  });
26371
- const encode$4 = (attributes) => {
26371
+ const encode$6 = (attributes) => {
26372
26372
  return attributes["w14:paraId"];
26373
26373
  };
26374
- const decode$4 = (attrs) => {
26374
+ const decode$6 = (attrs) => {
26375
26375
  return attrs.paraId;
26376
26376
  };
26377
26377
  const attrConfig$1 = Object.freeze({
26378
26378
  xmlName: "w14:paraId",
26379
26379
  sdName: "paraId",
26380
- encode: encode$4,
26381
- decode: decode$4
26380
+ encode: encode$6,
26381
+ decode: decode$6
26382
26382
  });
26383
- const encode$3 = (attributes) => {
26383
+ const encode$5 = (attributes) => {
26384
26384
  return attributes["w14:textId"];
26385
26385
  };
26386
- const decode$3 = (attrs) => {
26386
+ const decode$5 = (attrs) => {
26387
26387
  return attrs.textId;
26388
26388
  };
26389
26389
  const attrConfig = Object.freeze({
26390
26390
  xmlName: "w14:textId",
26391
26391
  sdName: "textId",
26392
- encode: encode$3,
26393
- decode: decode$3
26392
+ encode: encode$5,
26393
+ decode: decode$5
26394
26394
  });
26395
- const validXmlAttributes$2 = [
26395
+ const validXmlAttributes$3 = [
26396
26396
  attrConfig$1,
26397
26397
  attrConfig,
26398
26398
  attrConfig$4,
@@ -26401,9 +26401,9 @@ const validXmlAttributes$2 = [
26401
26401
  attrConfig$3,
26402
26402
  attrConfig$6
26403
26403
  ];
26404
- const XML_NODE_NAME$2 = "w:p";
26405
- const SD_NODE_NAME$2 = "paragraph";
26406
- const encode$2 = (params, encodedAttrs = {}) => {
26404
+ const XML_NODE_NAME$4 = "w:p";
26405
+ const SD_NODE_NAME$3 = "paragraph";
26406
+ const encode$4 = (params, encodedAttrs = {}) => {
26407
26407
  const node2 = handleParagraphNode$1(params);
26408
26408
  if (!node2) return void 0;
26409
26409
  if (encodedAttrs && Object.keys(encodedAttrs).length) {
@@ -26411,7 +26411,7 @@ const encode$2 = (params, encodedAttrs = {}) => {
26411
26411
  }
26412
26412
  return node2;
26413
26413
  };
26414
- const decode$2 = (params, decodedAttrs = {}) => {
26414
+ const decode$4 = (params, decodedAttrs = {}) => {
26415
26415
  const translated = translateParagraphNode(params);
26416
26416
  if (!translated) return void 0;
26417
26417
  if (decodedAttrs && Object.keys(decodedAttrs).length) {
@@ -26419,6 +26419,356 @@ const decode$2 = (params, decodedAttrs = {}) => {
26419
26419
  }
26420
26420
  return translated;
26421
26421
  };
26422
+ const config$4 = {
26423
+ xmlName: XML_NODE_NAME$4,
26424
+ sdNodeOrKeyName: SD_NODE_NAME$3,
26425
+ type: NodeTranslator.translatorTypes.NODE,
26426
+ encode: encode$4,
26427
+ decode: decode$4,
26428
+ attributes: validXmlAttributes$3
26429
+ };
26430
+ const translator$g = NodeTranslator.from(config$4);
26431
+ const generateV2HandlerEntity = (handlerName, translator2) => ({
26432
+ handlerName,
26433
+ handler: (params) => {
26434
+ const { nodes } = params;
26435
+ if (nodes.length === 0 || nodes[0].name !== translator2.xmlName) {
26436
+ return { nodes: [], consumed: 0 };
26437
+ }
26438
+ const result = translator2.encode(params);
26439
+ if (!result) return { nodes: [], consumed: 0 };
26440
+ return {
26441
+ nodes: Array.isArray(result) ? result : [result],
26442
+ consumed: 1
26443
+ };
26444
+ }
26445
+ });
26446
+ function createSingleAttrPropertyHandler(xmlName, sdName = null, attrName = "w:val", transformEncode = null, transformDecode = null) {
26447
+ if (!sdName) sdName = xmlName.split(":")[1];
26448
+ if (!transformEncode) transformEncode = (v2) => v2;
26449
+ if (!transformDecode) transformDecode = (v2) => v2;
26450
+ return {
26451
+ xmlName,
26452
+ sdNodeOrKeyName: sdName,
26453
+ encode: ({ nodes }) => {
26454
+ return transformEncode(nodes[0].attributes[attrName]) ?? void 0;
26455
+ },
26456
+ decode: ({ node: node2 }) => {
26457
+ const value = node2.attrs?.[sdName] != null ? transformDecode(node2.attrs[sdName]) : void 0;
26458
+ return value != null ? { [attrName]: value } : void 0;
26459
+ }
26460
+ };
26461
+ }
26462
+ function createMeasurementPropertyHandler(xmlName, sdName = null) {
26463
+ if (!sdName) sdName = xmlName.split(":")[1];
26464
+ return {
26465
+ xmlName,
26466
+ sdNodeOrKeyName: sdName,
26467
+ attributes: [
26468
+ createAttributeHandler("w:w", "value", parseInteger, integerToString),
26469
+ createAttributeHandler("w:type")
26470
+ ],
26471
+ encode: (_2, encodedAttrs) => {
26472
+ return encodedAttrs["value"] != null ? encodedAttrs : void 0;
26473
+ },
26474
+ decode: function({ node: node2 }, _2) {
26475
+ const decodedAttrs = this.decodeAttributes({ node: { ...node2, attrs: node2.attrs[sdName] || {} } });
26476
+ return decodedAttrs["w:w"] != null ? decodedAttrs : void 0;
26477
+ }
26478
+ };
26479
+ }
26480
+ const createAttributeHandler = (xmlName, sdName = null, transformEncode = null, transformDecode = null) => {
26481
+ if (!transformEncode) transformEncode = (v2) => v2;
26482
+ if (!transformDecode) transformDecode = (v2) => v2;
26483
+ if (!sdName) sdName = xmlName.split(":")[1];
26484
+ return {
26485
+ xmlName,
26486
+ sdName,
26487
+ encode: (attributes) => transformEncode(attributes[xmlName]),
26488
+ decode: (attributes) => transformDecode(attributes[sdName])
26489
+ };
26490
+ };
26491
+ function encodeProperties(node2, translatorsByXmlName, asArray = false) {
26492
+ let attributes = asArray ? [] : {};
26493
+ node2.elements.forEach((el) => {
26494
+ const translator2 = translatorsByXmlName[el.name];
26495
+ if (translator2) {
26496
+ const encodedAttr = translator2.encode({ nodes: [el] });
26497
+ if (encodedAttr != null) {
26498
+ if (asArray) {
26499
+ attributes.push({ [translator2.sdNodeOrKeyName]: encodedAttr });
26500
+ } else {
26501
+ attributes[translator2.sdNodeOrKeyName] = encodedAttr;
26502
+ }
26503
+ }
26504
+ }
26505
+ });
26506
+ return attributes;
26507
+ }
26508
+ function decodeProperties(translatorsBySdName, properties) {
26509
+ const elements = [];
26510
+ Object.keys(properties).forEach((key) => {
26511
+ const translator2 = translatorsBySdName[key];
26512
+ if (translator2) {
26513
+ const attributes = translator2.decode({ node: { attrs: { [key]: properties[key] } } });
26514
+ if (attributes != null) {
26515
+ elements.push({ name: translator2.xmlName, attributes });
26516
+ }
26517
+ }
26518
+ });
26519
+ return elements;
26520
+ }
26521
+ const parseBoolean = (value) => ["1", "true"].includes(value);
26522
+ const parseInteger = (value) => {
26523
+ if (value == null) return void 0;
26524
+ const intValue = parseInt(value, 10);
26525
+ return isNaN(intValue) ? void 0 : intValue;
26526
+ };
26527
+ const integerToString = (value) => {
26528
+ const intValue = parseInteger(value);
26529
+ return intValue != void 0 ? String(intValue) : void 0;
26530
+ };
26531
+ const translator$f = NodeTranslator.from({
26532
+ xmlName: "w:cantSplit",
26533
+ sdNodeOrKeyName: "cantSplit",
26534
+ encode: ({ nodes }) => ["1", "true"].includes(nodes[0].attributes?.["w:val"] ?? "1"),
26535
+ decode: ({ node: node2 }) => node2.attrs?.cantSplit ? {} : void 0
26536
+ });
26537
+ const translator$e = NodeTranslator.from({
26538
+ xmlName: "w:cnfStyle",
26539
+ sdNodeOrKeyName: "cnfStyle",
26540
+ attributes: [
26541
+ "w:evenHBand",
26542
+ "w:evenVBand",
26543
+ "w:firstColumn",
26544
+ "w:firstRow",
26545
+ "w:firstRowFirstColumn",
26546
+ "w:firstRowLastColumn",
26547
+ "w:lastColumn",
26548
+ "w:lastRow",
26549
+ "w:lastRowFirstColumn",
26550
+ "w:lastRowLastColumn",
26551
+ "w:oddHBand",
26552
+ "w:oddVBand",
26553
+ "w:val"
26554
+ ].map((attr) => createAttributeHandler(attr)),
26555
+ encode: (_2, encodedAttrs) => {
26556
+ Object.keys(encodedAttrs).forEach((key) => {
26557
+ encodedAttrs[key] = ["1", "true"].includes(encodedAttrs[key]);
26558
+ });
26559
+ return Object.keys(encodedAttrs).length > 0 ? encodedAttrs : void 0;
26560
+ },
26561
+ decode: ({ node: node2 }) => {
26562
+ if (!node2.attrs?.cnfStyle) return;
26563
+ const cnfStyleAttrs = {};
26564
+ Object.entries(node2.attrs.cnfStyle).forEach(([key, value]) => {
26565
+ cnfStyleAttrs[`w:${key}`] = value ? "1" : "0";
26566
+ });
26567
+ return Object.keys(cnfStyleAttrs).length > 0 ? cnfStyleAttrs : void 0;
26568
+ }
26569
+ });
26570
+ const translator$d = NodeTranslator.from(createSingleAttrPropertyHandler("w:divId"));
26571
+ const translator$c = NodeTranslator.from(
26572
+ createSingleAttrPropertyHandler(
26573
+ "w:gridAfter",
26574
+ null,
26575
+ "w:val",
26576
+ (v2) => parseInteger(v2) ?? void 0,
26577
+ (v2) => integerToString(v2)
26578
+ )
26579
+ );
26580
+ const translator$b = NodeTranslator.from(
26581
+ createSingleAttrPropertyHandler(
26582
+ "w:gridBefore",
26583
+ null,
26584
+ "w:val",
26585
+ (v2) => parseInteger(v2) ?? void 0,
26586
+ (v2) => integerToString(v2)
26587
+ )
26588
+ );
26589
+ const translator$a = NodeTranslator.from({
26590
+ xmlName: "w:hidden",
26591
+ sdNodeOrKeyName: "hidden",
26592
+ encode: ({ nodes }) => parseBoolean(nodes[0].attributes?.["w:val"] ?? "1"),
26593
+ decode: ({ node: node2 }) => node2.attrs.hidden ? {} : void 0
26594
+ });
26595
+ const translator$9 = NodeTranslator.from(createSingleAttrPropertyHandler("w:jc"));
26596
+ const translator$8 = NodeTranslator.from(createMeasurementPropertyHandler("w:tblCellSpacing", "cellSpacing"));
26597
+ const translator$7 = NodeTranslator.from({
26598
+ xmlName: "w:tblHeader",
26599
+ sdNodeOrKeyName: "repeatHeader",
26600
+ encode: ({ nodes }) => parseBoolean(nodes[0].attributes?.["w:val"] ?? "1"),
26601
+ decode: ({ node: node2 }) => node2.attrs.repeatHeader ? {} : void 0
26602
+ });
26603
+ const translator$6 = NodeTranslator.from({
26604
+ xmlName: "w:trHeight",
26605
+ sdNodeOrKeyName: "rowHeight",
26606
+ encode: ({ nodes }) => {
26607
+ const heightAttrs = {};
26608
+ const val = nodes[0].attributes["w:val"];
26609
+ if (val) {
26610
+ heightAttrs["value"] = parseInt(val, 10);
26611
+ }
26612
+ const rule = nodes[0].attributes["w:hRule"];
26613
+ if (rule) {
26614
+ heightAttrs["rule"] = rule;
26615
+ }
26616
+ return Object.keys(heightAttrs).length > 0 ? heightAttrs : void 0;
26617
+ },
26618
+ decode: ({ node: node2 }) => {
26619
+ if (!node2.attrs?.rowHeight) return;
26620
+ const heightAttrs = {};
26621
+ if (typeof node2.attrs.rowHeight.value === "number" && !isNaN(node2.attrs.rowHeight.value)) {
26622
+ heightAttrs["w:val"] = String(node2.attrs.rowHeight.value);
26623
+ }
26624
+ if (node2.attrs.rowHeight.rule) {
26625
+ heightAttrs["w:hRule"] = node2.attrs.rowHeight.rule;
26626
+ }
26627
+ return Object.keys(heightAttrs).length > 0 ? heightAttrs : void 0;
26628
+ }
26629
+ });
26630
+ const translator$5 = NodeTranslator.from(createMeasurementPropertyHandler("w:wAfter"));
26631
+ const translator$4 = NodeTranslator.from(createMeasurementPropertyHandler("w:wBefore"));
26632
+ const XML_NODE_NAME$3 = "w:trPr";
26633
+ const SD_ATTR_KEY = "tableRowProperties";
26634
+ const encode$3 = (params) => {
26635
+ const { nodes } = params;
26636
+ const node2 = nodes[0];
26637
+ let attributes = {
26638
+ cantSplit: false,
26639
+ hidden: false,
26640
+ repeatHeader: false
26641
+ };
26642
+ attributes = {
26643
+ ...attributes,
26644
+ ...encodeProperties(node2, propertyTranslatorsByXmlName)
26645
+ };
26646
+ return {
26647
+ type: NodeTranslator.translatorTypes.ATTRIBUTE,
26648
+ xmlName: XML_NODE_NAME$3,
26649
+ sdNodeOrKeyName: SD_ATTR_KEY,
26650
+ attributes
26651
+ };
26652
+ };
26653
+ const decode$3 = (params) => {
26654
+ const { tableRowProperties = {} } = params.node.attrs || {};
26655
+ const elements = decodeProperties(propertyTranslatorsBySdName, tableRowProperties);
26656
+ const newNode = {
26657
+ name: "w:trPr",
26658
+ type: "element",
26659
+ attributes: {},
26660
+ elements
26661
+ };
26662
+ return newNode;
26663
+ };
26664
+ const propertyTranslators = [
26665
+ translator$f,
26666
+ translator$e,
26667
+ translator$d,
26668
+ translator$c,
26669
+ translator$b,
26670
+ translator$a,
26671
+ translator$9,
26672
+ translator$8,
26673
+ translator$7,
26674
+ translator$6,
26675
+ translator$5,
26676
+ translator$4
26677
+ ];
26678
+ const propertyTranslatorsByXmlName = {};
26679
+ propertyTranslators.forEach((translator2) => {
26680
+ propertyTranslatorsByXmlName[translator2.xmlName] = translator2;
26681
+ });
26682
+ const propertyTranslatorsBySdName = {};
26683
+ propertyTranslators.forEach((translator2) => {
26684
+ propertyTranslatorsBySdName[translator2.sdNodeOrKeyName] = translator2;
26685
+ });
26686
+ const config$3 = {
26687
+ xmlName: XML_NODE_NAME$3,
26688
+ sdNodeOrKeyName: SD_ATTR_KEY,
26689
+ type: NodeTranslator.translatorTypes.ATTRIBUTE,
26690
+ encode: encode$3,
26691
+ decode: decode$3
26692
+ };
26693
+ const translator$3 = NodeTranslator.from(config$3);
26694
+ const XML_NODE_NAME$2 = "w:tr";
26695
+ const SD_NODE_NAME$2 = "tableRow";
26696
+ const validXmlAttributes$2 = ["w:rsidDel", "w:rsidR", "w:rsidRPr", "w:rsidTr", "w14:paraId", "w14:textId"].map(
26697
+ (xmlName) => createAttributeHandler(xmlName)
26698
+ );
26699
+ const encode$2 = (params, encodedAttrs) => {
26700
+ const { row, table } = params.extraParams;
26701
+ let tableRowProperties = {};
26702
+ const tPr = row.elements.find((el) => el.name === "w:trPr");
26703
+ if (tPr) {
26704
+ ({ attributes: tableRowProperties } = translator$3.encode({
26705
+ ...params,
26706
+ nodes: [tPr]
26707
+ }));
26708
+ }
26709
+ encodedAttrs["tableRowProperties"] = Object.freeze(tableRowProperties);
26710
+ encodedAttrs["rowHeight"] = twipsToPixels(tableRowProperties["rowHeight"]?.value);
26711
+ encodedAttrs["cantSplit"] = tableRowProperties["cantSplit"];
26712
+ const gridColumnWidths = _getGridColumnWidths(table);
26713
+ const cellNodes = row.elements.filter((el) => el.name === "w:tc");
26714
+ let currentColumnIndex = 0;
26715
+ const content = cellNodes?.map((n) => {
26716
+ let columnWidth = gridColumnWidths?.[currentColumnIndex] || null;
26717
+ const result = translator$1.encode({
26718
+ ...params,
26719
+ extraParams: {
26720
+ ...params.extraParams,
26721
+ node: n,
26722
+ columnIndex: currentColumnIndex,
26723
+ columnWidth
26724
+ }
26725
+ });
26726
+ const tcPr = n.elements?.find((el) => el.name === "w:tcPr");
26727
+ const colspanTag = tcPr?.elements?.find((el) => el.name === "w:gridSpan");
26728
+ const colspan = parseInt(colspanTag?.attributes["w:val"] || 1, 10);
26729
+ currentColumnIndex += colspan;
26730
+ return result;
26731
+ }) || [];
26732
+ const newNode = {
26733
+ type: "tableRow",
26734
+ content,
26735
+ attrs: encodedAttrs
26736
+ };
26737
+ return newNode;
26738
+ };
26739
+ const _getGridColumnWidths = (tableNode) => {
26740
+ const tblGrid = tableNode.elements.find((el) => el.name === "w:tblGrid");
26741
+ if (!tblGrid) return [];
26742
+ const columnWidths = tblGrid?.elements?.flatMap((el) => {
26743
+ if (el.name !== "w:gridCol") return [];
26744
+ return twipsToPixels(el.attributes["w:w"]);
26745
+ }) || [];
26746
+ return columnWidths;
26747
+ };
26748
+ const decode$2 = (params, decodedAttrs) => {
26749
+ const { node: node2 } = params;
26750
+ const elements = translateChildNodes(params);
26751
+ if (node2.attrs?.tableRowProperties) {
26752
+ const tableRowProperties = { ...node2.attrs.tableRowProperties };
26753
+ if (node2.attrs.rowHeight != null) {
26754
+ const rowHeightPixels = twipsToPixels(node2.attrs.tableRowProperties["rowHeight"]?.value);
26755
+ if (rowHeightPixels !== node2.attrs.rowHeight) {
26756
+ tableRowProperties["rowHeight"] = { value: String(pixelsToTwips(node2.attrs["rowHeight"])) };
26757
+ }
26758
+ }
26759
+ tableRowProperties["cantSplit"] = node2.attrs["cantSplit"];
26760
+ const trPr = translator$3.decode({
26761
+ ...params,
26762
+ node: { ...node2, attrs: { ...node2.attrs, tableRowProperties } }
26763
+ });
26764
+ if (trPr) elements.unshift(trPr);
26765
+ }
26766
+ return {
26767
+ name: "w:tr",
26768
+ attributes: decodedAttrs || {},
26769
+ elements
26770
+ };
26771
+ };
26422
26772
  const config$2 = {
26423
26773
  xmlName: XML_NODE_NAME$2,
26424
26774
  sdNodeOrKeyName: SD_NODE_NAME$2,
@@ -26491,7 +26841,16 @@ function handleTableNode(node2, params) {
26491
26841
  attrs["borders"] = borderData;
26492
26842
  const content = [];
26493
26843
  rows.forEach((row) => {
26494
- const result = handleTableRowNode(row, node2, borderRowData, tblStyleTag, params);
26844
+ const result = translator$2.encode({
26845
+ ...params,
26846
+ nodes: [row],
26847
+ extraParams: {
26848
+ row,
26849
+ table: node2,
26850
+ rowBorders: borderRowData,
26851
+ styleTag: tblStyleTag
26852
+ }
26853
+ });
26495
26854
  if (result.content?.length) content.push(result);
26496
26855
  });
26497
26856
  return {
@@ -26500,31 +26859,6 @@ function handleTableNode(node2, params) {
26500
26859
  attrs
26501
26860
  };
26502
26861
  }
26503
- function handleTableCellNode$1({
26504
- params,
26505
- node: node2,
26506
- table,
26507
- row,
26508
- rowBorders,
26509
- styleTag,
26510
- columnIndex,
26511
- columnWidth = null
26512
- }) {
26513
- const translatorParams = {
26514
- ...params,
26515
- extraParams: {
26516
- node: node2,
26517
- table,
26518
- row,
26519
- rowBorders,
26520
- styleTag,
26521
- columnIndex,
26522
- columnWidth
26523
- }
26524
- };
26525
- const schemaNode = translator$1.encode(translatorParams);
26526
- return schemaNode;
26527
- }
26528
26862
  function getReferencedTableStyles(tblStyleTag, docx) {
26529
26863
  if (!tblStyleTag) return null;
26530
26864
  const stylesToReturn = {};
@@ -26605,50 +26939,6 @@ function processTableBorders(borderElements) {
26605
26939
  rowBorders
26606
26940
  };
26607
26941
  }
26608
- function handleTableRowNode(node2, table, rowBorders, styleTag, params) {
26609
- const attrs = {};
26610
- const tPr = node2.elements.find((el) => el.name === "w:trPr");
26611
- const rowHeightTag = tPr?.elements?.find((el) => el.name === "w:trHeight");
26612
- const rowHeight = rowHeightTag?.attributes["w:val"];
26613
- const cantSplitTag = tPr?.elements?.find((el) => el.name === "w:cantSplit");
26614
- if (cantSplitTag) {
26615
- attrs["cantSplit"] = true;
26616
- }
26617
- const borders = {};
26618
- if (rowBorders?.insideH) borders["bottom"] = rowBorders.insideH;
26619
- if (rowBorders?.insideV) borders["right"] = rowBorders.insideV;
26620
- attrs["borders"] = borders;
26621
- if (rowHeight) {
26622
- attrs["rowHeight"] = twipsToPixels(rowHeight);
26623
- }
26624
- const gridColumnWidths = getGridColumnWidths(table);
26625
- const cellNodes = node2.elements.filter((el) => el.name === "w:tc");
26626
- let currentColumnIndex = 0;
26627
- const content = cellNodes?.map((n) => {
26628
- let colWidth = gridColumnWidths?.[currentColumnIndex] || null;
26629
- const result = handleTableCellNode$1({
26630
- params,
26631
- node: n,
26632
- table,
26633
- row: node2,
26634
- rowBorders: borders,
26635
- styleTag,
26636
- columnIndex: currentColumnIndex,
26637
- columnWidth: colWidth
26638
- });
26639
- const tcPr = n.elements?.find((el) => el.name === "w:tcPr");
26640
- const colspanTag = tcPr?.elements?.find((el) => el.name === "w:gridSpan");
26641
- const colspan = parseInt(colspanTag?.attributes["w:val"] || 1, 10);
26642
- currentColumnIndex += colspan;
26643
- return result;
26644
- }) || [];
26645
- const newNode = {
26646
- type: "tableRow",
26647
- content,
26648
- attrs
26649
- };
26650
- return newNode;
26651
- }
26652
26942
  const getGridColumnWidths = (tableNode) => {
26653
26943
  const tblGrid = tableNode.elements.find((el) => el.name === "w:tblGrid");
26654
26944
  if (!tblGrid) return [];
@@ -26671,6 +26961,14 @@ function handleTableCellNode({
26671
26961
  const { docx, nodeListHandler: nodeListHandler2 } = params;
26672
26962
  const tcPr = node2.elements.find((el) => el.name === "w:tcPr");
26673
26963
  const borders = tcPr?.elements?.find((el) => el.name === "w:tcBorders");
26964
+ if (rowBorders?.insideH) {
26965
+ rowBorders["bottom"] = rowBorders.insideH;
26966
+ delete rowBorders.insideH;
26967
+ }
26968
+ if (rowBorders?.insideV) {
26969
+ rowBorders["right"] = rowBorders.insideV;
26970
+ delete rowBorders?.insideV;
26971
+ }
26674
26972
  const inlineBorders = processInlineCellBorders(borders, rowBorders);
26675
26973
  const gridColumnWidths = getGridColumnWidths(table);
26676
26974
  const tcWidth = tcPr?.elements?.find((el) => el.name === "w:tcW");
@@ -27071,19 +27369,19 @@ function exportSchemaToJson(params) {
27071
27369
  doc: translateDocumentNode,
27072
27370
  body: translateBodyNode,
27073
27371
  heading: translateHeadingNode,
27074
- paragraph: translator$2,
27372
+ paragraph: translator$g,
27075
27373
  text: translateTextNode,
27076
27374
  bulletList: translateList,
27077
27375
  orderedList: translateList,
27078
- lineBreak: translator$4,
27376
+ lineBreak: translator$i,
27079
27377
  table: translateTable,
27080
- tableRow: translateTableRow,
27378
+ tableRow: translator$2,
27081
27379
  tableCell: translator$1,
27082
27380
  bookmarkStart: translateBookmarkStart,
27083
27381
  fieldAnnotation: translateFieldAnnotation,
27084
- tab: translator$3,
27382
+ tab: translator$h,
27085
27383
  image: translateImageNode,
27086
- hardBreak: translator$4,
27384
+ hardBreak: translator$i,
27087
27385
  commentRangeStart: () => translateCommentNode(params, "Start"),
27088
27386
  commentRangeEnd: () => translateCommentNode(params, "End"),
27089
27387
  commentReference: () => null,
@@ -27863,36 +28161,6 @@ function generateTableGrid(node2, params) {
27863
28161
  elements
27864
28162
  };
27865
28163
  }
27866
- function translateTableRow(params) {
27867
- const elements = translateChildNodes(params);
27868
- const tableRowProperties = generateTableRowProperties(params.node);
27869
- if (tableRowProperties.elements.length) elements.unshift(tableRowProperties);
27870
- return {
27871
- name: "w:tr",
27872
- elements
27873
- };
27874
- }
27875
- function generateTableRowProperties(node2) {
27876
- const { attrs } = node2;
27877
- const elements = [];
27878
- const { rowHeight, rowHeightType } = attrs;
27879
- if (rowHeight) {
27880
- const attributes = { "w:val": pixelsToTwips(rowHeight) };
27881
- if (rowHeightType) attributes["w:hRule"] = rowHeightType;
27882
- const rowHeightElement = {
27883
- name: "w:trHeight",
27884
- attributes
27885
- };
27886
- elements.push(rowHeightElement);
27887
- }
27888
- if (attrs?.cantSplit) {
27889
- elements.push({ name: "w:cantSplit" });
27890
- }
27891
- return {
27892
- name: "w:trPr",
27893
- elements
27894
- };
27895
- }
27896
28164
  function translateBookmarkStart(params) {
27897
28165
  const bookmarkStartNode = {
27898
28166
  name: "w:bookmarkStart",
@@ -29112,21 +29380,6 @@ const trackChangeNodeHandlerEntity = {
29112
29380
  handlerName: "trackChangeNodeHandler",
29113
29381
  handler: handleTrackChangeNode
29114
29382
  };
29115
- const generateV2HandlerEntity = (handlerName, translator2) => ({
29116
- handlerName,
29117
- handler: (params) => {
29118
- const { nodes } = params;
29119
- if (nodes.length === 0 || nodes[0].name !== translator2.xmlName) {
29120
- return { nodes: [], consumed: 0 };
29121
- }
29122
- const result = translator2.encode(params);
29123
- if (!result) return { nodes: [], consumed: 0 };
29124
- return {
29125
- nodes: Array.isArray(result) ? result : [result],
29126
- consumed: 1
29127
- };
29128
- }
29129
- });
29130
29383
  const hyperlinkNodeHandlerEntity = generateV2HandlerEntity("hyperlinkNodeHandler", translator);
29131
29384
  const handleRunNode = (params) => {
29132
29385
  const { nodes, nodeListHandler: nodeListHandler2, parentStyleId, docx } = params;
@@ -29239,7 +29492,7 @@ const handleParagraphNode = (params) => {
29239
29492
  if (nodes.length === 0 || nodes[0].name !== "w:p") {
29240
29493
  return { nodes: [], consumed: 0 };
29241
29494
  }
29242
- const schemaNode = translator$2.encode(params);
29495
+ const schemaNode = translator$g.encode(params);
29243
29496
  const newNodes = schemaNode ? [schemaNode] : [];
29244
29497
  return { nodes: newNodes, consumed: 1 };
29245
29498
  };
@@ -29552,7 +29805,7 @@ const handler = (params) => {
29552
29805
  if (nodes.length === 0 || nodes[0].name !== "w:br") {
29553
29806
  return { nodes: [], consumed: 0 };
29554
29807
  }
29555
- const result = translator$4.encode(params);
29808
+ const result = translator$i.encode(params);
29556
29809
  if (!result) return { nodes: [], consumed: 0 };
29557
29810
  return {
29558
29811
  nodes: [result],
@@ -30248,7 +30501,7 @@ const handleTabNode = (params) => {
30248
30501
  if (!nodes.length || nodes[0].name !== "w:tab") {
30249
30502
  return { nodes: [], consumed: 0 };
30250
30503
  }
30251
- const node2 = translator$3.encode(params);
30504
+ const node2 = translator$h.encode(params);
30252
30505
  return { nodes: [node2], consumed: 1 };
30253
30506
  };
30254
30507
  const tabNodeEntityHandler = {
@@ -31329,9 +31582,9 @@ export {
31329
31582
  readFromClipboard as aC,
31330
31583
  handleClipboardPaste as aD,
31331
31584
  getFileObject as aE,
31332
- translator$2 as aF,
31333
- translator$3 as aG,
31334
- translator$4 as aH,
31585
+ translator$g as aF,
31586
+ translator$h as aG,
31587
+ translator$i as aH,
31335
31588
  _sfc_main as aI,
31336
31589
  hasSomeParentWithClass as aa,
31337
31590
  isActive as ab,