@harbour-enterprises/superdoc 1.0.0-beta.97 → 1.0.0-beta.99

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 (28) hide show
  1. package/dist/chunks/{PdfViewer-YvkZg201.cjs → PdfViewer-BtuTHUW7.cjs} +1 -1
  2. package/dist/chunks/{PdfViewer-BHcBfUWj.es.js → PdfViewer-DF-v5Yrr.es.js} +1 -1
  3. package/dist/chunks/{index-Pvlqsxge-IH3eauKE.cjs → index-BB0msI45-CPU6Ak2R.cjs} +1 -1
  4. package/dist/chunks/{index-Pvlqsxge-vW641SZt.es.js → index-BB0msI45-DUPBw4Bh.es.js} +1 -1
  5. package/dist/chunks/{index-DZ_AI-HW.cjs → index-BBu9BBvp.cjs} +5 -14
  6. package/dist/chunks/{index-DeQfFbTb.es.js → index-CJy3FxL7.es.js} +5 -14
  7. package/dist/chunks/{super-editor.es-BinyZw4F.es.js → super-editor.es-BiaFIbw-.es.js} +242 -160
  8. package/dist/chunks/{super-editor.es-BP3PKkwh.cjs → super-editor.es-C04sFzVD.cjs} +242 -160
  9. package/dist/style.css +6 -6
  10. package/dist/super-editor/ai-writer.es.js +2 -2
  11. package/dist/super-editor/chunks/{converter-BEVM5t3i.js → converter-B_cVJPnh.js} +1 -1
  12. package/dist/super-editor/chunks/{docx-zipper-vETk3IMG.js → docx-zipper-fPWx7kV0.js} +1 -1
  13. package/dist/super-editor/chunks/{editor-B8k1bwD_.js → editor-DS9z42Je.js} +243 -161
  14. package/dist/super-editor/chunks/{index-Pvlqsxge.js → index-BB0msI45.js} +1 -1
  15. package/dist/super-editor/chunks/{toolbar-j1GSUGWU.js → toolbar-aIFlIr6h.js} +2 -2
  16. package/dist/super-editor/converter.es.js +1 -1
  17. package/dist/super-editor/docx-zipper.es.js +2 -2
  18. package/dist/super-editor/editor.es.js +3 -3
  19. package/dist/super-editor/file-zipper.es.js +1 -1
  20. package/dist/super-editor/super-editor.es.js +6 -6
  21. package/dist/super-editor/toolbar.es.js +2 -2
  22. package/dist/super-editor.cjs +1 -1
  23. package/dist/super-editor.es.js +1 -1
  24. package/dist/superdoc.cjs +2 -2
  25. package/dist/superdoc.es.js +2 -2
  26. package/dist/superdoc.umd.js +246 -173
  27. package/dist/superdoc.umd.js.map +1 -1
  28. package/package.json +1 -1
@@ -42404,7 +42404,7 @@ const _SuperConverter = class _SuperConverter2 {
42404
42404
  static getStoredSuperdocVersion(docx) {
42405
42405
  return _SuperConverter2.getStoredCustomProperty(docx, "SuperdocVersion");
42406
42406
  }
42407
- static setStoredSuperdocVersion(docx = this.convertedXml, version2 = "1.0.0-beta.97") {
42407
+ static setStoredSuperdocVersion(docx = this.convertedXml, version2 = "1.0.0-beta.99") {
42408
42408
  return _SuperConverter2.setStoredCustomProperty(docx, "SuperdocVersion", version2, false);
42409
42409
  }
42410
42410
  /**
@@ -59622,7 +59622,7 @@ const isHeadless = (editor) => {
59622
59622
  const shouldSkipNodeView = (editor) => {
59623
59623
  return isHeadless(editor);
59624
59624
  };
59625
- const summaryVersion = "1.0.0-beta.97";
59625
+ const summaryVersion = "1.0.0-beta.99";
59626
59626
  const nodeKeys = ["group", "content", "marks", "inline", "atom", "defining", "code", "tableRole", "summary"];
59627
59627
  const markKeys = ["group", "inclusive", "excludes", "spanning", "code"];
59628
59628
  function mapAttributes(attrs) {
@@ -60411,7 +60411,7 @@ const _Editor = class _Editor2 extends EventEmitter$1 {
60411
60411
  { default: remarkStringify },
60412
60412
  { default: remarkGfm }
60413
60413
  ] = await Promise.all([
60414
- import("./index-Pvlqsxge-vW641SZt.es.js"),
60414
+ import("./index-BB0msI45-DUPBw4Bh.es.js"),
60415
60415
  import("./index-DRCvimau-Cw339678.es.js"),
60416
60416
  import("./index-C_x_N6Uh-DJn8hIEt.es.js"),
60417
60417
  import("./index-D_sWOSiG-DE96TaT5.es.js"),
@@ -60616,7 +60616,7 @@ const _Editor = class _Editor2 extends EventEmitter$1 {
60616
60616
  * Process collaboration migrations
60617
60617
  */
60618
60618
  processCollaborationMigrations() {
60619
- console.debug("[checkVersionMigrations] Current editor version", "1.0.0-beta.97");
60619
+ console.debug("[checkVersionMigrations] Current editor version", "1.0.0-beta.99");
60620
60620
  if (!this.options.ydoc) return;
60621
60621
  const metaMap = this.options.ydoc.getMap("meta");
60622
60622
  let docVersion = metaMap.get("version");
@@ -62994,14 +62994,15 @@ function extractPageSizeAndOrientation(elements) {
62994
62994
  return { pageSizePx, orientation };
62995
62995
  }
62996
62996
  function extractFallbackMargins(elements, currentHeader, currentFooter) {
62997
- if (currentHeader !== void 0 && currentFooter !== void 0) {
62998
- return { headerPx: currentHeader, footerPx: currentFooter };
62999
- }
63000
62997
  const pgMar = elements.find((el) => el?.name === "w:pgMar");
63001
62998
  const a = pgMar?.attributes || {};
63002
62999
  return {
63003
63000
  headerPx: currentHeader ?? (a["w:header"] != null ? twipsToPixels$1(a["w:header"]) : void 0),
63004
- footerPx: currentFooter ?? (a["w:footer"] != null ? twipsToPixels$1(a["w:footer"]) : void 0)
63001
+ footerPx: currentFooter ?? (a["w:footer"] != null ? twipsToPixels$1(a["w:footer"]) : void 0),
63002
+ topPx: a["w:top"] != null ? twipsToPixels$1(a["w:top"]) : void 0,
63003
+ rightPx: a["w:right"] != null ? twipsToPixels$1(a["w:right"]) : void 0,
63004
+ bottomPx: a["w:bottom"] != null ? twipsToPixels$1(a["w:bottom"]) : void 0,
63005
+ leftPx: a["w:left"] != null ? twipsToPixels$1(a["w:left"]) : void 0
63005
63006
  };
63006
63007
  }
63007
63008
  function extractHeaderFooterRefs(elements, refName) {
@@ -63062,7 +63063,10 @@ function extractSectionData(para) {
63062
63063
  const type2 = extractSectionType(sectPrElements);
63063
63064
  const { pageSizePx, orientation } = extractPageSizeAndOrientation(sectPrElements);
63064
63065
  const titlePg = sectPrElements.some((el) => el?.name === "w:titlePg");
63065
- ({ headerPx, footerPx } = extractFallbackMargins(sectPrElements, headerPx, footerPx));
63066
+ const fallbackMargins = extractFallbackMargins(sectPrElements, headerPx, footerPx);
63067
+ headerPx = fallbackMargins.headerPx;
63068
+ footerPx = fallbackMargins.footerPx;
63069
+ const { topPx, rightPx, bottomPx, leftPx } = fallbackMargins;
63066
63070
  const headerRefs = extractHeaderFooterRefs(sectPrElements, "w:headerReference");
63067
63071
  const footerRefs = extractHeaderFooterRefs(sectPrElements, "w:footerReference");
63068
63072
  const numbering = extractPageNumbering(sectPrElements);
@@ -63071,6 +63075,10 @@ function extractSectionData(para) {
63071
63075
  return {
63072
63076
  headerPx,
63073
63077
  footerPx,
63078
+ topPx,
63079
+ rightPx,
63080
+ bottomPx,
63081
+ leftPx,
63074
63082
  type: type2,
63075
63083
  pageSizePx,
63076
63084
  orientation,
@@ -63182,7 +63190,14 @@ function buildSectionRangesFromParagraphs(paragraphs, hasBodySectPr) {
63182
63190
  startParagraphIndex: currentStart,
63183
63191
  endParagraphIndex: item.index,
63184
63192
  sectPr,
63185
- margins: sectionData.headerPx != null || sectionData.footerPx != null ? { header: sectionData.headerPx ?? 0, footer: sectionData.footerPx ?? 0 } : null,
63193
+ margins: sectionData.headerPx != null || sectionData.footerPx != null ? {
63194
+ header: sectionData.headerPx ?? 0,
63195
+ footer: sectionData.footerPx ?? 0,
63196
+ top: sectionData.topPx,
63197
+ right: sectionData.rightPx,
63198
+ bottom: sectionData.bottomPx,
63199
+ left: sectionData.leftPx
63200
+ } : null,
63186
63201
  pageSize: sectionData.pageSizePx ?? null,
63187
63202
  orientation: sectionData.orientation ?? null,
63188
63203
  columns: sectionData.columnsPx ?? null,
@@ -63224,7 +63239,14 @@ function createFinalSectionFromBodySectPr(bodySectPr, currentStart, totalParagra
63224
63239
  startParagraphIndex: currentStart,
63225
63240
  endParagraphIndex: totalParagraphs - 1,
63226
63241
  sectPr: bodySectPr,
63227
- margins: bodySectionData.headerPx != null || bodySectionData.footerPx != null ? { header: bodySectionData.headerPx ?? 0, footer: bodySectionData.footerPx ?? 0 } : null,
63242
+ margins: bodySectionData.headerPx != null || bodySectionData.footerPx != null ? {
63243
+ header: bodySectionData.headerPx ?? 0,
63244
+ footer: bodySectionData.footerPx ?? 0,
63245
+ top: bodySectionData.topPx,
63246
+ right: bodySectionData.rightPx,
63247
+ bottom: bodySectionData.bottomPx,
63248
+ left: bodySectionData.leftPx
63249
+ } : null,
63228
63250
  pageSize: bodySectionData.pageSizePx ?? null,
63229
63251
  orientation: bodySectionData.orientation ?? null,
63230
63252
  columns: bodySectionData.columnsPx ?? null,
@@ -69503,41 +69525,6 @@ const parseTableCell = (args) => {
69503
69525
  }
69504
69526
  }
69505
69527
  }
69506
- try {
69507
- const blockSummaries = blocks.map((b2) => {
69508
- if (b2.kind === "paragraph") {
69509
- const runs = b2.runs ?? [];
69510
- const attrs = b2.attrs ?? {};
69511
- return {
69512
- kind: "paragraph",
69513
- runKinds: runs.map((r2) => r2.kind ?? "text"),
69514
- runCount: runs.length,
69515
- runPreview: runs.map((r2) => {
69516
- const kind = r2.kind ?? "text";
69517
- if (kind === "image") {
69518
- const img = r2;
69519
- return { kind, src: img.src, width: img.width, height: img.height };
69520
- }
69521
- return { kind };
69522
- }),
69523
- hasNumbering: Boolean(attrs.numberingProperties),
69524
- markerText: attrs.wordLayout?.marker?.markerText
69525
- };
69526
- }
69527
- return { kind: b2.kind };
69528
- });
69529
- console.log(
69530
- "[tableNodeToBlock.parseTableCell] cell contents",
69531
- JSON.stringify({
69532
- cellIndex,
69533
- rowIndex,
69534
- cellIdPreview: `cell-${rowIndex}-${cellIndex}`,
69535
- childTypes: cellNode.content.map((c2) => c2?.type),
69536
- blocks: blockSummaries
69537
- })
69538
- );
69539
- } catch {
69540
- }
69541
69528
  if (blocks.length === 0) {
69542
69529
  return null;
69543
69530
  }
@@ -73402,20 +73389,6 @@ const renderTableCell = (deps) => {
73402
73389
  }
73403
73390
  const cellBlocks = cell?.blocks ?? (cell?.paragraph ? [cell.paragraph] : []);
73404
73391
  const blockMeasures = cellMeasure?.blocks ?? (cellMeasure?.paragraph ? [cellMeasure.paragraph] : []);
73405
- try {
73406
- console.log(
73407
- "[DomPainter.renderTableCell] cell render input",
73408
- JSON.stringify({
73409
- cellId: cell?.id,
73410
- blockKinds: cellBlocks.map((b2) => b2.kind),
73411
- measureKinds: blockMeasures.map((m2) => m2.kind),
73412
- width: cellMeasure?.width,
73413
- height: cellMeasure?.height,
73414
- rowHeight
73415
- })
73416
- );
73417
- } catch {
73418
- }
73419
73392
  if (cellBlocks.length > 0 && blockMeasures.length > 0) {
73420
73393
  const content = doc2.createElement("div");
73421
73394
  content.style.position = "relative";
@@ -73448,15 +73421,6 @@ const renderTableCell = (deps) => {
73448
73421
  const blockMeasure = blockMeasures[i];
73449
73422
  const block = cellBlocks[i];
73450
73423
  if (blockMeasure.kind === "image" && block?.kind === "image") {
73451
- console.log(
73452
- "[DomPainter.renderTableCell] rendering image block in cell",
73453
- JSON.stringify({
73454
- cellId: cell?.id,
73455
- blockId: block.id,
73456
- width: blockMeasure.width,
73457
- height: blockMeasure.height
73458
- })
73459
- );
73460
73424
  const imageWrapper = doc2.createElement("div");
73461
73425
  imageWrapper.style.position = "relative";
73462
73426
  imageWrapper.style.width = `${blockMeasure.width}px`;
@@ -73479,16 +73443,6 @@ const renderTableCell = (deps) => {
73479
73443
  continue;
73480
73444
  }
73481
73445
  if (blockMeasure.kind === "drawing" && block?.kind === "drawing") {
73482
- console.log(
73483
- "[DomPainter.renderTableCell] rendering drawing block in cell",
73484
- JSON.stringify({
73485
- cellId: cell?.id,
73486
- blockId: block.id,
73487
- drawingKind: block.drawingKind,
73488
- width: blockMeasure.width,
73489
- height: blockMeasure.height
73490
- })
73491
- );
73492
73446
  const drawingWrapper = doc2.createElement("div");
73493
73447
  drawingWrapper.style.position = "relative";
73494
73448
  drawingWrapper.style.width = `${blockMeasure.width}px`;
@@ -73531,20 +73485,6 @@ const renderTableCell = (deps) => {
73531
73485
  continue;
73532
73486
  }
73533
73487
  if (blockMeasure.kind === "paragraph" && block?.kind === "paragraph") {
73534
- try {
73535
- const runKinds = (block.runs ?? []).map((r2) => r2.kind ?? "text");
73536
- const imageRuns = (block.runs ?? []).filter((r2) => r2.kind === "image").map((r2) => ({ src: r2.src }));
73537
- console.log(
73538
- "[DomPainter.renderTableCell] rendering paragraph block in cell",
73539
- JSON.stringify({
73540
- cellId: cell?.id,
73541
- blockId: block.id,
73542
- runKinds,
73543
- imageRuns
73544
- })
73545
- );
73546
- } catch {
73547
- }
73548
73488
  const paragraphMeasure = blockMeasure;
73549
73489
  const lines = paragraphMeasure.lines;
73550
73490
  const blockLineCount = lines?.length || 0;
@@ -74467,6 +74407,61 @@ function ensureRulerStyles(doc2) {
74467
74407
  doc2.head?.appendChild(styleEl);
74468
74408
  rulerStylesInjected = true;
74469
74409
  }
74410
+ const hashParagraphBorder$1 = (border) => {
74411
+ const parts = [];
74412
+ if (border.style !== void 0) parts.push(`s:${border.style}`);
74413
+ if (border.width !== void 0) parts.push(`w:${border.width}`);
74414
+ if (border.color !== void 0) parts.push(`c:${border.color}`);
74415
+ if (border.space !== void 0) parts.push(`sp:${border.space}`);
74416
+ return parts.join(",");
74417
+ };
74418
+ const hashParagraphBorders$1 = (borders) => {
74419
+ const parts = [];
74420
+ if (borders.top) parts.push(`t:[${hashParagraphBorder$1(borders.top)}]`);
74421
+ if (borders.right) parts.push(`r:[${hashParagraphBorder$1(borders.right)}]`);
74422
+ if (borders.bottom) parts.push(`b:[${hashParagraphBorder$1(borders.bottom)}]`);
74423
+ if (borders.left) parts.push(`l:[${hashParagraphBorder$1(borders.left)}]`);
74424
+ return parts.join(";");
74425
+ };
74426
+ const hasStringProp = (run2, prop) => {
74427
+ return prop in run2 && typeof run2[prop] === "string";
74428
+ };
74429
+ const hasNumberProp = (run2, prop) => {
74430
+ return prop in run2 && typeof run2[prop] === "number";
74431
+ };
74432
+ const hasBooleanProp = (run2, prop) => {
74433
+ return prop in run2 && typeof run2[prop] === "boolean";
74434
+ };
74435
+ const getRunStringProp = (run2, prop) => {
74436
+ if (hasStringProp(run2, prop)) {
74437
+ return run2[prop];
74438
+ }
74439
+ return "";
74440
+ };
74441
+ const getRunNumberProp = (run2, prop) => {
74442
+ if (hasNumberProp(run2, prop)) {
74443
+ return run2[prop];
74444
+ }
74445
+ return 0;
74446
+ };
74447
+ const getRunBooleanProp = (run2, prop) => {
74448
+ if (hasBooleanProp(run2, prop)) {
74449
+ return run2[prop];
74450
+ }
74451
+ return false;
74452
+ };
74453
+ const getRunUnderlineStyle = (run2) => {
74454
+ if ("underline" in run2 && run2.underline && typeof run2.underline === "object") {
74455
+ return run2.underline.style ?? "";
74456
+ }
74457
+ return "";
74458
+ };
74459
+ const getRunUnderlineColor = (run2) => {
74460
+ if ("underline" in run2 && run2.underline && typeof run2.underline === "object") {
74461
+ return run2.underline.color ?? "";
74462
+ }
74463
+ return "";
74464
+ };
74470
74465
  function isMinimalWordLayout(value) {
74471
74466
  if (typeof value !== "object" || value === null) {
74472
74467
  return false;
@@ -75359,7 +75354,9 @@ const _DomPainter = class _DomPainter2 {
75359
75354
  const isTocEntry = block.attrs?.isTocEntry;
75360
75355
  const hasMarker = !fragment.continuesFromPrev && fragment.markerWidth && wordLayout?.marker;
75361
75356
  const hasSdtContainer = block.attrs?.sdt?.type === "documentSection" || block.attrs?.sdt?.type === "structuredContent" || block.attrs?.containerSdt?.type === "documentSection" || block.attrs?.containerSdt?.type === "structuredContent";
75362
- const styles = isTocEntry ? { ...fragmentStyles, whiteSpace: "nowrap" } : hasMarker || hasSdtContainer ? { ...fragmentStyles, overflow: "visible" } : fragmentStyles;
75357
+ const paraIndentForOverflow = block.attrs?.indent;
75358
+ const hasNegativeIndent = (paraIndentForOverflow?.left ?? 0) < 0 || (paraIndentForOverflow?.right ?? 0) < 0;
75359
+ const styles = isTocEntry ? { ...fragmentStyles, whiteSpace: "nowrap" } : hasMarker || hasSdtContainer || hasNegativeIndent ? { ...fragmentStyles, overflow: "visible" } : fragmentStyles;
75363
75360
  applyStyles$2(fragmentEl, styles);
75364
75361
  this.applyFragmentFrame(fragmentEl, fragment, context.section);
75365
75362
  if (isTocEntry) {
@@ -75388,6 +75385,8 @@ const _DomPainter = class _DomPainter2 {
75388
75385
  }
75389
75386
  if (fragmentEl.style.paddingLeft) fragmentEl.style.removeProperty("padding-left");
75390
75387
  if (fragmentEl.style.paddingRight) fragmentEl.style.removeProperty("padding-right");
75388
+ if (fragmentEl.style.marginLeft) fragmentEl.style.removeProperty("margin-left");
75389
+ if (fragmentEl.style.marginRight) fragmentEl.style.removeProperty("margin-right");
75391
75390
  if (fragmentEl.style.textIndent) fragmentEl.style.removeProperty("text-indent");
75392
75391
  const paraIndent = block.attrs?.indent;
75393
75392
  const paraIndentLeft = paraIndent?.left ?? 0;
@@ -75416,16 +75415,22 @@ const _DomPainter = class _DomPainter2 {
75416
75415
  if (!isListFirstLine) {
75417
75416
  if (hasExplicitSegmentPositioning) {
75418
75417
  if (isFirstLine && firstLineOffset !== 0) {
75419
- const adjustedPadding = paraIndentLeft + firstLineOffset;
75420
- lineEl.style.paddingLeft = `${adjustedPadding}px`;
75418
+ const effectiveLeftIndent = paraIndentLeft < 0 ? 0 : paraIndentLeft;
75419
+ const adjustedPadding = effectiveLeftIndent + firstLineOffset;
75420
+ if (adjustedPadding > 0) {
75421
+ lineEl.style.paddingLeft = `${adjustedPadding}px`;
75422
+ }
75421
75423
  }
75422
- } else if (paraIndentLeft) {
75424
+ } else if (paraIndentLeft && paraIndentLeft > 0) {
75423
75425
  lineEl.style.paddingLeft = `${paraIndentLeft}px`;
75426
+ } else if (!isFirstLine && paraIndent?.hanging && paraIndent.hanging > 0) {
75427
+ lineEl.style.paddingLeft = `${paraIndent.hanging}px`;
75424
75428
  }
75425
75429
  }
75426
- if (paraIndentRight) {
75430
+ if (paraIndentRight && paraIndentRight > 0) {
75427
75431
  lineEl.style.paddingRight = `${paraIndentRight}px`;
75428
75432
  }
75433
+ const hasNegativeLeftIndent = paraIndentLeft != null && paraIndentLeft < 0;
75429
75434
  if (!fragment.continuesFromPrev && index2 === 0 && firstLineOffset && !isListFirstLine) {
75430
75435
  if (!hasExplicitSegmentPositioning) {
75431
75436
  lineEl.style.textIndent = `${firstLineOffset}px`;
@@ -77536,7 +77541,7 @@ const deriveBlockVersion = (block) => {
77536
77541
  attrs.indent?.right ?? "",
77537
77542
  attrs.indent?.firstLine ?? "",
77538
77543
  attrs.indent?.hanging ?? "",
77539
- attrs.borders ? JSON.stringify(attrs.borders) : "",
77544
+ attrs.borders ? hashParagraphBorders$1(attrs.borders) : "",
77540
77545
  attrs.shading?.fill ?? "",
77541
77546
  attrs.shading?.color ?? "",
77542
77547
  attrs.direction ?? "",
@@ -77625,14 +77630,43 @@ const deriveBlockVersion = (block) => {
77625
77630
  for (const cellBlock of cellBlocks) {
77626
77631
  hash2 = hashString(hash2, cellBlock?.kind ?? "unknown");
77627
77632
  if (cellBlock?.kind === "paragraph") {
77628
- const runs = cellBlock.runs ?? [];
77633
+ const paragraphBlock = cellBlock;
77634
+ const runs = paragraphBlock.runs ?? [];
77629
77635
  hash2 = hashNumber(hash2, runs.length);
77636
+ const attrs = paragraphBlock.attrs;
77637
+ if (attrs) {
77638
+ hash2 = hashString(hash2, attrs.alignment ?? "");
77639
+ hash2 = hashNumber(hash2, attrs.spacing?.before ?? 0);
77640
+ hash2 = hashNumber(hash2, attrs.spacing?.after ?? 0);
77641
+ hash2 = hashNumber(hash2, attrs.spacing?.line ?? 0);
77642
+ hash2 = hashString(hash2, attrs.spacing?.lineRule ?? "");
77643
+ hash2 = hashNumber(hash2, attrs.indent?.left ?? 0);
77644
+ hash2 = hashNumber(hash2, attrs.indent?.right ?? 0);
77645
+ hash2 = hashNumber(hash2, attrs.indent?.firstLine ?? 0);
77646
+ hash2 = hashNumber(hash2, attrs.indent?.hanging ?? 0);
77647
+ hash2 = hashString(hash2, attrs.shading?.fill ?? "");
77648
+ hash2 = hashString(hash2, attrs.shading?.color ?? "");
77649
+ hash2 = hashString(hash2, attrs.direction ?? "");
77650
+ hash2 = hashString(hash2, attrs.rtl ? "1" : "");
77651
+ if (attrs.borders) {
77652
+ hash2 = hashString(hash2, hashParagraphBorders$1(attrs.borders));
77653
+ }
77654
+ }
77630
77655
  for (const run2 of runs) {
77631
77656
  if ("text" in run2 && typeof run2.text === "string") {
77632
77657
  hash2 = hashString(hash2, run2.text);
77633
77658
  }
77634
77659
  hash2 = hashNumber(hash2, run2.pmStart ?? -1);
77635
77660
  hash2 = hashNumber(hash2, run2.pmEnd ?? -1);
77661
+ hash2 = hashString(hash2, getRunStringProp(run2, "color"));
77662
+ hash2 = hashString(hash2, getRunStringProp(run2, "highlight"));
77663
+ hash2 = hashString(hash2, getRunBooleanProp(run2, "bold") ? "1" : "");
77664
+ hash2 = hashString(hash2, getRunBooleanProp(run2, "italic") ? "1" : "");
77665
+ hash2 = hashNumber(hash2, getRunNumberProp(run2, "fontSize"));
77666
+ hash2 = hashString(hash2, getRunStringProp(run2, "fontFamily"));
77667
+ hash2 = hashString(hash2, getRunUnderlineStyle(run2));
77668
+ hash2 = hashString(hash2, getRunUnderlineColor(run2));
77669
+ hash2 = hashString(hash2, getRunBooleanProp(run2, "strike") ? "1" : "");
77636
77670
  }
77637
77671
  }
77638
77672
  }
@@ -77710,15 +77744,18 @@ const applyParagraphBlockStyles = (element, attrs) => {
77710
77744
  }
77711
77745
  const indent = attrs.indent;
77712
77746
  if (indent) {
77713
- if (indent.left) {
77747
+ if (indent.left && indent.left > 0) {
77714
77748
  element.style.paddingLeft = `${indent.left}px`;
77715
77749
  }
77716
- if (indent.right) {
77750
+ if (indent.right && indent.right > 0) {
77717
77751
  element.style.paddingRight = `${indent.right}px`;
77718
77752
  }
77719
- const textIndent = (indent.firstLine ?? 0) - (indent.hanging ?? 0);
77720
- if (textIndent) {
77721
- element.style.textIndent = `${textIndent}px`;
77753
+ const hasNegativeLeftIndent = indent.left != null && indent.left < 0;
77754
+ if (!hasNegativeLeftIndent) {
77755
+ const textIndent = (indent.firstLine ?? 0) - (indent.hanging ?? 0);
77756
+ if (textIndent) {
77757
+ element.style.textIndent = `${textIndent}px`;
77758
+ }
77722
77759
  }
77723
77760
  }
77724
77761
  applyParagraphBorderStyles(element, attrs.borders);
@@ -79080,20 +79117,6 @@ const asSafeNumber = (value) => {
79080
79117
  }
79081
79118
  return value;
79082
79119
  };
79083
- function calculateFirstLineIndent(block, measure) {
79084
- const wordLayout = block.attrs?.wordLayout;
79085
- if (!wordLayout?.firstLineIndentMode) {
79086
- return 0;
79087
- }
79088
- if (!wordLayout.marker || !measure.marker) {
79089
- return 0;
79090
- }
79091
- const markerWidthRaw = measure.marker.markerWidth ?? wordLayout.marker.markerBoxWidthPx ?? 0;
79092
- const markerWidth = Number.isFinite(markerWidthRaw) && markerWidthRaw >= 0 ? markerWidthRaw : 0;
79093
- const gutterWidthRaw = measure.marker.gutterWidth ?? 0;
79094
- const gutterWidth = Number.isFinite(gutterWidthRaw) && gutterWidthRaw >= 0 ? gutterWidthRaw : 0;
79095
- return markerWidth + gutterWidth;
79096
- }
79097
79120
  function layoutParagraphBlock(ctx2, anchors) {
79098
79121
  const { block, measure, columnWidth, ensurePage, advanceColumn, columnX, floatManager } = ctx2;
79099
79122
  const remeasureParagraph2 = ctx2.remeasureParagraph;
@@ -79215,10 +79238,25 @@ function layoutParagraphBlock(ctx2, anchors) {
79215
79238
  }
79216
79239
  let lines = normalizeLines(measure);
79217
79240
  const measurementWidth = lines[0]?.maxWidth;
79241
+ const paraIndent = block.attrs?.indent;
79242
+ const indentLeft = typeof paraIndent?.left === "number" && Number.isFinite(paraIndent.left) ? paraIndent.left : 0;
79243
+ const indentRight = typeof paraIndent?.right === "number" && Number.isFinite(paraIndent.right) ? paraIndent.right : 0;
79244
+ const negativeLeftIndent = indentLeft < 0 ? indentLeft : 0;
79245
+ const negativeRightIndent = indentRight < 0 ? indentRight : 0;
79246
+ const remeasureWidth = Math.max(1, columnWidth - indentLeft - indentRight);
79218
79247
  let didRemeasureForColumnWidth = false;
79219
- if (typeof remeasureParagraph2 === "function" && typeof measurementWidth === "number" && measurementWidth > columnWidth) {
79220
- const firstLineIndent = calculateFirstLineIndent(block, measure);
79221
- const newMeasure = remeasureParagraph2(block, columnWidth, firstLineIndent);
79248
+ if (typeof remeasureParagraph2 === "function" && typeof measurementWidth === "number" && measurementWidth > remeasureWidth) {
79249
+ let firstLineIndent = 0;
79250
+ const wordLayout = block.attrs?.wordLayout;
79251
+ if (wordLayout?.marker && measure.marker) {
79252
+ const markerJustification = wordLayout.marker.justification ?? "left";
79253
+ if (markerJustification === "left") {
79254
+ const markerWidth = measure.marker.markerWidth ?? 0;
79255
+ const gutterWidth = measure.marker.gutterWidth ?? wordLayout.marker.gutterWidthPx ?? 0;
79256
+ firstLineIndent = markerWidth + gutterWidth;
79257
+ }
79258
+ }
79259
+ const newMeasure = remeasureParagraph2(block, remeasureWidth, firstLineIndent);
79222
79260
  lines = normalizeLines(newMeasure);
79223
79261
  didRemeasureForColumnWidth = true;
79224
79262
  }
@@ -79297,9 +79335,19 @@ function layoutParagraphBlock(ctx2, anchors) {
79297
79335
  }
79298
79336
  tempY += lineHeight2;
79299
79337
  }
79300
- if (narrowestWidth < columnWidth) {
79301
- const firstLineIndent = calculateFirstLineIndent(block, measure);
79302
- const newMeasure = remeasureParagraph2(block, narrowestWidth, firstLineIndent);
79338
+ const narrowestRemeasureWidth = Math.max(1, narrowestWidth - indentLeft - indentRight);
79339
+ if (narrowestRemeasureWidth < remeasureWidth) {
79340
+ let firstLineIndent = 0;
79341
+ const wordLayout = block.attrs?.wordLayout;
79342
+ if (wordLayout?.marker && measure.marker) {
79343
+ const markerJustification = wordLayout.marker.justification ?? "left";
79344
+ if (markerJustification === "left") {
79345
+ const markerWidth = measure.marker.markerWidth ?? 0;
79346
+ const gutterWidth = measure.marker.gutterWidth ?? wordLayout.marker.gutterWidthPx ?? 0;
79347
+ firstLineIndent = markerWidth + gutterWidth;
79348
+ }
79349
+ }
79350
+ const newMeasure = remeasureParagraph2(block, narrowestRemeasureWidth, firstLineIndent);
79303
79351
  lines = normalizeLines(newMeasure);
79304
79352
  didRemeasureForFloats = true;
79305
79353
  }
@@ -79353,14 +79401,16 @@ function layoutParagraphBlock(ctx2, anchors) {
79353
79401
  }
79354
79402
  const slice2 = sliceLines(lines, fromLine, state2.contentBottom - state2.cursorY);
79355
79403
  const fragmentHeight = slice2.height;
79404
+ const adjustedX = columnX(state2.columnIndex) + offsetX + negativeLeftIndent;
79405
+ const adjustedWidth = effectiveColumnWidth - negativeLeftIndent - negativeRightIndent;
79356
79406
  const fragment = {
79357
79407
  kind: "para",
79358
79408
  blockId: block.id,
79359
79409
  fromLine,
79360
79410
  toLine: slice2.toLine,
79361
- x: columnX(state2.columnIndex) + offsetX,
79411
+ x: adjustedX,
79362
79412
  y: state2.cursorY,
79363
- width: effectiveColumnWidth,
79413
+ width: adjustedWidth,
79364
79414
  ...computeFragmentPmRange(block, lines, fromLine, slice2.toLine)
79365
79415
  };
79366
79416
  if (didRemeasureForColumnWidth) {
@@ -81314,10 +81364,6 @@ const resolveTrackedChangesEnabled = (attrs, defaultEnabled = true) => {
81314
81364
  }
81315
81365
  return attrs.trackedChangesEnabled !== false;
81316
81366
  };
81317
- const MAX_CACHE_SIZE$1 = 1e4;
81318
- const BYTES_PER_ENTRY_ESTIMATE = 5e3;
81319
- const NORMALIZED_WHITESPACE = /\s+/g;
81320
- const normalizeText = (text) => text.replace(NORMALIZED_WHITESPACE, " ");
81321
81367
  const hashParagraphBorder = (border) => {
81322
81368
  const parts = [];
81323
81369
  if (border.style !== void 0) parts.push(`s:${border.style}`);
@@ -81334,6 +81380,10 @@ const hashParagraphBorders = (borders) => {
81334
81380
  if (borders.left) parts.push(`l:[${hashParagraphBorder(borders.left)}]`);
81335
81381
  return parts.join(";");
81336
81382
  };
81383
+ const MAX_CACHE_SIZE$1 = 1e4;
81384
+ const BYTES_PER_ENTRY_ESTIMATE = 5e3;
81385
+ const NORMALIZED_WHITESPACE = /\s+/g;
81386
+ const normalizeText = (text) => text.replace(NORMALIZED_WHITESPACE, " ");
81337
81387
  const hashParagraphFrame = (frame) => {
81338
81388
  const parts = [];
81339
81389
  if (frame.wrap !== void 0) parts.push(`w:${frame.wrap}`);
@@ -81370,12 +81420,14 @@ const hashRuns = (block) => {
81370
81420
  const color = "color" in run2 ? run2.color : void 0;
81371
81421
  const fontSize2 = "fontSize" in run2 ? run2.fontSize : void 0;
81372
81422
  const fontFamily2 = "fontFamily" in run2 ? run2.fontFamily : void 0;
81423
+ const highlight = "highlight" in run2 ? run2.highlight : void 0;
81373
81424
  const marks = [
81374
81425
  bold ? "b" : "",
81375
81426
  italic ? "i" : "",
81376
81427
  color ?? "",
81377
81428
  fontSize2 !== void 0 ? `fs:${fontSize2}` : "",
81378
- fontFamily2 ? `ff:${fontFamily2}` : ""
81429
+ fontFamily2 ? `ff:${fontFamily2}` : "",
81430
+ highlight ? `hl:${highlight}` : ""
81379
81431
  ].join("");
81380
81432
  let trackedKey = "";
81381
81433
  if (hasTrackedChange(run2)) {
@@ -81386,6 +81438,38 @@ const hashRuns = (block) => {
81386
81438
  }
81387
81439
  cellHashes.push(`${text}:${marks}${trackedKey}`);
81388
81440
  }
81441
+ if (paragraphBlock.attrs) {
81442
+ const attrs = paragraphBlock.attrs;
81443
+ const parts = [];
81444
+ if (attrs.alignment) parts.push(`al:${attrs.alignment}`);
81445
+ if (attrs.spacing) {
81446
+ const s2 = attrs.spacing;
81447
+ if (s2.before !== void 0) parts.push(`sb:${s2.before}`);
81448
+ if (s2.after !== void 0) parts.push(`sa:${s2.after}`);
81449
+ if (s2.line !== void 0) parts.push(`sl:${s2.line}`);
81450
+ if (s2.lineRule) parts.push(`sr:${s2.lineRule}`);
81451
+ }
81452
+ if (attrs.indent) {
81453
+ const ind = attrs.indent;
81454
+ if (ind.left !== void 0) parts.push(`il:${ind.left}`);
81455
+ if (ind.right !== void 0) parts.push(`ir:${ind.right}`);
81456
+ if (ind.firstLine !== void 0) parts.push(`if:${ind.firstLine}`);
81457
+ if (ind.hanging !== void 0) parts.push(`ih:${ind.hanging}`);
81458
+ }
81459
+ if (attrs.borders) {
81460
+ parts.push(`br:${hashParagraphBorders(attrs.borders)}`);
81461
+ }
81462
+ if (attrs.shading) {
81463
+ const sh = attrs.shading;
81464
+ if (sh.fill) parts.push(`shf:${sh.fill}`);
81465
+ if (sh.color) parts.push(`shc:${sh.color}`);
81466
+ }
81467
+ if (attrs.direction) parts.push(`dir:${attrs.direction}`);
81468
+ if (attrs.rtl) parts.push("rtl");
81469
+ if (parts.length > 0) {
81470
+ cellHashes.push(`pa:${parts.join(":")}`);
81471
+ }
81472
+ }
81389
81473
  }
81390
81474
  }
81391
81475
  }
@@ -81409,12 +81493,14 @@ const hashRuns = (block) => {
81409
81493
  const color = "color" in run2 ? run2.color : void 0;
81410
81494
  const fontSize2 = "fontSize" in run2 ? run2.fontSize : void 0;
81411
81495
  const fontFamily2 = "fontFamily" in run2 ? run2.fontFamily : void 0;
81496
+ const highlight = "highlight" in run2 ? run2.highlight : void 0;
81412
81497
  const marks = [
81413
81498
  bold ? "b" : "",
81414
81499
  italic ? "i" : "",
81415
81500
  color ?? "",
81416
81501
  fontSize2 !== void 0 ? `fs:${fontSize2}` : "",
81417
- fontFamily2 ? `ff:${fontFamily2}` : ""
81502
+ fontFamily2 ? `ff:${fontFamily2}` : "",
81503
+ highlight ? `hl:${highlight}` : ""
81418
81504
  ].join("");
81419
81505
  let trackedKey = "";
81420
81506
  if (hasTrackedChange(run2)) {
@@ -82541,7 +82627,7 @@ const paragraphBlocksEqual = (a, b2) => {
82541
82627
  for (let i = 0; i < a.runs.length; i += 1) {
82542
82628
  const runA = a.runs[i];
82543
82629
  const runB = b2.runs[i];
82544
- if (("src" in runA || runA.kind === "lineBreak" || runA.kind === "break" || runA.kind === "fieldAnnotation" ? "" : runA.text) !== ("src" in runB || runB.kind === "lineBreak" || runB.kind === "break" || runB.kind === "fieldAnnotation" ? "" : runB.text) || ("bold" in runA ? runA.bold : false) !== ("bold" in runB ? runB.bold : false) || ("italic" in runA ? runA.italic : false) !== ("italic" in runB ? runB.italic : false) || ("color" in runA ? runA.color : void 0) !== ("color" in runB ? runB.color : void 0) || ("fontSize" in runA ? runA.fontSize : void 0) !== ("fontSize" in runB ? runB.fontSize : void 0) || ("fontFamily" in runA ? runA.fontFamily : void 0) !== ("fontFamily" in runB ? runB.fontFamily : void 0) || getTrackedChangeKey(runA) !== getTrackedChangeKey(runB)) {
82630
+ if (("src" in runA || runA.kind === "lineBreak" || runA.kind === "break" || runA.kind === "fieldAnnotation" ? "" : runA.text) !== ("src" in runB || runB.kind === "lineBreak" || runB.kind === "break" || runB.kind === "fieldAnnotation" ? "" : runB.text) || ("bold" in runA ? runA.bold : false) !== ("bold" in runB ? runB.bold : false) || ("italic" in runA ? runA.italic : false) !== ("italic" in runB ? runB.italic : false) || ("color" in runA ? runA.color : void 0) !== ("color" in runB ? runB.color : void 0) || ("fontSize" in runA ? runA.fontSize : void 0) !== ("fontSize" in runB ? runB.fontSize : void 0) || ("fontFamily" in runA ? runA.fontFamily : void 0) !== ("fontFamily" in runB ? runB.fontFamily : void 0) || ("highlight" in runA ? runA.highlight : void 0) !== ("highlight" in runB ? runB.highlight : void 0) || getTrackedChangeKey(runA) !== getTrackedChangeKey(runB)) {
82545
82631
  return false;
82546
82632
  }
82547
82633
  }
@@ -83068,9 +83154,15 @@ async function incrementalLayout(previousBlocks, _previousLayout, nextBlocks, op
83068
83154
  }
83069
83155
  const DEFAULT_PAGE_SIZE$1 = { w: 612, h: 792 };
83070
83156
  const DEFAULT_MARGINS$1 = { top: 72, right: 72, bottom: 72, left: 72 };
83157
+ const normalizeMargin = (value, fallback) => Number.isFinite(value) ? value : fallback;
83071
83158
  function resolveMeasurementConstraints(options) {
83072
83159
  const pageSize = options.pageSize ?? DEFAULT_PAGE_SIZE$1;
83073
- const margins = options.margins ?? DEFAULT_MARGINS$1;
83160
+ const margins = {
83161
+ top: normalizeMargin(options.margins?.top, DEFAULT_MARGINS$1.top),
83162
+ right: normalizeMargin(options.margins?.right, DEFAULT_MARGINS$1.right),
83163
+ bottom: normalizeMargin(options.margins?.bottom, DEFAULT_MARGINS$1.bottom),
83164
+ left: normalizeMargin(options.margins?.left, DEFAULT_MARGINS$1.left)
83165
+ };
83074
83166
  const contentWidth = pageSize.w - (margins.left + margins.right);
83075
83167
  const contentHeight = pageSize.h - (margins.top + margins.bottom);
83076
83168
  const columns = options.columns;
@@ -84608,8 +84700,8 @@ async function measureParagraphBlock(block, maxWidth) {
84608
84700
  const lines = [];
84609
84701
  const indent = block.attrs?.indent;
84610
84702
  const spacing = block.attrs?.spacing;
84611
- const indentLeft = sanitizePositive(indent?.left);
84612
- const indentRight = sanitizePositive(indent?.right);
84703
+ const indentLeft = sanitizeIndent(indent?.left);
84704
+ const indentRight = sanitizeIndent(indent?.right);
84613
84705
  const firstLine = indent?.firstLine ?? 0;
84614
84706
  const hanging = indent?.hanging ?? 0;
84615
84707
  const isWordLayoutList = Boolean(wordLayout?.marker);
@@ -84618,10 +84710,10 @@ async function measureParagraphBlock(block, maxWidth) {
84618
84710
  const clampedFirstLineOffset = Math.max(0, rawFirstLineOffset);
84619
84711
  const firstLineOffset = isWordLayoutList ? 0 : clampedFirstLineOffset;
84620
84712
  const contentWidth = Math.max(1, maxWidth - indentLeft - indentRight);
84713
+ const bodyContentWidth = contentWidth;
84621
84714
  let initialAvailableWidth;
84622
84715
  const textStartPx = wordLayout?.textStartPx;
84623
- const treatAsHanging = isWordLayoutList && indentLeft === 0 && hanging === 0 && typeof textStartPx === "number";
84624
- if (typeof textStartPx === "number" && textStartPx > indentLeft && !treatAsHanging) {
84716
+ if (typeof textStartPx === "number" && textStartPx > indentLeft) {
84625
84717
  initialAvailableWidth = Math.max(1, maxWidth - textStartPx - indentRight);
84626
84718
  } else {
84627
84719
  initialAvailableWidth = Math.max(1, contentWidth - firstLineOffset);
@@ -84668,21 +84760,6 @@ async function measureParagraphBlock(block, maxWidth) {
84668
84760
  totalHeight: metrics.lineHeight
84669
84761
  };
84670
84762
  }
84671
- const isListLike = Boolean(block.attrs?.numId || wordLayout?.marker);
84672
- if (isListLike) {
84673
- console.log(
84674
- "[measureParagraph][list]",
84675
- JSON.stringify({
84676
- blockId: block.id,
84677
- maxWidth,
84678
- indentLeft,
84679
- indentRight,
84680
- textStartPx: textStartPx ?? null,
84681
- firstLineOffset: firstLineOffset ?? null,
84682
- initialAvailableWidth
84683
- })
84684
- );
84685
- }
84686
84763
  let currentLine = null;
84687
84764
  const getEffectiveWidth = (baseWidth) => {
84688
84765
  if (dropCapMeasure && lines.length < dropCapMeasure.lines && dropCapMeasure.mode === "drop") {
@@ -84828,7 +84905,7 @@ async function measureParagraphBlock(block, maxWidth) {
84828
84905
  lines.push(emptyLine);
84829
84906
  }
84830
84907
  const hadPreviousLine = lines.length > 0;
84831
- const nextLineMaxWidth = hadPreviousLine ? getEffectiveWidth(contentWidth) : getEffectiveWidth(initialAvailableWidth);
84908
+ const nextLineMaxWidth = hadPreviousLine ? getEffectiveWidth(bodyContentWidth) : getEffectiveWidth(initialAvailableWidth);
84832
84909
  currentLine = {
84833
84910
  fromRun: runIndex,
84834
84911
  fromChar: 0,
@@ -84939,7 +85016,7 @@ async function measureParagraphBlock(block, maxWidth) {
84939
85016
  toChar: 1,
84940
85017
  width: imageWidth,
84941
85018
  maxFontSize: imageHeight,
84942
- maxWidth: getEffectiveWidth(contentWidth),
85019
+ maxWidth: getEffectiveWidth(bodyContentWidth),
84943
85020
  spaceCount: 0,
84944
85021
  segments: [
84945
85022
  {
@@ -85028,7 +85105,7 @@ async function measureParagraphBlock(block, maxWidth) {
85028
85105
  toChar: 1,
85029
85106
  width: annotationWidth,
85030
85107
  maxFontSize: annotationHeight,
85031
- maxWidth: getEffectiveWidth(contentWidth),
85108
+ maxWidth: getEffectiveWidth(bodyContentWidth),
85032
85109
  spaceCount: 0,
85033
85110
  segments: [
85034
85111
  {
@@ -85110,7 +85187,7 @@ async function measureParagraphBlock(block, maxWidth) {
85110
85187
  width: spacesWidth,
85111
85188
  maxFontSize: run2.fontSize,
85112
85189
  maxFontInfo: getFontInfoFromRun(run2),
85113
- maxWidth: getEffectiveWidth(contentWidth),
85190
+ maxWidth: getEffectiveWidth(bodyContentWidth),
85114
85191
  segments: [{ runIndex, fromChar: spacesStartChar, toChar: spacesEndChar, width: spacesWidth }],
85115
85192
  spaceCount: spacesLength
85116
85193
  };
@@ -85173,7 +85250,7 @@ async function measureParagraphBlock(block, maxWidth) {
85173
85250
  width: singleSpaceWidth,
85174
85251
  maxFontSize: run2.fontSize,
85175
85252
  maxFontInfo: getFontInfoFromRun(run2),
85176
- maxWidth: getEffectiveWidth(contentWidth),
85253
+ maxWidth: getEffectiveWidth(bodyContentWidth),
85177
85254
  segments: [{ runIndex, fromChar: spaceStartChar, toChar: spaceEndChar, width: singleSpaceWidth }],
85178
85255
  spaceCount: 1
85179
85256
  };
@@ -85366,7 +85443,7 @@ async function measureParagraphBlock(block, maxWidth) {
85366
85443
  width: wordOnlyWidth,
85367
85444
  maxFontSize: run2.fontSize,
85368
85445
  maxFontInfo: getFontInfoFromRun(run2),
85369
- maxWidth: getEffectiveWidth(contentWidth),
85446
+ maxWidth: getEffectiveWidth(bodyContentWidth),
85370
85447
  segments: [{ runIndex, fromChar: wordStartChar, toChar: wordEndNoSpace, width: wordOnlyWidth }],
85371
85448
  spaceCount: 0
85372
85449
  };
@@ -85931,6 +86008,7 @@ const resolveLineHeight = (spacing, baseLineHeight) => {
85931
86008
  return Math.max(baseLineHeight, raw);
85932
86009
  };
85933
86010
  const sanitizePositive = (value) => typeof value === "number" && Number.isFinite(value) ? Math.max(0, value) : 0;
86011
+ const sanitizeIndent = (value) => typeof value === "number" && Number.isFinite(value) ? value : 0;
85934
86012
  const sanitizeDecimalSeparator = (value) => {
85935
86013
  if (value === ",") return ",";
85936
86014
  return DEFAULT_DECIMAL_SEPARATOR;
@@ -90479,6 +90557,10 @@ resolveLayoutOptions_fn = function(blocks, sectionMetadata) {
90479
90557
  const pageSize = firstSection?.pageSize ?? defaults.pageSize;
90480
90558
  const margins = {
90481
90559
  ...defaults.margins,
90560
+ ...firstSection?.margins?.top != null ? { top: firstSection.margins.top } : {},
90561
+ ...firstSection?.margins?.right != null ? { right: firstSection.margins.right } : {},
90562
+ ...firstSection?.margins?.bottom != null ? { bottom: firstSection.margins.bottom } : {},
90563
+ ...firstSection?.margins?.left != null ? { left: firstSection.margins.left } : {},
90482
90564
  ...firstSection?.margins?.header != null ? { header: firstSection.margins.header } : {},
90483
90565
  ...firstSection?.margins?.footer != null ? { footer: firstSection.margins.footer } : {}
90484
90566
  };