kordoc 4.24.37 → 4.24.38
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/{-HX3RWDQF.js → -LPQSUCWH.js} +60 -60
- package/dist/{chunk-VRCXXZHT.js → chunk-3NZP2VXB.js} +2 -2
- package/dist/{chunk-4OWD6WRS.js → chunk-5IYRVLGJ.js} +58 -7
- package/dist/{chunk-524MGRNW.js.map → chunk-5IYRVLGJ.js.map} +1 -1
- package/dist/{chunk-P3SZJJRK.js → chunk-5PONVN46.js} +7 -7
- package/dist/{chunk-QWYIYVIZ.cjs → chunk-6COUUT2E.cjs} +2 -2
- package/dist/{chunk-QWYIYVIZ.cjs.map → chunk-6COUUT2E.cjs.map} +1 -1
- package/dist/{chunk-BT5RPLV4.js → chunk-6MTH2EYN.js} +19 -19
- package/dist/{chunk-64MVXWS5.js → chunk-7F42AI4O.js} +2 -2
- package/dist/{chunk-4MWGWS3B.js → chunk-7F63OEHI.js} +2 -2
- package/dist/{chunk-IOABX3GR.cjs → chunk-ACQBUQB6.cjs} +153 -143
- package/dist/chunk-ACQBUQB6.cjs.map +1 -0
- package/dist/{chunk-6XOJ6CEK.js → chunk-AZ56HT3M.js} +3 -3
- package/dist/{chunk-OTB6UOIB.js → chunk-CDVDRC77.js} +2 -2
- package/dist/{chunk-MTSWWXSB.js → chunk-FA3MQGIF.js} +2 -2
- package/dist/{chunk-E527FG6I.cjs → chunk-FZWI6S7M.cjs} +3 -3
- package/dist/{chunk-E527FG6I.cjs.map → chunk-FZWI6S7M.cjs.map} +1 -1
- package/dist/{chunk-IWCWO3GP.js → chunk-G3JUKDMB.js} +2 -2
- package/dist/{chunk-2LDFUVVF.js → chunk-HWSJAYMR.js} +16 -7
- package/dist/chunk-HWSJAYMR.js.map +1 -0
- package/dist/{chunk-J42O5KBX.js → chunk-IDCU74H5.js} +2 -2
- package/dist/{chunk-KFJKRST5.js → chunk-ISMJQJOP.js} +14 -4
- package/dist/chunk-ISMJQJOP.js.map +1 -0
- package/dist/{chunk-RBCDHT55.cjs → chunk-JEHCRYUT.cjs} +98 -98
- package/dist/{chunk-RBCDHT55.cjs.map → chunk-JEHCRYUT.cjs.map} +1 -1
- package/dist/{chunk-524MGRNW.js → chunk-JL5REIEZ.js} +62 -11
- package/dist/{chunk-4OWD6WRS.js.map → chunk-JL5REIEZ.js.map} +1 -1
- package/dist/{chunk-BYOAA442.js → chunk-LAKPAL53.js} +2 -2
- package/dist/{chunk-J26TNCL7.js → chunk-MLXVSAR3.js} +2 -2
- package/dist/{chunk-6SVVVZLV.js → chunk-MNXKORB5.js} +2 -2
- package/dist/{chunk-33BKUIIC.js → chunk-MSRDRUOV.js} +2 -2
- package/dist/{chunk-7GN7O3K2.js → chunk-OBZV23UV.js} +51 -51
- package/dist/{chunk-B2VRTOQZ.js → chunk-ONC5LWD4.js} +18 -9
- package/dist/chunk-ONC5LWD4.js.map +1 -0
- package/dist/{chunk-XCMDIXWE.js → chunk-ONL4UTGQ.js} +32 -32
- package/dist/{chunk-GCFG67SF.js → chunk-ORIA2IFK.js} +50 -50
- package/dist/{chunk-T7K3CLXM.js → chunk-OYIGWP2N.js} +2 -2
- package/dist/{chunk-ONCXLQV4.js → chunk-P4OK4W2F.js} +3 -3
- package/dist/{chunk-LG4SU2D4.cjs → chunk-Q7WPRN62.cjs} +69 -60
- package/dist/chunk-Q7WPRN62.cjs.map +1 -0
- package/dist/{chunk-7MGZWDO4.js → chunk-RLED4WS3.js} +2 -2
- package/dist/{chunk-7MGZWDO4.js.map → chunk-RLED4WS3.js.map} +1 -1
- package/dist/{chunk-WZUTLJP2.cjs → chunk-SOI7R4LF.cjs} +133 -82
- package/dist/chunk-SOI7R4LF.cjs.map +1 -0
- package/dist/{chunk-YNIZLSM4.js → chunk-SORWBCEP.js} +8 -8
- package/dist/{chunk-6QK6ZQTF.js → chunk-TQUO7JR5.js} +3 -3
- package/dist/{chunk-LWSMZJLR.js → chunk-UJFT2OED.js} +2 -2
- package/dist/{chunk-UMQADPM5.js → chunk-UPO7Y3KL.js} +2 -2
- package/dist/{chunk-LM7LYH54.js → chunk-UQ2ZA3X4.js} +2 -2
- package/dist/{chunk-DRDW5ULI.js → chunk-UQTQXXHU.js} +14 -14
- package/dist/{chunk-EJKCEP3Q.cjs → chunk-URSNWPD4.cjs} +6 -6
- package/dist/{chunk-EJKCEP3Q.cjs.map → chunk-URSNWPD4.cjs.map} +1 -1
- package/dist/{chunk-KGX4TLBX.cjs → chunk-V5CNQSVW.cjs} +3 -3
- package/dist/{chunk-KGX4TLBX.cjs.map → chunk-V5CNQSVW.cjs.map} +1 -1
- package/dist/{chunk-OHLJEWS6.js → chunk-WOGL3YQK.js} +2 -2
- package/dist/{chunk-TQBNSAAS.js → chunk-XQPF6I6P.js} +2 -2
- package/dist/{chunk-JRVZBYQ2.js → chunk-XVWPMKPH.js} +18 -8
- package/dist/chunk-XVWPMKPH.js.map +1 -0
- package/dist/{chunk-RR2FKPFN.js → chunk-YPLKE5WG.js} +2 -2
- package/dist/{chunk-RR2FKPFN.js.map → chunk-YPLKE5WG.js.map} +1 -1
- package/dist/chunks-5L5OU6AI.js +11 -0
- package/dist/cli.js +61 -60
- package/dist/cli.js.map +1 -1
- package/dist/{formula-DLZUYM6F.js → formula-AV7SNRB4.js} +20 -17
- package/dist/{formula-DLZUYM6F.js.map → formula-AV7SNRB4.js.map} +1 -1
- package/dist/{formula-2MQWKUKR.js → formula-BMSREXB5.js} +19 -16
- package/dist/{formula-2MQWKUKR.js.map → formula-BMSREXB5.js.map} +1 -1
- package/dist/{formula-T2YY77JT.cjs → formula-NQHARDPX.cjs} +25 -22
- package/dist/formula-NQHARDPX.cjs.map +1 -0
- package/dist/generator-4CSCP6YH.js +17 -0
- package/dist/generator-OC366G6M.cjs +11 -0
- package/dist/{generator-YBWCA6B5.cjs.map → generator-OC366G6M.cjs.map} +1 -1
- package/dist/generator-UPESZL4M.js +10 -0
- package/dist/hancom-3CHPVF7H.js +84 -0
- package/dist/hancom-3CHPVF7H.js.map +1 -0
- package/dist/hancom-6Z7O3G4K.js +85 -0
- package/dist/hancom-6Z7O3G4K.js.map +1 -0
- package/dist/hancom-F5OHWSWU.cjs +85 -0
- package/dist/hancom-F5OHWSWU.cjs.map +1 -0
- package/dist/{image-ocr-N7UKGSRY.cjs → image-ocr-JQ4OEBBK.cjs} +86 -22
- package/dist/image-ocr-JQ4OEBBK.cjs.map +1 -0
- package/dist/{image-ocr-3NF3QJM7.js → image-ocr-PE5NAWAR.js} +76 -12
- package/dist/image-ocr-PE5NAWAR.js.map +1 -0
- package/dist/{image-ocr-XRKFK7AA.js → image-ocr-YJPNUWXR.js} +71 -7
- package/dist/image-ocr-YJPNUWXR.js.map +1 -0
- package/dist/index.cjs +1110 -1110
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +7 -1
- package/dist/index.d.ts +7 -1
- package/dist/index.js +70 -70
- package/dist/mcp.js +57 -56
- package/dist/mcp.js.map +1 -1
- package/dist/memo-OVXY467W.js +17 -0
- package/dist/{model-bundle-MO5I26AO.js → model-bundle-AXHPS54Q.js} +5 -5
- package/dist/{models-IIP4GZ57.js → models-CYRFBT43.js} +5 -5
- package/dist/{parse-worker-v2-GWOL3TTO.js → parse-worker-v2-GUJQNNOF.js} +28 -28
- package/dist/{parser-UCLUVQPA.js → parser-533OXR3B.js} +16 -16
- package/dist/{parser-R6UJQ6CV.cjs → parser-JVJSUMCA.cjs} +162 -162
- package/dist/{parser-R6UJQ6CV.cjs.map → parser-JVJSUMCA.cjs.map} +1 -1
- package/dist/{parser-DJQFM6VE.js → parser-S56VNTRV.js} +16 -16
- package/dist/{pdf-ocr-EWXGN4JB.js → pdf-ocr-FNW4IJWX.js} +8 -6
- package/dist/{pdf-ocr-7PSNKQOI.js → pdf-ocr-JNR4HA7O.js} +12 -10
- package/dist/pdf-ocr-ZBKAXNIE.cjs +40 -0
- package/dist/pdf-ocr-ZBKAXNIE.cjs.map +1 -0
- package/dist/{profile-io-NUU3VKNW.js → profile-io-GU5XFVSI.js} +3 -3
- package/dist/{rasterize-RARCMBJ3.js → rasterize-XOHGVWKM.js} +3 -3
- package/dist/{redact-doc-JKGDXGNJ.js → redact-doc-G5K4NVUN.js} +37 -37
- package/dist/{render-SGLKO3PG.js → render-J7VBXGFV.js} +14 -14
- package/dist/{rewrite-fallback-7YZXSR5K.js → rewrite-fallback-4QGM5F4V.js} +21 -21
- package/dist/seal-DSMAUDZ4.js +16 -0
- package/dist/{setup-5IYW4FZ7.js → setup-R5IH4AGD.js} +3 -3
- package/dist/{to-hwpx-QMANIAWY.js → to-hwpx-5ENZWUTU.js} +9 -9
- package/dist/{to-hwpx-4PM6XV2L.js → to-hwpx-I6LNQ4D4.js} +4 -4
- package/dist/to-hwpx-WCDMFRNN.cjs +16 -0
- package/dist/{to-hwpx-DEBHREDM.cjs.map → to-hwpx-WCDMFRNN.cjs.map} +1 -1
- package/dist/visual-QFPNYNCF.js +37 -0
- package/dist/{watch-YZS76EOS.js → watch-UM5SMZQP.js} +27 -27
- package/package.json +1 -1
- package/dist/chunk-2LDFUVVF.js.map +0 -1
- package/dist/chunk-B2VRTOQZ.js.map +0 -1
- package/dist/chunk-IOABX3GR.cjs.map +0 -1
- package/dist/chunk-JRVZBYQ2.js.map +0 -1
- package/dist/chunk-KFJKRST5.js.map +0 -1
- package/dist/chunk-LG4SU2D4.cjs.map +0 -1
- package/dist/chunk-WZUTLJP2.cjs.map +0 -1
- package/dist/chunks-NRA4GFK2.js +0 -11
- package/dist/formula-T2YY77JT.cjs.map +0 -1
- package/dist/generator-2WFWLJFG.js +0 -10
- package/dist/generator-5NWKWLOO.js +0 -17
- package/dist/generator-YBWCA6B5.cjs +0 -11
- package/dist/image-ocr-3NF3QJM7.js.map +0 -1
- package/dist/image-ocr-N7UKGSRY.cjs.map +0 -1
- package/dist/image-ocr-XRKFK7AA.js.map +0 -1
- package/dist/memo-XJ4NBV4J.js +0 -17
- package/dist/pdf-ocr-HECUBUMU.cjs +0 -38
- package/dist/pdf-ocr-HECUBUMU.cjs.map +0 -1
- package/dist/seal-LSS7WY6Z.js +0 -16
- package/dist/to-hwpx-DEBHREDM.cjs +0 -16
- package/dist/visual-QXYBJJ5D.js +0 -37
- /package/dist/{-HX3RWDQF.js.map → -LPQSUCWH.js.map} +0 -0
- /package/dist/{chunk-VRCXXZHT.js.map → chunk-3NZP2VXB.js.map} +0 -0
- /package/dist/{chunk-P3SZJJRK.js.map → chunk-5PONVN46.js.map} +0 -0
- /package/dist/{chunk-BT5RPLV4.js.map → chunk-6MTH2EYN.js.map} +0 -0
- /package/dist/{chunk-64MVXWS5.js.map → chunk-7F42AI4O.js.map} +0 -0
- /package/dist/{chunk-4MWGWS3B.js.map → chunk-7F63OEHI.js.map} +0 -0
- /package/dist/{chunk-6XOJ6CEK.js.map → chunk-AZ56HT3M.js.map} +0 -0
- /package/dist/{chunk-OTB6UOIB.js.map → chunk-CDVDRC77.js.map} +0 -0
- /package/dist/{chunk-MTSWWXSB.js.map → chunk-FA3MQGIF.js.map} +0 -0
- /package/dist/{chunk-IWCWO3GP.js.map → chunk-G3JUKDMB.js.map} +0 -0
- /package/dist/{chunk-J42O5KBX.js.map → chunk-IDCU74H5.js.map} +0 -0
- /package/dist/{chunk-BYOAA442.js.map → chunk-LAKPAL53.js.map} +0 -0
- /package/dist/{chunk-J26TNCL7.js.map → chunk-MLXVSAR3.js.map} +0 -0
- /package/dist/{chunk-6SVVVZLV.js.map → chunk-MNXKORB5.js.map} +0 -0
- /package/dist/{chunk-33BKUIIC.js.map → chunk-MSRDRUOV.js.map} +0 -0
- /package/dist/{chunk-7GN7O3K2.js.map → chunk-OBZV23UV.js.map} +0 -0
- /package/dist/{chunk-XCMDIXWE.js.map → chunk-ONL4UTGQ.js.map} +0 -0
- /package/dist/{chunk-GCFG67SF.js.map → chunk-ORIA2IFK.js.map} +0 -0
- /package/dist/{chunk-T7K3CLXM.js.map → chunk-OYIGWP2N.js.map} +0 -0
- /package/dist/{chunk-ONCXLQV4.js.map → chunk-P4OK4W2F.js.map} +0 -0
- /package/dist/{chunk-YNIZLSM4.js.map → chunk-SORWBCEP.js.map} +0 -0
- /package/dist/{chunk-6QK6ZQTF.js.map → chunk-TQUO7JR5.js.map} +0 -0
- /package/dist/{chunk-LWSMZJLR.js.map → chunk-UJFT2OED.js.map} +0 -0
- /package/dist/{chunk-UMQADPM5.js.map → chunk-UPO7Y3KL.js.map} +0 -0
- /package/dist/{chunk-LM7LYH54.js.map → chunk-UQ2ZA3X4.js.map} +0 -0
- /package/dist/{chunk-DRDW5ULI.js.map → chunk-UQTQXXHU.js.map} +0 -0
- /package/dist/{chunk-OHLJEWS6.js.map → chunk-WOGL3YQK.js.map} +0 -0
- /package/dist/{chunk-TQBNSAAS.js.map → chunk-XQPF6I6P.js.map} +0 -0
- /package/dist/{chunks-NRA4GFK2.js.map → chunks-5L5OU6AI.js.map} +0 -0
- /package/dist/{generator-2WFWLJFG.js.map → generator-4CSCP6YH.js.map} +0 -0
- /package/dist/{generator-5NWKWLOO.js.map → generator-UPESZL4M.js.map} +0 -0
- /package/dist/{memo-XJ4NBV4J.js.map → memo-OVXY467W.js.map} +0 -0
- /package/dist/{model-bundle-MO5I26AO.js.map → model-bundle-AXHPS54Q.js.map} +0 -0
- /package/dist/{models-IIP4GZ57.js.map → models-CYRFBT43.js.map} +0 -0
- /package/dist/{parse-worker-v2-GWOL3TTO.js.map → parse-worker-v2-GUJQNNOF.js.map} +0 -0
- /package/dist/{parser-UCLUVQPA.js.map → parser-533OXR3B.js.map} +0 -0
- /package/dist/{parser-DJQFM6VE.js.map → parser-S56VNTRV.js.map} +0 -0
- /package/dist/{pdf-ocr-7PSNKQOI.js.map → pdf-ocr-FNW4IJWX.js.map} +0 -0
- /package/dist/{pdf-ocr-EWXGN4JB.js.map → pdf-ocr-JNR4HA7O.js.map} +0 -0
- /package/dist/{profile-io-NUU3VKNW.js.map → profile-io-GU5XFVSI.js.map} +0 -0
- /package/dist/{rasterize-RARCMBJ3.js.map → rasterize-XOHGVWKM.js.map} +0 -0
- /package/dist/{redact-doc-JKGDXGNJ.js.map → redact-doc-G5K4NVUN.js.map} +0 -0
- /package/dist/{render-SGLKO3PG.js.map → render-J7VBXGFV.js.map} +0 -0
- /package/dist/{rewrite-fallback-7YZXSR5K.js.map → rewrite-fallback-4QGM5F4V.js.map} +0 -0
- /package/dist/{seal-LSS7WY6Z.js.map → seal-DSMAUDZ4.js.map} +0 -0
- /package/dist/{setup-5IYW4FZ7.js.map → setup-R5IH4AGD.js.map} +0 -0
- /package/dist/{to-hwpx-4PM6XV2L.js.map → to-hwpx-5ENZWUTU.js.map} +0 -0
- /package/dist/{to-hwpx-QMANIAWY.js.map → to-hwpx-I6LNQ4D4.js.map} +0 -0
- /package/dist/{visual-QXYBJJ5D.js.map → visual-QFPNYNCF.js.map} +0 -0
- /package/dist/{watch-YZS76EOS.js.map → watch-UM5SMZQP.js.map} +0 -0
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; } async function _asyncOptionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = await fn(value); } else if (op === 'call' || op === 'optionalCall') { value = await fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; } var _class;
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _chunkV5CNQSVWcjs = require('./chunk-V5CNQSVW.cjs');
|
|
4
4
|
|
|
5
5
|
|
|
6
|
+
var _chunkX7RBVVDCcjs = require('./chunk-X7RBVVDC.cjs');
|
|
6
7
|
|
|
7
8
|
|
|
8
9
|
|
|
10
|
+
var _chunkJ55UQC5Hcjs = require('./chunk-J55UQC5H.cjs');
|
|
9
11
|
|
|
10
12
|
|
|
11
13
|
|
|
@@ -57,17 +59,16 @@ var _chunkKGX4TLBXcjs = require('./chunk-KGX4TLBX.cjs');
|
|
|
57
59
|
|
|
58
60
|
|
|
59
61
|
|
|
60
|
-
var _chunkIOABX3GRcjs = require('./chunk-IOABX3GR.cjs');
|
|
61
62
|
|
|
62
63
|
|
|
63
|
-
var _chunkZTN3T3GHcjs = require('./chunk-ZTN3T3GH.cjs');
|
|
64
64
|
|
|
65
65
|
|
|
66
|
-
var _chunkX7RBVVDCcjs = require('./chunk-X7RBVVDC.cjs');
|
|
67
66
|
|
|
67
|
+
var _chunkACQBUQB6cjs = require('./chunk-ACQBUQB6.cjs');
|
|
68
68
|
|
|
69
69
|
|
|
70
|
-
var
|
|
70
|
+
var _chunkZTN3T3GHcjs = require('./chunk-ZTN3T3GH.cjs');
|
|
71
|
+
require('./chunk-FZWI6S7M.cjs');
|
|
71
72
|
|
|
72
73
|
|
|
73
74
|
|
|
@@ -84,12 +85,11 @@ var _chunkJ55UQC5Hcjs = require('./chunk-J55UQC5H.cjs');
|
|
|
84
85
|
|
|
85
86
|
|
|
86
87
|
|
|
87
|
-
var
|
|
88
|
-
require('./chunk-E527FG6I.cjs');
|
|
88
|
+
var _chunkURSNWPD4cjs = require('./chunk-URSNWPD4.cjs');
|
|
89
89
|
|
|
90
90
|
|
|
91
91
|
|
|
92
|
-
var
|
|
92
|
+
var _chunk6COUUT2Ecjs = require('./chunk-6COUUT2E.cjs');
|
|
93
93
|
|
|
94
94
|
|
|
95
95
|
var _chunkGS7T56RPcjs = require('./chunk-GS7T56RP.cjs');
|
|
@@ -622,13 +622,13 @@ function ocrVectorOps(opList, paths) {
|
|
|
622
622
|
|
|
623
623
|
// src/pdf/split-row-pattern.ts
|
|
624
624
|
var textOf = (cell) => cell.text.replace(/<\/?u>|~~/g, "").trim();
|
|
625
|
-
var plain = (cell) => !_optionalChain([cell, 'access', _9 => _9.blocks, 'optionalAccess', _10 => _10.length]) && !
|
|
625
|
+
var plain = (cell) => !_optionalChain([cell, 'access', _9 => _9.blocks, 'optionalAccess', _10 => _10.length]) && !_chunkACQBUQB6cjs.IMAGE_CELLS.has(cell);
|
|
626
626
|
var labelsOf = (cell) => {
|
|
627
627
|
const labels = textOf(cell).split("\n").map((s) => s.trim()).filter(Boolean);
|
|
628
628
|
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;
|
|
629
629
|
};
|
|
630
630
|
var alignedLabels = (label, value, count) => {
|
|
631
|
-
const L =
|
|
631
|
+
const L = _chunkACQBUQB6cjs.CELL_LINES.get(label), V = _chunkACQBUQB6cjs.CELL_LINES.get(value);
|
|
632
632
|
let next = 0;
|
|
633
633
|
return !!L && !!V && L.length === count && V.length >= count && Math.abs(L[0].y - V[0].y) <= 1 && L.every((l) => {
|
|
634
634
|
while (next < V.length && Math.abs(l.y - V[next].y) > 1) next++;
|
|
@@ -636,7 +636,7 @@ var alignedLabels = (label, value, count) => {
|
|
|
636
636
|
});
|
|
637
637
|
};
|
|
638
638
|
function partialAlignedLabelCells(table, owner, first) {
|
|
639
|
-
const pageOf = (a) => _nullishCoalesce(
|
|
639
|
+
const pageOf = (a) => _nullishCoalesce(_chunkURSNWPD4cjs.CELL_PAGES.get(_nullishCoalesce(a.cell, () => ( table.cells[a.r][a.c]))), () => ( (a.r < first ? -1 : -2)));
|
|
640
640
|
const pairs = [];
|
|
641
641
|
let carried = false;
|
|
642
642
|
for (let c = 0; c < table.cols; ) {
|
|
@@ -659,10 +659,10 @@ function partialAlignedLabelCells(table, owner, first) {
|
|
|
659
659
|
const keyed = pairs.filter((p) => labelsOf(p.upper) && labelsOf(p.lower));
|
|
660
660
|
if (keyed.length !== 1) return;
|
|
661
661
|
const label = keyed[0], value = pairs.find((p) => p.c === label.c + label.cs), context = pairs.find((p) => p.c + p.cs === label.c);
|
|
662
|
-
if (!value || !context || value === context || textOf(context.upper).replace(/\s+/g, "") === textOf(context.lower).replace(/\s+/g, "") || !_optionalChain([
|
|
662
|
+
if (!value || !context || value === context || textOf(context.upper).replace(/\s+/g, "") === textOf(context.lower).replace(/\s+/g, "") || !_optionalChain([_chunkURSNWPD4cjs.CELL_EDGES, 'access', _21 => _21.get, 'call', _22 => _22(context.upper), 'optionalAccess', _23 => _23.b]) || !_optionalChain([_chunkURSNWPD4cjs.CELL_EDGES, 'access', _24 => _24.get, 'call', _25 => _25(context.lower), 'optionalAccess', _26 => _26.t])) return;
|
|
663
663
|
const U = labelsOf(label.upper), D = labelsOf(label.lower), sequence = [...U, ...D];
|
|
664
664
|
if (D.length < 2 || sequence.length < 3 || new Set(sequence).size !== sequence.length || !alignedLabels(label.upper, value.upper, U.length)) return;
|
|
665
|
-
const L =
|
|
665
|
+
const L = _chunkACQBUQB6cjs.CELL_LINES.get(label.lower), V = _chunkACQBUQB6cjs.CELL_LINES.get(value.lower);
|
|
666
666
|
if (!L || !V || L.length !== D.length) return;
|
|
667
667
|
let next = V.findIndex((v) => Math.abs(v.y - L[0].y) <= 1);
|
|
668
668
|
if (next <= 0 || !V.slice(0, next).every((v) => v.y > L[0].y + 1) || !L.every((l) => {
|
|
@@ -682,14 +682,14 @@ function partialAlignedLabelCells(table, owner, first) {
|
|
|
682
682
|
continue;
|
|
683
683
|
}
|
|
684
684
|
if (list.length < 3 || new Set(list).size !== list.length) continue;
|
|
685
|
-
const visible = _nullishCoalesce(_optionalChain([
|
|
685
|
+
const visible = _nullishCoalesce(_optionalChain([_chunkACQBUQB6cjs.CELL_LINES, 'access', _31 => _31.get, 'call', _32 => _32(lc), 'optionalAccess', _33 => _33.length]), () => ( 0)), values = _chunkACQBUQB6cjs.CELL_LINES.get(vc);
|
|
686
686
|
if (visible < 3 || visible > list.length || !values || !alignedLabels(lc, vc, visible)) continue;
|
|
687
687
|
const top = Math.max(...values.map((v2) => v2.y)), bottom = Math.min(...values.map((v2) => v2.y));
|
|
688
688
|
const contexts = [];
|
|
689
689
|
for (let rr = r; rr < r + l.rs && rr < table.rows; rr++) {
|
|
690
690
|
const a = _optionalChain([owner, 'access', _34 => _34[rr], 'optionalAccess', _35 => _35[context.c]]), cell = a ? table.cells[a.r][a.c] : void 0;
|
|
691
691
|
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;
|
|
692
|
-
const lines =
|
|
692
|
+
const lines = _chunkACQBUQB6cjs.CELL_LINES.get(cell);
|
|
693
693
|
if (!_optionalChain([lines, 'optionalAccess', _36 => _36.length]) || lines.some((line) => line.y > top + 1 || line.y < bottom - 1)) break;
|
|
694
694
|
contexts.push(textOf(cell).replace(/\s+/g, ""));
|
|
695
695
|
}
|
|
@@ -991,7 +991,7 @@ function rowStarts(t) {
|
|
|
991
991
|
}
|
|
992
992
|
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));
|
|
993
993
|
function cellPage(cell) {
|
|
994
|
-
const p =
|
|
994
|
+
const p = _chunkURSNWPD4cjs.CELL_PAGES.get(cell);
|
|
995
995
|
if (p !== void 0 || !_optionalChain([cell, 'access', _103 => _103.blocks, 'optionalAccess', _104 => _104.length]) || cell.blocks.some((b) => b.pageNumber === void 0)) return p;
|
|
996
996
|
return Math.min(...cell.blocks.map((b) => b.pageNumber));
|
|
997
997
|
}
|
|
@@ -1020,7 +1020,7 @@ function markJoinedPages(table, prev, curr) {
|
|
|
1020
1020
|
rows.forEach((starts, r) => {
|
|
1021
1021
|
const page2 = r < pt.rows ? pp[r] : cp[r - off];
|
|
1022
1022
|
for (const { cell } of starts) {
|
|
1023
|
-
if (page2 !== void 0 && page2 !== prev.pageNumber)
|
|
1023
|
+
if (page2 !== void 0 && page2 !== prev.pageNumber) _chunkURSNWPD4cjs.CELL_PAGES.set(cell, page2);
|
|
1024
1024
|
const src = _optionalChain([(r < pt.rows ? ptRows[r] : ctRows[r - off]), 'optionalAccess', _107 => _107.find, 'call', _108 => _108((s) => s.cell !== cell && s.cell.text === cell.text && CELL_SPLITS.has(s.cell))]);
|
|
1025
1025
|
if (src) setSplits(cell, relocate(src.cell, cell));
|
|
1026
1026
|
}
|
|
@@ -1080,8 +1080,8 @@ function splitCrossPageRows(t, pageNumber) {
|
|
|
1080
1080
|
if (!splits.length) continue;
|
|
1081
1081
|
const clone = (cell, patch) => {
|
|
1082
1082
|
const out = { ...cell, ...patch };
|
|
1083
|
-
const p =
|
|
1084
|
-
if (p !== void 0)
|
|
1083
|
+
const p = _chunkURSNWPD4cjs.CELL_PAGES.get(cell);
|
|
1084
|
+
if (p !== void 0) _chunkURSNWPD4cjs.CELL_PAGES.set(out, p);
|
|
1085
1085
|
if (!("text" in patch) && CELL_SPLITS.has(cell)) CELL_SPLITS.set(out, CELL_SPLITS.get(cell));
|
|
1086
1086
|
return out;
|
|
1087
1087
|
};
|
|
@@ -1092,7 +1092,7 @@ function splitCrossPageRows(t, pageNumber) {
|
|
|
1092
1092
|
for (const { cell, c, split } of splits) {
|
|
1093
1093
|
cells[r][c] = clone(cell, { ...split.head, rowSpan: cut - r });
|
|
1094
1094
|
const tail = { ...cell, ...split.tail, rowSpan: r + cell.rowSpan - cut };
|
|
1095
|
-
|
|
1095
|
+
_chunkURSNWPD4cjs.CELL_PAGES.set(tail, split.page);
|
|
1096
1096
|
setSplits(tail, split.rest);
|
|
1097
1097
|
cells[cut][c] = tail;
|
|
1098
1098
|
}
|
|
@@ -1102,7 +1102,7 @@ function splitCrossPageRows(t, pageNumber) {
|
|
|
1102
1102
|
for (const { cell, c, split } of splits) {
|
|
1103
1103
|
cells[r][c] = clone(cell, split.head);
|
|
1104
1104
|
const tail = { ...cell, ...split.tail, rowSpan: 1 };
|
|
1105
|
-
|
|
1105
|
+
_chunkURSNWPD4cjs.CELL_PAGES.set(tail, split.page);
|
|
1106
1106
|
setSplits(tail, split.rest);
|
|
1107
1107
|
row[c] = tail;
|
|
1108
1108
|
}
|
|
@@ -1193,7 +1193,7 @@ function joinSplitParts(prev, pcx, curr, ccx, dx = 0, prevBottom, lex) {
|
|
|
1193
1193
|
if (cols < 1) return null;
|
|
1194
1194
|
const pa = anchorsOf(prev), ca = anchorsOf(curr);
|
|
1195
1195
|
const cutOpen = (() => {
|
|
1196
|
-
const u =
|
|
1196
|
+
const u = _chunkACQBUQB6cjs.ROW_RULES.get(prev), d = _chunkACQBUQB6cjs.ROW_RULES.get(curr);
|
|
1197
1197
|
return !!u && !!d && !u.bottom && !d.top;
|
|
1198
1198
|
})();
|
|
1199
1199
|
let skip = 0, head = 0;
|
|
@@ -1225,19 +1225,19 @@ function joinSplitParts(prev, pcx, curr, ccx, dx = 0, prevBottom, lex) {
|
|
|
1225
1225
|
if (r + dr < rows) owner[r + dr][dc] = placed;
|
|
1226
1226
|
}
|
|
1227
1227
|
grid[r][c1] = { ...a.cell, colSpan: c2 - c1, rowSpan: a.rs };
|
|
1228
|
-
const lines =
|
|
1229
|
-
if (lines)
|
|
1230
|
-
if (
|
|
1231
|
-
const edges =
|
|
1228
|
+
const lines = _chunkACQBUQB6cjs.CELL_LINES.get(a.cell);
|
|
1229
|
+
if (lines) _chunkACQBUQB6cjs.CELL_LINES.set(grid[r][c1], shift ? lines.map((l) => ({ ...l, l: l.l + shift, r: l.r + shift })) : lines);
|
|
1230
|
+
if (_chunkACQBUQB6cjs.IMAGE_CELLS.has(a.cell)) _chunkACQBUQB6cjs.IMAGE_CELLS.add(grid[r][c1]);
|
|
1231
|
+
const edges = _chunkURSNWPD4cjs.CELL_EDGES.get(a.cell);
|
|
1232
1232
|
if (edges) {
|
|
1233
|
-
|
|
1233
|
+
_chunkURSNWPD4cjs.CELL_EDGES.set(grid[r][c1], edges);
|
|
1234
1234
|
edged = true;
|
|
1235
1235
|
}
|
|
1236
1236
|
return true;
|
|
1237
1237
|
};
|
|
1238
|
-
for (const a of pa) if (!
|
|
1238
|
+
for (const a of pa) if (!_chunkACQBUQB6cjs.FILLER_CELLS.has(a.cell) && !place(a, pcx, 0)) return null;
|
|
1239
1239
|
for (const a of ca) {
|
|
1240
|
-
if (a.r < skip ||
|
|
1240
|
+
if (a.r < skip || _chunkACQBUQB6cjs.FILLER_CELLS.has(a.cell)) continue;
|
|
1241
1241
|
if (!place(a, cxU, prev.rows - skip, dx)) return null;
|
|
1242
1242
|
}
|
|
1243
1243
|
const first = prev.rows;
|
|
@@ -1261,9 +1261,9 @@ function joinSplitParts(prev, pcx, curr, ccx, dx = 0, prevBottom, lex) {
|
|
|
1261
1261
|
const grown = { ...above, rs: newRs };
|
|
1262
1262
|
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;
|
|
1263
1263
|
}
|
|
1264
|
-
for (let r = 0; r < rows; r++) for (let c = 0; c < cols; c++) if (owner[r][c] === null)
|
|
1264
|
+
for (let r = 0; r < rows; r++) for (let c = 0; c < cols; c++) if (owner[r][c] === null) _chunkACQBUQB6cjs.FILLER_CELLS.add(grid[r][c]);
|
|
1265
1265
|
if (edged) {
|
|
1266
|
-
for (let r = 0; r < rows; r++) for (let c = 0; c < cols; c++) if (owner[r][c] === null)
|
|
1266
|
+
for (let r = 0; r < rows; r++) for (let c = 0; c < cols; c++) if (owner[r][c] === null) _chunkURSNWPD4cjs.CELL_EDGES.set(grid[r][c], _chunkACQBUQB6cjs.NO_EDGES);
|
|
1267
1267
|
}
|
|
1268
1268
|
for (let c = 0; c < cols && U[c + 1] <= pcx[0] + PART_COL_TOL; c++) {
|
|
1269
1269
|
let r = prev.rows;
|
|
@@ -1272,7 +1272,7 @@ function joinSplitParts(prev, pcx, curr, ccx, dx = 0, prevBottom, lex) {
|
|
|
1272
1272
|
for (let rr = 0; rr < r; rr++) owner[rr][c] = through;
|
|
1273
1273
|
}
|
|
1274
1274
|
const table = { rows, cols, cells: grid, hasHeader: prev.hasHeader, ...prev.caption ? { caption: prev.caption } : {} };
|
|
1275
|
-
const pr =
|
|
1275
|
+
const pr = _chunkACQBUQB6cjs.ROW_RULES.get(prev), cr = _chunkACQBUQB6cjs.ROW_RULES.get(curr);
|
|
1276
1276
|
const shifted = dx !== 0;
|
|
1277
1277
|
const cut = {
|
|
1278
1278
|
open: !!pr && !!cr && !pr.bottom && !cr.top && pr.innerOpen + cr.innerOpen === 0 && pr.innerRuled + cr.innerRuled > 0,
|
|
@@ -1280,13 +1280,13 @@ function joinSplitParts(prev, pcx, curr, ccx, dx = 0, prevBottom, lex) {
|
|
|
1280
1280
|
list: !shifted ? "any" : skip > 0 && ca.filter((a) => a.r < skip && a.cell.text.trim()).length < 2 ? "none" : "multi"
|
|
1281
1281
|
};
|
|
1282
1282
|
let partial = !skip && cols === prev.cols && cols === curr.cols && cut.ruled && prevBottom !== void 0 ? partialAlignedLabelCells(table, owner, first) : void 0;
|
|
1283
|
-
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]) ||
|
|
1283
|
+
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]) || _chunkACQBUQB6cjs.startsNewItem.call(void 0, partial.value.upper.text, partial.value.lower.text))) partial = void 0;
|
|
1284
1284
|
const selected = partial ? /* @__PURE__ */ new Set([partial.label.c, partial.value.c]) : void 0;
|
|
1285
1285
|
let split = !selected && rows > prev.rows && mergeSplitRow(table, owner, prev.rows, U, false, cut);
|
|
1286
1286
|
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 });
|
|
1287
1287
|
if (pr && cr) {
|
|
1288
1288
|
const cutRuled = pr.bottom || cr.top;
|
|
1289
|
-
|
|
1289
|
+
_chunkACQBUQB6cjs.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) });
|
|
1290
1290
|
}
|
|
1291
1291
|
return { table, colXs: U, split, header: ca.filter((a) => a.r < skip && a.cell.text.trim()).length >= 2 };
|
|
1292
1292
|
}
|
|
@@ -1348,18 +1348,18 @@ function mergeStraddlingCells(table, owner, first, prevBottom, lex, colXs, selec
|
|
|
1348
1348
|
if (!d || d === u || u.r + u.rs - 1 !== last || d.r !== first || d.c !== u.c || d.cs !== u.cs) continue;
|
|
1349
1349
|
const a = table.cells[u.r][u.c], b = table.cells[first][d.c];
|
|
1350
1350
|
if (selected && !selected.has(u.c)) continue;
|
|
1351
|
-
const flowsOn = itemBreak && straddles && !!colXs && hasContent(a) && hasContent(b) && longLastLine(a) && !
|
|
1352
|
-
const openSeam = hasContent(a) && hasContent(b) &&
|
|
1351
|
+
const flowsOn = itemBreak && straddles && !!colXs && hasContent(a) && hasContent(b) && longLastLine(a) && !_chunkACQBUQB6cjs.startsNewItem.call(void 0, a.text, b.text) && continuesAcross(a, b, colXs[u.c], colXs[u.c + u.cs]);
|
|
1352
|
+
const openSeam = hasContent(a) && hasContent(b) && _chunkACQBUQB6cjs.hasOpenCellSeam.call(void 0, a, b) && !owner.some((row, r) => {
|
|
1353
1353
|
if (!r || r === first) return false;
|
|
1354
1354
|
const up = owner[r - 1][u.c], down = row[u.c];
|
|
1355
1355
|
if (!up || !down || up === down || up.c !== u.c || down.c !== u.c || up.cs !== u.cs || down.cs !== u.cs) return false;
|
|
1356
|
-
const ue =
|
|
1356
|
+
const ue = _chunkURSNWPD4cjs.CELL_EDGES.get(table.cells[up.r][up.c]), de = _chunkURSNWPD4cjs.CELL_EDGES.get(table.cells[down.r][down.c]);
|
|
1357
1357
|
return !!ue && !!de && !ue.b && !de.t;
|
|
1358
1358
|
});
|
|
1359
1359
|
if (!selected && !openSeam && !flowsOn && !crossed.has(shape(u, d)) && !(u.rs >= 2 && u.c + u.cs <= firstNew && hasContent(a) && !hasContent(b))) {
|
|
1360
1360
|
if (!straddles && !midWord) continue;
|
|
1361
1361
|
if (u.r >= last && d.rs < 2) continue;
|
|
1362
|
-
const U =
|
|
1362
|
+
const U = _chunkACQBUQB6cjs.CELL_LINES.get(a);
|
|
1363
1363
|
if (!_optionalChain([U, 'optionalAccess', _134 => _134.length]) || !hasContent(b)) continue;
|
|
1364
1364
|
if (!(straddles && filledToBottom(U, prevBottom) && clauseContinues(a, b))) {
|
|
1365
1365
|
if (U.length > STRADDLE_MAX_LINES) continue;
|
|
@@ -1377,7 +1377,7 @@ function mergeStraddlingCells(table, owner, first, prevBottom, lex, colXs, selec
|
|
|
1377
1377
|
return merged;
|
|
1378
1378
|
}
|
|
1379
1379
|
function longLastLine(c) {
|
|
1380
|
-
const L =
|
|
1380
|
+
const L = _chunkACQBUQB6cjs.CELL_LINES.get(c), l = _optionalChain([L, 'optionalAccess', _135 => _135[L.length - 1]]);
|
|
1381
1381
|
return !!l && l.r - l.l >= 6 * (l.h || 10);
|
|
1382
1382
|
}
|
|
1383
1383
|
function filledToBottom(U, bottom) {
|
|
@@ -1410,7 +1410,7 @@ function nextItemHead(prev, next) {
|
|
|
1410
1410
|
return false;
|
|
1411
1411
|
}
|
|
1412
1412
|
function continuesAcross(u, d, x1, x2) {
|
|
1413
|
-
const U =
|
|
1413
|
+
const U = _chunkACQBUQB6cjs.CELL_LINES.get(u), D = _chunkACQBUQB6cjs.CELL_LINES.get(d);
|
|
1414
1414
|
if (!_optionalChain([U, 'optionalAccess', _136 => _136.length]) || !_optionalChain([D, 'optionalAccess', _137 => _137.length])) return false;
|
|
1415
1415
|
const last = U[U.length - 1];
|
|
1416
1416
|
const fs = last.h || 10;
|
|
@@ -1428,7 +1428,7 @@ function continuesAcross(u, d, x1, x2) {
|
|
|
1428
1428
|
if (U.length === 1 && x2 - last.r > Math.max(FULL_LINE_EDGE_MIN, SINGLE_LINE_WORD_GAP * fs)) return false;
|
|
1429
1429
|
const indented = last.l - minL >= HANGING_MIN * fs;
|
|
1430
1430
|
if (last.r - last.l < FULL_LINE_MIN_FRAC * (indented ? x2 - last.l : x2 - x1)) return false;
|
|
1431
|
-
const newItem =
|
|
1431
|
+
const newItem = _chunkACQBUQB6cjs.startsNewItem.call(void 0, u.text, d.text);
|
|
1432
1432
|
const all = D.length ? U.concat(D) : U;
|
|
1433
1433
|
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));
|
|
1434
1434
|
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;
|
|
@@ -1445,10 +1445,10 @@ function outlineContinues(u, d) {
|
|
|
1445
1445
|
return U.length >= 2 && D.length >= 1 && U.some((l) => OUTLINE_HEAD.test(l)) && OUTLINE_ITEM.test(D[0]);
|
|
1446
1446
|
}
|
|
1447
1447
|
function lineEnded(c, x1, x2, next) {
|
|
1448
|
-
const L =
|
|
1448
|
+
const L = _chunkACQBUQB6cjs.CELL_LINES.get(c);
|
|
1449
1449
|
if (!L || L.length !== 1) return false;
|
|
1450
1450
|
const l = L[0], h = l.h || 10;
|
|
1451
|
-
const d0 = next ? _optionalChain([
|
|
1451
|
+
const d0 = next ? _optionalChain([_chunkACQBUQB6cjs.CELL_LINES, 'access', _138 => _138.get, 'call', _139 => _139(next), 'optionalAccess', _140 => _140[0]]) : void 0;
|
|
1452
1452
|
if (d0 && d0.l - l.l >= HANGING_MIN * h) return false;
|
|
1453
1453
|
return x2 - l.r - (l.l - x1) >= Math.max(LABEL_ROOM, firstWordUnits(_nullishCoalesce(_optionalChain([next, 'optionalAccess', _141 => _141.text]), () => ( "")))) * h;
|
|
1454
1454
|
}
|
|
@@ -1459,15 +1459,15 @@ function firstWordUnits(text) {
|
|
|
1459
1459
|
return units;
|
|
1460
1460
|
}
|
|
1461
1461
|
function appendCell(a, b) {
|
|
1462
|
-
if (
|
|
1462
|
+
if (_chunkACQBUQB6cjs.IMAGE_CELLS.has(b)) _chunkACQBUQB6cjs.IMAGE_CELLS.add(a);
|
|
1463
1463
|
if (_optionalChain([a, 'access', _142 => _142.blocks, 'optionalAccess', _143 => _143.length]) || _optionalChain([b, 'access', _144 => _144.blocks, 'optionalAccess', _145 => _145.length])) {
|
|
1464
1464
|
const asBlocks = (c) => _optionalChain([c, 'access', _146 => _146.blocks, 'optionalAccess', _147 => _147.length]) ? c.blocks : c.text.split("\n").map((l) => l.trim()).filter(Boolean).map((text) => ({ type: "paragraph", text }));
|
|
1465
1465
|
a.blocks = [...asBlocks(a), ...asBlocks(b)];
|
|
1466
1466
|
}
|
|
1467
1467
|
if (b.text.trim()) a.text = a.text.trim() ? a.text + "\n" + b.text : b.text;
|
|
1468
|
-
|
|
1468
|
+
_chunkACQBUQB6cjs.joinCellEdges.call(void 0, a, b);
|
|
1469
1469
|
}
|
|
1470
|
-
var hasContent = (cell) => !!cell.text.trim() || !!_optionalChain([cell, 'access', _148 => _148.blocks, 'optionalAccess', _149 => _149.length]) ||
|
|
1470
|
+
var hasContent = (cell) => !!cell.text.trim() || !!_optionalChain([cell, 'access', _148 => _148.blocks, 'optionalAccess', _149 => _149.length]) || _chunkACQBUQB6cjs.IMAGE_CELLS.has(cell);
|
|
1471
1471
|
var CLAUSE_OPEN_ENDING = /(?:하는|되는|하고|하며|하여|되어|되고|되며|이며|으며|어야|아야|여야)$/;
|
|
1472
1472
|
var batchim = (ch) => {
|
|
1473
1473
|
const k = ch.charCodeAt(0) - 44032;
|
|
@@ -1475,7 +1475,7 @@ var batchim = (ch) => {
|
|
|
1475
1475
|
};
|
|
1476
1476
|
function clauseContinues(u, d) {
|
|
1477
1477
|
const tail = _nullishCoalesce(flowText(u.text).trim().split(/\s+/).pop(), () => ( "")), head = flowText(d.text).trim();
|
|
1478
|
-
if (!/^[가-힣]{2,}$/.test(tail) || !/^[가-힣]/.test(head) ||
|
|
1478
|
+
if (!/^[가-힣]{2,}$/.test(tail) || !/^[가-힣]/.test(head) || _chunkACQBUQB6cjs.startsNewItem.call(void 0, u.text, head)) return false;
|
|
1479
1479
|
const last = tail[tail.length - 1], before = tail[tail.length - 2];
|
|
1480
1480
|
return last === "\uC744" && batchim(before) || last === "\uB97C" && !batchim(before) || CLAUSE_OPEN_ENDING.test(tail);
|
|
1481
1481
|
}
|
|
@@ -1483,8 +1483,8 @@ function quantityContinues(u, d) {
|
|
|
1483
1483
|
return /\d[\d,.]*\s*(?:%|[가-힣]{1,2})?$/.test(flowText(u.text).trim()) && /^(?:미만|이상|이하|초과)(?![가-힣])/.test(flowText(d.text).trim());
|
|
1484
1484
|
}
|
|
1485
1485
|
function wordOverflows(u, d, x1, x2) {
|
|
1486
|
-
const U =
|
|
1487
|
-
if (!_optionalChain([U, 'optionalAccess', _150 => _150.length]) ||
|
|
1486
|
+
const U = _chunkACQBUQB6cjs.CELL_LINES.get(u);
|
|
1487
|
+
if (!_optionalChain([U, 'optionalAccess', _150 => _150.length]) || _chunkACQBUQB6cjs.startsNewItem.call(void 0, u.text, d.text)) return false;
|
|
1488
1488
|
const last = U[U.length - 1], units = firstWordUnits(d.text);
|
|
1489
1489
|
return units > 0 && last.r - last.l + units * (last.h || 10) > x2 - x1;
|
|
1490
1490
|
}
|
|
@@ -1553,7 +1553,7 @@ function mergeSplitRow(table, owner, first, colXs, textOnly = false, cut = NO_CU
|
|
|
1553
1553
|
if (!carriedSplit && !band) {
|
|
1554
1554
|
const norm = (c) => flowText(c.text).replace(/\s+/g, "");
|
|
1555
1555
|
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;
|
|
1556
|
-
const oneLine = (c) => _optionalChain([
|
|
1556
|
+
const oneLine = (c) => _optionalChain([_chunkACQBUQB6cjs.CELL_LINES, 'access', _152 => _152.get, 'call', _153 => _153(c), 'optionalAccess', _154 => _154.length]) === 1;
|
|
1557
1557
|
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;
|
|
1558
1558
|
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;
|
|
1559
1559
|
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));
|
|
@@ -1646,19 +1646,19 @@ function mergeCrossPageTables(blocks, pageHeights, lex) {
|
|
|
1646
1646
|
placeJoined(blocks, i, j, joined);
|
|
1647
1647
|
continue;
|
|
1648
1648
|
}
|
|
1649
|
-
if (
|
|
1649
|
+
if (_chunkACQBUQB6cjs.EMPTY_PARTS.has(curr.table)) {
|
|
1650
1650
|
blocks.splice(j, 1);
|
|
1651
1651
|
i++;
|
|
1652
1652
|
continue;
|
|
1653
1653
|
}
|
|
1654
1654
|
if (joined === null) continue;
|
|
1655
|
-
if (prev.table.cols !== curr.table.cols || prev.table.renderAsTable !== curr.table.renderAsTable ||
|
|
1655
|
+
if (prev.table.cols !== curr.table.cols || prev.table.renderAsTable !== curr.table.renderAsTable || _chunkACQBUQB6cjs.EMPTY_PARTS.has(prev.table)) continue;
|
|
1656
1656
|
const width = Math.max(prev.bbox.width, curr.bbox.width, 1);
|
|
1657
1657
|
const leftDiff = Math.abs(prev.bbox.x - curr.bbox.x);
|
|
1658
1658
|
const rightDiff = Math.abs(prev.bbox.x + prev.bbox.width - (curr.bbox.x + curr.bbox.width));
|
|
1659
1659
|
if (leftDiff > width * NEIGHBOR_TABLE_EPSILON || rightDiff > width * NEIGHBOR_TABLE_EPSILON) continue;
|
|
1660
|
-
const px =
|
|
1661
|
-
if (px && cx && !shiftedSame(px, cx, !
|
|
1660
|
+
const px = _chunkACQBUQB6cjs.TABLE_COLXS.get(prev.table), cx = _chunkACQBUQB6cjs.TABLE_COLXS.get(curr.table);
|
|
1661
|
+
if (px && cx && !shiftedSame(px, cx, !_chunkACQBUQB6cjs.CLIP_TABLES.has(prev.table) && !_chunkACQBUQB6cjs.CLIP_TABLES.has(curr.table))) continue;
|
|
1662
1662
|
if (!px !== !cx) continue;
|
|
1663
1663
|
if (!rowTextsEqual(prev.table.cells[0], curr.table.cells[0]) && sameHeadShape(prev.table.cells[0], curr.table.cells[0])) continue;
|
|
1664
1664
|
let currCells = curr.table.cells;
|
|
@@ -1670,16 +1670,16 @@ function mergeCrossPageTables(blocks, pageHeights, lex) {
|
|
|
1670
1670
|
blocks.splice(j, 1);
|
|
1671
1671
|
continue;
|
|
1672
1672
|
}
|
|
1673
|
-
if (px && cx && !
|
|
1673
|
+
if (px && cx && !_chunkACQBUQB6cjs.CLIP_TABLES.has(prev.table) && !_chunkACQBUQB6cjs.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 && _chunkACQBUQB6cjs.CELL_LINES.has(c))) {
|
|
1674
1674
|
const dx = px[0] - cx[0];
|
|
1675
1675
|
const part = joinSplitParts(prev.table, px, curr.table, cx.map((x) => x + dx), dx, void 0, lex);
|
|
1676
1676
|
if (_optionalChain([part, 'optionalAccess', _175 => _175.split]) && part.table.rows === prev.table.rows + currCells.length - 1) {
|
|
1677
1677
|
const last = prev.table.rows - 1;
|
|
1678
1678
|
for (let c = 0; c < part.table.cols; c++) {
|
|
1679
|
-
const U =
|
|
1680
|
-
|
|
1679
|
+
const U = _chunkACQBUQB6cjs.CELL_LINES.get(prev.table.cells[last][c]), D = _chunkACQBUQB6cjs.CELL_LINES.get(currCells[0][c]);
|
|
1680
|
+
_chunkACQBUQB6cjs.CELL_LINES.set(part.table.cells[last][c], U.concat(D.map((l) => ({ ...l, l: l.l + dx, r: l.r + dx }))));
|
|
1681
1681
|
}
|
|
1682
|
-
|
|
1682
|
+
_chunkACQBUQB6cjs.TABLE_COLXS.set(part.table, part.colXs);
|
|
1683
1683
|
placeJoined(blocks, i, j, part.table);
|
|
1684
1684
|
continue;
|
|
1685
1685
|
}
|
|
@@ -1692,20 +1692,20 @@ function mergeCrossPageTables(blocks, pageHeights, lex) {
|
|
|
1692
1692
|
caption: prev.table.caption,
|
|
1693
1693
|
...prev.table.renderAsTable ? { renderAsTable: true } : {}
|
|
1694
1694
|
};
|
|
1695
|
-
if (_nullishCoalesce(px, () => ( cx)))
|
|
1696
|
-
if (
|
|
1695
|
+
if (_nullishCoalesce(px, () => ( cx))) _chunkACQBUQB6cjs.TABLE_COLXS.set(merged, _nullishCoalesce(px, () => ( cx)));
|
|
1696
|
+
if (_chunkACQBUQB6cjs.CLIP_TABLES.has(prev.table) || _chunkACQBUQB6cjs.CLIP_TABLES.has(curr.table)) _chunkACQBUQB6cjs.CLIP_TABLES.add(merged);
|
|
1697
1697
|
placeJoined(blocks, i, j, merged);
|
|
1698
1698
|
}
|
|
1699
1699
|
for (let i = blocks.length - 1; i >= 0; i--) {
|
|
1700
1700
|
const t = blocks[i].table;
|
|
1701
|
-
if (blocks[i].type === "table" && t &&
|
|
1701
|
+
if (blocks[i].type === "table" && t && _chunkACQBUQB6cjs.EMPTY_PARTS.has(t)) blocks.splice(i, 1);
|
|
1702
1702
|
}
|
|
1703
1703
|
}
|
|
1704
1704
|
function mergeColumnFlow(blocks, pageHeights, lex) {
|
|
1705
1705
|
if (!pageHeights) return;
|
|
1706
1706
|
for (let i = 0; i < blocks.length; i++) {
|
|
1707
1707
|
const L = blocks[i];
|
|
1708
|
-
if (L.type !== "table" || !L.table || !L.bbox || !L.pageNumber || !
|
|
1708
|
+
if (L.type !== "table" || !L.table || !L.bbox || !L.pageNumber || !_chunkACQBUQB6cjs.CLIP_TABLES.has(L.table) || _chunkACQBUQB6cjs.EMPTY_PARTS.has(L.table)) continue;
|
|
1709
1709
|
const ph = pageHeights.get(L.pageNumber);
|
|
1710
1710
|
if (!ph || L.bbox.y > ph * PAGE_EDGE_BAND) continue;
|
|
1711
1711
|
let s0 = i, s1 = i;
|
|
@@ -1724,8 +1724,8 @@ function mergeColumnFlow(blocks, pageHeights, lex) {
|
|
|
1724
1724
|
if (Math.abs(R.bbox.width - L.bbox.width) > Math.max(R.bbox.width, L.bbox.width) * NEIGHBOR_TABLE_EPSILON) continue;
|
|
1725
1725
|
if (!looksContinued(L, R) || restartsTable(blocks, i, R.table, pageHeights)) continue;
|
|
1726
1726
|
const rt = R.table;
|
|
1727
|
-
if (rt.rows === 1 && rt.cols === 1 && !
|
|
1728
|
-
const px =
|
|
1727
|
+
if (rt.rows === 1 && rt.cols === 1 && !_chunkACQBUQB6cjs.CLIP_TABLES.has(rt) && L.table.rows >= 2) {
|
|
1728
|
+
const px = _chunkACQBUQB6cjs.TABLE_COLXS.get(L.table), lb = L.bbox;
|
|
1729
1729
|
const dx = lb.x + lb.width - (R.bbox.x + R.bbox.width);
|
|
1730
1730
|
const last = L.table.cells[L.table.rows - 1];
|
|
1731
1731
|
let col = 0;
|
|
@@ -1754,8 +1754,8 @@ function mergeColumnFlow(blocks, pageHeights, lex) {
|
|
|
1754
1754
|
}
|
|
1755
1755
|
function joinClipParts(prev, curr, pageHeights, lex) {
|
|
1756
1756
|
const pt = prev.table, ct = curr.table;
|
|
1757
|
-
if (!
|
|
1758
|
-
const px =
|
|
1757
|
+
if (!_chunkACQBUQB6cjs.CLIP_TABLES.has(pt) || !_chunkACQBUQB6cjs.CLIP_TABLES.has(ct)) return null;
|
|
1758
|
+
const px = _chunkACQBUQB6cjs.TABLE_COLXS.get(pt), cx = _chunkACQBUQB6cjs.TABLE_COLXS.get(ct);
|
|
1759
1759
|
if (!px || !cx) return null;
|
|
1760
1760
|
let xs = cx, shifted = false, dx = 0, foreign = false, within = false;
|
|
1761
1761
|
if (!shiftedSame(px, cx, false)) {
|
|
@@ -1771,15 +1771,15 @@ function joinClipParts(prev, curr, pageHeights, lex) {
|
|
|
1771
1771
|
const inner = b.slice(1, -1).map((x) => x + dx);
|
|
1772
1772
|
return inner.length > 0 && !inner.some((x) => px.some((p) => Math.abs(p - x) <= CONTINUATION_COL_TOL));
|
|
1773
1773
|
};
|
|
1774
|
-
foreign = unrelated(cx) && unrelated(_nullishCoalesce(
|
|
1774
|
+
foreign = unrelated(cx) && unrelated(_nullishCoalesce(_chunkACQBUQB6cjs.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);
|
|
1775
1775
|
}
|
|
1776
1776
|
const res = joinSplitParts(pt, px, ct, xs, dx, _optionalChain([prev, 'access', _180 => _180.bbox, 'optionalAccess', _181 => _181.y]), lex);
|
|
1777
1777
|
if (!res || (shifted || foreign || within) && !res.split && !res.header) return null;
|
|
1778
|
-
|
|
1779
|
-
const ys =
|
|
1780
|
-
if (ys)
|
|
1781
|
-
|
|
1782
|
-
|
|
1778
|
+
_chunkACQBUQB6cjs.TABLE_COLXS.set(res.table, res.colXs);
|
|
1779
|
+
const ys = _chunkACQBUQB6cjs.TABLE_ROWYS.get(pt);
|
|
1780
|
+
if (ys) _chunkACQBUQB6cjs.TABLE_ROWYS.set(res.table, ys);
|
|
1781
|
+
_chunkACQBUQB6cjs.PART_COLXS.set(res.table, _nullishCoalesce(_chunkACQBUQB6cjs.PART_COLXS.get(pt), () => ( px)));
|
|
1782
|
+
_chunkACQBUQB6cjs.CLIP_TABLES.add(res.table);
|
|
1783
1783
|
return res.table;
|
|
1784
1784
|
}
|
|
1785
1785
|
function prevLacksLeftCols(prev, px, xs, pageHeights) {
|
|
@@ -1803,12 +1803,12 @@ function looksContinued(prev, curr, pageHeights) {
|
|
|
1803
1803
|
return filled.length >= 2 && filled.every((t) => t === filled[0]);
|
|
1804
1804
|
}
|
|
1805
1805
|
function pushedLead(prev, curr) {
|
|
1806
|
-
if (!
|
|
1806
|
+
if (!_chunkACQBUQB6cjs.CLIP_TABLES.has(prev.table) || !_chunkACQBUQB6cjs.CLIP_TABLES.has(curr.table)) return false;
|
|
1807
1807
|
const lead = leadRows(curr.table);
|
|
1808
1808
|
return lead.image && lead.height > prev.bbox.y;
|
|
1809
1809
|
}
|
|
1810
1810
|
function leadRows(t) {
|
|
1811
|
-
const ys =
|
|
1811
|
+
const ys = _chunkACQBUQB6cjs.TABLE_ROWYS.get(t);
|
|
1812
1812
|
if (!ys || ys.length < 2) return { height: 0, image: false };
|
|
1813
1813
|
const anchors = anchorsOf(t);
|
|
1814
1814
|
let end = 1, image = false;
|
|
@@ -1816,17 +1816,17 @@ function leadRows(t) {
|
|
|
1816
1816
|
for (const a of anchors) {
|
|
1817
1817
|
if (a.r !== r) continue;
|
|
1818
1818
|
end = Math.max(end, r + a.rs);
|
|
1819
|
-
if (
|
|
1819
|
+
if (_chunkACQBUQB6cjs.IMAGE_CELLS.has(a.cell)) image = true;
|
|
1820
1820
|
}
|
|
1821
1821
|
}
|
|
1822
1822
|
return { height: ys[0] - ys[Math.min(end, ys.length - 1)], image };
|
|
1823
1823
|
}
|
|
1824
1824
|
function tailOf(b) {
|
|
1825
|
-
const t = b.table &&
|
|
1825
|
+
const t = b.table && _chunkACQBUQB6cjs.TABLE_TAIL.get(b.table);
|
|
1826
1826
|
return t && b.bbox ? { ...b, pageNumber: t.page, bbox: { ...b.bbox, page: t.page, y: t.y, height: t.height } } : b;
|
|
1827
1827
|
}
|
|
1828
1828
|
function firstRowSig(t) {
|
|
1829
|
-
const x =
|
|
1829
|
+
const x = _chunkACQBUQB6cjs.TABLE_COLXS.get(t);
|
|
1830
1830
|
if (!x || x.length !== t.cols + 1) return null;
|
|
1831
1831
|
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, "") }));
|
|
1832
1832
|
}
|
|
@@ -1879,7 +1879,7 @@ function chainHead(blocks, i, pageHeights) {
|
|
|
1879
1879
|
if (pb.pageNumber !== (_nullishCoalesce(cur.pageNumber, () => ( 0))) - 1) break;
|
|
1880
1880
|
if (!blocks.slice(p + 1, k).every((b) => besideOwn(b, pb, cur) || insideTable(b, pb) || pageNumberBetween(b, pb, cur, pageHeights))) break;
|
|
1881
1881
|
if (!looksContinued(pb, cur, pageHeights)) break;
|
|
1882
|
-
const px =
|
|
1882
|
+
const px = _chunkACQBUQB6cjs.TABLE_COLXS.get(pb.table), cx = _chunkACQBUQB6cjs.TABLE_COLXS.get(cur.table);
|
|
1883
1883
|
if (!px || !cx) break;
|
|
1884
1884
|
const dx = px[px.length - 1] - cx[cx.length - 1];
|
|
1885
1885
|
if (!shiftedSame(px, cx) && !px.some((x) => Math.abs(x - (cx[0] + dx)) <= CONTINUATION_COL_TOL) && !prevLacksLeftCols(pb, px, cx, pageHeights)) break;
|
|
@@ -1950,7 +1950,7 @@ var RESTART_LOOKBACK_PAGES = 5;
|
|
|
1950
1950
|
var COL_MATCH_TOL = 0.5;
|
|
1951
1951
|
var CONTINUED_TABLE_PAGE_BAND = 0.16;
|
|
1952
1952
|
function lastRowCell(t, x1, x2) {
|
|
1953
|
-
const xs =
|
|
1953
|
+
const xs = _chunkACQBUQB6cjs.TABLE_COLXS.get(t);
|
|
1954
1954
|
const covered = /* @__PURE__ */ new Set();
|
|
1955
1955
|
for (let r = 0; r < t.rows; r++) {
|
|
1956
1956
|
for (let c = 0; c < t.cols; c++) {
|
|
@@ -1968,7 +1968,7 @@ var cellBlocks = (cell, pageNumber) => _nullishCoalesce(cell.blocks, () => ( cel
|
|
|
1968
1968
|
function mergeContinuedCells(blocks, pageHeights) {
|
|
1969
1969
|
for (let j = blocks.length - 1; j > 0; j--) {
|
|
1970
1970
|
const part = blocks[j];
|
|
1971
|
-
const from = part.table ?
|
|
1971
|
+
const from = part.table ? _chunkACQBUQB6cjs.CONT_PARTS.get(part.table) : void 0;
|
|
1972
1972
|
if (!from || !part.table) {
|
|
1973
1973
|
unwrapContinuedTable(blocks, j, pageHeights, true);
|
|
1974
1974
|
continue;
|
|
@@ -1984,12 +1984,12 @@ function mergeContinuedCells(blocks, pageHeights) {
|
|
|
1984
1984
|
if (cell.blocks || add.blocks) cell.blocks = [...cellBlocks(cell, prev.pageNumber), ...cellBlocks(add, part.pageNumber)];
|
|
1985
1985
|
else if (part.pageNumber) markContinuedText(cell, add, part.pageNumber);
|
|
1986
1986
|
cell.text = [cell.text, add.text].filter((s) => s.trim()).join("\n");
|
|
1987
|
-
if (
|
|
1988
|
-
|
|
1989
|
-
const lines =
|
|
1990
|
-
if (_optionalChain([lines, 'optionalAccess', _205 => _205.length]))
|
|
1991
|
-
if (part.pageNumber && part.bbox)
|
|
1992
|
-
if (cell.text.trim() || _optionalChain([cell, 'access', _206 => _206.blocks, 'optionalAccess', _207 => _207.length]) ||
|
|
1987
|
+
if (_chunkACQBUQB6cjs.IMAGE_CELLS.has(add)) _chunkACQBUQB6cjs.IMAGE_CELLS.add(cell);
|
|
1988
|
+
_chunkACQBUQB6cjs.joinCellEdges.call(void 0, cell, add);
|
|
1989
|
+
const lines = _chunkACQBUQB6cjs.CELL_LINES.get(add);
|
|
1990
|
+
if (_optionalChain([lines, 'optionalAccess', _205 => _205.length])) _chunkACQBUQB6cjs.CELL_LINES.set(cell, [..._nullishCoalesce(_chunkACQBUQB6cjs.CELL_LINES.get(cell), () => ( [])), ...lines]);
|
|
1991
|
+
if (part.pageNumber && part.bbox) _chunkACQBUQB6cjs.TABLE_TAIL.set(prev.table, _nullishCoalesce(_chunkACQBUQB6cjs.TABLE_TAIL.get(part.table), () => ( { page: part.pageNumber, y: part.bbox.y, height: part.bbox.height })));
|
|
1992
|
+
if (cell.text.trim() || _optionalChain([cell, 'access', _206 => _206.blocks, 'optionalAccess', _207 => _207.length]) || _chunkACQBUQB6cjs.IMAGE_CELLS.has(cell)) _chunkACQBUQB6cjs.EMPTY_PARTS.delete(prev.table);
|
|
1993
1993
|
blocks.splice(j, 1);
|
|
1994
1994
|
if (cell.blocks && at > 0) {
|
|
1995
1995
|
const nextAt = cell.blocks[at];
|
|
@@ -2001,11 +2001,11 @@ function mergeContinuedCells(blocks, pageHeights) {
|
|
|
2001
2001
|
}
|
|
2002
2002
|
function unwrapContinuedTable(blocks, at, pageHeights, splitOnly = false) {
|
|
2003
2003
|
const prev = blocks[at - 1], frame = blocks[at];
|
|
2004
|
-
if (!_optionalChain([prev, 'optionalAccess', _208 => _208.table]) || !_optionalChain([frame, 'optionalAccess', _209 => _209.table]) || frame.table.rows !== 1 || frame.table.cols !== 1 || !
|
|
2004
|
+
if (!_optionalChain([prev, 'optionalAccess', _208 => _208.table]) || !_optionalChain([frame, 'optionalAccess', _209 => _209.table]) || frame.table.rows !== 1 || frame.table.cols !== 1 || !_chunkACQBUQB6cjs.CLIP_TABLES.has(frame.table)) return;
|
|
2005
2005
|
const inner = _optionalChain([frame, 'access', _210 => _210.table, 'access', _211 => _211.cells, 'access', _212 => _212[0], 'optionalAccess', _213 => _213[0], 'optionalAccess', _214 => _214.blocks]);
|
|
2006
2006
|
const next = _optionalChain([inner, 'optionalAccess', _215 => _215[0]]);
|
|
2007
|
-
if (!inner || !_optionalChain([next, 'optionalAccess', _216 => _216.table]) || !prev.bbox || !next.bbox || !prev.pageNumber || next.pageNumber !== prev.pageNumber + 1 || !
|
|
2008
|
-
const px =
|
|
2007
|
+
if (!inner || !_optionalChain([next, 'optionalAccess', _216 => _216.table]) || !prev.bbox || !next.bbox || !prev.pageNumber || next.pageNumber !== prev.pageNumber + 1 || !_chunkACQBUQB6cjs.CLIP_TABLES.has(prev.table) || !_chunkACQBUQB6cjs.CLIP_TABLES.has(next.table) || prev.table.cols !== next.table.cols) return;
|
|
2008
|
+
const px = _chunkACQBUQB6cjs.TABLE_COLXS.get(prev.table), nx = _chunkACQBUQB6cjs.TABLE_COLXS.get(next.table);
|
|
2009
2009
|
if (!px || !nx || px.length !== nx.length || px.some((x, i) => Math.abs(x - nx[i]) > COL_MATCH_TOL)) return;
|
|
2010
2010
|
const ph = _optionalChain([pageHeights, 'optionalAccess', _217 => _217.get, 'call', _218 => _218(prev.pageNumber)]), nh = _optionalChain([pageHeights, 'optionalAccess', _219 => _219.get, 'call', _220 => _220(next.pageNumber)]);
|
|
2011
2011
|
if (!ph || !nh || prev.bbox.y > ph * CONTINUED_TABLE_PAGE_BAND || next.bbox.y + next.bbox.height < nh * (1 - CONTINUED_TABLE_PAGE_BAND)) return;
|
|
@@ -2015,15 +2015,15 @@ function unwrapContinuedTable(blocks, at, pageHeights, splitOnly = false) {
|
|
|
2015
2015
|
function fillNestedContinuation(blocks, at) {
|
|
2016
2016
|
const prev = blocks[at - 1], next = blocks[at];
|
|
2017
2017
|
const t = _optionalChain([prev, 'optionalAccess', _223 => _223.table]), u = _optionalChain([next, 'optionalAccess', _224 => _224.table]);
|
|
2018
|
-
if (!t || !u || u.rows !== 1 || u.cols !== 1 || !
|
|
2019
|
-
const xs =
|
|
2018
|
+
if (!t || !u || u.rows !== 1 || u.cols !== 1 || !_chunkACQBUQB6cjs.CLIP_TABLES.has(t) || !_chunkACQBUQB6cjs.CLIP_TABLES.has(u) || next.pageNumber !== (_nullishCoalesce(prev.pageNumber, () => ( 0))) + 1) return;
|
|
2019
|
+
const xs = _chunkACQBUQB6cjs.TABLE_COLXS.get(u);
|
|
2020
2020
|
const cell = xs ? lastRowCell(t, xs[0], xs[xs.length - 1]) : void 0;
|
|
2021
2021
|
const add = _optionalChain([u, 'access', _225 => _225.cells, 'access', _226 => _226[0], 'optionalAccess', _227 => _227[0]]);
|
|
2022
|
-
if (!cell || !add || cell.text.trim() || _optionalChain([cell, 'access', _228 => _228.blocks, 'optionalAccess', _229 => _229.length]) ||
|
|
2022
|
+
if (!cell || !add || cell.text.trim() || _optionalChain([cell, 'access', _228 => _228.blocks, 'optionalAccess', _229 => _229.length]) || _chunkACQBUQB6cjs.IMAGE_CELLS.has(cell)) return;
|
|
2023
2023
|
cell.text = add.text;
|
|
2024
2024
|
if (add.blocks) cell.blocks = add.blocks;
|
|
2025
|
-
if (
|
|
2026
|
-
|
|
2025
|
+
if (_chunkACQBUQB6cjs.IMAGE_CELLS.has(add)) _chunkACQBUQB6cjs.IMAGE_CELLS.add(cell);
|
|
2026
|
+
_chunkACQBUQB6cjs.joinCellEdges.call(void 0, cell, add);
|
|
2027
2027
|
blocks.splice(at, 1);
|
|
2028
2028
|
}
|
|
2029
2029
|
|
|
@@ -2623,12 +2623,12 @@ function restoreUnmappedGlyphs(items, fnArray, argsArray, fontObj) {
|
|
|
2623
2623
|
}
|
|
2624
2624
|
}
|
|
2625
2625
|
for (const q of queues.values()) for (let k = 0; k < q.length; k++) {
|
|
2626
|
-
const pair = k + 1 < q.length ?
|
|
2626
|
+
const pair = k + 1 < q.length ? _chunkURSNWPD4cjs.pairedNumber.call(void 0, q[k], q[k + 1]) : void 0;
|
|
2627
2627
|
if (pair !== void 0) {
|
|
2628
2628
|
q[k] = pair;
|
|
2629
2629
|
q[k + 1] = "";
|
|
2630
2630
|
k++;
|
|
2631
|
-
} else q[k] =
|
|
2631
|
+
} else q[k] = _chunkURSNWPD4cjs.mapPuaText.call(void 0, q[k]);
|
|
2632
2632
|
}
|
|
2633
2633
|
const byFont = /* @__PURE__ */ new Map();
|
|
2634
2634
|
for (const it of items) {
|
|
@@ -2718,15 +2718,15 @@ function selectionContextPages(selected, pageCount) {
|
|
|
2718
2718
|
function marginContextBlocks(raw, page, view) {
|
|
2719
2719
|
const [x1, y1, x2, y2] = view;
|
|
2720
2720
|
const width = x2 - x1, height = y2 - y1;
|
|
2721
|
-
const items =
|
|
2721
|
+
const items = _chunkACQBUQB6cjs.filterHiddenText.call(void 0, _chunkACQBUQB6cjs.normalizeItems.call(void 0, raw), width, height, x1, y1).visible;
|
|
2722
2722
|
for (const item of items) {
|
|
2723
2723
|
item.x -= x1;
|
|
2724
2724
|
item.y -= y1;
|
|
2725
2725
|
}
|
|
2726
|
-
return
|
|
2727
|
-
const bbox =
|
|
2726
|
+
return _chunkACQBUQB6cjs.groupByY.call(void 0, items).flatMap((line) => {
|
|
2727
|
+
const bbox = _chunkACQBUQB6cjs.computeBBox.call(void 0, line, page);
|
|
2728
2728
|
if (bbox.y + bbox.height < height * 0.88 && bbox.y > height * 0.12) return [];
|
|
2729
|
-
return [{ type: "paragraph", text:
|
|
2729
|
+
return [{ type: "paragraph", text: _chunkACQBUQB6cjs.mergeLineSimple.call(void 0, line), pageNumber: page, bbox, style: _chunkACQBUQB6cjs.dominantStyle.call(void 0, line) }];
|
|
2730
2730
|
});
|
|
2731
2731
|
}
|
|
2732
2732
|
|
|
@@ -2762,7 +2762,7 @@ var WINANSI_REVERSE = {
|
|
|
2762
2762
|
};
|
|
2763
2763
|
function symbolFontTable(fontName) {
|
|
2764
2764
|
if (!fontName) return void 0;
|
|
2765
|
-
if (/wingdings(?![\s-]*[23])/i.test(fontName)) return
|
|
2765
|
+
if (/wingdings(?![\s-]*[23])/i.test(fontName)) return _chunkURSNWPD4cjs.WINGDINGS;
|
|
2766
2766
|
return void 0;
|
|
2767
2767
|
}
|
|
2768
2768
|
function remapSymbolText(text, table) {
|
|
@@ -2995,7 +2995,7 @@ function wrapEquationRuns(items, faceName) {
|
|
|
2995
2995
|
for (const i of members) drop.add(i);
|
|
2996
2996
|
const toks = cur.map((it) => {
|
|
2997
2997
|
const bar2 = isBarItem(it);
|
|
2998
|
-
const text = bar2 ? "" : plain2.has(items.indexOf(it)) ?
|
|
2998
|
+
const text = bar2 ? "" : plain2.has(items.indexOf(it)) ? _chunkURSNWPD4cjs.toTex.call(void 0, it.text) : FUNC_RE.test(it.text.trim()) ? it.text.trim() : [...it.text].map(decodeEq).join("");
|
|
2999
2999
|
return { text, x: it.x, y: it.y, w: it.w, size: sizeOf(it), bar: bar2 };
|
|
3000
3000
|
});
|
|
3001
3001
|
const tex = layout(toks).replace(/\}\\text\{/g, "");
|
|
@@ -3835,7 +3835,7 @@ function mergeEnclosedDigits(items) {
|
|
|
3835
3835
|
if (!/^\d\d?$/.test(digits)) continue;
|
|
3836
3836
|
const mid = (inside2[0].x + inside2[inside2.length - 1].x + inside2[inside2.length - 1].w) / 2;
|
|
3837
3837
|
if (Math.abs(mid - (s.x + s.w / 2)) > s.fontSize * 0.15) continue;
|
|
3838
|
-
s.text =
|
|
3838
|
+
s.text = _chunkURSNWPD4cjs.enclosedNumber.call(void 0, Number(digits));
|
|
3839
3839
|
for (const d of inside2) drop.add(d);
|
|
3840
3840
|
}
|
|
3841
3841
|
if (!drop.size) return;
|
|
@@ -4032,7 +4032,7 @@ function demoteNonHeadingRoles(blocks, pageHeights, faceNames) {
|
|
|
4032
4032
|
if (block.type !== "heading" || !block.text) continue;
|
|
4033
4033
|
const text = block.text.replace(/<[^>]+>/g, "").trim();
|
|
4034
4034
|
const fsz = _nullishCoalesce(_optionalChain([block, 'access', _311 => _311.style, 'optionalAccess', _312 => _312.fontSize]), () => ( 0));
|
|
4035
|
-
const tocEntry = i > 0 &&
|
|
4035
|
+
const tocEntry = i > 0 && _chunkACQBUQB6cjs.TOC_BLOCKS.has(blocks[i - 1]) && _chunkACQBUQB6cjs.TOC_BLOCKS.has(blocks[i + 1]);
|
|
4036
4036
|
const page = _nullishCoalesce(byPage.get(_nullishCoalesce(block.pageNumber, () => ( 0))), () => ( []));
|
|
4037
4037
|
const proseStyle = _optionalChain([block, 'access', _313 => _313.style, 'optionalAccess', _314 => _314.fontName]) && bodyStyle.get(_nullishCoalesce(block.pageNumber, () => ( 0))) === `${block.style.fontName}:${block.style.fontSize}` && text.length > 60;
|
|
4038
4038
|
const next = blocks[i + 1];
|
|
@@ -4130,7 +4130,7 @@ function splitSingleCellTables(blocks) {
|
|
|
4130
4130
|
const out = [];
|
|
4131
4131
|
for (const b of blocks) {
|
|
4132
4132
|
const t = b.type === "table" ? b.table : void 0;
|
|
4133
|
-
const title = t &&
|
|
4133
|
+
const title = t && _chunkACQBUQB6cjs.FRAME_TITLE_BLOCKS.get(t);
|
|
4134
4134
|
if (title) {
|
|
4135
4135
|
out.push({ ...title, text: `${t.cells[0][0].text.trim()} ${t.cells[0][2].text.trim()}` });
|
|
4136
4136
|
continue;
|
|
@@ -4166,7 +4166,7 @@ function joinLatinCellWraps(blocks) {
|
|
|
4166
4166
|
const lines = cell.text.split("\n");
|
|
4167
4167
|
const out = [lines[0]];
|
|
4168
4168
|
for (const line of lines.slice(1)) {
|
|
4169
|
-
if (
|
|
4169
|
+
if (_chunkACQBUQB6cjs.latinSoftWrap.call(void 0, out[out.length - 1], line)) out[out.length - 1] = out[out.length - 1].trimEnd() + " " + line.trim();
|
|
4170
4170
|
else out.push(line);
|
|
4171
4171
|
}
|
|
4172
4172
|
cell.text = out.join("\n");
|
|
@@ -4186,10 +4186,10 @@ function cleanPdfText(text, opts) {
|
|
|
4186
4186
|
).replace(/^(?!\| ---).*$/gm, (line) => {
|
|
4187
4187
|
if (/^\s*\${1,2}.+\${1,2}\s*$/.test(line)) return line;
|
|
4188
4188
|
if (line.startsWith("|")) {
|
|
4189
|
-
return line.replace(/(?:\\.|[^|\\])+/g, (cell) => cell.split("<br>").map((seg) => seg.replace(/\S(?:.*\S)?/, (t) =>
|
|
4189
|
+
return line.replace(/(?:\\.|[^|\\])+/g, (cell) => cell.split("<br>").map((seg) => seg.replace(/\S(?:.*\S)?/, (t) => _chunkACQBUQB6cjs.collapseEvenSpacing.call(void 0, t, false))).join("<br>"));
|
|
4190
4190
|
}
|
|
4191
4191
|
const mark = _nullishCoalesce(_optionalChain([/^(?:#{1,6}|-) /, 'access', _394 => _394.exec, 'call', _395 => _395(line), 'optionalAccess', _396 => _396[0]]), () => ( ""));
|
|
4192
|
-
return mark +
|
|
4192
|
+
return mark + _chunkACQBUQB6cjs.collapseEvenSpacing.call(void 0, line.slice(mark.length), false);
|
|
4193
4193
|
}).replace(/\\~\\~/g, "~~").replace(/~~~~/g, "").replace(/<u>\s*<\/u>/g, "").replace(/<(sup|sub)>\s*<\/\1>/g, "").replace(/\n{3,}/g, "\n\n").trim();
|
|
4194
4194
|
}
|
|
4195
4195
|
function startsWithMarker(line) {
|
|
@@ -4221,7 +4221,7 @@ function mergeKoreanLines(text) {
|
|
|
4221
4221
|
continue;
|
|
4222
4222
|
}
|
|
4223
4223
|
if (/[가-힣·,\-]$/.test(prev) && /^[가-힣(]/.test(curr) && !startsWithMarker(curr) && !isStandaloneHeader(prev) && !startsWithMarker(prev)) {
|
|
4224
|
-
result[result.length - 1] = prev +
|
|
4224
|
+
result[result.length - 1] = prev + _chunkACQBUQB6cjs.wrapJoiner.call(void 0, prev, curr) + curr;
|
|
4225
4225
|
} else {
|
|
4226
4226
|
result.push(curr);
|
|
4227
4227
|
}
|
|
@@ -4237,7 +4237,7 @@ function applyLinkAnnotations(items, annots) {
|
|
|
4237
4237
|
const wrapped = /* @__PURE__ */ new Set();
|
|
4238
4238
|
for (const a of annots) {
|
|
4239
4239
|
if (a.subtype !== "Link" || !a.url || !a.rect || a.rect.length < 4) continue;
|
|
4240
|
-
const url =
|
|
4240
|
+
const url = _chunk6COUUT2Ecjs.sanitizeHref.call(void 0, a.url);
|
|
4241
4241
|
if (!url) continue;
|
|
4242
4242
|
const x1 = Math.min(a.rect[0], a.rect[2]), x2 = Math.max(a.rect[0], a.rect[2]);
|
|
4243
4243
|
const y1 = Math.min(a.rect[1], a.rect[3]), y2 = Math.max(a.rect[1], a.rect[3]);
|
|
@@ -4289,7 +4289,7 @@ function mergeLinkRuns(markdown) {
|
|
|
4289
4289
|
|
|
4290
4290
|
// src/pdf/formula-ocr.ts
|
|
4291
4291
|
async function applyFormulaOcr(buffer, blocks, pageFilter, effectivePageCount, warnings, _onProgress) {
|
|
4292
|
-
const formulaMod = await Promise.resolve().then(() => _interopRequireWildcard(require("./formula-
|
|
4292
|
+
const formulaMod = await Promise.resolve().then(() => _interopRequireWildcard(require("./formula-NQHARDPX.cjs")));
|
|
4293
4293
|
const { FormulaPipeline, ensureFormulaModels } = formulaMod;
|
|
4294
4294
|
await ensureFormulaModels((p) => {
|
|
4295
4295
|
if (p.phase === "download" && p.total) {
|
|
@@ -4480,13 +4480,13 @@ async function loadPdfWithTimeout(buffer) {
|
|
|
4480
4480
|
try {
|
|
4481
4481
|
return await Promise.race([
|
|
4482
4482
|
loadingTask.promise.catch((e) => {
|
|
4483
|
-
if (e instanceof Error && e.name === "PasswordException") throw new (0,
|
|
4483
|
+
if (e instanceof Error && e.name === "PasswordException") throw new (0, _chunk6COUUT2Ecjs.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)");
|
|
4484
4484
|
throw e;
|
|
4485
4485
|
}),
|
|
4486
4486
|
new Promise((_, reject) => {
|
|
4487
4487
|
timer = setTimeout(() => {
|
|
4488
4488
|
loadingTask.destroy();
|
|
4489
|
-
reject(new (0,
|
|
4489
|
+
reject(new (0, _chunk6COUUT2Ecjs.KordocError)("PDF \uB85C\uB529 \uD0C0\uC784\uC544\uC6C3 (30\uCD08 \uCD08\uACFC)"));
|
|
4490
4490
|
}, PDF_LOAD_TIMEOUT_MS);
|
|
4491
4491
|
})
|
|
4492
4492
|
]);
|
|
@@ -4497,13 +4497,13 @@ async function loadPdfWithTimeout(buffer) {
|
|
|
4497
4497
|
async function parsePdfDocument(buffer, options) {
|
|
4498
4498
|
const formulaBuffer = _optionalChain([options, 'optionalAccess', _397 => _397.formulaOcr]) ? buffer : null;
|
|
4499
4499
|
const ocrOptionError = _chunkZTN3T3GHcjs.validateOcrOptions.call(void 0, options);
|
|
4500
|
-
if (ocrOptionError) throw new (0,
|
|
4501
|
-
const autoOcr = _optionalChain([options, 'optionalAccess', _398 => _398.ocr]) === void 0 && await
|
|
4500
|
+
if (ocrOptionError) throw new (0, _chunk6COUUT2Ecjs.KordocError)(ocrOptionError);
|
|
4501
|
+
const autoOcr = _optionalChain([options, 'optionalAccess', _398 => _398.ocr]) === void 0 && await _chunkACQBUQB6cjs.ocrModelsCached.call(void 0, _chunkACQBUQB6cjs.resolveOcrModels.call(void 0, options)) && (_optionalChain([options, 'optionalAccess', _399 => _399.ocrRec]) !== "auto" || await _chunkACQBUQB6cjs.ocrModelsCached.call(void 0, _chunkACQBUQB6cjs.handwritingFallbackModels.call(void 0, _chunkACQBUQB6cjs.resolveOcrModels.call(void 0, options))));
|
|
4502
4502
|
const ocrBuffer = _optionalChain([options, 'optionalAccess', _400 => _400.ocr]) || autoOcr ? buffer : null;
|
|
4503
4503
|
const doc = await loadPdfWithTimeout(buffer);
|
|
4504
4504
|
try {
|
|
4505
4505
|
const pageCount = doc.numPages;
|
|
4506
|
-
if (pageCount === 0) throw new (0,
|
|
4506
|
+
if (pageCount === 0) throw new (0, _chunk6COUUT2Ecjs.KordocError)("PDF\uC5D0 \uD398\uC774\uC9C0\uAC00 \uC5C6\uC2B5\uB2C8\uB2E4.");
|
|
4507
4507
|
const metadata = { pageCount, pageMode: "layout" };
|
|
4508
4508
|
await extractPdfMetadata(doc, metadata);
|
|
4509
4509
|
const blocks = [];
|
|
@@ -4533,7 +4533,7 @@ async function parsePdfDocument(buffer, options) {
|
|
|
4533
4533
|
const carry = {};
|
|
4534
4534
|
const preciseGaps = await isHancomPdf(doc);
|
|
4535
4535
|
const vectorPageOps = /* @__PURE__ */ new Map();
|
|
4536
|
-
const wrapLexicon = new (0,
|
|
4536
|
+
const wrapLexicon = new (0, _chunkACQBUQB6cjs.WrapLexicon)();
|
|
4537
4537
|
const noteMarks = /* @__PURE__ */ new Map();
|
|
4538
4538
|
const headerContext = [];
|
|
4539
4539
|
if (pageFilter && _optionalChain([options, 'optionalAccess', _403 => _403.removeHeaderFooter]) !== false && pageFilter.size < effectivePageCount) {
|
|
@@ -4584,12 +4584,12 @@ async function parsePdfDocument(buffer, options) {
|
|
|
4584
4584
|
markSyntheticSpaces(rawItems, rawOps.fnArray, rawOps.argsArray);
|
|
4585
4585
|
restoreSoftHyphens();
|
|
4586
4586
|
rawItems.push(...spaceMappedDots(rawOps.fnArray, rawOps.argsArray, (n) => fontObj(n)));
|
|
4587
|
-
const items =
|
|
4587
|
+
const items = _chunkACQBUQB6cjs.normalizeItems.call(void 0, occluded.size ? rawItems.filter((it) => !occluded.has(it)) : rawItems);
|
|
4588
4588
|
if (!preciseGaps) for (const it of items) {
|
|
4589
4589
|
delete it.fx;
|
|
4590
4590
|
delete it.fw;
|
|
4591
4591
|
}
|
|
4592
|
-
const filtered =
|
|
4592
|
+
const filtered = _chunkACQBUQB6cjs.filterHiddenText.call(void 0, items, pageW, pageH, viewX1, viewY1);
|
|
4593
4593
|
const joined = joinVerticalColumns(filtered.visible);
|
|
4594
4594
|
const visible = dropTabLeaderDots(joined);
|
|
4595
4595
|
const hiddenCount = filtered.hiddenCount + occluded.size;
|
|
@@ -4616,7 +4616,7 @@ async function parsePdfDocument(buffer, options) {
|
|
|
4616
4616
|
} : rawOps;
|
|
4617
4617
|
remapSymbolFontItems(visible, (loadedName) => _optionalChain([fontObj, 'call', _410 => _410(loadedName), 'optionalAccess', _411 => _411.name]));
|
|
4618
4618
|
remapControlGlyphs(visible, differencesOf);
|
|
4619
|
-
await
|
|
4619
|
+
await _chunkACQBUQB6cjs.restoreImageBullets.call(void 0, visible, page, opList.fnArray, opList.argsArray, imageBulletShapes);
|
|
4620
4620
|
const faces = /* @__PURE__ */ new Map();
|
|
4621
4621
|
for (const it of visible) {
|
|
4622
4622
|
if (!it.fontName) continue;
|
|
@@ -4629,12 +4629,12 @@ async function parsePdfDocument(buffer, options) {
|
|
|
4629
4629
|
it.fontName = face;
|
|
4630
4630
|
if (!faceNames.has(face)) faceNames.set(face, (_nullishCoalesce(_optionalChain([fontObj, 'call', _413 => _413(face), 'optionalAccess', _414 => _414.name]), () => ( ""))).replace(/^[A-Z]{6}\+/, ""));
|
|
4631
4631
|
}
|
|
4632
|
-
for (const it of visible) if (it.text.includes("$")) it.text =
|
|
4633
|
-
for (const it of visible) if (it.text.includes("<")) it.text =
|
|
4632
|
+
for (const it of visible) if (it.text.includes("$")) it.text = _chunkURSNWPD4cjs.escapeLiteralDollar.call(void 0, it.text);
|
|
4633
|
+
for (const it of visible) if (it.text.includes("<")) it.text = _chunkURSNWPD4cjs.escapeLiteralTags.call(void 0, it.text);
|
|
4634
4634
|
wrapEquationRuns(visible, (face) => faceNames.get(face));
|
|
4635
4635
|
const pageArea = pageW * pageH;
|
|
4636
4636
|
if (pageArea > 0) {
|
|
4637
|
-
const imageRegions =
|
|
4637
|
+
const imageRegions = _chunkACQBUQB6cjs.extractImageRegions.call(void 0, opList.fnArray, opList.argsArray);
|
|
4638
4638
|
let uncovered = 0;
|
|
4639
4639
|
for (const r of imageRegions) {
|
|
4640
4640
|
const area = (r.x2 - r.x1) * (r.y2 - r.y1);
|
|
@@ -4660,11 +4660,11 @@ async function parsePdfDocument(buffer, options) {
|
|
|
4660
4660
|
if (uncovered > 0) skippedImagePages.set(i, uncovered);
|
|
4661
4661
|
}
|
|
4662
4662
|
const marks = superscriptNoteMarks(visible);
|
|
4663
|
-
if (marks.length) noteMarks.set(i, { marks, seps: footnoteSeparators(
|
|
4663
|
+
if (marks.length) noteMarks.set(i, { marks, seps: footnoteSeparators(_chunkACQBUQB6cjs.extractLines.call(void 0, opList.fnArray, opList.argsArray).horizontals, pageW, pageH) });
|
|
4664
4664
|
const stamp = marginStamp(visible);
|
|
4665
4665
|
const flow = stamp.length ? visible.filter((it) => !stamp.includes(it)) : visible;
|
|
4666
|
-
const rightArrows = _optionalChain([options, 'optionalAccess', _415 => _415.tables]) !== false ? await
|
|
4667
|
-
const pageBlocks = orderTwoUpPage(
|
|
4666
|
+
const rightArrows = _optionalChain([options, 'optionalAccess', _415 => _415.tables]) !== false ? await _chunkACQBUQB6cjs.detectRightArrowRegions.call(void 0, page, opList.fnArray, opList.argsArray, imageArrowDirections) : [];
|
|
4667
|
+
const pageBlocks = orderTwoUpPage(_chunkACQBUQB6cjs.extractPageBlocksWithLines.call(void 0, flow, i, opList, pageW, pageH, void 0, _optionalChain([options, 'optionalAccess', _416 => _416.tables]) !== false, carry, wrapLexicon, rightArrows), pageW, pageH);
|
|
4668
4668
|
if (stamp.length) pageBlocks.unshift({ type: "paragraph", text: [...stamp].sort((a, b) => a.y - b.y).map((it) => it.text).join(" "), pageNumber: i });
|
|
4669
4669
|
for (const b of pageBlocks) blocks.push(b);
|
|
4670
4670
|
try {
|
|
@@ -4690,11 +4690,11 @@ async function parsePdfDocument(buffer, options) {
|
|
|
4690
4690
|
if (_optionalChain([options, 'optionalAccess', _418 => _418.ocr]) && quality.ocrReason === "vector_text" && page.rotate % 360 === 0 && page.view[0] === 0 && page.view[1] === 0) {
|
|
4691
4691
|
vectorPageOps.set(i, ocrVectorOps(opList, vector.paths));
|
|
4692
4692
|
}
|
|
4693
|
-
if (totalTextBytes > MAX_TOTAL_TEXT) throw new (0,
|
|
4693
|
+
if (totalTextBytes > MAX_TOTAL_TEXT) throw new (0, _chunk6COUUT2Ecjs.KordocError)("\uD14D\uC2A4\uD2B8 \uCD94\uCD9C \uD06C\uAE30 \uCD08\uACFC");
|
|
4694
4694
|
parsedPages++;
|
|
4695
4695
|
_optionalChain([options, 'optionalAccess', _419 => _419.onProgress, 'optionalCall', _420 => _420(parsedPages, totalTarget)]);
|
|
4696
4696
|
} catch (pageErr) {
|
|
4697
|
-
if (pageErr instanceof
|
|
4697
|
+
if (pageErr instanceof _chunk6COUUT2Ecjs.KordocError) throw pageErr;
|
|
4698
4698
|
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" });
|
|
4699
4699
|
} finally {
|
|
4700
4700
|
_optionalChain([loadedPage, 'optionalAccess', _421 => _421.cleanup, 'call', _422 => _422()]);
|
|
@@ -4725,12 +4725,12 @@ async function parsePdfDocument(buffer, options) {
|
|
|
4725
4725
|
}
|
|
4726
4726
|
if (targets.size > 0) {
|
|
4727
4727
|
try {
|
|
4728
|
-
const { runPdfOcr } = await Promise.resolve().then(() => _interopRequireWildcard(require("./pdf-ocr-
|
|
4728
|
+
const { runPdfOcr } = await Promise.resolve().then(() => _interopRequireWildcard(require("./pdf-ocr-ZBKAXNIE.cjs")));
|
|
4729
4729
|
const mode = typeof _optionalChain([options, 'optionalAccess', _427 => _427.ocr]) === "function" ? options.ocr : "builtin";
|
|
4730
4730
|
const regionPages = new Map([...ocrRegions].filter(([p]) => _optionalChain([options, 'optionalAccess', _428 => _428.ocr]) !== "force" && !isImageBased && !_optionalChain([pageQuality, 'access', _429 => _429.find, 'call', _430 => _430((q) => q.page === p), 'optionalAccess', _431 => _431.needsOcr])));
|
|
4731
|
-
const { builtinOcrConfig } = await Promise.resolve().then(() => _interopRequireWildcard(require("./pdf-ocr-
|
|
4731
|
+
const { builtinOcrConfig } = await Promise.resolve().then(() => _interopRequireWildcard(require("./pdf-ocr-ZBKAXNIE.cjs")));
|
|
4732
4732
|
const ocrPageBlocks = await runPdfOcr(ocrBuffer, targets, mode, warnings, _optionalChain([options, 'optionalAccess', _432 => _432.onProgress]), _optionalChain([options, 'optionalAccess', _433 => _433.tables]) !== false, vectorPageOps, regionPages, builtinOcrConfig(options), ocrLinesOut);
|
|
4733
|
-
for (const obs of ocrPageBlocks.values())
|
|
4733
|
+
for (const obs of ocrPageBlocks.values()) _chunkURSNWPD4cjs.stripScriptTags.call(void 0, { blocks: obs });
|
|
4734
4734
|
if (ocrPageBlocks.size > 0) {
|
|
4735
4735
|
const replacePages = /* @__PURE__ */ new Set();
|
|
4736
4736
|
for (const [p, obs] of ocrPageBlocks) {
|
|
@@ -4741,7 +4741,7 @@ async function parsePdfDocument(buffer, options) {
|
|
|
4741
4741
|
continue;
|
|
4742
4742
|
}
|
|
4743
4743
|
const regions = ocrRegions.get(p);
|
|
4744
|
-
if (!regions ||
|
|
4744
|
+
if (!regions || _chunkACQBUQB6cjs.mergeOcrImageRegions.call(void 0, blocks, p, regions, obs) === 0) continue;
|
|
4745
4745
|
ocrDone.add(p);
|
|
4746
4746
|
if (_optionalChain([pageImageBlocks, 'access', _438 => _438.get, 'call', _439 => _439(p), 'optionalAccess', _440 => _440.length]) === 1) pageImageBlocks.delete(p);
|
|
4747
4747
|
}
|
|
@@ -4794,17 +4794,17 @@ async function parsePdfDocument(buffer, options) {
|
|
|
4794
4794
|
}
|
|
4795
4795
|
}
|
|
4796
4796
|
if (_optionalChain([options, 'optionalAccess', _441 => _441.removeHeaderFooter]) !== false && (parsedPageCount >= 3 || headerContext.length)) {
|
|
4797
|
-
const removed =
|
|
4798
|
-
const running =
|
|
4797
|
+
const removed = _chunkACQBUQB6cjs.removeHeaderFooterBlocks.call(void 0, blocks, pageHeights, warnings, noteMarks, false, headerContext);
|
|
4798
|
+
const running = _chunkACQBUQB6cjs.runningLinePatterns.call(void 0, removed.map((ri) => blocks[ri]), pageHeights);
|
|
4799
4799
|
for (let ri = removed.length - 1; ri >= 0; ri--) {
|
|
4800
4800
|
blocks.splice(removed[ri], 1);
|
|
4801
4801
|
}
|
|
4802
|
-
const stripped =
|
|
4802
|
+
const stripped = _chunkACQBUQB6cjs.stripAbsorbedRunningLines.call(void 0, blocks, pageHeights, running);
|
|
4803
4803
|
if (stripped !== blocks) {
|
|
4804
4804
|
blocks.length = 0;
|
|
4805
4805
|
blocks.push(...stripped);
|
|
4806
4806
|
}
|
|
4807
|
-
const kept =
|
|
4807
|
+
const kept = _chunkACQBUQB6cjs.removeSideTabs.call(void 0, blocks, pageWidths);
|
|
4808
4808
|
if (kept !== blocks) {
|
|
4809
4809
|
blocks.length = 0;
|
|
4810
4810
|
blocks.push(...kept);
|
|
@@ -4813,12 +4813,12 @@ async function parsePdfDocument(buffer, options) {
|
|
|
4813
4813
|
mergeContinuedCells(blocks, pageHeights);
|
|
4814
4814
|
mergeCrossPageTables(blocks, pageHeights, wrapLexicon);
|
|
4815
4815
|
if (_optionalChain([options, 'optionalAccess', _442 => _442.removeHeaderFooter]) !== false && parsedPageCount >= 3) {
|
|
4816
|
-
const boxes =
|
|
4816
|
+
const boxes = _chunkACQBUQB6cjs.removeHeaderFooterBlocks.call(void 0, blocks, pageHeights, warnings, noteMarks, true);
|
|
4817
4817
|
for (let ri = boxes.length - 1; ri >= 0; ri--) blocks.splice(boxes[ri], 1);
|
|
4818
4818
|
}
|
|
4819
4819
|
splitContactTables(blocks);
|
|
4820
|
-
if (!_optionalChain([options, 'optionalAccess', _443 => _443.keepTrailingEmptyCols]))
|
|
4821
|
-
|
|
4820
|
+
if (!_optionalChain([options, 'optionalAccess', _443 => _443.keepTrailingEmptyCols])) _chunkACQBUQB6cjs.trimTrailingEmptyTableCols.call(void 0, blocks);
|
|
4821
|
+
_chunkACQBUQB6cjs.joinPageBreakWraps.call(void 0, blocks, wrapLexicon);
|
|
4822
4822
|
injectPageImageBlocks(blocks, pageImageBlocks);
|
|
4823
4823
|
if (_optionalChain([options, 'optionalAccess', _444 => _444.formulaOcr]) && formulaBuffer) {
|
|
4824
4824
|
try {
|
|
@@ -4830,21 +4830,21 @@ async function parsePdfDocument(buffer, options) {
|
|
|
4830
4830
|
});
|
|
4831
4831
|
}
|
|
4832
4832
|
}
|
|
4833
|
-
const medianFontSize =
|
|
4833
|
+
const medianFontSize = _chunkACQBUQB6cjs.computeMedianFontSizeFromFreq.call(void 0, fontSizeFreq);
|
|
4834
4834
|
if (medianFontSize > 0) {
|
|
4835
|
-
|
|
4836
|
-
}
|
|
4837
|
-
|
|
4838
|
-
|
|
4839
|
-
|
|
4840
|
-
|
|
4841
|
-
|
|
4842
|
-
|
|
4843
|
-
|
|
4844
|
-
|
|
4835
|
+
_chunkACQBUQB6cjs.detectHeadings.call(void 0, blocks, medianFontSize);
|
|
4836
|
+
}
|
|
4837
|
+
_chunkACQBUQB6cjs.detectDocumentStyleHeadings.call(void 0, blocks);
|
|
4838
|
+
_chunkACQBUQB6cjs.detectTypographyHeadings.call(void 0, blocks);
|
|
4839
|
+
_chunkACQBUQB6cjs.detectSiblingStyleHeadings.call(void 0, blocks);
|
|
4840
|
+
_chunkACQBUQB6cjs.detectRepeatedPageLabels.call(void 0, blocks);
|
|
4841
|
+
_chunkACQBUQB6cjs.detectPageLeadHeadings.call(void 0, blocks);
|
|
4842
|
+
_chunkACQBUQB6cjs.mergeStackedHeadingLines.call(void 0, blocks, medianFontSize);
|
|
4843
|
+
_chunkACQBUQB6cjs.refineDocumentStyleHeadings.call(void 0, blocks);
|
|
4844
|
+
_chunkACQBUQB6cjs.detectMarkerHeadings.call(void 0, blocks);
|
|
4845
4845
|
demoteNonHeadingRoles(blocks, pageHeights, faceNames);
|
|
4846
|
-
|
|
4847
|
-
|
|
4846
|
+
_chunkACQBUQB6cjs.detectTableCaptions.call(void 0, blocks);
|
|
4847
|
+
_chunkACQBUQB6cjs.detectKoreanListBlocks.call(void 0, blocks);
|
|
4848
4848
|
sanitizeBlockControlChars(blocks);
|
|
4849
4849
|
let outBlocks = splitSingleCellTables(blocks);
|
|
4850
4850
|
if (_optionalChain([options, 'optionalAccess', _445 => _445.layoutTables]) !== "keep") {
|
|
@@ -4865,19 +4865,19 @@ async function parsePdfDocument(buffer, options) {
|
|
|
4865
4865
|
const shown = /* @__PURE__ */ new Map();
|
|
4866
4866
|
const markContent = (bs) => {
|
|
4867
4867
|
for (const b of _nullishCoalesce(bs, () => ( []))) if (b.table) for (const row of b.table.cells) for (const c of row) {
|
|
4868
|
-
if (
|
|
4869
|
-
const lines =
|
|
4870
|
-
if (lines)
|
|
4868
|
+
if (_chunkACQBUQB6cjs.IMAGE_CELLS.has(c)) _chunkURSNWPD4cjs.CONTENT_CELLS.add(c);
|
|
4869
|
+
const lines = _chunkACQBUQB6cjs.CELL_LINES.get(c);
|
|
4870
|
+
if (lines) _chunkURSNWPD4cjs.CELL_BASELINES.set(c, lines.map((l) => l.y));
|
|
4871
4871
|
markContent(c.blocks);
|
|
4872
4872
|
}
|
|
4873
4873
|
};
|
|
4874
4874
|
const visual = (bs) => bs.flatMap((b) => {
|
|
4875
4875
|
if (b.type !== "table") return [b];
|
|
4876
|
-
if (!hancom && b.table &&
|
|
4876
|
+
if (!hancom && b.table && _chunkACQBUQB6cjs.CLIP_TABLES.has(b.table)) return [b];
|
|
4877
4877
|
let v = shown.get(b);
|
|
4878
4878
|
if (!v) {
|
|
4879
4879
|
markContent([b]);
|
|
4880
|
-
shown.set(b, v =
|
|
4880
|
+
shown.set(b, v = _chunkURSNWPD4cjs.unframeLayoutTables.call(void 0, [b], !!_optionalChain([options, 'optionalAccess', _448 => _448.keepTrailingEmptyCols])));
|
|
4881
4881
|
}
|
|
4882
4882
|
return v;
|
|
4883
4883
|
});
|
|
@@ -4886,13 +4886,13 @@ async function parsePdfDocument(buffer, options) {
|
|
|
4886
4886
|
blocks.length = 0;
|
|
4887
4887
|
for (const b of kept) blocks.push(b);
|
|
4888
4888
|
}
|
|
4889
|
-
const finishMarkdown = (bs) => mergeLinkRuns(cleanPdfText(
|
|
4890
|
-
if (_optionalChain([options, 'optionalAccess', _450 => _450.tableFormat]) === "gfm")
|
|
4889
|
+
const finishMarkdown = (bs) => mergeLinkRuns(cleanPdfText(_chunkURSNWPD4cjs.blocksToMarkdown.call(void 0, bs, { tableFormat: _optionalChain([options, 'optionalAccess', _449 => _449.tableFormat]) }), { keepLoneNumbers: true }));
|
|
4890
|
+
if (_optionalChain([options, 'optionalAccess', _450 => _450.tableFormat]) === "gfm") _chunkURSNWPD4cjs.assignTableIds.call(void 0, blocks);
|
|
4891
4891
|
let markdown = finishMarkdown(outBlocks);
|
|
4892
4892
|
const outline = collectPdfOutline(outBlocks);
|
|
4893
4893
|
return {
|
|
4894
4894
|
markdown,
|
|
4895
|
-
pages:
|
|
4895
|
+
pages: _chunkV5CNQSVWcjs.blocksToPages.call(void 0, splitPageTables(_chunkACQBUQB6cjs.splitPageBreakWraps.call(void 0, outBlocks)), finishMarkdown),
|
|
4896
4896
|
blocks,
|
|
4897
4897
|
metadata,
|
|
4898
4898
|
outline: outline.length > 0 ? outline : void 0,
|
|
@@ -4972,5 +4972,5 @@ function marginStamp(items) {
|
|
|
4972
4972
|
|
|
4973
4973
|
|
|
4974
4974
|
|
|
4975
|
-
exports.PDFJS_DOCUMENT_OPTIONS = PDFJS_DOCUMENT_OPTIONS; exports.cleanPdfText = cleanPdfText; exports.detectKoreanListBlocks =
|
|
4976
|
-
//# sourceMappingURL=parser-
|
|
4975
|
+
exports.PDFJS_DOCUMENT_OPTIONS = PDFJS_DOCUMENT_OPTIONS; exports.cleanPdfText = cleanPdfText; exports.detectKoreanListBlocks = _chunkACQBUQB6cjs.detectKoreanListBlocks; exports.detectTableCaptions = _chunkACQBUQB6cjs.detectTableCaptions; exports.extractPdfMetadataOnly = extractPdfMetadataOnly; exports.mergeCrossPageTables = mergeCrossPageTables; exports.ocrImageRegions = ocrImageRegions; exports.parsePdfDocument = parsePdfDocument; exports.removeHeaderFooterBlocks = _chunkACQBUQB6cjs.removeHeaderFooterBlocks;
|
|
4976
|
+
//# sourceMappingURL=parser-JVJSUMCA.cjs.map
|