kordoc 3.8.2 → 3.8.3

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.
@@ -6,7 +6,7 @@
6
6
 
7
7
 
8
8
 
9
- var _chunkYBPNKFJWcjs = require('./chunk-YBPNKFJW.cjs');
9
+ var _chunkXL6O3VAYcjs = require('./chunk-XL6O3VAY.cjs');
10
10
 
11
11
 
12
12
  var _chunkDCZVOIEOcjs = require('./chunk-DCZVOIEO.cjs');
@@ -1265,7 +1265,106 @@ function detectClusterTables(items, pageNum) {
1265
1265
  }
1266
1266
  }
1267
1267
  }
1268
- return results;
1268
+ return results.filter((r) => !isTwoColumnProse(r));
1269
+ }
1270
+ function isTwoColumnProse(r) {
1271
+ const t = r.table;
1272
+ if (t.rows < 8) return false;
1273
+ const dense = [];
1274
+ for (let c = 0; c < t.cols; c++) {
1275
+ const filled = t.cells.filter((row) => _optionalChain([row, 'access', _9 => _9[c], 'optionalAccess', _10 => _10.text, 'access', _11 => _11.trim, 'call', _12 => _12()])).length;
1276
+ if (filled / t.rows >= 0.3) dense.push(c);
1277
+ }
1278
+ if (dense.length !== 2) return false;
1279
+ for (const c of dense) {
1280
+ const lens = t.cells.map((row) => _nullishCoalesce(_optionalChain([row, 'access', _13 => _13[c], 'optionalAccess', _14 => _14.text, 'access', _15 => _15.replace, 'call', _16 => _16(/\s+/g, ""), 'access', _17 => _17.length]), () => ( 0))).filter((n) => n > 0);
1281
+ const avg = lens.reduce((s, v) => s + v, 0) / (lens.length || 1);
1282
+ if (avg < 12) return false;
1283
+ }
1284
+ return findTwoColumnProseCutX([...r.usedItems]) !== null;
1285
+ }
1286
+ function findTwoColumnProseCutX(items) {
1287
+ const lines = groupByBaseline(items);
1288
+ if (lines.length < 8) return null;
1289
+ let minX = Infinity;
1290
+ let maxX = -Infinity;
1291
+ for (const i of items) {
1292
+ if (i.x < minX) minX = i.x;
1293
+ if (i.x + i.w > maxX) maxX = i.x + i.w;
1294
+ }
1295
+ if (!Number.isFinite(maxX - minX)) return null;
1296
+ if (maxX - minX < 100) return null;
1297
+ const lo = minX + (maxX - minX) * 0.3;
1298
+ const hi = minX + (maxX - minX) * 0.7;
1299
+ const step = Math.max(2, (hi - lo) / 400);
1300
+ let cutX = 0;
1301
+ let bestCover = Infinity;
1302
+ for (let x = lo; x <= hi; x += step) {
1303
+ let cover = 0;
1304
+ for (const line of lines) {
1305
+ if (line.items.some((i) => i.x < x && i.x + i.w > x)) cover++;
1306
+ }
1307
+ if (cover < bestCover) {
1308
+ bestCover = cover;
1309
+ cutX = x;
1310
+ }
1311
+ }
1312
+ if (bestCover / lines.length > 0.15) return null;
1313
+ const left = [];
1314
+ const right = [];
1315
+ let twoSide = 0;
1316
+ for (const line of lines) {
1317
+ let hasL = false;
1318
+ let hasR = false;
1319
+ for (const i of line.items) {
1320
+ if (i.x + i.w <= cutX) {
1321
+ left.push(i);
1322
+ hasL = true;
1323
+ } else if (i.x >= cutX) {
1324
+ right.push(i);
1325
+ hasR = true;
1326
+ }
1327
+ }
1328
+ if (hasL && hasR) twoSide++;
1329
+ }
1330
+ if (twoSide / lines.length < 0.55) return null;
1331
+ if (left.length < 5 || right.length < 5) return null;
1332
+ const allText = items.map((i) => i.text).join("").replace(/\s+/g, "");
1333
+ const digits = (allText.match(/[\d,.%△—-]/g) || []).length;
1334
+ if (allText.length === 0 || digits / allText.length > 0.15) return null;
1335
+ const stats = [left, right].map((side) => {
1336
+ let sMinX = Infinity;
1337
+ let sMaxR = -Infinity;
1338
+ let fsSum = 0;
1339
+ const rowEnds = /* @__PURE__ */ new Map();
1340
+ const rowLens = /* @__PURE__ */ new Map();
1341
+ const rowFirst = /* @__PURE__ */ new Map();
1342
+ for (const i of side) {
1343
+ if (i.x < sMinX) sMinX = i.x;
1344
+ const rgt = i.x + i.w;
1345
+ if (rgt > sMaxR) sMaxR = rgt;
1346
+ fsSum += i.fontSize;
1347
+ const key = Math.round(i.y / 4);
1348
+ rowEnds.set(key, Math.max(_nullishCoalesce(rowEnds.get(key), () => ( -Infinity)), rgt));
1349
+ rowLens.set(key, (_nullishCoalesce(rowLens.get(key), () => ( 0))) + i.text.replace(/\s+/g, "").length);
1350
+ const f = rowFirst.get(key);
1351
+ if (!f || i.x < f.x) rowFirst.set(key, i);
1352
+ }
1353
+ const ends = [...rowEnds.values()].sort((a, b) => a - b);
1354
+ const p85 = _nullishCoalesce(ends[Math.floor(ends.length * 0.85)], () => ( sMaxR));
1355
+ const fs = fsSum / side.length;
1356
+ const justified = ends.filter((e) => Math.abs(e - p85) <= fs).length / ends.length;
1357
+ const lens = [...rowLens.values()];
1358
+ const avgLen = lens.reduce((s, v) => s + v, 0) / (lens.length || 1);
1359
+ const markers = [...rowFirst.values()].filter((i) => /^[•▪◦‣∙·\-–—□■◇◆▶※*]/.test(i.text)).length;
1360
+ return { width: sMaxR - sMinX, justified, avgLen, markerRatio: markers / (rowFirst.size || 1) };
1361
+ });
1362
+ if (stats.some((s) => s.avgLen < 12)) return null;
1363
+ if (stats.some((s) => s.markerRatio > 0.1)) return null;
1364
+ const widthSym = Math.min(stats[0].width, stats[1].width) / Math.max(stats[0].width, stats[1].width);
1365
+ if (widthSym < 0.6) return null;
1366
+ if (Math.min(stats[0].justified, stats[1].justified) < 0.55) return null;
1367
+ return cutX;
1269
1368
  }
1270
1369
  function mergeEvenSpacedClusters(items) {
1271
1370
  const originMap = /* @__PURE__ */ new Map();
@@ -1655,7 +1754,7 @@ function buildClusterTable(rows, columns, pageNum) {
1655
1754
  const nonEmptyCols = cells[r].filter((c) => c.text.trim()).length;
1656
1755
  if (nonEmptyCols !== 1) continue;
1657
1756
  if (cells[r][0].text.trim() !== "") continue;
1658
- const contentText = _optionalChain([cells, 'access', _9 => _9[r], 'access', _10 => _10.find, 'call', _11 => _11((c) => c.text.trim()), 'optionalAccess', _12 => _12.text, 'access', _13 => _13.trim, 'call', _14 => _14()]) || "";
1757
+ const contentText = _optionalChain([cells, 'access', _18 => _18[r], 'access', _19 => _19.find, 'call', _20 => _20((c) => c.text.trim()), 'optionalAccess', _21 => _21.text, 'access', _22 => _22.trim, 'call', _23 => _23()]) || "";
1659
1758
  if (/^[○●▶\-·]/.test(contentText)) continue;
1660
1759
  for (let pr = r - 1; pr >= 0; pr--) {
1661
1760
  if (cells[pr].some((c) => c.text.trim())) {
@@ -1877,14 +1976,14 @@ function isProseSpread(items) {
1877
1976
  for (let i = 1; i < sorted.length; i++) {
1878
1977
  gaps.push(sorted[i].x - (sorted[i - 1].x + sorted[i - 1].w));
1879
1978
  }
1880
- const maxGap = _chunkYBPNKFJWcjs.safeMax.call(void 0, gaps);
1979
+ const maxGap = _chunkXL6O3VAYcjs.safeMax.call(void 0, gaps);
1881
1980
  const avgLen = items.reduce((s, i) => s + i.text.length, 0) / items.length;
1882
1981
  return maxGap < 40 && avgLen < 5;
1883
1982
  }
1884
1983
  function detectColumns(yLines) {
1885
1984
  const allItems = yLines.flat();
1886
1985
  if (allItems.length === 0) return null;
1887
- const pageWidth = _chunkYBPNKFJWcjs.safeMax.call(void 0, allItems.map((i) => i.x + i.w)) - _chunkYBPNKFJWcjs.safeMin.call(void 0, allItems.map((i) => i.x));
1986
+ const pageWidth = _chunkXL6O3VAYcjs.safeMax.call(void 0, allItems.map((i) => i.x + i.w)) - _chunkXL6O3VAYcjs.safeMin.call(void 0, allItems.map((i) => i.x));
1888
1987
  if (pageWidth < 100) return null;
1889
1988
  let bigoLineIdx = -1;
1890
1989
  for (let i = 0; i < yLines.length; i++) {
@@ -2100,15 +2199,15 @@ function computeMedianFontSizeFromFreq(freq) {
2100
2199
  }
2101
2200
  function detectHeadings(blocks, medianFontSize) {
2102
2201
  for (const block of blocks) {
2103
- if (block.type !== "paragraph" || !block.text || !_optionalChain([block, 'access', _15 => _15.style, 'optionalAccess', _16 => _16.fontSize])) continue;
2202
+ if (block.type !== "paragraph" || !block.text || !_optionalChain([block, 'access', _24 => _24.style, 'optionalAccess', _25 => _25.fontSize])) continue;
2104
2203
  const text = block.text.trim();
2105
2204
  if (text.length === 0 || text.length > 200) continue;
2106
2205
  if (/^\d+$/.test(text)) continue;
2107
2206
  const ratio = block.style.fontSize / medianFontSize;
2108
2207
  let level = 0;
2109
- if (ratio >= _chunkYBPNKFJWcjs.HEADING_RATIO_H1) level = 1;
2110
- else if (ratio >= _chunkYBPNKFJWcjs.HEADING_RATIO_H2) level = 2;
2111
- else if (ratio >= _chunkYBPNKFJWcjs.HEADING_RATIO_H3) level = 3;
2208
+ if (ratio >= _chunkXL6O3VAYcjs.HEADING_RATIO_H1) level = 1;
2209
+ else if (ratio >= _chunkXL6O3VAYcjs.HEADING_RATIO_H2) level = 2;
2210
+ else if (ratio >= _chunkXL6O3VAYcjs.HEADING_RATIO_H3) level = 3;
2112
2211
  if (level > 0) {
2113
2212
  block.type = "heading";
2114
2213
  block.level = level;
@@ -2157,7 +2256,7 @@ function detectMarkerHeadings(blocks) {
2157
2256
  block.level = 4;
2158
2257
  continue;
2159
2258
  }
2160
- if (/^[가-힣]{2,6}$/.test(text) && _optionalChain([block, 'access', _17 => _17.style, 'optionalAccess', _18 => _18.fontSize])) {
2259
+ if (/^[가-힣]{2,6}$/.test(text) && _optionalChain([block, 'access', _26 => _26.style, 'optionalAccess', _27 => _27.fontSize])) {
2161
2260
  const prev = blocks[i - 1];
2162
2261
  const next = blocks[i + 1];
2163
2262
  const prevIsStructural = !prev || prev.type === "table" || prev.type === "heading" || prev.type === "separator";
@@ -2410,7 +2509,7 @@ function removeHeaderFooterBlocks(blocks, pageHeights, warnings) {
2410
2509
  const bottomEntries = [];
2411
2510
  for (let bi = 0; bi < blocks.length; bi++) {
2412
2511
  const b = blocks[bi];
2413
- if (!b.bbox || !b.pageNumber || !_optionalChain([b, 'access', _19 => _19.text, 'optionalAccess', _20 => _20.trim, 'call', _21 => _21()])) continue;
2512
+ if (!b.bbox || !b.pageNumber || !_optionalChain([b, 'access', _28 => _28.text, 'optionalAccess', _29 => _29.trim, 'call', _30 => _30()])) continue;
2414
2513
  const ph = pageHeights.get(b.bbox.page) || pageHeights.get(b.pageNumber);
2415
2514
  if (!ph) continue;
2416
2515
  const blockTop = ph - (b.bbox.y + b.bbox.height);
@@ -2433,7 +2532,7 @@ function removeHeaderFooterBlocks(blocks, pageHeights, warnings) {
2433
2532
  }
2434
2533
  const repeatedPatterns = /* @__PURE__ */ new Set();
2435
2534
  for (const [p, count] of patternCount) {
2436
- if (count >= MIN_REPEAT && (_nullishCoalesce(_optionalChain([patternPages, 'access', _22 => _22.get, 'call', _23 => _23(p), 'optionalAccess', _24 => _24.size]), () => ( 0))) >= MIN_REPEAT) {
2535
+ if (count >= MIN_REPEAT && (_nullishCoalesce(_optionalChain([patternPages, 'access', _31 => _31.get, 'call', _32 => _32(p), 'optionalAccess', _33 => _33.size]), () => ( 0))) >= MIN_REPEAT) {
2437
2536
  repeatedPatterns.add(p);
2438
2537
  }
2439
2538
  }
@@ -2462,7 +2561,7 @@ function extractPageBlocksWithLines(items, pageNum, opList, pageWidth, pageHeigh
2462
2561
  if (grids.length > 0) {
2463
2562
  return extractBlocksWithGrids(items, pageNum, grids, horizontals, verticals);
2464
2563
  }
2465
- return extractPageBlocksFallback(items, pageNum);
2564
+ return extractPageBlocksFallback(items, pageNum, true);
2466
2565
  }
2467
2566
  var STRIKE_MAX_THICKNESS = 2;
2468
2567
  var STRIKE_MAX_THICKNESS_RATIO = 0.25;
@@ -2627,7 +2726,7 @@ function extractBlocksWithGrids(items, pageNum, grids, horizontals, verticals) {
2627
2726
  }
2628
2727
  if (remaining.length > 0) {
2629
2728
  const allY = remaining.map((i) => i.y);
2630
- const pageH = _chunkYBPNKFJWcjs.safeMax.call(void 0, allY) - _chunkYBPNKFJWcjs.safeMin.call(void 0, allY);
2729
+ const pageH = _chunkXL6O3VAYcjs.safeMax.call(void 0, allY) - _chunkXL6O3VAYcjs.safeMin.call(void 0, allY);
2631
2730
  const groups = xyCutOrder(remaining, Math.max(15, pageH * 0.03));
2632
2731
  const textBlocks = [];
2633
2732
  for (const group of groups) {
@@ -2707,7 +2806,53 @@ function mergeAdjacentTableBlocks(blocks) {
2707
2806
  }
2708
2807
  return result;
2709
2808
  }
2710
- function extractPageBlocksFallback(items, pageNum) {
2809
+ function splitTwoColumnProse(items, cutX) {
2810
+ const left = [];
2811
+ const right = [];
2812
+ const cross = [];
2813
+ for (const i of items) {
2814
+ if (i.x + i.w <= cutX) left.push(i);
2815
+ else if (i.x >= cutX) right.push(i);
2816
+ else cross.push(i);
2817
+ }
2818
+ if (cross.length === 0) {
2819
+ return [left, right].filter((g2) => g2.length > 0);
2820
+ }
2821
+ cross.sort((a, b) => b.y - a.y);
2822
+ const crossLines = [];
2823
+ for (const c of cross) {
2824
+ const last = crossLines[crossLines.length - 1];
2825
+ if (last && Math.abs(last[0].y - c.y) <= 3) last.push(c);
2826
+ else crossLines.push([c]);
2827
+ }
2828
+ const bandItem = (arr) => arr.filter((i) => {
2829
+ for (const cl of crossLines) {
2830
+ if (Math.abs(cl[0].y - i.y) <= 3) {
2831
+ cl.push(i);
2832
+ return false;
2833
+ }
2834
+ }
2835
+ return true;
2836
+ });
2837
+ const leftRest = bandItem(left);
2838
+ const rightRest = bandItem(right);
2839
+ const boundYs = crossLines.map((cl) => cl[0].y);
2840
+ const bandOf = (y) => {
2841
+ let k = 0;
2842
+ while (k < boundYs.length && y < boundYs[k]) k++;
2843
+ return k;
2844
+ };
2845
+ const groups = [];
2846
+ for (let k = 0; k <= crossLines.length; k++) {
2847
+ const L = leftRest.filter((i) => bandOf(i.y) === k);
2848
+ const R = rightRest.filter((i) => bandOf(i.y) === k);
2849
+ if (L.length > 0) groups.push(L);
2850
+ if (R.length > 0) groups.push(R);
2851
+ if (k < crossLines.length) groups.push(crossLines[k]);
2852
+ }
2853
+ return groups;
2854
+ }
2855
+ function extractPageBlocksFallback(items, pageNum, fullPage = false) {
2711
2856
  if (items.length === 0) return [];
2712
2857
  const blocks = [];
2713
2858
  const clusterItems = items.map((i) => ({
@@ -2748,17 +2893,18 @@ function extractPageBlocksFallback(items, pageNum) {
2748
2893
  return by - ay;
2749
2894
  });
2750
2895
  } else {
2896
+ const proseCutX = fullPage ? findTwoColumnProseCutX(items) : null;
2751
2897
  const allYLines = mergeSuperscriptLines(groupByY(items));
2752
- const columns = detectColumns(allYLines);
2898
+ const columns = proseCutX !== null ? null : detectColumns(allYLines);
2753
2899
  if (columns && columns.length >= 3) {
2754
2900
  const tableText = extractWithColumns(allYLines, columns);
2755
2901
  const bbox = computeBBox(items, pageNum);
2756
2902
  blocks.push({ type: "paragraph", text: tableText, pageNumber: pageNum, bbox, style: dominantStyle(items) });
2757
2903
  } else {
2758
2904
  const allY = items.map((i) => i.y);
2759
- const pageHeight = _chunkYBPNKFJWcjs.safeMax.call(void 0, allY) - _chunkYBPNKFJWcjs.safeMin.call(void 0, allY);
2905
+ const pageHeight = _chunkXL6O3VAYcjs.safeMax.call(void 0, allY) - _chunkXL6O3VAYcjs.safeMin.call(void 0, allY);
2760
2906
  const gapThreshold = Math.max(15, pageHeight * 0.03);
2761
- const orderedGroups = xyCutOrder(items, gapThreshold);
2907
+ const orderedGroups = proseCutX !== null ? splitTwoColumnProse(items, proseCutX) : xyCutOrder(items, gapThreshold);
2762
2908
  for (const group of orderedGroups) {
2763
2909
  if (group.length === 0) continue;
2764
2910
  const yLines = mergeSuperscriptLines(groupByY(group));
@@ -3009,7 +3155,7 @@ async function loadPdfWithTimeout(buffer) {
3009
3155
  new Promise((_, reject) => {
3010
3156
  timer = setTimeout(() => {
3011
3157
  loadingTask.destroy();
3012
- reject(new (0, _chunkYBPNKFJWcjs.KordocError)("PDF \uB85C\uB529 \uD0C0\uC784\uC544\uC6C3 (30\uCD08 \uCD08\uACFC)"));
3158
+ reject(new (0, _chunkXL6O3VAYcjs.KordocError)("PDF \uB85C\uB529 \uD0C0\uC784\uC544\uC6C3 (30\uCD08 \uCD08\uACFC)"));
3013
3159
  }, PDF_LOAD_TIMEOUT_MS);
3014
3160
  })
3015
3161
  ]);
@@ -3018,11 +3164,11 @@ async function loadPdfWithTimeout(buffer) {
3018
3164
  }
3019
3165
  }
3020
3166
  async function parsePdfDocument(buffer, options) {
3021
- const formulaBuffer = _optionalChain([options, 'optionalAccess', _25 => _25.formulaOcr]) ? buffer.slice(0) : null;
3167
+ const formulaBuffer = _optionalChain([options, 'optionalAccess', _34 => _34.formulaOcr]) ? buffer.slice(0) : null;
3022
3168
  const doc = await loadPdfWithTimeout(buffer);
3023
3169
  try {
3024
3170
  const pageCount = doc.numPages;
3025
- if (pageCount === 0) throw new (0, _chunkYBPNKFJWcjs.KordocError)("PDF\uC5D0 \uD398\uC774\uC9C0\uAC00 \uC5C6\uC2B5\uB2C8\uB2E4.");
3171
+ if (pageCount === 0) throw new (0, _chunkXL6O3VAYcjs.KordocError)("PDF\uC5D0 \uD398\uC774\uC9C0\uAC00 \uC5C6\uC2B5\uB2C8\uB2E4.");
3026
3172
  const metadata = { pageCount };
3027
3173
  await extractPdfMetadata(doc, metadata);
3028
3174
  const blocks = [];
@@ -3031,7 +3177,7 @@ async function parsePdfDocument(buffer, options) {
3031
3177
  let totalChars = 0;
3032
3178
  let totalTextBytes = 0;
3033
3179
  const effectivePageCount = Math.min(pageCount, MAX_PAGES);
3034
- const pageFilter = _optionalChain([options, 'optionalAccess', _26 => _26.pages]) ? _chunkDCZVOIEOcjs.parsePageRange.call(void 0, options.pages, effectivePageCount) : null;
3180
+ const pageFilter = _optionalChain([options, 'optionalAccess', _35 => _35.pages]) ? _chunkDCZVOIEOcjs.parsePageRange.call(void 0, options.pages, effectivePageCount) : null;
3035
3181
  const totalTarget = pageFilter ? pageFilter.size : effectivePageCount;
3036
3182
  const fontSizeFreq = /* @__PURE__ */ new Map();
3037
3183
  const pageHeights = /* @__PURE__ */ new Map();
@@ -3082,18 +3228,18 @@ async function parsePdfDocument(buffer, options) {
3082
3228
  pageText += pageText ? "\n" + t : t;
3083
3229
  }
3084
3230
  pageQuality.push(computePageQuality(i, pageText));
3085
- if (totalTextBytes > MAX_TOTAL_TEXT) throw new (0, _chunkYBPNKFJWcjs.KordocError)("\uD14D\uC2A4\uD2B8 \uCD94\uCD9C \uD06C\uAE30 \uCD08\uACFC");
3231
+ if (totalTextBytes > MAX_TOTAL_TEXT) throw new (0, _chunkXL6O3VAYcjs.KordocError)("\uD14D\uC2A4\uD2B8 \uCD94\uCD9C \uD06C\uAE30 \uCD08\uACFC");
3086
3232
  parsedPages++;
3087
- _optionalChain([options, 'optionalAccess', _27 => _27.onProgress, 'optionalCall', _28 => _28(parsedPages, totalTarget)]);
3233
+ _optionalChain([options, 'optionalAccess', _36 => _36.onProgress, 'optionalCall', _37 => _37(parsedPages, totalTarget)]);
3088
3234
  } catch (pageErr) {
3089
- if (pageErr instanceof _chunkYBPNKFJWcjs.KordocError) throw pageErr;
3235
+ if (pageErr instanceof _chunkXL6O3VAYcjs.KordocError) throw pageErr;
3090
3236
  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" });
3091
3237
  }
3092
3238
  }
3093
3239
  const parsedPageCount = parsedPages || (pageFilter ? pageFilter.size : effectivePageCount);
3094
3240
  let isImageBased = false;
3095
3241
  if (totalChars / Math.max(parsedPageCount, 1) < 10) {
3096
- if (_optionalChain([options, 'optionalAccess', _29 => _29.ocr])) {
3242
+ if (_optionalChain([options, 'optionalAccess', _38 => _38.ocr])) {
3097
3243
  try {
3098
3244
  const { ocrPages } = await Promise.resolve().then(() => _interopRequireWildcard(require("./provider-G4C2V2PD.cjs")));
3099
3245
  const ocrBlocks = await ocrPages(doc, options.ocr, pageFilter, effectivePageCount);
@@ -3128,14 +3274,14 @@ async function parsePdfDocument(buffer, options) {
3128
3274
  warnings.push({ page, message: `${count}\uAC1C \uC774\uBBF8\uC9C0 \uC601\uC5ED\uC5D0 \uCD94\uCD9C \uAC00\uB2A5\uD55C \uD14D\uC2A4\uD2B8 \uC5C6\uC74C (\uADF8\uB9BC/\uCC28\uD2B8/\uB3C4\uC7A5 \uB0B4\uC6A9 \uB204\uB77D \uAC00\uB2A5)`, code: "SKIPPED_IMAGE" });
3129
3275
  }
3130
3276
  }
3131
- if (_optionalChain([options, 'optionalAccess', _30 => _30.removeHeaderFooter]) !== false && parsedPageCount >= 3) {
3277
+ if (_optionalChain([options, 'optionalAccess', _39 => _39.removeHeaderFooter]) !== false && parsedPageCount >= 3) {
3132
3278
  const removed = removeHeaderFooterBlocks(blocks, pageHeights, warnings);
3133
3279
  for (let ri = removed.length - 1; ri >= 0; ri--) {
3134
3280
  blocks.splice(removed[ri], 1);
3135
3281
  }
3136
3282
  }
3137
3283
  mergeCrossPageTables(blocks);
3138
- if (_optionalChain([options, 'optionalAccess', _31 => _31.formulaOcr]) && formulaBuffer) {
3284
+ if (_optionalChain([options, 'optionalAccess', _40 => _40.formulaOcr]) && formulaBuffer) {
3139
3285
  try {
3140
3286
  await applyFormulaOcr(formulaBuffer, blocks, pageFilter, effectivePageCount, warnings, options.onProgress);
3141
3287
  } catch (e) {
@@ -3154,7 +3300,7 @@ async function parsePdfDocument(buffer, options) {
3154
3300
  detectKoreanListBlocks(blocks);
3155
3301
  const outline = blocks.filter((b) => b.type === "heading" && b.level && b.text).map((b) => ({ level: b.level, text: b.text, pageNumber: b.pageNumber }));
3156
3302
  sanitizeBlockControlChars(blocks);
3157
- let markdown = cleanPdfText(_chunkYBPNKFJWcjs.blocksToMarkdown.call(void 0, blocks));
3303
+ let markdown = cleanPdfText(_chunkXL6O3VAYcjs.blocksToMarkdown.call(void 0, blocks));
3158
3304
  return {
3159
3305
  markdown,
3160
3306
  blocks,
@@ -3173,7 +3319,7 @@ async function parsePdfDocument(buffer, options) {
3173
3319
  async function extractPdfMetadata(doc, metadata) {
3174
3320
  try {
3175
3321
  const result = await doc.getMetadata();
3176
- if (!_optionalChain([result, 'optionalAccess', _32 => _32.info])) return;
3322
+ if (!_optionalChain([result, 'optionalAccess', _41 => _41.info])) return;
3177
3323
  const info = result.info;
3178
3324
  if (typeof info.Title === "string" && info.Title.trim()) metadata.title = info.Title.trim();
3179
3325
  if (typeof info.Author === "string" && info.Author.trim()) metadata.author = info.Author.trim();
@@ -3213,4 +3359,4 @@ async function extractPdfMetadataOnly(buffer) {
3213
3359
 
3214
3360
 
3215
3361
  exports.cleanPdfText = cleanPdfText; exports.detectKoreanListBlocks = detectKoreanListBlocks; exports.detectTableCaptions = detectTableCaptions; exports.extractPdfMetadataOnly = extractPdfMetadataOnly; exports.mergeCrossPageTables = mergeCrossPageTables; exports.parsePdfDocument = parsePdfDocument; exports.removeHeaderFooterBlocks = removeHeaderFooterBlocks;
3216
- //# sourceMappingURL=parser-NS4ZPD7B.cjs.map
3362
+ //# sourceMappingURL=parser-WWKYMRGJ.cjs.map