@sobree/core 0.1.21 → 0.1.22
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/index.js +172 -132
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -106,7 +106,7 @@ function To() {
|
|
|
106
106
|
const t = Array.from(e, (n) => n.toString(16).padStart(2, "0")).join("");
|
|
107
107
|
return `{${t.slice(0, 8)}-${t.slice(8, 12)}-${t.slice(12, 16)}-${t.slice(16, 20)}-${t.slice(20, 32)}}`;
|
|
108
108
|
}
|
|
109
|
-
function
|
|
109
|
+
function Ao(e) {
|
|
110
110
|
return e ? Mr(e) === vo.replace(/[^0-9a-f]/gi, "") : !0;
|
|
111
111
|
}
|
|
112
112
|
function Lr(e, t) {
|
|
@@ -131,7 +131,7 @@ function Co(e) {
|
|
|
131
131
|
function Mr(e) {
|
|
132
132
|
return e.replace(/[{}\-]/g, "").toLowerCase();
|
|
133
133
|
}
|
|
134
|
-
function
|
|
134
|
+
function Eo(e) {
|
|
135
135
|
if (e.length < 12) return null;
|
|
136
136
|
const t = new DataView(e.buffer, e.byteOffset, e.byteLength), n = t.getUint32(0);
|
|
137
137
|
if (n !== 65536 && n !== 1330926671) return null;
|
|
@@ -396,7 +396,7 @@ function jo(e, t, n, r = {}) {
|
|
|
396
396
|
], s = {}, a = { ...e.rawParts };
|
|
397
397
|
for (const [u, f] of o) {
|
|
398
398
|
if (!f) continue;
|
|
399
|
-
const d =
|
|
399
|
+
const d = Eo(f);
|
|
400
400
|
if (No(d).mode === "restricted" && !r.allowRestricted) {
|
|
401
401
|
i.push(
|
|
402
402
|
`Refused to embed "${t}" face "${u}": OS/2 fsType marks it as embedding-restricted.`
|
|
@@ -471,7 +471,7 @@ class Xo {
|
|
|
471
471
|
if (!f) continue;
|
|
472
472
|
const d = i[f.partPath];
|
|
473
473
|
if (!d) continue;
|
|
474
|
-
const h =
|
|
474
|
+
const h = Ao(f.fontKey) ? d : xo(d, f.fontKey ?? ""), p = new Blob([new Uint8Array(h)], {
|
|
475
475
|
type: "application/font-sfnt"
|
|
476
476
|
}), g = URL.createObjectURL(p);
|
|
477
477
|
this.blobUrls.push(g), s.push(Vo(a.name, g, u));
|
|
@@ -903,7 +903,7 @@ function xs(e, t, n) {
|
|
|
903
903
|
return b("w:tc", null, `${i}${o}${s}`);
|
|
904
904
|
}
|
|
905
905
|
const Ss = "application/vnd.openxmlformats-officedocument.wordprocessingml.header+xml", Ts = "application/vnd.openxmlformats-officedocument.wordprocessingml.footer+xml";
|
|
906
|
-
function
|
|
906
|
+
function As(e, t) {
|
|
907
907
|
if (e.sections.length === 0) return [Ps()];
|
|
908
908
|
const n = /* @__PURE__ */ new Map(), r = (i) => {
|
|
909
909
|
const o = [], s = [], a = (c, l) => {
|
|
@@ -923,7 +923,7 @@ function Es(e, t) {
|
|
|
923
923
|
};
|
|
924
924
|
for (const c of i.headerRefs) a(c, "header");
|
|
925
925
|
for (const c of i.footerRefs) a(c, "footer");
|
|
926
|
-
return
|
|
926
|
+
return Es(i, o, s);
|
|
927
927
|
};
|
|
928
928
|
return e.sections.map(r);
|
|
929
929
|
}
|
|
@@ -931,7 +931,7 @@ function Cs(e, t, n, r) {
|
|
|
931
931
|
const i = e === "header" ? "w:hdr" : "w:ftr", o = ys(t, n, r);
|
|
932
932
|
return o.length === 0 && o.push(b("w:p")), nt(b(i, { "xmlns:w": m.w, "xmlns:r": m.r }, o));
|
|
933
933
|
}
|
|
934
|
-
function
|
|
934
|
+
function Es(e, t, n) {
|
|
935
935
|
const r = [];
|
|
936
936
|
r.push(...t, ...n), e.type && e.type !== "nextPage" ? r.push(b("w:type", { "w:val": e.type })) : e.type === "nextPage" && r.push(b("w:type", { "w:val": "nextPage" })), r.push(
|
|
937
937
|
b("w:pgSz", {
|
|
@@ -1065,7 +1065,7 @@ function $s(e) {
|
|
|
1065
1065
|
return { blob: new Blob([new Uint8Array(n)], { type: Ms }), bytes: n };
|
|
1066
1066
|
}
|
|
1067
1067
|
function jr(e) {
|
|
1068
|
-
const t = [], n = es(2), r =
|
|
1068
|
+
const t = [], n = es(2), r = As(e, n), i = ms(e, r, n), o = Is(e.numbering);
|
|
1069
1069
|
o && (n.parts["word/numbering.xml"] = o, n.contentTypeOverrides.push({
|
|
1070
1070
|
partName: "/word/numbering.xml",
|
|
1071
1071
|
contentType: "application/vnd.openxmlformats-officedocument.wordprocessingml.numbering+xml"
|
|
@@ -1275,15 +1275,15 @@ class js {
|
|
|
1275
1275
|
* With `animate = true`, the transition runs with a CSS ease curve.
|
|
1276
1276
|
*/
|
|
1277
1277
|
fitTo(t, n, r = !1) {
|
|
1278
|
-
var
|
|
1278
|
+
var A;
|
|
1279
1279
|
const i = this.container.getBoundingClientRect(), o = t.getBoundingClientRect(), s = this.stage.getBoundingClientRect(), a = this.scale, c = o.width / a, l = o.height / a, u = (o.left - s.left) / a, f = (o.top - s.top) / a, d = 32, h = i.width - d * 2, p = i.height - d * 2, g = h / c, y = p / l, S = Tn(n === "width" ? g : Math.min(g, y), this.minScale, this.maxScale), x = i.width / 2 - (u + c / 2) * S;
|
|
1280
1280
|
let v;
|
|
1281
1281
|
if (n === "width") {
|
|
1282
|
-
const
|
|
1283
|
-
v = i.height / 2 -
|
|
1282
|
+
const E = (i.height / 2 - this.ty) / a;
|
|
1283
|
+
v = i.height / 2 - E * S;
|
|
1284
1284
|
} else
|
|
1285
1285
|
v = i.height / 2 - (f + l / 2) * S;
|
|
1286
|
-
this.scale = S, this.tx = x, this.ty = v, this.wheelGestures.engageHorizontalLock(), r ? this.applyTransformAnimated() : this.applyTransform(), (
|
|
1286
|
+
this.scale = S, this.tx = x, this.ty = v, this.wheelGestures.engageHorizontalLock(), r ? this.applyTransformAnimated() : this.applyTransform(), (A = this.onScaleChange) == null || A.call(this, this.scale);
|
|
1287
1287
|
}
|
|
1288
1288
|
/**
|
|
1289
1289
|
* Pan the stage by `(dx, dy)` CSS pixels. Optional `animate` runs the
|
|
@@ -1306,7 +1306,7 @@ class js {
|
|
|
1306
1306
|
}
|
|
1307
1307
|
applyTransform() {
|
|
1308
1308
|
var n, r;
|
|
1309
|
-
const t =
|
|
1309
|
+
const t = An(this.scale);
|
|
1310
1310
|
t !== this.renderTier && (this.renderTier = t, this.stage.style.zoom = String(t), (n = this.onRenderTierChange) == null || n.call(this, t)), this.stage.classList.add("is-gesturing"), this.stage.style.transform = this.transformCss(!0), this.scheduleSettle(), this.constructed && ((r = this.onTransformChange) == null || r.call(this));
|
|
1311
1311
|
}
|
|
1312
1312
|
/**
|
|
@@ -1358,7 +1358,7 @@ class js {
|
|
|
1358
1358
|
*/
|
|
1359
1359
|
applyTransformAnimated() {
|
|
1360
1360
|
var c;
|
|
1361
|
-
const t = this.stage, r =
|
|
1361
|
+
const t = this.stage, r = An(this.scale) !== this.renderTier;
|
|
1362
1362
|
t.classList.add("is-animating"), r ? (t.style.transform = this.transformCss(!0), (c = this.onTransformChange) == null || c.call(this)) : this.applyTransform();
|
|
1363
1363
|
let i = !1, o = 0;
|
|
1364
1364
|
const s = () => {
|
|
@@ -1395,7 +1395,7 @@ function Xs() {
|
|
|
1395
1395
|
return t.className = "sobree-viewport__slot", e.appendChild(t), e;
|
|
1396
1396
|
}
|
|
1397
1397
|
const Vs = 180, Gs = 400;
|
|
1398
|
-
function
|
|
1398
|
+
function An(e) {
|
|
1399
1399
|
return 1;
|
|
1400
1400
|
}
|
|
1401
1401
|
function wt(e = [], t = {}) {
|
|
@@ -1408,7 +1408,7 @@ function qs(e, t = [], n = {}) {
|
|
|
1408
1408
|
function vp(e) {
|
|
1409
1409
|
return { kind: "section_break", toSectionIndex: e };
|
|
1410
1410
|
}
|
|
1411
|
-
const Ks = 11906, Js = 16838, Nt = 1440, Cn = Nt / 2, Zs = 240,
|
|
1411
|
+
const Ks = 11906, Js = 16838, Nt = 1440, Cn = Nt / 2, Zs = 240, En = 11;
|
|
1412
1412
|
function rn() {
|
|
1413
1413
|
return {
|
|
1414
1414
|
body: [wt()],
|
|
@@ -1450,7 +1450,7 @@ function on() {
|
|
|
1450
1450
|
displayName: "Normal",
|
|
1451
1451
|
runDefaults: {
|
|
1452
1452
|
fontFamily: "Helvetica",
|
|
1453
|
-
fontSizePt:
|
|
1453
|
+
fontSizePt: En
|
|
1454
1454
|
},
|
|
1455
1455
|
// Word hardcoded default — single line, zero before/after.
|
|
1456
1456
|
paragraphDefaults: {
|
|
@@ -1459,7 +1459,7 @@ function on() {
|
|
|
1459
1459
|
}
|
|
1460
1460
|
];
|
|
1461
1461
|
for (let n = 1; n <= 6; n++) {
|
|
1462
|
-
const r = e[n - 1] ??
|
|
1462
|
+
const r = e[n - 1] ?? En;
|
|
1463
1463
|
t.push({
|
|
1464
1464
|
id: `Heading${n}`,
|
|
1465
1465
|
type: "paragraph",
|
|
@@ -1489,7 +1489,7 @@ function on() {
|
|
|
1489
1489
|
}
|
|
1490
1490
|
}), t;
|
|
1491
1491
|
}
|
|
1492
|
-
function
|
|
1492
|
+
function Ee(e, t) {
|
|
1493
1493
|
return e.body.push(t), e;
|
|
1494
1494
|
}
|
|
1495
1495
|
function xp(e, t) {
|
|
@@ -1504,13 +1504,13 @@ function Tp(e) {
|
|
|
1504
1504
|
function ce(e, t = {}) {
|
|
1505
1505
|
return { kind: "text", text: e, properties: t };
|
|
1506
1506
|
}
|
|
1507
|
-
function
|
|
1507
|
+
function Ap(e, t = {}) {
|
|
1508
1508
|
return { kind: "text", text: e, properties: { ...t, italic: !0 } };
|
|
1509
1509
|
}
|
|
1510
1510
|
function Cp(e, t = {}) {
|
|
1511
1511
|
return { kind: "text", text: e, properties: { ...t, bold: !0 } };
|
|
1512
1512
|
}
|
|
1513
|
-
function
|
|
1513
|
+
function Ep() {
|
|
1514
1514
|
return { kind: "break", type: "line" };
|
|
1515
1515
|
}
|
|
1516
1516
|
function Np() {
|
|
@@ -1644,13 +1644,13 @@ function Vr(e) {
|
|
|
1644
1644
|
if (s) {
|
|
1645
1645
|
r.listState = null;
|
|
1646
1646
|
const f = s[1].length, d = s[2];
|
|
1647
|
-
|
|
1647
|
+
Ee(t, qs(f, mt(d))), i++;
|
|
1648
1648
|
continue;
|
|
1649
1649
|
}
|
|
1650
1650
|
const a = /^(\s*)([-*])\s+(.+)$/.exec(o), c = /^(\s*)(\d+)\.\s+(.+)$/.exec(o);
|
|
1651
1651
|
if (a || c) {
|
|
1652
1652
|
const f = c !== null, d = (c ?? a)[3], h = aa(r, f, mt(d));
|
|
1653
|
-
|
|
1653
|
+
Ee(t, h), i++;
|
|
1654
1654
|
continue;
|
|
1655
1655
|
}
|
|
1656
1656
|
r.listState = null;
|
|
@@ -1661,7 +1661,7 @@ function Vr(e) {
|
|
|
1661
1661
|
if (f.trim() === "" || /^#{1,6}\s+/.test(f) || /^\s*[-*]\s+/.test(f) || /^\s*\d+\.\s+/.test(f)) break;
|
|
1662
1662
|
l.push(f), u++;
|
|
1663
1663
|
}
|
|
1664
|
-
|
|
1664
|
+
Ee(t, wt(ua(l))), i = u;
|
|
1665
1665
|
}
|
|
1666
1666
|
return t.body.length === 0 && t.body.push(wt()), t;
|
|
1667
1667
|
}
|
|
@@ -2078,7 +2078,7 @@ function le(e, t) {
|
|
|
2078
2078
|
function va(e) {
|
|
2079
2079
|
const t = Ta(e, "pathLst");
|
|
2080
2080
|
if (!t) return null;
|
|
2081
|
-
const n =
|
|
2081
|
+
const n = Aa(t, "path");
|
|
2082
2082
|
if (n.length === 0) return null;
|
|
2083
2083
|
const r = ue(n[0], "w"), i = ue(n[0], "h");
|
|
2084
2084
|
if (r <= 0 || i <= 0) return null;
|
|
@@ -2120,7 +2120,7 @@ function Ta(e, t) {
|
|
|
2120
2120
|
if (n.namespaceURI === m.a && n.localName === t) return n;
|
|
2121
2121
|
return null;
|
|
2122
2122
|
}
|
|
2123
|
-
function
|
|
2123
|
+
function Aa(e, t) {
|
|
2124
2124
|
return Array.from(e.children).filter(
|
|
2125
2125
|
(n) => n.namespaceURI === m.a && n.localName === t
|
|
2126
2126
|
);
|
|
@@ -2159,7 +2159,7 @@ function Qr(e, t, n = !0) {
|
|
|
2159
2159
|
function Ca(e, t, n) {
|
|
2160
2160
|
const r = e.getElementsByTagNameNS(m.v, "imagedata")[0];
|
|
2161
2161
|
if (!r) return null;
|
|
2162
|
-
const i = r.parentElement, o =
|
|
2162
|
+
const i = r.parentElement, o = Ea((i == null ? void 0 : i.getAttribute("style")) ?? "");
|
|
2163
2163
|
if (o.position !== "absolute") return null;
|
|
2164
2164
|
const s = Wt(o.width), a = Wt(o.height);
|
|
2165
2165
|
if (s <= 0 || a <= 0) return null;
|
|
@@ -2182,7 +2182,7 @@ function Ca(e, t, n) {
|
|
|
2182
2182
|
}, f = Number(o["z-index"]);
|
|
2183
2183
|
return Number.isFinite(f) && f < 0 && (u.behindText = !0), u;
|
|
2184
2184
|
}
|
|
2185
|
-
function
|
|
2185
|
+
function Ea(e) {
|
|
2186
2186
|
const t = {};
|
|
2187
2187
|
for (const n of e.split(";")) {
|
|
2188
2188
|
const r = n.indexOf(":");
|
|
@@ -3384,11 +3384,11 @@ function Tc(e, t, n) {
|
|
|
3384
3384
|
let i = [];
|
|
3385
3385
|
for (const o of e) {
|
|
3386
3386
|
const s = o.widthEmu * t, a = o.heightEmu * n, c = o.content;
|
|
3387
|
-
c.kind === "picture" ? i.push(
|
|
3387
|
+
c.kind === "picture" ? i.push(Ac(c, s, a)) : c.kind === "textbox" ? (r.push(...Un(c.body, i)), i = []) : c.kind === "group" && (r.push(...Un(gi(c, s, a), i)), i = []);
|
|
3388
3388
|
}
|
|
3389
3389
|
return r;
|
|
3390
3390
|
}
|
|
3391
|
-
function
|
|
3391
|
+
function Ac(e, t, n) {
|
|
3392
3392
|
const r = {
|
|
3393
3393
|
kind: "drawing",
|
|
3394
3394
|
partPath: e.partPath,
|
|
@@ -3433,7 +3433,7 @@ function Cc(e, t) {
|
|
|
3433
3433
|
}
|
|
3434
3434
|
return { body: i, frames: a };
|
|
3435
3435
|
}
|
|
3436
|
-
function
|
|
3436
|
+
function Ec(e, t) {
|
|
3437
3437
|
if (!e) return {};
|
|
3438
3438
|
let n;
|
|
3439
3439
|
try {
|
|
@@ -3564,14 +3564,14 @@ function Ic(e, t, n, r) {
|
|
|
3564
3564
|
if (v.namespaceURI === m.wpg && v.localName === "grpSp")
|
|
3565
3565
|
y(v);
|
|
3566
3566
|
else if (v.namespaceURI === m.wps && v.localName === "wsp") {
|
|
3567
|
-
const
|
|
3568
|
-
if (
|
|
3569
|
-
const
|
|
3570
|
-
if (!
|
|
3567
|
+
const A = P(v, m.wps, "txbx");
|
|
3568
|
+
if (A) {
|
|
3569
|
+
const E = P(A, m.w, "txbxContent");
|
|
3570
|
+
if (!E) continue;
|
|
3571
3571
|
const { off: I, ext: F } = re(v), B = {
|
|
3572
3572
|
offsetEmu: { xEmu: I.x, yEmu: I.y },
|
|
3573
3573
|
sizeEmu: { wEmu: F.cx, hEmu: F.cy },
|
|
3574
|
-
body: n.parseBlockBody(
|
|
3574
|
+
body: n.parseBlockBody(E)
|
|
3575
3575
|
}, M = Xe(v, n.theme);
|
|
3576
3576
|
M !== void 0 && (B.fill = M);
|
|
3577
3577
|
const L = Ve(v, n.theme);
|
|
@@ -3589,21 +3589,21 @@ function Ic(e, t, n, r) {
|
|
|
3589
3589
|
}
|
|
3590
3590
|
h.push(B);
|
|
3591
3591
|
} else {
|
|
3592
|
-
const { off:
|
|
3592
|
+
const { off: E, ext: I } = re(v);
|
|
3593
3593
|
if (I.cx <= 0 || I.cy <= 0) continue;
|
|
3594
3594
|
const F = mi(v), B = Xe(v, n.theme), M = Ve(v, n.theme), L = {
|
|
3595
3595
|
geometry: F,
|
|
3596
|
-
offsetEmu: { xEmu:
|
|
3596
|
+
offsetEmu: { xEmu: E.x, yEmu: E.y },
|
|
3597
3597
|
sizeEmu: { wEmu: I.cx, hEmu: I.cy }
|
|
3598
3598
|
};
|
|
3599
3599
|
B !== void 0 && (L.fill = B), M !== void 0 && (L.border = M), g.push(L);
|
|
3600
3600
|
}
|
|
3601
3601
|
} else if (v.namespaceURI === m.pic && v.localName === "pic") {
|
|
3602
|
-
const
|
|
3603
|
-
if (!E) continue;
|
|
3604
|
-
const A = E.getAttributeNS(m.r, "embed") ?? E.getAttribute("r:embed");
|
|
3602
|
+
const A = v.getElementsByTagNameNS(m.a, "blip")[0];
|
|
3605
3603
|
if (!A) continue;
|
|
3606
|
-
const
|
|
3604
|
+
const E = A.getAttributeNS(m.r, "embed") ?? A.getAttribute("r:embed");
|
|
3605
|
+
if (!E) continue;
|
|
3606
|
+
const I = n.rels.get(E);
|
|
3607
3607
|
if (!I) continue;
|
|
3608
3608
|
const F = $c(I), { off: B, ext: M } = re(v);
|
|
3609
3609
|
if (M.cx <= 0 || M.cy <= 0) continue;
|
|
@@ -4281,25 +4281,25 @@ async function ol(e) {
|
|
|
4281
4281
|
), { body: x, frames: v } = Cc(
|
|
4282
4282
|
g,
|
|
4283
4283
|
c
|
|
4284
|
-
),
|
|
4284
|
+
), A = S.map((j) => Nc(j, o)), { body: E, frames: I } = yc(
|
|
4285
4285
|
x,
|
|
4286
4286
|
v,
|
|
4287
|
-
|
|
4287
|
+
A
|
|
4288
4288
|
), { bodies: F, frames: B } = sl(
|
|
4289
|
-
|
|
4289
|
+
A,
|
|
4290
4290
|
t.text,
|
|
4291
4291
|
o,
|
|
4292
4292
|
s
|
|
4293
4293
|
), M = {};
|
|
4294
4294
|
for (const [j, _t] of Object.entries(t.binary))
|
|
4295
4295
|
M[j] = _t;
|
|
4296
|
-
const L = Fo(t.text, Ye), $ = zc(t.text["word/settings.xml"]), K = Jc(t.text["word/styles.xml"], $), mn =
|
|
4296
|
+
const L = Fo(t.text, Ye), $ = zc(t.text["word/settings.xml"]), K = Jc(t.text["word/styles.xml"], $), mn = Ec(t.text["word/footnotes.xml"], { rels: o }), bn = hc(
|
|
4297
4297
|
t.text["word/comments.xml"],
|
|
4298
4298
|
{ rels: o },
|
|
4299
4299
|
t.text["word/commentsExtended.xml"]
|
|
4300
4300
|
), Ce = {
|
|
4301
|
-
body:
|
|
4302
|
-
sections:
|
|
4301
|
+
body: E,
|
|
4302
|
+
sections: A.length > 0 ? A : [ll()],
|
|
4303
4303
|
headerFooterBodies: F,
|
|
4304
4304
|
styles: K ?? on(),
|
|
4305
4305
|
// Parse the docx's numbering definitions so the renderer can apply
|
|
@@ -4712,7 +4712,7 @@ const ln = "body", un = "meta", xe = "parts", Ti = "partRefs", tt = "id", kt = "
|
|
|
4712
4712
|
numbering: "numbering",
|
|
4713
4713
|
fonts: "fonts"
|
|
4714
4714
|
};
|
|
4715
|
-
function
|
|
4715
|
+
function Ai(e) {
|
|
4716
4716
|
const t = [];
|
|
4717
4717
|
return Ci(e, t, void 0), t;
|
|
4718
4718
|
}
|
|
@@ -4745,7 +4745,7 @@ function Fe(e, t) {
|
|
|
4745
4745
|
if (!(!e && !t))
|
|
4746
4746
|
return e ? t ? { ...e, ...t } : e : t;
|
|
4747
4747
|
}
|
|
4748
|
-
function
|
|
4748
|
+
function Ei(e) {
|
|
4749
4749
|
const t = [];
|
|
4750
4750
|
let n = 0;
|
|
4751
4751
|
for (; n < e.length; ) {
|
|
@@ -4768,7 +4768,7 @@ function Ai(e) {
|
|
|
4768
4768
|
const d = wl(f, "link");
|
|
4769
4769
|
Object.keys(d).length > 0 && (u.attributes = d);
|
|
4770
4770
|
}
|
|
4771
|
-
o.push(...
|
|
4771
|
+
o.push(...Ei([u])), s++;
|
|
4772
4772
|
}
|
|
4773
4773
|
const a = {
|
|
4774
4774
|
kind: "hyperlink",
|
|
@@ -4872,14 +4872,14 @@ function Ri(e, t) {
|
|
|
4872
4872
|
e.set(fe, JSON.stringify(t.properties));
|
|
4873
4873
|
let n = e.get(it);
|
|
4874
4874
|
n instanceof Y.Text || (n = new Y.Text(), e.set(it, n));
|
|
4875
|
-
const r =
|
|
4875
|
+
const r = Ai(t.runs);
|
|
4876
4876
|
r.length > 0 && n.applyDelta(r);
|
|
4877
4877
|
}
|
|
4878
4878
|
function de(e) {
|
|
4879
4879
|
const t = e.getArray(ln), n = e.getMap(un), r = e.getMap(xe), i = e.getMap(Ti), o = [], s = [];
|
|
4880
4880
|
t.forEach((v) => {
|
|
4881
|
-
const
|
|
4882
|
-
|
|
4881
|
+
const A = v.get(tt) ?? "", E = kl(v);
|
|
4882
|
+
E && (o.push(E), s.push(A));
|
|
4883
4883
|
});
|
|
4884
4884
|
const a = V(n, N.sections, []), c = V(
|
|
4885
4885
|
n,
|
|
@@ -4890,12 +4890,12 @@ function de(e) {
|
|
|
4890
4890
|
N.headerFooterFrames,
|
|
4891
4891
|
{}
|
|
4892
4892
|
), f = V(n, N.footnotes, {}), d = V(n, N.comments, {}), h = V(n, N.settings, {}), p = V(n, N.styles, []), g = V(n, N.numbering, []), y = V(n, N.fonts, []), S = {};
|
|
4893
|
-
r.forEach((v,
|
|
4894
|
-
S[
|
|
4893
|
+
r.forEach((v, A) => {
|
|
4894
|
+
S[A] = v;
|
|
4895
4895
|
});
|
|
4896
4896
|
const x = {};
|
|
4897
|
-
return i.forEach((v,
|
|
4898
|
-
x[
|
|
4897
|
+
return i.forEach((v, A) => {
|
|
4898
|
+
x[A] = v;
|
|
4899
4899
|
}), {
|
|
4900
4900
|
doc: {
|
|
4901
4901
|
body: o,
|
|
@@ -4940,7 +4940,7 @@ function vl(e) {
|
|
|
4940
4940
|
} catch {
|
|
4941
4941
|
r = {};
|
|
4942
4942
|
}
|
|
4943
|
-
const i = t.toDelta(), o =
|
|
4943
|
+
const i = t.toDelta(), o = Ei(i);
|
|
4944
4944
|
return { kind: "paragraph", properties: r, runs: o };
|
|
4945
4945
|
}
|
|
4946
4946
|
function V(e, t, n) {
|
|
@@ -4959,7 +4959,7 @@ function xl(e, t) {
|
|
|
4959
4959
|
Tl(e, r, i);
|
|
4960
4960
|
return;
|
|
4961
4961
|
}
|
|
4962
|
-
|
|
4962
|
+
Al(e, r, i);
|
|
4963
4963
|
}
|
|
4964
4964
|
}
|
|
4965
4965
|
function Jn(e) {
|
|
@@ -5021,7 +5021,7 @@ function Zn(e, t) {
|
|
|
5021
5021
|
r in t || (n[r] = null);
|
|
5022
5022
|
return n;
|
|
5023
5023
|
}
|
|
5024
|
-
function
|
|
5024
|
+
function Al(e, t, n) {
|
|
5025
5025
|
let r = 0;
|
|
5026
5026
|
for (; r < t.length && r < n.length && Ge(t[r], n[r]); )
|
|
5027
5027
|
r++;
|
|
@@ -5042,11 +5042,11 @@ function Cl(e, t, n, r, i) {
|
|
|
5042
5042
|
let c = s + 1;
|
|
5043
5043
|
for (; c < i && n[c].kind === "char" && ot(n[c].attrs, a.attrs); )
|
|
5044
5044
|
c++;
|
|
5045
|
-
const l =
|
|
5045
|
+
const l = El(n, s, c);
|
|
5046
5046
|
e.insert(o, l, a.attrs), o += l.length, s = c;
|
|
5047
5047
|
}
|
|
5048
5048
|
}
|
|
5049
|
-
function
|
|
5049
|
+
function El(e, t, n) {
|
|
5050
5050
|
let r = "";
|
|
5051
5051
|
for (let i = t; i < n; i++) r += e[i].char;
|
|
5052
5052
|
return r;
|
|
@@ -5104,7 +5104,7 @@ function Pl(e, t) {
|
|
|
5104
5104
|
function Il(e, t) {
|
|
5105
5105
|
e.get(kt) !== "paragraph" && e.set(kt, "paragraph");
|
|
5106
5106
|
let n = e.get(it);
|
|
5107
|
-
n instanceof Y.Text || (n = new Y.Text(), e.set(it, n), e.has(lt) && e.delete(lt)), xl(n,
|
|
5107
|
+
n instanceof Y.Text || (n = new Y.Text(), e.set(it, n), e.has(lt) && e.delete(lt)), xl(n, Ai(t.runs));
|
|
5108
5108
|
const r = JSON.stringify(t.properties);
|
|
5109
5109
|
e.get(fe) !== r && e.set(fe, r);
|
|
5110
5110
|
}
|
|
@@ -6053,7 +6053,47 @@ const rr = [
|
|
|
6053
6053
|
{ match: /^arial$/i, chain: "Arial, 'Helvetica Neue', Helvetica, sans-serif" },
|
|
6054
6054
|
{ match: /^helvetica$/i, chain: "Helvetica, 'Helvetica Neue', Arial, sans-serif" },
|
|
6055
6055
|
{ match: /^helvetica neue$/i, chain: "'Helvetica Neue', Helvetica, Arial, sans-serif" },
|
|
6056
|
-
{ match: /^verdana$/i, chain: "Verdana, Geneva, Tahoma, sans-serif" }
|
|
6056
|
+
{ match: /^verdana$/i, chain: "Verdana, Geneva, Tahoma, sans-serif" },
|
|
6057
|
+
// Humanist / geometric sans families common in marketing + web docs
|
|
6058
|
+
// but rarely installed on the rendering host. The terminal generic
|
|
6059
|
+
// MUST be `sans-serif`: the unknown-font default below ends in `serif`
|
|
6060
|
+
// (right for an unknown SERIF face, which Word substitutes with Times),
|
|
6061
|
+
// but a missing SANS face — Word substitutes those with a sans, not a
|
|
6062
|
+
// serif — would otherwise render as Times here while Word shows sans.
|
|
6063
|
+
// That's exactly the "why is the heading serif in Sobree but sans in
|
|
6064
|
+
// Word" gap on Adobe-templated flyers (Myriad Pro). Chains stay
|
|
6065
|
+
// macOS/Win-safe (Helvetica Neue / Segoe UI / Arial) for close metrics.
|
|
6066
|
+
{
|
|
6067
|
+
match: /^myriad pro$/i,
|
|
6068
|
+
chain: "'Myriad Pro', 'Segoe UI', 'Helvetica Neue', Helvetica, Arial, sans-serif"
|
|
6069
|
+
},
|
|
6070
|
+
{
|
|
6071
|
+
match: /^myriad pro cond$/i,
|
|
6072
|
+
chain: "'Myriad Pro Cond', 'Arial Narrow', 'Helvetica Neue', Helvetica, sans-serif"
|
|
6073
|
+
},
|
|
6074
|
+
{
|
|
6075
|
+
match: /^open sans$/i,
|
|
6076
|
+
chain: "'Open Sans', 'Segoe UI', 'Helvetica Neue', Helvetica, Arial, sans-serif"
|
|
6077
|
+
},
|
|
6078
|
+
{ match: /^segoe ui$/i, chain: "'Segoe UI', 'Helvetica Neue', Helvetica, Arial, sans-serif" },
|
|
6079
|
+
{ match: /^lato$/i, chain: "Lato, 'Helvetica Neue', Helvetica, Arial, sans-serif" },
|
|
6080
|
+
{
|
|
6081
|
+
match: /^montserrat$/i,
|
|
6082
|
+
chain: "Montserrat, 'Segoe UI', 'Helvetica Neue', Helvetica, Arial, sans-serif"
|
|
6083
|
+
},
|
|
6084
|
+
{ match: /^roboto$/i, chain: "Roboto, 'Helvetica Neue', Helvetica, Arial, sans-serif" },
|
|
6085
|
+
{
|
|
6086
|
+
match: /^source sans pro$/i,
|
|
6087
|
+
chain: "'Source Sans Pro', 'Segoe UI', 'Helvetica Neue', Helvetica, Arial, sans-serif"
|
|
6088
|
+
},
|
|
6089
|
+
{
|
|
6090
|
+
match: /^(trebuchet ms|tahoma)$/i,
|
|
6091
|
+
chain: "'Trebuchet MS', Tahoma, 'Helvetica Neue', Helvetica, Arial, sans-serif"
|
|
6092
|
+
},
|
|
6093
|
+
{
|
|
6094
|
+
match: /^century gothic$/i,
|
|
6095
|
+
chain: "'Century Gothic', 'Apple Gothic', 'Helvetica Neue', Helvetica, Arial, sans-serif"
|
|
6096
|
+
}
|
|
6057
6097
|
], yu = [
|
|
6058
6098
|
{ match: /^(thin|hairline)$/i, weight: 100 },
|
|
6059
6099
|
{ match: /^(extralight|extra light|ultralight|ultra light)$/i, weight: 200 },
|
|
@@ -6175,9 +6215,9 @@ function Tu(e, t) {
|
|
|
6175
6215
|
const n = document.createElement("img");
|
|
6176
6216
|
n.setAttribute("data-part", e.partPath), e.altText && n.setAttribute("alt", e.altText);
|
|
6177
6217
|
const r = Vi(e.partPath, t);
|
|
6178
|
-
return r && n.setAttribute("src", r), e.widthEmu > 0 && (n.style.width = `${or(e.widthEmu)}px`), e.heightEmu > 0 && (n.style.height = `${or(e.heightEmu)}px`), e.verticalAlign === "middle" && (n.style.verticalAlign = "middle"), e.placement === "anchor" && e.anchor ? Cu(n, e.anchor) : (e.placement === "floatLeft" || e.placement === "floatRight") &&
|
|
6218
|
+
return r && n.setAttribute("src", r), e.widthEmu > 0 && (n.style.width = `${or(e.widthEmu)}px`), e.heightEmu > 0 && (n.style.height = `${or(e.heightEmu)}px`), e.verticalAlign === "middle" && (n.style.verticalAlign = "middle"), e.placement === "anchor" && e.anchor ? Cu(n, e.anchor) : (e.placement === "floatLeft" || e.placement === "floatRight") && Au(n, e), n;
|
|
6179
6219
|
}
|
|
6180
|
-
function
|
|
6220
|
+
function Au(e, t) {
|
|
6181
6221
|
e.style.float = t.placement === "floatLeft" ? "left" : "right";
|
|
6182
6222
|
const n = t.floatMarginsEmu;
|
|
6183
6223
|
n && (e.style.margin = `${pt(n.topEmu)}mm ${pt(n.rightEmu)}mm ${pt(n.bottomEmu)}mm ${pt(n.leftEmu)}mm`);
|
|
@@ -6190,9 +6230,9 @@ function pt(e) {
|
|
|
6190
6230
|
}
|
|
6191
6231
|
function Vi(e, t) {
|
|
6192
6232
|
const n = t[e];
|
|
6193
|
-
return n ? typeof URL > "u" || typeof URL.createObjectURL != "function" ? `data:${ir(e)};base64,${
|
|
6233
|
+
return n ? typeof URL > "u" || typeof URL.createObjectURL != "function" ? `data:${ir(e)};base64,${Eu(n)}` : Nu(n, ir(e)) : null;
|
|
6194
6234
|
}
|
|
6195
|
-
function
|
|
6235
|
+
function Eu(e) {
|
|
6196
6236
|
let t = "";
|
|
6197
6237
|
for (let i = 0; i < e.length; i += 32768)
|
|
6198
6238
|
t += String.fromCharCode(...e.subarray(i, i + 32768));
|
|
@@ -6273,8 +6313,8 @@ function dn(e, t, n = []) {
|
|
|
6273
6313
|
for (const x of ["top", "bottom", "left", "right"]) {
|
|
6274
6314
|
const v = s.borders[x];
|
|
6275
6315
|
if (!v || v.style === "none") continue;
|
|
6276
|
-
const
|
|
6277
|
-
e.style[`border${x[0].toUpperCase() + x.slice(1)}`] = `${
|
|
6316
|
+
const A = Math.max(1, Math.round(v.sizeEighthsOfPt / 8 * (96 / 72)));
|
|
6317
|
+
e.style[`border${x[0].toUpperCase() + x.slice(1)}`] = `${A}px ${Mu(v.style)} ${$u(v.color)}`;
|
|
6278
6318
|
}
|
|
6279
6319
|
if ((S = s.shading) != null && S.fill && s.shading.fill !== "#auto" && (e.style.backgroundColor = s.shading.fill), s.pageBreakBefore && e.setAttribute("data-page-break-before", ""), s.keepNext && e.setAttribute("data-keep-next", ""), s.tabStops && s.tabStops.length > 0) {
|
|
6280
6320
|
const x = Math.min(...s.tabStops.map((v) => v.positionTwips));
|
|
@@ -6805,11 +6845,11 @@ function vt(e, t, n, r = [], i = {}, o, s = []) {
|
|
|
6805
6845
|
const S = zu(g, n);
|
|
6806
6846
|
if (S) {
|
|
6807
6847
|
if (!c || c.numId !== S.numId) {
|
|
6808
|
-
const
|
|
6809
|
-
u.appendChild(
|
|
6848
|
+
const E = Uu(S, l);
|
|
6849
|
+
u.appendChild(E), c = { el: E, numId: S.numId };
|
|
6810
6850
|
}
|
|
6811
|
-
const
|
|
6812
|
-
y && (
|
|
6851
|
+
const A = document.createElement("li");
|
|
6852
|
+
y && (A.dataset.blockId = y), A.dataset.sectionIndex = String(l), A.dataset.blockIndex = String(p), dn(A, g.properties, r), ju(A, g, n), dr(A, g.properties), Rt(A, g.runs, i, r), c.el.appendChild(A);
|
|
6813
6853
|
continue;
|
|
6814
6854
|
}
|
|
6815
6855
|
h();
|
|
@@ -6817,8 +6857,8 @@ function vt(e, t, n, r = [], i = {}, o, s = []) {
|
|
|
6817
6857
|
if (v) {
|
|
6818
6858
|
if (y && (v.dataset.blockId = y), v.dataset.sectionIndex = String(l), v.dataset.blockIndex = String(p), g.kind === "paragraph") {
|
|
6819
6859
|
dr(v, g.properties);
|
|
6820
|
-
const
|
|
6821
|
-
|
|
6860
|
+
const A = a.get(p);
|
|
6861
|
+
A && (v.dataset.outlineNumber = A);
|
|
6822
6862
|
}
|
|
6823
6863
|
g.kind === "section_break" ? (lr(u, t), t.appendChild(v)) : u.appendChild(v);
|
|
6824
6864
|
}
|
|
@@ -6872,7 +6912,7 @@ function Sf(e) {
|
|
|
6872
6912
|
return Pt(e.syncFromDom(), t), t.innerHTML;
|
|
6873
6913
|
}
|
|
6874
6914
|
function Ji(e) {
|
|
6875
|
-
return e.ensureCurrent().body.map((n, r) =>
|
|
6915
|
+
return e.ensureCurrent().body.map((n, r) => Af(e, n, r));
|
|
6876
6916
|
}
|
|
6877
6917
|
function ge(e, t) {
|
|
6878
6918
|
const r = Ji(e)[t];
|
|
@@ -6896,7 +6936,7 @@ function Tf(e) {
|
|
|
6896
6936
|
});
|
|
6897
6937
|
}), n;
|
|
6898
6938
|
}
|
|
6899
|
-
function
|
|
6939
|
+
function Af(e, t, n) {
|
|
6900
6940
|
var o;
|
|
6901
6941
|
const r = e.registry.refAt(n), i = {
|
|
6902
6942
|
index: n,
|
|
@@ -6949,7 +6989,7 @@ function Cf(e, t) {
|
|
|
6949
6989
|
const n = t === void 0 ? { type: "ins" } : { type: "ins", author: t };
|
|
6950
6990
|
return { ...e, properties: { ...e.properties, revision: n } };
|
|
6951
6991
|
}
|
|
6952
|
-
function
|
|
6992
|
+
function Ae(e, t) {
|
|
6953
6993
|
if (e.kind !== "text") return e;
|
|
6954
6994
|
const n = e.properties.revisionFormat;
|
|
6955
6995
|
if (!n) return e;
|
|
@@ -6959,7 +6999,7 @@ function Ee(e, t) {
|
|
|
6959
6999
|
}
|
|
6960
7000
|
return { ...e, properties: n.before };
|
|
6961
7001
|
}
|
|
6962
|
-
function
|
|
7002
|
+
function Ef(e, t) {
|
|
6963
7003
|
if (e.kind !== "text" || e.properties.revisionFormat) return e;
|
|
6964
7004
|
const { revisionFormat: n, ...r } = e.properties, i = t === void 0 ? { before: r } : { before: r, author: t };
|
|
6965
7005
|
return { ...e, properties: { ...e.properties, revisionFormat: i } };
|
|
@@ -7052,7 +7092,7 @@ function Qi(e, t, n, r = {}) {
|
|
|
7052
7092
|
if (e.trackChanges.enabled) {
|
|
7053
7093
|
const o = e.trackChanges.author;
|
|
7054
7094
|
return st(e, t, (s) => {
|
|
7055
|
-
const a = s.map((c) =>
|
|
7095
|
+
const a = s.map((c) => Ef(c, o));
|
|
7056
7096
|
return qe(a, n);
|
|
7057
7097
|
});
|
|
7058
7098
|
}
|
|
@@ -7262,12 +7302,12 @@ function zf(e, t, n = {}) {
|
|
|
7262
7302
|
function Uf(e, t, n = {}) {
|
|
7263
7303
|
e.ensureCurrent();
|
|
7264
7304
|
const r = e.checkRange(t, n.expect);
|
|
7265
|
-
return r || st(e, t, (i) => i.map((o) =>
|
|
7305
|
+
return r || st(e, t, (i) => i.map((o) => Ae(o, "accept")));
|
|
7266
7306
|
}
|
|
7267
7307
|
function jf(e, t, n = {}) {
|
|
7268
7308
|
e.ensureCurrent();
|
|
7269
7309
|
const r = e.checkRange(t, n.expect);
|
|
7270
|
-
return r || st(e, t, (i) => i.map((o) =>
|
|
7310
|
+
return r || st(e, t, (i) => i.map((o) => Ae(o, "reject")));
|
|
7271
7311
|
}
|
|
7272
7312
|
function Wf(e, t) {
|
|
7273
7313
|
e.ensureCurrent();
|
|
@@ -7442,7 +7482,7 @@ function ro(e, t, n) {
|
|
|
7442
7482
|
h = y[0];
|
|
7443
7483
|
}
|
|
7444
7484
|
const g = h.kind === "text" ? h.properties.revisionFormat : void 0;
|
|
7445
|
-
return g && (n === void 0 || g.author === n) && (h =
|
|
7485
|
+
return g && (n === void 0 || g.author === n) && (h = Ae(h, t), c = !0), [h];
|
|
7446
7486
|
});
|
|
7447
7487
|
let u = a;
|
|
7448
7488
|
c && (u = { ...a, runs: D(l) });
|
|
@@ -7498,7 +7538,7 @@ function Jf(e, t, n) {
|
|
|
7498
7538
|
g = x[0];
|
|
7499
7539
|
}
|
|
7500
7540
|
const S = g.kind === "text" ? g.properties.revisionFormat : void 0;
|
|
7501
|
-
return S && (n === void 0 || S.author === n) && (g =
|
|
7541
|
+
return S && (n === void 0 || S.author === n) && (g = Ae(g, t), u = !0), [g];
|
|
7502
7542
|
});
|
|
7503
7543
|
let d = u ? { ...l, runs: D(f) } : l;
|
|
7504
7544
|
const h = l.properties.revision;
|
|
@@ -7638,14 +7678,14 @@ function Zf(e) {
|
|
|
7638
7678
|
} else
|
|
7639
7679
|
S = 0;
|
|
7640
7680
|
if (x < g.length - 1 && y) {
|
|
7641
|
-
const
|
|
7681
|
+
const A = dt(e, {
|
|
7642
7682
|
block: y.block,
|
|
7643
7683
|
offset: y.offset + S
|
|
7644
7684
|
});
|
|
7645
|
-
if (!
|
|
7646
|
-
const
|
|
7647
|
-
if (!
|
|
7648
|
-
y = { block:
|
|
7685
|
+
if (!A) return;
|
|
7686
|
+
const E = Ze(e, A);
|
|
7687
|
+
if (!E.ok) return;
|
|
7688
|
+
y = { block: E.value, offset: 0 };
|
|
7649
7689
|
} else
|
|
7650
7690
|
y = y ? dt(e, {
|
|
7651
7691
|
block: y.block,
|
|
@@ -7778,7 +7818,7 @@ class rd {
|
|
|
7778
7818
|
insertRow(t, n) {
|
|
7779
7819
|
const r = this.getTable(t);
|
|
7780
7820
|
if (!r) return T({ code: "invalid-state", details: "target is not a table" });
|
|
7781
|
-
const i =
|
|
7821
|
+
const i = At(r), o = n.cells ?? pr(i);
|
|
7782
7822
|
if (o.length > i)
|
|
7783
7823
|
return T({
|
|
7784
7824
|
code: "invalid-state",
|
|
@@ -7796,13 +7836,13 @@ class rd {
|
|
|
7796
7836
|
if (n < 0 || n >= r.rows.length)
|
|
7797
7837
|
return T({ code: "invalid-position", details: `row ${n} out of range` });
|
|
7798
7838
|
const i = r.rows.slice(), o = i[n];
|
|
7799
|
-
return i.splice(n, 1), o && ud(i, n, o), i.length === 0 && i.push({ cells: pr(
|
|
7839
|
+
return i.splice(n, 1), o && ud(i, n, o), i.length === 0 && i.push({ cells: pr(At(r)) }), this.editor.replaceBlock(t, { ...r, rows: i });
|
|
7800
7840
|
}
|
|
7801
7841
|
// === column operations ===
|
|
7802
7842
|
insertColumn(t, n) {
|
|
7803
7843
|
const r = this.getTable(t);
|
|
7804
7844
|
if (!r) return T({ code: "invalid-state", details: "target is not a table" });
|
|
7805
|
-
const i =
|
|
7845
|
+
const i = At(r), o = ad(i, n);
|
|
7806
7846
|
if (o === null)
|
|
7807
7847
|
return T({ code: "invalid-position", details: "column index out of range" });
|
|
7808
7848
|
const s = n.widthTwips ?? od(r) ?? nd, a = r.grid.slice();
|
|
@@ -7813,7 +7853,7 @@ class rd {
|
|
|
7813
7853
|
deleteColumn(t, n) {
|
|
7814
7854
|
const r = this.getTable(t);
|
|
7815
7855
|
if (!r) return T({ code: "invalid-state", details: "target is not a table" });
|
|
7816
|
-
const i =
|
|
7856
|
+
const i = At(r);
|
|
7817
7857
|
if (n < 0 || n >= i)
|
|
7818
7858
|
return T({ code: "invalid-position", details: `column ${n} out of range` });
|
|
7819
7859
|
if (i === 1)
|
|
@@ -7835,7 +7875,7 @@ class rd {
|
|
|
7835
7875
|
return T({ code: "invalid-state", details: "rowSpan/colSpan must be ≥ 1" });
|
|
7836
7876
|
if (i === 1 && o === 1)
|
|
7837
7877
|
return T({ code: "invalid-state", details: "merge target is a single cell" });
|
|
7838
|
-
const s =
|
|
7878
|
+
const s = At(r);
|
|
7839
7879
|
if (n.row < 0 || n.col < 0 || n.row + i > r.rows.length || n.col + o > s)
|
|
7840
7880
|
return T({ code: "invalid-position", details: "merge region out of range" });
|
|
7841
7881
|
for (let c = n.row; c < n.row + i; c++)
|
|
@@ -7914,7 +7954,7 @@ class rd {
|
|
|
7914
7954
|
return a[s.cellIndex] = n(s.cell), i[t.row] = { ...o, cells: a }, this.editor.replaceBlock(t.table, { ...r, rows: i });
|
|
7915
7955
|
}
|
|
7916
7956
|
}
|
|
7917
|
-
function
|
|
7957
|
+
function At(e) {
|
|
7918
7958
|
return Math.max(
|
|
7919
7959
|
e.grid.length,
|
|
7920
7960
|
...e.rows.map((t) => t.cells.reduce((n, r) => n + (r.gridSpan ?? 1), 0))
|
|
@@ -8445,7 +8485,7 @@ function wr(e, t) {
|
|
|
8445
8485
|
runs: Ft(e)
|
|
8446
8486
|
};
|
|
8447
8487
|
}
|
|
8448
|
-
function
|
|
8488
|
+
function Ad(e) {
|
|
8449
8489
|
const t = { numbering: [], currentList: null }, n = [];
|
|
8450
8490
|
for (const r of e)
|
|
8451
8491
|
n.push(...Td(Array.from(r.childNodes), t));
|
|
@@ -8473,7 +8513,7 @@ function Cd(e) {
|
|
|
8473
8513
|
c();
|
|
8474
8514
|
return;
|
|
8475
8515
|
}
|
|
8476
|
-
a(), t = u, u.classList.add("is-selected"), n =
|
|
8516
|
+
a(), t = u, u.classList.add("is-selected"), n = Ed(), e.appendChild(n), n.addEventListener("mousedown", l), c();
|
|
8477
8517
|
}, a = () => {
|
|
8478
8518
|
t && t.classList.remove("is-selected"), t = null, n && (n.removeEventListener("mousedown", l), n.remove(), n = null);
|
|
8479
8519
|
}, c = () => {
|
|
@@ -8484,12 +8524,12 @@ function Cd(e) {
|
|
|
8484
8524
|
if (!t) return;
|
|
8485
8525
|
u.preventDefault(), u.stopPropagation();
|
|
8486
8526
|
const f = t, d = u.clientX, h = u.clientY, p = f.getBoundingClientRect().width, g = f.getBoundingClientRect().height, y = p > 0 && g > 0 ? p / g : 1, S = (v) => {
|
|
8487
|
-
let
|
|
8527
|
+
let A = Math.max(20, p + (v.clientX - d)), E = Math.max(20, g + (v.clientY - h));
|
|
8488
8528
|
if (!v.shiftKey) {
|
|
8489
|
-
const I = Math.abs(
|
|
8490
|
-
I >= F ?
|
|
8529
|
+
const I = Math.abs(A - p), F = Math.abs(E - g);
|
|
8530
|
+
I >= F ? E = A / y : A = E * y;
|
|
8491
8531
|
}
|
|
8492
|
-
f.style.width = `${Math.round(
|
|
8532
|
+
f.style.width = `${Math.round(A)}px`, f.style.height = `${Math.round(E)}px`, c();
|
|
8493
8533
|
}, x = () => {
|
|
8494
8534
|
window.removeEventListener("mousemove", S), window.removeEventListener("mouseup", x), e.dispatchEvent(new Event("input", { bubbles: !0 }));
|
|
8495
8535
|
};
|
|
@@ -8499,7 +8539,7 @@ function Cd(e) {
|
|
|
8499
8539
|
a(), e.removeEventListener("click", r), window.removeEventListener("scroll", i, { capture: !0 }), window.removeEventListener("resize", o);
|
|
8500
8540
|
};
|
|
8501
8541
|
}
|
|
8502
|
-
function
|
|
8542
|
+
function Ed() {
|
|
8503
8543
|
const e = document.createElement("div");
|
|
8504
8544
|
return e.className = "sobree-image-resize-handle", e.setAttribute("contenteditable", "false"), e;
|
|
8505
8545
|
}
|
|
@@ -9197,7 +9237,7 @@ class Pd {
|
|
|
9197
9237
|
return this.domDirty ? this.syncFromDom() : this.doc;
|
|
9198
9238
|
}
|
|
9199
9239
|
syncFromDom() {
|
|
9200
|
-
const t =
|
|
9240
|
+
const t = Ad(this.getContentHosts()), n = this.registry.length(), r = t.body.length;
|
|
9201
9241
|
if (r !== n)
|
|
9202
9242
|
this.registry.reset(r);
|
|
9203
9243
|
else {
|
|
@@ -9677,7 +9717,7 @@ function Zd(e) {
|
|
|
9677
9717
|
const i = e[r];
|
|
9678
9718
|
if (!i) continue;
|
|
9679
9719
|
const o = getComputedStyle(i), s = o.position === "absolute" || o.position === "fixed", a = s ? 0 : Math.max(0, i.offsetTop - n);
|
|
9680
|
-
(r > 0 || a > 0) && t.push({ type: "glue", height: a }), oh(i) ? (t.push({ type: "penalty", cost: Number.NEGATIVE_INFINITY }), t.push({ type: "box", height: 0, el: i, monolithic: !0 })) : sh(i) ? (
|
|
9720
|
+
(r > 0 || a > 0) && t.push({ type: "glue", height: a }), oh(i) ? (t.push({ type: "penalty", cost: Number.NEGATIVE_INFINITY }), t.push({ type: "box", height: 0, el: i, monolithic: !0 })) : sh(i) ? (Et(i) && t.push({ type: "penalty", cost: Number.NEGATIVE_INFINITY }), t.push(at(i, { monolithic: !0 }))) : i.tagName === "P" ? (Et(i) && t.push({ type: "penalty", cost: Number.NEGATIVE_INFINITY }), t.push(...lo(i, ao(i)))) : i.tagName === "OL" || i.tagName === "UL" ? (Et(i) && t.push({ type: "penalty", cost: Number.NEGATIVE_INFINITY }), t.push(...rh(i, Qd(i)))) : i.tagName === "TABLE" ? (Et(i) && t.push({ type: "penalty", cost: Number.NEGATIVE_INFINITY }), t.push(...eh(i, th(i)))) : (Et(i) && t.push({ type: "penalty", cost: Number.NEGATIVE_INFINITY }), t.push(at(i, ih(i)))), s || (n = i.offsetTop + i.offsetHeight);
|
|
9681
9721
|
}
|
|
9682
9722
|
return t;
|
|
9683
9723
|
}
|
|
@@ -9819,7 +9859,7 @@ function gn(e) {
|
|
|
9819
9859
|
function oh(e) {
|
|
9820
9860
|
return e.classList.contains("page-break") || e.hasAttribute("data-page-break");
|
|
9821
9861
|
}
|
|
9822
|
-
function
|
|
9862
|
+
function Et(e) {
|
|
9823
9863
|
return e.hasAttribute("data-page-break-before");
|
|
9824
9864
|
}
|
|
9825
9865
|
function sh(e) {
|
|
@@ -9873,12 +9913,12 @@ function lh(e) {
|
|
|
9873
9913
|
let x;
|
|
9874
9914
|
if (S.lineIndex !== void 0 ? x = ((c = n.get(S.el)) == null ? void 0 : c.get(l)) ?? S.el : x = S.el, !u.has(x)) {
|
|
9875
9915
|
if (u.add(x), S.cellTr) {
|
|
9876
|
-
const v = S.cellTr,
|
|
9877
|
-
if (!
|
|
9916
|
+
const v = S.cellTr, A = v.closest("table"), E = A == null ? void 0 : A.querySelector(":scope > tbody");
|
|
9917
|
+
if (!A || !E) {
|
|
9878
9918
|
f.push(x), d = null, h = null, p = null, g = null;
|
|
9879
9919
|
continue;
|
|
9880
9920
|
}
|
|
9881
|
-
|
|
9921
|
+
A !== d && (h = xr(A), f.push(h), d = A, o.add(A), p = null, g = null), v !== p && (g = fh(v), h.querySelector(":scope > tbody").appendChild(g), p = v, s.add(v));
|
|
9882
9922
|
const I = x.closest("td, th");
|
|
9883
9923
|
if (!I) {
|
|
9884
9924
|
f.push(x);
|
|
@@ -9905,20 +9945,20 @@ function lh(e) {
|
|
|
9905
9945
|
continue;
|
|
9906
9946
|
}
|
|
9907
9947
|
if (v !== d) {
|
|
9908
|
-
const
|
|
9909
|
-
h = hh(v,
|
|
9948
|
+
const A = r.get(x) ?? uo(v);
|
|
9949
|
+
h = hh(v, A), f.push(h), d = v, o.add(v);
|
|
9910
9950
|
}
|
|
9911
9951
|
x.dataset.pagContinuation === "1" ? x.classList.add("sobree-li-continuation") : x.classList.remove("sobree-li-continuation"), h.appendChild(x);
|
|
9912
9952
|
} else if (x.tagName === "TR" && !S.cellTr) {
|
|
9913
|
-
const v = x.parentElement,
|
|
9914
|
-
if (!
|
|
9953
|
+
const v = x.parentElement, A = v == null ? void 0 : v.closest("table");
|
|
9954
|
+
if (!A) {
|
|
9915
9955
|
f.push(x), d = null, h = null;
|
|
9916
9956
|
continue;
|
|
9917
9957
|
}
|
|
9918
|
-
|
|
9919
|
-
const
|
|
9958
|
+
A !== d && (h = xr(A), f.push(h), d = A, o.add(A));
|
|
9959
|
+
const E = (v == null ? void 0 : v.tagName) === "THEAD";
|
|
9920
9960
|
let I;
|
|
9921
|
-
if (
|
|
9961
|
+
if (E) {
|
|
9922
9962
|
let F = h.querySelector(":scope > thead");
|
|
9923
9963
|
F || (F = document.createElement("thead"), h.insertBefore(F, h.firstChild)), I = F;
|
|
9924
9964
|
} else
|
|
@@ -10122,7 +10162,7 @@ function Th(e, t, n) {
|
|
|
10122
10162
|
const r = e.getBoundingClientRect().top - t.getBoundingClientRect().top;
|
|
10123
10163
|
return r > 0 ? r % n : 0;
|
|
10124
10164
|
}
|
|
10125
|
-
function
|
|
10165
|
+
function Ah(e, t, n) {
|
|
10126
10166
|
const r = bh(e);
|
|
10127
10167
|
if (!r) return;
|
|
10128
10168
|
const i = be(e);
|
|
@@ -10143,9 +10183,9 @@ function Eh(e, t, n) {
|
|
|
10143
10183
|
function Ch(e, t) {
|
|
10144
10184
|
const n = Array.from(e.querySelectorAll(".sobree-cols"));
|
|
10145
10185
|
for (const r of kh(n))
|
|
10146
|
-
|
|
10186
|
+
Ah(r, e, t);
|
|
10147
10187
|
}
|
|
10148
|
-
function
|
|
10188
|
+
function Eh(e, t) {
|
|
10149
10189
|
return {
|
|
10150
10190
|
xEmu: Ph(e, t) + e.offsetXEmu,
|
|
10151
10191
|
yEmu: Nh(e, t) + e.offsetYEmu
|
|
@@ -10287,7 +10327,7 @@ function Dh(e) {
|
|
|
10287
10327
|
return "application/octet-stream";
|
|
10288
10328
|
}
|
|
10289
10329
|
}
|
|
10290
|
-
function
|
|
10330
|
+
function Ar(e, t) {
|
|
10291
10331
|
if (e.replaceChildren(), t.blocks.length === 0) {
|
|
10292
10332
|
e.classList.add("is-empty");
|
|
10293
10333
|
return;
|
|
@@ -10391,7 +10431,7 @@ class _h {
|
|
|
10391
10431
|
}
|
|
10392
10432
|
applySetup(t) {
|
|
10393
10433
|
const { widthMM: n, heightMM: r } = qr(t), i = t.margins, o = this.root.style;
|
|
10394
|
-
o.width = `${n}mm`, o.height = `${r}mm`, o.setProperty("--margin-top", `${i.top}mm`), o.setProperty("--margin-right", `${i.right}mm`), o.setProperty("--margin-bottom", `${i.bottom}mm`), o.setProperty("--margin-left", `${i.left}mm`),
|
|
10434
|
+
o.width = `${n}mm`, o.height = `${r}mm`, o.setProperty("--margin-top", `${i.top}mm`), o.setProperty("--margin-right", `${i.right}mm`), o.setProperty("--margin-bottom", `${i.bottom}mm`), o.setProperty("--margin-left", `${i.left}mm`), Er(this.content, t.verticalAlign);
|
|
10395
10435
|
}
|
|
10396
10436
|
/**
|
|
10397
10437
|
* Apply per-section settings on top of the base PageSetup. Currently
|
|
@@ -10400,7 +10440,7 @@ class _h {
|
|
|
10400
10440
|
* PaperStack after pagination distributes content.
|
|
10401
10441
|
*/
|
|
10402
10442
|
applySectionOverride(t) {
|
|
10403
|
-
|
|
10443
|
+
Er(this.content, t.vAlign);
|
|
10404
10444
|
const n = t.pageMargins;
|
|
10405
10445
|
if ((n == null ? void 0 : n.headerTwips) !== void 0) {
|
|
10406
10446
|
const r = n.headerTwips / 1440 * 25.4;
|
|
@@ -10418,10 +10458,10 @@ class _h {
|
|
|
10418
10458
|
* substituted with this paper's page number / the total count.
|
|
10419
10459
|
*/
|
|
10420
10460
|
setHeaderBlocks(t) {
|
|
10421
|
-
|
|
10461
|
+
Ar(this.header, t), this.applyZoneOverflowPadding();
|
|
10422
10462
|
}
|
|
10423
10463
|
setFooterBlocks(t) {
|
|
10424
|
-
|
|
10464
|
+
Ar(this.footer, t), this.applyZoneOverflowPadding();
|
|
10425
10465
|
}
|
|
10426
10466
|
/**
|
|
10427
10467
|
* Paint the header zone's floating frames. Resolved against the header
|
|
@@ -10473,7 +10513,7 @@ class _h {
|
|
|
10473
10513
|
);
|
|
10474
10514
|
l && (s = zh(l, this.root) * ie);
|
|
10475
10515
|
}
|
|
10476
|
-
const { xEmu: a, yEmu: c } =
|
|
10516
|
+
const { xEmu: a, yEmu: c } = Eh(o, {
|
|
10477
10517
|
marginTopEmu: r,
|
|
10478
10518
|
marginLeftEmu: i,
|
|
10479
10519
|
anchorParaTopEmu: s
|
|
@@ -10558,7 +10598,7 @@ function ee(e) {
|
|
|
10558
10598
|
}
|
|
10559
10599
|
return 0;
|
|
10560
10600
|
}
|
|
10561
|
-
function
|
|
10601
|
+
function Er(e, t) {
|
|
10562
10602
|
t === "center" || t === "bottom" || t === "both" ? (e.style.display = "flex", e.style.flexDirection = "column", e.style.justifyContent = jh(t)) : (e.style.display = "", e.style.flexDirection = "", e.style.justifyContent = "");
|
|
10563
10603
|
}
|
|
10564
10604
|
function jh(e) {
|
|
@@ -11066,7 +11106,7 @@ function ep(e) {
|
|
|
11066
11106
|
const i = e.getDocument(), o = i.sections.slice(), s = o.length - 1, a = o[s];
|
|
11067
11107
|
a && (o.push(structuredClone(a)), e.setDocument({ ...i, sections: o }));
|
|
11068
11108
|
}
|
|
11069
|
-
const np = "0.1.
|
|
11109
|
+
const np = "0.1.22", rp = np;
|
|
11070
11110
|
function ip(e = document) {
|
|
11071
11111
|
const t = e.createElement("div");
|
|
11072
11112
|
return t.className = "sobree-version-badge", t.textContent = `@sobree/core v${rp}`, t.setAttribute("aria-hidden", "true"), Object.assign(t.style, {
|
|
@@ -12066,7 +12106,7 @@ export {
|
|
|
12066
12106
|
op as Sobree,
|
|
12067
12107
|
rp as VERSION,
|
|
12068
12108
|
js as Viewport,
|
|
12069
|
-
|
|
12109
|
+
Ee as appendBlock,
|
|
12070
12110
|
Bi as applyDocumentToYDoc,
|
|
12071
12111
|
mp as attachPresence,
|
|
12072
12112
|
Gp as attachPresenceOverlay,
|
|
@@ -12083,7 +12123,7 @@ export {
|
|
|
12083
12123
|
on as defaultStyles,
|
|
12084
12124
|
xo as deobfuscate,
|
|
12085
12125
|
jo as embedFontIntoDoc,
|
|
12086
|
-
|
|
12126
|
+
Ap as emphasis,
|
|
12087
12127
|
rn as emptyDocument,
|
|
12088
12128
|
Xp as enterZoneEdit,
|
|
12089
12129
|
jp as fetchBlobStore,
|
|
@@ -12112,13 +12152,13 @@ export {
|
|
|
12112
12152
|
Ir as presenceSelectionFromEditor,
|
|
12113
12153
|
de as projectYDoc,
|
|
12114
12154
|
tr as rangeAtSelection,
|
|
12115
|
-
|
|
12155
|
+
Eo as readFsType,
|
|
12116
12156
|
Wo as removeFontFromDoc,
|
|
12117
12157
|
bi as resolveStyleCascade,
|
|
12118
12158
|
vp as sectionBreak,
|
|
12119
12159
|
Ni as seedYDoc,
|
|
12120
12160
|
cn as sha256Hex,
|
|
12121
|
-
|
|
12161
|
+
Ep as softBreak,
|
|
12122
12162
|
Cp as strong,
|
|
12123
12163
|
Ip as tab,
|
|
12124
12164
|
Dp as table,
|