kordoc 4.24.2 → 4.24.3

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 (124) hide show
  1. package/README.md +12 -10
  2. package/dist/{-SRNEV7LS.js → -Q56U3KCA.js} +11 -11
  3. package/dist/{chunk-E7B5CXYI.js → chunk-33NZN73M.js} +2 -2
  4. package/dist/{chunk-NJ5RUDCW.js → chunk-3EWXRIPH.js} +3 -3
  5. package/dist/{chunk-NMFFIUI6.js → chunk-42FSKT7R.js} +2 -2
  6. package/dist/{chunk-M46PB75E.js → chunk-4X73CGIL.js} +2 -2
  7. package/dist/{chunk-PNSALBXH.cjs → chunk-6ZRZLV3J.cjs} +2 -2
  8. package/dist/{chunk-PNSALBXH.cjs.map → chunk-6ZRZLV3J.cjs.map} +1 -1
  9. package/dist/{chunk-W24TJJNN.js → chunk-AEEQN6L3.js} +2 -2
  10. package/dist/{chunk-TW3V6FSH.js → chunk-EEXIFCXC.js} +2 -2
  11. package/dist/{chunk-LMEF7FN5.js → chunk-EWCJCWTT.js} +2 -2
  12. package/dist/{chunk-MHNJOJQV.js → chunk-FZT34MUI.js} +4 -4
  13. package/dist/{chunk-WDSTW3BD.js → chunk-HNX2I7D6.js} +2 -2
  14. package/dist/{chunk-PNX5FYHC.cjs → chunk-HTG3VVET.cjs} +24 -24
  15. package/dist/{chunk-PNX5FYHC.cjs.map → chunk-HTG3VVET.cjs.map} +1 -1
  16. package/dist/{chunk-KUC5I5MB.js → chunk-HU7POUBS.js} +2 -2
  17. package/dist/{chunk-WJAFE3Z6.js → chunk-I2QETSZN.js} +2 -2
  18. package/dist/{chunk-DHMBPMKC.js → chunk-J45OVEUM.js} +139 -15
  19. package/dist/chunk-J45OVEUM.js.map +1 -0
  20. package/dist/{chunk-UNICY546.cjs → chunk-JILIA5EV.cjs} +23 -23
  21. package/dist/{chunk-UNICY546.cjs.map → chunk-JILIA5EV.cjs.map} +1 -1
  22. package/dist/{chunk-TDMBTG7U.js → chunk-KXHNIHLC.js} +2 -2
  23. package/dist/{chunk-JFUUFJZW.cjs → chunk-N65EY5BI.cjs} +6 -6
  24. package/dist/{chunk-JFUUFJZW.cjs.map → chunk-N65EY5BI.cjs.map} +1 -1
  25. package/dist/{chunk-4XC4O7FJ.js → chunk-NKDPCALC.js} +4 -4
  26. package/dist/{chunk-C6ZVB547.js → chunk-OAOM7IEI.js} +11 -11
  27. package/dist/{chunk-4745MFQU.js → chunk-PHZDAHZC.js} +3 -3
  28. package/dist/{chunk-RIRPLFPN.js → chunk-PMX5CPK5.js} +2 -2
  29. package/dist/{chunk-E6VBLBOO.js → chunk-Q2QKRE4P.js} +2 -2
  30. package/dist/{chunk-7NTMM6PO.js → chunk-TZ753B6A.js} +2 -2
  31. package/dist/{chunk-HLTPMSYW.cjs → chunk-VFEI2GIE.cjs} +3 -3
  32. package/dist/{chunk-HLTPMSYW.cjs.map → chunk-VFEI2GIE.cjs.map} +1 -1
  33. package/dist/{chunk-3HN65YAL.js → chunk-W6O7KBOD.js} +2 -2
  34. package/dist/{chunk-VPSF5LEM.js → chunk-XAZ5RGVG.js} +3 -3
  35. package/dist/{chunk-R2GIGE5H.js → chunk-XNNMMYFO.js} +2 -2
  36. package/dist/{chunk-JMOAMKAR.js → chunk-XZOAE2Q7.js} +4 -4
  37. package/dist/{chunk-IGG63DFK.cjs → chunk-YG4YOPK6.cjs} +3 -3
  38. package/dist/{chunk-IGG63DFK.cjs.map → chunk-YG4YOPK6.cjs.map} +1 -1
  39. package/dist/chunks-REYSCBPB.js +10 -0
  40. package/dist/cli.js +30 -30
  41. package/dist/{formula-HK2MNZ3Q.cjs → formula-2BPHF6O7.cjs} +9 -9
  42. package/dist/{formula-HK2MNZ3Q.cjs.map → formula-2BPHF6O7.cjs.map} +1 -1
  43. package/dist/{formula-DSB574H7.js → formula-EA5GDCUD.js} +4 -4
  44. package/dist/{formula-U2LZ67KI.js → formula-IREEAC4T.js} +3 -3
  45. package/dist/{image-ocr-QNIMVE5A.cjs → image-ocr-CCTE7HX3.cjs} +17 -17
  46. package/dist/{image-ocr-QNIMVE5A.cjs.map → image-ocr-CCTE7HX3.cjs.map} +1 -1
  47. package/dist/{image-ocr-J54Q3YWP.js → image-ocr-JQJC5HWK.js} +6 -6
  48. package/dist/{image-ocr-3QB2HLSI.js → image-ocr-LGOFUS3O.js} +9 -9
  49. package/dist/index.cjs +517 -393
  50. package/dist/index.cjs.map +1 -1
  51. package/dist/index.js +139 -15
  52. package/dist/index.js.map +1 -1
  53. package/dist/mcp.js +23 -23
  54. package/dist/{model-bundle-CGWU4ALC.js → model-bundle-YW62Y6UD.js} +5 -5
  55. package/dist/{models-A3TF3BDV.js → models-AAL3IS2R.js} +5 -5
  56. package/dist/{parse-worker-v2-MNUD4WAR.js → parse-worker-v2-3JAHV7NY.js} +12 -12
  57. package/dist/{parser-C3ARF26I.js → parser-4FCKKJ2N.js} +18 -14
  58. package/dist/parser-4FCKKJ2N.js.map +1 -0
  59. package/dist/{parser-RPAHN3OR.cjs → parser-HE45CCSG.cjs} +163 -159
  60. package/dist/parser-HE45CCSG.cjs.map +1 -0
  61. package/dist/{parser-OBGWEWSU.js → parser-ZBP5GOQK.js} +15 -11
  62. package/dist/parser-ZBP5GOQK.js.map +1 -0
  63. package/dist/pdf-ocr-7MDCLWAA.cjs +31 -0
  64. package/dist/{pdf-ocr-GA5QJFNK.cjs.map → pdf-ocr-7MDCLWAA.cjs.map} +1 -1
  65. package/dist/{pdf-ocr-K53REDNY.js → pdf-ocr-HFAEOA7W.js} +6 -6
  66. package/dist/{pdf-ocr-ENLVEEYL.js → pdf-ocr-Q4TPGDDI.js} +9 -9
  67. package/dist/{profile-io-ZGFEO7CB.js → profile-io-EDQTKLLL.js} +3 -3
  68. package/dist/{rasterize-QMC2SAUT.js → rasterize-VD2XGHUJ.js} +3 -3
  69. package/dist/{redact-doc-JH6RZZBE.js → redact-doc-TBIBQJCT.js} +11 -11
  70. package/dist/{render-ZGKQLKPJ.js → render-J5KAZAQH.js} +7 -7
  71. package/dist/seal-H2JNAZU7.js +10 -0
  72. package/dist/{setup-LAQGCYQ2.js → setup-5LYHCQRU.js} +3 -3
  73. package/dist/visual-7EO6GR3M.js +21 -0
  74. package/dist/{watch-7YPB4TKC.js → watch-YP4IWM75.js} +12 -12
  75. package/package.json +1 -1
  76. package/dist/chunk-DHMBPMKC.js.map +0 -1
  77. package/dist/chunks-AL4P5TO5.js +0 -10
  78. package/dist/parser-C3ARF26I.js.map +0 -1
  79. package/dist/parser-OBGWEWSU.js.map +0 -1
  80. package/dist/parser-RPAHN3OR.cjs.map +0 -1
  81. package/dist/pdf-ocr-GA5QJFNK.cjs +0 -31
  82. package/dist/seal-KMGYTJAV.js +0 -10
  83. package/dist/visual-4OYJFGXL.js +0 -21
  84. /package/dist/{-SRNEV7LS.js.map → -Q56U3KCA.js.map} +0 -0
  85. /package/dist/{chunk-E7B5CXYI.js.map → chunk-33NZN73M.js.map} +0 -0
  86. /package/dist/{chunk-NJ5RUDCW.js.map → chunk-3EWXRIPH.js.map} +0 -0
  87. /package/dist/{chunk-NMFFIUI6.js.map → chunk-42FSKT7R.js.map} +0 -0
  88. /package/dist/{chunk-M46PB75E.js.map → chunk-4X73CGIL.js.map} +0 -0
  89. /package/dist/{chunk-W24TJJNN.js.map → chunk-AEEQN6L3.js.map} +0 -0
  90. /package/dist/{chunk-TW3V6FSH.js.map → chunk-EEXIFCXC.js.map} +0 -0
  91. /package/dist/{chunk-LMEF7FN5.js.map → chunk-EWCJCWTT.js.map} +0 -0
  92. /package/dist/{chunk-MHNJOJQV.js.map → chunk-FZT34MUI.js.map} +0 -0
  93. /package/dist/{chunk-WDSTW3BD.js.map → chunk-HNX2I7D6.js.map} +0 -0
  94. /package/dist/{chunk-KUC5I5MB.js.map → chunk-HU7POUBS.js.map} +0 -0
  95. /package/dist/{chunk-WJAFE3Z6.js.map → chunk-I2QETSZN.js.map} +0 -0
  96. /package/dist/{chunk-TDMBTG7U.js.map → chunk-KXHNIHLC.js.map} +0 -0
  97. /package/dist/{chunk-4XC4O7FJ.js.map → chunk-NKDPCALC.js.map} +0 -0
  98. /package/dist/{chunk-C6ZVB547.js.map → chunk-OAOM7IEI.js.map} +0 -0
  99. /package/dist/{chunk-4745MFQU.js.map → chunk-PHZDAHZC.js.map} +0 -0
  100. /package/dist/{chunk-RIRPLFPN.js.map → chunk-PMX5CPK5.js.map} +0 -0
  101. /package/dist/{chunk-E6VBLBOO.js.map → chunk-Q2QKRE4P.js.map} +0 -0
  102. /package/dist/{chunk-7NTMM6PO.js.map → chunk-TZ753B6A.js.map} +0 -0
  103. /package/dist/{chunk-3HN65YAL.js.map → chunk-W6O7KBOD.js.map} +0 -0
  104. /package/dist/{chunk-VPSF5LEM.js.map → chunk-XAZ5RGVG.js.map} +0 -0
  105. /package/dist/{chunk-R2GIGE5H.js.map → chunk-XNNMMYFO.js.map} +0 -0
  106. /package/dist/{chunk-JMOAMKAR.js.map → chunk-XZOAE2Q7.js.map} +0 -0
  107. /package/dist/{chunks-AL4P5TO5.js.map → chunks-REYSCBPB.js.map} +0 -0
  108. /package/dist/{formula-DSB574H7.js.map → formula-EA5GDCUD.js.map} +0 -0
  109. /package/dist/{formula-U2LZ67KI.js.map → formula-IREEAC4T.js.map} +0 -0
  110. /package/dist/{image-ocr-J54Q3YWP.js.map → image-ocr-JQJC5HWK.js.map} +0 -0
  111. /package/dist/{image-ocr-3QB2HLSI.js.map → image-ocr-LGOFUS3O.js.map} +0 -0
  112. /package/dist/{model-bundle-CGWU4ALC.js.map → model-bundle-YW62Y6UD.js.map} +0 -0
  113. /package/dist/{models-A3TF3BDV.js.map → models-AAL3IS2R.js.map} +0 -0
  114. /package/dist/{parse-worker-v2-MNUD4WAR.js.map → parse-worker-v2-3JAHV7NY.js.map} +0 -0
  115. /package/dist/{pdf-ocr-ENLVEEYL.js.map → pdf-ocr-HFAEOA7W.js.map} +0 -0
  116. /package/dist/{pdf-ocr-K53REDNY.js.map → pdf-ocr-Q4TPGDDI.js.map} +0 -0
  117. /package/dist/{profile-io-ZGFEO7CB.js.map → profile-io-EDQTKLLL.js.map} +0 -0
  118. /package/dist/{rasterize-QMC2SAUT.js.map → rasterize-VD2XGHUJ.js.map} +0 -0
  119. /package/dist/{redact-doc-JH6RZZBE.js.map → redact-doc-TBIBQJCT.js.map} +0 -0
  120. /package/dist/{render-ZGKQLKPJ.js.map → render-J5KAZAQH.js.map} +0 -0
  121. /package/dist/{seal-KMGYTJAV.js.map → seal-H2JNAZU7.js.map} +0 -0
  122. /package/dist/{setup-LAQGCYQ2.js.map → setup-5LYHCQRU.js.map} +0 -0
  123. /package/dist/{visual-4OYJFGXL.js.map → visual-7EO6GR3M.js.map} +0 -0
  124. /package/dist/{watch-7YPB4TKC.js.map → watch-YP4IWM75.js.map} +0 -0
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  visibleText
4
- } from "./chunk-WDSTW3BD.js";
4
+ } from "./chunk-HNX2I7D6.js";
5
5
 
6
6
  // src/script-tags.ts
7
7
  var LITERAL_TAG = /<(?=\/?(?:u|sup|sub)>)/g;
@@ -328,4 +328,4 @@ export {
328
328
  HEADING_RATIO_H2,
329
329
  HEADING_RATIO_H3
330
330
  };
331
- //# sourceMappingURL=chunk-KUC5I5MB.js.map
331
+ //# sourceMappingURL=chunk-HU7POUBS.js.map
@@ -1,5 +1,5 @@
1
1
  // src/utils.ts
2
- var VERSION = true ? "4.24.2" : "0.0.0-dev";
2
+ var VERSION = true ? "4.24.3" : "0.0.0-dev";
3
3
  function toArrayBuffer(buf) {
4
4
  if (buf.byteOffset === 0 && buf.byteLength === buf.buffer.byteLength) {
5
5
  return buf.buffer;
@@ -161,4 +161,4 @@ export {
161
161
  classifyError,
162
162
  partExtension
163
163
  };
164
- //# sourceMappingURL=chunk-WJAFE3Z6.js.map
164
+ //# sourceMappingURL=chunk-I2QETSZN.js.map
@@ -2,7 +2,7 @@
2
2
  import {
3
3
  loadSharp,
4
4
  rasterizePageSvg
5
- } from "./chunk-E6VBLBOO.js";
5
+ } from "./chunk-Q2QKRE4P.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-KUC5I5MB.js";
19
+ } from "./chunk-HU7POUBS.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-WDSTW3BD.js";
35
+ } from "./chunk-HNX2I7D6.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-RIRPLFPN.js";
49
+ } from "./chunk-PMX5CPK5.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-LMEF7FN5.js";
57
+ } from "./chunk-EWCJCWTT.js";
58
58
 
59
59
  // src/render/svg-render.ts
60
60
  import JSZip from "jszip";
@@ -163,6 +163,12 @@ function solveRowHeights(cells, rowCount, maxTotal = Number.POSITIVE_INFINITY, s
163
163
  for (const r of missing) h[r] = each;
164
164
  return true;
165
165
  };
166
+ for (let r = 0; r < rowCount; r++) {
167
+ if (h[r] !== 0) continue;
168
+ let need = 0;
169
+ for (const { c, rows } of spans) if (rows[rows.length - 1] === r && rows.slice(0, -1).every((q) => h[q] > 0)) need = Math.max(need, c.height - rows.slice(0, -1).reduce((t, q) => t + h[q], 0));
170
+ if (need > 0) h[r] = need;
171
+ }
166
172
  for (let again = true; again; ) {
167
173
  again = false;
168
174
  for (let k = 0; k < spans.length; k++) if (!done.has(k) && solve(k, true)) again = true;
@@ -11644,6 +11650,7 @@ function splitTableRows(tbl, top, lim, bodyH, styles, notes) {
11644
11650
  const fl = () => notes && nN > 0 ? Math.min(floor, bodyH - notes.area((moved ? 0 : notes.n0) + nN, (moved ? 0 : notes.s0) + nS)) : floor;
11645
11651
  const sp = num(tbl, "cellSpacing");
11646
11652
  const cells = mode === "CELL" ? collectCells(tbl) : [];
11653
+ const tableCells = mode === "TABLE" ? collectCells(tbl) : [];
11647
11654
  const record = mode === "CELL" ? /* @__PURE__ */ new Map() : void 0;
11648
11655
  const carries = /* @__PURE__ */ new Map();
11649
11656
  for (let r = 0; r < rows.length; r++) {
@@ -11672,7 +11679,20 @@ function splitTableRows(tbl, top, lim, bodyH, styles, notes) {
11672
11679
  y += h;
11673
11680
  continue;
11674
11681
  }
11675
- if (y + h + outB > fl() && !(moved && y === outT + headH)) {
11682
+ let need = h;
11683
+ if (!tableCells.some((c) => c.ra < r && c.ra + c.rs > r)) {
11684
+ let end = r + 1;
11685
+ for (let grown = true; grown; ) {
11686
+ grown = false;
11687
+ for (const c of tableCells) if (c.ra >= r && c.ra < end && c.ra + c.rs > end) {
11688
+ end = c.ra + c.rs;
11689
+ grown = true;
11690
+ }
11691
+ }
11692
+ const groupH = rows.slice(r, end).reduce((a, b) => a + b, 0);
11693
+ if (end > r + 1 && groupH <= bodyH - outT - outB - headH) need = groupH;
11694
+ }
11695
+ if (y + need + outB > fl() && !(moved && y === outT + headH)) {
11676
11696
  if (!moved && r === 0) splitWhole = true;
11677
11697
  y = outT + headH;
11678
11698
  floor = bodyH;
@@ -13280,6 +13300,26 @@ function cellLineBoxes(c) {
13280
13300
  function cellLines(c) {
13281
13301
  return cellLineBoxes(c).map((b) => [b.top, b.bottom]);
13282
13302
  }
13303
+ function spanPartRows(cells, rowY) {
13304
+ const out = /* @__PURE__ */ new Set();
13305
+ for (const c of cells) {
13306
+ if (c.rs < 2) continue;
13307
+ const bs = cellLineBoxes(c);
13308
+ const parts = bs.length ? bs[bs.length - 1].part : 0;
13309
+ let s = c.ra;
13310
+ for (let k = 0; k < parts; k++) {
13311
+ const inK = bs.filter((b) => b.part === k);
13312
+ if (!inK.length) break;
13313
+ const ext = Math.max(...inK.map((b) => b.bottom)) - inK[0].origin + c.marginT + c.marginB;
13314
+ let r = s + 1;
13315
+ while (r < c.ra + c.rs && rowY[r] - rowY[s] < ext - 100) r++;
13316
+ if (r >= c.ra + c.rs) break;
13317
+ out.add(r);
13318
+ s = r;
13319
+ }
13320
+ }
13321
+ return out;
13322
+ }
13283
13323
  function planTableRows(tbl, cells, rowH, ty, MT, BODY_H, slack = 0, floatSpan, nested = false, contMT = MT) {
13284
13324
  if (nested) slack = 0;
13285
13325
  const nRows = rowH.length;
@@ -13312,9 +13352,15 @@ function planTableRows(tbl, cells, rowH, ty, MT, BODY_H, slack = 0, floatSpan, n
13312
13352
  const out = [];
13313
13353
  const flows = (findChildByLocalName(tbl, "pos")?.getAttribute("vertRelTo") ?? "PARA") === "PARA";
13314
13354
  let page = 0, y = ty, first = !flows || ty - MT < 2e3;
13355
+ const spanStarts = cellSplit ? spanPartRows(cells, rowY) : /* @__PURE__ */ new Set();
13315
13356
  for (let r = 0; r < nRows; r++) {
13316
13357
  let h = rowH[r];
13317
13358
  const pieces = [];
13359
+ if (!first && r >= hdrRows && spanStarts.has(r)) {
13360
+ page++;
13361
+ y = contTop;
13362
+ first = true;
13363
+ }
13318
13364
  const rowCells = cells.filter((c) => c.ra === r && c.rs === 1);
13319
13365
  const splittable = cellSplit && r >= hdrRows && rowCells.length > 0;
13320
13366
  const stack = splittable && rowCells.length === 1 ? stackedFloats(rowCells[0]) : [];
@@ -13529,6 +13575,21 @@ function planTableRows(tbl, cells, rowH, ty, MT, BODY_H, slack = 0, floatSpan, n
13529
13575
  page++;
13530
13576
  y = contTop;
13531
13577
  first = true;
13578
+ } else if (!first && tbl.getAttribute("pageBreak") === "TABLE" && r >= hdrRows && !cells.some((c) => c.ra < r && c.ra + c.rs > r)) {
13579
+ let end = r + 1;
13580
+ for (let grown = true; grown; ) {
13581
+ grown = false;
13582
+ for (const c of cells) if (c.ra >= r && c.ra < end && c.ra + c.rs > end) {
13583
+ end = c.ra + c.rs;
13584
+ grown = true;
13585
+ }
13586
+ }
13587
+ const groupH = rowY[Math.min(end, nRows)] - rowY[r];
13588
+ if (end > r + 1 && y + groupH + outB > pageBottom && groupH <= pageBottom - contTop) {
13589
+ page++;
13590
+ y = contTop;
13591
+ first = true;
13592
+ }
13532
13593
  }
13533
13594
  out.push([{ page, y, h }]);
13534
13595
  y += h;
@@ -13571,12 +13632,27 @@ function renderingMatrix(el) {
13571
13632
  const info = findChildByLocalName(el, "renderingInfo");
13572
13633
  if (!info) return null;
13573
13634
  let m = null;
13635
+ let pendingS = null;
13636
+ const apply = (n) => {
13637
+ m = m ? mulAffine(m, n) : n;
13638
+ };
13574
13639
  for (const c of elements(info)) {
13575
13640
  const tag = ln(c);
13576
13641
  if (tag !== "transMatrix" && tag !== "scaMatrix" && tag !== "rotMatrix") continue;
13577
13642
  const n = [num(c, "e1", 1), num(c, "e4"), num(c, "e2"), num(c, "e5", 1), num(c, "e3"), num(c, "e6")];
13578
- m = m ? mulAffine(m, n) : n;
13643
+ if (tag === "scaMatrix") {
13644
+ if (pendingS) apply(pendingS);
13645
+ pendingS = n;
13646
+ continue;
13647
+ }
13648
+ if (tag === "rotMatrix" && pendingS) {
13649
+ apply(mulAffine(n, pendingS));
13650
+ pendingS = null;
13651
+ continue;
13652
+ }
13653
+ apply(n);
13579
13654
  }
13655
+ if (pendingS) apply(pendingS);
13580
13656
  return m;
13581
13657
  }
13582
13658
  function objectGeometry(el, x, y, w, h, boxW = w, boxH = h) {
@@ -13683,7 +13759,7 @@ function linePushedBy(o, lineV, paraTop) {
13683
13759
  const raw = num(pos, "vertOffset"), vo = (pos?.getAttribute("vertRelTo") ?? "PARA") === "PARA" ? Math.max(0, raw >= 2 ** 31 ? raw - 2 ** 32 : raw) : 0;
13684
13760
  return Math.abs(lineV - (vo + num(om, "top") + o.height + num(om, "bottom")) - paraTop) <= 10;
13685
13761
  }
13686
- function anchorObject(o, ox, oy, baseV, areaW, ctx, anchorLineV, stayLine = false, paraStartV, lineH, lineSB = 0) {
13762
+ function anchorObject(o, ox, oy, baseV, areaW, ctx, anchorLineV, stayLine = false, paraStartV, lineH, lineSB = 0, anchorAt = "end") {
13687
13763
  const { PW, PH, ML, MT, BODY_W, BODY_H } = ctx.geom;
13688
13764
  const pos = findChildByLocalName(o.el, "pos");
13689
13765
  const om = findChildByLocalName(o.el, "outMargin");
@@ -13711,8 +13787,9 @@ function anchorObject(o, ox, oy, baseV, areaW, ctx, anchorLineV, stayLine = fals
13711
13787
  y = oy + anchor + omT + vo;
13712
13788
  } else {
13713
13789
  const origin = vrel === "PARA" && wrap === "SQUARE" ? paraStartV ?? baseV : baseV;
13714
- const later = vrel === "PARA" && wrap === "SQUARE" && anchorLineV !== void 0 && anchorLineV > baseV;
13715
- y = later ? oy + anchorLineV + vo + omT : oy + Math.max(origin + vo, wrap === "SQUARE" && anchorLineV !== void 0 ? anchorLineV : -Infinity) + omT;
13790
+ const later = vrel === "PARA" && wrap === "SQUARE" && anchorAt === "end" && anchorLineV !== void 0 && anchorLineV > baseV;
13791
+ const midLater = vrel === "PARA" && wrap === "SQUARE" && anchorAt === "top" && anchorLineV !== void 0 && anchorLineV > baseV;
13792
+ y = later ? oy + anchorLineV + vo + omT : oy + Math.max(origin + vo, wrap === "SQUARE" && !midLater && anchorLineV !== void 0 ? anchorLineV : -Infinity) + omT;
13716
13793
  }
13717
13794
  let x;
13718
13795
  const omL = num(om, "left"), omR = num(om, "right");
@@ -14779,7 +14856,8 @@ function drawPara(p, ox, oy, areaW, ctx, depth, segPages) {
14779
14856
  const plan = plans[planIdx];
14780
14857
  if (segPages && segPages[planIdx] !== void 0) ctx.page = segPages[planIdx];
14781
14858
  const x = ox + plan.seg.horzpos + plan.xoff + advanceTo(m, ctx.styles, plan, o.index) + o.omL;
14782
- const eqAsc = o.tag === "equation" && Number(o.el.getAttribute("baseLine")) > 0 ? Math.round(o.height * Number(o.el.getAttribute("baseLine")) / 100) : o.tag === "pic" ? Math.round(o.height * 0.85) : o.height;
14859
+ const shadowed = o.tag === "pic" && !!findChildByLocalName(findChildByLocalName(o.el, "effects") ?? o.el, "shadow") && plan.seg.textheight > o.height && Math.abs(plan.seg.baseline - Math.round(plan.seg.textheight * 0.85)) <= 2;
14860
+ const eqAsc = o.tag === "equation" && Number(o.el.getAttribute("baseLine")) > 0 ? Math.round(o.height * Number(o.el.getAttribute("baseLine")) / 100) : shadowed ? Math.round(plan.seg.textheight * 0.85) : o.tag === "pic" ? Math.round(o.height * 0.85) : o.height;
14783
14861
  const iom = findChildByLocalName(o.el, "outMargin"), iomT = num(iom, "top"), iomB = num(iom, "bottom");
14784
14862
  const yTop = oy + plan.seg.vertpos + Math.max(iomT, plan.seg.baseline - eqAsc - iomB - captionExtra(o.el));
14785
14863
  drawObject(o, x, yTop, baseV, areaW, ctx, depth);
@@ -14793,9 +14871,11 @@ function drawPara(p, ox, oy, areaW, ctx, depth, segPages) {
14793
14871
  }
14794
14872
  let anchorLineV;
14795
14873
  let anchorLineH = 0;
14874
+ let anchorSeg;
14796
14875
  for (const pl of plans) if (pl.start <= o.index) {
14797
14876
  anchorLineV = pl.seg.vertpos;
14798
14877
  anchorLineH = pl.seg.textheight;
14878
+ anchorSeg = pl.seg;
14799
14879
  }
14800
14880
  let objBaseV = baseV;
14801
14881
  const pTop = depth === 0 ? ctx.paraTops?.get(p) : void 0;
@@ -14806,6 +14886,9 @@ function drawPara(p, ox, oy, areaW, ctx, depth, segPages) {
14806
14886
  if (baseV > start + 100) {
14807
14887
  objBaseV = start;
14808
14888
  if (anchorLineV === baseV) anchorLineV = start;
14889
+ } else if (depth > 0 && start > top0 && Math.abs(baseV - start) <= 100) {
14890
+ objBaseV = top0;
14891
+ if (anchorLineV === baseV) anchorLineV = top0;
14809
14892
  }
14810
14893
  }
14811
14894
  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;
@@ -14813,7 +14896,21 @@ function drawPara(p, ox, oy, areaW, ctx, depth, segPages) {
14813
14896
  const sbA = m.paraPrId != null ? ctx.styles.paraGeom.get(m.paraPrId)?.spaceBefore ?? 0 : 0;
14814
14897
  if (stay && wrapA === "TOP_AND_BOTTOM" && linePushedBy(o, anchorLineV ?? baseV, pTop ?? (depth > 0 ? cellParaTop(p, ctx.styles.paraGeom) : void 0))) stay = false;
14815
14898
  const firstLine = anchorLineV === void 0 || anchorLineV === baseV;
14816
- 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, anchorLineH, firstLine ? sbA : 0);
14899
+ let { x, y } = anchorObject(
14900
+ o,
14901
+ ax,
14902
+ oy,
14903
+ objBaseV,
14904
+ aw,
14905
+ ctx,
14906
+ anchorLineV,
14907
+ stay ? sbA : false,
14908
+ (firstLine || wrapA === "SQUARE") && pTop !== void 0 && pTop < baseV ? pTop : void 0,
14909
+ anchorLineH,
14910
+ firstLine ? sbA : 0,
14911
+ // 문단 중간 글자 앵커인데 첫 줄부터 앵커 줄만큼 좁게 저장됐으면 개체는 문단 위에 있다(같은 판 한컴 PDF: 둘째 줄 앵커 사진, 네 줄 모두 34602)
14912
+ m.chars.slice(o.index).some((c) => c.ch.trim() !== "") && !!anchorSeg && plans.length > 0 && plans[0].seg !== anchorSeg && Math.abs(plans[0].seg.horzsize - anchorSeg.horzsize) <= 100 && anchorSeg.horzpos + anchorSeg.horzsize < aw - 1e3 ? "top" : m.chars.slice(o.index).some((c) => c.ch.trim() !== "") ? "mid" : "end"
14913
+ );
14817
14914
  let stackTop = depth === 0 ? pTop ?? 0 : cellParaTop(p, ctx.styles.paraGeom);
14818
14915
  if (tbFloats >= 2 && wrapA === "TOP_AND_BOTTOM" && stackTop !== void 0) {
14819
14916
  if (!tbStack) {
@@ -15068,10 +15165,28 @@ function drawTable(tbl, tx, ty, ctx, depth) {
15068
15165
  pcs.forEach((pc, k) => geom.push({ c, page: startPage + pc.page, ...xw(c), y: pc.y, h: pc.h, pieces: k === 0 ? pcs : [] }));
15069
15166
  continue;
15070
15167
  }
15168
+ if (c.rs > 1) {
15169
+ const span = plan.slice(c.ra, Math.min(c.ra + c.rs, nRows)).flat();
15170
+ const pages = [...new Set(span.map((pc) => pc.page))];
15171
+ if (pages.length > 1) {
15172
+ const bs = cellLineBoxes(c);
15173
+ const partTop = (k) => bs.find((b) => b.part === k);
15174
+ const groups = pages.map((pg, k) => {
15175
+ const on = span.filter((pc) => pc.page === pg);
15176
+ const y0 = Math.min(...on.map((pc) => pc.y)), y1 = Math.max(...on.map((pc) => pc.y + pc.h));
15177
+ const from = k === 0 ? 0 : partTop(k)?.origin ?? Number.POSITIVE_INFINITY;
15178
+ const to = k === pages.length - 1 ? Number.POSITIVE_INFINITY : partTop(k + 1)?.top ?? Number.POSITIVE_INFINITY;
15179
+ return { page: pg, y: y0, h: y1 - y0, range: /* @__PURE__ */ new Map([[c.el, [from, to]]]) };
15180
+ });
15181
+ groups.forEach((pc, k) => geom.push({ c, page: startPage + pc.page, ...xw(c), y: pc.y, h: pc.h, pieces: k === 0 ? groups : [] }));
15182
+ continue;
15183
+ }
15184
+ }
15071
15185
  const h = c.rs === 1 ? pcs[0].h : rowY[Math.min(c.ra + c.rs, nRows)] - rowY[c.ra];
15072
15186
  geom.push({ c, page: startPage + pcs[0].page, ...xw(c), y: pcs[0].y, h });
15073
15187
  }
15074
- for (const page of contPages) for (const c of cells) if (c.ra < hdrRows) geom.push({ c, page, ...xw(c), y: ctx.geom.MT + num(findChildByLocalName(tbl, "outMargin"), "top") + rowY[c.ra], h: rowY[Math.min(c.ra + c.rs, nRows)] - rowY[c.ra] });
15188
+ const contBase = depth !== 1 && ctx.splitContMT !== void 0 ? ctx.splitContMT : ctx.geom.MT;
15189
+ for (const page of contPages) for (const c of cells) if (c.ra < hdrRows) geom.push({ c, page, ...xw(c), y: contBase + num(findChildByLocalName(tbl, "outMargin"), "top") + rowY[c.ra], h: rowY[Math.min(c.ra + c.rs, nRows)] - rowY[c.ra] });
15075
15190
  for (const g of geom) {
15076
15191
  ctx.page = g.page;
15077
15192
  const bf = g.c.bfId != null ? ctx.styles.borderFill.get(g.c.bfId) : void 0;
@@ -15116,7 +15231,7 @@ function drawTable(tbl, tx, ty, ctx, depth) {
15116
15231
  });
15117
15232
  ctx.splitCell = splitHere;
15118
15233
  const contMTSaved = ctx.splitContMT;
15119
- ctx.splitContMT = ctx.geom.MT + num(findChildByLocalName(tbl, "outMargin"), "top") + rowY[hdrRows] + c.marginT;
15234
+ ctx.splitContMT = (depth > 1 && contMTSaved !== void 0 ? contMTSaved : ctx.geom.MT) + num(findChildByLocalName(tbl, "outMargin"), "top") + rowY[hdrRows] + c.marginT;
15120
15235
  drawPara(p, g.x + c.marginL, base, g.w - c.marginL - c.marginR, ctx, depth + 1, pages);
15121
15236
  ctx.splitContMT = contMTSaved;
15122
15237
  ctx.splitCell = false;
@@ -15763,6 +15878,7 @@ async function renderHwpxInternal(input, options) {
15763
15878
  }
15764
15879
  const roots = [];
15765
15880
  let noCacheSkipped = false;
15881
+ const lastParity = /* @__PURE__ */ new Map();
15766
15882
  for (let si = 0; si < secXmls.length; si++) {
15767
15883
  const secXml = secXmls[si];
15768
15884
  const hasCache = /<(?:[A-Za-z][\w.-]*:)?linesegarray[\s/>]/.test(secXml);
@@ -15779,6 +15895,14 @@ async function renderHwpxInternal(input, options) {
15779
15895
  }
15780
15896
  const secPr = findFirst(root, "secPr");
15781
15897
  const referenced = secPr ? elements(secPr).filter((el) => ln(el) === "masterPage").map((el) => masterPages.get(el.getAttribute("idRef") || "")).filter((el) => !!el) : [];
15898
+ const typeOf = (m) => m.getAttribute("type") || "BOTH";
15899
+ const has = (t) => referenced.some((m) => typeOf(m) === t);
15900
+ if (!has("BOTH")) for (const [t, other] of [["EVEN", "ODD"], ["ODD", "EVEN"]]) {
15901
+ const prev = lastParity.get(t);
15902
+ if (prev && !has(t) && has(other)) referenced.unshift(prev);
15903
+ }
15904
+ for (const m of referenced) if (typeOf(m) === "EVEN" || typeOf(m) === "ODD") lastParity.set(typeOf(m), m);
15905
+ if (has("BOTH")) lastParity.clear();
15782
15906
  roots.push({ root, index: si, masterPages: referenced, hasDeletionMarkers: secXml.includes("deleteBegin") || secXml.includes("deleteEnd") });
15783
15907
  }
15784
15908
  if (roots.length === 0) {
@@ -19962,4 +20086,4 @@ export {
19962
20086
  cropRect,
19963
20087
  extractRenderedRegions
19964
20088
  };
19965
- //# sourceMappingURL=chunk-DHMBPMKC.js.map
20089
+ //# sourceMappingURL=chunk-J45OVEUM.js.map