kordoc 4.15.0 → 4.15.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 (163) hide show
  1. package/README.md +15 -0
  2. package/dist/{-WXTUDCBW.js → -5HJYDZKM.js} +15 -13
  3. package/dist/{chunk-DTM6FV74.js → chunk-2WERADM4.js} +17 -38
  4. package/dist/chunk-2WERADM4.js.map +1 -0
  5. package/dist/{chunk-2FT2DHE6.js → chunk-3WSNLH4B.js} +9 -1
  6. package/dist/chunk-3WSNLH4B.js.map +1 -0
  7. package/dist/{chunk-3CWXYYCL.cjs → chunk-3Y26ICMC.cjs} +32 -8
  8. package/dist/chunk-3Y26ICMC.cjs.map +1 -0
  9. package/dist/{chunk-IMR5HSB5.js → chunk-73K6BXEQ.js} +2 -2
  10. package/dist/{chunk-S5PJ7ZE2.js → chunk-AS66S3HA.js} +40 -29
  11. package/dist/chunk-AS66S3HA.js.map +1 -0
  12. package/dist/{chunk-6CUIXJOC.js → chunk-ATGOFB7P.js} +1 -1
  13. package/dist/{chunk-6BWU6SQX.js.map → chunk-ATGOFB7P.js.map} +1 -1
  14. package/dist/{chunk-EP4DTCVJ.cjs → chunk-B4LHTFLY.cjs} +44 -33
  15. package/dist/chunk-B4LHTFLY.cjs.map +1 -0
  16. package/dist/{chunk-6Y6KUOA6.js → chunk-CODOAMAV.js} +2 -2
  17. package/dist/{chunk-YINJO3PR.js → chunk-GFBLDBL2.js} +2 -2
  18. package/dist/{chunk-KO5S25RD.js → chunk-GWTN34UT.js} +2 -2
  19. package/dist/{chunk-KNZUG3SV.js → chunk-GYZCXVJX.js} +2 -2
  20. package/dist/{chunk-DCZVOIEO.cjs → chunk-J55UQC5H.cjs} +20 -2
  21. package/dist/chunk-J55UQC5H.cjs.map +1 -0
  22. package/dist/{chunk-B3NAP4FA.js → chunk-JPJNZXCC.js} +2 -2
  23. package/dist/{chunk-M26GSDV3.js → chunk-KKQBQY32.js} +27 -3
  24. package/dist/chunk-KKQBQY32.js.map +1 -0
  25. package/dist/{chunk-UCDOIHGW.js → chunk-KY6HUZZR.js} +2 -2
  26. package/dist/{chunk-AKWMQ5XT.js → chunk-MJHUOAAI.js} +2 -2
  27. package/dist/{chunk-FSQJJTHS.cjs → chunk-MRPDMIMN.cjs} +3 -3
  28. package/dist/{chunk-FSQJJTHS.cjs.map → chunk-MRPDMIMN.cjs.map} +1 -1
  29. package/dist/{chunk-MX36AA26.js → chunk-N4WZZ2PR.js} +2 -2
  30. package/dist/{chunk-4OLS5RDH.js → chunk-NYNJP45T.js} +89 -26
  31. package/dist/chunk-NYNJP45T.js.map +1 -0
  32. package/dist/{chunk-23AJ65GX.js → chunk-PTN7YG24.js} +90 -25
  33. package/dist/chunk-PTN7YG24.js.map +1 -0
  34. package/dist/{chunk-VWUYVEFN.cjs → chunk-PY2M7YVN.cjs} +1 -1
  35. package/dist/{chunk-VWUYVEFN.cjs.map → chunk-PY2M7YVN.cjs.map} +1 -1
  36. package/dist/{chunk-6BWU6SQX.js → chunk-RIVHAAV4.js} +1 -1
  37. package/dist/{chunk-6CUIXJOC.js.map → chunk-RIVHAAV4.js.map} +1 -1
  38. package/dist/{chunk-QMUM25RB.js → chunk-SX2KSBMO.js} +2 -2
  39. package/dist/{chunk-PJ2K6B3V.js → chunk-TCMEK4LF.js} +7 -7
  40. package/dist/{chunk-GE43BE46.js → chunk-V4BH5SRQ.js} +20 -2
  41. package/dist/chunk-V4BH5SRQ.js.map +1 -0
  42. package/dist/{chunk-LBYKEJUJ.cjs → chunk-VGU4FLLD.cjs} +2 -2
  43. package/dist/{chunk-LBYKEJUJ.cjs.map → chunk-VGU4FLLD.cjs.map} +1 -1
  44. package/dist/{chunk-MOL7MDBG.js → chunk-VQFA55IC.js} +20 -2
  45. package/dist/chunk-VQFA55IC.js.map +1 -0
  46. package/dist/chunk-VRZEPD4K.js +32 -0
  47. package/dist/chunk-VRZEPD4K.js.map +1 -0
  48. package/dist/{chunk-W33QEDLY.cjs → chunk-VSI5SRP2.cjs} +118 -54
  49. package/dist/chunk-VSI5SRP2.cjs.map +1 -0
  50. package/dist/{chunk-H5XLUEZG.js → chunk-VTUADXSS.js} +2 -2
  51. package/dist/{chunk-NJP76IZ5.js → chunk-WQWWVZ6Y.js} +40 -29
  52. package/dist/chunk-WQWWVZ6Y.js.map +1 -0
  53. package/dist/{chunk-TDYGL267.js → chunk-ZVN2H7XL.js} +3 -3
  54. package/dist/chunks-C3AW42QH.js +10 -0
  55. package/dist/cli.js +29 -28
  56. package/dist/cli.js.map +1 -1
  57. package/dist/{formula-WGBYDRVU.js → formula-D4PUT5J3.js} +18 -10
  58. package/dist/{formula-WGBYDRVU.js.map → formula-D4PUT5J3.js.map} +1 -1
  59. package/dist/{formula-RGK6WGD2.cjs → formula-DYVJSHWN.cjs} +25 -15
  60. package/dist/formula-DYVJSHWN.cjs.map +1 -0
  61. package/dist/{formula-USQK6NHN.js → formula-QVHAUNK6.js} +20 -8
  62. package/dist/{formula-USQK6NHN.js.map → formula-QVHAUNK6.js.map} +1 -1
  63. package/dist/{image-ocr-WCKYPPXY.js → image-ocr-5BHKFZL6.js} +29 -15
  64. package/dist/image-ocr-5BHKFZL6.js.map +1 -0
  65. package/dist/{image-ocr-JPP6JRFU.cjs → image-ocr-SGANCWQ5.cjs} +35 -21
  66. package/dist/image-ocr-SGANCWQ5.cjs.map +1 -0
  67. package/dist/{image-ocr-SLYPOW7G.js → image-ocr-TNNFV5VQ.js} +27 -13
  68. package/dist/image-ocr-TNNFV5VQ.js.map +1 -0
  69. package/dist/index.cjs +486 -500
  70. package/dist/index.cjs.map +1 -1
  71. package/dist/index.d.cts +3 -1
  72. package/dist/index.d.ts +3 -1
  73. package/dist/index.js +19 -33
  74. package/dist/index.js.map +1 -1
  75. package/dist/mcp.js +24 -23
  76. package/dist/mcp.js.map +1 -1
  77. package/dist/{model-bundle-BIS5HNXA.js → model-bundle-ISGAMXQS.js} +5 -5
  78. package/dist/{models-APDLDMGJ.js → models-LI5INKZM.js} +5 -5
  79. package/dist/page-range-M5SRB2WK.js +9 -0
  80. package/dist/page-range-OKVE3DBS.js +10 -0
  81. package/dist/page-range-QHHFTL7X.cjs +10 -0
  82. package/dist/page-range-QHHFTL7X.cjs.map +1 -0
  83. package/dist/{parser-6ZWJPQC2.js → parser-EYJID4YX.js} +82 -36
  84. package/dist/parser-EYJID4YX.js.map +1 -0
  85. package/dist/{parser-4D2YTTIH.js → parser-GW3KRTXY.js} +84 -36
  86. package/dist/parser-GW3KRTXY.js.map +1 -0
  87. package/dist/{parser-Y5NX55GC.cjs → parser-XCXDSKQ3.cjs} +155 -109
  88. package/dist/parser-XCXDSKQ3.cjs.map +1 -0
  89. package/dist/pdf-ocr-JCJAME6Q.js +15 -0
  90. package/dist/pdf-ocr-K7MJFRBS.cjs +16 -0
  91. package/dist/pdf-ocr-K7MJFRBS.cjs.map +1 -0
  92. package/dist/pdf-ocr-TC3BN2MV.js +18 -0
  93. package/dist/{profile-io-VJUZYOJA.js → profile-io-DBN56Y2Z.js} +3 -3
  94. package/dist/{rasterize-6U5NWILD.js → rasterize-BYRCKQIW.js} +3 -3
  95. package/dist/{redact-3CY3KGVD.js → redact-NV2QCDGE.js} +2 -2
  96. package/dist/{redact-doc-H56QYJGQ.js → redact-doc-UP2J6RRP.js} +13 -12
  97. package/dist/{redact-doc-H56QYJGQ.js.map → redact-doc-UP2J6RRP.js.map} +1 -1
  98. package/dist/{render-HNMDLMI2.js → render-WGD5DN4G.js} +8 -8
  99. package/dist/seal-5GAFTYQO.js +10 -0
  100. package/dist/{setup-RZVYAXAV.js → setup-E5JILUAN.js} +3 -3
  101. package/dist/visual-FKV2TRYY.js +20 -0
  102. package/dist/{watch-VA6GK56C.js → watch-LKWPCU42.js} +14 -13
  103. package/dist/{watch-VA6GK56C.js.map → watch-LKWPCU42.js.map} +1 -1
  104. package/package.json +1 -1
  105. package/dist/chunk-23AJ65GX.js.map +0 -1
  106. package/dist/chunk-2FT2DHE6.js.map +0 -1
  107. package/dist/chunk-3CWXYYCL.cjs.map +0 -1
  108. package/dist/chunk-4OLS5RDH.js.map +0 -1
  109. package/dist/chunk-DCZVOIEO.cjs.map +0 -1
  110. package/dist/chunk-DTM6FV74.js.map +0 -1
  111. package/dist/chunk-EP4DTCVJ.cjs.map +0 -1
  112. package/dist/chunk-GE43BE46.js.map +0 -1
  113. package/dist/chunk-M26GSDV3.js.map +0 -1
  114. package/dist/chunk-MOL7MDBG.js.map +0 -1
  115. package/dist/chunk-NJP76IZ5.js.map +0 -1
  116. package/dist/chunk-S5PJ7ZE2.js.map +0 -1
  117. package/dist/chunk-W33QEDLY.cjs.map +0 -1
  118. package/dist/chunks-S2XR4JDI.js +0 -10
  119. package/dist/formula-RGK6WGD2.cjs.map +0 -1
  120. package/dist/image-ocr-JPP6JRFU.cjs.map +0 -1
  121. package/dist/image-ocr-SLYPOW7G.js.map +0 -1
  122. package/dist/image-ocr-WCKYPPXY.js.map +0 -1
  123. package/dist/page-range-737B4EZW.js +0 -8
  124. package/dist/page-range-LNMXJU6W.js +0 -7
  125. package/dist/page-range-P7SDW6LR.cjs +0 -8
  126. package/dist/page-range-P7SDW6LR.cjs.map +0 -1
  127. package/dist/parser-4D2YTTIH.js.map +0 -1
  128. package/dist/parser-6ZWJPQC2.js.map +0 -1
  129. package/dist/parser-Y5NX55GC.cjs.map +0 -1
  130. package/dist/pdf-ocr-E3IZ3EI5.cjs +0 -14
  131. package/dist/pdf-ocr-E3IZ3EI5.cjs.map +0 -1
  132. package/dist/pdf-ocr-FNXYMNM6.js +0 -16
  133. package/dist/pdf-ocr-WSYPOBBU.js +0 -13
  134. package/dist/seal-VXNEOHZV.js +0 -10
  135. package/dist/visual-NSZP2FWZ.js +0 -19
  136. /package/dist/{-WXTUDCBW.js.map → -5HJYDZKM.js.map} +0 -0
  137. /package/dist/{chunk-IMR5HSB5.js.map → chunk-73K6BXEQ.js.map} +0 -0
  138. /package/dist/{chunk-6Y6KUOA6.js.map → chunk-CODOAMAV.js.map} +0 -0
  139. /package/dist/{chunk-YINJO3PR.js.map → chunk-GFBLDBL2.js.map} +0 -0
  140. /package/dist/{chunk-KO5S25RD.js.map → chunk-GWTN34UT.js.map} +0 -0
  141. /package/dist/{chunk-KNZUG3SV.js.map → chunk-GYZCXVJX.js.map} +0 -0
  142. /package/dist/{chunk-B3NAP4FA.js.map → chunk-JPJNZXCC.js.map} +0 -0
  143. /package/dist/{chunk-UCDOIHGW.js.map → chunk-KY6HUZZR.js.map} +0 -0
  144. /package/dist/{chunk-AKWMQ5XT.js.map → chunk-MJHUOAAI.js.map} +0 -0
  145. /package/dist/{chunk-MX36AA26.js.map → chunk-N4WZZ2PR.js.map} +0 -0
  146. /package/dist/{chunk-QMUM25RB.js.map → chunk-SX2KSBMO.js.map} +0 -0
  147. /package/dist/{chunk-PJ2K6B3V.js.map → chunk-TCMEK4LF.js.map} +0 -0
  148. /package/dist/{chunk-H5XLUEZG.js.map → chunk-VTUADXSS.js.map} +0 -0
  149. /package/dist/{chunk-TDYGL267.js.map → chunk-ZVN2H7XL.js.map} +0 -0
  150. /package/dist/{chunks-S2XR4JDI.js.map → chunks-C3AW42QH.js.map} +0 -0
  151. /package/dist/{model-bundle-BIS5HNXA.js.map → model-bundle-ISGAMXQS.js.map} +0 -0
  152. /package/dist/{models-APDLDMGJ.js.map → models-LI5INKZM.js.map} +0 -0
  153. /package/dist/{page-range-737B4EZW.js.map → page-range-M5SRB2WK.js.map} +0 -0
  154. /package/dist/{page-range-LNMXJU6W.js.map → page-range-OKVE3DBS.js.map} +0 -0
  155. /package/dist/{pdf-ocr-FNXYMNM6.js.map → pdf-ocr-JCJAME6Q.js.map} +0 -0
  156. /package/dist/{pdf-ocr-WSYPOBBU.js.map → pdf-ocr-TC3BN2MV.js.map} +0 -0
  157. /package/dist/{profile-io-VJUZYOJA.js.map → profile-io-DBN56Y2Z.js.map} +0 -0
  158. /package/dist/{rasterize-6U5NWILD.js.map → rasterize-BYRCKQIW.js.map} +0 -0
  159. /package/dist/{redact-3CY3KGVD.js.map → redact-NV2QCDGE.js.map} +0 -0
  160. /package/dist/{render-HNMDLMI2.js.map → render-WGD5DN4G.js.map} +0 -0
  161. /package/dist/{seal-VXNEOHZV.js.map → seal-5GAFTYQO.js.map} +0 -0
  162. /package/dist/{setup-RZVYAXAV.js.map → setup-E5JILUAN.js.map} +0 -0
  163. /package/dist/{visual-NSZP2FWZ.js.map → visual-FKV2TRYY.js.map} +0 -0
@@ -3,12 +3,12 @@
3
3
 
4
4
 
5
5
 
6
- var _chunk3CWXYYCLcjs = require('./chunk-3CWXYYCL.cjs');
7
6
 
7
+ var _chunk3Y26ICMCcjs = require('./chunk-3Y26ICMC.cjs');
8
8
 
9
- var _chunkDCZVOIEOcjs = require('./chunk-DCZVOIEO.cjs');
10
9
 
11
10
 
11
+ var _chunkJ55UQC5Hcjs = require('./chunk-J55UQC5H.cjs');
12
12
 
13
13
 
14
14
 
@@ -30,17 +30,20 @@ var _chunkDCZVOIEOcjs = require('./chunk-DCZVOIEO.cjs');
30
30
 
31
31
 
32
32
 
33
- var _chunkW33QEDLYcjs = require('./chunk-W33QEDLY.cjs');
34
- require('./chunk-VWUYVEFN.cjs');
35
33
 
36
34
 
35
+ var _chunkVSI5SRP2cjs = require('./chunk-VSI5SRP2.cjs');
36
+ require('./chunk-PY2M7YVN.cjs');
37
37
 
38
- var _chunkLBYKEJUJcjs = require('./chunk-LBYKEJUJ.cjs');
38
+
39
+
40
+ var _chunkVGU4FLLDcjs = require('./chunk-VGU4FLLD.cjs');
39
41
 
40
42
 
41
43
  var _chunkGS7T56RPcjs = require('./chunk-GS7T56RP.cjs');
42
44
 
43
45
  // src/pdf/image-extract.ts
46
+ var _crypto = require('crypto');
44
47
  var _pdfmjs = require('pdfjs-dist/legacy/build/pdf.mjs');
45
48
  var IMAGE_RESOLVE_TIMEOUT_MS = 5e3;
46
49
  function resolveImgData(page, objId) {
@@ -75,27 +78,26 @@ var MAX_PIXELS = 36e6;
75
78
  var MAX_IMAGES_PER_DOC = 200;
76
79
  var MAX_TOTAL_IMAGE_BYTES = 128 * 1024 * 1024;
77
80
  function createPdfImageState() {
78
- return { imageIndex: 0, totalBytes: 0, seen: /* @__PURE__ */ new Map(), capWarned: false };
81
+ return { imageIndex: 0, totalBytes: 0, seen: /* @__PURE__ */ new Map(), globalKeys: /* @__PURE__ */ new Map(), capWarned: false };
79
82
  }
80
- function fnv1a(data) {
81
- let h = 2166136261;
82
- for (let i = 0; i < data.length; i++) {
83
- h ^= data[i];
84
- h = Math.imul(h, 16777619);
85
- }
86
- return h >>> 0;
83
+ function contentHash(data) {
84
+ return _crypto.createHash.call(void 0, "sha1").update(data).digest("hex");
87
85
  }
88
- function toRgba(img) {
86
+ var NO_BYTES = new Uint8Array(0);
87
+ function toRgba(img, convert = true) {
89
88
  const { width: w, height: h, kind, data } = img;
90
89
  if (!data || !w || !h) return null;
91
- const rgba = new Uint8Array(w * h * 4);
92
90
  if (kind === _pdfmjs.ImageKind.RGBA_32BPP) {
93
91
  if (data.length < w * h * 4) return null;
92
+ if (!convert) return NO_BYTES;
93
+ const rgba = new Uint8Array(w * h * 4);
94
94
  rgba.set(data.subarray(0, w * h * 4));
95
95
  return rgba;
96
96
  }
97
97
  if (kind === _pdfmjs.ImageKind.RGB_24BPP) {
98
98
  if (data.length < w * h * 3) return null;
99
+ if (!convert) return NO_BYTES;
100
+ const rgba = new Uint8Array(w * h * 4);
99
101
  for (let i = 0, s = 0, d = 0; i < w * h; i++, s += 3, d += 4) {
100
102
  rgba[d] = data[s];
101
103
  rgba[d + 1] = data[s + 1];
@@ -107,6 +109,8 @@ function toRgba(img) {
107
109
  if (kind === _pdfmjs.ImageKind.GRAYSCALE_1BPP) {
108
110
  const stride = w + 7 >> 3;
109
111
  if (data.length < stride * h) return null;
112
+ if (!convert) return NO_BYTES;
113
+ const rgba = new Uint8Array(w * h * 4);
110
114
  for (let y = 0; y < h; y++) {
111
115
  for (let x = 0; x < w; x++) {
112
116
  const bit = data[y * stride + (x >> 3)] >> 7 - (x & 7) & 1;
@@ -157,15 +161,20 @@ async function extractPageImages(page, fnArray, argsArray, pageNumber, state, wa
157
161
  warnings.push({ page: pageNumber, message: `\uC774\uBBF8\uC9C0 \uD06C\uAE30 \uCD08\uACFC\uB85C \uCD94\uCD9C \uC0DD\uB7B5 (${w}\xD7${h})`, code: "SKIPPED_IMAGE" });
158
162
  continue;
159
163
  }
160
- const hash = `${w}x${h}k${_nullishCoalesce(imgData.kind, () => ( "?"))}h${fnv1a(imgData.data)}${dedupeId ? "" : "inline"}`;
164
+ const globalId = _optionalChain([dedupeId, 'optionalAccess', _7 => _7.startsWith, 'call', _8 => _8("g_")]) ? dedupeId : void 0;
165
+ let hash = globalId ? state.globalKeys.get(globalId) : void 0;
166
+ if (hash === void 0) {
167
+ hash = `${w}x${h}k${_nullishCoalesce(imgData.kind, () => ( "?"))}h${contentHash(imgData.data)}${dedupeId ? "" : "inline"}`;
168
+ if (globalId) state.globalKeys.set(globalId, hash);
169
+ }
161
170
  if (state.seen.has(hash)) continue;
162
- const rgba = toRgba(imgData);
171
+ const rgba = toRgba(imgData, withBytes);
163
172
  if (!rgba) continue;
164
173
  state.imageIndex++;
165
174
  const filename = `image_${String(state.imageIndex).padStart(3, "0")}.png`;
166
175
  state.seen.set(hash, filename);
167
176
  if (withBytes) {
168
- const png = _chunk3CWXYYCLcjs.encodePng.call(void 0, w, h, rgba);
177
+ const png = _chunk3Y26ICMCcjs.encodePng.call(void 0, w, h, rgba);
169
178
  state.totalBytes += png.length;
170
179
  images.push({ filename, data: png, mimeType: "image/png" });
171
180
  }
@@ -205,7 +214,7 @@ function injectPageImageBlocks(blocks, pageImages) {
205
214
  result.splice(at, 0, ...pageImages.get(p));
206
215
  }
207
216
  blocks.length = 0;
208
- blocks.push(...result);
217
+ for (const b of result) blocks.push(b);
209
218
  }
210
219
 
211
220
  // src/pdf/quality.ts
@@ -567,7 +576,7 @@ function anchorsOf(table) {
567
576
  for (let r = 0; r < table.rows; r++) {
568
577
  for (let c = 0; c < table.cols; c++) {
569
578
  if (covered.has(r * 1e5 + c)) continue;
570
- const cell = _optionalChain([table, 'access', _7 => _7.cells, 'access', _8 => _8[r], 'optionalAccess', _9 => _9[c]]);
579
+ const cell = _optionalChain([table, 'access', _9 => _9.cells, 'access', _10 => _10[r], 'optionalAccess', _11 => _11[c]]);
571
580
  if (!cell) continue;
572
581
  out.push({ r, c, rs: cell.rowSpan, cs: cell.colSpan, cell });
573
582
  for (let dr = 0; dr < cell.rowSpan; dr++) {
@@ -618,19 +627,19 @@ function joinSplitParts(prev, pcx, curr, ccx, dx = 0, prevBottom) {
618
627
  if (r + dr < rows) owner[r + dr][dc] = placed;
619
628
  }
620
629
  grid[r][c1] = { ...a.cell, colSpan: c2 - c1, rowSpan: a.rs };
621
- const lines = _chunkW33QEDLYcjs.CELL_LINES.get(a.cell);
622
- if (lines) _chunkW33QEDLYcjs.CELL_LINES.set(grid[r][c1], shift ? lines.map((l) => ({ ...l, l: l.l + shift, r: l.r + shift })) : lines);
623
- if (_chunkW33QEDLYcjs.IMAGE_CELLS.has(a.cell)) _chunkW33QEDLYcjs.IMAGE_CELLS.add(grid[r][c1]);
630
+ const lines = _chunkVSI5SRP2cjs.CELL_LINES.get(a.cell);
631
+ if (lines) _chunkVSI5SRP2cjs.CELL_LINES.set(grid[r][c1], shift ? lines.map((l) => ({ ...l, l: l.l + shift, r: l.r + shift })) : lines);
632
+ if (_chunkVSI5SRP2cjs.IMAGE_CELLS.has(a.cell)) _chunkVSI5SRP2cjs.IMAGE_CELLS.add(grid[r][c1]);
624
633
  return true;
625
634
  };
626
- for (const a of pa) if (!_chunkW33QEDLYcjs.FILLER_CELLS.has(a.cell) && !place(a, pcx, 0)) return null;
635
+ for (const a of pa) if (!_chunkVSI5SRP2cjs.FILLER_CELLS.has(a.cell) && !place(a, pcx, 0)) return null;
627
636
  for (const a of ca) {
628
- if (a.r < skip || _chunkW33QEDLYcjs.FILLER_CELLS.has(a.cell)) continue;
637
+ if (a.r < skip || _chunkVSI5SRP2cjs.FILLER_CELLS.has(a.cell)) continue;
629
638
  if (!place(a, ccx, prev.rows - skip, dx)) return null;
630
639
  }
631
640
  const first = prev.rows;
632
641
  for (let c = 0; c < cols; c++) {
633
- const above = _optionalChain([owner, 'access', _10 => _10[first - 1], 'optionalAccess', _11 => _11[c]]);
642
+ const above = _optionalChain([owner, 'access', _12 => _12[first - 1], 'optionalAccess', _13 => _13[c]]);
634
643
  if (!above) continue;
635
644
  let r = first;
636
645
  while (r < rows && owner[r][c] === null) r++;
@@ -649,7 +658,7 @@ function joinSplitParts(prev, pcx, curr, ccx, dx = 0, prevBottom) {
649
658
  const grown = { ...above, rs: newRs };
650
659
  for (let rr = above.r; rr < above.r + newRs; rr++) for (let dc = above.c; dc < above.c + above.cs; dc++) owner[rr][dc] = grown;
651
660
  }
652
- for (let r = 0; r < rows; r++) for (let c = 0; c < cols; c++) if (owner[r][c] === null) _chunkW33QEDLYcjs.FILLER_CELLS.add(grid[r][c]);
661
+ for (let r = 0; r < rows; r++) for (let c = 0; c < cols; c++) if (owner[r][c] === null) _chunkVSI5SRP2cjs.FILLER_CELLS.add(grid[r][c]);
653
662
  const table = { rows, cols, cells: grid, hasHeader: prev.hasHeader, ...prev.caption ? { caption: prev.caption } : {} };
654
663
  const split = rows > prev.rows && mergeSplitRow(table, owner, prev.rows, U);
655
664
  if (rows > prev.rows && !split && prevBottom !== void 0) mergeStraddlingCells(table, owner, prev.rows, prevBottom);
@@ -667,8 +676,8 @@ function mergeStraddlingCells(table, owner, first, prevBottom) {
667
676
  c = u.c + u.cs;
668
677
  if (!d || d === u || u.r >= last || u.r + u.rs - 1 !== last || d.r !== first || d.c !== u.c || d.cs !== u.cs) continue;
669
678
  const a = table.cells[u.r][u.c], b = table.cells[first][d.c];
670
- const U = _chunkW33QEDLYcjs.CELL_LINES.get(a);
671
- if (!_optionalChain([U, 'optionalAccess', _12 => _12.length]) || U.length > STRADDLE_MAX_LINES || !hasContent(b)) continue;
679
+ const U = _chunkVSI5SRP2cjs.CELL_LINES.get(a);
680
+ if (!_optionalChain([U, 'optionalAccess', _14 => _14.length]) || U.length > STRADDLE_MAX_LINES || !hasContent(b)) continue;
672
681
  const lu = U[U.length - 1];
673
682
  if (lu.y - prevBottom > STRADDLE_BOTTOM * (lu.h || 10)) continue;
674
683
  appendCell(a, b);
@@ -690,8 +699,8 @@ var LABEL_ROOM = 1.5;
690
699
  var HANGING_MIN = 0.5;
691
700
  var HANGING_TOL = 1;
692
701
  function continuesAcross(u, d, x1, x2) {
693
- const U = _chunkW33QEDLYcjs.CELL_LINES.get(u), D = _chunkW33QEDLYcjs.CELL_LINES.get(d);
694
- if (!_optionalChain([U, 'optionalAccess', _13 => _13.length]) || !_optionalChain([D, 'optionalAccess', _14 => _14.length])) return false;
702
+ const U = _chunkVSI5SRP2cjs.CELL_LINES.get(u), D = _chunkVSI5SRP2cjs.CELL_LINES.get(d);
703
+ if (!_optionalChain([U, 'optionalAccess', _15 => _15.length]) || !_optionalChain([D, 'optionalAccess', _16 => _16.length])) return false;
695
704
  const last = U[U.length - 1];
696
705
  const fs = last.h || 10;
697
706
  let minL = Infinity, maxR = -Infinity;
@@ -712,19 +721,19 @@ function continuesAcross(u, d, x1, x2) {
712
721
  return U.some(leftAligned) || D.some(leftAligned) || hanging;
713
722
  }
714
723
  function lineEnded(c, x1, x2) {
715
- const L = _chunkW33QEDLYcjs.CELL_LINES.get(c);
724
+ const L = _chunkVSI5SRP2cjs.CELL_LINES.get(c);
716
725
  if (!L || L.length !== 1) return false;
717
726
  const l = L[0];
718
727
  return x2 - l.r - (l.l - x1) >= LABEL_ROOM * (l.h || 10);
719
728
  }
720
729
  function appendCell(a, b) {
721
- if (_optionalChain([a, 'access', _15 => _15.blocks, 'optionalAccess', _16 => _16.length]) || _optionalChain([b, 'access', _17 => _17.blocks, 'optionalAccess', _18 => _18.length])) {
722
- const asBlocks = (c) => _optionalChain([c, 'access', _19 => _19.blocks, 'optionalAccess', _20 => _20.length]) ? c.blocks : c.text.split("\n").map((l) => l.trim()).filter(Boolean).map((text) => ({ type: "paragraph", text }));
730
+ if (_optionalChain([a, 'access', _17 => _17.blocks, 'optionalAccess', _18 => _18.length]) || _optionalChain([b, 'access', _19 => _19.blocks, 'optionalAccess', _20 => _20.length])) {
731
+ const asBlocks = (c) => _optionalChain([c, 'access', _21 => _21.blocks, 'optionalAccess', _22 => _22.length]) ? c.blocks : c.text.split("\n").map((l) => l.trim()).filter(Boolean).map((text) => ({ type: "paragraph", text }));
723
732
  a.blocks = [...asBlocks(a), ...asBlocks(b)];
724
733
  }
725
734
  if (b.text.trim()) a.text = a.text.trim() ? a.text + "\n" + b.text : b.text;
726
735
  }
727
- var hasContent = (cell) => !!cell.text.trim() || !!_optionalChain([cell, 'access', _21 => _21.blocks, 'optionalAccess', _22 => _22.length]) || _chunkW33QEDLYcjs.IMAGE_CELLS.has(cell);
736
+ var hasContent = (cell) => !!cell.text.trim() || !!_optionalChain([cell, 'access', _23 => _23.blocks, 'optionalAccess', _24 => _24.length]) || _chunkVSI5SRP2cjs.IMAGE_CELLS.has(cell);
728
737
  function mergeSplitRow(table, owner, first, colXs) {
729
738
  const last = first - 1;
730
739
  const pairs = [];
@@ -797,19 +806,19 @@ function mergeCrossPageTables(blocks, pageHeights) {
797
806
  placeJoined(blocks, i, j, joined);
798
807
  continue;
799
808
  }
800
- if (_chunkW33QEDLYcjs.EMPTY_PARTS.has(curr.table)) {
809
+ if (_chunkVSI5SRP2cjs.EMPTY_PARTS.has(curr.table)) {
801
810
  blocks.splice(j, 1);
802
811
  i++;
803
812
  continue;
804
813
  }
805
814
  if (joined === null) continue;
806
- if (prev.table.cols !== curr.table.cols || _chunkW33QEDLYcjs.EMPTY_PARTS.has(prev.table)) continue;
815
+ if (prev.table.cols !== curr.table.cols || _chunkVSI5SRP2cjs.EMPTY_PARTS.has(prev.table)) continue;
807
816
  const width = Math.max(prev.bbox.width, curr.bbox.width, 1);
808
817
  const leftDiff = Math.abs(prev.bbox.x - curr.bbox.x);
809
818
  const rightDiff = Math.abs(prev.bbox.x + prev.bbox.width - (curr.bbox.x + curr.bbox.width));
810
819
  if (leftDiff > width * NEIGHBOR_TABLE_EPSILON || rightDiff > width * NEIGHBOR_TABLE_EPSILON) continue;
811
- const px = _chunkW33QEDLYcjs.TABLE_COLXS.get(prev.table), cx = _chunkW33QEDLYcjs.TABLE_COLXS.get(curr.table);
812
- if (px && cx && !shiftedSame(px, cx, !_chunkW33QEDLYcjs.CLIP_TABLES.has(prev.table) && !_chunkW33QEDLYcjs.CLIP_TABLES.has(curr.table))) continue;
820
+ const px = _chunkVSI5SRP2cjs.TABLE_COLXS.get(prev.table), cx = _chunkVSI5SRP2cjs.TABLE_COLXS.get(curr.table);
821
+ if (px && cx && !shiftedSame(px, cx, !_chunkVSI5SRP2cjs.CLIP_TABLES.has(prev.table) && !_chunkVSI5SRP2cjs.CLIP_TABLES.has(curr.table))) continue;
813
822
  let currCells = curr.table.cells;
814
823
  if (currCells.length > 1 && prev.table.cells.length > 0 && rowTextsEqual(prev.table.cells[0], currCells[0])) {
815
824
  currCells = currCells.slice(1);
@@ -825,20 +834,20 @@ function mergeCrossPageTables(blocks, pageHeights) {
825
834
  hasHeader: prev.table.hasHeader,
826
835
  caption: prev.table.caption
827
836
  };
828
- if (_nullishCoalesce(px, () => ( cx))) _chunkW33QEDLYcjs.TABLE_COLXS.set(merged, _nullishCoalesce(px, () => ( cx)));
829
- if (_chunkW33QEDLYcjs.CLIP_TABLES.has(prev.table) || _chunkW33QEDLYcjs.CLIP_TABLES.has(curr.table)) _chunkW33QEDLYcjs.CLIP_TABLES.add(merged);
837
+ if (_nullishCoalesce(px, () => ( cx))) _chunkVSI5SRP2cjs.TABLE_COLXS.set(merged, _nullishCoalesce(px, () => ( cx)));
838
+ if (_chunkVSI5SRP2cjs.CLIP_TABLES.has(prev.table) || _chunkVSI5SRP2cjs.CLIP_TABLES.has(curr.table)) _chunkVSI5SRP2cjs.CLIP_TABLES.add(merged);
830
839
  placeJoined(blocks, i, j, merged);
831
840
  }
832
841
  for (let i = blocks.length - 1; i >= 0; i--) {
833
842
  const t = blocks[i].table;
834
- if (blocks[i].type === "table" && t && _chunkW33QEDLYcjs.EMPTY_PARTS.has(t)) blocks.splice(i, 1);
843
+ if (blocks[i].type === "table" && t && _chunkVSI5SRP2cjs.EMPTY_PARTS.has(t)) blocks.splice(i, 1);
835
844
  }
836
845
  }
837
846
  function mergeColumnFlow(blocks, pageHeights) {
838
847
  if (!pageHeights) return;
839
848
  for (let i = 0; i < blocks.length; i++) {
840
849
  const L = blocks[i];
841
- if (L.type !== "table" || !L.table || !L.bbox || !L.pageNumber || !_chunkW33QEDLYcjs.CLIP_TABLES.has(L.table) || _chunkW33QEDLYcjs.EMPTY_PARTS.has(L.table)) continue;
850
+ if (L.type !== "table" || !L.table || !L.bbox || !L.pageNumber || !_chunkVSI5SRP2cjs.CLIP_TABLES.has(L.table) || _chunkVSI5SRP2cjs.EMPTY_PARTS.has(L.table)) continue;
842
851
  const ph = pageHeights.get(L.pageNumber);
843
852
  if (!ph || L.bbox.y > ph * PAGE_EDGE_BAND) continue;
844
853
  let s0 = i, s1 = i;
@@ -867,12 +876,12 @@ function mergeColumnFlow(blocks, pageHeights) {
867
876
  }
868
877
  function joinClipParts(prev, curr, pageHeights) {
869
878
  const pt = prev.table, ct = curr.table;
870
- if (!_chunkW33QEDLYcjs.CLIP_TABLES.has(pt) || !_chunkW33QEDLYcjs.CLIP_TABLES.has(ct)) return null;
871
- const px = _chunkW33QEDLYcjs.TABLE_COLXS.get(pt), cx = _chunkW33QEDLYcjs.TABLE_COLXS.get(ct);
879
+ if (!_chunkVSI5SRP2cjs.CLIP_TABLES.has(pt) || !_chunkVSI5SRP2cjs.CLIP_TABLES.has(ct)) return null;
880
+ const px = _chunkVSI5SRP2cjs.TABLE_COLXS.get(pt), cx = _chunkVSI5SRP2cjs.TABLE_COLXS.get(ct);
872
881
  if (!px || !cx) return null;
873
882
  let xs = cx, shifted = false, dx = 0;
874
883
  if (!shiftedSame(px, cx, false)) {
875
- if (!_optionalChain([pageHeights, 'optionalAccess', _23 => _23.get, 'call', _24 => _24(prev.pageNumber)]) || !_optionalChain([pageHeights, 'optionalAccess', _25 => _25.get, 'call', _26 => _26(curr.pageNumber)])) return null;
884
+ if (!_optionalChain([pageHeights, 'optionalAccess', _25 => _25.get, 'call', _26 => _26(prev.pageNumber)]) || !_optionalChain([pageHeights, 'optionalAccess', _27 => _27.get, 'call', _28 => _28(curr.pageNumber)])) return null;
876
885
  dx = px[px.length - 1] - cx[cx.length - 1];
877
886
  if (Math.abs(dx) > CONTINUATION_COL_TOL) {
878
887
  xs = cx.map((x) => x + dx);
@@ -880,21 +889,21 @@ function joinClipParts(prev, curr, pageHeights) {
880
889
  } else dx = 0;
881
890
  if (!px.some((x) => Math.abs(x - xs[0]) <= CONTINUATION_COL_TOL)) return null;
882
891
  }
883
- const res = joinSplitParts(pt, px, ct, xs, dx, _optionalChain([prev, 'access', _27 => _27.bbox, 'optionalAccess', _28 => _28.y]));
892
+ const res = joinSplitParts(pt, px, ct, xs, dx, _optionalChain([prev, 'access', _29 => _29.bbox, 'optionalAccess', _30 => _30.y]));
884
893
  if (!res || shifted && !res.split && !res.header) return null;
885
- _chunkW33QEDLYcjs.TABLE_COLXS.set(res.table, res.colXs);
886
- _chunkW33QEDLYcjs.CLIP_TABLES.add(res.table);
894
+ _chunkVSI5SRP2cjs.TABLE_COLXS.set(res.table, res.colXs);
895
+ _chunkVSI5SRP2cjs.CLIP_TABLES.add(res.table);
887
896
  return res.table;
888
897
  }
889
898
  var ANNEX_HEAD_RE = /^\s*[<\[(【]?\s*(?:붙\s*임|참\s*고|별\s*첨|별\s*지|별\s*표|첨\s*부|부\s*록)(?:\s*\d|\s*$|\s*[>\])】])|^\s*■/;
890
899
  function looksContinued(prev, curr, pageHeights) {
891
- const ph = _optionalChain([pageHeights, 'optionalAccess', _29 => _29.get, 'call', _30 => _30(prev.pageNumber)]), ch = _optionalChain([pageHeights, 'optionalAccess', _31 => _31.get, 'call', _32 => _32(curr.pageNumber)]);
900
+ const ph = _optionalChain([pageHeights, 'optionalAccess', _31 => _31.get, 'call', _32 => _32(prev.pageNumber)]), ch = _optionalChain([pageHeights, 'optionalAccess', _33 => _33.get, 'call', _34 => _34(curr.pageNumber)]);
892
901
  if (ph && ch && (prev.bbox.y > ph * PAGE_EDGE_BAND || curr.bbox.y + curr.bbox.height < ch * (1 - PAGE_EDGE_BAND))) return false;
893
- const firstText = _nullishCoalesce(_optionalChain([curr, 'access', _33 => _33.table, 'access', _34 => _34.cells, 'access', _35 => _35[0], 'optionalAccess', _36 => _36.find, 'call', _37 => _37((c) => c.text.trim()), 'optionalAccess', _38 => _38.text]), () => ( ""));
902
+ const firstText = _nullishCoalesce(_optionalChain([curr, 'access', _35 => _35.table, 'access', _36 => _36.cells, 'access', _37 => _37[0], 'optionalAccess', _38 => _38.find, 'call', _39 => _39((c) => c.text.trim()), 'optionalAccess', _40 => _40.text]), () => ( ""));
894
903
  return !ANNEX_HEAD_RE.test(firstText);
895
904
  }
896
905
  function firstRowSig(t) {
897
- const x = _chunkW33QEDLYcjs.TABLE_COLXS.get(t);
906
+ const x = _chunkVSI5SRP2cjs.TABLE_COLXS.get(t);
898
907
  if (!x || x.length !== t.cols + 1) return null;
899
908
  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, "") }));
900
909
  }
@@ -930,7 +939,7 @@ function chainHead(blocks, i, pageHeights) {
930
939
  if (pb.pageNumber !== (_nullishCoalesce(cur.pageNumber, () => ( 0))) - 1) break;
931
940
  if (!blocks.slice(p + 1, k).every((b) => besideOwn(b, pb, cur) || insideTable(b, pb))) break;
932
941
  if (!looksContinued(pb, cur, pageHeights)) break;
933
- const px = _chunkW33QEDLYcjs.TABLE_COLXS.get(pb.table), cx = _chunkW33QEDLYcjs.TABLE_COLXS.get(cur.table);
942
+ const px = _chunkVSI5SRP2cjs.TABLE_COLXS.get(pb.table), cx = _chunkVSI5SRP2cjs.TABLE_COLXS.get(cur.table);
934
943
  if (!px || !cx) break;
935
944
  const dx = px[px.length - 1] - cx[cx.length - 1];
936
945
  if (!shiftedSame(px, cx) && !px.some((x) => Math.abs(x - (cx[0] + dx)) <= CONTINUATION_COL_TOL)) break;
@@ -959,12 +968,12 @@ var RESTART_LOOKBACK_PAGES = 5;
959
968
  // src/pdf/cell-continuation.ts
960
969
  var COL_MATCH_TOL = 0.5;
961
970
  function lastRowCell(t, x1, x2) {
962
- const xs = _chunkW33QEDLYcjs.TABLE_COLXS.get(t);
971
+ const xs = _chunkVSI5SRP2cjs.TABLE_COLXS.get(t);
963
972
  const covered = /* @__PURE__ */ new Set();
964
973
  for (let r = 0; r < t.rows; r++) {
965
974
  for (let c = 0; c < t.cols; c++) {
966
975
  if (covered.has(r * 1e5 + c)) continue;
967
- const cell = _optionalChain([t, 'access', _39 => _39.cells, 'access', _40 => _40[r], 'optionalAccess', _41 => _41[c]]);
976
+ const cell = _optionalChain([t, 'access', _41 => _41.cells, 'access', _42 => _42[r], 'optionalAccess', _43 => _43[c]]);
968
977
  if (!cell) continue;
969
978
  for (let dr = 0; dr < cell.rowSpan; dr++) for (let dc = 0; dc < cell.colSpan; dc++) covered.add((r + dr) * 1e5 + c + dc);
970
979
  if (r + cell.rowSpan !== t.rows) continue;
@@ -977,22 +986,36 @@ var cellBlocks = (cell, pageNumber) => _nullishCoalesce(cell.blocks, () => ( cel
977
986
  function mergeContinuedCells(blocks, pageHeights) {
978
987
  for (let j = blocks.length - 1; j > 0; j--) {
979
988
  const part = blocks[j];
980
- const from = part.table ? _chunkW33QEDLYcjs.CONT_PARTS.get(part.table) : void 0;
989
+ const from = part.table ? _chunkVSI5SRP2cjs.CONT_PARTS.get(part.table) : void 0;
981
990
  if (!from || !part.table) continue;
982
991
  let i = j - 1;
983
992
  while (i >= 0 && blocks[i].type !== "table") i--;
984
993
  const prev = blocks[i];
985
994
  if (i < 0 || !prev.table || prev.pageNumber !== (_nullishCoalesce(part.pageNumber, () => ( 0))) - 1) continue;
986
995
  const cell = lastRowCell(prev.table, from.x1, from.x2);
987
- const add = _optionalChain([part, 'access', _42 => _42.table, 'access', _43 => _43.cells, 'access', _44 => _44[0], 'optionalAccess', _45 => _45[0]]);
996
+ const add = _optionalChain([part, 'access', _44 => _44.table, 'access', _45 => _45.cells, 'access', _46 => _46[0], 'optionalAccess', _47 => _47[0]]);
988
997
  if (!cell || !add) continue;
998
+ const at = cell.blocks || add.blocks ? cellBlocks(cell, prev.pageNumber).length : -1;
989
999
  if (cell.blocks || add.blocks) cell.blocks = [...cellBlocks(cell, prev.pageNumber), ...cellBlocks(add, part.pageNumber)];
990
1000
  cell.text = [cell.text, add.text].filter((s) => s.trim()).join("\n");
991
- if (cell.text.trim() || _optionalChain([cell, 'access', _46 => _46.blocks, 'optionalAccess', _47 => _47.length])) _chunkW33QEDLYcjs.EMPTY_PARTS.delete(prev.table);
1001
+ if (cell.text.trim() || _optionalChain([cell, 'access', _48 => _48.blocks, 'optionalAccess', _49 => _49.length])) _chunkVSI5SRP2cjs.EMPTY_PARTS.delete(prev.table);
992
1002
  blocks.splice(j, 1);
1003
+ if (cell.blocks && at > 0) fillNestedContinuation(cell.blocks, at);
993
1004
  if (cell.blocks) mergeCrossPageTables(cell.blocks, pageHeights);
994
1005
  }
995
1006
  }
1007
+ function fillNestedContinuation(blocks, at) {
1008
+ const prev = blocks[at - 1], next = blocks[at];
1009
+ const t = _optionalChain([prev, 'optionalAccess', _50 => _50.table]), u = _optionalChain([next, 'optionalAccess', _51 => _51.table]);
1010
+ if (!t || !u || u.rows !== 1 || u.cols !== 1 || !_chunkVSI5SRP2cjs.CLIP_TABLES.has(t) || !_chunkVSI5SRP2cjs.CLIP_TABLES.has(u) || next.pageNumber !== (_nullishCoalesce(prev.pageNumber, () => ( 0))) + 1) return;
1011
+ const xs = _chunkVSI5SRP2cjs.TABLE_COLXS.get(u);
1012
+ const cell = xs ? lastRowCell(t, xs[0], xs[xs.length - 1]) : void 0;
1013
+ const add = _optionalChain([u, 'access', _52 => _52.cells, 'access', _53 => _53[0], 'optionalAccess', _54 => _54[0]]);
1014
+ if (!cell || !add || cell.text.trim() || _optionalChain([cell, 'access', _55 => _55.blocks, 'optionalAccess', _56 => _56.length])) return;
1015
+ cell.text = add.text;
1016
+ if (add.blocks) cell.blocks = add.blocks;
1017
+ blocks.splice(at, 1);
1018
+ }
996
1019
 
997
1020
  // src/pdf/symbol-fonts.ts
998
1021
  var WINANSI_REVERSE = {
@@ -1026,7 +1049,7 @@ var WINANSI_REVERSE = {
1026
1049
  };
1027
1050
  function symbolFontTable(fontName) {
1028
1051
  if (!fontName) return void 0;
1029
- if (/wingdings(?![\s-]*[23])/i.test(fontName)) return _chunk3CWXYYCLcjs.WINGDINGS;
1052
+ if (/wingdings(?![\s-]*[23])/i.test(fontName)) return _chunk3Y26ICMCcjs.WINGDINGS;
1030
1053
  return void 0;
1031
1054
  }
1032
1055
  function remapSymbolText(text, table) {
@@ -1087,8 +1110,8 @@ function splitSingleCellTables(blocks) {
1087
1110
  const out = [];
1088
1111
  for (const b of blocks) {
1089
1112
  const t = b.type === "table" ? b.table : void 0;
1090
- const cell = t && t.rows === 1 && t.cols === 1 ? _optionalChain([t, 'access', _48 => _48.cells, 'access', _49 => _49[0], 'optionalAccess', _50 => _50[0]]) : void 0;
1091
- if (!cell || _optionalChain([cell, 'access', _51 => _51.blocks, 'optionalAccess', _52 => _52.some, 'call', _53 => _53((x) => x.type === "table")])) {
1113
+ const cell = t && t.rows === 1 && t.cols === 1 ? _optionalChain([t, 'access', _57 => _57.cells, 'access', _58 => _58[0], 'optionalAccess', _59 => _59[0]]) : void 0;
1114
+ if (!cell || _optionalChain([cell, 'access', _60 => _60.blocks, 'optionalAccess', _61 => _61.some, 'call', _62 => _62((x) => x.type === "table")])) {
1092
1115
  out.push(b);
1093
1116
  continue;
1094
1117
  }
@@ -1104,10 +1127,10 @@ function cleanPdfText(text) {
1104
1127
  ).replace(/^(?!\| ---).*$/gm, (line) => {
1105
1128
  if (/^\s*\${1,2}.+\${1,2}\s*$/.test(line)) return line;
1106
1129
  if (line.startsWith("|")) {
1107
- return line.replace(/(?:\\.|[^|\\])+/g, (cell) => cell.split("<br>").map((seg) => seg.replace(/\S(?:.*\S)?/, (t) => _chunkW33QEDLYcjs.collapseEvenSpacing.call(void 0, t, false))).join("<br>"));
1130
+ return line.replace(/(?:\\.|[^|\\])+/g, (cell) => cell.split("<br>").map((seg) => seg.replace(/\S(?:.*\S)?/, (t) => _chunkVSI5SRP2cjs.collapseEvenSpacing.call(void 0, t, false))).join("<br>"));
1108
1131
  }
1109
- const mark = _nullishCoalesce(_optionalChain([/^(?:#{1,6}|-) /, 'access', _54 => _54.exec, 'call', _55 => _55(line), 'optionalAccess', _56 => _56[0]]), () => ( ""));
1110
- return mark + _chunkW33QEDLYcjs.collapseEvenSpacing.call(void 0, line.slice(mark.length), false);
1132
+ const mark = _nullishCoalesce(_optionalChain([/^(?:#{1,6}|-) /, 'access', _63 => _63.exec, 'call', _64 => _64(line), 'optionalAccess', _65 => _65[0]]), () => ( ""));
1133
+ return mark + _chunkVSI5SRP2cjs.collapseEvenSpacing.call(void 0, line.slice(mark.length), false);
1111
1134
  }).replace(/\\~\\~/g, "~~").replace(/~~~~/g, "").replace(/<u>\s*<\/u>/g, "").replace(/\n{3,}/g, "\n\n").trim();
1112
1135
  }
1113
1136
  function startsWithMarker(line) {
@@ -1139,7 +1162,7 @@ function mergeKoreanLines(text) {
1139
1162
  continue;
1140
1163
  }
1141
1164
  if (/[가-힣·,\-]$/.test(prev) && /^[가-힣(]/.test(curr) && !startsWithMarker(curr) && !isStandaloneHeader(prev) && !startsWithMarker(prev)) {
1142
- result[result.length - 1] = prev + _chunkW33QEDLYcjs.wrapJoiner.call(void 0, prev, curr) + curr;
1165
+ result[result.length - 1] = prev + _chunkVSI5SRP2cjs.wrapJoiner.call(void 0, prev, curr) + curr;
1143
1166
  } else {
1144
1167
  result.push(curr);
1145
1168
  }
@@ -1155,7 +1178,7 @@ function applyLinkAnnotations(items, annots) {
1155
1178
  const wrapped = /* @__PURE__ */ new Set();
1156
1179
  for (const a of annots) {
1157
1180
  if (a.subtype !== "Link" || !a.url || !a.rect || a.rect.length < 4) continue;
1158
- const url = _chunkLBYKEJUJcjs.sanitizeHref.call(void 0, a.url);
1181
+ const url = _chunkVGU4FLLDcjs.sanitizeHref.call(void 0, a.url);
1159
1182
  if (!url) continue;
1160
1183
  const x1 = Math.min(a.rect[0], a.rect[2]), x2 = Math.max(a.rect[0], a.rect[2]);
1161
1184
  const y1 = Math.min(a.rect[1], a.rect[3]), y2 = Math.max(a.rect[1], a.rect[3]);
@@ -1186,7 +1209,7 @@ function applyLinkAnnotations(items, annots) {
1186
1209
 
1187
1210
  // src/pdf/formula-ocr.ts
1188
1211
  async function applyFormulaOcr(buffer, blocks, pageFilter, effectivePageCount, warnings, _onProgress) {
1189
- const formulaMod = await Promise.resolve().then(() => _interopRequireWildcard(require("./formula-RGK6WGD2.cjs")));
1212
+ const formulaMod = await Promise.resolve().then(() => _interopRequireWildcard(require("./formula-DYVJSHWN.cjs")));
1190
1213
  const { FormulaPipeline, ensureFormulaModels } = formulaMod;
1191
1214
  await ensureFormulaModels((p) => {
1192
1215
  if (p.phase === "download" && p.total) {
@@ -1341,7 +1364,8 @@ try {
1341
1364
  }
1342
1365
  async function loadPdfWithTimeout(buffer) {
1343
1366
  const loadingTask = _pdfmjs.getDocument.call(void 0, {
1344
- data: new Uint8Array(buffer),
1367
+ // pdfjs transfers its input to the worker; retain the caller's buffer for reuse.
1368
+ data: new Uint8Array(buffer.slice(0)),
1345
1369
  useSystemFonts: true,
1346
1370
  disableFontFace: true,
1347
1371
  isEvalSupported: false,
@@ -1352,11 +1376,14 @@ async function loadPdfWithTimeout(buffer) {
1352
1376
  let timer;
1353
1377
  try {
1354
1378
  return await Promise.race([
1355
- loadingTask.promise,
1379
+ loadingTask.promise.catch((e) => {
1380
+ if (e instanceof Error && e.name === "PasswordException") throw new (0, _chunkVGU4FLLDcjs.KordocError)("\uC554\uD638\uB85C \uBCF4\uD638\uB41C PDF \uD30C\uC77C\uC785\uB2C8\uB2E4 (PDF \uC5F4\uAE30 \uC554\uD638\uB294 \uC9C0\uC6D0\uD558\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4)");
1381
+ throw e;
1382
+ }),
1356
1383
  new Promise((_, reject) => {
1357
1384
  timer = setTimeout(() => {
1358
1385
  loadingTask.destroy();
1359
- reject(new (0, _chunkLBYKEJUJcjs.KordocError)("PDF \uB85C\uB529 \uD0C0\uC784\uC544\uC6C3 (30\uCD08 \uCD08\uACFC)"));
1386
+ reject(new (0, _chunkVGU4FLLDcjs.KordocError)("PDF \uB85C\uB529 \uD0C0\uC784\uC544\uC6C3 (30\uCD08 \uCD08\uACFC)"));
1360
1387
  }, PDF_LOAD_TIMEOUT_MS);
1361
1388
  })
1362
1389
  ]);
@@ -1365,12 +1392,12 @@ async function loadPdfWithTimeout(buffer) {
1365
1392
  }
1366
1393
  }
1367
1394
  async function parsePdfDocument(buffer, options) {
1368
- const formulaBuffer = _optionalChain([options, 'optionalAccess', _57 => _57.formulaOcr]) ? buffer.slice(0) : null;
1369
- const ocrBuffer = _optionalChain([options, 'optionalAccess', _58 => _58.ocr]) ? buffer.slice(0) : null;
1395
+ const formulaBuffer = _optionalChain([options, 'optionalAccess', _66 => _66.formulaOcr]) ? buffer : null;
1396
+ const ocrBuffer = _optionalChain([options, 'optionalAccess', _67 => _67.ocr]) ? buffer : null;
1370
1397
  const doc = await loadPdfWithTimeout(buffer);
1371
1398
  try {
1372
1399
  const pageCount = doc.numPages;
1373
- if (pageCount === 0) throw new (0, _chunkLBYKEJUJcjs.KordocError)("PDF\uC5D0 \uD398\uC774\uC9C0\uAC00 \uC5C6\uC2B5\uB2C8\uB2E4.");
1400
+ if (pageCount === 0) throw new (0, _chunkVGU4FLLDcjs.KordocError)("PDF\uC5D0 \uD398\uC774\uC9C0\uAC00 \uC5C6\uC2B5\uB2C8\uB2E4.");
1374
1401
  const metadata = { pageCount, pageMode: "layout" };
1375
1402
  await extractPdfMetadata(doc, metadata);
1376
1403
  const blocks = [];
@@ -1379,7 +1406,10 @@ async function parsePdfDocument(buffer, options) {
1379
1406
  let totalChars = 0;
1380
1407
  let totalTextBytes = 0;
1381
1408
  const effectivePageCount = Math.min(pageCount, MAX_PAGES);
1382
- const pageFilter = _optionalChain([options, 'optionalAccess', _59 => _59.pages]) ? _chunkDCZVOIEOcjs.parsePageRange.call(void 0, options.pages, effectivePageCount) : null;
1409
+ const pageFilter = _optionalChain([options, 'optionalAccess', _68 => _68.pages]) ? _chunkJ55UQC5Hcjs.parsePageRange.call(void 0, options.pages, effectivePageCount) : null;
1410
+ if (pageCount > MAX_PAGES && (!_optionalChain([options, 'optionalAccess', _69 => _69.pages]) || _chunkJ55UQC5Hcjs.hasRequestedPagesAfter.call(void 0, options.pages, MAX_PAGES, pageCount))) {
1411
+ warnings.push({ message: `${pageCount}\uCABD \uC911 \uC55E ${MAX_PAGES}\uCABD\uB9CC \uD30C\uC2F1\uD588\uC2B5\uB2C8\uB2E4 (\uCABD \uC218 \uC0C1\uD55C)`, code: "PARTIAL_PARSE" });
1412
+ }
1383
1413
  const totalTarget = pageFilter ? pageFilter.size : effectivePageCount;
1384
1414
  const fontSizeFreq = /* @__PURE__ */ new Map();
1385
1415
  const pageHeights = /* @__PURE__ */ new Map();
@@ -1390,18 +1420,21 @@ async function parsePdfDocument(buffer, options) {
1390
1420
  const pageImageBlocks = /* @__PURE__ */ new Map();
1391
1421
  const carry = {};
1392
1422
  const vectorPageOps = /* @__PURE__ */ new Map();
1393
- const wrapLexicon = new (0, _chunkW33QEDLYcjs.WrapLexicon)();
1423
+ const wrapLexicon = new (0, _chunkVSI5SRP2cjs.WrapLexicon)();
1394
1424
  let parsedPages = 0;
1395
1425
  for (let i = 1; i <= effectivePageCount; i++) {
1396
1426
  if (pageFilter && !pageFilter.has(i)) continue;
1427
+ let loadedPage;
1397
1428
  try {
1398
1429
  const page = await doc.getPage(i);
1430
+ loadedPage = page;
1399
1431
  const tc = await page.getTextContent();
1400
- const viewport = page.getViewport({ scale: 1 });
1401
- pageHeights.set(i, viewport.height);
1432
+ const [viewX1, viewY1, viewX2, viewY2] = page.view;
1433
+ const pageW = viewX2 - viewX1, pageH = viewY2 - viewY1;
1434
+ pageHeights.set(i, pageH);
1402
1435
  const rawItems = tc.items;
1403
- const items = _chunkW33QEDLYcjs.normalizeItems.call(void 0, rawItems);
1404
- const { visible, hiddenCount } = _chunkW33QEDLYcjs.filterHiddenText.call(void 0, items, viewport.width, viewport.height);
1436
+ const items = _chunkVSI5SRP2cjs.normalizeItems.call(void 0, rawItems);
1437
+ const { visible, hiddenCount } = _chunkVSI5SRP2cjs.filterHiddenText.call(void 0, items, pageW, pageH, viewX1, viewY1);
1405
1438
  if (hiddenCount > 0) {
1406
1439
  warnings.push({ page: i, message: `${hiddenCount}\uAC1C \uC228\uACA8\uC9C4 \uD14D\uC2A4\uD2B8 \uC694\uC18C \uD544\uD130\uB9C1\uB428`, code: "HIDDEN_TEXT_FILTERED" });
1407
1440
  }
@@ -1413,18 +1446,27 @@ async function parsePdfDocument(buffer, options) {
1413
1446
  applyLinkAnnotations(visible, annots);
1414
1447
  } catch (e4) {
1415
1448
  }
1416
- const opList = await page.getOperatorList();
1449
+ const rawOps = await page.getOperatorList();
1450
+ const shifted = viewX1 !== 0 || viewY1 !== 0;
1451
+ if (shifted) for (const item of visible) {
1452
+ item.x -= viewX1;
1453
+ item.y -= viewY1;
1454
+ }
1455
+ const opList = shifted ? {
1456
+ fnArray: [_pdfmjs.OPS.transform, ...rawOps.fnArray],
1457
+ argsArray: [[1, 0, 0, 1, -viewX1, -viewY1], ...rawOps.argsArray]
1458
+ } : rawOps;
1417
1459
  remapSymbolFontItems(visible, (loadedName) => {
1418
1460
  try {
1419
- return page.commonObjs.has(loadedName) ? _optionalChain([page, 'access', _60 => _60.commonObjs, 'access', _61 => _61.get, 'call', _62 => _62(loadedName), 'optionalAccess', _63 => _63.name]) : void 0;
1461
+ return page.commonObjs.has(loadedName) ? _optionalChain([page, 'access', _70 => _70.commonObjs, 'access', _71 => _71.get, 'call', _72 => _72(loadedName), 'optionalAccess', _73 => _73.name]) : void 0;
1420
1462
  } catch (e5) {
1421
1463
  return void 0;
1422
1464
  }
1423
1465
  });
1424
- for (const it of visible) if (it.text.includes("$")) it.text = _chunk3CWXYYCLcjs.escapeLiteralDollar.call(void 0, it.text);
1425
- const pageArea = viewport.width * viewport.height;
1466
+ for (const it of visible) if (it.text.includes("$")) it.text = _chunk3Y26ICMCcjs.escapeLiteralDollar.call(void 0, it.text);
1467
+ const pageArea = pageW * pageH;
1426
1468
  if (pageArea > 0) {
1427
- const imageRegions = _chunkW33QEDLYcjs.extractImageRegions.call(void 0, opList.fnArray, opList.argsArray);
1469
+ const imageRegions = _chunkVSI5SRP2cjs.extractImageRegions.call(void 0, opList.fnArray, opList.argsArray);
1428
1470
  let uncovered = 0;
1429
1471
  for (const r of imageRegions) {
1430
1472
  const area = (r.x2 - r.x1) * (r.y2 - r.y1);
@@ -1439,10 +1481,10 @@ async function parsePdfDocument(buffer, options) {
1439
1481
  }
1440
1482
  if (uncovered > 0) skippedImagePages.set(i, uncovered);
1441
1483
  }
1442
- const pageBlocks = _chunkW33QEDLYcjs.extractPageBlocksWithLines.call(void 0, visible, i, opList, viewport.width, viewport.height, void 0, _optionalChain([options, 'optionalAccess', _64 => _64.tables]) !== false, carry, wrapLexicon);
1484
+ const pageBlocks = _chunkVSI5SRP2cjs.extractPageBlocksWithLines.call(void 0, visible, i, opList, pageW, pageH, void 0, _optionalChain([options, 'optionalAccess', _74 => _74.tables]) !== false, carry, wrapLexicon);
1443
1485
  for (const b of pageBlocks) blocks.push(b);
1444
1486
  try {
1445
- const { blocks: imgBlocks, images: pageImages } = await extractPageImages(page, opList.fnArray, opList.argsArray, i, imageState, warnings, _optionalChain([options, 'optionalAccess', _65 => _65.images]) !== false);
1487
+ const { blocks: imgBlocks, images: pageImages } = await extractPageImages(page, opList.fnArray, opList.argsArray, i, imageState, warnings, _optionalChain([options, 'optionalAccess', _75 => _75.images]) !== false);
1446
1488
  if (imgBlocks.length > 0) pageImageBlocks.set(i, imgBlocks);
1447
1489
  extractedImages.push(...pageImages);
1448
1490
  } catch (e6) {
@@ -1461,21 +1503,23 @@ async function parsePdfDocument(buffer, options) {
1461
1503
  const vector = scanVectorGlyphs(opList.fnArray, opList.argsArray, visible);
1462
1504
  const quality = computePageQuality(i, pageText, vector.glyphs);
1463
1505
  pageQuality.push(quality);
1464
- if (_optionalChain([options, 'optionalAccess', _66 => _66.ocr]) && quality.ocrReason === "vector_text" && page.rotate % 360 === 0 && page.view[0] === 0 && page.view[1] === 0) {
1506
+ if (_optionalChain([options, 'optionalAccess', _76 => _76.ocr]) && quality.ocrReason === "vector_text" && page.rotate % 360 === 0 && page.view[0] === 0 && page.view[1] === 0) {
1465
1507
  vectorPageOps.set(i, ocrVectorOps(opList, vector.paths));
1466
1508
  }
1467
- if (totalTextBytes > MAX_TOTAL_TEXT) throw new (0, _chunkLBYKEJUJcjs.KordocError)("\uD14D\uC2A4\uD2B8 \uCD94\uCD9C \uD06C\uAE30 \uCD08\uACFC");
1509
+ if (totalTextBytes > MAX_TOTAL_TEXT) throw new (0, _chunkVGU4FLLDcjs.KordocError)("\uD14D\uC2A4\uD2B8 \uCD94\uCD9C \uD06C\uAE30 \uCD08\uACFC");
1468
1510
  parsedPages++;
1469
- _optionalChain([options, 'optionalAccess', _67 => _67.onProgress, 'optionalCall', _68 => _68(parsedPages, totalTarget)]);
1511
+ _optionalChain([options, 'optionalAccess', _77 => _77.onProgress, 'optionalCall', _78 => _78(parsedPages, totalTarget)]);
1470
1512
  } catch (pageErr) {
1471
- if (pageErr instanceof _chunkLBYKEJUJcjs.KordocError) throw pageErr;
1513
+ if (pageErr instanceof _chunkVGU4FLLDcjs.KordocError) throw pageErr;
1472
1514
  warnings.push({ page: i, message: `\uD398\uC774\uC9C0 ${i} \uD30C\uC2F1 \uC2E4\uD328: ${pageErr instanceof Error ? pageErr.message : "\uC54C \uC218 \uC5C6\uB294 \uC624\uB958"}`, code: "PARTIAL_PARSE" });
1515
+ } finally {
1516
+ _optionalChain([loadedPage, 'optionalAccess', _79 => _79.cleanup, 'call', _80 => _80()]);
1473
1517
  }
1474
1518
  }
1475
1519
  const parsedPageCount = parsedPages || (pageFilter ? pageFilter.size : effectivePageCount);
1476
- const isImageBased = totalChars / Math.max(parsedPageCount, 1) < 10;
1520
+ const isImageBased = _optionalChain([pageFilter, 'optionalAccess', _81 => _81.size]) !== 0 && totalChars / Math.max(parsedPageCount, 1) < 10;
1477
1521
  const ocrDone = /* @__PURE__ */ new Set();
1478
- if (_optionalChain([options, 'optionalAccess', _69 => _69.ocr]) && ocrBuffer) {
1522
+ if (_optionalChain([options, 'optionalAccess', _82 => _82.ocr]) && ocrBuffer) {
1479
1523
  const inScope = (p) => !pageFilter || pageFilter.has(p);
1480
1524
  const targets = /* @__PURE__ */ new Set();
1481
1525
  if (options.ocr === "force" || isImageBased) {
@@ -1489,16 +1533,16 @@ async function parsePdfDocument(buffer, options) {
1489
1533
  }
1490
1534
  if (targets.size > 0) {
1491
1535
  try {
1492
- const { runPdfOcr } = await Promise.resolve().then(() => _interopRequireWildcard(require("./pdf-ocr-E3IZ3EI5.cjs")));
1536
+ const { runPdfOcr } = await Promise.resolve().then(() => _interopRequireWildcard(require("./pdf-ocr-K7MJFRBS.cjs")));
1493
1537
  const mode = typeof options.ocr === "function" ? options.ocr : "builtin";
1494
1538
  const ocrPageBlocks = await runPdfOcr(ocrBuffer, targets, mode, warnings, options.onProgress, options.tables !== false, vectorPageOps);
1495
1539
  if (ocrPageBlocks.size > 0) {
1496
1540
  for (const p of ocrPageBlocks.keys()) ocrDone.add(p);
1497
1541
  const merged = blocks.filter((b) => !(b.pageNumber && ocrDone.has(b.pageNumber)));
1498
- for (const obs of ocrPageBlocks.values()) merged.push(...obs);
1542
+ for (const obs of ocrPageBlocks.values()) for (const b of obs) merged.push(b);
1499
1543
  merged.sort((a, b) => (_nullishCoalesce(a.pageNumber, () => ( 0))) - (_nullishCoalesce(b.pageNumber, () => ( 0))));
1500
1544
  blocks.length = 0;
1501
- blocks.push(...merged);
1545
+ for (const b of merged) blocks.push(b);
1502
1546
  for (const pq of pageQuality) if (ocrDone.has(pq.page)) pq.ocrApplied = true;
1503
1547
  warnings.push({
1504
1548
  message: `${ocrDone.size}\uAC1C \uD398\uC774\uC9C0\uC5D0 OCR \uC801\uC6A9 (${mode === "builtin" ? "\uB0B4\uC7A5 PP-OCRv5" : "\uC0AC\uC6A9\uC790 \uD504\uB85C\uBC14\uC774\uB354"})`,
@@ -1539,18 +1583,18 @@ async function parsePdfDocument(buffer, options) {
1539
1583
  warnings.push({ page, message: `${count}\uAC1C \uC774\uBBF8\uC9C0 \uC601\uC5ED\uC5D0 \uCD94\uCD9C \uAC00\uB2A5\uD55C \uD14D\uC2A4\uD2B8 \uC5C6\uC74C (\uADF8\uB9BC/\uCC28\uD2B8/\uB3C4\uC7A5 \uB0B4\uC6A9 \uB204\uB77D \uAC00\uB2A5)`, code: "SKIPPED_IMAGE" });
1540
1584
  }
1541
1585
  }
1542
- if (_optionalChain([options, 'optionalAccess', _70 => _70.removeHeaderFooter]) !== false && parsedPageCount >= 3) {
1543
- const removed = _chunkW33QEDLYcjs.removeHeaderFooterBlocks.call(void 0, blocks, pageHeights, warnings);
1586
+ if (_optionalChain([options, 'optionalAccess', _83 => _83.removeHeaderFooter]) !== false && parsedPageCount >= 3) {
1587
+ const removed = _chunkVSI5SRP2cjs.removeHeaderFooterBlocks.call(void 0, blocks, pageHeights, warnings);
1544
1588
  for (let ri = removed.length - 1; ri >= 0; ri--) {
1545
1589
  blocks.splice(removed[ri], 1);
1546
1590
  }
1547
1591
  }
1548
1592
  mergeContinuedCells(blocks, pageHeights);
1549
1593
  mergeCrossPageTables(blocks, pageHeights);
1550
- if (!_optionalChain([options, 'optionalAccess', _71 => _71.keepTrailingEmptyCols])) _chunkW33QEDLYcjs.trimTrailingEmptyTableCols.call(void 0, blocks);
1551
- _chunkW33QEDLYcjs.joinPageBreakWraps.call(void 0, blocks, wrapLexicon);
1594
+ if (!_optionalChain([options, 'optionalAccess', _84 => _84.keepTrailingEmptyCols])) _chunkVSI5SRP2cjs.trimTrailingEmptyTableCols.call(void 0, blocks);
1595
+ _chunkVSI5SRP2cjs.joinPageBreakWraps.call(void 0, blocks, wrapLexicon);
1552
1596
  injectPageImageBlocks(blocks, pageImageBlocks);
1553
- if (_optionalChain([options, 'optionalAccess', _72 => _72.formulaOcr]) && formulaBuffer) {
1597
+ if (_optionalChain([options, 'optionalAccess', _85 => _85.formulaOcr]) && formulaBuffer) {
1554
1598
  try {
1555
1599
  await applyFormulaOcr(formulaBuffer, blocks, pageFilter, effectivePageCount, warnings, options.onProgress);
1556
1600
  } catch (e) {
@@ -1560,19 +1604,21 @@ async function parsePdfDocument(buffer, options) {
1560
1604
  });
1561
1605
  }
1562
1606
  }
1563
- const medianFontSize = _chunkW33QEDLYcjs.computeMedianFontSizeFromFreq.call(void 0, fontSizeFreq);
1607
+ const medianFontSize = _chunkVSI5SRP2cjs.computeMedianFontSizeFromFreq.call(void 0, fontSizeFreq);
1564
1608
  if (medianFontSize > 0) {
1565
- _chunkW33QEDLYcjs.detectHeadings.call(void 0, blocks, medianFontSize);
1609
+ _chunkVSI5SRP2cjs.detectHeadings.call(void 0, blocks, medianFontSize);
1566
1610
  }
1567
- _chunkW33QEDLYcjs.detectMarkerHeadings.call(void 0, blocks);
1568
- _chunkW33QEDLYcjs.detectTableCaptions.call(void 0, blocks);
1569
- _chunkW33QEDLYcjs.detectKoreanListBlocks.call(void 0, blocks);
1611
+ _chunkVSI5SRP2cjs.detectMarkerHeadings.call(void 0, blocks);
1612
+ _chunkVSI5SRP2cjs.detectTableCaptions.call(void 0, blocks);
1613
+ _chunkVSI5SRP2cjs.detectKoreanListBlocks.call(void 0, blocks);
1570
1614
  const outline = blocks.filter((b) => b.type === "heading" && b.level && b.text).map((b) => ({ level: b.level, text: b.text, pageNumber: b.pageNumber }));
1571
1615
  sanitizeBlockControlChars(blocks);
1572
1616
  const outBlocks = splitSingleCellTables(blocks);
1573
- let markdown = cleanPdfText(_chunk3CWXYYCLcjs.blocksToMarkdown.call(void 0, outBlocks));
1617
+ const finishMarkdown = (bs) => cleanPdfText(_chunk3Y26ICMCcjs.blocksToMarkdown.call(void 0, bs));
1618
+ let markdown = finishMarkdown(outBlocks);
1574
1619
  return {
1575
1620
  markdown,
1621
+ pages: _chunk3Y26ICMCcjs.blocksToPages.call(void 0, outBlocks, finishMarkdown),
1576
1622
  blocks,
1577
1623
  metadata,
1578
1624
  outline: outline.length > 0 ? outline : void 0,
@@ -1590,7 +1636,7 @@ async function parsePdfDocument(buffer, options) {
1590
1636
  async function extractPdfMetadata(doc, metadata) {
1591
1637
  try {
1592
1638
  const result = await doc.getMetadata();
1593
- if (!_optionalChain([result, 'optionalAccess', _73 => _73.info])) return;
1639
+ if (!_optionalChain([result, 'optionalAccess', _86 => _86.info])) return;
1594
1640
  const info = result.info;
1595
1641
  if (typeof info.Title === "string" && info.Title.trim()) metadata.title = info.Title.trim();
1596
1642
  if (typeof info.Author === "string" && info.Author.trim()) metadata.author = info.Author.trim();
@@ -1629,5 +1675,5 @@ async function extractPdfMetadataOnly(buffer) {
1629
1675
 
1630
1676
 
1631
1677
 
1632
- exports.cleanPdfText = cleanPdfText; exports.detectKoreanListBlocks = _chunkW33QEDLYcjs.detectKoreanListBlocks; exports.detectTableCaptions = _chunkW33QEDLYcjs.detectTableCaptions; exports.extractPdfMetadataOnly = extractPdfMetadataOnly; exports.mergeCrossPageTables = mergeCrossPageTables; exports.parsePdfDocument = parsePdfDocument; exports.removeHeaderFooterBlocks = _chunkW33QEDLYcjs.removeHeaderFooterBlocks;
1633
- //# sourceMappingURL=parser-Y5NX55GC.cjs.map
1678
+ exports.cleanPdfText = cleanPdfText; exports.detectKoreanListBlocks = _chunkVSI5SRP2cjs.detectKoreanListBlocks; exports.detectTableCaptions = _chunkVSI5SRP2cjs.detectTableCaptions; exports.extractPdfMetadataOnly = extractPdfMetadataOnly; exports.mergeCrossPageTables = mergeCrossPageTables; exports.parsePdfDocument = parsePdfDocument; exports.removeHeaderFooterBlocks = _chunkVSI5SRP2cjs.removeHeaderFooterBlocks;
1679
+ //# sourceMappingURL=parser-XCXDSKQ3.cjs.map