@silurus/ooxml 0.82.0 → 0.83.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.
- package/README.md +72 -3
- package/dist/assets/{render-worker-7-Zr7fSw.js → render-worker-Bu31cf1J.js} +4 -4
- package/dist/assets/render-worker-DuztdEcX.js +11 -0
- package/dist/{canvas-viewer-mechanics-CS_qbr6T.js → canvas-viewer-mechanics-h07vpVOQ.js} +42 -2
- package/dist/{comment-ui-runtime-BAe30Ct9.js → comment-ui-runtime-BelHJt73.js} +3 -3
- package/dist/{comment-ui-runtime-BUCj4hWn.js → comment-ui-runtime-DD5a3x3k.js} +3 -3
- package/dist/comment-ui-runtime-DTGN3Vyy.js +2 -0
- package/dist/{comments-Cf9W7r3M.js → comments-AAaNnQTi.js} +7 -2
- package/dist/{document-pull-client-BCgmytqI.js → document-pull-client-BAhqoTmm.js} +4509 -3953
- package/dist/docx-Dg73PGgC.js +2707 -0
- package/dist/docx.mjs +6 -6
- package/dist/docx_parser_bg.wasm +0 -0
- package/dist/dom-interaction-boundary-CepOlXt6.js +217 -0
- package/dist/index.mjs +4 -4
- package/dist/line-distribute-D7A_wnJg.js +1003 -0
- package/dist/{line-metrics-B3syvDn2.js → line-metrics-Bpn7OeZD.js} +616 -616
- package/dist/node.mjs +308 -308
- package/dist/pptx-BcUCETmQ.js +2990 -0
- package/dist/pptx.mjs +5 -5
- package/dist/pptx_parser_bg.wasm +0 -0
- package/dist/{read-only-comment-margin-Dn2y55W6.js → read-only-comment-margin-DrUX-YrP.js} +1 -1
- package/dist/{render-CenWM4g1.js → render-CL-7V3E8.js} +1 -1
- package/dist/{render-worker-host-BNENN3qP.js → render-worker-host-DDZo0feh.js} +1 -1
- package/dist/{render-worker-host-BmH3kGSj.js → render-worker-host-FJ19-fUI.js} +1 -1
- package/dist/{resource-measurement-CsW4_eYt.js → resource-measurement-DuiFWzam.js} +3 -3
- package/dist/{session-Cky_swUj.js → session-BjydZEDF.js} +107 -94
- package/dist/{slide-pull-client-CqTVFb3W.js → slide-pull-client-CwvvncPA.js} +1199 -970
- package/dist/types/docx.d.ts +99 -7
- package/dist/types/index.d.ts +189 -12
- package/dist/types/node.d.ts +385 -379
- package/dist/types/pptx.d.ts +96 -5
- package/dist/types/xlsx.d.ts +4 -2
- package/dist/{worksheet-pull-client-CYtwXP5D.js → worksheet-pull-client-DyFsDF4A.js} +32 -32
- package/dist/{xlsx-DlV37-0j.js → xlsx-BibrHQ52.js} +477 -477
- package/dist/xlsx.mjs +5 -5
- package/dist/xlsx_parser_bg.wasm +0 -0
- package/package.json +4 -1
- package/dist/assets/render-worker-B5gsW6b5.js +0 -11
- package/dist/comment-ui-runtime-F4a3te6p.js +0 -2
- package/dist/docx-wokGKYfi.js +0 -2162
- package/dist/dom-interaction-boundary-C8F6HO5x.js +0 -119
- package/dist/line-distribute-iXsUCIH-.js +0 -1003
- package/dist/pptx-DU8L8I2T.js +0 -2432
- /package/dist/{comment-occurrence-C34fWs_F.js → comment-occurrence-X54si2ob.js} +0 -0
- /package/dist/{highlight-rect-MaCt0om0.js → highlight-rect-Hes0z_Mj.js} +0 -0
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { a as
|
|
3
|
-
import { S as
|
|
4
|
-
import { r as
|
|
5
|
-
import { A as
|
|
6
|
-
import { k as
|
|
7
|
-
import { i as
|
|
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, Et as c, J as l, M as u, Mt as d, N as f, O as p, Ot as m, Pt as h, Qt as g, S as _, St as v, Tt as y, _ as b, at as x, bt as S, c as C, ct as w, d as T, dt as E, et as D, f as O, g as k, gt as A, h as j, i as M, it as N, j as P, jt as F, kt as I, m as L, mt as R, n as z, nt as B, p as V, pt as H, r as U, rt as ee, s as W, st as te, tt as G, u as K, ut as q, vt as ne, w as re, wt as ie, xt as ae, y as oe, zt as se } from "./line-metrics-Bpn7OeZD.js";
|
|
2
|
+
import { a as ce, c as le, d as ue, i as de, l as fe, n as pe, o as me, r as he, s as ge, t as _e, u as ve } from "./line-distribute-D7A_wnJg.js";
|
|
3
|
+
import { S as ye, _ as be, an as xe, h as Se, in as Ce, k as we, ln as Te, nn as Ee, un as De, v as Oe, w as ke } from "./plot-area-frame-DHV02PJU.js";
|
|
4
|
+
import { r as J } from "./units-BzZ0gAxs.js";
|
|
5
|
+
import { A as Ae, F as je, I as Me, L as Ne, M as Pe, N as Fe, P as Ie, j as Le } from "./three-d-7MaVzQuZ.js";
|
|
6
|
+
import { k as Re } from "./renderer-CYr9YTXM.js";
|
|
7
|
+
import { i as ze, n as Be, t as Ve } from "./resource-measurement-DuiFWzam.js";
|
|
8
8
|
//#region packages/pptx/src/types.ts
|
|
9
|
-
function
|
|
9
|
+
function He(e) {
|
|
10
10
|
return e;
|
|
11
11
|
}
|
|
12
|
-
var
|
|
12
|
+
var Ue = {
|
|
13
13
|
textarchdown: {
|
|
14
14
|
adj: [["adj", "val 0"]],
|
|
15
15
|
gd: [
|
|
@@ -2391,22 +2391,22 @@ var Le = {
|
|
|
2391
2391
|
]
|
|
2392
2392
|
}]
|
|
2393
2393
|
}
|
|
2394
|
-
},
|
|
2395
|
-
function
|
|
2396
|
-
return e.toLowerCase() in
|
|
2394
|
+
}, We = Math.PI * 2 / 216e5, Ge = Ue, Ke = /* @__PURE__ */ new Map();
|
|
2395
|
+
function qe(e) {
|
|
2396
|
+
return e.toLowerCase() in Ge;
|
|
2397
2397
|
}
|
|
2398
|
-
function
|
|
2399
|
-
let t =
|
|
2398
|
+
function Je(e) {
|
|
2399
|
+
let t = Ke.get(e);
|
|
2400
2400
|
if (t) return t;
|
|
2401
|
-
let n =
|
|
2401
|
+
let n = Ge[e];
|
|
2402
2402
|
return n ? (t = {
|
|
2403
|
-
adj: n.adj.map(([e, t]) => [e,
|
|
2404
|
-
gd: n.gd.map(([e, t]) => [e,
|
|
2403
|
+
adj: n.adj.map(([e, t]) => [e, ie(t)]),
|
|
2404
|
+
gd: n.gd.map(([e, t]) => [e, ie(t)]),
|
|
2405
2405
|
paths: n.paths
|
|
2406
|
-
},
|
|
2406
|
+
}, Ke.set(e, t), t) : null;
|
|
2407
2407
|
}
|
|
2408
|
-
var
|
|
2409
|
-
function
|
|
2408
|
+
var Ye = 48;
|
|
2409
|
+
function Xe(e, t, n, r) {
|
|
2410
2410
|
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;
|
|
2411
2411
|
for (let n of e.cmds) switch (n[0]) {
|
|
2412
2412
|
case "m":
|
|
@@ -2423,8 +2423,8 @@ function We(e, t, n, r) {
|
|
|
2423
2423
|
break;
|
|
2424
2424
|
case "C": {
|
|
2425
2425
|
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]));
|
|
2426
|
-
for (let t = 1; t <=
|
|
2427
|
-
let n = t /
|
|
2426
|
+
for (let t = 1; t <= Ye; t++) {
|
|
2427
|
+
let n = t / Ye, o = 1 - n, s = o * o * o * l + 3 * o * o * n * e + 3 * o * n * n * i + n * n * n * d, p = o * o * o * u + 3 * o * o * n * r + 3 * o * n * n * a + n * n * n * f;
|
|
2428
2428
|
c.push({
|
|
2429
2429
|
x: s,
|
|
2430
2430
|
y: p
|
|
@@ -2435,8 +2435,8 @@ function We(e, t, n, r) {
|
|
|
2435
2435
|
}
|
|
2436
2436
|
case "Q": {
|
|
2437
2437
|
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]));
|
|
2438
|
-
for (let t = 1; t <=
|
|
2439
|
-
let n = t /
|
|
2438
|
+
for (let t = 1; t <= Ye; t++) {
|
|
2439
|
+
let n = t / Ye, o = 1 - n, s = o * o * l + 2 * o * n * e + n * n * i, d = o * o * u + 2 * o * n * r + n * n * a;
|
|
2440
2440
|
c.push({
|
|
2441
2441
|
x: s,
|
|
2442
2442
|
y: d
|
|
@@ -2446,9 +2446,9 @@ function We(e, t, n, r) {
|
|
|
2446
2446
|
break;
|
|
2447
2447
|
}
|
|
2448
2448
|
case "a": {
|
|
2449
|
-
let e = t.resolve(n[1]), r = t.resolve(n[2]), o = e * i, s = r * a, d = t.resolve(n[3]) *
|
|
2449
|
+
let e = t.resolve(n[1]), r = t.resolve(n[2]), o = e * i, s = r * a, d = t.resolve(n[3]) * We, f = t.resolve(n[4]) * We, 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;
|
|
2450
2450
|
_ > 0 && v < 0 ? v += m : _ < 0 && v > 0 && (v -= m);
|
|
2451
|
-
let y = v + g * m, b = l - o * Math.cos(h), x = u - s * Math.sin(h), S = Math.max(
|
|
2451
|
+
let y = v + g * m, b = l - o * Math.cos(h), x = u - s * Math.sin(h), S = Math.max(Ye, Math.ceil(Math.abs(y) / m * 96));
|
|
2452
2452
|
for (let e = 1; e <= S; e++) {
|
|
2453
2453
|
let t = h + y * e / S;
|
|
2454
2454
|
c.push({
|
|
@@ -2463,7 +2463,7 @@ function We(e, t, n, r) {
|
|
|
2463
2463
|
}
|
|
2464
2464
|
return c;
|
|
2465
2465
|
}
|
|
2466
|
-
function
|
|
2466
|
+
function Ze(e) {
|
|
2467
2467
|
let t = [0];
|
|
2468
2468
|
for (let n = 1; n < e.length; n++) {
|
|
2469
2469
|
let r = e[n].x - e[n - 1].x, i = e[n].y - e[n - 1].y;
|
|
@@ -2471,23 +2471,23 @@ function Ge(e) {
|
|
|
2471
2471
|
}
|
|
2472
2472
|
return t;
|
|
2473
2473
|
}
|
|
2474
|
-
function
|
|
2475
|
-
let i =
|
|
2474
|
+
function Qe(e, t, n, r) {
|
|
2475
|
+
let i = Je(e.toLowerCase());
|
|
2476
2476
|
if (!i || i.paths.length === 0) return null;
|
|
2477
|
-
let a =
|
|
2477
|
+
let a = y({
|
|
2478
2478
|
w: n,
|
|
2479
2479
|
h: r,
|
|
2480
2480
|
adj: t
|
|
2481
|
-
}, i.adj, i.gd), o = i.paths.length === 1, s =
|
|
2481
|
+
}, i.adj, i.gd), o = i.paths.length === 1, s = Xe(i.paths[0], a, n, r), c = o ? s : Xe(i.paths[i.paths.length - 1], a, n, r);
|
|
2482
2482
|
return {
|
|
2483
2483
|
top: s,
|
|
2484
2484
|
bottom: c,
|
|
2485
|
-
topLen:
|
|
2486
|
-
bottomLen:
|
|
2485
|
+
topLen: Ze(s),
|
|
2486
|
+
bottomLen: Ze(c),
|
|
2487
2487
|
singleEdge: o
|
|
2488
2488
|
};
|
|
2489
2489
|
}
|
|
2490
|
-
function
|
|
2490
|
+
function $e(e, t, n) {
|
|
2491
2491
|
let r = t[t.length - 1];
|
|
2492
2492
|
if (e.length === 1 || r === 0) return {
|
|
2493
2493
|
x: e[0].x,
|
|
@@ -2508,17 +2508,17 @@ function qe(e, t, n) {
|
|
|
2508
2508
|
ty: f / p
|
|
2509
2509
|
};
|
|
2510
2510
|
}
|
|
2511
|
-
function
|
|
2511
|
+
function et(e) {
|
|
2512
2512
|
return e.topLen[e.topLen.length - 1] ?? 0;
|
|
2513
2513
|
}
|
|
2514
|
-
function
|
|
2514
|
+
function tt(e, t) {
|
|
2515
2515
|
if (!e.singleEdge) return 1;
|
|
2516
|
-
let n =
|
|
2516
|
+
let n = et(e);
|
|
2517
2517
|
return n <= 0 ? 1 : Math.max(0, Math.min(1, t / n));
|
|
2518
2518
|
}
|
|
2519
|
-
function
|
|
2519
|
+
function nt(e, t, n, r) {
|
|
2520
2520
|
if (e.singleEdge) {
|
|
2521
|
-
let i =
|
|
2521
|
+
let i = $e(e.top, e.topLen, t), a = Math.atan2(i.ty, i.tx), o = i.ty, s = -i.tx, c = n * (1 - r);
|
|
2522
2522
|
return {
|
|
2523
2523
|
x: i.x - o * c,
|
|
2524
2524
|
y: i.y - s * c,
|
|
@@ -2527,7 +2527,7 @@ function Xe(e, t, n, r) {
|
|
|
2527
2527
|
shear: 0
|
|
2528
2528
|
};
|
|
2529
2529
|
}
|
|
2530
|
-
let i =
|
|
2530
|
+
let i = $e(e.top, e.topLen, t), a = $e(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);
|
|
2531
2531
|
return {
|
|
2532
2532
|
x: c,
|
|
2533
2533
|
y: l,
|
|
@@ -2538,7 +2538,7 @@ function Xe(e, t, n, r) {
|
|
|
2538
2538
|
}
|
|
2539
2539
|
//#endregion
|
|
2540
2540
|
//#region packages/core/src/shape/scene3d-camera.ts
|
|
2541
|
-
var
|
|
2541
|
+
var rt = 26, it = {
|
|
2542
2542
|
orthographicFront: {
|
|
2543
2543
|
kind: "orthographic",
|
|
2544
2544
|
baseLat: 0,
|
|
@@ -2551,52 +2551,52 @@ var Ze = 26, Qe = {
|
|
|
2551
2551
|
baseLat: 0,
|
|
2552
2552
|
baseLon: 0,
|
|
2553
2553
|
baseRev: 0,
|
|
2554
|
-
fovDeg:
|
|
2554
|
+
fovDeg: rt
|
|
2555
2555
|
},
|
|
2556
2556
|
perspectiveRelaxed: {
|
|
2557
2557
|
kind: "perspective",
|
|
2558
2558
|
baseLat: 0,
|
|
2559
2559
|
baseLon: 0,
|
|
2560
2560
|
baseRev: 0,
|
|
2561
|
-
fovDeg:
|
|
2561
|
+
fovDeg: rt
|
|
2562
2562
|
},
|
|
2563
2563
|
perspectiveRelaxedModerately: {
|
|
2564
2564
|
kind: "perspective",
|
|
2565
2565
|
baseLat: 0,
|
|
2566
2566
|
baseLon: 0,
|
|
2567
2567
|
baseRev: 0,
|
|
2568
|
-
fovDeg:
|
|
2568
|
+
fovDeg: rt
|
|
2569
2569
|
},
|
|
2570
2570
|
perspectiveAbove: {
|
|
2571
2571
|
kind: "perspective",
|
|
2572
2572
|
baseLat: -20,
|
|
2573
2573
|
baseLon: 0,
|
|
2574
2574
|
baseRev: 0,
|
|
2575
|
-
fovDeg:
|
|
2575
|
+
fovDeg: rt
|
|
2576
2576
|
},
|
|
2577
2577
|
perspectiveBelow: {
|
|
2578
2578
|
kind: "perspective",
|
|
2579
2579
|
baseLat: 20,
|
|
2580
2580
|
baseLon: 0,
|
|
2581
2581
|
baseRev: 0,
|
|
2582
|
-
fovDeg:
|
|
2582
|
+
fovDeg: rt
|
|
2583
2583
|
},
|
|
2584
2584
|
perspectiveLeft: {
|
|
2585
2585
|
kind: "perspective",
|
|
2586
2586
|
baseLat: 0,
|
|
2587
2587
|
baseLon: -20,
|
|
2588
2588
|
baseRev: 0,
|
|
2589
|
-
fovDeg:
|
|
2589
|
+
fovDeg: rt
|
|
2590
2590
|
},
|
|
2591
2591
|
perspectiveRight: {
|
|
2592
2592
|
kind: "perspective",
|
|
2593
2593
|
baseLat: 0,
|
|
2594
2594
|
baseLon: 20,
|
|
2595
2595
|
baseRev: 0,
|
|
2596
|
-
fovDeg:
|
|
2596
|
+
fovDeg: rt
|
|
2597
2597
|
}
|
|
2598
2598
|
};
|
|
2599
|
-
function
|
|
2599
|
+
function at(e, t) {
|
|
2600
2600
|
let n = Array(9).fill(0);
|
|
2601
2601
|
for (let r = 0; r < 3; r++) for (let i = 0; i < 3; i++) {
|
|
2602
2602
|
let a = 0;
|
|
@@ -2605,7 +2605,7 @@ function $e(e, t) {
|
|
|
2605
2605
|
}
|
|
2606
2606
|
return n;
|
|
2607
2607
|
}
|
|
2608
|
-
function
|
|
2608
|
+
function ot(e) {
|
|
2609
2609
|
let t = e * Math.PI / 180, n = Math.cos(t), r = Math.sin(t);
|
|
2610
2610
|
return [
|
|
2611
2611
|
1,
|
|
@@ -2619,7 +2619,7 @@ function et(e) {
|
|
|
2619
2619
|
n
|
|
2620
2620
|
];
|
|
2621
2621
|
}
|
|
2622
|
-
function
|
|
2622
|
+
function st(e) {
|
|
2623
2623
|
let t = e * Math.PI / 180, n = Math.cos(t), r = Math.sin(t);
|
|
2624
2624
|
return [
|
|
2625
2625
|
n,
|
|
@@ -2633,7 +2633,7 @@ function tt(e) {
|
|
|
2633
2633
|
n
|
|
2634
2634
|
];
|
|
2635
2635
|
}
|
|
2636
|
-
function
|
|
2636
|
+
function ct(e) {
|
|
2637
2637
|
let t = e * Math.PI / 180, n = Math.cos(t), r = Math.sin(t);
|
|
2638
2638
|
return [
|
|
2639
2639
|
n,
|
|
@@ -2647,22 +2647,22 @@ function nt(e) {
|
|
|
2647
2647
|
1
|
|
2648
2648
|
];
|
|
2649
2649
|
}
|
|
2650
|
-
function
|
|
2650
|
+
function lt(e, t, n, r) {
|
|
2651
2651
|
return [
|
|
2652
2652
|
e[0] * t + e[1] * n + e[2] * r,
|
|
2653
2653
|
e[3] * t + e[4] * n + e[5] * r,
|
|
2654
2654
|
e[6] * t + e[7] * n + e[8] * r
|
|
2655
2655
|
];
|
|
2656
2656
|
}
|
|
2657
|
-
function
|
|
2657
|
+
function ut(e, t) {
|
|
2658
2658
|
let n = t ? t.lat : e.baseLat, r = t ? t.lon : e.baseLon;
|
|
2659
|
-
return
|
|
2659
|
+
return at(ct(-(t ? t.rev : e.baseRev)), at(ot(-n), st(-r)));
|
|
2660
2660
|
}
|
|
2661
|
-
function
|
|
2662
|
-
return
|
|
2661
|
+
function dt(e) {
|
|
2662
|
+
return it[e] || (e.startsWith("perspective") ? it.perspectiveFront : it.orthographicFront);
|
|
2663
2663
|
}
|
|
2664
|
-
function
|
|
2665
|
-
let r =
|
|
2664
|
+
function ft(e, t, n) {
|
|
2665
|
+
let r = dt(e.prst), i = ut(r, e.rot);
|
|
2666
2666
|
if (t <= 0 || n <= 0) return {
|
|
2667
2667
|
corners: [
|
|
2668
2668
|
{
|
|
@@ -2694,11 +2694,11 @@ function ot(e, t, n) {
|
|
|
2694
2694
|
if (r.kind === "perspective") {
|
|
2695
2695
|
let t = e.fov ?? r.fovDeg, n = Math.max(1, Math.min(179, t)) * Math.PI / 180, a = l / Math.tan(n / 2);
|
|
2696
2696
|
u = s.map(([e, t]) => {
|
|
2697
|
-
let [n, r, o] =
|
|
2697
|
+
let [n, r, o] = lt(i, e, t, 0), s = a - o, c = a / (Math.abs(s) < 1e-6 ? 1e-6 * Math.sign(s || 1) : s);
|
|
2698
2698
|
return [n * c, r * c];
|
|
2699
2699
|
});
|
|
2700
2700
|
} else u = s.map(([e, t]) => {
|
|
2701
|
-
let [n, r] =
|
|
2701
|
+
let [n, r] = lt(i, e, t, 0);
|
|
2702
2702
|
return [n, r];
|
|
2703
2703
|
});
|
|
2704
2704
|
u = u.map(([e, t]) => [e * c, t * c]);
|
|
@@ -2721,18 +2721,18 @@ function ot(e, t, n) {
|
|
|
2721
2721
|
isIdentity: _
|
|
2722
2722
|
};
|
|
2723
2723
|
}
|
|
2724
|
-
function
|
|
2725
|
-
let { isIdentity: t } =
|
|
2724
|
+
function pt(e) {
|
|
2725
|
+
let { isIdentity: t } = ft(e, 1e3, 1e3);
|
|
2726
2726
|
return !t;
|
|
2727
2727
|
}
|
|
2728
|
-
function
|
|
2729
|
-
let i =
|
|
2728
|
+
function mt(e, t, n, r) {
|
|
2729
|
+
let i = dt(e.prst), a = ut(i, e.rot);
|
|
2730
2730
|
if (t <= 0 || n <= 0 || r === 0) return {
|
|
2731
2731
|
x: 0,
|
|
2732
2732
|
y: 0
|
|
2733
2733
|
};
|
|
2734
2734
|
let o = t / 2, s = n / 2, c = Math.max(o, s), l = e.zoom ?? 1, u = (t) => {
|
|
2735
|
-
let [n, r, o] =
|
|
2735
|
+
let [n, r, o] = lt(a, 0, 0, t);
|
|
2736
2736
|
if (i.kind === "perspective") {
|
|
2737
2737
|
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);
|
|
2738
2738
|
return [n * d * l, r * d * l];
|
|
@@ -2746,12 +2746,12 @@ function ct(e, t, n, r) {
|
|
|
2746
2746
|
}
|
|
2747
2747
|
//#endregion
|
|
2748
2748
|
//#region packages/core/src/shape/bevel-shading.ts
|
|
2749
|
-
function
|
|
2749
|
+
function ht(e, t) {
|
|
2750
2750
|
if (t <= 0) return () => 1;
|
|
2751
2751
|
let n = (e) => Math.max(0, Math.min(1, e / t));
|
|
2752
2752
|
switch (e) {
|
|
2753
2753
|
case "hardEdge": {
|
|
2754
|
-
let e =
|
|
2754
|
+
let e = Ct;
|
|
2755
2755
|
return (t) => {
|
|
2756
2756
|
let r = Math.min(1, n(t) / e);
|
|
2757
2757
|
return r * r * (3 - 2 * r);
|
|
@@ -2771,7 +2771,7 @@ function lt(e, t) {
|
|
|
2771
2771
|
};
|
|
2772
2772
|
}
|
|
2773
2773
|
}
|
|
2774
|
-
function
|
|
2774
|
+
function gt(e) {
|
|
2775
2775
|
let t = e.length, n = new Float64Array(t);
|
|
2776
2776
|
if (t === 0) return n;
|
|
2777
2777
|
let r = new Int32Array(t), i = new Float64Array(t + 1), a = 0;
|
|
@@ -2789,7 +2789,7 @@ function ut(e) {
|
|
|
2789
2789
|
}
|
|
2790
2790
|
return n;
|
|
2791
2791
|
}
|
|
2792
|
-
function
|
|
2792
|
+
function _t(e, t = 3) {
|
|
2793
2793
|
if (e <= 0) return Array(t).fill(1);
|
|
2794
2794
|
let n = Math.sqrt(12 * e * e / t + 1), r = Math.floor(n);
|
|
2795
2795
|
r % 2 == 0 && r--;
|
|
@@ -2797,7 +2797,7 @@ function dt(e, t = 3) {
|
|
|
2797
2797
|
for (let e = 0; e < t; e++) s.push(e < o ? r : i);
|
|
2798
2798
|
return s;
|
|
2799
2799
|
}
|
|
2800
|
-
function
|
|
2800
|
+
function vt(e, t, n, r, i, a) {
|
|
2801
2801
|
let o = 1 / (2 * i + 1);
|
|
2802
2802
|
if (a) for (let a = 0; a < r; a++) {
|
|
2803
2803
|
let r = a * n, s = 0;
|
|
@@ -2818,29 +2818,29 @@ function ft(e, t, n, r, i, a) {
|
|
|
2818
2818
|
}
|
|
2819
2819
|
}
|
|
2820
2820
|
}
|
|
2821
|
-
function
|
|
2821
|
+
function yt(e, t, n, r) {
|
|
2822
2822
|
let i = Float64Array.from(e);
|
|
2823
2823
|
if (r <= 0 || t <= 0 || n <= 0) return i;
|
|
2824
2824
|
let a = new Float64Array(t * n);
|
|
2825
|
-
for (let e of
|
|
2825
|
+
for (let e of _t(r, 3)) {
|
|
2826
2826
|
let r = Math.max(1, (e - 1) / 2);
|
|
2827
|
-
|
|
2827
|
+
vt(i, a, t, n, r, !0), vt(a, i, t, n, r, !1);
|
|
2828
2828
|
}
|
|
2829
2829
|
return i;
|
|
2830
2830
|
}
|
|
2831
|
-
function
|
|
2831
|
+
function bt(e, t, n, r = 128) {
|
|
2832
2832
|
let i = new Float64Array(t * n);
|
|
2833
2833
|
for (let a = 0; a < t * n; a++) i[a] = (e[a] ?? 0) >= r ? 0x56bc75e2d63100000 : 0;
|
|
2834
2834
|
let a = new Float64Array(n);
|
|
2835
2835
|
for (let e = 0; e < t; e++) {
|
|
2836
2836
|
for (let r = 0; r < n; r++) a[r] = i[r * t + e];
|
|
2837
|
-
let r =
|
|
2837
|
+
let r = gt(a);
|
|
2838
2838
|
for (let a = 0; a < n; a++) i[a * t + e] = r[a];
|
|
2839
2839
|
}
|
|
2840
2840
|
let o = new Float64Array(t);
|
|
2841
2841
|
for (let e = 0; e < n; e++) {
|
|
2842
2842
|
for (let n = 0; n < t; n++) o[n] = i[e * t + n];
|
|
2843
|
-
let n =
|
|
2843
|
+
let n = gt(o);
|
|
2844
2844
|
for (let r = 0; r < t; r++) i[e * t + r] = n[r];
|
|
2845
2845
|
}
|
|
2846
2846
|
for (let e = 0; e < n; e++) for (let r = 0; r < t; r++) {
|
|
@@ -2852,15 +2852,15 @@ function mt(e, t, n, r = 128) {
|
|
|
2852
2852
|
for (let e = 0; e < t * n; e++) i[e] = Math.sqrt(i[e]);
|
|
2853
2853
|
return i;
|
|
2854
2854
|
}
|
|
2855
|
-
var
|
|
2856
|
-
function
|
|
2855
|
+
var xt = .25, St = .35, Ct = .5;
|
|
2856
|
+
function wt(e, t, n, r, i, a) {
|
|
2857
2857
|
let o = new Float32Array(t * n * 3), s = new Uint8Array(t * n), c = new Float32Array(t * n);
|
|
2858
2858
|
if (t <= 0 || n <= 0) return {
|
|
2859
2859
|
normals: o,
|
|
2860
2860
|
bandMask: s,
|
|
2861
2861
|
bandWeight: c
|
|
2862
2862
|
};
|
|
2863
|
-
let l =
|
|
2863
|
+
let l = bt(e, t, n), u = ht(i, r), d = (n, r) => (e[r * t + n] ?? 0) >= 128, f = (r > 0 ? a / r : 0) * r, p = yt(l, t, n, Math.max(1, r * xt)), m = (e) => {
|
|
2864
2864
|
let t = u(Math.max(0, e - .5));
|
|
2865
2865
|
return u(e + .5) - t;
|
|
2866
2866
|
};
|
|
@@ -2875,9 +2875,9 @@ function vt(e, t, n, r, i, a) {
|
|
|
2875
2875
|
o[a * 3 + 2] = 1;
|
|
2876
2876
|
continue;
|
|
2877
2877
|
}
|
|
2878
|
-
let g = u / r, _ = 1 -
|
|
2878
|
+
let g = u / r, _ = 1 - St, v = 1;
|
|
2879
2879
|
if (g > _) {
|
|
2880
|
-
let e = Math.min(1, (g - _) /
|
|
2880
|
+
let e = Math.min(1, (g - _) / St);
|
|
2881
2881
|
v = 1 - e * e * (3 - 2 * e);
|
|
2882
2882
|
}
|
|
2883
2883
|
c[a] = v;
|
|
@@ -2892,7 +2892,7 @@ function vt(e, t, n, r, i, a) {
|
|
|
2892
2892
|
bandWeight: c
|
|
2893
2893
|
};
|
|
2894
2894
|
}
|
|
2895
|
-
var
|
|
2895
|
+
var Tt = 35 * Math.PI / 180, Et = 12 * Math.PI / 180, Dt = {
|
|
2896
2896
|
t: {
|
|
2897
2897
|
x: 0,
|
|
2898
2898
|
y: -1
|
|
@@ -2926,22 +2926,22 @@ var yt = 35 * Math.PI / 180, bt = 12 * Math.PI / 180, xt = {
|
|
|
2926
2926
|
y: 1
|
|
2927
2927
|
}
|
|
2928
2928
|
};
|
|
2929
|
-
function
|
|
2929
|
+
function Ot(e, t, n) {
|
|
2930
2930
|
let r = n * Math.PI / 180, i = Math.cos(r), a = Math.sin(r);
|
|
2931
2931
|
return {
|
|
2932
2932
|
x: e * i - t * a,
|
|
2933
2933
|
y: e * a + t * i
|
|
2934
2934
|
};
|
|
2935
2935
|
}
|
|
2936
|
-
function
|
|
2937
|
-
let r =
|
|
2938
|
-
return n && n.rev && (r =
|
|
2936
|
+
function kt(e, t, n) {
|
|
2937
|
+
let r = Dt[t] ?? Dt.t;
|
|
2938
|
+
return n && n.rev && (r = Ot(r.x, r.y, n.rev)), jt(r.x, r.y, Tt);
|
|
2939
2939
|
}
|
|
2940
|
-
function
|
|
2940
|
+
function At(e) {
|
|
2941
2941
|
let t = Math.hypot(e.x, e.y) || 1;
|
|
2942
|
-
return
|
|
2942
|
+
return jt(-e.x / t, -e.y / t, Et);
|
|
2943
2943
|
}
|
|
2944
|
-
function
|
|
2944
|
+
function jt(e, t, n) {
|
|
2945
2945
|
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;
|
|
2946
2946
|
return {
|
|
2947
2947
|
x: o / l,
|
|
@@ -2949,7 +2949,7 @@ function Tt(e, t, n) {
|
|
|
2949
2949
|
z: c / l
|
|
2950
2950
|
};
|
|
2951
2951
|
}
|
|
2952
|
-
var
|
|
2952
|
+
var Mt = 2, Nt = {
|
|
2953
2953
|
matte: {
|
|
2954
2954
|
ambient: .62,
|
|
2955
2955
|
diffuse: .45,
|
|
@@ -2962,8 +2962,8 @@ var Et = 2, Dt = {
|
|
|
2962
2962
|
specular: .35,
|
|
2963
2963
|
shininess: 22
|
|
2964
2964
|
}
|
|
2965
|
-
},
|
|
2966
|
-
function
|
|
2965
|
+
}, Pt = .8;
|
|
2966
|
+
function Ft(e) {
|
|
2967
2967
|
switch (e) {
|
|
2968
2968
|
case "plastic":
|
|
2969
2969
|
case "metal":
|
|
@@ -2974,8 +2974,8 @@ function kt(e) {
|
|
|
2974
2974
|
default: return "matte";
|
|
2975
2975
|
}
|
|
2976
2976
|
}
|
|
2977
|
-
function
|
|
2978
|
-
let r =
|
|
2977
|
+
function It(e, t, n = !0) {
|
|
2978
|
+
let r = Nt[e], i = {
|
|
2979
2979
|
light: t,
|
|
2980
2980
|
material: e,
|
|
2981
2981
|
ambient: r.ambient,
|
|
@@ -2983,9 +2983,9 @@ function At(e, t, n = !0) {
|
|
|
2983
2983
|
specular: r.specular,
|
|
2984
2984
|
shininess: r.shininess
|
|
2985
2985
|
};
|
|
2986
|
-
return n && (i.fillLight =
|
|
2986
|
+
return n && (i.fillLight = At(t), i.fillDiffuse = i.diffuse * Pt), i;
|
|
2987
2987
|
}
|
|
2988
|
-
function
|
|
2988
|
+
function Lt(e, t) {
|
|
2989
2989
|
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;
|
|
2990
2990
|
if (t.fillLight && t.fillDiffuse) {
|
|
2991
2991
|
let n = e.x * t.fillLight.x + e.y * t.fillLight.y + e.z * t.fillLight.z;
|
|
@@ -2998,7 +2998,7 @@ function jt(e, t) {
|
|
|
2998
2998
|
}
|
|
2999
2999
|
return Math.max(0, t.ambient + r + i + a);
|
|
3000
3000
|
}
|
|
3001
|
-
function
|
|
3001
|
+
function Rt(e, t, n) {
|
|
3002
3002
|
if (!e) return {
|
|
3003
3003
|
x: 0,
|
|
3004
3004
|
y: 0,
|
|
@@ -3013,16 +3013,16 @@ function Mt(e, t, n) {
|
|
|
3013
3013
|
h: Math.max(0, o - i)
|
|
3014
3014
|
};
|
|
3015
3015
|
}
|
|
3016
|
-
function
|
|
3016
|
+
function zt(e, t, n) {
|
|
3017
3017
|
let r = e.canvas.width, i = e.canvas.height;
|
|
3018
3018
|
if (r <= 0 || i <= 0) return;
|
|
3019
3019
|
let a = t.widthPx;
|
|
3020
3020
|
if (a < .75) return;
|
|
3021
|
-
let { x: o, y: s, w: c, h: l } =
|
|
3021
|
+
let { x: o, y: s, w: c, h: l } = Rt(n, r, i);
|
|
3022
3022
|
if (c <= 0 || l <= 0) return;
|
|
3023
3023
|
let u = e.getImageData(o, s, c, l), d = u.data, f = new Uint8ClampedArray(c * l);
|
|
3024
3024
|
for (let e = 0; e < c * l; e++) f[e] = d[e * 4 + 3];
|
|
3025
|
-
let { bandMask: p, bandWeight: m, normals: h } =
|
|
3025
|
+
let { bandMask: p, bandWeight: m, normals: h } = wt(f, c, l, a, t.prst, t.heightPx), g = It(t.material, t.light), _ = Lt({
|
|
3026
3026
|
x: 0,
|
|
3027
3027
|
y: 0,
|
|
3028
3028
|
z: 1
|
|
@@ -3033,13 +3033,13 @@ function Nt(e, t, n) {
|
|
|
3033
3033
|
if (n <= 0) continue;
|
|
3034
3034
|
let r = h[e * 3], i = h[e * 3 + 1], a = h[e * 3 + 2];
|
|
3035
3035
|
t.bottom && (r = -r, i = -i);
|
|
3036
|
-
let o = 1 + (
|
|
3036
|
+
let o = 1 + (Lt({
|
|
3037
3037
|
x: r,
|
|
3038
3038
|
y: i,
|
|
3039
3039
|
z: a
|
|
3040
3040
|
}, g) / _ - 1) * n, s = e * 4;
|
|
3041
3041
|
if (o >= 1) {
|
|
3042
|
-
let e = Math.min(1, (o - 1) *
|
|
3042
|
+
let e = Math.min(1, (o - 1) * Mt);
|
|
3043
3043
|
for (let t = 0; t < 3; t++) {
|
|
3044
3044
|
let n = Math.min(255, d[s + t] * o);
|
|
3045
3045
|
d[s + t] = n + (255 - n) * e;
|
|
@@ -3048,12 +3048,12 @@ function Nt(e, t, n) {
|
|
|
3048
3048
|
}
|
|
3049
3049
|
e.putImageData(u, o, s);
|
|
3050
3050
|
}
|
|
3051
|
-
function
|
|
3051
|
+
function Bt(e, t, n) {
|
|
3052
3052
|
let r = e.canvas.width, i = e.canvas.height;
|
|
3053
3053
|
if (r <= 0 || i <= 0) return;
|
|
3054
3054
|
let a = t.offsetX, o = t.offsetY, s = Math.hypot(a, o);
|
|
3055
3055
|
if (s < .75) return;
|
|
3056
|
-
let { x: c, y: l, w: u, h: d } =
|
|
3056
|
+
let { x: c, y: l, w: u, h: d } = Rt(n, r, i);
|
|
3057
3057
|
if (u <= 0 || d <= 0) return;
|
|
3058
3058
|
let f = e.getImageData(c, l, u, d), p = f.data, m = new Uint8ClampedArray(u * d);
|
|
3059
3059
|
for (let e = 0; e < u * d; e++) m[e] = p[e * 4 + 3];
|
|
@@ -3077,36 +3077,36 @@ function Pt(e, t, n) {
|
|
|
3077
3077
|
}
|
|
3078
3078
|
//#endregion
|
|
3079
3079
|
//#region packages/core/src/text/underline.ts
|
|
3080
|
-
function
|
|
3081
|
-
let
|
|
3082
|
-
if (
|
|
3083
|
-
let
|
|
3084
|
-
|
|
3085
|
-
let a = Math.max(1,
|
|
3086
|
-
for (let o = 0; o <=
|
|
3087
|
-
let
|
|
3088
|
-
|
|
3080
|
+
function Vt(t, n, r, i, a, o, s, c = 1) {
|
|
3081
|
+
let l = Math.max(1, a * .05), u = s === "heavy" || (s?.endsWith("Heavy") ?? !1) ? l * 1.8 : l, d = r + Math.max(2, u), f = e(d, u, c);
|
|
3082
|
+
if (t.strokeStyle = o, t.lineWidth = u, t.setLineDash([]), s && s.startsWith("wavy")) {
|
|
3083
|
+
let e = u, r = u * 6;
|
|
3084
|
+
t.beginPath(), t.moveTo(n, d);
|
|
3085
|
+
let a = Math.max(1, u * .5);
|
|
3086
|
+
for (let o = 0; o <= i; o += a) {
|
|
3087
|
+
let i = d + Math.sin(o / r * Math.PI * 2) * e;
|
|
3088
|
+
t.lineTo(n + o, i);
|
|
3089
3089
|
}
|
|
3090
|
-
if (
|
|
3091
|
-
|
|
3092
|
-
for (let o = 0; o <=
|
|
3093
|
-
let
|
|
3094
|
-
|
|
3090
|
+
if (t.stroke(), s === "wavyDbl") {
|
|
3091
|
+
t.beginPath(), t.moveTo(n, d + e * 2.5);
|
|
3092
|
+
for (let o = 0; o <= i; o += a) {
|
|
3093
|
+
let i = d + e * 2.5 + Math.sin(o / r * Math.PI * 2) * e;
|
|
3094
|
+
t.lineTo(n + o, i);
|
|
3095
3095
|
}
|
|
3096
|
-
|
|
3096
|
+
t.stroke();
|
|
3097
3097
|
}
|
|
3098
3098
|
return;
|
|
3099
3099
|
}
|
|
3100
|
-
if (
|
|
3101
|
-
let
|
|
3102
|
-
|
|
3100
|
+
if (s === "dbl") {
|
|
3101
|
+
let r = u * 1.4, a = d - r / 2, o = d + r / 2;
|
|
3102
|
+
t.beginPath(), t.moveTo(n, a + e(a, u, c)), t.lineTo(n + i, a + e(a, u, c)), t.moveTo(n, o + e(o, u, c)), t.lineTo(n + i, o + e(o, u, c)), t.stroke();
|
|
3103
3103
|
return;
|
|
3104
3104
|
}
|
|
3105
|
-
|
|
3105
|
+
t.setLineDash(ye(s ?? "sng", u)), t.beginPath(), t.moveTo(n, d + f), t.lineTo(n + i, d + f), t.stroke(), t.setLineDash([]);
|
|
3106
3106
|
}
|
|
3107
3107
|
//#endregion
|
|
3108
3108
|
//#region packages/core/src/text/highlight-box.ts
|
|
3109
|
-
function
|
|
3109
|
+
function Ht(e, t) {
|
|
3110
3110
|
return {
|
|
3111
3111
|
top: e - t * .85,
|
|
3112
3112
|
height: t * 1.1
|
|
@@ -3114,7 +3114,7 @@ function It(e, t) {
|
|
|
3114
3114
|
}
|
|
3115
3115
|
//#endregion
|
|
3116
3116
|
//#region packages/core/src/text/justify-positions.ts
|
|
3117
|
-
function
|
|
3117
|
+
function Ut(e, t, n, r, i = 0) {
|
|
3118
3118
|
let a = [], o = 0, s = 0;
|
|
3119
3119
|
for (let c of t) a.push({
|
|
3120
3120
|
text: e.slice(o, c).join(""),
|
|
@@ -3127,14 +3127,14 @@ function Lt(e, t, n, r, i = 0) {
|
|
|
3127
3127
|
}
|
|
3128
3128
|
//#endregion
|
|
3129
3129
|
//#region packages/pptx/src/reflection-blur.ts
|
|
3130
|
-
var
|
|
3131
|
-
function
|
|
3130
|
+
var Wt = .5;
|
|
3131
|
+
function Gt(e, t) {
|
|
3132
3132
|
if (!(t > 0) || !(e.h > 0)) return [{
|
|
3133
3133
|
y: e.y,
|
|
3134
3134
|
h: Math.max(0, e.h),
|
|
3135
3135
|
radius: 0
|
|
3136
3136
|
}];
|
|
3137
|
-
let n = Math.max(4, Math.min(24, Math.ceil(t /
|
|
3137
|
+
let n = Math.max(4, Math.min(24, Math.ceil(t / Wt) + 1)), r = e.y + e.h, i = [];
|
|
3138
3138
|
for (let a = 0; a < n; a++) {
|
|
3139
3139
|
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;
|
|
3140
3140
|
i.push({
|
|
@@ -3145,19 +3145,19 @@ function zt(e, t) {
|
|
|
3145
3145
|
}
|
|
3146
3146
|
return i;
|
|
3147
3147
|
}
|
|
3148
|
-
function
|
|
3149
|
-
for (let a of
|
|
3148
|
+
function Kt(e, t, n, r, i) {
|
|
3149
|
+
for (let a of Gt(n, r)) e.save(), e.beginPath(), e.rect(0, a.y, i, a.h), e.clip(), e.filter = a.radius > 0 ? `blur(${a.radius}px)` : "none", e.drawImage(t, 0, 0), e.restore();
|
|
3150
3150
|
}
|
|
3151
3151
|
//#endregion
|
|
3152
3152
|
//#region packages/pptx/src/hyperlink.ts
|
|
3153
|
-
function
|
|
3153
|
+
function qt(e, t) {
|
|
3154
3154
|
let n = e !== void 0 && e !== "" ? e : void 0, r = t !== void 0 && t !== "" ? t : void 0;
|
|
3155
3155
|
if (n === void 0 && r === void 0) return;
|
|
3156
3156
|
if (r !== void 0) return {
|
|
3157
3157
|
kind: "internal",
|
|
3158
3158
|
ref: n ?? r
|
|
3159
3159
|
};
|
|
3160
|
-
let i = n, a =
|
|
3160
|
+
let i = n, a = M(i);
|
|
3161
3161
|
return a !== null && U.includes(a) ? {
|
|
3162
3162
|
kind: "external",
|
|
3163
3163
|
url: i
|
|
@@ -3168,7 +3168,7 @@ function Vt(e, t) {
|
|
|
3168
3168
|
}
|
|
3169
3169
|
//#endregion
|
|
3170
3170
|
//#region packages/pptx/src/media-chrome.ts
|
|
3171
|
-
function
|
|
3171
|
+
function Jt(e, t, n, r, i, a) {
|
|
3172
3172
|
let o = Math.max(18, Math.min(32, Math.min(r, i) * .25));
|
|
3173
3173
|
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") {
|
|
3174
3174
|
e.beginPath();
|
|
@@ -3182,47 +3182,47 @@ function Ht(e, t, n, r, i, a) {
|
|
|
3182
3182
|
}
|
|
3183
3183
|
//#endregion
|
|
3184
3184
|
//#region packages/pptx/src/bidi-line.ts
|
|
3185
|
-
var
|
|
3185
|
+
var Yt = (e) => {
|
|
3186
3186
|
let t = e.text;
|
|
3187
3187
|
return typeof t == "string" ? t : void 0;
|
|
3188
|
-
},
|
|
3189
|
-
function
|
|
3188
|
+
}, Xt = (e) => "isTab" in e;
|
|
3189
|
+
function Zt(e) {
|
|
3190
3190
|
for (let t of e) {
|
|
3191
|
-
let e =
|
|
3192
|
-
if (e !== void 0 &&
|
|
3191
|
+
let e = Yt(t);
|
|
3192
|
+
if (e !== void 0 && P(e)) return !0;
|
|
3193
3193
|
}
|
|
3194
3194
|
return !1;
|
|
3195
3195
|
}
|
|
3196
|
-
function
|
|
3197
|
-
let r =
|
|
3196
|
+
function Qt(e, n) {
|
|
3197
|
+
let r = e.length;
|
|
3198
3198
|
if (r === 0) return {
|
|
3199
3199
|
order: [],
|
|
3200
3200
|
rtl: []
|
|
3201
3201
|
};
|
|
3202
3202
|
let i = "", a = Array(r), o;
|
|
3203
|
-
for (let
|
|
3204
|
-
a[
|
|
3205
|
-
let n =
|
|
3206
|
-
if (i += n.length > 0 ? n : "",
|
|
3203
|
+
for (let t = 0; t < r; t++) {
|
|
3204
|
+
a[t] = i.length;
|
|
3205
|
+
let n = Yt(e[t]) ?? "";
|
|
3206
|
+
if (i += n.length > 0 ? n : "", Xt(e[t])) {
|
|
3207
3207
|
for (o ??= []; o.length < i.length;) o.push(null);
|
|
3208
|
-
o[a[
|
|
3208
|
+
o[a[t]] = "S";
|
|
3209
3209
|
}
|
|
3210
3210
|
}
|
|
3211
3211
|
if (o) for (; o.length < i.length;) o.push(null);
|
|
3212
|
-
let { levels: s, paragraphLevel: c } =
|
|
3213
|
-
for (let e = 0; e < r; e++)
|
|
3212
|
+
let { levels: s, paragraphLevel: c } = u().computeLevels(i, n ? "rtl" : "ltr", o), { order: l, segLevels: d } = t(s, c, a), f = Array(r);
|
|
3213
|
+
for (let e = 0; e < r; e++) f[e] = (d[e] & 1) == 1;
|
|
3214
3214
|
return {
|
|
3215
3215
|
order: l,
|
|
3216
|
-
rtl:
|
|
3216
|
+
rtl: f
|
|
3217
3217
|
};
|
|
3218
3218
|
}
|
|
3219
3219
|
//#endregion
|
|
3220
3220
|
//#region packages/pptx/src/cjk-wrap.ts
|
|
3221
|
-
function
|
|
3221
|
+
function $t(e, t, n, r, i = 0, a = !1) {
|
|
3222
3222
|
if (e.length === 0) return 0;
|
|
3223
3223
|
let s = t === 0, c = 0, l = t;
|
|
3224
3224
|
for (let t of e) {
|
|
3225
|
-
let e = c > 0 ||
|
|
3225
|
+
let e = c > 0 || a ? i : 0;
|
|
3226
3226
|
if (l + e + t.w > n) {
|
|
3227
3227
|
if (c > 0 || !s) break;
|
|
3228
3228
|
l += e + t.w, c++;
|
|
@@ -3230,20 +3230,20 @@ function qt(e, t, n, r, a = 0, o = !1) {
|
|
|
3230
3230
|
}
|
|
3231
3231
|
l += e + t.w, c++;
|
|
3232
3232
|
}
|
|
3233
|
-
return c === 0 ? 0 : c >= e.length ? e.length :
|
|
3233
|
+
return c === 0 ? 0 : c >= e.length ? e.length : o(e.map((e) => e.ch), c, r, +!!s);
|
|
3234
3234
|
}
|
|
3235
3235
|
//#endregion
|
|
3236
3236
|
//#region packages/pptx/src/text-justify.ts
|
|
3237
|
-
var
|
|
3238
|
-
function
|
|
3237
|
+
var en = (e) => /\s/.test(String.fromCodePoint(e));
|
|
3238
|
+
function tn(e, t, n, r, i) {
|
|
3239
3239
|
if (r === "just" && i) return null;
|
|
3240
3240
|
let a = t - n;
|
|
3241
3241
|
if (a <= .5) return null;
|
|
3242
|
-
let o =
|
|
3242
|
+
let o = _e(e, a, {
|
|
3243
3243
|
firstContentSi: 0,
|
|
3244
3244
|
lastDrawnSi: e.length,
|
|
3245
|
-
isGapChar:
|
|
3246
|
-
isWhitespace:
|
|
3245
|
+
isGapChar: re,
|
|
3246
|
+
isWhitespace: en,
|
|
3247
3247
|
seaClusterGaps: r === "thaiDist"
|
|
3248
3248
|
});
|
|
3249
3249
|
if (!o) return null;
|
|
@@ -3264,7 +3264,7 @@ function Yt(e, t, n, r, i) {
|
|
|
3264
3264
|
}
|
|
3265
3265
|
//#endregion
|
|
3266
3266
|
//#region packages/pptx/src/table-border-conflict.ts
|
|
3267
|
-
function
|
|
3267
|
+
function nn(e) {
|
|
3268
3268
|
if (!e) return {
|
|
3269
3269
|
r: 0,
|
|
3270
3270
|
g: 0,
|
|
@@ -3281,37 +3281,37 @@ function Xt(e) {
|
|
|
3281
3281
|
b: parseInt(t.slice(4, 6), 16)
|
|
3282
3282
|
};
|
|
3283
3283
|
}
|
|
3284
|
-
function
|
|
3285
|
-
let t =
|
|
3284
|
+
function rn(e) {
|
|
3285
|
+
let t = nn(e);
|
|
3286
3286
|
return .299 * t.r + .587 * t.g + .114 * t.b;
|
|
3287
3287
|
}
|
|
3288
|
-
function
|
|
3288
|
+
function an(e, t) {
|
|
3289
3289
|
if (!e && !t) return null;
|
|
3290
3290
|
if (!e) return t;
|
|
3291
3291
|
if (!t) return e;
|
|
3292
3292
|
if (e.width !== t.width) return e.width > t.width ? e : t;
|
|
3293
|
-
let n =
|
|
3293
|
+
let n = rn(e.color), r = rn(t.color);
|
|
3294
3294
|
return n === r || n < r ? e : t;
|
|
3295
3295
|
}
|
|
3296
3296
|
//#endregion
|
|
3297
3297
|
//#region packages/pptx/src/smartart-fallback-contrast.ts
|
|
3298
|
-
function
|
|
3299
|
-
let t =
|
|
3298
|
+
function on(e) {
|
|
3299
|
+
let t = te(e.length === 8 ? e.slice(0, 6) : e);
|
|
3300
3300
|
if (!t) return null;
|
|
3301
|
-
let n =
|
|
3301
|
+
let n = w(t[0], t[1], t[2]);
|
|
3302
3302
|
if (e.length !== 8) return n;
|
|
3303
3303
|
let r = Number.parseInt(e.slice(6, 8), 16);
|
|
3304
3304
|
if (Number.isNaN(r)) return null;
|
|
3305
3305
|
let i = r / 255;
|
|
3306
3306
|
return i * n + (1 - i);
|
|
3307
3307
|
}
|
|
3308
|
-
function
|
|
3308
|
+
function sn(e) {
|
|
3309
3309
|
if (!e) return null;
|
|
3310
|
-
if (e.fillType === "solid") return
|
|
3310
|
+
if (e.fillType === "solid") return on(e.color);
|
|
3311
3311
|
if (e.fillType === "gradient") {
|
|
3312
3312
|
let t = e.stops.map((e) => ({
|
|
3313
3313
|
p: Math.min(1, Math.max(0, e.position)),
|
|
3314
|
-
l:
|
|
3314
|
+
l: on(e.color)
|
|
3315
3315
|
})).filter((e) => e.l !== null).sort((e, t) => e.p - t.p);
|
|
3316
3316
|
if (t.length === 0) return null;
|
|
3317
3317
|
let n = t[0], r = t[t.length - 1], i = n.l * n.p + r.l * (1 - r.p);
|
|
@@ -3320,18 +3320,18 @@ function en(e) {
|
|
|
3320
3320
|
}
|
|
3321
3321
|
return null;
|
|
3322
3322
|
}
|
|
3323
|
-
function
|
|
3323
|
+
function cn(e) {
|
|
3324
3324
|
return e.name === "SmartArt" && e.id === void 0;
|
|
3325
3325
|
}
|
|
3326
|
-
function
|
|
3327
|
-
let n =
|
|
3326
|
+
function ln(e, t) {
|
|
3327
|
+
let n = sn(e);
|
|
3328
3328
|
if (n === null || n >= .5) return null;
|
|
3329
|
-
let r =
|
|
3329
|
+
let r = on(t.replace(/^#/, ""));
|
|
3330
3330
|
return r !== null && r >= .5 ? null : "#FFFFFF";
|
|
3331
3331
|
}
|
|
3332
3332
|
//#endregion
|
|
3333
3333
|
//#region packages/pptx/src/tab-layout.ts
|
|
3334
|
-
function
|
|
3334
|
+
function un(e, t, n, r, i, a = 0) {
|
|
3335
3335
|
let o = e.map((e) => e.width), s = (t) => {
|
|
3336
3336
|
let n = 0;
|
|
3337
3337
|
for (let r = t; r < e.length && !e[r].isTab; r++) n += o[r];
|
|
@@ -3359,8 +3359,8 @@ function rn(e, t, n, r, i, a = 0) {
|
|
|
3359
3359
|
}
|
|
3360
3360
|
//#endregion
|
|
3361
3361
|
//#region packages/pptx/src/vertical-text.ts
|
|
3362
|
-
var
|
|
3363
|
-
function
|
|
3362
|
+
var dn = () => !1;
|
|
3363
|
+
function fn(e, t, n) {
|
|
3364
3364
|
let r = e.textBaseline;
|
|
3365
3365
|
e.textBaseline = "alphabetic";
|
|
3366
3366
|
let i = e.measureText(t);
|
|
@@ -3368,7 +3368,7 @@ function on(e, t, n) {
|
|
|
3368
3368
|
let a = i.fontBoundingBoxAscent, o = i.fontBoundingBoxDescent;
|
|
3369
3369
|
return typeof a == "number" && typeof o == "number" && (a !== 0 || o !== 0) ? (a - o) / 2 : .38 * n;
|
|
3370
3370
|
}
|
|
3371
|
-
function
|
|
3371
|
+
function pn(e, t) {
|
|
3372
3372
|
let n = e.textAlign, r = e.textBaseline;
|
|
3373
3373
|
e.textAlign = "center", e.textBaseline = "middle";
|
|
3374
3374
|
let i = e.measureText(t);
|
|
@@ -3376,15 +3376,15 @@ function sn(e, t) {
|
|
|
3376
3376
|
let a = i.actualBoundingBoxAscent, o = i.actualBoundingBoxDescent;
|
|
3377
3377
|
return typeof a == "number" && typeof o == "number" ? (a - o) / 2 : 0;
|
|
3378
3378
|
}
|
|
3379
|
-
function
|
|
3380
|
-
let c = e.textAlign, l = e.textBaseline, u = o === "stroke" ? e.strokeText.bind(e) : e.fillText.bind(e), d = r -
|
|
3379
|
+
function mn(e, t, n, r, i, a, o = "fill", s = dn) {
|
|
3380
|
+
let c = e.textAlign, l = e.textBaseline, u = o === "stroke" ? e.strokeText.bind(e) : e.fillText.bind(e), d = r - fn(e, t, i), f = 0;
|
|
3381
3381
|
for (let o of t) {
|
|
3382
|
-
let t = o.codePointAt(0) ?? 0, l =
|
|
3383
|
-
if (
|
|
3382
|
+
let t = o.codePointAt(0) ?? 0, l = O(t), p = e.measureText(o).width + a, m = l === "Tr" ? K(t) : null, h = l === "Tr" && m === null && L(t), g = l === "U" || l === "Tu" || m !== null || h;
|
|
3383
|
+
if (V(t) && s(t)) {
|
|
3384
3384
|
let t = n + f + p / 2;
|
|
3385
|
-
e.save(), e.translate(t, d), e.rotate(-Math.PI / 2), e.textAlign = "center", e.textBaseline = "middle",
|
|
3385
|
+
e.save(), e.translate(t, d), e.rotate(-Math.PI / 2), e.textAlign = "center", e.textBaseline = "middle", C(e, () => u(o, 0, 0)), e.restore();
|
|
3386
3386
|
} else if (g) {
|
|
3387
|
-
let r = m === null && l === "Tu" ?
|
|
3387
|
+
let r = m === null && l === "Tu" ? T(t) : null, a = m === null ? r : m, s = a === null ? o : String.fromCodePoint(a), c = n + f + p / 2, h = r === null ? pn(e, s) / i : 0;
|
|
3388
3388
|
e.save(), e.translate(c, d), e.rotate(-Math.PI / 2), e.textAlign = "center", e.textBaseline = "middle", u(s, 0, h * i), e.restore();
|
|
3389
3389
|
} else if (l === "Tr") {
|
|
3390
3390
|
let t = n + f + p / 2;
|
|
@@ -3394,30 +3394,30 @@ function cn(e, t, n, r, i, a, o = "fill", s = an) {
|
|
|
3394
3394
|
}
|
|
3395
3395
|
e.textAlign = c, e.textBaseline = l;
|
|
3396
3396
|
}
|
|
3397
|
-
function
|
|
3398
|
-
|
|
3397
|
+
function hn(e, t, n, r, i, a, o = "fill") {
|
|
3398
|
+
mn(e, t, n, r, i, a, o, (t) => W(e, t));
|
|
3399
3399
|
}
|
|
3400
3400
|
//#endregion
|
|
3401
3401
|
//#region packages/pptx/src/renderer.ts
|
|
3402
|
-
function
|
|
3402
|
+
function Y(e, t) {
|
|
3403
3403
|
return e * t;
|
|
3404
3404
|
}
|
|
3405
|
-
var
|
|
3406
|
-
function
|
|
3407
|
-
let { top: s, height: c } =
|
|
3405
|
+
var X = be;
|
|
3406
|
+
function gn(e, t, n, r, i, a, o) {
|
|
3407
|
+
let { top: s, height: c } = Ht(n, i);
|
|
3408
3408
|
e.fillStyle = a, e.fillRect(t, s, r, c), e.fillStyle = o;
|
|
3409
3409
|
}
|
|
3410
|
-
function
|
|
3411
|
-
return
|
|
3410
|
+
function _n(e, t, n, r, i, a, o = 0) {
|
|
3411
|
+
return Oe(e, t, n, r, i, a, o);
|
|
3412
3412
|
}
|
|
3413
|
-
var
|
|
3414
|
-
function
|
|
3413
|
+
var vn = /* @__PURE__ */ new WeakMap();
|
|
3414
|
+
function yn(e, t) {
|
|
3415
3415
|
let n = e.tinted.get(t);
|
|
3416
3416
|
if (n) return n;
|
|
3417
|
-
let r =
|
|
3417
|
+
let r = ee(e.raster, t);
|
|
3418
3418
|
return e.tinted.set(t, r), r;
|
|
3419
3419
|
}
|
|
3420
|
-
function
|
|
3420
|
+
function bn(e) {
|
|
3421
3421
|
let t = [], n = (e) => {
|
|
3422
3422
|
if (e) for (let n of e.paragraphs) for (let e of n.runs) e.type === "math" && t.push({
|
|
3423
3423
|
nodes: e.nodes,
|
|
@@ -3428,13 +3428,13 @@ function mn(e) {
|
|
|
3428
3428
|
else if (t.type === "table") for (let e of t.rows) for (let t of e.cells) n(t.textBody);
|
|
3429
3429
|
return t;
|
|
3430
3430
|
}
|
|
3431
|
-
async function
|
|
3432
|
-
let n =
|
|
3431
|
+
async function xn(e, t) {
|
|
3432
|
+
let n = bn(e);
|
|
3433
3433
|
if (n.length !== 0) {
|
|
3434
3434
|
await t.loadMathJax();
|
|
3435
|
-
for (let e of n) if (!
|
|
3436
|
-
let n = await t.mathMLToSvg(
|
|
3437
|
-
|
|
3435
|
+
for (let e of n) if (!vn.has(e.nodes)) try {
|
|
3436
|
+
let n = await t.mathMLToSvg(N(e.nodes, e.display)), r = await B(n, "#000000");
|
|
3437
|
+
vn.set(e.nodes, {
|
|
3438
3438
|
raster: r,
|
|
3439
3439
|
widthEm: n.widthEm,
|
|
3440
3440
|
ascentEm: n.ascentEm,
|
|
@@ -3444,10 +3444,14 @@ async function hn(e, t) {
|
|
|
3444
3444
|
} catch {}
|
|
3445
3445
|
}
|
|
3446
3446
|
}
|
|
3447
|
-
function
|
|
3448
|
-
|
|
3447
|
+
function Sn(e, t) {
|
|
3448
|
+
let n = (e) => t.embeddedFontAliases?.get(e.trim().toLowerCase()) ?? e;
|
|
3449
|
+
if (!e) return n(t.themeMinorFont ?? "sans-serif");
|
|
3450
|
+
if (e.startsWith("+")) return n(e === "+mj-lt" || e === "+mj-ea" || e === "+mj-cs" ? t.themeMajorFont ?? "sans-serif" : t.themeMinorFont ?? "sans-serif");
|
|
3451
|
+
let r = e.split(",")[0].trim();
|
|
3452
|
+
return r ? n(r) : t.themeMinorFont ?? "sans-serif";
|
|
3449
3453
|
}
|
|
3450
|
-
var
|
|
3454
|
+
var Cn = new Set([
|
|
3451
3455
|
"serif",
|
|
3452
3456
|
"sans-serif",
|
|
3453
3457
|
"monospace",
|
|
@@ -3455,11 +3459,11 @@ var _n = new Set([
|
|
|
3455
3459
|
"fantasy",
|
|
3456
3460
|
"system-ui"
|
|
3457
3461
|
]);
|
|
3458
|
-
function
|
|
3459
|
-
let t =
|
|
3462
|
+
function wn(e) {
|
|
3463
|
+
let t = d(e);
|
|
3460
3464
|
return t === "mono" ? "monospace" : t === "serif" ? "serif" : "sans-serif";
|
|
3461
3465
|
}
|
|
3462
|
-
var
|
|
3466
|
+
var Tn = {
|
|
3463
3467
|
calibri: "Carlito",
|
|
3464
3468
|
"calibri light": "Carlito",
|
|
3465
3469
|
cambria: "Caladea",
|
|
@@ -3471,38 +3475,38 @@ var yn = {
|
|
|
3471
3475
|
"simplified arabic": "Noto Naskh Arabic",
|
|
3472
3476
|
"arabic typesetting": "Noto Naskh Arabic",
|
|
3473
3477
|
"univers next arabic": "Noto Sans Arabic"
|
|
3474
|
-
},
|
|
3475
|
-
function
|
|
3476
|
-
if (
|
|
3478
|
+
}, En = "\"Noto Naskh Arabic\", \"Noto Sans Arabic\"";
|
|
3479
|
+
function Dn(e) {
|
|
3480
|
+
if (Tn[e.toLowerCase()]?.includes("Arabic")) return !0;
|
|
3477
3481
|
let t = e.toLowerCase();
|
|
3478
3482
|
return /arabic|naskh|kufi|nastaliq|amiri|scheherazade|lateef|aldhabi|urdu|farsi|العرب|[-ۿ]/.test(t);
|
|
3479
3483
|
}
|
|
3480
|
-
function
|
|
3484
|
+
function On(e) {
|
|
3481
3485
|
return e.map((e) => `"${e}"`).join(", ");
|
|
3482
3486
|
}
|
|
3483
|
-
function
|
|
3484
|
-
let
|
|
3485
|
-
if (
|
|
3486
|
-
let
|
|
3487
|
-
return `"${e}", ${
|
|
3487
|
+
function kn(e, t = e) {
|
|
3488
|
+
let r = wn(t), i = Tn[t.toLowerCase()], a = i ? `"${i}", ` : "";
|
|
3489
|
+
if (Dn(t)) return `"${e}", ${a}${En}, ${r}`;
|
|
3490
|
+
let o = r === "serif" ? "serif" : "sans", l = F(t);
|
|
3491
|
+
return `"${e}", ${a}${l ? `${On(n(l, o))}, ` : ""}${`${On(o === "serif" ? s : c)}, `}${r}`;
|
|
3488
3492
|
}
|
|
3489
|
-
function
|
|
3493
|
+
function An(e) {
|
|
3490
3494
|
return e ? e.kind === "external" ? `e:${e.url}` : `i:${e.ref}` : "";
|
|
3491
3495
|
}
|
|
3492
|
-
function
|
|
3496
|
+
function jn(e) {
|
|
3493
3497
|
let t = e.toLowerCase();
|
|
3494
3498
|
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;
|
|
3495
3499
|
}
|
|
3496
|
-
function
|
|
3497
|
-
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 =
|
|
3500
|
+
function Mn(e, t, n, r, i, a, o, s) {
|
|
3501
|
+
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 = De(m, h), _ = g?.getContext("2d");
|
|
3498
3502
|
if (!g || !_) return;
|
|
3499
3503
|
_.save(), _.setTransform(a.a, a.b, a.c, a.d, a.e - u, a.f - d), t(_), _.restore();
|
|
3500
3504
|
let v = n.y - d, y = v + n.h, b = g, x = _;
|
|
3501
3505
|
if (c > 0) {
|
|
3502
|
-
let e =
|
|
3506
|
+
let e = De(m, h), t = e?.getContext("2d");
|
|
3503
3507
|
e && t && (b = e, x = t);
|
|
3504
3508
|
}
|
|
3505
|
-
b !== g &&
|
|
3509
|
+
b !== g && Kt(x, g, {
|
|
3506
3510
|
x: n.x - u,
|
|
3507
3511
|
y: v,
|
|
3508
3512
|
w: n.w,
|
|
@@ -3529,45 +3533,48 @@ function En(e, t, n, r, i, a, o, s) {
|
|
|
3529
3533
|
let T = r.dist * i, E = r.dir * Math.PI / 180, D = n.y + n.h;
|
|
3530
3534
|
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();
|
|
3531
3535
|
}
|
|
3532
|
-
function
|
|
3533
|
-
let a = t ? "italic " : "", o =
|
|
3534
|
-
return
|
|
3536
|
+
function Z(e, t, n, r, i) {
|
|
3537
|
+
let a = t ? "italic " : "", o = Sn(r, i), s = i.embeddedFontAuthoredFamilies?.get(o) ?? o, c = jn(s), l = e ? "bold " : c ? `${c} ` : "";
|
|
3538
|
+
return Cn.has(o) ? `${a}${l}${n}px ${o}` : `${a}${l}${n}px ${kn(o, s)}`;
|
|
3535
3539
|
}
|
|
3536
|
-
function
|
|
3537
|
-
return e.bullet.type === "char" || e.bullet.type === "autoNum" ||
|
|
3540
|
+
function Nn(e) {
|
|
3541
|
+
return e.bullet.type === "char" || e.bullet.type === "autoNum" || He(e.bullet).type === "blip";
|
|
3538
3542
|
}
|
|
3539
|
-
function
|
|
3543
|
+
function Pn(e, t) {
|
|
3540
3544
|
return e ? 0 : Math.max(0, t);
|
|
3541
3545
|
}
|
|
3542
|
-
function
|
|
3543
|
-
|
|
3546
|
+
function Fn(e, t) {
|
|
3547
|
+
return t != null && t !== 0 ? e * .65 : e;
|
|
3548
|
+
}
|
|
3549
|
+
function In(e, t, n, r, i, a, o) {
|
|
3550
|
+
let s = (t.defaultFontSize ?? 18) * J * a;
|
|
3544
3551
|
for (let c of t.paragraphs) {
|
|
3545
|
-
let l =
|
|
3552
|
+
let l = Y(c.marL, a), u = Y(c.marR, a), d = Y(c.indent, a), f = Pn(Nn(c), d), p = n - r - i - l - u - f, m = 0;
|
|
3546
3553
|
for (let n of c.runs) {
|
|
3547
3554
|
if (n.type !== "text") continue;
|
|
3548
|
-
let r = n.fontSize == null ? c.defFontSize == null ? s : c.defFontSize *
|
|
3549
|
-
e.font =
|
|
3550
|
-
let l = (n.letterSpacing ?? 0) *
|
|
3555
|
+
let r = n.fontSize == null ? c.defFontSize == null ? s : c.defFontSize * J * a : n.fontSize * J * a, i = Sn(n.fontFamily ?? c.defFontFamily ?? null, o);
|
|
3556
|
+
e.font = Z(n.bold ?? c.defBold ?? t.defaultBold ?? !1, n.italic ?? c.defItalic ?? t.defaultItalic ?? !1, Fn(r, n.baseline ?? void 0), i, o);
|
|
3557
|
+
let l = (n.letterSpacing ?? 0) * J * a;
|
|
3551
3558
|
if (m += Q(e, n.text, l), m > p) return !0;
|
|
3552
3559
|
}
|
|
3553
3560
|
}
|
|
3554
3561
|
return !1;
|
|
3555
3562
|
}
|
|
3556
|
-
function
|
|
3557
|
-
for (let t of e) if (
|
|
3563
|
+
function Ln(e) {
|
|
3564
|
+
for (let t of e) if (re(t.codePointAt(0) ?? 0)) return !0;
|
|
3558
3565
|
return !1;
|
|
3559
3566
|
}
|
|
3560
|
-
function
|
|
3567
|
+
function Rn(e) {
|
|
3561
3568
|
let t = 0;
|
|
3562
3569
|
for (let n of e) t++;
|
|
3563
3570
|
return t;
|
|
3564
3571
|
}
|
|
3565
|
-
var
|
|
3566
|
-
function
|
|
3567
|
-
let t =
|
|
3572
|
+
var zn = /* @__PURE__ */ new WeakMap();
|
|
3573
|
+
function Bn(e) {
|
|
3574
|
+
let t = zn.get(e);
|
|
3568
3575
|
if (t != null) return t;
|
|
3569
3576
|
let n = e, r = n.letterSpacing;
|
|
3570
|
-
if (typeof r != "string") return
|
|
3577
|
+
if (typeof r != "string") return zn.set(e, !1), !1;
|
|
3571
3578
|
let i = !1;
|
|
3572
3579
|
try {
|
|
3573
3580
|
n.letterSpacing = "0px";
|
|
@@ -3582,11 +3589,11 @@ function Pn(e) {
|
|
|
3582
3589
|
n.letterSpacing = r;
|
|
3583
3590
|
} catch {}
|
|
3584
3591
|
}
|
|
3585
|
-
return
|
|
3592
|
+
return zn.set(e, i), i;
|
|
3586
3593
|
}
|
|
3587
3594
|
function Q(e, t, n) {
|
|
3588
3595
|
let r = e, i = r.letterSpacing;
|
|
3589
|
-
if (n !== 0 &&
|
|
3596
|
+
if (n !== 0 && Bn(e)) try {
|
|
3590
3597
|
r.letterSpacing = `${n}px`;
|
|
3591
3598
|
let i = e.measureText(t).width;
|
|
3592
3599
|
if (Number.isFinite(i)) return t.length > 0 ? i - n : i;
|
|
@@ -3595,38 +3602,38 @@ function Q(e, t, n) {
|
|
|
3595
3602
|
r.letterSpacing = i;
|
|
3596
3603
|
} catch {}
|
|
3597
3604
|
}
|
|
3598
|
-
let a = Math.max(0,
|
|
3605
|
+
let a = Math.max(0, Rn(t) - 1);
|
|
3599
3606
|
return e.measureText(t).width + n * a;
|
|
3600
3607
|
}
|
|
3601
|
-
function
|
|
3608
|
+
function Vn(e, t, n, r, a, o, s, c = !1, l = !1, u = 1, d, f = {
|
|
3602
3609
|
themeMajorFont: null,
|
|
3603
3610
|
themeMinorFont: null,
|
|
3604
3611
|
dpr: 1
|
|
3605
|
-
},
|
|
3606
|
-
let
|
|
3607
|
-
for (let e = t.runs.length - 1; e >= 0 &&
|
|
3612
|
+
}, m = 0) {
|
|
3613
|
+
let h = [], g = /* @__PURE__ */ new Map(), v = !0;
|
|
3614
|
+
for (let e = t.runs.length - 1; e >= 0 && v; e--) {
|
|
3608
3615
|
let n = t.runs[e];
|
|
3609
3616
|
if (n.type === "break") continue;
|
|
3610
3617
|
if (n.type === "math") break;
|
|
3611
3618
|
let r = n.text.replace(/ +$/u, "");
|
|
3612
|
-
r !== n.text && g.set(n, r), (r.length > 0 || n.fieldType != null) && (
|
|
3619
|
+
r !== n.text && g.set(n, r), (r.length > 0 || n.fieldType != null) && (v = !1);
|
|
3613
3620
|
}
|
|
3614
|
-
let
|
|
3615
|
-
pos:
|
|
3621
|
+
let y = () => n - (h.length === 0 ? m : 0), x = { segments: [] }, S = 0, C = !1, w = t.rtl === !0, T = Y(t.marR, o), E = (t.tabStops ?? []).map((e) => ({
|
|
3622
|
+
pos: Y(e.pos, o),
|
|
3616
3623
|
algn: e.algn
|
|
3617
|
-
})), D =
|
|
3618
|
-
let t =
|
|
3624
|
+
})), D = Y(t.defTabSz ?? 914400, o), O = !1, A = [], M = 0, N = () => w ? T : s + (h.length === 0 ? m : 0), P = (e = 0) => {
|
|
3625
|
+
let t = un(e > 0 ? [...A, {
|
|
3619
3626
|
isTab: !1,
|
|
3620
3627
|
width: e
|
|
3621
|
-
}] :
|
|
3628
|
+
}] : A, E, N(), Infinity, M, D), n = 0;
|
|
3622
3629
|
for (let e of t) n += e;
|
|
3623
3630
|
return n;
|
|
3624
3631
|
}, F = (e) => {
|
|
3625
|
-
let t =
|
|
3626
|
-
return Number.isFinite(t) ? O ? P(e) <= t :
|
|
3632
|
+
let t = y();
|
|
3633
|
+
return Number.isFinite(t) ? O ? P(e) <= t : S + e <= t : !0;
|
|
3627
3634
|
}, I = () => {
|
|
3628
|
-
let e =
|
|
3629
|
-
if (!O) return e -
|
|
3635
|
+
let e = y();
|
|
3636
|
+
if (!O) return e - S;
|
|
3630
3637
|
if (!Number.isFinite(e)) return Infinity;
|
|
3631
3638
|
if (P(0) >= e) return 0;
|
|
3632
3639
|
let t = 0, n = e;
|
|
@@ -3636,26 +3643,27 @@ function Fn(e, t, n, i, a, o, s, c = !1, l = !1, u = 1, d, f = {
|
|
|
3636
3643
|
}
|
|
3637
3644
|
return t;
|
|
3638
3645
|
}, L = (e = !1) => {
|
|
3639
|
-
e && (
|
|
3646
|
+
e && (x.endsWithBreak = !0), h.push(x), x = { segments: [] }, S = 0, O = !1, A = [], C = !1;
|
|
3640
3647
|
}, R = (t, n, r, i) => {
|
|
3641
3648
|
e.font = n;
|
|
3642
|
-
let a = Q(e, t, r), o =
|
|
3649
|
+
let a = Q(e, t, r), o = x.segments.at(-1);
|
|
3643
3650
|
return !o || o.isTab || o.math || o.sourceRunId !== i ? a : o.font === n && (o.letterSpacingPx ?? 0) === r ? Q(e, o.text + t, r) - Q(e, o.text, r) : a + r;
|
|
3644
3651
|
}, z = (t, n, r, i, a, o, s, c) => {
|
|
3645
3652
|
if (!t) return;
|
|
3646
3653
|
e.font = n;
|
|
3647
|
-
let l = c?.letterSpacingPx ?? 0, u = c?.sourceRunId, d = c?.strikeDouble, f = c?.underlineStyle, p = c?.underlineColor, m = c?.shadow, h = c?.reflection, g = c?.outline, _ = c?.highlight, v = c?.fontFamily, y = c?.hyperlink,
|
|
3648
|
-
if (
|
|
3654
|
+
let l = c?.letterSpacingPx ?? 0, u = c?.sourceRunId, d = c?.strikeDouble, f = c?.underlineStyle, p = c?.underlineColor, m = c?.shadow, h = c?.reflection, g = c?.outline, _ = c?.highlight, v = c?.fontFamily, y = c?.hyperlink, b = c?.drawSizePx ?? r, C = (e) => !e.math && !e.isTab && e.font === n && e.color === i && e.underline === a && (e.underlineStyle ?? "") === (f ?? "") && (e.underlineColor ?? "") === (p ?? "") && e.strikethrough === o && (e.strikeDouble ?? !1) === (d ?? !1) && (e.letterSpacingPx ?? 0) === l && e.baseline === s && e.shadow === m && e.reflection === h && e.outline === g && (e.highlight ?? "") === (_ ?? "") && (e.fontFamily ?? "") === (v ?? "") && (e.drawSizePx ?? e.sizePx) === b && An(e.hyperlink) === An(y) && (l === 0 || e.sourceRunId === u), w = x.segments.at(-1), T = Q(e, t, l);
|
|
3655
|
+
if (w && C(w) ? T = Q(e, w.text + t, l) - Q(e, w.text, l) : w && !w.isTab && !w.math && u != null && w.sourceRunId === u && (T += l), S += T, A.push({
|
|
3649
3656
|
isTab: !1,
|
|
3650
|
-
width:
|
|
3651
|
-
}),
|
|
3657
|
+
width: T
|
|
3658
|
+
}), w && C(w)) w.text += t;
|
|
3652
3659
|
else {
|
|
3653
|
-
let e =
|
|
3654
|
-
|
|
3660
|
+
let e = w && !w.isTab && !w.math && u != null && w.sourceRunId === u ? l : 0;
|
|
3661
|
+
x.segments.push({
|
|
3655
3662
|
text: t,
|
|
3656
3663
|
font: n,
|
|
3657
3664
|
fontFamily: v,
|
|
3658
3665
|
sizePx: r,
|
|
3666
|
+
drawSizePx: b,
|
|
3659
3667
|
color: i,
|
|
3660
3668
|
underline: a,
|
|
3661
3669
|
underlineStyle: f,
|
|
@@ -3674,11 +3682,11 @@ function Fn(e, t, n, i, a, o, s, c = !1, l = !1, u = 1, d, f = {
|
|
|
3674
3682
|
});
|
|
3675
3683
|
}
|
|
3676
3684
|
}, B = () => {
|
|
3677
|
-
let e =
|
|
3685
|
+
let e = x.segments.at(-1);
|
|
3678
3686
|
if (!e || e.math) return !1;
|
|
3679
3687
|
let t = /^(.*\s)(\S+)$/s.exec(e.text), n;
|
|
3680
3688
|
if (t) e.text = t[1], n = t[2];
|
|
3681
|
-
else if (
|
|
3689
|
+
else if (x.segments.length > 1) x.segments.pop(), n = e.text;
|
|
3682
3690
|
else return !1;
|
|
3683
3691
|
return L(), z(n, e.font, e.sizePx, e.color, e.underline, e.strikethrough, e.baseline, {
|
|
3684
3692
|
strikeDouble: e.strikeDouble,
|
|
@@ -3690,7 +3698,8 @@ function Fn(e, t, n, i, a, o, s, c = !1, l = !1, u = 1, d, f = {
|
|
|
3690
3698
|
outline: e.outline,
|
|
3691
3699
|
highlight: e.highlight,
|
|
3692
3700
|
fontFamily: e.fontFamily,
|
|
3693
|
-
sourceRunId: e.sourceRunId
|
|
3701
|
+
sourceRunId: e.sourceRunId,
|
|
3702
|
+
drawSizePx: e.drawSizePx
|
|
3694
3703
|
}), !0;
|
|
3695
3704
|
};
|
|
3696
3705
|
for (let [n, s] of t.runs.entries()) {
|
|
@@ -3699,105 +3708,106 @@ function Fn(e, t, n, i, a, o, s, c = !1, l = !1, u = 1, d, f = {
|
|
|
3699
3708
|
continue;
|
|
3700
3709
|
}
|
|
3701
3710
|
if (s.type === "math") {
|
|
3702
|
-
let e =
|
|
3703
|
-
(s.display &&
|
|
3711
|
+
let e = vn.get(s.nodes), t = s.fontSize == null ? r : s.fontSize * J * o * u, n = e ? e.widthEm * t : 0, i = e ? e.ascentEm * t : 0, c = e ? e.descentEm * t : 0;
|
|
3712
|
+
(s.display && S > 0 || !F(n) && S > 0) && L(), A.push({
|
|
3704
3713
|
isTab: !1,
|
|
3705
3714
|
width: n
|
|
3706
|
-
}),
|
|
3715
|
+
}), x.segments.push({
|
|
3707
3716
|
text: "",
|
|
3708
3717
|
font: `${t}px sans-serif`,
|
|
3709
3718
|
sizePx: t,
|
|
3710
|
-
color: s.color ?
|
|
3719
|
+
color: s.color ? X(s.color) : a,
|
|
3711
3720
|
underline: !1,
|
|
3712
3721
|
strikethrough: !1,
|
|
3713
3722
|
math: {
|
|
3714
3723
|
nodes: s.nodes,
|
|
3715
3724
|
display: s.display,
|
|
3716
3725
|
width: n,
|
|
3717
|
-
ascent:
|
|
3726
|
+
ascent: i,
|
|
3718
3727
|
descent: c
|
|
3719
3728
|
}
|
|
3720
|
-
}),
|
|
3729
|
+
}), S += n, s.display && L();
|
|
3721
3730
|
continue;
|
|
3722
3731
|
}
|
|
3723
|
-
let
|
|
3724
|
-
|
|
3725
|
-
let
|
|
3726
|
-
e.font =
|
|
3727
|
-
let
|
|
3728
|
-
(
|
|
3729
|
-
let
|
|
3730
|
-
strikeDouble:
|
|
3731
|
-
letterSpacingPx:
|
|
3732
|
+
let m = s.fontSize == null ? r : s.fontSize * J * o * u, h = Fn(m, s.baseline ?? void 0), v = Sn(s.fontFamily ?? t.defFontFamily ?? null, f), w = s.fontFamilyEa ? Sn(s.fontFamilyEa, f) : null, T = s.fontFamilySym ? Sn(s.fontFamilySym, f) : null, E;
|
|
3733
|
+
E = s.color ? X(s.color) : s.hyperlink && f.themeHlinkColor ? X(f.themeHlinkColor) : a;
|
|
3734
|
+
let D = s.bold ?? t.defBold ?? c, N = s.italic ?? t.defItalic ?? l, P = Z(D, N, h, v, f), V = w ? Z(D, N, h, w, f) : P;
|
|
3735
|
+
e.font = P;
|
|
3736
|
+
let H = s.caps, U = g.get(s) ?? s.text;
|
|
3737
|
+
(H === "all" || H === "small") && (U = U.toUpperCase());
|
|
3738
|
+
let ee = s.fieldType === "slidenum" && d !== void 0 ? String(d) : U, W = s.underline || s.hyperlink !== void 0, te = s.strikeDouble === !0, G = s.letterSpacing == null ? 0 : s.letterSpacing * J * o, K = {
|
|
3739
|
+
strikeDouble: te,
|
|
3740
|
+
letterSpacingPx: G,
|
|
3732
3741
|
underlineStyle: s.underlineStyle,
|
|
3733
|
-
underlineColor: s.underlineColor ?
|
|
3742
|
+
underlineColor: s.underlineColor ? X(s.underlineColor) : void 0,
|
|
3734
3743
|
shadow: s.shadow,
|
|
3735
3744
|
reflection: s.reflection,
|
|
3736
3745
|
outline: s.outline,
|
|
3737
|
-
fontFamily:
|
|
3738
|
-
highlight: s.highlight ?
|
|
3739
|
-
hyperlink:
|
|
3740
|
-
sourceRunId: n
|
|
3741
|
-
|
|
3742
|
-
|
|
3743
|
-
|
|
3744
|
-
if (
|
|
3745
|
-
|
|
3746
|
-
|
|
3746
|
+
fontFamily: v,
|
|
3747
|
+
highlight: s.highlight ? X(s.highlight) : void 0,
|
|
3748
|
+
hyperlink: qt(s.hyperlink),
|
|
3749
|
+
sourceRunId: n,
|
|
3750
|
+
drawSizePx: h
|
|
3751
|
+
}, q = ee.split(/(\s+)/);
|
|
3752
|
+
for (let r of q) {
|
|
3753
|
+
if (!r) continue;
|
|
3754
|
+
if (/^\t+$/.test(r)) {
|
|
3755
|
+
O || (e.font = P, M = e.measureText(" ").width);
|
|
3756
|
+
for (let e of r) x.segments.push({
|
|
3747
3757
|
text: "",
|
|
3748
3758
|
isTab: !0,
|
|
3749
|
-
font:
|
|
3750
|
-
fontFamily:
|
|
3751
|
-
sizePx:
|
|
3752
|
-
color:
|
|
3759
|
+
font: P,
|
|
3760
|
+
fontFamily: v,
|
|
3761
|
+
sizePx: m,
|
|
3762
|
+
color: E,
|
|
3753
3763
|
underline: !1,
|
|
3754
3764
|
strikethrough: !1
|
|
3755
|
-
}),
|
|
3765
|
+
}), A.push({
|
|
3756
3766
|
isTab: !0,
|
|
3757
3767
|
width: 0
|
|
3758
3768
|
});
|
|
3759
3769
|
O = !0;
|
|
3760
3770
|
continue;
|
|
3761
3771
|
}
|
|
3762
|
-
e.font =
|
|
3763
|
-
let a = R(
|
|
3764
|
-
if (c.test(
|
|
3765
|
-
let t =
|
|
3766
|
-
for (let
|
|
3767
|
-
let
|
|
3768
|
-
if (c.test(
|
|
3769
|
-
let e =
|
|
3770
|
-
e ===
|
|
3772
|
+
e.font = P;
|
|
3773
|
+
let a = R(r, P, G, n), o = /^\s+$/.test(r), c = /[-]/;
|
|
3774
|
+
if (c.test(r) && (T != null || ve(v))) {
|
|
3775
|
+
let t = T ?? v;
|
|
3776
|
+
for (let i of r) {
|
|
3777
|
+
let r = i, a = P;
|
|
3778
|
+
if (c.test(i)) {
|
|
3779
|
+
let e = ue(i, t);
|
|
3780
|
+
e === i ? a = Z(D, N, h, t, f) : (r = e, a = Z(D, N, h, "sans-serif", f));
|
|
3771
3781
|
}
|
|
3772
|
-
e.font = a, !F(R(
|
|
3782
|
+
e.font = a, !F(R(r, a, G, n)) && S > 0 && L(), z(r, a, m, E, W, s.strikethrough, s.baseline ?? void 0, K);
|
|
3773
3783
|
}
|
|
3774
3784
|
continue;
|
|
3775
3785
|
}
|
|
3776
|
-
if (
|
|
3777
|
-
let
|
|
3778
|
-
for (let t of
|
|
3779
|
-
let n =
|
|
3780
|
-
e.font =
|
|
3786
|
+
if (Ln(r) && (!j(r) || t.eaLnBrk === !1)) {
|
|
3787
|
+
let i = [];
|
|
3788
|
+
for (let t of r) {
|
|
3789
|
+
let n = re(t.codePointAt(0) ?? 0) && w != null, r = n ? V : P, a = n ? w : v;
|
|
3790
|
+
e.font = r, i.push({
|
|
3781
3791
|
ch: t,
|
|
3782
3792
|
w: Q(e, t, 0),
|
|
3783
|
-
font:
|
|
3793
|
+
font: r,
|
|
3784
3794
|
family: a
|
|
3785
3795
|
});
|
|
3786
3796
|
}
|
|
3787
3797
|
if (t.eaLnBrk === !1) {
|
|
3788
|
-
let e =
|
|
3789
|
-
|
|
3790
|
-
for (let e of
|
|
3791
|
-
...
|
|
3798
|
+
let e = x.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);
|
|
3799
|
+
S > 0 && !F(r) && L();
|
|
3800
|
+
for (let e of i) z(e.ch, e.font, m, E, W, s.strikethrough, s.baseline ?? void 0, {
|
|
3801
|
+
...K,
|
|
3792
3802
|
fontFamily: e.family
|
|
3793
3803
|
});
|
|
3794
3804
|
continue;
|
|
3795
3805
|
}
|
|
3796
|
-
let a =
|
|
3806
|
+
let a = i;
|
|
3797
3807
|
for (; a.length > 0;) {
|
|
3798
|
-
let e = Number.isFinite(
|
|
3808
|
+
let e = Number.isFinite(y()) ? y() - I() : S, t = x.segments.at(-1), r = !!t && !t.isTab && !t.math && t.sourceRunId === n, i = $t(a, e, y(), p, G, r);
|
|
3799
3809
|
if (i === 0) {
|
|
3800
|
-
if (
|
|
3810
|
+
if (S > 0) {
|
|
3801
3811
|
L();
|
|
3802
3812
|
continue;
|
|
3803
3813
|
}
|
|
@@ -3805,8 +3815,8 @@ function Fn(e, t, n, i, a, o, s, c = !1, l = !1, u = 1, d, f = {
|
|
|
3805
3815
|
}
|
|
3806
3816
|
for (let e = 0; e < i; e++) {
|
|
3807
3817
|
let t = a[e];
|
|
3808
|
-
z(t.ch, t.font,
|
|
3809
|
-
...
|
|
3818
|
+
z(t.ch, t.font, m, E, W, s.strikethrough, s.baseline ?? void 0, {
|
|
3819
|
+
...K,
|
|
3810
3820
|
fontFamily: t.family
|
|
3811
3821
|
});
|
|
3812
3822
|
}
|
|
@@ -3814,13 +3824,13 @@ function Fn(e, t, n, i, a, o, s, c = !1, l = !1, u = 1, d, f = {
|
|
|
3814
3824
|
}
|
|
3815
3825
|
continue;
|
|
3816
3826
|
}
|
|
3817
|
-
if (
|
|
3818
|
-
let t =
|
|
3827
|
+
if (j(r)) {
|
|
3828
|
+
let t = _(r, {
|
|
3819
3829
|
cjk: !0,
|
|
3820
|
-
kinsoku:
|
|
3821
|
-
}),
|
|
3822
|
-
let r = 0, i =
|
|
3823
|
-
s !== "" && (e.font = c ?
|
|
3830
|
+
kinsoku: p
|
|
3831
|
+
}), i = w != null && V !== P, a = (e) => i && re(e.codePointAt(0) ?? 0), o = (t) => {
|
|
3832
|
+
let r = 0, i = x.segments.at(-1), o = !!i && !i.isTab && !i.math && i.sourceRunId === n, s = "", c = null, l = () => {
|
|
3833
|
+
s !== "" && (e.font = c ? V : P, r += Q(e, s, G), o && (r += G), o = !0, s = "");
|
|
3824
3834
|
};
|
|
3825
3835
|
for (let e of t) {
|
|
3826
3836
|
let t = a(e);
|
|
@@ -3830,9 +3840,9 @@ function Fn(e, t, n, i, a, o, s, c = !1, l = !1, u = 1, d, f = {
|
|
|
3830
3840
|
}, c = (e) => {
|
|
3831
3841
|
let t = "", n = null, r = () => {
|
|
3832
3842
|
if (t === "") return;
|
|
3833
|
-
let e = n ?
|
|
3834
|
-
z(t, e,
|
|
3835
|
-
...
|
|
3843
|
+
let e = n ? V : P, r = n ? w : v;
|
|
3844
|
+
z(t, e, m, E, W, s.strikethrough, s.baseline ?? void 0, {
|
|
3845
|
+
...K,
|
|
3836
3846
|
fontFamily: r
|
|
3837
3847
|
}), t = "";
|
|
3838
3848
|
};
|
|
@@ -3841,59 +3851,59 @@ function Fn(e, t, n, i, a, o, s, c = !1, l = !1, u = 1, d, f = {
|
|
|
3841
3851
|
n === null || e === n ? (t += i, n = e) : (r(), t = i, n = e);
|
|
3842
3852
|
}
|
|
3843
3853
|
r();
|
|
3844
|
-
}, l =
|
|
3854
|
+
}, l = oe(r), u = r.length, d = 0;
|
|
3845
3855
|
for (; d < u;) {
|
|
3846
|
-
let e = I(), n =
|
|
3856
|
+
let e = I(), n = k(r, t, d, e, o, l);
|
|
3847
3857
|
if (n <= d) {
|
|
3848
|
-
if (
|
|
3858
|
+
if (S > 0) {
|
|
3849
3859
|
L();
|
|
3850
3860
|
continue;
|
|
3851
3861
|
}
|
|
3852
|
-
let
|
|
3862
|
+
let i = t.find((e) => e > d) ?? u, a = r.slice(d, i), s = b(a), c = k(a, s, 0, e, o, l);
|
|
3853
3863
|
c <= 0 && (c = s.length > 0 ? s[0] : a.length), n = d + c;
|
|
3854
3864
|
}
|
|
3855
|
-
c(
|
|
3865
|
+
c(r.slice(d, n)), d = n, d < u && L();
|
|
3856
3866
|
}
|
|
3857
3867
|
continue;
|
|
3858
3868
|
}
|
|
3859
|
-
if (F(a)) z(
|
|
3860
|
-
else if (o)
|
|
3861
|
-
else if (a >
|
|
3862
|
-
|
|
3863
|
-
for (let t of
|
|
3864
|
-
} else if (!
|
|
3869
|
+
if (F(a)) z(r, P, m, E, W, s.strikethrough, s.baseline ?? void 0, K), o && (C = !0);
|
|
3870
|
+
else if (o) S > 0 && L();
|
|
3871
|
+
else if (a > y()) {
|
|
3872
|
+
S > 0 && L();
|
|
3873
|
+
for (let t of r) e.font = P, !F(R(t, P, G, n)) && S > 0 && L(), z(t, P, m, E, W, s.strikethrough, s.baseline ?? void 0, K);
|
|
3874
|
+
} else if (!C) z(r, P, m, E, W, s.strikethrough, s.baseline ?? void 0, K);
|
|
3865
3875
|
else {
|
|
3866
|
-
let e =
|
|
3867
|
-
(o || c) && B() || L(), z(
|
|
3876
|
+
let e = x.segments.at(-1)?.text ?? "", t = r.codePointAt(0), n = [...e].at(-1)?.codePointAt(0), a = /\S$/u.test(e) && /^\S/u.test(r) && n !== 8203 && t !== 8203, o = t !== void 0 && p.lineStartForbidden.has(t) && a, c = n !== void 0 && t !== void 0 && a && !j(e) && !j(r) && i(n, t);
|
|
3877
|
+
(o || c) && B() || L(), z(r, P, m, E, W, s.strikethrough, s.baseline ?? void 0, K);
|
|
3868
3878
|
}
|
|
3869
3879
|
}
|
|
3870
3880
|
}
|
|
3871
|
-
return
|
|
3881
|
+
return h.push(x), h;
|
|
3872
3882
|
}
|
|
3873
|
-
async function
|
|
3883
|
+
async function Hn(e, t, n, r, i, a, o) {
|
|
3874
3884
|
if (t && t.fillType === "image") {
|
|
3875
3885
|
if (e.fillStyle = "#FFFFFF", e.fillRect(0, 0, n, r), !t.imagePath || !t.mimeType || !o) return;
|
|
3876
3886
|
try {
|
|
3877
|
-
let s = await
|
|
3878
|
-
widthPt: n / i /
|
|
3879
|
-
heightPt: r / i /
|
|
3887
|
+
let s = await ze(t.imagePath, t.mimeType, t.duotone, o, {
|
|
3888
|
+
widthPt: n / i / J,
|
|
3889
|
+
heightPt: r / i / J
|
|
3880
3890
|
});
|
|
3881
3891
|
if (a() || !s) return;
|
|
3882
|
-
if (e.save(), e.beginPath(), e.rect(0, 0, n, r), e.clip(), t.alpha != null && (e.globalAlpha = t.alpha), t.tile)
|
|
3892
|
+
if (e.save(), e.beginPath(), e.rect(0, 0, n, r), e.clip(), t.alpha != null && (e.globalAlpha = t.alpha), t.tile) Gn(e, s, t.tile, n, r, i);
|
|
3883
3893
|
else {
|
|
3884
3894
|
let i = t.fillRect ?? {}, a = i.l ?? 0, o = i.t ?? 0, c = i.r ?? 0, l = i.b ?? 0, u = a * n, d = o * r, f = n * (1 - a - c), p = r * (1 - o - l);
|
|
3885
3895
|
e.drawImage(s, u, d, f, p);
|
|
3886
3896
|
}
|
|
3887
3897
|
e.restore();
|
|
3888
3898
|
} catch (e) {
|
|
3889
|
-
if (
|
|
3899
|
+
if (Te(e)) throw e;
|
|
3890
3900
|
}
|
|
3891
3901
|
return;
|
|
3892
3902
|
}
|
|
3893
|
-
e.fillStyle =
|
|
3903
|
+
e.fillStyle = _n(t, e, 0, 0, n, r) ?? "#FFFFFF", e.fillRect(0, 0, n, r);
|
|
3894
3904
|
}
|
|
3895
|
-
var
|
|
3896
|
-
function
|
|
3905
|
+
var Un = 9525;
|
|
3906
|
+
function Wn(e, t, n, r, i) {
|
|
3897
3907
|
let a;
|
|
3898
3908
|
a = e === "t" || e === "ctr" || e === "b" ? (t - r) / 2 : e === "tr" || e === "r" || e === "br" ? t - r : 0;
|
|
3899
3909
|
let o;
|
|
@@ -3902,10 +3912,10 @@ function Rn(e, t, n, r, i) {
|
|
|
3902
3912
|
ay: o
|
|
3903
3913
|
};
|
|
3904
3914
|
}
|
|
3905
|
-
function
|
|
3906
|
-
let o = t.width *
|
|
3915
|
+
function Gn(e, t, n, r, i, a) {
|
|
3916
|
+
let o = t.width * Un * (n.sx ?? 1) * a, s = t.height * Un * (n.sy ?? 1) * a;
|
|
3907
3917
|
if (!(o > 0) || !(s > 0)) return;
|
|
3908
|
-
let c = n.flip === "x" || n.flip === "xy", l = n.flip === "y" || n.flip === "xy", u =
|
|
3918
|
+
let c = n.flip === "x" || n.flip === "xy", l = n.flip === "y" || n.flip === "xy", u = De(o * (c ? 2 : 1), s * (l ? 2 : 1));
|
|
3909
3919
|
if (!u) return;
|
|
3910
3920
|
let d = u.getContext("2d");
|
|
3911
3921
|
if (!d) return;
|
|
@@ -3915,33 +3925,33 @@ function zn(e, t, n, r, i, a) {
|
|
|
3915
3925
|
f(0, 0, !1, !1), c && f(o, 0, !0, !1), l && f(0, s, !1, !0), c && l && f(o, s, !0, !0);
|
|
3916
3926
|
let p = e.createPattern(u, "repeat");
|
|
3917
3927
|
if (!p) return;
|
|
3918
|
-
let { ax: m, ay: h } =
|
|
3928
|
+
let { ax: m, ay: h } = Wn(n.algn ?? "tl", r, i, o, s), g = m + Y(n.tx ?? 0, a), _ = h + Y(n.ty ?? 0, a);
|
|
3919
3929
|
typeof p.setTransform == "function" && typeof DOMMatrix < "u" ? (p.setTransform(new DOMMatrix().translateSelf(g, _)), e.fillStyle = p, e.fillRect(0, 0, r, i)) : (e.save(), e.translate(g, _), e.fillStyle = p, e.fillRect(-g, -_, r, i), e.restore());
|
|
3920
3930
|
}
|
|
3921
|
-
function
|
|
3931
|
+
function Kn(e, t, n) {
|
|
3922
3932
|
if (!t) return;
|
|
3923
|
-
let r = t.dir * Math.PI / 180, i =
|
|
3924
|
-
e.shadowColor =
|
|
3933
|
+
let r = t.dir * Math.PI / 180, i = Y(t.dist, n);
|
|
3934
|
+
e.shadowColor = X(t.color, t.alpha), e.shadowBlur = 0, e.shadowOffsetX = Math.cos(r) * i, e.shadowOffsetY = Math.sin(r) * i;
|
|
3925
3935
|
}
|
|
3926
|
-
function
|
|
3927
|
-
t && (e.shadowColor =
|
|
3936
|
+
function qn(e, t, n) {
|
|
3937
|
+
t && (e.shadowColor = X(t.color, t.alpha), e.shadowBlur = Y(t.radius, n), e.shadowOffsetX = 0, e.shadowOffsetY = 0);
|
|
3928
3938
|
}
|
|
3929
|
-
function
|
|
3939
|
+
function Jn(e) {
|
|
3930
3940
|
e.shadowColor = "transparent", e.shadowBlur = 0, e.shadowOffsetX = 0, e.shadowOffsetY = 0;
|
|
3931
3941
|
}
|
|
3932
|
-
var
|
|
3933
|
-
function
|
|
3942
|
+
var Yn = 8, Xn = 1, Zn = 1, Qn = 256;
|
|
3943
|
+
function $n(e, t, n, r, i, a, o, s, c, l, u, d, f, p, m) {
|
|
3934
3944
|
if (r <= 0) return;
|
|
3935
|
-
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(
|
|
3936
|
-
for (; w >
|
|
3937
|
-
let e = Math.min(
|
|
3945
|
+
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(Qn, Math.max(1, Math.round(b / Yn))), S = (e) => nr(e, a, r, o, s, c, u, d), C = S(x), w = ir(C, a, o, s, c, u, d, l, i, -g, _);
|
|
3946
|
+
for (; w > Zn && x < Qn;) {
|
|
3947
|
+
let e = Math.min(Qn, x * 2), t = S(e), n = ir(t, a, o, s, c, u, d, l, i, -g, _);
|
|
3938
3948
|
if (n >= w * .75) {
|
|
3939
3949
|
C = t;
|
|
3940
3950
|
break;
|
|
3941
3951
|
}
|
|
3942
3952
|
x = e, C = t, w = n;
|
|
3943
3953
|
}
|
|
3944
|
-
let T = 1e4, E =
|
|
3954
|
+
let T = 1e4, E = Xn / (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) => {
|
|
3945
3955
|
e.fillStyle = r;
|
|
3946
3956
|
for (let r = 0; r <= D; r++) {
|
|
3947
3957
|
let { s0: i, s1: a, g: o } = C[r], s = (i + a) / 2;
|
|
@@ -3949,7 +3959,7 @@ function qn(e, t, n, r, i, a, o, s, c, l, u, d, f, p, m) {
|
|
|
3949
3959
|
let c = O(r, i, s), u = k(r, a, s);
|
|
3950
3960
|
e.rect(c, -T, u - c, 2 * T), e.clip(), e.fillText(t, -s + n / 2, 0), e.restore();
|
|
3951
3961
|
}
|
|
3952
|
-
}, j =
|
|
3962
|
+
}, j = er(m), M = typeof e.globalAlpha == "number" ? e.globalAlpha : 1;
|
|
3953
3963
|
if (j >= 1 && M >= 1) {
|
|
3954
3964
|
A(e, m);
|
|
3955
3965
|
return;
|
|
@@ -3969,67 +3979,67 @@ function qn(e, t, n, r, i, a, o, s, c, l, u, d, f, p, m) {
|
|
|
3969
3979
|
[s, _],
|
|
3970
3980
|
[c, _]
|
|
3971
3981
|
]) {
|
|
3972
|
-
let n =
|
|
3982
|
+
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;
|
|
3973
3983
|
o < P && (P = o), o > I && (I = o), s < F && (F = s), s > L && (L = s);
|
|
3974
3984
|
}
|
|
3975
3985
|
}
|
|
3976
3986
|
if (!(I > P && L > F)) return;
|
|
3977
|
-
let R = Math.floor(P - 2), z = Math.floor(F - 2), B =
|
|
3987
|
+
let R = Math.floor(P - 2), z = Math.floor(F - 2), B = De(Math.ceil(I + 2) - R, Math.ceil(L + 2) - z), V = B ? B.getContext("2d") : null;
|
|
3978
3988
|
if (!B || !V) {
|
|
3979
3989
|
A(e, m);
|
|
3980
3990
|
return;
|
|
3981
3991
|
}
|
|
3982
|
-
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,
|
|
3992
|
+
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, tr(m)), e.save(), e.setTransform(1, 0, 0, 1, 0, 0), e.globalAlpha = M * j, e.drawImage(B, R, z), e.restore();
|
|
3983
3993
|
}
|
|
3984
|
-
function
|
|
3994
|
+
function er(e) {
|
|
3985
3995
|
let t = /^rgba?\(\s*[\d.]+\s*,\s*[\d.]+\s*,\s*[\d.]+\s*,\s*([\d.]+)\s*\)$/i.exec(e);
|
|
3986
3996
|
if (!t) return 1;
|
|
3987
3997
|
let n = parseFloat(t[1]);
|
|
3988
3998
|
return Number.isFinite(n) ? Math.min(1, Math.max(0, n)) : 1;
|
|
3989
3999
|
}
|
|
3990
|
-
function
|
|
4000
|
+
function tr(e) {
|
|
3991
4001
|
let t = /^rgba?\(\s*([\d.]+)\s*,\s*([\d.]+)\s*,\s*([\d.]+)/i.exec(e);
|
|
3992
4002
|
return t ? `rgb(${t[1]}, ${t[2]}, ${t[3]})` : e;
|
|
3993
4003
|
}
|
|
3994
|
-
function
|
|
4004
|
+
function nr(e, t, n, r, i, a, o, s) {
|
|
3995
4005
|
let c = Array(e);
|
|
3996
4006
|
for (let l = 0; l < e; l++) {
|
|
3997
4007
|
let u = l / e * n, d = (l + 1) / e * n;
|
|
3998
4008
|
c[l] = {
|
|
3999
4009
|
s0: u,
|
|
4000
4010
|
s1: d,
|
|
4001
|
-
g:
|
|
4011
|
+
g: nt(t, (r + (u + d) / 2) / i * a, o, s)
|
|
4002
4012
|
};
|
|
4003
4013
|
}
|
|
4004
4014
|
return c;
|
|
4005
4015
|
}
|
|
4006
|
-
function
|
|
4016
|
+
function rr(e, t, n, r) {
|
|
4007
4017
|
let i = n * t, a = r * e.vScale, o = i + e.shear * a, s = Math.cos(e.angle), c = Math.sin(e.angle);
|
|
4008
4018
|
return {
|
|
4009
4019
|
x: e.x + s * o - c * a,
|
|
4010
4020
|
y: e.y + c * o + s * a
|
|
4011
4021
|
};
|
|
4012
4022
|
}
|
|
4013
|
-
function
|
|
4023
|
+
function ir(e, t, n, r, i, a, o, s, c, l, u) {
|
|
4014
4024
|
let d = 0;
|
|
4015
4025
|
for (let f of e) {
|
|
4016
4026
|
let e = (f.s0 + f.s1) / 2;
|
|
4017
4027
|
for (let p of [f.s0, f.s1]) {
|
|
4018
|
-
let m =
|
|
4028
|
+
let m = nt(t, (n + p) / r * i, a, o);
|
|
4019
4029
|
for (let t of [l, u]) {
|
|
4020
|
-
let n =
|
|
4030
|
+
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;
|
|
4021
4031
|
i > d && (d = i);
|
|
4022
4032
|
}
|
|
4023
4033
|
}
|
|
4024
4034
|
}
|
|
4025
4035
|
return d;
|
|
4026
4036
|
}
|
|
4027
|
-
function
|
|
4028
|
-
let d = i, f = a, p = Math.max(1, o), m = Math.max(1, s), h =
|
|
4037
|
+
function ar(e, t, n, r, i, a, o, s, c, l, u) {
|
|
4038
|
+
let d = i, f = a, p = Math.max(1, o), m = Math.max(1, s), h = Qe(n, r, p, m);
|
|
4029
4039
|
if (!h) return;
|
|
4030
|
-
let g = t.defaultBold ?? !1, _ = t.defaultItalic ?? !1, v = (t.defaultFontSize ?? 18) *
|
|
4040
|
+
let g = t.defaultBold ?? !1, _ = t.defaultItalic ?? !1, v = (t.defaultFontSize ?? 18) * J * c, y = [];
|
|
4031
4041
|
for (let n of t.paragraphs) {
|
|
4032
|
-
let t =
|
|
4042
|
+
let t = Vn(e, n, Infinity, n.defFontSize == null ? v : n.defFontSize * J * c, n.defColor ? X(n.defColor) : l, c, 0, g, _, 1, void 0, u, 0);
|
|
4033
4043
|
for (let e of t) y.push(e);
|
|
4034
4044
|
}
|
|
4035
4045
|
if (y.length === 0) return;
|
|
@@ -4048,10 +4058,10 @@ function $n(e, t, n, r, i, a, o, s, c, l, u) {
|
|
|
4048
4058
|
}
|
|
4049
4059
|
e.font = t.font;
|
|
4050
4060
|
let n = t.letterSpacingPx ?? 0, r = e.measureText(t.text);
|
|
4051
|
-
a += r.width + n *
|
|
4061
|
+
a += r.width + n * Rn(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));
|
|
4052
4062
|
}
|
|
4053
4063
|
if (a <= 0) continue;
|
|
4054
|
-
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 =
|
|
4064
|
+
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 = tt(h, a), b = 0;
|
|
4055
4065
|
for (let t of n.segments) {
|
|
4056
4066
|
if (t.math) {
|
|
4057
4067
|
b += t.math.width;
|
|
@@ -4062,17 +4072,17 @@ function $n(e, t, n, r, i, a, o, s, c, l, u) {
|
|
|
4062
4072
|
for (let s of o) {
|
|
4063
4073
|
let o = e.measureText(s).width + n, c = r + u * (i - r);
|
|
4064
4074
|
if (!h.singleEdge && o > 0) {
|
|
4065
|
-
|
|
4075
|
+
$n(e, s, n, o, x(), h, b, a, v, g, _, c, d, f, t.color), b += o;
|
|
4066
4076
|
continue;
|
|
4067
4077
|
}
|
|
4068
|
-
let l =
|
|
4078
|
+
let l = nt(h, (b + o / 2) / a * v, _, c);
|
|
4069
4079
|
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;
|
|
4070
4080
|
}
|
|
4071
4081
|
}
|
|
4072
4082
|
}
|
|
4073
4083
|
e.restore();
|
|
4074
4084
|
}
|
|
4075
|
-
function
|
|
4085
|
+
function or(e, t, n, r, i, a, o) {
|
|
4076
4086
|
let s = Math.min(r, i);
|
|
4077
4087
|
switch (e) {
|
|
4078
4088
|
case "rightarrow":
|
|
@@ -4102,17 +4112,17 @@ function er(e, t, n, r, i, a, o) {
|
|
|
4102
4112
|
default: return null;
|
|
4103
4113
|
}
|
|
4104
4114
|
}
|
|
4105
|
-
function
|
|
4106
|
-
return e.defaultTextColor ?
|
|
4115
|
+
function sr(e, t) {
|
|
4116
|
+
return e.defaultTextColor ? X(e.defaultTextColor) : t.smartArtFallbackTextColor != null && cn(e) ? t.smartArtFallbackTextColor : null;
|
|
4107
4117
|
}
|
|
4108
|
-
function
|
|
4118
|
+
function cr(e, t, n) {
|
|
4109
4119
|
return {
|
|
4110
4120
|
outerRotation: e,
|
|
4111
4121
|
localFlipH: t,
|
|
4112
4122
|
localFlipV: n
|
|
4113
4123
|
};
|
|
4114
4124
|
}
|
|
4115
|
-
function
|
|
4125
|
+
function lr(e, t, n, r, i) {
|
|
4116
4126
|
let a = [
|
|
4117
4127
|
{
|
|
4118
4128
|
x: t,
|
|
@@ -4141,7 +4151,7 @@ function rr(e, t, n, r, i) {
|
|
|
4141
4151
|
h: l - s
|
|
4142
4152
|
};
|
|
4143
4153
|
}
|
|
4144
|
-
var
|
|
4154
|
+
var ur = {
|
|
4145
4155
|
tl: [0, 0],
|
|
4146
4156
|
t: [.5, 0],
|
|
4147
4157
|
tr: [1, 0],
|
|
@@ -4152,15 +4162,15 @@ var ir = {
|
|
|
4152
4162
|
b: [.5, 1],
|
|
4153
4163
|
br: [1, 1]
|
|
4154
4164
|
};
|
|
4155
|
-
function
|
|
4165
|
+
function dr(e, t, n) {
|
|
4156
4166
|
return [e.a * t + e.c * n + e.e, e.b * t + e.d * n + e.f];
|
|
4157
4167
|
}
|
|
4158
|
-
function
|
|
4159
|
-
let [o, s] =
|
|
4160
|
-
return
|
|
4168
|
+
function fr(e, t, n, r, i, a) {
|
|
4169
|
+
let [o, s] = ur[a ?? "b"];
|
|
4170
|
+
return dr(e, t + o * r, n + s * i);
|
|
4161
4171
|
}
|
|
4162
|
-
function
|
|
4163
|
-
let c =
|
|
4172
|
+
function pr(e, t, n, r, i, a, o, s) {
|
|
4173
|
+
let c = ft(e, i, a).corners, l = (o > 0 ? Le(c, o / i, o / a) ?? c : c).map((e) => dr(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, _] = ur[s ?? "b"], v = Pe(c, g, _);
|
|
4164
4174
|
return {
|
|
4165
4175
|
bbox: {
|
|
4166
4176
|
x: f,
|
|
@@ -4168,15 +4178,15 @@ function sr(e, t, n, r, i, a, o, s) {
|
|
|
4168
4178
|
w: m - f,
|
|
4169
4179
|
h: h - p
|
|
4170
4180
|
},
|
|
4171
|
-
anchor: v ?
|
|
4181
|
+
anchor: v ? dr(t, n + v.x, r + v.y) : fr(t, n, r, i, a, s)
|
|
4172
4182
|
};
|
|
4173
4183
|
}
|
|
4174
|
-
function
|
|
4184
|
+
function mr(e, t, n, r) {
|
|
4175
4185
|
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);
|
|
4176
|
-
if (r && (i + o <= 0 || a + s <= 0 || i >= r.w || a >= r.h) ||
|
|
4186
|
+
if (r && (i + o <= 0 || a + s <= 0 || i >= r.w || a >= r.h) || Ne(o, s).clamped) return e;
|
|
4177
4187
|
let c = null;
|
|
4178
4188
|
try {
|
|
4179
|
-
c =
|
|
4189
|
+
c = De(o, s);
|
|
4180
4190
|
} catch {
|
|
4181
4191
|
return e;
|
|
4182
4192
|
}
|
|
@@ -4195,7 +4205,7 @@ function cr(e, t, n, r) {
|
|
|
4195
4205
|
e.save(), e.setTransform(u), e.drawImage(c, i, a), e.restore();
|
|
4196
4206
|
};
|
|
4197
4207
|
}
|
|
4198
|
-
function
|
|
4208
|
+
function hr(e, t, n, r, i, a, o, s, c, l = !0, u = r) {
|
|
4199
4209
|
let d = e.canvas.width || 0, f = e.canvas.height || 0, p = d > 0 && f > 0, m = {
|
|
4200
4210
|
a: 1,
|
|
4201
4211
|
b: 0,
|
|
@@ -4210,40 +4220,40 @@ function lr(e, t, n, r, i, a, o, s, c, l = !0, u = r) {
|
|
|
4210
4220
|
}, v = (e) => {
|
|
4211
4221
|
h(e), u(e);
|
|
4212
4222
|
}, y = !1;
|
|
4213
|
-
t.shadow && p ? (e.save(), e.setTransform(m), y = !
|
|
4223
|
+
t.shadow && p ? (e.save(), e.setTransform(m), y = !Ie(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), je(e, g, i, t.reflection, s, d, f), e.restore()), y ? Kn(e, t.shadow ?? null, o) : t.glow && qn(e, t.glow, o), t.softEdge && p ? (e.save(), e.setTransform(m), Me(e, g, i, t.softEdge, s, d, f, _), e.restore()) : n(e), (y || t.glow) && Jn(e), t.innerShadow && l && p && (e.save(), e.setTransform(m), Fe(e, v, i, t.innerShadow, s, d, f), e.restore());
|
|
4214
4224
|
}
|
|
4215
|
-
function
|
|
4225
|
+
function gr(e, t, n, r = "#000000", i, o = {
|
|
4216
4226
|
themeMajorFont: null,
|
|
4217
4227
|
themeMinorFont: null,
|
|
4218
4228
|
dpr: 1
|
|
4219
4229
|
}, s, c) {
|
|
4220
|
-
let
|
|
4230
|
+
let l = Y(t.x, n), u = Y(t.y, n), d = Y(t.width, n), f = Y(t.height, n), p = s && t.id !== void 0 ? (e) => s({
|
|
4221
4231
|
...e,
|
|
4222
4232
|
shapeId: t.id
|
|
4223
4233
|
}) : s;
|
|
4224
|
-
if (
|
|
4225
|
-
if (t.stroke && (e.save(),
|
|
4226
|
-
x:
|
|
4227
|
-
y:
|
|
4228
|
-
w:
|
|
4234
|
+
if (f === 0 && t.textBody?.verticalAnchor === "b") {
|
|
4235
|
+
if (t.stroke && (e.save(), Nr(e, t.stroke, n, {
|
|
4236
|
+
x: l,
|
|
4237
|
+
y: u,
|
|
4238
|
+
w: d,
|
|
4229
4239
|
h: 1
|
|
4230
|
-
}, t.rotation), e.beginPath(), e.moveTo(
|
|
4231
|
-
let
|
|
4232
|
-
|
|
4240
|
+
}, t.rotation), e.beginPath(), e.moveTo(l, u), e.lineTo(l + d, u), e.stroke(), e.restore()), t.textBody) {
|
|
4241
|
+
let a = sr(t, o);
|
|
4242
|
+
Sr(e, t.textBody, l, u, d, f, n, a, t.rotation, t.flipH, t.flipV, r, i, o, p, !1, c);
|
|
4233
4243
|
}
|
|
4234
4244
|
return;
|
|
4235
4245
|
}
|
|
4236
|
-
let
|
|
4237
|
-
if (
|
|
4238
|
-
let
|
|
4239
|
-
e.save(),
|
|
4246
|
+
let m = t.scene3d && pt(t.scene3d.camera) ? t.scene3d : null;
|
|
4247
|
+
if (m && d > 0 && f > 0) {
|
|
4248
|
+
let a = e.getTransform(), s = Math.abs(a.a * a.d - a.b * a.c), c = s > 0 ? Math.sqrt(s) : 1, p = Cr(t.sp3d, t.scene3d?.lightRig, t.sp3d?.prstMaterial, n, c), h = wr(t.sp3d, m.camera, d, f, n, c), g = cr(t.rotation, t.flipH, t.flipV);
|
|
4249
|
+
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)));
|
|
4240
4250
|
let _ = {
|
|
4241
4251
|
...t,
|
|
4242
4252
|
x: 0,
|
|
4243
4253
|
y: 0,
|
|
4244
4254
|
rotation: 0,
|
|
4245
|
-
flipH:
|
|
4246
|
-
flipV:
|
|
4255
|
+
flipH: g.localFlipH,
|
|
4256
|
+
flipV: g.localFlipV,
|
|
4247
4257
|
scene3d: void 0,
|
|
4248
4258
|
sp3d: void 0,
|
|
4249
4259
|
shadow: null,
|
|
@@ -4258,21 +4268,21 @@ function ur(e, t, n, r = "#000000", i, a = {
|
|
|
4258
4268
|
..._,
|
|
4259
4269
|
fill: null,
|
|
4260
4270
|
stroke: null
|
|
4261
|
-
}, b = (t.stroke ? t.stroke.width * n / 2 : 0) + (t.sp3d?.contourW ? t.sp3d.contourW * n : 0) + (
|
|
4262
|
-
|
|
4263
|
-
},
|
|
4264
|
-
bevels:
|
|
4265
|
-
extrusion:
|
|
4271
|
+
}, b = (t.stroke ? t.stroke.width * n / 2 : 0) + (t.sp3d?.contourW ? t.sp3d.contourW * n : 0) + (h ? Math.hypot(h.offsetX, h.offsetY) / c : 0) + 2, x = (e, t, a) => Tr(e, m.camera, l, u, d, f, (e) => {
|
|
4272
|
+
gr(e, t, n, r, i, o, void 0);
|
|
4273
|
+
}, a ? {
|
|
4274
|
+
bevels: p,
|
|
4275
|
+
extrusion: h ?? void 0,
|
|
4266
4276
|
edgePadCss: b
|
|
4267
4277
|
} : {}), S = (e) => x(e, v, !0), C = (e) => !t.textBody || x(e, y, !1);
|
|
4268
4278
|
if (t.shadow || t.innerShadow || t.glow || t.softEdge || t.reflection) {
|
|
4269
|
-
let r = e.getTransform(), i = Math.abs(r.a * r.d - r.b * r.c), a = i > 0 ? Math.sqrt(i) : 1, o =
|
|
4279
|
+
let r = e.getTransform(), i = Math.abs(r.a * r.d - r.b * r.c), a = i > 0 ? Math.sqrt(i) : 1, o = pr(m.camera, r, l, u, d, f, b, t.shadow?.algn), s = !1, c = mr((e) => {
|
|
4270
4280
|
s = S(e) || s;
|
|
4271
4281
|
}, r, o.bbox, {
|
|
4272
4282
|
w: e.canvas.width || 0,
|
|
4273
4283
|
h: e.canvas.height || 0
|
|
4274
4284
|
});
|
|
4275
|
-
if (
|
|
4285
|
+
if (hr(e, t, c, c, o.bbox, o.anchor, n, n * a, r, !!t.fill), s) {
|
|
4276
4286
|
C(e), e.restore();
|
|
4277
4287
|
return;
|
|
4278
4288
|
}
|
|
@@ -4282,10 +4292,10 @@ function ur(e, t, n, r = "#000000", i, a = {
|
|
|
4282
4292
|
}
|
|
4283
4293
|
e.restore();
|
|
4284
4294
|
}
|
|
4285
|
-
e.save(), (t.rotation !== 0 || t.flipH || t.flipV) && (e.translate(
|
|
4286
|
-
let
|
|
4287
|
-
t.shadow ||
|
|
4288
|
-
let
|
|
4295
|
+
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)));
|
|
4296
|
+
let h = t.geometry.toLowerCase(), g = _n(t.fill, e, l, u, d, f, t.rotation);
|
|
4297
|
+
t.shadow || qn(e, t.glow ?? null, n);
|
|
4298
|
+
let _ = new Set([
|
|
4289
4299
|
"line",
|
|
4290
4300
|
"straightconnector1",
|
|
4291
4301
|
"bentconnector2",
|
|
@@ -4296,7 +4306,7 @@ function ur(e, t, n, r = "#000000", i, a = {
|
|
|
4296
4306
|
"curvedconnector3",
|
|
4297
4307
|
"curvedconnector4",
|
|
4298
4308
|
"curvedconnector5"
|
|
4299
|
-
]),
|
|
4309
|
+
]), y = new Set([
|
|
4300
4310
|
"callout1",
|
|
4301
4311
|
"callout2",
|
|
4302
4312
|
"callout3",
|
|
@@ -4309,22 +4319,22 @@ function ur(e, t, n, r = "#000000", i, a = {
|
|
|
4309
4319
|
"accentbordercallout1",
|
|
4310
4320
|
"accentbordercallout2",
|
|
4311
4321
|
"accentbordercallout3"
|
|
4312
|
-
]),
|
|
4313
|
-
x:
|
|
4314
|
-
y:
|
|
4315
|
-
w:
|
|
4316
|
-
h:
|
|
4322
|
+
]), b = (e) => y.has(e) || e === "line" || e === "straightconnector1" || e.startsWith("bentconnector"), x = !t.custGeom && v(h), C = (r, i, o = {
|
|
4323
|
+
x: l,
|
|
4324
|
+
y: u,
|
|
4325
|
+
w: d,
|
|
4326
|
+
h: f
|
|
4317
4327
|
}) => {
|
|
4318
|
-
let { x:
|
|
4319
|
-
|
|
4320
|
-
x:
|
|
4321
|
-
y:
|
|
4322
|
-
w:
|
|
4323
|
-
h:
|
|
4328
|
+
let { x: s, y: c, w: p, h: m } = o, _ = i ?? (r === e && s === l && c === u && p === d && m === f ? g : _n(t.fill, r, s, c, p, m, t.rotation)), v = i ? null : t.stroke ? () => {
|
|
4329
|
+
Nr(r, t.stroke, n, {
|
|
4330
|
+
x: s,
|
|
4331
|
+
y: c,
|
|
4332
|
+
w: p,
|
|
4333
|
+
h: m
|
|
4324
4334
|
}, t.rotation), r.stroke();
|
|
4325
|
-
} : null,
|
|
4326
|
-
if (
|
|
4327
|
-
|
|
4335
|
+
} : null, y = () => Jn(r);
|
|
4336
|
+
if (x && !i) {
|
|
4337
|
+
a(r, h, s, c, p, m, [
|
|
4328
4338
|
t.adj,
|
|
4329
4339
|
t.adj2,
|
|
4330
4340
|
t.adj3,
|
|
@@ -4333,11 +4343,11 @@ function ur(e, t, n, r = "#000000", i, a = {
|
|
|
4333
4343
|
t.adj6,
|
|
4334
4344
|
t.adj7,
|
|
4335
4345
|
t.adj8
|
|
4336
|
-
],
|
|
4346
|
+
], _, v, y, b(h) ? { skipTrailingStroke: !0 } : void 0);
|
|
4337
4347
|
return;
|
|
4338
4348
|
}
|
|
4339
|
-
r.beginPath(), t.custGeom && t.custGeom.length > 0 ?
|
|
4340
|
-
},
|
|
4349
|
+
r.beginPath(), t.custGeom && t.custGeom.length > 0 ? _r(r, t.custGeom, s, c, p, m) : me(r, h, s, c, p, m, t.adj, t.adj2, t.adj3, t.adj4), _ && h !== "arc" && (r.fillStyle = _, h === "donut" || h === "smileyface" || h === "frame" ? r.fill("evenodd") : r.fill(), i || y()), v && v();
|
|
4350
|
+
}, w = e.getTransform(), T = Math.abs(w.a * w.d - w.b * w.c), E = T > 0 ? Math.sqrt(T) : 1, D = (t.shadow || t.reflection || t.softEdge || t.innerShadow ? x ? ae(h, l, u, d, f, [
|
|
4341
4351
|
t.adj,
|
|
4342
4352
|
t.adj2,
|
|
4343
4353
|
t.adj3,
|
|
@@ -4346,20 +4356,20 @@ function ur(e, t, n, r = "#000000", i, a = {
|
|
|
4346
4356
|
t.adj6,
|
|
4347
4357
|
t.adj7,
|
|
4348
4358
|
t.adj8
|
|
4349
|
-
]) : t.custGeom && t.custGeom.length > 0 ?
|
|
4350
|
-
x:
|
|
4351
|
-
y:
|
|
4352
|
-
w:
|
|
4353
|
-
h:
|
|
4354
|
-
},
|
|
4355
|
-
x:
|
|
4356
|
-
y:
|
|
4357
|
-
w:
|
|
4358
|
-
h:
|
|
4359
|
-
} :
|
|
4360
|
-
let r = t.stroke?.fill ?
|
|
4361
|
-
if (t.stroke && (
|
|
4362
|
-
let i =
|
|
4359
|
+
]) : t.custGeom && t.custGeom.length > 0 ? fe(t.custGeom, l, u, d, f) : null : null) ?? {
|
|
4360
|
+
x: l,
|
|
4361
|
+
y: u,
|
|
4362
|
+
w: d,
|
|
4363
|
+
h: f
|
|
4364
|
+
}, O = t.stroke ? t.stroke.width * n / 2 : 0, k = t.stroke ? Math.max(t.stroke.headEnd ? he(t.stroke.headEnd, t.stroke, n) : 0, t.stroke.tailEnd ? he(t.stroke.tailEnd, t.stroke, n) : 0) : 0, A = t.sp3d?.contourW ? t.sp3d.contourW * n : 0, j = Math.max(O, k, A), M = j > 0 ? {
|
|
4365
|
+
x: D.x - j,
|
|
4366
|
+
y: D.y - j,
|
|
4367
|
+
w: D.w + j * 2,
|
|
4368
|
+
h: D.h + j * 2
|
|
4369
|
+
} : D, N = lr(w, M.x, M.y, M.w, M.h), P = n * E, F = m ? [] : Cr(t.sp3d, t.scene3d?.lightRig, t.sp3d?.prstMaterial, n, E), I = (t.stroke ? t.stroke.width * n / 2 : 0) + 2, L = (e) => {
|
|
4370
|
+
let r = t.stroke?.fill ? _n(t.stroke.fill, e, l, u, d, f, t.rotation) ?? void 0 : void 0;
|
|
4371
|
+
if (t.stroke && (_.has(h) || y.has(h))) {
|
|
4372
|
+
let i = S(h, l, u, d, f, [
|
|
4363
4373
|
t.adj,
|
|
4364
4374
|
t.adj2,
|
|
4365
4375
|
t.adj3,
|
|
@@ -4370,69 +4380,69 @@ function ur(e, t, n, r = "#000000", i, a = {
|
|
|
4370
4380
|
t.adj8
|
|
4371
4381
|
]);
|
|
4372
4382
|
if (!i) return;
|
|
4373
|
-
let a = t.stroke.cmpd, o =
|
|
4374
|
-
if (
|
|
4383
|
+
let a = t.stroke.cmpd, o = h === "line" || h === "straightconnector1";
|
|
4384
|
+
if (b(h) && i.vertices.length >= 2 && !(a && o)) {
|
|
4375
4385
|
let r = i.vertices.map((e) => ({
|
|
4376
4386
|
x: e.x,
|
|
4377
4387
|
y: e.y
|
|
4378
4388
|
}));
|
|
4379
4389
|
if (t.stroke.tailEnd) {
|
|
4380
|
-
let e =
|
|
4381
|
-
r[r.length - 1] =
|
|
4390
|
+
let e = de(t.stroke.tailEnd, t.stroke, n);
|
|
4391
|
+
r[r.length - 1] = ce(r[r.length - 1], r[r.length - 2], e);
|
|
4382
4392
|
}
|
|
4383
4393
|
if (t.stroke.headEnd) {
|
|
4384
|
-
let e =
|
|
4385
|
-
r[0] =
|
|
4394
|
+
let e = de(t.stroke.headEnd, t.stroke, n);
|
|
4395
|
+
r[0] = ce(r[0], r[1], e);
|
|
4386
4396
|
}
|
|
4387
|
-
|
|
4388
|
-
x:
|
|
4389
|
-
y:
|
|
4390
|
-
w:
|
|
4391
|
-
h:
|
|
4397
|
+
Nr(e, t.stroke, n, {
|
|
4398
|
+
x: l,
|
|
4399
|
+
y: u,
|
|
4400
|
+
w: d,
|
|
4401
|
+
h: f
|
|
4392
4402
|
}, t.rotation), e.beginPath(), e.moveTo(r[0].x, r[0].y);
|
|
4393
4403
|
for (let t = 1; t < r.length; t++) e.lineTo(r[t].x, r[t].y);
|
|
4394
4404
|
e.stroke();
|
|
4395
4405
|
}
|
|
4396
|
-
a && o &&
|
|
4406
|
+
a && o && Mr(e, i.start, i.end, t.stroke, a, n, t.rotation), t.stroke.tailEnd && pe(e, i.end.x, i.end.y, i.end.angle, t.stroke.tailEnd, t.stroke, n, r), t.stroke.headEnd && pe(e, i.start.x, i.start.y, i.start.angle, t.stroke.headEnd, t.stroke, n, r);
|
|
4397
4407
|
return;
|
|
4398
4408
|
}
|
|
4399
4409
|
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;
|
|
4400
|
-
let { start: i, end: a } =
|
|
4401
|
-
i && t.stroke.headEnd && t.stroke.headEnd.type !== "none" &&
|
|
4402
|
-
},
|
|
4403
|
-
if (
|
|
4410
|
+
let { start: i, end: a } = ge(t.custGeom);
|
|
4411
|
+
i && t.stroke.headEnd && t.stroke.headEnd.type !== "none" && pe(e, l + i.x * d, u + i.y * f, Math.atan2(i.dy * f, i.dx * d), t.stroke.headEnd, t.stroke, n, r), a && t.stroke.tailEnd && t.stroke.tailEnd.type !== "none" && pe(e, l + a.x * d, u + a.y * f, Math.atan2(a.dy * f, a.dx * d), t.stroke.tailEnd, t.stroke, n, r);
|
|
4412
|
+
}, R = (e) => {
|
|
4413
|
+
if (F.length > 0 && Er(e, l, u, d, f, F, (e, t, n, r, i) => C(e, void 0, {
|
|
4404
4414
|
x: t,
|
|
4405
4415
|
y: n,
|
|
4406
4416
|
w: r,
|
|
4407
4417
|
h: i
|
|
4408
|
-
}), void 0,
|
|
4409
|
-
|
|
4418
|
+
}), void 0, I)) {
|
|
4419
|
+
L(e), Jn(e);
|
|
4410
4420
|
return;
|
|
4411
4421
|
}
|
|
4412
|
-
|
|
4422
|
+
C(e), L(e);
|
|
4413
4423
|
};
|
|
4414
|
-
if (
|
|
4415
|
-
let
|
|
4424
|
+
if (hr(e, t, R, R, N, fr(w, l, u, d, f, t.shadow?.algn), n, P, w, !!g, (e) => C(e, "#000")), t.textBody) {
|
|
4425
|
+
let a = sr(t, o);
|
|
4416
4426
|
if (e.save(), t.flipH || t.flipV) {
|
|
4417
|
-
let n =
|
|
4427
|
+
let n = l + d / 2, r = u + f / 2;
|
|
4418
4428
|
e.translate(n, r), t.flipH && e.scale(-1, 1), t.flipV && e.scale(1, -1), e.translate(-n, -r);
|
|
4419
4429
|
}
|
|
4420
|
-
let s =
|
|
4421
|
-
if (t.textRect) s =
|
|
4422
|
-
else if (
|
|
4423
|
-
let e =
|
|
4424
|
-
s =
|
|
4430
|
+
let s = l, m = u, g = d, _ = f;
|
|
4431
|
+
if (t.textRect) s = Y(t.textRect.x, n), m = Y(t.textRect.y, n), g = Y(t.textRect.width, n), _ = Y(t.textRect.height, n);
|
|
4432
|
+
else if (h === "ellipse") {
|
|
4433
|
+
let e = d * (1 - 1 / Math.SQRT2) / 2, t = f * (1 - 1 / Math.SQRT2) / 2;
|
|
4434
|
+
s = l + e, m = u + t, g = d / Math.SQRT2, _ = f / Math.SQRT2;
|
|
4425
4435
|
} else {
|
|
4426
|
-
let e =
|
|
4427
|
-
e && (s = e.tx,
|
|
4436
|
+
let e = or(h, l, u, d, f, t.adj, t.adj2);
|
|
4437
|
+
e && (s = e.tx, m = e.ty, g = e.tw, _ = e.th);
|
|
4428
4438
|
}
|
|
4429
|
-
|
|
4439
|
+
Sr(e, t.textBody, s, m, g, _, n, a, t.rotation, !1, !1, r, i, o, p, !1, c), e.restore();
|
|
4430
4440
|
}
|
|
4431
4441
|
e.restore();
|
|
4432
4442
|
}
|
|
4433
|
-
var
|
|
4434
|
-
function
|
|
4435
|
-
let n = `${e}`, r = e >= 1 && e <= 26 ? String.fromCharCode(96 + e) : n, i = e >= 1 && e <= 26 ? String.fromCharCode(64 + e) : n, a =
|
|
4443
|
+
var _r = le;
|
|
4444
|
+
function vr(e, t) {
|
|
4445
|
+
let n = `${e}`, r = e >= 1 && e <= 26 ? String.fromCharCode(96 + e) : n, i = e >= 1 && e <= 26 ? String.fromCharCode(64 + e) : n, a = yr(e).toLowerCase(), o = yr(e), s = n.replace(/[0-9]/g, (e) => String.fromCharCode(65296 + (e.charCodeAt(0) - 48)));
|
|
4436
4446
|
switch (t) {
|
|
4437
4447
|
case "arabicPlain": return n;
|
|
4438
4448
|
case "arabicPeriod": return `${n}.`;
|
|
@@ -4459,7 +4469,7 @@ function fr(e, t) {
|
|
|
4459
4469
|
default: return `${n}.`;
|
|
4460
4470
|
}
|
|
4461
4471
|
}
|
|
4462
|
-
function
|
|
4472
|
+
function yr(e) {
|
|
4463
4473
|
let t = [
|
|
4464
4474
|
1e3,
|
|
4465
4475
|
900,
|
|
@@ -4492,28 +4502,28 @@ function pr(e) {
|
|
|
4492
4502
|
for (let i = 0; i < t.length; i++) for (; e >= t[i];) r += n[i], e -= t[i];
|
|
4493
4503
|
return r;
|
|
4494
4504
|
}
|
|
4495
|
-
function
|
|
4505
|
+
function br(e) {
|
|
4496
4506
|
for (let t of e.runs) if (t.type === "text" && t.text !== "" || t.type === "math") return !0;
|
|
4497
4507
|
return !1;
|
|
4498
4508
|
}
|
|
4499
|
-
function
|
|
4500
|
-
let n =
|
|
4501
|
-
if (e.bullet.type === "char") return t.clear(), n ?
|
|
4509
|
+
function xr(e, t) {
|
|
4510
|
+
let n = br(e);
|
|
4511
|
+
if (e.bullet.type === "char") return t.clear(), n ? ue(e.bullet.char, e.bullet.fontFamily ?? null) : "";
|
|
4502
4512
|
if (e.bullet.type === "autoNum") {
|
|
4503
4513
|
if (!n) return "";
|
|
4504
4514
|
let r = e.lvl;
|
|
4505
|
-
return t.has(r) ? t.set(r, t.get(r) + 1) : t.set(r, e.bullet.startAt ?? 1),
|
|
4515
|
+
return t.has(r) ? t.set(r, t.get(r) + 1) : t.set(r, e.bullet.startAt ?? 1), vr(t.get(r), e.bullet.numType);
|
|
4506
4516
|
}
|
|
4507
4517
|
return t.clear(), "";
|
|
4508
4518
|
}
|
|
4509
|
-
function
|
|
4519
|
+
function Sr(t, n, r, i, a, o, s, c = null, l = 0, u = !1, d = !1, f = "#000000", p, m = {
|
|
4510
4520
|
themeMajorFont: null,
|
|
4511
4521
|
themeMinorFont: null,
|
|
4512
4522
|
dpr: 1
|
|
4513
4523
|
}, h, g = !1, _, v = !1, y = g) {
|
|
4514
4524
|
let b = n.vert === "vert" || n.vert === "eaVert", x = n.vert === "vert270";
|
|
4515
4525
|
if (b || x) {
|
|
4516
|
-
let
|
|
4526
|
+
let e = r + a / 2, u = i + o / 2, d = b ? 90 : -90, v = h ? (e) => h({
|
|
4517
4527
|
...e,
|
|
4518
4528
|
inShapeX: e.inShapeX - o / 2 + a / 2,
|
|
4519
4529
|
inShapeY: e.inShapeY - a / 2 + o / 2,
|
|
@@ -4525,49 +4535,49 @@ function gr(e, n, r, i, a, o, s, c = null, l = 0, u = !1, d = !1, f = "#000000",
|
|
|
4525
4535
|
textBodyRotation: d
|
|
4526
4536
|
}) : void 0;
|
|
4527
4537
|
if (g) return a;
|
|
4528
|
-
|
|
4538
|
+
t.save(), t.translate(e, u), t.rotate(x ? -Math.PI / 2 : Math.PI / 2), Sr(t, {
|
|
4529
4539
|
...n,
|
|
4530
4540
|
vert: "horz"
|
|
4531
|
-
}, -o / 2, -a / 2, o, a, s, c, 0, !1, !1, f, p, m, v, !1, _, n.vert === "eaVert"),
|
|
4541
|
+
}, -o / 2, -a / 2, o, a, s, c, 0, !1, !1, f, p, m, v, !1, _, n.vert === "eaVert"), t.restore();
|
|
4532
4542
|
return;
|
|
4533
4543
|
}
|
|
4534
4544
|
let S = n.textWarp;
|
|
4535
|
-
if (!g && S &&
|
|
4536
|
-
|
|
4545
|
+
if (!g && S && qe(S.preset)) {
|
|
4546
|
+
ar(t, n, S.preset, S.adj ?? [], r, i, a, o, s, c ?? f, m);
|
|
4537
4547
|
return;
|
|
4538
4548
|
}
|
|
4539
|
-
let C =
|
|
4540
|
-
let i = (n.defaultFontSize ?? 18) *
|
|
4549
|
+
let C = Y(n.lIns, s), w = Y(n.rIns, s), T = Y(n.tIns, s), E = Y(n.bIns, s), D = n.wrap !== "none", O = n.autoFit === "sp" ? D && In(t, n, a, C, w, s, m) : D, k = Math.max(1, n.numCol ?? 1), j = Y(n.spcCol ?? 0, s), M = n.defaultBold ?? !1, N = n.defaultItalic ?? !1, P = c ?? f, F = (e) => {
|
|
4550
|
+
let i = (n.defaultFontSize ?? 18) * J * s * e, o = [], c = 0, l = /* @__PURE__ */ new Map();
|
|
4541
4551
|
for (let u = 0; u < n.paragraphs.length; u++) {
|
|
4542
|
-
let d = n.paragraphs[u], f =
|
|
4552
|
+
let d = n.paragraphs[u], f = Y(d.marL, s), h = Y(d.marR, s), _ = Y(d.indent, s), v = d.defFontSize == null ? i : d.defFontSize * J * s * e, b = d.defColor ? X(d.defColor) : P, x = Nn(d), S = (() => {
|
|
4543
4553
|
for (let e of d.runs) if (e.type === "text" && e.fontSize != null) return e.fontSize;
|
|
4544
4554
|
return null;
|
|
4545
|
-
})(), T = S == null ? v : S *
|
|
4555
|
+
})(), T = S == null ? v : S * J * s * e, E = (() => {
|
|
4546
4556
|
for (let e of d.runs) if (e.type === "text" && e.color) return e.color;
|
|
4547
4557
|
return null;
|
|
4548
|
-
})(), D = E ?
|
|
4558
|
+
})(), D = E ? X(E) : b, A = (() => {
|
|
4549
4559
|
for (let e of d.runs) if (e.type === "text" && e.fontFamily) return e.fontFamily;
|
|
4550
4560
|
return d.defFontFamily ?? null;
|
|
4551
|
-
})(), F = "", I =
|
|
4552
|
-
F =
|
|
4553
|
-
let B =
|
|
4561
|
+
})(), F = "", I = Z(!1, !1, T, "sans-serif", m), L = D, R = null;
|
|
4562
|
+
F = xr(d, l);
|
|
4563
|
+
let B = He(d.bullet);
|
|
4554
4564
|
if (B.type === "char") {
|
|
4555
|
-
let
|
|
4556
|
-
I =
|
|
4565
|
+
let t = B;
|
|
4566
|
+
I = Z(!1, !1, t.sizePts == null ? t.sizePct == null ? T : T * (t.sizePct / 100) : t.sizePts * J * s * e, F === t.char ? Sn(t.fontFamily ?? null, m) : "sans-serif", m), L = t.color ? X(t.color) : D;
|
|
4557
4567
|
} else if (B.type === "autoNum") {
|
|
4558
|
-
let
|
|
4559
|
-
I =
|
|
4568
|
+
let t = B;
|
|
4569
|
+
I = Z(!1, !1, t.sizePts == null ? t.sizePct == null ? T : T * (t.sizePct / 100) : t.sizePts * J * s * e, Sn(t.fontFamily ?? A, m), m), L = B.color ? X(B.color) : D;
|
|
4560
4570
|
} else if (B.type === "blip") {
|
|
4561
|
-
let
|
|
4571
|
+
let t = B, n = t.sizePts == null ? t.sizePct == null ? T : T * (t.sizePct / 100) : t.sizePts * J * s * e;
|
|
4562
4572
|
R = {
|
|
4563
|
-
imagePath:
|
|
4564
|
-
mimeType:
|
|
4573
|
+
imagePath: t.imagePath,
|
|
4574
|
+
mimeType: t.mimeType,
|
|
4565
4575
|
sizePx: n
|
|
4566
4576
|
};
|
|
4567
4577
|
}
|
|
4568
|
-
let V = k > 1 ? (a - C - w - (k - 1) *
|
|
4569
|
-
for (let
|
|
4570
|
-
let r =
|
|
4578
|
+
let V = k > 1 ? (a - C - w - (k - 1) * j) / k : a - C - w, H = r + C + f, U = r + C + f + _, ee = V - f - h, W = Vn(t, d, O ? ee : Infinity, v, b, s, f, M, N, e, p, m, Pn(x, _)), te = d.spaceBefore == null ? 0 : d.spaceBefore / 100 * J * s * e, G = d.spaceAfter == null ? 0 : d.spaceAfter / 100 * J * s * e;
|
|
4579
|
+
for (let e = 0; e < W.length; e++) {
|
|
4580
|
+
let r = W[e], i = e === 0, a = e === W.length - 1, l = 0, f = 0;
|
|
4571
4581
|
for (let e of r.segments) {
|
|
4572
4582
|
let t = e.math ? Math.max(e.sizePx, (e.math.ascent + e.math.descent) / 1.2) : e.sizePx;
|
|
4573
4583
|
if (t > l && (l = t), !e.math) {
|
|
@@ -4576,14 +4586,14 @@ function gr(e, n, r, i, a, o, s, c = null, l = 0, u = !1, d = !1, f = "#000000",
|
|
|
4576
4586
|
}
|
|
4577
4587
|
}
|
|
4578
4588
|
if (l === 0 && (l = v), i && F) {
|
|
4579
|
-
|
|
4580
|
-
let
|
|
4589
|
+
t.font = I;
|
|
4590
|
+
let e = t.measureText("M"), n = e.actualBoundingBoxAscent + e.actualBoundingBoxDescent;
|
|
4581
4591
|
n > l && (l = n);
|
|
4582
4592
|
}
|
|
4583
4593
|
i && R && R.sizePx > l && (l = R.sizePx);
|
|
4584
4594
|
let p = l * 1.2, m = Math.max(p, f), h;
|
|
4585
|
-
h = d.spaceLine ? d.spaceLine.type === "pct" ? (g ? l : p) * (d.spaceLine.val / 1e5) : d.spaceLine.val *
|
|
4586
|
-
let b = h + (a ?
|
|
4595
|
+
h = d.spaceLine ? d.spaceLine.type === "pct" ? (g ? l : p) * (d.spaceLine.val / 1e5) : d.spaceLine.val * J * s : g ? y ? p : l : m, n.autoFit === "norm" && n.lnSpcReduction != null && d.spaceLine?.type !== "pts" && (h *= 1 - n.lnSpcReduction);
|
|
4596
|
+
let b = h + (a ? G : 0), S = i && u > 0 ? te : 0, C = i ? Pn(x, _) : 0, w = r.segments.some((e) => e.text && e.text.length > 0 || e.math != null), T = i && w ? R : null;
|
|
4587
4597
|
o.push({
|
|
4588
4598
|
line: r,
|
|
4589
4599
|
linePx: b,
|
|
@@ -4596,7 +4606,7 @@ function gr(e, n, r, i, a, o, s, c = null, l = 0, u = !1, d = !1, f = "#000000",
|
|
|
4596
4606
|
bulletX: U,
|
|
4597
4607
|
bulletImage: T,
|
|
4598
4608
|
textX: H,
|
|
4599
|
-
textMaxW:
|
|
4609
|
+
textMaxW: ee,
|
|
4600
4610
|
alignment: d.alignment,
|
|
4601
4611
|
isLastLine: a,
|
|
4602
4612
|
para: d
|
|
@@ -4607,125 +4617,125 @@ function gr(e, n, r, i, a, o, s, c = null, l = 0, u = !1, d = !1, f = "#000000",
|
|
|
4607
4617
|
allLines: o,
|
|
4608
4618
|
totalHeight: c
|
|
4609
4619
|
};
|
|
4610
|
-
}, { allLines:
|
|
4611
|
-
if (n.autoFit === "norm") if (n.fontScale != null && n.fontScale > 0) n.fontScale < 1 && ({allLines:
|
|
4620
|
+
}, { allLines: I, totalHeight: L } = F(1);
|
|
4621
|
+
if (n.autoFit === "norm") if (n.fontScale != null && n.fontScale > 0) n.fontScale < 1 && ({allLines: I, totalHeight: L} = F(n.fontScale));
|
|
4612
4622
|
else {
|
|
4613
4623
|
let e = o - T - E;
|
|
4614
|
-
if (
|
|
4624
|
+
if (L > e && e > 0) {
|
|
4615
4625
|
let t = .1, n = 1;
|
|
4616
4626
|
for (let r = 0; r < 6; r++) {
|
|
4617
4627
|
let r = (t + n) / 2;
|
|
4618
|
-
|
|
4628
|
+
F(r).totalHeight <= e ? t = r : n = r;
|
|
4619
4629
|
}
|
|
4620
|
-
({allLines:
|
|
4630
|
+
({allLines: I, totalHeight: L} = F(t));
|
|
4621
4631
|
}
|
|
4622
4632
|
}
|
|
4623
|
-
if (g) return T +
|
|
4624
|
-
let
|
|
4625
|
-
o === 0 &&
|
|
4626
|
-
let H, U = Math.max(0,
|
|
4627
|
-
H =
|
|
4628
|
-
let
|
|
4629
|
-
for (let c of
|
|
4633
|
+
if (g) return T + L + E;
|
|
4634
|
+
let R = n.verticalAnchor ?? "t", B = i, V;
|
|
4635
|
+
o === 0 && R === "b" ? (V = T + L + E, B = i - V) : V = n.autoFit === "sp" ? Math.max(o, T + L + E) : o;
|
|
4636
|
+
let H, U = Math.max(0, V - T - E);
|
|
4637
|
+
H = R === "ctr" ? B + T + (U - L) / 2 : R === "b" ? B + V - E - L : B + T, t.save(), t.textAlign = "left", t.textBaseline = "alphabetic";
|
|
4638
|
+
let ee = H, W = k > 1 ? (a - C - w - (k - 1) * j) / k + j : 0, te = Math.max(0, V - T - E), G = I[I.length - 1], K = G ? Math.max(0, G.linePx - G.lineHeight) : 0, q = L - K, ne = o === 0 || q <= te + .5, re = k > 1 && !ne ? Math.ceil(I.length / k) : I.length, ie = 0, ae = 0;
|
|
4639
|
+
for (let c of I) {
|
|
4630
4640
|
let { line: u, linePx: d, lineHeight: f, topGapPx: p, textXOffset: g, bulletLabel: y, bulletFont: b, bulletColor: x, bulletImage: S, alignment: C, isLastLine: w } = c;
|
|
4631
|
-
k > 1 &&
|
|
4632
|
-
let T = (n.rtlCol ? k - 1 -
|
|
4633
|
-
if (
|
|
4634
|
-
let
|
|
4635
|
-
|
|
4636
|
-
let a =
|
|
4637
|
-
if (
|
|
4641
|
+
k > 1 && ie < k - 1 && ae >= re && (ie++, ae = 0, H = ee), H += p, ae++;
|
|
4642
|
+
let T = (n.rtlCol ? k - 1 - ie : ie) * W, E = c.textX + T, D = c.bulletX + T, O = c.textMaxW, j = c.para.rtl === !0, M = j || Zt(u.segments), N = u.segments.some((e) => e.isTab);
|
|
4643
|
+
if (N) {
|
|
4644
|
+
let e = Y(c.para.marL, s), n = Y(c.para.marR, s), r = j ? n : e + g, i = O + e + n;
|
|
4645
|
+
t.font = u.segments.find((e) => e.isTab).font;
|
|
4646
|
+
let a = t.measureText(" ").width, o = un(u.segments.map((e) => {
|
|
4647
|
+
if (e.isTab) return {
|
|
4638
4648
|
isTab: !0,
|
|
4639
4649
|
width: 0
|
|
4640
4650
|
};
|
|
4641
|
-
if (
|
|
4651
|
+
if (e.math) return {
|
|
4642
4652
|
isTab: !1,
|
|
4643
|
-
width:
|
|
4653
|
+
width: e.math.width
|
|
4644
4654
|
};
|
|
4645
|
-
|
|
4646
|
-
let n =
|
|
4655
|
+
t.font = e.font;
|
|
4656
|
+
let n = e.letterSpacingPx ?? 0;
|
|
4647
4657
|
return {
|
|
4648
4658
|
isTab: !1,
|
|
4649
|
-
width:
|
|
4659
|
+
width: e.text ? (e.leadingLetterSpacingPx ?? 0) + Q(t, e.text, n) : 0
|
|
4650
4660
|
};
|
|
4651
4661
|
}), (c.para.tabStops ?? []).map((e) => ({
|
|
4652
|
-
pos:
|
|
4662
|
+
pos: Y(e.pos, s),
|
|
4653
4663
|
algn: e.algn
|
|
4654
|
-
})), r, i, a,
|
|
4664
|
+
})), r, i, a, Y(c.para.defTabSz ?? 914400, s));
|
|
4655
4665
|
for (let e = 0; e < u.segments.length; e++) u.segments[e].isTab && (u.segments[e].tabWidthPx = o[e]);
|
|
4656
4666
|
}
|
|
4657
|
-
let
|
|
4658
|
-
for (let
|
|
4659
|
-
if (
|
|
4660
|
-
|
|
4667
|
+
let P = 0, F = f * .8;
|
|
4668
|
+
for (let e of u.segments) {
|
|
4669
|
+
if (e.isTab) {
|
|
4670
|
+
P += e.tabWidthPx ?? 0;
|
|
4661
4671
|
continue;
|
|
4662
4672
|
}
|
|
4663
|
-
if (
|
|
4664
|
-
|
|
4673
|
+
if (e.math) {
|
|
4674
|
+
P += e.math.width, F = Math.max(F, e.math.ascent);
|
|
4665
4675
|
continue;
|
|
4666
4676
|
}
|
|
4667
|
-
|
|
4668
|
-
let n =
|
|
4669
|
-
|
|
4677
|
+
t.font = e.font;
|
|
4678
|
+
let n = t.measureText(e.text || "M"), r = e.letterSpacingPx ?? 0;
|
|
4679
|
+
P += e.leadingLetterSpacingPx ?? 0, P += e.text ? Q(t, e.text, r) : 0, n.actualBoundingBoxAscent > 0 && (F = Math.max(F, n.actualBoundingBoxAscent));
|
|
4670
4680
|
}
|
|
4671
|
-
let
|
|
4672
|
-
if (
|
|
4673
|
-
if (y)
|
|
4674
|
-
else if (S && _ && (
|
|
4681
|
+
let I = H + F, L = E + O, R = 0, z = null;
|
|
4682
|
+
if (M && j) {
|
|
4683
|
+
if (y) t.font = b, R = t.measureText(y).width;
|
|
4684
|
+
else if (S && _ && (z = A(S.imagePath, _), z)) {
|
|
4675
4685
|
let e = S.sizePx;
|
|
4676
|
-
|
|
4686
|
+
R = z.height > 0 ? e * (z.width / z.height) : e;
|
|
4677
4687
|
}
|
|
4678
4688
|
}
|
|
4679
|
-
if (y) if (
|
|
4680
|
-
let
|
|
4681
|
-
|
|
4682
|
-
} else
|
|
4689
|
+
if (y) if (t.font = b, t.fillStyle = x, M && j) {
|
|
4690
|
+
let e = t.direction;
|
|
4691
|
+
t.direction = "rtl", t.fillText(y, L - R, I), t.direction = e;
|
|
4692
|
+
} else t.fillText(y, D, I);
|
|
4683
4693
|
if (S && _) {
|
|
4684
|
-
let
|
|
4685
|
-
if (
|
|
4686
|
-
let
|
|
4687
|
-
|
|
4694
|
+
let e = A(S.imagePath, _);
|
|
4695
|
+
if (e) {
|
|
4696
|
+
let n = S.sizePx, r = e.height > 0 ? n * (e.width / e.height) : n, i = I - n;
|
|
4697
|
+
M && j ? t.drawImage(e, L - r, i, r, n) : t.drawImage(e, D, i, r, n);
|
|
4688
4698
|
}
|
|
4689
4699
|
}
|
|
4690
|
-
let
|
|
4691
|
-
|
|
4692
|
-
let U = C === "just" || C === "justLow" ? "just" : C === "thaiDist" ? "thaiDist" : C === "dist" ? "dist" : null,
|
|
4700
|
+
let B = E + g, V;
|
|
4701
|
+
V = N ? j ? E + O - R - P : B : C === "ctr" ? B + (O - g - P) / 2 : C === "r" ? E + O - R - P : B;
|
|
4702
|
+
let U = C === "just" || C === "justLow" ? "just" : C === "thaiDist" ? "thaiDist" : C === "dist" ? "dist" : null, te = w || (u.endsWithBreak ?? !1), G = (U && !M && !N ? tn(u.segments, O - g, P, U, te) : null) ?? u.segments, K = M ? Qt(u.segments, j) : null, q = (e, t) => {
|
|
4693
4703
|
if (Math.abs(e - t) !== 1) return 0;
|
|
4694
4704
|
let n = u.segments[Math.min(e, t)], r = u.segments[Math.max(e, t)];
|
|
4695
4705
|
return n.isTab || n.math || r.isTab || r.math || n.sourceRunId == null || n.sourceRunId !== r.sourceRunId ? 0 : r.leadingLetterSpacingPx ?? 0;
|
|
4696
|
-
},
|
|
4697
|
-
for (let
|
|
4698
|
-
let
|
|
4699
|
-
if (
|
|
4700
|
-
let e =
|
|
4701
|
-
|
|
4706
|
+
}, ne = G.length;
|
|
4707
|
+
for (let n = 0; n < ne; n++) {
|
|
4708
|
+
let c = K ? K.order[n] : n, u = G[c], d = K ? K.rtl[c] : !1;
|
|
4709
|
+
if (M && (t.direction = d ? "rtl" : "ltr"), n > 0) {
|
|
4710
|
+
let e = K ? K.order[n - 1] : n - 1;
|
|
4711
|
+
V += q(e, c);
|
|
4702
4712
|
}
|
|
4703
|
-
if (
|
|
4704
|
-
|
|
4713
|
+
if (u.isTab) {
|
|
4714
|
+
V += u.tabWidthPx ?? 0;
|
|
4705
4715
|
continue;
|
|
4706
4716
|
}
|
|
4707
|
-
let
|
|
4708
|
-
if (
|
|
4709
|
-
let
|
|
4710
|
-
if (
|
|
4711
|
-
let i =
|
|
4712
|
-
|
|
4717
|
+
let p = u.jext ?? 0, g = u.splitBefore, _ = u.perGap ?? 0, y = g && g.length > 0 ? g.length * _ : 0;
|
|
4718
|
+
if (u.math) {
|
|
4719
|
+
let e = vn.get(u.math.nodes), n = u.math.width, r = u.math.ascent + u.math.descent;
|
|
4720
|
+
if (e && n > 0 && r > 0) {
|
|
4721
|
+
let i = I - u.math.ascent, a = yn(e, u.color);
|
|
4722
|
+
t.drawImage(a, V, i, n, r);
|
|
4713
4723
|
}
|
|
4714
|
-
|
|
4724
|
+
V += n, V += p;
|
|
4715
4725
|
continue;
|
|
4716
4726
|
}
|
|
4717
|
-
|
|
4718
|
-
let
|
|
4719
|
-
if (
|
|
4720
|
-
let
|
|
4721
|
-
|
|
4727
|
+
t.font = u.font, t.fillStyle = u.color;
|
|
4728
|
+
let b = u.drawSizePx ?? u.sizePx, x = I + (u.baseline ? -(u.baseline / 1e5) * u.sizePx : 0), S = u.letterSpacingPx ?? 0;
|
|
4729
|
+
if (u.highlight && u.text) {
|
|
4730
|
+
let e = Q(t, u.text, S) + y + p;
|
|
4731
|
+
gn(t, V, x, e, b, u.highlight, u.color);
|
|
4722
4732
|
}
|
|
4723
|
-
let
|
|
4733
|
+
let C = u.shadow, w = (e, t, n, r) => {
|
|
4724
4734
|
let i = r === "fill" ? e.fillText.bind(e) : e.strokeText.bind(e);
|
|
4725
|
-
if (
|
|
4735
|
+
if (S !== 0 && Rn(t) > 1) {
|
|
4726
4736
|
let r = e, a = r.letterSpacing;
|
|
4727
|
-
if (
|
|
4728
|
-
r.letterSpacing = `${
|
|
4737
|
+
if (Bn(e)) {
|
|
4738
|
+
r.letterSpacing = `${S}px`, i(t, n, x);
|
|
4729
4739
|
try {
|
|
4730
4740
|
r.letterSpacing = a;
|
|
4731
4741
|
} catch {}
|
|
@@ -4733,92 +4743,92 @@ function gr(e, n, r, i, a, o, s, c = null, l = 0, u = !1, d = !1, f = "#000000",
|
|
|
4733
4743
|
let r = n, a = [...t];
|
|
4734
4744
|
for (let t = 0; t < a.length; t++) {
|
|
4735
4745
|
let n = a[t];
|
|
4736
|
-
i(n, r,
|
|
4746
|
+
i(n, r, x), t < a.length - 1 && (r += e.measureText(n).width + S);
|
|
4737
4747
|
}
|
|
4738
4748
|
}
|
|
4739
|
-
} else i(t, n,
|
|
4740
|
-
},
|
|
4749
|
+
} else i(t, n, x);
|
|
4750
|
+
}, T = (e) => Q(t, e, S), E = g && g.length > 0 ? Ut([...u.text], g, _, T) : null, D = [...u.text], O = !!g && g.length === D.length - 1 && D.length > 1, k = (e, t) => {
|
|
4741
4751
|
if (v) {
|
|
4742
|
-
let n =
|
|
4743
|
-
|
|
4752
|
+
let n = O ? S + _ : S;
|
|
4753
|
+
hn(e, u.text, V, x, b, n, t);
|
|
4744
4754
|
return;
|
|
4745
4755
|
}
|
|
4746
|
-
if (
|
|
4747
|
-
let n = t === "fill" ? e.fillText.bind(e) : e.strokeText.bind(e), r =
|
|
4748
|
-
if (
|
|
4756
|
+
if (O) {
|
|
4757
|
+
let n = t === "fill" ? e.fillText.bind(e) : e.strokeText.bind(e), r = S + _;
|
|
4758
|
+
if (Bn(e)) {
|
|
4749
4759
|
let t = e, i = t.letterSpacing;
|
|
4750
|
-
t.letterSpacing = `${r}px`, n(
|
|
4760
|
+
t.letterSpacing = `${r}px`, n(u.text, V, x);
|
|
4751
4761
|
try {
|
|
4752
4762
|
t.letterSpacing = i;
|
|
4753
4763
|
} catch {}
|
|
4754
4764
|
} else {
|
|
4755
|
-
let t =
|
|
4756
|
-
for (let i = 0; i <
|
|
4757
|
-
let a =
|
|
4758
|
-
n(a, t,
|
|
4765
|
+
let t = V;
|
|
4766
|
+
for (let i = 0; i < D.length; i++) {
|
|
4767
|
+
let a = D[i];
|
|
4768
|
+
n(a, t, x), i < D.length - 1 && (t += e.measureText(a).width + r);
|
|
4759
4769
|
}
|
|
4760
4770
|
}
|
|
4761
|
-
} else if (
|
|
4762
|
-
else
|
|
4763
|
-
},
|
|
4764
|
-
if (
|
|
4765
|
-
let
|
|
4766
|
-
if (
|
|
4767
|
-
|
|
4768
|
-
let r =
|
|
4769
|
-
|
|
4770
|
-
e.font =
|
|
4771
|
+
} else if (E) for (let { text: n, dx: r } of E) w(e, n, V + r, t);
|
|
4772
|
+
else w(e, u.text, V, t);
|
|
4773
|
+
}, A = u.reflection;
|
|
4774
|
+
if (A && u.text) {
|
|
4775
|
+
let e = t.canvas.width || 0, n = t.canvas.height || 0;
|
|
4776
|
+
if (e > 0 && n > 0) {
|
|
4777
|
+
t.font = u.font;
|
|
4778
|
+
let r = t.measureText(u.text), i = Number.isFinite(r.actualBoundingBoxAscent) ? r.actualBoundingBoxAscent : b * .8, a = Number.isFinite(r.actualBoundingBoxDescent) ? r.actualBoundingBoxDescent : b * .2, o = Number.isFinite(r.actualBoundingBoxLeft) ? r.actualBoundingBoxLeft : 0, c = Number.isFinite(r.actualBoundingBoxRight) ? r.actualBoundingBoxRight : r.width, l = t.getTransform(), d = Math.abs(l.a * l.d - l.b * l.c), f = d > 0 ? Math.sqrt(d) : 1;
|
|
4779
|
+
Mn(t, (e) => {
|
|
4780
|
+
e.font = u.font, e.fillStyle = u.color, k(e, "fill");
|
|
4771
4781
|
}, {
|
|
4772
|
-
x: (
|
|
4773
|
-
y: (
|
|
4774
|
-
w: Math.max(1, o +
|
|
4782
|
+
x: (V - o) * f,
|
|
4783
|
+
y: (x - i) * f,
|
|
4784
|
+
w: Math.max(1, o + c) * f,
|
|
4775
4785
|
h: Math.max(1, i + a) * f
|
|
4776
|
-
},
|
|
4786
|
+
}, A, s * f, l, e, n), t.font = u.font, t.fillStyle = u.color;
|
|
4777
4787
|
}
|
|
4778
4788
|
}
|
|
4779
|
-
if (
|
|
4780
|
-
let
|
|
4781
|
-
|
|
4789
|
+
if (C) {
|
|
4790
|
+
let e = C.dir * Math.PI / 180, n = Y(C.dist, s);
|
|
4791
|
+
t.save(), t.shadowColor = X(C.color, C.alpha), t.shadowBlur = Y(C.blur, s), t.shadowOffsetX = Math.cos(e) * n, t.shadowOffsetY = Math.sin(e) * n;
|
|
4782
4792
|
}
|
|
4783
|
-
|
|
4784
|
-
let
|
|
4785
|
-
|
|
4786
|
-
let
|
|
4787
|
-
if (h &&
|
|
4788
|
-
text:
|
|
4789
|
-
inShapeX:
|
|
4793
|
+
k(t, "fill"), C && t.restore();
|
|
4794
|
+
let j = u.outline;
|
|
4795
|
+
j && j.width > 0 && (t.save(), t.lineWidth = Math.max(.5, Y(j.width, s)), t.strokeStyle = j.color ? `#${j.color}` : u.color, t.lineJoin = "round", k(t, "stroke"), t.restore()), t.font = u.font;
|
|
4796
|
+
let N = Q(t, u.text, S) + y;
|
|
4797
|
+
if (h && u.text && h({
|
|
4798
|
+
text: u.text,
|
|
4799
|
+
inShapeX: V - r,
|
|
4790
4800
|
inShapeY: H - i,
|
|
4791
|
-
w:
|
|
4801
|
+
w: N + p,
|
|
4792
4802
|
h: f,
|
|
4793
|
-
fontSize:
|
|
4794
|
-
font:
|
|
4803
|
+
fontSize: b,
|
|
4804
|
+
font: u.font,
|
|
4795
4805
|
shapeX: r,
|
|
4796
4806
|
shapeY: i,
|
|
4797
4807
|
shapeW: a,
|
|
4798
4808
|
shapeH: o,
|
|
4799
4809
|
rotation: l,
|
|
4800
|
-
hyperlink:
|
|
4801
|
-
}),
|
|
4802
|
-
let
|
|
4803
|
-
|
|
4804
|
-
let
|
|
4805
|
-
if (
|
|
4806
|
-
let
|
|
4807
|
-
|
|
4810
|
+
hyperlink: u.hyperlink
|
|
4811
|
+
}), u.underline && Vt(t, V, x, N + p, b, u.underlineColor ?? u.color, u.underlineStyle, m.dpr), u.strikethrough) {
|
|
4812
|
+
let n = Math.max(1, b * .05);
|
|
4813
|
+
t.strokeStyle = u.color, t.lineWidth = n, t.setLineDash([]);
|
|
4814
|
+
let r = x - b * .32;
|
|
4815
|
+
if (u.strikeDouble) {
|
|
4816
|
+
let i = n * .9, a = r - i, o = r + i;
|
|
4817
|
+
t.beginPath(), t.moveTo(V, a + e(a, n, m.dpr)), t.lineTo(V + N + p, a + e(a, n, m.dpr)), t.moveTo(V, o + e(o, n, m.dpr)), t.lineTo(V + N + p, o + e(o, n, m.dpr)), t.stroke();
|
|
4808
4818
|
} else {
|
|
4809
|
-
let
|
|
4810
|
-
|
|
4819
|
+
let i = r + e(r, n, m.dpr);
|
|
4820
|
+
t.beginPath(), t.moveTo(V, i), t.lineTo(V + N + p, i), t.stroke();
|
|
4811
4821
|
}
|
|
4812
4822
|
}
|
|
4813
|
-
|
|
4823
|
+
V += N, V += p;
|
|
4814
4824
|
}
|
|
4815
|
-
|
|
4825
|
+
M && (t.direction = "ltr"), H += d;
|
|
4816
4826
|
}
|
|
4817
|
-
|
|
4827
|
+
t.restore();
|
|
4818
4828
|
}
|
|
4819
|
-
function
|
|
4829
|
+
function Cr(e, t, n, r, i) {
|
|
4820
4830
|
if (!e) return [];
|
|
4821
|
-
let a =
|
|
4831
|
+
let a = kt(t?.rig ?? "threePt", t?.dir ?? "t", t?.rot), o = Ft(n), s = r * i, c = [];
|
|
4822
4832
|
return e.bevelT && e.bevelT.w > 0 && e.bevelT.h > 0 && c.push({
|
|
4823
4833
|
widthPx: e.bevelT.w * s,
|
|
4824
4834
|
heightPx: e.bevelT.h * s,
|
|
@@ -4834,9 +4844,9 @@ function _r(e, t, n, r, i) {
|
|
|
4834
4844
|
bottom: !0
|
|
4835
4845
|
}), c;
|
|
4836
4846
|
}
|
|
4837
|
-
function
|
|
4847
|
+
function wr(e, t, n, r, i, a) {
|
|
4838
4848
|
if (!e || !e.extrusionH || e.extrusionH <= 0) return null;
|
|
4839
|
-
let o = e.extrusionH * i * a, s =
|
|
4849
|
+
let o = e.extrusionH * i * a, s = mt(t, n * a, r * a, o);
|
|
4840
4850
|
if (Math.hypot(s.x, s.y) < .75) return null;
|
|
4841
4851
|
let c = [
|
|
4842
4852
|
64,
|
|
@@ -4857,14 +4867,14 @@ function vr(e, t, n, r, i, a) {
|
|
|
4857
4867
|
rgb: c
|
|
4858
4868
|
};
|
|
4859
4869
|
}
|
|
4860
|
-
function
|
|
4870
|
+
function Tr(e, t, n, r, i, a, o, s = {}) {
|
|
4861
4871
|
if (i <= 0 || a <= 0) return !1;
|
|
4862
|
-
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 =
|
|
4872
|
+
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 = ft(t, i, a), p = f.corners;
|
|
4863
4873
|
if (d > 0) {
|
|
4864
|
-
let e = d / u, t =
|
|
4874
|
+
let e = d / u, t = Le(f.corners, e / i, e / a);
|
|
4865
4875
|
t ? p = t : d = 0;
|
|
4866
4876
|
}
|
|
4867
|
-
let m = d / u, h = Math.max(1, Math.ceil(i * u) + 2 * d), g = Math.max(1, Math.ceil(a * u) + 2 * d), _ =
|
|
4877
|
+
let m = d / u, h = Math.max(1, Math.ceil(i * u) + 2 * d), g = Math.max(1, Math.ceil(a * u) + 2 * d), _ = De(h, g);
|
|
4868
4878
|
if (!_) return !1;
|
|
4869
4879
|
let v = _.getContext("2d");
|
|
4870
4880
|
if (!v) return !1;
|
|
@@ -4877,17 +4887,17 @@ function yr(e, t, n, r, i, a, o, s = {}) {
|
|
|
4877
4887
|
});
|
|
4878
4888
|
if (s.extrusion) {
|
|
4879
4889
|
let e = Math.ceil(Math.hypot(s.extrusion.offsetX, s.extrusion.offsetY)) + 2;
|
|
4880
|
-
|
|
4890
|
+
Bt(v, s.extrusion, x(e));
|
|
4881
4891
|
}
|
|
4882
|
-
if (s.bevels && s.bevels.length > 0) for (let e of s.bevels)
|
|
4883
|
-
return s.paintEdges && (v.save(), v.scale(u, u), v.translate(m, m), s.paintEdges(v, 0, 0, i, a), v.restore()),
|
|
4892
|
+
if (s.bevels && s.bevels.length > 0) for (let e of s.bevels) zt(v, e, x(Math.ceil(e.widthPx) + 2));
|
|
4893
|
+
return s.paintEdges && (v.save(), v.scale(u, u), v.translate(m, m), s.paintEdges(v, 0, 0, i, a), v.restore()), Ae(_, e, h, g, p.map((e) => ({
|
|
4884
4894
|
x: n + e.x,
|
|
4885
4895
|
y: r + e.y
|
|
4886
4896
|
}))), !0;
|
|
4887
4897
|
}
|
|
4888
|
-
function
|
|
4898
|
+
function Er(e, t, n, r, i, a, o, s, c = 0) {
|
|
4889
4899
|
if (r <= 0 || i <= 0 || a.length === 0) return !1;
|
|
4890
|
-
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 =
|
|
4900
|
+
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 = De(m, h);
|
|
4891
4901
|
if (!g) return !1;
|
|
4892
4902
|
let _ = g.getContext("2d");
|
|
4893
4903
|
if (!_) return !1;
|
|
@@ -4895,7 +4905,7 @@ function br(e, t, n, r, i, a, o, s, c = 0) {
|
|
|
4895
4905
|
let v = Math.ceil(r * d), y = Math.ceil(i * d);
|
|
4896
4906
|
for (let e of a) {
|
|
4897
4907
|
let t = Math.ceil(e.widthPx) + 2;
|
|
4898
|
-
|
|
4908
|
+
zt(_, e, {
|
|
4899
4909
|
x: f - t,
|
|
4900
4910
|
y: f - t,
|
|
4901
4911
|
w: v + 2 * t,
|
|
@@ -4904,19 +4914,19 @@ function br(e, t, n, r, i, a, o, s, c = 0) {
|
|
|
4904
4914
|
}
|
|
4905
4915
|
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;
|
|
4906
4916
|
}
|
|
4907
|
-
var
|
|
4908
|
-
function
|
|
4909
|
-
let t =
|
|
4917
|
+
var Dr = /* @__PURE__ */ new WeakMap();
|
|
4918
|
+
function Or(e) {
|
|
4919
|
+
let t = Dr.get(e);
|
|
4910
4920
|
return t || (t = async (t, n) => {
|
|
4911
4921
|
let r = await e(t);
|
|
4912
4922
|
return r.type === n ? r : new Blob([r], { type: n });
|
|
4913
|
-
},
|
|
4923
|
+
}, Dr.set(e, t)), t;
|
|
4914
4924
|
}
|
|
4915
|
-
function
|
|
4916
|
-
return
|
|
4925
|
+
function kr(e, t, n = Or(t)) {
|
|
4926
|
+
return R("base", e.posterPath, n, async () => {
|
|
4917
4927
|
let n = await t(e.posterPath), r = e.posterMimeType || n.type || "application/octet-stream";
|
|
4918
4928
|
return {
|
|
4919
|
-
bitmap: await
|
|
4929
|
+
bitmap: await xe(n.type === r ? n : new Blob([n], { type: r })),
|
|
4920
4930
|
owned: !0
|
|
4921
4931
|
};
|
|
4922
4932
|
}).then((e) => {
|
|
@@ -4924,99 +4934,99 @@ function Cr(e, t, n = Sr(t)) {
|
|
|
4924
4934
|
return e;
|
|
4925
4935
|
});
|
|
4926
4936
|
}
|
|
4927
|
-
async function
|
|
4937
|
+
async function Ar(e, t, n, r, i) {
|
|
4928
4938
|
if (i) try {
|
|
4929
|
-
let a = t.mimeType === "image/svg+xml",
|
|
4930
|
-
if (!
|
|
4931
|
-
let { widthPt:
|
|
4932
|
-
if (
|
|
4933
|
-
|
|
4939
|
+
let a = t.mimeType === "image/svg+xml", o = Ce(t.mimeType, t.srcRect, t.width / J, t.height / J);
|
|
4940
|
+
if (!o) return;
|
|
4941
|
+
let { widthPt: s, heightPt: c } = o, l;
|
|
4942
|
+
if (x(t)) try {
|
|
4943
|
+
l = await q(t.svgImagePath, i);
|
|
4934
4944
|
} catch {
|
|
4935
|
-
|
|
4936
|
-
widthPt:
|
|
4937
|
-
heightPt:
|
|
4945
|
+
l = a ? await q(t.imagePath, i) : await ze(t.imagePath, t.mimeType, t.duotone, i, {
|
|
4946
|
+
widthPt: s,
|
|
4947
|
+
heightPt: c
|
|
4938
4948
|
});
|
|
4939
4949
|
}
|
|
4940
|
-
else
|
|
4941
|
-
widthPt:
|
|
4942
|
-
heightPt:
|
|
4950
|
+
else l = a ? await q(t.imagePath, i) : await ze(t.imagePath, t.mimeType, t.duotone, i, {
|
|
4951
|
+
widthPt: s,
|
|
4952
|
+
heightPt: c
|
|
4943
4953
|
});
|
|
4944
|
-
if (!
|
|
4954
|
+
if (!l || r()) return;
|
|
4945
4955
|
e.save(), t.alpha != null && (e.globalAlpha *= t.alpha);
|
|
4946
|
-
let
|
|
4947
|
-
(t.rotation !== 0 || t.flipH || t.flipV) && (e.translate(
|
|
4948
|
-
let
|
|
4949
|
-
t.custGeom && t.custGeom.length > 0 ?
|
|
4950
|
-
},
|
|
4951
|
-
e.beginPath(),
|
|
4952
|
-
},
|
|
4953
|
-
(t.prstGeom || t.custGeom && t.custGeom.length > 0) && (
|
|
4954
|
-
},
|
|
4955
|
-
t.stroke && (e.save(),
|
|
4956
|
+
let u = Y(t.x, n), d = Y(t.y, n), f = Y(t.width, n), p = Y(t.height, n);
|
|
4957
|
+
(t.rotation !== 0 || t.flipH || t.flipV) && (e.translate(u + f / 2, d + p / 2), e.rotate(t.rotation * Math.PI / 180), t.flipH && e.scale(-1, 1), t.flipV && e.scale(1, -1), e.translate(-(u + f / 2), -(d + p / 2)));
|
|
4958
|
+
let m = (e, n, r, i, a) => {
|
|
4959
|
+
t.custGeom && t.custGeom.length > 0 ? _r(e, t.custGeom, n, r, i, a) : t.prstGeom && ne(e, t.prstGeom, n, r, i, a, t.prstAdjust ?? []) || e.rect(n, r, i, a);
|
|
4960
|
+
}, h = (e, t, n, r, i) => {
|
|
4961
|
+
e.beginPath(), m(e, t, n, r, i);
|
|
4962
|
+
}, g = (e, n, r, i, a) => {
|
|
4963
|
+
(t.prstGeom || t.custGeom && t.custGeom.length > 0) && (h(e, n, r, i, a), e.clip());
|
|
4964
|
+
}, _ = (e, r, i, a, o) => {
|
|
4965
|
+
t.stroke && (e.save(), Nr(e, t.stroke, n, {
|
|
4956
4966
|
x: r,
|
|
4957
4967
|
y: i,
|
|
4958
4968
|
w: a,
|
|
4959
4969
|
h: o
|
|
4960
|
-
}, t.rotation),
|
|
4961
|
-
},
|
|
4970
|
+
}, t.rotation), h(e, r, i, a, o), e.stroke(), e.restore());
|
|
4971
|
+
}, y = (e, r, i, a, o) => {
|
|
4962
4972
|
let s = t.sp3d;
|
|
4963
4973
|
if (s && (s.contourW ?? 0) > 0 && s.contourClr) {
|
|
4964
4974
|
let t = Math.max(.5, s.contourW * n);
|
|
4965
4975
|
e.save(), e.beginPath();
|
|
4966
4976
|
let c = t * 2 + Math.max(a, o);
|
|
4967
|
-
e.rect(r - c, i - c, a + 2 * c, o + 2 * c),
|
|
4977
|
+
e.rect(r - c, i - c, a + 2 * c, o + 2 * c), m(e, r, i, a, o), e.clip("evenodd"), e.beginPath(), h(e, r, i, a, o), e.strokeStyle = X(s.contourClr), e.lineWidth = t * 2, e.setLineDash([]), e.stroke(), e.restore();
|
|
4968
4978
|
}
|
|
4969
|
-
},
|
|
4970
|
-
e.save(),
|
|
4979
|
+
}, b = t.scene3d && pt(t.scene3d.camera) ? t.scene3d : null, S = (e, n, r, i, a) => {
|
|
4980
|
+
e.save(), g(e, n, r, i, a), Ee(e, l, t.srcRect, n, r, i, a), e.restore();
|
|
4981
|
+
}, C = (e, t, n, r, i) => {
|
|
4982
|
+
S(e, t, n, r, i), _(e, t, n, r, i), y(e, t, n, r, i);
|
|
4971
4983
|
}, w = (e, t, n, r, i) => {
|
|
4972
|
-
|
|
4973
|
-
}, T = (
|
|
4974
|
-
|
|
4975
|
-
|
|
4976
|
-
|
|
4977
|
-
|
|
4978
|
-
|
|
4979
|
-
|
|
4980
|
-
paintEdges: x,
|
|
4981
|
-
edgePadCss: P
|
|
4984
|
+
S(e, t, n, r, i), _(e, t, n, r, i);
|
|
4985
|
+
}, T = e.getTransform(), E = Math.abs(T.a * T.d - T.b * T.c), D = E > 0 ? Math.sqrt(E) : 1, O = Cr(t.sp3d, t.scene3d?.lightRig, t.sp3d ? t.sp3d.prstMaterial : void 0, n, D), k = b ? wr(t.sp3d, b.camera, f, p, n, D) : null, A = t.stroke ? t.stroke.width * n / 2 : 0, j = t.sp3d?.contourW ? t.sp3d.contourW * n : 0, M = k ? Math.hypot(k.offsetX, k.offsetY) / D : 0, N = A + j + M + 2, P = (e) => {
|
|
4986
|
+
if (b) {
|
|
4987
|
+
if (Tr(e, b.camera, u, d, f, p, w, {
|
|
4988
|
+
bevels: O,
|
|
4989
|
+
extrusion: k ?? void 0,
|
|
4990
|
+
paintEdges: y,
|
|
4991
|
+
edgePadCss: N
|
|
4982
4992
|
})) return;
|
|
4983
|
-
} else if (
|
|
4984
|
-
|
|
4985
|
-
},
|
|
4986
|
-
e.save(),
|
|
4987
|
-
},
|
|
4988
|
-
|
|
4989
|
-
},
|
|
4990
|
-
x:
|
|
4991
|
-
y:
|
|
4992
|
-
w:
|
|
4993
|
-
h:
|
|
4994
|
-
},
|
|
4995
|
-
bbox:
|
|
4996
|
-
anchor:
|
|
4997
|
-
},
|
|
4998
|
-
|
|
4993
|
+
} else if (O.length > 0 && Er(e, u, d, f, p, O, w, y, N)) return;
|
|
4994
|
+
C(e, u, d, f, p);
|
|
4995
|
+
}, F = (e, t, n, r, i, a) => {
|
|
4996
|
+
e.save(), g(e, n, r, i, a), e.fillStyle = t, e.fillRect(n, r, i, a), e.restore();
|
|
4997
|
+
}, I = (e, t) => {
|
|
4998
|
+
b && Tr(e, b.camera, u, d, f, p, (e, n, r, i, a) => F(e, t, n, r, i, a)) || F(e, t, u, d, f, p);
|
|
4999
|
+
}, L = e.getTransform(), R = Math.abs(L.a * L.d - L.b * L.c), z = R > 0 ? Math.sqrt(R) : 1, B = A + j, V = (t.custGeom && t.custGeom.length > 0 ? fe(t.custGeom, u, d, f, p) : t.prstGeom && v(t.prstGeom.toLowerCase()) ? ae(t.prstGeom.toLowerCase(), u, d, f, p, t.prstAdjust ?? []) : null) ?? {
|
|
5000
|
+
x: u,
|
|
5001
|
+
y: d,
|
|
5002
|
+
w: f,
|
|
5003
|
+
h: p
|
|
5004
|
+
}, H = b ? pr(b.camera, L, u, d, f, p, N, t.shadow?.algn) : {
|
|
5005
|
+
bbox: lr(L, V.x - B, V.y - B, V.w + B * 2, V.h + B * 2),
|
|
5006
|
+
anchor: fr(L, u, d, f, p, t.shadow?.algn)
|
|
5007
|
+
}, U = n * z, ee = !!(t.shadow || t.innerShadow || t.glow || t.softEdge || t.reflection), W = (e) => I(e, "#000");
|
|
5008
|
+
hr(e, t, b && ee ? mr(P, L, H.bbox, {
|
|
4999
5009
|
w: e.canvas.width || 0,
|
|
5000
5010
|
h: e.canvas.height || 0
|
|
5001
|
-
}) :
|
|
5011
|
+
}) : P, b && ee ? mr(W, L, H.bbox, {
|
|
5002
5012
|
w: e.canvas.width || 0,
|
|
5003
5013
|
h: e.canvas.height || 0
|
|
5004
|
-
}) :
|
|
5014
|
+
}) : W, H.bbox, H.anchor, n, U, L), e.restore();
|
|
5005
5015
|
} catch (e) {
|
|
5006
|
-
if (
|
|
5016
|
+
if (Te(e)) throw e;
|
|
5007
5017
|
}
|
|
5008
5018
|
}
|
|
5009
|
-
async function
|
|
5010
|
-
let s =
|
|
5019
|
+
async function jr(e, t, n, r, i, a, o) {
|
|
5020
|
+
let s = Y(t.x, n), c = Y(t.y, n), l = Y(t.width, n), u = Y(t.height, n), d;
|
|
5011
5021
|
if (t.posterPath && i) try {
|
|
5012
|
-
d = await
|
|
5022
|
+
d = await kr(t, i, o);
|
|
5013
5023
|
} catch (e) {
|
|
5014
|
-
if (
|
|
5024
|
+
if (Te(e)) throw e;
|
|
5015
5025
|
}
|
|
5016
|
-
r() || (e.save(),
|
|
5026
|
+
r() || (e.save(), Pr(e, t, n), d ? e.drawImage(d, s, c, l, u) : (e.fillStyle = t.mediaKind === "video" ? "#111" : "#f0f0f0", e.fillRect(s, c, l, u)), a || Jt(e, s + l / 2, c + u / 2, l, u, "paused"), e.restore());
|
|
5017
5027
|
}
|
|
5018
|
-
function
|
|
5019
|
-
let s = Math.max(.5,
|
|
5028
|
+
function Mr(e, t, n, r, i, a, o) {
|
|
5029
|
+
let s = Math.max(.5, Y(r.width, a)), c = n.x - t.x, l = n.y - t.y, u = Math.hypot(c, l);
|
|
5020
5030
|
if (u === 0) return;
|
|
5021
5031
|
let d = -l / u, f = c / u, p;
|
|
5022
5032
|
switch (i) {
|
|
@@ -5065,170 +5075,170 @@ function Er(e, t, n, r, i, a, o) {
|
|
|
5065
5075
|
break;
|
|
5066
5076
|
default: return;
|
|
5067
5077
|
}
|
|
5068
|
-
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 ?
|
|
5078
|
+
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 ? _n(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) ?? X(r.color);
|
|
5069
5079
|
for (let r of p) {
|
|
5070
5080
|
let i = d * (s * r.offset), a = f * (s * r.offset);
|
|
5071
5081
|
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();
|
|
5072
5082
|
}
|
|
5073
5083
|
e.restore();
|
|
5074
5084
|
}
|
|
5075
|
-
function
|
|
5076
|
-
if (
|
|
5077
|
-
let n =
|
|
5085
|
+
function Nr(e, t, n, r, i = 0) {
|
|
5086
|
+
if (Se(e, t, n), t?.fill && r) {
|
|
5087
|
+
let n = _n(t.fill, e, r.x, r.y, r.w, r.h, i);
|
|
5078
5088
|
n && (e.strokeStyle = n);
|
|
5079
5089
|
}
|
|
5080
5090
|
}
|
|
5081
|
-
function
|
|
5091
|
+
function Pr(e, t, n) {
|
|
5082
5092
|
if (t.rotation === 0 && !t.flipH && !t.flipV) return;
|
|
5083
|
-
let r =
|
|
5093
|
+
let r = Y(t.x, n), i = Y(t.y, n), a = Y(t.width, n), o = Y(t.height, n);
|
|
5084
5094
|
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));
|
|
5085
5095
|
}
|
|
5086
|
-
function
|
|
5096
|
+
function Fr(t, n, r, i, a = {
|
|
5087
5097
|
themeMajorFont: null,
|
|
5088
5098
|
themeMinorFont: null,
|
|
5089
5099
|
dpr: 1
|
|
5090
5100
|
}) {
|
|
5091
|
-
|
|
5092
|
-
let
|
|
5101
|
+
t.save(), Pr(t, n, r);
|
|
5102
|
+
let o = Y(n.x, r), s = Y(n.y, r), c = n.cols.map((e) => Y(e, r)), l = c.length, u = (e, t) => {
|
|
5093
5103
|
let n = 0;
|
|
5094
|
-
for (let r = 0; r < t; r++) n +=
|
|
5104
|
+
for (let r = 0; r < t; r++) n += c[e + r] ?? 0;
|
|
5095
5105
|
return n;
|
|
5096
|
-
},
|
|
5097
|
-
for (let
|
|
5098
|
-
let o =
|
|
5099
|
-
for (let
|
|
5100
|
-
let s = o.cells[
|
|
5106
|
+
}, d = n.rows.map((e) => Y(e.height, r));
|
|
5107
|
+
for (let e = 0; e < n.rows.length; e++) {
|
|
5108
|
+
let o = n.rows[e];
|
|
5109
|
+
for (let n = 0; n < o.cells.length; n++) {
|
|
5110
|
+
let s = o.cells[n];
|
|
5101
5111
|
if (s.hMerge || s.vMerge || (s.rowSpan || 1) > 1 || !s.textBody) continue;
|
|
5102
|
-
let c =
|
|
5103
|
-
|
|
5112
|
+
let c = u(n, s.gridSpan || 1), l = Sr(t, s.textBody, 0, 0, c, 0, r, null, 0, !1, !1, "#000000", i, a, void 0, !0, void 0, !1, o.height === 0) || 0;
|
|
5113
|
+
l > d[e] && (d[e] = l);
|
|
5104
5114
|
}
|
|
5105
5115
|
}
|
|
5106
|
-
for (let
|
|
5107
|
-
let o =
|
|
5116
|
+
for (let e = 0; e < n.rows.length; e++) {
|
|
5117
|
+
let o = n.rows[e];
|
|
5108
5118
|
for (let s = 0; s < o.cells.length; s++) {
|
|
5109
5119
|
let c = o.cells[s];
|
|
5110
5120
|
if (c.hMerge || c.vMerge) continue;
|
|
5111
|
-
let
|
|
5112
|
-
if (
|
|
5113
|
-
let f =
|
|
5114
|
-
for (let
|
|
5121
|
+
let l = c.rowSpan || 1;
|
|
5122
|
+
if (l <= 1 || !c.textBody) continue;
|
|
5123
|
+
let f = u(s, c.gridSpan || 1), p = n.rows.slice(e, Math.min(n.rows.length, e + l)).some((e) => e.height === 0), m = Sr(t, c.textBody, 0, 0, f, 0, r, null, 0, !1, !1, "#000000", i, a, void 0, !0, void 0, !1, p) || 0, h = 0;
|
|
5124
|
+
for (let t = 0; t < l && e + t < d.length; t++) h += d[e + t];
|
|
5115
5125
|
if (m > h) {
|
|
5116
|
-
let
|
|
5117
|
-
for (let
|
|
5126
|
+
let t = (m - h) / l;
|
|
5127
|
+
for (let n = 0; n < l && e + n < d.length; n++) d[e + n] += t;
|
|
5118
5128
|
}
|
|
5119
5129
|
}
|
|
5120
5130
|
}
|
|
5121
|
-
let
|
|
5122
|
-
if (
|
|
5123
|
-
let e =
|
|
5124
|
-
for (let t = 0; t <
|
|
5131
|
+
let f = c.reduce((e, t) => e + t, 0), p = Array(l);
|
|
5132
|
+
if (n.rtl) {
|
|
5133
|
+
let e = o + f;
|
|
5134
|
+
for (let t = 0; t < l; t++) e -= c[t], p[t] = e;
|
|
5125
5135
|
} else {
|
|
5126
|
-
let e =
|
|
5127
|
-
for (let t = 0; t <
|
|
5136
|
+
let e = o;
|
|
5137
|
+
for (let t = 0; t < l; t++) p[t] = e, e += c[t];
|
|
5128
5138
|
}
|
|
5129
|
-
let
|
|
5139
|
+
let m = (e, t) => n.rtl ? p[e + t - 1] : p[e], h = Array(n.rows.length);
|
|
5130
5140
|
{
|
|
5131
|
-
let e =
|
|
5132
|
-
for (let
|
|
5141
|
+
let e = s;
|
|
5142
|
+
for (let t = 0; t < n.rows.length; t++) h[t] = e, e += d[t];
|
|
5133
5143
|
}
|
|
5134
|
-
let
|
|
5135
|
-
for (let e = 0; e <
|
|
5136
|
-
let
|
|
5137
|
-
for (let i = 0; i <
|
|
5138
|
-
let a =
|
|
5144
|
+
let g = [], _ = n.rows.map(() => Array(l).fill(-1));
|
|
5145
|
+
for (let e = 0; e < n.rows.length; e++) {
|
|
5146
|
+
let t = n.rows[e], r = h[e];
|
|
5147
|
+
for (let i = 0; i < t.cells.length; i++) {
|
|
5148
|
+
let a = t.cells[i];
|
|
5139
5149
|
if (a.hMerge || a.vMerge) continue;
|
|
5140
|
-
let o = a.gridSpan || 1, s = a.rowSpan || 1,
|
|
5141
|
-
for (let t = 0; t < s; t++) f +=
|
|
5142
|
-
let
|
|
5143
|
-
|
|
5150
|
+
let o = a.gridSpan || 1, s = a.rowSpan || 1, c = u(i, o), f = 0;
|
|
5151
|
+
for (let t = 0; t < s; t++) f += d[e + t] ?? 0;
|
|
5152
|
+
let p = m(i, o), h = Math.min(e + s - 1, n.rows.length - 1), v = g.length;
|
|
5153
|
+
g.push({
|
|
5144
5154
|
cell: a,
|
|
5145
|
-
colX:
|
|
5155
|
+
colX: p,
|
|
5146
5156
|
rowY: r,
|
|
5147
|
-
cellW:
|
|
5157
|
+
cellW: c,
|
|
5148
5158
|
cellH: f,
|
|
5149
5159
|
ci: i,
|
|
5150
5160
|
ri: e,
|
|
5151
5161
|
span: o,
|
|
5152
|
-
lastRi:
|
|
5162
|
+
lastRi: h
|
|
5153
5163
|
});
|
|
5154
|
-
for (let t = e; t <=
|
|
5164
|
+
for (let t = e; t <= h; t++) for (let e = i; e < i + o && e < l; e++) _[t][e] = v;
|
|
5155
5165
|
}
|
|
5156
5166
|
}
|
|
5157
|
-
for (let { cell:
|
|
5158
|
-
let u =
|
|
5159
|
-
if (u && (
|
|
5160
|
-
let
|
|
5161
|
-
|
|
5167
|
+
for (let { cell: e, colX: o, rowY: s, cellW: c, cellH: l } of g) {
|
|
5168
|
+
let u = _n(e.fill, t, o, s, c, l, n.rotation);
|
|
5169
|
+
if (u && (t.fillStyle = u, t.fillRect(o, s, c, l)), e.textBody) {
|
|
5170
|
+
let n = e.textColor ? X(e.textColor) : null;
|
|
5171
|
+
Sr(t, e.textBody, o, s, c, l, r, n, 0, !1, !1, "#000000", i, a);
|
|
5162
5172
|
}
|
|
5163
5173
|
}
|
|
5164
|
-
let
|
|
5165
|
-
if (e < 0 || e >=
|
|
5166
|
-
let n =
|
|
5167
|
-
return n < 0 ? null :
|
|
5168
|
-
},
|
|
5169
|
-
|
|
5170
|
-
x: Math.min(
|
|
5171
|
-
y: Math.min(
|
|
5172
|
-
w: Math.max(1, Math.abs(
|
|
5173
|
-
h: Math.max(1, Math.abs(
|
|
5174
|
-
},
|
|
5175
|
-
let
|
|
5176
|
-
|
|
5174
|
+
let v = a.dpr, y = (e, t) => {
|
|
5175
|
+
if (e < 0 || e >= _.length || t < 0 || t >= l) return null;
|
|
5176
|
+
let n = _[e][t];
|
|
5177
|
+
return n < 0 ? null : g[n];
|
|
5178
|
+
}, b = (i, a, o, s, c) => {
|
|
5179
|
+
Nr(t, i, r, {
|
|
5180
|
+
x: Math.min(a, s),
|
|
5181
|
+
y: Math.min(o, c),
|
|
5182
|
+
w: Math.max(1, Math.abs(s - a)),
|
|
5183
|
+
h: Math.max(1, Math.abs(c - o))
|
|
5184
|
+
}, n.rotation);
|
|
5185
|
+
let l = a === s ? e(a, t.lineWidth, v) : 0, u = o === c ? e(o, t.lineWidth, v) : 0;
|
|
5186
|
+
t.beginPath(), t.moveTo(a + l, o + u), t.lineTo(s + l, c + u), t.stroke();
|
|
5177
5187
|
};
|
|
5178
|
-
for (let
|
|
5179
|
-
let { cell: i, colX: a, rowY: o, cellW: s, cellH:
|
|
5180
|
-
|
|
5181
|
-
let f =
|
|
5182
|
-
if (
|
|
5188
|
+
for (let e of g) {
|
|
5189
|
+
let { cell: i, colX: a, rowY: o, cellW: s, cellH: c } = e;
|
|
5190
|
+
t.save();
|
|
5191
|
+
let f = n.rtl ? i.borderR : i.borderL, p = n.rtl ? i.borderL : i.borderR, g = n.rtl ? e.ci + e.span === l : e.ci === 0, v = n.rtl ? e.ci === 0 : e.ci + e.span === l, x = n.rtl ? e.ci - 1 : e.ci + e.span, S = (e) => n.rtl ? e.borderR : e.borderL;
|
|
5192
|
+
if (e.ri === 0 && i.borderT && b(i.borderT, a, o, a + s, o), g && f && b(f, a, o, a, o + c), e.lastRi === n.rows.length - 1) {
|
|
5183
5193
|
let e = i.borderB;
|
|
5184
|
-
e &&
|
|
5194
|
+
e && b(e, a, o + c, a + s, o + c);
|
|
5185
5195
|
} else {
|
|
5186
|
-
let
|
|
5187
|
-
for (; a <
|
|
5188
|
-
let
|
|
5189
|
-
for (; o <
|
|
5190
|
-
let s =
|
|
5196
|
+
let t = e.lastRi + 1, n = o + c, r = Math.min(e.ci + e.span, l), a = e.ci;
|
|
5197
|
+
for (; a < r;) {
|
|
5198
|
+
let e = _[t][a], o = a + 1;
|
|
5199
|
+
for (; o < r && _[t][o] === e;) o++;
|
|
5200
|
+
let s = y(t, a), c = an(i.borderB, s ? s.cell.borderT : null);
|
|
5191
5201
|
if (c) {
|
|
5192
|
-
let e =
|
|
5193
|
-
|
|
5202
|
+
let e = m(a, o - a);
|
|
5203
|
+
b(c, e, n, e + u(a, o - a), n);
|
|
5194
5204
|
}
|
|
5195
5205
|
a = o;
|
|
5196
5206
|
}
|
|
5197
5207
|
}
|
|
5198
|
-
if (
|
|
5199
|
-
let e =
|
|
5200
|
-
e &&
|
|
5208
|
+
if (v) {
|
|
5209
|
+
let e = p;
|
|
5210
|
+
e && b(e, a + s, o, a + s, o + c);
|
|
5201
5211
|
} else {
|
|
5202
|
-
let
|
|
5203
|
-
for (;
|
|
5204
|
-
let
|
|
5205
|
-
for (; i + 1 <=
|
|
5206
|
-
let a =
|
|
5207
|
-
o &&
|
|
5212
|
+
let t = a + s, n = e.ri;
|
|
5213
|
+
for (; n <= e.lastRi;) {
|
|
5214
|
+
let r = _[n][x], i = n;
|
|
5215
|
+
for (; i + 1 <= e.lastRi && _[i + 1][x] === r;) i++;
|
|
5216
|
+
let a = y(n, x), o = an(p, a ? S(a.cell) : null);
|
|
5217
|
+
o && b(o, t, h[n], t, h[i] + d[i]), n = i + 1;
|
|
5208
5218
|
}
|
|
5209
5219
|
}
|
|
5210
|
-
i.diagonalTL && (
|
|
5220
|
+
i.diagonalTL && (Nr(t, i.diagonalTL, r, {
|
|
5211
5221
|
x: a,
|
|
5212
5222
|
y: o,
|
|
5213
5223
|
w: s,
|
|
5214
|
-
h:
|
|
5215
|
-
},
|
|
5224
|
+
h: c
|
|
5225
|
+
}, n.rotation), t.beginPath(), t.moveTo(a, o), t.lineTo(a + s, o + c), t.stroke()), i.diagonalTR && (Nr(t, i.diagonalTR, r, {
|
|
5216
5226
|
x: a,
|
|
5217
5227
|
y: o,
|
|
5218
5228
|
w: s,
|
|
5219
|
-
h:
|
|
5220
|
-
},
|
|
5229
|
+
h: c
|
|
5230
|
+
}, n.rotation), t.beginPath(), t.moveTo(a + s, o), t.lineTo(a, o + c), t.stroke()), t.restore();
|
|
5221
5231
|
}
|
|
5222
|
-
|
|
5232
|
+
t.restore();
|
|
5223
5233
|
}
|
|
5224
|
-
function
|
|
5234
|
+
function Ir(e, t, n, r) {
|
|
5225
5235
|
e.save(), e.globalAlpha = t.opacity, e.fillStyle = t.color, e.fillRect(0, 0, n, r), e.restore();
|
|
5226
5236
|
}
|
|
5227
|
-
var
|
|
5228
|
-
function
|
|
5229
|
-
|
|
5237
|
+
var Lr = /* @__PURE__ */ new WeakMap();
|
|
5238
|
+
function Rr(e) {
|
|
5239
|
+
Lr.set(e, (Lr.get(e) ?? 0) + 1);
|
|
5230
5240
|
}
|
|
5231
|
-
function
|
|
5241
|
+
function zr(e, t, n, r, i) {
|
|
5232
5242
|
e.save(), e.fillStyle = "#f7f7f8", e.fillRect(0, 0, t, n);
|
|
5233
5243
|
let a = Math.max(12, Math.min(t, n) * .04);
|
|
5234
5244
|
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([]);
|
|
@@ -5248,129 +5258,172 @@ function Nr(e, t, n, r, i) {
|
|
|
5248
5258
|
for (let t of f.slice(0, 4)) e.fillText(t, o, h), h += m;
|
|
5249
5259
|
e.restore();
|
|
5250
5260
|
}
|
|
5251
|
-
async function
|
|
5252
|
-
|
|
5261
|
+
async function Br(e, t, n, r, i = {}, a) {
|
|
5262
|
+
return Vr(e, t, n, r, i, a);
|
|
5263
|
+
}
|
|
5264
|
+
async function Vr(e, t, n, r, i = {}, a) {
|
|
5265
|
+
let o = i.fetchImage ?? (i.fetchMedia ? Or(i.fetchMedia) : void 0), s = o ? E(o) : void 0;
|
|
5253
5266
|
try {
|
|
5254
|
-
return await
|
|
5267
|
+
return await Hr(e, t, n, r, i, a, o);
|
|
5255
5268
|
} finally {
|
|
5256
5269
|
s?.();
|
|
5257
5270
|
}
|
|
5258
5271
|
}
|
|
5259
|
-
async function
|
|
5260
|
-
let
|
|
5261
|
-
|
|
5262
|
-
let
|
|
5263
|
-
e.width =
|
|
5264
|
-
let
|
|
5265
|
-
if (!
|
|
5266
|
-
if (
|
|
5267
|
-
let
|
|
5272
|
+
async function Hr(e, t, n, r, i = {}, a, o) {
|
|
5273
|
+
let s = (Lr.get(e) ?? 0) + 1;
|
|
5274
|
+
Lr.set(e, s);
|
|
5275
|
+
let c = () => Lr.get(e) !== s, l = i.width ?? ((G(e) ? e.offsetWidth : 0) || 960), u = l / n, d = Math.round(l), f = Math.round(r * u), p = i.dpr ?? D(), m = Ne(d * p, f * p), h = m.clamped ? p * m.scale : p;
|
|
5276
|
+
e.width = m.width, e.height = m.height, G(e) && (e.style.width = `${d}px`, e.style.display || (e.style.display = "block"));
|
|
5277
|
+
let g = e.getContext("2d");
|
|
5278
|
+
if (!g) throw Error("Could not get 2D context");
|
|
5279
|
+
if (g.scale(h, h), t.parseError) return zr(g, d, f, t.slideNumber, t.parseError), e;
|
|
5280
|
+
let _ = i.defaultTextColor ? `#${i.defaultTextColor}` : "#000000", v = {
|
|
5268
5281
|
themeMajorFont: i.majorFont ?? null,
|
|
5269
5282
|
themeMinorFont: i.minorFont ?? null,
|
|
5270
5283
|
themeHlinkColor: i.hlinkColor ?? null,
|
|
5271
|
-
|
|
5272
|
-
|
|
5284
|
+
embeddedFontAliases: i.embeddedFontAliases,
|
|
5285
|
+
embeddedFontAuthoredFamilies: i.embeddedFontAuthoredFamilies,
|
|
5286
|
+
dpr: h,
|
|
5287
|
+
smartArtFallbackTextColor: ln(t.background, _)
|
|
5273
5288
|
};
|
|
5274
|
-
if (await
|
|
5275
|
-
let
|
|
5289
|
+
if (await Hn(g, t.background, d, f, u, c, i.fetchImage), c() || (i.math && await xn(t, i.math), c())) return e;
|
|
5290
|
+
let y = t.slideNumber;
|
|
5276
5291
|
for (let e of t.elements) if (e.type === "picture" && i.fetchImage) {
|
|
5277
5292
|
let t = e, n = t.mimeType === "image/svg+xml";
|
|
5278
|
-
if (
|
|
5279
|
-
else if (n)
|
|
5293
|
+
if (x(t)) q(t.svgImagePath, i.fetchImage).catch(() => void 0);
|
|
5294
|
+
else if (n) q(t.imagePath, i.fetchImage).catch(() => void 0);
|
|
5280
5295
|
else {
|
|
5281
|
-
let e =
|
|
5296
|
+
let e = Ce(t.mimeType, t.srcRect, t.width / J, t.height / J);
|
|
5282
5297
|
if (!e) continue;
|
|
5283
|
-
|
|
5298
|
+
ze(t.imagePath, t.mimeType, t.duotone, i.fetchImage, {
|
|
5284
5299
|
widthPt: e.widthPt,
|
|
5285
5300
|
heightPt: e.heightPt
|
|
5286
5301
|
}).catch(() => void 0);
|
|
5287
5302
|
}
|
|
5288
5303
|
} else if (e.type === "media") {
|
|
5289
5304
|
let t = e;
|
|
5290
|
-
t.posterPath && i.fetchMedia &&
|
|
5305
|
+
t.posterPath && i.fetchMedia && kr(t, i.fetchMedia, o).catch(() => void 0);
|
|
5291
5306
|
}
|
|
5292
|
-
let
|
|
5307
|
+
let b = /* @__PURE__ */ new Map();
|
|
5293
5308
|
if (i.fetchImage) {
|
|
5294
|
-
let n = i.fetchImage, r = /* @__PURE__ */ new Set(),
|
|
5295
|
-
for (let e of
|
|
5296
|
-
let t =
|
|
5297
|
-
|
|
5309
|
+
let n = i.fetchImage, r = /* @__PURE__ */ new Set(), a = /* @__PURE__ */ new Map();
|
|
5310
|
+
for (let e of we(t.elements.filter((e) => e.type === "chart").map((e) => e.chart))) {
|
|
5311
|
+
let t = ke(e);
|
|
5312
|
+
a.has(t) || a.set(t, e);
|
|
5298
5313
|
}
|
|
5299
5314
|
for (let e of t.elements) if (!(e.type !== "shape" || !e.textBody)) for (let t of e.textBody.paragraphs) {
|
|
5300
|
-
let e =
|
|
5315
|
+
let e = He(t.bullet);
|
|
5301
5316
|
e.type === "blip" && r.add(`${e.imagePath} ${e.mimeType}`);
|
|
5302
5317
|
}
|
|
5303
|
-
if (r.size > 0 ||
|
|
5318
|
+
if (r.size > 0 || a.size > 0) {
|
|
5304
5319
|
let t = [...r].map((e) => {
|
|
5305
5320
|
let [t, r] = e.split(" ");
|
|
5306
|
-
return
|
|
5307
|
-
if (
|
|
5321
|
+
return H(t, r, n).catch((e) => {
|
|
5322
|
+
if (Te(e)) throw e;
|
|
5308
5323
|
});
|
|
5309
|
-
}), i = [...
|
|
5324
|
+
}), i = [...a].map(async ([e, t]) => {
|
|
5310
5325
|
try {
|
|
5311
|
-
let r =
|
|
5326
|
+
let r = Ce(t.mimeType, t.srcRect, 72, 72);
|
|
5312
5327
|
if (!r) {
|
|
5313
|
-
|
|
5328
|
+
b.set(e, null);
|
|
5314
5329
|
return;
|
|
5315
5330
|
}
|
|
5316
|
-
let i = () => t.mimeType === "image/svg+xml" ? t.duotone ? Promise.resolve(null) :
|
|
5331
|
+
let i = () => t.mimeType === "image/svg+xml" ? t.duotone ? Promise.resolve(null) : q(t.imagePath, n) : ze(t.imagePath, t.mimeType, t.duotone, n, {
|
|
5317
5332
|
widthPt: r.widthPt,
|
|
5318
5333
|
heightPt: r.heightPt,
|
|
5319
5334
|
failClosedOnDuotoneFailure: !0
|
|
5320
5335
|
}), a;
|
|
5321
|
-
if (!t.duotone &&
|
|
5322
|
-
a = await
|
|
5336
|
+
if (!t.duotone && x(t)) try {
|
|
5337
|
+
a = await q(t.svgImagePath, n);
|
|
5323
5338
|
} catch {
|
|
5324
5339
|
a = await i();
|
|
5325
5340
|
}
|
|
5326
5341
|
else a = await i();
|
|
5327
|
-
|
|
5342
|
+
b.set(e, a);
|
|
5328
5343
|
} catch (t) {
|
|
5329
|
-
if (
|
|
5330
|
-
|
|
5344
|
+
if (Te(t)) throw t;
|
|
5345
|
+
b.set(e, null);
|
|
5331
5346
|
}
|
|
5332
5347
|
});
|
|
5333
|
-
if (await Promise.all([...t, ...i]),
|
|
5348
|
+
if (await Promise.all([...t, ...i]), c()) return e;
|
|
5334
5349
|
}
|
|
5335
5350
|
}
|
|
5336
5351
|
for (let [n, r] of t.elements.entries()) {
|
|
5337
|
-
if (
|
|
5338
|
-
if (r.type === "shape")
|
|
5352
|
+
if (c()) return e;
|
|
5353
|
+
if (r.type === "shape") gr(g, r, u, _, y, v, a ? (e) => a({
|
|
5339
5354
|
...e,
|
|
5340
5355
|
elementIndex: n,
|
|
5341
5356
|
origin: t.elementSources?.[n]?.origin ?? "slide"
|
|
5342
5357
|
}) : void 0, i.fetchImage);
|
|
5343
|
-
else if (r.type === "picture") await
|
|
5344
|
-
else if (r.type === "table")
|
|
5345
|
-
else if (r.type === "media") await
|
|
5358
|
+
else if (r.type === "picture") await Ar(g, r, u, c, i.fetchImage);
|
|
5359
|
+
else if (r.type === "table") Fr(g, r, u, y, v);
|
|
5360
|
+
else if (r.type === "media") await jr(g, r, u, c, i.fetchMedia, i.skipMediaControls, i.fetchImage);
|
|
5346
5361
|
else if (r.type === "chart") {
|
|
5347
|
-
let e =
|
|
5348
|
-
|
|
5349
|
-
x:
|
|
5350
|
-
y:
|
|
5351
|
-
w:
|
|
5352
|
-
h:
|
|
5353
|
-
}, e, r.rotation, i.threeD, i.regionMap, (e) =>
|
|
5362
|
+
let e = J * u;
|
|
5363
|
+
g.save(), Pr(g, r, u), Re(g, r.chart, {
|
|
5364
|
+
x: Y(r.x, u),
|
|
5365
|
+
y: Y(r.y, u),
|
|
5366
|
+
w: Y(r.width, u),
|
|
5367
|
+
h: Y(r.height, u)
|
|
5368
|
+
}, e, r.rotation, i.threeD, i.regionMap, (e) => b.get(ke(e)), i.chartEx), g.restore();
|
|
5354
5369
|
}
|
|
5355
5370
|
}
|
|
5356
|
-
return
|
|
5371
|
+
return c() || i.dim && Ir(g, i.dim, d, f), e;
|
|
5357
5372
|
}
|
|
5358
5373
|
//#endregion
|
|
5359
5374
|
//#region packages/pptx/src/google-fonts.ts
|
|
5360
|
-
var
|
|
5361
|
-
...
|
|
5362
|
-
...
|
|
5375
|
+
var Ur = {
|
|
5376
|
+
...h,
|
|
5377
|
+
...m
|
|
5363
5378
|
};
|
|
5364
|
-
|
|
5379
|
+
function* Wr(e) {
|
|
5380
|
+
for (let t of e?.paragraphs ?? []) for (let e of t.runs) e.type === "text" && (yield e.text);
|
|
5381
|
+
}
|
|
5382
|
+
function* Gr(e) {
|
|
5383
|
+
for (let t of e?.paragraphs ?? []) {
|
|
5384
|
+
t.defFontFamily && (yield t.defFontFamily);
|
|
5385
|
+
for (let e of t.runs) e.type === "text" && (e.fontFamily && (yield e.fontFamily), e.fontFamilyEa && (yield e.fontFamilyEa), e.fontFamilySym && (yield e.fontFamilySym));
|
|
5386
|
+
}
|
|
5387
|
+
}
|
|
5388
|
+
function* Kr(e) {
|
|
5389
|
+
for (let t of e.elements) if (t.type === "shape") yield* Wr(t.textBody);
|
|
5390
|
+
else if (t.type === "table") for (let e of t.rows) for (let t of e.cells) yield* Wr(t.textBody);
|
|
5391
|
+
else if (t.type === "chart") {
|
|
5392
|
+
t.chart.title && (yield t.chart.title);
|
|
5393
|
+
for (let e of t.chart.categories) yield e;
|
|
5394
|
+
for (let e of t.chart.series) e.name && (yield e.name);
|
|
5395
|
+
}
|
|
5396
|
+
}
|
|
5397
|
+
var qr = class e {
|
|
5398
|
+
scripts;
|
|
5399
|
+
families;
|
|
5400
|
+
constructor(e, t, n, r) {
|
|
5401
|
+
this.majorFont = e, this.minorFont = t;
|
|
5402
|
+
let i = F(e) ?? F(t) ?? null;
|
|
5403
|
+
this.scripts = n ?? new I(i), this.families = r ?? /* @__PURE__ */ new Set(), e && this.families.add(e), t && this.families.add(t);
|
|
5404
|
+
}
|
|
5405
|
+
addSlide(e) {
|
|
5406
|
+
this.scripts.addText(Kr(e));
|
|
5407
|
+
for (let t of e.elements) if (t.type === "shape") for (let e of Gr(t.textBody)) this.families.add(e);
|
|
5408
|
+
else if (t.type === "table") for (let e of t.rows) for (let t of e.cells) for (let e of Gr(t.textBody)) this.families.add(e);
|
|
5409
|
+
}
|
|
5410
|
+
names() {
|
|
5411
|
+
return [...this.families, ...this.scripts.names()];
|
|
5412
|
+
}
|
|
5413
|
+
withSlide(t) {
|
|
5414
|
+
let n = new e(this.majorFont, this.minorFont, this.scripts.clone(), new Set(this.families));
|
|
5415
|
+
return n.addSlide(t), n;
|
|
5416
|
+
}
|
|
5417
|
+
}, Jr = Object.freeze({
|
|
5365
5418
|
archiveEntryCount: 0,
|
|
5366
5419
|
declaredInflatedBytes: 0,
|
|
5367
5420
|
distinctInflatedBytes: 0,
|
|
5368
5421
|
operationInflatedBytes: 0
|
|
5369
|
-
});
|
|
5422
|
+
}), Yr = se;
|
|
5370
5423
|
function $(e, t) {
|
|
5371
5424
|
if (e !== null && typeof e != "string") throw Error(`invalid PPTX presentation bootstrap ${t}`);
|
|
5372
5425
|
}
|
|
5373
|
-
function
|
|
5426
|
+
function Xr(e, t) {
|
|
5374
5427
|
if (!e || typeof e != "object" || Array.isArray(e)) throw Error(`invalid PPTX presentation bootstrap slide at ${t}`);
|
|
5375
5428
|
let n = e;
|
|
5376
5429
|
if (n.index !== t) throw Error(`invalid PPTX presentation bootstrap slide index ${n.index}`);
|
|
@@ -5380,10 +5433,26 @@ function Lr(e, t) {
|
|
|
5380
5433
|
...n.partName === void 0 ? {} : { partName: n.partName }
|
|
5381
5434
|
});
|
|
5382
5435
|
}
|
|
5383
|
-
function
|
|
5436
|
+
function Zr(e, t) {
|
|
5437
|
+
if (!e || typeof e != "object" || Array.isArray(e)) throw Error(`invalid PPTX presentation bootstrap embedded font at ${t}`);
|
|
5438
|
+
let n = e;
|
|
5439
|
+
if (typeof n.fontName != "string" || n.fontName.length === 0 || ![
|
|
5440
|
+
"regular",
|
|
5441
|
+
"bold",
|
|
5442
|
+
"italic",
|
|
5443
|
+
"boldItalic"
|
|
5444
|
+
].includes(n.style ?? "") || typeof n.partPath != "string" || n.partPath.length === 0 || n.partPath.startsWith("/") || n.partPath.split("/").includes("..") || !["application/x-font-ttf", "application/x-fontdata"].includes(n.contentType ?? "")) throw Error(`invalid PPTX presentation bootstrap embedded font fields at ${t}`);
|
|
5445
|
+
return Object.freeze({
|
|
5446
|
+
fontName: n.fontName,
|
|
5447
|
+
style: n.style,
|
|
5448
|
+
partPath: n.partPath,
|
|
5449
|
+
contentType: n.contentType
|
|
5450
|
+
});
|
|
5451
|
+
}
|
|
5452
|
+
function Qr(e) {
|
|
5384
5453
|
if (!e || typeof e != "object" || Array.isArray(e)) throw Error("invalid PPTX presentation bootstrap payload");
|
|
5385
5454
|
let t = e;
|
|
5386
|
-
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.slides) || t.slides.length !== t.slideCount) throw Error("invalid PPTX presentation bootstrap dimensions or slide count");
|
|
5455
|
+
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");
|
|
5387
5456
|
return $(t.defaultTextColor, "defaultTextColor"), $(t.majorFont, "majorFont"), $(t.minorFont, "minorFont"), $(t.hlinkColor, "hlinkColor"), $(t.folHlinkColor, "folHlinkColor"), Object.freeze({
|
|
5388
5457
|
slideCount: t.slideCount,
|
|
5389
5458
|
slideWidth: t.slideWidth,
|
|
@@ -5393,10 +5462,11 @@ function Rr(e) {
|
|
|
5393
5462
|
minorFont: t.minorFont,
|
|
5394
5463
|
hlinkColor: t.hlinkColor,
|
|
5395
5464
|
folHlinkColor: t.folHlinkColor,
|
|
5396
|
-
|
|
5465
|
+
embeddedFonts: Object.freeze(t.embeddedFonts.map(Zr)),
|
|
5466
|
+
slides: Object.freeze(t.slides.map(Xr))
|
|
5397
5467
|
});
|
|
5398
5468
|
}
|
|
5399
|
-
function
|
|
5469
|
+
function $r(e) {
|
|
5400
5470
|
return Object.freeze({
|
|
5401
5471
|
type: "media",
|
|
5402
5472
|
x: e.x,
|
|
@@ -5413,7 +5483,7 @@ function zr(e) {
|
|
|
5413
5483
|
mimeType: e.mimeType
|
|
5414
5484
|
});
|
|
5415
5485
|
}
|
|
5416
|
-
function
|
|
5486
|
+
function ei(e) {
|
|
5417
5487
|
return Object.freeze({
|
|
5418
5488
|
...e.id === void 0 ? {} : { id: e.id },
|
|
5419
5489
|
...e.authorId === void 0 ? {} : { authorId: e.authorId },
|
|
@@ -5423,10 +5493,10 @@ function Br(e) {
|
|
|
5423
5493
|
text: e.text
|
|
5424
5494
|
});
|
|
5425
5495
|
}
|
|
5426
|
-
function
|
|
5496
|
+
function ti(e) {
|
|
5427
5497
|
return Object.freeze({ ...e });
|
|
5428
5498
|
}
|
|
5429
|
-
function
|
|
5499
|
+
function ni(e) {
|
|
5430
5500
|
return Object.freeze({
|
|
5431
5501
|
...e.authorId === void 0 ? {} : { authorId: e.authorId },
|
|
5432
5502
|
...e.modernAuthorId === void 0 ? {} : { modernAuthorId: e.modernAuthorId },
|
|
@@ -5436,16 +5506,16 @@ function Hr(e) {
|
|
|
5436
5506
|
...e.date === void 0 ? {} : { date: e.date },
|
|
5437
5507
|
...e.x === void 0 ? {} : { x: e.x },
|
|
5438
5508
|
...e.y === void 0 ? {} : { y: e.y },
|
|
5439
|
-
...e.anchors?.length ? { anchors: Object.freeze(e.anchors.map(
|
|
5509
|
+
...e.anchors?.length ? { anchors: Object.freeze(e.anchors.map(ti)) } : {},
|
|
5440
5510
|
...e.status === void 0 ? {} : { status: e.status },
|
|
5441
5511
|
text: e.text,
|
|
5442
|
-
...e.replies?.length ? { replies: Object.freeze(e.replies.map(
|
|
5512
|
+
...e.replies?.length ? { replies: Object.freeze(e.replies.map(ei)) } : {}
|
|
5443
5513
|
});
|
|
5444
5514
|
}
|
|
5445
|
-
function
|
|
5515
|
+
function ri(e, t, n) {
|
|
5446
5516
|
if (e !== void 0 && typeof e != "string") throw Error(`invalid PPTX presentation preflight comment ${t} at slide ${n}`);
|
|
5447
5517
|
}
|
|
5448
|
-
function
|
|
5518
|
+
function ii(e, t) {
|
|
5449
5519
|
if (!e || typeof e != "object" || Array.isArray(e)) throw Error(`invalid PPTX presentation preflight comment reply at slide ${t}`);
|
|
5450
5520
|
let n = e;
|
|
5451
5521
|
for (let e of [
|
|
@@ -5454,16 +5524,16 @@ function Wr(e, t) {
|
|
|
5454
5524
|
"author",
|
|
5455
5525
|
"date",
|
|
5456
5526
|
"status"
|
|
5457
|
-
])
|
|
5527
|
+
]) ri(n[e], e, t);
|
|
5458
5528
|
if (typeof n.text != "string") throw Error(`invalid PPTX presentation preflight comment reply text at slide ${t}`);
|
|
5459
5529
|
if (n.status !== void 0 && ![
|
|
5460
5530
|
"active",
|
|
5461
5531
|
"resolved",
|
|
5462
5532
|
"closed"
|
|
5463
5533
|
].includes(n.status)) throw Error(`invalid PPTX presentation preflight comment reply status at slide ${t}`);
|
|
5464
|
-
return
|
|
5534
|
+
return ei(n);
|
|
5465
5535
|
}
|
|
5466
|
-
function
|
|
5536
|
+
function ai(e, t) {
|
|
5467
5537
|
if (!e || typeof e != "object" || Array.isArray(e)) throw Error(`invalid PPTX presentation preflight comment at slide ${t}`);
|
|
5468
5538
|
let n = e;
|
|
5469
5539
|
for (let e of [
|
|
@@ -5472,7 +5542,7 @@ function Gr(e, t) {
|
|
|
5472
5542
|
"author",
|
|
5473
5543
|
"date",
|
|
5474
5544
|
"status"
|
|
5475
|
-
])
|
|
5545
|
+
]) ri(n[e], e, t);
|
|
5476
5546
|
for (let e of [
|
|
5477
5547
|
"authorId",
|
|
5478
5548
|
"index",
|
|
@@ -5488,23 +5558,23 @@ function Gr(e, t) {
|
|
|
5488
5558
|
"resolved",
|
|
5489
5559
|
"closed"
|
|
5490
5560
|
].includes(n.status)) throw Error(`invalid PPTX presentation preflight comment status at slide ${t}`);
|
|
5491
|
-
return
|
|
5561
|
+
return ni({
|
|
5492
5562
|
...n,
|
|
5493
|
-
...n.anchors?.length ? { anchors: n.anchors.map((e) =>
|
|
5494
|
-
...n.replies?.length ? { replies: n.replies.map((e) =>
|
|
5563
|
+
...n.anchors?.length ? { anchors: n.anchors.map((e) => oi(e, t)) } : {},
|
|
5564
|
+
...n.replies?.length ? { replies: n.replies.map((e) => ii(e, t)) } : {}
|
|
5495
5565
|
});
|
|
5496
5566
|
}
|
|
5497
|
-
function
|
|
5567
|
+
function oi(e, t) {
|
|
5498
5568
|
if (!e || typeof e != "object" || Array.isArray(e)) throw Error(`invalid PPTX presentation preflight comment anchor at slide ${t}`);
|
|
5499
5569
|
let n = e;
|
|
5500
5570
|
if (n.type === "slide" || n.type === "unknown") return Object.freeze({ type: n.type });
|
|
5501
|
-
if (n.type === "drawingElement") return
|
|
5571
|
+
if (n.type === "drawingElement") return ri(n.elementId, "anchor.elementId", t), ri(n.creationId, "anchor.creationId", t), Object.freeze({
|
|
5502
5572
|
type: "drawingElement",
|
|
5503
5573
|
...n.elementId === void 0 ? {} : { elementId: n.elementId },
|
|
5504
5574
|
...n.creationId === void 0 ? {} : { creationId: n.creationId }
|
|
5505
5575
|
});
|
|
5506
5576
|
if (n.type === "textRange") {
|
|
5507
|
-
|
|
5577
|
+
ri(n.elementId, "anchor.elementId", t);
|
|
5508
5578
|
for (let e of ["start", "length"]) {
|
|
5509
5579
|
let r = n[e];
|
|
5510
5580
|
if (r !== void 0 && (typeof r != "number" || !Number.isSafeInteger(r))) throw Error(`invalid PPTX presentation preflight comment anchor.${e} at slide ${t}`);
|
|
@@ -5518,7 +5588,7 @@ function Kr(e, t) {
|
|
|
5518
5588
|
}
|
|
5519
5589
|
throw Error(`invalid PPTX presentation preflight comment anchor type at slide ${t}`);
|
|
5520
5590
|
}
|
|
5521
|
-
function
|
|
5591
|
+
function si(e, t) {
|
|
5522
5592
|
if (!e || typeof e != "object" || Array.isArray(e)) throw Error(`invalid PPTX presentation preflight media at slide ${t}`);
|
|
5523
5593
|
let n = e;
|
|
5524
5594
|
for (let e of [
|
|
@@ -5529,14 +5599,14 @@ function qr(e, t) {
|
|
|
5529
5599
|
"rotation"
|
|
5530
5600
|
]) if (typeof n[e] != "number" || !Number.isFinite(n[e])) throw Error(`invalid PPTX presentation preflight media ${e} at slide ${t}`);
|
|
5531
5601
|
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}`);
|
|
5532
|
-
return
|
|
5602
|
+
return $r(n);
|
|
5533
5603
|
}
|
|
5534
|
-
function
|
|
5604
|
+
function ci(e, t) {
|
|
5535
5605
|
if (!e || typeof e != "object" || Array.isArray(e)) throw Error("invalid PPTX presentation preflight payload");
|
|
5536
|
-
let
|
|
5537
|
-
if (!Number.isSafeInteger(
|
|
5538
|
-
$(
|
|
5539
|
-
let
|
|
5606
|
+
let n = e;
|
|
5607
|
+
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");
|
|
5608
|
+
$(n.defaultTextColor, "defaultTextColor"), $(n.majorFont, "majorFont"), $(n.minorFont, "minorFont"), $(n.hlinkColor, "hlinkColor"), $(n.folHlinkColor, "folHlinkColor");
|
|
5609
|
+
let r = n.slides.map((e, t) => {
|
|
5540
5610
|
if (!e || typeof e != "object" || Array.isArray(e)) throw Error(`invalid PPTX presentation preflight slide at ${t}`);
|
|
5541
5611
|
let n = e;
|
|
5542
5612
|
if (n.index !== t || n.partName !== void 0 && typeof n.partName != "string" || n.notes !== null && typeof n.notes != "string" || typeof n.hidden != "boolean" || !Array.isArray(n.mediaElements) || n.comments !== void 0 && !Array.isArray(n.comments)) throw Error(`invalid PPTX presentation preflight slide fields at ${t}`);
|
|
@@ -5545,36 +5615,195 @@ function Jr(e) {
|
|
|
5545
5615
|
...n.partName === void 0 ? {} : { partName: n.partName },
|
|
5546
5616
|
notes: n.notes,
|
|
5547
5617
|
hidden: n.hidden,
|
|
5548
|
-
mediaElements: Object.freeze(n.mediaElements.map((e) =>
|
|
5549
|
-
...n.comments?.length ? { comments: Object.freeze(n.comments.map((e) =>
|
|
5618
|
+
mediaElements: Object.freeze(n.mediaElements.map((e) => si(e, t))),
|
|
5619
|
+
...n.comments?.length ? { comments: Object.freeze(n.comments.map((e) => ai(e, t))) } : {}
|
|
5550
5620
|
});
|
|
5551
|
-
}),
|
|
5621
|
+
}), i = n.fontPreloadNames.map((e, t) => {
|
|
5552
5622
|
if (e !== null && typeof e != "string") throw Error(`invalid PPTX presentation preflight font at ${t}`);
|
|
5553
5623
|
return e;
|
|
5554
5624
|
});
|
|
5555
5625
|
return Object.freeze({
|
|
5556
|
-
slideCount:
|
|
5557
|
-
slideWidth:
|
|
5558
|
-
slideHeight:
|
|
5559
|
-
defaultTextColor:
|
|
5560
|
-
majorFont:
|
|
5561
|
-
minorFont:
|
|
5562
|
-
hlinkColor:
|
|
5563
|
-
folHlinkColor:
|
|
5564
|
-
|
|
5565
|
-
|
|
5626
|
+
slideCount: n.slideCount,
|
|
5627
|
+
slideWidth: n.slideWidth,
|
|
5628
|
+
slideHeight: n.slideHeight,
|
|
5629
|
+
defaultTextColor: n.defaultTextColor,
|
|
5630
|
+
majorFont: n.majorFont,
|
|
5631
|
+
minorFont: n.minorFont,
|
|
5632
|
+
hlinkColor: n.hlinkColor,
|
|
5633
|
+
folHlinkColor: n.folHlinkColor,
|
|
5634
|
+
embeddedFonts: Object.freeze(n.embeddedFonts.map(Zr)),
|
|
5635
|
+
slides: Object.freeze(r),
|
|
5636
|
+
fontPreloadNames: Object.freeze(i)
|
|
5566
5637
|
});
|
|
5567
5638
|
}
|
|
5568
|
-
function
|
|
5639
|
+
function li(e) {
|
|
5640
|
+
return ci(e, !1);
|
|
5641
|
+
}
|
|
5642
|
+
function ui(e) {
|
|
5643
|
+
return ci(e, !0);
|
|
5644
|
+
}
|
|
5645
|
+
function di(e, t) {
|
|
5569
5646
|
for (let n of e.slides) for (let e of n.mediaElements) {
|
|
5570
5647
|
if (e.mediaPath === t) return e.mimeType;
|
|
5571
5648
|
if (e.posterPath === t) return e.posterMimeType;
|
|
5572
5649
|
}
|
|
5573
5650
|
return "";
|
|
5574
5651
|
}
|
|
5575
|
-
|
|
5576
|
-
|
|
5577
|
-
|
|
5652
|
+
function fi(e, t) {
|
|
5653
|
+
if (e.index !== t.index || e.partName !== t.partName) throw Error(`PPTX pulled slide identity does not match bootstrap index ${t.index}`);
|
|
5654
|
+
return Object.freeze({
|
|
5655
|
+
index: t.index,
|
|
5656
|
+
...t.partName === void 0 ? {} : { partName: t.partName },
|
|
5657
|
+
notes: e.notes ?? null,
|
|
5658
|
+
hidden: e.hidden ?? !1,
|
|
5659
|
+
mediaElements: Object.freeze(e.elements.filter((e) => e.type === "media").map($r)),
|
|
5660
|
+
...e.comments?.length ? { comments: Object.freeze(e.comments.map(ni)) } : {}
|
|
5661
|
+
});
|
|
5662
|
+
}
|
|
5663
|
+
function pi(e, t, n) {
|
|
5664
|
+
if (!(e <= t)) throw new g(`PPTX presentation preflight exceeded its hard limit of ${t} projected bytes`, {
|
|
5665
|
+
stage: "parsing",
|
|
5666
|
+
violation: {
|
|
5667
|
+
format: "pptx",
|
|
5668
|
+
operation: "presentation-preflight",
|
|
5669
|
+
resource: "presentation-preflight",
|
|
5670
|
+
metric: "projected-bytes",
|
|
5671
|
+
limit: t,
|
|
5672
|
+
observed: Math.min(e, t + 1),
|
|
5673
|
+
configurable: !1,
|
|
5674
|
+
usage: n
|
|
5675
|
+
}
|
|
5676
|
+
});
|
|
5677
|
+
}
|
|
5678
|
+
var mi = class {
|
|
5679
|
+
slideCountValue;
|
|
5680
|
+
slideWidthValue;
|
|
5681
|
+
slideHeightValue;
|
|
5682
|
+
defaultTextColorValue;
|
|
5683
|
+
majorFontValue;
|
|
5684
|
+
minorFontValue;
|
|
5685
|
+
hlinkColorValue;
|
|
5686
|
+
folHlinkColorValue;
|
|
5687
|
+
embeddedFontsValue;
|
|
5688
|
+
descriptors;
|
|
5689
|
+
slides = [];
|
|
5690
|
+
fonts;
|
|
5691
|
+
fontPreloadNames;
|
|
5692
|
+
fontProjectionBytes;
|
|
5693
|
+
projectionBytesValue;
|
|
5694
|
+
limit;
|
|
5695
|
+
pending = null;
|
|
5696
|
+
finished = null;
|
|
5697
|
+
constructor(e, t = {}) {
|
|
5698
|
+
let n = Qr(e), r = t.hardLimitForTesting ?? Yr;
|
|
5699
|
+
if (!Number.isSafeInteger(r) || r <= 0 || r > Yr) throw Error("invalid PPTX presentation preflight test limit");
|
|
5700
|
+
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 qr(this.majorFontValue, this.minorFontValue), this.fontPreloadNames = Object.freeze(this.fonts.names()), this.fontProjectionBytes = Be(this.fontPreloadNames, this.limit).jsonBytes, this.projectionBytesValue = Be({
|
|
5701
|
+
slideCount: this.slideCountValue,
|
|
5702
|
+
slideWidth: this.slideWidthValue,
|
|
5703
|
+
slideHeight: this.slideHeightValue,
|
|
5704
|
+
defaultTextColor: this.defaultTextColorValue,
|
|
5705
|
+
majorFont: this.majorFontValue,
|
|
5706
|
+
minorFont: this.minorFontValue,
|
|
5707
|
+
hlinkColor: this.hlinkColorValue,
|
|
5708
|
+
folHlinkColor: this.folHlinkColorValue,
|
|
5709
|
+
embeddedFonts: this.embeddedFontsValue,
|
|
5710
|
+
remainingSlides: this.descriptors,
|
|
5711
|
+
slides: [],
|
|
5712
|
+
fontPreloadNames: this.fontPreloadNames
|
|
5713
|
+
}, this.limit).jsonBytes, pi(this.projectionBytesValue, this.limit, Jr);
|
|
5714
|
+
}
|
|
5715
|
+
get acceptedSlideCount() {
|
|
5716
|
+
return this.finished?.slideCount ?? this.slides.length;
|
|
5717
|
+
}
|
|
5718
|
+
get projectedBytes() {
|
|
5719
|
+
return this.projectionBytesValue;
|
|
5720
|
+
}
|
|
5721
|
+
get remainingDescriptorCount() {
|
|
5722
|
+
return this.descriptors.reduce((e, t) => e + Number(t !== void 0), 0);
|
|
5723
|
+
}
|
|
5724
|
+
get latestSlide() {
|
|
5725
|
+
return this.slides[this.slides.length - 1];
|
|
5726
|
+
}
|
|
5727
|
+
get currentFontPreloadNames() {
|
|
5728
|
+
return this.fontPreloadNames;
|
|
5729
|
+
}
|
|
5730
|
+
snapshot() {
|
|
5731
|
+
if (this.finished) return this.finished;
|
|
5732
|
+
if (this.pending) throw Error("PPTX presentation preflight has an uncommitted slide");
|
|
5733
|
+
return Object.freeze({
|
|
5734
|
+
slideCount: this.slideCountValue,
|
|
5735
|
+
slideWidth: this.slideWidthValue,
|
|
5736
|
+
slideHeight: this.slideHeightValue,
|
|
5737
|
+
defaultTextColor: this.defaultTextColorValue,
|
|
5738
|
+
majorFont: this.majorFontValue,
|
|
5739
|
+
minorFont: this.minorFontValue,
|
|
5740
|
+
hlinkColor: this.hlinkColorValue,
|
|
5741
|
+
folHlinkColor: this.folHlinkColorValue,
|
|
5742
|
+
embeddedFonts: this.embeddedFontsValue,
|
|
5743
|
+
slides: Object.freeze([...this.slides]),
|
|
5744
|
+
fontPreloadNames: this.fontPreloadNames
|
|
5745
|
+
});
|
|
5746
|
+
}
|
|
5747
|
+
addSlide(e, t = Jr) {
|
|
5748
|
+
this.prepareSlide(e, t).commit();
|
|
5749
|
+
}
|
|
5750
|
+
prepareSlide(e, t = Jr) {
|
|
5751
|
+
if (this.finished) throw Error("PPTX presentation preflight is already finished");
|
|
5752
|
+
if (this.pending) throw Error("PPTX presentation preflight already has a prepared slide");
|
|
5753
|
+
let n = this.slides.length, r = this.descriptors[n];
|
|
5754
|
+
if (!r) throw Error("PPTX presentation preflight received an extra slide");
|
|
5755
|
+
let i = fi(e, r), a = this.fonts.withSlide(e), o = Object.freeze(a.names()), s = Be(o, this.limit).jsonBytes, c = Be(i, this.limit).jsonBytes, l = this.projectionBytesValue - this.fontProjectionBytes - Be(r, this.limit).jsonBytes + 4;
|
|
5756
|
+
l = Ve(l, s, this.limit), l = Ve(l, c, this.limit), this.slides.length !== 0 && (l = Ve(l, 1, this.limit));
|
|
5757
|
+
let u = Be({
|
|
5758
|
+
slide: i,
|
|
5759
|
+
fontPreloadNames: o
|
|
5760
|
+
}, this.limit).jsonBytes, d = Ve(this.projectionBytesValue, u, this.limit);
|
|
5761
|
+
pi(Math.max(d, l), this.limit, t);
|
|
5762
|
+
let f = {
|
|
5763
|
+
state: "prepared",
|
|
5764
|
+
fact: i,
|
|
5765
|
+
fonts: a,
|
|
5766
|
+
fontNames: o,
|
|
5767
|
+
fontBytes: s,
|
|
5768
|
+
committedBytes: l
|
|
5769
|
+
};
|
|
5770
|
+
return this.pending = f, {
|
|
5771
|
+
projectedBytes: d,
|
|
5772
|
+
commit: () => {
|
|
5773
|
+
if (f.state !== "committed") {
|
|
5774
|
+
if (f.state === "rolled-back") throw Error("PPTX presentation preflight cannot commit a rolled-back slide");
|
|
5775
|
+
if (this.pending !== f) throw Error("PPTX presentation preflight prepared slide is stale");
|
|
5776
|
+
this.descriptors[n] = void 0, this.slides.push(f.fact), this.fonts = f.fonts, this.fontPreloadNames = f.fontNames, this.fontProjectionBytes = f.fontBytes, this.projectionBytesValue = f.committedBytes, f.state = "committed", this.pending = null;
|
|
5777
|
+
}
|
|
5778
|
+
},
|
|
5779
|
+
rollback: () => {
|
|
5780
|
+
if (f.state !== "rolled-back") {
|
|
5781
|
+
if (f.state === "committed") throw Error("PPTX presentation preflight cannot roll back a committed slide");
|
|
5782
|
+
if (this.pending !== f) throw Error("PPTX presentation preflight prepared slide is stale");
|
|
5783
|
+
f.state = "rolled-back", this.pending = null;
|
|
5784
|
+
}
|
|
5785
|
+
}
|
|
5786
|
+
};
|
|
5787
|
+
}
|
|
5788
|
+
finish() {
|
|
5789
|
+
if (this.finished) return this.finished;
|
|
5790
|
+
if (this.pending) throw Error("PPTX presentation preflight has an uncommitted slide");
|
|
5791
|
+
if (this.slides.length !== this.slideCountValue) throw Error(`PPTX presentation preflight is incomplete: ${this.slides.length}/${this.slideCountValue} slides`);
|
|
5792
|
+
return this.finished = Object.freeze({
|
|
5793
|
+
slideCount: this.slideCountValue,
|
|
5794
|
+
slideWidth: this.slideWidthValue,
|
|
5795
|
+
slideHeight: this.slideHeightValue,
|
|
5796
|
+
defaultTextColor: this.defaultTextColorValue,
|
|
5797
|
+
majorFont: this.majorFontValue,
|
|
5798
|
+
minorFont: this.minorFontValue,
|
|
5799
|
+
hlinkColor: this.hlinkColorValue,
|
|
5800
|
+
folHlinkColor: this.folHlinkColorValue,
|
|
5801
|
+
embeddedFonts: this.embeddedFontsValue,
|
|
5802
|
+
slides: Object.freeze([...this.slides]),
|
|
5803
|
+
fontPreloadNames: this.fontPreloadNames
|
|
5804
|
+
}), this.descriptors = [], this.slides = [], this.projectionBytesValue = Be(this.finished, this.limit).jsonBytes, this.finished;
|
|
5805
|
+
}
|
|
5806
|
+
}, hi = 1024 * 1024, gi = class {
|
|
5578
5807
|
active = /* @__PURE__ */ new Set();
|
|
5579
5808
|
nextSessionId = 1;
|
|
5580
5809
|
constructor(e) {
|
|
@@ -5583,21 +5812,21 @@ var Xr = 1024 * 1024, Zr = class {
|
|
|
5583
5812
|
}
|
|
5584
5813
|
async load(e, t = !0, n) {
|
|
5585
5814
|
this.assertSlideIndex(e);
|
|
5586
|
-
let
|
|
5587
|
-
sessionId:
|
|
5588
|
-
operationId:
|
|
5815
|
+
let i = this.nextSessionId++, a = {
|
|
5816
|
+
sessionId: i,
|
|
5817
|
+
operationId: i,
|
|
5589
5818
|
generation: this.options.generation ?? 1
|
|
5590
|
-
},
|
|
5591
|
-
...
|
|
5592
|
-
maxByteCredit:
|
|
5819
|
+
}, o = new f(this.options.transport, {
|
|
5820
|
+
...a,
|
|
5821
|
+
maxByteCredit: r,
|
|
5593
5822
|
timeoutMs: n
|
|
5594
5823
|
});
|
|
5595
|
-
this.active.add(
|
|
5824
|
+
this.active.add(o);
|
|
5596
5825
|
try {
|
|
5597
|
-
await this.options.open(e,
|
|
5598
|
-
let r = await
|
|
5826
|
+
await this.options.open(e, a, n);
|
|
5827
|
+
let r = await vi(o);
|
|
5599
5828
|
try {
|
|
5600
|
-
let e = r.usage ??
|
|
5829
|
+
let e = r.usage ?? o.usageCheckpoint;
|
|
5601
5830
|
e && this.options.onUsage?.(e);
|
|
5602
5831
|
let n = t ? JSON.parse(new TextDecoder().decode(new Uint8Array(r.payload))) : void 0;
|
|
5603
5832
|
return await r.ack(), n;
|
|
@@ -5605,9 +5834,9 @@ var Xr = 1024 * 1024, Zr = class {
|
|
|
5605
5834
|
r.disposeTransferred();
|
|
5606
5835
|
}
|
|
5607
5836
|
} catch (e) {
|
|
5608
|
-
throw await
|
|
5837
|
+
throw await o.cancel("request-error").catch(() => void 0), e;
|
|
5609
5838
|
} finally {
|
|
5610
|
-
this.active.delete(
|
|
5839
|
+
this.active.delete(o);
|
|
5611
5840
|
}
|
|
5612
5841
|
}
|
|
5613
5842
|
cancelAll() {
|
|
@@ -5618,20 +5847,20 @@ var Xr = 1024 * 1024, Zr = class {
|
|
|
5618
5847
|
if (!Number.isSafeInteger(e) || e < 0 || e >= this.options.slideCount) throw RangeError(`Slide index ${e} out of range (count: ${this.options.slideCount})`);
|
|
5619
5848
|
}
|
|
5620
5849
|
};
|
|
5621
|
-
function
|
|
5850
|
+
function _i(e) {
|
|
5622
5851
|
return !!e && typeof e == "object" && e.protocol === "ooxml-pull-v1";
|
|
5623
5852
|
}
|
|
5624
|
-
async function
|
|
5853
|
+
async function vi(e) {
|
|
5625
5854
|
try {
|
|
5626
|
-
return await e.pull(
|
|
5855
|
+
return await e.pull(hi);
|
|
5627
5856
|
} catch (t) {
|
|
5628
|
-
let n =
|
|
5857
|
+
let n = yi(t);
|
|
5629
5858
|
if (n === void 0) throw t;
|
|
5630
5859
|
return e.pull(n);
|
|
5631
5860
|
}
|
|
5632
5861
|
}
|
|
5633
|
-
function
|
|
5634
|
-
return
|
|
5862
|
+
function yi(e) {
|
|
5863
|
+
return l(e, hi, r);
|
|
5635
5864
|
}
|
|
5636
5865
|
//#endregion
|
|
5637
|
-
export {
|
|
5866
|
+
export { Qr as a, Ur as c, Vr as d, Jt as f, di as i, Rr as l, _i as n, li as o, mi as r, ui as s, gi as t, Br as u };
|