kordoc 4.22.15 → 4.22.16

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 (123) hide show
  1. package/README.md +2 -1
  2. package/dist/{-QKNGJHAZ.js → -3XSSQOP6.js} +11 -11
  3. package/dist/{chunk-C7GEA5EE.js → chunk-2WAKSO2Z.js} +2 -2
  4. package/dist/{chunk-4BEGCKHJ.js → chunk-2ZGVOGHM.js} +2 -2
  5. package/dist/{chunk-WBDHB4XF.js → chunk-3BQYVNOW.js} +2 -2
  6. package/dist/{chunk-SOLVML3D.cjs → chunk-3NYFGUOJ.cjs} +24 -24
  7. package/dist/{chunk-SOLVML3D.cjs.map → chunk-3NYFGUOJ.cjs.map} +1 -1
  8. package/dist/{chunk-7QEYWKCX.js → chunk-5EISWK2J.js} +2 -2
  9. package/dist/{chunk-DQRHLLZX.js → chunk-75YWX55A.js} +3 -3
  10. package/dist/{chunk-BH4PFHF5.js → chunk-C3XICONM.js} +4 -4
  11. package/dist/{chunk-5N6MENH6.cjs → chunk-FFQLQLRE.cjs} +6 -6
  12. package/dist/{chunk-5N6MENH6.cjs.map → chunk-FFQLQLRE.cjs.map} +1 -1
  13. package/dist/{chunk-QG35WGJY.js → chunk-GDTSPYWP.js} +2 -2
  14. package/dist/{chunk-L66D5JSX.js → chunk-HXV4V6IH.js} +2 -2
  15. package/dist/{chunk-KXTCBOUC.cjs → chunk-IUVFOBQM.cjs} +3 -3
  16. package/dist/{chunk-KXTCBOUC.cjs.map → chunk-IUVFOBQM.cjs.map} +1 -1
  17. package/dist/{chunk-YFBPSJIK.cjs → chunk-JL3IR45L.cjs} +23 -23
  18. package/dist/{chunk-YFBPSJIK.cjs.map → chunk-JL3IR45L.cjs.map} +1 -1
  19. package/dist/{chunk-NELX5BUF.js → chunk-JTRP3OO2.js} +2 -2
  20. package/dist/{chunk-AUENDUDZ.cjs → chunk-JZCBDX34.cjs} +3 -3
  21. package/dist/{chunk-AUENDUDZ.cjs.map → chunk-JZCBDX34.cjs.map} +1 -1
  22. package/dist/{chunk-PZWP7QZI.js → chunk-L5HFJV5O.js} +3 -3
  23. package/dist/{chunk-B5M5SQKA.js → chunk-NDO4XZMT.js} +2 -2
  24. package/dist/{chunk-CHVZJ657.js → chunk-RMNJTPSR.js} +4 -4
  25. package/dist/{chunk-OGYWOGKZ.js → chunk-RVZVCHUE.js} +2 -2
  26. package/dist/{chunk-YEGBKWM2.js → chunk-RWLGFHZO.js} +2 -2
  27. package/dist/{chunk-ETER5U3Z.js → chunk-SDIKLPMY.js} +2 -2
  28. package/dist/{chunk-5BA72NJJ.js → chunk-TI534EYY.js} +6 -6
  29. package/dist/{chunk-ILRCRR54.cjs → chunk-UDG4L37H.cjs} +2 -2
  30. package/dist/{chunk-ILRCRR54.cjs.map → chunk-UDG4L37H.cjs.map} +1 -1
  31. package/dist/{chunk-YPXIUH4N.js → chunk-VJ6UNTC7.js} +2 -2
  32. package/dist/{chunk-QCDFGYTY.js → chunk-VTVPHZJ6.js} +34 -31
  33. package/dist/{chunk-QCDFGYTY.js.map → chunk-VTVPHZJ6.js.map} +1 -1
  34. package/dist/{chunk-DM67WSTH.js → chunk-VVOURQFY.js} +2 -2
  35. package/dist/{chunk-DM67WSTH.js.map → chunk-VVOURQFY.js.map} +1 -1
  36. package/dist/{chunk-AIK55H5I.js → chunk-W5SRR7W6.js} +3 -3
  37. package/dist/{chunk-H66FRBTO.js → chunk-WMJPOOBJ.js} +2 -2
  38. package/dist/{chunk-7RWA3PZ4.js → chunk-XD4B7B55.js} +2 -2
  39. package/dist/{chunk-7RWA3PZ4.js.map → chunk-XD4B7B55.js.map} +1 -1
  40. package/dist/{chunk-XZ34KDGA.js → chunk-Z7URWVQH.js} +4 -4
  41. package/dist/chunks-XXPD5OV5.js +10 -0
  42. package/dist/cli.js +32 -32
  43. package/dist/cli.js.map +1 -1
  44. package/dist/{formula-TRZNBQA7.js → formula-JMFME265.js} +4 -4
  45. package/dist/{formula-GHINZR45.cjs → formula-XSJKSTPU.cjs} +9 -9
  46. package/dist/{formula-GHINZR45.cjs.map → formula-XSJKSTPU.cjs.map} +1 -1
  47. package/dist/{formula-YQXHLN62.js → formula-YWCFQN7M.js} +3 -3
  48. package/dist/{image-ocr-VS42CA7V.cjs → image-ocr-2OWPVTWD.cjs} +17 -17
  49. package/dist/{image-ocr-VS42CA7V.cjs.map → image-ocr-2OWPVTWD.cjs.map} +1 -1
  50. package/dist/{image-ocr-7G5BY6HP.js → image-ocr-HH4WLRMA.js} +9 -9
  51. package/dist/{image-ocr-TMBFSD4U.js → image-ocr-W52R3U55.js} +6 -6
  52. package/dist/index.cjs +561 -558
  53. package/dist/index.cjs.map +1 -1
  54. package/dist/index.d.cts +6 -1
  55. package/dist/index.d.ts +6 -1
  56. package/dist/index.js +29 -26
  57. package/dist/index.js.map +1 -1
  58. package/dist/mcp.js +22 -22
  59. package/dist/{model-bundle-3N52FRRY.js → model-bundle-LAMGDBR5.js} +5 -5
  60. package/dist/{models-APDB3SOF.js → models-UW6K53RI.js} +5 -5
  61. package/dist/{parse-worker-v2-35LPGAQU.js → parse-worker-v2-TCYTBP2P.js} +12 -12
  62. package/dist/{parser-HSHTGLFC.js → parser-J37C64DT.js} +12 -12
  63. package/dist/{parser-FVCPSKL3.cjs → parser-JXAIWIOE.cjs} +157 -157
  64. package/dist/{parser-FVCPSKL3.cjs.map → parser-JXAIWIOE.cjs.map} +1 -1
  65. package/dist/{parser-QDNORIBQ.js → parser-Y2OKEGM4.js} +9 -9
  66. package/dist/{pdf-ocr-IL4EKHC2.js → pdf-ocr-BDNBONES.js} +6 -6
  67. package/dist/pdf-ocr-HPC5BVB7.cjs +31 -0
  68. package/dist/{pdf-ocr-2J4X7BIB.cjs.map → pdf-ocr-HPC5BVB7.cjs.map} +1 -1
  69. package/dist/{pdf-ocr-K6BODKK6.js → pdf-ocr-NUQHXJJR.js} +9 -9
  70. package/dist/{profile-io-IMYZVBUB.js → profile-io-SET4RRP2.js} +3 -3
  71. package/dist/{rasterize-52M5QMCF.js → rasterize-O7ZM2CRL.js} +3 -3
  72. package/dist/{redact-doc-OWZYVLOL.js → redact-doc-Z3ISHGTJ.js} +11 -11
  73. package/dist/{render-B4DB5V3H.js → render-MLKOC2PN.js} +7 -7
  74. package/dist/seal-7QUWLHB6.js +10 -0
  75. package/dist/{setup-XQOG5DQH.js → setup-CUB6RCSD.js} +3 -3
  76. package/dist/visual-QLWVIUQS.js +21 -0
  77. package/dist/{watch-YLHLYA2C.js → watch-YPDHDT4N.js} +12 -12
  78. package/package.json +1 -1
  79. package/dist/chunks-VIMWBMRT.js +0 -10
  80. package/dist/pdf-ocr-2J4X7BIB.cjs +0 -31
  81. package/dist/seal-GILBR2UU.js +0 -10
  82. package/dist/visual-ZJY2HO57.js +0 -21
  83. /package/dist/{-QKNGJHAZ.js.map → -3XSSQOP6.js.map} +0 -0
  84. /package/dist/{chunk-C7GEA5EE.js.map → chunk-2WAKSO2Z.js.map} +0 -0
  85. /package/dist/{chunk-4BEGCKHJ.js.map → chunk-2ZGVOGHM.js.map} +0 -0
  86. /package/dist/{chunk-WBDHB4XF.js.map → chunk-3BQYVNOW.js.map} +0 -0
  87. /package/dist/{chunk-7QEYWKCX.js.map → chunk-5EISWK2J.js.map} +0 -0
  88. /package/dist/{chunk-DQRHLLZX.js.map → chunk-75YWX55A.js.map} +0 -0
  89. /package/dist/{chunk-BH4PFHF5.js.map → chunk-C3XICONM.js.map} +0 -0
  90. /package/dist/{chunk-QG35WGJY.js.map → chunk-GDTSPYWP.js.map} +0 -0
  91. /package/dist/{chunk-L66D5JSX.js.map → chunk-HXV4V6IH.js.map} +0 -0
  92. /package/dist/{chunk-NELX5BUF.js.map → chunk-JTRP3OO2.js.map} +0 -0
  93. /package/dist/{chunk-PZWP7QZI.js.map → chunk-L5HFJV5O.js.map} +0 -0
  94. /package/dist/{chunk-B5M5SQKA.js.map → chunk-NDO4XZMT.js.map} +0 -0
  95. /package/dist/{chunk-CHVZJ657.js.map → chunk-RMNJTPSR.js.map} +0 -0
  96. /package/dist/{chunk-OGYWOGKZ.js.map → chunk-RVZVCHUE.js.map} +0 -0
  97. /package/dist/{chunk-YEGBKWM2.js.map → chunk-RWLGFHZO.js.map} +0 -0
  98. /package/dist/{chunk-ETER5U3Z.js.map → chunk-SDIKLPMY.js.map} +0 -0
  99. /package/dist/{chunk-5BA72NJJ.js.map → chunk-TI534EYY.js.map} +0 -0
  100. /package/dist/{chunk-YPXIUH4N.js.map → chunk-VJ6UNTC7.js.map} +0 -0
  101. /package/dist/{chunk-AIK55H5I.js.map → chunk-W5SRR7W6.js.map} +0 -0
  102. /package/dist/{chunk-H66FRBTO.js.map → chunk-WMJPOOBJ.js.map} +0 -0
  103. /package/dist/{chunk-XZ34KDGA.js.map → chunk-Z7URWVQH.js.map} +0 -0
  104. /package/dist/{chunks-VIMWBMRT.js.map → chunks-XXPD5OV5.js.map} +0 -0
  105. /package/dist/{formula-TRZNBQA7.js.map → formula-JMFME265.js.map} +0 -0
  106. /package/dist/{formula-YQXHLN62.js.map → formula-YWCFQN7M.js.map} +0 -0
  107. /package/dist/{image-ocr-7G5BY6HP.js.map → image-ocr-HH4WLRMA.js.map} +0 -0
  108. /package/dist/{image-ocr-TMBFSD4U.js.map → image-ocr-W52R3U55.js.map} +0 -0
  109. /package/dist/{model-bundle-3N52FRRY.js.map → model-bundle-LAMGDBR5.js.map} +0 -0
  110. /package/dist/{models-APDB3SOF.js.map → models-UW6K53RI.js.map} +0 -0
  111. /package/dist/{parse-worker-v2-35LPGAQU.js.map → parse-worker-v2-TCYTBP2P.js.map} +0 -0
  112. /package/dist/{parser-HSHTGLFC.js.map → parser-J37C64DT.js.map} +0 -0
  113. /package/dist/{parser-QDNORIBQ.js.map → parser-Y2OKEGM4.js.map} +0 -0
  114. /package/dist/{pdf-ocr-IL4EKHC2.js.map → pdf-ocr-BDNBONES.js.map} +0 -0
  115. /package/dist/{pdf-ocr-K6BODKK6.js.map → pdf-ocr-NUQHXJJR.js.map} +0 -0
  116. /package/dist/{profile-io-IMYZVBUB.js.map → profile-io-SET4RRP2.js.map} +0 -0
  117. /package/dist/{rasterize-52M5QMCF.js.map → rasterize-O7ZM2CRL.js.map} +0 -0
  118. /package/dist/{redact-doc-OWZYVLOL.js.map → redact-doc-Z3ISHGTJ.js.map} +0 -0
  119. /package/dist/{render-B4DB5V3H.js.map → render-MLKOC2PN.js.map} +0 -0
  120. /package/dist/{seal-GILBR2UU.js.map → seal-7QUWLHB6.js.map} +0 -0
  121. /package/dist/{setup-XQOG5DQH.js.map → setup-CUB6RCSD.js.map} +0 -0
  122. /package/dist/{visual-ZJY2HO57.js.map → visual-QLWVIUQS.js.map} +0 -0
  123. /package/dist/{watch-YLHLYA2C.js.map → watch-YPDHDT4N.js.map} +0 -0
@@ -50,10 +50,10 @@ import {
50
50
  resolveParaHeading,
51
51
  simulateWrap,
52
52
  takeTocLeaders
53
- } from "./chunk-5BA72NJJ.js";
53
+ } from "./chunk-TI534EYY.js";
54
54
  import {
55
55
  blocksToPages
56
- } from "./chunk-OGYWOGKZ.js";
56
+ } from "./chunk-RVZVCHUE.js";
57
57
  import {
58
58
  bmpToPng,
59
59
  inlineImagesIntoMarkdown
@@ -75,7 +75,7 @@ import {
75
75
  tidyScriptTags,
76
76
  unframeLayoutTables,
77
77
  wrapScript
78
- } from "./chunk-DM67WSTH.js";
78
+ } from "./chunk-VVOURQFY.js";
79
79
  import {
80
80
  MAX_COLS,
81
81
  MAX_ROWS,
@@ -97,7 +97,7 @@ import {
97
97
  noteTableHtml,
98
98
  sanitizeText,
99
99
  visibleText
100
- } from "./chunk-L66D5JSX.js";
100
+ } from "./chunk-HXV4V6IH.js";
101
101
  import {
102
102
  ANNOTATION_BLANK_RE,
103
103
  ValueCursor,
@@ -130,7 +130,7 @@ import {
130
130
  resolveUnmatched,
131
131
  scanInlineSegments,
132
132
  scanSectionXml
133
- } from "./chunk-PZWP7QZI.js";
133
+ } from "./chunk-L5HFJV5O.js";
134
134
  import {
135
135
  MAX_DECOMPRESS_SIZE,
136
136
  MAX_XML_DEPTH,
@@ -147,7 +147,7 @@ import {
147
147
  localName,
148
148
  rawTextContent,
149
149
  readZipEntry
150
- } from "./chunk-YPXIUH4N.js";
150
+ } from "./chunk-VJ6UNTC7.js";
151
151
  import {
152
152
  KordocError,
153
153
  classifyError,
@@ -163,7 +163,7 @@ import {
163
163
  toArrayBuffer,
164
164
  unescapeHtml,
165
165
  unzipLimitBytes
166
- } from "./chunk-C7GEA5EE.js";
166
+ } from "./chunk-2WAKSO2Z.js";
167
167
 
168
168
  // src/table/visual.ts
169
169
  import { readFile as readFile2 } from "fs/promises";
@@ -19327,7 +19327,7 @@ var MIN_SIDE = 24;
19327
19327
  async function ocrEmbeddedImages(blocks, options, warnings) {
19328
19328
  const ocr = options?.ocr;
19329
19329
  if (ocr !== true && ocr !== "force" && typeof ocr !== "function") return false;
19330
- const { parseImageDocument } = await import("./image-ocr-7G5BY6HP.js");
19330
+ const { parseImageDocument } = await import("./image-ocr-HH4WLRMA.js");
19331
19331
  let inserted = false, unreadable = 0;
19332
19332
  let failed = null;
19333
19333
  const walk = async (list, depth) => {
@@ -29134,7 +29134,8 @@ function serializeRecords(recs, repl, inserts) {
29134
29134
  };
29135
29135
  for (let i = 0; i < recs.length; i++) {
29136
29136
  for (const ins of inserts?.get(i) ?? []) push(ins.tagId, ins.level, ins.data);
29137
- push(recs[i].tagId, recs[i].level, repl?.get(i) ?? recs[i].data);
29137
+ const data = repl?.get(i);
29138
+ if (data !== null) push(recs[i].tagId, recs[i].level, data ?? recs[i].data);
29138
29139
  }
29139
29140
  return Buffer.concat(parts);
29140
29141
  }
@@ -29310,7 +29311,8 @@ async function patchHwp(original, editedMarkdown, options) {
29310
29311
  paraMap,
29311
29312
  scans,
29312
29313
  tableMap,
29313
- skipped
29314
+ skipped,
29315
+ keepLineseg: options?.keepLineseg === true
29314
29316
  });
29315
29317
  } else if (oi !== null) {
29316
29318
  skipped.push({ reason: "\uBE14\uB85D \uC0AD\uC81C\uB294 \uBBF8\uC9C0\uC6D0 (v1) \u2014 \uC6D0\uBCF8 \uC720\uC9C0", before: summarize(origUnits[oi].raw) });
@@ -29506,7 +29508,7 @@ function patchParagraph(block, orig, edited, ctx, skip) {
29506
29508
  const origPrefix = block.text.split(" ", 1)[0];
29507
29509
  if (origMd.startsWith(origPrefix + " ")) origMd = origMd.slice(origPrefix.length + 1);
29508
29510
  }
29509
- return stageParaPatch(ctx.scans[mapping.para.sectionIndex], mapping.para, newPlain, skip, origMd);
29511
+ return stageParaPatch(ctx.scans[mapping.para.sectionIndex], mapping.para, newPlain, skip, ctx.keepLineseg, origMd);
29510
29512
  }
29511
29513
  function patchGfmCells(scanTable, orig, edited, ctx, skip) {
29512
29514
  const origRows = parseGfmTable(orig.lines);
@@ -29548,7 +29550,7 @@ function patchGfmCells(scanTable, orig, edited, ctx, skip) {
29548
29550
  cellSkip("\uACF5\uBC31 \uC815\uADDC\uD654 \uBD88\uC548\uC815 \uD14D\uC2A4\uD2B8 \u2014 \uBBF8\uC9C0\uC6D0");
29549
29551
  continue;
29550
29552
  }
29551
- applied += stageParaPatch(ctx.scans[para2.sectionIndex], para2, after, cellSkip);
29553
+ applied += stageParaPatch(ctx.scans[para2.sectionIndex], para2, after, cellSkip, ctx.keepLineseg);
29552
29554
  continue;
29553
29555
  }
29554
29556
  if (beforeParts.length !== cell2.paras.length || afterParts.length !== cell2.paras.length) {
@@ -29576,7 +29578,7 @@ function patchGfmCells(scanTable, orig, edited, ctx, skip) {
29576
29578
  cellSkip("\uACF5\uBC31 \uC815\uADDC\uD654 \uBD88\uC548\uC815 \uD14D\uC2A4\uD2B8 \u2014 \uBBF8\uC9C0\uC6D0");
29577
29579
  break;
29578
29580
  }
29579
- applied += stageParaPatch(ctx.scans[para2.sectionIndex], para2, after, cellSkip);
29581
+ applied += stageParaPatch(ctx.scans[para2.sectionIndex], para2, after, cellSkip, ctx.keepLineseg);
29580
29582
  }
29581
29583
  }
29582
29584
  }
@@ -29708,7 +29710,7 @@ function applyCellEdit5(table2, scanTable, gridR, gridC, newLines, ctx, before,
29708
29710
  let staged = 0;
29709
29711
  for (let i = 0; i < targets.length; i++) {
29710
29712
  if (assigned[i] === targets[i].rawText || normForMatch(assigned[i]) === normForMatch(targets[i].rawText)) continue;
29711
- staged += stageParaPatch(ctx.scans[targets[i].sectionIndex], targets[i], assigned[i], skip);
29713
+ staged += stageParaPatch(ctx.scans[targets[i].sectionIndex], targets[i], assigned[i], skip, ctx.keepLineseg);
29712
29714
  }
29713
29715
  return staged > 0 ? 1 : 0;
29714
29716
  }
@@ -29893,11 +29895,11 @@ function synthesizeLineSegs(lineSegData, newRaw, startUnits) {
29893
29895
  }
29894
29896
  return { buf: Buffer.concat(segs), count: lines.length };
29895
29897
  }
29896
- function stageParaPatch(scan, para2, newPlain, skip, origPlain) {
29898
+ function stageParaPatch(scan, para2, newPlain, skip, keepLineseg, origPlain) {
29897
29899
  if (!scan.safe) return skip("\uC139\uC158 \uB808\uCF54\uB4DC \uC7AC\uC9C1\uB82C\uD654 \uBD88\uC77C\uCE58 \u2014 \uC548\uC804\uC744 \uC704\uD574 \uC774 \uC139\uC158\uC740 \uBBF8\uC9C0\uC6D0");
29898
29900
  if (para2.textIdx === -2) return skip("\uBCF5\uC218 PARA_TEXT \uB808\uCF54\uB4DC \uBB38\uB2E8 \u2014 \uBBF8\uC9C0\uC6D0 (v1)");
29899
29901
  if (para2.rangeTagCount > 0) return skip("\uBC94\uC704 \uD0DC\uADF8(\uD615\uAD11\uD39C/\uAD50\uC815\uBD80\uD638) \uBB38\uB2E8 \u2014 \uBBF8\uC9C0\uC6D0 (v1)");
29900
- if (para2.charShapeIdx < 0 || para2.lineSegIdx < 0) return skip("\uBB38\uB2E8 \uB808\uCF54\uB4DC \uAD6C\uC131 \uBE44\uC815\uD615 \u2014 \uBBF8\uC9C0\uC6D0");
29902
+ if (para2.charShapeIdx < 0) return skip("\uBB38\uB2E8 \uB808\uCF54\uB4DC \uAD6C\uC131 \uBE44\uC815\uD615 \u2014 \uBBF8\uC9C0\uC6D0");
29901
29903
  if (scan.repl.has(para2.headerIdx)) return skip("\uB3D9\uC77C \uBB38\uB2E8 \uC911\uBCF5 \uC218\uC815 \u2014 \uCCAB \uC218\uC815\uB9CC \uC801\uC6A9");
29902
29904
  if (/[\u0000-\u0009\u000b-\u001f]/.test(newPlain)) return skip("\uC0C8 \uD14D\uC2A4\uD2B8\uC5D0 \uC81C\uC5B4\uBB38\uC790 \uD3EC\uD568 \u2014 \uBBF8\uC9C0\uC6D0");
29903
29905
  const records = scan.records;
@@ -29919,13 +29921,7 @@ function stageParaPatch(scan, para2, newPlain, skip, origPlain) {
29919
29921
  const cs2 = rebuildCharShape(charShapeRec.data, 0);
29920
29922
  scan.repl.set(para2.charShapeIdx, cs2.buf);
29921
29923
  newHeader2.writeUInt16LE(cs2.count, 12);
29922
- if (newPlain.includes("\n")) {
29923
- const synth = synthesizeLineSegs(records[para2.lineSegIdx].data, newPlain, 0);
29924
- if (synth) {
29925
- scan.repl.set(para2.lineSegIdx, synth.buf);
29926
- newHeader2.writeUInt16LE(synth.count, 16);
29927
- }
29928
- }
29924
+ stageLineSegs(scan, para2, newHeader2, newPlain, 0, newPlain.length + nCharsLow, keepLineseg);
29929
29925
  scan.repl.set(para2.headerIdx, newHeader2);
29930
29926
  return 1;
29931
29927
  }
@@ -29947,14 +29943,23 @@ function stageParaPatch(scan, para2, newPlain, skip, origPlain) {
29947
29943
  const cs = edit ? shiftCharShape(charShapeRec.data, seg.prefixUnits + edit.start, seg.prefixUnits + edit.end, edit.text.length) : rebuildCharShape(charShapeRec.data, seg.prefixUnits);
29948
29944
  scan.repl.set(para2.charShapeIdx, cs.buf);
29949
29945
  newHeader.writeUInt16LE(cs.count, 12);
29950
- if (newRaw.includes("\n")) {
29951
- const synth = synthesizeLineSegs(records[para2.lineSegIdx].data, newRaw, seg.prefixUnits);
29946
+ stageLineSegs(scan, para2, newHeader, newRaw, seg.prefixUnits, nChars, keepLineseg);
29947
+ scan.repl.set(para2.headerIdx, newHeader);
29948
+ return 1;
29949
+ }
29950
+ function stageLineSegs(scan, para2, newHeader, newRaw, startUnits, nChars, keepLineseg) {
29951
+ if (para2.lineSegIdx < 0) return;
29952
+ const lineSegData = scan.records[para2.lineSegIdx].data;
29953
+ if (!keepLineseg) {
29954
+ scan.repl.set(para2.lineSegIdx, null);
29955
+ newHeader.writeUInt16LE(0, 16);
29956
+ } else if (newRaw.includes("\n")) {
29957
+ const synth = synthesizeLineSegs(lineSegData, newRaw, startUnits);
29952
29958
  if (synth) {
29953
29959
  scan.repl.set(para2.lineSegIdx, synth.buf);
29954
29960
  newHeader.writeUInt16LE(synth.count, 16);
29955
29961
  }
29956
29962
  } else {
29957
- const lineSegData = records[para2.lineSegIdx].data;
29958
29963
  const segCount = Math.floor(lineSegData.length / 36);
29959
29964
  let keep = 1;
29960
29965
  while (keep < segCount && lineSegData.readUInt32LE(keep * 36) < nChars) keep++;
@@ -29963,8 +29968,6 @@ function stageParaPatch(scan, para2, newPlain, skip, origPlain) {
29963
29968
  newHeader.writeUInt16LE(keep, 16);
29964
29969
  }
29965
29970
  }
29966
- scan.repl.set(para2.headerIdx, newHeader);
29967
- return 1;
29968
29971
  }
29969
29972
 
29970
29973
  // src/roundtrip/patcher.ts
@@ -31022,7 +31025,7 @@ function scriptsOff(r, off) {
31022
31025
  }
31023
31026
  async function parseImage(buffer, options) {
31024
31027
  try {
31025
- const { parseImageDocument } = await import("./image-ocr-7G5BY6HP.js");
31028
+ const { parseImageDocument } = await import("./image-ocr-HH4WLRMA.js");
31026
31029
  const { blocks, warnings, lines } = await parseImageDocument(buffer, options);
31027
31030
  stripScriptTags({ blocks });
31028
31031
  return {
@@ -31086,7 +31089,7 @@ async function parseHwp(buffer, options) {
31086
31089
  async function parsePdf(buffer, options) {
31087
31090
  let parsePdfDocument;
31088
31091
  try {
31089
- const mod = await import("./parser-HSHTGLFC.js");
31092
+ const mod = await import("./parser-J37C64DT.js");
31090
31093
  parsePdfDocument = mod.parsePdfDocument;
31091
31094
  } catch {
31092
31095
  return {
@@ -31309,4 +31312,4 @@ export {
31309
31312
  parseHwpml,
31310
31313
  fillForm
31311
31314
  };
31312
- //# sourceMappingURL=chunk-QCDFGYTY.js.map
31315
+ //# sourceMappingURL=chunk-VTVPHZJ6.js.map