@forevka/wordcanvas 0.7.2 → 0.7.3
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-4HYrkNrG.js → worker-CqU4Popa.js} +399 -375
- package/dist-lib/assets/{worker-CJpwUzKh.js → worker-Cw5cYW5z.js} +359 -344
- package/dist-lib/{blockFactory-B_CLnkUh.js → blockFactory-DDCRWDnA.js} +16 -31
- package/dist-lib/browser-BUrsjziD.js +612 -0
- package/dist-lib/builder.js +16 -17
- package/dist-lib/editorApp-CB_ZArIF.js +9566 -0
- package/dist-lib/export.js +28 -28
- package/dist-lib/generate-toc.js +6 -6
- package/dist-lib/import.js +2 -2
- package/dist-lib/lists-DpmgbDyt.js +110 -0
- package/dist-lib/measure.js +2 -2
- package/dist-lib/{measureHost-B2aKX7lF.js → measureHost-BlukHGwx.js} +1 -1
- package/dist-lib/metrics-bvGO8KDK.js +96 -0
- package/dist-lib/paintStyle-vT6jtWbH.js +74 -0
- package/dist-lib/{pipeline-DD0nxAYM.js → pipeline-UryP-u7Z.js} +80 -80
- package/dist-lib/recalc-docx.js +2 -2
- package/dist-lib/{recalcToc-CFCGCgij.js → recalcToc-BfXlXZik.js} +3 -3
- package/dist-lib/{stylesheet-B6oczA-L.js → stylesheet-LTBEGkvG.js} +32 -27
- package/dist-lib/toc-D09f4PrI.js +939 -0
- package/dist-lib/{webmcp-CXghUon_.js → webmcp-K6UZgQJ0.js} +60 -68
- package/dist-lib/wordcanvas-DBx2ana_.js +734 -0
- package/dist-lib/wordcanvas.js +4 -2
- package/dist-node/{chunk-PIMVQULL.js → chunk-373K2XRY.js} +34 -22
- package/dist-node/chunk-373K2XRY.js.map +7 -0
- package/dist-node/{chunk-57L5XMCL.js → chunk-3PUV3BG6.js} +2 -2
- package/dist-node/{chunk-U27EBKBG.js → chunk-5RX3IHWE.js} +3 -3
- package/dist-node/chunk-5RX3IHWE.js.map +7 -0
- package/dist-node/{chunk-SA26UVIJ.js → chunk-HWQKGDS2.js} +2 -2
- package/dist-node/{chunk-T3253N22.js → chunk-ZLLSXOO2.js} +3 -3
- package/dist-node/{engine-5F7DUU4W.js → engine-LLA6PCS5.js} +4 -4
- package/dist-node/export.js +5 -5
- package/dist-node/generate-toc.js +4 -4
- package/dist-node/import.js +2 -2
- package/dist-node/measure.js +2 -2
- package/dist-node/recalc-docx.js +3 -3
- package/package.json +1 -1
- package/types/wordcanvas.d.ts +649 -212
- package/dist-lib/browser-p_rkUcqE.js +0 -1339
- package/dist-lib/editorApp-mTD0YNv-.js +0 -9863
- package/dist-lib/lists-Sc5I40JO.js +0 -110
- package/dist-lib/metrics-BUMIC9Mv.js +0 -164
- package/dist-lib/toc-Dj57zdz-.js +0 -213
- package/dist-lib/wordcanvas-D5DI9ZR1.js +0 -151
- package/dist-node/chunk-PIMVQULL.js.map +0 -7
- package/dist-node/chunk-U27EBKBG.js.map +0 -7
- /package/dist-node/{chunk-57L5XMCL.js.map → chunk-3PUV3BG6.js.map} +0 -0
- /package/dist-node/{chunk-SA26UVIJ.js.map → chunk-HWQKGDS2.js.map} +0 -0
- /package/dist-node/{chunk-T3253N22.js.map → chunk-ZLLSXOO2.js.map} +0 -0
- /package/dist-node/{engine-5F7DUU4W.js.map → engine-LLA6PCS5.js.map} +0 -0
|
@@ -1,17 +1,40 @@
|
|
|
1
|
-
const
|
|
2
|
-
function
|
|
1
|
+
const Ft = (e) => e.map((n) => n.text).join("");
|
|
2
|
+
function Mt(e = {}) {
|
|
3
|
+
return {
|
|
4
|
+
fontFamily: e.fontFamily ?? "Georgia, serif",
|
|
5
|
+
fontSizePx: e.fontSizePx ?? 16,
|
|
6
|
+
bold: !1,
|
|
7
|
+
italic: !1,
|
|
8
|
+
underline: !1,
|
|
9
|
+
strikethrough: !1,
|
|
10
|
+
color: e.color ?? "#202124"
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
function Rt(e = {}) {
|
|
14
|
+
return {
|
|
15
|
+
align: "left",
|
|
16
|
+
lineHeight: e.lineHeight ?? 1.5,
|
|
17
|
+
spaceBeforePx: 0,
|
|
18
|
+
spaceAfterPx: 12,
|
|
19
|
+
indentFirstLinePx: 0,
|
|
20
|
+
indentLeftPx: 0
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
const Bt = Mt();
|
|
24
|
+
Rt();
|
|
25
|
+
function Lt(e, n) {
|
|
3
26
|
return e.fontFamily === n.fontFamily && e.fontSizePx === n.fontSizePx && e.bold === n.bold && e.italic === n.italic && e.underline === n.underline && e.strikethrough === n.strikethrough && e.color === n.color && !!e.hidden == !!n.hidden && // hidden runs must never merge with visible ones
|
|
4
27
|
(e.letterSpacingPx ?? 0) === (n.letterSpacingPx ?? 0) && e.highlightColor === n.highlightColor && e.verticalAlign === n.verticalAlign && e.link === n.link && e.footnoteRef === n.footnoteRef && // adjacent refs must never merge into one run
|
|
5
28
|
e.sdtId === n.sdtId && // content-control boundaries survive normalization
|
|
6
29
|
e.fieldId === n.fieldId;
|
|
7
30
|
}
|
|
8
|
-
function
|
|
31
|
+
function Ot(e, n) {
|
|
9
32
|
const t = e.filter((r) => r.text.length > 0);
|
|
10
33
|
if (t.length === 0) return [{ text: "", style: e[0]?.style ?? n }];
|
|
11
34
|
const o = [{ ...t[0] }];
|
|
12
35
|
for (let r = 1; r < t.length; r++) {
|
|
13
36
|
const i = t[r], a = o[o.length - 1];
|
|
14
|
-
|
|
37
|
+
Lt(a.style, i.style) ? a.text += i.text : o.push({ ...i });
|
|
15
38
|
}
|
|
16
39
|
return o;
|
|
17
40
|
}
|
|
@@ -24,11 +47,11 @@ function Ze(e, n) {
|
|
|
24
47
|
}
|
|
25
48
|
return [t, o];
|
|
26
49
|
}
|
|
27
|
-
function
|
|
50
|
+
function Nt(e, n, t) {
|
|
28
51
|
const [, o] = Ze(e, n), [r] = Ze(o, t - n);
|
|
29
52
|
return r;
|
|
30
53
|
}
|
|
31
|
-
function
|
|
54
|
+
function Dt(e, n = 20) {
|
|
32
55
|
if (!e.bookmarks) return 0;
|
|
33
56
|
const t = e.section.pageWidthPx - e.section.marginPx.left - e.section.marginPx.right;
|
|
34
57
|
let o = 0;
|
|
@@ -38,23 +61,15 @@ function Ot(e, n = 20) {
|
|
|
38
61
|
if (!i) continue;
|
|
39
62
|
const a = e.bookmarks[i]?.start.blockId;
|
|
40
63
|
if (!a) continue;
|
|
41
|
-
const s =
|
|
64
|
+
const s = Ft(r.runs), d = s.match(/\t\d+\s*$/);
|
|
42
65
|
if (!d) continue;
|
|
43
|
-
r.runs =
|
|
66
|
+
r.runs = Nt(r.runs, 0, s.length - d[0].length), r.runs.length === 0 && (r.runs = [{ text: "", style: { ...Ht } }]);
|
|
44
67
|
const u = Math.min(9, Math.max(1, Math.round((r.style.indentLeftPx || 0) / n) + 1));
|
|
45
68
|
r.style.tocEntry = { targetId: a, level: u }, !r.style.tabStops?.length && t > 0 && (r.style.tabStops = [{ posPx: t, align: "right", leader: "dot" }]), r.revision++, o++;
|
|
46
69
|
}
|
|
47
70
|
return o;
|
|
48
71
|
}
|
|
49
|
-
const
|
|
50
|
-
fontFamily: "Georgia, serif",
|
|
51
|
-
fontSizePx: 13,
|
|
52
|
-
bold: !1,
|
|
53
|
-
italic: !1,
|
|
54
|
-
underline: !1,
|
|
55
|
-
strikethrough: !1,
|
|
56
|
-
color: "#202124"
|
|
57
|
-
}, Nt = /* @__PURE__ */ new Set([
|
|
72
|
+
const Ht = { ...Bt, fontSizePx: 13 }, zt = /* @__PURE__ */ new Set([
|
|
58
73
|
"TOC",
|
|
59
74
|
"PAGE",
|
|
60
75
|
"NUMPAGES",
|
|
@@ -115,24 +130,24 @@ const Lt = {
|
|
|
115
130
|
"LINK",
|
|
116
131
|
"NOTEREF"
|
|
117
132
|
]);
|
|
118
|
-
function
|
|
119
|
-
return
|
|
133
|
+
function Ut(e) {
|
|
134
|
+
return zt.has(e.trim().toUpperCase());
|
|
120
135
|
}
|
|
121
|
-
function
|
|
136
|
+
function _t(e) {
|
|
122
137
|
const n = [], t = /"([^"]*)"|(\S+)/g;
|
|
123
138
|
let o;
|
|
124
139
|
for (; (o = t.exec(e)) !== null; ) n.push(o[1] !== void 0 ? o[1] : o[2]);
|
|
125
140
|
return n;
|
|
126
141
|
}
|
|
127
142
|
function Ve(e) {
|
|
128
|
-
const n =
|
|
143
|
+
const n = _t(e);
|
|
129
144
|
return { name: n.length > 0 ? n[0].toUpperCase() : "", args: n.slice(1), raw: e };
|
|
130
145
|
}
|
|
131
|
-
function
|
|
146
|
+
function Gt(e) {
|
|
132
147
|
const n = Ve(e).name;
|
|
133
|
-
return n.length > 0 && !
|
|
148
|
+
return n.length > 0 && !Ut(n);
|
|
134
149
|
}
|
|
135
|
-
const
|
|
150
|
+
const jt = /* @__PURE__ */ new Set(["=", "<>", "<", ">", "<=", ">="]);
|
|
136
151
|
function Qe(e) {
|
|
137
152
|
if (/\\\*\s*ROMAN\b/.test(e)) return "Roman";
|
|
138
153
|
if (/\\\*\s*roman\b/.test(e)) return "roman";
|
|
@@ -142,7 +157,7 @@ function Qe(e) {
|
|
|
142
157
|
function Je(e) {
|
|
143
158
|
return e.match(/\\@\s*"([^"]*)"/)?.[1] ?? e.match(/\\@\s*(\S+)/)?.[1];
|
|
144
159
|
}
|
|
145
|
-
function
|
|
160
|
+
function $t(e, n) {
|
|
146
161
|
switch (e.name) {
|
|
147
162
|
case "PAGE": {
|
|
148
163
|
const t = Qe(e.raw);
|
|
@@ -158,7 +173,7 @@ function Gt(e, n) {
|
|
|
158
173
|
return { type: "TIME", format: Je(e.raw) ?? "h:mm AM/PM" };
|
|
159
174
|
case "IF": {
|
|
160
175
|
const [t, o, r, i, a] = e.args;
|
|
161
|
-
return t === void 0 || o === void 0 || r === void 0 || !
|
|
176
|
+
return t === void 0 || o === void 0 || r === void 0 || !jt.has(o) ? void 0 : {
|
|
162
177
|
type: "IF",
|
|
163
178
|
operandA: t,
|
|
164
179
|
op: o,
|
|
@@ -171,7 +186,7 @@ function Gt(e, n) {
|
|
|
171
186
|
return;
|
|
172
187
|
}
|
|
173
188
|
}
|
|
174
|
-
function
|
|
189
|
+
function Oe(e) {
|
|
175
190
|
return e.replace(/&(#x[0-9a-fA-F]+|#\d+|amp|lt|gt|quot|apos);/g, function(n, t) {
|
|
176
191
|
if (t === "amp") return "&";
|
|
177
192
|
if (t === "lt") return "<";
|
|
@@ -212,8 +227,8 @@ Char: ` + e[t]);
|
|
|
212
227
|
t === -1 && (t = e.length), o && H.push(e.substring(y, t + 1));
|
|
213
228
|
} else {
|
|
214
229
|
if (e.charCodeAt(t + 2) === S && e.charCodeAt(t + 8) === S && e.substr(t + 3, 5).toLowerCase() === "cdata") {
|
|
215
|
-
var
|
|
216
|
-
|
|
230
|
+
var G = e.indexOf("]]>", t);
|
|
231
|
+
G == -1 ? (H.push(e.substr(t + 9)), t = e.length) : (H.push(e.substring(t + 9, G)), t = G + 3);
|
|
217
232
|
continue;
|
|
218
233
|
}
|
|
219
234
|
{
|
|
@@ -229,10 +244,10 @@ Char: ` + e[t]);
|
|
|
229
244
|
var m = X();
|
|
230
245
|
H.push(m);
|
|
231
246
|
} else {
|
|
232
|
-
var
|
|
233
|
-
if (r)
|
|
247
|
+
var F = E();
|
|
248
|
+
if (r) F.length > 0 && H.push(F);
|
|
234
249
|
else {
|
|
235
|
-
var C =
|
|
250
|
+
var C = F.trim();
|
|
236
251
|
C.length > 0 && H.push(C);
|
|
237
252
|
}
|
|
238
253
|
t++;
|
|
@@ -243,7 +258,7 @@ Char: ` + e[t]);
|
|
|
243
258
|
var P = t;
|
|
244
259
|
(t = e.indexOf("<", t) - 1) === -2 && (t = e.length);
|
|
245
260
|
var H = e.slice(P, t + 1);
|
|
246
|
-
return i ?
|
|
261
|
+
return i ? Oe(H) : H;
|
|
247
262
|
}
|
|
248
263
|
var N = `\r
|
|
249
264
|
>/= `;
|
|
@@ -255,40 +270,40 @@ Char: ` + e[t]);
|
|
|
255
270
|
function X() {
|
|
256
271
|
t++;
|
|
257
272
|
const P = Z(), H = P[0] === "?", re = t, Q = {};
|
|
258
|
-
let
|
|
273
|
+
let G = [];
|
|
259
274
|
for (; e[t] && e.charCodeAt(t) !== s && (!H || e.charCodeAt(t) !== c || e.charCodeAt(t + 1) !== s); ) {
|
|
260
275
|
var l = e.charCodeAt(t);
|
|
261
276
|
if (l > 64 && l < 91 || l > 96 && l < 123) {
|
|
262
|
-
for (var m = Z(),
|
|
277
|
+
for (var m = Z(), F = null; e.charCodeAt(t) === 32 || e.charCodeAt(t) === 9 || e.charCodeAt(t) === 10 || e.charCodeAt(t) === 13; ) t++;
|
|
263
278
|
if (e.charCodeAt(t) === T) {
|
|
264
279
|
for (t++; e.charCodeAt(t) === 32 || e.charCodeAt(t) === 9 || e.charCodeAt(t) === 10 || e.charCodeAt(t) === 13; ) t++;
|
|
265
280
|
var C = e.charCodeAt(t);
|
|
266
281
|
if (C === p || C === g) {
|
|
267
|
-
if (
|
|
282
|
+
if (F = q(), t === -1) return { tagName: P, attributes: Q, children: G };
|
|
268
283
|
} else if (C && C !== s) {
|
|
269
284
|
for (var y = t; e[t] && N.indexOf(e[t]) === -1; ) t++;
|
|
270
|
-
|
|
285
|
+
F = e.slice(y, t), i && (F = Oe(F));
|
|
271
286
|
}
|
|
272
287
|
}
|
|
273
|
-
Q[m] =
|
|
288
|
+
Q[m] = F;
|
|
274
289
|
} else t++;
|
|
275
290
|
}
|
|
276
291
|
if (H) {
|
|
277
|
-
var
|
|
278
|
-
return
|
|
292
|
+
var M = e.slice(re, t).trim();
|
|
293
|
+
return M.length > 0 && Object.keys(Q).length === 0 && (G = [M]), e.charCodeAt(t) === c && e.charCodeAt(t + 1) === s ? t += 2 : e.charCodeAt(t) === s && (t += 1), { tagName: P, attributes: Q, children: G };
|
|
279
294
|
}
|
|
280
295
|
if (e.charCodeAt(t - 1) !== u && e.charCodeAt(t - 1) !== x) if (P == "script") {
|
|
281
296
|
var R = t + 1;
|
|
282
|
-
t = e.indexOf("<\/script>", t),
|
|
283
|
-
} else P == "style" ? (R = t + 1, t = e.indexOf("</style>", t),
|
|
297
|
+
t = e.indexOf("<\/script>", t), G = [e.slice(R, t)], t += 9;
|
|
298
|
+
} else P == "style" ? (R = t + 1, t = e.indexOf("</style>", t), G = [e.slice(R, t)], t += 8) : K.indexOf(P) === -1 ? (t++, G = I(P)) : t++;
|
|
284
299
|
else t++;
|
|
285
|
-
return { tagName: P, attributes: Q, children:
|
|
300
|
+
return { tagName: P, attributes: Q, children: G };
|
|
286
301
|
}
|
|
287
302
|
function q() {
|
|
288
303
|
var P = e[t], H = t + 1;
|
|
289
304
|
t = e.indexOf(P, H);
|
|
290
305
|
var re = e.slice(H, t);
|
|
291
|
-
return i ?
|
|
306
|
+
return i ? Oe(re) : re;
|
|
292
307
|
}
|
|
293
308
|
function ee() {
|
|
294
309
|
if (!n || !n.attrName || !n.attrValue) return -1;
|
|
@@ -297,10 +312,10 @@ Char: ` + e[t]);
|
|
|
297
312
|
}
|
|
298
313
|
if (n.attrValue !== void 0) for (n.attrName = n.attrName || "id", z = []; (t = ee()) !== -1; ) (t = e.lastIndexOf("<", t)) !== -1 && z.push(X()), e = e.substr(t), t = 0;
|
|
299
314
|
else z = n.parseNode ? X() : I("");
|
|
300
|
-
return n.filter && Array.isArray(z) && (z = ut(z, n.filter)), n.simplify ?
|
|
315
|
+
return n.filter && Array.isArray(z) && (z = ut(z, n.filter)), n.simplify ? _e(Array.isArray(z) ? z : [z]) : (n.setPos && typeof z == "object" && !Array.isArray(z) && (z.pos = t), z);
|
|
301
316
|
}
|
|
302
|
-
function
|
|
303
|
-
if (typeof e == "string") return
|
|
317
|
+
function _e(e) {
|
|
318
|
+
if (typeof e == "string") return _e(dt(e));
|
|
304
319
|
if (!Array.isArray(e)) throw new TypeError("simplify() expects parsed node array or XML string");
|
|
305
320
|
var n = {};
|
|
306
321
|
if (!e.length) return "";
|
|
@@ -308,7 +323,7 @@ function Ge(e) {
|
|
|
308
323
|
for (var t in e.forEach(function(o) {
|
|
309
324
|
if (typeof o == "object") {
|
|
310
325
|
n[o.tagName] || (n[o.tagName] = []);
|
|
311
|
-
var r =
|
|
326
|
+
var r = _e(o.children);
|
|
312
327
|
n[o.tagName].push(r), Object.keys(o.attributes).length && typeof r == "object" && !Array.isArray(r) && (r._attributes = o.attributes);
|
|
313
328
|
}
|
|
314
329
|
}), n) n[t].length == 1 && (n[t] = n[t][0]);
|
|
@@ -332,7 +347,7 @@ class ge extends Error {
|
|
|
332
347
|
super(t), this.name = "ImportError", this.code = n;
|
|
333
348
|
}
|
|
334
349
|
}
|
|
335
|
-
class
|
|
350
|
+
class Wt {
|
|
336
351
|
list = [];
|
|
337
352
|
seen = /* @__PURE__ */ new Set();
|
|
338
353
|
add(n, t) {
|
|
@@ -394,26 +409,26 @@ function b(e, n) {
|
|
|
394
409
|
const o = Number(t);
|
|
395
410
|
return Number.isFinite(o) ? o : void 0;
|
|
396
411
|
}
|
|
397
|
-
const
|
|
412
|
+
const Xt = /* @__PURE__ */ new Set([
|
|
398
413
|
"application/vnd.openxmlformats-officedocument.wordprocessingml.document.main+xml",
|
|
399
414
|
"application/vnd.ms-word.document.macroEnabled.main+xml"
|
|
400
415
|
]);
|
|
401
|
-
function
|
|
416
|
+
function Vt(e) {
|
|
402
417
|
const n = de(ue(e, "[Content_Types].xml"), "Types");
|
|
403
418
|
if (n)
|
|
404
419
|
for (const t of oe(n)) {
|
|
405
420
|
if (t.tagName !== "Override") continue;
|
|
406
421
|
const o = w(t, "ContentType"), r = w(t, "PartName");
|
|
407
|
-
if (o && r &&
|
|
422
|
+
if (o && r && Xt.has(o))
|
|
408
423
|
return r.replace(/^\//, "");
|
|
409
424
|
}
|
|
410
425
|
}
|
|
411
|
-
const W = (e) => e / 15,
|
|
412
|
-
top:
|
|
413
|
-
right:
|
|
414
|
-
bottom:
|
|
415
|
-
left:
|
|
416
|
-
}),
|
|
426
|
+
const W = (e) => e / 15, Yt = (e) => e * 2 / 3, Ce = (e) => e / 9525, Kt = (e) => e / 240, L = (e) => Math.round(e * 100) / 100, Ne = (e) => ({
|
|
427
|
+
top: L(W(e.top)),
|
|
428
|
+
right: L(W(e.right)),
|
|
429
|
+
bottom: L(W(e.bottom)),
|
|
430
|
+
left: L(W(e.left))
|
|
431
|
+
}), qt = [
|
|
417
432
|
["top", "w:top"],
|
|
418
433
|
["left", "w:left"],
|
|
419
434
|
["bottom", "w:bottom"],
|
|
@@ -424,7 +439,7 @@ const W = (e) => e / 15, Wt = (e) => e * 2 / 3, Ce = (e) => e / 9525, Xt = (e) =
|
|
|
424
439
|
function Be(e) {
|
|
425
440
|
if (!e) return;
|
|
426
441
|
const n = {};
|
|
427
|
-
for (const [t, o] of
|
|
442
|
+
for (const [t, o] of qt) {
|
|
428
443
|
const r = h(e, o);
|
|
429
444
|
if (!r) continue;
|
|
430
445
|
const i = { val: w(r, "w:val") ?? "single" }, a = b(r, "w:sz");
|
|
@@ -434,7 +449,7 @@ function Be(e) {
|
|
|
434
449
|
}
|
|
435
450
|
return Object.keys(n).length > 0 ? n : void 0;
|
|
436
451
|
}
|
|
437
|
-
function
|
|
452
|
+
function Le(e) {
|
|
438
453
|
if (!e) return;
|
|
439
454
|
const n = w(e, "w:fill");
|
|
440
455
|
if (n && n !== "auto") return `#${n.toLowerCase()}`;
|
|
@@ -442,10 +457,10 @@ function Oe(e) {
|
|
|
442
457
|
if (t && t !== "clear" && t !== "nil" && o && o !== "auto")
|
|
443
458
|
return `#${o.toLowerCase()}`;
|
|
444
459
|
}
|
|
445
|
-
function
|
|
460
|
+
function Zt(e, n) {
|
|
446
461
|
return e ? n ? { ...e, ...n } : e : n;
|
|
447
462
|
}
|
|
448
|
-
function
|
|
463
|
+
function Qt(e, n) {
|
|
449
464
|
const t = (d, u, f) => (
|
|
450
465
|
// Cell edges are named directly; the table/style layers use the named edge
|
|
451
466
|
// on the boundary and the inside edge between cells.
|
|
@@ -459,7 +474,7 @@ function Kt(e, n) {
|
|
|
459
474
|
const s = pe(t("right", "insideV", n.right));
|
|
460
475
|
return s && (o.right = s), o;
|
|
461
476
|
}
|
|
462
|
-
function
|
|
477
|
+
function Jt(e) {
|
|
463
478
|
if (!e) return;
|
|
464
479
|
const n = {}, t = pe(e.top);
|
|
465
480
|
t && (n.top = t);
|
|
@@ -472,10 +487,10 @@ function qt(e) {
|
|
|
472
487
|
}
|
|
473
488
|
function pe(e) {
|
|
474
489
|
if (!e || e.val === "nil" || e.val === "none") return;
|
|
475
|
-
const n =
|
|
490
|
+
const n = L(Math.max(0.5, (e.sizeEighthPt ?? 4) / 6)), o = { color: !e.color || e.color === "auto" ? "#000000" : `#${e.color.toLowerCase()}`, widthPx: n }, r = en(e.val);
|
|
476
491
|
return r !== "single" && (o.style = r), o;
|
|
477
492
|
}
|
|
478
|
-
function
|
|
493
|
+
function en(e) {
|
|
479
494
|
return e === "double" ? "double" : /dash/i.test(e) ? "dashed" : /dot/i.test(e) ? "dotted" : "single";
|
|
480
495
|
}
|
|
481
496
|
function we(e) {
|
|
@@ -512,7 +527,7 @@ function we(e) {
|
|
|
512
527
|
const p = me(h(e, "w:vanish"));
|
|
513
528
|
return p !== void 0 && (n.vanish = p), n;
|
|
514
529
|
}
|
|
515
|
-
const
|
|
530
|
+
const tn = {
|
|
516
531
|
left: "left",
|
|
517
532
|
start: "left",
|
|
518
533
|
center: "center",
|
|
@@ -521,10 +536,10 @@ const Qt = {
|
|
|
521
536
|
both: "justify",
|
|
522
537
|
distribute: "justify"
|
|
523
538
|
};
|
|
524
|
-
function
|
|
539
|
+
function Me(e, n) {
|
|
525
540
|
const t = {}, o = ie(e, "w:pStyle");
|
|
526
541
|
o && (t.styleId = o);
|
|
527
|
-
const r = ie(e, "w:jc"), i = r !== void 0 ?
|
|
542
|
+
const r = ie(e, "w:jc"), i = r !== void 0 ? tn[r] : void 0;
|
|
528
543
|
i && (t.align = i);
|
|
529
544
|
const a = h(e, "w:spacing");
|
|
530
545
|
if (a) {
|
|
@@ -533,7 +548,7 @@ function Fe(e, n) {
|
|
|
533
548
|
const x = b(a, "w:after");
|
|
534
549
|
x !== void 0 && (t.spaceAfterTwips = x);
|
|
535
550
|
const I = b(a, "w:line"), E = w(a, "w:lineRule") ?? "auto";
|
|
536
|
-
I !== void 0 && (E === "auto" ? t.lineHeight =
|
|
551
|
+
I !== void 0 && (E === "auto" ? t.lineHeight = Kt(I) : n.add("line-rule-exact", "Exact/atLeast line spacing was ignored (model is multiplier-only)."));
|
|
537
552
|
}
|
|
538
553
|
const s = h(e, "w:ind");
|
|
539
554
|
if (s) {
|
|
@@ -627,7 +642,7 @@ function Fe(e, n) {
|
|
|
627
642
|
const Ye = () => ({ depth: 0, topInstr: "", openId: null, markBlock: null, next: { n: 0 }, registry: {} });
|
|
628
643
|
function et(e) {
|
|
629
644
|
const n = e.fieldTrack;
|
|
630
|
-
if (n.openId !== null || !
|
|
645
|
+
if (n.openId !== null || !Gt(n.topInstr)) return;
|
|
631
646
|
const t = `field${n.next.n++}`;
|
|
632
647
|
n.registry[t] = { id: t, instruction: n.topInstr, name: Ve(n.topInstr).name, kind: "custom" }, n.openId = t, n.markBlock = t;
|
|
633
648
|
}
|
|
@@ -637,37 +652,37 @@ function tt(e) {
|
|
|
637
652
|
t.kind === "run" ? n += t.text.length : t.kind === "break" && (n += 1);
|
|
638
653
|
return n;
|
|
639
654
|
}
|
|
640
|
-
function
|
|
655
|
+
function nn(e, n, t) {
|
|
641
656
|
const o = de(ue(e, n), "w:document"), r = o && h(o, "w:body");
|
|
642
657
|
if (!r)
|
|
643
658
|
throw new ge("MALFORMED_XML", `${n} has no w:document/w:body root.`);
|
|
644
659
|
const i = {}, a = { warnings: t, fieldTokens: !1, sdts: i, nextSdt: { n: 0 }, pendingBookmarks: [], currentBookmarks: null, pendingMarkers: [], currentMarkers: null, trackFields: !0, fieldTrack: Ye() }, s = [];
|
|
645
660
|
Te(oe(r), s, a);
|
|
646
|
-
const d = h(r, "w:sectPr"), u = d ?
|
|
661
|
+
const d = h(r, "w:sectPr"), u = d ? Tn(d) : null, f = o ? h(o, "w:background") : void 0, c = f ? w(f, "w:color") : void 0, p = c && c !== "auto" ? c : void 0, g = a.fieldTrack.registry, T = Object.keys(g).length > 0 ? { blocks: s, section: u, sdts: i, fields: g } : { blocks: s, section: u, sdts: i };
|
|
647
662
|
return p && (T.pageColorHex = p), T;
|
|
648
663
|
}
|
|
649
|
-
function
|
|
664
|
+
function on(e, n, t, o = {}) {
|
|
650
665
|
const r = ue(e, n), i = de(r, "w:hdr") ?? de(r, "w:ftr");
|
|
651
666
|
if (!i)
|
|
652
667
|
throw new ge("MALFORMED_XML", `${n} has no w:hdr/w:ftr root.`);
|
|
653
668
|
const a = { warnings: t, fieldTokens: !0, sdts: o, nextSdt: { n: Object.keys(o).length }, pendingBookmarks: [], currentBookmarks: null, pendingMarkers: [], currentMarkers: null, trackFields: !1, fieldTrack: Ye() }, s = [];
|
|
654
669
|
return Te(oe(i), s, a), s;
|
|
655
670
|
}
|
|
656
|
-
const
|
|
671
|
+
const rn = /* @__PURE__ */ new Set(["_GoBack", "_Toc_Placeholder"]);
|
|
657
672
|
function ht(e) {
|
|
658
673
|
const n = w(e, "w:name");
|
|
659
|
-
return n && !
|
|
674
|
+
return n && !rn.has(n) ? n : null;
|
|
660
675
|
}
|
|
661
676
|
function Te(e, n, t) {
|
|
662
677
|
for (const o of e)
|
|
663
678
|
switch (t.trackFields && (t.fieldTrack.markBlock = t.fieldTrack.openId), o.tagName) {
|
|
664
679
|
case "w:p": {
|
|
665
|
-
const r =
|
|
680
|
+
const r = sn(o, t);
|
|
666
681
|
t.trackFields && t.fieldTrack.markBlock && (r.fieldId = t.fieldTrack.markBlock), n.push(r);
|
|
667
682
|
break;
|
|
668
683
|
}
|
|
669
684
|
case "w:tbl": {
|
|
670
|
-
const r =
|
|
685
|
+
const r = bn(o, t);
|
|
671
686
|
t.trackFields && t.fieldTrack.markBlock && (r.fieldId = t.fieldTrack.markBlock), n.push(r);
|
|
672
687
|
break;
|
|
673
688
|
}
|
|
@@ -699,8 +714,8 @@ function Te(e, n, t) {
|
|
|
699
714
|
}
|
|
700
715
|
}
|
|
701
716
|
}
|
|
702
|
-
function
|
|
703
|
-
const t = h(e, "w:pPr"), o = t ?
|
|
717
|
+
function sn(e, n) {
|
|
718
|
+
const t = h(e, "w:pPr"), o = t ? Me(t, n.warnings) : {}, r = [], i = n.pendingBookmarks;
|
|
704
719
|
n.pendingBookmarks = [], n.currentBookmarks = i;
|
|
705
720
|
const a = n.pendingMarkers;
|
|
706
721
|
n.pendingMarkers = [], n.currentMarkers = a;
|
|
@@ -709,15 +724,15 @@ function nn(e, n) {
|
|
|
709
724
|
const d = { kind: "paragraph", props: o, inlines: r };
|
|
710
725
|
return i.length > 0 && (d.bookmarks = i), a.length > 0 && (d.bookmarkMarkers = a), s.tocInstr !== void 0 && (d.tocField = s.tocInstr), d;
|
|
711
726
|
}
|
|
712
|
-
const
|
|
713
|
-
function
|
|
727
|
+
const an = /* @__PURE__ */ new Set(["PAGE", "NUMPAGES", "DATE", "TIME", "IF"]), cn = { fontFamily: "", fontSizePx: 16, bold: !1, italic: !1, underline: !1, strikethrough: !1, color: "#000000" };
|
|
728
|
+
function ln(e) {
|
|
714
729
|
return e.type === "NUMPAGES" ? "{pages}" : e.type === "PAGE" ? `{page${e.numFmt && e.numFmt !== "arabic" ? `:${e.numFmt}` : ""}}` : "";
|
|
715
730
|
}
|
|
716
|
-
function
|
|
731
|
+
function Ge(e) {
|
|
717
732
|
if (/\bNUMPAGES\b/.test(e)) return "{pages}";
|
|
718
733
|
if (/\bPAGE\b/.test(e)) return "{page}";
|
|
719
734
|
}
|
|
720
|
-
function
|
|
735
|
+
function fn(e) {
|
|
721
736
|
const n = e.match(/\bPAGEREF\s+("[^"]+"|\S+)/) ?? e.match(/\bHYPERLINK\s+\\l\s+("[^"]+"|\S+)/);
|
|
722
737
|
return n ? n[1].replace(/^"|"$/g, "") : void 0;
|
|
723
738
|
}
|
|
@@ -725,7 +740,7 @@ function ve(e, n, t, o) {
|
|
|
725
740
|
for (const r of e)
|
|
726
741
|
switch (r.tagName) {
|
|
727
742
|
case "w:r":
|
|
728
|
-
|
|
743
|
+
un(r, n, t, o);
|
|
729
744
|
break;
|
|
730
745
|
case "w:hyperlink": {
|
|
731
746
|
const i = w(r, "r:id"), a = w(r, "w:anchor"), s = n.length;
|
|
@@ -754,8 +769,8 @@ function ve(e, n, t, o) {
|
|
|
754
769
|
break;
|
|
755
770
|
}
|
|
756
771
|
case "w:fldSimple": {
|
|
757
|
-
const i = w(r, "w:instr") ?? "", a = t.fieldTokens ?
|
|
758
|
-
a ? n.push({ kind: "run", text: a, props:
|
|
772
|
+
const i = w(r, "w:instr") ?? "", a = t.fieldTokens ? Ge(i) : void 0;
|
|
773
|
+
a ? n.push({ kind: "run", text: a, props: dn(r) }) : ve(oe(r), n, t, o);
|
|
759
774
|
break;
|
|
760
775
|
}
|
|
761
776
|
case "w:smartTag":
|
|
@@ -776,11 +791,11 @@ function ve(e, n, t, o) {
|
|
|
776
791
|
}
|
|
777
792
|
}
|
|
778
793
|
}
|
|
779
|
-
function
|
|
794
|
+
function dn(e) {
|
|
780
795
|
const n = ye(e, "w:r"), t = n && h(n, "w:rPr");
|
|
781
796
|
return t ? we(t) : {};
|
|
782
797
|
}
|
|
783
|
-
function
|
|
798
|
+
function un(e, n, t, o) {
|
|
784
799
|
const r = h(e, "w:rPr"), i = r ? we(r) : {};
|
|
785
800
|
let a = "";
|
|
786
801
|
const s = () => {
|
|
@@ -808,13 +823,13 @@ function ln(e, n, t, o) {
|
|
|
808
823
|
break;
|
|
809
824
|
case "w:drawing": {
|
|
810
825
|
s();
|
|
811
|
-
const c =
|
|
826
|
+
const c = pn(f, t);
|
|
812
827
|
c && n.push(c);
|
|
813
828
|
break;
|
|
814
829
|
}
|
|
815
830
|
case "w:pict": {
|
|
816
831
|
s();
|
|
817
|
-
const c =
|
|
832
|
+
const c = kn(f, t);
|
|
818
833
|
c && n.push(c);
|
|
819
834
|
break;
|
|
820
835
|
}
|
|
@@ -824,7 +839,7 @@ function ln(e, n, t, o) {
|
|
|
824
839
|
case "w:instrText":
|
|
825
840
|
if (o.depth > 0) {
|
|
826
841
|
o.instr += ke(f);
|
|
827
|
-
const c =
|
|
842
|
+
const c = fn(o.instr);
|
|
828
843
|
c && (o.pagerefAnchor = c);
|
|
829
844
|
const p = ke(f);
|
|
830
845
|
o.tocInstr === void 0 && /\bTOC\b/.test(p) && (o.tocInstr = p);
|
|
@@ -832,7 +847,7 @@ function ln(e, n, t, o) {
|
|
|
832
847
|
t.trackFields && t.fieldTrack.depth === 1 && (t.fieldTrack.topInstr += ke(f));
|
|
833
848
|
break;
|
|
834
849
|
case "w:fldChar":
|
|
835
|
-
|
|
850
|
+
hn(f, i, n, t, o);
|
|
836
851
|
break;
|
|
837
852
|
case "mc:AlternateContent": {
|
|
838
853
|
const c = h(f, "mc:Choice") ?? h(f, "mc:Fallback");
|
|
@@ -848,7 +863,7 @@ function ln(e, n, t, o) {
|
|
|
848
863
|
};
|
|
849
864
|
d(oe(e)), s();
|
|
850
865
|
}
|
|
851
|
-
function
|
|
866
|
+
function hn(e, n, t, o, r) {
|
|
852
867
|
const i = o.fieldTrack;
|
|
853
868
|
switch (w(e, "w:fldCharType")) {
|
|
854
869
|
case "begin":
|
|
@@ -858,23 +873,23 @@ function fn(e, n, t, o, r) {
|
|
|
858
873
|
if (o.trackFields && i.depth === 1 && et(o), r.depth !== 1) break;
|
|
859
874
|
if (o.trackFields) {
|
|
860
875
|
const s = Ve(r.instr);
|
|
861
|
-
if (
|
|
862
|
-
const d =
|
|
876
|
+
if (an.has(s.name)) {
|
|
877
|
+
const d = $t(s, cn);
|
|
863
878
|
if (d) {
|
|
864
879
|
const u = `field${i.next.n++}`;
|
|
865
|
-
i.registry[u] = { id: u, instruction: r.instr, name: s.name, kind: "builtin", spec: d }, d.type === "PAGE" || d.type === "NUMPAGES" ? (t.push({ kind: "run", text:
|
|
880
|
+
i.registry[u] = { id: u, instruction: r.instr, name: s.name, kind: "builtin", spec: d }, d.type === "PAGE" || d.type === "NUMPAGES" ? (t.push({ kind: "run", text: ln(d), props: n, fieldId: u }), r.suppressResult = !0) : r.resultFieldId = u;
|
|
866
881
|
break;
|
|
867
882
|
}
|
|
868
883
|
}
|
|
869
884
|
}
|
|
870
|
-
const a = o.fieldTokens ?
|
|
885
|
+
const a = o.fieldTokens ? Ge(r.instr) : void 0;
|
|
871
886
|
a && (t.push({ kind: "run", text: a, props: n }), r.suppressResult = !0);
|
|
872
887
|
break;
|
|
873
888
|
}
|
|
874
889
|
case "end":
|
|
875
890
|
if (o.trackFields && i.depth > 0 && (i.depth === 1 && (et(o), i.openId = null, i.topInstr = ""), i.depth--), r.depth > 0 && r.depth--, r.depth === 0) {
|
|
876
891
|
if (!r.suppressResult) {
|
|
877
|
-
const a = o.fieldTokens ?
|
|
892
|
+
const a = o.fieldTokens ? Ge(r.instr) : void 0;
|
|
878
893
|
a && t.push({ kind: "run", text: a, props: n });
|
|
879
894
|
}
|
|
880
895
|
r.instr = "", r.suppressResult = !1, r.pagerefAnchor = void 0, r.resultFieldId = void 0;
|
|
@@ -882,7 +897,7 @@ function fn(e, n, t, o, r) {
|
|
|
882
897
|
break;
|
|
883
898
|
}
|
|
884
899
|
}
|
|
885
|
-
function
|
|
900
|
+
function pn(e, n) {
|
|
886
901
|
const t = h(e, "wp:anchor"), o = h(e, "wp:inline") ?? t;
|
|
887
902
|
if (!o) return;
|
|
888
903
|
const r = ye(o, "a:blip"), i = r && w(r, "r:embed");
|
|
@@ -903,8 +918,8 @@ function dn(e, n) {
|
|
|
903
918
|
behind: w(t, "behindDoc") === "1",
|
|
904
919
|
offsetXEmu: nt(p),
|
|
905
920
|
offsetYEmu: nt(g),
|
|
906
|
-
relFromH:
|
|
907
|
-
relFromV:
|
|
921
|
+
relFromH: wn(p),
|
|
922
|
+
relFromV: vn(g),
|
|
908
923
|
decorative: !!v && w(v, "val") !== "0",
|
|
909
924
|
...x !== void 0 ? { z: x } : {}
|
|
910
925
|
};
|
|
@@ -919,16 +934,16 @@ function nt(e) {
|
|
|
919
934
|
const n = e && h(e, "wp:posOffset"), t = n ? Number(ke(n).trim()) : NaN;
|
|
920
935
|
return Number.isFinite(t) ? t : 0;
|
|
921
936
|
}
|
|
922
|
-
const
|
|
923
|
-
function
|
|
937
|
+
const gn = /* @__PURE__ */ new Set(["page", "margin", "column", "leftMargin", "rightMargin", "character"]), mn = /* @__PURE__ */ new Set(["page", "margin", "paragraph", "line", "topMargin", "bottomMargin"]);
|
|
938
|
+
function wn(e) {
|
|
924
939
|
const n = e && w(e, "relativeFrom");
|
|
925
|
-
return n &&
|
|
940
|
+
return n && gn.has(n) ? n : "column";
|
|
926
941
|
}
|
|
927
|
-
function
|
|
942
|
+
function vn(e) {
|
|
928
943
|
const n = e && w(e, "relativeFrom");
|
|
929
|
-
return n &&
|
|
944
|
+
return n && mn.has(n) ? n : "paragraph";
|
|
930
945
|
}
|
|
931
|
-
function
|
|
946
|
+
function kn(e, n) {
|
|
932
947
|
const t = ye(e, "v:imagedata"), o = t && w(t, "r:id");
|
|
933
948
|
if (!o) {
|
|
934
949
|
n.warnings.add("images-skipped", "A legacy picture without an image reference was skipped.");
|
|
@@ -953,12 +968,12 @@ function pt(e) {
|
|
|
953
968
|
const a = n("w:left");
|
|
954
969
|
return a !== void 0 && (t.left = a), Object.keys(t).length > 0 ? t : void 0;
|
|
955
970
|
}
|
|
956
|
-
function
|
|
971
|
+
function bn(e, n) {
|
|
957
972
|
const t = [];
|
|
958
973
|
for (const a of te(e, "w:tr")) {
|
|
959
974
|
const s = [];
|
|
960
975
|
for (const d of te(a, "w:tc"))
|
|
961
|
-
s.push(
|
|
976
|
+
s.push(yn(d, n));
|
|
962
977
|
t.push({ cells: s });
|
|
963
978
|
}
|
|
964
979
|
const o = { kind: "table", rows: t }, r = h(e, "w:tblGrid");
|
|
@@ -988,14 +1003,14 @@ function wn(e, n) {
|
|
|
988
1003
|
h(i, "w:tblBorders") && (o.bordersSpecified = !0);
|
|
989
1004
|
const d = Be(h(i, "w:tblBorders"));
|
|
990
1005
|
d && (o.borders = d);
|
|
991
|
-
const u =
|
|
1006
|
+
const u = Le(h(i, "w:shd"));
|
|
992
1007
|
u && (o.shd = u);
|
|
993
1008
|
const f = pt(h(i, "w:tblCellMar"));
|
|
994
1009
|
f && (o.cellMarginTwips = f);
|
|
995
1010
|
}
|
|
996
1011
|
return o;
|
|
997
1012
|
}
|
|
998
|
-
function
|
|
1013
|
+
function yn(e, n) {
|
|
999
1014
|
const t = h(e, "w:tcPr"), o = (t && b(h(t, "w:gridSpan"), "w:val")) ?? 1, r = t && h(t, "w:vMerge"), i = !!r && (w(r, "w:val") ?? "continue") === "continue", a = [];
|
|
1000
1015
|
Te(oe(e), a, n);
|
|
1001
1016
|
const s = { blocks: a, gridSpan: o, vMergeContinue: i };
|
|
@@ -1003,7 +1018,7 @@ function vn(e, n) {
|
|
|
1003
1018
|
h(t, "w:tcBorders") && (s.bordersSpecified = !0);
|
|
1004
1019
|
const d = Be(h(t, "w:tcBorders"));
|
|
1005
1020
|
d && (s.borders = d);
|
|
1006
|
-
const u =
|
|
1021
|
+
const u = Le(h(t, "w:shd"));
|
|
1007
1022
|
u && (s.shd = u);
|
|
1008
1023
|
const f = pt(h(t, "w:tcMar"));
|
|
1009
1024
|
f && (s.marginTwips = f);
|
|
@@ -1046,7 +1061,7 @@ function mt(e, n) {
|
|
|
1046
1061
|
for (const t of e.rows)
|
|
1047
1062
|
for (const o of t.cells) for (const r of o.blocks) mt(r, n);
|
|
1048
1063
|
}
|
|
1049
|
-
function
|
|
1064
|
+
function Tn(e, n) {
|
|
1050
1065
|
const t = {}, o = h(e, "w:pgSz"), r = b(o, "w:w");
|
|
1051
1066
|
r !== void 0 && (t.pageWidthTwips = r);
|
|
1052
1067
|
const i = b(o, "w:h");
|
|
@@ -1110,7 +1125,7 @@ function ot(e) {
|
|
|
1110
1125
|
}
|
|
1111
1126
|
return Object.keys(n).length > 0 ? n : void 0;
|
|
1112
1127
|
}
|
|
1113
|
-
function
|
|
1128
|
+
function Pn(e, n, t, o = {}) {
|
|
1114
1129
|
const r = /* @__PURE__ */ new Map(), i = de(ue(e, n), "w:footnotes");
|
|
1115
1130
|
if (!i) return r;
|
|
1116
1131
|
const a = {
|
|
@@ -1133,24 +1148,24 @@ function bn(e, n, t, o = {}) {
|
|
|
1133
1148
|
}
|
|
1134
1149
|
return r;
|
|
1135
1150
|
}
|
|
1136
|
-
const
|
|
1151
|
+
const An = /* @__PURE__ */ new Set(["single", "double", "dashed", "dotted", "thick", "none"]);
|
|
1137
1152
|
function rt(e) {
|
|
1138
|
-
const n = { count: e.count, gapPx:
|
|
1153
|
+
const n = { count: e.count, gapPx: L(W(e.spaceTwips ?? 720)) };
|
|
1139
1154
|
return e.sep && (n.sep = !0), e.cols && e.cols.length === e.count && (n.cols = e.cols.map((t) => ({
|
|
1140
|
-
widthPx:
|
|
1141
|
-
spaceAfterPx:
|
|
1155
|
+
widthPx: L(W(t.wTwips)),
|
|
1156
|
+
spaceAfterPx: L(W(t.spaceTwips))
|
|
1142
1157
|
}))), n;
|
|
1143
1158
|
}
|
|
1144
1159
|
function it(e) {
|
|
1145
1160
|
const n = (s) => {
|
|
1146
1161
|
if (!s) return;
|
|
1147
1162
|
const u = {
|
|
1148
|
-
style:
|
|
1149
|
-
widthPx: s.sz !== void 0 ?
|
|
1163
|
+
style: An.has(s.style) ? s.style : "single",
|
|
1164
|
+
widthPx: s.sz !== void 0 ? L(s.sz / 6) : 1,
|
|
1150
1165
|
// w:sz is eighth-points
|
|
1151
1166
|
color: !s.color || s.color === "auto" ? "#000000" : `#${s.color}`
|
|
1152
1167
|
};
|
|
1153
|
-
return s.space !== void 0 && (u.spacePx =
|
|
1168
|
+
return s.space !== void 0 && (u.spacePx = L(s.space * 96 / 72)), u;
|
|
1154
1169
|
}, t = { offsetFrom: e.offsetFrom ?? "page" }, o = n(e.top);
|
|
1155
1170
|
o && (t.top = o);
|
|
1156
1171
|
const r = n(e.right);
|
|
@@ -1160,7 +1175,7 @@ function it(e) {
|
|
|
1160
1175
|
const a = n(e.left);
|
|
1161
1176
|
return a && (t.left = a), t;
|
|
1162
1177
|
}
|
|
1163
|
-
const
|
|
1178
|
+
const Sn = () => {
|
|
1164
1179
|
}, wt = {
|
|
1165
1180
|
fontFamily: "Times New Roman, serif",
|
|
1166
1181
|
fontSizePx: 16,
|
|
@@ -1170,19 +1185,19 @@ const Tn = () => {
|
|
|
1170
1185
|
underline: !1,
|
|
1171
1186
|
strikethrough: !1,
|
|
1172
1187
|
color: "#000000"
|
|
1173
|
-
},
|
|
1188
|
+
}, xn = {
|
|
1174
1189
|
align: "left",
|
|
1175
1190
|
lineHeight: 1,
|
|
1176
1191
|
spaceBeforePx: 0,
|
|
1177
1192
|
spaceAfterPx: 0,
|
|
1178
1193
|
indentFirstLinePx: 0,
|
|
1179
1194
|
indentLeftPx: 0
|
|
1180
|
-
},
|
|
1195
|
+
}, In = { top: 0, right: 108, bottom: 0, left: 108 }, Pe = {
|
|
1181
1196
|
pageWidthPx: 816,
|
|
1182
1197
|
pageHeightPx: 1056,
|
|
1183
1198
|
marginPx: { top: 96, right: 96, bottom: 96, left: 96 }
|
|
1184
1199
|
};
|
|
1185
|
-
function
|
|
1200
|
+
function Cn(e, n, t = {}, o = /* @__PURE__ */ new Map(), r = () => ({}), i) {
|
|
1186
1201
|
let a = 0;
|
|
1187
1202
|
const s = () => `i${a++}`, d = /* @__PURE__ */ new Map(), u = /* @__PURE__ */ new Map(), f = /* @__PURE__ */ new Map(), c = [], p = (l) => {
|
|
1188
1203
|
let m = f.get(l);
|
|
@@ -1190,9 +1205,9 @@ function Sn(e, n, t = {}, o = /* @__PURE__ */ new Map(), r = () => ({}), i) {
|
|
|
1190
1205
|
}, g = /* @__PURE__ */ new Map(), T = (l) => {
|
|
1191
1206
|
const m = g.get(l);
|
|
1192
1207
|
if (m) return m;
|
|
1193
|
-
const
|
|
1194
|
-
if (!
|
|
1195
|
-
const C =
|
|
1208
|
+
const F = o.get(l);
|
|
1209
|
+
if (!F) return;
|
|
1210
|
+
const C = Mn(F);
|
|
1196
1211
|
return g.set(l, C), C;
|
|
1197
1212
|
}, S = De(n.run(void 0, {})), v = st(n.para({})), x = () => ({
|
|
1198
1213
|
kind: "paragraph",
|
|
@@ -1202,25 +1217,25 @@ function Sn(e, n, t = {}, o = /* @__PURE__ */ new Map(), r = () => ({}), i) {
|
|
|
1202
1217
|
style: { ...v }
|
|
1203
1218
|
}), I = (l, m) => {
|
|
1204
1219
|
if (!m) return 0;
|
|
1205
|
-
const
|
|
1206
|
-
if (!
|
|
1220
|
+
const F = T(m.numId);
|
|
1221
|
+
if (!F)
|
|
1207
1222
|
return e.add("list-missing", "A list reference had no matching definition — markers were dropped."), 0;
|
|
1208
1223
|
l.list = { listId: m.numId, level: m.level };
|
|
1209
|
-
const C =
|
|
1210
|
-
return l.indentLeftPx = Math.max(0,
|
|
1224
|
+
const C = F.levels[Math.min(m.level, F.levels.length - 1)], y = C ? C.indentLeftPx : 0;
|
|
1225
|
+
return l.indentLeftPx = Math.max(0, L(l.indentLeftPx - y)), l.indentFirstLinePx = 0, y;
|
|
1211
1226
|
}, E = (l) => {
|
|
1212
1227
|
const m = l.sectionPgSize;
|
|
1213
1228
|
return !!m && !!i && (m.w !== i.w || m.h !== i.h);
|
|
1214
1229
|
}, N = (l) => E(l) || !!l.sectionColumns || l.sectionPageNumberStart !== void 0 || !!l.sectionPgBorders, Z = (l) => {
|
|
1215
1230
|
const m = {};
|
|
1216
|
-
return l.sectionPgSize && (m.pageWidthPx =
|
|
1231
|
+
return l.sectionPgSize && (m.pageWidthPx = L(W(l.sectionPgSize.w)), m.pageHeightPx = L(W(l.sectionPgSize.h))), l.sectionMarginTwips && (m.marginPx = Ne(l.sectionMarginTwips)), l.sectionColumns && (m.columns = rt(l.sectionColumns)), l.sectionPageNumberStart !== void 0 && (m.pageNumberStart = l.sectionPageNumberStart), l.sectionHeaderDistTwips !== void 0 && (m.headerDistancePx = L(W(l.sectionHeaderDistTwips))), l.sectionFooterDistTwips !== void 0 && (m.footerDistancePx = L(W(l.sectionFooterDistTwips))), l.sectionPgBorders && (m.pageBorders = it(l.sectionPgBorders)), m;
|
|
1217
1232
|
}, z = (l) => {
|
|
1218
1233
|
for (let m = l.length - 1; m >= 0; m--) if (l[m].kind === "paragraph") return l[m];
|
|
1219
1234
|
};
|
|
1220
1235
|
let K;
|
|
1221
|
-
const X = (l, m,
|
|
1236
|
+
const X = (l, m, F = Sn) => {
|
|
1222
1237
|
const C = [];
|
|
1223
|
-
let y = !1,
|
|
1238
|
+
let y = !1, M = !1, R = !1, B = !1;
|
|
1224
1239
|
const J = (D) => D.some((A) => A.kind !== "paragraph" || A.runs.some((k) => k.text.trim().length > 0 && !k.style.hidden));
|
|
1225
1240
|
let j = 0, V = null;
|
|
1226
1241
|
const $ = (D) => {
|
|
@@ -1231,43 +1246,43 @@ function Sn(e, n, t = {}, o = /* @__PURE__ */ new Map(), r = () => ({}), i) {
|
|
|
1231
1246
|
const k = l[A];
|
|
1232
1247
|
if (k.kind !== "paragraph") return !1;
|
|
1233
1248
|
if (k.inlines.some(
|
|
1234
|
-
(
|
|
1249
|
+
(_) => _.kind === "run" && _.text.trim().length > 0 && !_.props.vanish
|
|
1235
1250
|
))
|
|
1236
|
-
return n.isHeading(k.props.styleId) ? !0 : (k.bookmarks ?? []).some((
|
|
1251
|
+
return n.isHeading(k.props.styleId) ? !0 : (k.bookmarks ?? []).some((_) => /toc/i.test(_));
|
|
1237
1252
|
}
|
|
1238
1253
|
return !1;
|
|
1239
1254
|
};
|
|
1240
1255
|
for (let D = 0; D < l.length; D++) {
|
|
1241
|
-
const A = l[D], k = A.kind === "paragraph" ? ee(A, m,
|
|
1242
|
-
if (A.fieldId) for (const
|
|
1256
|
+
const A = l[D], k = A.kind === "paragraph" ? ee(A, m, F) : [Q(A, m, F)];
|
|
1257
|
+
if (A.fieldId) for (const O of k) O.fieldId = A.fieldId;
|
|
1243
1258
|
if (A.kind === "paragraph" && A.tocField !== void 0 && K === void 0) {
|
|
1244
|
-
const
|
|
1245
|
-
|
|
1259
|
+
const O = k.find((_) => _.kind === "paragraph") ?? k[0];
|
|
1260
|
+
O && (K = { blockId: O.id, instruction: A.tocField });
|
|
1246
1261
|
}
|
|
1247
1262
|
if (y && k.length > 0) {
|
|
1248
|
-
const
|
|
1249
|
-
|
|
1263
|
+
const O = k[0];
|
|
1264
|
+
O.kind === "paragraph" && O.runs.every((ne) => ne.text.length === 0 || ne.style.hidden) || ((A.kind === "paragraph" && n.isHeading(A.props.styleId) || M) && (O.kind === "paragraph" ? O.style.pageBreakBefore = !0 : k.unshift({ ...x(), style: { ...v, pageBreakBefore: !0 } })), y = !1, M = !1);
|
|
1250
1265
|
}
|
|
1251
1266
|
if (A.kind === "paragraph" && A.props.sectionBreak === "page") {
|
|
1252
|
-
const
|
|
1253
|
-
if (N(
|
|
1254
|
-
let
|
|
1255
|
-
|
|
1267
|
+
const O = A.props;
|
|
1268
|
+
if (N(O)) {
|
|
1269
|
+
let _ = z(k);
|
|
1270
|
+
_ || (_ = x(), k.push(_)), _.style.sectionBreak = { type: "nextPage", props: Z(O) }, y = !1;
|
|
1256
1271
|
} else
|
|
1257
|
-
|
|
1272
|
+
O.sectionHasBands && e.add(
|
|
1258
1273
|
"section-bands-flattened",
|
|
1259
1274
|
"Per-section headers/footers on geometry-preserving section breaks were not applied (the document section's are used)."
|
|
1260
|
-
), y = !0,
|
|
1275
|
+
), y = !0, M = !R && B || U(D), j > 0 && V && U(j - 1) && (V.style.pageBreakBefore = !0);
|
|
1261
1276
|
R = !0;
|
|
1262
1277
|
}
|
|
1263
1278
|
A.kind === "paragraph" && A.props.sectionBreak !== void 0 ? (j = D + 1, V = null) : V || (V = $(k) ?? null), C.push(...k), R || (B ||= J(k));
|
|
1264
1279
|
}
|
|
1265
1280
|
return q(C), C;
|
|
1266
1281
|
}, q = (l) => {
|
|
1267
|
-
const m = (y) => y.kind === "image" || y.kind === "table",
|
|
1282
|
+
const m = (y) => y.kind === "image" || y.kind === "table", F = (y) => y.kind === "paragraph" && y.runs.every((M) => M.text.trim().length === 0 || M.style.hidden), C = (y) => y.kind === "paragraph" ? y.runs.reduce((M, R) => M + R.text.length, 0) : 0;
|
|
1268
1283
|
for (let y = 0; y < l.length; y++) {
|
|
1269
|
-
const
|
|
1270
|
-
if (
|
|
1284
|
+
const M = l[y];
|
|
1285
|
+
if (M.kind !== "paragraph" || !M.style.namedStyle || !n.isHeading(M.style.namedStyle)) continue;
|
|
1271
1286
|
const R = [];
|
|
1272
1287
|
let B = 0, J = -1;
|
|
1273
1288
|
for (let j = y + 1; j < l.length && j <= y + 6; j++) {
|
|
@@ -1277,28 +1292,28 @@ function Sn(e, n, t = {}, o = /* @__PURE__ */ new Map(), r = () => ({}), i) {
|
|
|
1277
1292
|
break;
|
|
1278
1293
|
}
|
|
1279
1294
|
if (V.kind !== "paragraph") break;
|
|
1280
|
-
if (!
|
|
1295
|
+
if (!F(V)) {
|
|
1281
1296
|
if (B >= 2 || C(V) > 300) break;
|
|
1282
1297
|
B++, R.push(V);
|
|
1283
1298
|
}
|
|
1284
1299
|
}
|
|
1285
1300
|
if (!(J < 0)) {
|
|
1286
|
-
|
|
1301
|
+
M.style.keepWithNext = !0;
|
|
1287
1302
|
for (const j of R) j.style.keepWithNext = !0;
|
|
1288
1303
|
}
|
|
1289
1304
|
}
|
|
1290
1305
|
};
|
|
1291
|
-
function ee(l, m,
|
|
1292
|
-
const C = n.para(l.props), y = st(C),
|
|
1306
|
+
function ee(l, m, F) {
|
|
1307
|
+
const C = n.para(l.props), y = st(C), M = I(y, C.list), R = De(n.run(l.props.styleId, l.props.markRunProps ?? {})), B = [];
|
|
1293
1308
|
let J = [], j = !1, V = !1, $ = !1;
|
|
1294
1309
|
const U = (k) => {
|
|
1295
|
-
const
|
|
1296
|
-
return V && (
|
|
1310
|
+
const O = { ...y };
|
|
1311
|
+
return V && (O.pageBreakBefore = !0, V = !1), $ && (O.columnBreakBefore = !0, $ = !1), {
|
|
1297
1312
|
kind: "paragraph",
|
|
1298
1313
|
id: s(),
|
|
1299
1314
|
revision: 0,
|
|
1300
|
-
runs:
|
|
1301
|
-
style:
|
|
1315
|
+
runs: Ot(k, R),
|
|
1316
|
+
style: O
|
|
1302
1317
|
};
|
|
1303
1318
|
}, D = () => {
|
|
1304
1319
|
J.length !== 0 && (B.push(U(J)), J = []);
|
|
@@ -1309,30 +1324,30 @@ function Sn(e, n, t = {}, o = /* @__PURE__ */ new Map(), r = () => ({}), i) {
|
|
|
1309
1324
|
!k.page && !k.column ? (e.add("soft-breaks", "Soft line breaks (Shift+Enter) became paragraph breaks."), J.length > 0 ? D() : B.push(U([]))) : (J.length > 0 && D(), k.page && (V = !0), k.column && ($ = !0)), j = !0;
|
|
1310
1325
|
break;
|
|
1311
1326
|
case "image": {
|
|
1312
|
-
const
|
|
1313
|
-
|
|
1327
|
+
const O = P(k, m, y.align);
|
|
1328
|
+
O && (D(), (V || $) && B.push(U([])), B.push(O), j = !1);
|
|
1314
1329
|
break;
|
|
1315
1330
|
}
|
|
1316
1331
|
case "run": {
|
|
1317
|
-
const
|
|
1318
|
-
J.push(H(k.text,
|
|
1332
|
+
const O = n.run(l.props.styleId, k.props);
|
|
1333
|
+
J.push(H(k.text, O, F, k.sdtId, k.fieldId)), j = !1;
|
|
1319
1334
|
break;
|
|
1320
1335
|
}
|
|
1321
1336
|
}
|
|
1322
1337
|
D(), (j || B.length === 0) && B.push(U([]));
|
|
1323
1338
|
const A = B.filter((k) => k.kind === "paragraph");
|
|
1324
|
-
if (A.forEach((k,
|
|
1325
|
-
|
|
1339
|
+
if (A.forEach((k, O) => {
|
|
1340
|
+
O > 0 && (k.style.spaceBeforePx = 0), O < A.length - 1 && (k.style.spaceAfterPx = 0), O > 0 && k.style.list && (delete k.style.list, k.style.indentLeftPx = L(k.style.indentLeftPx + M));
|
|
1326
1341
|
}), l.bookmarkMarkers && l.bookmarkMarkers.length > 0 && B[0]) {
|
|
1327
|
-
const k = B[0],
|
|
1328
|
-
for (const
|
|
1329
|
-
const ne = { blockId: k.id, offset: Math.min(
|
|
1330
|
-
|
|
1342
|
+
const k = B[0], O = k.kind === "paragraph" ? k.runs.reduce((_, ne) => _ + ne.text.length, 0) : 0;
|
|
1343
|
+
for (const _ of l.bookmarkMarkers) {
|
|
1344
|
+
const ne = { blockId: k.id, offset: Math.min(_.offset, O) };
|
|
1345
|
+
_.kind === "start" && _.name ? d.set(_.id, { name: _.name, pos: ne }) : _.kind === "end" && u.set(_.id, ne);
|
|
1331
1346
|
}
|
|
1332
1347
|
}
|
|
1333
1348
|
return B;
|
|
1334
1349
|
}
|
|
1335
|
-
function P(l, m,
|
|
1350
|
+
function P(l, m, F) {
|
|
1336
1351
|
const C = m.resolve(l.relId);
|
|
1337
1352
|
if (!C) return;
|
|
1338
1353
|
if (l.widthEmu === void 0 || l.heightEmu === void 0) {
|
|
@@ -1344,97 +1359,97 @@ function Sn(e, n, t = {}, o = /* @__PURE__ */ new Map(), r = () => ({}), i) {
|
|
|
1344
1359
|
id: s(),
|
|
1345
1360
|
revision: 0,
|
|
1346
1361
|
src: C,
|
|
1347
|
-
widthPx:
|
|
1348
|
-
heightPx:
|
|
1349
|
-
align: l.anchorAlign ?? (
|
|
1362
|
+
widthPx: L(Ce(l.widthEmu)),
|
|
1363
|
+
heightPx: L(Ce(l.heightEmu)),
|
|
1364
|
+
align: l.anchorAlign ?? (F === "justify" ? "left" : F)
|
|
1350
1365
|
};
|
|
1351
1366
|
if (l.anchored && l.anchorWrap === "square" && (y.wrap = "square"), l.anchorFloat) {
|
|
1352
|
-
const
|
|
1367
|
+
const M = l.anchorFloat;
|
|
1353
1368
|
y.anchor = {
|
|
1354
|
-
behind:
|
|
1355
|
-
offsetXPx:
|
|
1356
|
-
offsetYPx:
|
|
1357
|
-
relFromH:
|
|
1358
|
-
relFromV:
|
|
1359
|
-
...
|
|
1360
|
-
...
|
|
1369
|
+
behind: M.behind,
|
|
1370
|
+
offsetXPx: L(Ce(M.offsetXEmu)),
|
|
1371
|
+
offsetYPx: L(Ce(M.offsetYEmu)),
|
|
1372
|
+
relFromH: M.relFromH,
|
|
1373
|
+
relFromV: M.relFromV,
|
|
1374
|
+
...M.decorative ? { decorative: !0 } : {},
|
|
1375
|
+
...M.z !== void 0 ? { z: M.z } : {}
|
|
1361
1376
|
};
|
|
1362
1377
|
}
|
|
1363
1378
|
return y;
|
|
1364
1379
|
}
|
|
1365
|
-
function H(l, m,
|
|
1366
|
-
let
|
|
1380
|
+
function H(l, m, F, C, y) {
|
|
1381
|
+
let M = l;
|
|
1367
1382
|
const R = De(m);
|
|
1368
1383
|
if (m.linkRelId) {
|
|
1369
|
-
const B =
|
|
1384
|
+
const B = F(m.linkRelId);
|
|
1370
1385
|
B ? R.link = B : e.add("links-unresolved", "A hyperlink target could not be resolved and was dropped.");
|
|
1371
1386
|
} else m.linkAnchor && (R.link = `#${m.linkAnchor}`);
|
|
1372
|
-
if (m.footnoteId !== void 0 && (
|
|
1387
|
+
if (m.footnoteId !== void 0 && (M = p(m.footnoteId), R.footnoteRef = `fn${m.footnoteId}`, R.verticalAlign = "super"), C) {
|
|
1373
1388
|
R.sdtId = C;
|
|
1374
1389
|
const B = t[C];
|
|
1375
|
-
B?.type === "checkbox" &&
|
|
1390
|
+
B?.type === "checkbox" && M.length > 0 && (M = B.checked ? "☒" : "☐", R.fontFamily = wt.fontFamily);
|
|
1376
1391
|
}
|
|
1377
|
-
return y && (R.fieldId = y), m.styleId && (R.charStyleId = m.styleId), { text:
|
|
1392
|
+
return y && (R.fieldId = y), m.styleId && (R.charStyleId = m.styleId), { text: M, style: R };
|
|
1378
1393
|
}
|
|
1379
|
-
function re(l, m,
|
|
1394
|
+
function re(l, m, F, C, y, M) {
|
|
1380
1395
|
const R = l.cell.rowSpan ?? 1, B = {
|
|
1381
1396
|
top: l.startRow === 0,
|
|
1382
|
-
bottom: l.startRow + R - 1 ===
|
|
1397
|
+
bottom: l.startRow + R - 1 === M - 1,
|
|
1383
1398
|
left: l.startCol === 0,
|
|
1384
1399
|
right: l.startCol + l.colSpan - 1 === y - 1
|
|
1385
|
-
}, J = l.ir?.shd ?? m.shd ??
|
|
1400
|
+
}, J = l.ir?.shd ?? m.shd ?? F.shd;
|
|
1386
1401
|
if (J && (l.cell.shading = J), C) {
|
|
1387
|
-
const j = { cell: l.ir?.borders, table: m.borders, style:
|
|
1388
|
-
l.cell.borders =
|
|
1402
|
+
const j = { cell: l.ir?.borders, table: m.borders, style: F.borders };
|
|
1403
|
+
l.cell.borders = Qt(j, B);
|
|
1389
1404
|
}
|
|
1390
1405
|
}
|
|
1391
|
-
function Q(l, m,
|
|
1406
|
+
function Q(l, m, F) {
|
|
1392
1407
|
const C = ($) => {
|
|
1393
1408
|
const U = [];
|
|
1394
1409
|
for (const k of $.blocks)
|
|
1395
|
-
k.kind === "paragraph" ? U.push(...ee(k, m,
|
|
1410
|
+
k.kind === "paragraph" ? U.push(...ee(k, m, F)) : U.push(Q(k, m, F));
|
|
1396
1411
|
const D = { id: s(), blocks: U.length > 0 ? U : [x()] };
|
|
1397
1412
|
$.gridSpan > 1 && (D.colSpan = $.gridSpan);
|
|
1398
|
-
const A = (k) => $.marginTwips?.[k] ?? l.cellMarginTwips?.[k] ??
|
|
1413
|
+
const A = (k) => $.marginTwips?.[k] ?? l.cellMarginTwips?.[k] ?? In[k];
|
|
1399
1414
|
return D.margin = Ne({ top: A("top"), right: A("right"), bottom: A("bottom"), left: A("left") }), D;
|
|
1400
|
-
}, y = Math.max(1, ...l.rows.map(($) => $.cells.reduce((U, D) => U + Math.max(1, D.gridSpan), 0))),
|
|
1415
|
+
}, y = Math.max(1, ...l.rows.map(($) => $.cells.reduce((U, D) => U + Math.max(1, D.gridSpan), 0))), M = new Array(y), R = l.rows.map(($, U) => {
|
|
1401
1416
|
const D = [];
|
|
1402
1417
|
let A = 0;
|
|
1403
1418
|
for (const k of $.cells) {
|
|
1404
1419
|
if (A >= y) break;
|
|
1405
|
-
const
|
|
1420
|
+
const O = Math.max(1, Math.min(k.gridSpan, y - A));
|
|
1406
1421
|
if (k.vMergeContinue) {
|
|
1407
|
-
const ne =
|
|
1408
|
-
ne ? ne.rowSpan = (ne.rowSpan ?? 1) + 1 : e.add("cell-vmerge-orphan", "A merged-cell continuation had no cell above to extend."), A +=
|
|
1422
|
+
const ne = M[A];
|
|
1423
|
+
ne ? ne.rowSpan = (ne.rowSpan ?? 1) + 1 : e.add("cell-vmerge-orphan", "A merged-cell continuation had no cell above to extend."), A += O;
|
|
1409
1424
|
continue;
|
|
1410
1425
|
}
|
|
1411
|
-
const
|
|
1412
|
-
D.push({ cell:
|
|
1413
|
-
for (let ne = 0; ne <
|
|
1414
|
-
A +=
|
|
1426
|
+
const _ = C(k);
|
|
1427
|
+
D.push({ cell: _, ir: k, startRow: U, startCol: A, colSpan: O });
|
|
1428
|
+
for (let ne = 0; ne < O && A + ne < y; ne++) M[A + ne] = _;
|
|
1429
|
+
A += O;
|
|
1415
1430
|
}
|
|
1416
1431
|
for (; A < y; ) {
|
|
1417
1432
|
const k = { id: s(), blocks: [x()] };
|
|
1418
|
-
D.push({ cell: k, ir: null, startRow: U, startCol: A, colSpan: 1 }),
|
|
1433
|
+
D.push({ cell: k, ir: null, startRow: U, startCol: A, colSpan: 1 }), M[A] = k, A += 1;
|
|
1419
1434
|
}
|
|
1420
1435
|
return D;
|
|
1421
1436
|
}), B = l.styleId ? r(l.styleId) : {}, J = !!B.borders || !!l.borders || !!l.bordersSpecified || l.rows.some(($) => $.cells.some((U) => U.borders || U.bordersSpecified));
|
|
1422
1437
|
for (const $ of R) for (const U of $) re(U, l, B, J, y, l.rows.length);
|
|
1423
1438
|
const j = R.map(($) => ({ cells: $.map((U) => U.cell) })), V = { kind: "table", id: s(), revision: 0, rows: j };
|
|
1424
|
-
return l.styleId && (V.styleId = l.styleId), l.look && (V.condOverrides = { ...l.look }), V.colFractions =
|
|
1439
|
+
return l.styleId && (V.styleId = l.styleId), l.look && (V.condOverrides = { ...l.look }), V.colFractions = On(l.colWidthsTwips, y), V;
|
|
1425
1440
|
}
|
|
1426
|
-
function
|
|
1441
|
+
function G(l) {
|
|
1427
1442
|
if (!l) return { ...Pe, marginPx: { ...Pe.marginPx } };
|
|
1428
1443
|
const m = {
|
|
1429
|
-
pageWidthPx: l.pageWidthTwips !== void 0 ?
|
|
1430
|
-
pageHeightPx: l.pageHeightTwips !== void 0 ?
|
|
1444
|
+
pageWidthPx: l.pageWidthTwips !== void 0 ? L(W(l.pageWidthTwips)) : Pe.pageWidthPx,
|
|
1445
|
+
pageHeightPx: l.pageHeightTwips !== void 0 ? L(W(l.pageHeightTwips)) : Pe.pageHeightPx,
|
|
1431
1446
|
marginPx: l.marginTwips ? Ne(l.marginTwips) : { ...Pe.marginPx }
|
|
1432
1447
|
};
|
|
1433
|
-
return l.columns && (m.columns = rt(l.columns)), l.pageNumberStart !== void 0 && (m.pageNumberStart = l.pageNumberStart), l.headerDistTwips !== void 0 && (m.headerDistancePx =
|
|
1448
|
+
return l.columns && (m.columns = rt(l.columns)), l.pageNumberStart !== void 0 && (m.pageNumberStart = l.pageNumberStart), l.headerDistTwips !== void 0 && (m.headerDistancePx = L(W(l.headerDistTwips))), l.footerDistTwips !== void 0 && (m.footerDistancePx = L(W(l.footerDistTwips))), l.pageBorders && (m.pageBorders = it(l.pageBorders)), m;
|
|
1434
1449
|
}
|
|
1435
1450
|
return {
|
|
1436
1451
|
mapBlocks: X,
|
|
1437
|
-
mapSection:
|
|
1452
|
+
mapSection: G,
|
|
1438
1453
|
emptyParagraph: x,
|
|
1439
1454
|
// Realize EVERY defined numbering definition (not just referenced ones) so a
|
|
1440
1455
|
// list style authored in the editor survives save→reopen before it's applied.
|
|
@@ -1444,15 +1459,15 @@ function Sn(e, n, t = {}, o = /* @__PURE__ */ new Map(), r = () => ({}), i) {
|
|
|
1444
1459
|
},
|
|
1445
1460
|
bookmarks: () => {
|
|
1446
1461
|
const l = {};
|
|
1447
|
-
for (const [m,
|
|
1448
|
-
l[
|
|
1462
|
+
for (const [m, F] of d)
|
|
1463
|
+
l[F.name] = { start: F.pos, end: u.get(m) ?? F.pos };
|
|
1449
1464
|
return l;
|
|
1450
1465
|
},
|
|
1451
1466
|
footnoteRefs: () => c.map((l) => ({ docxId: l, noteId: `fn${l}` })),
|
|
1452
1467
|
tocField: () => K
|
|
1453
1468
|
};
|
|
1454
1469
|
}
|
|
1455
|
-
const
|
|
1470
|
+
const En = {
|
|
1456
1471
|
decimal: "decimal",
|
|
1457
1472
|
decimalZero: "decimal",
|
|
1458
1473
|
lowerLetter: "lowerLetter",
|
|
@@ -1461,7 +1476,7 @@ const xn = {
|
|
|
1461
1476
|
upperRoman: "upperRoman",
|
|
1462
1477
|
bullet: "bullet"
|
|
1463
1478
|
};
|
|
1464
|
-
function
|
|
1479
|
+
function Fn(e) {
|
|
1465
1480
|
if (e.length !== 1) return e;
|
|
1466
1481
|
switch (e.charCodeAt(0)) {
|
|
1467
1482
|
case 61623:
|
|
@@ -1487,29 +1502,29 @@ function In(e) {
|
|
|
1487
1502
|
return e;
|
|
1488
1503
|
}
|
|
1489
1504
|
}
|
|
1490
|
-
function
|
|
1505
|
+
function Mn(e) {
|
|
1491
1506
|
const n = [];
|
|
1492
1507
|
for (let t = 0; t < 9; t++)
|
|
1493
|
-
n.push(
|
|
1508
|
+
n.push(Rn(e.levels[t], t));
|
|
1494
1509
|
return { id: e.id, levels: n };
|
|
1495
1510
|
}
|
|
1496
|
-
function
|
|
1511
|
+
function Rn(e, n) {
|
|
1497
1512
|
if (!e)
|
|
1498
1513
|
return { format: "decimal", text: `%${n + 1}.`, indentLeftPx: 24 + n * 24, hangingPx: 18, start: 1 };
|
|
1499
|
-
const t =
|
|
1514
|
+
const t = En[e.format] ?? (e.format === "none" ? "bullet" : "decimal"), o = {
|
|
1500
1515
|
format: t,
|
|
1501
1516
|
text: t === "bullet" ? "" : e.lvlText,
|
|
1502
|
-
indentLeftPx: e.indentLeftTwips !== void 0 ?
|
|
1503
|
-
hangingPx: e.hangingTwips !== void 0 ?
|
|
1517
|
+
indentLeftPx: e.indentLeftTwips !== void 0 ? L(W(e.indentLeftTwips)) : 24 + n * 24,
|
|
1518
|
+
hangingPx: e.hangingTwips !== void 0 ? L(W(e.hangingTwips)) : 18,
|
|
1504
1519
|
start: e.start
|
|
1505
1520
|
};
|
|
1506
|
-
if (t === "bullet" && (o.bulletChar = e.format === "none" ? "" :
|
|
1521
|
+
if (t === "bullet" && (o.bulletChar = e.format === "none" ? "" : Fn(e.lvlText)), e.markerRunProps) {
|
|
1507
1522
|
const r = Ke(e.markerRunProps);
|
|
1508
1523
|
Object.keys(r).length > 0 && (o.markerStyle = r);
|
|
1509
1524
|
}
|
|
1510
1525
|
return o;
|
|
1511
1526
|
}
|
|
1512
|
-
const
|
|
1527
|
+
const Bn = {
|
|
1513
1528
|
left: "left",
|
|
1514
1529
|
start: "left",
|
|
1515
1530
|
num: "left",
|
|
@@ -1517,7 +1532,7 @@ const Mn = {
|
|
|
1517
1532
|
right: "right",
|
|
1518
1533
|
end: "right",
|
|
1519
1534
|
decimal: "decimal"
|
|
1520
|
-
},
|
|
1535
|
+
}, Ln = {
|
|
1521
1536
|
dot: "dot",
|
|
1522
1537
|
middleDot: "dot",
|
|
1523
1538
|
hyphen: "dash",
|
|
@@ -1525,18 +1540,18 @@ const Mn = {
|
|
|
1525
1540
|
};
|
|
1526
1541
|
function vt(e) {
|
|
1527
1542
|
const n = e.map((t) => {
|
|
1528
|
-
const o = { posPx:
|
|
1543
|
+
const o = { posPx: L(W(t.posTwips)) }, r = t.val ? Bn[t.val] : void 0;
|
|
1529
1544
|
r && r !== "left" && (o.align = r);
|
|
1530
|
-
const i = t.leader ?
|
|
1545
|
+
const i = t.leader ? Ln[t.leader] : void 0;
|
|
1531
1546
|
return i && (o.leader = i), o;
|
|
1532
1547
|
});
|
|
1533
1548
|
return n.sort((t, o) => t.posPx - o.posPx), n;
|
|
1534
1549
|
}
|
|
1535
|
-
function
|
|
1550
|
+
function On(e, n) {
|
|
1536
1551
|
const t = e && e.length === n && e.reduce((o, r) => o + r, 0) > 0 ? e.map((o) => Math.round(o / e.reduce((r, i) => r + i, 0) * 1e4) / 1e4) : Array.from({ length: n }, () => Math.round(1 / n * 1e4) / 1e4);
|
|
1537
1552
|
return t[t.length - 1] = Math.round((1 - t.slice(0, -1).reduce((o, r) => o + r, 0)) * 1e4) / 1e4, t;
|
|
1538
1553
|
}
|
|
1539
|
-
const
|
|
1554
|
+
const Nn = {
|
|
1540
1555
|
yellow: "#ffff00",
|
|
1541
1556
|
green: "#00ff00",
|
|
1542
1557
|
cyan: "#00ffff",
|
|
@@ -1559,13 +1574,13 @@ function De(e) {
|
|
|
1559
1574
|
return kt(n, e), n;
|
|
1560
1575
|
}
|
|
1561
1576
|
function kt(e, n) {
|
|
1562
|
-
if (n.fontAscii && (e.fontFamily = `${n.fontAscii}, serif`), n.sizeHalfPoints !== void 0 && (e.fontSizePx =
|
|
1563
|
-
const t =
|
|
1577
|
+
if (n.fontAscii && (e.fontFamily = `${n.fontAscii}, serif`), n.sizeHalfPoints !== void 0 && (e.fontSizePx = L(Yt(n.sizeHalfPoints))), n.bold !== void 0 && (e.bold = n.bold), n.italic !== void 0 && (e.italic = n.italic), n.underline !== void 0 && (e.underline = n.underline), n.strikethrough !== void 0 && (e.strikethrough = n.strikethrough), n.color && n.color !== "auto" && (e.color = `#${n.color.toLowerCase()}`), n.highlight) {
|
|
1578
|
+
const t = Nn[n.highlight];
|
|
1564
1579
|
t && (e.highlightColor = t);
|
|
1565
1580
|
}
|
|
1566
1581
|
n.vertAlign === "superscript" ? e.verticalAlign = "super" : n.vertAlign === "subscript" && (e.verticalAlign = "sub"), n.vanish && (e.hidden = !0);
|
|
1567
1582
|
}
|
|
1568
|
-
function
|
|
1583
|
+
function Dn(e) {
|
|
1569
1584
|
const n = {};
|
|
1570
1585
|
for (const [t, o] of Object.entries(e)) {
|
|
1571
1586
|
const r = { type: o.type };
|
|
@@ -1579,9 +1594,9 @@ function Ke(e) {
|
|
|
1579
1594
|
}
|
|
1580
1595
|
function bt(e) {
|
|
1581
1596
|
const n = {};
|
|
1582
|
-
return e.align && (n.align = e.align), e.lineHeight !== void 0 && (n.lineHeight =
|
|
1597
|
+
return e.align && (n.align = e.align), e.lineHeight !== void 0 && (n.lineHeight = L(e.lineHeight)), e.spaceBeforeTwips !== void 0 && (n.spaceBeforePx = L(W(e.spaceBeforeTwips))), e.spaceAfterTwips !== void 0 && (n.spaceAfterPx = L(W(e.spaceAfterTwips))), e.indentLeftTwips !== void 0 && (n.indentLeftPx = L(W(e.indentLeftTwips))), e.indentRightTwips !== void 0 && (n.indentRightPx = L(W(e.indentRightTwips))), e.indentFirstLineTwips !== void 0 && (n.indentFirstLinePx = L(W(e.indentFirstLineTwips))), e.keepWithNext && (n.keepWithNext = !0), e.keepLinesTogether && (n.keepLinesTogether = !0), e.tabStops && (n.tabStops = vt(e.tabStops)), n;
|
|
1583
1598
|
}
|
|
1584
|
-
function
|
|
1599
|
+
function Hn(e) {
|
|
1585
1600
|
if (e.styles.size === 0) return;
|
|
1586
1601
|
const n = /* @__PURE__ */ new Set();
|
|
1587
1602
|
for (const o of e.styles.values())
|
|
@@ -1602,7 +1617,7 @@ function Ln(e) {
|
|
|
1602
1617
|
(o, r) => o.id === e.defaultParaStyleId ? -1 : r.id === e.defaultParaStyleId ? 1 : o.name.localeCompare(r.name)
|
|
1603
1618
|
), { styles: t, defaultStyleId: e.defaultParaStyleId ?? t[0].id };
|
|
1604
1619
|
}
|
|
1605
|
-
function
|
|
1620
|
+
function zn(e) {
|
|
1606
1621
|
const n = /* @__PURE__ */ new Set();
|
|
1607
1622
|
for (const r of e.styles.values()) r.type === "table" && n.add(r.id);
|
|
1608
1623
|
if (n.size === 0) return;
|
|
@@ -1611,7 +1626,7 @@ function Nn(e) {
|
|
|
1611
1626
|
Object.keys(u).length > 0 && (d.char = u);
|
|
1612
1627
|
const f = bt(i);
|
|
1613
1628
|
Object.keys(f).length > 0 && (d.para = f);
|
|
1614
|
-
const c =
|
|
1629
|
+
const c = Jt(a);
|
|
1615
1630
|
return c && (d.borders = c), s !== void 0 && (d.shading = s), d;
|
|
1616
1631
|
}, o = {};
|
|
1617
1632
|
for (const r of n) {
|
|
@@ -1626,10 +1641,10 @@ function Nn(e) {
|
|
|
1626
1641
|
return o;
|
|
1627
1642
|
}
|
|
1628
1643
|
function st(e) {
|
|
1629
|
-
const n = { ...
|
|
1630
|
-
return e.align && (n.align = e.align), e.lineHeight !== void 0 && (n.lineHeight =
|
|
1644
|
+
const n = { ...xn };
|
|
1645
|
+
return e.align && (n.align = e.align), e.lineHeight !== void 0 && (n.lineHeight = L(e.lineHeight)), e.spaceBeforeTwips !== void 0 && (n.spaceBeforePx = L(W(e.spaceBeforeTwips))), e.spaceAfterTwips !== void 0 && (n.spaceAfterPx = L(W(e.spaceAfterTwips))), e.indentLeftTwips !== void 0 && (n.indentLeftPx = L(W(e.indentLeftTwips))), e.indentRightTwips !== void 0 && (n.indentRightPx = L(W(e.indentRightTwips))), e.indentFirstLineTwips !== void 0 && (n.indentFirstLinePx = L(W(e.indentFirstLineTwips))), e.keepWithNext && (n.keepWithNext = !0), e.keepLinesTogether && (n.keepLinesTogether = !0), e.tabStops && (n.tabStops = vt(e.tabStops)), e.pageBreakBefore && (n.pageBreakBefore = !0), e.outlineLevel !== void 0 && (n.outlineLevel = e.outlineLevel), e.styleId && (n.namedStyle = e.styleId), n;
|
|
1631
1646
|
}
|
|
1632
|
-
const
|
|
1647
|
+
const Un = {
|
|
1633
1648
|
png: "image/png",
|
|
1634
1649
|
jpg: "image/jpeg",
|
|
1635
1650
|
jpeg: "image/jpeg",
|
|
@@ -1638,7 +1653,7 @@ const Dn = {
|
|
|
1638
1653
|
webp: "image/webp",
|
|
1639
1654
|
svg: "image/svg+xml"
|
|
1640
1655
|
};
|
|
1641
|
-
function
|
|
1656
|
+
function _n(e, n, t, o) {
|
|
1642
1657
|
const r = /* @__PURE__ */ new Map(), i = [];
|
|
1643
1658
|
return {
|
|
1644
1659
|
resolve(a) {
|
|
@@ -1658,7 +1673,7 @@ function Hn(e, n, t, o) {
|
|
|
1658
1673
|
return r.set(s.target, p), p;
|
|
1659
1674
|
}
|
|
1660
1675
|
let d;
|
|
1661
|
-
const u = s.target.slice(s.target.lastIndexOf(".") + 1).toLowerCase(), f =
|
|
1676
|
+
const u = s.target.slice(s.target.lastIndexOf(".") + 1).toLowerCase(), f = Un[u];
|
|
1662
1677
|
if (!f)
|
|
1663
1678
|
t.add(
|
|
1664
1679
|
"media-unsupported",
|
|
@@ -1678,14 +1693,14 @@ function Hn(e, n, t, o) {
|
|
|
1678
1693
|
urls: () => [...i]
|
|
1679
1694
|
};
|
|
1680
1695
|
}
|
|
1681
|
-
const
|
|
1682
|
-
function
|
|
1696
|
+
const Gn = /* @__PURE__ */ new Map();
|
|
1697
|
+
function jn(e) {
|
|
1683
1698
|
const n = /* @__PURE__ */ new Map(), t = de(ue(e, "numbering.xml"), "w:numbering");
|
|
1684
1699
|
if (!t) return n;
|
|
1685
1700
|
const o = /* @__PURE__ */ new Map();
|
|
1686
1701
|
for (const r of te(t, "w:abstractNum")) {
|
|
1687
1702
|
const i = w(r, "w:abstractNumId");
|
|
1688
|
-
i !== void 0 && o.set(i,
|
|
1703
|
+
i !== void 0 && o.set(i, $n(r));
|
|
1689
1704
|
}
|
|
1690
1705
|
for (const r of te(t, "w:num")) {
|
|
1691
1706
|
const i = w(r, "w:numId");
|
|
@@ -1701,7 +1716,7 @@ function Un(e) {
|
|
|
1701
1716
|
}
|
|
1702
1717
|
return n;
|
|
1703
1718
|
}
|
|
1704
|
-
function
|
|
1719
|
+
function $n(e) {
|
|
1705
1720
|
const n = [];
|
|
1706
1721
|
for (const t of te(e, "w:lvl")) {
|
|
1707
1722
|
const o = b(t, "w:ilvl") ?? n.length;
|
|
@@ -1724,7 +1739,7 @@ function yt(e, n) {
|
|
|
1724
1739
|
const a = h(e, "w:rPr");
|
|
1725
1740
|
return a && (o.markerRunProps = we(a)), o;
|
|
1726
1741
|
}
|
|
1727
|
-
function
|
|
1742
|
+
function Wn(e, n) {
|
|
1728
1743
|
const t = n.includes("/") ? n.slice(0, n.lastIndexOf("/")) : "", o = /* @__PURE__ */ new Map(), r = de(ue(e, `${n} rels`), "Relationships");
|
|
1729
1744
|
if (!r) return o;
|
|
1730
1745
|
for (const i of oe(r)) {
|
|
@@ -1732,11 +1747,11 @@ function _n(e, n) {
|
|
|
1732
1747
|
const a = w(i, "Id"), s = w(i, "Type"), d = w(i, "Target");
|
|
1733
1748
|
if (!a || !s || !d) continue;
|
|
1734
1749
|
const u = w(i, "TargetMode") === "External";
|
|
1735
|
-
o.set(a, { id: a, type: s, target: u ? d :
|
|
1750
|
+
o.set(a, { id: a, type: s, target: u ? d : Xn(t, d), external: u });
|
|
1736
1751
|
}
|
|
1737
1752
|
return o;
|
|
1738
1753
|
}
|
|
1739
|
-
function
|
|
1754
|
+
function Xn(e, n) {
|
|
1740
1755
|
if (n.startsWith("/")) return n.slice(1);
|
|
1741
1756
|
const t = e === "" ? [] : e.split("/");
|
|
1742
1757
|
for (const o of n.split("/"))
|
|
@@ -1747,11 +1762,11 @@ function Tt(e, n) {
|
|
|
1747
1762
|
for (const t of e.values())
|
|
1748
1763
|
if (t.type.endsWith(`/${n}`)) return t;
|
|
1749
1764
|
}
|
|
1750
|
-
function
|
|
1765
|
+
function Vn(e) {
|
|
1751
1766
|
const n = e.lastIndexOf("/"), t = n >= 0 ? e.slice(0, n + 1) : "", o = n >= 0 ? e.slice(n + 1) : e;
|
|
1752
1767
|
return `${t}_rels/${o}.rels`;
|
|
1753
1768
|
}
|
|
1754
|
-
const
|
|
1769
|
+
const Yn = { colors: /* @__PURE__ */ new Map() }, Kn = {
|
|
1755
1770
|
dark1: "dk1",
|
|
1756
1771
|
light1: "lt1",
|
|
1757
1772
|
dark2: "dk2",
|
|
@@ -1763,14 +1778,14 @@ const Wn = { colors: /* @__PURE__ */ new Map() }, Xn = {
|
|
|
1763
1778
|
hyperlink: "hlink",
|
|
1764
1779
|
followedHyperlink: "folHlink"
|
|
1765
1780
|
};
|
|
1766
|
-
function
|
|
1767
|
-
return e.colors.get(
|
|
1781
|
+
function qn(e, n) {
|
|
1782
|
+
return e.colors.get(Kn[n] ?? n);
|
|
1768
1783
|
}
|
|
1769
|
-
function
|
|
1784
|
+
function Zn(e, n) {
|
|
1770
1785
|
if (n.startsWith("major")) return e.majorLatin;
|
|
1771
1786
|
if (n.startsWith("minor")) return e.minorLatin;
|
|
1772
1787
|
}
|
|
1773
|
-
function
|
|
1788
|
+
function Qn(e) {
|
|
1774
1789
|
const n = { colors: /* @__PURE__ */ new Map() }, t = de(ue(e, "theme"), "a:theme"), o = t && h(t, "a:themeElements");
|
|
1775
1790
|
if (!o) return n;
|
|
1776
1791
|
const r = h(o, "a:fontScheme");
|
|
@@ -1792,8 +1807,8 @@ function at(e) {
|
|
|
1792
1807
|
const n = e && h(e, "a:latin");
|
|
1793
1808
|
return n && w(n, "typeface") || void 0;
|
|
1794
1809
|
}
|
|
1795
|
-
const
|
|
1796
|
-
function
|
|
1810
|
+
const Jn = { docDefaultsRun: {}, docDefaultsPara: {}, styles: /* @__PURE__ */ new Map() };
|
|
1811
|
+
function eo(e, n) {
|
|
1797
1812
|
const t = { docDefaultsRun: {}, docDefaultsPara: {}, styles: /* @__PURE__ */ new Map() }, o = de(ue(e, "styles.xml"), "w:styles");
|
|
1798
1813
|
if (!o) return t;
|
|
1799
1814
|
const r = h(o, "w:docDefaults");
|
|
@@ -1801,7 +1816,7 @@ function Zn(e, n) {
|
|
|
1801
1816
|
const i = h(r, "w:rPrDefault"), a = i && h(i, "w:rPr");
|
|
1802
1817
|
a && (t.docDefaultsRun = we(a));
|
|
1803
1818
|
const s = h(r, "w:pPrDefault"), d = s && h(s, "w:pPr");
|
|
1804
|
-
d && (t.docDefaultsPara =
|
|
1819
|
+
d && (t.docDefaultsPara = Me(d, n));
|
|
1805
1820
|
}
|
|
1806
1821
|
for (const i of te(o, "w:style")) {
|
|
1807
1822
|
const a = w(i, "w:styleId"), s = w(i, "w:type");
|
|
@@ -1810,7 +1825,7 @@ function Zn(e, n) {
|
|
|
1810
1825
|
id: a,
|
|
1811
1826
|
type: s,
|
|
1812
1827
|
rPr: d ? we(d) : {},
|
|
1813
|
-
pPr: u ?
|
|
1828
|
+
pPr: u ? Me(u, n) : {}
|
|
1814
1829
|
}, c = ie(i, "w:name");
|
|
1815
1830
|
c && (f.name = c);
|
|
1816
1831
|
const p = ie(i, "w:basedOn");
|
|
@@ -1819,7 +1834,7 @@ function Zn(e, n) {
|
|
|
1819
1834
|
if (T) {
|
|
1820
1835
|
const v = Be(h(T, "w:tblBorders"));
|
|
1821
1836
|
v && (f.tblBorders = v);
|
|
1822
|
-
const x =
|
|
1837
|
+
const x = Le(h(T, "w:shd"));
|
|
1823
1838
|
x && (f.tblShd = x);
|
|
1824
1839
|
const I = ie(T, "w:tblStyleRowBandSize");
|
|
1825
1840
|
I && Number.isFinite(Number(I)) && (f.rowBandSize = Number(I));
|
|
@@ -1832,10 +1847,10 @@ function Zn(e, n) {
|
|
|
1832
1847
|
if (!x) continue;
|
|
1833
1848
|
const I = h(v, "w:rPr"), E = h(v, "w:pPr"), N = h(v, "w:tcPr"), Z = {
|
|
1834
1849
|
rPr: I ? we(I) : {},
|
|
1835
|
-
pPr: E ?
|
|
1850
|
+
pPr: E ? Me(E, n) : {}
|
|
1836
1851
|
}, z = N && Be(h(N, "w:tcBorders"));
|
|
1837
1852
|
z && (Z.borders = z);
|
|
1838
|
-
const K = N &&
|
|
1853
|
+
const K = N && Le(h(N, "w:shd"));
|
|
1839
1854
|
K && (Z.shd = K), S[x] = Z;
|
|
1840
1855
|
}
|
|
1841
1856
|
Object.keys(S).length > 0 && (f.tblStylePr = S);
|
|
@@ -1846,18 +1861,18 @@ function Zn(e, n) {
|
|
|
1846
1861
|
}
|
|
1847
1862
|
return t;
|
|
1848
1863
|
}
|
|
1849
|
-
function
|
|
1864
|
+
function to(e, n) {
|
|
1850
1865
|
let t, o;
|
|
1851
1866
|
const r = /* @__PURE__ */ new Set(), i = [];
|
|
1852
1867
|
for (let s = e.styles.get(n); s && !r.has(s.id); s = s.basedOnId ? e.styles.get(s.basedOnId) : void 0)
|
|
1853
1868
|
r.add(s.id), i.unshift(s);
|
|
1854
1869
|
for (const s of i)
|
|
1855
|
-
t =
|
|
1870
|
+
t = Zt(t, s.tblBorders), s.tblShd !== void 0 && (o = s.tblShd);
|
|
1856
1871
|
const a = {};
|
|
1857
1872
|
return t && (a.borders = t), o !== void 0 && (a.shd = o), a;
|
|
1858
1873
|
}
|
|
1859
|
-
const
|
|
1860
|
-
function
|
|
1874
|
+
const no = ["bold", "italic", "strikethrough", "vanish"];
|
|
1875
|
+
function oo(e, n) {
|
|
1861
1876
|
const t = /* @__PURE__ */ new Map(), o = /* @__PURE__ */ new Map(), r = (f) => {
|
|
1862
1877
|
const c = [], p = /* @__PURE__ */ new Set();
|
|
1863
1878
|
for (let g = e.styles.get(f); g && !p.has(g.id); g = g.basedOnId ? e.styles.get(g.basedOnId) : void 0)
|
|
@@ -1875,7 +1890,7 @@ function eo(e, n) {
|
|
|
1875
1890
|
if (g) return g;
|
|
1876
1891
|
const T = f ? i(f) : {}, S = c ? i(c) : {};
|
|
1877
1892
|
g = Ee(Ee(e.docDefaultsRun, T), S);
|
|
1878
|
-
for (const v of
|
|
1893
|
+
for (const v of no) {
|
|
1879
1894
|
if (e.docDefaultsRun[v] === void 0 && T[v] === void 0 && S[v] === void 0) continue;
|
|
1880
1895
|
const x = e.docDefaultsRun[v] ?? !1;
|
|
1881
1896
|
g[v] = x !== (T[v] === !0) != (S[v] === !0);
|
|
@@ -1900,11 +1915,11 @@ function eo(e, n) {
|
|
|
1900
1915
|
function u(f) {
|
|
1901
1916
|
const c = { ...f };
|
|
1902
1917
|
if (!c.fontAscii && c.fontThemeAscii) {
|
|
1903
|
-
const p =
|
|
1918
|
+
const p = Zn(n, c.fontThemeAscii);
|
|
1904
1919
|
p && (c.fontAscii = p);
|
|
1905
1920
|
}
|
|
1906
1921
|
if ((c.color === void 0 || c.color === "auto") && c.colorTheme) {
|
|
1907
|
-
const p =
|
|
1922
|
+
const p = qn(n, c.colorTheme);
|
|
1908
1923
|
p && (c.color = p);
|
|
1909
1924
|
}
|
|
1910
1925
|
return c;
|
|
@@ -1920,7 +1935,7 @@ function Re(e, n) {
|
|
|
1920
1935
|
r !== void 0 && (t[o] = r);
|
|
1921
1936
|
return t;
|
|
1922
1937
|
}
|
|
1923
|
-
var ae = Uint8Array, be = Uint16Array,
|
|
1938
|
+
var ae = Uint8Array, be = Uint16Array, ro = Int32Array, Pt = new ae([
|
|
1924
1939
|
0,
|
|
1925
1940
|
0,
|
|
1926
1941
|
0,
|
|
@@ -1989,16 +2004,16 @@ var ae = Uint8Array, be = Uint16Array, to = Int32Array, Pt = new ae([
|
|
|
1989
2004
|
/* unused */
|
|
1990
2005
|
0,
|
|
1991
2006
|
0
|
|
1992
|
-
]),
|
|
2007
|
+
]), io = new ae([16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15]), St = function(e, n) {
|
|
1993
2008
|
for (var t = new be(31), o = 0; o < 31; ++o)
|
|
1994
2009
|
t[o] = n += 1 << e[o - 1];
|
|
1995
|
-
for (var r = new
|
|
2010
|
+
for (var r = new ro(t[30]), o = 1; o < 30; ++o)
|
|
1996
2011
|
for (var i = t[o]; i < t[o + 1]; ++i)
|
|
1997
2012
|
r[i] = i - t[o] << 5 | o;
|
|
1998
2013
|
return { b: t, r };
|
|
1999
|
-
}, xt = St(Pt, 2), It = xt.b,
|
|
2000
|
-
It[28] = 258,
|
|
2001
|
-
var
|
|
2014
|
+
}, xt = St(Pt, 2), It = xt.b, so = xt.r;
|
|
2015
|
+
It[28] = 258, so[258] = 28;
|
|
2016
|
+
var ao = St(At, 0), co = ao.b, je = new be(32768);
|
|
2002
2017
|
for (var Y = 0; Y < 32768; ++Y) {
|
|
2003
2018
|
var he = (Y & 43690) >> 1 | (Y & 21845) << 1;
|
|
2004
2019
|
he = (he & 52428) >> 2 | (he & 13107) << 2, he = (he & 61680) >> 4 | (he & 3855) << 4, je[Y] = ((he & 65280) >> 8 | (he & 255) << 8) >> 1;
|
|
@@ -2033,7 +2048,7 @@ for (var Y = 280; Y < 288; ++Y)
|
|
|
2033
2048
|
var Ct = new ae(32);
|
|
2034
2049
|
for (var Y = 0; Y < 32; ++Y)
|
|
2035
2050
|
Ct[Y] = 5;
|
|
2036
|
-
var
|
|
2051
|
+
var lo = /* @__PURE__ */ Se(Ie, 9, 1), fo = /* @__PURE__ */ Se(Ct, 5, 1), He = function(e) {
|
|
2037
2052
|
for (var n = e[0], t = 1; t < e.length; ++t)
|
|
2038
2053
|
e[t] > n && (n = e[t]);
|
|
2039
2054
|
return n;
|
|
@@ -2043,11 +2058,11 @@ var so = /* @__PURE__ */ Se(Ie, 9, 1), ao = /* @__PURE__ */ Se(Ct, 5, 1), He = f
|
|
|
2043
2058
|
}, ze = function(e, n) {
|
|
2044
2059
|
var t = n / 8 | 0;
|
|
2045
2060
|
return (e[t] | e[t + 1] << 8 | e[t + 2] << 16) >> (n & 7);
|
|
2046
|
-
},
|
|
2061
|
+
}, uo = function(e) {
|
|
2047
2062
|
return (e + 7) / 8 | 0;
|
|
2048
2063
|
}, qe = function(e, n, t) {
|
|
2049
2064
|
return (n == null || n < 0) && (n = 0), (t == null || t > e.length) && (t = e.length), new ae(e.subarray(n, t));
|
|
2050
|
-
},
|
|
2065
|
+
}, ho = [
|
|
2051
2066
|
"unexpected EOF",
|
|
2052
2067
|
"invalid block type",
|
|
2053
2068
|
"invalid length/literal",
|
|
@@ -2065,21 +2080,21 @@ var so = /* @__PURE__ */ Se(Ie, 9, 1), ao = /* @__PURE__ */ Se(Ct, 5, 1), He = f
|
|
|
2065
2080
|
"invalid zip data"
|
|
2066
2081
|
// determined by unknown compression method
|
|
2067
2082
|
], se = function(e, n, t) {
|
|
2068
|
-
var o = new Error(n ||
|
|
2083
|
+
var o = new Error(n || ho[e]);
|
|
2069
2084
|
if (o.code = e, Error.captureStackTrace && Error.captureStackTrace(o, se), !t)
|
|
2070
2085
|
throw o;
|
|
2071
2086
|
return o;
|
|
2072
|
-
},
|
|
2087
|
+
}, po = function(e, n, t, o) {
|
|
2073
2088
|
var r = e.length, i = o ? o.length : 0;
|
|
2074
2089
|
if (!r || n.f && !n.l)
|
|
2075
2090
|
return t || new ae(0);
|
|
2076
2091
|
var a = !t, s = a || n.i != 2, d = n.i;
|
|
2077
2092
|
a && (t = new ae(r * 3));
|
|
2078
2093
|
var u = function(k) {
|
|
2079
|
-
var
|
|
2080
|
-
if (k >
|
|
2081
|
-
var
|
|
2082
|
-
|
|
2094
|
+
var O = t.length;
|
|
2095
|
+
if (k > O) {
|
|
2096
|
+
var _ = new ae(Math.max(O * 2, k));
|
|
2097
|
+
_.set(t), t = _;
|
|
2083
2098
|
}
|
|
2084
2099
|
}, f = n.f || 0, c = n.p || 0, p = n.b || 0, g = n.l, T = n.d, S = n.m, v = n.n, x = r * 8;
|
|
2085
2100
|
do {
|
|
@@ -2088,17 +2103,17 @@ var so = /* @__PURE__ */ Se(Ie, 9, 1), ao = /* @__PURE__ */ Se(Ct, 5, 1), He = f
|
|
|
2088
2103
|
var I = le(e, c + 1, 3);
|
|
2089
2104
|
if (c += 3, I)
|
|
2090
2105
|
if (I == 1)
|
|
2091
|
-
g =
|
|
2106
|
+
g = lo, T = fo, S = 9, v = 5;
|
|
2092
2107
|
else if (I == 2) {
|
|
2093
2108
|
var z = le(e, c, 31) + 257, K = le(e, c + 10, 15) + 4, X = z + le(e, c + 5, 31) + 1;
|
|
2094
2109
|
c += 14;
|
|
2095
2110
|
for (var q = new ae(X), ee = new ae(19), P = 0; P < K; ++P)
|
|
2096
|
-
ee[
|
|
2111
|
+
ee[io[P]] = le(e, c + P * 3, 7);
|
|
2097
2112
|
c += K * 3;
|
|
2098
2113
|
for (var H = He(ee), re = (1 << H) - 1, Q = Se(ee, H, 1), P = 0; P < X; ) {
|
|
2099
|
-
var
|
|
2100
|
-
c +=
|
|
2101
|
-
var E =
|
|
2114
|
+
var G = Q[le(e, c, re)];
|
|
2115
|
+
c += G & 15;
|
|
2116
|
+
var E = G >> 4;
|
|
2102
2117
|
if (E < 16)
|
|
2103
2118
|
q[P++] = E;
|
|
2104
2119
|
else {
|
|
@@ -2107,12 +2122,12 @@ var so = /* @__PURE__ */ Se(Ie, 9, 1), ao = /* @__PURE__ */ Se(Ct, 5, 1), He = f
|
|
|
2107
2122
|
q[P++] = l;
|
|
2108
2123
|
}
|
|
2109
2124
|
}
|
|
2110
|
-
var
|
|
2111
|
-
S = He(
|
|
2125
|
+
var F = q.subarray(0, z), C = q.subarray(z);
|
|
2126
|
+
S = He(F), v = He(C), g = Se(F, S, 1), T = Se(C, v, 1);
|
|
2112
2127
|
} else
|
|
2113
2128
|
se(1);
|
|
2114
2129
|
else {
|
|
2115
|
-
var E =
|
|
2130
|
+
var E = uo(c) + 4, N = e[E - 4] | e[E - 3] << 8, Z = E + N;
|
|
2116
2131
|
if (Z > r) {
|
|
2117
2132
|
d && se(0);
|
|
2118
2133
|
break;
|
|
@@ -2126,7 +2141,7 @@ var so = /* @__PURE__ */ Se(Ie, 9, 1), ao = /* @__PURE__ */ Se(Ct, 5, 1), He = f
|
|
|
2126
2141
|
}
|
|
2127
2142
|
}
|
|
2128
2143
|
s && u(p + 131072);
|
|
2129
|
-
for (var y = (1 << S) - 1,
|
|
2144
|
+
for (var y = (1 << S) - 1, M = (1 << v) - 1, R = c; ; R = c) {
|
|
2130
2145
|
var l = g[ze(e, c) & y], B = l >> 4;
|
|
2131
2146
|
if (c += l & 15, c > x) {
|
|
2132
2147
|
d && se(0);
|
|
@@ -2143,9 +2158,9 @@ var so = /* @__PURE__ */ Se(Ie, 9, 1), ao = /* @__PURE__ */ Se(Ct, 5, 1), He = f
|
|
|
2143
2158
|
var P = B - 257, j = Pt[P];
|
|
2144
2159
|
J = le(e, c, (1 << j) - 1) + It[P], c += j;
|
|
2145
2160
|
}
|
|
2146
|
-
var V = T[ze(e, c) &
|
|
2161
|
+
var V = T[ze(e, c) & M], $ = V >> 4;
|
|
2147
2162
|
V || se(3), c += V & 15;
|
|
2148
|
-
var C =
|
|
2163
|
+
var C = co[$];
|
|
2149
2164
|
if ($ > 3) {
|
|
2150
2165
|
var j = At[$];
|
|
2151
2166
|
C += ze(e, c) & (1 << j) - 1, c += j;
|
|
@@ -2168,22 +2183,22 @@ var so = /* @__PURE__ */ Se(Ie, 9, 1), ao = /* @__PURE__ */ Se(Ct, 5, 1), He = f
|
|
|
2168
2183
|
n.l = g, n.p = R, n.b = p, n.f = f, g && (f = 1, n.m = S, n.d = T, n.n = v);
|
|
2169
2184
|
} while (!f);
|
|
2170
2185
|
return p != t.length && a ? qe(t, 0, p) : t.subarray(0, p);
|
|
2171
|
-
},
|
|
2186
|
+
}, go = /* @__PURE__ */ new ae(0), fe = function(e, n) {
|
|
2172
2187
|
return e[n] | e[n + 1] << 8;
|
|
2173
2188
|
}, ce = function(e, n) {
|
|
2174
2189
|
return (e[n] | e[n + 1] << 8 | e[n + 2] << 16 | e[n + 3] << 24) >>> 0;
|
|
2175
2190
|
}, Ue = function(e, n) {
|
|
2176
2191
|
return ce(e, n) + ce(e, n + 4) * 4294967296;
|
|
2177
2192
|
};
|
|
2178
|
-
function
|
|
2179
|
-
return
|
|
2193
|
+
function mo(e, n) {
|
|
2194
|
+
return po(e, { i: 2 }, n && n.out, n && n.dictionary);
|
|
2180
2195
|
}
|
|
2181
|
-
var $e = typeof TextDecoder < "u" && /* @__PURE__ */ new TextDecoder(),
|
|
2196
|
+
var $e = typeof TextDecoder < "u" && /* @__PURE__ */ new TextDecoder(), wo = 0;
|
|
2182
2197
|
try {
|
|
2183
|
-
$e.decode(
|
|
2198
|
+
$e.decode(go, { stream: !0 }), wo = 1;
|
|
2184
2199
|
} catch {
|
|
2185
2200
|
}
|
|
2186
|
-
var
|
|
2201
|
+
var vo = function(e) {
|
|
2187
2202
|
for (var n = "", t = 0; ; ) {
|
|
2188
2203
|
var o = e[t++], r = (o > 127) + (o > 223) + (o > 239);
|
|
2189
2204
|
if (t + r > e.length)
|
|
@@ -2199,16 +2214,16 @@ function Et(e, n) {
|
|
|
2199
2214
|
} else {
|
|
2200
2215
|
if ($e)
|
|
2201
2216
|
return $e.decode(e);
|
|
2202
|
-
var r =
|
|
2217
|
+
var r = vo(e), i = r.s, t = r.r;
|
|
2203
2218
|
return t.length && se(8), i;
|
|
2204
2219
|
}
|
|
2205
2220
|
}
|
|
2206
|
-
var
|
|
2221
|
+
var ko = function(e, n) {
|
|
2207
2222
|
return n + 30 + fe(e, n + 26) + fe(e, n + 28);
|
|
2208
|
-
},
|
|
2209
|
-
var o = fe(e, n + 28), r = fe(e, n + 30), i = Et(e.subarray(n + 46, n + 46 + o), !(fe(e, n + 8) & 2048)), a = n + 46 + o, s =
|
|
2223
|
+
}, bo = function(e, n, t) {
|
|
2224
|
+
var o = fe(e, n + 28), r = fe(e, n + 30), i = Et(e.subarray(n + 46, n + 46 + o), !(fe(e, n + 8) & 2048)), a = n + 46 + o, s = yo(e, a, r, t, ce(e, n + 20), ce(e, n + 24), ce(e, n + 42)), d = s[0], u = s[1], f = s[2];
|
|
2210
2225
|
return [fe(e, n + 10), d, u, i, a + r + fe(e, n + 32), f];
|
|
2211
|
-
},
|
|
2226
|
+
}, yo = function(e, n, t, o, r, i, a) {
|
|
2212
2227
|
var s = r == 4294967295, d = i == 4294967295, u = a == 4294967295, f = n + t, c = s + d + u;
|
|
2213
2228
|
if (o && c) {
|
|
2214
2229
|
for (; n + 4 < f; n += 4 + fe(e, n + 2))
|
|
@@ -2235,21 +2250,21 @@ function ct(e, n) {
|
|
|
2235
2250
|
a = ce(e, s) == 101075792, a && (r = ce(e, s + 32), i = ce(e, s + 48));
|
|
2236
2251
|
}
|
|
2237
2252
|
for (var d = n && n.filter, u = 0; u < r; ++u) {
|
|
2238
|
-
var f =
|
|
2253
|
+
var f = bo(e, i, a), c = f[0], p = f[1], g = f[2], T = f[3], S = f[4], v = f[5], x = ko(e, v);
|
|
2239
2254
|
i = S, (!d || d({
|
|
2240
2255
|
name: T,
|
|
2241
2256
|
size: p,
|
|
2242
2257
|
originalSize: g,
|
|
2243
2258
|
compression: c
|
|
2244
|
-
})) && (c ? c == 8 ? t[T] =
|
|
2259
|
+
})) && (c ? c == 8 ? t[T] = mo(e.subarray(x, x + p), { out: new ae(g) }) : se(14, "unknown compression type " + c) : t[T] = qe(e, x, x + p));
|
|
2245
2260
|
}
|
|
2246
2261
|
return t;
|
|
2247
2262
|
}
|
|
2248
|
-
const
|
|
2249
|
-
function
|
|
2250
|
-
if (lt(e,
|
|
2263
|
+
const To = [80, 75], Po = [208, 207, 17, 224], lt = (e, n) => n.every((t, o) => e[o] === t);
|
|
2264
|
+
function Ao(e) {
|
|
2265
|
+
if (lt(e, Po))
|
|
2251
2266
|
throw new ge("ENCRYPTED", "Password-protected documents are not supported.");
|
|
2252
|
-
if (!lt(e,
|
|
2267
|
+
if (!lt(e, To))
|
|
2253
2268
|
throw new ge("NOT_ZIP", "Not a .docx file (zip container signature missing).");
|
|
2254
2269
|
const n = (a) => /^word\/media\//.test(a);
|
|
2255
2270
|
let t, o;
|
|
@@ -2277,40 +2292,40 @@ function yo(e) {
|
|
|
2277
2292
|
names: () => [...Object.keys(t), ...o.filter((a) => !(a in t))]
|
|
2278
2293
|
};
|
|
2279
2294
|
}
|
|
2280
|
-
function
|
|
2281
|
-
const o = (R, B) => n?.(R, B), r = new
|
|
2295
|
+
function So(e, n, t) {
|
|
2296
|
+
const o = (R, B) => n?.(R, B), r = new Wt(), i = [];
|
|
2282
2297
|
o("unzip", 0);
|
|
2283
|
-
const a =
|
|
2298
|
+
const a = Ao(e);
|
|
2284
2299
|
o("unzip", 1);
|
|
2285
|
-
const s = a.text("[Content_Types].xml"), d = (s !== void 0 ?
|
|
2300
|
+
const s = a.text("[Content_Types].xml"), d = (s !== void 0 ? Vt(s) : void 0) ?? "word/document.xml", u = a.text(d);
|
|
2286
2301
|
if (u === void 0)
|
|
2287
2302
|
throw new ge("NO_DOCUMENT_PART", `Main document part "${d}" not found in the archive.`);
|
|
2288
2303
|
const f = We(a, d);
|
|
2289
2304
|
o("styles", 0);
|
|
2290
|
-
const c =
|
|
2305
|
+
const c = Fe(a, f, "styles") ?? a.text("word/styles.xml"), p = c !== void 0 ? eo(c, r) : Jn, g = Fe(a, f, "theme") ?? a.text("word/theme/theme1.xml"), T = g !== void 0 ? Qn(g) : Yn, S = oo(p, T), v = Fe(a, f, "numbering") ?? a.text("word/numbering.xml"), x = v !== void 0 ? jn(v) : Gn;
|
|
2291
2306
|
o("styles", 1), o("parse", 0);
|
|
2292
|
-
const I =
|
|
2307
|
+
const I = nn(u, d, r);
|
|
2293
2308
|
o("parse", 1), o("map", 0);
|
|
2294
2309
|
const E = {
|
|
2295
2310
|
w: I.section?.pageWidthTwips ?? 12240,
|
|
2296
2311
|
h: I.section?.pageHeightTwips ?? 15840
|
|
2297
|
-
}, N =
|
|
2312
|
+
}, N = Cn(
|
|
2298
2313
|
r,
|
|
2299
2314
|
S,
|
|
2300
2315
|
I.sdts,
|
|
2301
2316
|
x,
|
|
2302
|
-
(R) =>
|
|
2317
|
+
(R) => to(p, R),
|
|
2303
2318
|
E
|
|
2304
2319
|
), Z = [], z = (R) => {
|
|
2305
|
-
const B =
|
|
2320
|
+
const B = _n(a, R, r);
|
|
2306
2321
|
return Z.push(B), B;
|
|
2307
2322
|
}, K = N.mapBlocks(I.blocks, z(f), Xe(f));
|
|
2308
2323
|
K.length === 0 && K.push(N.emptyParagraph());
|
|
2309
2324
|
const X = N.mapSection(I.section);
|
|
2310
2325
|
I.pageColorHex && (X.pageColorHex = `#${I.pageColorHex}`);
|
|
2311
|
-
const q =
|
|
2326
|
+
const q = Fe(a, f, "settings") ?? a.text("word/settings.xml"), ee = q !== void 0 && Io(q);
|
|
2312
2327
|
ft(X, "header", I.section?.headerRefs, I.section?.titlePg ?? !1, ee, a, f, N, z, r, I.sdts), ft(X, "footer", I.section?.footerRefs, I.section?.titlePg ?? !1, ee, a, f, N, z, r, I.sdts);
|
|
2313
|
-
const P =
|
|
2328
|
+
const P = Co(f, "footnotes") ?? "word/footnotes.xml", H = a.text(P), re = H !== void 0 ? Pn(H, P, r, I.sdts) : /* @__PURE__ */ new Map(), Q = {};
|
|
2314
2329
|
if (re.size > 0) {
|
|
2315
2330
|
const R = We(a, P), B = z(R), J = Xe(R);
|
|
2316
2331
|
for (const { docxId: j, noteId: V } of N.footnoteRefs()) {
|
|
@@ -2324,51 +2339,51 @@ function To(e, n, t) {
|
|
|
2324
2339
|
}
|
|
2325
2340
|
}
|
|
2326
2341
|
o("map", 1);
|
|
2327
|
-
const
|
|
2328
|
-
Object.keys(Q).length > 0 && (
|
|
2329
|
-
const l =
|
|
2330
|
-
Object.keys(l).length > 0 && (
|
|
2342
|
+
const G = { section: X, blocks: K };
|
|
2343
|
+
Object.keys(Q).length > 0 && (G.footnotes = Q);
|
|
2344
|
+
const l = Dn(I.sdts);
|
|
2345
|
+
Object.keys(l).length > 0 && (G.sdts = l);
|
|
2331
2346
|
const m = N.lists();
|
|
2332
|
-
Object.keys(m).length > 0 && (
|
|
2333
|
-
const
|
|
2334
|
-
Object.keys(
|
|
2335
|
-
const C =
|
|
2336
|
-
C && (
|
|
2337
|
-
const y =
|
|
2338
|
-
y && (
|
|
2339
|
-
const
|
|
2340
|
-
return
|
|
2341
|
-
doc:
|
|
2347
|
+
Object.keys(m).length > 0 && (G.lists = m);
|
|
2348
|
+
const F = N.bookmarks();
|
|
2349
|
+
Object.keys(F).length > 0 && (G.bookmarks = F);
|
|
2350
|
+
const C = Hn(p);
|
|
2351
|
+
C && (G.stylesheet = C);
|
|
2352
|
+
const y = zn(p);
|
|
2353
|
+
y && (G.tableStyles = y);
|
|
2354
|
+
const M = N.tocField();
|
|
2355
|
+
return M && (G.tocInstruction = M.instruction, Dt(G) === 0 && (G.tocAnchorBlockId = M.blockId)), I.fields && (G.fields = I.fields), {
|
|
2356
|
+
doc: G,
|
|
2342
2357
|
warnings: r.list,
|
|
2343
2358
|
mediaUrls: Z.flatMap((R) => R.urls()),
|
|
2344
2359
|
media: i
|
|
2345
2360
|
};
|
|
2346
2361
|
}
|
|
2347
|
-
function
|
|
2362
|
+
function xo(e, n, t, o, r, i, a) {
|
|
2348
2363
|
if (!t) return;
|
|
2349
2364
|
const s = n.get(t), d = s && !s.external ? e.text(s.target) : void 0;
|
|
2350
2365
|
if (s === void 0 || d === void 0) {
|
|
2351
2366
|
i.add("header-missing", "A referenced header/footer part was missing from the archive.");
|
|
2352
2367
|
return;
|
|
2353
2368
|
}
|
|
2354
|
-
const u = We(e, s.target), f =
|
|
2369
|
+
const u = We(e, s.target), f = on(d, s.target, i, a), c = o.mapBlocks(f, r(u), Xe(u));
|
|
2355
2370
|
return c.length > 0 ? c : void 0;
|
|
2356
2371
|
}
|
|
2357
2372
|
function ft(e, n, t, o, r, i, a, s, d, u, f) {
|
|
2358
2373
|
if (!t) return;
|
|
2359
2374
|
const c = (g) => `${n}${g}`, p = (g, T) => {
|
|
2360
|
-
const S =
|
|
2375
|
+
const S = xo(i, a, T, s, d, u, f);
|
|
2361
2376
|
S && (e[g] = S);
|
|
2362
2377
|
};
|
|
2363
2378
|
p(c(""), t.default), o && p(c("First"), t.first), r && p(c("Even"), t.even);
|
|
2364
2379
|
}
|
|
2365
|
-
function
|
|
2380
|
+
function Io(e) {
|
|
2366
2381
|
const n = de(ue(e, "settings.xml"), "w:settings");
|
|
2367
2382
|
return !!n && !!h(n, "w:evenAndOddHeadersAndFooters");
|
|
2368
2383
|
}
|
|
2369
2384
|
function We(e, n) {
|
|
2370
|
-
const t = e.text(
|
|
2371
|
-
return t !== void 0 ?
|
|
2385
|
+
const t = e.text(Vn(n));
|
|
2386
|
+
return t !== void 0 ? Wn(t, n) : /* @__PURE__ */ new Map();
|
|
2372
2387
|
}
|
|
2373
2388
|
function Xe(e) {
|
|
2374
2389
|
return (n) => {
|
|
@@ -2376,11 +2391,11 @@ function Xe(e) {
|
|
|
2376
2391
|
return t?.external ? t.target : void 0;
|
|
2377
2392
|
};
|
|
2378
2393
|
}
|
|
2379
|
-
function
|
|
2394
|
+
function Fe(e, n, t) {
|
|
2380
2395
|
const o = Tt(n, t);
|
|
2381
2396
|
return o && !o.external ? e.text(o.target) : void 0;
|
|
2382
2397
|
}
|
|
2383
|
-
function
|
|
2398
|
+
function Co(e, n) {
|
|
2384
2399
|
const t = Tt(e, n);
|
|
2385
2400
|
return t && !t.external ? t.target : void 0;
|
|
2386
2401
|
}
|
|
@@ -2388,7 +2403,7 @@ const Ae = self;
|
|
|
2388
2403
|
Ae.onmessage = (e) => {
|
|
2389
2404
|
const { id: n, buf: t } = e.data;
|
|
2390
2405
|
try {
|
|
2391
|
-
const o =
|
|
2406
|
+
const o = So(new Uint8Array(t), (r, i) => {
|
|
2392
2407
|
Ae.postMessage({ id: n, type: "progress", phase: r, pct: i });
|
|
2393
2408
|
});
|
|
2394
2409
|
Ae.postMessage({ id: n, type: "done", result: o });
|