@snowcone-app/canvas 0.44.1 → 0.45.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (30) hide show
  1. package/dist/{ContextualToolbars-rCZo-KCm.js → ContextualToolbars-5tHC6s0Y.js} +4 -4
  2. package/dist/{ContextualToolbars-rCZo-KCm.js.map → ContextualToolbars-5tHC6s0Y.js.map} +1 -1
  3. package/dist/{EditorCanvasImpl-VkjeyOGd.js → EditorCanvasImpl-B4VBKRBA.js} +6 -6
  4. package/dist/{EditorCanvasImpl-VkjeyOGd.js.map → EditorCanvasImpl-B4VBKRBA.js.map} +1 -1
  5. package/dist/{ImagePanel-DhOWKvIN.js → ImagePanel-bW3yr6Ac.js} +264 -259
  6. package/dist/{ImagePanel-DhOWKvIN.js.map → ImagePanel-bW3yr6Ac.js.map} +1 -1
  7. package/dist/{SnowconeCanvas-COXpmwkS.js → SnowconeCanvas-crxPwbib.js} +441 -439
  8. package/dist/SnowconeCanvas-crxPwbib.js.map +1 -0
  9. package/dist/advanced.mjs +9 -9
  10. package/dist/components/embed/SnowconeCanvas.d.ts +6 -0
  11. package/dist/components/embed/kernel.d.ts +2 -0
  12. package/dist/{custom-icons-C4bzABm2.js → custom-icons-DQRp8GhF.js} +2 -2
  13. package/dist/{custom-icons-C4bzABm2.js.map → custom-icons-DQRp8GhF.js.map} +1 -1
  14. package/dist/{design-builder-DCHVrEFV.js → design-builder-sH53Og6j.js} +598 -589
  15. package/dist/design-builder-sH53Og6j.js.map +1 -0
  16. package/dist/{embed-CamnTsuT.js → embed-CYWbpvu_.js} +6 -6
  17. package/dist/{embed-CamnTsuT.js.map → embed-CYWbpvu_.js.map} +1 -1
  18. package/dist/embed.mjs +4 -4
  19. package/dist/index.mjs +7 -7
  20. package/dist/{template-fields-CK7Uvvc8.js → template-fields-BaQG0CJY.js} +3 -3
  21. package/dist/{template-fields-CK7Uvvc8.js.map → template-fields-BaQG0CJY.js.map} +1 -1
  22. package/dist/testing.mjs +2 -2
  23. package/dist/{useCommands-BrkGKdXr.js → useCommands-F-b_SwW-.js} +3 -3
  24. package/dist/{useCommands-BrkGKdXr.js.map → useCommands-F-b_SwW-.js.map} +1 -1
  25. package/dist/{validation-jgr2OtXC.js → validation-hn5ZX8Po.js} +9 -8
  26. package/dist/{validation-jgr2OtXC.js.map → validation-hn5ZX8Po.js.map} +1 -1
  27. package/example/package.json +1 -1
  28. package/package.json +3 -3
  29. package/dist/SnowconeCanvas-COXpmwkS.js.map +0 -1
  30. package/dist/design-builder-DCHVrEFV.js.map +0 -1
@@ -1,104 +1,104 @@
1
- import { p as ee, c as te, u as ze, t as ae, I as Ge, v as Ue, x as Ve, y as Xe } from "./FontAnalyzer-Ds3Wdba7.js";
2
- import { jsx as y, Fragment as Je, jsxs as _ } from "react/jsx-runtime";
3
- import Qe, { useMemo as Re, useRef as N, useEffect as F, Component as Ye, useState as oe, useCallback as V, useImperativeHandle as Ze, forwardRef as Ce } from "react";
4
- import { a as qe, b as _e, c as et, G as tt, d as rt, Z as nt, g as at, e as ot, D as st, r as it, v as ct, S as lt, K as dt, f as ut } from "./validation-jgr2OtXC.js";
5
- import { ImagePanel as ft } from "./ImagePanel-DhOWKvIN.js";
6
- import { C as mt, a as gt } from "./ContextualToolbars-rCZo-KCm.js";
7
- import { n as ht, o as pt, E as bt, C as vt, b as he, k as Et } from "./useCommands-BrkGKdXr.js";
8
- import { C as yt, D as xt } from "./template-fields-CK7Uvvc8.js";
9
- import { E as wt, b as se, i as It, l as At, j as Ie } from "./design-builder-DCHVrEFV.js";
1
+ import { p as ee, c as te, u as Ge, t as ae, I as Ue, v as Ve, x as Xe, y as Je } from "./FontAnalyzer-Ds3Wdba7.js";
2
+ import { jsx as x, Fragment as Qe, jsxs as _ } from "react/jsx-runtime";
3
+ import Ye, { useMemo as Re, useRef as N, useEffect as F, Component as Ze, useState as oe, useCallback as V, useImperativeHandle as qe, forwardRef as Ce } from "react";
4
+ import { a as _e, b as et, c as tt, G as rt, d as nt, Z as at, g as ot, e as st, D as it, r as ct, v as lt, S as dt, K as ut, f as ft } from "./validation-hn5ZX8Po.js";
5
+ import { ImagePanel as mt } from "./ImagePanel-bW3yr6Ac.js";
6
+ import { C as gt, a as ht } from "./ContextualToolbars-5tHC6s0Y.js";
7
+ import { n as pt, o as bt, E as vt, C as Et, b as he, k as yt } from "./useCommands-F-b_SwW-.js";
8
+ import { C as xt, D as wt } from "./template-fields-BaQG0CJY.js";
9
+ import { E as It, b as se, i as At, l as St, j as Ie } from "./design-builder-sH53Og6j.js";
10
10
  import { T as Ae } from "./ThemeContext-Rjz25x9X.js";
11
- import { c as St } from "./placement-tSiIVhrL.js";
12
- import { a as kt, G as ce, E as Me, H as Ft } from "./ExportManager-xRsXgyNo.js";
11
+ import { c as kt } from "./placement-tSiIVhrL.js";
12
+ import { a as Ft, G as ce, E as Me, H as Rt } from "./ExportManager-xRsXgyNo.js";
13
13
  import { C as fe } from "./CanvasRenderer-B8BADU_r.js";
14
14
  const pe = te("KitLayout"), ne = "canvas", me = 320;
15
15
  let Se = !1;
16
- function Rt() {
17
- Se || (Se = !0, qe({
18
- EffectsPanel: _e,
19
- ExportPanel: et,
20
- ImagePanel: ft,
21
- GlyphPanel: tt,
22
- ArtboardTabs: rt,
23
- ContextualToolbars: mt,
24
- ZoomControls: nt,
25
- CropPanel: gt
16
+ function Ct() {
17
+ Se || (Se = !0, _e({
18
+ EffectsPanel: et,
19
+ ExportPanel: tt,
20
+ ImagePanel: mt,
21
+ GlyphPanel: rt,
22
+ ArtboardTabs: nt,
23
+ ContextualToolbars: gt,
24
+ ZoomControls: at,
25
+ CropPanel: ht
26
26
  }));
27
27
  }
28
- function Ct({ children: r }) {
28
+ function Mt({ children: r }) {
29
29
  const n = N(null);
30
30
  if (n.current === null) {
31
- const e = new ht();
31
+ const e = new pt();
32
32
  e.registerCanvas("legacy-kit-canvas"), n.current = {
33
- store: new xt({ elements: [], artboards: [], activeArtboard: "" }),
34
- commerce: new yt({ productId: "", mockupIds: [] }),
33
+ store: new wt({ elements: [], artboards: [], activeArtboard: "" }),
34
+ commerce: new xt({ productId: "", mockupIds: [] }),
35
35
  registry: e,
36
- ...pt((a) => pe.error("[kit section]", a))
36
+ ...bt((a) => pe.error("[kit section]", a))
37
37
  };
38
38
  }
39
- return /* @__PURE__ */ y(bt.Provider, { value: n.current, children: r });
39
+ return /* @__PURE__ */ x(vt.Provider, { value: n.current, children: r });
40
40
  }
41
41
  function le({ ids: r }) {
42
- return !r || r.length === 0 ? null : /* @__PURE__ */ y(Ct, { children: r.map((n) => {
42
+ return !r || r.length === 0 ? null : /* @__PURE__ */ x(Mt, { children: r.map((n) => {
43
43
  var t;
44
44
  if (n === ne) return null;
45
- const e = at(n);
45
+ const e = ot(n);
46
46
  if (!e)
47
47
  return typeof ee < "u" && ((t = ee.env) == null ? void 0 : t.NODE_ENV) === "development" && pe.warn(
48
48
  `Kit layout references unknown section "${n}" — skipping. Register it with registerSection("${n}", { ... }).`
49
49
  ), null;
50
50
  const a = e.component;
51
- return /* @__PURE__ */ y(a, {}, n);
51
+ return /* @__PURE__ */ x(a, {}, n);
52
52
  }) });
53
53
  }
54
- function Mt({ kit: r, canvas: n }) {
55
- var v, c, w, A;
56
- Rt();
57
- const e = r.layout.slots, a = !!((v = e.topbar) != null && v.some((S) => S !== ne)), t = !!((c = e.left) != null && c.some((S) => S !== ne)), o = !!((w = e.right) != null && w.some((S) => S !== ne)), i = !!((A = e.bottombar) != null && A.some((S) => S !== ne)), l = Re(
54
+ function Tt({ kit: r, canvas: n }) {
55
+ var p, c, A, S;
56
+ Ct();
57
+ const e = r.layout.slots, a = !!((p = e.topbar) != null && p.some((y) => y !== ne)), t = !!((c = e.left) != null && c.some((y) => y !== ne)), o = !!((A = e.right) != null && A.some((y) => y !== ne)), i = !!((S = e.bottombar) != null && S.some((y) => y !== ne)), l = Re(
58
58
  () => !a && !t && !o && !i,
59
59
  [a, t, o, i]
60
- ), s = N(null), m = a || t || o || i, h = N(!1);
60
+ ), s = N(null), h = a || t || o || i, v = N(!1);
61
61
  return F(() => {
62
- var u;
63
- if (typeof ee > "u" || ((u = ee.env) == null ? void 0 : u.NODE_ENV) !== "development" || !m) return;
64
- const S = s.current;
65
- if (!S || typeof ResizeObserver > "u") return;
66
- const $ = (x) => {
67
- x > 0 && x < me && !h.current ? (h.current = !0, pe.warn(
68
- `Kit "${r.name}" declares chrome (toolbar / panels) but its container is only ${Math.round(x)}px wide — below the ~${me}px needed to render it, so the toolbar / panels are suppressed and the editor looks like a bare canvas. Give the editor more container width, or pass kit="embed-only" if a chrome-less canvas is intended.`
69
- )) : x >= me && (h.current = !1);
62
+ var w;
63
+ if (typeof ee > "u" || ((w = ee.env) == null ? void 0 : w.NODE_ENV) !== "development" || !h) return;
64
+ const y = s.current;
65
+ if (!y || typeof ResizeObserver > "u") return;
66
+ const L = (f) => {
67
+ f > 0 && f < me && !v.current ? (v.current = !0, pe.warn(
68
+ `Kit "${r.name}" declares chrome (toolbar / panels) but its container is only ${Math.round(f)}px wide — below the ~${me}px needed to render it, so the toolbar / panels are suppressed and the editor looks like a bare canvas. Give the editor more container width, or pass kit="embed-only" if a chrome-less canvas is intended.`
69
+ )) : f >= me && (v.current = !1);
70
70
  };
71
- $(S.getBoundingClientRect().width);
72
- const T = new ResizeObserver((x) => {
73
- for (const d of x) $(d.contentRect.width);
71
+ L(y.getBoundingClientRect().width);
72
+ const T = new ResizeObserver((f) => {
73
+ for (const m of f) L(m.contentRect.width);
74
74
  });
75
- return T.observe(S), () => T.disconnect();
76
- }, [m, r.name]), l ? /* @__PURE__ */ y(Je, { children: n }) : /* @__PURE__ */ _("div", { ref: s, className: "sc-kit-layout", style: { display: "flex", flexDirection: "column", height: "100%", minHeight: 0 }, children: [
77
- a && /* @__PURE__ */ y(
75
+ return T.observe(y), () => T.disconnect();
76
+ }, [h, r.name]), l ? /* @__PURE__ */ x(Qe, { children: n }) : /* @__PURE__ */ _("div", { ref: s, className: "sc-kit-layout", style: { display: "flex", flexDirection: "column", height: "100%", minHeight: 0 }, children: [
77
+ a && /* @__PURE__ */ x(
78
78
  "div",
79
79
  {
80
80
  className: "sc-kit-topbar sc-toolbar",
81
81
  style: { display: "flex", alignItems: "center", gap: 8, flexWrap: "wrap", flexShrink: 0 },
82
- children: /* @__PURE__ */ y(le, { ids: e.topbar })
82
+ children: /* @__PURE__ */ x(le, { ids: e.topbar })
83
83
  }
84
84
  ),
85
85
  /* @__PURE__ */ _("div", { className: "sc-kit-body", style: { display: "flex", flex: 1, minHeight: 0 }, children: [
86
- t && /* @__PURE__ */ y("div", { className: "sc-kit-left", style: { flexShrink: 0, overflow: "auto" }, children: /* @__PURE__ */ y(le, { ids: e.left }) }),
87
- /* @__PURE__ */ y("div", { className: "sc-kit-canvas", style: { flex: 1, minWidth: 0, position: "relative" }, children: n }),
88
- o && /* @__PURE__ */ y("div", { className: "sc-kit-right", style: { flexShrink: 0, overflow: "auto" }, children: /* @__PURE__ */ y(le, { ids: e.right }) })
86
+ t && /* @__PURE__ */ x("div", { className: "sc-kit-left", style: { flexShrink: 0, overflow: "auto" }, children: /* @__PURE__ */ x(le, { ids: e.left }) }),
87
+ /* @__PURE__ */ x("div", { className: "sc-kit-canvas", style: { flex: 1, minWidth: 0, position: "relative" }, children: n }),
88
+ o && /* @__PURE__ */ x("div", { className: "sc-kit-right", style: { flexShrink: 0, overflow: "auto" }, children: /* @__PURE__ */ x(le, { ids: e.right }) })
89
89
  ] }),
90
- i && /* @__PURE__ */ y(
90
+ i && /* @__PURE__ */ x(
91
91
  "div",
92
92
  {
93
93
  className: "sc-kit-bottombar sc-toolbar",
94
94
  style: { display: "flex", alignItems: "center", gap: 8, flexShrink: 0 },
95
- children: /* @__PURE__ */ y(le, { ids: e.bottombar })
95
+ children: /* @__PURE__ */ x(le, { ids: e.bottombar })
96
96
  }
97
97
  )
98
98
  ] });
99
99
  }
100
- const Tt = te("ErrorBoundary");
101
- class Nt extends Ye {
100
+ const Nt = te("ErrorBoundary");
101
+ class Pt extends Ze {
102
102
  constructor(n) {
103
103
  super(n), this.resetError = () => {
104
104
  this.setState({
@@ -117,7 +117,7 @@ class Nt extends Ye {
117
117
  };
118
118
  }
119
119
  componentDidCatch(n, e) {
120
- if (Tt.error("Caught error:", n, e), this.props.onError && this.props.onError(n, e), this.props.onCanvasError) {
120
+ if (Nt.error("Caught error:", n, e), this.props.onError && this.props.onError(n, e), this.props.onCanvasError) {
121
121
  const a = {
122
122
  category: "unknown",
123
123
  message: n.message,
@@ -140,8 +140,8 @@ class Nt extends Ye {
140
140
  fontFamily: "system-ui, sans-serif"
141
141
  },
142
142
  children: [
143
- /* @__PURE__ */ y("h2", { style: { margin: "0 0 16px 0", fontSize: "18px", fontWeight: 600 }, children: "Something went wrong" }),
144
- /* @__PURE__ */ y(
143
+ /* @__PURE__ */ x("h2", { style: { margin: "0 0 16px 0", fontSize: "18px", fontWeight: 600 }, children: "Something went wrong" }),
144
+ /* @__PURE__ */ x(
145
145
  "pre",
146
146
  {
147
147
  style: {
@@ -156,7 +156,7 @@ class Nt extends Ye {
156
156
  children: this.state.error.message
157
157
  }
158
158
  ),
159
- /* @__PURE__ */ y(
159
+ /* @__PURE__ */ x(
160
160
  "button",
161
161
  {
162
162
  onClick: this.resetError,
@@ -185,35 +185,35 @@ function Lt({
185
185
  viewPadding: a,
186
186
  children: t
187
187
  }) {
188
- const o = n ? /* @__PURE__ */ y(Ae, { defaultTheme: "light", passive: r, children: t }) : /* @__PURE__ */ y(Ae, { defaultTheme: "light", passive: r, children: /* @__PURE__ */ y(wt, { viewPadding: a, children: t }) });
189
- return e ? /* @__PURE__ */ y(vt, { services: e, children: o }) : o;
188
+ const o = n ? /* @__PURE__ */ x(Ae, { defaultTheme: "light", passive: r, children: t }) : /* @__PURE__ */ x(Ae, { defaultTheme: "light", passive: r, children: /* @__PURE__ */ x(It, { viewPadding: a, children: t }) });
189
+ return e ? /* @__PURE__ */ x(Et, { services: e, children: o }) : o;
190
190
  }
191
- const Pt = te("useAutoExport");
192
- function $t(r) {
193
- const { config: n, historyManager: e, artboards: a, elements: t, onExport: o, onExportScheduled: i, isCanvasReady: l = !1 } = r, s = N(null), m = N(!1), h = N({
191
+ const $t = te("useAutoExport");
192
+ function Ot(r) {
193
+ const { config: n, historyManager: e, artboards: a, elements: t, onExport: o, onExportScheduled: i, isCanvasReady: l = !1 } = r, s = N(null), h = N(!1), v = N({
194
194
  totalExports: 0,
195
195
  skippedExports: 0,
196
196
  lastExportTime: null,
197
197
  avgExportInterval: 0,
198
198
  failedExports: 0,
199
199
  lastExportError: null
200
- }), [v, c] = oe(h.current), w = N(o);
201
- w.current = o, F(() => {
202
- const u = new ot({
203
- ...st,
200
+ }), [p, c] = oe(v.current), A = N(o);
201
+ A.current = o, F(() => {
202
+ const w = new st({
203
+ ...it,
204
204
  ...n
205
205
  });
206
- return u.onExport(async () => {
206
+ return w.onExport(async () => {
207
207
  try {
208
- await w.current(), h.current = u.getStats();
209
- } catch (x) {
210
- Pt.error("[useAutoExport] Export failed:", x);
208
+ await A.current(), v.current = w.getStats();
209
+ } catch (f) {
210
+ $t.error("[useAutoExport] Export failed:", f);
211
211
  }
212
- }), s.current = u, () => {
213
- u.destroy();
212
+ }), s.current = w, () => {
213
+ w.destroy();
214
214
  };
215
215
  }, []), F(() => {
216
- l && m.current && s.current && (m.current = !1, s.current.forceExport());
216
+ l && h.current && s.current && (h.current = !1, s.current.forceExport());
217
217
  }, [l]), F(() => {
218
218
  s.current && n && s.current.updateConfig(n);
219
219
  }, [n == null ? void 0 : n.enabled, n == null ? void 0 : n.debounceMs, n == null ? void 0 : n.maxWaitMs]), F(() => {
@@ -221,49 +221,49 @@ function $t(r) {
221
221
  }, [i]), F(() => {
222
222
  if (!e || !s.current)
223
223
  return;
224
- const u = e.onCommandExecuted(() => {
224
+ const w = e.onCommandExecuted(() => {
225
225
  if (s.current) {
226
226
  if (!l) {
227
- m.current = !0;
227
+ h.current = !0;
228
228
  return;
229
229
  }
230
230
  s.current.scheduleExport();
231
231
  }
232
232
  });
233
233
  return () => {
234
- u();
234
+ w();
235
235
  };
236
236
  }, [e, l]), F(() => {
237
237
  if (s.current) {
238
238
  if (!l) {
239
- m.current = !0;
239
+ h.current = !0;
240
240
  return;
241
241
  }
242
242
  s.current.scheduleExport();
243
243
  }
244
- }, [t, a, l]), F(() => ze((x) => {
244
+ }, [t, a, l]), F(() => Ge((f) => {
245
245
  if (!s.current || !l) return;
246
- t.some((p) => p.id === x) && s.current.scheduleExport();
246
+ t.some((d) => d.id === f) && s.current.scheduleExport();
247
247
  }), [t, l]);
248
- const A = V((u) => {
249
- s.current && s.current.updateConfig(u);
250
- }, []), S = V(async () => {
251
- s.current && (await s.current.forceExport(), h.current = s.current.getStats(), c(h.current));
252
- }, []), $ = V(() => {
253
- s.current && (s.current.resetStats(), h.current = s.current.getStats(), c(h.current));
248
+ const S = V((w) => {
249
+ s.current && s.current.updateConfig(w);
250
+ }, []), y = V(async () => {
251
+ s.current && (await s.current.forceExport(), v.current = s.current.getStats(), c(v.current));
252
+ }, []), L = V(() => {
253
+ s.current && (s.current.resetStats(), v.current = s.current.getStats(), c(v.current));
254
254
  }, []), T = V(() => {
255
255
  s.current && s.current.resetChangeDetection();
256
256
  }, []);
257
257
  return {
258
- stats: v,
259
- updateConfig: A,
260
- forceExport: S,
261
- resetStats: $,
258
+ stats: p,
259
+ updateConfig: S,
260
+ forceExport: y,
261
+ resetStats: L,
262
262
  resetChangeDetection: T
263
263
  };
264
264
  }
265
265
  const Te = te("useContentReady");
266
- function Ot(r) {
266
+ function Dt(r) {
267
267
  var e;
268
268
  const n = /* @__PURE__ */ new Set();
269
269
  for (const a of r)
@@ -277,7 +277,7 @@ function Ot(r) {
277
277
  }
278
278
  return Array.from(n);
279
279
  }
280
- async function Dt(r) {
280
+ async function Bt(r) {
281
281
  if (r.length === 0 || typeof document > "u" || !document.fonts) return;
282
282
  const n = [];
283
283
  for (const e of r) {
@@ -289,10 +289,10 @@ async function Dt(r) {
289
289
  new Promise((e) => setTimeout(e, 250))
290
290
  ]), Te.debug(`Awaited ${n.length} font(s)`);
291
291
  }
292
- function Bt() {
292
+ function Wt() {
293
293
  return new Promise((r) => requestAnimationFrame(() => r()));
294
294
  }
295
- function Wt(r) {
295
+ function Ht(r) {
296
296
  const { isCanvasReady: n, elements: e, hasInitialElements: a, initialElementsLoaded: t } = r, [o, i] = oe(!1), l = N(!1);
297
297
  return F(() => {
298
298
  if (o || !n || a && !t || a && e.length === 0 || l.current) return;
@@ -300,11 +300,11 @@ function Wt(r) {
300
300
  let s = !1;
301
301
  return (async () => {
302
302
  try {
303
- const m = Ot(e);
304
- if (m.length > 0 && (await Dt(m), s) || (await Bt(), s)) return;
303
+ const h = Dt(e);
304
+ if (h.length > 0 && (await Bt(h), s) || (await Wt(), s)) return;
305
305
  i(!0);
306
- } catch (m) {
307
- Te.error("Error during content readiness check:", m), s || i(!0);
306
+ } catch (h) {
307
+ Te.error("Error during content readiness check:", h), s || i(!0);
308
308
  } finally {
309
309
  l.current = !1;
310
310
  }
@@ -314,7 +314,7 @@ function Wt(r) {
314
314
  }, [n, e, a, t, o]), o;
315
315
  }
316
316
  const ke = /^#[0-9a-fA-F]{6}$/, q = (r, n, e) => typeof r == "number" && Number.isFinite(r) && r >= n && r <= e;
317
- function Ht(r, n) {
317
+ function Kt(r, n) {
318
318
  if (!r || r.length === 0) return [];
319
319
  if (!n)
320
320
  throw new ae(
@@ -329,8 +329,8 @@ function Ht(r, n) {
329
329
  throw new ae("E_INITIAL_TEXT_INVALID", `initialImageText[${a}]: ${t.join("; ")}.`, { docSlug: "initial-image-text", index: a });
330
330
  }), r;
331
331
  }
332
- function Kt(r, n, e) {
333
- const a = r.fontSize * n.height, t = (r.letterSpacing ?? 0) * n.height, o = e(r.text, a, r.fontFamily, t), i = n.left + r.left * n.width, l = (r.width ?? 0) * n.width, s = r.align === "center" ? i + l / 2 : r.align === "right" ? i + l - o.advance / 2 : i + o.advance / 2, m = n.top + r.baseline * n.height;
332
+ function jt(r, n, e) {
333
+ const a = r.fontSize * n.height, t = (r.letterSpacing ?? 0) * n.height, o = e(r.text, a, r.fontFamily, t), i = n.left + r.left * n.width, l = (r.width ?? 0) * n.width, s = r.align === "center" ? i + l / 2 : r.align === "right" ? i + l - o.advance / 2 : i + o.advance / 2, h = n.top + r.baseline * n.height;
334
334
  return {
335
335
  transformType: "custom",
336
336
  name: r.name ?? r.text,
@@ -342,24 +342,24 @@ function Kt(r, n, e) {
342
342
  ...t !== 0 ? { letterSpacing: t } : {},
343
343
  ...r.stroke ? { stroke: { enabled: !0, color: r.stroke.color, width: r.stroke.width * n.height, lineJoin: "round", lineCap: "round" } } : {},
344
344
  x: s,
345
- y: m - o.ascent + (o.ascent + o.descent) / 2,
345
+ y: h - o.ascent + (o.ascent + o.descent) / 2,
346
346
  rotation: 0,
347
347
  // Room past the measured advance: the editor wraps a line at its box, and measures spaced letters a little
348
348
  // wider when it wraps than when it measures (a spaced "BRIDE SQUAD" broke onto two lines at its exact width).
349
349
  transformData: { type: "custom", controlPoints: [], width: Math.ceil(o.advance + 2 * Math.abs(t) + 0.5 * a) }
350
350
  };
351
351
  }
352
- const jt = 1e4;
352
+ const zt = 1e4;
353
353
  function Ne(r) {
354
354
  const n = [];
355
355
  for (const e of r) {
356
- e instanceof Ge && n.push(e);
356
+ e instanceof Ue && n.push(e);
357
357
  const a = e.children;
358
358
  Array.isArray(a) && n.push(...Ne(a));
359
359
  }
360
360
  return n;
361
361
  }
362
- async function zt(r, n, e) {
362
+ async function Gt(r, n, e) {
363
363
  const a = Date.now();
364
364
  for (; ; ) {
365
365
  const t = Ne(n.filter((i) => i.visible !== !1)).filter((i) => !i.imageElement || !i.imageLoaded);
@@ -376,7 +376,7 @@ async function zt(r, n, e) {
376
376
  await new Promise((i) => setTimeout(i, 100));
377
377
  }
378
378
  }
379
- async function Gt(r, n, e = {}, a = {}) {
379
+ async function Ut(r, n, e = {}, a = {}) {
380
380
  var i, l;
381
381
  const t = r.map((s) => s.name);
382
382
  for (const s of Object.keys(e.regions ?? {}))
@@ -387,13 +387,13 @@ async function Gt(r, n, e = {}, a = {}) {
387
387
  });
388
388
  const o = {};
389
389
  for (const s of r) {
390
- const m = n(s);
391
- await zt(s, m, a.imageWaitMs ?? jt);
392
- const h = (i = e.regions) == null ? void 0 : i[s.name], v = h ? h.map((c) => ({ key: c.id, region: c })) : [{ key: s.name }];
393
- for (const { key: c, region: w } of v) {
390
+ const h = n(s);
391
+ await Gt(s, h, a.imageWaitMs ?? zt);
392
+ const v = (i = e.regions) == null ? void 0 : i[s.name], p = v ? v.map((c) => ({ key: c.id, region: c })) : [{ key: s.name }];
393
+ for (const { key: c, region: A } of p) {
394
394
  if (c in o)
395
395
  throw new ae("E_PRINT_FILE_FAILED", `two print files are keyed "${c}": region ids and artboard names must all differ.`, { key: c });
396
- o[c] = await kt.exportPrintFile(s, m, { scale: ((l = e.scale) == null ? void 0 : l[c]) ?? 1, region: w });
396
+ o[c] = await Ft.exportPrintFile(s, h, { scale: ((l = e.scale) == null ? void 0 : l[c]) ?? 1, region: A });
397
397
  }
398
398
  }
399
399
  return o;
@@ -408,7 +408,7 @@ function ge(r, n, e, a) {
408
408
  const l = Math.max(r, n), s = a / l;
409
409
  return Math.min(s, e);
410
410
  }
411
- function Ut(r) {
411
+ function Vt(r) {
412
412
  const n = N(r);
413
413
  n.current = r;
414
414
  const e = V((t) => {
@@ -428,7 +428,7 @@ function Ut(r) {
428
428
  }, [e]);
429
429
  return { emitError: e, handleBoundaryError: a };
430
430
  }
431
- function Vt(r) {
431
+ function Xt(r) {
432
432
  const {
433
433
  artboardConfigs: n,
434
434
  width: e,
@@ -439,162 +439,162 @@ function Vt(r) {
439
439
  resetDocumentOnMount: l
440
440
  } = r, {
441
441
  setElements: s,
442
- setSelectedId: m,
443
- setMultiSelection: h,
444
- artboardManager: v,
442
+ setSelectedId: h,
443
+ setMultiSelection: v,
444
+ artboardManager: p,
445
445
  refreshArtboards: c
446
- } = se(), { createArtboard: w, selectArtboard: A, artboards: S } = he(), $ = N(!1), T = N(!1);
446
+ } = se(), { createArtboard: A, selectArtboard: S, artboards: y } = he(), L = N(!1), T = N(!1);
447
447
  F(() => {
448
- if ($.current) return;
449
- $.current = !0;
450
- const d = n || [{ name: "Design", width: e, height: a }], p = t ? "transparent" : void 0, b = (E) => E.exportBackground ?? (!!E.backgroundColor && E.backgroundColor !== "transparent"), g = () => {
451
- for (const E of v.getAllArtboards()) {
452
- const f = d.find((I) => I.name === E.name);
453
- E.imageFit = It(f), E.engrave = f != null && f.engrave ? { ...f.engrave } : void 0;
448
+ if (L.current) return;
449
+ L.current = !0;
450
+ const m = n || [{ name: "Design", width: e, height: a }], d = t ? "transparent" : void 0, b = (E) => E.exportBackground ?? (!!E.backgroundColor && E.backgroundColor !== "transparent"), g = () => {
451
+ for (const E of p.getAllArtboards()) {
452
+ const u = m.find((I) => I.name === E.name);
453
+ E.imageFit = At(u), E.engrave = u != null && u.engrave ? { ...u.engrave } : void 0;
454
454
  }
455
455
  };
456
456
  if (l) {
457
- v.clear(), s([]), m(null), h([]);
458
- for (const f of d)
459
- v.createArtboard({
460
- name: f.name,
461
- width: f.width,
462
- height: f.height,
463
- backgroundColor: f.backgroundColor ?? p,
464
- exportBackground: b(f),
465
- clipShape: f.clipShape,
466
- role: f.role
457
+ p.clear(), s([]), h(null), v([]);
458
+ for (const u of m)
459
+ p.createArtboard({
460
+ name: u.name,
461
+ width: u.width,
462
+ height: u.height,
463
+ backgroundColor: u.backgroundColor ?? d,
464
+ exportBackground: b(u),
465
+ clipShape: u.clipShape,
466
+ role: u.role
467
467
  });
468
- const E = v.getAllArtboards();
469
- E.length > 0 && !o && v.setActiveArtboard(E[0].id), g(), c();
468
+ const E = p.getAllArtboards();
469
+ E.length > 0 && !o && p.setActiveArtboard(E[0].id), g(), c();
470
470
  return;
471
471
  }
472
- const k = v.getAllArtboards();
472
+ const k = p.getAllArtboards();
473
473
  if (k.length > 0) {
474
- const E = d[0], f = k[0];
475
- f.name = E.name, f.width = E.width, f.height = E.height, f.clipShape = E.clipShape, f.exportBackground = b(E), f.role = E.role, E.backgroundColor ? f.backgroundColor = E.backgroundColor : p && (f.backgroundColor = p);
476
- for (let I = 1; I < d.length; I++)
477
- w(d[I].width, d[I].height, {
478
- name: d[I].name,
479
- backgroundColor: d[I].backgroundColor ?? p,
480
- exportBackground: b(d[I]),
481
- clipShape: d[I].clipShape,
482
- role: d[I].role
474
+ const E = m[0], u = k[0];
475
+ u.name = E.name, u.width = E.width, u.height = E.height, u.clipShape = E.clipShape, u.exportBackground = b(E), u.role = E.role, E.backgroundColor ? u.backgroundColor = E.backgroundColor : d && (u.backgroundColor = d);
476
+ for (let I = 1; I < m.length; I++)
477
+ A(m[I].width, m[I].height, {
478
+ name: m[I].name,
479
+ backgroundColor: m[I].backgroundColor ?? d,
480
+ exportBackground: b(m[I]),
481
+ clipShape: m[I].clipShape,
482
+ role: m[I].role
483
483
  });
484
- !o && d.length > 1 && v.setActiveArtboard(f.id);
484
+ !o && m.length > 1 && p.setActiveArtboard(u.id);
485
485
  }
486
486
  g(), c();
487
487
  }, []);
488
- const u = JSON.stringify((n ?? []).map((d) => [d.name, d.engrave ?? null])), x = N(u);
488
+ const w = JSON.stringify((n ?? []).map((m) => [m.name, m.engrave ?? null])), f = N(w);
489
489
  F(() => {
490
- if (x.current !== u) {
491
- x.current = u;
492
- for (const d of v.getAllArtboards()) {
493
- const p = (n ?? []).find((b) => b.name === d.name);
494
- d.engrave = p != null && p.engrave ? { ...p.engrave } : void 0;
490
+ if (f.current !== w) {
491
+ f.current = w;
492
+ for (const m of p.getAllArtboards()) {
493
+ const d = (n ?? []).find((b) => b.name === m.name);
494
+ m.engrave = d != null && d.engrave ? { ...d.engrave } : void 0;
495
495
  }
496
496
  c();
497
497
  }
498
- }, [u]), F(() => {
498
+ }, [w]), F(() => {
499
499
  if (!o) {
500
500
  T.current = !0;
501
501
  return;
502
502
  }
503
- const d = S.find((p) => p.name === o);
504
- if (d) {
505
- const p = v.getActiveArtboard();
506
- (p == null ? void 0 : p.name) !== o && A(d.id), T.current = !0;
503
+ const m = y.find((d) => d.name === o);
504
+ if (m) {
505
+ const d = p.getActiveArtboard();
506
+ (d == null ? void 0 : d.name) !== o && S(m.id), T.current = !0;
507
507
  }
508
- }, [o, S]), F(() => {
508
+ }, [o, y]), F(() => {
509
509
  if (!i || !T.current) return;
510
- const d = v.getActiveArtboard();
511
- d && i(d.name);
512
- }, [v.getActiveArtboardId()]);
510
+ const m = p.getActiveArtboard();
511
+ m && i(m.name);
512
+ }, [p.getActiveArtboardId()]);
513
513
  }
514
- function Xt(r) {
515
- const { initialElements: n, emitError: e, customFonts: a } = r, { setElements: t, artboardManager: o } = se(), i = N(!1), [l, s] = oe(!1), m = N(!0);
516
- return F(() => (m.current = !0, () => {
517
- m.current = !1;
514
+ function Jt(r) {
515
+ const { initialElements: n, emitError: e, customFonts: a, role: t = "design" } = r, { setElements: o, artboardManager: i } = se(), l = N(!1), [s, h] = oe(!1), v = N(!0);
516
+ return F(() => (v.current = !0, () => {
517
+ v.current = !1;
518
518
  }), []), F(() => {
519
- if (!(!n || n.length === 0) && !i.current) {
520
- i.current = !0, s(!0);
519
+ if (!(!n || n.length === 0) && !l.current) {
520
+ l.current = !0, h(!0);
521
521
  try {
522
522
  a && a.length > 0 && ce.register(a);
523
- const h = Me.createManyFromJSON(n), v = o.getAllArtboards();
524
- if (v.length > 0) {
525
- const w = new Map(v.map((A) => [A.name, A]));
526
- h.forEach((A, S) => {
527
- var u;
528
- const $ = (u = n[S]) == null ? void 0 : u.artboard, T = $ && w.get($) || v[0];
529
- o.addElementToArtboard(A.id, T.id);
523
+ const p = Me.createManyFromJSON(n), c = i.getAllArtboards();
524
+ if (c.length > 0) {
525
+ const S = new Map(c.map((y) => [y.name, y]));
526
+ p.forEach((y, L) => {
527
+ var f;
528
+ const T = (f = n[L]) == null ? void 0 : f.artboard, w = T && S.get(T) || c[0];
529
+ i.addElementToArtboard(y.id, w.id);
530
530
  });
531
531
  }
532
- t(h);
533
- const c = /* @__PURE__ */ new Set();
534
- for (const w of h) {
535
- const A = w.fontFamily;
536
- typeof A == "string" && A.trim().length > 0 && c.add(A);
532
+ o(p), t === "placeholder" && i.markPlaceholders(p.map((S) => S.id));
533
+ const A = /* @__PURE__ */ new Set();
534
+ for (const S of p) {
535
+ const y = S.fontFamily;
536
+ typeof y == "string" && y.trim().length > 0 && A.add(y);
537
537
  }
538
- if (c.size > 0 && typeof document < "u") {
539
- const w = document.fonts ?? null, A = Array.from(c).filter(
540
- (u) => ce.has(u)
541
- ), S = Ft(
542
- ce.forFamilies(A),
538
+ if (A.size > 0 && typeof document < "u") {
539
+ const S = document.fonts ?? null, y = Array.from(A).filter(
540
+ (f) => ce.has(f)
541
+ ), L = Rt(
542
+ ce.forFamilies(y),
543
543
  {
544
- onLoadError: (u) => {
545
- m.current && e({
544
+ onLoadError: (f) => {
545
+ v.current && e({
546
546
  category: "import",
547
- message: u.message,
548
- originalError: u,
547
+ message: f.message,
548
+ originalError: f,
549
549
  recoverable: !0
550
550
  });
551
551
  }
552
552
  }
553
- ), T = Array.from(c).filter(
554
- (u) => !ce.has(u)
555
- ).map((u) => {
556
- const x = `font-${u.replace(/\s+/g, "-").toLowerCase()}`;
557
- let d = document.getElementById(x);
558
- return d || (d = document.createElement("link"), d.id = x, d.rel = "stylesheet", d.href = `https://fonts.googleapis.com/css2?family=${u.replace(
553
+ ), w = Array.from(A).filter(
554
+ (f) => !ce.has(f)
555
+ ).map((f) => {
556
+ const m = `font-${f.replace(/\s+/g, "-").toLowerCase()}`;
557
+ let d = document.getElementById(m);
558
+ return d || (d = document.createElement("link"), d.id = m, d.rel = "stylesheet", d.href = `https://fonts.googleapis.com/css2?family=${f.replace(
559
559
  /\s+/g,
560
560
  "+"
561
- )}:wght@400;700&display=swap`, document.head.appendChild(d)), new Promise((p) => {
561
+ )}:wght@400;700&display=swap`, document.head.appendChild(d)), new Promise((b) => {
562
562
  if (d.sheet) {
563
- p(u);
563
+ b(f);
564
564
  return;
565
565
  }
566
- const b = () => p(u);
567
- d.addEventListener("load", b, { once: !0 }), d.addEventListener("error", b, { once: !0 }), setTimeout(b, 4e3);
566
+ const g = () => b(f);
567
+ d.addEventListener("load", g, { once: !0 }), d.addEventListener("error", g, { once: !0 }), setTimeout(g, 4e3);
568
568
  });
569
569
  });
570
- Promise.all([Promise.all(T), S]).then(([u]) => {
571
- if (!(!m.current || !w))
570
+ Promise.all([Promise.all(w), L]).then(([f]) => {
571
+ if (!(!v.current || !S))
572
572
  return Promise.all(
573
- u.flatMap((x) => [
574
- w.load(`400 16px "${x}"`).catch(() => {
573
+ f.flatMap((m) => [
574
+ S.load(`400 16px "${m}"`).catch(() => {
575
575
  }),
576
- w.load(`700 16px "${x}"`).catch(() => {
576
+ S.load(`700 16px "${m}"`).catch(() => {
577
577
  })
578
578
  ])
579
579
  );
580
580
  }).then(() => {
581
- m.current && t((u) => u.slice());
581
+ v.current && o((f) => f.slice());
582
582
  });
583
583
  }
584
- } catch (h) {
585
- Q.error("Failed to load initial elements:", h);
586
- const v = h instanceof Error ? h : new Error(String(h));
584
+ } catch (p) {
585
+ Q.error("Failed to load initial elements:", p);
586
+ const c = p instanceof Error ? p : new Error(String(p));
587
587
  e({
588
588
  category: "import",
589
- message: `Failed to load initial elements: ${v.message}`,
590
- originalError: v,
589
+ message: `Failed to load initial elements: ${c.message}`,
590
+ originalError: c,
591
591
  recoverable: !0
592
592
  });
593
593
  }
594
594
  }
595
- }, [n, o, t, e, a]), { initialElementsLoadedState: l };
595
+ }, [n, i, o, e, a]), { initialElementsLoadedState: s };
596
596
  }
597
- function Jt(r) {
597
+ function Qt(r) {
598
598
  const {
599
599
  initialImage: n,
600
600
  initialImageText: e,
@@ -604,46 +604,46 @@ function Jt(r) {
604
604
  initialImageRole: i,
605
605
  artboardConfigs: l,
606
606
  onImageLoad: s,
607
- onImageError: m,
608
- emitError: h
609
- } = r, { elements: v, setElements: c, artboardManager: w } = se(), [A, S] = oe("idle"), [$, T] = oe(null), u = N(void 0);
607
+ onImageError: h,
608
+ emitError: v
609
+ } = r, { elements: p, setElements: c, artboardManager: A } = se(), [S, y] = oe("idle"), [L, T] = oe(null), w = N(void 0);
610
610
  return F(() => {
611
- if (!n || u.current === n) return;
612
- if (v.length > 0) {
613
- u.current = n;
611
+ if (!n || w.current === n) return;
612
+ if (p.length > 0) {
613
+ w.current = n;
614
614
  return;
615
615
  }
616
- u.current = n, (async () => {
617
- S("loading"), T(null);
616
+ w.current = n, (async () => {
617
+ y("loading"), T(null);
618
618
  try {
619
- const d = w.getAllArtboards();
620
- if (d.length === 0)
619
+ const m = A.getAllArtboards();
620
+ if (m.length === 0)
621
621
  throw new Error("No artboards available");
622
- const p = [];
623
- for (const b of d) {
622
+ const d = [];
623
+ for (const b of m) {
624
624
  const g = l == null ? void 0 : l.find((I) => I.name === b.name), k = (g == null ? void 0 : g.scaleMode) || o, E = (g == null ? void 0 : g.imageRegions) ?? [];
625
625
  if (E.length > 0) {
626
- const I = await At(n);
626
+ const I = await St(n);
627
627
  if (!I.success || !I.width || !I.height) {
628
628
  Q.error("Failed to load image for artboard:", b.name, I.error);
629
629
  continue;
630
630
  }
631
631
  for (const W of E) {
632
- const L = St(I.width / I.height, W), H = await Ie(
632
+ const P = kt(I.width / I.height, W), H = await Ie(
633
633
  n,
634
634
  {
635
- artboard: { width: L.width, height: L.height, x: b.x + L.centerX - L.width / 2, y: b.y + L.centerY - L.height / 2 },
635
+ artboard: { width: P.width, height: P.height, x: b.x + P.centerX - P.width / 2, y: b.y + P.centerY - P.height / 2 },
636
636
  alignment: "center",
637
637
  scale: 1,
638
638
  scaleMode: "cover"
639
639
  },
640
- { transformData: { type: "image", width: L.width, height: L.height, cropX: L.cropX, cropY: L.cropY, cropWidth: L.cropWidth, cropHeight: L.cropHeight } }
640
+ { transformData: { type: "image", width: P.width, height: P.height, cropX: P.cropX, cropY: P.cropY, cropWidth: P.cropWidth, cropHeight: P.cropHeight } }
641
641
  );
642
- H.success && H.element ? (w.addElementToArtboard(H.element.id, b.id), p.push(H.element)) : Q.error("Failed to load image for a panel of artboard:", b.name, H.error);
642
+ H.success && H.element ? (A.addElementToArtboard(H.element.id, b.id), d.push(H.element)) : Q.error("Failed to load image for a panel of artboard:", b.name, H.error);
643
643
  }
644
644
  continue;
645
645
  }
646
- const f = await Ie(
646
+ const u = await Ie(
647
647
  n,
648
648
  {
649
649
  artboard: {
@@ -661,64 +661,64 @@ function Jt(r) {
661
661
  marginLeft: g == null ? void 0 : g.fitMarginLeft
662
662
  }
663
663
  );
664
- f.success && f.element ? (w.addElementToArtboard(f.element.id, b.id), p.push(f.element)) : Q.error("Failed to load image for artboard:", b.name, f.error);
664
+ u.success && u.element ? (A.addElementToArtboard(u.element.id, b.id), d.push(u.element)) : Q.error("Failed to load image for artboard:", b.name, u.error);
665
665
  }
666
- if (e.length > 0 && p.length > 0) {
667
- const b = await Zt(Array.from(new Set(e.map((k) => k.fontFamily))));
666
+ if (e.length > 0 && d.length > 0) {
667
+ const b = await qt(Array.from(new Set(e.map((k) => k.fontFamily))));
668
668
  for (const k of b)
669
- h({
669
+ v({
670
670
  category: "import",
671
671
  message: `E_FONT_LOAD_FAILED: the font "${k}" for initialImageText could not be loaded; its words are drawn in a fallback font until it loads.`,
672
672
  recoverable: !0
673
673
  });
674
- const g = (k, E, f, I) => {
675
- const W = Ue(E, f);
676
- return { advance: Ve(k, E, f, !1, !1, I), ascent: W.ascent, descent: W.descent };
674
+ const g = (k, E, u, I) => {
675
+ const W = Ve(E, u);
676
+ return { advance: Xe(k, E, u, !1, !1, I), ascent: W.ascent, descent: W.descent };
677
677
  };
678
- for (const k of p.slice()) {
679
- const E = w.getArtboardForElement(k.id), f = k.transformData, I = (f == null ? void 0 : f.width) ?? 0, W = (f == null ? void 0 : f.height) ?? 0;
678
+ for (const k of d.slice()) {
679
+ const E = A.getArtboardForElement(k.id), u = k.transformData, I = (u == null ? void 0 : u.width) ?? 0, W = (u == null ? void 0 : u.height) ?? 0;
680
680
  if (!E || !(I > 0) || !(W > 0)) continue;
681
- const L = { left: k.x - I / 2, top: k.y - W / 2, width: I, height: W };
681
+ const P = { left: k.x - I / 2, top: k.y - W / 2, width: I, height: W };
682
682
  for (const H of e) {
683
- const Y = Me.createFromJSON(Kt(H, L, g));
684
- w.addElementToArtboard(Y.id, E.id), p.push(Y);
683
+ const Y = Me.createFromJSON(jt(H, P, g));
684
+ A.addElementToArtboard(Y.id, E.id), d.push(Y);
685
685
  }
686
686
  }
687
687
  }
688
- if (p.length > 0)
689
- i === "placeholder" && w.markPlaceholders(p.map((b) => b.id)), c((b) => [...b, ...p]), S("success"), s == null || s(n);
688
+ if (d.length > 0)
689
+ i === "placeholder" && A.markPlaceholders(d.map((b) => b.id)), c((b) => [...b, ...d]), y("success"), s == null || s(n);
690
690
  else {
691
691
  const b = new Error("Failed to load image into any artboard");
692
- S("error"), T(b), m == null || m(n, b), h({
692
+ y("error"), T(b), h == null || h(n, b), v({
693
693
  category: "image",
694
694
  message: b.message,
695
695
  originalError: b,
696
696
  recoverable: !0
697
697
  });
698
698
  }
699
- } catch (d) {
700
- const p = d instanceof Error ? d : new Error(String(d));
701
- S("error"), T(p), m == null || m(n, p), h({
699
+ } catch (m) {
700
+ const d = m instanceof Error ? m : new Error(String(m));
701
+ y("error"), T(d), h == null || h(n, d), v({
702
702
  category: "image",
703
- message: p.message,
704
- originalError: p,
703
+ message: d.message,
704
+ originalError: d,
705
705
  recoverable: !0
706
706
  });
707
707
  }
708
708
  })();
709
- }, [n, e, a, t, o, i]), { imageLoadingState: A, imageError: $ };
709
+ }, [n, e, a, t, o, i]), { imageLoadingState: S, imageError: L };
710
710
  }
711
- function Qt(r) {
711
+ function Yt(r) {
712
712
  const { onChange: n, onSelectionChange: e } = r, { elements: a, selectedId: t, artboardManager: o } = se(), { artboards: i } = he(), l = N(e);
713
713
  l.current = e, F(() => {
714
- var m;
715
- (m = l.current) == null || m.call(l, t);
714
+ var h;
715
+ (h = l.current) == null || h.call(l, t);
716
716
  }, [t]);
717
717
  const s = N(n);
718
718
  s.current = n, F(() => {
719
- const m = s.current;
720
- if (!m) return;
721
- const h = o.getActiveArtboard(), v = {
719
+ const h = s.current;
720
+ if (!h) return;
721
+ const v = o.getActiveArtboard(), p = {
722
722
  // Stamp each element with the NAME of the artboard it lives on (the
723
723
  // manager is the membership source of truth). Without this the public
724
724
  // state is flat and a multi-placement design cannot round-trip: restore
@@ -726,8 +726,8 @@ function Qt(r) {
726
726
  // states can't be derived from onChange. Pinned by
727
727
  // SnowconeCanvas.artboard-membership.test.tsx.
728
728
  elements: a.map((c) => {
729
- const w = c.toJSON(), A = o.getArtboardForElement(c.id);
730
- return A ? { ...w, artboard: A.name } : w;
729
+ const A = c.toJSON(), S = o.getArtboardForElement(c.id);
730
+ return S ? { ...A, artboard: S.name } : A;
731
731
  }),
732
732
  artboards: i.map((c) => ({
733
733
  name: c.name,
@@ -742,12 +742,12 @@ function Qt(r) {
742
742
  // set so non-template states stay byte-identical.
743
743
  ...c.role ? { role: c.role } : {}
744
744
  })),
745
- activeArtboard: (h == null ? void 0 : h.name) || "Design"
745
+ activeArtboard: (v == null ? void 0 : v.name) || "Design"
746
746
  };
747
- m(v);
747
+ h(p);
748
748
  }, [a, i]);
749
749
  }
750
- function Yt(r, n) {
750
+ function Zt(r, n) {
751
751
  const {
752
752
  autoExportInterval: e,
753
753
  autoExportConfig: a,
@@ -756,45 +756,45 @@ function Yt(r, n) {
756
756
  exportScale: i,
757
757
  maxExportSize: l,
758
758
  exportImageFormat: s,
759
- exportImageQuality: m,
760
- onExport: h,
761
- onExportScheduled: v,
759
+ exportImageQuality: h,
760
+ onExport: v,
761
+ onExportScheduled: p,
762
762
  onExportStatus: c,
763
- onExportReady: w,
764
- onReady: A,
765
- hasInitialElements: S,
766
- initialElementsLoaded: $,
763
+ onExportReady: A,
764
+ onReady: S,
765
+ hasInitialElements: y,
766
+ initialElementsLoaded: L,
767
767
  emitError: T
768
768
  } = r, {
769
- elements: u,
770
- artboardManager: x,
771
- historyManager: d,
772
- isCanvasReady: p,
769
+ elements: w,
770
+ artboardManager: f,
771
+ historyManager: m,
772
+ isCanvasReady: d,
773
773
  setCanvasReady: b
774
- } = se(), { artboards: g } = he(), { exportArtboard: k, exportAllArtboards: E, exportArtboardAsBlob: f, exportAllArtboardsAsBlobs: I } = Et(), W = N(0), L = N(0), H = N(u);
775
- H.current = u, Ze(n, () => ({
776
- exportArtboards: async (O = {}) => {
777
- const P = O.format || t, B = O.scale || i, K = O.all ?? !1;
778
- let j = B;
774
+ } = se(), { artboards: g } = he(), { exportArtboard: k, exportAllArtboards: E, exportArtboardAsBlob: u, exportAllArtboardsAsBlobs: I } = yt(), W = N(0), P = N(0), H = N(w);
775
+ H.current = w, qe(n, () => ({
776
+ exportArtboards: async ($ = {}) => {
777
+ const O = $.format || t, D = $.scale || i, K = $.all ?? !1;
778
+ let j = D;
779
779
  if (l > 0 && isFinite(l))
780
780
  for (const M of g) {
781
- const C = ge(M.width, M.height, B, l);
781
+ const C = ge(M.width, M.height, D, l);
782
782
  j = Math.min(j, C);
783
783
  }
784
- const R = { scale: j, format: s, quality: m };
784
+ const R = { scale: j, format: s, quality: h };
785
785
  if (K) {
786
- const M = P === "blob" ? await I(R) : await E(R), C = {};
787
- for (const [D, X] of Object.entries(M)) {
788
- const z = g.find((J) => J.id === D);
786
+ const M = O === "blob" ? await I(R) : await E(R), C = {};
787
+ for (const [B, X] of Object.entries(M)) {
788
+ const z = g.find((J) => J.id === B);
789
789
  z && (C[z.name] = X);
790
790
  }
791
791
  return C;
792
792
  } else {
793
- const M = x.getActiveArtboard();
793
+ const M = f.getActiveArtboard();
794
794
  if (!M)
795
795
  throw new Error("[SnowconeCanvas] No active artboard found");
796
- if (P === "blob") {
797
- const C = await f(M.id, R);
796
+ if (O === "blob") {
797
+ const C = await u(M.id, R);
798
798
  return { [M.name]: C };
799
799
  } else {
800
800
  const C = await k(M.id, R);
@@ -804,112 +804,112 @@ function Yt(r, n) {
804
804
  },
805
805
  // Print files: every artboard (or its regions), lossless PNG, full size, original picture pixels, one at a time.
806
806
  // Never the auto-export's format / maxExportSize: those keep the live preview light, a print file is the product.
807
- exportPrintFiles: (O = {}) => Gt(
807
+ exportPrintFiles: ($ = {}) => Ut(
808
808
  g,
809
- (P) => {
810
- const B = new Set(x.getElementsOnArtboard(P.id));
811
- return H.current.filter((K) => B.has(K.id));
809
+ (O) => {
810
+ const D = new Set(f.getElementsOnArtboard(O.id));
811
+ return H.current.filter((K) => D.has(K.id));
812
812
  },
813
- O
813
+ $
814
814
  )
815
- }), [k, E, f, I, t, i, l, s, m, x, g]), F(() => {
816
- w && w(async () => {
817
- const P = x.getActiveArtboard();
818
- if (!P)
815
+ }), [k, E, u, I, t, i, l, s, h, f, g]), F(() => {
816
+ A && A(async () => {
817
+ const O = f.getActiveArtboard();
818
+ if (!O)
819
819
  throw new Error("[SnowconeCanvas] No active artboard found");
820
- const B = ge(
821
- P.width,
822
- P.height,
820
+ const D = ge(
821
+ O.width,
822
+ O.height,
823
823
  i,
824
824
  l
825
- ), K = t === "blob" ? await f(P.id, { scale: B }) : await k(P.id, { scale: B });
826
- return { [P.name]: K };
825
+ ), K = t === "blob" ? await u(O.id, { scale: D }) : await k(O.id, { scale: D });
826
+ return { [O.name]: K };
827
827
  });
828
- }, [w, k, f, x, t, i, l]);
828
+ }, [A, k, u, f, t, i, l]);
829
829
  const Y = V(async () => {
830
- if (!h && !c) return;
831
- const O = ++L.current, P = Date.now();
832
- let B = i;
830
+ if (!v && !c) return;
831
+ const $ = ++P.current, O = Date.now();
832
+ let D = i;
833
833
  if (l > 0 && isFinite(l))
834
834
  for (const R of g) {
835
835
  const M = ge(R.width, R.height, i, l);
836
- B = Math.min(B, M);
836
+ D = Math.min(D, M);
837
837
  }
838
- const K = x.getActiveArtboard(), j = (K == null ? void 0 : K.id) ?? "unknown";
839
- c == null || c({ status: "rendering", artboardId: j }), W.current = P;
838
+ const K = f.getActiveArtboard(), j = (K == null ? void 0 : K.id) ?? "unknown";
839
+ c == null || c({ status: "rendering", artboardId: j }), W.current = O;
840
840
  try {
841
841
  let R;
842
842
  const M = {
843
843
  format: s,
844
- scale: B,
845
- quality: m
844
+ scale: D,
845
+ quality: h
846
846
  };
847
847
  if (t === "blob")
848
848
  if (o) {
849
849
  const C = await I(M);
850
850
  R = {};
851
- for (const [D, X] of Object.entries(C)) {
852
- const z = g.find((J) => J.id === D);
851
+ for (const [B, X] of Object.entries(C)) {
852
+ const z = g.find((J) => J.id === B);
853
853
  z && (R[z.name] = X);
854
854
  }
855
855
  } else {
856
- const C = x.getActiveArtboard();
856
+ const C = f.getActiveArtboard();
857
857
  if (!C) return;
858
- const D = await f(C.id, M);
859
- R = { [C.name]: D };
858
+ const B = await u(C.id, M);
859
+ R = { [C.name]: B };
860
860
  }
861
861
  else if (o) {
862
862
  const C = await E(M);
863
863
  R = {};
864
- for (const [D, X] of Object.entries(C)) {
865
- const z = g.find((J) => J.id === D);
864
+ for (const [B, X] of Object.entries(C)) {
865
+ const z = g.find((J) => J.id === B);
866
866
  z && (R[z.name] = X);
867
867
  }
868
868
  } else {
869
- const C = x.getActiveArtboard();
869
+ const C = f.getActiveArtboard();
870
870
  if (!C) return;
871
- const D = await k(C.id, M);
872
- R = { [C.name]: D };
871
+ const B = await k(C.id, M);
872
+ R = { [C.name]: B };
873
873
  }
874
- h == null || h(R), c == null || c({ status: "complete", artboardId: j, result: R });
874
+ v == null || v(R), c == null || c({ status: "complete", artboardId: j, result: R });
875
875
  } catch (R) {
876
876
  const M = R instanceof Error ? R.message : String(R);
877
877
  if (M.includes("Canvas ref not available"))
878
878
  return;
879
- const C = Date.now() - P;
880
- Q.error("Export failed (export #" + O + "):", {
879
+ const C = Date.now() - O;
880
+ Q.error("Export failed (export #" + $ + "):", {
881
881
  duration: `${C}ms`,
882
882
  error: M
883
883
  });
884
- const D = R instanceof Error ? R : new Error(M);
885
- c == null || c({ status: "error", artboardId: j, error: D }), T({
884
+ const B = R instanceof Error ? R : new Error(M);
885
+ c == null || c({ status: "error", artboardId: j, error: B }), T({
886
886
  category: "export",
887
- message: D.message,
888
- originalError: D,
887
+ message: B.message,
888
+ originalError: B,
889
889
  artboardId: j,
890
890
  recoverable: !0
891
891
  });
892
892
  }
893
- }, [h, c, o, t, i, l, s, m, k, E, f, I, g, x, u, a, T]);
893
+ }, [v, c, o, t, i, l, s, h, k, E, u, I, g, f, w, a, T]);
894
894
  F(() => {
895
895
  e !== void 0 && e > 0 && Q.warn(
896
896
  "autoExportInterval is deprecated and ignored. Use autoExportConfig={{ enabled: true, debounceMs: 100, maxWaitMs: 1000 }} instead."
897
897
  );
898
898
  }, []);
899
899
  const de = V(() => {
900
- if (v == null || v(), c) {
901
- const O = x.getActiveArtboard();
902
- c({ status: "scheduled", artboardId: (O == null ? void 0 : O.id) ?? "unknown" });
900
+ if (p == null || p(), c) {
901
+ const $ = f.getActiveArtboard();
902
+ c({ status: "scheduled", artboardId: ($ == null ? void 0 : $.id) ?? "unknown" });
903
903
  }
904
- }, [v, c, x]), re = Wt({
905
- isCanvasReady: p,
906
- elements: u,
907
- hasInitialElements: S,
908
- initialElementsLoaded: $
904
+ }, [p, c, f]), re = Ht({
905
+ isCanvasReady: d,
906
+ elements: w,
907
+ hasInitialElements: y,
908
+ initialElementsLoaded: L
909
909
  }), ie = N(!1);
910
910
  F(() => {
911
- re && !ie.current && (ie.current = !0, A == null || A());
912
- }, [re, A]), $t({
911
+ re && !ie.current && (ie.current = !0, S == null || S());
912
+ }, [re, S]), Ot({
913
913
  config: a ? {
914
914
  enabled: a.enabled ?? !0,
915
915
  debounceMs: a.debounceMs ?? 100,
@@ -918,25 +918,25 @@ function Yt(r, n) {
918
918
  enabled: !1
919
919
  // Only use smart export if autoExportConfig is provided
920
920
  },
921
- historyManager: d,
921
+ historyManager: m,
922
922
  artboards: g,
923
- elements: u,
923
+ elements: w,
924
924
  onExport: Y,
925
925
  onExportScheduled: de,
926
926
  isCanvasReady: re
927
927
  // Gate exports until content is fully ready (fonts loaded, elements deserialized)
928
928
  }), F(() => {
929
- if (g.length > 0 && !p) {
930
- const O = requestAnimationFrame(() => {
929
+ if (g.length > 0 && !d) {
930
+ const $ = requestAnimationFrame(() => {
931
931
  b(!0);
932
932
  });
933
- return () => cancelAnimationFrame(O);
933
+ return () => cancelAnimationFrame($);
934
934
  }
935
- }, [g.length, p, b]), F(() => () => {
935
+ }, [g.length, d, b]), F(() => () => {
936
936
  b(!1);
937
937
  }, [b]);
938
938
  }
939
- async function Zt(r) {
939
+ async function qt(r) {
940
940
  if (typeof document > "u" || r.length === 0) return [];
941
941
  const n = document.fonts ?? null;
942
942
  return await Promise.all(
@@ -957,7 +957,7 @@ async function Zt(r) {
957
957
  }
958
958
  })) : [];
959
959
  }
960
- const Fe = te("SnowconeCanvas"), Le = Ce((r, n) => {
960
+ const Fe = te("SnowconeCanvas"), Pe = Ce((r, n) => {
961
961
  var we;
962
962
  const {
963
963
  exportConfig: e,
@@ -967,104 +967,106 @@ const Fe = te("SnowconeCanvas"), Le = Ce((r, n) => {
967
967
  artboards: i,
968
968
  activeArtboard: l,
969
969
  onArtboardChange: s,
970
- initialElements: m,
971
- customFonts: h,
972
- onChange: v,
973
- onSelectionChange: c,
974
- autoExportInterval: w,
975
- onExport: A,
976
- onExportScheduled: S,
977
- onExportStatus: $,
978
- onExportReady: T,
979
- onImageLoad: u,
980
- onImageError: x,
970
+ initialElements: h,
971
+ initialElementsRole: v,
972
+ customFonts: p,
973
+ onChange: c,
974
+ onSelectionChange: A,
975
+ autoExportInterval: S,
976
+ onExport: y,
977
+ onExportScheduled: L,
978
+ onExportStatus: T,
979
+ onExportReady: w,
980
+ onImageLoad: f,
981
+ onImageError: m,
981
982
  onImageLoadError: d,
982
- onError: p,
983
- onReady: b,
984
- className: g,
985
- style: k,
986
- enableShortcuts: E,
987
- overlay: f,
988
- resetDocumentOnMount: I
989
- } = r, W = w, L = r.autoExportConfig ?? (e == null ? void 0 : e.autoExportConfig), H = r.autoExportFormat ?? (e == null ? void 0 : e.format) ?? "dataUrl", Y = r.autoExportAll ?? (e == null ? void 0 : e.exportAll) ?? !1, de = r.exportScale ?? (e == null ? void 0 : e.scale) ?? 2, re = r.maxExportSize ?? (e == null ? void 0 : e.maxSize) ?? 4e3, ie = r.exportImageFormat ?? (e == null ? void 0 : e.imageFormat) ?? "png", O = r.exportImageQuality ?? (e == null ? void 0 : e.imageQuality) ?? 0.92, P = r.initialImage ?? (a == null ? void 0 : a.src), B = r.initialImageAlignment ?? (a == null ? void 0 : a.alignment) ?? "center", K = r.initialImageScale ?? (a == null ? void 0 : a.scale) ?? 1, j = r.initialImageScaleMode ?? (a == null ? void 0 : a.scaleMode) ?? "cover", R = r.initialImageRole ?? (a == null ? void 0 : a.role) ?? "design", M = Qe.useMemo(() => Ht(r.initialImageText, P), [r.initialImageText, P]), C = r.width ?? (t == null ? void 0 : t.width) ?? 1200, D = r.height ?? (t == null ? void 0 : t.height) ?? 1200, X = r.viewPadding ?? (t == null ? void 0 : t.viewPadding) ?? 0.9, z = r.artboardBorderRadius ?? (t == null ? void 0 : t.artboardBorderRadius) ?? 0, J = r.fixedMargin ?? (t == null ? void 0 : t.fixedMargin), Pe = r.maxHeight ?? (t == null ? void 0 : t.maxHeight), $e = r.showRotationHandle ?? (t == null ? void 0 : t.showRotationHandle) ?? !0, Oe = r.hideCanvas ?? (t == null ? void 0 : t.hideCanvas) ?? !1, be = r.canvasWrapperClassName ?? (t == null ? void 0 : t.canvasWrapperClassName), ve = r.canvasWrapperStyle ?? (t == null ? void 0 : t.canvasWrapperStyle), De = r.canvasCutouts ?? (t == null ? void 0 : t.canvasCutouts), Ee = r.pieceGuides, Be = r.pieceFocus, We = E ?? !0, Z = Re(() => it(o ?? "pro-studio"), [o]);
983
+ onError: b,
984
+ onReady: g,
985
+ className: k,
986
+ style: E,
987
+ enableShortcuts: u,
988
+ overlay: I,
989
+ resetDocumentOnMount: W
990
+ } = r, P = S, H = r.autoExportConfig ?? (e == null ? void 0 : e.autoExportConfig), Y = r.autoExportFormat ?? (e == null ? void 0 : e.format) ?? "dataUrl", de = r.autoExportAll ?? (e == null ? void 0 : e.exportAll) ?? !1, re = r.exportScale ?? (e == null ? void 0 : e.scale) ?? 2, ie = r.maxExportSize ?? (e == null ? void 0 : e.maxSize) ?? 4e3, $ = r.exportImageFormat ?? (e == null ? void 0 : e.imageFormat) ?? "png", O = r.exportImageQuality ?? (e == null ? void 0 : e.imageQuality) ?? 0.92, D = r.initialImage ?? (a == null ? void 0 : a.src), K = r.initialImageAlignment ?? (a == null ? void 0 : a.alignment) ?? "center", j = r.initialImageScale ?? (a == null ? void 0 : a.scale) ?? 1, R = r.initialImageScaleMode ?? (a == null ? void 0 : a.scaleMode) ?? "cover", M = r.initialImageRole ?? (a == null ? void 0 : a.role) ?? "design", C = Ye.useMemo(() => Kt(r.initialImageText, D), [r.initialImageText, D]), B = r.width ?? (t == null ? void 0 : t.width) ?? 1200, X = r.height ?? (t == null ? void 0 : t.height) ?? 1200, z = r.viewPadding ?? (t == null ? void 0 : t.viewPadding) ?? 0.9, J = r.artboardBorderRadius ?? (t == null ? void 0 : t.artboardBorderRadius) ?? 0, Le = r.fixedMargin ?? (t == null ? void 0 : t.fixedMargin), $e = r.maxHeight ?? (t == null ? void 0 : t.maxHeight), Oe = r.showRotationHandle ?? (t == null ? void 0 : t.showRotationHandle) ?? !0, De = r.hideCanvas ?? (t == null ? void 0 : t.hideCanvas) ?? !1, be = r.canvasWrapperClassName ?? (t == null ? void 0 : t.canvasWrapperClassName), ve = r.canvasWrapperStyle ?? (t == null ? void 0 : t.canvasWrapperStyle), Be = r.canvasCutouts ?? (t == null ? void 0 : t.canvasCutouts), Ee = r.pieceGuides, We = r.pieceFocus, He = u ?? !0, Z = Re(() => ct(o ?? "pro-studio"), [o]);
990
991
  F(() => {
991
992
  var U;
992
993
  if (typeof ee < "u" && ((U = ee.env) == null ? void 0 : U.NODE_ENV) === "development" && Z) {
993
- const G = ct(Z);
994
+ const G = lt(Z);
994
995
  G.valid || Fe.warn("Kit validation warnings:", G.errors), G.warnings.length > 0 && Fe.warn("Kit validation warnings:", G.warnings);
995
996
  }
996
997
  }, [Z]), F(() => {
997
998
  if (d)
998
- return Xe(d);
999
+ return Je(d);
999
1000
  }, [d]);
1000
- const { emitError: ue, handleBoundaryError: He } = Ut(p);
1001
- Vt({
1001
+ const { emitError: ue, handleBoundaryError: Ke } = Vt(b);
1002
+ Xt({
1002
1003
  artboardConfigs: i,
1003
- width: C,
1004
- height: D,
1004
+ width: B,
1005
+ height: X,
1005
1006
  pieceGuides: Ee,
1006
1007
  controlledActiveArtboard: l,
1007
1008
  onArtboardChange: s,
1008
- resetDocumentOnMount: I
1009
+ resetDocumentOnMount: W
1009
1010
  });
1010
- const { initialElementsLoadedState: Ke } = Xt({
1011
- initialElements: m,
1012
- customFonts: h,
1011
+ const { initialElementsLoadedState: je } = Jt({
1012
+ initialElements: h,
1013
+ role: v ?? "design",
1014
+ customFonts: p,
1013
1015
  emitError: ue
1014
- }), { imageLoadingState: ye, imageError: xe } = Jt({
1015
- initialImage: P,
1016
- initialImageText: M,
1017
- initialImageAlignment: B,
1018
- initialImageScale: K,
1019
- initialImageScaleMode: j,
1020
- initialImageRole: R,
1016
+ }), { imageLoadingState: ye, imageError: xe } = Qt({
1017
+ initialImage: D,
1018
+ initialImageText: C,
1019
+ initialImageAlignment: K,
1020
+ initialImageScale: j,
1021
+ initialImageScaleMode: R,
1022
+ initialImageRole: M,
1021
1023
  artboardConfigs: i,
1022
- onImageLoad: u,
1023
- onImageError: x,
1024
+ onImageLoad: f,
1025
+ onImageError: m,
1024
1026
  emitError: ue
1025
1027
  });
1026
- if (Qt({ onChange: v, onSelectionChange: c }), Yt(
1028
+ if (Yt({ onChange: c, onSelectionChange: A }), Zt(
1027
1029
  {
1028
- autoExportInterval: W,
1029
- autoExportConfig: L,
1030
- autoExportFormat: H,
1031
- autoExportAll: Y,
1032
- exportScale: de,
1033
- maxExportSize: re,
1034
- exportImageFormat: ie,
1030
+ autoExportInterval: P,
1031
+ autoExportConfig: H,
1032
+ autoExportFormat: Y,
1033
+ autoExportAll: de,
1034
+ exportScale: re,
1035
+ maxExportSize: ie,
1036
+ exportImageFormat: $,
1035
1037
  exportImageQuality: O,
1036
- onExport: A,
1037
- onExportScheduled: S,
1038
- onExportStatus: $,
1039
- onExportReady: T,
1040
- onReady: b,
1041
- hasInitialElements: !!m && m.length > 0,
1042
- initialElementsLoaded: Ke,
1038
+ onExport: y,
1039
+ onExportScheduled: L,
1040
+ onExportStatus: T,
1041
+ onExportReady: w,
1042
+ onReady: g,
1043
+ hasInitialElements: !!h && h.length > 0,
1044
+ initialElementsLoaded: je,
1043
1045
  emitError: ue
1044
1046
  },
1045
1047
  n
1046
1048
  ), ye === "loading")
1047
- return /* @__PURE__ */ y(
1049
+ return /* @__PURE__ */ x(
1048
1050
  "div",
1049
1051
  {
1050
- className: g,
1052
+ className: k,
1051
1053
  style: {
1052
- ...k,
1054
+ ...E,
1053
1055
  display: "flex",
1054
1056
  alignItems: "center",
1055
1057
  justifyContent: "center",
1056
1058
  backgroundColor: "var(--surface, #f5f5f5)"
1057
1059
  },
1058
- children: /* @__PURE__ */ y(lt, { size: 48 })
1060
+ children: /* @__PURE__ */ x(dt, { size: 48 })
1059
1061
  }
1060
1062
  );
1061
1063
  if (ye === "error" && xe)
1062
- return /* @__PURE__ */ y(
1064
+ return /* @__PURE__ */ x(
1063
1065
  "div",
1064
1066
  {
1065
- className: g,
1067
+ className: k,
1066
1068
  style: {
1067
- ...k,
1069
+ ...E,
1068
1070
  display: "flex",
1069
1071
  alignItems: "center",
1070
1072
  justifyContent: "center",
@@ -1073,18 +1075,18 @@ const Fe = te("SnowconeCanvas"), Le = Ce((r, n) => {
1073
1075
  padding: "1rem"
1074
1076
  },
1075
1077
  children: /* @__PURE__ */ _("div", { className: "sc:text-center", children: [
1076
- /* @__PURE__ */ y("div", { className: "sc:font-medium", children: "Failed to load image" }),
1077
- /* @__PURE__ */ y("div", { className: "sc:text-sm sc:mt-1 sc:opacity-70", children: xe.message })
1078
+ /* @__PURE__ */ x("div", { className: "sc:font-medium", children: "Failed to load image" }),
1079
+ /* @__PURE__ */ x("div", { className: "sc:text-sm sc:mt-1 sc:opacity-70", children: xe.message })
1078
1080
  ] })
1079
1081
  }
1080
1082
  );
1081
- const je = Object.entries(((we = Z.layout) == null ? void 0 : we.slots) ?? {}).every(
1083
+ const ze = Object.entries(((we = Z.layout) == null ? void 0 : we.slots) ?? {}).every(
1082
1084
  ([U, G]) => U === "canvas" || !G || G.length === 0
1083
1085
  ) ? { "--color-canvas-bg": "transparent" } : void 0;
1084
- return /* @__PURE__ */ y(dt, { kit: Z, children: /* @__PURE__ */ y("div", { className: `sc-root ${g || ""}`, style: { ...je, ...k, position: "relative" }, children: /* @__PURE__ */ _(
1085
- Nt,
1086
+ return /* @__PURE__ */ x(ut, { kit: Z, children: /* @__PURE__ */ x("div", { className: `sc-root ${k || ""}`, style: { ...ze, ...E, position: "relative" }, children: /* @__PURE__ */ _(
1087
+ Pt,
1086
1088
  {
1087
- onError: He,
1089
+ onError: Ke,
1088
1090
  fallback: (U, G) => /* @__PURE__ */ _(
1089
1091
  "div",
1090
1092
  {
@@ -1101,9 +1103,9 @@ const Fe = te("SnowconeCanvas"), Le = Ce((r, n) => {
1101
1103
  textAlign: "center"
1102
1104
  },
1103
1105
  children: [
1104
- /* @__PURE__ */ y("div", { style: { fontSize: "18px", fontWeight: 600, marginBottom: "8px" }, children: "Something went wrong" }),
1105
- /* @__PURE__ */ y("div", { style: { fontSize: "14px", opacity: 0.7, marginBottom: "16px", maxWidth: "400px" }, children: U.message }),
1106
- /* @__PURE__ */ y(
1106
+ /* @__PURE__ */ x("div", { style: { fontSize: "18px", fontWeight: 600, marginBottom: "8px" }, children: "Something went wrong" }),
1107
+ /* @__PURE__ */ x("div", { style: { fontSize: "14px", opacity: 0.7, marginBottom: "16px", maxWidth: "400px" }, children: U.message }),
1108
+ /* @__PURE__ */ x(
1107
1109
  "button",
1108
1110
  {
1109
1111
  onClick: G,
@@ -1124,49 +1126,49 @@ const Fe = te("SnowconeCanvas"), Le = Ce((r, n) => {
1124
1126
  }
1125
1127
  ),
1126
1128
  children: [
1127
- !Oe && /* @__PURE__ */ (() => {
1128
- const U = /* @__PURE__ */ y(
1129
- ut,
1129
+ !De && /* @__PURE__ */ (() => {
1130
+ const U = /* @__PURE__ */ x(
1131
+ ft,
1130
1132
  {
1131
1133
  style: { width: "100%" },
1132
- fitPadding: X,
1133
- artboardBorderRadius: z,
1134
- fixedMargin: J,
1135
- maxHeight: Pe,
1136
- showRotationHandle: $e,
1137
- enableShortcuts: We,
1138
- canvasCutouts: De,
1134
+ fitPadding: z,
1135
+ artboardBorderRadius: J,
1136
+ fixedMargin: Le,
1137
+ maxHeight: $e,
1138
+ showRotationHandle: Oe,
1139
+ enableShortcuts: He,
1140
+ canvasCutouts: Be,
1139
1141
  pieceGuides: Ee,
1140
- pieceFocus: Be
1142
+ pieceFocus: We
1141
1143
  }
1142
1144
  );
1143
- return /* @__PURE__ */ y(Mt, { kit: Z, canvas: be || ve ? /* @__PURE__ */ y("div", { className: be, style: ve, children: U }) : U });
1145
+ return /* @__PURE__ */ x(Tt, { kit: Z, canvas: be || ve ? /* @__PURE__ */ x("div", { className: be, style: ve, children: U }) : U });
1144
1146
  })(),
1145
- f
1147
+ I
1146
1148
  ]
1147
1149
  }
1148
1150
  ) }) });
1149
1151
  });
1150
- Le.displayName = "SnowconeCanvasInner";
1151
- const qt = Ce((r, n) => {
1152
+ Pe.displayName = "SnowconeCanvasInner";
1153
+ const _t = Ce((r, n) => {
1152
1154
  var i;
1153
1155
  const { inheritTheme: e, externalProvider: a, services: t } = r, o = r.viewPadding ?? ((i = r.layoutConfig) == null ? void 0 : i.viewPadding);
1154
- return /* @__PURE__ */ y(
1156
+ return /* @__PURE__ */ x(
1155
1157
  Lt,
1156
1158
  {
1157
1159
  inheritTheme: e,
1158
1160
  externalProvider: a,
1159
1161
  services: t,
1160
1162
  viewPadding: o,
1161
- children: /* @__PURE__ */ y(Le, { ref: n, ...r })
1163
+ children: /* @__PURE__ */ x(Pe, { ref: n, ...r })
1162
1164
  }
1163
1165
  );
1164
1166
  });
1165
- qt.displayName = "SnowconeCanvas";
1167
+ _t.displayName = "SnowconeCanvas";
1166
1168
  export {
1167
- Nt as E,
1168
- qt as S,
1169
- Wt as a,
1170
- $t as u
1169
+ Pt as E,
1170
+ _t as S,
1171
+ Ht as a,
1172
+ Ot as u
1171
1173
  };
1172
- //# sourceMappingURL=SnowconeCanvas-COXpmwkS.js.map
1174
+ //# sourceMappingURL=SnowconeCanvas-crxPwbib.js.map