@algorisys/yappydraw 0.8.292 → 0.8.294

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (29) hide show
  1. package/README.md +2 -2
  2. package/chunks/{canva-ai-DEXgo3RO.js → canva-ai-DqccAnxC.js} +1 -1
  3. package/chunks/{choice-dialog-state-DF7Hd13K.js → choice-dialog-state-10-yA9qy.js} +1 -1
  4. package/chunks/{custgeom-DK60FLyH.js → custgeom-gp_HWEYw.js} +13 -10
  5. package/chunks/{design-generator-dbNACXM-.js → design-generator-DIyJ4Dr0.js} +1 -1
  6. package/chunks/{drawing-engine-Dpuzo1lz.js → drawing-engine-nqE0zI8L.js} +1 -1
  7. package/chunks/{drawings-store-Day7j_Tw.js → drawings-store-BFtMld-q.js} +1 -1
  8. package/chunks/{ds-operations-DTBQ2jlO.js → ds-operations-40JYI4lM.js} +1 -1
  9. package/chunks/{export-game-B-Zaoh5a.js → export-game-5Kek7Bol.js} +1 -1
  10. package/chunks/{from-yappy-ChDOEKXM.js → from-yappy-ChRzxzZ9.js} +216 -206
  11. package/chunks/{game-runtime-A4EiMP-P.js → game-runtime--zmzKmmo.js} +37 -37
  12. package/chunks/import-DGbhv-Je.js +1699 -0
  13. package/chunks/{index-Dxj5fgvO.js → index-v2rH-W8-.js} +40141 -39505
  14. package/chunks/{lucide-solid-BXo3zhMX.js → lucide-solid-BHWkJbay.js} +1 -1
  15. package/chunks/markdown-to-slides-siI6fZd3.js +122 -0
  16. package/chunks/{morph-animator-mlVxvG9t.js → morph-animator-klLNQx0a.js} +1 -1
  17. package/chunks/{onboarding-tour-EDXLuYEp.js → onboarding-tour-CV0e3oyB.js} +1 -1
  18. package/chunks/{pdf-vector-OO6sbSA5.js → pdf-vector-DLxGyE10.js} +1 -1
  19. package/chunks/{search-C28u5fM2.js → search-53sGgwDp.js} +2 -2
  20. package/chunks/{slide-generator-BxoPBOpW.js → slide-generator-BttJgv2N.js} +1 -1
  21. package/chunks/{turntable-ai-BxllwIBP.js → turntable-ai-7udakZBz.js} +1 -1
  22. package/chunks/write-CIGfHqn4.js +254 -0
  23. package/chunks/yappy-CvwwkLs8.css +1 -0
  24. package/package.json +1 -1
  25. package/yappy.js +1 -1
  26. package/chunks/import-D8POTmPt.js +0 -1430
  27. package/chunks/markdown-to-slides-DdrONEUr.js +0 -96
  28. package/chunks/write-DbVLX69U.js +0 -212
  29. package/chunks/yappy-FCQs01wv.css +0 -1
@@ -1,17 +1,17 @@
1
- import { d as F, g as j, t as I, h as pt } from "./custgeom-DK60FLyH.js";
2
- import { a1 as et, a2 as mt, a3 as xt, a4 as gt, a5 as yt, a6 as kt, a7 as bt, a8 as G, a9 as Mt, aa as wt, ab as vt, ac as St, ad as At, ae as $t, af as Ct, ag as It, ah as Tt, ai as Pt, aj as zt, ak as Ft } from "./index-Dxj5fgvO.js";
3
- function Lt(t) {
4
- 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, d = 1.2270138511 * c - 0.5577999807 * u + 0.2812561489 * h, p = -0.0405801784 * c + 1.1122568696 * u - 0.0716766787 * h, g = -0.0763812845 * c - 0.4214819787 * u + 1.5861632204 * h, x = 2.4039459 * d - 0.9898517 * p - 0.4141151 * g, k = -0.7797967 * d + 1.5445214 * p + 0.0352745 * g, m = 0.0384795 * d - 0.1141381 * p + 1.0756786 * g, y = (b) => {
1
+ import { a1 as et, a2 as pt, a3 as mt, a4 as xt, a5 as gt, a6 as yt, a7 as kt, a8 as bt, a9 as G, aa as Mt, ab as wt, ac as vt, ad as St, ae as At, af as $t, ag as It, ah as Ct, ai as Tt, aj as Pt, ak as zt, al as Ft } from "./index-v2rH-W8-.js";
2
+ import { d as F, g as j, t as C, h as Lt } from "./custgeom-gp_HWEYw.js";
3
+ function Et(t) {
4
+ 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, s = n - 0.1055613458 * o - 0.0638541728 * l, a = n - 0.0894841775 * o - 1.291485548 * l, c = f * f * f, u = s * s * s, p = a * a * a, d = 1.2270138511 * c - 0.5577999807 * u + 0.2812561489 * p, h = -0.0405801784 * c + 1.1122568696 * u - 0.0716766787 * p, x = -0.0763812845 * c - 0.4214819787 * u + 1.5861632204 * p, g = 2.4039459 * d - 0.9898517 * h - 0.4141151 * x, k = -0.7797967 * d + 1.5445214 * h + 0.0352745 * x, m = 0.0384795 * d - 0.1141381 * h + 1.0756786 * x, y = (b) => {
5
5
  const M = Math.abs(b), w = M > 31308e-7 ? 1.055 * Math.pow(M, 1 / 2.4) - 0.055 : 12.92 * M;
6
6
  return b < 0 ? -w : w;
7
7
  };
8
8
  return {
9
- r: y(x),
9
+ r: y(g),
10
10
  g: y(k),
11
11
  b: y(m)
12
12
  };
13
13
  }
14
- function O(t) {
14
+ function R(t) {
15
15
  const n = Math.abs(t), e = n > 31308e-7 ? 1.055 * Math.pow(n, 1 / 2.4) - 0.055 : 12.92 * n;
16
16
  return t < 0 ? -e : e;
17
17
  }
@@ -22,12 +22,12 @@ function X(t) {
22
22
  function V(t, n, e) {
23
23
  const r = X(t), i = X(n), o = X(e);
24
24
  return {
25
- r: O(1.2249401762805083 * r - 0.2249401762805082 * i),
26
- g: O(-0.04205697751522136 * r + 1.0420569775152215 * i),
27
- b: O(-0.019637554590334 * r - 0.07863604555063188 * i + 1.0982736001409656 * o)
25
+ r: R(1.2249401762805083 * r - 0.2249401762805082 * i),
26
+ g: R(-0.04205697751522136 * r + 1.0420569775152215 * i),
27
+ b: R(-0.019637554590334 * r - 0.07863604555063188 * i + 1.0982736001409656 * o)
28
28
  };
29
29
  }
30
- function Et(t) {
30
+ function Ot(t) {
31
31
  return t.endsWith("%") ? parseFloat(t) / 100 : parseFloat(t);
32
32
  }
33
33
  function T(t) {
@@ -40,21 +40,21 @@ function T(t) {
40
40
  }
41
41
  const e = (o) => Math.round(Math.max(0, Math.min(1, o)) * 255), r = n.match(/^color\(\s*(display-p3|srgb)\s+([^/)]+?)\s*(?:\/[^)]*)?\)$/);
42
42
  if (r) {
43
- const o = r[2].split(/[\s,]+/).filter(Boolean).map(Et);
43
+ const o = r[2].split(/[\s,]+/).filter(Boolean).map(Ot);
44
44
  if (o.length < 3 || o.some((c) => !isFinite(c))) return null;
45
- const [l, f, a] = o;
46
- if (r[1] === "srgb") return [e(l), e(f), e(a)];
47
- const s = V(l, f, a);
48
- return [e(s.r), e(s.g), e(s.b)];
45
+ const [l, f, s] = o;
46
+ if (r[1] === "srgb") return [e(l), e(f), e(s)];
47
+ const a = V(l, f, s);
48
+ return [e(a.r), e(a.g), e(a.b)];
49
49
  }
50
50
  const i = n.match(/^oklch\(\s*([^/)]+?)\s*(?:\/[^)]*)?\)$/);
51
51
  if (i) {
52
52
  const o = i[1].split(/[\s,]+/).filter(Boolean);
53
53
  if (o.length < 3) return null;
54
- const l = o[0].endsWith("%") ? parseFloat(o[0]) / 100 : parseFloat(o[0]), f = parseFloat(o[1]), a = parseFloat(o[2]);
55
- if (![l, f, a].every(isFinite)) return null;
56
- const s = V(...(({ r: c, g: u, b: h }) => [c, u, h])(Lt({ l, c: f, h: a })));
57
- return [e(s.r), e(s.g), e(s.b)];
54
+ const l = o[0].endsWith("%") ? parseFloat(o[0]) / 100 : parseFloat(o[0]), f = parseFloat(o[1]), s = parseFloat(o[2]);
55
+ if (![l, f, s].every(isFinite)) return null;
56
+ const a = V(...(({ r: c, g: u, b: p }) => [c, u, p])(Et({ l, c: f, h: s })));
57
+ return [e(a.r), e(a.g), e(a.b)];
58
58
  }
59
59
  return Rt(n);
60
60
  }
@@ -79,7 +79,7 @@ function Rt(t) {
79
79
  return P.size < 512 && P.set(t, n), n;
80
80
  }
81
81
  const L = (t) => "#" + t.map((n) => n.toString(16).padStart(2, "0")).join("");
82
- function Ot(t) {
82
+ function Xt(t) {
83
83
  const n = t.trim().toLowerCase(), e = n.match(/^#([0-9a-f]{8})$/);
84
84
  if (e) return parseInt(e[1].slice(6), 16) / 255;
85
85
  const r = n.match(/^#([0-9a-f]{4})$/);
@@ -100,10 +100,10 @@ function S(t, n = 1) {
100
100
  if (!t) return null;
101
101
  const e = T(t);
102
102
  if (!e) return null;
103
- const r = Ot(t) * n;
103
+ const r = Xt(t) * n;
104
104
  return r <= 0 ? null : r < 0.999 ? { hex: L(e), alpha: r } : { hex: L(e) };
105
105
  }
106
- const rt = (t) => mt(t).split(",")[0].trim().replace(/^['"]|['"]$/g, "") || "Calibri", Y = {
106
+ const rt = (t) => pt(t).split(",")[0].trim().replace(/^['"]|['"]$/g, "") || "Calibri", Y = {
107
107
  hachure: "ltUpDiag",
108
108
  zigzag: "ltUpDiag",
109
109
  "zigzag-line": "ltUpDiag",
@@ -111,7 +111,7 @@ const rt = (t) => mt(t).split(",")[0].trim().replace(/^['"]|['"]$/g, "") || "Cal
111
111
  "cross-hatch": "diagCross",
112
112
  dots: "pct20"
113
113
  };
114
- function Xt(t, n) {
114
+ function Bt(t, n) {
115
115
  const e = t.fillStyle || "solid";
116
116
  if ((e === "linear" || e === "radial" || e === "conic") && (t.gradientStops?.length ?? 0) > 0) {
117
117
  const i = t.gradientStops.map((o) => ({ pos: Math.max(0, Math.min(1, o.offset)), color: S(o.color, n) ?? { hex: "#000000", alpha: 0 } }));
@@ -150,48 +150,48 @@ function st(t, n) {
150
150
  return t.split(`
151
151
  `).map((e) => ({ runs: e ? [{ text: e }] : [], align: n }));
152
152
  }
153
- function Bt(t) {
153
+ function Dt(t) {
154
154
  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";
155
155
  return n + e;
156
156
  }
157
- let C;
158
- function Dt(t, n) {
159
- if (C === void 0 && (C = typeof document < "u" ? document.createElement("canvas").getContext("2d") : null), C)
160
- return C.font = n, C.measureText(t).width;
157
+ let I;
158
+ function Yt(t, n) {
159
+ if (I === void 0 && (I = typeof document < "u" ? document.createElement("canvas").getContext("2d") : null), I)
160
+ return I.font = n, I.measureText(t).width;
161
161
  const e = Number(/(\d+(?:\.\d+)?)px/.exec(n)?.[1] ?? 16);
162
162
  return t.length * e * 0.6;
163
163
  }
164
- function Yt(t, n, e, r) {
164
+ function Wt(t, n, e, r) {
165
165
  const i = t.listLevel || 0, o = { bullet: t.listType === "ordered" ? "num" : "char", level: i };
166
166
  if (o.bullet === "num") {
167
- const a = Bt(t);
168
- 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);
167
+ const s = Dt(t);
168
+ s !== "arabicPeriod" && (o.numType = s), !(e && e.level === i && e.scheme === s && (t.listIndex || 1) === e.index + 1) && (t.listIndex || 1) > 1 && (o.startAt = t.listIndex);
169
169
  } else t.listMarker && t.listMarker !== "•" && (o.bulletChar = t.listMarker);
170
170
  if (t.listMarkerColor) {
171
- const a = S(t.listMarkerColor, n);
172
- a && (o.bulletColor = a);
171
+ const s = S(t.listMarkerColor, n);
172
+ s && (o.bulletColor = s);
173
173
  }
174
174
  t.listMarkerScale && t.listMarkerScale !== 1 && (o.bulletScale = t.listMarkerScale);
175
- const l = zt(t), f = Ft(Dt, t, r);
175
+ const l = Ft(t), f = r(t);
176
176
  return o.marL = f, o.indent = l - f, o;
177
177
  }
178
178
  function at(t, n, e, r) {
179
179
  const i = [];
180
180
  let o = { runs: [], align: n }, l = !1, f = null;
181
- const a = () => {
181
+ const s = Pt(Yt, t, r), a = () => {
182
182
  i.push(o), o = { runs: [], align: n }, l = !1;
183
183
  };
184
- for (const s of t)
185
- String(s.text ?? "").split(`
186
- `).forEach((u, h) => {
187
- if (h > 0 && a(), s.fontSize && !l && (o.endSize = s.fontSize), !u) return;
188
- l || (l = !0, s.paragraphSpaceBefore && (o.spaceBefore = s.paragraphSpaceBefore), s.paragraphAlign && (o.align = U(s.paragraphAlign, n ?? "l")), s.listType && s.listType !== "none" && Object.assign(o, Yt(s, e, f, r)), f = o.bullet === "num" ? { level: o.level ?? 0, scheme: o.numType ?? "arabicPeriod", index: s.listIndex || 1 } : null);
189
- const d = { text: u };
190
- if (s.bold && (d.bold = !0), s.italic && (d.italic = !0), s.underline && (d.underline = !0), s.strikethrough && (d.strike = !0), s.color) {
191
- const p = S(s.color, e);
192
- p && (d.color = p);
184
+ for (const c of t)
185
+ String(c.text ?? "").split(`
186
+ `).forEach((p, d) => {
187
+ if (d > 0 && a(), c.fontSize && !l && (o.endSize = c.fontSize), !p) return;
188
+ l || (l = !0, c.paragraphSpaceBefore && (o.spaceBefore = c.paragraphSpaceBefore), c.paragraphAlign && (o.align = U(c.paragraphAlign, n ?? "l")), c.listType && c.listType !== "none" && Object.assign(o, Wt(c, e, f, s)), f = o.bullet === "num" ? { level: o.level ?? 0, scheme: o.numType ?? "arabicPeriod", index: c.listIndex || 1 } : null);
189
+ const h = { text: p };
190
+ if (c.bold && (h.bold = !0), c.italic && (h.italic = !0), c.underline && (h.underline = !0), c.strikethrough && (h.strike = !0), c.color) {
191
+ const x = S(c.color, e);
192
+ x && (h.color = x);
193
193
  }
194
- s.fontSize && (d.size = s.fontSize), s.fontFamily && (d.font = rt(s.fontFamily)), o.runs.push(d);
194
+ c.fontSize && (h.size = c.fontSize), c.fontFamily && (h.font = rt(c.fontFamily)), o.runs.push(h);
195
195
  });
196
196
  return a(), i;
197
197
  }
@@ -201,12 +201,12 @@ function ct(t, n, e) {
201
201
  size: e,
202
202
  color: r,
203
203
  font: rt(t.fontFamily),
204
- bold: Ct(t.fontWeight) >= 600 ? !0 : void 0,
204
+ bold: It(t.fontWeight) >= 600 ? !0 : void 0,
205
205
  italic: $t(t.fontStyle) === "italic" ? !0 : void 0
206
206
  };
207
207
  }
208
- const lt = (t) => It(t) / Tt;
209
- function Wt(t, n) {
208
+ const lt = (t) => Ct(t) / Tt;
209
+ function Ht(t, n) {
210
210
  const e = t.richText && t.richText.length > 0, r = U(t.textAlign, e ? "ctr" : "l");
211
211
  return {
212
212
  paragraphs: e ? at(t.richText, r, n, { fontSize: t.fontSize || 20, fontFamily: t.fontFamily || "sans-serif" }) : st(t.text || "", r),
@@ -230,44 +230,44 @@ function ft(t, n) {
230
230
  defaults: ct(t, n, t.fontSize || 16)
231
231
  };
232
232
  }
233
- function Ht(t, n, e) {
234
- const r = [], i = Math.abs(n) / 2, o = Math.abs(e) / 2, l = (a, s, c) => {
235
- const u = I(F(a), i, o);
233
+ function jt(t, n, e) {
234
+ const r = [], i = Math.abs(n) / 2, o = Math.abs(e) / 2, l = (s, a, c) => {
235
+ const u = C(F(s), i, o);
236
236
  if (u.length === 0) return;
237
- const h = s, d = { fill: h.noFill ? !1 : void 0, stroke: h.noStroke ? !1 : void 0 };
237
+ const p = a, d = { fill: p.noFill ? !1 : void 0, stroke: p.noStroke ? !1 : void 0 };
238
238
  if (c) {
239
239
  r.push({ cmds: u, ...d });
240
240
  return;
241
241
  }
242
- let p = [];
243
- for (const g of u)
244
- g.op === "M" && p.length && (r.push({ cmds: p, ...d }), p = []), p.push(g);
245
- p.length && r.push({ cmds: p, ...d });
246
- }, f = (a) => {
247
- const s = (c) => Math.round(c * 1e3) / 1e3;
248
- switch (a.type) {
242
+ let h = [];
243
+ for (const x of u)
244
+ x.op === "M" && h.length && (r.push({ cmds: h, ...d }), h = []), h.push(x);
245
+ h.length && r.push({ cmds: h, ...d });
246
+ }, f = (s) => {
247
+ const a = (c) => Math.round(c * 1e3) / 1e3;
248
+ switch (s.type) {
249
249
  case "rect": {
250
- const c = Math.min(Math.abs(a.w), Math.abs(a.h)) / 2, [u, h, d, p] = (Array.isArray(a.r) ? a.r : [a.r || 0, a.r || 0, a.r || 0, a.r || 0]).map((b) => Math.max(0, Math.min(b || 0, c))), g = (b, M, w) => b ? ` A ${s(b)} ${s(b)} 0 0 1 ${s(M)} ${s(w)}` : "", { x, y: k } = a, m = a.w, y = a.h;
251
- l(`M ${x + u} ${k} H ${x + m - h}${g(h, x + m, k + h)} V ${k + y - d}${g(d, x + m - d, k + y)} H ${x + p}${g(p, x, k + y - p)} V ${k + u}${g(u, x + u, k)} Z`, a, !1);
250
+ const c = Math.min(Math.abs(s.w), Math.abs(s.h)) / 2, [u, p, d, h] = (Array.isArray(s.r) ? s.r : [s.r || 0, s.r || 0, s.r || 0, s.r || 0]).map((b) => Math.max(0, Math.min(b || 0, c))), x = (b, M, w) => b ? ` A ${a(b)} ${a(b)} 0 0 1 ${a(M)} ${a(w)}` : "", { x: g, y: k } = s, m = s.w, y = s.h;
251
+ l(`M ${g + u} ${k} H ${g + m - p}${x(p, g + m, k + p)} V ${k + y - d}${x(d, g + m - d, k + y)} H ${g + h}${x(h, g, k + y - h)} V ${k + u}${x(u, g + u, k)} Z`, s, !1);
252
252
  break;
253
253
  }
254
254
  case "ellipse":
255
- l(`M ${a.cx - a.rx} ${a.cy} A ${a.rx} ${a.ry} 0 1 0 ${a.cx + a.rx} ${a.cy} A ${a.rx} ${a.ry} 0 1 0 ${a.cx - a.rx} ${a.cy} Z`, a, !1);
255
+ l(`M ${s.cx - s.rx} ${s.cy} A ${s.rx} ${s.ry} 0 1 0 ${s.cx + s.rx} ${s.cy} A ${s.rx} ${s.ry} 0 1 0 ${s.cx - s.rx} ${s.cy} Z`, s, !1);
256
256
  break;
257
257
  case "points":
258
- a.points.length >= 2 && l(`M ${a.points.map((c) => `${c.x} ${c.y}`).join(" L ")}${a.isClosed !== !1 ? " Z" : ""}`, a, !1);
258
+ s.points.length >= 2 && l(`M ${s.points.map((c) => `${c.x} ${c.y}`).join(" L ")}${s.isClosed !== !1 ? " Z" : ""}`, s, !1);
259
259
  break;
260
260
  case "path":
261
- l(a.path, a, !!a.evenOdd);
261
+ l(s.path, s, !!s.evenOdd);
262
262
  break;
263
263
  case "multi":
264
- a.shapes.forEach(f);
264
+ s.shapes.forEach(f);
265
265
  break;
266
266
  }
267
267
  };
268
268
  return f(t), r;
269
269
  }
270
- function jt(t) {
270
+ function Nt(t) {
271
271
  if (t.warp || t.points && t.points.length) return null;
272
272
  if (t.type === "circle") return { kind: "preset", prst: "ellipse" };
273
273
  if (t.type === "rectangle") {
@@ -280,10 +280,10 @@ function jt(t) {
280
280
  }
281
281
  return null;
282
282
  }
283
- const Nt = /* @__PURE__ */ new Set(["umlClass", "umlInterface", "qrCode", "video", "codeBlock"]), Ut = /* @__PURE__ */ new Set(["fineliner", "inkbrush", "marker", "ink"]), _t = /* @__PURE__ */ new Set(["text", "richtext", "image", "line", "arrow"]);
284
- function Zt(t) {
283
+ const Ut = /* @__PURE__ */ new Set(["umlClass", "umlInterface", "qrCode", "video", "codeBlock"]), _t = /* @__PURE__ */ new Set(["fineliner", "inkbrush", "marker", "ink"]), Zt = /* @__PURE__ */ new Set(["text", "richtext", "image", "line", "arrow"]);
284
+ function Gt(t) {
285
285
  const n = t;
286
- if (Nt.has(t.type) || t.clipMaskId || t.shadowEnabled || t.glowEnabled || (t.featherRadius ?? 0) > 0 || t.blendMode && t.blendMode !== "normal" || t.shearX || t.shearY || xt(t) || gt(t) || yt(t) || kt(t) || t.appearance && (t.appearance.fills?.length ?? 0) + (t.appearance.strokes?.length ?? 0) > 0) return !0;
286
+ if (Ut.has(t.type) || t.clipMaskId || t.shadowEnabled || t.glowEnabled || (t.featherRadius ?? 0) > 0 || t.blendMode && t.blendMode !== "normal" || t.shearX || t.shearY || xt(t) || gt(t) || yt(t) || kt(t) || t.appearance && (t.appearance.fills?.length ?? 0) + (t.appearance.strokes?.length ?? 0) > 0) return !0;
287
287
  const e = t.fillStyle;
288
288
  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;
289
289
  if (t.type === "image") {
@@ -330,25 +330,25 @@ function W(t, n, e) {
330
330
  const r = n.hooks.rasterize(t), i = r ? _(r.dataURL) : null;
331
331
  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 }]);
332
332
  }
333
- function Gt(t, n) {
333
+ function Vt(t, n) {
334
334
  const e = _(t.dataURL);
335
335
  if (!e) return W([t], n, A(t));
336
336
  let r;
337
337
  if (t.crop) {
338
338
  const o = t.dataURL ? et(t.dataURL) : null, l = o?.naturalWidth, f = o?.naturalHeight;
339
339
  if (l && f) {
340
- const a = t.crop;
341
- r = { l: a.x / l, t: a.y / f, r: 1 - (a.x + a.width) / l, b: 1 - (a.y + a.height) / f };
340
+ const s = t.crop;
341
+ r = { l: s.x / l, t: s.y / f, r: 1 - (s.x + s.width) / l, b: 1 - (s.y + s.height) / f };
342
342
  }
343
343
  }
344
344
  const i = (t.opacity ?? 100) / 100;
345
345
  return n.report.native++, [{ kind: "picture", id: n.nextId++, name: A(t), ...Z(t, n), media: e, crop: r, alpha: i < 1 ? i : void 0, descr: t.altText }];
346
346
  }
347
- function Vt(t, n, e, r) {
347
+ function qt(t, n, e, r) {
348
348
  const i = ft(t, r);
349
349
  if (!i) return [];
350
350
  const o = t.fontSize || 16, l = (t.containerText || "").split(`
351
- `), f = Math.max(1, ...l.map((c) => c.length)), a = Math.max(40, f * o * 0.6 + 24), s = Math.max(o * 1.6, l.length * o * 1.25 + 8);
351
+ `), f = Math.max(1, ...l.map((c) => c.length)), s = Math.max(40, f * o * 0.6 + 24), a = Math.max(o * 1.6, l.length * o * 1.25 + 8);
352
352
  return i.wrap = !1, i.anchor = "ctr", i.paragraphs.forEach((c) => {
353
353
  c.align = "ctr";
354
354
  }), [{
@@ -356,38 +356,38 @@ function Vt(t, n, e, r) {
356
356
  id: e.nextId++,
357
357
  name: `${A(t)} label`,
358
358
  textBox: !0,
359
- x: n.x - e.ox - a / 2,
360
- y: n.y - e.oy - s / 2,
361
- w: a,
362
- h: s,
359
+ x: n.x - e.ox - s / 2,
360
+ y: n.y - e.oy - a / 2,
361
+ w: s,
362
+ h: a,
363
363
  geom: { kind: "preset", prst: "rect" },
364
364
  fill: { kind: "none" },
365
365
  line: null,
366
366
  text: i
367
367
  }];
368
368
  }
369
- function qt(t, n, e) {
370
- 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;
371
- for (let s = 0; s < 4; s++) {
372
- let [c, u] = l[s];
369
+ function Jt(t, n, e) {
370
+ 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, s = n.y - e.oy;
371
+ for (let a = 0; a < 4; a++) {
372
+ let [c, u] = l[a];
373
373
  t.flipH && (c = -c), t.flipV && (u = -u);
374
- const h = r + c * Math.cos(o) - u * Math.sin(o), d = i + c * Math.sin(o) + u * Math.cos(o);
375
- if (Math.hypot(h - f, d - a) <= 2) return s;
374
+ const p = r + c * Math.cos(o) - u * Math.sin(o), d = i + c * Math.sin(o) + u * Math.cos(o);
375
+ if (Math.hypot(p - f, d - s) <= 2) return a;
376
376
  }
377
377
  return -1;
378
378
  }
379
- function Jt(t, n, e) {
379
+ function Kt(t, n, e) {
380
380
  const r = e.x - n.x, i = e.y - n.y, o = Math.hypot(r, i);
381
381
  if (!(o > 0)) return !1;
382
- 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;
383
- 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));
382
+ const l = (a, c) => Math.abs((a - n.x) * i - (c - n.y) * r) / o, f = (a, c) => ((a - n.x) * r + (c - n.y) * i) / (o * o), s = (a, c) => l(a, c) <= 0.5 && f(a, c) >= -0.01 && f(a, c) <= 1.01;
383
+ return t.every((a) => a.op === "Z" ? !1 : a.op === "C" ? s(a.x1, a.y1) && s(a.x2, a.y2) && s(a.x, a.y) : s(a.x, a.y));
384
384
  }
385
- function Kt(t, n) {
385
+ function Qt(t, n) {
386
386
  const e = (t.opacity ?? 100) / 100, r = N(t, e, !0), i = bt(t), o = [];
387
387
  if (r) {
388
- 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) };
389
- if (!i.d || Jt(F(i.d), i.start, i.end)) {
390
- const { start: c, end: u } = i, h = {
388
+ const l = t.type === "arrow", f = l ? t.startArrowhead : null, s = l ? t.endArrowhead || (t.startArrowhead ? null : "arrow") : null, a = { ...r, head: J(f, G(t, "start"), t.strokeWidth), tail: J(s, G(t, "end"), t.strokeWidth) };
389
+ if (!i.d || Kt(F(i.d), i.start, i.end)) {
390
+ const { start: c, end: u } = i, p = {
391
391
  kind: "connector",
392
392
  id: n.nextId++,
393
393
  name: A(t),
@@ -398,50 +398,50 @@ function Kt(t, n) {
398
398
  flipH: u.x < c.x || void 0,
399
399
  flipV: u.y < c.y || void 0,
400
400
  geom: { kind: "preset", prst: "straightConnector1" },
401
- line: s
402
- }, d = (p, g) => {
403
- const x = p?.elementId ? n.ids.get(p.elementId) : void 0;
404
- if (!x) return;
405
- const k = qt(x.item, g, n);
406
- return k >= 0 ? { id: x.id, idx: k } : void 0;
401
+ line: a
402
+ }, d = (h, x) => {
403
+ const g = h?.elementId ? n.ids.get(h.elementId) : void 0;
404
+ if (!g) return;
405
+ const k = Jt(g.item, x, n);
406
+ return k >= 0 ? { id: g.id, idx: k } : void 0;
407
407
  };
408
408
  n.glue.push(() => {
409
- h.start = d(t.startBinding, c), h.end = d(t.endBinding, u);
410
- }), o.push(h);
409
+ p.start = d(t.startBinding, c), p.end = d(t.endBinding, u);
410
+ }), o.push(p);
411
411
  } else {
412
412
  const c = F(i.d), u = j(c);
413
413
  if (u) {
414
- const h = Math.max(u.maxX - u.minX, 0.01), d = Math.max(u.maxY - u.minY, 0.01);
414
+ const p = Math.max(u.maxX - u.minX, 0.01), d = Math.max(u.maxY - u.minY, 0.01);
415
415
  o.push({
416
416
  kind: "shape",
417
417
  id: n.nextId++,
418
418
  name: A(t),
419
419
  x: u.minX - n.ox,
420
420
  y: u.minY - n.oy,
421
- w: h,
421
+ w: p,
422
422
  h: d,
423
- geom: { kind: "custom", paths: [{ cmds: I(c, -u.minX, -u.minY), fill: !1 }] },
423
+ geom: { kind: "custom", paths: [{ cmds: C(c, -u.minX, -u.minY), fill: !1 }] },
424
424
  fill: { kind: "none" },
425
- line: s
425
+ line: a
426
426
  });
427
427
  }
428
428
  }
429
429
  n.report.native++;
430
430
  }
431
- return o.push(...Vt(t, i.mid, n, e)), o;
431
+ return o.push(...qt(t, i.mid, n, e)), o;
432
432
  }
433
- function Qt(t, n) {
433
+ function tn(t, n) {
434
434
  const e = (t.opacity ?? 100) / 100, r = Mt(t.points), i = N(t, e, !0);
435
435
  if (r.length < 2 || !i) return [];
436
436
  i.cap = "rnd", i.join = "round";
437
- 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, d) => ({ op: d ? "L" : "M", x: h.x - f, y: h.y - a }));
437
+ const o = r.map((p) => p.x), l = r.map((p) => p.y), f = Math.min(...o), s = Math.min(...l), a = Math.max(Math.max(...o) - f, 0.01), c = Math.max(Math.max(...l) - s, 0.01), u = r.map((p, d) => ({ op: d ? "L" : "M", x: p.x - f, y: p.y - s }));
438
438
  return n.report.native++, [{
439
439
  kind: "shape",
440
440
  id: n.nextId++,
441
441
  name: A(t),
442
442
  x: t.x + f - n.ox,
443
- y: t.y + a - n.oy,
444
- w: s,
443
+ y: t.y + s - n.oy,
444
+ w: a,
445
445
  h: c,
446
446
  rot: t.angle ? t.angle * 180 / Math.PI : void 0,
447
447
  geom: { kind: "custom", paths: [{ cmds: u, fill: !1 }] },
@@ -449,7 +449,7 @@ function Qt(t, n) {
449
449
  line: i
450
450
  }];
451
451
  }
452
- function tn(t, n) {
452
+ function nn(t, n) {
453
453
  const e = (t.opacity ?? 100) / 100;
454
454
  if (!(t.text || t.richText && t.richText.length > 0)) return [];
455
455
  n.report.native++;
@@ -463,15 +463,15 @@ function tn(t, n) {
463
463
  geom: { kind: "preset", prst: "rect" },
464
464
  fill: i ? { kind: "solid", color: i } : { kind: "none" },
465
465
  line: null,
466
- text: Wt(t, e)
466
+ text: Ht(t, e)
467
467
  }];
468
468
  }
469
- const nn = (t) => {
469
+ const en = (t) => {
470
470
  const n = t && /matrix\(([^)]+)\)/.exec(t), e = n ? n[1].split(/[\s,]+/).map(Number) : [];
471
471
  return e.length === 6 && e.every(Number.isFinite) ? e : [1, 0, 0, 1, 0, 0];
472
472
  }, Q = (t, n, e) => ({ x: t[0] * n + t[2] * e + t[4], y: t[1] * n + t[3] * e + t[5] });
473
- function en(t) {
474
- const n = Pt.generator(), e = (i) => {
473
+ function rn(t) {
474
+ const n = zt.generator(), e = (i) => {
475
475
  for (const o of n.toPaths(i))
476
476
  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();
477
477
  return i;
@@ -480,7 +480,7 @@ function en(t) {
480
480
  r[i] = (...o) => e(n[i](...o));
481
481
  return r;
482
482
  }
483
- function rn(t) {
483
+ function on(t) {
484
484
  const n = t.fillStyle, e = {
485
485
  ...t,
486
486
  renderStyle: "architectural",
@@ -495,28 +495,28 @@ function rn(t) {
495
495
  fillStyle: Y[n] ? "solid" : t.fillStyle
496
496
  }, r = new St();
497
497
  try {
498
- const s = document.createElement("canvas");
499
- At(en(r), s.getContext("2d"), e, !1, 1, r);
498
+ const a = document.createElement("canvas");
499
+ At(rn(r), a.getContext("2d"), e, !1, 1, r);
500
500
  } catch {
501
501
  return null;
502
502
  }
503
503
  if (r.failed) return null;
504
504
  const i = /* @__PURE__ */ new Map();
505
- for (const s of Array.from(r.defs.children)) s.id && i.set(s.id, s);
506
- const o = (s, c) => {
507
- const u = i.get(s.replace(/^url\(#|\)$/g, ""));
505
+ for (const a of Array.from(r.defs.children)) a.id && i.set(a.id, a);
506
+ const o = (a, c) => {
507
+ const u = i.get(a.replace(/^url\(#|\)$/g, ""));
508
508
  if (!u) return null;
509
- const h = Array.from(u.children).map((d) => ({ pos: +(d.getAttribute("offset") || 0), color: S(d.getAttribute("stop-color")) ?? { hex: "#000000", alpha: 0 } }));
510
- if (!h.length) return null;
509
+ const p = Array.from(u.children).map((d) => ({ pos: +(d.getAttribute("offset") || 0), color: S(d.getAttribute("stop-color")) ?? { hex: "#000000", alpha: 0 } }));
510
+ if (!p.length) return null;
511
511
  if (u.tagName.toLowerCase() === "lineargradient") {
512
- const d = Q(c, +u.getAttribute("x1"), +u.getAttribute("y1")), p = Q(c, +u.getAttribute("x2"), +u.getAttribute("y2"));
513
- return { kind: "linear", x1: d.x, y1: d.y, x2: p.x, y2: p.y, stops: h };
512
+ const d = Q(c, +u.getAttribute("x1"), +u.getAttribute("y1")), h = Q(c, +u.getAttribute("x2"), +u.getAttribute("y2"));
513
+ return { kind: "linear", x1: d.x, y1: d.y, x2: h.x, y2: h.y, stops: p };
514
514
  }
515
- return { kind: "radial", x1: 0, y1: 0, x2: 0, y2: 0, stops: h };
515
+ return { kind: "radial", x1: 0, y1: 0, x2: 0, y2: 0, stops: p };
516
516
  }, l = [];
517
517
  let f = "ok";
518
- const a = (s) => {
519
- for (const c of Array.from(s.children)) {
518
+ const s = (a) => {
519
+ for (const c of Array.from(a.children)) {
520
520
  if (f !== "ok") return;
521
521
  const u = c.tagName.toLowerCase();
522
522
  if (u === "g") {
@@ -524,30 +524,30 @@ function rn(t) {
524
524
  f = "picture";
525
525
  return;
526
526
  }
527
- a(c);
527
+ s(c);
528
528
  continue;
529
529
  }
530
530
  if (u === "text" || u === "image") {
531
531
  f = "picture";
532
532
  return;
533
533
  }
534
- let h = null;
535
- if (u === "path") h = c.getAttribute("d");
534
+ let p = null;
535
+ if (u === "path") p = c.getAttribute("d");
536
536
  else if (u === "rect") {
537
537
  const b = +c.getAttribute("x"), M = +c.getAttribute("y"), w = +c.getAttribute("width"), v = +c.getAttribute("height");
538
- h = `M ${b} ${M} L ${b + w} ${M} L ${b + w} ${M + v} L ${b} ${M + v} Z`;
538
+ p = `M ${b} ${M} L ${b + w} ${M} L ${b + w} ${M + v} L ${b} ${M + v} Z`;
539
539
  } else {
540
540
  f = "fail";
541
541
  return;
542
542
  }
543
- const d = nn(c.getAttribute("transform")), p = pt(F(h || ""), d);
544
- if (!p.length) continue;
545
- const g = c.getAttribute("fill"), x = c.getAttribute("stroke"), k = !!g && g.startsWith("url("), m = +(c.getAttribute("fill-opacity") ?? 1), y = +(c.getAttribute("stroke-opacity") ?? 1);
543
+ const d = en(c.getAttribute("transform")), h = Lt(F(p || ""), d);
544
+ if (!h.length) continue;
545
+ 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);
546
546
  l.push({
547
- cmds: p,
548
- fill: g && g !== "none" && !k ? g : null,
549
- grad: k ? o(g, d) : null,
550
- stroke: x && x !== "none" ? x : null,
547
+ cmds: h,
548
+ fill: x && x !== "none" && !k ? x : null,
549
+ grad: k ? o(x, d) : null,
550
+ stroke: g && g !== "none" ? g : null,
551
551
  fillAlpha: Number.isFinite(m) ? m : 1,
552
552
  strokeAlpha: Number.isFinite(y) ? y : 1,
553
553
  width: +(c.getAttribute("stroke-width") || 1) * Math.sqrt(Math.abs(d[0] * d[3] - d[1] * d[2])),
@@ -556,21 +556,21 @@ function rn(t) {
556
556
  });
557
557
  }
558
558
  };
559
- return a(r.root), f === "ok" ? l : f === "picture" ? "picture" : null;
559
+ return s(r.root), f === "ok" ? l : f === "picture" ? "picture" : null;
560
560
  }
561
561
  const tt = (t, n) => {
562
562
  if (!t || !n) return !1;
563
563
  const e = T(t), r = T(n);
564
564
  return !!e && !!r && e[0] === r[0] && e[1] === r[1] && e[2] === r[2];
565
565
  };
566
- function on(t, n, e) {
567
- const r = t.stops.map((p) => ({ pos: p.pos, color: e < 1 ? { ...p.color, alpha: (p.color.alpha ?? 1) * e } : p.color }));
566
+ function sn(t, n, e) {
567
+ const r = t.stops.map((h) => ({ pos: h.pos, color: e < 1 ? { ...h.color, alpha: (h.color.alpha ?? 1) * e } : h.color }));
568
568
  if (t.kind === "radial") return { kind: "radial", stops: r };
569
569
  const i = t.x2 - t.x1, o = t.y2 - t.y1, l = Math.hypot(i, o);
570
570
  if (!(l > 0)) return { kind: "solid", color: r[r.length - 1].color };
571
- const f = i / l, a = o / l, s = (n.minX + n.maxX) / 2, c = (n.minY + n.maxY) / 2, u = (Math.abs((n.maxX - n.minX) * f) + Math.abs((n.maxY - n.minY) * a)) / 2;
571
+ const f = i / l, s = o / l, a = (n.minX + n.maxX) / 2, c = (n.minY + n.maxY) / 2, u = (Math.abs((n.maxX - n.minX) * f) + Math.abs((n.maxY - n.minY) * s)) / 2;
572
572
  if (!(u > 0)) return { kind: "solid", color: r[0].color };
573
- const h = (p) => ((t.x1 + i * p - s) * f + (t.y1 + o * p - c) * a + u) / (2 * u), d = [...r].sort((p, g) => p.pos - g.pos).map((p) => ({ pos: h(p.pos), color: p.color }));
573
+ const p = (h) => ((t.x1 + i * h - a) * f + (t.y1 + o * h - c) * s + u) / (2 * u), d = [...r].sort((h, x) => h.pos - x.pos).map((h) => ({ pos: p(h.pos), color: h.color }));
574
574
  return { kind: "linear", angle: Math.atan2(o, i) * 180 / Math.PI, stops: ut(d) };
575
575
  }
576
576
  function ut(t) {
@@ -579,7 +579,7 @@ function ut(t) {
579
579
  if (e <= t[0].pos) return t[0].color;
580
580
  for (let r = 1; r < t.length; r++) {
581
581
  const i = t[r - 1], o = t[r];
582
- if (e <= o.pos) return pn(i.color, o.color, o.pos > i.pos ? (e - i.pos) / (o.pos - i.pos) : 0);
582
+ if (e <= o.pos) return mn(i.color, o.color, o.pos > i.pos ? (e - i.pos) / (o.pos - i.pos) : 0);
583
583
  }
584
584
  return t[t.length - 1].color;
585
585
  };
@@ -595,32 +595,32 @@ function H(t) {
595
595
  return t.stroke !== !1 && r.push({ cmds: t.cmds, fill: !1, stroke: t.stroke }), r;
596
596
  }
597
597
  const E = (t) => JSON.stringify(t.cmds);
598
- function sn(t, n) {
598
+ function an(t, n) {
599
599
  const e = (t.opacity ?? 100) / 100, r = Z(t, n), i = ft(t, e);
600
- let o = jt(t);
600
+ let o = Nt(t);
601
601
  if (!o) {
602
- const f = wt(t), a = f ? Ht(f, t.width, t.height) : [], s = rn(t);
603
- if (s === "picture") return null;
604
- if (s && s.length) {
605
- 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) => I(m.cmds, c, u)) : null, d = !!ot(t), p = ["linear", "radial", "conic"].includes(t.fillStyle);
606
- if (!s.every((m) => (!m.grad || p) && 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 === d))) {
607
- const m = cn(t, s, r, i, n, e, h);
602
+ const f = wt(t), s = f ? jt(f, t.width, t.height) : [], a = on(t);
603
+ if (a === "picture") return null;
604
+ if (a && a.length) {
605
+ const c = Math.min(t.x, t.x + t.width), u = Math.min(t.y, t.y + t.height), p = s.length ? s.filter((m) => m.fill !== !1).map((m) => C(m.cmds, c, u)) : null, d = !!ot(t), h = ["linear", "radial", "conic"].includes(t.fillStyle);
606
+ if (!a.every((m) => (!m.grad || h) && 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 === d))) {
607
+ const m = ln(t, a, r, i, n, e, p);
608
608
  return m ? [m] : null;
609
609
  }
610
- const x = [], k = (m) => I(m, -c, -u);
611
- for (let m = 0; m < s.length; m++) {
612
- 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;
610
+ const g = [], k = (m) => C(m, -c, -u);
611
+ for (let m = 0; m < a.length; m++) {
612
+ const y = a[m], b = a[m + 1], M = !!((y.fill || y.grad) && !y.stroke && b && b.stroke && !b.fill && !b.grad && E(b) === E(y)), w = !!y.stroke || M;
613
613
  if (y.fill || y.grad) {
614
- const v = dt(y, h);
614
+ const v = dt(y, p);
615
615
  if (!v) return null;
616
- v.length === 1 && v[0] === y.cmds ? x.push(...H({ cmds: k(y.cmds), stroke: w ? void 0 : !1 })) : (x.push(...v.map((R) => ({ cmds: k(R), stroke: !1 }))), w && x.push({ cmds: k(y.cmds), fill: !1 }));
616
+ v.length === 1 && v[0] === y.cmds ? g.push(...H({ cmds: k(y.cmds), stroke: w ? void 0 : !1 })) : (g.push(...v.map((O) => ({ cmds: k(O), stroke: !1 }))), w && g.push({ cmds: k(y.cmds), fill: !1 }));
617
617
  } else
618
- x.push({ cmds: k(y.cmds), fill: !1, stroke: w ? void 0 : !1 });
618
+ g.push({ cmds: k(y.cmds), fill: !1, stroke: w ? void 0 : !1 });
619
619
  M && m++;
620
620
  }
621
- o = { kind: "custom", paths: x };
622
- } else if (a.length)
623
- o = { kind: "custom", paths: a.flatMap(H) };
621
+ o = { kind: "custom", paths: g };
622
+ } else if (s.length)
623
+ o = { kind: "custom", paths: s.flatMap(H) };
624
624
  else return null;
625
625
  }
626
626
  const l = {
@@ -629,23 +629,23 @@ function sn(t, n) {
629
629
  name: A(t),
630
630
  ...r,
631
631
  geom: o,
632
- fill: Xt(t, e),
632
+ fill: Bt(t, e),
633
633
  line: N(t, e),
634
634
  text: i
635
635
  };
636
636
  return n.ids.set(t.id, { id: l.id, item: l }), n.report.native++, [l];
637
637
  }
638
- const an = (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(" ");
638
+ const cn = (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(" ");
639
639
  let B = null;
640
640
  const z = 28;
641
641
  function D(t, n, e) {
642
642
  B ??= document.createElement("canvas").getContext("2d");
643
643
  const r = [];
644
644
  if (!B) return r;
645
- const i = t.map((o) => new Path2D(an(o)));
645
+ const i = t.map((o) => new Path2D(cn(o)));
646
646
  for (let o = 0; o < z; o++) for (let l = 0; l < z; l++) {
647
- const f = e.minX + (l + 0.5) / z * (e.maxX - e.minX), a = e.minY + (o + 0.5) / z * (e.maxY - e.minY);
648
- r.push(i.some((s) => B.isPointInPath(s, f, a, n)));
647
+ const f = e.minX + (l + 0.5) / z * (e.maxX - e.minX), s = e.minY + (o + 0.5) / z * (e.maxY - e.minY);
648
+ r.push(i.some((a) => B.isPointInPath(a, f, s, n)));
649
649
  }
650
650
  return r;
651
651
  }
@@ -657,30 +657,30 @@ function dt(t, n) {
657
657
  const r = D([t.cmds], "nonzero", e);
658
658
  return nt(r, D([t.cmds], "evenodd", e)) === 0 ? [t.cmds] : n && nt(r, D(n, "evenodd", e)) <= 0.03 ? n : null;
659
659
  }
660
- function cn(t, n, e, r, i, o, l) {
660
+ function ln(t, n, e, r, i, o, l) {
661
661
  const f = [];
662
- for (let a = 0; a < n.length; a++) {
663
- 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, d = j(s.cmds);
662
+ for (let s = 0; s < n.length; s++) {
663
+ const a = n[s], c = n[s + 1], u = !!((a.fill || a.grad) && !a.stroke && c && c.stroke && !c.fill && !c.grad && E(c) === E(a)), p = u ? c : a, d = j(a.cmds);
664
664
  if (!d) continue;
665
- const p = Math.max(d.maxX - d.minX, 0.01), g = Math.max(d.maxY - d.minY, 0.01), x = S(s.fill, o * s.fillAlpha), k = s.grad ? on(s.grad, d, o) : x ? { kind: "solid", color: x } : { kind: "none" }, m = S(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 = (v) => I(v, -d.minX, -d.minY);
665
+ const h = Math.max(d.maxX - d.minX, 0.01), x = Math.max(d.maxY - d.minY, 0.01), g = S(a.fill, o * a.fillAlpha), k = a.grad ? sn(a.grad, d, o) : g ? { kind: "solid", color: g } : { kind: "none" }, m = S(p.stroke, o * p.strokeAlpha), y = m ? { width: p.width, color: m, dash: p.dash ? "dash" : void 0, join: "round", cap: "rnd" } : null, b = !!(a.fill || a.grad), M = (v) => C(v, -d.minX, -d.minY);
666
666
  let w;
667
667
  if (b) {
668
- const v = dt(s, l);
668
+ const v = dt(a, l);
669
669
  if (!v) return null;
670
- w = v.length === 1 && v[0] === s.cmds ? H({ cmds: M(s.cmds), stroke: m ? void 0 : !1 }) : [...v.map((R) => ({ cmds: M(R), stroke: !1 })), ...m ? [{ cmds: M(s.cmds), fill: !1 }] : []];
671
- } else w = [{ cmds: M(s.cmds), fill: !1, stroke: m ? void 0 : !1 }];
670
+ w = v.length === 1 && v[0] === a.cmds ? H({ cmds: M(a.cmds), stroke: m ? void 0 : !1 }) : [...v.map((O) => ({ cmds: M(O), stroke: !1 })), ...m ? [{ cmds: M(a.cmds), fill: !1 }] : []];
671
+ } else w = [{ cmds: M(a.cmds), fill: !1, stroke: m ? void 0 : !1 }];
672
672
  f.push({
673
673
  kind: "shape",
674
674
  id: i.nextId++,
675
675
  name: `${A(t)} part`,
676
676
  x: d.minX - i.ox,
677
677
  y: d.minY - i.oy,
678
- w: p,
679
- h: g,
678
+ w: h,
679
+ h: x,
680
680
  geom: { kind: "custom", paths: w },
681
681
  fill: k,
682
682
  line: y
683
- }), u && a++;
683
+ }), u && s++;
684
684
  }
685
685
  return r && f.push({
686
686
  kind: "shape",
@@ -697,15 +697,15 @@ function cn(t, n, e, r, i, o, l) {
697
697
  text: r
698
698
  }), i.report.native++, { kind: "group", id: i.nextId++, name: A(t), ...e, children: f };
699
699
  }
700
- function ln(t, n) {
701
- if (Zt(t)) return W([t], n, A(t));
700
+ function fn(t, n) {
701
+ if (Gt(t)) return W([t], n, A(t));
702
702
  try {
703
- if (t.type === "text" || t.type === "richtext") return tn(t, n);
704
- if (t.type === "image") return Gt(t, n);
705
- if (t.type === "line" || t.type === "arrow") return Kt(t, n);
706
- if (Ut.has(t.type)) return Qt(t, n);
707
- if (!_t.has(t.type)) {
708
- const e = sn(t, n);
703
+ if (t.type === "text" || t.type === "richtext") return nn(t, n);
704
+ if (t.type === "image") return Vt(t, n);
705
+ if (t.type === "line" || t.type === "arrow") return Qt(t, n);
706
+ if (_t.has(t.type)) return tn(t, n);
707
+ if (!Zt.has(t.type)) {
708
+ const e = an(t, n);
709
709
  if (e) return e;
710
710
  }
711
711
  } catch {
@@ -722,27 +722,29 @@ function ht(t, n, e) {
722
722
  for (; i < t.length; ) {
723
723
  const l = o(t[i]);
724
724
  if (!l) {
725
- r.push(...ln(t[i], e)), i++;
725
+ const a = fn(t[i], e), c = xn(t[i].link);
726
+ if (c) for (const u of a) u.link = c;
727
+ r.push(...a), i++;
726
728
  continue;
727
729
  }
728
730
  let f = i;
729
731
  for (; f < t.length && o(t[f]) === l; ) f++;
730
- const a = ht(t.slice(i, f), n + 1, e);
731
- if (a.length > 1) {
732
- const s = fn(a), c = { kind: "group", id: e.nextId++, name: t[i].groupNames?.[l] || "Group", ...s, children: a };
732
+ const s = ht(t.slice(i, f), n + 1, e);
733
+ if (s.length > 1) {
734
+ const a = un(s), c = { kind: "group", id: e.nextId++, name: t[i].groupNames?.[l] || "Group", ...a, children: s };
733
735
  r.push(c);
734
- } else r.push(...a);
736
+ } else r.push(...s);
735
737
  i = f;
736
738
  }
737
739
  return r;
738
740
  }
739
- function fn(t) {
741
+ function un(t) {
740
742
  let n = 1 / 0, e = 1 / 0, r = -1 / 0, i = -1 / 0;
741
743
  for (const o of t)
742
744
  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);
743
745
  return { x: n, y: e, w: Math.max(0, r - n), h: Math.max(0, i - e) };
744
746
  }
745
- function un(t) {
747
+ function dn(t) {
746
748
  if (!t || t.type === "none") return;
747
749
  const n = t.duration ?? 500;
748
750
  switch (t.type) {
@@ -764,7 +766,7 @@ function un(t) {
764
766
  return;
765
767
  }
766
768
  }
767
- function dn(t, n) {
769
+ function hn(t, n) {
768
770
  const e = t.slide;
769
771
  if (!e) {
770
772
  const f = S(t.background);
@@ -774,41 +776,49 @@ function dn(t, n) {
774
776
  if (i && r === "solid")
775
777
  return { kind: "solid", color: S(e.backgroundColor === "transparent" ? "#ffffff" : e.backgroundColor || "#ffffff") ?? { hex: "#ffffff" } };
776
778
  if (i && (r === "linear" || r === "radial") && (e.gradientStops?.length ?? 0) > 0) {
777
- const f = e.gradientDirection || 0, a = e.gradientStops.map((s) => ({ pos: s.offset, color: S(s.color) ?? { hex: "#ffffff" } }));
778
- return r === "radial" ? { kind: "radial", stops: a } : { kind: "linear", stops: hn(a, f, t.w, t.h), angle: f };
779
+ const f = e.gradientDirection || 0, s = e.gradientStops.map((a) => ({ pos: a.offset, color: S(a.color) ?? { hex: "#ffffff" } }));
780
+ return r === "radial" ? { kind: "radial", stops: s } : { kind: "linear", stops: pn(s, f, t.w, t.h), angle: f };
779
781
  }
780
782
  const o = n.rasterizeBackground?.(e), l = o ? _(o) : null;
781
783
  return l ? { kind: "image", media: l } : { kind: "solid", color: S(e.backgroundColor) ?? { hex: "#ffffff" } };
782
784
  }
783
- function hn(t, n, e, r) {
785
+ function pn(t, n, e, r) {
784
786
  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;
785
787
  if (!(l > 0) || t.length < 2) return t;
786
- const f = [...t].sort((a, s) => a.pos - s.pos).map((a) => ({ pos: (-o + 2 * o * a.pos + l) / (2 * l), color: a.color }));
788
+ const f = [...t].sort((s, a) => s.pos - a.pos).map((s) => ({ pos: (-o + 2 * o * s.pos + l) / (2 * l), color: s.color }));
787
789
  return ut(f);
788
790
  }
789
- function pn(t, n, e) {
790
- 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;
791
- return a < 0.999 ? { hex: L(o), alpha: a } : { hex: L(o) };
791
+ function mn(t, n, e) {
792
+ const r = T(t.hex), i = T(n.hex), o = [0, 1, 2].map((a) => Math.round(r[a] + (i[a] - r[a]) * e)), l = t.alpha ?? 1, f = n.alpha ?? 1, s = l + (f - l) * e;
793
+ return s < 0.999 ? { hex: L(o), alpha: s } : { hex: L(o) };
794
+ }
795
+ function xn(t) {
796
+ const n = mt(t);
797
+ if (n.kind === "url") return { kind: "url", url: n.url };
798
+ if (n.kind === "slide") return { kind: "slide", key: n.slideId };
799
+ if (n.kind === "action") return { kind: "action", action: n.action };
792
800
  }
793
- function gn(t, n, e) {
801
+ function kn(t, n, e) {
794
802
  const r = { ox: t.x, oy: t.y, nextId: 2, ids: /* @__PURE__ */ new Map(), glue: [], hooks: n, report: e }, i = ht(t.elements, 0, r);
795
803
  return r.glue.forEach((o) => o()), {
796
804
  name: t.name,
797
805
  items: i,
798
- background: dn(t, n),
799
- transition: un(t.slide?.transition)
806
+ background: hn(t, n),
807
+ transition: dn(t.slide?.transition),
808
+ notes: t.slide?.notes?.trim() ? t.slide.notes : void 0,
809
+ key: t.slide?.id
800
810
  };
801
811
  }
802
- function yn(t, n, e, r) {
812
+ function bn(t, n, e, r) {
803
813
  const i = Math.min(e / Math.max(t, 1), r / Math.max(n, 1));
804
814
  return { scale: i, dx: (e - t * i) / 2, dy: (r - n * i) / 2 };
805
815
  }
806
816
  export {
807
- yn as fitInto,
817
+ bn as fitInto,
808
818
  _ as mediaOf,
809
- gn as pageToSlide,
810
- hn as remapPageStops,
819
+ kn as pageToSlide,
820
+ pn as remapPageStops,
811
821
  S as toColor,
812
- un as transitionOf,
822
+ dn as transitionOf,
813
823
  rt as typefaceOf
814
824
  };