kordoc 4.24.57 → 4.24.59
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 -5
- package/dist/{-RVICVRYN.js → -W245SBZ4.js} +21 -21
- package/dist/{chunk-SVYEPDTI.cjs → chunk-2ABMZKN4.cjs} +3 -3
- package/dist/{chunk-SVYEPDTI.cjs.map → chunk-2ABMZKN4.cjs.map} +1 -1
- package/dist/{chunk-OVOXFXWE.cjs → chunk-2NQ2U5WG.cjs} +2 -2
- package/dist/{chunk-OVOXFXWE.cjs.map → chunk-2NQ2U5WG.cjs.map} +1 -1
- package/dist/{chunk-ZC4LTDN7.js → chunk-5HUFJ72Q.js} +10 -10
- package/dist/{chunk-GXFBOB2T.js → chunk-62L576J7.js} +7 -7
- package/dist/{chunk-XRJB3DAK.cjs → chunk-6ZQ2SVBP.cjs} +100 -27
- package/dist/chunk-6ZQ2SVBP.cjs.map +1 -0
- package/dist/chunk-7Y6KVNIT.js +45 -0
- package/dist/chunk-7Y6KVNIT.js.map +1 -0
- package/dist/{chunk-3P5B6BK7.js → chunk-AFTIHYYH.js} +2 -2
- package/dist/{chunk-CR7YAAPL.js → chunk-APMUZQI7.js} +3 -3
- package/dist/{chunk-A262AU5L.js → chunk-BSURADAT.js} +2 -2
- package/dist/{chunk-DXW7LWIH.js → chunk-DK6OHNBF.js} +2 -2
- package/dist/{chunk-DZAPWW3L.js → chunk-EN4MDTK5.js} +78 -5
- package/dist/chunk-EN4MDTK5.js.map +1 -0
- package/dist/{chunk-56NNV4HJ.js → chunk-EYQXC7JU.js} +2 -2
- package/dist/{chunk-2RWSNYRZ.js → chunk-FN6RSXGM.js} +2 -2
- package/dist/{chunk-IQN2MDFK.cjs → chunk-FPE6B6Y7.cjs} +88 -87
- package/dist/chunk-FPE6B6Y7.cjs.map +1 -0
- package/dist/{chunk-RVWKUI7R.js → chunk-HBNH6SUO.js} +2 -2
- package/dist/{chunk-VHZ62NYY.js → chunk-IG3QOZPY.js} +79 -6
- package/dist/chunk-IG3QOZPY.js.map +1 -0
- package/dist/{chunk-2Q6WVO5L.js → chunk-IPIYPTDX.js} +2 -2
- package/dist/{chunk-2VAQKOEL.js → chunk-JDHVJ5FT.js} +5 -4
- package/dist/{chunk-2VAQKOEL.js.map → chunk-JDHVJ5FT.js.map} +1 -1
- package/dist/{chunk-PUY6TLTM.js → chunk-KIWMGVEU.js} +3 -3
- package/dist/{chunk-C5BAOY4Z.js → chunk-KLXLAWWJ.js} +2 -2
- package/dist/{chunk-QMIG4HGT.js → chunk-KOL37ON7.js} +2 -2
- package/dist/{chunk-MI5K5VGQ.cjs → chunk-LF65TMMS.cjs} +98 -98
- package/dist/{chunk-MI5K5VGQ.cjs.map → chunk-LF65TMMS.cjs.map} +1 -1
- package/dist/{chunk-EK34SHOH.js → chunk-MOYAWRBL.js} +6 -6
- package/dist/{chunk-MK4MGJLH.js → chunk-MYZZL77Z.js} +5 -5
- package/dist/{chunk-IRKCGITR.js → chunk-NLUKUB3X.js} +11 -11
- package/dist/{chunk-IAWFPRS4.js → chunk-NMHCAYXY.js} +2 -2
- package/dist/{chunk-IEP5NLBI.js → chunk-OT4LV5ME.js} +2 -2
- package/dist/{chunk-OQDUDMUC.js → chunk-PSBUE4JR.js} +2 -2
- package/dist/{chunk-AEYKZCBM.js → chunk-PXZVXAZY.js} +6 -6
- package/dist/{chunk-4QLPYPUD.js → chunk-Q2VGRE5H.js} +2 -2
- package/dist/{chunk-MULOWEJJ.js → chunk-TOTB3KYT.js} +2 -2
- package/dist/{chunk-RZLDEQSO.js → chunk-UCGS2MCN.js} +2 -2
- package/dist/{chunk-JJ5B5SZE.js → chunk-V75TUR6R.js} +5 -5
- package/dist/{chunk-RRLBDA4N.js → chunk-VFDUH2TU.js} +3 -3
- package/dist/{chunk-EK3UUR4K.js → chunk-WCQPPQLF.js} +2 -2
- package/dist/{chunk-NVY6SVAF.js → chunk-WQYK6U2Y.js} +5 -5
- package/dist/{chunk-URMGWSSG.js → chunk-XIFN4NSV.js} +2 -2
- package/dist/{chunk-YD7EXMI5.js → chunk-XKDFWNSS.js} +15 -15
- package/dist/{chunk-PONHO47S.cjs → chunk-XQ5NDWB3.cjs} +58 -58
- package/dist/{chunk-PONHO47S.cjs.map → chunk-XQ5NDWB3.cjs.map} +1 -1
- package/dist/{chunk-WACFPXDR.js → chunk-XUVI3ZOZ.js} +2 -2
- package/dist/{chunk-C52UENIF.cjs → chunk-YO3DF4UK.cjs} +6 -6
- package/dist/{chunk-C52UENIF.cjs.map → chunk-YO3DF4UK.cjs.map} +1 -1
- package/dist/{chunk-BSH6DX4J.js → chunk-YOAAZRJP.js} +6 -5
- package/dist/{chunk-BSH6DX4J.js.map → chunk-YOAAZRJP.js.map} +1 -1
- package/dist/{chunk-IADEGWCE.cjs → chunk-ZHQNN6UJ.cjs} +3 -3
- package/dist/{chunk-IADEGWCE.cjs.map → chunk-ZHQNN6UJ.cjs.map} +1 -1
- package/dist/{chunk-MZY3TG73.js → chunk-ZMBSNNH2.js} +2 -2
- package/dist/chunks-V2CDKRY6.js +11 -0
- package/dist/cli.js +52 -45
- package/dist/cli.js.map +1 -1
- package/dist/{formula-7BVDJITM.js → formula-E4SBECED.js} +3 -3
- package/dist/{formula-NU5E7RNT.cjs → formula-HRBPOC5P.cjs} +9 -9
- package/dist/{formula-NU5E7RNT.cjs.map → formula-HRBPOC5P.cjs.map} +1 -1
- package/dist/{formula-TZZJFJO5.js → formula-RJUJZO3U.js} +4 -4
- package/dist/generator-OHFYCIXQ.cjs +12 -0
- package/dist/{generator-LO2AKTLV.cjs.map → generator-OHFYCIXQ.cjs.map} +1 -1
- package/dist/generator-P7ZN7B7P.js +11 -0
- package/dist/generator-RURC6RNR.js +18 -0
- package/dist/{hancom-WYRJFLSK.js → hancom-3SOIES4W.js} +2 -2
- package/dist/{hancom-UUX6JSFO.cjs → hancom-KMPPOAYM.cjs} +5 -5
- package/dist/{hancom-UUX6JSFO.cjs.map → hancom-KMPPOAYM.cjs.map} +1 -1
- package/dist/{hancom-TLAJ67QZ.js → hancom-YAVHUQRY.js} +2 -2
- package/dist/{image-ocr-KNLMHI6S.cjs → image-ocr-AL5E6HKK.cjs} +28 -28
- package/dist/{image-ocr-KNLMHI6S.cjs.map → image-ocr-AL5E6HKK.cjs.map} +1 -1
- package/dist/{image-ocr-A3ANFFSW.js → image-ocr-CSOLKSS2.js} +7 -7
- package/dist/{image-ocr-RZS3OCVX.js → image-ocr-I4EFZ2DP.js} +10 -10
- package/dist/index.cjs +1105 -1105
- package/dist/index.js +9 -9
- package/dist/mcp.js +46 -40
- package/dist/mcp.js.map +1 -1
- package/dist/memo-AY6W7DU2.js +17 -0
- package/dist/{model-bundle-KKGRDCIM.js → model-bundle-IK5RDP32.js} +5 -5
- package/dist/{models-WFUMRIYE.js → models-GCAX7F7S.js} +5 -5
- package/dist/{parse-worker-v2-M5VS2BZX.js → parse-worker-v2-5CFBYPWC.js} +32 -23
- package/dist/parse-worker-v2-5CFBYPWC.js.map +1 -0
- package/dist/{parser-5FW57ZYW.cjs → parser-PC6CZYSQ.cjs} +166 -166
- package/dist/{parser-5FW57ZYW.cjs.map → parser-PC6CZYSQ.cjs.map} +1 -1
- package/dist/{parser-W4AZXRL2.js → parser-QE5GS3WD.js} +12 -12
- package/dist/{parser-KEDWQUIV.js → parser-VFF6L2LG.js} +9 -9
- package/dist/pdf-ocr-2KNRTDV3.cjs +43 -0
- package/dist/{pdf-ocr-LFU7S4SG.cjs.map → pdf-ocr-2KNRTDV3.cjs.map} +1 -1
- package/dist/{pdf-ocr-VPLHO5LW.js → pdf-ocr-DW2WDL33.js} +6 -6
- package/dist/{pdf-ocr-VJW42GR3.js → pdf-ocr-ZYT7XPGE.js} +9 -9
- package/dist/{profile-io-QBT4UZ42.js → profile-io-MF7JI5RT.js} +3 -3
- package/dist/{rasterize-MJHFTXJJ.js → rasterize-T7GGC6S5.js} +3 -3
- package/dist/{redact-doc-FO55EMD6.js → redact-doc-QPZN5OOW.js} +21 -21
- package/dist/{render-VUY3PA4Q.js → render-S7LIWDPT.js} +12 -12
- package/dist/{rewrite-fallback-A2ZW3PB4.js → rewrite-fallback-OZ5FI5BZ.js} +13 -13
- package/dist/seal-UJW2PODF.js +16 -0
- package/dist/{setup-43ZBS4SL.js → setup-U5XWE7T7.js} +3 -3
- package/dist/{to-hwpx-BXM7QAQB.js → to-hwpx-5K2KPJCF.js} +4 -4
- package/dist/{to-hwpx-MIB5552R.js → to-hwpx-FVGC42RQ.js} +7 -7
- package/dist/to-hwpx-KG6AAVTM.cjs +16 -0
- package/dist/{to-hwpx-YXMPSFSI.cjs.map → to-hwpx-KG6AAVTM.cjs.map} +1 -1
- package/dist/visual-CPJFRSYD.js +38 -0
- package/dist/{watch-X244G37W.js → watch-P4WN723H.js} +22 -22
- package/package.json +1 -1
- package/dist/chunk-DZAPWW3L.js.map +0 -1
- package/dist/chunk-IQN2MDFK.cjs.map +0 -1
- package/dist/chunk-VHZ62NYY.js.map +0 -1
- package/dist/chunk-XRJB3DAK.cjs.map +0 -1
- package/dist/chunks-TG7YGGKM.js +0 -11
- package/dist/generator-LO2AKTLV.cjs +0 -12
- package/dist/generator-LSSDBV4Y.js +0 -18
- package/dist/generator-OHKS5I5D.js +0 -11
- package/dist/memo-3ZDUAFYY.js +0 -17
- package/dist/parse-worker-v2-M5VS2BZX.js.map +0 -1
- package/dist/pdf-ocr-LFU7S4SG.cjs +0 -43
- package/dist/seal-ELESG4D4.js +0 -16
- package/dist/to-hwpx-YXMPSFSI.cjs +0 -16
- package/dist/visual-CNDBJE2X.js +0 -38
- /package/dist/{-RVICVRYN.js.map → -W245SBZ4.js.map} +0 -0
- /package/dist/{chunk-ZC4LTDN7.js.map → chunk-5HUFJ72Q.js.map} +0 -0
- /package/dist/{chunk-GXFBOB2T.js.map → chunk-62L576J7.js.map} +0 -0
- /package/dist/{chunk-3P5B6BK7.js.map → chunk-AFTIHYYH.js.map} +0 -0
- /package/dist/{chunk-CR7YAAPL.js.map → chunk-APMUZQI7.js.map} +0 -0
- /package/dist/{chunk-A262AU5L.js.map → chunk-BSURADAT.js.map} +0 -0
- /package/dist/{chunk-DXW7LWIH.js.map → chunk-DK6OHNBF.js.map} +0 -0
- /package/dist/{chunk-56NNV4HJ.js.map → chunk-EYQXC7JU.js.map} +0 -0
- /package/dist/{chunk-2RWSNYRZ.js.map → chunk-FN6RSXGM.js.map} +0 -0
- /package/dist/{chunk-RVWKUI7R.js.map → chunk-HBNH6SUO.js.map} +0 -0
- /package/dist/{chunk-2Q6WVO5L.js.map → chunk-IPIYPTDX.js.map} +0 -0
- /package/dist/{chunk-PUY6TLTM.js.map → chunk-KIWMGVEU.js.map} +0 -0
- /package/dist/{chunk-C5BAOY4Z.js.map → chunk-KLXLAWWJ.js.map} +0 -0
- /package/dist/{chunk-QMIG4HGT.js.map → chunk-KOL37ON7.js.map} +0 -0
- /package/dist/{chunk-EK34SHOH.js.map → chunk-MOYAWRBL.js.map} +0 -0
- /package/dist/{chunk-MK4MGJLH.js.map → chunk-MYZZL77Z.js.map} +0 -0
- /package/dist/{chunk-IRKCGITR.js.map → chunk-NLUKUB3X.js.map} +0 -0
- /package/dist/{chunk-IAWFPRS4.js.map → chunk-NMHCAYXY.js.map} +0 -0
- /package/dist/{chunk-IEP5NLBI.js.map → chunk-OT4LV5ME.js.map} +0 -0
- /package/dist/{chunk-OQDUDMUC.js.map → chunk-PSBUE4JR.js.map} +0 -0
- /package/dist/{chunk-AEYKZCBM.js.map → chunk-PXZVXAZY.js.map} +0 -0
- /package/dist/{chunk-4QLPYPUD.js.map → chunk-Q2VGRE5H.js.map} +0 -0
- /package/dist/{chunk-MULOWEJJ.js.map → chunk-TOTB3KYT.js.map} +0 -0
- /package/dist/{chunk-RZLDEQSO.js.map → chunk-UCGS2MCN.js.map} +0 -0
- /package/dist/{chunk-JJ5B5SZE.js.map → chunk-V75TUR6R.js.map} +0 -0
- /package/dist/{chunk-RRLBDA4N.js.map → chunk-VFDUH2TU.js.map} +0 -0
- /package/dist/{chunk-EK3UUR4K.js.map → chunk-WCQPPQLF.js.map} +0 -0
- /package/dist/{chunk-NVY6SVAF.js.map → chunk-WQYK6U2Y.js.map} +0 -0
- /package/dist/{chunk-URMGWSSG.js.map → chunk-XIFN4NSV.js.map} +0 -0
- /package/dist/{chunk-YD7EXMI5.js.map → chunk-XKDFWNSS.js.map} +0 -0
- /package/dist/{chunk-WACFPXDR.js.map → chunk-XUVI3ZOZ.js.map} +0 -0
- /package/dist/{chunk-MZY3TG73.js.map → chunk-ZMBSNNH2.js.map} +0 -0
- /package/dist/{chunks-TG7YGGKM.js.map → chunks-V2CDKRY6.js.map} +0 -0
- /package/dist/{formula-7BVDJITM.js.map → formula-E4SBECED.js.map} +0 -0
- /package/dist/{formula-TZZJFJO5.js.map → formula-RJUJZO3U.js.map} +0 -0
- /package/dist/{generator-LSSDBV4Y.js.map → generator-P7ZN7B7P.js.map} +0 -0
- /package/dist/{generator-OHKS5I5D.js.map → generator-RURC6RNR.js.map} +0 -0
- /package/dist/{hancom-WYRJFLSK.js.map → hancom-3SOIES4W.js.map} +0 -0
- /package/dist/{hancom-TLAJ67QZ.js.map → hancom-YAVHUQRY.js.map} +0 -0
- /package/dist/{image-ocr-A3ANFFSW.js.map → image-ocr-CSOLKSS2.js.map} +0 -0
- /package/dist/{image-ocr-RZS3OCVX.js.map → image-ocr-I4EFZ2DP.js.map} +0 -0
- /package/dist/{memo-3ZDUAFYY.js.map → memo-AY6W7DU2.js.map} +0 -0
- /package/dist/{model-bundle-KKGRDCIM.js.map → model-bundle-IK5RDP32.js.map} +0 -0
- /package/dist/{models-WFUMRIYE.js.map → models-GCAX7F7S.js.map} +0 -0
- /package/dist/{parser-W4AZXRL2.js.map → parser-QE5GS3WD.js.map} +0 -0
- /package/dist/{parser-KEDWQUIV.js.map → parser-VFF6L2LG.js.map} +0 -0
- /package/dist/{pdf-ocr-VJW42GR3.js.map → pdf-ocr-DW2WDL33.js.map} +0 -0
- /package/dist/{pdf-ocr-VPLHO5LW.js.map → pdf-ocr-ZYT7XPGE.js.map} +0 -0
- /package/dist/{profile-io-QBT4UZ42.js.map → profile-io-MF7JI5RT.js.map} +0 -0
- /package/dist/{rasterize-MJHFTXJJ.js.map → rasterize-T7GGC6S5.js.map} +0 -0
- /package/dist/{redact-doc-FO55EMD6.js.map → redact-doc-QPZN5OOW.js.map} +0 -0
- /package/dist/{render-VUY3PA4Q.js.map → render-S7LIWDPT.js.map} +0 -0
- /package/dist/{rewrite-fallback-A2ZW3PB4.js.map → rewrite-fallback-OZ5FI5BZ.js.map} +0 -0
- /package/dist/{seal-ELESG4D4.js.map → seal-UJW2PODF.js.map} +0 -0
- /package/dist/{setup-43ZBS4SL.js.map → setup-U5XWE7T7.js.map} +0 -0
- /package/dist/{to-hwpx-BXM7QAQB.js.map → to-hwpx-5K2KPJCF.js.map} +0 -0
- /package/dist/{to-hwpx-MIB5552R.js.map → to-hwpx-FVGC42RQ.js.map} +0 -0
- /package/dist/{visual-CNDBJE2X.js.map → visual-CPJFRSYD.js.map} +0 -0
- /package/dist/{watch-X244G37W.js.map → watch-P4WN723H.js.map} +0 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; } var _class;
|
|
2
2
|
|
|
3
3
|
|
|
4
|
-
var
|
|
4
|
+
var _chunk2ABMZKN4cjs = require('./chunk-2ABMZKN4.cjs');
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
|
|
@@ -9,11 +9,11 @@ var _chunkSVYEPDTIcjs = require('./chunk-SVYEPDTI.cjs');
|
|
|
9
9
|
|
|
10
10
|
|
|
11
11
|
|
|
12
|
-
var
|
|
12
|
+
var _chunkYO3DF4UKcjs = require('./chunk-YO3DF4UK.cjs');
|
|
13
13
|
|
|
14
14
|
|
|
15
15
|
|
|
16
|
-
var
|
|
16
|
+
var _chunk2NQ2U5WGcjs = require('./chunk-2NQ2U5WG.cjs');
|
|
17
17
|
|
|
18
18
|
// src/ocr/models.ts
|
|
19
19
|
var _path = require('path');
|
|
@@ -65,7 +65,7 @@ var OCR_REC_DICT = {
|
|
|
65
65
|
sizeMb: 1
|
|
66
66
|
};
|
|
67
67
|
function getOcrModelsDir() {
|
|
68
|
-
return
|
|
68
|
+
return _chunk2ABMZKN4cjs.getModelsDir.call(void 0, "ppocr");
|
|
69
69
|
}
|
|
70
70
|
var DEFAULT_OCR_MODELS = Object.freeze({
|
|
71
71
|
det: { spec: OCR_DET_MODEL },
|
|
@@ -110,7 +110,7 @@ async function ensureOcrModelsFor(sel, onProgress) {
|
|
|
110
110
|
if (!stamp || verifiedInProcess.get(path) !== stamp) todo.push(s.spec);
|
|
111
111
|
}
|
|
112
112
|
if (!todo.length) return;
|
|
113
|
-
await
|
|
113
|
+
await _chunk2ABMZKN4cjs.ensureModelsIn.call(void 0, dir, todo, onProgress);
|
|
114
114
|
for (const spec of todo) {
|
|
115
115
|
const path = _path.join.call(void 0, dir, spec.filename), stamp = await fileStamp(path);
|
|
116
116
|
if (stamp) verifiedInProcess.set(path, stamp);
|
|
@@ -437,8 +437,31 @@ function inkBounds(gray, w, h, ink) {
|
|
|
437
437
|
const ruleCol = new Uint8Array(w), ruleRow = new Uint8Array(h);
|
|
438
438
|
for (let x = 0; x < w; x++) if (colInk[x] >= h * 0.85) ruleCol[x] = 1;
|
|
439
439
|
for (let y = 0; y < h; y++) if (rowInk[y] >= w * 0.85) ruleRow[y] = 1;
|
|
440
|
+
let top = 0, bottom = h;
|
|
441
|
+
const inkRow = (y) => {
|
|
442
|
+
for (let x = 0, off = y * w; x < w; x++) if (!ruleCol[x] && isInk(gray[off + x])) return true;
|
|
443
|
+
return false;
|
|
444
|
+
};
|
|
445
|
+
for (let y = Math.floor(h * 0.3); y >= 1; y--) {
|
|
446
|
+
if (ruleRow[y] || !dottedRow(gray, w, h, y, isInk)) continue;
|
|
447
|
+
let beyond = false;
|
|
448
|
+
for (let k = 0; k < y && !beyond; k++) if (!ruleRow[k] && inkRow(k) && !dottedRow(gray, w, h, k, isInk)) beyond = true;
|
|
449
|
+
if (beyond) {
|
|
450
|
+
top = y + 1;
|
|
451
|
+
break;
|
|
452
|
+
}
|
|
453
|
+
}
|
|
454
|
+
for (let y = Math.ceil(h * 0.7); y < h - 1; y++) {
|
|
455
|
+
if (ruleRow[y] || !dottedRow(gray, w, h, y, isInk)) continue;
|
|
456
|
+
let beyond = false;
|
|
457
|
+
for (let k = y + 1; k < h && !beyond; k++) if (!ruleRow[k] && inkRow(k) && !dottedRow(gray, w, h, k, isInk)) beyond = true;
|
|
458
|
+
if (beyond) {
|
|
459
|
+
bottom = y;
|
|
460
|
+
break;
|
|
461
|
+
}
|
|
462
|
+
}
|
|
440
463
|
let x0 = w, x1 = -1, y0 = h, y1 = -1;
|
|
441
|
-
for (let y =
|
|
464
|
+
for (let y = top; y < bottom; y++) {
|
|
442
465
|
if (ruleRow[y]) continue;
|
|
443
466
|
const off = y * w;
|
|
444
467
|
for (let x = 0; x < w; x++) {
|
|
@@ -450,8 +473,58 @@ function inkBounds(gray, w, h, ink) {
|
|
|
450
473
|
}
|
|
451
474
|
}
|
|
452
475
|
if (x1 < x0 || y1 < y0) return { x0: 0, y0: 0, x1: w, y1: h };
|
|
476
|
+
const colAt = (x) => {
|
|
477
|
+
let n = 0;
|
|
478
|
+
for (let y = Math.max(y0, top); y <= Math.min(y1, bottom - 1); y++) if (!ruleRow[y] && isInk(gray[y * w + x])) n++;
|
|
479
|
+
return n;
|
|
480
|
+
};
|
|
481
|
+
const trimSpecks = (edge, d) => {
|
|
482
|
+
let k = edge, n = 0;
|
|
483
|
+
for (; n < 2 && k >= 0 && k < w && !ruleCol[k] && colAt(k) > 0; n++, k -= d) if (colAt(k) > h * 0.45) return edge;
|
|
484
|
+
const touches = [edge + d, edge + 2 * d].some((r) => r >= 0 && r < w && ruleCol[r]);
|
|
485
|
+
if (!touches || !n) return edge;
|
|
486
|
+
let gap = 0;
|
|
487
|
+
for (; k >= 0 && k < w && !ruleCol[k] && colAt(k) === 0; k -= d) gap++;
|
|
488
|
+
return gap >= 3 && k >= 0 && k < w && !ruleCol[k] ? k : edge;
|
|
489
|
+
};
|
|
490
|
+
x1 = trimSpecks(x1, 1);
|
|
491
|
+
x0 = trimSpecks(x0, -1);
|
|
453
492
|
return { x0, y0, x1: x1 + 1, y1: y1 + 1 };
|
|
454
493
|
}
|
|
494
|
+
function dottedLine(n, at, side) {
|
|
495
|
+
const runs = [];
|
|
496
|
+
for (let i = 0; i < n; ) {
|
|
497
|
+
if (!at(i)) {
|
|
498
|
+
i++;
|
|
499
|
+
continue;
|
|
500
|
+
}
|
|
501
|
+
let e = i;
|
|
502
|
+
while (e < n && at(e)) e++;
|
|
503
|
+
runs.push([i, e]);
|
|
504
|
+
i = e;
|
|
505
|
+
}
|
|
506
|
+
if (runs.length < 6 || runs[runs.length - 1][1] - runs[0][0] < n * 0.85) return false;
|
|
507
|
+
const med = (v) => [...v].sort((p, q) => p - q)[v.length >> 1];
|
|
508
|
+
const lens = runs.map(([a, b]) => b - a), gaps = runs.slice(1).map(([a], i) => a - runs[i][1]);
|
|
509
|
+
const ml = med(lens), mg = med(gaps);
|
|
510
|
+
if (!(ml <= 4 && mg <= 4 && Math.max(...lens) <= Math.max(3, ml * 2.5) && Math.max(...gaps) <= Math.max(3, mg * 2.5))) return false;
|
|
511
|
+
let px = 0;
|
|
512
|
+
for (const [a, b] of runs) px += b - a;
|
|
513
|
+
for (const d of [-3, 3]) {
|
|
514
|
+
let n2 = 0, seen2 = false;
|
|
515
|
+
for (const [a, b] of runs) for (let i = a; i < b; i++) {
|
|
516
|
+
const v = side(d, i);
|
|
517
|
+
if (v === null) break;
|
|
518
|
+
seen2 = true;
|
|
519
|
+
if (v) n2++;
|
|
520
|
+
}
|
|
521
|
+
if (seen2 && n2 >= px * 0.3) return false;
|
|
522
|
+
}
|
|
523
|
+
return true;
|
|
524
|
+
}
|
|
525
|
+
function dottedRow(gray, w, h, y, isInk) {
|
|
526
|
+
return dottedLine(w, (x) => isInk(gray[y * w + x]), (d, x) => y + d < 0 || y + d >= h ? null : isInk(gray[(y + d) * w + x]));
|
|
527
|
+
}
|
|
455
528
|
function bracketFeatures(gray, w, h, ink, cx) {
|
|
456
529
|
const { comps, label } = components(gray, w, h, ink);
|
|
457
530
|
let charH = 0;
|
|
@@ -3333,16 +3406,16 @@ function recordOpenEndCellEdges(grid, cells, horizontals) {
|
|
|
3333
3406
|
}
|
|
3334
3407
|
function takeClipCellEdges(from, to) {
|
|
3335
3408
|
const e = CLIP_CELL_EDGES.get(from);
|
|
3336
|
-
if (e)
|
|
3409
|
+
if (e) _chunkYO3DF4UKcjs.CELL_EDGES.set(to, e);
|
|
3337
3410
|
}
|
|
3338
3411
|
function hasOpenCellSeam(a, b) {
|
|
3339
|
-
const u =
|
|
3412
|
+
const u = _chunkYO3DF4UKcjs.CELL_EDGES.get(a), d = _chunkYO3DF4UKcjs.CELL_EDGES.get(b);
|
|
3340
3413
|
return !!u && !!d && u.t && !u.b && !d.t && d.b && u.l && u.r && d.l && d.r;
|
|
3341
3414
|
}
|
|
3342
3415
|
function joinCellEdges(a, b) {
|
|
3343
|
-
const u =
|
|
3416
|
+
const u = _chunkYO3DF4UKcjs.CELL_EDGES.get(a), d = _chunkYO3DF4UKcjs.CELL_EDGES.get(b);
|
|
3344
3417
|
if (!u || !d) return;
|
|
3345
|
-
|
|
3418
|
+
_chunkYO3DF4UKcjs.CELL_EDGES.set(a, { t: u.t, b: d.b, l: u.l || d.l, r: u.r || d.r });
|
|
3346
3419
|
}
|
|
3347
3420
|
|
|
3348
3421
|
// src/pdf/cell-extract.ts
|
|
@@ -3518,7 +3591,7 @@ function tagScripts(text, lines) {
|
|
|
3518
3591
|
const [s, e, kind] = marks[m];
|
|
3519
3592
|
out = out.slice(0, s) + `<${kind}>` + out.slice(s, e) + `</${kind}>` + out.slice(e);
|
|
3520
3593
|
}
|
|
3521
|
-
return
|
|
3594
|
+
return _chunkYO3DF4UKcjs.tidyScriptTags.call(void 0, out);
|
|
3522
3595
|
}
|
|
3523
3596
|
|
|
3524
3597
|
// src/pdf/line-wrap.ts
|
|
@@ -3939,7 +4012,7 @@ function keepWordsInOneCell(result) {
|
|
|
3939
4012
|
const ca = owner.get(a), cb = owner.get(b);
|
|
3940
4013
|
return ca !== cb && /^[·•‧∙․ㆍ]$/.test(a.text) && ca.row === cb.row && ca.rowSpan === cb.rowSpan && ca.col + ca.colSpan === cb.col && Math.abs(ca.bbox.x2 - cb.bbox.x1) <= 1 && a.x >= ca.bbox.x1 - 1 && b.x >= cb.bbox.x1 - 1;
|
|
3941
4014
|
};
|
|
3942
|
-
const value = /^[-+−]?[\d
|
|
4015
|
+
const value = /^[-+−]?[\d.,:]+%?$/;
|
|
3943
4016
|
const ocrValues = (a, b) => a.fontName === "ocr" && b.fontName === "ocr" && value.test(a.text.trim()) && value.test(b.text.trim());
|
|
3944
4017
|
const all = [...owner.keys()].sort((a, b) => b.y - a.y || a.x - b.x);
|
|
3945
4018
|
for (let i = 0; i < all.length; ) {
|
|
@@ -6933,9 +7006,9 @@ function detectHeadings(blocks, medianFontSize) {
|
|
|
6933
7006
|
if (/^\d+$/.test(text) && !isChapterNumber(block, blocks[bi + 1], medianFontSize)) continue;
|
|
6934
7007
|
const ratio = block.style.fontSize / medianFontSize;
|
|
6935
7008
|
let level = 0;
|
|
6936
|
-
if (ratio >=
|
|
6937
|
-
else if (ratio >=
|
|
6938
|
-
else if (ratio >=
|
|
7009
|
+
if (ratio >= _chunkYO3DF4UKcjs.HEADING_RATIO_H1) level = 1;
|
|
7010
|
+
else if (ratio >= _chunkYO3DF4UKcjs.HEADING_RATIO_H2) level = 2;
|
|
7011
|
+
else if (ratio >= _chunkYO3DF4UKcjs.HEADING_RATIO_H3) level = 3;
|
|
6939
7012
|
if (level > 0) {
|
|
6940
7013
|
block.type = "heading";
|
|
6941
7014
|
block.level = level;
|
|
@@ -6948,7 +7021,7 @@ function isChapterNumber(block, next, medianFontSize) {
|
|
|
6948
7021
|
const nextSize = _nullishCoalesce(_optionalChain([next, 'optionalAccess', _195 => _195.style, 'optionalAccess', _196 => _196.fontSize]), () => ( 0));
|
|
6949
7022
|
const text = _nullishCoalesce(_optionalChain([next, 'optionalAccess', _197 => _197.text, 'optionalAccess', _198 => _198.trim, 'call', _199 => _199()]), () => ( ""));
|
|
6950
7023
|
const a = block.bbox, b = _optionalChain([next, 'optionalAccess', _200 => _200.bbox]);
|
|
6951
|
-
return /^\d{1,2}$/.test(_nullishCoalesce(_optionalChain([block, 'access', _201 => _201.text, 'optionalAccess', _202 => _202.trim, 'call', _203 => _203()]), () => ( ""))) && size >= medianFontSize * 2.5 && !!next && (next.type === "paragraph" || next.type === "heading") && next.pageNumber === block.pageNumber && nextSize >= medianFontSize *
|
|
7024
|
+
return /^\d{1,2}$/.test(_nullishCoalesce(_optionalChain([block, 'access', _201 => _201.text, 'optionalAccess', _202 => _202.trim, 'call', _203 => _203()]), () => ( ""))) && size >= medianFontSize * 2.5 && !!next && (next.type === "paragraph" || next.type === "heading") && next.pageNumber === block.pageNumber && nextSize >= medianFontSize * _chunkYO3DF4UKcjs.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;
|
|
6952
7025
|
}
|
|
6953
7026
|
function mergeStackedHeadingLines(blocks, medianFontSize) {
|
|
6954
7027
|
for (let i = 0; i < blocks.length - 1; ) {
|
|
@@ -8718,16 +8791,16 @@ function isProseSpread(items) {
|
|
|
8718
8791
|
for (let i = 1; i < sorted.length; i++) {
|
|
8719
8792
|
gaps.push(sorted[i].x - (sorted[i - 1].x + sorted[i - 1].w));
|
|
8720
8793
|
}
|
|
8721
|
-
const maxGap =
|
|
8794
|
+
const maxGap = _chunk2NQ2U5WGcjs.safeMax.call(void 0, gaps);
|
|
8722
8795
|
const avgLen = items.reduce((s, i) => s + i.text.length, 0) / items.length;
|
|
8723
8796
|
if (items.length >= 4 && maxGap < 40 && avgLen < 5) return true;
|
|
8724
|
-
const minGap =
|
|
8797
|
+
const minGap = _chunk2NQ2U5WGcjs.safeMin.call(void 0, gaps);
|
|
8725
8798
|
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)));
|
|
8726
8799
|
}
|
|
8727
8800
|
function detectColumns(yLines) {
|
|
8728
8801
|
const allItems = yLines.flat();
|
|
8729
8802
|
if (allItems.length === 0) return null;
|
|
8730
|
-
const pageWidth =
|
|
8803
|
+
const pageWidth = _chunk2NQ2U5WGcjs.safeMax.call(void 0, allItems.map((i) => i.x + i.w)) - _chunk2NQ2U5WGcjs.safeMin.call(void 0, allItems.map((i) => i.x));
|
|
8731
8804
|
if (pageWidth < 100) return null;
|
|
8732
8805
|
let bigoLineIdx = -1;
|
|
8733
8806
|
for (let i = 0; i < yLines.length; i++) {
|
|
@@ -9125,13 +9198,13 @@ function partTex(group) {
|
|
|
9125
9198
|
const base = Math.min(...g.filter((i) => i.fontSize >= size * SCRIPT_SIZE_RATIO).map((i) => i.y));
|
|
9126
9199
|
let s = "", run = "";
|
|
9127
9200
|
const flush = () => {
|
|
9128
|
-
if (run) s +=
|
|
9201
|
+
if (run) s += _chunkYO3DF4UKcjs.toTex.call(void 0, run);
|
|
9129
9202
|
run = "";
|
|
9130
9203
|
};
|
|
9131
9204
|
g.forEach((it, k) => {
|
|
9132
9205
|
if (it.fontSize < size * SCRIPT_SIZE_RATIO && it.y - base >= size * SCRIPT_RISE_EM) {
|
|
9133
9206
|
flush();
|
|
9134
|
-
s += `^{${
|
|
9207
|
+
s += `^{${_chunkYO3DF4UKcjs.toTex.call(void 0, it.text)}}`;
|
|
9135
9208
|
return;
|
|
9136
9209
|
}
|
|
9137
9210
|
if (k && it.x - (g[k - 1].x + g[k - 1].w) > spaceGapThreshold(it.fontSize)) run += " ";
|
|
@@ -9304,7 +9377,7 @@ function rebuildUnitLine(items, grid) {
|
|
|
9304
9377
|
function prependUnitRow(cells, cols, line, usedItems) {
|
|
9305
9378
|
const text = cleanCellText(line.map((item) => item.text).join(""));
|
|
9306
9379
|
cells.unshift(Array.from({ length: cols }, (_, c) => ({ text: c === 0 ? text : "", colSpan: c === 0 ? cols : 1, rowSpan: 1 })));
|
|
9307
|
-
for (const cell of cells[0])
|
|
9380
|
+
for (const cell of cells[0]) _chunkYO3DF4UKcjs.CELL_EDGES.set(cell, NO_EDGES);
|
|
9308
9381
|
for (const item of line) usedItems.add(item);
|
|
9309
9382
|
}
|
|
9310
9383
|
function attachUnitRow(items, grid, cells, cols, usedItems) {
|
|
@@ -9886,7 +9959,7 @@ function recordFrameTitle(table, source, pageNum) {
|
|
|
9886
9959
|
const [label, spacer, title] = cells;
|
|
9887
9960
|
if (!/^(?:붙임|별첨|첨부|부록)\s*\d{1,3}$/.test(label.text.trim()) || spacer.text.trim() || !title.text.trim()) return;
|
|
9888
9961
|
if (cells.some((c) => {
|
|
9889
|
-
const e =
|
|
9962
|
+
const e = _chunkYO3DF4UKcjs.CELL_EDGES.get(c);
|
|
9890
9963
|
return !e || e.t || e.b || e.l || e.r;
|
|
9891
9964
|
})) return;
|
|
9892
9965
|
const xs = TABLE_COLXS.get(table), style = dominantStyle(source), fs = _nullishCoalesce(_optionalChain([style, 'optionalAccess', _395 => _395.fontSize]), () => ( 0));
|
|
@@ -10647,7 +10720,7 @@ function extractBlocksWithGrids(items, pageNum, pageWidth, pageHeight, grids, ho
|
|
|
10647
10720
|
groupSizes.push(1);
|
|
10648
10721
|
}
|
|
10649
10722
|
const allY = remaining.map((i) => i.y);
|
|
10650
|
-
const pageH =
|
|
10723
|
+
const pageH = _chunk2NQ2U5WGcjs.safeMax.call(void 0, allY) - _chunk2NQ2U5WGcjs.safeMin.call(void 0, allY);
|
|
10651
10724
|
const gapThreshold = Math.max(15, pageH * 0.03);
|
|
10652
10725
|
const sides = frameColumnTextBands(remaining, spanning, gx);
|
|
10653
10726
|
const textBlocks = [];
|
|
@@ -10663,7 +10736,7 @@ function extractBlocksWithGrids(items, pageNum, pageWidth, pageHeight, grids, ho
|
|
|
10663
10736
|
finalTextBlocks.push(...detectListBlocks(textBlocks));
|
|
10664
10737
|
} else {
|
|
10665
10738
|
const allY = remaining.map((i) => i.y);
|
|
10666
|
-
const pageH =
|
|
10739
|
+
const pageH = _chunk2NQ2U5WGcjs.safeMax.call(void 0, allY) - _chunk2NQ2U5WGcjs.safeMin.call(void 0, allY);
|
|
10667
10740
|
const gapThreshold = Math.max(15, pageH * 0.03);
|
|
10668
10741
|
const groups = xyCutOrder(remaining, gapThreshold);
|
|
10669
10742
|
const textBlocks = [];
|
|
@@ -11025,7 +11098,7 @@ function extractPageBlocksFallback(items, pageNum, fullPage = false, detectTable
|
|
|
11025
11098
|
blocks.push(...columnTextToBlocks(tableText, pageNum, bbox, dominantStyle(items)));
|
|
11026
11099
|
} else {
|
|
11027
11100
|
const allY = items.map((i) => i.y);
|
|
11028
|
-
const pageHeight =
|
|
11101
|
+
const pageHeight = _chunk2NQ2U5WGcjs.safeMax.call(void 0, allY) - _chunk2NQ2U5WGcjs.safeMin.call(void 0, allY);
|
|
11029
11102
|
const gapThreshold = Math.max(15, pageHeight * 0.03);
|
|
11030
11103
|
const orderedGroups = proseCutX !== null ? splitTwoColumnProse(items, proseCutX) : xyCutOrder(items, gapThreshold, 0, void 0, minGap);
|
|
11031
11104
|
for (const group of orderedGroups) {
|
|
@@ -11295,4 +11368,4 @@ function rowParagraphs(block) {
|
|
|
11295
11368
|
|
|
11296
11369
|
|
|
11297
11370
|
exports.DEFAULT_OCR_MODELS = DEFAULT_OCR_MODELS; exports.resolveOcrModels = resolveOcrModels; exports.handwritingFallbackModels = handwritingFallbackModels; exports.ocrSelectionKey = ocrSelectionKey; exports.ocrSourcePath = ocrSourcePath; exports.ensureOcrModelsFor = ensureOcrModelsFor; exports.ocrModelsCached = ocrModelsCached; exports.parseCharacterDict = parseCharacterDict; exports.grayCrop = grayCrop; exports.inkStats = inkStats; exports.splitRowBands = splitRowBands; exports.leadingTriangle = leadingTriangle; exports.arrowGlyph = arrowGlyph; exports.leaderRuns = leaderRuns; exports.inkBounds = inkBounds; exports.bracketFeatures = bracketFeatures; exports.slantedPair = slantedPair; exports.romanStems = romanStems; exports.circledAt = circledAt; exports.ringBoxes = ringBoxes; exports.quoteHead = quoteHead; exports.edgeTrim = edgeTrim; exports.tallInkCount = tallInkCount; exports.gapGlyphs = gapGlyphs; exports.ringBullet = ringBullet; exports.dashRatio = dashRatio; exports.leadingRing = leadingRing; exports.discAt = discAt; exports.serifOne = serifOne; exports.starRun = starRun; exports.bracketShape = bracketShape; exports.leadingBullet = leadingBullet; exports.stackedGlyphBands = stackedGlyphBands; exports.rememberOcrTextGaps = rememberOcrTextGaps; exports.copyOcrTextGaps = copyOcrTextGaps; exports.findOcrTextGaps = findOcrTextGaps; 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;
|
|
11298
|
-
//# sourceMappingURL=chunk-
|
|
11371
|
+
//# sourceMappingURL=chunk-6ZQ2SVBP.cjs.map
|