kordoc 4.22.5 → 4.22.7
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/NOTICE +23 -0
- package/README.md +12 -10
- package/dist/{-WFRWBH7T.js → -O7EP5UQ2.js} +12 -12
- package/dist/{chunk-DN55FTJP.js → chunk-5S4UCIGP.js} +2 -2
- package/dist/{chunk-63N6CEJE.js → chunk-5VCZDP2K.js} +2 -2
- package/dist/{chunk-35ZHXEJA.js → chunk-6U2O5LAV.js} +3 -3
- package/dist/{chunk-TOUJCO2P.js → chunk-BFAYABLC.js} +120 -28
- package/dist/chunk-BFAYABLC.js.map +1 -0
- package/dist/{chunk-CW67DAAH.js → chunk-BHSATDA7.js} +12 -3
- package/dist/chunk-BHSATDA7.js.map +1 -0
- package/dist/{chunk-PSORL4PA.js → chunk-BIF35Q4D.js} +21 -16
- package/dist/chunk-BIF35Q4D.js.map +1 -0
- package/dist/{chunk-BHVOY6V4.js → chunk-BYMPPVT3.js} +9 -5
- package/dist/chunk-BYMPPVT3.js.map +1 -0
- package/dist/{chunk-LE4VHWIT.js → chunk-CEOOL37E.js} +4 -4
- package/dist/{chunk-4SUB43EJ.cjs → chunk-CIDWITQN.cjs} +24 -24
- package/dist/chunk-CIDWITQN.cjs.map +1 -0
- package/dist/{chunk-RYKDIUHT.js → chunk-CRMEBMMW.js} +5 -5
- package/dist/{chunk-52HIK4C2.js → chunk-CVKSBUIO.js} +4 -3
- package/dist/chunk-CVKSBUIO.js.map +1 -0
- package/dist/{chunk-U3GUZQ54.js → chunk-D4YBFNWK.js} +35 -75
- package/dist/chunk-D4YBFNWK.js.map +1 -0
- package/dist/{chunk-4TWN7PWJ.js → chunk-DFBGN2TG.js} +2 -2
- package/dist/{chunk-HLPMC7L4.js → chunk-DLAPQKGK.js} +13 -5
- package/dist/chunk-DLAPQKGK.js.map +1 -0
- package/dist/{chunk-C3REGEQO.js → chunk-DXJRDFCT.js} +2 -2
- package/dist/{chunk-C3REGEQO.js.map → chunk-DXJRDFCT.js.map} +1 -1
- package/dist/{chunk-UCK6WGHY.cjs → chunk-F537QK7M.cjs} +3 -3
- package/dist/chunk-F537QK7M.cjs.map +1 -0
- package/dist/{chunk-AS25R4EU.cjs → chunk-FJ45NNLA.cjs} +2 -2
- package/dist/chunk-FJ45NNLA.cjs.map +1 -0
- package/dist/chunk-GS7T56RP.cjs.map +1 -1
- package/dist/chunk-J55UQC5H.cjs.map +1 -1
- package/dist/{chunk-3G3TLZDK.js → chunk-OTCH63U3.js} +2 -2
- package/dist/{chunk-6MQKNB6K.js → chunk-PILIRK7O.js} +3 -3
- package/dist/{chunk-CRSTBATY.js → chunk-QYFBXJGK.js} +2 -2
- package/dist/{chunk-C6B5GWN7.cjs → chunk-R3T4RTQL.cjs} +183 -175
- package/dist/chunk-R3T4RTQL.cjs.map +1 -0
- package/dist/{chunk-SETAYS6P.js → chunk-RHHRVPLL.js} +2 -2
- package/dist/{chunk-YG4GFQB7.cjs → chunk-S34OVRKD.cjs} +125 -33
- package/dist/chunk-S34OVRKD.cjs.map +1 -0
- package/dist/chunk-TK3FDAEE.cjs.map +1 -1
- package/dist/{chunk-N6KXGIIN.cjs → chunk-TN4SSNES.cjs} +3 -3
- package/dist/chunk-TN4SSNES.cjs.map +1 -0
- package/dist/{chunk-3BR7VKWL.js → chunk-V2SJJHJH.js} +112 -24
- package/dist/chunk-V2SJJHJH.js.map +1 -0
- package/dist/{chunk-6MCC2XNB.js → chunk-VYH2ATWU.js} +2 -2
- package/dist/{chunk-2L3Q7REU.js → chunk-WBR62IXV.js} +3 -3
- package/dist/{chunk-3YEL7P4L.js → chunk-YVRARYLN.js} +2 -2
- package/dist/{chunk-T7OZ7X6A.js → chunk-ZNSWN4JM.js} +2 -2
- package/dist/{chunk-CO7O3ZT6.js → chunk-ZW3RY4YT.js} +2 -2
- package/dist/chunks-MPPNEL5A.js +10 -0
- package/dist/cli.js +33 -33
- package/dist/cli.js.map +1 -1
- package/dist/{formula-QZGTF3DZ.cjs → formula-3M6U2J7S.cjs} +9 -9
- package/dist/formula-3M6U2J7S.cjs.map +1 -0
- package/dist/{formula-FSVHUQ6Y.js → formula-EQ2KQA5T.js} +4 -4
- package/dist/{formula-L625ULJP.js → formula-RH55FUJF.js} +3 -3
- package/dist/{image-ocr-AELVAU75.cjs → image-ocr-DP4YTLGN.cjs} +17 -17
- package/dist/image-ocr-DP4YTLGN.cjs.map +1 -0
- package/dist/{image-ocr-QTZNBP5V.js → image-ocr-KIKAO43E.js} +10 -10
- package/dist/{image-ocr-KE3RUS3R.js → image-ocr-LO2GZKA5.js} +6 -6
- package/dist/index.cjs +492 -522
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +4 -2
- package/dist/index.d.ts +4 -2
- package/dist/index.js +41 -71
- package/dist/index.js.map +1 -1
- package/dist/mcp.js +23 -23
- package/dist/{model-bundle-F6TU6ZAV.js → model-bundle-EAQ6LWS5.js} +5 -5
- package/dist/{models-ZHNNVH2W.js → models-ZN6JAI4Q.js} +7 -5
- package/dist/page-range-QHHFTL7X.cjs.map +1 -1
- package/dist/{parse-worker-v2-KQRG3NQO.js → parse-worker-v2-UKFFINUH.js} +14 -14
- package/dist/parse-worker-v2-UKFFINUH.js.map +1 -0
- package/dist/{parser-WNDH2X6N.cjs → parser-CGKXEB3U.cjs} +592 -173
- package/dist/parser-CGKXEB3U.cjs.map +1 -0
- package/dist/{parser-RVMH4PUB.js → parser-DFV3VDWX.js} +452 -33
- package/dist/parser-DFV3VDWX.js.map +1 -0
- package/dist/{parser-WBKVRDPV.js → parser-TJFS44BI.js} +447 -28
- package/dist/parser-TJFS44BI.js.map +1 -0
- package/dist/{pdf-ocr-X5XLGL5J.js → pdf-ocr-CATVQJ2I.js} +6 -6
- package/dist/{pdf-ocr-ZP2CUWSO.js → pdf-ocr-EQXJAKHB.js} +10 -10
- package/dist/pdf-ocr-U5MFMNCW.cjs +31 -0
- package/dist/pdf-ocr-U5MFMNCW.cjs.map +1 -0
- package/dist/{profile-io-B4VSI4LW.js → profile-io-5IG6SSMK.js} +3 -3
- package/dist/{rasterize-Y7NVUVXU.js → rasterize-W4TJFQBT.js} +3 -3
- package/dist/{redact-doc-GIBTFWCO.js → redact-doc-LZ3PY2LX.js} +12 -12
- package/dist/{render-JVCGYRRO.js → render-N2QA335I.js} +7 -7
- package/dist/seal-FYJZMW4G.js +10 -0
- package/dist/{setup-7L7EQPMG.js → setup-5Y2UAWZG.js} +3 -3
- package/dist/visual-VQGE67RU.js +21 -0
- package/dist/{watch-VYMFGX72.js → watch-2MLCRQZQ.js} +13 -13
- package/package.json +1 -1
- package/dist/chunk-3BR7VKWL.js.map +0 -1
- package/dist/chunk-4SUB43EJ.cjs.map +0 -1
- package/dist/chunk-52HIK4C2.js.map +0 -1
- package/dist/chunk-AS25R4EU.cjs.map +0 -1
- package/dist/chunk-BHVOY6V4.js.map +0 -1
- package/dist/chunk-C6B5GWN7.cjs.map +0 -1
- package/dist/chunk-CW67DAAH.js.map +0 -1
- package/dist/chunk-HLPMC7L4.js.map +0 -1
- package/dist/chunk-N6KXGIIN.cjs.map +0 -1
- package/dist/chunk-PSORL4PA.js.map +0 -1
- package/dist/chunk-TOUJCO2P.js.map +0 -1
- package/dist/chunk-U3GUZQ54.js.map +0 -1
- package/dist/chunk-UCK6WGHY.cjs.map +0 -1
- package/dist/chunk-YG4GFQB7.cjs.map +0 -1
- package/dist/chunks-NXABWR6G.js +0 -10
- package/dist/formula-QZGTF3DZ.cjs.map +0 -1
- package/dist/image-ocr-AELVAU75.cjs.map +0 -1
- package/dist/parse-worker-v2-KQRG3NQO.js.map +0 -1
- package/dist/parser-RVMH4PUB.js.map +0 -1
- package/dist/parser-WBKVRDPV.js.map +0 -1
- package/dist/parser-WNDH2X6N.cjs.map +0 -1
- package/dist/pdf-ocr-IOUZTPPH.cjs +0 -31
- package/dist/pdf-ocr-IOUZTPPH.cjs.map +0 -1
- package/dist/seal-WNX2ZJTK.js +0 -10
- package/dist/visual-VPWPXIHN.js +0 -21
- /package/dist/{-WFRWBH7T.js.map → -O7EP5UQ2.js.map} +0 -0
- /package/dist/{chunk-DN55FTJP.js.map → chunk-5S4UCIGP.js.map} +0 -0
- /package/dist/{chunk-63N6CEJE.js.map → chunk-5VCZDP2K.js.map} +0 -0
- /package/dist/{chunk-35ZHXEJA.js.map → chunk-6U2O5LAV.js.map} +0 -0
- /package/dist/{chunk-LE4VHWIT.js.map → chunk-CEOOL37E.js.map} +0 -0
- /package/dist/{chunk-RYKDIUHT.js.map → chunk-CRMEBMMW.js.map} +0 -0
- /package/dist/{chunk-4TWN7PWJ.js.map → chunk-DFBGN2TG.js.map} +0 -0
- /package/dist/{chunk-3G3TLZDK.js.map → chunk-OTCH63U3.js.map} +0 -0
- /package/dist/{chunk-6MQKNB6K.js.map → chunk-PILIRK7O.js.map} +0 -0
- /package/dist/{chunk-CRSTBATY.js.map → chunk-QYFBXJGK.js.map} +0 -0
- /package/dist/{chunk-SETAYS6P.js.map → chunk-RHHRVPLL.js.map} +0 -0
- /package/dist/{chunk-6MCC2XNB.js.map → chunk-VYH2ATWU.js.map} +0 -0
- /package/dist/{chunk-2L3Q7REU.js.map → chunk-WBR62IXV.js.map} +0 -0
- /package/dist/{chunk-3YEL7P4L.js.map → chunk-YVRARYLN.js.map} +0 -0
- /package/dist/{chunk-T7OZ7X6A.js.map → chunk-ZNSWN4JM.js.map} +0 -0
- /package/dist/{chunk-CO7O3ZT6.js.map → chunk-ZW3RY4YT.js.map} +0 -0
- /package/dist/{chunks-NXABWR6G.js.map → chunks-MPPNEL5A.js.map} +0 -0
- /package/dist/{formula-FSVHUQ6Y.js.map → formula-EQ2KQA5T.js.map} +0 -0
- /package/dist/{formula-L625ULJP.js.map → formula-RH55FUJF.js.map} +0 -0
- /package/dist/{image-ocr-QTZNBP5V.js.map → image-ocr-KIKAO43E.js.map} +0 -0
- /package/dist/{image-ocr-KE3RUS3R.js.map → image-ocr-LO2GZKA5.js.map} +0 -0
- /package/dist/{model-bundle-F6TU6ZAV.js.map → model-bundle-EAQ6LWS5.js.map} +0 -0
- /package/dist/{models-ZHNNVH2W.js.map → models-ZN6JAI4Q.js.map} +0 -0
- /package/dist/{pdf-ocr-X5XLGL5J.js.map → pdf-ocr-CATVQJ2I.js.map} +0 -0
- /package/dist/{pdf-ocr-ZP2CUWSO.js.map → pdf-ocr-EQXJAKHB.js.map} +0 -0
- /package/dist/{profile-io-B4VSI4LW.js.map → profile-io-5IG6SSMK.js.map} +0 -0
- /package/dist/{rasterize-Y7NVUVXU.js.map → rasterize-W4TJFQBT.js.map} +0 -0
- /package/dist/{redact-doc-GIBTFWCO.js.map → redact-doc-LZ3PY2LX.js.map} +0 -0
- /package/dist/{render-JVCGYRRO.js.map → render-N2QA335I.js.map} +0 -0
- /package/dist/{seal-WNX2ZJTK.js.map → seal-FYJZMW4G.js.map} +0 -0
- /package/dist/{setup-7L7EQPMG.js.map → setup-5Y2UAWZG.js.map} +0 -0
- /package/dist/{visual-VPWPXIHN.js.map → visual-VQGE67RU.js.map} +0 -0
- /package/dist/{watch-VYMFGX72.js.map → watch-2MLCRQZQ.js.map} +0 -0
|
@@ -1,7 +1,7 @@
|
|
|
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
3
|
|
|
4
|
-
var
|
|
4
|
+
var _chunkTN4SSNEScjs = require('./chunk-TN4SSNES.cjs');
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
|
|
@@ -61,7 +61,7 @@ var _chunkJ55UQC5Hcjs = require('./chunk-J55UQC5H.cjs');
|
|
|
61
61
|
|
|
62
62
|
|
|
63
63
|
|
|
64
|
-
var
|
|
64
|
+
var _chunkR3T4RTQLcjs = require('./chunk-R3T4RTQL.cjs');
|
|
65
65
|
|
|
66
66
|
|
|
67
67
|
|
|
@@ -76,12 +76,14 @@ var _chunkC6B5GWN7cjs = require('./chunk-C6B5GWN7.cjs');
|
|
|
76
76
|
|
|
77
77
|
|
|
78
78
|
|
|
79
|
-
var _chunkYG4GFQB7cjs = require('./chunk-YG4GFQB7.cjs');
|
|
80
|
-
require('./chunk-UCK6WGHY.cjs');
|
|
81
79
|
|
|
82
80
|
|
|
81
|
+
var _chunkS34OVRKDcjs = require('./chunk-S34OVRKD.cjs');
|
|
82
|
+
require('./chunk-F537QK7M.cjs');
|
|
83
83
|
|
|
84
|
-
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
var _chunkFJ45NNLAcjs = require('./chunk-FJ45NNLA.cjs');
|
|
85
87
|
|
|
86
88
|
|
|
87
89
|
var _chunkGS7T56RPcjs = require('./chunk-GS7T56RP.cjs');
|
|
@@ -218,7 +220,7 @@ async function extractPageImages(page, fnArray, argsArray, pageNumber, state, wa
|
|
|
218
220
|
const filename = `image_${String(state.imageIndex).padStart(3, "0")}.png`;
|
|
219
221
|
state.seen.set(hash, filename);
|
|
220
222
|
if (withBytes) {
|
|
221
|
-
const png =
|
|
223
|
+
const png = _chunkTN4SSNEScjs.encodePng.call(void 0, w, h, rgba);
|
|
222
224
|
state.totalBytes += png.length;
|
|
223
225
|
images.push({ filename, data: png, mimeType: "image/png" });
|
|
224
226
|
}
|
|
@@ -614,13 +616,13 @@ function ocrVectorOps(opList, paths) {
|
|
|
614
616
|
|
|
615
617
|
// src/pdf/split-row-pattern.ts
|
|
616
618
|
var textOf = (cell) => cell.text.replace(/<\/?u>|~~/g, "").trim();
|
|
617
|
-
var plain = (cell) => !_optionalChain([cell, 'access', _9 => _9.blocks, 'optionalAccess', _10 => _10.length]) && !
|
|
619
|
+
var plain = (cell) => !_optionalChain([cell, 'access', _9 => _9.blocks, 'optionalAccess', _10 => _10.length]) && !_chunkR3T4RTQLcjs.IMAGE_CELLS.has(cell);
|
|
618
620
|
var labelsOf = (cell) => {
|
|
619
621
|
const labels = textOf(cell).split("\n").map((s) => s.trim()).filter(Boolean);
|
|
620
622
|
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;
|
|
621
623
|
};
|
|
622
624
|
var alignedLabels = (label, value, count) => {
|
|
623
|
-
const L =
|
|
625
|
+
const L = _chunkR3T4RTQLcjs.CELL_LINES.get(label), V = _chunkR3T4RTQLcjs.CELL_LINES.get(value);
|
|
624
626
|
let next = 0;
|
|
625
627
|
return !!L && !!V && L.length === count && V.length >= count && Math.abs(L[0].y - V[0].y) <= 1 && L.every((l) => {
|
|
626
628
|
while (next < V.length && Math.abs(l.y - V[next].y) > 1) next++;
|
|
@@ -628,7 +630,7 @@ var alignedLabels = (label, value, count) => {
|
|
|
628
630
|
});
|
|
629
631
|
};
|
|
630
632
|
function partialAlignedLabelCells(table, owner, first) {
|
|
631
|
-
const pageOf = (a) => _nullishCoalesce(
|
|
633
|
+
const pageOf = (a) => _nullishCoalesce(_chunkS34OVRKDcjs.CELL_PAGES.get(_nullishCoalesce(a.cell, () => ( table.cells[a.r][a.c]))), () => ( (a.r < first ? -1 : -2)));
|
|
632
634
|
const pairs = [];
|
|
633
635
|
let carried = false;
|
|
634
636
|
for (let c = 0; c < table.cols; ) {
|
|
@@ -651,10 +653,10 @@ function partialAlignedLabelCells(table, owner, first) {
|
|
|
651
653
|
const keyed = pairs.filter((p) => labelsOf(p.upper) && labelsOf(p.lower));
|
|
652
654
|
if (keyed.length !== 1) return;
|
|
653
655
|
const label = keyed[0], value = pairs.find((p) => p.c === label.c + label.cs), context = pairs.find((p) => p.c + p.cs === label.c);
|
|
654
|
-
if (!value || !context || value === context || textOf(context.upper).replace(/\s+/g, "") === textOf(context.lower).replace(/\s+/g, "") || !_optionalChain([
|
|
656
|
+
if (!value || !context || value === context || textOf(context.upper).replace(/\s+/g, "") === textOf(context.lower).replace(/\s+/g, "") || !_optionalChain([_chunkS34OVRKDcjs.CELL_EDGES, 'access', _21 => _21.get, 'call', _22 => _22(context.upper), 'optionalAccess', _23 => _23.b]) || !_optionalChain([_chunkS34OVRKDcjs.CELL_EDGES, 'access', _24 => _24.get, 'call', _25 => _25(context.lower), 'optionalAccess', _26 => _26.t])) return;
|
|
655
657
|
const U = labelsOf(label.upper), D = labelsOf(label.lower), sequence = [...U, ...D];
|
|
656
658
|
if (D.length < 2 || sequence.length < 3 || new Set(sequence).size !== sequence.length || !alignedLabels(label.upper, value.upper, U.length)) return;
|
|
657
|
-
const L =
|
|
659
|
+
const L = _chunkR3T4RTQLcjs.CELL_LINES.get(label.lower), V = _chunkR3T4RTQLcjs.CELL_LINES.get(value.lower);
|
|
658
660
|
if (!L || !V || L.length !== D.length) return;
|
|
659
661
|
let next = V.findIndex((v) => Math.abs(v.y - L[0].y) <= 1);
|
|
660
662
|
if (next <= 0 || !V.slice(0, next).every((v) => v.y > L[0].y + 1) || !L.every((l) => {
|
|
@@ -674,14 +676,14 @@ function partialAlignedLabelCells(table, owner, first) {
|
|
|
674
676
|
continue;
|
|
675
677
|
}
|
|
676
678
|
if (list.length < 3 || new Set(list).size !== list.length) continue;
|
|
677
|
-
const visible = _nullishCoalesce(_optionalChain([
|
|
679
|
+
const visible = _nullishCoalesce(_optionalChain([_chunkR3T4RTQLcjs.CELL_LINES, 'access', _31 => _31.get, 'call', _32 => _32(lc), 'optionalAccess', _33 => _33.length]), () => ( 0)), values = _chunkR3T4RTQLcjs.CELL_LINES.get(vc);
|
|
678
680
|
if (visible < 3 || visible > list.length || !values || !alignedLabels(lc, vc, visible)) continue;
|
|
679
681
|
const top = Math.max(...values.map((v2) => v2.y)), bottom = Math.min(...values.map((v2) => v2.y));
|
|
680
682
|
const contexts = [];
|
|
681
683
|
for (let rr = r; rr < r + l.rs && rr < table.rows; rr++) {
|
|
682
684
|
const a = _optionalChain([owner, 'access', _34 => _34[rr], 'optionalAccess', _35 => _35[context.c]]), cell = a ? table.cells[a.r][a.c] : void 0;
|
|
683
685
|
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;
|
|
684
|
-
const lines =
|
|
686
|
+
const lines = _chunkR3T4RTQLcjs.CELL_LINES.get(cell);
|
|
685
687
|
if (!_optionalChain([lines, 'optionalAccess', _36 => _36.length]) || lines.some((line) => line.y > top + 1 || line.y < bottom - 1)) break;
|
|
686
688
|
contexts.push(textOf(cell).replace(/\s+/g, ""));
|
|
687
689
|
}
|
|
@@ -983,7 +985,7 @@ function rowStarts(t) {
|
|
|
983
985
|
}
|
|
984
986
|
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));
|
|
985
987
|
function cellPage(cell) {
|
|
986
|
-
const p =
|
|
988
|
+
const p = _chunkS34OVRKDcjs.CELL_PAGES.get(cell);
|
|
987
989
|
if (p !== void 0 || !_optionalChain([cell, 'access', _103 => _103.blocks, 'optionalAccess', _104 => _104.length]) || cell.blocks.some((b) => b.pageNumber === void 0)) return p;
|
|
988
990
|
return Math.min(...cell.blocks.map((b) => b.pageNumber));
|
|
989
991
|
}
|
|
@@ -1012,7 +1014,7 @@ function markJoinedPages(table, prev, curr) {
|
|
|
1012
1014
|
rows.forEach((starts, r) => {
|
|
1013
1015
|
const page2 = r < pt.rows ? pp[r] : cp[r - off];
|
|
1014
1016
|
for (const { cell } of starts) {
|
|
1015
|
-
if (page2 !== void 0 && page2 !== prev.pageNumber)
|
|
1017
|
+
if (page2 !== void 0 && page2 !== prev.pageNumber) _chunkS34OVRKDcjs.CELL_PAGES.set(cell, page2);
|
|
1016
1018
|
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))]);
|
|
1017
1019
|
if (src) setSplits(cell, relocate(src.cell, cell));
|
|
1018
1020
|
}
|
|
@@ -1072,8 +1074,8 @@ function splitCrossPageRows(t, pageNumber) {
|
|
|
1072
1074
|
if (!splits.length) continue;
|
|
1073
1075
|
const clone = (cell, patch) => {
|
|
1074
1076
|
const out = { ...cell, ...patch };
|
|
1075
|
-
const p =
|
|
1076
|
-
if (p !== void 0)
|
|
1077
|
+
const p = _chunkS34OVRKDcjs.CELL_PAGES.get(cell);
|
|
1078
|
+
if (p !== void 0) _chunkS34OVRKDcjs.CELL_PAGES.set(out, p);
|
|
1077
1079
|
if (!("text" in patch) && CELL_SPLITS.has(cell)) CELL_SPLITS.set(out, CELL_SPLITS.get(cell));
|
|
1078
1080
|
return out;
|
|
1079
1081
|
};
|
|
@@ -1084,7 +1086,7 @@ function splitCrossPageRows(t, pageNumber) {
|
|
|
1084
1086
|
for (const { cell, c, split } of splits) {
|
|
1085
1087
|
cells[r][c] = clone(cell, { ...split.head, rowSpan: cut - r });
|
|
1086
1088
|
const tail = { ...cell, ...split.tail, rowSpan: r + cell.rowSpan - cut };
|
|
1087
|
-
|
|
1089
|
+
_chunkS34OVRKDcjs.CELL_PAGES.set(tail, split.page);
|
|
1088
1090
|
setSplits(tail, split.rest);
|
|
1089
1091
|
cells[cut][c] = tail;
|
|
1090
1092
|
}
|
|
@@ -1094,7 +1096,7 @@ function splitCrossPageRows(t, pageNumber) {
|
|
|
1094
1096
|
for (const { cell, c, split } of splits) {
|
|
1095
1097
|
cells[r][c] = clone(cell, split.head);
|
|
1096
1098
|
const tail = { ...cell, ...split.tail, rowSpan: 1 };
|
|
1097
|
-
|
|
1099
|
+
_chunkS34OVRKDcjs.CELL_PAGES.set(tail, split.page);
|
|
1098
1100
|
setSplits(tail, split.rest);
|
|
1099
1101
|
row[c] = tail;
|
|
1100
1102
|
}
|
|
@@ -1213,19 +1215,19 @@ function joinSplitParts(prev, pcx, curr, ccx, dx = 0, prevBottom, lex) {
|
|
|
1213
1215
|
if (r + dr < rows) owner[r + dr][dc] = placed;
|
|
1214
1216
|
}
|
|
1215
1217
|
grid[r][c1] = { ...a.cell, colSpan: c2 - c1, rowSpan: a.rs };
|
|
1216
|
-
const lines =
|
|
1217
|
-
if (lines)
|
|
1218
|
-
if (
|
|
1219
|
-
const edges =
|
|
1218
|
+
const lines = _chunkR3T4RTQLcjs.CELL_LINES.get(a.cell);
|
|
1219
|
+
if (lines) _chunkR3T4RTQLcjs.CELL_LINES.set(grid[r][c1], shift ? lines.map((l) => ({ ...l, l: l.l + shift, r: l.r + shift })) : lines);
|
|
1220
|
+
if (_chunkR3T4RTQLcjs.IMAGE_CELLS.has(a.cell)) _chunkR3T4RTQLcjs.IMAGE_CELLS.add(grid[r][c1]);
|
|
1221
|
+
const edges = _chunkS34OVRKDcjs.CELL_EDGES.get(a.cell);
|
|
1220
1222
|
if (edges) {
|
|
1221
|
-
|
|
1223
|
+
_chunkS34OVRKDcjs.CELL_EDGES.set(grid[r][c1], edges);
|
|
1222
1224
|
edged = true;
|
|
1223
1225
|
}
|
|
1224
1226
|
return true;
|
|
1225
1227
|
};
|
|
1226
|
-
for (const a of pa) if (!
|
|
1228
|
+
for (const a of pa) if (!_chunkR3T4RTQLcjs.FILLER_CELLS.has(a.cell) && !place(a, pcx, 0)) return null;
|
|
1227
1229
|
for (const a of ca) {
|
|
1228
|
-
if (a.r < skip ||
|
|
1230
|
+
if (a.r < skip || _chunkR3T4RTQLcjs.FILLER_CELLS.has(a.cell)) continue;
|
|
1229
1231
|
if (!place(a, cxU, prev.rows - skip, dx)) return null;
|
|
1230
1232
|
}
|
|
1231
1233
|
const first = prev.rows;
|
|
@@ -1249,9 +1251,9 @@ function joinSplitParts(prev, pcx, curr, ccx, dx = 0, prevBottom, lex) {
|
|
|
1249
1251
|
const grown = { ...above, rs: newRs };
|
|
1250
1252
|
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;
|
|
1251
1253
|
}
|
|
1252
|
-
for (let r = 0; r < rows; r++) for (let c = 0; c < cols; c++) if (owner[r][c] === null)
|
|
1254
|
+
for (let r = 0; r < rows; r++) for (let c = 0; c < cols; c++) if (owner[r][c] === null) _chunkR3T4RTQLcjs.FILLER_CELLS.add(grid[r][c]);
|
|
1253
1255
|
if (edged) {
|
|
1254
|
-
for (let r = 0; r < rows; r++) for (let c = 0; c < cols; c++) if (owner[r][c] === null)
|
|
1256
|
+
for (let r = 0; r < rows; r++) for (let c = 0; c < cols; c++) if (owner[r][c] === null) _chunkS34OVRKDcjs.CELL_EDGES.set(grid[r][c], _chunkR3T4RTQLcjs.NO_EDGES);
|
|
1255
1257
|
}
|
|
1256
1258
|
for (let c = 0; c < cols && U[c + 1] <= pcx[0] + PART_COL_TOL; c++) {
|
|
1257
1259
|
let r = prev.rows;
|
|
@@ -1260,7 +1262,7 @@ function joinSplitParts(prev, pcx, curr, ccx, dx = 0, prevBottom, lex) {
|
|
|
1260
1262
|
for (let rr = 0; rr < r; rr++) owner[rr][c] = through;
|
|
1261
1263
|
}
|
|
1262
1264
|
const table = { rows, cols, cells: grid, hasHeader: prev.hasHeader, ...prev.caption ? { caption: prev.caption } : {} };
|
|
1263
|
-
const pr =
|
|
1265
|
+
const pr = _chunkR3T4RTQLcjs.ROW_RULES.get(prev), cr = _chunkR3T4RTQLcjs.ROW_RULES.get(curr);
|
|
1264
1266
|
const shifted = dx !== 0;
|
|
1265
1267
|
const cut = {
|
|
1266
1268
|
open: !!pr && !!cr && !pr.bottom && !cr.top && pr.innerOpen + cr.innerOpen === 0 && pr.innerRuled + cr.innerRuled > 0,
|
|
@@ -1268,13 +1270,13 @@ function joinSplitParts(prev, pcx, curr, ccx, dx = 0, prevBottom, lex) {
|
|
|
1268
1270
|
list: !shifted ? "any" : skip > 0 && ca.filter((a) => a.r < skip && a.cell.text.trim()).length < 2 ? "none" : "multi"
|
|
1269
1271
|
};
|
|
1270
1272
|
let partial = !skip && cols === prev.cols && cols === curr.cols && cut.ruled && prevBottom !== void 0 ? partialAlignedLabelCells(table, owner, first) : void 0;
|
|
1271
|
-
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]) ||
|
|
1273
|
+
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]) || _chunkR3T4RTQLcjs.startsNewItem.call(void 0, partial.value.upper.text, partial.value.lower.text))) partial = void 0;
|
|
1272
1274
|
const selected = partial ? /* @__PURE__ */ new Set([partial.label.c, partial.value.c]) : void 0;
|
|
1273
1275
|
let split = !selected && rows > prev.rows && mergeSplitRow(table, owner, prev.rows, U, false, cut);
|
|
1274
1276
|
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 });
|
|
1275
1277
|
if (pr && cr) {
|
|
1276
1278
|
const cutRuled = pr.bottom || cr.top;
|
|
1277
|
-
|
|
1279
|
+
_chunkR3T4RTQLcjs.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) });
|
|
1278
1280
|
}
|
|
1279
1281
|
return { table, colXs: U, split, header: ca.filter((a) => a.r < skip && a.cell.text.trim()).length >= 2 };
|
|
1280
1282
|
}
|
|
@@ -1336,18 +1338,18 @@ function mergeStraddlingCells(table, owner, first, prevBottom, lex, colXs, selec
|
|
|
1336
1338
|
if (!d || d === u || u.r + u.rs - 1 !== last || d.r !== first || d.c !== u.c || d.cs !== u.cs) continue;
|
|
1337
1339
|
const a = table.cells[u.r][u.c], b = table.cells[first][d.c];
|
|
1338
1340
|
if (selected && !selected.has(u.c)) continue;
|
|
1339
|
-
const flowsOn = itemBreak && straddles && !!colXs && hasContent(a) && hasContent(b) && longLastLine(a) && !
|
|
1340
|
-
const openSeam = hasContent(a) && hasContent(b) &&
|
|
1341
|
+
const flowsOn = itemBreak && straddles && !!colXs && hasContent(a) && hasContent(b) && longLastLine(a) && !_chunkR3T4RTQLcjs.startsNewItem.call(void 0, a.text, b.text) && continuesAcross(a, b, colXs[u.c], colXs[u.c + u.cs]);
|
|
1342
|
+
const openSeam = hasContent(a) && hasContent(b) && _chunkR3T4RTQLcjs.hasOpenCellSeam.call(void 0, a, b) && !owner.some((row, r) => {
|
|
1341
1343
|
if (!r || r === first) return false;
|
|
1342
1344
|
const up = owner[r - 1][u.c], down = row[u.c];
|
|
1343
1345
|
if (!up || !down || up === down || up.c !== u.c || down.c !== u.c || up.cs !== u.cs || down.cs !== u.cs) return false;
|
|
1344
|
-
const ue =
|
|
1346
|
+
const ue = _chunkS34OVRKDcjs.CELL_EDGES.get(table.cells[up.r][up.c]), de = _chunkS34OVRKDcjs.CELL_EDGES.get(table.cells[down.r][down.c]);
|
|
1345
1347
|
return !!ue && !!de && !ue.b && !de.t;
|
|
1346
1348
|
});
|
|
1347
1349
|
if (!selected && !openSeam && !flowsOn && !crossed.has(shape(u, d)) && !(u.rs >= 2 && u.c + u.cs <= firstNew && hasContent(a) && !hasContent(b))) {
|
|
1348
1350
|
if (!straddles && !midWord) continue;
|
|
1349
1351
|
if (u.r >= last && d.rs < 2) continue;
|
|
1350
|
-
const U =
|
|
1352
|
+
const U = _chunkR3T4RTQLcjs.CELL_LINES.get(a);
|
|
1351
1353
|
if (!_optionalChain([U, 'optionalAccess', _134 => _134.length]) || !hasContent(b)) continue;
|
|
1352
1354
|
if (!(straddles && filledToBottom(U, prevBottom) && clauseContinues(a, b))) {
|
|
1353
1355
|
if (U.length > STRADDLE_MAX_LINES) continue;
|
|
@@ -1365,7 +1367,7 @@ function mergeStraddlingCells(table, owner, first, prevBottom, lex, colXs, selec
|
|
|
1365
1367
|
return merged;
|
|
1366
1368
|
}
|
|
1367
1369
|
function longLastLine(c) {
|
|
1368
|
-
const L =
|
|
1370
|
+
const L = _chunkR3T4RTQLcjs.CELL_LINES.get(c), l = _optionalChain([L, 'optionalAccess', _135 => _135[L.length - 1]]);
|
|
1369
1371
|
return !!l && l.r - l.l >= 6 * (l.h || 10);
|
|
1370
1372
|
}
|
|
1371
1373
|
function filledToBottom(U, bottom) {
|
|
@@ -1398,7 +1400,7 @@ function nextItemHead(prev, next) {
|
|
|
1398
1400
|
return false;
|
|
1399
1401
|
}
|
|
1400
1402
|
function continuesAcross(u, d, x1, x2) {
|
|
1401
|
-
const U =
|
|
1403
|
+
const U = _chunkR3T4RTQLcjs.CELL_LINES.get(u), D = _chunkR3T4RTQLcjs.CELL_LINES.get(d);
|
|
1402
1404
|
if (!_optionalChain([U, 'optionalAccess', _136 => _136.length]) || !_optionalChain([D, 'optionalAccess', _137 => _137.length])) return false;
|
|
1403
1405
|
const last = U[U.length - 1];
|
|
1404
1406
|
const fs = last.h || 10;
|
|
@@ -1416,7 +1418,7 @@ function continuesAcross(u, d, x1, x2) {
|
|
|
1416
1418
|
if (U.length === 1 && x2 - last.r > Math.max(FULL_LINE_EDGE_MIN, SINGLE_LINE_WORD_GAP * fs)) return false;
|
|
1417
1419
|
const indented = last.l - minL >= HANGING_MIN * fs;
|
|
1418
1420
|
if (last.r - last.l < FULL_LINE_MIN_FRAC * (indented ? x2 - last.l : x2 - x1)) return false;
|
|
1419
|
-
const newItem =
|
|
1421
|
+
const newItem = _chunkR3T4RTQLcjs.startsNewItem.call(void 0, u.text, d.text);
|
|
1420
1422
|
const all = D.length ? U.concat(D) : U;
|
|
1421
1423
|
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));
|
|
1422
1424
|
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;
|
|
@@ -1433,10 +1435,10 @@ function outlineContinues(u, d) {
|
|
|
1433
1435
|
return U.length >= 2 && D.length >= 1 && U.some((l) => OUTLINE_HEAD.test(l)) && OUTLINE_ITEM.test(D[0]);
|
|
1434
1436
|
}
|
|
1435
1437
|
function lineEnded(c, x1, x2, next) {
|
|
1436
|
-
const L =
|
|
1438
|
+
const L = _chunkR3T4RTQLcjs.CELL_LINES.get(c);
|
|
1437
1439
|
if (!L || L.length !== 1) return false;
|
|
1438
1440
|
const l = L[0], h = l.h || 10;
|
|
1439
|
-
const d0 = next ? _optionalChain([
|
|
1441
|
+
const d0 = next ? _optionalChain([_chunkR3T4RTQLcjs.CELL_LINES, 'access', _138 => _138.get, 'call', _139 => _139(next), 'optionalAccess', _140 => _140[0]]) : void 0;
|
|
1440
1442
|
if (d0 && d0.l - l.l >= HANGING_MIN * h) return false;
|
|
1441
1443
|
return x2 - l.r - (l.l - x1) >= Math.max(LABEL_ROOM, firstWordUnits(_nullishCoalesce(_optionalChain([next, 'optionalAccess', _141 => _141.text]), () => ( "")))) * h;
|
|
1442
1444
|
}
|
|
@@ -1447,15 +1449,15 @@ function firstWordUnits(text) {
|
|
|
1447
1449
|
return units;
|
|
1448
1450
|
}
|
|
1449
1451
|
function appendCell(a, b) {
|
|
1450
|
-
if (
|
|
1452
|
+
if (_chunkR3T4RTQLcjs.IMAGE_CELLS.has(b)) _chunkR3T4RTQLcjs.IMAGE_CELLS.add(a);
|
|
1451
1453
|
if (_optionalChain([a, 'access', _142 => _142.blocks, 'optionalAccess', _143 => _143.length]) || _optionalChain([b, 'access', _144 => _144.blocks, 'optionalAccess', _145 => _145.length])) {
|
|
1452
1454
|
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 }));
|
|
1453
1455
|
a.blocks = [...asBlocks(a), ...asBlocks(b)];
|
|
1454
1456
|
}
|
|
1455
1457
|
if (b.text.trim()) a.text = a.text.trim() ? a.text + "\n" + b.text : b.text;
|
|
1456
|
-
|
|
1458
|
+
_chunkR3T4RTQLcjs.joinCellEdges.call(void 0, a, b);
|
|
1457
1459
|
}
|
|
1458
|
-
var hasContent = (cell) => !!cell.text.trim() || !!_optionalChain([cell, 'access', _148 => _148.blocks, 'optionalAccess', _149 => _149.length]) ||
|
|
1460
|
+
var hasContent = (cell) => !!cell.text.trim() || !!_optionalChain([cell, 'access', _148 => _148.blocks, 'optionalAccess', _149 => _149.length]) || _chunkR3T4RTQLcjs.IMAGE_CELLS.has(cell);
|
|
1459
1461
|
var CLAUSE_OPEN_ENDING = /(?:하는|되는|하고|하며|하여|되어|되고|되며|이며|으며|어야|아야|여야)$/;
|
|
1460
1462
|
var batchim = (ch) => {
|
|
1461
1463
|
const k = ch.charCodeAt(0) - 44032;
|
|
@@ -1463,7 +1465,7 @@ var batchim = (ch) => {
|
|
|
1463
1465
|
};
|
|
1464
1466
|
function clauseContinues(u, d) {
|
|
1465
1467
|
const tail = _nullishCoalesce(flowText(u.text).trim().split(/\s+/).pop(), () => ( "")), head = flowText(d.text).trim();
|
|
1466
|
-
if (!/^[가-힣]{2,}$/.test(tail) || !/^[가-힣]/.test(head) ||
|
|
1468
|
+
if (!/^[가-힣]{2,}$/.test(tail) || !/^[가-힣]/.test(head) || _chunkR3T4RTQLcjs.startsNewItem.call(void 0, u.text, head)) return false;
|
|
1467
1469
|
const last = tail[tail.length - 1], before = tail[tail.length - 2];
|
|
1468
1470
|
return last === "\uC744" && batchim(before) || last === "\uB97C" && !batchim(before) || CLAUSE_OPEN_ENDING.test(tail);
|
|
1469
1471
|
}
|
|
@@ -1471,8 +1473,8 @@ function quantityContinues(u, d) {
|
|
|
1471
1473
|
return /\d[\d,.]*\s*(?:%|[가-힣]{1,2})?$/.test(flowText(u.text).trim()) && /^(?:미만|이상|이하|초과)(?![가-힣])/.test(flowText(d.text).trim());
|
|
1472
1474
|
}
|
|
1473
1475
|
function wordOverflows(u, d, x1, x2) {
|
|
1474
|
-
const U =
|
|
1475
|
-
if (!_optionalChain([U, 'optionalAccess', _150 => _150.length]) ||
|
|
1476
|
+
const U = _chunkR3T4RTQLcjs.CELL_LINES.get(u);
|
|
1477
|
+
if (!_optionalChain([U, 'optionalAccess', _150 => _150.length]) || _chunkR3T4RTQLcjs.startsNewItem.call(void 0, u.text, d.text)) return false;
|
|
1476
1478
|
const last = U[U.length - 1], units = firstWordUnits(d.text);
|
|
1477
1479
|
return units > 0 && last.r - last.l + units * (last.h || 10) > x2 - x1;
|
|
1478
1480
|
}
|
|
@@ -1530,7 +1532,7 @@ function mergeSplitRow(table, owner, first, colXs, textOnly = false, cut = NO_CU
|
|
|
1530
1532
|
if (!carriedSplit) {
|
|
1531
1533
|
const norm = (c) => flowText(c.text).replace(/\s+/g, "");
|
|
1532
1534
|
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;
|
|
1533
|
-
const oneLine = (c) => _optionalChain([
|
|
1535
|
+
const oneLine = (c) => _optionalChain([_chunkR3T4RTQLcjs.CELL_LINES, 'access', _152 => _152.get, 'call', _153 => _153(c), 'optionalAccess', _154 => _154.length]) === 1;
|
|
1534
1536
|
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;
|
|
1535
1537
|
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));
|
|
1536
1538
|
if (!(cut.open && !newCell)) {
|
|
@@ -1622,19 +1624,19 @@ function mergeCrossPageTables(blocks, pageHeights, lex) {
|
|
|
1622
1624
|
placeJoined(blocks, i, j, joined);
|
|
1623
1625
|
continue;
|
|
1624
1626
|
}
|
|
1625
|
-
if (
|
|
1627
|
+
if (_chunkR3T4RTQLcjs.EMPTY_PARTS.has(curr.table)) {
|
|
1626
1628
|
blocks.splice(j, 1);
|
|
1627
1629
|
i++;
|
|
1628
1630
|
continue;
|
|
1629
1631
|
}
|
|
1630
1632
|
if (joined === null) continue;
|
|
1631
|
-
if (prev.table.cols !== curr.table.cols || prev.table.renderAsTable !== curr.table.renderAsTable ||
|
|
1633
|
+
if (prev.table.cols !== curr.table.cols || prev.table.renderAsTable !== curr.table.renderAsTable || _chunkR3T4RTQLcjs.EMPTY_PARTS.has(prev.table)) continue;
|
|
1632
1634
|
const width = Math.max(prev.bbox.width, curr.bbox.width, 1);
|
|
1633
1635
|
const leftDiff = Math.abs(prev.bbox.x - curr.bbox.x);
|
|
1634
1636
|
const rightDiff = Math.abs(prev.bbox.x + prev.bbox.width - (curr.bbox.x + curr.bbox.width));
|
|
1635
1637
|
if (leftDiff > width * NEIGHBOR_TABLE_EPSILON || rightDiff > width * NEIGHBOR_TABLE_EPSILON) continue;
|
|
1636
|
-
const px =
|
|
1637
|
-
if (px && cx && !shiftedSame(px, cx, !
|
|
1638
|
+
const px = _chunkR3T4RTQLcjs.TABLE_COLXS.get(prev.table), cx = _chunkR3T4RTQLcjs.TABLE_COLXS.get(curr.table);
|
|
1639
|
+
if (px && cx && !shiftedSame(px, cx, !_chunkR3T4RTQLcjs.CLIP_TABLES.has(prev.table) && !_chunkR3T4RTQLcjs.CLIP_TABLES.has(curr.table))) continue;
|
|
1638
1640
|
if (!rowTextsEqual(prev.table.cells[0], curr.table.cells[0]) && sameHeadShape(prev.table.cells[0], curr.table.cells[0])) continue;
|
|
1639
1641
|
let currCells = curr.table.cells;
|
|
1640
1642
|
const headRows = repeatedHeaderRows(prev.table, curr.table);
|
|
@@ -1645,16 +1647,16 @@ function mergeCrossPageTables(blocks, pageHeights, lex) {
|
|
|
1645
1647
|
blocks.splice(j, 1);
|
|
1646
1648
|
continue;
|
|
1647
1649
|
}
|
|
1648
|
-
if (px && cx && !
|
|
1650
|
+
if (px && cx && !_chunkR3T4RTQLcjs.CLIP_TABLES.has(prev.table) && !_chunkR3T4RTQLcjs.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 && _chunkR3T4RTQLcjs.CELL_LINES.has(c))) {
|
|
1649
1651
|
const dx = px[0] - cx[0];
|
|
1650
1652
|
const part = joinSplitParts(prev.table, px, curr.table, cx.map((x) => x + dx), dx, void 0, lex);
|
|
1651
1653
|
if (_optionalChain([part, 'optionalAccess', _175 => _175.split]) && part.table.rows === prev.table.rows + currCells.length - 1) {
|
|
1652
1654
|
const last = prev.table.rows - 1;
|
|
1653
1655
|
for (let c = 0; c < part.table.cols; c++) {
|
|
1654
|
-
const U =
|
|
1655
|
-
|
|
1656
|
+
const U = _chunkR3T4RTQLcjs.CELL_LINES.get(prev.table.cells[last][c]), D = _chunkR3T4RTQLcjs.CELL_LINES.get(currCells[0][c]);
|
|
1657
|
+
_chunkR3T4RTQLcjs.CELL_LINES.set(part.table.cells[last][c], U.concat(D.map((l) => ({ ...l, l: l.l + dx, r: l.r + dx }))));
|
|
1656
1658
|
}
|
|
1657
|
-
|
|
1659
|
+
_chunkR3T4RTQLcjs.TABLE_COLXS.set(part.table, part.colXs);
|
|
1658
1660
|
placeJoined(blocks, i, j, part.table);
|
|
1659
1661
|
continue;
|
|
1660
1662
|
}
|
|
@@ -1667,20 +1669,20 @@ function mergeCrossPageTables(blocks, pageHeights, lex) {
|
|
|
1667
1669
|
caption: prev.table.caption,
|
|
1668
1670
|
...prev.table.renderAsTable ? { renderAsTable: true } : {}
|
|
1669
1671
|
};
|
|
1670
|
-
if (_nullishCoalesce(px, () => ( cx)))
|
|
1671
|
-
if (
|
|
1672
|
+
if (_nullishCoalesce(px, () => ( cx))) _chunkR3T4RTQLcjs.TABLE_COLXS.set(merged, _nullishCoalesce(px, () => ( cx)));
|
|
1673
|
+
if (_chunkR3T4RTQLcjs.CLIP_TABLES.has(prev.table) || _chunkR3T4RTQLcjs.CLIP_TABLES.has(curr.table)) _chunkR3T4RTQLcjs.CLIP_TABLES.add(merged);
|
|
1672
1674
|
placeJoined(blocks, i, j, merged);
|
|
1673
1675
|
}
|
|
1674
1676
|
for (let i = blocks.length - 1; i >= 0; i--) {
|
|
1675
1677
|
const t = blocks[i].table;
|
|
1676
|
-
if (blocks[i].type === "table" && t &&
|
|
1678
|
+
if (blocks[i].type === "table" && t && _chunkR3T4RTQLcjs.EMPTY_PARTS.has(t)) blocks.splice(i, 1);
|
|
1677
1679
|
}
|
|
1678
1680
|
}
|
|
1679
1681
|
function mergeColumnFlow(blocks, pageHeights, lex) {
|
|
1680
1682
|
if (!pageHeights) return;
|
|
1681
1683
|
for (let i = 0; i < blocks.length; i++) {
|
|
1682
1684
|
const L = blocks[i];
|
|
1683
|
-
if (L.type !== "table" || !L.table || !L.bbox || !L.pageNumber || !
|
|
1685
|
+
if (L.type !== "table" || !L.table || !L.bbox || !L.pageNumber || !_chunkR3T4RTQLcjs.CLIP_TABLES.has(L.table) || _chunkR3T4RTQLcjs.EMPTY_PARTS.has(L.table)) continue;
|
|
1684
1686
|
const ph = pageHeights.get(L.pageNumber);
|
|
1685
1687
|
if (!ph || L.bbox.y > ph * PAGE_EDGE_BAND) continue;
|
|
1686
1688
|
let s0 = i, s1 = i;
|
|
@@ -1709,8 +1711,8 @@ function mergeColumnFlow(blocks, pageHeights, lex) {
|
|
|
1709
1711
|
}
|
|
1710
1712
|
function joinClipParts(prev, curr, pageHeights, lex) {
|
|
1711
1713
|
const pt = prev.table, ct = curr.table;
|
|
1712
|
-
if (!
|
|
1713
|
-
const px =
|
|
1714
|
+
if (!_chunkR3T4RTQLcjs.CLIP_TABLES.has(pt) || !_chunkR3T4RTQLcjs.CLIP_TABLES.has(ct)) return null;
|
|
1715
|
+
const px = _chunkR3T4RTQLcjs.TABLE_COLXS.get(pt), cx = _chunkR3T4RTQLcjs.TABLE_COLXS.get(ct);
|
|
1714
1716
|
if (!px || !cx) return null;
|
|
1715
1717
|
let xs = cx, shifted = false, dx = 0, foreign = false, within = false;
|
|
1716
1718
|
if (!shiftedSame(px, cx, false)) {
|
|
@@ -1726,15 +1728,15 @@ function joinClipParts(prev, curr, pageHeights, lex) {
|
|
|
1726
1728
|
const inner = b.slice(1, -1).map((x) => x + dx);
|
|
1727
1729
|
return inner.length > 0 && !inner.some((x) => px.some((p) => Math.abs(p - x) <= CONTINUATION_COL_TOL));
|
|
1728
1730
|
};
|
|
1729
|
-
foreign = unrelated(cx) && unrelated(_nullishCoalesce(
|
|
1731
|
+
foreign = unrelated(cx) && unrelated(_nullishCoalesce(_chunkR3T4RTQLcjs.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);
|
|
1730
1732
|
}
|
|
1731
1733
|
const res = joinSplitParts(pt, px, ct, xs, dx, _optionalChain([prev, 'access', _180 => _180.bbox, 'optionalAccess', _181 => _181.y]), lex);
|
|
1732
1734
|
if (!res || (shifted || foreign || within) && !res.split && !res.header) return null;
|
|
1733
|
-
|
|
1734
|
-
const ys =
|
|
1735
|
-
if (ys)
|
|
1736
|
-
|
|
1737
|
-
|
|
1735
|
+
_chunkR3T4RTQLcjs.TABLE_COLXS.set(res.table, res.colXs);
|
|
1736
|
+
const ys = _chunkR3T4RTQLcjs.TABLE_ROWYS.get(pt);
|
|
1737
|
+
if (ys) _chunkR3T4RTQLcjs.TABLE_ROWYS.set(res.table, ys);
|
|
1738
|
+
_chunkR3T4RTQLcjs.PART_COLXS.set(res.table, _nullishCoalesce(_chunkR3T4RTQLcjs.PART_COLXS.get(pt), () => ( px)));
|
|
1739
|
+
_chunkR3T4RTQLcjs.CLIP_TABLES.add(res.table);
|
|
1738
1740
|
return res.table;
|
|
1739
1741
|
}
|
|
1740
1742
|
function prevLacksLeftCols(prev, px, xs, pageHeights) {
|
|
@@ -1758,12 +1760,12 @@ function looksContinued(prev, curr, pageHeights) {
|
|
|
1758
1760
|
return filled.length >= 2 && filled.every((t) => t === filled[0]);
|
|
1759
1761
|
}
|
|
1760
1762
|
function pushedLead(prev, curr) {
|
|
1761
|
-
if (!
|
|
1763
|
+
if (!_chunkR3T4RTQLcjs.CLIP_TABLES.has(prev.table) || !_chunkR3T4RTQLcjs.CLIP_TABLES.has(curr.table)) return false;
|
|
1762
1764
|
const lead = leadRows(curr.table);
|
|
1763
1765
|
return lead.image && lead.height > prev.bbox.y;
|
|
1764
1766
|
}
|
|
1765
1767
|
function leadRows(t) {
|
|
1766
|
-
const ys =
|
|
1768
|
+
const ys = _chunkR3T4RTQLcjs.TABLE_ROWYS.get(t);
|
|
1767
1769
|
if (!ys || ys.length < 2) return { height: 0, image: false };
|
|
1768
1770
|
const anchors = anchorsOf(t);
|
|
1769
1771
|
let end = 1, image = false;
|
|
@@ -1771,17 +1773,17 @@ function leadRows(t) {
|
|
|
1771
1773
|
for (const a of anchors) {
|
|
1772
1774
|
if (a.r !== r) continue;
|
|
1773
1775
|
end = Math.max(end, r + a.rs);
|
|
1774
|
-
if (
|
|
1776
|
+
if (_chunkR3T4RTQLcjs.IMAGE_CELLS.has(a.cell)) image = true;
|
|
1775
1777
|
}
|
|
1776
1778
|
}
|
|
1777
1779
|
return { height: ys[0] - ys[Math.min(end, ys.length - 1)], image };
|
|
1778
1780
|
}
|
|
1779
1781
|
function tailOf(b) {
|
|
1780
|
-
const t = b.table &&
|
|
1782
|
+
const t = b.table && _chunkR3T4RTQLcjs.TABLE_TAIL.get(b.table);
|
|
1781
1783
|
return t && b.bbox ? { ...b, pageNumber: t.page, bbox: { ...b.bbox, page: t.page, y: t.y, height: t.height } } : b;
|
|
1782
1784
|
}
|
|
1783
1785
|
function firstRowSig(t) {
|
|
1784
|
-
const x =
|
|
1786
|
+
const x = _chunkR3T4RTQLcjs.TABLE_COLXS.get(t);
|
|
1785
1787
|
if (!x || x.length !== t.cols + 1) return null;
|
|
1786
1788
|
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, "") }));
|
|
1787
1789
|
}
|
|
@@ -1834,7 +1836,7 @@ function chainHead(blocks, i, pageHeights) {
|
|
|
1834
1836
|
if (pb.pageNumber !== (_nullishCoalesce(cur.pageNumber, () => ( 0))) - 1) break;
|
|
1835
1837
|
if (!blocks.slice(p + 1, k).every((b) => besideOwn(b, pb, cur) || insideTable(b, pb) || pageNumberBetween(b, pb, cur, pageHeights))) break;
|
|
1836
1838
|
if (!looksContinued(pb, cur, pageHeights)) break;
|
|
1837
|
-
const px =
|
|
1839
|
+
const px = _chunkR3T4RTQLcjs.TABLE_COLXS.get(pb.table), cx = _chunkR3T4RTQLcjs.TABLE_COLXS.get(cur.table);
|
|
1838
1840
|
if (!px || !cx) break;
|
|
1839
1841
|
const dx = px[px.length - 1] - cx[cx.length - 1];
|
|
1840
1842
|
if (!shiftedSame(px, cx) && !px.some((x) => Math.abs(x - (cx[0] + dx)) <= CONTINUATION_COL_TOL) && !prevLacksLeftCols(pb, px, cx, pageHeights)) break;
|
|
@@ -1905,7 +1907,7 @@ var RESTART_LOOKBACK_PAGES = 5;
|
|
|
1905
1907
|
var COL_MATCH_TOL = 0.5;
|
|
1906
1908
|
var CONTINUED_TABLE_PAGE_BAND = 0.16;
|
|
1907
1909
|
function lastRowCell(t, x1, x2) {
|
|
1908
|
-
const xs =
|
|
1910
|
+
const xs = _chunkR3T4RTQLcjs.TABLE_COLXS.get(t);
|
|
1909
1911
|
const covered = /* @__PURE__ */ new Set();
|
|
1910
1912
|
for (let r = 0; r < t.rows; r++) {
|
|
1911
1913
|
for (let c = 0; c < t.cols; c++) {
|
|
@@ -1923,7 +1925,7 @@ var cellBlocks = (cell, pageNumber) => _nullishCoalesce(cell.blocks, () => ( cel
|
|
|
1923
1925
|
function mergeContinuedCells(blocks, pageHeights) {
|
|
1924
1926
|
for (let j = blocks.length - 1; j > 0; j--) {
|
|
1925
1927
|
const part = blocks[j];
|
|
1926
|
-
const from = part.table ?
|
|
1928
|
+
const from = part.table ? _chunkR3T4RTQLcjs.CONT_PARTS.get(part.table) : void 0;
|
|
1927
1929
|
if (!from || !part.table) {
|
|
1928
1930
|
unwrapContinuedTable(blocks, j, pageHeights, true);
|
|
1929
1931
|
continue;
|
|
@@ -1939,12 +1941,12 @@ function mergeContinuedCells(blocks, pageHeights) {
|
|
|
1939
1941
|
if (cell.blocks || add.blocks) cell.blocks = [...cellBlocks(cell, prev.pageNumber), ...cellBlocks(add, part.pageNumber)];
|
|
1940
1942
|
else if (part.pageNumber) markContinuedText(cell, add, part.pageNumber);
|
|
1941
1943
|
cell.text = [cell.text, add.text].filter((s) => s.trim()).join("\n");
|
|
1942
|
-
if (
|
|
1943
|
-
|
|
1944
|
-
const lines =
|
|
1945
|
-
if (_optionalChain([lines, 'optionalAccess', _205 => _205.length]))
|
|
1946
|
-
if (part.pageNumber && part.bbox)
|
|
1947
|
-
if (cell.text.trim() || _optionalChain([cell, 'access', _206 => _206.blocks, 'optionalAccess', _207 => _207.length]) ||
|
|
1944
|
+
if (_chunkR3T4RTQLcjs.IMAGE_CELLS.has(add)) _chunkR3T4RTQLcjs.IMAGE_CELLS.add(cell);
|
|
1945
|
+
_chunkR3T4RTQLcjs.joinCellEdges.call(void 0, cell, add);
|
|
1946
|
+
const lines = _chunkR3T4RTQLcjs.CELL_LINES.get(add);
|
|
1947
|
+
if (_optionalChain([lines, 'optionalAccess', _205 => _205.length])) _chunkR3T4RTQLcjs.CELL_LINES.set(cell, [..._nullishCoalesce(_chunkR3T4RTQLcjs.CELL_LINES.get(cell), () => ( [])), ...lines]);
|
|
1948
|
+
if (part.pageNumber && part.bbox) _chunkR3T4RTQLcjs.TABLE_TAIL.set(prev.table, _nullishCoalesce(_chunkR3T4RTQLcjs.TABLE_TAIL.get(part.table), () => ( { page: part.pageNumber, y: part.bbox.y, height: part.bbox.height })));
|
|
1949
|
+
if (cell.text.trim() || _optionalChain([cell, 'access', _206 => _206.blocks, 'optionalAccess', _207 => _207.length]) || _chunkR3T4RTQLcjs.IMAGE_CELLS.has(cell)) _chunkR3T4RTQLcjs.EMPTY_PARTS.delete(prev.table);
|
|
1948
1950
|
blocks.splice(j, 1);
|
|
1949
1951
|
if (cell.blocks && at > 0) {
|
|
1950
1952
|
const nextAt = cell.blocks[at];
|
|
@@ -1956,11 +1958,11 @@ function mergeContinuedCells(blocks, pageHeights) {
|
|
|
1956
1958
|
}
|
|
1957
1959
|
function unwrapContinuedTable(blocks, at, pageHeights, splitOnly = false) {
|
|
1958
1960
|
const prev = blocks[at - 1], frame = blocks[at];
|
|
1959
|
-
if (!_optionalChain([prev, 'optionalAccess', _208 => _208.table]) || !_optionalChain([frame, 'optionalAccess', _209 => _209.table]) || frame.table.rows !== 1 || frame.table.cols !== 1 || !
|
|
1961
|
+
if (!_optionalChain([prev, 'optionalAccess', _208 => _208.table]) || !_optionalChain([frame, 'optionalAccess', _209 => _209.table]) || frame.table.rows !== 1 || frame.table.cols !== 1 || !_chunkR3T4RTQLcjs.CLIP_TABLES.has(frame.table)) return;
|
|
1960
1962
|
const inner = _optionalChain([frame, 'access', _210 => _210.table, 'access', _211 => _211.cells, 'access', _212 => _212[0], 'optionalAccess', _213 => _213[0], 'optionalAccess', _214 => _214.blocks]);
|
|
1961
1963
|
const next = _optionalChain([inner, 'optionalAccess', _215 => _215[0]]);
|
|
1962
|
-
if (!inner || !_optionalChain([next, 'optionalAccess', _216 => _216.table]) || !prev.bbox || !next.bbox || !prev.pageNumber || next.pageNumber !== prev.pageNumber + 1 || !
|
|
1963
|
-
const px =
|
|
1964
|
+
if (!inner || !_optionalChain([next, 'optionalAccess', _216 => _216.table]) || !prev.bbox || !next.bbox || !prev.pageNumber || next.pageNumber !== prev.pageNumber + 1 || !_chunkR3T4RTQLcjs.CLIP_TABLES.has(prev.table) || !_chunkR3T4RTQLcjs.CLIP_TABLES.has(next.table) || prev.table.cols !== next.table.cols) return;
|
|
1965
|
+
const px = _chunkR3T4RTQLcjs.TABLE_COLXS.get(prev.table), nx = _chunkR3T4RTQLcjs.TABLE_COLXS.get(next.table);
|
|
1964
1966
|
if (!px || !nx || px.length !== nx.length || px.some((x, i) => Math.abs(x - nx[i]) > COL_MATCH_TOL)) return;
|
|
1965
1967
|
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)]);
|
|
1966
1968
|
if (!ph || !nh || prev.bbox.y > ph * CONTINUED_TABLE_PAGE_BAND || next.bbox.y + next.bbox.height < nh * (1 - CONTINUED_TABLE_PAGE_BAND)) return;
|
|
@@ -1970,15 +1972,15 @@ function unwrapContinuedTable(blocks, at, pageHeights, splitOnly = false) {
|
|
|
1970
1972
|
function fillNestedContinuation(blocks, at) {
|
|
1971
1973
|
const prev = blocks[at - 1], next = blocks[at];
|
|
1972
1974
|
const t = _optionalChain([prev, 'optionalAccess', _223 => _223.table]), u = _optionalChain([next, 'optionalAccess', _224 => _224.table]);
|
|
1973
|
-
if (!t || !u || u.rows !== 1 || u.cols !== 1 || !
|
|
1974
|
-
const xs =
|
|
1975
|
+
if (!t || !u || u.rows !== 1 || u.cols !== 1 || !_chunkR3T4RTQLcjs.CLIP_TABLES.has(t) || !_chunkR3T4RTQLcjs.CLIP_TABLES.has(u) || next.pageNumber !== (_nullishCoalesce(prev.pageNumber, () => ( 0))) + 1) return;
|
|
1976
|
+
const xs = _chunkR3T4RTQLcjs.TABLE_COLXS.get(u);
|
|
1975
1977
|
const cell = xs ? lastRowCell(t, xs[0], xs[xs.length - 1]) : void 0;
|
|
1976
1978
|
const add = _optionalChain([u, 'access', _225 => _225.cells, 'access', _226 => _226[0], 'optionalAccess', _227 => _227[0]]);
|
|
1977
|
-
if (!cell || !add || cell.text.trim() || _optionalChain([cell, 'access', _228 => _228.blocks, 'optionalAccess', _229 => _229.length]) ||
|
|
1979
|
+
if (!cell || !add || cell.text.trim() || _optionalChain([cell, 'access', _228 => _228.blocks, 'optionalAccess', _229 => _229.length]) || _chunkR3T4RTQLcjs.IMAGE_CELLS.has(cell)) return;
|
|
1978
1980
|
cell.text = add.text;
|
|
1979
1981
|
if (add.blocks) cell.blocks = add.blocks;
|
|
1980
|
-
if (
|
|
1981
|
-
|
|
1982
|
+
if (_chunkR3T4RTQLcjs.IMAGE_CELLS.has(add)) _chunkR3T4RTQLcjs.IMAGE_CELLS.add(cell);
|
|
1983
|
+
_chunkR3T4RTQLcjs.joinCellEdges.call(void 0, cell, add);
|
|
1982
1984
|
blocks.splice(at, 1);
|
|
1983
1985
|
}
|
|
1984
1986
|
|
|
@@ -1987,24 +1989,411 @@ function fillNestedContinuation(blocks, at) {
|
|
|
1987
1989
|
|
|
1988
1990
|
// src/pdf/known-font-glyphs.ts
|
|
1989
1991
|
|
|
1990
|
-
var
|
|
1991
|
-
|
|
1992
|
-
"
|
|
1993
|
-
"
|
|
1994
|
-
"
|
|
1995
|
-
"
|
|
1996
|
-
"
|
|
1997
|
-
"
|
|
1998
|
-
|
|
1999
|
-
|
|
2000
|
-
|
|
2001
|
-
|
|
2002
|
-
|
|
2003
|
-
|
|
2004
|
-
|
|
2005
|
-
|
|
2006
|
-
|
|
2007
|
-
|
|
1992
|
+
var FACES = {
|
|
1993
|
+
"HCRDotum": 1,
|
|
1994
|
+
"HCRDotum-Bold": 2,
|
|
1995
|
+
"HCRBatang": 4,
|
|
1996
|
+
"HCRBatang-Bold": 8,
|
|
1997
|
+
"Haansoft Batang": 16,
|
|
1998
|
+
"Haansoft-Batang": 16,
|
|
1999
|
+
"Haansoft Dotum": 32,
|
|
2000
|
+
"Haansoft-Dotum": 32
|
|
2001
|
+
};
|
|
2002
|
+
var KNOWN = {
|
|
2003
|
+
"826331f96b451b13": [983258, 3],
|
|
2004
|
+
// [예]
|
|
2005
|
+
"1f3219ba4989a5dd": [983258, 12],
|
|
2006
|
+
// [예]
|
|
2007
|
+
"c4abdae02a0adcdc": [983258, 16],
|
|
2008
|
+
// [예]
|
|
2009
|
+
"10d5c418739e1ee5": [983258, 32],
|
|
2010
|
+
// [예]
|
|
2011
|
+
"25c7519ef8303490": [983688, 3],
|
|
2012
|
+
// ⓪
|
|
2013
|
+
"7a4d4fc73a94fd6f": [983688, 12],
|
|
2014
|
+
// ⓪
|
|
2015
|
+
"9ac1486abd17f333": [983688, 16],
|
|
2016
|
+
// ⓪
|
|
2017
|
+
"70cd3f569bae37e4": [983688, 32],
|
|
2018
|
+
// ⓪
|
|
2019
|
+
"f3fc6c0b35446527": [983689, 3],
|
|
2020
|
+
// ①
|
|
2021
|
+
"c8b18f8b6909f7eb": [983689, 12],
|
|
2022
|
+
// ①
|
|
2023
|
+
"8eb0a9d7ed539b5a": [983689, 16],
|
|
2024
|
+
// ①
|
|
2025
|
+
"ea3a316f2ca28f88": [983689, 32],
|
|
2026
|
+
// ①
|
|
2027
|
+
"56308212eb08ddc6": [983690, 3],
|
|
2028
|
+
// ②
|
|
2029
|
+
"81526da89b2a83e7": [983690, 12],
|
|
2030
|
+
// ②
|
|
2031
|
+
"57c21fc91bbd187a": [983690, 16],
|
|
2032
|
+
// ②
|
|
2033
|
+
"0a9a9842c5859d24": [983690, 32],
|
|
2034
|
+
// ②
|
|
2035
|
+
"95f624806225d322": [983691, 3],
|
|
2036
|
+
// ③
|
|
2037
|
+
"22fcf5064c432ac5": [983691, 12],
|
|
2038
|
+
// ③
|
|
2039
|
+
"845da0dfe52f7f75": [983691, 16],
|
|
2040
|
+
// ③
|
|
2041
|
+
"b4b28c8f658fff6c": [983691, 32],
|
|
2042
|
+
// ③
|
|
2043
|
+
"64ef43392a5f4907": [983692, 3],
|
|
2044
|
+
// ④
|
|
2045
|
+
"e42417ac350732cd": [983692, 12],
|
|
2046
|
+
// ④
|
|
2047
|
+
"0a7304ef03051e39": [983692, 16],
|
|
2048
|
+
// ④
|
|
2049
|
+
"38ddce9cc21efe51": [983692, 32],
|
|
2050
|
+
// ④
|
|
2051
|
+
"1b8460dc6e7b912c": [983693, 3],
|
|
2052
|
+
// ⑤
|
|
2053
|
+
"5f2fe78b05094aec": [983693, 12],
|
|
2054
|
+
// ⑤
|
|
2055
|
+
"0d490cbd51284f7e": [983693, 16],
|
|
2056
|
+
// ⑤
|
|
2057
|
+
"59cdc6f9196deb3b": [983693, 32],
|
|
2058
|
+
// ⑤
|
|
2059
|
+
"a9248e357c6d2f94": [983694, 3],
|
|
2060
|
+
// ⑥
|
|
2061
|
+
"14fd2828f84314b2": [983694, 12],
|
|
2062
|
+
// ⑥
|
|
2063
|
+
"a374bf3d8ac0390d": [983694, 16],
|
|
2064
|
+
// ⑥
|
|
2065
|
+
"9dc030a3d48eab2d": [983694, 32],
|
|
2066
|
+
// ⑥
|
|
2067
|
+
"3d4c8ecea5f954a2": [983695, 3],
|
|
2068
|
+
// ⑦
|
|
2069
|
+
"011d2e114e023812": [983695, 12],
|
|
2070
|
+
// ⑦
|
|
2071
|
+
"dccf0cd2cb2920de": [983695, 16],
|
|
2072
|
+
// ⑦
|
|
2073
|
+
"aadf43754e54c718": [983695, 32],
|
|
2074
|
+
// ⑦
|
|
2075
|
+
"19f7f2f56a38f6c7": [983696, 3],
|
|
2076
|
+
// ⑧
|
|
2077
|
+
"c705ca51164a86fa": [983696, 12],
|
|
2078
|
+
// ⑧
|
|
2079
|
+
"f0674c0791905a3b": [983696, 16],
|
|
2080
|
+
// ⑧
|
|
2081
|
+
"4c1a5d0e7a2078a2": [983696, 32],
|
|
2082
|
+
// ⑧
|
|
2083
|
+
"6171ffd64e69e3c0": [983697, 3],
|
|
2084
|
+
// ⑨
|
|
2085
|
+
"7f8640f0b5f6962b": [983697, 12],
|
|
2086
|
+
// ⑨
|
|
2087
|
+
"975feebe80392a7a": [983697, 16],
|
|
2088
|
+
// ⑨
|
|
2089
|
+
"c713cb5f4a98611e": [983697, 32],
|
|
2090
|
+
// ⑨
|
|
2091
|
+
"cadd7be654448e42": [983698, 3],
|
|
2092
|
+
// 0
|
|
2093
|
+
"0b9ec49d497d3646": [983698, 12],
|
|
2094
|
+
// 0
|
|
2095
|
+
"10a51e102f0306fb": [983698, 16],
|
|
2096
|
+
// 0
|
|
2097
|
+
"48a15e77a884ffb3": [983698, 32],
|
|
2098
|
+
// 0
|
|
2099
|
+
"c97025da583eb791": [983699, 3],
|
|
2100
|
+
// 1
|
|
2101
|
+
"488c136219610b0a": [983699, 12],
|
|
2102
|
+
// 1
|
|
2103
|
+
"213957f83bbb739f": [983699, 16],
|
|
2104
|
+
// 1
|
|
2105
|
+
"ac809cda3e4a391a": [983699, 32],
|
|
2106
|
+
// 1
|
|
2107
|
+
"9f4b5b579d0ba173": [983700, 3],
|
|
2108
|
+
// 2
|
|
2109
|
+
"b4543f3d7b21dbed": [983700, 12],
|
|
2110
|
+
// 2
|
|
2111
|
+
"cf4060ddff2fbf83": [983700, 16],
|
|
2112
|
+
// 2
|
|
2113
|
+
"b05b6b801401474b": [983700, 32],
|
|
2114
|
+
// 2
|
|
2115
|
+
"33342b2d368732ca": [983701, 3],
|
|
2116
|
+
// 3
|
|
2117
|
+
"a57db9d367b280f1": [983701, 12],
|
|
2118
|
+
// 3
|
|
2119
|
+
"cf9c97b8bdbd5dd1": [983701, 16],
|
|
2120
|
+
// 3
|
|
2121
|
+
"f7089036b51172e6": [983701, 32],
|
|
2122
|
+
// 3
|
|
2123
|
+
"823fc81e44f6c1dd": [983702, 3],
|
|
2124
|
+
// 4
|
|
2125
|
+
"288164560efc93c2": [983702, 12],
|
|
2126
|
+
// 4
|
|
2127
|
+
"b22de630fdeff95e": [983702, 16],
|
|
2128
|
+
// 4
|
|
2129
|
+
"9ef89a7f302fe895": [983702, 32],
|
|
2130
|
+
// 4
|
|
2131
|
+
"b37b1bc6f7c09d46": [983703, 3],
|
|
2132
|
+
// 5
|
|
2133
|
+
"8189971df4593c4c": [983703, 12],
|
|
2134
|
+
// 5
|
|
2135
|
+
"6d3bb5ffa7dc8373": [983703, 16],
|
|
2136
|
+
// 5
|
|
2137
|
+
"c6d92fbb5f495527": [983703, 32],
|
|
2138
|
+
// 5
|
|
2139
|
+
"254ac5477b752619": [983704, 3],
|
|
2140
|
+
// 6
|
|
2141
|
+
"abb8ec7aff98cd65": [983704, 12],
|
|
2142
|
+
// 6
|
|
2143
|
+
"b99e44219dddb1c3": [983704, 16],
|
|
2144
|
+
// 6
|
|
2145
|
+
"8ae57f96227ded7b": [983704, 32],
|
|
2146
|
+
// 6
|
|
2147
|
+
"79c4d7500ede6f6d": [983705, 3],
|
|
2148
|
+
// 7
|
|
2149
|
+
"14052a8d421cc20c": [983705, 12],
|
|
2150
|
+
// 7
|
|
2151
|
+
"26b8733c4f4cee0a": [983705, 16],
|
|
2152
|
+
// 7
|
|
2153
|
+
"67cbd258ede1d1a1": [983705, 32],
|
|
2154
|
+
// 7
|
|
2155
|
+
"823090b6d43f1253": [983706, 3],
|
|
2156
|
+
// 8
|
|
2157
|
+
"270d964bb683d135": [983706, 12],
|
|
2158
|
+
// 8
|
|
2159
|
+
"da8df7ffecee06e6": [983706, 16],
|
|
2160
|
+
// 8
|
|
2161
|
+
"9425a73553094ef8": [983706, 32],
|
|
2162
|
+
// 8
|
|
2163
|
+
"02e3297d2a71cf3f": [983707, 3],
|
|
2164
|
+
// 9
|
|
2165
|
+
"cbdf54dd95a84117": [983707, 12],
|
|
2166
|
+
// 9
|
|
2167
|
+
"cc92e0b3fa06d8a2": [983707, 16],
|
|
2168
|
+
// 9
|
|
2169
|
+
"81d62c8e9242637b": [983707, 32],
|
|
2170
|
+
// 9
|
|
2171
|
+
"18840c2b372836b1": [983728, 3],
|
|
2172
|
+
// ⓪
|
|
2173
|
+
"e2985a2dc2c729c1": [983728, 12],
|
|
2174
|
+
// ⓪
|
|
2175
|
+
"7c42aa23c1a68e32": [983728, 16],
|
|
2176
|
+
// ⓪
|
|
2177
|
+
"8bb6b32ba84d6ea0": [983728, 32],
|
|
2178
|
+
// ⓪
|
|
2179
|
+
"1b0a094dcfd7aefc": [983729, 3],
|
|
2180
|
+
// ①
|
|
2181
|
+
"75ad8123e5e01977": [983729, 12],
|
|
2182
|
+
// ①
|
|
2183
|
+
"8a4af2cf2dfe3238": [983729, 16],
|
|
2184
|
+
// ①
|
|
2185
|
+
"7828251a7a571442": [983729, 32],
|
|
2186
|
+
// ①
|
|
2187
|
+
"aae8317fb2a0107a": [983730, 3],
|
|
2188
|
+
// ②
|
|
2189
|
+
"b89bc7926f0c3f01": [983730, 12],
|
|
2190
|
+
// ②
|
|
2191
|
+
"7332dcab9d77002b": [983730, 16],
|
|
2192
|
+
// ②
|
|
2193
|
+
"8d74bcf8acd941a3": [983730, 32],
|
|
2194
|
+
// ②
|
|
2195
|
+
"8f24a5ed56b3bf1b": [983731, 3],
|
|
2196
|
+
// ③
|
|
2197
|
+
"4352941ed1545430": [983731, 12],
|
|
2198
|
+
// ③
|
|
2199
|
+
"e7cc725807eae1ae": [983731, 16],
|
|
2200
|
+
// ③
|
|
2201
|
+
"f6a21cbb2b062080": [983731, 32],
|
|
2202
|
+
// ③
|
|
2203
|
+
"9d4c236dfd7b8185": [983732, 3],
|
|
2204
|
+
// ④
|
|
2205
|
+
"04c4fa723908a3fd": [983732, 12],
|
|
2206
|
+
// ④
|
|
2207
|
+
"3956a9db6baa74ef": [983732, 16],
|
|
2208
|
+
// ④
|
|
2209
|
+
"4c850a0e2e079596": [983732, 32],
|
|
2210
|
+
// ④
|
|
2211
|
+
"de1c0ac7276ae7ae": [983733, 3],
|
|
2212
|
+
// ⑤
|
|
2213
|
+
"b153a10aa5d3636c": [983733, 12],
|
|
2214
|
+
// ⑤
|
|
2215
|
+
"8340732dc5f6a75a": [983733, 16],
|
|
2216
|
+
// ⑤
|
|
2217
|
+
"2cfe943ce9a12ec8": [983733, 32],
|
|
2218
|
+
// ⑤
|
|
2219
|
+
"520e685af87659bd": [983734, 3],
|
|
2220
|
+
// ⑥
|
|
2221
|
+
"142011df67c9b44f": [983734, 12],
|
|
2222
|
+
// ⑥
|
|
2223
|
+
"1412a79bd9ed7fdb": [983734, 16],
|
|
2224
|
+
// ⑥
|
|
2225
|
+
"ed6ad4f3954e8ceb": [983734, 32],
|
|
2226
|
+
// ⑥
|
|
2227
|
+
"0ef28db85f8cec3c": [983735, 3],
|
|
2228
|
+
// ⑦
|
|
2229
|
+
"67f0a679b7f2d027": [983735, 12],
|
|
2230
|
+
// ⑦
|
|
2231
|
+
"64760d2273d92363": [983735, 16],
|
|
2232
|
+
// ⑦
|
|
2233
|
+
"f35d358a18f7686a": [983735, 32],
|
|
2234
|
+
// ⑦
|
|
2235
|
+
"51a2cf4d6a635cb7": [983736, 3],
|
|
2236
|
+
// ⑧
|
|
2237
|
+
"a29075d7a2fb6d84": [983736, 12],
|
|
2238
|
+
// ⑧
|
|
2239
|
+
"eb19943ef67624e2": [983736, 16],
|
|
2240
|
+
// ⑧
|
|
2241
|
+
"97311736edcf72f5": [983736, 32],
|
|
2242
|
+
// ⑧
|
|
2243
|
+
"641fdd5b007be3ed": [983737, 3],
|
|
2244
|
+
// ⑨
|
|
2245
|
+
"3302bd6c6a89f170": [983737, 12],
|
|
2246
|
+
// ⑨
|
|
2247
|
+
"c70d5cf181c87ff3": [983737, 16],
|
|
2248
|
+
// ⑨
|
|
2249
|
+
"cfc718a620755cc7": [983737, 32],
|
|
2250
|
+
// ⑨
|
|
2251
|
+
"ace6bb494fed2822": [983738, 3],
|
|
2252
|
+
// ①
|
|
2253
|
+
"5e95e7c19a0a3252": [983738, 12],
|
|
2254
|
+
// ①
|
|
2255
|
+
"366c206a1a5eb7b3": [983738, 16],
|
|
2256
|
+
// ①
|
|
2257
|
+
"d774e0d5bf84b4eb": [983738, 32],
|
|
2258
|
+
// ①
|
|
2259
|
+
"3dd6397d43caff8a": [983739, 3],
|
|
2260
|
+
// ②
|
|
2261
|
+
"071ca79d1928ca6a": [983739, 12],
|
|
2262
|
+
// ②
|
|
2263
|
+
"f87edf8771950efc": [983739, 16],
|
|
2264
|
+
// ②
|
|
2265
|
+
"605e83b5db1c25e5": [983739, 32],
|
|
2266
|
+
// ②
|
|
2267
|
+
"d1b6e256036e3c3b": [983740, 3],
|
|
2268
|
+
// ③
|
|
2269
|
+
"d3b776f144feaeab": [983740, 12],
|
|
2270
|
+
// ③
|
|
2271
|
+
"2df1cac0085b70ea": [983740, 16],
|
|
2272
|
+
// ③
|
|
2273
|
+
"75a76c9c0c4f1c4b": [983740, 32],
|
|
2274
|
+
// ③
|
|
2275
|
+
"6ff861ec8f16dbfd": [983741, 3],
|
|
2276
|
+
// ④
|
|
2277
|
+
"0a8f9fca0df85993": [983741, 12],
|
|
2278
|
+
// ④
|
|
2279
|
+
"c499cc2964bd0779": [983741, 16],
|
|
2280
|
+
// ④
|
|
2281
|
+
"e205b0387cab87cf": [983741, 32],
|
|
2282
|
+
// ④
|
|
2283
|
+
"0363c022091ead97": [983742, 3],
|
|
2284
|
+
// ⑤
|
|
2285
|
+
"f273353f24dc13b3": [983742, 12],
|
|
2286
|
+
// ⑤
|
|
2287
|
+
"d654e7a8fe433226": [983742, 16],
|
|
2288
|
+
// ⑤
|
|
2289
|
+
"9e7de3de310828d5": [983742, 32],
|
|
2290
|
+
// ⑤
|
|
2291
|
+
"cfa634873e746a80": [983743, 3],
|
|
2292
|
+
// ⑥
|
|
2293
|
+
"95548e9f1f188c06": [983743, 12],
|
|
2294
|
+
// ⑥
|
|
2295
|
+
"137c82933241676c": [983743, 16],
|
|
2296
|
+
// ⑥
|
|
2297
|
+
"0c65ceb7ea70c76e": [983743, 32],
|
|
2298
|
+
// ⑥
|
|
2299
|
+
"a628f9637b3e16c6": [983744, 3],
|
|
2300
|
+
// ⑦
|
|
2301
|
+
"f7da31a2bd1a4fcb": [983744, 12],
|
|
2302
|
+
// ⑦
|
|
2303
|
+
"04eb03456ade3835": [983744, 16],
|
|
2304
|
+
// ⑦
|
|
2305
|
+
"3e2f588ec93a8c1a": [983744, 32],
|
|
2306
|
+
// ⑦
|
|
2307
|
+
"08dbe26d5e2215e3": [983745, 3],
|
|
2308
|
+
// ⑧
|
|
2309
|
+
"fb2fb5d7159da4e1": [983745, 12],
|
|
2310
|
+
// ⑧
|
|
2311
|
+
"fc5b77fcf4ba7625": [983745, 16],
|
|
2312
|
+
// ⑧
|
|
2313
|
+
"3a43e9161faff052": [983745, 32],
|
|
2314
|
+
// ⑧
|
|
2315
|
+
"9d96ee04f1fee34a": [983746, 3],
|
|
2316
|
+
// ⑨
|
|
2317
|
+
"620c1fe6557dc2e1": [983746, 12],
|
|
2318
|
+
// ⑨
|
|
2319
|
+
"ca04c951be8e90a0": [983746, 16],
|
|
2320
|
+
// ⑨
|
|
2321
|
+
"1a8d0f130913b394": [983746, 32],
|
|
2322
|
+
// ⑨
|
|
2323
|
+
"08f95e2d8f93e79c": [983747, 16],
|
|
2324
|
+
// 0
|
|
2325
|
+
"7753a030002921f3": [983747, 32],
|
|
2326
|
+
// 0
|
|
2327
|
+
"4afc19da05acec69": [983748, 32],
|
|
2328
|
+
// 1
|
|
2329
|
+
"57a8e8356417989d": [983749, 32],
|
|
2330
|
+
// 2
|
|
2331
|
+
"baf0a674c0ead6e8": [983750, 32],
|
|
2332
|
+
// 3
|
|
2333
|
+
"b5d1475bbd0f3664": [983751, 16],
|
|
2334
|
+
// 4
|
|
2335
|
+
"f11aec151661b94c": [983751, 32],
|
|
2336
|
+
// 4
|
|
2337
|
+
"85966b97f6841cea": [983752, 32],
|
|
2338
|
+
// 5
|
|
2339
|
+
"a8bea1990c0d2da7": [983753, 32],
|
|
2340
|
+
// 6
|
|
2341
|
+
"6cf70b1be4cb338a": [983754, 32],
|
|
2342
|
+
// 7
|
|
2343
|
+
"25a2a23bf0916876": [983755, 32],
|
|
2344
|
+
// 8
|
|
2345
|
+
"08c28287d2e5ca4a": [983756, 32],
|
|
2346
|
+
// 9
|
|
2347
|
+
"bb7a2a3ab48d5bfd": [983791, 3],
|
|
2348
|
+
// ·
|
|
2349
|
+
"0def640ab8b3d0dd": [983791, 12],
|
|
2350
|
+
// ·
|
|
2351
|
+
"92cde1460f8b9741": [983791, 16],
|
|
2352
|
+
// ·
|
|
2353
|
+
"bf4a39ce21068bca": [983791, 32],
|
|
2354
|
+
// ·
|
|
2355
|
+
"88bc8d90af006b6e": [983836, 15],
|
|
2356
|
+
// ■
|
|
2357
|
+
"aa4c7212192186fa": [983836, 48],
|
|
2358
|
+
// ■
|
|
2359
|
+
"4d42e9990c15cced": [983975, 15],
|
|
2360
|
+
// ⊟
|
|
2361
|
+
"6857a6fa443ea10a": [983975, 48],
|
|
2362
|
+
// ⊟
|
|
2363
|
+
"f1aba8be3af5e204": [983976, 15],
|
|
2364
|
+
// ⊞
|
|
2365
|
+
"941878859ff9044f": [983976, 48],
|
|
2366
|
+
// ⊞
|
|
2367
|
+
"0f4a7a4e4706126d": [985094, 15],
|
|
2368
|
+
// ┌
|
|
2369
|
+
"75c326411cb5667d": [985094, 48],
|
|
2370
|
+
// ┌
|
|
2371
|
+
"dda10d803b819e44": [985095, 15],
|
|
2372
|
+
// ┬
|
|
2373
|
+
"5c3d963f00d6c0eb": [985095, 48],
|
|
2374
|
+
// ┬
|
|
2375
|
+
"a8ff5c3ff51cfd3d": [985096, 15],
|
|
2376
|
+
// ┐
|
|
2377
|
+
"8500249727d63a45": [985096, 48],
|
|
2378
|
+
// ┐
|
|
2379
|
+
"8c4b57517c58ee56": [985100, 15],
|
|
2380
|
+
// └
|
|
2381
|
+
"a42ba1e406489654": [985100, 48],
|
|
2382
|
+
// └
|
|
2383
|
+
"442960c8dfd5e763": [985102, 15],
|
|
2384
|
+
// ┘
|
|
2385
|
+
"f1d0f30f61e84248": [985102, 48],
|
|
2386
|
+
// ┘
|
|
2387
|
+
"65d24bb2fe5dcf5a": [985104, 15],
|
|
2388
|
+
// │
|
|
2389
|
+
"5644629ab371a597": [985104, 48]
|
|
2390
|
+
// │
|
|
2391
|
+
};
|
|
2392
|
+
function knownFontPua(name, outline, width) {
|
|
2393
|
+
const face = FACES[_nullishCoalesce(_optionalChain([name, 'optionalAccess', _230 => _230.replace, 'call', _231 => _231(/^[A-Z]{6}\+/, "")]), () => ( ""))];
|
|
2394
|
+
if (!face) return null;
|
|
2395
|
+
const hit = KNOWN[_crypto.createHash.call(void 0, "sha256").update(JSON.stringify([outline.upm, width, outline.contours])).digest("hex").slice(0, 16)];
|
|
2396
|
+
return hit && hit[1] & face ? hit[0] : null;
|
|
2008
2397
|
}
|
|
2009
2398
|
|
|
2010
2399
|
// src/pdf/symbol-glyphs.ts
|
|
@@ -2178,7 +2567,8 @@ function restoreUnmappedGlyphs(items, fnArray, argsArray, fontObj) {
|
|
|
2178
2567
|
const source = fontObj(font), data = _optionalChain([source, 'optionalAccess', _232 => _232.data]);
|
|
2179
2568
|
const code = glyph.fontChar.codePointAt(0);
|
|
2180
2569
|
const outline = data && code !== void 0 ? readOutline(data, code) : null;
|
|
2181
|
-
|
|
2570
|
+
const pua = outline ? knownFontPua(_optionalChain([source, 'optionalAccess', _233 => _233.name]), outline, glyph.width) : null;
|
|
2571
|
+
if (outline) sym = pua !== null ? String.fromCodePoint(pua) : classifyOutline(outline);
|
|
2182
2572
|
} catch (e3) {
|
|
2183
2573
|
}
|
|
2184
2574
|
cache.set(key, sym);
|
|
@@ -2189,6 +2579,14 @@ function restoreUnmappedGlyphs(items, fnArray, argsArray, fontObj) {
|
|
|
2189
2579
|
}
|
|
2190
2580
|
}
|
|
2191
2581
|
}
|
|
2582
|
+
for (const q of queues.values()) for (let k = 0; k < q.length; k++) {
|
|
2583
|
+
const pair = k + 1 < q.length ? _chunkS34OVRKDcjs.pairedNumber.call(void 0, q[k], q[k + 1]) : void 0;
|
|
2584
|
+
if (pair !== void 0) {
|
|
2585
|
+
q[k] = pair;
|
|
2586
|
+
q[k + 1] = "";
|
|
2587
|
+
k++;
|
|
2588
|
+
} else q[k] = _chunkS34OVRKDcjs.mapPuaText.call(void 0, q[k]);
|
|
2589
|
+
}
|
|
2192
2590
|
const byFont = /* @__PURE__ */ new Map();
|
|
2193
2591
|
for (const it of items) {
|
|
2194
2592
|
if (typeof it.str !== "string" || !it.str.includes(NO_UNICODE)) continue;
|
|
@@ -2222,15 +2620,15 @@ function selectionContextPages(selected, pageCount) {
|
|
|
2222
2620
|
function marginContextBlocks(raw, page, view) {
|
|
2223
2621
|
const [x1, y1, x2, y2] = view;
|
|
2224
2622
|
const width = x2 - x1, height = y2 - y1;
|
|
2225
|
-
const items =
|
|
2623
|
+
const items = _chunkR3T4RTQLcjs.filterHiddenText.call(void 0, _chunkR3T4RTQLcjs.normalizeItems.call(void 0, raw), width, height, x1, y1).visible;
|
|
2226
2624
|
for (const item of items) {
|
|
2227
2625
|
item.x -= x1;
|
|
2228
2626
|
item.y -= y1;
|
|
2229
2627
|
}
|
|
2230
|
-
return
|
|
2231
|
-
const bbox =
|
|
2628
|
+
return _chunkR3T4RTQLcjs.groupByY.call(void 0, items).flatMap((line) => {
|
|
2629
|
+
const bbox = _chunkR3T4RTQLcjs.computeBBox.call(void 0, line, page);
|
|
2232
2630
|
if (bbox.y + bbox.height < height * 0.88 && bbox.y > height * 0.12) return [];
|
|
2233
|
-
return [{ type: "paragraph", text:
|
|
2631
|
+
return [{ type: "paragraph", text: _chunkR3T4RTQLcjs.mergeLineSimple.call(void 0, line), pageNumber: page, bbox, style: _chunkR3T4RTQLcjs.dominantStyle.call(void 0, line) }];
|
|
2234
2632
|
});
|
|
2235
2633
|
}
|
|
2236
2634
|
|
|
@@ -2266,7 +2664,7 @@ var WINANSI_REVERSE = {
|
|
|
2266
2664
|
};
|
|
2267
2665
|
function symbolFontTable(fontName) {
|
|
2268
2666
|
if (!fontName) return void 0;
|
|
2269
|
-
if (/wingdings(?![\s-]*[23])/i.test(fontName)) return
|
|
2667
|
+
if (/wingdings(?![\s-]*[23])/i.test(fontName)) return _chunkS34OVRKDcjs.WINGDINGS;
|
|
2270
2668
|
return void 0;
|
|
2271
2669
|
}
|
|
2272
2670
|
function remapSymbolText(text, table) {
|
|
@@ -3158,6 +3556,26 @@ function dropTabLeaderDots(items) {
|
|
|
3158
3556
|
});
|
|
3159
3557
|
}
|
|
3160
3558
|
|
|
3559
|
+
// src/pdf/enclosed-digits.ts
|
|
3560
|
+
var SHAPES = /* @__PURE__ */ new Set(["\u25EF", "\u25A1"]);
|
|
3561
|
+
function mergeEnclosedDigits(items) {
|
|
3562
|
+
const drop = /* @__PURE__ */ new Set();
|
|
3563
|
+
for (const s of items) {
|
|
3564
|
+
if (!SHAPES.has(s.text)) continue;
|
|
3565
|
+
const inside2 = items.filter((d) => !drop.has(d) && /^\d\d?$/.test(d.text) && d.fontSize < s.fontSize && d.x >= s.x - 1 && d.x + d.w <= s.x + s.w + 1 && Math.abs(d.y - s.y) <= s.fontSize * 0.5).sort((a, b) => a.x - b.x);
|
|
3566
|
+
const digits = inside2.map((d) => d.text).join("");
|
|
3567
|
+
if (!/^\d\d?$/.test(digits)) continue;
|
|
3568
|
+
const mid = (inside2[0].x + inside2[inside2.length - 1].x + inside2[inside2.length - 1].w) / 2;
|
|
3569
|
+
if (Math.abs(mid - (s.x + s.w / 2)) > s.fontSize * 0.15) continue;
|
|
3570
|
+
s.text = _chunkS34OVRKDcjs.enclosedNumber.call(void 0, Number(digits));
|
|
3571
|
+
for (const d of inside2) drop.add(d);
|
|
3572
|
+
}
|
|
3573
|
+
if (!drop.size) return;
|
|
3574
|
+
let k = 0;
|
|
3575
|
+
for (const it of items) if (!drop.has(it)) items[k++] = it;
|
|
3576
|
+
items.length = k;
|
|
3577
|
+
}
|
|
3578
|
+
|
|
3161
3579
|
// src/pdf/two-up.ts
|
|
3162
3580
|
function orderTwoUpPage(blocks, pageWidth, pageHeight) {
|
|
3163
3581
|
if (pageWidth < pageHeight * 1.2 || blocks.length < 2) return blocks;
|
|
@@ -3331,7 +3749,7 @@ function demoteNonHeadingRoles(blocks, pageHeights, faceNames) {
|
|
|
3331
3749
|
if (block.type !== "heading" || !block.text) continue;
|
|
3332
3750
|
const text = block.text.replace(/<[^>]+>/g, "").trim();
|
|
3333
3751
|
const fsz = _nullishCoalesce(_optionalChain([block, 'access', _304 => _304.style, 'optionalAccess', _305 => _305.fontSize]), () => ( 0));
|
|
3334
|
-
const tocEntry = i > 0 &&
|
|
3752
|
+
const tocEntry = i > 0 && _chunkR3T4RTQLcjs.TOC_BLOCKS.has(blocks[i - 1]) && _chunkR3T4RTQLcjs.TOC_BLOCKS.has(blocks[i + 1]);
|
|
3335
3753
|
const page = _nullishCoalesce(byPage.get(_nullishCoalesce(block.pageNumber, () => ( 0))), () => ( []));
|
|
3336
3754
|
const proseStyle = _optionalChain([block, 'access', _306 => _306.style, 'optionalAccess', _307 => _307.fontName]) && bodyStyle.get(_nullishCoalesce(block.pageNumber, () => ( 0))) === `${block.style.fontName}:${block.style.fontSize}` && text.length > 60;
|
|
3337
3755
|
const next = blocks[i + 1];
|
|
@@ -3429,7 +3847,7 @@ function splitSingleCellTables(blocks) {
|
|
|
3429
3847
|
const out = [];
|
|
3430
3848
|
for (const b of blocks) {
|
|
3431
3849
|
const t = b.type === "table" ? b.table : void 0;
|
|
3432
|
-
const title = t &&
|
|
3850
|
+
const title = t && _chunkR3T4RTQLcjs.FRAME_TITLE_BLOCKS.get(t);
|
|
3433
3851
|
if (title) {
|
|
3434
3852
|
out.push({ ...title, text: `${t.cells[0][0].text.trim()} ${t.cells[0][2].text.trim()}` });
|
|
3435
3853
|
continue;
|
|
@@ -3465,7 +3883,7 @@ function joinLatinCellWraps(blocks) {
|
|
|
3465
3883
|
const lines = cell.text.split("\n");
|
|
3466
3884
|
const out = [lines[0]];
|
|
3467
3885
|
for (const line of lines.slice(1)) {
|
|
3468
|
-
if (
|
|
3886
|
+
if (_chunkR3T4RTQLcjs.latinSoftWrap.call(void 0, out[out.length - 1], line)) out[out.length - 1] = out[out.length - 1].trimEnd() + " " + line.trim();
|
|
3469
3887
|
else out.push(line);
|
|
3470
3888
|
}
|
|
3471
3889
|
cell.text = out.join("\n");
|
|
@@ -3485,10 +3903,10 @@ function cleanPdfText(text, opts) {
|
|
|
3485
3903
|
).replace(/^(?!\| ---).*$/gm, (line) => {
|
|
3486
3904
|
if (/^\s*\${1,2}.+\${1,2}\s*$/.test(line)) return line;
|
|
3487
3905
|
if (line.startsWith("|")) {
|
|
3488
|
-
return line.replace(/(?:\\.|[^|\\])+/g, (cell) => cell.split("<br>").map((seg) => seg.replace(/\S(?:.*\S)?/, (t) =>
|
|
3906
|
+
return line.replace(/(?:\\.|[^|\\])+/g, (cell) => cell.split("<br>").map((seg) => seg.replace(/\S(?:.*\S)?/, (t) => _chunkR3T4RTQLcjs.collapseEvenSpacing.call(void 0, t, false))).join("<br>"));
|
|
3489
3907
|
}
|
|
3490
3908
|
const mark = _nullishCoalesce(_optionalChain([/^(?:#{1,6}|-) /, 'access', _387 => _387.exec, 'call', _388 => _388(line), 'optionalAccess', _389 => _389[0]]), () => ( ""));
|
|
3491
|
-
return mark +
|
|
3909
|
+
return mark + _chunkR3T4RTQLcjs.collapseEvenSpacing.call(void 0, line.slice(mark.length), false);
|
|
3492
3910
|
}).replace(/\\~\\~/g, "~~").replace(/~~~~/g, "").replace(/<u>\s*<\/u>/g, "").replace(/<(sup|sub)>\s*<\/\1>/g, "").replace(/\n{3,}/g, "\n\n").trim();
|
|
3493
3911
|
}
|
|
3494
3912
|
function startsWithMarker(line) {
|
|
@@ -3520,7 +3938,7 @@ function mergeKoreanLines(text) {
|
|
|
3520
3938
|
continue;
|
|
3521
3939
|
}
|
|
3522
3940
|
if (/[가-힣·,\-]$/.test(prev) && /^[가-힣(]/.test(curr) && !startsWithMarker(curr) && !isStandaloneHeader(prev) && !startsWithMarker(prev)) {
|
|
3523
|
-
result[result.length - 1] = prev +
|
|
3941
|
+
result[result.length - 1] = prev + _chunkR3T4RTQLcjs.wrapJoiner.call(void 0, prev, curr) + curr;
|
|
3524
3942
|
} else {
|
|
3525
3943
|
result.push(curr);
|
|
3526
3944
|
}
|
|
@@ -3536,7 +3954,7 @@ function applyLinkAnnotations(items, annots) {
|
|
|
3536
3954
|
const wrapped = /* @__PURE__ */ new Set();
|
|
3537
3955
|
for (const a of annots) {
|
|
3538
3956
|
if (a.subtype !== "Link" || !a.url || !a.rect || a.rect.length < 4) continue;
|
|
3539
|
-
const url =
|
|
3957
|
+
const url = _chunkFJ45NNLAcjs.sanitizeHref.call(void 0, a.url);
|
|
3540
3958
|
if (!url) continue;
|
|
3541
3959
|
const x1 = Math.min(a.rect[0], a.rect[2]), x2 = Math.max(a.rect[0], a.rect[2]);
|
|
3542
3960
|
const y1 = Math.min(a.rect[1], a.rect[3]), y2 = Math.max(a.rect[1], a.rect[3]);
|
|
@@ -3588,7 +4006,7 @@ function mergeLinkRuns(markdown) {
|
|
|
3588
4006
|
|
|
3589
4007
|
// src/pdf/formula-ocr.ts
|
|
3590
4008
|
async function applyFormulaOcr(buffer, blocks, pageFilter, effectivePageCount, warnings, _onProgress) {
|
|
3591
|
-
const formulaMod = await Promise.resolve().then(() => _interopRequireWildcard(require("./formula-
|
|
4009
|
+
const formulaMod = await Promise.resolve().then(() => _interopRequireWildcard(require("./formula-3M6U2J7S.cjs")));
|
|
3592
4010
|
const { FormulaPipeline, ensureFormulaModels } = formulaMod;
|
|
3593
4011
|
await ensureFormulaModels((p) => {
|
|
3594
4012
|
if (p.phase === "download" && p.total) {
|
|
@@ -3779,13 +4197,13 @@ async function loadPdfWithTimeout(buffer) {
|
|
|
3779
4197
|
try {
|
|
3780
4198
|
return await Promise.race([
|
|
3781
4199
|
loadingTask.promise.catch((e) => {
|
|
3782
|
-
if (e instanceof Error && e.name === "PasswordException") throw new (0,
|
|
4200
|
+
if (e instanceof Error && e.name === "PasswordException") throw new (0, _chunkFJ45NNLAcjs.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)");
|
|
3783
4201
|
throw e;
|
|
3784
4202
|
}),
|
|
3785
4203
|
new Promise((_, reject) => {
|
|
3786
4204
|
timer = setTimeout(() => {
|
|
3787
4205
|
loadingTask.destroy();
|
|
3788
|
-
reject(new (0,
|
|
4206
|
+
reject(new (0, _chunkFJ45NNLAcjs.KordocError)("PDF \uB85C\uB529 \uD0C0\uC784\uC544\uC6C3 (30\uCD08 \uCD08\uACFC)"));
|
|
3789
4207
|
}, PDF_LOAD_TIMEOUT_MS);
|
|
3790
4208
|
})
|
|
3791
4209
|
]);
|
|
@@ -3795,14 +4213,14 @@ async function loadPdfWithTimeout(buffer) {
|
|
|
3795
4213
|
}
|
|
3796
4214
|
async function parsePdfDocument(buffer, options) {
|
|
3797
4215
|
const formulaBuffer = _optionalChain([options, 'optionalAccess', _390 => _390.formulaOcr]) ? buffer : null;
|
|
3798
|
-
const ocrOptionError =
|
|
3799
|
-
if (ocrOptionError) throw new (0,
|
|
3800
|
-
const autoOcr = _optionalChain([options, 'optionalAccess', _391 => _391.ocr]) === void 0 && await
|
|
4216
|
+
const ocrOptionError = _chunkS34OVRKDcjs.validateOcrOptions.call(void 0, options);
|
|
4217
|
+
if (ocrOptionError) throw new (0, _chunkFJ45NNLAcjs.KordocError)(ocrOptionError);
|
|
4218
|
+
const autoOcr = _optionalChain([options, 'optionalAccess', _391 => _391.ocr]) === void 0 && await _chunkR3T4RTQLcjs.ocrModelsCached.call(void 0, _chunkR3T4RTQLcjs.resolveOcrModels.call(void 0, options));
|
|
3801
4219
|
const ocrBuffer = _optionalChain([options, 'optionalAccess', _392 => _392.ocr]) || autoOcr ? buffer : null;
|
|
3802
4220
|
const doc = await loadPdfWithTimeout(buffer);
|
|
3803
4221
|
try {
|
|
3804
4222
|
const pageCount = doc.numPages;
|
|
3805
|
-
if (pageCount === 0) throw new (0,
|
|
4223
|
+
if (pageCount === 0) throw new (0, _chunkFJ45NNLAcjs.KordocError)("PDF\uC5D0 \uD398\uC774\uC9C0\uAC00 \uC5C6\uC2B5\uB2C8\uB2E4.");
|
|
3806
4224
|
const metadata = { pageCount, pageMode: "layout" };
|
|
3807
4225
|
await extractPdfMetadata(doc, metadata);
|
|
3808
4226
|
const blocks = [];
|
|
@@ -3831,7 +4249,7 @@ async function parsePdfDocument(buffer, options) {
|
|
|
3831
4249
|
const pageImageBlocks = /* @__PURE__ */ new Map();
|
|
3832
4250
|
const carry = {};
|
|
3833
4251
|
const vectorPageOps = /* @__PURE__ */ new Map();
|
|
3834
|
-
const wrapLexicon = new (0,
|
|
4252
|
+
const wrapLexicon = new (0, _chunkR3T4RTQLcjs.WrapLexicon)();
|
|
3835
4253
|
const noteMarks = /* @__PURE__ */ new Map();
|
|
3836
4254
|
const headerContext = [];
|
|
3837
4255
|
if (pageFilter && _optionalChain([options, 'optionalAccess', _395 => _395.removeHeaderFooter]) !== false && pageFilter.size < effectivePageCount) {
|
|
@@ -3878,8 +4296,8 @@ async function parsePdfDocument(buffer, options) {
|
|
|
3878
4296
|
restoreUnmappedGlyphs(rawItems, rawOps.fnArray, rawOps.argsArray, (n) => fontObj(n));
|
|
3879
4297
|
restoreTrackedSpacing(rawItems, rawOps.fnArray, rawOps.argsArray);
|
|
3880
4298
|
markSyntheticSpaces(rawItems, rawOps.fnArray, rawOps.argsArray);
|
|
3881
|
-
const items =
|
|
3882
|
-
const filtered =
|
|
4299
|
+
const items = _chunkR3T4RTQLcjs.normalizeItems.call(void 0, occluded.size ? rawItems.filter((it) => !occluded.has(it)) : rawItems);
|
|
4300
|
+
const filtered = _chunkR3T4RTQLcjs.filterHiddenText.call(void 0, items, pageW, pageH, viewX1, viewY1);
|
|
3883
4301
|
const joined = joinVerticalColumns(filtered.visible);
|
|
3884
4302
|
const visible = dropTabLeaderDots(joined);
|
|
3885
4303
|
const hiddenCount = filtered.hiddenCount + occluded.size;
|
|
@@ -3889,6 +4307,7 @@ async function parsePdfDocument(buffer, options) {
|
|
|
3889
4307
|
for (const item of joined) {
|
|
3890
4308
|
if (item.fontSize > 0) fontSizeFreq.set(item.fontSize, (fontSizeFreq.get(item.fontSize) || 0) + 1);
|
|
3891
4309
|
}
|
|
4310
|
+
mergeEnclosedDigits(visible);
|
|
3892
4311
|
try {
|
|
3893
4312
|
const annots = await page.getAnnotations();
|
|
3894
4313
|
applyLinkAnnotations(visible, annots);
|
|
@@ -3905,7 +4324,7 @@ async function parsePdfDocument(buffer, options) {
|
|
|
3905
4324
|
} : rawOps;
|
|
3906
4325
|
remapSymbolFontItems(visible, (loadedName) => _optionalChain([fontObj, 'call', _402 => _402(loadedName), 'optionalAccess', _403 => _403.name]));
|
|
3907
4326
|
remapControlGlyphs(visible, differencesOf);
|
|
3908
|
-
await
|
|
4327
|
+
await _chunkR3T4RTQLcjs.restoreImageBullets.call(void 0, visible, page, opList.fnArray, opList.argsArray, imageBulletShapes);
|
|
3909
4328
|
const faces = /* @__PURE__ */ new Map();
|
|
3910
4329
|
for (const it of visible) {
|
|
3911
4330
|
if (!it.fontName) continue;
|
|
@@ -3918,12 +4337,12 @@ async function parsePdfDocument(buffer, options) {
|
|
|
3918
4337
|
it.fontName = face;
|
|
3919
4338
|
if (!faceNames.has(face)) faceNames.set(face, (_nullishCoalesce(_optionalChain([fontObj, 'call', _405 => _405(face), 'optionalAccess', _406 => _406.name]), () => ( ""))).replace(/^[A-Z]{6}\+/, ""));
|
|
3920
4339
|
}
|
|
3921
|
-
for (const it of visible) if (it.text.includes("$")) it.text =
|
|
3922
|
-
for (const it of visible) if (it.text.includes("<")) it.text =
|
|
4340
|
+
for (const it of visible) if (it.text.includes("$")) it.text = _chunkS34OVRKDcjs.escapeLiteralDollar.call(void 0, it.text);
|
|
4341
|
+
for (const it of visible) if (it.text.includes("<")) it.text = _chunkS34OVRKDcjs.escapeLiteralTags.call(void 0, it.text);
|
|
3923
4342
|
wrapEquationRuns(visible, (face) => faceNames.get(face));
|
|
3924
4343
|
const pageArea = pageW * pageH;
|
|
3925
4344
|
if (pageArea > 0) {
|
|
3926
|
-
const imageRegions =
|
|
4345
|
+
const imageRegions = _chunkR3T4RTQLcjs.extractImageRegions.call(void 0, opList.fnArray, opList.argsArray);
|
|
3927
4346
|
let uncovered = 0;
|
|
3928
4347
|
for (const r of imageRegions) {
|
|
3929
4348
|
const area = (r.x2 - r.x1) * (r.y2 - r.y1);
|
|
@@ -3949,11 +4368,11 @@ async function parsePdfDocument(buffer, options) {
|
|
|
3949
4368
|
if (uncovered > 0) skippedImagePages.set(i, uncovered);
|
|
3950
4369
|
}
|
|
3951
4370
|
const marks = superscriptNoteMarks(visible);
|
|
3952
|
-
if (marks.length) noteMarks.set(i, { marks, seps: footnoteSeparators(
|
|
4371
|
+
if (marks.length) noteMarks.set(i, { marks, seps: footnoteSeparators(_chunkR3T4RTQLcjs.extractLines.call(void 0, opList.fnArray, opList.argsArray).horizontals, pageW, pageH) });
|
|
3953
4372
|
const stamp = marginStamp(visible);
|
|
3954
4373
|
const flow = stamp.length ? visible.filter((it) => !stamp.includes(it)) : visible;
|
|
3955
|
-
const rightArrows = _optionalChain([options, 'optionalAccess', _407 => _407.tables]) !== false ? await
|
|
3956
|
-
const pageBlocks = orderTwoUpPage(
|
|
4374
|
+
const rightArrows = _optionalChain([options, 'optionalAccess', _407 => _407.tables]) !== false ? await _chunkR3T4RTQLcjs.detectRightArrowRegions.call(void 0, page, opList.fnArray, opList.argsArray, imageArrowDirections) : [];
|
|
4375
|
+
const pageBlocks = orderTwoUpPage(_chunkR3T4RTQLcjs.extractPageBlocksWithLines.call(void 0, flow, i, opList, pageW, pageH, void 0, _optionalChain([options, 'optionalAccess', _408 => _408.tables]) !== false, carry, wrapLexicon, rightArrows), pageW, pageH);
|
|
3957
4376
|
if (stamp.length) pageBlocks.unshift({ type: "paragraph", text: [...stamp].sort((a, b) => a.y - b.y).map((it) => it.text).join(" "), pageNumber: i });
|
|
3958
4377
|
for (const b of pageBlocks) blocks.push(b);
|
|
3959
4378
|
try {
|
|
@@ -3979,11 +4398,11 @@ async function parsePdfDocument(buffer, options) {
|
|
|
3979
4398
|
if (_optionalChain([options, 'optionalAccess', _410 => _410.ocr]) && quality.ocrReason === "vector_text" && page.rotate % 360 === 0 && page.view[0] === 0 && page.view[1] === 0) {
|
|
3980
4399
|
vectorPageOps.set(i, ocrVectorOps(opList, vector.paths));
|
|
3981
4400
|
}
|
|
3982
|
-
if (totalTextBytes > MAX_TOTAL_TEXT) throw new (0,
|
|
4401
|
+
if (totalTextBytes > MAX_TOTAL_TEXT) throw new (0, _chunkFJ45NNLAcjs.KordocError)("\uD14D\uC2A4\uD2B8 \uCD94\uCD9C \uD06C\uAE30 \uCD08\uACFC");
|
|
3983
4402
|
parsedPages++;
|
|
3984
4403
|
_optionalChain([options, 'optionalAccess', _411 => _411.onProgress, 'optionalCall', _412 => _412(parsedPages, totalTarget)]);
|
|
3985
4404
|
} catch (pageErr) {
|
|
3986
|
-
if (pageErr instanceof
|
|
4405
|
+
if (pageErr instanceof _chunkFJ45NNLAcjs.KordocError) throw pageErr;
|
|
3987
4406
|
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" });
|
|
3988
4407
|
} finally {
|
|
3989
4408
|
_optionalChain([loadedPage, 'optionalAccess', _413 => _413.cleanup, 'call', _414 => _414()]);
|
|
@@ -4014,12 +4433,12 @@ async function parsePdfDocument(buffer, options) {
|
|
|
4014
4433
|
}
|
|
4015
4434
|
if (targets.size > 0) {
|
|
4016
4435
|
try {
|
|
4017
|
-
const { runPdfOcr } = await Promise.resolve().then(() => _interopRequireWildcard(require("./pdf-ocr-
|
|
4436
|
+
const { runPdfOcr } = await Promise.resolve().then(() => _interopRequireWildcard(require("./pdf-ocr-U5MFMNCW.cjs")));
|
|
4018
4437
|
const mode = typeof _optionalChain([options, 'optionalAccess', _419 => _419.ocr]) === "function" ? options.ocr : "builtin";
|
|
4019
4438
|
const regionPages = new Map([...ocrRegions].filter(([p]) => _optionalChain([options, 'optionalAccess', _420 => _420.ocr]) !== "force" && !isImageBased && !_optionalChain([pageQuality, 'access', _421 => _421.find, 'call', _422 => _422((q) => q.page === p), 'optionalAccess', _423 => _423.needsOcr])));
|
|
4020
|
-
const { builtinOcrConfig } = await Promise.resolve().then(() => _interopRequireWildcard(require("./pdf-ocr-
|
|
4439
|
+
const { builtinOcrConfig } = await Promise.resolve().then(() => _interopRequireWildcard(require("./pdf-ocr-U5MFMNCW.cjs")));
|
|
4021
4440
|
const ocrPageBlocks = await runPdfOcr(ocrBuffer, targets, mode, warnings, _optionalChain([options, 'optionalAccess', _424 => _424.onProgress]), _optionalChain([options, 'optionalAccess', _425 => _425.tables]) !== false, vectorPageOps, regionPages, builtinOcrConfig(options), ocrLinesOut);
|
|
4022
|
-
for (const obs of ocrPageBlocks.values())
|
|
4441
|
+
for (const obs of ocrPageBlocks.values()) _chunkS34OVRKDcjs.stripScriptTags.call(void 0, { blocks: obs });
|
|
4023
4442
|
if (ocrPageBlocks.size > 0) {
|
|
4024
4443
|
const replacePages = /* @__PURE__ */ new Set();
|
|
4025
4444
|
for (const [p, obs] of ocrPageBlocks) {
|
|
@@ -4030,7 +4449,7 @@ async function parsePdfDocument(buffer, options) {
|
|
|
4030
4449
|
continue;
|
|
4031
4450
|
}
|
|
4032
4451
|
const regions = ocrRegions.get(p);
|
|
4033
|
-
if (!regions ||
|
|
4452
|
+
if (!regions || _chunkR3T4RTQLcjs.mergeOcrImageRegions.call(void 0, blocks, p, regions, obs) === 0) continue;
|
|
4034
4453
|
ocrDone.add(p);
|
|
4035
4454
|
if (_optionalChain([pageImageBlocks, 'access', _430 => _430.get, 'call', _431 => _431(p), 'optionalAccess', _432 => _432.length]) === 1) pageImageBlocks.delete(p);
|
|
4036
4455
|
}
|
|
@@ -4083,17 +4502,17 @@ async function parsePdfDocument(buffer, options) {
|
|
|
4083
4502
|
}
|
|
4084
4503
|
}
|
|
4085
4504
|
if (_optionalChain([options, 'optionalAccess', _433 => _433.removeHeaderFooter]) !== false && (parsedPageCount >= 3 || headerContext.length)) {
|
|
4086
|
-
const removed =
|
|
4087
|
-
const running =
|
|
4505
|
+
const removed = _chunkR3T4RTQLcjs.removeHeaderFooterBlocks.call(void 0, blocks, pageHeights, warnings, noteMarks, false, headerContext);
|
|
4506
|
+
const running = _chunkR3T4RTQLcjs.runningLinePatterns.call(void 0, removed.map((ri) => blocks[ri]), pageHeights);
|
|
4088
4507
|
for (let ri = removed.length - 1; ri >= 0; ri--) {
|
|
4089
4508
|
blocks.splice(removed[ri], 1);
|
|
4090
4509
|
}
|
|
4091
|
-
const stripped =
|
|
4510
|
+
const stripped = _chunkR3T4RTQLcjs.stripAbsorbedRunningLines.call(void 0, blocks, pageHeights, running);
|
|
4092
4511
|
if (stripped !== blocks) {
|
|
4093
4512
|
blocks.length = 0;
|
|
4094
4513
|
blocks.push(...stripped);
|
|
4095
4514
|
}
|
|
4096
|
-
const kept =
|
|
4515
|
+
const kept = _chunkR3T4RTQLcjs.removeSideTabs.call(void 0, blocks, pageWidths);
|
|
4097
4516
|
if (kept !== blocks) {
|
|
4098
4517
|
blocks.length = 0;
|
|
4099
4518
|
blocks.push(...kept);
|
|
@@ -4102,12 +4521,12 @@ async function parsePdfDocument(buffer, options) {
|
|
|
4102
4521
|
mergeContinuedCells(blocks, pageHeights);
|
|
4103
4522
|
mergeCrossPageTables(blocks, pageHeights, wrapLexicon);
|
|
4104
4523
|
if (_optionalChain([options, 'optionalAccess', _434 => _434.removeHeaderFooter]) !== false && parsedPageCount >= 3) {
|
|
4105
|
-
const boxes =
|
|
4524
|
+
const boxes = _chunkR3T4RTQLcjs.removeHeaderFooterBlocks.call(void 0, blocks, pageHeights, warnings, noteMarks, true);
|
|
4106
4525
|
for (let ri = boxes.length - 1; ri >= 0; ri--) blocks.splice(boxes[ri], 1);
|
|
4107
4526
|
}
|
|
4108
4527
|
splitContactTables(blocks);
|
|
4109
|
-
if (!_optionalChain([options, 'optionalAccess', _435 => _435.keepTrailingEmptyCols]))
|
|
4110
|
-
|
|
4528
|
+
if (!_optionalChain([options, 'optionalAccess', _435 => _435.keepTrailingEmptyCols])) _chunkR3T4RTQLcjs.trimTrailingEmptyTableCols.call(void 0, blocks);
|
|
4529
|
+
_chunkR3T4RTQLcjs.joinPageBreakWraps.call(void 0, blocks, wrapLexicon);
|
|
4111
4530
|
injectPageImageBlocks(blocks, pageImageBlocks);
|
|
4112
4531
|
if (_optionalChain([options, 'optionalAccess', _436 => _436.formulaOcr]) && formulaBuffer) {
|
|
4113
4532
|
try {
|
|
@@ -4119,21 +4538,21 @@ async function parsePdfDocument(buffer, options) {
|
|
|
4119
4538
|
});
|
|
4120
4539
|
}
|
|
4121
4540
|
}
|
|
4122
|
-
const medianFontSize =
|
|
4541
|
+
const medianFontSize = _chunkR3T4RTQLcjs.computeMedianFontSizeFromFreq.call(void 0, fontSizeFreq);
|
|
4123
4542
|
if (medianFontSize > 0) {
|
|
4124
|
-
|
|
4125
|
-
}
|
|
4126
|
-
|
|
4127
|
-
|
|
4128
|
-
|
|
4129
|
-
|
|
4130
|
-
|
|
4131
|
-
|
|
4132
|
-
|
|
4133
|
-
|
|
4543
|
+
_chunkR3T4RTQLcjs.detectHeadings.call(void 0, blocks, medianFontSize);
|
|
4544
|
+
}
|
|
4545
|
+
_chunkR3T4RTQLcjs.detectDocumentStyleHeadings.call(void 0, blocks);
|
|
4546
|
+
_chunkR3T4RTQLcjs.detectTypographyHeadings.call(void 0, blocks);
|
|
4547
|
+
_chunkR3T4RTQLcjs.detectSiblingStyleHeadings.call(void 0, blocks);
|
|
4548
|
+
_chunkR3T4RTQLcjs.detectRepeatedPageLabels.call(void 0, blocks);
|
|
4549
|
+
_chunkR3T4RTQLcjs.detectPageLeadHeadings.call(void 0, blocks);
|
|
4550
|
+
_chunkR3T4RTQLcjs.mergeStackedHeadingLines.call(void 0, blocks, medianFontSize);
|
|
4551
|
+
_chunkR3T4RTQLcjs.refineDocumentStyleHeadings.call(void 0, blocks);
|
|
4552
|
+
_chunkR3T4RTQLcjs.detectMarkerHeadings.call(void 0, blocks);
|
|
4134
4553
|
demoteNonHeadingRoles(blocks, pageHeights, faceNames);
|
|
4135
|
-
|
|
4136
|
-
|
|
4554
|
+
_chunkR3T4RTQLcjs.detectTableCaptions.call(void 0, blocks);
|
|
4555
|
+
_chunkR3T4RTQLcjs.detectKoreanListBlocks.call(void 0, blocks);
|
|
4137
4556
|
sanitizeBlockControlChars(blocks);
|
|
4138
4557
|
let outBlocks = splitSingleCellTables(blocks);
|
|
4139
4558
|
if (_optionalChain([options, 'optionalAccess', _437 => _437.layoutTables]) !== "keep") {
|
|
@@ -4154,19 +4573,19 @@ async function parsePdfDocument(buffer, options) {
|
|
|
4154
4573
|
const shown = /* @__PURE__ */ new Map();
|
|
4155
4574
|
const markContent = (bs) => {
|
|
4156
4575
|
for (const b of _nullishCoalesce(bs, () => ( []))) if (b.table) for (const row of b.table.cells) for (const c of row) {
|
|
4157
|
-
if (
|
|
4158
|
-
const lines =
|
|
4159
|
-
if (lines)
|
|
4576
|
+
if (_chunkR3T4RTQLcjs.IMAGE_CELLS.has(c)) _chunkS34OVRKDcjs.CONTENT_CELLS.add(c);
|
|
4577
|
+
const lines = _chunkR3T4RTQLcjs.CELL_LINES.get(c);
|
|
4578
|
+
if (lines) _chunkS34OVRKDcjs.CELL_BASELINES.set(c, lines.map((l) => l.y));
|
|
4160
4579
|
markContent(c.blocks);
|
|
4161
4580
|
}
|
|
4162
4581
|
};
|
|
4163
4582
|
const visual = (bs) => bs.flatMap((b) => {
|
|
4164
4583
|
if (b.type !== "table") return [b];
|
|
4165
|
-
if (!hancom && b.table &&
|
|
4584
|
+
if (!hancom && b.table && _chunkR3T4RTQLcjs.CLIP_TABLES.has(b.table)) return [b];
|
|
4166
4585
|
let v = shown.get(b);
|
|
4167
4586
|
if (!v) {
|
|
4168
4587
|
markContent([b]);
|
|
4169
|
-
shown.set(b, v =
|
|
4588
|
+
shown.set(b, v = _chunkS34OVRKDcjs.unframeLayoutTables.call(void 0, [b], !!_optionalChain([options, 'optionalAccess', _440 => _440.keepTrailingEmptyCols])));
|
|
4170
4589
|
}
|
|
4171
4590
|
return v;
|
|
4172
4591
|
});
|
|
@@ -4175,13 +4594,13 @@ async function parsePdfDocument(buffer, options) {
|
|
|
4175
4594
|
blocks.length = 0;
|
|
4176
4595
|
for (const b of kept) blocks.push(b);
|
|
4177
4596
|
}
|
|
4178
|
-
const finishMarkdown = (bs) => mergeLinkRuns(cleanPdfText(
|
|
4179
|
-
if (_optionalChain([options, 'optionalAccess', _442 => _442.tableFormat]) === "gfm")
|
|
4597
|
+
const finishMarkdown = (bs) => mergeLinkRuns(cleanPdfText(_chunkS34OVRKDcjs.blocksToMarkdown.call(void 0, bs, { tableFormat: _optionalChain([options, 'optionalAccess', _441 => _441.tableFormat]) }), { keepLoneNumbers: true }));
|
|
4598
|
+
if (_optionalChain([options, 'optionalAccess', _442 => _442.tableFormat]) === "gfm") _chunkS34OVRKDcjs.assignTableIds.call(void 0, blocks);
|
|
4180
4599
|
let markdown = finishMarkdown(outBlocks);
|
|
4181
4600
|
const outline = collectPdfOutline(outBlocks);
|
|
4182
4601
|
return {
|
|
4183
4602
|
markdown,
|
|
4184
|
-
pages:
|
|
4603
|
+
pages: _chunkTN4SSNEScjs.blocksToPages.call(void 0, splitPageTables(_chunkR3T4RTQLcjs.splitPageBreakWraps.call(void 0, outBlocks)), finishMarkdown),
|
|
4185
4604
|
blocks,
|
|
4186
4605
|
metadata,
|
|
4187
4606
|
outline: outline.length > 0 ? outline : void 0,
|
|
@@ -4261,5 +4680,5 @@ function marginStamp(items) {
|
|
|
4261
4680
|
|
|
4262
4681
|
|
|
4263
4682
|
|
|
4264
|
-
exports.PDFJS_DOCUMENT_OPTIONS = PDFJS_DOCUMENT_OPTIONS; exports.cleanPdfText = cleanPdfText; exports.detectKoreanListBlocks =
|
|
4265
|
-
//# sourceMappingURL=parser-
|
|
4683
|
+
exports.PDFJS_DOCUMENT_OPTIONS = PDFJS_DOCUMENT_OPTIONS; exports.cleanPdfText = cleanPdfText; exports.detectKoreanListBlocks = _chunkR3T4RTQLcjs.detectKoreanListBlocks; exports.detectTableCaptions = _chunkR3T4RTQLcjs.detectTableCaptions; exports.extractPdfMetadataOnly = extractPdfMetadataOnly; exports.mergeCrossPageTables = mergeCrossPageTables; exports.ocrImageRegions = ocrImageRegions; exports.parsePdfDocument = parsePdfDocument; exports.removeHeaderFooterBlocks = _chunkR3T4RTQLcjs.removeHeaderFooterBlocks;
|
|
4684
|
+
//# sourceMappingURL=parser-CGKXEB3U.cjs.map
|