@silurus/ooxml 0.74.4 → 0.74.5

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.
@@ -4681,26 +4681,26 @@ function Ur(e, t, r, i, a, o, s, c = null, l = 0, d = !1, f = !1, p = "#000000",
4681
4681
  n > u && (u = n);
4682
4682
  }
4683
4683
  a && I && I.sizePx > u && (u = I.sizePx);
4684
- let m = Math.max(u * 1.2, p), h;
4685
- h = f.spaceLine ? f.spaceLine.type === "pct" ? m * (f.spaceLine.val / 1e5) : f.spaceLine.val * n * s : m, t.autoFit === "norm" && t.lnSpcReduction != null && f.spaceLine?.type !== "pts" && (h *= 1 - t.lnSpcReduction);
4686
- let g = h + (o ? ee : 0), y = a && d > 0 ? U : 0, x = a ? fr(b, _) : 0, S = i.segments.some((e) => e.text && e.text.length > 0 || e.math != null), C = a && S ? I : null;
4684
+ let m = u * 1.2, h = Math.max(m, p), g;
4685
+ g = f.spaceLine ? f.spaceLine.type === "pct" ? m * (f.spaceLine.val / 1e5) : f.spaceLine.val * n * s : h, t.autoFit === "norm" && t.lnSpcReduction != null && f.spaceLine?.type !== "pts" && (g *= 1 - t.lnSpcReduction);
4686
+ let y = g + (o ? ee : 0), x = a && d > 0 ? U : 0, S = a ? fr(b, _) : 0, C = i.segments.some((e) => e.text && e.text.length > 0 || e.math != null), w = a && C ? I : null;
4687
4687
  c.push({
4688
4688
  line: i,
4689
- linePx: g,
4690
- lineHeight: h,
4691
- topGapPx: y,
4692
- textXOffset: x,
4689
+ linePx: y,
4690
+ lineHeight: g,
4691
+ topGapPx: x,
4692
+ textXOffset: S,
4693
4693
  bulletLabel: a ? D : "",
4694
4694
  bulletFont: P,
4695
4695
  bulletColor: F,
4696
4696
  bulletX: B,
4697
- bulletImage: C,
4697
+ bulletImage: w,
4698
4698
  textX: z,
4699
4699
  textMaxW: V,
4700
4700
  alignment: f.alignment,
4701
4701
  isLastLine: o,
4702
4702
  para: f
4703
- }), l += g + y;
4703
+ }), l += y + x;
4704
4704
  }
4705
4705
  }
4706
4706
  return {
@@ -5378,64 +5378,91 @@ async function fi(e, t, n) {
5378
5378
  let o = a.getContext("2d");
5379
5379
  if (!o) throw Error("base 2D context not available");
5380
5380
  o.drawImage(e, 0, 0);
5381
- let s = [];
5381
+ let s = [], c = [], l = !1, u = (e) => {
5382
+ l || (n.onError ? n.onError(e) : console.error("[ooxml] PPTX embedded media failed:", e));
5383
+ };
5384
+ if (t.length > 0) {
5385
+ r.save(), r.setTransform(n.dpr, 0, 0, n.dpr, 0, 0);
5386
+ for (let e of t) mi(r, pi(e, i), "Loading media…");
5387
+ r.restore();
5388
+ }
5382
5389
  for (let e of t) {
5383
5390
  let t;
5384
5391
  try {
5385
5392
  t = await n.fetchMedia(e.mediaPath);
5386
- } catch {
5393
+ } catch (t) {
5394
+ u(hi(e, t)), c.push(pi(e, i));
5387
5395
  continue;
5388
5396
  }
5389
- let r = e.mimeType || t.type, a = t.type === r ? t : new Blob([t], { type: r }), o = URL.createObjectURL(a), c = e.mediaKind === "video" ? document.createElement("video") : document.createElement("audio");
5390
- c.src = o, c.preload = "metadata", e.mediaKind === "video" && (c.playsInline = !0);
5391
- let l = {
5392
- x: di(e.x, i),
5393
- y: di(e.y, i),
5394
- w: di(e.width, i),
5395
- h: di(e.height, i)
5396
- }, u = e.mediaKind === "audio" ? {
5397
- x: l.x + l.w / 2 - Math.max(l.w, 260) / 2,
5398
- y: l.y,
5399
- w: Math.max(l.w, 260),
5400
- h: l.h + 36
5401
- } : l;
5402
- s.push({
5397
+ let r = e.mimeType || t.type, a = t.type === r ? t : new Blob([t], { type: r }), o = URL.createObjectURL(a), d = e.mediaKind === "video" ? document.createElement("video") : document.createElement("audio");
5398
+ d.src = o, d.preload = "metadata", e.mediaKind === "video" && (d.playsInline = !0);
5399
+ let f = pi(e, i), p = {
5403
5400
  el: e,
5404
- rect: u,
5405
- posterRect: l,
5406
- media: c,
5407
- objectUrl: o
5408
- });
5401
+ rect: e.mediaKind === "audio" ? {
5402
+ x: f.x + f.w / 2 - Math.max(f.w, 260) / 2,
5403
+ y: f.y,
5404
+ w: Math.max(f.w, 260),
5405
+ h: f.h + 36
5406
+ } : f,
5407
+ posterRect: f,
5408
+ media: d,
5409
+ objectUrl: o,
5410
+ loadState: "loading",
5411
+ detachListeners: () => {}
5412
+ }, m = () => {
5413
+ l || (p.loadState = "metadata");
5414
+ }, h = () => {
5415
+ l || (p.loadState = "ready");
5416
+ }, g = () => {
5417
+ l || (p.loadState = "error", u(gi(e, d, "decode")));
5418
+ };
5419
+ d.addEventListener("loadedmetadata", m), d.addEventListener("canplay", h), d.addEventListener("error", g), p.detachListeners = () => {
5420
+ d.removeEventListener("loadedmetadata", m), d.removeEventListener("canplay", h), d.removeEventListener("error", g);
5421
+ }, s.push(p);
5422
+ try {
5423
+ d.load();
5424
+ } catch (t) {
5425
+ p.loadState = "error", u(gi(e, d, "load", t));
5426
+ }
5409
5427
  }
5410
- let c = null, l = !1, u = null, d = () => {
5428
+ let d = null, f = null, p = () => {
5411
5429
  r.setTransform(n.dpr, 0, 0, n.dpr, 0, 0);
5412
5430
  let t = e.width / n.dpr, i = e.height / n.dpr;
5413
5431
  r.drawImage(a, 0, 0, e.width, e.height, 0, 0, t, i);
5432
+ for (let e of c) mi(r, e, "Media unavailable");
5414
5433
  for (let e of s) {
5415
5434
  let t = e.media;
5435
+ if (e.loadState === "loading") {
5436
+ mi(r, e.posterRect, "Loading media…");
5437
+ continue;
5438
+ }
5439
+ if (e.loadState === "error") {
5440
+ mi(r, e.posterRect, "Media unavailable");
5441
+ continue;
5442
+ }
5416
5443
  if (e.el.mediaKind === "video" && t.readyState >= 2) {
5417
5444
  let { x: n, y: i, w: a, h: o } = e.posterRect;
5418
5445
  r.drawImage(t, n, i, a, o);
5419
5446
  }
5420
- if (e === u || h?.state === e) vi(r, e, t);
5447
+ if (e === f || _?.state === e) Ci(r, e, t);
5421
5448
  else if (t.paused) {
5422
5449
  let { x: t, y: n, w: i, h: a } = e.posterRect;
5423
5450
  Tn(r, t + i / 2, n + a / 2, i, a, "paused");
5424
5451
  }
5425
5452
  }
5426
- }, f = () => {
5427
- l || (d(), c = requestAnimationFrame(f));
5428
- }, p = (t, r) => {
5453
+ }, m = () => {
5454
+ l || (p(), d = requestAnimationFrame(m));
5455
+ }, h = (t, r) => {
5429
5456
  let i = e.getBoundingClientRect(), a = e.width / n.dpr, o = e.height / n.dpr;
5430
5457
  return {
5431
5458
  x: (t - i.left) / i.width * a,
5432
5459
  y: (r - i.top) / i.height * o
5433
5460
  };
5434
- }, m = (e, t) => {
5461
+ }, g = (e, t) => {
5435
5462
  for (let n of s) {
5436
5463
  let { x: r, y: i, w: a, h: o } = n.rect;
5437
5464
  if (e < r || e > r + a || t < i || t > i + o) continue;
5438
- let s = wi(n), c = s.y - 12, l = s.y + s.h + 8;
5465
+ let s = ki(n), c = s.y - 12, l = s.y + s.h + 8;
5439
5466
  return (Number.isFinite(n.media.duration) ? n.media.duration : 0) > 0 && e >= s.x && e <= s.x + s.w && t >= c && t <= l ? {
5440
5467
  kind: "seek",
5441
5468
  state: n,
@@ -5446,131 +5473,174 @@ async function fi(e, t, n) {
5446
5473
  };
5447
5474
  }
5448
5475
  return null;
5449
- }, h = null, g = (e, t) => {
5476
+ }, _ = null, v = (e, t) => {
5450
5477
  let n = Number.isFinite(e.media.duration) ? e.media.duration : 0;
5451
5478
  n <= 0 || (e.media.currentTime = n * t);
5452
- }, _ = (t) => {
5453
- let { x: n, y: r } = p(t.clientX, t.clientY), i = m(n, r);
5454
- i && (i.kind === "seek" ? (h = {
5479
+ }, y = (e) => {
5480
+ try {
5481
+ e.media.play().catch((t) => {
5482
+ u(gi(e.el, e.media, "play", t));
5483
+ });
5484
+ } catch (t) {
5485
+ u(gi(e.el, e.media, "play", t));
5486
+ }
5487
+ }, b = (t) => {
5488
+ let { x: n, y: r } = h(t.clientX, t.clientY), i = g(n, r);
5489
+ i && (i.kind === "seek" ? (_ = {
5455
5490
  state: i.state,
5456
5491
  wasPlaying: !i.state.media.paused
5457
- }, i.state.media.pause(), g(i.state, i.fraction), e.setPointerCapture(t.pointerId), t.preventDefault()) : i.state.media.paused ? i.state.media.play().catch(() => void 0) : i.state.media.pause());
5458
- }, v = (e) => {
5459
- let { x: t, y: n } = p(e.clientX, e.clientY);
5460
- u = null;
5492
+ }, i.state.media.pause(), v(i.state, i.fraction), e.setPointerCapture(t.pointerId), t.preventDefault()) : i.state.media.paused ? y(i.state) : i.state.media.pause());
5493
+ }, x = (e) => {
5494
+ let { x: t, y: n } = h(e.clientX, e.clientY);
5495
+ f = null;
5461
5496
  for (let e of s) {
5462
5497
  let { x: r, y: i, w: a, h: o } = e.rect;
5463
5498
  if (t >= r && t <= r + a && n >= i && n <= i + o) {
5464
- u = e;
5499
+ f = e;
5465
5500
  break;
5466
5501
  }
5467
5502
  }
5468
- if (h) {
5469
- let e = wi(h.state), n = Math.max(0, Math.min(1, (t - e.x) / e.w));
5470
- g(h.state, n);
5503
+ if (_) {
5504
+ let e = ki(_.state), n = Math.max(0, Math.min(1, (t - e.x) / e.w));
5505
+ v(_.state, n);
5471
5506
  }
5472
- }, y = () => {
5473
- u = null;
5474
- }, b = (t) => {
5475
- if (!h) return;
5476
- let { wasPlaying: n, state: r } = h;
5477
- h = null, e.releasePointerCapture(t.pointerId), n && r.media.play().catch(() => void 0);
5507
+ }, S = () => {
5508
+ f = null;
5509
+ }, C = (t) => {
5510
+ if (!_) return;
5511
+ let { wasPlaying: n, state: r } = _;
5512
+ _ = null, e.releasePointerCapture(t.pointerId), n && y(r);
5478
5513
  };
5479
- return s.length > 0 && (e.addEventListener("pointerdown", _), e.addEventListener("pointermove", v), e.addEventListener("pointerleave", y), e.addEventListener("pointerup", b), e.addEventListener("pointercancel", b), e.style.cursor = "pointer", f()), {
5514
+ return s.length > 0 ? (e.addEventListener("pointerdown", b), e.addEventListener("pointermove", x), e.addEventListener("pointerleave", S), e.addEventListener("pointerup", C), e.addEventListener("pointercancel", C), e.style.cursor = "pointer", m()) : c.length > 0 && p(), {
5480
5515
  play(e) {
5481
- for (let t of s) (!e || t.el.mediaPath === e) && t.media.play().catch(() => void 0);
5516
+ for (let t of s) (!e || t.el.mediaPath === e) && y(t);
5482
5517
  },
5483
5518
  pause(e) {
5484
5519
  for (let t of s) (!e || t.el.mediaPath === e) && t.media.pause();
5485
5520
  },
5486
5521
  destroy() {
5487
5522
  if (!l) {
5488
- l = !0, c !== null && cancelAnimationFrame(c), e.removeEventListener("pointerdown", _), e.removeEventListener("pointermove", v), e.removeEventListener("pointerleave", y), e.removeEventListener("pointerup", b), e.removeEventListener("pointercancel", b), e.style.cursor = "";
5489
- for (let e of s) e.media.pause(), e.media.removeAttribute("src"), e.media.load(), URL.revokeObjectURL(e.objectUrl);
5523
+ l = !0, d !== null && cancelAnimationFrame(d), e.removeEventListener("pointerdown", b), e.removeEventListener("pointermove", x), e.removeEventListener("pointerleave", S), e.removeEventListener("pointerup", C), e.removeEventListener("pointercancel", C), e.style.cursor = "";
5524
+ for (let e of s) e.detachListeners(), e.media.pause(), e.media.removeAttribute("src"), e.media.load(), URL.revokeObjectURL(e.objectUrl);
5490
5525
  }
5491
5526
  }
5492
5527
  };
5493
5528
  }
5494
- var pi = 28, mi = 14, hi = 72, gi = 10, _i = 3;
5495
- function vi(e, t, n) {
5529
+ function pi(e, t) {
5530
+ return {
5531
+ x: di(e.x, t),
5532
+ y: di(e.y, t),
5533
+ w: di(e.width, t),
5534
+ h: di(e.height, t)
5535
+ };
5536
+ }
5537
+ function mi(e, t, n) {
5538
+ let r = Math.max(10, Math.min(14, t.h * .12));
5539
+ e.save(), e.font = `500 ${r}px system-ui, -apple-system, sans-serif`, e.textAlign = "center", e.textBaseline = "middle";
5540
+ let i = r + 12, a = Math.min(t.w, Math.max(100, e.measureText(n).width + 24));
5541
+ Ai(e, t.x + (t.w - a) / 2, t.y + (t.h - i) / 2, a, i, i / 2), e.fillStyle = "rgba(20, 20, 20, 0.72)", e.fill(), e.fillStyle = "rgba(255, 255, 255, 0.95)", e.fillText(n, t.x + t.w / 2, t.y + t.h / 2), e.restore();
5542
+ }
5543
+ function hi(e, t) {
5544
+ return /* @__PURE__ */ Error(`Embedded ${e.mediaKind} fetch failed for "${e.mediaPath}" (mime=${e.mimeType || "unknown"}): ${_i(t)}`);
5545
+ }
5546
+ function gi(e, t, n, r) {
5547
+ let i = "";
5548
+ try {
5549
+ i = e.mimeType ? t.canPlayType(e.mimeType) : "";
5550
+ } catch {}
5551
+ let a = t.error, o = [
5552
+ `mime=${e.mimeType || "unknown"}`,
5553
+ `canPlayType=${i || "no"}`,
5554
+ `readyState=${t.readyState}`,
5555
+ `networkState=${t.networkState}`
5556
+ ];
5557
+ a && o.push(`mediaError=${a.code}${a.message ? ` ${a.message}` : ""}`);
5558
+ let s = r === void 0 ? "" : `: ${_i(r)}`;
5559
+ return /* @__PURE__ */ Error(`Embedded ${e.mediaKind} ${n} failed for "${e.mediaPath}" (${o.join("; ")})${s}`);
5560
+ }
5561
+ function _i(e) {
5562
+ return e instanceof Error ? `${e.name || "Error"}${e.message ? `: ${e.message}` : ""}` : String(e);
5563
+ }
5564
+ var vi = 28, yi = 14, bi = 72, xi = 10, Si = 3;
5565
+ function Ci(e, t, n) {
5496
5566
  let r = Number.isFinite(n.duration) ? n.duration : 0, i = r > 0 ? Math.min(1, n.currentTime / r) : 0, a = t.posterRect;
5497
- Tn(e, a.x + a.w / 2, a.y + a.h / 2, a.w, a.h, n.paused ? "paused" : "playing"), t.el.mediaKind === "audio" ? bi(e, t, n, r, i) : yi(e, t, n, r, i);
5567
+ Tn(e, a.x + a.w / 2, a.y + a.h / 2, a.w, a.h, n.paused ? "paused" : "playing"), t.el.mediaKind === "audio" ? Ti(e, t, n, r, i) : wi(e, t, n, r, i);
5498
5568
  }
5499
- function yi(e, t, n, r, i) {
5569
+ function wi(e, t, n, r, i) {
5500
5570
  let { x: a, y: o, w: s, h: c } = t.rect, l = Math.max(28, Math.min(56, c * .22)), u = o + c - l;
5501
5571
  e.save();
5502
5572
  let d = e.createLinearGradient(0, u, 0, o + c);
5503
5573
  d.addColorStop(0, "rgba(0, 0, 0, 0)"), d.addColorStop(1, "rgba(0, 0, 0, 0.55)"), e.fillStyle = d, e.fillRect(a, u, s, l), e.restore();
5504
- let f = wi(t);
5505
- Si(e, f, i, r > 0), e.save(), e.font = "500 11px system-ui, -apple-system, sans-serif", e.textBaseline = "middle", e.shadowColor = "rgba(0, 0, 0, 0.75)", e.shadowBlur = 3, e.fillStyle = "rgba(255, 255, 255, 0.95)", xi(e, n.currentTime, r, f.x, f.y - 10, "bottom"), e.restore();
5574
+ let f = ki(t);
5575
+ Di(e, f, i, r > 0), e.save(), e.font = "500 11px system-ui, -apple-system, sans-serif", e.textBaseline = "middle", e.shadowColor = "rgba(0, 0, 0, 0.75)", e.shadowBlur = 3, e.fillStyle = "rgba(255, 255, 255, 0.95)", Ei(e, n.currentTime, r, f.x, f.y - 10, "bottom"), e.restore();
5506
5576
  }
5507
- function bi(e, t, n, r, i) {
5508
- let a = Ci(t.rect);
5509
- e.save(), Ti(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)", xi(e, n.currentTime, r, a.x + mi, a.y + a.h / 2, "middle"), e.restore(), Si(e, wi(t), i, r > 0);
5577
+ function Ti(e, t, n, r, i) {
5578
+ let a = Oi(t.rect);
5579
+ e.save(), Ai(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)", Ei(e, n.currentTime, r, a.x + yi, a.y + a.h / 2, "middle"), e.restore(), Di(e, ki(t), i, r > 0);
5510
5580
  }
5511
- function xi(e, t, n, r, i, a) {
5512
- let o = Ei(t), s = Ei(n), c = ci(e), l = li(e, o, c), u = li(e, s, c), d = e.measureText(" / ").width, f = Math.max(l, u);
5581
+ function Ei(e, t, n, r, i, a) {
5582
+ let o = ji(t), s = ji(n), c = ci(e), l = li(e, o, c), u = li(e, s, c), d = e.measureText(" / ").width, f = Math.max(l, u);
5513
5583
  ui(e, o, r + f - l, i, c);
5514
5584
  let p = e.textAlign;
5515
5585
  e.textAlign = "left", e.fillText(" / ", r + f, i), e.textAlign = p, ui(e, s, r + f + d, i, c);
5516
5586
  }
5517
- function Si(e, t, n, r) {
5587
+ function Di(e, t, n, r) {
5518
5588
  let i = t.h / 2;
5519
- if (e.save(), Ti(e, t.x, t.y, t.w, t.h, i), e.fillStyle = "rgba(255, 255, 255, 0.35)", e.fill(), n > 0 && (Ti(e, t.x, t.y, t.w * n, t.h, i), e.fillStyle = "#fff", e.fill()), r) {
5589
+ if (e.save(), Ai(e, t.x, t.y, t.w, t.h, i), e.fillStyle = "rgba(255, 255, 255, 0.35)", e.fill(), n > 0 && (Ai(e, t.x, t.y, t.w * n, t.h, i), e.fillStyle = "#fff", e.fill()), r) {
5520
5590
  let r = Math.max(t.x + 5, Math.min(t.x + t.w - 5, t.x + t.w * n));
5521
5591
  e.shadowColor = "rgba(0, 0, 0, 0.3)", e.shadowBlur = 3, e.fillStyle = "#fff", e.beginPath(), e.arc(r, t.y + t.h / 2, 5, 0, Math.PI * 2), e.fill();
5522
5592
  }
5523
5593
  e.restore();
5524
5594
  }
5525
- function Ci(e) {
5595
+ function Oi(e) {
5526
5596
  let t = Math.max(220, e.w - 24);
5527
5597
  return {
5528
5598
  x: e.x + e.w / 2 - t / 2,
5529
- y: e.y + e.h - pi - 4,
5599
+ y: e.y + e.h - vi - 4,
5530
5600
  w: t,
5531
- h: pi
5601
+ h: vi
5532
5602
  };
5533
5603
  }
5534
- function wi(e) {
5604
+ function ki(e) {
5535
5605
  if (e.el.mediaKind === "audio") {
5536
- let t = Ci(e.rect), n = t.x + mi + hi + gi, r = Math.max(40, t.x + t.w - mi - n);
5606
+ let t = Oi(e.rect), n = t.x + yi + bi + xi, r = Math.max(40, t.x + t.w - yi - n);
5537
5607
  return {
5538
5608
  x: n,
5539
- y: t.y + (t.h - _i) / 2,
5609
+ y: t.y + (t.h - Si) / 2,
5540
5610
  w: r,
5541
- h: _i
5611
+ h: Si
5542
5612
  };
5543
5613
  }
5544
5614
  let t = e.rect, n = Math.max(12, t.w * .025), r = Math.max(12, Math.min(18, t.h * .05));
5545
5615
  return {
5546
5616
  x: t.x + n,
5547
- y: t.y + t.h - _i - r,
5617
+ y: t.y + t.h - Si - r,
5548
5618
  w: t.w - n * 2,
5549
- h: _i
5619
+ h: Si
5550
5620
  };
5551
5621
  }
5552
- function Ti(e, t, n, r, i, a) {
5622
+ function Ai(e, t, n, r, i, a) {
5553
5623
  let o = Math.min(a, i / 2, r / 2);
5554
5624
  e.beginPath(), e.moveTo(t + o, n), e.lineTo(t + r - o, n), e.quadraticCurveTo(t + r, n, t + r, n + o), e.lineTo(t + r, n + i - o), e.quadraticCurveTo(t + r, n + i, t + r - o, n + i), e.lineTo(t + o, n + i), e.quadraticCurveTo(t, n + i, t, n + i - o), e.lineTo(t, n + o), e.quadraticCurveTo(t, n, t + o, n), e.closePath();
5555
5625
  }
5556
- function Ei(e) {
5626
+ function ji(e) {
5557
5627
  if (!Number.isFinite(e) || e < 0) return "0:00";
5558
5628
  let t = Math.floor(e);
5559
5629
  return `${Math.floor(t / 60)}:${(t % 60).toString().padStart(2, "0")}`;
5560
5630
  }
5561
5631
  //#endregion
5562
5632
  //#region packages/pptx/src/notes.ts
5563
- function Di(e, t) {
5633
+ function Mi(e, t) {
5564
5634
  return !Number.isInteger(t) || t < 0 || t >= e.length ? null : e[t].notes ?? null;
5565
5635
  }
5566
5636
  //#endregion
5567
5637
  //#region packages/pptx/src/hidden.ts
5568
- function Oi(e, t) {
5638
+ function Ni(e, t) {
5569
5639
  return !Number.isInteger(t) || t < 0 || t >= e.length ? !1 : e[t].hidden ?? !1;
5570
5640
  }
5571
5641
  //#endregion
5572
5642
  //#region packages/pptx/src/slide-nav.ts
5573
- function ki(e) {
5643
+ function Pi(e) {
5574
5644
  let t = /* @__PURE__ */ new Map();
5575
5645
  for (let n = 0; n < e.length; n++) {
5576
5646
  let r = e[n];
@@ -5578,44 +5648,44 @@ function ki(e) {
5578
5648
  }
5579
5649
  return t;
5580
5650
  }
5581
- function Ai(e, t) {
5651
+ function Fi(e, t) {
5582
5652
  if (e === "") return;
5583
5653
  let n = vn("ppt/slides", e);
5584
5654
  return t.get(n);
5585
5655
  }
5586
- function ji(e, t, n) {
5656
+ function Ii(e, t, n) {
5587
5657
  let r = yn(e);
5588
- return r === null ? Ai(e, t) : bn(r, n, t.size);
5658
+ return r === null ? Fi(e, t) : bn(r, n, t.size);
5589
5659
  }
5590
5660
  //#endregion
5591
5661
  //#region packages/pptx/src/google-fonts.ts
5592
- var Mi = {
5662
+ var Li = {
5593
5663
  ...i,
5594
5664
  ...l
5595
5665
  };
5596
- function* Ni(e) {
5666
+ function* Ri(e) {
5597
5667
  for (let t of e?.paragraphs ?? []) for (let e of t.runs) e.type === "text" && (yield e.text);
5598
5668
  }
5599
- function* Pi(e) {
5600
- for (let t of e.slides) for (let e of t.elements) if (e.type === "shape") yield* Ni(e.textBody);
5601
- else if (e.type === "table") for (let t of e.rows) for (let e of t.cells) yield* Ni(e.textBody);
5669
+ function* zi(e) {
5670
+ for (let t of e.slides) for (let e of t.elements) if (e.type === "shape") yield* Ri(e.textBody);
5671
+ else if (e.type === "table") for (let t of e.rows) for (let e of t.cells) yield* Ri(e.textBody);
5602
5672
  else if (e.type === "chart") {
5603
5673
  e.chart.title && (yield e.chart.title);
5604
5674
  for (let t of e.chart.categories) yield t;
5605
5675
  for (let t of e.chart.series) t.name && (yield t.name);
5606
5676
  }
5607
5677
  }
5608
- function Fi(e) {
5678
+ function Bi(e) {
5609
5679
  let t = v(e.majorFont) ?? v(e.minorFont) ?? null;
5610
5680
  return [
5611
5681
  e.majorFont,
5612
5682
  e.minorFont,
5613
- ...Me(Pi(e), t)
5683
+ ...Me(zi(e), t)
5614
5684
  ];
5615
5685
  }
5616
5686
  //#endregion
5617
5687
  //#region packages/pptx/src/media-mime.ts
5618
- function Ii(e, t) {
5688
+ function Vi(e, t) {
5619
5689
  for (let n of e.slides) for (let e of n.elements) {
5620
5690
  if (e.type !== "media") continue;
5621
5691
  let n = e;
@@ -5626,11 +5696,11 @@ function Ii(e, t) {
5626
5696
  }
5627
5697
  //#endregion
5628
5698
  //#region packages/pptx/src/worker.ts?worker&inline
5629
- var Li = "function e(e){if(!e.startsWith(`data:`))return null;let t=e.indexOf(`,`);if(t===-1)return null;let n=atob(e.slice(t+1)),r=new Uint8Array(n.length);for(let e=0;e<n.length;e++)r[e]=n.charCodeAt(e);return r.buffer}var t=class e extends Error{code=`parser-crashed`;constructor(t){super(t),this.name=`WasmTrapError`,Object.setPrototypeOf(this,e.prototype)}};function n(e){let t=globalThis.WebAssembly?.RuntimeError;if(t&&e instanceof t||e instanceof RangeError)return!0;if(e instanceof Error){let t=e.name;if(t===`RuntimeError`||t===`CompileError`||t===`LinkError`)return!0}return!1}var r=class{_init;_opts;_wasmInput=null;_initPromise=null;_poisoned=!1;_archive=null;constructor(e,t={}){this._init=e,this._opts=t}setWasmUrl(e){this._wasmInput=e,this._poisoned=!1,this._initPromise=this._init(e)}get archive(){return this._archive}setArchive(e){this._freeArchive(),this._archive=e}disposeArchive(){this._freeArchive()}_freeArchive(){this._archive!=null&&this._opts.freeArchive&&this._opts.freeArchive(this._archive),this._archive=null}get poisoned(){return this._poisoned}async ensureReady(){if(this._poisoned){if(this._wasmInput===null)throw Error(`WasmParserHost: setWasmUrl was never called`);let e=(this._opts.reinit??this._init)(this._wasmInput);this._initPromise=e,await e,this._poisoned=!1;return}if(this._initPromise===null)throw Error(`WasmParserHost: setWasmUrl was never called`);await this._initPromise}run(e){try{return e()}catch(e){throw n(e)?(this._poison(),new t(`WASM parser trapped and was recycled: ${e instanceof Error?e.message:String(e)}`)):e}}poison(){this._poison()}_poison(){if(this._poisoned=!0,this._initPromise=null,this._archive!=null&&this._opts.freeArchive)try{this._opts.freeArchive(this._archive)}catch{}this._archive=null}},i=class{__destroy_into_raw(){let e=this.__wbg_ptr;return this.__wbg_ptr=0,o.unregister(this),e}free(){let e=this.__destroy_into_raw();S.__wbg_pptxarchive_free(e,0)}extract_image(e){let t=h(e,S.__wbindgen_malloc,S.__wbindgen_realloc),n=x,r=S.pptxarchive_extract_image(this.__wbg_ptr,t,n);if(r[3])throw g(r[2]);var i=s(r[0],r[1]).slice();return S.__wbindgen_free(r[0],r[1]*1,1),i}extract_media(e){let t=h(e,S.__wbindgen_malloc,S.__wbindgen_realloc),n=x,r=S.pptxarchive_extract_media(this.__wbg_ptr,t,n);if(r[3])throw g(r[2]);var i=s(r[0],r[1]).slice();return S.__wbindgen_free(r[0],r[1]*1,1),i}constructor(e,t){let n=m(e,S.__wbindgen_malloc),r=x,i=S.pptxarchive_new(n,r,!p(t),p(t)?BigInt(0):t);if(i[2])throw g(i[1]);return this.__wbg_ptr=i[0]>>>0,o.register(this,this.__wbg_ptr,this),this}parse(){let e=S.pptxarchive_parse(this.__wbg_ptr);if(e[3])throw g(e[2]);var t=s(e[0],e[1]).slice();return S.__wbindgen_free(e[0],e[1]*1,1),t}to_markdown(){let e,t;try{let i=S.pptxarchive_to_markdown(this.__wbg_ptr);var n=i[0],r=i[1];if(i[3])throw n=0,r=0,g(i[2]);return e=n,t=r,u(n,r)}finally{S.__wbindgen_free(e,t,1)}}};Symbol.dispose&&(i.prototype[Symbol.dispose]=i.prototype.free);function a(){return{__proto__:null,\"./pptx_parser_bg.js\":{__proto__:null,__wbg___wbindgen_throw_6b64449b9b9ed33c:function(e,t){throw Error(u(e,t))},__wbg_error_a6fa202b58aa1cd3:function(e,t){let n,r;try{n=e,r=t,console.error(u(e,t))}finally{S.__wbindgen_free(n,r,1)}},__wbg_new_227d7c05414eb861:function(){return Error()},__wbg_stack_3b0d974bbf31e44f:function(e,t){let n=t.stack,r=h(n,S.__wbindgen_malloc,S.__wbindgen_realloc),i=x;l().setInt32(e+4,i,!0),l().setInt32(e+0,r,!0)},__wbindgen_cast_0000000000000001:function(e,t){return u(e,t)},__wbindgen_init_externref_table:function(){let e=S.__wbindgen_externrefs,t=e.grow(4);e.set(0,void 0),e.set(t+0,void 0),e.set(t+1,null),e.set(t+2,!0),e.set(t+3,!1)}}}}const o=typeof FinalizationRegistry>`u`?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(e=>S.__wbg_pptxarchive_free(e>>>0,1));function s(e,t){return e>>>=0,f().subarray(e/1,e/1+t)}let c=null;function l(){return(c===null||c.buffer.detached===!0||c.buffer.detached===void 0&&c.buffer!==S.memory.buffer)&&(c=new DataView(S.memory.buffer)),c}function u(e,t){return e>>>=0,y(e,t)}let d=null;function f(){return(d===null||d.byteLength===0)&&(d=new Uint8Array(S.memory.buffer)),d}function p(e){return e==null}function m(e,t){let n=t(e.length*1,1)>>>0;return f().set(e,n/1),x=e.length,n}function h(e,t,n){if(n===void 0){let n=b.encode(e),r=t(n.length,1)>>>0;return f().subarray(r,r+n.length).set(n),x=n.length,r}let r=e.length,i=t(r,1)>>>0,a=f(),o=0;for(;o<r;o++){let t=e.charCodeAt(o);if(t>127)break;a[i+o]=t}if(o!==r){o!==0&&(e=e.slice(o)),i=n(i,r,r=o+e.length*3,1)>>>0;let t=f().subarray(i+o,i+r),a=b.encodeInto(e,t);o+=a.written,i=n(i,r,o,1)>>>0}return x=o,i}function g(e){let t=S.__wbindgen_externrefs.get(e);return S.__externref_table_dealloc(e),t}let _=new TextDecoder(`utf-8`,{ignoreBOM:!0,fatal:!0});_.decode();let v=0;function y(e,t){return v+=t,v>=2146435072&&(_=new TextDecoder(`utf-8`,{ignoreBOM:!0,fatal:!0}),_.decode(),v=t),_.decode(f().subarray(e,e+t))}const b=new TextEncoder;`encodeInto`in b||(b.encodeInto=function(e,t){let n=b.encode(e);return t.set(n),{read:e.length,written:n.length}});let x=0,S;function C(e,t){return S=e.exports,c=null,d=null,S.__wbindgen_start(),S}async function w(e,t){if(typeof Response==`function`&&e instanceof Response){if(typeof WebAssembly.instantiateStreaming==`function`)try{return await WebAssembly.instantiateStreaming(e,t)}catch(t){if(e.ok&&n(e.type)&&e.headers.get(`Content-Type`)!==`application/wasm`)console.warn(\"`WebAssembly.instantiateStreaming` failed because your server does not serve Wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\\n\",t);else throw t}let r=await e.arrayBuffer();return await WebAssembly.instantiate(r,t)}else{let n=await WebAssembly.instantiate(e,t);return n instanceof WebAssembly.Instance?{instance:n,module:e}:n}function n(e){switch(e){case`basic`:case`cors`:case`default`:return!0}return!1}}async function T(e){if(S!==void 0)return S;e!==void 0&&(Object.getPrototypeOf(e)===Object.prototype?{module_or_path:e}=e:console.warn(`using deprecated parameters for the initialization function; pass a single object instead`));let t=a();(typeof e==`string`||typeof Request==`function`&&e instanceof Request||typeof URL==`function`&&e instanceof URL)&&(e=fetch(e));let{instance:n,module:r}=await w(await e,t);return C(n,r)}async function E(e){return S=void 0,c=null,d=null,T(e)}const D=new r(T,{freeArchive:e=>e.free(),reinit:E});self.onmessage=async t=>{let n=t.data;if(n.kind===`init`){D.setWasmUrl(e(n.wasmUrl)??n.wasmUrl);return}let r=n.id;try{if(await D.ensureReady(),n.kind===`parse`){let e=typeof n.maxZipEntryBytes==`number`&&n.maxZipEntryBytes>0?BigInt(n.maxZipEntryBytes):void 0,t=new Uint8Array(n.buffer),a=D.run(()=>{let n=new i(t,e);return D.setArchive(n),n.parse()}).buffer,o={kind:`parsed`,id:r,presentationJson:a};self.postMessage(o,[a]);return}let e=D.archive;if(n.kind===`extractMedia`){if(!e)throw Error(`No pptx loaded`);let t=D.run(()=>e.extract_media(n.path).buffer),i={kind:`mediaExtracted`,id:r,bytes:t};self.postMessage(i,[t]);return}if(n.kind===`extractImage`){if(!e)throw Error(`No pptx loaded`);let t=D.run(()=>e.extract_image(n.path).buffer),i={kind:`imageExtracted`,id:r,bytes:t};self.postMessage(i,[t]);return}if(n.kind===`toMarkdown`){if(!e)throw Error(`No pptx loaded`);let t={kind:`markdownRendered`,id:r,markdown:D.run(()=>e.to_markdown())};self.postMessage(t);return}}catch(e){let t={kind:`error`,id:r,message:e instanceof Error?e.message:String(e)};self.postMessage(t)}};", Ri = typeof self < "u" && self.Blob && new Blob(["URL.revokeObjectURL(import.meta.url);", Li], { type: "text/javascript;charset=utf-8" });
5630
- function zi(e) {
5699
+ var Hi = "function e(e){if(!e.startsWith(`data:`))return null;let t=e.indexOf(`,`);if(t===-1)return null;let n=atob(e.slice(t+1)),r=new Uint8Array(n.length);for(let e=0;e<n.length;e++)r[e]=n.charCodeAt(e);return r.buffer}var t=class e extends Error{code=`parser-crashed`;constructor(t){super(t),this.name=`WasmTrapError`,Object.setPrototypeOf(this,e.prototype)}};function n(e){let t=globalThis.WebAssembly?.RuntimeError;if(t&&e instanceof t||e instanceof RangeError)return!0;if(e instanceof Error){let t=e.name;if(t===`RuntimeError`||t===`CompileError`||t===`LinkError`)return!0}return!1}var r=class{_init;_opts;_wasmInput=null;_initPromise=null;_poisoned=!1;_archive=null;constructor(e,t={}){this._init=e,this._opts=t}setWasmUrl(e){this._wasmInput=e,this._poisoned=!1,this._initPromise=this._init(e)}get archive(){return this._archive}setArchive(e){this._freeArchive(),this._archive=e}disposeArchive(){this._freeArchive()}_freeArchive(){this._archive!=null&&this._opts.freeArchive&&this._opts.freeArchive(this._archive),this._archive=null}get poisoned(){return this._poisoned}async ensureReady(){if(this._poisoned){if(this._wasmInput===null)throw Error(`WasmParserHost: setWasmUrl was never called`);let e=(this._opts.reinit??this._init)(this._wasmInput);this._initPromise=e,await e,this._poisoned=!1;return}if(this._initPromise===null)throw Error(`WasmParserHost: setWasmUrl was never called`);await this._initPromise}run(e){try{return e()}catch(e){throw n(e)?(this._poison(),new t(`WASM parser trapped and was recycled: ${e instanceof Error?e.message:String(e)}`)):e}}poison(){this._poison()}_poison(){if(this._poisoned=!0,this._initPromise=null,this._archive!=null&&this._opts.freeArchive)try{this._opts.freeArchive(this._archive)}catch{}this._archive=null}},i=class{__destroy_into_raw(){let e=this.__wbg_ptr;return this.__wbg_ptr=0,o.unregister(this),e}free(){let e=this.__destroy_into_raw();S.__wbg_pptxarchive_free(e,0)}extract_image(e){let t=h(e,S.__wbindgen_malloc,S.__wbindgen_realloc),n=x,r=S.pptxarchive_extract_image(this.__wbg_ptr,t,n);if(r[3])throw g(r[2]);var i=s(r[0],r[1]).slice();return S.__wbindgen_free(r[0],r[1]*1,1),i}extract_media(e){let t=h(e,S.__wbindgen_malloc,S.__wbindgen_realloc),n=x,r=S.pptxarchive_extract_media(this.__wbg_ptr,t,n);if(r[3])throw g(r[2]);var i=s(r[0],r[1]).slice();return S.__wbindgen_free(r[0],r[1]*1,1),i}constructor(e,t){let n=m(e,S.__wbindgen_malloc),r=x,i=S.pptxarchive_new(n,r,!p(t),p(t)?BigInt(0):t);if(i[2])throw g(i[1]);return this.__wbg_ptr=i[0]>>>0,o.register(this,this.__wbg_ptr,this),this}parse(){let e=S.pptxarchive_parse(this.__wbg_ptr);if(e[3])throw g(e[2]);var t=s(e[0],e[1]).slice();return S.__wbindgen_free(e[0],e[1]*1,1),t}to_markdown(){let e,t;try{let i=S.pptxarchive_to_markdown(this.__wbg_ptr);var n=i[0],r=i[1];if(i[3])throw n=0,r=0,g(i[2]);return e=n,t=r,u(n,r)}finally{S.__wbindgen_free(e,t,1)}}};Symbol.dispose&&(i.prototype[Symbol.dispose]=i.prototype.free);function a(){return{__proto__:null,\"./pptx_parser_bg.js\":{__proto__:null,__wbg___wbindgen_throw_6b64449b9b9ed33c:function(e,t){throw Error(u(e,t))},__wbg_error_a6fa202b58aa1cd3:function(e,t){let n,r;try{n=e,r=t,console.error(u(e,t))}finally{S.__wbindgen_free(n,r,1)}},__wbg_new_227d7c05414eb861:function(){return Error()},__wbg_stack_3b0d974bbf31e44f:function(e,t){let n=t.stack,r=h(n,S.__wbindgen_malloc,S.__wbindgen_realloc),i=x;l().setInt32(e+4,i,!0),l().setInt32(e+0,r,!0)},__wbindgen_cast_0000000000000001:function(e,t){return u(e,t)},__wbindgen_init_externref_table:function(){let e=S.__wbindgen_externrefs,t=e.grow(4);e.set(0,void 0),e.set(t+0,void 0),e.set(t+1,null),e.set(t+2,!0),e.set(t+3,!1)}}}}const o=typeof FinalizationRegistry>`u`?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(e=>S.__wbg_pptxarchive_free(e>>>0,1));function s(e,t){return e>>>=0,f().subarray(e/1,e/1+t)}let c=null;function l(){return(c===null||c.buffer.detached===!0||c.buffer.detached===void 0&&c.buffer!==S.memory.buffer)&&(c=new DataView(S.memory.buffer)),c}function u(e,t){return e>>>=0,y(e,t)}let d=null;function f(){return(d===null||d.byteLength===0)&&(d=new Uint8Array(S.memory.buffer)),d}function p(e){return e==null}function m(e,t){let n=t(e.length*1,1)>>>0;return f().set(e,n/1),x=e.length,n}function h(e,t,n){if(n===void 0){let n=b.encode(e),r=t(n.length,1)>>>0;return f().subarray(r,r+n.length).set(n),x=n.length,r}let r=e.length,i=t(r,1)>>>0,a=f(),o=0;for(;o<r;o++){let t=e.charCodeAt(o);if(t>127)break;a[i+o]=t}if(o!==r){o!==0&&(e=e.slice(o)),i=n(i,r,r=o+e.length*3,1)>>>0;let t=f().subarray(i+o,i+r),a=b.encodeInto(e,t);o+=a.written,i=n(i,r,o,1)>>>0}return x=o,i}function g(e){let t=S.__wbindgen_externrefs.get(e);return S.__externref_table_dealloc(e),t}let _=new TextDecoder(`utf-8`,{ignoreBOM:!0,fatal:!0});_.decode();let v=0;function y(e,t){return v+=t,v>=2146435072&&(_=new TextDecoder(`utf-8`,{ignoreBOM:!0,fatal:!0}),_.decode(),v=t),_.decode(f().subarray(e,e+t))}const b=new TextEncoder;`encodeInto`in b||(b.encodeInto=function(e,t){let n=b.encode(e);return t.set(n),{read:e.length,written:n.length}});let x=0,S;function C(e,t){return S=e.exports,c=null,d=null,S.__wbindgen_start(),S}async function w(e,t){if(typeof Response==`function`&&e instanceof Response){if(typeof WebAssembly.instantiateStreaming==`function`)try{return await WebAssembly.instantiateStreaming(e,t)}catch(t){if(e.ok&&n(e.type)&&e.headers.get(`Content-Type`)!==`application/wasm`)console.warn(\"`WebAssembly.instantiateStreaming` failed because your server does not serve Wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\\n\",t);else throw t}let r=await e.arrayBuffer();return await WebAssembly.instantiate(r,t)}else{let n=await WebAssembly.instantiate(e,t);return n instanceof WebAssembly.Instance?{instance:n,module:e}:n}function n(e){switch(e){case`basic`:case`cors`:case`default`:return!0}return!1}}async function T(e){if(S!==void 0)return S;e!==void 0&&(Object.getPrototypeOf(e)===Object.prototype?{module_or_path:e}=e:console.warn(`using deprecated parameters for the initialization function; pass a single object instead`));let t=a();(typeof e==`string`||typeof Request==`function`&&e instanceof Request||typeof URL==`function`&&e instanceof URL)&&(e=fetch(e));let{instance:n,module:r}=await w(await e,t);return C(n,r)}async function E(e){return S=void 0,c=null,d=null,T(e)}const D=new r(T,{freeArchive:e=>e.free(),reinit:E});self.onmessage=async t=>{let n=t.data;if(n.kind===`init`){D.setWasmUrl(e(n.wasmUrl)??n.wasmUrl);return}let r=n.id;try{if(await D.ensureReady(),n.kind===`parse`){let e=typeof n.maxZipEntryBytes==`number`&&n.maxZipEntryBytes>0?BigInt(n.maxZipEntryBytes):void 0,t=new Uint8Array(n.buffer),a=D.run(()=>{let n=new i(t,e);return D.setArchive(n),n.parse()}).buffer,o={kind:`parsed`,id:r,presentationJson:a};self.postMessage(o,[a]);return}let e=D.archive;if(n.kind===`extractMedia`){if(!e)throw Error(`No pptx loaded`);let t=D.run(()=>e.extract_media(n.path).buffer),i={kind:`mediaExtracted`,id:r,bytes:t};self.postMessage(i,[t]);return}if(n.kind===`extractImage`){if(!e)throw Error(`No pptx loaded`);let t=D.run(()=>e.extract_image(n.path).buffer),i={kind:`imageExtracted`,id:r,bytes:t};self.postMessage(i,[t]);return}if(n.kind===`toMarkdown`){if(!e)throw Error(`No pptx loaded`);let t={kind:`markdownRendered`,id:r,markdown:D.run(()=>e.to_markdown())};self.postMessage(t);return}}catch(e){let t={kind:`error`,id:r,message:e instanceof Error?e.message:String(e)};self.postMessage(t)}};", Ui = typeof self < "u" && self.Blob && new Blob(["URL.revokeObjectURL(import.meta.url);", Hi], { type: "text/javascript;charset=utf-8" });
5700
+ function Wi(e) {
5631
5701
  let t;
5632
5702
  try {
5633
- if (t = Ri && (self.URL || self.webkitURL).createObjectURL(Ri), !t) throw "";
5703
+ if (t = Ui && (self.URL || self.webkitURL).createObjectURL(Ui), !t) throw "";
5634
5704
  let n = new Worker(t, {
5635
5705
  type: "module",
5636
5706
  name: e?.name
@@ -5639,7 +5709,7 @@ function zi(e) {
5639
5709
  (self.URL || self.webkitURL).revokeObjectURL(t);
5640
5710
  }), n;
5641
5711
  } catch {
5642
- return new Worker("data:text/javascript;charset=utf-8," + encodeURIComponent(Li), {
5712
+ return new Worker("data:text/javascript;charset=utf-8," + encodeURIComponent(Hi), {
5643
5713
  type: "module",
5644
5714
  name: e?.name
5645
5715
  });
@@ -5647,7 +5717,7 @@ function zi(e) {
5647
5717
  }
5648
5718
  //#endregion
5649
5719
  //#region packages/pptx/src/wasm/pptx_parser_bg.wasm?url
5650
- var Bi = new URL("pptx_parser_bg.wasm", import.meta.url).href, Vi = class e {
5720
+ var Gi = new URL("pptx_parser_bg.wasm", import.meta.url).href, Ki = class e {
5651
5721
  _worker;
5652
5722
  _bridge;
5653
5723
  _mode = "main";
@@ -5664,7 +5734,7 @@ var Bi = new URL("pptx_parser_bg.wasm", import.meta.url).href, Vi = class e {
5664
5734
  correlate: (e) => e.id,
5665
5735
  toError: (e) => e.kind === "error" ? e.message : void 0
5666
5736
  });
5667
- let r = new URL(n ?? Bi, location.href).href;
5737
+ let r = new URL(n ?? Gi, location.href).href;
5668
5738
  this._bridge.post({
5669
5739
  kind: "init",
5670
5740
  wasmUrl: r
@@ -5680,8 +5750,8 @@ var Bi = new URL("pptx_parser_bg.wasm", import.meta.url).href, Vi = class e {
5680
5750
  i = await e.arrayBuffer();
5681
5751
  } else i = t;
5682
5752
  i = h(await _e(i, n.password));
5683
- let a = new e(r === "worker" ? (await import("./render-worker-host-B5otq5TA.js")).createRenderWorker() : new zi(), r, n.wasmUrl);
5684
- return n.math && r === "worker" && console.warn("[ooxml] the math engine is unavailable in mode: 'worker'; equations will be skipped. Use mode: 'main' for documents with equations."), a._math = r === "worker" ? void 0 : n.math, await a._parse(i, n.maxZipEntryBytes, r === "worker" ? !!n.useGoogleFonts : !1, n.workerTimeoutMs), r === "main" && n.useGoogleFonts && a._presentation && (a._googleFontFaces = await f(Fi(a._presentation), Mi)), a;
5753
+ let a = new e(r === "worker" ? (await import("./render-worker-host-BqSTDaYt.js")).createRenderWorker() : new Wi(), r, n.wasmUrl);
5754
+ return n.math && r === "worker" && console.warn("[ooxml] the math engine is unavailable in mode: 'worker'; equations will be skipped. Use mode: 'main' for documents with equations."), a._math = r === "worker" ? void 0 : n.math, await a._parse(i, n.maxZipEntryBytes, r === "worker" ? !!n.useGoogleFonts : !1, n.workerTimeoutMs), r === "main" && n.useGoogleFonts && a._presentation && (a._googleFontFaces = await f(Bi(a._presentation), Li)), a;
5685
5755
  }
5686
5756
  async _parse(e, t, n = !1, r) {
5687
5757
  let i = await this._bridge.request((r) => this._mode === "worker" ? {
@@ -5715,22 +5785,22 @@ var Bi = new URL("pptx_parser_bg.wasm", import.meta.url).href, Vi = class e {
5715
5785
  return this._mode;
5716
5786
  }
5717
5787
  getNotes(e) {
5718
- return this._meta ? Number.isInteger(e) ? this._meta.notes[e] ?? null : null : Di(this._presentation?.slides ?? [], e);
5788
+ return this._meta ? Number.isInteger(e) ? this._meta.notes[e] ?? null : null : Mi(this._presentation?.slides ?? [], e);
5719
5789
  }
5720
5790
  isHidden(e) {
5721
- return this._meta ? Number.isInteger(e) ? this._meta.hidden[e] ?? !1 : !1 : Oi(this._presentation?.slides ?? [], e);
5791
+ return this._meta ? Number.isInteger(e) ? this._meta.hidden[e] ?? !1 : !1 : Ni(this._presentation?.slides ?? [], e);
5722
5792
  }
5723
5793
  _partNames() {
5724
5794
  return this._meta ? this._meta.partNames : (this._presentation?.slides ?? []).map((e) => e.partName);
5725
5795
  }
5726
5796
  _partIndex() {
5727
- return this._slidePartIndex ||= ki(this._partNames()), this._slidePartIndex;
5797
+ return this._slidePartIndex ||= Pi(this._partNames()), this._slidePartIndex;
5728
5798
  }
5729
5799
  getSlideIndexByPartName(e) {
5730
5800
  return this._partIndex().get(e);
5731
5801
  }
5732
5802
  resolveInternalTarget(e, t = 0) {
5733
- return ji(e, this._partIndex(), t);
5803
+ return Ii(e, this._partIndex(), t);
5734
5804
  }
5735
5805
  async renderSlide(e, t, n = {}) {
5736
5806
  if (this._mode === "worker") throw Error("renderSlide(canvas) is unavailable in mode: 'worker'; use renderSlideToBitmap() and paint it via an ImageBitmapRenderingContext");
@@ -5807,7 +5877,7 @@ var Bi = new URL("pptx_parser_bg.wasm", import.meta.url).href, Vi = class e {
5807
5877
  return this._mediaCache.set(e, r), r;
5808
5878
  }
5809
5879
  _findMimeTypeForPath(e) {
5810
- return this._presentation ? Ii(this._presentation, e) : "";
5880
+ return this._presentation ? Vi(this._presentation, e) : "";
5811
5881
  }
5812
5882
  async getImage(e, t) {
5813
5883
  let n = this._imageCache.get(e);
@@ -5856,16 +5926,17 @@ var Bi = new URL("pptx_parser_bg.wasm", import.meta.url).href, Vi = class e {
5856
5926
  slideWidthEmu: this.slideWidth,
5857
5927
  fetchMedia: (e) => this.getMedia(e),
5858
5928
  fetchImage: this._fetchImage,
5859
- drawBase: a
5929
+ drawBase: a,
5930
+ onError: n.onError
5860
5931
  });
5861
5932
  }
5862
5933
  destroy() {
5863
5934
  this._bridge.terminate(), this._presentation = null, this._meta = null, this._slidePartIndex = null, this._mediaCache.clear(), this._imageCache.clear(), this._googleFontFaces.length > 0 && (j(this._googleFontFaces), this._googleFontFaces = []), z(this._fetchImage), Ge(this._fetchImage), se(this._fetchImage);
5864
5935
  }
5865
- }, Hi = {
5936
+ }, qi = {
5866
5937
  color: "#ffffff",
5867
5938
  opacity: .6
5868
- }, Ui = class {
5939
+ }, Ji = class {
5869
5940
  canvas;
5870
5941
  wrapper;
5871
5942
  _scale = null;
@@ -5893,7 +5964,7 @@ var Bi = new URL("pptx_parser_bg.wasm", import.meta.url).href, Vi = class e {
5893
5964
  async load(e) {
5894
5965
  let t = ++this._loadGen, n = this.engine;
5895
5966
  try {
5896
- let r = await Vi.load(e, {
5967
+ let r = await Ki.load(e, {
5897
5968
  useGoogleFonts: this.opts.useGoogleFonts,
5898
5969
  maxZipEntryBytes: this.opts.maxZipEntryBytes,
5899
5970
  workerTimeoutMs: this.opts.workerTimeoutMs,
@@ -5933,8 +6004,8 @@ var Bi = new URL("pptx_parser_bg.wasm", import.meta.url).href, Vi = class e {
5933
6004
  }
5934
6005
  _dim() {
5935
6006
  return {
5936
- color: this.opts.hiddenSlideDim?.color ?? Hi.color,
5937
- opacity: this.opts.hiddenSlideDim?.opacity ?? Hi.opacity
6007
+ color: this.opts.hiddenSlideDim?.color ?? qi.color,
6008
+ opacity: this.opts.hiddenSlideDim?.opacity ?? qi.opacity
5938
6009
  };
5939
6010
  }
5940
6011
  async setHiddenSlideMode(e) {
@@ -6018,7 +6089,8 @@ var Bi = new URL("pptx_parser_bg.wasm", import.meta.url).href, Vi = class e {
6018
6089
  width: t,
6019
6090
  dpr: n,
6020
6091
  dim: e,
6021
- onTextRun: s
6092
+ onTextRun: s,
6093
+ onError: (e) => this._reportRenderError(e)
6022
6094
  });
6023
6095
  else if (a) {
6024
6096
  let r = await this.engine.renderSlideToBitmap(this.currentSlide, {
@@ -6042,7 +6114,7 @@ var Bi = new URL("pptx_parser_bg.wasm", import.meta.url).href, Vi = class e {
6042
6114
  }
6043
6115
  _buildHighlightLayer(e, t, n) {
6044
6116
  let r = this.highlightLayer;
6045
- r && xn(r, e, this._find.slideHighlights(this.currentSlide), t, n, (e) => this._measureForFont(e));
6117
+ r && xn(r, e, this._find.slideHighlights(this.currentSlide), t, n, (e) => this._measureForFont(e), this.opts.findHighlightColors);
6046
6118
  }
6047
6119
  _measureForFont(e) {
6048
6120
  this._measureCtx ||= document.createElement("canvas").getContext("2d");
@@ -6111,7 +6183,7 @@ var Bi = new URL("pptx_parser_bg.wasm", import.meta.url).href, Vi = class e {
6111
6183
  } else this.canvas.parentNode && this.canvas.parentNode.removeChild(this.canvas);
6112
6184
  this.canvas.style.display = this._originalDisplay, this.wrapper.remove();
6113
6185
  }
6114
- }, Wi = 150, Gi = "0 1px 3px rgba(0,0,0,0.2)", Ki = class {
6186
+ }, Yi = 150, Xi = "0 1px 3px rgba(0,0,0,0.2)", Zi = class {
6115
6187
  _pres = null;
6116
6188
  _injected;
6117
6189
  _opts;
@@ -6145,7 +6217,7 @@ var Bi = new URL("pptx_parser_bg.wasm", import.meta.url).href, Vi = class e {
6145
6217
  _findMeasureCtx;
6146
6218
  constructor(e, t = {}) {
6147
6219
  if (e.tagName === "CANVAS") throw Error("PptxScrollViewer takes a container element (e.g. a <div>), not a <canvas> — the viewer creates and manages its own canvases. Pass a block container; for the single-slide canvas API use PptxViewer.");
6148
- if (this._container = e, this._opts = t, this._pageShadow = t.pageShadow ?? Gi, this._injected = !!t.presentation, this._injected) {
6220
+ if (this._container = e, this._opts = t, this._pageShadow = t.pageShadow ?? Xi, this._injected = !!t.presentation, this._injected) {
6149
6221
  let e = t.presentation;
6150
6222
  if (t.mode !== void 0 && t.mode !== e.mode) throw Error(`PptxScrollViewer: opts.mode='${t.mode}' conflicts with the injected engine's mode='${e.mode}'. Omit opts.mode when injecting an engine — the engine owns its render mode.`);
6151
6223
  this._pres = e, this._mode = e.mode;
@@ -6163,7 +6235,7 @@ var Bi = new URL("pptx_parser_bg.wasm", import.meta.url).href, Vi = class e {
6163
6235
  if (this._injected) throw Error("PptxScrollViewer.load() is unsupported when an engine is injected via opts.presentation; the injected engine is already loaded.");
6164
6236
  let t = ++this._loadGen, n = this._pres;
6165
6237
  try {
6166
- let r = await Vi.load(e, {
6238
+ let r = await Ki.load(e, {
6167
6239
  useGoogleFonts: this._opts.useGoogleFonts,
6168
6240
  maxZipEntryBytes: this._opts.maxZipEntryBytes,
6169
6241
  workerTimeoutMs: this._opts.workerTimeoutMs,
@@ -6364,7 +6436,10 @@ var Bi = new URL("pptx_parser_bg.wasm", import.meta.url).href, Vi = class e {
6364
6436
  this._pres.presentSlide(t.canvas, e, {
6365
6437
  width: n,
6366
6438
  dpr: r,
6367
- onTextRun: u
6439
+ onTextRun: u,
6440
+ onError: (e) => {
6441
+ o === t.presentationGeneration && this._reportRenderError(e);
6442
+ }
6368
6443
  }).then((r) => {
6369
6444
  if (o !== t.presentationGeneration || !t.mediaInteractive || a !== this._renderEpoch || this._slots.get(e) !== t || t.renderedSlide !== e) {
6370
6445
  r.destroy();
@@ -6482,7 +6557,7 @@ var Bi = new URL("pptx_parser_bg.wasm", import.meta.url).href, Vi = class e {
6482
6557
  _scheduleSettle() {
6483
6558
  this._settleTimer !== null && clearTimeout(this._settleTimer), this._settleTimer = setTimeout(() => {
6484
6559
  this._settleTimer = null, this._settleRender();
6485
- }, Wi);
6560
+ }, Yi);
6486
6561
  }
6487
6562
  _settleRender() {
6488
6563
  if (this._destroyed || !this._pres || this._pres.slideCount === 0) return;
@@ -6524,7 +6599,10 @@ var Bi = new URL("pptx_parser_bg.wasm", import.meta.url).href, Vi = class e {
6524
6599
  this._pres.presentSlide(s, e, {
6525
6600
  width: n,
6526
6601
  dpr: r,
6527
- onTextRun: d
6602
+ onTextRun: d,
6603
+ onError: (e) => {
6604
+ o === t.presentationGeneration && this._reportRenderError(e);
6605
+ }
6528
6606
  }).then((r) => {
6529
6607
  if (o !== t.presentationGeneration || !t.mediaInteractive || a !== this._renderEpoch || this._slots.get(e) !== t || t.renderedSlide !== e) {
6530
6608
  r.destroy();
@@ -6581,7 +6659,7 @@ var Bi = new URL("pptx_parser_bg.wasm", import.meta.url).href, Vi = class e {
6581
6659
  t.highlightLayer.innerHTML = "";
6582
6660
  return;
6583
6661
  }
6584
- xn(t.highlightLayer, n, this._find.slideHighlights(e), this._slideWidthPx(), this._slideHeightPx(), (e) => this._measureForFind(e));
6662
+ xn(t.highlightLayer, n, this._find.slideHighlights(e), this._slideWidthPx(), this._slideHeightPx(), (e) => this._measureForFind(e), this._opts.findHighlightColors);
6585
6663
  }
6586
6664
  _measureForFind(e) {
6587
6665
  this._findMeasureCtx === void 0 && (this._findMeasureCtx = document.createElement("canvas").getContext("2d"));
@@ -6668,11 +6746,11 @@ var Bi = new URL("pptx_parser_bg.wasm", import.meta.url).href, Vi = class e {
6668
6746
  for (let [e, t] of [...this._slots]) this._recycleSlot(e, t);
6669
6747
  this._free.length = 0, this._injected || this._pres?.destroy(), this._pres = null, this._wrapper.remove();
6670
6748
  }
6671
- }, qi = /* @__PURE__ */ e({
6749
+ }, Qi = /* @__PURE__ */ e({
6672
6750
  OoxmlError: () => F,
6673
- PptxPresentation: () => Vi,
6674
- PptxScrollViewer: () => Ki,
6675
- PptxViewer: () => Ui,
6751
+ PptxPresentation: () => Ki,
6752
+ PptxScrollViewer: () => Zi,
6753
+ PptxViewer: () => Ji,
6676
6754
  autoResize: () => R,
6677
6755
  buildPptxHighlightLayer: () => xn,
6678
6756
  buildPptxTextLayer: () => Y,
@@ -6680,4 +6758,4 @@ var Bi = new URL("pptx_parser_bg.wasm", import.meta.url).href, Vi = class e {
6680
6758
  renderSlide: () => ai
6681
6759
  });
6682
6760
  //#endregion
6683
- export { ai as a, Vi as i, Ki as n, xn as o, Ui as r, Y as s, qi as t };
6761
+ export { ai as a, Ki as i, Zi as n, xn as o, Ji as r, Y as s, Qi as t };