kordoc 4.17.1 → 4.17.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 (133) hide show
  1. package/README.md +3 -0
  2. package/dist/{-UNMTWAEI.js → -2UA2JHVA.js} +10 -10
  3. package/dist/{chunk-B4PUQ4FP.js → chunk-2XHXABCX.js} +2 -2
  4. package/dist/{chunk-MPAN6S5O.js → chunk-3N272C5L.js} +243 -114
  5. package/dist/chunk-3N272C5L.js.map +1 -0
  6. package/dist/{chunk-EULS3PDF.js → chunk-4HRJISJF.js} +3 -3
  7. package/dist/{chunk-KBIQGGNY.js → chunk-4TSYMJDL.js} +242 -113
  8. package/dist/chunk-4TSYMJDL.js.map +1 -0
  9. package/dist/{chunk-3M2BMQJY.js → chunk-5JZEY5IL.js} +119 -77
  10. package/dist/chunk-5JZEY5IL.js.map +1 -0
  11. package/dist/{chunk-5FCLQVT5.cjs → chunk-6DOCSYEM.cjs} +113 -71
  12. package/dist/chunk-6DOCSYEM.cjs.map +1 -0
  13. package/dist/{chunk-N6MPDM55.js → chunk-6OCKAXIS.js} +2 -2
  14. package/dist/{chunk-QXNQ2HNB.js → chunk-A2W2JQ3S.js} +2 -2
  15. package/dist/{chunk-66YTQ3NQ.js → chunk-C4MVZXB5.js} +2 -2
  16. package/dist/{chunk-GYHY2YLV.js → chunk-FGL4IGOT.js} +4 -4
  17. package/dist/{chunk-BEJYCCDN.cjs → chunk-GPC72VSF.cjs} +6 -6
  18. package/dist/chunk-GPC72VSF.cjs.map +1 -0
  19. package/dist/chunk-GS7T56RP.cjs.map +1 -1
  20. package/dist/{chunk-FMP4POMD.js → chunk-GYTL6WT3.js} +3 -3
  21. package/dist/{chunk-4NH45EEB.cjs → chunk-HAW2VL62.cjs} +12 -12
  22. package/dist/chunk-HAW2VL62.cjs.map +1 -0
  23. package/dist/chunk-J55UQC5H.cjs.map +1 -1
  24. package/dist/{chunk-ELNYQRBN.js → chunk-JY2NBFIG.js} +14 -12
  25. package/dist/chunk-JY2NBFIG.js.map +1 -0
  26. package/dist/{chunk-BQAJHAWR.js → chunk-KQIYC2ZU.js} +2 -2
  27. package/dist/{chunk-GRHSVGSB.cjs → chunk-KZVQK5NS.cjs} +2 -2
  28. package/dist/chunk-KZVQK5NS.cjs.map +1 -0
  29. package/dist/{chunk-AUFO5LVN.js → chunk-MDCTITUG.js} +2 -2
  30. package/dist/{chunk-OVSCNCT6.js → chunk-O4CB7D2Q.js} +2 -2
  31. package/dist/{chunk-3J3BJIOZ.js → chunk-SDRKHEVT.js} +2 -2
  32. package/dist/{chunk-HAPCN7BD.js → chunk-VU26WGE5.js} +37 -15
  33. package/dist/chunk-VU26WGE5.js.map +1 -0
  34. package/dist/{chunk-BHUYJBSQ.js → chunk-WJLICIYV.js} +2 -2
  35. package/dist/{chunk-ZRXQDJPM.cjs → chunk-WWMKIHF7.cjs} +336 -207
  36. package/dist/chunk-WWMKIHF7.cjs.map +1 -0
  37. package/dist/{chunk-MY6Q2HFW.js → chunk-XZA6X34R.js} +121 -77
  38. package/dist/chunk-XZA6X34R.js.map +1 -0
  39. package/dist/{chunk-4CSY3QUO.js → chunk-YGKC6E6A.js} +2 -2
  40. package/dist/chunk-YIANW5QX.cjs.map +1 -1
  41. package/dist/{chunk-E6TJNN2U.js → chunk-ZDX5PIWR.js} +2 -2
  42. package/dist/chunks-EBWJR55V.js +10 -0
  43. package/dist/cli.js +25 -25
  44. package/dist/{formula-K7UF5MBF.cjs → formula-5RETDCIC.cjs} +9 -9
  45. package/dist/formula-5RETDCIC.cjs.map +1 -0
  46. package/dist/{formula-VH545WNH.js → formula-MBLN2DG4.js} +4 -4
  47. package/dist/{formula-3GB47YTH.js → formula-QZZDW5GW.js} +3 -3
  48. package/dist/{image-ocr-6AKQWAU2.js → image-ocr-CJSO3QSR.js} +7 -7
  49. package/dist/{image-ocr-VJFZCFAI.js → image-ocr-EREKAS47.js} +5 -5
  50. package/dist/{image-ocr-ZPQTFYSK.cjs → image-ocr-PSPVRLB5.cjs} +14 -14
  51. package/dist/image-ocr-PSPVRLB5.cjs.map +1 -0
  52. package/dist/index.cjs +612 -588
  53. package/dist/index.cjs.map +1 -1
  54. package/dist/index.js +41 -17
  55. package/dist/index.js.map +1 -1
  56. package/dist/mcp.js +21 -21
  57. package/dist/{model-bundle-P2XOZ76Q.js → model-bundle-MA4MMCRJ.js} +5 -5
  58. package/dist/{models-GPHBC2YJ.js → models-SEJ7LNSN.js} +5 -5
  59. package/dist/page-range-QHHFTL7X.cjs.map +1 -1
  60. package/dist/{parser-YIIRSBZS.js → parser-M5WHRX25.js} +40 -22
  61. package/dist/parser-M5WHRX25.js.map +1 -0
  62. package/dist/{parser-6SPYH3RU.cjs → parser-QILYPWSI.cjs} +211 -193
  63. package/dist/parser-QILYPWSI.cjs.map +1 -0
  64. package/dist/{parser-BVUFTU2O.js → parser-VH3F4EQU.js} +37 -19
  65. package/dist/parser-VH3F4EQU.js.map +1 -0
  66. package/dist/pdf-ocr-3SZUM3CN.cjs +16 -0
  67. package/dist/pdf-ocr-3SZUM3CN.cjs.map +1 -0
  68. package/dist/pdf-ocr-QB2TB5W5.js +18 -0
  69. package/dist/pdf-ocr-XC33L43D.js +15 -0
  70. package/dist/{profile-io-GU45HTYP.js → profile-io-5YB627EO.js} +3 -3
  71. package/dist/{rasterize-OWHFWG6R.js → rasterize-V2XHHS2I.js} +3 -3
  72. package/dist/{redact-doc-YTP6AAUP.js → redact-doc-5MK5L5IQ.js} +10 -10
  73. package/dist/{render-525LXDMV.js → render-SYZMHYK6.js} +6 -6
  74. package/dist/seal-IPKIQHYB.js +10 -0
  75. package/dist/{setup-NOXZLS7G.js → setup-ZPLJENSK.js} +3 -3
  76. package/dist/visual-RTTGNOAE.js +20 -0
  77. package/dist/{watch-NDRTCLVT.js → watch-FNWHVKK3.js} +11 -11
  78. package/package.json +1 -1
  79. package/dist/chunk-3M2BMQJY.js.map +0 -1
  80. package/dist/chunk-4NH45EEB.cjs.map +0 -1
  81. package/dist/chunk-5FCLQVT5.cjs.map +0 -1
  82. package/dist/chunk-BEJYCCDN.cjs.map +0 -1
  83. package/dist/chunk-ELNYQRBN.js.map +0 -1
  84. package/dist/chunk-GRHSVGSB.cjs.map +0 -1
  85. package/dist/chunk-HAPCN7BD.js.map +0 -1
  86. package/dist/chunk-KBIQGGNY.js.map +0 -1
  87. package/dist/chunk-MPAN6S5O.js.map +0 -1
  88. package/dist/chunk-MY6Q2HFW.js.map +0 -1
  89. package/dist/chunk-ZRXQDJPM.cjs.map +0 -1
  90. package/dist/chunks-P5Y7V73K.js +0 -10
  91. package/dist/formula-K7UF5MBF.cjs.map +0 -1
  92. package/dist/image-ocr-ZPQTFYSK.cjs.map +0 -1
  93. package/dist/parser-6SPYH3RU.cjs.map +0 -1
  94. package/dist/parser-BVUFTU2O.js.map +0 -1
  95. package/dist/parser-YIIRSBZS.js.map +0 -1
  96. package/dist/pdf-ocr-5YBMXW54.js +0 -18
  97. package/dist/pdf-ocr-EAVNHK3V.js +0 -15
  98. package/dist/pdf-ocr-J5GB5BW6.cjs +0 -16
  99. package/dist/pdf-ocr-J5GB5BW6.cjs.map +0 -1
  100. package/dist/seal-S4KJGZUI.js +0 -10
  101. package/dist/visual-AU3NH6EO.js +0 -20
  102. /package/dist/{-UNMTWAEI.js.map → -2UA2JHVA.js.map} +0 -0
  103. /package/dist/{chunk-B4PUQ4FP.js.map → chunk-2XHXABCX.js.map} +0 -0
  104. /package/dist/{chunk-EULS3PDF.js.map → chunk-4HRJISJF.js.map} +0 -0
  105. /package/dist/{chunk-N6MPDM55.js.map → chunk-6OCKAXIS.js.map} +0 -0
  106. /package/dist/{chunk-QXNQ2HNB.js.map → chunk-A2W2JQ3S.js.map} +0 -0
  107. /package/dist/{chunk-66YTQ3NQ.js.map → chunk-C4MVZXB5.js.map} +0 -0
  108. /package/dist/{chunk-GYHY2YLV.js.map → chunk-FGL4IGOT.js.map} +0 -0
  109. /package/dist/{chunk-FMP4POMD.js.map → chunk-GYTL6WT3.js.map} +0 -0
  110. /package/dist/{chunk-BQAJHAWR.js.map → chunk-KQIYC2ZU.js.map} +0 -0
  111. /package/dist/{chunk-AUFO5LVN.js.map → chunk-MDCTITUG.js.map} +0 -0
  112. /package/dist/{chunk-OVSCNCT6.js.map → chunk-O4CB7D2Q.js.map} +0 -0
  113. /package/dist/{chunk-3J3BJIOZ.js.map → chunk-SDRKHEVT.js.map} +0 -0
  114. /package/dist/{chunk-BHUYJBSQ.js.map → chunk-WJLICIYV.js.map} +0 -0
  115. /package/dist/{chunk-4CSY3QUO.js.map → chunk-YGKC6E6A.js.map} +0 -0
  116. /package/dist/{chunk-E6TJNN2U.js.map → chunk-ZDX5PIWR.js.map} +0 -0
  117. /package/dist/{chunks-P5Y7V73K.js.map → chunks-EBWJR55V.js.map} +0 -0
  118. /package/dist/{formula-VH545WNH.js.map → formula-MBLN2DG4.js.map} +0 -0
  119. /package/dist/{formula-3GB47YTH.js.map → formula-QZZDW5GW.js.map} +0 -0
  120. /package/dist/{image-ocr-6AKQWAU2.js.map → image-ocr-CJSO3QSR.js.map} +0 -0
  121. /package/dist/{image-ocr-VJFZCFAI.js.map → image-ocr-EREKAS47.js.map} +0 -0
  122. /package/dist/{model-bundle-P2XOZ76Q.js.map → model-bundle-MA4MMCRJ.js.map} +0 -0
  123. /package/dist/{models-GPHBC2YJ.js.map → models-SEJ7LNSN.js.map} +0 -0
  124. /package/dist/{pdf-ocr-5YBMXW54.js.map → pdf-ocr-QB2TB5W5.js.map} +0 -0
  125. /package/dist/{pdf-ocr-EAVNHK3V.js.map → pdf-ocr-XC33L43D.js.map} +0 -0
  126. /package/dist/{profile-io-GU45HTYP.js.map → profile-io-5YB627EO.js.map} +0 -0
  127. /package/dist/{rasterize-OWHFWG6R.js.map → rasterize-V2XHHS2I.js.map} +0 -0
  128. /package/dist/{redact-doc-YTP6AAUP.js.map → redact-doc-5MK5L5IQ.js.map} +0 -0
  129. /package/dist/{render-525LXDMV.js.map → render-SYZMHYK6.js.map} +0 -0
  130. /package/dist/{seal-S4KJGZUI.js.map → seal-IPKIQHYB.js.map} +0 -0
  131. /package/dist/{setup-NOXZLS7G.js.map → setup-ZPLJENSK.js.map} +0 -0
  132. /package/dist/{visual-AU3NH6EO.js.map → visual-RTTGNOAE.js.map} +0 -0
  133. /package/dist/{watch-NDRTCLVT.js.map → watch-FNWHVKK3.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-N6MPDM55.js";
6
+ } from "./chunk-6OCKAXIS.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-HAPCN7BD.js";
47
- import "./chunk-OVSCNCT6.js";
48
- import "./chunk-EULS3PDF.js";
46
+ } from "./chunk-VU26WGE5.js";
47
+ import "./chunk-O4CB7D2Q.js";
48
+ import "./chunk-4HRJISJF.js";
49
49
  import "./chunk-3WSNLH4B.js";
50
- import "./chunk-66YTQ3NQ.js";
50
+ import "./chunk-C4MVZXB5.js";
51
51
  import {
52
52
  detectFormat,
53
53
  detectOle2Format,
54
54
  detectZipFormat,
55
55
  extractHwp5MetadataOnly
56
- } from "./chunk-ELNYQRBN.js";
56
+ } from "./chunk-JY2NBFIG.js";
57
57
  import "./chunk-7FCNOKOR.js";
58
58
  import "./chunk-WL3BWROT.js";
59
59
  import "./chunk-VQFA55IC.js";
60
- import "./chunk-B4PUQ4FP.js";
60
+ import "./chunk-2XHXABCX.js";
61
61
  import {
62
62
  blocksToMarkdown
63
- } from "./chunk-BHUYJBSQ.js";
64
- import "./chunk-AUFO5LVN.js";
63
+ } from "./chunk-WJLICIYV.js";
64
+ import "./chunk-MDCTITUG.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-QXNQ2HNB.js";
72
+ } from "./chunk-A2W2JQ3S.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-YIIRSBZS.js");
358
+ const { extractPdfMetadataOnly } = await import("./parser-M5WHRX25.js");
359
359
  metadata = await extractPdfMetadataOnly(buffer);
360
360
  } catch {
361
361
  metadata = void 0;
@@ -531,7 +531,7 @@ ${tableMarkdown}` }]
531
531
  if (!parsed.success) {
532
532
  return { content: [{ type: "text", text: `\uD30C\uC2F1 \uC2E4\uD328: ${parsed.error}` }], isError: true };
533
533
  }
534
- const { blocksToChunks } = await import("./chunks-P5Y7V73K.js");
534
+ const { blocksToChunks } = await import("./chunks-EBWJR55V.js");
535
535
  const chunks = blocksToChunks(parsed.blocks, { granularity, includeTableCells: include_table_cells });
536
536
  return { content: [{ type: "text", text: capResponseText(JSON.stringify(chunks, null, 2)) }] };
537
537
  } catch (err) {
@@ -776,7 +776,7 @@ ${previewMd}` }]
776
776
  }
777
777
  const image = new Uint8Array(await readFile2(imgResolved));
778
778
  const ext = extname2(imgResolved).slice(1).toLowerCase();
779
- const { placeSealHwpx } = await import("./seal-S4KJGZUI.js");
779
+ const { placeSealHwpx } = await import("./seal-IPKIQHYB.js");
780
780
  const result = await placeSealHwpx(buffer, [{
781
781
  anchor,
782
782
  occurrence,
@@ -893,7 +893,7 @@ ${previewMd}` }]
893
893
  if (outPath && await isSameFile(outPath, resolved)) {
894
894
  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 };
895
895
  }
896
- const { redactDocument } = await import("./redact-doc-YTP6AAUP.js");
896
+ const { redactDocument } = await import("./redact-doc-5MK5L5IQ.js");
897
897
  const r = await redactDocument(buffer, { rules, maskChar: mask_char, filePath: file_path, dryRun: dry_run });
898
898
  const MAX_LINES = 50;
899
899
  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}`);
@@ -967,7 +967,7 @@ function registerRenderTools(server2) {
967
967
  const { buffer, resolved } = await readValidatedFile(file_path, MAX_FILE_SIZE, /* @__PURE__ */ new Set([".hwpx", ".hwp"]));
968
968
  const isHwp5 = resolved.toLowerCase().endsWith(".hwp");
969
969
  if (!isHwp5 && !pages && (format === "png" || format === "svg")) {
970
- const { renderHwpxToSvg } = await import("./render-525LXDMV.js");
970
+ const { renderHwpxToSvg } = await import("./render-SYZMHYK6.js");
971
971
  const result = await renderHwpxToSvg(buffer, { highlights, reflow: true, reflowMode: reflow_mode });
972
972
  const summary2 = [
973
973
  `\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})`,
@@ -979,7 +979,7 @@ function registerRenderTools(server2) {
979
979
  summary2.push(`\uC800\uC7A5: ${outPath}`);
980
980
  return { content: [{ type: "text", text: summary2.join("\n") }] };
981
981
  }
982
- const { rasterizeSvg } = await import("./rasterize-OWHFWG6R.js");
982
+ const { rasterizeSvg } = await import("./rasterize-V2XHHS2I.js");
983
983
  const raster = await rasterizeSvg(result.svg, result.width, result.height, max_width_px ? { maxWidthPx: max_width_px } : void 0);
984
984
  if (outPath) {
985
985
  await mkdir2(dirname3(outPath), { recursive: true });
@@ -994,7 +994,7 @@ function registerRenderTools(server2) {
994
994
  ]
995
995
  };
996
996
  }
997
- const { renderDocument } = await import("./render-525LXDMV.js");
997
+ const { renderDocument } = await import("./render-SYZMHYK6.js");
998
998
  const { scene, assets } = await renderDocument(buffer, { format, pages, highlights, reflow: true, reflowMode: reflow_mode, maxWidthPx: max_width_px });
999
999
  const summary = [
1000
1000
  `\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})`,
@@ -1044,7 +1044,7 @@ function registerRenderTools(server2) {
1044
1044
  try {
1045
1045
  const { buffer } = await readValidatedFile(file_path, MAX_FILE_SIZE, /* @__PURE__ */ new Set([".hwpx", ".hwp"]));
1046
1046
  const dir = safeOutputPath(join2(output_dir, "regions.json"), /* @__PURE__ */ new Set([".json"])).replace(/[\\/]regions\.json$/, "");
1047
- const { extractRenderedRegions } = await import("./render-525LXDMV.js");
1047
+ const { extractRenderedRegions } = await import("./render-SYZMHYK6.js");
1048
1048
  const regions = await extractRenderedRegions(buffer, { types: target, format, pages, paddingPt: padding_pt, reflow: true });
1049
1049
  await mkdir2(dir, { recursive: true });
1050
1050
  const ext = format === "jpeg" ? "jpg" : "png";
@@ -1080,7 +1080,7 @@ function registerRenderTools(server2) {
1080
1080
  }
1081
1081
  const { buffer } = await readValidatedFile(file_path, MAX_FILE_SIZE, /* @__PURE__ */ new Set([".hwpx", ".hwp"]));
1082
1082
  const dir = output_dir ? safeOutputPath(join2(output_dir, "tables.json"), /* @__PURE__ */ new Set([".json"])).replace(/[\\/]tables\.json$/, "") : void 0;
1083
- const { extractTables } = await import("./visual-AU3NH6EO.js");
1083
+ const { extractTables } = await import("./visual-RTTGNOAE.js");
1084
1084
  const tables = await extractTables(buffer, { policy: visual, format, paddingPt: padding_pt });
1085
1085
  if (dir) await mkdir2(dir, { recursive: true });
1086
1086
  const ext = format === "jpeg" ? "jpg" : "png";
@@ -1137,7 +1137,7 @@ function registerGenerateTools(server2) {
1137
1137
  try {
1138
1138
  const out = safeOutputPath(output_path, PROFILE_EXTENSIONS);
1139
1139
  const { buffer } = await readValidatedFile(hwpx_path);
1140
- const { hwpxToProfile } = await import("./-UNMTWAEI.js");
1140
+ const { hwpxToProfile } = await import("./-2UA2JHVA.js");
1141
1141
  const profile = await hwpxToProfile(buffer);
1142
1142
  await mkdir3(dirname4(out), { recursive: true });
1143
1143
  await writeOutputFile(out, JSON.stringify(profile, null, 2));
@@ -1244,7 +1244,7 @@ function registerGenerateTools(server2) {
1244
1244
  }
1245
1245
  let profile;
1246
1246
  if (profile_path) {
1247
- const { parseFormatProfileJson } = await import("./profile-io-GU45HTYP.js");
1247
+ const { parseFormatProfileJson } = await import("./profile-io-5YB627EO.js");
1248
1248
  profile = parseFormatProfileJson(await readFile3(safePath(profile_path, PROFILE_EXTENSIONS), "utf-8"));
1249
1249
  }
1250
1250
  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-BQAJHAWR.js";
4
+ } from "./chunk-KQIYC2ZU.js";
5
5
  import {
6
6
  ALL_FORMULA_MODELS,
7
7
  getModelStatusIn,
8
8
  getModelsDir
9
- } from "./chunk-MY6Q2HFW.js";
10
- import "./chunk-N6MPDM55.js";
11
- import "./chunk-QXNQ2HNB.js";
9
+ } from "./chunk-XZA6X34R.js";
10
+ import "./chunk-6OCKAXIS.js";
11
+ import "./chunk-A2W2JQ3S.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-P2XOZ76Q.js.map
104
+ //# sourceMappingURL=model-bundle-MA4MMCRJ.js.map
@@ -10,10 +10,10 @@ import {
10
10
  ocrModelPath,
11
11
  ocrModelsCached,
12
12
  parseCharacterDict
13
- } from "./chunk-BQAJHAWR.js";
14
- import "./chunk-MY6Q2HFW.js";
15
- import "./chunk-N6MPDM55.js";
16
- import "./chunk-QXNQ2HNB.js";
13
+ } from "./chunk-KQIYC2ZU.js";
14
+ import "./chunk-XZA6X34R.js";
15
+ import "./chunk-6OCKAXIS.js";
16
+ import "./chunk-A2W2JQ3S.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-GPHBC2YJ.js.map
29
+ //# sourceMappingURL=models-SEJ7LNSN.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["/Users/mong-e/workspace/kordoc/dist/page-range-QHHFTL7X.cjs"],"names":[],"mappings":"AAAA;AACE;AACA;AACF,wDAA6B;AAC7B,gCAA6B;AAC7B;AACE;AACA;AACF,qIAAC","file":"/Users/mong-e/workspace/kordoc/dist/page-range-QHHFTL7X.cjs"}
1
+ {"version":3,"sources":["/Users/mong-e/workspace/kordoc-quality-99/dist/page-range-QHHFTL7X.cjs"],"names":[],"mappings":"AAAA;AACE;AACA;AACF,wDAA6B;AAC7B,gCAA6B;AAC7B;AACE;AACA;AACF,qIAAC","file":"/Users/mong-e/workspace/kordoc-quality-99/dist/page-range-QHHFTL7X.cjs"}
@@ -39,15 +39,15 @@ import {
39
39
  startsNewItem,
40
40
  trimTrailingEmptyTableCols,
41
41
  wrapJoiner
42
- } from "./chunk-KBIQGGNY.js";
42
+ } from "./chunk-4TSYMJDL.js";
43
43
  import {
44
44
  ocrModelsCached
45
- } from "./chunk-BQAJHAWR.js";
46
- import "./chunk-MY6Q2HFW.js";
47
- import "./chunk-N6MPDM55.js";
45
+ } from "./chunk-KQIYC2ZU.js";
46
+ import "./chunk-XZA6X34R.js";
47
+ import "./chunk-6OCKAXIS.js";
48
48
  import {
49
49
  blocksToPages
50
- } from "./chunk-OVSCNCT6.js";
50
+ } from "./chunk-O4CB7D2Q.js";
51
51
  import {
52
52
  encodePng
53
53
  } from "./chunk-7FCNOKOR.js";
@@ -65,11 +65,11 @@ import {
65
65
  WINGDINGS,
66
66
  blocksToMarkdown,
67
67
  escapeLiteralDollar
68
- } from "./chunk-BHUYJBSQ.js";
68
+ } from "./chunk-WJLICIYV.js";
69
69
  import {
70
70
  KordocError,
71
71
  sanitizeHref
72
- } from "./chunk-QXNQ2HNB.js";
72
+ } from "./chunk-A2W2JQ3S.js";
73
73
 
74
74
  // src/pdf/ocr-region-merge.ts
75
75
  function mergeOcrImageRegions(blocks, page, regions, ocrBlocks) {
@@ -689,6 +689,7 @@ function splitContactTables(blocks) {
689
689
  }
690
690
 
691
691
  // src/pdf/table-parts.ts
692
+ var flowText = (text) => text.replace(/<\/?u>|~~/g, "");
692
693
  var PART_COL_TOL = 1;
693
694
  var PART_COL_SNAP = 0.3;
694
695
  function anchorsOf(table) {
@@ -736,7 +737,7 @@ var indexOf = (coords, x) => {
736
737
  }
737
738
  return bestD <= PART_COL_TOL ? best : -1;
738
739
  };
739
- var rowText = (anchors, r) => anchors.filter((a) => a.r === r).map((a) => a.cell.text.replace(/\s+/g, "")).join("|");
740
+ var rowText = (anchors, r) => anchors.filter((a) => a.r === r).map((a) => flowText(a.cell.text).replace(/\s+/g, "")).join("|");
740
741
  var hasText = (t) => t.replace(/\|/g, "") !== "";
741
742
  function joinSplitParts(prev, pcx, curr, ccx, dx = 0, prevBottom, lex) {
742
743
  if (pcx.length !== prev.cols + 1 || ccx.length !== curr.cols + 1) return null;
@@ -952,8 +953,8 @@ function continuesAcross(u, d, x1, x2) {
952
953
  var OUTLINE_HEAD = /^[□■]\s*\S/;
953
954
  var OUTLINE_ITEM = /^[ㅇ○◦\-‐–·․‧※*]\s*\S/;
954
955
  function outlineContinues(u, d) {
955
- const U = u.text.split("\n").map((l) => l.trim()).filter(Boolean);
956
- const D = d.text.split("\n").map((l) => l.trim()).filter(Boolean);
956
+ const U = flowText(u.text).split("\n").map((l) => l.trim()).filter(Boolean);
957
+ const D = flowText(d.text).split("\n").map((l) => l.trim()).filter(Boolean);
957
958
  return U.length >= 2 && D.length >= 1 && U.some((l) => OUTLINE_HEAD.test(l)) && OUTLINE_ITEM.test(D[0]);
958
959
  }
959
960
  function lineEnded(c, x1, x2, next) {
@@ -965,7 +966,7 @@ function lineEnded(c, x1, x2, next) {
965
966
  return x2 - l.r - (l.l - x1) >= Math.max(LABEL_ROOM, firstWordUnits(next?.text ?? "")) * h;
966
967
  }
967
968
  function firstWordUnits(text) {
968
- const word = text.trim().replace(/^([(\[「『<〈])\s+/, "$1").split(/\s+/)[0] ?? "";
969
+ const word = flowText(text).trim().replace(/^([(\[「『<〈])\s+/, "$1").split(/\s+/)[0] ?? "";
969
970
  let units = 0;
970
971
  for (const ch of word) units += /[가-힣\u3400-\u9fff]/.test(ch) ? 1 : 0.55;
971
972
  return units;
@@ -985,7 +986,7 @@ var batchim = (ch) => {
985
986
  return k >= 0 && k < 11172 && k % 28 !== 0;
986
987
  };
987
988
  function clauseContinues(u, d) {
988
- const tail = u.text.trim().split(/\s+/).pop() ?? "", head = d.text.trim();
989
+ const tail = flowText(u.text).trim().split(/\s+/).pop() ?? "", head = flowText(d.text).trim();
989
990
  if (!/^[가-힣]{2,}$/.test(tail) || !/^[가-힣]/.test(head) || startsNewItem(u.text, head)) return false;
990
991
  const last = tail[tail.length - 1], before = tail[tail.length - 2];
991
992
  return last === "\uC744" && batchim(before) || last === "\uB97C" && !batchim(before) || CLAUSE_OPEN_ENDING.test(tail);
@@ -998,6 +999,7 @@ function wordOverflows(u, d, x1, x2) {
998
999
  }
999
1000
  var KO_ORDER = "\uAC00\uB098\uB2E4\uB77C\uB9C8\uBC14\uC0AC\uC544\uC790\uCC28\uCE74\uD0C0\uD30C\uD558";
1000
1001
  function itemMark(line) {
1002
+ line = flowText(line).trim();
1001
1003
  let m = /^(\d{1,2})([.)])(?!\d)/.exec(line);
1002
1004
  if (m) return { style: "1" + m[2], n: +m[1] };
1003
1005
  if (m = /^\((\d{1,2})\)/.exec(line)) return { style: "(1)", n: +m[1] };
@@ -1049,7 +1051,7 @@ function mergeSplitRow(table, owner, first, colXs, textOnly = false, cut = NO_CU
1049
1051
  const contentPairs = pairs.filter(([u, d]) => hasContent(u.cell) && hasContent(d.cell));
1050
1052
  const carriedSplit = !textOnly && carried && !newCell && (contentPairs.length <= 1 || contentPairs.every(([, d]) => d.rs > 1) || !cut.ruled && contentPairs.some(([u, d]) => wordOverflows(cell(u), cell(d), colXs[u.c], colXs[u.c + u.cs])));
1051
1053
  if (!carriedSplit) {
1052
- const norm = (c) => c.text.replace(/\s+/g, "");
1054
+ const norm = (c) => flowText(c.text).replace(/\s+/g, "");
1053
1055
  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;
1054
1056
  const flows = ([u, d]) => continuesAcross(cell(u), cell(d), colXs[u.c], colXs[u.c + u.cs]) || clauseContinues(cell(u), cell(d));
1055
1057
  if (!(cut.open && !newCell)) {
@@ -1146,6 +1148,20 @@ function mergeCrossPageTables(blocks, pageHeights, lex) {
1146
1148
  blocks.splice(j, 1);
1147
1149
  continue;
1148
1150
  }
1151
+ if (px && cx && !CLIP_TABLES.has(prev.table) && !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 && CELL_LINES.has(c))) {
1152
+ const dx = px[0] - cx[0];
1153
+ const part = joinSplitParts(prev.table, px, curr.table, cx.map((x) => x + dx), dx, void 0, lex);
1154
+ if (part?.split && part.table.rows === prev.table.rows + currCells.length - 1) {
1155
+ const last = prev.table.rows - 1;
1156
+ for (let c = 0; c < part.table.cols; c++) {
1157
+ const U = CELL_LINES.get(prev.table.cells[last][c]), D = CELL_LINES.get(currCells[0][c]);
1158
+ CELL_LINES.set(part.table.cells[last][c], U.concat(D.map((l) => ({ ...l, l: l.l + dx, r: l.r + dx }))));
1159
+ }
1160
+ TABLE_COLXS.set(part.table, part.colXs);
1161
+ placeJoined(blocks, i, j, part.table);
1162
+ continue;
1163
+ }
1164
+ }
1149
1165
  const merged = {
1150
1166
  rows: prev.table.rows + currCells.length,
1151
1167
  cols: prev.table.cols,
@@ -1230,7 +1246,7 @@ function prevLacksLeftCols(prev, px, xs, pageHeights) {
1230
1246
  return xs[0] < px[0] && xs.slice(1, -1).some((x) => Math.abs(x - px[0]) <= CONTINUATION_COL_TOL);
1231
1247
  }
1232
1248
  function headingRow(row) {
1233
- const heads = row.map((c) => c.text.replace(/\s+/g, "")).filter(Boolean);
1249
+ const heads = row.map((c) => flowText(c.text).replace(/\s+/g, "")).filter(Boolean);
1234
1250
  if (heads.length === 1) return heads[0].length <= 8 || /^[①-⑳❶-❿]/.test(heads[0]);
1235
1251
  return heads.length === 2 && /^(?:\d{1,2}|[ⅠⅡⅢⅣⅤⅥⅦⅧⅨⅩ]+|[①-⑳❶-❿])$/.test(heads[0]);
1236
1252
  }
@@ -1241,7 +1257,7 @@ function looksContinued(prev, curr, pageHeights) {
1241
1257
  const firstRow = curr.table.cells[0] ?? [];
1242
1258
  const firstText = firstRow.find((c) => c.text.trim())?.text ?? "";
1243
1259
  if (!ANNEX_HEAD_RE.test(firstText)) return true;
1244
- const filled = firstRow.map((c) => c.text.replace(/\s+/g, "")).filter(Boolean);
1260
+ const filled = firstRow.map((c) => flowText(c.text).replace(/\s+/g, "")).filter(Boolean);
1245
1261
  return filled.length >= 2 && filled.every((t) => t === filled[0]);
1246
1262
  }
1247
1263
  function pushedLead(prev, curr) {
@@ -1270,7 +1286,7 @@ function tailOf(b) {
1270
1286
  function firstRowSig(t) {
1271
1287
  const x = TABLE_COLXS.get(t);
1272
1288
  if (!x || x.length !== t.cols + 1) return null;
1273
- return anchorsOf(t).filter((a) => a.r === 0).map((a) => ({ x1: x[a.c], x2: x[a.c + a.cs], t: a.cell.text.replace(/\s+/g, "") }));
1289
+ 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, "") }));
1274
1290
  }
1275
1291
  function restartsTable(blocks, i, curr, pageHeights) {
1276
1292
  const cs = firstRowSig(curr);
@@ -1295,7 +1311,7 @@ function restartsTitledForm(head, curr) {
1295
1311
  if (head.rows < 2 || curr.rows < 2 || head.cols !== curr.cols) return false;
1296
1312
  const full = (t) => t.cells[0][0]?.colSpan === t.cols;
1297
1313
  if (!full(head) || !full(curr)) return false;
1298
- const norm = (c) => (c?.text ?? "").replace(/\s+/g, "");
1314
+ const norm = (c) => flowText(c?.text ?? "").replace(/\s+/g, "");
1299
1315
  const ht = norm(head.cells[0][0]), ct = norm(curr.cells[0][0]);
1300
1316
  if (!ht || !ct || ht === ct) return false;
1301
1317
  const titleLike = (t) => t.length <= TITLE_ROW_MAX_CHARS && !/^[ㅇ○◦•·\-–※*□■▪☞]/.test(t);
@@ -1331,7 +1347,7 @@ function chainHead(blocks, i, pageHeights) {
1331
1347
  }
1332
1348
  function rowTextsEqual(a, b) {
1333
1349
  if (a.length !== b.length) return false;
1334
- const norm = (t) => t.replace(/\s+/g, "");
1350
+ const norm = (t) => flowText(t).replace(/\s+/g, "");
1335
1351
  for (let i = 0; i < a.length; i++) {
1336
1352
  if (norm(a[i].text) !== norm(b[i].text)) return false;
1337
1353
  }
@@ -2696,7 +2712,7 @@ function mergeLinkRuns(markdown) {
2696
2712
 
2697
2713
  // src/pdf/formula-ocr.ts
2698
2714
  async function applyFormulaOcr(buffer, blocks, pageFilter, effectivePageCount, warnings, _onProgress) {
2699
- const formulaMod = await import("./formula-VH545WNH.js");
2715
+ const formulaMod = await import("./formula-MBLN2DG4.js");
2700
2716
  const { FormulaPipeline, ensureFormulaModels } = formulaMod;
2701
2717
  await ensureFormulaModels((p) => {
2702
2718
  if (p.phase === "download" && p.total) {
@@ -3079,7 +3095,7 @@ async function parsePdfDocument(buffer, options) {
3079
3095
  }
3080
3096
  if (targets.size > 0) {
3081
3097
  try {
3082
- const { runPdfOcr } = await import("./pdf-ocr-5YBMXW54.js");
3098
+ const { runPdfOcr } = await import("./pdf-ocr-QB2TB5W5.js");
3083
3099
  const mode = typeof options?.ocr === "function" ? options.ocr : "builtin";
3084
3100
  const regionPages = new Map([...ocrRegions].filter(([p]) => options?.ocr !== "force" && !isImageBased && !pageQuality.find((q) => q.page === p)?.needsOcr));
3085
3101
  const ocrPageBlocks = await runPdfOcr(ocrBuffer, targets, mode, warnings, options?.onProgress, options?.tables !== false, vectorPageOps, regionPages);
@@ -3204,7 +3220,8 @@ async function parsePdfDocument(buffer, options) {
3204
3220
  return b.bbox.y > h * 0.1 && b.bbox.y + b.bbox.height < h * 0.9;
3205
3221
  });
3206
3222
  joinLatinCellWraps(outBlocks);
3207
- if (options?.layoutTables !== "keep" && await isHancomPdf(doc)) {
3223
+ if (options?.layoutTables !== "keep") {
3224
+ const hancom = await isHancomPdf(doc);
3208
3225
  const shown = /* @__PURE__ */ new Map();
3209
3226
  const markContent = (bs) => {
3210
3227
  for (const b of bs ?? []) if (b.table) for (const row of b.table.cells) for (const c of row) {
@@ -3214,6 +3231,7 @@ async function parsePdfDocument(buffer, options) {
3214
3231
  };
3215
3232
  const visual = (bs) => bs.flatMap((b) => {
3216
3233
  if (b.type !== "table") return [b];
3234
+ if (!hancom && b.table && CLIP_TABLES.has(b.table)) return [b];
3217
3235
  let v = shown.get(b);
3218
3236
  if (!v) {
3219
3237
  markContent([b]);
@@ -3309,4 +3327,4 @@ export {
3309
3327
  parsePdfDocument,
3310
3328
  removeHeaderFooterBlocks
3311
3329
  };
3312
- //# sourceMappingURL=parser-YIIRSBZS.js.map
3330
+ //# sourceMappingURL=parser-M5WHRX25.js.map