kindy-editor 3.2.6 → 3.2.7
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/dist-lib/assets/{worker-B7ALyZOw.js → worker-DjZBUOhB.js} +1009 -997
- package/dist-lib/assets/{worker-z-dyEi8F.js → worker-pUzyeoiR.js} +2 -4
- package/dist-lib/builder.js +4 -4
- package/dist-lib/{changeAggregator-ZI959nPP.js → changeAggregator-DEuynIcV.js} +1 -1
- package/dist-lib/{editorApp-Bu3dbUIU.js → editorApp-BtDzRfJq.js} +6070 -5955
- package/dist-lib/events.js +2 -2
- package/dist-lib/export.js +7 -9
- package/dist-lib/generate-toc.js +3 -3
- package/dist-lib/import.js +2 -2
- package/dist-lib/{kindy-editor-CToKn_gP.js → kindy-editor---oVGhZU.js} +32 -13
- package/dist-lib/kindy-editor.js +2 -2
- package/dist-lib/{parse-CKw-ZDr9.js → parse-CpGoMQ_v.js} +3 -3
- package/dist-lib/{pipeline-BkC7G8gU.js → pipeline-CCwWMjhw.js} +850 -837
- package/dist-lib/{qrcode-efBlPzzh.js → qrcode-B-JKix2T.js} +5 -5
- package/dist-lib/{qrcode-oNwKusWD.js → qrcode-BCaJLV1G.js} +1 -1
- package/dist-lib/recalc-docx.js +1 -1
- package/dist-lib/{recalcToc-Bc8V9Ecn.js → recalcToc-CaiTn2IJ.js} +1 -1
- package/dist-lib/{stylesheet-BT1DGhnx.js → stylesheet-BPIJJMlK.js} +1 -1
- package/dist-lib/{webmcp-ClHEa6Gq.js → webmcp-B0swfp0T.js} +2 -2
- package/docs/find-and-replace.md +224 -0
- package/docs/security-review.md +26 -0
- package/docs/table-editing.md +3 -1
- package/docs/table-form-integration.md +4 -0
- package/package.json +6 -6
- package/types/import.d.ts +7 -0
- package/types/kindy-editor.d.ts +26 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
const
|
|
2
|
-
function
|
|
1
|
+
const un = (t) => t.map((e) => e.text).join("");
|
|
2
|
+
function hn(t = {}) {
|
|
3
3
|
return {
|
|
4
4
|
fontFamily: t.fontFamily ?? "Georgia, serif",
|
|
5
5
|
fontSizePx: t.fontSizePx ?? 16,
|
|
@@ -10,7 +10,7 @@ function un(t = {}) {
|
|
|
10
10
|
color: t.color ?? "#202124"
|
|
11
11
|
};
|
|
12
12
|
}
|
|
13
|
-
function
|
|
13
|
+
function pn(t = {}) {
|
|
14
14
|
return {
|
|
15
15
|
align: "left",
|
|
16
16
|
lineHeight: t.lineHeight ?? 1.5,
|
|
@@ -20,39 +20,39 @@ function hn(t = {}) {
|
|
|
20
20
|
indentLeftPx: 0
|
|
21
21
|
};
|
|
22
22
|
}
|
|
23
|
-
const pe =
|
|
24
|
-
|
|
25
|
-
function
|
|
23
|
+
const pe = hn();
|
|
24
|
+
pn();
|
|
25
|
+
function mn(t, e) {
|
|
26
26
|
const n = t?.length ?? 0, o = e?.length ?? 0;
|
|
27
27
|
if (n !== o) return !1;
|
|
28
28
|
for (let i = 0; i < n; i++) if (t[i] !== e[i]) return !1;
|
|
29
29
|
return !0;
|
|
30
30
|
}
|
|
31
|
-
function
|
|
31
|
+
function gn(t, e) {
|
|
32
32
|
return !t || !e ? !t == !e : t.font === e.font && t.char === e.char;
|
|
33
33
|
}
|
|
34
|
-
function
|
|
34
|
+
function wn(t, e) {
|
|
35
35
|
return t.fontFamily === e.fontFamily && t.fontFamilyComplexScript === e.fontFamilyComplexScript && t.fontFamilyEastAsia === e.fontFamilyEastAsia && t.fontSizePx === e.fontSizePx && t.bold === e.bold && t.italic === e.italic && t.underline === e.underline && t.underlineStyle === e.underlineStyle && t.underlineColor === e.underlineColor && t.strikethrough === e.strikethrough && t.color === e.color && !!t.hidden == !!e.hidden && // hidden runs must never merge with visible ones
|
|
36
36
|
(t.letterSpacingPx ?? 0) === (e.letterSpacingPx ?? 0) && t.highlightColor === e.highlightColor && t.verticalAlign === e.verticalAlign && !!t.caps == !!e.caps && // case transforms change the rendered glyphs — never merge across
|
|
37
37
|
!!t.smallCaps == !!e.smallCaps && t.link === e.link && t.footnoteRef === e.footnoteRef && // adjacent refs must never merge into one run
|
|
38
|
-
|
|
38
|
+
mn(t.sdtPath, e.sdtPath) && // content-control boundaries (incl. nesting) survive normalization
|
|
39
39
|
t.fieldId === e.fieldId && // inline-field boundaries survive normalization
|
|
40
40
|
t.variableKey === e.variableKey && // template variable boundaries survive normalization
|
|
41
41
|
t.equation === e.equation && // inline equations are atomic — never merge (reference identity)
|
|
42
42
|
// Minor run typography & effects (w:rPr extras) — compared so styled runs never
|
|
43
43
|
// merge with plain ones (and a struck-through pair keeps its boundary).
|
|
44
|
-
!!t.doubleStrikethrough == !!e.doubleStrikethrough && (t.positionPx ?? 0) === (e.positionPx ?? 0) && (t.kerningMinPx ?? 0) === (e.kerningMinPx ?? 0) && (t.widthScalePct ?? 100) === (e.widthScalePct ?? 100) && t.emphasisMark === e.emphasisMark && !!t.outline == !!e.outline && !!t.shadow == !!e.shadow && !!t.emboss == !!e.emboss && !!t.imprint == !!e.imprint && (t.fitTextPx ?? 0) === (e.fitTextPx ?? 0) &&
|
|
44
|
+
!!t.doubleStrikethrough == !!e.doubleStrikethrough && (t.positionPx ?? 0) === (e.positionPx ?? 0) && (t.kerningMinPx ?? 0) === (e.kerningMinPx ?? 0) && (t.widthScalePct ?? 100) === (e.widthScalePct ?? 100) && t.emphasisMark === e.emphasisMark && !!t.outline == !!e.outline && !!t.shadow == !!e.shadow && !!t.emboss == !!e.emboss && !!t.imprint == !!e.imprint && (t.fitTextPx ?? 0) === (e.fitTextPx ?? 0) && vn(t.runBorder, e.runBorder) && gn(t.symbol, e.symbol);
|
|
45
45
|
}
|
|
46
|
-
function
|
|
46
|
+
function vn(t, e) {
|
|
47
47
|
return t === e ? !0 : !t || !e ? !1 : t.color === e.color && t.widthPx === e.widthPx && t.style === e.style;
|
|
48
48
|
}
|
|
49
|
-
function
|
|
49
|
+
function kn(t, e) {
|
|
50
50
|
const n = t.filter((i) => i.text.length > 0);
|
|
51
51
|
if (n.length === 0) return [{ text: "", style: t[0]?.style ?? e }];
|
|
52
52
|
const o = [{ ...n[0] }];
|
|
53
53
|
for (let i = 1; i < n.length; i++) {
|
|
54
54
|
const r = n[i], s = o[o.length - 1];
|
|
55
|
-
|
|
55
|
+
wn(s.style, r.style) ? s.text += r.text : o.push({ ...r });
|
|
56
56
|
}
|
|
57
57
|
return o;
|
|
58
58
|
}
|
|
@@ -65,14 +65,14 @@ function Te(t, e) {
|
|
|
65
65
|
}
|
|
66
66
|
return [n, o];
|
|
67
67
|
}
|
|
68
|
-
function
|
|
68
|
+
function bn(t, e, n) {
|
|
69
69
|
const [, o] = Te(t, e), [i] = Te(o, n - e);
|
|
70
70
|
return i;
|
|
71
71
|
}
|
|
72
72
|
function je() {
|
|
73
73
|
return { type: "row", children: [] };
|
|
74
74
|
}
|
|
75
|
-
function
|
|
75
|
+
function yn(t, e = 0) {
|
|
76
76
|
let n = e;
|
|
77
77
|
return {
|
|
78
78
|
siteId: t,
|
|
@@ -80,29 +80,29 @@ function bn(t, e = 0) {
|
|
|
80
80
|
count: () => n
|
|
81
81
|
};
|
|
82
82
|
}
|
|
83
|
-
let
|
|
83
|
+
let Tn = yn("local");
|
|
84
84
|
function We() {
|
|
85
|
-
return
|
|
85
|
+
return Tn.next();
|
|
86
86
|
}
|
|
87
|
-
function
|
|
87
|
+
function Sn(t, e = 20) {
|
|
88
88
|
if (!t.bookmarks) return 0;
|
|
89
89
|
const n = t.section.pageWidthPx - t.section.marginPx.left - t.section.marginPx.right;
|
|
90
90
|
let o = 0;
|
|
91
91
|
for (const i of t.blocks) {
|
|
92
92
|
if (i.kind !== "paragraph" || i.style.tocEntry) continue;
|
|
93
|
-
const r = i.runs.find((
|
|
93
|
+
const r = i.runs.find((d) => d.style.link?.startsWith("#"))?.style.link?.slice(1);
|
|
94
94
|
if (!r) continue;
|
|
95
95
|
const s = t.bookmarks[r]?.start.blockId;
|
|
96
96
|
if (!s) continue;
|
|
97
|
-
const a =
|
|
98
|
-
if (!
|
|
99
|
-
i.runs =
|
|
97
|
+
const a = un(i.runs), c = a.match(/\t\d+\s*$/);
|
|
98
|
+
if (!c) continue;
|
|
99
|
+
i.runs = bn(i.runs, 0, a.length - c[0].length), i.runs.length === 0 && (i.runs = [{ text: "", style: { ...Pn } }]);
|
|
100
100
|
const h = Math.min(9, Math.max(1, Math.round((i.style.indentLeftPx || 0) / e) + 1));
|
|
101
101
|
i.style.tocEntry = { targetId: s, level: h }, !i.style.tabStops?.length && n > 0 && (i.style.tabStops = [{ posPx: n, align: "right", leader: "dot" }]), i.revision++, o++;
|
|
102
102
|
}
|
|
103
103
|
return o;
|
|
104
104
|
}
|
|
105
|
-
const
|
|
105
|
+
const Pn = { ...pe, fontSizePx: 13 }, xn = /* @__PURE__ */ new Set([
|
|
106
106
|
"TOC",
|
|
107
107
|
"PAGE",
|
|
108
108
|
"NUMPAGES",
|
|
@@ -163,24 +163,24 @@ const Sn = { ...pe, fontSizePx: 13 }, Pn = /* @__PURE__ */ new Set([
|
|
|
163
163
|
"LINK",
|
|
164
164
|
"NOTEREF"
|
|
165
165
|
]);
|
|
166
|
-
function xn(t) {
|
|
167
|
-
return Pn.has(t.trim().toUpperCase());
|
|
168
|
-
}
|
|
169
166
|
function An(t) {
|
|
167
|
+
return xn.has(t.trim().toUpperCase());
|
|
168
|
+
}
|
|
169
|
+
function In(t) {
|
|
170
170
|
const e = [], n = /"([^"]*)"|(\S+)/g;
|
|
171
171
|
let o;
|
|
172
172
|
for (; (o = n.exec(t)) !== null; ) e.push(o[1] !== void 0 ? o[1] : o[2]);
|
|
173
173
|
return e;
|
|
174
174
|
}
|
|
175
175
|
function ke(t) {
|
|
176
|
-
const e =
|
|
176
|
+
const e = In(t);
|
|
177
177
|
return { name: e.length > 0 ? e[0].toUpperCase() : "", args: e.slice(1), raw: t };
|
|
178
178
|
}
|
|
179
179
|
function Cn(t) {
|
|
180
180
|
const e = ke(t).name;
|
|
181
|
-
return e.length > 0 && !
|
|
181
|
+
return e.length > 0 && !An(e);
|
|
182
182
|
}
|
|
183
|
-
const
|
|
183
|
+
const En = /* @__PURE__ */ new Set(["=", "<>", "<", ">", "<=", ">="]);
|
|
184
184
|
function Se(t) {
|
|
185
185
|
if (/\\\*\s*ROMAN\b/.test(t)) return "Roman";
|
|
186
186
|
if (/\\\*\s*roman\b/.test(t)) return "roman";
|
|
@@ -190,7 +190,7 @@ function Se(t) {
|
|
|
190
190
|
function Pe(t) {
|
|
191
191
|
return t.match(/\\@\s*"([^"]*)"/)?.[1] ?? t.match(/\\@\s*(\S+)/)?.[1];
|
|
192
192
|
}
|
|
193
|
-
function
|
|
193
|
+
function Mn(t, e) {
|
|
194
194
|
switch (t.name) {
|
|
195
195
|
case "PAGE": {
|
|
196
196
|
const n = Se(t.raw);
|
|
@@ -206,7 +206,7 @@ function En(t, e) {
|
|
|
206
206
|
return { type: "TIME", format: Pe(t.raw) ?? "h:mm AM/PM" };
|
|
207
207
|
case "IF": {
|
|
208
208
|
const [n, o, i, r, s] = t.args;
|
|
209
|
-
return n === void 0 || o === void 0 || i === void 0 || !
|
|
209
|
+
return n === void 0 || o === void 0 || i === void 0 || !En.has(o) ? void 0 : {
|
|
210
210
|
type: "IF",
|
|
211
211
|
operandA: n,
|
|
212
212
|
op: o,
|
|
@@ -258,14 +258,14 @@ function ae(t) {
|
|
|
258
258
|
return e;
|
|
259
259
|
});
|
|
260
260
|
}
|
|
261
|
-
function
|
|
262
|
-
var n = (e = e || {}).pos || 0, o = !!e.keepComments, i = !!e.keepWhitespace, r = !!e.decodeEntities, s = !!e.skipXmlDeclaration, a = 60,
|
|
261
|
+
function $e(t, e) {
|
|
262
|
+
var n = (e = e || {}).pos || 0, o = !!e.keepComments, i = !!e.keepWhitespace, r = !!e.decodeEntities, s = !!e.skipXmlDeclaration, a = 60, c = 62, h = 45, d = 47, l = 63, u = 33, g = 39, k = 34, S = 61, y = 91, N = 93, P = 63;
|
|
263
263
|
function z(A) {
|
|
264
264
|
return typeof A == "string" && A.toLowerCase() === "?xml";
|
|
265
265
|
}
|
|
266
|
-
function
|
|
267
|
-
for (var
|
|
268
|
-
if (t.charCodeAt(n + 1) ===
|
|
266
|
+
function D(A) {
|
|
267
|
+
for (var C = []; t[n]; ) if (t.charCodeAt(n) == a) {
|
|
268
|
+
if (t.charCodeAt(n + 1) === d) {
|
|
269
269
|
var tt = n + 2;
|
|
270
270
|
if (n = t.indexOf(">", n), t.substring(tt, n).indexOf(A) == -1) {
|
|
271
271
|
var Q = t.substring(0, n).split(`
|
|
@@ -275,48 +275,48 @@ Line: ` + (Q.length - 1) + `
|
|
|
275
275
|
Column: ` + (Q[Q.length - 1].length + 1) + `
|
|
276
276
|
Char: ` + t[n]);
|
|
277
277
|
}
|
|
278
|
-
return n + 1 && (n += 1),
|
|
278
|
+
return n + 1 && (n += 1), C;
|
|
279
279
|
}
|
|
280
|
-
if (t.charCodeAt(n + 1) ===
|
|
280
|
+
if (t.charCodeAt(n + 1) === u) {
|
|
281
281
|
if (t.charCodeAt(n + 2) == h) {
|
|
282
282
|
const rt = n;
|
|
283
|
-
for (; n !== -1 && (t.charCodeAt(n) !==
|
|
284
|
-
n === -1 && (n = t.length), o &&
|
|
283
|
+
for (; n !== -1 && (t.charCodeAt(n) !== c || t.charCodeAt(n - 1) != h || t.charCodeAt(n - 2) != h || n == -1); ) n = t.indexOf(">", n + 1);
|
|
284
|
+
n === -1 && (n = t.length), o && C.push(t.substring(rt, n + 1));
|
|
285
285
|
} else {
|
|
286
286
|
if (t.charCodeAt(n + 2) === y && t.charCodeAt(n + 8) === y && t.substr(n + 3, 5).toLowerCase() === "cdata") {
|
|
287
287
|
var ot = t.indexOf("]]>", n);
|
|
288
|
-
ot == -1 ? (
|
|
288
|
+
ot == -1 ? (C.push(t.substr(n + 9)), n = t.length) : (C.push(t.substring(n + 9, ot)), n = ot + 3);
|
|
289
289
|
continue;
|
|
290
290
|
}
|
|
291
291
|
{
|
|
292
292
|
const rt = n + 1;
|
|
293
293
|
n += 2;
|
|
294
|
-
for (var it = !1; (t.charCodeAt(n) !==
|
|
295
|
-
|
|
294
|
+
for (var it = !1; (t.charCodeAt(n) !== c || it === !0) && t[n]; ) t.charCodeAt(n) === y ? it = !0 : it === !0 && t.charCodeAt(n) === N && (it = !1), n++;
|
|
295
|
+
C.push(t.substring(rt, n));
|
|
296
296
|
}
|
|
297
297
|
}
|
|
298
298
|
n++;
|
|
299
299
|
continue;
|
|
300
300
|
}
|
|
301
|
-
var U =
|
|
301
|
+
var U = _();
|
|
302
302
|
if (s && z(U.tagName)) continue;
|
|
303
|
-
|
|
303
|
+
C.push(U);
|
|
304
304
|
} else {
|
|
305
305
|
var et = nt();
|
|
306
|
-
if (i) et.length > 0 &&
|
|
306
|
+
if (i) et.length > 0 && C.push(et);
|
|
307
307
|
else {
|
|
308
308
|
var G = et.trim();
|
|
309
|
-
G.length > 0 &&
|
|
309
|
+
G.length > 0 && C.push(G);
|
|
310
310
|
}
|
|
311
311
|
n++;
|
|
312
312
|
}
|
|
313
|
-
return
|
|
313
|
+
return C;
|
|
314
314
|
}
|
|
315
315
|
function nt() {
|
|
316
316
|
var A = n;
|
|
317
317
|
(n = t.indexOf("<", n) - 1) === -2 && (n = t.length);
|
|
318
|
-
var
|
|
319
|
-
return r ? ae(
|
|
318
|
+
var C = t.slice(A, n + 1);
|
|
319
|
+
return r ? ae(C) : C;
|
|
320
320
|
}
|
|
321
321
|
var lt = `\r
|
|
322
322
|
>/= `;
|
|
@@ -325,11 +325,11 @@ Char: ` + t[n]);
|
|
|
325
325
|
return t.slice(A, n);
|
|
326
326
|
}
|
|
327
327
|
var E, R = e.selfClosingTags || e.noChildNodes || ["img", "br", "input", "meta", "link", "hr"];
|
|
328
|
-
function
|
|
328
|
+
function _() {
|
|
329
329
|
n++;
|
|
330
|
-
const A = Z(),
|
|
330
|
+
const A = Z(), C = A[0] === "?", tt = n, Q = {};
|
|
331
331
|
let ot = [];
|
|
332
|
-
for (; t[n] && t.charCodeAt(n) !==
|
|
332
|
+
for (; t[n] && t.charCodeAt(n) !== c && (!C || t.charCodeAt(n) !== l || t.charCodeAt(n + 1) !== c); ) {
|
|
333
333
|
var it = t.charCodeAt(n);
|
|
334
334
|
if (it > 64 && it < 91 || it > 96 && it < 123) {
|
|
335
335
|
for (var U = Z(), et = null; t.charCodeAt(n) === 32 || t.charCodeAt(n) === 9 || t.charCodeAt(n) === 10 || t.charCodeAt(n) === 13; ) n++;
|
|
@@ -337,8 +337,8 @@ Char: ` + t[n]);
|
|
|
337
337
|
for (n++; t.charCodeAt(n) === 32 || t.charCodeAt(n) === 9 || t.charCodeAt(n) === 10 || t.charCodeAt(n) === 13; ) n++;
|
|
338
338
|
var G = t.charCodeAt(n);
|
|
339
339
|
if (G === g || G === k) {
|
|
340
|
-
if (et =
|
|
341
|
-
} else if (G && G !==
|
|
340
|
+
if (et = j(), n === -1) return { tagName: A, attributes: Q, children: ot };
|
|
341
|
+
} else if (G && G !== c) {
|
|
342
342
|
for (var rt = n; t[n] && lt.indexOf(t[n]) === -1; ) n++;
|
|
343
343
|
et = t.slice(rt, n), r && (et = ae(et));
|
|
344
344
|
}
|
|
@@ -346,35 +346,35 @@ Char: ` + t[n]);
|
|
|
346
346
|
Q[U] = et;
|
|
347
347
|
} else n++;
|
|
348
348
|
}
|
|
349
|
-
if (
|
|
350
|
-
var
|
|
351
|
-
return
|
|
349
|
+
if (C) {
|
|
350
|
+
var f = t.slice(tt, n).trim();
|
|
351
|
+
return f.length > 0 && Object.keys(Q).length === 0 && (ot = [f]), t.charCodeAt(n) === l && t.charCodeAt(n + 1) === c ? n += 2 : t.charCodeAt(n) === c && (n += 1), { tagName: A, attributes: Q, children: ot };
|
|
352
352
|
}
|
|
353
|
-
if (t.charCodeAt(n - 1) !==
|
|
353
|
+
if (t.charCodeAt(n - 1) !== d && t.charCodeAt(n - 1) !== P) if (A == "script") {
|
|
354
354
|
var w = n + 1;
|
|
355
355
|
n = t.indexOf("<\/script>", n), ot = [t.slice(w, n)], n += 9;
|
|
356
|
-
} else A == "style" ? (w = n + 1, n = t.indexOf("</style>", n), ot = [t.slice(w, n)], n += 8) : R.indexOf(A) === -1 ? (n++, ot =
|
|
356
|
+
} else A == "style" ? (w = n + 1, n = t.indexOf("</style>", n), ot = [t.slice(w, n)], n += 8) : R.indexOf(A) === -1 ? (n++, ot = D(A)) : n++;
|
|
357
357
|
else n++;
|
|
358
358
|
return { tagName: A, attributes: Q, children: ot };
|
|
359
359
|
}
|
|
360
|
-
function
|
|
361
|
-
var A = t[n],
|
|
362
|
-
n = t.indexOf(A,
|
|
363
|
-
var tt = t.slice(
|
|
360
|
+
function j() {
|
|
361
|
+
var A = t[n], C = n + 1;
|
|
362
|
+
n = t.indexOf(A, C);
|
|
363
|
+
var tt = t.slice(C, n);
|
|
364
364
|
return r ? ae(tt) : tt;
|
|
365
365
|
}
|
|
366
|
-
function
|
|
366
|
+
function F() {
|
|
367
367
|
if (!e || !e.attrName || !e.attrValue) return -1;
|
|
368
368
|
var A = new RegExp("\\s" + e.attrName + `\\s*=['"]` + e.attrValue + `['"]`).exec(t);
|
|
369
369
|
return A ? A.index : -1;
|
|
370
370
|
}
|
|
371
|
-
if (e.attrValue !== void 0) for (e.attrName = e.attrName || "id", E = []; (n =
|
|
372
|
-
else if (e.parseNode) for (E =
|
|
373
|
-
else E =
|
|
374
|
-
return e.filter && Array.isArray(E) && (E =
|
|
371
|
+
if (e.attrValue !== void 0) for (e.attrName = e.attrName || "id", E = []; (n = F()) !== -1; ) (n = t.lastIndexOf("<", n)) !== -1 && E.push(_()), t = t.substr(n), n = 0;
|
|
372
|
+
else if (e.parseNode) for (E = _(); s && typeof E == "object" && E && z(E.tagName); ) E = _();
|
|
373
|
+
else E = D("");
|
|
374
|
+
return e.filter && Array.isArray(E) && (E = Ue(E, e.filter)), e.simplify ? me(Array.isArray(E) ? E : [E]) : (e.setPos && typeof E == "object" && !Array.isArray(E) && (E.pos = n), E);
|
|
375
375
|
}
|
|
376
376
|
function me(t) {
|
|
377
|
-
if (typeof t == "string") return me(
|
|
377
|
+
if (typeof t == "string") return me($e(t));
|
|
378
378
|
if (!Array.isArray(t)) throw new TypeError("simplify() expects parsed node array or XML string");
|
|
379
379
|
var e = {};
|
|
380
380
|
if (!t.length) return "";
|
|
@@ -388,62 +388,62 @@ function me(t) {
|
|
|
388
388
|
}), e) e[n].length == 1 && (e[n] = e[n][0]);
|
|
389
389
|
return e;
|
|
390
390
|
}
|
|
391
|
-
function
|
|
391
|
+
function Ue(t, e, n = 0, o = "") {
|
|
392
392
|
var i = [];
|
|
393
393
|
return t.forEach(function(r, s) {
|
|
394
394
|
if (typeof r == "object" && e(r, s, n, o) && i.push(r), typeof r == "object" && r.children) {
|
|
395
|
-
var a =
|
|
395
|
+
var a = Ue(r.children, e, n + 1, (o ? o + "." : "") + s + "." + r.tagName);
|
|
396
396
|
i = i.concat(a);
|
|
397
397
|
}
|
|
398
398
|
}), i;
|
|
399
399
|
}
|
|
400
|
-
function
|
|
400
|
+
function Ht(t) {
|
|
401
401
|
return typeof t == "object" && t !== null && "tagName" in t;
|
|
402
402
|
}
|
|
403
|
-
class
|
|
403
|
+
class kt extends Error {
|
|
404
404
|
code;
|
|
405
405
|
constructor(e, n) {
|
|
406
406
|
super(n), this.name = "ImportError", this.code = e;
|
|
407
407
|
}
|
|
408
408
|
}
|
|
409
|
-
class
|
|
409
|
+
class Rn {
|
|
410
410
|
list = [];
|
|
411
411
|
seen = /* @__PURE__ */ new Set();
|
|
412
412
|
add(e, n) {
|
|
413
413
|
this.seen.has(e) || (this.seen.add(e), this.list.push({ code: e, message: n }));
|
|
414
414
|
}
|
|
415
415
|
}
|
|
416
|
-
function
|
|
416
|
+
function Pt(t, e) {
|
|
417
417
|
try {
|
|
418
|
-
return
|
|
418
|
+
return $e(t, { keepWhitespace: !0, decodeEntities: !0 }).filter(Ht);
|
|
419
419
|
} catch (n) {
|
|
420
|
-
throw new
|
|
420
|
+
throw new kt(
|
|
421
421
|
"MALFORMED_XML",
|
|
422
422
|
`Failed to parse ${e}: ${n instanceof Error ? n.message : String(n)}`
|
|
423
423
|
);
|
|
424
424
|
}
|
|
425
425
|
}
|
|
426
|
-
function
|
|
426
|
+
function bt(t, e) {
|
|
427
427
|
return t.find((n) => n.tagName === e);
|
|
428
428
|
}
|
|
429
429
|
function dt(t) {
|
|
430
|
-
return t.children.filter(
|
|
430
|
+
return t.children.filter(Ht);
|
|
431
431
|
}
|
|
432
432
|
function p(t, e) {
|
|
433
|
-
return t.children.find((n) =>
|
|
433
|
+
return t.children.find((n) => Ht(n) && n.tagName === e);
|
|
434
434
|
}
|
|
435
435
|
function mt(t, e) {
|
|
436
|
-
return t.children.filter((n) =>
|
|
436
|
+
return t.children.filter((n) => Ht(n) && n.tagName === e);
|
|
437
437
|
}
|
|
438
438
|
function m(t, e) {
|
|
439
439
|
const n = t.attributes[e];
|
|
440
440
|
return n === void 0 ? void 0 : n ?? "";
|
|
441
441
|
}
|
|
442
|
-
function
|
|
442
|
+
function Bt(t, e) {
|
|
443
443
|
for (const n of t.children) {
|
|
444
|
-
if (!
|
|
444
|
+
if (!Ht(n)) continue;
|
|
445
445
|
if (n.tagName === e) return n;
|
|
446
|
-
const o =
|
|
446
|
+
const o = Bt(n, e);
|
|
447
447
|
if (o) return o;
|
|
448
448
|
}
|
|
449
449
|
}
|
|
@@ -468,12 +468,12 @@ function T(t, e) {
|
|
|
468
468
|
const o = Number(n);
|
|
469
469
|
return Number.isFinite(o) ? o : void 0;
|
|
470
470
|
}
|
|
471
|
-
const $ = (t) => t / 15, Qt = (t) => t * 2 / 3, Vt = (t) => t / 9525,
|
|
471
|
+
const $ = (t) => t / 15, Qt = (t) => t * 2 / 3, Vt = (t) => t / 9525, Nn = (t) => t / 240, M = (t) => Math.round(t * 100) / 100, Xt = (t) => Math.round(t * 1e4) / 1e4, Yt = (t) => ({
|
|
472
472
|
top: M($(t.top)),
|
|
473
473
|
right: M($(t.right)),
|
|
474
474
|
bottom: M($(t.bottom)),
|
|
475
475
|
left: M($(t.left))
|
|
476
|
-
}),
|
|
476
|
+
}), Bn = [
|
|
477
477
|
["top", "w:top"],
|
|
478
478
|
["left", "w:left"],
|
|
479
479
|
["bottom", "w:bottom"],
|
|
@@ -484,7 +484,7 @@ const $ = (t) => t / 15, Qt = (t) => t * 2 / 3, Vt = (t) => t / 9525, Rn = (t) =
|
|
|
484
484
|
function ie(t) {
|
|
485
485
|
if (!t) return;
|
|
486
486
|
const e = {};
|
|
487
|
-
for (const [n, o] of
|
|
487
|
+
for (const [n, o] of Bn) {
|
|
488
488
|
const i = p(t, o);
|
|
489
489
|
if (!i) continue;
|
|
490
490
|
const r = { val: m(i, "w:val") ?? "single" }, s = T(i, "w:sz");
|
|
@@ -505,11 +505,11 @@ function Ut(t) {
|
|
|
505
505
|
function Fn(t, e) {
|
|
506
506
|
return t ? e ? { ...t, ...e } : t : e;
|
|
507
507
|
}
|
|
508
|
-
function
|
|
509
|
-
const n = (
|
|
508
|
+
function Ln(t, e) {
|
|
509
|
+
const n = (c, h, d) => (
|
|
510
510
|
// Cell edges are named directly; the table/style layers use the named edge
|
|
511
511
|
// on the boundary and the inside edge between cells.
|
|
512
|
-
t.cell?.[
|
|
512
|
+
t.cell?.[c] ?? t.table?.[d ? c : h] ?? t.style?.[d ? c : h]
|
|
513
513
|
), o = {}, i = pt(n("top", "insideH", e.top));
|
|
514
514
|
i && (o.top = i);
|
|
515
515
|
const r = pt(n("bottom", "insideH", e.bottom));
|
|
@@ -519,7 +519,7 @@ function Bn(t, e) {
|
|
|
519
519
|
const a = pt(n("right", "insideV", e.right));
|
|
520
520
|
return a && (o.right = a), o;
|
|
521
521
|
}
|
|
522
|
-
function
|
|
522
|
+
function On(t) {
|
|
523
523
|
if (!t) return;
|
|
524
524
|
const e = {}, n = pt(t.top);
|
|
525
525
|
n && (e.top = n);
|
|
@@ -530,7 +530,7 @@ function Ln(t) {
|
|
|
530
530
|
const r = pt(t.left);
|
|
531
531
|
return r && (e.left = r), Object.keys(e).length > 0 ? e : void 0;
|
|
532
532
|
}
|
|
533
|
-
function
|
|
533
|
+
function Dn(t) {
|
|
534
534
|
if (!t) return;
|
|
535
535
|
const e = {}, n = pt(t.top);
|
|
536
536
|
n && (e.top = n);
|
|
@@ -545,7 +545,7 @@ function On(t) {
|
|
|
545
545
|
const a = pt(t.insideV);
|
|
546
546
|
return a && (e.insideV = a), Object.keys(e).length > 0 ? e : void 0;
|
|
547
547
|
}
|
|
548
|
-
function
|
|
548
|
+
function Ge(t) {
|
|
549
549
|
if (!t) return;
|
|
550
550
|
const e = {}, n = pt(t.top);
|
|
551
551
|
n && (e.top = n);
|
|
@@ -563,10 +563,10 @@ function Hn(t) {
|
|
|
563
563
|
}
|
|
564
564
|
function pt(t) {
|
|
565
565
|
if (!t || t.val === "nil" || t.val === "none") return;
|
|
566
|
-
const e = M(Math.max(0.5, (t.sizeEighthPt ?? 4) / 6)), o = { color: !t.color || t.color === "auto" ? "#000000" : `#${t.color.toLowerCase()}`, widthPx: e }, i =
|
|
566
|
+
const e = M(Math.max(0.5, (t.sizeEighthPt ?? 4) / 6)), o = { color: !t.color || t.color === "auto" ? "#000000" : `#${t.color.toLowerCase()}`, widthPx: e }, i = zn(t.val);
|
|
567
567
|
return i !== "single" && (o.style = i), o;
|
|
568
568
|
}
|
|
569
|
-
function
|
|
569
|
+
function zn(t) {
|
|
570
570
|
return t === "double" ? "double" : /dash/i.test(t) ? "dashed" : /dot/i.test(t) ? "dotted" : "single";
|
|
571
571
|
}
|
|
572
572
|
function Rt(t) {
|
|
@@ -580,51 +580,51 @@ function Rt(t) {
|
|
|
580
580
|
r !== void 0 && (e.strikethrough = r);
|
|
581
581
|
const s = p(t, "w:u");
|
|
582
582
|
if (s) {
|
|
583
|
-
const
|
|
584
|
-
e.underline =
|
|
583
|
+
const F = m(s, "w:val");
|
|
584
|
+
e.underline = F !== "none", e.underline && F && F !== "single" && (e.underlineStyle = F);
|
|
585
585
|
const A = m(s, "w:color");
|
|
586
586
|
A && (e.underlineColor = A);
|
|
587
|
-
const
|
|
588
|
-
|
|
587
|
+
const C = m(s, "w:themeColor");
|
|
588
|
+
C && (e.underlineColorTheme = C);
|
|
589
589
|
}
|
|
590
590
|
const a = p(t, "w:color");
|
|
591
591
|
if (a) {
|
|
592
|
-
const
|
|
593
|
-
|
|
592
|
+
const F = m(a, "w:val");
|
|
593
|
+
F && (e.color = F);
|
|
594
594
|
const A = m(a, "w:themeColor");
|
|
595
595
|
A && (e.colorTheme = A);
|
|
596
|
-
const
|
|
597
|
-
|
|
596
|
+
const C = m(a, "w:themeTint");
|
|
597
|
+
C && (e.colorThemeTint = C);
|
|
598
598
|
const tt = m(a, "w:themeShade");
|
|
599
599
|
tt && (e.colorThemeShade = tt);
|
|
600
600
|
}
|
|
601
|
-
const
|
|
602
|
-
|
|
601
|
+
const c = T(p(t, "w:sz"), "w:val");
|
|
602
|
+
c !== void 0 && (e.sizeHalfPoints = c);
|
|
603
603
|
const h = T(p(t, "w:spacing"), "w:val");
|
|
604
604
|
h !== void 0 && (e.letterSpacingTwips = h);
|
|
605
|
-
const
|
|
606
|
-
if (
|
|
607
|
-
const
|
|
608
|
-
|
|
609
|
-
const A = m(
|
|
605
|
+
const d = p(t, "w:rFonts");
|
|
606
|
+
if (d) {
|
|
607
|
+
const F = m(d, "w:ascii");
|
|
608
|
+
F && (e.fontAscii = F);
|
|
609
|
+
const A = m(d, "w:asciiTheme");
|
|
610
610
|
A && (e.fontThemeAscii = A);
|
|
611
|
-
const
|
|
612
|
-
|
|
613
|
-
const tt = m(
|
|
611
|
+
const C = m(d, "w:hAnsi");
|
|
612
|
+
C && (e.fontHAnsi = C);
|
|
613
|
+
const tt = m(d, "w:hAnsiTheme");
|
|
614
614
|
tt && (e.fontThemeHAnsi = tt);
|
|
615
|
-
const Q = m(
|
|
615
|
+
const Q = m(d, "w:cs");
|
|
616
616
|
Q && (e.fontCs = Q);
|
|
617
|
-
const ot = m(
|
|
617
|
+
const ot = m(d, "w:cstheme");
|
|
618
618
|
ot && (e.fontThemeCs = ot);
|
|
619
|
-
const it = m(
|
|
619
|
+
const it = m(d, "w:eastAsia");
|
|
620
620
|
it && (e.fontEastAsia = it);
|
|
621
|
-
const U = m(
|
|
621
|
+
const U = m(d, "w:eastAsiaTheme");
|
|
622
622
|
U && (e.fontThemeEastAsia = U);
|
|
623
623
|
}
|
|
624
|
-
const
|
|
625
|
-
|
|
626
|
-
const
|
|
627
|
-
|
|
624
|
+
const l = ht(t, "w:highlight");
|
|
625
|
+
l && l !== "none" && (e.highlight = l);
|
|
626
|
+
const u = ht(t, "w:vertAlign");
|
|
627
|
+
u && (e.vertAlign = u);
|
|
628
628
|
const g = ct(p(t, "w:vanish"));
|
|
629
629
|
g !== void 0 && (e.vanish = g);
|
|
630
630
|
const k = ct(p(t, "w:caps"));
|
|
@@ -639,11 +639,11 @@ function Rt(t) {
|
|
|
639
639
|
P !== void 0 && (e.positionHalfPoints = P);
|
|
640
640
|
const z = T(p(t, "w:kern"), "w:val");
|
|
641
641
|
z !== void 0 && (e.kerningHalfPoints = z);
|
|
642
|
-
const
|
|
643
|
-
if (
|
|
644
|
-
const
|
|
645
|
-
if (
|
|
646
|
-
const A = Number(
|
|
642
|
+
const D = p(t, "w:w");
|
|
643
|
+
if (D) {
|
|
644
|
+
const F = m(D, "w:val");
|
|
645
|
+
if (F !== void 0) {
|
|
646
|
+
const A = Number(F.replace("%", ""));
|
|
647
647
|
Number.isFinite(A) && A > 0 && (e.widthScalePct = A);
|
|
648
648
|
}
|
|
649
649
|
}
|
|
@@ -657,17 +657,17 @@ function Rt(t) {
|
|
|
657
657
|
E !== void 0 && (e.emboss = E);
|
|
658
658
|
const R = ct(p(t, "w:imprint"));
|
|
659
659
|
R !== void 0 && (e.imprint = R);
|
|
660
|
-
const
|
|
661
|
-
if (
|
|
662
|
-
const
|
|
663
|
-
A !== void 0 && (
|
|
664
|
-
const
|
|
665
|
-
|
|
660
|
+
const _ = p(t, "w:bdr");
|
|
661
|
+
if (_) {
|
|
662
|
+
const F = { val: m(_, "w:val") ?? "single" }, A = T(_, "w:sz");
|
|
663
|
+
A !== void 0 && (F.sizeEighthPt = A);
|
|
664
|
+
const C = m(_, "w:color");
|
|
665
|
+
C && (F.color = C), e.runBorder = F;
|
|
666
666
|
}
|
|
667
|
-
const
|
|
668
|
-
return
|
|
667
|
+
const j = T(p(t, "w:fitText"), "w:val");
|
|
668
|
+
return j !== void 0 && (e.fitTextTwips = j), e;
|
|
669
669
|
}
|
|
670
|
-
const
|
|
670
|
+
const _n = {
|
|
671
671
|
left: "left",
|
|
672
672
|
start: "left",
|
|
673
673
|
center: "center",
|
|
@@ -679,44 +679,44 @@ const zn = {
|
|
|
679
679
|
function te(t, e) {
|
|
680
680
|
const n = {}, o = ht(t, "w:pStyle");
|
|
681
681
|
o && (n.styleId = o);
|
|
682
|
-
const i = ht(t, "w:jc"), r = i !== void 0 ?
|
|
682
|
+
const i = ht(t, "w:jc"), r = i !== void 0 ? _n[i] : void 0;
|
|
683
683
|
r && (n.align = r);
|
|
684
684
|
const s = p(t, "w:spacing");
|
|
685
685
|
if (s) {
|
|
686
686
|
const R = T(s, "w:before");
|
|
687
687
|
R !== void 0 && (n.spaceBeforeTwips = R);
|
|
688
|
-
const
|
|
689
|
-
|
|
690
|
-
const
|
|
691
|
-
|
|
688
|
+
const _ = T(s, "w:after");
|
|
689
|
+
_ !== void 0 && (n.spaceAfterTwips = _);
|
|
690
|
+
const j = T(s, "w:line"), F = m(s, "w:lineRule") ?? "auto";
|
|
691
|
+
j !== void 0 && (F === "exact" || F === "atLeast" && j > 0 ? (n.lineRule = F, n.lineExactTwips = j) : F === "auto" && (n.lineRule = "auto", n.lineHeight = Nn(j)));
|
|
692
692
|
}
|
|
693
693
|
const a = p(t, "w:ind");
|
|
694
694
|
if (a) {
|
|
695
695
|
const R = T(a, "w:left") ?? T(a, "w:start");
|
|
696
696
|
R !== void 0 && (n.indentLeftTwips = R);
|
|
697
|
-
const
|
|
698
|
-
|
|
699
|
-
const
|
|
700
|
-
|
|
697
|
+
const _ = T(a, "w:right") ?? T(a, "w:end");
|
|
698
|
+
_ !== void 0 && (n.indentRightTwips = _);
|
|
699
|
+
const j = T(a, "w:firstLine"), F = T(a, "w:hanging");
|
|
700
|
+
j !== void 0 ? n.indentFirstLineTwips = j : F !== void 0 && (n.indentFirstLineTwips = -F);
|
|
701
701
|
}
|
|
702
|
-
const
|
|
703
|
-
|
|
702
|
+
const c = ct(p(t, "w:keepNext"));
|
|
703
|
+
c !== void 0 && (n.keepWithNext = c);
|
|
704
704
|
const h = ct(p(t, "w:keepLines"));
|
|
705
705
|
h !== void 0 && (n.keepLinesTogether = h);
|
|
706
|
-
const
|
|
707
|
-
|
|
708
|
-
const
|
|
709
|
-
|
|
710
|
-
const
|
|
711
|
-
if (
|
|
706
|
+
const d = ct(p(t, "w:contextualSpacing"));
|
|
707
|
+
d !== void 0 && (n.contextualSpacing = d);
|
|
708
|
+
const l = ct(p(t, "w:bidi"));
|
|
709
|
+
l !== void 0 && (n.direction = l ? "rtl" : "ltr");
|
|
710
|
+
const u = p(t, "w:tabs");
|
|
711
|
+
if (u) {
|
|
712
712
|
const R = [];
|
|
713
|
-
for (const
|
|
714
|
-
const
|
|
715
|
-
if (
|
|
716
|
-
const A = { posTwips:
|
|
717
|
-
|
|
718
|
-
const
|
|
719
|
-
|
|
713
|
+
for (const _ of mt(u, "w:tab")) {
|
|
714
|
+
const j = T(_, "w:pos"), F = m(_, "w:val");
|
|
715
|
+
if (j === void 0 || F === "clear" || F === "bar") continue;
|
|
716
|
+
const A = { posTwips: j };
|
|
717
|
+
F && (A.val = F);
|
|
718
|
+
const C = m(_, "w:leader");
|
|
719
|
+
C && (A.leader = C), R.push(A);
|
|
720
720
|
}
|
|
721
721
|
R.length > 0 && (n.tabStops = R);
|
|
722
722
|
}
|
|
@@ -734,15 +734,15 @@ function te(t, e) {
|
|
|
734
734
|
}
|
|
735
735
|
const y = p(t, "w:pBdr");
|
|
736
736
|
if (y) {
|
|
737
|
-
const R = {},
|
|
738
|
-
const A = p(y,
|
|
737
|
+
const R = {}, _ = (j, F) => {
|
|
738
|
+
const A = p(y, F);
|
|
739
739
|
if (!A) return;
|
|
740
|
-
const
|
|
741
|
-
tt !== void 0 && (
|
|
740
|
+
const C = { val: m(A, "w:val") ?? "single" }, tt = T(A, "w:sz");
|
|
741
|
+
tt !== void 0 && (C.sizeEighthPt = tt);
|
|
742
742
|
const Q = m(A, "w:color");
|
|
743
|
-
Q && (
|
|
743
|
+
Q && (C.color = Q), R[j] = C;
|
|
744
744
|
};
|
|
745
|
-
|
|
745
|
+
_("top", "w:top"), _("left", "w:left"), _("bottom", "w:bottom"), _("right", "w:right"), _("between", "w:between"), (R.top || R.left || R.bottom || R.right || R.between) && (n.borders = R);
|
|
746
746
|
}
|
|
747
747
|
const N = Ut(p(t, "w:shd"));
|
|
748
748
|
N !== void 0 && (n.shd = N);
|
|
@@ -750,8 +750,8 @@ function te(t, e) {
|
|
|
750
750
|
P !== void 0 && (n.widowControl = P);
|
|
751
751
|
const z = ct(p(t, "w:suppressLineNumbers"));
|
|
752
752
|
z !== void 0 && (n.suppressLineNumbers = z);
|
|
753
|
-
const
|
|
754
|
-
(
|
|
753
|
+
const D = ht(t, "w:textAlignment");
|
|
754
|
+
(D === "top" || D === "center" || D === "bottom" || D === "baseline") && (n.textAlignment = D);
|
|
755
755
|
const nt = ct(p(t, "w:mirrorIndents"));
|
|
756
756
|
nt !== void 0 && (n.mirrorIndents = nt);
|
|
757
757
|
const lt = ct(p(t, "w:adjustRightInd"));
|
|
@@ -762,18 +762,18 @@ function te(t, e) {
|
|
|
762
762
|
if (E) {
|
|
763
763
|
const R = ht(E, "w:type");
|
|
764
764
|
n.sectionBreak = R === "continuous" ? "continuous" : "page", (R === "evenPage" || R === "oddPage") && (n.sectionBreakType = R);
|
|
765
|
-
const
|
|
766
|
-
|
|
767
|
-
const
|
|
768
|
-
|
|
769
|
-
const
|
|
770
|
-
if (
|
|
771
|
-
const it = T(
|
|
765
|
+
const _ = Ve(p(E, "w:lnNumType"));
|
|
766
|
+
_ && (n.sectionLineNumbering = _);
|
|
767
|
+
const j = p(E, "w:pgSz"), F = T(j, "w:w"), A = T(j, "w:h");
|
|
768
|
+
F !== void 0 && A !== void 0 && (n.sectionPgSize = { w: F, h: A });
|
|
769
|
+
const C = p(E, "w:pgMar");
|
|
770
|
+
if (C) {
|
|
771
|
+
const it = T(C, "w:top"), U = T(C, "w:right"), et = T(C, "w:bottom"), G = T(C, "w:left");
|
|
772
772
|
it !== void 0 && U !== void 0 && et !== void 0 && G !== void 0 && (n.sectionMarginTwips = { top: it, right: U, bottom: et, left: G });
|
|
773
|
-
const rt = T(
|
|
773
|
+
const rt = T(C, "w:header");
|
|
774
774
|
rt !== void 0 && (n.sectionHeaderDistTwips = rt);
|
|
775
|
-
const
|
|
776
|
-
|
|
775
|
+
const f = T(C, "w:footer");
|
|
776
|
+
f !== void 0 && (n.sectionFooterDistTwips = f);
|
|
777
777
|
}
|
|
778
778
|
const tt = p(E, "w:cols");
|
|
779
779
|
if (tt) {
|
|
@@ -795,12 +795,12 @@ function te(t, e) {
|
|
|
795
795
|
const U = { offsetFrom: m(Q, "w:offsetFrom") === "text" ? "text" : "page" }, et = (G) => {
|
|
796
796
|
const rt = p(Q, "w:" + G);
|
|
797
797
|
if (!rt) return;
|
|
798
|
-
const
|
|
798
|
+
const f = T(rt, "w:sz"), w = T(rt, "w:space"), B = m(rt, "w:color");
|
|
799
799
|
U[G] = {
|
|
800
800
|
style: m(rt, "w:val") ?? "single",
|
|
801
|
-
...
|
|
801
|
+
...f !== void 0 ? { sz: f } : {},
|
|
802
802
|
...w !== void 0 ? { space: w } : {},
|
|
803
|
-
...
|
|
803
|
+
...B !== void 0 ? { color: B } : {}
|
|
804
804
|
};
|
|
805
805
|
};
|
|
806
806
|
et("top"), et("right"), et("bottom"), et("left"), (U.top || U.right || U.bottom || U.left) && (n.sectionPgBorders = U);
|
|
@@ -810,7 +810,7 @@ function te(t, e) {
|
|
|
810
810
|
}
|
|
811
811
|
return n;
|
|
812
812
|
}
|
|
813
|
-
function
|
|
813
|
+
function Ve(t) {
|
|
814
814
|
if (!t) return;
|
|
815
815
|
const e = {}, n = T(t, "w:countBy");
|
|
816
816
|
n !== void 0 && (e.countBy = n);
|
|
@@ -822,22 +822,22 @@ function Ge(t) {
|
|
|
822
822
|
return (r === "continuous" || r === "newPage" || r === "newSection") && (e.restart = r), e;
|
|
823
823
|
}
|
|
824
824
|
function jn(t) {
|
|
825
|
-
const e = /* @__PURE__ */ new Map(), n =
|
|
825
|
+
const e = /* @__PURE__ */ new Map(), n = Pt(t, "comments.xml"), o = bt(n, "w:comments");
|
|
826
826
|
if (!o) return e;
|
|
827
827
|
for (const i of dt(o)) {
|
|
828
828
|
if (i.tagName !== "w:comment") continue;
|
|
829
829
|
const r = m(i, "w:id");
|
|
830
830
|
if (r === void 0) continue;
|
|
831
|
-
const s = m(i, "w:author") || "Anonymous", a = m(i, "w:initials"),
|
|
832
|
-
let
|
|
833
|
-
for (const
|
|
834
|
-
if (
|
|
835
|
-
|
|
836
|
-
for (const
|
|
837
|
-
if (
|
|
838
|
-
const g = p(
|
|
831
|
+
const s = m(i, "w:author") || "Anonymous", a = m(i, "w:initials"), c = m(i, "w:date"), h = [];
|
|
832
|
+
let d;
|
|
833
|
+
for (const l of dt(i))
|
|
834
|
+
if (l.tagName === "w:p") {
|
|
835
|
+
d || (d = m(l, "w14:paraId"));
|
|
836
|
+
for (const u of dt(l)) {
|
|
837
|
+
if (u.tagName !== "w:r" || p(u, "w:annotationRef")) continue;
|
|
838
|
+
const g = p(u, "w:rPr"), k = g ? Rt(g) : {};
|
|
839
839
|
let S = "";
|
|
840
|
-
for (const y of dt(
|
|
840
|
+
for (const y of dt(u))
|
|
841
841
|
y.tagName === "w:t" ? S += Nt(y) : y.tagName === "w:br" ? S += `
|
|
842
842
|
` : y.tagName === "w:tab" && (S += " ");
|
|
843
843
|
if (S.length > 0) {
|
|
@@ -863,29 +863,29 @@ function jn(t) {
|
|
|
863
863
|
author: s,
|
|
864
864
|
runs: h,
|
|
865
865
|
...a !== void 0 ? { initials: a } : {},
|
|
866
|
-
...
|
|
867
|
-
...
|
|
866
|
+
...c !== void 0 ? { date: c } : {},
|
|
867
|
+
...d !== void 0 ? { paraId: d } : {}
|
|
868
868
|
});
|
|
869
869
|
}
|
|
870
870
|
return e;
|
|
871
871
|
}
|
|
872
872
|
function Wn(t) {
|
|
873
|
-
const e = /* @__PURE__ */ new Map(), n =
|
|
873
|
+
const e = /* @__PURE__ */ new Map(), n = Pt(t, "commentsExtended.xml"), o = bt(n, "w15:commentsEx") ?? bt(n, "w:commentsEx");
|
|
874
874
|
if (!o) return e;
|
|
875
875
|
for (const i of dt(o)) {
|
|
876
876
|
if (i.tagName !== "w15:commentEx" && i.tagName !== "w:commentEx") continue;
|
|
877
877
|
const r = m(i, "w15:paraId") ?? m(i, "w:paraId");
|
|
878
878
|
if (!r) continue;
|
|
879
|
-
const s = m(i, "w15:paraIdParent") ?? m(i, "w:paraIdParent"), a = m(i, "w15:done") ?? m(i, "w:done"),
|
|
879
|
+
const s = m(i, "w15:paraIdParent") ?? m(i, "w:paraIdParent"), a = m(i, "w15:done") ?? m(i, "w:done"), c = a === "1" || a === "true";
|
|
880
880
|
e.set(r, {
|
|
881
881
|
paraId: r,
|
|
882
|
-
done:
|
|
882
|
+
done: c,
|
|
883
883
|
...s !== void 0 ? { paraIdParent: s } : {}
|
|
884
884
|
});
|
|
885
885
|
}
|
|
886
886
|
return e;
|
|
887
887
|
}
|
|
888
|
-
function
|
|
888
|
+
function $n(t, e, n, o) {
|
|
889
889
|
if (t.size === 0) return;
|
|
890
890
|
const i = /* @__PURE__ */ new Map();
|
|
891
891
|
for (const h of t.values())
|
|
@@ -893,46 +893,46 @@ function _n(t, e, n, o) {
|
|
|
893
893
|
const r = /* @__PURE__ */ new Map();
|
|
894
894
|
for (const h of t.values()) {
|
|
895
895
|
if (!h.paraId) continue;
|
|
896
|
-
const
|
|
897
|
-
if (
|
|
898
|
-
const
|
|
899
|
-
|
|
896
|
+
const d = e.get(h.paraId);
|
|
897
|
+
if (d?.paraIdParent) {
|
|
898
|
+
const l = i.get(d.paraIdParent);
|
|
899
|
+
l && l.id !== h.id && r.set(h.id, l.id);
|
|
900
900
|
}
|
|
901
901
|
}
|
|
902
902
|
const s = /* @__PURE__ */ new Map(), a = [];
|
|
903
|
-
for (const [h,
|
|
903
|
+
for (const [h, d] of t)
|
|
904
904
|
if (!r.get(h)) {
|
|
905
905
|
s.has(h) || (s.set(h, []), a.push(h));
|
|
906
|
-
const
|
|
907
|
-
s.get(h).push(
|
|
906
|
+
const u = xe(d);
|
|
907
|
+
s.get(h).push(u);
|
|
908
908
|
}
|
|
909
|
-
for (const [h,
|
|
910
|
-
const
|
|
911
|
-
if (
|
|
912
|
-
let
|
|
913
|
-
for (; r.has(
|
|
914
|
-
|
|
915
|
-
s.has(
|
|
909
|
+
for (const [h, d] of t) {
|
|
910
|
+
const l = r.get(h);
|
|
911
|
+
if (l) {
|
|
912
|
+
let u = l;
|
|
913
|
+
for (; r.has(u); )
|
|
914
|
+
u = r.get(u);
|
|
915
|
+
s.has(u) || (s.set(u, []), a.push(u)), s.get(u).push(xe(d));
|
|
916
916
|
}
|
|
917
917
|
}
|
|
918
|
-
const
|
|
918
|
+
const c = [];
|
|
919
919
|
for (const h of a) {
|
|
920
|
-
const
|
|
921
|
-
if (!
|
|
922
|
-
const
|
|
923
|
-
k &&
|
|
920
|
+
const d = s.get(h);
|
|
921
|
+
if (!d || d.length === 0) continue;
|
|
922
|
+
const l = t.get(h), g = (l?.paraId ? e.get(l.paraId) : void 0)?.done ? "resolved" : "open", k = n.get(h) ?? o;
|
|
923
|
+
k && c.push({
|
|
924
924
|
id: We(),
|
|
925
925
|
anchor: k,
|
|
926
926
|
status: g,
|
|
927
|
-
comments:
|
|
927
|
+
comments: d
|
|
928
928
|
});
|
|
929
929
|
}
|
|
930
|
-
if (
|
|
930
|
+
if (c.length !== 0)
|
|
931
931
|
return {
|
|
932
932
|
docId: "imported",
|
|
933
933
|
baseVersion: 0,
|
|
934
934
|
suggestions: [],
|
|
935
|
-
threads:
|
|
935
|
+
threads: c
|
|
936
936
|
};
|
|
937
937
|
}
|
|
938
938
|
function xe(t) {
|
|
@@ -953,27 +953,27 @@ function xe(t) {
|
|
|
953
953
|
createdAt: e
|
|
954
954
|
};
|
|
955
955
|
}
|
|
956
|
-
const
|
|
956
|
+
const Un = /* @__PURE__ */ new Set([
|
|
957
957
|
"application/vnd.openxmlformats-officedocument.wordprocessingml.document.main+xml",
|
|
958
958
|
"application/vnd.ms-word.document.macroEnabled.main+xml"
|
|
959
959
|
]);
|
|
960
|
-
function
|
|
961
|
-
const e =
|
|
960
|
+
function Gn(t) {
|
|
961
|
+
const e = bt(Pt(t, "[Content_Types].xml"), "Types");
|
|
962
962
|
if (e)
|
|
963
963
|
for (const n of dt(e)) {
|
|
964
964
|
if (n.tagName !== "Override") continue;
|
|
965
965
|
const o = m(n, "ContentType"), i = m(n, "PartName");
|
|
966
|
-
if (o && i &&
|
|
966
|
+
if (o && i && Un.has(o))
|
|
967
967
|
return i.replace(/^\//, "");
|
|
968
968
|
}
|
|
969
969
|
}
|
|
970
|
-
const
|
|
970
|
+
const Et = (t) => {
|
|
971
971
|
const e = t.indexOf(":");
|
|
972
972
|
return e === -1 ? t : t.slice(e + 1);
|
|
973
|
-
}, gt = (t) => t.children.filter(
|
|
973
|
+
}, gt = (t) => t.children.filter(Ht), vt = (t, e) => gt(t).find((n) => Et(n.tagName) === e), re = (t, e) => {
|
|
974
974
|
const n = t.attributes[e];
|
|
975
975
|
return n === void 0 ? void 0 : n ?? "";
|
|
976
|
-
},
|
|
976
|
+
}, At = (t, e) => {
|
|
977
977
|
const n = vt(t, e);
|
|
978
978
|
if (n)
|
|
979
979
|
return re(n, "m:val") ?? re(n, "w:val") ?? "";
|
|
@@ -983,13 +983,13 @@ const It = (t) => {
|
|
|
983
983
|
const o = re(n, "m:val") ?? re(n, "w:val");
|
|
984
984
|
return o === void 0 || !["0", "false", "off"].includes(o);
|
|
985
985
|
};
|
|
986
|
-
function
|
|
987
|
-
const e =
|
|
986
|
+
function Xe(t) {
|
|
987
|
+
const e = Et(t.tagName) === "oMathPara" ? vt(t, "oMath") ?? t : t;
|
|
988
988
|
return Ct(gt(e));
|
|
989
989
|
}
|
|
990
|
-
const
|
|
990
|
+
const Vn = /^[^\p{L}\p{N}\s]+$/u, Xn = (t) => Et(t.tagName).endsWith("Pr");
|
|
991
991
|
function Ct(t) {
|
|
992
|
-
return { type: "row", children: t.filter((e) => !
|
|
992
|
+
return { type: "row", children: t.filter((e) => !Xn(e)).map(Zn) };
|
|
993
993
|
}
|
|
994
994
|
function at(t, e) {
|
|
995
995
|
const n = vt(t, e);
|
|
@@ -998,7 +998,7 @@ function at(t, e) {
|
|
|
998
998
|
function Ae(t) {
|
|
999
999
|
return t.type === "row" && t.children.length === 1 ? t.children[0] : void 0;
|
|
1000
1000
|
}
|
|
1001
|
-
function
|
|
1001
|
+
function Yn(t, e) {
|
|
1002
1002
|
const n = e ?? ",";
|
|
1003
1003
|
if (n.length === 0) return t;
|
|
1004
1004
|
const o = [];
|
|
@@ -1009,11 +1009,11 @@ function Xn(t, e) {
|
|
|
1009
1009
|
function qn(t) {
|
|
1010
1010
|
let e = "";
|
|
1011
1011
|
for (const n of gt(t))
|
|
1012
|
-
if (
|
|
1012
|
+
if (Et(n.tagName) === "t")
|
|
1013
1013
|
for (const o of n.children) typeof o == "string" && (e += o);
|
|
1014
1014
|
return e;
|
|
1015
1015
|
}
|
|
1016
|
-
function
|
|
1016
|
+
function Kn(t) {
|
|
1017
1017
|
switch (t) {
|
|
1018
1018
|
case "b":
|
|
1019
1019
|
return "bold";
|
|
@@ -1025,7 +1025,7 @@ function Yn(t) {
|
|
|
1025
1025
|
return;
|
|
1026
1026
|
}
|
|
1027
1027
|
}
|
|
1028
|
-
function
|
|
1028
|
+
function Ie(t, e) {
|
|
1029
1029
|
const n = t === "b" || t === "bi";
|
|
1030
1030
|
switch (e) {
|
|
1031
1031
|
case "double-struck":
|
|
@@ -1039,25 +1039,25 @@ function Ce(t, e) {
|
|
|
1039
1039
|
case "monospace":
|
|
1040
1040
|
return "monospace";
|
|
1041
1041
|
default:
|
|
1042
|
-
return
|
|
1042
|
+
return Kn(t);
|
|
1043
1043
|
}
|
|
1044
1044
|
}
|
|
1045
|
-
function
|
|
1046
|
-
const e = qn(t), n = vt(t, "rPr"), o = n ?
|
|
1045
|
+
function Jn(t) {
|
|
1046
|
+
const e = qn(t), n = vt(t, "rPr"), o = n ? At(n, "sty") : void 0, i = n ? At(n, "scr") : void 0;
|
|
1047
1047
|
if (e.length > 0 && /^\s+$/.test(e)) return { type: "space", widthEm: e.length * 0.25 };
|
|
1048
1048
|
if (/^[0-9]+([.,][0-9]+)?$/.test(e)) {
|
|
1049
|
-
const r =
|
|
1049
|
+
const r = Ie(o, i) ?? (o === "i" ? "italic" : void 0);
|
|
1050
1050
|
return { type: "number", text: e, ...r && r !== "normal" ? { variant: r } : {} };
|
|
1051
1051
|
}
|
|
1052
|
-
if (e.length > 0 &&
|
|
1052
|
+
if (e.length > 0 && Vn.test(e)) return { type: "op", text: e };
|
|
1053
1053
|
if (/\p{L}/u.test(e)) {
|
|
1054
|
-
const r =
|
|
1054
|
+
const r = Ie(o, i);
|
|
1055
1055
|
return { type: "ident", text: e, ...r ? { variant: r } : {} };
|
|
1056
1056
|
}
|
|
1057
1057
|
return { type: "text", text: e };
|
|
1058
1058
|
}
|
|
1059
|
-
function
|
|
1060
|
-
switch (
|
|
1059
|
+
function Zn(t) {
|
|
1060
|
+
switch (Et(t.tagName)) {
|
|
1061
1061
|
case "oMath":
|
|
1062
1062
|
case "oMathPara":
|
|
1063
1063
|
case "e":
|
|
@@ -1070,9 +1070,9 @@ function Jn(t) {
|
|
|
1070
1070
|
case "fName":
|
|
1071
1071
|
return Ct(gt(t));
|
|
1072
1072
|
case "r":
|
|
1073
|
-
return
|
|
1073
|
+
return Jn(t);
|
|
1074
1074
|
case "f": {
|
|
1075
|
-
const e = vt(t, "fPr"), n = e ?
|
|
1075
|
+
const e = vt(t, "fPr"), n = e ? At(e, "type") : void 0;
|
|
1076
1076
|
return {
|
|
1077
1077
|
type: "frac",
|
|
1078
1078
|
num: at(t, "num"),
|
|
@@ -1098,7 +1098,7 @@ function Jn(t) {
|
|
|
1098
1098
|
};
|
|
1099
1099
|
}
|
|
1100
1100
|
case "d": {
|
|
1101
|
-
const e = vt(t, "dPr"), n = e ?
|
|
1101
|
+
const e = vt(t, "dPr"), n = e ? At(e, "begChr") : void 0, o = e ? At(e, "endChr") : void 0, i = e ? At(e, "sepChr") : void 0, r = gt(t).filter((a) => Et(a.tagName) === "e").map((a) => Ct(gt(a))), s = r.length <= 1 ? r[0] ?? je() : { type: "row", children: Yn(r, i) };
|
|
1102
1102
|
return {
|
|
1103
1103
|
type: "fenced",
|
|
1104
1104
|
open: n ?? "(",
|
|
@@ -1107,12 +1107,12 @@ function Jn(t) {
|
|
|
1107
1107
|
};
|
|
1108
1108
|
}
|
|
1109
1109
|
case "nary": {
|
|
1110
|
-
const e = vt(t, "naryPr"), n = (e ?
|
|
1110
|
+
const e = vt(t, "naryPr"), n = (e ? At(e, "chr") : void 0) ?? "∫", o = e ? ce(e, "subHide") : !1, i = e ? ce(e, "supHide") : !1, r = vt(t, "sub"), s = vt(t, "sup"), a = !o && r && gt(r).length > 0 ? Ct(gt(r)) : void 0, c = !i && s && gt(s).length > 0 ? Ct(gt(s)) : void 0;
|
|
1111
1111
|
return {
|
|
1112
1112
|
type: "nary",
|
|
1113
1113
|
op: n,
|
|
1114
1114
|
...a ? { sub: a } : {},
|
|
1115
|
-
...
|
|
1115
|
+
...c ? { sup: c } : {},
|
|
1116
1116
|
body: at(t, "e")
|
|
1117
1117
|
};
|
|
1118
1118
|
}
|
|
@@ -1125,15 +1125,15 @@ function Jn(t) {
|
|
|
1125
1125
|
return o && o.type === "limit" && o.under && !o.over && !o.accent ? { type: "limit", base: o.base, under: o.under, over: n } : { type: "limit", base: e, over: n };
|
|
1126
1126
|
}
|
|
1127
1127
|
case "acc": {
|
|
1128
|
-
const e = vt(t, "accPr"), n = (e ?
|
|
1128
|
+
const e = vt(t, "accPr"), n = (e ? At(e, "chr") : void 0) ?? "̂";
|
|
1129
1129
|
return { type: "limit", base: at(t, "e"), over: { type: "op", text: n }, accent: !0 };
|
|
1130
1130
|
}
|
|
1131
1131
|
case "bar": {
|
|
1132
|
-
const e = vt(t, "barPr"), n = e ?
|
|
1132
|
+
const e = vt(t, "barPr"), n = e ? At(e, "pos") : "top", o = { type: "op", text: n === "bot" ? "_" : "‾", stretchy: !0 };
|
|
1133
1133
|
return n === "bot" ? { type: "limit", base: at(t, "e"), under: o } : { type: "limit", base: at(t, "e"), over: o };
|
|
1134
1134
|
}
|
|
1135
1135
|
case "groupChr": {
|
|
1136
|
-
const e = vt(t, "groupChrPr"), n = (e ?
|
|
1136
|
+
const e = vt(t, "groupChrPr"), n = (e ? At(e, "chr") : void 0) ?? "⏟", o = e ? At(e, "pos") : "bot", i = { type: "op", text: n, stretchy: !0 };
|
|
1137
1137
|
return o === "top" ? { type: "limit", base: at(t, "e"), over: i } : { type: "limit", base: at(t, "e"), under: i };
|
|
1138
1138
|
}
|
|
1139
1139
|
case "func":
|
|
@@ -1144,21 +1144,21 @@ function Jn(t) {
|
|
|
1144
1144
|
case "borderBox":
|
|
1145
1145
|
return at(t, "e");
|
|
1146
1146
|
case "eqArr":
|
|
1147
|
-
return { type: "matrix", rows: gt(t).filter((n) =>
|
|
1147
|
+
return { type: "matrix", rows: gt(t).filter((n) => Et(n.tagName) === "e").map((n) => [Ct(gt(n))]) };
|
|
1148
1148
|
case "m":
|
|
1149
|
-
return
|
|
1149
|
+
return Qn(t);
|
|
1150
1150
|
default:
|
|
1151
1151
|
return gt(t).length ? Ct(gt(t)) : { type: "unknown" };
|
|
1152
1152
|
}
|
|
1153
1153
|
}
|
|
1154
|
-
function
|
|
1154
|
+
function Qn(t) {
|
|
1155
1155
|
const e = [];
|
|
1156
1156
|
for (const n of gt(t))
|
|
1157
|
-
|
|
1157
|
+
Et(n.tagName) === "mr" && e.push(gt(n).filter((o) => Et(o.tagName) === "e").map((o) => Ct(gt(o))));
|
|
1158
1158
|
return { type: "matrix", rows: e };
|
|
1159
1159
|
}
|
|
1160
1160
|
const se = () => ({ depth: 0, topInstr: "", openId: null, markBlock: null, next: { n: 0 }, registry: {} });
|
|
1161
|
-
function
|
|
1161
|
+
function Ce(t) {
|
|
1162
1162
|
const e = t.fieldTrack;
|
|
1163
1163
|
if (e.openId !== null || !Cn(e.topInstr)) return;
|
|
1164
1164
|
const n = `field${e.next.n++}`;
|
|
@@ -1170,59 +1170,59 @@ function Lt(t) {
|
|
|
1170
1170
|
n.kind === "run" ? e += n.text.length : n.kind === "break" && (e += 1);
|
|
1171
1171
|
return e;
|
|
1172
1172
|
}
|
|
1173
|
-
function
|
|
1174
|
-
const o =
|
|
1173
|
+
function to(t, e, n) {
|
|
1174
|
+
const o = bt(Pt(t, e), "w:document"), i = o && p(o, "w:body");
|
|
1175
1175
|
if (!i)
|
|
1176
|
-
throw new
|
|
1176
|
+
throw new kt("MALFORMED_XML", `${e} has no w:document/w:body root.`);
|
|
1177
1177
|
const r = {}, s = { warnings: n, fieldTokens: !1, sdts: r, nextSdt: { n: 0 }, blockSdtStack: [], inlineSdtStack: [], pendingBookmarks: [], currentBookmarks: null, pendingMarkers: [], currentMarkers: null, pendingCommentMarkers: [], currentCommentMarkers: null, trackFields: !0, fieldTrack: se() }, a = [];
|
|
1178
|
-
|
|
1179
|
-
const
|
|
1180
|
-
return
|
|
1178
|
+
Ft(dt(i), a, s);
|
|
1179
|
+
const c = p(i, "w:sectPr"), h = c ? So(c) : null, d = o ? p(o, "w:background") : void 0, l = d ? m(d, "w:color") : void 0, u = l && l !== "auto" ? l : void 0, g = s.fieldTrack.registry, k = Object.keys(g).length > 0 ? { blocks: a, section: h, sdts: r, fields: g } : { blocks: a, section: h, sdts: r };
|
|
1180
|
+
return u && (k.pageColorHex = u), k;
|
|
1181
1181
|
}
|
|
1182
|
-
function
|
|
1183
|
-
const i =
|
|
1182
|
+
function eo(t, e, n, o = {}) {
|
|
1183
|
+
const i = Pt(t, e), r = bt(i, "w:hdr") ?? bt(i, "w:ftr");
|
|
1184
1184
|
if (!r)
|
|
1185
|
-
throw new
|
|
1185
|
+
throw new kt("MALFORMED_XML", `${e} has no w:hdr/w:ftr root.`);
|
|
1186
1186
|
const s = { warnings: n, fieldTokens: !0, sdts: o, nextSdt: { n: Object.keys(o).length }, blockSdtStack: [], inlineSdtStack: [], pendingBookmarks: [], currentBookmarks: null, pendingMarkers: [], currentMarkers: null, pendingCommentMarkers: [], currentCommentMarkers: null, trackFields: !1, fieldTrack: se() }, a = [];
|
|
1187
|
-
return
|
|
1187
|
+
return Ft(dt(r), a, s), a;
|
|
1188
1188
|
}
|
|
1189
|
-
const
|
|
1190
|
-
function
|
|
1189
|
+
const no = /* @__PURE__ */ new Set(["_GoBack", "_Toc_Placeholder"]);
|
|
1190
|
+
function Ye(t) {
|
|
1191
1191
|
const e = m(t, "w:name");
|
|
1192
|
-
return e && !
|
|
1192
|
+
return e && !no.has(e) ? e : null;
|
|
1193
1193
|
}
|
|
1194
|
-
function
|
|
1194
|
+
function oo(t) {
|
|
1195
1195
|
const e = p(t, "m:oMathParaPr"), n = e ? p(e, "m:jc") : void 0, o = n ? m(n, "m:val") : void 0;
|
|
1196
1196
|
if (o === "left" || o === "right") return o;
|
|
1197
1197
|
if (o === "center" || o === "centerGroup") return "center";
|
|
1198
1198
|
}
|
|
1199
|
-
function
|
|
1199
|
+
function Ft(t, e, n) {
|
|
1200
1200
|
for (const o of t)
|
|
1201
1201
|
switch (n.trackFields && (n.fieldTrack.markBlock = n.fieldTrack.openId), o.tagName) {
|
|
1202
1202
|
case "w:p": {
|
|
1203
|
-
const i =
|
|
1203
|
+
const i = io(o, n);
|
|
1204
1204
|
n.trackFields && n.fieldTrack.markBlock && (i.fieldId = n.fieldTrack.markBlock), n.blockSdtStack.length && (i.sdtPath = [...n.blockSdtStack]), e.push(i);
|
|
1205
1205
|
break;
|
|
1206
1206
|
}
|
|
1207
1207
|
case "w:tbl": {
|
|
1208
|
-
const i =
|
|
1208
|
+
const i = yo(o, n);
|
|
1209
1209
|
n.trackFields && n.fieldTrack.markBlock && (i.fieldId = n.fieldTrack.markBlock), n.blockSdtStack.length && (i.sdtPath = [...n.blockSdtStack]), e.push(i);
|
|
1210
1210
|
break;
|
|
1211
1211
|
}
|
|
1212
1212
|
case "w:sdt": {
|
|
1213
1213
|
const i = p(o, "w:sdtContent");
|
|
1214
1214
|
if (!i) break;
|
|
1215
|
-
const r =
|
|
1215
|
+
const r = Ke(p(o, "w:sdtPr"));
|
|
1216
1216
|
if (!r) {
|
|
1217
|
-
n.warnings.add("sdt-unwrapped", "Content controls were unwrapped to their content."),
|
|
1217
|
+
n.warnings.add("sdt-unwrapped", "Content controls were unwrapped to their content."), Ft(dt(i), e, n);
|
|
1218
1218
|
break;
|
|
1219
1219
|
}
|
|
1220
1220
|
const s = `sdt${n.nextSdt.n++}`;
|
|
1221
|
-
n.sdts[s] = r, n.blockSdtStack.push(s),
|
|
1221
|
+
n.sdts[s] = r, n.blockSdtStack.push(s), Ft(dt(i), e, n), n.blockSdtStack.pop();
|
|
1222
1222
|
break;
|
|
1223
1223
|
}
|
|
1224
1224
|
case "w:bookmarkStart": {
|
|
1225
|
-
const i =
|
|
1225
|
+
const i = Ye(o), r = m(o, "w:id");
|
|
1226
1226
|
i && (n.pendingBookmarks.push(i), r && n.pendingMarkers.push({ id: r, name: i, kind: "start", offset: 0 }));
|
|
1227
1227
|
break;
|
|
1228
1228
|
}
|
|
@@ -1242,33 +1242,33 @@ function Bt(t, e, n) {
|
|
|
1242
1242
|
break;
|
|
1243
1243
|
}
|
|
1244
1244
|
case "m:oMathPara": {
|
|
1245
|
-
const i =
|
|
1245
|
+
const i = oo(o), r = { kind: "math", root: Xe(o), display: !0 };
|
|
1246
1246
|
i && (r.align = i), n.trackFields && n.fieldTrack.markBlock && (r.fieldId = n.fieldTrack.markBlock), n.blockSdtStack.length && (r.sdtPath = [...n.blockSdtStack]), e.push(r);
|
|
1247
1247
|
break;
|
|
1248
1248
|
}
|
|
1249
1249
|
}
|
|
1250
1250
|
}
|
|
1251
|
-
function
|
|
1251
|
+
function io(t, e) {
|
|
1252
1252
|
const n = p(t, "w:pPr"), o = n ? te(n, e.warnings) : {}, i = [], r = e.pendingBookmarks;
|
|
1253
1253
|
e.pendingBookmarks = [], e.currentBookmarks = r;
|
|
1254
1254
|
const s = e.pendingMarkers;
|
|
1255
1255
|
e.pendingMarkers = [], e.currentMarkers = s;
|
|
1256
1256
|
const a = e.pendingCommentMarkers;
|
|
1257
1257
|
e.pendingCommentMarkers = [], e.currentCommentMarkers = a;
|
|
1258
|
-
const
|
|
1259
|
-
Ot(dt(t), i, e,
|
|
1258
|
+
const c = { depth: 0, instr: "", suppressResult: !1 };
|
|
1259
|
+
Ot(dt(t), i, e, c), e.currentBookmarks = null, e.currentMarkers = null, e.currentCommentMarkers = null;
|
|
1260
1260
|
const h = { kind: "paragraph", props: o, inlines: i };
|
|
1261
|
-
return r.length > 0 && (h.bookmarks = r), s.length > 0 && (h.bookmarkMarkers = s), a.length > 0 && (h.commentMarkers = a),
|
|
1261
|
+
return r.length > 0 && (h.bookmarks = r), s.length > 0 && (h.bookmarkMarkers = s), a.length > 0 && (h.commentMarkers = a), c.tocInstr !== void 0 && (h.tocField = c.tocInstr), h;
|
|
1262
1262
|
}
|
|
1263
|
-
const
|
|
1264
|
-
function
|
|
1263
|
+
const ro = /* @__PURE__ */ new Set(["PAGE", "NUMPAGES", "DATE", "TIME", "IF"]), so = { fontFamily: "", fontSizePx: 16, bold: !1, italic: !1, underline: !1, strikethrough: !1, color: "#000000" };
|
|
1264
|
+
function ao(t) {
|
|
1265
1265
|
return t.type === "NUMPAGES" ? "{pages}" : t.type === "PAGE" ? `{page${t.numFmt && t.numFmt !== "arabic" ? `:${t.numFmt}` : ""}}` : "";
|
|
1266
1266
|
}
|
|
1267
1267
|
function ge(t) {
|
|
1268
1268
|
if (/\bNUMPAGES\b/.test(t)) return "{pages}";
|
|
1269
1269
|
if (/\bPAGE\b/.test(t)) return "{page}";
|
|
1270
1270
|
}
|
|
1271
|
-
function
|
|
1271
|
+
function co(t) {
|
|
1272
1272
|
const e = t.match(/\bPAGEREF\s+("[^"]+"|\S+)/) ?? t.match(/\bHYPERLINK\s+\\l\s+("[^"]+"|\S+)/);
|
|
1273
1273
|
return e ? e[1].replace(/^"|"$/g, "") : void 0;
|
|
1274
1274
|
}
|
|
@@ -1276,21 +1276,21 @@ function Ot(t, e, n, o) {
|
|
|
1276
1276
|
for (const i of t)
|
|
1277
1277
|
switch (i.tagName) {
|
|
1278
1278
|
case "w:r":
|
|
1279
|
-
|
|
1279
|
+
fo(i, e, n, o);
|
|
1280
1280
|
break;
|
|
1281
1281
|
case "w:hyperlink": {
|
|
1282
1282
|
const r = m(i, "r:id"), s = m(i, "w:anchor"), a = e.length;
|
|
1283
1283
|
if (Ot(dt(i), e, n, o), r || s)
|
|
1284
|
-
for (let
|
|
1285
|
-
const h = e[
|
|
1286
|
-
|
|
1284
|
+
for (let c = a; c < e.length; c++) {
|
|
1285
|
+
const h = e[c], d = h.kind === "run" ? h.props : h.kind === "mathInline" ? h.props ??= {} : void 0;
|
|
1286
|
+
d && (r ? d.linkRelId = r : s && (d.linkAnchor = s));
|
|
1287
1287
|
}
|
|
1288
1288
|
break;
|
|
1289
1289
|
}
|
|
1290
1290
|
case "w:sdt": {
|
|
1291
1291
|
const r = p(i, "w:sdtContent");
|
|
1292
1292
|
if (!r) break;
|
|
1293
|
-
const s =
|
|
1293
|
+
const s = Ke(p(i, "w:sdtPr"));
|
|
1294
1294
|
if (!s) {
|
|
1295
1295
|
n.warnings.add("sdt-unwrapped", "Content controls were unwrapped to their content."), Ot(dt(r), e, n, o);
|
|
1296
1296
|
break;
|
|
@@ -1301,7 +1301,7 @@ function Ot(t, e, n, o) {
|
|
|
1301
1301
|
}
|
|
1302
1302
|
case "w:fldSimple": {
|
|
1303
1303
|
const r = m(i, "w:instr") ?? "", s = n.fieldTokens ? ge(r) : void 0;
|
|
1304
|
-
s ? e.push({ kind: "run", text: s, props:
|
|
1304
|
+
s ? e.push({ kind: "run", text: s, props: lo(i) }) : Ot(dt(i), e, n, o);
|
|
1305
1305
|
break;
|
|
1306
1306
|
}
|
|
1307
1307
|
case "w:smartTag":
|
|
@@ -1311,7 +1311,7 @@ function Ot(t, e, n, o) {
|
|
|
1311
1311
|
case "w:del":
|
|
1312
1312
|
break;
|
|
1313
1313
|
case "w:bookmarkStart": {
|
|
1314
|
-
const r =
|
|
1314
|
+
const r = Ye(i), s = m(i, "w:id");
|
|
1315
1315
|
r && n.currentBookmarks && n.currentBookmarks.push(r), r && s && n.currentMarkers && n.currentMarkers.push({ id: s, name: r, kind: "start", offset: Lt(e) });
|
|
1316
1316
|
break;
|
|
1317
1317
|
}
|
|
@@ -1336,32 +1336,32 @@ function Ot(t, e, n, o) {
|
|
|
1336
1336
|
break;
|
|
1337
1337
|
}
|
|
1338
1338
|
case "m:oMath": {
|
|
1339
|
-
e.push({ kind: "mathInline", root:
|
|
1339
|
+
e.push({ kind: "mathInline", root: Xe(i) });
|
|
1340
1340
|
break;
|
|
1341
1341
|
}
|
|
1342
1342
|
}
|
|
1343
1343
|
}
|
|
1344
|
-
function
|
|
1345
|
-
const e =
|
|
1344
|
+
function lo(t) {
|
|
1345
|
+
const e = Bt(t, "w:r"), n = e && p(e, "w:rPr");
|
|
1346
1346
|
return n ? Rt(n) : {};
|
|
1347
1347
|
}
|
|
1348
|
-
function
|
|
1348
|
+
function fo(t, e, n, o) {
|
|
1349
1349
|
const i = p(t, "w:rPr"), r = i ? Rt(i) : {}, s = e.length, a = n.inlineSdtStack.length ? [...n.inlineSdtStack] : void 0;
|
|
1350
|
-
let
|
|
1350
|
+
let c = "";
|
|
1351
1351
|
const h = () => {
|
|
1352
|
-
|
|
1353
|
-
},
|
|
1354
|
-
for (const
|
|
1355
|
-
switch (
|
|
1352
|
+
c.length > 0 && (o.pagerefAnchor && r.linkAnchor === void 0 && r.linkRelId === void 0 && (r.linkAnchor = o.pagerefAnchor), e.push({ kind: "run", text: c, props: r, ...o.resultFieldId ? { fieldId: o.resultFieldId } : {} })), c = "";
|
|
1353
|
+
}, d = (l) => {
|
|
1354
|
+
for (const u of l)
|
|
1355
|
+
switch (u.tagName) {
|
|
1356
1356
|
case "w:t":
|
|
1357
|
-
o.suppressResult || (
|
|
1357
|
+
o.suppressResult || (c += Nt(u));
|
|
1358
1358
|
break;
|
|
1359
1359
|
case "w:tab":
|
|
1360
|
-
o.suppressResult || (
|
|
1360
|
+
o.suppressResult || (c += " ");
|
|
1361
1361
|
break;
|
|
1362
1362
|
case "w:br": {
|
|
1363
1363
|
h();
|
|
1364
|
-
const g = m(
|
|
1364
|
+
const g = m(u, "w:type");
|
|
1365
1365
|
g === "page" ? e.push({ kind: "break", page: !0 }) : g === "column" ? e.push({ kind: "break", column: !0 }) : e.push({ kind: "break" });
|
|
1366
1366
|
break;
|
|
1367
1367
|
}
|
|
@@ -1369,18 +1369,18 @@ function lo(t, e, n, o) {
|
|
|
1369
1369
|
h(), e.push({ kind: "break" });
|
|
1370
1370
|
break;
|
|
1371
1371
|
case "w:noBreakHyphen":
|
|
1372
|
-
|
|
1372
|
+
c += "‑";
|
|
1373
1373
|
break;
|
|
1374
1374
|
case "w:commentReference": {
|
|
1375
|
-
const g = m(
|
|
1376
|
-
g && n.currentCommentMarkers && n.currentCommentMarkers.push({ id: g, kind: "ref", offset: Lt(e) +
|
|
1375
|
+
const g = m(u, "w:id");
|
|
1376
|
+
g && n.currentCommentMarkers && n.currentCommentMarkers.push({ id: g, kind: "ref", offset: Lt(e) + c.length });
|
|
1377
1377
|
break;
|
|
1378
1378
|
}
|
|
1379
1379
|
case "w:sym": {
|
|
1380
|
-
const g = m(
|
|
1380
|
+
const g = m(u, "w:font"), k = m(u, "w:char");
|
|
1381
1381
|
g && k && (h(), e.push({
|
|
1382
1382
|
kind: "run",
|
|
1383
|
-
text:
|
|
1383
|
+
text: ho(k),
|
|
1384
1384
|
props: { ...r, symbol: { font: g, char: k.toUpperCase() } },
|
|
1385
1385
|
...o.resultFieldId ? { fieldId: o.resultFieldId } : {}
|
|
1386
1386
|
}));
|
|
@@ -1388,13 +1388,13 @@ function lo(t, e, n, o) {
|
|
|
1388
1388
|
}
|
|
1389
1389
|
case "w:drawing": {
|
|
1390
1390
|
h();
|
|
1391
|
-
const g =
|
|
1391
|
+
const g = po(u, n);
|
|
1392
1392
|
g && e.push(g);
|
|
1393
1393
|
break;
|
|
1394
1394
|
}
|
|
1395
1395
|
case "w:pict": {
|
|
1396
1396
|
h();
|
|
1397
|
-
const g =
|
|
1397
|
+
const g = ko(u, n);
|
|
1398
1398
|
g && e.push(g);
|
|
1399
1399
|
break;
|
|
1400
1400
|
}
|
|
@@ -1403,55 +1403,55 @@ function lo(t, e, n, o) {
|
|
|
1403
1403
|
break;
|
|
1404
1404
|
case "w:instrText":
|
|
1405
1405
|
if (o.depth > 0) {
|
|
1406
|
-
o.instr += Nt(
|
|
1407
|
-
const g =
|
|
1406
|
+
o.instr += Nt(u);
|
|
1407
|
+
const g = co(o.instr);
|
|
1408
1408
|
g && (o.pagerefAnchor = g);
|
|
1409
|
-
const k = Nt(
|
|
1409
|
+
const k = Nt(u);
|
|
1410
1410
|
o.tocInstr === void 0 && /\bTOC\b/.test(k) && (o.tocInstr = k);
|
|
1411
1411
|
}
|
|
1412
|
-
n.trackFields && n.fieldTrack.depth === 1 && (n.fieldTrack.topInstr += Nt(
|
|
1412
|
+
n.trackFields && n.fieldTrack.depth === 1 && (n.fieldTrack.topInstr += Nt(u));
|
|
1413
1413
|
break;
|
|
1414
1414
|
case "w:fldChar":
|
|
1415
|
-
|
|
1415
|
+
uo(u, r, e, n, o);
|
|
1416
1416
|
break;
|
|
1417
1417
|
case "mc:AlternateContent": {
|
|
1418
|
-
const g = p(
|
|
1419
|
-
g &&
|
|
1418
|
+
const g = p(u, "mc:Choice") ?? p(u, "mc:Fallback");
|
|
1419
|
+
g && d(dt(g));
|
|
1420
1420
|
break;
|
|
1421
1421
|
}
|
|
1422
1422
|
case "w:footnoteReference": {
|
|
1423
|
-
const g = m(
|
|
1423
|
+
const g = m(u, "w:id");
|
|
1424
1424
|
g !== void 0 && (h(), e.push({ kind: "run", text: "", props: { ...r, footnoteId: g } }));
|
|
1425
1425
|
break;
|
|
1426
1426
|
}
|
|
1427
1427
|
case "w:endnoteReference": {
|
|
1428
|
-
const g = m(
|
|
1428
|
+
const g = m(u, "w:id");
|
|
1429
1429
|
g !== void 0 && (h(), e.push({ kind: "run", text: "", props: { ...r, endnoteId: g } }));
|
|
1430
1430
|
break;
|
|
1431
1431
|
}
|
|
1432
1432
|
}
|
|
1433
1433
|
};
|
|
1434
|
-
if (
|
|
1435
|
-
for (let
|
|
1436
|
-
const
|
|
1437
|
-
|
|
1434
|
+
if (d(dt(t)), h(), a)
|
|
1435
|
+
for (let l = s; l < e.length; l++) {
|
|
1436
|
+
const u = e[l];
|
|
1437
|
+
u.kind === "run" && (u.sdtPath = a);
|
|
1438
1438
|
}
|
|
1439
1439
|
}
|
|
1440
|
-
function
|
|
1440
|
+
function uo(t, e, n, o, i) {
|
|
1441
1441
|
const r = o.fieldTrack;
|
|
1442
1442
|
switch (m(t, "w:fldCharType")) {
|
|
1443
1443
|
case "begin":
|
|
1444
1444
|
i.depth++, i.depth === 1 && (i.instr = "", i.suppressResult = !1, i.pagerefAnchor = void 0, i.resultFieldId = void 0), o.trackFields && (r.depth++, r.depth === 1 && (r.topInstr = "", r.openId = null));
|
|
1445
1445
|
break;
|
|
1446
1446
|
case "separate": {
|
|
1447
|
-
if (o.trackFields && r.depth === 1 &&
|
|
1447
|
+
if (o.trackFields && r.depth === 1 && Ce(o), i.depth !== 1) break;
|
|
1448
1448
|
if (o.trackFields) {
|
|
1449
1449
|
const a = ke(i.instr);
|
|
1450
|
-
if (
|
|
1451
|
-
const
|
|
1452
|
-
if (
|
|
1450
|
+
if (ro.has(a.name)) {
|
|
1451
|
+
const c = Mn(a, so);
|
|
1452
|
+
if (c) {
|
|
1453
1453
|
const h = `field${r.next.n++}`;
|
|
1454
|
-
r.registry[h] = { id: h, instruction: i.instr, name: a.name, kind: "builtin", spec:
|
|
1454
|
+
r.registry[h] = { id: h, instruction: i.instr, name: a.name, kind: "builtin", spec: c }, c.type === "PAGE" || c.type === "NUMPAGES" ? (n.push({ kind: "run", text: ao(c), props: e, fieldId: h }), i.suppressResult = !0) : i.resultFieldId = h;
|
|
1455
1455
|
break;
|
|
1456
1456
|
}
|
|
1457
1457
|
}
|
|
@@ -1461,7 +1461,7 @@ function fo(t, e, n, o, i) {
|
|
|
1461
1461
|
break;
|
|
1462
1462
|
}
|
|
1463
1463
|
case "end":
|
|
1464
|
-
if (o.trackFields && r.depth > 0 && (r.depth === 1 && (
|
|
1464
|
+
if (o.trackFields && r.depth > 0 && (r.depth === 1 && (Ce(o), r.openId = null, r.topInstr = ""), r.depth--), i.depth > 0 && i.depth--, i.depth === 0) {
|
|
1465
1465
|
if (!i.suppressResult) {
|
|
1466
1466
|
const s = o.fieldTokens ? ge(i.instr) : void 0;
|
|
1467
1467
|
s && n.push({ kind: "run", text: s, props: e });
|
|
@@ -1471,46 +1471,46 @@ function fo(t, e, n, o, i) {
|
|
|
1471
1471
|
break;
|
|
1472
1472
|
}
|
|
1473
1473
|
}
|
|
1474
|
-
function
|
|
1474
|
+
function ho(t) {
|
|
1475
1475
|
const e = parseInt(t, 16);
|
|
1476
1476
|
return Number.isFinite(e) && e > 0 && e <= 1114111 ? String.fromCodePoint(e) : "�";
|
|
1477
1477
|
}
|
|
1478
|
-
function
|
|
1478
|
+
function po(t, e) {
|
|
1479
1479
|
const n = p(t, "wp:anchor"), o = p(t, "wp:inline") ?? n;
|
|
1480
1480
|
if (!o) return;
|
|
1481
|
-
const i =
|
|
1481
|
+
const i = Bt(o, "a:blip"), r = i && m(i, "r:embed");
|
|
1482
1482
|
if (!r) {
|
|
1483
1483
|
e.warnings.add("images-skipped", "A drawing without an embedded image reference was skipped.");
|
|
1484
1484
|
return;
|
|
1485
1485
|
}
|
|
1486
|
-
const s = p(o, "wp:extent"), a = { kind: "image", relId: r, anchored: !!n },
|
|
1487
|
-
|
|
1486
|
+
const s = p(o, "wp:extent"), a = { kind: "image", relId: r, anchored: !!n }, c = T(s, "cx");
|
|
1487
|
+
c !== void 0 && (a.widthEmu = c);
|
|
1488
1488
|
const h = T(s, "cy");
|
|
1489
1489
|
h !== void 0 && (a.heightEmu = h);
|
|
1490
|
-
const
|
|
1491
|
-
if (
|
|
1492
|
-
const
|
|
1493
|
-
const k = T(
|
|
1490
|
+
const d = Bt(o, "a:srcRect");
|
|
1491
|
+
if (d) {
|
|
1492
|
+
const l = (g) => {
|
|
1493
|
+
const k = T(d, g);
|
|
1494
1494
|
return k !== void 0 && Number.isFinite(k) ? k / 1e5 : 0;
|
|
1495
|
-
},
|
|
1496
|
-
(
|
|
1495
|
+
}, u = { left: l("l"), top: l("t"), right: l("r"), bottom: l("b") };
|
|
1496
|
+
(u.left || u.top || u.right || u.bottom) && u.left + u.right < 1 && u.top + u.bottom < 1 && (a.crop = u);
|
|
1497
1497
|
}
|
|
1498
1498
|
if (n) {
|
|
1499
|
-
const
|
|
1500
|
-
a.anchorWrap =
|
|
1499
|
+
const l = p(n, "wp:wrapSquare") ?? p(n, "wp:wrapTight") ?? p(n, "wp:wrapThrough"), u = p(n, "wp:wrapNone");
|
|
1500
|
+
a.anchorWrap = l ? "square" : "block";
|
|
1501
1501
|
const g = p(n, "wp:positionH"), k = p(n, "wp:positionV"), S = g && p(g, "wp:align"), y = S && Nt(S);
|
|
1502
|
-
if ((y === "left" || y === "right" || y === "center") && (a.anchorAlign = y),
|
|
1503
|
-
const N =
|
|
1502
|
+
if ((y === "left" || y === "right" || y === "center") && (a.anchorAlign = y), u) {
|
|
1503
|
+
const N = Bt(n, "adec:decorative"), P = T(n, "relativeHeight");
|
|
1504
1504
|
a.anchorFloat = {
|
|
1505
1505
|
behind: m(n, "behindDoc") === "1",
|
|
1506
1506
|
offsetXEmu: Ee(g),
|
|
1507
1507
|
offsetYEmu: Ee(k),
|
|
1508
|
-
relFromH:
|
|
1509
|
-
relFromV:
|
|
1508
|
+
relFromH: wo(g),
|
|
1509
|
+
relFromV: vo(k),
|
|
1510
1510
|
decorative: !!N && m(N, "val") !== "0",
|
|
1511
1511
|
...P !== void 0 ? { z: P } : {}
|
|
1512
1512
|
};
|
|
1513
|
-
} else
|
|
1513
|
+
} else l || e.warnings.add(
|
|
1514
1514
|
"images-anchored",
|
|
1515
1515
|
"Some floating images (overlapping or top-and-bottom wrap) were placed in the text flow."
|
|
1516
1516
|
);
|
|
@@ -1521,26 +1521,26 @@ function Ee(t) {
|
|
|
1521
1521
|
const e = t && p(t, "wp:posOffset"), n = e ? Number(Nt(e).trim()) : NaN;
|
|
1522
1522
|
return Number.isFinite(n) ? n : 0;
|
|
1523
1523
|
}
|
|
1524
|
-
const
|
|
1525
|
-
function
|
|
1524
|
+
const mo = /* @__PURE__ */ new Set(["page", "margin", "column", "leftMargin", "rightMargin", "character"]), go = /* @__PURE__ */ new Set(["page", "margin", "paragraph", "line", "topMargin", "bottomMargin"]);
|
|
1525
|
+
function wo(t) {
|
|
1526
1526
|
const e = t && m(t, "relativeFrom");
|
|
1527
|
-
return e &&
|
|
1527
|
+
return e && mo.has(e) ? e : "column";
|
|
1528
1528
|
}
|
|
1529
|
-
function
|
|
1529
|
+
function vo(t) {
|
|
1530
1530
|
const e = t && m(t, "relativeFrom");
|
|
1531
|
-
return e &&
|
|
1531
|
+
return e && go.has(e) ? e : "paragraph";
|
|
1532
1532
|
}
|
|
1533
|
-
function
|
|
1534
|
-
const n =
|
|
1533
|
+
function ko(t, e) {
|
|
1534
|
+
const n = Bt(t, "v:imagedata"), o = n && m(n, "r:id");
|
|
1535
1535
|
if (!o) {
|
|
1536
1536
|
e.warnings.add("images-skipped", "A legacy picture without an image reference was skipped.");
|
|
1537
1537
|
return;
|
|
1538
1538
|
}
|
|
1539
|
-
const i = { kind: "image", relId: o, anchored: !1 }, r =
|
|
1540
|
-
const
|
|
1541
|
-
return
|
|
1542
|
-
},
|
|
1543
|
-
|
|
1539
|
+
const i = { kind: "image", relId: o, anchored: !1 }, r = Bt(t, "v:shape"), s = (r && m(r, "style")) ?? "", a = (d) => {
|
|
1540
|
+
const l = s.match(new RegExp(`(?:^|;)\\s*${d}:([\\d.]+)pt`));
|
|
1541
|
+
return l ? Number(l[1]) * 12700 : void 0;
|
|
1542
|
+
}, c = a("width");
|
|
1543
|
+
c !== void 0 && (i.widthEmu = c);
|
|
1544
1544
|
const h = a("height");
|
|
1545
1545
|
return h !== void 0 && (i.heightEmu = h), i;
|
|
1546
1546
|
}
|
|
@@ -1555,7 +1555,7 @@ function qe(t) {
|
|
|
1555
1555
|
const s = e("w:left");
|
|
1556
1556
|
return s !== void 0 && (n.left = s), Object.keys(n).length > 0 ? n : void 0;
|
|
1557
1557
|
}
|
|
1558
|
-
function
|
|
1558
|
+
function bo(t) {
|
|
1559
1559
|
if (!t) return;
|
|
1560
1560
|
const e = {}, n = p(t, "w:trHeight");
|
|
1561
1561
|
if (n) {
|
|
@@ -1564,14 +1564,14 @@ function ko(t) {
|
|
|
1564
1564
|
}
|
|
1565
1565
|
return ct(p(t, "w:cantSplit")) && (e.cantSplit = !0), ct(p(t, "w:tblHeader")) && (e.tblHeader = !0), Object.keys(e).length > 0 ? e : void 0;
|
|
1566
1566
|
}
|
|
1567
|
-
function
|
|
1567
|
+
function yo(t, e) {
|
|
1568
1568
|
const n = [];
|
|
1569
1569
|
for (const s of mt(t, "w:tr")) {
|
|
1570
1570
|
const a = [];
|
|
1571
|
-
for (const
|
|
1572
|
-
a.push(
|
|
1573
|
-
const
|
|
1574
|
-
h && (
|
|
1571
|
+
for (const d of mt(s, "w:tc"))
|
|
1572
|
+
a.push(To(d, e));
|
|
1573
|
+
const c = { cells: a }, h = bo(p(s, "w:trPr"));
|
|
1574
|
+
h && (c.props = h), n.push(c);
|
|
1575
1575
|
}
|
|
1576
1576
|
const o = { kind: "table", rows: n }, i = p(t, "w:tblGrid");
|
|
1577
1577
|
if (i) {
|
|
@@ -1598,14 +1598,14 @@ function bo(t, e) {
|
|
|
1598
1598
|
};
|
|
1599
1599
|
}
|
|
1600
1600
|
p(r, "w:tblBorders") && (o.bordersSpecified = !0);
|
|
1601
|
-
const
|
|
1602
|
-
|
|
1601
|
+
const c = ie(p(r, "w:tblBorders"));
|
|
1602
|
+
c && (o.borders = c);
|
|
1603
1603
|
const h = Ut(p(r, "w:shd"));
|
|
1604
1604
|
h && (o.shd = h);
|
|
1605
|
-
const
|
|
1606
|
-
|
|
1607
|
-
const
|
|
1608
|
-
|
|
1605
|
+
const d = qe(p(r, "w:tblCellMar"));
|
|
1606
|
+
d && (o.cellMarginTwips = d);
|
|
1607
|
+
const l = p(r, "w:tblLayout"), u = l ? m(l, "w:type") : void 0, g = p(r, "w:tblW"), k = g && m(g, "w:type"), S = g ? T(g, "w:w") : void 0, y = k === "pct" && (S ?? 0) > 0;
|
|
1608
|
+
u === "autofit" ? o.widthMode = y ? "autofitWindow" : "autofitContents" : u !== "fixed" && y && (o.widthMode = "autofitWindow"), o.widthMode || (k === "dxa" && S !== void 0 && S > 0 ? o.preferredWidthTwips = S : y && u === "fixed" && (o.preferredWidthPct = (S ?? 0) / 50));
|
|
1609
1609
|
const N = p(r, "w:jc"), P = N ? m(N, "w:val") : void 0;
|
|
1610
1610
|
P === "center" ? o.align = "center" : (P === "right" || P === "end") && (o.align = "right");
|
|
1611
1611
|
const z = p(r, "w:tblInd");
|
|
@@ -1614,8 +1614,8 @@ function bo(t, e) {
|
|
|
1614
1614
|
E !== void 0 && E !== 0 && (Z === "dxa" || Z === void 0) && (o.indentTwips = E);
|
|
1615
1615
|
}
|
|
1616
1616
|
ct(p(r, "w:bidiVisual")) && (o.bidiVisual = !0);
|
|
1617
|
-
const
|
|
1618
|
-
|
|
1617
|
+
const D = ht(r, "w:tblOverlap");
|
|
1618
|
+
D === "never" ? o.overlap = "never" : D === "overlap" && (o.overlap = "overlap");
|
|
1619
1619
|
const nt = ht(r, "w:tblCaption");
|
|
1620
1620
|
nt && (o.caption = nt);
|
|
1621
1621
|
const lt = ht(r, "w:tblDescription");
|
|
@@ -1623,63 +1623,63 @@ function bo(t, e) {
|
|
|
1623
1623
|
}
|
|
1624
1624
|
return o;
|
|
1625
1625
|
}
|
|
1626
|
-
function
|
|
1626
|
+
function To(t, e) {
|
|
1627
1627
|
const n = p(t, "w:tcPr"), o = (n && T(p(n, "w:gridSpan"), "w:val")) ?? 1, i = n && p(n, "w:vMerge"), r = !!i && (m(i, "w:val") ?? "continue") === "continue", s = [], a = e.blockSdtStack;
|
|
1628
|
-
e.blockSdtStack = [],
|
|
1629
|
-
const
|
|
1628
|
+
e.blockSdtStack = [], Ft(dt(t), s, e), e.blockSdtStack = a;
|
|
1629
|
+
const c = { blocks: s, gridSpan: o, vMergeContinue: r };
|
|
1630
1630
|
if (n) {
|
|
1631
|
-
p(n, "w:tcBorders") && (
|
|
1631
|
+
p(n, "w:tcBorders") && (c.bordersSpecified = !0);
|
|
1632
1632
|
const h = ie(p(n, "w:tcBorders"));
|
|
1633
|
-
h && (
|
|
1634
|
-
const
|
|
1635
|
-
|
|
1636
|
-
const
|
|
1637
|
-
|
|
1638
|
-
const
|
|
1639
|
-
if (
|
|
1640
|
-
const N = m(
|
|
1641
|
-
N === "pct" ?
|
|
1633
|
+
h && (c.borders = h);
|
|
1634
|
+
const d = Ut(p(n, "w:shd"));
|
|
1635
|
+
d && (c.shd = d);
|
|
1636
|
+
const l = qe(p(n, "w:tcMar"));
|
|
1637
|
+
l && (c.marginTwips = l);
|
|
1638
|
+
const u = p(n, "w:tcW"), g = u ? T(u, "w:w") : void 0;
|
|
1639
|
+
if (u && g !== void 0 && g > 0) {
|
|
1640
|
+
const N = m(u, "w:type");
|
|
1641
|
+
N === "pct" ? c.preferredWidth = { type: "pct", frac: g / 5e3 } : (N === "dxa" || N === void 0) && (c.preferredWidth = { type: "abs", twips: g });
|
|
1642
1642
|
}
|
|
1643
1643
|
const k = p(n, "w:vAlign"), S = k && m(k, "w:val");
|
|
1644
|
-
(S === "center" || S === "bottom") && (
|
|
1644
|
+
(S === "center" || S === "bottom") && (c.vAlign = S);
|
|
1645
1645
|
const y = ht(n, "w:textDirection");
|
|
1646
|
-
(y === "tbRl" || y === "btLr" || y === "lrTbV" || y === "tbRlV" || y === "tbLrV") && (
|
|
1646
|
+
(y === "tbRl" || y === "btLr" || y === "lrTbV" || y === "tbRlV" || y === "tbLrV") && (c.textDirection = y), ct(p(n, "w:noWrap")) && (c.noWrap = !0), ct(p(n, "w:tcFitText")) && (c.fitText = !0), ct(p(n, "w:hideMark")) && (c.hideMark = !0);
|
|
1647
1647
|
}
|
|
1648
|
-
return
|
|
1648
|
+
return c;
|
|
1649
1649
|
}
|
|
1650
|
-
function
|
|
1650
|
+
function Ke(t) {
|
|
1651
1651
|
if (!t) return null;
|
|
1652
1652
|
const e = { type: "richText" }, n = p(t, "w:alias"), o = n && m(n, "w:val");
|
|
1653
1653
|
o && (e.alias = o);
|
|
1654
1654
|
const i = p(t, "w:tag"), r = i && m(i, "w:val");
|
|
1655
1655
|
r && (e.tag = r), p(t, "w:text") && (e.type = "plainText");
|
|
1656
1656
|
const s = p(t, "w:dropDownList") ?? p(t, "w:comboBox");
|
|
1657
|
-
s && (e.type = s.tagName === "w:dropDownList" ? "dropDown" : "comboBox", e.listItems = mt(s, "w:listItem").map((
|
|
1658
|
-
display: m(
|
|
1659
|
-
value: m(
|
|
1657
|
+
s && (e.type = s.tagName === "w:dropDownList" ? "dropDown" : "comboBox", e.listItems = mt(s, "w:listItem").map((l) => ({
|
|
1658
|
+
display: m(l, "w:displayText") ?? m(l, "w:value") ?? "",
|
|
1659
|
+
value: m(l, "w:value") ?? m(l, "w:displayText") ?? ""
|
|
1660
1660
|
})));
|
|
1661
1661
|
const a = p(t, "w:date");
|
|
1662
1662
|
if (a) {
|
|
1663
1663
|
e.type = "date";
|
|
1664
|
-
const
|
|
1665
|
-
|
|
1664
|
+
const l = p(a, "w:dateFormat"), u = l && m(l, "w:val");
|
|
1665
|
+
u && (e.dateFormat = u);
|
|
1666
1666
|
}
|
|
1667
|
-
const
|
|
1668
|
-
if (
|
|
1667
|
+
const c = p(t, "w14:checkbox");
|
|
1668
|
+
if (c) {
|
|
1669
1669
|
e.type = "checkbox";
|
|
1670
|
-
const
|
|
1671
|
-
e.checked =
|
|
1670
|
+
const l = p(c, "w14:checked"), u = l && m(l, "w14:val");
|
|
1671
|
+
e.checked = u === "1" || u === "true";
|
|
1672
1672
|
}
|
|
1673
1673
|
if (e.type === "richText" && r && /^(wesign:signature|signature)(:|$)/i.test(r)) {
|
|
1674
1674
|
e.type = "signature";
|
|
1675
|
-
const
|
|
1676
|
-
|
|
1675
|
+
const l = r.split(":"), u = l.length > 2 ? l.slice(2).join(":") : void 0;
|
|
1676
|
+
u && (e.participantId = u), o && !e.signerName && (e.signerName = o);
|
|
1677
1677
|
}
|
|
1678
1678
|
p(t, "w:showingPlcHdr") && (e.placeholder = !0);
|
|
1679
|
-
const h = p(t, "w:lock"),
|
|
1680
|
-
return (
|
|
1679
|
+
const h = p(t, "w:lock"), d = h && m(h, "w:val");
|
|
1680
|
+
return (d === "contentLocked" || d === "sdtContentLocked") && (e.lockContent = !0), (d === "sdtLocked" || d === "sdtContentLocked") && (e.lockControl = !0), e;
|
|
1681
1681
|
}
|
|
1682
|
-
function
|
|
1682
|
+
function So(t, e) {
|
|
1683
1683
|
const n = {}, o = p(t, "w:pgSz"), i = T(o, "w:w");
|
|
1684
1684
|
i !== void 0 && (n.pageWidthTwips = i);
|
|
1685
1685
|
const r = T(o, "w:h");
|
|
@@ -1695,8 +1695,8 @@ function To(t, e) {
|
|
|
1695
1695
|
}
|
|
1696
1696
|
const a = Me(mt(t, "w:headerReference"));
|
|
1697
1697
|
a && (n.headerRefs = a);
|
|
1698
|
-
const
|
|
1699
|
-
|
|
1698
|
+
const c = Me(mt(t, "w:footerReference"));
|
|
1699
|
+
c && (n.footerRefs = c), p(t, "w:titlePg") && (n.titlePg = !0);
|
|
1700
1700
|
const h = p(t, "w:cols");
|
|
1701
1701
|
if (h) {
|
|
1702
1702
|
const k = mt(h, "w:col"), S = T(h, "w:num") ?? (k.length > 1 ? k.length : 1);
|
|
@@ -1712,27 +1712,27 @@ function To(t, e) {
|
|
|
1712
1712
|
}
|
|
1713
1713
|
}
|
|
1714
1714
|
}
|
|
1715
|
-
const
|
|
1716
|
-
if (
|
|
1715
|
+
const d = p(t, "w:pgBorders");
|
|
1716
|
+
if (d) {
|
|
1717
1717
|
const S = {
|
|
1718
|
-
offsetFrom: m(
|
|
1718
|
+
offsetFrom: m(d, "w:offsetFrom") === "text" ? "text" : "page"
|
|
1719
1719
|
}, y = (N) => {
|
|
1720
|
-
const P = p(
|
|
1720
|
+
const P = p(d, "w:" + N);
|
|
1721
1721
|
if (!P) return;
|
|
1722
|
-
const z = T(P, "w:sz"),
|
|
1722
|
+
const z = T(P, "w:sz"), D = T(P, "w:space"), nt = m(P, "w:color");
|
|
1723
1723
|
S[N] = {
|
|
1724
1724
|
style: m(P, "w:val") ?? "single",
|
|
1725
1725
|
...z !== void 0 ? { sz: z } : {},
|
|
1726
|
-
...
|
|
1726
|
+
...D !== void 0 ? { space: D } : {},
|
|
1727
1727
|
...nt !== void 0 ? { color: nt } : {}
|
|
1728
1728
|
};
|
|
1729
1729
|
};
|
|
1730
1730
|
y("top"), y("right"), y("bottom"), y("left"), (S.top || S.right || S.bottom || S.left) && (n.pageBorders = S);
|
|
1731
1731
|
}
|
|
1732
|
-
const
|
|
1733
|
-
|
|
1734
|
-
const
|
|
1735
|
-
|
|
1732
|
+
const l = T(p(t, "w:pgNumType"), "w:start");
|
|
1733
|
+
l !== void 0 && (n.pageNumberStart = l);
|
|
1734
|
+
const u = Ve(p(t, "w:lnNumType"));
|
|
1735
|
+
u && (n.lineNumbering = u);
|
|
1736
1736
|
const g = ht(t, "w:type");
|
|
1737
1737
|
return (g === "evenPage" || g === "oddPage") && (n.breakType = g), n;
|
|
1738
1738
|
}
|
|
@@ -1747,8 +1747,8 @@ function Me(t) {
|
|
|
1747
1747
|
}
|
|
1748
1748
|
return Object.keys(e).length > 0 ? e : void 0;
|
|
1749
1749
|
}
|
|
1750
|
-
function
|
|
1751
|
-
const i = /* @__PURE__ */ new Map(), r =
|
|
1750
|
+
function Po(t, e, n, o = {}) {
|
|
1751
|
+
const i = /* @__PURE__ */ new Map(), r = bt(Pt(t, e), "w:footnotes");
|
|
1752
1752
|
if (!r) return i;
|
|
1753
1753
|
const s = {
|
|
1754
1754
|
warnings: n,
|
|
@@ -1767,15 +1767,15 @@ function So(t, e, n, o = {}) {
|
|
|
1767
1767
|
fieldTrack: se()
|
|
1768
1768
|
};
|
|
1769
1769
|
for (const a of mt(r, "w:footnote")) {
|
|
1770
|
-
const
|
|
1771
|
-
if (
|
|
1772
|
-
const
|
|
1773
|
-
|
|
1770
|
+
const c = m(a, "w:id");
|
|
1771
|
+
if (c === void 0 || m(a, "w:type")) continue;
|
|
1772
|
+
const d = [];
|
|
1773
|
+
Ft(dt(a), d, s), i.set(c, d);
|
|
1774
1774
|
}
|
|
1775
1775
|
return i;
|
|
1776
1776
|
}
|
|
1777
|
-
function
|
|
1778
|
-
const i = /* @__PURE__ */ new Map(), r =
|
|
1777
|
+
function xo(t, e, n, o = {}) {
|
|
1778
|
+
const i = /* @__PURE__ */ new Map(), r = bt(Pt(t, e), "w:endnotes");
|
|
1779
1779
|
if (!r) return i;
|
|
1780
1780
|
const s = {
|
|
1781
1781
|
warnings: n,
|
|
@@ -1794,14 +1794,14 @@ function Po(t, e, n, o = {}) {
|
|
|
1794
1794
|
fieldTrack: se()
|
|
1795
1795
|
};
|
|
1796
1796
|
for (const a of mt(r, "w:endnote")) {
|
|
1797
|
-
const
|
|
1798
|
-
if (
|
|
1799
|
-
const
|
|
1800
|
-
|
|
1797
|
+
const c = m(a, "w:id");
|
|
1798
|
+
if (c === void 0 || m(a, "w:type")) continue;
|
|
1799
|
+
const d = [];
|
|
1800
|
+
Ft(dt(a), d, s), i.set(c, d);
|
|
1801
1801
|
}
|
|
1802
1802
|
return i;
|
|
1803
1803
|
}
|
|
1804
|
-
const
|
|
1804
|
+
const Ao = /* @__PURE__ */ new Set(["single", "double", "dashed", "dotted", "thick", "none"]);
|
|
1805
1805
|
function Re(t) {
|
|
1806
1806
|
const e = { count: t.count, gapPx: M($(t.spaceTwips ?? 720)) };
|
|
1807
1807
|
return t.sep && (e.sep = !0), t.cols && t.cols.length === t.count && (e.cols = t.cols.map((n) => ({
|
|
@@ -1813,7 +1813,7 @@ function Ne(t) {
|
|
|
1813
1813
|
const e = (a) => {
|
|
1814
1814
|
if (!a) return;
|
|
1815
1815
|
const h = {
|
|
1816
|
-
style:
|
|
1816
|
+
style: Ao.has(a.style) ? a.style : "single",
|
|
1817
1817
|
widthPx: a.sz !== void 0 ? M(a.sz / 6) : 1,
|
|
1818
1818
|
// w:sz is eighth-points
|
|
1819
1819
|
color: !a.color || a.color === "auto" ? "#000000" : `#${a.color}`
|
|
@@ -1828,12 +1828,12 @@ function Ne(t) {
|
|
|
1828
1828
|
const s = e(t.left);
|
|
1829
1829
|
return s && (n.left = s), n;
|
|
1830
1830
|
}
|
|
1831
|
-
function
|
|
1831
|
+
function Be(t) {
|
|
1832
1832
|
const e = {};
|
|
1833
1833
|
return t.countBy !== void 0 && (e.countBy = t.countBy), t.start !== void 0 && (e.start = t.start), t.restart !== void 0 && (e.restart = t.restart), t.distanceTwips !== void 0 && (e.distancePx = M($(t.distanceTwips))), e;
|
|
1834
1834
|
}
|
|
1835
|
-
const
|
|
1836
|
-
},
|
|
1835
|
+
const Io = () => {
|
|
1836
|
+
}, Je = {
|
|
1837
1837
|
fontFamily: "Times New Roman, serif",
|
|
1838
1838
|
fontSizePx: 16,
|
|
1839
1839
|
// 12pt
|
|
@@ -1849,73 +1849,73 @@ const Ao = () => {
|
|
|
1849
1849
|
spaceAfterPx: 0,
|
|
1850
1850
|
indentFirstLinePx: 0,
|
|
1851
1851
|
indentLeftPx: 0
|
|
1852
|
-
},
|
|
1852
|
+
}, _t = { top: 0, right: 108, bottom: 0, left: 108 }, jt = {
|
|
1853
1853
|
pageWidthPx: 816,
|
|
1854
1854
|
pageHeightPx: 1056,
|
|
1855
1855
|
marginPx: { top: 96, right: 96, bottom: 96, left: 96 }
|
|
1856
1856
|
};
|
|
1857
|
-
function
|
|
1857
|
+
function Eo(t, e, n = {}, o = /* @__PURE__ */ new Map(), i = () => ({}), r, s) {
|
|
1858
1858
|
let a = 0;
|
|
1859
|
-
const
|
|
1860
|
-
let w = k.get(
|
|
1861
|
-
return w === void 0 && (w = String(k.size + 1), k.set(
|
|
1862
|
-
}, N = /* @__PURE__ */ new Map(), P = [], z = (
|
|
1863
|
-
let w = N.get(
|
|
1864
|
-
return w === void 0 && (w = String(N.size + 1), N.set(
|
|
1865
|
-
},
|
|
1866
|
-
const w =
|
|
1859
|
+
const c = () => `i${a++}`, h = /* @__PURE__ */ new Map(), d = /* @__PURE__ */ new Map(), l = /* @__PURE__ */ new Map(), u = /* @__PURE__ */ new Map(), g = /* @__PURE__ */ new Map(), k = /* @__PURE__ */ new Map(), S = [], y = (f) => {
|
|
1860
|
+
let w = k.get(f);
|
|
1861
|
+
return w === void 0 && (w = String(k.size + 1), k.set(f, w), S.push(f)), w;
|
|
1862
|
+
}, N = /* @__PURE__ */ new Map(), P = [], z = (f) => {
|
|
1863
|
+
let w = N.get(f);
|
|
1864
|
+
return w === void 0 && (w = String(N.size + 1), N.set(f, w), P.push(f)), w;
|
|
1865
|
+
}, D = /* @__PURE__ */ new Map(), nt = (f) => {
|
|
1866
|
+
const w = D.get(f);
|
|
1867
1867
|
if (w) return w;
|
|
1868
|
-
const
|
|
1869
|
-
if (!
|
|
1870
|
-
const
|
|
1871
|
-
return
|
|
1872
|
-
}, lt = le(e.run(void 0, {})), Z =
|
|
1868
|
+
const B = o.get(f);
|
|
1869
|
+
if (!B) return;
|
|
1870
|
+
const W = No(B);
|
|
1871
|
+
return D.set(f, W), W;
|
|
1872
|
+
}, lt = le(e.run(void 0, {})), Z = Fe(e.para({})), E = () => ({
|
|
1873
1873
|
kind: "paragraph",
|
|
1874
|
-
id:
|
|
1874
|
+
id: c(),
|
|
1875
1875
|
revision: 0,
|
|
1876
1876
|
runs: [{ text: "", style: { ...lt } }],
|
|
1877
1877
|
style: { ...Z }
|
|
1878
|
-
}), R = (
|
|
1878
|
+
}), R = (f, w) => {
|
|
1879
1879
|
if (!w) return 0;
|
|
1880
|
-
const
|
|
1881
|
-
if (!
|
|
1880
|
+
const B = nt(w.numId);
|
|
1881
|
+
if (!B)
|
|
1882
1882
|
return t.add("list-missing", "A list reference had no matching definition — markers were dropped."), 0;
|
|
1883
|
-
|
|
1884
|
-
const
|
|
1885
|
-
return
|
|
1886
|
-
},
|
|
1887
|
-
const w =
|
|
1883
|
+
f.list = { listId: w.numId, level: w.level };
|
|
1884
|
+
const W = B.levels[Math.min(w.level, B.levels.length - 1)], I = W ? W.indentLeftPx : 0;
|
|
1885
|
+
return f.indentLeftPx = Math.max(0, M(f.indentLeftPx - I)), f.indentFirstLinePx = 0, I;
|
|
1886
|
+
}, _ = (f) => {
|
|
1887
|
+
const w = f.sectionPgSize;
|
|
1888
1888
|
return !!w && !!r && (w.w !== r.w || w.h !== r.h);
|
|
1889
|
-
},
|
|
1889
|
+
}, j = (f) => _(f) || !!f.sectionColumns || f.sectionPageNumberStart !== void 0 || !!f.sectionPgBorders || // An even/odd page-parity break or line numbering is a real, page-breaking
|
|
1890
1890
|
// section even when the geometry is identical to the document section.
|
|
1891
|
-
|
|
1891
|
+
f.sectionBreakType === "evenPage" || f.sectionBreakType === "oddPage" || !!f.sectionLineNumbering, F = (f) => {
|
|
1892
1892
|
const w = {};
|
|
1893
|
-
return
|
|
1894
|
-
}, A = (
|
|
1895
|
-
for (let w =
|
|
1893
|
+
return f.sectionPgSize && (w.pageWidthPx = M($(f.sectionPgSize.w)), w.pageHeightPx = M($(f.sectionPgSize.h))), f.sectionMarginTwips && (w.marginPx = Yt(f.sectionMarginTwips)), f.sectionColumns && (w.columns = Re(f.sectionColumns)), f.sectionPageNumberStart !== void 0 && (w.pageNumberStart = f.sectionPageNumberStart), f.sectionHeaderDistTwips !== void 0 && (w.headerDistancePx = M($(f.sectionHeaderDistTwips))), f.sectionFooterDistTwips !== void 0 && (w.footerDistancePx = M($(f.sectionFooterDistTwips))), f.sectionPgBorders && (w.pageBorders = Ne(f.sectionPgBorders)), f.sectionLineNumbering && (w.lineNumbering = Be(f.sectionLineNumbering)), w;
|
|
1894
|
+
}, A = (f) => {
|
|
1895
|
+
for (let w = f.length - 1; w >= 0; w--) if (f[w].kind === "paragraph") return f[w];
|
|
1896
1896
|
};
|
|
1897
|
-
let
|
|
1898
|
-
const tt = (
|
|
1899
|
-
const
|
|
1900
|
-
let
|
|
1897
|
+
let C;
|
|
1898
|
+
const tt = (f, w, B = Io) => {
|
|
1899
|
+
const W = [];
|
|
1900
|
+
let I = !1, H = !1, J = !1, V = !1;
|
|
1901
1901
|
const X = (b) => b.some((v) => v.kind !== "paragraph" || v.runs.some((x) => x.text.trim().length > 0 && !x.style.hidden));
|
|
1902
|
-
let
|
|
1902
|
+
let Y = 0, L = null;
|
|
1903
1903
|
const wt = (b) => {
|
|
1904
1904
|
for (const v of b)
|
|
1905
1905
|
if (v.kind === "paragraph" && v.runs.some((x) => x.text.trim().length > 0 && !x.style.hidden)) return v;
|
|
1906
1906
|
}, O = (b) => {
|
|
1907
|
-
for (let v = b + 1; v <
|
|
1908
|
-
const x =
|
|
1907
|
+
for (let v = b + 1; v < f.length; v++) {
|
|
1908
|
+
const x = f[v];
|
|
1909
1909
|
if (x.kind === "paragraph" && x.props.sectionBreak !== void 0)
|
|
1910
1910
|
return { lineNumbering: x.props.sectionLineNumbering, pageNumberStart: x.props.sectionPageNumberStart };
|
|
1911
1911
|
}
|
|
1912
1912
|
return { lineNumbering: s?.lineNumbering, pageNumberStart: s?.pageNumberStart };
|
|
1913
|
-
},
|
|
1913
|
+
}, q = (b, v) => {
|
|
1914
1914
|
const x = O(v);
|
|
1915
1915
|
return JSON.stringify(b.sectionLineNumbering ?? null) !== JSON.stringify(x.lineNumbering ?? null) || (b.sectionPageNumberStart ?? null) !== (x.pageNumberStart ?? null);
|
|
1916
1916
|
}, st = (b) => {
|
|
1917
|
-
for (let v = b + 1; v <
|
|
1918
|
-
const x =
|
|
1917
|
+
for (let v = b + 1; v < f.length; v++) {
|
|
1918
|
+
const x = f[v];
|
|
1919
1919
|
if (x.kind !== "paragraph") return !1;
|
|
1920
1920
|
if (x.inlines.some(
|
|
1921
1921
|
(ut) => ut.kind === "run" && ut.text.trim().length > 0 && !ut.props.vanish
|
|
@@ -1924,241 +1924,241 @@ function Io(t, e, n = {}, o = /* @__PURE__ */ new Map(), i = () => ({}), r, s) {
|
|
|
1924
1924
|
}
|
|
1925
1925
|
return !1;
|
|
1926
1926
|
};
|
|
1927
|
-
for (let b = 0; b <
|
|
1928
|
-
const v =
|
|
1927
|
+
for (let b = 0; b < f.length; b++) {
|
|
1928
|
+
const v = f[b], x = v.kind === "paragraph" ? ot(v, w, B) : v.kind === "math" ? [{ kind: "equation", id: c(), revision: 0, equation: { root: v.root, display: v.display }, align: v.align ?? "center" }] : [G(v, w, B)];
|
|
1929
1929
|
if (v.fieldId) for (const K of x) K.fieldId = v.fieldId;
|
|
1930
1930
|
if (v.sdtPath) for (const K of x) K.sdtPath = v.sdtPath;
|
|
1931
|
-
if (v.kind === "paragraph" && v.tocField !== void 0 &&
|
|
1931
|
+
if (v.kind === "paragraph" && v.tocField !== void 0 && C === void 0) {
|
|
1932
1932
|
const K = x.find((ut) => ut.kind === "paragraph") ?? x[0];
|
|
1933
|
-
K && (
|
|
1933
|
+
K && (C = { blockId: K.id, instruction: v.tocField });
|
|
1934
1934
|
}
|
|
1935
|
-
if (
|
|
1935
|
+
if (I && x.length > 0) {
|
|
1936
1936
|
const K = x[0];
|
|
1937
|
-
K.kind === "paragraph" && K.runs.every((zt) => zt.text.length === 0 || zt.style.hidden) || ((v.kind === "paragraph" && e.isHeading(v.props.styleId) ||
|
|
1937
|
+
K.kind === "paragraph" && K.runs.every((zt) => zt.text.length === 0 || zt.style.hidden) || ((v.kind === "paragraph" && e.isHeading(v.props.styleId) || H) && (K.kind === "paragraph" ? K.style.pageBreakBefore = !0 : x.unshift({ ...E(), style: { ...Z, pageBreakBefore: !0 } })), I = !1, H = !1);
|
|
1938
1938
|
}
|
|
1939
1939
|
if (v.kind === "paragraph" && v.props.sectionBreak === "page") {
|
|
1940
1940
|
const K = v.props;
|
|
1941
|
-
if (
|
|
1941
|
+
if (j(K) || q(K, b)) {
|
|
1942
1942
|
let ut = A(x);
|
|
1943
1943
|
ut || (ut = E(), x.push(ut));
|
|
1944
1944
|
const zt = K.sectionBreakType ?? "nextPage";
|
|
1945
|
-
ut.style.sectionBreak = { type: zt, props:
|
|
1945
|
+
ut.style.sectionBreak = { type: zt, props: F(K) }, I = !1;
|
|
1946
1946
|
} else
|
|
1947
1947
|
K.sectionHasBands && t.add(
|
|
1948
1948
|
"section-bands-flattened",
|
|
1949
1949
|
"Per-section headers/footers on geometry-preserving section breaks were not applied (the document section's are used)."
|
|
1950
|
-
),
|
|
1950
|
+
), I = !0, H = !J && V || st(b), Y > 0 && L && st(Y - 1) && (L.style.pageBreakBefore = !0);
|
|
1951
1951
|
J = !0;
|
|
1952
1952
|
}
|
|
1953
|
-
v.kind === "paragraph" && v.props.sectionBreak !== void 0 ? (
|
|
1953
|
+
v.kind === "paragraph" && v.props.sectionBreak !== void 0 ? (Y = b + 1, L = null) : L || (L = wt(x) ?? null), W.push(...x), J || (V ||= X(x));
|
|
1954
1954
|
}
|
|
1955
|
-
return Q(
|
|
1956
|
-
}, Q = (
|
|
1957
|
-
const w = (
|
|
1958
|
-
for (let
|
|
1959
|
-
const
|
|
1960
|
-
if (
|
|
1955
|
+
return Q(W), W;
|
|
1956
|
+
}, Q = (f) => {
|
|
1957
|
+
const w = (I) => I.kind === "image" || I.kind === "table", B = (I) => I.kind === "paragraph" && I.runs.every((H) => H.text.trim().length === 0 || H.style.hidden), W = (I) => I.kind === "paragraph" ? I.runs.reduce((H, J) => H + J.text.length, 0) : 0;
|
|
1958
|
+
for (let I = 0; I < f.length; I++) {
|
|
1959
|
+
const H = f[I];
|
|
1960
|
+
if (H.kind !== "paragraph" || !H.style.namedStyle || !e.isHeading(H.style.namedStyle)) continue;
|
|
1961
1961
|
const J = [];
|
|
1962
1962
|
let V = 0, X = -1;
|
|
1963
|
-
for (let
|
|
1964
|
-
const L =
|
|
1963
|
+
for (let Y = I + 1; Y < f.length && Y <= I + 6; Y++) {
|
|
1964
|
+
const L = f[Y];
|
|
1965
1965
|
if (w(L)) {
|
|
1966
|
-
X =
|
|
1966
|
+
X = Y;
|
|
1967
1967
|
break;
|
|
1968
1968
|
}
|
|
1969
1969
|
if (L.kind !== "paragraph") break;
|
|
1970
|
-
if (!
|
|
1971
|
-
if (V >= 2 ||
|
|
1970
|
+
if (!B(L)) {
|
|
1971
|
+
if (V >= 2 || W(L) > 300) break;
|
|
1972
1972
|
V++, J.push(L);
|
|
1973
1973
|
}
|
|
1974
1974
|
}
|
|
1975
1975
|
if (!(X < 0)) {
|
|
1976
|
-
|
|
1977
|
-
for (const
|
|
1976
|
+
H.style.keepWithNext = !0;
|
|
1977
|
+
for (const Y of J) Y.style.keepWithNext = !0;
|
|
1978
1978
|
}
|
|
1979
1979
|
}
|
|
1980
1980
|
};
|
|
1981
|
-
function ot(
|
|
1982
|
-
const
|
|
1983
|
-
let X = [],
|
|
1981
|
+
function ot(f, w, B) {
|
|
1982
|
+
const W = e.para(f.props), I = Fe(W), H = R(I, W.list), J = le(e.run(f.props.styleId, f.props.markRunProps ?? {})), V = [];
|
|
1983
|
+
let X = [], Y = !1, L = !1, wt = !1;
|
|
1984
1984
|
const O = (b) => {
|
|
1985
|
-
const v = { ...
|
|
1985
|
+
const v = { ...I };
|
|
1986
1986
|
return L && (v.pageBreakBefore = !0, L = !1), wt && (v.columnBreakBefore = !0, wt = !1), {
|
|
1987
1987
|
kind: "paragraph",
|
|
1988
|
-
id:
|
|
1988
|
+
id: c(),
|
|
1989
1989
|
revision: 0,
|
|
1990
|
-
runs:
|
|
1990
|
+
runs: kn(b, J),
|
|
1991
1991
|
style: v
|
|
1992
1992
|
};
|
|
1993
|
-
},
|
|
1993
|
+
}, q = () => {
|
|
1994
1994
|
X.length !== 0 && (V.push(O(X)), X = []);
|
|
1995
1995
|
};
|
|
1996
|
-
for (const b of
|
|
1996
|
+
for (const b of f.inlines)
|
|
1997
1997
|
switch (b.kind) {
|
|
1998
1998
|
case "break":
|
|
1999
|
-
!b.page && !b.column ? (t.add("soft-breaks", "Soft line breaks (Shift+Enter) became paragraph breaks."), X.length > 0 ?
|
|
1999
|
+
!b.page && !b.column ? (t.add("soft-breaks", "Soft line breaks (Shift+Enter) became paragraph breaks."), X.length > 0 ? q() : V.push(O([]))) : (X.length > 0 && q(), b.page && (L = !0), b.column && (wt = !0)), Y = !0;
|
|
2000
2000
|
break;
|
|
2001
2001
|
case "image": {
|
|
2002
|
-
const v = it(b, w,
|
|
2003
|
-
v && (
|
|
2002
|
+
const v = it(b, w, I.align);
|
|
2003
|
+
v && (q(), (L || wt) && V.push(O([])), V.push(v), Y = !1);
|
|
2004
2004
|
break;
|
|
2005
2005
|
}
|
|
2006
2006
|
case "run": {
|
|
2007
|
-
const v = e.run(
|
|
2008
|
-
X.push(U(b.text, v,
|
|
2007
|
+
const v = e.run(f.props.styleId, b.props);
|
|
2008
|
+
X.push(U(b.text, v, B, b.sdtPath, b.fieldId)), Y = !1;
|
|
2009
2009
|
break;
|
|
2010
2010
|
}
|
|
2011
2011
|
case "mathInline": {
|
|
2012
|
-
const v = U("", e.run(
|
|
2013
|
-
v.style = { ...v.style, equation: { root: b.root, display: !1 } }, X.push(v),
|
|
2012
|
+
const v = U("", e.run(f.props.styleId, b.props ?? {}), B);
|
|
2013
|
+
v.style = { ...v.style, equation: { root: b.root, display: !1 } }, X.push(v), Y = !1;
|
|
2014
2014
|
break;
|
|
2015
2015
|
}
|
|
2016
2016
|
}
|
|
2017
|
-
|
|
2017
|
+
q(), (Y || V.length === 0) && V.push(O([]));
|
|
2018
2018
|
const st = V.filter((b) => b.kind === "paragraph");
|
|
2019
2019
|
if (st.forEach((b, v) => {
|
|
2020
|
-
v > 0 && (b.style.spaceBeforePx = 0), v < st.length - 1 && (b.style.spaceAfterPx = 0), v > 0 && b.style.list && (delete b.style.list, b.style.indentLeftPx = M(b.style.indentLeftPx +
|
|
2021
|
-
}),
|
|
2020
|
+
v > 0 && (b.style.spaceBeforePx = 0), v < st.length - 1 && (b.style.spaceAfterPx = 0), v > 0 && b.style.list && (delete b.style.list, b.style.indentLeftPx = M(b.style.indentLeftPx + H));
|
|
2021
|
+
}), f.bookmarkMarkers && f.bookmarkMarkers.length > 0 && V[0]) {
|
|
2022
2022
|
const b = V[0], v = b.kind === "paragraph" ? b.runs.reduce((x, K) => x + K.text.length, 0) : 0;
|
|
2023
|
-
for (const x of
|
|
2023
|
+
for (const x of f.bookmarkMarkers) {
|
|
2024
2024
|
const K = { blockId: b.id, offset: Math.min(x.offset, v) };
|
|
2025
|
-
x.kind === "start" && x.name ? h.set(x.id, { name: x.name, pos: K }) : x.kind === "end" &&
|
|
2025
|
+
x.kind === "start" && x.name ? h.set(x.id, { name: x.name, pos: K }) : x.kind === "end" && d.set(x.id, K);
|
|
2026
2026
|
}
|
|
2027
2027
|
}
|
|
2028
|
-
if (
|
|
2028
|
+
if (f.commentMarkers && f.commentMarkers.length > 0 && V[0]) {
|
|
2029
2029
|
const b = V[0], v = b.kind === "paragraph" ? b.runs.reduce((x, K) => x + K.text.length, 0) : 0;
|
|
2030
|
-
for (const x of
|
|
2030
|
+
for (const x of f.commentMarkers) {
|
|
2031
2031
|
const K = { blockId: b.id, offset: Math.min(x.offset, v) };
|
|
2032
|
-
x.kind === "start" ?
|
|
2032
|
+
x.kind === "start" ? l.set(x.id, K) : x.kind === "end" ? u.set(x.id, K) : x.kind === "ref" && g.set(x.id, K);
|
|
2033
2033
|
}
|
|
2034
2034
|
}
|
|
2035
2035
|
return V;
|
|
2036
2036
|
}
|
|
2037
|
-
function it(
|
|
2038
|
-
const
|
|
2039
|
-
if (!
|
|
2040
|
-
if (
|
|
2037
|
+
function it(f, w, B) {
|
|
2038
|
+
const W = w.resolve(f.relId);
|
|
2039
|
+
if (!W) return;
|
|
2040
|
+
if (f.widthEmu === void 0 || f.heightEmu === void 0) {
|
|
2041
2041
|
t.add("images-unsized", "An image without explicit dimensions was skipped.");
|
|
2042
2042
|
return;
|
|
2043
2043
|
}
|
|
2044
|
-
const
|
|
2044
|
+
const I = {
|
|
2045
2045
|
kind: "image",
|
|
2046
|
-
id:
|
|
2046
|
+
id: c(),
|
|
2047
2047
|
revision: 0,
|
|
2048
|
-
src:
|
|
2049
|
-
widthPx: M(Vt(
|
|
2050
|
-
heightPx: M(Vt(
|
|
2051
|
-
align:
|
|
2048
|
+
src: W,
|
|
2049
|
+
widthPx: M(Vt(f.widthEmu)),
|
|
2050
|
+
heightPx: M(Vt(f.heightEmu)),
|
|
2051
|
+
align: f.anchorAlign ?? (B === "justify" ? "left" : B)
|
|
2052
2052
|
};
|
|
2053
|
-
if (
|
|
2054
|
-
left: Xt(
|
|
2055
|
-
top: Xt(
|
|
2056
|
-
right: Xt(
|
|
2057
|
-
bottom: Xt(
|
|
2058
|
-
}),
|
|
2059
|
-
const
|
|
2060
|
-
|
|
2061
|
-
behind:
|
|
2062
|
-
offsetXPx: M(Vt(
|
|
2063
|
-
offsetYPx: M(Vt(
|
|
2064
|
-
relFromH:
|
|
2065
|
-
relFromV:
|
|
2066
|
-
...
|
|
2067
|
-
...
|
|
2053
|
+
if (f.crop && (I.crop = {
|
|
2054
|
+
left: Xt(f.crop.left),
|
|
2055
|
+
top: Xt(f.crop.top),
|
|
2056
|
+
right: Xt(f.crop.right),
|
|
2057
|
+
bottom: Xt(f.crop.bottom)
|
|
2058
|
+
}), f.anchored && f.anchorWrap === "square" && (I.wrap = "square"), f.anchorFloat) {
|
|
2059
|
+
const H = f.anchorFloat;
|
|
2060
|
+
I.anchor = {
|
|
2061
|
+
behind: H.behind,
|
|
2062
|
+
offsetXPx: M(Vt(H.offsetXEmu)),
|
|
2063
|
+
offsetYPx: M(Vt(H.offsetYEmu)),
|
|
2064
|
+
relFromH: H.relFromH,
|
|
2065
|
+
relFromV: H.relFromV,
|
|
2066
|
+
...H.decorative ? { decorative: !0 } : {},
|
|
2067
|
+
...H.z !== void 0 ? { z: H.z } : {}
|
|
2068
2068
|
};
|
|
2069
2069
|
}
|
|
2070
|
-
return
|
|
2070
|
+
return I;
|
|
2071
2071
|
}
|
|
2072
|
-
function U(
|
|
2073
|
-
let
|
|
2072
|
+
function U(f, w, B, W, I) {
|
|
2073
|
+
let H = f;
|
|
2074
2074
|
const J = le(w);
|
|
2075
2075
|
if (w.linkRelId) {
|
|
2076
|
-
const V =
|
|
2076
|
+
const V = B(w.linkRelId);
|
|
2077
2077
|
V ? J.link = V : t.add("links-unresolved", "A hyperlink target could not be resolved and was dropped.");
|
|
2078
2078
|
} else w.linkAnchor && (J.link = `#${w.linkAnchor}`);
|
|
2079
|
-
if (w.footnoteId !== void 0 && (
|
|
2080
|
-
J.sdtPath =
|
|
2081
|
-
const V = n[
|
|
2082
|
-
V?.type === "checkbox" &&
|
|
2079
|
+
if (w.footnoteId !== void 0 && (H = y(w.footnoteId), J.footnoteRef = `fn${w.footnoteId}`, J.verticalAlign = "super"), w.endnoteId !== void 0 && (H = z(w.endnoteId), J.endnoteRef = `en${w.endnoteId}`, J.verticalAlign = "super"), W && W.length > 0) {
|
|
2080
|
+
J.sdtPath = W;
|
|
2081
|
+
const V = n[W[W.length - 1]];
|
|
2082
|
+
V?.type === "checkbox" && H.length > 0 && (H = V.checked ? "☒" : "☐", J.fontFamily = Je.fontFamily);
|
|
2083
2083
|
}
|
|
2084
|
-
return
|
|
2085
|
-
}
|
|
2086
|
-
function et(
|
|
2087
|
-
const J =
|
|
2088
|
-
top:
|
|
2089
|
-
bottom:
|
|
2090
|
-
left:
|
|
2091
|
-
right:
|
|
2092
|
-
}, X =
|
|
2093
|
-
if (X && (
|
|
2094
|
-
const
|
|
2095
|
-
|
|
2084
|
+
return I && (J.fieldId = I), w.styleId && (J.charStyleId = w.styleId), { text: H, style: J };
|
|
2085
|
+
}
|
|
2086
|
+
function et(f, w, B, W, I, H) {
|
|
2087
|
+
const J = f.cell.rowSpan ?? 1, V = {
|
|
2088
|
+
top: f.startRow === 0,
|
|
2089
|
+
bottom: f.startRow + J - 1 === H - 1,
|
|
2090
|
+
left: f.startCol === 0,
|
|
2091
|
+
right: f.startCol + f.colSpan - 1 === I - 1
|
|
2092
|
+
}, X = f.ir?.shd ?? w.shd ?? B.shd;
|
|
2093
|
+
if (X && (f.cell.shading = X), W) {
|
|
2094
|
+
const Y = { cell: f.ir?.borders, table: w.borders, style: B.borders };
|
|
2095
|
+
f.cell.borders = Ln(Y, V);
|
|
2096
2096
|
}
|
|
2097
2097
|
}
|
|
2098
|
-
function G(
|
|
2099
|
-
const
|
|
2100
|
-
const
|
|
2098
|
+
function G(f, w, B) {
|
|
2099
|
+
const W = (O) => {
|
|
2100
|
+
const q = [];
|
|
2101
2101
|
for (const v of O.blocks) {
|
|
2102
|
-
const x = v.kind === "paragraph" ? ot(v, w,
|
|
2102
|
+
const x = v.kind === "paragraph" ? ot(v, w, B) : v.kind === "math" ? [{ kind: "equation", id: c(), revision: 0, equation: { root: v.root, display: v.display }, align: v.align ?? "center" }] : [G(v, w, B)];
|
|
2103
2103
|
if (v.sdtPath) for (const K of x) K.sdtPath = v.sdtPath;
|
|
2104
|
-
|
|
2104
|
+
q.push(...x);
|
|
2105
2105
|
}
|
|
2106
|
-
const st = { id:
|
|
2106
|
+
const st = { id: c(), blocks: q.length > 0 ? q : [E()] };
|
|
2107
2107
|
O.gridSpan > 1 && (st.colSpan = O.gridSpan);
|
|
2108
|
-
const b = (v) => O.marginTwips?.[v] ??
|
|
2109
|
-
return st.margin =
|
|
2110
|
-
},
|
|
2108
|
+
const b = (v) => O.marginTwips?.[v] ?? f.cellMarginTwips?.[v] ?? _t[v];
|
|
2109
|
+
return st.margin = Yt({ top: b("top"), right: b("right"), bottom: b("bottom"), left: b("left") }), O.preferredWidth && (st.preferredWidth = O.preferredWidth.type === "pct" ? { type: "pct", px: O.preferredWidth.frac } : { type: "abs", px: M($(O.preferredWidth.twips)) }), O.vAlign && (st.vAlign = O.vAlign), O.textDirection && (st.textDirection = O.textDirection), O.noWrap && (st.noWrap = !0), O.fitText && (st.fitText = !0), O.hideMark && (st.hideMark = !0), st;
|
|
2110
|
+
}, I = Math.max(1, ...f.rows.map((O) => O.cells.reduce((q, st) => q + Math.max(1, st.gridSpan), 0))), H = new Array(I), J = f.rows.map((O, q) => {
|
|
2111
2111
|
const st = [];
|
|
2112
2112
|
let b = 0;
|
|
2113
2113
|
for (const v of O.cells) {
|
|
2114
|
-
if (b >=
|
|
2115
|
-
const x = Math.max(1, Math.min(v.gridSpan,
|
|
2114
|
+
if (b >= I) break;
|
|
2115
|
+
const x = Math.max(1, Math.min(v.gridSpan, I - b));
|
|
2116
2116
|
if (v.vMergeContinue) {
|
|
2117
|
-
const ut =
|
|
2117
|
+
const ut = H[b];
|
|
2118
2118
|
ut ? ut.rowSpan = (ut.rowSpan ?? 1) + 1 : t.add("cell-vmerge-orphan", "A merged-cell continuation had no cell above to extend."), b += x;
|
|
2119
2119
|
continue;
|
|
2120
2120
|
}
|
|
2121
|
-
const K =
|
|
2122
|
-
st.push({ cell: K, ir: v, startRow:
|
|
2123
|
-
for (let ut = 0; ut < x && b + ut <
|
|
2121
|
+
const K = W(v);
|
|
2122
|
+
st.push({ cell: K, ir: v, startRow: q, startCol: b, colSpan: x });
|
|
2123
|
+
for (let ut = 0; ut < x && b + ut < I; ut++) H[b + ut] = K;
|
|
2124
2124
|
b += x;
|
|
2125
2125
|
}
|
|
2126
|
-
for (; b <
|
|
2127
|
-
const v = { id:
|
|
2128
|
-
st.push({ cell: v, ir: null, startRow:
|
|
2126
|
+
for (; b < I; ) {
|
|
2127
|
+
const v = { id: c(), blocks: [E()] };
|
|
2128
|
+
st.push({ cell: v, ir: null, startRow: q, startCol: b, colSpan: 1 }), H[b] = v, b += 1;
|
|
2129
2129
|
}
|
|
2130
2130
|
return st;
|
|
2131
|
-
}), V =
|
|
2132
|
-
for (const O of J) for (const
|
|
2133
|
-
const
|
|
2134
|
-
const st = { cells: O.map((v) => v.cell) }, b =
|
|
2131
|
+
}), V = f.styleId ? i(f.styleId) : {}, X = !!V.borders || !!f.borders || !!f.bordersSpecified || f.rows.some((O) => O.cells.some((q) => q.borders || q.bordersSpecified));
|
|
2132
|
+
for (const O of J) for (const q of O) et(q, f, V, X, I, f.rows.length);
|
|
2133
|
+
const Y = J.map((O, q) => {
|
|
2134
|
+
const st = { cells: O.map((v) => v.cell) }, b = f.rows[q]?.props;
|
|
2135
2135
|
if (b) {
|
|
2136
2136
|
const v = {};
|
|
2137
2137
|
b.heightTwips !== void 0 && b.heightRule && (v.height = { value: M($(b.heightTwips)), rule: b.heightRule }), b.cantSplit && (v.cantSplit = !0), b.tblHeader && (v.repeatHeader = !0), Object.keys(v).length > 0 && (st.props = v);
|
|
2138
2138
|
}
|
|
2139
2139
|
return st;
|
|
2140
|
-
}), L = { kind: "table", id:
|
|
2141
|
-
|
|
2142
|
-
const wt =
|
|
2143
|
-
if (wt ? L.defaultBorders = wt :
|
|
2144
|
-
const O =
|
|
2145
|
-
L.defaultCellMargin =
|
|
2146
|
-
top: O.top ??
|
|
2147
|
-
right: O.right ??
|
|
2148
|
-
bottom: O.bottom ??
|
|
2149
|
-
left: O.left ??
|
|
2140
|
+
}), L = { kind: "table", id: c(), revision: 0, rows: Y };
|
|
2141
|
+
f.styleId && (L.styleId = f.styleId), f.look && (L.condOverrides = { ...f.look }), L.colFractions = Oo(f.colWidthsTwips, I), f.widthMode && f.widthMode !== "fixed" && (L.widthMode = f.widthMode), f.preferredWidthTwips ? L.preferredWidth = { type: "px", value: M($(f.preferredWidthTwips)) } : f.preferredWidthPct && (L.preferredWidth = { type: "pct", value: f.preferredWidthPct }), f.align && f.align !== "left" && (L.align = f.align), f.indentTwips && (L.indentPx = M($(f.indentTwips))), f.bidiVisual && (L.bidiVisual = !0), f.overlap && (L.overlap = f.overlap), f.caption && (L.caption = f.caption), f.description && (L.description = f.description);
|
|
2142
|
+
const wt = Dn(f.borders);
|
|
2143
|
+
if (wt ? L.defaultBorders = wt : f.bordersSpecified && (L.defaultBorders = {}), f.shd && (L.defaultShading = f.shd), f.cellMarginTwips) {
|
|
2144
|
+
const O = f.cellMarginTwips;
|
|
2145
|
+
L.defaultCellMargin = Yt({
|
|
2146
|
+
top: O.top ?? _t.top,
|
|
2147
|
+
right: O.right ?? _t.right,
|
|
2148
|
+
bottom: O.bottom ?? _t.bottom,
|
|
2149
|
+
left: O.left ?? _t.left
|
|
2150
2150
|
});
|
|
2151
2151
|
}
|
|
2152
2152
|
return L;
|
|
2153
2153
|
}
|
|
2154
|
-
function rt(
|
|
2155
|
-
if (!
|
|
2154
|
+
function rt(f) {
|
|
2155
|
+
if (!f) return { ...jt, marginPx: { ...jt.marginPx } };
|
|
2156
2156
|
const w = {
|
|
2157
|
-
pageWidthPx:
|
|
2158
|
-
pageHeightPx:
|
|
2159
|
-
marginPx:
|
|
2157
|
+
pageWidthPx: f.pageWidthTwips !== void 0 ? M($(f.pageWidthTwips)) : jt.pageWidthPx,
|
|
2158
|
+
pageHeightPx: f.pageHeightTwips !== void 0 ? M($(f.pageHeightTwips)) : jt.pageHeightPx,
|
|
2159
|
+
marginPx: f.marginTwips ? Yt(f.marginTwips) : { ...jt.marginPx }
|
|
2160
2160
|
};
|
|
2161
|
-
return
|
|
2161
|
+
return f.columns && (w.columns = Re(f.columns)), f.pageNumberStart !== void 0 && (w.pageNumberStart = f.pageNumberStart), f.headerDistTwips !== void 0 && (w.headerDistancePx = M($(f.headerDistTwips))), f.footerDistTwips !== void 0 && (w.footerDistancePx = M($(f.footerDistTwips))), f.pageBorders && (w.pageBorders = Ne(f.pageBorders)), f.lineNumbering && (w.lineNumbering = Be(f.lineNumbering)), f.breakType && (w.breakType = f.breakType), w;
|
|
2162
2162
|
}
|
|
2163
2163
|
return {
|
|
2164
2164
|
mapBlocks: tt,
|
|
@@ -2167,29 +2167,29 @@ function Io(t, e, n = {}, o = /* @__PURE__ */ new Map(), i = () => ({}), r, s) {
|
|
|
2167
2167
|
// Realize EVERY defined numbering definition (not just referenced ones) so a
|
|
2168
2168
|
// list style authored in the editor survives save→reopen before it's applied.
|
|
2169
2169
|
lists: () => {
|
|
2170
|
-
for (const
|
|
2171
|
-
return Object.fromEntries(
|
|
2170
|
+
for (const f of o.keys()) nt(f);
|
|
2171
|
+
return Object.fromEntries(D);
|
|
2172
2172
|
},
|
|
2173
2173
|
bookmarks: () => {
|
|
2174
|
-
const
|
|
2175
|
-
for (const [w,
|
|
2176
|
-
|
|
2177
|
-
return
|
|
2174
|
+
const f = {};
|
|
2175
|
+
for (const [w, B] of h)
|
|
2176
|
+
f[B.name] = { start: B.pos, end: d.get(w) ?? B.pos };
|
|
2177
|
+
return f;
|
|
2178
2178
|
},
|
|
2179
|
-
footnoteRefs: () => S.map((
|
|
2180
|
-
endnoteRefs: () => P.map((
|
|
2179
|
+
footnoteRefs: () => S.map((f) => ({ docxId: f, noteId: `fn${f}` })),
|
|
2180
|
+
endnoteRefs: () => P.map((f) => ({ docxId: f, noteId: `en${f}` })),
|
|
2181
2181
|
commentAnchors: () => {
|
|
2182
|
-
const
|
|
2183
|
-
for (const
|
|
2184
|
-
const
|
|
2185
|
-
|
|
2182
|
+
const f = /* @__PURE__ */ new Map(), w = /* @__PURE__ */ new Set([...l.keys(), ...u.keys(), ...g.keys()]);
|
|
2183
|
+
for (const B of w) {
|
|
2184
|
+
const W = l.get(B) ?? g.get(B) ?? u.get(B), I = u.get(B) ?? g.get(B) ?? W;
|
|
2185
|
+
W && I && f.set(B, { start: W, end: I });
|
|
2186
2186
|
}
|
|
2187
|
-
return
|
|
2187
|
+
return f;
|
|
2188
2188
|
},
|
|
2189
|
-
tocField: () =>
|
|
2189
|
+
tocField: () => C
|
|
2190
2190
|
};
|
|
2191
2191
|
}
|
|
2192
|
-
const
|
|
2192
|
+
const Mo = {
|
|
2193
2193
|
decimal: "decimal",
|
|
2194
2194
|
decimalZero: "decimal",
|
|
2195
2195
|
lowerLetter: "lowerLetter",
|
|
@@ -2198,7 +2198,7 @@ const Eo = {
|
|
|
2198
2198
|
upperRoman: "upperRoman",
|
|
2199
2199
|
bullet: "bullet"
|
|
2200
2200
|
};
|
|
2201
|
-
function
|
|
2201
|
+
function Ro(t) {
|
|
2202
2202
|
if (t.length !== 1) return t;
|
|
2203
2203
|
switch (t.charCodeAt(0)) {
|
|
2204
2204
|
case 61623:
|
|
@@ -2224,23 +2224,23 @@ function Mo(t) {
|
|
|
2224
2224
|
return t;
|
|
2225
2225
|
}
|
|
2226
2226
|
}
|
|
2227
|
-
function
|
|
2227
|
+
function No(t) {
|
|
2228
2228
|
const e = [];
|
|
2229
2229
|
for (let n = 0; n < 9; n++)
|
|
2230
|
-
e.push(
|
|
2230
|
+
e.push(Bo(t.levels[n], n));
|
|
2231
2231
|
return { id: t.id, levels: e };
|
|
2232
2232
|
}
|
|
2233
|
-
function
|
|
2233
|
+
function Bo(t, e) {
|
|
2234
2234
|
if (!t)
|
|
2235
2235
|
return { format: "decimal", text: `%${e + 1}.`, indentLeftPx: 24 + e * 24, hangingPx: 18, start: 1 };
|
|
2236
|
-
const n =
|
|
2236
|
+
const n = Mo[t.format] ?? (t.format === "none" ? "bullet" : "decimal"), o = {
|
|
2237
2237
|
format: n,
|
|
2238
2238
|
text: n === "bullet" ? "" : t.lvlText,
|
|
2239
2239
|
indentLeftPx: t.indentLeftTwips !== void 0 ? M($(t.indentLeftTwips)) : 24 + e * 24,
|
|
2240
2240
|
hangingPx: t.hangingTwips !== void 0 ? M($(t.hangingTwips)) : 18,
|
|
2241
2241
|
start: t.start
|
|
2242
2242
|
};
|
|
2243
|
-
if (n === "bullet" && (o.bulletChar = t.format === "none" ? "" :
|
|
2243
|
+
if (n === "bullet" && (o.bulletChar = t.format === "none" ? "" : Ro(t.lvlText)), t.markerRunProps) {
|
|
2244
2244
|
const i = be(t.markerRunProps);
|
|
2245
2245
|
Object.keys(i).length > 0 && (o.markerStyle = i);
|
|
2246
2246
|
}
|
|
@@ -2254,26 +2254,26 @@ const Fo = {
|
|
|
2254
2254
|
right: "right",
|
|
2255
2255
|
end: "right",
|
|
2256
2256
|
decimal: "decimal"
|
|
2257
|
-
},
|
|
2257
|
+
}, Lo = {
|
|
2258
2258
|
dot: "dot",
|
|
2259
2259
|
middleDot: "dot",
|
|
2260
2260
|
hyphen: "dash",
|
|
2261
2261
|
underscore: "underscore"
|
|
2262
2262
|
};
|
|
2263
|
-
function
|
|
2263
|
+
function Ze(t) {
|
|
2264
2264
|
const e = t.map((n) => {
|
|
2265
2265
|
const o = { posPx: M($(n.posTwips)) }, i = n.val ? Fo[n.val] : void 0;
|
|
2266
2266
|
i && i !== "left" && (o.align = i);
|
|
2267
|
-
const r = n.leader ?
|
|
2267
|
+
const r = n.leader ? Lo[n.leader] : void 0;
|
|
2268
2268
|
return r && (o.leader = r), o;
|
|
2269
2269
|
});
|
|
2270
2270
|
return e.sort((n, o) => n.posPx - o.posPx), e;
|
|
2271
2271
|
}
|
|
2272
|
-
function
|
|
2272
|
+
function Oo(t, e) {
|
|
2273
2273
|
const n = t && t.length === e && t.reduce((o, i) => o + i, 0) > 0 ? t.map((o) => Math.round(o / t.reduce((i, r) => i + r, 0) * 1e4) / 1e4) : Array.from({ length: e }, () => Math.round(1 / e * 1e4) / 1e4);
|
|
2274
2274
|
return n[n.length - 1] = Math.round((1 - n.slice(0, -1).reduce((o, i) => o + i, 0)) * 1e4) / 1e4, n;
|
|
2275
2275
|
}
|
|
2276
|
-
const
|
|
2276
|
+
const Do = {
|
|
2277
2277
|
yellow: "#ffff00",
|
|
2278
2278
|
green: "#00ff00",
|
|
2279
2279
|
cyan: "#00ffff",
|
|
@@ -2292,8 +2292,8 @@ const Oo = {
|
|
|
2292
2292
|
white: "#ffffff"
|
|
2293
2293
|
};
|
|
2294
2294
|
function le(t) {
|
|
2295
|
-
const e = { ...
|
|
2296
|
-
return
|
|
2295
|
+
const e = { ...Je };
|
|
2296
|
+
return Qe(e, t), e;
|
|
2297
2297
|
}
|
|
2298
2298
|
const Ho = {
|
|
2299
2299
|
double: "double",
|
|
@@ -2312,17 +2312,17 @@ const Ho = {
|
|
|
2312
2312
|
wavyHeavy: "wave",
|
|
2313
2313
|
wavyDouble: "wave"
|
|
2314
2314
|
};
|
|
2315
|
-
function
|
|
2315
|
+
function zo(t) {
|
|
2316
2316
|
return Ho[t];
|
|
2317
2317
|
}
|
|
2318
|
-
function
|
|
2318
|
+
function Qe(t, e) {
|
|
2319
2319
|
const n = e.fontAscii ?? e.fontHAnsi;
|
|
2320
2320
|
if (e.fontAscii ? t.fontFamily = `${e.fontAscii}, serif` : e.fontHAnsi && (t.fontFamily = `${e.fontHAnsi}, serif`), e.fontCs && e.fontCs !== n && (t.fontFamilyComplexScript = `${e.fontCs}, serif`), e.fontEastAsia && e.fontEastAsia !== n && (t.fontFamilyEastAsia = `${e.fontEastAsia}, serif`), e.letterSpacingTwips !== void 0 && (t.letterSpacingPx = M($(e.letterSpacingTwips))), e.sizeHalfPoints !== void 0 && (t.fontSizePx = M(Qt(e.sizeHalfPoints))), e.bold !== void 0 && (t.bold = e.bold), e.italic !== void 0 && (t.italic = e.italic), e.underline !== void 0 && (t.underline = e.underline), e.underline) {
|
|
2321
|
-
const o = e.underlineStyle ?
|
|
2321
|
+
const o = e.underlineStyle ? zo(e.underlineStyle) : void 0;
|
|
2322
2322
|
o && (t.underlineStyle = o), e.underlineColor && e.underlineColor !== "auto" && (t.underlineColor = `#${e.underlineColor.toLowerCase()}`);
|
|
2323
2323
|
}
|
|
2324
2324
|
if (e.strikethrough !== void 0 && (t.strikethrough = e.strikethrough), e.color && e.color !== "auto" && (t.color = `#${e.color.toLowerCase()}`), e.highlight) {
|
|
2325
|
-
const o =
|
|
2325
|
+
const o = Do[e.highlight];
|
|
2326
2326
|
o && (t.highlightColor = o);
|
|
2327
2327
|
}
|
|
2328
2328
|
if (e.vertAlign === "superscript" ? t.verticalAlign = "super" : e.vertAlign === "subscript" && (t.verticalAlign = "sub"), e.vanish && (t.hidden = !0), e.caps !== void 0 && (t.caps = e.caps), e.smallCaps !== void 0 && (t.smallCaps = e.smallCaps), e.rtl !== void 0 && (t.rtl = e.rtl), e.doubleStrikethrough !== void 0 && (t.doubleStrikethrough = e.doubleStrikethrough), e.positionHalfPoints !== void 0 && (t.positionPx = M(Qt(e.positionHalfPoints))), e.kerningHalfPoints !== void 0 && (t.kerningMinPx = M(Qt(e.kerningHalfPoints))), e.widthScalePct !== void 0 && (t.widthScalePct = e.widthScalePct), e.emphasisMark) {
|
|
@@ -2335,14 +2335,14 @@ function Ze(t, e) {
|
|
|
2335
2335
|
}
|
|
2336
2336
|
e.fitTextTwips !== void 0 && e.fitTextTwips > 0 && (t.fitTextPx = M($(e.fitTextTwips))), e.symbol && (t.symbol = { font: e.symbol.font, char: e.symbol.char }, t.fontFamily = `${e.symbol.font}, sans-serif`);
|
|
2337
2337
|
}
|
|
2338
|
-
const
|
|
2338
|
+
const _o = {
|
|
2339
2339
|
dot: "dot",
|
|
2340
2340
|
comma: "comma",
|
|
2341
2341
|
circle: "circle",
|
|
2342
2342
|
underDot: "underDot"
|
|
2343
2343
|
};
|
|
2344
2344
|
function jo(t) {
|
|
2345
|
-
return
|
|
2345
|
+
return _o[t];
|
|
2346
2346
|
}
|
|
2347
2347
|
function Wo(t) {
|
|
2348
2348
|
const e = {};
|
|
@@ -2354,18 +2354,18 @@ function Wo(t) {
|
|
|
2354
2354
|
}
|
|
2355
2355
|
function be(t) {
|
|
2356
2356
|
const e = {};
|
|
2357
|
-
return
|
|
2357
|
+
return Qe(e, t), e;
|
|
2358
2358
|
}
|
|
2359
|
-
function
|
|
2359
|
+
function tn(t) {
|
|
2360
2360
|
const e = {};
|
|
2361
|
-
t.align && (e.align = t.align), t.direction && (e.direction = t.direction), t.lineHeight !== void 0 && (e.lineHeight = M(t.lineHeight)), (t.lineRule === "exact" || t.lineRule === "atLeast") && (e.lineRule = t.lineRule, t.lineExactTwips !== void 0 && (e.lineHeightPx = M($(t.lineExactTwips)))), t.spaceBeforeTwips !== void 0 && (e.spaceBeforePx = M($(t.spaceBeforeTwips))), t.spaceAfterTwips !== void 0 && (e.spaceAfterPx = M($(t.spaceAfterTwips))), t.indentLeftTwips !== void 0 && (e.indentLeftPx = M($(t.indentLeftTwips))), t.indentRightTwips !== void 0 && (e.indentRightPx = M($(t.indentRightTwips))), t.indentFirstLineTwips !== void 0 && (e.indentFirstLinePx = M($(t.indentFirstLineTwips))), t.keepWithNext && (e.keepWithNext = !0), t.keepLinesTogether && (e.keepLinesTogether = !0), t.contextualSpacing !== void 0 && (e.contextualSpacing = t.contextualSpacing), t.tabStops && (e.tabStops =
|
|
2362
|
-
const n =
|
|
2363
|
-
return n && (e.borders = n), t.shd !== void 0 && (e.shading = t.shd),
|
|
2361
|
+
t.align && (e.align = t.align), t.direction && (e.direction = t.direction), t.lineHeight !== void 0 && (e.lineHeight = M(t.lineHeight)), (t.lineRule === "exact" || t.lineRule === "atLeast") && (e.lineRule = t.lineRule, t.lineExactTwips !== void 0 && (e.lineHeightPx = M($(t.lineExactTwips)))), t.spaceBeforeTwips !== void 0 && (e.spaceBeforePx = M($(t.spaceBeforeTwips))), t.spaceAfterTwips !== void 0 && (e.spaceAfterPx = M($(t.spaceAfterTwips))), t.indentLeftTwips !== void 0 && (e.indentLeftPx = M($(t.indentLeftTwips))), t.indentRightTwips !== void 0 && (e.indentRightPx = M($(t.indentRightTwips))), t.indentFirstLineTwips !== void 0 && (e.indentFirstLinePx = M($(t.indentFirstLineTwips))), t.keepWithNext && (e.keepWithNext = !0), t.keepLinesTogether && (e.keepLinesTogether = !0), t.contextualSpacing !== void 0 && (e.contextualSpacing = t.contextualSpacing), t.tabStops && (e.tabStops = Ze(t.tabStops));
|
|
2362
|
+
const n = Ge(t.borders);
|
|
2363
|
+
return n && (e.borders = n), t.shd !== void 0 && (e.shading = t.shd), en(t, e), e;
|
|
2364
2364
|
}
|
|
2365
|
-
function
|
|
2365
|
+
function en(t, e) {
|
|
2366
2366
|
t.widowControl !== void 0 && (e.widowControl = t.widowControl), t.suppressLineNumbers !== void 0 && (e.suppressLineNumbers = t.suppressLineNumbers), t.textAlignment !== void 0 && (e.textAlignment = t.textAlignment), t.mirrorIndents !== void 0 && (e.mirrorIndents = t.mirrorIndents), t.adjustRightInd !== void 0 && (e.adjustRightInd = t.adjustRightInd);
|
|
2367
2367
|
}
|
|
2368
|
-
function
|
|
2368
|
+
function $o(t) {
|
|
2369
2369
|
if (t.styles.size === 0) return;
|
|
2370
2370
|
const e = /* @__PURE__ */ new Set();
|
|
2371
2371
|
for (const o of t.styles.values())
|
|
@@ -2378,7 +2378,7 @@ function _o(t) {
|
|
|
2378
2378
|
name: i.name ?? o,
|
|
2379
2379
|
type: r ? "character" : "paragraph",
|
|
2380
2380
|
char: be(i.rPr),
|
|
2381
|
-
para: r ? {} :
|
|
2381
|
+
para: r ? {} : tn(i.pPr)
|
|
2382
2382
|
};
|
|
2383
2383
|
i.basedOnId && e.has(i.basedOnId) && t.styles.get(i.basedOnId)?.type === i.type && (s.basedOn = i.basedOnId), n.push(s);
|
|
2384
2384
|
}
|
|
@@ -2386,36 +2386,36 @@ function _o(t) {
|
|
|
2386
2386
|
(o, i) => o.id === t.defaultParaStyleId ? -1 : i.id === t.defaultParaStyleId ? 1 : o.name.localeCompare(i.name)
|
|
2387
2387
|
), { styles: n, defaultStyleId: t.defaultParaStyleId ?? n[0].id };
|
|
2388
2388
|
}
|
|
2389
|
-
function
|
|
2389
|
+
function Uo(t) {
|
|
2390
2390
|
const e = /* @__PURE__ */ new Set();
|
|
2391
2391
|
for (const i of t.styles.values()) i.type === "table" && e.add(i.id);
|
|
2392
2392
|
if (e.size === 0) return;
|
|
2393
2393
|
const n = (i, r, s, a) => {
|
|
2394
|
-
const
|
|
2395
|
-
Object.keys(h).length > 0 && (
|
|
2396
|
-
const
|
|
2397
|
-
Object.keys(
|
|
2398
|
-
const
|
|
2399
|
-
return
|
|
2394
|
+
const c = {}, h = be(i);
|
|
2395
|
+
Object.keys(h).length > 0 && (c.char = h);
|
|
2396
|
+
const d = tn(r);
|
|
2397
|
+
Object.keys(d).length > 0 && (c.para = d);
|
|
2398
|
+
const l = On(s);
|
|
2399
|
+
return l && (c.borders = l), a !== void 0 && (c.shading = a), c;
|
|
2400
2400
|
}, o = {};
|
|
2401
2401
|
for (const i of e) {
|
|
2402
2402
|
const r = t.styles.get(i), s = {
|
|
2403
2403
|
wholeTable: n(r.rPr, r.pPr, r.tblBorders, r.tblShd)
|
|
2404
2404
|
};
|
|
2405
|
-
for (const [
|
|
2406
|
-
s[
|
|
2405
|
+
for (const [c, h] of Object.entries(r.tblStylePr ?? {}))
|
|
2406
|
+
s[c] = n(h.rPr, h.pPr, h.borders, h.shd);
|
|
2407
2407
|
const a = { id: i, name: r.name ?? i, conds: s };
|
|
2408
2408
|
r.basedOnId && e.has(r.basedOnId) && (a.basedOn = r.basedOnId), r.rowBandSize !== void 0 && (a.rowBandSize = r.rowBandSize), r.colBandSize !== void 0 && (a.colBandSize = r.colBandSize), o[i] = a;
|
|
2409
2409
|
}
|
|
2410
2410
|
return o;
|
|
2411
2411
|
}
|
|
2412
|
-
function
|
|
2412
|
+
function Fe(t) {
|
|
2413
2413
|
const e = { ...Co };
|
|
2414
|
-
t.align && (e.align = t.align), t.direction && (e.direction = t.direction), t.lineHeight !== void 0 && (e.lineHeight = M(t.lineHeight)), (t.lineRule === "exact" || t.lineRule === "atLeast") && (e.lineRule = t.lineRule, t.lineExactTwips !== void 0 && (e.lineHeightPx = M($(t.lineExactTwips)))), t.spaceBeforeTwips !== void 0 && (e.spaceBeforePx = M($(t.spaceBeforeTwips))), t.spaceAfterTwips !== void 0 && (e.spaceAfterPx = M($(t.spaceAfterTwips))), t.indentLeftTwips !== void 0 && (e.indentLeftPx = M($(t.indentLeftTwips))), t.indentRightTwips !== void 0 && (e.indentRightPx = M($(t.indentRightTwips))), t.indentFirstLineTwips !== void 0 && (e.indentFirstLinePx = M($(t.indentFirstLineTwips))), t.keepWithNext && (e.keepWithNext = !0), t.keepLinesTogether && (e.keepLinesTogether = !0), t.contextualSpacing !== void 0 && (e.contextualSpacing = t.contextualSpacing), t.tabStops && (e.tabStops =
|
|
2415
|
-
const n =
|
|
2416
|
-
return n && (e.borders = n), t.shd !== void 0 && (e.shading = t.shd),
|
|
2414
|
+
t.align && (e.align = t.align), t.direction && (e.direction = t.direction), t.lineHeight !== void 0 && (e.lineHeight = M(t.lineHeight)), (t.lineRule === "exact" || t.lineRule === "atLeast") && (e.lineRule = t.lineRule, t.lineExactTwips !== void 0 && (e.lineHeightPx = M($(t.lineExactTwips)))), t.spaceBeforeTwips !== void 0 && (e.spaceBeforePx = M($(t.spaceBeforeTwips))), t.spaceAfterTwips !== void 0 && (e.spaceAfterPx = M($(t.spaceAfterTwips))), t.indentLeftTwips !== void 0 && (e.indentLeftPx = M($(t.indentLeftTwips))), t.indentRightTwips !== void 0 && (e.indentRightPx = M($(t.indentRightTwips))), t.indentFirstLineTwips !== void 0 && (e.indentFirstLinePx = M($(t.indentFirstLineTwips))), t.keepWithNext && (e.keepWithNext = !0), t.keepLinesTogether && (e.keepLinesTogether = !0), t.contextualSpacing !== void 0 && (e.contextualSpacing = t.contextualSpacing), t.tabStops && (e.tabStops = Ze(t.tabStops)), t.pageBreakBefore && (e.pageBreakBefore = !0), t.outlineLevel !== void 0 && (e.outlineLevel = t.outlineLevel);
|
|
2415
|
+
const n = Ge(t.borders);
|
|
2416
|
+
return n && (e.borders = n), t.shd !== void 0 && (e.shading = t.shd), en(t, e), t.styleId && (e.namedStyle = t.styleId), e;
|
|
2417
2417
|
}
|
|
2418
|
-
const
|
|
2418
|
+
const Go = {
|
|
2419
2419
|
png: "image/png",
|
|
2420
2420
|
jpg: "image/jpeg",
|
|
2421
2421
|
jpeg: "image/jpeg",
|
|
@@ -2424,7 +2424,7 @@ const Uo = {
|
|
|
2424
2424
|
webp: "image/webp",
|
|
2425
2425
|
svg: "image/svg+xml"
|
|
2426
2426
|
};
|
|
2427
|
-
function
|
|
2427
|
+
function Vo(t, e, n, o) {
|
|
2428
2428
|
const i = /* @__PURE__ */ new Map(), r = [];
|
|
2429
2429
|
return {
|
|
2430
2430
|
resolve(s) {
|
|
@@ -2435,38 +2435,38 @@ function Go(t, e, n, o) {
|
|
|
2435
2435
|
}
|
|
2436
2436
|
if (i.has(a.target)) return i.get(a.target);
|
|
2437
2437
|
if (a.external) {
|
|
2438
|
-
const
|
|
2439
|
-
|
|
2438
|
+
const l = /^https?:\/\//i.test(a.target);
|
|
2439
|
+
l ? n.add("media-external", "Linked (external) images load from their original URL.") : n.add(
|
|
2440
2440
|
"media-external-unreachable",
|
|
2441
2441
|
"Linked images pointing at local files can't be loaded in the browser — skipped."
|
|
2442
2442
|
);
|
|
2443
|
-
const
|
|
2444
|
-
return i.set(a.target,
|
|
2443
|
+
const u = l ? a.target : void 0;
|
|
2444
|
+
return i.set(a.target, u), u;
|
|
2445
2445
|
}
|
|
2446
|
-
let
|
|
2447
|
-
const h = a.target.slice(a.target.lastIndexOf(".") + 1).toLowerCase(),
|
|
2448
|
-
if (!
|
|
2446
|
+
let c;
|
|
2447
|
+
const h = a.target.slice(a.target.lastIndexOf(".") + 1).toLowerCase(), d = Go[h];
|
|
2448
|
+
if (!d)
|
|
2449
2449
|
n.add(
|
|
2450
2450
|
"media-unsupported",
|
|
2451
2451
|
`Some images use formats browsers can't display (.${h}, typically metafiles) — skipped.`
|
|
2452
2452
|
);
|
|
2453
2453
|
else {
|
|
2454
|
-
const
|
|
2455
|
-
if (!
|
|
2454
|
+
const l = t.part(a.target);
|
|
2455
|
+
if (!l)
|
|
2456
2456
|
n.add("media-missing", "An image reference had no matching relationship — skipped.");
|
|
2457
2457
|
else {
|
|
2458
|
-
const
|
|
2459
|
-
|
|
2458
|
+
const u = new Uint8Array(l);
|
|
2459
|
+
c = URL.createObjectURL(new Blob([u], { type: d })), r.push(c);
|
|
2460
2460
|
}
|
|
2461
2461
|
}
|
|
2462
|
-
return i.set(a.target,
|
|
2462
|
+
return i.set(a.target, c), c;
|
|
2463
2463
|
},
|
|
2464
2464
|
urls: () => [...r]
|
|
2465
2465
|
};
|
|
2466
2466
|
}
|
|
2467
|
-
const
|
|
2468
|
-
function
|
|
2469
|
-
const e = /* @__PURE__ */ new Map(), n =
|
|
2467
|
+
const Xo = /* @__PURE__ */ new Map();
|
|
2468
|
+
function Yo(t) {
|
|
2469
|
+
const e = /* @__PURE__ */ new Map(), n = bt(Pt(t, "numbering.xml"), "w:numbering");
|
|
2470
2470
|
if (!n) return e;
|
|
2471
2471
|
const o = /* @__PURE__ */ new Map();
|
|
2472
2472
|
for (const i of mt(n, "w:abstractNum")) {
|
|
@@ -2478,12 +2478,12 @@ function Xo(t) {
|
|
|
2478
2478
|
if (r === void 0) continue;
|
|
2479
2479
|
const s = ht(i, "w:abstractNumId"), a = s !== void 0 ? o.get(s) : void 0;
|
|
2480
2480
|
if (!a) continue;
|
|
2481
|
-
const
|
|
2481
|
+
const c = a.map((h) => ({ ...h }));
|
|
2482
2482
|
for (const h of mt(i, "w:lvlOverride")) {
|
|
2483
|
-
const
|
|
2484
|
-
|
|
2483
|
+
const d = T(h, "w:ilvl") ?? 0, l = T(p(h, "w:startOverride"), "w:val"), u = p(h, "w:lvl");
|
|
2484
|
+
u && c[d] && (c[d] = nn(u, d)), l !== void 0 && c[d] && (c[d].start = l);
|
|
2485
2485
|
}
|
|
2486
|
-
e.set(r, { id: r, levels:
|
|
2486
|
+
e.set(r, { id: r, levels: c });
|
|
2487
2487
|
}
|
|
2488
2488
|
return e;
|
|
2489
2489
|
}
|
|
@@ -2491,11 +2491,11 @@ function qo(t) {
|
|
|
2491
2491
|
const e = [];
|
|
2492
2492
|
for (const n of mt(t, "w:lvl")) {
|
|
2493
2493
|
const o = T(n, "w:ilvl") ?? e.length;
|
|
2494
|
-
e[o] =
|
|
2494
|
+
e[o] = nn(n, o);
|
|
2495
2495
|
}
|
|
2496
2496
|
return e;
|
|
2497
2497
|
}
|
|
2498
|
-
function
|
|
2498
|
+
function nn(t, e) {
|
|
2499
2499
|
const n = p(t, "w:lvlText"), o = {
|
|
2500
2500
|
format: ht(t, "w:numFmt") ?? "decimal",
|
|
2501
2501
|
lvlText: n ? m(n, "w:val") ?? "" : `%${e + 1}.`,
|
|
@@ -2504,40 +2504,40 @@ function en(t, e) {
|
|
|
2504
2504
|
if (r) {
|
|
2505
2505
|
const a = T(r, "w:left") ?? T(r, "w:start");
|
|
2506
2506
|
a !== void 0 && (o.indentLeftTwips = a);
|
|
2507
|
-
const
|
|
2508
|
-
|
|
2507
|
+
const c = T(r, "w:hanging");
|
|
2508
|
+
c !== void 0 && (o.hangingTwips = c);
|
|
2509
2509
|
}
|
|
2510
2510
|
const s = p(t, "w:rPr");
|
|
2511
2511
|
return s && (o.markerRunProps = Rt(s)), o;
|
|
2512
2512
|
}
|
|
2513
|
-
function
|
|
2514
|
-
const n = e.includes("/") ? e.slice(0, e.lastIndexOf("/")) : "", o = /* @__PURE__ */ new Map(), i =
|
|
2513
|
+
function Ko(t, e) {
|
|
2514
|
+
const n = e.includes("/") ? e.slice(0, e.lastIndexOf("/")) : "", o = /* @__PURE__ */ new Map(), i = bt(Pt(t, `${e} rels`), "Relationships");
|
|
2515
2515
|
if (!i) return o;
|
|
2516
2516
|
for (const r of dt(i)) {
|
|
2517
2517
|
if (r.tagName !== "Relationship") continue;
|
|
2518
|
-
const s = m(r, "Id"), a = m(r, "Type"),
|
|
2519
|
-
if (!s || !a || !
|
|
2518
|
+
const s = m(r, "Id"), a = m(r, "Type"), c = m(r, "Target");
|
|
2519
|
+
if (!s || !a || !c) continue;
|
|
2520
2520
|
const h = m(r, "TargetMode") === "External";
|
|
2521
|
-
o.set(s, { id: s, type: a, target: h ?
|
|
2521
|
+
o.set(s, { id: s, type: a, target: h ? c : Jo(n, c), external: h });
|
|
2522
2522
|
}
|
|
2523
2523
|
return o;
|
|
2524
2524
|
}
|
|
2525
|
-
function
|
|
2525
|
+
function Jo(t, e) {
|
|
2526
2526
|
if (e.startsWith("/")) return e.slice(1);
|
|
2527
2527
|
const n = t === "" ? [] : t.split("/");
|
|
2528
2528
|
for (const o of e.split("/"))
|
|
2529
2529
|
o === ".." ? n.pop() : o !== "." && o !== "" && n.push(o);
|
|
2530
2530
|
return n.join("/");
|
|
2531
2531
|
}
|
|
2532
|
-
function
|
|
2532
|
+
function on(t, e) {
|
|
2533
2533
|
for (const n of t.values())
|
|
2534
2534
|
if (n.type.endsWith(`/${e}`)) return n;
|
|
2535
2535
|
}
|
|
2536
|
-
function
|
|
2536
|
+
function Zo(t) {
|
|
2537
2537
|
const e = t.lastIndexOf("/"), n = e >= 0 ? t.slice(0, e + 1) : "", o = e >= 0 ? t.slice(e + 1) : t;
|
|
2538
2538
|
return `${n}_rels/${o}.rels`;
|
|
2539
2539
|
}
|
|
2540
|
-
const
|
|
2540
|
+
const Qo = { colors: /* @__PURE__ */ new Map() }, ti = {
|
|
2541
2541
|
dark1: "dk1",
|
|
2542
2542
|
light1: "lt1",
|
|
2543
2543
|
dark2: "dk2",
|
|
@@ -2550,25 +2550,25 @@ const Zo = { colors: /* @__PURE__ */ new Map() }, Qo = {
|
|
|
2550
2550
|
followedHyperlink: "folHlink"
|
|
2551
2551
|
};
|
|
2552
2552
|
function Le(t, e) {
|
|
2553
|
-
return t.colors.get(
|
|
2553
|
+
return t.colors.get(ti[e] ?? e);
|
|
2554
2554
|
}
|
|
2555
|
-
function
|
|
2555
|
+
function qt(t, e) {
|
|
2556
2556
|
const n = e.startsWith("major");
|
|
2557
2557
|
if (!(!n && !e.startsWith("minor")))
|
|
2558
2558
|
return e.endsWith("EastAsia") ? n ? t.majorEastAsia : t.minorEastAsia : e.endsWith("Bidi") ? n ? t.majorComplexScript : t.minorComplexScript : n ? t.majorLatin : t.minorLatin;
|
|
2559
2559
|
}
|
|
2560
|
-
function
|
|
2561
|
-
const o =
|
|
2560
|
+
function ei(t, e, n) {
|
|
2561
|
+
const o = ni(t);
|
|
2562
2562
|
if (!o) return t;
|
|
2563
2563
|
let [i, r, s] = o;
|
|
2564
|
-
const a = Oe(e),
|
|
2564
|
+
const a = Oe(e), c = Oe(n);
|
|
2565
2565
|
if (a !== void 0) {
|
|
2566
|
-
const h = (
|
|
2566
|
+
const h = (d) => Math.round(d * a + 255 * (1 - a));
|
|
2567
2567
|
[i, r, s] = [h(i), h(r), h(s)];
|
|
2568
|
-
} else
|
|
2568
|
+
} else c !== void 0 && ([i, r, s] = [Math.round(i * c), Math.round(r * c), Math.round(s * c)]);
|
|
2569
2569
|
return fe(i) + fe(r) + fe(s);
|
|
2570
2570
|
}
|
|
2571
|
-
function
|
|
2571
|
+
function ni(t) {
|
|
2572
2572
|
if (/^[0-9a-fA-F]{6}$/.test(t))
|
|
2573
2573
|
return [parseInt(t.slice(0, 2), 16), parseInt(t.slice(2, 4), 16), parseInt(t.slice(4, 6), 16)];
|
|
2574
2574
|
}
|
|
@@ -2577,87 +2577,87 @@ function Oe(t) {
|
|
|
2577
2577
|
return parseInt(t, 16) / 255;
|
|
2578
2578
|
}
|
|
2579
2579
|
const fe = (t) => Math.max(0, Math.min(255, t)).toString(16).padStart(2, "0");
|
|
2580
|
-
function
|
|
2581
|
-
const e = { colors: /* @__PURE__ */ new Map() }, n =
|
|
2580
|
+
function oi(t) {
|
|
2581
|
+
const e = { colors: /* @__PURE__ */ new Map() }, n = bt(Pt(t, "theme"), "a:theme"), o = n && p(n, "a:themeElements");
|
|
2582
2582
|
if (!o) return e;
|
|
2583
2583
|
const i = p(o, "a:fontScheme");
|
|
2584
2584
|
if (i) {
|
|
2585
|
-
const s = p(i, "a:majorFont"), a = p(i, "a:minorFont"),
|
|
2585
|
+
const s = p(i, "a:majorFont"), a = p(i, "a:minorFont"), c = (h, d, l, u) => {
|
|
2586
2586
|
if (!h) return;
|
|
2587
2587
|
const g = (k, S) => {
|
|
2588
|
-
const y =
|
|
2588
|
+
const y = ii(p(h, k));
|
|
2589
2589
|
y && (e[S] = y);
|
|
2590
2590
|
};
|
|
2591
|
-
g("a:latin",
|
|
2591
|
+
g("a:latin", d), g("a:ea", l), g("a:cs", u);
|
|
2592
2592
|
};
|
|
2593
|
-
|
|
2593
|
+
c(s, "majorLatin", "majorEastAsia", "majorComplexScript"), c(a, "minorLatin", "minorEastAsia", "minorComplexScript");
|
|
2594
2594
|
}
|
|
2595
2595
|
const r = p(o, "a:clrScheme");
|
|
2596
2596
|
if (r)
|
|
2597
2597
|
for (const s of dt(r)) {
|
|
2598
|
-
const a = s.tagName.replace(/^a:/, ""),
|
|
2599
|
-
|
|
2598
|
+
const a = s.tagName.replace(/^a:/, ""), c = p(s, "a:srgbClr"), h = p(s, "a:sysClr"), d = (c && m(c, "val")) ?? (h && m(h, "lastClr"));
|
|
2599
|
+
d && e.colors.set(a, d);
|
|
2600
2600
|
}
|
|
2601
2601
|
return e;
|
|
2602
2602
|
}
|
|
2603
|
-
function
|
|
2603
|
+
function ii(t) {
|
|
2604
2604
|
return t && m(t, "typeface") || void 0;
|
|
2605
2605
|
}
|
|
2606
|
-
const
|
|
2607
|
-
function
|
|
2608
|
-
const n = { docDefaultsRun: {}, docDefaultsPara: {}, styles: /* @__PURE__ */ new Map() }, o =
|
|
2606
|
+
const ri = { docDefaultsRun: {}, docDefaultsPara: {}, styles: /* @__PURE__ */ new Map() };
|
|
2607
|
+
function si(t, e) {
|
|
2608
|
+
const n = { docDefaultsRun: {}, docDefaultsPara: {}, styles: /* @__PURE__ */ new Map() }, o = bt(Pt(t, "styles.xml"), "w:styles");
|
|
2609
2609
|
if (!o) return n;
|
|
2610
2610
|
const i = p(o, "w:docDefaults");
|
|
2611
2611
|
if (i) {
|
|
2612
2612
|
const r = p(i, "w:rPrDefault"), s = r && p(r, "w:rPr");
|
|
2613
2613
|
s && (n.docDefaultsRun = Rt(s));
|
|
2614
|
-
const a = p(i, "w:pPrDefault"),
|
|
2615
|
-
|
|
2614
|
+
const a = p(i, "w:pPrDefault"), c = a && p(a, "w:pPr");
|
|
2615
|
+
c && (n.docDefaultsPara = te(c));
|
|
2616
2616
|
}
|
|
2617
2617
|
for (const r of mt(o, "w:style")) {
|
|
2618
2618
|
const s = m(r, "w:styleId"), a = m(r, "w:type");
|
|
2619
2619
|
if (!s || !a) continue;
|
|
2620
|
-
const
|
|
2620
|
+
const c = p(r, "w:rPr"), h = p(r, "w:pPr"), d = {
|
|
2621
2621
|
id: s,
|
|
2622
2622
|
type: a,
|
|
2623
|
-
rPr:
|
|
2623
|
+
rPr: c ? Rt(c) : {},
|
|
2624
2624
|
pPr: h ? te(h) : {}
|
|
2625
|
-
},
|
|
2626
|
-
|
|
2627
|
-
const
|
|
2628
|
-
if (
|
|
2625
|
+
}, l = ht(r, "w:name");
|
|
2626
|
+
l && (d.name = l);
|
|
2627
|
+
const u = ht(r, "w:basedOn");
|
|
2628
|
+
if (u && (d.basedOnId = u), a === "table") {
|
|
2629
2629
|
const k = p(r, "w:tblPr");
|
|
2630
2630
|
if (k) {
|
|
2631
2631
|
const y = ie(p(k, "w:tblBorders"));
|
|
2632
|
-
y && (
|
|
2632
|
+
y && (d.tblBorders = y);
|
|
2633
2633
|
const N = Ut(p(k, "w:shd"));
|
|
2634
|
-
N && (
|
|
2634
|
+
N && (d.tblShd = N);
|
|
2635
2635
|
const P = ht(k, "w:tblStyleRowBandSize");
|
|
2636
|
-
P && Number.isFinite(Number(P)) && (
|
|
2636
|
+
P && Number.isFinite(Number(P)) && (d.rowBandSize = Number(P));
|
|
2637
2637
|
const z = ht(k, "w:tblStyleColBandSize");
|
|
2638
|
-
z && Number.isFinite(Number(z)) && (
|
|
2638
|
+
z && Number.isFinite(Number(z)) && (d.colBandSize = Number(z));
|
|
2639
2639
|
}
|
|
2640
2640
|
const S = {};
|
|
2641
2641
|
for (const y of mt(r, "w:tblStylePr")) {
|
|
2642
2642
|
const N = m(y, "w:type");
|
|
2643
2643
|
if (!N) continue;
|
|
2644
|
-
const P = p(y, "w:rPr"), z = p(y, "w:pPr"),
|
|
2644
|
+
const P = p(y, "w:rPr"), z = p(y, "w:pPr"), D = p(y, "w:tcPr"), nt = {
|
|
2645
2645
|
rPr: P ? Rt(P) : {},
|
|
2646
2646
|
pPr: z ? te(z) : {}
|
|
2647
|
-
}, lt =
|
|
2647
|
+
}, lt = D && ie(p(D, "w:tcBorders"));
|
|
2648
2648
|
lt && (nt.borders = lt);
|
|
2649
|
-
const Z =
|
|
2649
|
+
const Z = D && Ut(p(D, "w:shd"));
|
|
2650
2650
|
Z && (nt.shd = Z), S[N] = nt;
|
|
2651
2651
|
}
|
|
2652
|
-
Object.keys(S).length > 0 && (
|
|
2652
|
+
Object.keys(S).length > 0 && (d.tblStylePr = S);
|
|
2653
2653
|
}
|
|
2654
|
-
n.styles.set(s,
|
|
2654
|
+
n.styles.set(s, d);
|
|
2655
2655
|
const g = m(r, "w:default");
|
|
2656
2656
|
a === "paragraph" && (g === "1" || g === "true") && (n.defaultParaStyleId = s);
|
|
2657
2657
|
}
|
|
2658
2658
|
return n;
|
|
2659
2659
|
}
|
|
2660
|
-
function
|
|
2660
|
+
function ai(t, e) {
|
|
2661
2661
|
let n, o;
|
|
2662
2662
|
const i = /* @__PURE__ */ new Set(), r = [];
|
|
2663
2663
|
for (let a = t.styles.get(e); a && !i.has(a.id); a = a.basedOnId ? t.styles.get(a.basedOnId) : void 0)
|
|
@@ -2667,74 +2667,74 @@ function si(t, e) {
|
|
|
2667
2667
|
const s = {};
|
|
2668
2668
|
return n && (s.borders = n), o !== void 0 && (s.shd = o), s;
|
|
2669
2669
|
}
|
|
2670
|
-
const
|
|
2671
|
-
function
|
|
2672
|
-
const n = /* @__PURE__ */ new Map(), o = /* @__PURE__ */ new Map(), i = (
|
|
2673
|
-
const
|
|
2674
|
-
for (let g = t.styles.get(
|
|
2675
|
-
|
|
2676
|
-
return
|
|
2677
|
-
}, r = (
|
|
2678
|
-
let
|
|
2679
|
-
return
|
|
2680
|
-
}, s = (
|
|
2681
|
-
let
|
|
2682
|
-
return
|
|
2683
|
-
}, a = /* @__PURE__ */ new Map(),
|
|
2684
|
-
const
|
|
2685
|
-
let g = a.get(
|
|
2670
|
+
const ci = ["bold", "italic", "strikethrough", "vanish", "caps", "smallCaps"];
|
|
2671
|
+
function li(t, e) {
|
|
2672
|
+
const n = /* @__PURE__ */ new Map(), o = /* @__PURE__ */ new Map(), i = (d) => {
|
|
2673
|
+
const l = [], u = /* @__PURE__ */ new Set();
|
|
2674
|
+
for (let g = t.styles.get(d); g && !u.has(g.id); g = g.basedOnId ? t.styles.get(g.basedOnId) : void 0)
|
|
2675
|
+
u.add(g.id), l.unshift(g);
|
|
2676
|
+
return l;
|
|
2677
|
+
}, r = (d) => {
|
|
2678
|
+
let l = n.get(d);
|
|
2679
|
+
return l || (l = i(d).reduce((u, g) => Kt(u, g.rPr), {}), n.set(d, l)), l;
|
|
2680
|
+
}, s = (d) => {
|
|
2681
|
+
let l = o.get(d);
|
|
2682
|
+
return l || (l = i(d).reduce((u, g) => ee(u, g.pPr), {}), o.set(d, l)), l;
|
|
2683
|
+
}, a = /* @__PURE__ */ new Map(), c = (d, l) => {
|
|
2684
|
+
const u = `${d ?? ""}|${l ?? ""}`;
|
|
2685
|
+
let g = a.get(u);
|
|
2686
2686
|
if (g) return g;
|
|
2687
|
-
const k =
|
|
2687
|
+
const k = d ? r(d) : {}, S = l ? r(l) : {};
|
|
2688
2688
|
g = Kt(Kt(t.docDefaultsRun, k), S);
|
|
2689
|
-
for (const y of
|
|
2689
|
+
for (const y of ci) {
|
|
2690
2690
|
if (t.docDefaultsRun[y] === void 0 && k[y] === void 0 && S[y] === void 0) continue;
|
|
2691
2691
|
const N = t.docDefaultsRun[y] ?? !1;
|
|
2692
2692
|
g[y] = N !== (k[y] === !0) != (S[y] === !0);
|
|
2693
2693
|
}
|
|
2694
|
-
return a.set(
|
|
2694
|
+
return a.set(u, g), g;
|
|
2695
2695
|
};
|
|
2696
2696
|
return {
|
|
2697
|
-
run(
|
|
2698
|
-
const
|
|
2699
|
-
return h(Kt(g,
|
|
2697
|
+
run(d, l) {
|
|
2698
|
+
const u = d ?? t.defaultParaStyleId, g = c(u, l.styleId);
|
|
2699
|
+
return h(Kt(g, l));
|
|
2700
2700
|
},
|
|
2701
|
-
para(
|
|
2702
|
-
const
|
|
2703
|
-
return
|
|
2701
|
+
para(d) {
|
|
2702
|
+
const l = d.styleId ?? t.defaultParaStyleId, u = l ? s(l) : {}, g = ee(ee(t.docDefaultsPara, u), d);
|
|
2703
|
+
return d.styleId ? g.styleId = d.styleId : delete g.styleId, g;
|
|
2704
2704
|
},
|
|
2705
|
-
isHeading(
|
|
2706
|
-
if (!
|
|
2707
|
-
const
|
|
2708
|
-
return i(
|
|
2705
|
+
isHeading(d) {
|
|
2706
|
+
if (!d) return !1;
|
|
2707
|
+
const l = (u) => u !== void 0 && /(^|\s)heading(\s|\d|$)/i.test(u);
|
|
2708
|
+
return i(d).some((u) => l(u.name) || l(u.id));
|
|
2709
2709
|
}
|
|
2710
2710
|
};
|
|
2711
|
-
function h(
|
|
2712
|
-
const
|
|
2713
|
-
if (!
|
|
2714
|
-
const
|
|
2715
|
-
|
|
2711
|
+
function h(d) {
|
|
2712
|
+
const l = { ...d };
|
|
2713
|
+
if (!l.fontAscii && l.fontThemeAscii) {
|
|
2714
|
+
const u = qt(e, l.fontThemeAscii);
|
|
2715
|
+
u && (l.fontAscii = u);
|
|
2716
2716
|
}
|
|
2717
|
-
if (!
|
|
2718
|
-
const
|
|
2719
|
-
|
|
2717
|
+
if (!l.fontHAnsi && l.fontThemeHAnsi) {
|
|
2718
|
+
const u = qt(e, l.fontThemeHAnsi);
|
|
2719
|
+
u && (l.fontHAnsi = u);
|
|
2720
2720
|
}
|
|
2721
|
-
if (!
|
|
2722
|
-
const
|
|
2723
|
-
|
|
2721
|
+
if (!l.fontCs && l.fontThemeCs) {
|
|
2722
|
+
const u = qt(e, l.fontThemeCs);
|
|
2723
|
+
u && (l.fontCs = u);
|
|
2724
2724
|
}
|
|
2725
|
-
if (!
|
|
2726
|
-
const
|
|
2727
|
-
|
|
2725
|
+
if (!l.fontEastAsia && l.fontThemeEastAsia) {
|
|
2726
|
+
const u = qt(e, l.fontThemeEastAsia);
|
|
2727
|
+
u && (l.fontEastAsia = u);
|
|
2728
2728
|
}
|
|
2729
|
-
if ((
|
|
2730
|
-
const
|
|
2731
|
-
|
|
2729
|
+
if ((l.color === void 0 || l.color === "auto") && l.colorTheme) {
|
|
2730
|
+
const u = Le(e, l.colorTheme);
|
|
2731
|
+
u && (l.color = ei(u, l.colorThemeTint, l.colorThemeShade));
|
|
2732
2732
|
}
|
|
2733
|
-
if ((
|
|
2734
|
-
const
|
|
2735
|
-
|
|
2733
|
+
if ((l.underlineColor === void 0 || l.underlineColor === "auto") && l.underlineColorTheme) {
|
|
2734
|
+
const u = Le(e, l.underlineColorTheme);
|
|
2735
|
+
u && (l.underlineColor = u);
|
|
2736
2736
|
}
|
|
2737
|
-
return
|
|
2737
|
+
return l;
|
|
2738
2738
|
}
|
|
2739
2739
|
}
|
|
2740
2740
|
function Kt(t, e) {
|
|
@@ -2747,7 +2747,7 @@ function ee(t, e) {
|
|
|
2747
2747
|
i !== void 0 && (n[o] = i);
|
|
2748
2748
|
return n;
|
|
2749
2749
|
}
|
|
2750
|
-
var
|
|
2750
|
+
var Tt = Uint8Array, Dt = Uint16Array, fi = Int32Array, rn = new Tt([
|
|
2751
2751
|
0,
|
|
2752
2752
|
0,
|
|
2753
2753
|
0,
|
|
@@ -2782,7 +2782,7 @@ var yt = Uint8Array, Ht = Uint16Array, li = Int32Array, on = new yt([
|
|
|
2782
2782
|
0,
|
|
2783
2783
|
/* impossible */
|
|
2784
2784
|
0
|
|
2785
|
-
]),
|
|
2785
|
+
]), sn = new Tt([
|
|
2786
2786
|
0,
|
|
2787
2787
|
0,
|
|
2788
2788
|
0,
|
|
@@ -2816,39 +2816,39 @@ var yt = Uint8Array, Ht = Uint16Array, li = Int32Array, on = new yt([
|
|
|
2816
2816
|
/* unused */
|
|
2817
2817
|
0,
|
|
2818
2818
|
0
|
|
2819
|
-
]),
|
|
2820
|
-
for (var n = new
|
|
2819
|
+
]), di = new Tt([16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15]), an = function(t, e) {
|
|
2820
|
+
for (var n = new Dt(31), o = 0; o < 31; ++o)
|
|
2821
2821
|
n[o] = e += 1 << t[o - 1];
|
|
2822
|
-
for (var i = new
|
|
2822
|
+
for (var i = new fi(n[30]), o = 1; o < 30; ++o)
|
|
2823
2823
|
for (var r = n[o]; r < n[o + 1]; ++r)
|
|
2824
2824
|
i[r] = r - n[o] << 5 | o;
|
|
2825
2825
|
return { b: n, r: i };
|
|
2826
|
-
},
|
|
2827
|
-
|
|
2828
|
-
var
|
|
2826
|
+
}, cn = an(rn, 2), ln = cn.b, ui = cn.r;
|
|
2827
|
+
ln[28] = 258, ui[258] = 28;
|
|
2828
|
+
var hi = an(sn, 0), pi = hi.b, we = new Dt(32768);
|
|
2829
2829
|
for (var ft = 0; ft < 32768; ++ft) {
|
|
2830
|
-
var
|
|
2831
|
-
|
|
2830
|
+
var Mt = (ft & 43690) >> 1 | (ft & 21845) << 1;
|
|
2831
|
+
Mt = (Mt & 52428) >> 2 | (Mt & 13107) << 2, Mt = (Mt & 61680) >> 4 | (Mt & 3855) << 4, we[ft] = ((Mt & 65280) >> 8 | (Mt & 255) << 8) >> 1;
|
|
2832
2832
|
}
|
|
2833
2833
|
var $t = (function(t, e, n) {
|
|
2834
|
-
for (var o = t.length, i = 0, r = new
|
|
2834
|
+
for (var o = t.length, i = 0, r = new Dt(e); i < o; ++i)
|
|
2835
2835
|
t[i] && ++r[t[i] - 1];
|
|
2836
|
-
var s = new
|
|
2836
|
+
var s = new Dt(e);
|
|
2837
2837
|
for (i = 1; i < e; ++i)
|
|
2838
2838
|
s[i] = s[i - 1] + r[i - 1] << 1;
|
|
2839
2839
|
var a;
|
|
2840
2840
|
if (n) {
|
|
2841
|
-
a = new
|
|
2842
|
-
var
|
|
2841
|
+
a = new Dt(1 << e);
|
|
2842
|
+
var c = 15 - e;
|
|
2843
2843
|
for (i = 0; i < o; ++i)
|
|
2844
2844
|
if (t[i])
|
|
2845
|
-
for (var h = i << 4 | t[i],
|
|
2846
|
-
a[we[
|
|
2845
|
+
for (var h = i << 4 | t[i], d = e - t[i], l = s[t[i] - 1]++ << d, u = l | (1 << d) - 1; l <= u; ++l)
|
|
2846
|
+
a[we[l] >> c] = h;
|
|
2847
2847
|
} else
|
|
2848
|
-
for (a = new
|
|
2848
|
+
for (a = new Dt(o), i = 0; i < o; ++i)
|
|
2849
2849
|
t[i] && (a[i] = we[s[t[i] - 1]++] >> 15 - t[i]);
|
|
2850
2850
|
return a;
|
|
2851
|
-
}), Gt = new
|
|
2851
|
+
}), Gt = new Tt(288);
|
|
2852
2852
|
for (var ft = 0; ft < 144; ++ft)
|
|
2853
2853
|
Gt[ft] = 8;
|
|
2854
2854
|
for (var ft = 144; ft < 256; ++ft)
|
|
@@ -2857,24 +2857,24 @@ for (var ft = 256; ft < 280; ++ft)
|
|
|
2857
2857
|
Gt[ft] = 7;
|
|
2858
2858
|
for (var ft = 280; ft < 288; ++ft)
|
|
2859
2859
|
Gt[ft] = 8;
|
|
2860
|
-
var
|
|
2860
|
+
var fn = new Tt(32);
|
|
2861
2861
|
for (var ft = 0; ft < 32; ++ft)
|
|
2862
|
-
|
|
2863
|
-
var
|
|
2862
|
+
fn[ft] = 5;
|
|
2863
|
+
var mi = /* @__PURE__ */ $t(Gt, 9, 1), gi = /* @__PURE__ */ $t(fn, 5, 1), de = function(t) {
|
|
2864
2864
|
for (var e = t[0], n = 1; n < t.length; ++n)
|
|
2865
2865
|
t[n] > e && (e = t[n]);
|
|
2866
2866
|
return e;
|
|
2867
|
-
},
|
|
2867
|
+
}, xt = function(t, e, n) {
|
|
2868
2868
|
var o = e / 8 | 0;
|
|
2869
2869
|
return (t[o] | t[o + 1] << 8) >> (e & 7) & n;
|
|
2870
2870
|
}, ue = function(t, e) {
|
|
2871
2871
|
var n = e / 8 | 0;
|
|
2872
2872
|
return (t[n] | t[n + 1] << 8 | t[n + 2] << 16) >> (e & 7);
|
|
2873
|
-
},
|
|
2873
|
+
}, wi = function(t) {
|
|
2874
2874
|
return (t + 7) / 8 | 0;
|
|
2875
2875
|
}, ye = function(t, e, n) {
|
|
2876
|
-
return (e == null || e < 0) && (e = 0), (n == null || n > t.length) && (n = t.length), new
|
|
2877
|
-
},
|
|
2876
|
+
return (e == null || e < 0) && (e = 0), (n == null || n > t.length) && (n = t.length), new Tt(t.subarray(e, n));
|
|
2877
|
+
}, vi = [
|
|
2878
2878
|
"unexpected EOF",
|
|
2879
2879
|
"invalid block type",
|
|
2880
2880
|
"invalid length/literal",
|
|
@@ -2891,126 +2891,126 @@ var pi = /* @__PURE__ */ $t(Gt, 9, 1), mi = /* @__PURE__ */ $t(ln, 5, 1), de = f
|
|
|
2891
2891
|
"stream finishing",
|
|
2892
2892
|
"invalid zip data"
|
|
2893
2893
|
// determined by unknown compression method
|
|
2894
|
-
],
|
|
2895
|
-
var o = new Error(e ||
|
|
2896
|
-
if (o.code = t, Error.captureStackTrace && Error.captureStackTrace(o,
|
|
2894
|
+
], yt = function(t, e, n) {
|
|
2895
|
+
var o = new Error(e || vi[t]);
|
|
2896
|
+
if (o.code = t, Error.captureStackTrace && Error.captureStackTrace(o, yt), !n)
|
|
2897
2897
|
throw o;
|
|
2898
2898
|
return o;
|
|
2899
|
-
},
|
|
2899
|
+
}, ki = function(t, e, n, o) {
|
|
2900
2900
|
var i = t.length, r = o ? o.length : 0;
|
|
2901
2901
|
if (!i || e.f && !e.l)
|
|
2902
|
-
return n || new
|
|
2903
|
-
var s = !n, a = s || e.i != 2,
|
|
2904
|
-
s && (n = new
|
|
2902
|
+
return n || new Tt(0);
|
|
2903
|
+
var s = !n, a = s || e.i != 2, c = e.i;
|
|
2904
|
+
s && (n = new Tt(i * 3));
|
|
2905
2905
|
var h = function(X) {
|
|
2906
|
-
var
|
|
2907
|
-
if (X >
|
|
2908
|
-
var L = new
|
|
2906
|
+
var Y = n.length;
|
|
2907
|
+
if (X > Y) {
|
|
2908
|
+
var L = new Tt(Math.max(Y * 2, X));
|
|
2909
2909
|
L.set(n), n = L;
|
|
2910
2910
|
}
|
|
2911
|
-
},
|
|
2911
|
+
}, d = e.f || 0, l = e.p || 0, u = e.b || 0, g = e.l, k = e.d, S = e.m, y = e.n, N = i * 8;
|
|
2912
2912
|
do {
|
|
2913
2913
|
if (!g) {
|
|
2914
|
-
|
|
2915
|
-
var P =
|
|
2916
|
-
if (
|
|
2914
|
+
d = xt(t, l, 1);
|
|
2915
|
+
var P = xt(t, l + 1, 3);
|
|
2916
|
+
if (l += 3, P)
|
|
2917
2917
|
if (P == 1)
|
|
2918
|
-
g =
|
|
2918
|
+
g = mi, k = gi, S = 9, y = 5;
|
|
2919
2919
|
else if (P == 2) {
|
|
2920
|
-
var lt =
|
|
2921
|
-
|
|
2922
|
-
for (var R = new
|
|
2923
|
-
|
|
2924
|
-
|
|
2925
|
-
for (var
|
|
2926
|
-
var tt =
|
|
2927
|
-
|
|
2920
|
+
var lt = xt(t, l, 31) + 257, Z = xt(t, l + 10, 15) + 4, E = lt + xt(t, l + 5, 31) + 1;
|
|
2921
|
+
l += 14;
|
|
2922
|
+
for (var R = new Tt(E), _ = new Tt(19), j = 0; j < Z; ++j)
|
|
2923
|
+
_[di[j]] = xt(t, l + j * 3, 7);
|
|
2924
|
+
l += Z * 3;
|
|
2925
|
+
for (var F = de(_), A = (1 << F) - 1, C = $t(_, F, 1), j = 0; j < E; ) {
|
|
2926
|
+
var tt = C[xt(t, l, A)];
|
|
2927
|
+
l += tt & 15;
|
|
2928
2928
|
var z = tt >> 4;
|
|
2929
2929
|
if (z < 16)
|
|
2930
|
-
R[
|
|
2930
|
+
R[j++] = z;
|
|
2931
2931
|
else {
|
|
2932
2932
|
var Q = 0, ot = 0;
|
|
2933
|
-
for (z == 16 ? (ot = 3 +
|
|
2934
|
-
R[
|
|
2933
|
+
for (z == 16 ? (ot = 3 + xt(t, l, 3), l += 2, Q = R[j - 1]) : z == 17 ? (ot = 3 + xt(t, l, 7), l += 3) : z == 18 && (ot = 11 + xt(t, l, 127), l += 7); ot--; )
|
|
2934
|
+
R[j++] = Q;
|
|
2935
2935
|
}
|
|
2936
2936
|
}
|
|
2937
2937
|
var it = R.subarray(0, lt), U = R.subarray(lt);
|
|
2938
2938
|
S = de(it), y = de(U), g = $t(it, S, 1), k = $t(U, y, 1);
|
|
2939
2939
|
} else
|
|
2940
|
-
|
|
2940
|
+
yt(1);
|
|
2941
2941
|
else {
|
|
2942
|
-
var z =
|
|
2942
|
+
var z = wi(l) + 4, D = t[z - 4] | t[z - 3] << 8, nt = z + D;
|
|
2943
2943
|
if (nt > i) {
|
|
2944
|
-
|
|
2944
|
+
c && yt(0);
|
|
2945
2945
|
break;
|
|
2946
2946
|
}
|
|
2947
|
-
a && h(
|
|
2947
|
+
a && h(u + D), n.set(t.subarray(z, nt), u), e.b = u += D, e.p = l = nt * 8, e.f = d;
|
|
2948
2948
|
continue;
|
|
2949
2949
|
}
|
|
2950
|
-
if (
|
|
2951
|
-
|
|
2950
|
+
if (l > N) {
|
|
2951
|
+
c && yt(0);
|
|
2952
2952
|
break;
|
|
2953
2953
|
}
|
|
2954
2954
|
}
|
|
2955
|
-
a && h(
|
|
2956
|
-
for (var et = (1 << S) - 1, G = (1 << y) - 1, rt =
|
|
2957
|
-
var Q = g[ue(t,
|
|
2958
|
-
if (
|
|
2959
|
-
|
|
2955
|
+
a && h(u + 131072);
|
|
2956
|
+
for (var et = (1 << S) - 1, G = (1 << y) - 1, rt = l; ; rt = l) {
|
|
2957
|
+
var Q = g[ue(t, l) & et], f = Q >> 4;
|
|
2958
|
+
if (l += Q & 15, l > N) {
|
|
2959
|
+
c && yt(0);
|
|
2960
2960
|
break;
|
|
2961
2961
|
}
|
|
2962
|
-
if (Q ||
|
|
2963
|
-
n[
|
|
2964
|
-
else if (
|
|
2965
|
-
rt =
|
|
2962
|
+
if (Q || yt(2), f < 256)
|
|
2963
|
+
n[u++] = f;
|
|
2964
|
+
else if (f == 256) {
|
|
2965
|
+
rt = l, g = null;
|
|
2966
2966
|
break;
|
|
2967
2967
|
} else {
|
|
2968
|
-
var w =
|
|
2969
|
-
if (
|
|
2970
|
-
var
|
|
2971
|
-
w =
|
|
2968
|
+
var w = f - 254;
|
|
2969
|
+
if (f > 264) {
|
|
2970
|
+
var j = f - 257, B = rn[j];
|
|
2971
|
+
w = xt(t, l, (1 << B) - 1) + ln[j], l += B;
|
|
2972
2972
|
}
|
|
2973
|
-
var
|
|
2974
|
-
|
|
2975
|
-
var U =
|
|
2976
|
-
if (
|
|
2977
|
-
var
|
|
2978
|
-
U += ue(t,
|
|
2973
|
+
var W = k[ue(t, l) & G], I = W >> 4;
|
|
2974
|
+
W || yt(3), l += W & 15;
|
|
2975
|
+
var U = pi[I];
|
|
2976
|
+
if (I > 3) {
|
|
2977
|
+
var B = sn[I];
|
|
2978
|
+
U += ue(t, l) & (1 << B) - 1, l += B;
|
|
2979
2979
|
}
|
|
2980
|
-
if (
|
|
2981
|
-
|
|
2980
|
+
if (l > N) {
|
|
2981
|
+
c && yt(0);
|
|
2982
2982
|
break;
|
|
2983
2983
|
}
|
|
2984
|
-
a && h(
|
|
2985
|
-
var
|
|
2986
|
-
if (
|
|
2987
|
-
var J = r - U, V = Math.min(U,
|
|
2988
|
-
for (J +
|
|
2989
|
-
n[
|
|
2984
|
+
a && h(u + 131072);
|
|
2985
|
+
var H = u + w;
|
|
2986
|
+
if (u < U) {
|
|
2987
|
+
var J = r - U, V = Math.min(U, H);
|
|
2988
|
+
for (J + u < 0 && yt(3); u < V; ++u)
|
|
2989
|
+
n[u] = o[J + u];
|
|
2990
2990
|
}
|
|
2991
|
-
for (;
|
|
2992
|
-
n[
|
|
2991
|
+
for (; u < H; ++u)
|
|
2992
|
+
n[u] = n[u - U];
|
|
2993
2993
|
}
|
|
2994
2994
|
}
|
|
2995
|
-
e.l = g, e.p = rt, e.b =
|
|
2996
|
-
} while (!
|
|
2997
|
-
return
|
|
2998
|
-
},
|
|
2995
|
+
e.l = g, e.p = rt, e.b = u, e.f = d, g && (d = 1, e.m = S, e.d = k, e.n = y);
|
|
2996
|
+
} while (!d);
|
|
2997
|
+
return u != n.length && s ? ye(n, 0, u) : n.subarray(0, u);
|
|
2998
|
+
}, bi = /* @__PURE__ */ new Tt(0), It = function(t, e) {
|
|
2999
2999
|
return t[e] | t[e + 1] << 8;
|
|
3000
|
-
},
|
|
3000
|
+
}, St = function(t, e) {
|
|
3001
3001
|
return (t[e] | t[e + 1] << 8 | t[e + 2] << 16 | t[e + 3] << 24) >>> 0;
|
|
3002
3002
|
}, he = function(t, e) {
|
|
3003
|
-
return
|
|
3003
|
+
return St(t, e) + St(t, e + 4) * 4294967296;
|
|
3004
3004
|
};
|
|
3005
|
-
function
|
|
3006
|
-
return
|
|
3005
|
+
function yi(t, e) {
|
|
3006
|
+
return ki(t, { i: 2 }, e && e.out, e && e.dictionary);
|
|
3007
3007
|
}
|
|
3008
|
-
var ve = typeof TextDecoder < "u" && /* @__PURE__ */ new TextDecoder(),
|
|
3008
|
+
var ve = typeof TextDecoder < "u" && /* @__PURE__ */ new TextDecoder(), Ti = 0;
|
|
3009
3009
|
try {
|
|
3010
|
-
ve.decode(
|
|
3010
|
+
ve.decode(bi, { stream: !0 }), Ti = 1;
|
|
3011
3011
|
} catch {
|
|
3012
3012
|
}
|
|
3013
|
-
var
|
|
3013
|
+
var Si = function(t) {
|
|
3014
3014
|
for (var e = "", n = 0; ; ) {
|
|
3015
3015
|
var o = t[n++], i = (o > 127) + (o > 223) + (o > 239);
|
|
3016
3016
|
if (n + i > t.length)
|
|
@@ -3018,7 +3018,7 @@ var Ti = function(t) {
|
|
|
3018
3018
|
i ? i == 3 ? (o = ((o & 15) << 18 | (t[n++] & 63) << 12 | (t[n++] & 63) << 6 | t[n++] & 63) - 65536, e += String.fromCharCode(55296 | o >> 10, 56320 | o & 1023)) : i & 1 ? e += String.fromCharCode((o & 31) << 6 | t[n++] & 63) : e += String.fromCharCode((o & 15) << 12 | (t[n++] & 63) << 6 | t[n++] & 63) : e += String.fromCharCode(o);
|
|
3019
3019
|
}
|
|
3020
3020
|
};
|
|
3021
|
-
function
|
|
3021
|
+
function dn(t, e) {
|
|
3022
3022
|
if (e) {
|
|
3023
3023
|
for (var n = "", o = 0; o < t.length; o += 16384)
|
|
3024
3024
|
n += String.fromCharCode.apply(null, t.subarray(o, o + 16384));
|
|
@@ -3026,166 +3026,178 @@ function fn(t, e) {
|
|
|
3026
3026
|
} else {
|
|
3027
3027
|
if (ve)
|
|
3028
3028
|
return ve.decode(t);
|
|
3029
|
-
var i =
|
|
3030
|
-
return n.length &&
|
|
3031
|
-
}
|
|
3032
|
-
}
|
|
3033
|
-
var
|
|
3034
|
-
return e + 30 +
|
|
3035
|
-
},
|
|
3036
|
-
var o =
|
|
3037
|
-
return [
|
|
3038
|
-
},
|
|
3039
|
-
var a = i == 4294967295,
|
|
3040
|
-
if (o &&
|
|
3041
|
-
for (; e + 4 <
|
|
3042
|
-
if (
|
|
3029
|
+
var i = Si(t), r = i.s, n = i.r;
|
|
3030
|
+
return n.length && yt(8), r;
|
|
3031
|
+
}
|
|
3032
|
+
}
|
|
3033
|
+
var Pi = function(t, e) {
|
|
3034
|
+
return e + 30 + It(t, e + 26) + It(t, e + 28);
|
|
3035
|
+
}, xi = function(t, e, n) {
|
|
3036
|
+
var o = It(t, e + 28), i = It(t, e + 30), r = dn(t.subarray(e + 46, e + 46 + o), !(It(t, e + 8) & 2048)), s = e + 46 + o, a = Ai(t, s, i, n, St(t, e + 20), St(t, e + 24), St(t, e + 42)), c = a[0], h = a[1], d = a[2];
|
|
3037
|
+
return [It(t, e + 10), c, h, r, s + i + It(t, e + 32), d];
|
|
3038
|
+
}, Ai = function(t, e, n, o, i, r, s) {
|
|
3039
|
+
var a = i == 4294967295, c = r == 4294967295, h = s == 4294967295, d = e + n, l = a + c + h;
|
|
3040
|
+
if (o && l) {
|
|
3041
|
+
for (; e + 4 < d; e += 4 + It(t, e + 2))
|
|
3042
|
+
if (It(t, e) == 1)
|
|
3043
3043
|
return [
|
|
3044
|
-
a ? he(t, e + 4 + 8 *
|
|
3045
|
-
|
|
3046
|
-
h ? he(t, e + 4 + 8 * (
|
|
3044
|
+
a ? he(t, e + 4 + 8 * c) : i,
|
|
3045
|
+
c ? he(t, e + 4) : r,
|
|
3046
|
+
h ? he(t, e + 4 + 8 * (c + a)) : s,
|
|
3047
3047
|
1
|
|
3048
3048
|
];
|
|
3049
|
-
o < 2 &&
|
|
3049
|
+
o < 2 && yt(13);
|
|
3050
3050
|
}
|
|
3051
3051
|
return [i, r, s, 0];
|
|
3052
3052
|
};
|
|
3053
|
-
function
|
|
3054
|
-
for (var n = {}, o = t.length - 22;
|
|
3055
|
-
(!o || t.length - o > 65558) &&
|
|
3056
|
-
var i =
|
|
3053
|
+
function De(t, e) {
|
|
3054
|
+
for (var n = {}, o = t.length - 22; St(t, o) != 101010256; --o)
|
|
3055
|
+
(!o || t.length - o > 65558) && yt(13);
|
|
3056
|
+
var i = It(t, o + 8);
|
|
3057
3057
|
if (!i)
|
|
3058
3058
|
return {};
|
|
3059
|
-
var r =
|
|
3059
|
+
var r = St(t, o + 16), s = St(t, o - 20) == 117853008;
|
|
3060
3060
|
if (s) {
|
|
3061
|
-
var a =
|
|
3062
|
-
s =
|
|
3061
|
+
var a = St(t, o - 12);
|
|
3062
|
+
s = St(t, a) == 101075792, s && (i = St(t, a + 32), r = St(t, a + 48));
|
|
3063
3063
|
}
|
|
3064
|
-
for (var
|
|
3065
|
-
var
|
|
3066
|
-
r = S, (!
|
|
3064
|
+
for (var c = e && e.filter, h = 0; h < i; ++h) {
|
|
3065
|
+
var d = xi(t, r, s), l = d[0], u = d[1], g = d[2], k = d[3], S = d[4], y = d[5], N = Pi(t, y);
|
|
3066
|
+
r = S, (!c || c({
|
|
3067
3067
|
name: k,
|
|
3068
|
-
size:
|
|
3068
|
+
size: u,
|
|
3069
3069
|
originalSize: g,
|
|
3070
|
-
compression:
|
|
3071
|
-
})) && (
|
|
3070
|
+
compression: l
|
|
3071
|
+
})) && (l ? l == 8 ? n[k] = yi(t.subarray(N, N + u), { out: new Tt(g) }) : yt(14, "unknown compression type " + l) : n[k] = ye(t, N, N + u));
|
|
3072
3072
|
}
|
|
3073
3073
|
return n;
|
|
3074
3074
|
}
|
|
3075
|
-
const
|
|
3076
|
-
function
|
|
3077
|
-
if (
|
|
3078
|
-
throw new
|
|
3079
|
-
if (
|
|
3080
|
-
throw new
|
|
3081
|
-
|
|
3082
|
-
|
|
3075
|
+
const Ii = 64 * 1024 * 1024, Ci = 4096, Ei = 128 * 1024 * 1024, He = 32 * 1024 * 1024, Mi = [80, 75], Ri = [208, 207, 17, 224], ze = (t, e) => e.every((n, o) => t[o] === n);
|
|
3076
|
+
function Ni(t) {
|
|
3077
|
+
if (t.byteLength > Ii)
|
|
3078
|
+
throw new kt("ARCHIVE_LIMIT", "Document exceeds the maximum supported compressed size.");
|
|
3079
|
+
if (ze(t, Ri))
|
|
3080
|
+
throw new kt("ENCRYPTED", "Password-protected documents are not supported.");
|
|
3081
|
+
if (!ze(t, Mi))
|
|
3082
|
+
throw new kt("NOT_ZIP", "Not a .docx file (zip container signature missing).");
|
|
3083
|
+
const e = (c) => /^word\/media\//.test(c);
|
|
3084
|
+
let n, o, i = 0, r = 0;
|
|
3083
3085
|
try {
|
|
3084
|
-
o = [], n =
|
|
3085
|
-
filter: (
|
|
3086
|
+
o = [], n = De(t, {
|
|
3087
|
+
filter: (c) => {
|
|
3088
|
+
if (r++, r > Ci)
|
|
3089
|
+
throw new kt("ARCHIVE_LIMIT", "Document contains too many archive entries.");
|
|
3090
|
+
if (!Number.isSafeInteger(c.originalSize) || c.originalSize < 0 || c.originalSize > He)
|
|
3091
|
+
throw new kt("ARCHIVE_LIMIT", "Document contains an oversized archive part.");
|
|
3092
|
+
if (i += c.originalSize, i > Ei)
|
|
3093
|
+
throw new kt("ARCHIVE_LIMIT", "Document exceeds the maximum supported expanded size.");
|
|
3094
|
+
return e(c.name) ? (o.push(c.name), !1) : !0;
|
|
3095
|
+
}
|
|
3086
3096
|
});
|
|
3087
|
-
} catch (
|
|
3088
|
-
throw new
|
|
3089
|
-
}
|
|
3090
|
-
const
|
|
3091
|
-
const
|
|
3092
|
-
|
|
3097
|
+
} catch (c) {
|
|
3098
|
+
throw c instanceof kt ? c : new kt("NOT_ZIP", `Corrupt zip container: ${c instanceof Error ? c.message : String(c)}`);
|
|
3099
|
+
}
|
|
3100
|
+
const s = /* @__PURE__ */ new Map(), a = (c) => {
|
|
3101
|
+
const h = De(t, { filter: (d) => d.name === c })[c];
|
|
3102
|
+
if (h && h.byteLength > He)
|
|
3103
|
+
throw new kt("ARCHIVE_LIMIT", "Document contains an oversized media part.");
|
|
3104
|
+
return h && (n[c] = h), h;
|
|
3093
3105
|
};
|
|
3094
3106
|
return {
|
|
3095
|
-
part: (
|
|
3096
|
-
text(
|
|
3097
|
-
const
|
|
3098
|
-
if (
|
|
3099
|
-
const
|
|
3100
|
-
if (!
|
|
3101
|
-
const
|
|
3102
|
-
return
|
|
3107
|
+
part: (c) => n[c] ?? (e(c) ? a(c) : void 0),
|
|
3108
|
+
text(c) {
|
|
3109
|
+
const h = s.get(c);
|
|
3110
|
+
if (h !== void 0) return h;
|
|
3111
|
+
const d = n[c];
|
|
3112
|
+
if (!d) return;
|
|
3113
|
+
const l = dn(d);
|
|
3114
|
+
return s.set(c, l), l;
|
|
3103
3115
|
},
|
|
3104
|
-
names: () => [...Object.keys(n), ...o.filter((
|
|
3116
|
+
names: () => [...Object.keys(n), ...o.filter((c) => !(c in n))]
|
|
3105
3117
|
};
|
|
3106
3118
|
}
|
|
3107
|
-
function
|
|
3108
|
-
const o = (X,
|
|
3119
|
+
function Bi(t, e, n) {
|
|
3120
|
+
const o = (X, Y) => e?.(X, Y), i = new Rn(), r = [];
|
|
3109
3121
|
o("unzip", 0);
|
|
3110
|
-
const s =
|
|
3122
|
+
const s = Ni(t);
|
|
3111
3123
|
o("unzip", 1);
|
|
3112
|
-
const a = s.text("[Content_Types].xml"),
|
|
3124
|
+
const a = s.text("[Content_Types].xml"), c = (a !== void 0 ? Gn(a) : void 0) ?? "word/document.xml", h = s.text(c);
|
|
3113
3125
|
if (h === void 0)
|
|
3114
|
-
throw new
|
|
3115
|
-
const
|
|
3126
|
+
throw new kt("NO_DOCUMENT_PART", `Main document part "${c}" not found in the archive.`);
|
|
3127
|
+
const d = ne(s, c);
|
|
3116
3128
|
o("styles", 0);
|
|
3117
|
-
const
|
|
3129
|
+
const l = Jt(s, d, "styles") ?? s.text("word/styles.xml"), u = l !== void 0 ? si(l) : ri, g = Jt(s, d, "theme") ?? s.text("word/theme/theme1.xml"), k = g !== void 0 ? oi(g) : Qo, S = li(u, k), y = Jt(s, d, "numbering") ?? s.text("word/numbering.xml"), N = y !== void 0 ? Yo(y) : Xo;
|
|
3118
3130
|
o("styles", 1), o("parse", 0);
|
|
3119
|
-
const P =
|
|
3131
|
+
const P = to(h, c, i);
|
|
3120
3132
|
o("parse", 1), o("map", 0);
|
|
3121
3133
|
const z = {
|
|
3122
3134
|
w: P.section?.pageWidthTwips ?? 12240,
|
|
3123
3135
|
h: P.section?.pageHeightTwips ?? 15840
|
|
3124
|
-
},
|
|
3136
|
+
}, D = Eo(
|
|
3125
3137
|
i,
|
|
3126
3138
|
S,
|
|
3127
3139
|
P.sdts,
|
|
3128
3140
|
N,
|
|
3129
|
-
(X) =>
|
|
3141
|
+
(X) => ai(u, X),
|
|
3130
3142
|
z,
|
|
3131
3143
|
{ lineNumbering: P.section?.lineNumbering, pageNumberStart: P.section?.pageNumberStart }
|
|
3132
3144
|
), nt = [], lt = (X) => {
|
|
3133
|
-
const
|
|
3134
|
-
return nt.push(
|
|
3135
|
-
}, Z =
|
|
3136
|
-
Z.length === 0 && Z.push(
|
|
3137
|
-
const E =
|
|
3145
|
+
const Y = Vo(s, X, i);
|
|
3146
|
+
return nt.push(Y), Y;
|
|
3147
|
+
}, Z = D.mapBlocks(P.blocks, lt(d), oe(d));
|
|
3148
|
+
Z.length === 0 && Z.push(D.emptyParagraph());
|
|
3149
|
+
const E = D.mapSection(P.section);
|
|
3138
3150
|
P.pageColorHex && (E.pageColorHex = `#${P.pageColorHex}`);
|
|
3139
|
-
const R = Jt(s,
|
|
3140
|
-
|
|
3141
|
-
const
|
|
3142
|
-
if (
|
|
3143
|
-
const X = ne(s,
|
|
3144
|
-
for (const { docxId: wt, noteId: O } of
|
|
3145
|
-
const
|
|
3146
|
-
if (!
|
|
3151
|
+
const R = Jt(s, d, "settings") ?? s.text("word/settings.xml"), _ = R !== void 0 ? Li(R) : { evenAndOdd: !1 }, j = _.evenAndOdd;
|
|
3152
|
+
_e(E, "header", P.section?.headerRefs, P.section?.titlePg ?? !1, j, s, d, D, lt, i, P.sdts), _e(E, "footer", P.section?.footerRefs, P.section?.titlePg ?? !1, j, s, d, D, lt, i, P.sdts);
|
|
3153
|
+
const F = Zt(d, "footnotes") ?? "word/footnotes.xml", A = s.text(F), C = A !== void 0 ? Po(A, F, i, P.sdts) : /* @__PURE__ */ new Map(), tt = {};
|
|
3154
|
+
if (C.size > 0) {
|
|
3155
|
+
const X = ne(s, F), Y = lt(X), L = oe(X);
|
|
3156
|
+
for (const { docxId: wt, noteId: O } of D.footnoteRefs()) {
|
|
3157
|
+
const q = C.get(wt);
|
|
3158
|
+
if (!q) {
|
|
3147
3159
|
i.add("footnote-missing", "A footnote reference had no matching note body.");
|
|
3148
3160
|
continue;
|
|
3149
3161
|
}
|
|
3150
|
-
const st =
|
|
3162
|
+
const st = D.mapBlocks(q, Y, L), b = st.filter((v) => v.kind === "paragraph");
|
|
3151
3163
|
b.length < st.length && i.add("footnote-tables", "Tables inside footnotes were dropped (footnotes hold paragraphs only)."), b.length > 0 && (tt[O] = b);
|
|
3152
3164
|
}
|
|
3153
3165
|
}
|
|
3154
|
-
const Q = Zt(
|
|
3166
|
+
const Q = Zt(d, "endnotes") ?? "word/endnotes.xml", ot = s.text(Q), it = ot !== void 0 ? xo(ot, Q, i, P.sdts) : /* @__PURE__ */ new Map(), U = {};
|
|
3155
3167
|
let et;
|
|
3156
|
-
for (const { docxId: X, noteId:
|
|
3168
|
+
for (const { docxId: X, noteId: Y } of D.endnoteRefs()) {
|
|
3157
3169
|
const L = it.get(X);
|
|
3158
3170
|
if (!L) {
|
|
3159
3171
|
i.add("endnote-missing", "An endnote reference had no matching note body.");
|
|
3160
3172
|
continue;
|
|
3161
3173
|
}
|
|
3162
3174
|
if (!et) {
|
|
3163
|
-
const
|
|
3164
|
-
et = { media: lt(
|
|
3175
|
+
const q = ne(s, Q);
|
|
3176
|
+
et = { media: lt(q), link: oe(q) };
|
|
3165
3177
|
}
|
|
3166
|
-
const wt =
|
|
3167
|
-
O.length < wt.length && i.add("endnote-tables", "Tables inside endnotes were dropped (endnotes hold paragraphs only)."), O.length > 0 && (U[
|
|
3178
|
+
const wt = D.mapBlocks(L, et.media, et.link), O = wt.filter((q) => q.kind === "paragraph");
|
|
3179
|
+
O.length < wt.length && i.add("endnote-tables", "Tables inside endnotes were dropped (endnotes hold paragraphs only)."), O.length > 0 && (U[Y] = O);
|
|
3168
3180
|
}
|
|
3169
3181
|
o("map", 1);
|
|
3170
3182
|
const G = { section: E, blocks: Z };
|
|
3171
3183
|
Object.keys(tt).length > 0 && (G.footnotes = tt), Object.keys(U).length > 0 && (G.endnotes = U);
|
|
3172
3184
|
const rt = Wo(P.sdts);
|
|
3173
3185
|
Object.keys(rt).length > 0 && (G.sdts = rt);
|
|
3174
|
-
const
|
|
3175
|
-
Object.keys(
|
|
3176
|
-
const w =
|
|
3186
|
+
const f = D.lists();
|
|
3187
|
+
Object.keys(f).length > 0 && (G.lists = f);
|
|
3188
|
+
const w = D.bookmarks();
|
|
3177
3189
|
Object.keys(w).length > 0 && (G.bookmarks = w);
|
|
3178
|
-
const
|
|
3179
|
-
|
|
3180
|
-
const
|
|
3181
|
-
|
|
3182
|
-
const
|
|
3183
|
-
|
|
3184
|
-
const
|
|
3190
|
+
const B = $o(u);
|
|
3191
|
+
B && (G.stylesheet = B);
|
|
3192
|
+
const W = Uo(u);
|
|
3193
|
+
W && (G.tableStyles = W);
|
|
3194
|
+
const I = D.tocField();
|
|
3195
|
+
I && (G.tocInstruction = I.instruction, Sn(G) === 0 && (G.tocAnchorBlockId = I.blockId)), P.fields && (G.fields = P.fields), _.defaultTabStopPx !== void 0 && (G.defaultTabStopPx = _.defaultTabStopPx), _.compatSettings && (G.compatSettings = _.compatSettings);
|
|
3196
|
+
const H = Zt(d, "comments") ?? "word/comments.xml", J = s.text(H);
|
|
3185
3197
|
let V;
|
|
3186
3198
|
if (J !== void 0) {
|
|
3187
|
-
const X = jn(J),
|
|
3188
|
-
V =
|
|
3199
|
+
const X = jn(J), Y = Zt(d, "commentsExtended") ?? "word/commentsExtended.xml", L = s.text(Y), wt = L !== void 0 ? Wn(L) : /* @__PURE__ */ new Map(), O = D.commentAnchors(), q = Z[0]?.id;
|
|
3200
|
+
V = $n(X, wt, O, q ? { start: { blockId: q, offset: 0 }, end: { blockId: q, offset: 0 } } : void 0);
|
|
3189
3201
|
}
|
|
3190
3202
|
return {
|
|
3191
3203
|
doc: G,
|
|
@@ -3195,26 +3207,26 @@ function Ei(t, e, n) {
|
|
|
3195
3207
|
media: r
|
|
3196
3208
|
};
|
|
3197
3209
|
}
|
|
3198
|
-
function
|
|
3210
|
+
function Fi(t, e, n, o, i, r, s) {
|
|
3199
3211
|
if (!n) return;
|
|
3200
|
-
const a = e.get(n),
|
|
3201
|
-
if (a === void 0 ||
|
|
3212
|
+
const a = e.get(n), c = a && !a.external ? t.text(a.target) : void 0;
|
|
3213
|
+
if (a === void 0 || c === void 0) {
|
|
3202
3214
|
r.add("header-missing", "A referenced header/footer part was missing from the archive.");
|
|
3203
3215
|
return;
|
|
3204
3216
|
}
|
|
3205
|
-
const h = ne(t, a.target),
|
|
3206
|
-
return
|
|
3217
|
+
const h = ne(t, a.target), d = eo(c, a.target, r, s), l = o.mapBlocks(d, i(h), oe(h));
|
|
3218
|
+
return l.length > 0 ? l : void 0;
|
|
3207
3219
|
}
|
|
3208
|
-
function
|
|
3220
|
+
function _e(t, e, n, o, i, r, s, a, c, h, d) {
|
|
3209
3221
|
if (!n) return;
|
|
3210
|
-
const
|
|
3211
|
-
const S =
|
|
3222
|
+
const l = (g) => `${e}${g}`, u = (g, k) => {
|
|
3223
|
+
const S = Fi(r, s, k, a, c, h, d);
|
|
3212
3224
|
S && (t[g] = S);
|
|
3213
3225
|
};
|
|
3214
|
-
|
|
3226
|
+
u(l(""), n.default), o && u(l("First"), n.first), i && u(l("Even"), n.even);
|
|
3215
3227
|
}
|
|
3216
|
-
function
|
|
3217
|
-
const e =
|
|
3228
|
+
function Li(t) {
|
|
3229
|
+
const e = bt(Pt(t, "settings.xml"), "w:settings");
|
|
3218
3230
|
if (!e) return { evenAndOdd: !1 };
|
|
3219
3231
|
const n = { evenAndOdd: !!p(e, "w:evenAndOddHeadersAndFooters") }, o = T(p(e, "w:defaultTabStop"), "w:val");
|
|
3220
3232
|
o !== void 0 && o > 0 && o !== 720 && (n.defaultTabStopPx = M($(o)));
|
|
@@ -3226,8 +3238,8 @@ function Ri(t) {
|
|
|
3226
3238
|
return n;
|
|
3227
3239
|
}
|
|
3228
3240
|
function ne(t, e) {
|
|
3229
|
-
const n = t.text(
|
|
3230
|
-
return n !== void 0 ?
|
|
3241
|
+
const n = t.text(Zo(e));
|
|
3242
|
+
return n !== void 0 ? Ko(n, e) : /* @__PURE__ */ new Map();
|
|
3231
3243
|
}
|
|
3232
3244
|
function oe(t) {
|
|
3233
3245
|
return (e) => {
|
|
@@ -3236,23 +3248,23 @@ function oe(t) {
|
|
|
3236
3248
|
};
|
|
3237
3249
|
}
|
|
3238
3250
|
function Jt(t, e, n) {
|
|
3239
|
-
const o =
|
|
3251
|
+
const o = on(e, n);
|
|
3240
3252
|
return o && !o.external ? t.text(o.target) : void 0;
|
|
3241
3253
|
}
|
|
3242
3254
|
function Zt(t, e) {
|
|
3243
|
-
const n =
|
|
3255
|
+
const n = on(t, e);
|
|
3244
3256
|
return n && !n.external ? n.target : void 0;
|
|
3245
3257
|
}
|
|
3246
|
-
const
|
|
3247
|
-
|
|
3258
|
+
const Wt = self;
|
|
3259
|
+
Wt.onmessage = (t) => {
|
|
3248
3260
|
const { id: e, buf: n } = t.data;
|
|
3249
3261
|
try {
|
|
3250
|
-
const o =
|
|
3251
|
-
|
|
3262
|
+
const o = Bi(new Uint8Array(n), (i, r) => {
|
|
3263
|
+
Wt.postMessage({ id: e, type: "progress", phase: i, pct: r });
|
|
3252
3264
|
});
|
|
3253
|
-
|
|
3265
|
+
Wt.postMessage({ id: e, type: "done", result: o });
|
|
3254
3266
|
} catch (o) {
|
|
3255
|
-
o instanceof
|
|
3267
|
+
o instanceof kt ? Wt.postMessage({ id: e, type: "error", code: o.code, message: o.message }) : Wt.postMessage({
|
|
3256
3268
|
id: e,
|
|
3257
3269
|
type: "error",
|
|
3258
3270
|
code: "MALFORMED_XML",
|