@forevka/wordcanvas 0.8.1 → 0.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist-lib/assets/{worker-BFAbWoje.js → worker-VdvO3cMW.js} +1198 -1182
- package/dist-lib/builder.js +5 -5
- package/dist-lib/{editorApp-CQn18PAu.js → editorApp-BGyP48-P.js} +37 -36
- package/dist-lib/{recalcToc-Dzz8cQho.js → engine-Chvebzwr.js} +525 -548
- package/dist-lib/export.js +8 -7
- package/dist-lib/generate-toc.js +7 -6
- package/dist-lib/import.js +2 -2
- package/dist-lib/{lists-DpmgbDyt.js → lists-BVCy5dMa.js} +2 -2
- package/dist-lib/{parse-CIuWi88O.js → parse-PD2rg4oO.js} +28 -28
- package/dist-lib/{pipeline-DQil8qUX.js → pipeline-r7GVSMFb.js} +60 -60
- package/dist-lib/query.js +977 -0
- package/dist-lib/recalc-docx.js +22 -21
- package/dist-lib/recalcToc-CAeOzLr3.js +37 -0
- package/dist-lib/{stylesheet-BeM16Mvj.js → stylesheet-IH4Hyc8o.js} +3 -3
- package/dist-lib/{toc-C-JErW1U.js → toc-B-TzD-Mr.js} +102 -86
- package/dist-lib/{webmcp-B9Q6w0Vl.js → webmcp-CDpzmTtU.js} +2 -2
- package/dist-lib/{wordcanvas-Cla5Ys8Y.js → wordcanvas-CIqBAV2w.js} +3 -3
- package/dist-lib/wordcanvas.js +1 -1
- package/dist-node/{chunk-JVSPB6WM.js → chunk-A53KB3BE.js} +2 -2
- package/dist-node/{chunk-HMBQQDXD.js → chunk-TLGEFCLV.js} +64 -1
- package/dist-node/chunk-TLGEFCLV.js.map +7 -0
- package/dist-node/{chunk-KZHUXFDE.js → chunk-VNDCELYX.js} +5 -45
- package/dist-node/chunk-VNDCELYX.js.map +7 -0
- package/dist-node/{engine-46GL2RKU.js → engine-QKH45ZHY.js} +5 -4
- package/dist-node/export.js +3 -3
- package/dist-node/generate-toc.js +3 -3
- package/dist-node/import.js +2 -2
- package/dist-node/recalc-docx.js +2 -2
- package/package.json +6 -2
- package/types/builder.d.ts +47 -2
- package/types/model.d.ts +34 -0
- package/types/query.d.ts +416 -0
- package/dist-node/chunk-HMBQQDXD.js.map +0 -7
- package/dist-node/chunk-KZHUXFDE.js.map +0 -7
- /package/dist-node/{chunk-JVSPB6WM.js.map → chunk-A53KB3BE.js.map} +0 -0
- /package/dist-node/{engine-46GL2RKU.js.map → engine-QKH45ZHY.js.map} +0 -0
package/dist-lib/export.js
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import { B as $e } from "./index-6mKfgpcs.js";
|
|
2
2
|
import { c as Rt, g as kr, a as Jl, $ as Ql, b as Ba, r as Nf, d as jf, i as Uf, e as Ma, s as ec } from "./measureHost-CEPC_Lpi.js";
|
|
3
3
|
import { _ as tc, f as nt } from "./__vite-browser-external-BYRIRx8p.js";
|
|
4
|
-
import { D as rc, d as nc, t as ic, p as ac, i as oc } from "./toc-
|
|
4
|
+
import { D as rc, d as nc, t as ic, p as ac, i as oc } from "./toc-B-TzD-Mr.js";
|
|
5
5
|
import { p as La, b as sc, n as Da, T as Na, a as fc, c as ja, l as lc, d as cc, I as uc, D as hc, r as Ua, e as ta, U as za, s as qa, f as dc, S as pc, w as gc, g as xc, h as yc, i as mc, M as bc, u as wc, j as vc, k as _c, m as Sc, o as Rr, q as zf, t as Ec, C as Ac, F as Tc, v as Pc, x as qf, H as Rc, A as Cc, y as Oc } from "./paintStyle-OSXohdGT.js";
|
|
6
6
|
import { s as Fc, z as Ic } from "./browser-BUrsjziD.js";
|
|
7
7
|
import { h as Wt, p as Je, r as Br, a as ua, b as kc, c as dr, d as $f, e as Bc, t as Mc } from "./styleProps-OePkgWnD.js";
|
|
8
8
|
import { e as $, X as vt, a as Wf, W as Ht, t as Hf } from "./xmlWrite-DxSDwuaP.js";
|
|
9
|
-
import { a as Lc } from "./stylesheet-
|
|
10
|
-
import {
|
|
9
|
+
import { a as Lc } from "./stylesheet-IH4Hyc8o.js";
|
|
10
|
+
import { c as Dc } from "./engine-Chvebzwr.js";
|
|
11
|
+
import { p as Nc } from "./recalcToc-CAeOzLr3.js";
|
|
11
12
|
var pr = { exports: {} }, $a;
|
|
12
13
|
function ha() {
|
|
13
14
|
if ($a) return pr.exports;
|
|
@@ -14094,7 +14095,7 @@ async function Xd(e, t = {}) {
|
|
|
14094
14095
|
}
|
|
14095
14096
|
async function Vd(e, t, n) {
|
|
14096
14097
|
await Uf();
|
|
14097
|
-
const { createLayoutEngine: r } = await import("./
|
|
14098
|
+
const { createLayoutEngine: r } = await import("./engine-Chvebzwr.js").then((x) => x.a), i = r(n, t.cjk).layout(e), a = new zl(), o = t.images ?? {}, s = new Wr({ autoFirstPage: !1, compress: !0, font: !1 }), f = Yd(s), d = /* @__PURE__ */ new Set(), p = (x, m, A) => {
|
|
14098
14099
|
const O = Ma(x, m, A);
|
|
14099
14100
|
return d.has(O.file) || (s.registerFont(O.file, ea(O.bytes)), d.add(O.file), O.substituted && a.warn("font-substituted", x)), O.file;
|
|
14100
14101
|
}, h = /* @__PURE__ */ new Set();
|
|
@@ -14998,7 +14999,7 @@ function Op(e) {
|
|
|
14998
14999
|
);
|
|
14999
15000
|
return t(e.blocks);
|
|
15000
15001
|
}
|
|
15001
|
-
async function
|
|
15002
|
+
async function Gp(e, t, n = {}, r, i) {
|
|
15002
15003
|
const a = {
|
|
15003
15004
|
cjkFallback: i?.fallbackFont ?? Oc,
|
|
15004
15005
|
arabicFallback: i?.arabicFallbackFont ?? Cc,
|
|
@@ -15014,12 +15015,12 @@ async function Fp(e, t, n, r, i) {
|
|
|
15014
15015
|
const a = zf();
|
|
15015
15016
|
i && a.register(i.defs), Rr(a), i && Nf(i.faces);
|
|
15016
15017
|
try {
|
|
15017
|
-
const o = Dc(
|
|
15018
|
+
const o = Nc(Dc(a, r).layout(e));
|
|
15018
15019
|
return await Df(e, n, o);
|
|
15019
15020
|
} finally {
|
|
15020
15021
|
jf(a), Rr(qf());
|
|
15021
15022
|
}
|
|
15022
15023
|
}
|
|
15023
15024
|
export {
|
|
15024
|
-
|
|
15025
|
+
Gp as runExport
|
|
15025
15026
|
};
|
package/dist-lib/generate-toc.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { u as G, a as C, s as R, z as M } from "./browser-BUrsjziD.js";
|
|
2
|
-
import { p as H, d as K, t as q, i as J,
|
|
2
|
+
import { p as H, d as K, t as q, i as J, m as Q } from "./toc-B-TzD-Mr.js";
|
|
3
3
|
import { f as V } from "./contentTypes-BwUSSoXc.js";
|
|
4
|
-
import { r as N } from "./pipeline-
|
|
5
|
-
import {
|
|
4
|
+
import { r as N } from "./pipeline-r7GVSMFb.js";
|
|
5
|
+
import { c as Y } from "./engine-Chvebzwr.js";
|
|
6
|
+
import { p as Z } from "./recalcToc-CAeOzLr3.js";
|
|
6
7
|
import { r as tt, b as et } from "./styleProps-OePkgWnD.js";
|
|
7
8
|
import { e as d, t as T, a as nt } from "./xmlWrite-DxSDwuaP.js";
|
|
8
9
|
const b = (t) => d("w:r", void 0, d("w:fldChar", { "w:fldCharType": t })), j = (t) => d("w:r", void 0, d("w:instrText", { "xml:space": "preserve" }, nt(t)));
|
|
@@ -69,7 +70,7 @@ function it(t, a, s) {
|
|
|
69
70
|
}
|
|
70
71
|
return n;
|
|
71
72
|
}
|
|
72
|
-
function
|
|
73
|
+
function ht(t, a = {}) {
|
|
73
74
|
const s = G(t), n = s["[Content_Types].xml"], l = (n ? V(C(n)) : void 0) ?? "word/document.xml", i = s[l];
|
|
74
75
|
if (!i) return { bytes: t, generated: 0, headings: 0, bookmarksSynthesized: 0 };
|
|
75
76
|
const c = C(i), o = ot(c);
|
|
@@ -95,7 +96,7 @@ function gt(t, a = {}) {
|
|
|
95
96
|
last: f === e.length - 1,
|
|
96
97
|
hyperlink: y,
|
|
97
98
|
...p.separator !== void 0 ? { separator: p.separator } : {}
|
|
98
|
-
})).join(""), P = (e) => at(c, [{ start: o.pStart, end: o.pEnd, text: D(e) }, ...W]), A = P(w), B = { ...s, [l]: R(A) }, U = M(B), E = N(U).doc, $ = Y(
|
|
99
|
+
})).join(""), P = (e) => at(c, [{ start: o.pStart, end: o.pEnd, text: D(e) }, ...W]), A = P(w), B = { ...s, [l]: R(A) }, U = M(B), E = N(U).doc, $ = Z(Y().layout(E)), O = /* @__PURE__ */ new Map();
|
|
99
100
|
for (const [e, m] of Object.entries(E.bookmarks ?? {})) O.set(e, m.start.blockId);
|
|
100
101
|
for (const e of w) {
|
|
101
102
|
if (!e.numText || !e.anchor) continue;
|
|
@@ -110,5 +111,5 @@ function gt(t, a = {}) {
|
|
|
110
111
|
};
|
|
111
112
|
}
|
|
112
113
|
export {
|
|
113
|
-
|
|
114
|
+
ht as generateTocInDocx
|
|
114
115
|
};
|
package/dist-lib/import.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { d as m, g as f, h as g, l as y, t as x } from "./pipeline-
|
|
1
|
+
import { k as V, a0 as H, D as W, a as $ } from "./toc-B-TzD-Mr.js";
|
|
2
|
+
import { r as C, s as G } from "./stylesheet-IH4Hyc8o.js";
|
|
3
|
+
import { d as m, g as f, h as g, l as y, t as x } from "./pipeline-r7GVSMFb.js";
|
|
4
4
|
import { a as U, l as j } from "./contentTypes-BwUSSoXc.js";
|
|
5
5
|
function K(r) {
|
|
6
6
|
const t = V(r), e = r.rows.length, s = Array.from(
|
|
@@ -78,7 +78,7 @@ function St(r, t, e, s, n) {
|
|
|
78
78
|
}
|
|
79
79
|
return o;
|
|
80
80
|
}
|
|
81
|
-
function
|
|
81
|
+
function X(r, t) {
|
|
82
82
|
const e = [];
|
|
83
83
|
for (let s = 0; s < r.rows; s++) {
|
|
84
84
|
const n = [];
|
|
@@ -91,7 +91,7 @@ function Z(r, t) {
|
|
|
91
91
|
return e;
|
|
92
92
|
}
|
|
93
93
|
const k = (r, t, e) => Math.max(t, Math.min(e, r));
|
|
94
|
-
function
|
|
94
|
+
function Y(r, t) {
|
|
95
95
|
const e = [], s = /* @__PURE__ */ new Set();
|
|
96
96
|
for (let i = r[t]; i && !s.has(i.id); i = i.basedOn ? r[i.basedOn] : void 0)
|
|
97
97
|
s.add(i.id), e.unshift(i);
|
|
@@ -107,7 +107,7 @@ function P(r, t) {
|
|
|
107
107
|
const e = { ...r };
|
|
108
108
|
return t.char && (e.char = { ...r.char, ...t.char }), t.para && (e.para = { ...r.para, ...t.para }), t.shading !== void 0 && (e.shading = t.shading), t.borders && (e.borders = { ...r.borders, ...t.borders }), t.margin && (e.margin = t.margin), e;
|
|
109
109
|
}
|
|
110
|
-
const
|
|
110
|
+
const Z = [
|
|
111
111
|
"wholeTable",
|
|
112
112
|
"band1Horz",
|
|
113
113
|
"band2Horz",
|
|
@@ -122,7 +122,7 @@ const Y = [
|
|
|
122
122
|
"swCell",
|
|
123
123
|
"seCell"
|
|
124
124
|
];
|
|
125
|
-
function
|
|
125
|
+
function J(r, t, e) {
|
|
126
126
|
const s = (i) => {
|
|
127
127
|
switch (i) {
|
|
128
128
|
case "wholeTable":
|
|
@@ -154,11 +154,11 @@ function Q(r, t, e) {
|
|
|
154
154
|
}
|
|
155
155
|
};
|
|
156
156
|
let n = {};
|
|
157
|
-
for (const i of
|
|
157
|
+
for (const i of Z)
|
|
158
158
|
s(i) && r[i] && (n = P(n, r[i]));
|
|
159
159
|
return n;
|
|
160
160
|
}
|
|
161
|
-
function
|
|
161
|
+
function Q(r, t, e, s, n) {
|
|
162
162
|
const i = {}, o = n.firstRow && r === 0, a = n.lastRow && r === e - 1, u = n.firstCol && t === 0, c = n.lastCol && t === s - 1;
|
|
163
163
|
if (o && (i.firstRow = !0), a && (i.lastRow = !0), u && (i.firstCol = !0), c && (i.lastCol = !0), n.bandRows && !o && !a) {
|
|
164
164
|
const l = n.firstRow ? 1 : 0, h = Math.floor((r - l) / Math.max(1, n.rowBandSize ?? 1));
|
|
@@ -171,25 +171,25 @@ function J(r, t, e, s, n) {
|
|
|
171
171
|
return i;
|
|
172
172
|
}
|
|
173
173
|
const Et = { firstRow: !0, bandRows: !0 };
|
|
174
|
-
function
|
|
174
|
+
function _(r, t, e, s) {
|
|
175
175
|
const n = r, i = e, o = { ...n };
|
|
176
176
|
for (const [a, u] of Object.entries(t))
|
|
177
177
|
s?.has(a) || u !== void 0 && (n[a] === void 0 || n[a] === i[a]) && (o[a] = u);
|
|
178
178
|
return o;
|
|
179
179
|
}
|
|
180
180
|
function At(r, t, e, s, n) {
|
|
181
|
-
const i =
|
|
182
|
-
return
|
|
183
|
-
const c =
|
|
181
|
+
const i = Y(e, t.id), o = K(r);
|
|
182
|
+
return X(o, (a, u) => {
|
|
183
|
+
const c = Q(u.originRow, u.originCol, o.rows, o.cols, {
|
|
184
184
|
...s,
|
|
185
185
|
rowBandSize: t.rowBandSize ?? 1,
|
|
186
186
|
colBandSize: t.colBandSize ?? 1
|
|
187
|
-
}), l =
|
|
187
|
+
}), l = J(i, c), h = { ...a };
|
|
188
188
|
return l.shading !== void 0 ? h.shading = l.shading : delete h.shading, l.borders && Object.keys(l.borders).length > 0 ? h.borders = l.borders : delete h.borders, l.margin ? h.margin = l.margin : delete h.margin, n && (l.char || l.para) && (h.blocks = h.blocks.map(
|
|
189
189
|
(d) => d.kind === "paragraph" ? {
|
|
190
190
|
...d,
|
|
191
|
-
style: l.para ?
|
|
192
|
-
runs: l.char ? d.runs.map((w) => ({ ...w, style:
|
|
191
|
+
style: l.para ? _(d.style, l.para, n.para, n.explicitPara?.get(d)) : d.style,
|
|
192
|
+
runs: l.char ? d.runs.map((w) => ({ ...w, style: _(w.style, l.char, n.char, n.explicitChar?.get(w)) })) : d.runs
|
|
193
193
|
} : d
|
|
194
194
|
)), h;
|
|
195
195
|
});
|
|
@@ -228,7 +228,7 @@ function Tt(r, t) {
|
|
|
228
228
|
style: { ...T, ...e.para }
|
|
229
229
|
};
|
|
230
230
|
}
|
|
231
|
-
class
|
|
231
|
+
class Nt {
|
|
232
232
|
ids;
|
|
233
233
|
doc;
|
|
234
234
|
warnings = [];
|
|
@@ -762,7 +762,7 @@ class ct {
|
|
|
762
762
|
* tokenizer already captured the brace group as one `rawtext` token; fall back
|
|
763
763
|
* to a math atom flattened to text if it wasn't (e.g. `\text x`). */
|
|
764
764
|
rawTextArg() {
|
|
765
|
-
return this.peek()?.k === "rawtext" ? this.next().v :
|
|
765
|
+
return this.peek()?.k === "rawtext" ? this.next().v : N(this.arg());
|
|
766
766
|
}
|
|
767
767
|
/** Consume an optional `[...]` argument; returns null if absent. */
|
|
768
768
|
optArg() {
|
|
@@ -861,7 +861,7 @@ class ct {
|
|
|
861
861
|
}
|
|
862
862
|
/** \begin{env} … \end{env} — matrices and cases. */
|
|
863
863
|
environment() {
|
|
864
|
-
const t =
|
|
864
|
+
const t = N(this.arg()), e = rt[t] ?? ["", ""], s = [];
|
|
865
865
|
let n = [], i = [];
|
|
866
866
|
const o = () => {
|
|
867
867
|
n.push(this.row(i)), i = [];
|
|
@@ -911,7 +911,7 @@ function pt(r) {
|
|
|
911
911
|
function I(r, t) {
|
|
912
912
|
return r.type === "ident" ? { ...r, variant: t } : r.type === "number" ? { ...r, variant: t } : r.type === "row" ? { ...r, children: r.children.map((e) => I(e, t)) } : r;
|
|
913
913
|
}
|
|
914
|
-
function
|
|
914
|
+
function N(r) {
|
|
915
915
|
switch (r.type) {
|
|
916
916
|
case "ident":
|
|
917
917
|
case "number":
|
|
@@ -919,12 +919,12 @@ function _(r) {
|
|
|
919
919
|
case "text":
|
|
920
920
|
return r.text;
|
|
921
921
|
case "row":
|
|
922
|
-
return r.children.map(
|
|
922
|
+
return r.children.map(N).join("");
|
|
923
923
|
default:
|
|
924
924
|
return "";
|
|
925
925
|
}
|
|
926
926
|
}
|
|
927
|
-
function
|
|
927
|
+
function _t(r) {
|
|
928
928
|
return { type: "row", children: new ct(at(r)).parseList() };
|
|
929
929
|
}
|
|
930
930
|
const M = /* @__PURE__ */ new Set([
|
|
@@ -1065,7 +1065,7 @@ function wt(r) {
|
|
|
1065
1065
|
}
|
|
1066
1066
|
export {
|
|
1067
1067
|
z as A,
|
|
1068
|
-
|
|
1068
|
+
Nt as B,
|
|
1069
1069
|
Et as D,
|
|
1070
1070
|
L as G,
|
|
1071
1071
|
E as O,
|
|
@@ -1073,16 +1073,16 @@ export {
|
|
|
1073
1073
|
K as a,
|
|
1074
1074
|
At as b,
|
|
1075
1075
|
vt as c,
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1076
|
+
Y as d,
|
|
1077
|
+
J as e,
|
|
1078
|
+
Q as f,
|
|
1079
1079
|
Ct as g,
|
|
1080
1080
|
q as h,
|
|
1081
1081
|
Tt as i,
|
|
1082
|
-
|
|
1082
|
+
_t as l,
|
|
1083
1083
|
Rt as m,
|
|
1084
1084
|
kt as n,
|
|
1085
1085
|
Ot as p,
|
|
1086
|
-
|
|
1086
|
+
X as r,
|
|
1087
1087
|
St as u
|
|
1088
1088
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { t as
|
|
2
|
-
import { l as Oe, e as l, b as m, n as v, v as et, o as
|
|
1
|
+
import { t as Jt, O as Ce, a1 as Le } from "./toc-B-TzD-Mr.js";
|
|
2
|
+
import { l as Oe, e as l, b as m, n as v, v as et, o as K, c as rt, r as wt, p as vt, I as It, d as dt, g as xt, t as Pt, f as He, W as De } from "./contentTypes-BwUSSoXc.js";
|
|
3
3
|
import { u as Zt, a as We } from "./browser-BUrsjziD.js";
|
|
4
4
|
function ve() {
|
|
5
5
|
return { type: "row", children: [] };
|
|
@@ -188,7 +188,7 @@ function oe(t) {
|
|
|
188
188
|
function ie(t) {
|
|
189
189
|
return t.match(/\\@\s*"([^"]*)"/)?.[1] ?? t.match(/\\@\s*(\S+)/)?.[1];
|
|
190
190
|
}
|
|
191
|
-
function
|
|
191
|
+
function Ke(t, e) {
|
|
192
192
|
switch (t.name) {
|
|
193
193
|
case "PAGE": {
|
|
194
194
|
const n = oe(t.raw);
|
|
@@ -228,7 +228,7 @@ function Co(t) {
|
|
|
228
228
|
case "TIME":
|
|
229
229
|
return ` TIME \\@ "${t.format}" `;
|
|
230
230
|
case "IF":
|
|
231
|
-
return ` IF ${t.operandA} ${t.op} ${t.operandB} "${
|
|
231
|
+
return ` IF ${t.operandA} ${t.op} ${t.operandB} "${Jt(t.trueRuns)}" "${Jt(t.falseRuns)}" `;
|
|
232
232
|
}
|
|
233
233
|
}
|
|
234
234
|
const kt = (t) => {
|
|
@@ -250,7 +250,7 @@ const kt = (t) => {
|
|
|
250
250
|
if (!n) return !1;
|
|
251
251
|
const o = jt(n, "m:val") ?? jt(n, "w:val");
|
|
252
252
|
return o === void 0 || !["0", "false", "off"].includes(o);
|
|
253
|
-
}, H = (t) => t / 15, Ut = (t) => t * 2 / 3, Ft = (t) => t / 9525,
|
|
253
|
+
}, H = (t) => t / 15, Ut = (t) => t * 2 / 3, Ft = (t) => t / 9525, Je = (t) => t / 240, P = (t) => Math.round(t * 100) / 100, Bt = (t) => Math.round(t * 1e4) / 1e4, Nt = (t) => ({
|
|
254
254
|
top: P(H(t.top)),
|
|
255
255
|
right: P(H(t.right)),
|
|
256
256
|
bottom: P(H(t.bottom)),
|
|
@@ -354,11 +354,11 @@ function sn(t) {
|
|
|
354
354
|
function yt(t) {
|
|
355
355
|
const e = {}, n = et(t, "w:rStyle");
|
|
356
356
|
n && (e.styleId = n);
|
|
357
|
-
const o =
|
|
357
|
+
const o = K(l(t, "w:b"));
|
|
358
358
|
o !== void 0 && (e.bold = o);
|
|
359
|
-
const i =
|
|
359
|
+
const i = K(l(t, "w:i"));
|
|
360
360
|
i !== void 0 && (e.italic = i);
|
|
361
|
-
const s =
|
|
361
|
+
const s = K(l(t, "w:strike"));
|
|
362
362
|
s !== void 0 && (e.strikethrough = s);
|
|
363
363
|
const a = l(t, "w:u");
|
|
364
364
|
if (a) {
|
|
@@ -407,15 +407,15 @@ function yt(t) {
|
|
|
407
407
|
f && f !== "none" && (e.highlight = f);
|
|
408
408
|
const u = et(t, "w:vertAlign");
|
|
409
409
|
u && (e.vertAlign = u);
|
|
410
|
-
const g =
|
|
410
|
+
const g = K(l(t, "w:vanish"));
|
|
411
411
|
g !== void 0 && (e.vanish = g);
|
|
412
|
-
const y =
|
|
412
|
+
const y = K(l(t, "w:caps"));
|
|
413
413
|
y !== void 0 && (e.caps = y);
|
|
414
|
-
const I =
|
|
414
|
+
const I = K(l(t, "w:smallCaps"));
|
|
415
415
|
I !== void 0 && (e.smallCaps = I);
|
|
416
|
-
const S =
|
|
416
|
+
const S = K(l(t, "w:rtl"));
|
|
417
417
|
S !== void 0 && (e.rtl = S);
|
|
418
|
-
const L =
|
|
418
|
+
const L = K(l(t, "w:dstrike"));
|
|
419
419
|
L !== void 0 && (e.doubleStrikethrough = L);
|
|
420
420
|
const O = v(l(t, "w:position"), "w:val");
|
|
421
421
|
O !== void 0 && (e.positionHalfPoints = O);
|
|
@@ -431,13 +431,13 @@ function yt(t) {
|
|
|
431
431
|
}
|
|
432
432
|
const $ = et(t, "w:em");
|
|
433
433
|
$ && $ !== "none" && (e.emphasisMark = $);
|
|
434
|
-
const ft =
|
|
434
|
+
const ft = K(l(t, "w:outline"));
|
|
435
435
|
ft !== void 0 && (e.outline = ft);
|
|
436
|
-
const
|
|
437
|
-
|
|
438
|
-
const Z =
|
|
436
|
+
const J = K(l(t, "w:shadow"));
|
|
437
|
+
J !== void 0 && (e.shadow = J);
|
|
438
|
+
const Z = K(l(t, "w:emboss"));
|
|
439
439
|
Z !== void 0 && (e.emboss = Z);
|
|
440
|
-
const R =
|
|
440
|
+
const R = K(l(t, "w:imprint"));
|
|
441
441
|
R !== void 0 && (e.imprint = R);
|
|
442
442
|
const V = l(t, "w:bdr");
|
|
443
443
|
if (V) {
|
|
@@ -470,7 +470,7 @@ function Ht(t, e) {
|
|
|
470
470
|
const V = v(a, "w:after");
|
|
471
471
|
V !== void 0 && (n.spaceAfterTwips = V);
|
|
472
472
|
const X = v(a, "w:line"), C = m(a, "w:lineRule") ?? "auto";
|
|
473
|
-
X !== void 0 && (C === "exact" || C === "atLeast" && X > 0 ? (n.lineRule = C, n.lineExactTwips = X) : C === "auto" && (n.lineRule = "auto", n.lineHeight =
|
|
473
|
+
X !== void 0 && (C === "exact" || C === "atLeast" && X > 0 ? (n.lineRule = C, n.lineExactTwips = X) : C === "auto" && (n.lineRule = "auto", n.lineHeight = Je(X)));
|
|
474
474
|
}
|
|
475
475
|
const r = l(t, "w:ind");
|
|
476
476
|
if (r) {
|
|
@@ -481,13 +481,13 @@ function Ht(t, e) {
|
|
|
481
481
|
const X = v(r, "w:firstLine"), C = v(r, "w:hanging");
|
|
482
482
|
X !== void 0 ? n.indentFirstLineTwips = X : C !== void 0 && (n.indentFirstLineTwips = -C);
|
|
483
483
|
}
|
|
484
|
-
const d =
|
|
484
|
+
const d = K(l(t, "w:keepNext"));
|
|
485
485
|
d !== void 0 && (n.keepWithNext = d);
|
|
486
|
-
const p =
|
|
486
|
+
const p = K(l(t, "w:keepLines"));
|
|
487
487
|
p !== void 0 && (n.keepLinesTogether = p);
|
|
488
|
-
const h =
|
|
488
|
+
const h = K(l(t, "w:contextualSpacing"));
|
|
489
489
|
h !== void 0 && (n.contextualSpacing = h);
|
|
490
|
-
const f =
|
|
490
|
+
const f = K(l(t, "w:bidi"));
|
|
491
491
|
f !== void 0 && (n.direction = f ? "rtl" : "ltr");
|
|
492
492
|
const u = l(t, "w:tabs");
|
|
493
493
|
if (u) {
|
|
@@ -502,7 +502,7 @@ function Ht(t, e) {
|
|
|
502
502
|
}
|
|
503
503
|
R.length > 0 && (n.tabStops = R);
|
|
504
504
|
}
|
|
505
|
-
const g =
|
|
505
|
+
const g = K(l(t, "w:pageBreakBefore"));
|
|
506
506
|
g !== void 0 && (n.pageBreakBefore = g);
|
|
507
507
|
const y = et(t, "w:outlineLvl");
|
|
508
508
|
if (y !== void 0) {
|
|
@@ -528,18 +528,18 @@ function Ht(t, e) {
|
|
|
528
528
|
}
|
|
529
529
|
const L = Rt(l(t, "w:shd"));
|
|
530
530
|
L !== void 0 && (n.shd = L);
|
|
531
|
-
const O =
|
|
531
|
+
const O = K(l(t, "w:widowControl"));
|
|
532
532
|
O !== void 0 && (n.widowControl = O);
|
|
533
|
-
const M =
|
|
533
|
+
const M = K(l(t, "w:suppressLineNumbers"));
|
|
534
534
|
M !== void 0 && (n.suppressLineNumbers = M);
|
|
535
535
|
const tt = et(t, "w:textAlignment");
|
|
536
536
|
(tt === "top" || tt === "center" || tt === "bottom" || tt === "baseline") && (n.textAlignment = tt);
|
|
537
|
-
const $ =
|
|
537
|
+
const $ = K(l(t, "w:mirrorIndents"));
|
|
538
538
|
$ !== void 0 && (n.mirrorIndents = $);
|
|
539
|
-
const ft =
|
|
539
|
+
const ft = K(l(t, "w:adjustRightInd"));
|
|
540
540
|
ft !== void 0 && (n.adjustRightInd = ft);
|
|
541
|
-
const
|
|
542
|
-
|
|
541
|
+
const J = l(t, "w:rPr");
|
|
542
|
+
J && (n.markRunProps = yt(J));
|
|
543
543
|
const Z = l(t, "w:sectPr");
|
|
544
544
|
if (Z) {
|
|
545
545
|
const R = et(Z, "w:type");
|
|
@@ -1036,7 +1036,7 @@ function xn(t, e, n, o, i) {
|
|
|
1036
1036
|
if (o.trackFields) {
|
|
1037
1037
|
const r = qt(i.instr);
|
|
1038
1038
|
if (vn.has(r.name)) {
|
|
1039
|
-
const d =
|
|
1039
|
+
const d = Ke(r, yn);
|
|
1040
1040
|
if (d) {
|
|
1041
1041
|
const p = `field${s.next.n++}`;
|
|
1042
1042
|
s.registry[p] = { id: p, instruction: i.instr, name: r.name, kind: "builtin", spec: d }, d.type === "PAGE" || d.type === "NUMPAGES" ? (n.push({ kind: "run", text: Tn(d), props: e, fieldId: p }), i.suppressResult = !0) : i.resultFieldId = p;
|
|
@@ -1150,7 +1150,7 @@ function Cn(t) {
|
|
|
1150
1150
|
const o = v(n, "w:val"), i = m(n, "w:hRule");
|
|
1151
1151
|
o !== void 0 && o > 0 && (i === "atLeast" || i === "exact") && (e.heightTwips = o, e.heightRule = i);
|
|
1152
1152
|
}
|
|
1153
|
-
return
|
|
1153
|
+
return K(l(t, "w:cantSplit")) && (e.cantSplit = !0), K(l(t, "w:tblHeader")) && (e.tblHeader = !0), Object.keys(e).length > 0 ? e : void 0;
|
|
1154
1154
|
}
|
|
1155
1155
|
function Ln(t, e) {
|
|
1156
1156
|
const n = [];
|
|
@@ -1172,17 +1172,17 @@ function Ln(t, e) {
|
|
|
1172
1172
|
a && (o.styleId = a);
|
|
1173
1173
|
const r = l(s, "w:tblLook");
|
|
1174
1174
|
if (r) {
|
|
1175
|
-
const
|
|
1175
|
+
const J = (Z) => {
|
|
1176
1176
|
const R = m(r, Z);
|
|
1177
1177
|
return R === "1" || R === "true";
|
|
1178
1178
|
};
|
|
1179
1179
|
o.look = {
|
|
1180
|
-
firstRow:
|
|
1181
|
-
lastRow:
|
|
1182
|
-
firstCol:
|
|
1183
|
-
lastCol:
|
|
1184
|
-
bandRows: !
|
|
1185
|
-
bandCols: !
|
|
1180
|
+
firstRow: J("w:firstRow"),
|
|
1181
|
+
lastRow: J("w:lastRow"),
|
|
1182
|
+
firstCol: J("w:firstColumn"),
|
|
1183
|
+
lastCol: J("w:lastColumn"),
|
|
1184
|
+
bandRows: !J("w:noHBand"),
|
|
1185
|
+
bandCols: !J("w:noVBand")
|
|
1186
1186
|
};
|
|
1187
1187
|
}
|
|
1188
1188
|
l(s, "w:tblBorders") && (o.bordersSpecified = !0);
|
|
@@ -1198,10 +1198,10 @@ function Ln(t, e) {
|
|
|
1198
1198
|
O === "center" ? o.align = "center" : (O === "right" || O === "end") && (o.align = "right");
|
|
1199
1199
|
const M = l(s, "w:tblInd");
|
|
1200
1200
|
if (M) {
|
|
1201
|
-
const
|
|
1202
|
-
Z !== void 0 && Z !== 0 && (
|
|
1201
|
+
const J = m(M, "w:type"), Z = v(M, "w:w");
|
|
1202
|
+
Z !== void 0 && Z !== 0 && (J === "dxa" || J === void 0) && (o.indentTwips = Z);
|
|
1203
1203
|
}
|
|
1204
|
-
|
|
1204
|
+
K(l(s, "w:bidiVisual")) && (o.bidiVisual = !0);
|
|
1205
1205
|
const tt = et(s, "w:tblOverlap");
|
|
1206
1206
|
tt === "never" ? o.overlap = "never" : tt === "overlap" && (o.overlap = "overlap");
|
|
1207
1207
|
const $ = et(s, "w:tblCaption");
|
|
@@ -1231,7 +1231,7 @@ function On(t, e) {
|
|
|
1231
1231
|
const y = l(n, "w:vAlign"), I = y && m(y, "w:val");
|
|
1232
1232
|
(I === "center" || I === "bottom") && (d.vAlign = I);
|
|
1233
1233
|
const S = et(n, "w:textDirection");
|
|
1234
|
-
(S === "tbRl" || S === "btLr" || S === "lrTbV" || S === "tbRlV" || S === "tbLrV") && (d.textDirection = S),
|
|
1234
|
+
(S === "tbRl" || S === "btLr" || S === "lrTbV" || S === "tbRlV" || S === "tbLrV") && (d.textDirection = S), K(l(n, "w:noWrap")) && (d.noWrap = !0), K(l(n, "w:tcFitText")) && (d.fitText = !0), K(l(n, "w:hideMark")) && (d.hideMark = !0);
|
|
1235
1235
|
}
|
|
1236
1236
|
return d;
|
|
1237
1237
|
}
|
|
@@ -1462,10 +1462,10 @@ function Gn(t, e, n = {}, o = /* @__PURE__ */ new Map(), i = () => ({}), s, a) {
|
|
|
1462
1462
|
c.list = { listId: w.numId, level: w.level };
|
|
1463
1463
|
const D = T.levels[Math.min(w.level, T.levels.length - 1)], x = D ? D.indentLeftPx : 0;
|
|
1464
1464
|
return c.indentLeftPx = Math.max(0, P(c.indentLeftPx - x)), c.indentFirstLinePx = 0, x;
|
|
1465
|
-
},
|
|
1465
|
+
}, J = (c) => {
|
|
1466
1466
|
const w = c.sectionPgSize;
|
|
1467
1467
|
return !!w && !!s && (w.w !== s.w || w.h !== s.h);
|
|
1468
|
-
}, Z = (c) =>
|
|
1468
|
+
}, Z = (c) => J(c) || !!c.sectionColumns || c.sectionPageNumberStart !== void 0 || !!c.sectionPgBorders || // An even/odd page-parity break or line numbering is a real, page-breaking
|
|
1469
1469
|
// section even when the geometry is identical to the document section.
|
|
1470
1470
|
c.sectionBreakType === "evenPage" || c.sectionBreakType === "oddPage" || !!c.sectionLineNumbering, R = (c) => {
|
|
1471
1471
|
const w = {};
|
|
@@ -1715,7 +1715,7 @@ function Gn(t, e, n = {}, o = /* @__PURE__ */ new Map(), i = () => ({}), s, a) {
|
|
|
1715
1715
|
}
|
|
1716
1716
|
return G;
|
|
1717
1717
|
}), E = { kind: "table", id: d(), revision: 0, rows: W };
|
|
1718
|
-
c.styleId && (E.styleId = c.styleId), c.look && (E.condOverrides = { ...c.look }), E.colFractions =
|
|
1718
|
+
c.styleId && (E.styleId = c.styleId), c.look && (E.condOverrides = { ...c.look }), E.colFractions = Kn(c.colWidthsTwips, x), c.widthMode && c.widthMode !== "fixed" && (E.widthMode = c.widthMode), c.preferredWidthTwips ? E.preferredWidth = { type: "px", value: P(H(c.preferredWidthTwips)) } : c.preferredWidthPct && (E.preferredWidth = { type: "pct", value: c.preferredWidthPct }), c.align && c.align !== "left" && (E.align = c.align), c.indentTwips && (E.indentPx = P(H(c.indentTwips))), c.bidiVisual && (E.bidiVisual = !0), c.overlap && (E.overlap = c.overlap), c.caption && (E.caption = c.caption), c.description && (E.description = c.description);
|
|
1719
1719
|
const lt = nn(c.borders);
|
|
1720
1720
|
if (lt ? E.defaultBorders = lt : c.bordersSpecified && (E.defaultBorders = {}), c.shd && (E.defaultShading = c.shd), c.cellMarginTwips) {
|
|
1721
1721
|
const B = c.cellMarginTwips;
|
|
@@ -1810,7 +1810,7 @@ function Xn(t, e) {
|
|
|
1810
1810
|
start: t.start
|
|
1811
1811
|
};
|
|
1812
1812
|
if (n === "bullet" && (o.bulletChar = t.format === "none" ? "" : Un(t.lvlText)), t.markerRunProps) {
|
|
1813
|
-
const i =
|
|
1813
|
+
const i = Kt(t.markerRunProps);
|
|
1814
1814
|
Object.keys(i).length > 0 && (o.markerStyle = i);
|
|
1815
1815
|
}
|
|
1816
1816
|
return o;
|
|
@@ -1838,11 +1838,11 @@ function Me(t) {
|
|
|
1838
1838
|
});
|
|
1839
1839
|
return e.sort((n, o) => n.posPx - o.posPx), e;
|
|
1840
1840
|
}
|
|
1841
|
-
function
|
|
1841
|
+
function Kn(t, e) {
|
|
1842
1842
|
const n = t && t.length === e && t.reduce((o, i) => o + i, 0) > 0 ? t.map((o) => Math.round(o / t.reduce((i, s) => i + s, 0) * 1e4) / 1e4) : Array.from({ length: e }, () => Math.round(1 / e * 1e4) / 1e4);
|
|
1843
1843
|
return n[n.length - 1] = Math.round((1 - n.slice(0, -1).reduce((o, i) => o + i, 0)) * 1e4) / 1e4, n;
|
|
1844
1844
|
}
|
|
1845
|
-
const
|
|
1845
|
+
const Jn = {
|
|
1846
1846
|
yellow: "#ffff00",
|
|
1847
1847
|
green: "#00ff00",
|
|
1848
1848
|
cyan: "#00ffff",
|
|
@@ -1891,7 +1891,7 @@ function Ee(t, e) {
|
|
|
1891
1891
|
o && (t.underlineStyle = o), e.underlineColor && e.underlineColor !== "auto" && (t.underlineColor = `#${e.underlineColor.toLowerCase()}`);
|
|
1892
1892
|
}
|
|
1893
1893
|
if (e.strikethrough !== void 0 && (t.strikethrough = e.strikethrough), e.color && e.color !== "auto" && (t.color = `#${e.color.toLowerCase()}`), e.highlight) {
|
|
1894
|
-
const o =
|
|
1894
|
+
const o = Jn[e.highlight];
|
|
1895
1895
|
o && (t.highlightColor = o);
|
|
1896
1896
|
}
|
|
1897
1897
|
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 = P(Ut(e.positionHalfPoints))), e.kerningHalfPoints !== void 0 && (t.kerningMinPx = P(Ut(e.kerningHalfPoints))), e.widthScalePct !== void 0 && (t.widthScalePct = e.widthScalePct), e.emphasisMark) {
|
|
@@ -1921,7 +1921,7 @@ function no(t) {
|
|
|
1921
1921
|
}
|
|
1922
1922
|
return e;
|
|
1923
1923
|
}
|
|
1924
|
-
function
|
|
1924
|
+
function Kt(t) {
|
|
1925
1925
|
const e = {};
|
|
1926
1926
|
return Ee(e, t), e;
|
|
1927
1927
|
}
|
|
@@ -1946,7 +1946,7 @@ function oo(t) {
|
|
|
1946
1946
|
id: o,
|
|
1947
1947
|
name: i.name ?? o,
|
|
1948
1948
|
type: s ? "character" : "paragraph",
|
|
1949
|
-
char:
|
|
1949
|
+
char: Kt(i.rPr),
|
|
1950
1950
|
para: s ? {} : Re(i.pPr)
|
|
1951
1951
|
};
|
|
1952
1952
|
i.basedOnId && e.has(i.basedOnId) && t.styles.get(i.basedOnId)?.type === i.type && (a.basedOn = i.basedOnId), n.push(a);
|
|
@@ -1960,7 +1960,7 @@ function io(t) {
|
|
|
1960
1960
|
for (const i of t.styles.values()) i.type === "table" && e.add(i.id);
|
|
1961
1961
|
if (e.size === 0) return;
|
|
1962
1962
|
const n = (i, s, a, r) => {
|
|
1963
|
-
const d = {}, p =
|
|
1963
|
+
const d = {}, p = Kt(i);
|
|
1964
1964
|
Object.keys(p).length > 0 && (d.char = p);
|
|
1965
1965
|
const h = Re(s);
|
|
1966
1966
|
Object.keys(h).length > 0 && (d.para = h);
|
|
@@ -2215,8 +2215,8 @@ function yo(t, e) {
|
|
|
2215
2215
|
pPr: M ? Ht(M) : {}
|
|
2216
2216
|
}, ft = tt && zt(l(tt, "w:tcBorders"));
|
|
2217
2217
|
ft && ($.borders = ft);
|
|
2218
|
-
const
|
|
2219
|
-
|
|
2218
|
+
const J = tt && Rt(l(tt, "w:shd"));
|
|
2219
|
+
J && ($.shd = J), I[L] = $;
|
|
2220
2220
|
}
|
|
2221
2221
|
Object.keys(I).length > 0 && (h.tblStylePr = I);
|
|
2222
2222
|
}
|
|
@@ -2378,18 +2378,18 @@ function Oo(t, e, n) {
|
|
|
2378
2378
|
(W) => To(g, W),
|
|
2379
2379
|
tt,
|
|
2380
2380
|
{ lineNumbering: M.section?.lineNumbering, pageNumberStart: M.section?.pageNumberStart }
|
|
2381
|
-
), ft = [],
|
|
2381
|
+
), ft = [], J = (W) => {
|
|
2382
2382
|
const E = ro(r, W, i, a);
|
|
2383
2383
|
return ft.push(E), E;
|
|
2384
|
-
}, Z = $.mapBlocks(M.blocks,
|
|
2384
|
+
}, Z = $.mapBlocks(M.blocks, J(f), $t(f));
|
|
2385
2385
|
Z.length === 0 && Z.push($.emptyParagraph());
|
|
2386
2386
|
const R = $.mapSection(M.section);
|
|
2387
2387
|
M.pageColorHex && (R.pageColorHex = `#${M.pageColorHex}`);
|
|
2388
2388
|
const V = Ot(r, f, "settings") ?? r.text("word/settings.xml"), X = V !== void 0 ? Eo(V) : { evenAndOdd: !1 }, C = X.evenAndOdd;
|
|
2389
|
-
be(R, "header", M.section?.headerRefs, M.section?.titlePg ?? !1, C, r, f, $,
|
|
2389
|
+
be(R, "header", M.section?.headerRefs, M.section?.titlePg ?? !1, C, r, f, $, J, i, M.sdts), be(R, "footer", M.section?.footerRefs, M.section?.titlePg ?? !1, C, r, f, $, J, i, M.sdts);
|
|
2390
2390
|
const j = ke(f, "footnotes") ?? "word/footnotes.xml", z = r.text(j), ot = z !== void 0 ? Dn(z, j, i, M.sdts) : /* @__PURE__ */ new Map(), ut = {};
|
|
2391
2391
|
if (ot.size > 0) {
|
|
2392
|
-
const W = Wt(r, j), E =
|
|
2392
|
+
const W = Wt(r, j), E = J(W), lt = $t(W);
|
|
2393
2393
|
for (const { docxId: B, noteId: Y } of $.footnoteRefs()) {
|
|
2394
2394
|
const G = ot.get(B);
|
|
2395
2395
|
if (!G) {
|
|
@@ -2410,7 +2410,7 @@ function Oo(t, e, n) {
|
|
|
2410
2410
|
}
|
|
2411
2411
|
if (!w) {
|
|
2412
2412
|
const G = Wt(r, mt);
|
|
2413
|
-
w = { media:
|
|
2413
|
+
w = { media: J(G), link: $t(G) };
|
|
2414
2414
|
}
|
|
2415
2415
|
const B = $.mapBlocks(lt, w.media, w.link), Y = B.filter((G) => G.kind === "paragraph");
|
|
2416
2416
|
Y.length < B.length && i.add("endnote-tables", "Tables inside endnotes were dropped (endnotes hold paragraphs only)."), Y.length > 0 && (c[E] = Y);
|