@silurus/ooxml 0.85.3 → 0.86.1

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.
Files changed (56) hide show
  1. package/README.md +39 -7
  2. package/dist/assets/render-worker-D21h5TGR.js +10 -0
  3. package/dist/assets/render-worker-Dsfekaht.js +11 -0
  4. package/dist/assets/render-worker-DxU7IrKo.js +31 -0
  5. package/dist/bounded-raw-part-cache-BfbSxRIL.js +119 -0
  6. package/dist/{canvas-viewer-mechanics-CDNMJ-Yz.js → canvas-viewer-mechanics-DN5SqWGS.js} +329 -192
  7. package/dist/{comment-ui-runtime-DAKBCpsM.js → comment-ui-runtime-DEtgcmj7.js} +5 -5
  8. package/dist/comment-ui-runtime-TLHustXJ.js +2 -0
  9. package/dist/{comment-ui-runtime-CAbpuWi_.js → comment-ui-runtime-lXwVOgjW.js} +4 -4
  10. package/dist/{comments-Brfxa3hQ.js → comments-CAn2A_Xh.js} +1 -1
  11. package/dist/delimited-text-worker-host-DcHj_JZt.js +27 -0
  12. package/dist/{document-pull-client-F3ox_VXK.js → document-pull-client-uopDjRde.js} +4477 -4431
  13. package/dist/{docx-BYvm3TWw.js → docx-wPzeF76A.js} +519 -334
  14. package/dist/docx.mjs +7 -7
  15. package/dist/docx_parser_bg.wasm +0 -0
  16. package/dist/{dom-interaction-boundary-CDGegIB5.js → dom-interaction-boundary-CswB9Tzi.js} +60 -57
  17. package/dist/{line-metrics-BGtFM-ec.js → hyperlink-BR1NCO7S.js} +954 -935
  18. package/dist/index.mjs +4 -4
  19. package/dist/{line-distribute-BsV4MVZ2.js → line-distribute-IsUGfHXm.js} +10 -10
  20. package/dist/line-metrics-CBbw80Ko.js +60 -0
  21. package/dist/node.mjs +266 -266
  22. package/dist/{pptx-BqpVTP8p.js → pptx-BxJ_RBSY.js} +173 -165
  23. package/dist/pptx.mjs +5 -5
  24. package/dist/pptx_parser_bg.wasm +0 -0
  25. package/dist/{render-DeZpRCfx.js → render-DEiun_AH.js} +1 -1
  26. package/dist/{render-worker-host-BKtXmlEF.js → render-worker-host-BEfLZvSL.js} +1 -1
  27. package/dist/{render-worker-host-CNKQ76tu.js → render-worker-host-Ba6Fchqr.js} +1 -1
  28. package/dist/{render-worker-host-CBcQXsR5.js → render-worker-host-C3xwtHnv.js} +1 -1
  29. package/dist/{resource-measurement-D41R-0Bl.js → resource-measurement-CclArDRs.js} +10 -10
  30. package/dist/{session-n2p5_jxV.js → session-BuJL_xcp.js} +87 -87
  31. package/dist/{slide-pull-client-Dwek7xW8.js → slide-pull-client-Ck8wfRT_.js} +1239 -1165
  32. package/dist/types/chart-ex.d.ts +2 -2
  33. package/dist/types/docx.d.ts +10 -11
  34. package/dist/types/index.d.ts +38 -19
  35. package/dist/types/math.d.ts +1 -1
  36. package/dist/types/node.d.ts +6 -5
  37. package/dist/types/pptx.d.ts +10 -10
  38. package/dist/types/region-map.d.ts +2 -2
  39. package/dist/types/three-d.d.ts +2 -2
  40. package/dist/types/tiff.d.ts +1 -1
  41. package/dist/types/xlsx.d.ts +34 -14
  42. package/dist/{worksheet-pull-client-C9sC36Vu.js → worksheet-pull-client-CAvuf22q.js} +72 -69
  43. package/dist/{xlsx-DSU6pV1O.js → xlsx-Bblm5r1h.js} +1752 -1592
  44. package/dist/xlsx.mjs +5 -5
  45. package/dist/xlsx_parser_bg.wasm +0 -0
  46. package/package.json +1 -1
  47. package/dist/assets/render-worker-D1O73gYW.js +0 -10
  48. package/dist/assets/render-worker-DHP0rgcW.js +0 -24
  49. package/dist/assets/render-worker-V2wWYA4O.js +0 -11
  50. package/dist/bounded-raw-part-cache-C6ro6Ezf.js +0 -254
  51. package/dist/comment-ui-runtime-DTaaZdXC.js +0 -2
  52. /package/dist/{comment-occurrence-tj54AXXB.js → comment-occurrence-CqejEuts.js} +0 -0
  53. /package/dist/{highlight-rect-DBcYVJDv.js → highlight-rect-FuUSmL3a.js} +0 -0
  54. /package/dist/{read-only-comment-decoration-Mv_SAiHy.js → read-only-comment-decoration-BTnWEeo5.js} +0 -0
  55. /package/dist/{read-only-comment-margin-Cqu-Ir0C.js → read-only-comment-margin-plStyGfE.js} +0 -0
  56. /package/dist/{source-key-BkBB3X82.js → source-key-Ktb1GRE5.js} +0 -0
@@ -1,17 +1,17 @@
1
- import { $ as e, A as t, At as n, Bt as r, C as i, Ct as a, D as o, Et as s, Ft as c, Ht as l, It as u, J as d, Lt as f, M as p, Mt as m, N as h, Nt as g, O as _, Ot as v, Pt as y, Rt as b, S as x, St as S, Tt as C, Vt as w, Wt as T, Xt as E, Yt as D, _ as O, _t as k, at as A, bt as j, c as M, cn as N, ct as P, d as F, dt as I, et as L, f as R, g as z, gt as B, h as V, i as H, it as U, j as ee, jt as W, lt as G, m as K, mt as q, n as J, nt as te, p as ne, r as re, rt as ie, s as ae, tt as oe, u as se, w as ce, wt as le, xt as ue, y as de, zt as fe } from "./line-metrics-BGtFM-ec.js";
2
- import { a as pe, c as me, d as he, f as ge, i as _e, l as ve, o as ye, p as be, r as xe, s as Se, t as Ce, u as we } from "./line-distribute-BsV4MVZ2.js";
3
- import { A as Te, D as Ee, S as De, _ as Oe, h as ke, hn as Ae, in as je, j as Me, on as Ne, sn as Pe, v as Fe, w as Ie } from "./plot-area-frame-D5hEOgkJ.js";
4
- import { l as Le } from "./pixel-budget-Dgjw269h.js";
1
+ import { $ as e, A as t, At as n, Bt as r, C as i, Ct as a, D as o, Dt as s, E as c, Ft as l, Ht as u, It as d, Lt as f, M as p, Mt as m, Nt as h, Pt as g, Q as _, Rt as v, S as y, St as b, Tt as x, Vt as S, Wt as C, Xt as w, Yt as T, _ as E, a as D, b as O, bt as k, c as A, cn as j, ct as M, d as N, et as P, f as F, gt as I, h as L, ht as R, it as z, j as B, jt as V, k as H, kt as U, l as W, m as ee, n as G, nt as te, o as K, p as q, pt as J, q as ne, rt as re, st as ie, t as ae, tt as oe, u as se, ut as ce, wt as le, x as ue, xt as de, yt as fe, zt as pe } from "./hyperlink-BR1NCO7S.js";
2
+ import { a as me, c as he, d as ge, f as _e, i as ve, l as ye, o as be, p as xe, r as Se, s as Ce, t as we, u as Te } from "./line-distribute-IsUGfHXm.js";
3
+ import { A as Ee, D as De, S as Oe, _ as ke, h as Ae, hn as je, in as Me, j as Ne, on as Pe, sn as Fe, v as Ie, w as Le } from "./plot-area-frame-D5hEOgkJ.js";
4
+ import { l as Re } from "./pixel-budget-Dgjw269h.js";
5
5
  import { r as Y } from "./units-EJdC96r6.js";
6
- import { A as Re, F as ze, I as Be, L as Ve, M as He, N as Ue, P as We, j as Ge } from "./three-d-YYghQndN.js";
7
- import { k as Ke } from "./renderer-XFSCOT6m.js";
8
- import { s as qe } from "./raster-target-ojDdQizC.js";
9
- import { a as Je, i as Ye, n as Xe, t as Ze } from "./resource-measurement-D41R-0Bl.js";
6
+ import { A as ze, F as Be, I as Ve, L as He, M as Ue, N as We, P as Ge, j as Ke } from "./three-d-YYghQndN.js";
7
+ import { k as qe } from "./renderer-XFSCOT6m.js";
8
+ import { s as Je } from "./raster-target-ojDdQizC.js";
9
+ import { a as Ye, i as Xe, n as Ze, t as Qe } from "./resource-measurement-CclArDRs.js";
10
10
  //#region packages/pptx/src/types.ts
11
- function Qe(e) {
11
+ function $e(e) {
12
12
  return e;
13
13
  }
14
- var $e = {
14
+ var et = {
15
15
  textarchdown: {
16
16
  adj: [["adj", "val 0"]],
17
17
  gd: [
@@ -2393,22 +2393,22 @@ var $e = {
2393
2393
  ]
2394
2394
  }]
2395
2395
  }
2396
- }, et = Math.PI * 2 / 216e5, tt = $e, nt = /* @__PURE__ */ new Map();
2397
- function rt(e) {
2398
- return e.toLowerCase() in tt;
2399
- }
2396
+ }, tt = Math.PI * 2 / 216e5, nt = et, rt = /* @__PURE__ */ new Map();
2400
2397
  function it(e) {
2401
- let t = nt.get(e);
2398
+ return e.toLowerCase() in nt;
2399
+ }
2400
+ function at(e) {
2401
+ let t = rt.get(e);
2402
2402
  if (t) return t;
2403
- let n = tt[e];
2403
+ let n = nt[e];
2404
2404
  return n ? (t = {
2405
- adj: n.adj.map(([e, t]) => [e, y(t)]),
2406
- gd: n.gd.map(([e, t]) => [e, y(t)]),
2405
+ adj: n.adj.map(([e, t]) => [e, h(t)]),
2406
+ gd: n.gd.map(([e, t]) => [e, h(t)]),
2407
2407
  paths: n.paths
2408
- }, nt.set(e, t), t) : null;
2408
+ }, rt.set(e, t), t) : null;
2409
2409
  }
2410
- var at = 48;
2411
- function ot(e, t, n, r) {
2410
+ var ot = 48;
2411
+ function st(e, t, n, r) {
2412
2412
  let i = e.w == null ? 1 : n / e.w, a = e.h == null ? 1 : r / e.h, o = (e) => e * i, s = (e) => e * a, c = [], l = 0, u = 0;
2413
2413
  for (let n of e.cmds) switch (n[0]) {
2414
2414
  case "m":
@@ -2425,8 +2425,8 @@ function ot(e, t, n, r) {
2425
2425
  break;
2426
2426
  case "C": {
2427
2427
  let e = o(t.resolve(n[1])), r = s(t.resolve(n[2])), i = o(t.resolve(n[3])), a = s(t.resolve(n[4])), d = o(t.resolve(n[5])), f = s(t.resolve(n[6]));
2428
- for (let t = 1; t <= at; t++) {
2429
- let n = t / at, o = 1 - n, s = o * o * o * l + 3 * o * o * n * e + 3 * o * n * n * i + n * n * n * d, p = o * o * o * u + 3 * o * o * n * r + 3 * o * n * n * a + n * n * n * f;
2428
+ for (let t = 1; t <= ot; t++) {
2429
+ let n = t / ot, o = 1 - n, s = o * o * o * l + 3 * o * o * n * e + 3 * o * n * n * i + n * n * n * d, p = o * o * o * u + 3 * o * o * n * r + 3 * o * n * n * a + n * n * n * f;
2430
2430
  c.push({
2431
2431
  x: s,
2432
2432
  y: p
@@ -2437,8 +2437,8 @@ function ot(e, t, n, r) {
2437
2437
  }
2438
2438
  case "Q": {
2439
2439
  let e = o(t.resolve(n[1])), r = s(t.resolve(n[2])), i = o(t.resolve(n[3])), a = s(t.resolve(n[4]));
2440
- for (let t = 1; t <= at; t++) {
2441
- let n = t / at, o = 1 - n, s = o * o * l + 2 * o * n * e + n * n * i, d = o * o * u + 2 * o * n * r + n * n * a;
2440
+ for (let t = 1; t <= ot; t++) {
2441
+ let n = t / ot, o = 1 - n, s = o * o * l + 2 * o * n * e + n * n * i, d = o * o * u + 2 * o * n * r + n * n * a;
2442
2442
  c.push({
2443
2443
  x: s,
2444
2444
  y: d
@@ -2448,9 +2448,9 @@ function ot(e, t, n, r) {
2448
2448
  break;
2449
2449
  }
2450
2450
  case "a": {
2451
- let e = t.resolve(n[1]), r = t.resolve(n[2]), o = e * i, s = r * a, d = t.resolve(n[3]) * et, f = t.resolve(n[4]) * et, p = (t) => Math.atan2(e * Math.sin(t), r * Math.cos(t)), m = Math.PI * 2, h = p(d), g = Math.trunc(f / m), _ = f - g * m, v = p(d + _) - h;
2451
+ let e = t.resolve(n[1]), r = t.resolve(n[2]), o = e * i, s = r * a, d = t.resolve(n[3]) * tt, f = t.resolve(n[4]) * tt, p = (t) => Math.atan2(e * Math.sin(t), r * Math.cos(t)), m = Math.PI * 2, h = p(d), g = Math.trunc(f / m), _ = f - g * m, v = p(d + _) - h;
2452
2452
  _ > 0 && v < 0 ? v += m : _ < 0 && v > 0 && (v -= m);
2453
- let y = v + g * m, b = l - o * Math.cos(h), x = u - s * Math.sin(h), S = Math.max(at, Math.ceil(Math.abs(y) / m * 96));
2453
+ let y = v + g * m, b = l - o * Math.cos(h), x = u - s * Math.sin(h), S = Math.max(ot, Math.ceil(Math.abs(y) / m * 96));
2454
2454
  for (let e = 1; e <= S; e++) {
2455
2455
  let t = h + y * e / S;
2456
2456
  c.push({
@@ -2465,7 +2465,7 @@ function ot(e, t, n, r) {
2465
2465
  }
2466
2466
  return c;
2467
2467
  }
2468
- function st(e) {
2468
+ function ct(e) {
2469
2469
  let t = [0];
2470
2470
  for (let n = 1; n < e.length; n++) {
2471
2471
  let r = e[n].x - e[n - 1].x, i = e[n].y - e[n - 1].y;
@@ -2473,23 +2473,23 @@ function st(e) {
2473
2473
  }
2474
2474
  return t;
2475
2475
  }
2476
- function ct(e, t, n, r) {
2477
- let i = it(e.toLowerCase());
2476
+ function lt(e, t, n, r) {
2477
+ let i = at(e.toLowerCase());
2478
2478
  if (!i || i.paths.length === 0) return null;
2479
- let a = c({
2479
+ let a = g({
2480
2480
  w: n,
2481
2481
  h: r,
2482
2482
  adj: t
2483
- }, i.adj, i.gd), o = i.paths.length === 1, s = ot(i.paths[0], a, n, r), l = o ? s : ot(i.paths[i.paths.length - 1], a, n, r);
2483
+ }, i.adj, i.gd), o = i.paths.length === 1, s = st(i.paths[0], a, n, r), c = o ? s : st(i.paths[i.paths.length - 1], a, n, r);
2484
2484
  return {
2485
2485
  top: s,
2486
- bottom: l,
2487
- topLen: st(s),
2488
- bottomLen: st(l),
2486
+ bottom: c,
2487
+ topLen: ct(s),
2488
+ bottomLen: ct(c),
2489
2489
  singleEdge: o
2490
2490
  };
2491
2491
  }
2492
- function lt(e, t, n) {
2492
+ function ut(e, t, n) {
2493
2493
  let r = t[t.length - 1];
2494
2494
  if (e.length === 1 || r === 0) return {
2495
2495
  x: e[0].x,
@@ -2510,17 +2510,17 @@ function lt(e, t, n) {
2510
2510
  ty: f / p
2511
2511
  };
2512
2512
  }
2513
- function ut(e) {
2513
+ function dt(e) {
2514
2514
  return e.topLen[e.topLen.length - 1] ?? 0;
2515
2515
  }
2516
- function dt(e, t) {
2516
+ function ft(e, t) {
2517
2517
  if (!e.singleEdge) return 1;
2518
- let n = ut(e);
2518
+ let n = dt(e);
2519
2519
  return n <= 0 ? 1 : Math.max(0, Math.min(1, t / n));
2520
2520
  }
2521
- function ft(e, t, n, r) {
2521
+ function pt(e, t, n, r) {
2522
2522
  if (e.singleEdge) {
2523
- let i = lt(e.top, e.topLen, t), a = Math.atan2(i.ty, i.tx), o = i.ty, s = -i.tx, c = n * (1 - r);
2523
+ let i = ut(e.top, e.topLen, t), a = Math.atan2(i.ty, i.tx), o = i.ty, s = -i.tx, c = n * (1 - r);
2524
2524
  return {
2525
2525
  x: i.x - o * c,
2526
2526
  y: i.y - s * c,
@@ -2529,7 +2529,7 @@ function ft(e, t, n, r) {
2529
2529
  shear: 0
2530
2530
  };
2531
2531
  }
2532
- let i = lt(e.top, e.topLen, t), a = lt(e.bottom, e.bottomLen, t), o = a.x - i.x, s = a.y - i.y, c = i.x + o * r, l = i.y + s * r, u = i.tx + a.tx, d = i.ty + a.ty, f = Math.atan2(d, u), p = Math.cos(f), m = Math.sin(f), h = (p * o + m * s) / (n > 0 ? n : 1), g = (-m * o + p * s) / (n > 0 ? n : 1);
2532
+ let i = ut(e.top, e.topLen, t), a = ut(e.bottom, e.bottomLen, t), o = a.x - i.x, s = a.y - i.y, c = i.x + o * r, l = i.y + s * r, u = i.tx + a.tx, d = i.ty + a.ty, f = Math.atan2(d, u), p = Math.cos(f), m = Math.sin(f), h = (p * o + m * s) / (n > 0 ? n : 1), g = (-m * o + p * s) / (n > 0 ? n : 1);
2533
2533
  return {
2534
2534
  x: c,
2535
2535
  y: l,
@@ -2540,7 +2540,7 @@ function ft(e, t, n, r) {
2540
2540
  }
2541
2541
  //#endregion
2542
2542
  //#region packages/core/src/shape/scene3d-camera.ts
2543
- var pt = 26, mt = {
2543
+ var mt = 26, ht = {
2544
2544
  orthographicFront: {
2545
2545
  kind: "orthographic",
2546
2546
  baseLat: 0,
@@ -2553,52 +2553,52 @@ var pt = 26, mt = {
2553
2553
  baseLat: 0,
2554
2554
  baseLon: 0,
2555
2555
  baseRev: 0,
2556
- fovDeg: pt
2556
+ fovDeg: mt
2557
2557
  },
2558
2558
  perspectiveRelaxed: {
2559
2559
  kind: "perspective",
2560
2560
  baseLat: 0,
2561
2561
  baseLon: 0,
2562
2562
  baseRev: 0,
2563
- fovDeg: pt
2563
+ fovDeg: mt
2564
2564
  },
2565
2565
  perspectiveRelaxedModerately: {
2566
2566
  kind: "perspective",
2567
2567
  baseLat: 0,
2568
2568
  baseLon: 0,
2569
2569
  baseRev: 0,
2570
- fovDeg: pt
2570
+ fovDeg: mt
2571
2571
  },
2572
2572
  perspectiveAbove: {
2573
2573
  kind: "perspective",
2574
2574
  baseLat: -20,
2575
2575
  baseLon: 0,
2576
2576
  baseRev: 0,
2577
- fovDeg: pt
2577
+ fovDeg: mt
2578
2578
  },
2579
2579
  perspectiveBelow: {
2580
2580
  kind: "perspective",
2581
2581
  baseLat: 20,
2582
2582
  baseLon: 0,
2583
2583
  baseRev: 0,
2584
- fovDeg: pt
2584
+ fovDeg: mt
2585
2585
  },
2586
2586
  perspectiveLeft: {
2587
2587
  kind: "perspective",
2588
2588
  baseLat: 0,
2589
2589
  baseLon: -20,
2590
2590
  baseRev: 0,
2591
- fovDeg: pt
2591
+ fovDeg: mt
2592
2592
  },
2593
2593
  perspectiveRight: {
2594
2594
  kind: "perspective",
2595
2595
  baseLat: 0,
2596
2596
  baseLon: 20,
2597
2597
  baseRev: 0,
2598
- fovDeg: pt
2598
+ fovDeg: mt
2599
2599
  }
2600
2600
  };
2601
- function ht(e, t) {
2601
+ function gt(e, t) {
2602
2602
  let n = Array(9).fill(0);
2603
2603
  for (let r = 0; r < 3; r++) for (let i = 0; i < 3; i++) {
2604
2604
  let a = 0;
@@ -2607,7 +2607,7 @@ function ht(e, t) {
2607
2607
  }
2608
2608
  return n;
2609
2609
  }
2610
- function gt(e) {
2610
+ function _t(e) {
2611
2611
  let t = e * Math.PI / 180, n = Math.cos(t), r = Math.sin(t);
2612
2612
  return [
2613
2613
  1,
@@ -2621,7 +2621,7 @@ function gt(e) {
2621
2621
  n
2622
2622
  ];
2623
2623
  }
2624
- function _t(e) {
2624
+ function vt(e) {
2625
2625
  let t = e * Math.PI / 180, n = Math.cos(t), r = Math.sin(t);
2626
2626
  return [
2627
2627
  n,
@@ -2635,7 +2635,7 @@ function _t(e) {
2635
2635
  n
2636
2636
  ];
2637
2637
  }
2638
- function vt(e) {
2638
+ function yt(e) {
2639
2639
  let t = e * Math.PI / 180, n = Math.cos(t), r = Math.sin(t);
2640
2640
  return [
2641
2641
  n,
@@ -2649,22 +2649,22 @@ function vt(e) {
2649
2649
  1
2650
2650
  ];
2651
2651
  }
2652
- function yt(e, t, n, r) {
2652
+ function bt(e, t, n, r) {
2653
2653
  return [
2654
2654
  e[0] * t + e[1] * n + e[2] * r,
2655
2655
  e[3] * t + e[4] * n + e[5] * r,
2656
2656
  e[6] * t + e[7] * n + e[8] * r
2657
2657
  ];
2658
2658
  }
2659
- function bt(e, t) {
2659
+ function xt(e, t) {
2660
2660
  let n = t ? t.lat : e.baseLat, r = t ? t.lon : e.baseLon;
2661
- return ht(vt(-(t ? t.rev : e.baseRev)), ht(gt(-n), _t(-r)));
2661
+ return gt(yt(-(t ? t.rev : e.baseRev)), gt(_t(-n), vt(-r)));
2662
2662
  }
2663
- function xt(e) {
2664
- return mt[e] || (e.startsWith("perspective") ? mt.perspectiveFront : mt.orthographicFront);
2663
+ function St(e) {
2664
+ return ht[e] || (e.startsWith("perspective") ? ht.perspectiveFront : ht.orthographicFront);
2665
2665
  }
2666
- function St(e, t, n) {
2667
- let r = xt(e.prst), i = bt(r, e.rot);
2666
+ function Ct(e, t, n) {
2667
+ let r = St(e.prst), i = xt(r, e.rot);
2668
2668
  if (t <= 0 || n <= 0) return {
2669
2669
  corners: [
2670
2670
  {
@@ -2696,11 +2696,11 @@ function St(e, t, n) {
2696
2696
  if (r.kind === "perspective") {
2697
2697
  let t = e.fov ?? r.fovDeg, n = Math.max(1, Math.min(179, t)) * Math.PI / 180, a = l / Math.tan(n / 2);
2698
2698
  u = s.map(([e, t]) => {
2699
- let [n, r, o] = yt(i, e, t, 0), s = a - o, c = a / (Math.abs(s) < 1e-6 ? 1e-6 * Math.sign(s || 1) : s);
2699
+ let [n, r, o] = bt(i, e, t, 0), s = a - o, c = a / (Math.abs(s) < 1e-6 ? 1e-6 * Math.sign(s || 1) : s);
2700
2700
  return [n * c, r * c];
2701
2701
  });
2702
2702
  } else u = s.map(([e, t]) => {
2703
- let [n, r] = yt(i, e, t, 0);
2703
+ let [n, r] = bt(i, e, t, 0);
2704
2704
  return [n, r];
2705
2705
  });
2706
2706
  u = u.map(([e, t]) => [e * c, t * c]);
@@ -2723,18 +2723,18 @@ function St(e, t, n) {
2723
2723
  isIdentity: _
2724
2724
  };
2725
2725
  }
2726
- function Ct(e) {
2727
- let { isIdentity: t } = St(e, 1e3, 1e3);
2726
+ function wt(e) {
2727
+ let { isIdentity: t } = Ct(e, 1e3, 1e3);
2728
2728
  return !t;
2729
2729
  }
2730
- function wt(e, t, n, r) {
2731
- let i = xt(e.prst), a = bt(i, e.rot);
2730
+ function Tt(e, t, n, r) {
2731
+ let i = St(e.prst), a = xt(i, e.rot);
2732
2732
  if (t <= 0 || n <= 0 || r === 0) return {
2733
2733
  x: 0,
2734
2734
  y: 0
2735
2735
  };
2736
2736
  let o = t / 2, s = n / 2, c = Math.max(o, s), l = e.zoom ?? 1, u = (t) => {
2737
- let [n, r, o] = yt(a, 0, 0, t);
2737
+ let [n, r, o] = bt(a, 0, 0, t);
2738
2738
  if (i.kind === "perspective") {
2739
2739
  let t = e.fov ?? i.fovDeg, a = Math.max(1, Math.min(179, t)) * Math.PI / 180, s = c / Math.tan(a / 2), u = s - o, d = s / (Math.abs(u) < 1e-6 ? 1e-6 * Math.sign(u || 1) : u);
2740
2740
  return [n * d * l, r * d * l];
@@ -2748,12 +2748,12 @@ function wt(e, t, n, r) {
2748
2748
  }
2749
2749
  //#endregion
2750
2750
  //#region packages/core/src/shape/bevel-shading.ts
2751
- function Tt(e, t) {
2751
+ function Et(e, t) {
2752
2752
  if (t <= 0) return () => 1;
2753
2753
  let n = (e) => Math.max(0, Math.min(1, e / t));
2754
2754
  switch (e) {
2755
2755
  case "hardEdge": {
2756
- let e = Nt;
2756
+ let e = Pt;
2757
2757
  return (t) => {
2758
2758
  let r = Math.min(1, n(t) / e);
2759
2759
  return r * r * (3 - 2 * r);
@@ -2773,7 +2773,7 @@ function Tt(e, t) {
2773
2773
  };
2774
2774
  }
2775
2775
  }
2776
- function Et(e) {
2776
+ function Dt(e) {
2777
2777
  let t = e.length, n = new Float64Array(t);
2778
2778
  if (t === 0) return n;
2779
2779
  let r = new Int32Array(t), i = new Float64Array(t + 1), a = 0;
@@ -2791,7 +2791,7 @@ function Et(e) {
2791
2791
  }
2792
2792
  return n;
2793
2793
  }
2794
- function Dt(e, t = 3) {
2794
+ function Ot(e, t = 3) {
2795
2795
  if (e <= 0) return Array(t).fill(1);
2796
2796
  let n = Math.sqrt(12 * e * e / t + 1), r = Math.floor(n);
2797
2797
  r % 2 == 0 && r--;
@@ -2799,7 +2799,7 @@ function Dt(e, t = 3) {
2799
2799
  for (let e = 0; e < t; e++) s.push(e < o ? r : i);
2800
2800
  return s;
2801
2801
  }
2802
- function Ot(e, t, n, r, i, a) {
2802
+ function kt(e, t, n, r, i, a) {
2803
2803
  let o = 1 / (2 * i + 1);
2804
2804
  if (a) for (let a = 0; a < r; a++) {
2805
2805
  let r = a * n, s = 0;
@@ -2820,29 +2820,29 @@ function Ot(e, t, n, r, i, a) {
2820
2820
  }
2821
2821
  }
2822
2822
  }
2823
- function kt(e, t, n, r) {
2823
+ function At(e, t, n, r) {
2824
2824
  let i = Float64Array.from(e);
2825
2825
  if (r <= 0 || t <= 0 || n <= 0) return i;
2826
2826
  let a = new Float64Array(t * n);
2827
- for (let e of Dt(r, 3)) {
2827
+ for (let e of Ot(r, 3)) {
2828
2828
  let r = Math.max(1, (e - 1) / 2);
2829
- Ot(i, a, t, n, r, !0), Ot(a, i, t, n, r, !1);
2829
+ kt(i, a, t, n, r, !0), kt(a, i, t, n, r, !1);
2830
2830
  }
2831
2831
  return i;
2832
2832
  }
2833
- function At(e, t, n, r = 128) {
2833
+ function jt(e, t, n, r = 128) {
2834
2834
  let i = new Float64Array(t * n);
2835
2835
  for (let a = 0; a < t * n; a++) i[a] = (e[a] ?? 0) >= r ? 0x56bc75e2d63100000 : 0;
2836
2836
  let a = new Float64Array(n);
2837
2837
  for (let e = 0; e < t; e++) {
2838
2838
  for (let r = 0; r < n; r++) a[r] = i[r * t + e];
2839
- let r = Et(a);
2839
+ let r = Dt(a);
2840
2840
  for (let a = 0; a < n; a++) i[a * t + e] = r[a];
2841
2841
  }
2842
2842
  let o = new Float64Array(t);
2843
2843
  for (let e = 0; e < n; e++) {
2844
2844
  for (let n = 0; n < t; n++) o[n] = i[e * t + n];
2845
- let n = Et(o);
2845
+ let n = Dt(o);
2846
2846
  for (let r = 0; r < t; r++) i[e * t + r] = n[r];
2847
2847
  }
2848
2848
  for (let e = 0; e < n; e++) for (let r = 0; r < t; r++) {
@@ -2854,15 +2854,15 @@ function At(e, t, n, r = 128) {
2854
2854
  for (let e = 0; e < t * n; e++) i[e] = Math.sqrt(i[e]);
2855
2855
  return i;
2856
2856
  }
2857
- var jt = .25, Mt = .35, Nt = .5;
2858
- function Pt(e, t, n, r, i, a) {
2857
+ var Mt = .25, Nt = .35, Pt = .5;
2858
+ function Ft(e, t, n, r, i, a) {
2859
2859
  let o = new Float32Array(t * n * 3), s = new Uint8Array(t * n), c = new Float32Array(t * n);
2860
2860
  if (t <= 0 || n <= 0) return {
2861
2861
  normals: o,
2862
2862
  bandMask: s,
2863
2863
  bandWeight: c
2864
2864
  };
2865
- let l = At(e, t, n), u = Tt(i, r), d = (n, r) => (e[r * t + n] ?? 0) >= 128, f = (r > 0 ? a / r : 0) * r, p = kt(l, t, n, Math.max(1, r * jt)), m = (e) => {
2865
+ let l = jt(e, t, n), u = Et(i, r), d = (n, r) => (e[r * t + n] ?? 0) >= 128, f = (r > 0 ? a / r : 0) * r, p = At(l, t, n, Math.max(1, r * Mt)), m = (e) => {
2866
2866
  let t = u(Math.max(0, e - .5));
2867
2867
  return u(e + .5) - t;
2868
2868
  };
@@ -2877,9 +2877,9 @@ function Pt(e, t, n, r, i, a) {
2877
2877
  o[a * 3 + 2] = 1;
2878
2878
  continue;
2879
2879
  }
2880
- let g = u / r, _ = 1 - Mt, v = 1;
2880
+ let g = u / r, _ = 1 - Nt, v = 1;
2881
2881
  if (g > _) {
2882
- let e = Math.min(1, (g - _) / Mt);
2882
+ let e = Math.min(1, (g - _) / Nt);
2883
2883
  v = 1 - e * e * (3 - 2 * e);
2884
2884
  }
2885
2885
  c[a] = v;
@@ -2894,7 +2894,7 @@ function Pt(e, t, n, r, i, a) {
2894
2894
  bandWeight: c
2895
2895
  };
2896
2896
  }
2897
- var Ft = 35 * Math.PI / 180, It = 12 * Math.PI / 180, Lt = {
2897
+ var It = 35 * Math.PI / 180, Lt = 12 * Math.PI / 180, Rt = {
2898
2898
  t: {
2899
2899
  x: 0,
2900
2900
  y: -1
@@ -2928,22 +2928,22 @@ var Ft = 35 * Math.PI / 180, It = 12 * Math.PI / 180, Lt = {
2928
2928
  y: 1
2929
2929
  }
2930
2930
  };
2931
- function Rt(e, t, n) {
2931
+ function zt(e, t, n) {
2932
2932
  let r = n * Math.PI / 180, i = Math.cos(r), a = Math.sin(r);
2933
2933
  return {
2934
2934
  x: e * i - t * a,
2935
2935
  y: e * a + t * i
2936
2936
  };
2937
2937
  }
2938
- function zt(e, t, n) {
2939
- let r = Lt[t] ?? Lt.t;
2940
- return n && n.rev && (r = Rt(r.x, r.y, n.rev)), Vt(r.x, r.y, Ft);
2938
+ function Bt(e, t, n) {
2939
+ let r = Rt[t] ?? Rt.t;
2940
+ return n && n.rev && (r = zt(r.x, r.y, n.rev)), Ht(r.x, r.y, It);
2941
2941
  }
2942
- function Bt(e) {
2942
+ function Vt(e) {
2943
2943
  let t = Math.hypot(e.x, e.y) || 1;
2944
- return Vt(-e.x / t, -e.y / t, It);
2944
+ return Ht(-e.x / t, -e.y / t, Lt);
2945
2945
  }
2946
- function Vt(e, t, n) {
2946
+ function Ht(e, t, n) {
2947
2947
  let r = Math.hypot(e, t) || 1, i = Math.cos(n), a = Math.sin(n), o = e / r * i, s = t / r * i, c = a, l = Math.hypot(o, s, c) || 1;
2948
2948
  return {
2949
2949
  x: o / l,
@@ -2951,7 +2951,7 @@ function Vt(e, t, n) {
2951
2951
  z: c / l
2952
2952
  };
2953
2953
  }
2954
- var Ht = 2, Ut = {
2954
+ var Ut = 2, Wt = {
2955
2955
  matte: {
2956
2956
  ambient: .62,
2957
2957
  diffuse: .45,
@@ -2964,8 +2964,8 @@ var Ht = 2, Ut = {
2964
2964
  specular: .35,
2965
2965
  shininess: 22
2966
2966
  }
2967
- }, Wt = .8;
2968
- function Gt(e) {
2967
+ }, Gt = .8;
2968
+ function Kt(e) {
2969
2969
  switch (e) {
2970
2970
  case "plastic":
2971
2971
  case "metal":
@@ -2976,8 +2976,8 @@ function Gt(e) {
2976
2976
  default: return "matte";
2977
2977
  }
2978
2978
  }
2979
- function Kt(e, t, n = !0) {
2980
- let r = Ut[e], i = {
2979
+ function qt(e, t, n = !0) {
2980
+ let r = Wt[e], i = {
2981
2981
  light: t,
2982
2982
  material: e,
2983
2983
  ambient: r.ambient,
@@ -2985,9 +2985,9 @@ function Kt(e, t, n = !0) {
2985
2985
  specular: r.specular,
2986
2986
  shininess: r.shininess
2987
2987
  };
2988
- return n && (i.fillLight = Bt(t), i.fillDiffuse = i.diffuse * Wt), i;
2988
+ return n && (i.fillLight = Vt(t), i.fillDiffuse = i.diffuse * Gt), i;
2989
2989
  }
2990
- function qt(e, t) {
2990
+ function Jt(e, t) {
2991
2991
  let n = e.x * t.light.x + e.y * t.light.y + e.z * t.light.z, r = t.diffuse * Math.max(0, n), i = 0;
2992
2992
  if (t.fillLight && t.fillDiffuse) {
2993
2993
  let n = e.x * t.fillLight.x + e.y * t.fillLight.y + e.z * t.fillLight.z;
@@ -3000,7 +3000,7 @@ function qt(e, t) {
3000
3000
  }
3001
3001
  return Math.max(0, t.ambient + r + i + a);
3002
3002
  }
3003
- function Jt(e, t, n) {
3003
+ function Yt(e, t, n) {
3004
3004
  if (!e) return {
3005
3005
  x: 0,
3006
3006
  y: 0,
@@ -3015,16 +3015,16 @@ function Jt(e, t, n) {
3015
3015
  h: Math.max(0, o - i)
3016
3016
  };
3017
3017
  }
3018
- function Yt(e, t, n) {
3018
+ function Xt(e, t, n) {
3019
3019
  let r = e.canvas.width, i = e.canvas.height;
3020
3020
  if (r <= 0 || i <= 0) return;
3021
3021
  let a = t.widthPx;
3022
3022
  if (a < .75) return;
3023
- let { x: o, y: s, w: c, h: l } = Jt(n, r, i);
3023
+ let { x: o, y: s, w: c, h: l } = Yt(n, r, i);
3024
3024
  if (c <= 0 || l <= 0) return;
3025
3025
  let u = e.getImageData(o, s, c, l), d = u.data, f = new Uint8ClampedArray(c * l);
3026
3026
  for (let e = 0; e < c * l; e++) f[e] = d[e * 4 + 3];
3027
- let { bandMask: p, bandWeight: m, normals: h } = Pt(f, c, l, a, t.prst, t.heightPx), g = Kt(t.material, t.light), _ = qt({
3027
+ let { bandMask: p, bandWeight: m, normals: h } = Ft(f, c, l, a, t.prst, t.heightPx), g = qt(t.material, t.light), _ = Jt({
3028
3028
  x: 0,
3029
3029
  y: 0,
3030
3030
  z: 1
@@ -3035,13 +3035,13 @@ function Yt(e, t, n) {
3035
3035
  if (n <= 0) continue;
3036
3036
  let r = h[e * 3], i = h[e * 3 + 1], a = h[e * 3 + 2];
3037
3037
  t.bottom && (r = -r, i = -i);
3038
- let o = 1 + (qt({
3038
+ let o = 1 + (Jt({
3039
3039
  x: r,
3040
3040
  y: i,
3041
3041
  z: a
3042
3042
  }, g) / _ - 1) * n, s = e * 4;
3043
3043
  if (o >= 1) {
3044
- let e = Math.min(1, (o - 1) * Ht);
3044
+ let e = Math.min(1, (o - 1) * Ut);
3045
3045
  for (let t = 0; t < 3; t++) {
3046
3046
  let n = Math.min(255, d[s + t] * o);
3047
3047
  d[s + t] = n + (255 - n) * e;
@@ -3050,12 +3050,12 @@ function Yt(e, t, n) {
3050
3050
  }
3051
3051
  e.putImageData(u, o, s);
3052
3052
  }
3053
- function Xt(e, t, n) {
3053
+ function Zt(e, t, n) {
3054
3054
  let r = e.canvas.width, i = e.canvas.height;
3055
3055
  if (r <= 0 || i <= 0) return;
3056
3056
  let a = t.offsetX, o = t.offsetY, s = Math.hypot(a, o);
3057
3057
  if (s < .75) return;
3058
- let { x: c, y: l, w: u, h: d } = Jt(n, r, i);
3058
+ let { x: c, y: l, w: u, h: d } = Yt(n, r, i);
3059
3059
  if (u <= 0 || d <= 0) return;
3060
3060
  let f = e.getImageData(c, l, u, d), p = f.data, m = new Uint8ClampedArray(u * d);
3061
3061
  for (let e = 0; e < u * d; e++) m[e] = p[e * 4 + 3];
@@ -3079,36 +3079,36 @@ function Xt(e, t, n) {
3079
3079
  }
3080
3080
  //#endregion
3081
3081
  //#region packages/core/src/text/underline.ts
3082
- function Zt(t, n, r, i, a, o, s, c = 1) {
3083
- let l = Math.max(1, a * .05), u = s === "heavy" || (s?.endsWith("Heavy") ?? !1) ? l * 1.8 : l, d = r + Math.max(2, u), f = e(d, u, c);
3084
- if (t.strokeStyle = o, t.lineWidth = u, t.setLineDash([]), s && s.startsWith("wavy")) {
3085
- let e = u, r = u * 6;
3086
- t.beginPath(), t.moveTo(n, d);
3087
- let a = Math.max(1, u * .5);
3088
- for (let o = 0; o <= i; o += a) {
3089
- let i = d + Math.sin(o / r * Math.PI * 2) * e;
3090
- t.lineTo(n + o, i);
3082
+ function Qt(e, t, n, r, i, a, o, s = 1) {
3083
+ let c = Math.max(1, i * .05), l = o === "heavy" || (o?.endsWith("Heavy") ?? !1) ? c * 1.8 : c, u = n + Math.max(2, l), d = _(u, l, s);
3084
+ if (e.strokeStyle = a, e.lineWidth = l, e.setLineDash([]), o && o.startsWith("wavy")) {
3085
+ let n = l, i = l * 6;
3086
+ e.beginPath(), e.moveTo(t, u);
3087
+ let a = Math.max(1, l * .5);
3088
+ for (let o = 0; o <= r; o += a) {
3089
+ let r = u + Math.sin(o / i * Math.PI * 2) * n;
3090
+ e.lineTo(t + o, r);
3091
3091
  }
3092
- if (t.stroke(), s === "wavyDbl") {
3093
- t.beginPath(), t.moveTo(n, d + e * 2.5);
3094
- for (let o = 0; o <= i; o += a) {
3095
- let i = d + e * 2.5 + Math.sin(o / r * Math.PI * 2) * e;
3096
- t.lineTo(n + o, i);
3092
+ if (e.stroke(), o === "wavyDbl") {
3093
+ e.beginPath(), e.moveTo(t, u + n * 2.5);
3094
+ for (let o = 0; o <= r; o += a) {
3095
+ let r = u + n * 2.5 + Math.sin(o / i * Math.PI * 2) * n;
3096
+ e.lineTo(t + o, r);
3097
3097
  }
3098
- t.stroke();
3098
+ e.stroke();
3099
3099
  }
3100
3100
  return;
3101
3101
  }
3102
- if (s === "dbl") {
3103
- let r = u * 1.4, a = d - r / 2, o = d + r / 2;
3104
- t.beginPath(), t.moveTo(n, a + e(a, u, c)), t.lineTo(n + i, a + e(a, u, c)), t.moveTo(n, o + e(o, u, c)), t.lineTo(n + i, o + e(o, u, c)), t.stroke();
3102
+ if (o === "dbl") {
3103
+ let n = l * 1.4, i = u - n / 2, a = u + n / 2;
3104
+ e.beginPath(), e.moveTo(t, i + _(i, l, s)), e.lineTo(t + r, i + _(i, l, s)), e.moveTo(t, a + _(a, l, s)), e.lineTo(t + r, a + _(a, l, s)), e.stroke();
3105
3105
  return;
3106
3106
  }
3107
- t.setLineDash(De(s ?? "sng", u)), t.beginPath(), t.moveTo(n, d + f), t.lineTo(n + i, d + f), t.stroke(), t.setLineDash([]);
3107
+ e.setLineDash(Oe(o ?? "sng", l)), e.beginPath(), e.moveTo(t, u + d), e.lineTo(t + r, u + d), e.stroke(), e.setLineDash([]);
3108
3108
  }
3109
3109
  //#endregion
3110
3110
  //#region packages/core/src/text/highlight-box.ts
3111
- function Qt(e, t) {
3111
+ function $t(e, t) {
3112
3112
  return {
3113
3113
  top: e - t * .85,
3114
3114
  height: t * 1.1
@@ -3116,7 +3116,7 @@ function Qt(e, t) {
3116
3116
  }
3117
3117
  //#endregion
3118
3118
  //#region packages/core/src/text/justify-positions.ts
3119
- function $t(e, t, n, r, i = 0) {
3119
+ function en(e, t, n, r, i = 0) {
3120
3120
  let a = [], o = 0, s = 0;
3121
3121
  for (let c of t) a.push({
3122
3122
  text: e.slice(o, c).join(""),
@@ -3129,14 +3129,14 @@ function $t(e, t, n, r, i = 0) {
3129
3129
  }
3130
3130
  //#endregion
3131
3131
  //#region packages/pptx/src/reflection-blur.ts
3132
- var en = .5;
3133
- function tn(e, t) {
3132
+ var tn = .5;
3133
+ function nn(e, t) {
3134
3134
  if (!(t > 0) || !(e.h > 0)) return [{
3135
3135
  y: e.y,
3136
3136
  h: Math.max(0, e.h),
3137
3137
  radius: 0
3138
3138
  }];
3139
- let n = Math.max(4, Math.min(24, Math.ceil(t / en) + 1)), r = e.y + e.h, i = [];
3139
+ let n = Math.max(4, Math.min(24, Math.ceil(t / tn) + 1)), r = e.y + e.h, i = [];
3140
3140
  for (let a = 0; a < n; a++) {
3141
3141
  let o = Math.sqrt(a / (n - 1)), s = a === 0 ? 0 : Math.sqrt((a - 1) / (n - 1)), c = a === n - 1 ? 1 : Math.sqrt((a + 1) / (n - 1)), l = a === 0 ? 0 : (s + o) / 2, u = a === n - 1 ? 1 : (o + c) / 2, d = r - u * e.h;
3142
3142
  i.push({
@@ -3147,20 +3147,20 @@ function tn(e, t) {
3147
3147
  }
3148
3148
  return i;
3149
3149
  }
3150
- function nn(e, t, n, r, i) {
3151
- for (let a of tn(n, r)) e.save(), e.beginPath(), e.rect(0, a.y, i, a.h), e.clip(), e.filter = a.radius > 0 ? `blur(${a.radius}px)` : "none", e.drawImage(t, 0, 0), e.restore();
3150
+ function rn(e, t, n, r, i) {
3151
+ for (let a of nn(n, r)) e.save(), e.beginPath(), e.rect(0, a.y, i, a.h), e.clip(), e.filter = a.radius > 0 ? `blur(${a.radius}px)` : "none", e.drawImage(t, 0, 0), e.restore();
3152
3152
  }
3153
3153
  //#endregion
3154
3154
  //#region packages/pptx/src/hyperlink.ts
3155
- function rn(e, t) {
3155
+ function an(e, t) {
3156
3156
  let n = e !== void 0 && e !== "" ? e : void 0, r = t !== void 0 && t !== "" ? t : void 0;
3157
3157
  if (n === void 0 && r === void 0) return;
3158
3158
  if (r !== void 0) return {
3159
3159
  kind: "internal",
3160
3160
  ref: n ?? r
3161
3161
  };
3162
- let i = n, a = H(i);
3163
- return a !== null && re.includes(a) ? {
3162
+ let i = n, a = G(i);
3163
+ return a !== null && ae.includes(a) ? {
3164
3164
  kind: "external",
3165
3165
  url: i
3166
3166
  } : {
@@ -3170,7 +3170,7 @@ function rn(e, t) {
3170
3170
  }
3171
3171
  //#endregion
3172
3172
  //#region packages/pptx/src/media-chrome.ts
3173
- function an(e, t, n, r, i, a) {
3173
+ function on(e, t, n, r, i, a) {
3174
3174
  let o = Math.max(18, Math.min(32, Math.min(r, i) * .25));
3175
3175
  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") {
3176
3176
  e.beginPath();
@@ -3184,89 +3184,89 @@ function an(e, t, n, r, i, a) {
3184
3184
  }
3185
3185
  //#endregion
3186
3186
  //#region packages/pptx/src/bidi-line.ts
3187
- var on = (e) => {
3187
+ var sn = (e) => {
3188
3188
  let t = e.text;
3189
3189
  return typeof t == "string" ? t : void 0;
3190
- }, sn = (e) => "isTab" in e;
3191
- function cn(e) {
3192
- for (let t of e) {
3193
- let e = on(t);
3194
- if (e !== void 0 && ee(e)) return !0;
3190
+ }, cn = (e) => "isTab" in e;
3191
+ function ln(e) {
3192
+ for (let n of e) {
3193
+ let e = sn(n);
3194
+ if (e !== void 0 && t(e)) return !0;
3195
3195
  }
3196
3196
  return !1;
3197
3197
  }
3198
- function ln(e, n) {
3199
- let r = e.length;
3200
- if (r === 0) return {
3198
+ function un(e, t) {
3199
+ let n = e.length;
3200
+ if (n === 0) return {
3201
3201
  order: [],
3202
3202
  rtl: []
3203
3203
  };
3204
- let i = "", a = Array(r), o;
3205
- for (let t = 0; t < r; t++) {
3206
- a[t] = i.length;
3207
- let n = on(e[t]) ?? "";
3208
- if (i += n.length > 0 ? n : "", sn(e[t])) {
3209
- for (o ??= []; o.length < i.length;) o.push(null);
3210
- o[a[t]] = "S";
3204
+ let r = "", i = Array(n), a;
3205
+ for (let t = 0; t < n; t++) {
3206
+ i[t] = r.length;
3207
+ let n = sn(e[t]) ?? "";
3208
+ if (r += n.length > 0 ? n : "", cn(e[t])) {
3209
+ for (a ??= []; a.length < r.length;) a.push(null);
3210
+ a[i[t]] = "S";
3211
3211
  }
3212
3212
  }
3213
- if (o) for (; o.length < i.length;) o.push(null);
3214
- let { levels: s, paragraphLevel: c } = p().computeLevels(i, n ? "rtl" : "ltr", o), { order: l, segLevels: u } = t(s, c, a), d = Array(r);
3215
- for (let e = 0; e < r; e++) d[e] = (u[e] & 1) == 1;
3213
+ if (a) for (; a.length < r.length;) a.push(null);
3214
+ let { levels: o, paragraphLevel: s } = B().computeLevels(r, t ? "rtl" : "ltr", a), { order: c, segLevels: l } = H(o, s, i), u = Array(n);
3215
+ for (let e = 0; e < n; e++) u[e] = (l[e] & 1) == 1;
3216
3216
  return {
3217
- order: l,
3218
- rtl: d
3217
+ order: c,
3218
+ rtl: u
3219
3219
  };
3220
3220
  }
3221
3221
  //#endregion
3222
3222
  //#region packages/pptx/src/cjk-wrap.ts
3223
- function un(e, t, n, r, i = 0, a = !1) {
3223
+ function dn(e, t, n, r, i = 0, a = !1) {
3224
3224
  if (e.length === 0) return 0;
3225
- let s = t === 0, c = 0, l = t;
3225
+ let o = t === 0, s = 0, l = t;
3226
3226
  for (let t of e) {
3227
- let e = c > 0 || a ? i : 0;
3227
+ let e = s > 0 || a ? i : 0;
3228
3228
  if (l + e + t.w > n) {
3229
- if (c > 0 || !s) break;
3230
- l += e + t.w, c++;
3229
+ if (s > 0 || !o) break;
3230
+ l += e + t.w, s++;
3231
3231
  break;
3232
3232
  }
3233
- l += e + t.w, c++;
3233
+ l += e + t.w, s++;
3234
3234
  }
3235
- return c === 0 ? 0 : c >= e.length ? e.length : o(e.map((e) => e.ch), c, r, +!!s);
3235
+ return s === 0 ? 0 : s >= e.length ? e.length : c(e.map((e) => e.ch), s, r, +!!o);
3236
3236
  }
3237
3237
  //#endregion
3238
3238
  //#region packages/pptx/src/text-justify.ts
3239
- var dn = (e) => /\s/.test(String.fromCodePoint(e));
3240
- function fn(e, t, n, r, i) {
3241
- if (r === "just" && i) return null;
3242
- let a = t - n;
3243
- if (a <= .5) return null;
3244
- let o = Ce(e, a, {
3239
+ var fn = (e) => /\s/.test(String.fromCodePoint(e));
3240
+ function pn(e, t, n, r, a) {
3241
+ if (r === "just" && a) return null;
3242
+ let o = t - n;
3243
+ if (o <= .5) return null;
3244
+ let s = we(e, o, {
3245
3245
  firstContentSi: 0,
3246
3246
  lastDrawnSi: e.length,
3247
- isGapChar: ce,
3248
- isWhitespace: dn,
3247
+ isGapChar: i,
3248
+ isWhitespace: fn,
3249
3249
  seaClusterGaps: r === "thaiDist"
3250
3250
  });
3251
- if (!o) return null;
3252
- let { perGap: s, perSeg: c } = o, l = [];
3251
+ if (!s) return null;
3252
+ let { perGap: c, perSeg: l } = s, u = [];
3253
3253
  for (let t = 0; t < e.length; t++) {
3254
- let n = e[t], r = c.get(t), i = r?.trailingGap ? s : 0, a = r?.splitBefore;
3255
- a && a.length > 0 ? l.push({
3254
+ let n = e[t], r = l.get(t), i = r?.trailingGap ? c : 0, a = r?.splitBefore;
3255
+ a && a.length > 0 ? u.push({
3256
3256
  ...n,
3257
3257
  jext: i,
3258
3258
  splitBefore: [...a],
3259
- perGap: s
3260
- }) : l.push({
3259
+ perGap: c
3260
+ }) : u.push({
3261
3261
  ...n,
3262
3262
  jext: i
3263
3263
  });
3264
3264
  }
3265
- return l;
3265
+ return u;
3266
3266
  }
3267
3267
  //#endregion
3268
3268
  //#region packages/pptx/src/table-border-conflict.ts
3269
- function pn(e) {
3269
+ function mn(e) {
3270
3270
  if (!e) return {
3271
3271
  r: 0,
3272
3272
  g: 0,
@@ -3283,37 +3283,37 @@ function pn(e) {
3283
3283
  b: parseInt(t.slice(4, 6), 16)
3284
3284
  };
3285
3285
  }
3286
- function mn(e) {
3287
- let t = pn(e);
3286
+ function hn(e) {
3287
+ let t = mn(e);
3288
3288
  return .299 * t.r + .587 * t.g + .114 * t.b;
3289
3289
  }
3290
- function hn(e, t) {
3290
+ function gn(e, t) {
3291
3291
  if (!e && !t) return null;
3292
3292
  if (!e) return t;
3293
3293
  if (!t) return e;
3294
3294
  if (e.width !== t.width) return e.width > t.width ? e : t;
3295
- let n = mn(e.color), r = mn(t.color);
3295
+ let n = hn(e.color), r = hn(t.color);
3296
3296
  return n === r || n < r ? e : t;
3297
3297
  }
3298
3298
  //#endregion
3299
3299
  //#region packages/pptx/src/smartart-fallback-contrast.ts
3300
- function gn(e) {
3301
- let t = P(e.length === 8 ? e.slice(0, 6) : e);
3300
+ function _n(e) {
3301
+ let t = ie(e.length === 8 ? e.slice(0, 6) : e);
3302
3302
  if (!t) return null;
3303
- let n = G(t[0], t[1], t[2]);
3303
+ let n = M(t[0], t[1], t[2]);
3304
3304
  if (e.length !== 8) return n;
3305
3305
  let r = Number.parseInt(e.slice(6, 8), 16);
3306
3306
  if (Number.isNaN(r)) return null;
3307
3307
  let i = r / 255;
3308
3308
  return i * n + (1 - i);
3309
3309
  }
3310
- function _n(e) {
3310
+ function vn(e) {
3311
3311
  if (!e) return null;
3312
- if (e.fillType === "solid") return gn(e.color);
3312
+ if (e.fillType === "solid") return _n(e.color);
3313
3313
  if (e.fillType === "gradient") {
3314
3314
  let t = e.stops.map((e) => ({
3315
3315
  p: Math.min(1, Math.max(0, e.position)),
3316
- l: gn(e.color)
3316
+ l: _n(e.color)
3317
3317
  })).filter((e) => e.l !== null).sort((e, t) => e.p - t.p);
3318
3318
  if (t.length === 0) return null;
3319
3319
  let n = t[0], r = t[t.length - 1], i = n.l * n.p + r.l * (1 - r.p);
@@ -3322,18 +3322,18 @@ function _n(e) {
3322
3322
  }
3323
3323
  return null;
3324
3324
  }
3325
- function vn(e) {
3325
+ function yn(e) {
3326
3326
  return e.name === "SmartArt" && e.id === void 0;
3327
3327
  }
3328
- function yn(e, t) {
3329
- let n = _n(e);
3328
+ function bn(e, t) {
3329
+ let n = vn(e);
3330
3330
  if (n === null || n >= .5) return null;
3331
- let r = gn(t.replace(/^#/, ""));
3331
+ let r = _n(t.replace(/^#/, ""));
3332
3332
  return r !== null && r >= .5 ? null : "#FFFFFF";
3333
3333
  }
3334
3334
  //#endregion
3335
3335
  //#region packages/pptx/src/tab-layout.ts
3336
- function bn(e, t, n, r, i, a = 0) {
3336
+ function xn(e, t, n, r, i, a = 0) {
3337
3337
  let o = e.map((e) => e.width), s = (t) => {
3338
3338
  let n = 0;
3339
3339
  for (let r = t; r < e.length && !e[r].isTab; r++) n += o[r];
@@ -3361,8 +3361,8 @@ function bn(e, t, n, r, i, a = 0) {
3361
3361
  }
3362
3362
  //#endregion
3363
3363
  //#region packages/pptx/src/vertical-text.ts
3364
- var xn = () => !1;
3365
- function Sn(e, t, n) {
3364
+ var Sn = () => !1;
3365
+ function Cn(e, t, n) {
3366
3366
  let r = e.textBaseline;
3367
3367
  e.textBaseline = "alphabetic";
3368
3368
  let i = e.measureText(t);
@@ -3370,7 +3370,7 @@ function Sn(e, t, n) {
3370
3370
  let a = i.fontBoundingBoxAscent, o = i.fontBoundingBoxDescent;
3371
3371
  return typeof a == "number" && typeof o == "number" && (a !== 0 || o !== 0) ? (a - o) / 2 : .38 * n;
3372
3372
  }
3373
- function Cn(e, t) {
3373
+ function wn(e, t) {
3374
3374
  let n = e.textAlign, r = e.textBaseline;
3375
3375
  e.textAlign = "center", e.textBaseline = "middle";
3376
3376
  let i = e.measureText(t);
@@ -3378,15 +3378,15 @@ function Cn(e, t) {
3378
3378
  let a = i.actualBoundingBoxAscent, o = i.actualBoundingBoxDescent;
3379
3379
  return typeof a == "number" && typeof o == "number" ? (a - o) / 2 : 0;
3380
3380
  }
3381
- function wn(e, t, n, r, i, a, o = "fill", s = xn) {
3382
- let c = e.textAlign, l = e.textBaseline, u = o === "stroke" ? e.strokeText.bind(e) : e.fillText.bind(e), d = r - Sn(e, t, i), f = 0;
3381
+ function Tn(e, t, n, r, i, a, o = "fill", s = Sn) {
3382
+ let c = e.textAlign, l = e.textBaseline, u = o === "stroke" ? e.strokeText.bind(e) : e.fillText.bind(e), d = r - Cn(e, t, i), f = 0;
3383
3383
  for (let o of t) {
3384
- let t = o.codePointAt(0) ?? 0, l = R(t), p = e.measureText(o).width + a, m = l === "Tr" ? se(t) : null, h = l === "Tr" && m === null && K(t), g = l === "U" || l === "Tu" || m !== null || h;
3385
- if (ne(t) && s(t)) {
3384
+ let t = o.codePointAt(0) ?? 0, l = se(t), p = e.measureText(o).width + a, m = l === "Tr" ? A(t) : null, h = l === "Tr" && m === null && F(t), g = l === "U" || l === "Tu" || m !== null || h;
3385
+ if (N(t) && s(t)) {
3386
3386
  let t = n + f + p / 2;
3387
- e.save(), e.translate(t, d), e.rotate(-Math.PI / 2), e.textAlign = "center", e.textBaseline = "middle", M(e, () => u(o, 0, 0)), e.restore();
3387
+ e.save(), e.translate(t, d), e.rotate(-Math.PI / 2), e.textAlign = "center", e.textBaseline = "middle", K(e, () => u(o, 0, 0)), e.restore();
3388
3388
  } else if (g) {
3389
- let r = m === null && l === "Tu" ? F(t) : null, a = m === null ? r : m, s = a === null ? o : String.fromCodePoint(a), c = n + f + p / 2, h = r === null ? Cn(e, s) / i : 0;
3389
+ let r = m === null && l === "Tu" ? W(t) : null, a = m === null ? r : m, s = a === null ? o : String.fromCodePoint(a), c = n + f + p / 2, h = r === null ? wn(e, s) / i : 0;
3390
3390
  e.save(), e.translate(c, d), e.rotate(-Math.PI / 2), e.textAlign = "center", e.textBaseline = "middle", u(s, 0, h * i), e.restore();
3391
3391
  } else if (l === "Tr") {
3392
3392
  let t = n + f + p / 2;
@@ -3396,25 +3396,25 @@ function wn(e, t, n, r, i, a, o = "fill", s = xn) {
3396
3396
  }
3397
3397
  e.textAlign = c, e.textBaseline = l;
3398
3398
  }
3399
- function Tn(e, t, n, r, i, a, o = "fill") {
3400
- wn(e, t, n, r, i, a, o, (t) => ae(e, t));
3399
+ function En(e, t, n, r, i, a, o = "fill") {
3400
+ Tn(e, t, n, r, i, a, o, (t) => D(e, t));
3401
3401
  }
3402
3402
  //#endregion
3403
3403
  //#region packages/pptx/src/renderer.ts
3404
3404
  function X(e, t) {
3405
3405
  return e * t;
3406
3406
  }
3407
- function En(e, t, n, r) {
3408
- let i = Pe(Math.abs(e * n), Math.abs(t * n), r);
3407
+ function Dn(e, t, n, r) {
3408
+ let i = Fe(Math.abs(e * n), Math.abs(t * n), r);
3409
3409
  return i ? {
3410
3410
  targetWidthPx: i.width,
3411
3411
  targetHeightPx: i.height
3412
3412
  } : void 0;
3413
3413
  }
3414
3414
  function Z(e, t) {
3415
- return Ye(e, t);
3415
+ return Xe(e, t);
3416
3416
  }
3417
- function Dn(e, t) {
3417
+ function On(e, t) {
3418
3418
  let n = e.targets.get(t);
3419
3419
  return n ? {
3420
3420
  targetWidthPx: n.width,
@@ -3422,11 +3422,11 @@ function Dn(e, t) {
3422
3422
  maxRetainedPixels: n.maxRetainedPixels
3423
3423
  } : void 0;
3424
3424
  }
3425
- function On(e) {
3426
- return A(e) ? e.svgImagePath : e.imagePath;
3425
+ function kn(e) {
3426
+ return z(e) ? e.svgImagePath : e.imagePath;
3427
3427
  }
3428
- function kn(e, t, n, r) {
3429
- let i = Qe(t.bullet);
3428
+ function An(e, t, n, r) {
3429
+ let i = $e(t.bullet);
3430
3430
  if (i.type !== "blip") return;
3431
3431
  let a;
3432
3432
  for (let e of t.runs) if (e.type === "text" && e.fontSize != null) {
@@ -3436,18 +3436,18 @@ function kn(e, t, n, r) {
3436
3436
  let o = a ?? t.defFontSize ?? e.defaultFontSize ?? 18, s = i.sizePts == null ? o * ((i.sizePct ?? 100) / 100) : i.sizePts;
3437
3437
  return Math.max(1, s * Y * n * r);
3438
3438
  }
3439
- async function An(e, t, n, r, i, a, o, c, l, u) {
3440
- let d = ue(a), f = [], p = [], m = (e, t, n, r, i, a = 1, o = i) => {
3439
+ async function jn(e, t, n, r, i, a, o, s, c, l) {
3440
+ let u = k(a), d = [], f = [], p = (e, t, n, r, i, a = 1, o = i) => {
3441
3441
  if (!(!t || !i)) {
3442
- if (C(r) && (d.resolution === "display" || d.strategy === "adaptive")) {
3443
- f.push({
3442
+ if (le(r) && (u.resolution === "display" || u.strategy === "adaptive")) {
3443
+ d.push({
3444
3444
  key: e,
3445
3445
  ...t,
3446
3446
  retainedSurfaceCount: a
3447
3447
  });
3448
3448
  return;
3449
3449
  }
3450
- p.push(B(n, r, i, o).then((n) => n.dimensions && s(n.format, u !== void 0) ? {
3450
+ f.push(R(n, r, i, o).then((n) => n.dimensions && x(n.format, l !== void 0) ? {
3451
3451
  key: e,
3452
3452
  ...t,
3453
3453
  sourceWidthPx: n.dimensions.width,
@@ -3455,15 +3455,15 @@ async function An(e, t, n, r, i, a, o, c, l, u) {
3455
3455
  retainedSurfaceCount: a
3456
3456
  } : null).catch(() => null));
3457
3457
  }
3458
- }, h = e.background;
3459
- if (h?.fillType === "image" && h.imagePath && !h.tile && !h.duotone) {
3460
- let e = h.fillRect ?? {}, r = t * (1 - (e.l ?? 0) - (e.r ?? 0)), a = n * (1 - (e.t ?? 0) - (e.b ?? 0));
3461
- m(Z(h.imagePath, h.duotone), En(r, a, i, h.srcRect), h.imagePath, h.mimeType, o, 1);
3458
+ }, m = e.background;
3459
+ if (m?.fillType === "image" && m.imagePath && !m.tile && !m.duotone) {
3460
+ let e = m.fillRect ?? {}, r = t * (1 - (e.l ?? 0) - (e.r ?? 0)), a = n * (1 - (e.t ?? 0) - (e.b ?? 0));
3461
+ p(Z(m.imagePath, m.duotone), Dn(r, a, i, m.srcRect), m.imagePath, m.mimeType, o, 1);
3462
3462
  }
3463
- for (let t of e.elements) if (t.type === "picture") !(A(t) || t.mimeType === "image/svg+xml") && !t.duotone && m(Z(t.imagePath, t.duotone), En(X(t.width, r), X(t.height, r), i, t.srcRect), t.imagePath, t.mimeType, o, 1);
3463
+ for (let t of e.elements) if (t.type === "picture") !(z(t) || t.mimeType === "image/svg+xml") && !t.duotone && p(Z(t.imagePath, t.duotone), Dn(X(t.width, r), X(t.height, r), i, t.srcRect), t.imagePath, t.mimeType, o, 1);
3464
3464
  else if (t.type === "media" && t.posterPath) {
3465
- let e = c ? qr(c) : void 0;
3466
- m(Z(t.posterPath), En(X(t.width, r), X(t.height, r), i), t.posterPath, t.posterMimeType || "application/octet-stream", e, 1, l ?? e);
3465
+ let e = s ? ti(s) : void 0;
3466
+ p(Z(t.posterPath), Dn(X(t.width, r), X(t.height, r), i), t.posterPath, t.posterMimeType || "application/octet-stream", e, 1, c ?? e);
3467
3467
  } else if (t.type === "chart") {
3468
3468
  let e = {
3469
3469
  widthPt: t.width / Y,
@@ -3471,21 +3471,21 @@ async function An(e, t, n, r, i, a, o, c, l, u) {
3471
3471
  targetWidthPx: X(t.width, r) * i,
3472
3472
  targetHeightPx: X(t.height, r) * i
3473
3473
  };
3474
- for (let n of Te(t.chart)) {
3475
- let t = n.fill, r = Ee(n, e);
3476
- !(t.mimeType === "image/svg+xml" || A({
3474
+ for (let n of Ee(t.chart)) {
3475
+ let t = n.fill, r = De(n, e);
3476
+ !(t.mimeType === "image/svg+xml" || z({
3477
3477
  svgImagePath: t.svgImagePath,
3478
3478
  srcRect: n.hasSourceCrop ? !0 : null
3479
- })) && !t.duotone && !n.preserveNaturalSize && r?.targetWidthPx && r.targetHeightPx && m(Z(t.imagePath, t.duotone), {
3479
+ })) && !t.duotone && !n.preserveNaturalSize && r?.targetWidthPx && r.targetHeightPx && p(Z(t.imagePath, t.duotone), {
3480
3480
  targetWidthPx: r.targetWidthPx,
3481
3481
  targetHeightPx: r.targetHeightPx
3482
3482
  }, t.imagePath, t.mimeType, o, 1);
3483
3483
  }
3484
3484
  } else if (t.type === "shape" && t.textBody) for (let e of t.textBody.paragraphs) {
3485
- let n = Qe(e.bullet);
3485
+ let n = $e(e.bullet);
3486
3486
  if (n.type !== "blip") continue;
3487
- let a = kn(t.textBody, e, r, i);
3488
- !a || !o || p.push(B(n.imagePath, n.mimeType, o).then((e) => e.dimensions && e.dimensions.width > 0 && e.dimensions.height > 0 && s(e.format, u !== void 0) ? {
3487
+ let a = An(t.textBody, e, r, i);
3488
+ !a || !o || f.push(R(n.imagePath, n.mimeType, o).then((e) => e.dimensions && e.dimensions.width > 0 && e.dimensions.height > 0 && x(e.format, l !== void 0) ? {
3489
3489
  key: Z(n.imagePath),
3490
3490
  targetWidthPx: a * e.dimensions.width / e.dimensions.height,
3491
3491
  targetHeightPx: a,
@@ -3493,27 +3493,27 @@ async function An(e, t, n, r, i, a, o, c, l, u) {
3493
3493
  sourceHeightPx: e.dimensions.height
3494
3494
  } : null).catch(() => null));
3495
3495
  }
3496
- return f.push(...(await Promise.all(p)).filter((e) => e !== null)), S(f, d);
3496
+ return d.push(...(await Promise.all(f)).filter((e) => e !== null)), de(d, u);
3497
3497
  }
3498
- function jn(e) {
3499
- return e.background?.fillType === "image" ? !0 : e.elements.some((e) => e.type === "picture" ? !0 : e.type === "media" ? !!e.posterPath : e.type === "chart" ? Te(e.chart).length > 0 : e.type === "shape" && !!e.textBody?.paragraphs.some((e) => Qe(e.bullet).type === "blip"));
3498
+ function Mn(e) {
3499
+ return e.background?.fillType === "image" ? !0 : e.elements.some((e) => e.type === "picture" ? !0 : e.type === "media" ? !!e.posterPath : e.type === "chart" ? Ee(e.chart).length > 0 : e.type === "shape" && !!e.textBody?.paragraphs.some((e) => $e(e.bullet).type === "blip"));
3500
3500
  }
3501
- var Q = Oe;
3502
- function Mn(e, t, n, r, i, a, o) {
3503
- let { top: s, height: c } = Qt(n, i);
3501
+ var Q = ke;
3502
+ function Nn(e, t, n, r, i, a, o) {
3503
+ let { top: s, height: c } = $t(n, i);
3504
3504
  e.fillStyle = a, e.fillRect(t, s, r, c), e.fillStyle = o;
3505
3505
  }
3506
- function Nn(e, t, n, r, i, a, o = 0) {
3507
- return Fe(e, t, n, r, i, a, o);
3506
+ function Pn(e, t, n, r, i, a, o = 0) {
3507
+ return Ie(e, t, n, r, i, a, o);
3508
3508
  }
3509
- var Pn = /* @__PURE__ */ new WeakMap();
3510
- function Fn(e, t) {
3509
+ var Fn = /* @__PURE__ */ new WeakMap();
3510
+ function In(e, t) {
3511
3511
  let n = e.tinted.get(t);
3512
3512
  if (n) return n;
3513
- let r = ie(e.raster, t);
3513
+ let r = te(e.raster, t);
3514
3514
  return e.tinted.set(t, r), r;
3515
3515
  }
3516
- function In(e) {
3516
+ function Ln(e) {
3517
3517
  let t = [], n = (e) => {
3518
3518
  if (e) for (let n of e.paragraphs) for (let e of n.runs) e.type === "math" && t.push({
3519
3519
  nodes: e.nodes,
@@ -3524,13 +3524,13 @@ function In(e) {
3524
3524
  else if (t.type === "table") for (let e of t.rows) for (let t of e.cells) n(t.textBody);
3525
3525
  return t;
3526
3526
  }
3527
- async function Ln(e, t) {
3528
- let n = In(e);
3527
+ async function Rn(e, t) {
3528
+ let n = Ln(e);
3529
3529
  if (n.length !== 0) {
3530
3530
  await t.loadMathJax();
3531
- for (let e of n) if (!Pn.has(e.nodes)) try {
3532
- let n = await t.mathMLToSvg(U(e.nodes, e.display)), r = await te(n, "#000000");
3533
- Pn.set(e.nodes, {
3531
+ for (let e of n) if (!Fn.has(e.nodes)) try {
3532
+ let n = await t.mathMLToSvg(re(e.nodes, e.display)), r = await oe(n, "#000000");
3533
+ Fn.set(e.nodes, {
3534
3534
  raster: r,
3535
3535
  widthEm: n.widthEm,
3536
3536
  ascentEm: n.ascentEm,
@@ -3540,14 +3540,14 @@ async function Ln(e, t) {
3540
3540
  } catch {}
3541
3541
  }
3542
3542
  }
3543
- function Rn(e, t) {
3543
+ function zn(e, t) {
3544
3544
  let n = (e) => t.embeddedFontAliases?.get(e.trim().toLowerCase()) ?? e;
3545
3545
  if (!e) return n(t.themeMinorFont ?? "sans-serif");
3546
3546
  if (e.startsWith("+")) return n(e === "+mj-lt" || e === "+mj-ea" || e === "+mj-cs" ? t.themeMajorFont ?? "sans-serif" : t.themeMinorFont ?? "sans-serif");
3547
3547
  let r = e.split(",")[0].trim();
3548
3548
  return r ? n(r) : t.themeMinorFont ?? "sans-serif";
3549
3549
  }
3550
- var zn = new Set([
3550
+ var Bn = new Set([
3551
3551
  "serif",
3552
3552
  "sans-serif",
3553
3553
  "monospace",
@@ -3555,11 +3555,11 @@ var zn = new Set([
3555
3555
  "fantasy",
3556
3556
  "system-ui"
3557
3557
  ]);
3558
- function Bn(e) {
3559
- let t = l(e);
3558
+ function Vn(e) {
3559
+ let t = S(e);
3560
3560
  return t === "mono" ? "monospace" : t === "serif" ? "serif" : "sans-serif";
3561
3561
  }
3562
- var Vn = {
3562
+ var Hn = {
3563
3563
  calibri: "Carlito",
3564
3564
  "calibri light": "Carlito",
3565
3565
  cambria: "Caladea",
@@ -3571,38 +3571,38 @@ var Vn = {
3571
3571
  "simplified arabic": "Noto Naskh Arabic",
3572
3572
  "arabic typesetting": "Noto Naskh Arabic",
3573
3573
  "univers next arabic": "Noto Sans Arabic"
3574
- }, Hn = "\"Noto Naskh Arabic\", \"Noto Sans Arabic\"";
3575
- function Un(e) {
3576
- if (Vn[e.toLowerCase()]?.includes("Arabic")) return !0;
3574
+ }, Un = "\"Noto Naskh Arabic\", \"Noto Sans Arabic\"";
3575
+ function Wn(e) {
3576
+ if (Hn[e.toLowerCase()]?.includes("Arabic")) return !0;
3577
3577
  let t = e.toLowerCase();
3578
3578
  return /arabic|naskh|kufi|nastaliq|amiri|scheherazade|lateef|aldhabi|urdu|farsi|العرب|[؀-ۿ]/.test(t);
3579
3579
  }
3580
- function Wn(e) {
3580
+ function Gn(e) {
3581
3581
  return e.map((e) => `"${e}"`).join(", ");
3582
3582
  }
3583
- function Gn(e, t = e) {
3584
- let n = Bn(t), i = Vn[t.toLowerCase()], a = i ? `"${i}", ` : "";
3585
- if (Un(t)) return `"${e}", ${a}${Hn}, ${n}`;
3586
- let o = n === "serif" ? "serif" : "sans", s = w(t);
3587
- return `"${e}", ${a}${s ? `${Wn(r(s, o))}, ` : ""}${`${Wn(o === "serif" ? f : u)}, `}${n}`;
3583
+ function Kn(e, t = e) {
3584
+ let n = Vn(t), i = Hn[t.toLowerCase()], a = i ? `"${i}", ` : "", o = u(t), s = o ? `"${o}", ` : "";
3585
+ if (Wn(t)) return `"${e}", ${a}${Un}, ${n}`;
3586
+ let c = n === "serif" ? "serif" : "sans", f = r(t), p = f ? pe(f, c).filter((e) => e !== o) : [];
3587
+ return `"${e}", ${a}${s}${p.length > 0 ? `${Gn(p)}, ` : ""}${`${Gn(c === "serif" ? d : l)}, `}${n}`;
3588
3588
  }
3589
- function Kn(e) {
3589
+ function qn(e) {
3590
3590
  return e ? e.kind === "external" ? `e:${e.url}` : `i:${e.ref}` : "";
3591
3591
  }
3592
- function qn(e) {
3592
+ function Jn(e) {
3593
3593
  let t = e.toLowerCase();
3594
3594
  return /\b(thin|hairline)\b/.test(t) ? 100 : /\b(extra[- ]?light|ultra[- ]?light)\b/.test(t) ? 200 : /\blight\b/.test(t) ? 300 : /\b(black|heavy)\b/.test(t) ? 900 : /\b(extra[- ]?bold|ultra[- ]?bold)\b/.test(t) ? 800 : /\b(semi[- ]?bold|demi[- ]?bold)\b/.test(t) ? 600 : /\bbold\b/.test(t) ? 700 : /\bmedium\b/.test(t) ? 600 : null;
3595
3595
  }
3596
- function Jn(e, t, n, r, i, a, o, s) {
3597
- let c = Math.max(0, r.blur * i), l = Math.ceil(c * 3) + 2, u = Math.max(0, Math.floor(n.x - l)), d = Math.max(0, Math.floor(n.y - l)), f = Math.min(o, Math.ceil(n.x + n.w + l)), p = Math.min(s, Math.ceil(n.y + n.h + l)), m = Math.max(1, f - u), h = Math.max(1, p - d), g = Ae(m, h), _ = g?.getContext("2d");
3596
+ function Yn(e, t, n, r, i, a, o, s) {
3597
+ let c = Math.max(0, r.blur * i), l = Math.ceil(c * 3) + 2, u = Math.max(0, Math.floor(n.x - l)), d = Math.max(0, Math.floor(n.y - l)), f = Math.min(o, Math.ceil(n.x + n.w + l)), p = Math.min(s, Math.ceil(n.y + n.h + l)), m = Math.max(1, f - u), h = Math.max(1, p - d), g = je(m, h), _ = g?.getContext("2d");
3598
3598
  if (!g || !_) return;
3599
3599
  _.save(), _.setTransform(a.a, a.b, a.c, a.d, a.e - u, a.f - d), t(_), _.restore();
3600
3600
  let v = n.y - d, y = v + n.h, b = g, x = _;
3601
3601
  if (c > 0) {
3602
- let e = Ae(m, h), t = e?.getContext("2d");
3602
+ let e = je(m, h), t = e?.getContext("2d");
3603
3603
  e && t && (b = e, x = t);
3604
3604
  }
3605
- b !== g && nn(x, g, {
3605
+ b !== g && rn(x, g, {
3606
3606
  x: n.x - u,
3607
3607
  y: v,
3608
3608
  w: n.w,
@@ -3629,14 +3629,14 @@ function Jn(e, t, n, r, i, a, o, s) {
3629
3629
  let T = r.dist * i, E = r.dir * Math.PI / 180, D = n.y + n.h;
3630
3630
  e.save(), e.setTransform(1, 0, 0, 1, 0, 0), e.translate(n.x + Math.cos(E) * T, D + Math.sin(E) * T), e.scale(r.sx, r.sy), e.translate(-n.x, -D), e.drawImage(b, u, d), e.restore();
3631
3631
  }
3632
- function Yn(e, t, n, r, i) {
3633
- let a = t ? "italic " : "", o = Rn(r, i), s = i.embeddedFontAuthoredFamilies?.get(o) ?? o, c = qn(s), l = e ? "bold " : c ? `${c} ` : "";
3634
- return zn.has(o) ? `${a}${l}${n}px ${o}` : `${a}${l}${n}px ${Gn(o, s)}`;
3632
+ function Xn(e, t, n, r, i) {
3633
+ let a = t ? "italic " : "", o = zn(r, i), s = i.embeddedFontAuthoredFamilies?.get(o) ?? o, c = Jn(s), l = e ? "bold " : c ? `${c} ` : "";
3634
+ return Bn.has(o) ? `${a}${l}${n}px ${o}` : `${a}${l}${n}px ${Kn(o, s)}`;
3635
3635
  }
3636
- function Xn(e) {
3637
- return e.bullet.type === "char" || e.bullet.type === "autoNum" || Qe(e.bullet).type === "blip";
3636
+ function Zn(e) {
3637
+ return e.bullet.type === "char" || e.bullet.type === "autoNum" || $e(e.bullet).type === "blip";
3638
3638
  }
3639
- function Zn(e, t, n) {
3639
+ function Qn(e, t, n) {
3640
3640
  let r = null;
3641
3641
  for (let e of t.runs) if (e.type === "text" && e.fontSize != null) {
3642
3642
  r = e.fontSize;
@@ -3645,41 +3645,77 @@ function Zn(e, t, n) {
3645
3645
  let i = r ?? t.defFontSize ?? e.defaultFontSize ?? 18;
3646
3646
  return n.sizePts == null ? i * ((n.sizePct ?? 100) / 100) : n.sizePts;
3647
3647
  }
3648
- function Qn(e, t) {
3648
+ function $n(e, t) {
3649
3649
  return e ? 0 : Math.max(0, t);
3650
3650
  }
3651
- function $n(e, t) {
3651
+ var er = /^\p{Script_Extensions=Latin}$/u, tr = /^\p{L}$/u, nr = /^[\u0000-\u007f]*$/u;
3652
+ function rr(e, t, n) {
3653
+ let r = t.codePointAt(0);
3654
+ if (r <= 127 && r !== 45 || tr.test(t)) return !1;
3655
+ let i = y(r);
3656
+ return i !== "HY" && i !== "HH" ? !1 : er.test(e) && er.test(n);
3657
+ }
3658
+ function ir(e) {
3659
+ if (!e.includes("-") && nr.test(e)) return [{
3660
+ text: e,
3661
+ breakBefore: !1
3662
+ }];
3663
+ let t = [...e], n = [], r = 0;
3664
+ for (let e = 1; e + 1 < t.length; e++) {
3665
+ if (!rr(t[e - 1], t[e], t[e + 1])) continue;
3666
+ let i = e + 1;
3667
+ n.push({
3668
+ text: t.slice(r, i).join(""),
3669
+ breakBefore: n.length > 0
3670
+ }), r = i;
3671
+ }
3672
+ return n.push({
3673
+ text: t.slice(r).join(""),
3674
+ breakBefore: n.length > 0
3675
+ }), n;
3676
+ }
3677
+ function ar(e) {
3678
+ let t = [];
3679
+ for (let n = e.segments.length - 1; n >= 0 && t.length < 2; n--) {
3680
+ let r = e.segments[n];
3681
+ if (r.isTab || r.math) continue;
3682
+ let i = [...r.text];
3683
+ for (let e = i.length - 1; e >= 0 && t.length < 2; e--) t.unshift(i[e]);
3684
+ }
3685
+ return t;
3686
+ }
3687
+ function or(e, t) {
3652
3688
  return t != null && t !== 0 ? e * .65 : e;
3653
3689
  }
3654
- function er(e, t, n, r, i, a, o) {
3690
+ function sr(e, t, n, r, i, a, o) {
3655
3691
  let s = (t.defaultFontSize ?? 18) * Y * a;
3656
3692
  for (let c of t.paragraphs) {
3657
- let l = X(c.marL, a), u = X(c.marR, a), d = X(c.indent, a), f = Qn(Xn(c), d), p = n - r - i - l - u - f, m = 0;
3693
+ let l = X(c.marL, a), u = X(c.marR, a), d = X(c.indent, a), f = $n(Zn(c), d), p = n - r - i - l - u - f, m = 0;
3658
3694
  for (let n of c.runs) {
3659
3695
  if (n.type !== "text") continue;
3660
- let r = n.fontSize == null ? c.defFontSize == null ? s : c.defFontSize * Y * a : n.fontSize * Y * a, i = Rn(n.fontFamily ?? c.defFontFamily ?? null, o);
3661
- e.font = Yn(n.bold ?? c.defBold ?? t.defaultBold ?? !1, n.italic ?? c.defItalic ?? t.defaultItalic ?? !1, $n(r, n.baseline ?? void 0), i, o);
3696
+ let r = n.fontSize == null ? c.defFontSize == null ? s : c.defFontSize * Y * a : n.fontSize * Y * a, i = zn(n.fontFamily ?? c.defFontFamily ?? null, o);
3697
+ e.font = Xn(n.bold ?? c.defBold ?? t.defaultBold ?? !1, n.italic ?? c.defItalic ?? t.defaultItalic ?? !1, or(r, n.baseline ?? void 0), i, o);
3662
3698
  let l = (n.letterSpacing ?? 0) * Y * a;
3663
3699
  if (m += $(e, n.text, l), m > p) return !0;
3664
3700
  }
3665
3701
  }
3666
3702
  return !1;
3667
3703
  }
3668
- function tr(e) {
3669
- for (let t of e) if (ce(t.codePointAt(0) ?? 0)) return !0;
3704
+ function cr(e) {
3705
+ for (let t of e) if (i(t.codePointAt(0) ?? 0)) return !0;
3670
3706
  return !1;
3671
3707
  }
3672
- function nr(e) {
3708
+ function lr(e) {
3673
3709
  let t = 0;
3674
3710
  for (let n of e) t++;
3675
3711
  return t;
3676
3712
  }
3677
- var rr = /* @__PURE__ */ new WeakMap();
3678
- function ir(e) {
3679
- let t = rr.get(e);
3713
+ var ur = /* @__PURE__ */ new WeakMap();
3714
+ function dr(e) {
3715
+ let t = ur.get(e);
3680
3716
  if (t != null) return t;
3681
3717
  let n = e, r = n.letterSpacing;
3682
- if (typeof r != "string") return rr.set(e, !1), !1;
3718
+ if (typeof r != "string") return ur.set(e, !1), !1;
3683
3719
  let i = !1;
3684
3720
  try {
3685
3721
  n.letterSpacing = "0px";
@@ -3694,11 +3730,11 @@ function ir(e) {
3694
3730
  n.letterSpacing = r;
3695
3731
  } catch {}
3696
3732
  }
3697
- return rr.set(e, i), i;
3733
+ return ur.set(e, i), i;
3698
3734
  }
3699
3735
  function $(e, t, n) {
3700
3736
  let r = e, i = r.letterSpacing;
3701
- if (n !== 0 && ir(e)) try {
3737
+ if (n !== 0 && dr(e)) try {
3702
3738
  r.letterSpacing = `${n}px`;
3703
3739
  let i = e.measureText(t).width;
3704
3740
  if (Number.isFinite(i)) return t.length > 0 ? i - n : i;
@@ -3707,30 +3743,30 @@ function $(e, t, n) {
3707
3743
  r.letterSpacing = i;
3708
3744
  } catch {}
3709
3745
  }
3710
- let a = Math.max(0, nr(t) - 1);
3746
+ let a = Math.max(0, lr(t) - 1);
3711
3747
  return e.measureText(t).width + n * a;
3712
3748
  }
3713
- function ar(e, t, n, r, a, o, s, c = !1, l = !1, u = 1, d, f = {
3749
+ function fr(e, t, n, r, a, s, c, l = !1, u = !1, d = 1, f, p = {
3714
3750
  themeMajorFont: null,
3715
3751
  themeMinorFont: null,
3716
3752
  dpr: 1
3717
- }, p = 0) {
3718
- let m = [], h = /* @__PURE__ */ new Map(), g = !0;
3719
- for (let e = t.runs.length - 1; e >= 0 && g; e--) {
3753
+ }, m = 0) {
3754
+ let h = [], g = /* @__PURE__ */ new Map(), _ = !0;
3755
+ for (let e = t.runs.length - 1; e >= 0 && _; e--) {
3720
3756
  let n = t.runs[e];
3721
3757
  if (n.type === "break") continue;
3722
3758
  if (n.type === "math") break;
3723
3759
  let r = n.text.replace(/ +$/u, "");
3724
- r !== n.text && h.set(n, r), (r.length > 0 || n.fieldType != null) && (g = !1);
3760
+ r !== n.text && g.set(n, r), (r.length > 0 || n.fieldType != null) && (_ = !1);
3725
3761
  }
3726
- let v = () => n - (m.length === 0 ? p : 0), y = { segments: [] }, b = 0, S = !1, C = t.rtl === !0, w = X(t.marR, o), T = (t.tabStops ?? []).map((e) => ({
3727
- pos: X(e.pos, o),
3762
+ let v = () => n - (h.length === 0 ? m : 0), y = { segments: [] }, b = 0, x = !1, S = t.rtl === !0, C = X(t.marR, s), w = (t.tabStops ?? []).map((e) => ({
3763
+ pos: X(e.pos, s),
3728
3764
  algn: e.algn
3729
- })), E = X(t.defTabSz ?? 914400, o), D = !1, k = [], A = 0, j = () => C ? w : s + (m.length === 0 ? p : 0), M = (e = 0) => {
3730
- let t = bn(e > 0 ? [...k, {
3765
+ })), T = X(t.defTabSz ?? 914400, s), D = !1, k = [], A = 0, j = () => S ? C : c + (h.length === 0 ? m : 0), M = (e = 0) => {
3766
+ let t = xn(e > 0 ? [...k, {
3731
3767
  isTab: !1,
3732
3768
  width: e
3733
- }] : k, T, j(), Infinity, A, E), n = 0;
3769
+ }] : k, w, j(), Infinity, A, T), n = 0;
3734
3770
  for (let e of t) n += e;
3735
3771
  return n;
3736
3772
  }, N = (e) => {
@@ -3748,27 +3784,26 @@ function ar(e, t, n, r, a, o, s, c = !1, l = !1, u = 1, d, f = {
3748
3784
  }
3749
3785
  return t;
3750
3786
  }, F = (e = !1) => {
3751
- e && (y.endsWithBreak = !0), m.push(y), y = { segments: [] }, b = 0, D = !1, k = [], S = !1;
3787
+ e && (y.endsWithBreak = !0), h.push(y), y = { segments: [] }, b = 0, D = !1, k = [], x = !1;
3752
3788
  }, I = (t, n, r, i) => {
3753
3789
  e.font = n;
3754
3790
  let a = $(e, t, r), o = y.segments.at(-1);
3755
3791
  return !o || o.isTab || o.math || o.sourceRunId !== i ? a : o.font === n && (o.letterSpacingPx ?? 0) === r ? $(e, o.text + t, r) - $(e, o.text, r) : a + r;
3756
- }, L = (t, n, r, i, a, o, s, c) => {
3792
+ }, R = (t, n, r, i, a, o, s, c) => {
3757
3793
  if (!t) return;
3758
3794
  e.font = n;
3759
- let l = c?.letterSpacingPx ?? 0, u = c?.sourceRunId, d = c?.strikeDouble, f = c?.underlineStyle, p = c?.underlineColor, m = c?.shadow, h = c?.reflection, g = c?.outline, _ = c?.highlight, v = c?.fontFamily, x = c?.hyperlink, S = c?.drawSizePx ?? r, C = (e) => !e.math && !e.isTab && e.font === n && e.color === i && e.underline === a && (e.underlineStyle ?? "") === (f ?? "") && (e.underlineColor ?? "") === (p ?? "") && e.strikethrough === o && (e.strikeDouble ?? !1) === (d ?? !1) && (e.letterSpacingPx ?? 0) === l && e.baseline === s && e.shadow === m && e.reflection === h && e.outline === g && (e.highlight ?? "") === (_ ?? "") && (e.fontFamily ?? "") === (v ?? "") && (e.drawSizePx ?? e.sizePx) === S && Kn(e.hyperlink) === Kn(x) && (l === 0 || e.sourceRunId === u), w = y.segments.at(-1), T = $(e, t, l);
3760
- if (w && C(w) ? T = $(e, w.text + t, l) - $(e, w.text, l) : w && !w.isTab && !w.math && u != null && w.sourceRunId === u && (T += l), b += T, k.push({
3795
+ let l = c?.letterSpacingPx ?? 0, u = c?.sourceRunId, d = c?.strikeDouble, f = c?.underlineStyle, p = c?.underlineColor, m = c?.shadow, h = c?.reflection, g = c?.outline, _ = c?.highlight, v = c?.hyperlink, x = c?.drawSizePx ?? r, S = (e) => !e.math && !e.isTab && e.font === n && e.color === i && e.underline === a && (e.underlineStyle ?? "") === (f ?? "") && (e.underlineColor ?? "") === (p ?? "") && e.strikethrough === o && (e.strikeDouble ?? !1) === (d ?? !1) && (e.letterSpacingPx ?? 0) === l && e.baseline === s && e.shadow === m && e.reflection === h && e.outline === g && (e.highlight ?? "") === (_ ?? "") && (e.drawSizePx ?? e.sizePx) === x && qn(e.hyperlink) === qn(v) && (l === 0 || e.sourceRunId === u), C = y.segments.at(-1), w = $(e, t, l);
3796
+ if (C && S(C) ? w = $(e, C.text + t, l) - $(e, C.text, l) : C && !C.isTab && !C.math && u != null && C.sourceRunId === u && (w += l), b += w, k.push({
3761
3797
  isTab: !1,
3762
- width: T
3763
- }), w && C(w)) w.text += t;
3798
+ width: w
3799
+ }), C && S(C)) C.text += t;
3764
3800
  else {
3765
- let e = w && !w.isTab && !w.math && u != null && w.sourceRunId === u ? l : 0;
3801
+ let e = C && !C.isTab && !C.math && u != null && C.sourceRunId === u ? l : 0;
3766
3802
  y.segments.push({
3767
3803
  text: t,
3768
3804
  font: n,
3769
- fontFamily: v,
3770
3805
  sizePx: r,
3771
- drawSizePx: S,
3806
+ drawSizePx: x,
3772
3807
  color: i,
3773
3808
  underline: a,
3774
3809
  underlineStyle: f,
@@ -3783,17 +3818,17 @@ function ar(e, t, n, r, a, o, s, c = !1, l = !1, u = 1, d, f = {
3783
3818
  reflection: h,
3784
3819
  outline: g,
3785
3820
  highlight: _,
3786
- hyperlink: x
3821
+ hyperlink: v
3787
3822
  });
3788
3823
  }
3789
- }, R = () => {
3824
+ }, z = () => {
3790
3825
  let e = y.segments.at(-1);
3791
3826
  if (!e || e.math) return !1;
3792
3827
  let t = /^(.*\s)(\S+)$/s.exec(e.text), n;
3793
3828
  if (t) e.text = t[1], n = t[2];
3794
3829
  else if (y.segments.length > 1) y.segments.pop(), n = e.text;
3795
3830
  else return !1;
3796
- return F(), L(n, e.font, e.sizePx, e.color, e.underline, e.strikethrough, e.baseline, {
3831
+ return F(), R(n, e.font, e.sizePx, e.color, e.underline, e.strikethrough, e.baseline, {
3797
3832
  strikeDouble: e.strikeDouble,
3798
3833
  letterSpacingPx: e.letterSpacingPx,
3799
3834
  underlineStyle: e.underlineStyle,
@@ -3802,68 +3837,72 @@ function ar(e, t, n, r, a, o, s, c = !1, l = !1, u = 1, d, f = {
3802
3837
  reflection: e.reflection,
3803
3838
  outline: e.outline,
3804
3839
  highlight: e.highlight,
3805
- fontFamily: e.fontFamily,
3806
3840
  sourceRunId: e.sourceRunId,
3807
3841
  drawSizePx: e.drawSizePx
3808
3842
  }), !0;
3809
3843
  };
3810
- for (let [n, s] of t.runs.entries()) {
3811
- if (s.type === "break") {
3844
+ for (let [c, m] of t.runs.entries()) {
3845
+ if (m.type === "break") {
3812
3846
  F(!0);
3813
3847
  continue;
3814
3848
  }
3815
- if (s.type === "math") {
3816
- let e = Pn.get(s.nodes), t = s.fontSize == null ? r : s.fontSize * Y * o * u, n = e ? e.widthEm * t : 0, i = e ? e.ascentEm * t : 0, c = e ? e.descentEm * t : 0;
3817
- (s.display && b > 0 || !N(n) && b > 0) && F(), k.push({
3849
+ if (m.type === "math") {
3850
+ let e = Fn.get(m.nodes), t = m.fontSize == null ? r : m.fontSize * Y * s * d, n = e ? e.widthEm * t : 0, i = e ? e.ascentEm * t : 0, o = e ? e.descentEm * t : 0;
3851
+ (m.display && b > 0 || !N(n) && b > 0) && F(), k.push({
3818
3852
  isTab: !1,
3819
3853
  width: n
3820
3854
  }), y.segments.push({
3821
3855
  text: "",
3822
3856
  font: `${t}px sans-serif`,
3823
3857
  sizePx: t,
3824
- color: s.color ? Q(s.color) : a,
3858
+ color: m.color ? Q(m.color) : a,
3825
3859
  underline: !1,
3826
3860
  strikethrough: !1,
3827
3861
  math: {
3828
- nodes: s.nodes,
3829
- display: s.display,
3862
+ nodes: m.nodes,
3863
+ display: m.display,
3830
3864
  width: n,
3831
3865
  ascent: i,
3832
- descent: c
3866
+ descent: o
3833
3867
  }
3834
- }), b += n, s.display && F();
3868
+ }), b += n, m.display && F();
3835
3869
  continue;
3836
3870
  }
3837
- let p = s.fontSize == null ? r : s.fontSize * Y * o * u, m = $n(p, s.baseline ?? void 0), g = Rn(s.fontFamily ?? t.defFontFamily ?? null, f), C = s.fontFamilyEa ? Rn(s.fontFamilyEa, f) : null, w = s.fontFamilySym ? Rn(s.fontFamilySym, f) : null, T;
3838
- T = s.color ? Q(s.color) : s.hyperlink && f.themeHlinkColor ? Q(f.themeHlinkColor) : a;
3839
- let E = s.bold ?? t.defBold ?? c, j = s.italic ?? t.defItalic ?? l, M = Yn(E, j, m, g, f), B = C ? Yn(E, j, m, C, f) : M;
3840
- e.font = M;
3841
- let H = s.caps, U = h.get(s) ?? s.text;
3871
+ let h = m.fontSize == null ? r : m.fontSize * Y * s * d, _ = or(h, m.baseline ?? void 0), S = zn(m.fontFamily ?? t.defFontFamily ?? null, p), C = m.fontFamilyEa ? zn(m.fontFamilyEa, p) : null, w = m.fontFamilySym ? zn(m.fontFamilySym, p) : null, T;
3872
+ T = m.color ? Q(m.color) : m.hyperlink && p.themeHlinkColor ? Q(p.themeHlinkColor) : a;
3873
+ let j = m.bold ?? t.defBold ?? l, M = m.italic ?? t.defItalic ?? u, B = Xn(j, M, _, S, p), V = C ? Xn(j, M, _, C, p) : B;
3874
+ e.font = B;
3875
+ let H = m.caps, U = g.get(m) ?? m.text;
3842
3876
  (H === "all" || H === "small") && (U = U.toUpperCase());
3843
- let ee = s.fieldType === "slidenum" && d !== void 0 ? String(d) : U, W = s.underline || s.hyperlink !== void 0, G = s.strikeDouble === !0, K = s.letterSpacing == null ? 0 : s.letterSpacing * Y * o, q = {
3844
- strikeDouble: G,
3877
+ let W = m.fieldType === "slidenum" && f !== void 0 ? String(f) : U, G = m.underline || m.hyperlink !== void 0, te = m.strikeDouble === !0, K = m.letterSpacing == null ? 0 : m.letterSpacing * Y * s, J = {
3878
+ strikeDouble: te,
3845
3879
  letterSpacingPx: K,
3846
- underlineStyle: s.underlineStyle,
3847
- underlineColor: s.underlineColor ? Q(s.underlineColor) : void 0,
3848
- shadow: s.shadow,
3849
- reflection: s.reflection,
3850
- outline: s.outline,
3851
- fontFamily: g,
3852
- highlight: s.highlight ? Q(s.highlight) : void 0,
3853
- hyperlink: rn(s.hyperlink),
3854
- sourceRunId: n,
3855
- drawSizePx: m
3856
- }, J = ee.split(/(\s+)/);
3857
- for (let r of J) {
3880
+ underlineStyle: m.underlineStyle,
3881
+ underlineColor: m.underlineColor ? Q(m.underlineColor) : void 0,
3882
+ shadow: m.shadow,
3883
+ reflection: m.reflection,
3884
+ outline: m.outline,
3885
+ highlight: m.highlight ? Q(m.highlight) : void 0,
3886
+ hyperlink: an(m.hyperlink),
3887
+ sourceRunId: c,
3888
+ drawSizePx: _
3889
+ }, ne = W.split(/(\s+)/).flatMap((e) => e ? /^\s+$/u.test(e) ? [{
3890
+ text: e,
3891
+ breakBefore: !1
3892
+ }] : Number.isFinite(n) ? ir(e) : [{
3893
+ text: e,
3894
+ breakBefore: !1
3895
+ }] : []);
3896
+ for (let n of ne) {
3897
+ let r = n.text;
3858
3898
  if (!r) continue;
3859
3899
  if (/^\t+$/.test(r)) {
3860
- D || (e.font = M, A = e.measureText(" ").width);
3900
+ D || (e.font = B, A = e.measureText(" ").width);
3861
3901
  for (let e of r) y.segments.push({
3862
3902
  text: "",
3863
3903
  isTab: !0,
3864
- font: M,
3865
- fontFamily: g,
3866
- sizePx: p,
3904
+ font: B,
3905
+ sizePx: h,
3867
3906
  color: T,
3868
3907
  underline: !1,
3869
3908
  strikethrough: !1
@@ -3874,122 +3913,131 @@ function ar(e, t, n, r, a, o, s, c = !1, l = !1, u = 1, d, f = {
3874
3913
  D = !0;
3875
3914
  continue;
3876
3915
  }
3877
- e.font = M;
3878
- let a = I(r, M, K, n), o = /^\s+$/.test(r), c = /[-]/;
3879
- if (c.test(r) && (w != null || ge(g))) {
3880
- let t = w ?? g;
3881
- for (let i of r) {
3882
- let r = i, a = M;
3883
- if (c.test(i)) {
3884
- let e = be(i, t);
3885
- e === i ? a = Yn(E, j, m, t, f) : (r = e, a = Yn(E, j, m, "sans-serif", f));
3916
+ e.font = B;
3917
+ let a = I(r, B, K, c), s = /^\s+$/.test(r), l = /[-]/;
3918
+ if (l.test(r) && (w != null || _e(S))) {
3919
+ let t = w ?? S;
3920
+ for (let n of r) {
3921
+ let r = n, i = B;
3922
+ if (l.test(n)) {
3923
+ let e = xe(n, t);
3924
+ e === n ? i = Xn(j, M, _, t, p) : (r = e, i = Xn(j, M, _, "sans-serif", p));
3886
3925
  }
3887
- e.font = a, !N(I(r, a, K, n)) && b > 0 && F(), L(r, a, p, T, W, s.strikethrough, s.baseline ?? void 0, q);
3926
+ e.font = i, !N(I(r, i, K, c)) && b > 0 && F(), R(r, i, h, T, G, m.strikethrough, m.baseline ?? void 0, J);
3888
3927
  }
3889
3928
  continue;
3890
3929
  }
3891
- if (tr(r) && (!V(r) || t.eaLnBrk === !1)) {
3892
- let i = [];
3930
+ if (cr(r) && (!q(r) || t.eaLnBrk === !1)) {
3931
+ let n = [], a = "", s = () => {
3932
+ a !== "" && (e.font = B, n.push({
3933
+ ch: a,
3934
+ w: $(e, a, K),
3935
+ font: B
3936
+ }), a = "");
3937
+ };
3893
3938
  for (let t of r) {
3894
- let n = ce(t.codePointAt(0) ?? 0) && C != null, r = n ? B : M, a = n ? C : g;
3895
- e.font = r, i.push({
3939
+ if (!i(t.codePointAt(0) ?? 0)) {
3940
+ a += t;
3941
+ continue;
3942
+ }
3943
+ s();
3944
+ let r = C == null ? B : V;
3945
+ e.font = r, n.push({
3896
3946
  ch: t,
3897
3947
  w: $(e, t, 0),
3898
- font: r,
3899
- family: a
3948
+ font: r
3900
3949
  });
3901
3950
  }
3902
- if (t.eaLnBrk === !1) {
3903
- let e = y.segments.at(-1), t = !!e && !e.isTab && !e.math && e.sourceRunId === n, r = i.reduce((e, t) => e + t.w, 0) + Math.max(0, i.length - 1) * K + (t && i.length > 0 ? K : 0);
3951
+ if (s(), t.eaLnBrk === !1) {
3952
+ let e = y.segments.at(-1), t = !!e && !e.isTab && !e.math && e.sourceRunId === c, r = n.reduce((e, t) => e + t.w, 0) + Math.max(0, n.length - 1) * K + (t && n.length > 0 ? K : 0);
3904
3953
  b > 0 && !N(r) && F();
3905
- for (let e of i) L(e.ch, e.font, p, T, W, s.strikethrough, s.baseline ?? void 0, {
3906
- ...q,
3907
- fontFamily: e.family
3908
- });
3954
+ for (let e of n) R(e.ch, e.font, h, T, G, m.strikethrough, m.baseline ?? void 0, J);
3909
3955
  continue;
3910
3956
  }
3911
- let a = i;
3912
- for (; a.length > 0;) {
3913
- let e = Number.isFinite(v()) ? v() - P() : b, t = y.segments.at(-1), r = !!t && !t.isTab && !t.math && t.sourceRunId === n, i = un(a, e, v(), _, K, r);
3914
- if (i === 0) {
3957
+ let l = n;
3958
+ for (; l.length > 0;) {
3959
+ let e = Number.isFinite(v()) ? v() - P() : b, t = y.segments.at(-1), n = !!t && !t.isTab && !t.math && t.sourceRunId === c, r = dn(l, e, v(), o, K, n);
3960
+ if (r === 0) {
3915
3961
  if (b > 0) {
3916
3962
  F();
3917
3963
  continue;
3918
3964
  }
3919
- i = 1;
3965
+ r = 1;
3920
3966
  }
3921
- for (let e = 0; e < i; e++) {
3922
- let t = a[e];
3923
- L(t.ch, t.font, p, T, W, s.strikethrough, s.baseline ?? void 0, {
3924
- ...q,
3925
- fontFamily: t.family
3926
- });
3967
+ for (let e = 0; e < r; e++) {
3968
+ let t = l[e];
3969
+ R(t.ch, t.font, h, T, G, m.strikethrough, m.baseline ?? void 0, J);
3927
3970
  }
3928
- a = a.slice(i), a.length > 0 && F();
3971
+ l = l.slice(r), l.length > 0 && F();
3929
3972
  }
3930
3973
  continue;
3931
3974
  }
3932
- if (V(r)) {
3933
- let t = x(r, {
3975
+ if (q(r)) {
3976
+ let t = O(r, {
3934
3977
  cjk: !0,
3935
- kinsoku: _
3936
- }), i = C != null && B !== M, a = (e) => i && ce(e.codePointAt(0) ?? 0), o = (t) => {
3937
- let r = 0, i = y.segments.at(-1), o = !!i && !i.isTab && !i.math && i.sourceRunId === n, s = "", c = null, l = () => {
3938
- s !== "" && (e.font = c ? B : M, r += $(e, s, K), o && (r += K), o = !0, s = "");
3978
+ kinsoku: o
3979
+ }), n = C != null && V !== B, a = (e) => n && i(e.codePointAt(0) ?? 0), s = (t) => {
3980
+ let n = 0, r = y.segments.at(-1), i = !!r && !r.isTab && !r.math && r.sourceRunId === c, o = "", s = null, l = () => {
3981
+ o !== "" && (e.font = s ? V : B, n += $(e, o, K), i && (n += K), i = !0, o = "");
3939
3982
  };
3940
3983
  for (let e of t) {
3941
3984
  let t = a(e);
3942
- c === null || t === c ? (s += e, c = t) : (l(), s = e, c = t);
3985
+ s === null || t === s ? (o += e, s = t) : (l(), o = e, s = t);
3943
3986
  }
3944
- return l(), r;
3945
- }, c = (e) => {
3987
+ return l(), n;
3988
+ }, l = (e) => {
3946
3989
  let t = "", n = null, r = () => {
3947
- if (t === "") return;
3948
- let e = n ? B : M, r = n ? C : g;
3949
- L(t, e, p, T, W, s.strikethrough, s.baseline ?? void 0, {
3950
- ...q,
3951
- fontFamily: r
3952
- }), t = "";
3990
+ t !== "" && (R(t, n ? V : B, h, T, G, m.strikethrough, m.baseline ?? void 0, J), t = "");
3953
3991
  };
3954
3992
  for (let i of e) {
3955
3993
  let e = a(i);
3956
3994
  n === null || e === n ? (t += i, n = e) : (r(), t = i, n = e);
3957
3995
  }
3958
3996
  r();
3959
- }, l = de(r), u = r.length, d = 0;
3960
- for (; d < u;) {
3961
- let e = P(), n = z(r, t, d, e, o, l);
3962
- if (n <= d) {
3997
+ }, u = E(r), d = r.length, f = 0;
3998
+ for (; f < d;) {
3999
+ let e = P(), n = ee(r, t, f, e, s, u);
4000
+ if (n <= f) {
3963
4001
  if (b > 0) {
3964
4002
  F();
3965
4003
  continue;
3966
4004
  }
3967
- let i = t.find((e) => e > d) ?? u, a = r.slice(d, i), s = O(a), c = z(a, s, 0, e, o, l);
3968
- c <= 0 && (c = s.length > 0 ? s[0] : a.length), n = d + c;
4005
+ let i = t.find((e) => e > f) ?? d, a = r.slice(f, i), o = L(a), c = ee(a, o, 0, e, s, u);
4006
+ c <= 0 && (c = o.length > 0 ? o[0] : a.length), n = f + c;
3969
4007
  }
3970
- c(r.slice(d, n)), d = n, d < u && F();
4008
+ l(r.slice(f, n)), f = n, f < d && F();
3971
4009
  }
3972
4010
  continue;
3973
4011
  }
3974
- if (N(a)) L(r, M, p, T, W, s.strikethrough, s.baseline ?? void 0, q), o && (S = !0);
3975
- else if (o) b > 0 && F();
4012
+ if (!N(a) && (b > 0 || D)) {
4013
+ let e = n.breakBefore;
4014
+ if (!e) {
4015
+ let t = ar(y), n = [...r][0];
4016
+ e = t.length === 2 && n !== void 0 && rr(t[0], t[1], n);
4017
+ }
4018
+ e && (F(), a = I(r, B, K, c));
4019
+ }
4020
+ if (N(a)) R(r, B, h, T, G, m.strikethrough, m.baseline ?? void 0, J), s && (x = !0);
4021
+ else if (s) b > 0 && F();
3976
4022
  else if (a > v()) {
3977
4023
  b > 0 && F();
3978
- for (let t of r) e.font = M, !N(I(t, M, K, n)) && b > 0 && F(), L(t, M, p, T, W, s.strikethrough, s.baseline ?? void 0, q);
3979
- } else if (!S) L(r, M, p, T, W, s.strikethrough, s.baseline ?? void 0, q);
3980
- else {
3981
- let e = y.segments.at(-1)?.text ?? "", t = r.codePointAt(0), n = [...e].at(-1)?.codePointAt(0), a = /\S$/u.test(e) && /^\S/u.test(r) && n !== 8203 && t !== 8203, o = t !== void 0 && _.lineStartForbidden.has(t) && a, c = n !== void 0 && t !== void 0 && a && !V(e) && !V(r) && i(n, t);
3982
- (o || c) && R() || F(), L(r, M, p, T, W, s.strikethrough, s.baseline ?? void 0, q);
4024
+ for (let t of r) e.font = B, !N(I(t, B, K, c)) && b > 0 && F(), R(t, B, h, T, G, m.strikethrough, m.baseline ?? void 0, J);
4025
+ } else if (x) {
4026
+ let e = y.segments.at(-1)?.text ?? "", t = r.codePointAt(0), n = [...e].at(-1)?.codePointAt(0), i = /\S$/u.test(e) && /^\S/u.test(r) && n !== 8203 && t !== 8203, a = t !== void 0 && o.lineStartForbidden.has(t) && i, s = n !== void 0 && t !== void 0 && i && !q(e) && !q(r) && ue(n, t);
4027
+ (a || s) && z() || F(), R(r, B, h, T, G, m.strikethrough, m.baseline ?? void 0, J);
4028
+ } else {
4029
+ let e = [...y.segments.at(-1)?.text ?? ""].at(-1)?.codePointAt(0), t = r.codePointAt(0);
4030
+ e !== void 0 && t !== void 0 && i(e) !== i(t) && !ue(e, t) && b > 0 && F(), R(r, B, h, T, G, m.strikethrough, m.baseline ?? void 0, J);
3983
4031
  }
3984
4032
  }
3985
4033
  }
3986
- return m.push(y), m;
4034
+ return h.push(y), h;
3987
4035
  }
3988
- async function or(e, t, n, r, i, o, s, c, l, u) {
4036
+ async function pr(e, t, n, r, i, o, s, c, l, u) {
3989
4037
  if (t && t.fillType === "image") {
3990
4038
  if (e.fillStyle = "#FFFFFF", e.fillRect(0, 0, n, r), !t.imagePath || !t.mimeType || !s) return;
3991
4039
  try {
3992
- let a = t.fillRect ?? {}, d = a.l ?? 0, f = a.t ?? 0, p = a.r ?? 0, m = a.b ?? 0, h = d * n, g = f * r, _ = n * (1 - d - p), v = r * (1 - f - m), y = u && !t.duotone ? Dn(u, Z(t.imagePath, t.duotone)) : void 0, b = t.tile ? await B(t.imagePath, t.mimeType, s) : void 0, x = await Je(t.imagePath, t.mimeType, t.duotone, s, {
4040
+ let a = t.fillRect ?? {}, d = a.l ?? 0, f = a.t ?? 0, p = a.r ?? 0, m = a.b ?? 0, h = d * n, g = f * r, _ = n * (1 - d - p), v = r * (1 - f - m), y = u && !t.duotone ? On(u, Z(t.imagePath, t.duotone)) : void 0, b = t.tile ? await R(t.imagePath, t.mimeType, s) : void 0, x = await Ye(t.imagePath, t.mimeType, t.duotone, s, {
3993
4041
  widthPt: n / i / Y,
3994
4042
  heightPt: r / i / Y,
3995
4043
  ...y ?? {},
@@ -3997,10 +4045,10 @@ async function or(e, t, n, r, i, o, s, c, l, u) {
3997
4045
  svgDecoder: l
3998
4046
  });
3999
4047
  if (o() || !x) return;
4000
- e.save(), e.beginPath(), e.rect(0, 0, n, r), e.clip(), t.alpha != null && (e.globalAlpha = t.alpha), t.tile ? ur(e, x, t.tile, n, r, i, t.srcRect, b?.dimensions ?? void 0) : je(e, x, t.srcRect, h, g, _, v), e.restore();
4048
+ e.save(), e.beginPath(), e.rect(0, 0, n, r), e.clip(), t.alpha != null && (e.globalAlpha = t.alpha), t.tile ? _r(e, x, t.tile, n, r, i, t.srcRect, b?.dimensions ?? void 0) : Me(e, x, t.srcRect, h, g, _, v), e.restore();
4001
4049
  } catch (t) {
4002
- if (a(t, "tiff")) {
4003
- le(e, "tiff", {
4050
+ if (b(t, "tiff")) {
4051
+ a(e, "tiff", {
4004
4052
  x: 0,
4005
4053
  y: 0,
4006
4054
  width: n,
@@ -4008,14 +4056,14 @@ async function or(e, t, n, r, i, o, s, c, l, u) {
4008
4056
  });
4009
4057
  return;
4010
4058
  }
4011
- if (Le(t) || qe(t)) throw t;
4059
+ if (Re(t) || Je(t)) throw t;
4012
4060
  }
4013
4061
  return;
4014
4062
  }
4015
- e.fillStyle = Nn(t, e, 0, 0, n, r) ?? "#FFFFFF", e.fillRect(0, 0, n, r);
4063
+ e.fillStyle = Pn(t, e, 0, 0, n, r) ?? "#FFFFFF", e.fillRect(0, 0, n, r);
4016
4064
  }
4017
- var sr = 9525;
4018
- function cr(e, t, n, r, i) {
4065
+ var mr = 9525;
4066
+ function hr(e, t, n, r, i) {
4019
4067
  let a;
4020
4068
  a = e === "t" || e === "ctr" || e === "b" ? (t - r) / 2 : e === "tr" || e === "r" || e === "br" ? t - r : 0;
4021
4069
  let o;
@@ -4024,52 +4072,52 @@ function cr(e, t, n, r, i) {
4024
4072
  ay: o
4025
4073
  };
4026
4074
  }
4027
- function lr(e, t, n) {
4075
+ function gr(e, t, n) {
4028
4076
  return {
4029
4077
  width: e * (n ? 1 - n.l - n.r : 1),
4030
4078
  height: t * (n ? 1 - n.t - n.b : 1)
4031
4079
  };
4032
4080
  }
4033
- function ur(e, t, n, r, i, a, o, s) {
4034
- let c = lr(s?.width ?? t.width, s?.height ?? t.height, o), l = c.width * sr * (n.sx ?? 1) * a, u = c.height * sr * (n.sy ?? 1) * a;
4081
+ function _r(e, t, n, r, i, a, o, s) {
4082
+ let c = gr(s?.width ?? t.width, s?.height ?? t.height, o), l = c.width * mr * (n.sx ?? 1) * a, u = c.height * mr * (n.sy ?? 1) * a;
4035
4083
  if (!(l > 0) || !(u > 0)) return;
4036
- let d = n.flip === "x" || n.flip === "xy", f = n.flip === "y" || n.flip === "xy", p = Ae(l * (d ? 2 : 1), u * (f ? 2 : 1));
4084
+ let d = n.flip === "x" || n.flip === "xy", f = n.flip === "y" || n.flip === "xy", p = je(l * (d ? 2 : 1), u * (f ? 2 : 1));
4037
4085
  if (!p) return;
4038
4086
  let m = p.getContext("2d");
4039
4087
  if (!m) return;
4040
4088
  let h = (e, n, r, i) => {
4041
- m.save(), m.translate(e + (r ? l : 0), n + (i ? u : 0)), m.scale(r ? -1 : 1, i ? -1 : 1), je(m, t, o, 0, 0, l, u), m.restore();
4089
+ m.save(), m.translate(e + (r ? l : 0), n + (i ? u : 0)), m.scale(r ? -1 : 1, i ? -1 : 1), Me(m, t, o, 0, 0, l, u), m.restore();
4042
4090
  };
4043
4091
  h(0, 0, !1, !1), d && h(l, 0, !0, !1), f && h(0, u, !1, !0), d && f && h(l, u, !0, !0);
4044
4092
  let g = e.createPattern(p, "repeat");
4045
4093
  if (!g) return;
4046
- let { ax: _, ay: v } = cr(n.algn ?? "tl", r, i, l, u), y = _ + X(n.tx ?? 0, a), b = v + X(n.ty ?? 0, a);
4094
+ let { ax: _, ay: v } = hr(n.algn ?? "tl", r, i, l, u), y = _ + X(n.tx ?? 0, a), b = v + X(n.ty ?? 0, a);
4047
4095
  typeof g.setTransform == "function" && typeof DOMMatrix < "u" ? (g.setTransform(new DOMMatrix().translateSelf(y, b)), e.fillStyle = g, e.fillRect(0, 0, r, i)) : (e.save(), e.translate(y, b), e.fillStyle = g, e.fillRect(-y, -b, r, i), e.restore());
4048
4096
  }
4049
- function dr(e, t, n) {
4097
+ function vr(e, t, n) {
4050
4098
  if (!t) return;
4051
4099
  let r = t.dir * Math.PI / 180, i = X(t.dist, n);
4052
4100
  e.shadowColor = Q(t.color, t.alpha), e.shadowBlur = 0, e.shadowOffsetX = Math.cos(r) * i, e.shadowOffsetY = Math.sin(r) * i;
4053
4101
  }
4054
- function fr(e, t, n) {
4102
+ function yr(e, t, n) {
4055
4103
  t && (e.shadowColor = Q(t.color, t.alpha), e.shadowBlur = X(t.radius, n), e.shadowOffsetX = 0, e.shadowOffsetY = 0);
4056
4104
  }
4057
- function pr(e) {
4105
+ function br(e) {
4058
4106
  e.shadowColor = "transparent", e.shadowBlur = 0, e.shadowOffsetX = 0, e.shadowOffsetY = 0;
4059
4107
  }
4060
- var mr = 8, hr = 1, gr = 1, _r = 256;
4061
- function vr(e, t, n, r, i, a, o, s, c, l, u, d, f, p, m) {
4108
+ var xr = 8, Sr = 1, Cr = 1, wr = 256;
4109
+ function Tr(e, t, n, r, i, a, o, s, c, l, u, d, f, p, m) {
4062
4110
  if (r <= 0) return;
4063
- let h = e.measureText(t), g = h.actualBoundingBoxAscent > 0 ? h.actualBoundingBoxAscent : r, _ = h.actualBoundingBoxDescent > 0 ? h.actualBoundingBoxDescent : r * .25, v = h.actualBoundingBoxLeft > 0 ? h.actualBoundingBoxLeft : 0, y = h.actualBoundingBoxRight > 0 ? h.actualBoundingBoxRight : r, b = r * l * i, x = Math.min(_r, Math.max(1, Math.round(b / mr))), S = (e) => xr(e, a, r, o, s, c, u, d), C = S(x), w = Cr(C, a, o, s, c, u, d, l, i, -g, _);
4064
- for (; w > gr && x < _r;) {
4065
- let e = Math.min(_r, x * 2), t = S(e), n = Cr(t, a, o, s, c, u, d, l, i, -g, _);
4111
+ let h = e.measureText(t), g = h.actualBoundingBoxAscent > 0 ? h.actualBoundingBoxAscent : r, _ = h.actualBoundingBoxDescent > 0 ? h.actualBoundingBoxDescent : r * .25, v = h.actualBoundingBoxLeft > 0 ? h.actualBoundingBoxLeft : 0, y = h.actualBoundingBoxRight > 0 ? h.actualBoundingBoxRight : r, b = r * l * i, x = Math.min(wr, Math.max(1, Math.round(b / xr))), S = (e) => Or(e, a, r, o, s, c, u, d), C = S(x), w = Ar(C, a, o, s, c, u, d, l, i, -g, _);
4112
+ for (; w > Cr && x < wr;) {
4113
+ let e = Math.min(wr, x * 2), t = S(e), n = Ar(t, a, o, s, c, u, d, l, i, -g, _);
4066
4114
  if (n >= w * .75) {
4067
4115
  C = t;
4068
4116
  break;
4069
4117
  }
4070
4118
  x = e, C = t, w = n;
4071
4119
  }
4072
- let T = 1e4, E = hr / (l * i), D = C.length - 1, O = (e, t, n) => e === 0 ? -T : t - n - E, k = (e, t, n) => e === D ? T : t - n + E, A = (e, r) => {
4120
+ let T = 1e4, E = Sr / (l * i), D = C.length - 1, O = (e, t, n) => e === 0 ? -T : t - n - E, k = (e, t, n) => e === D ? T : t - n + E, A = (e, r) => {
4073
4121
  e.fillStyle = r;
4074
4122
  for (let r = 0; r <= D; r++) {
4075
4123
  let { s0: i, s1: a, g: o } = C[r], s = (i + a) / 2;
@@ -4077,7 +4125,7 @@ function vr(e, t, n, r, i, a, o, s, c, l, u, d, f, p, m) {
4077
4125
  let c = O(r, i, s), u = k(r, a, s);
4078
4126
  e.rect(c, -T, u - c, 2 * T), e.clip(), e.fillText(t, -s + n / 2, 0), e.restore();
4079
4127
  }
4080
- }, j = yr(m), M = typeof e.globalAlpha == "number" ? e.globalAlpha : 1;
4128
+ }, j = Er(m), M = typeof e.globalAlpha == "number" ? e.globalAlpha : 1;
4081
4129
  if (j >= 1 && M >= 1) {
4082
4130
  A(e, m);
4083
4131
  return;
@@ -4097,110 +4145,119 @@ function vr(e, t, n, r, i, a, o, s, c, l, u, d, f, p, m) {
4097
4145
  [s, _],
4098
4146
  [c, _]
4099
4147
  ]) {
4100
- let n = Sr(i, l, e, t), r = f + n.x, a = p + n.y, o = N.a * r + N.c * a + N.e, s = N.b * r + N.d * a + N.f;
4148
+ let n = kr(i, l, e, t), r = f + n.x, a = p + n.y, o = N.a * r + N.c * a + N.e, s = N.b * r + N.d * a + N.f;
4101
4149
  o < P && (P = o), o > I && (I = o), s < F && (F = s), s > L && (L = s);
4102
4150
  }
4103
4151
  }
4104
4152
  if (!(I > P && L > F)) return;
4105
- let R = Math.floor(P - 2), z = Math.floor(F - 2), B = Ae(Math.ceil(I + 2) - R, Math.ceil(L + 2) - z), V = B ? B.getContext("2d") : null;
4153
+ let R = Math.floor(P - 2), z = Math.floor(F - 2), B = je(Math.ceil(I + 2) - R, Math.ceil(L + 2) - z), V = B ? B.getContext("2d") : null;
4106
4154
  if (!B || !V) {
4107
4155
  A(e, m);
4108
4156
  return;
4109
4157
  }
4110
- V.font = e.font, V.textAlign = "left", V.textBaseline = "alphabetic", V.setTransform(N.a, N.b, N.c, N.d, N.e - R, N.f - z), A(V, br(m)), e.save(), e.setTransform(1, 0, 0, 1, 0, 0), e.globalAlpha = M * j, e.drawImage(B, R, z), e.restore();
4158
+ V.font = e.font, V.textAlign = "left", V.textBaseline = "alphabetic", V.setTransform(N.a, N.b, N.c, N.d, N.e - R, N.f - z), A(V, Dr(m)), e.save(), e.setTransform(1, 0, 0, 1, 0, 0), e.globalAlpha = M * j, e.drawImage(B, R, z), e.restore();
4111
4159
  }
4112
- function yr(e) {
4160
+ function Er(e) {
4113
4161
  let t = /^rgba?\(\s*[\d.]+\s*,\s*[\d.]+\s*,\s*[\d.]+\s*,\s*([\d.]+)\s*\)$/i.exec(e);
4114
4162
  if (!t) return 1;
4115
4163
  let n = parseFloat(t[1]);
4116
4164
  return Number.isFinite(n) ? Math.min(1, Math.max(0, n)) : 1;
4117
4165
  }
4118
- function br(e) {
4166
+ function Dr(e) {
4119
4167
  let t = /^rgba?\(\s*([\d.]+)\s*,\s*([\d.]+)\s*,\s*([\d.]+)/i.exec(e);
4120
4168
  return t ? `rgb(${t[1]}, ${t[2]}, ${t[3]})` : e;
4121
4169
  }
4122
- function xr(e, t, n, r, i, a, o, s) {
4170
+ function Or(e, t, n, r, i, a, o, s) {
4123
4171
  let c = Array(e);
4124
4172
  for (let l = 0; l < e; l++) {
4125
4173
  let u = l / e * n, d = (l + 1) / e * n;
4126
4174
  c[l] = {
4127
4175
  s0: u,
4128
4176
  s1: d,
4129
- g: ft(t, (r + (u + d) / 2) / i * a, o, s)
4177
+ g: pt(t, (r + (u + d) / 2) / i * a, o, s)
4130
4178
  };
4131
4179
  }
4132
4180
  return c;
4133
4181
  }
4134
- function Sr(e, t, n, r) {
4182
+ function kr(e, t, n, r) {
4135
4183
  let i = n * t, a = r * e.vScale, o = i + e.shear * a, s = Math.cos(e.angle), c = Math.sin(e.angle);
4136
4184
  return {
4137
4185
  x: e.x + s * o - c * a,
4138
4186
  y: e.y + c * o + s * a
4139
4187
  };
4140
4188
  }
4141
- function Cr(e, t, n, r, i, a, o, s, c, l, u) {
4189
+ function Ar(e, t, n, r, i, a, o, s, c, l, u) {
4142
4190
  let d = 0;
4143
4191
  for (let f of e) {
4144
4192
  let e = (f.s0 + f.s1) / 2;
4145
4193
  for (let p of [f.s0, f.s1]) {
4146
- let m = ft(t, (n + p) / r * i, a, o);
4194
+ let m = pt(t, (n + p) / r * i, a, o);
4147
4195
  for (let t of [l, u]) {
4148
- let n = Sr(m, s, 0, t), r = Sr(f.g, s, p - e, t), i = Math.hypot(r.x - n.x, r.y - n.y) * c;
4196
+ let n = kr(m, s, 0, t), r = kr(f.g, s, p - e, t), i = Math.hypot(r.x - n.x, r.y - n.y) * c;
4149
4197
  i > d && (d = i);
4150
4198
  }
4151
4199
  }
4152
4200
  }
4153
4201
  return d;
4154
4202
  }
4155
- function wr(e, t, n, r, i, a, o, s, c, l, u) {
4156
- let d = i, f = a, p = Math.max(1, o), m = Math.max(1, s), h = ct(n, r, p, m);
4203
+ function jr(e, t, n, r, i, a, o, s, c, l, u) {
4204
+ let d = i, f = a, p = Math.max(1, o), m = Math.max(1, s), h = lt(n, r, p, m);
4157
4205
  if (!h) return;
4158
- let g = t.defaultBold ?? !1, _ = t.defaultItalic ?? !1, v = (t.defaultFontSize ?? 18) * Y * c, y = [];
4206
+ let g = t.defaultBold ?? !1, _ = t.defaultItalic ?? !1, v = (t.defaultFontSize ?? 18) * Y * c, y = [], b = 0;
4159
4207
  for (let n of t.paragraphs) {
4160
- let t = ar(e, n, Infinity, n.defFontSize == null ? v : n.defFontSize * Y * c, n.defColor ? Q(n.defColor) : l, c, 0, g, _, 1, void 0, u, 0);
4161
- for (let e of t) y.push(e);
4208
+ let t = n.defFontSize == null ? v : n.defFontSize * Y * c, r = fr(e, n, Infinity, t, n.defColor ? Q(n.defColor) : l, c, 0, g, _, 1, void 0, u, 0);
4209
+ y.length > 0 && (b += (n.spaceBefore ?? 0) / 100 * Y * c);
4210
+ for (let e of r) {
4211
+ let r = e.segments.reduce((e, t) => Math.max(e, t.sizePx), 0) || t, i = n.spaceLine?.type === "pts" ? n.spaceLine.val * Y * c : r * 1.2 * (n.spaceLine ? n.spaceLine.val / 1e5 : 1);
4212
+ y.push({
4213
+ line: e,
4214
+ alignment: n.alignment,
4215
+ baseline: b + i * .8
4216
+ }), b += i;
4217
+ }
4218
+ b += (n.spaceAfter ?? 0) / 100 * Y * c;
4162
4219
  }
4163
4220
  if (y.length === 0) return;
4164
4221
  e.save(), e.textAlign = "left", e.textBaseline = "alphabetic";
4165
- let b = -1, x = () => {
4166
- if (b >= 0) return b;
4222
+ let x = -1, S = () => {
4223
+ if (x >= 0) return x;
4167
4224
  let t = typeof e.getTransform == "function" ? e.getTransform() : null, n = t ? Math.abs(t.a * t.d - t.b * t.c) : 1;
4168
- return b = n > 0 ? Math.sqrt(n) : 1, b;
4169
- }, S = y.length;
4170
- for (let t = 0; t < S; t++) {
4171
- let n = y[t], r = t / S, i = (t + 1) / S, a = 0, o = 0, s = 0, c = 0;
4172
- for (let t of n.segments) {
4225
+ return x = n > 0 ? Math.sqrt(n) : 1, x;
4226
+ }, C = y.length, w = h.top[0], T = h.top[1], E = w && T ? (w.x - p / 2) * (T.y - m / 2) - (w.y - m / 2) * (T.x - p / 2) > 0 : !0, D = y[E ? C - 1 : 0].baseline;
4227
+ for (let t = 0; t < C; t++) {
4228
+ let { line: i, alignment: a } = y[t], o = t / C, s = (t + 1) / C, c = 0, l = 0, u = 0, g = 0;
4229
+ for (let t of i.segments) {
4173
4230
  if (t.math) {
4174
- a += t.math.width, o = Math.max(o, t.sizePx), s = Math.max(s, t.math.ascent), c = Math.max(c, t.math.descent);
4231
+ c += t.math.width, l = Math.max(l, t.sizePx), u = Math.max(u, t.math.ascent), g = Math.max(g, t.math.descent);
4175
4232
  continue;
4176
4233
  }
4177
4234
  e.font = t.font;
4178
4235
  let n = t.letterSpacingPx ?? 0, r = e.measureText(t.text);
4179
- a += r.width + n * nr(t.text), o = Math.max(o, t.sizePx), r.actualBoundingBoxAscent > 0 && (s = Math.max(s, r.actualBoundingBoxAscent)), r.actualBoundingBoxDescent > 0 && (c = Math.max(c, r.actualBoundingBoxDescent));
4236
+ c += r.width + n * lr(t.text), l = Math.max(l, t.sizePx), r.actualBoundingBoxAscent > 0 && (u = Math.max(u, r.actualBoundingBoxAscent)), r.actualBoundingBoxDescent > 0 && (g = Math.max(g, r.actualBoundingBoxDescent));
4180
4237
  }
4181
- if (a <= 0) continue;
4182
- let l = s + c > 0 ? s + c : o, u = h.singleEdge ? .8 : l > 0 ? s / l : .8, g = h.singleEdge ? 1 : p / a, _ = h.singleEdge ? m : l / (i - r), v = dt(h, a), b = 0;
4183
- for (let t of n.segments) {
4238
+ if (c <= 0) continue;
4239
+ let _ = h.singleEdge ? Math.max(0, E ? D - y[t].baseline : y[t].baseline - D) : 0, v = _ > 0 ? lt(n, r, p + 2 * _, m + 2 * _) ?? h : h, b = u + g > 0 ? u + g : l, x = h.singleEdge ? .8 : b > 0 ? u / b : .8, w = h.singleEdge ? 1 : p / c, T = h.singleEdge ? b : b / (s - o), O = ft(v, c), k = h.singleEdge ? (1 - O) * (a === "r" ? 1 : a === "ctr" ? .5 : 0) : 0, A = 0;
4240
+ for (let t of i.segments) {
4184
4241
  if (t.math) {
4185
- b += t.math.width;
4242
+ A += t.math.width;
4186
4243
  continue;
4187
4244
  }
4188
4245
  e.font = t.font, e.fillStyle = t.color;
4189
- let n = t.letterSpacingPx ?? 0, o = [...t.text];
4190
- for (let s of o) {
4191
- let o = e.measureText(s).width + n, c = r + u * (i - r);
4192
- if (!h.singleEdge && o > 0) {
4193
- vr(e, s, n, o, x(), h, b, a, v, g, _, c, d, f, t.color), b += o;
4246
+ let n = t.letterSpacingPx ?? 0, r = [...t.text];
4247
+ for (let i of r) {
4248
+ let r = e.measureText(i).width + n, a = h.singleEdge ? x : o + x * (s - o);
4249
+ if (!h.singleEdge && r > 0) {
4250
+ Tr(e, i, n, r, S(), h, A, c, O, w, T, a, d, f, t.color), A += r;
4194
4251
  continue;
4195
4252
  }
4196
- let l = ft(h, (b + o / 2) / a * v, _, c);
4197
- e.save(), e.translate(d + l.x, f + l.y), e.rotate(l.angle), l.shear !== 0 && e.transform(1, 0, l.shear, 1, 0, 0), (g !== 1 || l.vScale !== 1) && e.scale(g, l.vScale), e.fillText(s, -o / 2 + n / 2, 0), e.restore(), b += o;
4253
+ let l = pt(v, k + (A + r / 2) / c * O, T, a);
4254
+ l.x -= _, l.y -= _, e.save(), e.translate(d + l.x, f + l.y), e.rotate(l.angle), l.shear !== 0 && e.transform(1, 0, l.shear, 1, 0, 0), (w !== 1 || l.vScale !== 1) && e.scale(w, l.vScale), e.fillText(i, -r / 2 + n / 2, 0), e.restore(), A += r;
4198
4255
  }
4199
4256
  }
4200
4257
  }
4201
4258
  e.restore();
4202
4259
  }
4203
- function Tr(e, t, n, r, i, a, o) {
4260
+ function Mr(e, t, n, r, i, a, o) {
4204
4261
  let s = Math.min(r, i);
4205
4262
  switch (e) {
4206
4263
  case "rightarrow":
@@ -4230,17 +4287,17 @@ function Tr(e, t, n, r, i, a, o) {
4230
4287
  default: return null;
4231
4288
  }
4232
4289
  }
4233
- function Er(e, t) {
4234
- return e.defaultTextColor ? Q(e.defaultTextColor) : t.smartArtFallbackTextColor != null && vn(e) ? t.smartArtFallbackTextColor : null;
4290
+ function Nr(e, t) {
4291
+ return e.defaultTextColor ? Q(e.defaultTextColor) : t.smartArtFallbackTextColor != null && yn(e) ? t.smartArtFallbackTextColor : null;
4235
4292
  }
4236
- function Dr(e, t, n) {
4293
+ function Pr(e, t, n) {
4237
4294
  return {
4238
4295
  outerRotation: e,
4239
4296
  localFlipH: t,
4240
4297
  localFlipV: n
4241
4298
  };
4242
4299
  }
4243
- function Or(e, t, n, r, i) {
4300
+ function Fr(e, t, n, r, i) {
4244
4301
  let a = [
4245
4302
  {
4246
4303
  x: t,
@@ -4269,7 +4326,7 @@ function Or(e, t, n, r, i) {
4269
4326
  h: l - s
4270
4327
  };
4271
4328
  }
4272
- var kr = {
4329
+ var Ir = {
4273
4330
  tl: [0, 0],
4274
4331
  t: [.5, 0],
4275
4332
  tr: [1, 0],
@@ -4280,15 +4337,15 @@ var kr = {
4280
4337
  b: [.5, 1],
4281
4338
  br: [1, 1]
4282
4339
  };
4283
- function Ar(e, t, n) {
4340
+ function Lr(e, t, n) {
4284
4341
  return [e.a * t + e.c * n + e.e, e.b * t + e.d * n + e.f];
4285
4342
  }
4286
- function jr(e, t, n, r, i, a) {
4287
- let [o, s] = kr[a ?? "b"];
4288
- return Ar(e, t + o * r, n + s * i);
4343
+ function Rr(e, t, n, r, i, a) {
4344
+ let [o, s] = Ir[a ?? "b"];
4345
+ return Lr(e, t + o * r, n + s * i);
4289
4346
  }
4290
- function Mr(e, t, n, r, i, a, o, s) {
4291
- let c = St(e, i, a).corners, l = (o > 0 ? Ge(c, o / i, o / a) ?? c : c).map((e) => Ar(t, n + e.x, r + e.y)), u = l.map(([e]) => e), d = l.map(([, e]) => e), f = Math.min(...u), p = Math.min(...d), m = Math.max(...u), h = Math.max(...d), [g, _] = kr[s ?? "b"], v = He(c, g, _);
4347
+ function zr(e, t, n, r, i, a, o, s) {
4348
+ let c = Ct(e, i, a).corners, l = (o > 0 ? Ke(c, o / i, o / a) ?? c : c).map((e) => Lr(t, n + e.x, r + e.y)), u = l.map(([e]) => e), d = l.map(([, e]) => e), f = Math.min(...u), p = Math.min(...d), m = Math.max(...u), h = Math.max(...d), [g, _] = Ir[s ?? "b"], v = Ue(c, g, _);
4292
4349
  return {
4293
4350
  bbox: {
4294
4351
  x: f,
@@ -4296,15 +4353,15 @@ function Mr(e, t, n, r, i, a, o, s) {
4296
4353
  w: m - f,
4297
4354
  h: h - p
4298
4355
  },
4299
- anchor: v ? Ar(t, n + v.x, r + v.y) : jr(t, n, r, i, a, s)
4356
+ anchor: v ? Lr(t, n + v.x, r + v.y) : Rr(t, n, r, i, a, s)
4300
4357
  };
4301
4358
  }
4302
- function Nr(e, t, n, r) {
4359
+ function Br(e, t, n, r) {
4303
4360
  let i = Math.floor(n.x) - 1, a = Math.floor(n.y) - 1, o = Math.max(1, Math.ceil(n.x + n.w) - i + 1), s = Math.max(1, Math.ceil(n.y + n.h) - a + 1);
4304
- if (r && (i + o <= 0 || a + s <= 0 || i >= r.w || a >= r.h) || Ve(o, s).clamped) return e;
4361
+ if (r && (i + o <= 0 || a + s <= 0 || i >= r.w || a >= r.h) || He(o, s).clamped) return e;
4305
4362
  let c = null;
4306
4363
  try {
4307
- c = Ae(o, s);
4364
+ c = je(o, s);
4308
4365
  } catch {
4309
4366
  return e;
4310
4367
  }
@@ -4323,7 +4380,7 @@ function Nr(e, t, n, r) {
4323
4380
  e.save(), e.setTransform(u), e.drawImage(c, i, a), e.restore();
4324
4381
  };
4325
4382
  }
4326
- function Pr(e, t, n, r, i, a, o, s, c, l = !0, u = r) {
4383
+ function Vr(e, t, n, r, i, a, o, s, c, l = !0, u = r) {
4327
4384
  let d = e.canvas.width || 0, f = e.canvas.height || 0, p = d > 0 && f > 0, m = {
4328
4385
  a: 1,
4329
4386
  b: 0,
@@ -4338,9 +4395,14 @@ function Pr(e, t, n, r, i, a, o, s, c, l = !0, u = r) {
4338
4395
  }, v = (e) => {
4339
4396
  h(e), u(e);
4340
4397
  }, y = !1;
4341
- t.shadow && p ? (e.save(), e.setTransform(m), y = !We(e, g, i, t.shadow, s, d, f, Math.atan2(c.b, c.a) * 180 / Math.PI, a), e.restore()) : t.shadow && (y = !0), t.reflection && p && (e.save(), e.setTransform(m), ze(e, g, i, t.reflection, s, d, f), e.restore()), y ? dr(e, t.shadow ?? null, o) : t.glow && fr(e, t.glow, o), t.softEdge && p ? (e.save(), e.setTransform(m), Be(e, g, i, t.softEdge, s, d, f, _), e.restore()) : n(e), (y || t.glow) && pr(e), t.innerShadow && l && p && (e.save(), e.setTransform(m), Ue(e, v, i, t.innerShadow, s, d, f), e.restore());
4398
+ t.shadow && p ? (e.save(), e.setTransform(m), y = !Ge(e, g, i, t.shadow, s, d, f, Math.atan2(c.b, c.a) * 180 / Math.PI, a), e.restore()) : t.shadow && (y = !0), t.reflection && p && (e.save(), e.setTransform(m), Be(e, g, i, t.reflection, s, d, f), e.restore()), y ? vr(e, t.shadow ?? null, o) : t.glow && yr(e, t.glow, o), t.softEdge && p ? (e.save(), e.setTransform(m), Ve(e, g, i, t.softEdge, s, d, f, _), e.restore()) : n(e), (y || t.glow) && br(e), t.innerShadow && l && p && (e.save(), e.setTransform(m), We(e, v, i, t.innerShadow, s, d, f), e.restore());
4399
+ }
4400
+ function Hr(e, t, n) {
4401
+ if (t === n || !Number.isFinite(e)) return e;
4402
+ let r = ((e + 180) % 360 + 360) % 360 - 180;
4403
+ return r > 90 ? r -= 180 : r < -90 && (r += 180), Object.is(r, -0) ? 0 : r;
4342
4404
  }
4343
- function Fr(e, t, r, i = "#000000", a, o = {
4405
+ function Ur(e, t, r, i = "#000000", a, o = {
4344
4406
  themeMajorFont: null,
4345
4407
  themeMinorFont: null,
4346
4408
  dpr: 1
@@ -4350,20 +4412,20 @@ function Fr(e, t, r, i = "#000000", a, o = {
4350
4412
  shapeId: t.id
4351
4413
  }) : s;
4352
4414
  if (f === 0 && t.textBody?.verticalAnchor === "b") {
4353
- if (t.stroke && (e.save(), $r(e, t.stroke, r, {
4415
+ if (t.stroke && (e.save(), si(e, t.stroke, r, {
4354
4416
  x: l,
4355
4417
  y: u,
4356
4418
  w: d,
4357
4419
  h: 1
4358
4420
  }, t.rotation), e.beginPath(), e.moveTo(l, u), e.lineTo(l + d, u), e.stroke(), e.restore()), t.textBody) {
4359
- let n = Er(t, o);
4360
- Vr(e, t.textBody, l, u, d, f, r, n, t.rotation, t.flipH, t.flipV, i, a, o, p, !1, c);
4421
+ let n = Nr(t, o);
4422
+ Yr(e, t.textBody, l, u, d, f, r, n, t.rotation, t.flipH, t.flipV, i, a, o, p, !1, c);
4361
4423
  }
4362
4424
  return;
4363
4425
  }
4364
- let h = t.scene3d && Ct(t.scene3d.camera) ? t.scene3d : null;
4426
+ let h = t.scene3d && wt(t.scene3d.camera) ? t.scene3d : null;
4365
4427
  if (h && d > 0 && f > 0) {
4366
- let n = e.getTransform(), s = Math.abs(n.a * n.d - n.b * n.c), c = s > 0 ? Math.sqrt(s) : 1, p = Hr(t.sp3d, t.scene3d?.lightRig, t.sp3d?.prstMaterial, r, c), m = Ur(t.sp3d, h.camera, d, f, r, c), g = Dr(t.rotation, t.flipH, t.flipV);
4428
+ let n = e.getTransform(), s = Math.abs(n.a * n.d - n.b * n.c), c = s > 0 ? Math.sqrt(s) : 1, p = Xr(t.sp3d, t.scene3d?.lightRig, t.sp3d?.prstMaterial, r, c), m = Zr(t.sp3d, h.camera, d, f, r, c), g = Pr(t.rotation, t.flipH, t.flipV);
4367
4429
  e.save(), g.outerRotation !== 0 && (e.translate(l + d / 2, u + f / 2), e.rotate(g.outerRotation * Math.PI / 180), e.translate(-(l + d / 2), -(u + f / 2)));
4368
4430
  let _ = {
4369
4431
  ...t,
@@ -4386,21 +4448,21 @@ function Fr(e, t, r, i = "#000000", a, o = {
4386
4448
  ..._,
4387
4449
  fill: null,
4388
4450
  stroke: null
4389
- }, b = (t.stroke ? t.stroke.width * r / 2 : 0) + (t.sp3d?.contourW ? t.sp3d.contourW * r : 0) + (m ? Math.hypot(m.offsetX, m.offsetY) / c : 0) + 2, x = (e, t, n) => Wr(e, h.camera, l, u, d, f, (e) => {
4390
- Fr(e, t, r, i, a, o, void 0);
4451
+ }, b = (t.stroke ? t.stroke.width * r / 2 : 0) + (t.sp3d?.contourW ? t.sp3d.contourW * r : 0) + (m ? Math.hypot(m.offsetX, m.offsetY) / c : 0) + 2, x = (e, t, n) => Qr(e, h.camera, l, u, d, f, (e) => {
4452
+ Ur(e, t, r, i, a, o, void 0);
4391
4453
  }, n ? {
4392
4454
  bevels: p,
4393
4455
  extrusion: m ?? void 0,
4394
4456
  edgePadCss: b
4395
4457
  } : {}), S = (e) => x(e, v, !0), C = (e) => !t.textBody || x(e, y, !1);
4396
4458
  if (t.shadow || t.innerShadow || t.glow || t.softEdge || t.reflection) {
4397
- let n = e.getTransform(), i = Math.abs(n.a * n.d - n.b * n.c), a = i > 0 ? Math.sqrt(i) : 1, o = Mr(h.camera, n, l, u, d, f, b, t.shadow?.algn), s = !1, c = Nr((e) => {
4459
+ let n = e.getTransform(), i = Math.abs(n.a * n.d - n.b * n.c), a = i > 0 ? Math.sqrt(i) : 1, o = zr(h.camera, n, l, u, d, f, b, t.shadow?.algn), s = !1, c = Br((e) => {
4398
4460
  s = S(e) || s;
4399
4461
  }, n, o.bbox, {
4400
4462
  w: e.canvas.width || 0,
4401
4463
  h: e.canvas.height || 0
4402
4464
  });
4403
- if (Pr(e, t, c, c, o.bbox, o.anchor, r, r * a, n, !!t.fill), s) {
4465
+ if (Vr(e, t, c, c, o.bbox, o.anchor, r, r * a, n, !!t.fill), s) {
4404
4466
  C(e), e.restore();
4405
4467
  return;
4406
4468
  }
@@ -4411,9 +4473,9 @@ function Fr(e, t, r, i = "#000000", a, o = {
4411
4473
  e.restore();
4412
4474
  }
4413
4475
  e.save(), (t.rotation !== 0 || t.flipH || t.flipV) && (e.translate(l + d / 2, u + f / 2), e.rotate(t.rotation * Math.PI / 180), t.flipH && e.scale(-1, 1), t.flipV && e.scale(1, -1), e.translate(-(l + d / 2), -(u + f / 2)));
4414
- let _ = t.geometry.toLowerCase(), v = Nn(t.fill, e, l, u, d, f, t.rotation);
4415
- t.shadow || fr(e, t.glow ?? null, r);
4416
- let y = new Set([
4476
+ let g = t.geometry.toLowerCase(), _ = Pn(t.fill, e, l, u, d, f, t.rotation);
4477
+ t.shadow || yr(e, t.glow ?? null, r);
4478
+ let v = new Set([
4417
4479
  "line",
4418
4480
  "straightconnector1",
4419
4481
  "bentconnector2",
@@ -4424,7 +4486,7 @@ function Fr(e, t, r, i = "#000000", a, o = {
4424
4486
  "curvedconnector3",
4425
4487
  "curvedconnector4",
4426
4488
  "curvedconnector5"
4427
- ]), b = new Set([
4489
+ ]), y = new Set([
4428
4490
  "callout1",
4429
4491
  "callout2",
4430
4492
  "callout3",
@@ -4437,22 +4499,22 @@ function Fr(e, t, r, i = "#000000", a, o = {
4437
4499
  "accentbordercallout1",
4438
4500
  "accentbordercallout2",
4439
4501
  "accentbordercallout3"
4440
- ]), x = (e) => b.has(e) || e === "line" || e === "straightconnector1" || e.startsWith("bentconnector"), S = !t.custGeom && m(_), C = (n, i, a = {
4502
+ ]), b = (e) => y.has(e) || e === "line" || e === "straightconnector1" || e.startsWith("bentconnector"), x = !t.custGeom && V(g), S = (n, i, a = {
4441
4503
  x: l,
4442
4504
  y: u,
4443
4505
  w: d,
4444
4506
  h: f
4445
4507
  }) => {
4446
- let { x: o, y: s, w: c, h: p } = a, m = i ?? (n === e && o === l && s === u && c === d && p === f ? v : Nn(t.fill, n, o, s, c, p, t.rotation)), h = i ? null : t.stroke ? () => {
4447
- $r(n, t.stroke, r, {
4508
+ let { x: o, y: s, w: c, h: p } = a, h = i ?? (n === e && o === l && s === u && c === d && p === f ? _ : Pn(t.fill, n, o, s, c, p, t.rotation)), v = i ? null : t.stroke ? () => {
4509
+ si(n, t.stroke, r, {
4448
4510
  x: o,
4449
4511
  y: s,
4450
4512
  w: c,
4451
4513
  h: p
4452
4514
  }, t.rotation), n.stroke();
4453
- } : null, y = () => pr(n);
4454
- if (S && !i) {
4455
- g(n, _, o, s, c, p, [
4515
+ } : null, y = () => br(n);
4516
+ if (x && !i) {
4517
+ m(n, g, o, s, c, p, [
4456
4518
  t.adj,
4457
4519
  t.adj2,
4458
4520
  t.adj3,
@@ -4461,11 +4523,11 @@ function Fr(e, t, r, i = "#000000", a, o = {
4461
4523
  t.adj6,
4462
4524
  t.adj7,
4463
4525
  t.adj8
4464
- ], m, h, y, x(_) ? { skipTrailingStroke: !0 } : void 0);
4526
+ ], h, v, y, b(g) ? { skipTrailingStroke: !0 } : void 0);
4465
4527
  return;
4466
4528
  }
4467
- n.beginPath(), t.custGeom && t.custGeom.length > 0 ? Ir(n, t.custGeom, o, s, c, p) : me(n, _, o, s, c, p, t.adj, t.adj2, t.adj3, t.adj4), m && _ !== "arc" && (n.fillStyle = m, _ === "donut" || _ === "smileyface" || _ === "frame" ? n.fill("evenodd") : n.fill(), i || y()), h && h();
4468
- }, w = e.getTransform(), T = Math.abs(w.a * w.d - w.b * w.c), E = T > 0 ? Math.sqrt(T) : 1, D = (t.shadow || t.reflection || t.softEdge || t.innerShadow ? S ? W(_, l, u, d, f, [
4529
+ n.beginPath(), t.custGeom && t.custGeom.length > 0 ? Wr(n, t.custGeom, o, s, c, p) : he(n, g, o, s, c, p, t.adj, t.adj2, t.adj3, t.adj4), h && g !== "arc" && (n.fillStyle = h, g === "donut" || g === "smileyface" || g === "frame" ? n.fill("evenodd") : n.fill(), i || y()), v && v();
4530
+ }, C = e.getTransform(), w = Math.abs(C.a * C.d - C.b * C.c), T = w > 0 ? Math.sqrt(w) : 1, E = (t.shadow || t.reflection || t.softEdge || t.innerShadow ? x ? n(g, l, u, d, f, [
4469
4531
  t.adj,
4470
4532
  t.adj2,
4471
4533
  t.adj3,
@@ -4474,20 +4536,20 @@ function Fr(e, t, r, i = "#000000", a, o = {
4474
4536
  t.adj6,
4475
4537
  t.adj7,
4476
4538
  t.adj8
4477
- ]) : t.custGeom && t.custGeom.length > 0 ? he(t.custGeom, l, u, d, f) : null : null) ?? {
4539
+ ]) : t.custGeom && t.custGeom.length > 0 ? ge(t.custGeom, l, u, d, f) : null : null) ?? {
4478
4540
  x: l,
4479
4541
  y: u,
4480
4542
  w: d,
4481
4543
  h: f
4482
- }, O = t.stroke ? t.stroke.width * r / 2 : 0, k = t.stroke ? Math.max(t.stroke.headEnd ? pe(t.stroke.headEnd, t.stroke, r) : 0, t.stroke.tailEnd ? pe(t.stroke.tailEnd, t.stroke, r) : 0) : 0, A = t.sp3d?.contourW ? t.sp3d.contourW * r : 0, j = Math.max(O, k, A), M = j > 0 ? {
4483
- x: D.x - j,
4484
- y: D.y - j,
4485
- w: D.w + j * 2,
4486
- h: D.h + j * 2
4487
- } : D, N = Or(w, M.x, M.y, M.w, M.h), P = r * E, F = h ? [] : Hr(t.sp3d, t.scene3d?.lightRig, t.sp3d?.prstMaterial, r, E), I = (t.stroke ? t.stroke.width * r / 2 : 0) + 2, L = (e) => {
4488
- let i = t.stroke?.fill ? Nn(t.stroke.fill, e, l, u, d, f, t.rotation) ?? void 0 : void 0;
4489
- if (t.stroke && (y.has(_) || b.has(_))) {
4490
- let a = n(_, l, u, d, f, [
4544
+ }, D = t.stroke ? t.stroke.width * r / 2 : 0, O = t.stroke ? Math.max(t.stroke.headEnd ? me(t.stroke.headEnd, t.stroke, r) : 0, t.stroke.tailEnd ? me(t.stroke.tailEnd, t.stroke, r) : 0) : 0, k = t.sp3d?.contourW ? t.sp3d.contourW * r : 0, A = Math.max(D, O, k), j = A > 0 ? {
4545
+ x: E.x - A,
4546
+ y: E.y - A,
4547
+ w: E.w + A * 2,
4548
+ h: E.h + A * 2
4549
+ } : E, M = Fr(C, j.x, j.y, j.w, j.h), N = r * T, P = h ? [] : Xr(t.sp3d, t.scene3d?.lightRig, t.sp3d?.prstMaterial, r, T), F = (t.stroke ? t.stroke.width * r / 2 : 0) + 2, I = (e) => {
4550
+ let n = t.stroke?.fill ? Pn(t.stroke.fill, e, l, u, d, f, t.rotation) ?? void 0 : void 0;
4551
+ if (t.stroke && (v.has(g) || y.has(g))) {
4552
+ let i = U(g, l, u, d, f, [
4491
4553
  t.adj,
4492
4554
  t.adj2,
4493
4555
  t.adj3,
@@ -4497,22 +4559,22 @@ function Fr(e, t, r, i = "#000000", a, o = {
4497
4559
  t.adj7,
4498
4560
  t.adj8
4499
4561
  ]);
4500
- if (!a) return;
4501
- let o = t.stroke.cmpd, s = _ === "line" || _ === "straightconnector1";
4502
- if (x(_) && a.vertices.length >= 2 && !(o && s)) {
4503
- let n = a.vertices.map((e) => ({
4562
+ if (!i) return;
4563
+ let a = t.stroke.cmpd, o = g === "line" || g === "straightconnector1";
4564
+ if (b(g) && i.vertices.length >= 2 && !(a && o)) {
4565
+ let n = i.vertices.map((e) => ({
4504
4566
  x: e.x,
4505
4567
  y: e.y
4506
4568
  }));
4507
4569
  if (t.stroke.tailEnd) {
4508
- let e = ye(t.stroke.tailEnd, t.stroke, r);
4509
- n[n.length - 1] = Se(n[n.length - 1], n[n.length - 2], e);
4570
+ let e = be(t.stroke.tailEnd, t.stroke, r);
4571
+ n[n.length - 1] = Ce(n[n.length - 1], n[n.length - 2], e);
4510
4572
  }
4511
4573
  if (t.stroke.headEnd) {
4512
- let e = ye(t.stroke.headEnd, t.stroke, r);
4513
- n[0] = Se(n[0], n[1], e);
4574
+ let e = be(t.stroke.headEnd, t.stroke, r);
4575
+ n[0] = Ce(n[0], n[1], e);
4514
4576
  }
4515
- $r(e, t.stroke, r, {
4577
+ si(e, t.stroke, r, {
4516
4578
  x: l,
4517
4579
  y: u,
4518
4580
  w: d,
@@ -4521,46 +4583,51 @@ function Fr(e, t, r, i = "#000000", a, o = {
4521
4583
  for (let t = 1; t < n.length; t++) e.lineTo(n[t].x, n[t].y);
4522
4584
  e.stroke();
4523
4585
  }
4524
- o && s && Qr(e, a.start, a.end, t.stroke, o, r, t.rotation), t.stroke.tailEnd && _e(e, a.end.x, a.end.y, a.end.angle, t.stroke.tailEnd, t.stroke, r, i), t.stroke.headEnd && _e(e, a.start.x, a.start.y, a.start.angle, t.stroke.headEnd, t.stroke, r, i);
4586
+ a && o && oi(e, i.start, i.end, t.stroke, a, r, t.rotation), t.stroke.tailEnd && ve(e, i.end.x, i.end.y, i.end.angle, t.stroke.tailEnd, t.stroke, r, n), t.stroke.headEnd && ve(e, i.start.x, i.start.y, i.start.angle, t.stroke.headEnd, t.stroke, r, n);
4525
4587
  return;
4526
4588
  }
4527
4589
  if (!t.stroke || !t.custGeom || t.custGeom.length === 0 || (!t.stroke.headEnd || t.stroke.headEnd.type === "none") && (!t.stroke.tailEnd || t.stroke.tailEnd.type === "none")) return;
4528
- let { start: a, end: o } = ve(t.custGeom);
4529
- a && t.stroke.headEnd && t.stroke.headEnd.type !== "none" && _e(e, l + a.x * d, u + a.y * f, Math.atan2(a.dy * f, a.dx * d), t.stroke.headEnd, t.stroke, r, i), o && t.stroke.tailEnd && t.stroke.tailEnd.type !== "none" && _e(e, l + o.x * d, u + o.y * f, Math.atan2(o.dy * f, o.dx * d), t.stroke.tailEnd, t.stroke, r, i);
4530
- }, R = (e) => {
4531
- if (F.length > 0 && Gr(e, l, u, d, f, F, (e, t, n, r, i) => C(e, void 0, {
4590
+ let { start: i, end: a } = ye(t.custGeom);
4591
+ i && t.stroke.headEnd && t.stroke.headEnd.type !== "none" && ve(e, l + i.x * d, u + i.y * f, Math.atan2(i.dy * f, i.dx * d), t.stroke.headEnd, t.stroke, r, n), a && t.stroke.tailEnd && t.stroke.tailEnd.type !== "none" && ve(e, l + a.x * d, u + a.y * f, Math.atan2(a.dy * f, a.dx * d), t.stroke.tailEnd, t.stroke, r, n);
4592
+ }, L = (e) => {
4593
+ if (P.length > 0 && $r(e, l, u, d, f, P, (e, t, n, r, i) => S(e, void 0, {
4532
4594
  x: t,
4533
4595
  y: n,
4534
4596
  w: r,
4535
4597
  h: i
4536
- }), void 0, I)) {
4537
- L(e), pr(e);
4598
+ }), void 0, F)) {
4599
+ I(e), br(e);
4538
4600
  return;
4539
4601
  }
4540
- C(e), L(e);
4602
+ S(e), I(e);
4541
4603
  };
4542
- if (Pr(e, t, R, R, N, jr(w, l, u, d, f, t.shadow?.algn), r, P, w, !!v, (e) => C(e, "#000")), t.textBody) {
4543
- let n = Er(t, o);
4604
+ if (Vr(e, t, L, L, M, Rr(C, l, u, d, f, t.shadow?.algn), r, N, C, !!_, (e) => S(e, "#000")), t.textBody) {
4605
+ let n = Nr(t, o), s = Hr(t.rotation, t.flipH, t.flipV);
4544
4606
  if (e.save(), t.flipH || t.flipV) {
4545
4607
  let n = l + d / 2, r = u + f / 2;
4546
4608
  e.translate(n, r), t.flipH && e.scale(-1, 1), t.flipV && e.scale(1, -1), e.translate(-n, -r);
4547
4609
  }
4548
- let s = l, m = u, h = d, g = f;
4549
- if (t.textRect) s = X(t.textRect.x, r), m = X(t.textRect.y, r), h = X(t.textRect.width, r), g = X(t.textRect.height, r);
4550
- else if (_ === "ellipse") {
4610
+ let m = (s - t.rotation) % 360;
4611
+ if (m !== 0) {
4612
+ let t = l + d / 2, n = u + f / 2;
4613
+ e.translate(t, n), e.rotate(m * Math.PI / 180), e.translate(-t, -n);
4614
+ }
4615
+ let h = l, _ = u, v = d, y = f;
4616
+ if (t.textRect) h = X(t.textRect.x, r), _ = X(t.textRect.y, r), v = X(t.textRect.width, r), y = X(t.textRect.height, r);
4617
+ else if (g === "ellipse") {
4551
4618
  let e = d * (1 - 1 / Math.SQRT2) / 2, t = f * (1 - 1 / Math.SQRT2) / 2;
4552
- s = l + e, m = u + t, h = d / Math.SQRT2, g = f / Math.SQRT2;
4619
+ h = l + e, _ = u + t, v = d / Math.SQRT2, y = f / Math.SQRT2;
4553
4620
  } else {
4554
- let e = Tr(_, l, u, d, f, t.adj, t.adj2);
4555
- e && (s = e.tx, m = e.ty, h = e.tw, g = e.th);
4621
+ let e = Mr(g, l, u, d, f, t.adj, t.adj2);
4622
+ e && (h = e.tx, _ = e.ty, v = e.tw, y = e.th);
4556
4623
  }
4557
- Vr(e, t.textBody, s, m, h, g, r, n, t.rotation, !1, !1, i, a, o, p, !1, c), e.restore();
4624
+ Yr(e, t.textBody, h, _, v, y, r, n, s, !1, !1, i, a, o, p, !1, c), e.restore();
4558
4625
  }
4559
4626
  e.restore();
4560
4627
  }
4561
- var Ir = we;
4562
- function Lr(e, t) {
4563
- let n = `${e}`, r = e >= 1 && e <= 26 ? String.fromCharCode(96 + e) : n, i = e >= 1 && e <= 26 ? String.fromCharCode(64 + e) : n, a = Rr(e).toLowerCase(), o = Rr(e), s = n.replace(/[0-9]/g, (e) => String.fromCharCode(65296 + (e.charCodeAt(0) - 48)));
4628
+ var Wr = Te;
4629
+ function Gr(e, t) {
4630
+ let n = `${e}`, r = e >= 1 && e <= 26 ? String.fromCharCode(96 + e) : n, i = e >= 1 && e <= 26 ? String.fromCharCode(64 + e) : n, a = Kr(e).toLowerCase(), o = Kr(e), s = n.replace(/[0-9]/g, (e) => String.fromCharCode(65296 + (e.charCodeAt(0) - 48)));
4564
4631
  switch (t) {
4565
4632
  case "arabicPlain": return n;
4566
4633
  case "arabicPeriod": return `${n}.`;
@@ -4587,7 +4654,7 @@ function Lr(e, t) {
4587
4654
  default: return `${n}.`;
4588
4655
  }
4589
4656
  }
4590
- function Rr(e) {
4657
+ function Kr(e) {
4591
4658
  let t = [
4592
4659
  1e3,
4593
4660
  900,
@@ -4620,244 +4687,249 @@ function Rr(e) {
4620
4687
  for (let i = 0; i < t.length; i++) for (; e >= t[i];) r += n[i], e -= t[i];
4621
4688
  return r;
4622
4689
  }
4623
- function zr(e) {
4690
+ function qr(e) {
4624
4691
  for (let t of e.runs) if (t.type === "text" && t.text !== "" || t.type === "math") return !0;
4625
4692
  return !1;
4626
4693
  }
4627
- function Br(e, t) {
4628
- let n = zr(e);
4629
- if (e.bullet.type === "char") return t.clear(), n ? be(e.bullet.char, e.bullet.fontFamily ?? null) : "";
4694
+ function Jr(e, t) {
4695
+ let n = qr(e);
4696
+ if (e.bullet.type === "char") return t.clear(), n ? xe(e.bullet.char, e.bullet.fontFamily ?? null) : "";
4630
4697
  if (e.bullet.type === "autoNum") {
4631
4698
  if (!n) return "";
4632
4699
  let r = e.lvl;
4633
- return t.has(r) ? t.set(r, t.get(r) + 1) : t.set(r, e.bullet.startAt ?? 1), Lr(t.get(r), e.bullet.numType);
4700
+ return t.has(r) ? t.set(r, t.get(r) + 1) : t.set(r, e.bullet.startAt ?? 1), Gr(t.get(r), e.bullet.numType);
4634
4701
  }
4635
4702
  return t.clear(), "";
4636
4703
  }
4637
- function Vr(t, n, r, i, a, o, s, c = null, l = 0, u = !1, d = !1, f = "#000000", p, m = {
4704
+ function Yr(e, t, n, r, i, a, o, s = null, c = 0, l = !1, u = !1, d = "#000000", f, p = {
4638
4705
  themeMajorFont: null,
4639
4706
  themeMinorFont: null,
4640
4707
  dpr: 1
4641
- }, h, g = !1, _, v = !1, y = g) {
4642
- let b = n.vert === "vert" || n.vert === "eaVert", x = n.vert === "vert270";
4708
+ }, m, h = !1, g, v = !1, y = h) {
4709
+ let b = t.vert === "vert" || t.vert === "eaVert", x = t.vert === "vert270";
4643
4710
  if (b || x) {
4644
- let e = r + a / 2, u = i + o / 2, d = b ? 90 : -90, v = h ? (e) => h({
4711
+ let l = n + i / 2, u = r + a / 2, _ = b ? 90 : -90, v = m ? (e) => m({
4645
4712
  ...e,
4646
- inShapeX: e.inShapeX - o / 2 + a / 2,
4647
- inShapeY: e.inShapeY - a / 2 + o / 2,
4648
- shapeX: r,
4649
- shapeY: i,
4650
- shapeW: a,
4651
- shapeH: o,
4652
- rotation: l,
4653
- textBodyRotation: d
4713
+ inShapeX: e.inShapeX - a / 2 + i / 2,
4714
+ inShapeY: e.inShapeY - i / 2 + a / 2,
4715
+ shapeX: n,
4716
+ shapeY: r,
4717
+ shapeW: i,
4718
+ shapeH: a,
4719
+ rotation: c,
4720
+ textBodyRotation: _
4654
4721
  }) : void 0;
4655
- if (g) return a;
4656
- t.save(), t.translate(e, u), t.rotate(x ? -Math.PI / 2 : Math.PI / 2), Vr(t, {
4657
- ...n,
4722
+ if (h) return i;
4723
+ e.save(), e.translate(l, u), e.rotate(x ? -Math.PI / 2 : Math.PI / 2), Yr(e, {
4724
+ ...t,
4658
4725
  vert: "horz"
4659
- }, -o / 2, -a / 2, o, a, s, c, 0, !1, !1, f, p, m, v, !1, _, n.vert === "eaVert"), t.restore();
4726
+ }, -a / 2, -i / 2, a, i, o, s, 0, !1, !1, d, f, p, v, !1, g, t.vert === "eaVert"), e.restore();
4660
4727
  return;
4661
4728
  }
4662
- let S = n.textWarp;
4663
- if (!g && S && rt(S.preset)) {
4664
- wr(t, n, S.preset, S.adj ?? [], r, i, a, o, s, c ?? f, m);
4729
+ let S = t.textWarp;
4730
+ if (!h && S && it(S.preset)) {
4731
+ jr(e, t, S.preset, S.adj ?? [], n, r, i, a, o, s ?? d, p);
4665
4732
  return;
4666
4733
  }
4667
- let C = X(n.lIns, s), w = X(n.rIns, s), T = X(n.tIns, s), E = X(n.bIns, s), D = n.wrap !== "none", O = n.autoFit === "sp", A = O ? D && er(t, n, a, C, w, s, m) : D, j = Math.max(1, n.numCol ?? 1), M = X(n.spcCol ?? 0, s), N = n.defaultBold ?? !1, P = n.defaultItalic ?? !1, F = c ?? f, I = (e) => {
4668
- let i = (n.defaultFontSize ?? 18) * Y * s * e, o = [], c = 0, l = /* @__PURE__ */ new Map();
4669
- for (let u = 0; u < n.paragraphs.length; u++) {
4670
- let d = n.paragraphs[u], f = X(d.marL, s), h = X(d.marR, s), _ = X(d.indent, s), v = d.defFontSize == null ? i : d.defFontSize * Y * s * e, b = d.defColor ? Q(d.defColor) : F, x = Xn(d), S = (() => {
4671
- for (let e of d.runs) if (e.type === "text" && e.fontSize != null) return e.fontSize;
4672
- return d.defFontSize ?? n.defaultFontSize ?? 18;
4673
- })() * Y * s * e, T = (() => {
4674
- for (let e of d.runs) if (e.type === "text" && e.color) return e.color;
4734
+ let C = X(t.lIns, o), w = X(t.rIns, o), T = X(t.tIns, o), E = X(t.bIns, o), D = t.wrap !== "none", O = t.autoFit === "sp", k = O ? D && sr(e, t, i, C, w, o, p) : D, A = Math.max(1, t.numCol ?? 1), j = X(t.spcCol ?? 0, o), M = t.defaultBold ?? !1, N = t.defaultItalic ?? !1, P = s ?? d, F = (r) => {
4735
+ let a = (t.defaultFontSize ?? 18) * Y * o * r, s = [], c = 0, l = 0, u = /* @__PURE__ */ new Map();
4736
+ for (let d = 0; d < t.paragraphs.length; d++) {
4737
+ let m = t.paragraphs[d], g = X(m.marL, o), _ = X(m.marR, o), v = X(m.indent, o), b = m.defFontSize == null ? a : m.defFontSize * Y * o * r, x = m.defColor ? Q(m.defColor) : P, S = Zn(m), T = (() => {
4738
+ for (let e of m.runs) if (e.type === "text" && e.fontSize != null) return e.fontSize;
4739
+ return m.defFontSize ?? t.defaultFontSize ?? 18;
4740
+ })() * Y * o * r, E = (() => {
4741
+ for (let e of m.runs) if (e.type === "text" && e.color) return e.color;
4675
4742
  return null;
4676
- })(), E = T ? Q(T) : b, D = (() => {
4677
- for (let e of d.runs) if (e.type === "text" && e.fontFamily) return e.fontFamily;
4678
- return d.defFontFamily ?? null;
4679
- })(), k = "", I = Yn(!1, !1, S, "sans-serif", m), L = E, R = null;
4680
- k = Br(d, l);
4681
- let z = Qe(d.bullet);
4682
- if (z.type === "char") {
4683
- let t = z;
4684
- I = Yn(!1, !1, t.sizePts == null ? t.sizePct == null ? S : S * (t.sizePct / 100) : t.sizePts * Y * s * e, k === t.char ? Rn(t.fontFamily ?? null, m) : "sans-serif", m), L = t.color ? Q(t.color) : E;
4685
- } else if (z.type === "autoNum") {
4686
- let t = z;
4687
- I = Yn(!1, !1, t.sizePts == null ? t.sizePct == null ? S : S * (t.sizePct / 100) : t.sizePts * Y * s * e, Rn(t.fontFamily ?? D, m), m), L = z.color ? Q(z.color) : E;
4688
- } else if (z.type === "blip") {
4689
- let t = z, r = Zn(n, d, t) * Y * s * e;
4690
- R = {
4691
- imagePath: t.imagePath,
4692
- mimeType: t.mimeType,
4693
- sizePx: r
4743
+ })(), D = E ? Q(E) : x, F = (() => {
4744
+ for (let e of m.runs) if (e.type === "text" && e.fontFamily) return e.fontFamily;
4745
+ return m.defFontFamily ?? null;
4746
+ })(), I = "", L = Xn(!1, !1, T, "sans-serif", p), R = D, z = null;
4747
+ I = Jr(m, u);
4748
+ let B = $e(m.bullet);
4749
+ if (B.type === "char") {
4750
+ let e = B;
4751
+ L = Xn(!1, !1, e.sizePts == null ? e.sizePct == null ? T : T * (e.sizePct / 100) : e.sizePts * Y * o * r, I === e.char ? zn(e.fontFamily ?? null, p) : "sans-serif", p), R = e.color ? Q(e.color) : D;
4752
+ } else if (B.type === "autoNum") {
4753
+ let e = B;
4754
+ L = Xn(!1, !1, e.sizePts == null ? e.sizePct == null ? T : T * (e.sizePct / 100) : e.sizePts * Y * o * r, zn(e.fontFamily ?? F, p), p), R = B.color ? Q(B.color) : D;
4755
+ } else if (B.type === "blip") {
4756
+ let e = B, n = Qn(t, m, e) * Y * o * r;
4757
+ z = {
4758
+ imagePath: e.imagePath,
4759
+ mimeType: e.mimeType,
4760
+ sizePx: n
4694
4761
  };
4695
4762
  }
4696
- let B = j > 1 ? (a - C - w - (j - 1) * M) / j : a - C - w, V = r + C + f, H = r + C + f + _, U = B - f - h, ee = ar(t, d, A ? U : Infinity, v, b, s, f, N, P, e, p, m, Qn(x, _)), W = d.spaceBefore == null ? 0 : d.spaceBefore / 100 * Y * s * e, G = d.spaceAfter == null ? 0 : d.spaceAfter / 100 * Y * s * e;
4697
- for (let e = 0; e < ee.length; e++) {
4698
- let r = ee[e], i = e === 0, a = e === ee.length - 1, l = 0, f = 0, p = 0;
4699
- for (let e of r.segments) {
4700
- let n = e.math ? Math.max(e.sizePx, (e.math.ascent + e.math.descent) / 1.2) : e.sizePx;
4701
- if (n > l && (l = n), !e.math) {
4702
- let n = J(e.fontFamily, e.sizePx);
4703
- if (n > f && (f = n), O) {
4704
- t.font = e.font;
4705
- let n = t.measureText(e.text || "M"), r = (n.fontBoundingBoxAscent ?? 0) + (n.fontBoundingBoxDescent ?? 0);
4706
- r > p && (p = r);
4707
- }
4763
+ let V = A > 1 ? (i - C - w - (A - 1) * j) / A : i - C - w, H = n + C + g, U = n + C + g + v, W = V - g - _, ee = fr(e, m, k ? W : Infinity, b, x, o, g, M, N, r, f, p, $n(S, v)), G = m.spaceBefore == null ? 0 : m.spaceBefore / 100 * Y * o * r, te = m.spaceAfter == null ? 0 : m.spaceAfter / 100 * Y * o * r;
4764
+ for (let n = 0; n < ee.length; n++) {
4765
+ let r = ee[n], i = n === 0, a = n === ee.length - 1, u = 0, f = 0;
4766
+ for (let t of r.segments) {
4767
+ let n = t.math ? Math.max(t.sizePx, (t.math.ascent + t.math.descent) / 1.2) : t.sizePx;
4768
+ if (n > u && (u = n), !t.math && O) {
4769
+ e.font = t.font;
4770
+ let n = e.measureText(t.text || "M"), r = (n.fontBoundingBoxAscent ?? 0) + (n.fontBoundingBoxDescent ?? 0);
4771
+ r > f && (f = r);
4708
4772
  }
4709
4773
  }
4710
- if (l === 0 && (l = v), i && k) {
4711
- t.font = I;
4712
- let e = t.measureText("M"), n = e.actualBoundingBoxAscent + e.actualBoundingBoxDescent;
4713
- n > l && (l = n);
4774
+ if (u === 0 && (u = b), i && I) {
4775
+ e.font = L;
4776
+ let t = e.measureText("M"), n = t.actualBoundingBoxAscent + t.actualBoundingBoxDescent;
4777
+ n > u && (u = n);
4714
4778
  }
4715
- i && R && R.sizePx > l && (l = R.sizePx);
4716
- let m = l * 1.2, h = O && f > m && p > 0, b = h ? Math.max(m, p) : Math.max(m, f), S;
4717
- S = d.spaceLine ? d.spaceLine.type === "pct" ? (g ? l : m) * (d.spaceLine.val / 1e5) : d.spaceLine.val * Y * s : g && !O ? y ? m : l : b, n.autoFit === "norm" && n.lnSpcReduction != null && d.spaceLine?.type !== "pts" && (S *= 1 - n.lnSpcReduction);
4718
- let C = S + (a ? G : 0), w = i && u > 0 ? W : 0, T = i ? Qn(x, _) : 0, E = r.segments.some((e) => e.text && e.text.length > 0 || e.math != null), D = i && E ? R : null;
4719
- o.push({
4779
+ i && z && z.sizePx > u && (u = z.sizePx);
4780
+ let p = u * 1.2, g = O && f > p, _ = p, x = d === t.paragraphs.length - 1 && a, C = t.paragraphs.length === 1 && ee.length === 1, w;
4781
+ w = m.spaceLine ? m.spaceLine.type === "pct" ? p * (m.spaceLine.val / 1e5) : m.spaceLine.val * Y * o : _;
4782
+ let T = w;
4783
+ h && !O && !y && (m.spaceLine ? m.spaceLine.type === "pct" && x && C && (T = u * (m.spaceLine.val / 1e5)) : T = u);
4784
+ let E = m.spaceLine?.type === "pct" ? u * (m.spaceLine.val / 1e5) : T;
4785
+ t.autoFit === "norm" && t.lnSpcReduction != null && m.spaceLine?.type !== "pts" && (T *= 1 - t.lnSpcReduction);
4786
+ let D = T + (a ? te : 0), k = i && d > 0 ? G : 0, A = i ? $n(S, v) : 0, j = r.segments.some((e) => e.text && e.text.length > 0 || e.math != null), M = i && j ? z : null;
4787
+ s.push({
4720
4788
  line: r,
4721
- linePx: C,
4722
- lineHeight: S,
4723
- topGapPx: w,
4724
- textXOffset: T,
4725
- bulletLabel: i ? k : "",
4726
- bulletFont: I,
4727
- bulletColor: L,
4728
- bulletX: H,
4729
- bulletImage: D,
4730
- textX: V,
4731
- textMaxW: U,
4732
- alignment: d.alignment,
4789
+ linePx: D,
4790
+ lineHeight: T,
4791
+ baselineLineHeight: E,
4792
+ topGapPx: k,
4793
+ textXOffset: A,
4794
+ bulletLabel: i ? I : "",
4795
+ bulletFont: L,
4796
+ bulletColor: R,
4797
+ bulletX: U,
4798
+ bulletImage: M,
4799
+ textX: H,
4800
+ textMaxW: W,
4801
+ alignment: m.alignment,
4733
4802
  isLastLine: a,
4734
- para: d,
4735
- useResolvedFontMetrics: h
4736
- }), c += C + w;
4803
+ para: m,
4804
+ useResolvedFontMetrics: g
4805
+ });
4806
+ let N = c + k;
4807
+ c += D + k, l = Math.max(l, c, N + (g ? Math.max(T, f) : T) + (a ? te : 0));
4737
4808
  }
4738
4809
  }
4739
4810
  return {
4740
- allLines: o,
4741
- totalHeight: c
4811
+ allLines: s,
4812
+ totalHeight: c,
4813
+ requiredHeight: l
4742
4814
  };
4743
- }, { allLines: L, totalHeight: R } = I(1);
4744
- if (n.autoFit === "norm") if (n.fontScale != null && n.fontScale > 0) n.fontScale < 1 && ({allLines: L, totalHeight: R} = I(n.fontScale));
4815
+ }, { allLines: L, totalHeight: R, requiredHeight: z } = F(1);
4816
+ if (t.autoFit === "norm") if (t.fontScale != null && t.fontScale > 0) t.fontScale < 1 && ({allLines: L, totalHeight: R, requiredHeight: z} = F(t.fontScale));
4745
4817
  else {
4746
- let e = o - T - E;
4747
- if (R > e && e > 0) {
4818
+ let e = a - T - E;
4819
+ if (z > e && e > 0) {
4748
4820
  let t = .1, n = 1;
4749
4821
  for (let r = 0; r < 6; r++) {
4750
4822
  let r = (t + n) / 2;
4751
- I(r).totalHeight <= e ? t = r : n = r;
4823
+ F(r).requiredHeight <= e ? t = r : n = r;
4752
4824
  }
4753
- ({allLines: L, totalHeight: R} = I(t));
4825
+ ({allLines: L, totalHeight: R, requiredHeight: z} = F(t));
4754
4826
  }
4755
4827
  }
4756
- if (g) return T + R + E;
4757
- let z = n.verticalAnchor ?? "t", B = i, V;
4758
- o === 0 && z === "b" ? (V = T + R + E, B = i - V) : V = n.autoFit === "sp" ? Math.max(o, T + R + E) : o;
4759
- let H, U = Math.max(0, V - T - E);
4760
- H = z === "ctr" ? B + T + (U - R) / 2 : z === "b" ? B + V - E - R : B + T, t.save(), t.textAlign = "left", t.textBaseline = "alphabetic";
4761
- let ee = H, W = j > 1 ? (a - C - w - (j - 1) * M) / j + M : 0, G = Math.max(0, V - T - E), K = L[L.length - 1], q = K ? Math.max(0, K.linePx - K.lineHeight) : 0, te = R - q, ne = o === 0 || te <= G + .5, re = j > 1 && !ne ? Math.ceil(L.length / j) : L.length, ie = 0, ae = 0;
4762
- for (let c of L) {
4763
- let { line: u, linePx: d, lineHeight: f, topGapPx: p, textXOffset: g, bulletLabel: y, bulletFont: b, bulletColor: x, bulletImage: S, alignment: C, isLastLine: w, useResolvedFontMetrics: T } = c;
4764
- j > 1 && ie < j - 1 && ae >= re && (ie++, ae = 0, H = ee), H += p, ae++;
4765
- let E = (n.rtlCol ? j - 1 - ie : ie) * W, D = c.textX + E, O = c.bulletX + E, A = c.textMaxW, M = c.para.rtl === !0, N = M || cn(u.segments), P = u.segments.some((e) => e.isTab);
4766
- if (P) {
4767
- let e = X(c.para.marL, s), n = X(c.para.marR, s), r = M ? n : e + g, i = A + e + n;
4768
- t.font = u.segments.find((e) => e.isTab).font;
4769
- let a = t.measureText(" ").width, o = bn(u.segments.map((e) => {
4770
- if (e.isTab) return {
4828
+ if (h) return T + z + E;
4829
+ let B = t.verticalAnchor ?? "t", V = r, H;
4830
+ a === 0 && B === "b" ? (H = T + z + E, V = r - H) : H = t.autoFit === "sp" ? Math.max(a, T + z + E) : a;
4831
+ let U, W = Math.max(0, H - T - E);
4832
+ U = B === "ctr" ? V + T + (W - z) / 2 : B === "b" ? V + H - E - z : V + T, e.save(), e.textAlign = "left", e.textBaseline = "alphabetic";
4833
+ let ee = U, G = A > 1 ? (i - C - w - (A - 1) * j) / A + j : 0, te = Math.max(0, H - T - E), K = L[L.length - 1], q = K ? Math.max(0, K.linePx - K.lineHeight) : 0, J = z - q, ne = a === 0 || J <= te + .5, re = A > 1 && !ne ? Math.ceil(L.length / A) : L.length, ie = 0, ae = 0;
4834
+ for (let s of L) {
4835
+ let { line: l, linePx: u, lineHeight: d, topGapPx: f, textXOffset: h, bulletLabel: y, bulletFont: b, bulletColor: x, bulletImage: S, alignment: C, isLastLine: w, useResolvedFontMetrics: T } = s;
4836
+ A > 1 && ie < A - 1 && ae >= re && (ie++, ae = 0, U = ee), U += f, ae++;
4837
+ let E = (t.rtlCol ? A - 1 - ie : ie) * G, D = s.textX + E, O = s.bulletX + E, k = s.textMaxW, j = s.para.rtl === !0, M = j || ln(l.segments), N = l.segments.some((e) => e.isTab);
4838
+ if (N) {
4839
+ let t = X(s.para.marL, o), n = X(s.para.marR, o), r = j ? n : t + h, i = k + t + n;
4840
+ e.font = l.segments.find((e) => e.isTab).font;
4841
+ let a = e.measureText(" ").width, c = xn(l.segments.map((t) => {
4842
+ if (t.isTab) return {
4771
4843
  isTab: !0,
4772
4844
  width: 0
4773
4845
  };
4774
- if (e.math) return {
4846
+ if (t.math) return {
4775
4847
  isTab: !1,
4776
- width: e.math.width
4848
+ width: t.math.width
4777
4849
  };
4778
- t.font = e.font;
4779
- let n = e.letterSpacingPx ?? 0;
4850
+ e.font = t.font;
4851
+ let n = t.letterSpacingPx ?? 0;
4780
4852
  return {
4781
4853
  isTab: !1,
4782
- width: e.text ? (e.leadingLetterSpacingPx ?? 0) + $(t, e.text, n) : 0
4854
+ width: t.text ? (t.leadingLetterSpacingPx ?? 0) + $(e, t.text, n) : 0
4783
4855
  };
4784
- }), (c.para.tabStops ?? []).map((e) => ({
4785
- pos: X(e.pos, s),
4856
+ }), (s.para.tabStops ?? []).map((e) => ({
4857
+ pos: X(e.pos, o),
4786
4858
  algn: e.algn
4787
- })), r, i, a, X(c.para.defTabSz ?? 914400, s));
4788
- for (let e = 0; e < u.segments.length; e++) u.segments[e].isTab && (u.segments[e].tabWidthPx = o[e]);
4859
+ })), r, i, a, X(s.para.defTabSz ?? 914400, o));
4860
+ for (let e = 0; e < l.segments.length; e++) l.segments[e].isTab && (l.segments[e].tabWidthPx = c[e]);
4789
4861
  }
4790
- let F = 0, I = 0, L = 0, R = 0;
4791
- for (let e of u.segments) {
4792
- if (e.isTab) {
4793
- F += e.tabWidthPx ?? 0;
4862
+ let P = 0, F = 0, L = 0, R = 0;
4863
+ for (let t of l.segments) {
4864
+ if (t.isTab) {
4865
+ P += t.tabWidthPx ?? 0;
4794
4866
  continue;
4795
4867
  }
4796
- if (e.math) {
4797
- F += e.math.width, I = Math.max(I, e.math.ascent);
4868
+ if (t.math) {
4869
+ P += t.math.width, F = Math.max(F, t.math.ascent);
4798
4870
  continue;
4799
4871
  }
4800
- t.font = e.font;
4801
- let n = t.measureText(e.text || "M"), r = e.letterSpacingPx ?? 0;
4802
- if (F += e.leadingLetterSpacingPx ?? 0, F += e.text ? $(t, e.text, r) : 0, n.actualBoundingBoxAscent > 0 && (I = Math.max(I, n.actualBoundingBoxAscent)), T) {
4872
+ e.font = t.font;
4873
+ let n = e.measureText(t.text || "M"), r = t.letterSpacingPx ?? 0;
4874
+ if (P += t.leadingLetterSpacingPx ?? 0, P += t.text ? $(e, t.text, r) : 0, n.actualBoundingBoxAscent > 0 && (F = Math.max(F, n.actualBoundingBoxAscent)), T) {
4803
4875
  let e = n.fontBoundingBoxAscent ?? 0, t = e + (n.fontBoundingBoxDescent ?? 0);
4804
4876
  t > R && (R = t, L = e);
4805
4877
  }
4806
4878
  }
4807
- let B = T && R > 0 ? z === "t" && I > 0 ? I : Math.max(I, L + Math.max(0, f - R) / 2) : Math.max(f * .8, I), V = H + B, U = D + A, G = S && _ ? m.pictureBulletImages?.has(S.imagePath) ? m.pictureBulletImages.get(S.imagePath) : k(S.imagePath, _) : void 0, K = 0;
4808
- if (N && M) {
4809
- if (y) t.font = b, K = t.measureText(y).width;
4810
- else if (S && G) {
4879
+ let z = T && R > 0 ? B === "t" && F > 0 ? s.para.spaceLine?.type === "pct" ? Math.max(F, L + (s.baselineLineHeight - R) / 2) : F : Math.max(F, L + Math.max(0, d - R) / 2) : Math.max(d * .8, F), V = U + z, H = D + k, W = S && g ? p.pictureBulletImages?.has(S.imagePath) ? p.pictureBulletImages.get(S.imagePath) : I(S.imagePath, g) : void 0, te = 0;
4880
+ if (M && j) {
4881
+ if (y) e.font = b, te = e.measureText(y).width;
4882
+ else if (S && W) {
4811
4883
  let e = S.sizePx;
4812
- K = G.height > 0 ? e * (G.width / G.height) : e;
4884
+ te = W.height > 0 ? e * (W.width / W.height) : e;
4813
4885
  }
4814
4886
  }
4815
- if (y) if (t.font = b, t.fillStyle = x, N && M) {
4816
- let e = t.direction;
4817
- t.direction = "rtl", t.fillText(y, U - K, V), t.direction = e;
4818
- } else t.fillText(y, O, V);
4819
- if (S && _ && G) {
4820
- let e = S.sizePx, n = G.height > 0 ? e * (G.width / G.height) : e, r = V - e;
4821
- N && M ? t.drawImage(G, U - n, r, n, e) : t.drawImage(G, O, r, n, e);
4887
+ if (y) if (e.font = b, e.fillStyle = x, M && j) {
4888
+ let t = e.direction;
4889
+ e.direction = "rtl", e.fillText(y, H - te, V), e.direction = t;
4890
+ } else e.fillText(y, O, V);
4891
+ if (S && g && W) {
4892
+ let t = S.sizePx, n = W.height > 0 ? t * (W.width / W.height) : t, r = V - t;
4893
+ M && j ? e.drawImage(W, H - n, r, n, t) : e.drawImage(W, O, r, n, t);
4822
4894
  }
4823
- let q = D + g, J;
4824
- J = P ? M ? D + A - K - F : q : C === "ctr" ? q + (A - g - F) / 2 : C === "r" ? D + A - K - F : q;
4825
- let te = C === "just" || C === "justLow" ? "just" : C === "thaiDist" ? "thaiDist" : C === "dist" ? "dist" : null, ne = w || (u.endsWithBreak ?? !1), oe = (te && !N && !P ? fn(u.segments, A - g, F, te, ne) : null) ?? u.segments, se = N ? ln(u.segments, M) : null, ce = (e, t) => {
4895
+ let K = D + h, q;
4896
+ q = N ? j ? D + k - te - P : K : C === "ctr" ? K + (k - h - P) / 2 : C === "r" ? D + k - te - P : K;
4897
+ let J = C === "just" || C === "justLow" ? "just" : C === "thaiDist" ? "thaiDist" : C === "dist" ? "dist" : null, ne = w || (l.endsWithBreak ?? !1), oe = (J && !M && !N ? pn(l.segments, k - h, P, J, ne) : null) ?? l.segments, se = M ? un(l.segments, j) : null, ce = (e, t) => {
4826
4898
  if (Math.abs(e - t) !== 1) return 0;
4827
- let n = u.segments[Math.min(e, t)], r = u.segments[Math.max(e, t)];
4899
+ let n = l.segments[Math.min(e, t)], r = l.segments[Math.max(e, t)];
4828
4900
  return n.isTab || n.math || r.isTab || r.math || n.sourceRunId == null || n.sourceRunId !== r.sourceRunId ? 0 : r.leadingLetterSpacingPx ?? 0;
4829
4901
  }, le = oe.length;
4830
- for (let n = 0; n < le; n++) {
4831
- let c = se ? se.order[n] : n, u = oe[c], d = se ? se.rtl[c] : !1;
4832
- if (N && (t.direction = d ? "rtl" : "ltr"), n > 0) {
4833
- let e = se ? se.order[n - 1] : n - 1;
4834
- J += ce(e, c);
4902
+ for (let t = 0; t < le; t++) {
4903
+ let s = se ? se.order[t] : t, l = oe[s], u = se ? se.rtl[s] : !1;
4904
+ if (M && (e.direction = u ? "rtl" : "ltr"), t > 0) {
4905
+ let e = se ? se.order[t - 1] : t - 1;
4906
+ q += ce(e, s);
4835
4907
  }
4836
- if (u.isTab) {
4837
- J += u.tabWidthPx ?? 0;
4908
+ if (l.isTab) {
4909
+ q += l.tabWidthPx ?? 0;
4838
4910
  continue;
4839
4911
  }
4840
- let p = u.jext ?? 0, g = u.splitBefore, _ = u.perGap ?? 0, y = g && g.length > 0 ? g.length * _ : 0;
4841
- if (u.math) {
4842
- let e = Pn.get(u.math.nodes), n = u.math.width, r = u.math.ascent + u.math.descent;
4843
- if (e && n > 0 && r > 0) {
4844
- let i = V - u.math.ascent, a = Fn(e, u.color);
4845
- t.drawImage(a, J, i, n, r);
4912
+ let f = l.jext ?? 0, h = l.splitBefore, g = l.perGap ?? 0, y = h && h.length > 0 ? h.length * g : 0;
4913
+ if (l.math) {
4914
+ let t = Fn.get(l.math.nodes), n = l.math.width, r = l.math.ascent + l.math.descent;
4915
+ if (t && n > 0 && r > 0) {
4916
+ let i = V - l.math.ascent, a = In(t, l.color);
4917
+ e.drawImage(a, q, i, n, r);
4846
4918
  }
4847
- J += n, J += p;
4919
+ q += n, q += f;
4848
4920
  continue;
4849
4921
  }
4850
- t.font = u.font, t.fillStyle = u.color;
4851
- let b = u.drawSizePx ?? u.sizePx, x = V + (u.baseline ? -(u.baseline / 1e5) * u.sizePx : 0), S = u.letterSpacingPx ?? 0;
4852
- if (u.highlight && u.text) {
4853
- let e = $(t, u.text, S) + y + p;
4854
- Mn(t, J, x, e, b, u.highlight, u.color);
4922
+ e.font = l.font, e.fillStyle = l.color;
4923
+ let b = l.drawSizePx ?? l.sizePx, x = V + (l.baseline ? -(l.baseline / 1e5) * l.sizePx : 0), S = l.letterSpacingPx ?? 0;
4924
+ if (l.highlight && l.text) {
4925
+ let t = $(e, l.text, S) + y + f;
4926
+ Nn(e, q, x, t, b, l.highlight, l.color);
4855
4927
  }
4856
- let C = u.shadow, w = (e, t, n, r) => {
4928
+ let C = l.shadow, w = (e, t, n, r) => {
4857
4929
  let i = r === "fill" ? e.fillText.bind(e) : e.strokeText.bind(e);
4858
- if (S !== 0 && nr(t) > 1) {
4930
+ if (S !== 0 && lr(t) > 1) {
4859
4931
  let r = e, a = r.letterSpacing;
4860
- if (ir(e)) {
4932
+ if (dr(e)) {
4861
4933
  r.letterSpacing = `${S}px`, i(t, n, x);
4862
4934
  try {
4863
4935
  r.letterSpacing = a;
@@ -4870,88 +4942,88 @@ function Vr(t, n, r, i, a, o, s, c = null, l = 0, u = !1, d = !1, f = "#000000",
4870
4942
  }
4871
4943
  }
4872
4944
  } else i(t, n, x);
4873
- }, T = (e) => $(t, e, S), E = g && g.length > 0 ? $t([...u.text], g, _, T) : null, D = [...u.text], O = !!g && g.length === D.length - 1 && D.length > 1, k = (e, t) => {
4945
+ }, T = (t) => $(e, t, S), E = h && h.length > 0 ? en([...l.text], h, g, T) : null, D = [...l.text], O = !!h && h.length === D.length - 1 && D.length > 1, k = (e, t) => {
4874
4946
  if (v) {
4875
- let n = O ? S + _ : S;
4876
- Tn(e, u.text, J, x, b, n, t);
4947
+ let n = O ? S + g : S;
4948
+ En(e, l.text, q, x, b, n, t);
4877
4949
  return;
4878
4950
  }
4879
4951
  if (O) {
4880
- let n = t === "fill" ? e.fillText.bind(e) : e.strokeText.bind(e), r = S + _;
4881
- if (ir(e)) {
4952
+ let n = t === "fill" ? e.fillText.bind(e) : e.strokeText.bind(e), r = S + g;
4953
+ if (dr(e)) {
4882
4954
  let t = e, i = t.letterSpacing;
4883
- t.letterSpacing = `${r}px`, n(u.text, J, x);
4955
+ t.letterSpacing = `${r}px`, n(l.text, q, x);
4884
4956
  try {
4885
4957
  t.letterSpacing = i;
4886
4958
  } catch {}
4887
4959
  } else {
4888
- let t = J;
4960
+ let t = q;
4889
4961
  for (let i = 0; i < D.length; i++) {
4890
4962
  let a = D[i];
4891
4963
  n(a, t, x), i < D.length - 1 && (t += e.measureText(a).width + r);
4892
4964
  }
4893
4965
  }
4894
- } else if (E) for (let { text: n, dx: r } of E) w(e, n, J + r, t);
4895
- else w(e, u.text, J, t);
4896
- }, A = u.reflection;
4897
- if (A && u.text) {
4898
- let e = t.canvas.width || 0, n = t.canvas.height || 0;
4899
- if (e > 0 && n > 0) {
4900
- t.font = u.font;
4901
- let r = t.measureText(u.text), i = Number.isFinite(r.actualBoundingBoxAscent) ? r.actualBoundingBoxAscent : b * .8, a = Number.isFinite(r.actualBoundingBoxDescent) ? r.actualBoundingBoxDescent : b * .2, o = Number.isFinite(r.actualBoundingBoxLeft) ? r.actualBoundingBoxLeft : 0, c = Number.isFinite(r.actualBoundingBoxRight) ? r.actualBoundingBoxRight : r.width, l = t.getTransform(), d = Math.abs(l.a * l.d - l.b * l.c), f = d > 0 ? Math.sqrt(d) : 1;
4902
- Jn(t, (e) => {
4903
- e.font = u.font, e.fillStyle = u.color, k(e, "fill");
4966
+ } else if (E) for (let { text: n, dx: r } of E) w(e, n, q + r, t);
4967
+ else w(e, l.text, q, t);
4968
+ }, A = l.reflection;
4969
+ if (A && l.text) {
4970
+ let t = e.canvas.width || 0, n = e.canvas.height || 0;
4971
+ if (t > 0 && n > 0) {
4972
+ e.font = l.font;
4973
+ let r = e.measureText(l.text), i = Number.isFinite(r.actualBoundingBoxAscent) ? r.actualBoundingBoxAscent : b * .8, a = Number.isFinite(r.actualBoundingBoxDescent) ? r.actualBoundingBoxDescent : b * .2, s = Number.isFinite(r.actualBoundingBoxLeft) ? r.actualBoundingBoxLeft : 0, c = Number.isFinite(r.actualBoundingBoxRight) ? r.actualBoundingBoxRight : r.width, u = e.getTransform(), d = Math.abs(u.a * u.d - u.b * u.c), f = d > 0 ? Math.sqrt(d) : 1;
4974
+ Yn(e, (e) => {
4975
+ e.font = l.font, e.fillStyle = l.color, k(e, "fill");
4904
4976
  }, {
4905
- x: (J - o) * f,
4977
+ x: (q - s) * f,
4906
4978
  y: (x - i) * f,
4907
- w: Math.max(1, o + c) * f,
4979
+ w: Math.max(1, s + c) * f,
4908
4980
  h: Math.max(1, i + a) * f
4909
- }, A, s * f, l, e, n), t.font = u.font, t.fillStyle = u.color;
4981
+ }, A, o * f, u, t, n), e.font = l.font, e.fillStyle = l.color;
4910
4982
  }
4911
4983
  }
4912
4984
  if (C) {
4913
- let e = C.dir * Math.PI / 180, n = X(C.dist, s);
4914
- t.save(), t.shadowColor = Q(C.color, C.alpha), t.shadowBlur = X(C.blur, s), t.shadowOffsetX = Math.cos(e) * n, t.shadowOffsetY = Math.sin(e) * n;
4985
+ let t = C.dir * Math.PI / 180, n = X(C.dist, o);
4986
+ e.save(), e.shadowColor = Q(C.color, C.alpha), e.shadowBlur = X(C.blur, o), e.shadowOffsetX = Math.cos(t) * n, e.shadowOffsetY = Math.sin(t) * n;
4915
4987
  }
4916
- k(t, "fill"), C && t.restore();
4917
- let j = u.outline;
4918
- j && j.width > 0 && (t.save(), t.lineWidth = Math.max(.5, X(j.width, s)), t.strokeStyle = j.color ? `#${j.color}` : u.color, t.lineJoin = "round", k(t, "stroke"), t.restore()), t.font = u.font;
4919
- let M = $(t, u.text, S) + y;
4920
- if (h && u.text && h({
4921
- text: u.text,
4922
- inShapeX: J - r,
4923
- inShapeY: H - i,
4924
- w: M + p,
4925
- h: f,
4988
+ k(e, "fill"), C && e.restore();
4989
+ let j = l.outline;
4990
+ j && j.width > 0 && (e.save(), e.lineWidth = Math.max(.5, X(j.width, o)), e.strokeStyle = j.color ? `#${j.color}` : l.color, e.lineJoin = "round", k(e, "stroke"), e.restore()), e.font = l.font;
4991
+ let N = $(e, l.text, S) + y;
4992
+ if (m && l.text && m({
4993
+ text: l.text,
4994
+ inShapeX: q - n,
4995
+ inShapeY: U - r,
4996
+ w: N + f,
4997
+ h: d,
4926
4998
  fontSize: b,
4927
- font: u.font,
4928
- shapeX: r,
4929
- shapeY: i,
4930
- shapeW: a,
4931
- shapeH: o,
4932
- rotation: l,
4933
- hyperlink: u.hyperlink
4934
- }), u.underline && Zt(t, J, x, M + p, b, u.underlineColor ?? u.color, u.underlineStyle, m.dpr), u.strikethrough) {
4935
- let n = Math.max(1, b * .05);
4936
- t.strokeStyle = u.color, t.lineWidth = n, t.setLineDash([]);
4937
- let r = x - b * .32;
4938
- if (u.strikeDouble) {
4939
- let i = n * .9, a = r - i, o = r + i;
4940
- t.beginPath(), t.moveTo(J, a + e(a, n, m.dpr)), t.lineTo(J + M + p, a + e(a, n, m.dpr)), t.moveTo(J, o + e(o, n, m.dpr)), t.lineTo(J + M + p, o + e(o, n, m.dpr)), t.stroke();
4999
+ font: l.font,
5000
+ shapeX: n,
5001
+ shapeY: r,
5002
+ shapeW: i,
5003
+ shapeH: a,
5004
+ rotation: c,
5005
+ hyperlink: l.hyperlink
5006
+ }), l.underline && Qt(e, q, x, N + f, b, l.underlineColor ?? l.color, l.underlineStyle, p.dpr), l.strikethrough) {
5007
+ let t = Math.max(1, b * .05);
5008
+ e.strokeStyle = l.color, e.lineWidth = t, e.setLineDash([]);
5009
+ let n = x - b * .32;
5010
+ if (l.strikeDouble) {
5011
+ let r = t * .9, i = n - r, a = n + r;
5012
+ e.beginPath(), e.moveTo(q, i + _(i, t, p.dpr)), e.lineTo(q + N + f, i + _(i, t, p.dpr)), e.moveTo(q, a + _(a, t, p.dpr)), e.lineTo(q + N + f, a + _(a, t, p.dpr)), e.stroke();
4941
5013
  } else {
4942
- let i = r + e(r, n, m.dpr);
4943
- t.beginPath(), t.moveTo(J, i), t.lineTo(J + M + p, i), t.stroke();
5014
+ let r = n + _(n, t, p.dpr);
5015
+ e.beginPath(), e.moveTo(q, r), e.lineTo(q + N + f, r), e.stroke();
4944
5016
  }
4945
5017
  }
4946
- J += M, J += p;
5018
+ q += N, q += f;
4947
5019
  }
4948
- N && (t.direction = "ltr"), H += d;
5020
+ M && (e.direction = "ltr"), U += u;
4949
5021
  }
4950
- t.restore();
5022
+ e.restore();
4951
5023
  }
4952
- function Hr(e, t, n, r, i) {
5024
+ function Xr(e, t, n, r, i) {
4953
5025
  if (!e) return [];
4954
- let a = zt(t?.rig ?? "threePt", t?.dir ?? "t", t?.rot), o = Gt(n), s = r * i, c = [];
5026
+ let a = Bt(t?.rig ?? "threePt", t?.dir ?? "t", t?.rot), o = Kt(n), s = r * i, c = [];
4955
5027
  return e.bevelT && e.bevelT.w > 0 && e.bevelT.h > 0 && c.push({
4956
5028
  widthPx: e.bevelT.w * s,
4957
5029
  heightPx: e.bevelT.h * s,
@@ -4967,9 +5039,9 @@ function Hr(e, t, n, r, i) {
4967
5039
  bottom: !0
4968
5040
  }), c;
4969
5041
  }
4970
- function Ur(e, t, n, r, i, a) {
5042
+ function Zr(e, t, n, r, i, a) {
4971
5043
  if (!e || !e.extrusionH || e.extrusionH <= 0) return null;
4972
- let o = e.extrusionH * i * a, s = wt(t, n * a, r * a, o);
5044
+ let o = e.extrusionH * i * a, s = Tt(t, n * a, r * a, o);
4973
5045
  if (Math.hypot(s.x, s.y) < .75) return null;
4974
5046
  let c = [
4975
5047
  64,
@@ -4990,14 +5062,14 @@ function Ur(e, t, n, r, i, a) {
4990
5062
  rgb: c
4991
5063
  };
4992
5064
  }
4993
- function Wr(e, t, n, r, i, a, o, s = {}) {
5065
+ function Qr(e, t, n, r, i, a, o, s = {}) {
4994
5066
  if (i <= 0 || a <= 0) return !1;
4995
- let c = e.getTransform(), l = Math.abs(c.a * c.d - c.b * c.c), u = l > 0 ? Math.sqrt(l) : 1, d = Math.max(0, Math.ceil((s.edgePadCss ?? 0) * u)), f = St(t, i, a), p = f.corners;
5067
+ let c = e.getTransform(), l = Math.abs(c.a * c.d - c.b * c.c), u = l > 0 ? Math.sqrt(l) : 1, d = Math.max(0, Math.ceil((s.edgePadCss ?? 0) * u)), f = Ct(t, i, a), p = f.corners;
4996
5068
  if (d > 0) {
4997
- let e = d / u, t = Ge(f.corners, e / i, e / a);
5069
+ let e = d / u, t = Ke(f.corners, e / i, e / a);
4998
5070
  t ? p = t : d = 0;
4999
5071
  }
5000
- let m = d / u, h = Math.max(1, Math.ceil(i * u) + 2 * d), g = Math.max(1, Math.ceil(a * u) + 2 * d), _ = Ae(h, g);
5072
+ let m = d / u, h = Math.max(1, Math.ceil(i * u) + 2 * d), g = Math.max(1, Math.ceil(a * u) + 2 * d), _ = je(h, g);
5001
5073
  if (!_) return !1;
5002
5074
  let v = _.getContext("2d");
5003
5075
  if (!v) return !1;
@@ -5010,17 +5082,17 @@ function Wr(e, t, n, r, i, a, o, s = {}) {
5010
5082
  });
5011
5083
  if (s.extrusion) {
5012
5084
  let e = Math.ceil(Math.hypot(s.extrusion.offsetX, s.extrusion.offsetY)) + 2;
5013
- Xt(v, s.extrusion, x(e));
5085
+ Zt(v, s.extrusion, x(e));
5014
5086
  }
5015
- if (s.bevels && s.bevels.length > 0) for (let e of s.bevels) Yt(v, e, x(Math.ceil(e.widthPx) + 2));
5016
- return s.paintEdges && (v.save(), v.scale(u, u), v.translate(m, m), s.paintEdges(v, 0, 0, i, a), v.restore()), Re(_, e, h, g, p.map((e) => ({
5087
+ if (s.bevels && s.bevels.length > 0) for (let e of s.bevels) Xt(v, e, x(Math.ceil(e.widthPx) + 2));
5088
+ return s.paintEdges && (v.save(), v.scale(u, u), v.translate(m, m), s.paintEdges(v, 0, 0, i, a), v.restore()), ze(_, e, h, g, p.map((e) => ({
5017
5089
  x: n + e.x,
5018
5090
  y: r + e.y
5019
5091
  }))), !0;
5020
5092
  }
5021
- function Gr(e, t, n, r, i, a, o, s, c = 0) {
5093
+ function $r(e, t, n, r, i, a, o, s, c = 0) {
5022
5094
  if (r <= 0 || i <= 0 || a.length === 0) return !1;
5023
- let l = e.getTransform(), u = Math.abs(l.a * l.d - l.b * l.c), d = u > 0 ? Math.sqrt(u) : 1, f = Math.max(0, Math.ceil(c * d)), p = f / d, m = Math.max(1, Math.ceil(r * d) + 2 * f), h = Math.max(1, Math.ceil(i * d) + 2 * f), g = Ae(m, h);
5095
+ let l = e.getTransform(), u = Math.abs(l.a * l.d - l.b * l.c), d = u > 0 ? Math.sqrt(u) : 1, f = Math.max(0, Math.ceil(c * d)), p = f / d, m = Math.max(1, Math.ceil(r * d) + 2 * f), h = Math.max(1, Math.ceil(i * d) + 2 * f), g = je(m, h);
5024
5096
  if (!g) return !1;
5025
5097
  let _ = g.getContext("2d");
5026
5098
  if (!_) return !1;
@@ -5028,7 +5100,7 @@ function Gr(e, t, n, r, i, a, o, s, c = 0) {
5028
5100
  let v = Math.ceil(r * d), y = Math.ceil(i * d);
5029
5101
  for (let e of a) {
5030
5102
  let t = Math.ceil(e.widthPx) + 2;
5031
- Yt(_, e, {
5103
+ Xt(_, e, {
5032
5104
  x: f - t,
5033
5105
  y: f - t,
5034
5106
  w: v + 2 * t,
@@ -5037,17 +5109,17 @@ function Gr(e, t, n, r, i, a, o, s, c = 0) {
5037
5109
  }
5038
5110
  return s && (_.save(), _.scale(d, d), _.translate(p, p), s(_, 0, 0, r, i), _.restore()), e.drawImage(g, t - p, n - p, m / d, h / d), !0;
5039
5111
  }
5040
- var Kr = /* @__PURE__ */ new WeakMap();
5041
- function qr(e) {
5042
- let t = Kr.get(e);
5112
+ var ei = /* @__PURE__ */ new WeakMap();
5113
+ function ti(e) {
5114
+ let t = ei.get(e);
5043
5115
  return t || (t = async (t, n) => {
5044
5116
  let r = await e(t);
5045
5117
  return r.type === n ? r : new Blob([r], { type: n });
5046
- }, Kr.set(e, t)), t;
5118
+ }, ei.set(e, t)), t;
5047
5119
  }
5048
- function Jr(e, t, n = qr(t), r, i, a) {
5049
- let o = qr(t);
5050
- return q(e.posterPath, e.posterMimeType || "application/octet-stream", o, {
5120
+ function ni(e, t, n = ti(t), r, i, a) {
5121
+ let o = ti(t);
5122
+ return J(e.posterPath, e.posterMimeType || "application/octet-stream", o, {
5051
5123
  tiff: r,
5052
5124
  svgDecoder: a,
5053
5125
  ...i ?? {}
@@ -5056,133 +5128,133 @@ function Jr(e, t, n = qr(t), r, i, a) {
5056
5128
  return e;
5057
5129
  });
5058
5130
  }
5059
- function Yr(e, t, n) {
5060
- let r = X(t.x, n), i = X(t.y, n), a = X(t.width, n), o = X(t.height, n);
5131
+ function ri(e, t, n) {
5132
+ let r = X(t.x, n), i = X(t.y, n), o = X(t.width, n), s = X(t.height, n);
5061
5133
  e.save();
5062
5134
  try {
5063
- t.alpha != null && (e.globalAlpha *= t.alpha), (t.rotation !== 0 || t.flipH || t.flipV) && (e.translate(r + a / 2, i + o / 2), e.rotate(t.rotation * Math.PI / 180), e.scale(t.flipH ? -1 : 1, t.flipV ? -1 : 1), e.translate(-(r + a / 2), -(i + o / 2))), le(e, "tiff", {
5135
+ t.alpha != null && (e.globalAlpha *= t.alpha), (t.rotation !== 0 || t.flipH || t.flipV) && (e.translate(r + o / 2, i + s / 2), e.rotate(t.rotation * Math.PI / 180), e.scale(t.flipH ? -1 : 1, t.flipV ? -1 : 1), e.translate(-(r + o / 2), -(i + s / 2))), a(e, "tiff", {
5064
5136
  x: r,
5065
5137
  y: i,
5066
- width: a,
5067
- height: o
5138
+ width: o,
5139
+ height: s
5068
5140
  });
5069
5141
  } finally {
5070
5142
  e.restore();
5071
5143
  }
5072
5144
  }
5073
- async function Xr(e, t, n, r, i, o, s = 1, c, l) {
5074
- if (i) try {
5075
- let a = t.mimeType === "image/svg+xml", u = Ne(t.mimeType, t.srcRect, t.width / Y, t.height / Y);
5076
- if (!u) return;
5077
- let { widthPt: d, heightPt: f } = u, p = En(X(t.width, n), X(t.height, n), s, t.srcRect), h = A(t) || a, g = h ? p : l && !t.duotone ? Dn(l, Z(On(t), h ? void 0 : t.duotone)) : void 0, _ = g && "maxRetainedPixels" in g ? g.maxRetainedPixels : void 0, y = {
5078
- ...g ? {
5079
- targetWidthPx: g.targetWidthPx,
5080
- targetHeightPx: g.targetHeightPx,
5081
- ..._ === void 0 ? {} : { maxRetainedPixels: _ }
5145
+ async function ii(e, t, r, i, a, o, c = 1, l, u) {
5146
+ if (a) try {
5147
+ let d = t.mimeType === "image/svg+xml", f = Pe(t.mimeType, t.srcRect, t.width / Y, t.height / Y);
5148
+ if (!f) return;
5149
+ let { widthPt: p, heightPt: m } = f, h = Dn(X(t.width, r), X(t.height, r), c, t.srcRect), g = z(t) || d, _ = g ? h : u && !t.duotone ? On(u, Z(kn(t), g ? void 0 : t.duotone)) : void 0, v = _ && "maxRetainedPixels" in _ ? _.maxRetainedPixels : void 0, y = {
5150
+ ..._ ? {
5151
+ targetWidthPx: _.targetWidthPx,
5152
+ targetHeightPx: _.targetHeightPx,
5153
+ ...v === void 0 ? {} : { maxRetainedPixels: v }
5082
5154
  } : {},
5083
- workerDecoder: c
5155
+ workerDecoder: l
5084
5156
  }, b;
5085
- if (A(t)) try {
5086
- b = await I(t.svgImagePath, i, y);
5157
+ if (z(t)) try {
5158
+ b = await ce(t.svgImagePath, a, y);
5087
5159
  } catch {
5088
- b = a ? await I(t.imagePath, i, y) : await Je(t.imagePath, t.mimeType, t.duotone, i, {
5089
- widthPt: d,
5090
- heightPt: f,
5091
- ...g ?? {},
5160
+ b = d ? await ce(t.imagePath, a, y) : await Ye(t.imagePath, t.mimeType, t.duotone, a, {
5161
+ widthPt: p,
5162
+ heightPt: m,
5163
+ ..._ ?? {},
5092
5164
  tiff: o
5093
5165
  });
5094
5166
  }
5095
- else b = a ? await I(t.imagePath, i, y) : await Je(t.imagePath, t.mimeType, t.duotone, i, {
5096
- widthPt: d,
5097
- heightPt: f,
5098
- ...g ?? {},
5167
+ else b = d ? await ce(t.imagePath, a, y) : await Ye(t.imagePath, t.mimeType, t.duotone, a, {
5168
+ widthPt: p,
5169
+ heightPt: m,
5170
+ ..._ ?? {},
5099
5171
  tiff: o
5100
5172
  });
5101
- if (!b || r()) return;
5173
+ if (!b || i()) return;
5102
5174
  e.save(), t.alpha != null && (e.globalAlpha *= t.alpha);
5103
- let x = X(t.x, n), S = X(t.y, n), C = X(t.width, n), w = X(t.height, n);
5175
+ let x = X(t.x, r), S = X(t.y, r), C = X(t.width, r), w = X(t.height, r);
5104
5176
  (t.rotation !== 0 || t.flipH || t.flipV) && (e.translate(x + C / 2, S + w / 2), e.rotate(t.rotation * Math.PI / 180), t.flipH && e.scale(-1, 1), t.flipV && e.scale(1, -1), e.translate(-(x + C / 2), -(S + w / 2)));
5105
5177
  let T = (e, n, r, i, a) => {
5106
- t.custGeom && t.custGeom.length > 0 ? Ir(e, t.custGeom, n, r, i, a) : t.prstGeom && v(e, t.prstGeom, n, r, i, a, t.prstAdjust ?? []) || e.rect(n, r, i, a);
5178
+ t.custGeom && t.custGeom.length > 0 ? Wr(e, t.custGeom, n, r, i, a) : t.prstGeom && s(e, t.prstGeom, n, r, i, a, t.prstAdjust ?? []) || e.rect(n, r, i, a);
5107
5179
  }, E = (e, t, n, r, i) => {
5108
5180
  e.beginPath(), T(e, t, n, r, i);
5109
5181
  }, D = (e, n, r, i, a) => {
5110
5182
  (t.prstGeom || t.custGeom && t.custGeom.length > 0) && (E(e, n, r, i, a), e.clip());
5111
- }, O = (e, r, i, a, o) => {
5112
- t.stroke && (e.save(), $r(e, t.stroke, n, {
5113
- x: r,
5183
+ }, O = (e, n, i, a, o) => {
5184
+ t.stroke && (e.save(), si(e, t.stroke, r, {
5185
+ x: n,
5114
5186
  y: i,
5115
5187
  w: a,
5116
5188
  h: o
5117
- }, t.rotation), E(e, r, i, a, o), e.stroke(), e.restore());
5118
- }, k = (e, r, i, a, o) => {
5189
+ }, t.rotation), E(e, n, i, a, o), e.stroke(), e.restore());
5190
+ }, k = (e, n, i, a, o) => {
5119
5191
  let s = t.sp3d;
5120
5192
  if (s && (s.contourW ?? 0) > 0 && s.contourClr) {
5121
- let t = Math.max(.5, s.contourW * n);
5193
+ let t = Math.max(.5, s.contourW * r);
5122
5194
  e.save(), e.beginPath();
5123
5195
  let c = t * 2 + Math.max(a, o);
5124
- e.rect(r - c, i - c, a + 2 * c, o + 2 * c), T(e, r, i, a, o), e.clip("evenodd"), e.beginPath(), E(e, r, i, a, o), e.strokeStyle = Q(s.contourClr), e.lineWidth = t * 2, e.setLineDash([]), e.stroke(), e.restore();
5196
+ e.rect(n - c, i - c, a + 2 * c, o + 2 * c), T(e, n, i, a, o), e.clip("evenodd"), e.beginPath(), E(e, n, i, a, o), e.strokeStyle = Q(s.contourClr), e.lineWidth = t * 2, e.setLineDash([]), e.stroke(), e.restore();
5125
5197
  }
5126
- }, j = t.scene3d && Ct(t.scene3d.camera) ? t.scene3d : null, M = (e, n, r, i, a) => {
5127
- e.save(), D(e, n, r, i, a), je(e, b, t.srcRect, n, r, i, a), e.restore();
5198
+ }, A = t.scene3d && wt(t.scene3d.camera) ? t.scene3d : null, j = (e, n, r, i, a) => {
5199
+ e.save(), D(e, n, r, i, a), Me(e, b, t.srcRect, n, r, i, a), e.restore();
5200
+ }, M = (e, t, n, r, i) => {
5201
+ j(e, t, n, r, i), O(e, t, n, r, i), k(e, t, n, r, i);
5128
5202
  }, N = (e, t, n, r, i) => {
5129
- M(e, t, n, r, i), O(e, t, n, r, i), k(e, t, n, r, i);
5130
- }, P = (e, t, n, r, i) => {
5131
- M(e, t, n, r, i), O(e, t, n, r, i);
5132
- }, F = e.getTransform(), L = Math.abs(F.a * F.d - F.b * F.c), R = L > 0 ? Math.sqrt(L) : 1, z = Hr(t.sp3d, t.scene3d?.lightRig, t.sp3d ? t.sp3d.prstMaterial : void 0, n, R), B = j ? Ur(t.sp3d, j.camera, C, w, n, R) : null, V = t.stroke ? t.stroke.width * n / 2 : 0, H = t.sp3d?.contourW ? t.sp3d.contourW * n : 0, U = B ? Math.hypot(B.offsetX, B.offsetY) / R : 0, ee = V + H + U + 2, G = (e) => {
5133
- if (j) {
5134
- if (Wr(e, j.camera, x, S, C, w, P, {
5135
- bevels: z,
5136
- extrusion: B ?? void 0,
5203
+ j(e, t, n, r, i), O(e, t, n, r, i);
5204
+ }, P = e.getTransform(), F = Math.abs(P.a * P.d - P.b * P.c), I = F > 0 ? Math.sqrt(F) : 1, L = Xr(t.sp3d, t.scene3d?.lightRig, t.sp3d ? t.sp3d.prstMaterial : void 0, r, I), R = A ? Zr(t.sp3d, A.camera, C, w, r, I) : null, B = t.stroke ? t.stroke.width * r / 2 : 0, H = t.sp3d?.contourW ? t.sp3d.contourW * r : 0, U = R ? Math.hypot(R.offsetX, R.offsetY) / I : 0, W = B + H + U + 2, ee = (e) => {
5205
+ if (A) {
5206
+ if (Qr(e, A.camera, x, S, C, w, N, {
5207
+ bevels: L,
5208
+ extrusion: R ?? void 0,
5137
5209
  paintEdges: k,
5138
- edgePadCss: ee
5210
+ edgePadCss: W
5139
5211
  })) return;
5140
- } else if (z.length > 0 && Gr(e, x, S, C, w, z, P, k, ee)) return;
5141
- N(e, x, S, C, w);
5142
- }, K = (e, t, n, r, i, a) => {
5212
+ } else if (L.length > 0 && $r(e, x, S, C, w, L, N, k, W)) return;
5213
+ M(e, x, S, C, w);
5214
+ }, G = (e, t, n, r, i, a) => {
5143
5215
  e.save(), D(e, n, r, i, a), e.fillStyle = t, e.fillRect(n, r, i, a), e.restore();
5144
- }, q = (e, t) => {
5145
- j && Wr(e, j.camera, x, S, C, w, (e, n, r, i, a) => K(e, t, n, r, i, a)) || K(e, t, x, S, C, w);
5146
- }, J = e.getTransform(), te = Math.abs(J.a * J.d - J.b * J.c), ne = te > 0 ? Math.sqrt(te) : 1, re = V + H, ie = (t.custGeom && t.custGeom.length > 0 ? he(t.custGeom, x, S, C, w) : t.prstGeom && m(t.prstGeom.toLowerCase()) ? W(t.prstGeom.toLowerCase(), x, S, C, w, t.prstAdjust ?? []) : null) ?? {
5216
+ }, te = (e, t) => {
5217
+ A && Qr(e, A.camera, x, S, C, w, (e, n, r, i, a) => G(e, t, n, r, i, a)) || G(e, t, x, S, C, w);
5218
+ }, K = e.getTransform(), q = Math.abs(K.a * K.d - K.b * K.c), J = q > 0 ? Math.sqrt(q) : 1, ne = B + H, re = (t.custGeom && t.custGeom.length > 0 ? ge(t.custGeom, x, S, C, w) : t.prstGeom && V(t.prstGeom.toLowerCase()) ? n(t.prstGeom.toLowerCase(), x, S, C, w, t.prstAdjust ?? []) : null) ?? {
5147
5219
  x,
5148
5220
  y: S,
5149
5221
  w: C,
5150
5222
  h: w
5151
- }, ae = j ? Mr(j.camera, J, x, S, C, w, ee, t.shadow?.algn) : {
5152
- bbox: Or(J, ie.x - re, ie.y - re, ie.w + re * 2, ie.h + re * 2),
5153
- anchor: jr(J, x, S, C, w, t.shadow?.algn)
5154
- }, oe = n * ne, se = !!(t.shadow || t.innerShadow || t.glow || t.softEdge || t.reflection), ce = (e) => q(e, "#000");
5155
- Pr(e, t, j && se ? Nr(G, J, ae.bbox, {
5223
+ }, ie = A ? zr(A.camera, K, x, S, C, w, W, t.shadow?.algn) : {
5224
+ bbox: Fr(K, re.x - ne, re.y - ne, re.w + ne * 2, re.h + ne * 2),
5225
+ anchor: Rr(K, x, S, C, w, t.shadow?.algn)
5226
+ }, ae = r * J, oe = !!(t.shadow || t.innerShadow || t.glow || t.softEdge || t.reflection), se = (e) => te(e, "#000");
5227
+ Vr(e, t, A && oe ? Br(ee, K, ie.bbox, {
5156
5228
  w: e.canvas.width || 0,
5157
5229
  h: e.canvas.height || 0
5158
- }) : G, j && se ? Nr(ce, J, ae.bbox, {
5230
+ }) : ee, A && oe ? Br(se, K, ie.bbox, {
5159
5231
  w: e.canvas.width || 0,
5160
5232
  h: e.canvas.height || 0
5161
- }) : ce, ae.bbox, ae.anchor, n, oe, J), e.restore();
5162
- } catch (i) {
5163
- if (a(i, "tiff")) {
5164
- r() || Yr(e, t, n);
5233
+ }) : se, ie.bbox, ie.anchor, r, ae, K), e.restore();
5234
+ } catch (n) {
5235
+ if (b(n, "tiff")) {
5236
+ i() || ri(e, t, r);
5165
5237
  return;
5166
5238
  }
5167
- if (Le(i) || qe(i)) throw i;
5239
+ if (Re(n) || Je(n)) throw n;
5168
5240
  }
5169
5241
  }
5170
- async function Zr(e, t, n, r, i, o, s, c, l = 1, u, d) {
5242
+ async function ai(e, t, n, r, i, o, s, c, l = 1, u, d) {
5171
5243
  let f = X(t.x, n), p = X(t.y, n), m = X(t.width, n), h = X(t.height, n), g, _ = !1;
5172
5244
  if (t.posterPath && i) try {
5173
- g = await Jr(t, i, s, c, t.posterMimeType === "image/svg+xml" ? En(m, h, l) : d ? Dn(d, Z(t.posterPath)) : void 0, u);
5245
+ g = await ni(t, i, s, c, t.posterMimeType === "image/svg+xml" ? Dn(m, h, l) : d ? On(d, Z(t.posterPath)) : void 0, u);
5174
5246
  } catch (e) {
5175
- if (a(e, "tiff")) _ = !0;
5176
- else if (Le(e) || qe(e)) throw e;
5247
+ if (b(e, "tiff")) _ = !0;
5248
+ else if (Re(e) || Je(e)) throw e;
5177
5249
  }
5178
- r() || (e.save(), ei(e, t, n), g ? e.drawImage(g, f, p, m, h) : (e.fillStyle = t.mediaKind === "video" ? "#111" : "#f0f0f0", e.fillRect(f, p, m, h), _ && le(e, "tiff", {
5250
+ r() || (e.save(), ci(e, t, n), g ? e.drawImage(g, f, p, m, h) : (e.fillStyle = t.mediaKind === "video" ? "#111" : "#f0f0f0", e.fillRect(f, p, m, h), _ && a(e, "tiff", {
5179
5251
  x: f,
5180
5252
  y: p,
5181
5253
  width: m,
5182
5254
  height: h
5183
- })), o || an(e, f + m / 2, p + h / 2, m, h, "paused"), e.restore());
5255
+ })), o || on(e, f + m / 2, p + h / 2, m, h, "paused"), e.restore());
5184
5256
  }
5185
- function Qr(e, t, n, r, i, a, o) {
5257
+ function oi(e, t, n, r, i, a, o) {
5186
5258
  let s = Math.max(.5, X(r.width, a)), c = n.x - t.x, l = n.y - t.y, u = Math.hypot(c, l);
5187
5259
  if (u === 0) return;
5188
5260
  let d = -l / u, f = c / u, p;
@@ -5232,199 +5304,201 @@ function Qr(e, t, n, r, i, a, o) {
5232
5304
  break;
5233
5305
  default: return;
5234
5306
  }
5235
- e.save(), e.globalCompositeOperation = "destination-out", e.strokeStyle = "#000", e.lineWidth = s + .5, e.setLineDash([]), e.beginPath(), e.moveTo(t.x, t.y), e.lineTo(n.x, n.y), e.stroke(), e.globalCompositeOperation = "source-over", e.strokeStyle = (r.fill ? Nn(r.fill, e, Math.min(t.x, n.x), Math.min(t.y, n.y), Math.max(1, Math.abs(n.x - t.x)), Math.max(1, Math.abs(n.y - t.y)), o) : null) ?? Q(r.color);
5307
+ e.save(), e.globalCompositeOperation = "destination-out", e.strokeStyle = "#000", e.lineWidth = s + .5, e.setLineDash([]), e.beginPath(), e.moveTo(t.x, t.y), e.lineTo(n.x, n.y), e.stroke(), e.globalCompositeOperation = "source-over", e.strokeStyle = (r.fill ? Pn(r.fill, e, Math.min(t.x, n.x), Math.min(t.y, n.y), Math.max(1, Math.abs(n.x - t.x)), Math.max(1, Math.abs(n.y - t.y)), o) : null) ?? Q(r.color);
5236
5308
  for (let r of p) {
5237
5309
  let i = d * (s * r.offset), a = f * (s * r.offset);
5238
5310
  e.lineWidth = Math.max(.5, s * r.widthFrac), e.beginPath(), e.moveTo(t.x + i, t.y + a), e.lineTo(n.x + i, n.y + a), e.stroke();
5239
5311
  }
5240
5312
  e.restore();
5241
5313
  }
5242
- function $r(e, t, n, r, i = 0) {
5243
- if (ke(e, t, n), t?.fill && r) {
5244
- let n = Nn(t.fill, e, r.x, r.y, r.w, r.h, i);
5314
+ function si(e, t, n, r, i = 0) {
5315
+ if (Ae(e, t, n), t?.fill && r) {
5316
+ let n = Pn(t.fill, e, r.x, r.y, r.w, r.h, i);
5245
5317
  n && (e.strokeStyle = n);
5246
5318
  }
5247
5319
  }
5248
- function ei(e, t, n) {
5320
+ function ci(e, t, n) {
5249
5321
  if (t.rotation === 0 && !t.flipH && !t.flipV) return;
5250
5322
  let r = X(t.x, n), i = X(t.y, n), a = X(t.width, n), o = X(t.height, n);
5251
5323
  e.translate(r + a / 2, i + o / 2), e.rotate(t.rotation * Math.PI / 180), t.flipH && e.scale(-1, 1), t.flipV && e.scale(1, -1), e.translate(-(r + a / 2), -(i + o / 2));
5252
5324
  }
5253
- function ti(t, n, r, i, a = {
5325
+ function li(e, t, n, r, i = {
5254
5326
  themeMajorFont: null,
5255
5327
  themeMinorFont: null,
5256
5328
  dpr: 1
5257
- }, o) {
5258
- t.save(), ei(t, n, r);
5259
- let s = X(n.x, r), c = X(n.y, r), l = n.cols.map((e) => X(e, r)), u = l.length, d = (e, t) => {
5329
+ }, a) {
5330
+ e.save(), ci(e, t, n);
5331
+ let o = X(t.x, n), s = X(t.y, n), c = t.cols.map((e) => X(e, n)), l = c.length, u = (e, t) => {
5260
5332
  let n = 0;
5261
- for (let r = 0; r < t; r++) n += l[e + r] ?? 0;
5333
+ for (let r = 0; r < t; r++) n += c[e + r] ?? 0;
5262
5334
  return n;
5263
- }, f = n.rows.map((e) => X(e.height, r));
5264
- for (let e = 0; e < n.rows.length; e++) {
5265
- let o = n.rows[e];
5266
- for (let n = 0; n < o.cells.length; n++) {
5267
- let s = o.cells[n];
5268
- if (s.hMerge || s.vMerge || (s.rowSpan || 1) > 1 || !s.textBody) continue;
5269
- let c = d(n, s.gridSpan || 1), l = Vr(t, s.textBody, 0, 0, c, 0, r, null, 0, !1, !1, "#000000", i, a, void 0, !0, void 0, !1, o.height === 0) || 0;
5270
- l > f[e] && (f[e] = l);
5335
+ }, d = [...t.rows.map((e) => X(e.height, n))], f = t.rows.reduce((e, t) => e + t.height, 0), p = t.height > f;
5336
+ for (let a = 0; a < t.rows.length; a++) {
5337
+ let o = t.rows[a];
5338
+ for (let t = 0; t < o.cells.length; t++) {
5339
+ let s = o.cells[t];
5340
+ if (s.hMerge || s.vMerge || (s.rowSpan || 1) > 1 || !s.textBody || o.height > 0 && !p) continue;
5341
+ let c = u(t, s.gridSpan || 1), l = Yr(e, s.textBody, 0, 0, c, 0, n, null, 0, !1, !1, "#000000", r, i, void 0, !0, void 0, !1, o.height === 0) || 0;
5342
+ l > d[a] && (d[a] = l);
5271
5343
  }
5272
5344
  }
5273
- for (let e = 0; e < n.rows.length; e++) {
5274
- let o = n.rows[e];
5345
+ for (let a = 0; a < t.rows.length; a++) {
5346
+ let o = t.rows[a];
5275
5347
  for (let s = 0; s < o.cells.length; s++) {
5276
5348
  let c = o.cells[s];
5277
5349
  if (c.hMerge || c.vMerge) continue;
5278
5350
  let l = c.rowSpan || 1;
5279
5351
  if (l <= 1 || !c.textBody) continue;
5280
- let u = d(s, c.gridSpan || 1), p = n.rows.slice(e, Math.min(n.rows.length, e + l)).some((e) => e.height === 0), m = Vr(t, c.textBody, 0, 0, u, 0, r, null, 0, !1, !1, "#000000", i, a, void 0, !0, void 0, !1, p) || 0, h = 0;
5281
- for (let t = 0; t < l && e + t < f.length; t++) h += f[e + t];
5282
- if (m > h) {
5283
- let t = (m - h) / l;
5284
- for (let n = 0; n < l && e + n < f.length; n++) f[e + n] += t;
5352
+ let f = u(s, c.gridSpan || 1), m = t.rows.slice(a, Math.min(t.rows.length, a + l)).some((e) => e.height === 0);
5353
+ if (!m && !p) continue;
5354
+ let h = Yr(e, c.textBody, 0, 0, f, 0, n, null, 0, !1, !1, "#000000", r, i, void 0, !0, void 0, !1, m) || 0, g = 0;
5355
+ for (let e = 0; e < l && a + e < d.length; e++) g += d[a + e];
5356
+ if (h > g) {
5357
+ let e = (h - g) / l;
5358
+ for (let t = 0; t < l && a + t < d.length; t++) d[a + t] += e;
5285
5359
  }
5286
5360
  }
5287
5361
  }
5288
- let p = l.reduce((e, t) => e + t, 0), m = Array(u);
5289
- if (n.rtl) {
5290
- let e = s + p;
5291
- for (let t = 0; t < u; t++) e -= l[t], m[t] = e;
5362
+ let m = c.reduce((e, t) => e + t, 0), h = Array(l);
5363
+ if (t.rtl) {
5364
+ let e = o + m;
5365
+ for (let t = 0; t < l; t++) e -= c[t], h[t] = e;
5292
5366
  } else {
5293
- let e = s;
5294
- for (let t = 0; t < u; t++) m[t] = e, e += l[t];
5367
+ let e = o;
5368
+ for (let t = 0; t < l; t++) h[t] = e, e += c[t];
5295
5369
  }
5296
- let h = (e, t) => n.rtl ? m[e + t - 1] : m[e], g = Array(n.rows.length);
5370
+ let g = (e, n) => t.rtl ? h[e + n - 1] : h[e], v = Array(t.rows.length);
5297
5371
  {
5298
- let e = c;
5299
- for (let t = 0; t < n.rows.length; t++) g[t] = e, e += f[t];
5372
+ let e = s;
5373
+ for (let n = 0; n < t.rows.length; n++) v[n] = e, e += d[n];
5300
5374
  }
5301
- let _, v = {
5375
+ let y, b = {
5302
5376
  row: 0,
5303
5377
  column: 0
5304
5378
  };
5305
- if (o) {
5306
- let e = X(n.width, r), t = X(n.height, r), i = s + e / 2, a = c + t / 2, l = n.rotation * Math.PI / 180, u = Math.cos(l), d = Math.sin(l);
5307
- _ = (e) => {
5308
- let t = e.shapeX + e.shapeW / 2 - i, r = e.shapeY + e.shapeH / 2 - a;
5309
- n.flipH && (t = -t), n.flipV && (r = -r);
5310
- let s = i + u * t - d * r, c = a + d * t + u * r;
5311
- o({
5379
+ if (a) {
5380
+ let e = X(t.width, n), r = X(t.height, n), i = o + e / 2, c = s + r / 2, l = t.rotation * Math.PI / 180, u = Math.cos(l), d = Math.sin(l);
5381
+ y = (e) => {
5382
+ let n = e.shapeX + e.shapeW / 2 - i, r = e.shapeY + e.shapeH / 2 - c;
5383
+ t.flipH && (n = -n), t.flipV && (r = -r);
5384
+ let o = i + u * n - d * r, s = c + d * n + u * r;
5385
+ a({
5312
5386
  ...e,
5313
- ...n.id === void 0 ? {} : { shapeId: n.id },
5314
- shapeX: s - e.shapeW / 2,
5315
- shapeY: c - e.shapeH / 2,
5316
- rotation: n.rotation,
5317
- ...n.flipH ? { shapeFlipH: !0 } : {},
5318
- ...n.flipV ? { shapeFlipV: !0 } : {},
5319
- tableCell: v
5387
+ ...t.id === void 0 ? {} : { shapeId: t.id },
5388
+ shapeX: o - e.shapeW / 2,
5389
+ shapeY: s - e.shapeH / 2,
5390
+ rotation: t.rotation,
5391
+ ...t.flipH ? { shapeFlipH: !0 } : {},
5392
+ ...t.flipV ? { shapeFlipV: !0 } : {},
5393
+ tableCell: b
5320
5394
  });
5321
5395
  };
5322
5396
  }
5323
- let y = [], b = n.rows.map(() => Array(u).fill(-1));
5324
- for (let e = 0; e < n.rows.length; e++) {
5325
- let t = n.rows[e], r = g[e];
5326
- for (let i = 0; i < t.cells.length; i++) {
5327
- let a = t.cells[i];
5397
+ let x = [], S = t.rows.map(() => Array(l).fill(-1));
5398
+ for (let e = 0; e < t.rows.length; e++) {
5399
+ let n = t.rows[e], r = v[e];
5400
+ for (let i = 0; i < n.cells.length; i++) {
5401
+ let a = n.cells[i];
5328
5402
  if (a.hMerge || a.vMerge) continue;
5329
- let o = a.gridSpan || 1, s = a.rowSpan || 1, c = d(i, o), l = 0;
5330
- for (let t = 0; t < s; t++) l += f[e + t] ?? 0;
5331
- let p = h(i, o), m = Math.min(e + s - 1, n.rows.length - 1), g = y.length;
5332
- y.push({
5403
+ let o = a.gridSpan || 1, s = a.rowSpan || 1, c = u(i, o), f = 0;
5404
+ for (let t = 0; t < s; t++) f += d[e + t] ?? 0;
5405
+ let p = g(i, o), m = Math.min(e + s - 1, t.rows.length - 1), h = x.length;
5406
+ x.push({
5333
5407
  cell: a,
5334
5408
  colX: p,
5335
5409
  rowY: r,
5336
5410
  cellW: c,
5337
- cellH: l,
5411
+ cellH: f,
5338
5412
  ci: i,
5339
5413
  ri: e,
5340
5414
  span: o,
5341
5415
  lastRi: m
5342
5416
  });
5343
- for (let t = e; t <= m; t++) for (let e = i; e < i + o && e < u; e++) b[t][e] = g;
5417
+ for (let t = e; t <= m; t++) for (let e = i; e < i + o && e < l; e++) S[t][e] = h;
5344
5418
  }
5345
5419
  }
5346
- for (let { cell: e, colX: o, rowY: s, cellW: c, cellH: l, ci: u, ri: d } of y) {
5347
- let f = Nn(e.fill, t, o, s, c, l, n.rotation);
5348
- if (f && (t.fillStyle = f, t.fillRect(o, s, c, l)), e.textBody) {
5349
- _ && (v = {
5420
+ for (let { cell: a, colX: o, rowY: s, cellW: c, cellH: l, ci: u, ri: d } of x) {
5421
+ let f = Pn(a.fill, e, o, s, c, l, t.rotation);
5422
+ if (f && (e.fillStyle = f, e.fillRect(o, s, c, l)), a.textBody) {
5423
+ y && (b = {
5350
5424
  row: d,
5351
5425
  column: u
5352
5426
  });
5353
- let n = e.textColor ? Q(e.textColor) : null;
5354
- Vr(t, e.textBody, o, s, c, l, r, n, 0, !1, !1, "#000000", i, a, _);
5427
+ let t = a.textColor ? Q(a.textColor) : null;
5428
+ Yr(e, a.textBody, o, s, c, l, n, t, 0, !1, !1, "#000000", r, i, y);
5355
5429
  }
5356
5430
  }
5357
- let x = a.dpr, S = (e, t) => {
5358
- if (e < 0 || e >= b.length || t < 0 || t >= u) return null;
5359
- let n = b[e][t];
5360
- return n < 0 ? null : y[n];
5361
- }, C = (i, a, o, s, c) => {
5362
- if ($r(t, i, r, {
5363
- x: Math.min(a, s),
5364
- y: Math.min(o, c),
5365
- w: Math.max(1, Math.abs(s - a)),
5366
- h: Math.max(1, Math.abs(c - o))
5367
- }, n.rotation), i.cmpd === "dbl" && !i.dashStyle && !i.customDash?.length && (a === s || o === c)) {
5368
- t.fillStyle = t.strokeStyle, xe(t, a, o, s, c, Math.max(.5, X(i.width, r)), x);
5431
+ let C = i.dpr, w = (e, t) => {
5432
+ if (e < 0 || e >= S.length || t < 0 || t >= l) return null;
5433
+ let n = S[e][t];
5434
+ return n < 0 ? null : x[n];
5435
+ }, T = (r, i, a, o, s) => {
5436
+ if (si(e, r, n, {
5437
+ x: Math.min(i, o),
5438
+ y: Math.min(a, s),
5439
+ w: Math.max(1, Math.abs(o - i)),
5440
+ h: Math.max(1, Math.abs(s - a))
5441
+ }, t.rotation), r.cmpd === "dbl" && !r.dashStyle && !r.customDash?.length && (i === o || a === s)) {
5442
+ e.fillStyle = e.strokeStyle, Se(e, i, a, o, s, Math.max(.5, X(r.width, n)), C);
5369
5443
  return;
5370
5444
  }
5371
- let l = a === s ? e(a, t.lineWidth, x) : 0, u = o === c ? e(o, t.lineWidth, x) : 0;
5372
- t.beginPath(), t.moveTo(a + l, o + u), t.lineTo(s + l, c + u), t.stroke();
5445
+ let c = i === o ? _(i, e.lineWidth, C) : 0, l = a === s ? _(a, e.lineWidth, C) : 0;
5446
+ e.beginPath(), e.moveTo(i + c, a + l), e.lineTo(o + c, s + l), e.stroke();
5373
5447
  };
5374
- for (let e of y) {
5375
- let { cell: i, colX: a, rowY: o, cellW: s, cellH: c } = e;
5376
- t.save();
5377
- let l = n.rtl ? i.borderR : i.borderL, p = n.rtl ? i.borderL : i.borderR, m = n.rtl ? e.ci + e.span === u : e.ci === 0, _ = n.rtl ? e.ci === 0 : e.ci + e.span === u, v = n.rtl ? e.ci - 1 : e.ci + e.span, y = (e) => n.rtl ? e.borderR : e.borderL;
5378
- if (e.ri === 0 && i.borderT && C(i.borderT, a, o, a + s, o), m && l && C(l, a, o, a, o + c), e.lastRi === n.rows.length - 1) {
5448
+ for (let r of x) {
5449
+ let { cell: i, colX: a, rowY: o, cellW: s, cellH: c } = r;
5450
+ e.save();
5451
+ let f = t.rtl ? i.borderR : i.borderL, p = t.rtl ? i.borderL : i.borderR, m = t.rtl ? r.ci + r.span === l : r.ci === 0, h = t.rtl ? r.ci === 0 : r.ci + r.span === l, _ = t.rtl ? r.ci - 1 : r.ci + r.span, y = (e) => t.rtl ? e.borderR : e.borderL;
5452
+ if (r.ri === 0 && i.borderT && T(i.borderT, a, o, a + s, o), m && f && T(f, a, o, a, o + c), r.lastRi === t.rows.length - 1) {
5379
5453
  let e = i.borderB;
5380
- e && C(e, a, o + c, a + s, o + c);
5454
+ e && T(e, a, o + c, a + s, o + c);
5381
5455
  } else {
5382
- let t = e.lastRi + 1, n = o + c, r = Math.min(e.ci + e.span, u), a = e.ci;
5383
- for (; a < r;) {
5384
- let e = b[t][a], o = a + 1;
5385
- for (; o < r && b[t][o] === e;) o++;
5386
- let s = S(t, a), c = hn(i.borderB, s ? s.cell.borderT : null);
5456
+ let e = r.lastRi + 1, t = o + c, n = Math.min(r.ci + r.span, l), a = r.ci;
5457
+ for (; a < n;) {
5458
+ let r = S[e][a], o = a + 1;
5459
+ for (; o < n && S[e][o] === r;) o++;
5460
+ let s = w(e, a), c = gn(i.borderB, s ? s.cell.borderT : null);
5387
5461
  if (c) {
5388
- let e = h(a, o - a);
5389
- C(c, e, n, e + d(a, o - a), n);
5462
+ let e = g(a, o - a);
5463
+ T(c, e, t, e + u(a, o - a), t);
5390
5464
  }
5391
5465
  a = o;
5392
5466
  }
5393
5467
  }
5394
- if (_) {
5468
+ if (h) {
5395
5469
  let e = p;
5396
- e && C(e, a + s, o, a + s, o + c);
5470
+ e && T(e, a + s, o, a + s, o + c);
5397
5471
  } else {
5398
- let t = a + s, n = e.ri;
5399
- for (; n <= e.lastRi;) {
5400
- let r = b[n][v], i = n;
5401
- for (; i + 1 <= e.lastRi && b[i + 1][v] === r;) i++;
5402
- let a = S(n, v), o = hn(p, a ? y(a.cell) : null);
5403
- o && C(o, t, g[n], t, g[i] + f[i]), n = i + 1;
5472
+ let e = a + s, t = r.ri;
5473
+ for (; t <= r.lastRi;) {
5474
+ let n = S[t][_], i = t;
5475
+ for (; i + 1 <= r.lastRi && S[i + 1][_] === n;) i++;
5476
+ let a = w(t, _), o = gn(p, a ? y(a.cell) : null);
5477
+ o && T(o, e, v[t], e, v[i] + d[i]), t = i + 1;
5404
5478
  }
5405
5479
  }
5406
- i.diagonalTL && ($r(t, i.diagonalTL, r, {
5480
+ i.diagonalTL && (si(e, i.diagonalTL, n, {
5407
5481
  x: a,
5408
5482
  y: o,
5409
5483
  w: s,
5410
5484
  h: c
5411
- }, n.rotation), t.beginPath(), t.moveTo(a, o), t.lineTo(a + s, o + c), t.stroke()), i.diagonalTR && ($r(t, i.diagonalTR, r, {
5485
+ }, t.rotation), e.beginPath(), e.moveTo(a, o), e.lineTo(a + s, o + c), e.stroke()), i.diagonalTR && (si(e, i.diagonalTR, n, {
5412
5486
  x: a,
5413
5487
  y: o,
5414
5488
  w: s,
5415
5489
  h: c
5416
- }, n.rotation), t.beginPath(), t.moveTo(a + s, o), t.lineTo(a, o + c), t.stroke()), t.restore();
5490
+ }, t.rotation), e.beginPath(), e.moveTo(a + s, o), e.lineTo(a, o + c), e.stroke()), e.restore();
5417
5491
  }
5418
- t.restore();
5492
+ e.restore();
5419
5493
  }
5420
- function ni(e, t, n, r) {
5494
+ function ui(e, t, n, r) {
5421
5495
  e.save(), e.globalAlpha = t.opacity, e.fillStyle = t.color, e.fillRect(0, 0, n, r), e.restore();
5422
5496
  }
5423
- var ri = /* @__PURE__ */ new WeakMap();
5424
- function ii(e) {
5425
- ri.set(e, (ri.get(e) ?? 0) + 1);
5497
+ var di = /* @__PURE__ */ new WeakMap();
5498
+ function fi(e) {
5499
+ di.set(e, (di.get(e) ?? 0) + 1);
5426
5500
  }
5427
- function ai(e, t, n, r, i) {
5501
+ function pi(e, t, n, r, i) {
5428
5502
  e.save(), e.fillStyle = "#f7f7f8", e.fillRect(0, 0, t, n);
5429
5503
  let a = Math.max(12, Math.min(t, n) * .04);
5430
5504
  e.strokeStyle = "#c8ccd2", e.lineWidth = Math.max(1, Math.min(t, n) * .004), e.setLineDash([e.lineWidth * 6, e.lineWidth * 5]), e.strokeRect(a, a, t - a * 2, n - a * 2), e.setLineDash([]);
@@ -5444,63 +5518,63 @@ function ai(e, t, n, r, i) {
5444
5518
  for (let t of f.slice(0, 4)) e.fillText(t, o, h), h += m;
5445
5519
  e.restore();
5446
5520
  }
5447
- async function oi(e, t, n, r, i = {}, a) {
5448
- return si(e, t, n, r, i, a);
5521
+ async function mi(e, t, n, r, i = {}, a) {
5522
+ return hi(e, t, n, r, i, a);
5449
5523
  }
5450
- async function si(e, t, n, r, i = {}, a) {
5451
- let o = i.fetchImage ?? (i.fetchMedia ? qr(i.fetchMedia) : void 0), s = (ri.get(e) ?? 0) + 1;
5452
- ri.set(e, s);
5453
- let c = () => ri.get(e) !== s, l = () => c() ? Promise.resolve(e) : ci(e, t, n, r, i, a, o, c);
5454
- return o && jn(t) ? j(o, i.imageResources, l) : l();
5524
+ async function hi(e, t, n, r, i = {}, a) {
5525
+ let o = i.fetchImage ?? (i.fetchMedia ? ti(i.fetchMedia) : void 0), s = (di.get(e) ?? 0) + 1;
5526
+ di.set(e, s);
5527
+ let c = () => di.get(e) !== s, l = () => c() ? Promise.resolve(e) : gi(e, t, n, r, i, a, o, c);
5528
+ return o && Mn(t) ? fe(o, i.imageResources, l) : l();
5455
5529
  }
5456
- async function ci(e, t, n, r, i = {}, o, s, c = () => !1) {
5457
- let l = i.width ?? ((oe(e) ? e.offsetWidth : 0) || 960), u = l / n, d = Math.round(l), f = Math.round(r * u), p = i.dpr ?? L(), m = Ve(d * p, f * p), h = m.clamped ? p * m.scale : p, g = await An(t, d, f, u, h, i.imageResources, i.fetchImage, i.fetchMedia, s, i.tiff);
5458
- e.width = m.width, e.height = m.height, oe(e) && (e.style.width = `${d}px`, e.style.display || (e.style.display = "block"));
5459
- let _ = e.getContext("2d");
5530
+ async function gi(t, n, r, i, a = {}, o, s, c = () => !1) {
5531
+ let l = a.width ?? ((P(t) ? t.offsetWidth : 0) || 960), u = l / r, d = Math.round(l), f = Math.round(i * u), p = a.dpr ?? e(), m = He(d * p, f * p), h = m.clamped ? p * m.scale : p, g = await jn(n, d, f, u, h, a.imageResources, a.fetchImage, a.fetchMedia, s, a.tiff);
5532
+ t.width = m.width, t.height = m.height, P(t) && (t.style.width = `${d}px`, t.style.display || (t.style.display = "block"));
5533
+ let _ = t.getContext("2d");
5460
5534
  if (!_) throw Error("Could not get 2D context");
5461
- if (_.scale(h, h), t.parseError) return ai(_, d, f, t.slideNumber, t.parseError), e;
5462
- let v = i.defaultTextColor ? `#${i.defaultTextColor}` : "#000000", y = /* @__PURE__ */ new Map(), b = {
5463
- themeMajorFont: i.majorFont ?? null,
5464
- themeMinorFont: i.minorFont ?? null,
5465
- themeHlinkColor: i.hlinkColor ?? null,
5466
- embeddedFontAliases: i.embeddedFontAliases,
5467
- embeddedFontAuthoredFamilies: i.embeddedFontAuthoredFamilies,
5535
+ if (_.scale(h, h), n.parseError) return pi(_, d, f, n.slideNumber, n.parseError), t;
5536
+ let v = a.defaultTextColor ? `#${a.defaultTextColor}` : "#000000", y = /* @__PURE__ */ new Map(), x = {
5537
+ themeMajorFont: a.majorFont ?? null,
5538
+ themeMinorFont: a.minorFont ?? null,
5539
+ themeHlinkColor: a.hlinkColor ?? null,
5540
+ embeddedFontAliases: a.embeddedFontAliases,
5541
+ embeddedFontAuthoredFamilies: a.embeddedFontAuthoredFamilies,
5468
5542
  dpr: h,
5469
- smartArtFallbackTextColor: yn(t.background, v),
5543
+ smartArtFallbackTextColor: bn(n.background, v),
5470
5544
  pictureBulletImages: y
5471
5545
  };
5472
- if (await or(_, t.background, d, f, u, c, i.fetchImage, i.tiff, i.svgDecoder, g), c() || (i.math && await Ln(t, i.math), c())) return e;
5473
- let x = t.slideNumber;
5474
- for (let e of t.elements) if (e.type === "picture" && i.fetchImage) {
5475
- let t = e, n = t.mimeType === "image/svg+xml", r = A(t) || n, a = !r && !t.duotone ? Dn(g, Z(On(t), t.duotone)) : void 0, o = En(X(t.width, u), X(t.height, u), h, t.srcRect), s = r ? o : a, c = s && "maxRetainedPixels" in s ? s.maxRetainedPixels : void 0, l = {
5546
+ if (await pr(_, n.background, d, f, u, c, a.fetchImage, a.tiff, a.svgDecoder, g), c() || (a.math && await Rn(n, a.math), c())) return t;
5547
+ let S = n.slideNumber;
5548
+ for (let e of n.elements) if (e.type === "picture" && a.fetchImage) {
5549
+ let t = e, n = t.mimeType === "image/svg+xml", r = z(t) || n, i = !r && !t.duotone ? On(g, Z(kn(t), t.duotone)) : void 0, o = Dn(X(t.width, u), X(t.height, u), h, t.srcRect), s = r ? o : i, c = s && "maxRetainedPixels" in s ? s.maxRetainedPixels : void 0, l = {
5476
5550
  ...s ? {
5477
5551
  targetWidthPx: s.targetWidthPx,
5478
5552
  targetHeightPx: s.targetHeightPx,
5479
5553
  ...c === void 0 ? {} : { maxRetainedPixels: c }
5480
5554
  } : {},
5481
- workerDecoder: i.svgDecoder
5555
+ workerDecoder: a.svgDecoder
5482
5556
  };
5483
- if (A(t)) I(t.svgImagePath, i.fetchImage, l).catch(() => void 0);
5484
- else if (n) I(t.imagePath, i.fetchImage, l).catch(() => void 0);
5557
+ if (z(t)) ce(t.svgImagePath, a.fetchImage, l).catch(() => void 0);
5558
+ else if (n) ce(t.imagePath, a.fetchImage, l).catch(() => void 0);
5485
5559
  else {
5486
- let e = Ne(t.mimeType, t.srcRect, t.width / Y, t.height / Y);
5560
+ let e = Pe(t.mimeType, t.srcRect, t.width / Y, t.height / Y);
5487
5561
  if (!e) continue;
5488
- Je(t.imagePath, t.mimeType, t.duotone, i.fetchImage, {
5562
+ Ye(t.imagePath, t.mimeType, t.duotone, a.fetchImage, {
5489
5563
  widthPt: e.widthPt,
5490
5564
  heightPt: e.heightPt,
5491
5565
  ...s ?? {},
5492
- tiff: i.tiff,
5493
- svgDecoder: i.svgDecoder
5566
+ tiff: a.tiff,
5567
+ svgDecoder: a.svgDecoder
5494
5568
  }).catch(() => void 0);
5495
5569
  }
5496
5570
  } else if (e.type === "media") {
5497
5571
  let t = e;
5498
- t.posterPath && i.fetchMedia && Jr(t, i.fetchMedia, s, i.tiff, t.posterMimeType === "image/svg+xml" ? En(X(t.width, u), X(t.height, u), h) : Dn(g, Z(t.posterPath)), i.svgDecoder).catch(() => void 0);
5572
+ t.posterPath && a.fetchMedia && ni(t, a.fetchMedia, s, a.tiff, t.posterMimeType === "image/svg+xml" ? Dn(X(t.width, u), X(t.height, u), h) : On(g, Z(t.posterPath)), a.svgDecoder).catch(() => void 0);
5499
5573
  }
5500
- let S = /* @__PURE__ */ new Map();
5501
- if (i.fetchImage) {
5502
- let n = i.fetchImage, r = /* @__PURE__ */ new Map(), o = [];
5503
- for (let e of t.elements) {
5574
+ let C = /* @__PURE__ */ new Map();
5575
+ if (a.fetchImage) {
5576
+ let e = a.fetchImage, r = /* @__PURE__ */ new Map(), i = [];
5577
+ for (let e of n.elements) {
5504
5578
  if (e.type !== "chart" || !Number.isFinite(e.width) || e.width <= 0 || !Number.isFinite(e.height) || e.height <= 0) continue;
5505
5579
  let t = {
5506
5580
  widthPt: e.width / Y,
@@ -5508,8 +5582,8 @@ async function ci(e, t, n, r, i = {}, o, s, c = () => !1) {
5508
5582
  targetWidthPx: X(e.width, u) * h,
5509
5583
  targetHeightPx: X(e.height, u) * h
5510
5584
  }, n = [], r = !0;
5511
- for (let i of Te(e.chart)) {
5512
- let e = Ee(i, t);
5585
+ for (let i of Ee(e.chart)) {
5586
+ let e = De(i, t);
5513
5587
  if (!e) {
5514
5588
  r = !1;
5515
5589
  break;
@@ -5519,16 +5593,16 @@ async function ci(e, t, n, r, i = {}, o, s, c = () => !1) {
5519
5593
  size: e
5520
5594
  });
5521
5595
  }
5522
- r && o.push({
5596
+ r && i.push({
5523
5597
  element: e,
5524
5598
  frame: t,
5525
5599
  usages: n
5526
5600
  });
5527
5601
  }
5528
- let s = /* @__PURE__ */ new Map();
5529
- for (let e of Me(o.map(({ element: e }) => e.chart), (e, t) => Ee(e, o[t].frame) != null)) {
5530
- let { fill: t } = e, n = Ie(t);
5531
- s.has(n) || s.set(n, {
5602
+ let o = /* @__PURE__ */ new Map();
5603
+ for (let e of Ne(i.map(({ element: e }) => e.chart), (e, t) => De(e, i[t].frame) != null)) {
5604
+ let { fill: t } = e, n = Le(t);
5605
+ o.has(n) || o.set(n, {
5532
5606
  fill: t,
5533
5607
  widthPt: 0,
5534
5608
  heightPt: 0,
@@ -5536,14 +5610,14 @@ async function ci(e, t, n, r, i = {}, o, s, c = () => !1) {
5536
5610
  hasSourceCrop: e.hasSourceCrop
5537
5611
  });
5538
5612
  }
5539
- for (let { usages: e } of o) for (let { usage: t, size: n } of e) {
5540
- let { fill: e } = t, r = Ie(e), i = s.get(r);
5613
+ for (let { usages: e } of i) for (let { usage: t, size: n } of e) {
5614
+ let { fill: e } = t, r = Le(e), i = o.get(r);
5541
5615
  if (!i) continue;
5542
- let a = i.preserveNaturalSize || t.preserveNaturalSize, o = i.hasSourceCrop || t.hasSourceCrop, c = a || e.duotone ? void 0 : Dn(g, Z(e.imagePath, e.duotone)), l = !e.duotone && (e.mimeType === "image/svg+xml" || A({
5616
+ let a = i.preserveNaturalSize || t.preserveNaturalSize, s = i.hasSourceCrop || t.hasSourceCrop, c = a || e.duotone ? void 0 : On(g, Z(e.imagePath, e.duotone)), l = !e.duotone && (e.mimeType === "image/svg+xml" || z({
5543
5617
  svgImagePath: e.svgImagePath,
5544
- srcRect: o ? !0 : null
5618
+ srcRect: s ? !0 : null
5545
5619
  }));
5546
- s.set(r, {
5620
+ o.set(r, {
5547
5621
  ...i,
5548
5622
  widthPt: Math.max(i.widthPt, n.widthPt),
5549
5623
  heightPt: Math.max(i.heightPt, n.heightPt),
@@ -5551,145 +5625,145 @@ async function ci(e, t, n, r, i = {}, o, s, c = () => !1) {
5551
5625
  targetHeightPx: a ? void 0 : c?.targetHeightPx ?? (l && Math.max(i.targetHeightPx ?? 0, n.targetHeightPx ?? 0) || void 0),
5552
5626
  maxRetainedPixels: c?.maxRetainedPixels,
5553
5627
  preserveNaturalSize: a,
5554
- hasSourceCrop: o
5628
+ hasSourceCrop: s
5555
5629
  });
5556
5630
  }
5557
- for (let e of t.elements) if (!(e.type !== "shape" || !e.textBody)) for (let t of e.textBody.paragraphs) {
5558
- let n = Qe(t.bullet);
5631
+ for (let e of n.elements) if (!(e.type !== "shape" || !e.textBody)) for (let t of e.textBody.paragraphs) {
5632
+ let n = $e(t.bullet);
5559
5633
  if (n.type === "blip") {
5560
- let i = Zn(e.textBody, t, n) * Y * u * h, a = r.get(n.imagePath);
5634
+ let i = Qn(e.textBody, t, n) * Y * u * h, a = r.get(n.imagePath);
5561
5635
  a ? Number.isFinite(i) && i > 0 && (a.targetHeightPx = Math.max(a.targetHeightPx ?? 0, i)) : r.set(n.imagePath, {
5562
5636
  mimeType: n.mimeType,
5563
5637
  ...Number.isFinite(i) && i > 0 ? { targetHeightPx: i } : {}
5564
5638
  });
5565
5639
  }
5566
5640
  }
5567
- if (r.size > 0 || s.size > 0) {
5568
- let t = [...r].map(async ([e, { mimeType: t, targetHeightPx: r }]) => {
5641
+ if (r.size > 0 || o.size > 0) {
5642
+ let n = [...r].map(async ([t, { mimeType: n, targetHeightPx: r }]) => {
5569
5643
  try {
5570
- let a = t === "image/svg+xml" ? r === void 0 ? {} : {
5644
+ let i = n === "image/svg+xml" ? r === void 0 ? {} : {
5571
5645
  targetWidthPx: 1,
5572
5646
  targetHeightPx: r
5573
- } : Dn(g, Z(e)) ?? {}, o = t === "image/svg+xml" ? await I(e, n, {
5574
- ...a,
5575
- workerDecoder: i.svgDecoder
5576
- }) : await q(e, t, n, {
5577
- tiff: i.tiff,
5578
- ...a
5647
+ } : On(g, Z(t)) ?? {}, o = n === "image/svg+xml" ? await ce(t, e, {
5648
+ ...i,
5649
+ workerDecoder: a.svgDecoder
5650
+ }) : await J(t, n, e, {
5651
+ tiff: a.tiff,
5652
+ ...i
5579
5653
  });
5580
- y.set(e, o);
5581
- } catch (t) {
5582
- if (a(t, "tiff")) {
5583
- y.set(e, null);
5654
+ y.set(t, o);
5655
+ } catch (e) {
5656
+ if (b(e, "tiff")) {
5657
+ y.set(t, null);
5584
5658
  return;
5585
5659
  }
5586
- if (Le(t) || qe(t)) throw t;
5587
- y.set(e, null);
5660
+ if (Re(e) || Je(e)) throw e;
5661
+ y.set(t, null);
5588
5662
  }
5589
- }), o = [...s].map(async ([e, t]) => {
5590
- let { fill: r, widthPt: o, heightPt: s, targetWidthPx: c, targetHeightPx: l, maxRetainedPixels: u, hasSourceCrop: d } = t, f = c && l ? {
5591
- targetWidthPx: c,
5592
- targetHeightPx: l,
5593
- ...u === void 0 ? {} : { maxRetainedPixels: u }
5663
+ }), i = [...o].map(async ([t, n]) => {
5664
+ let { fill: r, widthPt: i, heightPt: o, targetWidthPx: s, targetHeightPx: c, maxRetainedPixels: l, hasSourceCrop: u } = n, d = s && c ? {
5665
+ targetWidthPx: s,
5666
+ targetHeightPx: c,
5667
+ ...l === void 0 ? {} : { maxRetainedPixels: l }
5594
5668
  } : void 0;
5595
5669
  try {
5596
- let t = () => r.mimeType === "image/svg+xml" ? r.duotone ? Promise.resolve(null) : I(r.imagePath, n, {
5597
- ...f ?? {},
5598
- workerDecoder: i.svgDecoder
5599
- }) : Je(r.imagePath, r.mimeType, r.duotone, n, {
5600
- widthPt: o,
5601
- heightPt: s,
5602
- ...f ?? {},
5670
+ let n = () => r.mimeType === "image/svg+xml" ? r.duotone ? Promise.resolve(null) : ce(r.imagePath, e, {
5671
+ ...d ?? {},
5672
+ workerDecoder: a.svgDecoder
5673
+ }) : Ye(r.imagePath, r.mimeType, r.duotone, e, {
5674
+ widthPt: i,
5675
+ heightPt: o,
5676
+ ...d ?? {},
5603
5677
  failClosedOnDuotoneFailure: !0,
5604
- tiff: i.tiff
5605
- }), a, c = {
5678
+ tiff: a.tiff
5679
+ }), s, c = {
5606
5680
  svgImagePath: r.svgImagePath,
5607
- srcRect: d ? !0 : null
5681
+ srcRect: u ? !0 : null
5608
5682
  };
5609
- if (!r.duotone && A(c)) try {
5610
- a = await I(c.svgImagePath, n, {
5611
- ...f ?? {},
5612
- workerDecoder: i.svgDecoder
5683
+ if (!r.duotone && z(c)) try {
5684
+ s = await ce(c.svgImagePath, e, {
5685
+ ...d ?? {},
5686
+ workerDecoder: a.svgDecoder
5613
5687
  });
5614
5688
  } catch {
5615
- a = await t();
5689
+ s = await n();
5616
5690
  }
5617
- else a = await t();
5618
- S.set(e, a);
5619
- } catch (t) {
5620
- if (a(t, "tiff")) {
5621
- S.set(e, null);
5691
+ else s = await n();
5692
+ C.set(t, s);
5693
+ } catch (e) {
5694
+ if (b(e, "tiff")) {
5695
+ C.set(t, null);
5622
5696
  return;
5623
5697
  }
5624
- if (Le(t) || qe(t)) throw t;
5625
- S.set(e, null);
5698
+ if (Re(e) || Je(e)) throw e;
5699
+ C.set(t, null);
5626
5700
  }
5627
5701
  });
5628
- if (await Promise.all([...t, ...o]), c()) return e;
5702
+ if (await Promise.all([...n, ...i]), c()) return t;
5629
5703
  }
5630
5704
  }
5631
- for (let [n, r] of t.elements.entries()) {
5632
- if (c()) return e;
5633
- if (r.type === "shape") Fr(_, r, u, v, x, b, o ? (e) => o({
5634
- ...e,
5635
- elementIndex: n,
5636
- origin: t.elementSources?.[n]?.origin ?? "slide"
5637
- }) : void 0, i.fetchImage);
5638
- else if (r.type === "picture") await Xr(_, r, u, c, i.fetchImage, i.tiff, h, i.svgDecoder, g);
5639
- else if (r.type === "table") ti(_, r, u, x, b, o ? (e) => o({
5640
- ...e,
5641
- elementIndex: n,
5642
- origin: t.elementSources?.[n]?.origin ?? "slide"
5705
+ for (let [e, r] of n.elements.entries()) {
5706
+ if (c()) return t;
5707
+ if (r.type === "shape") Ur(_, r, u, v, S, x, o ? (t) => o({
5708
+ ...t,
5709
+ elementIndex: e,
5710
+ origin: n.elementSources?.[e]?.origin ?? "slide"
5711
+ }) : void 0, a.fetchImage);
5712
+ else if (r.type === "picture") await ii(_, r, u, c, a.fetchImage, a.tiff, h, a.svgDecoder, g);
5713
+ else if (r.type === "table") li(_, r, u, S, x, o ? (t) => o({
5714
+ ...t,
5715
+ elementIndex: e,
5716
+ origin: n.elementSources?.[e]?.origin ?? "slide"
5643
5717
  }) : void 0);
5644
- else if (r.type === "media") await Zr(_, r, u, c, i.fetchMedia, i.skipMediaControls, i.fetchImage, i.tiff, h, i.svgDecoder, g);
5718
+ else if (r.type === "media") await ai(_, r, u, c, a.fetchMedia, a.skipMediaControls, a.fetchImage, a.tiff, h, a.svgDecoder, g);
5645
5719
  else if (r.type === "chart") {
5646
5720
  let e = Y * u;
5647
- _.save(), ei(_, r, u), Ke(_, r.chart, {
5721
+ _.save(), ci(_, r, u), qe(_, r.chart, {
5648
5722
  x: X(r.x, u),
5649
5723
  y: X(r.y, u),
5650
5724
  w: X(r.width, u),
5651
5725
  h: X(r.height, u)
5652
- }, e, r.rotation, i.threeD, i.regionMap, (e) => S.get(Ie(e)), i.chartEx), _.restore();
5726
+ }, e, r.rotation, a.threeD, a.regionMap, (e) => C.get(Le(e)), a.chartEx), _.restore();
5653
5727
  }
5654
5728
  }
5655
- return c() || i.dim && ni(_, i.dim, d, f), e;
5729
+ return c() || a.dim && ui(_, a.dim, d, f), t;
5656
5730
  }
5657
5731
  //#endregion
5658
5732
  //#region packages/pptx/src/google-fonts.ts
5659
- var li = {
5660
- ...T,
5661
- ...b
5733
+ var _i = {
5734
+ ...C,
5735
+ ...f
5662
5736
  };
5663
- function* ui(e) {
5737
+ function* vi(e) {
5664
5738
  for (let t of e?.paragraphs ?? []) for (let e of t.runs) e.type === "text" && (yield e.text);
5665
5739
  }
5666
- function* di(e) {
5740
+ function* yi(e) {
5667
5741
  for (let t of e?.paragraphs ?? []) {
5668
5742
  t.defFontFamily && (yield t.defFontFamily);
5669
5743
  for (let e of t.runs) e.type === "text" && (e.fontFamily && (yield e.fontFamily), e.fontFamilyEa && (yield e.fontFamilyEa), e.fontFamilySym && (yield e.fontFamilySym));
5670
5744
  }
5671
5745
  }
5672
- function* fi(e) {
5673
- for (let t of e.elements) if (t.type === "shape") yield* ui(t.textBody);
5674
- else if (t.type === "table") for (let e of t.rows) for (let t of e.cells) yield* ui(t.textBody);
5746
+ function* bi(e) {
5747
+ for (let t of e.elements) if (t.type === "shape") yield* vi(t.textBody);
5748
+ else if (t.type === "table") for (let e of t.rows) for (let t of e.cells) yield* vi(t.textBody);
5675
5749
  else if (t.type === "chart") {
5676
5750
  t.chart.title && (yield t.chart.title);
5677
5751
  for (let e of t.chart.categories) yield e;
5678
5752
  for (let e of t.chart.series) e.name && (yield e.name);
5679
5753
  }
5680
5754
  }
5681
- var pi = class e {
5755
+ var xi = class e {
5682
5756
  scripts;
5683
5757
  families;
5684
- constructor(e, t, n, r) {
5758
+ constructor(e, t, n, i) {
5685
5759
  this.majorFont = e, this.minorFont = t;
5686
- let i = w(e) ?? w(t) ?? null;
5687
- this.scripts = n ?? new fe(i), this.families = r ?? /* @__PURE__ */ new Set(), e && this.families.add(e), t && this.families.add(t);
5760
+ let a = r(e) ?? r(t) ?? null;
5761
+ this.scripts = n ?? new v(a), this.families = i ?? /* @__PURE__ */ new Set(), e && this.families.add(e), t && this.families.add(t);
5688
5762
  }
5689
5763
  addSlide(e) {
5690
- this.scripts.addText(fi(e));
5691
- for (let t of e.elements) if (t.type === "shape") for (let e of di(t.textBody)) this.families.add(e);
5692
- else if (t.type === "table") for (let e of t.rows) for (let t of e.cells) for (let e of di(t.textBody)) this.families.add(e);
5764
+ this.scripts.addText(bi(e));
5765
+ for (let t of e.elements) if (t.type === "shape") for (let e of yi(t.textBody)) this.families.add(e);
5766
+ else if (t.type === "table") for (let e of t.rows) for (let t of e.cells) for (let e of yi(t.textBody)) this.families.add(e);
5693
5767
  }
5694
5768
  names() {
5695
5769
  return [...this.families, ...this.scripts.names()];
@@ -5698,16 +5772,16 @@ var pi = class e {
5698
5772
  let n = new e(this.majorFont, this.minorFont, this.scripts.clone(), new Set(this.families));
5699
5773
  return n.addSlide(t), n;
5700
5774
  }
5701
- }, mi = Object.freeze({
5775
+ }, Si = Object.freeze({
5702
5776
  archiveEntryCount: 0,
5703
5777
  declaredInflatedBytes: 0,
5704
5778
  distinctInflatedBytes: 0,
5705
5779
  operationInflatedBytes: 0
5706
- }), hi = D;
5707
- function gi(e, t) {
5780
+ }), Ci = T;
5781
+ function wi(e, t) {
5708
5782
  if (e !== null && typeof e != "string") throw Error(`invalid PPTX presentation bootstrap ${t}`);
5709
5783
  }
5710
- function _i(e, t) {
5784
+ function Ti(e, t) {
5711
5785
  if (!e || typeof e != "object" || Array.isArray(e)) throw Error(`invalid PPTX presentation bootstrap slide at ${t}`);
5712
5786
  let n = e;
5713
5787
  if (n.index !== t) throw Error(`invalid PPTX presentation bootstrap slide index ${n.index}`);
@@ -5717,7 +5791,7 @@ function _i(e, t) {
5717
5791
  ...n.partName === void 0 ? {} : { partName: n.partName }
5718
5792
  });
5719
5793
  }
5720
- function vi(e, t) {
5794
+ function Ei(e, t) {
5721
5795
  if (!e || typeof e != "object" || Array.isArray(e)) throw Error(`invalid PPTX presentation bootstrap embedded font at ${t}`);
5722
5796
  let n = e;
5723
5797
  if (typeof n.fontName != "string" || n.fontName.length === 0 || ![
@@ -5733,11 +5807,11 @@ function vi(e, t) {
5733
5807
  contentType: n.contentType
5734
5808
  });
5735
5809
  }
5736
- function yi(e) {
5810
+ function Di(e) {
5737
5811
  if (!e || typeof e != "object" || Array.isArray(e)) throw Error("invalid PPTX presentation bootstrap payload");
5738
5812
  let t = e;
5739
5813
  if (!Number.isSafeInteger(t.slideCount) || (t.slideCount ?? -1) < 0 || !Number.isSafeInteger(t.slideWidth) || (t.slideWidth ?? 0) <= 0 || !Number.isSafeInteger(t.slideHeight) || (t.slideHeight ?? 0) <= 0 || !Array.isArray(t.embeddedFonts) || !Array.isArray(t.slides) || t.slides.length !== t.slideCount) throw Error("invalid PPTX presentation bootstrap dimensions or slide count");
5740
- return gi(t.defaultTextColor, "defaultTextColor"), gi(t.majorFont, "majorFont"), gi(t.minorFont, "minorFont"), gi(t.hlinkColor, "hlinkColor"), gi(t.folHlinkColor, "folHlinkColor"), Object.freeze({
5814
+ return wi(t.defaultTextColor, "defaultTextColor"), wi(t.majorFont, "majorFont"), wi(t.minorFont, "minorFont"), wi(t.hlinkColor, "hlinkColor"), wi(t.folHlinkColor, "folHlinkColor"), Object.freeze({
5741
5815
  slideCount: t.slideCount,
5742
5816
  slideWidth: t.slideWidth,
5743
5817
  slideHeight: t.slideHeight,
@@ -5746,11 +5820,11 @@ function yi(e) {
5746
5820
  minorFont: t.minorFont,
5747
5821
  hlinkColor: t.hlinkColor,
5748
5822
  folHlinkColor: t.folHlinkColor,
5749
- embeddedFonts: Object.freeze(t.embeddedFonts.map(vi)),
5750
- slides: Object.freeze(t.slides.map(_i))
5823
+ embeddedFonts: Object.freeze(t.embeddedFonts.map(Ei)),
5824
+ slides: Object.freeze(t.slides.map(Ti))
5751
5825
  });
5752
5826
  }
5753
- function bi(e) {
5827
+ function Oi(e) {
5754
5828
  return Object.freeze({
5755
5829
  type: "media",
5756
5830
  x: e.x,
@@ -5767,7 +5841,7 @@ function bi(e) {
5767
5841
  mimeType: e.mimeType
5768
5842
  });
5769
5843
  }
5770
- function xi(e) {
5844
+ function ki(e) {
5771
5845
  return Object.freeze({
5772
5846
  ...e.id === void 0 ? {} : { id: e.id },
5773
5847
  ...e.authorId === void 0 ? {} : { authorId: e.authorId },
@@ -5777,10 +5851,10 @@ function xi(e) {
5777
5851
  text: e.text
5778
5852
  });
5779
5853
  }
5780
- function Si(e) {
5854
+ function Ai(e) {
5781
5855
  return Object.freeze({ ...e });
5782
5856
  }
5783
- function Ci(e) {
5857
+ function ji(e) {
5784
5858
  return Object.freeze({
5785
5859
  ...e.authorId === void 0 ? {} : { authorId: e.authorId },
5786
5860
  ...e.modernAuthorId === void 0 ? {} : { modernAuthorId: e.modernAuthorId },
@@ -5790,16 +5864,16 @@ function Ci(e) {
5790
5864
  ...e.date === void 0 ? {} : { date: e.date },
5791
5865
  ...e.x === void 0 ? {} : { x: e.x },
5792
5866
  ...e.y === void 0 ? {} : { y: e.y },
5793
- ...e.anchors?.length ? { anchors: Object.freeze(e.anchors.map(Si)) } : {},
5867
+ ...e.anchors?.length ? { anchors: Object.freeze(e.anchors.map(Ai)) } : {},
5794
5868
  ...e.status === void 0 ? {} : { status: e.status },
5795
5869
  text: e.text,
5796
- ...e.replies?.length ? { replies: Object.freeze(e.replies.map(xi)) } : {}
5870
+ ...e.replies?.length ? { replies: Object.freeze(e.replies.map(ki)) } : {}
5797
5871
  });
5798
5872
  }
5799
- function wi(e, t, n) {
5873
+ function Mi(e, t, n) {
5800
5874
  if (e !== void 0 && typeof e != "string") throw Error(`invalid PPTX presentation preflight comment ${t} at slide ${n}`);
5801
5875
  }
5802
- function Ti(e, t) {
5876
+ function Ni(e, t) {
5803
5877
  if (!e || typeof e != "object" || Array.isArray(e)) throw Error(`invalid PPTX presentation preflight comment reply at slide ${t}`);
5804
5878
  let n = e;
5805
5879
  for (let e of [
@@ -5808,16 +5882,16 @@ function Ti(e, t) {
5808
5882
  "author",
5809
5883
  "date",
5810
5884
  "status"
5811
- ]) wi(n[e], e, t);
5885
+ ]) Mi(n[e], e, t);
5812
5886
  if (typeof n.text != "string") throw Error(`invalid PPTX presentation preflight comment reply text at slide ${t}`);
5813
5887
  if (n.status !== void 0 && ![
5814
5888
  "active",
5815
5889
  "resolved",
5816
5890
  "closed"
5817
5891
  ].includes(n.status)) throw Error(`invalid PPTX presentation preflight comment reply status at slide ${t}`);
5818
- return xi(n);
5892
+ return ki(n);
5819
5893
  }
5820
- function Ei(e, t) {
5894
+ function Pi(e, t) {
5821
5895
  if (!e || typeof e != "object" || Array.isArray(e)) throw Error(`invalid PPTX presentation preflight comment at slide ${t}`);
5822
5896
  let n = e;
5823
5897
  for (let e of [
@@ -5826,7 +5900,7 @@ function Ei(e, t) {
5826
5900
  "author",
5827
5901
  "date",
5828
5902
  "status"
5829
- ]) wi(n[e], e, t);
5903
+ ]) Mi(n[e], e, t);
5830
5904
  for (let e of [
5831
5905
  "authorId",
5832
5906
  "index",
@@ -5842,23 +5916,23 @@ function Ei(e, t) {
5842
5916
  "resolved",
5843
5917
  "closed"
5844
5918
  ].includes(n.status)) throw Error(`invalid PPTX presentation preflight comment status at slide ${t}`);
5845
- return Ci({
5919
+ return ji({
5846
5920
  ...n,
5847
- ...n.anchors?.length ? { anchors: n.anchors.map((e) => Di(e, t)) } : {},
5848
- ...n.replies?.length ? { replies: n.replies.map((e) => Ti(e, t)) } : {}
5921
+ ...n.anchors?.length ? { anchors: n.anchors.map((e) => Fi(e, t)) } : {},
5922
+ ...n.replies?.length ? { replies: n.replies.map((e) => Ni(e, t)) } : {}
5849
5923
  });
5850
5924
  }
5851
- function Di(e, t) {
5925
+ function Fi(e, t) {
5852
5926
  if (!e || typeof e != "object" || Array.isArray(e)) throw Error(`invalid PPTX presentation preflight comment anchor at slide ${t}`);
5853
5927
  let n = e;
5854
5928
  if (n.type === "slide" || n.type === "unknown") return Object.freeze({ type: n.type });
5855
- if (n.type === "drawingElement") return wi(n.elementId, "anchor.elementId", t), wi(n.creationId, "anchor.creationId", t), Object.freeze({
5929
+ if (n.type === "drawingElement") return Mi(n.elementId, "anchor.elementId", t), Mi(n.creationId, "anchor.creationId", t), Object.freeze({
5856
5930
  type: "drawingElement",
5857
5931
  ...n.elementId === void 0 ? {} : { elementId: n.elementId },
5858
5932
  ...n.creationId === void 0 ? {} : { creationId: n.creationId }
5859
5933
  });
5860
5934
  if (n.type === "textRange") {
5861
- wi(n.elementId, "anchor.elementId", t);
5935
+ Mi(n.elementId, "anchor.elementId", t);
5862
5936
  for (let e of ["start", "length"]) {
5863
5937
  let r = n[e];
5864
5938
  if (r !== void 0 && (typeof r != "number" || !Number.isSafeInteger(r))) throw Error(`invalid PPTX presentation preflight comment anchor.${e} at slide ${t}`);
@@ -5872,7 +5946,7 @@ function Di(e, t) {
5872
5946
  }
5873
5947
  throw Error(`invalid PPTX presentation preflight comment anchor type at slide ${t}`);
5874
5948
  }
5875
- function Oi(e, t) {
5949
+ function Ii(e, t) {
5876
5950
  if (!e || typeof e != "object" || Array.isArray(e)) throw Error(`invalid PPTX presentation preflight media at slide ${t}`);
5877
5951
  let n = e;
5878
5952
  for (let e of [
@@ -5883,13 +5957,13 @@ function Oi(e, t) {
5883
5957
  "rotation"
5884
5958
  ]) if (typeof n[e] != "number" || !Number.isFinite(n[e])) throw Error(`invalid PPTX presentation preflight media ${e} at slide ${t}`);
5885
5959
  if (n.type !== "media" || typeof n.flipH != "boolean" || typeof n.flipV != "boolean" || n.mediaKind !== "audio" && n.mediaKind !== "video" || typeof n.posterPath != "string" || typeof n.posterMimeType != "string" || typeof n.mediaPath != "string" || typeof n.mimeType != "string") throw Error(`invalid PPTX presentation preflight media fields at slide ${t}`);
5886
- return bi(n);
5960
+ return Oi(n);
5887
5961
  }
5888
- function ki(e, t) {
5962
+ function Li(e, t) {
5889
5963
  if (!e || typeof e != "object" || Array.isArray(e)) throw Error("invalid PPTX presentation preflight payload");
5890
5964
  let n = e;
5891
5965
  if (!Number.isSafeInteger(n.slideCount) || (n.slideCount ?? -1) < 0 || !Number.isSafeInteger(n.slideWidth) || (n.slideWidth ?? 0) <= 0 || !Number.isSafeInteger(n.slideHeight) || (n.slideHeight ?? 0) <= 0 || !Array.isArray(n.embeddedFonts) || !Array.isArray(n.slides) || (t ? n.slides.length > (n.slideCount ?? -1) : n.slides.length !== n.slideCount) || !Array.isArray(n.fontPreloadNames)) throw Error("invalid PPTX presentation preflight dimensions or slide count");
5892
- gi(n.defaultTextColor, "defaultTextColor"), gi(n.majorFont, "majorFont"), gi(n.minorFont, "minorFont"), gi(n.hlinkColor, "hlinkColor"), gi(n.folHlinkColor, "folHlinkColor");
5966
+ wi(n.defaultTextColor, "defaultTextColor"), wi(n.majorFont, "majorFont"), wi(n.minorFont, "minorFont"), wi(n.hlinkColor, "hlinkColor"), wi(n.folHlinkColor, "folHlinkColor");
5893
5967
  let r = n.slides.map((e, t) => {
5894
5968
  if (!e || typeof e != "object" || Array.isArray(e)) throw Error(`invalid PPTX presentation preflight slide at ${t}`);
5895
5969
  let n = e;
@@ -5899,8 +5973,8 @@ function ki(e, t) {
5899
5973
  ...n.partName === void 0 ? {} : { partName: n.partName },
5900
5974
  notes: n.notes,
5901
5975
  hidden: n.hidden,
5902
- mediaElements: Object.freeze(n.mediaElements.map((e) => Oi(e, t))),
5903
- ...n.comments?.length ? { comments: Object.freeze(n.comments.map((e) => Ei(e, t))) } : {}
5976
+ mediaElements: Object.freeze(n.mediaElements.map((e) => Ii(e, t))),
5977
+ ...n.comments?.length ? { comments: Object.freeze(n.comments.map((e) => Pi(e, t))) } : {}
5904
5978
  });
5905
5979
  }), i = n.fontPreloadNames.map((e, t) => {
5906
5980
  if (e !== null && typeof e != "string") throw Error(`invalid PPTX presentation preflight font at ${t}`);
@@ -5915,37 +5989,37 @@ function ki(e, t) {
5915
5989
  minorFont: n.minorFont,
5916
5990
  hlinkColor: n.hlinkColor,
5917
5991
  folHlinkColor: n.folHlinkColor,
5918
- embeddedFonts: Object.freeze(n.embeddedFonts.map(vi)),
5992
+ embeddedFonts: Object.freeze(n.embeddedFonts.map(Ei)),
5919
5993
  slides: Object.freeze(r),
5920
5994
  fontPreloadNames: Object.freeze(i)
5921
5995
  });
5922
5996
  }
5923
- function Ai(e) {
5924
- return ki(e, !1);
5997
+ function Ri(e) {
5998
+ return Li(e, !1);
5925
5999
  }
5926
- function ji(e) {
5927
- return ki(e, !0);
6000
+ function zi(e) {
6001
+ return Li(e, !0);
5928
6002
  }
5929
- function Mi(e, t) {
6003
+ function Bi(e, t) {
5930
6004
  for (let n of e.slides) for (let e of n.mediaElements) {
5931
6005
  if (e.mediaPath === t) return e.mimeType;
5932
6006
  if (e.posterPath === t) return e.posterMimeType;
5933
6007
  }
5934
6008
  return "";
5935
6009
  }
5936
- function Ni(e, t) {
6010
+ function Vi(e, t) {
5937
6011
  if (e.index !== t.index || e.partName !== t.partName) throw Error(`PPTX pulled slide identity does not match bootstrap index ${t.index}`);
5938
6012
  return Object.freeze({
5939
6013
  index: t.index,
5940
6014
  ...t.partName === void 0 ? {} : { partName: t.partName },
5941
6015
  notes: e.notes ?? null,
5942
6016
  hidden: e.hidden ?? !1,
5943
- mediaElements: Object.freeze(e.elements.filter((e) => e.type === "media").map(bi)),
5944
- ...e.comments?.length ? { comments: Object.freeze(e.comments.map(Ci)) } : {}
6017
+ mediaElements: Object.freeze(e.elements.filter((e) => e.type === "media").map(Oi)),
6018
+ ...e.comments?.length ? { comments: Object.freeze(e.comments.map(ji)) } : {}
5945
6019
  });
5946
6020
  }
5947
- function Pi(e, t, n) {
5948
- if (!(e <= t)) throw new N(`PPTX presentation preflight exceeded its hard limit of ${t} projected bytes`, {
6021
+ function Hi(e, t, n) {
6022
+ if (!(e <= t)) throw new j(`PPTX presentation preflight exceeded its hard limit of ${t} projected bytes`, {
5949
6023
  stage: "parsing",
5950
6024
  violation: {
5951
6025
  format: "pptx",
@@ -5959,7 +6033,7 @@ function Pi(e, t, n) {
5959
6033
  }
5960
6034
  });
5961
6035
  }
5962
- var Fi = class {
6036
+ var Ui = class {
5963
6037
  slideCountValue;
5964
6038
  slideWidthValue;
5965
6039
  slideHeightValue;
@@ -5979,9 +6053,9 @@ var Fi = class {
5979
6053
  pending = null;
5980
6054
  finished = null;
5981
6055
  constructor(e, t = {}) {
5982
- let n = yi(e), r = t.hardLimitForTesting ?? hi;
5983
- if (!Number.isSafeInteger(r) || r <= 0 || r > hi) throw Error("invalid PPTX presentation preflight test limit");
5984
- this.limit = r, this.slideCountValue = n.slideCount, this.slideWidthValue = n.slideWidth, this.slideHeightValue = n.slideHeight, this.defaultTextColorValue = n.defaultTextColor, this.majorFontValue = n.majorFont, this.minorFontValue = n.minorFont, this.hlinkColorValue = n.hlinkColor, this.folHlinkColorValue = n.folHlinkColor, this.embeddedFontsValue = n.embeddedFonts, this.descriptors = [...n.slides], this.fonts = new pi(this.majorFontValue, this.minorFontValue), this.fontPreloadNames = Object.freeze(this.fonts.names()), this.fontProjectionBytes = Xe(this.fontPreloadNames, this.limit).jsonBytes, this.projectionBytesValue = Xe({
6056
+ let n = Di(e), r = t.hardLimitForTesting ?? Ci;
6057
+ if (!Number.isSafeInteger(r) || r <= 0 || r > Ci) throw Error("invalid PPTX presentation preflight test limit");
6058
+ this.limit = r, this.slideCountValue = n.slideCount, this.slideWidthValue = n.slideWidth, this.slideHeightValue = n.slideHeight, this.defaultTextColorValue = n.defaultTextColor, this.majorFontValue = n.majorFont, this.minorFontValue = n.minorFont, this.hlinkColorValue = n.hlinkColor, this.folHlinkColorValue = n.folHlinkColor, this.embeddedFontsValue = n.embeddedFonts, this.descriptors = [...n.slides], this.fonts = new xi(this.majorFontValue, this.minorFontValue), this.fontPreloadNames = Object.freeze(this.fonts.names()), this.fontProjectionBytes = Ze(this.fontPreloadNames, this.limit).jsonBytes, this.projectionBytesValue = Ze({
5985
6059
  slideCount: this.slideCountValue,
5986
6060
  slideWidth: this.slideWidthValue,
5987
6061
  slideHeight: this.slideHeightValue,
@@ -5994,7 +6068,7 @@ var Fi = class {
5994
6068
  remainingSlides: this.descriptors,
5995
6069
  slides: [],
5996
6070
  fontPreloadNames: this.fontPreloadNames
5997
- }, this.limit).jsonBytes, Pi(this.projectionBytesValue, this.limit, mi);
6071
+ }, this.limit).jsonBytes, Hi(this.projectionBytesValue, this.limit, Si);
5998
6072
  }
5999
6073
  get acceptedSlideCount() {
6000
6074
  return this.finished?.slideCount ?? this.slides.length;
@@ -6028,21 +6102,21 @@ var Fi = class {
6028
6102
  fontPreloadNames: this.fontPreloadNames
6029
6103
  });
6030
6104
  }
6031
- addSlide(e, t = mi) {
6105
+ addSlide(e, t = Si) {
6032
6106
  this.prepareSlide(e, t).commit();
6033
6107
  }
6034
- prepareSlide(e, t = mi) {
6108
+ prepareSlide(e, t = Si) {
6035
6109
  if (this.finished) throw Error("PPTX presentation preflight is already finished");
6036
6110
  if (this.pending) throw Error("PPTX presentation preflight already has a prepared slide");
6037
6111
  let n = this.slides.length, r = this.descriptors[n];
6038
6112
  if (!r) throw Error("PPTX presentation preflight received an extra slide");
6039
- let i = Ni(e, r), a = this.fonts.withSlide(e), o = Object.freeze(a.names()), s = Xe(o, this.limit).jsonBytes, c = Xe(i, this.limit).jsonBytes, l = this.projectionBytesValue - this.fontProjectionBytes - Xe(r, this.limit).jsonBytes + 4;
6040
- l = Ze(l, s, this.limit), l = Ze(l, c, this.limit), this.slides.length !== 0 && (l = Ze(l, 1, this.limit));
6041
- let u = Xe({
6113
+ let i = Vi(e, r), a = this.fonts.withSlide(e), o = Object.freeze(a.names()), s = Ze(o, this.limit).jsonBytes, c = Ze(i, this.limit).jsonBytes, l = this.projectionBytesValue - this.fontProjectionBytes - Ze(r, this.limit).jsonBytes + 4;
6114
+ l = Qe(l, s, this.limit), l = Qe(l, c, this.limit), this.slides.length !== 0 && (l = Qe(l, 1, this.limit));
6115
+ let u = Ze({
6042
6116
  slide: i,
6043
6117
  fontPreloadNames: o
6044
- }, this.limit).jsonBytes, d = Ze(this.projectionBytesValue, u, this.limit);
6045
- Pi(Math.max(d, l), this.limit, t);
6118
+ }, this.limit).jsonBytes, d = Qe(this.projectionBytesValue, u, this.limit);
6119
+ Hi(Math.max(d, l), this.limit, t);
6046
6120
  let f = {
6047
6121
  state: "prepared",
6048
6122
  fact: i,
@@ -6085,9 +6159,9 @@ var Fi = class {
6085
6159
  embeddedFonts: this.embeddedFontsValue,
6086
6160
  slides: Object.freeze([...this.slides]),
6087
6161
  fontPreloadNames: this.fontPreloadNames
6088
- }), this.descriptors = [], this.slides = [], this.projectionBytesValue = Xe(this.finished, this.limit).jsonBytes, this.finished;
6162
+ }), this.descriptors = [], this.slides = [], this.projectionBytesValue = Ze(this.finished, this.limit).jsonBytes, this.finished;
6089
6163
  }
6090
- }, Ii = 1024 * 1024, Li = class {
6164
+ }, Wi = 1024 * 1024, Gi = class {
6091
6165
  active = /* @__PURE__ */ new Set();
6092
6166
  nextSessionId = 1;
6093
6167
  constructor(e) {
@@ -6100,15 +6174,15 @@ var Fi = class {
6100
6174
  sessionId: r,
6101
6175
  operationId: r,
6102
6176
  generation: this.options.generation ?? 1
6103
- }, a = new h(this.options.transport, {
6177
+ }, a = new p(this.options.transport, {
6104
6178
  ...i,
6105
- maxByteCredit: E,
6179
+ maxByteCredit: w,
6106
6180
  timeoutMs: n
6107
6181
  });
6108
6182
  this.active.add(a);
6109
6183
  try {
6110
6184
  await this.options.open(e, i, n);
6111
- let r = await zi(a);
6185
+ let r = await qi(a);
6112
6186
  try {
6113
6187
  let e = r.usage ?? a.usageCheckpoint;
6114
6188
  e && this.options.onUsage?.(e);
@@ -6131,20 +6205,20 @@ var Fi = class {
6131
6205
  if (!Number.isSafeInteger(e) || e < 0 || e >= this.options.slideCount) throw RangeError(`Slide index ${e} out of range (count: ${this.options.slideCount})`);
6132
6206
  }
6133
6207
  };
6134
- function Ri(e) {
6208
+ function Ki(e) {
6135
6209
  return !!e && typeof e == "object" && e.protocol === "ooxml-pull-v1";
6136
6210
  }
6137
- async function zi(e) {
6211
+ async function qi(e) {
6138
6212
  try {
6139
- return await e.pull(Ii);
6213
+ return await e.pull(Wi);
6140
6214
  } catch (t) {
6141
- let n = Bi(t);
6215
+ let n = Ji(t);
6142
6216
  if (n === void 0) throw t;
6143
6217
  return e.pull(n);
6144
6218
  }
6145
6219
  }
6146
- function Bi(e) {
6147
- return d(e, Ii, E);
6220
+ function Ji(e) {
6221
+ return ne(e, Wi, w);
6148
6222
  }
6149
6223
  //#endregion
6150
- export { yi as a, li as c, si as d, an as f, Mi as i, ii as l, Ri as n, Ai as o, Fi as r, ji as s, Li as t, oi as u };
6224
+ export { Di as a, _i as c, hi as d, on as f, Bi as i, fi as l, Ki as n, Ri as o, Ui as r, zi as s, Gi as t, mi as u };