@silurus/ooxml 0.86.0 → 0.87.0

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