kordoc 4.22.7 → 4.22.9
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 +7 -5
- package/dist/{-O7EP5UQ2.js → -KJW567ZH.js} +11 -11
- package/dist/{chunk-CRMEBMMW.js → chunk-3MTKUEA7.js} +4 -4
- package/dist/{chunk-DLAPQKGK.js → chunk-55XTFFLH.js} +11 -4
- package/dist/chunk-55XTFFLH.js.map +1 -0
- package/dist/{chunk-DXJRDFCT.js → chunk-6LM4CAOF.js} +2 -2
- package/dist/chunk-6LM4CAOF.js.map +1 -0
- package/dist/{chunk-BHSATDA7.js → chunk-7PBVL7NL.js} +2 -2
- package/dist/{chunk-CVKSBUIO.js → chunk-7RVYIPLH.js} +2 -2
- package/dist/{chunk-PILIRK7O.js → chunk-AX3XT5Y7.js} +10 -3
- package/dist/chunk-AX3XT5Y7.js.map +1 -0
- package/dist/{chunk-DFBGN2TG.js → chunk-AZUWSGMI.js} +2 -2
- package/dist/{chunk-R3T4RTQL.cjs → chunk-BTLQOIES.cjs} +30 -23
- package/dist/chunk-BTLQOIES.cjs.map +1 -0
- package/dist/{chunk-BIF35Q4D.js → chunk-CKWCSQGW.js} +11 -11
- package/dist/{chunk-ZNSWN4JM.js → chunk-D44JWJPI.js} +2 -2
- package/dist/{chunk-CEOOL37E.js → chunk-DF6NB52F.js} +4 -4
- package/dist/{chunk-FJ45NNLA.cjs → chunk-EREKI4DD.cjs} +2 -2
- package/dist/{chunk-FJ45NNLA.cjs.map → chunk-EREKI4DD.cjs.map} +1 -1
- package/dist/{chunk-V2SJJHJH.js → chunk-F6C4UO55.js} +5 -3
- package/dist/{chunk-V2SJJHJH.js.map → chunk-F6C4UO55.js.map} +1 -1
- package/dist/{chunk-BFAYABLC.js → chunk-MLTGRR6C.js} +5 -3
- package/dist/{chunk-BFAYABLC.js.map → chunk-MLTGRR6C.js.map} +1 -1
- package/dist/{chunk-D4YBFNWK.js → chunk-NT54LN6C.js} +123 -15
- package/dist/chunk-NT54LN6C.js.map +1 -0
- package/dist/{chunk-QYFBXJGK.js → chunk-OREE2GWG.js} +2 -2
- package/dist/{chunk-CIDWITQN.cjs → chunk-Q3GZMZTK.cjs} +24 -24
- package/dist/{chunk-CIDWITQN.cjs.map → chunk-Q3GZMZTK.cjs.map} +1 -1
- package/dist/{chunk-VYH2ATWU.js → chunk-R5TMMRVG.js} +2 -2
- package/dist/{chunk-S34OVRKD.cjs → chunk-SO4ZYWYE.cjs} +9 -7
- package/dist/chunk-SO4ZYWYE.cjs.map +1 -0
- package/dist/{chunk-F537QK7M.cjs → chunk-SU6ABNIX.cjs} +3 -3
- package/dist/{chunk-F537QK7M.cjs.map → chunk-SU6ABNIX.cjs.map} +1 -1
- package/dist/{chunk-WBR62IXV.js → chunk-UNFXTOU3.js} +3 -3
- package/dist/{chunk-ZW3RY4YT.js → chunk-UPZISYRP.js} +2 -2
- package/dist/{chunk-5S4UCIGP.js → chunk-VH2QBIUA.js} +2 -2
- package/dist/{chunk-6U2O5LAV.js → chunk-VQ5DOQZO.js} +3 -3
- package/dist/{chunk-TN4SSNES.cjs → chunk-VSH7EV3W.cjs} +3 -3
- package/dist/{chunk-TN4SSNES.cjs.map → chunk-VSH7EV3W.cjs.map} +1 -1
- package/dist/{chunk-OTCH63U3.js → chunk-XSRXVLOL.js} +2 -2
- package/dist/{chunk-RHHRVPLL.js → chunk-Z4SUS7JW.js} +2 -2
- package/dist/{chunk-YVRARYLN.js → chunk-ZBUOPXGD.js} +2 -2
- package/dist/{chunk-5VCZDP2K.js → chunk-ZP6SRHAD.js} +2 -2
- package/dist/chunks-YCPWFWFT.js +10 -0
- package/dist/cli.js +30 -30
- package/dist/{formula-EQ2KQA5T.js → formula-47QIFQ7V.js} +4 -4
- package/dist/{formula-RH55FUJF.js → formula-GZEMCXLD.js} +3 -3
- package/dist/{formula-3M6U2J7S.cjs → formula-JCG77RAE.cjs} +9 -9
- package/dist/{formula-3M6U2J7S.cjs.map → formula-JCG77RAE.cjs.map} +1 -1
- package/dist/{image-ocr-KIKAO43E.js → image-ocr-FAHJNFDG.js} +9 -9
- package/dist/{image-ocr-LO2GZKA5.js → image-ocr-HEKAORHV.js} +6 -6
- package/dist/{image-ocr-DP4YTLGN.cjs → image-ocr-RTS5BZRM.cjs} +17 -17
- package/dist/{image-ocr-DP4YTLGN.cjs.map → image-ocr-RTS5BZRM.cjs.map} +1 -1
- package/dist/index.cjs +543 -435
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +123 -15
- package/dist/index.js.map +1 -1
- package/dist/mcp.js +22 -22
- package/dist/{model-bundle-EAQ6LWS5.js → model-bundle-IN3RQ52S.js} +5 -5
- package/dist/{models-ZN6JAI4Q.js → models-FHSKU7WB.js} +5 -5
- package/dist/{parse-worker-v2-UKFFINUH.js → parse-worker-v2-I3A77UZB.js} +12 -12
- package/dist/{parser-CGKXEB3U.cjs → parser-A4SIJK2I.cjs} +157 -157
- package/dist/{parser-CGKXEB3U.cjs.map → parser-A4SIJK2I.cjs.map} +1 -1
- package/dist/{parser-DFV3VDWX.js → parser-JDLV2EI4.js} +12 -12
- package/dist/{parser-TJFS44BI.js → parser-ZLZRQLZU.js} +9 -9
- package/dist/pdf-ocr-MKSW5GJ7.cjs +31 -0
- package/dist/{pdf-ocr-U5MFMNCW.cjs.map → pdf-ocr-MKSW5GJ7.cjs.map} +1 -1
- package/dist/{pdf-ocr-CATVQJ2I.js → pdf-ocr-SJKJ7JT7.js} +6 -6
- package/dist/{pdf-ocr-EQXJAKHB.js → pdf-ocr-VIEII6TD.js} +9 -9
- package/dist/{profile-io-5IG6SSMK.js → profile-io-ZPCTNRBM.js} +3 -3
- package/dist/{rasterize-W4TJFQBT.js → rasterize-QT7IPC27.js} +3 -3
- package/dist/{redact-doc-LZ3PY2LX.js → redact-doc-64PLXN3U.js} +11 -11
- package/dist/{render-N2QA335I.js → render-43RSFAGY.js} +7 -7
- package/dist/seal-RQZTBH54.js +10 -0
- package/dist/{setup-5Y2UAWZG.js → setup-46VYX5XM.js} +3 -3
- package/dist/visual-JFUP46UP.js +21 -0
- package/dist/{watch-2MLCRQZQ.js → watch-ZBBQKEKD.js} +12 -12
- package/package.json +1 -1
- package/dist/chunk-D4YBFNWK.js.map +0 -1
- package/dist/chunk-DLAPQKGK.js.map +0 -1
- package/dist/chunk-DXJRDFCT.js.map +0 -1
- package/dist/chunk-PILIRK7O.js.map +0 -1
- package/dist/chunk-R3T4RTQL.cjs.map +0 -1
- package/dist/chunk-S34OVRKD.cjs.map +0 -1
- package/dist/chunks-MPPNEL5A.js +0 -10
- package/dist/pdf-ocr-U5MFMNCW.cjs +0 -31
- package/dist/seal-FYJZMW4G.js +0 -10
- package/dist/visual-VQGE67RU.js +0 -21
- /package/dist/{-O7EP5UQ2.js.map → -KJW567ZH.js.map} +0 -0
- /package/dist/{chunk-CRMEBMMW.js.map → chunk-3MTKUEA7.js.map} +0 -0
- /package/dist/{chunk-BHSATDA7.js.map → chunk-7PBVL7NL.js.map} +0 -0
- /package/dist/{chunk-CVKSBUIO.js.map → chunk-7RVYIPLH.js.map} +0 -0
- /package/dist/{chunk-DFBGN2TG.js.map → chunk-AZUWSGMI.js.map} +0 -0
- /package/dist/{chunk-BIF35Q4D.js.map → chunk-CKWCSQGW.js.map} +0 -0
- /package/dist/{chunk-ZNSWN4JM.js.map → chunk-D44JWJPI.js.map} +0 -0
- /package/dist/{chunk-CEOOL37E.js.map → chunk-DF6NB52F.js.map} +0 -0
- /package/dist/{chunk-QYFBXJGK.js.map → chunk-OREE2GWG.js.map} +0 -0
- /package/dist/{chunk-VYH2ATWU.js.map → chunk-R5TMMRVG.js.map} +0 -0
- /package/dist/{chunk-WBR62IXV.js.map → chunk-UNFXTOU3.js.map} +0 -0
- /package/dist/{chunk-ZW3RY4YT.js.map → chunk-UPZISYRP.js.map} +0 -0
- /package/dist/{chunk-5S4UCIGP.js.map → chunk-VH2QBIUA.js.map} +0 -0
- /package/dist/{chunk-6U2O5LAV.js.map → chunk-VQ5DOQZO.js.map} +0 -0
- /package/dist/{chunk-OTCH63U3.js.map → chunk-XSRXVLOL.js.map} +0 -0
- /package/dist/{chunk-RHHRVPLL.js.map → chunk-Z4SUS7JW.js.map} +0 -0
- /package/dist/{chunk-YVRARYLN.js.map → chunk-ZBUOPXGD.js.map} +0 -0
- /package/dist/{chunk-5VCZDP2K.js.map → chunk-ZP6SRHAD.js.map} +0 -0
- /package/dist/{chunks-MPPNEL5A.js.map → chunks-YCPWFWFT.js.map} +0 -0
- /package/dist/{formula-EQ2KQA5T.js.map → formula-47QIFQ7V.js.map} +0 -0
- /package/dist/{formula-RH55FUJF.js.map → formula-GZEMCXLD.js.map} +0 -0
- /package/dist/{image-ocr-KIKAO43E.js.map → image-ocr-FAHJNFDG.js.map} +0 -0
- /package/dist/{image-ocr-LO2GZKA5.js.map → image-ocr-HEKAORHV.js.map} +0 -0
- /package/dist/{model-bundle-EAQ6LWS5.js.map → model-bundle-IN3RQ52S.js.map} +0 -0
- /package/dist/{models-ZN6JAI4Q.js.map → models-FHSKU7WB.js.map} +0 -0
- /package/dist/{parse-worker-v2-UKFFINUH.js.map → parse-worker-v2-I3A77UZB.js.map} +0 -0
- /package/dist/{parser-DFV3VDWX.js.map → parser-JDLV2EI4.js.map} +0 -0
- /package/dist/{parser-TJFS44BI.js.map → parser-ZLZRQLZU.js.map} +0 -0
- /package/dist/{pdf-ocr-CATVQJ2I.js.map → pdf-ocr-SJKJ7JT7.js.map} +0 -0
- /package/dist/{pdf-ocr-EQXJAKHB.js.map → pdf-ocr-VIEII6TD.js.map} +0 -0
- /package/dist/{profile-io-5IG6SSMK.js.map → profile-io-ZPCTNRBM.js.map} +0 -0
- /package/dist/{rasterize-W4TJFQBT.js.map → rasterize-QT7IPC27.js.map} +0 -0
- /package/dist/{redact-doc-LZ3PY2LX.js.map → redact-doc-64PLXN3U.js.map} +0 -0
- /package/dist/{render-N2QA335I.js.map → render-43RSFAGY.js.map} +0 -0
- /package/dist/{seal-FYJZMW4G.js.map → seal-RQZTBH54.js.map} +0 -0
- /package/dist/{setup-5Y2UAWZG.js.map → setup-46VYX5XM.js.map} +0 -0
- /package/dist/{visual-VQGE67RU.js.map → visual-JFUP46UP.js.map} +0 -0
- /package/dist/{watch-2MLCRQZQ.js.map → watch-ZBBQKEKD.js.map} +0 -0
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
// src/utils.ts
|
|
4
4
|
import { format } from "util";
|
|
5
|
-
var VERSION = true ? "4.22.
|
|
5
|
+
var VERSION = true ? "4.22.9" : "0.0.0-dev";
|
|
6
6
|
function toArrayBuffer(buf) {
|
|
7
7
|
if (buf.byteOffset === 0 && buf.byteLength === buf.buffer.byteLength) {
|
|
8
8
|
return buf.buffer;
|
|
@@ -172,4 +172,4 @@ export {
|
|
|
172
172
|
classifyError,
|
|
173
173
|
partExtension
|
|
174
174
|
};
|
|
175
|
-
//# sourceMappingURL=chunk-
|
|
175
|
+
//# sourceMappingURL=chunk-AZUWSGMI.js.map
|
|
@@ -4,15 +4,15 @@
|
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
|
|
7
|
-
var
|
|
7
|
+
var _chunkSO4ZYWYEcjs = require('./chunk-SO4ZYWYE.cjs');
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
|
|
11
|
-
var
|
|
11
|
+
var _chunkSU6ABNIXcjs = require('./chunk-SU6ABNIX.cjs');
|
|
12
12
|
|
|
13
13
|
|
|
14
14
|
|
|
15
|
-
var
|
|
15
|
+
var _chunkEREKI4DDcjs = require('./chunk-EREKI4DD.cjs');
|
|
16
16
|
|
|
17
17
|
// src/ocr/models.ts
|
|
18
18
|
var _path = require('path');
|
|
@@ -56,7 +56,7 @@ var OCR_REC_DICT = {
|
|
|
56
56
|
sizeMb: 1
|
|
57
57
|
};
|
|
58
58
|
function getOcrModelsDir() {
|
|
59
|
-
return
|
|
59
|
+
return _chunkSU6ABNIXcjs.getModelsDir.call(void 0, "ppocr");
|
|
60
60
|
}
|
|
61
61
|
var DEFAULT_OCR_MODELS = Object.freeze({
|
|
62
62
|
det: { spec: OCR_DET_MODEL },
|
|
@@ -98,7 +98,7 @@ async function ensureOcrModelsFor(sel, onProgress) {
|
|
|
98
98
|
if (!stamp || verifiedInProcess.get(path) !== stamp) todo.push(s.spec);
|
|
99
99
|
}
|
|
100
100
|
if (!todo.length) return;
|
|
101
|
-
await
|
|
101
|
+
await _chunkSU6ABNIXcjs.ensureModelsIn.call(void 0, dir, todo, onProgress);
|
|
102
102
|
for (const spec of todo) {
|
|
103
103
|
const path = _path.join.call(void 0, dir, spec.filename), stamp = await fileStamp(path);
|
|
104
104
|
if (stamp) verifiedInProcess.set(path, stamp);
|
|
@@ -2147,16 +2147,16 @@ function recordOpenEndCellEdges(grid, cells, horizontals) {
|
|
|
2147
2147
|
}
|
|
2148
2148
|
function takeClipCellEdges(from, to) {
|
|
2149
2149
|
const e = CLIP_CELL_EDGES.get(from);
|
|
2150
|
-
if (e)
|
|
2150
|
+
if (e) _chunkSO4ZYWYEcjs.CELL_EDGES.set(to, e);
|
|
2151
2151
|
}
|
|
2152
2152
|
function hasOpenCellSeam(a, b) {
|
|
2153
|
-
const u =
|
|
2153
|
+
const u = _chunkSO4ZYWYEcjs.CELL_EDGES.get(a), d = _chunkSO4ZYWYEcjs.CELL_EDGES.get(b);
|
|
2154
2154
|
return !!u && !!d && u.t && !u.b && !d.t && d.b && u.l && u.r && d.l && d.r;
|
|
2155
2155
|
}
|
|
2156
2156
|
function joinCellEdges(a, b) {
|
|
2157
|
-
const u =
|
|
2157
|
+
const u = _chunkSO4ZYWYEcjs.CELL_EDGES.get(a), d = _chunkSO4ZYWYEcjs.CELL_EDGES.get(b);
|
|
2158
2158
|
if (!u || !d) return;
|
|
2159
|
-
|
|
2159
|
+
_chunkSO4ZYWYEcjs.CELL_EDGES.set(a, { t: u.t, b: d.b, l: u.l || d.l, r: u.r || d.r });
|
|
2160
2160
|
}
|
|
2161
2161
|
|
|
2162
2162
|
// src/pdf/cell-extract.ts
|
|
@@ -2332,7 +2332,7 @@ function tagScripts(text, lines) {
|
|
|
2332
2332
|
const [s, e, kind] = marks[m];
|
|
2333
2333
|
out = out.slice(0, s) + `<${kind}>` + out.slice(s, e) + `</${kind}>` + out.slice(e);
|
|
2334
2334
|
}
|
|
2335
|
-
return
|
|
2335
|
+
return _chunkSO4ZYWYEcjs.tidyScriptTags.call(void 0, out);
|
|
2336
2336
|
}
|
|
2337
2337
|
|
|
2338
2338
|
// src/pdf/line-wrap.ts
|
|
@@ -5391,9 +5391,9 @@ function detectHeadings(blocks, medianFontSize) {
|
|
|
5391
5391
|
if (/^\d+$/.test(text) && !isChapterNumber(block, blocks[bi + 1], medianFontSize)) continue;
|
|
5392
5392
|
const ratio = block.style.fontSize / medianFontSize;
|
|
5393
5393
|
let level = 0;
|
|
5394
|
-
if (ratio >=
|
|
5395
|
-
else if (ratio >=
|
|
5396
|
-
else if (ratio >=
|
|
5394
|
+
if (ratio >= _chunkSO4ZYWYEcjs.HEADING_RATIO_H1) level = 1;
|
|
5395
|
+
else if (ratio >= _chunkSO4ZYWYEcjs.HEADING_RATIO_H2) level = 2;
|
|
5396
|
+
else if (ratio >= _chunkSO4ZYWYEcjs.HEADING_RATIO_H3) level = 3;
|
|
5397
5397
|
if (level > 0) {
|
|
5398
5398
|
block.type = "heading";
|
|
5399
5399
|
block.level = level;
|
|
@@ -5406,7 +5406,7 @@ function isChapterNumber(block, next, medianFontSize) {
|
|
|
5406
5406
|
const nextSize = _nullishCoalesce(_optionalChain([next, 'optionalAccess', _159 => _159.style, 'optionalAccess', _160 => _160.fontSize]), () => ( 0));
|
|
5407
5407
|
const text = _nullishCoalesce(_optionalChain([next, 'optionalAccess', _161 => _161.text, 'optionalAccess', _162 => _162.trim, 'call', _163 => _163()]), () => ( ""));
|
|
5408
5408
|
const a = block.bbox, b = _optionalChain([next, 'optionalAccess', _164 => _164.bbox]);
|
|
5409
|
-
return /^\d{1,2}$/.test(_nullishCoalesce(_optionalChain([block, 'access', _165 => _165.text, 'optionalAccess', _166 => _166.trim, 'call', _167 => _167()]), () => ( ""))) && size >= medianFontSize * 2.5 && !!next && (next.type === "paragraph" || next.type === "heading") && next.pageNumber === block.pageNumber && nextSize >= medianFontSize *
|
|
5409
|
+
return /^\d{1,2}$/.test(_nullishCoalesce(_optionalChain([block, 'access', _165 => _165.text, 'optionalAccess', _166 => _166.trim, 'call', _167 => _167()]), () => ( ""))) && size >= medianFontSize * 2.5 && !!next && (next.type === "paragraph" || next.type === "heading") && next.pageNumber === block.pageNumber && nextSize >= medianFontSize * _chunkSO4ZYWYEcjs.HEADING_RATIO_H1 && text.length > 0 && text.length <= 80 && !/^[\d\s.]+$/.test(text) && !!a && !!b && a.y > b.y && a.y - (b.y + b.height) <= size * 2;
|
|
5410
5410
|
}
|
|
5411
5411
|
function mergeStackedHeadingLines(blocks, medianFontSize) {
|
|
5412
5412
|
for (let i = 0; i < blocks.length - 1; ) {
|
|
@@ -5739,7 +5739,9 @@ function detectTableCaptions(blocks) {
|
|
|
5739
5739
|
blocks.splice(i - 1, 1);
|
|
5740
5740
|
i--;
|
|
5741
5741
|
} else if (isCaptionCandidate(blocks[i + 1], block) && _optionalChain([blocks, 'access', _284 => _284[i + 2], 'optionalAccess', _285 => _285.type]) !== "table") {
|
|
5742
|
+
const cap = blocks[i + 1].bbox, tbl = block.bbox;
|
|
5742
5743
|
block.table.caption = blocks[i + 1].text.trim();
|
|
5744
|
+
if (cap && tbl && cap.y + cap.height <= tbl.y + 1) block.table.captionBelow = true;
|
|
5743
5745
|
blocks.splice(i + 1, 1);
|
|
5744
5746
|
}
|
|
5745
5747
|
}
|
|
@@ -6755,6 +6757,9 @@ function detectColumnGutter(rects) {
|
|
|
6755
6757
|
if (lRowCount < SIDE_MIN_TEXT_ROWS || rRowCount < SIDE_MIN_TEXT_ROWS) return null;
|
|
6756
6758
|
if (tinyGapRows > MAX_TINY_GAP_ROWS) return null;
|
|
6757
6759
|
if (bothRows / Math.min(lRowCount, rRowCount) > MAX_BOTH_SIDE_ROW_RATIO) return null;
|
|
6760
|
+
const lo2 = Math.max(L.minY, R.minY), hi2 = Math.min(L.maxT, R.maxT);
|
|
6761
|
+
const wideCrossRows = new Set(rects.filter((r) => r.h <= TEXT_RECT_MAX_H && r.w >= span2 * WIDE_RECT_RATIO && r.x < gutterX && r.x + r.w > gutterX && r.y >= lo2 && r.y <= hi2).map((r) => rowKey(r.y))).size;
|
|
6762
|
+
if (wideCrossRows >= Math.min(lRowCount, rRowCount)) return null;
|
|
6758
6763
|
}
|
|
6759
6764
|
return gutterX;
|
|
6760
6765
|
}
|
|
@@ -6939,16 +6944,16 @@ function isProseSpread(items) {
|
|
|
6939
6944
|
for (let i = 1; i < sorted.length; i++) {
|
|
6940
6945
|
gaps.push(sorted[i].x - (sorted[i - 1].x + sorted[i - 1].w));
|
|
6941
6946
|
}
|
|
6942
|
-
const maxGap =
|
|
6947
|
+
const maxGap = _chunkEREKI4DDcjs.safeMax.call(void 0, gaps);
|
|
6943
6948
|
const avgLen = items.reduce((s, i) => s + i.text.length, 0) / items.length;
|
|
6944
6949
|
if (items.length >= 4 && maxGap < 40 && avgLen < 5) return true;
|
|
6945
|
-
const minGap =
|
|
6950
|
+
const minGap = _chunkEREKI4DDcjs.safeMin.call(void 0, gaps);
|
|
6946
6951
|
return minGap > 0 && maxGap - minGap <= Math.max(2, maxGap * 0.15) && (items.filter((i) => /^\P{L}*\p{Ll}/u.test(i.text)).length * 2 >= items.length || items.some((i) => /\p{L}[,.;:]["”’)]?$/u.test(i.text)));
|
|
6947
6952
|
}
|
|
6948
6953
|
function detectColumns(yLines) {
|
|
6949
6954
|
const allItems = yLines.flat();
|
|
6950
6955
|
if (allItems.length === 0) return null;
|
|
6951
|
-
const pageWidth =
|
|
6956
|
+
const pageWidth = _chunkEREKI4DDcjs.safeMax.call(void 0, allItems.map((i) => i.x + i.w)) - _chunkEREKI4DDcjs.safeMin.call(void 0, allItems.map((i) => i.x));
|
|
6952
6957
|
if (pageWidth < 100) return null;
|
|
6953
6958
|
let bigoLineIdx = -1;
|
|
6954
6959
|
for (let i = 0; i < yLines.length; i++) {
|
|
@@ -7440,7 +7445,7 @@ function rebuildUnitLine(items, grid) {
|
|
|
7440
7445
|
function prependUnitRow(cells, cols, line, usedItems) {
|
|
7441
7446
|
const text = cleanCellText(line.map((item) => item.text).join(""));
|
|
7442
7447
|
cells.unshift(Array.from({ length: cols }, (_, c) => ({ text: c === 0 ? text : "", colSpan: c === 0 ? cols : 1, rowSpan: 1 })));
|
|
7443
|
-
for (const cell of cells[0])
|
|
7448
|
+
for (const cell of cells[0]) _chunkSO4ZYWYEcjs.CELL_EDGES.set(cell, NO_EDGES);
|
|
7444
7449
|
for (const item of line) usedItems.add(item);
|
|
7445
7450
|
}
|
|
7446
7451
|
function attachUnitRow(items, grid, cells, cols, usedItems) {
|
|
@@ -7972,7 +7977,7 @@ function recordFrameTitle(table, source, pageNum) {
|
|
|
7972
7977
|
const [label, spacer, title] = cells;
|
|
7973
7978
|
if (!/^(?:붙임|별첨|첨부|부록)\s*\d{1,3}$/.test(label.text.trim()) || spacer.text.trim() || !title.text.trim()) return;
|
|
7974
7979
|
if (cells.some((c) => {
|
|
7975
|
-
const e =
|
|
7980
|
+
const e = _chunkSO4ZYWYEcjs.CELL_EDGES.get(c);
|
|
7976
7981
|
return !e || e.t || e.b || e.l || e.r;
|
|
7977
7982
|
})) return;
|
|
7978
7983
|
const xs = TABLE_COLXS.get(table), style = dominantStyle(source), fs = _nullishCoalesce(_optionalChain([style, 'optionalAccess', _358 => _358.fontSize]), () => ( 0));
|
|
@@ -8553,7 +8558,7 @@ function extractBlocksWithGrids(items, pageNum, pageWidth, pageHeight, grids, ho
|
|
|
8553
8558
|
groupSizes.push(1);
|
|
8554
8559
|
}
|
|
8555
8560
|
const allY = remaining.map((i) => i.y);
|
|
8556
|
-
const pageH =
|
|
8561
|
+
const pageH = _chunkEREKI4DDcjs.safeMax.call(void 0, allY) - _chunkEREKI4DDcjs.safeMin.call(void 0, allY);
|
|
8557
8562
|
const gapThreshold = Math.max(15, pageH * 0.03);
|
|
8558
8563
|
const sides = frameColumnTextBands(remaining, spanning, gx);
|
|
8559
8564
|
const textBlocks = [];
|
|
@@ -8569,7 +8574,7 @@ function extractBlocksWithGrids(items, pageNum, pageWidth, pageHeight, grids, ho
|
|
|
8569
8574
|
finalTextBlocks.push(...detectListBlocks(textBlocks));
|
|
8570
8575
|
} else {
|
|
8571
8576
|
const allY = remaining.map((i) => i.y);
|
|
8572
|
-
const pageH =
|
|
8577
|
+
const pageH = _chunkEREKI4DDcjs.safeMax.call(void 0, allY) - _chunkEREKI4DDcjs.safeMin.call(void 0, allY);
|
|
8573
8578
|
const gapThreshold = Math.max(15, pageH * 0.03);
|
|
8574
8579
|
const groups = xyCutOrder(remaining, gapThreshold);
|
|
8575
8580
|
const textBlocks = [];
|
|
@@ -8897,7 +8902,7 @@ function extractPageBlocksFallback(items, pageNum, fullPage = false, detectTable
|
|
|
8897
8902
|
blocks.push(...columnTextToBlocks(tableText, pageNum, bbox, dominantStyle(items)));
|
|
8898
8903
|
} else {
|
|
8899
8904
|
const allY = items.map((i) => i.y);
|
|
8900
|
-
const pageHeight =
|
|
8905
|
+
const pageHeight = _chunkEREKI4DDcjs.safeMax.call(void 0, allY) - _chunkEREKI4DDcjs.safeMin.call(void 0, allY);
|
|
8901
8906
|
const gapThreshold = Math.max(15, pageHeight * 0.03);
|
|
8902
8907
|
const orderedGroups = proseCutX !== null ? splitTwoColumnProse(items, proseCutX) : xyCutOrder(items, gapThreshold, 0, void 0, minGap);
|
|
8903
8908
|
for (const group of orderedGroups) {
|
|
@@ -8935,6 +8940,8 @@ function mergeOcrImageRegions(blocks, page, regions, ocrBlocks) {
|
|
|
8935
8940
|
if (b.type === "paragraph") return (_nullishCoalesce(_optionalChain([b, 'access', _391 => _391.text, 'optionalAccess', _392 => _392.match, 'call', _393 => _393(/[\p{L}\p{N}]/gu), 'optionalAccess', _394 => _394.length]), () => ( 0))) >= 2 || !axisFragments.has(b) && (supportedDiagramLabel(b, labels, region) || axisTick(b, candidates));
|
|
8936
8941
|
const t = b.table;
|
|
8937
8942
|
if (b.type !== "table" || !t || UNRULED_REGION_TABLES.has(b)) return false;
|
|
8943
|
+
const lone = t.cells.filter((row) => row.filter((c) => c.text.trim()).length === 1 && row.some((c) => c.colSpan === t.cols)).length;
|
|
8944
|
+
if (t.rows >= 2 && lone * 2 >= t.rows) return false;
|
|
8938
8945
|
if (t.rows === 1 && t.cols === 1) {
|
|
8939
8946
|
const text = _nullishCoalesce(_optionalChain([t, 'access', _395 => _395.cells, 'access', _396 => _396[0], 'optionalAccess', _397 => _397[0], 'optionalAccess', _398 => _398.text]), () => ( ""));
|
|
8940
8947
|
return (_nullishCoalesce(_optionalChain([text, 'access', _399 => _399.match, 'call', _400 => _400(/\n/g), 'optionalAccess', _401 => _401.length]), () => ( 0))) >= 5 && (_nullishCoalesce(_optionalChain([text, 'access', _402 => _402.match, 'call', _403 => _403(/\d/g), 'optionalAccess', _404 => _404.length]), () => ( 0))) >= text.length * 0.25;
|
|
@@ -9111,4 +9118,4 @@ function rowParagraphs(block) {
|
|
|
9111
9118
|
|
|
9112
9119
|
|
|
9113
9120
|
exports.DEFAULT_OCR_MODELS = DEFAULT_OCR_MODELS; exports.resolveOcrModels = resolveOcrModels; exports.ocrSelectionKey = ocrSelectionKey; exports.ocrSourcePath = ocrSourcePath; exports.ensureOcrModelsFor = ensureOcrModelsFor; exports.ocrModelsCached = ocrModelsCached; exports.parseCharacterDict = parseCharacterDict; exports.extractLines = extractLines; exports.extractImageRegions = extractImageRegions; exports.NO_EDGES = NO_EDGES; exports.hasOpenCellSeam = hasOpenCellSeam; exports.joinCellEdges = joinCellEdges; exports.filterHiddenText = filterHiddenText; exports.collapseEvenSpacing = collapseEvenSpacing; exports.computeBBox = computeBBox; exports.dominantStyle = dominantStyle; exports.normalizeItems = normalizeItems; exports.groupByY = groupByY; exports.mergeLineSimple = mergeLineSimple; exports.WrapLexicon = WrapLexicon; exports.startsNewItem = startsNewItem; exports.wrapJoiner = wrapJoiner; exports.joinPageBreakWraps = joinPageBreakWraps; exports.splitPageBreakWraps = splitPageBreakWraps; exports.latinSoftWrap = latinSoftWrap; exports.TOC_BLOCKS = TOC_BLOCKS; exports.computeMedianFontSizeFromFreq = computeMedianFontSizeFromFreq; exports.detectHeadings = detectHeadings; exports.mergeStackedHeadingLines = mergeStackedHeadingLines; exports.detectTypographyHeadings = detectTypographyHeadings; exports.detectDocumentStyleHeadings = detectDocumentStyleHeadings; exports.detectSiblingStyleHeadings = detectSiblingStyleHeadings; exports.detectRepeatedPageLabels = detectRepeatedPageLabels; exports.detectPageLeadHeadings = detectPageLeadHeadings; exports.refineDocumentStyleHeadings = refineDocumentStyleHeadings; exports.detectMarkerHeadings = detectMarkerHeadings; exports.detectTableCaptions = detectTableCaptions; exports.detectKoreanListBlocks = detectKoreanListBlocks; exports.removeHeaderFooterBlocks = removeHeaderFooterBlocks; exports.runningLinePatterns = runningLinePatterns; exports.stripAbsorbedRunningLines = stripAbsorbedRunningLines; exports.CLIP_TABLES = CLIP_TABLES; exports.FRAME_TITLE_BLOCKS = FRAME_TITLE_BLOCKS; exports.TABLE_COLXS = TABLE_COLXS; exports.TABLE_ROWYS = TABLE_ROWYS; exports.TABLE_TAIL = TABLE_TAIL; exports.PART_COLXS = PART_COLXS; exports.EMPTY_PARTS = EMPTY_PARTS; exports.IMAGE_CELLS = IMAGE_CELLS; exports.FILLER_CELLS = FILLER_CELLS; exports.CONT_PARTS = CONT_PARTS; exports.CELL_LINES = CELL_LINES; exports.ROW_RULES = ROW_RULES; exports.trimTrailingEmptyTableCols = trimTrailingEmptyTableCols; exports.restoreImageBullets = restoreImageBullets; exports.detectRightArrowRegions = detectRightArrowRegions; exports.removeSideTabs = removeSideTabs; exports.extractPageBlocksWithLines = extractPageBlocksWithLines; exports.UNRULED_REGION_TABLES = UNRULED_REGION_TABLES; exports.mergeOcrImageRegions = mergeOcrImageRegions;
|
|
9114
|
-
//# sourceMappingURL=chunk-
|
|
9121
|
+
//# sourceMappingURL=chunk-BTLQOIES.cjs.map
|