kordoc 4.24.75 → 4.24.77
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 +3 -3
- package/dist/{-IA5KLKYE.js → -5UTN72IU.js} +22 -22
- package/dist/{chunk-XNHDKTTV.cjs → chunk-3FCFBMS5.cjs} +6 -6
- package/dist/{chunk-XNHDKTTV.cjs.map → chunk-3FCFBMS5.cjs.map} +1 -1
- package/dist/{chunk-TSACZSXD.js → chunk-4MAW3JZO.js} +2 -2
- package/dist/{chunk-SODVNDR5.js → chunk-5D25RVT5.js} +5 -5
- package/dist/{chunk-IITWVZF5.js → chunk-5TM34VJ5.js} +2 -2
- package/dist/{chunk-YIW4AEC6.js → chunk-5XWGKCPA.js} +2 -2
- package/dist/{chunk-2RTRPVUB.js → chunk-67WGWE23.js} +4 -4
- package/dist/{chunk-BIHQG2N7.js → chunk-6P3XVII7.js} +3 -3
- package/dist/{chunk-M33WZZPM.js → chunk-7AWQXTSU.js} +2 -2
- package/dist/{chunk-RYYDGS4R.js → chunk-7Y2RNRWL.js} +5 -5
- package/dist/{chunk-7USEKDFP.js → chunk-A7VTEP5R.js} +2 -2
- package/dist/{chunk-SJG57YQQ.js → chunk-AMSLIVAC.js} +2 -2
- package/dist/{chunk-N564V2TH.js → chunk-AOBRIYGM.js} +2 -2
- package/dist/{chunk-XV6A6WHZ.js → chunk-BFAGTWOT.js} +61 -16
- package/dist/chunk-BFAGTWOT.js.map +1 -0
- package/dist/{chunk-NNTUIJLC.js → chunk-BPMDM3JP.js} +2 -2
- package/dist/{chunk-XJNRTANY.js → chunk-CG4BCYQ2.js} +2 -2
- package/dist/{chunk-UXWF3PM7.js → chunk-CNUWB5NK.js} +2 -2
- package/dist/{chunk-SDQZSUFR.js → chunk-D4XGVKQV.js} +6 -6
- package/dist/{chunk-HY3LV5HN.cjs → chunk-DGOTUUCW.cjs} +3 -3
- package/dist/{chunk-HY3LV5HN.cjs.map → chunk-DGOTUUCW.cjs.map} +1 -1
- package/dist/{chunk-NI3YCMGC.cjs → chunk-DZX2B4CB.cjs} +2 -2
- package/dist/{chunk-NI3YCMGC.cjs.map → chunk-DZX2B4CB.cjs.map} +1 -1
- package/dist/{chunk-SOW4ES4Y.js → chunk-EFLSK5JD.js} +2 -2
- package/dist/{chunk-6F54BTUN.cjs → chunk-ENGSBT44.cjs} +3 -3
- package/dist/{chunk-6F54BTUN.cjs.map → chunk-ENGSBT44.cjs.map} +1 -1
- package/dist/{chunk-JQ6N26LA.js → chunk-ERMTVALW.js} +2 -2
- package/dist/{chunk-XJID65VS.js → chunk-F33LA2ET.js} +111 -12
- package/dist/chunk-F33LA2ET.js.map +1 -0
- package/dist/{chunk-FZMAFLAY.js → chunk-GCUP3CBW.js} +5 -5
- package/dist/{chunk-FV57PXPQ.js → chunk-GUTZU7XE.js} +3 -3
- package/dist/{chunk-V5XT2PRB.js → chunk-H7HRVW32.js} +2 -2
- package/dist/{chunk-QKOORIR2.cjs → chunk-HDDU4LP5.cjs} +104 -104
- package/dist/{chunk-QKOORIR2.cjs.map → chunk-HDDU4LP5.cjs.map} +1 -1
- package/dist/{chunk-7JMND4DW.cjs → chunk-JVM237XE.cjs} +88 -88
- package/dist/{chunk-7JMND4DW.cjs.map → chunk-JVM237XE.cjs.map} +1 -1
- package/dist/{chunk-ZOXPQZ4D.js → chunk-K6YLVT6X.js} +11 -11
- package/dist/{chunk-GBOVNTH6.js → chunk-LGQ75OKH.js} +60 -15
- package/dist/chunk-LGQ75OKH.js.map +1 -0
- package/dist/{chunk-TOBOXNSE.cjs → chunk-LHHZZVRD.cjs} +8 -8
- package/dist/{chunk-TOBOXNSE.cjs.map → chunk-LHHZZVRD.cjs.map} +1 -1
- package/dist/{chunk-QQTMRZUG.cjs → chunk-O5IIMWXC.cjs} +209 -164
- package/dist/chunk-O5IIMWXC.cjs.map +1 -0
- package/dist/{chunk-S3RWTPEO.js → chunk-OLO76CMN.js} +3 -3
- package/dist/{chunk-MG2DFKP7.js → chunk-P6GTNKAA.js} +2 -2
- package/dist/{chunk-CXQXLQVT.js → chunk-QJ7MMZUI.js} +2 -2
- package/dist/{chunk-H7OEE7UV.js → chunk-QWK3DGUI.js} +16 -16
- package/dist/{chunk-OQAE5NDF.js → chunk-SAUEKG7G.js} +3 -3
- package/dist/{chunk-IPR3I6YO.js → chunk-SKP4XXCB.js} +2 -2
- package/dist/{chunk-WQQVAAPX.js → chunk-T424VUF7.js} +2 -2
- package/dist/{chunk-BX6TAXOM.js → chunk-UFTF2BO7.js} +2 -2
- package/dist/{chunk-SEO3FQLR.cjs → chunk-UIHCY476.cjs} +58 -58
- package/dist/{chunk-SEO3FQLR.cjs.map → chunk-UIHCY476.cjs.map} +1 -1
- package/dist/{chunk-DZPF2PWU.js → chunk-UN3YZZNT.js} +2 -2
- package/dist/{chunk-RGSVM7RL.js → chunk-XY5BFX3H.js} +6 -6
- package/dist/{chunk-UNIYOWUQ.js → chunk-Y2RWVFGG.js} +7 -7
- package/dist/{chunk-CJYGYR2V.js → chunk-YSOXWADD.js} +2 -2
- package/dist/{chunk-RJBQXQAM.js → chunk-ZZNZGQRX.js} +2 -2
- package/dist/chunks-QN364YXU.js +11 -0
- package/dist/cli.js +46 -46
- package/dist/{formula-XSFAUBCL.js → formula-37OIV2H3.js} +4 -4
- package/dist/{formula-PMHBDDCI.js → formula-P6EJMUKF.js} +3 -3
- package/dist/{formula-VPH2VTGN.cjs → formula-YN4NKDPV.cjs} +9 -9
- package/dist/{formula-VPH2VTGN.cjs.map → formula-YN4NKDPV.cjs.map} +1 -1
- package/dist/generator-6YDUW5RE.cjs +12 -0
- package/dist/{generator-GFSOVACB.cjs.map → generator-6YDUW5RE.cjs.map} +1 -1
- package/dist/generator-C5FWPI6A.js +18 -0
- package/dist/generator-JX3OZYTO.js +11 -0
- package/dist/{hancom-MOQ5X7BT.js → hancom-547ZXYYE.js} +2 -2
- package/dist/{hancom-Q2VC3YBY.js → hancom-GOOSRL7W.js} +2 -2
- package/dist/{hancom-UZAYAZLU.cjs → hancom-LKRD7PXX.cjs} +5 -5
- package/dist/{hancom-UZAYAZLU.cjs.map → hancom-LKRD7PXX.cjs.map} +1 -1
- package/dist/{image-ocr-KVV5JKY6.js → image-ocr-6HQTBMLN.js} +11 -11
- package/dist/{image-ocr-4RGMDWKZ.cjs → image-ocr-EZEOBMEQ.cjs} +36 -36
- package/dist/{image-ocr-4RGMDWKZ.cjs.map → image-ocr-EZEOBMEQ.cjs.map} +1 -1
- package/dist/{image-ocr-2Q2ZJYAJ.js → image-ocr-RNY2H3HS.js} +8 -8
- package/dist/index.cjs +1214 -1115
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +111 -12
- package/dist/index.js.map +1 -1
- package/dist/mcp.js +37 -37
- package/dist/memo-RE3TCSXK.js +17 -0
- package/dist/{model-bundle-SKRKICE4.js → model-bundle-ZYGK4G65.js} +5 -5
- package/dist/{models-QRQ4SU52.js → models-K65TUK4Q.js} +5 -5
- package/dist/{parse-worker-v2-4BSQYNJ4.js → parse-worker-v2-VOM4DPZV.js} +23 -23
- package/dist/{parser-B6YSYZTH.js → parser-6KOCPC6H.js} +22 -13
- package/dist/{parser-B6YSYZTH.js.map → parser-6KOCPC6H.js.map} +1 -1
- package/dist/{parser-N5CJ252P.cjs → parser-7V6AQMPT.cjs} +176 -167
- package/dist/parser-7V6AQMPT.cjs.map +1 -0
- package/dist/{parser-LVDXYJ2F.js → parser-SNW4ZFUX.js} +19 -10
- package/dist/{parser-LVDXYJ2F.js.map → parser-SNW4ZFUX.js.map} +1 -1
- package/dist/{pdf-ocr-5X2ZFG5O.js → pdf-ocr-2JDCK34V.js} +9 -9
- package/dist/pdf-ocr-A4GJJCT3.cjs +43 -0
- package/dist/{pdf-ocr-ZEP6O2UV.cjs.map → pdf-ocr-A4GJJCT3.cjs.map} +1 -1
- package/dist/{pdf-ocr-BJFC7NL3.js → pdf-ocr-JNCOGFLO.js} +6 -6
- package/dist/{profile-io-C55VLUZW.js → profile-io-WHUZPJEM.js} +3 -3
- package/dist/{rasterize-LCD3Q43I.js → rasterize-XR5V2FQQ.js} +3 -3
- package/dist/{redact-doc-BKNJOYE3.js → redact-doc-5FMV7KOY.js} +22 -22
- package/dist/{render-TWO5VQNJ.js → render-OKC4QJUY.js} +12 -12
- package/dist/{rewrite-fallback-AH3RNFIL.js → rewrite-fallback-Y6ZUV6GG.js} +13 -13
- package/dist/seal-VMMMFVLG.js +16 -0
- package/dist/{setup-VPGX6IJS.js → setup-Q6CIDVRW.js} +3 -3
- package/dist/to-hwpx-B7RPAOQC.cjs +16 -0
- package/dist/{to-hwpx-LJQWVGOZ.cjs.map → to-hwpx-B7RPAOQC.cjs.map} +1 -1
- package/dist/{to-hwpx-TZFO5KL2.js → to-hwpx-BS2NFDUM.js} +4 -4
- package/dist/{to-hwpx-JUWORW4M.js → to-hwpx-XFNMYMGR.js} +7 -7
- package/dist/visual-SECUV4LR.js +40 -0
- package/dist/{watch-3J3O5GZN.js → watch-ADXQOSZY.js} +23 -23
- package/package.json +1 -1
- package/dist/chunk-GBOVNTH6.js.map +0 -1
- package/dist/chunk-QQTMRZUG.cjs.map +0 -1
- package/dist/chunk-XJID65VS.js.map +0 -1
- package/dist/chunk-XV6A6WHZ.js.map +0 -1
- package/dist/chunks-SC2MGE4B.js +0 -11
- package/dist/generator-4P5RXII7.js +0 -18
- package/dist/generator-GFSOVACB.cjs +0 -12
- package/dist/generator-NABTD6TU.js +0 -11
- package/dist/memo-K65K6E5J.js +0 -17
- package/dist/parser-N5CJ252P.cjs.map +0 -1
- package/dist/pdf-ocr-ZEP6O2UV.cjs +0 -43
- package/dist/seal-OCTCBT5O.js +0 -16
- package/dist/to-hwpx-LJQWVGOZ.cjs +0 -16
- package/dist/visual-SDJQ6EGR.js +0 -40
- /package/dist/{-IA5KLKYE.js.map → -5UTN72IU.js.map} +0 -0
- /package/dist/{chunk-TSACZSXD.js.map → chunk-4MAW3JZO.js.map} +0 -0
- /package/dist/{chunk-SODVNDR5.js.map → chunk-5D25RVT5.js.map} +0 -0
- /package/dist/{chunk-IITWVZF5.js.map → chunk-5TM34VJ5.js.map} +0 -0
- /package/dist/{chunk-YIW4AEC6.js.map → chunk-5XWGKCPA.js.map} +0 -0
- /package/dist/{chunk-2RTRPVUB.js.map → chunk-67WGWE23.js.map} +0 -0
- /package/dist/{chunk-BIHQG2N7.js.map → chunk-6P3XVII7.js.map} +0 -0
- /package/dist/{chunk-M33WZZPM.js.map → chunk-7AWQXTSU.js.map} +0 -0
- /package/dist/{chunk-RYYDGS4R.js.map → chunk-7Y2RNRWL.js.map} +0 -0
- /package/dist/{chunk-7USEKDFP.js.map → chunk-A7VTEP5R.js.map} +0 -0
- /package/dist/{chunk-SJG57YQQ.js.map → chunk-AMSLIVAC.js.map} +0 -0
- /package/dist/{chunk-N564V2TH.js.map → chunk-AOBRIYGM.js.map} +0 -0
- /package/dist/{chunk-NNTUIJLC.js.map → chunk-BPMDM3JP.js.map} +0 -0
- /package/dist/{chunk-XJNRTANY.js.map → chunk-CG4BCYQ2.js.map} +0 -0
- /package/dist/{chunk-UXWF3PM7.js.map → chunk-CNUWB5NK.js.map} +0 -0
- /package/dist/{chunk-SDQZSUFR.js.map → chunk-D4XGVKQV.js.map} +0 -0
- /package/dist/{chunk-SOW4ES4Y.js.map → chunk-EFLSK5JD.js.map} +0 -0
- /package/dist/{chunk-JQ6N26LA.js.map → chunk-ERMTVALW.js.map} +0 -0
- /package/dist/{chunk-FZMAFLAY.js.map → chunk-GCUP3CBW.js.map} +0 -0
- /package/dist/{chunk-FV57PXPQ.js.map → chunk-GUTZU7XE.js.map} +0 -0
- /package/dist/{chunk-V5XT2PRB.js.map → chunk-H7HRVW32.js.map} +0 -0
- /package/dist/{chunk-ZOXPQZ4D.js.map → chunk-K6YLVT6X.js.map} +0 -0
- /package/dist/{chunk-S3RWTPEO.js.map → chunk-OLO76CMN.js.map} +0 -0
- /package/dist/{chunk-MG2DFKP7.js.map → chunk-P6GTNKAA.js.map} +0 -0
- /package/dist/{chunk-CXQXLQVT.js.map → chunk-QJ7MMZUI.js.map} +0 -0
- /package/dist/{chunk-H7OEE7UV.js.map → chunk-QWK3DGUI.js.map} +0 -0
- /package/dist/{chunk-OQAE5NDF.js.map → chunk-SAUEKG7G.js.map} +0 -0
- /package/dist/{chunk-IPR3I6YO.js.map → chunk-SKP4XXCB.js.map} +0 -0
- /package/dist/{chunk-WQQVAAPX.js.map → chunk-T424VUF7.js.map} +0 -0
- /package/dist/{chunk-BX6TAXOM.js.map → chunk-UFTF2BO7.js.map} +0 -0
- /package/dist/{chunk-DZPF2PWU.js.map → chunk-UN3YZZNT.js.map} +0 -0
- /package/dist/{chunk-RGSVM7RL.js.map → chunk-XY5BFX3H.js.map} +0 -0
- /package/dist/{chunk-UNIYOWUQ.js.map → chunk-Y2RWVFGG.js.map} +0 -0
- /package/dist/{chunk-CJYGYR2V.js.map → chunk-YSOXWADD.js.map} +0 -0
- /package/dist/{chunk-RJBQXQAM.js.map → chunk-ZZNZGQRX.js.map} +0 -0
- /package/dist/{chunks-SC2MGE4B.js.map → chunks-QN364YXU.js.map} +0 -0
- /package/dist/{formula-XSFAUBCL.js.map → formula-37OIV2H3.js.map} +0 -0
- /package/dist/{formula-PMHBDDCI.js.map → formula-P6EJMUKF.js.map} +0 -0
- /package/dist/{generator-4P5RXII7.js.map → generator-C5FWPI6A.js.map} +0 -0
- /package/dist/{generator-NABTD6TU.js.map → generator-JX3OZYTO.js.map} +0 -0
- /package/dist/{hancom-MOQ5X7BT.js.map → hancom-547ZXYYE.js.map} +0 -0
- /package/dist/{hancom-Q2VC3YBY.js.map → hancom-GOOSRL7W.js.map} +0 -0
- /package/dist/{image-ocr-KVV5JKY6.js.map → image-ocr-6HQTBMLN.js.map} +0 -0
- /package/dist/{image-ocr-2Q2ZJYAJ.js.map → image-ocr-RNY2H3HS.js.map} +0 -0
- /package/dist/{memo-K65K6E5J.js.map → memo-RE3TCSXK.js.map} +0 -0
- /package/dist/{model-bundle-SKRKICE4.js.map → model-bundle-ZYGK4G65.js.map} +0 -0
- /package/dist/{models-QRQ4SU52.js.map → models-K65TUK4Q.js.map} +0 -0
- /package/dist/{parse-worker-v2-4BSQYNJ4.js.map → parse-worker-v2-VOM4DPZV.js.map} +0 -0
- /package/dist/{pdf-ocr-5X2ZFG5O.js.map → pdf-ocr-2JDCK34V.js.map} +0 -0
- /package/dist/{pdf-ocr-BJFC7NL3.js.map → pdf-ocr-JNCOGFLO.js.map} +0 -0
- /package/dist/{profile-io-C55VLUZW.js.map → profile-io-WHUZPJEM.js.map} +0 -0
- /package/dist/{rasterize-LCD3Q43I.js.map → rasterize-XR5V2FQQ.js.map} +0 -0
- /package/dist/{redact-doc-BKNJOYE3.js.map → redact-doc-5FMV7KOY.js.map} +0 -0
- /package/dist/{render-TWO5VQNJ.js.map → render-OKC4QJUY.js.map} +0 -0
- /package/dist/{rewrite-fallback-AH3RNFIL.js.map → rewrite-fallback-Y6ZUV6GG.js.map} +0 -0
- /package/dist/{seal-OCTCBT5O.js.map → seal-VMMMFVLG.js.map} +0 -0
- /package/dist/{setup-VPGX6IJS.js.map → setup-Q6CIDVRW.js.map} +0 -0
- /package/dist/{to-hwpx-JUWORW4M.js.map → to-hwpx-BS2NFDUM.js.map} +0 -0
- /package/dist/{to-hwpx-TZFO5KL2.js.map → to-hwpx-XFNMYMGR.js.map} +0 -0
- /package/dist/{visual-SDJQ6EGR.js.map → visual-SECUV4LR.js.map} +0 -0
- /package/dist/{watch-3J3O5GZN.js.map → watch-ADXQOSZY.js.map} +0 -0
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
|
|
4
4
|
|
|
5
5
|
|
|
6
|
-
var
|
|
6
|
+
var _chunkDGOTUUCWcjs = require('./chunk-DGOTUUCW.cjs');
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
|
|
@@ -71,11 +71,11 @@ var _chunkHHLZQQNLcjs = require('./chunk-HHLZQQNL.cjs');
|
|
|
71
71
|
|
|
72
72
|
|
|
73
73
|
|
|
74
|
-
var
|
|
74
|
+
var _chunkO5IIMWXCcjs = require('./chunk-O5IIMWXC.cjs');
|
|
75
75
|
|
|
76
76
|
|
|
77
77
|
var _chunkMMK32GPDcjs = require('./chunk-MMK32GPD.cjs');
|
|
78
|
-
require('./chunk-
|
|
78
|
+
require('./chunk-ENGSBT44.cjs');
|
|
79
79
|
|
|
80
80
|
|
|
81
81
|
|
|
@@ -92,11 +92,11 @@ require('./chunk-6F54BTUN.cjs');
|
|
|
92
92
|
|
|
93
93
|
|
|
94
94
|
|
|
95
|
-
var
|
|
95
|
+
var _chunkLHHZZVRDcjs = require('./chunk-LHHZZVRD.cjs');
|
|
96
96
|
|
|
97
97
|
|
|
98
98
|
|
|
99
|
-
var
|
|
99
|
+
var _chunkDZX2B4CBcjs = require('./chunk-DZX2B4CB.cjs');
|
|
100
100
|
|
|
101
101
|
|
|
102
102
|
var _chunkGS7T56RPcjs = require('./chunk-GS7T56RP.cjs');
|
|
@@ -429,7 +429,7 @@ async function extractPageImages(page, fnArray, argsArray, pageNumber, state, wa
|
|
|
429
429
|
let pristine;
|
|
430
430
|
let paintIndex = -1;
|
|
431
431
|
const regions = state.placement ? /* @__PURE__ */ new Map() : void 0;
|
|
432
|
-
if (regions)
|
|
432
|
+
if (regions) _chunkO5IIMWXCcjs.extractImageRegions.call(void 0, fnArray, argsArray, false, regions);
|
|
433
433
|
const placed = (block, i) => {
|
|
434
434
|
const r = _optionalChain([regions, 'optionalAccess', _4 => _4.get, 'call', _5 => _5(i)]);
|
|
435
435
|
if (r) block.bbox = { page: pageNumber, x: r.x1, y: r.y1, width: r.x2 - r.x1, height: r.y2 - r.y1 };
|
|
@@ -511,7 +511,7 @@ async function extractPageImages(page, fnArray, argsArray, pageNumber, state, wa
|
|
|
511
511
|
if (state.seen.has(hash)) continue;
|
|
512
512
|
const rgba = toRgba(imgData, withBytes || !!readQr || state.dropBlank);
|
|
513
513
|
if (!rgba) continue;
|
|
514
|
-
if (state.dropBlank &&
|
|
514
|
+
if (state.dropBlank && _chunkDGOTUUCWcjs.isBlankRgba.call(void 0, rgba)) {
|
|
515
515
|
state.seen.set(hash, "");
|
|
516
516
|
continue;
|
|
517
517
|
}
|
|
@@ -611,7 +611,7 @@ async function extractPdfiumImage(image, pageNumber, state, warnings, withBytes,
|
|
|
611
611
|
const hash = `${w}x${h}kPh${contentHash(rgba)}`;
|
|
612
612
|
state.rawKeys.set(image.raw, hash);
|
|
613
613
|
if (state.seen.has(hash)) return null;
|
|
614
|
-
if (state.dropBlank &&
|
|
614
|
+
if (state.dropBlank && _chunkDGOTUUCWcjs.isBlankRgba.call(void 0, rgba)) {
|
|
615
615
|
state.seen.set(hash, "");
|
|
616
616
|
return null;
|
|
617
617
|
}
|
|
@@ -1059,13 +1059,13 @@ function ocrVectorOps(opList, paths) {
|
|
|
1059
1059
|
|
|
1060
1060
|
// src/pdf/split-row-pattern.ts
|
|
1061
1061
|
var textOf = (cell) => cell.text.replace(/<\/?u>|~~/g, "").trim();
|
|
1062
|
-
var plain = (cell) => !_optionalChain([cell, 'access', _31 => _31.blocks, 'optionalAccess', _32 => _32.length]) && !
|
|
1062
|
+
var plain = (cell) => !_optionalChain([cell, 'access', _31 => _31.blocks, 'optionalAccess', _32 => _32.length]) && !_chunkO5IIMWXCcjs.IMAGE_CELLS.has(cell);
|
|
1063
1063
|
var labelsOf = (cell) => {
|
|
1064
1064
|
const labels = textOf(cell).split("\n").map((s) => s.trim()).filter(Boolean);
|
|
1065
1065
|
return labels.length && labels.every((s) => /^\p{L}[\p{L}\p{N} ]{0,15}[::]$/u.test(s)) ? labels.map((s) => s.replace(/\s+/g, "").replace(/:/g, ":")) : void 0;
|
|
1066
1066
|
};
|
|
1067
1067
|
var alignedLabels = (label, value, count) => {
|
|
1068
|
-
const L =
|
|
1068
|
+
const L = _chunkO5IIMWXCcjs.CELL_LINES.get(label), V = _chunkO5IIMWXCcjs.CELL_LINES.get(value);
|
|
1069
1069
|
let next = 0;
|
|
1070
1070
|
return !!L && !!V && L.length === count && V.length >= count && Math.abs(L[0].y - V[0].y) <= 1 && L.every((l) => {
|
|
1071
1071
|
while (next < V.length && Math.abs(l.y - V[next].y) > 1) next++;
|
|
@@ -1073,7 +1073,7 @@ var alignedLabels = (label, value, count) => {
|
|
|
1073
1073
|
});
|
|
1074
1074
|
};
|
|
1075
1075
|
function partialAlignedLabelCells(table, owner, first) {
|
|
1076
|
-
const pageOf = (a) => _nullishCoalesce(
|
|
1076
|
+
const pageOf = (a) => _nullishCoalesce(_chunkLHHZZVRDcjs.CELL_PAGES.get(_nullishCoalesce(a.cell, () => ( table.cells[a.r][a.c]))), () => ( (a.r < first ? -1 : -2)));
|
|
1077
1077
|
const pairs = [];
|
|
1078
1078
|
let carried = false;
|
|
1079
1079
|
for (let c = 0; c < table.cols; ) {
|
|
@@ -1096,10 +1096,10 @@ function partialAlignedLabelCells(table, owner, first) {
|
|
|
1096
1096
|
const keyed = pairs.filter((p) => labelsOf(p.upper) && labelsOf(p.lower));
|
|
1097
1097
|
if (keyed.length !== 1) return;
|
|
1098
1098
|
const label = keyed[0], value = pairs.find((p) => p.c === label.c + label.cs), context = pairs.find((p) => p.c + p.cs === label.c);
|
|
1099
|
-
if (!value || !context || value === context || textOf(context.upper).replace(/\s+/g, "") === textOf(context.lower).replace(/\s+/g, "") || !_optionalChain([
|
|
1099
|
+
if (!value || !context || value === context || textOf(context.upper).replace(/\s+/g, "") === textOf(context.lower).replace(/\s+/g, "") || !_optionalChain([_chunkLHHZZVRDcjs.CELL_EDGES, 'access', _43 => _43.get, 'call', _44 => _44(context.upper), 'optionalAccess', _45 => _45.b]) || !_optionalChain([_chunkLHHZZVRDcjs.CELL_EDGES, 'access', _46 => _46.get, 'call', _47 => _47(context.lower), 'optionalAccess', _48 => _48.t])) return;
|
|
1100
1100
|
const U = labelsOf(label.upper), D = labelsOf(label.lower), sequence = [...U, ...D];
|
|
1101
1101
|
if (D.length < 2 || sequence.length < 3 || new Set(sequence).size !== sequence.length || !alignedLabels(label.upper, value.upper, U.length)) return;
|
|
1102
|
-
const L =
|
|
1102
|
+
const L = _chunkO5IIMWXCcjs.CELL_LINES.get(label.lower), V = _chunkO5IIMWXCcjs.CELL_LINES.get(value.lower);
|
|
1103
1103
|
if (!L || !V || L.length !== D.length) return;
|
|
1104
1104
|
let next = V.findIndex((v) => Math.abs(v.y - L[0].y) <= 1);
|
|
1105
1105
|
if (next <= 0 || !V.slice(0, next).every((v) => v.y > L[0].y + 1) || !L.every((l) => {
|
|
@@ -1119,14 +1119,14 @@ function partialAlignedLabelCells(table, owner, first) {
|
|
|
1119
1119
|
continue;
|
|
1120
1120
|
}
|
|
1121
1121
|
if (list.length < 3 || new Set(list).size !== list.length) continue;
|
|
1122
|
-
const visible = _nullishCoalesce(_optionalChain([
|
|
1122
|
+
const visible = _nullishCoalesce(_optionalChain([_chunkO5IIMWXCcjs.CELL_LINES, 'access', _53 => _53.get, 'call', _54 => _54(lc), 'optionalAccess', _55 => _55.length]), () => ( 0)), values = _chunkO5IIMWXCcjs.CELL_LINES.get(vc);
|
|
1123
1123
|
if (visible < 3 || visible > list.length || !values || !alignedLabels(lc, vc, visible)) continue;
|
|
1124
1124
|
const top = Math.max(...values.map((v2) => v2.y)), bottom = Math.min(...values.map((v2) => v2.y));
|
|
1125
1125
|
const contexts = [];
|
|
1126
1126
|
for (let rr = r; rr < r + l.rs && rr < table.rows; rr++) {
|
|
1127
1127
|
const a = _optionalChain([owner, 'access', _56 => _56[rr], 'optionalAccess', _57 => _57[context.c]]), cell = a ? table.cells[a.r][a.c] : void 0;
|
|
1128
1128
|
if (!a || a.r !== rr || a.c !== context.c || a.cs !== context.cs || a.rs !== 1 || !cell || !plain(cell) || !textOf(cell) || pageOf(a) !== pageOf(l)) break;
|
|
1129
|
-
const lines =
|
|
1129
|
+
const lines = _chunkO5IIMWXCcjs.CELL_LINES.get(cell);
|
|
1130
1130
|
if (!_optionalChain([lines, 'optionalAccess', _58 => _58.length]) || lines.some((line) => line.y > top + 1 || line.y < bottom - 1)) break;
|
|
1131
1131
|
contexts.push(textOf(cell).replace(/\s+/g, ""));
|
|
1132
1132
|
}
|
|
@@ -1428,7 +1428,7 @@ function rowStarts(t) {
|
|
|
1428
1428
|
}
|
|
1429
1429
|
var covering = (t, r) => rowStarts(t).slice(0, r + 1).flatMap((starts, rr) => starts.filter((s) => rr + s.cell.rowSpan > r).map((s) => s.cell));
|
|
1430
1430
|
function cellPage(cell) {
|
|
1431
|
-
const p =
|
|
1431
|
+
const p = _chunkLHHZZVRDcjs.CELL_PAGES.get(cell);
|
|
1432
1432
|
if (p !== void 0 || !_optionalChain([cell, 'access', _125 => _125.blocks, 'optionalAccess', _126 => _126.length]) || cell.blocks.some((b) => b.pageNumber === void 0)) return p;
|
|
1433
1433
|
return Math.min(...cell.blocks.map((b) => b.pageNumber));
|
|
1434
1434
|
}
|
|
@@ -1457,7 +1457,7 @@ function markJoinedPages(table, prev, curr) {
|
|
|
1457
1457
|
rows.forEach((starts, r) => {
|
|
1458
1458
|
const page2 = r < pt.rows ? pp[r] : cp[r - off];
|
|
1459
1459
|
for (const { cell } of starts) {
|
|
1460
|
-
if (page2 !== void 0 && page2 !== prev.pageNumber)
|
|
1460
|
+
if (page2 !== void 0 && page2 !== prev.pageNumber) _chunkLHHZZVRDcjs.CELL_PAGES.set(cell, page2);
|
|
1461
1461
|
const src = _optionalChain([(r < pt.rows ? ptRows[r] : ctRows[r - off]), 'optionalAccess', _129 => _129.find, 'call', _130 => _130((s) => s.cell !== cell && s.cell.text === cell.text && CELL_SPLITS.has(s.cell))]);
|
|
1462
1462
|
if (src) setSplits(cell, relocate(src.cell, cell));
|
|
1463
1463
|
}
|
|
@@ -1517,8 +1517,8 @@ function splitCrossPageRows(t, pageNumber) {
|
|
|
1517
1517
|
if (!splits.length) continue;
|
|
1518
1518
|
const clone = (cell, patch) => {
|
|
1519
1519
|
const out = { ...cell, ...patch };
|
|
1520
|
-
const p =
|
|
1521
|
-
if (p !== void 0)
|
|
1520
|
+
const p = _chunkLHHZZVRDcjs.CELL_PAGES.get(cell);
|
|
1521
|
+
if (p !== void 0) _chunkLHHZZVRDcjs.CELL_PAGES.set(out, p);
|
|
1522
1522
|
if (!("text" in patch) && CELL_SPLITS.has(cell)) CELL_SPLITS.set(out, CELL_SPLITS.get(cell));
|
|
1523
1523
|
return out;
|
|
1524
1524
|
};
|
|
@@ -1529,7 +1529,7 @@ function splitCrossPageRows(t, pageNumber) {
|
|
|
1529
1529
|
for (const { cell, c, split } of splits) {
|
|
1530
1530
|
cells[r][c] = clone(cell, { ...split.head, rowSpan: cut - r });
|
|
1531
1531
|
const tail = { ...cell, ...split.tail, rowSpan: r + cell.rowSpan - cut };
|
|
1532
|
-
|
|
1532
|
+
_chunkLHHZZVRDcjs.CELL_PAGES.set(tail, split.page);
|
|
1533
1533
|
setSplits(tail, split.rest);
|
|
1534
1534
|
cells[cut][c] = tail;
|
|
1535
1535
|
}
|
|
@@ -1539,7 +1539,7 @@ function splitCrossPageRows(t, pageNumber) {
|
|
|
1539
1539
|
for (const { cell, c, split } of splits) {
|
|
1540
1540
|
cells[r][c] = clone(cell, split.head);
|
|
1541
1541
|
const tail = { ...cell, ...split.tail, rowSpan: 1 };
|
|
1542
|
-
|
|
1542
|
+
_chunkLHHZZVRDcjs.CELL_PAGES.set(tail, split.page);
|
|
1543
1543
|
setSplits(tail, split.rest);
|
|
1544
1544
|
row[c] = tail;
|
|
1545
1545
|
}
|
|
@@ -1630,7 +1630,7 @@ function joinSplitParts(prev, pcx, curr, ccx, dx = 0, prevBottom, lex) {
|
|
|
1630
1630
|
if (cols < 1) return null;
|
|
1631
1631
|
const pa = anchorsOf(prev), ca = anchorsOf(curr);
|
|
1632
1632
|
const cutOpen = (() => {
|
|
1633
|
-
const u =
|
|
1633
|
+
const u = _chunkO5IIMWXCcjs.ROW_RULES.get(prev), d = _chunkO5IIMWXCcjs.ROW_RULES.get(curr);
|
|
1634
1634
|
return !!u && !!d && !u.bottom && !d.top;
|
|
1635
1635
|
})();
|
|
1636
1636
|
let skip = 0, head = 0;
|
|
@@ -1662,19 +1662,19 @@ function joinSplitParts(prev, pcx, curr, ccx, dx = 0, prevBottom, lex) {
|
|
|
1662
1662
|
if (r + dr < rows) owner[r + dr][dc] = placed;
|
|
1663
1663
|
}
|
|
1664
1664
|
grid[r][c1] = { ...a.cell, colSpan: c2 - c1, rowSpan: a.rs };
|
|
1665
|
-
const lines =
|
|
1666
|
-
if (lines)
|
|
1667
|
-
if (
|
|
1668
|
-
const edges =
|
|
1665
|
+
const lines = _chunkO5IIMWXCcjs.CELL_LINES.get(a.cell);
|
|
1666
|
+
if (lines) _chunkO5IIMWXCcjs.CELL_LINES.set(grid[r][c1], shift ? lines.map((l) => ({ ...l, l: l.l + shift, r: l.r + shift })) : lines);
|
|
1667
|
+
if (_chunkO5IIMWXCcjs.IMAGE_CELLS.has(a.cell)) _chunkO5IIMWXCcjs.IMAGE_CELLS.add(grid[r][c1]);
|
|
1668
|
+
const edges = _chunkLHHZZVRDcjs.CELL_EDGES.get(a.cell);
|
|
1669
1669
|
if (edges) {
|
|
1670
|
-
|
|
1670
|
+
_chunkLHHZZVRDcjs.CELL_EDGES.set(grid[r][c1], edges);
|
|
1671
1671
|
edged = true;
|
|
1672
1672
|
}
|
|
1673
1673
|
return true;
|
|
1674
1674
|
};
|
|
1675
|
-
for (const a of pa) if (!
|
|
1675
|
+
for (const a of pa) if (!_chunkO5IIMWXCcjs.FILLER_CELLS.has(a.cell) && !place(a, pcx, 0)) return null;
|
|
1676
1676
|
for (const a of ca) {
|
|
1677
|
-
if (a.r < skip ||
|
|
1677
|
+
if (a.r < skip || _chunkO5IIMWXCcjs.FILLER_CELLS.has(a.cell)) continue;
|
|
1678
1678
|
if (!place(a, cxU, prev.rows - skip, dx)) return null;
|
|
1679
1679
|
}
|
|
1680
1680
|
const first = prev.rows;
|
|
@@ -1698,9 +1698,9 @@ function joinSplitParts(prev, pcx, curr, ccx, dx = 0, prevBottom, lex) {
|
|
|
1698
1698
|
const grown = { ...above, rs: newRs };
|
|
1699
1699
|
for (let rr = above.r; rr < above.r + newRs; rr++) for (let dc = above.c; dc < above.c + above.cs; dc++) owner[rr][dc] = grown;
|
|
1700
1700
|
}
|
|
1701
|
-
for (let r = 0; r < rows; r++) for (let c = 0; c < cols; c++) if (owner[r][c] === null)
|
|
1701
|
+
for (let r = 0; r < rows; r++) for (let c = 0; c < cols; c++) if (owner[r][c] === null) _chunkO5IIMWXCcjs.FILLER_CELLS.add(grid[r][c]);
|
|
1702
1702
|
if (edged) {
|
|
1703
|
-
for (let r = 0; r < rows; r++) for (let c = 0; c < cols; c++) if (owner[r][c] === null)
|
|
1703
|
+
for (let r = 0; r < rows; r++) for (let c = 0; c < cols; c++) if (owner[r][c] === null) _chunkLHHZZVRDcjs.CELL_EDGES.set(grid[r][c], _chunkO5IIMWXCcjs.NO_EDGES);
|
|
1704
1704
|
}
|
|
1705
1705
|
for (let c = 0; c < cols && U[c + 1] <= pcx[0] + PART_COL_TOL; c++) {
|
|
1706
1706
|
let r = prev.rows;
|
|
@@ -1709,7 +1709,7 @@ function joinSplitParts(prev, pcx, curr, ccx, dx = 0, prevBottom, lex) {
|
|
|
1709
1709
|
for (let rr = 0; rr < r; rr++) owner[rr][c] = through;
|
|
1710
1710
|
}
|
|
1711
1711
|
const table = { rows, cols, cells: grid, hasHeader: prev.hasHeader, ...prev.caption ? { caption: prev.caption } : {} };
|
|
1712
|
-
const pr =
|
|
1712
|
+
const pr = _chunkO5IIMWXCcjs.ROW_RULES.get(prev), cr = _chunkO5IIMWXCcjs.ROW_RULES.get(curr);
|
|
1713
1713
|
const shifted = dx !== 0;
|
|
1714
1714
|
const cut = {
|
|
1715
1715
|
open: !!pr && !!cr && !pr.bottom && !cr.top && pr.innerOpen + cr.innerOpen === 0 && pr.innerRuled + cr.innerRuled > 0,
|
|
@@ -1717,13 +1717,13 @@ function joinSplitParts(prev, pcx, curr, ccx, dx = 0, prevBottom, lex) {
|
|
|
1717
1717
|
list: !shifted ? "any" : skip > 0 && ca.filter((a) => a.r < skip && a.cell.text.trim()).length < 2 ? "none" : "multi"
|
|
1718
1718
|
};
|
|
1719
1719
|
let partial = !skip && cols === prev.cols && cols === curr.cols && cut.ruled && prevBottom !== void 0 ? partialAlignedLabelCells(table, owner, first) : void 0;
|
|
1720
|
-
if (partial && (continuesAcross(partial.context.upper, partial.context.lower, U[partial.context.c], U[partial.context.c + partial.context.cs]) || clauseContinues(partial.context.upper, partial.context.lower) || quantityContinues(partial.context.upper, partial.context.lower) || !continuesAcross(partial.value.upper, partial.value.lower, U[partial.value.c], U[partial.value.c + partial.value.cs]) ||
|
|
1720
|
+
if (partial && (continuesAcross(partial.context.upper, partial.context.lower, U[partial.context.c], U[partial.context.c + partial.context.cs]) || clauseContinues(partial.context.upper, partial.context.lower) || quantityContinues(partial.context.upper, partial.context.lower) || !continuesAcross(partial.value.upper, partial.value.lower, U[partial.value.c], U[partial.value.c + partial.value.cs]) || _chunkO5IIMWXCcjs.startsNewItem.call(void 0, partial.value.upper.text, partial.value.lower.text))) partial = void 0;
|
|
1721
1721
|
const selected = partial ? /* @__PURE__ */ new Set([partial.label.c, partial.value.c]) : void 0;
|
|
1722
1722
|
let split = !selected && rows > prev.rows && mergeSplitRow(table, owner, prev.rows, U, false, cut);
|
|
1723
1723
|
if (rows > prev.rows && !split && prevBottom !== void 0 && mergeStraddlingCells(table, owner, prev.rows, prevBottom, lex, U, selected) && !selected) split = mergeSplitRow(table, owner, prev.rows, U, true, { ...cut, open: false });
|
|
1724
1724
|
if (pr && cr) {
|
|
1725
1725
|
const cutRuled = pr.bottom || cr.top;
|
|
1726
|
-
|
|
1726
|
+
_chunkO5IIMWXCcjs.ROW_RULES.set(table, { top: pr.top, bottom: cr.bottom, innerRuled: pr.innerRuled + cr.innerRuled + (!split && cutRuled ? 1 : 0), innerOpen: pr.innerOpen + cr.innerOpen + (!split && !cutRuled ? 1 : 0) });
|
|
1727
1727
|
}
|
|
1728
1728
|
return { table, colXs: U, split, header: ca.filter((a) => a.r < skip && a.cell.text.trim()).length >= 2 };
|
|
1729
1729
|
}
|
|
@@ -1785,18 +1785,18 @@ function mergeStraddlingCells(table, owner, first, prevBottom, lex, colXs, selec
|
|
|
1785
1785
|
if (!d || d === u || u.r + u.rs - 1 !== last || d.r !== first || d.c !== u.c || d.cs !== u.cs) continue;
|
|
1786
1786
|
const a = table.cells[u.r][u.c], b = table.cells[first][d.c];
|
|
1787
1787
|
if (selected && !selected.has(u.c)) continue;
|
|
1788
|
-
const flowsOn = itemBreak && straddles && !!colXs && hasContent(a) && hasContent(b) && longLastLine(a) && !
|
|
1789
|
-
const openSeam = hasContent(a) && hasContent(b) &&
|
|
1788
|
+
const flowsOn = itemBreak && straddles && !!colXs && hasContent(a) && hasContent(b) && longLastLine(a) && !_chunkO5IIMWXCcjs.startsNewItem.call(void 0, a.text, b.text) && continuesAcross(a, b, colXs[u.c], colXs[u.c + u.cs]);
|
|
1789
|
+
const openSeam = hasContent(a) && hasContent(b) && _chunkO5IIMWXCcjs.hasOpenCellSeam.call(void 0, a, b) && !owner.some((row, r) => {
|
|
1790
1790
|
if (!r || r === first) return false;
|
|
1791
1791
|
const up = owner[r - 1][u.c], down = row[u.c];
|
|
1792
1792
|
if (!up || !down || up === down || up.c !== u.c || down.c !== u.c || up.cs !== u.cs || down.cs !== u.cs) return false;
|
|
1793
|
-
const ue =
|
|
1793
|
+
const ue = _chunkLHHZZVRDcjs.CELL_EDGES.get(table.cells[up.r][up.c]), de = _chunkLHHZZVRDcjs.CELL_EDGES.get(table.cells[down.r][down.c]);
|
|
1794
1794
|
return !!ue && !!de && !ue.b && !de.t;
|
|
1795
1795
|
});
|
|
1796
1796
|
if (!selected && !openSeam && !flowsOn && !crossed.has(shape(u, d)) && !(u.rs >= 2 && u.c + u.cs <= firstNew && hasContent(a) && !hasContent(b))) {
|
|
1797
1797
|
if (!straddles && !midWord) continue;
|
|
1798
1798
|
if (u.r >= last && d.rs < 2) continue;
|
|
1799
|
-
const U =
|
|
1799
|
+
const U = _chunkO5IIMWXCcjs.CELL_LINES.get(a);
|
|
1800
1800
|
if (!_optionalChain([U, 'optionalAccess', _156 => _156.length]) || !hasContent(b)) continue;
|
|
1801
1801
|
if (!(straddles && filledToBottom(U, prevBottom) && clauseContinues(a, b))) {
|
|
1802
1802
|
if (U.length > STRADDLE_MAX_LINES) continue;
|
|
@@ -1814,7 +1814,7 @@ function mergeStraddlingCells(table, owner, first, prevBottom, lex, colXs, selec
|
|
|
1814
1814
|
return merged;
|
|
1815
1815
|
}
|
|
1816
1816
|
function longLastLine(c) {
|
|
1817
|
-
const L =
|
|
1817
|
+
const L = _chunkO5IIMWXCcjs.CELL_LINES.get(c), l = _optionalChain([L, 'optionalAccess', _157 => _157[L.length - 1]]);
|
|
1818
1818
|
return !!l && l.r - l.l >= 6 * (l.h || 10);
|
|
1819
1819
|
}
|
|
1820
1820
|
function filledToBottom(U, bottom) {
|
|
@@ -1847,7 +1847,7 @@ function nextItemHead(prev, next) {
|
|
|
1847
1847
|
return false;
|
|
1848
1848
|
}
|
|
1849
1849
|
function continuesAcross(u, d, x1, x2) {
|
|
1850
|
-
const U =
|
|
1850
|
+
const U = _chunkO5IIMWXCcjs.CELL_LINES.get(u), D = _chunkO5IIMWXCcjs.CELL_LINES.get(d);
|
|
1851
1851
|
if (!_optionalChain([U, 'optionalAccess', _158 => _158.length]) || !_optionalChain([D, 'optionalAccess', _159 => _159.length])) return false;
|
|
1852
1852
|
const last = U[U.length - 1];
|
|
1853
1853
|
const fs = last.h || 10;
|
|
@@ -1865,7 +1865,7 @@ function continuesAcross(u, d, x1, x2) {
|
|
|
1865
1865
|
if (U.length === 1 && x2 - last.r > Math.max(FULL_LINE_EDGE_MIN, SINGLE_LINE_WORD_GAP * fs)) return false;
|
|
1866
1866
|
const indented = last.l - minL >= HANGING_MIN * fs;
|
|
1867
1867
|
if (last.r - last.l < FULL_LINE_MIN_FRAC * (indented ? x2 - last.l : x2 - x1)) return false;
|
|
1868
|
-
const newItem =
|
|
1868
|
+
const newItem = _chunkO5IIMWXCcjs.startsNewItem.call(void 0, u.text, d.text);
|
|
1869
1869
|
const all = D.length ? U.concat(D) : U;
|
|
1870
1870
|
const leftAligned = (l) => maxR - l.r > SHORT_LINE_GAP * fs && (l.l - minL <= fs || !newItem && all.some((o) => o !== l && Math.abs(o.l - l.l) <= HANGING_TOL && Math.abs(o.r - l.r) >= HANGING_MIN * fs));
|
|
1871
1871
|
const hanging = U.length >= 2 && U.every((l) => maxR - l.r <= FULL_LINE_TOL * fs) && indented && Math.abs(D[0].l - last.l) <= HANGING_TOL;
|
|
@@ -1882,10 +1882,10 @@ function outlineContinues(u, d) {
|
|
|
1882
1882
|
return U.length >= 2 && D.length >= 1 && U.some((l) => OUTLINE_HEAD.test(l)) && OUTLINE_ITEM.test(D[0]);
|
|
1883
1883
|
}
|
|
1884
1884
|
function lineEnded(c, x1, x2, next) {
|
|
1885
|
-
const L =
|
|
1885
|
+
const L = _chunkO5IIMWXCcjs.CELL_LINES.get(c);
|
|
1886
1886
|
if (!L || L.length !== 1) return false;
|
|
1887
1887
|
const l = L[0], h = l.h || 10;
|
|
1888
|
-
const d0 = next ? _optionalChain([
|
|
1888
|
+
const d0 = next ? _optionalChain([_chunkO5IIMWXCcjs.CELL_LINES, 'access', _160 => _160.get, 'call', _161 => _161(next), 'optionalAccess', _162 => _162[0]]) : void 0;
|
|
1889
1889
|
if (d0 && d0.l - l.l >= HANGING_MIN * h) return false;
|
|
1890
1890
|
return x2 - l.r - (l.l - x1) >= Math.max(LABEL_ROOM, firstWordUnits(_nullishCoalesce(_optionalChain([next, 'optionalAccess', _163 => _163.text]), () => ( "")))) * h;
|
|
1891
1891
|
}
|
|
@@ -1896,15 +1896,15 @@ function firstWordUnits(text) {
|
|
|
1896
1896
|
return units;
|
|
1897
1897
|
}
|
|
1898
1898
|
function appendCell(a, b) {
|
|
1899
|
-
if (
|
|
1899
|
+
if (_chunkO5IIMWXCcjs.IMAGE_CELLS.has(b)) _chunkO5IIMWXCcjs.IMAGE_CELLS.add(a);
|
|
1900
1900
|
if (_optionalChain([a, 'access', _164 => _164.blocks, 'optionalAccess', _165 => _165.length]) || _optionalChain([b, 'access', _166 => _166.blocks, 'optionalAccess', _167 => _167.length])) {
|
|
1901
1901
|
const asBlocks = (c) => _optionalChain([c, 'access', _168 => _168.blocks, 'optionalAccess', _169 => _169.length]) ? c.blocks : c.text.split("\n").map((l) => l.trim()).filter(Boolean).map((text) => ({ type: "paragraph", text }));
|
|
1902
1902
|
a.blocks = [...asBlocks(a), ...asBlocks(b)];
|
|
1903
1903
|
}
|
|
1904
1904
|
if (b.text.trim()) a.text = a.text.trim() ? a.text + "\n" + b.text : b.text;
|
|
1905
|
-
|
|
1905
|
+
_chunkO5IIMWXCcjs.joinCellEdges.call(void 0, a, b);
|
|
1906
1906
|
}
|
|
1907
|
-
var hasContent = (cell) => !!cell.text.trim() || !!_optionalChain([cell, 'access', _170 => _170.blocks, 'optionalAccess', _171 => _171.length]) ||
|
|
1907
|
+
var hasContent = (cell) => !!cell.text.trim() || !!_optionalChain([cell, 'access', _170 => _170.blocks, 'optionalAccess', _171 => _171.length]) || _chunkO5IIMWXCcjs.IMAGE_CELLS.has(cell);
|
|
1908
1908
|
var CLAUSE_OPEN_ENDING = /(?:하는|되는|하고|하며|하여|되어|되고|되며|이며|으며|어야|아야|여야)$/;
|
|
1909
1909
|
var batchim = (ch) => {
|
|
1910
1910
|
const k = ch.charCodeAt(0) - 44032;
|
|
@@ -1912,7 +1912,7 @@ var batchim = (ch) => {
|
|
|
1912
1912
|
};
|
|
1913
1913
|
function clauseContinues(u, d) {
|
|
1914
1914
|
const tail = _nullishCoalesce(flowText(u.text).trim().split(/\s+/).pop(), () => ( "")), head = flowText(d.text).trim();
|
|
1915
|
-
if (!/^[가-힣]{2,}$/.test(tail) || !/^[가-힣]/.test(head) ||
|
|
1915
|
+
if (!/^[가-힣]{2,}$/.test(tail) || !/^[가-힣]/.test(head) || _chunkO5IIMWXCcjs.startsNewItem.call(void 0, u.text, head)) return false;
|
|
1916
1916
|
const last = tail[tail.length - 1], before = tail[tail.length - 2];
|
|
1917
1917
|
return last === "\uC744" && batchim(before) || last === "\uB97C" && !batchim(before) || CLAUSE_OPEN_ENDING.test(tail);
|
|
1918
1918
|
}
|
|
@@ -1920,8 +1920,8 @@ function quantityContinues(u, d) {
|
|
|
1920
1920
|
return /\d[\d,.]*\s*(?:%|[가-힣]{1,2})?$/.test(flowText(u.text).trim()) && /^(?:미만|이상|이하|초과)(?![가-힣])/.test(flowText(d.text).trim());
|
|
1921
1921
|
}
|
|
1922
1922
|
function wordOverflows(u, d, x1, x2) {
|
|
1923
|
-
const U =
|
|
1924
|
-
if (!_optionalChain([U, 'optionalAccess', _172 => _172.length]) ||
|
|
1923
|
+
const U = _chunkO5IIMWXCcjs.CELL_LINES.get(u);
|
|
1924
|
+
if (!_optionalChain([U, 'optionalAccess', _172 => _172.length]) || _chunkO5IIMWXCcjs.startsNewItem.call(void 0, u.text, d.text)) return false;
|
|
1925
1925
|
const last = U[U.length - 1], units = firstWordUnits(d.text);
|
|
1926
1926
|
return units > 0 && last.r - last.l + units * (last.h || 10) > x2 - x1;
|
|
1927
1927
|
}
|
|
@@ -1990,7 +1990,7 @@ function mergeSplitRow(table, owner, first, colXs, textOnly = false, cut = NO_CU
|
|
|
1990
1990
|
if (!carriedSplit && !band) {
|
|
1991
1991
|
const norm = (c) => flowText(c.text).replace(/\s+/g, "");
|
|
1992
1992
|
if (pairs.some(([u, d]) => hasContent(d.cell) && norm(cell(d)) !== norm(cell(u)) && lineEnded(cell(u), colXs[u.c], colXs[u.c + u.cs], cell(d)))) return false;
|
|
1993
|
-
const oneLine = (c) => _optionalChain([
|
|
1993
|
+
const oneLine = (c) => _optionalChain([_chunkO5IIMWXCcjs.CELL_LINES, 'access', _174 => _174.get, 'call', _175 => _175(c), 'optionalAccess', _176 => _176.length]) === 1;
|
|
1994
1994
|
if (pairs.some(([u, d]) => nextItemHead(cell(u).text, cell(d).text)) && pairs.some(([u, d]) => hasContent(u.cell) && hasContent(d.cell) && oneLine(cell(u)) && oneLine(cell(d)) && norm(cell(u)) !== norm(cell(d)))) return false;
|
|
1995
1995
|
if (cut.ruled && pairs.some(([u, d]) => u.rs >= 2 && hasContent(u.cell) && hasContent(d.cell) && oneLine(cell(u)) && oneLine(cell(d)) && norm(cell(u)) !== norm(cell(d)))) return false;
|
|
1996
1996
|
const flows = ([u, d]) => continuesAcross(cell(u), cell(d), colXs[u.c], colXs[u.c + u.cs]) || clauseContinues(cell(u), cell(d)) || quantityContinues(cell(u), cell(d));
|
|
@@ -2083,19 +2083,19 @@ function mergeCrossPageTables(blocks, pageHeights, lex) {
|
|
|
2083
2083
|
placeJoined(blocks, i, j, joined);
|
|
2084
2084
|
continue;
|
|
2085
2085
|
}
|
|
2086
|
-
if (
|
|
2086
|
+
if (_chunkO5IIMWXCcjs.EMPTY_PARTS.has(curr.table)) {
|
|
2087
2087
|
blocks.splice(j, 1);
|
|
2088
2088
|
i++;
|
|
2089
2089
|
continue;
|
|
2090
2090
|
}
|
|
2091
2091
|
if (joined === null) continue;
|
|
2092
|
-
if (prev.table.cols !== curr.table.cols || prev.table.renderAsTable !== curr.table.renderAsTable ||
|
|
2092
|
+
if (prev.table.cols !== curr.table.cols || prev.table.renderAsTable !== curr.table.renderAsTable || _chunkO5IIMWXCcjs.EMPTY_PARTS.has(prev.table)) continue;
|
|
2093
2093
|
const width = Math.max(prev.bbox.width, curr.bbox.width, 1);
|
|
2094
2094
|
const leftDiff = Math.abs(prev.bbox.x - curr.bbox.x);
|
|
2095
2095
|
const rightDiff = Math.abs(prev.bbox.x + prev.bbox.width - (curr.bbox.x + curr.bbox.width));
|
|
2096
2096
|
if (leftDiff > width * NEIGHBOR_TABLE_EPSILON || rightDiff > width * NEIGHBOR_TABLE_EPSILON) continue;
|
|
2097
|
-
const px =
|
|
2098
|
-
if (px && cx && !shiftedSame(px, cx, !
|
|
2097
|
+
const px = _chunkO5IIMWXCcjs.TABLE_COLXS.get(prev.table), cx = _chunkO5IIMWXCcjs.TABLE_COLXS.get(curr.table);
|
|
2098
|
+
if (px && cx && !shiftedSame(px, cx, !_chunkO5IIMWXCcjs.CLIP_TABLES.has(prev.table) && !_chunkO5IIMWXCcjs.CLIP_TABLES.has(curr.table))) continue;
|
|
2099
2099
|
if (!px !== !cx) continue;
|
|
2100
2100
|
if (!rowTextsEqual(prev.table.cells[0], curr.table.cells[0]) && sameHeadShape(prev.table.cells[0], curr.table.cells[0])) continue;
|
|
2101
2101
|
let currCells = curr.table.cells;
|
|
@@ -2107,16 +2107,16 @@ function mergeCrossPageTables(blocks, pageHeights, lex) {
|
|
|
2107
2107
|
blocks.splice(j, 1);
|
|
2108
2108
|
continue;
|
|
2109
2109
|
}
|
|
2110
|
-
if (px && cx && !
|
|
2110
|
+
if (px && cx && !_chunkO5IIMWXCcjs.CLIP_TABLES.has(prev.table) && !_chunkO5IIMWXCcjs.CLIP_TABLES.has(curr.table) && currCells.length < curr.table.cells.length && curr.table.cells[0].filter((c) => c.text.trim()).length >= 2 && prev.table.cells.at(-1).concat(currCells[0]).every((c) => c.rowSpan === 1 && c.colSpan === 1 && _chunkO5IIMWXCcjs.CELL_LINES.has(c))) {
|
|
2111
2111
|
const dx = px[0] - cx[0];
|
|
2112
2112
|
const part = joinSplitParts(prev.table, px, curr.table, cx.map((x) => x + dx), dx, void 0, lex);
|
|
2113
2113
|
if (_optionalChain([part, 'optionalAccess', _197 => _197.split]) && part.table.rows === prev.table.rows + currCells.length - 1) {
|
|
2114
2114
|
const last = prev.table.rows - 1;
|
|
2115
2115
|
for (let c = 0; c < part.table.cols; c++) {
|
|
2116
|
-
const U =
|
|
2117
|
-
|
|
2116
|
+
const U = _chunkO5IIMWXCcjs.CELL_LINES.get(prev.table.cells[last][c]), D = _chunkO5IIMWXCcjs.CELL_LINES.get(currCells[0][c]);
|
|
2117
|
+
_chunkO5IIMWXCcjs.CELL_LINES.set(part.table.cells[last][c], U.concat(D.map((l) => ({ ...l, l: l.l + dx, r: l.r + dx }))));
|
|
2118
2118
|
}
|
|
2119
|
-
|
|
2119
|
+
_chunkO5IIMWXCcjs.TABLE_COLXS.set(part.table, part.colXs);
|
|
2120
2120
|
placeJoined(blocks, i, j, part.table);
|
|
2121
2121
|
continue;
|
|
2122
2122
|
}
|
|
@@ -2129,20 +2129,20 @@ function mergeCrossPageTables(blocks, pageHeights, lex) {
|
|
|
2129
2129
|
caption: prev.table.caption,
|
|
2130
2130
|
...prev.table.renderAsTable ? { renderAsTable: true } : {}
|
|
2131
2131
|
};
|
|
2132
|
-
if (_nullishCoalesce(px, () => ( cx)))
|
|
2133
|
-
if (
|
|
2132
|
+
if (_nullishCoalesce(px, () => ( cx))) _chunkO5IIMWXCcjs.TABLE_COLXS.set(merged, _nullishCoalesce(px, () => ( cx)));
|
|
2133
|
+
if (_chunkO5IIMWXCcjs.CLIP_TABLES.has(prev.table) || _chunkO5IIMWXCcjs.CLIP_TABLES.has(curr.table)) _chunkO5IIMWXCcjs.CLIP_TABLES.add(merged);
|
|
2134
2134
|
placeJoined(blocks, i, j, merged);
|
|
2135
2135
|
}
|
|
2136
2136
|
for (let i = blocks.length - 1; i >= 0; i--) {
|
|
2137
2137
|
const t = blocks[i].table;
|
|
2138
|
-
if (blocks[i].type === "table" && t &&
|
|
2138
|
+
if (blocks[i].type === "table" && t && _chunkO5IIMWXCcjs.EMPTY_PARTS.has(t)) blocks.splice(i, 1);
|
|
2139
2139
|
}
|
|
2140
2140
|
}
|
|
2141
2141
|
function mergeColumnFlow(blocks, pageHeights, lex) {
|
|
2142
2142
|
if (!pageHeights) return;
|
|
2143
2143
|
for (let i = 0; i < blocks.length; i++) {
|
|
2144
2144
|
const L = blocks[i];
|
|
2145
|
-
if (L.type !== "table" || !L.table || !L.bbox || !L.pageNumber || !
|
|
2145
|
+
if (L.type !== "table" || !L.table || !L.bbox || !L.pageNumber || !_chunkO5IIMWXCcjs.CLIP_TABLES.has(L.table) || _chunkO5IIMWXCcjs.EMPTY_PARTS.has(L.table)) continue;
|
|
2146
2146
|
const ph = pageHeights.get(L.pageNumber);
|
|
2147
2147
|
if (!ph || L.bbox.y > ph * PAGE_EDGE_BAND) continue;
|
|
2148
2148
|
let s0 = i, s1 = i;
|
|
@@ -2161,8 +2161,8 @@ function mergeColumnFlow(blocks, pageHeights, lex) {
|
|
|
2161
2161
|
if (Math.abs(R.bbox.width - L.bbox.width) > Math.max(R.bbox.width, L.bbox.width) * NEIGHBOR_TABLE_EPSILON) continue;
|
|
2162
2162
|
if (!looksContinued(L, R) || restartsTable(blocks, i, R.table, pageHeights)) continue;
|
|
2163
2163
|
const rt = R.table;
|
|
2164
|
-
if (rt.rows === 1 && rt.cols === 1 && !
|
|
2165
|
-
const px =
|
|
2164
|
+
if (rt.rows === 1 && rt.cols === 1 && !_chunkO5IIMWXCcjs.CLIP_TABLES.has(rt) && L.table.rows >= 2) {
|
|
2165
|
+
const px = _chunkO5IIMWXCcjs.TABLE_COLXS.get(L.table), lb = L.bbox;
|
|
2166
2166
|
const dx = lb.x + lb.width - (R.bbox.x + R.bbox.width);
|
|
2167
2167
|
const last = L.table.cells[L.table.rows - 1];
|
|
2168
2168
|
let col = 0;
|
|
@@ -2191,8 +2191,8 @@ function mergeColumnFlow(blocks, pageHeights, lex) {
|
|
|
2191
2191
|
}
|
|
2192
2192
|
function joinClipParts(prev, curr, pageHeights, lex) {
|
|
2193
2193
|
const pt = prev.table, ct = curr.table;
|
|
2194
|
-
if (!
|
|
2195
|
-
const px =
|
|
2194
|
+
if (!_chunkO5IIMWXCcjs.CLIP_TABLES.has(pt) || !_chunkO5IIMWXCcjs.CLIP_TABLES.has(ct)) return null;
|
|
2195
|
+
const px = _chunkO5IIMWXCcjs.TABLE_COLXS.get(pt), cx = _chunkO5IIMWXCcjs.TABLE_COLXS.get(ct);
|
|
2196
2196
|
if (!px || !cx) return null;
|
|
2197
2197
|
let xs = cx, shifted = false, dx = 0, foreign = false, within = false;
|
|
2198
2198
|
if (!shiftedSame(px, cx, false)) {
|
|
@@ -2208,15 +2208,15 @@ function joinClipParts(prev, curr, pageHeights, lex) {
|
|
|
2208
2208
|
const inner = b.slice(1, -1).map((x) => x + dx);
|
|
2209
2209
|
return inner.length > 0 && !inner.some((x) => px.some((p) => Math.abs(p - x) <= CONTINUATION_COL_TOL));
|
|
2210
2210
|
};
|
|
2211
|
-
foreign = unrelated(cx) && unrelated(_nullishCoalesce(
|
|
2211
|
+
foreign = unrelated(cx) && unrelated(_nullishCoalesce(_chunkO5IIMWXCcjs.PART_COLXS.get(ct), () => ( cx))) && (headingRow(_nullishCoalesce(ct.cells[0], () => ( []))) || px.length > FOREIGN_FIRST_ROW_CELLS && anchorsOf(ct).filter((a) => a.r === 0).length >= FOREIGN_FIRST_ROW_CELLS);
|
|
2212
2212
|
}
|
|
2213
2213
|
const res = joinSplitParts(pt, px, ct, xs, dx, _optionalChain([prev, 'access', _202 => _202.bbox, 'optionalAccess', _203 => _203.y]), lex);
|
|
2214
2214
|
if (!res || (shifted || foreign || within) && !res.split && !res.header) return null;
|
|
2215
|
-
|
|
2216
|
-
const ys =
|
|
2217
|
-
if (ys)
|
|
2218
|
-
|
|
2219
|
-
|
|
2215
|
+
_chunkO5IIMWXCcjs.TABLE_COLXS.set(res.table, res.colXs);
|
|
2216
|
+
const ys = _chunkO5IIMWXCcjs.TABLE_ROWYS.get(pt);
|
|
2217
|
+
if (ys) _chunkO5IIMWXCcjs.TABLE_ROWYS.set(res.table, ys);
|
|
2218
|
+
_chunkO5IIMWXCcjs.PART_COLXS.set(res.table, _nullishCoalesce(_chunkO5IIMWXCcjs.PART_COLXS.get(pt), () => ( px)));
|
|
2219
|
+
_chunkO5IIMWXCcjs.CLIP_TABLES.add(res.table);
|
|
2220
2220
|
return res.table;
|
|
2221
2221
|
}
|
|
2222
2222
|
function prevLacksLeftCols(prev, px, xs, pageHeights) {
|
|
@@ -2240,12 +2240,12 @@ function looksContinued(prev, curr, pageHeights) {
|
|
|
2240
2240
|
return filled.length >= 2 && filled.every((t) => t === filled[0]);
|
|
2241
2241
|
}
|
|
2242
2242
|
function pushedLead(prev, curr) {
|
|
2243
|
-
if (!
|
|
2243
|
+
if (!_chunkO5IIMWXCcjs.CLIP_TABLES.has(prev.table) || !_chunkO5IIMWXCcjs.CLIP_TABLES.has(curr.table)) return false;
|
|
2244
2244
|
const lead = leadRows(curr.table);
|
|
2245
2245
|
return lead.image && lead.height > prev.bbox.y;
|
|
2246
2246
|
}
|
|
2247
2247
|
function leadRows(t) {
|
|
2248
|
-
const ys =
|
|
2248
|
+
const ys = _chunkO5IIMWXCcjs.TABLE_ROWYS.get(t);
|
|
2249
2249
|
if (!ys || ys.length < 2) return { height: 0, image: false };
|
|
2250
2250
|
const anchors = anchorsOf(t);
|
|
2251
2251
|
let end = 1, image = false;
|
|
@@ -2253,17 +2253,17 @@ function leadRows(t) {
|
|
|
2253
2253
|
for (const a of anchors) {
|
|
2254
2254
|
if (a.r !== r) continue;
|
|
2255
2255
|
end = Math.max(end, r + a.rs);
|
|
2256
|
-
if (
|
|
2256
|
+
if (_chunkO5IIMWXCcjs.IMAGE_CELLS.has(a.cell)) image = true;
|
|
2257
2257
|
}
|
|
2258
2258
|
}
|
|
2259
2259
|
return { height: ys[0] - ys[Math.min(end, ys.length - 1)], image };
|
|
2260
2260
|
}
|
|
2261
2261
|
function tailOf(b) {
|
|
2262
|
-
const t = b.table &&
|
|
2262
|
+
const t = b.table && _chunkO5IIMWXCcjs.TABLE_TAIL.get(b.table);
|
|
2263
2263
|
return t && b.bbox ? { ...b, pageNumber: t.page, bbox: { ...b.bbox, page: t.page, y: t.y, height: t.height } } : b;
|
|
2264
2264
|
}
|
|
2265
2265
|
function firstRowSig(t) {
|
|
2266
|
-
const x =
|
|
2266
|
+
const x = _chunkO5IIMWXCcjs.TABLE_COLXS.get(t);
|
|
2267
2267
|
if (!x || x.length !== t.cols + 1) return null;
|
|
2268
2268
|
return anchorsOf(t).filter((a) => a.r === 0).map((a) => ({ x1: x[a.c], x2: x[a.c + a.cs], t: flowText(a.cell.text).replace(/\s+/g, "") }));
|
|
2269
2269
|
}
|
|
@@ -2316,7 +2316,7 @@ function chainHead(blocks, i, pageHeights) {
|
|
|
2316
2316
|
if (pb.pageNumber !== (_nullishCoalesce(cur.pageNumber, () => ( 0))) - 1) break;
|
|
2317
2317
|
if (!blocks.slice(p + 1, k).every((b) => besideOwn(b, pb, cur) || insideTable(b, pb) || pageNumberBetween(b, pb, cur, pageHeights))) break;
|
|
2318
2318
|
if (!looksContinued(pb, cur, pageHeights)) break;
|
|
2319
|
-
const px =
|
|
2319
|
+
const px = _chunkO5IIMWXCcjs.TABLE_COLXS.get(pb.table), cx = _chunkO5IIMWXCcjs.TABLE_COLXS.get(cur.table);
|
|
2320
2320
|
if (!px || !cx) break;
|
|
2321
2321
|
const dx = px[px.length - 1] - cx[cx.length - 1];
|
|
2322
2322
|
if (!shiftedSame(px, cx) && !px.some((x) => Math.abs(x - (cx[0] + dx)) <= CONTINUATION_COL_TOL) && !prevLacksLeftCols(pb, px, cx, pageHeights)) break;
|
|
@@ -2387,7 +2387,7 @@ var RESTART_LOOKBACK_PAGES = 5;
|
|
|
2387
2387
|
var COL_MATCH_TOL = 0.5;
|
|
2388
2388
|
var CONTINUED_TABLE_PAGE_BAND = 0.16;
|
|
2389
2389
|
function lastRowCell(t, x1, x2) {
|
|
2390
|
-
const xs =
|
|
2390
|
+
const xs = _chunkO5IIMWXCcjs.TABLE_COLXS.get(t);
|
|
2391
2391
|
const covered = /* @__PURE__ */ new Set();
|
|
2392
2392
|
for (let r = 0; r < t.rows; r++) {
|
|
2393
2393
|
for (let c = 0; c < t.cols; c++) {
|
|
@@ -2405,7 +2405,7 @@ var cellBlocks = (cell, pageNumber) => _nullishCoalesce(cell.blocks, () => ( cel
|
|
|
2405
2405
|
function mergeContinuedCells(blocks, pageHeights) {
|
|
2406
2406
|
for (let j = blocks.length - 1; j > 0; j--) {
|
|
2407
2407
|
const part = blocks[j];
|
|
2408
|
-
const from = part.table ?
|
|
2408
|
+
const from = part.table ? _chunkO5IIMWXCcjs.CONT_PARTS.get(part.table) : void 0;
|
|
2409
2409
|
if (!from || !part.table) {
|
|
2410
2410
|
unwrapContinuedTable(blocks, j, pageHeights, true);
|
|
2411
2411
|
continue;
|
|
@@ -2421,12 +2421,12 @@ function mergeContinuedCells(blocks, pageHeights) {
|
|
|
2421
2421
|
if (cell.blocks || add.blocks) cell.blocks = [...cellBlocks(cell, prev.pageNumber), ...cellBlocks(add, part.pageNumber)];
|
|
2422
2422
|
else if (part.pageNumber) markContinuedText(cell, add, part.pageNumber);
|
|
2423
2423
|
cell.text = [cell.text, add.text].filter((s) => s.trim()).join("\n");
|
|
2424
|
-
if (
|
|
2425
|
-
|
|
2426
|
-
const lines =
|
|
2427
|
-
if (_optionalChain([lines, 'optionalAccess', _227 => _227.length]))
|
|
2428
|
-
if (part.pageNumber && part.bbox)
|
|
2429
|
-
if (cell.text.trim() || _optionalChain([cell, 'access', _228 => _228.blocks, 'optionalAccess', _229 => _229.length]) ||
|
|
2424
|
+
if (_chunkO5IIMWXCcjs.IMAGE_CELLS.has(add)) _chunkO5IIMWXCcjs.IMAGE_CELLS.add(cell);
|
|
2425
|
+
_chunkO5IIMWXCcjs.joinCellEdges.call(void 0, cell, add);
|
|
2426
|
+
const lines = _chunkO5IIMWXCcjs.CELL_LINES.get(add);
|
|
2427
|
+
if (_optionalChain([lines, 'optionalAccess', _227 => _227.length])) _chunkO5IIMWXCcjs.CELL_LINES.set(cell, [..._nullishCoalesce(_chunkO5IIMWXCcjs.CELL_LINES.get(cell), () => ( [])), ...lines]);
|
|
2428
|
+
if (part.pageNumber && part.bbox) _chunkO5IIMWXCcjs.TABLE_TAIL.set(prev.table, _nullishCoalesce(_chunkO5IIMWXCcjs.TABLE_TAIL.get(part.table), () => ( { page: part.pageNumber, y: part.bbox.y, height: part.bbox.height })));
|
|
2429
|
+
if (cell.text.trim() || _optionalChain([cell, 'access', _228 => _228.blocks, 'optionalAccess', _229 => _229.length]) || _chunkO5IIMWXCcjs.IMAGE_CELLS.has(cell)) _chunkO5IIMWXCcjs.EMPTY_PARTS.delete(prev.table);
|
|
2430
2430
|
blocks.splice(j, 1);
|
|
2431
2431
|
if (cell.blocks && at > 0) {
|
|
2432
2432
|
const nextAt = cell.blocks[at];
|
|
@@ -2438,11 +2438,11 @@ function mergeContinuedCells(blocks, pageHeights) {
|
|
|
2438
2438
|
}
|
|
2439
2439
|
function unwrapContinuedTable(blocks, at, pageHeights, splitOnly = false) {
|
|
2440
2440
|
const prev = blocks[at - 1], frame = blocks[at];
|
|
2441
|
-
if (!_optionalChain([prev, 'optionalAccess', _230 => _230.table]) || !_optionalChain([frame, 'optionalAccess', _231 => _231.table]) || frame.table.rows !== 1 || frame.table.cols !== 1 || !
|
|
2441
|
+
if (!_optionalChain([prev, 'optionalAccess', _230 => _230.table]) || !_optionalChain([frame, 'optionalAccess', _231 => _231.table]) || frame.table.rows !== 1 || frame.table.cols !== 1 || !_chunkO5IIMWXCcjs.CLIP_TABLES.has(frame.table)) return;
|
|
2442
2442
|
const inner = _optionalChain([frame, 'access', _232 => _232.table, 'access', _233 => _233.cells, 'access', _234 => _234[0], 'optionalAccess', _235 => _235[0], 'optionalAccess', _236 => _236.blocks]);
|
|
2443
2443
|
const next = _optionalChain([inner, 'optionalAccess', _237 => _237[0]]);
|
|
2444
|
-
if (!inner || !_optionalChain([next, 'optionalAccess', _238 => _238.table]) || !prev.bbox || !next.bbox || !prev.pageNumber || next.pageNumber !== prev.pageNumber + 1 || !
|
|
2445
|
-
const px =
|
|
2444
|
+
if (!inner || !_optionalChain([next, 'optionalAccess', _238 => _238.table]) || !prev.bbox || !next.bbox || !prev.pageNumber || next.pageNumber !== prev.pageNumber + 1 || !_chunkO5IIMWXCcjs.CLIP_TABLES.has(prev.table) || !_chunkO5IIMWXCcjs.CLIP_TABLES.has(next.table) || prev.table.cols !== next.table.cols) return;
|
|
2445
|
+
const px = _chunkO5IIMWXCcjs.TABLE_COLXS.get(prev.table), nx = _chunkO5IIMWXCcjs.TABLE_COLXS.get(next.table);
|
|
2446
2446
|
if (!px || !nx || px.length !== nx.length || px.some((x, i) => Math.abs(x - nx[i]) > COL_MATCH_TOL)) return;
|
|
2447
2447
|
const ph = _optionalChain([pageHeights, 'optionalAccess', _239 => _239.get, 'call', _240 => _240(prev.pageNumber)]), nh = _optionalChain([pageHeights, 'optionalAccess', _241 => _241.get, 'call', _242 => _242(next.pageNumber)]);
|
|
2448
2448
|
if (!ph || !nh || prev.bbox.y > ph * CONTINUED_TABLE_PAGE_BAND || next.bbox.y + next.bbox.height < nh * (1 - CONTINUED_TABLE_PAGE_BAND)) return;
|
|
@@ -2452,15 +2452,15 @@ function unwrapContinuedTable(blocks, at, pageHeights, splitOnly = false) {
|
|
|
2452
2452
|
function fillNestedContinuation(blocks, at) {
|
|
2453
2453
|
const prev = blocks[at - 1], next = blocks[at];
|
|
2454
2454
|
const t = _optionalChain([prev, 'optionalAccess', _245 => _245.table]), u = _optionalChain([next, 'optionalAccess', _246 => _246.table]);
|
|
2455
|
-
if (!t || !u || u.rows !== 1 || u.cols !== 1 || !
|
|
2456
|
-
const xs =
|
|
2455
|
+
if (!t || !u || u.rows !== 1 || u.cols !== 1 || !_chunkO5IIMWXCcjs.CLIP_TABLES.has(t) || !_chunkO5IIMWXCcjs.CLIP_TABLES.has(u) || next.pageNumber !== (_nullishCoalesce(prev.pageNumber, () => ( 0))) + 1) return;
|
|
2456
|
+
const xs = _chunkO5IIMWXCcjs.TABLE_COLXS.get(u);
|
|
2457
2457
|
const cell = xs ? lastRowCell(t, xs[0], xs[xs.length - 1]) : void 0;
|
|
2458
2458
|
const add = _optionalChain([u, 'access', _247 => _247.cells, 'access', _248 => _248[0], 'optionalAccess', _249 => _249[0]]);
|
|
2459
|
-
if (!cell || !add || cell.text.trim() || _optionalChain([cell, 'access', _250 => _250.blocks, 'optionalAccess', _251 => _251.length]) ||
|
|
2459
|
+
if (!cell || !add || cell.text.trim() || _optionalChain([cell, 'access', _250 => _250.blocks, 'optionalAccess', _251 => _251.length]) || _chunkO5IIMWXCcjs.IMAGE_CELLS.has(cell)) return;
|
|
2460
2460
|
cell.text = add.text;
|
|
2461
2461
|
if (add.blocks) cell.blocks = add.blocks;
|
|
2462
|
-
if (
|
|
2463
|
-
|
|
2462
|
+
if (_chunkO5IIMWXCcjs.IMAGE_CELLS.has(add)) _chunkO5IIMWXCcjs.IMAGE_CELLS.add(cell);
|
|
2463
|
+
_chunkO5IIMWXCcjs.joinCellEdges.call(void 0, cell, add);
|
|
2464
2464
|
blocks.splice(at, 1);
|
|
2465
2465
|
}
|
|
2466
2466
|
|
|
@@ -3060,12 +3060,12 @@ function restoreUnmappedGlyphs(items, fnArray, argsArray, fontObj) {
|
|
|
3060
3060
|
}
|
|
3061
3061
|
}
|
|
3062
3062
|
for (const q of queues.values()) for (let k = 0; k < q.length; k++) {
|
|
3063
|
-
const pair = k + 1 < q.length ?
|
|
3063
|
+
const pair = k + 1 < q.length ? _chunkLHHZZVRDcjs.pairedNumber.call(void 0, q[k], q[k + 1]) : void 0;
|
|
3064
3064
|
if (pair !== void 0) {
|
|
3065
3065
|
q[k] = pair;
|
|
3066
3066
|
q[k + 1] = "";
|
|
3067
3067
|
k++;
|
|
3068
|
-
} else q[k] =
|
|
3068
|
+
} else q[k] = _chunkLHHZZVRDcjs.mapPuaText.call(void 0, q[k]);
|
|
3069
3069
|
}
|
|
3070
3070
|
const byFont = /* @__PURE__ */ new Map();
|
|
3071
3071
|
for (const it of items) {
|
|
@@ -3155,15 +3155,15 @@ function selectionContextPages(selected, pageCount) {
|
|
|
3155
3155
|
function marginContextBlocks(raw, page, view) {
|
|
3156
3156
|
const [x1, y1, x2, y2] = view;
|
|
3157
3157
|
const width = x2 - x1, height = y2 - y1;
|
|
3158
|
-
const items =
|
|
3158
|
+
const items = _chunkO5IIMWXCcjs.filterHiddenText.call(void 0, _chunkO5IIMWXCcjs.normalizeItems.call(void 0, raw), width, height, x1, y1).visible;
|
|
3159
3159
|
for (const item of items) {
|
|
3160
3160
|
item.x -= x1;
|
|
3161
3161
|
item.y -= y1;
|
|
3162
3162
|
}
|
|
3163
|
-
return
|
|
3164
|
-
const bbox =
|
|
3163
|
+
return _chunkO5IIMWXCcjs.groupByY.call(void 0, items).flatMap((line) => {
|
|
3164
|
+
const bbox = _chunkO5IIMWXCcjs.computeBBox.call(void 0, line, page);
|
|
3165
3165
|
if (bbox.y + bbox.height < height * 0.88 && bbox.y > height * 0.12) return [];
|
|
3166
|
-
return [{ type: "paragraph", text:
|
|
3166
|
+
return [{ type: "paragraph", text: _chunkO5IIMWXCcjs.mergeLineSimple.call(void 0, line), pageNumber: page, bbox, style: _chunkO5IIMWXCcjs.dominantStyle.call(void 0, line) }];
|
|
3167
3167
|
});
|
|
3168
3168
|
}
|
|
3169
3169
|
|
|
@@ -3199,7 +3199,7 @@ var WINANSI_REVERSE = {
|
|
|
3199
3199
|
};
|
|
3200
3200
|
function symbolFontTable(fontName) {
|
|
3201
3201
|
if (!fontName) return void 0;
|
|
3202
|
-
if (/wingdings(?![\s-]*[23])/i.test(fontName)) return
|
|
3202
|
+
if (/wingdings(?![\s-]*[23])/i.test(fontName)) return _chunkLHHZZVRDcjs.WINGDINGS;
|
|
3203
3203
|
return void 0;
|
|
3204
3204
|
}
|
|
3205
3205
|
function remapSymbolText(text, table) {
|
|
@@ -3432,7 +3432,7 @@ function wrapEquationRuns(items, faceName) {
|
|
|
3432
3432
|
for (const i of members) drop.add(i);
|
|
3433
3433
|
const toks = cur.map((it) => {
|
|
3434
3434
|
const bar2 = isBarItem(it);
|
|
3435
|
-
const text = bar2 ? "" : plain2.has(items.indexOf(it)) ?
|
|
3435
|
+
const text = bar2 ? "" : plain2.has(items.indexOf(it)) ? _chunkLHHZZVRDcjs.toTex.call(void 0, it.text) : FUNC_RE.test(it.text.trim()) ? it.text.trim() : [...it.text].map(decodeEq).join("");
|
|
3436
3436
|
return { text, x: it.x, y: it.y, w: it.w, size: sizeOf(it), bar: bar2 };
|
|
3437
3437
|
});
|
|
3438
3438
|
const tex = layout(toks).replace(/\}\\text\{/g, "");
|
|
@@ -4272,7 +4272,7 @@ function mergeEnclosedDigits(items) {
|
|
|
4272
4272
|
if (!/^\d\d?$/.test(digits)) continue;
|
|
4273
4273
|
const mid = (inside2[0].x + inside2[inside2.length - 1].x + inside2[inside2.length - 1].w) / 2;
|
|
4274
4274
|
if (Math.abs(mid - (s.x + s.w / 2)) > s.fontSize * 0.15) continue;
|
|
4275
|
-
s.text =
|
|
4275
|
+
s.text = _chunkLHHZZVRDcjs.enclosedNumber.call(void 0, Number(digits));
|
|
4276
4276
|
for (const d of inside2) drop.add(d);
|
|
4277
4277
|
}
|
|
4278
4278
|
if (!drop.size) return;
|
|
@@ -4469,7 +4469,7 @@ function demoteNonHeadingRoles(blocks, pageHeights, faceNames) {
|
|
|
4469
4469
|
if (block.type !== "heading" || !block.text) continue;
|
|
4470
4470
|
const text = block.text.replace(/<[^>]+>/g, "").trim();
|
|
4471
4471
|
const fsz = _nullishCoalesce(_optionalChain([block, 'access', _333 => _333.style, 'optionalAccess', _334 => _334.fontSize]), () => ( 0));
|
|
4472
|
-
const tocEntry = i > 0 &&
|
|
4472
|
+
const tocEntry = i > 0 && _chunkO5IIMWXCcjs.TOC_BLOCKS.has(blocks[i - 1]) && _chunkO5IIMWXCcjs.TOC_BLOCKS.has(blocks[i + 1]);
|
|
4473
4473
|
const page = _nullishCoalesce(byPage.get(_nullishCoalesce(block.pageNumber, () => ( 0))), () => ( []));
|
|
4474
4474
|
const proseStyle = _optionalChain([block, 'access', _335 => _335.style, 'optionalAccess', _336 => _336.fontName]) && bodyStyle.get(_nullishCoalesce(block.pageNumber, () => ( 0))) === `${block.style.fontName}:${block.style.fontSize}` && text.length > 60;
|
|
4475
4475
|
const next = blocks[i + 1];
|
|
@@ -4567,7 +4567,7 @@ function splitSingleCellTables(blocks) {
|
|
|
4567
4567
|
const out = [];
|
|
4568
4568
|
for (const b of blocks) {
|
|
4569
4569
|
const t = b.type === "table" ? b.table : void 0;
|
|
4570
|
-
const title = t &&
|
|
4570
|
+
const title = t && _chunkO5IIMWXCcjs.FRAME_TITLE_BLOCKS.get(t);
|
|
4571
4571
|
if (title) {
|
|
4572
4572
|
out.push({ ...title, text: `${t.cells[0][0].text.trim()} ${t.cells[0][2].text.trim()}` });
|
|
4573
4573
|
continue;
|
|
@@ -4603,7 +4603,7 @@ function joinLatinCellWraps(blocks) {
|
|
|
4603
4603
|
const lines = cell.text.split("\n");
|
|
4604
4604
|
const out = [lines[0]];
|
|
4605
4605
|
for (const line of lines.slice(1)) {
|
|
4606
|
-
if (
|
|
4606
|
+
if (_chunkO5IIMWXCcjs.latinSoftWrap.call(void 0, out[out.length - 1], line)) out[out.length - 1] = out[out.length - 1].trimEnd() + " " + line.trim();
|
|
4607
4607
|
else out.push(line);
|
|
4608
4608
|
}
|
|
4609
4609
|
cell.text = out.join("\n");
|
|
@@ -4623,10 +4623,10 @@ function cleanPdfText(text, opts) {
|
|
|
4623
4623
|
).replace(/^(?!\| ---).*$/gm, (line) => {
|
|
4624
4624
|
if (/^\s*\${1,2}.+\${1,2}\s*$/.test(line)) return line;
|
|
4625
4625
|
if (line.startsWith("|")) {
|
|
4626
|
-
return line.replace(/(?:\\.|[^|\\])+/g, (cell) => cell.split("<br>").map((seg) => seg.replace(/\S(?:.*\S)?/, (t) =>
|
|
4626
|
+
return line.replace(/(?:\\.|[^|\\])+/g, (cell) => cell.split("<br>").map((seg) => seg.replace(/\S(?:.*\S)?/, (t) => _chunkO5IIMWXCcjs.collapseEvenSpacing.call(void 0, t, false))).join("<br>"));
|
|
4627
4627
|
}
|
|
4628
4628
|
const mark = _nullishCoalesce(_optionalChain([/^(?:#{1,6}|-) /, 'access', _416 => _416.exec, 'call', _417 => _417(line), 'optionalAccess', _418 => _418[0]]), () => ( ""));
|
|
4629
|
-
return mark +
|
|
4629
|
+
return mark + _chunkO5IIMWXCcjs.collapseEvenSpacing.call(void 0, line.slice(mark.length), false);
|
|
4630
4630
|
}).replace(/\\~\\~/g, "~~").replace(/~~~~/g, "").replace(/<u>\s*<\/u>/g, "").replace(/<(sup|sub)>\s*<\/\1>/g, "").replace(/\n{3,}/g, "\n\n").trim();
|
|
4631
4631
|
}
|
|
4632
4632
|
function startsWithMarker(line) {
|
|
@@ -4658,7 +4658,7 @@ function mergeKoreanLines(text) {
|
|
|
4658
4658
|
continue;
|
|
4659
4659
|
}
|
|
4660
4660
|
if (/[가-힣·,\-]$/.test(prev) && /^[가-힣(]/.test(curr) && !startsWithMarker(curr) && !isStandaloneHeader(prev) && !startsWithMarker(prev)) {
|
|
4661
|
-
result[result.length - 1] = prev +
|
|
4661
|
+
result[result.length - 1] = prev + _chunkO5IIMWXCcjs.wrapJoiner.call(void 0, prev, curr) + curr;
|
|
4662
4662
|
} else {
|
|
4663
4663
|
result.push(curr);
|
|
4664
4664
|
}
|
|
@@ -4674,7 +4674,7 @@ function applyLinkAnnotations(items, annots) {
|
|
|
4674
4674
|
const wrapped = /* @__PURE__ */ new Set();
|
|
4675
4675
|
for (const a of annots) {
|
|
4676
4676
|
if (a.subtype !== "Link" || !a.url || !a.rect || a.rect.length < 4) continue;
|
|
4677
|
-
const url =
|
|
4677
|
+
const url = _chunkDZX2B4CBcjs.sanitizeHref.call(void 0, a.url);
|
|
4678
4678
|
if (!url) continue;
|
|
4679
4679
|
const x1 = Math.min(a.rect[0], a.rect[2]), x2 = Math.max(a.rect[0], a.rect[2]);
|
|
4680
4680
|
const y1 = Math.min(a.rect[1], a.rect[3]), y2 = Math.max(a.rect[1], a.rect[3]);
|
|
@@ -4726,7 +4726,7 @@ function mergeLinkRuns(markdown) {
|
|
|
4726
4726
|
|
|
4727
4727
|
// src/pdf/formula-ocr.ts
|
|
4728
4728
|
async function applyFormulaOcr(buffer, blocks, pageFilter, effectivePageCount, warnings, _onProgress) {
|
|
4729
|
-
const formulaMod = await Promise.resolve().then(() => _interopRequireWildcard(require("./formula-
|
|
4729
|
+
const formulaMod = await Promise.resolve().then(() => _interopRequireWildcard(require("./formula-YN4NKDPV.cjs")));
|
|
4730
4730
|
const { FormulaPipeline, ensureFormulaModels } = formulaMod;
|
|
4731
4731
|
await ensureFormulaModels((p) => {
|
|
4732
4732
|
if (p.phase === "download" && p.total) {
|
|
@@ -4917,13 +4917,13 @@ async function loadPdfWithTimeout(buffer, data) {
|
|
|
4917
4917
|
try {
|
|
4918
4918
|
return await Promise.race([
|
|
4919
4919
|
loadingTask.promise.catch((e) => {
|
|
4920
|
-
if (e instanceof Error && e.name === "PasswordException") throw new (0,
|
|
4920
|
+
if (e instanceof Error && e.name === "PasswordException") throw new (0, _chunkDZX2B4CBcjs.KordocError)("\uC554\uD638\uB85C \uBCF4\uD638\uB41C PDF \uD30C\uC77C\uC785\uB2C8\uB2E4 (PDF \uC5F4\uAE30 \uC554\uD638\uB294 \uC9C0\uC6D0\uD558\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4)");
|
|
4921
4921
|
throw e;
|
|
4922
4922
|
}),
|
|
4923
4923
|
new Promise((_, reject) => {
|
|
4924
4924
|
timer = setTimeout(() => {
|
|
4925
4925
|
loadingTask.destroy();
|
|
4926
|
-
reject(new (0,
|
|
4926
|
+
reject(new (0, _chunkDZX2B4CBcjs.KordocError)("PDF \uB85C\uB529 \uD0C0\uC784\uC544\uC6C3 (30\uCD08 \uCD08\uACFC)"));
|
|
4927
4927
|
}, PDF_LOAD_TIMEOUT_MS);
|
|
4928
4928
|
})
|
|
4929
4929
|
]);
|
|
@@ -4934,8 +4934,8 @@ async function loadPdfWithTimeout(buffer, data) {
|
|
|
4934
4934
|
async function parsePdfDocument(buffer, options) {
|
|
4935
4935
|
const formulaBuffer = _optionalChain([options, 'optionalAccess', _419 => _419.formulaOcr]) ? buffer : null;
|
|
4936
4936
|
const ocrOptionError = _chunkMMK32GPDcjs.validateOcrOptions.call(void 0, options);
|
|
4937
|
-
if (ocrOptionError) throw new (0,
|
|
4938
|
-
const autoOcr = _optionalChain([options, 'optionalAccess', _420 => _420.ocr]) === void 0 && await
|
|
4937
|
+
if (ocrOptionError) throw new (0, _chunkDZX2B4CBcjs.KordocError)(ocrOptionError);
|
|
4938
|
+
const autoOcr = _optionalChain([options, 'optionalAccess', _420 => _420.ocr]) === void 0 && await _chunkO5IIMWXCcjs.ocrModelsCached.call(void 0, _chunkO5IIMWXCcjs.resolveOcrModels.call(void 0, options)) && (_optionalChain([options, 'optionalAccess', _421 => _421.ocrRec]) !== "auto" || await _chunkO5IIMWXCcjs.ocrModelsCached.call(void 0, _chunkO5IIMWXCcjs.handwritingFallbackModels.call(void 0, _chunkO5IIMWXCcjs.resolveOcrModels.call(void 0, options))));
|
|
4939
4939
|
const ocrBuffer = _optionalChain([options, 'optionalAccess', _422 => _422.ocr]) || autoOcr ? buffer : null;
|
|
4940
4940
|
const pdfjsData = new Uint8Array(buffer.slice(0));
|
|
4941
4941
|
const blanked = blankLargeImageStreams(pdfjsData);
|
|
@@ -4947,7 +4947,7 @@ async function parsePdfDocument(buffer, options) {
|
|
|
4947
4947
|
let pristine;
|
|
4948
4948
|
try {
|
|
4949
4949
|
const pageCount = doc.numPages;
|
|
4950
|
-
if (pageCount === 0) throw new (0,
|
|
4950
|
+
if (pageCount === 0) throw new (0, _chunkDZX2B4CBcjs.KordocError)("PDF\uC5D0 \uD398\uC774\uC9C0\uAC00 \uC5C6\uC2B5\uB2C8\uB2E4.");
|
|
4951
4951
|
const metadata = { pageCount, pageMode: "layout" };
|
|
4952
4952
|
await extractPdfMetadata(doc, metadata);
|
|
4953
4953
|
const blocks = [];
|
|
@@ -4973,16 +4973,16 @@ async function parsePdfDocument(buffer, options) {
|
|
|
4973
4973
|
const encodeWebp = wantWebp ? await _chunkTV7B6DJQcjs.loadWebpEncoder.call(void 0, ) : null;
|
|
4974
4974
|
if (wantWebp && !encodeWebp) warnings.push(_chunkTV7B6DJQcjs.WEBP_UNAVAILABLE);
|
|
4975
4975
|
const imageState = createPdfImageState(pdfium ? { decoder: pdfium, sizes: blanked.sizes, pristine: () => pristine ??= loadPdfWithTimeout(buffer) } : void 0, _nullishCoalesce(encodeWebp, () => ( void 0)), _optionalChain([options, 'optionalAccess', _428 => _428.imagePlacement]) === "flow", !!_optionalChain([options, 'optionalAccess', _429 => _429.dropBlankImages]) && _optionalChain([options, 'optionalAccess', _430 => _430.images]) !== false);
|
|
4976
|
-
const readQr = _optionalChain([options, 'optionalAccess', _431 => _431.qrCodes]) ? await
|
|
4977
|
-
if (_optionalChain([options, 'optionalAccess', _432 => _432.qrCodes]) && !readQr) warnings.push(
|
|
4976
|
+
const readQr = _optionalChain([options, 'optionalAccess', _431 => _431.qrCodes]) ? await _chunkDGOTUUCWcjs.loadQrReader.call(void 0, ) : null;
|
|
4977
|
+
if (_optionalChain([options, 'optionalAccess', _432 => _432.qrCodes]) && !readQr) warnings.push(_chunkDGOTUUCWcjs.QR_UNAVAILABLE);
|
|
4978
4978
|
const imageBulletShapes = /* @__PURE__ */ new Map();
|
|
4979
4979
|
const imageArrowDirections = /* @__PURE__ */ new Map();
|
|
4980
4980
|
const extractedImages = [];
|
|
4981
4981
|
const pageImageBlocks = /* @__PURE__ */ new Map();
|
|
4982
4982
|
const carry = {};
|
|
4983
|
-
const preciseGaps = await isHancomPdf(doc);
|
|
4983
|
+
const preciseGaps = await isHancomPdf(doc) || await isPreciseGapProducer(doc);
|
|
4984
4984
|
const vectorPageOps = /* @__PURE__ */ new Map();
|
|
4985
|
-
const wrapLexicon = new (0,
|
|
4985
|
+
const wrapLexicon = new (0, _chunkO5IIMWXCcjs.WrapLexicon)();
|
|
4986
4986
|
const noteMarks = /* @__PURE__ */ new Map();
|
|
4987
4987
|
const headerContext = [];
|
|
4988
4988
|
if (pageFilter && _optionalChain([options, 'optionalAccess', _433 => _433.removeHeaderFooter]) !== false && pageFilter.size < effectivePageCount) {
|
|
@@ -5033,12 +5033,12 @@ async function parsePdfDocument(buffer, options) {
|
|
|
5033
5033
|
markSyntheticSpaces(rawItems, rawOps.fnArray, rawOps.argsArray);
|
|
5034
5034
|
restoreSoftHyphens();
|
|
5035
5035
|
rawItems.push(...spaceMappedDots(rawOps.fnArray, rawOps.argsArray, (n) => fontObj(n)));
|
|
5036
|
-
const items =
|
|
5036
|
+
const items = _chunkO5IIMWXCcjs.normalizeItems.call(void 0, occluded.size ? rawItems.filter((it) => !occluded.has(it)) : rawItems);
|
|
5037
5037
|
if (!preciseGaps) for (const it of items) {
|
|
5038
5038
|
delete it.fx;
|
|
5039
5039
|
delete it.fw;
|
|
5040
5040
|
}
|
|
5041
|
-
const filtered =
|
|
5041
|
+
const filtered = _chunkO5IIMWXCcjs.filterHiddenText.call(void 0, items, pageW, pageH, viewX1, viewY1);
|
|
5042
5042
|
const joined = joinVerticalColumns(filtered.visible);
|
|
5043
5043
|
const visible = dropTabLeaderDots(joined);
|
|
5044
5044
|
const hiddenCount = filtered.hiddenCount + occluded.size;
|
|
@@ -5065,7 +5065,7 @@ async function parsePdfDocument(buffer, options) {
|
|
|
5065
5065
|
} : rawOps;
|
|
5066
5066
|
remapSymbolFontItems(visible, (loadedName) => _optionalChain([fontObj, 'call', _440 => _440(loadedName), 'optionalAccess', _441 => _441.name]));
|
|
5067
5067
|
remapControlGlyphs(visible, differencesOf);
|
|
5068
|
-
await
|
|
5068
|
+
await _chunkO5IIMWXCcjs.restoreImageBullets.call(void 0, visible, page, opList.fnArray, opList.argsArray, imageBulletShapes);
|
|
5069
5069
|
const faces = /* @__PURE__ */ new Map();
|
|
5070
5070
|
for (const it of visible) {
|
|
5071
5071
|
if (!it.fontName) continue;
|
|
@@ -5078,12 +5078,12 @@ async function parsePdfDocument(buffer, options) {
|
|
|
5078
5078
|
it.fontName = face;
|
|
5079
5079
|
if (!faceNames.has(face)) faceNames.set(face, (_nullishCoalesce(_optionalChain([fontObj, 'call', _443 => _443(face), 'optionalAccess', _444 => _444.name]), () => ( ""))).replace(/^[A-Z]{6}\+/, ""));
|
|
5080
5080
|
}
|
|
5081
|
-
for (const it of visible) if (it.text.includes("$")) it.text =
|
|
5082
|
-
for (const it of visible) if (it.text.includes("<")) it.text =
|
|
5081
|
+
for (const it of visible) if (it.text.includes("$")) it.text = _chunkLHHZZVRDcjs.escapeLiteralDollar.call(void 0, it.text);
|
|
5082
|
+
for (const it of visible) if (it.text.includes("<")) it.text = _chunkLHHZZVRDcjs.escapeLiteralTags.call(void 0, it.text);
|
|
5083
5083
|
wrapEquationRuns(visible, (face) => faceNames.get(face));
|
|
5084
5084
|
const pageArea = pageW * pageH;
|
|
5085
5085
|
if (pageArea > 0) {
|
|
5086
|
-
const imageRegions =
|
|
5086
|
+
const imageRegions = _chunkO5IIMWXCcjs.extractImageRegions.call(void 0, opList.fnArray, opList.argsArray);
|
|
5087
5087
|
let uncovered = 0;
|
|
5088
5088
|
for (const r of imageRegions) {
|
|
5089
5089
|
const area = (r.x2 - r.x1) * (r.y2 - r.y1);
|
|
@@ -5110,11 +5110,11 @@ async function parsePdfDocument(buffer, options) {
|
|
|
5110
5110
|
if (uncovered > 0) skippedImagePages.set(i, uncovered);
|
|
5111
5111
|
}
|
|
5112
5112
|
const marks = superscriptNoteMarks(visible);
|
|
5113
|
-
if (marks.length) noteMarks.set(i, { marks, seps: footnoteSeparators(
|
|
5113
|
+
if (marks.length) noteMarks.set(i, { marks, seps: footnoteSeparators(_chunkO5IIMWXCcjs.extractLines.call(void 0, opList.fnArray, opList.argsArray).horizontals, pageW, pageH) });
|
|
5114
5114
|
const stamp = marginStamp(visible);
|
|
5115
5115
|
const flow = stamp.length ? visible.filter((it) => !stamp.includes(it)) : visible;
|
|
5116
|
-
const rightArrows = _optionalChain([options, 'optionalAccess', _445 => _445.tables]) !== false ? await
|
|
5117
|
-
const pageBlocks = orderTwoUpPage(
|
|
5116
|
+
const rightArrows = _optionalChain([options, 'optionalAccess', _445 => _445.tables]) !== false ? await _chunkO5IIMWXCcjs.detectRightArrowRegions.call(void 0, page, opList.fnArray, opList.argsArray, imageArrowDirections) : [];
|
|
5117
|
+
const pageBlocks = orderTwoUpPage(_chunkO5IIMWXCcjs.extractPageBlocksWithLines.call(void 0, flow, i, opList, pageW, pageH, void 0, _optionalChain([options, 'optionalAccess', _446 => _446.tables]) !== false, carry, wrapLexicon, rightArrows), pageW, pageH);
|
|
5118
5118
|
if (stamp.length) pageBlocks.unshift({ type: "paragraph", text: [...stamp].sort((a, b) => a.y - b.y).map((it) => it.text).join(" "), pageNumber: i });
|
|
5119
5119
|
for (const b of pageBlocks) blocks.push(b);
|
|
5120
5120
|
try {
|
|
@@ -5140,11 +5140,11 @@ async function parsePdfDocument(buffer, options) {
|
|
|
5140
5140
|
if (_optionalChain([options, 'optionalAccess', _448 => _448.ocr]) && quality.ocrReason === "vector_text" && page.rotate % 360 === 0 && page.view[0] === 0 && page.view[1] === 0) {
|
|
5141
5141
|
vectorPageOps.set(i, ocrVectorOps(opList, vector.paths));
|
|
5142
5142
|
}
|
|
5143
|
-
if (totalTextBytes > MAX_TOTAL_TEXT) throw new (0,
|
|
5143
|
+
if (totalTextBytes > MAX_TOTAL_TEXT) throw new (0, _chunkDZX2B4CBcjs.KordocError)("\uD14D\uC2A4\uD2B8 \uCD94\uCD9C \uD06C\uAE30 \uCD08\uACFC");
|
|
5144
5144
|
parsedPages++;
|
|
5145
5145
|
_optionalChain([options, 'optionalAccess', _449 => _449.onProgress, 'optionalCall', _450 => _450(parsedPages, totalTarget)]);
|
|
5146
5146
|
} catch (pageErr) {
|
|
5147
|
-
if (pageErr instanceof
|
|
5147
|
+
if (pageErr instanceof _chunkDZX2B4CBcjs.KordocError) throw pageErr;
|
|
5148
5148
|
warnings.push({ page: i, message: `\uD398\uC774\uC9C0 ${i} \uD30C\uC2F1 \uC2E4\uD328: ${pageErr instanceof Error ? pageErr.message : "\uC54C \uC218 \uC5C6\uB294 \uC624\uB958"}`, code: "PARTIAL_PARSE" });
|
|
5149
5149
|
} finally {
|
|
5150
5150
|
_optionalChain([loadedPage, 'optionalAccess', _451 => _451.cleanup, 'call', _452 => _452()]);
|
|
@@ -5175,12 +5175,12 @@ async function parsePdfDocument(buffer, options) {
|
|
|
5175
5175
|
}
|
|
5176
5176
|
if (targets.size > 0) {
|
|
5177
5177
|
try {
|
|
5178
|
-
const { runPdfOcr } = await Promise.resolve().then(() => _interopRequireWildcard(require("./pdf-ocr-
|
|
5178
|
+
const { runPdfOcr } = await Promise.resolve().then(() => _interopRequireWildcard(require("./pdf-ocr-A4GJJCT3.cjs")));
|
|
5179
5179
|
const mode = typeof _optionalChain([options, 'optionalAccess', _457 => _457.ocr]) === "function" ? options.ocr : "builtin";
|
|
5180
5180
|
const regionPages = new Map([...ocrRegions].filter(([p]) => _optionalChain([options, 'optionalAccess', _458 => _458.ocr]) !== "force" && !isImageBased && !_optionalChain([pageQuality, 'access', _459 => _459.find, 'call', _460 => _460((q) => q.page === p), 'optionalAccess', _461 => _461.needsOcr])));
|
|
5181
|
-
const { builtinOcrConfig } = await Promise.resolve().then(() => _interopRequireWildcard(require("./pdf-ocr-
|
|
5181
|
+
const { builtinOcrConfig } = await Promise.resolve().then(() => _interopRequireWildcard(require("./pdf-ocr-A4GJJCT3.cjs")));
|
|
5182
5182
|
const ocrPageBlocks = await runPdfOcr(ocrBuffer, targets, mode, warnings, _optionalChain([options, 'optionalAccess', _462 => _462.onProgress]), _optionalChain([options, 'optionalAccess', _463 => _463.tables]) !== false, vectorPageOps, regionPages, builtinOcrConfig(options), ocrLinesOut);
|
|
5183
|
-
for (const obs of ocrPageBlocks.values())
|
|
5183
|
+
for (const obs of ocrPageBlocks.values()) _chunkLHHZZVRDcjs.stripScriptTags.call(void 0, { blocks: obs });
|
|
5184
5184
|
if (ocrPageBlocks.size > 0) {
|
|
5185
5185
|
const replacePages = /* @__PURE__ */ new Set();
|
|
5186
5186
|
for (const [p, obs] of ocrPageBlocks) {
|
|
@@ -5191,7 +5191,7 @@ async function parsePdfDocument(buffer, options) {
|
|
|
5191
5191
|
continue;
|
|
5192
5192
|
}
|
|
5193
5193
|
const regions = ocrRegions.get(p);
|
|
5194
|
-
if (!regions ||
|
|
5194
|
+
if (!regions || _chunkO5IIMWXCcjs.mergeOcrImageRegions.call(void 0, blocks, p, regions, obs) === 0) continue;
|
|
5195
5195
|
ocrDone.add(p);
|
|
5196
5196
|
if (_optionalChain([pageImageBlocks, 'access', _468 => _468.get, 'call', _469 => _469(p), 'optionalAccess', _470 => _470.length]) === 1) pageImageBlocks.delete(p);
|
|
5197
5197
|
}
|
|
@@ -5244,17 +5244,17 @@ async function parsePdfDocument(buffer, options) {
|
|
|
5244
5244
|
}
|
|
5245
5245
|
}
|
|
5246
5246
|
if (_optionalChain([options, 'optionalAccess', _471 => _471.removeHeaderFooter]) !== false && (parsedPageCount >= 3 || headerContext.length)) {
|
|
5247
|
-
const removed =
|
|
5248
|
-
const running =
|
|
5247
|
+
const removed = _chunkO5IIMWXCcjs.removeHeaderFooterBlocks.call(void 0, blocks, pageHeights, warnings, noteMarks, false, headerContext);
|
|
5248
|
+
const running = _chunkO5IIMWXCcjs.runningLinePatterns.call(void 0, removed.map((ri) => blocks[ri]), pageHeights);
|
|
5249
5249
|
for (let ri = removed.length - 1; ri >= 0; ri--) {
|
|
5250
5250
|
blocks.splice(removed[ri], 1);
|
|
5251
5251
|
}
|
|
5252
|
-
const stripped =
|
|
5252
|
+
const stripped = _chunkO5IIMWXCcjs.stripAbsorbedRunningLines.call(void 0, blocks, pageHeights, running);
|
|
5253
5253
|
if (stripped !== blocks) {
|
|
5254
5254
|
blocks.length = 0;
|
|
5255
5255
|
blocks.push(...stripped);
|
|
5256
5256
|
}
|
|
5257
|
-
const kept =
|
|
5257
|
+
const kept = _chunkO5IIMWXCcjs.removeSideTabs.call(void 0, blocks, pageWidths);
|
|
5258
5258
|
if (kept !== blocks) {
|
|
5259
5259
|
blocks.length = 0;
|
|
5260
5260
|
blocks.push(...kept);
|
|
@@ -5263,12 +5263,12 @@ async function parsePdfDocument(buffer, options) {
|
|
|
5263
5263
|
mergeContinuedCells(blocks, pageHeights);
|
|
5264
5264
|
mergeCrossPageTables(blocks, pageHeights, wrapLexicon);
|
|
5265
5265
|
if (_optionalChain([options, 'optionalAccess', _472 => _472.removeHeaderFooter]) !== false && parsedPageCount >= 3) {
|
|
5266
|
-
const boxes =
|
|
5266
|
+
const boxes = _chunkO5IIMWXCcjs.removeHeaderFooterBlocks.call(void 0, blocks, pageHeights, warnings, noteMarks, true);
|
|
5267
5267
|
for (let ri = boxes.length - 1; ri >= 0; ri--) blocks.splice(boxes[ri], 1);
|
|
5268
5268
|
}
|
|
5269
5269
|
splitContactTables(blocks);
|
|
5270
|
-
if (!_optionalChain([options, 'optionalAccess', _473 => _473.keepTrailingEmptyCols]))
|
|
5271
|
-
|
|
5270
|
+
if (!_optionalChain([options, 'optionalAccess', _473 => _473.keepTrailingEmptyCols])) _chunkO5IIMWXCcjs.trimTrailingEmptyTableCols.call(void 0, blocks);
|
|
5271
|
+
_chunkO5IIMWXCcjs.joinPageBreakWraps.call(void 0, blocks, wrapLexicon);
|
|
5272
5272
|
await flushPdfImages(imageState, warnings, pageImageBlocks);
|
|
5273
5273
|
injectPageImageBlocks(blocks, pageImageBlocks);
|
|
5274
5274
|
if (_optionalChain([options, 'optionalAccess', _474 => _474.formulaOcr]) && formulaBuffer) {
|
|
@@ -5281,21 +5281,21 @@ async function parsePdfDocument(buffer, options) {
|
|
|
5281
5281
|
});
|
|
5282
5282
|
}
|
|
5283
5283
|
}
|
|
5284
|
-
const medianFontSize =
|
|
5284
|
+
const medianFontSize = _chunkO5IIMWXCcjs.computeMedianFontSizeFromFreq.call(void 0, fontSizeFreq);
|
|
5285
5285
|
if (medianFontSize > 0) {
|
|
5286
|
-
|
|
5287
|
-
}
|
|
5288
|
-
|
|
5289
|
-
|
|
5290
|
-
|
|
5291
|
-
|
|
5292
|
-
|
|
5293
|
-
|
|
5294
|
-
|
|
5295
|
-
|
|
5286
|
+
_chunkO5IIMWXCcjs.detectHeadings.call(void 0, blocks, medianFontSize);
|
|
5287
|
+
}
|
|
5288
|
+
_chunkO5IIMWXCcjs.detectDocumentStyleHeadings.call(void 0, blocks);
|
|
5289
|
+
_chunkO5IIMWXCcjs.detectTypographyHeadings.call(void 0, blocks);
|
|
5290
|
+
_chunkO5IIMWXCcjs.detectSiblingStyleHeadings.call(void 0, blocks);
|
|
5291
|
+
_chunkO5IIMWXCcjs.detectRepeatedPageLabels.call(void 0, blocks);
|
|
5292
|
+
_chunkO5IIMWXCcjs.detectPageLeadHeadings.call(void 0, blocks);
|
|
5293
|
+
_chunkO5IIMWXCcjs.mergeStackedHeadingLines.call(void 0, blocks, medianFontSize);
|
|
5294
|
+
_chunkO5IIMWXCcjs.refineDocumentStyleHeadings.call(void 0, blocks);
|
|
5295
|
+
_chunkO5IIMWXCcjs.detectMarkerHeadings.call(void 0, blocks);
|
|
5296
5296
|
demoteNonHeadingRoles(blocks, pageHeights, faceNames);
|
|
5297
|
-
|
|
5298
|
-
|
|
5297
|
+
_chunkO5IIMWXCcjs.detectTableCaptions.call(void 0, blocks);
|
|
5298
|
+
_chunkO5IIMWXCcjs.detectKoreanListBlocks.call(void 0, blocks);
|
|
5299
5299
|
sanitizeBlockControlChars(blocks);
|
|
5300
5300
|
if (_optionalChain([options, 'optionalAccess', _475 => _475.imagePlacement]) === "flow") moveImagesInFlow(blocks);
|
|
5301
5301
|
let outBlocks = splitSingleCellTables(blocks);
|
|
@@ -5317,19 +5317,19 @@ async function parsePdfDocument(buffer, options) {
|
|
|
5317
5317
|
const shown = /* @__PURE__ */ new Map();
|
|
5318
5318
|
const markContent = (bs) => {
|
|
5319
5319
|
for (const b of _nullishCoalesce(bs, () => ( []))) if (b.table) for (const row of b.table.cells) for (const c of row) {
|
|
5320
|
-
if (
|
|
5321
|
-
const lines =
|
|
5322
|
-
if (lines)
|
|
5320
|
+
if (_chunkO5IIMWXCcjs.IMAGE_CELLS.has(c)) _chunkLHHZZVRDcjs.CONTENT_CELLS.add(c);
|
|
5321
|
+
const lines = _chunkO5IIMWXCcjs.CELL_LINES.get(c);
|
|
5322
|
+
if (lines) _chunkLHHZZVRDcjs.CELL_BASELINES.set(c, lines.map((l) => l.y));
|
|
5323
5323
|
markContent(c.blocks);
|
|
5324
5324
|
}
|
|
5325
5325
|
};
|
|
5326
5326
|
const visual = (bs) => bs.flatMap((b) => {
|
|
5327
5327
|
if (b.type !== "table") return [b];
|
|
5328
|
-
if (!hancom && b.table &&
|
|
5328
|
+
if (!hancom && b.table && _chunkO5IIMWXCcjs.CLIP_TABLES.has(b.table)) return [b];
|
|
5329
5329
|
let v = shown.get(b);
|
|
5330
5330
|
if (!v) {
|
|
5331
5331
|
markContent([b]);
|
|
5332
|
-
shown.set(b, v =
|
|
5332
|
+
shown.set(b, v = _chunkLHHZZVRDcjs.unframeLayoutTables.call(void 0, [b], !!_optionalChain([options, 'optionalAccess', _479 => _479.keepTrailingEmptyCols])));
|
|
5333
5333
|
}
|
|
5334
5334
|
return v;
|
|
5335
5335
|
});
|
|
@@ -5338,13 +5338,13 @@ async function parsePdfDocument(buffer, options) {
|
|
|
5338
5338
|
blocks.length = 0;
|
|
5339
5339
|
for (const b of kept) blocks.push(b);
|
|
5340
5340
|
}
|
|
5341
|
-
const finishMarkdown = (bs) => mergeLinkRuns(cleanPdfText(
|
|
5342
|
-
if (_optionalChain([options, 'optionalAccess', _481 => _481.tableFormat]) === "gfm")
|
|
5341
|
+
const finishMarkdown = (bs) => mergeLinkRuns(cleanPdfText(_chunkLHHZZVRDcjs.blocksToMarkdown.call(void 0, bs, { tableFormat: _optionalChain([options, 'optionalAccess', _480 => _480.tableFormat]) }), { keepLoneNumbers: true }));
|
|
5342
|
+
if (_optionalChain([options, 'optionalAccess', _481 => _481.tableFormat]) === "gfm") _chunkLHHZZVRDcjs.assignTableIds.call(void 0, blocks);
|
|
5343
5343
|
let markdown = finishMarkdown(outBlocks);
|
|
5344
5344
|
const outline = collectPdfOutline(outBlocks);
|
|
5345
5345
|
return {
|
|
5346
5346
|
markdown,
|
|
5347
|
-
pages:
|
|
5347
|
+
pages: _chunkDGOTUUCWcjs.blocksToPages.call(void 0, splitPageTables(_chunkO5IIMWXCcjs.splitPageBreakWraps.call(void 0, outBlocks)), finishMarkdown),
|
|
5348
5348
|
blocks,
|
|
5349
5349
|
metadata,
|
|
5350
5350
|
outline: outline.length > 0 ? outline : void 0,
|
|
@@ -5380,14 +5380,22 @@ async function extractPdfMetadata(doc, metadata) {
|
|
|
5380
5380
|
} catch (e11) {
|
|
5381
5381
|
}
|
|
5382
5382
|
}
|
|
5383
|
-
async function
|
|
5383
|
+
async function isPreciseGapProducer(doc) {
|
|
5384
5384
|
try {
|
|
5385
5385
|
const info = await _asyncOptionalChain([(await doc.getMetadata()), 'optionalAccess', async _490 => _490.info]);
|
|
5386
|
-
return [_optionalChain([info, 'optionalAccess', _491 => _491.Producer]), _optionalChain([info, 'optionalAccess', _492 => _492.Creator])].some((v) => typeof v === "string" && /^\s*(?:
|
|
5386
|
+
return [_optionalChain([info, 'optionalAccess', _491 => _491.Producer]), _optionalChain([info, 'optionalAccess', _492 => _492.Creator])].some((v) => typeof v === "string" && /^\s*(?:microsoft: print to pdf|libreoffice)\b/i.test(v));
|
|
5387
5387
|
} catch (e12) {
|
|
5388
5388
|
return false;
|
|
5389
5389
|
}
|
|
5390
5390
|
}
|
|
5391
|
+
async function isHancomPdf(doc) {
|
|
5392
|
+
try {
|
|
5393
|
+
const info = await _asyncOptionalChain([(await doc.getMetadata()), 'optionalAccess', async _493 => _493.info]);
|
|
5394
|
+
return [_optionalChain([info, 'optionalAccess', _494 => _494.Producer]), _optionalChain([info, 'optionalAccess', _495 => _495.Creator])].some((v) => typeof v === "string" && /^\s*(?:hancom\b|hwp\b)/i.test(v));
|
|
5395
|
+
} catch (e13) {
|
|
5396
|
+
return false;
|
|
5397
|
+
}
|
|
5398
|
+
}
|
|
5391
5399
|
function parsePdfDate(dateStr) {
|
|
5392
5400
|
const m = dateStr.match(/D:(\d{4})(\d{2})?(\d{2})?(\d{2})?(\d{2})?(\d{2})?/);
|
|
5393
5401
|
if (!m) return void 0;
|
|
@@ -5427,5 +5435,6 @@ function marginStamp(items) {
|
|
|
5427
5435
|
|
|
5428
5436
|
|
|
5429
5437
|
|
|
5430
|
-
|
|
5431
|
-
|
|
5438
|
+
|
|
5439
|
+
exports.PDFJS_DOCUMENT_OPTIONS = PDFJS_DOCUMENT_OPTIONS; exports.cleanPdfText = cleanPdfText; exports.detectKoreanListBlocks = _chunkO5IIMWXCcjs.detectKoreanListBlocks; exports.detectTableCaptions = _chunkO5IIMWXCcjs.detectTableCaptions; exports.extractPdfMetadataOnly = extractPdfMetadataOnly; exports.isPreciseGapProducer = isPreciseGapProducer; exports.mergeCrossPageTables = mergeCrossPageTables; exports.ocrImageRegions = ocrImageRegions; exports.parsePdfDocument = parsePdfDocument; exports.removeHeaderFooterBlocks = _chunkO5IIMWXCcjs.removeHeaderFooterBlocks;
|
|
5440
|
+
//# sourceMappingURL=parser-7V6AQMPT.cjs.map
|