@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
@@ -42421,7 +42421,7 @@ const _SuperConverter = class _SuperConverter2 {
42421
42421
  static getStoredSuperdocVersion(docx) {
42422
42422
  return _SuperConverter2.getStoredCustomProperty(docx, "SuperdocVersion");
42423
42423
  }
42424
- static setStoredSuperdocVersion(docx = this.convertedXml, version2 = "1.0.0-beta.97") {
42424
+ static setStoredSuperdocVersion(docx = this.convertedXml, version2 = "1.0.0-beta.99") {
42425
42425
  return _SuperConverter2.setStoredCustomProperty(docx, "SuperdocVersion", version2, false);
42426
42426
  }
42427
42427
  /**
@@ -59639,7 +59639,7 @@ const isHeadless = (editor) => {
59639
59639
  const shouldSkipNodeView = (editor) => {
59640
59640
  return isHeadless(editor);
59641
59641
  };
59642
- const summaryVersion = "1.0.0-beta.97";
59642
+ const summaryVersion = "1.0.0-beta.99";
59643
59643
  const nodeKeys = ["group", "content", "marks", "inline", "atom", "defining", "code", "tableRole", "summary"];
59644
59644
  const markKeys = ["group", "inclusive", "excludes", "spanning", "code"];
59645
59645
  function mapAttributes(attrs) {
@@ -60428,7 +60428,7 @@ const _Editor = class _Editor2 extends EventEmitter$1 {
60428
60428
  { default: remarkStringify },
60429
60429
  { default: remarkGfm }
60430
60430
  ] = await Promise.all([
60431
- Promise.resolve().then(() => require("./index-Pvlqsxge-IH3eauKE.cjs")),
60431
+ Promise.resolve().then(() => require("./index-BB0msI45-CPU6Ak2R.cjs")),
60432
60432
  Promise.resolve().then(() => require("./index-DRCvimau-H4Ck3S9a.cjs")),
60433
60433
  Promise.resolve().then(() => require("./index-C_x_N6Uh-Db3CUJMX.cjs")),
60434
60434
  Promise.resolve().then(() => require("./index-D_sWOSiG-BtDZzJ6I.cjs")),
@@ -60633,7 +60633,7 @@ const _Editor = class _Editor2 extends EventEmitter$1 {
60633
60633
  * Process collaboration migrations
60634
60634
  */
60635
60635
  processCollaborationMigrations() {
60636
- console.debug("[checkVersionMigrations] Current editor version", "1.0.0-beta.97");
60636
+ console.debug("[checkVersionMigrations] Current editor version", "1.0.0-beta.99");
60637
60637
  if (!this.options.ydoc) return;
60638
60638
  const metaMap = this.options.ydoc.getMap("meta");
60639
60639
  let docVersion = metaMap.get("version");
@@ -63011,14 +63011,15 @@ function extractPageSizeAndOrientation(elements) {
63011
63011
  return { pageSizePx, orientation };
63012
63012
  }
63013
63013
  function extractFallbackMargins(elements, currentHeader, currentFooter) {
63014
- if (currentHeader !== void 0 && currentFooter !== void 0) {
63015
- return { headerPx: currentHeader, footerPx: currentFooter };
63016
- }
63017
63014
  const pgMar = elements.find((el) => el?.name === "w:pgMar");
63018
63015
  const a = pgMar?.attributes || {};
63019
63016
  return {
63020
63017
  headerPx: currentHeader ?? (a["w:header"] != null ? twipsToPixels$1(a["w:header"]) : void 0),
63021
- footerPx: currentFooter ?? (a["w:footer"] != null ? twipsToPixels$1(a["w:footer"]) : void 0)
63018
+ footerPx: currentFooter ?? (a["w:footer"] != null ? twipsToPixels$1(a["w:footer"]) : void 0),
63019
+ topPx: a["w:top"] != null ? twipsToPixels$1(a["w:top"]) : void 0,
63020
+ rightPx: a["w:right"] != null ? twipsToPixels$1(a["w:right"]) : void 0,
63021
+ bottomPx: a["w:bottom"] != null ? twipsToPixels$1(a["w:bottom"]) : void 0,
63022
+ leftPx: a["w:left"] != null ? twipsToPixels$1(a["w:left"]) : void 0
63022
63023
  };
63023
63024
  }
63024
63025
  function extractHeaderFooterRefs(elements, refName) {
@@ -63079,7 +63080,10 @@ function extractSectionData(para) {
63079
63080
  const type2 = extractSectionType(sectPrElements);
63080
63081
  const { pageSizePx, orientation } = extractPageSizeAndOrientation(sectPrElements);
63081
63082
  const titlePg = sectPrElements.some((el) => el?.name === "w:titlePg");
63082
- ({ headerPx, footerPx } = extractFallbackMargins(sectPrElements, headerPx, footerPx));
63083
+ const fallbackMargins = extractFallbackMargins(sectPrElements, headerPx, footerPx);
63084
+ headerPx = fallbackMargins.headerPx;
63085
+ footerPx = fallbackMargins.footerPx;
63086
+ const { topPx, rightPx, bottomPx, leftPx } = fallbackMargins;
63083
63087
  const headerRefs = extractHeaderFooterRefs(sectPrElements, "w:headerReference");
63084
63088
  const footerRefs = extractHeaderFooterRefs(sectPrElements, "w:footerReference");
63085
63089
  const numbering = extractPageNumbering(sectPrElements);
@@ -63088,6 +63092,10 @@ function extractSectionData(para) {
63088
63092
  return {
63089
63093
  headerPx,
63090
63094
  footerPx,
63095
+ topPx,
63096
+ rightPx,
63097
+ bottomPx,
63098
+ leftPx,
63091
63099
  type: type2,
63092
63100
  pageSizePx,
63093
63101
  orientation,
@@ -63199,7 +63207,14 @@ function buildSectionRangesFromParagraphs(paragraphs, hasBodySectPr) {
63199
63207
  startParagraphIndex: currentStart,
63200
63208
  endParagraphIndex: item.index,
63201
63209
  sectPr,
63202
- margins: sectionData.headerPx != null || sectionData.footerPx != null ? { header: sectionData.headerPx ?? 0, footer: sectionData.footerPx ?? 0 } : null,
63210
+ margins: sectionData.headerPx != null || sectionData.footerPx != null ? {
63211
+ header: sectionData.headerPx ?? 0,
63212
+ footer: sectionData.footerPx ?? 0,
63213
+ top: sectionData.topPx,
63214
+ right: sectionData.rightPx,
63215
+ bottom: sectionData.bottomPx,
63216
+ left: sectionData.leftPx
63217
+ } : null,
63203
63218
  pageSize: sectionData.pageSizePx ?? null,
63204
63219
  orientation: sectionData.orientation ?? null,
63205
63220
  columns: sectionData.columnsPx ?? null,
@@ -63241,7 +63256,14 @@ function createFinalSectionFromBodySectPr(bodySectPr, currentStart, totalParagra
63241
63256
  startParagraphIndex: currentStart,
63242
63257
  endParagraphIndex: totalParagraphs - 1,
63243
63258
  sectPr: bodySectPr,
63244
- margins: bodySectionData.headerPx != null || bodySectionData.footerPx != null ? { header: bodySectionData.headerPx ?? 0, footer: bodySectionData.footerPx ?? 0 } : null,
63259
+ margins: bodySectionData.headerPx != null || bodySectionData.footerPx != null ? {
63260
+ header: bodySectionData.headerPx ?? 0,
63261
+ footer: bodySectionData.footerPx ?? 0,
63262
+ top: bodySectionData.topPx,
63263
+ right: bodySectionData.rightPx,
63264
+ bottom: bodySectionData.bottomPx,
63265
+ left: bodySectionData.leftPx
63266
+ } : null,
63245
63267
  pageSize: bodySectionData.pageSizePx ?? null,
63246
63268
  orientation: bodySectionData.orientation ?? null,
63247
63269
  columns: bodySectionData.columnsPx ?? null,
@@ -69520,41 +69542,6 @@ const parseTableCell = (args) => {
69520
69542
  }
69521
69543
  }
69522
69544
  }
69523
- try {
69524
- const blockSummaries = blocks.map((b2) => {
69525
- if (b2.kind === "paragraph") {
69526
- const runs = b2.runs ?? [];
69527
- const attrs = b2.attrs ?? {};
69528
- return {
69529
- kind: "paragraph",
69530
- runKinds: runs.map((r2) => r2.kind ?? "text"),
69531
- runCount: runs.length,
69532
- runPreview: runs.map((r2) => {
69533
- const kind = r2.kind ?? "text";
69534
- if (kind === "image") {
69535
- const img = r2;
69536
- return { kind, src: img.src, width: img.width, height: img.height };
69537
- }
69538
- return { kind };
69539
- }),
69540
- hasNumbering: Boolean(attrs.numberingProperties),
69541
- markerText: attrs.wordLayout?.marker?.markerText
69542
- };
69543
- }
69544
- return { kind: b2.kind };
69545
- });
69546
- console.log(
69547
- "[tableNodeToBlock.parseTableCell] cell contents",
69548
- JSON.stringify({
69549
- cellIndex,
69550
- rowIndex,
69551
- cellIdPreview: `cell-${rowIndex}-${cellIndex}`,
69552
- childTypes: cellNode.content.map((c2) => c2?.type),
69553
- blocks: blockSummaries
69554
- })
69555
- );
69556
- } catch {
69557
- }
69558
69545
  if (blocks.length === 0) {
69559
69546
  return null;
69560
69547
  }
@@ -73419,20 +73406,6 @@ const renderTableCell = (deps) => {
73419
73406
  }
73420
73407
  const cellBlocks = cell?.blocks ?? (cell?.paragraph ? [cell.paragraph] : []);
73421
73408
  const blockMeasures = cellMeasure?.blocks ?? (cellMeasure?.paragraph ? [cellMeasure.paragraph] : []);
73422
- try {
73423
- console.log(
73424
- "[DomPainter.renderTableCell] cell render input",
73425
- JSON.stringify({
73426
- cellId: cell?.id,
73427
- blockKinds: cellBlocks.map((b2) => b2.kind),
73428
- measureKinds: blockMeasures.map((m2) => m2.kind),
73429
- width: cellMeasure?.width,
73430
- height: cellMeasure?.height,
73431
- rowHeight
73432
- })
73433
- );
73434
- } catch {
73435
- }
73436
73409
  if (cellBlocks.length > 0 && blockMeasures.length > 0) {
73437
73410
  const content = doc2.createElement("div");
73438
73411
  content.style.position = "relative";
@@ -73465,15 +73438,6 @@ const renderTableCell = (deps) => {
73465
73438
  const blockMeasure = blockMeasures[i];
73466
73439
  const block = cellBlocks[i];
73467
73440
  if (blockMeasure.kind === "image" && block?.kind === "image") {
73468
- console.log(
73469
- "[DomPainter.renderTableCell] rendering image block in cell",
73470
- JSON.stringify({
73471
- cellId: cell?.id,
73472
- blockId: block.id,
73473
- width: blockMeasure.width,
73474
- height: blockMeasure.height
73475
- })
73476
- );
73477
73441
  const imageWrapper = doc2.createElement("div");
73478
73442
  imageWrapper.style.position = "relative";
73479
73443
  imageWrapper.style.width = `${blockMeasure.width}px`;
@@ -73496,16 +73460,6 @@ const renderTableCell = (deps) => {
73496
73460
  continue;
73497
73461
  }
73498
73462
  if (blockMeasure.kind === "drawing" && block?.kind === "drawing") {
73499
- console.log(
73500
- "[DomPainter.renderTableCell] rendering drawing block in cell",
73501
- JSON.stringify({
73502
- cellId: cell?.id,
73503
- blockId: block.id,
73504
- drawingKind: block.drawingKind,
73505
- width: blockMeasure.width,
73506
- height: blockMeasure.height
73507
- })
73508
- );
73509
73463
  const drawingWrapper = doc2.createElement("div");
73510
73464
  drawingWrapper.style.position = "relative";
73511
73465
  drawingWrapper.style.width = `${blockMeasure.width}px`;
@@ -73548,20 +73502,6 @@ const renderTableCell = (deps) => {
73548
73502
  continue;
73549
73503
  }
73550
73504
  if (blockMeasure.kind === "paragraph" && block?.kind === "paragraph") {
73551
- try {
73552
- const runKinds = (block.runs ?? []).map((r2) => r2.kind ?? "text");
73553
- const imageRuns = (block.runs ?? []).filter((r2) => r2.kind === "image").map((r2) => ({ src: r2.src }));
73554
- console.log(
73555
- "[DomPainter.renderTableCell] rendering paragraph block in cell",
73556
- JSON.stringify({
73557
- cellId: cell?.id,
73558
- blockId: block.id,
73559
- runKinds,
73560
- imageRuns
73561
- })
73562
- );
73563
- } catch {
73564
- }
73565
73505
  const paragraphMeasure = blockMeasure;
73566
73506
  const lines = paragraphMeasure.lines;
73567
73507
  const blockLineCount = lines?.length || 0;
@@ -74484,6 +74424,61 @@ function ensureRulerStyles(doc2) {
74484
74424
  doc2.head?.appendChild(styleEl);
74485
74425
  rulerStylesInjected = true;
74486
74426
  }
74427
+ const hashParagraphBorder$1 = (border) => {
74428
+ const parts = [];
74429
+ if (border.style !== void 0) parts.push(`s:${border.style}`);
74430
+ if (border.width !== void 0) parts.push(`w:${border.width}`);
74431
+ if (border.color !== void 0) parts.push(`c:${border.color}`);
74432
+ if (border.space !== void 0) parts.push(`sp:${border.space}`);
74433
+ return parts.join(",");
74434
+ };
74435
+ const hashParagraphBorders$1 = (borders) => {
74436
+ const parts = [];
74437
+ if (borders.top) parts.push(`t:[${hashParagraphBorder$1(borders.top)}]`);
74438
+ if (borders.right) parts.push(`r:[${hashParagraphBorder$1(borders.right)}]`);
74439
+ if (borders.bottom) parts.push(`b:[${hashParagraphBorder$1(borders.bottom)}]`);
74440
+ if (borders.left) parts.push(`l:[${hashParagraphBorder$1(borders.left)}]`);
74441
+ return parts.join(";");
74442
+ };
74443
+ const hasStringProp = (run2, prop) => {
74444
+ return prop in run2 && typeof run2[prop] === "string";
74445
+ };
74446
+ const hasNumberProp = (run2, prop) => {
74447
+ return prop in run2 && typeof run2[prop] === "number";
74448
+ };
74449
+ const hasBooleanProp = (run2, prop) => {
74450
+ return prop in run2 && typeof run2[prop] === "boolean";
74451
+ };
74452
+ const getRunStringProp = (run2, prop) => {
74453
+ if (hasStringProp(run2, prop)) {
74454
+ return run2[prop];
74455
+ }
74456
+ return "";
74457
+ };
74458
+ const getRunNumberProp = (run2, prop) => {
74459
+ if (hasNumberProp(run2, prop)) {
74460
+ return run2[prop];
74461
+ }
74462
+ return 0;
74463
+ };
74464
+ const getRunBooleanProp = (run2, prop) => {
74465
+ if (hasBooleanProp(run2, prop)) {
74466
+ return run2[prop];
74467
+ }
74468
+ return false;
74469
+ };
74470
+ const getRunUnderlineStyle = (run2) => {
74471
+ if ("underline" in run2 && run2.underline && typeof run2.underline === "object") {
74472
+ return run2.underline.style ?? "";
74473
+ }
74474
+ return "";
74475
+ };
74476
+ const getRunUnderlineColor = (run2) => {
74477
+ if ("underline" in run2 && run2.underline && typeof run2.underline === "object") {
74478
+ return run2.underline.color ?? "";
74479
+ }
74480
+ return "";
74481
+ };
74487
74482
  function isMinimalWordLayout(value) {
74488
74483
  if (typeof value !== "object" || value === null) {
74489
74484
  return false;
@@ -75376,7 +75371,9 @@ const _DomPainter = class _DomPainter2 {
75376
75371
  const isTocEntry = block.attrs?.isTocEntry;
75377
75372
  const hasMarker = !fragment.continuesFromPrev && fragment.markerWidth && wordLayout?.marker;
75378
75373
  const hasSdtContainer = block.attrs?.sdt?.type === "documentSection" || block.attrs?.sdt?.type === "structuredContent" || block.attrs?.containerSdt?.type === "documentSection" || block.attrs?.containerSdt?.type === "structuredContent";
75379
- const styles = isTocEntry ? { ...fragmentStyles, whiteSpace: "nowrap" } : hasMarker || hasSdtContainer ? { ...fragmentStyles, overflow: "visible" } : fragmentStyles;
75374
+ const paraIndentForOverflow = block.attrs?.indent;
75375
+ const hasNegativeIndent = (paraIndentForOverflow?.left ?? 0) < 0 || (paraIndentForOverflow?.right ?? 0) < 0;
75376
+ const styles = isTocEntry ? { ...fragmentStyles, whiteSpace: "nowrap" } : hasMarker || hasSdtContainer || hasNegativeIndent ? { ...fragmentStyles, overflow: "visible" } : fragmentStyles;
75380
75377
  applyStyles$2(fragmentEl, styles);
75381
75378
  this.applyFragmentFrame(fragmentEl, fragment, context.section);
75382
75379
  if (isTocEntry) {
@@ -75405,6 +75402,8 @@ const _DomPainter = class _DomPainter2 {
75405
75402
  }
75406
75403
  if (fragmentEl.style.paddingLeft) fragmentEl.style.removeProperty("padding-left");
75407
75404
  if (fragmentEl.style.paddingRight) fragmentEl.style.removeProperty("padding-right");
75405
+ if (fragmentEl.style.marginLeft) fragmentEl.style.removeProperty("margin-left");
75406
+ if (fragmentEl.style.marginRight) fragmentEl.style.removeProperty("margin-right");
75408
75407
  if (fragmentEl.style.textIndent) fragmentEl.style.removeProperty("text-indent");
75409
75408
  const paraIndent = block.attrs?.indent;
75410
75409
  const paraIndentLeft = paraIndent?.left ?? 0;
@@ -75433,16 +75432,22 @@ const _DomPainter = class _DomPainter2 {
75433
75432
  if (!isListFirstLine) {
75434
75433
  if (hasExplicitSegmentPositioning) {
75435
75434
  if (isFirstLine && firstLineOffset !== 0) {
75436
- const adjustedPadding = paraIndentLeft + firstLineOffset;
75437
- lineEl.style.paddingLeft = `${adjustedPadding}px`;
75435
+ const effectiveLeftIndent = paraIndentLeft < 0 ? 0 : paraIndentLeft;
75436
+ const adjustedPadding = effectiveLeftIndent + firstLineOffset;
75437
+ if (adjustedPadding > 0) {
75438
+ lineEl.style.paddingLeft = `${adjustedPadding}px`;
75439
+ }
75438
75440
  }
75439
- } else if (paraIndentLeft) {
75441
+ } else if (paraIndentLeft && paraIndentLeft > 0) {
75440
75442
  lineEl.style.paddingLeft = `${paraIndentLeft}px`;
75443
+ } else if (!isFirstLine && paraIndent?.hanging && paraIndent.hanging > 0) {
75444
+ lineEl.style.paddingLeft = `${paraIndent.hanging}px`;
75441
75445
  }
75442
75446
  }
75443
- if (paraIndentRight) {
75447
+ if (paraIndentRight && paraIndentRight > 0) {
75444
75448
  lineEl.style.paddingRight = `${paraIndentRight}px`;
75445
75449
  }
75450
+ const hasNegativeLeftIndent = paraIndentLeft != null && paraIndentLeft < 0;
75446
75451
  if (!fragment.continuesFromPrev && index2 === 0 && firstLineOffset && !isListFirstLine) {
75447
75452
  if (!hasExplicitSegmentPositioning) {
75448
75453
  lineEl.style.textIndent = `${firstLineOffset}px`;
@@ -77553,7 +77558,7 @@ const deriveBlockVersion = (block) => {
77553
77558
  attrs.indent?.right ?? "",
77554
77559
  attrs.indent?.firstLine ?? "",
77555
77560
  attrs.indent?.hanging ?? "",
77556
- attrs.borders ? JSON.stringify(attrs.borders) : "",
77561
+ attrs.borders ? hashParagraphBorders$1(attrs.borders) : "",
77557
77562
  attrs.shading?.fill ?? "",
77558
77563
  attrs.shading?.color ?? "",
77559
77564
  attrs.direction ?? "",
@@ -77642,14 +77647,43 @@ const deriveBlockVersion = (block) => {
77642
77647
  for (const cellBlock of cellBlocks) {
77643
77648
  hash2 = hashString(hash2, cellBlock?.kind ?? "unknown");
77644
77649
  if (cellBlock?.kind === "paragraph") {
77645
- const runs = cellBlock.runs ?? [];
77650
+ const paragraphBlock = cellBlock;
77651
+ const runs = paragraphBlock.runs ?? [];
77646
77652
  hash2 = hashNumber(hash2, runs.length);
77653
+ const attrs = paragraphBlock.attrs;
77654
+ if (attrs) {
77655
+ hash2 = hashString(hash2, attrs.alignment ?? "");
77656
+ hash2 = hashNumber(hash2, attrs.spacing?.before ?? 0);
77657
+ hash2 = hashNumber(hash2, attrs.spacing?.after ?? 0);
77658
+ hash2 = hashNumber(hash2, attrs.spacing?.line ?? 0);
77659
+ hash2 = hashString(hash2, attrs.spacing?.lineRule ?? "");
77660
+ hash2 = hashNumber(hash2, attrs.indent?.left ?? 0);
77661
+ hash2 = hashNumber(hash2, attrs.indent?.right ?? 0);
77662
+ hash2 = hashNumber(hash2, attrs.indent?.firstLine ?? 0);
77663
+ hash2 = hashNumber(hash2, attrs.indent?.hanging ?? 0);
77664
+ hash2 = hashString(hash2, attrs.shading?.fill ?? "");
77665
+ hash2 = hashString(hash2, attrs.shading?.color ?? "");
77666
+ hash2 = hashString(hash2, attrs.direction ?? "");
77667
+ hash2 = hashString(hash2, attrs.rtl ? "1" : "");
77668
+ if (attrs.borders) {
77669
+ hash2 = hashString(hash2, hashParagraphBorders$1(attrs.borders));
77670
+ }
77671
+ }
77647
77672
  for (const run2 of runs) {
77648
77673
  if ("text" in run2 && typeof run2.text === "string") {
77649
77674
  hash2 = hashString(hash2, run2.text);
77650
77675
  }
77651
77676
  hash2 = hashNumber(hash2, run2.pmStart ?? -1);
77652
77677
  hash2 = hashNumber(hash2, run2.pmEnd ?? -1);
77678
+ hash2 = hashString(hash2, getRunStringProp(run2, "color"));
77679
+ hash2 = hashString(hash2, getRunStringProp(run2, "highlight"));
77680
+ hash2 = hashString(hash2, getRunBooleanProp(run2, "bold") ? "1" : "");
77681
+ hash2 = hashString(hash2, getRunBooleanProp(run2, "italic") ? "1" : "");
77682
+ hash2 = hashNumber(hash2, getRunNumberProp(run2, "fontSize"));
77683
+ hash2 = hashString(hash2, getRunStringProp(run2, "fontFamily"));
77684
+ hash2 = hashString(hash2, getRunUnderlineStyle(run2));
77685
+ hash2 = hashString(hash2, getRunUnderlineColor(run2));
77686
+ hash2 = hashString(hash2, getRunBooleanProp(run2, "strike") ? "1" : "");
77653
77687
  }
77654
77688
  }
77655
77689
  }
@@ -77727,15 +77761,18 @@ const applyParagraphBlockStyles = (element, attrs) => {
77727
77761
  }
77728
77762
  const indent = attrs.indent;
77729
77763
  if (indent) {
77730
- if (indent.left) {
77764
+ if (indent.left && indent.left > 0) {
77731
77765
  element.style.paddingLeft = `${indent.left}px`;
77732
77766
  }
77733
- if (indent.right) {
77767
+ if (indent.right && indent.right > 0) {
77734
77768
  element.style.paddingRight = `${indent.right}px`;
77735
77769
  }
77736
- const textIndent = (indent.firstLine ?? 0) - (indent.hanging ?? 0);
77737
- if (textIndent) {
77738
- element.style.textIndent = `${textIndent}px`;
77770
+ const hasNegativeLeftIndent = indent.left != null && indent.left < 0;
77771
+ if (!hasNegativeLeftIndent) {
77772
+ const textIndent = (indent.firstLine ?? 0) - (indent.hanging ?? 0);
77773
+ if (textIndent) {
77774
+ element.style.textIndent = `${textIndent}px`;
77775
+ }
77739
77776
  }
77740
77777
  }
77741
77778
  applyParagraphBorderStyles(element, attrs.borders);
@@ -79097,20 +79134,6 @@ const asSafeNumber = (value) => {
79097
79134
  }
79098
79135
  return value;
79099
79136
  };
79100
- function calculateFirstLineIndent(block, measure) {
79101
- const wordLayout = block.attrs?.wordLayout;
79102
- if (!wordLayout?.firstLineIndentMode) {
79103
- return 0;
79104
- }
79105
- if (!wordLayout.marker || !measure.marker) {
79106
- return 0;
79107
- }
79108
- const markerWidthRaw = measure.marker.markerWidth ?? wordLayout.marker.markerBoxWidthPx ?? 0;
79109
- const markerWidth = Number.isFinite(markerWidthRaw) && markerWidthRaw >= 0 ? markerWidthRaw : 0;
79110
- const gutterWidthRaw = measure.marker.gutterWidth ?? 0;
79111
- const gutterWidth = Number.isFinite(gutterWidthRaw) && gutterWidthRaw >= 0 ? gutterWidthRaw : 0;
79112
- return markerWidth + gutterWidth;
79113
- }
79114
79137
  function layoutParagraphBlock(ctx2, anchors) {
79115
79138
  const { block, measure, columnWidth, ensurePage, advanceColumn, columnX, floatManager } = ctx2;
79116
79139
  const remeasureParagraph2 = ctx2.remeasureParagraph;
@@ -79232,10 +79255,25 @@ function layoutParagraphBlock(ctx2, anchors) {
79232
79255
  }
79233
79256
  let lines = normalizeLines(measure);
79234
79257
  const measurementWidth = lines[0]?.maxWidth;
79258
+ const paraIndent = block.attrs?.indent;
79259
+ const indentLeft = typeof paraIndent?.left === "number" && Number.isFinite(paraIndent.left) ? paraIndent.left : 0;
79260
+ const indentRight = typeof paraIndent?.right === "number" && Number.isFinite(paraIndent.right) ? paraIndent.right : 0;
79261
+ const negativeLeftIndent = indentLeft < 0 ? indentLeft : 0;
79262
+ const negativeRightIndent = indentRight < 0 ? indentRight : 0;
79263
+ const remeasureWidth = Math.max(1, columnWidth - indentLeft - indentRight);
79235
79264
  let didRemeasureForColumnWidth = false;
79236
- if (typeof remeasureParagraph2 === "function" && typeof measurementWidth === "number" && measurementWidth > columnWidth) {
79237
- const firstLineIndent = calculateFirstLineIndent(block, measure);
79238
- const newMeasure = remeasureParagraph2(block, columnWidth, firstLineIndent);
79265
+ if (typeof remeasureParagraph2 === "function" && typeof measurementWidth === "number" && measurementWidth > remeasureWidth) {
79266
+ let firstLineIndent = 0;
79267
+ const wordLayout = block.attrs?.wordLayout;
79268
+ if (wordLayout?.marker && measure.marker) {
79269
+ const markerJustification = wordLayout.marker.justification ?? "left";
79270
+ if (markerJustification === "left") {
79271
+ const markerWidth = measure.marker.markerWidth ?? 0;
79272
+ const gutterWidth = measure.marker.gutterWidth ?? wordLayout.marker.gutterWidthPx ?? 0;
79273
+ firstLineIndent = markerWidth + gutterWidth;
79274
+ }
79275
+ }
79276
+ const newMeasure = remeasureParagraph2(block, remeasureWidth, firstLineIndent);
79239
79277
  lines = normalizeLines(newMeasure);
79240
79278
  didRemeasureForColumnWidth = true;
79241
79279
  }
@@ -79314,9 +79352,19 @@ function layoutParagraphBlock(ctx2, anchors) {
79314
79352
  }
79315
79353
  tempY += lineHeight2;
79316
79354
  }
79317
- if (narrowestWidth < columnWidth) {
79318
- const firstLineIndent = calculateFirstLineIndent(block, measure);
79319
- const newMeasure = remeasureParagraph2(block, narrowestWidth, firstLineIndent);
79355
+ const narrowestRemeasureWidth = Math.max(1, narrowestWidth - indentLeft - indentRight);
79356
+ if (narrowestRemeasureWidth < remeasureWidth) {
79357
+ let firstLineIndent = 0;
79358
+ const wordLayout = block.attrs?.wordLayout;
79359
+ if (wordLayout?.marker && measure.marker) {
79360
+ const markerJustification = wordLayout.marker.justification ?? "left";
79361
+ if (markerJustification === "left") {
79362
+ const markerWidth = measure.marker.markerWidth ?? 0;
79363
+ const gutterWidth = measure.marker.gutterWidth ?? wordLayout.marker.gutterWidthPx ?? 0;
79364
+ firstLineIndent = markerWidth + gutterWidth;
79365
+ }
79366
+ }
79367
+ const newMeasure = remeasureParagraph2(block, narrowestRemeasureWidth, firstLineIndent);
79320
79368
  lines = normalizeLines(newMeasure);
79321
79369
  didRemeasureForFloats = true;
79322
79370
  }
@@ -79370,14 +79418,16 @@ function layoutParagraphBlock(ctx2, anchors) {
79370
79418
  }
79371
79419
  const slice2 = sliceLines(lines, fromLine, state2.contentBottom - state2.cursorY);
79372
79420
  const fragmentHeight = slice2.height;
79421
+ const adjustedX = columnX(state2.columnIndex) + offsetX + negativeLeftIndent;
79422
+ const adjustedWidth = effectiveColumnWidth - negativeLeftIndent - negativeRightIndent;
79373
79423
  const fragment = {
79374
79424
  kind: "para",
79375
79425
  blockId: block.id,
79376
79426
  fromLine,
79377
79427
  toLine: slice2.toLine,
79378
- x: columnX(state2.columnIndex) + offsetX,
79428
+ x: adjustedX,
79379
79429
  y: state2.cursorY,
79380
- width: effectiveColumnWidth,
79430
+ width: adjustedWidth,
79381
79431
  ...computeFragmentPmRange(block, lines, fromLine, slice2.toLine)
79382
79432
  };
79383
79433
  if (didRemeasureForColumnWidth) {
@@ -81331,10 +81381,6 @@ const resolveTrackedChangesEnabled = (attrs, defaultEnabled = true) => {
81331
81381
  }
81332
81382
  return attrs.trackedChangesEnabled !== false;
81333
81383
  };
81334
- const MAX_CACHE_SIZE$1 = 1e4;
81335
- const BYTES_PER_ENTRY_ESTIMATE = 5e3;
81336
- const NORMALIZED_WHITESPACE = /\s+/g;
81337
- const normalizeText = (text) => text.replace(NORMALIZED_WHITESPACE, " ");
81338
81384
  const hashParagraphBorder = (border) => {
81339
81385
  const parts = [];
81340
81386
  if (border.style !== void 0) parts.push(`s:${border.style}`);
@@ -81351,6 +81397,10 @@ const hashParagraphBorders = (borders) => {
81351
81397
  if (borders.left) parts.push(`l:[${hashParagraphBorder(borders.left)}]`);
81352
81398
  return parts.join(";");
81353
81399
  };
81400
+ const MAX_CACHE_SIZE$1 = 1e4;
81401
+ const BYTES_PER_ENTRY_ESTIMATE = 5e3;
81402
+ const NORMALIZED_WHITESPACE = /\s+/g;
81403
+ const normalizeText = (text) => text.replace(NORMALIZED_WHITESPACE, " ");
81354
81404
  const hashParagraphFrame = (frame) => {
81355
81405
  const parts = [];
81356
81406
  if (frame.wrap !== void 0) parts.push(`w:${frame.wrap}`);
@@ -81387,12 +81437,14 @@ const hashRuns = (block) => {
81387
81437
  const color = "color" in run2 ? run2.color : void 0;
81388
81438
  const fontSize2 = "fontSize" in run2 ? run2.fontSize : void 0;
81389
81439
  const fontFamily2 = "fontFamily" in run2 ? run2.fontFamily : void 0;
81440
+ const highlight = "highlight" in run2 ? run2.highlight : void 0;
81390
81441
  const marks = [
81391
81442
  bold ? "b" : "",
81392
81443
  italic ? "i" : "",
81393
81444
  color ?? "",
81394
81445
  fontSize2 !== void 0 ? `fs:${fontSize2}` : "",
81395
- fontFamily2 ? `ff:${fontFamily2}` : ""
81446
+ fontFamily2 ? `ff:${fontFamily2}` : "",
81447
+ highlight ? `hl:${highlight}` : ""
81396
81448
  ].join("");
81397
81449
  let trackedKey = "";
81398
81450
  if (hasTrackedChange(run2)) {
@@ -81403,6 +81455,38 @@ const hashRuns = (block) => {
81403
81455
  }
81404
81456
  cellHashes.push(`${text}:${marks}${trackedKey}`);
81405
81457
  }
81458
+ if (paragraphBlock.attrs) {
81459
+ const attrs = paragraphBlock.attrs;
81460
+ const parts = [];
81461
+ if (attrs.alignment) parts.push(`al:${attrs.alignment}`);
81462
+ if (attrs.spacing) {
81463
+ const s2 = attrs.spacing;
81464
+ if (s2.before !== void 0) parts.push(`sb:${s2.before}`);
81465
+ if (s2.after !== void 0) parts.push(`sa:${s2.after}`);
81466
+ if (s2.line !== void 0) parts.push(`sl:${s2.line}`);
81467
+ if (s2.lineRule) parts.push(`sr:${s2.lineRule}`);
81468
+ }
81469
+ if (attrs.indent) {
81470
+ const ind = attrs.indent;
81471
+ if (ind.left !== void 0) parts.push(`il:${ind.left}`);
81472
+ if (ind.right !== void 0) parts.push(`ir:${ind.right}`);
81473
+ if (ind.firstLine !== void 0) parts.push(`if:${ind.firstLine}`);
81474
+ if (ind.hanging !== void 0) parts.push(`ih:${ind.hanging}`);
81475
+ }
81476
+ if (attrs.borders) {
81477
+ parts.push(`br:${hashParagraphBorders(attrs.borders)}`);
81478
+ }
81479
+ if (attrs.shading) {
81480
+ const sh = attrs.shading;
81481
+ if (sh.fill) parts.push(`shf:${sh.fill}`);
81482
+ if (sh.color) parts.push(`shc:${sh.color}`);
81483
+ }
81484
+ if (attrs.direction) parts.push(`dir:${attrs.direction}`);
81485
+ if (attrs.rtl) parts.push("rtl");
81486
+ if (parts.length > 0) {
81487
+ cellHashes.push(`pa:${parts.join(":")}`);
81488
+ }
81489
+ }
81406
81490
  }
81407
81491
  }
81408
81492
  }
@@ -81426,12 +81510,14 @@ const hashRuns = (block) => {
81426
81510
  const color = "color" in run2 ? run2.color : void 0;
81427
81511
  const fontSize2 = "fontSize" in run2 ? run2.fontSize : void 0;
81428
81512
  const fontFamily2 = "fontFamily" in run2 ? run2.fontFamily : void 0;
81513
+ const highlight = "highlight" in run2 ? run2.highlight : void 0;
81429
81514
  const marks = [
81430
81515
  bold ? "b" : "",
81431
81516
  italic ? "i" : "",
81432
81517
  color ?? "",
81433
81518
  fontSize2 !== void 0 ? `fs:${fontSize2}` : "",
81434
- fontFamily2 ? `ff:${fontFamily2}` : ""
81519
+ fontFamily2 ? `ff:${fontFamily2}` : "",
81520
+ highlight ? `hl:${highlight}` : ""
81435
81521
  ].join("");
81436
81522
  let trackedKey = "";
81437
81523
  if (hasTrackedChange(run2)) {
@@ -82558,7 +82644,7 @@ const paragraphBlocksEqual = (a, b2) => {
82558
82644
  for (let i = 0; i < a.runs.length; i += 1) {
82559
82645
  const runA = a.runs[i];
82560
82646
  const runB = b2.runs[i];
82561
- 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)) {
82647
+ 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)) {
82562
82648
  return false;
82563
82649
  }
82564
82650
  }
@@ -83085,9 +83171,15 @@ async function incrementalLayout(previousBlocks, _previousLayout, nextBlocks, op
83085
83171
  }
83086
83172
  const DEFAULT_PAGE_SIZE$1 = { w: 612, h: 792 };
83087
83173
  const DEFAULT_MARGINS$1 = { top: 72, right: 72, bottom: 72, left: 72 };
83174
+ const normalizeMargin = (value, fallback) => Number.isFinite(value) ? value : fallback;
83088
83175
  function resolveMeasurementConstraints(options) {
83089
83176
  const pageSize = options.pageSize ?? DEFAULT_PAGE_SIZE$1;
83090
- const margins = options.margins ?? DEFAULT_MARGINS$1;
83177
+ const margins = {
83178
+ top: normalizeMargin(options.margins?.top, DEFAULT_MARGINS$1.top),
83179
+ right: normalizeMargin(options.margins?.right, DEFAULT_MARGINS$1.right),
83180
+ bottom: normalizeMargin(options.margins?.bottom, DEFAULT_MARGINS$1.bottom),
83181
+ left: normalizeMargin(options.margins?.left, DEFAULT_MARGINS$1.left)
83182
+ };
83091
83183
  const contentWidth = pageSize.w - (margins.left + margins.right);
83092
83184
  const contentHeight = pageSize.h - (margins.top + margins.bottom);
83093
83185
  const columns = options.columns;
@@ -84625,8 +84717,8 @@ async function measureParagraphBlock(block, maxWidth) {
84625
84717
  const lines = [];
84626
84718
  const indent = block.attrs?.indent;
84627
84719
  const spacing = block.attrs?.spacing;
84628
- const indentLeft = sanitizePositive(indent?.left);
84629
- const indentRight = sanitizePositive(indent?.right);
84720
+ const indentLeft = sanitizeIndent(indent?.left);
84721
+ const indentRight = sanitizeIndent(indent?.right);
84630
84722
  const firstLine = indent?.firstLine ?? 0;
84631
84723
  const hanging = indent?.hanging ?? 0;
84632
84724
  const isWordLayoutList = Boolean(wordLayout?.marker);
@@ -84635,10 +84727,10 @@ async function measureParagraphBlock(block, maxWidth) {
84635
84727
  const clampedFirstLineOffset = Math.max(0, rawFirstLineOffset);
84636
84728
  const firstLineOffset = isWordLayoutList ? 0 : clampedFirstLineOffset;
84637
84729
  const contentWidth = Math.max(1, maxWidth - indentLeft - indentRight);
84730
+ const bodyContentWidth = contentWidth;
84638
84731
  let initialAvailableWidth;
84639
84732
  const textStartPx = wordLayout?.textStartPx;
84640
- const treatAsHanging = isWordLayoutList && indentLeft === 0 && hanging === 0 && typeof textStartPx === "number";
84641
- if (typeof textStartPx === "number" && textStartPx > indentLeft && !treatAsHanging) {
84733
+ if (typeof textStartPx === "number" && textStartPx > indentLeft) {
84642
84734
  initialAvailableWidth = Math.max(1, maxWidth - textStartPx - indentRight);
84643
84735
  } else {
84644
84736
  initialAvailableWidth = Math.max(1, contentWidth - firstLineOffset);
@@ -84685,21 +84777,6 @@ async function measureParagraphBlock(block, maxWidth) {
84685
84777
  totalHeight: metrics.lineHeight
84686
84778
  };
84687
84779
  }
84688
- const isListLike = Boolean(block.attrs?.numId || wordLayout?.marker);
84689
- if (isListLike) {
84690
- console.log(
84691
- "[measureParagraph][list]",
84692
- JSON.stringify({
84693
- blockId: block.id,
84694
- maxWidth,
84695
- indentLeft,
84696
- indentRight,
84697
- textStartPx: textStartPx ?? null,
84698
- firstLineOffset: firstLineOffset ?? null,
84699
- initialAvailableWidth
84700
- })
84701
- );
84702
- }
84703
84780
  let currentLine = null;
84704
84781
  const getEffectiveWidth = (baseWidth) => {
84705
84782
  if (dropCapMeasure && lines.length < dropCapMeasure.lines && dropCapMeasure.mode === "drop") {
@@ -84845,7 +84922,7 @@ async function measureParagraphBlock(block, maxWidth) {
84845
84922
  lines.push(emptyLine);
84846
84923
  }
84847
84924
  const hadPreviousLine = lines.length > 0;
84848
- const nextLineMaxWidth = hadPreviousLine ? getEffectiveWidth(contentWidth) : getEffectiveWidth(initialAvailableWidth);
84925
+ const nextLineMaxWidth = hadPreviousLine ? getEffectiveWidth(bodyContentWidth) : getEffectiveWidth(initialAvailableWidth);
84849
84926
  currentLine = {
84850
84927
  fromRun: runIndex,
84851
84928
  fromChar: 0,
@@ -84956,7 +85033,7 @@ async function measureParagraphBlock(block, maxWidth) {
84956
85033
  toChar: 1,
84957
85034
  width: imageWidth,
84958
85035
  maxFontSize: imageHeight,
84959
- maxWidth: getEffectiveWidth(contentWidth),
85036
+ maxWidth: getEffectiveWidth(bodyContentWidth),
84960
85037
  spaceCount: 0,
84961
85038
  segments: [
84962
85039
  {
@@ -85045,7 +85122,7 @@ async function measureParagraphBlock(block, maxWidth) {
85045
85122
  toChar: 1,
85046
85123
  width: annotationWidth,
85047
85124
  maxFontSize: annotationHeight,
85048
- maxWidth: getEffectiveWidth(contentWidth),
85125
+ maxWidth: getEffectiveWidth(bodyContentWidth),
85049
85126
  spaceCount: 0,
85050
85127
  segments: [
85051
85128
  {
@@ -85127,7 +85204,7 @@ async function measureParagraphBlock(block, maxWidth) {
85127
85204
  width: spacesWidth,
85128
85205
  maxFontSize: run2.fontSize,
85129
85206
  maxFontInfo: getFontInfoFromRun(run2),
85130
- maxWidth: getEffectiveWidth(contentWidth),
85207
+ maxWidth: getEffectiveWidth(bodyContentWidth),
85131
85208
  segments: [{ runIndex, fromChar: spacesStartChar, toChar: spacesEndChar, width: spacesWidth }],
85132
85209
  spaceCount: spacesLength
85133
85210
  };
@@ -85190,7 +85267,7 @@ async function measureParagraphBlock(block, maxWidth) {
85190
85267
  width: singleSpaceWidth,
85191
85268
  maxFontSize: run2.fontSize,
85192
85269
  maxFontInfo: getFontInfoFromRun(run2),
85193
- maxWidth: getEffectiveWidth(contentWidth),
85270
+ maxWidth: getEffectiveWidth(bodyContentWidth),
85194
85271
  segments: [{ runIndex, fromChar: spaceStartChar, toChar: spaceEndChar, width: singleSpaceWidth }],
85195
85272
  spaceCount: 1
85196
85273
  };
@@ -85383,7 +85460,7 @@ async function measureParagraphBlock(block, maxWidth) {
85383
85460
  width: wordOnlyWidth,
85384
85461
  maxFontSize: run2.fontSize,
85385
85462
  maxFontInfo: getFontInfoFromRun(run2),
85386
- maxWidth: getEffectiveWidth(contentWidth),
85463
+ maxWidth: getEffectiveWidth(bodyContentWidth),
85387
85464
  segments: [{ runIndex, fromChar: wordStartChar, toChar: wordEndNoSpace, width: wordOnlyWidth }],
85388
85465
  spaceCount: 0
85389
85466
  };
@@ -85948,6 +86025,7 @@ const resolveLineHeight = (spacing, baseLineHeight) => {
85948
86025
  return Math.max(baseLineHeight, raw);
85949
86026
  };
85950
86027
  const sanitizePositive = (value) => typeof value === "number" && Number.isFinite(value) ? Math.max(0, value) : 0;
86028
+ const sanitizeIndent = (value) => typeof value === "number" && Number.isFinite(value) ? value : 0;
85951
86029
  const sanitizeDecimalSeparator = (value) => {
85952
86030
  if (value === ",") return ",";
85953
86031
  return DEFAULT_DECIMAL_SEPARATOR;
@@ -90496,6 +90574,10 @@ resolveLayoutOptions_fn = function(blocks, sectionMetadata) {
90496
90574
  const pageSize = firstSection?.pageSize ?? defaults.pageSize;
90497
90575
  const margins = {
90498
90576
  ...defaults.margins,
90577
+ ...firstSection?.margins?.top != null ? { top: firstSection.margins.top } : {},
90578
+ ...firstSection?.margins?.right != null ? { right: firstSection.margins.right } : {},
90579
+ ...firstSection?.margins?.bottom != null ? { bottom: firstSection.margins.bottom } : {},
90580
+ ...firstSection?.margins?.left != null ? { left: firstSection.margins.left } : {},
90499
90581
  ...firstSection?.margins?.header != null ? { header: firstSection.margins.header } : {},
90500
90582
  ...firstSection?.margins?.footer != null ? { footer: firstSection.margins.footer } : {}
90501
90583
  };