@algorisys/yappydraw 0.8.297 → 0.8.298
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 +2 -2
- package/chunks/{canva-ai-cwK_LwEk.js → canva-ai-wYv31lWm.js} +1 -1
- package/chunks/{choice-dialog-state-CF9ddIAk.js → choice-dialog-state-DqR_5IIZ.js} +1 -1
- package/chunks/{custgeom-N1NlyQKZ.js → custgeom-DUHYX5Vs.js} +28 -26
- package/chunks/{design-generator-DSEgwQ7i.js → design-generator-DGqLbsqR.js} +1 -1
- package/chunks/{drawing-engine-CPFaJPyz.js → drawing-engine-BCPX1hm_.js} +1 -1
- package/chunks/{drawings-store-CxGNbTN7.js → drawings-store-BJW1Dmw_.js} +1 -1
- package/chunks/{ds-operations-BTcGLr6X.js → ds-operations-Bi7WKGwN.js} +1 -1
- package/chunks/{export-game-BVjxTYD1.js → export-game-BkUpm1R8.js} +1 -1
- package/chunks/{from-yappy-kTebD-0Y.js → from-yappy-fz7AULvS.js} +175 -173
- package/chunks/{game-runtime-Ch0y0mLm.js → game-runtime-Bng0zlkA.js} +24 -24
- package/chunks/import-BvGSYTzL.js +1895 -0
- package/chunks/{index-zg1eC33A.js → index-Bqlr2FLr.js} +9325 -9170
- package/chunks/{lucide-solid-DAmszm-d.js → lucide-solid-Db2bPSrx.js} +1 -1
- package/chunks/{markdown-to-slides-CGvmGrK2.js → markdown-to-slides-D1OVYcQV.js} +1 -1
- package/chunks/{morph-animator-BQPPQ08b.js → morph-animator-DCs2sEkC.js} +1 -1
- package/chunks/{onboarding-tour-CpRCV3Ub.js → onboarding-tour-DoZ9Sivk.js} +1 -1
- package/chunks/{pdf-vector-D65OC03c.js → pdf-vector-DTgEkBKW.js} +1 -1
- package/chunks/{search-rp-eRNJ6.js → search-4gFkAhbD.js} +9 -9
- package/chunks/{slide-generator-Ctxdc9Yn.js → slide-generator-D1fy8u8B.js} +5 -5
- package/chunks/{turntable-ai-ZhAGEjzz.js → turntable-ai-C1B4jzNc.js} +1 -1
- package/chunks/write-DDXhxpu-.js +408 -0
- package/chunks/yappy-Btkc8ueG.css +1 -0
- package/package.json +1 -1
- package/yappy.js +1 -1
- package/chunks/import-eCGTFoVi.js +0 -1814
- package/chunks/write-ZW6FSyj1.js +0 -327
- package/chunks/yappy-CvwwkLs8.css +0 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { t as
|
|
3
|
-
import { d as
|
|
4
|
-
function
|
|
1
|
+
import { a5 as rt, a6 as mt, a7 as xt, a1 as gt, a8 as yt, a9 as kt, aa as bt, ab as Mt, ac as wt, ad as vt, ae as G, af as St, ag as At, ah as $t, ai as It, aj as Ct, ak as Tt, al as zt, am as Ft, an as Pt, ao as Lt, ap as Et, aq as Ot } from "./index-Bqlr2FLr.js";
|
|
2
|
+
import { t as Rt } from "./anim-map-D7T1mIAM.js";
|
|
3
|
+
import { d as P, g as N, t as C, h as Xt } from "./custgeom-DUHYX5Vs.js";
|
|
4
|
+
function Dt(t) {
|
|
5
5
|
const { l: n, c: e, h: r } = t, i = r * Math.PI / 180, o = e * Math.cos(i), l = e * Math.sin(i), f = n + 0.3963377774 * o + 0.2158037573 * l, a = n - 0.1055613458 * o - 0.0638541728 * l, s = n - 0.0894841775 * o - 1.291485548 * l, c = f * f * f, u = a * a * a, h = s * s * s, p = 1.2270138511 * c - 0.5577999807 * u + 0.2812561489 * h, d = -0.0405801784 * c + 1.1122568696 * u - 0.0716766787 * h, x = -0.0763812845 * c - 0.4214819787 * u + 1.5861632204 * h, g = 2.4039459 * p - 0.9898517 * d - 0.4141151 * x, k = -0.7797967 * p + 1.5445214 * d + 0.0352745 * x, m = 0.0384795 * p - 0.1141381 * d + 1.0756786 * x, y = (b) => {
|
|
6
6
|
const M = Math.abs(b), w = M > 31308e-7 ? 1.055 * Math.pow(M, 1 / 2.4) - 0.055 : 12.92 * M;
|
|
7
7
|
return b < 0 ? -w : w;
|
|
@@ -12,23 +12,23 @@ function Xt(t) {
|
|
|
12
12
|
b: y(m)
|
|
13
13
|
};
|
|
14
14
|
}
|
|
15
|
-
function
|
|
15
|
+
function X(t) {
|
|
16
16
|
const n = Math.abs(t), e = n > 31308e-7 ? 1.055 * Math.pow(n, 1 / 2.4) - 0.055 : 12.92 * n;
|
|
17
17
|
return t < 0 ? -e : e;
|
|
18
18
|
}
|
|
19
|
-
function
|
|
19
|
+
function D(t) {
|
|
20
20
|
const n = Math.abs(t), e = n > 0.04045 ? Math.pow((n + 0.055) / 1.055, 2.4) : n / 12.92;
|
|
21
21
|
return t < 0 ? -e : e;
|
|
22
22
|
}
|
|
23
|
-
function
|
|
24
|
-
const r =
|
|
23
|
+
function q(t, n, e) {
|
|
24
|
+
const r = D(t), i = D(n), o = D(e);
|
|
25
25
|
return {
|
|
26
|
-
r:
|
|
27
|
-
g:
|
|
28
|
-
b:
|
|
26
|
+
r: X(1.2249401762805083 * r - 0.2249401762805082 * i),
|
|
27
|
+
g: X(-0.04205697751522136 * r + 1.0420569775152215 * i),
|
|
28
|
+
b: X(-0.019637554590334 * r - 0.07863604555063188 * i + 1.0982736001409656 * o)
|
|
29
29
|
};
|
|
30
30
|
}
|
|
31
|
-
function
|
|
31
|
+
function Bt(t) {
|
|
32
32
|
return t.endsWith("%") ? parseFloat(t) / 100 : parseFloat(t);
|
|
33
33
|
}
|
|
34
34
|
function T(t) {
|
|
@@ -41,11 +41,11 @@ function T(t) {
|
|
|
41
41
|
}
|
|
42
42
|
const e = (o) => Math.round(Math.max(0, Math.min(1, o)) * 255), r = n.match(/^color\(\s*(display-p3|srgb)\s+([^/)]+?)\s*(?:\/[^)]*)?\)$/);
|
|
43
43
|
if (r) {
|
|
44
|
-
const o = r[2].split(/[\s,]+/).filter(Boolean).map(
|
|
44
|
+
const o = r[2].split(/[\s,]+/).filter(Boolean).map(Bt);
|
|
45
45
|
if (o.length < 3 || o.some((c) => !isFinite(c))) return null;
|
|
46
46
|
const [l, f, a] = o;
|
|
47
47
|
if (r[1] === "srgb") return [e(l), e(f), e(a)];
|
|
48
|
-
const s =
|
|
48
|
+
const s = q(l, f, a);
|
|
49
49
|
return [e(s.r), e(s.g), e(s.b)];
|
|
50
50
|
}
|
|
51
51
|
const i = n.match(/^oklch\(\s*([^/)]+?)\s*(?:\/[^)]*)?\)$/);
|
|
@@ -54,15 +54,15 @@ function T(t) {
|
|
|
54
54
|
if (o.length < 3) return null;
|
|
55
55
|
const l = o[0].endsWith("%") ? parseFloat(o[0]) / 100 : parseFloat(o[0]), f = parseFloat(o[1]), a = parseFloat(o[2]);
|
|
56
56
|
if (![l, f, a].every(isFinite)) return null;
|
|
57
|
-
const s =
|
|
57
|
+
const s = q(...(({ r: c, g: u, b: h }) => [c, u, h])(Dt({ l, c: f, h: a })));
|
|
58
58
|
return [e(s.r), e(s.g), e(s.b)];
|
|
59
59
|
}
|
|
60
|
-
return
|
|
60
|
+
return Yt(n);
|
|
61
61
|
}
|
|
62
|
-
const
|
|
62
|
+
const z = /* @__PURE__ */ new Map();
|
|
63
63
|
let $;
|
|
64
|
-
function
|
|
65
|
-
if (
|
|
64
|
+
function Yt(t) {
|
|
65
|
+
if (z.has(t)) return z.get(t);
|
|
66
66
|
let n = null;
|
|
67
67
|
try {
|
|
68
68
|
if ($ === void 0) {
|
|
@@ -77,10 +77,10 @@ function Bt(t) {
|
|
|
77
77
|
} catch {
|
|
78
78
|
n = null;
|
|
79
79
|
}
|
|
80
|
-
return
|
|
80
|
+
return z.size < 512 && z.set(t, n), n;
|
|
81
81
|
}
|
|
82
82
|
const L = (t) => "#" + t.map((n) => n.toString(16).padStart(2, "0")).join("");
|
|
83
|
-
function
|
|
83
|
+
function Wt(t) {
|
|
84
84
|
const n = t.trim().toLowerCase(), e = n.match(/^#([0-9a-f]{8})$/);
|
|
85
85
|
if (e) return parseInt(e[1].slice(6), 16) / 255;
|
|
86
86
|
const r = n.match(/^#([0-9a-f]{4})$/);
|
|
@@ -88,23 +88,23 @@ function Yt(t) {
|
|
|
88
88
|
const i = n.match(/^(?:rgba?|hsla?)\(([^)]*)\)$/);
|
|
89
89
|
if (i) {
|
|
90
90
|
const l = i[1].split(/[\s,/]+/).filter(Boolean);
|
|
91
|
-
if (l.length >= 4) return
|
|
91
|
+
if (l.length >= 4) return V(l[3]);
|
|
92
92
|
}
|
|
93
93
|
const o = n.match(/\/\s*([\d.]+%?)\s*\)$/);
|
|
94
|
-
return o ?
|
|
94
|
+
return o ? V(o[1]) : 1;
|
|
95
95
|
}
|
|
96
|
-
const
|
|
96
|
+
const V = (t) => {
|
|
97
97
|
const n = t.endsWith("%") ? parseFloat(t) / 100 : parseFloat(t);
|
|
98
98
|
return Number.isFinite(n) ? Math.max(0, Math.min(1, n)) : 1;
|
|
99
99
|
};
|
|
100
|
-
function
|
|
100
|
+
function A(t, n = 1) {
|
|
101
101
|
if (!t) return null;
|
|
102
102
|
const e = T(t);
|
|
103
103
|
if (!e) return null;
|
|
104
|
-
const r =
|
|
104
|
+
const r = Wt(t) * n;
|
|
105
105
|
return r <= 0 ? null : r < 0.999 ? { hex: L(e), alpha: r } : { hex: L(e) };
|
|
106
106
|
}
|
|
107
|
-
const ot = (t) => mt(t).split(",")[0].trim().replace(/^['"]|['"]$/g, "") || "Calibri",
|
|
107
|
+
const ot = (t) => mt(t).split(",")[0].trim().replace(/^['"]|['"]$/g, "") || "Calibri", W = {
|
|
108
108
|
hachure: "ltUpDiag",
|
|
109
109
|
zigzag: "ltUpDiag",
|
|
110
110
|
"zigzag-line": "ltUpDiag",
|
|
@@ -112,14 +112,14 @@ const ot = (t) => mt(t).split(",")[0].trim().replace(/^['"]|['"]$/g, "") || "Cal
|
|
|
112
112
|
"cross-hatch": "diagCross",
|
|
113
113
|
dots: "pct20"
|
|
114
114
|
};
|
|
115
|
-
function
|
|
115
|
+
function Ht(t, n) {
|
|
116
116
|
const e = t.fillStyle || "solid";
|
|
117
117
|
if ((e === "linear" || e === "radial" || e === "conic") && (t.gradientStops?.length ?? 0) > 0) {
|
|
118
|
-
const i = t.gradientStops.map((o) => ({ pos: Math.max(0, Math.min(1, o.offset)), color:
|
|
118
|
+
const i = t.gradientStops.map((o) => ({ pos: Math.max(0, Math.min(1, o.offset)), color: A(o.color, n) ?? { hex: "#000000", alpha: 0 } }));
|
|
119
119
|
return e === "linear" ? { kind: "linear", stops: i, angle: t.gradientDirection ?? 45, scaled: !0 } : { kind: "radial", stops: i };
|
|
120
120
|
}
|
|
121
|
-
const r =
|
|
122
|
-
return r ?
|
|
121
|
+
const r = A(t.backgroundColor, n);
|
|
122
|
+
return r ? W[e] ? { kind: "pattern", preset: W[e], color: r } : { kind: "solid", color: r } : { kind: "none" };
|
|
123
123
|
}
|
|
124
124
|
function it(t) {
|
|
125
125
|
if (t.strokeStyle === "dotted") return "sysDot";
|
|
@@ -129,8 +129,8 @@ function it(t) {
|
|
|
129
129
|
return n <= (t.strokeWidth || 2) * 1.5 ? "sysDot" : "dash";
|
|
130
130
|
}
|
|
131
131
|
}
|
|
132
|
-
function
|
|
133
|
-
const r =
|
|
132
|
+
function U(t, n, e = !1) {
|
|
133
|
+
const r = A(t.strokeColor, n);
|
|
134
134
|
if (!r || !(t.strokeWidth > 0)) return null;
|
|
135
135
|
const i = t.strokeLineCap === "butt" ? "flat" : t.strokeLineCap === "square" ? "sq" : "rnd";
|
|
136
136
|
return {
|
|
@@ -146,50 +146,50 @@ function J(t, n, e) {
|
|
|
146
146
|
const r = n / Math.max(e, 0.5), i = r <= 2.5 ? "sm" : r <= 4 ? "med" : "lg";
|
|
147
147
|
return { type: t === "triangle" ? "triangle" : t === "dot" || t === "circle" ? "oval" : t === "diamond" || t === "diamondFilled" ? "diamond" : "arrow", size: i };
|
|
148
148
|
}
|
|
149
|
-
const
|
|
149
|
+
const _ = (t, n) => t === "center" ? "ctr" : t === "right" ? "r" : t === "left" ? "l" : n, st = (t) => t === "top" ? "t" : t === "bottom" ? "b" : "ctr";
|
|
150
150
|
function at(t, n) {
|
|
151
151
|
return t.split(`
|
|
152
152
|
`).map((e) => ({ runs: e ? [{ text: e }] : [], align: n }));
|
|
153
153
|
}
|
|
154
|
-
function
|
|
154
|
+
function jt(t) {
|
|
155
155
|
const n = { "lower-alpha": "alphaLc", "upper-alpha": "alphaUc", "lower-roman": "romanLc", "upper-roman": "romanUc" }[t.listNumberStyle ?? ""] ?? "arabic", e = { paren: "ParenR", parens: "ParenBoth", none: "Plain" }[t.listNumberSuffix ?? ""] ?? "Period";
|
|
156
156
|
return n + e;
|
|
157
157
|
}
|
|
158
158
|
let I;
|
|
159
|
-
function
|
|
159
|
+
function Nt(t, n) {
|
|
160
160
|
if (I === void 0 && (I = typeof document < "u" ? document.createElement("canvas").getContext("2d") : null), I)
|
|
161
161
|
return I.font = n, I.measureText(t).width;
|
|
162
162
|
const e = Number(/(\d+(?:\.\d+)?)px/.exec(n)?.[1] ?? 16);
|
|
163
163
|
return t.length * e * 0.6;
|
|
164
164
|
}
|
|
165
|
-
function
|
|
165
|
+
function Ut(t, n, e, r) {
|
|
166
166
|
const i = t.listLevel || 0, o = { bullet: t.listType === "ordered" ? "num" : "char", level: i };
|
|
167
167
|
if (o.bullet === "num") {
|
|
168
|
-
const a =
|
|
168
|
+
const a = jt(t);
|
|
169
169
|
a !== "arabicPeriod" && (o.numType = a), !(e && e.level === i && e.scheme === a && (t.listIndex || 1) === e.index + 1) && (t.listIndex || 1) > 1 && (o.startAt = t.listIndex);
|
|
170
170
|
} else t.listMarker && t.listMarker !== "•" && (o.bulletChar = t.listMarker);
|
|
171
171
|
if (t.listMarkerColor) {
|
|
172
|
-
const a =
|
|
172
|
+
const a = A(t.listMarkerColor, n);
|
|
173
173
|
a && (o.bulletColor = a);
|
|
174
174
|
}
|
|
175
175
|
t.listMarkerScale && t.listMarkerScale !== 1 && (o.bulletScale = t.listMarkerScale);
|
|
176
|
-
const l =
|
|
176
|
+
const l = Ot(t), f = r(t);
|
|
177
177
|
return o.marL = f, o.indent = l - f, o;
|
|
178
178
|
}
|
|
179
179
|
function ct(t, n, e, r) {
|
|
180
180
|
const i = [];
|
|
181
181
|
let o = { runs: [], align: n }, l = !1, f = null;
|
|
182
|
-
const a =
|
|
182
|
+
const a = Lt(Nt, t, r), s = () => {
|
|
183
183
|
i.push(o), o = { runs: [], align: n }, l = !1;
|
|
184
184
|
};
|
|
185
185
|
for (const c of t)
|
|
186
186
|
String(c.text ?? "").split(`
|
|
187
187
|
`).forEach((h, p) => {
|
|
188
188
|
if (p > 0 && s(), c.fontSize && !l && (o.endSize = c.fontSize), !h) return;
|
|
189
|
-
l || (l = !0, c.paragraphSpaceBefore && (o.spaceBefore = c.paragraphSpaceBefore), c.paragraphAlign && (o.align =
|
|
189
|
+
l || (l = !0, c.paragraphSpaceBefore && (o.spaceBefore = c.paragraphSpaceBefore), c.paragraphAlign && (o.align = _(c.paragraphAlign, n ?? "l")), c.listType && c.listType !== "none" && Object.assign(o, Ut(c, e, f, a)), f = o.bullet === "num" ? { level: o.level ?? 0, scheme: o.numType ?? "arabicPeriod", index: c.listIndex || 1 } : null);
|
|
190
190
|
const d = { text: h };
|
|
191
191
|
if (c.bold && (d.bold = !0), c.italic && (d.italic = !0), c.underline && (d.underline = !0), c.strikethrough && (d.strike = !0), c.color) {
|
|
192
|
-
const x =
|
|
192
|
+
const x = A(c.color, e);
|
|
193
193
|
x && (d.color = x);
|
|
194
194
|
}
|
|
195
195
|
c.fontSize && (d.size = c.fontSize), c.fontFamily && (d.font = ot(c.fontFamily)), o.runs.push(d);
|
|
@@ -197,18 +197,18 @@ function ct(t, n, e, r) {
|
|
|
197
197
|
return s(), i;
|
|
198
198
|
}
|
|
199
199
|
function lt(t, n, e) {
|
|
200
|
-
const r =
|
|
200
|
+
const r = A(t.textColor || t.strokeColor || "#000000", n) ?? void 0;
|
|
201
201
|
return {
|
|
202
202
|
size: e,
|
|
203
203
|
color: r,
|
|
204
204
|
font: ot(t.fontFamily),
|
|
205
|
-
bold:
|
|
206
|
-
italic:
|
|
205
|
+
bold: zt(t.fontWeight) >= 600 ? !0 : void 0,
|
|
206
|
+
italic: Tt(t.fontStyle) === "italic" ? !0 : void 0
|
|
207
207
|
};
|
|
208
208
|
}
|
|
209
209
|
const ft = (t) => Ft(t) / Pt;
|
|
210
|
-
function
|
|
211
|
-
const e = t.richText && t.richText.length > 0, r =
|
|
210
|
+
function _t(t, n) {
|
|
211
|
+
const e = t.richText && t.richText.length > 0, r = _(t.textAlign, e ? "ctr" : "l");
|
|
212
212
|
return {
|
|
213
213
|
paragraphs: e ? ct(t.richText, r, n, { fontSize: t.fontSize || 20, fontFamily: t.fontFamily || "sans-serif" }) : at(t.text || "", r),
|
|
214
214
|
anchor: st(t.verticalAlign),
|
|
@@ -221,7 +221,7 @@ function Ut(t, n) {
|
|
|
221
221
|
function ut(t, n) {
|
|
222
222
|
const e = t.richContainerText && t.richContainerText.length > 0;
|
|
223
223
|
if (!e && !t.containerText) return;
|
|
224
|
-
const r =
|
|
224
|
+
const r = _(t.textAlign, "ctr");
|
|
225
225
|
return {
|
|
226
226
|
paragraphs: e ? ct(t.richContainerText, r, n, { fontSize: t.fontSize || 28, fontFamily: t.fontFamily || "hand-drawn" }) : at(t.containerText, r),
|
|
227
227
|
anchor: st(t.verticalAlign),
|
|
@@ -231,9 +231,9 @@ function ut(t, n) {
|
|
|
231
231
|
defaults: lt(t, n, t.fontSize || 16)
|
|
232
232
|
};
|
|
233
233
|
}
|
|
234
|
-
function
|
|
234
|
+
function Zt(t, n, e) {
|
|
235
235
|
const r = [], i = Math.abs(n) / 2, o = Math.abs(e) / 2, l = (a, s, c) => {
|
|
236
|
-
const u = C(
|
|
236
|
+
const u = C(P(a), i, o);
|
|
237
237
|
if (u.length === 0) return;
|
|
238
238
|
const h = s, p = { fill: h.noFill ? !1 : void 0, stroke: h.noStroke ? !1 : void 0 };
|
|
239
239
|
if (c) {
|
|
@@ -268,11 +268,11 @@ function _t(t, n, e) {
|
|
|
268
268
|
};
|
|
269
269
|
return f(t), r;
|
|
270
270
|
}
|
|
271
|
-
function
|
|
271
|
+
function Gt(t) {
|
|
272
272
|
if (t.warp || t.points && t.points.length) return null;
|
|
273
273
|
if (t.type === "circle") return { kind: "preset", prst: "ellipse" };
|
|
274
274
|
if (t.type === "rectangle") {
|
|
275
|
-
const [n, e, r, i] =
|
|
275
|
+
const [n, e, r, i] = $t(t);
|
|
276
276
|
if (!n && !e && !r && !i) return { kind: "preset", prst: "rect" };
|
|
277
277
|
if (n === e && e === r && r === i) {
|
|
278
278
|
const o = Math.min(Math.abs(t.width), Math.abs(t.height));
|
|
@@ -281,10 +281,10 @@ function Zt(t) {
|
|
|
281
281
|
}
|
|
282
282
|
return null;
|
|
283
283
|
}
|
|
284
|
-
const
|
|
285
|
-
function
|
|
284
|
+
const qt = /* @__PURE__ */ new Set(["umlClass", "umlInterface", "qrCode", "video", "codeBlock"]), Vt = /* @__PURE__ */ new Set(["fineliner", "inkbrush", "marker", "ink"]), Jt = /* @__PURE__ */ new Set(["text", "richtext", "image", "line", "arrow"]);
|
|
285
|
+
function Kt(t) {
|
|
286
286
|
const n = t;
|
|
287
|
-
if (
|
|
287
|
+
if (qt.has(t.type) || t.clipMaskId || t.shadowEnabled || t.glowEnabled || (t.featherRadius ?? 0) > 0 || t.blendMode && t.blendMode !== "normal" || t.shearX || t.shearY || kt(t) || bt(t) || Mt(t) || wt(t) || t.appearance && (t.appearance.fills?.length ?? 0) + (t.appearance.strokes?.length ?? 0) > 0) return !0;
|
|
288
288
|
const e = t.fillStyle;
|
|
289
289
|
if (e === "image" || e === "mesh" || e === "pattern" || t.backgroundImage || t.curvedText || (t.type === "text" || t.type === "richtext") && (t.verticalText || (n.charTransforms?.length ?? 0) > 0)) return !0;
|
|
290
290
|
if (t.type === "image") {
|
|
@@ -305,7 +305,7 @@ function K(t) {
|
|
|
305
305
|
return null;
|
|
306
306
|
}
|
|
307
307
|
}
|
|
308
|
-
function
|
|
308
|
+
function Z(t) {
|
|
309
309
|
if (!t) return null;
|
|
310
310
|
const n = K(t);
|
|
311
311
|
if (n && n.mime === "image/png") return { bytes: n.bytes, ext: "png" };
|
|
@@ -322,18 +322,18 @@ function _(t) {
|
|
|
322
322
|
return null;
|
|
323
323
|
}
|
|
324
324
|
}
|
|
325
|
-
const
|
|
326
|
-
function
|
|
325
|
+
const v = (t) => t.name || t.type;
|
|
326
|
+
function O(t, n) {
|
|
327
327
|
const e = Math.abs(t.width), r = Math.abs(t.height), i = Math.min(t.x, t.x + t.width) - n.ox, o = Math.min(t.y, t.y + t.height) - n.oy;
|
|
328
328
|
return { x: i, y: o, w: e, h: r, rot: t.angle ? t.angle * 180 / Math.PI : void 0, flipH: !!t.flipX || void 0, flipV: !!t.flipY || void 0 };
|
|
329
329
|
}
|
|
330
|
-
function
|
|
331
|
-
const r = n.hooks.rasterize(t), i = r ?
|
|
330
|
+
function H(t, n, e) {
|
|
331
|
+
const r = n.hooks.rasterize(t), i = r ? Z(r.dataURL) : null;
|
|
332
332
|
return !r || !i ? [] : (n.report.pictures++, [{ kind: "picture", id: n.nextId++, name: e, x: r.x - n.ox, y: r.y - n.oy, w: r.width, h: r.height, media: i }]);
|
|
333
333
|
}
|
|
334
|
-
function
|
|
335
|
-
const e =
|
|
336
|
-
if (!e) return
|
|
334
|
+
function Qt(t, n) {
|
|
335
|
+
const e = Z(t.dataURL);
|
|
336
|
+
if (!e) return H([t], n, v(t));
|
|
337
337
|
let r;
|
|
338
338
|
if (t.crop) {
|
|
339
339
|
const o = t.dataURL ? rt(t.dataURL) : null, l = o?.naturalWidth, f = o?.naturalHeight;
|
|
@@ -343,9 +343,9 @@ function Kt(t, n) {
|
|
|
343
343
|
}
|
|
344
344
|
}
|
|
345
345
|
const i = (t.opacity ?? 100) / 100;
|
|
346
|
-
return n.report.native++, [{ kind: "picture", id: n.nextId++, name:
|
|
346
|
+
return n.report.native++, [{ kind: "picture", id: n.nextId++, name: v(t), ...O(t, n), media: e, crop: r, alpha: i < 1 ? i : void 0, descr: t.altText }];
|
|
347
347
|
}
|
|
348
|
-
function
|
|
348
|
+
function tn(t, n, e, r) {
|
|
349
349
|
const i = ut(t, r);
|
|
350
350
|
if (!i) return [];
|
|
351
351
|
const o = t.fontSize || 16, l = (t.containerText || "").split(`
|
|
@@ -355,7 +355,7 @@ function Qt(t, n, e, r) {
|
|
|
355
355
|
}), [{
|
|
356
356
|
kind: "shape",
|
|
357
357
|
id: e.nextId++,
|
|
358
|
-
name: `${
|
|
358
|
+
name: `${v(t)} label`,
|
|
359
359
|
textBox: !0,
|
|
360
360
|
x: n.x - e.ox - a / 2,
|
|
361
361
|
y: n.y - e.oy - s / 2,
|
|
@@ -367,7 +367,7 @@ function Qt(t, n, e, r) {
|
|
|
367
367
|
text: i
|
|
368
368
|
}];
|
|
369
369
|
}
|
|
370
|
-
function
|
|
370
|
+
function nn(t, n, e) {
|
|
371
371
|
const r = t.x + t.w / 2, i = t.y + t.h / 2, o = (t.rot || 0) * Math.PI / 180, l = [[0, -t.h / 2], [-t.w / 2, 0], [0, t.h / 2], [t.w / 2, 0]], f = n.x - e.ox, a = n.y - e.oy;
|
|
372
372
|
for (let s = 0; s < 4; s++) {
|
|
373
373
|
let [c, u] = l[s];
|
|
@@ -377,21 +377,21 @@ function tn(t, n, e) {
|
|
|
377
377
|
}
|
|
378
378
|
return -1;
|
|
379
379
|
}
|
|
380
|
-
function
|
|
380
|
+
function en(t, n, e) {
|
|
381
381
|
const r = e.x - n.x, i = e.y - n.y, o = Math.hypot(r, i);
|
|
382
382
|
if (!(o > 0)) return !1;
|
|
383
383
|
const l = (s, c) => Math.abs((s - n.x) * i - (c - n.y) * r) / o, f = (s, c) => ((s - n.x) * r + (c - n.y) * i) / (o * o), a = (s, c) => l(s, c) <= 0.5 && f(s, c) >= -0.01 && f(s, c) <= 1.01;
|
|
384
384
|
return t.every((s) => s.op === "Z" ? !1 : s.op === "C" ? a(s.x1, s.y1) && a(s.x2, s.y2) && a(s.x, s.y) : a(s.x, s.y));
|
|
385
385
|
}
|
|
386
|
-
function
|
|
387
|
-
const e = (t.opacity ?? 100) / 100, r =
|
|
386
|
+
function rn(t, n) {
|
|
387
|
+
const e = (t.opacity ?? 100) / 100, r = U(t, e, !0), i = vt(t), o = [];
|
|
388
388
|
if (r) {
|
|
389
389
|
const l = t.type === "arrow", f = l ? t.startArrowhead : null, a = l ? t.endArrowhead || (t.startArrowhead ? null : "arrow") : null, s = { ...r, head: J(f, G(t, "start"), t.strokeWidth), tail: J(a, G(t, "end"), t.strokeWidth) };
|
|
390
|
-
if (!i.d ||
|
|
390
|
+
if (!i.d || en(P(i.d), i.start, i.end)) {
|
|
391
391
|
const { start: c, end: u } = i, h = {
|
|
392
392
|
kind: "connector",
|
|
393
393
|
id: n.nextId++,
|
|
394
|
-
name:
|
|
394
|
+
name: v(t),
|
|
395
395
|
x: Math.min(c.x, u.x) - n.ox,
|
|
396
396
|
y: Math.min(c.y, u.y) - n.oy,
|
|
397
397
|
w: Math.abs(u.x - c.x),
|
|
@@ -403,20 +403,20 @@ function en(t, n) {
|
|
|
403
403
|
}, p = (d, x) => {
|
|
404
404
|
const g = d?.elementId ? n.ids.get(d.elementId) : void 0;
|
|
405
405
|
if (!g) return;
|
|
406
|
-
const k =
|
|
406
|
+
const k = nn(g.item, x, n);
|
|
407
407
|
return k >= 0 ? { id: g.id, idx: k } : void 0;
|
|
408
408
|
};
|
|
409
409
|
n.glue.push(() => {
|
|
410
410
|
h.start = p(t.startBinding, c), h.end = p(t.endBinding, u);
|
|
411
411
|
}), o.push(h);
|
|
412
412
|
} else {
|
|
413
|
-
const c =
|
|
413
|
+
const c = P(i.d), u = N(c);
|
|
414
414
|
if (u) {
|
|
415
415
|
const h = Math.max(u.maxX - u.minX, 0.01), p = Math.max(u.maxY - u.minY, 0.01);
|
|
416
416
|
o.push({
|
|
417
417
|
kind: "shape",
|
|
418
418
|
id: n.nextId++,
|
|
419
|
-
name:
|
|
419
|
+
name: v(t),
|
|
420
420
|
x: u.minX - n.ox,
|
|
421
421
|
y: u.minY - n.oy,
|
|
422
422
|
w: h,
|
|
@@ -429,17 +429,17 @@ function en(t, n) {
|
|
|
429
429
|
}
|
|
430
430
|
n.report.native++;
|
|
431
431
|
}
|
|
432
|
-
return o.push(...
|
|
432
|
+
return o.push(...tn(t, i.mid, n, e)), o;
|
|
433
433
|
}
|
|
434
|
-
function
|
|
435
|
-
const e = (t.opacity ?? 100) / 100, r =
|
|
434
|
+
function on(t, n) {
|
|
435
|
+
const e = (t.opacity ?? 100) / 100, r = St(t.points), i = U(t, e, !0);
|
|
436
436
|
if (r.length < 2 || !i) return [];
|
|
437
437
|
i.cap = "rnd", i.join = "round";
|
|
438
438
|
const o = r.map((h) => h.x), l = r.map((h) => h.y), f = Math.min(...o), a = Math.min(...l), s = Math.max(Math.max(...o) - f, 0.01), c = Math.max(Math.max(...l) - a, 0.01), u = r.map((h, p) => ({ op: p ? "L" : "M", x: h.x - f, y: h.y - a }));
|
|
439
439
|
return n.report.native++, [{
|
|
440
440
|
kind: "shape",
|
|
441
441
|
id: n.nextId++,
|
|
442
|
-
name:
|
|
442
|
+
name: v(t),
|
|
443
443
|
x: t.x + f - n.ox,
|
|
444
444
|
y: t.y + a - n.oy,
|
|
445
445
|
w: s,
|
|
@@ -450,29 +450,29 @@ function rn(t, n) {
|
|
|
450
450
|
line: i
|
|
451
451
|
}];
|
|
452
452
|
}
|
|
453
|
-
function
|
|
453
|
+
function sn(t, n) {
|
|
454
454
|
const e = (t.opacity ?? 100) / 100;
|
|
455
455
|
if (!(t.text || t.richText && t.richText.length > 0)) return [];
|
|
456
456
|
n.report.native++;
|
|
457
|
-
const i =
|
|
457
|
+
const i = A(t.backgroundColor, e);
|
|
458
458
|
return [{
|
|
459
459
|
kind: "shape",
|
|
460
460
|
id: n.nextId++,
|
|
461
|
-
name:
|
|
462
|
-
...
|
|
461
|
+
name: v(t),
|
|
462
|
+
...O(t, n),
|
|
463
463
|
textBox: !0,
|
|
464
464
|
geom: { kind: "preset", prst: "rect" },
|
|
465
465
|
fill: i ? { kind: "solid", color: i } : { kind: "none" },
|
|
466
466
|
line: null,
|
|
467
|
-
text:
|
|
467
|
+
text: _t(t, e)
|
|
468
468
|
}];
|
|
469
469
|
}
|
|
470
|
-
const
|
|
470
|
+
const an = (t) => {
|
|
471
471
|
const n = t && /matrix\(([^)]+)\)/.exec(t), e = n ? n[1].split(/[\s,]+/).map(Number) : [];
|
|
472
472
|
return e.length === 6 && e.every(Number.isFinite) ? e : [1, 0, 0, 1, 0, 0];
|
|
473
473
|
}, Q = (t, n, e) => ({ x: t[0] * n + t[2] * e + t[4], y: t[1] * n + t[3] * e + t[5] });
|
|
474
|
-
function
|
|
475
|
-
const n =
|
|
474
|
+
function cn(t) {
|
|
475
|
+
const n = Et.generator(), e = (i) => {
|
|
476
476
|
for (const o of n.toPaths(i))
|
|
477
477
|
t.save(), o.fill && o.fill !== "none" && (!o.stroke || o.stroke === "none") ? (t.fillStyle = o.fill, t.fillPath(o.d)) : o.stroke && o.stroke !== "none" && o.strokeWidth > 0 && (t.strokeStyle = o.stroke, t.lineWidth = o.strokeWidth, t.strokePath(o.d)), t.restore();
|
|
478
478
|
return i;
|
|
@@ -481,7 +481,7 @@ function an(t) {
|
|
|
481
481
|
r[i] = (...o) => e(n[i](...o));
|
|
482
482
|
return r;
|
|
483
483
|
}
|
|
484
|
-
function
|
|
484
|
+
function ln(t) {
|
|
485
485
|
const n = t.fillStyle, e = {
|
|
486
486
|
...t,
|
|
487
487
|
renderStyle: "architectural",
|
|
@@ -493,11 +493,11 @@ function cn(t) {
|
|
|
493
493
|
containerText: void 0,
|
|
494
494
|
richContainerText: void 0,
|
|
495
495
|
// Hatching is re-created as a pattern fill on the body; recording it would be hundreds of lines.
|
|
496
|
-
fillStyle:
|
|
497
|
-
}, r = new
|
|
496
|
+
fillStyle: W[n] ? "solid" : t.fillStyle
|
|
497
|
+
}, r = new It();
|
|
498
498
|
try {
|
|
499
499
|
const s = document.createElement("canvas");
|
|
500
|
-
|
|
500
|
+
Ct(cn(r), s.getContext("2d"), e, !1, 1, r);
|
|
501
501
|
} catch {
|
|
502
502
|
return null;
|
|
503
503
|
}
|
|
@@ -507,7 +507,7 @@ function cn(t) {
|
|
|
507
507
|
const o = (s, c) => {
|
|
508
508
|
const u = i.get(s.replace(/^url\(#|\)$/g, ""));
|
|
509
509
|
if (!u) return null;
|
|
510
|
-
const h = Array.from(u.children).map((p) => ({ pos: +(p.getAttribute("offset") || 0), color:
|
|
510
|
+
const h = Array.from(u.children).map((p) => ({ pos: +(p.getAttribute("offset") || 0), color: A(p.getAttribute("stop-color")) ?? { hex: "#000000", alpha: 0 } }));
|
|
511
511
|
if (!h.length) return null;
|
|
512
512
|
if (u.tagName.toLowerCase() === "lineargradient") {
|
|
513
513
|
const p = Q(c, +u.getAttribute("x1"), +u.getAttribute("y1")), d = Q(c, +u.getAttribute("x2"), +u.getAttribute("y2"));
|
|
@@ -535,13 +535,13 @@ function cn(t) {
|
|
|
535
535
|
let h = null;
|
|
536
536
|
if (u === "path") h = c.getAttribute("d");
|
|
537
537
|
else if (u === "rect") {
|
|
538
|
-
const b = +c.getAttribute("x"), M = +c.getAttribute("y"), w = +c.getAttribute("width"),
|
|
539
|
-
h = `M ${b} ${M} L ${b + w} ${M} L ${b + w} ${M +
|
|
538
|
+
const b = +c.getAttribute("x"), M = +c.getAttribute("y"), w = +c.getAttribute("width"), S = +c.getAttribute("height");
|
|
539
|
+
h = `M ${b} ${M} L ${b + w} ${M} L ${b + w} ${M + S} L ${b} ${M + S} Z`;
|
|
540
540
|
} else {
|
|
541
541
|
f = "fail";
|
|
542
542
|
return;
|
|
543
543
|
}
|
|
544
|
-
const p =
|
|
544
|
+
const p = an(c.getAttribute("transform")), d = Xt(P(h || ""), p);
|
|
545
545
|
if (!d.length) continue;
|
|
546
546
|
const x = c.getAttribute("fill"), g = c.getAttribute("stroke"), k = !!x && x.startsWith("url("), m = +(c.getAttribute("fill-opacity") ?? 1), y = +(c.getAttribute("stroke-opacity") ?? 1);
|
|
547
547
|
l.push({
|
|
@@ -564,7 +564,7 @@ const tt = (t, n) => {
|
|
|
564
564
|
const e = T(t), r = T(n);
|
|
565
565
|
return !!e && !!r && e[0] === r[0] && e[1] === r[1] && e[2] === r[2];
|
|
566
566
|
};
|
|
567
|
-
function
|
|
567
|
+
function fn(t, n, e) {
|
|
568
568
|
const r = t.stops.map((d) => ({ pos: d.pos, color: e < 1 ? { ...d.color, alpha: (d.color.alpha ?? 1) * e } : d.color }));
|
|
569
569
|
if (t.kind === "radial") return { kind: "radial", stops: r };
|
|
570
570
|
const i = t.x2 - t.x1, o = t.y2 - t.y1, l = Math.hypot(i, o);
|
|
@@ -580,13 +580,13 @@ function dt(t) {
|
|
|
580
580
|
if (e <= t[0].pos) return t[0].color;
|
|
581
581
|
for (let r = 1; r < t.length; r++) {
|
|
582
582
|
const i = t[r - 1], o = t[r];
|
|
583
|
-
if (e <= o.pos) return
|
|
583
|
+
if (e <= o.pos) return yn(i.color, o.color, o.pos > i.pos ? (e - i.pos) / (o.pos - i.pos) : 0);
|
|
584
584
|
}
|
|
585
585
|
return t[t.length - 1].color;
|
|
586
586
|
};
|
|
587
587
|
return [{ pos: 0, color: n(0) }, ...t.filter((e) => e.pos > 0 && e.pos < 1), { pos: 1, color: n(1) }];
|
|
588
588
|
}
|
|
589
|
-
function
|
|
589
|
+
function j(t) {
|
|
590
590
|
if (t.fill === !1) return [t];
|
|
591
591
|
const n = [];
|
|
592
592
|
for (const i of t.cmds)
|
|
@@ -596,84 +596,84 @@ function H(t) {
|
|
|
596
596
|
return t.stroke !== !1 && r.push({ cmds: t.cmds, fill: !1, stroke: t.stroke }), r;
|
|
597
597
|
}
|
|
598
598
|
const E = (t) => JSON.stringify(t.cmds);
|
|
599
|
-
function
|
|
600
|
-
const e = (t.opacity ?? 100) / 100, r =
|
|
601
|
-
let o =
|
|
599
|
+
function un(t, n) {
|
|
600
|
+
const e = (t.opacity ?? 100) / 100, r = O(t, n), i = ut(t, e);
|
|
601
|
+
let o = Gt(t);
|
|
602
602
|
if (!o) {
|
|
603
|
-
const f =
|
|
603
|
+
const f = At(t), a = f ? Zt(f, t.width, t.height) : [], s = ln(t);
|
|
604
604
|
if (s === "picture") return null;
|
|
605
605
|
if (s && s.length) {
|
|
606
606
|
const c = Math.min(t.x, t.x + t.width), u = Math.min(t.y, t.y + t.height), h = a.length ? a.filter((m) => m.fill !== !1).map((m) => C(m.cmds, c, u)) : null, p = !!it(t), d = ["linear", "radial", "conic"].includes(t.fillStyle);
|
|
607
607
|
if (!s.every((m) => (!m.grad || d) && m.fillAlpha >= 1 && m.strokeAlpha >= 1 && (!m.fill || tt(m.fill, t.backgroundColor)) && (!m.stroke || tt(m.stroke, t.strokeColor) && Math.abs(m.width - t.strokeWidth) < 0.75 && m.dash === p))) {
|
|
608
|
-
const m =
|
|
608
|
+
const m = hn(t, s, r, i, n, e, h);
|
|
609
609
|
return m ? [m] : null;
|
|
610
610
|
}
|
|
611
611
|
const g = [], k = (m) => C(m, -c, -u);
|
|
612
612
|
for (let m = 0; m < s.length; m++) {
|
|
613
613
|
const y = s[m], b = s[m + 1], M = !!((y.fill || y.grad) && !y.stroke && b && b.stroke && !b.fill && !b.grad && E(b) === E(y)), w = !!y.stroke || M;
|
|
614
614
|
if (y.fill || y.grad) {
|
|
615
|
-
const
|
|
616
|
-
if (!
|
|
617
|
-
|
|
615
|
+
const S = ht(y, h);
|
|
616
|
+
if (!S) return null;
|
|
617
|
+
S.length === 1 && S[0] === y.cmds ? g.push(...j({ cmds: k(y.cmds), stroke: w ? void 0 : !1 })) : (g.push(...S.map((R) => ({ cmds: k(R), stroke: !1 }))), w && g.push({ cmds: k(y.cmds), fill: !1 }));
|
|
618
618
|
} else
|
|
619
619
|
g.push({ cmds: k(y.cmds), fill: !1, stroke: w ? void 0 : !1 });
|
|
620
620
|
M && m++;
|
|
621
621
|
}
|
|
622
622
|
o = { kind: "custom", paths: g };
|
|
623
623
|
} else if (a.length)
|
|
624
|
-
o = { kind: "custom", paths: a.flatMap(
|
|
624
|
+
o = { kind: "custom", paths: a.flatMap(j) };
|
|
625
625
|
else return null;
|
|
626
626
|
}
|
|
627
627
|
const l = {
|
|
628
628
|
kind: "shape",
|
|
629
629
|
id: n.nextId++,
|
|
630
|
-
name:
|
|
630
|
+
name: v(t),
|
|
631
631
|
...r,
|
|
632
632
|
geom: o,
|
|
633
|
-
fill:
|
|
634
|
-
line:
|
|
633
|
+
fill: Ht(t, e),
|
|
634
|
+
line: U(t, e),
|
|
635
635
|
text: i
|
|
636
636
|
};
|
|
637
637
|
return n.ids.set(t.id, { id: l.id, item: l }), n.report.native++, [l];
|
|
638
638
|
}
|
|
639
|
-
const
|
|
640
|
-
let
|
|
641
|
-
const
|
|
642
|
-
function
|
|
643
|
-
|
|
639
|
+
const dn = (t) => t.map((n) => n.op === "Z" ? "Z" : n.op === "C" ? `C ${n.x1} ${n.y1} ${n.x2} ${n.y2} ${n.x} ${n.y}` : `${n.op} ${n.x} ${n.y}`).join(" ");
|
|
640
|
+
let B = null;
|
|
641
|
+
const F = 28;
|
|
642
|
+
function Y(t, n, e) {
|
|
643
|
+
B ??= document.createElement("canvas").getContext("2d");
|
|
644
644
|
const r = [];
|
|
645
|
-
if (!
|
|
646
|
-
const i = t.map((o) => new Path2D(
|
|
647
|
-
for (let o = 0; o <
|
|
648
|
-
const f = e.minX + (l + 0.5) /
|
|
649
|
-
r.push(i.some((s) =>
|
|
645
|
+
if (!B) return r;
|
|
646
|
+
const i = t.map((o) => new Path2D(dn(o)));
|
|
647
|
+
for (let o = 0; o < F; o++) for (let l = 0; l < F; l++) {
|
|
648
|
+
const f = e.minX + (l + 0.5) / F * (e.maxX - e.minX), a = e.minY + (o + 0.5) / F * (e.maxY - e.minY);
|
|
649
|
+
r.push(i.some((s) => B.isPointInPath(s, f, a, n)));
|
|
650
650
|
}
|
|
651
651
|
return r;
|
|
652
652
|
}
|
|
653
653
|
const nt = (t, n) => t.reduce((e, r, i) => e + (r !== n[i] ? 1 : 0), 0) / Math.max(1, t.length);
|
|
654
654
|
function ht(t, n) {
|
|
655
655
|
if (t.evenOdd) return [t.cmds];
|
|
656
|
-
const e =
|
|
656
|
+
const e = N(t.cmds);
|
|
657
657
|
if (!e) return [t.cmds];
|
|
658
|
-
const r =
|
|
659
|
-
return nt(r,
|
|
658
|
+
const r = Y([t.cmds], "nonzero", e);
|
|
659
|
+
return nt(r, Y([t.cmds], "evenodd", e)) === 0 ? [t.cmds] : n && nt(r, Y(n, "evenodd", e)) <= 0.03 ? n : null;
|
|
660
660
|
}
|
|
661
|
-
function
|
|
661
|
+
function hn(t, n, e, r, i, o, l) {
|
|
662
662
|
const f = [];
|
|
663
663
|
for (let a = 0; a < n.length; a++) {
|
|
664
|
-
const s = n[a], c = n[a + 1], u = !!((s.fill || s.grad) && !s.stroke && c && c.stroke && !c.fill && !c.grad && E(c) === E(s)), h = u ? c : s, p =
|
|
664
|
+
const s = n[a], c = n[a + 1], u = !!((s.fill || s.grad) && !s.stroke && c && c.stroke && !c.fill && !c.grad && E(c) === E(s)), h = u ? c : s, p = N(s.cmds);
|
|
665
665
|
if (!p) continue;
|
|
666
|
-
const d = Math.max(p.maxX - p.minX, 0.01), x = Math.max(p.maxY - p.minY, 0.01), g =
|
|
666
|
+
const d = Math.max(p.maxX - p.minX, 0.01), x = Math.max(p.maxY - p.minY, 0.01), g = A(s.fill, o * s.fillAlpha), k = s.grad ? fn(s.grad, p, o) : g ? { kind: "solid", color: g } : { kind: "none" }, m = A(h.stroke, o * h.strokeAlpha), y = m ? { width: h.width, color: m, dash: h.dash ? "dash" : void 0, join: "round", cap: "rnd" } : null, b = !!(s.fill || s.grad), M = (S) => C(S, -p.minX, -p.minY);
|
|
667
667
|
let w;
|
|
668
668
|
if (b) {
|
|
669
|
-
const
|
|
670
|
-
if (!
|
|
671
|
-
w =
|
|
669
|
+
const S = ht(s, l);
|
|
670
|
+
if (!S) return null;
|
|
671
|
+
w = S.length === 1 && S[0] === s.cmds ? j({ cmds: M(s.cmds), stroke: m ? void 0 : !1 }) : [...S.map((R) => ({ cmds: M(R), stroke: !1 })), ...m ? [{ cmds: M(s.cmds), fill: !1 }] : []];
|
|
672
672
|
} else w = [{ cmds: M(s.cmds), fill: !1, stroke: m ? void 0 : !1 }];
|
|
673
673
|
f.push({
|
|
674
674
|
kind: "shape",
|
|
675
675
|
id: i.nextId++,
|
|
676
|
-
name: `${
|
|
676
|
+
name: `${v(t)} part`,
|
|
677
677
|
x: p.minX - i.ox,
|
|
678
678
|
y: p.minY - i.oy,
|
|
679
679
|
w: d,
|
|
@@ -686,7 +686,7 @@ function dn(t, n, e, r, i, o, l) {
|
|
|
686
686
|
return r && f.push({
|
|
687
687
|
kind: "shape",
|
|
688
688
|
id: i.nextId++,
|
|
689
|
-
name: `${
|
|
689
|
+
name: `${v(t)} label`,
|
|
690
690
|
textBox: !0,
|
|
691
691
|
x: e.x,
|
|
692
692
|
y: e.y,
|
|
@@ -696,22 +696,24 @@ function dn(t, n, e, r, i, o, l) {
|
|
|
696
696
|
fill: { kind: "none" },
|
|
697
697
|
line: null,
|
|
698
698
|
text: r
|
|
699
|
-
}), i.report.native++, { kind: "group", id: i.nextId++, name:
|
|
699
|
+
}), i.report.native++, { kind: "group", id: i.nextId++, name: v(t), ...e, children: f };
|
|
700
700
|
}
|
|
701
|
-
function
|
|
702
|
-
if (
|
|
701
|
+
function pn(t, n) {
|
|
702
|
+
if (Kt(t)) return H([t], n, v(t));
|
|
703
703
|
try {
|
|
704
|
-
if (t.type === "
|
|
705
|
-
|
|
706
|
-
if (t.type === "
|
|
707
|
-
if (
|
|
708
|
-
if (
|
|
709
|
-
|
|
704
|
+
if (t.type === "chart")
|
|
705
|
+
return n.report.native++, [{ kind: "chart", id: n.nextId++, name: v(t), ...O(t, n), chart: gt(t.chart) }];
|
|
706
|
+
if (t.type === "text" || t.type === "richtext") return sn(t, n);
|
|
707
|
+
if (t.type === "image") return Qt(t, n);
|
|
708
|
+
if (t.type === "line" || t.type === "arrow") return rn(t, n);
|
|
709
|
+
if (Vt.has(t.type)) return on(t, n);
|
|
710
|
+
if (!Jt.has(t.type)) {
|
|
711
|
+
const e = un(t, n);
|
|
710
712
|
if (e) return e;
|
|
711
713
|
}
|
|
712
714
|
} catch {
|
|
713
715
|
}
|
|
714
|
-
return
|
|
716
|
+
return H([t], n, v(t));
|
|
715
717
|
}
|
|
716
718
|
function pt(t, n, e) {
|
|
717
719
|
const r = [];
|
|
@@ -723,10 +725,10 @@ function pt(t, n, e) {
|
|
|
723
725
|
for (; i < t.length; ) {
|
|
724
726
|
const l = o(t[i]);
|
|
725
727
|
if (!l) {
|
|
726
|
-
let s =
|
|
727
|
-
const c =
|
|
728
|
+
let s = pn(t[i], e);
|
|
729
|
+
const c = kn(t[i].link);
|
|
728
730
|
if (c) for (const u of s) u.link = c;
|
|
729
|
-
e.animTargets && t[i].animations?.length && s.length > 1 && (s = [{ kind: "group", id: e.nextId++, name:
|
|
731
|
+
e.animTargets && t[i].animations?.length && s.length > 1 && (s = [{ kind: "group", id: e.nextId++, name: v(t[i]), ...et(s), children: s }]), e.animTargets && s.length === 1 && e.animTargets.set(t[i].id, s[0].id), r.push(...s), i++;
|
|
730
732
|
continue;
|
|
731
733
|
}
|
|
732
734
|
let f = i;
|
|
@@ -746,7 +748,7 @@ function et(t) {
|
|
|
746
748
|
n = Math.min(n, o.x), e = Math.min(e, o.y), r = Math.max(r, o.x + o.w), i = Math.max(i, o.y + o.h);
|
|
747
749
|
return { x: n, y: e, w: Math.max(0, r - n), h: Math.max(0, i - e) };
|
|
748
750
|
}
|
|
749
|
-
function
|
|
751
|
+
function mn(t) {
|
|
750
752
|
if (!t || t.type === "none") return;
|
|
751
753
|
const n = t.duration ?? 500;
|
|
752
754
|
switch (t.type) {
|
|
@@ -770,61 +772,61 @@ function pn(t) {
|
|
|
770
772
|
return;
|
|
771
773
|
}
|
|
772
774
|
}
|
|
773
|
-
function
|
|
775
|
+
function xn(t, n) {
|
|
774
776
|
const e = t.slide;
|
|
775
777
|
if (!e) {
|
|
776
|
-
const f =
|
|
778
|
+
const f = A(t.background);
|
|
777
779
|
return f ? { kind: "solid", color: f } : void 0;
|
|
778
780
|
}
|
|
779
781
|
const r = e.fillStyle || "solid", i = !e.backgroundImage && (!e.canvasTexture || e.canvasTexture === "none");
|
|
780
782
|
if (i && r === "solid")
|
|
781
|
-
return { kind: "solid", color:
|
|
783
|
+
return { kind: "solid", color: A(e.backgroundColor === "transparent" ? "#ffffff" : e.backgroundColor || "#ffffff") ?? { hex: "#ffffff" } };
|
|
782
784
|
if (i && (r === "linear" || r === "radial") && (e.gradientStops?.length ?? 0) > 0) {
|
|
783
|
-
const f = e.gradientDirection || 0, a = e.gradientStops.map((s) => ({ pos: s.offset, color:
|
|
784
|
-
return r === "radial" ? { kind: "radial", stops: a } : { kind: "linear", stops:
|
|
785
|
+
const f = e.gradientDirection || 0, a = e.gradientStops.map((s) => ({ pos: s.offset, color: A(s.color) ?? { hex: "#ffffff" } }));
|
|
786
|
+
return r === "radial" ? { kind: "radial", stops: a } : { kind: "linear", stops: gn(a, f, t.w, t.h), angle: f };
|
|
785
787
|
}
|
|
786
|
-
const o = n.rasterizeBackground?.(e), l = o ?
|
|
787
|
-
return l ? { kind: "image", media: l } : { kind: "solid", color:
|
|
788
|
+
const o = n.rasterizeBackground?.(e), l = o ? Z(o) : null;
|
|
789
|
+
return l ? { kind: "image", media: l } : { kind: "solid", color: A(e.backgroundColor) ?? { hex: "#ffffff" } };
|
|
788
790
|
}
|
|
789
|
-
function
|
|
791
|
+
function gn(t, n, e, r) {
|
|
790
792
|
const i = n * Math.PI / 180, o = Math.hypot(e, r) / 2, l = (Math.abs(e * Math.cos(i)) + Math.abs(r * Math.sin(i))) / 2;
|
|
791
793
|
if (!(l > 0) || t.length < 2) return t;
|
|
792
794
|
const f = [...t].sort((a, s) => a.pos - s.pos).map((a) => ({ pos: (-o + 2 * o * a.pos + l) / (2 * l), color: a.color }));
|
|
793
795
|
return dt(f);
|
|
794
796
|
}
|
|
795
|
-
function
|
|
797
|
+
function yn(t, n, e) {
|
|
796
798
|
const r = T(t.hex), i = T(n.hex), o = [0, 1, 2].map((s) => Math.round(r[s] + (i[s] - r[s]) * e)), l = t.alpha ?? 1, f = n.alpha ?? 1, a = l + (f - l) * e;
|
|
797
799
|
return a < 0.999 ? { hex: L(o), alpha: a } : { hex: L(o) };
|
|
798
800
|
}
|
|
799
|
-
function
|
|
800
|
-
const n =
|
|
801
|
+
function kn(t) {
|
|
802
|
+
const n = yt(t);
|
|
801
803
|
if (n.kind === "url") return { kind: "url", url: n.url };
|
|
802
804
|
if (n.kind === "slide") return { kind: "slide", key: n.slideId };
|
|
803
805
|
if (n.kind === "action") return { kind: "action", action: n.action };
|
|
804
806
|
}
|
|
805
|
-
function
|
|
807
|
+
function bn(t) {
|
|
806
808
|
return {
|
|
807
809
|
...t?.hidden && { hidden: !0 },
|
|
808
810
|
...t?.advanceAfter && t.advanceAfter > 0 && { advanceAfterMs: t.advanceAfter },
|
|
809
811
|
...t?.section && { section: t.section }
|
|
810
812
|
};
|
|
811
813
|
}
|
|
812
|
-
function
|
|
814
|
+
function An(t, n, e) {
|
|
813
815
|
const r = { ox: t.x, oy: t.y, nextId: 2, ids: /* @__PURE__ */ new Map(), glue: [], hooks: n, report: e, ...t.layers && { animTargets: /* @__PURE__ */ new Map() } }, i = pt(t.elements, 0, r);
|
|
814
816
|
r.glue.forEach((l) => l());
|
|
815
|
-
const o = t.layers && r.animTargets ?
|
|
817
|
+
const o = t.layers && r.animTargets ? Mn(t.elements, t.layers, r.animTargets, e) : [];
|
|
816
818
|
return {
|
|
817
819
|
name: t.name,
|
|
818
820
|
items: i,
|
|
819
|
-
background:
|
|
820
|
-
transition:
|
|
821
|
+
background: xn(t, n),
|
|
822
|
+
transition: mn(t.slide?.transition),
|
|
821
823
|
notes: t.slide?.notes?.trim() ? t.slide.notes : void 0,
|
|
822
824
|
key: t.slide?.id,
|
|
823
|
-
...
|
|
825
|
+
...bn(t.slide),
|
|
824
826
|
...o.length && { anims: o }
|
|
825
827
|
};
|
|
826
828
|
}
|
|
827
|
-
function
|
|
829
|
+
function Mn(t, n, e, r) {
|
|
828
830
|
const i = xt(t.filter((a) => !a.id.includes("@page")), n), o = [];
|
|
829
831
|
let l = 0;
|
|
830
832
|
for (const a of i) {
|
|
@@ -838,7 +840,7 @@ function bn(t, n, e, r) {
|
|
|
838
840
|
for (const a of [...o.filter((s) => s.load && !s.skip), ...o.filter((s) => !s.load && !s.skip)]) {
|
|
839
841
|
const s = /* @__PURE__ */ new Set();
|
|
840
842
|
a.steps.forEach((c, u) => {
|
|
841
|
-
const h = e.get(c.elementId), p = u === 0 ? a.load ? "with" : "click" : c.animation.trigger === "after-prev" ? "after" : "with", d = h !== void 0 ?
|
|
843
|
+
const h = e.get(c.elementId), p = u === 0 ? a.load ? "with" : "click" : c.animation.trigger === "after-prev" ? "after" : "with", d = h !== void 0 ? Rt(c.animation, h, p) : null;
|
|
842
844
|
if (!d) {
|
|
843
845
|
l++;
|
|
844
846
|
return;
|
|
@@ -849,17 +851,17 @@ function bn(t, n, e, r) {
|
|
|
849
851
|
}
|
|
850
852
|
return l && (r.animsSkipped = (r.animsSkipped ?? 0) + l), f;
|
|
851
853
|
}
|
|
852
|
-
function
|
|
854
|
+
function $n(t, n, e, r) {
|
|
853
855
|
const i = Math.min(e / Math.max(t, 1), r / Math.max(n, 1));
|
|
854
856
|
return { scale: i, dx: (e - t * i) / 2, dy: (r - n * i) / 2 };
|
|
855
857
|
}
|
|
856
858
|
export {
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
859
|
+
$n as fitInto,
|
|
860
|
+
Z as mediaOf,
|
|
861
|
+
An as pageToSlide,
|
|
862
|
+
gn as remapPageStops,
|
|
863
|
+
bn as showFields,
|
|
864
|
+
A as toColor,
|
|
865
|
+
mn as transitionOf,
|
|
864
866
|
ot as typefaceOf
|
|
865
867
|
};
|