kordoc 4.6.1 → 4.7.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (97) hide show
  1. package/dist/{-6XJ6MCQG.js → -O42BMYNX.js} +9 -9
  2. package/dist/{chunk-B2OQOTRT.js → chunk-3UIT4PPQ.js} +121 -2
  3. package/dist/chunk-3UIT4PPQ.js.map +1 -0
  4. package/dist/{chunk-MVTX6ODZ.js → chunk-4VNUQYUE.js} +1 -1
  5. package/dist/chunk-4VNUQYUE.js.map +1 -0
  6. package/dist/{chunk-VO24F4BJ.js → chunk-5KPNXBNR.js} +26 -14
  7. package/dist/chunk-5KPNXBNR.js.map +1 -0
  8. package/dist/{chunk-EACTUWYE.js → chunk-6663UXPE.js} +2 -2
  9. package/dist/{chunk-AFPD74JJ.js → chunk-7ZIOZ6PU.js} +2 -2
  10. package/dist/{chunk-XZDJXYUC.js → chunk-AFX6ZXER.js} +2 -2
  11. package/dist/{chunk-BGSGUONP.js → chunk-BQENBAUC.js} +122 -3
  12. package/dist/chunk-BQENBAUC.js.map +1 -0
  13. package/dist/{chunk-TUU535RB.cjs → chunk-DJKLOLBT.cjs} +2 -2
  14. package/dist/chunk-DJKLOLBT.cjs.map +1 -0
  15. package/dist/{chunk-BCG2PKQU.js → chunk-IMEMTJ76.js} +11 -5
  16. package/dist/chunk-IMEMTJ76.js.map +1 -0
  17. package/dist/{chunk-YUVKU5CW.js → chunk-IZEUWEEY.js} +2 -2
  18. package/dist/chunk-IZEUWEEY.js.map +1 -0
  19. package/dist/{chunk-ZYVULRYF.js → chunk-J3W6Q3AX.js} +2 -2
  20. package/dist/{chunk-PV2EXXGI.js → chunk-JEX5P66D.js} +3 -3
  21. package/dist/{chunk-VCA4SZ2D.js → chunk-PLEGO474.js} +2 -2
  22. package/dist/{chunk-AC3K3FZJ.cjs → chunk-TZ3WCAJZ.cjs} +3 -3
  23. package/dist/{chunk-AC3K3FZJ.cjs.map → chunk-TZ3WCAJZ.cjs.map} +1 -1
  24. package/dist/{chunk-W5KRKBYR.cjs → chunk-USGC3ZKU.cjs} +13 -7
  25. package/dist/chunk-USGC3ZKU.cjs.map +1 -0
  26. package/dist/{chunk-YXXHH6WC.js → chunk-UZB3UGC5.js} +2 -2
  27. package/dist/{chunk-IDHBO6AG.js → chunk-VECVLIWE.js} +3 -3
  28. package/dist/{chunk-3VTMSSDW.js → chunk-YWDN5PQC.js} +11 -5
  29. package/dist/chunk-YWDN5PQC.js.map +1 -0
  30. package/dist/{chunk-SHYF2BB2.cjs → chunk-ZDWP3LLY.cjs} +129 -10
  31. package/dist/chunk-ZDWP3LLY.cjs.map +1 -0
  32. package/dist/chunks-C7DJL4RE.js +10 -0
  33. package/dist/cli.js +17 -17
  34. package/dist/{image-ocr-Y3WDYG4I.js → image-ocr-5QRZBNOF.js} +5 -5
  35. package/dist/{image-ocr-MLUPV4FM.cjs → image-ocr-MKD6MKWO.cjs} +10 -10
  36. package/dist/{image-ocr-MLUPV4FM.cjs.map → image-ocr-MKD6MKWO.cjs.map} +1 -1
  37. package/dist/{image-ocr-7VYYQH5F.js → image-ocr-TAJHRZ5T.js} +4 -4
  38. package/dist/index.cjs +479 -467
  39. package/dist/index.cjs.map +1 -1
  40. package/dist/index.d.cts +4 -0
  41. package/dist/index.d.ts +4 -0
  42. package/dist/index.js +21 -9
  43. package/dist/index.js.map +1 -1
  44. package/dist/mcp.js +15 -15
  45. package/dist/{parser-ZDJ7QTLL.js → parser-RCEHB2EV.js} +50 -7
  46. package/dist/parser-RCEHB2EV.js.map +1 -0
  47. package/dist/{parser-QOFG3K3Y.cjs → parser-SWY4RKGD.cjs} +70 -27
  48. package/dist/parser-SWY4RKGD.cjs.map +1 -0
  49. package/dist/{parser-FMYUF4DT.js → parser-UMFBJG2D.js} +51 -8
  50. package/dist/parser-UMFBJG2D.js.map +1 -0
  51. package/dist/pdf-ocr-3NTV3MYP.js +12 -0
  52. package/dist/{pdf-ocr-BFWPYON4.js → pdf-ocr-7BOO4JA7.js} +5 -5
  53. package/dist/pdf-ocr-JDHELYBY.cjs +13 -0
  54. package/dist/{pdf-ocr-MYZNSEK4.cjs.map → pdf-ocr-JDHELYBY.cjs.map} +1 -1
  55. package/dist/{profile-io-L5EH4JAD.js → profile-io-HT62OAEU.js} +3 -3
  56. package/dist/{rasterize-7AR662AL.js → rasterize-GL67HQC7.js} +2 -2
  57. package/dist/render-IQ4IZLY4.js +10 -0
  58. package/dist/seal-AGSZ6MUR.js +10 -0
  59. package/dist/{watch-ZPKLNQTD.js → watch-5ST75Q7Q.js} +9 -9
  60. package/package.json +1 -1
  61. package/dist/chunk-3VTMSSDW.js.map +0 -1
  62. package/dist/chunk-B2OQOTRT.js.map +0 -1
  63. package/dist/chunk-BCG2PKQU.js.map +0 -1
  64. package/dist/chunk-BGSGUONP.js.map +0 -1
  65. package/dist/chunk-MVTX6ODZ.js.map +0 -1
  66. package/dist/chunk-SHYF2BB2.cjs.map +0 -1
  67. package/dist/chunk-TUU535RB.cjs.map +0 -1
  68. package/dist/chunk-VO24F4BJ.js.map +0 -1
  69. package/dist/chunk-W5KRKBYR.cjs.map +0 -1
  70. package/dist/chunk-YUVKU5CW.js.map +0 -1
  71. package/dist/chunks-4HEG6ZPG.js +0 -10
  72. package/dist/parser-FMYUF4DT.js.map +0 -1
  73. package/dist/parser-QOFG3K3Y.cjs.map +0 -1
  74. package/dist/parser-ZDJ7QTLL.js.map +0 -1
  75. package/dist/pdf-ocr-CBJAL5DC.js +0 -12
  76. package/dist/pdf-ocr-MYZNSEK4.cjs +0 -13
  77. package/dist/render-CAFQT7S4.js +0 -10
  78. package/dist/seal-ESAC3IZR.js +0 -10
  79. /package/dist/{-6XJ6MCQG.js.map → -O42BMYNX.js.map} +0 -0
  80. /package/dist/{chunk-EACTUWYE.js.map → chunk-6663UXPE.js.map} +0 -0
  81. /package/dist/{chunk-AFPD74JJ.js.map → chunk-7ZIOZ6PU.js.map} +0 -0
  82. /package/dist/{chunk-XZDJXYUC.js.map → chunk-AFX6ZXER.js.map} +0 -0
  83. /package/dist/{chunk-ZYVULRYF.js.map → chunk-J3W6Q3AX.js.map} +0 -0
  84. /package/dist/{chunk-PV2EXXGI.js.map → chunk-JEX5P66D.js.map} +0 -0
  85. /package/dist/{chunk-VCA4SZ2D.js.map → chunk-PLEGO474.js.map} +0 -0
  86. /package/dist/{chunk-YXXHH6WC.js.map → chunk-UZB3UGC5.js.map} +0 -0
  87. /package/dist/{chunk-IDHBO6AG.js.map → chunk-VECVLIWE.js.map} +0 -0
  88. /package/dist/{chunks-4HEG6ZPG.js.map → chunks-C7DJL4RE.js.map} +0 -0
  89. /package/dist/{image-ocr-Y3WDYG4I.js.map → image-ocr-5QRZBNOF.js.map} +0 -0
  90. /package/dist/{image-ocr-7VYYQH5F.js.map → image-ocr-TAJHRZ5T.js.map} +0 -0
  91. /package/dist/{pdf-ocr-BFWPYON4.js.map → pdf-ocr-3NTV3MYP.js.map} +0 -0
  92. /package/dist/{pdf-ocr-CBJAL5DC.js.map → pdf-ocr-7BOO4JA7.js.map} +0 -0
  93. /package/dist/{profile-io-L5EH4JAD.js.map → profile-io-HT62OAEU.js.map} +0 -0
  94. /package/dist/{rasterize-7AR662AL.js.map → rasterize-GL67HQC7.js.map} +0 -0
  95. /package/dist/{render-CAFQT7S4.js.map → render-IQ4IZLY4.js.map} +0 -0
  96. /package/dist/{seal-ESAC3IZR.js.map → seal-AGSZ6MUR.js.map} +0 -0
  97. /package/dist/{watch-ZPKLNQTD.js.map → watch-5ST75Q7Q.js.map} +0 -0
@@ -52,9 +52,9 @@ import {
52
52
  resolveBuiltinTemplate,
53
53
  unknownFontWarnings,
54
54
  validateHwpx
55
- } from "./chunk-VO24F4BJ.js";
55
+ } from "./chunk-5KPNXBNR.js";
56
56
  import "./chunk-7FCNOKOR.js";
57
- import "./chunk-MVTX6ODZ.js";
57
+ import "./chunk-4VNUQYUE.js";
58
58
  import "./chunk-MOL7MDBG.js";
59
59
  import {
60
60
  applySplices,
@@ -62,7 +62,7 @@ import {
62
62
  buildRangeSplices,
63
63
  placeSealHwpx,
64
64
  scanSectionXml
65
- } from "./chunk-IDHBO6AG.js";
65
+ } from "./chunk-VECVLIWE.js";
66
66
  import {
67
67
  DEFAULT_REDACT_RULES,
68
68
  redactMarkdown,
@@ -70,10 +70,10 @@ import {
70
70
  } from "./chunk-DZIXKL7E.js";
71
71
  import {
72
72
  blocksToChunks
73
- } from "./chunk-XZDJXYUC.js";
73
+ } from "./chunk-AFX6ZXER.js";
74
74
  import {
75
75
  blocksToMarkdown
76
- } from "./chunk-3VTMSSDW.js";
76
+ } from "./chunk-YWDN5PQC.js";
77
77
  import {
78
78
  SPACE_EM_FIXED,
79
79
  SPACE_EM_FONT,
@@ -83,11 +83,11 @@ import {
83
83
  renderHwpxToSvg,
84
84
  simulateWrap,
85
85
  simulateWrapKeepWord
86
- } from "./chunk-PV2EXXGI.js";
87
- import "./chunk-AFPD74JJ.js";
86
+ } from "./chunk-JEX5P66D.js";
87
+ import "./chunk-7ZIOZ6PU.js";
88
88
  import {
89
89
  VERSION
90
- } from "./chunk-ZYVULRYF.js";
90
+ } from "./chunk-J3W6Q3AX.js";
91
91
  export {
92
92
  BUILTIN_TEMPLATES,
93
93
  DEFAULT_REDACT_RULES,
@@ -161,4 +161,4 @@ export {
161
161
  unknownFontWarnings,
162
162
  validateHwpx
163
163
  };
164
- //# sourceMappingURL=-6XJ6MCQG.js.map
164
+ //# sourceMappingURL=-O42BMYNX.js.map
@@ -4,7 +4,7 @@ import {
4
4
  HEADING_RATIO_H3,
5
5
  safeMax,
6
6
  safeMin
7
- } from "./chunk-YUVKU5CW.js";
7
+ } from "./chunk-IZEUWEEY.js";
8
8
 
9
9
  // src/pdf/image-regions.ts
10
10
  import { OPS } from "pdfjs-dist/legacy/build/pdf.mjs";
@@ -3040,6 +3040,123 @@ function buildGridTable(lines, columns) {
3040
3040
  return md.join("\n");
3041
3041
  }
3042
3042
 
3043
+ // src/pdf/underline.ts
3044
+ var UNDER_MAX_THICKNESS = 2;
3045
+ var UNDER_BELOW_EM = 0.72;
3046
+ var UNDER_BELOW_MIN_PT = 3;
3047
+ var UNDER_ABOVE_PT = 1;
3048
+ var UNDER_MIN_OVERLAP_RATIO = 0.6;
3049
+ var UNDER_OWNER_PAD_EM = 0.75;
3050
+ var UNDER_OWNER_PAD_MIN_PT = 4;
3051
+ var UNDER_MIN_COVERAGE = 0.6;
3052
+ var UNDER_GRID_EPS = 2;
3053
+ var UNDER_COLUMN_GAP_EM = 2;
3054
+ var UNDER_REPEATED_SPAN_LEVELS = 3;
3055
+ var UNDER_SPAN_OVERLAP_RATIO = 0.8;
3056
+ var UNDER_BOX_PAIR_MIN_EM = 0.5;
3057
+ var UNDER_BOX_PAIR_MAX_EM = 2.2;
3058
+ var UNDER_BOX_PAIR_OVERLAP = 0.8;
3059
+ function markUnderlineItems(items, horizontals, verticals) {
3060
+ if (items.length === 0 || horizontals.length === 0) return;
3061
+ for (const line of horizontals) {
3062
+ if (line.lineWidth > UNDER_MAX_THICKNESS) continue;
3063
+ if (touchesVertical(line, verticals)) continue;
3064
+ if (isRepeatedSpanRule(line, horizontals)) continue;
3065
+ const matches = [];
3066
+ for (const item of items) {
3067
+ const h = item.h > 0 ? item.h : item.fontSize;
3068
+ if (h <= 0 || item.w <= 0 || !item.text.trim()) continue;
3069
+ const below = Math.max(h * UNDER_BELOW_EM, UNDER_BELOW_MIN_PT);
3070
+ if (line.y1 < item.y - below || line.y1 > item.y + UNDER_ABOVE_PT) continue;
3071
+ const overlap = Math.min(line.x2, item.x + item.w) - Math.max(line.x1, item.x);
3072
+ if (overlap / item.w < UNDER_MIN_OVERLAP_RATIO) continue;
3073
+ matches.push(item);
3074
+ }
3075
+ if (matches.length === 0) continue;
3076
+ let x1 = Infinity, x2 = -Infinity, maxH = 0, covered = 0;
3077
+ for (const m of matches) {
3078
+ x1 = Math.min(x1, m.x);
3079
+ x2 = Math.max(x2, m.x + m.w);
3080
+ maxH = Math.max(maxH, m.h > 0 ? m.h : m.fontSize);
3081
+ covered += m.w;
3082
+ }
3083
+ const pad = Math.max(maxH * UNDER_OWNER_PAD_EM, UNDER_OWNER_PAD_MIN_PT);
3084
+ if (line.x1 < x1 - pad || line.x2 > x2 + pad) continue;
3085
+ if (covered < (line.x2 - line.x1) * UNDER_MIN_COVERAGE) continue;
3086
+ if (hasBoxTopPair(line, maxH, horizontals)) continue;
3087
+ matches.sort((a, b) => a.x - b.x);
3088
+ let hole = false;
3089
+ for (let i = 1; i < matches.length; i++) {
3090
+ if (matches[i].x - (matches[i - 1].x + matches[i - 1].w) > maxH * UNDER_COLUMN_GAP_EM) {
3091
+ hole = true;
3092
+ break;
3093
+ }
3094
+ }
3095
+ if (hole) continue;
3096
+ for (const m of matches) m.underline = true;
3097
+ }
3098
+ }
3099
+ function touchesVertical(line, verticals) {
3100
+ for (const v of verticals) {
3101
+ if (v.x1 < line.x1 - UNDER_GRID_EPS || v.x1 > line.x2 + UNDER_GRID_EPS) continue;
3102
+ const lo = Math.min(v.y1, v.y2), hi = Math.max(v.y1, v.y2);
3103
+ if (lo <= line.y1 + UNDER_GRID_EPS && hi >= line.y1 - UNDER_GRID_EPS) return true;
3104
+ }
3105
+ return false;
3106
+ }
3107
+ function hasBoxTopPair(line, maxH, horizontals) {
3108
+ const w = line.x2 - line.x1;
3109
+ if (w <= 0) return false;
3110
+ for (const o of horizontals) {
3111
+ if (o === line) continue;
3112
+ const dy = o.y1 - line.y1;
3113
+ if (dy < maxH * UNDER_BOX_PAIR_MIN_EM || dy > maxH * UNDER_BOX_PAIR_MAX_EM) continue;
3114
+ const ow = o.x2 - o.x1;
3115
+ if (ow <= 0) continue;
3116
+ const overlap = Math.min(line.x2, o.x2) - Math.max(line.x1, o.x1);
3117
+ if (overlap / Math.max(w, ow) >= UNDER_BOX_PAIR_OVERLAP) return true;
3118
+ }
3119
+ return false;
3120
+ }
3121
+ function isRepeatedSpanRule(line, horizontals) {
3122
+ const w = line.x2 - line.x1;
3123
+ if (w <= 0) return false;
3124
+ const ys = [];
3125
+ for (const o of horizontals) {
3126
+ const ow = o.x2 - o.x1;
3127
+ if (ow <= 0) continue;
3128
+ const overlap = Math.min(line.x2, o.x2) - Math.max(line.x1, o.x1);
3129
+ if (overlap / Math.max(w, ow) < UNDER_SPAN_OVERLAP_RATIO) continue;
3130
+ if (!ys.some((y) => Math.abs(y - o.y1) < 2)) ys.push(o.y1);
3131
+ }
3132
+ return ys.length >= UNDER_REPEATED_SPAN_LEVELS;
3133
+ }
3134
+ function wrapUnderlineRuns(items) {
3135
+ const marked = items.filter((i) => i.underline);
3136
+ if (marked.length === 0) return;
3137
+ const lines = /* @__PURE__ */ new Map();
3138
+ for (const item of marked) {
3139
+ const key = Math.round(item.y / 3);
3140
+ const arr = lines.get(key) || [];
3141
+ arr.push(item);
3142
+ lines.set(key, arr);
3143
+ }
3144
+ for (const arr of lines.values()) {
3145
+ arr.sort((a, b) => a.x - b.x);
3146
+ let runStart = 0;
3147
+ for (let i = 1; i <= arr.length; i++) {
3148
+ const prev = arr[i - 1];
3149
+ const em = Math.max(prev.h > 0 ? prev.h : prev.fontSize, 1);
3150
+ const gap = i < arr.length ? arr[i].x - (prev.x + prev.w) : Infinity;
3151
+ if (gap > em) {
3152
+ arr[runStart].text = "<u>" + arr[runStart].text;
3153
+ prev.text = prev.text + "</u>";
3154
+ runStart = i;
3155
+ }
3156
+ }
3157
+ }
3158
+ }
3159
+
3043
3160
  // src/pdf/page-blocks.ts
3044
3161
  function extractPageBlocksWithLines(items, pageNum, opList, pageWidth, pageHeight, extraLines, detectTables = true) {
3045
3162
  if (items.length === 0) return [];
@@ -3055,6 +3172,8 @@ function extractPageBlocksWithLines(items, pageNum, opList, pageWidth, pageHeigh
3055
3172
  verticals = bridgeSplitColumnVerticals(horizontals, verticals);
3056
3173
  markStrikethroughItems(items, horizontals);
3057
3174
  wrapStrikethroughRuns(items);
3175
+ markUnderlineItems(items, horizontals, verticals);
3176
+ wrapUnderlineRuns(items);
3058
3177
  const grids = detectTables ? buildTableGrids(horizontals, verticals) : [];
3059
3178
  if (grids.length > 0) {
3060
3179
  return extractBlocksWithGrids(items, pageNum, grids, horizontals, verticals);
@@ -3565,4 +3684,4 @@ export {
3565
3684
  extractPageBlocksWithLines,
3566
3685
  mergeCrossPageTables
3567
3686
  };
3568
- //# sourceMappingURL=chunk-B2OQOTRT.js.map
3687
+ //# sourceMappingURL=chunk-3UIT4PPQ.js.map