kordoc 4.24.69 → 4.24.71
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 +4 -4
- package/dist/{-KG4BXVPV.js → -F7GLIIGT.js} +21 -21
- package/dist/{chunk-3MQXPZ6R.js → chunk-2CPEW6WC.js} +3 -3
- package/dist/{chunk-3LYXCBQ6.js → chunk-2OF2YWIZ.js} +2 -2
- package/dist/{chunk-PZ7NOQHD.js → chunk-2VBRCIPI.js} +2 -2
- package/dist/{chunk-OWYYRDZR.js → chunk-5WWGC5SG.js} +2 -2
- package/dist/{chunk-LERHV2DV.js → chunk-6ZA4V4QS.js} +2 -2
- package/dist/{chunk-EBBPXRLU.js → chunk-7KVDHXP2.js} +4 -4
- package/dist/{chunk-YBV3DCBB.js → chunk-AUHQRRKM.js} +3 -3
- package/dist/{chunk-6RAP7IYO.js → chunk-BHYBZSOC.js} +2 -2
- package/dist/{chunk-YYGN4RAC.cjs → chunk-BNP3WXTB.cjs} +3 -3
- package/dist/{chunk-YYGN4RAC.cjs.map → chunk-BNP3WXTB.cjs.map} +1 -1
- package/dist/{chunk-53KBBSHJ.js → chunk-D4UFBXMT.js} +2 -2
- package/dist/{chunk-QXZZ37WG.js → chunk-DSCT67WF.js} +3 -3
- package/dist/{chunk-C3OMT5XO.js → chunk-EZNUMAAJ.js} +2 -2
- package/dist/{chunk-4NPX2NIK.js → chunk-GFAWIBHG.js} +10 -10
- package/dist/{chunk-KXVMRGSM.js → chunk-GRCIFCGC.js} +2 -2
- package/dist/{chunk-SQXRRR75.cjs → chunk-H2VOH7X3.cjs} +246 -198
- package/dist/chunk-H2VOH7X3.cjs.map +1 -0
- package/dist/{chunk-AAIU5QXZ.js → chunk-HIYRMYAS.js} +2 -2
- package/dist/{chunk-OYXFVDEL.js → chunk-IMT5TVVM.js} +2 -2
- package/dist/{chunk-KCA54CHN.js → chunk-KGCJNPAI.js} +5 -5
- package/dist/{chunk-EM6II5KB.js → chunk-KLUI4SAZ.js} +2 -2
- package/dist/{chunk-4SKZG3K4.cjs → chunk-LFTO5QAP.cjs} +2 -2
- package/dist/{chunk-4SKZG3K4.cjs.map → chunk-LFTO5QAP.cjs.map} +1 -1
- package/dist/{chunk-4P4ZWHNQ.js → chunk-LNWURZ2Z.js} +7 -7
- package/dist/{chunk-V37SADMF.js → chunk-M27VBFO6.js} +83 -35
- package/dist/chunk-M27VBFO6.js.map +1 -0
- package/dist/{chunk-I776RNAM.js → chunk-MHXPW72E.js} +2 -2
- package/dist/{chunk-YJA4HQUO.js → chunk-NPBNJCXZ.js} +2 -2
- package/dist/{chunk-3APUYEC6.js → chunk-O7PJFEOC.js} +2 -2
- package/dist/{chunk-3CUPBG7W.js → chunk-OJK4FLS5.js} +3 -3
- package/dist/{chunk-U456OELH.js → chunk-OUHMNF2A.js} +2 -2
- package/dist/{chunk-AQSU4NAT.cjs → chunk-OW2XKTQA.cjs} +8 -8
- package/dist/{chunk-AQSU4NAT.cjs.map → chunk-OW2XKTQA.cjs.map} +1 -1
- package/dist/{chunk-ZPSCL2UV.js → chunk-QK5KCWLE.js} +2 -2
- package/dist/{chunk-FQHTZNNA.js → chunk-RUUUGCXS.js} +6 -6
- package/dist/{chunk-MQHAFMEU.js → chunk-RWU3Y5YK.js} +15 -15
- package/dist/{chunk-5ZDXCGBI.cjs → chunk-SK5AOGYK.cjs} +104 -104
- package/dist/{chunk-5ZDXCGBI.cjs.map → chunk-SK5AOGYK.cjs.map} +1 -1
- package/dist/{chunk-6ZWX733V.js → chunk-SMEBVDM2.js} +7 -6
- package/dist/chunk-SMEBVDM2.js.map +1 -0
- package/dist/{chunk-R32ERRRI.js → chunk-T7MHZIFG.js} +84 -36
- package/dist/chunk-T7MHZIFG.js.map +1 -0
- package/dist/{chunk-GMTI7GBK.js → chunk-TYGZ6O2A.js} +11 -11
- package/dist/{chunk-OEBMM2WZ.js → chunk-UJQRIX4L.js} +2 -2
- package/dist/{chunk-XHAM4CGG.js → chunk-WMA4GJHC.js} +7 -6
- package/dist/chunk-WMA4GJHC.js.map +1 -0
- package/dist/{chunk-6T2QXCFD.cjs → chunk-YISBYF7X.cjs} +60 -59
- package/dist/chunk-YISBYF7X.cjs.map +1 -0
- package/dist/{chunk-OZWNUIUS.cjs → chunk-YJ2YVG6N.cjs} +88 -88
- package/dist/{chunk-OZWNUIUS.cjs.map → chunk-YJ2YVG6N.cjs.map} +1 -1
- package/dist/{chunk-JDHX44G4.js → chunk-YPRIJDH6.js} +2 -2
- package/dist/{chunk-ONKURIVQ.js → chunk-YTDHH362.js} +2 -2
- package/dist/{chunk-6RWM6WRI.cjs → chunk-YTP7FPA5.cjs} +3 -3
- package/dist/{chunk-6RWM6WRI.cjs.map → chunk-YTP7FPA5.cjs.map} +1 -1
- package/dist/{chunk-MHRKKMCS.js → chunk-ZPJZXTEG.js} +6 -6
- package/dist/chunks-JAD5Z5YY.js +11 -0
- package/dist/cli.js +45 -45
- package/dist/{formula-ACYUF2DL.js → formula-3PJYUQMG.js} +4 -4
- package/dist/{formula-4HIPZCUM.cjs → formula-RTPZD2IM.cjs} +9 -9
- package/dist/{formula-4HIPZCUM.cjs.map → formula-RTPZD2IM.cjs.map} +1 -1
- package/dist/{formula-TO3RLKBZ.js → formula-UJF4RZ6W.js} +3 -3
- package/dist/generator-EB2436BE.js +18 -0
- package/dist/generator-INMUN6KB.cjs +12 -0
- package/dist/{generator-UAEKNWCY.cjs.map → generator-INMUN6KB.cjs.map} +1 -1
- package/dist/generator-K5KMPSLC.js +11 -0
- package/dist/{hancom-4FAVUJFH.cjs → hancom-MVPEYI4X.cjs} +5 -5
- package/dist/{hancom-4FAVUJFH.cjs.map → hancom-MVPEYI4X.cjs.map} +1 -1
- package/dist/{hancom-JLRWAJ7K.js → hancom-P3SUQXM4.js} +2 -2
- package/dist/{hancom-FCNE5FBM.js → hancom-RYIZHWJ5.js} +2 -2
- package/dist/{image-ocr-53K5Y7RJ.js → image-ocr-GL5YVCNU.js} +10 -10
- package/dist/{image-ocr-HGYEY56S.cjs → image-ocr-ZS4EMQN3.cjs} +28 -28
- package/dist/{image-ocr-HGYEY56S.cjs.map → image-ocr-ZS4EMQN3.cjs.map} +1 -1
- package/dist/{image-ocr-ZIHIC6E7.js → image-ocr-ZXLHPQI2.js} +7 -7
- package/dist/index.cjs +1115 -1115
- package/dist/index.js +9 -9
- package/dist/mcp.js +36 -36
- package/dist/memo-JNMSGIO7.js +17 -0
- package/dist/{model-bundle-VR77PCZE.js → model-bundle-VCUAKBF3.js} +5 -5
- package/dist/{models-CLF7ODRG.js → models-UACAGYBI.js} +5 -5
- package/dist/{parse-worker-v2-WXRS3WBA.js → parse-worker-v2-LJB4QXGF.js} +22 -22
- package/dist/{parser-LKSBUPHG.js → parser-5GZUD22P.js} +12 -12
- package/dist/{parser-H27KVKB7.js → parser-HCZD4DUO.js} +9 -9
- package/dist/{parser-7UHFKMVL.cjs → parser-T4HAQ3QW.cjs} +166 -166
- package/dist/{parser-7UHFKMVL.cjs.map → parser-T4HAQ3QW.cjs.map} +1 -1
- package/dist/pdf-ocr-H4DKZSOB.cjs +43 -0
- package/dist/{pdf-ocr-Z22C7K6C.cjs.map → pdf-ocr-H4DKZSOB.cjs.map} +1 -1
- package/dist/{pdf-ocr-AYLXK6OF.js → pdf-ocr-JXVGK5MR.js} +6 -6
- package/dist/{pdf-ocr-ABMCDMIV.js → pdf-ocr-YCMC2VL4.js} +9 -9
- package/dist/{profile-io-HGOQULXZ.js → profile-io-MVTEOXAU.js} +3 -3
- package/dist/{rasterize-5RWYKMSP.js → rasterize-VWT3C3RW.js} +3 -3
- package/dist/{redact-doc-HNKVSOLJ.js → redact-doc-SU3JDC6F.js} +21 -21
- package/dist/{render-TUDHFNDV.js → render-D5N4FKWB.js} +12 -12
- package/dist/{rewrite-fallback-EWVH2MR4.js → rewrite-fallback-QXTWSPGY.js} +13 -13
- package/dist/seal-Q3BD6CRB.js +16 -0
- package/dist/{setup-5EEOZUUH.js → setup-TXNJYX6P.js} +3 -3
- package/dist/to-hwpx-KZTTH7EY.cjs +16 -0
- package/dist/{to-hwpx-RNZ72ZYF.cjs.map → to-hwpx-KZTTH7EY.cjs.map} +1 -1
- package/dist/{to-hwpx-UHNIAQ2L.js → to-hwpx-YHGVFTBO.js} +4 -4
- package/dist/{to-hwpx-6KY7WGVN.js → to-hwpx-Z7NHUMUD.js} +7 -7
- package/dist/visual-LNHFYJDL.js +38 -0
- package/dist/{watch-SZJOKRCO.js → watch-EI5QYDT2.js} +22 -22
- package/package.json +1 -1
- package/dist/chunk-6T2QXCFD.cjs.map +0 -1
- package/dist/chunk-6ZWX733V.js.map +0 -1
- package/dist/chunk-R32ERRRI.js.map +0 -1
- package/dist/chunk-SQXRRR75.cjs.map +0 -1
- package/dist/chunk-V37SADMF.js.map +0 -1
- package/dist/chunk-XHAM4CGG.js.map +0 -1
- package/dist/chunks-HN36MEGV.js +0 -11
- package/dist/generator-5NUDHWLL.js +0 -11
- package/dist/generator-K2CNNN64.js +0 -18
- package/dist/generator-UAEKNWCY.cjs +0 -12
- package/dist/memo-ALIRNVIU.js +0 -17
- package/dist/pdf-ocr-Z22C7K6C.cjs +0 -43
- package/dist/seal-R6WDXSRI.js +0 -16
- package/dist/to-hwpx-RNZ72ZYF.cjs +0 -16
- package/dist/visual-Z5HND4S7.js +0 -38
- /package/dist/{-KG4BXVPV.js.map → -F7GLIIGT.js.map} +0 -0
- /package/dist/{chunk-3MQXPZ6R.js.map → chunk-2CPEW6WC.js.map} +0 -0
- /package/dist/{chunk-3LYXCBQ6.js.map → chunk-2OF2YWIZ.js.map} +0 -0
- /package/dist/{chunk-PZ7NOQHD.js.map → chunk-2VBRCIPI.js.map} +0 -0
- /package/dist/{chunk-OWYYRDZR.js.map → chunk-5WWGC5SG.js.map} +0 -0
- /package/dist/{chunk-LERHV2DV.js.map → chunk-6ZA4V4QS.js.map} +0 -0
- /package/dist/{chunk-EBBPXRLU.js.map → chunk-7KVDHXP2.js.map} +0 -0
- /package/dist/{chunk-YBV3DCBB.js.map → chunk-AUHQRRKM.js.map} +0 -0
- /package/dist/{chunk-6RAP7IYO.js.map → chunk-BHYBZSOC.js.map} +0 -0
- /package/dist/{chunk-53KBBSHJ.js.map → chunk-D4UFBXMT.js.map} +0 -0
- /package/dist/{chunk-QXZZ37WG.js.map → chunk-DSCT67WF.js.map} +0 -0
- /package/dist/{chunk-C3OMT5XO.js.map → chunk-EZNUMAAJ.js.map} +0 -0
- /package/dist/{chunk-4NPX2NIK.js.map → chunk-GFAWIBHG.js.map} +0 -0
- /package/dist/{chunk-KXVMRGSM.js.map → chunk-GRCIFCGC.js.map} +0 -0
- /package/dist/{chunk-AAIU5QXZ.js.map → chunk-HIYRMYAS.js.map} +0 -0
- /package/dist/{chunk-OYXFVDEL.js.map → chunk-IMT5TVVM.js.map} +0 -0
- /package/dist/{chunk-KCA54CHN.js.map → chunk-KGCJNPAI.js.map} +0 -0
- /package/dist/{chunk-EM6II5KB.js.map → chunk-KLUI4SAZ.js.map} +0 -0
- /package/dist/{chunk-4P4ZWHNQ.js.map → chunk-LNWURZ2Z.js.map} +0 -0
- /package/dist/{chunk-I776RNAM.js.map → chunk-MHXPW72E.js.map} +0 -0
- /package/dist/{chunk-YJA4HQUO.js.map → chunk-NPBNJCXZ.js.map} +0 -0
- /package/dist/{chunk-3APUYEC6.js.map → chunk-O7PJFEOC.js.map} +0 -0
- /package/dist/{chunk-3CUPBG7W.js.map → chunk-OJK4FLS5.js.map} +0 -0
- /package/dist/{chunk-U456OELH.js.map → chunk-OUHMNF2A.js.map} +0 -0
- /package/dist/{chunk-ZPSCL2UV.js.map → chunk-QK5KCWLE.js.map} +0 -0
- /package/dist/{chunk-FQHTZNNA.js.map → chunk-RUUUGCXS.js.map} +0 -0
- /package/dist/{chunk-MQHAFMEU.js.map → chunk-RWU3Y5YK.js.map} +0 -0
- /package/dist/{chunk-GMTI7GBK.js.map → chunk-TYGZ6O2A.js.map} +0 -0
- /package/dist/{chunk-OEBMM2WZ.js.map → chunk-UJQRIX4L.js.map} +0 -0
- /package/dist/{chunk-JDHX44G4.js.map → chunk-YPRIJDH6.js.map} +0 -0
- /package/dist/{chunk-ONKURIVQ.js.map → chunk-YTDHH362.js.map} +0 -0
- /package/dist/{chunk-MHRKKMCS.js.map → chunk-ZPJZXTEG.js.map} +0 -0
- /package/dist/{chunks-HN36MEGV.js.map → chunks-JAD5Z5YY.js.map} +0 -0
- /package/dist/{formula-ACYUF2DL.js.map → formula-3PJYUQMG.js.map} +0 -0
- /package/dist/{formula-TO3RLKBZ.js.map → formula-UJF4RZ6W.js.map} +0 -0
- /package/dist/{generator-5NUDHWLL.js.map → generator-EB2436BE.js.map} +0 -0
- /package/dist/{generator-K2CNNN64.js.map → generator-K5KMPSLC.js.map} +0 -0
- /package/dist/{hancom-JLRWAJ7K.js.map → hancom-P3SUQXM4.js.map} +0 -0
- /package/dist/{hancom-FCNE5FBM.js.map → hancom-RYIZHWJ5.js.map} +0 -0
- /package/dist/{image-ocr-53K5Y7RJ.js.map → image-ocr-GL5YVCNU.js.map} +0 -0
- /package/dist/{image-ocr-ZIHIC6E7.js.map → image-ocr-ZXLHPQI2.js.map} +0 -0
- /package/dist/{memo-ALIRNVIU.js.map → memo-JNMSGIO7.js.map} +0 -0
- /package/dist/{model-bundle-VR77PCZE.js.map → model-bundle-VCUAKBF3.js.map} +0 -0
- /package/dist/{models-CLF7ODRG.js.map → models-UACAGYBI.js.map} +0 -0
- /package/dist/{parse-worker-v2-WXRS3WBA.js.map → parse-worker-v2-LJB4QXGF.js.map} +0 -0
- /package/dist/{parser-LKSBUPHG.js.map → parser-5GZUD22P.js.map} +0 -0
- /package/dist/{parser-H27KVKB7.js.map → parser-HCZD4DUO.js.map} +0 -0
- /package/dist/{pdf-ocr-ABMCDMIV.js.map → pdf-ocr-JXVGK5MR.js.map} +0 -0
- /package/dist/{pdf-ocr-AYLXK6OF.js.map → pdf-ocr-YCMC2VL4.js.map} +0 -0
- /package/dist/{profile-io-HGOQULXZ.js.map → profile-io-MVTEOXAU.js.map} +0 -0
- /package/dist/{rasterize-5RWYKMSP.js.map → rasterize-VWT3C3RW.js.map} +0 -0
- /package/dist/{redact-doc-HNKVSOLJ.js.map → redact-doc-SU3JDC6F.js.map} +0 -0
- /package/dist/{render-TUDHFNDV.js.map → render-D5N4FKWB.js.map} +0 -0
- /package/dist/{rewrite-fallback-EWVH2MR4.js.map → rewrite-fallback-QXTWSPGY.js.map} +0 -0
- /package/dist/{seal-R6WDXSRI.js.map → seal-Q3BD6CRB.js.map} +0 -0
- /package/dist/{setup-5EEOZUUH.js.map → setup-TXNJYX6P.js.map} +0 -0
- /package/dist/{to-hwpx-6KY7WGVN.js.map → to-hwpx-YHGVFTBO.js.map} +0 -0
- /package/dist/{to-hwpx-UHNIAQ2L.js.map → to-hwpx-Z7NHUMUD.js.map} +0 -0
- /package/dist/{visual-Z5HND4S7.js.map → visual-LNHFYJDL.js.map} +0 -0
- /package/dist/{watch-SZJOKRCO.js.map → watch-EI5QYDT2.js.map} +0 -0
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
|
|
8
|
-
var
|
|
8
|
+
var _chunkBNP3WXTBcjs = require('./chunk-BNP3WXTB.cjs');
|
|
9
9
|
|
|
10
10
|
|
|
11
11
|
var _chunk6NZ32OTXcjs = require('./chunk-6NZ32OTX.cjs');
|
|
@@ -69,11 +69,11 @@ var _chunkJ55UQC5Hcjs = require('./chunk-J55UQC5H.cjs');
|
|
|
69
69
|
|
|
70
70
|
|
|
71
71
|
|
|
72
|
-
var
|
|
72
|
+
var _chunkH2VOH7X3cjs = require('./chunk-H2VOH7X3.cjs');
|
|
73
73
|
|
|
74
74
|
|
|
75
75
|
var _chunkMMK32GPDcjs = require('./chunk-MMK32GPD.cjs');
|
|
76
|
-
require('./chunk-
|
|
76
|
+
require('./chunk-YTP7FPA5.cjs');
|
|
77
77
|
|
|
78
78
|
|
|
79
79
|
|
|
@@ -90,11 +90,11 @@ require('./chunk-6RWM6WRI.cjs');
|
|
|
90
90
|
|
|
91
91
|
|
|
92
92
|
|
|
93
|
-
var
|
|
93
|
+
var _chunkOW2XKTQAcjs = require('./chunk-OW2XKTQA.cjs');
|
|
94
94
|
|
|
95
95
|
|
|
96
96
|
|
|
97
|
-
var
|
|
97
|
+
var _chunkLFTO5QAPcjs = require('./chunk-LFTO5QAP.cjs');
|
|
98
98
|
|
|
99
99
|
|
|
100
100
|
var _chunkGS7T56RPcjs = require('./chunk-GS7T56RP.cjs');
|
|
@@ -427,7 +427,7 @@ async function extractPageImages(page, fnArray, argsArray, pageNumber, state, wa
|
|
|
427
427
|
let pristine;
|
|
428
428
|
let paintIndex = -1;
|
|
429
429
|
const regions = state.placement ? /* @__PURE__ */ new Map() : void 0;
|
|
430
|
-
if (regions)
|
|
430
|
+
if (regions) _chunkH2VOH7X3cjs.extractImageRegions.call(void 0, fnArray, argsArray, false, regions);
|
|
431
431
|
const placed = (block, i) => {
|
|
432
432
|
const r = _optionalChain([regions, 'optionalAccess', _4 => _4.get, 'call', _5 => _5(i)]);
|
|
433
433
|
if (r) block.bbox = { page: pageNumber, x: r.x1, y: r.y1, width: r.x2 - r.x1, height: r.y2 - r.y1 };
|
|
@@ -509,7 +509,7 @@ async function extractPageImages(page, fnArray, argsArray, pageNumber, state, wa
|
|
|
509
509
|
if (state.seen.has(hash)) continue;
|
|
510
510
|
const rgba = toRgba(imgData, withBytes || !!readQr || state.dropBlank);
|
|
511
511
|
if (!rgba) continue;
|
|
512
|
-
if (state.dropBlank &&
|
|
512
|
+
if (state.dropBlank && _chunkBNP3WXTBcjs.isBlankRgba.call(void 0, rgba)) {
|
|
513
513
|
state.seen.set(hash, "");
|
|
514
514
|
continue;
|
|
515
515
|
}
|
|
@@ -609,7 +609,7 @@ async function extractPdfiumImage(image, pageNumber, state, warnings, withBytes,
|
|
|
609
609
|
const hash = `${w}x${h}kPh${contentHash(rgba)}`;
|
|
610
610
|
state.rawKeys.set(image.raw, hash);
|
|
611
611
|
if (state.seen.has(hash)) return null;
|
|
612
|
-
if (state.dropBlank &&
|
|
612
|
+
if (state.dropBlank && _chunkBNP3WXTBcjs.isBlankRgba.call(void 0, rgba)) {
|
|
613
613
|
state.seen.set(hash, "");
|
|
614
614
|
return null;
|
|
615
615
|
}
|
|
@@ -1057,13 +1057,13 @@ function ocrVectorOps(opList, paths) {
|
|
|
1057
1057
|
|
|
1058
1058
|
// src/pdf/split-row-pattern.ts
|
|
1059
1059
|
var textOf = (cell) => cell.text.replace(/<\/?u>|~~/g, "").trim();
|
|
1060
|
-
var plain = (cell) => !_optionalChain([cell, 'access', _31 => _31.blocks, 'optionalAccess', _32 => _32.length]) && !
|
|
1060
|
+
var plain = (cell) => !_optionalChain([cell, 'access', _31 => _31.blocks, 'optionalAccess', _32 => _32.length]) && !_chunkH2VOH7X3cjs.IMAGE_CELLS.has(cell);
|
|
1061
1061
|
var labelsOf = (cell) => {
|
|
1062
1062
|
const labels = textOf(cell).split("\n").map((s) => s.trim()).filter(Boolean);
|
|
1063
1063
|
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;
|
|
1064
1064
|
};
|
|
1065
1065
|
var alignedLabels = (label, value, count) => {
|
|
1066
|
-
const L =
|
|
1066
|
+
const L = _chunkH2VOH7X3cjs.CELL_LINES.get(label), V = _chunkH2VOH7X3cjs.CELL_LINES.get(value);
|
|
1067
1067
|
let next = 0;
|
|
1068
1068
|
return !!L && !!V && L.length === count && V.length >= count && Math.abs(L[0].y - V[0].y) <= 1 && L.every((l) => {
|
|
1069
1069
|
while (next < V.length && Math.abs(l.y - V[next].y) > 1) next++;
|
|
@@ -1071,7 +1071,7 @@ var alignedLabels = (label, value, count) => {
|
|
|
1071
1071
|
});
|
|
1072
1072
|
};
|
|
1073
1073
|
function partialAlignedLabelCells(table, owner, first) {
|
|
1074
|
-
const pageOf = (a) => _nullishCoalesce(
|
|
1074
|
+
const pageOf = (a) => _nullishCoalesce(_chunkOW2XKTQAcjs.CELL_PAGES.get(_nullishCoalesce(a.cell, () => ( table.cells[a.r][a.c]))), () => ( (a.r < first ? -1 : -2)));
|
|
1075
1075
|
const pairs = [];
|
|
1076
1076
|
let carried = false;
|
|
1077
1077
|
for (let c = 0; c < table.cols; ) {
|
|
@@ -1094,10 +1094,10 @@ function partialAlignedLabelCells(table, owner, first) {
|
|
|
1094
1094
|
const keyed = pairs.filter((p) => labelsOf(p.upper) && labelsOf(p.lower));
|
|
1095
1095
|
if (keyed.length !== 1) return;
|
|
1096
1096
|
const label = keyed[0], value = pairs.find((p) => p.c === label.c + label.cs), context = pairs.find((p) => p.c + p.cs === label.c);
|
|
1097
|
-
if (!value || !context || value === context || textOf(context.upper).replace(/\s+/g, "") === textOf(context.lower).replace(/\s+/g, "") || !_optionalChain([
|
|
1097
|
+
if (!value || !context || value === context || textOf(context.upper).replace(/\s+/g, "") === textOf(context.lower).replace(/\s+/g, "") || !_optionalChain([_chunkOW2XKTQAcjs.CELL_EDGES, 'access', _43 => _43.get, 'call', _44 => _44(context.upper), 'optionalAccess', _45 => _45.b]) || !_optionalChain([_chunkOW2XKTQAcjs.CELL_EDGES, 'access', _46 => _46.get, 'call', _47 => _47(context.lower), 'optionalAccess', _48 => _48.t])) return;
|
|
1098
1098
|
const U = labelsOf(label.upper), D = labelsOf(label.lower), sequence = [...U, ...D];
|
|
1099
1099
|
if (D.length < 2 || sequence.length < 3 || new Set(sequence).size !== sequence.length || !alignedLabels(label.upper, value.upper, U.length)) return;
|
|
1100
|
-
const L =
|
|
1100
|
+
const L = _chunkH2VOH7X3cjs.CELL_LINES.get(label.lower), V = _chunkH2VOH7X3cjs.CELL_LINES.get(value.lower);
|
|
1101
1101
|
if (!L || !V || L.length !== D.length) return;
|
|
1102
1102
|
let next = V.findIndex((v) => Math.abs(v.y - L[0].y) <= 1);
|
|
1103
1103
|
if (next <= 0 || !V.slice(0, next).every((v) => v.y > L[0].y + 1) || !L.every((l) => {
|
|
@@ -1117,14 +1117,14 @@ function partialAlignedLabelCells(table, owner, first) {
|
|
|
1117
1117
|
continue;
|
|
1118
1118
|
}
|
|
1119
1119
|
if (list.length < 3 || new Set(list).size !== list.length) continue;
|
|
1120
|
-
const visible = _nullishCoalesce(_optionalChain([
|
|
1120
|
+
const visible = _nullishCoalesce(_optionalChain([_chunkH2VOH7X3cjs.CELL_LINES, 'access', _53 => _53.get, 'call', _54 => _54(lc), 'optionalAccess', _55 => _55.length]), () => ( 0)), values = _chunkH2VOH7X3cjs.CELL_LINES.get(vc);
|
|
1121
1121
|
if (visible < 3 || visible > list.length || !values || !alignedLabels(lc, vc, visible)) continue;
|
|
1122
1122
|
const top = Math.max(...values.map((v2) => v2.y)), bottom = Math.min(...values.map((v2) => v2.y));
|
|
1123
1123
|
const contexts = [];
|
|
1124
1124
|
for (let rr = r; rr < r + l.rs && rr < table.rows; rr++) {
|
|
1125
1125
|
const a = _optionalChain([owner, 'access', _56 => _56[rr], 'optionalAccess', _57 => _57[context.c]]), cell = a ? table.cells[a.r][a.c] : void 0;
|
|
1126
1126
|
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;
|
|
1127
|
-
const lines =
|
|
1127
|
+
const lines = _chunkH2VOH7X3cjs.CELL_LINES.get(cell);
|
|
1128
1128
|
if (!_optionalChain([lines, 'optionalAccess', _58 => _58.length]) || lines.some((line) => line.y > top + 1 || line.y < bottom - 1)) break;
|
|
1129
1129
|
contexts.push(textOf(cell).replace(/\s+/g, ""));
|
|
1130
1130
|
}
|
|
@@ -1426,7 +1426,7 @@ function rowStarts(t) {
|
|
|
1426
1426
|
}
|
|
1427
1427
|
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));
|
|
1428
1428
|
function cellPage(cell) {
|
|
1429
|
-
const p =
|
|
1429
|
+
const p = _chunkOW2XKTQAcjs.CELL_PAGES.get(cell);
|
|
1430
1430
|
if (p !== void 0 || !_optionalChain([cell, 'access', _125 => _125.blocks, 'optionalAccess', _126 => _126.length]) || cell.blocks.some((b) => b.pageNumber === void 0)) return p;
|
|
1431
1431
|
return Math.min(...cell.blocks.map((b) => b.pageNumber));
|
|
1432
1432
|
}
|
|
@@ -1455,7 +1455,7 @@ function markJoinedPages(table, prev, curr) {
|
|
|
1455
1455
|
rows.forEach((starts, r) => {
|
|
1456
1456
|
const page2 = r < pt.rows ? pp[r] : cp[r - off];
|
|
1457
1457
|
for (const { cell } of starts) {
|
|
1458
|
-
if (page2 !== void 0 && page2 !== prev.pageNumber)
|
|
1458
|
+
if (page2 !== void 0 && page2 !== prev.pageNumber) _chunkOW2XKTQAcjs.CELL_PAGES.set(cell, page2);
|
|
1459
1459
|
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))]);
|
|
1460
1460
|
if (src) setSplits(cell, relocate(src.cell, cell));
|
|
1461
1461
|
}
|
|
@@ -1515,8 +1515,8 @@ function splitCrossPageRows(t, pageNumber) {
|
|
|
1515
1515
|
if (!splits.length) continue;
|
|
1516
1516
|
const clone = (cell, patch) => {
|
|
1517
1517
|
const out = { ...cell, ...patch };
|
|
1518
|
-
const p =
|
|
1519
|
-
if (p !== void 0)
|
|
1518
|
+
const p = _chunkOW2XKTQAcjs.CELL_PAGES.get(cell);
|
|
1519
|
+
if (p !== void 0) _chunkOW2XKTQAcjs.CELL_PAGES.set(out, p);
|
|
1520
1520
|
if (!("text" in patch) && CELL_SPLITS.has(cell)) CELL_SPLITS.set(out, CELL_SPLITS.get(cell));
|
|
1521
1521
|
return out;
|
|
1522
1522
|
};
|
|
@@ -1527,7 +1527,7 @@ function splitCrossPageRows(t, pageNumber) {
|
|
|
1527
1527
|
for (const { cell, c, split } of splits) {
|
|
1528
1528
|
cells[r][c] = clone(cell, { ...split.head, rowSpan: cut - r });
|
|
1529
1529
|
const tail = { ...cell, ...split.tail, rowSpan: r + cell.rowSpan - cut };
|
|
1530
|
-
|
|
1530
|
+
_chunkOW2XKTQAcjs.CELL_PAGES.set(tail, split.page);
|
|
1531
1531
|
setSplits(tail, split.rest);
|
|
1532
1532
|
cells[cut][c] = tail;
|
|
1533
1533
|
}
|
|
@@ -1537,7 +1537,7 @@ function splitCrossPageRows(t, pageNumber) {
|
|
|
1537
1537
|
for (const { cell, c, split } of splits) {
|
|
1538
1538
|
cells[r][c] = clone(cell, split.head);
|
|
1539
1539
|
const tail = { ...cell, ...split.tail, rowSpan: 1 };
|
|
1540
|
-
|
|
1540
|
+
_chunkOW2XKTQAcjs.CELL_PAGES.set(tail, split.page);
|
|
1541
1541
|
setSplits(tail, split.rest);
|
|
1542
1542
|
row[c] = tail;
|
|
1543
1543
|
}
|
|
@@ -1628,7 +1628,7 @@ function joinSplitParts(prev, pcx, curr, ccx, dx = 0, prevBottom, lex) {
|
|
|
1628
1628
|
if (cols < 1) return null;
|
|
1629
1629
|
const pa = anchorsOf(prev), ca = anchorsOf(curr);
|
|
1630
1630
|
const cutOpen = (() => {
|
|
1631
|
-
const u =
|
|
1631
|
+
const u = _chunkH2VOH7X3cjs.ROW_RULES.get(prev), d = _chunkH2VOH7X3cjs.ROW_RULES.get(curr);
|
|
1632
1632
|
return !!u && !!d && !u.bottom && !d.top;
|
|
1633
1633
|
})();
|
|
1634
1634
|
let skip = 0, head = 0;
|
|
@@ -1660,19 +1660,19 @@ function joinSplitParts(prev, pcx, curr, ccx, dx = 0, prevBottom, lex) {
|
|
|
1660
1660
|
if (r + dr < rows) owner[r + dr][dc] = placed;
|
|
1661
1661
|
}
|
|
1662
1662
|
grid[r][c1] = { ...a.cell, colSpan: c2 - c1, rowSpan: a.rs };
|
|
1663
|
-
const lines =
|
|
1664
|
-
if (lines)
|
|
1665
|
-
if (
|
|
1666
|
-
const edges =
|
|
1663
|
+
const lines = _chunkH2VOH7X3cjs.CELL_LINES.get(a.cell);
|
|
1664
|
+
if (lines) _chunkH2VOH7X3cjs.CELL_LINES.set(grid[r][c1], shift ? lines.map((l) => ({ ...l, l: l.l + shift, r: l.r + shift })) : lines);
|
|
1665
|
+
if (_chunkH2VOH7X3cjs.IMAGE_CELLS.has(a.cell)) _chunkH2VOH7X3cjs.IMAGE_CELLS.add(grid[r][c1]);
|
|
1666
|
+
const edges = _chunkOW2XKTQAcjs.CELL_EDGES.get(a.cell);
|
|
1667
1667
|
if (edges) {
|
|
1668
|
-
|
|
1668
|
+
_chunkOW2XKTQAcjs.CELL_EDGES.set(grid[r][c1], edges);
|
|
1669
1669
|
edged = true;
|
|
1670
1670
|
}
|
|
1671
1671
|
return true;
|
|
1672
1672
|
};
|
|
1673
|
-
for (const a of pa) if (!
|
|
1673
|
+
for (const a of pa) if (!_chunkH2VOH7X3cjs.FILLER_CELLS.has(a.cell) && !place(a, pcx, 0)) return null;
|
|
1674
1674
|
for (const a of ca) {
|
|
1675
|
-
if (a.r < skip ||
|
|
1675
|
+
if (a.r < skip || _chunkH2VOH7X3cjs.FILLER_CELLS.has(a.cell)) continue;
|
|
1676
1676
|
if (!place(a, cxU, prev.rows - skip, dx)) return null;
|
|
1677
1677
|
}
|
|
1678
1678
|
const first = prev.rows;
|
|
@@ -1696,9 +1696,9 @@ function joinSplitParts(prev, pcx, curr, ccx, dx = 0, prevBottom, lex) {
|
|
|
1696
1696
|
const grown = { ...above, rs: newRs };
|
|
1697
1697
|
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;
|
|
1698
1698
|
}
|
|
1699
|
-
for (let r = 0; r < rows; r++) for (let c = 0; c < cols; c++) if (owner[r][c] === null)
|
|
1699
|
+
for (let r = 0; r < rows; r++) for (let c = 0; c < cols; c++) if (owner[r][c] === null) _chunkH2VOH7X3cjs.FILLER_CELLS.add(grid[r][c]);
|
|
1700
1700
|
if (edged) {
|
|
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) _chunkOW2XKTQAcjs.CELL_EDGES.set(grid[r][c], _chunkH2VOH7X3cjs.NO_EDGES);
|
|
1702
1702
|
}
|
|
1703
1703
|
for (let c = 0; c < cols && U[c + 1] <= pcx[0] + PART_COL_TOL; c++) {
|
|
1704
1704
|
let r = prev.rows;
|
|
@@ -1707,7 +1707,7 @@ function joinSplitParts(prev, pcx, curr, ccx, dx = 0, prevBottom, lex) {
|
|
|
1707
1707
|
for (let rr = 0; rr < r; rr++) owner[rr][c] = through;
|
|
1708
1708
|
}
|
|
1709
1709
|
const table = { rows, cols, cells: grid, hasHeader: prev.hasHeader, ...prev.caption ? { caption: prev.caption } : {} };
|
|
1710
|
-
const pr =
|
|
1710
|
+
const pr = _chunkH2VOH7X3cjs.ROW_RULES.get(prev), cr = _chunkH2VOH7X3cjs.ROW_RULES.get(curr);
|
|
1711
1711
|
const shifted = dx !== 0;
|
|
1712
1712
|
const cut = {
|
|
1713
1713
|
open: !!pr && !!cr && !pr.bottom && !cr.top && pr.innerOpen + cr.innerOpen === 0 && pr.innerRuled + cr.innerRuled > 0,
|
|
@@ -1715,13 +1715,13 @@ function joinSplitParts(prev, pcx, curr, ccx, dx = 0, prevBottom, lex) {
|
|
|
1715
1715
|
list: !shifted ? "any" : skip > 0 && ca.filter((a) => a.r < skip && a.cell.text.trim()).length < 2 ? "none" : "multi"
|
|
1716
1716
|
};
|
|
1717
1717
|
let partial = !skip && cols === prev.cols && cols === curr.cols && cut.ruled && prevBottom !== void 0 ? partialAlignedLabelCells(table, owner, first) : void 0;
|
|
1718
|
-
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]) ||
|
|
1718
|
+
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]) || _chunkH2VOH7X3cjs.startsNewItem.call(void 0, partial.value.upper.text, partial.value.lower.text))) partial = void 0;
|
|
1719
1719
|
const selected = partial ? /* @__PURE__ */ new Set([partial.label.c, partial.value.c]) : void 0;
|
|
1720
1720
|
let split = !selected && rows > prev.rows && mergeSplitRow(table, owner, prev.rows, U, false, cut);
|
|
1721
1721
|
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 });
|
|
1722
1722
|
if (pr && cr) {
|
|
1723
1723
|
const cutRuled = pr.bottom || cr.top;
|
|
1724
|
-
|
|
1724
|
+
_chunkH2VOH7X3cjs.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) });
|
|
1725
1725
|
}
|
|
1726
1726
|
return { table, colXs: U, split, header: ca.filter((a) => a.r < skip && a.cell.text.trim()).length >= 2 };
|
|
1727
1727
|
}
|
|
@@ -1783,18 +1783,18 @@ function mergeStraddlingCells(table, owner, first, prevBottom, lex, colXs, selec
|
|
|
1783
1783
|
if (!d || d === u || u.r + u.rs - 1 !== last || d.r !== first || d.c !== u.c || d.cs !== u.cs) continue;
|
|
1784
1784
|
const a = table.cells[u.r][u.c], b = table.cells[first][d.c];
|
|
1785
1785
|
if (selected && !selected.has(u.c)) continue;
|
|
1786
|
-
const flowsOn = itemBreak && straddles && !!colXs && hasContent(a) && hasContent(b) && longLastLine(a) && !
|
|
1787
|
-
const openSeam = hasContent(a) && hasContent(b) &&
|
|
1786
|
+
const flowsOn = itemBreak && straddles && !!colXs && hasContent(a) && hasContent(b) && longLastLine(a) && !_chunkH2VOH7X3cjs.startsNewItem.call(void 0, a.text, b.text) && continuesAcross(a, b, colXs[u.c], colXs[u.c + u.cs]);
|
|
1787
|
+
const openSeam = hasContent(a) && hasContent(b) && _chunkH2VOH7X3cjs.hasOpenCellSeam.call(void 0, a, b) && !owner.some((row, r) => {
|
|
1788
1788
|
if (!r || r === first) return false;
|
|
1789
1789
|
const up = owner[r - 1][u.c], down = row[u.c];
|
|
1790
1790
|
if (!up || !down || up === down || up.c !== u.c || down.c !== u.c || up.cs !== u.cs || down.cs !== u.cs) return false;
|
|
1791
|
-
const ue =
|
|
1791
|
+
const ue = _chunkOW2XKTQAcjs.CELL_EDGES.get(table.cells[up.r][up.c]), de = _chunkOW2XKTQAcjs.CELL_EDGES.get(table.cells[down.r][down.c]);
|
|
1792
1792
|
return !!ue && !!de && !ue.b && !de.t;
|
|
1793
1793
|
});
|
|
1794
1794
|
if (!selected && !openSeam && !flowsOn && !crossed.has(shape(u, d)) && !(u.rs >= 2 && u.c + u.cs <= firstNew && hasContent(a) && !hasContent(b))) {
|
|
1795
1795
|
if (!straddles && !midWord) continue;
|
|
1796
1796
|
if (u.r >= last && d.rs < 2) continue;
|
|
1797
|
-
const U =
|
|
1797
|
+
const U = _chunkH2VOH7X3cjs.CELL_LINES.get(a);
|
|
1798
1798
|
if (!_optionalChain([U, 'optionalAccess', _156 => _156.length]) || !hasContent(b)) continue;
|
|
1799
1799
|
if (!(straddles && filledToBottom(U, prevBottom) && clauseContinues(a, b))) {
|
|
1800
1800
|
if (U.length > STRADDLE_MAX_LINES) continue;
|
|
@@ -1812,7 +1812,7 @@ function mergeStraddlingCells(table, owner, first, prevBottom, lex, colXs, selec
|
|
|
1812
1812
|
return merged;
|
|
1813
1813
|
}
|
|
1814
1814
|
function longLastLine(c) {
|
|
1815
|
-
const L =
|
|
1815
|
+
const L = _chunkH2VOH7X3cjs.CELL_LINES.get(c), l = _optionalChain([L, 'optionalAccess', _157 => _157[L.length - 1]]);
|
|
1816
1816
|
return !!l && l.r - l.l >= 6 * (l.h || 10);
|
|
1817
1817
|
}
|
|
1818
1818
|
function filledToBottom(U, bottom) {
|
|
@@ -1845,7 +1845,7 @@ function nextItemHead(prev, next) {
|
|
|
1845
1845
|
return false;
|
|
1846
1846
|
}
|
|
1847
1847
|
function continuesAcross(u, d, x1, x2) {
|
|
1848
|
-
const U =
|
|
1848
|
+
const U = _chunkH2VOH7X3cjs.CELL_LINES.get(u), D = _chunkH2VOH7X3cjs.CELL_LINES.get(d);
|
|
1849
1849
|
if (!_optionalChain([U, 'optionalAccess', _158 => _158.length]) || !_optionalChain([D, 'optionalAccess', _159 => _159.length])) return false;
|
|
1850
1850
|
const last = U[U.length - 1];
|
|
1851
1851
|
const fs = last.h || 10;
|
|
@@ -1863,7 +1863,7 @@ function continuesAcross(u, d, x1, x2) {
|
|
|
1863
1863
|
if (U.length === 1 && x2 - last.r > Math.max(FULL_LINE_EDGE_MIN, SINGLE_LINE_WORD_GAP * fs)) return false;
|
|
1864
1864
|
const indented = last.l - minL >= HANGING_MIN * fs;
|
|
1865
1865
|
if (last.r - last.l < FULL_LINE_MIN_FRAC * (indented ? x2 - last.l : x2 - x1)) return false;
|
|
1866
|
-
const newItem =
|
|
1866
|
+
const newItem = _chunkH2VOH7X3cjs.startsNewItem.call(void 0, u.text, d.text);
|
|
1867
1867
|
const all = D.length ? U.concat(D) : U;
|
|
1868
1868
|
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));
|
|
1869
1869
|
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;
|
|
@@ -1880,10 +1880,10 @@ function outlineContinues(u, d) {
|
|
|
1880
1880
|
return U.length >= 2 && D.length >= 1 && U.some((l) => OUTLINE_HEAD.test(l)) && OUTLINE_ITEM.test(D[0]);
|
|
1881
1881
|
}
|
|
1882
1882
|
function lineEnded(c, x1, x2, next) {
|
|
1883
|
-
const L =
|
|
1883
|
+
const L = _chunkH2VOH7X3cjs.CELL_LINES.get(c);
|
|
1884
1884
|
if (!L || L.length !== 1) return false;
|
|
1885
1885
|
const l = L[0], h = l.h || 10;
|
|
1886
|
-
const d0 = next ? _optionalChain([
|
|
1886
|
+
const d0 = next ? _optionalChain([_chunkH2VOH7X3cjs.CELL_LINES, 'access', _160 => _160.get, 'call', _161 => _161(next), 'optionalAccess', _162 => _162[0]]) : void 0;
|
|
1887
1887
|
if (d0 && d0.l - l.l >= HANGING_MIN * h) return false;
|
|
1888
1888
|
return x2 - l.r - (l.l - x1) >= Math.max(LABEL_ROOM, firstWordUnits(_nullishCoalesce(_optionalChain([next, 'optionalAccess', _163 => _163.text]), () => ( "")))) * h;
|
|
1889
1889
|
}
|
|
@@ -1894,15 +1894,15 @@ function firstWordUnits(text) {
|
|
|
1894
1894
|
return units;
|
|
1895
1895
|
}
|
|
1896
1896
|
function appendCell(a, b) {
|
|
1897
|
-
if (
|
|
1897
|
+
if (_chunkH2VOH7X3cjs.IMAGE_CELLS.has(b)) _chunkH2VOH7X3cjs.IMAGE_CELLS.add(a);
|
|
1898
1898
|
if (_optionalChain([a, 'access', _164 => _164.blocks, 'optionalAccess', _165 => _165.length]) || _optionalChain([b, 'access', _166 => _166.blocks, 'optionalAccess', _167 => _167.length])) {
|
|
1899
1899
|
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 }));
|
|
1900
1900
|
a.blocks = [...asBlocks(a), ...asBlocks(b)];
|
|
1901
1901
|
}
|
|
1902
1902
|
if (b.text.trim()) a.text = a.text.trim() ? a.text + "\n" + b.text : b.text;
|
|
1903
|
-
|
|
1903
|
+
_chunkH2VOH7X3cjs.joinCellEdges.call(void 0, a, b);
|
|
1904
1904
|
}
|
|
1905
|
-
var hasContent = (cell) => !!cell.text.trim() || !!_optionalChain([cell, 'access', _170 => _170.blocks, 'optionalAccess', _171 => _171.length]) ||
|
|
1905
|
+
var hasContent = (cell) => !!cell.text.trim() || !!_optionalChain([cell, 'access', _170 => _170.blocks, 'optionalAccess', _171 => _171.length]) || _chunkH2VOH7X3cjs.IMAGE_CELLS.has(cell);
|
|
1906
1906
|
var CLAUSE_OPEN_ENDING = /(?:하는|되는|하고|하며|하여|되어|되고|되며|이며|으며|어야|아야|여야)$/;
|
|
1907
1907
|
var batchim = (ch) => {
|
|
1908
1908
|
const k = ch.charCodeAt(0) - 44032;
|
|
@@ -1910,7 +1910,7 @@ var batchim = (ch) => {
|
|
|
1910
1910
|
};
|
|
1911
1911
|
function clauseContinues(u, d) {
|
|
1912
1912
|
const tail = _nullishCoalesce(flowText(u.text).trim().split(/\s+/).pop(), () => ( "")), head = flowText(d.text).trim();
|
|
1913
|
-
if (!/^[가-힣]{2,}$/.test(tail) || !/^[가-힣]/.test(head) ||
|
|
1913
|
+
if (!/^[가-힣]{2,}$/.test(tail) || !/^[가-힣]/.test(head) || _chunkH2VOH7X3cjs.startsNewItem.call(void 0, u.text, head)) return false;
|
|
1914
1914
|
const last = tail[tail.length - 1], before = tail[tail.length - 2];
|
|
1915
1915
|
return last === "\uC744" && batchim(before) || last === "\uB97C" && !batchim(before) || CLAUSE_OPEN_ENDING.test(tail);
|
|
1916
1916
|
}
|
|
@@ -1918,8 +1918,8 @@ function quantityContinues(u, d) {
|
|
|
1918
1918
|
return /\d[\d,.]*\s*(?:%|[가-힣]{1,2})?$/.test(flowText(u.text).trim()) && /^(?:미만|이상|이하|초과)(?![가-힣])/.test(flowText(d.text).trim());
|
|
1919
1919
|
}
|
|
1920
1920
|
function wordOverflows(u, d, x1, x2) {
|
|
1921
|
-
const U =
|
|
1922
|
-
if (!_optionalChain([U, 'optionalAccess', _172 => _172.length]) ||
|
|
1921
|
+
const U = _chunkH2VOH7X3cjs.CELL_LINES.get(u);
|
|
1922
|
+
if (!_optionalChain([U, 'optionalAccess', _172 => _172.length]) || _chunkH2VOH7X3cjs.startsNewItem.call(void 0, u.text, d.text)) return false;
|
|
1923
1923
|
const last = U[U.length - 1], units = firstWordUnits(d.text);
|
|
1924
1924
|
return units > 0 && last.r - last.l + units * (last.h || 10) > x2 - x1;
|
|
1925
1925
|
}
|
|
@@ -1988,7 +1988,7 @@ function mergeSplitRow(table, owner, first, colXs, textOnly = false, cut = NO_CU
|
|
|
1988
1988
|
if (!carriedSplit && !band) {
|
|
1989
1989
|
const norm = (c) => flowText(c.text).replace(/\s+/g, "");
|
|
1990
1990
|
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;
|
|
1991
|
-
const oneLine = (c) => _optionalChain([
|
|
1991
|
+
const oneLine = (c) => _optionalChain([_chunkH2VOH7X3cjs.CELL_LINES, 'access', _174 => _174.get, 'call', _175 => _175(c), 'optionalAccess', _176 => _176.length]) === 1;
|
|
1992
1992
|
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;
|
|
1993
1993
|
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;
|
|
1994
1994
|
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));
|
|
@@ -2081,19 +2081,19 @@ function mergeCrossPageTables(blocks, pageHeights, lex) {
|
|
|
2081
2081
|
placeJoined(blocks, i, j, joined);
|
|
2082
2082
|
continue;
|
|
2083
2083
|
}
|
|
2084
|
-
if (
|
|
2084
|
+
if (_chunkH2VOH7X3cjs.EMPTY_PARTS.has(curr.table)) {
|
|
2085
2085
|
blocks.splice(j, 1);
|
|
2086
2086
|
i++;
|
|
2087
2087
|
continue;
|
|
2088
2088
|
}
|
|
2089
2089
|
if (joined === null) continue;
|
|
2090
|
-
if (prev.table.cols !== curr.table.cols || prev.table.renderAsTable !== curr.table.renderAsTable ||
|
|
2090
|
+
if (prev.table.cols !== curr.table.cols || prev.table.renderAsTable !== curr.table.renderAsTable || _chunkH2VOH7X3cjs.EMPTY_PARTS.has(prev.table)) continue;
|
|
2091
2091
|
const width = Math.max(prev.bbox.width, curr.bbox.width, 1);
|
|
2092
2092
|
const leftDiff = Math.abs(prev.bbox.x - curr.bbox.x);
|
|
2093
2093
|
const rightDiff = Math.abs(prev.bbox.x + prev.bbox.width - (curr.bbox.x + curr.bbox.width));
|
|
2094
2094
|
if (leftDiff > width * NEIGHBOR_TABLE_EPSILON || rightDiff > width * NEIGHBOR_TABLE_EPSILON) continue;
|
|
2095
|
-
const px =
|
|
2096
|
-
if (px && cx && !shiftedSame(px, cx, !
|
|
2095
|
+
const px = _chunkH2VOH7X3cjs.TABLE_COLXS.get(prev.table), cx = _chunkH2VOH7X3cjs.TABLE_COLXS.get(curr.table);
|
|
2096
|
+
if (px && cx && !shiftedSame(px, cx, !_chunkH2VOH7X3cjs.CLIP_TABLES.has(prev.table) && !_chunkH2VOH7X3cjs.CLIP_TABLES.has(curr.table))) continue;
|
|
2097
2097
|
if (!px !== !cx) continue;
|
|
2098
2098
|
if (!rowTextsEqual(prev.table.cells[0], curr.table.cells[0]) && sameHeadShape(prev.table.cells[0], curr.table.cells[0])) continue;
|
|
2099
2099
|
let currCells = curr.table.cells;
|
|
@@ -2105,16 +2105,16 @@ function mergeCrossPageTables(blocks, pageHeights, lex) {
|
|
|
2105
2105
|
blocks.splice(j, 1);
|
|
2106
2106
|
continue;
|
|
2107
2107
|
}
|
|
2108
|
-
if (px && cx && !
|
|
2108
|
+
if (px && cx && !_chunkH2VOH7X3cjs.CLIP_TABLES.has(prev.table) && !_chunkH2VOH7X3cjs.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 && _chunkH2VOH7X3cjs.CELL_LINES.has(c))) {
|
|
2109
2109
|
const dx = px[0] - cx[0];
|
|
2110
2110
|
const part = joinSplitParts(prev.table, px, curr.table, cx.map((x) => x + dx), dx, void 0, lex);
|
|
2111
2111
|
if (_optionalChain([part, 'optionalAccess', _197 => _197.split]) && part.table.rows === prev.table.rows + currCells.length - 1) {
|
|
2112
2112
|
const last = prev.table.rows - 1;
|
|
2113
2113
|
for (let c = 0; c < part.table.cols; c++) {
|
|
2114
|
-
const U =
|
|
2115
|
-
|
|
2114
|
+
const U = _chunkH2VOH7X3cjs.CELL_LINES.get(prev.table.cells[last][c]), D = _chunkH2VOH7X3cjs.CELL_LINES.get(currCells[0][c]);
|
|
2115
|
+
_chunkH2VOH7X3cjs.CELL_LINES.set(part.table.cells[last][c], U.concat(D.map((l) => ({ ...l, l: l.l + dx, r: l.r + dx }))));
|
|
2116
2116
|
}
|
|
2117
|
-
|
|
2117
|
+
_chunkH2VOH7X3cjs.TABLE_COLXS.set(part.table, part.colXs);
|
|
2118
2118
|
placeJoined(blocks, i, j, part.table);
|
|
2119
2119
|
continue;
|
|
2120
2120
|
}
|
|
@@ -2127,20 +2127,20 @@ function mergeCrossPageTables(blocks, pageHeights, lex) {
|
|
|
2127
2127
|
caption: prev.table.caption,
|
|
2128
2128
|
...prev.table.renderAsTable ? { renderAsTable: true } : {}
|
|
2129
2129
|
};
|
|
2130
|
-
if (_nullishCoalesce(px, () => ( cx)))
|
|
2131
|
-
if (
|
|
2130
|
+
if (_nullishCoalesce(px, () => ( cx))) _chunkH2VOH7X3cjs.TABLE_COLXS.set(merged, _nullishCoalesce(px, () => ( cx)));
|
|
2131
|
+
if (_chunkH2VOH7X3cjs.CLIP_TABLES.has(prev.table) || _chunkH2VOH7X3cjs.CLIP_TABLES.has(curr.table)) _chunkH2VOH7X3cjs.CLIP_TABLES.add(merged);
|
|
2132
2132
|
placeJoined(blocks, i, j, merged);
|
|
2133
2133
|
}
|
|
2134
2134
|
for (let i = blocks.length - 1; i >= 0; i--) {
|
|
2135
2135
|
const t = blocks[i].table;
|
|
2136
|
-
if (blocks[i].type === "table" && t &&
|
|
2136
|
+
if (blocks[i].type === "table" && t && _chunkH2VOH7X3cjs.EMPTY_PARTS.has(t)) blocks.splice(i, 1);
|
|
2137
2137
|
}
|
|
2138
2138
|
}
|
|
2139
2139
|
function mergeColumnFlow(blocks, pageHeights, lex) {
|
|
2140
2140
|
if (!pageHeights) return;
|
|
2141
2141
|
for (let i = 0; i < blocks.length; i++) {
|
|
2142
2142
|
const L = blocks[i];
|
|
2143
|
-
if (L.type !== "table" || !L.table || !L.bbox || !L.pageNumber || !
|
|
2143
|
+
if (L.type !== "table" || !L.table || !L.bbox || !L.pageNumber || !_chunkH2VOH7X3cjs.CLIP_TABLES.has(L.table) || _chunkH2VOH7X3cjs.EMPTY_PARTS.has(L.table)) continue;
|
|
2144
2144
|
const ph = pageHeights.get(L.pageNumber);
|
|
2145
2145
|
if (!ph || L.bbox.y > ph * PAGE_EDGE_BAND) continue;
|
|
2146
2146
|
let s0 = i, s1 = i;
|
|
@@ -2159,8 +2159,8 @@ function mergeColumnFlow(blocks, pageHeights, lex) {
|
|
|
2159
2159
|
if (Math.abs(R.bbox.width - L.bbox.width) > Math.max(R.bbox.width, L.bbox.width) * NEIGHBOR_TABLE_EPSILON) continue;
|
|
2160
2160
|
if (!looksContinued(L, R) || restartsTable(blocks, i, R.table, pageHeights)) continue;
|
|
2161
2161
|
const rt = R.table;
|
|
2162
|
-
if (rt.rows === 1 && rt.cols === 1 && !
|
|
2163
|
-
const px =
|
|
2162
|
+
if (rt.rows === 1 && rt.cols === 1 && !_chunkH2VOH7X3cjs.CLIP_TABLES.has(rt) && L.table.rows >= 2) {
|
|
2163
|
+
const px = _chunkH2VOH7X3cjs.TABLE_COLXS.get(L.table), lb = L.bbox;
|
|
2164
2164
|
const dx = lb.x + lb.width - (R.bbox.x + R.bbox.width);
|
|
2165
2165
|
const last = L.table.cells[L.table.rows - 1];
|
|
2166
2166
|
let col = 0;
|
|
@@ -2189,8 +2189,8 @@ function mergeColumnFlow(blocks, pageHeights, lex) {
|
|
|
2189
2189
|
}
|
|
2190
2190
|
function joinClipParts(prev, curr, pageHeights, lex) {
|
|
2191
2191
|
const pt = prev.table, ct = curr.table;
|
|
2192
|
-
if (!
|
|
2193
|
-
const px =
|
|
2192
|
+
if (!_chunkH2VOH7X3cjs.CLIP_TABLES.has(pt) || !_chunkH2VOH7X3cjs.CLIP_TABLES.has(ct)) return null;
|
|
2193
|
+
const px = _chunkH2VOH7X3cjs.TABLE_COLXS.get(pt), cx = _chunkH2VOH7X3cjs.TABLE_COLXS.get(ct);
|
|
2194
2194
|
if (!px || !cx) return null;
|
|
2195
2195
|
let xs = cx, shifted = false, dx = 0, foreign = false, within = false;
|
|
2196
2196
|
if (!shiftedSame(px, cx, false)) {
|
|
@@ -2206,15 +2206,15 @@ function joinClipParts(prev, curr, pageHeights, lex) {
|
|
|
2206
2206
|
const inner = b.slice(1, -1).map((x) => x + dx);
|
|
2207
2207
|
return inner.length > 0 && !inner.some((x) => px.some((p) => Math.abs(p - x) <= CONTINUATION_COL_TOL));
|
|
2208
2208
|
};
|
|
2209
|
-
foreign = unrelated(cx) && unrelated(_nullishCoalesce(
|
|
2209
|
+
foreign = unrelated(cx) && unrelated(_nullishCoalesce(_chunkH2VOH7X3cjs.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);
|
|
2210
2210
|
}
|
|
2211
2211
|
const res = joinSplitParts(pt, px, ct, xs, dx, _optionalChain([prev, 'access', _202 => _202.bbox, 'optionalAccess', _203 => _203.y]), lex);
|
|
2212
2212
|
if (!res || (shifted || foreign || within) && !res.split && !res.header) return null;
|
|
2213
|
-
|
|
2214
|
-
const ys =
|
|
2215
|
-
if (ys)
|
|
2216
|
-
|
|
2217
|
-
|
|
2213
|
+
_chunkH2VOH7X3cjs.TABLE_COLXS.set(res.table, res.colXs);
|
|
2214
|
+
const ys = _chunkH2VOH7X3cjs.TABLE_ROWYS.get(pt);
|
|
2215
|
+
if (ys) _chunkH2VOH7X3cjs.TABLE_ROWYS.set(res.table, ys);
|
|
2216
|
+
_chunkH2VOH7X3cjs.PART_COLXS.set(res.table, _nullishCoalesce(_chunkH2VOH7X3cjs.PART_COLXS.get(pt), () => ( px)));
|
|
2217
|
+
_chunkH2VOH7X3cjs.CLIP_TABLES.add(res.table);
|
|
2218
2218
|
return res.table;
|
|
2219
2219
|
}
|
|
2220
2220
|
function prevLacksLeftCols(prev, px, xs, pageHeights) {
|
|
@@ -2238,12 +2238,12 @@ function looksContinued(prev, curr, pageHeights) {
|
|
|
2238
2238
|
return filled.length >= 2 && filled.every((t) => t === filled[0]);
|
|
2239
2239
|
}
|
|
2240
2240
|
function pushedLead(prev, curr) {
|
|
2241
|
-
if (!
|
|
2241
|
+
if (!_chunkH2VOH7X3cjs.CLIP_TABLES.has(prev.table) || !_chunkH2VOH7X3cjs.CLIP_TABLES.has(curr.table)) return false;
|
|
2242
2242
|
const lead = leadRows(curr.table);
|
|
2243
2243
|
return lead.image && lead.height > prev.bbox.y;
|
|
2244
2244
|
}
|
|
2245
2245
|
function leadRows(t) {
|
|
2246
|
-
const ys =
|
|
2246
|
+
const ys = _chunkH2VOH7X3cjs.TABLE_ROWYS.get(t);
|
|
2247
2247
|
if (!ys || ys.length < 2) return { height: 0, image: false };
|
|
2248
2248
|
const anchors = anchorsOf(t);
|
|
2249
2249
|
let end = 1, image = false;
|
|
@@ -2251,17 +2251,17 @@ function leadRows(t) {
|
|
|
2251
2251
|
for (const a of anchors) {
|
|
2252
2252
|
if (a.r !== r) continue;
|
|
2253
2253
|
end = Math.max(end, r + a.rs);
|
|
2254
|
-
if (
|
|
2254
|
+
if (_chunkH2VOH7X3cjs.IMAGE_CELLS.has(a.cell)) image = true;
|
|
2255
2255
|
}
|
|
2256
2256
|
}
|
|
2257
2257
|
return { height: ys[0] - ys[Math.min(end, ys.length - 1)], image };
|
|
2258
2258
|
}
|
|
2259
2259
|
function tailOf(b) {
|
|
2260
|
-
const t = b.table &&
|
|
2260
|
+
const t = b.table && _chunkH2VOH7X3cjs.TABLE_TAIL.get(b.table);
|
|
2261
2261
|
return t && b.bbox ? { ...b, pageNumber: t.page, bbox: { ...b.bbox, page: t.page, y: t.y, height: t.height } } : b;
|
|
2262
2262
|
}
|
|
2263
2263
|
function firstRowSig(t) {
|
|
2264
|
-
const x =
|
|
2264
|
+
const x = _chunkH2VOH7X3cjs.TABLE_COLXS.get(t);
|
|
2265
2265
|
if (!x || x.length !== t.cols + 1) return null;
|
|
2266
2266
|
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, "") }));
|
|
2267
2267
|
}
|
|
@@ -2314,7 +2314,7 @@ function chainHead(blocks, i, pageHeights) {
|
|
|
2314
2314
|
if (pb.pageNumber !== (_nullishCoalesce(cur.pageNumber, () => ( 0))) - 1) break;
|
|
2315
2315
|
if (!blocks.slice(p + 1, k).every((b) => besideOwn(b, pb, cur) || insideTable(b, pb) || pageNumberBetween(b, pb, cur, pageHeights))) break;
|
|
2316
2316
|
if (!looksContinued(pb, cur, pageHeights)) break;
|
|
2317
|
-
const px =
|
|
2317
|
+
const px = _chunkH2VOH7X3cjs.TABLE_COLXS.get(pb.table), cx = _chunkH2VOH7X3cjs.TABLE_COLXS.get(cur.table);
|
|
2318
2318
|
if (!px || !cx) break;
|
|
2319
2319
|
const dx = px[px.length - 1] - cx[cx.length - 1];
|
|
2320
2320
|
if (!shiftedSame(px, cx) && !px.some((x) => Math.abs(x - (cx[0] + dx)) <= CONTINUATION_COL_TOL) && !prevLacksLeftCols(pb, px, cx, pageHeights)) break;
|
|
@@ -2385,7 +2385,7 @@ var RESTART_LOOKBACK_PAGES = 5;
|
|
|
2385
2385
|
var COL_MATCH_TOL = 0.5;
|
|
2386
2386
|
var CONTINUED_TABLE_PAGE_BAND = 0.16;
|
|
2387
2387
|
function lastRowCell(t, x1, x2) {
|
|
2388
|
-
const xs =
|
|
2388
|
+
const xs = _chunkH2VOH7X3cjs.TABLE_COLXS.get(t);
|
|
2389
2389
|
const covered = /* @__PURE__ */ new Set();
|
|
2390
2390
|
for (let r = 0; r < t.rows; r++) {
|
|
2391
2391
|
for (let c = 0; c < t.cols; c++) {
|
|
@@ -2403,7 +2403,7 @@ var cellBlocks = (cell, pageNumber) => _nullishCoalesce(cell.blocks, () => ( cel
|
|
|
2403
2403
|
function mergeContinuedCells(blocks, pageHeights) {
|
|
2404
2404
|
for (let j = blocks.length - 1; j > 0; j--) {
|
|
2405
2405
|
const part = blocks[j];
|
|
2406
|
-
const from = part.table ?
|
|
2406
|
+
const from = part.table ? _chunkH2VOH7X3cjs.CONT_PARTS.get(part.table) : void 0;
|
|
2407
2407
|
if (!from || !part.table) {
|
|
2408
2408
|
unwrapContinuedTable(blocks, j, pageHeights, true);
|
|
2409
2409
|
continue;
|
|
@@ -2419,12 +2419,12 @@ function mergeContinuedCells(blocks, pageHeights) {
|
|
|
2419
2419
|
if (cell.blocks || add.blocks) cell.blocks = [...cellBlocks(cell, prev.pageNumber), ...cellBlocks(add, part.pageNumber)];
|
|
2420
2420
|
else if (part.pageNumber) markContinuedText(cell, add, part.pageNumber);
|
|
2421
2421
|
cell.text = [cell.text, add.text].filter((s) => s.trim()).join("\n");
|
|
2422
|
-
if (
|
|
2423
|
-
|
|
2424
|
-
const lines =
|
|
2425
|
-
if (_optionalChain([lines, 'optionalAccess', _227 => _227.length]))
|
|
2426
|
-
if (part.pageNumber && part.bbox)
|
|
2427
|
-
if (cell.text.trim() || _optionalChain([cell, 'access', _228 => _228.blocks, 'optionalAccess', _229 => _229.length]) ||
|
|
2422
|
+
if (_chunkH2VOH7X3cjs.IMAGE_CELLS.has(add)) _chunkH2VOH7X3cjs.IMAGE_CELLS.add(cell);
|
|
2423
|
+
_chunkH2VOH7X3cjs.joinCellEdges.call(void 0, cell, add);
|
|
2424
|
+
const lines = _chunkH2VOH7X3cjs.CELL_LINES.get(add);
|
|
2425
|
+
if (_optionalChain([lines, 'optionalAccess', _227 => _227.length])) _chunkH2VOH7X3cjs.CELL_LINES.set(cell, [..._nullishCoalesce(_chunkH2VOH7X3cjs.CELL_LINES.get(cell), () => ( [])), ...lines]);
|
|
2426
|
+
if (part.pageNumber && part.bbox) _chunkH2VOH7X3cjs.TABLE_TAIL.set(prev.table, _nullishCoalesce(_chunkH2VOH7X3cjs.TABLE_TAIL.get(part.table), () => ( { page: part.pageNumber, y: part.bbox.y, height: part.bbox.height })));
|
|
2427
|
+
if (cell.text.trim() || _optionalChain([cell, 'access', _228 => _228.blocks, 'optionalAccess', _229 => _229.length]) || _chunkH2VOH7X3cjs.IMAGE_CELLS.has(cell)) _chunkH2VOH7X3cjs.EMPTY_PARTS.delete(prev.table);
|
|
2428
2428
|
blocks.splice(j, 1);
|
|
2429
2429
|
if (cell.blocks && at > 0) {
|
|
2430
2430
|
const nextAt = cell.blocks[at];
|
|
@@ -2436,11 +2436,11 @@ function mergeContinuedCells(blocks, pageHeights) {
|
|
|
2436
2436
|
}
|
|
2437
2437
|
function unwrapContinuedTable(blocks, at, pageHeights, splitOnly = false) {
|
|
2438
2438
|
const prev = blocks[at - 1], frame = blocks[at];
|
|
2439
|
-
if (!_optionalChain([prev, 'optionalAccess', _230 => _230.table]) || !_optionalChain([frame, 'optionalAccess', _231 => _231.table]) || frame.table.rows !== 1 || frame.table.cols !== 1 || !
|
|
2439
|
+
if (!_optionalChain([prev, 'optionalAccess', _230 => _230.table]) || !_optionalChain([frame, 'optionalAccess', _231 => _231.table]) || frame.table.rows !== 1 || frame.table.cols !== 1 || !_chunkH2VOH7X3cjs.CLIP_TABLES.has(frame.table)) return;
|
|
2440
2440
|
const inner = _optionalChain([frame, 'access', _232 => _232.table, 'access', _233 => _233.cells, 'access', _234 => _234[0], 'optionalAccess', _235 => _235[0], 'optionalAccess', _236 => _236.blocks]);
|
|
2441
2441
|
const next = _optionalChain([inner, 'optionalAccess', _237 => _237[0]]);
|
|
2442
|
-
if (!inner || !_optionalChain([next, 'optionalAccess', _238 => _238.table]) || !prev.bbox || !next.bbox || !prev.pageNumber || next.pageNumber !== prev.pageNumber + 1 || !
|
|
2443
|
-
const px =
|
|
2442
|
+
if (!inner || !_optionalChain([next, 'optionalAccess', _238 => _238.table]) || !prev.bbox || !next.bbox || !prev.pageNumber || next.pageNumber !== prev.pageNumber + 1 || !_chunkH2VOH7X3cjs.CLIP_TABLES.has(prev.table) || !_chunkH2VOH7X3cjs.CLIP_TABLES.has(next.table) || prev.table.cols !== next.table.cols) return;
|
|
2443
|
+
const px = _chunkH2VOH7X3cjs.TABLE_COLXS.get(prev.table), nx = _chunkH2VOH7X3cjs.TABLE_COLXS.get(next.table);
|
|
2444
2444
|
if (!px || !nx || px.length !== nx.length || px.some((x, i) => Math.abs(x - nx[i]) > COL_MATCH_TOL)) return;
|
|
2445
2445
|
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)]);
|
|
2446
2446
|
if (!ph || !nh || prev.bbox.y > ph * CONTINUED_TABLE_PAGE_BAND || next.bbox.y + next.bbox.height < nh * (1 - CONTINUED_TABLE_PAGE_BAND)) return;
|
|
@@ -2450,15 +2450,15 @@ function unwrapContinuedTable(blocks, at, pageHeights, splitOnly = false) {
|
|
|
2450
2450
|
function fillNestedContinuation(blocks, at) {
|
|
2451
2451
|
const prev = blocks[at - 1], next = blocks[at];
|
|
2452
2452
|
const t = _optionalChain([prev, 'optionalAccess', _245 => _245.table]), u = _optionalChain([next, 'optionalAccess', _246 => _246.table]);
|
|
2453
|
-
if (!t || !u || u.rows !== 1 || u.cols !== 1 || !
|
|
2454
|
-
const xs =
|
|
2453
|
+
if (!t || !u || u.rows !== 1 || u.cols !== 1 || !_chunkH2VOH7X3cjs.CLIP_TABLES.has(t) || !_chunkH2VOH7X3cjs.CLIP_TABLES.has(u) || next.pageNumber !== (_nullishCoalesce(prev.pageNumber, () => ( 0))) + 1) return;
|
|
2454
|
+
const xs = _chunkH2VOH7X3cjs.TABLE_COLXS.get(u);
|
|
2455
2455
|
const cell = xs ? lastRowCell(t, xs[0], xs[xs.length - 1]) : void 0;
|
|
2456
2456
|
const add = _optionalChain([u, 'access', _247 => _247.cells, 'access', _248 => _248[0], 'optionalAccess', _249 => _249[0]]);
|
|
2457
|
-
if (!cell || !add || cell.text.trim() || _optionalChain([cell, 'access', _250 => _250.blocks, 'optionalAccess', _251 => _251.length]) ||
|
|
2457
|
+
if (!cell || !add || cell.text.trim() || _optionalChain([cell, 'access', _250 => _250.blocks, 'optionalAccess', _251 => _251.length]) || _chunkH2VOH7X3cjs.IMAGE_CELLS.has(cell)) return;
|
|
2458
2458
|
cell.text = add.text;
|
|
2459
2459
|
if (add.blocks) cell.blocks = add.blocks;
|
|
2460
|
-
if (
|
|
2461
|
-
|
|
2460
|
+
if (_chunkH2VOH7X3cjs.IMAGE_CELLS.has(add)) _chunkH2VOH7X3cjs.IMAGE_CELLS.add(cell);
|
|
2461
|
+
_chunkH2VOH7X3cjs.joinCellEdges.call(void 0, cell, add);
|
|
2462
2462
|
blocks.splice(at, 1);
|
|
2463
2463
|
}
|
|
2464
2464
|
|
|
@@ -3058,12 +3058,12 @@ function restoreUnmappedGlyphs(items, fnArray, argsArray, fontObj) {
|
|
|
3058
3058
|
}
|
|
3059
3059
|
}
|
|
3060
3060
|
for (const q of queues.values()) for (let k = 0; k < q.length; k++) {
|
|
3061
|
-
const pair = k + 1 < q.length ?
|
|
3061
|
+
const pair = k + 1 < q.length ? _chunkOW2XKTQAcjs.pairedNumber.call(void 0, q[k], q[k + 1]) : void 0;
|
|
3062
3062
|
if (pair !== void 0) {
|
|
3063
3063
|
q[k] = pair;
|
|
3064
3064
|
q[k + 1] = "";
|
|
3065
3065
|
k++;
|
|
3066
|
-
} else q[k] =
|
|
3066
|
+
} else q[k] = _chunkOW2XKTQAcjs.mapPuaText.call(void 0, q[k]);
|
|
3067
3067
|
}
|
|
3068
3068
|
const byFont = /* @__PURE__ */ new Map();
|
|
3069
3069
|
for (const it of items) {
|
|
@@ -3153,15 +3153,15 @@ function selectionContextPages(selected, pageCount) {
|
|
|
3153
3153
|
function marginContextBlocks(raw, page, view) {
|
|
3154
3154
|
const [x1, y1, x2, y2] = view;
|
|
3155
3155
|
const width = x2 - x1, height = y2 - y1;
|
|
3156
|
-
const items =
|
|
3156
|
+
const items = _chunkH2VOH7X3cjs.filterHiddenText.call(void 0, _chunkH2VOH7X3cjs.normalizeItems.call(void 0, raw), width, height, x1, y1).visible;
|
|
3157
3157
|
for (const item of items) {
|
|
3158
3158
|
item.x -= x1;
|
|
3159
3159
|
item.y -= y1;
|
|
3160
3160
|
}
|
|
3161
|
-
return
|
|
3162
|
-
const bbox =
|
|
3161
|
+
return _chunkH2VOH7X3cjs.groupByY.call(void 0, items).flatMap((line) => {
|
|
3162
|
+
const bbox = _chunkH2VOH7X3cjs.computeBBox.call(void 0, line, page);
|
|
3163
3163
|
if (bbox.y + bbox.height < height * 0.88 && bbox.y > height * 0.12) return [];
|
|
3164
|
-
return [{ type: "paragraph", text:
|
|
3164
|
+
return [{ type: "paragraph", text: _chunkH2VOH7X3cjs.mergeLineSimple.call(void 0, line), pageNumber: page, bbox, style: _chunkH2VOH7X3cjs.dominantStyle.call(void 0, line) }];
|
|
3165
3165
|
});
|
|
3166
3166
|
}
|
|
3167
3167
|
|
|
@@ -3197,7 +3197,7 @@ var WINANSI_REVERSE = {
|
|
|
3197
3197
|
};
|
|
3198
3198
|
function symbolFontTable(fontName) {
|
|
3199
3199
|
if (!fontName) return void 0;
|
|
3200
|
-
if (/wingdings(?![\s-]*[23])/i.test(fontName)) return
|
|
3200
|
+
if (/wingdings(?![\s-]*[23])/i.test(fontName)) return _chunkOW2XKTQAcjs.WINGDINGS;
|
|
3201
3201
|
return void 0;
|
|
3202
3202
|
}
|
|
3203
3203
|
function remapSymbolText(text, table) {
|
|
@@ -3430,7 +3430,7 @@ function wrapEquationRuns(items, faceName) {
|
|
|
3430
3430
|
for (const i of members) drop.add(i);
|
|
3431
3431
|
const toks = cur.map((it) => {
|
|
3432
3432
|
const bar2 = isBarItem(it);
|
|
3433
|
-
const text = bar2 ? "" : plain2.has(items.indexOf(it)) ?
|
|
3433
|
+
const text = bar2 ? "" : plain2.has(items.indexOf(it)) ? _chunkOW2XKTQAcjs.toTex.call(void 0, it.text) : FUNC_RE.test(it.text.trim()) ? it.text.trim() : [...it.text].map(decodeEq).join("");
|
|
3434
3434
|
return { text, x: it.x, y: it.y, w: it.w, size: sizeOf(it), bar: bar2 };
|
|
3435
3435
|
});
|
|
3436
3436
|
const tex = layout(toks).replace(/\}\\text\{/g, "");
|
|
@@ -4270,7 +4270,7 @@ function mergeEnclosedDigits(items) {
|
|
|
4270
4270
|
if (!/^\d\d?$/.test(digits)) continue;
|
|
4271
4271
|
const mid = (inside2[0].x + inside2[inside2.length - 1].x + inside2[inside2.length - 1].w) / 2;
|
|
4272
4272
|
if (Math.abs(mid - (s.x + s.w / 2)) > s.fontSize * 0.15) continue;
|
|
4273
|
-
s.text =
|
|
4273
|
+
s.text = _chunkOW2XKTQAcjs.enclosedNumber.call(void 0, Number(digits));
|
|
4274
4274
|
for (const d of inside2) drop.add(d);
|
|
4275
4275
|
}
|
|
4276
4276
|
if (!drop.size) return;
|
|
@@ -4467,7 +4467,7 @@ function demoteNonHeadingRoles(blocks, pageHeights, faceNames) {
|
|
|
4467
4467
|
if (block.type !== "heading" || !block.text) continue;
|
|
4468
4468
|
const text = block.text.replace(/<[^>]+>/g, "").trim();
|
|
4469
4469
|
const fsz = _nullishCoalesce(_optionalChain([block, 'access', _333 => _333.style, 'optionalAccess', _334 => _334.fontSize]), () => ( 0));
|
|
4470
|
-
const tocEntry = i > 0 &&
|
|
4470
|
+
const tocEntry = i > 0 && _chunkH2VOH7X3cjs.TOC_BLOCKS.has(blocks[i - 1]) && _chunkH2VOH7X3cjs.TOC_BLOCKS.has(blocks[i + 1]);
|
|
4471
4471
|
const page = _nullishCoalesce(byPage.get(_nullishCoalesce(block.pageNumber, () => ( 0))), () => ( []));
|
|
4472
4472
|
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;
|
|
4473
4473
|
const next = blocks[i + 1];
|
|
@@ -4565,7 +4565,7 @@ function splitSingleCellTables(blocks) {
|
|
|
4565
4565
|
const out = [];
|
|
4566
4566
|
for (const b of blocks) {
|
|
4567
4567
|
const t = b.type === "table" ? b.table : void 0;
|
|
4568
|
-
const title = t &&
|
|
4568
|
+
const title = t && _chunkH2VOH7X3cjs.FRAME_TITLE_BLOCKS.get(t);
|
|
4569
4569
|
if (title) {
|
|
4570
4570
|
out.push({ ...title, text: `${t.cells[0][0].text.trim()} ${t.cells[0][2].text.trim()}` });
|
|
4571
4571
|
continue;
|
|
@@ -4601,7 +4601,7 @@ function joinLatinCellWraps(blocks) {
|
|
|
4601
4601
|
const lines = cell.text.split("\n");
|
|
4602
4602
|
const out = [lines[0]];
|
|
4603
4603
|
for (const line of lines.slice(1)) {
|
|
4604
|
-
if (
|
|
4604
|
+
if (_chunkH2VOH7X3cjs.latinSoftWrap.call(void 0, out[out.length - 1], line)) out[out.length - 1] = out[out.length - 1].trimEnd() + " " + line.trim();
|
|
4605
4605
|
else out.push(line);
|
|
4606
4606
|
}
|
|
4607
4607
|
cell.text = out.join("\n");
|
|
@@ -4621,10 +4621,10 @@ function cleanPdfText(text, opts) {
|
|
|
4621
4621
|
).replace(/^(?!\| ---).*$/gm, (line) => {
|
|
4622
4622
|
if (/^\s*\${1,2}.+\${1,2}\s*$/.test(line)) return line;
|
|
4623
4623
|
if (line.startsWith("|")) {
|
|
4624
|
-
return line.replace(/(?:\\.|[^|\\])+/g, (cell) => cell.split("<br>").map((seg) => seg.replace(/\S(?:.*\S)?/, (t) =>
|
|
4624
|
+
return line.replace(/(?:\\.|[^|\\])+/g, (cell) => cell.split("<br>").map((seg) => seg.replace(/\S(?:.*\S)?/, (t) => _chunkH2VOH7X3cjs.collapseEvenSpacing.call(void 0, t, false))).join("<br>"));
|
|
4625
4625
|
}
|
|
4626
4626
|
const mark = _nullishCoalesce(_optionalChain([/^(?:#{1,6}|-) /, 'access', _416 => _416.exec, 'call', _417 => _417(line), 'optionalAccess', _418 => _418[0]]), () => ( ""));
|
|
4627
|
-
return mark +
|
|
4627
|
+
return mark + _chunkH2VOH7X3cjs.collapseEvenSpacing.call(void 0, line.slice(mark.length), false);
|
|
4628
4628
|
}).replace(/\\~\\~/g, "~~").replace(/~~~~/g, "").replace(/<u>\s*<\/u>/g, "").replace(/<(sup|sub)>\s*<\/\1>/g, "").replace(/\n{3,}/g, "\n\n").trim();
|
|
4629
4629
|
}
|
|
4630
4630
|
function startsWithMarker(line) {
|
|
@@ -4656,7 +4656,7 @@ function mergeKoreanLines(text) {
|
|
|
4656
4656
|
continue;
|
|
4657
4657
|
}
|
|
4658
4658
|
if (/[가-힣·,\-]$/.test(prev) && /^[가-힣(]/.test(curr) && !startsWithMarker(curr) && !isStandaloneHeader(prev) && !startsWithMarker(prev)) {
|
|
4659
|
-
result[result.length - 1] = prev +
|
|
4659
|
+
result[result.length - 1] = prev + _chunkH2VOH7X3cjs.wrapJoiner.call(void 0, prev, curr) + curr;
|
|
4660
4660
|
} else {
|
|
4661
4661
|
result.push(curr);
|
|
4662
4662
|
}
|
|
@@ -4672,7 +4672,7 @@ function applyLinkAnnotations(items, annots) {
|
|
|
4672
4672
|
const wrapped = /* @__PURE__ */ new Set();
|
|
4673
4673
|
for (const a of annots) {
|
|
4674
4674
|
if (a.subtype !== "Link" || !a.url || !a.rect || a.rect.length < 4) continue;
|
|
4675
|
-
const url =
|
|
4675
|
+
const url = _chunkLFTO5QAPcjs.sanitizeHref.call(void 0, a.url);
|
|
4676
4676
|
if (!url) continue;
|
|
4677
4677
|
const x1 = Math.min(a.rect[0], a.rect[2]), x2 = Math.max(a.rect[0], a.rect[2]);
|
|
4678
4678
|
const y1 = Math.min(a.rect[1], a.rect[3]), y2 = Math.max(a.rect[1], a.rect[3]);
|
|
@@ -4724,7 +4724,7 @@ function mergeLinkRuns(markdown) {
|
|
|
4724
4724
|
|
|
4725
4725
|
// src/pdf/formula-ocr.ts
|
|
4726
4726
|
async function applyFormulaOcr(buffer, blocks, pageFilter, effectivePageCount, warnings, _onProgress) {
|
|
4727
|
-
const formulaMod = await Promise.resolve().then(() => _interopRequireWildcard(require("./formula-
|
|
4727
|
+
const formulaMod = await Promise.resolve().then(() => _interopRequireWildcard(require("./formula-RTPZD2IM.cjs")));
|
|
4728
4728
|
const { FormulaPipeline, ensureFormulaModels } = formulaMod;
|
|
4729
4729
|
await ensureFormulaModels((p) => {
|
|
4730
4730
|
if (p.phase === "download" && p.total) {
|
|
@@ -4915,13 +4915,13 @@ async function loadPdfWithTimeout(buffer, data) {
|
|
|
4915
4915
|
try {
|
|
4916
4916
|
return await Promise.race([
|
|
4917
4917
|
loadingTask.promise.catch((e) => {
|
|
4918
|
-
if (e instanceof Error && e.name === "PasswordException") throw new (0,
|
|
4918
|
+
if (e instanceof Error && e.name === "PasswordException") throw new (0, _chunkLFTO5QAPcjs.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)");
|
|
4919
4919
|
throw e;
|
|
4920
4920
|
}),
|
|
4921
4921
|
new Promise((_, reject) => {
|
|
4922
4922
|
timer = setTimeout(() => {
|
|
4923
4923
|
loadingTask.destroy();
|
|
4924
|
-
reject(new (0,
|
|
4924
|
+
reject(new (0, _chunkLFTO5QAPcjs.KordocError)("PDF \uB85C\uB529 \uD0C0\uC784\uC544\uC6C3 (30\uCD08 \uCD08\uACFC)"));
|
|
4925
4925
|
}, PDF_LOAD_TIMEOUT_MS);
|
|
4926
4926
|
})
|
|
4927
4927
|
]);
|
|
@@ -4932,8 +4932,8 @@ async function loadPdfWithTimeout(buffer, data) {
|
|
|
4932
4932
|
async function parsePdfDocument(buffer, options) {
|
|
4933
4933
|
const formulaBuffer = _optionalChain([options, 'optionalAccess', _419 => _419.formulaOcr]) ? buffer : null;
|
|
4934
4934
|
const ocrOptionError = _chunkMMK32GPDcjs.validateOcrOptions.call(void 0, options);
|
|
4935
|
-
if (ocrOptionError) throw new (0,
|
|
4936
|
-
const autoOcr = _optionalChain([options, 'optionalAccess', _420 => _420.ocr]) === void 0 && await
|
|
4935
|
+
if (ocrOptionError) throw new (0, _chunkLFTO5QAPcjs.KordocError)(ocrOptionError);
|
|
4936
|
+
const autoOcr = _optionalChain([options, 'optionalAccess', _420 => _420.ocr]) === void 0 && await _chunkH2VOH7X3cjs.ocrModelsCached.call(void 0, _chunkH2VOH7X3cjs.resolveOcrModels.call(void 0, options)) && (_optionalChain([options, 'optionalAccess', _421 => _421.ocrRec]) !== "auto" || await _chunkH2VOH7X3cjs.ocrModelsCached.call(void 0, _chunkH2VOH7X3cjs.handwritingFallbackModels.call(void 0, _chunkH2VOH7X3cjs.resolveOcrModels.call(void 0, options))));
|
|
4937
4937
|
const ocrBuffer = _optionalChain([options, 'optionalAccess', _422 => _422.ocr]) || autoOcr ? buffer : null;
|
|
4938
4938
|
const pdfjsData = new Uint8Array(buffer.slice(0));
|
|
4939
4939
|
const blanked = blankLargeImageStreams(pdfjsData);
|
|
@@ -4945,7 +4945,7 @@ async function parsePdfDocument(buffer, options) {
|
|
|
4945
4945
|
let pristine;
|
|
4946
4946
|
try {
|
|
4947
4947
|
const pageCount = doc.numPages;
|
|
4948
|
-
if (pageCount === 0) throw new (0,
|
|
4948
|
+
if (pageCount === 0) throw new (0, _chunkLFTO5QAPcjs.KordocError)("PDF\uC5D0 \uD398\uC774\uC9C0\uAC00 \uC5C6\uC2B5\uB2C8\uB2E4.");
|
|
4949
4949
|
const metadata = { pageCount, pageMode: "layout" };
|
|
4950
4950
|
await extractPdfMetadata(doc, metadata);
|
|
4951
4951
|
const blocks = [];
|
|
@@ -4968,11 +4968,11 @@ async function parsePdfDocument(buffer, options) {
|
|
|
4968
4968
|
const uncoveredImageRegions = /* @__PURE__ */ new Map();
|
|
4969
4969
|
const largeImageRegions = /* @__PURE__ */ new Set();
|
|
4970
4970
|
const wantWebp = _optionalChain([options, 'optionalAccess', _427 => _427.imageFormat]) === "webp" && options.images !== false;
|
|
4971
|
-
const encodeWebp = wantWebp ? await
|
|
4972
|
-
if (wantWebp && !encodeWebp) warnings.push(
|
|
4971
|
+
const encodeWebp = wantWebp ? await _chunkBNP3WXTBcjs.loadWebpEncoder.call(void 0, ) : null;
|
|
4972
|
+
if (wantWebp && !encodeWebp) warnings.push(_chunkBNP3WXTBcjs.WEBP_UNAVAILABLE);
|
|
4973
4973
|
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);
|
|
4974
|
-
const readQr = _optionalChain([options, 'optionalAccess', _431 => _431.qrCodes]) ? await
|
|
4975
|
-
if (_optionalChain([options, 'optionalAccess', _432 => _432.qrCodes]) && !readQr) warnings.push(
|
|
4974
|
+
const readQr = _optionalChain([options, 'optionalAccess', _431 => _431.qrCodes]) ? await _chunkBNP3WXTBcjs.loadQrReader.call(void 0, ) : null;
|
|
4975
|
+
if (_optionalChain([options, 'optionalAccess', _432 => _432.qrCodes]) && !readQr) warnings.push(_chunkBNP3WXTBcjs.QR_UNAVAILABLE);
|
|
4976
4976
|
const imageBulletShapes = /* @__PURE__ */ new Map();
|
|
4977
4977
|
const imageArrowDirections = /* @__PURE__ */ new Map();
|
|
4978
4978
|
const extractedImages = [];
|
|
@@ -4980,7 +4980,7 @@ async function parsePdfDocument(buffer, options) {
|
|
|
4980
4980
|
const carry = {};
|
|
4981
4981
|
const preciseGaps = await isHancomPdf(doc);
|
|
4982
4982
|
const vectorPageOps = /* @__PURE__ */ new Map();
|
|
4983
|
-
const wrapLexicon = new (0,
|
|
4983
|
+
const wrapLexicon = new (0, _chunkH2VOH7X3cjs.WrapLexicon)();
|
|
4984
4984
|
const noteMarks = /* @__PURE__ */ new Map();
|
|
4985
4985
|
const headerContext = [];
|
|
4986
4986
|
if (pageFilter && _optionalChain([options, 'optionalAccess', _433 => _433.removeHeaderFooter]) !== false && pageFilter.size < effectivePageCount) {
|
|
@@ -5031,12 +5031,12 @@ async function parsePdfDocument(buffer, options) {
|
|
|
5031
5031
|
markSyntheticSpaces(rawItems, rawOps.fnArray, rawOps.argsArray);
|
|
5032
5032
|
restoreSoftHyphens();
|
|
5033
5033
|
rawItems.push(...spaceMappedDots(rawOps.fnArray, rawOps.argsArray, (n) => fontObj(n)));
|
|
5034
|
-
const items =
|
|
5034
|
+
const items = _chunkH2VOH7X3cjs.normalizeItems.call(void 0, occluded.size ? rawItems.filter((it) => !occluded.has(it)) : rawItems);
|
|
5035
5035
|
if (!preciseGaps) for (const it of items) {
|
|
5036
5036
|
delete it.fx;
|
|
5037
5037
|
delete it.fw;
|
|
5038
5038
|
}
|
|
5039
|
-
const filtered =
|
|
5039
|
+
const filtered = _chunkH2VOH7X3cjs.filterHiddenText.call(void 0, items, pageW, pageH, viewX1, viewY1);
|
|
5040
5040
|
const joined = joinVerticalColumns(filtered.visible);
|
|
5041
5041
|
const visible = dropTabLeaderDots(joined);
|
|
5042
5042
|
const hiddenCount = filtered.hiddenCount + occluded.size;
|
|
@@ -5063,7 +5063,7 @@ async function parsePdfDocument(buffer, options) {
|
|
|
5063
5063
|
} : rawOps;
|
|
5064
5064
|
remapSymbolFontItems(visible, (loadedName) => _optionalChain([fontObj, 'call', _440 => _440(loadedName), 'optionalAccess', _441 => _441.name]));
|
|
5065
5065
|
remapControlGlyphs(visible, differencesOf);
|
|
5066
|
-
await
|
|
5066
|
+
await _chunkH2VOH7X3cjs.restoreImageBullets.call(void 0, visible, page, opList.fnArray, opList.argsArray, imageBulletShapes);
|
|
5067
5067
|
const faces = /* @__PURE__ */ new Map();
|
|
5068
5068
|
for (const it of visible) {
|
|
5069
5069
|
if (!it.fontName) continue;
|
|
@@ -5076,12 +5076,12 @@ async function parsePdfDocument(buffer, options) {
|
|
|
5076
5076
|
it.fontName = face;
|
|
5077
5077
|
if (!faceNames.has(face)) faceNames.set(face, (_nullishCoalesce(_optionalChain([fontObj, 'call', _443 => _443(face), 'optionalAccess', _444 => _444.name]), () => ( ""))).replace(/^[A-Z]{6}\+/, ""));
|
|
5078
5078
|
}
|
|
5079
|
-
for (const it of visible) if (it.text.includes("$")) it.text =
|
|
5080
|
-
for (const it of visible) if (it.text.includes("<")) it.text =
|
|
5079
|
+
for (const it of visible) if (it.text.includes("$")) it.text = _chunkOW2XKTQAcjs.escapeLiteralDollar.call(void 0, it.text);
|
|
5080
|
+
for (const it of visible) if (it.text.includes("<")) it.text = _chunkOW2XKTQAcjs.escapeLiteralTags.call(void 0, it.text);
|
|
5081
5081
|
wrapEquationRuns(visible, (face) => faceNames.get(face));
|
|
5082
5082
|
const pageArea = pageW * pageH;
|
|
5083
5083
|
if (pageArea > 0) {
|
|
5084
|
-
const imageRegions =
|
|
5084
|
+
const imageRegions = _chunkH2VOH7X3cjs.extractImageRegions.call(void 0, opList.fnArray, opList.argsArray);
|
|
5085
5085
|
let uncovered = 0;
|
|
5086
5086
|
for (const r of imageRegions) {
|
|
5087
5087
|
const area = (r.x2 - r.x1) * (r.y2 - r.y1);
|
|
@@ -5108,11 +5108,11 @@ async function parsePdfDocument(buffer, options) {
|
|
|
5108
5108
|
if (uncovered > 0) skippedImagePages.set(i, uncovered);
|
|
5109
5109
|
}
|
|
5110
5110
|
const marks = superscriptNoteMarks(visible);
|
|
5111
|
-
if (marks.length) noteMarks.set(i, { marks, seps: footnoteSeparators(
|
|
5111
|
+
if (marks.length) noteMarks.set(i, { marks, seps: footnoteSeparators(_chunkH2VOH7X3cjs.extractLines.call(void 0, opList.fnArray, opList.argsArray).horizontals, pageW, pageH) });
|
|
5112
5112
|
const stamp = marginStamp(visible);
|
|
5113
5113
|
const flow = stamp.length ? visible.filter((it) => !stamp.includes(it)) : visible;
|
|
5114
|
-
const rightArrows = _optionalChain([options, 'optionalAccess', _445 => _445.tables]) !== false ? await
|
|
5115
|
-
const pageBlocks = orderTwoUpPage(
|
|
5114
|
+
const rightArrows = _optionalChain([options, 'optionalAccess', _445 => _445.tables]) !== false ? await _chunkH2VOH7X3cjs.detectRightArrowRegions.call(void 0, page, opList.fnArray, opList.argsArray, imageArrowDirections) : [];
|
|
5115
|
+
const pageBlocks = orderTwoUpPage(_chunkH2VOH7X3cjs.extractPageBlocksWithLines.call(void 0, flow, i, opList, pageW, pageH, void 0, _optionalChain([options, 'optionalAccess', _446 => _446.tables]) !== false, carry, wrapLexicon, rightArrows), pageW, pageH);
|
|
5116
5116
|
if (stamp.length) pageBlocks.unshift({ type: "paragraph", text: [...stamp].sort((a, b) => a.y - b.y).map((it) => it.text).join(" "), pageNumber: i });
|
|
5117
5117
|
for (const b of pageBlocks) blocks.push(b);
|
|
5118
5118
|
try {
|
|
@@ -5138,11 +5138,11 @@ async function parsePdfDocument(buffer, options) {
|
|
|
5138
5138
|
if (_optionalChain([options, 'optionalAccess', _448 => _448.ocr]) && quality.ocrReason === "vector_text" && page.rotate % 360 === 0 && page.view[0] === 0 && page.view[1] === 0) {
|
|
5139
5139
|
vectorPageOps.set(i, ocrVectorOps(opList, vector.paths));
|
|
5140
5140
|
}
|
|
5141
|
-
if (totalTextBytes > MAX_TOTAL_TEXT) throw new (0,
|
|
5141
|
+
if (totalTextBytes > MAX_TOTAL_TEXT) throw new (0, _chunkLFTO5QAPcjs.KordocError)("\uD14D\uC2A4\uD2B8 \uCD94\uCD9C \uD06C\uAE30 \uCD08\uACFC");
|
|
5142
5142
|
parsedPages++;
|
|
5143
5143
|
_optionalChain([options, 'optionalAccess', _449 => _449.onProgress, 'optionalCall', _450 => _450(parsedPages, totalTarget)]);
|
|
5144
5144
|
} catch (pageErr) {
|
|
5145
|
-
if (pageErr instanceof
|
|
5145
|
+
if (pageErr instanceof _chunkLFTO5QAPcjs.KordocError) throw pageErr;
|
|
5146
5146
|
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" });
|
|
5147
5147
|
} finally {
|
|
5148
5148
|
_optionalChain([loadedPage, 'optionalAccess', _451 => _451.cleanup, 'call', _452 => _452()]);
|
|
@@ -5173,12 +5173,12 @@ async function parsePdfDocument(buffer, options) {
|
|
|
5173
5173
|
}
|
|
5174
5174
|
if (targets.size > 0) {
|
|
5175
5175
|
try {
|
|
5176
|
-
const { runPdfOcr } = await Promise.resolve().then(() => _interopRequireWildcard(require("./pdf-ocr-
|
|
5176
|
+
const { runPdfOcr } = await Promise.resolve().then(() => _interopRequireWildcard(require("./pdf-ocr-H4DKZSOB.cjs")));
|
|
5177
5177
|
const mode = typeof _optionalChain([options, 'optionalAccess', _457 => _457.ocr]) === "function" ? options.ocr : "builtin";
|
|
5178
5178
|
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])));
|
|
5179
|
-
const { builtinOcrConfig } = await Promise.resolve().then(() => _interopRequireWildcard(require("./pdf-ocr-
|
|
5179
|
+
const { builtinOcrConfig } = await Promise.resolve().then(() => _interopRequireWildcard(require("./pdf-ocr-H4DKZSOB.cjs")));
|
|
5180
5180
|
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);
|
|
5181
|
-
for (const obs of ocrPageBlocks.values())
|
|
5181
|
+
for (const obs of ocrPageBlocks.values()) _chunkOW2XKTQAcjs.stripScriptTags.call(void 0, { blocks: obs });
|
|
5182
5182
|
if (ocrPageBlocks.size > 0) {
|
|
5183
5183
|
const replacePages = /* @__PURE__ */ new Set();
|
|
5184
5184
|
for (const [p, obs] of ocrPageBlocks) {
|
|
@@ -5189,7 +5189,7 @@ async function parsePdfDocument(buffer, options) {
|
|
|
5189
5189
|
continue;
|
|
5190
5190
|
}
|
|
5191
5191
|
const regions = ocrRegions.get(p);
|
|
5192
|
-
if (!regions ||
|
|
5192
|
+
if (!regions || _chunkH2VOH7X3cjs.mergeOcrImageRegions.call(void 0, blocks, p, regions, obs) === 0) continue;
|
|
5193
5193
|
ocrDone.add(p);
|
|
5194
5194
|
if (_optionalChain([pageImageBlocks, 'access', _468 => _468.get, 'call', _469 => _469(p), 'optionalAccess', _470 => _470.length]) === 1) pageImageBlocks.delete(p);
|
|
5195
5195
|
}
|
|
@@ -5242,17 +5242,17 @@ async function parsePdfDocument(buffer, options) {
|
|
|
5242
5242
|
}
|
|
5243
5243
|
}
|
|
5244
5244
|
if (_optionalChain([options, 'optionalAccess', _471 => _471.removeHeaderFooter]) !== false && (parsedPageCount >= 3 || headerContext.length)) {
|
|
5245
|
-
const removed =
|
|
5246
|
-
const running =
|
|
5245
|
+
const removed = _chunkH2VOH7X3cjs.removeHeaderFooterBlocks.call(void 0, blocks, pageHeights, warnings, noteMarks, false, headerContext);
|
|
5246
|
+
const running = _chunkH2VOH7X3cjs.runningLinePatterns.call(void 0, removed.map((ri) => blocks[ri]), pageHeights);
|
|
5247
5247
|
for (let ri = removed.length - 1; ri >= 0; ri--) {
|
|
5248
5248
|
blocks.splice(removed[ri], 1);
|
|
5249
5249
|
}
|
|
5250
|
-
const stripped =
|
|
5250
|
+
const stripped = _chunkH2VOH7X3cjs.stripAbsorbedRunningLines.call(void 0, blocks, pageHeights, running);
|
|
5251
5251
|
if (stripped !== blocks) {
|
|
5252
5252
|
blocks.length = 0;
|
|
5253
5253
|
blocks.push(...stripped);
|
|
5254
5254
|
}
|
|
5255
|
-
const kept =
|
|
5255
|
+
const kept = _chunkH2VOH7X3cjs.removeSideTabs.call(void 0, blocks, pageWidths);
|
|
5256
5256
|
if (kept !== blocks) {
|
|
5257
5257
|
blocks.length = 0;
|
|
5258
5258
|
blocks.push(...kept);
|
|
@@ -5261,12 +5261,12 @@ async function parsePdfDocument(buffer, options) {
|
|
|
5261
5261
|
mergeContinuedCells(blocks, pageHeights);
|
|
5262
5262
|
mergeCrossPageTables(blocks, pageHeights, wrapLexicon);
|
|
5263
5263
|
if (_optionalChain([options, 'optionalAccess', _472 => _472.removeHeaderFooter]) !== false && parsedPageCount >= 3) {
|
|
5264
|
-
const boxes =
|
|
5264
|
+
const boxes = _chunkH2VOH7X3cjs.removeHeaderFooterBlocks.call(void 0, blocks, pageHeights, warnings, noteMarks, true);
|
|
5265
5265
|
for (let ri = boxes.length - 1; ri >= 0; ri--) blocks.splice(boxes[ri], 1);
|
|
5266
5266
|
}
|
|
5267
5267
|
splitContactTables(blocks);
|
|
5268
|
-
if (!_optionalChain([options, 'optionalAccess', _473 => _473.keepTrailingEmptyCols]))
|
|
5269
|
-
|
|
5268
|
+
if (!_optionalChain([options, 'optionalAccess', _473 => _473.keepTrailingEmptyCols])) _chunkH2VOH7X3cjs.trimTrailingEmptyTableCols.call(void 0, blocks);
|
|
5269
|
+
_chunkH2VOH7X3cjs.joinPageBreakWraps.call(void 0, blocks, wrapLexicon);
|
|
5270
5270
|
await flushPdfImages(imageState, warnings, pageImageBlocks);
|
|
5271
5271
|
injectPageImageBlocks(blocks, pageImageBlocks);
|
|
5272
5272
|
if (_optionalChain([options, 'optionalAccess', _474 => _474.formulaOcr]) && formulaBuffer) {
|
|
@@ -5279,21 +5279,21 @@ async function parsePdfDocument(buffer, options) {
|
|
|
5279
5279
|
});
|
|
5280
5280
|
}
|
|
5281
5281
|
}
|
|
5282
|
-
const medianFontSize =
|
|
5282
|
+
const medianFontSize = _chunkH2VOH7X3cjs.computeMedianFontSizeFromFreq.call(void 0, fontSizeFreq);
|
|
5283
5283
|
if (medianFontSize > 0) {
|
|
5284
|
-
|
|
5285
|
-
}
|
|
5286
|
-
|
|
5287
|
-
|
|
5288
|
-
|
|
5289
|
-
|
|
5290
|
-
|
|
5291
|
-
|
|
5292
|
-
|
|
5293
|
-
|
|
5284
|
+
_chunkH2VOH7X3cjs.detectHeadings.call(void 0, blocks, medianFontSize);
|
|
5285
|
+
}
|
|
5286
|
+
_chunkH2VOH7X3cjs.detectDocumentStyleHeadings.call(void 0, blocks);
|
|
5287
|
+
_chunkH2VOH7X3cjs.detectTypographyHeadings.call(void 0, blocks);
|
|
5288
|
+
_chunkH2VOH7X3cjs.detectSiblingStyleHeadings.call(void 0, blocks);
|
|
5289
|
+
_chunkH2VOH7X3cjs.detectRepeatedPageLabels.call(void 0, blocks);
|
|
5290
|
+
_chunkH2VOH7X3cjs.detectPageLeadHeadings.call(void 0, blocks);
|
|
5291
|
+
_chunkH2VOH7X3cjs.mergeStackedHeadingLines.call(void 0, blocks, medianFontSize);
|
|
5292
|
+
_chunkH2VOH7X3cjs.refineDocumentStyleHeadings.call(void 0, blocks);
|
|
5293
|
+
_chunkH2VOH7X3cjs.detectMarkerHeadings.call(void 0, blocks);
|
|
5294
5294
|
demoteNonHeadingRoles(blocks, pageHeights, faceNames);
|
|
5295
|
-
|
|
5296
|
-
|
|
5295
|
+
_chunkH2VOH7X3cjs.detectTableCaptions.call(void 0, blocks);
|
|
5296
|
+
_chunkH2VOH7X3cjs.detectKoreanListBlocks.call(void 0, blocks);
|
|
5297
5297
|
sanitizeBlockControlChars(blocks);
|
|
5298
5298
|
if (_optionalChain([options, 'optionalAccess', _475 => _475.imagePlacement]) === "flow") moveImagesInFlow(blocks);
|
|
5299
5299
|
let outBlocks = splitSingleCellTables(blocks);
|
|
@@ -5315,19 +5315,19 @@ async function parsePdfDocument(buffer, options) {
|
|
|
5315
5315
|
const shown = /* @__PURE__ */ new Map();
|
|
5316
5316
|
const markContent = (bs) => {
|
|
5317
5317
|
for (const b of _nullishCoalesce(bs, () => ( []))) if (b.table) for (const row of b.table.cells) for (const c of row) {
|
|
5318
|
-
if (
|
|
5319
|
-
const lines =
|
|
5320
|
-
if (lines)
|
|
5318
|
+
if (_chunkH2VOH7X3cjs.IMAGE_CELLS.has(c)) _chunkOW2XKTQAcjs.CONTENT_CELLS.add(c);
|
|
5319
|
+
const lines = _chunkH2VOH7X3cjs.CELL_LINES.get(c);
|
|
5320
|
+
if (lines) _chunkOW2XKTQAcjs.CELL_BASELINES.set(c, lines.map((l) => l.y));
|
|
5321
5321
|
markContent(c.blocks);
|
|
5322
5322
|
}
|
|
5323
5323
|
};
|
|
5324
5324
|
const visual = (bs) => bs.flatMap((b) => {
|
|
5325
5325
|
if (b.type !== "table") return [b];
|
|
5326
|
-
if (!hancom && b.table &&
|
|
5326
|
+
if (!hancom && b.table && _chunkH2VOH7X3cjs.CLIP_TABLES.has(b.table)) return [b];
|
|
5327
5327
|
let v = shown.get(b);
|
|
5328
5328
|
if (!v) {
|
|
5329
5329
|
markContent([b]);
|
|
5330
|
-
shown.set(b, v =
|
|
5330
|
+
shown.set(b, v = _chunkOW2XKTQAcjs.unframeLayoutTables.call(void 0, [b], !!_optionalChain([options, 'optionalAccess', _479 => _479.keepTrailingEmptyCols])));
|
|
5331
5331
|
}
|
|
5332
5332
|
return v;
|
|
5333
5333
|
});
|
|
@@ -5336,13 +5336,13 @@ async function parsePdfDocument(buffer, options) {
|
|
|
5336
5336
|
blocks.length = 0;
|
|
5337
5337
|
for (const b of kept) blocks.push(b);
|
|
5338
5338
|
}
|
|
5339
|
-
const finishMarkdown = (bs) => mergeLinkRuns(cleanPdfText(
|
|
5340
|
-
if (_optionalChain([options, 'optionalAccess', _481 => _481.tableFormat]) === "gfm")
|
|
5339
|
+
const finishMarkdown = (bs) => mergeLinkRuns(cleanPdfText(_chunkOW2XKTQAcjs.blocksToMarkdown.call(void 0, bs, { tableFormat: _optionalChain([options, 'optionalAccess', _480 => _480.tableFormat]) }), { keepLoneNumbers: true }));
|
|
5340
|
+
if (_optionalChain([options, 'optionalAccess', _481 => _481.tableFormat]) === "gfm") _chunkOW2XKTQAcjs.assignTableIds.call(void 0, blocks);
|
|
5341
5341
|
let markdown = finishMarkdown(outBlocks);
|
|
5342
5342
|
const outline = collectPdfOutline(outBlocks);
|
|
5343
5343
|
return {
|
|
5344
5344
|
markdown,
|
|
5345
|
-
pages:
|
|
5345
|
+
pages: _chunkBNP3WXTBcjs.blocksToPages.call(void 0, splitPageTables(_chunkH2VOH7X3cjs.splitPageBreakWraps.call(void 0, outBlocks)), finishMarkdown),
|
|
5346
5346
|
blocks,
|
|
5347
5347
|
metadata,
|
|
5348
5348
|
outline: outline.length > 0 ? outline : void 0,
|
|
@@ -5425,5 +5425,5 @@ function marginStamp(items) {
|
|
|
5425
5425
|
|
|
5426
5426
|
|
|
5427
5427
|
|
|
5428
|
-
exports.PDFJS_DOCUMENT_OPTIONS = PDFJS_DOCUMENT_OPTIONS; exports.cleanPdfText = cleanPdfText; exports.detectKoreanListBlocks =
|
|
5429
|
-
//# sourceMappingURL=parser-
|
|
5428
|
+
exports.PDFJS_DOCUMENT_OPTIONS = PDFJS_DOCUMENT_OPTIONS; exports.cleanPdfText = cleanPdfText; exports.detectKoreanListBlocks = _chunkH2VOH7X3cjs.detectKoreanListBlocks; exports.detectTableCaptions = _chunkH2VOH7X3cjs.detectTableCaptions; exports.extractPdfMetadataOnly = extractPdfMetadataOnly; exports.mergeCrossPageTables = mergeCrossPageTables; exports.ocrImageRegions = ocrImageRegions; exports.parsePdfDocument = parsePdfDocument; exports.removeHeaderFooterBlocks = _chunkH2VOH7X3cjs.removeHeaderFooterBlocks;
|
|
5429
|
+
//# sourceMappingURL=parser-T4HAQ3QW.cjs.map
|