kordoc 3.5.0 → 3.5.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 (83) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +590 -590
  3. package/dist/{-GKNSTVEZ.js → -LYUGJZQG.js} +5 -5
  4. package/dist/{chunk-X34YWRL5.cjs → chunk-DCZVOIEO.cjs} +1 -1
  5. package/dist/chunk-DCZVOIEO.cjs.map +1 -0
  6. package/dist/{chunk-GTCJQANY.js → chunk-DN5LTND6.js} +48 -38
  7. package/dist/chunk-DN5LTND6.js.map +1 -0
  8. package/dist/{chunk-4JLD2IT7.cjs → chunk-G44XLS26.cjs} +25 -11
  9. package/dist/chunk-G44XLS26.cjs.map +1 -0
  10. package/dist/{chunk-AIQ3ISQU.js → chunk-GE43BE46.js} +1 -1
  11. package/dist/chunk-GE43BE46.js.map +1 -0
  12. package/dist/chunk-GS7T56RP.cjs.map +1 -1
  13. package/dist/{chunk-CFQLK3LM.js → chunk-MEPHGCPQ.js} +1 -1
  14. package/dist/chunk-MEPHGCPQ.js.map +1 -0
  15. package/dist/{chunk-3TBUDJDE.js → chunk-MOL7MDBG.js} +1 -1
  16. package/dist/chunk-MOL7MDBG.js.map +1 -0
  17. package/dist/{chunk-A4LSWJEC.js → chunk-NOIHZQWC.js} +16 -2
  18. package/dist/chunk-NOIHZQWC.js.map +1 -0
  19. package/dist/{chunk-AHDNELBR.js → chunk-QXXQIZBH.js} +16 -2
  20. package/dist/chunk-QXXQIZBH.js.map +1 -0
  21. package/dist/cli.js +8 -8
  22. package/dist/cli.js.map +1 -1
  23. package/dist/{detect-NTR2FUEG.js → detect-RI2MQ33K.js} +2 -2
  24. package/dist/{formula-ZYUDQHD3.cjs → formula-5NKVS2LR.cjs} +1 -1
  25. package/dist/formula-5NKVS2LR.cjs.map +1 -0
  26. package/dist/{formula-KOQV353G.js → formula-JCNF43NE.js} +1 -1
  27. package/dist/formula-JCNF43NE.js.map +1 -0
  28. package/dist/{formula-MEDGYQXS.js → formula-RXVSQPXI.js} +1 -1
  29. package/dist/formula-RXVSQPXI.js.map +1 -0
  30. package/dist/index.cjs +185 -175
  31. package/dist/index.cjs.map +1 -1
  32. package/dist/index.js +46 -36
  33. package/dist/index.js.map +1 -1
  34. package/dist/mcp.js +6 -6
  35. package/dist/mcp.js.map +1 -1
  36. package/dist/page-range-737B4EZW.js +8 -0
  37. package/dist/page-range-LNMXJU6W.js +7 -0
  38. package/dist/page-range-P7SDW6LR.cjs +8 -0
  39. package/dist/page-range-P7SDW6LR.cjs.map +1 -0
  40. package/dist/{parser-25ISHR7Q.cjs → parser-2O276TRF.cjs} +18 -18
  41. package/dist/parser-2O276TRF.cjs.map +1 -0
  42. package/dist/{parser-LBLPN3KY.js → parser-4FFTFIYL.js} +5 -5
  43. package/dist/parser-4FFTFIYL.js.map +1 -0
  44. package/dist/{parser-LMBDB7RM.js → parser-KDF76UCB.js} +5 -5
  45. package/dist/parser-KDF76UCB.js.map +1 -0
  46. package/dist/{provider-H4WWSPOV.js → provider-4ZJKV3DC.js} +1 -1
  47. package/dist/provider-4ZJKV3DC.js.map +1 -0
  48. package/dist/{provider-7H4CPZYS.js → provider-AKROB7WQ.js} +1 -1
  49. package/dist/provider-AKROB7WQ.js.map +1 -0
  50. package/dist/{provider-5K7O3Z2O.cjs → provider-G4C2V2PD.cjs} +1 -1
  51. package/dist/provider-G4C2V2PD.cjs.map +1 -0
  52. package/dist/{setup-QSJ2INNS.js → setup-57FB3LSP.js} +1 -1
  53. package/dist/setup-57FB3LSP.js.map +1 -0
  54. package/dist/{watch-77CYT54V.js → watch-MF7JFR7S.js} +5 -5
  55. package/dist/watch-MF7JFR7S.js.map +1 -0
  56. package/package.json +98 -98
  57. package/dist/chunk-3TBUDJDE.js.map +0 -1
  58. package/dist/chunk-4JLD2IT7.cjs.map +0 -1
  59. package/dist/chunk-A4LSWJEC.js.map +0 -1
  60. package/dist/chunk-AHDNELBR.js.map +0 -1
  61. package/dist/chunk-AIQ3ISQU.js.map +0 -1
  62. package/dist/chunk-CFQLK3LM.js.map +0 -1
  63. package/dist/chunk-GTCJQANY.js.map +0 -1
  64. package/dist/chunk-X34YWRL5.cjs.map +0 -1
  65. package/dist/formula-KOQV353G.js.map +0 -1
  66. package/dist/formula-MEDGYQXS.js.map +0 -1
  67. package/dist/formula-ZYUDQHD3.cjs.map +0 -1
  68. package/dist/page-range-CIRRJPXJ.js +0 -7
  69. package/dist/page-range-OF5I4PQY.js +0 -8
  70. package/dist/page-range-TPIRSA3J.cjs +0 -8
  71. package/dist/page-range-TPIRSA3J.cjs.map +0 -1
  72. package/dist/parser-25ISHR7Q.cjs.map +0 -1
  73. package/dist/parser-LBLPN3KY.js.map +0 -1
  74. package/dist/parser-LMBDB7RM.js.map +0 -1
  75. package/dist/provider-5K7O3Z2O.cjs.map +0 -1
  76. package/dist/provider-7H4CPZYS.js.map +0 -1
  77. package/dist/provider-H4WWSPOV.js.map +0 -1
  78. package/dist/setup-QSJ2INNS.js.map +0 -1
  79. package/dist/watch-77CYT54V.js.map +0 -1
  80. /package/dist/{-GKNSTVEZ.js.map → -LYUGJZQG.js.map} +0 -0
  81. /package/dist/{detect-NTR2FUEG.js.map → detect-RI2MQ33K.js.map} +0 -0
  82. /package/dist/{page-range-CIRRJPXJ.js.map → page-range-737B4EZW.js.map} +0 -0
  83. /package/dist/{page-range-OF5I4PQY.js.map → page-range-LNMXJU6W.js.map} +0 -0
package/dist/index.cjs CHANGED
@@ -17,10 +17,12 @@
17
17
 
18
18
 
19
19
 
20
- var _chunk4JLD2IT7cjs = require('./chunk-4JLD2IT7.cjs');
21
20
 
22
21
 
23
- var _chunkX34YWRL5cjs = require('./chunk-X34YWRL5.cjs');
22
+ var _chunkG44XLS26cjs = require('./chunk-G44XLS26.cjs');
23
+
24
+
25
+ var _chunkDCZVOIEOcjs = require('./chunk-DCZVOIEO.cjs');
24
26
 
25
27
 
26
28
  var _chunkGS7T56RPcjs = require('./chunk-GS7T56RP.cjs');
@@ -660,14 +662,27 @@ function findBrackets(eqString, startIdx, direction) {
660
662
  const [s, e] = findBrackets(flipped, newStartIdx, 1);
661
663
  return [flipped.length - e, flipped.length - s];
662
664
  }
663
- function findOutterBrackets(eqString, startIdx) {
664
- let idx = startIdx;
665
- while (true) {
666
- idx -= 1;
667
- if (idx < 0) throw new Error("cannot find bracket");
668
- if (eqString[idx] === "{") break;
665
+ function findEnclosingBrackets(eqString, startIdx) {
666
+ let depth = 0;
667
+ for (let idx = startIdx - 1; idx >= 0; idx--) {
668
+ const ch = eqString[idx];
669
+ if (ch === "}") {
670
+ depth += 1;
671
+ } else if (ch === "{") {
672
+ if (depth > 0) {
673
+ depth -= 1;
674
+ continue;
675
+ }
676
+ try {
677
+ const [start, end] = findBrackets(eqString, idx, 1);
678
+ if (start === idx && end > startIdx) return [start, end];
679
+ } catch (e5) {
680
+ return null;
681
+ }
682
+ return null;
683
+ }
669
684
  }
670
- return findBrackets(eqString, idx, 1);
685
+ return null;
671
686
  }
672
687
  function replaceFrac(eqString) {
673
688
  const hmlFrac = "over";
@@ -680,7 +695,7 @@ function replaceFrac(eqString) {
680
695
  const beforeFrac = eqString.slice(0, numStart);
681
696
  const afterFrac = eqString.slice(cursor + hmlFrac.length);
682
697
  eqString = beforeFrac + "\\frac" + numerator + afterFrac;
683
- } catch (e5) {
698
+ } catch (e6) {
684
699
  return eqString;
685
700
  }
686
701
  }
@@ -698,7 +713,7 @@ function replaceRootOf(eqString) {
698
713
  const e1 = eqString.slice(elem1[0] + 1, elem1[1] - 1);
699
714
  const e2 = eqString.slice(elem2[0] + 1, elem2[1] - 1);
700
715
  eqString = eqString.slice(0, rootCursor) + "\\sqrt[" + e1 + "]{" + e2 + "}" + eqString.slice(elem2[1] + 1);
701
- } catch (e6) {
716
+ } catch (e7) {
702
717
  return eqString;
703
718
  }
704
719
  }
@@ -720,8 +735,9 @@ function replaceAllMatrix(eqString) {
720
735
  const elem = replaceElements(input.slice(eStart, eEnd));
721
736
  let beforeMat;
722
737
  let afterMat;
723
- if (matElem.removeOutterBrackets) {
724
- const [bStart, bEnd] = findOutterBrackets(input, cursor);
738
+ const outer = matElem.removeOutterBrackets ? findEnclosingBrackets(input, cursor) : null;
739
+ if (outer && outer[1] >= eEnd) {
740
+ const [bStart, bEnd] = outer;
725
741
  beforeMat = input.slice(0, bStart);
726
742
  afterMat = input.slice(bEnd);
727
743
  } else {
@@ -729,7 +745,7 @@ function replaceAllMatrix(eqString) {
729
745
  afterMat = input.slice(eEnd);
730
746
  }
731
747
  input = beforeMat + matElem.begin + elem + matElem.end + afterMat;
732
- } catch (e7) {
748
+ } catch (e8) {
733
749
  return input;
734
750
  }
735
751
  }
@@ -747,12 +763,13 @@ function replaceAllBar(eqString) {
747
763
  if (cursor === -1) break;
748
764
  try {
749
765
  const [eStart, eEnd] = findBrackets(input, cursor, 1);
750
- const [bStart, bEnd] = findOutterBrackets(input, cursor);
751
766
  const elem = input.slice(eStart, eEnd);
752
- const beforeBar = input.slice(0, bStart);
753
- const afterBar = input.slice(bEnd);
767
+ const outer = findEnclosingBrackets(input, cursor);
768
+ const [replaceStart, replaceEnd] = outer && outer[1] >= eEnd ? outer : [cursor, eEnd];
769
+ const beforeBar = input.slice(0, replaceStart);
770
+ const afterBar = input.slice(replaceEnd);
754
771
  input = beforeBar + barElem + elem + afterBar;
755
- } catch (e8) {
772
+ } catch (e9) {
756
773
  return input;
757
774
  }
758
775
  }
@@ -776,7 +793,7 @@ function replaceAllBrace(eqString) {
776
793
  const beforeBrace = input.slice(0, cursor);
777
794
  const afterBrace = input.slice(eEnd2);
778
795
  input = beforeBrace + braceElem + elem1 + "^" + elem2 + afterBrace;
779
- } catch (e9) {
796
+ } catch (e10) {
780
797
  return input;
781
798
  }
782
799
  }
@@ -828,7 +845,7 @@ function createSectionShared() {
828
845
  function createXmlParser(warnings) {
829
846
  return new (0, _xmldom.DOMParser)({
830
847
  onError(level, msg2) {
831
- if (level === "fatalError") throw new (0, _chunk4JLD2IT7cjs.KordocError)(`XML \uD30C\uC2F1 \uC2E4\uD328: ${msg2}`);
848
+ if (level === "fatalError") throw new (0, _chunkG44XLS26cjs.KordocError)(`XML \uD30C\uC2F1 \uC2E4\uD328: ${msg2}`);
832
849
  _optionalChain([warnings, 'optionalAccess', _3 => _3.push, 'call', _4 => _4({ code: "MALFORMED_XML", message: `XML ${level === "warn" ? "\uACBD\uACE0" : "\uC624\uB958"}: ${msg2}` })]);
833
850
  }
834
851
  });
@@ -850,10 +867,10 @@ async function extractHwpxStyles(zip, decompressed) {
850
867
  const xml = await file.async("text");
851
868
  if (decompressed) {
852
869
  decompressed.total += xml.length * 2;
853
- if (decompressed.total > MAX_DECOMPRESS_SIZE) throw new (0, _chunk4JLD2IT7cjs.KordocError)("ZIP \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (ZIP bomb \uC758\uC2EC)");
870
+ if (decompressed.total > MAX_DECOMPRESS_SIZE) throw new (0, _chunkG44XLS26cjs.KordocError)("ZIP \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (ZIP bomb \uC758\uC2EC)");
854
871
  }
855
872
  const parser = createXmlParser();
856
- const doc = parser.parseFromString(_chunk4JLD2IT7cjs.stripDtd.call(void 0, xml), "text/xml");
873
+ const doc = parser.parseFromString(_chunkG44XLS26cjs.stripDtd.call(void 0, xml), "text/xml");
857
874
  if (!doc.documentElement) continue;
858
875
  parseCharProperties(doc, result.charProperties);
859
876
  parseStyleElements(doc, result.styles);
@@ -862,7 +879,7 @@ async function extractHwpxStyles(zip, decompressed) {
862
879
  parseBullets(domDoc, result.bullets);
863
880
  parseParaHeadings(domDoc, result.paraHeadings);
864
881
  break;
865
- } catch (e10) {
882
+ } catch (e11) {
866
883
  continue;
867
884
  }
868
885
  }
@@ -1075,16 +1092,16 @@ function resolveParaHeading(paraEl, ctx) {
1075
1092
  return { prefix, headingLevel };
1076
1093
  }
1077
1094
  async function parseHwpxDocument(buffer, options) {
1078
- _chunk4JLD2IT7cjs.precheckZipSize.call(void 0, buffer, MAX_DECOMPRESS_SIZE, MAX_ZIP_ENTRIES);
1095
+ _chunkG44XLS26cjs.precheckZipSize.call(void 0, buffer, MAX_DECOMPRESS_SIZE, MAX_ZIP_ENTRIES);
1079
1096
  let zip;
1080
1097
  try {
1081
1098
  zip = await _jszip2.default.loadAsync(buffer);
1082
- } catch (e11) {
1099
+ } catch (e12) {
1083
1100
  return extractFromBrokenZip(buffer);
1084
1101
  }
1085
1102
  const actualEntryCount = Object.keys(zip.files).length;
1086
1103
  if (actualEntryCount > MAX_ZIP_ENTRIES) {
1087
- throw new (0, _chunk4JLD2IT7cjs.KordocError)("ZIP \uC5D4\uD2B8\uB9AC \uC218 \uCD08\uACFC (ZIP bomb \uC758\uC2EC)");
1104
+ throw new (0, _chunkG44XLS26cjs.KordocError)("ZIP \uC5D4\uD2B8\uB9AC \uC218 \uCD08\uACFC (ZIP bomb \uC758\uC2EC)");
1088
1105
  }
1089
1106
  const manifestFile = zip.file("META-INF/manifest.xml");
1090
1107
  if (manifestFile) {
@@ -1096,7 +1113,7 @@ async function parseHwpxDocument(buffer, options) {
1096
1113
  return comResultToParseResult(pages, pageCount, warnings2);
1097
1114
  }
1098
1115
  }
1099
- throw new (0, _chunk4JLD2IT7cjs.KordocError)("DRM \uC554\uD638\uD654\uB41C HWPX \uD30C\uC77C\uC785\uB2C8\uB2E4. Windows + \uD55C\uCEF4 \uC624\uD53C\uC2A4 \uC124\uCE58 \uC2DC \uC790\uB3D9 \uCD94\uCD9C\uB429\uB2C8\uB2E4.");
1116
+ throw new (0, _chunkG44XLS26cjs.KordocError)("DRM \uC554\uD638\uD654\uB41C HWPX \uD30C\uC77C\uC785\uB2C8\uB2E4. Windows + \uD55C\uCEF4 \uC624\uD53C\uC2A4 \uC124\uCE58 \uC2DC \uC790\uB3D9 \uCD94\uCD9C\uB429\uB2C8\uB2E4.");
1100
1117
  }
1101
1118
  }
1102
1119
  const decompressed = { total: 0 };
@@ -1105,9 +1122,9 @@ async function parseHwpxDocument(buffer, options) {
1105
1122
  const styleMap = await extractHwpxStyles(zip, decompressed);
1106
1123
  const warnings = [];
1107
1124
  const sectionPaths = await resolveSectionPaths(zip);
1108
- if (sectionPaths.length === 0) throw new (0, _chunk4JLD2IT7cjs.KordocError)("HWPX\uC5D0\uC11C \uC139\uC158 \uD30C\uC77C\uC744 \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4");
1125
+ if (sectionPaths.length === 0) throw new (0, _chunkG44XLS26cjs.KordocError)("HWPX\uC5D0\uC11C \uC139\uC158 \uD30C\uC77C\uC744 \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4");
1109
1126
  metadata.pageCount = sectionPaths.length;
1110
- const pageFilter = _optionalChain([options, 'optionalAccess', _12 => _12.pages]) ? _chunkX34YWRL5cjs.parsePageRange.call(void 0, options.pages, sectionPaths.length) : null;
1127
+ const pageFilter = _optionalChain([options, 'optionalAccess', _12 => _12.pages]) ? _chunkDCZVOIEOcjs.parsePageRange.call(void 0, options.pages, sectionPaths.length) : null;
1111
1128
  const totalTarget = pageFilter ? pageFilter.size : sectionPaths.length;
1112
1129
  const blocks = [];
1113
1130
  const shared = createSectionShared();
@@ -1119,12 +1136,12 @@ async function parseHwpxDocument(buffer, options) {
1119
1136
  try {
1120
1137
  const xml = await file.async("text");
1121
1138
  decompressed.total += xml.length * 2;
1122
- if (decompressed.total > MAX_DECOMPRESS_SIZE) throw new (0, _chunk4JLD2IT7cjs.KordocError)("ZIP \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (ZIP bomb \uC758\uC2EC)");
1139
+ if (decompressed.total > MAX_DECOMPRESS_SIZE) throw new (0, _chunkG44XLS26cjs.KordocError)("ZIP \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (ZIP bomb \uC758\uC2EC)");
1123
1140
  blocks.push(...parseSectionXml(xml, styleMap, warnings, si + 1, shared));
1124
1141
  parsedSections++;
1125
1142
  _optionalChain([options, 'optionalAccess', _13 => _13.onProgress, 'optionalCall', _14 => _14(parsedSections, totalTarget)]);
1126
1143
  } catch (secErr) {
1127
- if (secErr instanceof _chunk4JLD2IT7cjs.KordocError) throw secErr;
1144
+ if (secErr instanceof _chunkG44XLS26cjs.KordocError) throw secErr;
1128
1145
  warnings.push({ page: si + 1, message: `\uC139\uC158 ${si + 1} \uD30C\uC2F1 \uC2E4\uD328: ${secErr instanceof Error ? secErr.message : "\uC54C \uC218 \uC5C6\uB294 \uC624\uB958"}`, code: "PARTIAL_PARSE" });
1129
1146
  }
1130
1147
  }
@@ -1132,7 +1149,7 @@ async function parseHwpxDocument(buffer, options) {
1132
1149
  const images = await extractImagesFromZip(zip, blocks, decompressed, warnings);
1133
1150
  detectHwpxHeadings(blocks, styleMap);
1134
1151
  const outline = blocks.filter((b) => b.type === "heading" && b.level && b.text).map((b) => ({ level: b.level, text: b.text, pageNumber: b.pageNumber }));
1135
- const markdown = _chunk4JLD2IT7cjs.blocksToMarkdown.call(void 0, blocks);
1152
+ const markdown = _chunkG44XLS26cjs.blocksToMarkdown.call(void 0, blocks);
1136
1153
  return { markdown, blocks, metadata, outline: outline.length > 0 ? outline : void 0, warnings: warnings.length > 0 ? warnings : void 0, images: images.length > 0 ? images : void 0 };
1137
1154
  }
1138
1155
  function applyPageText(blocks, shared) {
@@ -1221,13 +1238,13 @@ async function extractImagesFromZip(zip, blocks, decompressed, warnings) {
1221
1238
  let found = false;
1222
1239
  const allCandidates = resolvedPath ? [resolvedPath, ...candidates] : candidates;
1223
1240
  for (const path of allCandidates) {
1224
- if (_chunk4JLD2IT7cjs.isPathTraversal.call(void 0, path)) continue;
1241
+ if (_chunkG44XLS26cjs.isPathTraversal.call(void 0, path)) continue;
1225
1242
  const file = zip.file(path);
1226
1243
  if (!file) continue;
1227
1244
  try {
1228
1245
  const data = await file.async("uint8array");
1229
1246
  decompressed.total += data.length;
1230
- if (decompressed.total > MAX_DECOMPRESS_SIZE) throw new (0, _chunk4JLD2IT7cjs.KordocError)("ZIP \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (ZIP bomb \uC758\uC2EC)");
1247
+ if (decompressed.total > MAX_DECOMPRESS_SIZE) throw new (0, _chunkG44XLS26cjs.KordocError)("ZIP \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (ZIP bomb \uC758\uC2EC)");
1231
1248
  const actualPath = path;
1232
1249
  const ext = actualPath.includes(".") ? actualPath.split(".").pop() || "png" : "png";
1233
1250
  const mimeType = imageExtToMime(ext);
@@ -1240,7 +1257,7 @@ async function extractImagesFromZip(zip, blocks, decompressed, warnings) {
1240
1257
  found = true;
1241
1258
  break;
1242
1259
  } catch (err) {
1243
- if (err instanceof _chunk4JLD2IT7cjs.KordocError) throw err;
1260
+ if (err instanceof _chunkG44XLS26cjs.KordocError) throw err;
1244
1261
  }
1245
1262
  }
1246
1263
  if (!found) {
@@ -1261,17 +1278,17 @@ async function extractHwpxMetadata(zip, metadata, decompressed) {
1261
1278
  const xml = await file.async("text");
1262
1279
  if (decompressed) {
1263
1280
  decompressed.total += xml.length * 2;
1264
- if (decompressed.total > MAX_DECOMPRESS_SIZE) throw new (0, _chunk4JLD2IT7cjs.KordocError)("ZIP \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (ZIP bomb \uC758\uC2EC)");
1281
+ if (decompressed.total > MAX_DECOMPRESS_SIZE) throw new (0, _chunkG44XLS26cjs.KordocError)("ZIP \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (ZIP bomb \uC758\uC2EC)");
1265
1282
  }
1266
1283
  parseDublinCoreMetadata(xml, metadata);
1267
1284
  if (metadata.title || metadata.author) return;
1268
1285
  }
1269
- } catch (e12) {
1286
+ } catch (e13) {
1270
1287
  }
1271
1288
  }
1272
1289
  function parseDublinCoreMetadata(xml, metadata) {
1273
1290
  const parser = createXmlParser();
1274
- const doc = parser.parseFromString(_chunk4JLD2IT7cjs.stripDtd.call(void 0, xml), "text/xml");
1291
+ const doc = parser.parseFromString(_chunkG44XLS26cjs.stripDtd.call(void 0, xml), "text/xml");
1275
1292
  if (!doc.documentElement) return;
1276
1293
  const getText = (tagNames) => {
1277
1294
  for (const tag of tagNames) {
@@ -1331,7 +1348,7 @@ function extractFromBrokenZip(buffer) {
1331
1348
  }
1332
1349
  const nameBytes = data.slice(pos + 30, pos + 30 + nameLen);
1333
1350
  const name = new TextDecoder().decode(nameBytes);
1334
- if (_chunk4JLD2IT7cjs.isPathTraversal.call(void 0, name)) {
1351
+ if (_chunkG44XLS26cjs.isPathTraversal.call(void 0, name)) {
1335
1352
  pos = fileStart + compSize;
1336
1353
  continue;
1337
1354
  }
@@ -1349,16 +1366,16 @@ function extractFromBrokenZip(buffer) {
1349
1366
  continue;
1350
1367
  }
1351
1368
  totalDecompressed += content.length * 2;
1352
- if (totalDecompressed > MAX_DECOMPRESS_SIZE) throw new (0, _chunk4JLD2IT7cjs.KordocError)("\uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC");
1369
+ if (totalDecompressed > MAX_DECOMPRESS_SIZE) throw new (0, _chunkG44XLS26cjs.KordocError)("\uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC");
1353
1370
  sectionNum++;
1354
1371
  blocks.push(...parseSectionXml(content, void 0, warnings, sectionNum, shared));
1355
- } catch (e13) {
1372
+ } catch (e14) {
1356
1373
  continue;
1357
1374
  }
1358
1375
  }
1359
- if (blocks.length === 0) throw new (0, _chunk4JLD2IT7cjs.KordocError)("\uC190\uC0C1\uB41C HWPX\uC5D0\uC11C \uC139\uC158 \uB370\uC774\uD130\uB97C \uBCF5\uAD6C\uD560 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4");
1376
+ if (blocks.length === 0) throw new (0, _chunkG44XLS26cjs.KordocError)("\uC190\uC0C1\uB41C HWPX\uC5D0\uC11C \uC139\uC158 \uB370\uC774\uD130\uB97C \uBCF5\uAD6C\uD560 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4");
1360
1377
  applyPageText(blocks, shared);
1361
- const markdown = _chunk4JLD2IT7cjs.blocksToMarkdown.call(void 0, blocks);
1378
+ const markdown = _chunkG44XLS26cjs.blocksToMarkdown.call(void 0, blocks);
1362
1379
  return { markdown, blocks, warnings: warnings.length > 0 ? warnings : void 0 };
1363
1380
  }
1364
1381
  async function resolveSectionPaths(zip) {
@@ -1372,24 +1389,19 @@ async function resolveSectionPaths(zip) {
1372
1389
  if (paths.length > 0) return paths;
1373
1390
  }
1374
1391
  const sectionFiles = zip.file(/[Ss]ection\d+\.xml$/);
1375
- return sectionFiles.map((f) => f.name).sort();
1392
+ return sectionFiles.map((f) => f.name).sort(_chunkG44XLS26cjs.compareSectionPaths);
1376
1393
  }
1377
1394
  function parseSectionPathsFromManifest(xml) {
1378
1395
  const parser = createXmlParser();
1379
- const doc = parser.parseFromString(_chunk4JLD2IT7cjs.stripDtd.call(void 0, xml), "text/xml");
1396
+ const doc = parser.parseFromString(_chunkG44XLS26cjs.stripDtd.call(void 0, xml), "text/xml");
1380
1397
  const items = doc.getElementsByTagName("opf:item");
1381
1398
  const spine = doc.getElementsByTagName("opf:itemref");
1382
- const isSectionId = (id) => /^s/i.test(id) || id.toLowerCase().includes("section");
1383
1399
  const idToHref = /* @__PURE__ */ new Map();
1384
1400
  for (let i = 0; i < items.length; i++) {
1385
1401
  const item = items[i];
1386
1402
  const id = item.getAttribute("id") || "";
1387
- let href = item.getAttribute("href") || "";
1388
- const mediaType = item.getAttribute("media-type") || "";
1389
- if (!isSectionId(id) && !mediaType.includes("xml")) continue;
1390
- if (!href.startsWith("/") && !href.startsWith("Contents/") && isSectionId(id))
1391
- href = "Contents/" + href;
1392
- idToHref.set(id, href);
1403
+ const href = _chunkG44XLS26cjs.normalizeSectionHref.call(void 0, item.getAttribute("href") || "");
1404
+ if (id && href) idToHref.set(id, href);
1393
1405
  }
1394
1406
  if (spine.length > 0) {
1395
1407
  const ordered = [];
@@ -1399,7 +1411,7 @@ function parseSectionPathsFromManifest(xml) {
1399
1411
  }
1400
1412
  if (ordered.length > 0) return ordered;
1401
1413
  }
1402
- return Array.from(idToHref.entries()).filter(([id]) => isSectionId(id)).sort((a, b) => a[0].localeCompare(b[0])).map(([, href]) => href);
1414
+ return Array.from(idToHref.values()).sort(_chunkG44XLS26cjs.compareSectionPaths);
1403
1415
  }
1404
1416
  function detectHwpxHeadings(blocks, styleMap) {
1405
1417
  if (blocks.some((b) => b.type === "heading")) return;
@@ -1424,9 +1436,9 @@ function detectHwpxHeadings(blocks, styleMap) {
1424
1436
  let level = 0;
1425
1437
  if (baseFontSize > 0 && _optionalChain([block, 'access', _25 => _25.style, 'optionalAccess', _26 => _26.fontSize])) {
1426
1438
  const ratio = block.style.fontSize / baseFontSize;
1427
- if (ratio >= _chunk4JLD2IT7cjs.HEADING_RATIO_H1) level = 1;
1428
- else if (ratio >= _chunk4JLD2IT7cjs.HEADING_RATIO_H2) level = 2;
1429
- else if (ratio >= _chunk4JLD2IT7cjs.HEADING_RATIO_H3) level = 3;
1439
+ if (ratio >= _chunkG44XLS26cjs.HEADING_RATIO_H1) level = 1;
1440
+ else if (ratio >= _chunkG44XLS26cjs.HEADING_RATIO_H2) level = 2;
1441
+ else if (ratio >= _chunkG44XLS26cjs.HEADING_RATIO_H3) level = 3;
1430
1442
  }
1431
1443
  const compactText = text.replace(/\s+/g, "");
1432
1444
  if (/^제\d+[조장절편]/.test(compactText) && text.length <= 50) {
@@ -1439,7 +1451,7 @@ function detectHwpxHeadings(blocks, styleMap) {
1439
1451
  }
1440
1452
  }
1441
1453
  function buildTableWithCellMeta(state) {
1442
- const table = _chunk4JLD2IT7cjs.buildTable.call(void 0, state.rows);
1454
+ const table = _chunkG44XLS26cjs.buildTable.call(void 0, state.rows);
1443
1455
  if (state.caption) table.caption = state.caption;
1444
1456
  const claimed = /* @__PURE__ */ new Set();
1445
1457
  for (const row of state.rows) {
@@ -1482,7 +1494,7 @@ function completeTable(newTable, tableStack, blocks, ctx) {
1482
1494
  const cell = parentTable.cell;
1483
1495
  (cell.blocks ??= []).push(block);
1484
1496
  cell.hasStructure = true;
1485
- let flat = _chunk4JLD2IT7cjs.convertTableToText.call(void 0, newTable.rows);
1497
+ let flat = _chunkG44XLS26cjs.convertTableToText.call(void 0, newTable.rows);
1486
1498
  if (newTable.caption) flat = newTable.caption + (flat ? "\n" + flat : "");
1487
1499
  if (flat) cell.text += (cell.text ? "\n" : "") + flat;
1488
1500
  } else {
@@ -1492,7 +1504,7 @@ function completeTable(newTable, tableStack, blocks, ctx) {
1492
1504
  }
1493
1505
  function parseSectionXml(xml, styleMap, warnings, sectionNum, shared) {
1494
1506
  const parser = createXmlParser(warnings);
1495
- const doc = parser.parseFromString(_chunk4JLD2IT7cjs.stripDtd.call(void 0, xml), "text/xml");
1507
+ const doc = parser.parseFromString(_chunkG44XLS26cjs.stripDtd.call(void 0, xml), "text/xml");
1496
1508
  if (!doc.documentElement) return [];
1497
1509
  const ctx = { styleMap, warnings, sectionNum, shared: _nullishCoalesce(shared, () => ( createSectionShared())) };
1498
1510
  ctx.shared.track.deleteDepth = 0;
@@ -1583,8 +1595,8 @@ function walkSection(node, blocks, tableCtx, tableStack, ctx, depth = 0) {
1583
1595
  const cs = isNaN(rawCs) ? 1 : rawCs;
1584
1596
  const rawRs = parseInt(el.getAttribute("rowSpan") || "1", 10);
1585
1597
  const rs = isNaN(rawRs) ? 1 : rawRs;
1586
- tableCtx.cell.colSpan = clampSpan(cs, _chunk4JLD2IT7cjs.MAX_COLS);
1587
- tableCtx.cell.rowSpan = clampSpan(rs, _chunk4JLD2IT7cjs.MAX_ROWS);
1598
+ tableCtx.cell.colSpan = clampSpan(cs, _chunkG44XLS26cjs.MAX_COLS);
1599
+ tableCtx.cell.rowSpan = clampSpan(rs, _chunkG44XLS26cjs.MAX_ROWS);
1588
1600
  }
1589
1601
  break;
1590
1602
  case "p": {
@@ -1806,7 +1818,7 @@ function extractHyperlinkHref(fieldBegin) {
1806
1818
  let url = (ch.textContent || "").trim();
1807
1819
  if (!url) continue;
1808
1820
  url = url.replace(/^https?:\/\/(?=https?:\/\/)/i, "");
1809
- const safe = _chunk4JLD2IT7cjs.sanitizeHref.call(void 0, url);
1821
+ const safe = _chunkG44XLS26cjs.sanitizeHref.call(void 0, url);
1810
1822
  if (safe) return safe;
1811
1823
  }
1812
1824
  return void 0;
@@ -1941,7 +1953,7 @@ function extractParagraphInfo(para, styleMap, ctx) {
1941
1953
  case "hyperlink": {
1942
1954
  const url = child.getAttribute("url") || child.getAttribute("href") || "";
1943
1955
  if (url) {
1944
- const safe = _chunk4JLD2IT7cjs.sanitizeHref.call(void 0, url);
1956
+ const safe = _chunkG44XLS26cjs.sanitizeHref.call(void 0, url);
1945
1957
  if (safe) href = safe;
1946
1958
  }
1947
1959
  walk(child);
@@ -2006,7 +2018,7 @@ function extractParagraphInfo(para, styleMap, ctx) {
2006
2018
  try {
2007
2019
  const latex = hmlToLatex(raw).trim();
2008
2020
  if (latex) text += " $" + latex + "$ ";
2009
- } catch (e14) {
2021
+ } catch (e15) {
2010
2022
  }
2011
2023
  }
2012
2024
  break;
@@ -2125,13 +2137,13 @@ function decompressStream(data) {
2125
2137
  if (data.length >= 2 && data[0] === 120) {
2126
2138
  try {
2127
2139
  return _zlib.inflateSync.call(void 0, data, opts);
2128
- } catch (e15) {
2140
+ } catch (e16) {
2129
2141
  }
2130
2142
  }
2131
2143
  return _zlib.inflateRawSync.call(void 0, data, opts);
2132
2144
  }
2133
2145
  function parseFileHeader(data) {
2134
- if (data.length < 40) throw new (0, _chunk4JLD2IT7cjs.KordocError)("FileHeader\uAC00 \uB108\uBB34 \uC9E7\uC2B5\uB2C8\uB2E4 (\uCD5C\uC18C 40\uBC14\uC774\uD2B8)");
2146
+ if (data.length < 40) throw new (0, _chunkG44XLS26cjs.KordocError)("FileHeader\uAC00 \uB108\uBB34 \uC9E7\uC2B5\uB2C8\uB2E4 (\uCD5C\uC18C 40\uBC14\uC774\uD2B8)");
2135
2147
  const sig = data.subarray(0, 32).toString("utf8").replace(/\0+$/, "");
2136
2148
  return {
2137
2149
  signature: sig,
@@ -2245,7 +2257,7 @@ function parseDocInfo(records) {
2245
2257
  offset += 2;
2246
2258
  const charShapeId = offset + 2 <= rec.data.length ? rec.data.readUInt16LE(offset) : 0;
2247
2259
  styles.push({ name, nameKo, charShapeId, paraShapeId, type });
2248
- } catch (e16) {
2260
+ } catch (e17) {
2249
2261
  }
2250
2262
  }
2251
2263
  }
@@ -2545,7 +2557,7 @@ function normalizeBinPayload(data) {
2545
2557
  try {
2546
2558
  const inflated = decompressStream(data);
2547
2559
  if (inflated.length > 0) return inflated;
2548
- } catch (e17) {
2560
+ } catch (e18) {
2549
2561
  }
2550
2562
  return data;
2551
2563
  }
@@ -3354,7 +3366,7 @@ function decryptViewText(viewTextRaw, compressed) {
3354
3366
  if (compressed) {
3355
3367
  try {
3356
3368
  return decompressStream(Buffer.from(decrypted));
3357
- } catch (e18) {
3369
+ } catch (e19) {
3358
3370
  return Buffer.from(decrypted);
3359
3371
  }
3360
3372
  }
@@ -3650,12 +3662,12 @@ function parseHwp5Document(buffer, options) {
3650
3662
  const warnings = [];
3651
3663
  try {
3652
3664
  cfb = CFB.parse(buffer);
3653
- } catch (e19) {
3665
+ } catch (e20) {
3654
3666
  try {
3655
3667
  lenientCfb = parseLenientCfb(buffer);
3656
3668
  warnings.push({ message: "\uC190\uC0C1\uB41C CFB \uCEE8\uD14C\uC774\uB108 \u2014 lenient \uBAA8\uB4DC\uB85C \uBCF5\uAD6C", code: "LENIENT_CFB_RECOVERY" });
3657
- } catch (e20) {
3658
- throw new (0, _chunk4JLD2IT7cjs.KordocError)("CFB \uCEE8\uD14C\uC774\uB108 \uD30C\uC2F1 \uC2E4\uD328 (strict \uBC0F lenient \uBAA8\uB450)");
3669
+ } catch (e21) {
3670
+ throw new (0, _chunkG44XLS26cjs.KordocError)("CFB \uCEE8\uD14C\uC774\uB108 \uD30C\uC2F1 \uC2E4\uD328 (strict \uBC0F lenient \uBAA8\uB450)");
3659
3671
  }
3660
3672
  }
3661
3673
  const findStream = (path) => {
@@ -3666,11 +3678,11 @@ function parseHwp5Document(buffer, options) {
3666
3678
  return lenientCfb.findStream(path);
3667
3679
  };
3668
3680
  const headerData = findStream("/FileHeader");
3669
- if (!headerData) throw new (0, _chunk4JLD2IT7cjs.KordocError)("FileHeader \uC2A4\uD2B8\uB9BC \uC5C6\uC74C");
3681
+ if (!headerData) throw new (0, _chunkG44XLS26cjs.KordocError)("FileHeader \uC2A4\uD2B8\uB9BC \uC5C6\uC74C");
3670
3682
  const header = parseFileHeader(headerData);
3671
- if (header.signature !== "HWP Document File") throw new (0, _chunk4JLD2IT7cjs.KordocError)("HWP \uC2DC\uADF8\uB2C8\uCC98 \uBD88\uC77C\uCE58");
3672
- if (header.flags & FLAG_ENCRYPTED) throw new (0, _chunk4JLD2IT7cjs.KordocError)("\uC554\uD638\uD654\uB41C HWP\uB294 \uC9C0\uC6D0\uD558\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4");
3673
- if (header.flags & FLAG_DRM) throw new (0, _chunk4JLD2IT7cjs.KordocError)("DRM \uBCF4\uD638\uB41C HWP\uB294 \uC9C0\uC6D0\uD558\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4");
3683
+ if (header.signature !== "HWP Document File") throw new (0, _chunkG44XLS26cjs.KordocError)("HWP \uC2DC\uADF8\uB2C8\uCC98 \uBD88\uC77C\uCE58");
3684
+ if (header.flags & FLAG_ENCRYPTED) throw new (0, _chunkG44XLS26cjs.KordocError)("\uC554\uD638\uD654\uB41C HWP\uB294 \uC9C0\uC6D0\uD558\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4");
3685
+ if (header.flags & FLAG_DRM) throw new (0, _chunkG44XLS26cjs.KordocError)("DRM \uBCF4\uD638\uB41C HWP\uB294 \uC9C0\uC6D0\uD558\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4");
3674
3686
  const compressed = (header.flags & FLAG_COMPRESSED) !== 0;
3675
3687
  const distribution = (header.flags & FLAG_DISTRIBUTION) !== 0;
3676
3688
  const metadata = {
@@ -3679,9 +3691,9 @@ function parseHwp5Document(buffer, options) {
3679
3691
  if (cfb) extractHwp5Metadata(cfb, metadata);
3680
3692
  const docInfo = cfb ? parseDocInfoStream(cfb, compressed) : parseDocInfoFromStream(findStream("/DocInfo"), compressed);
3681
3693
  const sections = distribution ? cfb ? findViewTextSections(cfb, compressed) : findViewTextSectionsLenient(lenientCfb, compressed) : cfb ? findSections(cfb) : findSectionsLenient(lenientCfb, compressed);
3682
- if (sections.length === 0) throw new (0, _chunk4JLD2IT7cjs.KordocError)("\uC139\uC158 \uC2A4\uD2B8\uB9BC\uC744 \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4");
3694
+ if (sections.length === 0) throw new (0, _chunkG44XLS26cjs.KordocError)("\uC139\uC158 \uC2A4\uD2B8\uB9BC\uC744 \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4");
3683
3695
  metadata.pageCount = sections.length;
3684
- const pageFilter = _optionalChain([options, 'optionalAccess', _51 => _51.pages]) ? _chunkX34YWRL5cjs.parsePageRange.call(void 0, options.pages, sections.length) : null;
3696
+ const pageFilter = _optionalChain([options, 'optionalAccess', _51 => _51.pages]) ? _chunkDCZVOIEOcjs.parsePageRange.call(void 0, options.pages, sections.length) : null;
3685
3697
  const totalTarget = pageFilter ? pageFilter.size : sections.length;
3686
3698
  const bodyBlocks = [];
3687
3699
  const doc = createHwp5DocState();
@@ -3693,25 +3705,25 @@ function parseHwp5Document(buffer, options) {
3693
3705
  const sectionData = sections[si];
3694
3706
  const data = !distribution && compressed ? decompressStream(Buffer.from(sectionData)) : Buffer.from(sectionData);
3695
3707
  totalDecompressed += data.length;
3696
- if (totalDecompressed > MAX_TOTAL_DECOMPRESS) throw new (0, _chunk4JLD2IT7cjs.KordocError)("\uCD1D \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (decompression bomb \uC758\uC2EC)");
3708
+ if (totalDecompressed > MAX_TOTAL_DECOMPRESS) throw new (0, _chunkG44XLS26cjs.KordocError)("\uCD1D \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (decompression bomb \uC758\uC2EC)");
3697
3709
  const records = readRecords(data);
3698
3710
  const sectionBlocks = parseSection(records, docInfo, warnings, si + 1, doc);
3699
3711
  bodyBlocks.push(...sectionBlocks);
3700
3712
  parsedSections++;
3701
3713
  _optionalChain([options, 'optionalAccess', _52 => _52.onProgress, 'optionalCall', _53 => _53(parsedSections, totalTarget)]);
3702
3714
  } catch (secErr) {
3703
- if (secErr instanceof _chunk4JLD2IT7cjs.KordocError) throw secErr;
3715
+ if (secErr instanceof _chunkG44XLS26cjs.KordocError) throw secErr;
3704
3716
  warnings.push({ page: si + 1, message: `\uC139\uC158 ${si + 1} \uD30C\uC2F1 \uC2E4\uD328: ${secErr instanceof Error ? secErr.message : "\uC54C \uC218 \uC5C6\uB294 \uC624\uB958"}`, code: "PARTIAL_PARSE" });
3705
3717
  }
3706
3718
  }
3707
3719
  const blocks = [...doc.headerBlocks, ...bodyBlocks, ...doc.footerBlocks];
3708
3720
  const images = cfb ? extractHwp5Images(cfb.FileIndex, blocks, warnings) : extractHwp5ImagesLenient(lenientCfb, blocks, warnings);
3709
- const flatBlocks = _chunk4JLD2IT7cjs.flattenLayoutTables.call(void 0, blocks);
3721
+ const flatBlocks = _chunkG44XLS26cjs.flattenLayoutTables.call(void 0, blocks);
3710
3722
  if (docInfo) {
3711
3723
  detectHwp5Headings(flatBlocks, docInfo);
3712
3724
  }
3713
3725
  const outline = flatBlocks.filter((b) => b.type === "heading" && b.level && b.text).map((b) => ({ level: b.level, text: b.text, pageNumber: b.pageNumber }));
3714
- const markdown = _chunk4JLD2IT7cjs.blocksToMarkdown.call(void 0, flatBlocks);
3726
+ const markdown = _chunkG44XLS26cjs.blocksToMarkdown.call(void 0, flatBlocks);
3715
3727
  return { markdown, blocks: flatBlocks, metadata, outline: outline.length > 0 ? outline : void 0, warnings: warnings.length > 0 ? warnings : void 0, images: images.length > 0 ? images : void 0 };
3716
3728
  }
3717
3729
  function parseDocInfoStream(cfb, compressed) {
@@ -3721,7 +3733,7 @@ function parseDocInfoStream(cfb, compressed) {
3721
3733
  const data = compressed ? decompressStream(Buffer.from(entry.content)) : Buffer.from(entry.content);
3722
3734
  const records = readRecords(data);
3723
3735
  return parseDocInfo(records);
3724
- } catch (e21) {
3736
+ } catch (e22) {
3725
3737
  return null;
3726
3738
  }
3727
3739
  }
@@ -3730,7 +3742,7 @@ function parseDocInfoFromStream(raw, compressed) {
3730
3742
  try {
3731
3743
  const data = compressed ? decompressStream(raw) : raw;
3732
3744
  return parseDocInfo(readRecords(data));
3733
- } catch (e22) {
3745
+ } catch (e23) {
3734
3746
  return null;
3735
3747
  }
3736
3748
  }
@@ -3771,9 +3783,9 @@ function detectHwp5Headings(blocks, docInfo) {
3771
3783
  let level = 0;
3772
3784
  if (_optionalChain([block, 'access', _58 => _58.style, 'optionalAccess', _59 => _59.fontSize]) && baseFontSize > 0) {
3773
3785
  const ratio = block.style.fontSize / baseFontSize;
3774
- if (ratio >= _chunk4JLD2IT7cjs.HEADING_RATIO_H1) level = 1;
3775
- else if (ratio >= _chunk4JLD2IT7cjs.HEADING_RATIO_H2) level = 2;
3776
- else if (ratio >= _chunk4JLD2IT7cjs.HEADING_RATIO_H3) level = 3;
3786
+ if (ratio >= _chunkG44XLS26cjs.HEADING_RATIO_H1) level = 1;
3787
+ else if (ratio >= _chunkG44XLS26cjs.HEADING_RATIO_H2) level = 2;
3788
+ else if (ratio >= _chunkG44XLS26cjs.HEADING_RATIO_H3) level = 3;
3777
3789
  }
3778
3790
  if (/^제\d+[장절편]\s/.test(text) && text.length <= 50) {
3779
3791
  if (level === 0) level = 2;
@@ -3815,7 +3827,7 @@ function extractHwp5Metadata(cfb, metadata) {
3815
3827
  else if (propId === 4) metadata.author = str;
3816
3828
  else if (propId === 6) metadata.description = str;
3817
3829
  }
3818
- } catch (e23) {
3830
+ } catch (e24) {
3819
3831
  }
3820
3832
  }
3821
3833
  function findViewTextSections(cfb, compressed) {
@@ -3826,7 +3838,7 @@ function findViewTextSections(cfb, compressed) {
3826
3838
  try {
3827
3839
  const decrypted = decryptViewText(Buffer.from(entry.content), compressed);
3828
3840
  sections.push({ idx: i, content: decrypted });
3829
- } catch (e24) {
3841
+ } catch (e25) {
3830
3842
  break;
3831
3843
  }
3832
3844
  }
@@ -3858,7 +3870,7 @@ function findSectionsLenient(lcfb, compressed) {
3858
3870
  if (!raw) break;
3859
3871
  const content = compressed ? decompressStream(raw) : raw;
3860
3872
  totalDecompressed += content.length;
3861
- if (totalDecompressed > MAX_TOTAL_DECOMPRESS) throw new (0, _chunk4JLD2IT7cjs.KordocError)("\uCD1D \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (decompression bomb \uC758\uC2EC)");
3873
+ if (totalDecompressed > MAX_TOTAL_DECOMPRESS) throw new (0, _chunkG44XLS26cjs.KordocError)("\uCD1D \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (decompression bomb \uC758\uC2EC)");
3862
3874
  sections.push({ idx: i, content });
3863
3875
  }
3864
3876
  if (sections.length === 0) {
@@ -3870,7 +3882,7 @@ function findSectionsLenient(lcfb, compressed) {
3870
3882
  if (raw) {
3871
3883
  const content = compressed ? decompressStream(raw) : raw;
3872
3884
  totalDecompressed += content.length;
3873
- if (totalDecompressed > MAX_TOTAL_DECOMPRESS) throw new (0, _chunk4JLD2IT7cjs.KordocError)("\uCD1D \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (decompression bomb \uC758\uC2EC)");
3885
+ if (totalDecompressed > MAX_TOTAL_DECOMPRESS) throw new (0, _chunkG44XLS26cjs.KordocError)("\uCD1D \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (decompression bomb \uC758\uC2EC)");
3874
3886
  sections.push({ idx, content });
3875
3887
  }
3876
3888
  }
@@ -3887,9 +3899,9 @@ function findViewTextSectionsLenient(lcfb, compressed) {
3887
3899
  try {
3888
3900
  const content = decryptViewText(raw, compressed);
3889
3901
  totalDecompressed += content.length;
3890
- if (totalDecompressed > MAX_TOTAL_DECOMPRESS) throw new (0, _chunk4JLD2IT7cjs.KordocError)("\uCD1D \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (decompression bomb \uC758\uC2EC)");
3902
+ if (totalDecompressed > MAX_TOTAL_DECOMPRESS) throw new (0, _chunkG44XLS26cjs.KordocError)("\uCD1D \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (decompression bomb \uC758\uC2EC)");
3891
3903
  sections.push({ idx: i, content });
3892
- } catch (e25) {
3904
+ } catch (e26) {
3893
3905
  break;
3894
3906
  }
3895
3907
  }
@@ -3990,7 +4002,7 @@ function parseParagraph(records, start, end, ctx) {
3990
4002
  const ctrl = ctrls[r.ctrlIdx];
3991
4003
  if (!_optionalChain([ctrl, 'optionalAccess', _66 => _66.href]) || r.end <= r.start) continue;
3992
4004
  if (applied.some(([s, e]) => r.start < e && r.end > s)) continue;
3993
- const href = _chunk4JLD2IT7cjs.sanitizeHref.call(void 0, ctrl.href);
4005
+ const href = _chunkG44XLS26cjs.sanitizeHref.call(void 0, ctrl.href);
3994
4006
  if (!href) continue;
3995
4007
  const anchor = text.slice(r.start, r.end);
3996
4008
  if (!anchor.trim()) continue;
@@ -4223,8 +4235,8 @@ function parseTableControl(ctrl, records, ctx) {
4223
4235
  let tableIdx = -1;
4224
4236
  for (let i2 = childStart; i2 < childEnd; i2++) {
4225
4237
  if (records[i2].tagId === TAG_TABLE && records[i2].data.length >= 8) {
4226
- rows = Math.min(records[i2].data.readUInt16LE(4), _chunk4JLD2IT7cjs.MAX_ROWS);
4227
- cols = Math.min(records[i2].data.readUInt16LE(6), _chunk4JLD2IT7cjs.MAX_COLS);
4238
+ rows = Math.min(records[i2].data.readUInt16LE(4), _chunkG44XLS26cjs.MAX_ROWS);
4239
+ cols = Math.min(records[i2].data.readUInt16LE(6), _chunkG44XLS26cjs.MAX_COLS);
4228
4240
  tableIdx = i2;
4229
4241
  break;
4230
4242
  }
@@ -4273,7 +4285,7 @@ function parseTableControl(ctrl, records, ctx) {
4273
4285
  return table2;
4274
4286
  }
4275
4287
  const cellRows = arrangeCells(rows, cols, cells);
4276
- const table = _chunk4JLD2IT7cjs.buildTable.call(void 0, cellRows);
4288
+ const table = _chunkG44XLS26cjs.buildTable.call(void 0, cellRows);
4277
4289
  if (caption && table.rows > 0) table.caption = caption;
4278
4290
  return table.rows > 0 ? table : null;
4279
4291
  }
@@ -4290,8 +4302,8 @@ function parseCell(records, lhIdx, end, ctx) {
4290
4302
  rowAddr = rec.data.readUInt16LE(10);
4291
4303
  const cs = rec.data.readUInt16LE(12);
4292
4304
  const rs = rec.data.readUInt16LE(14);
4293
- if (cs > 0) colSpan = Math.min(cs, _chunk4JLD2IT7cjs.MAX_COLS);
4294
- if (rs > 0) rowSpan = Math.min(rs, _chunk4JLD2IT7cjs.MAX_ROWS);
4305
+ if (cs > 0) colSpan = Math.min(cs, _chunkG44XLS26cjs.MAX_COLS);
4306
+ if (rs > 0) rowSpan = Math.min(rs, _chunkG44XLS26cjs.MAX_ROWS);
4295
4307
  }
4296
4308
  const blocks = ctx.depth < MAX_NEST_DEPTH ? parseParagraphList(records, lhIdx + 1, end, { ...ctx, depth: ctx.depth + 1 }) : [];
4297
4309
  const parts = [];
@@ -4301,7 +4313,7 @@ function parseCell(records, lhIdx, end, ctx) {
4301
4313
  parts.push(`![image](hwp5bin:${b.text})`);
4302
4314
  hasStructure = true;
4303
4315
  } else if (b.type === "table" && b.table) {
4304
- const flat = _chunk4JLD2IT7cjs.convertTableToText.call(void 0, b.table.cells);
4316
+ const flat = _chunkG44XLS26cjs.convertTableToText.call(void 0, b.table.cells);
4305
4317
  if (flat) parts.push(flat);
4306
4318
  hasStructure = true;
4307
4319
  } else if (b.text) {
@@ -16735,7 +16747,7 @@ function getTextContent(el) {
16735
16747
  return _nullishCoalesce(_optionalChain([el, 'access', _79 => _79.textContent, 'optionalAccess', _80 => _80.trim, 'call', _81 => _81()]), () => ( ""));
16736
16748
  }
16737
16749
  function parseXml(text) {
16738
- return new (0, _xmldom.DOMParser)().parseFromString(_chunk4JLD2IT7cjs.stripDtd.call(void 0, text), "text/xml");
16750
+ return new (0, _xmldom.DOMParser)().parseFromString(_chunkG44XLS26cjs.stripDtd.call(void 0, text), "text/xml");
16739
16751
  }
16740
16752
  function parseSharedStrings(xml) {
16741
16753
  const doc = parseXml(xml);
@@ -16879,7 +16891,7 @@ function sheetToBlocks(sheetName, grid, merges, maxRow, maxCol, sheetIndex) {
16879
16891
  cellRows.push(row);
16880
16892
  }
16881
16893
  if (cellRows.length > 0) {
16882
- const table = _chunk4JLD2IT7cjs.buildTable.call(void 0, cellRows);
16894
+ const table = _chunkG44XLS26cjs.buildTable.call(void 0, cellRows);
16883
16895
  if (table.rows > 0) {
16884
16896
  blocks.push({ type: "table", table, pageNumber: sheetIndex + 1 });
16885
16897
  }
@@ -16887,12 +16899,12 @@ function sheetToBlocks(sheetName, grid, merges, maxRow, maxCol, sheetIndex) {
16887
16899
  return blocks;
16888
16900
  }
16889
16901
  async function parseXlsxDocument(buffer, options) {
16890
- _chunk4JLD2IT7cjs.precheckZipSize.call(void 0, buffer, MAX_DECOMPRESS_SIZE3);
16902
+ _chunkG44XLS26cjs.precheckZipSize.call(void 0, buffer, MAX_DECOMPRESS_SIZE3);
16891
16903
  const zip = await _jszip2.default.loadAsync(buffer);
16892
16904
  const warnings = [];
16893
16905
  const workbookFile = zip.file("xl/workbook.xml");
16894
16906
  if (!workbookFile) {
16895
- throw new (0, _chunk4JLD2IT7cjs.KordocError)("\uC720\uD6A8\uD558\uC9C0 \uC54A\uC740 XLSX \uD30C\uC77C: xl/workbook.xml\uC774 \uC5C6\uC2B5\uB2C8\uB2E4");
16907
+ throw new (0, _chunkG44XLS26cjs.KordocError)("\uC720\uD6A8\uD558\uC9C0 \uC54A\uC740 XLSX \uD30C\uC77C: xl/workbook.xml\uC774 \uC5C6\uC2B5\uB2C8\uB2E4");
16896
16908
  }
16897
16909
  let sharedStrings = [];
16898
16910
  const ssFile = zip.file("xl/sharedStrings.xml");
@@ -16901,7 +16913,7 @@ async function parseXlsxDocument(buffer, options) {
16901
16913
  }
16902
16914
  const sheets = parseWorkbook(await workbookFile.async("text"));
16903
16915
  if (sheets.length === 0) {
16904
- throw new (0, _chunk4JLD2IT7cjs.KordocError)("XLSX \uD30C\uC77C\uC5D0 \uC2DC\uD2B8\uAC00 \uC5C6\uC2B5\uB2C8\uB2E4");
16916
+ throw new (0, _chunkG44XLS26cjs.KordocError)("XLSX \uD30C\uC77C\uC5D0 \uC2DC\uD2B8\uAC00 \uC5C6\uC2B5\uB2C8\uB2E4");
16905
16917
  }
16906
16918
  let relsMap = /* @__PURE__ */ new Map();
16907
16919
  const relsFile = zip.file("xl/_rels/workbook.xml.rels");
@@ -16910,7 +16922,7 @@ async function parseXlsxDocument(buffer, options) {
16910
16922
  }
16911
16923
  let pageFilter = null;
16912
16924
  if (_optionalChain([options, 'optionalAccess', _84 => _84.pages])) {
16913
- const { parsePageRange: parsePageRange2 } = await Promise.resolve().then(() => _interopRequireWildcard(require("./page-range-TPIRSA3J.cjs")));
16925
+ const { parsePageRange: parsePageRange2 } = await Promise.resolve().then(() => _interopRequireWildcard(require("./page-range-P7SDW6LR.cjs")));
16914
16926
  pageFilter = parsePageRange2(options.pages, sheets.length);
16915
16927
  }
16916
16928
  const blocks = [];
@@ -16970,10 +16982,10 @@ async function parseXlsxDocument(buffer, options) {
16970
16982
  if (created) metadata.createdAt = created;
16971
16983
  const modified = getFirst("dcterms:modified");
16972
16984
  if (modified) metadata.modifiedAt = modified;
16973
- } catch (e26) {
16985
+ } catch (e27) {
16974
16986
  }
16975
16987
  }
16976
- const markdown = _chunk4JLD2IT7cjs.blocksToMarkdown.call(void 0, blocks);
16988
+ const markdown = _chunkG44XLS26cjs.blocksToMarkdown.call(void 0, blocks);
16977
16989
  return { markdown, blocks, metadata, warnings: warnings.length > 0 ? warnings : void 0 };
16978
16990
  }
16979
16991
 
@@ -17380,11 +17392,11 @@ function processGlobals(records) {
17380
17392
  let encrypted = false;
17381
17393
  const firstBof = records[0];
17382
17394
  if (!firstBof || firstBof.opcode !== OP_BOF) {
17383
- throw new (0, _chunk4JLD2IT7cjs.KordocError)("XLS: \uCCAB \uB808\uCF54\uB4DC\uAC00 BOF\uAC00 \uC544\uB2D8");
17395
+ throw new (0, _chunkG44XLS26cjs.KordocError)("XLS: \uCCAB \uB808\uCF54\uB4DC\uAC00 BOF\uAC00 \uC544\uB2D8");
17384
17396
  }
17385
17397
  const bof = decodeBof(firstBof.data);
17386
17398
  if (!bof || bof.dt !== DT_GLOBALS) {
17387
- throw new (0, _chunk4JLD2IT7cjs.KordocError)("XLS: Globals \uC11C\uBE0C\uC2A4\uD2B8\uB9BC BOF \uB204\uB77D");
17399
+ throw new (0, _chunkG44XLS26cjs.KordocError)("XLS: Globals \uC11C\uBE0C\uC2A4\uD2B8\uB9BC BOF \uB204\uB77D");
17388
17400
  }
17389
17401
  let i = 1;
17390
17402
  while (i < records.length) {
@@ -17499,7 +17511,7 @@ function sheetToBlocks2(sheetName, sheet, sheetIndex) {
17499
17511
  cellRows.push(row);
17500
17512
  }
17501
17513
  if (cellRows.length > 0) {
17502
- const table = _chunk4JLD2IT7cjs.buildTable.call(void 0, cellRows);
17514
+ const table = _chunkG44XLS26cjs.buildTable.call(void 0, cellRows);
17503
17515
  if (table.rows > 0) {
17504
17516
  blocks.push({ type: "table", table, pageNumber: sheetIndex + 1 });
17505
17517
  }
@@ -17512,21 +17524,21 @@ async function parseXlsDocument(buffer, options) {
17512
17524
  try {
17513
17525
  cfb = parseLenientCfb(buf);
17514
17526
  } catch (e) {
17515
- throw new (0, _chunk4JLD2IT7cjs.KordocError)(
17527
+ throw new (0, _chunkG44XLS26cjs.KordocError)(
17516
17528
  `XLS: OLE2 \uC2DC\uADF8\uB2C8\uCC98 \uAC80\uC99D \uC2E4\uD328 \u2014 ${e instanceof Error ? e.message : "\uC54C \uC218 \uC5C6\uB294 \uC624\uB958"}`
17517
17529
  );
17518
17530
  }
17519
17531
  const wb = _nullishCoalesce(cfb.findStream("/Workbook"), () => ( cfb.findStream("/Book")));
17520
17532
  if (!wb) {
17521
- throw new (0, _chunk4JLD2IT7cjs.KordocError)("XLS: Workbook \uC2A4\uD2B8\uB9BC\uC774 \uC5C6\uC74C (BIFF5 \uB610\uB294 \uBE44\uD45C\uC900 \uD30C\uC77C)");
17533
+ throw new (0, _chunkG44XLS26cjs.KordocError)("XLS: Workbook \uC2A4\uD2B8\uB9BC\uC774 \uC5C6\uC74C (BIFF5 \uB610\uB294 \uBE44\uD45C\uC900 \uD30C\uC77C)");
17522
17534
  }
17523
17535
  const records = readRecords2(wb);
17524
17536
  if (records.length === 0) {
17525
- throw new (0, _chunk4JLD2IT7cjs.KordocError)("XLS: \uC2DC\uADF8\uB2C8\uCC98 \uB808\uCF54\uB4DC\uAC00 \uC5C6\uC74C (Workbook \uC2A4\uD2B8\uB9BC \uC190\uC0C1)");
17537
+ throw new (0, _chunkG44XLS26cjs.KordocError)("XLS: \uC2DC\uADF8\uB2C8\uCC98 \uB808\uCF54\uB4DC\uAC00 \uC5C6\uC74C (Workbook \uC2A4\uD2B8\uB9BC \uC190\uC0C1)");
17526
17538
  }
17527
17539
  const firstBof = decodeBof(records[0].data);
17528
17540
  if (firstBof && firstBof.vers !== 1536) {
17529
- throw new (0, _chunk4JLD2IT7cjs.KordocError)(
17541
+ throw new (0, _chunkG44XLS26cjs.KordocError)(
17530
17542
  `XLS: BIFF8(0x0600)\uB9CC \uC9C0\uC6D0 \u2014 \uBCF8 \uD30C\uC77C\uC740 0x${firstBof.vers.toString(16)}`
17531
17543
  );
17532
17544
  }
@@ -17548,7 +17560,7 @@ async function parseXlsDocument(buffer, options) {
17548
17560
  const totalSheets = Math.min(globals.sheets.length, MAX_SHEETS2);
17549
17561
  let pageFilter = null;
17550
17562
  if (_optionalChain([options, 'optionalAccess', _89 => _89.pages])) {
17551
- const { parsePageRange: parsePageRange2 } = await Promise.resolve().then(() => _interopRequireWildcard(require("./page-range-TPIRSA3J.cjs")));
17563
+ const { parsePageRange: parsePageRange2 } = await Promise.resolve().then(() => _interopRequireWildcard(require("./page-range-P7SDW6LR.cjs")));
17552
17564
  pageFilter = parsePageRange2(options.pages, totalSheets);
17553
17565
  }
17554
17566
  const allBlocks = [];
@@ -17586,7 +17598,7 @@ async function parseXlsDocument(buffer, options) {
17586
17598
  pageCount: totalSheets
17587
17599
  };
17588
17600
  return {
17589
- markdown: _chunk4JLD2IT7cjs.blocksToMarkdown.call(void 0, allBlocks),
17601
+ markdown: _chunkG44XLS26cjs.blocksToMarkdown.call(void 0, allBlocks),
17590
17602
  blocks: allBlocks,
17591
17603
  metadata,
17592
17604
  warnings: warnings.length > 0 ? warnings : void 0
@@ -18024,7 +18036,7 @@ function getAttr(el, localName2) {
18024
18036
  return null;
18025
18037
  }
18026
18038
  function parseXml2(text) {
18027
- return new (0, _xmldom.DOMParser)().parseFromString(_chunk4JLD2IT7cjs.stripDtd.call(void 0, text), "text/xml");
18039
+ return new (0, _xmldom.DOMParser)().parseFromString(_chunkG44XLS26cjs.stripDtd.call(void 0, text), "text/xml");
18028
18040
  }
18029
18041
  function parseStyles(xml) {
18030
18042
  const doc = parseXml2(xml);
@@ -18336,19 +18348,19 @@ async function extractImages(zip, rels, doc) {
18336
18348
  const filename = `image_${String(imgIdx).padStart(3, "0")}.${ext}`;
18337
18349
  images.push({ filename, data, mimeType: _nullishCoalesce(mimeMap[ext], () => ( "image/png")) });
18338
18350
  blocks.push({ type: "image", text: filename });
18339
- } catch (e27) {
18351
+ } catch (e28) {
18340
18352
  }
18341
18353
  }
18342
18354
  }
18343
18355
  return { blocks, images };
18344
18356
  }
18345
18357
  async function parseDocxDocument(buffer, options) {
18346
- _chunk4JLD2IT7cjs.precheckZipSize.call(void 0, buffer, MAX_DECOMPRESS_SIZE4);
18358
+ _chunkG44XLS26cjs.precheckZipSize.call(void 0, buffer, MAX_DECOMPRESS_SIZE4);
18347
18359
  const zip = await _jszip2.default.loadAsync(buffer);
18348
18360
  const warnings = [];
18349
18361
  const docFile = zip.file("word/document.xml");
18350
18362
  if (!docFile) {
18351
- throw new (0, _chunk4JLD2IT7cjs.KordocError)("\uC720\uD6A8\uD558\uC9C0 \uC54A\uC740 DOCX \uD30C\uC77C: word/document.xml\uC774 \uC5C6\uC2B5\uB2C8\uB2E4");
18363
+ throw new (0, _chunkG44XLS26cjs.KordocError)("\uC720\uD6A8\uD558\uC9C0 \uC54A\uC740 DOCX \uD30C\uC77C: word/document.xml\uC774 \uC5C6\uC2B5\uB2C8\uB2E4");
18352
18364
  }
18353
18365
  let rels = /* @__PURE__ */ new Map();
18354
18366
  const relsFile = zip.file("word/_rels/document.xml.rels");
@@ -18360,7 +18372,7 @@ async function parseDocxDocument(buffer, options) {
18360
18372
  if (stylesFile) {
18361
18373
  try {
18362
18374
  styles = parseStyles(await stylesFile.async("text"));
18363
- } catch (e28) {
18375
+ } catch (e29) {
18364
18376
  }
18365
18377
  }
18366
18378
  let numbering = /* @__PURE__ */ new Map();
@@ -18368,7 +18380,7 @@ async function parseDocxDocument(buffer, options) {
18368
18380
  if (numFile) {
18369
18381
  try {
18370
18382
  numbering = parseNumbering(await numFile.async("text"));
18371
- } catch (e29) {
18383
+ } catch (e30) {
18372
18384
  }
18373
18385
  }
18374
18386
  let footnotes = /* @__PURE__ */ new Map();
@@ -18376,14 +18388,14 @@ async function parseDocxDocument(buffer, options) {
18376
18388
  if (fnFile) {
18377
18389
  try {
18378
18390
  footnotes = parseFootnotes(await fnFile.async("text"));
18379
- } catch (e30) {
18391
+ } catch (e31) {
18380
18392
  }
18381
18393
  }
18382
18394
  const docXml = await docFile.async("text");
18383
18395
  const doc = parseXml2(docXml);
18384
18396
  const body = findElements(doc, "body");
18385
18397
  if (body.length === 0) {
18386
- throw new (0, _chunk4JLD2IT7cjs.KordocError)("DOCX \uBCF8\uBB38(w:body)\uC744 \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4");
18398
+ throw new (0, _chunkG44XLS26cjs.KordocError)("DOCX \uBCF8\uBB38(w:body)\uC744 \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4");
18387
18399
  }
18388
18400
  const blocks = [];
18389
18401
  const bodyEl = body[0];
@@ -18416,11 +18428,11 @@ async function parseDocxDocument(buffer, options) {
18416
18428
  if (created) metadata.createdAt = created;
18417
18429
  const modified = getFirst("dcterms:modified");
18418
18430
  if (modified) metadata.modifiedAt = modified;
18419
- } catch (e31) {
18431
+ } catch (e32) {
18420
18432
  }
18421
18433
  }
18422
18434
  const outline = blocks.filter((b) => b.type === "heading").map((b) => ({ level: _nullishCoalesce(b.level, () => ( 2)), text: _nullishCoalesce(b.text, () => ( "")) }));
18423
- const markdown = _chunk4JLD2IT7cjs.blocksToMarkdown.call(void 0, blocks);
18435
+ const markdown = _chunkG44XLS26cjs.blocksToMarkdown.call(void 0, blocks);
18424
18436
  return {
18425
18437
  markdown,
18426
18438
  blocks,
@@ -18443,7 +18455,7 @@ function parseHwpmlDocument(buffer, options) {
18443
18455
  }
18444
18456
  const text = new TextDecoder("utf-8").decode(buffer).replace(/^\uFEFF/, "");
18445
18457
  const normalized = text.replace(/&nbsp;/g, "&#160;");
18446
- const xml = _chunk4JLD2IT7cjs.stripDtd.call(void 0, normalized);
18458
+ const xml = _chunkG44XLS26cjs.stripDtd.call(void 0, normalized);
18447
18459
  const warnings = [];
18448
18460
  const parser = new (0, _xmldom.DOMParser)({
18449
18461
  onError: (_level, msg2) => {
@@ -18471,7 +18483,7 @@ function parseHwpmlDocument(buffer, options) {
18471
18483
  return { markdown: "", blocks: [], metadata, warnings };
18472
18484
  }
18473
18485
  const blocks = [];
18474
- const pageFilter = _optionalChain([options, 'optionalAccess', _123 => _123.pages]) ? _chunkX34YWRL5cjs.parsePageRange.call(void 0, options.pages, countSections(body)) : null;
18486
+ const pageFilter = _optionalChain([options, 'optionalAccess', _123 => _123.pages]) ? _chunkDCZVOIEOcjs.parsePageRange.call(void 0, options.pages, countSections(body)) : null;
18475
18487
  let sectionIdx = 0;
18476
18488
  const children = body.childNodes;
18477
18489
  for (let i = 0; i < children.length; i++) {
@@ -18483,7 +18495,7 @@ function parseHwpmlDocument(buffer, options) {
18483
18495
  parseSection2(el, blocks, paraShapeMap, sectionIdx, warnings);
18484
18496
  }
18485
18497
  const outline = blocks.filter((b) => b.type === "heading" && b.text).map((b) => ({ level: _nullishCoalesce(b.level, () => ( 1)), text: b.text, pageNumber: b.pageNumber }));
18486
- const markdown = _chunk4JLD2IT7cjs.blocksToMarkdown.call(void 0, blocks);
18498
+ const markdown = _chunkG44XLS26cjs.blocksToMarkdown.call(void 0, blocks);
18487
18499
  return {
18488
18500
  markdown,
18489
18501
  blocks,
@@ -18625,7 +18637,7 @@ function parseTable2(el, blocks, paraShapeMap, sectionNum, warnings) {
18625
18637
  const cellRows = grid.map(
18626
18638
  (row) => row.map((cell) => _nullishCoalesce(cell, () => ( { text: "", colSpan: 1, rowSpan: 1 })))
18627
18639
  );
18628
- const table = _chunk4JLD2IT7cjs.buildTable.call(void 0, cellRows);
18640
+ const table = _chunkG44XLS26cjs.buildTable.call(void 0, cellRows);
18629
18641
  blocks.push({ type: "table", table, pageNumber: sectionNum });
18630
18642
  }
18631
18643
  function extractCellText(cellEl) {
@@ -19135,7 +19147,7 @@ function decodeXmlEntities(text) {
19135
19147
  try {
19136
19148
  const code = ent[1] === "x" || ent[1] === "X" ? parseInt(ent.slice(2), 16) : parseInt(ent.slice(1), 10);
19137
19149
  if (!isNaN(code) && code >= 0 && code <= 1114111) return String.fromCodePoint(code);
19138
- } catch (e32) {
19150
+ } catch (e33) {
19139
19151
  }
19140
19152
  return m;
19141
19153
  });
@@ -19652,19 +19664,19 @@ function parseCentralDirectory(buf) {
19652
19664
  }
19653
19665
  }
19654
19666
  }
19655
- if (eocdOffset < 0) throw new (0, _chunk4JLD2IT7cjs.KordocError)("ZIP EOCD\uB97C \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4");
19667
+ if (eocdOffset < 0) throw new (0, _chunkG44XLS26cjs.KordocError)("ZIP EOCD\uB97C \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4");
19656
19668
  const totalEntries = view.getUint16(eocdOffset + 10, true);
19657
19669
  const cdSize = view.getUint32(eocdOffset + 12, true);
19658
19670
  const cdOffset = view.getUint32(eocdOffset + 16, true);
19659
- if (cdOffset === 4294967295 || totalEntries === 65535) throw new (0, _chunk4JLD2IT7cjs.KordocError)("ZIP64\uB294 \uC9C0\uC6D0\uD558\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4");
19671
+ if (cdOffset === 4294967295 || totalEntries === 65535) throw new (0, _chunkG44XLS26cjs.KordocError)("ZIP64\uB294 \uC9C0\uC6D0\uD558\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4");
19660
19672
  if (eocdOffset >= 20 && view.getUint32(eocdOffset - 20, true) === ZIP64_EOCD_LOC_SIG) {
19661
- throw new (0, _chunk4JLD2IT7cjs.KordocError)("ZIP64\uB294 \uC9C0\uC6D0\uD558\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4");
19673
+ throw new (0, _chunkG44XLS26cjs.KordocError)("ZIP64\uB294 \uC9C0\uC6D0\uD558\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4");
19662
19674
  }
19663
19675
  const decoder = new TextDecoder("utf-8");
19664
19676
  const entries = [];
19665
19677
  let pos = cdOffset;
19666
19678
  for (let i = 0; i < totalEntries; i++) {
19667
- if (view.getUint32(pos, true) !== CD_SIG) throw new (0, _chunk4JLD2IT7cjs.KordocError)("ZIP Central Directory \uC190\uC0C1");
19679
+ if (view.getUint32(pos, true) !== CD_SIG) throw new (0, _chunkG44XLS26cjs.KordocError)("ZIP Central Directory \uC190\uC0C1");
19668
19680
  const flags = view.getUint16(pos + 8, true);
19669
19681
  const method = view.getUint16(pos + 10, true);
19670
19682
  const crc = view.getUint32(pos + 16, true);
@@ -19675,7 +19687,7 @@ function parseCentralDirectory(buf) {
19675
19687
  const commentLen = view.getUint16(pos + 32, true);
19676
19688
  const localOffset = view.getUint32(pos + 42, true);
19677
19689
  if (compSize === 4294967295 || uncompSize === 4294967295 || localOffset === 4294967295) {
19678
- throw new (0, _chunk4JLD2IT7cjs.KordocError)("ZIP64\uB294 \uC9C0\uC6D0\uD558\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4");
19690
+ throw new (0, _chunkG44XLS26cjs.KordocError)("ZIP64\uB294 \uC9C0\uC6D0\uD558\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4");
19679
19691
  }
19680
19692
  const name = decoder.decode(buf.subarray(pos + 46, pos + 46 + nameLen));
19681
19693
  const cdEnd = pos + 46 + nameLen + extraLen + commentLen;
@@ -19704,7 +19716,7 @@ function patchZipEntries(original, replacements) {
19704
19716
  const { entries, cdOffset, eocdOffset } = parseCentralDirectory(original);
19705
19717
  const view = new DataView(original.buffer, original.byteOffset, original.byteLength);
19706
19718
  for (const name of replacements.keys()) {
19707
- if (!entries.some((e) => e.name === name)) throw new (0, _chunk4JLD2IT7cjs.KordocError)(`ZIP\uC5D0 \uC5C6\uB294 \uC5D4\uD2B8\uB9AC: ${name}`);
19719
+ if (!entries.some((e) => e.name === name)) throw new (0, _chunkG44XLS26cjs.KordocError)(`ZIP\uC5D0 \uC5C6\uB294 \uC5D4\uD2B8\uB9AC: ${name}`);
19708
19720
  }
19709
19721
  const byLocal = [...entries].sort((a, b) => a.localOffset - b.localOffset);
19710
19722
  const segments = [];
@@ -19722,7 +19734,7 @@ function patchZipEntries(original, replacements) {
19722
19734
  offset += seg.length;
19723
19735
  continue;
19724
19736
  }
19725
- if (view.getUint32(e.localOffset, true) !== LOCAL_SIG) throw new (0, _chunk4JLD2IT7cjs.KordocError)("ZIP \uB85C\uCEEC \uD5E4\uB354 \uC2DC\uADF8\uB2C8\uCC98 \uBD88\uC77C\uCE58");
19737
+ if (view.getUint32(e.localOffset, true) !== LOCAL_SIG) throw new (0, _chunkG44XLS26cjs.KordocError)("ZIP \uB85C\uCEEC \uD5E4\uB354 \uC2DC\uADF8\uB2C8\uCC98 \uBD88\uC77C\uCE58");
19726
19738
  const nameLen = view.getUint16(e.localOffset + 26, true);
19727
19739
  const extraLen = view.getUint16(e.localOffset + 28, true);
19728
19740
  const headerLen = 30 + nameLen + extraLen;
@@ -19777,7 +19789,7 @@ async function fillHwpx(hwpxBuffer, values) {
19777
19789
  const zip = await _jszip2.default.loadAsync(hwpxBuffer);
19778
19790
  const sectionPaths = Object.keys(zip.files).filter((name) => /[Ss]ection\d+\.xml$/i.test(name)).sort();
19779
19791
  if (sectionPaths.length === 0) {
19780
- throw new (0, _chunk4JLD2IT7cjs.KordocError)("HWPX\uC5D0\uC11C \uC139\uC158 \uD30C\uC77C\uC744 \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4");
19792
+ throw new (0, _chunkG44XLS26cjs.KordocError)("HWPX\uC5D0\uC11C \uC139\uC158 \uD30C\uC77C\uC744 \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4");
19781
19793
  }
19782
19794
  const normalizedValues = normalizeValues(values);
19783
19795
  const matchedLabels = /* @__PURE__ */ new Set();
@@ -20444,7 +20456,8 @@ ${base2.join("\n")}
20444
20456
  ];
20445
20457
  for (let d = 0; d < GONGMUN_LIST_LEVELS; d++) {
20446
20458
  const { left, indent } = levelIndent(d, gongmun.bodyHeight, gongmun.numbering);
20447
- base.push(paraPr(GONGMUN_LIST_BASE + d, { align: "JUSTIFY", lineSpacing: ls, left, indent }));
20459
+ const sectionGap = gongmun.numbering === "report" && d === 0 ? Math.round(gongmun.bodyHeight * 0.5) : 0;
20460
+ base.push(paraPr(GONGMUN_LIST_BASE + d, { align: "JUSTIFY", lineSpacing: ls, left, indent, spaceBefore: sectionGap }));
20448
20461
  }
20449
20462
  base.push(paraPr(GONGMUN_CENTER, { align: "CENTER", lineSpacing: ls }));
20450
20463
  return `<hh:paraProperties itemCnt="${base.length}">
@@ -20655,7 +20668,8 @@ function blocksToSectionXml(blocks, theme, gongmun) {
20655
20668
  const marker2 = _nullishCoalesce(_optionalChain([info, 'optionalAccess', _171 => _171.marker]), () => ( ""));
20656
20669
  const content = block.text || "";
20657
20670
  const text = marker2 ? `${marker2} ${content}` : content;
20658
- xml = generateParagraph(text, GONGMUN_LIST_BASE + depth);
20671
+ const listCharPr = gongmun.numbering === "report" && depth === 0 ? CHAR_BOLD : CHAR_NORMAL;
20672
+ xml = generateParagraph(text, GONGMUN_LIST_BASE + depth, listCharPr);
20659
20673
  break;
20660
20674
  }
20661
20675
  const indent = block.indent || 0;
@@ -20949,7 +20963,7 @@ function escapeGfm(text) {
20949
20963
  }
20950
20964
  var HWP_SHAPE_ALT_TEXT_RE = /(?:모서리가 둥근 |둥근 )?(?:사각형|직사각형|정사각형|원|타원|삼각형|이등변 삼각형|직각 삼각형|선|직선|곡선|화살표|굵은 화살표|이중 화살표|오각형|육각형|팔각형|별|[4-8]점별|십자|십자형|구름|구름형|마름모|도넛|평행사변형|사다리꼴|부채꼴|호|반원|물결|번개|하트|빗금|블록 화살표|수식|표|그림|개체|그리기\s?개체|묶음\s?개체|글상자|수식\s?개체|OLE\s?개체)\s?입니다\.?/g;
20951
20965
  function sanitizeText(text) {
20952
- let result = _chunk4JLD2IT7cjs.mapPuaText.call(void 0, text).replace(/[\u{F0000}-\u{FFFFD}]/gu, "").replace(HWP_SHAPE_ALT_TEXT_RE, "").replace(/ +/g, " ").trim();
20966
+ let result = _chunkG44XLS26cjs.mapPuaText.call(void 0, text).replace(/[\u{F0000}-\u{FFFFD}]/gu, "").replace(HWP_SHAPE_ALT_TEXT_RE, "").replace(/ +/g, " ").trim();
20953
20967
  if (result.length <= 30 && result.includes(" ")) {
20954
20968
  const tokens = result.split(" ");
20955
20969
  const koreanSingleCharCount = tokens.filter((t) => t.length === 1 && /[가-힯ㄱ-ㆎ]/.test(t)).length;
@@ -21476,10 +21490,9 @@ async function resolveSectionEntryNames(zip) {
21476
21490
  const paths = sectionPathsFromManifest(xml).filter((p) => zip.file(p) !== null);
21477
21491
  if (paths.length > 0) return paths;
21478
21492
  }
21479
- return Object.keys(zip.files).filter((n) => /[Ss]ection\d+\.xml$/.test(n)).sort();
21493
+ return Object.keys(zip.files).filter((n) => /[Ss]ection\d+\.xml$/.test(n)).sort(_chunkG44XLS26cjs.compareSectionPaths);
21480
21494
  }
21481
21495
  function sectionPathsFromManifest(xml) {
21482
- const isSectionId = (id) => /^s/i.test(id) || id.toLowerCase().includes("section");
21483
21496
  const attr = (tag, name) => {
21484
21497
  const m = tag.match(new RegExp(`(?:^|\\s)${name}\\s*=\\s*(?:"([^"]*)"|'([^']*)')`));
21485
21498
  return m ? _nullishCoalesce(m[1], () => ( m[2])) : "";
@@ -21487,11 +21500,8 @@ function sectionPathsFromManifest(xml) {
21487
21500
  const idToHref = /* @__PURE__ */ new Map();
21488
21501
  for (const m of xml.matchAll(/<opf:item(\s(?:"[^"]*"|'[^']*'|[^>"'])*?)\/?>/g)) {
21489
21502
  const id = attr(m[1], "id");
21490
- let href = attr(m[1], "href");
21491
- const mediaType = attr(m[1], "media-type");
21492
- if (!isSectionId(id) && !mediaType.includes("xml")) continue;
21493
- if (!href.startsWith("/") && !href.startsWith("Contents/") && isSectionId(id)) href = "Contents/" + href;
21494
- if (id) idToHref.set(id, href);
21503
+ const href = _chunkG44XLS26cjs.normalizeSectionHref.call(void 0, attr(m[1], "href"));
21504
+ if (id && href) idToHref.set(id, href);
21495
21505
  }
21496
21506
  const ordered = [];
21497
21507
  for (const m of xml.matchAll(/<opf:itemref(\s(?:"[^"]*"|'[^']*'|[^>"'])*?)\/?>/g)) {
@@ -21499,7 +21509,7 @@ function sectionPathsFromManifest(xml) {
21499
21509
  if (href) ordered.push(href);
21500
21510
  }
21501
21511
  if (ordered.length > 0) return ordered;
21502
- return Array.from(idToHref.entries()).filter(([id]) => isSectionId(id)).sort((a, b) => a[0].localeCompare(b[0])).map(([, href]) => href);
21512
+ return Array.from(idToHref.values()).sort(_chunkG44XLS26cjs.compareSectionPaths);
21503
21513
  }
21504
21514
 
21505
21515
  // src/roundtrip/patcher.ts
@@ -21516,7 +21526,7 @@ async function patchHwpx(original, editedMarkdown, options) {
21516
21526
  let zip;
21517
21527
  try {
21518
21528
  zip = await _jszip2.default.loadAsync(original);
21519
- } catch (e33) {
21529
+ } catch (e34) {
21520
21530
  return { success: false, applied: 0, skipped, error: "ZIP \uB85C\uB4DC \uC2E4\uD328" };
21521
21531
  }
21522
21532
  const sectionPaths = await resolveSectionEntryNames(zip);
@@ -21609,9 +21619,9 @@ function buildOrigUnits(blocks) {
21609
21619
  if (block.type === "paragraph" && block.text && /^\[별표\s*\d+/.test(sanitizeText(block.text))) {
21610
21620
  const next = blocks[i + 1];
21611
21621
  if (_optionalChain([next, 'optionalAccess', _198 => _198.type]) === "paragraph" && next.text && /관련\)?$/.test(next.text)) consume = 2;
21612
- chunk = _chunk4JLD2IT7cjs.blocksToMarkdown.call(void 0, blocks.slice(i, i + consume));
21622
+ chunk = _chunkG44XLS26cjs.blocksToMarkdown.call(void 0, blocks.slice(i, i + consume));
21613
21623
  } else {
21614
- chunk = _chunk4JLD2IT7cjs.blocksToMarkdown.call(void 0, [block]);
21624
+ chunk = _chunkG44XLS26cjs.blocksToMarkdown.call(void 0, [block]);
21615
21625
  }
21616
21626
  if (chunk) {
21617
21627
  const subUnits = splitMarkdownUnits(chunk);
@@ -23351,14 +23361,14 @@ async function htmlToPdf(html, options) {
23351
23361
  let puppeteer;
23352
23362
  try {
23353
23363
  puppeteer = await Promise.resolve().then(() => _interopRequireWildcard(require("puppeteer-core")));
23354
- } catch (e34) {
23355
- throw new (0, _chunk4JLD2IT7cjs.KordocError)(
23364
+ } catch (e35) {
23365
+ throw new (0, _chunkG44XLS26cjs.KordocError)(
23356
23366
  "PDF \uC0DD\uC131\uC5D0 puppeteer-core\uAC00 \uD544\uC694\uD569\uB2C8\uB2E4. \uC124\uCE58: npm install puppeteer-core"
23357
23367
  );
23358
23368
  }
23359
23369
  const executablePath = _nullishCoalesce(process.env.PUPPETEER_EXECUTABLE_PATH, () => ( findChromiumPath()));
23360
23370
  if (!executablePath) {
23361
- throw new (0, _chunk4JLD2IT7cjs.KordocError)(
23371
+ throw new (0, _chunkG44XLS26cjs.KordocError)(
23362
23372
  "Chromium \uC2E4\uD589 \uD30C\uC77C\uC744 \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4. PUPPETEER_EXECUTABLE_PATH \uD658\uACBD\uBCC0\uC218\uB97C \uC124\uC815\uD558\uC138\uC694."
23363
23373
  );
23364
23374
  }
@@ -23417,7 +23427,7 @@ async function markdownToPdf(markdown, options) {
23417
23427
  return htmlToPdf(html, options);
23418
23428
  }
23419
23429
  async function blocksToPdf(blocks, options) {
23420
- const markdown = _chunk4JLD2IT7cjs.blocksToMarkdown.call(void 0, blocks);
23430
+ const markdown = _chunkG44XLS26cjs.blocksToMarkdown.call(void 0, blocks);
23421
23431
  return markdownToPdf(markdown, options);
23422
23432
  }
23423
23433
 
@@ -23428,13 +23438,13 @@ async function parse(input, options) {
23428
23438
  if (typeof input === "string") {
23429
23439
  try {
23430
23440
  const buf = await _promises.readFile.call(void 0, input);
23431
- buffer = _chunk4JLD2IT7cjs.toArrayBuffer.call(void 0, buf);
23441
+ buffer = _chunkG44XLS26cjs.toArrayBuffer.call(void 0, buf);
23432
23442
  } catch (err) {
23433
23443
  const msg2 = err instanceof Error && "code" in err && err.code === "ENOENT" ? `\uD30C\uC77C\uC744 \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4: ${input}` : `\uD30C\uC77C \uC77D\uAE30 \uC2E4\uD328: ${input}`;
23434
23444
  return { success: false, fileType: "unknown", error: msg2, code: "PARSE_ERROR" };
23435
23445
  }
23436
23446
  } else if (Buffer.isBuffer(input)) {
23437
- buffer = _chunk4JLD2IT7cjs.toArrayBuffer.call(void 0, input);
23447
+ buffer = _chunkG44XLS26cjs.toArrayBuffer.call(void 0, input);
23438
23448
  } else {
23439
23449
  buffer = input;
23440
23450
  }
@@ -23469,7 +23479,7 @@ async function parseHwp3(buffer, options) {
23469
23479
  const { markdown, blocks, metadata, outline, warnings } = parseHwp3Document(buffer, options);
23470
23480
  return { success: true, fileType: "hwp3", markdown, blocks, metadata, outline, warnings };
23471
23481
  } catch (err) {
23472
- return { success: false, fileType: "hwp3", error: err instanceof Error ? err.message : "HWP3 \uD30C\uC2F1 \uC2E4\uD328", code: _chunk4JLD2IT7cjs.classifyError.call(void 0, err) };
23482
+ return { success: false, fileType: "hwp3", error: err instanceof Error ? err.message : "HWP3 \uD30C\uC2F1 \uC2E4\uD328", code: _chunkG44XLS26cjs.classifyError.call(void 0, err) };
23473
23483
  }
23474
23484
  }
23475
23485
  async function parseHwpx(buffer, options) {
@@ -23477,7 +23487,7 @@ async function parseHwpx(buffer, options) {
23477
23487
  const { markdown, blocks, metadata, outline, warnings, images } = await parseHwpxDocument(buffer, options);
23478
23488
  return { success: true, fileType: "hwpx", markdown, blocks, metadata, outline, warnings, images: _optionalChain([images, 'optionalAccess', _256 => _256.length]) ? images : void 0 };
23479
23489
  } catch (err) {
23480
- return { success: false, fileType: "hwpx", error: err instanceof Error ? err.message : "HWPX \uD30C\uC2F1 \uC2E4\uD328", code: _chunk4JLD2IT7cjs.classifyError.call(void 0, err) };
23490
+ return { success: false, fileType: "hwpx", error: err instanceof Error ? err.message : "HWPX \uD30C\uC2F1 \uC2E4\uD328", code: _chunkG44XLS26cjs.classifyError.call(void 0, err) };
23481
23491
  }
23482
23492
  }
23483
23493
  async function parseHwp(buffer, options) {
@@ -23497,20 +23507,20 @@ async function parseHwp(buffer, options) {
23497
23507
  warnings: com.warnings
23498
23508
  };
23499
23509
  }
23500
- } catch (e35) {
23510
+ } catch (e36) {
23501
23511
  }
23502
23512
  }
23503
23513
  return { success: true, fileType: "hwp", markdown, blocks, metadata, outline, warnings, images: _optionalChain([images, 'optionalAccess', _258 => _258.length]) ? images : void 0 };
23504
23514
  } catch (err) {
23505
- return { success: false, fileType: "hwp", error: err instanceof Error ? err.message : "HWP \uD30C\uC2F1 \uC2E4\uD328", code: _chunk4JLD2IT7cjs.classifyError.call(void 0, err) };
23515
+ return { success: false, fileType: "hwp", error: err instanceof Error ? err.message : "HWP \uD30C\uC2F1 \uC2E4\uD328", code: _chunkG44XLS26cjs.classifyError.call(void 0, err) };
23506
23516
  }
23507
23517
  }
23508
23518
  async function parsePdf(buffer, options) {
23509
23519
  let parsePdfDocument;
23510
23520
  try {
23511
- const mod = await Promise.resolve().then(() => _interopRequireWildcard(require("./parser-25ISHR7Q.cjs")));
23521
+ const mod = await Promise.resolve().then(() => _interopRequireWildcard(require("./parser-2O276TRF.cjs")));
23512
23522
  parsePdfDocument = mod.parsePdfDocument;
23513
- } catch (e36) {
23523
+ } catch (e37) {
23514
23524
  return {
23515
23525
  success: false,
23516
23526
  fileType: "pdf",
@@ -23523,7 +23533,7 @@ async function parsePdf(buffer, options) {
23523
23533
  return { success: true, fileType: "pdf", markdown, blocks, metadata, outline, warnings, isImageBased, pageQuality, qualitySummary };
23524
23534
  } catch (err) {
23525
23535
  const isImageBased = err instanceof Error && "isImageBased" in err ? true : void 0;
23526
- return { success: false, fileType: "pdf", error: err instanceof Error ? err.message : "PDF \uD30C\uC2F1 \uC2E4\uD328", code: _chunk4JLD2IT7cjs.classifyError.call(void 0, err), isImageBased };
23536
+ return { success: false, fileType: "pdf", error: err instanceof Error ? err.message : "PDF \uD30C\uC2F1 \uC2E4\uD328", code: _chunkG44XLS26cjs.classifyError.call(void 0, err), isImageBased };
23527
23537
  }
23528
23538
  }
23529
23539
  async function parseXlsx(buffer, options) {
@@ -23531,7 +23541,7 @@ async function parseXlsx(buffer, options) {
23531
23541
  const { markdown, blocks, metadata, warnings } = await parseXlsxDocument(buffer, options);
23532
23542
  return { success: true, fileType: "xlsx", markdown, blocks, metadata, warnings };
23533
23543
  } catch (err) {
23534
- return { success: false, fileType: "xlsx", error: err instanceof Error ? err.message : "XLSX \uD30C\uC2F1 \uC2E4\uD328", code: _chunk4JLD2IT7cjs.classifyError.call(void 0, err) };
23544
+ return { success: false, fileType: "xlsx", error: err instanceof Error ? err.message : "XLSX \uD30C\uC2F1 \uC2E4\uD328", code: _chunkG44XLS26cjs.classifyError.call(void 0, err) };
23535
23545
  }
23536
23546
  }
23537
23547
  async function parseXls(buffer, options) {
@@ -23539,7 +23549,7 @@ async function parseXls(buffer, options) {
23539
23549
  const { markdown, blocks, metadata, warnings } = await parseXlsDocument(buffer, options);
23540
23550
  return { success: true, fileType: "xls", markdown, blocks, metadata, warnings };
23541
23551
  } catch (err) {
23542
- return { success: false, fileType: "xls", error: err instanceof Error ? err.message : "XLS \uD30C\uC2F1 \uC2E4\uD328", code: _chunk4JLD2IT7cjs.classifyError.call(void 0, err) };
23552
+ return { success: false, fileType: "xls", error: err instanceof Error ? err.message : "XLS \uD30C\uC2F1 \uC2E4\uD328", code: _chunkG44XLS26cjs.classifyError.call(void 0, err) };
23543
23553
  }
23544
23554
  }
23545
23555
  async function parseDocx(buffer, options) {
@@ -23547,7 +23557,7 @@ async function parseDocx(buffer, options) {
23547
23557
  const { markdown, blocks, metadata, outline, warnings, images } = await parseDocxDocument(buffer, options);
23548
23558
  return { success: true, fileType: "docx", markdown, blocks, metadata, outline, warnings, images: _optionalChain([images, 'optionalAccess', _259 => _259.length]) ? images : void 0 };
23549
23559
  } catch (err) {
23550
- return { success: false, fileType: "docx", error: err instanceof Error ? err.message : "DOCX \uD30C\uC2F1 \uC2E4\uD328", code: _chunk4JLD2IT7cjs.classifyError.call(void 0, err) };
23560
+ return { success: false, fileType: "docx", error: err instanceof Error ? err.message : "DOCX \uD30C\uC2F1 \uC2E4\uD328", code: _chunkG44XLS26cjs.classifyError.call(void 0, err) };
23551
23561
  }
23552
23562
  }
23553
23563
  async function parseHwpml(buffer, options) {
@@ -23555,16 +23565,16 @@ async function parseHwpml(buffer, options) {
23555
23565
  const { markdown, blocks, metadata, outline, warnings } = parseHwpmlDocument(buffer, options);
23556
23566
  return { success: true, fileType: "hwpml", markdown, blocks, metadata, outline, warnings };
23557
23567
  } catch (err) {
23558
- return { success: false, fileType: "hwpml", error: err instanceof Error ? err.message : "HWPML \uD30C\uC2F1 \uC2E4\uD328", code: _chunk4JLD2IT7cjs.classifyError.call(void 0, err) };
23568
+ return { success: false, fileType: "hwpml", error: err instanceof Error ? err.message : "HWPML \uD30C\uC2F1 \uC2E4\uD328", code: _chunkG44XLS26cjs.classifyError.call(void 0, err) };
23559
23569
  }
23560
23570
  }
23561
23571
  async function fillForm(input, values, outputFormat = "markdown") {
23562
23572
  let buffer;
23563
23573
  if (typeof input === "string") {
23564
23574
  const buf = await _promises.readFile.call(void 0, input);
23565
- buffer = _chunk4JLD2IT7cjs.toArrayBuffer.call(void 0, buf);
23575
+ buffer = _chunkG44XLS26cjs.toArrayBuffer.call(void 0, buf);
23566
23576
  } else if (Buffer.isBuffer(input)) {
23567
- buffer = _chunk4JLD2IT7cjs.toArrayBuffer.call(void 0, input);
23577
+ buffer = _chunkG44XLS26cjs.toArrayBuffer.call(void 0, input);
23568
23578
  } else {
23569
23579
  buffer = input;
23570
23580
  }
@@ -23590,7 +23600,7 @@ async function fillForm(input, values, outputFormat = "markdown") {
23590
23600
  throw new Error(`\uC11C\uC2DD \uD30C\uC2F1 \uC2E4\uD328: ${parsed.error}`);
23591
23601
  }
23592
23602
  const fill = fillFormFields(parsed.blocks, values);
23593
- const markdown = _chunk4JLD2IT7cjs.blocksToMarkdown.call(void 0, fill.blocks);
23603
+ const markdown = _chunkG44XLS26cjs.blocksToMarkdown.call(void 0, fill.blocks);
23594
23604
  if (outputFormat === "hwpx") {
23595
23605
  const hwpxBuffer = await markdownToHwpx(markdown);
23596
23606
  return { output: hwpxBuffer, format: "hwpx", fill };
@@ -23640,5 +23650,5 @@ async function fillForm(input, values, outputFormat = "markdown") {
23640
23650
 
23641
23651
 
23642
23652
 
23643
- exports.HwpxSession = HwpxSession; exports.PRESET_ALIAS = PRESET_ALIAS; exports.VERSION = _chunk4JLD2IT7cjs.VERSION; exports.applySplices = applySplices; exports.blocksToMarkdown = _chunk4JLD2IT7cjs.blocksToMarkdown; exports.blocksToPdf = blocksToPdf; exports.buildParagraphSplices = buildParagraphSplices; exports.buildRangeSplices = buildRangeSplices; exports.compare = compare; exports.detectFormat = detectFormat; exports.detectOle2Format = detectOle2Format; exports.detectZipFormat = detectZipFormat; exports.diffBlocks = diffBlocks; exports.extractFormFields = extractFormFields; exports.extractFormSchema = extractFormSchema; exports.fillForm = fillForm; exports.fillFormFields = fillFormFields; exports.fillHwpx = fillHwpx; exports.inferFieldType = inferFieldType; exports.isHwpxFile = isHwpxFile; exports.isLabelCell = isLabelCell; exports.isOldHwpFile = isOldHwpFile; exports.isPdfFile = isPdfFile; exports.isZipFile = isZipFile; exports.markdownToHwpx = markdownToHwpx; exports.markdownToPdf = markdownToPdf; exports.normalizeGongmunPreset = normalizeGongmunPreset; exports.openHwpxDocument = openHwpxDocument; exports.parse = parse; exports.parseDocx = parseDocx; exports.parseHwp = parseHwp; exports.parseHwp3 = parseHwp3; exports.parseHwpml = parseHwpml; exports.parseHwpx = parseHwpx; exports.parsePdf = parsePdf; exports.parseXls = parseXls; exports.parseXlsx = parseXlsx; exports.patchHwp = patchHwp; exports.patchHwpx = patchHwpx; exports.patchHwpxBlocks = patchHwpxBlocks; exports.renderHtml = renderHtml; exports.scanSectionXml = scanSectionXml;
23653
+ exports.HwpxSession = HwpxSession; exports.PRESET_ALIAS = PRESET_ALIAS; exports.VERSION = _chunkG44XLS26cjs.VERSION; exports.applySplices = applySplices; exports.blocksToMarkdown = _chunkG44XLS26cjs.blocksToMarkdown; exports.blocksToPdf = blocksToPdf; exports.buildParagraphSplices = buildParagraphSplices; exports.buildRangeSplices = buildRangeSplices; exports.compare = compare; exports.detectFormat = detectFormat; exports.detectOle2Format = detectOle2Format; exports.detectZipFormat = detectZipFormat; exports.diffBlocks = diffBlocks; exports.extractFormFields = extractFormFields; exports.extractFormSchema = extractFormSchema; exports.fillForm = fillForm; exports.fillFormFields = fillFormFields; exports.fillHwpx = fillHwpx; exports.inferFieldType = inferFieldType; exports.isHwpxFile = isHwpxFile; exports.isLabelCell = isLabelCell; exports.isOldHwpFile = isOldHwpFile; exports.isPdfFile = isPdfFile; exports.isZipFile = isZipFile; exports.markdownToHwpx = markdownToHwpx; exports.markdownToPdf = markdownToPdf; exports.normalizeGongmunPreset = normalizeGongmunPreset; exports.openHwpxDocument = openHwpxDocument; exports.parse = parse; exports.parseDocx = parseDocx; exports.parseHwp = parseHwp; exports.parseHwp3 = parseHwp3; exports.parseHwpml = parseHwpml; exports.parseHwpx = parseHwpx; exports.parsePdf = parsePdf; exports.parseXls = parseXls; exports.parseXlsx = parseXlsx; exports.patchHwp = patchHwp; exports.patchHwpx = patchHwpx; exports.patchHwpxBlocks = patchHwpxBlocks; exports.renderHtml = renderHtml; exports.scanSectionXml = scanSectionXml;
23644
23654
  //# sourceMappingURL=index.cjs.map