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/README.md CHANGED
@@ -100,7 +100,7 @@ await writeFile("보고서.hwpx", Buffer.from(hwpx))
100
100
 
101
101
  ## 검증 결과
102
102
 
103
- **4.22.11 · 2026-10-18 검증**. 고정 코퍼스와 참조 기준으로 측정한 결과입니다.
103
+ **4.22.13 · 2026-10-18 검증**. 고정 코퍼스와 참조 기준으로 측정한 결과입니다.
104
104
 
105
105
  | 대상 | 규모 | 결과 |
106
106
  | --- | --- | --- |
@@ -116,18 +116,20 @@ await writeFile("보고서.hwpx", Buffer.from(hwpx))
116
116
 
117
117
  표 구조 점수와 셀 내용·화면 재현은 별도 지표입니다. 중첩표 100%는 위 101표에 한정하며 전체 PDF·조판의 완전 일치를 뜻하지 않습니다. 채점 범위·제외 기준·전 벤치 문서별 비교는 [벤치마크 상세](docs/benchmarks.md)에 있습니다.
118
118
 
119
- **4.22.11 개선 검증(2026-10-18)**: 4.22.10과 같은 채점기·코퍼스로 다시 잰 결과 파서 출력(opendataloader-bench 네 모드·PDF 글·표·별표·OCR·기타 포맷·왕복)과 조판은 문서별로 4.22.10과 같고, 렌더(한컴 PDF 짝) 글 조각 위치(1.5pt 안) **85,496→85,837/90,418**로 개선했습니다. 쪽에서 갈린 칸 안 표의 이어진 쪽 시작, 갈라 저장한 행 마지막 조각의 개체 바닥, 여러 행 칸 내용이 저장 높이보다 클 때의 행 높이, 갈린 가운데 칸 마지막 조각의 정렬을 한컴과 같게 고치고, 개체만큼 밀려 저장된 빈 문단의 그림이 쪽 아래로 밀려 잘리던 것(4.21.31부터)을 바로잡았습니다. [상세](docs/benchmarks.md)
119
+ **4.22.13 개선 검증(2026-10-18)**: 4.22.12와 같은 채점기·코퍼스로 다시 잰 결과 파서 출력(opendataloader-bench 네 모드·PDF 글·표·별표·OCR·기타 포맷·왕복·생성)은 문서별로 4.22.12와 같고 조판 저장본 대조 지표도 그대로이며, 렌더(한컴 PDF 짝) 글 조각 위치(1.5pt 안) **85,968/90,428→86,051/90,433**, 그림 위치 **3,869→3,872/3,976**, 쪽 수 **1,413→1,421/1,431**로 개선했습니다. 꼬리말 없는 구역의 쪽 번호 자리, 한컴이 쪽에서 갈라 저장한 표·행의 쪽 넘김, 칸 안 표가 줄을 민 자리, 쪽을 넘는 칸 안 표를 바로잡았습니다. [상세](docs/benchmarks.md)
120
120
 
121
121
  빈 행을 접을 때 기존 논리 격자 안의 병합 모서리 셀을 보존합니다. 재현 PDF의 번호 기호 6종은 복원했으며, HTML 선 출력과 미등록 글꼴 기호는 [남은 한계](docs/parsing-loss-reproductions.md)로 기록했습니다.
122
122
 
123
- 외부 PDF 벤치 **opendataloader-bench 200문서**는 4.22.11 배포 후보의 동일 코퍼스 재검증에서 기본값 종합 **0.964**, OCR 끔 **0.939**입니다. [옵션별 결과와 재현 방법](docs/benchmarks.md#pdf--markdown--opendataloader-bench)
123
+ 외부 PDF 벤치 **opendataloader-bench 200문서**는 4.22.13 배포 후보의 동일 코퍼스 재검증에서 기본값 종합 **0.964**, OCR 끔 **0.939**입니다. [옵션별 결과와 재현 방법](docs/benchmarks.md#pdf--markdown--opendataloader-bench)
124
124
 
125
125
  ## 최근 업데이트
126
126
 
127
- 최신 배포: **[4.22.11](https://github.com/chrisryugj/kordoc/releases/tag/v4.22.11)** · 2026-10-18
127
+ 최신 배포: **[4.22.13](https://github.com/chrisryugj/kordoc/releases/tag/v4.22.13)** · 2026-10-18
128
128
 
129
129
  | 버전 | 주요 변경 |
130
130
  | --- | --- |
131
+ | 4.22.13 | 쪽 넘김·칸 안 표 렌더 보정 — 꼬리말 0 쪽 번호, 갈라 저장한 칸이 있는 표의 넘침 여유 해제, 첫 줄도 안 드는 갈라 저장 행은 다음 쪽, 칸 안 표에 밀린 줄, 쪽을 넘는 칸 안 표(한컴 PDF 글 조각 위치 85,968 → 86,051, 그림 3,869 → 3,872, 쪽 수 1,413 → 1,421) — 파서 출력·조판 지표는 4.22.12와 같음 |
132
+ | 4.22.12 | 글상자 렌더 보정 — 지금 크기(curSz)·쪽 좌표 캐시 재조판·글 영역 폭 없는 글상자·옛한글 자모 폭, 제 표에 밀린 쪽 나누기 문단, 같은 너비 행 없는 표의 가장 긴 길 열 경계(한컴 PDF 글 조각 위치 85,837 → 85,968, 그림 3,866 → 3,869) — 파서 출력·조판 지표는 4.22.11과 같음 |
131
133
  | 4.22.11 | 렌더 보정 — 갈린 칸 안 표의 이어진 쪽 시작·갈린 행 마지막 조각의 개체 바닥·여러 행 칸 내용 높이·갈린 가운데 칸 마지막 조각 정렬(한컴 PDF 글 조각 위치 85,496 → 85,837), 빈 문단 그림이 쪽 아래로 밀리던 4.21.31 회귀 수정 — 파서 출력·조판은 4.22.10과 같음 |
132
134
  | 4.22.10 | MCP `parse_document` OCR 모델 인수(#165), 렌더 표 보정 — 행마다 다른 칸 너비의 열 경계·병합 칸 행 성장·갈라 저장한 칸·쪽 바닥 첫 행·갈린 가운데 칸 다음 쪽 조각(한컴 PDF 글 조각 위치 84,468 → 85,496, 쪽 수 1,410 → 1,413) — 파서 출력·조판은 4.22.9와 같음 |
133
135
  | 4.22.9 | 굴림체·돋움체 반각 기호 폭·글머리표 예약 폭 조판 보정(본문 첫 줄 위치 76,676 → 76,729, 표 칸 205,007 → 205,015), 렌더의 갈라 저장한 가운데 칸·행 단위 표 쪽 넘김·개체 뒤 자동 탭 보정(한컴 PDF 글 조각 위치 82,816 → 84,468) — 파서 출력은 4.22.8과 같음 |
@@ -47,10 +47,10 @@ import {
47
47
  unknownFontWarnings,
48
48
  usesGaejosikMunche,
49
49
  validateHwpx
50
- } from "./chunk-PFDAVLZT.js";
50
+ } from "./chunk-AEDBCPFA.js";
51
51
  import {
52
52
  blocksToChunks
53
- } from "./chunk-SWY3AIPF.js";
53
+ } from "./chunk-PE3PGTLM.js";
54
54
  import {
55
55
  SPACE_EM_FIXED,
56
56
  SPACE_EM_FONT,
@@ -75,20 +75,20 @@ import {
75
75
  renderSceneToHtml,
76
76
  simulateWrap,
77
77
  simulateWrapKeepWord
78
- } from "./chunk-K6EG6ACM.js";
79
- import "./chunk-4YZMZMSL.js";
78
+ } from "./chunk-6VNSISFI.js";
79
+ import "./chunk-YD4TF6JI.js";
80
80
  import {
81
81
  blocksToPages
82
- } from "./chunk-PGIFLIT5.js";
82
+ } from "./chunk-YLCNGVXU.js";
83
83
  import "./chunk-VKVDMH7X.js";
84
84
  import "./chunk-VQFA55IC.js";
85
85
  import "./chunk-BYMPPVT3.js";
86
- import "./chunk-7HTGSGIV.js";
86
+ import "./chunk-MKRVPDDJ.js";
87
87
  import {
88
88
  blocksToMarkdown,
89
89
  flattenLayoutTables,
90
90
  hasStructuredCellContent
91
- } from "./chunk-KINTYLL4.js";
91
+ } from "./chunk-DUTPIML6.js";
92
92
  import {
93
93
  ValueCursor,
94
94
  applySplices,
@@ -102,11 +102,11 @@ import {
102
102
  isLabelCell,
103
103
  placeSealHwpx,
104
104
  scanSectionXml
105
- } from "./chunk-NK3WCKJA.js";
106
- import "./chunk-JX3QPTMU.js";
105
+ } from "./chunk-FVHGH6DG.js";
106
+ import "./chunk-FKMKZ3CV.js";
107
107
  import {
108
108
  VERSION
109
- } from "./chunk-RLMAOBWN.js";
109
+ } from "./chunk-RQII7NRF.js";
110
110
  import {
111
111
  DEFAULT_REDACT_RULES,
112
112
  redactMarkdown,
@@ -205,4 +205,4 @@ export {
205
205
  usesGaejosikMunche,
206
206
  validateHwpx
207
207
  };
208
- //# sourceMappingURL=-HVSX4WBM.js.map
208
+ //# sourceMappingURL=-WQIGIQTE.js.map
@@ -5,7 +5,7 @@ import {
5
5
  import {
6
6
  UNRULED_REGION_TABLES,
7
7
  extractPageBlocksWithLines
8
- } from "./chunk-WTJ7NVIJ.js";
8
+ } from "./chunk-M3YLZLHF.js";
9
9
  import {
10
10
  validateOcrOptions
11
11
  } from "./chunk-BYMPPVT3.js";
@@ -16,11 +16,11 @@ import {
16
16
  ocrSourcePath,
17
17
  parseCharacterDict,
18
18
  resolveOcrModels
19
- } from "./chunk-GMBWB4OU.js";
19
+ } from "./chunk-T4JZ7DGA.js";
20
20
  import {
21
21
  KordocError,
22
22
  OPTIONAL_DEP_INSTALL_HINT
23
- } from "./chunk-RLMAOBWN.js";
23
+ } from "./chunk-RQII7NRF.js";
24
24
 
25
25
  // src/ocr/ruling-lines.ts
26
26
  var INK_LUMA_MAX = 205;
@@ -2215,4 +2215,4 @@ export {
2215
2215
  groupOcrLines,
2216
2216
  ocrItemsToBlocks
2217
2217
  };
2218
- //# sourceMappingURL=chunk-ZXNKMDBN.js.map
2218
+ //# sourceMappingURL=chunk-3FXLQRWO.js.map
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  escapeHtml,
3
3
  sanitizeHref
4
- } from "./chunk-Z6EA67XV.js";
4
+ } from "./chunk-EMEEVTP2.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-JBPCRB4H.js.map
1542
+ //# sourceMappingURL=chunk-47NQ362T.js.map
@@ -2,7 +2,7 @@
2
2
  import {
3
3
  loadSharp,
4
4
  rasterizePageSvg
5
- } from "./chunk-4YZMZMSL.js";
5
+ } from "./chunk-YD4TF6JI.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-7HTGSGIV.js";
19
+ } from "./chunk-MKRVPDDJ.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-KINTYLL4.js";
35
+ } from "./chunk-DUTPIML6.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-JX3QPTMU.js";
49
+ } from "./chunk-FKMKZ3CV.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-RLMAOBWN.js";
57
+ } from "./chunk-RQII7NRF.js";
58
58
 
59
59
  // src/render/svg-render.ts
60
60
  import JSZip from "jszip";
@@ -124,11 +124,11 @@ function longestPathBoundaries(constraints, count) {
124
124
  }
125
125
  return { x, tight: x.map((v, k) => Math.abs(v + y[k] - x[count]) <= 2) };
126
126
  }
127
- function tableColumnBoundaries(constraints, count, total) {
127
+ function tableColumnBoundaries(constraints, count, total, noExactRow = false) {
128
128
  const prop = solveBoundaries(constraints, count, total);
129
129
  if (!total || total <= 0) return prop;
130
130
  const lp = longestPathBoundaries(constraints, count);
131
- 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;
131
+ 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;
132
132
  }
133
133
  function solveRowHeights(cells, rowCount, maxTotal = Number.POSITIVE_INFINITY) {
134
134
  const h = new Array(rowCount).fill(0);
@@ -11318,8 +11318,11 @@ function buildPara(p) {
11318
11318
  } else if (OBJ_TAGS.has(cn)) {
11319
11319
  const sz = findChildByLocalName(ch, "sz");
11320
11320
  const pos = findChildByLocalName(ch, "pos");
11321
- const w = num(sz, "width") || num(findChildByLocalName(ch, "curSz"), "width") || num(findChildByLocalName(ch, "orgSz"), "width");
11322
- const h = num(sz, "height") || num(findChildByLocalName(ch, "curSz"), "height") || num(findChildByLocalName(ch, "orgSz"), "height");
11321
+ const cur = findChildByLocalName(ch, "curSz");
11322
+ const rot = num(findChildByLocalName(ch, "rotationInfo"), "angle") % 360;
11323
+ const box = findChildByLocalName(ch, "drawText") && !rot && num(cur, "width") > 0 && num(cur, "height") > 0 && num(cur, "height") < 2 ** 31;
11324
+ const w = box ? num(cur, "width") : num(sz, "width") || num(cur, "width") || num(findChildByLocalName(ch, "orgSz"), "width");
11325
+ const h = box ? num(cur, "height") : num(sz, "height") || num(cur, "height") || num(findChildByLocalName(ch, "orgSz"), "height");
11323
11326
  const inline = pos?.getAttribute("treatAsChar") === "1";
11324
11327
  const om = inline ? findChildByLocalName(ch, "outMargin") : null;
11325
11328
  if (!deleted) objs.push({
@@ -11435,7 +11438,8 @@ function cellContentExtent(cell, memo) {
11435
11438
  const pushed = baseV - (num(om, "top") + o.height + num(om, "bottom"));
11436
11439
  const anchor = pushed >= -100 ? pushed : baseV - (memo?.paraGeom?.get(p.getAttribute("paraPrIDRef") ?? "")?.spaceBefore ?? 0);
11437
11440
  const vo = num(pos, "vertOffset");
11438
- ext = Math.max(ext, anchor + num(om, "top") + Math.max(0, vo) + o.height);
11441
+ const oh = o.tag === "tbl" ? Math.max(o.height, measureTableHeight(o.el, memo)) : o.height;
11442
+ ext = Math.max(ext, anchor + num(om, "top") + Math.max(0, vo) + oh);
11439
11443
  }
11440
11444
  }
11441
11445
  memo?.cell.set(cell.el, ext);
@@ -11858,7 +11862,7 @@ function reflowSubListsIn(p, doc, styles, mode, counter, flow, noteW = counter.b
11858
11862
  }
11859
11863
  if (t === "drawText" || t === "caption") {
11860
11864
  const sub = findChildByLocalName(ch, "subList"), tm = findChildByLocalName(ch, "textMargin");
11861
- const textW = num(ch, "lastWidth") || (t === "caption" ? num(ch, "width") : 0);
11865
+ const textW = num(ch, "lastWidth") || (t === "caption" ? num(ch, "width") : num(findChildByLocalName(el, "sz"), "width"));
11862
11866
  const w = textW - num(tm, "left") - num(tm, "right");
11863
11867
  if (sub && w > 0) flow(sub, doc, styles, w, mode, counter, 0);
11864
11868
  continue;
@@ -12080,6 +12084,7 @@ var isJamoV = (cp) => cp >= 4448 && cp <= 4519 || cp >= 55216 && cp <= 55238;
12080
12084
  var isJamoT = (cp) => cp >= 4520 && cp <= 4607 || cp >= 55243 && cp <= 55291;
12081
12085
  var isJamoLV = (cp) => isJamoL(cp) || isJamoV(cp);
12082
12086
  var isJamoVT = (cp) => isJamoV(cp) || isJamoT(cp);
12087
+ var joinsJamo = (prevCp, cp) => isJamoVT(cp) && isJamoLV(prevCp);
12083
12088
  var isLatinCp = (cp) => cp < 592 || cp >= 7680 && cp < 8192 || cp >= 8216 && cp < 8224;
12084
12089
  function hancomLangOf(cp) {
12085
12090
  if (isLatinCp(cp)) return "latin";
@@ -12210,7 +12215,7 @@ function reflowPara(p, doc, styles, areaW, startV, mode, zones = [], nums = /* @
12210
12215
  if (c.ch === "") continue;
12211
12216
  const st = (c.prId != null ? styles.charPr.get(c.prId) : void 0) ?? DEFAULT_CHAR;
12212
12217
  const cp = c.ch.codePointAt(0);
12213
- const joins = isJamoVT(cp) && isJamoLV(text.codePointAt(text.length - 1) ?? 0);
12218
+ const joins = joinsJamo(text.codePointAt(text.length - 1) ?? 0, cp);
12214
12219
  const { w, sp } = joins ? { w: 0, sp: 0 } : glyphWidth(c.ch, st);
12215
12220
  for (let u = 0; u < c.ch.length; u++) {
12216
12221
  realIdx.push(i);
@@ -13261,6 +13266,7 @@ function planTableRows(tbl, cells, rowH, ty, MT, BODY_H, slack = 0, floatSpan, n
13261
13266
  const st = stackedFloats(rc[0]);
13262
13267
  return st.length >= 2 && st.reduce((a, f) => a + f.h, 0) > h;
13263
13268
  });
13269
+ if (slack > 0 && ty + rowY[nRows] > pageBottom && ty + rowY[nRows] <= pageBottom + slack && cells.some((c) => cellLineBoxes(c).some((b) => b.part > 0))) slack = 0;
13264
13270
  if (BODY_H <= 0 || ty + rowY[nRows] <= pageBottom + slack && !stackOver) return plain();
13265
13271
  if (findChildByLocalName(tbl, "pos")?.getAttribute("treatAsChar") === "1") {
13266
13272
  const declared = num(findChildByLocalName(tbl, "sz"), "height") || rowY[nRows];
@@ -13311,6 +13317,14 @@ function planTableRows(tbl, cells, rowH, ty, MT, BODY_H, slack = 0, floatSpan, n
13311
13317
  const boxes = splittable ? new Map(rowCells.map((c) => [c.el, cellLineBoxes(c)])) : void 0;
13312
13318
  const hParts = boxes ? Math.max(0, ...[...boxes.values()].flatMap((bs) => bs.map((b) => b.part))) : 0;
13313
13319
  if (boxes && hParts > 0) {
13320
+ if (!first && rowCells.some((c) => {
13321
+ const b = (boxes.get(c.el) ?? []).find((x) => x.part === 0);
13322
+ return !!b && c.marginT + b.bottom - b.origin > pageBottom - y - c.marginB;
13323
+ })) {
13324
+ page++;
13325
+ y = contTop;
13326
+ first = true;
13327
+ }
13314
13328
  const declared = num(findChildByLocalName(tbl, "sz"), "height");
13315
13329
  const led = /* @__PURE__ */ new Set();
13316
13330
  let firstPh = 0;
@@ -13385,6 +13399,29 @@ function planTableRows(tbl, cells, rowH, ty, MT, BODY_H, slack = 0, floatSpan, n
13385
13399
  first = false;
13386
13400
  continue;
13387
13401
  }
13402
+ if (boxes && floatSpan) {
13403
+ let span = 0, spanEnd = 0, mB = 0;
13404
+ for (const c of rowCells) for (const b of boxes.get(c.el) ?? []) {
13405
+ const f = floatSpan(b.seg, y + c.marginT + b.top, contTop + c.marginT);
13406
+ if (f && f.pages > span) {
13407
+ span = f.pages;
13408
+ spanEnd = f.endY;
13409
+ mB = c.marginB;
13410
+ }
13411
+ }
13412
+ if (span > 0) {
13413
+ const none = new Map(rowCells.map((c) => [c.el, [Number.POSITIVE_INFINITY, Number.POSITIVE_INFINITY]]));
13414
+ pieces.push({ page, y, h: pageBottom - y, range: new Map(rowCells.map((c) => [c.el, [0, Number.POSITIVE_INFINITY]])), fill: true });
13415
+ for (let e = 1; e < span; e++) pieces.push({ page: page + e, y: contTop, h: pageBottom - contTop, range: none, fill: true });
13416
+ page += span;
13417
+ const endH = Math.max(0, spanEnd - contTop) + mB;
13418
+ pieces.push({ page, y: contTop, h: endH, range: none });
13419
+ out.push(pieces);
13420
+ y = contTop + endH;
13421
+ first = false;
13422
+ continue;
13423
+ }
13424
+ }
13388
13425
  if (splittable && y + h > pageBottom) {
13389
13426
  const from = /* @__PURE__ */ new Map();
13390
13427
  const lines = new Map(rowCells.map((c) => [c.el, cellLines(c)]));
@@ -14419,16 +14456,20 @@ function warnOnce(ctx, key, msg) {
14419
14456
  ctx.warned.add(key);
14420
14457
  ctx.warnings.push(msg);
14421
14458
  }
14422
- function charW(c, styles) {
14459
+ function charW(c, styles, prev) {
14423
14460
  const st = (c.prId != null ? styles.charPr.get(c.prId) : void 0) ?? DEFAULT_CHAR;
14424
14461
  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) });
14425
- let w = 0;
14426
- for (const ch of c.ch) w += glyphWidth(ch, st).w;
14462
+ let w = 0, last = prev?.ch ? prev.ch.codePointAt(prev.ch.length - 1) ?? 0 : 0;
14463
+ for (const ch of c.ch) {
14464
+ const cp = ch.codePointAt(0);
14465
+ if (!joinsJamo(last, cp)) w += glyphWidth(ch, st).w;
14466
+ last = cp;
14467
+ }
14427
14468
  return w;
14428
14469
  }
14429
14470
  function lineNaturalWidth(m, styles, start, end) {
14430
14471
  let text = 0;
14431
- for (let i = start; i < end && i < m.chars.length; i++) text += charW(m.chars[i], styles);
14472
+ for (let i = start; i < end && i < m.chars.length; i++) text += charW(m.chars[i], styles, m.chars[i - 1]);
14432
14473
  let obj = 0;
14433
14474
  for (const o of m.objs) if (o.inline && o.index >= start && o.index < end) obj += o.omL + o.width + o.omR;
14434
14475
  return { text, obj };
@@ -14462,7 +14503,7 @@ function planLines(m, styles, numText = "") {
14462
14503
  continue;
14463
14504
  }
14464
14505
  if (!c.tab) {
14465
- x += charW(c, styles);
14506
+ x += charW(c, styles, m.chars[k - 1]);
14466
14507
  continue;
14467
14508
  }
14468
14509
  const adv = tabAdvance(x, i === 0, geom, c.tabW);
@@ -14508,7 +14549,7 @@ function planLines(m, styles, numText = "") {
14508
14549
  function advanceTo(m, styles, plan, upto) {
14509
14550
  let x = 0;
14510
14551
  for (let i = plan.start; i < upto && i < m.chars.length; i++) {
14511
- 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);
14552
+ 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);
14512
14553
  }
14513
14554
  for (const o of m.objs) if (o.inline && o.index >= plan.start && o.index < upto) x += o.omL + o.width + o.omR;
14514
14555
  return x;
@@ -14608,8 +14649,12 @@ function drawPara(p, ox, oy, areaW, ctx, depth, segPages) {
14608
14649
  const fh = st.script ? Math.round(st.height * 16 / 25) : st.height;
14609
14650
  const raise = st.script === "sup" ? Math.round(st.height * 0.44) : 0;
14610
14651
  const measure = (text) => {
14611
- let w = 0;
14612
- for (const ch of text) w += glyphWidth(ch, st).w;
14652
+ let w = 0, last = 0;
14653
+ for (const ch of text) {
14654
+ const cp = ch.codePointAt(0);
14655
+ if (!joinsJamo(last, cp)) w += glyphWidth(ch, st).w;
14656
+ last = cp;
14657
+ }
14613
14658
  return w;
14614
14659
  };
14615
14660
  const skipLead = Math.max(0, plan.spFrom - i);
@@ -14719,7 +14764,7 @@ function drawPara(p, ox, oy, areaW, ctx, depth, segPages) {
14719
14764
  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;
14720
14765
  let stay = tbFloats < 2 && !m.objs.some((q) => q.inline) && !m.chars.some((c) => c.ch !== "" && !c.nb && c.ch.trim() !== "");
14721
14766
  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;
14767
+ if (stay && wrapA === "TOP_AND_BOTTOM" && linePushedBy(o, anchorLineV ?? baseV, pTop ?? (depth > 0 ? cellParaTop(p, ctx.styles.paraGeom) : void 0))) stay = false;
14723
14768
  const firstLine = anchorLineV === void 0 || anchorLineV === baseV;
14724
14769
  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);
14725
14770
  if (depth === 0 && tbFloats >= 2 && wrapA === "TOP_AND_BOTTOM") {
@@ -14913,7 +14958,9 @@ function cellFloatSpan(MT, BODY_H, memo, slack) {
14913
14958
  if ((pos?.getAttribute("vertRelTo") ?? "PARA") !== "PARA") continue;
14914
14959
  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)));
14915
14960
  if (segK !== k) continue;
14916
- const ty = top + num(findChildByLocalName(o.el, "outMargin"), "top") + Math.max(0, toInt32(pos?.getAttribute("vertOffset") ?? void 0, 0));
14961
+ const segV = num(seg, "vertpos"), pTop = cellParaTop(p, memo.paraGeom ?? /* @__PURE__ */ new Map());
14962
+ const start = linePushedBy(o, segV, pTop) ? top - (segV - (pTop ?? segV)) : top;
14963
+ const ty = start + num(findChildByLocalName(o.el, "outMargin"), "top") + Math.max(0, toInt32(pos?.getAttribute("vertOffset") ?? void 0, 0));
14917
14964
  const span = tableContPages(o.el, ty, MT, BODY_H, memo, slack, cellFloatSpan(MT, BODY_H, memo, slack), true, contMT);
14918
14965
  if (span.pages > 0 && (!best || span.pages > best.pages)) best = { ...span, el: o.el };
14919
14966
  }
@@ -14932,7 +14979,16 @@ function drawTable(tbl, tx, ty, ctx, depth) {
14932
14979
  const nCols = Math.max(...cells.map((c) => c.ca + c.cs));
14933
14980
  const nRows = Math.max(...cells.map((c) => c.ra + c.rs));
14934
14981
  const colCons = cells.map((c) => ({ a: c.ca, b: c.ca + c.cs, size: c.w }));
14935
- const colX = tableColumnBoundaries(colCons, nCols, num(tblSz, "width") || void 0);
14982
+ const tblW = num(tblSz, "width");
14983
+ const rowSum = /* @__PURE__ */ new Map();
14984
+ for (const c of cells) {
14985
+ const r = rowSum.get(c.ra) ?? { cover: 0, w: 0 };
14986
+ r.cover += c.cs;
14987
+ r.w += c.w;
14988
+ rowSum.set(c.ra, r);
14989
+ }
14990
+ const noExactRow = ![...rowSum.values()].some((r) => r.cover === nCols && Math.abs(r.w - tblW) <= 2);
14991
+ const colX = tableColumnBoundaries(colCons, nCols, tblW || void 0, noExactRow);
14936
14992
  const rowH = measureTableRowHeights(tbl, ctx.extentMemo);
14937
14993
  const rowY = [0];
14938
14994
  for (let r = 0; r < nRows; r++) rowY.push(rowY[r] + rowH[r]);
@@ -14984,7 +15040,7 @@ function drawTable(tbl, tx, ty, ctx, depth) {
14984
15040
  const va2 = c.sub.getAttribute("vertAlign") ?? "TOP";
14985
15041
  const lastK = g.pieces.length - 1;
14986
15042
  const pieceOff = g.pieces.map((pc, k) => {
14987
- if (va2 === "TOP" || k > 0 && k < lastK) return 0;
15043
+ if (va2 === "TOP" || k > 0 && k < lastK || pc.fill) return 0;
14988
15044
  const from = pc.range?.get(c.el)?.[0] ?? 0;
14989
15045
  const bottoms = boxes.filter((b) => pieceOf(b.top) === k).map((b) => b.bottom - from);
14990
15046
  if (k > 0) for (const f of subFloatBottoms(c.sub)) {
@@ -15178,6 +15234,20 @@ function staleTopCache(root, BODY_H) {
15178
15234
  }
15179
15235
  return false;
15180
15236
  }
15237
+ function absoluteTopCache(root, ML, BODY_W) {
15238
+ let tot = 0, over = 0;
15239
+ for (const p of elements(root)) {
15240
+ if (ln(p) !== "p") continue;
15241
+ const lsa = findChildByLocalName(p, "linesegarray");
15242
+ for (const sg of lsa ? elements(lsa) : []) {
15243
+ if (ln(sg) !== "lineseg" || num(sg, "horzsize") <= 0) continue;
15244
+ tot++;
15245
+ const hp = num(sg, "horzpos");
15246
+ if (hp >= ML - 500 && hp + num(sg, "horzsize") > BODY_W + 500) over++;
15247
+ }
15248
+ }
15249
+ return over >= 3 && over * 5 >= tot;
15250
+ }
15181
15251
  function renderSectionToPages(root, geom, ctxBase, doReflow, reflowMode, masters = [], hasDeletionMarkers = true, lastSection = true) {
15182
15252
  const { PW, PH, ML, MT, BODY_W, BODY_H } = geom;
15183
15253
  if (hasDeletionMarkers) prepareDeletedRanges(root);
@@ -15189,8 +15259,13 @@ function renderSectionToPages(root, geom, ctxBase, doReflow, reflowMode, masters
15189
15259
  }
15190
15260
  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");
15191
15261
  }
15192
- const mixed = !doReflow && !degenerate && Array.from(root.getElementsByTagName("*")).some((p) => ln(p) === "p" && !findChildByLocalName(p, "linesegarray"));
15193
- if (doReflow || degenerate || mixed) reflowSection(root, ctxBase.styles, { BODY_W, BODY_H }, reflowMode);
15262
+ const absolute = !degenerate && absoluteTopCache(root, ML, BODY_W);
15263
+ if (absolute) {
15264
+ for (const lsa of Array.from(root.getElementsByTagName("*")).filter((e) => ln(e) === "linesegarray")) lsa.parentNode?.removeChild(lsa);
15265
+ 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");
15266
+ }
15267
+ const mixed = !doReflow && !degenerate && !absolute && Array.from(root.getElementsByTagName("*")).some((p) => ln(p) === "p" && !findChildByLocalName(p, "linesegarray"));
15268
+ if (doReflow || degenerate || absolute || mixed) reflowSection(root, ctxBase.styles, { BODY_W, BODY_H }, reflowMode);
15194
15269
  const colPr = findFirst(root, "colPr");
15195
15270
  const multiCol = num(colPr, "colCount", 1) > 1;
15196
15271
  const nCol = multiCol ? num(colPr, "colCount", 1) : 1, colGap = multiCol ? num(colPr, "sameGap", 0) : 0;
@@ -15245,7 +15320,7 @@ function renderSectionToPages(root, geom, ctxBase, doReflow, reflowMode, masters
15245
15320
  pendingEnd = 0;
15246
15321
  } else {
15247
15322
  const brk = v < prevV ? !multiCol || h <= prevH : v === prevV && h <= prevH && prevEnd > v && v < BODY_H / 2;
15248
- const pbrk = !brk && paraFirst && prevV !== Number.NEGATIVE_INFINITY && p.getAttribute("pageBreak") === "1" && v < BODY_H / 2;
15323
+ 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)));
15249
15324
  const obrk = !brk && !pbrk && !multiCol && paraFirst && v > prevV && v < prevEnd - 100 && prevEnd + num(s, "vertsize") > BODY_H && v < BODY_H / 2;
15250
15325
  if (brk || pbrk || obrk) cur++;
15251
15326
  if (brk && prevSeg && prevV + prevSeg.vs > BODY_H && v === prevSeg.vs + prevSeg.sp && prevSeg.pages[prevSeg.idx] === cur - 1) {
@@ -15504,7 +15579,7 @@ function drawPageNumbers(root, paraPages, ctx) {
15504
15579
  const text = side ? `${side} ${formatHeadNumber2(n, decl.el.getAttribute("formatType") ?? "DIGIT")} ${side}` : formatHeadNumber2(n, decl.el.getAttribute("formatType") ?? "DIGIT");
15505
15580
  const w = measureTextWidth(text, h, 100, { faceClass: faceClassOf(st.face) });
15506
15581
  const x = /LEFT/.test(pos) ? ML : /RIGHT/.test(pos) ? ML + BODY_W - w : (PW - w) / 2;
15507
- const y = /^TOP/.test(pos) ? num(margin, "top", 5668) - 225 : PH - num(margin, "bottom", 4252) - 225;
15582
+ const y = /^TOP/.test(pos) ? num(margin, "top", 5668) - 225 : num(margin, "footer", 0) > 0 ? PH - num(margin, "bottom", 4252) - 225 : PH - Math.round(num(margin, "bottom", 4252) / 2) - 243;
15508
15583
  const attrs = [`x="${pt2(x)}"`, `y="${pt2(y)}"`, `font-size="${pt2(h)}"`];
15509
15584
  if (st.fontFamily) attrs.push(`font-family="${escapeXml(st.fontFamily)}"`);
15510
15585
  ctx.page = page;
@@ -19819,4 +19894,4 @@ export {
19819
19894
  cropRect,
19820
19895
  extractRenderedRegions
19821
19896
  };
19822
- //# sourceMappingURL=chunk-K6EG6ACM.js.map
19897
+ //# sourceMappingURL=chunk-6VNSISFI.js.map