kordoc 4.22.11 → 4.22.13

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 +6 -4
  2. package/dist/{-HVSX4WBM.js → -WQIGIQTE.js} +11 -11
  3. package/dist/{chunk-ZXNKMDBN.js → chunk-3FXLQRWO.js} +4 -4
  4. package/dist/{chunk-JBPCRB4H.js → chunk-47NQ362T.js} +2 -2
  5. package/dist/{chunk-K6EG6ACM.js → chunk-6VNSISFI.js} +104 -29
  6. package/dist/chunk-6VNSISFI.js.map +1 -0
  7. package/dist/{chunk-PFDAVLZT.js → chunk-AEDBCPFA.js} +11 -11
  8. package/dist/{chunk-A4UUVU43.cjs → chunk-AXKG24PC.cjs} +3 -3
  9. package/dist/{chunk-A4UUVU43.cjs.map → chunk-AXKG24PC.cjs.map} +1 -1
  10. package/dist/{chunk-MDMCZUDP.js → chunk-DO3TPBBJ.js} +2 -2
  11. package/dist/{chunk-KINTYLL4.js → chunk-DUTPIML6.js} +2 -2
  12. package/dist/{chunk-Z6EA67XV.js → chunk-EMEEVTP2.js} +2 -2
  13. package/dist/{chunk-QLDKBCAG.js → chunk-EQNLV4YH.js} +2 -2
  14. package/dist/{chunk-JX3QPTMU.js → chunk-FKMKZ3CV.js} +2 -2
  15. package/dist/{chunk-NK3WCKJA.js → chunk-FVHGH6DG.js} +3 -3
  16. package/dist/{chunk-LP6D54PI.js → chunk-GBJNTGVV.js} +2 -2
  17. package/dist/{chunk-DRBOO4F2.cjs → chunk-GDLEO7SO.cjs} +23 -23
  18. package/dist/{chunk-DRBOO4F2.cjs.map → chunk-GDLEO7SO.cjs.map} +1 -1
  19. package/dist/{chunk-SOHPBZHR.cjs → chunk-GZEVDQ7S.cjs} +3 -3
  20. package/dist/{chunk-SOHPBZHR.cjs.map → chunk-GZEVDQ7S.cjs.map} +1 -1
  21. package/dist/{chunk-PJHRL7UZ.cjs → chunk-JOHVSCHT.cjs} +2 -2
  22. package/dist/{chunk-PJHRL7UZ.cjs.map → chunk-JOHVSCHT.cjs.map} +1 -1
  23. package/dist/{chunk-YP5T2EZ7.js → chunk-KGO5RHY2.js} +2 -2
  24. package/dist/{chunk-RWWUQMLO.cjs → chunk-KMYZ2SBN.cjs} +24 -24
  25. package/dist/{chunk-RWWUQMLO.cjs.map → chunk-KMYZ2SBN.cjs.map} +1 -1
  26. package/dist/{chunk-ZYKZS3F6.js → chunk-LKHXRJX2.js} +2 -2
  27. package/dist/{chunk-WTJ7NVIJ.js → chunk-M3YLZLHF.js} +3 -3
  28. package/dist/{chunk-7HTGSGIV.js → chunk-MKRVPDDJ.js} +2 -2
  29. package/dist/{chunk-SWY3AIPF.js → chunk-PE3PGTLM.js} +2 -2
  30. package/dist/{chunk-NCP7M4N2.js → chunk-Q7BAXRRK.js} +3 -3
  31. package/dist/{chunk-RLMAOBWN.js → chunk-RQII7NRF.js} +2 -2
  32. package/dist/{chunk-4ZUR6QAO.js → chunk-T2BVIFDL.js} +4 -4
  33. package/dist/{chunk-GMBWB4OU.js → chunk-T4JZ7DGA.js} +2 -2
  34. package/dist/{chunk-XWTXCBXT.js → chunk-W5B45M7Z.js} +4 -4
  35. package/dist/{chunk-4YZMZMSL.js → chunk-YD4TF6JI.js} +2 -2
  36. package/dist/{chunk-PGIFLIT5.js → chunk-YLCNGVXU.js} +2 -2
  37. package/dist/{chunk-QJRRJB6Z.cjs → chunk-ZEVEVTRG.cjs} +6 -6
  38. package/dist/{chunk-QJRRJB6Z.cjs.map → chunk-ZEVEVTRG.cjs.map} +1 -1
  39. package/dist/chunks-FBC25VC6.js +10 -0
  40. package/dist/cli.js +30 -30
  41. package/dist/{formula-MO5QV2WU.cjs → formula-DZA6DTBT.cjs} +9 -9
  42. package/dist/{formula-MO5QV2WU.cjs.map → formula-DZA6DTBT.cjs.map} +1 -1
  43. package/dist/{formula-67MKCQ44.js → formula-GAW4HYPK.js} +4 -4
  44. package/dist/{formula-N3GX3SO2.js → formula-Q5O27Q3L.js} +3 -3
  45. package/dist/{image-ocr-65B7BSUH.js → image-ocr-SKLXAVIR.js} +9 -9
  46. package/dist/{image-ocr-PQ2Q55I2.js → image-ocr-WHMF24OA.js} +6 -6
  47. package/dist/{image-ocr-7GIT7REG.cjs → image-ocr-YUVG57VO.cjs} +17 -17
  48. package/dist/{image-ocr-7GIT7REG.cjs.map → image-ocr-YUVG57VO.cjs.map} +1 -1
  49. package/dist/index.cjs +484 -409
  50. package/dist/index.cjs.map +1 -1
  51. package/dist/index.js +104 -29
  52. package/dist/index.js.map +1 -1
  53. package/dist/mcp.js +22 -22
  54. package/dist/{model-bundle-AH3WIGOE.js → model-bundle-PHYAMJXE.js} +5 -5
  55. package/dist/{models-YFEVC3DI.js → models-B7DEVMPD.js} +5 -5
  56. package/dist/{parse-worker-v2-7NT2ZMYZ.js → parse-worker-v2-C7VA7D6M.js} +12 -12
  57. package/dist/{parser-REXFNEES.js → parser-4L4HI6KN.js} +9 -9
  58. package/dist/{parser-DIA2JXPE.cjs → parser-IBWL5DO6.cjs} +157 -157
  59. package/dist/{parser-DIA2JXPE.cjs.map → parser-IBWL5DO6.cjs.map} +1 -1
  60. package/dist/{parser-OZI6POE7.js → parser-SCRC6YOP.js} +12 -12
  61. package/dist/{pdf-ocr-U2XEMTFR.js → pdf-ocr-7JVAWHAF.js} +9 -9
  62. package/dist/pdf-ocr-BEXABEIP.cjs +31 -0
  63. package/dist/{pdf-ocr-3K5LAKGL.cjs.map → pdf-ocr-BEXABEIP.cjs.map} +1 -1
  64. package/dist/{pdf-ocr-EUJDEV4Z.js → pdf-ocr-Z62E4OGV.js} +6 -6
  65. package/dist/{profile-io-OIFR5XXG.js → profile-io-T4O5ZOSF.js} +3 -3
  66. package/dist/{rasterize-7QURJJZB.js → rasterize-2WOVCKGY.js} +3 -3
  67. package/dist/{redact-doc-OIHZYWVF.js → redact-doc-BS5KXZJU.js} +11 -11
  68. package/dist/{render-ZAJ4L4QM.js → render-EWFXTGYC.js} +7 -7
  69. package/dist/seal-B2FGIQ5C.js +10 -0
  70. package/dist/{setup-MWFDDT5X.js → setup-LRMO3ZKM.js} +3 -3
  71. package/dist/visual-UZQZUJIA.js +21 -0
  72. package/dist/{watch-7K2NBGMZ.js → watch-SOK25KLD.js} +12 -12
  73. package/package.json +1 -1
  74. package/dist/chunk-K6EG6ACM.js.map +0 -1
  75. package/dist/chunks-OZGUNAAZ.js +0 -10
  76. package/dist/pdf-ocr-3K5LAKGL.cjs +0 -31
  77. package/dist/seal-XVZFHFMG.js +0 -10
  78. package/dist/visual-QZVCWEG2.js +0 -21
  79. /package/dist/{-HVSX4WBM.js.map → -WQIGIQTE.js.map} +0 -0
  80. /package/dist/{chunk-ZXNKMDBN.js.map → chunk-3FXLQRWO.js.map} +0 -0
  81. /package/dist/{chunk-JBPCRB4H.js.map → chunk-47NQ362T.js.map} +0 -0
  82. /package/dist/{chunk-PFDAVLZT.js.map → chunk-AEDBCPFA.js.map} +0 -0
  83. /package/dist/{chunk-MDMCZUDP.js.map → chunk-DO3TPBBJ.js.map} +0 -0
  84. /package/dist/{chunk-KINTYLL4.js.map → chunk-DUTPIML6.js.map} +0 -0
  85. /package/dist/{chunk-Z6EA67XV.js.map → chunk-EMEEVTP2.js.map} +0 -0
  86. /package/dist/{chunk-QLDKBCAG.js.map → chunk-EQNLV4YH.js.map} +0 -0
  87. /package/dist/{chunk-JX3QPTMU.js.map → chunk-FKMKZ3CV.js.map} +0 -0
  88. /package/dist/{chunk-NK3WCKJA.js.map → chunk-FVHGH6DG.js.map} +0 -0
  89. /package/dist/{chunk-LP6D54PI.js.map → chunk-GBJNTGVV.js.map} +0 -0
  90. /package/dist/{chunk-YP5T2EZ7.js.map → chunk-KGO5RHY2.js.map} +0 -0
  91. /package/dist/{chunk-ZYKZS3F6.js.map → chunk-LKHXRJX2.js.map} +0 -0
  92. /package/dist/{chunk-WTJ7NVIJ.js.map → chunk-M3YLZLHF.js.map} +0 -0
  93. /package/dist/{chunk-7HTGSGIV.js.map → chunk-MKRVPDDJ.js.map} +0 -0
  94. /package/dist/{chunk-SWY3AIPF.js.map → chunk-PE3PGTLM.js.map} +0 -0
  95. /package/dist/{chunk-NCP7M4N2.js.map → chunk-Q7BAXRRK.js.map} +0 -0
  96. /package/dist/{chunk-RLMAOBWN.js.map → chunk-RQII7NRF.js.map} +0 -0
  97. /package/dist/{chunk-4ZUR6QAO.js.map → chunk-T2BVIFDL.js.map} +0 -0
  98. /package/dist/{chunk-GMBWB4OU.js.map → chunk-T4JZ7DGA.js.map} +0 -0
  99. /package/dist/{chunk-XWTXCBXT.js.map → chunk-W5B45M7Z.js.map} +0 -0
  100. /package/dist/{chunk-4YZMZMSL.js.map → chunk-YD4TF6JI.js.map} +0 -0
  101. /package/dist/{chunk-PGIFLIT5.js.map → chunk-YLCNGVXU.js.map} +0 -0
  102. /package/dist/{chunks-OZGUNAAZ.js.map → chunks-FBC25VC6.js.map} +0 -0
  103. /package/dist/{formula-67MKCQ44.js.map → formula-GAW4HYPK.js.map} +0 -0
  104. /package/dist/{formula-N3GX3SO2.js.map → formula-Q5O27Q3L.js.map} +0 -0
  105. /package/dist/{image-ocr-65B7BSUH.js.map → image-ocr-SKLXAVIR.js.map} +0 -0
  106. /package/dist/{image-ocr-PQ2Q55I2.js.map → image-ocr-WHMF24OA.js.map} +0 -0
  107. /package/dist/{model-bundle-AH3WIGOE.js.map → model-bundle-PHYAMJXE.js.map} +0 -0
  108. /package/dist/{models-YFEVC3DI.js.map → models-B7DEVMPD.js.map} +0 -0
  109. /package/dist/{parse-worker-v2-7NT2ZMYZ.js.map → parse-worker-v2-C7VA7D6M.js.map} +0 -0
  110. /package/dist/{parser-REXFNEES.js.map → parser-4L4HI6KN.js.map} +0 -0
  111. /package/dist/{parser-OZI6POE7.js.map → parser-SCRC6YOP.js.map} +0 -0
  112. /package/dist/{pdf-ocr-EUJDEV4Z.js.map → pdf-ocr-7JVAWHAF.js.map} +0 -0
  113. /package/dist/{pdf-ocr-U2XEMTFR.js.map → pdf-ocr-Z62E4OGV.js.map} +0 -0
  114. /package/dist/{profile-io-OIFR5XXG.js.map → profile-io-T4O5ZOSF.js.map} +0 -0
  115. /package/dist/{rasterize-7QURJJZB.js.map → rasterize-2WOVCKGY.js.map} +0 -0
  116. /package/dist/{redact-doc-OIHZYWVF.js.map → redact-doc-BS5KXZJU.js.map} +0 -0
  117. /package/dist/{render-ZAJ4L4QM.js.map → render-EWFXTGYC.js.map} +0 -0
  118. /package/dist/{seal-XVZFHFMG.js.map → seal-B2FGIQ5C.js.map} +0 -0
  119. /package/dist/{setup-MWFDDT5X.js.map → setup-LRMO3ZKM.js.map} +0 -0
  120. /package/dist/{visual-QZVCWEG2.js.map → visual-UZQZUJIA.js.map} +0 -0
  121. /package/dist/{watch-7K2NBGMZ.js.map → watch-SOK25KLD.js.map} +0 -0
package/dist/index.js CHANGED
@@ -2,7 +2,7 @@ import {
2
2
  blocksToPages,
3
3
  bmpToPng,
4
4
  inlineImagesIntoMarkdown
5
- } from "./chunk-QLDKBCAG.js";
5
+ } from "./chunk-EQNLV4YH.js";
6
6
  import {
7
7
  parsePageRange
8
8
  } from "./chunk-V4BH5SRQ.js";
@@ -43,7 +43,7 @@ import {
43
43
  validateOcrOptions,
44
44
  visibleText,
45
45
  wrapScript
46
- } from "./chunk-JBPCRB4H.js";
46
+ } from "./chunk-47NQ362T.js";
47
47
  import {
48
48
  KordocError,
49
49
  OPTIONAL_DEP_INSTALL_HINT,
@@ -61,7 +61,7 @@ import {
61
61
  toArrayBuffer,
62
62
  unescapeHtml,
63
63
  unzipLimitBytes
64
- } from "./chunk-Z6EA67XV.js";
64
+ } from "./chunk-EMEEVTP2.js";
65
65
 
66
66
  // src/plain-markdown.ts
67
67
  function toPlainMarkdown(md2) {
@@ -24604,7 +24604,7 @@ var MIN_SIDE = 24;
24604
24604
  async function ocrEmbeddedImages(blocks, options, warnings) {
24605
24605
  const ocr = options?.ocr;
24606
24606
  if (ocr !== true && ocr !== "force" && typeof ocr !== "function") return false;
24607
- const { parseImageDocument } = await import("./image-ocr-PQ2Q55I2.js");
24607
+ const { parseImageDocument } = await import("./image-ocr-WHMF24OA.js");
24608
24608
  let inserted = false, unreadable = 0;
24609
24609
  let failed = null;
24610
24610
  const walk = async (list, depth) => {
@@ -49980,11 +49980,11 @@ function longestPathBoundaries(constraints, count) {
49980
49980
  }
49981
49981
  return { x, tight: x.map((v, k) => Math.abs(v + y[k] - x[count]) <= 2) };
49982
49982
  }
49983
- function tableColumnBoundaries(constraints, count, total) {
49983
+ function tableColumnBoundaries(constraints, count, total, noExactRow = false) {
49984
49984
  const prop = solveBoundaries(constraints, count, total);
49985
49985
  if (!total || total <= 0) return prop;
49986
49986
  const lp = longestPathBoundaries(constraints, count);
49987
- return lp && Math.abs(lp.x[count] - total) <= 2 && lp.x.every((v, k) => Math.abs(v - prop[k]) <= 2 || lp.tight[k]) ? lp.x : prop;
49987
+ return lp && Math.abs(lp.x[count] - total) <= 2 && (noExactRow || lp.x.every((v, k) => Math.abs(v - prop[k]) <= 2 || lp.tight[k])) ? lp.x : prop;
49988
49988
  }
49989
49989
  function solveRowHeights(cells, rowCount, maxTotal = Number.POSITIVE_INFINITY) {
49990
49990
  const h = new Array(rowCount).fill(0);
@@ -50171,8 +50171,11 @@ function buildPara(p) {
50171
50171
  } else if (OBJ_TAGS.has(cn)) {
50172
50172
  const sz = findChildByLocalName(ch, "sz");
50173
50173
  const pos = findChildByLocalName(ch, "pos");
50174
- const w = num2(sz, "width") || num2(findChildByLocalName(ch, "curSz"), "width") || num2(findChildByLocalName(ch, "orgSz"), "width");
50175
- const h = num2(sz, "height") || num2(findChildByLocalName(ch, "curSz"), "height") || num2(findChildByLocalName(ch, "orgSz"), "height");
50174
+ const cur = findChildByLocalName(ch, "curSz");
50175
+ const rot = num2(findChildByLocalName(ch, "rotationInfo"), "angle") % 360;
50176
+ const box = findChildByLocalName(ch, "drawText") && !rot && num2(cur, "width") > 0 && num2(cur, "height") > 0 && num2(cur, "height") < 2 ** 31;
50177
+ const w = box ? num2(cur, "width") : num2(sz, "width") || num2(cur, "width") || num2(findChildByLocalName(ch, "orgSz"), "width");
50178
+ const h = box ? num2(cur, "height") : num2(sz, "height") || num2(cur, "height") || num2(findChildByLocalName(ch, "orgSz"), "height");
50176
50179
  const inline = pos?.getAttribute("treatAsChar") === "1";
50177
50180
  const om = inline ? findChildByLocalName(ch, "outMargin") : null;
50178
50181
  if (!deleted) objs.push({
@@ -50288,7 +50291,8 @@ function cellContentExtent(cell2, memo) {
50288
50291
  const pushed = baseV - (num2(om, "top") + o.height + num2(om, "bottom"));
50289
50292
  const anchor = pushed >= -100 ? pushed : baseV - (memo?.paraGeom?.get(p.getAttribute("paraPrIDRef") ?? "")?.spaceBefore ?? 0);
50290
50293
  const vo = num2(pos, "vertOffset");
50291
- ext = Math.max(ext, anchor + num2(om, "top") + Math.max(0, vo) + o.height);
50294
+ const oh = o.tag === "tbl" ? Math.max(o.height, measureTableHeight(o.el, memo)) : o.height;
50295
+ ext = Math.max(ext, anchor + num2(om, "top") + Math.max(0, vo) + oh);
50292
50296
  }
50293
50297
  }
50294
50298
  memo?.cell.set(cell2.el, ext);
@@ -50711,7 +50715,7 @@ function reflowSubListsIn(p, doc, styles, mode, counter, flow, noteW = counter.b
50711
50715
  }
50712
50716
  if (t === "drawText" || t === "caption") {
50713
50717
  const sub = findChildByLocalName(ch, "subList"), tm = findChildByLocalName(ch, "textMargin");
50714
- const textW2 = num2(ch, "lastWidth") || (t === "caption" ? num2(ch, "width") : 0);
50718
+ const textW2 = num2(ch, "lastWidth") || (t === "caption" ? num2(ch, "width") : num2(findChildByLocalName(el, "sz"), "width"));
50715
50719
  const w = textW2 - num2(tm, "left") - num2(tm, "right");
50716
50720
  if (sub && w > 0) flow(sub, doc, styles, w, mode, counter, 0);
50717
50721
  continue;
@@ -50933,6 +50937,7 @@ var isJamoV = (cp) => cp >= 4448 && cp <= 4519 || cp >= 55216 && cp <= 55238;
50933
50937
  var isJamoT = (cp) => cp >= 4520 && cp <= 4607 || cp >= 55243 && cp <= 55291;
50934
50938
  var isJamoLV = (cp) => isJamoL(cp) || isJamoV(cp);
50935
50939
  var isJamoVT = (cp) => isJamoV(cp) || isJamoT(cp);
50940
+ var joinsJamo = (prevCp, cp) => isJamoVT(cp) && isJamoLV(prevCp);
50936
50941
  var isLatinCp = (cp) => cp < 592 || cp >= 7680 && cp < 8192 || cp >= 8216 && cp < 8224;
50937
50942
  function hancomLangOf(cp) {
50938
50943
  if (isLatinCp(cp)) return "latin";
@@ -51063,7 +51068,7 @@ function reflowPara(p, doc, styles, areaW, startV, mode, zones = [], nums = /* @
51063
51068
  if (c.ch === "") continue;
51064
51069
  const st = (c.prId != null ? styles.charPr.get(c.prId) : void 0) ?? DEFAULT_CHAR;
51065
51070
  const cp = c.ch.codePointAt(0);
51066
- const joins = isJamoVT(cp) && isJamoLV(text.codePointAt(text.length - 1) ?? 0);
51071
+ const joins = joinsJamo(text.codePointAt(text.length - 1) ?? 0, cp);
51067
51072
  const { w, sp } = joins ? { w: 0, sp: 0 } : glyphWidth(c.ch, st);
51068
51073
  for (let u = 0; u < c.ch.length; u++) {
51069
51074
  realIdx.push(i);
@@ -52114,6 +52119,7 @@ function planTableRows(tbl2, cells, rowH, ty, MT, BODY_H, slack = 0, floatSpan,
52114
52119
  const st = stackedFloats(rc[0]);
52115
52120
  return st.length >= 2 && st.reduce((a, f) => a + f.h, 0) > h;
52116
52121
  });
52122
+ if (slack > 0 && ty + rowY[nRows] > pageBottom && ty + rowY[nRows] <= pageBottom + slack && cells.some((c) => cellLineBoxes(c).some((b) => b.part > 0))) slack = 0;
52117
52123
  if (BODY_H <= 0 || ty + rowY[nRows] <= pageBottom + slack && !stackOver) return plain4();
52118
52124
  if (findChildByLocalName(tbl2, "pos")?.getAttribute("treatAsChar") === "1") {
52119
52125
  const declared = num2(findChildByLocalName(tbl2, "sz"), "height") || rowY[nRows];
@@ -52164,6 +52170,14 @@ function planTableRows(tbl2, cells, rowH, ty, MT, BODY_H, slack = 0, floatSpan,
52164
52170
  const boxes = splittable ? new Map(rowCells.map((c) => [c.el, cellLineBoxes(c)])) : void 0;
52165
52171
  const hParts = boxes ? Math.max(0, ...[...boxes.values()].flatMap((bs) => bs.map((b) => b.part))) : 0;
52166
52172
  if (boxes && hParts > 0) {
52173
+ if (!first && rowCells.some((c) => {
52174
+ const b = (boxes.get(c.el) ?? []).find((x) => x.part === 0);
52175
+ return !!b && c.marginT + b.bottom - b.origin > pageBottom - y - c.marginB;
52176
+ })) {
52177
+ page++;
52178
+ y = contTop;
52179
+ first = true;
52180
+ }
52167
52181
  const declared = num2(findChildByLocalName(tbl2, "sz"), "height");
52168
52182
  const led = /* @__PURE__ */ new Set();
52169
52183
  let firstPh = 0;
@@ -52238,6 +52252,29 @@ function planTableRows(tbl2, cells, rowH, ty, MT, BODY_H, slack = 0, floatSpan,
52238
52252
  first = false;
52239
52253
  continue;
52240
52254
  }
52255
+ if (boxes && floatSpan) {
52256
+ let span2 = 0, spanEnd = 0, mB = 0;
52257
+ for (const c of rowCells) for (const b of boxes.get(c.el) ?? []) {
52258
+ const f = floatSpan(b.seg, y + c.marginT + b.top, contTop + c.marginT);
52259
+ if (f && f.pages > span2) {
52260
+ span2 = f.pages;
52261
+ spanEnd = f.endY;
52262
+ mB = c.marginB;
52263
+ }
52264
+ }
52265
+ if (span2 > 0) {
52266
+ const none = new Map(rowCells.map((c) => [c.el, [Number.POSITIVE_INFINITY, Number.POSITIVE_INFINITY]]));
52267
+ pieces.push({ page, y, h: pageBottom - y, range: new Map(rowCells.map((c) => [c.el, [0, Number.POSITIVE_INFINITY]])), fill: true });
52268
+ for (let e = 1; e < span2; e++) pieces.push({ page: page + e, y: contTop, h: pageBottom - contTop, range: none, fill: true });
52269
+ page += span2;
52270
+ const endH = Math.max(0, spanEnd - contTop) + mB;
52271
+ pieces.push({ page, y: contTop, h: endH, range: none });
52272
+ out.push(pieces);
52273
+ y = contTop + endH;
52274
+ first = false;
52275
+ continue;
52276
+ }
52277
+ }
52241
52278
  if (splittable && y + h > pageBottom) {
52242
52279
  const from = /* @__PURE__ */ new Map();
52243
52280
  const lines = new Map(rowCells.map((c) => [c.el, cellLines(c)]));
@@ -52735,16 +52772,20 @@ function warnOnce(ctx, key, msg2) {
52735
52772
  ctx.warned.add(key);
52736
52773
  ctx.warnings.push(msg2);
52737
52774
  }
52738
- function charW(c, styles) {
52775
+ function charW(c, styles, prev) {
52739
52776
  const st = (c.prId != null ? styles.charPr.get(c.prId) : void 0) ?? DEFAULT_CHAR;
52740
52777
  if (c.ch === "" && c.ctrlText) return measureTextWidth(c.ctrlText, c.ctrlSup ? Math.round(st.height * 3 / 4) : st.height, st.ratio, { spacingPct: st.spacing, faceClass: faceClassOf(st.face) });
52741
- let w = 0;
52742
- for (const ch of c.ch) w += glyphWidth(ch, st).w;
52778
+ let w = 0, last = prev?.ch ? prev.ch.codePointAt(prev.ch.length - 1) ?? 0 : 0;
52779
+ for (const ch of c.ch) {
52780
+ const cp = ch.codePointAt(0);
52781
+ if (!joinsJamo(last, cp)) w += glyphWidth(ch, st).w;
52782
+ last = cp;
52783
+ }
52743
52784
  return w;
52744
52785
  }
52745
52786
  function lineNaturalWidth(m, styles, start, end) {
52746
52787
  let text = 0;
52747
- for (let i = start; i < end && i < m.chars.length; i++) text += charW(m.chars[i], styles);
52788
+ for (let i = start; i < end && i < m.chars.length; i++) text += charW(m.chars[i], styles, m.chars[i - 1]);
52748
52789
  let obj = 0;
52749
52790
  for (const o of m.objs) if (o.inline && o.index >= start && o.index < end) obj += o.omL + o.width + o.omR;
52750
52791
  return { text, obj };
@@ -52778,7 +52819,7 @@ function planLines(m, styles, numText = "") {
52778
52819
  continue;
52779
52820
  }
52780
52821
  if (!c.tab) {
52781
- x += charW(c, styles);
52822
+ x += charW(c, styles, m.chars[k - 1]);
52782
52823
  continue;
52783
52824
  }
52784
52825
  const adv = tabAdvance(x, i === 0, geom, c.tabW);
@@ -52824,7 +52865,7 @@ function planLines(m, styles, numText = "") {
52824
52865
  function advanceTo(m, styles, plan, upto) {
52825
52866
  let x = 0;
52826
52867
  for (let i = plan.start; i < upto && i < m.chars.length; i++) {
52827
- x += m.chars[i].tab ? plan.tabs.get(i) ?? 0 : charW(m.chars[i], styles) * (i < plan.fixedTo ? 1 : plan.scale) + (i >= plan.spFrom && i < plan.textEnd && m.chars[i].ch === " " ? plan.spaceAdd : 0);
52868
+ x += m.chars[i].tab ? plan.tabs.get(i) ?? 0 : charW(m.chars[i], styles, m.chars[i - 1]) * (i < plan.fixedTo ? 1 : plan.scale) + (i >= plan.spFrom && i < plan.textEnd && m.chars[i].ch === " " ? plan.spaceAdd : 0);
52828
52869
  }
52829
52870
  for (const o of m.objs) if (o.inline && o.index >= plan.start && o.index < upto) x += o.omL + o.width + o.omR;
52830
52871
  return x;
@@ -52924,8 +52965,12 @@ function drawPara(p, ox, oy, areaW, ctx, depth, segPages) {
52924
52965
  const fh = st.script ? Math.round(st.height * 16 / 25) : st.height;
52925
52966
  const raise = st.script === "sup" ? Math.round(st.height * 0.44) : 0;
52926
52967
  const measure = (text) => {
52927
- let w = 0;
52928
- for (const ch of text) w += glyphWidth(ch, st).w;
52968
+ let w = 0, last = 0;
52969
+ for (const ch of text) {
52970
+ const cp = ch.codePointAt(0);
52971
+ if (!joinsJamo(last, cp)) w += glyphWidth(ch, st).w;
52972
+ last = cp;
52973
+ }
52929
52974
  return w;
52930
52975
  };
52931
52976
  const skipLead = Math.max(0, plan.spFrom - i);
@@ -53035,7 +53080,7 @@ function drawPara(p, ox, oy, areaW, ctx, depth, segPages) {
53035
53080
  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;
53036
53081
  let stay = tbFloats < 2 && !m.objs.some((q) => q.inline) && !m.chars.some((c) => c.ch !== "" && !c.nb && c.ch.trim() !== "");
53037
53082
  const sbA = m.paraPrId != null ? ctx.styles.paraGeom.get(m.paraPrId)?.spaceBefore ?? 0 : 0;
53038
- if (stay && wrapA === "TOP_AND_BOTTOM" && linePushedBy(o, anchorLineV ?? baseV, pTop)) stay = false;
53083
+ if (stay && wrapA === "TOP_AND_BOTTOM" && linePushedBy(o, anchorLineV ?? baseV, pTop ?? (depth > 0 ? cellParaTop(p, ctx.styles.paraGeom) : void 0))) stay = false;
53039
53084
  const firstLine = anchorLineV === void 0 || anchorLineV === baseV;
53040
53085
  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);
53041
53086
  if (depth === 0 && tbFloats >= 2 && wrapA === "TOP_AND_BOTTOM") {
@@ -53229,7 +53274,9 @@ function cellFloatSpan(MT, BODY_H, memo, slack) {
53229
53274
  if ((pos?.getAttribute("vertRelTo") ?? "PARA") !== "PARA") continue;
53230
53275
  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)));
53231
53276
  if (segK !== k) continue;
53232
- const ty = top + num2(findChildByLocalName(o.el, "outMargin"), "top") + Math.max(0, toInt32(pos?.getAttribute("vertOffset") ?? void 0, 0));
53277
+ const segV = num2(seg, "vertpos"), pTop = cellParaTop(p, memo.paraGeom ?? /* @__PURE__ */ new Map());
53278
+ const start = linePushedBy(o, segV, pTop) ? top - (segV - (pTop ?? segV)) : top;
53279
+ const ty = start + num2(findChildByLocalName(o.el, "outMargin"), "top") + Math.max(0, toInt32(pos?.getAttribute("vertOffset") ?? void 0, 0));
53233
53280
  const span2 = tableContPages(o.el, ty, MT, BODY_H, memo, slack, cellFloatSpan(MT, BODY_H, memo, slack), true, contMT);
53234
53281
  if (span2.pages > 0 && (!best || span2.pages > best.pages)) best = { ...span2, el: o.el };
53235
53282
  }
@@ -53248,7 +53295,16 @@ function drawTable(tbl2, tx, ty, ctx, depth) {
53248
53295
  const nCols = Math.max(...cells.map((c) => c.ca + c.cs));
53249
53296
  const nRows = Math.max(...cells.map((c) => c.ra + c.rs));
53250
53297
  const colCons = cells.map((c) => ({ a: c.ca, b: c.ca + c.cs, size: c.w }));
53251
- const colX = tableColumnBoundaries(colCons, nCols, num2(tblSz, "width") || void 0);
53298
+ const tblW = num2(tblSz, "width");
53299
+ const rowSum = /* @__PURE__ */ new Map();
53300
+ for (const c of cells) {
53301
+ const r = rowSum.get(c.ra) ?? { cover: 0, w: 0 };
53302
+ r.cover += c.cs;
53303
+ r.w += c.w;
53304
+ rowSum.set(c.ra, r);
53305
+ }
53306
+ const noExactRow = ![...rowSum.values()].some((r) => r.cover === nCols && Math.abs(r.w - tblW) <= 2);
53307
+ const colX = tableColumnBoundaries(colCons, nCols, tblW || void 0, noExactRow);
53252
53308
  const rowH = measureTableRowHeights(tbl2, ctx.extentMemo);
53253
53309
  const rowY = [0];
53254
53310
  for (let r = 0; r < nRows; r++) rowY.push(rowY[r] + rowH[r]);
@@ -53300,7 +53356,7 @@ function drawTable(tbl2, tx, ty, ctx, depth) {
53300
53356
  const va2 = c.sub.getAttribute("vertAlign") ?? "TOP";
53301
53357
  const lastK = g3.pieces.length - 1;
53302
53358
  const pieceOff = g3.pieces.map((pc, k) => {
53303
- if (va2 === "TOP" || k > 0 && k < lastK) return 0;
53359
+ if (va2 === "TOP" || k > 0 && k < lastK || pc.fill) return 0;
53304
53360
  const from = pc.range?.get(c.el)?.[0] ?? 0;
53305
53361
  const bottoms = boxes.filter((b) => pieceOf(b.top) === k).map((b) => b.bottom - from);
53306
53362
  if (k > 0) for (const f of subFloatBottoms(c.sub)) {
@@ -53494,6 +53550,20 @@ function staleTopCache(root, BODY_H) {
53494
53550
  }
53495
53551
  return false;
53496
53552
  }
53553
+ function absoluteTopCache(root, ML, BODY_W) {
53554
+ let tot = 0, over = 0;
53555
+ for (const p of elements(root)) {
53556
+ if (ln(p) !== "p") continue;
53557
+ const lsa = findChildByLocalName(p, "linesegarray");
53558
+ for (const sg of lsa ? elements(lsa) : []) {
53559
+ if (ln(sg) !== "lineseg" || num2(sg, "horzsize") <= 0) continue;
53560
+ tot++;
53561
+ const hp = num2(sg, "horzpos");
53562
+ if (hp >= ML - 500 && hp + num2(sg, "horzsize") > BODY_W + 500) over++;
53563
+ }
53564
+ }
53565
+ return over >= 3 && over * 5 >= tot;
53566
+ }
53497
53567
  function renderSectionToPages(root, geom, ctxBase, doReflow, reflowMode, masters = [], hasDeletionMarkers = true, lastSection = true) {
53498
53568
  const { PW, PH, ML, MT, BODY_W, BODY_H } = geom;
53499
53569
  if (hasDeletionMarkers) prepareDeletedRanges(root);
@@ -53505,8 +53575,13 @@ function renderSectionToPages(root, geom, ctxBase, doReflow, reflowMode, masters
53505
53575
  }
53506
53576
  ctxBase.warnings.push("\uC870\uD310 \uCE90\uC2DC\uAC00 \uB9DE\uC9C0 \uC54A\uC544(\uCD5C\uC0C1\uC704 \uBB38\uB2E8\uC774 \uBAA8\uB450 \uAC19\uC740 \uC790\uB9AC) \uB2E4\uC2DC \uC870\uD310\uD574 \uB80C\uB354");
53507
53577
  }
53508
- const mixed = !doReflow && !degenerate && Array.from(root.getElementsByTagName("*")).some((p) => ln(p) === "p" && !findChildByLocalName(p, "linesegarray"));
53509
- if (doReflow || degenerate || mixed) reflowSection(root, ctxBase.styles, { BODY_W, BODY_H }, reflowMode);
53578
+ const absolute = !degenerate && absoluteTopCache(root, ML, BODY_W);
53579
+ if (absolute) {
53580
+ for (const lsa of Array.from(root.getElementsByTagName("*")).filter((e) => ln(e) === "linesegarray")) lsa.parentNode?.removeChild(lsa);
53581
+ ctxBase.warnings.push("\uC870\uD310 \uCE90\uC2DC\uAC00 \uCABD \uAE30\uC900 \uC88C\uD45C\uB85C \uC801\uD600 \uC788\uC5B4 \uB2E4\uC2DC \uC870\uD310\uD574 \uB80C\uB354");
53582
+ }
53583
+ const mixed = !doReflow && !degenerate && !absolute && Array.from(root.getElementsByTagName("*")).some((p) => ln(p) === "p" && !findChildByLocalName(p, "linesegarray"));
53584
+ if (doReflow || degenerate || absolute || mixed) reflowSection(root, ctxBase.styles, { BODY_W, BODY_H }, reflowMode);
53510
53585
  const colPr = findFirst(root, "colPr");
53511
53586
  const multiCol = num2(colPr, "colCount", 1) > 1;
53512
53587
  const nCol = multiCol ? num2(colPr, "colCount", 1) : 1, colGap = multiCol ? num2(colPr, "sameGap", 0) : 0;
@@ -53561,7 +53636,7 @@ function renderSectionToPages(root, geom, ctxBase, doReflow, reflowMode, masters
53561
53636
  pendingEnd = 0;
53562
53637
  } else {
53563
53638
  const brk = v < prevV ? !multiCol || h <= prevH : v === prevV && h <= prevH && prevEnd > v && v < BODY_H / 2;
53564
- const pbrk = !brk && paraFirst && prevV !== Number.NEGATIVE_INFINITY && p.getAttribute("pageBreak") === "1" && v < BODY_H / 2;
53639
+ const pbrk = !brk && paraFirst && prevV !== Number.NEGATIVE_INFINITY && p.getAttribute("pageBreak") === "1" && (v < BODY_H / 2 || buildPara(p).objs.some((o) => !o.inline && (o.el.getAttribute("textWrap") ?? "TOP_AND_BOTTOM") === "TOP_AND_BOTTOM" && (findChildByLocalName(o.el, "pos")?.getAttribute("vertRelTo") ?? "PARA") === "PARA" && linePushedBy(o, v, 0)));
53565
53640
  const obrk = !brk && !pbrk && !multiCol && paraFirst && v > prevV && v < prevEnd - 100 && prevEnd + num2(s, "vertsize") > BODY_H && v < BODY_H / 2;
53566
53641
  if (brk || pbrk || obrk) cur++;
53567
53642
  if (brk && prevSeg && prevV + prevSeg.vs > BODY_H && v === prevSeg.vs + prevSeg.sp && prevSeg.pages[prevSeg.idx] === cur - 1) {
@@ -53820,7 +53895,7 @@ function drawPageNumbers(root, paraPages, ctx) {
53820
53895
  const text = side ? `${side} ${formatHeadNumber2(n, decl.el.getAttribute("formatType") ?? "DIGIT")} ${side}` : formatHeadNumber2(n, decl.el.getAttribute("formatType") ?? "DIGIT");
53821
53896
  const w = measureTextWidth(text, h, 100, { faceClass: faceClassOf(st.face) });
53822
53897
  const x = /LEFT/.test(pos) ? ML : /RIGHT/.test(pos) ? ML + BODY_W - w : (PW - w) / 2;
53823
- const y = /^TOP/.test(pos) ? num2(margin, "top", 5668) - 225 : PH - num2(margin, "bottom", 4252) - 225;
53898
+ const y = /^TOP/.test(pos) ? num2(margin, "top", 5668) - 225 : num2(margin, "footer", 0) > 0 ? PH - num2(margin, "bottom", 4252) - 225 : PH - Math.round(num2(margin, "bottom", 4252) / 2) - 243;
53824
53899
  const attrs = [`x="${pt2(x)}"`, `y="${pt2(y)}"`, `font-size="${pt2(h)}"`];
53825
53900
  if (st.fontFamily) attrs.push(`font-family="${escapeXml7(st.fontFamily)}"`);
53826
53901
  ctx.page = page;
@@ -54988,7 +55063,7 @@ function scriptsOff(r, off) {
54988
55063
  }
54989
55064
  async function parseImage(buffer, options) {
54990
55065
  try {
54991
- const { parseImageDocument } = await import("./image-ocr-PQ2Q55I2.js");
55066
+ const { parseImageDocument } = await import("./image-ocr-WHMF24OA.js");
54992
55067
  const { blocks, warnings, lines } = await parseImageDocument(buffer, options);
54993
55068
  stripScriptTags({ blocks });
54994
55069
  return {
@@ -55052,7 +55127,7 @@ async function parseHwp(buffer, options) {
55052
55127
  async function parsePdf(buffer, options) {
55053
55128
  let parsePdfDocument;
55054
55129
  try {
55055
- const mod = await import("./parser-REXFNEES.js");
55130
+ const mod = await import("./parser-4L4HI6KN.js");
55056
55131
  parsePdfDocument = mod.parsePdfDocument;
55057
55132
  } catch {
55058
55133
  return {