kordoc 3.5.2 → 3.5.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.
package/dist/mcp.js CHANGED
@@ -10,7 +10,7 @@ import {
10
10
  parse,
11
11
  patchHwp,
12
12
  patchHwpx
13
- } from "./chunk-DN5LTND6.js";
13
+ } from "./chunk-GUDFEDFK.js";
14
14
  import {
15
15
  detectFormat,
16
16
  detectZipFormat
@@ -21,7 +21,7 @@ import {
21
21
  blocksToMarkdown,
22
22
  sanitizeError,
23
23
  toArrayBuffer
24
- } from "./chunk-NOIHZQWC.js";
24
+ } from "./chunk-3Z2RAKIL.js";
25
25
  import "./chunk-MOL7MDBG.js";
26
26
 
27
27
  // src/mcp.ts
@@ -193,7 +193,7 @@ server.tool(
193
193
  break;
194
194
  case "pdf":
195
195
  try {
196
- const { extractPdfMetadataOnly } = await import("./parser-KDF76UCB.js");
196
+ const { extractPdfMetadataOnly } = await import("./parser-IAROZTY3.js");
197
197
  metadata = await extractPdfMetadataOnly(buffer);
198
198
  } catch {
199
199
  metadata = void 0;
@@ -6,7 +6,7 @@
6
6
 
7
7
 
8
8
 
9
- var _chunkG44XLS26cjs = require('./chunk-G44XLS26.cjs');
9
+ var _chunk53XNKPN6cjs = require('./chunk-53XNKPN6.cjs');
10
10
 
11
11
 
12
12
  var _chunkDCZVOIEOcjs = require('./chunk-DCZVOIEO.cjs');
@@ -1496,7 +1496,7 @@ async function loadPdfWithTimeout(buffer) {
1496
1496
  new Promise((_, reject) => {
1497
1497
  timer = setTimeout(() => {
1498
1498
  loadingTask.destroy();
1499
- reject(new (0, _chunkG44XLS26cjs.KordocError)("PDF \uB85C\uB529 \uD0C0\uC784\uC544\uC6C3 (30\uCD08 \uCD08\uACFC)"));
1499
+ reject(new (0, _chunk53XNKPN6cjs.KordocError)("PDF \uB85C\uB529 \uD0C0\uC784\uC544\uC6C3 (30\uCD08 \uCD08\uACFC)"));
1500
1500
  }, PDF_LOAD_TIMEOUT_MS);
1501
1501
  })
1502
1502
  ]);
@@ -1509,7 +1509,7 @@ async function parsePdfDocument(buffer, options) {
1509
1509
  const doc = await loadPdfWithTimeout(buffer);
1510
1510
  try {
1511
1511
  const pageCount = doc.numPages;
1512
- if (pageCount === 0) throw new (0, _chunkG44XLS26cjs.KordocError)("PDF\uC5D0 \uD398\uC774\uC9C0\uAC00 \uC5C6\uC2B5\uB2C8\uB2E4.");
1512
+ if (pageCount === 0) throw new (0, _chunk53XNKPN6cjs.KordocError)("PDF\uC5D0 \uD398\uC774\uC9C0\uAC00 \uC5C6\uC2B5\uB2C8\uB2E4.");
1513
1513
  const metadata = { pageCount };
1514
1514
  await extractPdfMetadata(doc, metadata);
1515
1515
  const blocks = [];
@@ -1569,11 +1569,11 @@ async function parsePdfDocument(buffer, options) {
1569
1569
  pageText += pageText ? "\n" + t : t;
1570
1570
  }
1571
1571
  pageQuality.push(computePageQuality(i, pageText));
1572
- if (totalTextBytes > MAX_TOTAL_TEXT) throw new (0, _chunkG44XLS26cjs.KordocError)("\uD14D\uC2A4\uD2B8 \uCD94\uCD9C \uD06C\uAE30 \uCD08\uACFC");
1572
+ if (totalTextBytes > MAX_TOTAL_TEXT) throw new (0, _chunk53XNKPN6cjs.KordocError)("\uD14D\uC2A4\uD2B8 \uCD94\uCD9C \uD06C\uAE30 \uCD08\uACFC");
1573
1573
  parsedPages++;
1574
1574
  _optionalChain([options, 'optionalAccess', _12 => _12.onProgress, 'optionalCall', _13 => _13(parsedPages, totalTarget)]);
1575
1575
  } catch (pageErr) {
1576
- if (pageErr instanceof _chunkG44XLS26cjs.KordocError) throw pageErr;
1576
+ if (pageErr instanceof _chunk53XNKPN6cjs.KordocError) throw pageErr;
1577
1577
  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" });
1578
1578
  }
1579
1579
  }
@@ -1641,7 +1641,7 @@ async function parsePdfDocument(buffer, options) {
1641
1641
  detectKoreanListBlocks(blocks);
1642
1642
  const outline = blocks.filter((b) => b.type === "heading" && b.level && b.text).map((b) => ({ level: b.level, text: b.text, pageNumber: b.pageNumber }));
1643
1643
  sanitizeBlockControlChars(blocks);
1644
- let markdown = cleanPdfText(_chunkG44XLS26cjs.blocksToMarkdown.call(void 0, blocks));
1644
+ let markdown = cleanPdfText(_chunk53XNKPN6cjs.blocksToMarkdown.call(void 0, blocks));
1645
1645
  return {
1646
1646
  markdown,
1647
1647
  blocks,
@@ -1729,9 +1729,9 @@ function detectHeadings(blocks, medianFontSize) {
1729
1729
  if (/^\d+$/.test(text)) continue;
1730
1730
  const ratio = block.style.fontSize / medianFontSize;
1731
1731
  let level = 0;
1732
- if (ratio >= _chunkG44XLS26cjs.HEADING_RATIO_H1) level = 1;
1733
- else if (ratio >= _chunkG44XLS26cjs.HEADING_RATIO_H2) level = 2;
1734
- else if (ratio >= _chunkG44XLS26cjs.HEADING_RATIO_H3) level = 3;
1732
+ if (ratio >= _chunk53XNKPN6cjs.HEADING_RATIO_H1) level = 1;
1733
+ else if (ratio >= _chunk53XNKPN6cjs.HEADING_RATIO_H2) level = 2;
1734
+ else if (ratio >= _chunk53XNKPN6cjs.HEADING_RATIO_H3) level = 3;
1735
1735
  if (level > 0) {
1736
1736
  block.type = "heading";
1737
1737
  block.level = level;
@@ -2136,7 +2136,7 @@ function extractBlocksWithGrids(items, pageNum, grids, horizontals, verticals) {
2136
2136
  }
2137
2137
  if (remaining.length > 0) {
2138
2138
  const allY = remaining.map((i) => i.y);
2139
- const pageH = _chunkG44XLS26cjs.safeMax.call(void 0, allY) - _chunkG44XLS26cjs.safeMin.call(void 0, allY);
2139
+ const pageH = _chunk53XNKPN6cjs.safeMax.call(void 0, allY) - _chunk53XNKPN6cjs.safeMin.call(void 0, allY);
2140
2140
  const groups = xyCutOrder(remaining, Math.max(15, pageH * 0.03));
2141
2141
  const textBlocks = [];
2142
2142
  for (const group of groups) {
@@ -2265,7 +2265,7 @@ function extractPageBlocksFallback(items, pageNum) {
2265
2265
  blocks.push({ type: "paragraph", text: tableText, pageNumber: pageNum, bbox, style: dominantStyle(items) });
2266
2266
  } else {
2267
2267
  const allY = items.map((i) => i.y);
2268
- const pageHeight = _chunkG44XLS26cjs.safeMax.call(void 0, allY) - _chunkG44XLS26cjs.safeMin.call(void 0, allY);
2268
+ const pageHeight = _chunk53XNKPN6cjs.safeMax.call(void 0, allY) - _chunk53XNKPN6cjs.safeMin.call(void 0, allY);
2269
2269
  const gapThreshold = Math.max(15, pageHeight * 0.03);
2270
2270
  const orderedGroups = xyCutOrder(items, gapThreshold);
2271
2271
  for (const group of orderedGroups) {
@@ -2441,14 +2441,14 @@ function isProseSpread(items) {
2441
2441
  for (let i = 1; i < sorted.length; i++) {
2442
2442
  gaps.push(sorted[i].x - (sorted[i - 1].x + sorted[i - 1].w));
2443
2443
  }
2444
- const maxGap = _chunkG44XLS26cjs.safeMax.call(void 0, gaps);
2444
+ const maxGap = _chunk53XNKPN6cjs.safeMax.call(void 0, gaps);
2445
2445
  const avgLen = items.reduce((s, i) => s + i.text.length, 0) / items.length;
2446
2446
  return maxGap < 40 && avgLen < 5;
2447
2447
  }
2448
2448
  function detectColumns(yLines) {
2449
2449
  const allItems = yLines.flat();
2450
2450
  if (allItems.length === 0) return null;
2451
- const pageWidth = _chunkG44XLS26cjs.safeMax.call(void 0, allItems.map((i) => i.x + i.w)) - _chunkG44XLS26cjs.safeMin.call(void 0, allItems.map((i) => i.x));
2451
+ const pageWidth = _chunk53XNKPN6cjs.safeMax.call(void 0, allItems.map((i) => i.x + i.w)) - _chunk53XNKPN6cjs.safeMin.call(void 0, allItems.map((i) => i.x));
2452
2452
  if (pageWidth < 100) return null;
2453
2453
  let bigoLineIdx = -1;
2454
2454
  for (let i = 0; i < yLines.length; i++) {
@@ -3144,4 +3144,4 @@ function formatMb(bytes) {
3144
3144
 
3145
3145
 
3146
3146
  exports.cleanPdfText = cleanPdfText; exports.detectKoreanListBlocks = detectKoreanListBlocks; exports.detectTableCaptions = detectTableCaptions; exports.extractPdfMetadataOnly = extractPdfMetadataOnly; exports.mergeCrossPageTables = mergeCrossPageTables; exports.parsePdfDocument = parsePdfDocument; exports.removeHeaderFooterBlocks = removeHeaderFooterBlocks;
3147
- //# sourceMappingURL=parser-2O276TRF.cjs.map
3147
+ //# sourceMappingURL=parser-CK5C6FF4.cjs.map