kordoc 4.16.2 → 4.16.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.
Files changed (115) hide show
  1. package/README.md +3 -6
  2. package/dist/{-4G6MA4X6.js → -5XQIJN3D.js} +10 -10
  3. package/dist/{chunk-UTP2WCHS.js → chunk-2EJ5YSFZ.js} +4 -4
  4. package/dist/{chunk-IQGIT2VX.js → chunk-3ZVZPYSA.js} +5 -5
  5. package/dist/{chunk-TXUKTOG2.js → chunk-46H2PPG7.js} +3 -3
  6. package/dist/{chunk-7KNGSQU7.js → chunk-4O5XQSCT.js} +2 -2
  7. package/dist/{chunk-MLIS253L.js → chunk-7NYRZI2Z.js} +2 -2
  8. package/dist/{chunk-GO5IFOUF.js → chunk-7USPM2VT.js} +2 -2
  9. package/dist/{chunk-XTFN5WKS.cjs → chunk-7WV3WETF.cjs} +6 -6
  10. package/dist/{chunk-XTFN5WKS.cjs.map → chunk-7WV3WETF.cjs.map} +1 -1
  11. package/dist/{chunk-KIOQ4N37.js → chunk-AL2WM6ZZ.js} +2 -2
  12. package/dist/{chunk-F4NRLLY4.js → chunk-AWWFGIBA.js} +2 -2
  13. package/dist/{chunk-QOCS7W7R.js → chunk-D2UGAEXY.js} +9 -9
  14. package/dist/{chunk-P6ZDXTV6.js → chunk-ENF34XNH.js} +2 -2
  15. package/dist/{chunk-5KS5PWJR.js → chunk-GGGO3OH2.js} +2 -2
  16. package/dist/{chunk-JFLAM3MM.js → chunk-GH2JGKWP.js} +2 -2
  17. package/dist/{chunk-S2PL227Q.js → chunk-IE6QX3T3.js} +2 -2
  18. package/dist/{chunk-LEIAEWZ7.js → chunk-JIFG35UT.js} +2 -2
  19. package/dist/{chunk-DES2LGFZ.js → chunk-LQAKDKSF.js} +2 -2
  20. package/dist/{chunk-SFEQYKYJ.js → chunk-MC2SRJXO.js} +2 -2
  21. package/dist/{chunk-STM3ORY7.cjs → chunk-PMULUMUF.cjs} +2 -2
  22. package/dist/{chunk-STM3ORY7.cjs.map → chunk-PMULUMUF.cjs.map} +1 -1
  23. package/dist/{chunk-FSDJLAOW.js → chunk-QPJXYJIK.js} +55 -1
  24. package/dist/chunk-QPJXYJIK.js.map +1 -0
  25. package/dist/{chunk-OXLPVQYK.js → chunk-T2QHY3S5.js} +3 -3
  26. package/dist/{chunk-4VODJKFL.js → chunk-UCGGVNTD.js} +3 -3
  27. package/dist/{chunk-AUWGDP4G.js → chunk-XPYK7Z73.js} +2 -2
  28. package/dist/{chunk-FKUDAIJI.cjs → chunk-YJECRT5Q.cjs} +12 -12
  29. package/dist/{chunk-FKUDAIJI.cjs.map → chunk-YJECRT5Q.cjs.map} +1 -1
  30. package/dist/{chunk-WDQTFAXY.cjs → chunk-YOCFY44Z.cjs} +11 -11
  31. package/dist/{chunk-WDQTFAXY.cjs.map → chunk-YOCFY44Z.cjs.map} +1 -1
  32. package/dist/{chunk-JELRWAZC.js → chunk-YUZZNS6E.js} +2 -2
  33. package/dist/{chunk-CEIATRDW.cjs → chunk-Z3RFAVZ2.cjs} +3 -3
  34. package/dist/{chunk-CEIATRDW.cjs.map → chunk-Z3RFAVZ2.cjs.map} +1 -1
  35. package/dist/chunks-GBPAQ6JM.js +10 -0
  36. package/dist/cli.js +31 -50
  37. package/dist/cli.js.map +1 -1
  38. package/dist/{formula-EPKLPDU7.js → formula-EUX2AHXG.js} +3 -3
  39. package/dist/{formula-NARUOXRX.js → formula-IMEE5OJR.js} +4 -4
  40. package/dist/{formula-WIMV5TUX.cjs → formula-NPOU4BSO.cjs} +9 -9
  41. package/dist/{formula-WIMV5TUX.cjs.map → formula-NPOU4BSO.cjs.map} +1 -1
  42. package/dist/{image-ocr-3WJ4QH3T.js → image-ocr-CCIE3SPX.js} +7 -7
  43. package/dist/{image-ocr-AXWXR6JV.cjs → image-ocr-LTSQRHCN.cjs} +14 -14
  44. package/dist/{image-ocr-AXWXR6JV.cjs.map → image-ocr-LTSQRHCN.cjs.map} +1 -1
  45. package/dist/{image-ocr-5BUJQ4TK.js → image-ocr-QLW5VL4M.js} +5 -5
  46. package/dist/index.cjs +237 -237
  47. package/dist/index.js +4 -4
  48. package/dist/mcp.js +30 -37
  49. package/dist/mcp.js.map +1 -1
  50. package/dist/{model-bundle-IMBW7D2Z.js → model-bundle-VRKRVD6Z.js} +5 -5
  51. package/dist/{models-SY75IBOE.js → models-GSZIPSV2.js} +5 -5
  52. package/dist/{parser-N6476XAC.js → parser-64C45UPQ.js} +10 -10
  53. package/dist/{parser-ZQM3664Z.js → parser-NARS2CF7.js} +7 -7
  54. package/dist/{parser-2LU4EVU3.cjs → parser-U52HRNOY.cjs} +81 -81
  55. package/dist/{parser-2LU4EVU3.cjs.map → parser-U52HRNOY.cjs.map} +1 -1
  56. package/dist/pdf-ocr-4QWLMFJQ.js +18 -0
  57. package/dist/pdf-ocr-C7RXT5YU.cjs +16 -0
  58. package/dist/{pdf-ocr-GHEJVPX2.cjs.map → pdf-ocr-C7RXT5YU.cjs.map} +1 -1
  59. package/dist/pdf-ocr-ZYRJLOWQ.js +15 -0
  60. package/dist/{profile-io-GJPKCYPT.js → profile-io-PZBOSV5X.js} +3 -3
  61. package/dist/{rasterize-UOALJQDS.js → rasterize-DXBWM6T2.js} +3 -3
  62. package/dist/{redact-doc-22SYW3KH.js → redact-doc-FLMBZ53F.js} +10 -10
  63. package/dist/{render-MJ4H3R23.js → render-QNWUOQXJ.js} +6 -6
  64. package/dist/seal-NNZUQPDJ.js +10 -0
  65. package/dist/{setup-2URYVUEO.js → setup-3OR4QZFF.js} +3 -3
  66. package/dist/visual-RDGSACGE.js +20 -0
  67. package/dist/{watch-ALXZGTOB.js → watch-5A52FP6G.js} +11 -11
  68. package/package.json +1 -1
  69. package/dist/chunk-FSDJLAOW.js.map +0 -1
  70. package/dist/chunks-NUNIKS2J.js +0 -10
  71. package/dist/pdf-ocr-6DEE23IP.js +0 -15
  72. package/dist/pdf-ocr-GHEJVPX2.cjs +0 -16
  73. package/dist/pdf-ocr-MQTWODVU.js +0 -18
  74. package/dist/seal-XWMRUTI4.js +0 -10
  75. package/dist/visual-USPS4QRC.js +0 -20
  76. /package/dist/{-4G6MA4X6.js.map → -5XQIJN3D.js.map} +0 -0
  77. /package/dist/{chunk-UTP2WCHS.js.map → chunk-2EJ5YSFZ.js.map} +0 -0
  78. /package/dist/{chunk-IQGIT2VX.js.map → chunk-3ZVZPYSA.js.map} +0 -0
  79. /package/dist/{chunk-TXUKTOG2.js.map → chunk-46H2PPG7.js.map} +0 -0
  80. /package/dist/{chunk-7KNGSQU7.js.map → chunk-4O5XQSCT.js.map} +0 -0
  81. /package/dist/{chunk-MLIS253L.js.map → chunk-7NYRZI2Z.js.map} +0 -0
  82. /package/dist/{chunk-GO5IFOUF.js.map → chunk-7USPM2VT.js.map} +0 -0
  83. /package/dist/{chunk-KIOQ4N37.js.map → chunk-AL2WM6ZZ.js.map} +0 -0
  84. /package/dist/{chunk-F4NRLLY4.js.map → chunk-AWWFGIBA.js.map} +0 -0
  85. /package/dist/{chunk-QOCS7W7R.js.map → chunk-D2UGAEXY.js.map} +0 -0
  86. /package/dist/{chunk-P6ZDXTV6.js.map → chunk-ENF34XNH.js.map} +0 -0
  87. /package/dist/{chunk-5KS5PWJR.js.map → chunk-GGGO3OH2.js.map} +0 -0
  88. /package/dist/{chunk-JFLAM3MM.js.map → chunk-GH2JGKWP.js.map} +0 -0
  89. /package/dist/{chunk-S2PL227Q.js.map → chunk-IE6QX3T3.js.map} +0 -0
  90. /package/dist/{chunk-LEIAEWZ7.js.map → chunk-JIFG35UT.js.map} +0 -0
  91. /package/dist/{chunk-DES2LGFZ.js.map → chunk-LQAKDKSF.js.map} +0 -0
  92. /package/dist/{chunk-SFEQYKYJ.js.map → chunk-MC2SRJXO.js.map} +0 -0
  93. /package/dist/{chunk-OXLPVQYK.js.map → chunk-T2QHY3S5.js.map} +0 -0
  94. /package/dist/{chunk-4VODJKFL.js.map → chunk-UCGGVNTD.js.map} +0 -0
  95. /package/dist/{chunk-AUWGDP4G.js.map → chunk-XPYK7Z73.js.map} +0 -0
  96. /package/dist/{chunk-JELRWAZC.js.map → chunk-YUZZNS6E.js.map} +0 -0
  97. /package/dist/{chunks-NUNIKS2J.js.map → chunks-GBPAQ6JM.js.map} +0 -0
  98. /package/dist/{formula-EPKLPDU7.js.map → formula-EUX2AHXG.js.map} +0 -0
  99. /package/dist/{formula-NARUOXRX.js.map → formula-IMEE5OJR.js.map} +0 -0
  100. /package/dist/{image-ocr-3WJ4QH3T.js.map → image-ocr-CCIE3SPX.js.map} +0 -0
  101. /package/dist/{image-ocr-5BUJQ4TK.js.map → image-ocr-QLW5VL4M.js.map} +0 -0
  102. /package/dist/{model-bundle-IMBW7D2Z.js.map → model-bundle-VRKRVD6Z.js.map} +0 -0
  103. /package/dist/{models-SY75IBOE.js.map → models-GSZIPSV2.js.map} +0 -0
  104. /package/dist/{parser-N6476XAC.js.map → parser-64C45UPQ.js.map} +0 -0
  105. /package/dist/{parser-ZQM3664Z.js.map → parser-NARS2CF7.js.map} +0 -0
  106. /package/dist/{pdf-ocr-6DEE23IP.js.map → pdf-ocr-4QWLMFJQ.js.map} +0 -0
  107. /package/dist/{pdf-ocr-MQTWODVU.js.map → pdf-ocr-ZYRJLOWQ.js.map} +0 -0
  108. /package/dist/{profile-io-GJPKCYPT.js.map → profile-io-PZBOSV5X.js.map} +0 -0
  109. /package/dist/{rasterize-UOALJQDS.js.map → rasterize-DXBWM6T2.js.map} +0 -0
  110. /package/dist/{redact-doc-22SYW3KH.js.map → redact-doc-FLMBZ53F.js.map} +0 -0
  111. /package/dist/{render-MJ4H3R23.js.map → render-QNWUOQXJ.js.map} +0 -0
  112. /package/dist/{seal-XWMRUTI4.js.map → seal-NNZUQPDJ.js.map} +0 -0
  113. /package/dist/{setup-2URYVUEO.js.map → setup-3OR4QZFF.js.map} +0 -0
  114. /package/dist/{visual-USPS4QRC.js.map → visual-RDGSACGE.js.map} +0 -0
  115. /package/dist/{watch-ALXZGTOB.js.map → watch-5A52FP6G.js.map} +0 -0
package/dist/index.js CHANGED
@@ -16,7 +16,7 @@ import {
16
16
  mapPuaText,
17
17
  markNonLayoutTable,
18
18
  noteSuffix
19
- } from "./chunk-7KNGSQU7.js";
19
+ } from "./chunk-4O5XQSCT.js";
20
20
  import {
21
21
  parsePageRange
22
22
  } from "./chunk-V4BH5SRQ.js";
@@ -45,7 +45,7 @@ import {
45
45
  toArrayBuffer,
46
46
  unescapeHtml,
47
47
  unzipLimitBytes
48
- } from "./chunk-MLIS253L.js";
48
+ } from "./chunk-7NYRZI2Z.js";
49
49
 
50
50
  // src/plain-markdown.ts
51
51
  function toPlainMarkdown(md2) {
@@ -40605,7 +40605,7 @@ function scriptsOff(r, off) {
40605
40605
  }
40606
40606
  async function parseImage(buffer, options) {
40607
40607
  try {
40608
- const { parseImageDocument } = await import("./image-ocr-5BUJQ4TK.js");
40608
+ const { parseImageDocument } = await import("./image-ocr-QLW5VL4M.js");
40609
40609
  const { blocks, warnings } = await parseImageDocument(buffer, options);
40610
40610
  stripScriptTags({ blocks });
40611
40611
  return {
@@ -40665,7 +40665,7 @@ async function parseHwp(buffer, options) {
40665
40665
  async function parsePdf(buffer, options) {
40666
40666
  let parsePdfDocument;
40667
40667
  try {
40668
- const mod = await import("./parser-ZQM3664Z.js");
40668
+ const mod = await import("./parser-NARS2CF7.js");
40669
40669
  parsePdfDocument = mod.parsePdfDocument;
40670
40670
  } catch {
40671
40671
  return {
package/dist/mcp.js CHANGED
@@ -3,7 +3,7 @@ import {
3
3
  assertWithinRoot,
4
4
  getAccessRoot,
5
5
  isOfflineMode
6
- } from "./chunk-JELRWAZC.js";
6
+ } from "./chunk-YUZZNS6E.js";
7
7
  import {
8
8
  APPROVAL_MAX,
9
9
  BODY_FONTS,
@@ -20,8 +20,9 @@ import {
20
20
  PRESS_CONTACT_KEYS,
21
21
  SIZE_KEYS,
22
22
  SIZE_PT_RANGE,
23
- buildGongmunOptions
24
- } from "./chunk-FSDJLAOW.js";
23
+ buildGongmunOptions,
24
+ loadGenerationImages
25
+ } from "./chunk-QPJXYJIK.js";
25
26
  import {
26
27
  BUILTIN_TEMPLATES,
27
28
  PRESET_ALIAS,
@@ -42,25 +43,25 @@ import {
42
43
  resolveBuiltinTemplate,
43
44
  unknownFontWarnings,
44
45
  usesGaejosikMunche
45
- } from "./chunk-QOCS7W7R.js";
46
- import "./chunk-AUWGDP4G.js";
47
- import "./chunk-4VODJKFL.js";
46
+ } from "./chunk-D2UGAEXY.js";
47
+ import "./chunk-XPYK7Z73.js";
48
+ import "./chunk-UCGGVNTD.js";
48
49
  import "./chunk-3WSNLH4B.js";
49
- import "./chunk-GO5IFOUF.js";
50
+ import "./chunk-7USPM2VT.js";
50
51
  import {
51
52
  detectFormat,
52
53
  detectOle2Format,
53
54
  detectZipFormat,
54
55
  extractHwp5MetadataOnly
55
- } from "./chunk-IQGIT2VX.js";
56
+ } from "./chunk-3ZVZPYSA.js";
56
57
  import "./chunk-7FCNOKOR.js";
57
58
  import "./chunk-J3IF6KGW.js";
58
59
  import "./chunk-VQFA55IC.js";
59
- import "./chunk-JFLAM3MM.js";
60
+ import "./chunk-GH2JGKWP.js";
60
61
  import {
61
62
  blocksToMarkdown
62
- } from "./chunk-LEIAEWZ7.js";
63
- import "./chunk-S2PL227Q.js";
63
+ } from "./chunk-JIFG35UT.js";
64
+ import "./chunk-IE6QX3T3.js";
64
65
  import {
65
66
  KordocError,
66
67
  VERSION,
@@ -68,7 +69,7 @@ import {
68
69
  routeConsoleToStderr,
69
70
  sanitizeError,
70
71
  toArrayBuffer
71
- } from "./chunk-P6ZDXTV6.js";
72
+ } from "./chunk-ENF34XNH.js";
72
73
 
73
74
  // src/mcp.ts
74
75
  import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
@@ -352,7 +353,7 @@ ${markdown}`);
352
353
  break;
353
354
  case "pdf":
354
355
  try {
355
- const { extractPdfMetadataOnly } = await import("./parser-N6476XAC.js");
356
+ const { extractPdfMetadataOnly } = await import("./parser-64C45UPQ.js");
356
357
  metadata = await extractPdfMetadataOnly(buffer);
357
358
  } catch {
358
359
  metadata = void 0;
@@ -528,7 +529,7 @@ ${tableMarkdown}` }]
528
529
  if (!parsed.success) {
529
530
  return { content: [{ type: "text", text: `\uD30C\uC2F1 \uC2E4\uD328: ${parsed.error}` }], isError: true };
530
531
  }
531
- const { blocksToChunks } = await import("./chunks-NUNIKS2J.js");
532
+ const { blocksToChunks } = await import("./chunks-GBPAQ6JM.js");
532
533
  const chunks = blocksToChunks(parsed.blocks, { granularity, includeTableCells: include_table_cells });
533
534
  return { content: [{ type: "text", text: capResponseText(JSON.stringify(chunks, null, 2)) }] };
534
535
  } catch (err) {
@@ -773,7 +774,7 @@ ${previewMd}` }]
773
774
  }
774
775
  const image = new Uint8Array(await readFile2(imgResolved));
775
776
  const ext = extname2(imgResolved).slice(1).toLowerCase();
776
- const { placeSealHwpx } = await import("./seal-XWMRUTI4.js");
777
+ const { placeSealHwpx } = await import("./seal-NNZUQPDJ.js");
777
778
  const result = await placeSealHwpx(buffer, [{
778
779
  anchor,
779
780
  occurrence,
@@ -890,7 +891,7 @@ ${previewMd}` }]
890
891
  if (outPath && await isSameFile(outPath, resolved)) {
891
892
  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 };
892
893
  }
893
- const { redactDocument } = await import("./redact-doc-22SYW3KH.js");
894
+ const { redactDocument } = await import("./redact-doc-FLMBZ53F.js");
894
895
  const r = await redactDocument(buffer, { rules, maskChar: mask_char, filePath: file_path, dryRun: dry_run });
895
896
  const MAX_LINES = 50;
896
897
  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}`);
@@ -964,7 +965,7 @@ function registerRenderTools(server2) {
964
965
  const { buffer, resolved } = await readValidatedFile(file_path, MAX_FILE_SIZE, /* @__PURE__ */ new Set([".hwpx", ".hwp"]));
965
966
  const isHwp5 = resolved.toLowerCase().endsWith(".hwp");
966
967
  if (!isHwp5 && !pages && (format === "png" || format === "svg")) {
967
- const { renderHwpxToSvg } = await import("./render-MJ4H3R23.js");
968
+ const { renderHwpxToSvg } = await import("./render-QNWUOQXJ.js");
968
969
  const result = await renderHwpxToSvg(buffer, { highlights, reflow: true, reflowMode: reflow_mode });
969
970
  const summary2 = [
970
971
  `\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})`,
@@ -976,7 +977,7 @@ function registerRenderTools(server2) {
976
977
  summary2.push(`\uC800\uC7A5: ${outPath}`);
977
978
  return { content: [{ type: "text", text: summary2.join("\n") }] };
978
979
  }
979
- const { rasterizeSvg } = await import("./rasterize-UOALJQDS.js");
980
+ const { rasterizeSvg } = await import("./rasterize-DXBWM6T2.js");
980
981
  const raster = await rasterizeSvg(result.svg, result.width, result.height, max_width_px ? { maxWidthPx: max_width_px } : void 0);
981
982
  if (outPath) {
982
983
  await mkdir2(dirname3(outPath), { recursive: true });
@@ -991,7 +992,7 @@ function registerRenderTools(server2) {
991
992
  ]
992
993
  };
993
994
  }
994
- const { renderDocument } = await import("./render-MJ4H3R23.js");
995
+ const { renderDocument } = await import("./render-QNWUOQXJ.js");
995
996
  const { scene, assets } = await renderDocument(buffer, { format, pages, highlights, reflow: true, reflowMode: reflow_mode, maxWidthPx: max_width_px });
996
997
  const summary = [
997
998
  `\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})`,
@@ -1041,7 +1042,7 @@ function registerRenderTools(server2) {
1041
1042
  try {
1042
1043
  const { buffer } = await readValidatedFile(file_path, MAX_FILE_SIZE, /* @__PURE__ */ new Set([".hwpx", ".hwp"]));
1043
1044
  const dir = safeOutputPath(join2(output_dir, "regions.json"), /* @__PURE__ */ new Set([".json"])).replace(/[\\/]regions\.json$/, "");
1044
- const { extractRenderedRegions } = await import("./render-MJ4H3R23.js");
1045
+ const { extractRenderedRegions } = await import("./render-QNWUOQXJ.js");
1045
1046
  const regions = await extractRenderedRegions(buffer, { types: target, format, pages, paddingPt: padding_pt, reflow: true });
1046
1047
  await mkdir2(dir, { recursive: true });
1047
1048
  const ext = format === "jpeg" ? "jpg" : "png";
@@ -1077,7 +1078,7 @@ function registerRenderTools(server2) {
1077
1078
  }
1078
1079
  const { buffer } = await readValidatedFile(file_path, MAX_FILE_SIZE, /* @__PURE__ */ new Set([".hwpx", ".hwp"]));
1079
1080
  const dir = output_dir ? safeOutputPath(join2(output_dir, "tables.json"), /* @__PURE__ */ new Set([".json"])).replace(/[\\/]tables\.json$/, "") : void 0;
1080
- const { extractTables } = await import("./visual-USPS4QRC.js");
1081
+ const { extractTables } = await import("./visual-RDGSACGE.js");
1081
1082
  const tables = await extractTables(buffer, { policy: visual, format, paddingPt: padding_pt });
1082
1083
  if (dir) await mkdir2(dir, { recursive: true });
1083
1084
  const ext = format === "jpeg" ? "jpg" : "png";
@@ -1120,8 +1121,8 @@ ${json}` }] };
1120
1121
 
1121
1122
  // src/mcp/tools-generate.ts
1122
1123
  import { z as z4 } from "zod";
1123
- import { readFile as readFile3, mkdir as mkdir3, realpath as realpath3 } from "fs/promises";
1124
- import { resolve as resolve2, dirname as dirname4, join as join3 } from "path";
1124
+ import { readFile as readFile3, mkdir as mkdir3 } from "fs/promises";
1125
+ import { dirname as dirname4 } from "path";
1125
1126
  function registerGenerateTools(server2) {
1126
1127
  server2.tool(
1127
1128
  "extract_profile",
@@ -1134,7 +1135,7 @@ function registerGenerateTools(server2) {
1134
1135
  try {
1135
1136
  const out = safeOutputPath(output_path, PROFILE_EXTENSIONS);
1136
1137
  const { buffer } = await readValidatedFile(hwpx_path);
1137
- const { hwpxToProfile } = await import("./-4G6MA4X6.js");
1138
+ const { hwpxToProfile } = await import("./-5XQIJN3D.js");
1138
1139
  const profile = await hwpxToProfile(buffer);
1139
1140
  await mkdir3(dirname4(out), { recursive: true });
1140
1141
  await writeOutputFile(out, JSON.stringify(profile, null, 2));
@@ -1241,7 +1242,7 @@ function registerGenerateTools(server2) {
1241
1242
  }
1242
1243
  let profile;
1243
1244
  if (profile_path) {
1244
- const { parseFormatProfileJson } = await import("./profile-io-GJPKCYPT.js");
1245
+ const { parseFormatProfileJson } = await import("./profile-io-PZBOSV5X.js");
1245
1246
  profile = parseFormatProfileJson(await readFile3(safePath(profile_path, PROFILE_EXTENSIONS), "utf-8"));
1246
1247
  }
1247
1248
  const out = safeOutputPath(output_path, /* @__PURE__ */ new Set([".hwpx"]));
@@ -1252,21 +1253,13 @@ function registerGenerateTools(server2) {
1252
1253
  ...header ? { header } : {},
1253
1254
  ...footer ? { footer } : {}
1254
1255
  } : void 0;
1256
+ const genWarnings = [];
1255
1257
  let images;
1256
1258
  if (image_dir) {
1257
- const dir = await realpath3(resolve2(image_dir));
1258
- assertWithinRoot(dir);
1259
- for (const m of markdown.matchAll(/!\[[^\]]*\]\(([^)\s]+)\)/g)) {
1260
- const url = m[1];
1261
- if (!/^[A-Za-z0-9._-]+\.[A-Za-z0-9]+$/.test(url) || url.includes("..")) continue;
1262
- try {
1263
- images ??= {};
1264
- images[url] = new Uint8Array(await readFile3(join3(dir, url)));
1265
- } catch {
1266
- }
1267
- }
1259
+ const loaded = await loadGenerationImages(markdown, image_dir, assertWithinRoot);
1260
+ images = loaded.images;
1261
+ genWarnings.push(...loaded.warnings);
1268
1262
  }
1269
- const genWarnings = [];
1270
1263
  const buf = await markdownToHwpx(markdown, gongmun || profile || page || images ? {
1271
1264
  ...gongmun ? { gongmun } : {},
1272
1265
  ...profile ? { profile } : {},