@silurus/ooxml 0.4.0 → 0.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,19 +1,33 @@
1
1
  import { n as e, t } from "./autoResize-U2-IRmNE.js";
2
- import { t as n } from "./renderer-CpJhtczQ.js";
2
+ import { t as n } from "./renderer-UsGKjfFU.js";
3
3
  import { i as r, n as i, r as a, t as o } from "./paint-CIAXt08M.js";
4
+ //#region packages/pptx/src/media-chrome.ts
5
+ function s(e, t, n, r, i, a) {
6
+ let o = Math.max(18, Math.min(32, Math.min(r, i) * .25));
7
+ if (e.save(), e.shadowColor = "rgba(0, 0, 0, 0.3)", e.shadowBlur = o * .35, e.fillStyle = "rgba(20, 20, 20, 0.7)", e.beginPath(), e.arc(t, n, o, 0, Math.PI * 2), e.fill(), e.shadowColor = "transparent", e.shadowBlur = 0, e.fillStyle = "#fff", a === "paused") {
8
+ e.beginPath();
9
+ let r = o * .48;
10
+ e.moveTo(t - r * .4, n - r), e.lineTo(t - r * .4, n + r), e.lineTo(t + r * .75, n), e.closePath(), e.fill();
11
+ } else {
12
+ let r = o * .2, i = o * .8, a = o * .15;
13
+ e.fillRect(t - a - r, n - i / 2, r, i), e.fillRect(t + a, n - i / 2, r, i);
14
+ }
15
+ e.restore();
16
+ }
17
+ //#endregion
4
18
  //#region packages/pptx/src/renderer.ts
5
- var s = 12700;
6
- function c(e, t) {
19
+ var c = 12700;
20
+ function l(e, t) {
7
21
  return e * t;
8
22
  }
9
- var l = i;
10
- function u(e) {
11
- return !e || e.fillType === "none" ? null : e.fillType === "solid" ? l(e.color) : e.fillType === "gradient" && e.stops.length > 0 ? l(e.stops[0].color) : null;
23
+ var u = i;
24
+ function d(e) {
25
+ return !e || e.fillType === "none" ? null : e.fillType === "solid" ? u(e.color) : e.fillType === "gradient" && e.stops.length > 0 ? u(e.stops[0].color) : null;
12
26
  }
13
- function d(e, t, n, r, i, o) {
27
+ function f(e, t, n, r, i, o) {
14
28
  return a(e, t, n, r, i, o);
15
29
  }
16
- var f = {
30
+ var p = {
17
31
  33: "✏",
18
32
  34: "✂",
19
33
  35: "✁",
@@ -32,14 +46,14 @@ var f = {
32
46
  61607: "▪",
33
47
  61623: "•"
34
48
  };
35
- function p(e, t) {
49
+ function m(e, t) {
36
50
  let n = t.toLowerCase();
37
- return n.includes("wingdings") || n === "symbol" ? f[e.charCodeAt(0)] ?? e : e;
51
+ return n.includes("wingdings") || n === "symbol" ? p[e.charCodeAt(0)] ?? e : e;
38
52
  }
39
- function m(e, t) {
53
+ function h(e, t) {
40
54
  return e ? e.startsWith("+") ? e === "+mj-lt" || e === "+mj-ea" || e === "+mj-cs" ? t.themeMajorFont ?? "sans-serif" : t.themeMinorFont ?? "sans-serif" : e.split(",")[0].trim() || (t.themeMinorFont ?? "sans-serif") : t.themeMinorFont ?? "sans-serif";
41
55
  }
42
- var h = new Set([
56
+ var g = new Set([
43
57
  "serif",
44
58
  "sans-serif",
45
59
  "monospace",
@@ -47,26 +61,26 @@ var h = new Set([
47
61
  "fantasy",
48
62
  "system-ui"
49
63
  ]);
50
- function g(e) {
64
+ function _(e) {
51
65
  let t = e.toLowerCase();
52
66
  return /mono|courier|consolas|等幅|gothic_m/.test(t) ? "monospace" : /mincho|明朝|roman|times|garamond|georgia|palatino|century|didot/.test(t) ? "serif" : "sans-serif";
53
67
  }
54
- function _(e, t, n, r, i) {
55
- let a = t ? "italic " : "", o = e ? "bold " : "", s = m(r, i);
56
- return h.has(s) ? `${a}${o}${n}px ${s}` : `${a}${o}${n}px "${s}", ${g(s)}`;
68
+ function v(e, t, n, r, i) {
69
+ let a = t ? "italic " : "", o = e ? "bold " : "", s = h(r, i);
70
+ return g.has(s) ? `${a}${o}${n}px ${s}` : `${a}${o}${n}px "${s}", ${_(s)}`;
57
71
  }
58
- function v(e, t, n, r, i, a, o, u = !1, d = !1, f = 1, p, h = {
72
+ function y(e, t, n, r, i, a, o, s = !1, d = !1, f = 1, p, m = {
59
73
  themeMajorFont: null,
60
74
  themeMinorFont: null
61
75
  }) {
62
- let g = [], v = { segments: [] }, y = 0, b = !1, x = 0, S = () => {
63
- g.push(v), v = { segments: [] }, y = 0, b = !1;
76
+ let g = [], _ = { segments: [] }, y = 0, b = !1, x = 0, S = () => {
77
+ g.push(_), _ = { segments: [] }, y = 0, b = !1;
64
78
  }, C = (t, n, r, i, a, o, s) => {
65
79
  if (!t) return;
66
80
  e.font = n;
67
81
  let c = e.measureText(t).width;
68
- if (b && v.tabStop) {
69
- let e = v.tabStop.segments, c = e.at(-1);
82
+ if (b && _.tabStop) {
83
+ let e = _.tabStop.segments, c = e.at(-1);
70
84
  c && c.font === n && c.color === i && c.underline === a && c.strikethrough === o && c.baseline === s ? c.text += t : e.push({
71
85
  text: t,
72
86
  font: n,
@@ -78,8 +92,8 @@ function v(e, t, n, r, i, a, o, u = !1, d = !1, f = 1, p, h = {
78
92
  });
79
93
  } else {
80
94
  y += c;
81
- let e = v.segments.at(-1);
82
- e && e.font === n && e.color === i && e.underline === a && e.strikethrough === o && e.baseline === s ? e.text += t : v.segments.push({
95
+ let e = _.segments.at(-1);
96
+ e && e.font === n && e.color === i && e.underline === a && e.strikethrough === o && e.baseline === s ? e.text += t : _.segments.push({
83
97
  text: t,
84
98
  font: n,
85
99
  sizePx: r,
@@ -95,14 +109,14 @@ function v(e, t, n, r, i, a, o, u = !1, d = !1, f = 1, p, h = {
95
109
  S();
96
110
  continue;
97
111
  }
98
- let w = g.fontSize == null ? r : g.fontSize * s * a * f, T = m(g.fontFamily ?? t.defFontFamily ?? null, h), E = g.color ? l(g.color) : i, D = _(g.bold ?? t.defBold ?? u, g.italic ?? t.defItalic ?? d, w, T, h);
112
+ let w = g.fontSize == null ? r : g.fontSize * c * a * f, T = h(g.fontFamily ?? t.defFontFamily ?? null, m), E = g.color ? u(g.color) : i, D = v(g.bold ?? t.defBold ?? s, g.italic ?? t.defItalic ?? d, w, T, m);
99
113
  e.font = D;
100
114
  let O = (g.fieldType === "slidenum" && p !== void 0 ? String(p) : g.text).split(/(\s+)/);
101
115
  for (let r of O) {
102
116
  if (!r) continue;
103
117
  if (/^\t+$/.test(r)) {
104
- let e = o + y, n = (t.tabStops ?? []).find((t) => c(t.pos, a) > e);
105
- n ? (x = c(n.pos, a), n.algn === "r" || n.algn === "ctr" ? (b = !0, v.tabStop = {
118
+ let e = o + y, n = (t.tabStops ?? []).find((t) => l(t.pos, a) > e);
119
+ n ? (x = l(n.pos, a), n.algn === "r" || n.algn === "ctr" ? (b = !0, _.tabStop = {
106
120
  px: x,
107
121
  algn: n.algn,
108
122
  segments: []
@@ -135,34 +149,34 @@ function v(e, t, n, r, i, a, o, u = !1, d = !1, f = 1, p, h = {
135
149
  } else S(), C(r, D, w, E, g.underline, g.strikethrough, g.baseline ?? void 0);
136
150
  }
137
151
  }
138
- return g.push(v), g;
152
+ return g.push(_), g;
139
153
  }
140
- function y(e, t, n, r) {
141
- e.fillStyle = d(t, e, 0, 0, n, r) ?? "#FFFFFF", e.fillRect(0, 0, n, r);
154
+ function b(e, t, n, r) {
155
+ e.fillStyle = f(t, e, 0, 0, n, r) ?? "#FFFFFF", e.fillRect(0, 0, n, r);
142
156
  }
143
- function b(e, t, n) {
157
+ function x(e, t, n) {
144
158
  if (!t) return;
145
- let r = t.dir * Math.PI / 180, i = c(t.dist, n);
146
- e.shadowColor = l(t.color, t.alpha), e.shadowBlur = c(t.blur, n), e.shadowOffsetX = Math.cos(r) * i, e.shadowOffsetY = Math.sin(r) * i;
159
+ let r = t.dir * Math.PI / 180, i = l(t.dist, n);
160
+ e.shadowColor = u(t.color, t.alpha), e.shadowBlur = l(t.blur, n), e.shadowOffsetX = Math.cos(r) * i, e.shadowOffsetY = Math.sin(r) * i;
147
161
  }
148
- function x(e) {
162
+ function S(e) {
149
163
  e.shadowColor = "transparent", e.shadowBlur = 0, e.shadowOffsetX = 0, e.shadowOffsetY = 0;
150
164
  }
151
- function S(e, t, n, r = "#000000", i, a = {
165
+ function C(e, t, n, r = "#000000", i, a = {
152
166
  themeMajorFont: null,
153
167
  themeMinorFont: null
154
168
  }) {
155
- let o = c(t.x, n), s = c(t.y, n), u = c(t.width, n), f = c(t.height, n);
156
- if (f === 0 && t.textBody?.verticalAnchor === "b") {
157
- if (t.stroke && (e.save(), N(e, t.stroke, n), e.beginPath(), e.moveTo(o, s), e.lineTo(o + u, s), e.stroke(), e.restore()), t.textBody) {
158
- let c = t.defaultTextColor ? l(t.defaultTextColor) : null;
159
- k(e, t.textBody, o, s, u, f, n, c, t.rotation, t.flipH, t.flipV, r, i, a);
169
+ let o = l(t.x, n), s = l(t.y, n), c = l(t.width, n), d = l(t.height, n);
170
+ if (d === 0 && t.textBody?.verticalAnchor === "b") {
171
+ if (t.stroke && (e.save(), P(e, t.stroke, n), e.beginPath(), e.moveTo(o, s), e.lineTo(o + c, s), e.stroke(), e.restore()), t.textBody) {
172
+ let l = t.defaultTextColor ? u(t.defaultTextColor) : null;
173
+ A(e, t.textBody, o, s, c, d, n, l, t.rotation, t.flipH, t.flipV, r, i, a);
160
174
  }
161
175
  return;
162
176
  }
163
- e.save(), (t.rotation !== 0 || t.flipH || t.flipV) && (e.translate(o + u / 2, s + f / 2), e.rotate(t.rotation * Math.PI / 180), t.flipH && e.scale(-1, 1), t.flipV && e.scale(1, -1), e.translate(-(o + u / 2), -(s + f / 2)));
164
- let p = t.geometry.toLowerCase(), m = d(t.fill, e, o, s, u, f);
165
- if (b(e, t.shadow ?? null, n), e.beginPath(), t.custGeom && t.custGeom.length > 0 ? C(e, t.custGeom, o, s, u, f) : E(e, p, o, s, u, f, t.adj, t.adj2, t.adj3, t.adj4), m && p !== "arc" && (e.fillStyle = m, p === "donut" || p === "smileyface" ? e.fill("evenodd") : e.fill(), x(e)), t.stroke && (N(e, t.stroke, n), e.stroke(), new Set([
177
+ e.save(), (t.rotation !== 0 || t.flipH || t.flipV) && (e.translate(o + c / 2, s + d / 2), e.rotate(t.rotation * Math.PI / 180), t.flipH && e.scale(-1, 1), t.flipV && e.scale(1, -1), e.translate(-(o + c / 2), -(s + d / 2)));
178
+ let p = t.geometry.toLowerCase(), m = f(t.fill, e, o, s, c, d);
179
+ if (x(e, t.shadow ?? null, n), e.beginPath(), t.custGeom && t.custGeom.length > 0 ? w(e, t.custGeom, o, s, c, d) : D(e, p, o, s, c, d, t.adj, t.adj2, t.adj3, t.adj4), m && p !== "arc" && (e.fillStyle = m, p === "donut" || p === "smileyface" ? e.fill("evenodd") : e.fill(), S(e)), t.stroke && (P(e, t.stroke, n), e.stroke(), new Set([
166
180
  "line",
167
181
  "straightconnector1",
168
182
  "bentconnector2",
@@ -174,26 +188,26 @@ function S(e, t, n, r = "#000000", i, a = {
174
188
  "curvedconnector4",
175
189
  "curvedconnector5"
176
190
  ]).has(p))) {
177
- let r = Math.atan2(f, u);
178
- t.stroke.tailEnd && M(e, o + u, s + f, r, t.stroke.tailEnd, t.stroke, n), t.stroke.headEnd && M(e, o, s, r + Math.PI, t.stroke.headEnd, t.stroke, n);
191
+ let r = Math.atan2(d, c);
192
+ t.stroke.tailEnd && N(e, o + c, s + d, r, t.stroke.tailEnd, t.stroke, n), t.stroke.headEnd && N(e, o, s, r + Math.PI, t.stroke.headEnd, t.stroke, n);
179
193
  }
180
194
  if (t.textBody) {
181
- let c = t.defaultTextColor ? l(t.defaultTextColor) : null;
195
+ let l = t.defaultTextColor ? u(t.defaultTextColor) : null;
182
196
  if (e.save(), t.flipH || t.flipV) {
183
- let n = o + u / 2, r = s + f / 2;
197
+ let n = o + c / 2, r = s + d / 2;
184
198
  e.translate(n, r), t.flipH && e.scale(-1, 1), t.flipV && e.scale(1, -1), e.translate(-n, -r);
185
199
  }
186
- let d = o, m = s, h = u, g = f;
200
+ let f = o, m = s, h = c, g = d;
187
201
  if (p === "ellipse") {
188
- let e = u * (1 - 1 / Math.SQRT2) / 2, t = f * (1 - 1 / Math.SQRT2) / 2;
189
- d = o + e, m = s + t, h = u / Math.SQRT2, g = f / Math.SQRT2;
202
+ let e = c * (1 - 1 / Math.SQRT2) / 2, t = d * (1 - 1 / Math.SQRT2) / 2;
203
+ f = o + e, m = s + t, h = c / Math.SQRT2, g = d / Math.SQRT2;
190
204
  }
191
- k(e, t.textBody, d, m, h, g, n, c, 0, !1, !1, r, i, a), e.restore();
205
+ A(e, t.textBody, f, m, h, g, n, l, 0, !1, !1, r, i, a), e.restore();
192
206
  }
193
207
  e.restore();
194
208
  }
195
- var C = r;
196
- function w(e, t, n, r, i, a, o, s = -Math.PI / 2) {
209
+ var w = r;
210
+ function T(e, t, n, r, i, a, o, s = -Math.PI / 2) {
197
211
  let c = a * 2;
198
212
  for (let l = 0; l < c; l++) {
199
213
  let c = s + l * Math.PI / a, u = l % 2 == 0 ? 1 : o, d = t + r * u * Math.cos(c), f = n + i * u * Math.sin(c);
@@ -201,14 +215,14 @@ function w(e, t, n, r, i, a, o, s = -Math.PI / 2) {
201
215
  }
202
216
  e.closePath();
203
217
  }
204
- function T(e, t, n, r, i, a, o = -Math.PI / 2) {
218
+ function E(e, t, n, r, i, a, o = -Math.PI / 2) {
205
219
  for (let s = 0; s < a; s++) {
206
220
  let c = o + s * 2 * Math.PI / a, l = t + r * Math.cos(c), u = n + i * Math.sin(c);
207
221
  s === 0 ? e.moveTo(l, u) : e.lineTo(l, u);
208
222
  }
209
223
  e.closePath();
210
224
  }
211
- function E(e, t, n, r, i, a, o = null, s = null, c = null, l = null) {
225
+ function D(e, t, n, r, i, a, o = null, s = null, c = null, l = null) {
212
226
  let u = n + i / 2, d = r + a / 2;
213
227
  switch (t) {
214
228
  case "ellipse":
@@ -243,53 +257,53 @@ function E(e, t, n, r, i, a, o = null, s = null, c = null, l = null) {
243
257
  break;
244
258
  }
245
259
  case "pentagon":
246
- T(e, u, d, i / 2, a / 2, 5);
260
+ E(e, u, d, i / 2, a / 2, 5);
247
261
  break;
248
262
  case "hexagon":
249
- T(e, u, d, i / 2, a / 2, 6, 0);
263
+ E(e, u, d, i / 2, a / 2, 6, 0);
250
264
  break;
251
265
  case "heptagon":
252
- T(e, u, d, i / 2, a / 2, 7);
266
+ E(e, u, d, i / 2, a / 2, 7);
253
267
  break;
254
268
  case "octagon":
255
- T(e, u, d, i / 2, a / 2, 8, -Math.PI / 8);
269
+ E(e, u, d, i / 2, a / 2, 8, -Math.PI / 8);
256
270
  break;
257
271
  case "decagon":
258
- T(e, u, d, i / 2, a / 2, 10);
272
+ E(e, u, d, i / 2, a / 2, 10);
259
273
  break;
260
274
  case "dodecagon":
261
- T(e, u, d, i / 2, a / 2, 12);
275
+ E(e, u, d, i / 2, a / 2, 12);
262
276
  break;
263
277
  case "star4":
264
- w(e, u, d, i / 2, a / 2, 4, (o ?? 12500) / 5e4);
278
+ T(e, u, d, i / 2, a / 2, 4, (o ?? 12500) / 5e4);
265
279
  break;
266
280
  case "star5":
267
281
  case "star":
268
- w(e, u, d, i / 2, a / 2, 5, (o ?? 19098) / 5e4);
282
+ T(e, u, d, i / 2, a / 2, 5, (o ?? 19098) / 5e4);
269
283
  break;
270
284
  case "star6":
271
- w(e, u, d, i / 2, a / 2, 6, (o ?? 28868) / 5e4, 0);
285
+ T(e, u, d, i / 2, a / 2, 6, (o ?? 28868) / 5e4, 0);
272
286
  break;
273
287
  case "star7":
274
- w(e, u, d, i / 2, a / 2, 7, (o ?? 34142) / 5e4);
288
+ T(e, u, d, i / 2, a / 2, 7, (o ?? 34142) / 5e4);
275
289
  break;
276
290
  case "star8":
277
- w(e, u, d, i / 2, a / 2, 8, (o ?? 37500) / 5e4, -Math.PI / 2);
291
+ T(e, u, d, i / 2, a / 2, 8, (o ?? 37500) / 5e4, -Math.PI / 2);
278
292
  break;
279
293
  case "star10":
280
- w(e, u, d, i / 2, a / 2, 10, (o ?? 41421) / 5e4);
294
+ T(e, u, d, i / 2, a / 2, 10, (o ?? 41421) / 5e4);
281
295
  break;
282
296
  case "star12":
283
- w(e, u, d, i / 2, a / 2, 12, (o ?? 37500) / 5e4, 0);
297
+ T(e, u, d, i / 2, a / 2, 12, (o ?? 37500) / 5e4, 0);
284
298
  break;
285
299
  case "star16":
286
- w(e, u, d, i / 2, a / 2, 16, (o ?? 37500) / 5e4, -Math.PI / 2);
300
+ T(e, u, d, i / 2, a / 2, 16, (o ?? 37500) / 5e4, -Math.PI / 2);
287
301
  break;
288
302
  case "star24":
289
- w(e, u, d, i / 2, a / 2, 24, (o ?? 37500) / 5e4, 0);
303
+ T(e, u, d, i / 2, a / 2, 24, (o ?? 37500) / 5e4, 0);
290
304
  break;
291
305
  case "star32":
292
- w(e, u, d, i / 2, a / 2, 32, (o ?? 37500) / 5e4, -Math.PI / 2);
306
+ T(e, u, d, i / 2, a / 2, 32, (o ?? 37500) / 5e4, -Math.PI / 2);
293
307
  break;
294
308
  case "rightarrow": {
295
309
  let t = a * Math.min(1, (o ?? 5e4) / 1e5), c = i * Math.min(1, (s ?? 5e4) / 1e5), l = r + (a - t) / 2;
@@ -951,19 +965,19 @@ function E(e, t, n, r, i, a, o = null, s = null, c = null, l = null) {
951
965
  break;
952
966
  }
953
967
  }
954
- function D(e, t) {
968
+ function O(e, t) {
955
969
  switch (t) {
956
970
  case "arabicPeriod": return `${e}.`;
957
971
  case "arabicParenR": return `${e})`;
958
972
  case "arabicParenBoth": return `(${e})`;
959
973
  case "alphaLcPeriod": return `${String.fromCharCode(96 + e)}.`;
960
974
  case "alphaUcPeriod": return `${String.fromCharCode(64 + e)}.`;
961
- case "romanLcPeriod": return `${O(e).toLowerCase()}.`;
962
- case "romanUcPeriod": return `${O(e)}.`;
975
+ case "romanLcPeriod": return `${k(e).toLowerCase()}.`;
976
+ case "romanUcPeriod": return `${k(e)}.`;
963
977
  default: return `${e}.`;
964
978
  }
965
979
  }
966
- function O(e) {
980
+ function k(e) {
967
981
  let t = [
968
982
  1e3,
969
983
  900,
@@ -996,34 +1010,34 @@ function O(e) {
996
1010
  for (let i = 0; i < t.length; i++) for (; e >= t[i];) r += n[i], e -= t[i];
997
1011
  return r;
998
1012
  }
999
- function k(e, t, n, r, i, a, o, u = null, d = 0, f = !1, h = !1, g = "#000000", y, b = {
1013
+ function A(e, t, n, r, i, a, o, s = null, d = 0, f = !1, p = !1, g = "#000000", _, b = {
1000
1014
  themeMajorFont: null,
1001
1015
  themeMinorFont: null
1002
1016
  }) {
1003
1017
  let x = t.vert === "vert" || t.vert === "eaVert", S = t.vert === "vert270";
1004
1018
  if (x || S) {
1005
- let s = n + i / 2, c = r + a / 2;
1006
- e.save(), e.translate(s, c), e.rotate(S ? -Math.PI / 2 : Math.PI / 2), k(e, {
1019
+ let c = n + i / 2, l = r + a / 2;
1020
+ e.save(), e.translate(c, l), e.rotate(S ? -Math.PI / 2 : Math.PI / 2), A(e, {
1007
1021
  ...t,
1008
1022
  vert: "horz"
1009
- }, -a / 2, -i / 2, a, i, o, u, 0, !1, !1, g, y, b), e.restore();
1023
+ }, -a / 2, -i / 2, a, i, o, s, 0, !1, !1, g, _, b), e.restore();
1010
1024
  return;
1011
1025
  }
1012
- let C = c(t.lIns, o), w = c(t.rIns, o), T = c(t.tIns, o), E = c(t.bIns, o), O = t.wrap !== "none", A = t.defaultBold ?? !1, j = t.defaultItalic ?? !1, M = u ?? g, N = (r) => {
1013
- let a = (t.defaultFontSize ?? 18) * s * o * r, u = [], d = 0, f = /* @__PURE__ */ new Map();
1014
- for (let h of t.paragraphs) {
1015
- let t = c(h.marL, o), g = c(h.marR, o), x = c(h.indent, o), S = h.defFontSize == null ? a : h.defFontSize * s * o * r, T = h.defColor ? l(h.defColor) : M, E = h.bullet.type === "char" || h.bullet.type === "autoNum", k = (() => {
1016
- for (let e of h.runs) if (e.type === "text" && e.fontSize != null) return e.fontSize;
1026
+ let C = l(t.lIns, o), w = l(t.rIns, o), T = l(t.tIns, o), E = l(t.bIns, o), D = t.wrap !== "none", k = t.defaultBold ?? !1, j = t.defaultItalic ?? !1, M = s ?? g, N = (r) => {
1027
+ let a = (t.defaultFontSize ?? 18) * c * o * r, s = [], d = 0, f = /* @__PURE__ */ new Map();
1028
+ for (let p of t.paragraphs) {
1029
+ let t = l(p.marL, o), g = l(p.marR, o), x = l(p.indent, o), S = p.defFontSize == null ? a : p.defFontSize * c * o * r, T = p.defColor ? u(p.defColor) : M, E = p.bullet.type === "char" || p.bullet.type === "autoNum", A = (() => {
1030
+ for (let e of p.runs) if (e.type === "text" && e.fontSize != null) return e.fontSize;
1017
1031
  return null;
1018
- })(), N = k == null ? S : k * s * o * r, P = "", F = _(!1, !1, N, "sans-serif", b), I = T;
1019
- if (h.bullet.type === "char") {
1020
- let e = h.bullet, t = e.sizePct == null ? N : N * (e.sizePct / 100);
1021
- P = p(e.char, e.fontFamily ?? ""), F = _(!1, !1, t, P === e.char ? m(e.fontFamily ?? null, b) : "sans-serif", b), I = e.color ? l(e.color) : T, f.clear();
1022
- } else if (h.bullet.type === "autoNum") {
1023
- let e = h.bullet, t = h.lvl;
1024
- f.has(t) ? f.set(t, f.get(t) + 1) : f.set(t, e.startAt ?? 1), P = D(f.get(t), e.numType), F = _(!1, !1, N, "sans-serif", b), I = T;
1032
+ })(), N = A == null ? S : A * c * o * r, P = "", F = v(!1, !1, N, "sans-serif", b), I = T;
1033
+ if (p.bullet.type === "char") {
1034
+ let e = p.bullet, t = e.sizePct == null ? N : N * (e.sizePct / 100);
1035
+ P = m(e.char, e.fontFamily ?? ""), F = v(!1, !1, t, P === e.char ? h(e.fontFamily ?? null, b) : "sans-serif", b), I = e.color ? u(e.color) : T, f.clear();
1036
+ } else if (p.bullet.type === "autoNum") {
1037
+ let e = p.bullet, t = p.lvl;
1038
+ f.has(t) ? f.set(t, f.get(t) + 1) : f.set(t, e.startAt ?? 1), P = O(f.get(t), e.numType), F = v(!1, !1, N, "sans-serif", b), I = T;
1025
1039
  } else f.clear();
1026
- let L = n + C + t, R = n + C + t + x, z = i - C - w - t - g, B = v(e, h, O ? z : Infinity, S, T, o, t, A, j, r, y, b), V = h.spaceBefore == null ? 0 : h.spaceBefore / 100 * s * o * r, H = h.spaceAfter == null ? 0 : h.spaceAfter / 100 * s * o * r;
1040
+ let L = n + C + t, R = n + C + t + x, z = i - C - w - t - g, B = y(e, p, D ? z : Infinity, S, T, o, t, k, j, r, _, b), V = p.spaceBefore == null ? 0 : p.spaceBefore / 100 * c * o * r, H = p.spaceAfter == null ? 0 : p.spaceAfter / 100 * c * o * r;
1027
1041
  for (let t = 0; t < B.length; t++) {
1028
1042
  let n = B[t], r = t === 0, i = t === B.length - 1, a = 0;
1029
1043
  for (let e of n.segments) e.sizePx > a && (a = e.sizePx);
@@ -1032,28 +1046,28 @@ function k(e, t, n, r, i, a, o, u = null, d = 0, f = !1, h = !1, g = "#000000",
1032
1046
  let t = e.measureText("M"), n = t.actualBoundingBoxAscent + t.actualBoundingBoxDescent;
1033
1047
  n > a && (a = n);
1034
1048
  }
1035
- let c;
1036
- c = h.spaceLine ? h.spaceLine.type === "pct" ? a * 1.2 * (h.spaceLine.val / 1e5) : h.spaceLine.val * s * o : a * 1.2;
1037
- let l = c + (i ? H : 0), f = r ? V : 0, p = !E && r ? x : 0;
1038
- u.push({
1049
+ let l;
1050
+ l = p.spaceLine ? p.spaceLine.type === "pct" ? a * 1.2 * (p.spaceLine.val / 1e5) : p.spaceLine.val * c * o : a * 1.2;
1051
+ let u = l + (i ? H : 0), f = r ? V : 0, m = !E && r ? x : 0;
1052
+ s.push({
1039
1053
  line: n,
1040
- linePx: l,
1041
- lineHeight: c,
1054
+ linePx: u,
1055
+ lineHeight: l,
1042
1056
  topGapPx: f,
1043
- textXOffset: p,
1057
+ textXOffset: m,
1044
1058
  bulletLabel: r ? P : "",
1045
1059
  bulletFont: F,
1046
1060
  bulletColor: I,
1047
1061
  bulletX: R,
1048
1062
  textX: L,
1049
1063
  textMaxW: z,
1050
- alignment: h.alignment,
1051
- para: h
1052
- }), d += l + f;
1064
+ alignment: p.alignment,
1065
+ para: p
1066
+ }), d += u + f;
1053
1067
  }
1054
1068
  }
1055
1069
  return {
1056
- allLines: u,
1070
+ allLines: s,
1057
1071
  totalHeight: d
1058
1072
  };
1059
1073
  }, { allLines: P, totalHeight: F } = N(1);
@@ -1103,38 +1117,34 @@ function k(e, t, n, r, i, a, o, u = null, d = 0, f = !1, h = !1, g = "#000000",
1103
1117
  }
1104
1118
  e.restore();
1105
1119
  }
1106
- async function A(e, t, n) {
1120
+ async function j(e, t, n) {
1107
1121
  try {
1108
1122
  let r = await (await fetch(t.dataUrl)).blob(), i = await createImageBitmap(r);
1109
1123
  e.save(), t.alpha != null && (e.globalAlpha *= t.alpha);
1110
- let a = c(t.x, n), o = c(t.y, n), s = c(t.width, n), l = c(t.height, n);
1111
- if ((t.rotation !== 0 || t.flipH || t.flipV) && (e.translate(a + s / 2, o + l / 2), e.rotate(t.rotation * Math.PI / 180), t.flipH && e.scale(-1, 1), t.flipV && e.scale(1, -1), e.translate(-(a + s / 2), -(o + l / 2))), t.clipAdjust != null) {
1112
- let n = Math.min(s, l), r = t.clipAdjust / 1e5 * n;
1113
- e.beginPath(), e.roundRect(a, o, s, l, r), e.clip();
1124
+ let a = l(t.x, n), o = l(t.y, n), s = l(t.width, n), c = l(t.height, n);
1125
+ if ((t.rotation !== 0 || t.flipH || t.flipV) && (e.translate(a + s / 2, o + c / 2), e.rotate(t.rotation * Math.PI / 180), t.flipH && e.scale(-1, 1), t.flipV && e.scale(1, -1), e.translate(-(a + s / 2), -(o + c / 2))), t.clipAdjust != null) {
1126
+ let n = Math.min(s, c), r = t.clipAdjust / 1e5 * n;
1127
+ e.beginPath(), e.roundRect(a, o, s, c, r), e.clip();
1114
1128
  }
1115
1129
  let u = t.srcRect;
1116
1130
  if (u && (u.l || u.t || u.r || u.b)) {
1117
- let t = i.width, n = i.height, r = Math.max(0, Math.min(1, u.l ?? 0)), c = Math.max(0, Math.min(1, u.t ?? 0)), d = Math.max(0, Math.min(1, u.r ?? 0)), f = Math.max(0, Math.min(1, u.b ?? 0)), p = r * t, m = c * n, h = Math.max(1, t - p - d * t), g = Math.max(1, n - m - f * n);
1118
- e.drawImage(i, p, m, h, g, a, o, s, l);
1119
- } else e.drawImage(i, a, o, s, l);
1131
+ let t = i.width, n = i.height, r = Math.max(0, Math.min(1, u.l ?? 0)), l = Math.max(0, Math.min(1, u.t ?? 0)), d = Math.max(0, Math.min(1, u.r ?? 0)), f = Math.max(0, Math.min(1, u.b ?? 0)), p = r * t, m = l * n, h = Math.max(1, t - p - d * t), g = Math.max(1, n - m - f * n);
1132
+ e.drawImage(i, p, m, h, g, a, o, s, c);
1133
+ } else e.drawImage(i, a, o, s, c);
1120
1134
  e.restore(), i.close();
1121
1135
  } catch {}
1122
1136
  }
1123
- async function j(e, t, n, r, i) {
1124
- let a = c(t.x, n), o = c(t.y, n), s = c(t.width, n), l = c(t.height, n), u = !1;
1137
+ async function M(e, t, n, r, i) {
1138
+ let a = l(t.x, n), o = l(t.y, n), c = l(t.width, n), u = l(t.height, n), d = !1;
1125
1139
  if (t.posterPath && r) try {
1126
- let n = await r(t.posterPath), i = t.posterMimeType ? new Blob([n], { type: t.posterMimeType }) : n, c = await createImageBitmap(i);
1127
- e.drawImage(c, a, o, s, l), c.close(), u = !0;
1140
+ let n = await r(t.posterPath), i = t.posterMimeType ? new Blob([n], { type: t.posterMimeType }) : n, s = await createImageBitmap(i);
1141
+ e.drawImage(s, a, o, c, u), s.close(), d = !0;
1128
1142
  } catch {}
1129
- if (u || (e.fillStyle = t.mediaKind === "video" ? "#111" : "#f0f0f0", e.fillRect(a, o, s, l)), i) return;
1130
- let d = a + s / 2, f = o + l / 2, p = Math.min(s, l) * .18;
1131
- e.save(), e.fillStyle = "rgba(0, 0, 0, 0.55)", e.beginPath(), e.arc(d, f, p, 0, Math.PI * 2), e.fill(), e.fillStyle = "#fff", e.beginPath();
1132
- let m = p * .55;
1133
- e.moveTo(d - m * .5, f - m), e.lineTo(d - m * .5, f + m), e.lineTo(d + m, f), e.closePath(), e.fill(), e.restore();
1143
+ d || (e.fillStyle = t.mediaKind === "video" ? "#111" : "#f0f0f0", e.fillRect(a, o, c, u)), !i && s(e, a + c / 2, o + u / 2, c, u, "paused");
1134
1144
  }
1135
- function M(e, t, n, r, i, a, o) {
1145
+ function N(e, t, n, r, i, a, o) {
1136
1146
  if (i.type === "none") return;
1137
- let s = Math.max(.5, c(a.width, o)), u = i.w === "sm" ? 2 : i.w === "lg" ? 4 : 3, d = i.len === "sm" ? 2 : i.len === "lg" ? 4 : 3, f = s * u / 2, p = s * d, m = l(a.color);
1147
+ let s = Math.max(.5, l(a.width, o)), c = i.w === "sm" ? 2 : i.w === "lg" ? 4 : 3, d = i.len === "sm" ? 2 : i.len === "lg" ? 4 : 3, f = s * c / 2, p = s * d, m = u(a.color);
1138
1148
  switch (e.save(), e.translate(t, n), e.rotate(r), e.fillStyle = m, e.strokeStyle = m, e.lineWidth = s, e.setLineDash([]), e.beginPath(), i.type) {
1139
1149
  case "triangle":
1140
1150
  case "stealth":
@@ -1152,18 +1162,18 @@ function M(e, t, n, r, i, a, o) {
1152
1162
  }
1153
1163
  e.restore();
1154
1164
  }
1155
- function N(e, t, n) {
1165
+ function P(e, t, n) {
1156
1166
  o(e, t, n);
1157
1167
  }
1158
- function P(e, t, n, r, i = {
1168
+ function F(e, t, n, r, i = {
1159
1169
  themeMajorFont: null,
1160
1170
  themeMinorFont: null
1161
1171
  }) {
1162
- let a = c(t.x, n), o = c(t.y, n), s = t.cols.map((e) => c(e, n)), l = t.rows.map((e) => c(e.height, n)), d = o;
1172
+ let a = l(t.x, n), o = l(t.y, n), s = t.cols.map((e) => l(e, n)), c = t.rows.map((e) => l(e.height, n)), u = o;
1163
1173
  for (let o = 0; o < t.rows.length; o++) {
1164
- let c = t.rows[o], f = l[o], p = a;
1165
- for (let t = 0; t < c.cells.length; t++) {
1166
- let a = c.cells[t];
1174
+ let l = t.rows[o], f = c[o], p = a;
1175
+ for (let t = 0; t < l.cells.length; t++) {
1176
+ let a = l.cells[t];
1167
1177
  if (a.hMerge || a.vMerge) {
1168
1178
  p += s[t] ?? 0;
1169
1179
  continue;
@@ -1171,16 +1181,16 @@ function P(e, t, n, r, i = {
1171
1181
  let f = 0;
1172
1182
  for (let e = 0; e < (a.gridSpan || 1); e++) f += s[t + e] ?? 0;
1173
1183
  let m = 0;
1174
- for (let e = 0; e < (a.rowSpan || 1); e++) m += l[o + e] ?? 0;
1175
- let h = u(a.fill);
1176
- h && (e.fillStyle = h, e.fillRect(p, d, f, m)), a.textBody && k(e, a.textBody, p, d, f, m, n, null, 0, !1, !1, "#000000", r, i), e.save(), a.borderT && (N(e, a.borderT, n), e.beginPath(), e.moveTo(p, d), e.lineTo(p + f, d), e.stroke()), a.borderB && (N(e, a.borderB, n), e.beginPath(), e.moveTo(p, d + m), e.lineTo(p + f, d + m), e.stroke()), a.borderL && (N(e, a.borderL, n), e.beginPath(), e.moveTo(p, d), e.lineTo(p, d + m), e.stroke()), a.borderR && (N(e, a.borderR, n), e.beginPath(), e.moveTo(p + f, d), e.lineTo(p + f, d + m), e.stroke()), a.diagonalTL && (N(e, a.diagonalTL, n), e.beginPath(), e.moveTo(p, d), e.lineTo(p + f, d + m), e.stroke()), a.diagonalTR && (N(e, a.diagonalTR, n), e.beginPath(), e.moveTo(p + f, d), e.lineTo(p, d + m), e.stroke()), e.restore(), p += s[t] ?? 0;
1184
+ for (let e = 0; e < (a.rowSpan || 1); e++) m += c[o + e] ?? 0;
1185
+ let h = d(a.fill);
1186
+ h && (e.fillStyle = h, e.fillRect(p, u, f, m)), a.textBody && A(e, a.textBody, p, u, f, m, n, null, 0, !1, !1, "#000000", r, i), e.save(), a.borderT && (P(e, a.borderT, n), e.beginPath(), e.moveTo(p, u), e.lineTo(p + f, u), e.stroke()), a.borderB && (P(e, a.borderB, n), e.beginPath(), e.moveTo(p, u + m), e.lineTo(p + f, u + m), e.stroke()), a.borderL && (P(e, a.borderL, n), e.beginPath(), e.moveTo(p, u), e.lineTo(p, u + m), e.stroke()), a.borderR && (P(e, a.borderR, n), e.beginPath(), e.moveTo(p + f, u), e.lineTo(p + f, u + m), e.stroke()), a.diagonalTL && (P(e, a.diagonalTL, n), e.beginPath(), e.moveTo(p, u), e.lineTo(p + f, u + m), e.stroke()), a.diagonalTR && (P(e, a.diagonalTR, n), e.beginPath(), e.moveTo(p + f, u), e.lineTo(p, u + m), e.stroke()), e.restore(), p += s[t] ?? 0;
1177
1187
  }
1178
- d += f;
1188
+ u += f;
1179
1189
  }
1180
1190
  }
1181
- async function F(e, t, r, i, a = {}) {
1182
- let o = a.width ?? ((e instanceof HTMLCanvasElement ? e.offsetWidth : 0) || 960), s = o / r, l = Math.round(o), u = Math.round(i * s), d = a.dpr ?? (typeof window < "u" && window.devicePixelRatio || 1);
1183
- e.width = l * d, e.height = u * d, typeof HTMLCanvasElement < "u" && e instanceof HTMLCanvasElement && (e.style.width = `${l}px`);
1191
+ async function I(e, t, r, i, a = {}) {
1192
+ let o = a.width ?? ((e instanceof HTMLCanvasElement ? e.offsetWidth : 0) || 960), s = o / r, c = Math.round(o), u = Math.round(i * s), d = a.dpr ?? (typeof window < "u" && window.devicePixelRatio || 1);
1193
+ e.width = c * d, e.height = u * d, typeof HTMLCanvasElement < "u" && e instanceof HTMLCanvasElement && (e.style.width = `${c}px`);
1184
1194
  let f = e.getContext("2d");
1185
1195
  if (!f) throw Error("Could not get 2D context");
1186
1196
  f.scale(d, d);
@@ -1188,12 +1198,12 @@ async function F(e, t, r, i, a = {}) {
1188
1198
  themeMajorFont: a.majorFont ?? null,
1189
1199
  themeMinorFont: a.minorFont ?? null
1190
1200
  };
1191
- y(f, t.background, l, u);
1201
+ b(f, t.background, c, u);
1192
1202
  let m = a.defaultTextColor ? `#${a.defaultTextColor}` : "#000000", h = t.slideNumber;
1193
- for (let e of t.elements) if (e.type === "shape") S(f, e, s, m, h, p);
1194
- else if (e.type === "picture") await A(f, e, s);
1195
- else if (e.type === "table") P(f, e, s, h, p);
1196
- else if (e.type === "media") await j(f, e, s, a.fetchMedia, a.skipMediaControls);
1203
+ for (let e of t.elements) if (e.type === "shape") C(f, e, s, m, h, p);
1204
+ else if (e.type === "picture") await j(f, e, s);
1205
+ else if (e.type === "table") F(f, e, s, h, p);
1206
+ else if (e.type === "media") await M(f, e, s, a.fetchMedia, a.skipMediaControls);
1197
1207
  else if (e.type === "chart") {
1198
1208
  let t = 12700 * s;
1199
1209
  n(f, {
@@ -1215,26 +1225,28 @@ async function F(e, t, r, i, a = {}) {
1215
1225
  valAxisMajorTickMark: e.valAxisMajorTickMark,
1216
1226
  catAxisMajorTickMark: e.catAxisMajorTickMark,
1217
1227
  titleFontSizeHpt: e.titleFontSizeHpt,
1228
+ titleFontColor: e.titleFontColor ?? null,
1229
+ titleFontFace: e.titleFontFace ?? null,
1218
1230
  catAxisFontSizeHpt: e.catAxisFontSizeHpt,
1219
1231
  valAxisFontSizeHpt: e.valAxisFontSizeHpt,
1220
1232
  dataLabelFontSizeHpt: e.dataLabelFontSizeHpt,
1221
1233
  subtotalIndices: e.subtotalIndices
1222
1234
  }, {
1223
- x: c(e.x, s),
1224
- y: c(e.y, s),
1225
- w: c(e.width, s),
1226
- h: c(e.height, s)
1235
+ x: l(e.x, s),
1236
+ y: l(e.y, s),
1237
+ w: l(e.width, s),
1238
+ h: l(e.height, s)
1227
1239
  }, t);
1228
1240
  }
1229
1241
  return e;
1230
1242
  }
1231
1243
  //#endregion
1232
1244
  //#region packages/pptx/src/presentation-handle.ts
1233
- var I = 9525, L = (e, t) => e / I * t;
1234
- async function R(e, t, n) {
1245
+ var L = 9525, R = (e, t) => e / L * t;
1246
+ async function z(e, t, n) {
1235
1247
  let r = e.getContext("2d");
1236
1248
  if (!r) throw Error("2D context not available");
1237
- let i = n.width / (n.slideWidthEmu / I);
1249
+ let i = n.width / (n.slideWidthEmu / L);
1238
1250
  await n.drawBase();
1239
1251
  let a = document.createElement("canvas");
1240
1252
  a.width = e.width, a.height = e.height;
@@ -1252,10 +1264,10 @@ async function R(e, t, n) {
1252
1264
  let r = new Blob([t], { type: e.mimeType || t.type }), a = URL.createObjectURL(r), o = e.mediaKind === "video" ? document.createElement("video") : document.createElement("audio");
1253
1265
  o.src = a, o.preload = "metadata", e.mediaKind === "video" && (o.playsInline = !0);
1254
1266
  let s = {
1255
- x: L(e.x, i),
1256
- y: L(e.y, i),
1257
- w: L(e.width, i),
1258
- h: L(e.height, i)
1267
+ x: R(e.x, i),
1268
+ y: R(e.y, i),
1269
+ w: R(e.width, i),
1270
+ h: R(e.height, i)
1259
1271
  }, l = e.mediaKind === "audio" ? {
1260
1272
  x: s.x + s.w / 2 - Math.max(s.w, 260) / 2,
1261
1273
  y: s.y,
@@ -1280,7 +1292,7 @@ async function R(e, t, n) {
1280
1292
  let { x: n, y: i, w: a, h: o } = e.posterRect;
1281
1293
  r.drawImage(t, n, i, a, o);
1282
1294
  }
1283
- (e === d || g?.state === e) && ee(r, e, t);
1295
+ (e === d || g?.state === e) && te(r, e, t);
1284
1296
  }
1285
1297
  }, p = () => {
1286
1298
  u || (f(), l = requestAnimationFrame(p));
@@ -1350,22 +1362,10 @@ async function R(e, t, n) {
1350
1362
  }
1351
1363
  };
1352
1364
  }
1353
- var z = 28, B = 14, V = 72, H = 10, U = 3;
1354
- function ee(e, t, n) {
1355
- let r = Number.isFinite(n.duration) ? n.duration : 0, i = r > 0 ? Math.min(1, n.currentTime / r) : 0;
1356
- te(e, t, n), t.el.mediaKind === "audio" ? re(e, t, n, r, i) : ne(e, t, n, r, i);
1357
- }
1365
+ var B = 28, V = 14, H = 72, ee = 10, U = 3;
1358
1366
  function te(e, t, n) {
1359
- let r = t.posterRect, i = Math.max(18, Math.min(32, Math.min(r.w, r.h) * .25)), a = r.x + r.w / 2, o = r.y + r.h / 2;
1360
- if (e.save(), e.shadowColor = "rgba(0, 0, 0, 0.3)", e.shadowBlur = i * .35, e.fillStyle = "rgba(20, 20, 20, 0.7)", e.beginPath(), e.arc(a, o, i, 0, Math.PI * 2), e.fill(), e.shadowColor = "transparent", e.shadowBlur = 0, e.fillStyle = "#fff", n.paused) {
1361
- e.beginPath();
1362
- let t = i * .48;
1363
- e.moveTo(a - t * .4, o - t), e.lineTo(a - t * .4, o + t), e.lineTo(a + t * .75, o), e.closePath(), e.fill();
1364
- } else {
1365
- let t = i * .2, n = i * .8, r = i * .15;
1366
- e.fillRect(a - r - t, o - n / 2, t, n), e.fillRect(a + r, o - n / 2, t, n);
1367
- }
1368
- e.restore();
1367
+ let r = Number.isFinite(n.duration) ? n.duration : 0, i = r > 0 ? Math.min(1, n.currentTime / r) : 0, a = t.posterRect;
1368
+ s(e, a.x + a.w / 2, a.y + a.h / 2, a.w, a.h, n.paused ? "paused" : "playing"), t.el.mediaKind === "audio" ? re(e, t, n, r, i) : ne(e, t, n, r, i);
1369
1369
  }
1370
1370
  function ne(e, t, n, r, i) {
1371
1371
  let { x: a, y: o, w: s, h: c } = t.rect, l = Math.max(28, Math.min(56, c * .22)), u = o + c - l;
@@ -1377,7 +1377,7 @@ function ne(e, t, n, r, i) {
1377
1377
  }
1378
1378
  function re(e, t, n, r, i) {
1379
1379
  let a = K(t.rect);
1380
- e.save(), J(e, a.x, a.y, a.w, a.h, a.h / 2), e.fillStyle = "rgba(20, 20, 20, 0.72)", e.fill(), e.font = "500 11px system-ui, -apple-system, sans-serif", e.textBaseline = "middle", e.fillStyle = "rgba(255, 255, 255, 0.95)", W(e, n.currentTime, r, a.x + B, a.y + a.h / 2, "middle"), e.restore(), G(e, q(t), i, r > 0);
1380
+ e.save(), J(e, a.x, a.y, a.w, a.h, a.h / 2), e.fillStyle = "rgba(20, 20, 20, 0.72)", e.fill(), e.font = "500 11px system-ui, -apple-system, sans-serif", e.textBaseline = "middle", e.fillStyle = "rgba(255, 255, 255, 0.95)", W(e, n.currentTime, r, a.x + V, a.y + a.h / 2, "middle"), e.restore(), G(e, q(t), i, r > 0);
1381
1381
  }
1382
1382
  function W(e, t, n, r, i, a) {
1383
1383
  let o = Y(t), s = Y(n), c = Math.max(e.measureText(o).width, e.measureText(s).width), l = e.measureText(" / ").width, u = i, d = e.textAlign;
@@ -1395,14 +1395,14 @@ function K(e) {
1395
1395
  let t = Math.max(220, e.w - 24);
1396
1396
  return {
1397
1397
  x: e.x + e.w / 2 - t / 2,
1398
- y: e.y + e.h - z - 4,
1398
+ y: e.y + e.h - B - 4,
1399
1399
  w: t,
1400
- h: z
1400
+ h: B
1401
1401
  };
1402
1402
  }
1403
1403
  function q(e) {
1404
1404
  if (e.el.mediaKind === "audio") {
1405
- let t = K(e.rect), n = t.x + B + V + H, r = Math.max(40, t.x + t.w - B - n);
1405
+ let t = K(e.rect), n = t.x + V + H + ee, r = Math.max(40, t.x + t.w - V - n);
1406
1406
  return {
1407
1407
  x: n,
1408
1408
  y: t.y + (t.h - U) / 2,
@@ -1563,7 +1563,7 @@ var Q = class e {
1563
1563
  let r = this._presentation.slides[t];
1564
1564
  if (!r) throw Error(`Slide index ${t} out of range (count: ${this.slideCount})`);
1565
1565
  let i = n.dpr ?? (typeof window < "u" && window.devicePixelRatio || 1), a = n.width ?? (e.offsetWidth || 960);
1566
- await F(e, r, this._presentation.slideWidth, this._presentation.slideHeight, {
1566
+ await I(e, r, this._presentation.slideWidth, this._presentation.slideHeight, {
1567
1567
  width: a,
1568
1568
  dpr: i,
1569
1569
  defaultTextColor: this._presentation.defaultTextColor,
@@ -1607,7 +1607,7 @@ var Q = class e {
1607
1607
  let r = this._presentation.slides[t];
1608
1608
  if (!r) throw Error(`Slide index ${t} out of range (count: ${this.slideCount})`);
1609
1609
  let i = n.dpr ?? (typeof window < "u" && window.devicePixelRatio || 1), a = n.width ?? (e.offsetWidth || 960);
1610
- return R(e, r, {
1610
+ return z(e, r, {
1611
1611
  width: a,
1612
1612
  dpr: i,
1613
1613
  slideWidthEmu: this._presentation.slideWidth,
@@ -1627,6 +1627,7 @@ var Q = class e {
1627
1627
  engine = null;
1628
1628
  opts;
1629
1629
  currentSlide = 0;
1630
+ handle = null;
1630
1631
  constructor(e, t = {}) {
1631
1632
  this.opts = t, this.canvas = document.createElement("canvas"), this.canvas.style.display = "block", this.canvas.style.maxWidth = "100%", this.canvas.style.height = "auto", e.appendChild(this.canvas);
1632
1633
  }
@@ -1659,9 +1660,12 @@ var Q = class e {
1659
1660
  async renderCurrentSlide() {
1660
1661
  if (!this.engine) return;
1661
1662
  let e = this.opts.width ?? (this.canvas.offsetWidth || 960), t = this.opts.dpr ?? (window.devicePixelRatio || 1), n = e / this.engine.slideWidth, r = Math.round(this.engine.slideHeight * n);
1662
- this.canvas.style.width = `${e}px`, this.canvas.style.height = `${r}px`;
1663
+ this.canvas.style.width = `${e}px`, this.canvas.style.height = `${r}px`, this.handle?.dispose(), this.handle = null;
1663
1664
  try {
1664
- await this.engine.renderSlide(this.canvas, this.currentSlide, {
1665
+ this.opts.enableMediaPlayback ? this.handle = await this.engine.presentSlide(this.canvas, this.currentSlide, {
1666
+ width: e,
1667
+ dpr: t
1668
+ }) : await this.engine.renderSlide(this.canvas, this.currentSlide, {
1665
1669
  width: e,
1666
1670
  dpr: t
1667
1671
  }), this.opts.onSlideChange?.(this.currentSlide, this.slideCount);
@@ -1670,13 +1674,13 @@ var Q = class e {
1670
1674
  }
1671
1675
  }
1672
1676
  destroy() {
1673
- this.engine?.destroy(), this.canvas.remove();
1677
+ this.handle?.dispose(), this.handle = null, this.engine?.destroy(), this.canvas.remove();
1674
1678
  }
1675
1679
  }, ce = /* @__PURE__ */ e({
1676
1680
  PptxPresentation: () => Q,
1677
1681
  PptxViewer: () => $,
1678
1682
  autoResize: () => t,
1679
- renderSlide: () => F
1683
+ renderSlide: () => I
1680
1684
  });
1681
1685
  //#endregion
1682
- export { F as i, $ as n, Q as r, ce as t };
1686
+ export { I as i, $ as n, Q as r, ce as t };