kordoc 4.19.0 → 4.19.2

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.
Files changed (127) hide show
  1. package/README.md +3 -1
  2. package/dist/{-I3DEUQUC.js → -3JIHF2AL.js} +11 -11
  3. package/dist/{chunk-CR4RXHXO.js → chunk-4CS7XE2Q.js} +2 -2
  4. package/dist/{chunk-UCTD3BXH.js → chunk-56ZWAREM.js} +2 -2
  5. package/dist/{chunk-YV4PWWRW.cjs → chunk-5PGOZBEQ.cjs} +22 -22
  6. package/dist/{chunk-YV4PWWRW.cjs.map → chunk-5PGOZBEQ.cjs.map} +1 -1
  7. package/dist/{chunk-OMJWAJBD.js → chunk-6ZBORHFB.js} +2 -2
  8. package/dist/{chunk-DH75ZUYF.js → chunk-AKSCTGKG.js} +10 -4
  9. package/dist/chunk-AKSCTGKG.js.map +1 -0
  10. package/dist/{chunk-L5KNWOGR.js → chunk-AOVMOCTK.js} +10 -4
  11. package/dist/chunk-AOVMOCTK.js.map +1 -0
  12. package/dist/{chunk-XXUXQHUC.js → chunk-B4R443MV.js} +2 -2
  13. package/dist/{chunk-RYKNAYKC.js → chunk-EUCBMW6C.js} +3 -3
  14. package/dist/{chunk-XIWGPC3V.js → chunk-GNUGD4RO.js} +2 -2
  15. package/dist/{chunk-AMDDV4CI.js → chunk-I2TBI7PN.js} +2 -2
  16. package/dist/{chunk-5B55S4JU.js → chunk-J75TVRJB.js} +2 -2
  17. package/dist/{chunk-VZSOPECZ.js → chunk-JK7N4R4K.js} +2 -2
  18. package/dist/{chunk-DEYCTP2S.js → chunk-JXJDXDOU.js} +3 -3
  19. package/dist/{chunk-34RIECIF.cjs → chunk-MZ6XNFZL.cjs} +2 -2
  20. package/dist/{chunk-34RIECIF.cjs.map → chunk-MZ6XNFZL.cjs.map} +1 -1
  21. package/dist/{chunk-C4JHZNRL.js → chunk-NV46IWKF.js} +27 -21
  22. package/dist/chunk-NV46IWKF.js.map +1 -0
  23. package/dist/{chunk-UTVNSCEI.js → chunk-OKHKEYTL.js} +2 -2
  24. package/dist/{chunk-LNU54ZKV.cjs → chunk-ORGWGR4K.cjs} +15 -9
  25. package/dist/chunk-ORGWGR4K.cjs.map +1 -0
  26. package/dist/{chunk-AAE765MK.js → chunk-PWQ2BVAT.js} +3 -3
  27. package/dist/{chunk-FJE3TMZ7.js → chunk-QYJPU4FZ.js} +30 -2
  28. package/dist/chunk-QYJPU4FZ.js.map +1 -0
  29. package/dist/{chunk-DGXGVC4Z.js → chunk-QZ63HXEG.js} +51 -20
  30. package/dist/chunk-QZ63HXEG.js.map +1 -0
  31. package/dist/{chunk-GCYLNOTJ.js → chunk-R2JM2HOJ.js} +4 -4
  32. package/dist/{chunk-LLVF6X5W.cjs → chunk-RVBQT2PD.cjs} +3 -3
  33. package/dist/{chunk-LLVF6X5W.cjs.map → chunk-RVBQT2PD.cjs.map} +1 -1
  34. package/dist/{chunk-7TVRQJXI.cjs → chunk-T2DZTOGG.cjs} +12 -12
  35. package/dist/{chunk-7TVRQJXI.cjs.map → chunk-T2DZTOGG.cjs.map} +1 -1
  36. package/dist/{chunk-GYQVQF2J.js → chunk-TM4T4NYJ.js} +2 -2
  37. package/dist/{chunk-W5XX2GKO.js → chunk-U6AJU2VD.js} +2 -2
  38. package/dist/{chunk-QHN7N2QA.js → chunk-VO22VAR3.js} +2 -2
  39. package/dist/{chunk-5ZSQ2ZIH.cjs → chunk-WQAGDJIP.cjs} +3 -3
  40. package/dist/{chunk-5ZSQ2ZIH.cjs.map → chunk-WQAGDJIP.cjs.map} +1 -1
  41. package/dist/{chunk-HFMIAMEO.js → chunk-XPM7WC54.js} +4 -4
  42. package/dist/chunks-2EC2R7PY.js +10 -0
  43. package/dist/cli.js +26 -26
  44. package/dist/{formula-L2BKGA4J.cjs → formula-RNATQ3FQ.cjs} +9 -9
  45. package/dist/{formula-L2BKGA4J.cjs.map → formula-RNATQ3FQ.cjs.map} +1 -1
  46. package/dist/{formula-DUEAYGIG.js → formula-RSTTP626.js} +4 -4
  47. package/dist/{formula-I4MAHCTZ.js → formula-STIFIS57.js} +3 -3
  48. package/dist/{image-ocr-ZWRJZKYR.cjs → image-ocr-7L5TBBPA.cjs} +15 -15
  49. package/dist/{image-ocr-ZWRJZKYR.cjs.map → image-ocr-7L5TBBPA.cjs.map} +1 -1
  50. package/dist/{image-ocr-B32G24XW.js → image-ocr-R6ZDFBAN.js} +6 -6
  51. package/dist/{image-ocr-NUL3JKXM.js → image-ocr-XKSAEEXP.js} +9 -9
  52. package/dist/index.cjs +824 -761
  53. package/dist/index.cjs.map +1 -1
  54. package/dist/index.js +94 -31
  55. package/dist/index.js.map +1 -1
  56. package/dist/mcp.js +22 -22
  57. package/dist/{model-bundle-OBIKG4K5.js → model-bundle-NGTKULP7.js} +5 -5
  58. package/dist/{models-2OZHOPPM.js → models-QOSU5SYL.js} +5 -5
  59. package/dist/{parser-FDE6GQST.js → parser-3G4G6SST.js} +176 -12
  60. package/dist/parser-3G4G6SST.js.map +1 -0
  61. package/dist/{parser-YW3NMSJE.js → parser-5GUEP6EK.js} +173 -9
  62. package/dist/parser-5GUEP6EK.js.map +1 -0
  63. package/dist/{parser-DMWCXX7A.cjs → parser-AIQBU7FS.cjs} +392 -228
  64. package/dist/parser-AIQBU7FS.cjs.map +1 -0
  65. package/dist/pdf-ocr-7OAFUDM4.cjs +17 -0
  66. package/dist/{pdf-ocr-K2OK7FNQ.cjs.map → pdf-ocr-7OAFUDM4.cjs.map} +1 -1
  67. package/dist/pdf-ocr-DAXS5RX4.js +16 -0
  68. package/dist/pdf-ocr-R3VGX6F2.js +20 -0
  69. package/dist/{profile-io-6WCU4KHY.js → profile-io-ZVNMDLLS.js} +3 -3
  70. package/dist/{rasterize-X3I7SWXF.js → rasterize-Y2RLMVCL.js} +3 -3
  71. package/dist/{redact-doc-6H7WPUQD.js → redact-doc-PNRDDBI3.js} +11 -11
  72. package/dist/{render-PBQJGZT3.js → render-S3ALARVO.js} +7 -7
  73. package/dist/seal-EJWPS5VK.js +10 -0
  74. package/dist/{setup-UORJSR3M.js → setup-JH66VSFZ.js} +3 -3
  75. package/dist/visual-GDXMKDVY.js +20 -0
  76. package/dist/{watch-S2ZMDDZU.js → watch-KMB2FTOD.js} +12 -12
  77. package/package.json +1 -1
  78. package/dist/chunk-C4JHZNRL.js.map +0 -1
  79. package/dist/chunk-DGXGVC4Z.js.map +0 -1
  80. package/dist/chunk-DH75ZUYF.js.map +0 -1
  81. package/dist/chunk-FJE3TMZ7.js.map +0 -1
  82. package/dist/chunk-L5KNWOGR.js.map +0 -1
  83. package/dist/chunk-LNU54ZKV.cjs.map +0 -1
  84. package/dist/chunks-JPNLQOVD.js +0 -10
  85. package/dist/parser-DMWCXX7A.cjs.map +0 -1
  86. package/dist/parser-FDE6GQST.js.map +0 -1
  87. package/dist/parser-YW3NMSJE.js.map +0 -1
  88. package/dist/pdf-ocr-7MR56U4P.js +0 -16
  89. package/dist/pdf-ocr-K2OK7FNQ.cjs +0 -17
  90. package/dist/pdf-ocr-YHC4X67W.js +0 -20
  91. package/dist/seal-E2E7CFZJ.js +0 -10
  92. package/dist/visual-4GDT5BRH.js +0 -20
  93. /package/dist/{-I3DEUQUC.js.map → -3JIHF2AL.js.map} +0 -0
  94. /package/dist/{chunk-CR4RXHXO.js.map → chunk-4CS7XE2Q.js.map} +0 -0
  95. /package/dist/{chunk-UCTD3BXH.js.map → chunk-56ZWAREM.js.map} +0 -0
  96. /package/dist/{chunk-OMJWAJBD.js.map → chunk-6ZBORHFB.js.map} +0 -0
  97. /package/dist/{chunk-XXUXQHUC.js.map → chunk-B4R443MV.js.map} +0 -0
  98. /package/dist/{chunk-RYKNAYKC.js.map → chunk-EUCBMW6C.js.map} +0 -0
  99. /package/dist/{chunk-XIWGPC3V.js.map → chunk-GNUGD4RO.js.map} +0 -0
  100. /package/dist/{chunk-AMDDV4CI.js.map → chunk-I2TBI7PN.js.map} +0 -0
  101. /package/dist/{chunk-5B55S4JU.js.map → chunk-J75TVRJB.js.map} +0 -0
  102. /package/dist/{chunk-VZSOPECZ.js.map → chunk-JK7N4R4K.js.map} +0 -0
  103. /package/dist/{chunk-DEYCTP2S.js.map → chunk-JXJDXDOU.js.map} +0 -0
  104. /package/dist/{chunk-UTVNSCEI.js.map → chunk-OKHKEYTL.js.map} +0 -0
  105. /package/dist/{chunk-AAE765MK.js.map → chunk-PWQ2BVAT.js.map} +0 -0
  106. /package/dist/{chunk-GCYLNOTJ.js.map → chunk-R2JM2HOJ.js.map} +0 -0
  107. /package/dist/{chunk-GYQVQF2J.js.map → chunk-TM4T4NYJ.js.map} +0 -0
  108. /package/dist/{chunk-W5XX2GKO.js.map → chunk-U6AJU2VD.js.map} +0 -0
  109. /package/dist/{chunk-QHN7N2QA.js.map → chunk-VO22VAR3.js.map} +0 -0
  110. /package/dist/{chunk-HFMIAMEO.js.map → chunk-XPM7WC54.js.map} +0 -0
  111. /package/dist/{chunks-JPNLQOVD.js.map → chunks-2EC2R7PY.js.map} +0 -0
  112. /package/dist/{formula-DUEAYGIG.js.map → formula-RSTTP626.js.map} +0 -0
  113. /package/dist/{formula-I4MAHCTZ.js.map → formula-STIFIS57.js.map} +0 -0
  114. /package/dist/{image-ocr-B32G24XW.js.map → image-ocr-R6ZDFBAN.js.map} +0 -0
  115. /package/dist/{image-ocr-NUL3JKXM.js.map → image-ocr-XKSAEEXP.js.map} +0 -0
  116. /package/dist/{model-bundle-OBIKG4K5.js.map → model-bundle-NGTKULP7.js.map} +0 -0
  117. /package/dist/{models-2OZHOPPM.js.map → models-QOSU5SYL.js.map} +0 -0
  118. /package/dist/{pdf-ocr-7MR56U4P.js.map → pdf-ocr-DAXS5RX4.js.map} +0 -0
  119. /package/dist/{pdf-ocr-YHC4X67W.js.map → pdf-ocr-R3VGX6F2.js.map} +0 -0
  120. /package/dist/{profile-io-6WCU4KHY.js.map → profile-io-ZVNMDLLS.js.map} +0 -0
  121. /package/dist/{rasterize-X3I7SWXF.js.map → rasterize-Y2RLMVCL.js.map} +0 -0
  122. /package/dist/{redact-doc-6H7WPUQD.js.map → redact-doc-PNRDDBI3.js.map} +0 -0
  123. /package/dist/{render-PBQJGZT3.js.map → render-S3ALARVO.js.map} +0 -0
  124. /package/dist/{seal-E2E7CFZJ.js.map → seal-EJWPS5VK.js.map} +0 -0
  125. /package/dist/{setup-UORJSR3M.js.map → setup-JH66VSFZ.js.map} +0 -0
  126. /package/dist/{visual-4GDT5BRH.js.map → visual-GDXMKDVY.js.map} +0 -0
  127. /package/dist/{watch-S2ZMDDZU.js.map → watch-KMB2FTOD.js.map} +0 -0
package/dist/mcp.js CHANGED
@@ -3,7 +3,7 @@ import {
3
3
  assertWithinRoot,
4
4
  getAccessRoot,
5
5
  isOfflineMode
6
- } from "./chunk-AMDDV4CI.js";
6
+ } from "./chunk-I2TBI7PN.js";
7
7
  import {
8
8
  APPROVAL_MAX,
9
9
  BODY_FONTS,
@@ -43,25 +43,25 @@ import {
43
43
  resolveBuiltinTemplate,
44
44
  unknownFontWarnings,
45
45
  usesGaejosikMunche
46
- } from "./chunk-C4JHZNRL.js";
47
- import "./chunk-QHN7N2QA.js";
48
- import "./chunk-AAE765MK.js";
46
+ } from "./chunk-NV46IWKF.js";
47
+ import "./chunk-VO22VAR3.js";
48
+ import "./chunk-PWQ2BVAT.js";
49
49
  import "./chunk-3WSNLH4B.js";
50
- import "./chunk-GYQVQF2J.js";
50
+ import "./chunk-TM4T4NYJ.js";
51
51
  import {
52
52
  detectFormat,
53
53
  detectOle2Format,
54
54
  detectZipFormat,
55
55
  extractHwp5MetadataOnly
56
- } from "./chunk-DGXGVC4Z.js";
56
+ } from "./chunk-QZ63HXEG.js";
57
57
  import "./chunk-7FCNOKOR.js";
58
- import "./chunk-L5KNWOGR.js";
58
+ import "./chunk-AOVMOCTK.js";
59
59
  import "./chunk-VQFA55IC.js";
60
- import "./chunk-FJE3TMZ7.js";
60
+ import "./chunk-QYJPU4FZ.js";
61
61
  import {
62
62
  blocksToMarkdown
63
- } from "./chunk-XXUXQHUC.js";
64
- import "./chunk-OMJWAJBD.js";
63
+ } from "./chunk-B4R443MV.js";
64
+ import "./chunk-6ZBORHFB.js";
65
65
  import {
66
66
  KordocError,
67
67
  VERSION,
@@ -69,7 +69,7 @@ import {
69
69
  routeConsoleToStderr,
70
70
  sanitizeError,
71
71
  toArrayBuffer
72
- } from "./chunk-UTVNSCEI.js";
72
+ } from "./chunk-OKHKEYTL.js";
73
73
 
74
74
  // src/mcp.ts
75
75
  import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
@@ -355,7 +355,7 @@ ${markdown}`);
355
355
  break;
356
356
  case "pdf":
357
357
  try {
358
- const { extractPdfMetadataOnly } = await import("./parser-FDE6GQST.js");
358
+ const { extractPdfMetadataOnly } = await import("./parser-3G4G6SST.js");
359
359
  metadata = await extractPdfMetadataOnly(buffer);
360
360
  } catch {
361
361
  metadata = void 0;
@@ -532,7 +532,7 @@ ${tableMarkdown}` }]
532
532
  if (!parsed.success) {
533
533
  return { content: [{ type: "text", text: `\uD30C\uC2F1 \uC2E4\uD328: ${parsed.error}` }], isError: true };
534
534
  }
535
- const { blocksToChunks } = await import("./chunks-JPNLQOVD.js");
535
+ const { blocksToChunks } = await import("./chunks-2EC2R7PY.js");
536
536
  const chunks = blocksToChunks(parsed.blocks, { granularity, includeTableCells: include_table_cells });
537
537
  return { content: [{ type: "text", text: capResponseText(JSON.stringify(chunks, null, 2)) }] };
538
538
  } catch (err) {
@@ -777,7 +777,7 @@ ${previewMd}` }]
777
777
  }
778
778
  const image = new Uint8Array(await readFile2(imgResolved));
779
779
  const ext = extname2(imgResolved).slice(1).toLowerCase();
780
- const { placeSealHwpx } = await import("./seal-E2E7CFZJ.js");
780
+ const { placeSealHwpx } = await import("./seal-EJWPS5VK.js");
781
781
  const result = await placeSealHwpx(buffer, [{
782
782
  anchor,
783
783
  occurrence,
@@ -894,7 +894,7 @@ ${previewMd}` }]
894
894
  if (outPath && await isSameFile(outPath, resolved)) {
895
895
  return { content: [{ type: "text", text: "output_path\uAC00 \uC785\uB825 \uD30C\uC77C\uACFC \uAC19\uC2B5\uB2C8\uB2E4 \u2014 \uC6D0\uBCF8\uC744 \uB36E\uC5B4\uC4F0\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4. \uB2E4\uB978 \uACBD\uB85C\uB97C \uC9C0\uC815\uD558\uC138\uC694." }], isError: true };
896
896
  }
897
- const { redactDocument } = await import("./redact-doc-6H7WPUQD.js");
897
+ const { redactDocument } = await import("./redact-doc-PNRDDBI3.js");
898
898
  const r = await redactDocument(buffer, { rules, maskChar: mask_char, filePath: file_path, dryRun: dry_run });
899
899
  const MAX_LINES = 50;
900
900
  const listed = r.fileHits.length > 0 ? r.fileHits.map((h) => ` - [${h.rule}] ${h.masked} (${h.where} @ ${h.part})`) : r.markdownHits.map((h) => ` - [${h.rule}] ${h.masked}`);
@@ -968,7 +968,7 @@ function registerRenderTools(server2) {
968
968
  const { buffer, resolved } = await readValidatedFile(file_path, MAX_FILE_SIZE, /* @__PURE__ */ new Set([".hwpx", ".hwp"]));
969
969
  const isHwp5 = resolved.toLowerCase().endsWith(".hwp");
970
970
  if (!isHwp5 && !pages && (format === "png" || format === "svg")) {
971
- const { renderHwpxToSvg } = await import("./render-PBQJGZT3.js");
971
+ const { renderHwpxToSvg } = await import("./render-S3ALARVO.js");
972
972
  const result = await renderHwpxToSvg(buffer, { highlights, reflow: true, reflowMode: reflow_mode });
973
973
  const summary2 = [
974
974
  `\uB80C\uB354 \uC644\uB8CC: ${result.pageCount}\uD398\uC774\uC9C0, ${Math.round(result.width)}x${Math.round(result.height)}pt (\uD14D\uC2A4\uD2B8 ${result.stats.texts}\xB7\uC774\uBBF8\uC9C0 ${result.stats.images}\xB7\uD45C ${result.stats.tables})`,
@@ -980,7 +980,7 @@ function registerRenderTools(server2) {
980
980
  summary2.push(`\uC800\uC7A5: ${outPath}`);
981
981
  return { content: [{ type: "text", text: summary2.join("\n") }] };
982
982
  }
983
- const { rasterizeSvg } = await import("./rasterize-X3I7SWXF.js");
983
+ const { rasterizeSvg } = await import("./rasterize-Y2RLMVCL.js");
984
984
  const raster = await rasterizeSvg(result.svg, result.width, result.height, max_width_px ? { maxWidthPx: max_width_px } : void 0);
985
985
  if (outPath) {
986
986
  await mkdir2(dirname3(outPath), { recursive: true });
@@ -995,7 +995,7 @@ function registerRenderTools(server2) {
995
995
  ]
996
996
  };
997
997
  }
998
- const { renderDocument } = await import("./render-PBQJGZT3.js");
998
+ const { renderDocument } = await import("./render-S3ALARVO.js");
999
999
  const { scene, assets } = await renderDocument(buffer, { format, pages, highlights, reflow: true, reflowMode: reflow_mode, maxWidthPx: max_width_px });
1000
1000
  const summary = [
1001
1001
  `\uB80C\uB354 \uC644\uB8CC: \uBB38\uC11C ${scene.pages.length}\uD398\uC774\uC9C0 \uC911 ${assets.filter((a) => a.page !== void 0).length || 1}\uAC74 (\uD14D\uC2A4\uD2B8 ${scene.stats.texts}\xB7\uC774\uBBF8\uC9C0 ${scene.stats.images}\xB7\uD45C ${scene.stats.tables}\xB7\uB3C4\uD615 ${scene.stats.shapes})`,
@@ -1045,7 +1045,7 @@ function registerRenderTools(server2) {
1045
1045
  try {
1046
1046
  const { buffer } = await readValidatedFile(file_path, MAX_FILE_SIZE, /* @__PURE__ */ new Set([".hwpx", ".hwp"]));
1047
1047
  const dir = safeOutputPath(join2(output_dir, "regions.json"), /* @__PURE__ */ new Set([".json"])).replace(/[\\/]regions\.json$/, "");
1048
- const { extractRenderedRegions } = await import("./render-PBQJGZT3.js");
1048
+ const { extractRenderedRegions } = await import("./render-S3ALARVO.js");
1049
1049
  const regions = await extractRenderedRegions(buffer, { types: target, format, pages, paddingPt: padding_pt, reflow: true });
1050
1050
  await mkdir2(dir, { recursive: true });
1051
1051
  const ext = format === "jpeg" ? "jpg" : "png";
@@ -1081,7 +1081,7 @@ function registerRenderTools(server2) {
1081
1081
  }
1082
1082
  const { buffer } = await readValidatedFile(file_path, MAX_FILE_SIZE, /* @__PURE__ */ new Set([".hwpx", ".hwp"]));
1083
1083
  const dir = output_dir ? safeOutputPath(join2(output_dir, "tables.json"), /* @__PURE__ */ new Set([".json"])).replace(/[\\/]tables\.json$/, "") : void 0;
1084
- const { extractTables } = await import("./visual-4GDT5BRH.js");
1084
+ const { extractTables } = await import("./visual-GDXMKDVY.js");
1085
1085
  const tables = await extractTables(buffer, { policy: visual, format, paddingPt: padding_pt });
1086
1086
  if (dir) await mkdir2(dir, { recursive: true });
1087
1087
  const ext = format === "jpeg" ? "jpg" : "png";
@@ -1138,7 +1138,7 @@ function registerGenerateTools(server2) {
1138
1138
  try {
1139
1139
  const out = safeOutputPath(output_path, PROFILE_EXTENSIONS);
1140
1140
  const { buffer } = await readValidatedFile(hwpx_path);
1141
- const { hwpxToProfile } = await import("./-I3DEUQUC.js");
1141
+ const { hwpxToProfile } = await import("./-3JIHF2AL.js");
1142
1142
  const profile = await hwpxToProfile(buffer);
1143
1143
  await mkdir3(dirname4(out), { recursive: true });
1144
1144
  await writeOutputFile(out, JSON.stringify(profile, null, 2));
@@ -1245,7 +1245,7 @@ function registerGenerateTools(server2) {
1245
1245
  }
1246
1246
  let profile;
1247
1247
  if (profile_path) {
1248
- const { parseFormatProfileJson } = await import("./profile-io-6WCU4KHY.js");
1248
+ const { parseFormatProfileJson } = await import("./profile-io-ZVNMDLLS.js");
1249
1249
  profile = parseFormatProfileJson(await readFile3(safePath(profile_path, PROFILE_EXTENSIONS), "utf-8"));
1250
1250
  }
1251
1251
  const out = safeOutputPath(output_path, /* @__PURE__ */ new Set([".hwpx"]));
@@ -1,14 +1,14 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  ALL_OCR_MODELS
4
- } from "./chunk-UCTD3BXH.js";
4
+ } from "./chunk-56ZWAREM.js";
5
5
  import {
6
6
  ALL_FORMULA_MODELS,
7
7
  getModelStatusIn,
8
8
  getModelsDir
9
- } from "./chunk-VZSOPECZ.js";
10
- import "./chunk-AMDDV4CI.js";
11
- import "./chunk-UTVNSCEI.js";
9
+ } from "./chunk-JK7N4R4K.js";
10
+ import "./chunk-I2TBI7PN.js";
11
+ import "./chunk-OKHKEYTL.js";
12
12
 
13
13
  // src/shared/model-bundle.ts
14
14
  import { copyFile, mkdir } from "fs/promises";
@@ -101,4 +101,4 @@ export {
101
101
  importModels,
102
102
  modelCacheStatus
103
103
  };
104
- //# sourceMappingURL=model-bundle-OBIKG4K5.js.map
104
+ //# sourceMappingURL=model-bundle-NGTKULP7.js.map
@@ -10,10 +10,10 @@ import {
10
10
  ocrModelPath,
11
11
  ocrModelsCached,
12
12
  parseCharacterDict
13
- } from "./chunk-UCTD3BXH.js";
14
- import "./chunk-VZSOPECZ.js";
15
- import "./chunk-AMDDV4CI.js";
16
- import "./chunk-UTVNSCEI.js";
13
+ } from "./chunk-56ZWAREM.js";
14
+ import "./chunk-JK7N4R4K.js";
15
+ import "./chunk-I2TBI7PN.js";
16
+ import "./chunk-OKHKEYTL.js";
17
17
  export {
18
18
  ALL_OCR_MODELS,
19
19
  OCR_DET_MODEL,
@@ -26,4 +26,4 @@ export {
26
26
  ocrModelsCached,
27
27
  parseCharacterDict
28
28
  };
29
- //# sourceMappingURL=models-2OZHOPPM.js.map
29
+ //# sourceMappingURL=models-QOSU5SYL.js.map
@@ -50,25 +50,26 @@ import {
50
50
  startsNewItem,
51
51
  trimTrailingEmptyTableCols,
52
52
  wrapJoiner
53
- } from "./chunk-RYKNAYKC.js";
53
+ } from "./chunk-EUCBMW6C.js";
54
54
  import {
55
55
  ocrModelsCached
56
- } from "./chunk-UCTD3BXH.js";
57
- import "./chunk-VZSOPECZ.js";
58
- import "./chunk-AMDDV4CI.js";
56
+ } from "./chunk-56ZWAREM.js";
57
+ import "./chunk-JK7N4R4K.js";
58
+ import "./chunk-I2TBI7PN.js";
59
59
  import {
60
60
  blocksToPages
61
- } from "./chunk-QHN7N2QA.js";
61
+ } from "./chunk-VO22VAR3.js";
62
62
  import {
63
63
  encodePng
64
64
  } from "./chunk-7FCNOKOR.js";
65
65
  import {
66
66
  CELL_EDGES,
67
+ CELL_PAGES,
67
68
  CONTENT_CELLS,
68
69
  escapeLiteralTags,
69
70
  stripScriptTags,
70
71
  unframeLayoutTables
71
- } from "./chunk-L5KNWOGR.js";
72
+ } from "./chunk-AOVMOCTK.js";
72
73
  import {
73
74
  hasRequestedPagesAfter,
74
75
  parsePageRange
@@ -78,11 +79,11 @@ import {
78
79
  assignTableIds,
79
80
  blocksToMarkdown,
80
81
  escapeLiteralDollar
81
- } from "./chunk-XXUXQHUC.js";
82
+ } from "./chunk-B4R443MV.js";
82
83
  import {
83
84
  KordocError,
84
85
  sanitizeHref
85
- } from "./chunk-UTVNSCEI.js";
86
+ } from "./chunk-OKHKEYTL.js";
86
87
 
87
88
  // src/pdf/ocr-region-merge.ts
88
89
  function mergeOcrImageRegions(blocks, page, regions, ocrBlocks) {
@@ -763,6 +764,167 @@ function splitContactTables(blocks) {
763
764
  }
764
765
  }
765
766
 
767
+ // src/pdf/table-pages.ts
768
+ var CELL_SPLITS = /* @__PURE__ */ new WeakMap();
769
+ function relocate(src, dst, from = 0) {
770
+ const out = [];
771
+ for (const s of CELL_SPLITS.get(src) ?? []) {
772
+ const at = dst.text.indexOf(src.text.slice(s.at, s.at + 20).trimEnd(), Math.max(from, out.at(-1)?.at ?? 0));
773
+ if (at >= 0) out.push({ at, page: s.page });
774
+ }
775
+ return out;
776
+ }
777
+ var setSplits = (cell, splits) => {
778
+ if (splits.length) CELL_SPLITS.set(cell, splits.sort((a, b) => a.at - b.at));
779
+ };
780
+ function markContinuedText(cell, add, page) {
781
+ if (!add.text.trim()) return;
782
+ const base = cell.text.trim() ? cell.text.length + 1 : 0;
783
+ setSplits(cell, [
784
+ ...CELL_SPLITS.get(cell) ?? [],
785
+ { at: base, page },
786
+ ...(CELL_SPLITS.get(add) ?? []).map((s) => ({ at: base + s.at, page: s.page }))
787
+ ]);
788
+ }
789
+ function rowStarts(t) {
790
+ const covered = /* @__PURE__ */ new Set();
791
+ const rows = [];
792
+ for (let r = 0; r < t.rows; r++) {
793
+ const starts = [];
794
+ for (let c = 0; c < t.cols; c++) {
795
+ if (covered.has(r * 1e5 + c)) continue;
796
+ const cell = t.cells[r]?.[c];
797
+ if (!cell) continue;
798
+ for (let dr = 0; dr < cell.rowSpan; dr++) for (let dc = 0; dc < cell.colSpan; dc++) if (dr || dc) covered.add((r + dr) * 1e5 + c + dc);
799
+ starts.push({ cell, c });
800
+ }
801
+ rows.push(starts);
802
+ }
803
+ return rows;
804
+ }
805
+ 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));
806
+ function cellPage(cell) {
807
+ const p = CELL_PAGES.get(cell);
808
+ if (p !== void 0 || !cell.blocks?.length || cell.blocks.some((b) => b.pageNumber === void 0)) return p;
809
+ return Math.min(...cell.blocks.map((b) => b.pageNumber));
810
+ }
811
+ function tableRowPages(t, pageNumber) {
812
+ const pages = [];
813
+ let prev = pageNumber;
814
+ for (const starts of rowStarts(t)) {
815
+ let mark, text = false;
816
+ for (const { cell } of starts) {
817
+ const p = cellPage(cell);
818
+ if (p !== void 0) mark = Math.max(mark ?? p, p);
819
+ else if (cell.text.trim() || cell.blocks?.length) text = true;
820
+ }
821
+ const page = mark ?? (text ? pageNumber : prev);
822
+ prev = page !== void 0 && prev !== void 0 ? Math.max(prev, page) : page ?? prev;
823
+ pages.push(prev);
824
+ }
825
+ return pages;
826
+ }
827
+ function markJoinedPages(table, prev, curr) {
828
+ const pt = prev.table, ct = curr.table;
829
+ if (!curr.pageNumber || table.rows < pt.rows) return;
830
+ const pp = tableRowPages(pt, prev.pageNumber), cp = tableRowPages(ct, curr.pageNumber);
831
+ const off = table.rows - ct.rows;
832
+ const rows = rowStarts(table), ptRows = rowStarts(pt), ctRows = rowStarts(ct);
833
+ rows.forEach((starts, r) => {
834
+ const page2 = r < pt.rows ? pp[r] : cp[r - off];
835
+ for (const { cell } of starts) {
836
+ if (page2 !== void 0 && page2 !== prev.pageNumber) CELL_PAGES.set(cell, page2);
837
+ const src = (r < pt.rows ? ptRows[r] : ctRows[r - off])?.find((s) => s.cell !== cell && s.cell.text === cell.text && CELL_SPLITS.has(s.cell));
838
+ if (src) setSplits(cell, relocate(src.cell, cell));
839
+ }
840
+ });
841
+ const cr = pt.rows - 1 - off, page = cp[cr];
842
+ if (cr < 0 || page === void 0 || page === prev.pageNumber) return;
843
+ const tails = ctRows[cr].filter((s) => s.cell.text.trim());
844
+ for (const { cell } of ctRows[cr]) for (const b of cell.blocks ?? []) b.pageNumber ??= page;
845
+ const heads = covering(pt, pt.rows - 1);
846
+ for (const cell of covering(table, pt.rows - 1)) {
847
+ if (cell.blocks?.length) continue;
848
+ const head = heads.filter((h) => h.text.trim() && cell.text.startsWith(h.text.trimEnd()) && cell.text.trim().length > h.text.trim().length).sort((a, b) => b.text.length - a.text.length)[0];
849
+ if (!head) continue;
850
+ const from = head.text.trimEnd().length;
851
+ const hit = tails.map((t) => ({ t: t.cell, at: cell.text.indexOf(t.cell.text.trim().slice(0, 20), from) })).filter((h) => h.at >= from).sort((a, b) => a.at - b.at)[0];
852
+ if (!hit) continue;
853
+ setSplits(cell, [...relocate(head, cell), { at: hit.at, page }, ...relocate(hit.t, cell, hit.at)]);
854
+ }
855
+ }
856
+ function splitCell(cell, page) {
857
+ if (page === void 0) return null;
858
+ if (cell.blocks?.length) {
859
+ const k2 = cell.blocks.findIndex((b) => (b.pageNumber ?? page) > page);
860
+ if (k2 <= 0) return null;
861
+ const head = cell.blocks.slice(0, k2), tail = cell.blocks.slice(k2);
862
+ const text = (bs) => bs.map((b) => b.text ?? "").filter(Boolean).join("\n");
863
+ return { head: { text: text(head), blocks: head }, tail: { text: text(tail), blocks: tail }, page: tail[0].pageNumber, rest: [] };
864
+ }
865
+ const splits = CELL_SPLITS.get(cell) ?? [];
866
+ const k = splits.findIndex((s2) => s2.page > page && s2.at < cell.text.length);
867
+ if (k < 0) return null;
868
+ const s = splits[k];
869
+ const rest = cell.text.slice(s.at), lead = rest.length - rest.trimStart().length;
870
+ return {
871
+ head: { text: cell.text.slice(0, s.at).trimEnd() },
872
+ tail: { text: rest.trim() },
873
+ page: s.page,
874
+ rest: splits.slice(k + 1).map((x) => ({ at: x.at - s.at - lead, page: x.page })).filter((x) => x.at > 0)
875
+ };
876
+ }
877
+ function splitCrossPageRows(t, pageNumber) {
878
+ const pages = tableRowPages(t, pageNumber);
879
+ const rows = rowStarts(t);
880
+ for (let r = 0; r < t.rows; r++) {
881
+ const splits = rows[r].map((s) => ({ ...s, split: splitCell(s.cell, pages[r]) })).filter((s) => s.split);
882
+ if (!splits.length) continue;
883
+ const clone = (cell, patch) => {
884
+ const out = { ...cell, ...patch };
885
+ const p = CELL_PAGES.get(cell);
886
+ if (p !== void 0) CELL_PAGES.set(out, p);
887
+ if (!("text" in patch) && CELL_SPLITS.has(cell)) CELL_SPLITS.set(out, CELL_SPLITS.get(cell));
888
+ return out;
889
+ };
890
+ const e = Math.max(...splits.map((s) => r + s.cell.rowSpan - 1));
891
+ const cells = t.cells.map((row2) => row2.slice());
892
+ const row = Array.from({ length: t.cols }, () => ({ text: "", colSpan: 1, rowSpan: 1 }));
893
+ for (const { cell, c, split } of splits) {
894
+ cells[r][c] = clone(cell, split.head);
895
+ const tail = { ...cell, ...split.tail, rowSpan: 1 };
896
+ CELL_PAGES.set(tail, split.page);
897
+ setSplits(tail, split.rest);
898
+ row[c] = tail;
899
+ }
900
+ rows.forEach((starts, rr) => {
901
+ for (const { cell, c } of starts) {
902
+ if (splits.some((s) => s.cell === cell) || rr > e || rr + cell.rowSpan - 1 <= e) continue;
903
+ cells[rr][c] = clone(cells[rr][c], { rowSpan: cell.rowSpan + 1 });
904
+ }
905
+ });
906
+ cells.splice(e + 1, 0, row);
907
+ return splitCrossPageRows({ ...t, rows: t.rows + 1, cells }, pageNumber);
908
+ }
909
+ return t;
910
+ }
911
+ function splitPageTables(blocks) {
912
+ return blocks.flatMap((b) => {
913
+ if (b.type !== "table" || !b.table) return [b];
914
+ const t = splitCrossPageRows(b.table, b.pageNumber);
915
+ const pages = tableRowPages(t, b.pageNumber);
916
+ const cuts = [0];
917
+ for (let r = 1; r < t.rows; r++) if (pages[r] !== pages[r - 1]) cuts.push(r);
918
+ if (cuts.length === 1) return t === b.table ? [b] : [{ ...b, table: t }];
919
+ return cuts.map((from, k) => {
920
+ const end = cuts[k + 1] ?? t.rows;
921
+ const cells = t.cells.slice(from, end).map((row, dr) => row.map((cell) => cell && from + dr + cell.rowSpan > end ? { ...cell, rowSpan: end - from - dr } : cell));
922
+ const table = { ...t, rows: end - from, cells, ...k ? { caption: void 0, captionBlocks: void 0 } : {} };
923
+ return { ...b, table, pageNumber: pages[from] };
924
+ });
925
+ });
926
+ }
927
+
766
928
  // src/pdf/table-parts.ts
767
929
  var flowText = (text) => text.replace(/<\/?u>|~~/g, "");
768
930
  var PART_COL_TOL = 1;
@@ -1182,6 +1344,7 @@ function leftColumnOf(b, t) {
1182
1344
  }
1183
1345
  function placeJoined(blocks, i, j, table) {
1184
1346
  const prev = blocks[i];
1347
+ markJoinedPages(table, prev, blocks[j]);
1185
1348
  blocks[i] = { ...prev, table };
1186
1349
  blocks.splice(j, 1);
1187
1350
  let k = j - 1;
@@ -1535,6 +1698,7 @@ function mergeContinuedCells(blocks, pageHeights) {
1535
1698
  if (!cell || !add) continue;
1536
1699
  const at = cell.blocks || add.blocks ? cellBlocks(cell, prev.pageNumber).length : -1;
1537
1700
  if (cell.blocks || add.blocks) cell.blocks = [...cellBlocks(cell, prev.pageNumber), ...cellBlocks(add, part.pageNumber)];
1701
+ else if (part.pageNumber) markContinuedText(cell, add, part.pageNumber);
1538
1702
  cell.text = [cell.text, add.text].filter((s) => s.trim()).join("\n");
1539
1703
  joinCellEdges(cell, add);
1540
1704
  const lines = CELL_LINES.get(add);
@@ -2883,7 +3047,7 @@ function mergeLinkRuns(markdown) {
2883
3047
 
2884
3048
  // src/pdf/formula-ocr.ts
2885
3049
  async function applyFormulaOcr(buffer, blocks, pageFilter, effectivePageCount, warnings, _onProgress) {
2886
- const formulaMod = await import("./formula-DUEAYGIG.js");
3050
+ const formulaMod = await import("./formula-RSTTP626.js");
2887
3051
  const { FormulaPipeline, ensureFormulaModels } = formulaMod;
2888
3052
  await ensureFormulaModels((p) => {
2889
3053
  if (p.phase === "download" && p.total) {
@@ -3304,7 +3468,7 @@ async function parsePdfDocument(buffer, options) {
3304
3468
  }
3305
3469
  if (targets.size > 0) {
3306
3470
  try {
3307
- const { runPdfOcr } = await import("./pdf-ocr-YHC4X67W.js");
3471
+ const { runPdfOcr } = await import("./pdf-ocr-R3VGX6F2.js");
3308
3472
  const mode = typeof options?.ocr === "function" ? options.ocr : "builtin";
3309
3473
  const regionPages = new Map([...ocrRegions].filter(([p]) => options?.ocr !== "force" && !isImageBased && !pageQuality.find((q) => q.page === p)?.needsOcr));
3310
3474
  const ocrPageBlocks = await runPdfOcr(ocrBuffer, targets, mode, warnings, options?.onProgress, options?.tables !== false, vectorPageOps, regionPages);
@@ -3462,7 +3626,7 @@ async function parsePdfDocument(buffer, options) {
3462
3626
  let markdown = finishMarkdown(outBlocks);
3463
3627
  return {
3464
3628
  markdown,
3465
- pages: blocksToPages(splitPageBreakWraps(outBlocks), finishMarkdown),
3629
+ pages: blocksToPages(splitPageTables(splitPageBreakWraps(outBlocks)), finishMarkdown),
3466
3630
  blocks,
3467
3631
  metadata,
3468
3632
  outline: outline.length > 0 ? outline : void 0,
@@ -3542,4 +3706,4 @@ export {
3542
3706
  parsePdfDocument,
3543
3707
  removeHeaderFooterBlocks
3544
3708
  };
3545
- //# sourceMappingURL=parser-FDE6GQST.js.map
3709
+ //# sourceMappingURL=parser-3G4G6SST.js.map