@algorisys/yappydraw 0.8.295 → 0.8.296
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/README.md +2 -2
- package/chunks/{canva-ai-kg789_jz.js → canva-ai-CkUlVY-Y.js} +1 -1
- package/chunks/{choice-dialog-state-ByeMPVwB.js → choice-dialog-state-BUFvjtpq.js} +1 -1
- package/chunks/{custgeom-CEAI2znd.js → custgeom-DThQ1Qnp.js} +1 -1
- package/chunks/{design-generator-zF-F-iCB.js → design-generator-BlrBbMDM.js} +1 -1
- package/chunks/{drawing-engine-U5zBcwtj.js → drawing-engine-KJLwmUE-.js} +1 -1
- package/chunks/{drawings-store-CZSZCNqP.js → drawings-store-CiDEeh5h.js} +1 -1
- package/chunks/{ds-operations-_c-HiYjk.js → ds-operations-C27tW9qb.js} +1 -1
- package/chunks/{export-game-CgMvNkoa.js → export-game-Bcz0A67O.js} +1 -1
- package/chunks/{from-yappy-Dd2p9P6N.js → from-yappy-lL1q0m9y.js} +4 -2
- package/chunks/{game-runtime-CH3yVPDc.js → game-runtime-RZ6Ygr7N.js} +5 -5
- package/chunks/{import-C3P7glRz.js → import-DFZ1uZOp.js} +198 -188
- package/chunks/{index-B_V19zDs.js → index-NbpsufU1.js} +23202 -23027
- package/chunks/{lucide-solid-DfQVDBtM.js → lucide-solid-DL_MnmQm.js} +1 -1
- package/chunks/{markdown-to-slides-B5OASdqg.js → markdown-to-slides-D9CoIzTi.js} +1 -1
- package/chunks/{morph-animator-b1aFWI5O.js → morph-animator-C_rDbafN.js} +1 -1
- package/chunks/{onboarding-tour-j-RhQYNM.js → onboarding-tour-B1fDeTqe.js} +1 -1
- package/chunks/{pdf-vector-CzrRoyPR.js → pdf-vector-ByOSpRwK.js} +1 -1
- package/chunks/{search-B7AUhYCm.js → search-MWY5OrgG.js} +2 -2
- package/chunks/{slide-generator-AO60zi1f.js → slide-generator-8-amet_R.js} +1 -1
- package/chunks/{turntable-ai-DddsPGTo.js → turntable-ai-DgSAtAc8.js} +1 -1
- package/chunks/{write-uweO04Cm.js → write-B1-j7TNq.js} +72 -72
- package/package.json +1 -1
- package/yappy.js +1 -1
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { u as fe, a as de } from "./browser-DbZP-BrN.js";
|
|
2
|
-
import { E as z, i as Ct, g as ue } from "./custgeom-
|
|
3
|
-
import { aq as he, ar as Lt, as as pe, at as me, M as ge, q as xe, K as be } from "./index-
|
|
2
|
+
import { E as z, i as Ct, g as ue } from "./custgeom-DThQ1Qnp.js";
|
|
3
|
+
import { aq as he, ar as Lt, as as pe, at as me, M as ge, q as xe, K as be } from "./index-NbpsufU1.js";
|
|
4
4
|
const ye = 1e4, ke = 1e5, qt = 6e4, nt = (t) => t / qt * (Math.PI / 180);
|
|
5
5
|
function Zt(t, n, e, o = {}) {
|
|
6
|
-
const s = /* @__PURE__ */ new Map(), r = Math.max(0, n), a = Math.max(0, e), i = Math.min(r, a), l = Math.max(r, a),
|
|
6
|
+
const s = /* @__PURE__ */ new Map(), r = Math.max(0, n), a = Math.max(0, e), i = Math.min(r, a), l = Math.max(r, a), g = {
|
|
7
7
|
w: r,
|
|
8
8
|
h: a,
|
|
9
9
|
l: 0,
|
|
@@ -22,12 +22,12 @@ function Zt(t, n, e, o = {}) {
|
|
|
22
22
|
"5cd8": 135e5,
|
|
23
23
|
"7cd8": 189e5
|
|
24
24
|
};
|
|
25
|
-
for (const [m,
|
|
25
|
+
for (const [m, x] of Object.entries(g)) s.set(m, x);
|
|
26
26
|
for (const m of [2, 3, 4, 5, 6, 8, 10, 12, 16, 32])
|
|
27
27
|
s.set(`wd${m}`, r / m), s.set(`hd${m}`, a / m), s.set(`ssd${m}`, i / m);
|
|
28
28
|
const b = (m) => {
|
|
29
|
-
const
|
|
30
|
-
if (
|
|
29
|
+
const x = s.get(m);
|
|
30
|
+
if (x !== void 0) return x;
|
|
31
31
|
const f = /^(wd|hd|ssd)(\d+)$/.exec(m);
|
|
32
32
|
if (f) {
|
|
33
33
|
const y = f[1] === "wd" ? r : f[1] === "hd" ? a : i, u = Number(f[2]);
|
|
@@ -35,12 +35,12 @@ function Zt(t, n, e, o = {}) {
|
|
|
35
35
|
}
|
|
36
36
|
const h = Number(m);
|
|
37
37
|
return Number.isFinite(h) ? h : 0;
|
|
38
|
-
}, d = (m,
|
|
39
|
-
s.size > ye || s.set(m, we(
|
|
38
|
+
}, d = (m, x) => {
|
|
39
|
+
s.size > ye || s.set(m, we(x, b));
|
|
40
40
|
};
|
|
41
|
-
for (const [m,
|
|
42
|
-
for (const [m,
|
|
43
|
-
for (const [m,
|
|
41
|
+
for (const [m, x] of t.av ?? []) d(m, o[m] ?? x);
|
|
42
|
+
for (const [m, x] of Object.entries(o)) s.has(m) || d(m, x);
|
|
43
|
+
for (const [m, x] of t.gd ?? []) d(m, x);
|
|
44
44
|
return s;
|
|
45
45
|
}
|
|
46
46
|
function we(t, n) {
|
|
@@ -106,26 +106,26 @@ function we(t, n) {
|
|
|
106
106
|
const Et = (t, n, e) => Math.atan2(n * Math.sin(t), e * Math.cos(t));
|
|
107
107
|
function ft(t, n, e, o = {}) {
|
|
108
108
|
const s = Math.max(Math.abs(n), 0) * z, r = Math.max(Math.abs(e), 0) * z, a = Zt(t, s, r, o), i = (b) => typeof b == "number" ? b : a.get(b) ?? (Number.isFinite(Number(b)) ? Number(b) : 0), l = [];
|
|
109
|
-
let
|
|
109
|
+
let g = ke;
|
|
110
110
|
for (const b of t.paths) {
|
|
111
|
-
const d = b.w ? s / b.w : 1, m = b.h ? r / b.h : 1,
|
|
111
|
+
const d = b.w ? s / b.w : 1, m = b.h ? r / b.h : 1, x = (p) => i(p) * d / z, f = (p) => i(p) * m / z, h = [];
|
|
112
112
|
let y = { x: 0, y: 0 }, u = { x: 0, y: 0 };
|
|
113
113
|
for (const p of b.d) {
|
|
114
|
-
if (--
|
|
114
|
+
if (--g < 0) break;
|
|
115
115
|
switch (p[0]) {
|
|
116
116
|
case "M":
|
|
117
|
-
y = { x:
|
|
117
|
+
y = { x: x(p[1]), y: f(p[2]) }, u = y, h.push({ op: "M", ...y });
|
|
118
118
|
break;
|
|
119
119
|
case "L":
|
|
120
|
-
y = { x:
|
|
120
|
+
y = { x: x(p[1]), y: f(p[2]) }, h.push({ op: "L", ...y });
|
|
121
121
|
break;
|
|
122
122
|
case "C": {
|
|
123
|
-
const w =
|
|
124
|
-
y = { x:
|
|
123
|
+
const w = x(p[1]), M = f(p[2]), S = x(p[3]), v = f(p[4]);
|
|
124
|
+
y = { x: x(p[5]), y: f(p[6]) }, h.push({ op: "C", x1: w, y1: M, x2: S, y2: v, ...y });
|
|
125
125
|
break;
|
|
126
126
|
}
|
|
127
127
|
case "Q": {
|
|
128
|
-
const w =
|
|
128
|
+
const w = x(p[1]), M = f(p[2]), S = x(p[3]), v = f(p[4]);
|
|
129
129
|
h.push({ op: "C", x1: y.x + 2 / 3 * (w - y.x), y1: y.y + 2 / 3 * (M - y.y), x2: S + 2 / 3 * (w - S), y2: v + 2 / 3 * (M - v), x: S, y: v }), y = { x: S, y: v };
|
|
130
130
|
break;
|
|
131
131
|
}
|
|
@@ -146,15 +146,15 @@ function ft(t, n, e, o = {}) {
|
|
|
146
146
|
function Me(t, n, e, o, s, r) {
|
|
147
147
|
if (Math.abs(e) < 1e-9 || Math.abs(o) < 1e-9 || r === 0) return n;
|
|
148
148
|
const a = nt(s), i = Math.max(-4 * Math.PI, Math.min(4 * Math.PI, nt(r))), l = Et(a, e, o);
|
|
149
|
-
let
|
|
150
|
-
if (Math.abs(i) >= 2 * Math.PI - 1e-9)
|
|
149
|
+
let g = Et(a + i, e, o);
|
|
150
|
+
if (Math.abs(i) >= 2 * Math.PI - 1e-9) g = l + Math.sign(i) * 2 * Math.PI;
|
|
151
151
|
else {
|
|
152
|
-
for (; i > 0 &&
|
|
153
|
-
for (; i < 0 &&
|
|
152
|
+
for (; i > 0 && g < l; ) g += 2 * Math.PI;
|
|
153
|
+
for (; i < 0 && g > l; ) g -= 2 * Math.PI;
|
|
154
154
|
}
|
|
155
|
-
const b = n.x - e * Math.cos(l), d = n.y - o * Math.sin(l), m =
|
|
155
|
+
const b = n.x - e * Math.cos(l), d = n.y - o * Math.sin(l), m = g - l, x = Math.max(1, Math.min(16, Math.ceil(Math.abs(m) / (Math.PI / 2)))), f = m / x, h = 4 / 3 * Math.tan(f / 4);
|
|
156
156
|
let y = l, u = n;
|
|
157
|
-
for (let p = 0; p <
|
|
157
|
+
for (let p = 0; p < x; p++) {
|
|
158
158
|
const w = y + f, M = Math.cos(y), S = Math.sin(y), v = Math.cos(w), N = Math.sin(w);
|
|
159
159
|
u = { x: b + e * v, y: d + o * N }, t.push({ op: "C", x1: b + e * (M - h * S), y1: d + o * (S + h * M), x2: b + e * (v + h * N), y2: d + o * (N - h * v), ...u }), y = w;
|
|
160
160
|
}
|
|
@@ -163,8 +163,8 @@ function Me(t, n, e, o, s, r) {
|
|
|
163
163
|
function Kt(t, n, e, o = {}) {
|
|
164
164
|
const s = Math.abs(n), r = Math.abs(e);
|
|
165
165
|
if (!t.rect) return { l: 0, t: 0, r: s, b: r };
|
|
166
|
-
const a = Zt(t, s * z, r * z, o), i = (m) => (a.get(m) ?? (Number.isFinite(Number(m)) ? Number(m) : 0)) / z, [l,
|
|
167
|
-
return { l, t:
|
|
166
|
+
const a = Zt(t, s * z, r * z, o), i = (m) => (a.get(m) ?? (Number.isFinite(Number(m)) ? Number(m) : 0)) / z, [l, g, b, d] = t.rect.map(i);
|
|
167
|
+
return { l, t: g, r: b, b: d };
|
|
168
168
|
}
|
|
169
169
|
let Ft = null;
|
|
170
170
|
async function ve() {
|
|
@@ -180,7 +180,7 @@ const jt = 5e4, Se = 256 * 1024 * 1024, Dt = 1024 * 1024 * 1024, Ce = 1e4, Pe =
|
|
|
180
180
|
if (!t) return null;
|
|
181
181
|
for (let e = t.firstChild; e; e = e.nextSibling) if (e.nodeType === 1 && e.localName === n) return e;
|
|
182
182
|
return null;
|
|
183
|
-
},
|
|
183
|
+
}, A = (t, ...n) => {
|
|
184
184
|
let e = t;
|
|
185
185
|
for (const o of n) e = c(e, o);
|
|
186
186
|
return e ?? null;
|
|
@@ -247,10 +247,10 @@ class Oe {
|
|
|
247
247
|
o = /* @__PURE__ */ new Map();
|
|
248
248
|
const s = e.includes("/") ? e.slice(0, e.lastIndexOf("/")) : "", r = e.slice(e.lastIndexOf("/") + 1), a = this.xml(`${s ? s + "/" : ""}_rels/${r}.rels`);
|
|
249
249
|
for (const i of I(a, "Relationship")) {
|
|
250
|
-
const l = k(i, "Id"),
|
|
250
|
+
const l = k(i, "Id"), g = k(i, "Type") || "", b = k(i, "Target") || "";
|
|
251
251
|
if (!l) continue;
|
|
252
252
|
const d = k(i, "TargetMode") === "External";
|
|
253
|
-
o.set(l, { type:
|
|
253
|
+
o.set(l, { type: g.slice(g.lastIndexOf("/") + 1), target: d ? b : Ae(s, b), external: d });
|
|
254
254
|
}
|
|
255
255
|
return this.relCache.set(e, o), o;
|
|
256
256
|
}
|
|
@@ -260,7 +260,7 @@ class Oe {
|
|
|
260
260
|
}
|
|
261
261
|
}
|
|
262
262
|
const et = (t) => t.replace(/\\/g, "/").replace(/^\/+/, "");
|
|
263
|
-
function
|
|
263
|
+
function Ae(t, n) {
|
|
264
264
|
let e = n.split("#")[0];
|
|
265
265
|
try {
|
|
266
266
|
e = decodeURIComponent(e);
|
|
@@ -282,11 +282,11 @@ function gt(t) {
|
|
|
282
282
|
i && /^[0-9a-f]{6}$/i.test(i) && (n.colors[r.localName] = "#" + i.toLowerCase());
|
|
283
283
|
}
|
|
284
284
|
const o = c(e, "fontScheme");
|
|
285
|
-
n.major = k(
|
|
285
|
+
n.major = k(A(o, "majorFont", "latin"), "typeface") || n.major, n.minor = k(A(o, "minorFont", "latin"), "typeface") || n.minor;
|
|
286
286
|
const s = c(e, "fmtScheme");
|
|
287
287
|
return n.fills = I(c(s, "fillStyleLst")), n.lines = I(c(s, "lnStyleLst")), n.bgFills = I(c(s, "bgFillStyleLst")), n;
|
|
288
288
|
}
|
|
289
|
-
const
|
|
289
|
+
const Re = {
|
|
290
290
|
black: "#000000",
|
|
291
291
|
white: "#ffffff",
|
|
292
292
|
red: "#ff0000",
|
|
@@ -345,14 +345,14 @@ function Le(t, n) {
|
|
|
345
345
|
break;
|
|
346
346
|
}
|
|
347
347
|
case "prstClr":
|
|
348
|
-
e =
|
|
348
|
+
e = Re[k(t, "val") || ""] ?? "#000000";
|
|
349
349
|
break;
|
|
350
350
|
case "scrgbClr":
|
|
351
351
|
e = ct(U(C(t, "r") / 1e5), U(C(t, "g") / 1e5), U(C(t, "b") / 1e5));
|
|
352
352
|
break;
|
|
353
353
|
case "hslClr": {
|
|
354
|
-
const [l,
|
|
355
|
-
e = ct(l,
|
|
354
|
+
const [l, g, b] = xt(C(t, "hue") / 6e4, C(t, "sat") / 1e5, C(t, "lum") / 1e5);
|
|
355
|
+
e = ct(l, g, b);
|
|
356
356
|
break;
|
|
357
357
|
}
|
|
358
358
|
case "schemeClr": {
|
|
@@ -361,24 +361,24 @@ function Le(t, n) {
|
|
|
361
361
|
n.phClr ? (e = n.phClr.hex, o = n.phClr.alpha ?? 1) : e = n.theme.colors.accent1 ?? "#4472c4";
|
|
362
362
|
break;
|
|
363
363
|
}
|
|
364
|
-
const
|
|
365
|
-
e = n.theme.colors[
|
|
364
|
+
const g = n.clrMap[l] ?? Pt[l] ?? l;
|
|
365
|
+
e = n.theme.colors[g] ?? null;
|
|
366
366
|
break;
|
|
367
367
|
}
|
|
368
368
|
}
|
|
369
369
|
if (!e) return null;
|
|
370
370
|
let [s, r, a] = Qt(e);
|
|
371
371
|
for (const l of I(t)) {
|
|
372
|
-
const
|
|
372
|
+
const g = C(l, "val") / 1e5;
|
|
373
373
|
switch (l.localName) {
|
|
374
374
|
case "alpha":
|
|
375
|
-
o =
|
|
375
|
+
o = g;
|
|
376
376
|
break;
|
|
377
377
|
case "alphaMod":
|
|
378
|
-
o *=
|
|
378
|
+
o *= g;
|
|
379
379
|
break;
|
|
380
380
|
case "alphaOff":
|
|
381
|
-
o +=
|
|
381
|
+
o += g;
|
|
382
382
|
break;
|
|
383
383
|
case "lumMod":
|
|
384
384
|
case "lumOff":
|
|
@@ -387,14 +387,14 @@ function Le(t, n) {
|
|
|
387
387
|
case "hueMod":
|
|
388
388
|
case "hueOff": {
|
|
389
389
|
let [b, d, m] = $t(s, r, a);
|
|
390
|
-
l.localName === "lumMod" ? m *=
|
|
390
|
+
l.localName === "lumMod" ? m *= g : l.localName === "lumOff" ? m += g : l.localName === "satMod" ? d *= g : l.localName === "satOff" ? d += g : l.localName === "hueMod" ? b *= g : b += C(l, "val") / 6e4, [s, r, a] = xt(b, Math.max(0, Math.min(1, d)), Math.max(0, Math.min(1, m)));
|
|
391
391
|
break;
|
|
392
392
|
}
|
|
393
393
|
case "tint":
|
|
394
|
-
[s, r, a] = [s, r, a].map((b) => U(ot(b) *
|
|
394
|
+
[s, r, a] = [s, r, a].map((b) => U(ot(b) * g + (1 - g)));
|
|
395
395
|
break;
|
|
396
396
|
case "shade":
|
|
397
|
-
[s, r, a] = [s, r, a].map((b) => U(ot(b) *
|
|
397
|
+
[s, r, a] = [s, r, a].map((b) => U(ot(b) * g));
|
|
398
398
|
break;
|
|
399
399
|
case "comp": {
|
|
400
400
|
const [b, d, m] = $t(s, r, a);
|
|
@@ -485,8 +485,8 @@ function G(t, n) {
|
|
|
485
485
|
const s = (i) => {
|
|
486
486
|
const l = k(i, "type");
|
|
487
487
|
if (!l || l === "none") return;
|
|
488
|
-
const
|
|
489
|
-
return { type:
|
|
488
|
+
const g = l === "triangle" || l === "stealth" || l === "arrow" || l === "oval" || l === "diamond" ? l : "triangle", b = k(i, "len") || k(i, "w");
|
|
489
|
+
return { type: g, size: b === "sm" || b === "lg" ? b : "med" };
|
|
490
490
|
}, r = Fe[k(c(t, "prstDash"), "val") || "solid"], a = k(t, "cap");
|
|
491
491
|
return {
|
|
492
492
|
// ECMA's default is 9525 EMU — 0.75 pt, one px.
|
|
@@ -536,14 +536,14 @@ const bt = (t) => t;
|
|
|
536
536
|
function je(t, n) {
|
|
537
537
|
const e = W(t);
|
|
538
538
|
if (!e) return n;
|
|
539
|
-
const o = c(t, "chOff"), s = c(t, "chExt"), r = o ? E(C(o, "x")) : e.x, a = o ? E(C(o, "y")) : e.y, i = s ? E(C(s, "cx")) : e.w, l = s ? E(C(s, "cy")) : e.h,
|
|
539
|
+
const o = c(t, "chOff"), s = c(t, "chExt"), r = o ? E(C(o, "x")) : e.x, a = o ? E(C(o, "y")) : e.y, i = s ? E(C(s, "cx")) : e.w, l = s ? E(C(s, "cy")) : e.h, g = i > 0 ? e.w / i : 1, b = l > 0 ? e.h / l : 1, d = e.x + e.w / 2, m = e.y + e.h / 2, x = e.rot * Math.PI / 180;
|
|
540
540
|
return (f) => {
|
|
541
|
-
let h = e.x + (f.x + f.w / 2 - r) *
|
|
542
|
-
if (e.flipH && (h = 2 * d - h, p = !p, u = -u), e.flipV && (y = 2 * m - y, w = !w, u = -u),
|
|
541
|
+
let h = e.x + (f.x + f.w / 2 - r) * g, y = e.y + (f.y + f.h / 2 - a) * b, u = f.rot, p = f.flipH, w = f.flipV;
|
|
542
|
+
if (e.flipH && (h = 2 * d - h, p = !p, u = -u), e.flipV && (y = 2 * m - y, w = !w, u = -u), x) {
|
|
543
543
|
const v = h - d, N = y - m;
|
|
544
|
-
h = d + v * Math.cos(
|
|
544
|
+
h = d + v * Math.cos(x) - N * Math.sin(x), y = m + v * Math.sin(x) + N * Math.cos(x), u += e.rot;
|
|
545
545
|
}
|
|
546
|
-
const M = f.w *
|
|
546
|
+
const M = f.w * g, S = f.h * b;
|
|
547
547
|
return n({ x: h - M / 2, y: y - S / 2, w: M, h: S, rot: (u % 360 + 360) % 360, flipH: p, flipV: w });
|
|
548
548
|
};
|
|
549
549
|
}
|
|
@@ -567,7 +567,7 @@ function te(t, n) {
|
|
|
567
567
|
const a = k(c(t, "buSzPct"), "val") || "", i = a.endsWith("%") ? parseFloat(a) / 100 : Number(a) / 1e5;
|
|
568
568
|
e.buSz = Number.isFinite(i) && i > 0 ? Math.max(0.25, Math.min(4, i)) : null;
|
|
569
569
|
} else (c(t, "buSzTx") || c(t, "buSzPts")) && (e.buSz = null);
|
|
570
|
-
const o =
|
|
570
|
+
const o = A(t, "lnSpc", "spcPct");
|
|
571
571
|
o && (e.lnSpcPct = C(o, "val") / 1e5);
|
|
572
572
|
const s = Bt(c(t, "spcBef")), r = Bt(c(t, "spcAft"));
|
|
573
573
|
return s && (e.spcBef = s), r && (e.spcAft = r), Object.assign(e, ee(c(t, "defRPr"), n)), e;
|
|
@@ -615,19 +615,19 @@ function ze(t, n) {
|
|
|
615
615
|
function Nt(t, n, e) {
|
|
616
616
|
if (!t) return;
|
|
617
617
|
const o = I(t, "p");
|
|
618
|
-
if (!o.some((
|
|
618
|
+
if (!o.some((x) => I(x).some((f) => (f.localName === "r" || f.localName === "fld") && (A(f, "t")?.textContent ?? "") !== ""))) return;
|
|
619
619
|
const r = {};
|
|
620
620
|
let a = 1, i = 1;
|
|
621
|
-
for (const
|
|
622
|
-
if (!
|
|
623
|
-
for (let h = 0; h <
|
|
624
|
-
const f = c(
|
|
625
|
-
f && (a = k(f, "fontScale") !== null ? C(f, "fontScale") / 1e5 : 1), f && (i = 1 - Math.max(0, Math.min(0.9, C(f, "lnSpcReduction") / 1e5))), (c(
|
|
621
|
+
for (const x of [...n.bodyPr, c(t, "bodyPr")]) {
|
|
622
|
+
if (!x) continue;
|
|
623
|
+
for (let h = 0; h < x.attributes.length; h++) r[x.attributes[h].localName ?? x.attributes[h].name] = x.attributes[h].value;
|
|
624
|
+
const f = c(x, "normAutofit");
|
|
625
|
+
f && (a = k(f, "fontScale") !== null ? C(f, "fontScale") / 1e5 : 1), f && (i = 1 - Math.max(0, Math.min(0.9, C(f, "lnSpcReduction") / 1e5))), (c(x, "noAutofit") || c(x, "spAutoFit")) && (a = 1, i = 1);
|
|
626
626
|
}
|
|
627
|
-
const l = (
|
|
627
|
+
const l = (x, f) => r[x] !== void 0 ? E(Number(r[x]) || 0) : E(f), g = r.anchor === "ctr" ? "ctr" : r.anchor === "b" ? "b" : "t", b = c(t, "lstStyle"), d = [];
|
|
628
628
|
let m;
|
|
629
|
-
for (const
|
|
630
|
-
const f = c(
|
|
629
|
+
for (const x of o) {
|
|
630
|
+
const f = c(x, "pPr"), h = Math.max(0, Math.min(8, C(f, "lvl"))), y = n.fontRef ? { color: n.fontRef.color ?? void 0, font: n.fontRef.font } : {}, u = Xt(...n.levels.map((P) => zt(P, h, e)), y, zt(b, h, e), f ? te(f, e) : {});
|
|
631
631
|
u.lnSpcPct !== void 0 && m === void 0 && (m = u.lnSpcPct);
|
|
632
632
|
const p = { runs: [], align: u.algn === "ctr" ? "ctr" : u.algn === "r" ? "r" : (u.algn === "just", "l"), level: h };
|
|
633
633
|
if (u.bullet === "char" || u.bullet === "num") {
|
|
@@ -651,21 +651,21 @@ function Nt(t, n, e) {
|
|
|
651
651
|
font: ze(L.font ?? "+mn-lt", e.ctx.theme)
|
|
652
652
|
};
|
|
653
653
|
};
|
|
654
|
-
for (const P of I(
|
|
654
|
+
for (const P of I(x))
|
|
655
655
|
if (P.localName === "r" || P.localName === "fld") {
|
|
656
|
-
const L =
|
|
656
|
+
const L = A(P, "t")?.textContent ?? "";
|
|
657
657
|
if (!L) continue;
|
|
658
658
|
L.split(/[\v\n]/).forEach((X, H) => {
|
|
659
659
|
H > 0 && p.runs.push({ ...w(c(P, "rPr")), br: !0 }), X && p.runs.push({ ...w(c(P, "rPr")), text: X });
|
|
660
660
|
});
|
|
661
661
|
} else P.localName === "br" && p.runs.push({ ...w(c(P, "rPr")), br: !0 });
|
|
662
|
-
p.endSize = w(c(
|
|
662
|
+
p.endSize = w(c(x, "endParaRPr")).size;
|
|
663
663
|
const M = (p.runs.length ? Math.max(...p.runs.map((P) => P.size ?? 0)) : p.endSize ?? 0) * 1.2 * (u.lnSpcPct ?? 1), S = (P) => P ? ("px" in P ? P.px : P.lines * M) * i : 0, v = S(u.spcBef), N = S(u.spcAft);
|
|
664
664
|
v > 0.05 && (p.spaceBefore = Math.round(v * 100) / 100), N > 0.05 && (p.spaceAfter = Math.round(N * 100) / 100), d.push(p);
|
|
665
665
|
}
|
|
666
666
|
return {
|
|
667
667
|
paragraphs: d,
|
|
668
|
-
anchor:
|
|
668
|
+
anchor: g,
|
|
669
669
|
insets: { l: l("lIns", 91440), t: l("tIns", 45720), r: l("rIns", 91440), b: l("bIns", 45720) },
|
|
670
670
|
wrap: r.wrap !== "none",
|
|
671
671
|
lineSpacing: m
|
|
@@ -706,19 +706,19 @@ function Ye(t) {
|
|
|
706
706
|
const n = (r) => I(r, "gd").slice(0, 1e4).map((a) => [k(a, "name") || "", k(a, "fmla") || "val 0"]), e = I(c(t, "cxnLst"), "cxn").map((r) => [k(r, "ang") || "0", k(c(r, "pos"), "x") || "0", k(c(r, "pos"), "y") || "0"]), o = c(t, "rect"), s = I(c(t, "pathLst"), "path").slice(0, 1e3).map((r) => {
|
|
707
707
|
const a = [];
|
|
708
708
|
for (const l of I(r)) {
|
|
709
|
-
const
|
|
709
|
+
const g = I(l, "pt").map((b) => [k(b, "x") || "0", k(b, "y") || "0"]).flat();
|
|
710
710
|
switch (l.localName) {
|
|
711
711
|
case "moveTo":
|
|
712
|
-
a.push(["M", ...
|
|
712
|
+
a.push(["M", ...g]);
|
|
713
713
|
break;
|
|
714
714
|
case "lnTo":
|
|
715
|
-
a.push(["L", ...
|
|
715
|
+
a.push(["L", ...g]);
|
|
716
716
|
break;
|
|
717
717
|
case "quadBezTo":
|
|
718
|
-
a.push(["Q", ...
|
|
718
|
+
a.push(["Q", ...g]);
|
|
719
719
|
break;
|
|
720
720
|
case "cubicBezTo":
|
|
721
|
-
a.push(["C", ...
|
|
721
|
+
a.push(["C", ...g]);
|
|
722
722
|
break;
|
|
723
723
|
case "arcTo":
|
|
724
724
|
a.push(["A", k(l, "wR") || "0", k(l, "hR") || "0", k(l, "stAng") || "0", k(l, "swAng") || "0"]);
|
|
@@ -793,43 +793,43 @@ function _e(t, n, e) {
|
|
|
793
793
|
return r?.external && /^(https?:|mailto:|tel:)/i.test(r.target) ? { kind: "url", url: r.target } : void 0;
|
|
794
794
|
}
|
|
795
795
|
function Ue(t, n, e, o, s, r) {
|
|
796
|
-
const a = I(t).find((
|
|
797
|
-
if (l) for (const
|
|
796
|
+
const a = I(t).find((g) => g.localName.startsWith("nv")), i = Ge(t, n, e, o, s, r), l = i ? _e(c(a ?? null, "cNvPr"), n.part, e.pkg) : void 0;
|
|
797
|
+
if (l) for (const g of Array.isArray(i) ? i : [i]) g.link = l;
|
|
798
798
|
return i;
|
|
799
799
|
}
|
|
800
800
|
function Ge(t, n, e, o, s, r) {
|
|
801
|
-
const a = { pkg: e.pkg, part: n.part, ctx: e.ctx }, i = I(t).find((d) => d.localName.startsWith("nv")), l = c(i ?? null, "cNvPr"),
|
|
801
|
+
const a = { pkg: e.pkg, part: n.part, ctx: e.ctx }, i = I(t).find((d) => d.localName.startsWith("nv")), l = c(i ?? null, "cNvPr"), g = C(l, "id"), b = k(l, "name") || t.localName;
|
|
802
802
|
if (k(l, "hidden") === "1") return null;
|
|
803
803
|
switch (t.localName) {
|
|
804
804
|
case "sp":
|
|
805
|
-
return Ze(t, n, e, o,
|
|
805
|
+
return Ze(t, n, e, o, g, b, r);
|
|
806
806
|
case "cxnSp": {
|
|
807
807
|
const d = c(t, "spPr"), m = W(c(d, "xfrm"));
|
|
808
808
|
if (!m) return null;
|
|
809
|
-
const
|
|
809
|
+
const x = o(m), f = c(t, "style"), h = G(c(d, "ln"), a) ?? It(f, a) ?? { width: 1, color: { hex: "#000000" } };
|
|
810
810
|
if (!h) return null;
|
|
811
|
-
const y = rt(d,
|
|
812
|
-
return { kind: "connector", id:
|
|
811
|
+
const y = rt(d, x) ?? { geom: { kind: "preset", prst: "line" } }, u = (w) => w ? { id: C(w, "id"), idx: C(w, "idx") } : void 0, p = c(i ?? null, "cNvCxnSpPr");
|
|
812
|
+
return { kind: "connector", id: g, name: b, ...x, geom: y.geom, line: h, start: u(c(p, "stCxn")), end: u(c(p, "endCxn")) };
|
|
813
813
|
}
|
|
814
814
|
case "pic": {
|
|
815
815
|
const d = c(t, "spPr");
|
|
816
816
|
let m = W(c(d, "xfrm"));
|
|
817
|
-
const
|
|
818
|
-
if (!m &&
|
|
817
|
+
const x = K(c(i ?? null, "nvPr"));
|
|
818
|
+
if (!m && x && (m = Ve(x, e)), !m) return null;
|
|
819
819
|
const f = c(t, "blipFill"), h = f ? Jt(f, a) : null;
|
|
820
820
|
if (!h)
|
|
821
821
|
return e.warnings.push(`Picture "${b}" has no image the importer can read.`), null;
|
|
822
|
-
const y = c(f, "srcRect"), u = y ? { l: C(y, "l") / 1e5, t: C(y, "t") / 1e5, r: C(y, "r") / 1e5, b: C(y, "b") / 1e5 } : void 0, p = k(
|
|
823
|
-
return { kind: "picture", id:
|
|
822
|
+
const y = c(f, "srcRect"), u = y ? { l: C(y, "l") / 1e5, t: C(y, "t") / 1e5, r: C(y, "r") / 1e5, b: C(y, "b") / 1e5 } : void 0, p = k(A(f, "blip", "alphaModFix"), "amt"), w = o(m), M = rt(d, w)?.geom, S = M && !(M.kind === "preset" && M.prst === "rect") ? M : void 0;
|
|
823
|
+
return { kind: "picture", id: g, name: b, ...w, media: h, crop: u, alpha: p !== null ? Number(p) / 1e5 : void 0, descr: k(l, "descr") || void 0, geom: S, ...A(f, "blip", "grayscl") ? { grayscale: !0 } : {} };
|
|
824
824
|
}
|
|
825
825
|
case "grpSp": {
|
|
826
|
-
const d = c(t, "grpSpPr"), m = c(d, "xfrm"),
|
|
826
|
+
const d = c(t, "grpSpPr"), m = c(d, "xfrm"), x = je(m, o), f = at(t, n, e, x, s + 1, r);
|
|
827
827
|
if (!f.length) return null;
|
|
828
828
|
const h = ht(f);
|
|
829
|
-
return { kind: "group", id:
|
|
829
|
+
return { kind: "group", id: g, name: b, ...h, children: f };
|
|
830
830
|
}
|
|
831
831
|
case "graphicFrame":
|
|
832
|
-
return Je(t, n, e, o,
|
|
832
|
+
return Je(t, n, e, o, g, b, s);
|
|
833
833
|
default:
|
|
834
834
|
return null;
|
|
835
835
|
}
|
|
@@ -841,10 +841,10 @@ function ht(t) {
|
|
|
841
841
|
return { x: n, y: e, w: Math.max(0, o - n), h: Math.max(0, s - e) };
|
|
842
842
|
}
|
|
843
843
|
function Ve(t, n) {
|
|
844
|
-
const e = ut(n.layout?.tree ?? null, t), o = W(
|
|
844
|
+
const e = ut(n.layout?.tree ?? null, t), o = W(A(e, "spPr", "xfrm"));
|
|
845
845
|
if (o) return o;
|
|
846
846
|
const s = ut(n.master?.tree ?? null, { type: oe(t.type), idx: 0 });
|
|
847
|
-
return W(
|
|
847
|
+
return W(A(s, "spPr", "xfrm"));
|
|
848
848
|
}
|
|
849
849
|
function qe(...t) {
|
|
850
850
|
for (const n of t) {
|
|
@@ -853,33 +853,33 @@ function qe(...t) {
|
|
|
853
853
|
}
|
|
854
854
|
}
|
|
855
855
|
function Ze(t, n, e, o, s, r, a) {
|
|
856
|
-
const i = { pkg: e.pkg, part: n.part, ctx: e.ctx }, l = st(t),
|
|
857
|
-
if (
|
|
858
|
-
const b = c(t, "spPr"), d = c(t, "style"), m = k(
|
|
859
|
-
let u = W(c(b, "xfrm")) ?? W(
|
|
856
|
+
const i = { pkg: e.pkg, part: n.part, ctx: e.ctx }, l = st(t), g = K(l);
|
|
857
|
+
if (g && !a) return null;
|
|
858
|
+
const b = c(t, "spPr"), d = c(t, "style"), m = k(A(t, "nvSpPr", "cNvSpPr"), "txBox") === "1", x = g && e.layout ? ut(e.layout.tree, g) : null, f = g && e.master ? ut(e.master.tree, { type: oe(x ? K(st(x))?.type ?? g.type : g.type), idx: 0 }) : null, h = x && e.layout ? { pkg: e.pkg, part: e.layout.part, ctx: e.ctx } : null, y = f && e.master ? { pkg: e.pkg, part: e.master.part, ctx: e.ctx } : null;
|
|
859
|
+
let u = W(c(b, "xfrm")) ?? W(A(x, "spPr", "xfrm")) ?? W(A(f, "spPr", "xfrm"));
|
|
860
860
|
if (!u) return null;
|
|
861
861
|
u = o(u);
|
|
862
|
-
const p = rt(b, u) ?? (
|
|
862
|
+
const p = rt(b, u) ?? (x ? rt(c(x, "spPr"), u) : void 0) ?? (f ? rt(c(f, "spPr"), u) : void 0) ?? { geom: { kind: "preset", prst: "rect" } }, M = (B(t, "useBgFill") ? e.background?.kind === "image" ? { kind: "none" } : e.background ?? { kind: "solid", color: { hex: "#ffffff" } } : void 0) ?? V(b, i) ?? dt(d, i) ?? (h ? V(c(x, "spPr"), h) : void 0) ?? (y ? V(c(f, "spPr"), y) : void 0) ?? (h ? dt(c(x, "style"), h) : void 0) ?? { kind: "none" }, S = qe(
|
|
863
863
|
() => G(c(b, "ln"), i),
|
|
864
864
|
() => It(d, i),
|
|
865
|
-
() => h ? G(
|
|
866
|
-
() => y ? G(
|
|
865
|
+
() => h ? G(A(x, "spPr", "ln"), h) : void 0,
|
|
866
|
+
() => y ? G(A(f, "spPr", "ln"), y) : void 0
|
|
867
867
|
) ?? null, v = [];
|
|
868
|
-
if (
|
|
869
|
-
const O =
|
|
870
|
-
v.push(it.has(O) ? e.masterTx.title : ["body", "obj", "subTitle", "tbl", "chart", "dgm", "media", "pic", "clipArt"].includes(O) ? e.masterTx.body : e.masterTx.other), v.push(
|
|
868
|
+
if (g) {
|
|
869
|
+
const O = x ? K(st(x))?.type ?? g.type : g.type;
|
|
870
|
+
v.push(it.has(O) ? e.masterTx.title : ["body", "obj", "subTitle", "tbl", "chart", "dgm", "media", "pic", "clipArt"].includes(O) ? e.masterTx.body : e.masterTx.other), v.push(A(f, "txBody", "lstStyle"), A(x, "txBody", "lstStyle"));
|
|
871
871
|
} else
|
|
872
872
|
v.push(e.defaultText);
|
|
873
873
|
const N = c(d, "fontRef"), P = {
|
|
874
874
|
levels: v,
|
|
875
|
-
bodyPr: [
|
|
875
|
+
bodyPr: [A(f, "txBody", "bodyPr"), A(x, "txBody", "bodyPr")],
|
|
876
876
|
fontRef: N ? { font: k(N, "idx") === "major" ? "+mj-lt" : "+mn-lt", color: D(N, i.ctx) } : void 0
|
|
877
877
|
}, L = Nt(c(t, "txBody"), P, i);
|
|
878
878
|
if (!(M.kind !== "none" || !!S || !!L)) return null;
|
|
879
879
|
let H = p.textRect;
|
|
880
|
-
const T = W(c(b, "xfrm")),
|
|
881
|
-
if (
|
|
882
|
-
const O = u.w / T.w, Y = u.h / T.h, j = { l: (
|
|
880
|
+
const T = W(c(b, "xfrm")), R = L ? W(c(t, "txXfrm")) : null;
|
|
881
|
+
if (R && T && T.w > 0 && T.h > 0) {
|
|
882
|
+
const O = u.w / T.w, Y = u.h / T.h, j = { l: (R.x - T.x) * O, t: (R.y - T.y) * Y, r: (R.x + R.w - T.x) * O, b: (R.y + R.h - T.y) * Y };
|
|
883
883
|
(Math.abs(j.l) > 0.5 || Math.abs(j.t) > 0.5 || Math.abs(j.r - u.w) > 0.5 || Math.abs(j.b - u.h) > 0.5) && (H = j);
|
|
884
884
|
}
|
|
885
885
|
return { kind: "shape", id: s, name: r, ...u, geom: p.geom, fill: M, line: S, text: L, textBox: m || void 0, textRect: H };
|
|
@@ -893,8 +893,8 @@ function Ke(t, n) {
|
|
|
893
893
|
const i = D(s, n.ctx) ?? D(c(s, "fontRef"), n.ctx);
|
|
894
894
|
i && (e.text = i), k(s, "b") === "on" && (e.bold = !0);
|
|
895
895
|
const l = c(o, "tcBdr");
|
|
896
|
-
for (const
|
|
897
|
-
const b = c(l,
|
|
896
|
+
for (const g of ["insideH", "bottom", "top", "left"]) {
|
|
897
|
+
const b = c(l, g);
|
|
898
898
|
if (!b) continue;
|
|
899
899
|
const d = G(c(b, "ln"), n) ?? It(b, n);
|
|
900
900
|
if (d !== void 0) {
|
|
@@ -907,7 +907,7 @@ function Ke(t, n) {
|
|
|
907
907
|
function Qe(t, n, e) {
|
|
908
908
|
const o = ((c(t, "tableStyleId")?.textContent || "").trim() || k(e, "def") || Wt).toUpperCase(), s = (d) => B(t, d) ?? !1, r = { firstRow: s("firstRow"), lastRow: s("lastRow"), firstCol: s("firstCol"), lastCol: s("lastCol"), bandRow: s("bandRow"), bandCol: s("bandCol") }, a = I(e, "tblStyle").find((d) => (k(d, "styleId") || "").toUpperCase() === o);
|
|
909
909
|
if (a) {
|
|
910
|
-
const d = (y) => Ke(c(a, y), n), m = c(a, "tblBg"),
|
|
910
|
+
const d = (y) => Ke(c(a, y), n), m = c(a, "tblBg"), x = m ? c(m, "fill") ? V(c(m, "fill"), n) : dt(m, n) : void 0, f = {
|
|
911
911
|
whole: d("wholeTbl"),
|
|
912
912
|
b1H: d("band1H"),
|
|
913
913
|
b2H: d("band2H"),
|
|
@@ -925,41 +925,41 @@ function Qe(t, n, e) {
|
|
|
925
925
|
P.fill && (N.fill = P.fill), P.text && (N.text = P.text), P.bold && (N.bold = !0), P.border !== void 0 && (N.border = P.border);
|
|
926
926
|
return N;
|
|
927
927
|
};
|
|
928
|
-
return
|
|
928
|
+
return x && x.kind !== "none" && (h.background = x), h;
|
|
929
929
|
}
|
|
930
930
|
if (o !== Wt) return null;
|
|
931
931
|
const i = n.ctx.theme.colors.accent1 ?? "#4472c4", l = (d) => {
|
|
932
|
-
const [m,
|
|
933
|
-
return { hex: ct(U(ot(m) * d + (1 - d)), U(ot(
|
|
934
|
-
},
|
|
932
|
+
const [m, x, f] = Qt(i);
|
|
933
|
+
return { hex: ct(U(ot(m) * d + (1 - d)), U(ot(x) * d + (1 - d)), U(ot(f) * d + (1 - d))) };
|
|
934
|
+
}, g = { hex: n.ctx.theme.colors.lt1 ?? "#ffffff" }, b = ne("tx1", n) ?? void 0;
|
|
935
935
|
return (d) => {
|
|
936
|
-
const m = r.firstRow && d === 0,
|
|
936
|
+
const m = r.firstRow && d === 0, x = r.bandRow && !m && (d - (r.firstRow ? 1 : 0)) % 2 === 0;
|
|
937
937
|
return {
|
|
938
|
-
fill: { kind: "solid", color: m ? { hex: i } : l(
|
|
939
|
-
text: m ?
|
|
938
|
+
fill: { kind: "solid", color: m ? { hex: i } : l(x ? 0.4 : 0.2) },
|
|
939
|
+
text: m ? g : b,
|
|
940
940
|
bold: m || void 0,
|
|
941
|
-
border: { width: 1.33, color:
|
|
941
|
+
border: { width: 1.33, color: g }
|
|
942
942
|
};
|
|
943
943
|
};
|
|
944
944
|
}
|
|
945
945
|
function Je(t, n, e, o, s, r, a = 0) {
|
|
946
946
|
const i = { pkg: e.pkg, part: n.part, ctx: e.ctx }, l = W(c(t, "xfrm"));
|
|
947
947
|
if (!l) return null;
|
|
948
|
-
const
|
|
948
|
+
const g = A(t, "graphic", "graphicData"), b = c(g, "tbl");
|
|
949
949
|
if (b) {
|
|
950
|
-
const
|
|
950
|
+
const x = I(c(b, "tblGrid"), "gridCol").map((w) => E(C(w, "w"))), f = Qe(c(b, "tblPr"), i, e.tableStyles), h = [];
|
|
951
951
|
let y = l.y, u = 1e6 + s * 1e3;
|
|
952
952
|
const p = I(b, "tr");
|
|
953
953
|
if (p.forEach((w, M) => {
|
|
954
954
|
const S = E(C(w, "h"));
|
|
955
955
|
let v = l.x, N = 0;
|
|
956
956
|
for (const P of I(w, "tc")) {
|
|
957
|
-
const L = Math.max(1, C(P, "gridSpan", 1)), X =
|
|
957
|
+
const L = Math.max(1, C(P, "gridSpan", 1)), X = x.slice(N, N + L).reduce((tt, Z) => tt + Z, 0);
|
|
958
958
|
if (N += L, B(P, "hMerge") || B(P, "vMerge")) {
|
|
959
959
|
v += X;
|
|
960
960
|
continue;
|
|
961
961
|
}
|
|
962
|
-
const H = Math.max(1, C(P, "rowSpan", 1)), T = c(P, "tcPr"),
|
|
962
|
+
const H = Math.max(1, C(P, "rowSpan", 1)), T = c(P, "tcPr"), R = H > 1 ? S * H : S, O = f ? f(M, N - L, p.length, x.length) : null, Y = O?.text ? { color: O.text } : void 0, j = Nt(c(P, "txBody"), { levels: [e.defaultText], bodyPr: [], fontRef: Y }, i);
|
|
963
963
|
j && O?.bold && j.paragraphs.forEach((tt) => tt.runs.forEach((Z) => {
|
|
964
964
|
Z.bold === void 0 && (Z.bold = !0);
|
|
965
965
|
})), j && (j.insets = { l: E(C(T, "marL", 91440)), r: E(C(T, "marR", 91440)), t: E(C(T, "marT", 45720)), b: E(C(T, "marB", 45720)) }, j.anchor = k(T, "anchor") === "ctr" ? "ctr" : k(T, "anchor") === "b" ? "b" : "t");
|
|
@@ -968,7 +968,7 @@ function Je(t, n, e, o, s, r, a = 0) {
|
|
|
968
968
|
kind: "shape",
|
|
969
969
|
id: u++,
|
|
970
970
|
name: `${r} cell`,
|
|
971
|
-
...o({ x: v, y, w: X, h:
|
|
971
|
+
...o({ x: v, y, w: X, h: R, rot: 0, flipH: !1, flipV: !1 }),
|
|
972
972
|
geom: { kind: "preset", prst: "rect" },
|
|
973
973
|
fill: V(T, i) ?? q ?? { kind: "none" },
|
|
974
974
|
line: _,
|
|
@@ -997,11 +997,11 @@ function Je(t, n, e, o, s, r, a = 0) {
|
|
|
997
997
|
}
|
|
998
998
|
return { kind: "group", id: s, name: r, ...ht(h), children: h };
|
|
999
999
|
}
|
|
1000
|
-
const d = k(
|
|
1000
|
+
const d = k(g, "uri") || "";
|
|
1001
1001
|
if (/diagram/.test(d)) {
|
|
1002
|
-
const
|
|
1003
|
-
if (
|
|
1004
|
-
const f = en(
|
|
1002
|
+
const x = tn(g, n, e, o, l, s, r, a);
|
|
1003
|
+
if (x) return x;
|
|
1004
|
+
const f = en(g, n, e, o, l, s, r, i);
|
|
1005
1005
|
if (f) return f;
|
|
1006
1006
|
}
|
|
1007
1007
|
const m = /chart/.test(d) ? "Chart" : /diagram/.test(d) ? "SmartArt diagram" : "Embedded object";
|
|
@@ -1017,7 +1017,7 @@ function Je(t, n, e, o, s, r, a = 0) {
|
|
|
1017
1017
|
};
|
|
1018
1018
|
}
|
|
1019
1019
|
function tn(t, n, e, o, s, r, a, i) {
|
|
1020
|
-
const l = e.pkg.rels(n.part),
|
|
1020
|
+
const l = e.pkg.rels(n.part), g = k(c(t, "relIds"), "r:dm"), b = g ? l.get(g) : void 0;
|
|
1021
1021
|
let d;
|
|
1022
1022
|
if (b && !b.external) {
|
|
1023
1023
|
const u = Ot(e.pkg.xml(b.target), "dataModelExt", 6), p = u ? l.get(k(u, "relId") || "") : void 0;
|
|
@@ -1039,9 +1039,9 @@ function tn(t, n, e, o, s, r, a, i) {
|
|
|
1039
1039
|
return y(f), { kind: "group", id: r, name: a, ...ht(f), children: f };
|
|
1040
1040
|
}
|
|
1041
1041
|
function en(t, n, e, o, s, r, a, i) {
|
|
1042
|
-
const l = k(c(t, "relIds"), "r:dm"),
|
|
1043
|
-
if (!
|
|
1044
|
-
const b = e.pkg.xml(
|
|
1042
|
+
const l = k(c(t, "relIds"), "r:dm"), g = l ? e.pkg.rels(n.part).get(l) : void 0;
|
|
1043
|
+
if (!g || g.external) return null;
|
|
1044
|
+
const b = e.pkg.xml(g.target), d = /* @__PURE__ */ new Map();
|
|
1045
1045
|
for (const u of I(c(b, "ptLst"), "pt")) d.set(k(u, "modelId") || "", u);
|
|
1046
1046
|
const m = /* @__PURE__ */ new Map();
|
|
1047
1047
|
for (const u of I(c(b, "cxnLst"), "cxn")) {
|
|
@@ -1049,8 +1049,8 @@ function en(t, n, e, o, s, r, a, i) {
|
|
|
1049
1049
|
const p = k(u, "srcId") || "", w = k(u, "destId") || "";
|
|
1050
1050
|
m.has(p) || m.set(p, []), m.get(p).push({ id: w, ord: C(u, "srcOrd") });
|
|
1051
1051
|
}
|
|
1052
|
-
const
|
|
1053
|
-
if (!
|
|
1052
|
+
const x = [...d.values()].find((u) => k(u, "type") === "doc");
|
|
1053
|
+
if (!x) return null;
|
|
1054
1054
|
const f = [], h = /* @__PURE__ */ new Set(), y = (u, p) => {
|
|
1055
1055
|
if (!(h.has(u) || p > 16 || f.length > 500)) {
|
|
1056
1056
|
h.add(u);
|
|
@@ -1070,7 +1070,7 @@ function en(t, n, e, o, s, r, a, i) {
|
|
|
1070
1070
|
}
|
|
1071
1071
|
}
|
|
1072
1072
|
};
|
|
1073
|
-
return y(k(
|
|
1073
|
+
return y(k(x, "modelId") || "", 0), f.length ? (e.warnings.push(`SmartArt diagram "${a}" had no saved drawing; its text was imported as a list.`), {
|
|
1074
1074
|
kind: "shape",
|
|
1075
1075
|
id: r,
|
|
1076
1076
|
name: a,
|
|
@@ -1104,7 +1104,7 @@ function yt(t, n) {
|
|
|
1104
1104
|
}
|
|
1105
1105
|
}
|
|
1106
1106
|
function nn(t, n) {
|
|
1107
|
-
const e = t.relOfType(n, "notesSlide"), o = e ?
|
|
1107
|
+
const e = t.relOfType(n, "notesSlide"), o = e ? A(t.xml(e), "cSld", "spTree") : null;
|
|
1108
1108
|
if (!o) return;
|
|
1109
1109
|
const s = [], r = (i) => {
|
|
1110
1110
|
for (const l of J(i)) {
|
|
@@ -1113,8 +1113,8 @@ function nn(t, n) {
|
|
|
1113
1113
|
continue;
|
|
1114
1114
|
}
|
|
1115
1115
|
if (l.localName !== "sp") continue;
|
|
1116
|
-
const
|
|
1117
|
-
if (!(!
|
|
1116
|
+
const g = K(st(l));
|
|
1117
|
+
if (!(!g || g.type !== "body" && g.type !== "obj"))
|
|
1118
1118
|
for (const b of I(c(l, "txBody"), "p")) {
|
|
1119
1119
|
let d = "";
|
|
1120
1120
|
for (const m of I(b))
|
|
@@ -1130,6 +1130,14 @@ function nn(t, n) {
|
|
|
1130
1130
|
return a.trim() ? a : void 0;
|
|
1131
1131
|
}
|
|
1132
1132
|
function on(t) {
|
|
1133
|
+
for (const a of I(t, "AlternateContent"))
|
|
1134
|
+
for (const i of I(a, "Choice")) {
|
|
1135
|
+
const l = c(i, "transition");
|
|
1136
|
+
if (l && c(l, "morph")) {
|
|
1137
|
+
const g = k(l, "spd");
|
|
1138
|
+
return { kind: "morph", durationMs: k(l, "p14:dur") !== null ? C(l, "p14:dur") : g === "fast" ? 500 : g === "slow" ? 1e3 : 750 };
|
|
1139
|
+
}
|
|
1140
|
+
}
|
|
1133
1141
|
const n = J(t).find((a) => a.localName === "transition");
|
|
1134
1142
|
if (!n) return;
|
|
1135
1143
|
const e = I(n).find((a) => a.localName !== "sndAc" && a.localName !== "extLst");
|
|
@@ -1143,6 +1151,8 @@ function on(t) {
|
|
|
1143
1151
|
return { kind: "push", dir: r === "r" || r === "u" || r === "d" ? r : "l", durationMs: s };
|
|
1144
1152
|
case "zoom":
|
|
1145
1153
|
return { kind: "zoom", zoomIn: r !== "out", durationMs: s };
|
|
1154
|
+
case "morph":
|
|
1155
|
+
return { kind: "morph", durationMs: s };
|
|
1146
1156
|
case "cut":
|
|
1147
1157
|
return;
|
|
1148
1158
|
default:
|
|
@@ -1179,45 +1189,45 @@ function rn(t, n = {}) {
|
|
|
1179
1189
|
throw new Error("This file is not a PowerPoint presentation (it is not a valid .pptx package).");
|
|
1180
1190
|
}
|
|
1181
1191
|
(a > jt || i > Dt) && o("The file is very large; some parts were skipped.");
|
|
1182
|
-
const l = new Oe(r, s, o),
|
|
1192
|
+
const l = new Oe(r, s, o), g = l.relOfType("", "officeDocument") ?? "ppt/presentation.xml", b = l.xml(g);
|
|
1183
1193
|
if (!b || b.localName !== "presentation") throw new Error("This file is not a PowerPoint presentation (no presentation part).");
|
|
1184
|
-
const d = c(b, "sldSz"), m = d ? Math.max(1, E(C(d, "cx", 9144e3))) : 960,
|
|
1194
|
+
const d = c(b, "sldSz"), m = d ? Math.max(1, E(C(d, "cx", 9144e3))) : 960, x = d ? Math.max(1, E(C(d, "cy", 5143500))) : 540, f = c(b, "defaultTextStyle"), h = l.rels(g), y = l.relOfType(g, "tableStyles"), u = y ? l.xml(y) : null, p = [], w = /* @__PURE__ */ new Set();
|
|
1185
1195
|
for (const T of I(c(b, "sldIdLst"), "sldId")) {
|
|
1186
|
-
const
|
|
1187
|
-
|
|
1196
|
+
const R = h.get(k(T, "r:id") || "");
|
|
1197
|
+
R && !w.has(R.target) && p.length < Ce && (w.add(R.target), p.push(R.target));
|
|
1188
1198
|
}
|
|
1189
1199
|
const M = /* @__PURE__ */ new Map(), S = (T) => {
|
|
1190
|
-
const
|
|
1191
|
-
return
|
|
1200
|
+
const R = l.relOfType(T, "theme");
|
|
1201
|
+
return R ? (M.has(R) || M.set(R, gt(l.xml(R))), M.get(R)) : gt(null);
|
|
1192
1202
|
}, v = (T) => {
|
|
1193
1203
|
if (!T) return null;
|
|
1194
|
-
const
|
|
1195
|
-
for (let O = 0; O < T.attributes.length; O++)
|
|
1196
|
-
return
|
|
1204
|
+
const R = {};
|
|
1205
|
+
for (let O = 0; O < T.attributes.length; O++) R[T.attributes[O].localName ?? T.attributes[O].name] = T.attributes[O].value;
|
|
1206
|
+
return R;
|
|
1197
1207
|
}, N = sn(b, h), P = [];
|
|
1198
|
-
p.forEach((T,
|
|
1208
|
+
p.forEach((T, R) => {
|
|
1199
1209
|
const O = l.xml(T);
|
|
1200
1210
|
if (!O) {
|
|
1201
|
-
o(`Slide ${
|
|
1211
|
+
o(`Slide ${R + 1} couldn't be read and was skipped.`);
|
|
1202
1212
|
return;
|
|
1203
1213
|
}
|
|
1204
|
-
const Y = l.relOfType(T, "slideLayout"), j = Y ? l.xml(Y) : null, _ = Y ? l.relOfType(Y, "slideMaster") : null, q = _ ? l.xml(_) : null, tt = _ ? S(_) : gt(null), Z = v(
|
|
1214
|
+
const Y = l.relOfType(T, "slideLayout"), j = Y ? l.xml(Y) : null, _ = Y ? l.relOfType(Y, "slideMaster") : null, q = _ ? l.xml(_) : null, tt = _ ? S(_) : gt(null), Z = v(A(O, "clrMapOvr", "overrideClrMapping")) ?? v(A(j, "clrMapOvr", "overrideClrMapping")) ?? v(c(q, "clrMap")) ?? Pt, At = { theme: tt, clrMap: Z }, pt = c(q, "txStyles"), $ = {
|
|
1205
1215
|
pkg: l,
|
|
1206
|
-
ctx:
|
|
1207
|
-
slide: { part: T, tree:
|
|
1208
|
-
layout: Y ? { part: Y, tree:
|
|
1209
|
-
master: _ ? { part: _, tree:
|
|
1216
|
+
ctx: At,
|
|
1217
|
+
slide: { part: T, tree: A(O, "cSld", "spTree") },
|
|
1218
|
+
layout: Y ? { part: Y, tree: A(j, "cSld", "spTree") } : null,
|
|
1219
|
+
master: _ ? { part: _, tree: A(q, "cSld", "spTree") } : null,
|
|
1210
1220
|
masterTx: { title: c(pt, "titleStyle"), body: c(pt, "bodyStyle"), other: c(pt, "otherStyle") },
|
|
1211
1221
|
defaultText: f,
|
|
1212
1222
|
warnings: e,
|
|
1213
1223
|
count: 0,
|
|
1214
1224
|
tableStyles: u
|
|
1215
|
-
}, mt = (ce) => ({ pkg: l, part: ce?.part ?? T, ctx:
|
|
1216
|
-
$.background =
|
|
1225
|
+
}, mt = (ce) => ({ pkg: l, part: ce?.part ?? T, ctx: At }), Rt = yt(c(O, "cSld"), mt($.slide)) ?? yt(c(j, "cSld"), mt($.layout)) ?? yt(c(q, "cSld"), mt($.master)) ?? { kind: "solid", color: { hex: "#ffffff" } };
|
|
1226
|
+
$.background = Rt;
|
|
1217
1227
|
const lt = [], le = B(O, "showMasterSp") !== !1 && B(j, "showMasterSp") !== !1;
|
|
1218
1228
|
$.master && le && lt.push(...at($.master.tree, $.master, $, bt, 0, !1)), $.layout && B(O, "showMasterSp") !== !1 && lt.push(...at($.layout.tree, $.layout, $, bt, 0, !1)), lt.push(...at($.slide.tree, $.slide, $, bt, 0, !0)), P.push({
|
|
1219
1229
|
items: lt,
|
|
1220
|
-
background:
|
|
1230
|
+
background: Rt,
|
|
1221
1231
|
transition: on(O),
|
|
1222
1232
|
name: k(c(O, "cSld"), "name") || void 0,
|
|
1223
1233
|
notes: nn(l, T),
|
|
@@ -1227,8 +1237,8 @@ function rn(t, n = {}) {
|
|
|
1227
1237
|
...N.has(T) && { section: N.get(T) }
|
|
1228
1238
|
});
|
|
1229
1239
|
}), P.length || o("The presentation has no slides.");
|
|
1230
|
-
const L =
|
|
1231
|
-
return { deck: { width: m, height:
|
|
1240
|
+
const L = A(l.xml("docProps/core.xml"), "title")?.textContent || void 0, X = l.relOfType(g, "presProps"), H = k(c(X ? l.xml(X) : null, "showPr"), "loop");
|
|
1241
|
+
return { deck: { width: m, height: x, slides: P, title: L, ...(H === "1" || H === "true") && { loop: !0 } }, warnings: e };
|
|
1232
1242
|
}
|
|
1233
1243
|
const an = 80, ln = "default-layer", F = (t) => {
|
|
1234
1244
|
if (!t) return "transparent";
|
|
@@ -1402,7 +1412,7 @@ function se(t, n) {
|
|
|
1402
1412
|
const y = a(h);
|
|
1403
1413
|
y && r.set(h.align ?? "l", (r.get(h.align ?? "l") ?? 0) + y);
|
|
1404
1414
|
}
|
|
1405
|
-
const i = [...r].sort((h, y) => y[1] - h[1])[0]?.[0] ?? t.paragraphs.find((h) => h.runs.length)?.align ?? "l", l = (h) => a(h) > 0 && (h.align ?? "l") !== i ? h.align === "ctr" ? "center" : h.align === "r" ? "right" : "left" : void 0,
|
|
1415
|
+
const i = [...r].sort((h, y) => y[1] - h[1])[0]?.[0] ?? t.paragraphs.find((h) => h.runs.length)?.align ?? "l", l = (h) => a(h) > 0 && (h.align ?? "l") !== i ? h.align === "ctr" ? "center" : h.align === "r" ? "right" : "left" : void 0, g = e.every((h) => h.size === o?.size && h.bold === o?.bold && h.italic === o?.italic && h.underline === o?.underline && h.strike === o?.strike && h.font === o?.font && F(h.color) === F(o?.color)) && !t.paragraphs.some((h) => h.bullet) && !t.paragraphs.some((h, y) => y > 0 && kt(t, y) > 0) && !t.paragraphs.some(l), b = {
|
|
1406
1416
|
fontSize: Math.round(s * 10) / 10,
|
|
1407
1417
|
fontFamily: Ut(o?.font),
|
|
1408
1418
|
textAlign: i === "ctr" ? "center" : i === "r" ? "right" : "left",
|
|
@@ -1413,18 +1423,18 @@ function se(t, n) {
|
|
|
1413
1423
|
const d = t.paragraphs.map((h) => h.runs.map((y) => y.br ? `
|
|
1414
1424
|
` : y.text).join("")).join(`
|
|
1415
1425
|
`);
|
|
1416
|
-
if (
|
|
1426
|
+
if (g)
|
|
1417
1427
|
return o?.bold && (b.fontWeight = 700), o?.italic && (b.fontStyle = "italic"), n ? b.containerText = d : b.text = d, { fields: b, rich: !1 };
|
|
1418
|
-
const m = [],
|
|
1428
|
+
const m = [], x = [], f = [];
|
|
1419
1429
|
return t.paragraphs.forEach((h, y) => {
|
|
1420
1430
|
const u = h.level ?? 0;
|
|
1421
1431
|
if (h.bullet === "num") {
|
|
1422
1432
|
const M = h.numType ?? "arabicPeriod";
|
|
1423
|
-
(
|
|
1433
|
+
(x[u] === void 0 || f[u] !== M) && (x[u] = (h.startAt ?? 1) - 1), x[u]++, f[u] = M, x.length = u + 1, f.length = u + 1;
|
|
1424
1434
|
} else
|
|
1425
|
-
|
|
1435
|
+
x.length = Math.min(x.length, u), f.length = x.length;
|
|
1426
1436
|
const p = h.bullet ? { listType: h.bullet === "num" ? "ordered" : "bullet", listLevel: u, ...bn(h, t) } : {};
|
|
1427
|
-
h.bullet === "num" && (p.listIndex =
|
|
1437
|
+
h.bullet === "num" && (p.listIndex = x[u]), (h.runs.length ? h.runs : [{ text: "" }]).forEach((M, S) => {
|
|
1428
1438
|
const v = { text: M.br ? `
|
|
1429
1439
|
` : M.text, ...S === 0 ? p : {} };
|
|
1430
1440
|
S === 0 && y > 0 && kt(t, y) > 0 && (v.paragraphSpaceBefore = kt(t, y));
|
|
@@ -1456,7 +1466,7 @@ function ae(t, n, e) {
|
|
|
1456
1466
|
if (s) {
|
|
1457
1467
|
const d = Q(n, s.type, t, e);
|
|
1458
1468
|
Object.assign(d, s.extra), Gt(d, t.fill, n), Mt(d, t.line), n.byPptId.set(t.id, { el: d, item: t }), n.stats.elements++;
|
|
1459
|
-
const m = t.textRect ?? { l: 0, t: 0, r: t.w, b: t.h },
|
|
1469
|
+
const m = t.textRect ?? { l: 0, t: 0, r: t.w, b: t.h }, x = t.text?.insets, f = Math.abs(m.l) > 0.5 || Math.abs(m.t) > 0.5 || Math.abs(m.r - t.w) > 0.5 || Math.abs(m.b - t.h) > 0.5, h = !!x && Math.max(x.l, x.r, x.t, x.b) > 16;
|
|
1460
1470
|
if (t.text && (f || h)) {
|
|
1461
1471
|
const y = n.nextId("group");
|
|
1462
1472
|
return d.groupIds = [...e, y].reverse(), n.stats.elements++, [d, wt(n, t.text, { ...t, rot: 0, x: t.x + m.l, y: t.y + m.t, w: m.r - m.l, h: m.b - m.t }, [...e, y])];
|
|
@@ -1471,18 +1481,18 @@ function ae(t, n, e) {
|
|
|
1471
1481
|
const d = n.presets[o.prst];
|
|
1472
1482
|
if (!d)
|
|
1473
1483
|
return n.warnings.push(`Unknown shape "${o.prst}" was imported as a rectangle.`), ft(n.presets.rect, t.w, t.h);
|
|
1474
|
-
const m = Object.fromEntries(Object.entries(o.adj ?? {}).map(([
|
|
1484
|
+
const m = Object.fromEntries(Object.entries(o.adj ?? {}).map(([x, f]) => [x, `val ${f}`]));
|
|
1475
1485
|
return ft(d, t.w, t.h, m);
|
|
1476
|
-
})(), a = [], i = (t.text || r.some((d) => d.fill === !1)) && r.some((d) => d.fill !== !1) ? n.nextId("group") : null, l = i ? [...e, i] : e,
|
|
1486
|
+
})(), a = [], i = (t.text || r.some((d) => d.fill === !1)) && r.some((d) => d.fill !== !1) ? n.nextId("group") : null, l = i ? [...e, i] : e, g = /* @__PURE__ */ new Map();
|
|
1477
1487
|
for (const d of r) {
|
|
1478
1488
|
const m = `${d.fill === !1 ? "nofill" : "fill"}|${d.stroke === !1 ? "nostroke" : "stroke"}`;
|
|
1479
|
-
|
|
1489
|
+
g.has(m) || g.set(m, []), g.get(m).push(d);
|
|
1480
1490
|
}
|
|
1481
1491
|
let b = null;
|
|
1482
|
-
for (const [d, m] of
|
|
1483
|
-
const
|
|
1492
|
+
for (const [d, m] of g) {
|
|
1493
|
+
const x = m.flatMap((p) => p.cmds), f = ue(x);
|
|
1484
1494
|
if (!f) continue;
|
|
1485
|
-
const h = dn(un(
|
|
1495
|
+
const h = dn(un(x, -f.minX, -f.minY));
|
|
1486
1496
|
if (!h.length) continue;
|
|
1487
1497
|
const y = Q(n, "path", { ...t, x: t.x + f.minX, y: t.y + f.minY, w: Math.max(f.maxX - f.minX, 1), h: Math.max(f.maxY - f.minY, 1) }, l);
|
|
1488
1498
|
!(Math.abs(f.minX + f.maxX - t.w) < 0.5 && Math.abs(f.minY + f.maxY - t.h) < 0.5) && (t.rot || t.flipH || t.flipV) && yn(y, h, t, f), y.pathSubpaths = h, y.pathAnchors = h[0].anchors, y.pathClosed = h[0].closed, d.startsWith("fill") ? Gt(y, t.fill, n) : y.backgroundColor = "transparent", d.endsWith("|stroke") ? Mt(y, t.line) : (y.strokeColor = "transparent", y.strokeWidth = 0), a.push(y), b ??= y, n.stats.paths++;
|
|
@@ -1494,14 +1504,14 @@ function ae(t, n, e) {
|
|
|
1494
1504
|
return n.stats.elements += a.length, a;
|
|
1495
1505
|
}
|
|
1496
1506
|
function yn(t, n, e, o) {
|
|
1497
|
-
const s = e.w / 2, r = e.h / 2, a = (e.rot || 0) * Math.PI / 180, i = Math.cos(a), l = Math.sin(a),
|
|
1498
|
-
const w = (u + o.minX - s) *
|
|
1507
|
+
const s = e.w / 2, r = e.h / 2, a = (e.rot || 0) * Math.PI / 180, i = Math.cos(a), l = Math.sin(a), g = e.flipH ? -1 : 1, b = e.flipV ? -1 : 1, d = (u, p) => {
|
|
1508
|
+
const w = (u + o.minX - s) * g, M = (p + o.minY - r) * b;
|
|
1499
1509
|
return { x: s + w * i - M * l, y: r + w * l + M * i };
|
|
1500
1510
|
}, m = (u, p) => {
|
|
1501
|
-
const w = u *
|
|
1511
|
+
const w = u * g, M = p * b;
|
|
1502
1512
|
return { x: w * i - M * l, y: w * l + M * i };
|
|
1503
1513
|
};
|
|
1504
|
-
let
|
|
1514
|
+
let x = 1 / 0, f = 1 / 0, h = -1 / 0, y = -1 / 0;
|
|
1505
1515
|
for (const u of n) for (const p of u.anchors) {
|
|
1506
1516
|
const w = d(p.x, p.y);
|
|
1507
1517
|
if (p.x = w.x, p.y = w.y, p.inX !== void 0) {
|
|
@@ -1512,11 +1522,11 @@ function yn(t, n, e, o) {
|
|
|
1512
1522
|
const M = m(p.outX, p.outY ?? 0);
|
|
1513
1523
|
p.outX = M.x, p.outY = M.y;
|
|
1514
1524
|
}
|
|
1515
|
-
|
|
1525
|
+
x = Math.min(x, p.x), f = Math.min(f, p.y), h = Math.max(h, p.x), y = Math.max(y, p.y);
|
|
1516
1526
|
}
|
|
1517
1527
|
for (const u of n) for (const p of u.anchors)
|
|
1518
|
-
p.x -=
|
|
1519
|
-
t.x = t.x - o.minX +
|
|
1528
|
+
p.x -= x, p.y -= f;
|
|
1529
|
+
t.x = t.x - o.minX + x, t.y = t.y - o.minY + f, t.width = Math.max(h - x, 1), t.height = Math.max(y - f, 1), t.angle = 0, t.flipX = void 0, t.flipY = void 0;
|
|
1520
1530
|
}
|
|
1521
1531
|
function kn(t) {
|
|
1522
1532
|
const n = t.geom;
|
|
@@ -1550,21 +1560,21 @@ function vt(t, n, e) {
|
|
|
1550
1560
|
const r = t.w / 2, a = t.h / 2, i = (t.rot || 0) * Math.PI / 180, l = (w, M) => {
|
|
1551
1561
|
let S = w - r, v = M - a;
|
|
1552
1562
|
return t.flipH && (S = -S), t.flipV && (v = -v), { x: t.x + r + S * Math.cos(i) - v * Math.sin(i), y: t.y + a + S * Math.sin(i) + v * Math.cos(i) };
|
|
1553
|
-
},
|
|
1563
|
+
}, g = [];
|
|
1554
1564
|
let b = { x: 0, y: 0 };
|
|
1555
1565
|
for (const w of s)
|
|
1556
1566
|
if (w.op === "M" || w.op === "L")
|
|
1557
|
-
b = { x: w.x, y: w.y },
|
|
1567
|
+
b = { x: w.x, y: w.y }, g.push(l(b.x, b.y));
|
|
1558
1568
|
else if (w.op === "C") {
|
|
1559
1569
|
for (let M = 1; M <= 12; M++) {
|
|
1560
1570
|
const S = M / 12, v = 1 - S, N = v * v * v * b.x + 3 * v * v * S * w.x1 + 3 * v * S * S * w.x2 + S * S * S * w.x, P = v * v * v * b.y + 3 * v * v * S * w.y1 + 3 * v * S * S * w.y2 + S * S * S * w.y;
|
|
1561
|
-
|
|
1571
|
+
g.push(l(N, P));
|
|
1562
1572
|
}
|
|
1563
1573
|
b = { x: w.x, y: w.y };
|
|
1564
1574
|
}
|
|
1565
|
-
if (
|
|
1566
|
-
const d = Math.min(...
|
|
1567
|
-
u.points =
|
|
1575
|
+
if (g.length < 2) return [];
|
|
1576
|
+
const d = Math.min(...g.map((w) => w.x)), m = Math.min(...g.map((w) => w.y)), x = Math.max(...g.map((w) => w.x)), f = Math.max(...g.map((w) => w.y)), h = t.line.head && Vt[t.line.head.type], y = t.line.tail && Vt[t.line.tail.type], u = Q(n, h || y ? "arrow" : "line", { ...t, x: d, y: m, w: Math.max(x - d, 1), h: Math.max(f - m, 1), rot: 0, flipH: !1, flipV: !1 }, e);
|
|
1577
|
+
u.points = g.map((w) => ({ x: w.x - d, y: w.y - m })), u.curveType = "straight", u.startArrowhead = h ?? null, u.endArrowhead = y ?? null, Mt(u, t.line);
|
|
1568
1578
|
const p = (w, M) => {
|
|
1569
1579
|
if (!w) return null;
|
|
1570
1580
|
const S = n.byPptId.get(w.id);
|
|
@@ -1573,7 +1583,7 @@ function vt(t, n, e) {
|
|
|
1573
1583
|
return { elementId: v.id, focus: 0, gap: 0, anchorFractionX: (M.x + n.ox - v.x) / v.width, anchorFractionY: (M.y + n.oy - v.y) / v.height };
|
|
1574
1584
|
};
|
|
1575
1585
|
return n.glue.push(() => {
|
|
1576
|
-
u.startBinding = p(t.start,
|
|
1586
|
+
u.startBinding = p(t.start, g[0]), u.endBinding = p(t.end, g[g.length - 1]);
|
|
1577
1587
|
}), n.stats.elements++, [u];
|
|
1578
1588
|
}
|
|
1579
1589
|
function wn(t, n, e) {
|
|
@@ -1634,7 +1644,7 @@ function ie(t, n, e) {
|
|
|
1634
1644
|
return o;
|
|
1635
1645
|
}
|
|
1636
1646
|
function Mn(t) {
|
|
1637
|
-
return t ? { type: t.kind === "fade" ? "fade" : t.kind === "zoom" ? t.zoomIn === !1 ? "zoom-out" : "zoom-in" : t.dir === "r" ? "slide-right" : t.dir === "u" ? "slide-up" : t.dir === "d" ? "slide-down" : "slide-left", duration: Math.max(100, Math.min(5e3, t.durationMs)), easing: "easeInOutQuad" } : void 0;
|
|
1647
|
+
return t ? { type: t.kind === "morph" ? "morph" : t.kind === "fade" ? "fade" : t.kind === "zoom" ? t.zoomIn === !1 ? "zoom-out" : "zoom-in" : t.dir === "r" ? "slide-right" : t.dir === "u" ? "slide-up" : t.dir === "d" ? "slide-down" : "slide-left", duration: Math.max(100, Math.min(5e3, t.durationMs)), easing: "easeInOutQuad" } : void 0;
|
|
1638
1648
|
}
|
|
1639
1649
|
function vn(t, n, e) {
|
|
1640
1650
|
if (n)
|
|
@@ -1689,28 +1699,28 @@ async function Pn(t) {
|
|
|
1689
1699
|
function Tn(t, n, e) {
|
|
1690
1700
|
const o = /^(nar|sm)/.test(t) ? 4 : /^(wd|lg)/.test(t) ? 12 : 8, s = /^dk/.test(t) ? 3 : /^lt/.test(t) ? 1 : /^(wd)/.test(t) ? 3 : 1.5, r = { color: n, background: e, spacing: o, strokeWidth: s }, a = /^pct(\d+)$/.exec(t);
|
|
1691
1701
|
if (a) {
|
|
1692
|
-
const i = Math.max(1, Math.min(99, Number(a[1]))), l = i > 50,
|
|
1693
|
-
return { type: "dots", color: l ? e : n, background: l ? n : e, spacing: 4, strokeWidth: Math.max(0.5, 4 * Math.sqrt(
|
|
1702
|
+
const i = Math.max(1, Math.min(99, Number(a[1]))), l = i > 50, g = (l ? 100 - i : i) / 100;
|
|
1703
|
+
return { type: "dots", color: l ? e : n, background: l ? n : e, spacing: 4, strokeWidth: Math.max(0.5, 4 * Math.sqrt(g / Math.PI)) };
|
|
1694
1704
|
}
|
|
1695
1705
|
return /Horz$|^horz|Brick$|^shingle$|^wave$|^zigZag$/.test(t) ? { type: "stripes", ...r, angle: 0 } : /Vert$|^vert$/.test(t) ? { type: "stripes", ...r, angle: 90 } : /DnDiag$|^dnDiag$/.test(t) ? { type: "stripes", ...r, angle: 45 } : /UpDiag$|^upDiag$/.test(t) ? { type: "stripes", ...r, angle: -45 } : /^(diagCross|trellis|openDmnd|weave)$/.test(t) ? { type: "crosshatch", ...r } : /Check$|^solidDmnd$/.test(t) ? { type: "checker", ...r, angle: t === "solidDmnd" ? 45 : 0 } : /^(cross|smGrid|lgGrid|dotGrid|plaid)$/.test(t) ? { type: "grid", ...r } : { type: "dots", ...r, strokeWidth: 1 };
|
|
1696
1706
|
}
|
|
1697
1707
|
async function In(t, n, e) {
|
|
1698
|
-
const o = await ve(), s = await Pn(t), r = Math.round(t.width), a = Math.round(t.height), i = he(e ?? t.title, "slides", { width: r, height: a }), l = [],
|
|
1708
|
+
const o = await ve(), s = await Pn(t), r = Math.round(t.width), a = Math.round(t.height), i = he(e ?? t.title, "slides", { width: r, height: a }), l = [], g = { slides: 0, elements: 0, pictures: 0, paths: 0 };
|
|
1699
1709
|
i.slides = [];
|
|
1700
1710
|
const b = await mn(t, s), d = await Promise.all(t.slides.map((f) => {
|
|
1701
1711
|
const h = f.background, y = h?.kind === "image" ? s.get(h.media) : void 0;
|
|
1702
1712
|
return h?.kind === "image" && y ? gn(y.url, r, a, h.tile) : void 0;
|
|
1703
|
-
})), m = t.slides.map(() => n("slide")),
|
|
1713
|
+
})), m = t.slides.map(() => n("slide")), x = /* @__PURE__ */ new Map();
|
|
1704
1714
|
return t.slides.forEach((f, h) => {
|
|
1705
|
-
f.key &&
|
|
1715
|
+
f.key && x.set(f.key, m[h]);
|
|
1706
1716
|
}), t.slides.forEach((f, h) => {
|
|
1707
1717
|
const y = h * (r + an), u = Lt(m[h], f.name || `Slide ${h + 1}`, y, 0, { width: r, height: a });
|
|
1708
1718
|
u.order = h;
|
|
1709
|
-
const p = { ox: y, oy: 0, presets: o, nextId: n, out: [], byPptId: /* @__PURE__ */ new Map(), glue: [], warnings: l, stats:
|
|
1719
|
+
const p = { ox: y, oy: 0, presets: o, nextId: n, out: [], byPptId: /* @__PURE__ */ new Map(), glue: [], warnings: l, stats: g, images: s, slideBg: d[h], gray: b, slideIds: x };
|
|
1710
1720
|
i.elements.push(...ie(f.items, p, [])), p.glue.forEach((M) => M()), vn(u, f.background, p);
|
|
1711
1721
|
const w = Mn(f.transition);
|
|
1712
|
-
w && (u.transition = w), f.notes && (u.notes = f.notes), f.hidden && (u.hidden = !0), f.advanceAfterMs && (u.advanceAfter = f.advanceAfterMs), f.section && (u.section = f.section), i.slides.push(u),
|
|
1713
|
-
}), i.slides.length || i.slides.push(Lt(void 0, "Slide 1", 0, 0, { width: r, height: a })), t.loop && (i.globalSettings = { ...i.globalSettings || {}, slideShowLoop: !0 }), { doc: i, warnings: [...new Set(l)], stats:
|
|
1722
|
+
w && (u.transition = w), f.notes && (u.notes = f.notes), f.hidden && (u.hidden = !0), f.advanceAfterMs && (u.advanceAfter = f.advanceAfterMs), f.section && (u.section = f.section), i.slides.push(u), g.slides++;
|
|
1723
|
+
}), i.slides.length || i.slides.push(Lt(void 0, "Slide 1", 0, 0, { width: r, height: a })), t.loop && (i.globalSettings = { ...i.globalSettings || {}, slideShowLoop: !0 }), { doc: i, warnings: [...new Set(l)], stats: g };
|
|
1714
1724
|
}
|
|
1715
1725
|
const Nn = 512 * 1024 * 1024;
|
|
1716
1726
|
async function Ln(t, n) {
|