kordoc 4.22.10 → 4.22.12
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.
- package/README.md +6 -4
- package/dist/{-K6ZEUCPU.js → -KQIWF7GR.js} +11 -11
- package/dist/{chunk-AXOFVPF2.js → chunk-45GOHDHP.js} +2 -2
- package/dist/{chunk-5QEVIUXM.js → chunk-52XK5GKO.js} +2 -2
- package/dist/{chunk-7YDXV44H.js → chunk-5WOYDR7R.js} +4 -4
- package/dist/{chunk-ATSTJQMI.js → chunk-5YGTRWCN.js} +143 -83
- package/dist/chunk-5YGTRWCN.js.map +1 -0
- package/dist/{chunk-NU4IFUHW.js → chunk-6DIUB4XS.js} +2 -2
- package/dist/{chunk-JJSSXV55.js → chunk-A7ZUDINW.js} +2 -2
- package/dist/{chunk-FMVSQED7.js → chunk-BTRNHZWT.js} +2 -2
- package/dist/{chunk-5TVTSRHH.js → chunk-BU7SJLB4.js} +3 -3
- package/dist/{chunk-6ZQ47CXH.js → chunk-C7E5WHUJ.js} +3 -3
- package/dist/{chunk-MILWFVER.cjs → chunk-CLVIG2P5.cjs} +3 -3
- package/dist/{chunk-MILWFVER.cjs.map → chunk-CLVIG2P5.cjs.map} +1 -1
- package/dist/{chunk-ZWBFTG3T.js → chunk-D4QSFRKK.js} +2 -2
- package/dist/{chunk-D7FPRPEZ.cjs → chunk-EZIUU32T.cjs} +2 -2
- package/dist/{chunk-D7FPRPEZ.cjs.map → chunk-EZIUU32T.cjs.map} +1 -1
- package/dist/{chunk-M7AXOSY5.js → chunk-FX6Y3N4K.js} +4 -4
- package/dist/{chunk-ZN4BGNYO.cjs → chunk-GHTV5OON.cjs} +23 -23
- package/dist/{chunk-ZN4BGNYO.cjs.map → chunk-GHTV5OON.cjs.map} +1 -1
- package/dist/{chunk-APEYJ6G5.js → chunk-HR5OB3PJ.js} +2 -2
- package/dist/{chunk-5RBT7L72.js → chunk-JHWISUYV.js} +2 -2
- package/dist/{chunk-55JC3WIX.cjs → chunk-KXHVDSXA.cjs} +3 -3
- package/dist/{chunk-55JC3WIX.cjs.map → chunk-KXHVDSXA.cjs.map} +1 -1
- package/dist/{chunk-3HEWZNSJ.js → chunk-L3WMBMDN.js} +2 -2
- package/dist/{chunk-GWYFJQL7.js → chunk-LYZGZMLW.js} +11 -11
- package/dist/{chunk-A65TQXWP.js → chunk-NFLXHIF7.js} +4 -4
- package/dist/{chunk-M4P52HHG.js → chunk-O7F6PWT4.js} +2 -2
- package/dist/{chunk-VLAYMRFS.js → chunk-P32MSVJI.js} +2 -2
- package/dist/{chunk-TUEX7M4N.js → chunk-RDWNQARC.js} +2 -2
- package/dist/{chunk-HTPPDXDH.js → chunk-RWHOVUUS.js} +2 -2
- package/dist/{chunk-LAZZEGT4.js → chunk-S2B4CTQT.js} +3 -3
- package/dist/{chunk-K65R6PB4.js → chunk-TFYEKMLY.js} +2 -2
- package/dist/{chunk-HRFGBMVO.cjs → chunk-VVU45ET4.cjs} +6 -6
- package/dist/{chunk-HRFGBMVO.cjs.map → chunk-VVU45ET4.cjs.map} +1 -1
- package/dist/{chunk-WCXPF7PT.cjs → chunk-X26KQYRU.cjs} +24 -24
- package/dist/{chunk-WCXPF7PT.cjs.map → chunk-X26KQYRU.cjs.map} +1 -1
- package/dist/{chunk-4OZKQ4ET.js → chunk-X4EYUXOV.js} +2 -2
- package/dist/chunks-6V34GQOS.js +10 -0
- package/dist/cli.js +30 -30
- package/dist/{formula-J5DTOYGK.js → formula-2QCZI77K.js} +4 -4
- package/dist/{formula-YYMYI32F.js → formula-DYNRSHYF.js} +3 -3
- package/dist/{formula-SOILYG2T.cjs → formula-NG3YI7AK.cjs} +9 -9
- package/dist/{formula-SOILYG2T.cjs.map → formula-NG3YI7AK.cjs.map} +1 -1
- package/dist/{image-ocr-HXLPIDJH.js → image-ocr-7D5KQUCQ.js} +6 -6
- package/dist/{image-ocr-2FQTSQAQ.cjs → image-ocr-P7YLKRUT.cjs} +17 -17
- package/dist/{image-ocr-2FQTSQAQ.cjs.map → image-ocr-P7YLKRUT.cjs.map} +1 -1
- package/dist/{image-ocr-EXZCN2Q5.js → image-ocr-TQB7UVGP.js} +9 -9
- package/dist/index.cjs +524 -464
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +143 -83
- package/dist/index.js.map +1 -1
- package/dist/mcp.js +22 -22
- package/dist/{model-bundle-L2OLSYAW.js → model-bundle-KSCQNHCC.js} +5 -5
- package/dist/{models-A4JR64CR.js → models-FL5TCXCT.js} +5 -5
- package/dist/{parse-worker-v2-YCNMSEIB.js → parse-worker-v2-EAGA4B4A.js} +12 -12
- package/dist/{parser-WFLZFNN4.js → parser-DANL24BN.js} +12 -12
- package/dist/{parser-2QCANHDO.js → parser-I7LDZPKR.js} +9 -9
- package/dist/{parser-S3IJOFFP.cjs → parser-LJE3SCND.cjs} +157 -157
- package/dist/{parser-S3IJOFFP.cjs.map → parser-LJE3SCND.cjs.map} +1 -1
- package/dist/{pdf-ocr-MXOMLVFC.js → pdf-ocr-C3ZLE47I.js} +6 -6
- package/dist/{pdf-ocr-UBQ4K63F.js → pdf-ocr-MWQTRCXQ.js} +9 -9
- package/dist/pdf-ocr-P6TG2KCD.cjs +31 -0
- package/dist/{pdf-ocr-6S4U4T56.cjs.map → pdf-ocr-P6TG2KCD.cjs.map} +1 -1
- package/dist/{profile-io-PIHSFGQ6.js → profile-io-Z5I6I6KS.js} +3 -3
- package/dist/{rasterize-7GBVLJG4.js → rasterize-HTNSO4VK.js} +3 -3
- package/dist/{redact-doc-CVJWVNKE.js → redact-doc-C2PNNX47.js} +11 -11
- package/dist/{render-FQN7Y52S.js → render-AFFWMWKU.js} +7 -7
- package/dist/seal-PBREQDNO.js +10 -0
- package/dist/{setup-JTVGMAJB.js → setup-GJKNGTRT.js} +3 -3
- package/dist/visual-HTE3YLPV.js +21 -0
- package/dist/{watch-5MU2GVS4.js → watch-F7W4ZM6Q.js} +12 -12
- package/package.json +1 -1
- package/dist/chunk-ATSTJQMI.js.map +0 -1
- package/dist/chunks-A4DKG5YP.js +0 -10
- package/dist/pdf-ocr-6S4U4T56.cjs +0 -31
- package/dist/seal-FZGFDRBC.js +0 -10
- package/dist/visual-SNHWQXSM.js +0 -21
- /package/dist/{-K6ZEUCPU.js.map → -KQIWF7GR.js.map} +0 -0
- /package/dist/{chunk-AXOFVPF2.js.map → chunk-45GOHDHP.js.map} +0 -0
- /package/dist/{chunk-5QEVIUXM.js.map → chunk-52XK5GKO.js.map} +0 -0
- /package/dist/{chunk-7YDXV44H.js.map → chunk-5WOYDR7R.js.map} +0 -0
- /package/dist/{chunk-NU4IFUHW.js.map → chunk-6DIUB4XS.js.map} +0 -0
- /package/dist/{chunk-JJSSXV55.js.map → chunk-A7ZUDINW.js.map} +0 -0
- /package/dist/{chunk-FMVSQED7.js.map → chunk-BTRNHZWT.js.map} +0 -0
- /package/dist/{chunk-5TVTSRHH.js.map → chunk-BU7SJLB4.js.map} +0 -0
- /package/dist/{chunk-6ZQ47CXH.js.map → chunk-C7E5WHUJ.js.map} +0 -0
- /package/dist/{chunk-ZWBFTG3T.js.map → chunk-D4QSFRKK.js.map} +0 -0
- /package/dist/{chunk-M7AXOSY5.js.map → chunk-FX6Y3N4K.js.map} +0 -0
- /package/dist/{chunk-APEYJ6G5.js.map → chunk-HR5OB3PJ.js.map} +0 -0
- /package/dist/{chunk-5RBT7L72.js.map → chunk-JHWISUYV.js.map} +0 -0
- /package/dist/{chunk-3HEWZNSJ.js.map → chunk-L3WMBMDN.js.map} +0 -0
- /package/dist/{chunk-GWYFJQL7.js.map → chunk-LYZGZMLW.js.map} +0 -0
- /package/dist/{chunk-A65TQXWP.js.map → chunk-NFLXHIF7.js.map} +0 -0
- /package/dist/{chunk-M4P52HHG.js.map → chunk-O7F6PWT4.js.map} +0 -0
- /package/dist/{chunk-VLAYMRFS.js.map → chunk-P32MSVJI.js.map} +0 -0
- /package/dist/{chunk-TUEX7M4N.js.map → chunk-RDWNQARC.js.map} +0 -0
- /package/dist/{chunk-HTPPDXDH.js.map → chunk-RWHOVUUS.js.map} +0 -0
- /package/dist/{chunk-LAZZEGT4.js.map → chunk-S2B4CTQT.js.map} +0 -0
- /package/dist/{chunk-K65R6PB4.js.map → chunk-TFYEKMLY.js.map} +0 -0
- /package/dist/{chunk-4OZKQ4ET.js.map → chunk-X4EYUXOV.js.map} +0 -0
- /package/dist/{chunks-A4DKG5YP.js.map → chunks-6V34GQOS.js.map} +0 -0
- /package/dist/{formula-J5DTOYGK.js.map → formula-2QCZI77K.js.map} +0 -0
- /package/dist/{formula-YYMYI32F.js.map → formula-DYNRSHYF.js.map} +0 -0
- /package/dist/{image-ocr-HXLPIDJH.js.map → image-ocr-7D5KQUCQ.js.map} +0 -0
- /package/dist/{image-ocr-EXZCN2Q5.js.map → image-ocr-TQB7UVGP.js.map} +0 -0
- /package/dist/{model-bundle-L2OLSYAW.js.map → model-bundle-KSCQNHCC.js.map} +0 -0
- /package/dist/{models-A4JR64CR.js.map → models-FL5TCXCT.js.map} +0 -0
- /package/dist/{parse-worker-v2-YCNMSEIB.js.map → parse-worker-v2-EAGA4B4A.js.map} +0 -0
- /package/dist/{parser-WFLZFNN4.js.map → parser-DANL24BN.js.map} +0 -0
- /package/dist/{parser-2QCANHDO.js.map → parser-I7LDZPKR.js.map} +0 -0
- /package/dist/{pdf-ocr-MXOMLVFC.js.map → pdf-ocr-C3ZLE47I.js.map} +0 -0
- /package/dist/{pdf-ocr-UBQ4K63F.js.map → pdf-ocr-MWQTRCXQ.js.map} +0 -0
- /package/dist/{profile-io-PIHSFGQ6.js.map → profile-io-Z5I6I6KS.js.map} +0 -0
- /package/dist/{rasterize-7GBVLJG4.js.map → rasterize-HTNSO4VK.js.map} +0 -0
- /package/dist/{redact-doc-CVJWVNKE.js.map → redact-doc-C2PNNX47.js.map} +0 -0
- /package/dist/{render-FQN7Y52S.js.map → render-AFFWMWKU.js.map} +0 -0
- /package/dist/{seal-FZGFDRBC.js.map → seal-PBREQDNO.js.map} +0 -0
- /package/dist/{setup-JTVGMAJB.js.map → setup-GJKNGTRT.js.map} +0 -0
- /package/dist/{visual-SNHWQXSM.js.map → visual-HTE3YLPV.js.map} +0 -0
- /package/dist/{watch-5MU2GVS4.js.map → watch-F7W4ZM6Q.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.
|
|
103
|
+
**4.22.12 · 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.
|
|
119
|
+
**4.22.12 개선 검증(2026-10-18)**: 4.22.11과 같은 채점기·코퍼스로 다시 잰 결과 파서 출력(opendataloader-bench 네 모드·PDF 글·표·별표·OCR·기타 포맷·왕복·생성)은 문서별로 4.22.11과 같고 조판 저장본 대조 지표도 그대로이며, 렌더(한컴 PDF 짝) 글 조각 위치(1.5pt 안) **85,837/90,418→85,968/90,428**, 그림 위치 **3,866→3,869/3,976**으로 개선했습니다. 글상자를 지금 크기(curSz)로 놓고, 제 표에 밀려 저장된 쪽 나누기 문단을 새 쪽에서 시작하고, 칸 너비 합이 표 너비와 같은 행이 없는 표의 열 경계를 가장 긴 길로 그리며, 쪽 좌표로 적힌 조판 캐시·글 영역 폭 없는 글상자·옛한글 자모 폭에서 글상자 글이 무너지던 것을 바로잡았습니다. [상세](docs/benchmarks.md)
|
|
120
120
|
|
|
121
121
|
빈 행을 접을 때 기존 논리 격자 안의 병합 모서리 셀을 보존합니다. 재현 PDF의 번호 기호 6종은 복원했으며, HTML 선 출력과 미등록 글꼴 기호는 [남은 한계](docs/parsing-loss-reproductions.md)로 기록했습니다.
|
|
122
122
|
|
|
123
|
-
외부 PDF 벤치 **opendataloader-bench 200문서**는 4.22.
|
|
123
|
+
외부 PDF 벤치 **opendataloader-bench 200문서**는 4.22.12 배포 후보의 동일 코퍼스 재검증에서 기본값 종합 **0.964**, OCR 끔 **0.939**입니다. [옵션별 결과와 재현 방법](docs/benchmarks.md#pdf--markdown--opendataloader-bench)
|
|
124
124
|
|
|
125
125
|
## 최근 업데이트
|
|
126
126
|
|
|
127
|
-
최신 배포: **[4.22.
|
|
127
|
+
최신 배포: **[4.22.12](https://github.com/chrisryugj/kordoc/releases/tag/v4.22.12)** · 2026-10-18
|
|
128
128
|
|
|
129
129
|
| 버전 | 주요 변경 |
|
|
130
130
|
| --- | --- |
|
|
131
|
+
| 4.22.12 | 글상자 렌더 보정 — 지금 크기(curSz)·쪽 좌표 캐시 재조판·글 영역 폭 없는 글상자·옛한글 자모 폭, 제 표에 밀린 쪽 나누기 문단, 같은 너비 행 없는 표의 가장 긴 길 열 경계(한컴 PDF 글 조각 위치 85,837 → 85,968, 그림 3,866 → 3,869) — 파서 출력·조판 지표는 4.22.11과 같음 |
|
|
132
|
+
| 4.22.11 | 렌더 보정 — 갈린 칸 안 표의 이어진 쪽 시작·갈린 행 마지막 조각의 개체 바닥·여러 행 칸 내용 높이·갈린 가운데 칸 마지막 조각 정렬(한컴 PDF 글 조각 위치 85,496 → 85,837), 빈 문단 그림이 쪽 아래로 밀리던 4.21.31 회귀 수정 — 파서 출력·조판은 4.22.10과 같음 |
|
|
131
133
|
| 4.22.10 | MCP `parse_document` OCR 모델 인수(#165), 렌더 표 보정 — 행마다 다른 칸 너비의 열 경계·병합 칸 행 성장·갈라 저장한 칸·쪽 바닥 첫 행·갈린 가운데 칸 다음 쪽 조각(한컴 PDF 글 조각 위치 84,468 → 85,496, 쪽 수 1,410 → 1,413) — 파서 출력·조판은 4.22.9와 같음 |
|
|
132
134
|
| 4.22.9 | 굴림체·돋움체 반각 기호 폭·글머리표 예약 폭 조판 보정(본문 첫 줄 위치 76,676 → 76,729, 표 칸 205,007 → 205,015), 렌더의 갈라 저장한 가운데 칸·행 단위 표 쪽 넘김·개체 뒤 자동 탭 보정(한컴 PDF 글 조각 위치 82,816 → 84,468) — 파서 출력은 4.22.8과 같음 |
|
|
133
135
|
| 4.22.8 | PDF 표 아래 캡션 순서·한 단 본문의 가짜 2단 기각·그림 영역 OCR 지도 표 오판 정리(ODL 기본값 0.96305 → 0.96367), 칸 높이 고정 표 나눔·Wingdings 기호 폭·표만 든 줄 높이 조판 보정 — 본문 첫 줄 위치 76,631 → 76,676, 표 칸 205,005 → 205,007 |
|
|
@@ -47,10 +47,10 @@ import {
|
|
|
47
47
|
unknownFontWarnings,
|
|
48
48
|
usesGaejosikMunche,
|
|
49
49
|
validateHwpx
|
|
50
|
-
} from "./chunk-
|
|
50
|
+
} from "./chunk-LYZGZMLW.js";
|
|
51
51
|
import {
|
|
52
52
|
blocksToChunks
|
|
53
|
-
} from "./chunk-
|
|
53
|
+
} from "./chunk-X4EYUXOV.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-
|
|
79
|
-
import "./chunk-
|
|
78
|
+
} from "./chunk-5YGTRWCN.js";
|
|
79
|
+
import "./chunk-RWHOVUUS.js";
|
|
80
80
|
import {
|
|
81
81
|
blocksToPages
|
|
82
|
-
} from "./chunk-
|
|
82
|
+
} from "./chunk-6DIUB4XS.js";
|
|
83
83
|
import "./chunk-VKVDMH7X.js";
|
|
84
84
|
import "./chunk-VQFA55IC.js";
|
|
85
85
|
import "./chunk-BYMPPVT3.js";
|
|
86
|
-
import "./chunk-
|
|
86
|
+
import "./chunk-TFYEKMLY.js";
|
|
87
87
|
import {
|
|
88
88
|
blocksToMarkdown,
|
|
89
89
|
flattenLayoutTables,
|
|
90
90
|
hasStructuredCellContent
|
|
91
|
-
} from "./chunk-
|
|
91
|
+
} from "./chunk-L3WMBMDN.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-
|
|
106
|
-
import "./chunk-
|
|
105
|
+
} from "./chunk-BU7SJLB4.js";
|
|
106
|
+
import "./chunk-52XK5GKO.js";
|
|
107
107
|
import {
|
|
108
108
|
VERSION
|
|
109
|
-
} from "./chunk-
|
|
109
|
+
} from "./chunk-D4QSFRKK.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=-
|
|
208
|
+
//# sourceMappingURL=-KQIWF7GR.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
escapeHtml,
|
|
3
3
|
sanitizeHref
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-HR5OB3PJ.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-
|
|
1542
|
+
//# sourceMappingURL=chunk-45GOHDHP.js.map
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import {
|
|
3
3
|
KordocError,
|
|
4
4
|
unzipLimitBytes
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-D4QSFRKK.js";
|
|
6
6
|
|
|
7
7
|
// src/hwpx/parser-shared.ts
|
|
8
8
|
import { DOMParser } from "@xmldom/xmldom";
|
|
@@ -494,4 +494,4 @@ export {
|
|
|
494
494
|
hwpFaceToCssStack,
|
|
495
495
|
parseRenderStyles
|
|
496
496
|
};
|
|
497
|
-
//# sourceMappingURL=chunk-
|
|
497
|
+
//# sourceMappingURL=chunk-52XK5GKO.js.map
|
|
@@ -4,15 +4,15 @@ import {
|
|
|
4
4
|
HEADING_RATIO_H2,
|
|
5
5
|
HEADING_RATIO_H3,
|
|
6
6
|
tidyScriptTags
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-45GOHDHP.js";
|
|
8
8
|
import {
|
|
9
9
|
ensureModelsIn,
|
|
10
10
|
getModelsDir
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-RDWNQARC.js";
|
|
12
12
|
import {
|
|
13
13
|
safeMax,
|
|
14
14
|
safeMin
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-HR5OB3PJ.js";
|
|
16
16
|
|
|
17
17
|
// src/ocr/models.ts
|
|
18
18
|
import { join } from "path";
|
|
@@ -9118,4 +9118,4 @@ export {
|
|
|
9118
9118
|
UNRULED_REGION_TABLES,
|
|
9119
9119
|
mergeOcrImageRegions
|
|
9120
9120
|
};
|
|
9121
|
-
//# sourceMappingURL=chunk-
|
|
9121
|
+
//# sourceMappingURL=chunk-5WOYDR7R.js.map
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import {
|
|
3
3
|
loadSharp,
|
|
4
4
|
rasterizePageSvg
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-RWHOVUUS.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-
|
|
19
|
+
} from "./chunk-TFYEKMLY.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-
|
|
35
|
+
} from "./chunk-L3WMBMDN.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-
|
|
49
|
+
} from "./chunk-52XK5GKO.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-
|
|
57
|
+
} from "./chunk-D4QSFRKK.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
|
|
11322
|
-
const
|
|
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({
|
|
@@ -11485,7 +11488,9 @@ function measureTableRowHeights(tbl, memo) {
|
|
|
11485
11488
|
const nRows = Math.max(...cells.map((c) => c.ra + c.rs));
|
|
11486
11489
|
const sp = num(tbl, "cellSpacing");
|
|
11487
11490
|
const rows = solveRowHeights(
|
|
11488
|
-
|
|
11491
|
+
// 여러 행 칸은 내용(+ 칸 여백)이 저장 높이보다 크면 내용 높이로 — 솔버가 모자란 만큼 그 칸 마지막 행을 키운다
|
|
11492
|
+
// (같은 판 PDF: 두 줄 든 2행 병합 칸 내용 2882 > 저장 2564 → 둘째 행이 318 자라고 첫 행은 그대로)
|
|
11493
|
+
cells.map((c) => ({ rowAddr: c.ra, rowSpan: c.rs, height: (c.rs > 1 ? Math.max(c.h, cellContentExtent(c, memo) + c.marginT + c.marginB) : c.h) - sp * (c.rs - 1), contentH: c.rs === 1 ? cellContentExtent(c, memo) + c.marginT + c.marginB : void 0 })),
|
|
11489
11494
|
nRows,
|
|
11490
11495
|
num(findChildByLocalName(tbl, "sz"), "height") - (sp > 0 ? sp * (nRows + 1) : 0) || Number.POSITIVE_INFINITY
|
|
11491
11496
|
);
|
|
@@ -11772,10 +11777,10 @@ function subFloatBottoms(sub) {
|
|
|
11772
11777
|
const rowInfo = split ? { rows: measureTableRowHeights(o), outT: num(om, "top"), outB: num(om, "bottom"), el: o } : {};
|
|
11773
11778
|
if (spacesHost(p)) {
|
|
11774
11779
|
const top0 = v0 - voS - carry;
|
|
11775
|
-
out.push({ v0: top0, bottom: v0, carry, hostEnd: top0, lineBottom: top0 + num(seg, "vertsize"), ...rowInfo });
|
|
11780
|
+
out.push({ v0: top0, bottom: v0, carry, hostEnd: top0, lineBottom: top0 + num(seg, "vertsize"), ...rowInfo, seg });
|
|
11776
11781
|
continue;
|
|
11777
11782
|
}
|
|
11778
|
-
out.push({ v0, bottom: v0 + voS + carry, carry, hostEnd, lineBottom: v0 + num(seg, "vertsize"), ...rowInfo });
|
|
11783
|
+
out.push({ v0, bottom: v0 + voS + carry, carry, hostEnd, lineBottom: v0 + num(seg, "vertsize"), ...rowInfo, seg });
|
|
11779
11784
|
}
|
|
11780
11785
|
}
|
|
11781
11786
|
}
|
|
@@ -11856,7 +11861,7 @@ function reflowSubListsIn(p, doc, styles, mode, counter, flow, noteW = counter.b
|
|
|
11856
11861
|
}
|
|
11857
11862
|
if (t === "drawText" || t === "caption") {
|
|
11858
11863
|
const sub = findChildByLocalName(ch, "subList"), tm = findChildByLocalName(ch, "textMargin");
|
|
11859
|
-
const textW = num(ch, "lastWidth") || (t === "caption" ? num(ch, "width") :
|
|
11864
|
+
const textW = num(ch, "lastWidth") || (t === "caption" ? num(ch, "width") : num(findChildByLocalName(el, "sz"), "width"));
|
|
11860
11865
|
const w = textW - num(tm, "left") - num(tm, "right");
|
|
11861
11866
|
if (sub && w > 0) flow(sub, doc, styles, w, mode, counter, 0);
|
|
11862
11867
|
continue;
|
|
@@ -12078,6 +12083,7 @@ var isJamoV = (cp) => cp >= 4448 && cp <= 4519 || cp >= 55216 && cp <= 55238;
|
|
|
12078
12083
|
var isJamoT = (cp) => cp >= 4520 && cp <= 4607 || cp >= 55243 && cp <= 55291;
|
|
12079
12084
|
var isJamoLV = (cp) => isJamoL(cp) || isJamoV(cp);
|
|
12080
12085
|
var isJamoVT = (cp) => isJamoV(cp) || isJamoT(cp);
|
|
12086
|
+
var joinsJamo = (prevCp, cp) => isJamoVT(cp) && isJamoLV(prevCp);
|
|
12081
12087
|
var isLatinCp = (cp) => cp < 592 || cp >= 7680 && cp < 8192 || cp >= 8216 && cp < 8224;
|
|
12082
12088
|
function hancomLangOf(cp) {
|
|
12083
12089
|
if (isLatinCp(cp)) return "latin";
|
|
@@ -12208,7 +12214,7 @@ function reflowPara(p, doc, styles, areaW, startV, mode, zones = [], nums = /* @
|
|
|
12208
12214
|
if (c.ch === "") continue;
|
|
12209
12215
|
const st = (c.prId != null ? styles.charPr.get(c.prId) : void 0) ?? DEFAULT_CHAR;
|
|
12210
12216
|
const cp = c.ch.codePointAt(0);
|
|
12211
|
-
const joins =
|
|
12217
|
+
const joins = joinsJamo(text.codePointAt(text.length - 1) ?? 0, cp);
|
|
12212
12218
|
const { w, sp } = joins ? { w: 0, sp: 0 } : glyphWidth(c.ch, st);
|
|
12213
12219
|
for (let u = 0; u < c.ch.length; u++) {
|
|
12214
12220
|
realIdx.push(i);
|
|
@@ -13246,7 +13252,7 @@ function cellLineBoxes(c) {
|
|
|
13246
13252
|
function cellLines(c) {
|
|
13247
13253
|
return cellLineBoxes(c).map((b) => [b.top, b.bottom]);
|
|
13248
13254
|
}
|
|
13249
|
-
function planTableRows(tbl, cells, rowH, ty, MT, BODY_H, slack = 0, floatSpan, nested = false) {
|
|
13255
|
+
function planTableRows(tbl, cells, rowH, ty, MT, BODY_H, slack = 0, floatSpan, nested = false, contMT = MT) {
|
|
13250
13256
|
if (nested) slack = 0;
|
|
13251
13257
|
const nRows = rowH.length;
|
|
13252
13258
|
const rowY = [0];
|
|
@@ -13267,7 +13273,7 @@ function planTableRows(tbl, cells, rowH, ty, MT, BODY_H, slack = 0, floatSpan, n
|
|
|
13267
13273
|
}
|
|
13268
13274
|
let hdrRows = 0;
|
|
13269
13275
|
if (tbl.getAttribute("repeatHeader") === "1") while (hdrRows < nRows && cells.some((c) => c.ra === hdrRows) && cells.filter((c) => c.ra === hdrRows).every((c) => c.el.getAttribute("header") === "1")) hdrRows++;
|
|
13270
|
-
const contTop =
|
|
13276
|
+
const contTop = contMT + num(findChildByLocalName(tbl, "outMargin"), "top") + rowY[hdrRows];
|
|
13271
13277
|
const outB = num(findChildByLocalName(tbl, "outMargin"), "bottom");
|
|
13272
13278
|
const cellSplit = tbl.getAttribute("pageBreak") === "CELL";
|
|
13273
13279
|
const out = [];
|
|
@@ -13318,7 +13324,7 @@ function planTableRows(tbl, cells, rowH, ty, MT, BODY_H, slack = 0, floatSpan, n
|
|
|
13318
13324
|
for (const c of rowCells) {
|
|
13319
13325
|
const b = (boxes.get(c.el) ?? []).find((x) => x.part === k);
|
|
13320
13326
|
if (!b) continue;
|
|
13321
|
-
const f = floatSpan(b.seg, y + c.marginT);
|
|
13327
|
+
const f = floatSpan(b.seg, y + c.marginT, contTop + c.marginT);
|
|
13322
13328
|
if (f?.el && f.pages > 0 && f.pages > lead && Math.abs(contTop + c.marginT + b.top - b.origin - f.endY) < 3e3) {
|
|
13323
13329
|
lead = f.pages;
|
|
13324
13330
|
place = /* @__PURE__ */ new Map([[f.el, y + c.marginT]]);
|
|
@@ -13339,12 +13345,16 @@ function planTableRows(tbl, cells, rowH, ty, MT, BODY_H, slack = 0, floatSpan, n
|
|
|
13339
13345
|
const from = inK[0]?.origin ?? next?.origin ?? Number.POSITIVE_INFINITY;
|
|
13340
13346
|
range.set(c.el, [from, next?.top ?? Number.POSITIVE_INFINITY]);
|
|
13341
13347
|
if (inK.length) ext = Math.max(ext, inK[inK.length - 1].bottom - from + c.marginT + c.marginB);
|
|
13348
|
+
if (k === hParts && inK.length && c.sub) for (const f of subFloatBottoms(c.sub)) {
|
|
13349
|
+
const b = bs.find((x) => x.seg === f.seg);
|
|
13350
|
+
if (b && b.part === k) ext = Math.max(ext, b.top + f.bottom - f.v0 - from + c.marginT + c.marginB);
|
|
13351
|
+
}
|
|
13342
13352
|
if (inK.length && next) toNext = Math.max(toNext, next.top - from + c.marginT + c.marginB);
|
|
13343
13353
|
}
|
|
13344
13354
|
const last = k === hParts;
|
|
13345
13355
|
const cellH = Math.max(0, ...rowCells.map((c) => num(findChildByLocalName(c.el, "cellSz"), "height")));
|
|
13346
13356
|
const firstH = Math.min(declared > 0 && ty + declared - y >= ext ? Math.min(pageBottom - y, ty + declared - y) : pageBottom - y, Math.max(ext, cellH));
|
|
13347
|
-
const share = last && k === 1 ? Math.max(0, ...rowCells.filter((c) => tbl.getAttribute("noAdjust") === "1" || /^(CENTER|BOTTOM)$/.test(c.sub?.getAttribute("vertAlign") ?? "")).map((c) => c.h - firstPh)) : 0;
|
|
13357
|
+
const share = last && k === 1 ? Math.max(0, ...rowCells.filter((c) => tbl.getAttribute("noAdjust") === "1" || /^(CENTER|BOTTOM)$/.test(c.sub?.getAttribute("vertAlign") ?? "")).map((c) => c.h - firstPh).filter((v) => v <= pageBottom - contTop)) : 0;
|
|
13348
13358
|
const ph = last ? Math.max(ext, share) : k === 0 ? firstH : toNext > 0 ? Math.min(pageBottom - contTop, toNext) : pageBottom - contTop;
|
|
13349
13359
|
if (k === 0) firstPh = ph;
|
|
13350
13360
|
pieces.push({ page, y, h: ph, range });
|
|
@@ -13354,7 +13364,7 @@ function planTableRows(tbl, cells, rowH, ty, MT, BODY_H, slack = 0, floatSpan, n
|
|
|
13354
13364
|
const bs = (boxes.get(c.el) ?? []).filter((b) => b.part === k), from = bs[0]?.origin ?? 0;
|
|
13355
13365
|
for (const b of bs) {
|
|
13356
13366
|
if (led.has(b.seg)) continue;
|
|
13357
|
-
const f = floatSpan(b.seg, y + c.marginT + b.top - from);
|
|
13367
|
+
const f = floatSpan(b.seg, y + c.marginT + b.top - from, contTop + c.marginT);
|
|
13358
13368
|
if (f && f.pages > span) {
|
|
13359
13369
|
span = f.pages;
|
|
13360
13370
|
spanEnd = f.endY;
|
|
@@ -13600,6 +13610,54 @@ function shapeGeometry(o, boxX, boxY, defs, images, warn, local = false) {
|
|
|
13600
13610
|
return { ...geometry, svg };
|
|
13601
13611
|
}
|
|
13602
13612
|
|
|
13613
|
+
// src/render/object-anchor.ts
|
|
13614
|
+
function linePushedBy(o, lineV, paraTop) {
|
|
13615
|
+
if (paraTop === void 0) return false;
|
|
13616
|
+
const om = findChildByLocalName(o.el, "outMargin");
|
|
13617
|
+
return Math.abs(lineV - (num(om, "top") + o.height + num(om, "bottom")) - paraTop) <= 10;
|
|
13618
|
+
}
|
|
13619
|
+
function anchorObject(o, ox, oy, baseV, areaW, ctx, anchorLineV, stayLine = false, paraStartV, laterLineH) {
|
|
13620
|
+
const { PW, PH, ML, MT, BODY_W, BODY_H } = ctx.geom;
|
|
13621
|
+
const pos = findChildByLocalName(o.el, "pos");
|
|
13622
|
+
const om = findChildByLocalName(o.el, "outMargin");
|
|
13623
|
+
const omT = num(om, "top"), omB = num(om, "bottom");
|
|
13624
|
+
const w = o.width, h = o.tag === "tbl" ? Math.max(o.height, measureTableHeight(o.el, ctx.extentMemo)) : o.height;
|
|
13625
|
+
if (!pos) return { x: ox, y: oy + baseV };
|
|
13626
|
+
const voRaw = num(pos, "vertOffset"), voS = voRaw >= 2 ** 31 ? voRaw - 2 ** 32 : voRaw;
|
|
13627
|
+
const vo = (pos.getAttribute("vertRelTo") ?? "PARA") === "PARA" ? Math.max(0, voS) : voS;
|
|
13628
|
+
const ho = num(pos, "horzOffset");
|
|
13629
|
+
const vrel = pos.getAttribute("vertRelTo") ?? "PARA";
|
|
13630
|
+
const hrel = pos.getAttribute("horzRelTo") ?? "PARA";
|
|
13631
|
+
const va = pos.getAttribute("vertAlign") ?? "TOP";
|
|
13632
|
+
const ha = pos.getAttribute("horzAlign") ?? "LEFT";
|
|
13633
|
+
const wrap = o.el.getAttribute("textWrap") ?? "TOP_AND_BOTTOM";
|
|
13634
|
+
let y;
|
|
13635
|
+
if (vrel === "PAPER") {
|
|
13636
|
+
y = va === "BOTTOM" ? PH - h - vo - omB : va === "CENTER" ? (PH - h) / 2 + vo : vo + omT;
|
|
13637
|
+
} else if (vrel === "PAGE") {
|
|
13638
|
+
y = va === "BOTTOM" ? MT + BODY_H - h - vo : va === "CENTER" ? MT + (BODY_H - h) / 2 + vo : MT + vo;
|
|
13639
|
+
} else if (wrap === "TOP_AND_BOTTOM") {
|
|
13640
|
+
const lineV = anchorLineV ?? baseV;
|
|
13641
|
+
const pushed = lineV - (omT + h + omB);
|
|
13642
|
+
const below = laterLineH !== void 0 && vo + omT >= laterLineH;
|
|
13643
|
+
const anchor = below ? lineV : stayLine !== false ? lineV - stayLine : pushed >= -100 ? pushed : paraStartV !== void 0 ? paraStartV : lineV;
|
|
13644
|
+
y = oy + anchor + omT + vo;
|
|
13645
|
+
} else {
|
|
13646
|
+
const origin = vrel === "PARA" && wrap === "SQUARE" ? paraStartV ?? baseV : baseV;
|
|
13647
|
+
y = oy + Math.max(origin + vo, wrap === "SQUARE" && anchorLineV !== void 0 ? anchorLineV : -Infinity) + omT;
|
|
13648
|
+
}
|
|
13649
|
+
let x;
|
|
13650
|
+
const omL = num(om, "left"), omR = num(om, "right");
|
|
13651
|
+
if (hrel === "PAGE") {
|
|
13652
|
+
x = ha === "RIGHT" ? ML + BODY_W - w - ho - omR : ha === "CENTER" ? ML + (BODY_W - w) / 2 + ho : ML + ho + omL;
|
|
13653
|
+
} else if (hrel === "PAPER") {
|
|
13654
|
+
x = (ha === "RIGHT" ? PW - w - ho - omR : ha === "CENTER" ? (PW - w) / 2 + ho : ho + omL) - (ctx.bodyDx?.(ctx.page) ?? 0);
|
|
13655
|
+
} else {
|
|
13656
|
+
x = ha === "RIGHT" ? ox + areaW - w - ho - omR : ha === "CENTER" ? ox + (areaW - w) / 2 + ho : ox + ho + omL;
|
|
13657
|
+
}
|
|
13658
|
+
return { x, y };
|
|
13659
|
+
}
|
|
13660
|
+
|
|
13603
13661
|
// src/render/equation-text.ts
|
|
13604
13662
|
var SYMBOLS = {
|
|
13605
13663
|
alpha: "\u03B1",
|
|
@@ -14336,49 +14394,6 @@ function hwpEquationToLatex(equation) {
|
|
|
14336
14394
|
return hmlToLatex(s).replace(/\s+/g, " ").trim();
|
|
14337
14395
|
}
|
|
14338
14396
|
|
|
14339
|
-
// src/render/object-anchor.ts
|
|
14340
|
-
function anchorObject(o, ox, oy, baseV, areaW, ctx, anchorLineV, stayLine = false, paraStartV, laterLineH) {
|
|
14341
|
-
const { PW, PH, ML, MT, BODY_W, BODY_H } = ctx.geom;
|
|
14342
|
-
const pos = findChildByLocalName(o.el, "pos");
|
|
14343
|
-
const om = findChildByLocalName(o.el, "outMargin");
|
|
14344
|
-
const omT = num(om, "top"), omB = num(om, "bottom");
|
|
14345
|
-
const w = o.width, h = o.tag === "tbl" ? Math.max(o.height, measureTableHeight(o.el, ctx.extentMemo)) : o.height;
|
|
14346
|
-
if (!pos) return { x: ox, y: oy + baseV };
|
|
14347
|
-
const voRaw = num(pos, "vertOffset"), voS = voRaw >= 2 ** 31 ? voRaw - 2 ** 32 : voRaw;
|
|
14348
|
-
const vo = (pos.getAttribute("vertRelTo") ?? "PARA") === "PARA" ? Math.max(0, voS) : voS;
|
|
14349
|
-
const ho = num(pos, "horzOffset");
|
|
14350
|
-
const vrel = pos.getAttribute("vertRelTo") ?? "PARA";
|
|
14351
|
-
const hrel = pos.getAttribute("horzRelTo") ?? "PARA";
|
|
14352
|
-
const va = pos.getAttribute("vertAlign") ?? "TOP";
|
|
14353
|
-
const ha = pos.getAttribute("horzAlign") ?? "LEFT";
|
|
14354
|
-
const wrap = o.el.getAttribute("textWrap") ?? "TOP_AND_BOTTOM";
|
|
14355
|
-
let y;
|
|
14356
|
-
if (vrel === "PAPER") {
|
|
14357
|
-
y = va === "BOTTOM" ? PH - h - vo - omB : va === "CENTER" ? (PH - h) / 2 + vo : vo + omT;
|
|
14358
|
-
} else if (vrel === "PAGE") {
|
|
14359
|
-
y = va === "BOTTOM" ? MT + BODY_H - h - vo : va === "CENTER" ? MT + (BODY_H - h) / 2 + vo : MT + vo;
|
|
14360
|
-
} else if (wrap === "TOP_AND_BOTTOM") {
|
|
14361
|
-
const lineV = anchorLineV ?? baseV;
|
|
14362
|
-
const pushed = lineV - (omT + h + omB);
|
|
14363
|
-
const below = laterLineH !== void 0 && vo + omT >= laterLineH;
|
|
14364
|
-
const anchor = below ? lineV : stayLine !== false ? lineV - stayLine : pushed >= -100 ? pushed : paraStartV !== void 0 ? paraStartV : lineV;
|
|
14365
|
-
y = oy + anchor + omT + vo;
|
|
14366
|
-
} else {
|
|
14367
|
-
const origin = vrel === "PARA" && wrap === "SQUARE" ? paraStartV ?? baseV : baseV;
|
|
14368
|
-
y = oy + Math.max(origin + vo, wrap === "SQUARE" && anchorLineV !== void 0 ? anchorLineV : -Infinity) + omT;
|
|
14369
|
-
}
|
|
14370
|
-
let x;
|
|
14371
|
-
const omL = num(om, "left"), omR = num(om, "right");
|
|
14372
|
-
if (hrel === "PAGE") {
|
|
14373
|
-
x = ha === "RIGHT" ? ML + BODY_W - w - ho - omR : ha === "CENTER" ? ML + (BODY_W - w) / 2 + ho : ML + ho + omL;
|
|
14374
|
-
} else if (hrel === "PAPER") {
|
|
14375
|
-
x = (ha === "RIGHT" ? PW - w - ho - omR : ha === "CENTER" ? (PW - w) / 2 + ho : ho + omL) - (ctx.bodyDx?.(ctx.page) ?? 0);
|
|
14376
|
-
} else {
|
|
14377
|
-
x = ha === "RIGHT" ? ox + areaW - w - ho - omR : ha === "CENTER" ? ox + (areaW - w) / 2 + ho : ox + ho + omL;
|
|
14378
|
-
}
|
|
14379
|
-
return { x, y };
|
|
14380
|
-
}
|
|
14381
|
-
|
|
14382
14397
|
// src/render/svg-content.ts
|
|
14383
14398
|
function escapeXml(s) {
|
|
14384
14399
|
return s.replace(/[\x00-\x08\x0B\x0C\x0E-\x1F]/g, "").replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """);
|
|
@@ -14408,16 +14423,20 @@ function warnOnce(ctx, key, msg) {
|
|
|
14408
14423
|
ctx.warned.add(key);
|
|
14409
14424
|
ctx.warnings.push(msg);
|
|
14410
14425
|
}
|
|
14411
|
-
function charW(c, styles) {
|
|
14426
|
+
function charW(c, styles, prev) {
|
|
14412
14427
|
const st = (c.prId != null ? styles.charPr.get(c.prId) : void 0) ?? DEFAULT_CHAR;
|
|
14413
14428
|
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) });
|
|
14414
|
-
let w = 0;
|
|
14415
|
-
for (const ch of c.ch)
|
|
14429
|
+
let w = 0, last = prev?.ch ? prev.ch.codePointAt(prev.ch.length - 1) ?? 0 : 0;
|
|
14430
|
+
for (const ch of c.ch) {
|
|
14431
|
+
const cp = ch.codePointAt(0);
|
|
14432
|
+
if (!joinsJamo(last, cp)) w += glyphWidth(ch, st).w;
|
|
14433
|
+
last = cp;
|
|
14434
|
+
}
|
|
14416
14435
|
return w;
|
|
14417
14436
|
}
|
|
14418
14437
|
function lineNaturalWidth(m, styles, start, end) {
|
|
14419
14438
|
let text = 0;
|
|
14420
|
-
for (let i = start; i < end && i < m.chars.length; i++) text += charW(m.chars[i], styles);
|
|
14439
|
+
for (let i = start; i < end && i < m.chars.length; i++) text += charW(m.chars[i], styles, m.chars[i - 1]);
|
|
14421
14440
|
let obj = 0;
|
|
14422
14441
|
for (const o of m.objs) if (o.inline && o.index >= start && o.index < end) obj += o.omL + o.width + o.omR;
|
|
14423
14442
|
return { text, obj };
|
|
@@ -14451,7 +14470,7 @@ function planLines(m, styles, numText = "") {
|
|
|
14451
14470
|
continue;
|
|
14452
14471
|
}
|
|
14453
14472
|
if (!c.tab) {
|
|
14454
|
-
x += charW(c, styles);
|
|
14473
|
+
x += charW(c, styles, m.chars[k - 1]);
|
|
14455
14474
|
continue;
|
|
14456
14475
|
}
|
|
14457
14476
|
const adv = tabAdvance(x, i === 0, geom, c.tabW);
|
|
@@ -14497,7 +14516,7 @@ function planLines(m, styles, numText = "") {
|
|
|
14497
14516
|
function advanceTo(m, styles, plan, upto) {
|
|
14498
14517
|
let x = 0;
|
|
14499
14518
|
for (let i = plan.start; i < upto && i < m.chars.length; i++) {
|
|
14500
|
-
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);
|
|
14519
|
+
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);
|
|
14501
14520
|
}
|
|
14502
14521
|
for (const o of m.objs) if (o.inline && o.index >= plan.start && o.index < upto) x += o.omL + o.width + o.omR;
|
|
14503
14522
|
return x;
|
|
@@ -14597,8 +14616,12 @@ function drawPara(p, ox, oy, areaW, ctx, depth, segPages) {
|
|
|
14597
14616
|
const fh = st.script ? Math.round(st.height * 16 / 25) : st.height;
|
|
14598
14617
|
const raise = st.script === "sup" ? Math.round(st.height * 0.44) : 0;
|
|
14599
14618
|
const measure = (text) => {
|
|
14600
|
-
let w = 0;
|
|
14601
|
-
for (const ch of text)
|
|
14619
|
+
let w = 0, last = 0;
|
|
14620
|
+
for (const ch of text) {
|
|
14621
|
+
const cp = ch.codePointAt(0);
|
|
14622
|
+
if (!joinsJamo(last, cp)) w += glyphWidth(ch, st).w;
|
|
14623
|
+
last = cp;
|
|
14624
|
+
}
|
|
14602
14625
|
return w;
|
|
14603
14626
|
};
|
|
14604
14627
|
const skipLead = Math.max(0, plan.spFrom - i);
|
|
@@ -14706,8 +14729,9 @@ function drawPara(p, ox, oy, areaW, ctx, depth, segPages) {
|
|
|
14706
14729
|
}
|
|
14707
14730
|
}
|
|
14708
14731
|
const tbFloats = m.objs.filter((q) => !q.inline && (q.el.getAttribute("textWrap") ?? "TOP_AND_BOTTOM") === "TOP_AND_BOTTOM" && (findChildByLocalName(q.el, "pos")?.getAttribute("vertRelTo") ?? "PARA") === "PARA").length;
|
|
14709
|
-
|
|
14732
|
+
let stay = tbFloats < 2 && !m.objs.some((q) => q.inline) && !m.chars.some((c) => c.ch !== "" && !c.nb && c.ch.trim() !== "");
|
|
14710
14733
|
const sbA = m.paraPrId != null ? ctx.styles.paraGeom.get(m.paraPrId)?.spaceBefore ?? 0 : 0;
|
|
14734
|
+
if (stay && wrapA === "TOP_AND_BOTTOM" && linePushedBy(o, anchorLineV ?? baseV, pTop)) stay = false;
|
|
14711
14735
|
const firstLine = anchorLineV === void 0 || anchorLineV === baseV;
|
|
14712
14736
|
let { x, y } = anchorObject(o, ax, oy, objBaseV, aw, ctx, anchorLineV, stay ? sbA : false, (firstLine || wrapA === "SQUARE") && pTop !== void 0 && pTop < baseV ? pTop : void 0, firstLine ? void 0 : anchorLineH);
|
|
14713
14737
|
if (depth === 0 && tbFloats >= 2 && wrapA === "TOP_AND_BOTTOM") {
|
|
@@ -14883,13 +14907,13 @@ function edgeLine(x1, y1, x2, y2, e) {
|
|
|
14883
14907
|
const dash = /DASH|DOT/.test(e.type) ? ` stroke-dasharray="${e.type.includes("DOT") ? "1,1.5" : "3,1.5"}"` : "";
|
|
14884
14908
|
return `<line x1="${pt2(x1)}" y1="${pt2(y1)}" x2="${pt2(x2)}" y2="${pt2(y2)}" stroke="${escapeXml(e.color)}" stroke-width="${e.widthPt.toFixed(2)}"${dash}/>`;
|
|
14885
14909
|
}
|
|
14886
|
-
function tableContPages(tbl, ty, MT, BODY_H, memo, slack = 0, floatSpan, nested = false) {
|
|
14887
|
-
const pcs = planTableRows(tbl, collectCells(tbl), measureTableRowHeights(tbl, memo), ty, MT, BODY_H, slack, floatSpan, nested).flat();
|
|
14910
|
+
function tableContPages(tbl, ty, MT, BODY_H, memo, slack = 0, floatSpan, nested = false, contMT = MT) {
|
|
14911
|
+
const pcs = planTableRows(tbl, collectCells(tbl), measureTableRowHeights(tbl, memo), ty, MT, BODY_H, slack, floatSpan, nested, contMT).flat();
|
|
14888
14912
|
const last = pcs.reduce((a, b) => b.page > a.page || b.page === a.page && b.y + b.h > a.y + a.h ? b : a, pcs[0] ?? { page: 0, y: ty, h: 0 });
|
|
14889
14913
|
return { pages: last.page, endY: last.y + last.h };
|
|
14890
14914
|
}
|
|
14891
14915
|
function cellFloatSpan(MT, BODY_H, memo, slack) {
|
|
14892
|
-
return (seg, top) => {
|
|
14916
|
+
return (seg, top, contMT) => {
|
|
14893
14917
|
const lsa = seg.parentNode, p = lsa?.parentNode;
|
|
14894
14918
|
if (!p || ln(p) !== "p") return void 0;
|
|
14895
14919
|
const segs = elements(lsa).filter((e) => ln(e) === "lineseg"), k = segs.indexOf(seg);
|
|
@@ -14902,7 +14926,7 @@ function cellFloatSpan(MT, BODY_H, memo, slack) {
|
|
|
14902
14926
|
const segK = Math.max(0, m.segs.findIndex((sg, i) => sg.textpos <= o.index && (i === m.segs.length - 1 || m.segs[i + 1].textpos > o.index)));
|
|
14903
14927
|
if (segK !== k) continue;
|
|
14904
14928
|
const ty = top + num(findChildByLocalName(o.el, "outMargin"), "top") + Math.max(0, toInt32(pos?.getAttribute("vertOffset") ?? void 0, 0));
|
|
14905
|
-
const span = tableContPages(o.el, ty, MT, BODY_H, memo, slack, cellFloatSpan(MT, BODY_H, memo, slack), true);
|
|
14929
|
+
const span = tableContPages(o.el, ty, MT, BODY_H, memo, slack, cellFloatSpan(MT, BODY_H, memo, slack), true, contMT);
|
|
14906
14930
|
if (span.pages > 0 && (!best || span.pages > best.pages)) best = { ...span, el: o.el };
|
|
14907
14931
|
}
|
|
14908
14932
|
return best;
|
|
@@ -14920,7 +14944,16 @@ function drawTable(tbl, tx, ty, ctx, depth) {
|
|
|
14920
14944
|
const nCols = Math.max(...cells.map((c) => c.ca + c.cs));
|
|
14921
14945
|
const nRows = Math.max(...cells.map((c) => c.ra + c.rs));
|
|
14922
14946
|
const colCons = cells.map((c) => ({ a: c.ca, b: c.ca + c.cs, size: c.w }));
|
|
14923
|
-
const
|
|
14947
|
+
const tblW = num(tblSz, "width");
|
|
14948
|
+
const rowSum = /* @__PURE__ */ new Map();
|
|
14949
|
+
for (const c of cells) {
|
|
14950
|
+
const r = rowSum.get(c.ra) ?? { cover: 0, w: 0 };
|
|
14951
|
+
r.cover += c.cs;
|
|
14952
|
+
r.w += c.w;
|
|
14953
|
+
rowSum.set(c.ra, r);
|
|
14954
|
+
}
|
|
14955
|
+
const noExactRow = ![...rowSum.values()].some((r) => r.cover === nCols && Math.abs(r.w - tblW) <= 2);
|
|
14956
|
+
const colX = tableColumnBoundaries(colCons, nCols, tblW || void 0, noExactRow);
|
|
14924
14957
|
const rowH = measureTableRowHeights(tbl, ctx.extentMemo);
|
|
14925
14958
|
const rowY = [0];
|
|
14926
14959
|
for (let r = 0; r < nRows; r++) rowY.push(rowY[r] + rowH[r]);
|
|
@@ -14934,7 +14967,7 @@ function drawTable(tbl, tx, ty, ctx, depth) {
|
|
|
14934
14967
|
if (tbl.getAttribute("repeatHeader") === "1") while (hdrRows < nRows && cells.some((c) => c.ra === hdrRows) && cells.filter((c) => c.ra === hdrRows).every((c) => c.el.getAttribute("header") === "1")) hdrRows++;
|
|
14935
14968
|
const slack = ctx.geom.PH - ctx.geom.MT - ctx.geom.BODY_H;
|
|
14936
14969
|
const splitHere = depth === 1 || !!ctx.splitCell && findChildByLocalName(tbl, "pos")?.getAttribute("treatAsChar") !== "1";
|
|
14937
|
-
const plan = splitHere ? planTableRows(tbl, cells, rowH, ty, ctx.geom.MT, ctx.geom.BODY_H, slack, cellFloatSpan(ctx.geom.MT, ctx.geom.BODY_H, ctx.extentMemo, slack), depth !== 1) : rowH.map((h, r) => [{ page: 0, y: ty + rowY[r], h }]);
|
|
14970
|
+
const plan = splitHere ? planTableRows(tbl, cells, rowH, ty, ctx.geom.MT, ctx.geom.BODY_H, slack, cellFloatSpan(ctx.geom.MT, ctx.geom.BODY_H, ctx.extentMemo, slack), depth !== 1, depth !== 1 && ctx.splitContMT !== void 0 ? ctx.splitContMT : ctx.geom.MT) : rowH.map((h, r) => [{ page: 0, y: ty + rowY[r], h }]);
|
|
14938
14971
|
const splitSaved = ctx.splitCell;
|
|
14939
14972
|
ctx.splitCell = false;
|
|
14940
14973
|
for (const pc of plan.flat()) for (const [el, py] of pc.place ?? []) (ctx.objPlace ??= /* @__PURE__ */ new Map()).set(el, { page: startPage + pc.page, y: py });
|
|
@@ -14970,10 +15003,15 @@ function drawTable(tbl, tx, ty, ctx, depth) {
|
|
|
14970
15003
|
return !!r && v >= r[0] && v < r[1];
|
|
14971
15004
|
}));
|
|
14972
15005
|
const va2 = c.sub.getAttribute("vertAlign") ?? "TOP";
|
|
15006
|
+
const lastK = g.pieces.length - 1;
|
|
14973
15007
|
const pieceOff = g.pieces.map((pc, k) => {
|
|
14974
|
-
if (va2 === "TOP" || k > 0) return 0;
|
|
15008
|
+
if (va2 === "TOP" || k > 0 && k < lastK) return 0;
|
|
14975
15009
|
const from = pc.range?.get(c.el)?.[0] ?? 0;
|
|
14976
15010
|
const bottoms = boxes.filter((b) => pieceOf(b.top) === k).map((b) => b.bottom - from);
|
|
15011
|
+
if (k > 0) for (const f of subFloatBottoms(c.sub)) {
|
|
15012
|
+
const b = boxes.find((x) => x.seg === f.seg);
|
|
15013
|
+
if (b && pieceOf(b.top) === k) bottoms.push(b.top + f.bottom - f.v0 - from);
|
|
15014
|
+
}
|
|
14977
15015
|
if (!bottoms.length) return 0;
|
|
14978
15016
|
const free = pc.h - c.marginT - c.marginB - Math.max(...bottoms);
|
|
14979
15017
|
return Math.max(0, va2 === "CENTER" ? free / 2 : free);
|
|
@@ -14990,7 +15028,10 @@ function drawTable(tbl, tx, ty, ctx, depth) {
|
|
|
14990
15028
|
return startPage + pc.page;
|
|
14991
15029
|
});
|
|
14992
15030
|
ctx.splitCell = splitHere;
|
|
15031
|
+
const contMTSaved = ctx.splitContMT;
|
|
15032
|
+
ctx.splitContMT = ctx.geom.MT + num(findChildByLocalName(tbl, "outMargin"), "top") + rowY[hdrRows] + c.marginT;
|
|
14993
15033
|
drawPara(p, g.x + c.marginL, base, g.w - c.marginL - c.marginR, ctx, depth + 1, pages);
|
|
15034
|
+
ctx.splitContMT = contMTSaved;
|
|
14994
15035
|
ctx.splitCell = false;
|
|
14995
15036
|
segs.forEach((sg, i) => sg.setAttribute("vertpos", saved[i] ?? "0"));
|
|
14996
15037
|
}
|
|
@@ -15158,6 +15199,20 @@ function staleTopCache(root, BODY_H) {
|
|
|
15158
15199
|
}
|
|
15159
15200
|
return false;
|
|
15160
15201
|
}
|
|
15202
|
+
function absoluteTopCache(root, ML, BODY_W) {
|
|
15203
|
+
let tot = 0, over = 0;
|
|
15204
|
+
for (const p of elements(root)) {
|
|
15205
|
+
if (ln(p) !== "p") continue;
|
|
15206
|
+
const lsa = findChildByLocalName(p, "linesegarray");
|
|
15207
|
+
for (const sg of lsa ? elements(lsa) : []) {
|
|
15208
|
+
if (ln(sg) !== "lineseg" || num(sg, "horzsize") <= 0) continue;
|
|
15209
|
+
tot++;
|
|
15210
|
+
const hp = num(sg, "horzpos");
|
|
15211
|
+
if (hp >= ML - 500 && hp + num(sg, "horzsize") > BODY_W + 500) over++;
|
|
15212
|
+
}
|
|
15213
|
+
}
|
|
15214
|
+
return over >= 3 && over * 5 >= tot;
|
|
15215
|
+
}
|
|
15161
15216
|
function renderSectionToPages(root, geom, ctxBase, doReflow, reflowMode, masters = [], hasDeletionMarkers = true, lastSection = true) {
|
|
15162
15217
|
const { PW, PH, ML, MT, BODY_W, BODY_H } = geom;
|
|
15163
15218
|
if (hasDeletionMarkers) prepareDeletedRanges(root);
|
|
@@ -15169,8 +15224,13 @@ function renderSectionToPages(root, geom, ctxBase, doReflow, reflowMode, masters
|
|
|
15169
15224
|
}
|
|
15170
15225
|
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");
|
|
15171
15226
|
}
|
|
15172
|
-
const
|
|
15173
|
-
if (
|
|
15227
|
+
const absolute = !degenerate && absoluteTopCache(root, ML, BODY_W);
|
|
15228
|
+
if (absolute) {
|
|
15229
|
+
for (const lsa of Array.from(root.getElementsByTagName("*")).filter((e) => ln(e) === "linesegarray")) lsa.parentNode?.removeChild(lsa);
|
|
15230
|
+
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");
|
|
15231
|
+
}
|
|
15232
|
+
const mixed = !doReflow && !degenerate && !absolute && Array.from(root.getElementsByTagName("*")).some((p) => ln(p) === "p" && !findChildByLocalName(p, "linesegarray"));
|
|
15233
|
+
if (doReflow || degenerate || absolute || mixed) reflowSection(root, ctxBase.styles, { BODY_W, BODY_H }, reflowMode);
|
|
15174
15234
|
const colPr = findFirst(root, "colPr");
|
|
15175
15235
|
const multiCol = num(colPr, "colCount", 1) > 1;
|
|
15176
15236
|
const nCol = multiCol ? num(colPr, "colCount", 1) : 1, colGap = multiCol ? num(colPr, "sameGap", 0) : 0;
|
|
@@ -15225,7 +15285,7 @@ function renderSectionToPages(root, geom, ctxBase, doReflow, reflowMode, masters
|
|
|
15225
15285
|
pendingEnd = 0;
|
|
15226
15286
|
} else {
|
|
15227
15287
|
const brk = v < prevV ? !multiCol || h <= prevH : v === prevV && h <= prevH && prevEnd > v && v < BODY_H / 2;
|
|
15228
|
-
const pbrk = !brk && paraFirst && prevV !== Number.NEGATIVE_INFINITY && p.getAttribute("pageBreak") === "1" && v < BODY_H / 2;
|
|
15288
|
+
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)));
|
|
15229
15289
|
const obrk = !brk && !pbrk && !multiCol && paraFirst && v > prevV && v < prevEnd - 100 && prevEnd + num(s, "vertsize") > BODY_H && v < BODY_H / 2;
|
|
15230
15290
|
if (brk || pbrk || obrk) cur++;
|
|
15231
15291
|
if (brk && prevSeg && prevV + prevSeg.vs > BODY_H && v === prevSeg.vs + prevSeg.sp && prevSeg.pages[prevSeg.idx] === cur - 1) {
|
|
@@ -15265,9 +15325,9 @@ function renderSectionToPages(root, geom, ctxBase, doReflow, reflowMode, masters
|
|
|
15265
15325
|
const h = Math.max(o.height, measureTableHeight(o.el, ctxBase.extentMemo)), omT = num(om, "top"), omB = num(om, "bottom");
|
|
15266
15326
|
const pushed = segV - (omT + h + omB);
|
|
15267
15327
|
const nTb = m0.objs.filter((q) => !q.inline && (q.el.getAttribute("textWrap") ?? "TOP_AND_BOTTOM") === "TOP_AND_BOTTOM").length;
|
|
15268
|
-
const stay = nTb < 2 && !m0.objs.some((q) => q.inline) && !m0.chars.some((c) => c.ch !== "" && !c.nb && c.ch.trim() !== "");
|
|
15269
15328
|
const wrapP = o.el.getAttribute("textWrap") ?? "TOP_AND_BOTTOM";
|
|
15270
15329
|
const pTop = paraTops.get(p), sbP = m0.paraPrId != null ? geom0.get(m0.paraPrId)?.spaceBefore ?? 0 : 0;
|
|
15330
|
+
const stay = nTb < 2 && !m0.objs.some((q) => q.inline) && !m0.chars.some((c) => c.ch !== "" && !c.nb && c.ch.trim() !== "") && !(!o.inline && wrapP === "TOP_AND_BOTTOM" && linePushedBy(o, segV, pTop));
|
|
15271
15331
|
const nonPush = wrapP !== "TOP_AND_BOTTOM" && pTop !== void 0 && segV > pTop + sbP + 100 ? pTop + sbP : void 0;
|
|
15272
15332
|
const voP = Math.max(0, toInt32(pos?.getAttribute("vertOffset") ?? void 0, 0));
|
|
15273
15333
|
const paraStart = segK === 0 && pTop !== void 0 && pTop < segV ? pTop : segV;
|
|
@@ -19799,4 +19859,4 @@ export {
|
|
|
19799
19859
|
cropRect,
|
|
19800
19860
|
extractRenderedRegions
|
|
19801
19861
|
};
|
|
19802
|
-
//# sourceMappingURL=chunk-
|
|
19862
|
+
//# sourceMappingURL=chunk-5YGTRWCN.js.map
|