kordoc 4.24.20 → 4.24.21

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 (121) hide show
  1. package/README.md +4 -4
  2. package/dist/{-3RL7OPC7.js → -IS4RXPEZ.js} +11 -11
  3. package/dist/{chunk-3EHQKGTL.js → chunk-3RVASM4C.js} +4 -4
  4. package/dist/{chunk-IBXG4UPB.js → chunk-4OF7DHIT.js} +4 -4
  5. package/dist/{chunk-KQULVTQH.js → chunk-B3POEH7X.js} +2 -2
  6. package/dist/{chunk-OJB7QZHP.cjs → chunk-B5M676H3.cjs} +6 -6
  7. package/dist/{chunk-OJB7QZHP.cjs.map → chunk-B5M676H3.cjs.map} +1 -1
  8. package/dist/{chunk-JCRJGCYA.js → chunk-BMXWY36E.js} +4 -4
  9. package/dist/{chunk-PWGE67XI.js → chunk-BNEKESI4.js} +2 -2
  10. package/dist/{chunk-VYWZASYT.js → chunk-BTBFKDPH.js} +2 -2
  11. package/dist/{chunk-DY7IZPA5.cjs → chunk-BUFGW3UJ.cjs} +25 -25
  12. package/dist/{chunk-DY7IZPA5.cjs.map → chunk-BUFGW3UJ.cjs.map} +1 -1
  13. package/dist/{chunk-23GHEDMW.js → chunk-BV2YG7M6.js} +2 -2
  14. package/dist/{chunk-G5WFGGUL.js → chunk-CPVXUEKF.js} +2 -2
  15. package/dist/{chunk-QRUTGCC2.js → chunk-E6G4B457.js} +2 -2
  16. package/dist/{chunk-VO27MPHI.js → chunk-F4GZFIUJ.js} +2 -2
  17. package/dist/{chunk-GAHHZ32A.js → chunk-F6OHQLN7.js} +3 -3
  18. package/dist/{chunk-NWL7D4F7.js → chunk-IZN5BTCW.js} +2 -2
  19. package/dist/{chunk-XIDZJIB4.cjs → chunk-L556KKBU.cjs} +79 -79
  20. package/dist/{chunk-XIDZJIB4.cjs.map → chunk-L556KKBU.cjs.map} +1 -1
  21. package/dist/{chunk-XAUJF2GZ.js → chunk-MGCIQ43Y.js} +3 -3
  22. package/dist/{chunk-S2LEIH33.js → chunk-MMZUWRH6.js} +11 -11
  23. package/dist/{chunk-YUEPDCVZ.js → chunk-MYDHNNPA.js} +30 -12
  24. package/dist/chunk-MYDHNNPA.js.map +1 -0
  25. package/dist/{chunk-ZGXXR3DH.js → chunk-N45RCYBL.js} +3 -3
  26. package/dist/{chunk-PZT5RCSM.js → chunk-NE75RO62.js} +2 -2
  27. package/dist/{chunk-PKX6CKAI.js → chunk-NRCG3ASU.js} +2 -2
  28. package/dist/{chunk-SSTOQ3ZS.js → chunk-O5ZCJEZ4.js} +2 -2
  29. package/dist/{chunk-PUHS26TX.cjs → chunk-OMGCVZ4W.cjs} +2 -2
  30. package/dist/{chunk-PUHS26TX.cjs.map → chunk-OMGCVZ4W.cjs.map} +1 -1
  31. package/dist/{chunk-IR6ZXRAK.js → chunk-PDOWSDNM.js} +2 -2
  32. package/dist/{chunk-NBQDGYCQ.js → chunk-UNYH6MTO.js} +2 -2
  33. package/dist/{chunk-GKZPJDLN.cjs → chunk-V7S36XCU.cjs} +3 -3
  34. package/dist/{chunk-GKZPJDLN.cjs.map → chunk-V7S36XCU.cjs.map} +1 -1
  35. package/dist/{chunk-VDG4G44B.js → chunk-WQC4XWVT.js} +2 -2
  36. package/dist/{chunk-CSWE6FQ4.cjs → chunk-WVZSTMCZ.cjs} +3 -3
  37. package/dist/{chunk-CSWE6FQ4.cjs.map → chunk-WVZSTMCZ.cjs.map} +1 -1
  38. package/dist/{chunk-HRZC7ITK.js → chunk-Z6ONQ63K.js} +2 -2
  39. package/dist/chunks-FYCQOIWO.js +10 -0
  40. package/dist/cli.js +30 -30
  41. package/dist/{formula-GQMRKV2P.js → formula-DHBBWQLC.js} +3 -3
  42. package/dist/{formula-7C6O7KHQ.cjs → formula-G3FQTUOY.cjs} +9 -9
  43. package/dist/{formula-7C6O7KHQ.cjs.map → formula-G3FQTUOY.cjs.map} +1 -1
  44. package/dist/{formula-CHBBFZGG.js → formula-I4EA7ULD.js} +4 -4
  45. package/dist/{image-ocr-SAW7A4YW.js → image-ocr-5YWVBRY6.js} +6 -6
  46. package/dist/{image-ocr-6DPYV3Z2.js → image-ocr-QUVBGNWD.js} +9 -9
  47. package/dist/{image-ocr-2VND3EWX.cjs → image-ocr-THUO6YRG.cjs} +17 -17
  48. package/dist/{image-ocr-2VND3EWX.cjs.map → image-ocr-THUO6YRG.cjs.map} +1 -1
  49. package/dist/index.cjs +448 -430
  50. package/dist/index.cjs.map +1 -1
  51. package/dist/index.js +30 -12
  52. package/dist/index.js.map +1 -1
  53. package/dist/mcp.js +23 -23
  54. package/dist/{model-bundle-7K554JAW.js → model-bundle-6RG5PO3R.js} +5 -5
  55. package/dist/{models-VU65CWCI.js → models-CGYIGN6D.js} +5 -5
  56. package/dist/{parse-worker-v2-435QCDJP.js → parse-worker-v2-F5NXYBU6.js} +12 -12
  57. package/dist/{parser-BD4VNEUA.js → parser-G5QTRKII.js} +9 -9
  58. package/dist/{parser-YRGM2WD3.cjs → parser-GJ4PKW7I.cjs} +159 -159
  59. package/dist/{parser-YRGM2WD3.cjs.map → parser-GJ4PKW7I.cjs.map} +1 -1
  60. package/dist/{parser-5LUP4EF5.js → parser-I2C5DUXC.js} +12 -12
  61. package/dist/pdf-ocr-LJKCUXTE.cjs +35 -0
  62. package/dist/{pdf-ocr-EYW5Q7DX.cjs.map → pdf-ocr-LJKCUXTE.cjs.map} +1 -1
  63. package/dist/{pdf-ocr-GJDRJACB.js → pdf-ocr-TNW6YOPX.js} +6 -6
  64. package/dist/{pdf-ocr-2TNMUGTU.js → pdf-ocr-U3I74Q4O.js} +9 -9
  65. package/dist/{profile-io-6XPZGJHS.js → profile-io-5YZCFK7B.js} +3 -3
  66. package/dist/{rasterize-PERRMQDZ.js → rasterize-7VRHPOQX.js} +3 -3
  67. package/dist/{redact-doc-EA2QBZG6.js → redact-doc-VK6VGBK3.js} +11 -11
  68. package/dist/{render-YLCMDE5W.js → render-Y7J6DPRL.js} +7 -7
  69. package/dist/seal-4QIZ3ZNI.js +10 -0
  70. package/dist/{setup-IJSICTFK.js → setup-4XTUDU4X.js} +3 -3
  71. package/dist/visual-VEMQJ52W.js +21 -0
  72. package/dist/{watch-Z6PMJO7G.js → watch-SPZRLTKG.js} +12 -12
  73. package/package.json +1 -1
  74. package/dist/chunk-YUEPDCVZ.js.map +0 -1
  75. package/dist/chunks-ODK2CKBM.js +0 -10
  76. package/dist/pdf-ocr-EYW5Q7DX.cjs +0 -35
  77. package/dist/seal-HZX7BXWG.js +0 -10
  78. package/dist/visual-GFFZPSRH.js +0 -21
  79. /package/dist/{-3RL7OPC7.js.map → -IS4RXPEZ.js.map} +0 -0
  80. /package/dist/{chunk-3EHQKGTL.js.map → chunk-3RVASM4C.js.map} +0 -0
  81. /package/dist/{chunk-IBXG4UPB.js.map → chunk-4OF7DHIT.js.map} +0 -0
  82. /package/dist/{chunk-KQULVTQH.js.map → chunk-B3POEH7X.js.map} +0 -0
  83. /package/dist/{chunk-JCRJGCYA.js.map → chunk-BMXWY36E.js.map} +0 -0
  84. /package/dist/{chunk-PWGE67XI.js.map → chunk-BNEKESI4.js.map} +0 -0
  85. /package/dist/{chunk-VYWZASYT.js.map → chunk-BTBFKDPH.js.map} +0 -0
  86. /package/dist/{chunk-23GHEDMW.js.map → chunk-BV2YG7M6.js.map} +0 -0
  87. /package/dist/{chunk-G5WFGGUL.js.map → chunk-CPVXUEKF.js.map} +0 -0
  88. /package/dist/{chunk-QRUTGCC2.js.map → chunk-E6G4B457.js.map} +0 -0
  89. /package/dist/{chunk-VO27MPHI.js.map → chunk-F4GZFIUJ.js.map} +0 -0
  90. /package/dist/{chunk-GAHHZ32A.js.map → chunk-F6OHQLN7.js.map} +0 -0
  91. /package/dist/{chunk-NWL7D4F7.js.map → chunk-IZN5BTCW.js.map} +0 -0
  92. /package/dist/{chunk-XAUJF2GZ.js.map → chunk-MGCIQ43Y.js.map} +0 -0
  93. /package/dist/{chunk-S2LEIH33.js.map → chunk-MMZUWRH6.js.map} +0 -0
  94. /package/dist/{chunk-ZGXXR3DH.js.map → chunk-N45RCYBL.js.map} +0 -0
  95. /package/dist/{chunk-PZT5RCSM.js.map → chunk-NE75RO62.js.map} +0 -0
  96. /package/dist/{chunk-PKX6CKAI.js.map → chunk-NRCG3ASU.js.map} +0 -0
  97. /package/dist/{chunk-SSTOQ3ZS.js.map → chunk-O5ZCJEZ4.js.map} +0 -0
  98. /package/dist/{chunk-IR6ZXRAK.js.map → chunk-PDOWSDNM.js.map} +0 -0
  99. /package/dist/{chunk-NBQDGYCQ.js.map → chunk-UNYH6MTO.js.map} +0 -0
  100. /package/dist/{chunk-VDG4G44B.js.map → chunk-WQC4XWVT.js.map} +0 -0
  101. /package/dist/{chunk-HRZC7ITK.js.map → chunk-Z6ONQ63K.js.map} +0 -0
  102. /package/dist/{chunks-ODK2CKBM.js.map → chunks-FYCQOIWO.js.map} +0 -0
  103. /package/dist/{formula-GQMRKV2P.js.map → formula-DHBBWQLC.js.map} +0 -0
  104. /package/dist/{formula-CHBBFZGG.js.map → formula-I4EA7ULD.js.map} +0 -0
  105. /package/dist/{image-ocr-SAW7A4YW.js.map → image-ocr-5YWVBRY6.js.map} +0 -0
  106. /package/dist/{image-ocr-6DPYV3Z2.js.map → image-ocr-QUVBGNWD.js.map} +0 -0
  107. /package/dist/{model-bundle-7K554JAW.js.map → model-bundle-6RG5PO3R.js.map} +0 -0
  108. /package/dist/{models-VU65CWCI.js.map → models-CGYIGN6D.js.map} +0 -0
  109. /package/dist/{parse-worker-v2-435QCDJP.js.map → parse-worker-v2-F5NXYBU6.js.map} +0 -0
  110. /package/dist/{parser-BD4VNEUA.js.map → parser-G5QTRKII.js.map} +0 -0
  111. /package/dist/{parser-5LUP4EF5.js.map → parser-I2C5DUXC.js.map} +0 -0
  112. /package/dist/{pdf-ocr-2TNMUGTU.js.map → pdf-ocr-TNW6YOPX.js.map} +0 -0
  113. /package/dist/{pdf-ocr-GJDRJACB.js.map → pdf-ocr-U3I74Q4O.js.map} +0 -0
  114. /package/dist/{profile-io-6XPZGJHS.js.map → profile-io-5YZCFK7B.js.map} +0 -0
  115. /package/dist/{rasterize-PERRMQDZ.js.map → rasterize-7VRHPOQX.js.map} +0 -0
  116. /package/dist/{redact-doc-EA2QBZG6.js.map → redact-doc-VK6VGBK3.js.map} +0 -0
  117. /package/dist/{render-YLCMDE5W.js.map → render-Y7J6DPRL.js.map} +0 -0
  118. /package/dist/{seal-HZX7BXWG.js.map → seal-4QIZ3ZNI.js.map} +0 -0
  119. /package/dist/{setup-IJSICTFK.js.map → setup-4XTUDU4X.js.map} +0 -0
  120. /package/dist/{visual-GFFZPSRH.js.map → visual-VEMQJ52W.js.map} +0 -0
  121. /package/dist/{watch-Z6PMJO7G.js.map → watch-SPZRLTKG.js.map} +0 -0
@@ -1,12 +1,12 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  parse
4
- } from "./chunk-S2LEIH33.js";
4
+ } from "./chunk-MMZUWRH6.js";
5
5
  import {
6
6
  classifyError,
7
7
  sanitizeError,
8
8
  toArrayBuffer
9
- } from "./chunk-VDG4G44B.js";
9
+ } from "./chunk-WQC4XWVT.js";
10
10
 
11
11
  // src/cli/worker-parse.ts
12
12
  import { readFileSync, statSync } from "fs";
@@ -26,4 +26,4 @@ async function parseWorkerFile(absPath, options) {
26
26
  export {
27
27
  parseWorkerFile
28
28
  };
29
- //# sourceMappingURL=chunk-XAUJF2GZ.js.map
29
+ //# sourceMappingURL=chunk-MGCIQ43Y.js.map
@@ -51,10 +51,10 @@ import {
51
51
  resolveParaHeading,
52
52
  simulateWrap,
53
53
  takeTocLeaders
54
- } from "./chunk-YUEPDCVZ.js";
54
+ } from "./chunk-MYDHNNPA.js";
55
55
  import {
56
56
  blocksToPages
57
- } from "./chunk-VYWZASYT.js";
57
+ } from "./chunk-BTBFKDPH.js";
58
58
  import {
59
59
  bmpToPng,
60
60
  inlineImagesIntoMarkdown
@@ -76,7 +76,7 @@ import {
76
76
  tidyScriptTags,
77
77
  unframeLayoutTables,
78
78
  wrapScript
79
- } from "./chunk-VO27MPHI.js";
79
+ } from "./chunk-F4GZFIUJ.js";
80
80
  import {
81
81
  MAX_COLS,
82
82
  MAX_ROWS,
@@ -100,7 +100,7 @@ import {
100
100
  noteTableHtml,
101
101
  sanitizeText,
102
102
  visibleText
103
- } from "./chunk-KQULVTQH.js";
103
+ } from "./chunk-B3POEH7X.js";
104
104
  import {
105
105
  ANNOTATION_BLANK_RE,
106
106
  ValueCursor,
@@ -133,7 +133,7 @@ import {
133
133
  resolveUnmatched,
134
134
  scanInlineSegments,
135
135
  scanSectionXml
136
- } from "./chunk-ZGXXR3DH.js";
136
+ } from "./chunk-N45RCYBL.js";
137
137
  import {
138
138
  MAX_DECOMPRESS_SIZE,
139
139
  MAX_XML_DEPTH,
@@ -150,7 +150,7 @@ import {
150
150
  localName,
151
151
  rawTextContent,
152
152
  readZipEntry
153
- } from "./chunk-NWL7D4F7.js";
153
+ } from "./chunk-IZN5BTCW.js";
154
154
  import {
155
155
  KordocError,
156
156
  VERSION,
@@ -167,7 +167,7 @@ import {
167
167
  toArrayBuffer,
168
168
  unescapeHtml,
169
169
  unzipLimitBytes
170
- } from "./chunk-VDG4G44B.js";
170
+ } from "./chunk-WQC4XWVT.js";
171
171
 
172
172
  // src/table/visual.ts
173
173
  import { readFile as readFile2 } from "fs/promises";
@@ -19351,7 +19351,7 @@ var MIN_SIDE = 24;
19351
19351
  async function ocrEmbeddedImages(blocks, options, warnings) {
19352
19352
  const ocr = options?.ocr;
19353
19353
  if (ocr !== true && ocr !== "force" && typeof ocr !== "function") return false;
19354
- const { parseImageDocument } = await import("./image-ocr-6DPYV3Z2.js");
19354
+ const { parseImageDocument } = await import("./image-ocr-QUVBGNWD.js");
19355
19355
  let inserted = false, unreadable = 0;
19356
19356
  let failed = null;
19357
19357
  const walk = async (list, depth) => {
@@ -34072,7 +34072,7 @@ function scriptsOff(r, off) {
34072
34072
  }
34073
34073
  async function parseImage(buffer, options) {
34074
34074
  try {
34075
- const { parseImageDocument } = await import("./image-ocr-6DPYV3Z2.js");
34075
+ const { parseImageDocument } = await import("./image-ocr-QUVBGNWD.js");
34076
34076
  const { blocks, warnings, lines } = await parseImageDocument(buffer, options);
34077
34077
  stripScriptTags({ blocks });
34078
34078
  return {
@@ -34136,7 +34136,7 @@ async function parseHwp(buffer, options) {
34136
34136
  async function parsePdf(buffer, options) {
34137
34137
  let parsePdfDocument;
34138
34138
  try {
34139
- const mod = await import("./parser-5LUP4EF5.js");
34139
+ const mod = await import("./parser-I2C5DUXC.js");
34140
34140
  parsePdfDocument = mod.parsePdfDocument;
34141
34141
  } catch {
34142
34142
  return {
@@ -34375,4 +34375,4 @@ export {
34375
34375
  parseHwpml,
34376
34376
  fillForm
34377
34377
  };
34378
- //# sourceMappingURL=chunk-S2LEIH33.js.map
34378
+ //# sourceMappingURL=chunk-MMZUWRH6.js.map
@@ -2,7 +2,7 @@
2
2
  import {
3
3
  loadSharp,
4
4
  rasterizePageSvg
5
- } from "./chunk-PKX6CKAI.js";
5
+ } from "./chunk-NRCG3ASU.js";
6
6
  import {
7
7
  inlineImagesIntoMarkdown
8
8
  } from "./chunk-VKVDMH7X.js";
@@ -16,7 +16,7 @@ import {
16
16
  HEADING_RATIO_H3,
17
17
  tidyScriptTags,
18
18
  unframeLayoutTables
19
- } from "./chunk-VO27MPHI.js";
19
+ } from "./chunk-F4GZFIUJ.js";
20
20
  import {
21
21
  MAX_COLS,
22
22
  MAX_ROWS,
@@ -33,7 +33,7 @@ import {
33
33
  mapPuaText,
34
34
  markNonLayoutTable,
35
35
  romanNumeral
36
- } from "./chunk-KQULVTQH.js";
36
+ } from "./chunk-B3POEH7X.js";
37
37
  import {
38
38
  DEFAULT_CHAR,
39
39
  DEFAULT_PARA_GEOM,
@@ -47,7 +47,7 @@ import {
47
47
  hwpxAppMajor,
48
48
  parseRenderStyles,
49
49
  readZipEntry
50
- } from "./chunk-NWL7D4F7.js";
50
+ } from "./chunk-IZN5BTCW.js";
51
51
  import {
52
52
  KordocError,
53
53
  compareSectionPaths,
@@ -56,7 +56,7 @@ import {
56
56
  sanitizeHref,
57
57
  stripDtd,
58
58
  toArrayBuffer
59
- } from "./chunk-VDG4G44B.js";
59
+ } from "./chunk-WQC4XWVT.js";
60
60
 
61
61
  // src/render/svg-render.ts
62
62
  import JSZip from "jszip";
@@ -177,9 +177,10 @@ function solveRowHeights(cells, rowCount, maxTotal = Number.POSITIVE_INFINITY, s
177
177
  }
178
178
  for (let k = 0; k < spans.length; k++) if (!done.has(k)) solve(k, false);
179
179
  let total = h.reduce((s, x) => s + x, 0);
180
+ const overSz = total > maxTotal;
180
181
  for (const { c, rows } of [...spans].sort((a, b) => a.rows[a.rows.length - 1] - b.rows[b.rows.length - 1] || b.rows[0] - a.rows[0])) {
181
182
  const known = rows.reduce((s, r) => s + h[r], 0);
182
- const add = Math.min(c.height - known, maxTotal - total);
183
+ const add = Math.min(c.height - known, overSz && c.contentH != null && c.contentH >= c.height ? Number.POSITIVE_INFINITY : maxTotal - total);
183
184
  if (rows.length && add > 0) {
184
185
  h[rows[rows.length - 1]] += add;
185
186
  total += add;
@@ -13252,12 +13253,24 @@ function footNoteStories(root, paraPages, geom) {
13252
13253
  const above = num(sp, "aboveLine", 850), below = num(sp, "belowLine", 567), between = num(sp, "betweenNotes", 283);
13253
13254
  const byPage = /* @__PURE__ */ new Map();
13254
13255
  for (const p of elements(root)) if (ln(p) === "p") {
13255
- const page = paraPages.get(p)?.[0] ?? 0;
13256
+ const pages = paraPages.get(p) ?? [];
13257
+ const m = pages.length > 1 ? buildPara(p) : null;
13256
13258
  for (const run of elements(p)) if (ln(run) === "run") {
13257
13259
  for (const ctrl of elements(run)) if (ln(ctrl) === "ctrl") {
13258
13260
  const fn = findChildByLocalName(ctrl, "footNote");
13259
13261
  const sub = fn && !isDeletedControl(fn) ? findChildByLocalName(fn, "subList") : null;
13260
13262
  if (!sub) continue;
13263
+ let page = pages[0] ?? 0;
13264
+ if (m) {
13265
+ const at = m.chars.findIndex((c) => c.note === fn);
13266
+ if (at >= 0) {
13267
+ let k = 0;
13268
+ m.segs.forEach((sg, i) => {
13269
+ if (sg.textpos <= at) k = i;
13270
+ });
13271
+ page = pages[k] ?? page;
13272
+ }
13273
+ }
13261
13274
  let h = 0;
13262
13275
  for (const q of elements(sub)) if (ln(q) === "p") {
13263
13276
  const lsa = findChildByLocalName(q, "linesegarray");
@@ -13483,6 +13496,10 @@ function planTableRows(tbl, cells, rowH, ty, MT, BODY_H, slack = 0, floatSpan, n
13483
13496
  const out = [];
13484
13497
  const flows = (findChildByLocalName(tbl, "pos")?.getAttribute("vertRelTo") ?? "PARA") === "PARA";
13485
13498
  let page = 0, y = ty, first = !flows || ty - MT < 2e3;
13499
+ if (!first && (tbl.getAttribute("pageBreak") ?? "NONE") === "NONE") {
13500
+ const outT = num(findChildByLocalName(tbl, "outMargin"), "top");
13501
+ if (outT + rowY[nRows] + outB <= BODY_H) return rowH.map((h, r) => [{ page: 1, y: contMT + outT + rowY[r], h }]);
13502
+ }
13486
13503
  if (!first && coAnchoredFollower(tbl)) {
13487
13504
  const outT = num(findChildByLocalName(tbl, "outMargin"), "top");
13488
13505
  if (outT + rowY[nRows] + outB <= BODY_H) return rowH.map((h, r) => [{ page: 1, y: contMT + outT + rowY[r], h }]);
@@ -15674,7 +15691,7 @@ function renderSectionToPages(root, geom, ctxBase, doReflow, reflowMode, masters
15674
15691
  let prevH = Number.NEGATIVE_INFINITY;
15675
15692
  let prevEnd = Number.NEGATIVE_INFINITY;
15676
15693
  let cur = 0, col = 0;
15677
- let pendingEnd = 0, pendingEndY = 0;
15694
+ let pendingEnd = 0, pendingEndY = 0, pendingTopY = -1;
15678
15695
  let lastEnd = 0, lastPage = -1;
15679
15696
  let lastSA = 0;
15680
15697
  let prevSeg;
@@ -15699,7 +15716,7 @@ function renderSectionToPages(root, geom, ctxBase, doReflow, reflowMode, masters
15699
15716
  }
15700
15717
  if (col > 0) s.setAttribute("horzpos", String(h + Math.round(col * (colW + colGap))));
15701
15718
  } else {
15702
- if (paraFirst && pendingEnd > cur) {
15719
+ if (paraFirst && pendingEnd > cur && !(v > prevV && v < pendingTopY - 100)) {
15703
15720
  cur = v < pendingEndY - 100 ? pendingEnd + 1 : pendingEnd;
15704
15721
  pendingEnd = 0;
15705
15722
  } else {
@@ -15771,9 +15788,10 @@ function renderSectionToPages(root, geom, ctxBase, doReflow, reflowMode, masters
15771
15788
  lastPage = pagesOf[pagesOf.length - 1];
15772
15789
  continue;
15773
15790
  }
15774
- if (span.pages > 0 && (pagesOf[0] ?? cur) + span.pages > pendingEnd) {
15791
+ if (span.pages > 0 && o.el.getAttribute("pageBreak") !== "NONE" && (pagesOf[0] ?? cur) + span.pages > pendingEnd) {
15775
15792
  pendingEnd = (pagesOf[0] ?? cur) + span.pages;
15776
15793
  pendingEndY = span.endY - MT;
15794
+ pendingTopY = below && voP > 0 && ty - MT < BODY_H ? ty - MT : -1;
15777
15795
  }
15778
15796
  }
15779
15797
  }
@@ -16008,7 +16026,7 @@ function renderSectionRoots(sections, input) {
16008
16026
  return pm.objs.length > 0 || pm.chars.some((c) => c.ch.trim() !== "" || !!c.ctrlText);
16009
16027
  });
16010
16028
  let lastIdx = sections.length - 1;
16011
- while (lastIdx > 0 && !hasContent(sections[lastIdx].root)) lastIdx--;
16029
+ while (lastIdx > 0 && !hasContent(sections[lastIdx].root) && !sections[lastIdx].masterPages?.length) lastIdx--;
16012
16030
  for (const [k, { root, index, masterPages, hasDeletionMarkers }] of sections.entries()) {
16013
16031
  if (k > lastIdx) break;
16014
16032
  const geom = readSectionGeom(root);
@@ -20313,4 +20331,4 @@ export {
20313
20331
  cropRect,
20314
20332
  extractRenderedRegions
20315
20333
  };
20316
- //# sourceMappingURL=chunk-YUEPDCVZ.js.map
20334
+ //# sourceMappingURL=chunk-MYDHNNPA.js.map