kordoc 4.1.0 → 4.2.0
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.
- package/README.md +25 -5
- package/dist/{-AS4IABL2.js → -SXQIZHYA.js} +10 -9
- package/dist/{parser-PEOYBXBO.js → chunk-26AJJCFF.js} +1339 -2023
- package/dist/chunk-26AJJCFF.js.map +1 -0
- package/dist/{parser-XX4QTDFQ.js → chunk-4JPPLIIV.js} +1337 -2019
- package/dist/chunk-4JPPLIIV.js.map +1 -0
- package/dist/chunk-4VNLZ2GZ.js +13 -0
- package/dist/chunk-4VNLZ2GZ.js.map +1 -0
- package/dist/{chunk-37HJHCPA.js → chunk-6SHO3BNV.js} +3 -3
- package/dist/{chunk-UOO7LSDG.js → chunk-7FCNOKOR.js} +1 -9
- package/dist/chunk-7FCNOKOR.js.map +1 -0
- package/dist/{chunk-SSTK6IKK.js → chunk-CMN3SYZ3.js} +14 -5
- package/dist/chunk-CMN3SYZ3.js.map +1 -0
- package/dist/{chunk-F2ZU3IZG.js → chunk-ELOV2GIJ.js} +2 -2
- package/dist/chunk-F2HYH62H.cjs +130 -0
- package/dist/chunk-F2HYH62H.cjs.map +1 -0
- package/dist/{chunk-O5VS7RIR.js → chunk-FSXLSHCW.js} +3 -3
- package/dist/{chunk-O5VS7RIR.js.map → chunk-FSXLSHCW.js.map} +1 -1
- package/dist/chunk-GEPINOL6.js +83 -0
- package/dist/chunk-GEPINOL6.js.map +1 -0
- package/dist/chunk-H7OWEYH2.cjs +243 -0
- package/dist/chunk-H7OWEYH2.cjs.map +1 -0
- package/dist/{chunk-L2XQQTOY.js → chunk-IGGRLWT5.js} +126 -46
- package/dist/chunk-IGGRLWT5.js.map +1 -0
- package/dist/chunk-J2RZ444H.js +243 -0
- package/dist/chunk-J2RZ444H.js.map +1 -0
- package/dist/chunk-JP5YH3Z4.js +130 -0
- package/dist/chunk-JP5YH3Z4.js.map +1 -0
- package/dist/{parser-N4A7UGDK.cjs → chunk-LHROM2BO.cjs} +1300 -1985
- package/dist/chunk-LHROM2BO.cjs.map +1 -0
- package/dist/chunk-NNDVFNMJ.js +246 -0
- package/dist/chunk-NNDVFNMJ.js.map +1 -0
- package/dist/{chunk-WO52HVQJ.js → chunk-PLIY23LY.js} +2 -2
- package/dist/{chunk-GQVSHGG4.js → chunk-V6U6YS5B.js} +2 -2
- package/dist/{chunk-4KI23VHA.js → chunk-WF2E5P2G.js} +16 -130
- package/dist/chunk-WF2E5P2G.js.map +1 -0
- package/dist/{chunk-AX2R5Q2N.js → chunk-WQLHPOMJ.js} +3 -3
- package/dist/{chunk-37VKMUST.cjs → chunk-XTCT6KQ5.cjs} +34 -148
- package/dist/chunk-XTCT6KQ5.cjs.map +1 -0
- package/dist/chunks-ZQEFAZNC.js +10 -0
- package/dist/cli.js +76 -19
- package/dist/cli.js.map +1 -1
- package/dist/{formula-RXVSQPXI.js → formula-KSNAEBZ2.js} +23 -232
- package/dist/formula-KSNAEBZ2.js.map +1 -0
- package/dist/{formula-5NKVS2LR.cjs → formula-SB3NHDUM.cjs} +30 -240
- package/dist/formula-SB3NHDUM.cjs.map +1 -0
- package/dist/{formula-JCNF43NE.js → formula-SXC6LRRC.js} +23 -233
- package/dist/formula-SXC6LRRC.js.map +1 -0
- package/dist/index.cjs +527 -447
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +7 -3
- package/dist/index.d.ts +7 -3
- package/dist/index.js +129 -49
- package/dist/index.js.map +1 -1
- package/dist/mcp.js +21 -19
- package/dist/mcp.js.map +1 -1
- package/dist/models-KA4GLQK5.js +25 -0
- package/dist/parser-ND2YGQZR.js +800 -0
- package/dist/parser-ND2YGQZR.js.map +1 -0
- package/dist/parser-RBZHA6SY.js +804 -0
- package/dist/parser-RBZHA6SY.js.map +1 -0
- package/dist/parser-WDZOMDG4.cjs +803 -0
- package/dist/parser-WDZOMDG4.cjs.map +1 -0
- package/dist/pdf-ocr-2Z7VZIFI.cjs +439 -0
- package/dist/pdf-ocr-2Z7VZIFI.cjs.map +1 -0
- package/dist/pdf-ocr-FJFXFADQ.js +438 -0
- package/dist/pdf-ocr-FJFXFADQ.js.map +1 -0
- package/dist/pdf-ocr-VYE4DHD4.js +386 -0
- package/dist/pdf-ocr-VYE4DHD4.js.map +1 -0
- package/dist/{profile-io-PLDQFPJA.js → profile-io-TWHDIVPL.js} +3 -3
- package/dist/{rasterize-WWNQLKYW.js → rasterize-W2NEZUSW.js} +2 -2
- package/dist/render-4MG5QUDG.js +10 -0
- package/dist/seal-D2QNXJVO.js +10 -0
- package/dist/seal-D2QNXJVO.js.map +1 -0
- package/dist/{watch-SFHXZALC.js → watch-VWXJZT2R.js} +11 -10
- package/dist/watch-VWXJZT2R.js.map +1 -0
- package/package.json +2 -1
- package/dist/chunk-37VKMUST.cjs.map +0 -1
- package/dist/chunk-4KI23VHA.js.map +0 -1
- package/dist/chunk-L2XQQTOY.js.map +0 -1
- package/dist/chunk-SSTK6IKK.js.map +0 -1
- package/dist/chunk-UOO7LSDG.js.map +0 -1
- package/dist/chunks-WVMGF7JL.js +0 -10
- package/dist/formula-5NKVS2LR.cjs.map +0 -1
- package/dist/formula-JCNF43NE.js.map +0 -1
- package/dist/formula-RXVSQPXI.js.map +0 -1
- package/dist/parser-N4A7UGDK.cjs.map +0 -1
- package/dist/parser-PEOYBXBO.js.map +0 -1
- package/dist/parser-XX4QTDFQ.js.map +0 -1
- package/dist/provider-4FAYHJ6N.cjs +0 -39
- package/dist/provider-4FAYHJ6N.cjs.map +0 -1
- package/dist/provider-C6IOGIS5.js +0 -37
- package/dist/provider-C6IOGIS5.js.map +0 -1
- package/dist/provider-UIBW2MIH.js +0 -39
- package/dist/provider-UIBW2MIH.js.map +0 -1
- package/dist/render-T7S6H6AN.js +0 -10
- package/dist/seal-7PTL6MXH.js +0 -10
- package/dist/watch-SFHXZALC.js.map +0 -1
- /package/dist/{-AS4IABL2.js.map → -SXQIZHYA.js.map} +0 -0
- /package/dist/{chunk-37HJHCPA.js.map → chunk-6SHO3BNV.js.map} +0 -0
- /package/dist/{chunk-F2ZU3IZG.js.map → chunk-ELOV2GIJ.js.map} +0 -0
- /package/dist/{chunk-WO52HVQJ.js.map → chunk-PLIY23LY.js.map} +0 -0
- /package/dist/{chunk-GQVSHGG4.js.map → chunk-V6U6YS5B.js.map} +0 -0
- /package/dist/{chunk-AX2R5Q2N.js.map → chunk-WQLHPOMJ.js.map} +0 -0
- /package/dist/{chunks-WVMGF7JL.js.map → chunks-ZQEFAZNC.js.map} +0 -0
- /package/dist/{profile-io-PLDQFPJA.js.map → models-KA4GLQK5.js.map} +0 -0
- /package/dist/{render-T7S6H6AN.js.map → profile-io-TWHDIVPL.js.map} +0 -0
- /package/dist/{rasterize-WWNQLKYW.js.map → rasterize-W2NEZUSW.js.map} +0 -0
- /package/dist/{seal-7PTL6MXH.js.map → render-4MG5QUDG.js.map} +0 -0
package/dist/index.cjs
CHANGED
|
@@ -8,8 +8,10 @@
|
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
|
|
11
|
+
var _chunkXTCT6KQ5cjs = require('./chunk-XTCT6KQ5.cjs');
|
|
11
12
|
|
|
12
13
|
|
|
14
|
+
var _chunkDCZVOIEOcjs = require('./chunk-DCZVOIEO.cjs');
|
|
13
15
|
|
|
14
16
|
|
|
15
17
|
|
|
@@ -22,10 +24,10 @@
|
|
|
22
24
|
|
|
23
25
|
|
|
24
26
|
|
|
25
|
-
var _chunk37VKMUSTcjs = require('./chunk-37VKMUST.cjs');
|
|
26
27
|
|
|
27
28
|
|
|
28
|
-
|
|
29
|
+
|
|
30
|
+
var _chunkF2HYH62Hcjs = require('./chunk-F2HYH62H.cjs');
|
|
29
31
|
|
|
30
32
|
|
|
31
33
|
var _chunkGS7T56RPcjs = require('./chunk-GS7T56RP.cjs');
|
|
@@ -402,7 +404,7 @@ function comResultToParseResult(pages, pageCount, warnings) {
|
|
|
402
404
|
var _xmldom = require('@xmldom/xmldom');
|
|
403
405
|
var MAX_DECOMPRESS_SIZE = 100 * 1024 * 1024;
|
|
404
406
|
var MAX_ZIP_ENTRIES = 500;
|
|
405
|
-
var ZipBombError = class extends
|
|
407
|
+
var ZipBombError = class extends _chunkF2HYH62Hcjs.KordocError {
|
|
406
408
|
constructor(message) {
|
|
407
409
|
super(message);
|
|
408
410
|
this.name = "ZipBombError";
|
|
@@ -418,7 +420,7 @@ function createSectionShared() {
|
|
|
418
420
|
function createXmlParser(warnings) {
|
|
419
421
|
return new (0, _xmldom.DOMParser)({
|
|
420
422
|
onError(level, msg2) {
|
|
421
|
-
if (level === "fatalError") throw new (0,
|
|
423
|
+
if (level === "fatalError") throw new (0, _chunkF2HYH62Hcjs.KordocError)(`XML \uD30C\uC2F1 \uC2E4\uD328: ${msg2}`);
|
|
422
424
|
_optionalChain([warnings, 'optionalAccess', _3 => _3.push, 'call', _4 => _4({ code: "MALFORMED_XML", message: `XML ${level === "warning" ? "\uACBD\uACE0" : "\uC624\uB958"}: ${msg2}` })]);
|
|
423
425
|
}
|
|
424
426
|
});
|
|
@@ -475,10 +477,10 @@ async function extractHwpxStyles(zip, decompressed) {
|
|
|
475
477
|
const xml = await file.async("text");
|
|
476
478
|
if (decompressed) {
|
|
477
479
|
decompressed.total += xml.length * 2;
|
|
478
|
-
if (decompressed.total > MAX_DECOMPRESS_SIZE) throw new (0,
|
|
480
|
+
if (decompressed.total > MAX_DECOMPRESS_SIZE) throw new (0, _chunkF2HYH62Hcjs.KordocError)("ZIP \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (ZIP bomb \uC758\uC2EC)");
|
|
479
481
|
}
|
|
480
482
|
const parser = createXmlParser();
|
|
481
|
-
const doc = parser.parseFromString(
|
|
483
|
+
const doc = parser.parseFromString(_chunkF2HYH62Hcjs.stripDtd.call(void 0, xml), "text/xml");
|
|
482
484
|
if (!doc.documentElement) continue;
|
|
483
485
|
const domDoc = doc;
|
|
484
486
|
parseCharProperties(domDoc, result.charProperties);
|
|
@@ -661,9 +663,9 @@ function detectHwpxHeadings(blocks, styleMap) {
|
|
|
661
663
|
let level = 0;
|
|
662
664
|
if (baseFontSize > 0 && _optionalChain([block, 'access', _11 => _11.style, 'optionalAccess', _12 => _12.fontSize])) {
|
|
663
665
|
const ratio = block.style.fontSize / baseFontSize;
|
|
664
|
-
if (ratio >=
|
|
665
|
-
else if (ratio >=
|
|
666
|
-
else if (ratio >=
|
|
666
|
+
if (ratio >= _chunkF2HYH62Hcjs.HEADING_RATIO_H1) level = 1;
|
|
667
|
+
else if (ratio >= _chunkF2HYH62Hcjs.HEADING_RATIO_H2) level = 2;
|
|
668
|
+
else if (ratio >= _chunkF2HYH62Hcjs.HEADING_RATIO_H3) level = 3;
|
|
667
669
|
}
|
|
668
670
|
const compactText = text.replace(/\s+/g, "");
|
|
669
671
|
if (/^제\d+[조장절편]/.test(compactText) && text.length <= 50) {
|
|
@@ -1588,7 +1590,7 @@ function needsGaejosikAssets(gongmun) {
|
|
|
1588
1590
|
}
|
|
1589
1591
|
function assertFiniteRange(name, value, min, max) {
|
|
1590
1592
|
if (!Number.isFinite(value) || value < min || value > max) {
|
|
1591
|
-
throw new (0,
|
|
1593
|
+
throw new (0, _chunkF2HYH62Hcjs.KordocError)(`${name} must be a finite number between ${min} and ${max}`);
|
|
1592
1594
|
}
|
|
1593
1595
|
}
|
|
1594
1596
|
function validateGongmunOptions(opts) {
|
|
@@ -1603,10 +1605,10 @@ function validateGongmunOptions(opts) {
|
|
|
1603
1605
|
assertFiniteRange(`margins.${side}`, value, 0, 200);
|
|
1604
1606
|
}
|
|
1605
1607
|
if (opts.margins.left + opts.margins.right >= 210) {
|
|
1606
|
-
throw new (0,
|
|
1608
|
+
throw new (0, _chunkF2HYH62Hcjs.KordocError)("margins.left + margins.right must be less than 210");
|
|
1607
1609
|
}
|
|
1608
1610
|
if (opts.margins.top + opts.margins.bottom >= 297) {
|
|
1609
|
-
throw new (0,
|
|
1611
|
+
throw new (0, _chunkF2HYH62Hcjs.KordocError)("margins.top + margins.bottom must be less than 297");
|
|
1610
1612
|
}
|
|
1611
1613
|
}
|
|
1612
1614
|
if (opts.sizes) {
|
|
@@ -1615,7 +1617,7 @@ function validateGongmunOptions(opts) {
|
|
|
1615
1617
|
}
|
|
1616
1618
|
}
|
|
1617
1619
|
if (opts.approval && opts.approval.length > 6) {
|
|
1618
|
-
throw new (0,
|
|
1620
|
+
throw new (0, _chunkF2HYH62Hcjs.KordocError)("approval must contain at most 6 labels");
|
|
1619
1621
|
}
|
|
1620
1622
|
}
|
|
1621
1623
|
function incompatibleGongmunWarnings(opts) {
|
|
@@ -1880,7 +1882,7 @@ function resolveParaHeading(paraEl, ctx) {
|
|
|
1880
1882
|
|
|
1881
1883
|
// src/hwpx/table-build.ts
|
|
1882
1884
|
function buildTableWithCellMeta(state, keepAnchoredEmptyCols) {
|
|
1883
|
-
const table2 =
|
|
1885
|
+
const table2 = _chunkXTCT6KQ5cjs.buildTable.call(void 0, state.rows, { keepAnchoredEmptyCols });
|
|
1884
1886
|
if (state.caption) table2.caption = state.caption;
|
|
1885
1887
|
const anchors = [];
|
|
1886
1888
|
{
|
|
@@ -1950,7 +1952,7 @@ function completeTable(newTable, tableStack, blocks, ctx) {
|
|
|
1950
1952
|
const cell2 = parentTable.cell;
|
|
1951
1953
|
(cell2.blocks ??= []).push(block);
|
|
1952
1954
|
cell2.hasStructure = true;
|
|
1953
|
-
let flat =
|
|
1955
|
+
let flat = _chunkXTCT6KQ5cjs.convertTableToText.call(void 0, newTable.rows);
|
|
1954
1956
|
if (newTable.caption) flat = newTable.caption + (flat ? "\n" + flat : "");
|
|
1955
1957
|
if (flat) cell2.text += (cell2.text ? "\n" : "") + flat;
|
|
1956
1958
|
} else {
|
|
@@ -1962,7 +1964,7 @@ function completeTable(newTable, tableStack, blocks, ctx) {
|
|
|
1962
1964
|
// src/hwpx/section-walker.ts
|
|
1963
1965
|
function parseSectionXml(xml, styleMap, warnings, sectionNum, shared) {
|
|
1964
1966
|
const parser = createXmlParser(warnings);
|
|
1965
|
-
const doc = parser.parseFromString(
|
|
1967
|
+
const doc = parser.parseFromString(_chunkF2HYH62Hcjs.stripDtd.call(void 0, xml), "text/xml");
|
|
1966
1968
|
if (!doc.documentElement) return [];
|
|
1967
1969
|
const ctx = { styleMap, warnings, sectionNum, shared: _nullishCoalesce(shared, () => ( createSectionShared())) };
|
|
1968
1970
|
ctx.shared.track.deleteDepth = 0;
|
|
@@ -2068,8 +2070,8 @@ function walkSection(node, blocks, tableCtx, tableStack, ctx, depth = 0) {
|
|
|
2068
2070
|
const cs = isNaN(rawCs) ? 1 : rawCs;
|
|
2069
2071
|
const rawRs = parseInt(el.getAttribute("rowSpan") || "1", 10);
|
|
2070
2072
|
const rs = isNaN(rawRs) ? 1 : rawRs;
|
|
2071
|
-
tableCtx.cell.colSpan = clampSpan(cs,
|
|
2072
|
-
tableCtx.cell.rowSpan = clampSpan(rs,
|
|
2073
|
+
tableCtx.cell.colSpan = clampSpan(cs, _chunkXTCT6KQ5cjs.MAX_COLS);
|
|
2074
|
+
tableCtx.cell.rowSpan = clampSpan(rs, _chunkXTCT6KQ5cjs.MAX_ROWS);
|
|
2073
2075
|
}
|
|
2074
2076
|
break;
|
|
2075
2077
|
case "p": {
|
|
@@ -2235,6 +2237,19 @@ function findKordocMarkedCell(el, depth) {
|
|
|
2235
2237
|
}
|
|
2236
2238
|
return null;
|
|
2237
2239
|
}
|
|
2240
|
+
function hasPageAutoNum(el, depth = 0) {
|
|
2241
|
+
if (depth > 10) return false;
|
|
2242
|
+
const children = el.childNodes;
|
|
2243
|
+
if (!children) return false;
|
|
2244
|
+
for (let i = 0; i < children.length; i++) {
|
|
2245
|
+
const ch = children[i];
|
|
2246
|
+
if (ch.nodeType !== 1) continue;
|
|
2247
|
+
const tag = (ch.tagName || ch.localName || "").replace(/^[^:]+:/, "");
|
|
2248
|
+
if (tag === "autoNum" && _optionalChain([ch, 'access', _44 => _44.getAttribute, 'optionalCall', _45 => _45("numType")]) === "PAGE") return true;
|
|
2249
|
+
if (hasPageAutoNum(ch, depth + 1)) return true;
|
|
2250
|
+
}
|
|
2251
|
+
return false;
|
|
2252
|
+
}
|
|
2238
2253
|
function collectSubListText(el, ctx, depth = 0) {
|
|
2239
2254
|
if (depth > 10) return "";
|
|
2240
2255
|
const parts = [];
|
|
@@ -2267,7 +2282,7 @@ function flattenSubListTable(el, ctx, depth) {
|
|
|
2267
2282
|
const sink = [];
|
|
2268
2283
|
const st = { rows: [], currentRow: [], cell: null };
|
|
2269
2284
|
walkSection(el, sink, st, [], ctx, depth + 1);
|
|
2270
|
-
let flat =
|
|
2285
|
+
let flat = _chunkXTCT6KQ5cjs.convertTableToText.call(void 0, st.rows);
|
|
2271
2286
|
if (st.caption) flat = st.caption + (flat ? "\n" + flat : "");
|
|
2272
2287
|
return flat;
|
|
2273
2288
|
}
|
|
@@ -2316,12 +2331,12 @@ function walkParagraphChildren(node, blocks, tableCtx, tableStack, ctx, depth =
|
|
|
2316
2331
|
} else if (localTag === "caption" && !inShape) {
|
|
2317
2332
|
const capText = collectSubListText(el, ctx);
|
|
2318
2333
|
if (capText) {
|
|
2319
|
-
if (_optionalChain([tableCtx, 'optionalAccess',
|
|
2334
|
+
if (_optionalChain([tableCtx, 'optionalAccess', _46 => _46.cell])) mergeBlocksIntoCell(tableCtx.cell, [{ type: "paragraph", text: capText, pageNumber: ctx.sectionNum }]);
|
|
2320
2335
|
else if (tableCtx) tableCtx.caption = (tableCtx.caption ? tableCtx.caption + "\n" : "") + capText;
|
|
2321
2336
|
else blocks.push({ type: "paragraph", text: capText, pageNumber: ctx.sectionNum });
|
|
2322
2337
|
}
|
|
2323
2338
|
} else if (localTag === "pic" || localTag === "shape" || localTag === "drawingObject") {
|
|
2324
|
-
if (_optionalChain([tableCtx, 'optionalAccess',
|
|
2339
|
+
if (_optionalChain([tableCtx, 'optionalAccess', _47 => _47.cell])) {
|
|
2325
2340
|
const sink = [];
|
|
2326
2341
|
handleShape(el, sink, ctx);
|
|
2327
2342
|
mergeBlocksIntoCell(tableCtx.cell, sink);
|
|
@@ -2329,7 +2344,7 @@ function walkParagraphChildren(node, blocks, tableCtx, tableStack, ctx, depth =
|
|
|
2329
2344
|
handleShape(el, blocks, ctx);
|
|
2330
2345
|
}
|
|
2331
2346
|
} else if (localTag === "drawText") {
|
|
2332
|
-
if (_optionalChain([tableCtx, 'optionalAccess',
|
|
2347
|
+
if (_optionalChain([tableCtx, 'optionalAccess', _48 => _48.cell])) {
|
|
2333
2348
|
const sink = [];
|
|
2334
2349
|
extractDrawTextBlocks(el, sink, ctx);
|
|
2335
2350
|
mergeBlocksIntoCell(tableCtx.cell, sink);
|
|
@@ -2375,7 +2390,7 @@ function extractDrawTextBlocks(drawTextNode, blocks, ctx) {
|
|
|
2375
2390
|
let text = info.text.trim();
|
|
2376
2391
|
const ph = resolveParaHeading(child, ctx);
|
|
2377
2392
|
if (text) {
|
|
2378
|
-
if (_optionalChain([ph, 'optionalAccess',
|
|
2393
|
+
if (_optionalChain([ph, 'optionalAccess', _49 => _49.prefix])) text = ph.prefix + " " + text;
|
|
2379
2394
|
const block = { type: "paragraph", text, style: _nullishCoalesce(info.style, () => ( void 0)), pageNumber: ctx.sectionNum };
|
|
2380
2395
|
if (info.href) block.href = info.href;
|
|
2381
2396
|
if (info.footnote) block.footnoteText = info.footnote;
|
|
@@ -2400,19 +2415,35 @@ function extractHyperlinkHref(fieldBegin) {
|
|
|
2400
2415
|
let url = (ch.textContent || "").trim();
|
|
2401
2416
|
if (!url) continue;
|
|
2402
2417
|
url = url.replace(/^https?:\/\/(?=https?:\/\/)/i, "");
|
|
2403
|
-
const safe =
|
|
2418
|
+
const safe = _chunkF2HYH62Hcjs.sanitizeHref.call(void 0, url);
|
|
2404
2419
|
if (safe) return safe;
|
|
2405
2420
|
}
|
|
2406
2421
|
return void 0;
|
|
2407
2422
|
}
|
|
2408
2423
|
function isInDeletedRange(ctx) {
|
|
2409
|
-
return (_nullishCoalesce(_optionalChain([ctx, 'optionalAccess',
|
|
2424
|
+
return (_nullishCoalesce(_optionalChain([ctx, 'optionalAccess', _50 => _50.shared, 'access', _51 => _51.track, 'access', _52 => _52.deleteDepth]), () => ( 0))) > 0;
|
|
2410
2425
|
}
|
|
2411
2426
|
function extractParagraphInfo(para2, styleMap, ctx) {
|
|
2412
2427
|
let text = "";
|
|
2413
2428
|
let href;
|
|
2414
2429
|
let footnote;
|
|
2415
2430
|
let charPrId;
|
|
2431
|
+
const linkRanges = [];
|
|
2432
|
+
const openFields = [];
|
|
2433
|
+
const onFieldBegin = (el) => {
|
|
2434
|
+
const url = extractHyperlinkHref(el);
|
|
2435
|
+
if (url) {
|
|
2436
|
+
linkRanges.push({ url, start: text.length });
|
|
2437
|
+
openFields.push({ rangeIdx: linkRanges.length - 1 });
|
|
2438
|
+
if (!href) href = url;
|
|
2439
|
+
} else {
|
|
2440
|
+
openFields.push({});
|
|
2441
|
+
}
|
|
2442
|
+
};
|
|
2443
|
+
const onFieldEnd = () => {
|
|
2444
|
+
const open = openFields.pop();
|
|
2445
|
+
if (_optionalChain([open, 'optionalAccess', _53 => _53.rangeIdx]) !== void 0) linkRanges[open.rangeIdx].end = text.length;
|
|
2446
|
+
};
|
|
2416
2447
|
const handleCtrl = (ctrlEl) => {
|
|
2417
2448
|
const kids2 = ctrlEl.childNodes;
|
|
2418
2449
|
if (!kids2) return;
|
|
@@ -2422,10 +2453,13 @@ function extractParagraphInfo(para2, styleMap, ctx) {
|
|
|
2422
2453
|
const ktag = (k.tagName || k.localName || "").replace(/^[^:]+:/, "");
|
|
2423
2454
|
switch (ktag) {
|
|
2424
2455
|
// 머리말/꼬리말 — 문서당 1회 수집, 본문 앞/뒤 배치
|
|
2456
|
+
// 페이지 번호 크롬(autoNum PAGE + 문자 없는 잔여 텍스트, 예: "- 1 -")은 본문 정보가
|
|
2457
|
+
// 아니므로 방출하지 않는다
|
|
2425
2458
|
case "header":
|
|
2426
2459
|
case "footer": {
|
|
2427
2460
|
if (!ctx) break;
|
|
2428
2461
|
const t = collectSubListText(k, ctx);
|
|
2462
|
+
if (t && hasPageAutoNum(k) && !/\p{L}/u.test(t)) break;
|
|
2429
2463
|
if (t) {
|
|
2430
2464
|
const bucket = ktag === "header" ? ctx.shared.pageText.headers : ctx.shared.pageText.footers;
|
|
2431
2465
|
if (!bucket.includes(t)) bucket.push(t);
|
|
@@ -2439,13 +2473,12 @@ function extractParagraphInfo(para2, styleMap, ctx) {
|
|
|
2439
2473
|
if (noteText) footnote = (footnote ? footnote + "; " : "") + noteText;
|
|
2440
2474
|
break;
|
|
2441
2475
|
}
|
|
2442
|
-
// 하이퍼링크 — fieldBegin type=HYPERLINK의 Path 파라미터
|
|
2443
|
-
case "fieldBegin":
|
|
2444
|
-
|
|
2445
|
-
if (url && !href) href = url;
|
|
2476
|
+
// 하이퍼링크 — fieldBegin type=HYPERLINK의 Path 파라미터 (extent 오프셋 추적)
|
|
2477
|
+
case "fieldBegin":
|
|
2478
|
+
onFieldBegin(k);
|
|
2446
2479
|
break;
|
|
2447
|
-
}
|
|
2448
2480
|
case "fieldEnd":
|
|
2481
|
+
onFieldEnd();
|
|
2449
2482
|
break;
|
|
2450
2483
|
// 변경추적 — 삭제 구간(deleteBegin~End)의 텍스트는 출력 제외 (최종본 상태 재현)
|
|
2451
2484
|
case "deleteBegin":
|
|
@@ -2460,7 +2493,7 @@ function extractParagraphInfo(para2, styleMap, ctx) {
|
|
|
2460
2493
|
// 삽입분은 최종본에 포함
|
|
2461
2494
|
// 숨은 설명 — 본문 혼입 차단
|
|
2462
2495
|
case "hiddenComment": {
|
|
2463
|
-
if (_optionalChain([ctx, 'optionalAccess',
|
|
2496
|
+
if (_optionalChain([ctx, 'optionalAccess', _54 => _54.warnings]) && extractTextFromNode(k)) {
|
|
2464
2497
|
ctx.warnings.push({ page: ctx.sectionNum, message: "\uC228\uC740 \uC124\uBA85 \uD14D\uC2A4\uD2B8 \uC81C\uC678: hiddenComment", code: "HIDDEN_TEXT_FILTERED" });
|
|
2465
2498
|
}
|
|
2466
2499
|
break;
|
|
@@ -2480,7 +2513,7 @@ function extractParagraphInfo(para2, styleMap, ctx) {
|
|
|
2480
2513
|
break;
|
|
2481
2514
|
// 미지원 요소 — 텍스트를 가졌으면 무음 손실 대신 경고
|
|
2482
2515
|
default: {
|
|
2483
|
-
if (_optionalChain([ctx, 'optionalAccess',
|
|
2516
|
+
if (_optionalChain([ctx, 'optionalAccess', _55 => _55.warnings]) && extractTextFromNode(k)) {
|
|
2484
2517
|
ctx.warnings.push({ page: ctx.sectionNum, message: `\uBBF8\uC9C0\uC6D0 \uC81C\uC5B4 \uC694\uC18C\uC758 \uD14D\uC2A4\uD2B8 \uC190\uC2E4: ${ktag}`, code: "UNSUPPORTED_ELEMENT" });
|
|
2485
2518
|
}
|
|
2486
2519
|
}
|
|
@@ -2498,7 +2531,7 @@ function extractParagraphInfo(para2, styleMap, ctx) {
|
|
|
2498
2531
|
if (isInDeletedRange(ctx)) {
|
|
2499
2532
|
if (t && ctx && !ctx.shared.track.warned) {
|
|
2500
2533
|
ctx.shared.track.warned = true;
|
|
2501
|
-
_optionalChain([ctx, 'access',
|
|
2534
|
+
_optionalChain([ctx, 'access', _56 => _56.warnings, 'optionalAccess', _57 => _57.push, 'call', _58 => _58({ page: ctx.sectionNum, message: "\uBCC0\uACBD\uCD94\uC801 \uC0AD\uC81C \uD14D\uC2A4\uD2B8 \uCD9C\uB825 \uC81C\uC678", code: "HIDDEN_TEXT_FILTERED" })]);
|
|
2502
2535
|
}
|
|
2503
2536
|
} else {
|
|
2504
2537
|
text += t;
|
|
@@ -2539,7 +2572,7 @@ function extractParagraphInfo(para2, styleMap, ctx) {
|
|
|
2539
2572
|
case "hyperlink": {
|
|
2540
2573
|
const url = child.getAttribute("url") || child.getAttribute("href") || "";
|
|
2541
2574
|
if (url) {
|
|
2542
|
-
const safe =
|
|
2575
|
+
const safe = _chunkF2HYH62Hcjs.sanitizeHref.call(void 0, url);
|
|
2543
2576
|
if (safe) href = safe;
|
|
2544
2577
|
}
|
|
2545
2578
|
walk(child, depth + 1);
|
|
@@ -2558,12 +2591,10 @@ function extractParagraphInfo(para2, styleMap, ctx) {
|
|
|
2558
2591
|
case "ctrl":
|
|
2559
2592
|
handleCtrl(child);
|
|
2560
2593
|
break;
|
|
2561
|
-
// run 직계 fieldBegin (비표준 경로) — 하이퍼링크 URL
|
|
2562
|
-
case "fieldBegin":
|
|
2563
|
-
|
|
2564
|
-
if (url && !href) href = url;
|
|
2594
|
+
// run 직계 fieldBegin (비표준 경로) — 하이퍼링크 URL·extent 추적
|
|
2595
|
+
case "fieldBegin":
|
|
2596
|
+
onFieldBegin(child);
|
|
2565
2597
|
break;
|
|
2566
|
-
}
|
|
2567
2598
|
// run 직계 변경추적 마커 (비표준 경로)
|
|
2568
2599
|
case "deleteBegin":
|
|
2569
2600
|
if (ctx) ctx.shared.track.deleteDepth++;
|
|
@@ -2575,6 +2606,8 @@ function extractParagraphInfo(para2, styleMap, ctx) {
|
|
|
2575
2606
|
case "insertEnd":
|
|
2576
2607
|
break;
|
|
2577
2608
|
case "fieldEnd":
|
|
2609
|
+
onFieldEnd();
|
|
2610
|
+
break;
|
|
2578
2611
|
case "parameters":
|
|
2579
2612
|
case "stringParam":
|
|
2580
2613
|
case "integerParam":
|
|
@@ -2623,6 +2656,18 @@ function extractParagraphInfo(para2, styleMap, ctx) {
|
|
|
2623
2656
|
}
|
|
2624
2657
|
};
|
|
2625
2658
|
walk(para2);
|
|
2659
|
+
{
|
|
2660
|
+
const applied = [];
|
|
2661
|
+
const closed = linkRanges.filter((r) => r.end !== void 0 && r.end > r.start).sort((a, b) => b.start - a.start);
|
|
2662
|
+
for (const r of closed) {
|
|
2663
|
+
if (applied.some(([s, e]) => r.start < e && r.end > s)) continue;
|
|
2664
|
+
const anchor = text.slice(r.start, r.end);
|
|
2665
|
+
if (!anchor.trim() || /[\n\x1F\[\]]/.test(anchor)) continue;
|
|
2666
|
+
text = text.slice(0, r.start) + `[${anchor}](${r.url})` + text.slice(r.end);
|
|
2667
|
+
applied.push([r.start, r.end]);
|
|
2668
|
+
}
|
|
2669
|
+
if (applied.length) href = void 0;
|
|
2670
|
+
}
|
|
2626
2671
|
const leaderIdx = text.indexOf("");
|
|
2627
2672
|
if (leaderIdx >= 0) text = text.substring(0, leaderIdx);
|
|
2628
2673
|
let cleanText = text.replace(/[ \t]+/g, " ").trim();
|
|
@@ -2666,13 +2711,13 @@ function extractRunSpans(para2, ctx, mode, requireMixed) {
|
|
|
2666
2711
|
if (tag !== "run" && tag !== "r") return null;
|
|
2667
2712
|
let text = "";
|
|
2668
2713
|
const rkids = child.childNodes;
|
|
2669
|
-
for (let j = 0; j < (_nullishCoalesce(_optionalChain([rkids, 'optionalAccess',
|
|
2714
|
+
for (let j = 0; j < (_nullishCoalesce(_optionalChain([rkids, 'optionalAccess', _59 => _59.length]), () => ( 0))); j++) {
|
|
2670
2715
|
const rc = rkids[j];
|
|
2671
2716
|
if (rc.nodeType !== 1) continue;
|
|
2672
2717
|
const rtag = (rc.tagName || rc.localName || "").replace(/^[^:]+:/, "");
|
|
2673
2718
|
if (rtag === "t") {
|
|
2674
2719
|
const tkids = rc.childNodes;
|
|
2675
|
-
for (let k = 0; k < (_nullishCoalesce(_optionalChain([tkids, 'optionalAccess',
|
|
2720
|
+
for (let k = 0; k < (_nullishCoalesce(_optionalChain([tkids, 'optionalAccess', _60 => _60.length]), () => ( 0))); k++) {
|
|
2676
2721
|
const tk = tkids[k];
|
|
2677
2722
|
if (tk.nodeType === 3) text += tk.textContent || "";
|
|
2678
2723
|
else if (tk.nodeType === 1) return null;
|
|
@@ -2690,8 +2735,8 @@ function extractRunSpans(para2, ctx, mode, requireMixed) {
|
|
|
2690
2735
|
const span = { text };
|
|
2691
2736
|
if (mode !== "foreign" && prId === KORDOC_CHAR_CODE) span.code = true;
|
|
2692
2737
|
else {
|
|
2693
|
-
if (_optionalChain([cp, 'optionalAccess',
|
|
2694
|
-
if (_optionalChain([cp, 'optionalAccess',
|
|
2738
|
+
if (_optionalChain([cp, 'optionalAccess', _61 => _61.bold])) span.bold = true;
|
|
2739
|
+
if (_optionalChain([cp, 'optionalAccess', _62 => _62.italic])) span.italic = true;
|
|
2695
2740
|
}
|
|
2696
2741
|
if (span.bold || span.italic || span.code) styled = true;
|
|
2697
2742
|
spans.push(span);
|
|
@@ -2714,12 +2759,12 @@ function gongmunDepthFromIndent(para2, left, ctx) {
|
|
|
2714
2759
|
if (!styleMap) return null;
|
|
2715
2760
|
let unit = 0;
|
|
2716
2761
|
const kids2 = para2.childNodes;
|
|
2717
|
-
for (let i = 0; i < (_nullishCoalesce(_optionalChain([kids2, 'optionalAccess',
|
|
2762
|
+
for (let i = 0; i < (_nullishCoalesce(_optionalChain([kids2, 'optionalAccess', _63 => _63.length]), () => ( 0))); i++) {
|
|
2718
2763
|
const child = kids2[i];
|
|
2719
2764
|
if (child.nodeType !== 1) continue;
|
|
2720
2765
|
const tag = (child.tagName || child.localName || "").replace(/^[^:]+:/, "");
|
|
2721
2766
|
if (tag !== "run" && tag !== "r") continue;
|
|
2722
|
-
const size = _optionalChain([styleMap, 'access',
|
|
2767
|
+
const size = _optionalChain([styleMap, 'access', _64 => _64.charProperties, 'access', _65 => _65.get, 'call', _66 => _66(_nullishCoalesce(child.getAttribute("charPrIDRef"), () => ( ""))), 'optionalAccess', _67 => _67.fontSize]);
|
|
2723
2768
|
if (size) unit = size * 100;
|
|
2724
2769
|
break;
|
|
2725
2770
|
}
|
|
@@ -2792,7 +2837,7 @@ function decompressStream(data) {
|
|
|
2792
2837
|
return _zlib.inflateRawSync.call(void 0, data, opts);
|
|
2793
2838
|
}
|
|
2794
2839
|
function parseFileHeader(data) {
|
|
2795
|
-
if (data.length < 40) throw new (0,
|
|
2840
|
+
if (data.length < 40) throw new (0, _chunkF2HYH62Hcjs.KordocError)("FileHeader\uAC00 \uB108\uBB34 \uC9E7\uC2B5\uB2C8\uB2E4 (\uCD5C\uC18C 40\uBC14\uC774\uD2B8)");
|
|
2796
2841
|
const sig = data.subarray(0, 32).toString("utf8").replace(/\0+$/, "");
|
|
2797
2842
|
return {
|
|
2798
2843
|
signature: sig,
|
|
@@ -2925,7 +2970,7 @@ function appendParaText(state, data, resolveControl) {
|
|
|
2925
2970
|
const resolveAt = (byteOffset, extended) => {
|
|
2926
2971
|
const ctrlId = data.readUInt32LE(byteOffset);
|
|
2927
2972
|
const idx = extended ? state.ctrlIdx : -1;
|
|
2928
|
-
const replacement = _optionalChain([resolveControl, 'optionalCall',
|
|
2973
|
+
const replacement = _optionalChain([resolveControl, 'optionalCall', _68 => _68(idx, ctrlId)]);
|
|
2929
2974
|
if (replacement) result += replacement;
|
|
2930
2975
|
if (extended) state.ctrlIdx++;
|
|
2931
2976
|
};
|
|
@@ -3127,7 +3172,7 @@ function extractHwp5Images(fileIndex, blocks, warnings, sweepUnreferenced) {
|
|
|
3127
3172
|
const binDataMap = /* @__PURE__ */ new Map();
|
|
3128
3173
|
if (fileIndex) {
|
|
3129
3174
|
for (const entry of fileIndex) {
|
|
3130
|
-
if (!_optionalChain([entry, 'optionalAccess',
|
|
3175
|
+
if (!_optionalChain([entry, 'optionalAccess', _69 => _69.name]) || !entry.content) continue;
|
|
3131
3176
|
const match = entry.name.match(BIN_ENTRY_RE);
|
|
3132
3177
|
if (!match) continue;
|
|
3133
3178
|
const idx = parseInt(match[1], 16);
|
|
@@ -3203,7 +3248,7 @@ function collectImageBlocks2(blocks, out, ownerCell, depth = 0) {
|
|
|
3203
3248
|
} else if (block.type === "table" && block.table) {
|
|
3204
3249
|
for (const row of block.table.cells) {
|
|
3205
3250
|
for (const cell2 of row) {
|
|
3206
|
-
if (_optionalChain([cell2, 'access',
|
|
3251
|
+
if (_optionalChain([cell2, 'access', _70 => _70.blocks, 'optionalAccess', _71 => _71.length])) collectImageBlocks2(cell2.blocks, out, cell2, depth + 1);
|
|
3207
3252
|
}
|
|
3208
3253
|
}
|
|
3209
3254
|
}
|
|
@@ -3241,13 +3286,13 @@ async function extractImagesFromZip(zip, blocks, decompressed, warnings, sweepUn
|
|
|
3241
3286
|
}
|
|
3242
3287
|
const allCandidates = resolvedPath ? [resolvedPath, ...candidates] : candidates;
|
|
3243
3288
|
for (const path of allCandidates) {
|
|
3244
|
-
if (
|
|
3289
|
+
if (_chunkF2HYH62Hcjs.isPathTraversal.call(void 0, path)) continue;
|
|
3245
3290
|
const file = zip.file(path);
|
|
3246
3291
|
if (!file) continue;
|
|
3247
3292
|
try {
|
|
3248
3293
|
const data = await file.async("uint8array");
|
|
3249
3294
|
decompressed.total += data.length;
|
|
3250
|
-
if (decompressed.total > MAX_DECOMPRESS_SIZE) throw new (0,
|
|
3295
|
+
if (decompressed.total > MAX_DECOMPRESS_SIZE) throw new (0, _chunkF2HYH62Hcjs.KordocError)("ZIP \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (ZIP bomb \uC758\uC2EC)");
|
|
3251
3296
|
const ext = path.includes(".") ? path.split(".").pop() || "png" : "png";
|
|
3252
3297
|
const mimeType = imageExtToMime(ext);
|
|
3253
3298
|
imageIndex++;
|
|
@@ -3257,10 +3302,10 @@ async function extractImagesFromZip(zip, blocks, decompressed, warnings, sweepUn
|
|
|
3257
3302
|
usedPaths.add(path);
|
|
3258
3303
|
break;
|
|
3259
3304
|
} catch (err) {
|
|
3260
|
-
if (err instanceof
|
|
3305
|
+
if (err instanceof _chunkF2HYH62Hcjs.KordocError) throw err;
|
|
3261
3306
|
}
|
|
3262
3307
|
}
|
|
3263
|
-
if (!img) _optionalChain([warnings, 'optionalAccess',
|
|
3308
|
+
if (!img) _optionalChain([warnings, 'optionalAccess', _72 => _72.push, 'call', _73 => _73({ page: block.pageNumber, message: `\uC774\uBBF8\uC9C0 \uD30C\uC77C \uC5C6\uC74C: ${ref}`, code: "SKIPPED_IMAGE" })]);
|
|
3264
3309
|
resolved.set(ref, img);
|
|
3265
3310
|
}
|
|
3266
3311
|
if (!img) {
|
|
@@ -3277,11 +3322,11 @@ async function extractImagesFromZip(zip, blocks, decompressed, warnings, sweepUn
|
|
|
3277
3322
|
if (sweepUnreferenced) {
|
|
3278
3323
|
const binEntries = zip.file(/(?:^|\/)BinData\//i);
|
|
3279
3324
|
for (const file of binEntries) {
|
|
3280
|
-
if (file.dir || usedPaths.has(file.name) ||
|
|
3325
|
+
if (file.dir || usedPaths.has(file.name) || _chunkF2HYH62Hcjs.isPathTraversal.call(void 0, file.name)) continue;
|
|
3281
3326
|
try {
|
|
3282
3327
|
const data = await file.async("uint8array");
|
|
3283
3328
|
decompressed.total += data.length;
|
|
3284
|
-
if (decompressed.total > MAX_DECOMPRESS_SIZE) throw new (0,
|
|
3329
|
+
if (decompressed.total > MAX_DECOMPRESS_SIZE) throw new (0, _chunkF2HYH62Hcjs.KordocError)("ZIP \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (ZIP bomb \uC758\uC2EC)");
|
|
3285
3330
|
const ext = file.name.includes(".") ? file.name.split(".").pop() || "" : "";
|
|
3286
3331
|
let mimeType = imageExtToMime(ext);
|
|
3287
3332
|
if (mimeType === "application/octet-stream") {
|
|
@@ -3295,8 +3340,8 @@ async function extractImagesFromZip(zip, blocks, decompressed, warnings, sweepUn
|
|
|
3295
3340
|
images.push(img);
|
|
3296
3341
|
blocks.push({ type: "image", text: filename, imageData: { data, mimeType, filename: file.name } });
|
|
3297
3342
|
} catch (err) {
|
|
3298
|
-
if (err instanceof
|
|
3299
|
-
_optionalChain([warnings, 'optionalAccess',
|
|
3343
|
+
if (err instanceof _chunkF2HYH62Hcjs.KordocError) throw err;
|
|
3344
|
+
_optionalChain([warnings, 'optionalAccess', _74 => _74.push, 'call', _75 => _75({ message: `\uC774\uBBF8\uC9C0 \uCD94\uCD9C \uC2E4\uD328: ${file.name}`, code: "SKIPPED_IMAGE" })]);
|
|
3300
3345
|
}
|
|
3301
3346
|
}
|
|
3302
3347
|
}
|
|
@@ -3346,7 +3391,7 @@ function extractFromBrokenZip(buffer) {
|
|
|
3346
3391
|
}
|
|
3347
3392
|
const nameBytes = data.slice(pos + 30, pos + 30 + nameLen);
|
|
3348
3393
|
const name = new TextDecoder().decode(nameBytes);
|
|
3349
|
-
if (
|
|
3394
|
+
if (_chunkF2HYH62Hcjs.isPathTraversal.call(void 0, name)) {
|
|
3350
3395
|
pos = fileStart + compSize;
|
|
3351
3396
|
continue;
|
|
3352
3397
|
}
|
|
@@ -3364,16 +3409,16 @@ function extractFromBrokenZip(buffer) {
|
|
|
3364
3409
|
continue;
|
|
3365
3410
|
}
|
|
3366
3411
|
totalDecompressed += content.length * 2;
|
|
3367
|
-
if (totalDecompressed > MAX_DECOMPRESS_SIZE) throw new (0,
|
|
3412
|
+
if (totalDecompressed > MAX_DECOMPRESS_SIZE) throw new (0, _chunkF2HYH62Hcjs.KordocError)("\uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC");
|
|
3368
3413
|
sectionNum++;
|
|
3369
3414
|
blocks.push(...parseSectionXml(content, void 0, warnings, sectionNum, shared));
|
|
3370
3415
|
} catch (e16) {
|
|
3371
3416
|
continue;
|
|
3372
3417
|
}
|
|
3373
3418
|
}
|
|
3374
|
-
if (blocks.length === 0) throw new (0,
|
|
3419
|
+
if (blocks.length === 0) throw new (0, _chunkF2HYH62Hcjs.KordocError)("\uC190\uC0C1\uB41C HWPX\uC5D0\uC11C \uC139\uC158 \uB370\uC774\uD130\uB97C \uBCF5\uAD6C\uD560 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
3375
3420
|
applyPageText(blocks, shared);
|
|
3376
|
-
const markdown =
|
|
3421
|
+
const markdown = _chunkXTCT6KQ5cjs.blocksToMarkdown.call(void 0, blocks);
|
|
3377
3422
|
return { markdown, blocks, warnings: warnings.length > 0 ? warnings : void 0 };
|
|
3378
3423
|
}
|
|
3379
3424
|
async function readKordocLayout(zip) {
|
|
@@ -3382,7 +3427,7 @@ async function readKordocLayout(zip) {
|
|
|
3382
3427
|
try {
|
|
3383
3428
|
const xml = await file.async("text");
|
|
3384
3429
|
if (!/<opf:meta\b[^>]*name="generator"[^>]*content="kordoc"/.test(xml)) return null;
|
|
3385
|
-
return _nullishCoalesce(_optionalChain([xml, 'access',
|
|
3430
|
+
return _nullishCoalesce(_optionalChain([xml, 'access', _76 => _76.match, 'call', _77 => _77(/<opf:meta\b[^>]*name="kordoc-layout"[^>]*content="([^"]*)"/), 'optionalAccess', _78 => _78[1]]), () => ( null));
|
|
3386
3431
|
} catch (e17) {
|
|
3387
3432
|
return null;
|
|
3388
3433
|
}
|
|
@@ -3398,18 +3443,18 @@ async function resolveSectionPaths(zip) {
|
|
|
3398
3443
|
if (paths.length > 0) return paths;
|
|
3399
3444
|
}
|
|
3400
3445
|
const sectionFiles = zip.file(/[Ss]ection\d+\.xml$/);
|
|
3401
|
-
return sectionFiles.map((f) => f.name).sort(
|
|
3446
|
+
return sectionFiles.map((f) => f.name).sort(_chunkF2HYH62Hcjs.compareSectionPaths);
|
|
3402
3447
|
}
|
|
3403
3448
|
function parseSectionPathsFromManifest(xml) {
|
|
3404
3449
|
const parser = createXmlParser();
|
|
3405
|
-
const doc = parser.parseFromString(
|
|
3450
|
+
const doc = parser.parseFromString(_chunkF2HYH62Hcjs.stripDtd.call(void 0, xml), "text/xml");
|
|
3406
3451
|
const items = doc.getElementsByTagName("opf:item");
|
|
3407
3452
|
const spine = doc.getElementsByTagName("opf:itemref");
|
|
3408
3453
|
const idToHref = /* @__PURE__ */ new Map();
|
|
3409
3454
|
for (let i = 0; i < items.length; i++) {
|
|
3410
3455
|
const item = items[i];
|
|
3411
3456
|
const id = item.getAttribute("id") || "";
|
|
3412
|
-
const href =
|
|
3457
|
+
const href = _chunkF2HYH62Hcjs.normalizeSectionHref.call(void 0, item.getAttribute("href") || "");
|
|
3413
3458
|
if (id && href) idToHref.set(id, href);
|
|
3414
3459
|
}
|
|
3415
3460
|
if (spine.length > 0) {
|
|
@@ -3420,7 +3465,7 @@ function parseSectionPathsFromManifest(xml) {
|
|
|
3420
3465
|
}
|
|
3421
3466
|
if (ordered.length > 0) return ordered;
|
|
3422
3467
|
}
|
|
3423
|
-
return Array.from(idToHref.values()).sort(
|
|
3468
|
+
return Array.from(idToHref.values()).sort(_chunkF2HYH62Hcjs.compareSectionPaths);
|
|
3424
3469
|
}
|
|
3425
3470
|
|
|
3426
3471
|
// src/hwpx/metadata.ts
|
|
@@ -3433,7 +3478,7 @@ async function extractHwpxMetadata(zip, metadata, decompressed) {
|
|
|
3433
3478
|
const xml = await file.async("text");
|
|
3434
3479
|
if (decompressed) {
|
|
3435
3480
|
decompressed.total += xml.length * 2;
|
|
3436
|
-
if (decompressed.total > MAX_DECOMPRESS_SIZE) throw new (0,
|
|
3481
|
+
if (decompressed.total > MAX_DECOMPRESS_SIZE) throw new (0, _chunkF2HYH62Hcjs.KordocError)("ZIP \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (ZIP bomb \uC758\uC2EC)");
|
|
3437
3482
|
}
|
|
3438
3483
|
parseDublinCoreMetadata(xml, metadata);
|
|
3439
3484
|
if (metadata.title || metadata.author) return;
|
|
@@ -3443,13 +3488,13 @@ async function extractHwpxMetadata(zip, metadata, decompressed) {
|
|
|
3443
3488
|
}
|
|
3444
3489
|
function parseDublinCoreMetadata(xml, metadata) {
|
|
3445
3490
|
const parser = createXmlParser();
|
|
3446
|
-
const doc = parser.parseFromString(
|
|
3491
|
+
const doc = parser.parseFromString(_chunkF2HYH62Hcjs.stripDtd.call(void 0, xml), "text/xml");
|
|
3447
3492
|
if (!doc.documentElement) return;
|
|
3448
3493
|
const getText = (tagNames) => {
|
|
3449
3494
|
for (const tag of tagNames) {
|
|
3450
3495
|
const els = doc.getElementsByTagName(tag);
|
|
3451
3496
|
if (els.length > 0) {
|
|
3452
|
-
const text = _optionalChain([els, 'access',
|
|
3497
|
+
const text = _optionalChain([els, 'access', _79 => _79[0], 'access', _80 => _80.textContent, 'optionalAccess', _81 => _81.trim, 'call', _82 => _82()]);
|
|
3453
3498
|
if (text) return text;
|
|
3454
3499
|
}
|
|
3455
3500
|
}
|
|
@@ -3468,7 +3513,7 @@ function parseDublinCoreMetadata(xml, metadata) {
|
|
|
3468
3513
|
|
|
3469
3514
|
// src/hwpx/parser.ts
|
|
3470
3515
|
async function parseHwpxDocument(buffer, options) {
|
|
3471
|
-
|
|
3516
|
+
_chunkF2HYH62Hcjs.precheckZipSize.call(void 0, buffer, MAX_DECOMPRESS_SIZE, MAX_ZIP_ENTRIES);
|
|
3472
3517
|
let zip;
|
|
3473
3518
|
try {
|
|
3474
3519
|
zip = await _jszip2.default.loadAsync(buffer);
|
|
@@ -3477,19 +3522,19 @@ async function parseHwpxDocument(buffer, options) {
|
|
|
3477
3522
|
}
|
|
3478
3523
|
const actualEntryCount = Object.keys(zip.files).length;
|
|
3479
3524
|
if (actualEntryCount > MAX_ZIP_ENTRIES) {
|
|
3480
|
-
throw new (0,
|
|
3525
|
+
throw new (0, _chunkF2HYH62Hcjs.KordocError)("ZIP \uC5D4\uD2B8\uB9AC \uC218 \uCD08\uACFC (ZIP bomb \uC758\uC2EC)");
|
|
3481
3526
|
}
|
|
3482
3527
|
const manifestFile = zip.file("META-INF/manifest.xml");
|
|
3483
3528
|
if (manifestFile) {
|
|
3484
3529
|
const manifestXml = await manifestFile.async("text");
|
|
3485
3530
|
if (isEncryptedHwpx(manifestXml)) {
|
|
3486
|
-
if (isComFallbackAvailable() && _optionalChain([options, 'optionalAccess',
|
|
3531
|
+
if (isComFallbackAvailable() && _optionalChain([options, 'optionalAccess', _83 => _83.filePath])) {
|
|
3487
3532
|
const { pages, pageCount, warnings: warnings2 } = extractTextViaCom(options.filePath);
|
|
3488
3533
|
if (pages.some((p) => p && p.trim().length > 0)) {
|
|
3489
3534
|
return comResultToParseResult(pages, pageCount, warnings2);
|
|
3490
3535
|
}
|
|
3491
3536
|
}
|
|
3492
|
-
throw new (0,
|
|
3537
|
+
throw new (0, _chunkF2HYH62Hcjs.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.");
|
|
3493
3538
|
}
|
|
3494
3539
|
}
|
|
3495
3540
|
const decompressed = { total: 0 };
|
|
@@ -3498,14 +3543,14 @@ async function parseHwpxDocument(buffer, options) {
|
|
|
3498
3543
|
const styleMap = await extractHwpxStyles(zip, decompressed);
|
|
3499
3544
|
const warnings = [];
|
|
3500
3545
|
const sectionPaths = await resolveSectionPaths(zip);
|
|
3501
|
-
if (sectionPaths.length === 0) throw new (0,
|
|
3546
|
+
if (sectionPaths.length === 0) throw new (0, _chunkF2HYH62Hcjs.KordocError)("HWPX\uC5D0\uC11C \uC139\uC158 \uD30C\uC77C\uC744 \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
3502
3547
|
metadata.pageCount = sectionPaths.length;
|
|
3503
|
-
const pageFilter = _optionalChain([options, 'optionalAccess',
|
|
3548
|
+
const pageFilter = _optionalChain([options, 'optionalAccess', _84 => _84.pages]) ? _chunkDCZVOIEOcjs.parsePageRange.call(void 0, options.pages, sectionPaths.length) : null;
|
|
3504
3549
|
const totalTarget = pageFilter ? pageFilter.size : sectionPaths.length;
|
|
3505
3550
|
const blocks = [];
|
|
3506
3551
|
const shared = createSectionShared();
|
|
3507
3552
|
shared.kordocLayout = await readKordocLayout(zip);
|
|
3508
|
-
shared.keepTrailingEmptyCols = _optionalChain([options, 'optionalAccess',
|
|
3553
|
+
shared.keepTrailingEmptyCols = _optionalChain([options, 'optionalAccess', _85 => _85.keepTrailingEmptyCols]);
|
|
3509
3554
|
let parsedSections = 0;
|
|
3510
3555
|
for (let si = 0; si < sectionPaths.length; si++) {
|
|
3511
3556
|
if (pageFilter && !pageFilter.has(si + 1)) continue;
|
|
@@ -3517,7 +3562,7 @@ async function parseHwpxDocument(buffer, options) {
|
|
|
3517
3562
|
if (decompressed.total > MAX_DECOMPRESS_SIZE) throw new ZipBombError("ZIP \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (ZIP bomb \uC758\uC2EC)");
|
|
3518
3563
|
blocks.push(...parseSectionXml(xml, styleMap, warnings, si + 1, shared));
|
|
3519
3564
|
parsedSections++;
|
|
3520
|
-
_optionalChain([options, 'optionalAccess',
|
|
3565
|
+
_optionalChain([options, 'optionalAccess', _86 => _86.onProgress, 'optionalCall', _87 => _87(parsedSections, totalTarget)]);
|
|
3521
3566
|
} catch (secErr) {
|
|
3522
3567
|
if (secErr instanceof ZipBombError) throw secErr;
|
|
3523
3568
|
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" });
|
|
@@ -3527,7 +3572,7 @@ async function parseHwpxDocument(buffer, options) {
|
|
|
3527
3572
|
const images = await extractImagesFromZip(zip, blocks, decompressed, warnings, !pageFilter);
|
|
3528
3573
|
detectHwpxHeadings(blocks, styleMap);
|
|
3529
3574
|
const outline = blocks.filter((b) => b.type === "heading" && b.level && b.text).map((b) => ({ level: b.level, text: b.text, pageNumber: b.pageNumber }));
|
|
3530
|
-
const markdown =
|
|
3575
|
+
const markdown = _chunkXTCT6KQ5cjs.blocksToMarkdown.call(void 0, blocks);
|
|
3531
3576
|
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 };
|
|
3532
3577
|
}
|
|
3533
3578
|
|
|
@@ -4706,22 +4751,22 @@ function parseHwp5Document(buffer, options) {
|
|
|
4706
4751
|
lenientCfb = parseLenientCfb(buffer);
|
|
4707
4752
|
warnings.push({ message: "\uC190\uC0C1\uB41C CFB \uCEE8\uD14C\uC774\uB108 \u2014 lenient \uBAA8\uB4DC\uB85C \uBCF5\uAD6C", code: "LENIENT_CFB_RECOVERY" });
|
|
4708
4753
|
} catch (e22) {
|
|
4709
|
-
throw new (0,
|
|
4754
|
+
throw new (0, _chunkF2HYH62Hcjs.KordocError)("CFB \uCEE8\uD14C\uC774\uB108 \uD30C\uC2F1 \uC2E4\uD328 (strict \uBC0F lenient \uBAA8\uB450)");
|
|
4710
4755
|
}
|
|
4711
4756
|
}
|
|
4712
4757
|
const findStream = (path) => {
|
|
4713
4758
|
if (cfb) {
|
|
4714
4759
|
const entry = CFB.find(cfb, path);
|
|
4715
|
-
return _optionalChain([entry, 'optionalAccess',
|
|
4760
|
+
return _optionalChain([entry, 'optionalAccess', _88 => _88.content]) ? Buffer.from(entry.content) : null;
|
|
4716
4761
|
}
|
|
4717
4762
|
return lenientCfb.findStream(path);
|
|
4718
4763
|
};
|
|
4719
4764
|
const headerData = findStream("/FileHeader");
|
|
4720
|
-
if (!headerData) throw new (0,
|
|
4765
|
+
if (!headerData) throw new (0, _chunkF2HYH62Hcjs.KordocError)("FileHeader \uC2A4\uD2B8\uB9BC \uC5C6\uC74C");
|
|
4721
4766
|
const header = parseFileHeader(headerData);
|
|
4722
|
-
if (header.signature !== "HWP Document File") throw new (0,
|
|
4723
|
-
if (header.flags & FLAG_ENCRYPTED) throw new (0,
|
|
4724
|
-
if (header.flags & FLAG_DRM) throw new (0,
|
|
4767
|
+
if (header.signature !== "HWP Document File") throw new (0, _chunkF2HYH62Hcjs.KordocError)("HWP \uC2DC\uADF8\uB2C8\uCC98 \uBD88\uC77C\uCE58");
|
|
4768
|
+
if (header.flags & FLAG_ENCRYPTED) throw new (0, _chunkF2HYH62Hcjs.KordocError)("\uC554\uD638\uD654\uB41C HWP\uB294 \uC9C0\uC6D0\uD558\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4");
|
|
4769
|
+
if (header.flags & FLAG_DRM) throw new (0, _chunkF2HYH62Hcjs.KordocError)("DRM \uBCF4\uD638\uB41C HWP\uB294 \uC9C0\uC6D0\uD558\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4");
|
|
4725
4770
|
const compressed = (header.flags & FLAG_COMPRESSED) !== 0;
|
|
4726
4771
|
const distribution = (header.flags & FLAG_DISTRIBUTION) !== 0;
|
|
4727
4772
|
const metadata = {
|
|
@@ -4730,13 +4775,13 @@ function parseHwp5Document(buffer, options) {
|
|
|
4730
4775
|
if (cfb) extractHwp5Metadata(cfb, metadata);
|
|
4731
4776
|
const docInfo = cfb ? parseDocInfoStream(cfb, compressed) : parseDocInfoFromStream(findStream("/DocInfo"), compressed);
|
|
4732
4777
|
const sections = distribution ? cfb ? findViewTextSections(cfb, compressed) : findViewTextSectionsLenient(lenientCfb, compressed) : cfb ? findSections(cfb) : findSectionsLenient(lenientCfb, compressed);
|
|
4733
|
-
if (sections.length === 0) throw new (0,
|
|
4778
|
+
if (sections.length === 0) throw new (0, _chunkF2HYH62Hcjs.KordocError)("\uC139\uC158 \uC2A4\uD2B8\uB9BC\uC744 \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
4734
4779
|
metadata.pageCount = sections.length;
|
|
4735
|
-
const pageFilter = _optionalChain([options, 'optionalAccess',
|
|
4780
|
+
const pageFilter = _optionalChain([options, 'optionalAccess', _89 => _89.pages]) ? _chunkDCZVOIEOcjs.parsePageRange.call(void 0, options.pages, sections.length) : null;
|
|
4736
4781
|
const totalTarget = pageFilter ? pageFilter.size : sections.length;
|
|
4737
4782
|
const bodyBlocks = [];
|
|
4738
4783
|
const doc = createHwp5DocState();
|
|
4739
|
-
doc.keepTrailingEmptyCols = _optionalChain([options, 'optionalAccess',
|
|
4784
|
+
doc.keepTrailingEmptyCols = _optionalChain([options, 'optionalAccess', _90 => _90.keepTrailingEmptyCols]);
|
|
4740
4785
|
let totalDecompressed = 0;
|
|
4741
4786
|
let parsedSections = 0;
|
|
4742
4787
|
for (let si = 0; si < sections.length; si++) {
|
|
@@ -4745,22 +4790,22 @@ function parseHwp5Document(buffer, options) {
|
|
|
4745
4790
|
const sectionData = sections[si];
|
|
4746
4791
|
const data = !distribution && compressed ? decompressStream(Buffer.from(sectionData)) : Buffer.from(sectionData);
|
|
4747
4792
|
totalDecompressed += data.length;
|
|
4748
|
-
if (totalDecompressed > MAX_TOTAL_DECOMPRESS) throw new (0,
|
|
4793
|
+
if (totalDecompressed > MAX_TOTAL_DECOMPRESS) throw new (0, _chunkF2HYH62Hcjs.KordocError)("\uCD1D \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (decompression bomb \uC758\uC2EC)");
|
|
4749
4794
|
const records = readRecords(data);
|
|
4750
4795
|
const sectionBlocks = parseSection(records, docInfo, warnings, si + 1, doc);
|
|
4751
4796
|
bodyBlocks.push(...sectionBlocks);
|
|
4752
4797
|
parsedSections++;
|
|
4753
|
-
_optionalChain([options, 'optionalAccess',
|
|
4798
|
+
_optionalChain([options, 'optionalAccess', _91 => _91.onProgress, 'optionalCall', _92 => _92(parsedSections, totalTarget)]);
|
|
4754
4799
|
} catch (secErr) {
|
|
4755
|
-
if (secErr instanceof
|
|
4800
|
+
if (secErr instanceof _chunkF2HYH62Hcjs.KordocError) throw secErr;
|
|
4756
4801
|
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" });
|
|
4757
4802
|
}
|
|
4758
4803
|
}
|
|
4759
4804
|
const blocks = [...doc.headerBlocks, ...bodyBlocks, ...doc.footerBlocks];
|
|
4760
4805
|
const images = cfb ? extractHwp5Images(cfb.FileIndex, blocks, warnings, !pageFilter) : extractHwp5ImagesLenient(lenientCfb, blocks, warnings, !pageFilter);
|
|
4761
|
-
let flatBlocks =
|
|
4762
|
-
if (_optionalChain([options, 'optionalAccess',
|
|
4763
|
-
const deduped =
|
|
4806
|
+
let flatBlocks = _chunkXTCT6KQ5cjs.flattenLayoutTables.call(void 0, blocks);
|
|
4807
|
+
if (_optionalChain([options, 'optionalAccess', _93 => _93.dedupeRunningHeaders])) {
|
|
4808
|
+
const deduped = _chunkXTCT6KQ5cjs.dedupeRunningHeaders.call(void 0, flatBlocks);
|
|
4764
4809
|
const removed = flatBlocks.length - deduped.length;
|
|
4765
4810
|
if (removed > 0) warnings.push({ message: `\uBC18\uBCF5 \uB7EC\uB2DD \uD5E4\uB354 ${removed}\uAC1C \uC81C\uAC70`, code: "HIDDEN_TEXT_FILTERED" });
|
|
4766
4811
|
flatBlocks = deduped;
|
|
@@ -4769,10 +4814,10 @@ function parseHwp5Document(buffer, options) {
|
|
|
4769
4814
|
detectHwp5Headings(flatBlocks, docInfo);
|
|
4770
4815
|
}
|
|
4771
4816
|
const outline = flatBlocks.filter((b) => b.type === "heading" && b.level && b.text).map((b) => ({ level: b.level, text: b.text, pageNumber: b.pageNumber }));
|
|
4772
|
-
let markdown =
|
|
4773
|
-
if (_optionalChain([options, 'optionalAccess',
|
|
4817
|
+
let markdown = _chunkXTCT6KQ5cjs.blocksToMarkdown.call(void 0, flatBlocks);
|
|
4818
|
+
if (_optionalChain([options, 'optionalAccess', _94 => _94.inlineImages]) && images.length > 0) {
|
|
4774
4819
|
try {
|
|
4775
|
-
markdown =
|
|
4820
|
+
markdown = _chunkXTCT6KQ5cjs.inlineImagesIntoMarkdown.call(void 0, markdown, images, { compress: true });
|
|
4776
4821
|
} catch (inlineErr) {
|
|
4777
4822
|
warnings.push({ message: `\uC774\uBBF8\uC9C0 \uC778\uB77C\uC778 \uC2E4\uD328 \u2014 \uC6D0\uBCF8 \uD30C\uC77C \uCC38\uC870\uB85C \uD3F4\uBC31: ${inlineErr instanceof Error ? inlineErr.message : "\uC54C \uC218 \uC5C6\uB294 \uC624\uB958"}`, code: "SKIPPED_IMAGE" });
|
|
4778
4823
|
}
|
|
@@ -4782,7 +4827,7 @@ function parseHwp5Document(buffer, options) {
|
|
|
4782
4827
|
function parseDocInfoStream(cfb, compressed) {
|
|
4783
4828
|
try {
|
|
4784
4829
|
const entry = CFB.find(cfb, "/DocInfo");
|
|
4785
|
-
if (!_optionalChain([entry, 'optionalAccess',
|
|
4830
|
+
if (!_optionalChain([entry, 'optionalAccess', _95 => _95.content])) return null;
|
|
4786
4831
|
const data = compressed ? decompressStream(Buffer.from(entry.content)) : Buffer.from(entry.content);
|
|
4787
4832
|
const records = readRecords(data);
|
|
4788
4833
|
return parseDocInfo(records);
|
|
@@ -4803,7 +4848,7 @@ function detectHwp5Headings(blocks, docInfo) {
|
|
|
4803
4848
|
let baseFontSize = 0;
|
|
4804
4849
|
const sizeFreq = /* @__PURE__ */ new Map();
|
|
4805
4850
|
for (const b of blocks) {
|
|
4806
|
-
if (_optionalChain([b, 'access',
|
|
4851
|
+
if (_optionalChain([b, 'access', _96 => _96.style, 'optionalAccess', _97 => _97.fontSize]) && b.text) {
|
|
4807
4852
|
sizeFreq.set(b.style.fontSize, (sizeFreq.get(b.style.fontSize) || 0) + b.text.length);
|
|
4808
4853
|
}
|
|
4809
4854
|
}
|
|
@@ -4819,7 +4864,7 @@ function detectHwp5Headings(blocks, docInfo) {
|
|
|
4819
4864
|
const name = (style.nameKo || style.name).toLowerCase();
|
|
4820
4865
|
if (name.includes("\uBC14\uD0D5") || name.includes("\uBCF8\uBB38") || name === "normal" || name === "body") {
|
|
4821
4866
|
const cs = docInfo.charShapes[style.charShapeId];
|
|
4822
|
-
if (_optionalChain([cs, 'optionalAccess',
|
|
4867
|
+
if (_optionalChain([cs, 'optionalAccess', _98 => _98.fontSize]) > 0) {
|
|
4823
4868
|
baseFontSize = cs.fontSize / 10;
|
|
4824
4869
|
break;
|
|
4825
4870
|
}
|
|
@@ -4834,11 +4879,11 @@ function detectHwp5Headings(blocks, docInfo) {
|
|
|
4834
4879
|
if (text.length === 0 || text.length > 200) continue;
|
|
4835
4880
|
if (/^\d+$/.test(text)) continue;
|
|
4836
4881
|
let level = 0;
|
|
4837
|
-
if (_optionalChain([block, 'access',
|
|
4882
|
+
if (_optionalChain([block, 'access', _99 => _99.style, 'optionalAccess', _100 => _100.fontSize]) && baseFontSize > 0) {
|
|
4838
4883
|
const ratio = block.style.fontSize / baseFontSize;
|
|
4839
|
-
if (ratio >=
|
|
4840
|
-
else if (ratio >=
|
|
4841
|
-
else if (ratio >=
|
|
4884
|
+
if (ratio >= _chunkF2HYH62Hcjs.HEADING_RATIO_H1) level = 1;
|
|
4885
|
+
else if (ratio >= _chunkF2HYH62Hcjs.HEADING_RATIO_H2) level = 2;
|
|
4886
|
+
else if (ratio >= _chunkF2HYH62Hcjs.HEADING_RATIO_H3) level = 3;
|
|
4842
4887
|
}
|
|
4843
4888
|
if (/^제\d+[장절편]\s/.test(text) && text.length <= 50) {
|
|
4844
4889
|
if (level === 0) level = 2;
|
|
@@ -4854,7 +4899,7 @@ function detectHwp5Headings(blocks, docInfo) {
|
|
|
4854
4899
|
function extractHwp5Metadata(cfb, metadata) {
|
|
4855
4900
|
try {
|
|
4856
4901
|
const summaryEntry = CFB.find(cfb, "/HwpSummaryInformation") || CFB.find(cfb, "/SummaryInformation");
|
|
4857
|
-
if (!_optionalChain([summaryEntry, 'optionalAccess',
|
|
4902
|
+
if (!_optionalChain([summaryEntry, 'optionalAccess', _101 => _101.content])) return;
|
|
4858
4903
|
const data = Buffer.from(summaryEntry.content);
|
|
4859
4904
|
if (data.length < 48) return;
|
|
4860
4905
|
const numSets = data.readUInt32LE(24);
|
|
@@ -4887,7 +4932,7 @@ function findViewTextSections(cfb, compressed) {
|
|
|
4887
4932
|
const sections = [];
|
|
4888
4933
|
for (let i = 0; i < MAX_SECTIONS; i++) {
|
|
4889
4934
|
const entry = CFB.find(cfb, `/ViewText/Section${i}`);
|
|
4890
|
-
if (!_optionalChain([entry, 'optionalAccess',
|
|
4935
|
+
if (!_optionalChain([entry, 'optionalAccess', _102 => _102.content])) break;
|
|
4891
4936
|
try {
|
|
4892
4937
|
const decrypted = decryptViewText(Buffer.from(entry.content), compressed);
|
|
4893
4938
|
sections.push({ idx: i, content: decrypted });
|
|
@@ -4901,13 +4946,13 @@ function findSections(cfb) {
|
|
|
4901
4946
|
const sections = [];
|
|
4902
4947
|
for (let i = 0; i < MAX_SECTIONS; i++) {
|
|
4903
4948
|
const entry = CFB.find(cfb, `/BodyText/Section${i}`);
|
|
4904
|
-
if (!_optionalChain([entry, 'optionalAccess',
|
|
4949
|
+
if (!_optionalChain([entry, 'optionalAccess', _103 => _103.content])) break;
|
|
4905
4950
|
sections.push({ idx: i, content: Buffer.from(entry.content) });
|
|
4906
4951
|
}
|
|
4907
4952
|
if (sections.length === 0 && cfb.FileIndex) {
|
|
4908
4953
|
for (const entry of cfb.FileIndex) {
|
|
4909
4954
|
if (sections.length >= MAX_SECTIONS) break;
|
|
4910
|
-
if (_optionalChain([entry, 'access',
|
|
4955
|
+
if (_optionalChain([entry, 'access', _104 => _104.name, 'optionalAccess', _105 => _105.startsWith, 'call', _106 => _106("Section")]) && entry.content) {
|
|
4911
4956
|
const idx = parseInt(entry.name.replace("Section", ""), 10) || 0;
|
|
4912
4957
|
sections.push({ idx, content: Buffer.from(entry.content) });
|
|
4913
4958
|
}
|
|
@@ -4923,7 +4968,7 @@ function findSectionsLenient(lcfb, compressed) {
|
|
|
4923
4968
|
if (!raw) break;
|
|
4924
4969
|
const content = compressed ? decompressStream(raw) : raw;
|
|
4925
4970
|
totalDecompressed += content.length;
|
|
4926
|
-
if (totalDecompressed > MAX_TOTAL_DECOMPRESS) throw new (0,
|
|
4971
|
+
if (totalDecompressed > MAX_TOTAL_DECOMPRESS) throw new (0, _chunkF2HYH62Hcjs.KordocError)("\uCD1D \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (decompression bomb \uC758\uC2EC)");
|
|
4927
4972
|
sections.push({ idx: i, content });
|
|
4928
4973
|
}
|
|
4929
4974
|
if (sections.length === 0) {
|
|
@@ -4935,7 +4980,7 @@ function findSectionsLenient(lcfb, compressed) {
|
|
|
4935
4980
|
if (raw) {
|
|
4936
4981
|
const content = compressed ? decompressStream(raw) : raw;
|
|
4937
4982
|
totalDecompressed += content.length;
|
|
4938
|
-
if (totalDecompressed > MAX_TOTAL_DECOMPRESS) throw new (0,
|
|
4983
|
+
if (totalDecompressed > MAX_TOTAL_DECOMPRESS) throw new (0, _chunkF2HYH62Hcjs.KordocError)("\uCD1D \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (decompression bomb \uC758\uC2EC)");
|
|
4939
4984
|
sections.push({ idx, content });
|
|
4940
4985
|
}
|
|
4941
4986
|
}
|
|
@@ -4952,7 +4997,7 @@ function findViewTextSectionsLenient(lcfb, compressed) {
|
|
|
4952
4997
|
try {
|
|
4953
4998
|
const content = decryptViewText(raw, compressed);
|
|
4954
4999
|
totalDecompressed += content.length;
|
|
4955
|
-
if (totalDecompressed > MAX_TOTAL_DECOMPRESS) throw new (0,
|
|
5000
|
+
if (totalDecompressed > MAX_TOTAL_DECOMPRESS) throw new (0, _chunkF2HYH62Hcjs.KordocError)("\uCD1D \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (decompression bomb \uC758\uC2EC)");
|
|
4956
5001
|
sections.push({ idx: i, content });
|
|
4957
5002
|
} catch (e27) {
|
|
4958
5003
|
break;
|
|
@@ -5053,9 +5098,9 @@ function parseParagraph(records, start, end, ctx) {
|
|
|
5053
5098
|
const applied = [];
|
|
5054
5099
|
for (const r of ranges) {
|
|
5055
5100
|
const ctrl = ctrls[r.ctrlIdx];
|
|
5056
|
-
if (!_optionalChain([ctrl, 'optionalAccess',
|
|
5101
|
+
if (!_optionalChain([ctrl, 'optionalAccess', _107 => _107.href]) || r.end <= r.start) continue;
|
|
5057
5102
|
if (applied.some(([s, e]) => r.start < e && r.end > s)) continue;
|
|
5058
|
-
const href =
|
|
5103
|
+
const href = _chunkF2HYH62Hcjs.sanitizeHref.call(void 0, ctrl.href);
|
|
5059
5104
|
if (!href) continue;
|
|
5060
5105
|
const anchor = text.slice(r.start, r.end);
|
|
5061
5106
|
if (!anchor.trim()) continue;
|
|
@@ -5073,7 +5118,7 @@ function parseParagraph(records, start, end, ctx) {
|
|
|
5073
5118
|
}
|
|
5074
5119
|
if (ps.headType === 1 || ps.headType === 2) {
|
|
5075
5120
|
const nid = ps.numberingId || (ps.headType === 1 ? ctx.doc.outlineNumberingId : 0);
|
|
5076
|
-
const numbering = nid >= 1 ? _optionalChain([ctx, 'access',
|
|
5121
|
+
const numbering = nid >= 1 ? _optionalChain([ctx, 'access', _108 => _108.docInfo, 'optionalAccess', _109 => _109.numberings, 'access', _110 => _110[nid - 1]]) : void 0;
|
|
5077
5122
|
if (numbering) {
|
|
5078
5123
|
const counters = ctx.doc.numbering.advance(nid, ps.paraLevel);
|
|
5079
5124
|
const fmt = numbering.levelFormats[Math.min(ps.paraLevel, 6)];
|
|
@@ -5083,7 +5128,7 @@ function parseParagraph(records, start, end, ctx) {
|
|
|
5083
5128
|
}
|
|
5084
5129
|
}
|
|
5085
5130
|
} else if (ps.headType === 3) {
|
|
5086
|
-
const bullet = ps.numberingId >= 1 ? _optionalChain([ctx, 'access',
|
|
5131
|
+
const bullet = ps.numberingId >= 1 ? _optionalChain([ctx, 'access', _111 => _111.docInfo, 'optionalAccess', _112 => _112.bullets, 'access', _113 => _113[ps.numberingId - 1]]) : void 0;
|
|
5087
5132
|
if (bullet && bullet.char !== "\uFFFF") headMarker = bullet.char;
|
|
5088
5133
|
}
|
|
5089
5134
|
}
|
|
@@ -5288,8 +5333,8 @@ function parseTableControl(ctrl, records, ctx) {
|
|
|
5288
5333
|
let tableIdx = -1;
|
|
5289
5334
|
for (let i2 = childStart; i2 < childEnd; i2++) {
|
|
5290
5335
|
if (records[i2].tagId === TAG_TABLE && records[i2].data.length >= 8) {
|
|
5291
|
-
rows = Math.min(records[i2].data.readUInt16LE(4),
|
|
5292
|
-
cols = Math.min(records[i2].data.readUInt16LE(6),
|
|
5336
|
+
rows = Math.min(records[i2].data.readUInt16LE(4), _chunkXTCT6KQ5cjs.MAX_ROWS);
|
|
5337
|
+
cols = Math.min(records[i2].data.readUInt16LE(6), _chunkXTCT6KQ5cjs.MAX_COLS);
|
|
5293
5338
|
tableIdx = i2;
|
|
5294
5339
|
break;
|
|
5295
5340
|
}
|
|
@@ -5329,7 +5374,7 @@ function parseTableControl(ctrl, records, ctx) {
|
|
|
5329
5374
|
const cellRows2 = arrangeCells(rows, cols, cells);
|
|
5330
5375
|
const irCells = cellRows2.map((row) => row.map((c) => {
|
|
5331
5376
|
const ir = { text: c.text.trim(), colSpan: c.colSpan, rowSpan: c.rowSpan };
|
|
5332
|
-
if (_optionalChain([c, 'access',
|
|
5377
|
+
if (_optionalChain([c, 'access', _114 => _114.blocks, 'optionalAccess', _115 => _115.length])) ir.blocks = c.blocks;
|
|
5333
5378
|
if (c.isHeader) ir.isHeader = true;
|
|
5334
5379
|
return ir;
|
|
5335
5380
|
}));
|
|
@@ -5338,7 +5383,7 @@ function parseTableControl(ctrl, records, ctx) {
|
|
|
5338
5383
|
return table3;
|
|
5339
5384
|
}
|
|
5340
5385
|
const cellRows = arrangeCells(rows, cols, cells);
|
|
5341
|
-
const table2 =
|
|
5386
|
+
const table2 = _chunkXTCT6KQ5cjs.buildTable.call(void 0, cellRows, { keepAnchoredEmptyCols: ctx.doc.keepTrailingEmptyCols });
|
|
5342
5387
|
if (caption && table2.rows > 0) table2.caption = caption;
|
|
5343
5388
|
return table2.rows > 0 ? table2 : null;
|
|
5344
5389
|
}
|
|
@@ -5355,8 +5400,8 @@ function parseCell(records, lhIdx, end, ctx) {
|
|
|
5355
5400
|
rowAddr = rec.data.readUInt16LE(10);
|
|
5356
5401
|
const cs = rec.data.readUInt16LE(12);
|
|
5357
5402
|
const rs = rec.data.readUInt16LE(14);
|
|
5358
|
-
if (cs > 0) colSpan = Math.min(cs,
|
|
5359
|
-
if (rs > 0) rowSpan = Math.min(rs,
|
|
5403
|
+
if (cs > 0) colSpan = Math.min(cs, _chunkXTCT6KQ5cjs.MAX_COLS);
|
|
5404
|
+
if (rs > 0) rowSpan = Math.min(rs, _chunkXTCT6KQ5cjs.MAX_ROWS);
|
|
5360
5405
|
}
|
|
5361
5406
|
const blocks = ctx.depth < MAX_NEST_DEPTH ? parseParagraphList(records, lhIdx + 1, end, { ...ctx, depth: ctx.depth + 1 }) : [];
|
|
5362
5407
|
const parts = [];
|
|
@@ -5366,7 +5411,7 @@ function parseCell(records, lhIdx, end, ctx) {
|
|
|
5366
5411
|
parts.push(``);
|
|
5367
5412
|
hasStructure = true;
|
|
5368
5413
|
} else if (b.type === "table" && b.table) {
|
|
5369
|
-
const flat =
|
|
5414
|
+
const flat = _chunkXTCT6KQ5cjs.convertTableToText.call(void 0, b.table.cells);
|
|
5370
5415
|
if (flat) parts.push(flat);
|
|
5371
5416
|
hasStructure = true;
|
|
5372
5417
|
} else if (b.text) {
|
|
@@ -5463,8 +5508,8 @@ function pictureToImageBlock(data, ctx) {
|
|
|
5463
5508
|
if (data.length < 73) return null;
|
|
5464
5509
|
const binDataId = data.readUInt16LE(71);
|
|
5465
5510
|
if (binDataId === 0) return null;
|
|
5466
|
-
const item = _optionalChain([ctx, 'access',
|
|
5467
|
-
if (_optionalChain([item, 'optionalAccess',
|
|
5511
|
+
const item = _optionalChain([ctx, 'access', _116 => _116.docInfo, 'optionalAccess', _117 => _117.binData, 'access', _118 => _118[binDataId - 1]]);
|
|
5512
|
+
if (_optionalChain([item, 'optionalAccess', _119 => _119.kind]) === "link") {
|
|
5468
5513
|
ctx.warnings.push({ page: ctx.sectionNum, message: `\uC678\uBD80 \uC5F0\uACB0 \uC774\uBBF8\uC9C0 (binDataId ${binDataId})`, code: "SKIPPED_IMAGE" });
|
|
5469
5514
|
return null;
|
|
5470
5515
|
}
|
|
@@ -17416,8 +17461,50 @@ function decodeJohab(ch) {
|
|
|
17416
17461
|
}
|
|
17417
17462
|
const hit = lookupSymbol(ch);
|
|
17418
17463
|
if (hit !== null) return hit;
|
|
17464
|
+
return JOHAB_UNMAPPED;
|
|
17465
|
+
}
|
|
17466
|
+
return decodeHwp3Extra(ch);
|
|
17467
|
+
}
|
|
17468
|
+
function decodeHwp3Extra(ch) {
|
|
17469
|
+
if (ch >= 13712 && ch <= 13721) return 8544 + (ch - 13712);
|
|
17470
|
+
if (ch >= 14055 && ch <= 14064) return 9312 + (ch - 14055);
|
|
17471
|
+
switch (ch) {
|
|
17472
|
+
case 129:
|
|
17473
|
+
return 8220;
|
|
17474
|
+
// 왼쪽 큰따옴표
|
|
17475
|
+
case 130:
|
|
17476
|
+
return 8221;
|
|
17477
|
+
// 오른쪽 큰따옴표
|
|
17478
|
+
case 12316:
|
|
17479
|
+
return 9473;
|
|
17480
|
+
// ━ 굵은 가로선 (rhwp: U+F080F, 표시값 직행)
|
|
17481
|
+
case 12349:
|
|
17482
|
+
return 9632;
|
|
17483
|
+
// ■ (rhwp: U+F0827, 표시값 직행)
|
|
17484
|
+
case 13158:
|
|
17485
|
+
return 9633;
|
|
17486
|
+
// □ 글머리 (rhwp: U+F03C5, 한컴 표시값 직행)
|
|
17487
|
+
case 13316:
|
|
17488
|
+
return 8228;
|
|
17489
|
+
// 한 점 리더
|
|
17490
|
+
case 13377:
|
|
17491
|
+
return 9632;
|
|
17492
|
+
// ■
|
|
17493
|
+
case 13382:
|
|
17494
|
+
return 8594;
|
|
17495
|
+
// → 오른쪽 화살표
|
|
17496
|
+
case 13793:
|
|
17497
|
+
return 9472;
|
|
17498
|
+
// ─ 상자 그리기 가로선
|
|
17499
|
+
case 13433:
|
|
17500
|
+
return 9655;
|
|
17501
|
+
// ▷
|
|
17502
|
+
case 13434:
|
|
17503
|
+
return 9654;
|
|
17504
|
+
// ▶
|
|
17505
|
+
default:
|
|
17506
|
+
return JOHAB_UNMAPPED;
|
|
17419
17507
|
}
|
|
17420
|
-
return JOHAB_UNMAPPED;
|
|
17421
17508
|
}
|
|
17422
17509
|
function decodeHcharString(bytes) {
|
|
17423
17510
|
let out = "";
|
|
@@ -17537,7 +17624,7 @@ var PARA_SHAPE_SIZE = 187;
|
|
|
17537
17624
|
var LINE_INFO_SIZE = 14;
|
|
17538
17625
|
var INLINE_CHAR_SHAPE_SIZE = 31;
|
|
17539
17626
|
var SIMPLE_CTRL = /* @__PURE__ */ new Map([
|
|
17540
|
-
[9, { extraBytes:
|
|
17627
|
+
[9, { extraBytes: 6, extraHchar: 3, emit: " " }],
|
|
17541
17628
|
[7, { extraBytes: 6, extraHchar: 3, emit: "\uFFFC" }],
|
|
17542
17629
|
[8, { extraBytes: 6, extraHchar: 3, emit: "\uFFFC" }],
|
|
17543
17630
|
[18, { extraBytes: 6, extraHchar: 3, emit: " " }],
|
|
@@ -17570,7 +17657,7 @@ function parseHwp3Document(buffer, _options) {
|
|
|
17570
17657
|
try {
|
|
17571
17658
|
body = _zlib.inflateRawSync.call(void 0, tail, { maxOutputLength: MAX_DECOMPRESS_SIZE3 });
|
|
17572
17659
|
} catch (err) {
|
|
17573
|
-
if (_optionalChain([err, 'optionalAccess',
|
|
17660
|
+
if (_optionalChain([err, 'optionalAccess', _120 => _120.code]) === "ERR_BUFFER_TOO_LARGE") {
|
|
17574
17661
|
throw new Error(`HWP3 \uC555\uCD95 \uD574\uC81C \uACB0\uACFC\uAC00 \uCD5C\uB300 \uD5C8\uC6A9 \uD06C\uAE30(${MAX_DECOMPRESS_SIZE3 / 1024 / 1024}MB)\uB97C \uCD08\uACFC\uD588\uC2B5\uB2C8\uB2E4`);
|
|
17575
17662
|
}
|
|
17576
17663
|
const msg2 = err instanceof Error ? err.message : String(err);
|
|
@@ -17713,6 +17800,12 @@ function parseCharStream(reader, charCount, ctx) {
|
|
|
17713
17800
|
parseParagraphList2(reader, ctx);
|
|
17714
17801
|
break;
|
|
17715
17802
|
}
|
|
17803
|
+
case 5:
|
|
17804
|
+
if (headerVal1 > 0 && headerVal1 < 1e6) reader.skip(headerVal1);
|
|
17805
|
+
break;
|
|
17806
|
+
case 6:
|
|
17807
|
+
reader.skip(34);
|
|
17808
|
+
break;
|
|
17716
17809
|
case 29:
|
|
17717
17810
|
if (headerVal1 < 1e6) reader.skip(headerVal1);
|
|
17718
17811
|
break;
|
|
@@ -17799,15 +17892,15 @@ function getElements(parent, tagName) {
|
|
|
17799
17892
|
const result = [];
|
|
17800
17893
|
for (let i = 0; i < nodes.length; i++) result.push(nodes[i]);
|
|
17801
17894
|
if (result.length > 0) return result;
|
|
17802
|
-
const nsNodes = _optionalChain([parent, 'access',
|
|
17895
|
+
const nsNodes = _optionalChain([parent, 'access', _121 => _121.getElementsByTagNameNS, 'optionalCall', _122 => _122("*", tagName)]);
|
|
17803
17896
|
if (nsNodes) for (let i = 0; i < nsNodes.length; i++) result.push(nsNodes[i]);
|
|
17804
17897
|
return result;
|
|
17805
17898
|
}
|
|
17806
17899
|
function getTextContent(el) {
|
|
17807
|
-
return _nullishCoalesce(_optionalChain([el, 'access',
|
|
17900
|
+
return _nullishCoalesce(_optionalChain([el, 'access', _123 => _123.textContent, 'optionalAccess', _124 => _124.trim, 'call', _125 => _125()]), () => ( ""));
|
|
17808
17901
|
}
|
|
17809
17902
|
function parseXml(text) {
|
|
17810
|
-
return new (0, _xmldom.DOMParser)().parseFromString(
|
|
17903
|
+
return new (0, _xmldom.DOMParser)().parseFromString(_chunkF2HYH62Hcjs.stripDtd.call(void 0, text), "text/xml");
|
|
17811
17904
|
}
|
|
17812
17905
|
function collectRichText(root) {
|
|
17813
17906
|
let out = "";
|
|
@@ -17816,7 +17909,7 @@ function collectRichText(root) {
|
|
|
17816
17909
|
for (let i = 0; i < children.length; i++) {
|
|
17817
17910
|
if (children[i].nodeType !== 1) continue;
|
|
17818
17911
|
const el = children[i];
|
|
17819
|
-
const local = el.localName || _optionalChain([el, 'access',
|
|
17912
|
+
const local = el.localName || _optionalChain([el, 'access', _126 => _126.tagName, 'optionalAccess', _127 => _127.replace, 'call', _128 => _128(/^[^:]+:/, "")]) || "";
|
|
17820
17913
|
if (local === "rPh") continue;
|
|
17821
17914
|
if (local === "t") out += _nullishCoalesce(el.textContent, () => ( ""));
|
|
17822
17915
|
else walk(el);
|
|
@@ -17990,7 +18083,7 @@ function parseWorksheet(xml, sharedStrings, dateXfs, date1904) {
|
|
|
17990
18083
|
}
|
|
17991
18084
|
return { grid, merges, maxRow, maxCol };
|
|
17992
18085
|
}
|
|
17993
|
-
function sheetToBlocks(sheetName, grid, merges, maxRow, maxCol, sheetIndex) {
|
|
18086
|
+
function sheetToBlocks(sheetName, grid, merges, maxRow, maxCol, sheetIndex, keepAnchoredEmptyCols) {
|
|
17994
18087
|
const blocks = [];
|
|
17995
18088
|
if (sheetName) {
|
|
17996
18089
|
blocks.push({
|
|
@@ -18035,14 +18128,14 @@ function sheetToBlocks(sheetName, grid, merges, maxRow, maxCol, sheetIndex) {
|
|
|
18035
18128
|
const merge = mergeMap.get(key);
|
|
18036
18129
|
row.push({
|
|
18037
18130
|
text,
|
|
18038
|
-
colSpan: _nullishCoalesce(_optionalChain([merge, 'optionalAccess',
|
|
18039
|
-
rowSpan: _nullishCoalesce(_optionalChain([merge, 'optionalAccess',
|
|
18131
|
+
colSpan: _nullishCoalesce(_optionalChain([merge, 'optionalAccess', _129 => _129.colSpan]), () => ( 1)),
|
|
18132
|
+
rowSpan: _nullishCoalesce(_optionalChain([merge, 'optionalAccess', _130 => _130.rowSpan]), () => ( 1))
|
|
18040
18133
|
});
|
|
18041
18134
|
}
|
|
18042
18135
|
cellRows.push(row);
|
|
18043
18136
|
}
|
|
18044
18137
|
if (cellRows.length > 0) {
|
|
18045
|
-
const table2 =
|
|
18138
|
+
const table2 = _chunkXTCT6KQ5cjs.buildTable.call(void 0, cellRows, { keepAnchoredEmptyCols });
|
|
18046
18139
|
if (table2.rows > 0) {
|
|
18047
18140
|
blocks.push({ type: "table", table: table2, pageNumber: sheetIndex + 1 });
|
|
18048
18141
|
}
|
|
@@ -18050,12 +18143,12 @@ function sheetToBlocks(sheetName, grid, merges, maxRow, maxCol, sheetIndex) {
|
|
|
18050
18143
|
return blocks;
|
|
18051
18144
|
}
|
|
18052
18145
|
async function parseXlsxDocument(buffer, options) {
|
|
18053
|
-
|
|
18146
|
+
_chunkF2HYH62Hcjs.precheckZipSize.call(void 0, buffer, MAX_DECOMPRESS_SIZE4);
|
|
18054
18147
|
const zip = await _jszip2.default.loadAsync(buffer);
|
|
18055
18148
|
const warnings = [];
|
|
18056
18149
|
const workbookFile = zip.file("xl/workbook.xml");
|
|
18057
18150
|
if (!workbookFile) {
|
|
18058
|
-
throw new (0,
|
|
18151
|
+
throw new (0, _chunkF2HYH62Hcjs.KordocError)("\uC720\uD6A8\uD558\uC9C0 \uC54A\uC740 XLSX \uD30C\uC77C: xl/workbook.xml\uC774 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
18059
18152
|
}
|
|
18060
18153
|
let sharedStrings = [];
|
|
18061
18154
|
const ssFile = zip.file("xl/sharedStrings.xml");
|
|
@@ -18064,7 +18157,7 @@ async function parseXlsxDocument(buffer, options) {
|
|
|
18064
18157
|
}
|
|
18065
18158
|
const { sheets, date1904 } = parseWorkbook(await workbookFile.async("text"));
|
|
18066
18159
|
if (sheets.length === 0) {
|
|
18067
|
-
throw new (0,
|
|
18160
|
+
throw new (0, _chunkF2HYH62Hcjs.KordocError)("XLSX \uD30C\uC77C\uC5D0 \uC2DC\uD2B8\uAC00 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
18068
18161
|
}
|
|
18069
18162
|
let dateXfs = /* @__PURE__ */ new Map();
|
|
18070
18163
|
const stylesFile = zip.file("xl/styles.xml");
|
|
@@ -18080,7 +18173,7 @@ async function parseXlsxDocument(buffer, options) {
|
|
|
18080
18173
|
relsMap = parseRels(await relsFile.async("text"));
|
|
18081
18174
|
}
|
|
18082
18175
|
let pageFilter = null;
|
|
18083
|
-
if (_optionalChain([options, 'optionalAccess',
|
|
18176
|
+
if (_optionalChain([options, 'optionalAccess', _131 => _131.pages])) {
|
|
18084
18177
|
const { parsePageRange: parsePageRange2 } = await Promise.resolve().then(() => _interopRequireWildcard(require("./page-range-P7SDW6LR.cjs")));
|
|
18085
18178
|
pageFilter = parsePageRange2(options.pages, sheets.length);
|
|
18086
18179
|
}
|
|
@@ -18089,7 +18182,7 @@ async function parseXlsxDocument(buffer, options) {
|
|
|
18089
18182
|
for (let i = 0; i < processedSheets; i++) {
|
|
18090
18183
|
if (pageFilter && !pageFilter.has(i + 1)) continue;
|
|
18091
18184
|
const sheet = sheets[i];
|
|
18092
|
-
_optionalChain([options, 'optionalAccess',
|
|
18185
|
+
_optionalChain([options, 'optionalAccess', _132 => _132.onProgress, 'optionalCall', _133 => _133(i + 1, processedSheets)]);
|
|
18093
18186
|
let sheetPath = relsMap.get(sheet.rId);
|
|
18094
18187
|
if (sheetPath) {
|
|
18095
18188
|
if (!sheetPath.startsWith("xl/") && !sheetPath.startsWith("/")) {
|
|
@@ -18112,7 +18205,7 @@ async function parseXlsxDocument(buffer, options) {
|
|
|
18112
18205
|
try {
|
|
18113
18206
|
const sheetXml = await sheetFile.async("text");
|
|
18114
18207
|
const { grid, merges, maxRow, maxCol } = parseWorksheet(sheetXml, sharedStrings, dateXfs, date1904);
|
|
18115
|
-
const sheetBlocks = sheetToBlocks(sheet.name, grid, merges, maxRow, maxCol, i);
|
|
18208
|
+
const sheetBlocks = sheetToBlocks(sheet.name, grid, merges, maxRow, maxCol, i, _optionalChain([options, 'optionalAccess', _134 => _134.keepTrailingEmptyCols]));
|
|
18116
18209
|
blocks.push(...sheetBlocks);
|
|
18117
18210
|
} catch (err) {
|
|
18118
18211
|
warnings.push({
|
|
@@ -18144,7 +18237,7 @@ async function parseXlsxDocument(buffer, options) {
|
|
|
18144
18237
|
} catch (e29) {
|
|
18145
18238
|
}
|
|
18146
18239
|
}
|
|
18147
|
-
const markdown =
|
|
18240
|
+
const markdown = _chunkXTCT6KQ5cjs.blocksToMarkdown.call(void 0, blocks);
|
|
18148
18241
|
return { markdown, blocks, metadata, warnings: warnings.length > 0 ? warnings : void 0 };
|
|
18149
18242
|
}
|
|
18150
18243
|
|
|
@@ -18595,11 +18688,11 @@ function processGlobals(records) {
|
|
|
18595
18688
|
const xfFmtIds = [];
|
|
18596
18689
|
const firstBof = records[0];
|
|
18597
18690
|
if (!firstBof || firstBof.opcode !== OP_BOF) {
|
|
18598
|
-
throw new (0,
|
|
18691
|
+
throw new (0, _chunkF2HYH62Hcjs.KordocError)("XLS: \uCCAB \uB808\uCF54\uB4DC\uAC00 BOF\uAC00 \uC544\uB2D8");
|
|
18599
18692
|
}
|
|
18600
18693
|
const bof = decodeBof(firstBof.data);
|
|
18601
18694
|
if (!bof || bof.dt !== DT_GLOBALS) {
|
|
18602
|
-
throw new (0,
|
|
18695
|
+
throw new (0, _chunkF2HYH62Hcjs.KordocError)("XLS: Globals \uC11C\uBE0C\uC2A4\uD2B8\uB9BC BOF \uB204\uB77D");
|
|
18603
18696
|
}
|
|
18604
18697
|
let i = 1;
|
|
18605
18698
|
while (i < records.length) {
|
|
@@ -18661,7 +18754,7 @@ function cellValueToText(v) {
|
|
|
18661
18754
|
if (typeof v === "boolean") return v ? "TRUE" : "FALSE";
|
|
18662
18755
|
return v;
|
|
18663
18756
|
}
|
|
18664
|
-
function sheetToBlocks2(sheetName, sheet, sheetIndex) {
|
|
18757
|
+
function sheetToBlocks2(sheetName, sheet, sheetIndex, keepAnchoredEmptyCols) {
|
|
18665
18758
|
const blocks = [];
|
|
18666
18759
|
if (sheetName) {
|
|
18667
18760
|
blocks.push({
|
|
@@ -18727,14 +18820,14 @@ function sheetToBlocks2(sheetName, sheet, sheetIndex) {
|
|
|
18727
18820
|
const merge = mergeMap.get(key);
|
|
18728
18821
|
row.push({
|
|
18729
18822
|
text: grid[r][c],
|
|
18730
|
-
colSpan: _nullishCoalesce(_optionalChain([merge, 'optionalAccess',
|
|
18731
|
-
rowSpan: _nullishCoalesce(_optionalChain([merge, 'optionalAccess',
|
|
18823
|
+
colSpan: _nullishCoalesce(_optionalChain([merge, 'optionalAccess', _135 => _135.colSpan]), () => ( 1)),
|
|
18824
|
+
rowSpan: _nullishCoalesce(_optionalChain([merge, 'optionalAccess', _136 => _136.rowSpan]), () => ( 1))
|
|
18732
18825
|
});
|
|
18733
18826
|
}
|
|
18734
18827
|
cellRows.push(row);
|
|
18735
18828
|
}
|
|
18736
18829
|
if (cellRows.length > 0) {
|
|
18737
|
-
const table2 =
|
|
18830
|
+
const table2 = _chunkXTCT6KQ5cjs.buildTable.call(void 0, cellRows, { keepAnchoredEmptyCols });
|
|
18738
18831
|
if (table2.rows > 0) {
|
|
18739
18832
|
blocks.push({ type: "table", table: table2, pageNumber: sheetIndex + 1 });
|
|
18740
18833
|
}
|
|
@@ -18747,21 +18840,21 @@ async function parseXlsDocument(buffer, options) {
|
|
|
18747
18840
|
try {
|
|
18748
18841
|
cfb = parseLenientCfb(buf);
|
|
18749
18842
|
} catch (e) {
|
|
18750
|
-
throw new (0,
|
|
18843
|
+
throw new (0, _chunkF2HYH62Hcjs.KordocError)(
|
|
18751
18844
|
`XLS: OLE2 \uC2DC\uADF8\uB2C8\uCC98 \uAC80\uC99D \uC2E4\uD328 \u2014 ${e instanceof Error ? e.message : "\uC54C \uC218 \uC5C6\uB294 \uC624\uB958"}`
|
|
18752
18845
|
);
|
|
18753
18846
|
}
|
|
18754
18847
|
const wb = _nullishCoalesce(cfb.findStream("/Workbook"), () => ( cfb.findStream("/Book")));
|
|
18755
18848
|
if (!wb) {
|
|
18756
|
-
throw new (0,
|
|
18849
|
+
throw new (0, _chunkF2HYH62Hcjs.KordocError)("XLS: Workbook \uC2A4\uD2B8\uB9BC\uC774 \uC5C6\uC74C (BIFF5 \uB610\uB294 \uBE44\uD45C\uC900 \uD30C\uC77C)");
|
|
18757
18850
|
}
|
|
18758
18851
|
const records = readRecords2(wb);
|
|
18759
18852
|
if (records.length === 0) {
|
|
18760
|
-
throw new (0,
|
|
18853
|
+
throw new (0, _chunkF2HYH62Hcjs.KordocError)("XLS: \uC2DC\uADF8\uB2C8\uCC98 \uB808\uCF54\uB4DC\uAC00 \uC5C6\uC74C (Workbook \uC2A4\uD2B8\uB9BC \uC190\uC0C1)");
|
|
18761
18854
|
}
|
|
18762
18855
|
const firstBof = decodeBof(records[0].data);
|
|
18763
18856
|
if (firstBof && firstBof.vers !== 1536) {
|
|
18764
|
-
throw new (0,
|
|
18857
|
+
throw new (0, _chunkF2HYH62Hcjs.KordocError)(
|
|
18765
18858
|
`XLS: BIFF8(0x0600)\uB9CC \uC9C0\uC6D0 \u2014 \uBCF8 \uD30C\uC77C\uC740 0x${firstBof.vers.toString(16)}`
|
|
18766
18859
|
);
|
|
18767
18860
|
}
|
|
@@ -18790,7 +18883,7 @@ async function parseXlsDocument(buffer, options) {
|
|
|
18790
18883
|
} : void 0;
|
|
18791
18884
|
const totalSheets = Math.min(globals.sheets.length, MAX_SHEETS2);
|
|
18792
18885
|
let pageFilter = null;
|
|
18793
|
-
if (_optionalChain([options, 'optionalAccess',
|
|
18886
|
+
if (_optionalChain([options, 'optionalAccess', _137 => _137.pages])) {
|
|
18794
18887
|
const { parsePageRange: parsePageRange2 } = await Promise.resolve().then(() => _interopRequireWildcard(require("./page-range-P7SDW6LR.cjs")));
|
|
18795
18888
|
pageFilter = parsePageRange2(options.pages, totalSheets);
|
|
18796
18889
|
}
|
|
@@ -18799,7 +18892,7 @@ async function parseXlsDocument(buffer, options) {
|
|
|
18799
18892
|
if (pageFilter && !pageFilter.has(i + 1)) continue;
|
|
18800
18893
|
const meta = globals.sheets[i];
|
|
18801
18894
|
if (meta.dt !== 0) continue;
|
|
18802
|
-
_optionalChain([options, 'optionalAccess',
|
|
18895
|
+
_optionalChain([options, 'optionalAccess', _138 => _138.onProgress, 'optionalCall', _139 => _139(i + 1, totalSheets)]);
|
|
18803
18896
|
const bofIdx = findSheetBofIndex(records, meta.lbPlyPos);
|
|
18804
18897
|
if (bofIdx < 0) {
|
|
18805
18898
|
warnings.push({
|
|
@@ -18815,7 +18908,7 @@ async function parseXlsDocument(buffer, options) {
|
|
|
18815
18908
|
}
|
|
18816
18909
|
try {
|
|
18817
18910
|
const { sheet } = extractSheetCells(records, bofIdx, globals.sst, convertNum);
|
|
18818
|
-
const blocks = sheetToBlocks2(meta.name, sheet, i);
|
|
18911
|
+
const blocks = sheetToBlocks2(meta.name, sheet, i, _optionalChain([options, 'optionalAccess', _140 => _140.keepTrailingEmptyCols]));
|
|
18819
18912
|
allBlocks.push(...blocks);
|
|
18820
18913
|
} catch (e) {
|
|
18821
18914
|
warnings.push({
|
|
@@ -18829,7 +18922,7 @@ async function parseXlsDocument(buffer, options) {
|
|
|
18829
18922
|
pageCount: totalSheets
|
|
18830
18923
|
};
|
|
18831
18924
|
return {
|
|
18832
|
-
markdown:
|
|
18925
|
+
markdown: _chunkXTCT6KQ5cjs.blocksToMarkdown.call(void 0, allBlocks),
|
|
18833
18926
|
blocks: allBlocks,
|
|
18834
18927
|
metadata,
|
|
18835
18928
|
warnings: warnings.length > 0 ? warnings : void 0
|
|
@@ -18842,7 +18935,7 @@ async function parseXlsDocument(buffer, options) {
|
|
|
18842
18935
|
|
|
18843
18936
|
// src/docx/equation.ts
|
|
18844
18937
|
function lname(el) {
|
|
18845
|
-
return el.localName || _optionalChain([el, 'access',
|
|
18938
|
+
return el.localName || _optionalChain([el, 'access', _141 => _141.tagName, 'optionalAccess', _142 => _142.replace, 'call', _143 => _143(/^[^:]+:/, "")]) || "";
|
|
18846
18939
|
}
|
|
18847
18940
|
function kids(parent, name) {
|
|
18848
18941
|
const out = [];
|
|
@@ -19231,7 +19324,7 @@ function isDisplayMath(el) {
|
|
|
19231
19324
|
// src/docx/parser.ts
|
|
19232
19325
|
var MAX_DECOMPRESS_SIZE5 = 100 * 1024 * 1024;
|
|
19233
19326
|
function matchesLocal(el, localName2) {
|
|
19234
|
-
return el.localName === localName2 || (_nullishCoalesce(_optionalChain([el, 'access',
|
|
19327
|
+
return el.localName === localName2 || (_nullishCoalesce(_optionalChain([el, 'access', _144 => _144.tagName, 'optionalAccess', _145 => _145.endsWith, 'call', _146 => _146(`:${localName2}`)]), () => ( false)));
|
|
19235
19328
|
}
|
|
19236
19329
|
function effectiveChildElements(parent) {
|
|
19237
19330
|
const result = [];
|
|
@@ -19266,7 +19359,7 @@ function findElements(parent, localName2) {
|
|
|
19266
19359
|
const child = children[i];
|
|
19267
19360
|
if (child.nodeType === 1) {
|
|
19268
19361
|
const el = child;
|
|
19269
|
-
if (el.localName === localName2 || _optionalChain([el, 'access',
|
|
19362
|
+
if (el.localName === localName2 || _optionalChain([el, 'access', _147 => _147.tagName, 'optionalAccess', _148 => _148.endsWith, 'call', _149 => _149(`:${localName2}`)])) {
|
|
19270
19363
|
result.push(el);
|
|
19271
19364
|
}
|
|
19272
19365
|
walk(el);
|
|
@@ -19285,7 +19378,7 @@ function getAttr(el, localName2) {
|
|
|
19285
19378
|
return null;
|
|
19286
19379
|
}
|
|
19287
19380
|
function parseXml2(text) {
|
|
19288
|
-
return new (0, _xmldom.DOMParser)().parseFromString(
|
|
19381
|
+
return new (0, _xmldom.DOMParser)().parseFromString(_chunkF2HYH62Hcjs.stripDtd.call(void 0, text), "text/xml");
|
|
19289
19382
|
}
|
|
19290
19383
|
function parseStyles(xml) {
|
|
19291
19384
|
const doc = parseXml2(xml);
|
|
@@ -19402,7 +19495,7 @@ function collectOmmlRoots(p) {
|
|
|
19402
19495
|
const child = children[i];
|
|
19403
19496
|
if (child.nodeType !== 1) continue;
|
|
19404
19497
|
const el = child;
|
|
19405
|
-
const tag = el.localName || _optionalChain([el, 'access',
|
|
19498
|
+
const tag = el.localName || _optionalChain([el, 'access', _150 => _150.tagName, 'optionalAccess', _151 => _151.replace, 'call', _152 => _152(/^[^:]+:/, "")]) || "";
|
|
19406
19499
|
if (tag === "oMath" || tag === "oMathPara") {
|
|
19407
19500
|
out.push(el);
|
|
19408
19501
|
} else if (tag === "txbxContent" || tag === "Fallback") {
|
|
@@ -19443,7 +19536,7 @@ function fieldUrlFromInstr(instr) {
|
|
|
19443
19536
|
function makeLink(text, rawHref) {
|
|
19444
19537
|
if (!text) return "";
|
|
19445
19538
|
if (!rawHref) return text;
|
|
19446
|
-
const href =
|
|
19539
|
+
const href = _chunkF2HYH62Hcjs.sanitizeHref.call(void 0, rawHref);
|
|
19447
19540
|
return href ? `[${text}](${href})` : text;
|
|
19448
19541
|
}
|
|
19449
19542
|
function collectInline(p, footnotes, rels) {
|
|
@@ -19545,7 +19638,7 @@ function parseParagraph2(p, styles, numbering, footnotes, rels) {
|
|
|
19545
19638
|
const { text, bold: hasBold, italic: hasItalic, footnoteText } = collectInline(p, footnotes, rels);
|
|
19546
19639
|
if (!text) return null;
|
|
19547
19640
|
const style = styles.get(styleId);
|
|
19548
|
-
if (_optionalChain([style, 'optionalAccess',
|
|
19641
|
+
if (_optionalChain([style, 'optionalAccess', _153 => _153.outlineLevel]) !== void 0 && style.outlineLevel >= 0 && style.outlineLevel <= 5) {
|
|
19549
19642
|
return {
|
|
19550
19643
|
type: "heading",
|
|
19551
19644
|
text,
|
|
@@ -19554,8 +19647,8 @@ function parseParagraph2(p, styles, numbering, footnotes, rels) {
|
|
|
19554
19647
|
}
|
|
19555
19648
|
if (numId && numId !== "0") {
|
|
19556
19649
|
const numDef = numbering.get(numId);
|
|
19557
|
-
const levelInfo = _optionalChain([numDef, 'optionalAccess',
|
|
19558
|
-
const listType = _optionalChain([levelInfo, 'optionalAccess',
|
|
19650
|
+
const levelInfo = _optionalChain([numDef, 'optionalAccess', _154 => _154.get, 'call', _155 => _155(ilvl)]);
|
|
19651
|
+
const listType = _optionalChain([levelInfo, 'optionalAccess', _156 => _156.numFmt]) === "bullet" ? "unordered" : "ordered";
|
|
19559
19652
|
return { type: "list", text, listType };
|
|
19560
19653
|
}
|
|
19561
19654
|
const block = { type: "paragraph", text };
|
|
@@ -19637,7 +19730,7 @@ ${cell2.text}` : cell2.text;
|
|
|
19637
19730
|
return { text: cell2.text, colSpan: cell2.colSpan, rowSpan, colAddr: cell2.col, rowAddr: r };
|
|
19638
19731
|
})
|
|
19639
19732
|
);
|
|
19640
|
-
const table2 =
|
|
19733
|
+
const table2 = _chunkXTCT6KQ5cjs.buildTable.call(void 0, cellRows, { keepAnchoredEmptyCols: keepEmptyCols });
|
|
19641
19734
|
if (table2.rows === 0 || table2.cols === 0) return null;
|
|
19642
19735
|
return { type: "table", table: table2 };
|
|
19643
19736
|
}
|
|
@@ -19647,10 +19740,10 @@ function collectCellText(tc2, styles, numbering, footnotes, rels, depth) {
|
|
|
19647
19740
|
for (const el of effectiveChildElements(tc2)) {
|
|
19648
19741
|
if (matchesLocal(el, "p")) {
|
|
19649
19742
|
const block = parseParagraph2(el, styles, numbering, footnotes, rels);
|
|
19650
|
-
if (_optionalChain([block, 'optionalAccess',
|
|
19743
|
+
if (_optionalChain([block, 'optionalAccess', _157 => _157.text])) parts.push(block.text);
|
|
19651
19744
|
for (const tp of collectTextboxParagraphs(el)) {
|
|
19652
19745
|
const tb = parseParagraph2(tp, styles, numbering, footnotes, rels);
|
|
19653
|
-
if (_optionalChain([tb, 'optionalAccess',
|
|
19746
|
+
if (_optionalChain([tb, 'optionalAccess', _158 => _158.text])) parts.push(tb.text);
|
|
19654
19747
|
}
|
|
19655
19748
|
} else if (matchesLocal(el, "tbl")) {
|
|
19656
19749
|
for (const tr of getChildElements(el, "tr")) {
|
|
@@ -19685,7 +19778,7 @@ async function buildImageMap(zip, rels, doc, warnings) {
|
|
|
19685
19778
|
try {
|
|
19686
19779
|
const data = await imgFile.async("uint8array");
|
|
19687
19780
|
imgIdx++;
|
|
19688
|
-
const ext = _nullishCoalesce(_optionalChain([imgPath, 'access',
|
|
19781
|
+
const ext = _nullishCoalesce(_optionalChain([imgPath, 'access', _159 => _159.split, 'call', _160 => _160("."), 'access', _161 => _161.pop, 'call', _162 => _162(), 'optionalAccess', _163 => _163.toLowerCase, 'call', _164 => _164()]), () => ( "png"));
|
|
19689
19782
|
const mimeMap = {
|
|
19690
19783
|
png: "image/png",
|
|
19691
19784
|
jpg: "image/jpeg",
|
|
@@ -19739,12 +19832,12 @@ function emitParagraphImages(p, imageMap, linked, out) {
|
|
|
19739
19832
|
}
|
|
19740
19833
|
}
|
|
19741
19834
|
async function parseDocxDocument(buffer, options) {
|
|
19742
|
-
|
|
19835
|
+
_chunkF2HYH62Hcjs.precheckZipSize.call(void 0, buffer, MAX_DECOMPRESS_SIZE5);
|
|
19743
19836
|
const zip = await _jszip2.default.loadAsync(buffer);
|
|
19744
19837
|
const warnings = [];
|
|
19745
19838
|
const docFile = zip.file("word/document.xml");
|
|
19746
19839
|
if (!docFile) {
|
|
19747
|
-
throw new (0,
|
|
19840
|
+
throw new (0, _chunkF2HYH62Hcjs.KordocError)("\uC720\uD6A8\uD558\uC9C0 \uC54A\uC740 DOCX \uD30C\uC77C: word/document.xml\uC774 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
19748
19841
|
}
|
|
19749
19842
|
let rels = /* @__PURE__ */ new Map();
|
|
19750
19843
|
const relsFile = zip.file("word/_rels/document.xml.rels");
|
|
@@ -19791,7 +19884,7 @@ async function parseDocxDocument(buffer, options) {
|
|
|
19791
19884
|
const doc = parseXml2(docXml);
|
|
19792
19885
|
const body = findElements(doc, "body");
|
|
19793
19886
|
if (body.length === 0) {
|
|
19794
|
-
throw new (0,
|
|
19887
|
+
throw new (0, _chunkF2HYH62Hcjs.KordocError)("DOCX \uBCF8\uBB38(w:body)\uC744 \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
19795
19888
|
}
|
|
19796
19889
|
const { imageMap, images } = await buildImageMap(zip, rels, doc, warnings);
|
|
19797
19890
|
const linkedImages = /* @__PURE__ */ new Set();
|
|
@@ -19799,7 +19892,7 @@ async function parseDocxDocument(buffer, options) {
|
|
|
19799
19892
|
const bodyEl = body[0];
|
|
19800
19893
|
const topLevel = effectiveChildElements(bodyEl);
|
|
19801
19894
|
for (const el of topLevel) {
|
|
19802
|
-
const localName2 = _nullishCoalesce(el.localName, () => ( _optionalChain([el, 'access',
|
|
19895
|
+
const localName2 = _nullishCoalesce(el.localName, () => ( _optionalChain([el, 'access', _165 => _165.tagName, 'optionalAccess', _166 => _166.split, 'call', _167 => _167(":"), 'access', _168 => _168.pop, 'call', _169 => _169()])));
|
|
19803
19896
|
if (localName2 === "p") {
|
|
19804
19897
|
const block = parseParagraph2(el, styles, numbering, footnotes, rels);
|
|
19805
19898
|
if (block) blocks.push(block);
|
|
@@ -19810,7 +19903,7 @@ async function parseDocxDocument(buffer, options) {
|
|
|
19810
19903
|
if (imageMap.size > 0) emitParagraphImages(tp, imageMap, linkedImages, blocks);
|
|
19811
19904
|
}
|
|
19812
19905
|
} else if (localName2 === "tbl") {
|
|
19813
|
-
const block = parseTable(el, styles, numbering, footnotes, rels, _optionalChain([options, 'optionalAccess',
|
|
19906
|
+
const block = parseTable(el, styles, numbering, footnotes, rels, _optionalChain([options, 'optionalAccess', _170 => _170.keepTrailingEmptyCols]));
|
|
19814
19907
|
if (block) blocks.push(block);
|
|
19815
19908
|
}
|
|
19816
19909
|
}
|
|
@@ -19842,7 +19935,7 @@ async function parseDocxDocument(buffer, options) {
|
|
|
19842
19935
|
}
|
|
19843
19936
|
}
|
|
19844
19937
|
const outline = blocks.filter((b) => b.type === "heading").map((b) => ({ level: _nullishCoalesce(b.level, () => ( 2)), text: _nullishCoalesce(b.text, () => ( "")) }));
|
|
19845
|
-
const markdown =
|
|
19938
|
+
const markdown = _chunkXTCT6KQ5cjs.blocksToMarkdown.call(void 0, blocks);
|
|
19846
19939
|
return {
|
|
19847
19940
|
markdown,
|
|
19848
19941
|
blocks,
|
|
@@ -19865,7 +19958,7 @@ function parseHwpmlDocument(buffer, options) {
|
|
|
19865
19958
|
}
|
|
19866
19959
|
const text = new TextDecoder("utf-8").decode(buffer).replace(/^\uFEFF/, "");
|
|
19867
19960
|
const normalized = text.replace(/ /g, " ");
|
|
19868
|
-
const xml =
|
|
19961
|
+
const xml = _chunkF2HYH62Hcjs.stripDtd.call(void 0, normalized);
|
|
19869
19962
|
const warnings = [];
|
|
19870
19963
|
const parser = new (0, _xmldom.DOMParser)({
|
|
19871
19964
|
onError: (_level, msg2) => {
|
|
@@ -19893,7 +19986,7 @@ function parseHwpmlDocument(buffer, options) {
|
|
|
19893
19986
|
return { markdown: "", blocks: [], metadata, warnings };
|
|
19894
19987
|
}
|
|
19895
19988
|
const blocks = [];
|
|
19896
|
-
const pageFilter = _optionalChain([options, 'optionalAccess',
|
|
19989
|
+
const pageFilter = _optionalChain([options, 'optionalAccess', _171 => _171.pages]) ? _chunkDCZVOIEOcjs.parsePageRange.call(void 0, options.pages, countSections(body)) : null;
|
|
19897
19990
|
let sectionIdx = 0;
|
|
19898
19991
|
const children = body.childNodes;
|
|
19899
19992
|
for (let i = 0; i < children.length; i++) {
|
|
@@ -19902,10 +19995,10 @@ function parseHwpmlDocument(buffer, options) {
|
|
|
19902
19995
|
if (localName(el) !== "SECTION") continue;
|
|
19903
19996
|
sectionIdx++;
|
|
19904
19997
|
if (pageFilter && !pageFilter.has(sectionIdx)) continue;
|
|
19905
|
-
parseSection2(el, blocks, paraShapeMap, sectionIdx, warnings, _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
19998
|
+
parseSection2(el, blocks, paraShapeMap, sectionIdx, warnings, _nullishCoalesce(_optionalChain([options, 'optionalAccess', _172 => _172.keepTrailingEmptyCols]), () => ( false)));
|
|
19906
19999
|
}
|
|
19907
20000
|
const outline = blocks.filter((b) => b.type === "heading" && b.text).map((b) => ({ level: _nullishCoalesce(b.level, () => ( 1)), text: b.text, pageNumber: b.pageNumber }));
|
|
19908
|
-
const markdown =
|
|
20001
|
+
const markdown = _chunkXTCT6KQ5cjs.blocksToMarkdown.call(void 0, blocks);
|
|
19909
20002
|
return {
|
|
19910
20003
|
markdown,
|
|
19911
20004
|
blocks,
|
|
@@ -19991,7 +20084,7 @@ function parseParagraph3(el, blocks, paraShapeMap, sectionNum) {
|
|
|
19991
20084
|
const shapeInfo = paraShapeMap.get(paraShapeId);
|
|
19992
20085
|
const text = extractParagraphText(el);
|
|
19993
20086
|
if (!text) return;
|
|
19994
|
-
if (_optionalChain([shapeInfo, 'optionalAccess',
|
|
20087
|
+
if (_optionalChain([shapeInfo, 'optionalAccess', _173 => _173.headingLevel]) != null) {
|
|
19995
20088
|
blocks.push({ type: "heading", text, level: shapeInfo.headingLevel, pageNumber: sectionNum });
|
|
19996
20089
|
} else {
|
|
19997
20090
|
blocks.push({ type: "paragraph", text, pageNumber: sectionNum });
|
|
@@ -20036,8 +20129,8 @@ function parseTable2(el, blocks, paraShapeMap, sectionNum, warnings, keep) {
|
|
|
20036
20129
|
for (let j = 0; j < rowCells.length; j++) {
|
|
20037
20130
|
const cellEl = rowCells[j];
|
|
20038
20131
|
if (cellEl.nodeType !== 1 || localName(cellEl) !== "CELL") continue;
|
|
20039
|
-
const colAddr = parseInt(_nullishCoalesce(cellEl.getAttribute("ColAddr"), () => ( "0")), 10);
|
|
20040
|
-
const rowAddr = parseInt(_nullishCoalesce(cellEl.getAttribute("RowAddr"), () => ( "0")), 10);
|
|
20132
|
+
const colAddr = parseInt(_nullishCoalesce(cellEl.getAttribute("ColAddr"), () => ( "0")), 10) || 0;
|
|
20133
|
+
const rowAddr = parseInt(_nullishCoalesce(cellEl.getAttribute("RowAddr"), () => ( "0")), 10) || 0;
|
|
20041
20134
|
const colSpan = Math.min(Math.max(1, parseInt(_nullishCoalesce(cellEl.getAttribute("ColSpan"), () => ( "1")), 10) || 1), MAX_TABLE_COLS);
|
|
20042
20135
|
const rowSpan = Math.min(Math.max(1, parseInt(_nullishCoalesce(cellEl.getAttribute("RowSpan"), () => ( "1")), 10) || 1), MAX_TABLE_ROWS);
|
|
20043
20136
|
const cellText = extractCellText(cellEl);
|
|
@@ -20045,25 +20138,12 @@ function parseTable2(el, blocks, paraShapeMap, sectionNum, warnings, keep) {
|
|
|
20045
20138
|
}
|
|
20046
20139
|
}
|
|
20047
20140
|
if (cells.length === 0) return;
|
|
20048
|
-
const
|
|
20141
|
+
const cellRows = Array.from({ length: rowCount }, () => []);
|
|
20049
20142
|
for (const cell2 of cells) {
|
|
20050
|
-
const r = _nullishCoalesce(cell2.rowAddr, () => ( 0));
|
|
20051
|
-
|
|
20052
|
-
if (isNaN(r) || isNaN(c) || r >= rowCount || c >= colCount) continue;
|
|
20053
|
-
grid[r][c] = cell2;
|
|
20054
|
-
for (let dr = 0; dr < cell2.rowSpan; dr++) {
|
|
20055
|
-
for (let dc = 0; dc < cell2.colSpan; dc++) {
|
|
20056
|
-
if (dr === 0 && dc === 0) continue;
|
|
20057
|
-
if (r + dr < rowCount && c + dc < colCount) {
|
|
20058
|
-
grid[r + dr][c + dc] = { text: "", colSpan: 1, rowSpan: 1 };
|
|
20059
|
-
}
|
|
20060
|
-
}
|
|
20061
|
-
}
|
|
20143
|
+
const r = Math.min(Math.max(_nullishCoalesce(cell2.rowAddr, () => ( 0)), 0), rowCount - 1);
|
|
20144
|
+
cellRows[r].push(cell2);
|
|
20062
20145
|
}
|
|
20063
|
-
const
|
|
20064
|
-
(row) => row.map((cell2) => _nullishCoalesce(cell2, () => ( { text: "", colSpan: 1, rowSpan: 1 })))
|
|
20065
|
-
);
|
|
20066
|
-
const table2 = _chunk37VKMUSTcjs.buildTable.call(void 0, cellRows, { keepAnchoredEmptyCols: keep });
|
|
20146
|
+
const table2 = _chunkXTCT6KQ5cjs.buildTable.call(void 0, cellRows, { keepAnchoredEmptyCols: keep });
|
|
20067
20147
|
const caption = extractShapeCaption(el);
|
|
20068
20148
|
if (caption.text && caption.before) {
|
|
20069
20149
|
blocks.push({ type: "paragraph", text: caption.text, pageNumber: sectionNum });
|
|
@@ -20323,7 +20403,7 @@ function fillInCellPatterns(cellText, values, matchedLabels, blockedLabels) {
|
|
|
20323
20403
|
(match, prefix, suffix) => {
|
|
20324
20404
|
const label = prefix + suffix;
|
|
20325
20405
|
const normalizedLabel = normalizeLabel(label);
|
|
20326
|
-
if (_optionalChain([blockedLabels, 'optionalAccess',
|
|
20406
|
+
if (_optionalChain([blockedLabels, 'optionalAccess', _174 => _174.has, 'call', _175 => _175(normalizedLabel)])) return match;
|
|
20327
20407
|
const matchKey = values.available(normalizedLabel) ? normalizedLabel : values.available(normalizeLabel(prefix)) ? normalizeLabel(prefix) : void 0;
|
|
20328
20408
|
if (matchKey === void 0) return match;
|
|
20329
20409
|
const newValue = values.consume(matchKey);
|
|
@@ -20402,17 +20482,17 @@ function matchInlineSegment(seg, values, blockedLabels) {
|
|
|
20402
20482
|
const nlabel = normalizeLabel(seg.label);
|
|
20403
20483
|
if (seg.extLabel !== void 0) {
|
|
20404
20484
|
const nExt = normalizeLabel(seg.extLabel);
|
|
20405
|
-
if (nExt !== nlabel && !_optionalChain([blockedLabels, 'optionalAccess',
|
|
20485
|
+
if (nExt !== nlabel && !_optionalChain([blockedLabels, 'optionalAccess', _176 => _176.has, 'call', _177 => _177(nExt)]) && values.has(nExt)) {
|
|
20406
20486
|
return { key: nExt, label: seg.extLabel, viaExt: true };
|
|
20407
20487
|
}
|
|
20408
20488
|
}
|
|
20409
|
-
if (_optionalChain([blockedLabels, 'optionalAccess',
|
|
20489
|
+
if (_optionalChain([blockedLabels, 'optionalAccess', _178 => _178.has, 'call', _179 => _179(nlabel)])) return void 0;
|
|
20410
20490
|
const key = findMatchingKey(nlabel, values);
|
|
20411
20491
|
return key !== void 0 ? { key, label: seg.label, viaExt: false } : void 0;
|
|
20412
20492
|
}
|
|
20413
20493
|
function clampSegmentEnd(text, seg, next, nextViaExt) {
|
|
20414
20494
|
let ve = seg.valueEnd;
|
|
20415
|
-
if (nextViaExt && _optionalChain([next, 'optionalAccess',
|
|
20495
|
+
if (nextViaExt && _optionalChain([next, 'optionalAccess', _180 => _180.extStart]) !== void 0 && next.extStart < ve) ve = next.extStart;
|
|
20416
20496
|
while (ve > seg.valueStart && /\s/.test(text[ve - 1])) ve--;
|
|
20417
20497
|
return ve;
|
|
20418
20498
|
}
|
|
@@ -20427,7 +20507,7 @@ function normalizeValues(values, warnings) {
|
|
|
20427
20507
|
const { value, format } = typeof raw === "object" && !Array.isArray(raw) ? raw : { value: raw, format: void 0 };
|
|
20428
20508
|
const key = normalizeLabel(label);
|
|
20429
20509
|
if (map.has(key)) {
|
|
20430
|
-
_optionalChain([warnings, 'optionalAccess',
|
|
20510
|
+
_optionalChain([warnings, 'optionalAccess', _181 => _181.push, 'call', _182 => _182(`\uC785\uB825 \uB77C\uBCA8 "${label}"\uC774 \uC815\uADDC\uD654 \uD0A4 "${key}"\uC5D0\uC11C \uB2E4\uB978 \uB77C\uBCA8\uACFC \uCDA9\uB3CC \u2014 \uB4A4 \uAC12\uC73C\uB85C \uB36E\uC5B4\uC500`)]);
|
|
20431
20511
|
}
|
|
20432
20512
|
map.set(key, Array.isArray(value) ? value.map((v) => formatFillValue(v, format)) : formatFillValue(value, format));
|
|
20433
20513
|
}
|
|
@@ -20602,8 +20682,8 @@ function extractFromTable(table2) {
|
|
|
20602
20682
|
if (table2.cols >= 2) {
|
|
20603
20683
|
for (let r = 0; r < table2.rows; r++) {
|
|
20604
20684
|
for (let c = 0; c < table2.cols - 1; c++) {
|
|
20605
|
-
const labelCell = _optionalChain([table2, 'access',
|
|
20606
|
-
const valueCell = _optionalChain([table2, 'access',
|
|
20685
|
+
const labelCell = _optionalChain([table2, 'access', _183 => _183.cells, 'access', _184 => _184[r], 'optionalAccess', _185 => _185[c]]);
|
|
20686
|
+
const valueCell = _optionalChain([table2, 'access', _186 => _186.cells, 'access', _187 => _187[r], 'optionalAccess', _188 => _188[c + 1]]);
|
|
20607
20687
|
if (!labelCell || !valueCell) continue;
|
|
20608
20688
|
if (isLabelCell(labelCell.text)) {
|
|
20609
20689
|
fields.push({
|
|
@@ -20618,15 +20698,15 @@ function extractFromTable(table2) {
|
|
|
20618
20698
|
}
|
|
20619
20699
|
if (fields.length === 0 && table2.rows >= 2 && table2.cols >= 2) {
|
|
20620
20700
|
const headerRow = table2.cells[0];
|
|
20621
|
-
const allLabels = _nullishCoalesce(_optionalChain([headerRow, 'optionalAccess',
|
|
20622
|
-
const t = _nullishCoalesce(_optionalChain([cell2, 'optionalAccess',
|
|
20701
|
+
const allLabels = _nullishCoalesce(_optionalChain([headerRow, 'optionalAccess', _189 => _189.every, 'call', _190 => _190((cell2) => {
|
|
20702
|
+
const t = _nullishCoalesce(_optionalChain([cell2, 'optionalAccess', _191 => _191.text, 'access', _192 => _192.trim, 'call', _193 => _193()]), () => ( ""));
|
|
20623
20703
|
return t.length > 0 && t.length <= 20;
|
|
20624
20704
|
})]), () => ( false));
|
|
20625
20705
|
if (allLabels) {
|
|
20626
20706
|
for (let r = 1; r < table2.rows; r++) {
|
|
20627
20707
|
for (let c = 0; c < table2.cols; c++) {
|
|
20628
|
-
const label = _nullishCoalesce(_optionalChain([headerRow, 'access',
|
|
20629
|
-
const value = _nullishCoalesce(_optionalChain([table2, 'access',
|
|
20708
|
+
const label = _nullishCoalesce(_optionalChain([headerRow, 'access', _194 => _194[c], 'optionalAccess', _195 => _195.text, 'access', _196 => _196.trim, 'call', _197 => _197()]), () => ( ""));
|
|
20709
|
+
const value = _nullishCoalesce(_optionalChain([table2, 'access', _198 => _198.cells, 'access', _199 => _199[r], 'optionalAccess', _200 => _200[c], 'optionalAccess', _201 => _201.text, 'access', _202 => _202.trim, 'call', _203 => _203()]), () => ( ""));
|
|
20630
20710
|
if (label && value) {
|
|
20631
20711
|
fields.push({ label, value, row: r, col: c });
|
|
20632
20712
|
}
|
|
@@ -20720,7 +20800,7 @@ function fillFormFields(blocks, values, blockedLabels) {
|
|
|
20720
20800
|
for (const table2 of allTables) {
|
|
20721
20801
|
for (let r = 0; r < table2.rows; r++) {
|
|
20722
20802
|
for (let c = 0; c < table2.cols; c++) {
|
|
20723
|
-
const cell2 = _optionalChain([table2, 'access',
|
|
20803
|
+
const cell2 = _optionalChain([table2, 'access', _204 => _204.cells, 'access', _205 => _205[r], 'optionalAccess', _206 => _206[c]]);
|
|
20724
20804
|
if (!cell2) continue;
|
|
20725
20805
|
const result = fillInCellPatterns(cell2.text, cursor, matchedLabels, blockedLabels);
|
|
20726
20806
|
if (result) {
|
|
@@ -20752,7 +20832,7 @@ function collectIRTables(blocks, depth) {
|
|
|
20752
20832
|
out.push(block.table);
|
|
20753
20833
|
for (const row of block.table.cells) {
|
|
20754
20834
|
for (const cell2 of row) {
|
|
20755
|
-
if (_optionalChain([cell2, 'optionalAccess',
|
|
20835
|
+
if (_optionalChain([cell2, 'optionalAccess', _207 => _207.blocks, 'optionalAccess', _208 => _208.length])) out.push(...collectIRTables(cell2.blocks, depth + 1));
|
|
20756
20836
|
}
|
|
20757
20837
|
}
|
|
20758
20838
|
}
|
|
@@ -20763,7 +20843,7 @@ function coveredPositions(table2) {
|
|
|
20763
20843
|
for (let r = 0; r < table2.rows; r++) {
|
|
20764
20844
|
for (let c = 0; c < table2.cols; c++) {
|
|
20765
20845
|
if (covered.has(`${r},${c}`)) continue;
|
|
20766
|
-
const cell2 = _optionalChain([table2, 'access',
|
|
20846
|
+
const cell2 = _optionalChain([table2, 'access', _209 => _209.cells, 'access', _210 => _210[r], 'optionalAccess', _211 => _211[c]]);
|
|
20767
20847
|
if (!cell2) continue;
|
|
20768
20848
|
for (let dr = 0; dr < cell2.rowSpan; dr++) {
|
|
20769
20849
|
for (let dc = 0; dc < cell2.colSpan; dc++) {
|
|
@@ -20779,15 +20859,15 @@ function coveredPositions(table2) {
|
|
|
20779
20859
|
function isHeaderDataTable(table2, covered) {
|
|
20780
20860
|
if (table2.rows < 2) return false;
|
|
20781
20861
|
const headerRow = table2.cells[0];
|
|
20782
|
-
if (!_optionalChain([headerRow, 'optionalAccess',
|
|
20862
|
+
if (!_optionalChain([headerRow, 'optionalAccess', _212 => _212.length])) return false;
|
|
20783
20863
|
const allLabels = headerRow.every((cell2) => {
|
|
20784
|
-
const t = _nullishCoalesce(_optionalChain([cell2, 'optionalAccess',
|
|
20864
|
+
const t = _nullishCoalesce(_optionalChain([cell2, 'optionalAccess', _213 => _213.text, 'access', _214 => _214.trim, 'call', _215 => _215()]), () => ( ""));
|
|
20785
20865
|
return t.length > 0 && t.length <= 20 && isLabelCell(t);
|
|
20786
20866
|
});
|
|
20787
20867
|
if (!allLabels) return false;
|
|
20788
20868
|
for (let c = 0; c < table2.cols; c++) {
|
|
20789
20869
|
if (covered.has(`1,${c}`)) continue;
|
|
20790
|
-
const cell2 = _optionalChain([table2, 'access',
|
|
20870
|
+
const cell2 = _optionalChain([table2, 'access', _216 => _216.cells, 'access', _217 => _217[1], 'optionalAccess', _218 => _218[c]]);
|
|
20791
20871
|
if (!cell2) break;
|
|
20792
20872
|
return !isLabelCell(cell2.text);
|
|
20793
20873
|
}
|
|
@@ -20800,7 +20880,7 @@ function fillTable(table2, values, filled, matchedLabels, patternFilledCells, bl
|
|
|
20800
20880
|
for (let r = skipHeaderRow ? 1 : 0; r < table2.rows; r++) {
|
|
20801
20881
|
for (let c = 0; c < table2.cols; c++) {
|
|
20802
20882
|
if (covered.has(`${r},${c}`)) continue;
|
|
20803
|
-
const labelCell = _optionalChain([table2, 'access',
|
|
20883
|
+
const labelCell = _optionalChain([table2, 'access', _219 => _219.cells, 'access', _220 => _220[r], 'optionalAccess', _221 => _221[c]]);
|
|
20804
20884
|
if (!labelCell) continue;
|
|
20805
20885
|
if (!isLabelCell(labelCell.text)) continue;
|
|
20806
20886
|
let vc = c + labelCell.colSpan;
|
|
@@ -20811,12 +20891,12 @@ function fillTable(table2, values, filled, matchedLabels, patternFilledCells, bl
|
|
|
20811
20891
|
if (isKeywordLabel(valueCell.text)) continue;
|
|
20812
20892
|
const normalizedCellLabel = normalizeLabel(labelCell.text);
|
|
20813
20893
|
if (!normalizedCellLabel) continue;
|
|
20814
|
-
if (_optionalChain([blockedLabels, 'optionalAccess',
|
|
20894
|
+
if (_optionalChain([blockedLabels, 'optionalAccess', _222 => _222.has, 'call', _223 => _223(normalizedCellLabel)])) continue;
|
|
20815
20895
|
const matchKey = findMatchingKey(normalizedCellLabel, values);
|
|
20816
20896
|
if (matchKey === void 0) continue;
|
|
20817
20897
|
const newValue = values.consume(matchKey);
|
|
20818
20898
|
if (newValue === void 0) continue;
|
|
20819
|
-
if (_optionalChain([patternFilledCells, 'optionalAccess',
|
|
20899
|
+
if (_optionalChain([patternFilledCells, 'optionalAccess', _224 => _224.has, 'call', _225 => _225(valueCell)])) {
|
|
20820
20900
|
valueCell.text = newValue + " " + valueCell.text;
|
|
20821
20901
|
} else {
|
|
20822
20902
|
valueCell.text = newValue;
|
|
@@ -20833,8 +20913,8 @@ function fillTable(table2, values, filled, matchedLabels, patternFilledCells, bl
|
|
|
20833
20913
|
}
|
|
20834
20914
|
if (table2.rows >= 2 && table2.cols >= 2) {
|
|
20835
20915
|
const headerRow = table2.cells[0];
|
|
20836
|
-
const allLabels = _nullishCoalesce(_optionalChain([headerRow, 'optionalAccess',
|
|
20837
|
-
const t = _nullishCoalesce(_optionalChain([cell2, 'optionalAccess',
|
|
20916
|
+
const allLabels = _nullishCoalesce(_optionalChain([headerRow, 'optionalAccess', _226 => _226.every, 'call', _227 => _227((cell2) => {
|
|
20917
|
+
const t = _nullishCoalesce(_optionalChain([cell2, 'optionalAccess', _228 => _228.text, 'access', _229 => _229.trim, 'call', _230 => _230()]), () => ( ""));
|
|
20838
20918
|
return t.length > 0 && t.length <= 20 && isLabelCell(t);
|
|
20839
20919
|
})]), () => ( false));
|
|
20840
20920
|
if (!allLabels) return;
|
|
@@ -20842,16 +20922,16 @@ function fillTable(table2, values, filled, matchedLabels, patternFilledCells, bl
|
|
|
20842
20922
|
for (let c = 0; c < table2.cols; c++) {
|
|
20843
20923
|
if (covered.has(`${r},${c}`)) continue;
|
|
20844
20924
|
const headerCell = headerRow[c];
|
|
20845
|
-
const valueCell = _optionalChain([table2, 'access',
|
|
20925
|
+
const valueCell = _optionalChain([table2, 'access', _231 => _231.cells, 'access', _232 => _232[r], 'optionalAccess', _233 => _233[c]]);
|
|
20846
20926
|
if (!headerCell || !valueCell) continue;
|
|
20847
20927
|
const headerLabel = normalizeLabel(headerCell.text);
|
|
20848
|
-
if (_optionalChain([blockedLabels, 'optionalAccess',
|
|
20928
|
+
if (_optionalChain([blockedLabels, 'optionalAccess', _234 => _234.has, 'call', _235 => _235(headerLabel)])) continue;
|
|
20849
20929
|
const matchKey = findMatchingKey(headerLabel, values);
|
|
20850
20930
|
if (matchKey === void 0) continue;
|
|
20851
20931
|
if (!values.isArray(matchKey) && matchedLabels.has(matchKey)) continue;
|
|
20852
20932
|
const newValue = values.consume(matchKey);
|
|
20853
20933
|
if (newValue === void 0) continue;
|
|
20854
|
-
if (_optionalChain([patternFilledCells, 'optionalAccess',
|
|
20934
|
+
if (_optionalChain([patternFilledCells, 'optionalAccess', _236 => _236.has, 'call', _237 => _237(valueCell)])) {
|
|
20855
20935
|
valueCell.text = newValue + " " + valueCell.text;
|
|
20856
20936
|
} else {
|
|
20857
20937
|
valueCell.text = newValue;
|
|
@@ -20883,7 +20963,7 @@ function fillInlineFields(text, values, filled, matchedLabels, blockedLabels) {
|
|
|
20883
20963
|
if (newValue === void 0) continue;
|
|
20884
20964
|
matchedLabels.add(matchKey);
|
|
20885
20965
|
filled.push({ label: matched.label.trim(), value: newValue, row: -1, col: -1, key: matchKey });
|
|
20886
|
-
const ve = clampSegmentEnd(text, seg, segments[i + 1], _nullishCoalesce(_optionalChain([matches, 'access',
|
|
20966
|
+
const ve = clampSegmentEnd(text, seg, segments[i + 1], _nullishCoalesce(_optionalChain([matches, 'access', _238 => _238[i + 1], 'optionalAccess', _239 => _239.viaExt]), () => ( false)));
|
|
20887
20967
|
out += text.slice(pos, seg.valueStart);
|
|
20888
20968
|
out += seg.valueStart === ve ? padInsertion(text, seg.valueStart, newValue) : newValue;
|
|
20889
20969
|
pos = ve;
|
|
@@ -21445,19 +21525,19 @@ function parseCentralDirectory(buf) {
|
|
|
21445
21525
|
}
|
|
21446
21526
|
}
|
|
21447
21527
|
}
|
|
21448
|
-
if (eocdOffset < 0) throw new (0,
|
|
21528
|
+
if (eocdOffset < 0) throw new (0, _chunkF2HYH62Hcjs.KordocError)("ZIP EOCD\uB97C \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
21449
21529
|
const totalEntries = view.getUint16(eocdOffset + 10, true);
|
|
21450
21530
|
const cdSize = view.getUint32(eocdOffset + 12, true);
|
|
21451
21531
|
const cdOffset = view.getUint32(eocdOffset + 16, true);
|
|
21452
|
-
if (cdOffset === 4294967295 || totalEntries === 65535) throw new (0,
|
|
21532
|
+
if (cdOffset === 4294967295 || totalEntries === 65535) throw new (0, _chunkF2HYH62Hcjs.KordocError)("ZIP64\uB294 \uC9C0\uC6D0\uD558\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4");
|
|
21453
21533
|
if (eocdOffset >= 20 && view.getUint32(eocdOffset - 20, true) === ZIP64_EOCD_LOC_SIG) {
|
|
21454
|
-
throw new (0,
|
|
21534
|
+
throw new (0, _chunkF2HYH62Hcjs.KordocError)("ZIP64\uB294 \uC9C0\uC6D0\uD558\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4");
|
|
21455
21535
|
}
|
|
21456
21536
|
const decoder = new TextDecoder("utf-8");
|
|
21457
21537
|
const entries = [];
|
|
21458
21538
|
let pos = cdOffset;
|
|
21459
21539
|
for (let i = 0; i < totalEntries; i++) {
|
|
21460
|
-
if (view.getUint32(pos, true) !== CD_SIG) throw new (0,
|
|
21540
|
+
if (view.getUint32(pos, true) !== CD_SIG) throw new (0, _chunkF2HYH62Hcjs.KordocError)("ZIP Central Directory \uC190\uC0C1");
|
|
21461
21541
|
const flags = view.getUint16(pos + 8, true);
|
|
21462
21542
|
const method = view.getUint16(pos + 10, true);
|
|
21463
21543
|
const crc = view.getUint32(pos + 16, true);
|
|
@@ -21468,7 +21548,7 @@ function parseCentralDirectory(buf) {
|
|
|
21468
21548
|
const commentLen = view.getUint16(pos + 32, true);
|
|
21469
21549
|
const localOffset = view.getUint32(pos + 42, true);
|
|
21470
21550
|
if (compSize === 4294967295 || uncompSize === 4294967295 || localOffset === 4294967295) {
|
|
21471
|
-
throw new (0,
|
|
21551
|
+
throw new (0, _chunkF2HYH62Hcjs.KordocError)("ZIP64\uB294 \uC9C0\uC6D0\uD558\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4");
|
|
21472
21552
|
}
|
|
21473
21553
|
const name = decoder.decode(buf.subarray(pos + 46, pos + 46 + nameLen));
|
|
21474
21554
|
const cdEnd = pos + 46 + nameLen + extraLen + commentLen;
|
|
@@ -21497,11 +21577,11 @@ function patchZipEntries(original, replacements, additions) {
|
|
|
21497
21577
|
const { entries, cdOffset, eocdOffset } = parseCentralDirectory(original);
|
|
21498
21578
|
const view = new DataView(original.buffer, original.byteOffset, original.byteLength);
|
|
21499
21579
|
for (const name of replacements.keys()) {
|
|
21500
|
-
if (!entries.some((e) => e.name === name)) throw new (0,
|
|
21580
|
+
if (!entries.some((e) => e.name === name)) throw new (0, _chunkF2HYH62Hcjs.KordocError)(`ZIP\uC5D0 \uC5C6\uB294 \uC5D4\uD2B8\uB9AC: ${name}`);
|
|
21501
21581
|
}
|
|
21502
21582
|
if (additions) {
|
|
21503
21583
|
for (const name of additions.keys()) {
|
|
21504
|
-
if (entries.some((e) => e.name === name)) throw new (0,
|
|
21584
|
+
if (entries.some((e) => e.name === name)) throw new (0, _chunkF2HYH62Hcjs.KordocError)(`ZIP\uC5D0 \uC774\uBBF8 \uC788\uB294 \uC5D4\uD2B8\uB9AC: ${name}`);
|
|
21505
21585
|
}
|
|
21506
21586
|
}
|
|
21507
21587
|
const byLocal = [...entries].sort((a, b) => a.localOffset - b.localOffset);
|
|
@@ -21520,7 +21600,7 @@ function patchZipEntries(original, replacements, additions) {
|
|
|
21520
21600
|
offset += seg.length;
|
|
21521
21601
|
continue;
|
|
21522
21602
|
}
|
|
21523
|
-
if (view.getUint32(e.localOffset, true) !== LOCAL_SIG) throw new (0,
|
|
21603
|
+
if (view.getUint32(e.localOffset, true) !== LOCAL_SIG) throw new (0, _chunkF2HYH62Hcjs.KordocError)("ZIP \uB85C\uCEEC \uD5E4\uB354 \uC2DC\uADF8\uB2C8\uCC98 \uBD88\uC77C\uCE58");
|
|
21524
21604
|
const nameLen = view.getUint16(e.localOffset + 26, true);
|
|
21525
21605
|
const extraLen = view.getUint16(e.localOffset + 28, true);
|
|
21526
21606
|
const headerLen = 30 + nameLen + extraLen;
|
|
@@ -21528,7 +21608,7 @@ function patchZipEntries(original, replacements, additions) {
|
|
|
21528
21608
|
const hview = new DataView(header.buffer, header.byteOffset, header.byteLength);
|
|
21529
21609
|
const method = e.method;
|
|
21530
21610
|
if (method !== 0 && method !== 8) {
|
|
21531
|
-
throw new (0,
|
|
21611
|
+
throw new (0, _chunkF2HYH62Hcjs.KordocError)(`\uC9C0\uC6D0\uD558\uC9C0 \uC54A\uB294 ZIP \uC555\uCD95 \uBC29\uC2DD(method=${method}): ${e.name} \u2014 STORE(0)/DEFLATE(8)\uB9CC \uAD50\uCCB4 \uAC00\uB2A5`);
|
|
21532
21612
|
}
|
|
21533
21613
|
const compData = method === 0 ? newData : new Uint8Array(_zlib.deflateRawSync.call(void 0, newData));
|
|
21534
21614
|
const crc = crc32(newData);
|
|
@@ -21629,7 +21709,7 @@ async function fillHwpx(hwpxBuffer, values, blockedLabels) {
|
|
|
21629
21709
|
const zip = await _jszip2.default.loadAsync(hwpxBuffer);
|
|
21630
21710
|
const sectionPaths = Object.keys(zip.files).filter((name) => /[Ss]ection\d+\.xml$/i.test(name)).sort();
|
|
21631
21711
|
if (sectionPaths.length === 0) {
|
|
21632
|
-
throw new (0,
|
|
21712
|
+
throw new (0, _chunkF2HYH62Hcjs.KordocError)("HWPX\uC5D0\uC11C \uC139\uC158 \uD30C\uC77C\uC744 \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
21633
21713
|
}
|
|
21634
21714
|
const warnings = [];
|
|
21635
21715
|
const normalizedValues = normalizeValues(values, warnings);
|
|
@@ -21713,7 +21793,7 @@ async function fillHwpx(hwpxBuffer, values, blockedLabels) {
|
|
|
21713
21793
|
if (isKeywordLabel(cellLabelText(valueCell))) continue;
|
|
21714
21794
|
const normalizedCellLabel = normalizeLabel(labelText);
|
|
21715
21795
|
if (!normalizedCellLabel) continue;
|
|
21716
|
-
if (_optionalChain([blockedLabels, 'optionalAccess',
|
|
21796
|
+
if (_optionalChain([blockedLabels, 'optionalAccess', _240 => _240.has, 'call', _241 => _241(normalizedCellLabel)])) continue;
|
|
21717
21797
|
const matchKey = findMatchingKey(normalizedCellLabel, cursor);
|
|
21718
21798
|
if (matchKey === void 0) continue;
|
|
21719
21799
|
if (patternApplied.has(valueCell)) {
|
|
@@ -21771,7 +21851,7 @@ async function fillHwpx(hwpxBuffer, values, blockedLabels) {
|
|
|
21771
21851
|
const dataCells = table2.rows[rowIdx];
|
|
21772
21852
|
for (let colIdx = 0; colIdx < Math.min(headerCells.length, dataCells.length); colIdx++) {
|
|
21773
21853
|
const headerLabel = normalizeLabel(cellLabelText(headerCells[colIdx]));
|
|
21774
|
-
if (_optionalChain([blockedLabels, 'optionalAccess',
|
|
21854
|
+
if (_optionalChain([blockedLabels, 'optionalAccess', _242 => _242.has, 'call', _243 => _243(headerLabel)])) continue;
|
|
21775
21855
|
const matchKey = findMatchingKey(headerLabel, cursor);
|
|
21776
21856
|
if (matchKey === void 0) continue;
|
|
21777
21857
|
if (!cursor.isArray(matchKey) && matchedLabels.has(matchKey)) continue;
|
|
@@ -21825,7 +21905,7 @@ async function fillHwpx(hwpxBuffer, values, blockedLabels) {
|
|
|
21825
21905
|
}
|
|
21826
21906
|
for (const para2 of [...scan.bodyParagraphs, ...scan.excludedParagraphs]) {
|
|
21827
21907
|
const existing = ledger.get(para2);
|
|
21828
|
-
if (_optionalChain([existing, 'optionalAccess',
|
|
21908
|
+
if (_optionalChain([existing, 'optionalAccess', _244 => _244.fullText]) !== void 0) continue;
|
|
21829
21909
|
const text = matchText(para2);
|
|
21830
21910
|
const segments = scanInlineSegments(text);
|
|
21831
21911
|
const matches = segments.map((seg) => matchInlineSegment(seg, cursor, blockedLabels));
|
|
@@ -21836,7 +21916,7 @@ async function fillHwpx(hwpxBuffer, values, blockedLabels) {
|
|
|
21836
21916
|
const matchKey = matched.key;
|
|
21837
21917
|
const newValue = cursor.consume(matchKey);
|
|
21838
21918
|
if (newValue === void 0) continue;
|
|
21839
|
-
const ve = clampSegmentEnd(text, seg, segments[i + 1], _nullishCoalesce(_optionalChain([matches, 'access',
|
|
21919
|
+
const ve = clampSegmentEnd(text, seg, segments[i + 1], _nullishCoalesce(_optionalChain([matches, 'access', _245 => _245[i + 1], 'optionalAccess', _246 => _246.viaExt]), () => ( false)));
|
|
21840
21920
|
const replacement = seg.valueStart === ve ? padInsertion(text, seg.valueStart, newValue) : newValue;
|
|
21841
21921
|
const l = led(para2);
|
|
21842
21922
|
l.ranges.push({ start: seg.valueStart, end: ve, replacement });
|
|
@@ -21942,16 +22022,16 @@ var PARA_LIST = 7;
|
|
|
21942
22022
|
var DEFAULT_TEXT_COLOR = "#000000";
|
|
21943
22023
|
function resolveTheme(theme) {
|
|
21944
22024
|
return {
|
|
21945
|
-
h1: _nullishCoalesce(_optionalChain([theme, 'optionalAccess',
|
|
21946
|
-
h2: _nullishCoalesce(_optionalChain([theme, 'optionalAccess',
|
|
21947
|
-
h3: _nullishCoalesce(_optionalChain([theme, 'optionalAccess',
|
|
21948
|
-
h4: _nullishCoalesce(_nullishCoalesce(_optionalChain([theme, 'optionalAccess',
|
|
21949
|
-
body: _nullishCoalesce(_optionalChain([theme, 'optionalAccess',
|
|
21950
|
-
quote: _nullishCoalesce(_optionalChain([theme, 'optionalAccess',
|
|
22025
|
+
h1: _nullishCoalesce(_optionalChain([theme, 'optionalAccess', _247 => _247.headingColors, 'optionalAccess', _248 => _248[1]]), () => ( DEFAULT_TEXT_COLOR)),
|
|
22026
|
+
h2: _nullishCoalesce(_optionalChain([theme, 'optionalAccess', _249 => _249.headingColors, 'optionalAccess', _250 => _250[2]]), () => ( DEFAULT_TEXT_COLOR)),
|
|
22027
|
+
h3: _nullishCoalesce(_optionalChain([theme, 'optionalAccess', _251 => _251.headingColors, 'optionalAccess', _252 => _252[3]]), () => ( DEFAULT_TEXT_COLOR)),
|
|
22028
|
+
h4: _nullishCoalesce(_nullishCoalesce(_optionalChain([theme, 'optionalAccess', _253 => _253.headingColors, 'optionalAccess', _254 => _254[4]]), () => ( _optionalChain([theme, 'optionalAccess', _255 => _255.headingColors, 'optionalAccess', _256 => _256[3]]))), () => ( DEFAULT_TEXT_COLOR)),
|
|
22029
|
+
body: _nullishCoalesce(_optionalChain([theme, 'optionalAccess', _257 => _257.bodyColor]), () => ( DEFAULT_TEXT_COLOR)),
|
|
22030
|
+
quote: _nullishCoalesce(_optionalChain([theme, 'optionalAccess', _258 => _258.quoteColor]), () => ( DEFAULT_TEXT_COLOR)),
|
|
21951
22031
|
/** quoteColor가 명시되었는지 — blockquote charPr 분기에 사용 (baseline 호환) */
|
|
21952
|
-
hasQuoteOption: _optionalChain([theme, 'optionalAccess',
|
|
21953
|
-
tableHeader: _nullishCoalesce(_nullishCoalesce(_optionalChain([theme, 'optionalAccess',
|
|
21954
|
-
tableHeaderBold: !!_optionalChain([theme, 'optionalAccess',
|
|
22032
|
+
hasQuoteOption: _optionalChain([theme, 'optionalAccess', _259 => _259.quoteColor]) !== void 0,
|
|
22033
|
+
tableHeader: _nullishCoalesce(_nullishCoalesce(_optionalChain([theme, 'optionalAccess', _260 => _260.tableHeaderColor]), () => ( _optionalChain([theme, 'optionalAccess', _261 => _261.bodyColor]))), () => ( DEFAULT_TEXT_COLOR)),
|
|
22034
|
+
tableHeaderBold: !!_optionalChain([theme, 'optionalAccess', _262 => _262.tableHeaderBold])
|
|
21955
22035
|
};
|
|
21956
22036
|
}
|
|
21957
22037
|
function escapeXml(text) {
|
|
@@ -22366,7 +22446,7 @@ function assertSequentialIds(rows, label, startId) {
|
|
|
22366
22446
|
const m = rows[i].match(/\bid="(\d+)"/);
|
|
22367
22447
|
const got = m ? Number(m[1]) : NaN;
|
|
22368
22448
|
if (got !== startId + i) {
|
|
22369
|
-
throw new (0,
|
|
22449
|
+
throw new (0, _chunkF2HYH62Hcjs.KordocError)(
|
|
22370
22450
|
`\uB0B4\uBD80 \uC624\uB958: ${label} id \uD30C\uD2F0\uC158 \uB4DC\uB9AC\uD504\uD2B8 \u2014 ${startId + i} \uC704\uCE58\uC5D0 id=${m ? m[1] : "?"} \uBC29\uCD9C. id \uC0C1\uC218(gen-ids)\uC640 \uC2E4\uC81C \uBC29\uCD9C \uC218\uAC00 \uC5B4\uAE0B\uB0AC\uB2E4 (GJ_CHAR_COUNT\uB958 \uCE74\uC6B4\uD2B8\xB7base \uC0B0\uC220 \uD655\uC778)`
|
|
22371
22451
|
);
|
|
22372
22452
|
}
|
|
@@ -22450,7 +22530,7 @@ function buildCharProperties(theme, gongmun, ratioVariants = [], extraCharPrXmls
|
|
|
22450
22530
|
}
|
|
22451
22531
|
const expectedBase = charVariantBase(richAssets, !!gongmun);
|
|
22452
22532
|
if (rows.length !== expectedBase) {
|
|
22453
|
-
throw new (0,
|
|
22533
|
+
throw new (0, _chunkF2HYH62Hcjs.KordocError)(
|
|
22454
22534
|
`\uB0B4\uBD80 \uC624\uB958: charPr \uAE30\uBCF8 \uBE14\uB85D \uBC29\uCD9C \uC218(${rows.length}) \u2260 charVariantBase(${expectedBase}) \u2014 gen-header \uBC29\uCD9C \uD589\uACFC gen-ids \uCE74\uC6B4\uD2B8 \uC0C1\uC218\uAC00 \uC5B4\uAE0B\uB0AC\uB2E4`
|
|
22455
22535
|
);
|
|
22456
22536
|
}
|
|
@@ -22677,7 +22757,7 @@ function buildStyles(gongmun) {
|
|
|
22677
22757
|
</hh:styles>`;
|
|
22678
22758
|
}
|
|
22679
22759
|
function generateHeaderXml(theme, gongmun, ratioVariants = [], extraBorderFills = [], extraCharPrXmls = [], listIndentVariants = [], extraFonts = []) {
|
|
22680
|
-
const bodyFace = _nullishCoalesce(_optionalChain([gongmun, 'optionalAccess',
|
|
22760
|
+
const bodyFace = _nullishCoalesce(_optionalChain([gongmun, 'optionalAccess', _263 => _263.fonts, 'access', _264 => _264.body]), () => ( (_optionalChain([gongmun, 'optionalAccess', _265 => _265.bodyFont]) === "gothic" ? "\uB9D1\uC740 \uACE0\uB515" : "\uD568\uCD08\uB86C\uBC14\uD0D5")));
|
|
22681
22761
|
const charPropsXml = buildCharProperties(theme, gongmun, ratioVariants, extraCharPrXmls);
|
|
22682
22762
|
const paraPropsXml = buildParaProperties(gongmun, gongmun ? listIndentVariants : []);
|
|
22683
22763
|
return `<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
|
|
@@ -22806,8 +22886,8 @@ function parseChartFence(text) {
|
|
|
22806
22886
|
const spec = chartSpec(type);
|
|
22807
22887
|
let finalSeries = spec.pie ? [series[0]] : series;
|
|
22808
22888
|
finalSeries = finalSeries.map((s) => ({ ...s }));
|
|
22809
|
-
const ptLen = Math.max(_nullishCoalesce(_optionalChain([cat, 'optionalAccess',
|
|
22810
|
-
const catFinal = Array.from({ length: ptLen }, (_, i) => _nullishCoalesce(_optionalChain([cat, 'optionalAccess',
|
|
22889
|
+
const ptLen = Math.max(_nullishCoalesce(_optionalChain([cat, 'optionalAccess', _266 => _266.length]), () => ( 0)), ...finalSeries.map((s) => s.values.length));
|
|
22890
|
+
const catFinal = Array.from({ length: ptLen }, (_, i) => _nullishCoalesce(_optionalChain([cat, 'optionalAccess', _267 => _267[i]]), () => ( `\uD56D\uBAA9 ${i + 1}`)));
|
|
22811
22891
|
if (!spec.scatter) {
|
|
22812
22892
|
finalSeries = finalSeries.map((s) => ({ ...s, values: catFinal.map((_, i) => _nullishCoalesce(s.values[i], () => ( 0))) }));
|
|
22813
22893
|
}
|
|
@@ -22849,7 +22929,7 @@ function serSpPr(color, stroke) {
|
|
|
22849
22929
|
return stroke ? `<c:spPr><a:ln w="28575" cap="flat" cmpd="sng" algn="ctr">${f}<a:prstDash val="solid"/><a:round/></a:ln></c:spPr>` : `<c:spPr>${f}</c:spPr>`;
|
|
22850
22930
|
}
|
|
22851
22931
|
function dPtXml(pointColors, pie) {
|
|
22852
|
-
if (!_optionalChain([pointColors, 'optionalAccess',
|
|
22932
|
+
if (!_optionalChain([pointColors, 'optionalAccess', _268 => _268.length])) return "";
|
|
22853
22933
|
return pointColors.map((col, i) => {
|
|
22854
22934
|
const f = chartColorFill(col);
|
|
22855
22935
|
if (!f) return "";
|
|
@@ -23088,8 +23168,8 @@ function buildGaejosikCover(title, gongmun, bodyWidth = GAEJOSIK_BASE_WIDTH) {
|
|
|
23088
23168
|
const botRow = cell({ bf: GJ_BF_BAR_DARK, col: 0, row: 2, w: g.botDarkW, h: g.botBarH, paras: barEmpty }) + cell({ bf: GJ_BF_BAR_LIGHT, col: 1, colSpan: 2, row: 2, w: g.botLightW, h: g.botBarH, paras: barEmpty });
|
|
23089
23169
|
const tbl2 = table([topRow, titleRow, botRow], g.totalW, g.barH + g.titleH + g.botBarH, 3, 1, bodyWidth);
|
|
23090
23170
|
const host = `<hp:p paraPrIDRef="${PARA_NORMAL}" styleIDRef="0"><hp:run charPrIDRef="${CHAR_NORMAL}">${tbl2}</hp:run></hp:p>`;
|
|
23091
|
-
const date = _nullishCoalesce(_optionalChain([gongmun, 'access',
|
|
23092
|
-
const org = _nullishCoalesce(_optionalChain([gongmun, 'access',
|
|
23171
|
+
const date = _nullishCoalesce(_optionalChain([gongmun, 'access', _269 => _269.cover, 'optionalAccess', _270 => _270.date]), () => ( formatGaejosikDate(/* @__PURE__ */ new Date())));
|
|
23172
|
+
const org = _nullishCoalesce(_optionalChain([gongmun, 'access', _271 => _271.cover, 'optionalAccess', _272 => _272.org]), () => ( ""));
|
|
23093
23173
|
const sub = (t) => `<hp:p paraPrIDRef="${GJ_PARA_COVER}" styleIDRef="0"><hp:run charPrIDRef="${GJ_CHAR_COVER_SUB}"><hp:t>${escapeXml(t)}</hp:t></hp:run></hp:p>`;
|
|
23094
23174
|
const subEmpty = emptyPara(GJ_PARA_COVER, false, GJ_CHAR_COVER_SUB);
|
|
23095
23175
|
return [
|
|
@@ -23345,7 +23425,7 @@ function escapeGfm(text) {
|
|
|
23345
23425
|
}
|
|
23346
23426
|
var HWP_SHAPE_ALT_TEXT_RE = /^(?:모서리가 둥근 |둥근 )?(?:사각형|직사각형|정사각형|원|타원|삼각형|이등변 삼각형|직각 삼각형|선|직선|곡선|화살표|굵은 화살표|이중 화살표|오각형|육각형|팔각형|별|[4-8]점별|십자|십자형|구름|구름형|마름모|도넛|평행사변형|사다리꼴|부채꼴|호|반원|물결|번개|하트|빗금|블록 화살표|수식|표|그림|개체|그리기\s?개체|묶음\s?개체|글상자|수식\s?개체|OLE\s?개체)\s?입니다\.?$/gm;
|
|
23347
23427
|
function sanitizeText(text) {
|
|
23348
|
-
let result =
|
|
23428
|
+
let result = _chunkXTCT6KQ5cjs.mapPuaText.call(void 0, text).replace(/[\u{F0000}-\u{FFFFD}]/gu, "").replace(HWP_SHAPE_ALT_TEXT_RE, "").replace(/ +/g, " ").trim();
|
|
23349
23429
|
if (result.length <= 30 && result.includes(" ")) {
|
|
23350
23430
|
const tokens = result.split(" ");
|
|
23351
23431
|
const koreanSingleCharCount = tokens.filter((t) => t.length === 1 && /[가-ㄱ-ㆎ]/.test(t)).length;
|
|
@@ -23375,7 +23455,7 @@ function replicateGfmTable(table2) {
|
|
|
23375
23455
|
for (let r = 0; r < numRows; r++) {
|
|
23376
23456
|
for (let c = 0; c < numCols; c++) {
|
|
23377
23457
|
if (skip.has(`${r},${c}`)) continue;
|
|
23378
|
-
const cell2 = _optionalChain([cells, 'access',
|
|
23458
|
+
const cell2 = _optionalChain([cells, 'access', _273 => _273[r], 'optionalAccess', _274 => _274[c]]);
|
|
23379
23459
|
if (!cell2) continue;
|
|
23380
23460
|
display[r][c] = {
|
|
23381
23461
|
text: escapeGfm(sanitizeText(cell2.text)).replace(/\|/g, "\\|").replace(/\n/g, "<br>"),
|
|
@@ -23429,7 +23509,7 @@ function unescapeGfmCell(text) {
|
|
|
23429
23509
|
return text.replace(/<br\s*\/?>/gi, "\n").replace(/\\\|/g, "|").replace(/\\([~*_`])/g, "$1");
|
|
23430
23510
|
}
|
|
23431
23511
|
function replicateCellInnerHtml(cell2) {
|
|
23432
|
-
if (_optionalChain([cell2, 'access',
|
|
23512
|
+
if (_optionalChain([cell2, 'access', _275 => _275.blocks, 'optionalAccess', _276 => _276.length])) {
|
|
23433
23513
|
return cell2.blocks.map((b) => {
|
|
23434
23514
|
if (b.type === "table" && b.table) {
|
|
23435
23515
|
const cap = b.table.caption ? sanitizeText(b.table.caption) : "";
|
|
@@ -23468,7 +23548,7 @@ function replicateHtmlTable(table2) {
|
|
|
23468
23548
|
const rowCells = [];
|
|
23469
23549
|
for (let c = 0; c < numCols; c++) {
|
|
23470
23550
|
if (skip.has(`${r},${c}`)) continue;
|
|
23471
|
-
const cell2 = _optionalChain([cells, 'access',
|
|
23551
|
+
const cell2 = _optionalChain([cells, 'access', _277 => _277[r], 'optionalAccess', _278 => _278[c]]);
|
|
23472
23552
|
if (!cell2) continue;
|
|
23473
23553
|
for (let dr = 0; dr < cell2.rowSpan; dr++) {
|
|
23474
23554
|
for (let dc = 0; dc < cell2.colSpan; dc++) {
|
|
@@ -23514,10 +23594,10 @@ function parseHtmlTable(raw) {
|
|
|
23514
23594
|
}
|
|
23515
23595
|
} else {
|
|
23516
23596
|
if (!isClose) {
|
|
23517
|
-
const cs = parseInt(_optionalChain([attrs, 'access',
|
|
23518
|
-
const rs = parseInt(_optionalChain([attrs, 'access',
|
|
23597
|
+
const cs = parseInt(_optionalChain([attrs, 'access', _279 => _279.match, 'call', _280 => _280(/colspan\s*=\s*["']?(\d+)/i), 'optionalAccess', _281 => _281[1]]) || "1", 10);
|
|
23598
|
+
const rs = parseInt(_optionalChain([attrs, 'access', _282 => _282.match, 'call', _283 => _283(/rowspan\s*=\s*["']?(\d+)/i), 'optionalAccess', _284 => _284[1]]) || "1", 10);
|
|
23519
23599
|
cellStart = m.index + m[0].length;
|
|
23520
|
-
cellInfo = { colSpan: clampSpan(isNaN(cs) ? 1 : cs,
|
|
23600
|
+
cellInfo = { colSpan: clampSpan(isNaN(cs) ? 1 : cs, _chunkXTCT6KQ5cjs.MAX_COLS), rowSpan: clampSpan(isNaN(rs) ? 1 : rs, _chunkXTCT6KQ5cjs.MAX_ROWS) };
|
|
23521
23601
|
} else if (cellStart >= 0 && cellInfo && currentRow) {
|
|
23522
23602
|
currentRow.push({ inner: raw.slice(cellStart, m.index), colSpan: cellInfo.colSpan, rowSpan: cellInfo.rowSpan });
|
|
23523
23603
|
cellStart = -1;
|
|
@@ -23541,7 +23621,7 @@ function htmlCellInnerToLines(inner) {
|
|
|
23541
23621
|
hadNonText = true;
|
|
23542
23622
|
work = work.replace(/<img\s(?:"[^"]*"|'[^']*'|[^>"'])*?>/gi, (tag) => {
|
|
23543
23623
|
const m = /\bsrc\s*=\s*(?:"([^"]*)"|'([^']*)')/i.exec(tag);
|
|
23544
|
-
const src = _nullishCoalesce(_optionalChain([m, 'optionalAccess',
|
|
23624
|
+
const src = _nullishCoalesce(_optionalChain([m, 'optionalAccess', _285 => _285[1]]), () => ( _optionalChain([m, 'optionalAccess', _286 => _286[2]])));
|
|
23545
23625
|
if (src) imgSrcs.push(src);
|
|
23546
23626
|
return "";
|
|
23547
23627
|
});
|
|
@@ -23672,7 +23752,7 @@ function edgeXml(tag, d) {
|
|
|
23672
23752
|
return d ? `<hh:${tag} type="${escapeXml(d.type)}" width="${escapeXml(d.width)}" color="${escapeXml(d.color)}"/>` : `<hh:${tag} type="NONE" width="0.1 mm" color="#000000"/>`;
|
|
23673
23753
|
}
|
|
23674
23754
|
function borderFillDefToXml(id, def) {
|
|
23675
|
-
const fill = _optionalChain([def, 'access',
|
|
23755
|
+
const fill = _optionalChain([def, 'access', _287 => _287.fill, 'optionalAccess', _288 => _288.faceColor]) ? `<hh:fillBrush><hh:winBrush faceColor="${escapeXml(def.fill.faceColor)}" hatchColor="#000000" alpha="0"/></hh:fillBrush>` : "";
|
|
23676
23756
|
return ` <hh:borderFill id="${id}" threeD="0" shadow="0" centerLine="NONE" breakCellSeparateLine="0">
|
|
23677
23757
|
<hh:slash type="NONE" Crooked="0" isCounter="0"/>
|
|
23678
23758
|
<hh:backSlash type="NONE" Crooked="0" isCounter="0"/>
|
|
@@ -24077,11 +24157,11 @@ function estimateRowHeight(cells, widths, charHeight) {
|
|
|
24077
24157
|
function generateTable(rows, theme, style = null, remap = null, seq = 0, images = null) {
|
|
24078
24158
|
const rowCnt = rows.length;
|
|
24079
24159
|
const colCnt = Math.max(...rows.map((r) => r.length), 1);
|
|
24080
|
-
const reg = _nullishCoalesce(_optionalChain([style, 'optionalAccess',
|
|
24160
|
+
const reg = _nullishCoalesce(_optionalChain([style, 'optionalAccess', _289 => _289.bfRegistry]), () => ( null));
|
|
24081
24161
|
const totalW = style ? reg ? style.totalWidth - DATA_TABLE_INSET : style.totalWidth : 44e3;
|
|
24082
|
-
const measureH = _nullishCoalesce(_optionalChain([style, 'optionalAccess',
|
|
24162
|
+
const measureH = _nullishCoalesce(_optionalChain([style, 'optionalAccess', _290 => _290.charHeight]), () => ( 1e3));
|
|
24083
24163
|
const rowAnchor = normalizeRowAnchor((_nullishCoalesce(rows[0], () => ( []))).map((c) => c.replace(/!\[[^\]]*\]\([^)]*\)/g, "")));
|
|
24084
|
-
const prof = takeProfile(remap, rowCnt, colCnt, anchorOfMarkdownCell(_nullishCoalesce(_optionalChain([rows, 'access',
|
|
24164
|
+
const prof = takeProfile(remap, rowCnt, colCnt, anchorOfMarkdownCell(_nullishCoalesce(_optionalChain([rows, 'access', _291 => _291[0], 'optionalAccess', _292 => _292[0]]), () => ( ""))), seq, rowAnchor);
|
|
24085
24165
|
const colMax = Array(colCnt).fill(0);
|
|
24086
24166
|
const colMaxBody = Array(colCnt).fill(0);
|
|
24087
24167
|
const colMinWord = Array(colCnt).fill(0);
|
|
@@ -24109,7 +24189,7 @@ function generateTable(rows, theme, style = null, remap = null, seq = 0, images
|
|
|
24109
24189
|
const k = `${rowIdx},${colIdx}`;
|
|
24110
24190
|
const isLabelCell2 = labelCol0 && colIdx === 0;
|
|
24111
24191
|
const defaultCharPr = style ? reg && (isHeaderRow || isLabelCell2) ? style.boldCharPr : style.charPr : isHeaderRow ? headerCharPr : baseCharPr;
|
|
24112
|
-
const cellCharPr = _nullishCoalesce(_optionalChain([prof, 'optionalAccess',
|
|
24192
|
+
const cellCharPr = _nullishCoalesce(_optionalChain([prof, 'optionalAccess', _293 => _293.cellChar, 'access', _294 => _294.get, 'call', _295 => _295(k)]), () => ( defaultCharPr));
|
|
24113
24193
|
const centered = isHeaderRow || colCentered[colIdx];
|
|
24114
24194
|
const paraPrId = style ? centered ? _nullishCoalesce(style.tblCenterParaPr, () => ( style.centerParaPr)) : reg ? _nullishCoalesce(style.tblLeftParaPr, () => ( PARA_NORMAL)) : PARA_NORMAL : PARA_NORMAL;
|
|
24115
24195
|
const p = cell2.split(/<br\s*\/?>/i).map((seg) => {
|
|
@@ -24127,11 +24207,11 @@ function generateTable(rows, theme, style = null, remap = null, seq = 0, images
|
|
|
24127
24207
|
}
|
|
24128
24208
|
}
|
|
24129
24209
|
}
|
|
24130
|
-
const runs = generateRuns(seg, cellCharPr, _optionalChain([prof, 'optionalAccess',
|
|
24210
|
+
const runs = generateRuns(seg, cellCharPr, _optionalChain([prof, 'optionalAccess', _296 => _296.cellChar, 'access', _297 => _297.has, 'call', _298 => _298(k)]) ? void 0 : mapId);
|
|
24131
24211
|
const body = (runs || (picRuns ? "" : `<hp:run charPrIDRef="${cellCharPr}"><hp:t></hp:t></hp:run>`)) + picRuns;
|
|
24132
24212
|
return `<hp:p paraPrIDRef="${paraPrId}" styleIDRef="0">${body}</hp:p>`;
|
|
24133
24213
|
}).join("");
|
|
24134
|
-
const bf = _nullishCoalesce(_optionalChain([prof, 'optionalAccess',
|
|
24214
|
+
const bf = _nullishCoalesce(_optionalChain([prof, 'optionalAccess', _299 => _299.cellBf, 'access', _300 => _300.get, 'call', _301 => _301(k)]), () => ( (reg ? reg.get(dataCellSpec({
|
|
24135
24215
|
row: rowIdx,
|
|
24136
24216
|
rowEnd: rowIdx,
|
|
24137
24217
|
col: colIdx,
|
|
@@ -24141,7 +24221,7 @@ function generateTable(rows, theme, style = null, remap = null, seq = 0, images
|
|
|
24141
24221
|
headerRows: 1,
|
|
24142
24222
|
fill: isHeaderRow ? _nullishCoalesce(style.headerFill, () => ( "#E6E6E6")) : isLabelCell2 ? _nullishCoalesce(style.labelFill, () => ( "#E7E7E7")) : void 0
|
|
24143
24223
|
})) : style && isHeaderRow ? style.headerBf : 2)));
|
|
24144
|
-
const h = _nullishCoalesce(_optionalChain([prof, 'optionalAccess',
|
|
24224
|
+
const h = _nullishCoalesce(_optionalChain([prof, 'optionalAccess', _302 => _302.cellH, 'access', _303 => _303.get, 'call', _304 => _304(k)]), () => ( cellH));
|
|
24145
24225
|
return `<hp:tc name="" header="${isHeaderRow ? 1 : 0}" hasMargin="0" protect="0" editable="1" dirty="0" borderFillIDRef="${bf}"><hp:subList id="" textDirection="HORIZONTAL" lineWrap="BREAK" vertAlign="${style ? "CENTER" : "TOP"}" linkListIDRef="0" linkListNextIDRef="0" textWidth="0" textHeight="0" hasTextRef="0" hasNumRef="0">${p}</hp:subList><hp:cellAddr colAddr="${colIdx}" rowAddr="${rowIdx}"/><hp:cellSpan colSpan="1" rowSpan="1"/><hp:cellSz width="${colWidths[colIdx]}" height="${h}"/><hp:cellMargin left="141" right="141" top="141" bottom="141"/></hp:tc>`;
|
|
24146
24226
|
}).join("");
|
|
24147
24227
|
return `<hp:tr>${tdElements}</hp:tr>`;
|
|
@@ -24150,7 +24230,7 @@ function generateTable(rows, theme, style = null, remap = null, seq = 0, images
|
|
|
24150
24230
|
const tblH = rowHeights.reduce((a, b) => a + b, 0);
|
|
24151
24231
|
const tblInner = `<hp:sz width="${tblW}" widthRelTo="ABSOLUTE" height="${tblH}" heightRelTo="ABSOLUTE" protect="0"/><hp:pos treatAsChar="1" affectLSpacing="0" flowWithText="0" allowOverlap="0" holdAnchorAndSO="0" vertRelTo="PARA" horzRelTo="PARA" vertAlign="TOP" horzAlign="LEFT" vertOffset="0" horzOffset="0"/><hp:outMargin left="0" right="0" top="0" bottom="0"/><hp:inMargin left="510" right="510" top="141" bottom="141"/>` + trElements;
|
|
24152
24232
|
const tbl2 = `<hp:tbl id="${tblId}" zOrder="0" numberingType="TABLE" pageBreak="CELL" repeatHeader="${style ? 1 : 0}" rowCnt="${rowCnt}" colCnt="${colCnt}" cellSpacing="0" borderFillIDRef="2" noShading="0">${tblInner}</hp:tbl>`;
|
|
24153
|
-
const hostPr = reg && _optionalChain([style, 'optionalAccess',
|
|
24233
|
+
const hostPr = reg && _optionalChain([style, 'optionalAccess', _305 => _305.rightParaPr]) !== void 0 ? style.rightParaPr : 0;
|
|
24154
24234
|
return `<hp:p paraPrIDRef="${hostPr}" styleIDRef="0"><hp:run charPrIDRef="0">${tbl2}</hp:run></hp:p>`;
|
|
24155
24235
|
}
|
|
24156
24236
|
function layoutHtmlRows(rows) {
|
|
@@ -24161,8 +24241,8 @@ function layoutHtmlRows(rows) {
|
|
|
24161
24241
|
let c = 0;
|
|
24162
24242
|
for (const cell2 of rows[r].cells) {
|
|
24163
24243
|
while (occupied.has(`${r},${c}`)) c++;
|
|
24164
|
-
const colSpan = clampSpan(cell2.colSpan,
|
|
24165
|
-
const rowSpan = clampSpan(cell2.rowSpan,
|
|
24244
|
+
const colSpan = clampSpan(cell2.colSpan, _chunkXTCT6KQ5cjs.MAX_COLS);
|
|
24245
|
+
const rowSpan = clampSpan(cell2.rowSpan, _chunkXTCT6KQ5cjs.MAX_ROWS);
|
|
24166
24246
|
placed.push({ r, c, colSpan, rowSpan, inner: cell2.inner, isHeader: rows[r].tag === "th" });
|
|
24167
24247
|
for (let dr = 0; dr < rowSpan; dr++) {
|
|
24168
24248
|
for (let dc = 0; dc < colSpan; dc++) occupied.add(`${r + dr},${c + dc}`);
|
|
@@ -24190,7 +24270,7 @@ function generateHtmlTableXml(rawHtml, theme, totalWidth = 44e3, style = null, r
|
|
|
24190
24270
|
if (!rows || rows.length === 0) return null;
|
|
24191
24271
|
const { placed, rowCnt, colCnt } = layoutHtmlRows(rows);
|
|
24192
24272
|
if (rowCnt === 0 || colCnt === 0) return null;
|
|
24193
|
-
const measureH = _nullishCoalesce(_optionalChain([style, 'optionalAccess',
|
|
24273
|
+
const measureH = _nullishCoalesce(_optionalChain([style, 'optionalAccess', _306 => _306.charHeight]), () => ( 1e3));
|
|
24194
24274
|
const first = _nullishCoalesce(placed.find((p) => p.r === 0 && p.c === 0), () => ( placed[0]));
|
|
24195
24275
|
const row0 = Array.from({ length: colCnt }, () => "");
|
|
24196
24276
|
for (const cell2 of placed) {
|
|
@@ -24219,7 +24299,7 @@ function generateHtmlTableXml(rawHtml, theme, totalWidth = 44e3, style = null, r
|
|
|
24219
24299
|
const tblId = nextTableId();
|
|
24220
24300
|
const useHeaderStyle = !style && (theme.tableHeader !== theme.body || theme.tableHeaderBold);
|
|
24221
24301
|
const spanW = (cell2) => colWidths.slice(cell2.c, cell2.c + cell2.colSpan).reduce((a, b) => a + b, 0);
|
|
24222
|
-
const reg = _nullishCoalesce(_optionalChain([style, 'optionalAccess',
|
|
24302
|
+
const reg = _nullishCoalesce(_optionalChain([style, 'optionalAccess', _307 => _307.bfRegistry]), () => ( null));
|
|
24223
24303
|
let htmlHeaderRows = 0;
|
|
24224
24304
|
while (htmlHeaderRows < rows.length && rows[htmlHeaderRows].tag === "th") htmlHeaderRows++;
|
|
24225
24305
|
const tableRowHeights = Array(rowCnt).fill(cellH);
|
|
@@ -24234,7 +24314,7 @@ function generateHtmlTableXml(rawHtml, theme, totalWidth = 44e3, style = null, r
|
|
|
24234
24314
|
const nestedXml = generateHtmlTableXml(nested, theme, nestedW, style ? { ...style, totalWidth: nestedW } : null);
|
|
24235
24315
|
if (nestedXml) {
|
|
24236
24316
|
nestedXmls.push(nestedXml);
|
|
24237
|
-
const szH = _optionalChain([nestedXml, 'access',
|
|
24317
|
+
const szH = _optionalChain([nestedXml, 'access', _308 => _308.match, 'call', _309 => _309(/<hp:sz [^>]*height="(\d+)"/), 'optionalAccess', _310 => _310[1]]);
|
|
24238
24318
|
nestedH += (szH ? Number(szH) : (_nullishCoalesce(nested.match(/<tr[\s>]/gi), () => ( []))).length * cellH) + 300;
|
|
24239
24319
|
}
|
|
24240
24320
|
}
|
|
@@ -24243,7 +24323,7 @@ function generateHtmlTableXml(rawHtml, theme, totalWidth = 44e3, style = null, r
|
|
|
24243
24323
|
for (const line of lines) wrapLines += Math.max(1, Math.ceil(measureTextWidth(unescapeHtml(line).trim(), measureH, 100) / usable));
|
|
24244
24324
|
const lineH = style ? Math.round(measureH * 1.6) : 800;
|
|
24245
24325
|
const contentH = Math.max(cellH * rowSpan, Math.max(wrapLines, 1) * lineH + nestedH);
|
|
24246
|
-
const cellHeight = Math.max(_nullishCoalesce(_optionalChain([prof, 'optionalAccess',
|
|
24326
|
+
const cellHeight = Math.max(_nullishCoalesce(_optionalChain([prof, 'optionalAccess', _311 => _311.cellH, 'access', _312 => _312.get, 'call', _313 => _313(`${cell2.r},${cell2.c}`)]), () => ( 0)), contentH);
|
|
24247
24327
|
const perRow = Math.ceil(cellHeight / rowSpan);
|
|
24248
24328
|
for (let r = cell2.r; r < cell2.r + rowSpan; r++) tableRowHeights[r] = Math.max(tableRowHeights[r], perRow);
|
|
24249
24329
|
return { cell: cell2, rowSpan, lines, nestedXmls, imgSrcs: cellParsed[i].imgSrcs };
|
|
@@ -24254,7 +24334,7 @@ function generateHtmlTableXml(rawHtml, theme, totalWidth = 44e3, style = null, r
|
|
|
24254
24334
|
const baseCharPr = style ? style.charPr : CHAR_NORMAL;
|
|
24255
24335
|
const headerCharPr = isHeader && useHeaderStyle ? CHAR_TABLE_HEADER : baseCharPr;
|
|
24256
24336
|
const defaultCharPr = style && reg && isHeader ? style.boldCharPr : isHeader ? headerCharPr : baseCharPr;
|
|
24257
|
-
const charPrId = _nullishCoalesce(_optionalChain([prof, 'optionalAccess',
|
|
24337
|
+
const charPrId = _nullishCoalesce(_optionalChain([prof, 'optionalAccess', _314 => _314.cellChar, 'access', _315 => _315.get, 'call', _316 => _316(k)]), () => ( defaultCharPr));
|
|
24258
24338
|
const centered = isHeader || colCentered[cell2.c];
|
|
24259
24339
|
const paraPrId = style ? centered ? reg ? _nullishCoalesce(style.tblCenterParaPr, () => ( style.centerParaPr)) : style.centerParaPr : reg ? _nullishCoalesce(style.tblLeftParaPr, () => ( PARA_NORMAL)) : PARA_NORMAL : PARA_NORMAL;
|
|
24260
24340
|
const picUrls = images ? [...imgSrcs] : [];
|
|
@@ -24290,7 +24370,7 @@ function generateHtmlTableXml(rawHtml, theme, totalWidth = 44e3, style = null, r
|
|
|
24290
24370
|
let cellHeight = 0;
|
|
24291
24371
|
for (let r = cell2.r; r < cell2.r + rowSpan; r++) cellHeight += tableRowHeights[r];
|
|
24292
24372
|
const rowEnd = cell2.r + rowSpan - 1;
|
|
24293
|
-
const bf = _nullishCoalesce(_optionalChain([prof, 'optionalAccess',
|
|
24373
|
+
const bf = _nullishCoalesce(_optionalChain([prof, 'optionalAccess', _317 => _317.cellBf, 'access', _318 => _318.get, 'call', _319 => _319(k)]), () => ( (reg ? reg.get(dataCellSpec({
|
|
24294
24374
|
row: cell2.r,
|
|
24295
24375
|
rowEnd,
|
|
24296
24376
|
col: cell2.c,
|
|
@@ -24460,7 +24540,7 @@ function buildPressHead(g, ids, bodyWidth, reg) {
|
|
|
24460
24540
|
return [`<hp:p paraPrIDRef="${PARA_NORMAL}" styleIDRef="0"><hp:run charPrIDRef="${CHAR_NORMAL}">${table2}</hp:run></hp:p>`, blank()];
|
|
24461
24541
|
}
|
|
24462
24542
|
function buildPressContact(g, ids, bodyWidth, reg) {
|
|
24463
|
-
const c = _optionalChain([g, 'access',
|
|
24543
|
+
const c = _optionalChain([g, 'access', _320 => _320.press, 'optionalAccess', _321 => _321.contact]);
|
|
24464
24544
|
if (!c || !c.dept && !c.manager && !c.phone) return [];
|
|
24465
24545
|
const w = bodyWidth - 280;
|
|
24466
24546
|
const cells = [["\uB2F4\uB2F9 \uBD80\uC11C", _nullishCoalesce(c.dept, () => ( ""))], ["\uB2F4\uB2F9\uC790", _nullishCoalesce(c.manager, () => ( ""))], ["\uC5F0\uB77D\uCC98", _nullishCoalesce(c.phone, () => ( ""))]];
|
|
@@ -24841,7 +24921,7 @@ function generateSecPr(gongmun) {
|
|
|
24841
24921
|
}
|
|
24842
24922
|
const secPr = `<hp:secPr textDirection="HORIZONTAL" spaceColumns="1134" tabStop="8000" outlineShapeIDRef="1" memoShapeIDRef="0" textVerticalWidthHead="0" masterPageCnt="0"><hp:grid lineGrid="0" charGrid="0" wonggojiFormat="0"/><hp:startNum pageStartsOn="BOTH" page="0" pic="0" tbl="0" equation="0"/><hp:visibility hideFirstHeader="0" hideFirstFooter="0" hideFirstMasterPage="0" border="SHOW_ALL" fill="SHOW_ALL" hideFirstPageNum="0" hideFirstEmptyLine="0" showLineNumber="0"/><hp:pagePr landscape="WIDELY" width="${A4_W_HU}" height="${A4_H_HU}" gutterType="LEFT_ONLY"><hp:margin header="${m.header}" footer="${m.footer}" gutter="0" left="${m.left}" right="${m.right}" top="${m.top}" bottom="${m.bottom}"/></hp:pagePr><hp:footNotePr><hp:autoNumFormat type="DIGIT" userChar="" prefixChar="" suffixChar=")" supscript="0"/><hp:noteLine length="-1" type="SOLID" width="0.12 mm" color="#000000"/><hp:noteSpacing betweenNotes="283" belowLine="567" aboveLine="850"/><hp:numbering type="CONTINUOUS" newNum="1"/><hp:placement place="EACH_COLUMN" beneathText="0"/></hp:footNotePr><hp:endNotePr><hp:autoNumFormat type="DIGIT" userChar="" prefixChar="" suffixChar=")" supscript="0"/><hp:noteLine length="14692344" type="SOLID" width="0.12 mm" color="#000000"/><hp:noteSpacing betweenNotes="0" belowLine="567" aboveLine="850"/><hp:numbering type="CONTINUOUS" newNum="1"/><hp:placement place="END_OF_DOCUMENT" beneathText="0"/></hp:endNotePr></hp:secPr>`;
|
|
24843
24923
|
const colPr = `<hp:ctrl><hp:colPr id="" type="NEWSPAPER" layout="LEFT" colCount="1" sameSz="1" sameGap="0"/></hp:ctrl>`;
|
|
24844
|
-
return secPr + colPr + (_optionalChain([gongmun, 'optionalAccess',
|
|
24924
|
+
return secPr + colPr + (_optionalChain([gongmun, 'optionalAccess', _322 => _322.pageNumbers]) ? pageNumCtrl() : "");
|
|
24845
24925
|
}
|
|
24846
24926
|
var SectionOpener = (_class6 = class {
|
|
24847
24927
|
constructor(gongmun) {;_class6.prototype.__init12.call(this);
|
|
@@ -24880,19 +24960,19 @@ function buildPreamble(blocks, ctx) {
|
|
|
24880
24960
|
const { gongmun, dfIds, bfReg, tableStyle, richAssets, gjBodyW } = ctx;
|
|
24881
24961
|
const preamble = [];
|
|
24882
24962
|
let hasFrontPages = false;
|
|
24883
|
-
if (_optionalChain([gongmun, 'optionalAccess',
|
|
24963
|
+
if (_optionalChain([gongmun, 'optionalAccess', _323 => _323.reportInfo]) && dfIds) {
|
|
24884
24964
|
preamble.push(buildReportInfo(gongmun, dfIds));
|
|
24885
24965
|
}
|
|
24886
|
-
if (_optionalChain([gongmun, 'optionalAccess',
|
|
24966
|
+
if (_optionalChain([gongmun, 'optionalAccess', _324 => _324.approval]) && bfReg) {
|
|
24887
24967
|
preamble.push(buildApprovalTable(gongmun.approval, bfReg, richAssets ? GJ_CHAR_APPROVAL : GONGMUN_APPROVAL_CHAR));
|
|
24888
24968
|
}
|
|
24889
|
-
if (_optionalChain([gongmun, 'optionalAccess',
|
|
24969
|
+
if (_optionalChain([gongmun, 'optionalAccess', _325 => _325.docHead]) && dfIds) {
|
|
24890
24970
|
preamble.push(...buildDocHead(gongmun, dfIds));
|
|
24891
24971
|
}
|
|
24892
|
-
if (_optionalChain([gongmun, 'optionalAccess',
|
|
24972
|
+
if (_optionalChain([gongmun, 'optionalAccess', _326 => _326.noticeHead]) && dfIds) {
|
|
24893
24973
|
preamble.push(...buildNoticeHead(gongmun));
|
|
24894
24974
|
}
|
|
24895
|
-
if (_optionalChain([gongmun, 'optionalAccess',
|
|
24975
|
+
if (_optionalChain([gongmun, 'optionalAccess', _327 => _327.press]) && dfIds && bfReg && tableStyle) {
|
|
24896
24976
|
preamble.push(...buildPressHead(gongmun, dfIds, tableStyle.totalWidth, bfReg));
|
|
24897
24977
|
}
|
|
24898
24978
|
if (gongmun && (gongmun.cover || gongmun.toc)) {
|
|
@@ -24921,7 +25001,7 @@ function buildPreamble(blocks, ctx) {
|
|
|
24921
25001
|
}
|
|
24922
25002
|
if (gongmun && !ctx.gaejosik && ctx.coverH1Idx < 0 && bfReg && (gongmun.preset === "report" || gongmun.preset === "plan" || gongmun.preset === "notice")) {
|
|
24923
25003
|
ctx.titleBoxH1Idx = blocks.findIndex((b) => b.type === "heading" && (_nullishCoalesce(b.level, () => ( 1))) === 1);
|
|
24924
|
-
} else if (_optionalChain([gongmun, 'optionalAccess',
|
|
25004
|
+
} else if (_optionalChain([gongmun, 'optionalAccess', _328 => _328.press]) && ctx.coverH1Idx < 0 && dfIds) {
|
|
24925
25005
|
ctx.pressH1Idx = blocks.findIndex((b) => b.type === "heading" && (_nullishCoalesce(b.level, () => ( 1))) === 1);
|
|
24926
25006
|
}
|
|
24927
25007
|
if (preamble.length > 0) {
|
|
@@ -24936,7 +25016,7 @@ function renderHeading(block, blockIdx, ctx) {
|
|
|
24936
25016
|
if (gongmun && blockIdx === ctx.coverH1Idx) return "";
|
|
24937
25017
|
if (gongmun && blockIdx === ctx.pressH1Idx && dfIds) {
|
|
24938
25018
|
const parts = [generateParagraph((block.text || "").trim(), GONGMUN_CENTER, dfIds.pressTitle)];
|
|
24939
|
-
for (const s of _nullishCoalesce(_optionalChain([gongmun, 'access',
|
|
25019
|
+
for (const s of _nullishCoalesce(_optionalChain([gongmun, 'access', _329 => _329.press, 'optionalAccess', _330 => _330.sub]), () => ( []))) {
|
|
24940
25020
|
parts.push(generateParagraph(`- ${s} -`, GONGMUN_CENTER, dfIds.pressSub));
|
|
24941
25021
|
}
|
|
24942
25022
|
return parts.join("\n ");
|
|
@@ -25030,8 +25110,8 @@ function renderListItem(block, blockIdx, ctx) {
|
|
|
25030
25110
|
const { gongmun, gongmunList, measured, fit, vBase, dfIds } = ctx;
|
|
25031
25111
|
if (gongmun && gongmunList) {
|
|
25032
25112
|
const info = gongmunList.items.get(blockIdx);
|
|
25033
|
-
const depth = _nullishCoalesce(_optionalChain([info, 'optionalAccess',
|
|
25034
|
-
const marker2 = _nullishCoalesce(_optionalChain([info, 'optionalAccess',
|
|
25113
|
+
const depth = _nullishCoalesce(_optionalChain([info, 'optionalAccess', _331 => _331.depth]), () => ( 0));
|
|
25114
|
+
const marker2 = _nullishCoalesce(_optionalChain([info, 'optionalAccess', _332 => _332.marker]), () => ( ""));
|
|
25035
25115
|
const content = block.text || "";
|
|
25036
25116
|
if (measured && content.trimStart().startsWith("\u203B")) {
|
|
25037
25117
|
return generateParagraph(content.trim(), GJ_PARA_CHAM, GJ_CHAR_CHAM, ctx.chamMap);
|
|
@@ -25040,7 +25120,7 @@ function renderListItem(block, blockIdx, ctx) {
|
|
|
25040
25120
|
return generateParagraph(`* ${content.trim()}`, GJ_PARA_CHAM, GJ_CHAR_CHAM, ctx.chamMap);
|
|
25041
25121
|
}
|
|
25042
25122
|
const text = marker2 ? `${marker2} ${content}` : content;
|
|
25043
|
-
const listParaPr = marker2 ? _optionalChain([info, 'optionalAccess',
|
|
25123
|
+
const listParaPr = marker2 ? _optionalChain([info, 'optionalAccess', _333 => _333.indentVariant]) !== void 0 ? GONGMUN_LIST_VARIANT_BASE + info.indentVariant : GONGMUN_LIST_BASE + depth : GONGMUN_LIST_PLAIN_BASE + depth;
|
|
25044
25124
|
let listCharPr = gongmun.numbering === "report" && depth === 0 ? CHAR_BOLD : CHAR_NORMAL;
|
|
25045
25125
|
let mapId = fit ? variantMapper(fit, blockIdx, vBase) : void 0;
|
|
25046
25126
|
if (measured && depth === 0 && gongmun.numbering !== "standard") {
|
|
@@ -25099,18 +25179,18 @@ function renderHtmlTable(block, ctx) {
|
|
|
25099
25179
|
}
|
|
25100
25180
|
function appendPostamble(blocks, ctx) {
|
|
25101
25181
|
const { gongmun, dfIds, bfReg, tableStyle, paraXmls } = ctx;
|
|
25102
|
-
if (_optionalChain([gongmun, 'optionalAccess',
|
|
25182
|
+
if (_optionalChain([gongmun, 'optionalAccess', _334 => _334.noticeHead]) && dfIds) {
|
|
25103
25183
|
paraXmls.push(...buildNoticeFoot(gongmun));
|
|
25104
25184
|
}
|
|
25105
|
-
if (_optionalChain([gongmun, 'optionalAccess',
|
|
25106
|
-
const lastBlock = [...blocks].reverse().find((b) => (b.text || "").trim() || b.type === "table" && _optionalChain([b, 'access',
|
|
25185
|
+
if (_optionalChain([gongmun, 'optionalAccess', _335 => _335.endMark]) && paraXmls.length > 0) {
|
|
25186
|
+
const lastBlock = [...blocks].reverse().find((b) => (b.text || "").trim() || b.type === "table" && _optionalChain([b, 'access', _336 => _336.rows, 'optionalAccess', _337 => _337.length]));
|
|
25107
25187
|
const lastText = lastBlock && (lastBlock.type === "paragraph" || lastBlock.type === "list_item") ? lastBlock.text || "" : "";
|
|
25108
25188
|
if (!hasEndMark(lastText)) paraXmls.push(buildEndMark());
|
|
25109
25189
|
}
|
|
25110
|
-
if (_optionalChain([gongmun, 'optionalAccess',
|
|
25190
|
+
if (_optionalChain([gongmun, 'optionalAccess', _338 => _338.docFoot]) && dfIds) {
|
|
25111
25191
|
paraXmls.push(...buildDocFoot(gongmun, dfIds));
|
|
25112
25192
|
}
|
|
25113
|
-
if (_optionalChain([gongmun, 'optionalAccess',
|
|
25193
|
+
if (_optionalChain([gongmun, 'optionalAccess', _339 => _339.press]) && dfIds && bfReg && tableStyle) {
|
|
25114
25194
|
paraXmls.push(...buildPressContact(gongmun, dfIds, tableStyle.totalWidth, bfReg));
|
|
25115
25195
|
}
|
|
25116
25196
|
}
|
|
@@ -25130,7 +25210,7 @@ function blocksToSectionXml(blocks, theme, gongmun, gongmunList = gongmun ? prec
|
|
|
25130
25210
|
remap,
|
|
25131
25211
|
dfIds,
|
|
25132
25212
|
images,
|
|
25133
|
-
gaejosik: _optionalChain([gongmun, 'optionalAccess',
|
|
25213
|
+
gaejosik: _optionalChain([gongmun, 'optionalAccess', _340 => _340.preset]) === "gaejosik",
|
|
25134
25214
|
measured,
|
|
25135
25215
|
richAssets,
|
|
25136
25216
|
vBase: charVariantBase(richAssets, !!gongmun),
|
|
@@ -25236,18 +25316,18 @@ function blocksToSectionXml(blocks, theme, gongmun, gongmunList = gongmun ? prec
|
|
|
25236
25316
|
|
|
25237
25317
|
// src/hwpx/generator.ts
|
|
25238
25318
|
async function markdownToHwpx(markdown, options) {
|
|
25239
|
-
const theme = resolveTheme(_optionalChain([options, 'optionalAccess',
|
|
25240
|
-
const gongmun = _optionalChain([options, 'optionalAccess',
|
|
25319
|
+
const theme = resolveTheme(_optionalChain([options, 'optionalAccess', _341 => _341.theme]));
|
|
25320
|
+
const gongmun = _optionalChain([options, 'optionalAccess', _342 => _342.gongmun]) ? resolveGongmun(options.gongmun) : null;
|
|
25241
25321
|
const measured = !!gongmun && usesReportFonts(gongmun.preset);
|
|
25242
25322
|
const richAssets = !!gongmun && needsGaejosikAssets(gongmun);
|
|
25243
25323
|
const blocks = parseMarkdownToBlocks(markdown);
|
|
25244
25324
|
const gongmunList = gongmun ? precomputeGongmunList(blocks, gongmun) : null;
|
|
25245
25325
|
const fit = gongmun && gongmunList ? computeGongmunFitPlan(blocks, gongmun, gongmunList) : null;
|
|
25246
25326
|
const staticBfEnd = staticBorderFillNext(gongmun);
|
|
25247
|
-
const remap = _optionalChain([options, 'optionalAccess',
|
|
25248
|
-
const bfReg = gongmun ? new TableBfRegistry(staticBfEnd + (_nullishCoalesce(_optionalChain([remap, 'optionalAccess',
|
|
25327
|
+
const remap = _optionalChain([options, 'optionalAccess', _343 => _343.profile]) ? buildProfileRemap(options.profile, charVariantBase(richAssets, !!gongmun) + (_nullishCoalesce(_optionalChain([fit, 'optionalAccess', _344 => _344.variants, 'optionalAccess', _345 => _345.length]), () => ( 0))) * 4, staticBfEnd, staticFontNext(gongmun)) : null;
|
|
25328
|
+
const bfReg = gongmun ? new TableBfRegistry(staticBfEnd + (_nullishCoalesce(_optionalChain([remap, 'optionalAccess', _346 => _346.borderFillXmls, 'access', _347 => _347.length]), () => ( 0)))) : null;
|
|
25249
25329
|
const dfActive = !!gongmun && docframeActive(gongmun);
|
|
25250
|
-
const dfBase = charVariantBase(richAssets, !!gongmun) + (_nullishCoalesce(_optionalChain([fit, 'optionalAccess',
|
|
25330
|
+
const dfBase = charVariantBase(richAssets, !!gongmun) + (_nullishCoalesce(_optionalChain([fit, 'optionalAccess', _348 => _348.variants, 'optionalAccess', _349 => _349.length]), () => ( 0))) * 4 + (_nullishCoalesce(_optionalChain([remap, 'optionalAccess', _350 => _350.charPrXmls, 'access', _351 => _351.length]), () => ( 0)));
|
|
25251
25331
|
const dfIds = dfActive ? docframeIds(dfBase) : null;
|
|
25252
25332
|
const chartParts = [];
|
|
25253
25333
|
const images = new ImageRegistry();
|
|
@@ -25258,7 +25338,7 @@ async function markdownToHwpx(markdown, options) {
|
|
|
25258
25338
|
console.warn(`[kordoc] format profile: \uD504\uB85C\uD544 \uD45C ${unused}\uAC1C\uAC00 \uBB38\uC11C \uD45C\uC640 \uB9E4\uCE6D\uB418\uC9C0 \uC54A\uC544 \uBBF8\uC801\uC6A9 (\uD589\xB7\uC5F4/\uCCAB \uC140 \uD14D\uC2A4\uD2B8 \uBD88\uC77C\uCE58)`);
|
|
25259
25339
|
}
|
|
25260
25340
|
}
|
|
25261
|
-
const extraBorderFills = [..._nullishCoalesce(_optionalChain([remap, 'optionalAccess',
|
|
25341
|
+
const extraBorderFills = [..._nullishCoalesce(_optionalChain([remap, 'optionalAccess', _352 => _352.borderFillXmls]), () => ( [])), ..._nullishCoalesce(_optionalChain([bfReg, 'optionalAccess', _353 => _353.emit, 'call', _354 => _354()]), () => ( []))];
|
|
25262
25342
|
const zip = new (0, _jszip2.default)();
|
|
25263
25343
|
zip.file("mimetype", "application/hwp+zip", { compression: "STORE" });
|
|
25264
25344
|
zip.file("META-INF/container.xml", generateContainerXml());
|
|
@@ -25267,11 +25347,11 @@ async function markdownToHwpx(markdown, options) {
|
|
|
25267
25347
|
zip.file("Contents/header.xml", generateHeaderXml(
|
|
25268
25348
|
theme,
|
|
25269
25349
|
gongmun,
|
|
25270
|
-
_nullishCoalesce(_optionalChain([fit, 'optionalAccess',
|
|
25350
|
+
_nullishCoalesce(_optionalChain([fit, 'optionalAccess', _355 => _355.variants]), () => ( [])),
|
|
25271
25351
|
extraBorderFills,
|
|
25272
|
-
[..._nullishCoalesce(_optionalChain([remap, 'optionalAccess',
|
|
25273
|
-
_nullishCoalesce(_optionalChain([gongmunList, 'optionalAccess',
|
|
25274
|
-
_nullishCoalesce(_optionalChain([remap, 'optionalAccess',
|
|
25352
|
+
[..._nullishCoalesce(_optionalChain([remap, 'optionalAccess', _356 => _356.charPrXmls]), () => ( [])), ...dfActive ? docframeCharPrXmls(dfBase, richAssets) : []],
|
|
25353
|
+
_nullishCoalesce(_optionalChain([gongmunList, 'optionalAccess', _357 => _357.indentVariants]), () => ( [])),
|
|
25354
|
+
_nullishCoalesce(_optionalChain([remap, 'optionalAccess', _358 => _358.fontFaces]), () => ( []))
|
|
25275
25355
|
));
|
|
25276
25356
|
zip.file("Contents/section0.xml", sectionXml);
|
|
25277
25357
|
for (const part of chartParts) zip.file(part.name, part.xml);
|
|
@@ -25322,7 +25402,7 @@ function alignBlocks(a, b) {
|
|
|
25322
25402
|
const m = a.length, n = b.length;
|
|
25323
25403
|
if (m * n > 1e7) return fallbackAlign(a, b);
|
|
25324
25404
|
const lenOf = (blk) => {
|
|
25325
|
-
const t = blk.text !== void 0 ? blk.text : blk.type === "table" && blk.table ? blk.table.cells.flat().map((c) => _nullishCoalesce(_optionalChain([c, 'optionalAccess',
|
|
25405
|
+
const t = blk.text !== void 0 ? blk.text : blk.type === "table" && blk.table ? blk.table.cells.flat().map((c) => _nullishCoalesce(_optionalChain([c, 'optionalAccess', _359 => _359.text]), () => ( ""))).join(" ") : "";
|
|
25326
25406
|
return t.replace(/\s+/g, " ").trim().length;
|
|
25327
25407
|
};
|
|
25328
25408
|
const aLen = a.map(lenOf);
|
|
@@ -25395,8 +25475,8 @@ function blockSimilarity(a, b) {
|
|
|
25395
25475
|
}
|
|
25396
25476
|
function tableSimilarity(a, b) {
|
|
25397
25477
|
const dimSim = 1 - Math.abs(a.rows * a.cols - b.rows * b.cols) / Math.max(a.rows * a.cols, b.rows * b.cols, 1);
|
|
25398
|
-
const textsA = a.cells.flat().map((c) => _nullishCoalesce(_optionalChain([c, 'optionalAccess',
|
|
25399
|
-
const textsB = b.cells.flat().map((c) => _nullishCoalesce(_optionalChain([c, 'optionalAccess',
|
|
25478
|
+
const textsA = a.cells.flat().map((c) => _nullishCoalesce(_optionalChain([c, 'optionalAccess', _360 => _360.text]), () => ( ""))).join(" ");
|
|
25479
|
+
const textsB = b.cells.flat().map((c) => _nullishCoalesce(_optionalChain([c, 'optionalAccess', _361 => _361.text]), () => ( ""))).join(" ");
|
|
25400
25480
|
const contentSim = normalizedSimilarity(textsA, textsB);
|
|
25401
25481
|
return dimSim * 0.3 + contentSim * 0.7;
|
|
25402
25482
|
}
|
|
@@ -25407,8 +25487,8 @@ function diffTableCells(a, b) {
|
|
|
25407
25487
|
for (let r = 0; r < maxRows; r++) {
|
|
25408
25488
|
const row = [];
|
|
25409
25489
|
for (let c = 0; c < maxCols; c++) {
|
|
25410
|
-
const cellA = r < a.rows && c < a.cols ? _optionalChain([a, 'access',
|
|
25411
|
-
const cellB = r < b.rows && c < b.cols ? _optionalChain([b, 'access',
|
|
25490
|
+
const cellA = r < a.rows && c < a.cols ? _optionalChain([a, 'access', _362 => _362.cells, 'access', _363 => _363[r], 'optionalAccess', _364 => _364[c], 'optionalAccess', _365 => _365.text]) : void 0;
|
|
25491
|
+
const cellB = r < b.rows && c < b.cols ? _optionalChain([b, 'access', _366 => _366.cells, 'access', _367 => _367[r], 'optionalAccess', _368 => _368[c], 'optionalAccess', _369 => _369.text]) : void 0;
|
|
25412
25492
|
let type;
|
|
25413
25493
|
if (cellA === void 0) type = "added";
|
|
25414
25494
|
else if (cellB === void 0) type = "removed";
|
|
@@ -25574,7 +25654,7 @@ function parseRenderStyles(headXml) {
|
|
|
25574
25654
|
const underlineEl = findChildByLocalName(el, "underline");
|
|
25575
25655
|
const textColor = el.getAttribute("textColor");
|
|
25576
25656
|
const fontRef = findChildByLocalName(el, "fontRef");
|
|
25577
|
-
const fontId = _nullishCoalesce(_optionalChain([fontRef, 'optionalAccess',
|
|
25657
|
+
const fontId = _nullishCoalesce(_optionalChain([fontRef, 'optionalAccess', _370 => _370.getAttribute, 'call', _371 => _371("hangul")]), () => ( _optionalChain([fontRef, 'optionalAccess', _372 => _372.getAttribute, 'call', _373 => _373("latin")])));
|
|
25578
25658
|
const face = fontId != null ? hangulFonts.get(fontId) : void 0;
|
|
25579
25659
|
styles.charPr.set(id, {
|
|
25580
25660
|
height: Number(el.getAttribute("height")) || 1e3,
|
|
@@ -25582,8 +25662,8 @@ function parseRenderStyles(headXml) {
|
|
|
25582
25662
|
italic: findChildByLocalName(el, "italic") != null,
|
|
25583
25663
|
underline: underlineEl != null && (_nullishCoalesce(underlineEl.getAttribute("type"), () => ( "NONE"))) !== "NONE",
|
|
25584
25664
|
color: textColor && textColor !== "#000000" && textColor.toLowerCase() !== "none" ? textColor : void 0,
|
|
25585
|
-
ratio: Number(_optionalChain([ratioEl, 'optionalAccess',
|
|
25586
|
-
spacing: Number(_optionalChain([spacingEl, 'optionalAccess',
|
|
25665
|
+
ratio: Number(_optionalChain([ratioEl, 'optionalAccess', _374 => _374.getAttribute, 'call', _375 => _375("hangul")])) || 100,
|
|
25666
|
+
spacing: Number(_optionalChain([spacingEl, 'optionalAccess', _376 => _376.getAttribute, 'call', _377 => _377("hangul")])) || 0,
|
|
25587
25667
|
fontFamily: face ? hwpFaceToCssStack(face) : void 0,
|
|
25588
25668
|
face
|
|
25589
25669
|
});
|
|
@@ -25592,7 +25672,7 @@ function parseRenderStyles(headXml) {
|
|
|
25592
25672
|
const id = el.getAttribute("id");
|
|
25593
25673
|
if (id != null) {
|
|
25594
25674
|
const align = findChildByLocalName(el, "align");
|
|
25595
|
-
styles.paraAlign.set(id, _optionalChain([align, 'optionalAccess',
|
|
25675
|
+
styles.paraAlign.set(id, _optionalChain([align, 'optionalAccess', _378 => _378.getAttribute, 'call', _379 => _379("horizontal")]) || "JUSTIFY");
|
|
25596
25676
|
styles.paraGeom.set(id, parseParaGeom(el));
|
|
25597
25677
|
}
|
|
25598
25678
|
} else if (tag === "borderFill") {
|
|
@@ -25606,7 +25686,7 @@ function parseRenderStyles(headXml) {
|
|
|
25606
25686
|
};
|
|
25607
25687
|
const fillBrush = findChildByLocalName(el, "fillBrush");
|
|
25608
25688
|
const winBrush = fillBrush ? findChildByLocalName(fillBrush, "winBrush") : null;
|
|
25609
|
-
const face = _optionalChain([winBrush, 'optionalAccess',
|
|
25689
|
+
const face = _optionalChain([winBrush, 'optionalAccess', _380 => _380.getAttribute, 'call', _381 => _381("faceColor")]);
|
|
25610
25690
|
if (face && face.toLowerCase() !== "none") bf.fill = face;
|
|
25611
25691
|
styles.borderFill.set(id, bf);
|
|
25612
25692
|
}
|
|
@@ -25678,7 +25758,7 @@ function collectSites(scan) {
|
|
|
25678
25758
|
}
|
|
25679
25759
|
function attrOf(openTag, name) {
|
|
25680
25760
|
const m = openTag.match(new RegExp(`\\b${name}="([^"]*)"`));
|
|
25681
|
-
return _optionalChain([m, 'optionalAccess',
|
|
25761
|
+
return _optionalChain([m, 'optionalAccess', _382 => _382[1]]);
|
|
25682
25762
|
}
|
|
25683
25763
|
function paraOpenTag(xml, para2) {
|
|
25684
25764
|
const end = xml.indexOf(">", para2.start);
|
|
@@ -25693,7 +25773,7 @@ function anchorRunInfo(xml, para2, anchor) {
|
|
|
25693
25773
|
if (!tr) return null;
|
|
25694
25774
|
const before = xml.slice(Math.max(0, para2.start), tr.contentStart);
|
|
25695
25775
|
const runOpen = [...before.matchAll(/<([A-Za-z0-9]+):run\b[^>]*>/g)].pop();
|
|
25696
|
-
const prefix = _nullishCoalesce(_nullishCoalesce(_optionalChain([runOpen, 'optionalAccess',
|
|
25776
|
+
const prefix = _nullishCoalesce(_nullishCoalesce(_optionalChain([runOpen, 'optionalAccess', _383 => _383[1]]), () => ( tr.prefix)), () => ( "hp"));
|
|
25697
25777
|
const charPr2 = runOpen && attrOf(runOpen[0], "charPrIDRef") || "0";
|
|
25698
25778
|
const close = xml.indexOf(`</${prefix}:run>`, tr.contentEnd);
|
|
25699
25779
|
if (close === -1) return null;
|
|
@@ -25720,7 +25800,7 @@ function cellContentWidthMm(xml, cell2) {
|
|
|
25720
25800
|
if (width === null) return null;
|
|
25721
25801
|
let content = width;
|
|
25722
25802
|
const win = cellAddrWindow(xml, cell2);
|
|
25723
|
-
const mg = _optionalChain([win, 'optionalAccess',
|
|
25803
|
+
const mg = _optionalChain([win, 'optionalAccess', _384 => _384.match, 'call', _385 => _385(/<[A-Za-z0-9]+:cellMargin\b[^>]*>/)]);
|
|
25724
25804
|
if (mg) {
|
|
25725
25805
|
content -= Number(_nullishCoalesce(attrOf(mg[0], "left"), () => ( 0))) + Number(_nullishCoalesce(attrOf(mg[0], "right"), () => ( 0)));
|
|
25726
25806
|
}
|
|
@@ -25754,11 +25834,11 @@ function buildFloatPicXml(itemId, sizeHu, posXHu, posYHu, ids) {
|
|
|
25754
25834
|
return `<hp:pic xmlns:hc="http://www.hancom.co.kr/hwpml/2011/core" id="${ids.id}" zOrder="0" numberingType="PICTURE" textWrap="IN_FRONT_OF_TEXT" textFlow="BOTH_SIDES" lock="0" dropcapstyle="None" href="" groupLevel="0" instid="${ids.instid}" reverse="0"><hp:offset x="0" y="0"/><hp:orgSz width="${w}" height="${h}"/><hp:curSz width="${w}" height="${h}"/><hp:flip horizontal="0" vertical="0"/><hp:rotationInfo angle="0" centerX="${Math.round(w / 2)}" centerY="${Math.round(h / 2)}" rotateimage="1"/><hp:renderingInfo><hc:transMatrix e1="1" e2="0" e3="0" e4="0" e5="1" e6="0"/><hc:scaMatrix e1="1" e2="0" e3="0" e4="0" e5="1" e6="0"/><hc:rotMatrix e1="1" e2="0" e3="0" e4="0" e5="1" e6="0"/></hp:renderingInfo><hp:imgRect><hc:pt0 x="0" y="0"/><hc:pt1 x="${w}" y="0"/><hc:pt2 x="${w}" y="${h}"/><hc:pt3 x="0" y="${h}"/></hp:imgRect><hp:imgClip left="0" right="${w}" top="0" bottom="${h}"/><hp:inMargin left="0" right="0" top="0" bottom="0"/><hp:imgDim dimwidth="${w}" dimheight="${h}"/><hc:img binaryItemIDRef="${itemId}" bright="0" contrast="0" effect="REAL_PIC" alpha="0"/><hp:effects/><hp:sz width="${w}" widthRelTo="ABSOLUTE" height="${h}" heightRelTo="ABSOLUTE" protect="0"/><hp:pos treatAsChar="0" affectLSpacing="0" flowWithText="0" allowOverlap="1" holdAnchorAndSO="0" vertRelTo="PARA" horzRelTo="COLUMN" vertAlign="TOP" horzAlign="LEFT" vertOffset="${posYHu}" horzOffset="${posXHu}"/><hp:outMargin left="0" right="0" top="0" bottom="0"/><hp:shapeComment>kordoc seal</hp:shapeComment></hp:pic>`;
|
|
25755
25835
|
}
|
|
25756
25836
|
async function placeSealHwpx(hwpxBuffer, ops) {
|
|
25757
|
-
if (ops.length === 0) throw new (0,
|
|
25837
|
+
if (ops.length === 0) throw new (0, _chunkF2HYH62Hcjs.KordocError)("place_seal: \uBC30\uCE58\uD560 \uB3C4\uC7A5\uC774 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
25758
25838
|
const u8 = new Uint8Array(hwpxBuffer);
|
|
25759
25839
|
const zip = await _jszip2.default.loadAsync(hwpxBuffer);
|
|
25760
|
-
const sectionPaths = Object.keys(zip.files).filter((name) => /[Ss]ection\d+\.xml$/i.test(name)).sort((a, b) => Number(_nullishCoalesce(_optionalChain([a, 'access',
|
|
25761
|
-
if (sectionPaths.length === 0) throw new (0,
|
|
25840
|
+
const sectionPaths = Object.keys(zip.files).filter((name) => /[Ss]ection\d+\.xml$/i.test(name)).sort((a, b) => Number(_nullishCoalesce(_optionalChain([a, 'access', _386 => _386.match, 'call', _387 => _387(/(\d+)\.xml$/i), 'optionalAccess', _388 => _388[1]]), () => ( 0))) - Number(_nullishCoalesce(_optionalChain([b, 'access', _389 => _389.match, 'call', _390 => _390(/(\d+)\.xml$/i), 'optionalAccess', _391 => _391[1]]), () => ( 0))));
|
|
25841
|
+
if (sectionPaths.length === 0) throw new (0, _chunkF2HYH62Hcjs.KordocError)("HWPX\uC5D0\uC11C \uC139\uC158 \uD30C\uC77C\uC744 \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
25762
25842
|
const manifestPath = Object.keys(zip.files).find((name) => /\.hpf$/i.test(name));
|
|
25763
25843
|
const headerPath = Object.keys(zip.files).find((name) => /(^|\/)header\.xml$/i.test(name));
|
|
25764
25844
|
const styles = headerPath ? parseRenderStyles(await zip.file(headerPath).async("text")) : null;
|
|
@@ -25799,11 +25879,11 @@ async function placeSealHwpx(hwpxBuffer, ops) {
|
|
|
25799
25879
|
const manifestItems = [];
|
|
25800
25880
|
const placed = [];
|
|
25801
25881
|
for (const op of ops) {
|
|
25802
|
-
if (!op.anchor) throw new (0,
|
|
25803
|
-
if (!op.image || op.image.length === 0) throw new (0,
|
|
25882
|
+
if (!op.anchor) throw new (0, _chunkF2HYH62Hcjs.KordocError)("place_seal: anchor \uBB38\uAD6C\uAC00 \uD544\uC694\uD569\uB2C8\uB2E4");
|
|
25883
|
+
if (!op.image || op.image.length === 0) throw new (0, _chunkF2HYH62Hcjs.KordocError)("place_seal: \uB3C4\uC7A5 \uC774\uBBF8\uC9C0\uAC00 \uD544\uC694\uD569\uB2C8\uB2E4");
|
|
25804
25884
|
const ext = (_nullishCoalesce(op.ext, () => ( "png"))).toLowerCase();
|
|
25805
|
-
if (!MIME[ext]) throw new (0,
|
|
25806
|
-
if (!imageMagicMatches(op.image, ext)) throw new (0,
|
|
25885
|
+
if (!MIME[ext]) throw new (0, _chunkF2HYH62Hcjs.KordocError)(`place_seal: \uC9C0\uC6D0\uD558\uC9C0 \uC54A\uB294 \uC774\uBBF8\uC9C0 \uD655\uC7A5\uC790 .${ext} (png/jpg/bmp/gif)`);
|
|
25886
|
+
if (!imageMagicMatches(op.image, ext)) throw new (0, _chunkF2HYH62Hcjs.KordocError)(`place_seal: \uC774\uBBF8\uC9C0 \uB0B4\uC6A9\uC774 .${ext} \uD615\uC2DD\uC774 \uC544\uB2D9\uB2C8\uB2E4 (\uB9E4\uC9C1\uBC14\uC774\uD2B8 \uBD88\uC77C\uCE58)`);
|
|
25807
25887
|
const wantOcc = _nullishCoalesce(op.occurrence, () => ( 0));
|
|
25808
25888
|
let found = null;
|
|
25809
25889
|
let total = 0;
|
|
@@ -25836,7 +25916,7 @@ async function placeSealHwpx(hwpxBuffer, ops) {
|
|
|
25836
25916
|
}
|
|
25837
25917
|
}
|
|
25838
25918
|
}
|
|
25839
|
-
throw new (0,
|
|
25919
|
+
throw new (0, _chunkF2HYH62Hcjs.KordocError)(
|
|
25840
25920
|
`place_seal: \uC575\uCEE4 "${op.anchor}" ${wantOcc}\uBC88\uC9F8 \uB4F1\uC7A5\uC744 \uCC3E\uC9C0 \uBABB\uD588\uC2B5\uB2C8\uB2E4 (\uBCF8\uBB38 \uB0B4 ${total}\uD68C \uB4F1\uC7A5 \u2014 occurrence 0..${Math.max(0, total - 1)})`
|
|
25841
25921
|
);
|
|
25842
25922
|
}
|
|
@@ -25844,9 +25924,9 @@ async function placeSealHwpx(hwpxBuffer, ops) {
|
|
|
25844
25924
|
const xml = sectionXmls[si];
|
|
25845
25925
|
const run = anchorRunInfo(xml, site.para, op.anchor);
|
|
25846
25926
|
if (!run) {
|
|
25847
|
-
throw new (0,
|
|
25927
|
+
throw new (0, _chunkF2HYH62Hcjs.KordocError)(`place_seal: \uC575\uCEE4 "${op.anchor}" \uBB38\uB2E8\uC5D0\uC11C run\uC744 \uCC3E\uC9C0 \uBABB\uD588\uC2B5\uB2C8\uB2E4`);
|
|
25848
25928
|
}
|
|
25849
|
-
const charPrHeight = _nullishCoalesce(_optionalChain([styles, 'optionalAccess',
|
|
25929
|
+
const charPrHeight = _nullishCoalesce(_optionalChain([styles, 'optionalAccess', _392 => _392.charPr, 'access', _393 => _393.get, 'call', _394 => _394(run.charPr), 'optionalAccess', _395 => _395.height]), () => ( 1e3));
|
|
25850
25930
|
const fontPt = charPrHeight / 100;
|
|
25851
25931
|
const emMm = fontPt * 25.4 / 72;
|
|
25852
25932
|
const lineHMm = emMm;
|
|
@@ -25855,7 +25935,7 @@ async function placeSealHwpx(hwpxBuffer, ops) {
|
|
|
25855
25935
|
const sizeMm = op.sizeMm != null && Number.isFinite(op.sizeMm) && op.sizeMm > 0 ? op.sizeMm : Math.max(7, Math.min(18, lineHMm * 1.6));
|
|
25856
25936
|
const availMm = _nullishCoalesce((site.cell ? cellContentWidthMm(xml, site.cell) : null), () => ( bodyColumnWidthMm(xml)));
|
|
25857
25937
|
const paraPrId = _nullishCoalesce(attrOf(paraOpenTag(xml, site.para), "paraPrIDRef"), () => ( "0"));
|
|
25858
|
-
const align = _optionalChain([styles, 'optionalAccess',
|
|
25938
|
+
const align = _optionalChain([styles, 'optionalAccess', _396 => _396.paraAlign, 'access', _397 => _397.get, 'call', _398 => _398(paraPrId)]);
|
|
25859
25939
|
let alignShiftMm = 0;
|
|
25860
25940
|
if (align === "CENTER" || align === "RIGHT") {
|
|
25861
25941
|
const paraWMm = measureMm(site.para.text, emMm);
|
|
@@ -25951,7 +26031,7 @@ function parseBorderFills(headerDoc) {
|
|
|
25951
26031
|
};
|
|
25952
26032
|
const fillBrush = findChildByLocalName(bf, "fillBrush");
|
|
25953
26033
|
const winBrush = fillBrush ? findChildByLocalName(fillBrush, "winBrush") : null;
|
|
25954
|
-
const face = _optionalChain([winBrush, 'optionalAccess',
|
|
26034
|
+
const face = _optionalChain([winBrush, 'optionalAccess', _399 => _399.getAttribute, 'call', _400 => _400("faceColor")]);
|
|
25955
26035
|
if (face && face !== "none") def.fill = { faceColor: face };
|
|
25956
26036
|
map.set(id, def);
|
|
25957
26037
|
}
|
|
@@ -25983,7 +26063,7 @@ function parseCharPrs(headerDoc, hangulFonts) {
|
|
|
25983
26063
|
if (cp.getAttribute("italic") === "1") def.italic = true;
|
|
25984
26064
|
if (findChildByLocalName(cp, "underline")) def.underline = true;
|
|
25985
26065
|
const fontRef = findChildByLocalName(cp, "fontRef");
|
|
25986
|
-
const hangul = _optionalChain([fontRef, 'optionalAccess',
|
|
26066
|
+
const hangul = _optionalChain([fontRef, 'optionalAccess', _401 => _401.getAttribute, 'call', _402 => _402("hangul")]);
|
|
25987
26067
|
if (hangul) {
|
|
25988
26068
|
def.fontRef_hangul = hangul;
|
|
25989
26069
|
const face = hangulFonts.get(hangul);
|
|
@@ -26011,7 +26091,7 @@ function parseTable3(tbl2, tableIndex, borderFills, charPrs) {
|
|
|
26011
26091
|
const rows = _nullishCoalesce(num(tbl2.getAttribute("rowCnt")), () => ( 0));
|
|
26012
26092
|
const cols = _nullishCoalesce(num(tbl2.getAttribute("colCnt")), () => ( 0));
|
|
26013
26093
|
const sz = findChildByLocalName(tbl2, "sz");
|
|
26014
|
-
const width = _optionalChain([sz, 'optionalAccess',
|
|
26094
|
+
const width = _optionalChain([sz, 'optionalAccess', _403 => _403.getAttribute, 'call', _404 => _404("width")]) || void 0;
|
|
26015
26095
|
const cells = [];
|
|
26016
26096
|
const usedBf = /* @__PURE__ */ new Set();
|
|
26017
26097
|
const usedCp = /* @__PURE__ */ new Set();
|
|
@@ -26024,17 +26104,17 @@ function parseTable3(tbl2, tableIndex, borderFills, charPrs) {
|
|
|
26024
26104
|
const addr = findChildByLocalName(tc2, "cellAddr");
|
|
26025
26105
|
const span = findChildByLocalName(tc2, "cellSpan");
|
|
26026
26106
|
const csz = findChildByLocalName(tc2, "cellSz");
|
|
26027
|
-
const row = _nullishCoalesce(num(_optionalChain([addr, 'optionalAccess',
|
|
26028
|
-
const col = _nullishCoalesce(num(_optionalChain([addr, 'optionalAccess',
|
|
26107
|
+
const row = _nullishCoalesce(num(_optionalChain([addr, 'optionalAccess', _405 => _405.getAttribute, 'call', _406 => _406("rowAddr")])), () => ( 0));
|
|
26108
|
+
const col = _nullishCoalesce(num(_optionalChain([addr, 'optionalAccess', _407 => _407.getAttribute, 'call', _408 => _408("colAddr")])), () => ( 0));
|
|
26029
26109
|
if (row === 0 && col === 0 && !anchorText) anchorText = directCellText(tc2);
|
|
26030
26110
|
if (row === 0) row0Texts.set(col, directCellText(tc2));
|
|
26031
|
-
const colSpan = _nullishCoalesce(num(_optionalChain([span, 'optionalAccess',
|
|
26032
|
-
const rowSpan = _nullishCoalesce(num(_optionalChain([span, 'optionalAccess',
|
|
26111
|
+
const colSpan = _nullishCoalesce(num(_optionalChain([span, 'optionalAccess', _409 => _409.getAttribute, 'call', _410 => _410("colSpan")])), () => ( 1));
|
|
26112
|
+
const rowSpan = _nullishCoalesce(num(_optionalChain([span, 'optionalAccess', _411 => _411.getAttribute, 'call', _412 => _412("rowSpan")])), () => ( 1));
|
|
26033
26113
|
const bfId = tc2.getAttribute("borderFillIDRef") || void 0;
|
|
26034
26114
|
const cpId = firstRunCharPr(tc2);
|
|
26035
26115
|
const cell2 = { row, col, rowSpan, colSpan };
|
|
26036
|
-
const w = _optionalChain([csz, 'optionalAccess',
|
|
26037
|
-
const hh = _optionalChain([csz, 'optionalAccess',
|
|
26116
|
+
const w = _optionalChain([csz, 'optionalAccess', _413 => _413.getAttribute, 'call', _414 => _414("width")]);
|
|
26117
|
+
const hh = _optionalChain([csz, 'optionalAccess', _415 => _415.getAttribute, 'call', _416 => _416("height")]);
|
|
26038
26118
|
if (w) cell2.width_hwpunit = w;
|
|
26039
26119
|
if (hh) cell2.height_hwpunit = hh;
|
|
26040
26120
|
if (bfId) {
|
|
@@ -26122,16 +26202,16 @@ function pick(map, keys) {
|
|
|
26122
26202
|
return out;
|
|
26123
26203
|
}
|
|
26124
26204
|
async function hwpxToProfile(input) {
|
|
26125
|
-
const buf = input instanceof ArrayBuffer ? input :
|
|
26205
|
+
const buf = input instanceof ArrayBuffer ? input : _chunkF2HYH62Hcjs.toArrayBuffer.call(void 0, input);
|
|
26126
26206
|
const zip = await _jszip2.default.loadAsync(buf);
|
|
26127
26207
|
const parser = createXmlParser();
|
|
26128
|
-
const headerFile = _nullishCoalesce(zip.file("Contents/header.xml"), () => ( _optionalChain([zip, 'access',
|
|
26208
|
+
const headerFile = _nullishCoalesce(zip.file("Contents/header.xml"), () => ( _optionalChain([zip, 'access', _417 => _417.file, 'call', _418 => _418(/[Hh]eader\.xml$/), 'optionalAccess', _419 => _419[0]])));
|
|
26129
26209
|
let headerXml = "<root/>";
|
|
26130
26210
|
if (headerFile) headerXml = await headerFile.async("text");
|
|
26131
26211
|
const headerDoc = parser.parseFromString(headerXml, "text/xml");
|
|
26132
26212
|
const borderFills = parseBorderFills(headerDoc);
|
|
26133
26213
|
const charPrs = parseCharPrs(headerDoc, parseHangulFonts(headerDoc));
|
|
26134
|
-
const sectionFiles = zip.file(/[Ss]ection\d+\.xml$/).sort((a, b) => (_nullishCoalesce(num(_nullishCoalesce(_optionalChain([a, 'access',
|
|
26214
|
+
const sectionFiles = zip.file(/[Ss]ection\d+\.xml$/).sort((a, b) => (_nullishCoalesce(num(_nullishCoalesce(_optionalChain([a, 'access', _420 => _420.name, 'access', _421 => _421.match, 'call', _422 => _422(/(\d+)\.xml$/), 'optionalAccess', _423 => _423[1]]), () => ( null))), () => ( 0))) - (_nullishCoalesce(num(_nullishCoalesce(_optionalChain([b, 'access', _424 => _424.name, 'access', _425 => _425.match, 'call', _426 => _426(/(\d+)\.xml$/), 'optionalAccess', _427 => _427[1]]), () => ( null))), () => ( 0))));
|
|
26135
26215
|
const tables = [];
|
|
26136
26216
|
let tableIndex = 0;
|
|
26137
26217
|
for (const f of sectionFiles) {
|
|
@@ -26445,7 +26525,7 @@ var ROW_OBJECT_RE = /<(?:[A-Za-z0-9_]+:)?(?:tbl|pic|equation|ole|container|shape
|
|
|
26445
26525
|
var TAG_AT_RE = /<[A-Za-z0-9_:]+(?:"[^"]*"|'[^']*'|[^>"'])*>/y;
|
|
26446
26526
|
function patchTableRows(input) {
|
|
26447
26527
|
const { table: table2, scanTable, ctx, skip, origKeys, editedKeys } = input;
|
|
26448
|
-
const xml = _optionalChain([ctx, 'access',
|
|
26528
|
+
const xml = _optionalChain([ctx, 'access', _428 => _428.scans, 'access', _429 => _429[scanTable.sectionIndex], 'optionalAccess', _430 => _430.xml]);
|
|
26449
26529
|
if (!xml) return skip("\uC139\uC158 XML \uB9E4\uD551 \uC2E4\uD328");
|
|
26450
26530
|
const numRows = table2.rows;
|
|
26451
26531
|
if (origKeys.length !== numRows) return skip("\uD45C \uD589 \uC88C\uD45C \uBD88\uC77C\uCE58 \u2014 \uD589 \uCD94\uAC00/\uC0AD\uC81C \uBBF8\uC9C0\uC6D0");
|
|
@@ -26612,7 +26692,7 @@ function buildRowFragment(xml, scanTable, template, cells, finalRow, hasExplicit
|
|
|
26612
26692
|
const rr = scanTable.rowRanges[template];
|
|
26613
26693
|
const wrapped = FRAG_OPEN + xml.slice(rr.start, rr.end) + FRAG_CLOSE;
|
|
26614
26694
|
const scan = scanSectionXml(wrapped, 0);
|
|
26615
|
-
const row = _optionalChain([scan, 'access',
|
|
26695
|
+
const row = _optionalChain([scan, 'access', _431 => _431.tables, 'access', _432 => _432[0], 'optionalAccess', _433 => _433.rows, 'access', _434 => _434[0]]);
|
|
26616
26696
|
if (!row || row.length !== cells.length) return null;
|
|
26617
26697
|
const splices = allLinesegRemovalSplices(wrapped);
|
|
26618
26698
|
for (let i = 0; i < cells.length; i++) {
|
|
@@ -26655,7 +26735,7 @@ function rowHeightOf(fragment) {
|
|
|
26655
26735
|
}
|
|
26656
26736
|
function tableSzHeightSplice(xml, scanTable, tblOpenLen, delta) {
|
|
26657
26737
|
const from = scanTable.start + tblOpenLen;
|
|
26658
|
-
const to = _nullishCoalesce(_optionalChain([scanTable, 'access',
|
|
26738
|
+
const to = _nullishCoalesce(_optionalChain([scanTable, 'access', _435 => _435.rowRanges, 'access', _436 => _436[0], 'optionalAccess', _437 => _437.start]), () => ( from));
|
|
26659
26739
|
const slice = xml.slice(from, to);
|
|
26660
26740
|
const szM = slice.match(/<(?:[A-Za-z0-9_]+:)?sz\b(?:"[^"]*"|'[^']*'|[^>"'])*>/);
|
|
26661
26741
|
if (!szM || szM.index === void 0) return null;
|
|
@@ -26844,9 +26924,9 @@ function patchHtmlTableRows(table2, scanTable, replica, editedRows, ctx, skip, d
|
|
|
26844
26924
|
});
|
|
26845
26925
|
}
|
|
26846
26926
|
function patchNestedTables(table2, scanTable, oc, origTables, editedTables, ctx, skip, depth) {
|
|
26847
|
-
const irCell = _optionalChain([table2, 'access',
|
|
26927
|
+
const irCell = _optionalChain([table2, 'access', _438 => _438.cells, 'access', _439 => _439[oc.gridR], 'optionalAccess', _440 => _440[oc.gridC]]);
|
|
26848
26928
|
const scanCell = scanTable.cellByAnchor.get(`${oc.gridR},${oc.gridC}`);
|
|
26849
|
-
const nestedIRs = (_nullishCoalesce(_optionalChain([irCell, 'optionalAccess',
|
|
26929
|
+
const nestedIRs = (_nullishCoalesce(_optionalChain([irCell, 'optionalAccess', _441 => _441.blocks]), () => ( []))).filter((b) => b.type === "table" && b.table).map((b) => b.table);
|
|
26850
26930
|
if (!scanCell || nestedIRs.length !== origTables.length || scanCell.tables.length !== origTables.length) {
|
|
26851
26931
|
return skip("\uC911\uCCA9\uD45C \uC18C\uC2A4\uB9F5 \uB9E4\uD551 \uC2E4\uD328");
|
|
26852
26932
|
}
|
|
@@ -26914,7 +26994,7 @@ function applyCellEdit(table2, scanTable, gridR, gridC, newLines, ctx, before, a
|
|
|
26914
26994
|
};
|
|
26915
26995
|
const cell2 = scanTable.cellByAnchor.get(`${gridR},${gridC}`);
|
|
26916
26996
|
if (!cell2) return skip("\uC140 \uC88C\uD45C \uB9E4\uD551 \uC2E4\uD328 (\uBCD1\uD569 \uC601\uC5ED\uC758 \uBE48 \uCE78\uC774\uAC70\uB098 \uC88C\uD45C \uBD88\uC77C\uCE58)");
|
|
26917
|
-
const irCell = _optionalChain([table2, 'access',
|
|
26997
|
+
const irCell = _optionalChain([table2, 'access', _442 => _442.cells, 'access', _443 => _443[gridR], 'optionalAccess', _444 => _444[gridC]]);
|
|
26918
26998
|
const scanJoined = cell2.paragraphs.map((p) => p.text).filter((t) => normForMatch(t)).join("\n");
|
|
26919
26999
|
if (irCell && normForMatch(scanJoined) !== normForMatch(stripCellTokens(irCell.text))) {
|
|
26920
27000
|
if (normForMatch(irCell.text) !== "" || normForMatch(scanJoined) !== "") {
|
|
@@ -26937,7 +27017,7 @@ function applyCellEdit(table2, scanTable, gridR, gridC, newLines, ctx, before, a
|
|
|
26937
27017
|
if (newLines.length === 0) return 0;
|
|
26938
27018
|
const target = cell2.paragraphs[0];
|
|
26939
27019
|
if (!target) return skip("\uBE48 \uC140\uC5D0 \uBB38\uB2E8\uC774 \uC5C6\uC5B4 \uD14D\uC2A4\uD2B8 \uC0BD\uC785 \uBD88\uAC00");
|
|
26940
|
-
const sp = buildParagraphSplices(target, newLines.join(" "), _optionalChain([ctx, 'access',
|
|
27020
|
+
const sp = buildParagraphSplices(target, newLines.join(" "), _optionalChain([ctx, 'access', _445 => _445.scans, 'access', _446 => _446[target.sectionIndex], 'optionalAccess', _447 => _447.xml]));
|
|
26941
27021
|
if (sp === null) return skip("\uC140 \uBB38\uB2E8\uC5D0 \uD14D\uC2A4\uD2B8 \uB178\uB4DC\uB97C \uB9CC\uB4E4 \uC218 \uC5C6\uC74C");
|
|
26942
27022
|
splices.push(...sp);
|
|
26943
27023
|
sectionIndex = target.sectionIndex;
|
|
@@ -26960,7 +27040,7 @@ function applyCellEdit(table2, scanTable, gridR, gridC, newLines, ctx, before, a
|
|
|
26960
27040
|
}
|
|
26961
27041
|
for (let i = 0; i < nonEmpty.length; i++) {
|
|
26962
27042
|
if (assigned[i] === nonEmpty[i].text || normForMatch(assigned[i]) === normForMatch(nonEmpty[i].text)) continue;
|
|
26963
|
-
const sp = buildParagraphSplices(nonEmpty[i], assigned[i], _optionalChain([ctx, 'access',
|
|
27043
|
+
const sp = buildParagraphSplices(nonEmpty[i], assigned[i], _optionalChain([ctx, 'access', _448 => _448.scans, 'access', _449 => _449[nonEmpty[i].sectionIndex], 'optionalAccess', _450 => _450.xml]));
|
|
26964
27044
|
if (sp === null) return skip("\uC140 \uBB38\uB2E8\uC5D0 \uD14D\uC2A4\uD2B8 \uB178\uB4DC\uB97C \uB9CC\uB4E4 \uC218 \uC5C6\uC74C");
|
|
26965
27045
|
splices.push(...sp);
|
|
26966
27046
|
sectionIndex = nonEmpty[i].sectionIndex;
|
|
@@ -27041,7 +27121,7 @@ async function resolveSectionEntryNames(zip) {
|
|
|
27041
27121
|
const paths = sectionPathsFromManifest(xml).filter((p) => zip.file(p) !== null);
|
|
27042
27122
|
if (paths.length > 0) return paths;
|
|
27043
27123
|
}
|
|
27044
|
-
return Object.keys(zip.files).filter((n) => /[Ss]ection\d+\.xml$/.test(n)).sort(
|
|
27124
|
+
return Object.keys(zip.files).filter((n) => /[Ss]ection\d+\.xml$/.test(n)).sort(_chunkF2HYH62Hcjs.compareSectionPaths);
|
|
27045
27125
|
}
|
|
27046
27126
|
function sectionPathsFromManifest(xml) {
|
|
27047
27127
|
const attr = (tag, name) => {
|
|
@@ -27051,7 +27131,7 @@ function sectionPathsFromManifest(xml) {
|
|
|
27051
27131
|
const idToHref = /* @__PURE__ */ new Map();
|
|
27052
27132
|
for (const m of xml.matchAll(/<opf:item(\s(?:"[^"]*"|'[^']*'|[^>"'])*?)\/?>/g)) {
|
|
27053
27133
|
const id = attr(m[1], "id");
|
|
27054
|
-
const href =
|
|
27134
|
+
const href = _chunkF2HYH62Hcjs.normalizeSectionHref.call(void 0, attr(m[1], "href"));
|
|
27055
27135
|
if (id && href) idToHref.set(id, href);
|
|
27056
27136
|
}
|
|
27057
27137
|
const ordered = [];
|
|
@@ -27060,7 +27140,7 @@ function sectionPathsFromManifest(xml) {
|
|
|
27060
27140
|
if (href) ordered.push(href);
|
|
27061
27141
|
}
|
|
27062
27142
|
if (ordered.length > 0) return ordered;
|
|
27063
|
-
return Array.from(idToHref.values()).sort(
|
|
27143
|
+
return Array.from(idToHref.values()).sort(_chunkF2HYH62Hcjs.compareSectionPaths);
|
|
27064
27144
|
}
|
|
27065
27145
|
|
|
27066
27146
|
// src/roundtrip/patcher.ts
|
|
@@ -27152,7 +27232,7 @@ async function patchHwpx(original, editedMarkdown, options) {
|
|
|
27152
27232
|
}
|
|
27153
27233
|
}
|
|
27154
27234
|
let verification;
|
|
27155
|
-
if (_optionalChain([options, 'optionalAccess',
|
|
27235
|
+
if (_optionalChain([options, 'optionalAccess', _451 => _451.verify]) !== false) {
|
|
27156
27236
|
try {
|
|
27157
27237
|
const reparsed = await parseHwpxDocument(u8ToArrayBuffer(data));
|
|
27158
27238
|
verification = diffUnitLists(splitMarkdownUnits(reparsed.markdown), editedUnits);
|
|
@@ -27170,17 +27250,17 @@ function buildOrigUnits(blocks) {
|
|
|
27170
27250
|
let chunk;
|
|
27171
27251
|
if (block.type === "paragraph" && block.text && /^\[별표\s*\d+/.test(sanitizeText(block.text))) {
|
|
27172
27252
|
const next = blocks[i + 1];
|
|
27173
|
-
if (_optionalChain([next, 'optionalAccess',
|
|
27174
|
-
chunk =
|
|
27253
|
+
if (_optionalChain([next, 'optionalAccess', _452 => _452.type]) === "paragraph" && next.text && /관련\)?$/.test(next.text)) consume = 2;
|
|
27254
|
+
chunk = _chunkXTCT6KQ5cjs.blocksToMarkdown.call(void 0, blocks.slice(i, i + consume));
|
|
27175
27255
|
} else {
|
|
27176
|
-
chunk =
|
|
27256
|
+
chunk = _chunkXTCT6KQ5cjs.blocksToMarkdown.call(void 0, [block]);
|
|
27177
27257
|
}
|
|
27178
27258
|
if (chunk) {
|
|
27179
27259
|
const subUnits = splitMarkdownUnits(chunk);
|
|
27180
27260
|
const isFragment = consume === 2 || (block.type === "paragraph" || block.type === "heading") && subUnits.length > 1;
|
|
27181
27261
|
for (let s = 0; s < subUnits.length; s++) {
|
|
27182
27262
|
const u = { ...subUnits[s], blockIdx: i, fragment: isFragment || void 0 };
|
|
27183
|
-
if (block.type === "table" && _optionalChain([block, 'access',
|
|
27263
|
+
if (block.type === "table" && _optionalChain([block, 'access', _453 => _453.table, 'optionalAccess', _454 => _454.caption]) && s === 0 && subUnits.length > 1 && u.kind === "text" && u.raw.startsWith("**")) {
|
|
27184
27264
|
u.role = "caption";
|
|
27185
27265
|
}
|
|
27186
27266
|
units.push(u);
|
|
@@ -27291,7 +27371,7 @@ function convertParagraphToTable(block, orig, edited, ctx, skip) {
|
|
|
27291
27371
|
const ti = ctx.tableInsert;
|
|
27292
27372
|
if (!ti) return skip("\uBB38\uB2E8\u2192\uD45C \uBCC0\uD658 \uBD88\uAC00 \u2014 header \uC5D4\uD2B8\uB9AC(borderFills) \uD574\uC11D \uC2E4\uD328");
|
|
27293
27373
|
const mapping = ctx.paraMap.get(orig.blockIdx);
|
|
27294
|
-
if (!_optionalChain([mapping, 'optionalAccess',
|
|
27374
|
+
if (!_optionalChain([mapping, 'optionalAccess', _455 => _455.para])) return skip("\uBB38\uB2E8 \uC18C\uC2A4\uB9F5 \uB9E4\uD551 \uC2E4\uD328 (\uBA38\uB9AC\uB9D0/\uAE00\uC0C1\uC790/\uCEA1\uC158 \uC601\uC5ED) \u2014 \uD45C \uBCC0\uD658 \uBD88\uAC00");
|
|
27295
27375
|
const para2 = mapping.para;
|
|
27296
27376
|
if (para2.kind !== "body") return skip("\uBCF8\uBB38 \uC678 \uC601\uC5ED(\uD45C \uC140/\uAE00\uC0C1\uC790) \uBB38\uB2E8\uC758 \uD45C \uBCC0\uD658\uC740 \uBBF8\uC9C0\uC6D0");
|
|
27297
27377
|
const scan = ctx.scans[para2.sectionIndex];
|
|
@@ -27319,7 +27399,7 @@ function convertParagraphToTable(block, orig, edited, ctx, skip) {
|
|
|
27319
27399
|
}
|
|
27320
27400
|
function patchParagraphUnit(block, orig, edited, ctx, skip) {
|
|
27321
27401
|
const mapping = ctx.paraMap.get(orig.blockIdx);
|
|
27322
|
-
if (!_optionalChain([mapping, 'optionalAccess',
|
|
27402
|
+
if (!_optionalChain([mapping, 'optionalAccess', _456 => _456.para])) return skip("\uBB38\uB2E8 \uC18C\uC2A4\uB9F5 \uB9E4\uD551 \uC2E4\uD328 (\uBA38\uB9AC\uB9D0/\uAE00\uC0C1\uC790/\uCEA1\uC158 \uC601\uC5ED\uC774\uAC70\uB098 \uD14D\uC2A4\uD2B8 \uBD88\uC77C\uCE58)");
|
|
27323
27403
|
if (block.text && block.text.includes("\n")) {
|
|
27324
27404
|
return skip("\uBB38\uB2E8 \uB0B4 \uAC15\uC81C \uC904\uBC14\uAFC8 \uD3EC\uD568 \u2014 \uC218\uC815 \uC2DC \uC904\uBC14\uAFC8 \uBCF4\uC874 \uBD88\uAC00\uB85C \uBBF8\uC9C0\uC6D0 (v1)");
|
|
27325
27405
|
}
|
|
@@ -27350,7 +27430,7 @@ function patchParagraphUnit(block, orig, edited, ctx, skip) {
|
|
|
27350
27430
|
if (sanitizeText(newPlain) !== newPlain) {
|
|
27351
27431
|
return skip("\uACF5\uBC31 \uC815\uADDC\uD654 \uBD88\uC548\uC815 \uD14D\uC2A4\uD2B8 \u2014 \uD328\uCE58 \uC2DC \uC6D0\uBB38 \uBCF4\uC874 \uBD88\uAC00\uB85C \uBBF8\uC9C0\uC6D0");
|
|
27352
27432
|
}
|
|
27353
|
-
const splices = buildParagraphSplices(mapping.para, newPlain, _optionalChain([ctx, 'access',
|
|
27433
|
+
const splices = buildParagraphSplices(mapping.para, newPlain, _optionalChain([ctx, 'access', _457 => _457.scans, 'access', _458 => _458[mapping.para.sectionIndex], 'optionalAccess', _459 => _459.xml]));
|
|
27354
27434
|
if (splices === null) return skip("\uBB38\uB2E8\uC5D0 \uD14D\uC2A4\uD2B8 \uB178\uB4DC\uB97C \uB9CC\uB4E4 \uC218 \uC5C6\uC74C");
|
|
27355
27435
|
ctx.sectionSplices[mapping.para.sectionIndex].push(...splices);
|
|
27356
27436
|
return 1;
|
|
@@ -27539,7 +27619,7 @@ var Surgeon = (_class7 = class {
|
|
|
27539
27619
|
/** 디렉토리 트리에서 경로 해석 (형제 = L/R 이진 트리, 자식 = child) */
|
|
27540
27620
|
findEntry(path) {
|
|
27541
27621
|
const parts = path.replace(/^\//, "").split("/");
|
|
27542
|
-
let scope = _nullishCoalesce(_optionalChain([this, 'access',
|
|
27622
|
+
let scope = _nullishCoalesce(_optionalChain([this, 'access', _460 => _460.entries, 'access', _461 => _461[0], 'optionalAccess', _462 => _462.child]), () => ( -1));
|
|
27543
27623
|
let current;
|
|
27544
27624
|
for (const part of parts) {
|
|
27545
27625
|
const search = (idx) => {
|
|
@@ -27778,8 +27858,8 @@ function serializeRecords(recs, repl, inserts) {
|
|
|
27778
27858
|
parts.push(header, data);
|
|
27779
27859
|
};
|
|
27780
27860
|
for (let i = 0; i < recs.length; i++) {
|
|
27781
|
-
for (const ins of _nullishCoalesce(_optionalChain([inserts, 'optionalAccess',
|
|
27782
|
-
push(recs[i].tagId, recs[i].level, _nullishCoalesce(_optionalChain([repl, 'optionalAccess',
|
|
27861
|
+
for (const ins of _nullishCoalesce(_optionalChain([inserts, 'optionalAccess', _463 => _463.get, 'call', _464 => _464(i)]), () => ( []))) push(ins.tagId, ins.level, ins.data);
|
|
27862
|
+
push(recs[i].tagId, recs[i].level, _nullishCoalesce(_optionalChain([repl, 'optionalAccess', _465 => _465.get, 'call', _466 => _466(i)]), () => ( recs[i].data)));
|
|
27783
27863
|
}
|
|
27784
27864
|
return Buffer.concat(parts);
|
|
27785
27865
|
}
|
|
@@ -27897,7 +27977,7 @@ async function patchHwp(original, editedMarkdown, options) {
|
|
|
27897
27977
|
return fail(`CFB \uCEE8\uD14C\uC774\uB108 \uD30C\uC2F1 \uC2E4\uD328: ${msg(err)}`);
|
|
27898
27978
|
}
|
|
27899
27979
|
const fhEntry = CFB2.find(cfb, "/FileHeader");
|
|
27900
|
-
if (!_optionalChain([fhEntry, 'optionalAccess',
|
|
27980
|
+
if (!_optionalChain([fhEntry, 'optionalAccess', _467 => _467.content])) return fail("FileHeader \uC2A4\uD2B8\uB9BC\uC774 \uC5C6\uC2B5\uB2C8\uB2E4 \u2014 HWP 5.x \uD30C\uC77C\uC774 \uC544\uB2D9\uB2C8\uB2E4");
|
|
27901
27981
|
let flags;
|
|
27902
27982
|
try {
|
|
27903
27983
|
flags = parseFileHeader(Buffer.from(fhEntry.content)).flags;
|
|
@@ -27919,7 +27999,7 @@ async function patchHwp(original, editedMarkdown, options) {
|
|
|
27919
27999
|
const scans = [];
|
|
27920
28000
|
for (let i = 0; i < sectionPaths.length; i++) {
|
|
27921
28001
|
const entry = CFB2.find(cfb, sectionPaths[i]);
|
|
27922
|
-
if (!_optionalChain([entry, 'optionalAccess',
|
|
28002
|
+
if (!_optionalChain([entry, 'optionalAccess', _468 => _468.content])) return fail(`\uC139\uC158 \uC2A4\uD2B8\uB9BC \uC77D\uAE30 \uC2E4\uD328: ${sectionPaths[i]}`);
|
|
27923
28003
|
let stream;
|
|
27924
28004
|
try {
|
|
27925
28005
|
stream = compressed ? decompressStream(Buffer.from(entry.content)) : Buffer.from(entry.content);
|
|
@@ -27970,7 +28050,7 @@ async function patchHwp(original, editedMarkdown, options) {
|
|
|
27970
28050
|
}
|
|
27971
28051
|
}
|
|
27972
28052
|
let verification;
|
|
27973
|
-
if (_optionalChain([options, 'optionalAccess',
|
|
28053
|
+
if (_optionalChain([options, 'optionalAccess', _469 => _469.verify]) !== false) {
|
|
27974
28054
|
try {
|
|
27975
28055
|
const reparsed = parseHwp5Document(Buffer.from(data));
|
|
27976
28056
|
const normBr = (u) => ({ ...u, raw: u.raw.replace(/<br\s*\/?\s*>/gi, "\n") });
|
|
@@ -28060,7 +28140,7 @@ function tableContentScore(irTable, scanTable) {
|
|
|
28060
28140
|
for (const [key, scanCell] of scanTable.cells) {
|
|
28061
28141
|
const comma = key.indexOf(",");
|
|
28062
28142
|
const r = Number(key.slice(0, comma)), c = Number(key.slice(comma + 1));
|
|
28063
|
-
const irCell = _optionalChain([irTable, 'access',
|
|
28143
|
+
const irCell = _optionalChain([irTable, 'access', _470 => _470.cells, 'access', _471 => _471[r], 'optionalAccess', _472 => _472[c]]);
|
|
28064
28144
|
if (!irCell) continue;
|
|
28065
28145
|
const a = normForMatch(scanCell.paras.map((p) => p.rawText).join(" "));
|
|
28066
28146
|
const b = normForMatch(stripCellTokens(irCell.text));
|
|
@@ -28096,7 +28176,7 @@ function handleModified(orig, edited, ctx) {
|
|
|
28096
28176
|
}
|
|
28097
28177
|
function patchParagraph(block, orig, edited, ctx, skip) {
|
|
28098
28178
|
const mapping = ctx.paraMap.get(orig.blockIdx);
|
|
28099
|
-
if (!_optionalChain([mapping, 'optionalAccess',
|
|
28179
|
+
if (!_optionalChain([mapping, 'optionalAccess', _473 => _473.para])) return skip("\uBB38\uB2E8 \uC18C\uC2A4\uB9F5 \uB9E4\uD551 \uC2E4\uD328 (\uBA38\uB9AC\uB9D0/\uAE00\uC0C1\uC790/\uCEA1\uC158 \uC601\uC5ED\uC774\uAC70\uB098 \uD14D\uC2A4\uD2B8 \uBD88\uC77C\uCE58)");
|
|
28100
28180
|
const restoreBr = (s) => s.replace(/(?:\s*<br\s*\/?\s*>\s*)+/gi, "\n");
|
|
28101
28181
|
let newPlain = restoreBr(textUnitToPlain(edited.raw, block));
|
|
28102
28182
|
if (block.text && block.text.includes("\n") && !newPlain.includes("\n")) {
|
|
@@ -28295,7 +28375,7 @@ function applyCellEdit5(table2, scanTable, gridR, gridC, newLines, ctx, before,
|
|
|
28295
28375
|
};
|
|
28296
28376
|
const cell2 = scanTable.cells.get(`${gridR},${gridC}`);
|
|
28297
28377
|
if (!cell2) return skip("\uC140 \uC88C\uD45C \uB9E4\uD551 \uC2E4\uD328 (\uBCD1\uD569 \uC601\uC5ED\uC758 \uBE48 \uCE78\uC774\uAC70\uB098 \uC88C\uD45C \uBD88\uC77C\uCE58)");
|
|
28298
|
-
const irCell = _optionalChain([table2, 'access',
|
|
28378
|
+
const irCell = _optionalChain([table2, 'access', _474 => _474.cells, 'access', _475 => _475[gridR], 'optionalAccess', _476 => _476[gridC]]);
|
|
28299
28379
|
const scanJoined = cell2.paras.map((p) => p.rawText).filter((t) => normForMatch(t)).join("\n");
|
|
28300
28380
|
if (irCell && normForMatch(scanJoined) !== normForMatch(stripCellTokens(irCell.text))) {
|
|
28301
28381
|
if (normForMatch(irCell.text) !== "" || normForMatch(scanJoined) !== "") {
|
|
@@ -28702,11 +28782,11 @@ var RULES2 = {
|
|
|
28702
28782
|
}
|
|
28703
28783
|
};
|
|
28704
28784
|
function redactText(text, options) {
|
|
28705
|
-
const maskChar = _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
28785
|
+
const maskChar = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _477 => _477.maskChar]), () => ( "\u25CF"));
|
|
28706
28786
|
if (maskChar.length !== 1 || /[0-9A-Za-z]/.test(maskChar)) {
|
|
28707
28787
|
throw new Error(`maskChar\uB294 \uC601\uC22B\uC790\uAC00 \uC544\uB2CC 1\uAE00\uC790\uC5EC\uC57C \uD568: ${JSON.stringify(maskChar)}`);
|
|
28708
28788
|
}
|
|
28709
|
-
const enabled = _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
28789
|
+
const enabled = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _478 => _478.rules]), () => ( DEFAULT_REDACT_RULES));
|
|
28710
28790
|
const hits = [];
|
|
28711
28791
|
if (text === "" || enabled.length === 0) return { text, hits };
|
|
28712
28792
|
const occupied = [];
|
|
@@ -28761,8 +28841,8 @@ function sameBreadcrumb(a, b) {
|
|
|
28761
28841
|
return a.length === b.length && a.every((v, i) => v === b[i]);
|
|
28762
28842
|
}
|
|
28763
28843
|
function blocksToChunks(blocks, options) {
|
|
28764
|
-
const granularity = _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
28765
|
-
const includeCells = _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
28844
|
+
const granularity = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _479 => _479.granularity]), () => ( "section"));
|
|
28845
|
+
const includeCells = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _480 => _480.includeTableCells]), () => ( false));
|
|
28766
28846
|
const chunks = [];
|
|
28767
28847
|
const headingStack = [];
|
|
28768
28848
|
const listStack = [];
|
|
@@ -28776,12 +28856,12 @@ function blocksToChunks(blocks, options) {
|
|
|
28776
28856
|
let run = null;
|
|
28777
28857
|
const flushRun = () => {
|
|
28778
28858
|
if (!run) return;
|
|
28779
|
-
push("text", run.breadcrumb,
|
|
28859
|
+
push("text", run.breadcrumb, _chunkXTCT6KQ5cjs.blocksToMarkdown.call(void 0, run.blocks), [run.start, run.end], run.page);
|
|
28780
28860
|
run = null;
|
|
28781
28861
|
};
|
|
28782
28862
|
for (let i = 0; i < blocks.length; i++) {
|
|
28783
28863
|
const block = blocks[i];
|
|
28784
|
-
const md2 =
|
|
28864
|
+
const md2 = _chunkXTCT6KQ5cjs.blocksToMarkdown.call(void 0, [block]);
|
|
28785
28865
|
if (!md2) continue;
|
|
28786
28866
|
if (block.type === "heading") {
|
|
28787
28867
|
flushRun();
|
|
@@ -28897,7 +28977,7 @@ var HwpxSession = (_class8 = class _HwpxSession {
|
|
|
28897
28977
|
const block = st.blocks[blockIndex];
|
|
28898
28978
|
if (!block) return void 0;
|
|
28899
28979
|
if (block.type === "paragraph" || block.type === "heading") {
|
|
28900
|
-
const para2 = _optionalChain([st, 'access',
|
|
28980
|
+
const para2 = _optionalChain([st, 'access', _481 => _481.paraMap, 'access', _482 => _482.get, 'call', _483 => _483(blockIndex), 'optionalAccess', _484 => _484.para]);
|
|
28901
28981
|
if (!para2) return void 0;
|
|
28902
28982
|
return { kind: "paragraph", sectionIndex: para2.sectionIndex, xmlStart: para2.start };
|
|
28903
28983
|
}
|
|
@@ -28922,7 +29002,7 @@ var HwpxSession = (_class8 = class _HwpxSession {
|
|
|
28922
29002
|
if (block.text && block.text.includes("\n")) {
|
|
28923
29003
|
return { capability: "locked", reason: "\uBB38\uB2E8 \uB0B4 \uAC15\uC81C \uC904\uBC14\uAFC8 \uD3EC\uD568 \u2014 \uC218\uC815 \uC2DC \uC904\uBC14\uAFC8 \uBCF4\uC874 \uBD88\uAC00\uB85C \uBBF8\uC9C0\uC6D0 (v1)" };
|
|
28924
29004
|
}
|
|
28925
|
-
if (!_optionalChain([st, 'access',
|
|
29005
|
+
if (!_optionalChain([st, 'access', _485 => _485.paraMap, 'access', _486 => _486.get, 'call', _487 => _487(blockIndex), 'optionalAccess', _488 => _488.para])) {
|
|
28926
29006
|
return { capability: "locked", reason: "\uBB38\uB2E8 \uC18C\uC2A4\uB9F5 \uB9E4\uD551 \uC2E4\uD328 (\uBA38\uB9AC\uB9D0/\uAE00\uC0C1\uC790/\uCEA1\uC158 \uC601\uC5ED\uC774\uAC70\uB098 \uD14D\uC2A4\uD2B8 \uBD88\uC77C\uCE58)" };
|
|
28927
29007
|
}
|
|
28928
29008
|
return { capability: "text" };
|
|
@@ -28988,7 +29068,7 @@ var HwpxSession = (_class8 = class _HwpxSession {
|
|
|
28988
29068
|
continue;
|
|
28989
29069
|
}
|
|
28990
29070
|
if (block.type === "table" && block.table) {
|
|
28991
|
-
if (!_optionalChain([edit, 'access',
|
|
29071
|
+
if (!_optionalChain([edit, 'access', _489 => _489.cells, 'optionalAccess', _490 => _490.length])) {
|
|
28992
29072
|
skipped.push({ reason: "\uD45C \uBE14\uB85D\uC5D0\uB294 cells \uD3B8\uC9D1\uB9CC \uC9C0\uC6D0", before: summarize(_nullishCoalesce(block.table.caption, () => ( "(\uD45C)"))) });
|
|
28993
29073
|
continue;
|
|
28994
29074
|
}
|
|
@@ -29008,7 +29088,7 @@ var HwpxSession = (_class8 = class _HwpxSession {
|
|
|
29008
29088
|
skipped.push({ reason: "\uAC19\uC740 \uC140\uC5D0 \uC911\uBCF5 \uD3B8\uC9D1 \u2014 \uBA3C\uC800 \uC801\uC6A9\uB41C \uD3B8\uC9D1 \uC720\uC9C0", after: summarize(cellEdit.text) });
|
|
29009
29089
|
continue;
|
|
29010
29090
|
}
|
|
29011
|
-
const irCell = _optionalChain([block, 'access',
|
|
29091
|
+
const irCell = _optionalChain([block, 'access', _491 => _491.table, 'access', _492 => _492.cells, 'access', _493 => _493[cellEdit.row], 'optionalAccess', _494 => _494[cellEdit.col]]);
|
|
29012
29092
|
if (!irCell) {
|
|
29013
29093
|
skipped.push({ reason: `\uC140 \uC88C\uD45C \uBC94\uC704 \uBC16: ${cellEdit.row},${cellEdit.col}`, after: summarize(cellEdit.text) });
|
|
29014
29094
|
continue;
|
|
@@ -29064,7 +29144,7 @@ var HwpxSession = (_class8 = class _HwpxSession {
|
|
|
29064
29144
|
}
|
|
29065
29145
|
if (replacements.size === 0) {
|
|
29066
29146
|
let changes2;
|
|
29067
|
-
if (_optionalChain([options, 'optionalAccess',
|
|
29147
|
+
if (_optionalChain([options, 'optionalAccess', _495 => _495.verify]) !== false) {
|
|
29068
29148
|
const units = splitMarkdownUnits(st.markdown);
|
|
29069
29149
|
changes2 = diffUnitLists(units, units);
|
|
29070
29150
|
}
|
|
@@ -29085,7 +29165,7 @@ var HwpxSession = (_class8 = class _HwpxSession {
|
|
|
29085
29165
|
}
|
|
29086
29166
|
this.state = newState;
|
|
29087
29167
|
let changes;
|
|
29088
|
-
if (_optionalChain([options, 'optionalAccess',
|
|
29168
|
+
if (_optionalChain([options, 'optionalAccess', _496 => _496.verify]) !== false) {
|
|
29089
29169
|
changes = diffUnitLists(splitMarkdownUnits(beforeMarkdown), splitMarkdownUnits(newState.markdown));
|
|
29090
29170
|
}
|
|
29091
29171
|
return { success: true, data: new Uint8Array(data), applied, skipped, changes };
|
|
@@ -29105,7 +29185,7 @@ var HwpxSession = (_class8 = class _HwpxSession {
|
|
|
29105
29185
|
return skip("\uBB38\uB2E8 \uB0B4 \uAC15\uC81C \uC904\uBC14\uAFC8 \uD3EC\uD568 \u2014 \uC218\uC815 \uC2DC \uC904\uBC14\uAFC8 \uBCF4\uC874 \uBD88\uAC00\uB85C \uBBF8\uC9C0\uC6D0 (v1)");
|
|
29106
29186
|
}
|
|
29107
29187
|
const mapping = st.paraMap.get(blockIndex);
|
|
29108
|
-
if (!_optionalChain([mapping, 'optionalAccess',
|
|
29188
|
+
if (!_optionalChain([mapping, 'optionalAccess', _497 => _497.para])) {
|
|
29109
29189
|
return skip("\uBB38\uB2E8 \uC18C\uC2A4\uB9F5 \uB9E4\uD551 \uC2E4\uD328 (\uBA38\uB9AC\uB9D0/\uAE00\uC0C1\uC790/\uCEA1\uC158 \uC601\uC5ED\uC774\uAC70\uB098 \uD14D\uC2A4\uD2B8 \uBD88\uC77C\uCE58)");
|
|
29110
29190
|
}
|
|
29111
29191
|
let newPlain = newTextRaw.split("\n").map((l) => l.trim()).filter(Boolean).join(" ");
|
|
@@ -29125,14 +29205,14 @@ var HwpxSession = (_class8 = class _HwpxSession {
|
|
|
29125
29205
|
if (sanitizeText(newPlain) !== newPlain) {
|
|
29126
29206
|
return skip("\uACF5\uBC31 \uC815\uADDC\uD654 \uBD88\uC548\uC815 \uD14D\uC2A4\uD2B8 \u2014 \uD328\uCE58 \uC2DC \uC6D0\uBB38 \uBCF4\uC874 \uBD88\uAC00\uB85C \uBBF8\uC9C0\uC6D0");
|
|
29127
29207
|
}
|
|
29128
|
-
const splices = buildParagraphSplices(mapping.para, newPlain, _optionalChain([st, 'access',
|
|
29208
|
+
const splices = buildParagraphSplices(mapping.para, newPlain, _optionalChain([st, 'access', _498 => _498.scans, 'access', _499 => _499[mapping.para.sectionIndex], 'optionalAccess', _500 => _500.xml]));
|
|
29129
29209
|
if (splices === null) return skip("\uBB38\uB2E8\uC5D0 \uD14D\uC2A4\uD2B8 \uB178\uB4DC\uB97C \uB9CC\uB4E4 \uC218 \uC5C6\uC74C");
|
|
29130
29210
|
sectionSplices[mapping.para.sectionIndex].push(...splices);
|
|
29131
29211
|
return 1;
|
|
29132
29212
|
}
|
|
29133
29213
|
}, _class8);
|
|
29134
29214
|
function cellStaticCheck(table2, scanTable, r, c) {
|
|
29135
|
-
const irCell = _optionalChain([table2, 'access',
|
|
29215
|
+
const irCell = _optionalChain([table2, 'access', _501 => _501.cells, 'access', _502 => _502[r], 'optionalAccess', _503 => _503[c]]);
|
|
29136
29216
|
if (!irCell) return { editable: false, reason: "\uC140 \uC88C\uD45C \uBC94\uC704 \uBC16" };
|
|
29137
29217
|
const cell2 = scanTable.cellByAnchor.get(`${r},${c}`);
|
|
29138
29218
|
if (!cell2) return { editable: false, reason: "\uBCD1\uD569 \uC601\uC5ED\uC758 \uBE48 \uCE78\uC774\uAC70\uB098 \uC88C\uD45C \uBD88\uC77C\uCE58" };
|
|
@@ -29216,11 +29296,11 @@ var md = new (0, _markdownit2.default)({
|
|
|
29216
29296
|
breaks: false
|
|
29217
29297
|
});
|
|
29218
29298
|
function renderHtml(markdown, options) {
|
|
29219
|
-
const preset = _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
29220
|
-
const css = PRESETS[preset] + (_nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
29299
|
+
const preset = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _504 => _504.preset]), () => ( "default"));
|
|
29300
|
+
const css = PRESETS[preset] + (_nullishCoalesce(_optionalChain([options, 'optionalAccess', _505 => _505.extraCss]), () => ( "")));
|
|
29221
29301
|
const body = md.render(markdown);
|
|
29222
|
-
const watermark = _optionalChain([options, 'optionalAccess',
|
|
29223
|
-
const watermarkCss = _optionalChain([options, 'optionalAccess',
|
|
29302
|
+
const watermark = _optionalChain([options, 'optionalAccess', _506 => _506.watermark]) ? `<div class="watermark">${escapeHtml(options.watermark)}</div>` : "";
|
|
29303
|
+
const watermarkCss = _optionalChain([options, 'optionalAccess', _507 => _507.watermark]) ? `
|
|
29224
29304
|
.watermark {
|
|
29225
29305
|
position: fixed;
|
|
29226
29306
|
top: 50%; left: 50%;
|
|
@@ -29251,13 +29331,13 @@ async function htmlToPdf(html, options) {
|
|
|
29251
29331
|
try {
|
|
29252
29332
|
puppeteer = await Promise.resolve().then(() => _interopRequireWildcard(require("puppeteer-core")));
|
|
29253
29333
|
} catch (e32) {
|
|
29254
|
-
throw new (0,
|
|
29334
|
+
throw new (0, _chunkF2HYH62Hcjs.KordocError)(
|
|
29255
29335
|
"PDF \uC0DD\uC131\uC5D0 puppeteer-core\uAC00 \uD544\uC694\uD569\uB2C8\uB2E4. \uC124\uCE58: npm install puppeteer-core"
|
|
29256
29336
|
);
|
|
29257
29337
|
}
|
|
29258
29338
|
const executablePath = _nullishCoalesce(process.env.PUPPETEER_EXECUTABLE_PATH, () => ( findChromiumPath()));
|
|
29259
29339
|
if (!executablePath) {
|
|
29260
|
-
throw new (0,
|
|
29340
|
+
throw new (0, _chunkF2HYH62Hcjs.KordocError)(
|
|
29261
29341
|
"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."
|
|
29262
29342
|
);
|
|
29263
29343
|
}
|
|
@@ -29269,10 +29349,10 @@ async function htmlToPdf(html, options) {
|
|
|
29269
29349
|
try {
|
|
29270
29350
|
const page = await browser.newPage();
|
|
29271
29351
|
await page.setContent(html, { waitUntil: "networkidle0" });
|
|
29272
|
-
const margin = _optionalChain([options, 'optionalAccess',
|
|
29352
|
+
const margin = _optionalChain([options, 'optionalAccess', _508 => _508.margin]);
|
|
29273
29353
|
const pdf = await page.pdf({
|
|
29274
|
-
format: _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
29275
|
-
landscape: _optionalChain([options, 'optionalAccess',
|
|
29354
|
+
format: _nullishCoalesce(_optionalChain([options, 'optionalAccess', _509 => _509.pageSize]), () => ( "A4")),
|
|
29355
|
+
landscape: _optionalChain([options, 'optionalAccess', _510 => _510.orientation]) === "landscape",
|
|
29276
29356
|
printBackground: true,
|
|
29277
29357
|
margin: margin ? {
|
|
29278
29358
|
top: toCss(margin.top),
|
|
@@ -29280,9 +29360,9 @@ async function htmlToPdf(html, options) {
|
|
|
29280
29360
|
bottom: toCss(margin.bottom),
|
|
29281
29361
|
left: toCss(margin.left)
|
|
29282
29362
|
} : void 0,
|
|
29283
|
-
displayHeaderFooter: !!(_optionalChain([options, 'optionalAccess',
|
|
29284
|
-
headerTemplate: _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
29285
|
-
footerTemplate: _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
29363
|
+
displayHeaderFooter: !!(_optionalChain([options, 'optionalAccess', _511 => _511.header]) || _optionalChain([options, 'optionalAccess', _512 => _512.footer])),
|
|
29364
|
+
headerTemplate: _nullishCoalesce(_optionalChain([options, 'optionalAccess', _513 => _513.header]), () => ( "<div></div>")),
|
|
29365
|
+
footerTemplate: _nullishCoalesce(_optionalChain([options, 'optionalAccess', _514 => _514.footer]), () => ( '<div style="font-size:8pt;width:100%;text-align:center;color:#777;"><span class="pageNumber"></span>/<span class="totalPages"></span></div>'))
|
|
29286
29366
|
});
|
|
29287
29367
|
return Buffer.from(pdf);
|
|
29288
29368
|
} finally {
|
|
@@ -29316,7 +29396,7 @@ async function markdownToPdf(markdown, options) {
|
|
|
29316
29396
|
return htmlToPdf(html, options);
|
|
29317
29397
|
}
|
|
29318
29398
|
async function blocksToPdf(blocks, options) {
|
|
29319
|
-
const markdown =
|
|
29399
|
+
const markdown = _chunkXTCT6KQ5cjs.blocksToMarkdown.call(void 0, blocks);
|
|
29320
29400
|
return markdownToPdf(markdown, options);
|
|
29321
29401
|
}
|
|
29322
29402
|
|
|
@@ -29495,7 +29575,7 @@ function reflowPara(p, doc, styles, areaW, startV, mode) {
|
|
|
29495
29575
|
}
|
|
29496
29576
|
const wrapAttr = _nullishCoalesce(o.el.getAttribute("textWrap"), () => ( ""));
|
|
29497
29577
|
if (wrapAttr === "BEHIND_TEXT" || wrapAttr === "IN_FRONT_OF_TEXT") continue;
|
|
29498
|
-
const vertRel = _nullishCoalesce(_optionalChain([pos, 'optionalAccess',
|
|
29578
|
+
const vertRel = _nullishCoalesce(_optionalChain([pos, 'optionalAccess', _515 => _515.getAttribute, 'call', _516 => _516("vertRelTo")]), () => ( "PARA"));
|
|
29499
29579
|
if (vertRel === "PAGE" || vertRel === "PAPER") continue;
|
|
29500
29580
|
const vo = Math.max(0, num2(pos, "vertOffset"));
|
|
29501
29581
|
if (wrapAttr === "TOP_AND_BOTTOM") {
|
|
@@ -29556,7 +29636,7 @@ function reflowBlockFlow(container, doc, styles, areaW, mode, counter, bodyH) {
|
|
|
29556
29636
|
if (ln(p) !== "p") continue;
|
|
29557
29637
|
reflowTablesIn(p, doc, styles, mode, counter);
|
|
29558
29638
|
const g = styles.paraGeom.get(_nullishCoalesce(p.getAttribute("paraPrIDRef"), () => ( "")));
|
|
29559
|
-
const startV = cursorV + prevSpaceAfter + (_nullishCoalesce(_optionalChain([g, 'optionalAccess',
|
|
29639
|
+
const startV = cursorV + prevSpaceAfter + (_nullishCoalesce(_optionalChain([g, 'optionalAccess', _517 => _517.spaceBefore]), () => ( 0)));
|
|
29560
29640
|
const res = reflowPara(p, doc, styles, areaW, startV, mode);
|
|
29561
29641
|
if (!res) {
|
|
29562
29642
|
const lsa = findChildByLocalName(p, "linesegarray");
|
|
@@ -29569,7 +29649,7 @@ function reflowBlockFlow(container, doc, styles, areaW, mode, counter, bodyH) {
|
|
|
29569
29649
|
}
|
|
29570
29650
|
if (Number.isFinite(bottom)) {
|
|
29571
29651
|
cursorV = bottom;
|
|
29572
|
-
prevSpaceAfter = _nullishCoalesce(_optionalChain([g, 'optionalAccess',
|
|
29652
|
+
prevSpaceAfter = _nullishCoalesce(_optionalChain([g, 'optionalAccess', _518 => _518.spaceAfter]), () => ( 0));
|
|
29573
29653
|
}
|
|
29574
29654
|
}
|
|
29575
29655
|
continue;
|
|
@@ -29679,7 +29759,7 @@ function buildPara(p) {
|
|
|
29679
29759
|
el: ch,
|
|
29680
29760
|
tag: cn,
|
|
29681
29761
|
index: chars.length,
|
|
29682
|
-
inline: _optionalChain([pos, 'optionalAccess',
|
|
29762
|
+
inline: _optionalChain([pos, 'optionalAccess', _519 => _519.getAttribute, 'call', _520 => _520("treatAsChar")]) === "1",
|
|
29683
29763
|
width: w,
|
|
29684
29764
|
height: h
|
|
29685
29765
|
});
|
|
@@ -29931,15 +30011,15 @@ function drawShape(o, x, y, ctx, depth) {
|
|
|
29931
30011
|
const sx = ow > 0 ? w / ow : 1;
|
|
29932
30012
|
const sy = oh > 0 ? h / oh : 1;
|
|
29933
30013
|
const lineShape = findChildByLocalName(el, "lineShape");
|
|
29934
|
-
const lstyle = _nullishCoalesce(_optionalChain([lineShape, 'optionalAccess',
|
|
29935
|
-
const strokeCol = _optionalChain([lineShape, 'optionalAccess',
|
|
30014
|
+
const lstyle = _nullishCoalesce(_optionalChain([lineShape, 'optionalAccess', _521 => _521.getAttribute, 'call', _522 => _522("style")]), () => ( "SOLID"));
|
|
30015
|
+
const strokeCol = _optionalChain([lineShape, 'optionalAccess', _523 => _523.getAttribute, 'call', _524 => _524("color")]) || "#000000";
|
|
29936
30016
|
const hasStroke = lstyle !== "NONE";
|
|
29937
30017
|
const strokeW = hasStroke ? shapeStrokePt(lineShape ? num3(lineShape, "width") : 33) : 0;
|
|
29938
30018
|
const dash = /DASH|DOT/.test(lstyle) ? ` stroke-dasharray="${lstyle.includes("DOT") ? "1,1.5" : "3,1.5"}"` : "";
|
|
29939
30019
|
const strokeAttr = hasStroke ? ` stroke="${escapeXml3(strokeCol)}" stroke-width="${strokeW.toFixed(2)}"${dash}` : "";
|
|
29940
30020
|
const fillBrush = findChildByLocalName(el, "fillBrush");
|
|
29941
30021
|
const winBrush = fillBrush ? findChildByLocalName(fillBrush, "winBrush") : null;
|
|
29942
|
-
const face = _optionalChain([winBrush, 'optionalAccess',
|
|
30022
|
+
const face = _optionalChain([winBrush, 'optionalAccess', _525 => _525.getAttribute, 'call', _526 => _526("faceColor")]);
|
|
29943
30023
|
const fill = face && face.toLowerCase() !== "none" ? face : "none";
|
|
29944
30024
|
const fillAttr = ` fill="${fill === "none" ? "none" : escapeXml3(fill)}"`;
|
|
29945
30025
|
if (o.tag === "rect") {
|
|
@@ -29966,14 +30046,14 @@ function drawShape(o, x, y, ctx, depth) {
|
|
|
29966
30046
|
}
|
|
29967
30047
|
function cellContentExtent(cell2, memo) {
|
|
29968
30048
|
if (!cell2.sub) return 0;
|
|
29969
|
-
const hit = _optionalChain([memo, 'optionalAccess',
|
|
30049
|
+
const hit = _optionalChain([memo, 'optionalAccess', _527 => _527.cell, 'access', _528 => _528.get, 'call', _529 => _529(cell2.el)]);
|
|
29970
30050
|
if (hit !== void 0) return hit;
|
|
29971
30051
|
let ext = 0;
|
|
29972
30052
|
for (const p of elements2(cell2.sub)) {
|
|
29973
30053
|
if (ln2(p) !== "p") continue;
|
|
29974
30054
|
const m = buildPara(p);
|
|
29975
30055
|
for (const s of m.segs) ext = Math.max(ext, s.vertpos + s.textheight);
|
|
29976
|
-
const baseV = _nullishCoalesce(_optionalChain([m, 'access',
|
|
30056
|
+
const baseV = _nullishCoalesce(_optionalChain([m, 'access', _530 => _530.segs, 'access', _531 => _531[0], 'optionalAccess', _532 => _532.vertpos]), () => ( 0));
|
|
29977
30057
|
for (const o of m.objs) {
|
|
29978
30058
|
if (o.inline) {
|
|
29979
30059
|
const h = o.tag === "tbl" ? Math.max(o.height, measureTableHeight(o.el, memo)) : o.height;
|
|
@@ -29981,14 +30061,14 @@ function cellContentExtent(cell2, memo) {
|
|
|
29981
30061
|
continue;
|
|
29982
30062
|
}
|
|
29983
30063
|
const pos = findChildByLocalName(o.el, "pos");
|
|
29984
|
-
if ((_nullishCoalesce(_optionalChain([pos, 'optionalAccess',
|
|
30064
|
+
if ((_nullishCoalesce(_optionalChain([pos, 'optionalAccess', _533 => _533.getAttribute, 'call', _534 => _534("vertRelTo")]), () => ( "PARA"))) !== "PARA") continue;
|
|
29985
30065
|
const om = findChildByLocalName(o.el, "outMargin");
|
|
29986
30066
|
const pushed = baseV - (num3(om, "top") + o.height + num3(om, "bottom"));
|
|
29987
30067
|
const anchor = pushed >= -100 ? pushed : baseV;
|
|
29988
30068
|
ext = Math.max(ext, anchor + num3(om, "top") + num3(pos, "vertOffset") + o.height);
|
|
29989
30069
|
}
|
|
29990
30070
|
}
|
|
29991
|
-
_optionalChain([memo, 'optionalAccess',
|
|
30071
|
+
_optionalChain([memo, 'optionalAccess', _535 => _535.cell, 'access', _536 => _536.set, 'call', _537 => _537(cell2.el, ext)]);
|
|
29992
30072
|
return ext;
|
|
29993
30073
|
}
|
|
29994
30074
|
function edgeLine(x1, y1, x2, y2, e) {
|
|
@@ -30030,7 +30110,7 @@ function collectCells(tbl2) {
|
|
|
30030
30110
|
return cells;
|
|
30031
30111
|
}
|
|
30032
30112
|
function measureTableHeight(tbl2, memo) {
|
|
30033
|
-
const hit = _optionalChain([memo, 'optionalAccess',
|
|
30113
|
+
const hit = _optionalChain([memo, 'optionalAccess', _538 => _538.table, 'access', _539 => _539.get, 'call', _540 => _540(tbl2)]);
|
|
30034
30114
|
if (hit !== void 0) return hit;
|
|
30035
30115
|
const cells = collectCells(tbl2);
|
|
30036
30116
|
if (cells.length === 0 || cells.length > 4096) return 0;
|
|
@@ -30041,7 +30121,7 @@ function measureTableHeight(tbl2, memo) {
|
|
|
30041
30121
|
);
|
|
30042
30122
|
let sum = 0;
|
|
30043
30123
|
for (const h of rowH) sum += h;
|
|
30044
|
-
_optionalChain([memo, 'optionalAccess',
|
|
30124
|
+
_optionalChain([memo, 'optionalAccess', _541 => _541.table, 'access', _542 => _542.set, 'call', _543 => _543(tbl2, sum)]);
|
|
30045
30125
|
return sum;
|
|
30046
30126
|
}
|
|
30047
30127
|
function drawTable(tbl2, tx, ty, ctx, depth) {
|
|
@@ -30072,7 +30152,7 @@ function drawTable(tbl2, tx, ty, ctx, depth) {
|
|
|
30072
30152
|
}));
|
|
30073
30153
|
for (const g of geom) {
|
|
30074
30154
|
const bf = g.c.bfId != null ? ctx.styles.borderFill.get(g.c.bfId) : void 0;
|
|
30075
|
-
if (_optionalChain([bf, 'optionalAccess',
|
|
30155
|
+
if (_optionalChain([bf, 'optionalAccess', _544 => _544.fill])) emit(ctx, `<rect x="${pt(g.x)}" y="${pt(g.y)}" width="${pt(g.w)}" height="${pt(g.h)}" fill="${escapeXml3(bf.fill)}"/>`);
|
|
30076
30156
|
}
|
|
30077
30157
|
for (const g of geom) {
|
|
30078
30158
|
const { c } = g;
|
|
@@ -30110,7 +30190,7 @@ function drawPic(pic, x, y, ctx) {
|
|
|
30110
30190
|
const sz = findChildByLocalName(pic, "sz");
|
|
30111
30191
|
const w = num3(sz, "width", 5669), h = num3(sz, "height", 5669);
|
|
30112
30192
|
const img = findFirst(pic, "img");
|
|
30113
|
-
const ref = _optionalChain([img, 'optionalAccess',
|
|
30193
|
+
const ref = _optionalChain([img, 'optionalAccess', _545 => _545.getAttribute, 'call', _546 => _546("binaryItemIDRef")]);
|
|
30114
30194
|
const loaded = ref != null ? ctx.images.get(ref) : void 0;
|
|
30115
30195
|
if (!loaded) {
|
|
30116
30196
|
emit(ctx, `<rect x="${pt(x)}" y="${pt(y)}" width="${pt(w)}" height="${pt(h)}" fill="#eee" stroke="#c00" stroke-width="0.5"/>`);
|
|
@@ -30150,7 +30230,7 @@ function readSectionGeom(root) {
|
|
|
30150
30230
|
const pagePr = findFirst(root, "pagePr");
|
|
30151
30231
|
const margin = pagePr ? findChildByLocalName(pagePr, "margin") : null;
|
|
30152
30232
|
let PW = num3(pagePr, "width", 59528), PH = num3(pagePr, "height", 84188);
|
|
30153
|
-
if (_optionalChain([pagePr, 'optionalAccess',
|
|
30233
|
+
if (_optionalChain([pagePr, 'optionalAccess', _547 => _547.getAttribute, 'call', _548 => _548("landscape")]) === "NARROWLY" && PW < PH) {
|
|
30154
30234
|
const t = PW;
|
|
30155
30235
|
PW = PH;
|
|
30156
30236
|
PH = t;
|
|
@@ -30208,17 +30288,17 @@ function renderSectionToPages(root, geom, ctxBase, doReflow, reflowMode) {
|
|
|
30208
30288
|
return { pages: ctx.pages, pageH };
|
|
30209
30289
|
}
|
|
30210
30290
|
async function renderHwpxToSvg(input, options) {
|
|
30211
|
-
const maxImg = _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
30291
|
+
const maxImg = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _549 => _549.maxImageBytes]), () => ( 40 * 1024 * 1024));
|
|
30212
30292
|
const ab = input instanceof Uint8Array ? input.buffer.slice(input.byteOffset, input.byteOffset + input.byteLength) : input;
|
|
30213
|
-
|
|
30293
|
+
_chunkF2HYH62Hcjs.precheckZipSize.call(void 0, ab, MAX_DECOMPRESS_SIZE, MAX_ZIP_ENTRIES);
|
|
30214
30294
|
let zip;
|
|
30215
30295
|
try {
|
|
30216
30296
|
zip = await _jszip2.default.loadAsync(input);
|
|
30217
30297
|
} catch (e33) {
|
|
30218
|
-
throw new (0,
|
|
30298
|
+
throw new (0, _chunkF2HYH62Hcjs.KordocError)("HWPX(ZIP) \uD615\uC2DD\uC774 \uC544\uB2D9\uB2C8\uB2E4 \u2014 \uB80C\uB354\uB294 HWPX\uB9CC \uC9C0\uC6D0");
|
|
30219
30299
|
}
|
|
30220
30300
|
const secFiles = zip.file(/Contents\/section\d+\.xml$/i).sort((a, b) => a.name.localeCompare(b.name));
|
|
30221
|
-
if (secFiles.length === 0) throw new (0,
|
|
30301
|
+
if (secFiles.length === 0) throw new (0, _chunkF2HYH62Hcjs.KordocError)("Contents/section0.xml \uC5C6\uC74C \u2014 HWPX\uAC00 \uC544\uB2C8\uAC70\uB098 \uC190\uC0C1\uB428");
|
|
30222
30302
|
const warnings = [];
|
|
30223
30303
|
const headFile = _nullishCoalesce(zip.file("Contents/header.xml"), () => ( zip.file("Contents/head.xml")));
|
|
30224
30304
|
const styles = headFile ? parseRenderStyles(await headFile.async("string")) : { charPr: /* @__PURE__ */ new Map(), paraAlign: /* @__PURE__ */ new Map(), paraGeom: /* @__PURE__ */ new Map(), borderFill: /* @__PURE__ */ new Map() };
|
|
@@ -30226,7 +30306,7 @@ async function renderHwpxToSvg(input, options) {
|
|
|
30226
30306
|
const secXmls = [];
|
|
30227
30307
|
for (const f of secFiles) {
|
|
30228
30308
|
const xml = await f.async("string");
|
|
30229
|
-
if (xml.length > MAX_DECOMPRESS_SIZE) throw new (0,
|
|
30309
|
+
if (xml.length > MAX_DECOMPRESS_SIZE) throw new (0, _chunkF2HYH62Hcjs.KordocError)("\uC139\uC158 XML\uC774 \uD5C8\uC6A9 \uD06C\uAE30\uB97C \uCD08\uACFC");
|
|
30230
30310
|
secXmls.push(xml);
|
|
30231
30311
|
}
|
|
30232
30312
|
const binmap = /* @__PURE__ */ new Map();
|
|
@@ -30250,7 +30330,7 @@ async function renderHwpxToSvg(input, options) {
|
|
|
30250
30330
|
let href = binmap.get(ref);
|
|
30251
30331
|
if (!href) {
|
|
30252
30332
|
const cand = zip.file(new RegExp(`BinData/.*${ref.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")}`, "i"))[0];
|
|
30253
|
-
href = _optionalChain([cand, 'optionalAccess',
|
|
30333
|
+
href = _optionalChain([cand, 'optionalAccess', _550 => _550.name]);
|
|
30254
30334
|
}
|
|
30255
30335
|
if (!href) continue;
|
|
30256
30336
|
const f = _nullishCoalesce(zip.file(href), () => ( zip.file("Contents/" + href)));
|
|
@@ -30271,7 +30351,7 @@ async function renderHwpxToSvg(input, options) {
|
|
|
30271
30351
|
styles,
|
|
30272
30352
|
images,
|
|
30273
30353
|
defs: [],
|
|
30274
|
-
highlights: (_nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
30354
|
+
highlights: (_nullishCoalesce(_optionalChain([options, 'optionalAccess', _551 => _551.highlights]), () => ( []))).map((s) => s.trim().toLowerCase()).filter((s) => s.length > 0),
|
|
30275
30355
|
warnings,
|
|
30276
30356
|
warned: /* @__PURE__ */ new Set(),
|
|
30277
30357
|
stats: { texts: 0, images: 0, tables: 0 },
|
|
@@ -30282,7 +30362,7 @@ async function renderHwpxToSvg(input, options) {
|
|
|
30282
30362
|
for (let si = 0; si < secXmls.length; si++) {
|
|
30283
30363
|
const secXml = secXmls[si];
|
|
30284
30364
|
const hasCache = /<(?:[A-Za-z][\w.-]*:)?linesegarray[\s/>]/.test(secXml);
|
|
30285
|
-
if (!hasCache && !_optionalChain([options, 'optionalAccess',
|
|
30365
|
+
if (!hasCache && !_optionalChain([options, 'optionalAccess', _552 => _552.reflow])) {
|
|
30286
30366
|
noCacheSkipped = true;
|
|
30287
30367
|
warnings.push(`\uAD6C\uC5ED ${si}: \uC870\uD310 \uCE90\uC2DC \uC5C6\uC74C \u2014 reflow \uC635\uC158 \uD544\uC694, \uC0DD\uB7B5`);
|
|
30288
30368
|
continue;
|
|
@@ -30294,14 +30374,14 @@ async function renderHwpxToSvg(input, options) {
|
|
|
30294
30374
|
continue;
|
|
30295
30375
|
}
|
|
30296
30376
|
const geom = readSectionGeom(root);
|
|
30297
|
-
const { pages, pageH } = renderSectionToPages(root, geom, ctxBase, !!_optionalChain([options, 'optionalAccess',
|
|
30377
|
+
const { pages, pageH } = renderSectionToPages(root, geom, ctxBase, !!_optionalChain([options, 'optionalAccess', _553 => _553.reflow]), _nullishCoalesce(_optionalChain([options, 'optionalAccess', _554 => _554.reflowMode]), () => ( "keep")));
|
|
30298
30378
|
rendered.push({ pages, PW: geom.PW, pageH, clipId: `pgclip${si}` });
|
|
30299
30379
|
}
|
|
30300
30380
|
if (rendered.length === 0) {
|
|
30301
30381
|
if (noCacheSkipped) {
|
|
30302
|
-
throw new (0,
|
|
30382
|
+
throw new (0, _chunkF2HYH62Hcjs.KordocError)("\uC870\uD310 \uCE90\uC2DC(linesegarray) \uC5C6\uC74C \u2014 \uD55C\uCEF4\uC5D0\uC11C \uC800\uC7A5\uD55C HWPX\uB9CC \uB80C\uB354 \uAC00\uB2A5 (reflow \uC635\uC158\uC73C\uB85C \uD569\uC131 \uB80C\uB354 \uAC00\uB2A5)");
|
|
30303
30383
|
}
|
|
30304
|
-
throw new (0,
|
|
30384
|
+
throw new (0, _chunkF2HYH62Hcjs.KordocError)("\uB80C\uB354\uD560 \uAD6C\uC5ED\uC774 \uC5C6\uC2B5\uB2C8\uB2E4 \u2014 HWPX\uAC00 \uC190\uC0C1\uB418\uC5C8\uC744 \uC218 \uC788\uC2B5\uB2C8\uB2E4");
|
|
30305
30385
|
}
|
|
30306
30386
|
const GAP = 2400;
|
|
30307
30387
|
const clipDefs = [];
|
|
@@ -30333,17 +30413,17 @@ ${groups.join("\n")}
|
|
|
30333
30413
|
// src/index.ts
|
|
30334
30414
|
async function parse(input, options) {
|
|
30335
30415
|
let buffer;
|
|
30336
|
-
const opts = typeof input === "string" && !_optionalChain([options, 'optionalAccess',
|
|
30416
|
+
const opts = typeof input === "string" && !_optionalChain([options, 'optionalAccess', _555 => _555.filePath]) ? { ...options, filePath: input } : options;
|
|
30337
30417
|
if (typeof input === "string") {
|
|
30338
30418
|
try {
|
|
30339
30419
|
const buf = await _promises.readFile.call(void 0, input);
|
|
30340
|
-
buffer =
|
|
30420
|
+
buffer = _chunkF2HYH62Hcjs.toArrayBuffer.call(void 0, buf);
|
|
30341
30421
|
} catch (err) {
|
|
30342
30422
|
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}`;
|
|
30343
30423
|
return { success: false, fileType: "unknown", error: msg2, code: "PARSE_ERROR" };
|
|
30344
30424
|
}
|
|
30345
30425
|
} else if (Buffer.isBuffer(input)) {
|
|
30346
|
-
buffer =
|
|
30426
|
+
buffer = _chunkF2HYH62Hcjs.toArrayBuffer.call(void 0, input);
|
|
30347
30427
|
} else {
|
|
30348
30428
|
buffer = input;
|
|
30349
30429
|
}
|
|
@@ -30378,21 +30458,21 @@ async function parseHwp3(buffer, options) {
|
|
|
30378
30458
|
const { markdown, blocks, metadata, outline, warnings } = parseHwp3Document(buffer, options);
|
|
30379
30459
|
return { success: true, fileType: "hwp3", markdown, blocks, metadata, outline, warnings };
|
|
30380
30460
|
} catch (err) {
|
|
30381
|
-
return { success: false, fileType: "hwp3", error:
|
|
30461
|
+
return { success: false, fileType: "hwp3", error: _chunkF2HYH62Hcjs.sanitizeError.call(void 0, err), code: _chunkF2HYH62Hcjs.classifyError.call(void 0, err) };
|
|
30382
30462
|
}
|
|
30383
30463
|
}
|
|
30384
30464
|
async function parseHwpx(buffer, options) {
|
|
30385
30465
|
try {
|
|
30386
30466
|
const { markdown, blocks, metadata, outline, warnings, images } = await parseHwpxDocument(buffer, options);
|
|
30387
|
-
return { success: true, fileType: "hwpx", markdown, blocks, metadata, outline, warnings, images: _optionalChain([images, 'optionalAccess',
|
|
30467
|
+
return { success: true, fileType: "hwpx", markdown, blocks, metadata, outline, warnings, images: _optionalChain([images, 'optionalAccess', _556 => _556.length]) ? images : void 0 };
|
|
30388
30468
|
} catch (err) {
|
|
30389
|
-
return { success: false, fileType: "hwpx", error:
|
|
30469
|
+
return { success: false, fileType: "hwpx", error: _chunkF2HYH62Hcjs.sanitizeError.call(void 0, err), code: _chunkF2HYH62Hcjs.classifyError.call(void 0, err) };
|
|
30390
30470
|
}
|
|
30391
30471
|
}
|
|
30392
30472
|
async function parseHwp(buffer, options) {
|
|
30393
30473
|
try {
|
|
30394
30474
|
const { markdown, blocks, metadata, outline, warnings, images } = parseHwp5Document(Buffer.from(buffer), options);
|
|
30395
|
-
if (isDistributionSentinel(markdown) && isComFallbackAvailable() && _optionalChain([options, 'optionalAccess',
|
|
30475
|
+
if (isDistributionSentinel(markdown) && isComFallbackAvailable() && _optionalChain([options, 'optionalAccess', _557 => _557.filePath])) {
|
|
30396
30476
|
try {
|
|
30397
30477
|
const { pages, pageCount, warnings: comWarns } = extractTextViaCom(options.filePath);
|
|
30398
30478
|
if (pages.some((p) => p && p.trim().length > 0)) {
|
|
@@ -30409,15 +30489,15 @@ async function parseHwp(buffer, options) {
|
|
|
30409
30489
|
} catch (e34) {
|
|
30410
30490
|
}
|
|
30411
30491
|
}
|
|
30412
|
-
return { success: true, fileType: "hwp", markdown, blocks, metadata, outline, warnings, images: _optionalChain([images, 'optionalAccess',
|
|
30492
|
+
return { success: true, fileType: "hwp", markdown, blocks, metadata, outline, warnings, images: _optionalChain([images, 'optionalAccess', _558 => _558.length]) ? images : void 0 };
|
|
30413
30493
|
} catch (err) {
|
|
30414
|
-
return { success: false, fileType: "hwp", error:
|
|
30494
|
+
return { success: false, fileType: "hwp", error: _chunkF2HYH62Hcjs.sanitizeError.call(void 0, err), code: _chunkF2HYH62Hcjs.classifyError.call(void 0, err) };
|
|
30415
30495
|
}
|
|
30416
30496
|
}
|
|
30417
30497
|
async function parsePdf(buffer, options) {
|
|
30418
30498
|
let parsePdfDocument;
|
|
30419
30499
|
try {
|
|
30420
|
-
const mod = await Promise.resolve().then(() => _interopRequireWildcard(require("./parser-
|
|
30500
|
+
const mod = await Promise.resolve().then(() => _interopRequireWildcard(require("./parser-WDZOMDG4.cjs")));
|
|
30421
30501
|
parsePdfDocument = mod.parsePdfDocument;
|
|
30422
30502
|
} catch (e35) {
|
|
30423
30503
|
return {
|
|
@@ -30432,7 +30512,7 @@ async function parsePdf(buffer, options) {
|
|
|
30432
30512
|
return { success: true, fileType: "pdf", markdown, blocks, metadata, outline, warnings, isImageBased, pageQuality, qualitySummary, images };
|
|
30433
30513
|
} catch (err) {
|
|
30434
30514
|
const isImageBased = err instanceof Error && "isImageBased" in err ? true : void 0;
|
|
30435
|
-
return { success: false, fileType: "pdf", error:
|
|
30515
|
+
return { success: false, fileType: "pdf", error: _chunkF2HYH62Hcjs.sanitizeError.call(void 0, err), code: _chunkF2HYH62Hcjs.classifyError.call(void 0, err), isImageBased };
|
|
30436
30516
|
}
|
|
30437
30517
|
}
|
|
30438
30518
|
async function parseXlsx(buffer, options) {
|
|
@@ -30440,7 +30520,7 @@ async function parseXlsx(buffer, options) {
|
|
|
30440
30520
|
const { markdown, blocks, metadata, warnings } = await parseXlsxDocument(buffer, options);
|
|
30441
30521
|
return { success: true, fileType: "xlsx", markdown, blocks, metadata, warnings };
|
|
30442
30522
|
} catch (err) {
|
|
30443
|
-
return { success: false, fileType: "xlsx", error:
|
|
30523
|
+
return { success: false, fileType: "xlsx", error: _chunkF2HYH62Hcjs.sanitizeError.call(void 0, err), code: _chunkF2HYH62Hcjs.classifyError.call(void 0, err) };
|
|
30444
30524
|
}
|
|
30445
30525
|
}
|
|
30446
30526
|
async function parseXls(buffer, options) {
|
|
@@ -30448,15 +30528,15 @@ async function parseXls(buffer, options) {
|
|
|
30448
30528
|
const { markdown, blocks, metadata, warnings } = await parseXlsDocument(buffer, options);
|
|
30449
30529
|
return { success: true, fileType: "xls", markdown, blocks, metadata, warnings };
|
|
30450
30530
|
} catch (err) {
|
|
30451
|
-
return { success: false, fileType: "xls", error:
|
|
30531
|
+
return { success: false, fileType: "xls", error: _chunkF2HYH62Hcjs.sanitizeError.call(void 0, err), code: _chunkF2HYH62Hcjs.classifyError.call(void 0, err) };
|
|
30452
30532
|
}
|
|
30453
30533
|
}
|
|
30454
30534
|
async function parseDocx(buffer, options) {
|
|
30455
30535
|
try {
|
|
30456
30536
|
const { markdown, blocks, metadata, outline, warnings, images } = await parseDocxDocument(buffer, options);
|
|
30457
|
-
return { success: true, fileType: "docx", markdown, blocks, metadata, outline, warnings, images: _optionalChain([images, 'optionalAccess',
|
|
30537
|
+
return { success: true, fileType: "docx", markdown, blocks, metadata, outline, warnings, images: _optionalChain([images, 'optionalAccess', _559 => _559.length]) ? images : void 0 };
|
|
30458
30538
|
} catch (err) {
|
|
30459
|
-
return { success: false, fileType: "docx", error:
|
|
30539
|
+
return { success: false, fileType: "docx", error: _chunkF2HYH62Hcjs.sanitizeError.call(void 0, err), code: _chunkF2HYH62Hcjs.classifyError.call(void 0, err) };
|
|
30460
30540
|
}
|
|
30461
30541
|
}
|
|
30462
30542
|
async function parseHwpml(buffer, options) {
|
|
@@ -30464,16 +30544,16 @@ async function parseHwpml(buffer, options) {
|
|
|
30464
30544
|
const { markdown, blocks, metadata, outline, warnings } = parseHwpmlDocument(buffer, options);
|
|
30465
30545
|
return { success: true, fileType: "hwpml", markdown, blocks, metadata, outline, warnings };
|
|
30466
30546
|
} catch (err) {
|
|
30467
|
-
return { success: false, fileType: "hwpml", error:
|
|
30547
|
+
return { success: false, fileType: "hwpml", error: _chunkF2HYH62Hcjs.sanitizeError.call(void 0, err), code: _chunkF2HYH62Hcjs.classifyError.call(void 0, err) };
|
|
30468
30548
|
}
|
|
30469
30549
|
}
|
|
30470
30550
|
async function fillForm(input, values, outputFormat = "markdown") {
|
|
30471
30551
|
let buffer;
|
|
30472
30552
|
if (typeof input === "string") {
|
|
30473
30553
|
const buf = await _promises.readFile.call(void 0, input);
|
|
30474
|
-
buffer =
|
|
30554
|
+
buffer = _chunkF2HYH62Hcjs.toArrayBuffer.call(void 0, buf);
|
|
30475
30555
|
} else if (Buffer.isBuffer(input)) {
|
|
30476
|
-
buffer =
|
|
30556
|
+
buffer = _chunkF2HYH62Hcjs.toArrayBuffer.call(void 0, input);
|
|
30477
30557
|
} else {
|
|
30478
30558
|
buffer = input;
|
|
30479
30559
|
}
|
|
@@ -30499,7 +30579,7 @@ async function fillForm(input, values, outputFormat = "markdown") {
|
|
|
30499
30579
|
throw new Error(`\uC11C\uC2DD \uD30C\uC2F1 \uC2E4\uD328: ${parsed.error}`);
|
|
30500
30580
|
}
|
|
30501
30581
|
const fill = fillFormFields(parsed.blocks, values);
|
|
30502
|
-
const markdown =
|
|
30582
|
+
const markdown = _chunkXTCT6KQ5cjs.blocksToMarkdown.call(void 0, fill.blocks);
|
|
30503
30583
|
if (outputFormat === "hwpx") {
|
|
30504
30584
|
const hwpxBuffer = await markdownToHwpx(markdown);
|
|
30505
30585
|
return { output: hwpxBuffer, format: "hwpx", fill };
|
|
@@ -30572,5 +30652,5 @@ async function fillForm(input, values, outputFormat = "markdown") {
|
|
|
30572
30652
|
|
|
30573
30653
|
|
|
30574
30654
|
|
|
30575
|
-
exports.DEFAULT_REDACT_RULES = DEFAULT_REDACT_RULES; exports.HwpxSession = HwpxSession; exports.PRESET_ALIAS = PRESET_ALIAS; exports.SPACE_EM_FIXED = SPACE_EM_FIXED; exports.SPACE_EM_FONT = SPACE_EM_FONT; exports.VERSION =
|
|
30655
|
+
exports.DEFAULT_REDACT_RULES = DEFAULT_REDACT_RULES; exports.HwpxSession = HwpxSession; exports.PRESET_ALIAS = PRESET_ALIAS; exports.SPACE_EM_FIXED = SPACE_EM_FIXED; exports.SPACE_EM_FONT = SPACE_EM_FONT; exports.VERSION = _chunkF2HYH62Hcjs.VERSION; exports.ValueCursor = ValueCursor; exports.applySplices = applySplices; exports.blocksToChunks = blocksToChunks; exports.blocksToMarkdown = _chunkXTCT6KQ5cjs.blocksToMarkdown; exports.blocksToPdf = blocksToPdf; exports.buildParagraphSplices = buildParagraphSplices; exports.buildRangeSplices = buildRangeSplices; exports.charWidthEm1000 = charWidthEm1000; 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.fillWithUniqueGuard = fillWithUniqueGuard; exports.fitRatioForFewerLines = fitRatioForFewerLines; exports.formatFillValue = formatFillValue; exports.gongmunLintWarnings = gongmunLintWarnings; exports.hwpxToProfile = hwpxToProfile; exports.incompatibleGongmunWarnings = incompatibleGongmunWarnings; exports.inferFieldType = inferFieldType; exports.isHwpxFile = isHwpxFile; exports.isKnownFont = isKnownFont; exports.isLabelCell = isLabelCell; exports.isOldHwpFile = isOldHwpFile; exports.isPdfFile = isPdfFile; exports.isZipFile = isZipFile; exports.lintGongmunText = lintGongmunText; exports.markdownToHwpx = markdownToHwpx; exports.markdownToPdf = markdownToPdf; exports.measureTextWidth = measureTextWidth; 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.placeSealHwpx = placeSealHwpx; exports.redactMarkdown = redactMarkdown; exports.redactText = redactText; exports.renderHtml = renderHtml; exports.renderHwpxToSvg = renderHwpxToSvg; exports.scanSectionXml = scanSectionXml; exports.simulateWrap = simulateWrap; exports.simulateWrapKeepWord = simulateWrapKeepWord; exports.unknownFontWarnings = unknownFontWarnings; exports.validateHwpx = validateHwpx;
|
|
30576
30656
|
//# sourceMappingURL=index.cjs.map
|