kordoc 4.22.10 → 4.22.11

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 +5 -4
  2. package/dist/{-K6ZEUCPU.js → -HVSX4WBM.js} +11 -11
  3. package/dist/{chunk-HTPPDXDH.js → chunk-4YZMZMSL.js} +2 -2
  4. package/dist/{chunk-7YDXV44H.js → chunk-4ZUR6QAO.js} +4 -4
  5. package/dist/{chunk-K65R6PB4.js → chunk-7HTGSGIV.js} +2 -2
  6. package/dist/{chunk-MILWFVER.cjs → chunk-A4UUVU43.cjs} +3 -3
  7. package/dist/{chunk-MILWFVER.cjs.map → chunk-A4UUVU43.cjs.map} +1 -1
  8. package/dist/{chunk-ZN4BGNYO.cjs → chunk-DRBOO4F2.cjs} +23 -23
  9. package/dist/{chunk-ZN4BGNYO.cjs.map → chunk-DRBOO4F2.cjs.map} +1 -1
  10. package/dist/{chunk-JJSSXV55.js → chunk-GMBWB4OU.js} +2 -2
  11. package/dist/{chunk-AXOFVPF2.js → chunk-JBPCRB4H.js} +2 -2
  12. package/dist/{chunk-5QEVIUXM.js → chunk-JX3QPTMU.js} +2 -2
  13. package/dist/{chunk-ATSTJQMI.js → chunk-K6EG6ACM.js} +85 -65
  14. package/dist/chunk-K6EG6ACM.js.map +1 -0
  15. package/dist/{chunk-3HEWZNSJ.js → chunk-KINTYLL4.js} +2 -2
  16. package/dist/{chunk-FMVSQED7.js → chunk-LP6D54PI.js} +2 -2
  17. package/dist/{chunk-TUEX7M4N.js → chunk-MDMCZUDP.js} +2 -2
  18. package/dist/{chunk-6ZQ47CXH.js → chunk-NCP7M4N2.js} +3 -3
  19. package/dist/{chunk-5TVTSRHH.js → chunk-NK3WCKJA.js} +3 -3
  20. package/dist/{chunk-GWYFJQL7.js → chunk-PFDAVLZT.js} +11 -11
  21. package/dist/{chunk-NU4IFUHW.js → chunk-PGIFLIT5.js} +2 -2
  22. package/dist/{chunk-D7FPRPEZ.cjs → chunk-PJHRL7UZ.cjs} +2 -2
  23. package/dist/{chunk-D7FPRPEZ.cjs.map → chunk-PJHRL7UZ.cjs.map} +1 -1
  24. package/dist/{chunk-HRFGBMVO.cjs → chunk-QJRRJB6Z.cjs} +6 -6
  25. package/dist/{chunk-HRFGBMVO.cjs.map → chunk-QJRRJB6Z.cjs.map} +1 -1
  26. package/dist/{chunk-M4P52HHG.js → chunk-QLDKBCAG.js} +2 -2
  27. package/dist/{chunk-ZWBFTG3T.js → chunk-RLMAOBWN.js} +2 -2
  28. package/dist/{chunk-WCXPF7PT.cjs → chunk-RWWUQMLO.cjs} +24 -24
  29. package/dist/{chunk-WCXPF7PT.cjs.map → chunk-RWWUQMLO.cjs.map} +1 -1
  30. package/dist/{chunk-55JC3WIX.cjs → chunk-SOHPBZHR.cjs} +3 -3
  31. package/dist/{chunk-55JC3WIX.cjs.map → chunk-SOHPBZHR.cjs.map} +1 -1
  32. package/dist/{chunk-4OZKQ4ET.js → chunk-SWY3AIPF.js} +2 -2
  33. package/dist/{chunk-LAZZEGT4.js → chunk-WTJ7NVIJ.js} +3 -3
  34. package/dist/{chunk-M7AXOSY5.js → chunk-XWTXCBXT.js} +4 -4
  35. package/dist/{chunk-5RBT7L72.js → chunk-YP5T2EZ7.js} +2 -2
  36. package/dist/{chunk-APEYJ6G5.js → chunk-Z6EA67XV.js} +2 -2
  37. package/dist/{chunk-A65TQXWP.js → chunk-ZXNKMDBN.js} +4 -4
  38. package/dist/{chunk-VLAYMRFS.js → chunk-ZYKZS3F6.js} +2 -2
  39. package/dist/chunks-OZGUNAAZ.js +10 -0
  40. package/dist/cli.js +30 -30
  41. package/dist/{formula-J5DTOYGK.js → formula-67MKCQ44.js} +4 -4
  42. package/dist/{formula-SOILYG2T.cjs → formula-MO5QV2WU.cjs} +9 -9
  43. package/dist/{formula-SOILYG2T.cjs.map → formula-MO5QV2WU.cjs.map} +1 -1
  44. package/dist/{formula-YYMYI32F.js → formula-N3GX3SO2.js} +3 -3
  45. package/dist/{image-ocr-EXZCN2Q5.js → image-ocr-65B7BSUH.js} +9 -9
  46. package/dist/{image-ocr-2FQTSQAQ.cjs → image-ocr-7GIT7REG.cjs} +17 -17
  47. package/dist/{image-ocr-2FQTSQAQ.cjs.map → image-ocr-7GIT7REG.cjs.map} +1 -1
  48. package/dist/{image-ocr-HXLPIDJH.js → image-ocr-PQ2Q55I2.js} +6 -6
  49. package/dist/index.cjs +403 -383
  50. package/dist/index.cjs.map +1 -1
  51. package/dist/index.js +85 -65
  52. package/dist/index.js.map +1 -1
  53. package/dist/mcp.js +22 -22
  54. package/dist/{model-bundle-L2OLSYAW.js → model-bundle-AH3WIGOE.js} +5 -5
  55. package/dist/{models-A4JR64CR.js → models-YFEVC3DI.js} +5 -5
  56. package/dist/{parse-worker-v2-YCNMSEIB.js → parse-worker-v2-7NT2ZMYZ.js} +12 -12
  57. package/dist/{parser-S3IJOFFP.cjs → parser-DIA2JXPE.cjs} +157 -157
  58. package/dist/{parser-S3IJOFFP.cjs.map → parser-DIA2JXPE.cjs.map} +1 -1
  59. package/dist/{parser-WFLZFNN4.js → parser-OZI6POE7.js} +12 -12
  60. package/dist/{parser-2QCANHDO.js → parser-REXFNEES.js} +9 -9
  61. package/dist/pdf-ocr-3K5LAKGL.cjs +31 -0
  62. package/dist/{pdf-ocr-6S4U4T56.cjs.map → pdf-ocr-3K5LAKGL.cjs.map} +1 -1
  63. package/dist/{pdf-ocr-MXOMLVFC.js → pdf-ocr-EUJDEV4Z.js} +6 -6
  64. package/dist/{pdf-ocr-UBQ4K63F.js → pdf-ocr-U2XEMTFR.js} +9 -9
  65. package/dist/{profile-io-PIHSFGQ6.js → profile-io-OIFR5XXG.js} +3 -3
  66. package/dist/{rasterize-7GBVLJG4.js → rasterize-7QURJJZB.js} +3 -3
  67. package/dist/{redact-doc-CVJWVNKE.js → redact-doc-OIHZYWVF.js} +11 -11
  68. package/dist/{render-FQN7Y52S.js → render-ZAJ4L4QM.js} +7 -7
  69. package/dist/seal-XVZFHFMG.js +10 -0
  70. package/dist/{setup-JTVGMAJB.js → setup-MWFDDT5X.js} +3 -3
  71. package/dist/visual-QZVCWEG2.js +21 -0
  72. package/dist/{watch-5MU2GVS4.js → watch-7K2NBGMZ.js} +12 -12
  73. package/package.json +1 -1
  74. package/dist/chunk-ATSTJQMI.js.map +0 -1
  75. package/dist/chunks-A4DKG5YP.js +0 -10
  76. package/dist/pdf-ocr-6S4U4T56.cjs +0 -31
  77. package/dist/seal-FZGFDRBC.js +0 -10
  78. package/dist/visual-SNHWQXSM.js +0 -21
  79. /package/dist/{-K6ZEUCPU.js.map → -HVSX4WBM.js.map} +0 -0
  80. /package/dist/{chunk-HTPPDXDH.js.map → chunk-4YZMZMSL.js.map} +0 -0
  81. /package/dist/{chunk-7YDXV44H.js.map → chunk-4ZUR6QAO.js.map} +0 -0
  82. /package/dist/{chunk-K65R6PB4.js.map → chunk-7HTGSGIV.js.map} +0 -0
  83. /package/dist/{chunk-JJSSXV55.js.map → chunk-GMBWB4OU.js.map} +0 -0
  84. /package/dist/{chunk-AXOFVPF2.js.map → chunk-JBPCRB4H.js.map} +0 -0
  85. /package/dist/{chunk-5QEVIUXM.js.map → chunk-JX3QPTMU.js.map} +0 -0
  86. /package/dist/{chunk-3HEWZNSJ.js.map → chunk-KINTYLL4.js.map} +0 -0
  87. /package/dist/{chunk-FMVSQED7.js.map → chunk-LP6D54PI.js.map} +0 -0
  88. /package/dist/{chunk-TUEX7M4N.js.map → chunk-MDMCZUDP.js.map} +0 -0
  89. /package/dist/{chunk-6ZQ47CXH.js.map → chunk-NCP7M4N2.js.map} +0 -0
  90. /package/dist/{chunk-5TVTSRHH.js.map → chunk-NK3WCKJA.js.map} +0 -0
  91. /package/dist/{chunk-GWYFJQL7.js.map → chunk-PFDAVLZT.js.map} +0 -0
  92. /package/dist/{chunk-NU4IFUHW.js.map → chunk-PGIFLIT5.js.map} +0 -0
  93. /package/dist/{chunk-M4P52HHG.js.map → chunk-QLDKBCAG.js.map} +0 -0
  94. /package/dist/{chunk-ZWBFTG3T.js.map → chunk-RLMAOBWN.js.map} +0 -0
  95. /package/dist/{chunk-4OZKQ4ET.js.map → chunk-SWY3AIPF.js.map} +0 -0
  96. /package/dist/{chunk-LAZZEGT4.js.map → chunk-WTJ7NVIJ.js.map} +0 -0
  97. /package/dist/{chunk-M7AXOSY5.js.map → chunk-XWTXCBXT.js.map} +0 -0
  98. /package/dist/{chunk-5RBT7L72.js.map → chunk-YP5T2EZ7.js.map} +0 -0
  99. /package/dist/{chunk-APEYJ6G5.js.map → chunk-Z6EA67XV.js.map} +0 -0
  100. /package/dist/{chunk-A65TQXWP.js.map → chunk-ZXNKMDBN.js.map} +0 -0
  101. /package/dist/{chunk-VLAYMRFS.js.map → chunk-ZYKZS3F6.js.map} +0 -0
  102. /package/dist/{chunks-A4DKG5YP.js.map → chunks-OZGUNAAZ.js.map} +0 -0
  103. /package/dist/{formula-J5DTOYGK.js.map → formula-67MKCQ44.js.map} +0 -0
  104. /package/dist/{formula-YYMYI32F.js.map → formula-N3GX3SO2.js.map} +0 -0
  105. /package/dist/{image-ocr-EXZCN2Q5.js.map → image-ocr-65B7BSUH.js.map} +0 -0
  106. /package/dist/{image-ocr-HXLPIDJH.js.map → image-ocr-PQ2Q55I2.js.map} +0 -0
  107. /package/dist/{model-bundle-L2OLSYAW.js.map → model-bundle-AH3WIGOE.js.map} +0 -0
  108. /package/dist/{models-A4JR64CR.js.map → models-YFEVC3DI.js.map} +0 -0
  109. /package/dist/{parse-worker-v2-YCNMSEIB.js.map → parse-worker-v2-7NT2ZMYZ.js.map} +0 -0
  110. /package/dist/{parser-WFLZFNN4.js.map → parser-OZI6POE7.js.map} +0 -0
  111. /package/dist/{parser-2QCANHDO.js.map → parser-REXFNEES.js.map} +0 -0
  112. /package/dist/{pdf-ocr-MXOMLVFC.js.map → pdf-ocr-EUJDEV4Z.js.map} +0 -0
  113. /package/dist/{pdf-ocr-UBQ4K63F.js.map → pdf-ocr-U2XEMTFR.js.map} +0 -0
  114. /package/dist/{profile-io-PIHSFGQ6.js.map → profile-io-OIFR5XXG.js.map} +0 -0
  115. /package/dist/{rasterize-7GBVLJG4.js.map → rasterize-7QURJJZB.js.map} +0 -0
  116. /package/dist/{redact-doc-CVJWVNKE.js.map → redact-doc-OIHZYWVF.js.map} +0 -0
  117. /package/dist/{render-FQN7Y52S.js.map → render-ZAJ4L4QM.js.map} +0 -0
  118. /package/dist/{seal-FZGFDRBC.js.map → seal-XVZFHFMG.js.map} +0 -0
  119. /package/dist/{setup-JTVGMAJB.js.map → setup-MWFDDT5X.js.map} +0 -0
  120. /package/dist/{visual-SNHWQXSM.js.map → visual-QZVCWEG2.js.map} +0 -0
  121. /package/dist/{watch-5MU2GVS4.js.map → watch-7K2NBGMZ.js.map} +0 -0
@@ -3,7 +3,7 @@ import {
3
3
  ensureModelsIn,
4
4
  getModelStatusIn,
5
5
  getModelsDir
6
- } from "./chunk-FMVSQED7.js";
6
+ } from "./chunk-LP6D54PI.js";
7
7
 
8
8
  // src/ocr/models.ts
9
9
  import { join } from "path";
@@ -162,4 +162,4 @@ export {
162
162
  parseCharacterDict,
163
163
  ocrModelPath
164
164
  };
165
- //# sourceMappingURL=chunk-JJSSXV55.js.map
165
+ //# sourceMappingURL=chunk-GMBWB4OU.js.map
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  escapeHtml,
3
3
  sanitizeHref
4
- } from "./chunk-APEYJ6G5.js";
4
+ } from "./chunk-Z6EA67XV.js";
5
5
 
6
6
  // src/script-tags.ts
7
7
  var LITERAL_TAG = /<(?=\/?(?:u|sup|sub)>)/g;
@@ -1539,4 +1539,4 @@ export {
1539
1539
  HEADING_RATIO_H3,
1540
1540
  validateOcrOptions
1541
1541
  };
1542
- //# sourceMappingURL=chunk-AXOFVPF2.js.map
1542
+ //# sourceMappingURL=chunk-JBPCRB4H.js.map
@@ -2,7 +2,7 @@
2
2
  import {
3
3
  KordocError,
4
4
  unzipLimitBytes
5
- } from "./chunk-ZWBFTG3T.js";
5
+ } from "./chunk-RLMAOBWN.js";
6
6
 
7
7
  // src/hwpx/parser-shared.ts
8
8
  import { DOMParser } from "@xmldom/xmldom";
@@ -494,4 +494,4 @@ export {
494
494
  hwpFaceToCssStack,
495
495
  parseRenderStyles
496
496
  };
497
- //# sourceMappingURL=chunk-5QEVIUXM.js.map
497
+ //# sourceMappingURL=chunk-JX3QPTMU.js.map
@@ -2,7 +2,7 @@
2
2
  import {
3
3
  loadSharp,
4
4
  rasterizePageSvg
5
- } from "./chunk-HTPPDXDH.js";
5
+ } from "./chunk-4YZMZMSL.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-K65R6PB4.js";
19
+ } from "./chunk-7HTGSGIV.js";
20
20
  import {
21
21
  MAX_COLS,
22
22
  MAX_ROWS,
@@ -32,7 +32,7 @@ import {
32
32
  mapPuaText,
33
33
  markNonLayoutTable,
34
34
  romanNumeral
35
- } from "./chunk-3HEWZNSJ.js";
35
+ } from "./chunk-KINTYLL4.js";
36
36
  import {
37
37
  DEFAULT_CHAR,
38
38
  DEFAULT_PARA_GEOM,
@@ -46,7 +46,7 @@ import {
46
46
  hwpxAppMajor,
47
47
  parseRenderStyles,
48
48
  readZipEntry
49
- } from "./chunk-5QEVIUXM.js";
49
+ } from "./chunk-JX3QPTMU.js";
50
50
  import {
51
51
  KordocError,
52
52
  compareSectionPaths,
@@ -54,7 +54,7 @@ import {
54
54
  precheckZipSize,
55
55
  sanitizeHref,
56
56
  toArrayBuffer
57
- } from "./chunk-ZWBFTG3T.js";
57
+ } from "./chunk-RLMAOBWN.js";
58
58
 
59
59
  // src/render/svg-render.ts
60
60
  import JSZip from "jszip";
@@ -11485,7 +11485,9 @@ function measureTableRowHeights(tbl, memo) {
11485
11485
  const nRows = Math.max(...cells.map((c) => c.ra + c.rs));
11486
11486
  const sp = num(tbl, "cellSpacing");
11487
11487
  const rows = solveRowHeights(
11488
- cells.map((c) => ({ rowAddr: c.ra, rowSpan: c.rs, height: c.h - sp * (c.rs - 1), contentH: c.rs === 1 ? cellContentExtent(c, memo) + c.marginT + c.marginB : void 0 })),
11488
+ // 여러 행 칸은 내용(+ 칸 여백)이 저장 높이보다 크면 내용 높이로 — 솔버가 모자란 만큼 그 칸 마지막 행을 키운다
11489
+ // (같은 판 PDF: 두 줄 든 2행 병합 칸 내용 2882 > 저장 2564 → 둘째 행이 318 자라고 첫 행은 그대로)
11490
+ cells.map((c) => ({ rowAddr: c.ra, rowSpan: c.rs, height: (c.rs > 1 ? Math.max(c.h, cellContentExtent(c, memo) + c.marginT + c.marginB) : c.h) - sp * (c.rs - 1), contentH: c.rs === 1 ? cellContentExtent(c, memo) + c.marginT + c.marginB : void 0 })),
11489
11491
  nRows,
11490
11492
  num(findChildByLocalName(tbl, "sz"), "height") - (sp > 0 ? sp * (nRows + 1) : 0) || Number.POSITIVE_INFINITY
11491
11493
  );
@@ -11772,10 +11774,10 @@ function subFloatBottoms(sub) {
11772
11774
  const rowInfo = split ? { rows: measureTableRowHeights(o), outT: num(om, "top"), outB: num(om, "bottom"), el: o } : {};
11773
11775
  if (spacesHost(p)) {
11774
11776
  const top0 = v0 - voS - carry;
11775
- out.push({ v0: top0, bottom: v0, carry, hostEnd: top0, lineBottom: top0 + num(seg, "vertsize"), ...rowInfo });
11777
+ out.push({ v0: top0, bottom: v0, carry, hostEnd: top0, lineBottom: top0 + num(seg, "vertsize"), ...rowInfo, seg });
11776
11778
  continue;
11777
11779
  }
11778
- out.push({ v0, bottom: v0 + voS + carry, carry, hostEnd, lineBottom: v0 + num(seg, "vertsize"), ...rowInfo });
11780
+ out.push({ v0, bottom: v0 + voS + carry, carry, hostEnd, lineBottom: v0 + num(seg, "vertsize"), ...rowInfo, seg });
11779
11781
  }
11780
11782
  }
11781
11783
  }
@@ -13246,7 +13248,7 @@ function cellLineBoxes(c) {
13246
13248
  function cellLines(c) {
13247
13249
  return cellLineBoxes(c).map((b) => [b.top, b.bottom]);
13248
13250
  }
13249
- function planTableRows(tbl, cells, rowH, ty, MT, BODY_H, slack = 0, floatSpan, nested = false) {
13251
+ function planTableRows(tbl, cells, rowH, ty, MT, BODY_H, slack = 0, floatSpan, nested = false, contMT = MT) {
13250
13252
  if (nested) slack = 0;
13251
13253
  const nRows = rowH.length;
13252
13254
  const rowY = [0];
@@ -13267,7 +13269,7 @@ function planTableRows(tbl, cells, rowH, ty, MT, BODY_H, slack = 0, floatSpan, n
13267
13269
  }
13268
13270
  let hdrRows = 0;
13269
13271
  if (tbl.getAttribute("repeatHeader") === "1") while (hdrRows < nRows && cells.some((c) => c.ra === hdrRows) && cells.filter((c) => c.ra === hdrRows).every((c) => c.el.getAttribute("header") === "1")) hdrRows++;
13270
- const contTop = MT + num(findChildByLocalName(tbl, "outMargin"), "top") + rowY[hdrRows];
13272
+ const contTop = contMT + num(findChildByLocalName(tbl, "outMargin"), "top") + rowY[hdrRows];
13271
13273
  const outB = num(findChildByLocalName(tbl, "outMargin"), "bottom");
13272
13274
  const cellSplit = tbl.getAttribute("pageBreak") === "CELL";
13273
13275
  const out = [];
@@ -13318,7 +13320,7 @@ function planTableRows(tbl, cells, rowH, ty, MT, BODY_H, slack = 0, floatSpan, n
13318
13320
  for (const c of rowCells) {
13319
13321
  const b = (boxes.get(c.el) ?? []).find((x) => x.part === k);
13320
13322
  if (!b) continue;
13321
- const f = floatSpan(b.seg, y + c.marginT);
13323
+ const f = floatSpan(b.seg, y + c.marginT, contTop + c.marginT);
13322
13324
  if (f?.el && f.pages > 0 && f.pages > lead && Math.abs(contTop + c.marginT + b.top - b.origin - f.endY) < 3e3) {
13323
13325
  lead = f.pages;
13324
13326
  place = /* @__PURE__ */ new Map([[f.el, y + c.marginT]]);
@@ -13339,12 +13341,16 @@ function planTableRows(tbl, cells, rowH, ty, MT, BODY_H, slack = 0, floatSpan, n
13339
13341
  const from = inK[0]?.origin ?? next?.origin ?? Number.POSITIVE_INFINITY;
13340
13342
  range.set(c.el, [from, next?.top ?? Number.POSITIVE_INFINITY]);
13341
13343
  if (inK.length) ext = Math.max(ext, inK[inK.length - 1].bottom - from + c.marginT + c.marginB);
13344
+ if (k === hParts && inK.length && c.sub) for (const f of subFloatBottoms(c.sub)) {
13345
+ const b = bs.find((x) => x.seg === f.seg);
13346
+ if (b && b.part === k) ext = Math.max(ext, b.top + f.bottom - f.v0 - from + c.marginT + c.marginB);
13347
+ }
13342
13348
  if (inK.length && next) toNext = Math.max(toNext, next.top - from + c.marginT + c.marginB);
13343
13349
  }
13344
13350
  const last = k === hParts;
13345
13351
  const cellH = Math.max(0, ...rowCells.map((c) => num(findChildByLocalName(c.el, "cellSz"), "height")));
13346
13352
  const firstH = Math.min(declared > 0 && ty + declared - y >= ext ? Math.min(pageBottom - y, ty + declared - y) : pageBottom - y, Math.max(ext, cellH));
13347
- const share = last && k === 1 ? Math.max(0, ...rowCells.filter((c) => tbl.getAttribute("noAdjust") === "1" || /^(CENTER|BOTTOM)$/.test(c.sub?.getAttribute("vertAlign") ?? "")).map((c) => c.h - firstPh)) : 0;
13353
+ const share = last && k === 1 ? Math.max(0, ...rowCells.filter((c) => tbl.getAttribute("noAdjust") === "1" || /^(CENTER|BOTTOM)$/.test(c.sub?.getAttribute("vertAlign") ?? "")).map((c) => c.h - firstPh).filter((v) => v <= pageBottom - contTop)) : 0;
13348
13354
  const ph = last ? Math.max(ext, share) : k === 0 ? firstH : toNext > 0 ? Math.min(pageBottom - contTop, toNext) : pageBottom - contTop;
13349
13355
  if (k === 0) firstPh = ph;
13350
13356
  pieces.push({ page, y, h: ph, range });
@@ -13354,7 +13360,7 @@ function planTableRows(tbl, cells, rowH, ty, MT, BODY_H, slack = 0, floatSpan, n
13354
13360
  const bs = (boxes.get(c.el) ?? []).filter((b) => b.part === k), from = bs[0]?.origin ?? 0;
13355
13361
  for (const b of bs) {
13356
13362
  if (led.has(b.seg)) continue;
13357
- const f = floatSpan(b.seg, y + c.marginT + b.top - from);
13363
+ const f = floatSpan(b.seg, y + c.marginT + b.top - from, contTop + c.marginT);
13358
13364
  if (f && f.pages > span) {
13359
13365
  span = f.pages;
13360
13366
  spanEnd = f.endY;
@@ -13600,6 +13606,54 @@ function shapeGeometry(o, boxX, boxY, defs, images, warn, local = false) {
13600
13606
  return { ...geometry, svg };
13601
13607
  }
13602
13608
 
13609
+ // src/render/object-anchor.ts
13610
+ function linePushedBy(o, lineV, paraTop) {
13611
+ if (paraTop === void 0) return false;
13612
+ const om = findChildByLocalName(o.el, "outMargin");
13613
+ return Math.abs(lineV - (num(om, "top") + o.height + num(om, "bottom")) - paraTop) <= 10;
13614
+ }
13615
+ function anchorObject(o, ox, oy, baseV, areaW, ctx, anchorLineV, stayLine = false, paraStartV, laterLineH) {
13616
+ const { PW, PH, ML, MT, BODY_W, BODY_H } = ctx.geom;
13617
+ const pos = findChildByLocalName(o.el, "pos");
13618
+ const om = findChildByLocalName(o.el, "outMargin");
13619
+ const omT = num(om, "top"), omB = num(om, "bottom");
13620
+ const w = o.width, h = o.tag === "tbl" ? Math.max(o.height, measureTableHeight(o.el, ctx.extentMemo)) : o.height;
13621
+ if (!pos) return { x: ox, y: oy + baseV };
13622
+ const voRaw = num(pos, "vertOffset"), voS = voRaw >= 2 ** 31 ? voRaw - 2 ** 32 : voRaw;
13623
+ const vo = (pos.getAttribute("vertRelTo") ?? "PARA") === "PARA" ? Math.max(0, voS) : voS;
13624
+ const ho = num(pos, "horzOffset");
13625
+ const vrel = pos.getAttribute("vertRelTo") ?? "PARA";
13626
+ const hrel = pos.getAttribute("horzRelTo") ?? "PARA";
13627
+ const va = pos.getAttribute("vertAlign") ?? "TOP";
13628
+ const ha = pos.getAttribute("horzAlign") ?? "LEFT";
13629
+ const wrap = o.el.getAttribute("textWrap") ?? "TOP_AND_BOTTOM";
13630
+ let y;
13631
+ if (vrel === "PAPER") {
13632
+ y = va === "BOTTOM" ? PH - h - vo - omB : va === "CENTER" ? (PH - h) / 2 + vo : vo + omT;
13633
+ } else if (vrel === "PAGE") {
13634
+ y = va === "BOTTOM" ? MT + BODY_H - h - vo : va === "CENTER" ? MT + (BODY_H - h) / 2 + vo : MT + vo;
13635
+ } else if (wrap === "TOP_AND_BOTTOM") {
13636
+ const lineV = anchorLineV ?? baseV;
13637
+ const pushed = lineV - (omT + h + omB);
13638
+ const below = laterLineH !== void 0 && vo + omT >= laterLineH;
13639
+ const anchor = below ? lineV : stayLine !== false ? lineV - stayLine : pushed >= -100 ? pushed : paraStartV !== void 0 ? paraStartV : lineV;
13640
+ y = oy + anchor + omT + vo;
13641
+ } else {
13642
+ const origin = vrel === "PARA" && wrap === "SQUARE" ? paraStartV ?? baseV : baseV;
13643
+ y = oy + Math.max(origin + vo, wrap === "SQUARE" && anchorLineV !== void 0 ? anchorLineV : -Infinity) + omT;
13644
+ }
13645
+ let x;
13646
+ const omL = num(om, "left"), omR = num(om, "right");
13647
+ if (hrel === "PAGE") {
13648
+ x = ha === "RIGHT" ? ML + BODY_W - w - ho - omR : ha === "CENTER" ? ML + (BODY_W - w) / 2 + ho : ML + ho + omL;
13649
+ } else if (hrel === "PAPER") {
13650
+ x = (ha === "RIGHT" ? PW - w - ho - omR : ha === "CENTER" ? (PW - w) / 2 + ho : ho + omL) - (ctx.bodyDx?.(ctx.page) ?? 0);
13651
+ } else {
13652
+ x = ha === "RIGHT" ? ox + areaW - w - ho - omR : ha === "CENTER" ? ox + (areaW - w) / 2 + ho : ox + ho + omL;
13653
+ }
13654
+ return { x, y };
13655
+ }
13656
+
13603
13657
  // src/render/equation-text.ts
13604
13658
  var SYMBOLS = {
13605
13659
  alpha: "\u03B1",
@@ -14336,49 +14390,6 @@ function hwpEquationToLatex(equation) {
14336
14390
  return hmlToLatex(s).replace(/\s+/g, " ").trim();
14337
14391
  }
14338
14392
 
14339
- // src/render/object-anchor.ts
14340
- function anchorObject(o, ox, oy, baseV, areaW, ctx, anchorLineV, stayLine = false, paraStartV, laterLineH) {
14341
- const { PW, PH, ML, MT, BODY_W, BODY_H } = ctx.geom;
14342
- const pos = findChildByLocalName(o.el, "pos");
14343
- const om = findChildByLocalName(o.el, "outMargin");
14344
- const omT = num(om, "top"), omB = num(om, "bottom");
14345
- const w = o.width, h = o.tag === "tbl" ? Math.max(o.height, measureTableHeight(o.el, ctx.extentMemo)) : o.height;
14346
- if (!pos) return { x: ox, y: oy + baseV };
14347
- const voRaw = num(pos, "vertOffset"), voS = voRaw >= 2 ** 31 ? voRaw - 2 ** 32 : voRaw;
14348
- const vo = (pos.getAttribute("vertRelTo") ?? "PARA") === "PARA" ? Math.max(0, voS) : voS;
14349
- const ho = num(pos, "horzOffset");
14350
- const vrel = pos.getAttribute("vertRelTo") ?? "PARA";
14351
- const hrel = pos.getAttribute("horzRelTo") ?? "PARA";
14352
- const va = pos.getAttribute("vertAlign") ?? "TOP";
14353
- const ha = pos.getAttribute("horzAlign") ?? "LEFT";
14354
- const wrap = o.el.getAttribute("textWrap") ?? "TOP_AND_BOTTOM";
14355
- let y;
14356
- if (vrel === "PAPER") {
14357
- y = va === "BOTTOM" ? PH - h - vo - omB : va === "CENTER" ? (PH - h) / 2 + vo : vo + omT;
14358
- } else if (vrel === "PAGE") {
14359
- y = va === "BOTTOM" ? MT + BODY_H - h - vo : va === "CENTER" ? MT + (BODY_H - h) / 2 + vo : MT + vo;
14360
- } else if (wrap === "TOP_AND_BOTTOM") {
14361
- const lineV = anchorLineV ?? baseV;
14362
- const pushed = lineV - (omT + h + omB);
14363
- const below = laterLineH !== void 0 && vo + omT >= laterLineH;
14364
- const anchor = below ? lineV : stayLine !== false ? lineV - stayLine : pushed >= -100 ? pushed : paraStartV !== void 0 ? paraStartV : lineV;
14365
- y = oy + anchor + omT + vo;
14366
- } else {
14367
- const origin = vrel === "PARA" && wrap === "SQUARE" ? paraStartV ?? baseV : baseV;
14368
- y = oy + Math.max(origin + vo, wrap === "SQUARE" && anchorLineV !== void 0 ? anchorLineV : -Infinity) + omT;
14369
- }
14370
- let x;
14371
- const omL = num(om, "left"), omR = num(om, "right");
14372
- if (hrel === "PAGE") {
14373
- x = ha === "RIGHT" ? ML + BODY_W - w - ho - omR : ha === "CENTER" ? ML + (BODY_W - w) / 2 + ho : ML + ho + omL;
14374
- } else if (hrel === "PAPER") {
14375
- x = (ha === "RIGHT" ? PW - w - ho - omR : ha === "CENTER" ? (PW - w) / 2 + ho : ho + omL) - (ctx.bodyDx?.(ctx.page) ?? 0);
14376
- } else {
14377
- x = ha === "RIGHT" ? ox + areaW - w - ho - omR : ha === "CENTER" ? ox + (areaW - w) / 2 + ho : ox + ho + omL;
14378
- }
14379
- return { x, y };
14380
- }
14381
-
14382
14393
  // src/render/svg-content.ts
14383
14394
  function escapeXml(s) {
14384
14395
  return s.replace(/[\x00-\x08\x0B\x0C\x0E-\x1F]/g, "").replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;");
@@ -14706,8 +14717,9 @@ function drawPara(p, ox, oy, areaW, ctx, depth, segPages) {
14706
14717
  }
14707
14718
  }
14708
14719
  const tbFloats = m.objs.filter((q) => !q.inline && (q.el.getAttribute("textWrap") ?? "TOP_AND_BOTTOM") === "TOP_AND_BOTTOM" && (findChildByLocalName(q.el, "pos")?.getAttribute("vertRelTo") ?? "PARA") === "PARA").length;
14709
- const stay = tbFloats < 2 && !m.objs.some((q) => q.inline) && !m.chars.some((c) => c.ch !== "" && !c.nb && c.ch.trim() !== "");
14720
+ let stay = tbFloats < 2 && !m.objs.some((q) => q.inline) && !m.chars.some((c) => c.ch !== "" && !c.nb && c.ch.trim() !== "");
14710
14721
  const sbA = m.paraPrId != null ? ctx.styles.paraGeom.get(m.paraPrId)?.spaceBefore ?? 0 : 0;
14722
+ if (stay && wrapA === "TOP_AND_BOTTOM" && linePushedBy(o, anchorLineV ?? baseV, pTop)) stay = false;
14711
14723
  const firstLine = anchorLineV === void 0 || anchorLineV === baseV;
14712
14724
  let { x, y } = anchorObject(o, ax, oy, objBaseV, aw, ctx, anchorLineV, stay ? sbA : false, (firstLine || wrapA === "SQUARE") && pTop !== void 0 && pTop < baseV ? pTop : void 0, firstLine ? void 0 : anchorLineH);
14713
14725
  if (depth === 0 && tbFloats >= 2 && wrapA === "TOP_AND_BOTTOM") {
@@ -14883,13 +14895,13 @@ function edgeLine(x1, y1, x2, y2, e) {
14883
14895
  const dash = /DASH|DOT/.test(e.type) ? ` stroke-dasharray="${e.type.includes("DOT") ? "1,1.5" : "3,1.5"}"` : "";
14884
14896
  return `<line x1="${pt2(x1)}" y1="${pt2(y1)}" x2="${pt2(x2)}" y2="${pt2(y2)}" stroke="${escapeXml(e.color)}" stroke-width="${e.widthPt.toFixed(2)}"${dash}/>`;
14885
14897
  }
14886
- function tableContPages(tbl, ty, MT, BODY_H, memo, slack = 0, floatSpan, nested = false) {
14887
- const pcs = planTableRows(tbl, collectCells(tbl), measureTableRowHeights(tbl, memo), ty, MT, BODY_H, slack, floatSpan, nested).flat();
14898
+ function tableContPages(tbl, ty, MT, BODY_H, memo, slack = 0, floatSpan, nested = false, contMT = MT) {
14899
+ const pcs = planTableRows(tbl, collectCells(tbl), measureTableRowHeights(tbl, memo), ty, MT, BODY_H, slack, floatSpan, nested, contMT).flat();
14888
14900
  const last = pcs.reduce((a, b) => b.page > a.page || b.page === a.page && b.y + b.h > a.y + a.h ? b : a, pcs[0] ?? { page: 0, y: ty, h: 0 });
14889
14901
  return { pages: last.page, endY: last.y + last.h };
14890
14902
  }
14891
14903
  function cellFloatSpan(MT, BODY_H, memo, slack) {
14892
- return (seg, top) => {
14904
+ return (seg, top, contMT) => {
14893
14905
  const lsa = seg.parentNode, p = lsa?.parentNode;
14894
14906
  if (!p || ln(p) !== "p") return void 0;
14895
14907
  const segs = elements(lsa).filter((e) => ln(e) === "lineseg"), k = segs.indexOf(seg);
@@ -14902,7 +14914,7 @@ function cellFloatSpan(MT, BODY_H, memo, slack) {
14902
14914
  const segK = Math.max(0, m.segs.findIndex((sg, i) => sg.textpos <= o.index && (i === m.segs.length - 1 || m.segs[i + 1].textpos > o.index)));
14903
14915
  if (segK !== k) continue;
14904
14916
  const ty = top + num(findChildByLocalName(o.el, "outMargin"), "top") + Math.max(0, toInt32(pos?.getAttribute("vertOffset") ?? void 0, 0));
14905
- const span = tableContPages(o.el, ty, MT, BODY_H, memo, slack, cellFloatSpan(MT, BODY_H, memo, slack), true);
14917
+ const span = tableContPages(o.el, ty, MT, BODY_H, memo, slack, cellFloatSpan(MT, BODY_H, memo, slack), true, contMT);
14906
14918
  if (span.pages > 0 && (!best || span.pages > best.pages)) best = { ...span, el: o.el };
14907
14919
  }
14908
14920
  return best;
@@ -14934,7 +14946,7 @@ function drawTable(tbl, tx, ty, ctx, depth) {
14934
14946
  if (tbl.getAttribute("repeatHeader") === "1") while (hdrRows < nRows && cells.some((c) => c.ra === hdrRows) && cells.filter((c) => c.ra === hdrRows).every((c) => c.el.getAttribute("header") === "1")) hdrRows++;
14935
14947
  const slack = ctx.geom.PH - ctx.geom.MT - ctx.geom.BODY_H;
14936
14948
  const splitHere = depth === 1 || !!ctx.splitCell && findChildByLocalName(tbl, "pos")?.getAttribute("treatAsChar") !== "1";
14937
- const plan = splitHere ? planTableRows(tbl, cells, rowH, ty, ctx.geom.MT, ctx.geom.BODY_H, slack, cellFloatSpan(ctx.geom.MT, ctx.geom.BODY_H, ctx.extentMemo, slack), depth !== 1) : rowH.map((h, r) => [{ page: 0, y: ty + rowY[r], h }]);
14949
+ const plan = splitHere ? planTableRows(tbl, cells, rowH, ty, ctx.geom.MT, ctx.geom.BODY_H, slack, cellFloatSpan(ctx.geom.MT, ctx.geom.BODY_H, ctx.extentMemo, slack), depth !== 1, depth !== 1 && ctx.splitContMT !== void 0 ? ctx.splitContMT : ctx.geom.MT) : rowH.map((h, r) => [{ page: 0, y: ty + rowY[r], h }]);
14938
14950
  const splitSaved = ctx.splitCell;
14939
14951
  ctx.splitCell = false;
14940
14952
  for (const pc of plan.flat()) for (const [el, py] of pc.place ?? []) (ctx.objPlace ??= /* @__PURE__ */ new Map()).set(el, { page: startPage + pc.page, y: py });
@@ -14970,10 +14982,15 @@ function drawTable(tbl, tx, ty, ctx, depth) {
14970
14982
  return !!r && v >= r[0] && v < r[1];
14971
14983
  }));
14972
14984
  const va2 = c.sub.getAttribute("vertAlign") ?? "TOP";
14985
+ const lastK = g.pieces.length - 1;
14973
14986
  const pieceOff = g.pieces.map((pc, k) => {
14974
- if (va2 === "TOP" || k > 0) return 0;
14987
+ if (va2 === "TOP" || k > 0 && k < lastK) return 0;
14975
14988
  const from = pc.range?.get(c.el)?.[0] ?? 0;
14976
14989
  const bottoms = boxes.filter((b) => pieceOf(b.top) === k).map((b) => b.bottom - from);
14990
+ if (k > 0) for (const f of subFloatBottoms(c.sub)) {
14991
+ const b = boxes.find((x) => x.seg === f.seg);
14992
+ if (b && pieceOf(b.top) === k) bottoms.push(b.top + f.bottom - f.v0 - from);
14993
+ }
14977
14994
  if (!bottoms.length) return 0;
14978
14995
  const free = pc.h - c.marginT - c.marginB - Math.max(...bottoms);
14979
14996
  return Math.max(0, va2 === "CENTER" ? free / 2 : free);
@@ -14990,7 +15007,10 @@ function drawTable(tbl, tx, ty, ctx, depth) {
14990
15007
  return startPage + pc.page;
14991
15008
  });
14992
15009
  ctx.splitCell = splitHere;
15010
+ const contMTSaved = ctx.splitContMT;
15011
+ ctx.splitContMT = ctx.geom.MT + num(findChildByLocalName(tbl, "outMargin"), "top") + rowY[hdrRows] + c.marginT;
14993
15012
  drawPara(p, g.x + c.marginL, base, g.w - c.marginL - c.marginR, ctx, depth + 1, pages);
15013
+ ctx.splitContMT = contMTSaved;
14994
15014
  ctx.splitCell = false;
14995
15015
  segs.forEach((sg, i) => sg.setAttribute("vertpos", saved[i] ?? "0"));
14996
15016
  }
@@ -15265,9 +15285,9 @@ function renderSectionToPages(root, geom, ctxBase, doReflow, reflowMode, masters
15265
15285
  const h = Math.max(o.height, measureTableHeight(o.el, ctxBase.extentMemo)), omT = num(om, "top"), omB = num(om, "bottom");
15266
15286
  const pushed = segV - (omT + h + omB);
15267
15287
  const nTb = m0.objs.filter((q) => !q.inline && (q.el.getAttribute("textWrap") ?? "TOP_AND_BOTTOM") === "TOP_AND_BOTTOM").length;
15268
- const stay = nTb < 2 && !m0.objs.some((q) => q.inline) && !m0.chars.some((c) => c.ch !== "" && !c.nb && c.ch.trim() !== "");
15269
15288
  const wrapP = o.el.getAttribute("textWrap") ?? "TOP_AND_BOTTOM";
15270
15289
  const pTop = paraTops.get(p), sbP = m0.paraPrId != null ? geom0.get(m0.paraPrId)?.spaceBefore ?? 0 : 0;
15290
+ const stay = nTb < 2 && !m0.objs.some((q) => q.inline) && !m0.chars.some((c) => c.ch !== "" && !c.nb && c.ch.trim() !== "") && !(!o.inline && wrapP === "TOP_AND_BOTTOM" && linePushedBy(o, segV, pTop));
15271
15291
  const nonPush = wrapP !== "TOP_AND_BOTTOM" && pTop !== void 0 && segV > pTop + sbP + 100 ? pTop + sbP : void 0;
15272
15292
  const voP = Math.max(0, toInt32(pos?.getAttribute("vertOffset") ?? void 0, 0));
15273
15293
  const paraStart = segK === 0 && pTop !== void 0 && pTop < segV ? pTop : segV;
@@ -19799,4 +19819,4 @@ export {
19799
19819
  cropRect,
19800
19820
  extractRenderedRegions
19801
19821
  };
19802
- //# sourceMappingURL=chunk-ATSTJQMI.js.map
19822
+ //# sourceMappingURL=chunk-K6EG6ACM.js.map